Put_parm, The int data type, The float/double data type – Crunch CRiSP File Editor 6 User Manual
Page 21: The string datatype

Page 21
{
d = max(a, b, c);
}
Note the ampersand after the type specifier for the last parameter in the list. Variables which are passed by
reference are noted by the crunch compiler and any assignments to these variables cause the right thing to
happen, i.e. the callers argument is updated.
The pass by reference mechanism shown above is actually implemented using the lower level put_parm()
primitive. Put_parm() is a special macro primitive which lets you assign values to the calling functions
parameters. The function takes two arguments - a number indicating which parameter to update and a
value. The above example could be written as:
put_parm
void get_max(int a, int b, int c)
{
put_parm(3, max(a, b, c));
}
The call-by-reference mechanism is new in CRiSP version 6, so many of the existing macros supplied with
CRiSP still use this older mechanism.
If you call the above function without specifying an appropriately typed variable for the return value, then you
are likely to get a macro error at run time or some other undefined behaviour. For example:
get_max(1, 2, 3, 4);
will result in an error because the 4 being passed is not a legal value to which CRiSP can assign a value to.
{button See Also, ALink(crunch,,,)}
The int data type
The int keyword is used to declare integer variables, i.e. variables which can hold only integral values.
CRiSP currently only supports 32-bit integers (i.e. chars and longs are not supported nor their
signed/unsigned counterparts). Integer variables are 32-bit twos complement numbers. The 32-bit word size
is chosen for maximum portability and usefulness.
Integer variables are used for many reasons -- as counters, indices, buffer identifiers, etc. The full
complement of C operators are supported for manipulating integer variables.
Integers are always stored in macros in a machine independent fashion. This means that compiled macros
using integer variables are portable to machines with different byte orderings.
{button See Also, ALink(crunch,,,)}
The float/double data type
The float and double data types are supported to facilitate implementation of macros which need to use
floating point numbers, e.g. the calculator macros, and the sum macro. CRiSP has no internal use for
floating point numbers.
CRiSP stores floating point numbers using the native C compilers double keyword, normally corresponding
to a 64-bit quantity.
Floating point numbers are declared using the float or double keywords. Currently these two keywords are
treated as being identical. It is recommended that users use the float or double keywords as appropriate to
the task in hand. Later versions of CRiSP may support a shorter floating point type for efficiency.
Floating point constants compiled into macros are NOT stored in a machine independent manner, and thus
compiled macros may not be portable to different machines.
Floating point numbers may be implicitly cast into integer values under certain circumstances.
{button See Also, ALink(crunch,,,)}
The string datatype
CRiSP supports a dynamic string data type. Strings variables may be used to store arbitrary length strings
(up to 64K on 16 bit machines and 4GB on 32-bit machines). Strings may be used to store any sequence of
characters, although storing the NULL character (ASCII 0) may cause problems, e.g. when determining the