,ll 6.6
,cs 10
,pl 66
,lm 0.2,0.5
,pn 19
,ju
,hd
,ce
OmegaSoft 6809 Cross Pascal Language Handbook (V1.0)
,,
,ft

,ce 1
6-##
,,
,ce
OmegaSoft 6809 Cross Pascal Language Handbook (V1.0)

,ce
STRING FUNCTIONS

CLINE

Returns a string with the contents of the command line (running under operating system only). If no parameter is provided or if the parameter has a value of zero then the entire command line will be returned. If the parameter is a positive number "n" then the "nth" command line argument will be returned. If there is no argument "n" then a null string will be returned. Command line arguments are separated by spaces or commas.

If the parameter is equal to -3 then the character "<" and the characters that follow it will be returned. If there is no "<" character then a null string will be returned. In a similar manner -2 will look for ">" and -1 will look for ">>".

Example : command line = >test.file -abcd this is a test
     cline = '>test.file -abcd this is a test'
     cline(-3) = ''
     cline(-2) = '>test.file'
     cline(1) = '-abcd'
     cline(2) = 'this'

cline-function = cline [( (integer-expression |
                           character-expression) )

CONCAT

Returns a string that is the concatenation of its parameters. The parameters will be concatenated in the order in which they are listed. If the resulting string would exceed 126 characters the concatenation is not performed and a dynamic length error will be generated.

Example : 
  concat ('Number five is ',string(5)) = 'Number five is 5'

concat-function = concat ( param {, param} )
param = (character-expression | string-expression)

INDEX

Returns an integer that corresponds to the location that one string is contained within another. The result is the location (starting character number) in the first parameter where the second parameter occurs. If there is no occurrence then 0 will be returned.

Examples : index ('This is a test', 'what') = 0
           index ('This is a test', 'is') = 6

index-function = index ( param , param )
param = (character-expression | string-expression)
,pg
,ce
STRING FUNCTIONS

LENGTH

Returns an integer in the range of 0 to 126 that represents the current dynamic length of a string parameter. This function is similar to :

ord (parameter[0])

If you just need a byte equivalent of the dynamic length then it is faster to use

parameter[0]  rather than   chr(length(parameter))

Of course if you need the length of an expression rather than of a variable you must use the length function.

Examples : length ('This is a test') = 14
           length ('') = 0

length-function = length ( string-expression )

SUBSTR

Returns a string that is a subrange of the string parameter. The subrange is defined by a starting expression which is the first character to include and by a count expression which is the number of characters to include. If the sum of the starting and count expressions would exceed 126 or if the start expression is 0 then an error occurs. If the starting expression is past the end of the string then a null string will be returned. If the sum of the starting and count expressions is past the end of the string no error will be generated, the result string will just be shorter than the count expression specifies.

Examples : substr ('This is a test', 3,7) = 'is is a'
           substr ('This is a test', 8,9) = ' a test'
           substr ('This is a test', 25,5) = ''

substr-function = substr ( string-param , start-expression ,
                                          count-expression )
string-param = (character-expression | string-expression)
start-expression = count-expression = (integer-expression |
                                      char-expression)

UPSHIFT

Returns a character or string with each character that lies in the range "a" .. "z" converted to lie in the range "A" .. "Z". This function will return the same type as its parameter.

Examples : upshift ('a') = 'A'  upshift ('Test') = 'TEST'

upshift-function = upshift ( (string-expression | 
                              character-expression) )

,pg

,ce
MISCELLANEOUS FUNCTIONS

ADDR

Returns the hex absolute address of a variable or procedure. This is useful for doing all sorts of devious things with pointers. For instance, to access the device descriptor for the standard output device :

type
  descriptor = record
                 mode : byte ;
                 err : byte ;
                 drv : hex ;
                 elnt : integer ;
                 elmt : char ;
               end ;
var
  ptr : ^descriptor ;
begin
  ptr := addr (output) ;
  write ('Element length is : ',ptr^.elnt)

Will write out the element length

This function will also return the address of a procedure, but the procedure must be defined as entry, external, interrupt, firq, or at an absolute address.

addr-function = addr ( (variable | procedure-identifier |
                                   function-identifier) )

PRED

Will return the value of its parameter decremented by one. The return type will be the same as the parameter type. For example :

type
  colors = (red, blue, green) ;
var
  a : byte ;
  b : integer ;
  c : colors ;
  d : boolean ;
begin
  a := pred (#5) ; { result is #4 }
  b := pred (5) ; {result is 4 }
  c := pred (green) ; { result is blue }
  d := pred (true) ; { result is false }
  .
  .

This function cannot generate an overflow, the one byte or two byte value will simply wrap around zero.

pred-function = pred ( (boolean-expression | 
                        hex-expression |
                        integer-expression |
                        enumerated-expression |
                        character-expression) )
,pg
,ce
MISCELLANEOUS FUNCTIONS

SIZEOF

Returns the integer size (in bytes) of its type or variable parameter. If the type contains a variant record the size returned will be the size of the largest variant. The parameter must be an entire variable (for example, indexing of an array is not allowed).

Example : abc : record
                  def : integer ;
                  ghi : string[10]
                end ;

sizeof (abc) = 13     sizeof (real) = 4     

sizeof-function = sizeof ( (type-identifier | entire-variable) )

SUCC

Will return the value of its parameter incremented by one. The return type will be the same as the parameter type. For example :

type
  colors = (red, blue, green) ;
var
  a : byte ;
  b : integer ;
  c : colors ;
  d : boolean ;
begin
  a := succ (#5) ; { result is #6 }
  b := succ (5) ; {result is 6 }
  c := succ (red) ; { result is blue }
  d := succ (false) ; { result is true }
  .
  .

This function cannot generate an overflow, the one byte or two byte value will simply wrap around zero.

succ-function = succ ( (boolean-expression | 
                        hex-expression |
                        integer-expression |
                        enumerated-expression |
                        character-expression) )

,ce
I/O PROCEDURES

CLOSE

Will send a signal code to the device driver to terminate use of that device, or in the case of a disk file will do an operating system close to the file that was open. No further data transfers may take place to the device until it is re-opened. This procedure is normally ignored by non-disk devices.

If any files or non-standard devices are opened in your program, you should close them before exiting your program rather than relying on the operating system to do it.

