Lua logo
RiscLua download page
Lua for RISC OS
The latest 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.final      error handling library
  c.doublelib  dbl library
  h.power
  c.power      fast integer exponentiation
  c.swilib     riscos 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_POW
Provide a fast integer exponential function.
GCW_CLOCK
Suppress rescaling of clock ticks.
GCW_SWI
Include the riscos 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_PALL
Apply Mike Pall's patch for unpacking-tables syntax.
GCW_SUGAR
Allow \ for function and => for return.
 
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.