Lua 5.4.0 RC 6 for OS/2 & no problems with lobjects.c/l_str2int

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Lua 5.4.0 RC 6 for OS/2 & no problems with lobjects.c/l_str2int

Alexander Walz
Hello,

I have just uploaded an OS/2 version of the latest Lua RC 6 release
candidate to Hobbes:

https://hobbes.nmsu.edu/download/pub/incoming/lua-5.4.0-rc6-os2.wpi

You will find amended source files here:

https://hobbes.nmsu.edu/download/pub/incoming/lua-5.4.0.rc6.src-diffs.zip

It would be great if you could add these OS/2-related modifications to
your branch as they are just additions but no modifications.

Concerning lobjects.c/l_str2int: I tried it out in RC 6 on my Raspberry
Pi and did not find any problems. I apologise for my false alarm.

Yours,

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4.0 RC 6 for OS/2 & no problems with lobjects.c/l_str2int

Luiz Henrique de Figueiredo
> It would be great if you could add these OS/2-related modifications to
> your branch as they are just additions but no modifications.

Please explain these modifications.
Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4.0 RC 6 for OS/2 & no problems with lobjects.c/l_str2int

Alexander Walz
Luiz,

the attached amendments work fine in OS/2 with Paul Smith's GCC 4.46 for OS/2.

Please note that I am not a professional programmer.

Alex


OS/2-specific changes to the Makefile
-------------------------------------

#LIBS= -lm $(SYSLIBS) $(MYLIBS)
LIBS= -lm -lreadline -lhistory -lncurses $(MYLIBS)
...
os2:
    $(MAKE) all "LUA_T=lua.exe" MYCFLAGS="-O2 -static-libgcc -fomit-frame-pointer -D__ST_MT_ERRNO__ -DLUA_USE_LINUX -DLUA_ANSI" SYSLIBS="-ldl -lreadline" lua.exe
    $(MAKE) all "LUAC_T=luac.exe" MYCFLAGS="-O2 -static-libgcc -fomit-frame-pointer -D__ST_MT_ERRNO__ -DLUA_USE_LINUX -DLUA_ANSI" SYSLIBS="-ldl -lreadline" luac.exe


Changes to lmathlib.c (or to be included in a compatibility file for Solaris, OS/2, DOS, etc.)
----------------------------------------------------------------------------------------------

#ifdef __OS2__
#define log2  logb
#endif

static int math_log (lua_State *L) {
....


Changes to lua.c
----------------

lua.c:

int main (int argc, char **argv) {
  int status, result;
  lua_State *L = luaL_newstate();  /* create state */
  /* 2.3.0 RC 2 OS2/eCS fix provided by Dave Yeo on OS/2 world.com to avoid
     segmentation faults with mathematical functions (SIGFPEs issued by
     libc065.dll with trunc, sinh, cosh, etc.) and also to speed up double
     arithmetic significantly.
     See: http://www.os2world.com/forum/index.php/topic,496.msg4679.html#msg4679 */
#ifdef __OS2__
  short fcr;
  __asm__ volatile ("fstcw           %0 \n"
                    "or         $63, %0 \n"
                    "fldcw           %0 \n"
                    : "=m"(fcr));
#endif
  if (L == NULL) {
    l_message(argv[0], "cannot create state: not enough memory");
    return EXIT_FAILURE;
  }