Sambar Server Documentation

CScript Constants


A constant is usually just the written version of a number. For example 1, 0, 5.73, 12.5e9. You can specify constants in octal or hexadecimal, or force them to be treated as long integers.

Octal constants are written with a leading zero, i.e. 015. Hexadecimal constants are written with a leading 0x, i.e. 0x1ae. Character constants are usually just the character enclosed in single quotes; 'a', 'b', 'c'. Some characters can't be represented in this way, so a 2 character sequence is used:

'\n'newline
'\t'tab
'\\'backslash
'\''single quote
'\0'NULL
A string constant is surrounded by double quotes, e.g. "Sambar Server". The string is actually stored as an array of characters. The NULL character '\0' is automatically placed at the end of such a string; this acts as a string terminator.

Below are some examples of other types of constants:

int123, -1, 2147483647, 040 (octal), 0xab (hexadecimal)
double1.23, 3.14e+0f
Note: An integer starting with a zero is assumed to be octal, unless the character after the zero is an 'x' or 'X', in which case the number is assumed to be in hexadecimal.

ASCII Character Codes

HexOctalASCII   HexOctalASCII   HexOctalASCII   HexOctalASCII   HexOctalASCII   HexOctalASCII
21041!22042"23043#24044$25045%26046&
27047'28050(29051)2a052*2b053+2c054,
2d055-2e056.2f057/300600310611320622
330633340644350655360666370677380708
3907193a072:3b073;3c074<3d075=3e076>
3f077?40100@41101A42102B43103C44104D
45105E46106F47107G48110H49111I4a112J
4b113K4c114L4d115M4e116N4f117O50120P
51121Q52122R53123S54124T55125U56126V
57127W58130X59131Y5a132Z5b133[5c134\
5d135]5e136^5f137_60140`61141a62142b
63143c64144d65145e66146f67147g68150h
69151i6a152j6b153k6c154l6d155m6e156n
6f157o70160p71161q72162r73163s74164t
75165u76166v77167w78170x79171y7a172z
7b173{7c174|7d175}7e176~

Predefined Constants

The predefined constants that are always available are:
__FILE__The name of the script file presently being executed. If used within a file which has been included, then the name of the included file is given, and not the name of the parent file.
__LINE__The number of the line within the current file which is being parsed. If used within a file which has been included, then the position within the included file is given.
__MEMORY__The amount of memory consumed thus far in the program.
__CALLDEPTH__The call depth of the program at this point in the execution.
__STATEMENTS__The number of statements executed so far in the program.
TRUEA true value (integer 1).
FALSEA false value (integer 0).
NULLThe NULL value.

© 2001 Sambar Technologies. All rights reserved. Terms of Use.