Lua icon

Sources

zip archive
Sources
The sources are arranged for compilation with the Norcroft C compiler. I have experimented with the Gnu C compiler both with Unixlib and the shared C library, but by a small margin on speed, and a large margin on size, the Norcroft version won.

The sources consist of the standard Lua distribution, decorated with extra #ifdef sections, together with extra files:

  s.sys        Objasm source for RISC OS linkage
  h.sys        header
  h.risclua    RISCOS-specific compilation flags
  c.blocklib   block library
  c.doublelib  dbl library
  c.power      fast integer exponentiation
  c.swilib     swi library
  c.lpeg       Roberto Ierusalimschy's parser expression grammar library
    
If the compilation flag RISCOS is undefined only the standard Lua distribution code is visible. If RISCOS is defined, further flags may be configured in h.risclua. These are:

 

GCW_INT
If this is set 32-bit integers are used in the Lua virtual machine. Otherwise 64-bit floating point numbers are used, which would be slow on most RISCOS ARM-based machines.
There follows a series of flags which only function when GCW_INT is defined.
GCW_DBL
Include the dbl library
GCW_BIT
Extend the Lua virtual machine with bitwise operations.
GCW_RND
Extend the base library with a random integer function.
GCW_POW
Provide a fast integer exponential function.
GCW_CLOCK
Suppress rescaling of clock ticks.
GCW_BLOCK
Include the block library. Blocks are fixed arrays, as needed by SWI calls.
The following flag can only function if GCW_BLOCK is defined.
GCW_SWI
Include the swi library. This enables SWI calls from within RiscLua programs (as SYS in Basic does).
GCW_LUACOUT
Rename the standard output of luac to <Wimp$Scrap>.
GCW_HARD
Treat hard spaces as soft. This avoids invisible typographic errors.
GCW_MORECHARS
Allow some extra characters in identifiers.
GCW_DIR
Extend the os library with a directory iterator and a function to return the filetype of a file.
GCW_PALL
Apply Mike Pall's patch for unpacking-tables syntax.
GCW_SUGAR
Allow \ for function and => for return.
GCW_NEHAB
Extend the base library with Diego Nehab's error handling functions.
 
If GCW_INT is not defined then the following two flags can be used:
GCW_SIGFPE
trap floating point errors.
GCW_MATH
Protect some of the functions in the math library from silly arguments.

RiscLua is obtained by compiling with all the flags defined.


Back to RISC OS stuff