Alien-LibJIT
view release on metacpan or search on metacpan
libjit/doc/libjit.texi view on Meta::CPAN
Some GNU Pascal operators like @code{xor}, @code{shl}, @code{@@}, etc
have been added.
@item
The integer type names (@code{Integer}, @code{Cardinal}, @code{LongInt}, etc)
follow those used in GNU Pascal also. The @code{Integer} type is always
32-bits in size, while @code{LongInt} is always 64-bits in size.
@item
The types @code{SysInt}, @code{SysCard}, @code{SysLong}, @code{SysLongCard},
@code{SysLongestInt}, and @code{SysLongestCard} are guaranteed to be the
same size as the underlying C system's @code{int}, @code{unsigned int},
@code{long}, @code{unsigned long}, @code{long long}, and
@code{unsigned long long} types.
@item
The type @code{Address} is logically equivalent to C's @code{void *}.
Any pointer or array can be implicitly cast to @code{Address}. An explicit
cast is required to cast back to a typed pointer (you cannot cast back
to an array).
@item
The @code{String} type is declared as @code{^Char}. Single-dimensional
arrays of @code{Char} can be implicitly cast to any @code{String}
destination. Strings are not bounds-checked, so be careful. Arrays
are bounds-checked.
@item
Pointers can be used as arrays. e.g. @code{p[n]} will access the n'th
item of an unbounded array located at @code{p}. Use with care.
@item
We don't support @code{file of} types. Data can be written to stdout
using @code{Write} and @code{WriteLn}, but that is the extent of
the I/O facilities.
@item
The declaration @code{import Name1, Name2, ...;} can be used at the head of a
program to declare additional files to include. e.g. @code{import stdio} will
import the contents of @code{stdio.pas}. We don't support units.
@item
The idiom @code{; ..} can be used at the end of a formal parameter list to
declare that the procedure or function takes a variable number of arguments.
The builtin function @code{va_arg(Type)} is used to extract the arguments.
@item
The directive @code{import("Library")} can be used to declare that a function
or procedure was imported from an external C library. For example, the
following imports the C @code{puts} and @code{printf} functions:
@example
function puts (str : String) : SysInt; import ("libc")
function printf (format : String; ..) : SysInt; import ("libc")
@end example
Functions that are imported in this manner have case-sensitive names.
i.e. using @code{Printf} above will fail.
@item
The @code{throw} keyword can be used to throw an exception. The argument
must be a pointer. The @code{try}, @code{catch}, and @code{finally}
keywords are used to manage such exceptions further up the stack. e.g.
@example
try
...
catch Name : Type
...
finally
...
end
@end example
The @code{catch} block will be invoked with the exception pointer that was
supplied to @code{throw}, after casting it to @code{Type} (which must
be a pointer type). Specifying @code{throw} on its own without an argument
will rethrow the current exception pointer, and can only be used inside a
@code{catch} block.
Dynamic Pascal does not actually check the type of the thrown pointer.
If you have multiple kinds of exceptions, then you must store some kind
of type indicator in the block that is thrown and then inspect @code{^Name}
to see what the indicator says.
@item
The @code{exit} keyword can be used to break out of a loop.
@item
Function calls can be used as procedure calls. The return value is ignored.
@item
Hexadecimal constants can be expressed as @code{XXH}. The first digit
must be between 0 and 9, but the remaining digits can be any hex digit.
@item
Ternary conditionals can be expressed as @code{(if e1 then e2 else e3)}.
The brackets are required. This is equivalent to C's @code{e1 ? e2 : e3}.
@item
Assigning to a function result will immediately return. i.e. it is
similar to @code{return value;} in C. It isn't necessary to arrange for
execution to flow through to the end of the function as in regular Pascal.
@item
The term @code{sizeof(Type)} can be used to get the size of a type.
@item
Procedure and function headings can appear in a record type to declare a
field with a @code{pointer to procedure/function} type.
@end enumerate
@c -----------------------------------------------------------------------
@node Initialization, Functions, Dynamic Pascal, Top
@chapter Initializing the JIT
@cindex Initialization
@cindex Contexts
@include libjitext-init.texi
@include libjitext-context.texi
@c -----------------------------------------------------------------------
@node Functions, Types, Initialization, Top
@chapter Building and compiling functions with the JIT
@cindex Building functions
@cindex Compiling functions
@include libjitext-function.texi
@c -----------------------------------------------------------------------
@node Types, Values, Functions, Top
@chapter Manipulating system types
@cindex Manipulating system types
@include libjitext-type.texi
@c -----------------------------------------------------------------------
@node Values, Instructions, Types, Top
@chapter Working with temporary values in the JIT
( run in 0.536 second using v1.01-cache-2.11-cpan-119454b85a5 )