User guide

18 CHAPTER 2. THE BCPL LANGUAGE
length and bytes of the string are packed. If s is a str i n g t h en s%0 is its length
and s%1 is its first character, see Section 2.2.6. The *# escapes allow Unicode
and GB2312 chara ct er s to be handled. For instance, if the following statements
output to a suitable UTF8 configured device:
writef("*#uUnicode hex 2200 prints as: ’*#2200’*n"}
writef("%%# in writef can also be used: ’%#’*n", #x2200)
the result is as follows
Unicode hex 2200 prints as: ’ %# in writef can also be used: ’
A static vector can be created using an expression of the following form:
TABLE K
0
, . . . , K
n
where K
0
, . . . , K
n
are manifest constant expressions, see Sec-
tion 2.2.10. The space for a static vector is allocated for th e lifetime of the
program and its elements are updateable.
2.2.3 Function Calls
Syntactically, a function call is an expression followed by an argument list enclosed
in paretheses as in th e following examp l es.
newline()
mk3(Mult, x, y)
writef("f(%n) = %n*n", i, f(i))
f(1,2,3)
(fntab!i)(p, @a)
The parentheses are required even if no arguments are given. The last exampl e
above illustrates a call in which the function is specified by an expression. If the
function being called was declared by a routin e declaration , the result of the call
will be undefined. See Sectio n 2.4.8 for more details.
2.2.4 Method Calls
Method calls are designed to make an object oriented style of programming more
convenient. They are syntactically similar to a function calls but uses a hash
symbol (#) to separate the function specifier from its arguments. The expression:
E#(E
1
,..,E
n
)
is defined to be equivalent to:
(E
1
!0!E)(E
1
,..,E
n
)