newLISP Stable Release v.10.5.4

Started by Lutz, October 01, 2013, 08:44:01 AM

Previous topic - Next topic

jonok

#15
I gather CYGWIN isn't supported any more ... but in any case I found an error in the code



in nl-import.c  if FFI is NOT defined and CYGWIN IS, it breaks the following code, as there is a bracket inside the #ifdef that I'm presuming shouldn't be.



This is the cause of the weird error ...

nl-import.c:470:5: error: static declaration of 'template' follows non-static declaration



With this fix in place, newlisp compiles

the bracket with the FIX comment is currently inside the #ifdef FFI



starting from line 134 of nl-import.c

------------------

#ifdef CYGWIN

if(params != nilCell)

    {

    if(params->next == nilCell)

        {

        params = getString(params, &options);

        if(strcmp(options, "cdecl") ==  0)

            type = CELL_IMPORT_CDECL;

        }

#ifdef FFI

    else type = CELL_IMPORT_FFI;

#endif

    } /* FIX moved from inside previous ifdef FIX */

#else

if(params->next != nilCell)

    type = CELL_IMPORT_FFI;

#endif

------------------



PS, I'm not sure why FFI is NOT defined ... as I have the cygwin libffi installed ... not sure if it's relevant or not.

jonok

#16
OK ... after some more digging ... I enabled using the cygwin libffi packages and ffi.h.

I also testing using the default FFI stuff in the source distribution ... (ie I just fixed the bracket placement as in previous post) and it behaves exactly the same.



newlisp compiles and the qa-specific-test run by make test all run SUCCESSFULLY



the qa-dot test runs but fails at semaphore



jon@jon-Z930 /cygdrive/c/src/newlisp-10.5.4

$ ./newlisp.exe qa-dot > test_qa_dot.txt



Testing built-in functions ...

Bad system call (core dumped)  



jon@jon-Z930 /cygdrive/c/src/newlisp-10.5.4

$ tail test_qa_dot.txt

  -> rotate          

  -> round          

  -> save          

  -> search          

  -> seed          

  -> seek          

  -> select          

  -> self          

  -> semaphore          



If there's interest in getting cygwin back as a supported platform, I'm happy to help.



Jon

Lutz

#17
Support for CYGWIN was dropped in 2005 for two reasons:



1. The newlisp.exe produced was not standalone Windows, but also needed a CYGWIN dll distributed with it to work.



2. Problems with the newLISP fork function on CYGWIN. Windows does not have a native fork(). The CYGWIN implementation gave problems. From what you tell, its seems to work fine on your CYGWIN build, because make test also includes testing the Cilk API using the test routines found in qa-specific-tests/qa-cilk. The Cilk spawn function uses fork() internally. See also here: http://cygwin.com/faq.html#faq.using.fixing-fork-failures">http://cygwin.com/faq.html#faq.using.fi ... k-failures">http://cygwin.com/faq.html#faq.using.fixing-fork-failures



The extended FFI using libffi was not introduced until November 2011. That is why it never has been tried in CYGWIN.



I am glad to hear that it compiles well now and you tried it using make testall. This more than doubles the number of tests compared to make test and also tries to test the libffi API.



The semaphore function is one of the first things to break when porting to other platforms. This function was introduced around the time CYGWIN support was dropping off. I think it only got implemented in the Borland-C compiled versions. Probably it would need new code be written to work on CYGWIN. semaphore is not a critical function in newLISP. You only would use it when working with the lower level fork function directly but not when using the Cilk and message API.



Ps: your brace fix for CYGWIN will be in the next version.

kosh

#18
Quote from: "jonok"the qa-dot test runs but fails at semaphore


To use semaphore function in cygwin, try install cygserver service.



http://cygwin.com/cygwin-ug-net/using-cygserver.html">http://cygwin.com/cygwin-ug-net/using-cygserver.html


$ (login as root)
$ cygserver-config
$ cygrunsrv --install cygserver -p /usr/sbin/cygserver
$ cygrunsrv --start cygserver
$ make -f makefile_cygwin
$ ./newlisp.exe -n qa-dot

Testing built-in functions ...

Testing contexts as objects and scoping rules ...

total time: 5411

>>>>> ALL FUNCTIONS FINISHED SUCCESSFUL: ./newlisp

jonok

#19
I can confirm that installing cygserver makes the semaphore test succeed!



Also, after tweaking qa-ffi to handle CYGWIN (by equating Windows to Cygin), eg replacing Win32 test with



(if (or (= ostype "Win32") (= ostype "Cygwin"))



all tests pass ...



$ make testall

make checkall | grep '>>>'

>>>>> ALL FUNCTIONS FINISHED SUCCESSFUL: ./newlisp

>>>>> Dictionary API tested SUCCESSFUL

>>>>> XML API tested SUCCESSFUL

>>>>> XML callback tested SUCCESSFUL

>>>>> JSON translation tested SUCESSFUL

>>>>> Signal testing SUCCESSFUL

>>>>> Network eval and network file functions IPv4 SUCCESSFUL

 >>>> Cannot bind socket. Cannot test IPv6 on this platform.

>>>>> The Cilk API tested SUCCESSFUL

>>>>> Reference testing SUCCESSFUL

>>>>> Time per simple message: 31 micro seconds

>>>>> Time per round trip : 160 micros seconds

>>>>> Time per proxy trip: 310 micro seconds

>>>>> Message API tested SUCCESSFUL

>>>>> Memory allocation/deallocation SUCCESSFUL

>>>>> Exception testing SUCCESSFUL

>>>>> Floating point tests SUCCESSFUL

>>>>> FOOP nested 'self' tested SUCCCESSFUL

>>>>> FOOP symbol protection SUCCESSFUL

>>>>> UNIX local domain sockets SUCCESSFUL

>>>>> In-place modification passed SUCCESSFUL

>>>>> qa-utf16path: This test is only used on UTF8 enabled versions.

>>>>> 0.047 ms per write->read pipe/fork (0.0356 ms Mac OSX, 1.83 GHz Core 2 Duo)

>>>>> ffilib API testing SUCCESSFUL

>>>>> callback API 1234567890 (simple callback API) SUCCESSFUL

>>>>> callback API 1234567890 12345.6789 (extended callback API) SUCCESSFUL

>>>>> struct tested SUCCESSFUL

>>>>> struct ptr tested SUCCESSFUL

>>>>> abs, float, bigint, +, -, *, /, % big integers tested SUCCESSFUL

>>>>> parsing big integers SUCCESSFUL

>>>>> Benchmarking all non I/O primitives ... may take a while ...

>>>>> Performance ratio: 0.48 (1.0 on Mac OSX, 1.83 GHz Core 2 Duo, newLISP v10.2.8)

Lutz

#20
looks good!



What do you put here in qa-ffi:
(define LIBC
  (case ostype
    ("Win32" "msvcrt.dll")
    ("Cygwin" "???????")
    ("OSX" "libc.dylib")
    ("Linux"

what is the name of the library, you would use for Cygwin?

jonok

#21
I took a punt on equating Cygwin to Win32 so I put in msvcrt.dll, and it worked.



BTW, you should look closely at my fix ... it's completely naive.