development version newLISP v.8.5.9
development version newLISP v.8.5.9
• 'nil' and 'true' are allowed in memory shares
• new flavor osx_lib for newlisp.so on Mac OSX
• new flavor tru64 for Compaq/HP Alpha 64bit CPU
• 'timer' now has millisecond resolution
• 'read-buffer' can take a wait string similar to 'net-receive'
• Mac OSX installer package for 10.3
• flushing buffers for non terminal STD I/O lets newLISP be UNIX inetd server
For files and change notes see http://newlisp.org/downloads/development
Lutz
ps: this is the last release before v.8.6 in mid June
• new flavor osx_lib for newlisp.so on Mac OSX
• new flavor tru64 for Compaq/HP Alpha 64bit CPU
• 'timer' now has millisecond resolution
• 'read-buffer' can take a wait string similar to 'net-receive'
• Mac OSX installer package for 10.3
• flushing buffers for non terminal STD I/O lets newLISP be UNIX inetd server
For files and change notes see http://newlisp.org/downloads/development
Lutz
ps: this is the last release before v.8.6 in mid June
After adding the macro -DWIN32_TIMER to the makefile, commenting the WINCC macro in primes.h, and adding this line
...to 'newlisp.h' the make mingw target compiles and links with no problems - no extra linkflag required, it seems?
However, it is the p_timerEvent in 'newlisp.c' which does not do anything, right...? The story at MSDN about timers is very big and requires some fundamental decisions... :-(
Peter
Code: Select all
#define TRACE_SIGALRM 0x8000
However, it is the p_timerEvent in 'newlisp.c' which does not do anything, right...? The story at MSDN about timers is very big and requires some fundamental decisions... :-(
Peter
Instead of TRACE_SIGALRM, it should now be TRACE_TIMER. I wrote the Win timer stuff before making the change from using alarm() to setitimer() for the UNIX timer function.
It compiles and links but the callback function timerFunc() is never called, the reason is that the application has to be linked as a Windows application with one or more of the Win libraries like ws2_32 and perhaps a .def file is needed exporting timerFunc(). May be it also needs a WinMain(), the main callback function in a Windows application receiving events.
Lutz
It compiles and links but the callback function timerFunc() is never called, the reason is that the application has to be linked as a Windows application with one or more of the Win libraries like ws2_32 and perhaps a .def file is needed exporting timerFunc(). May be it also needs a WinMain(), the main callback function in a Windows application receiving events.
Lutz
In the MSDN docs the following remark is shown:
Compile with 'gcc -o demo demo.c'. Pretty useless program but to get the idea. The timerevent is processed to the program itself, which must fetch it from the event queue.
So your "CELL * p_timerEvent(CELL * params)" must get the message of the event queue and dispatch it by itself. Probably you want to do this in a separate thread to let the newLisp programmer use the prompt.
Peter
This text was really a riddle to me. But the demo program below shows a working SetTimer function:When you specify a TimerProc callback function, the default window procedure calls the callback function when it processes WM_TIMER. Therefore, you need to dispatch messages in the calling thread, even when you use TimerProc instead of processing WM_TIMER.
Code: Select all
#include <windows.h>
void timer_proc(HWND a,unsigned int b, unsigned int c, unsigned long d) {
MessageBox(0, "Hello", "MessageBox", 0);
}
int main(int argc, char *argv[])
{
int iTimerID = SetTimer(0, 0, 300, (TIMERPROC)timer_proc);
MSG m;
while (GetMessage(&m,0,0,0)) {
TranslateMessage(&m);
DispatchMessage(&m);
}
return 1;
}
So your "CELL * p_timerEvent(CELL * params)" must get the message of the event queue and dispatch it by itself. Probably you want to do this in a separate thread to let the newLisp programmer use the prompt.
Peter
Turns out that GetMessage() blocks when no message is received, which is none if you filter for WM_TIMER.
In the end I just created a thread using _beginthread() from the Win32 runtime library and watch the time in it, which turned out to be a very short solution with very little code added in the Windows compile.
But GetMessage() could be an interesting function for 'import', and then a Win GUI could be built fetching messages for the keyboard, mouse etc.. Not a single code change would be required in newLISP, in fact it could be done with any of the previous versions. But I leave that to the volunteers ;-)
Lutz
In the end I just created a thread using _beginthread() from the Win32 runtime library and watch the time in it, which turned out to be a very short solution with very little code added in the Windows compile.
But GetMessage() could be an interesting function for 'import', and then a Win GUI could be built fetching messages for the keyboard, mouse etc.. Not a single code change would be required in newLISP, in fact it could be done with any of the previous versions. But I leave that to the volunteers ;-)
Lutz
Actually it came out pretty short (look for it in the next release). The Win32 _beginthread() doesn't need much stuff around it. The resulting 'timer' funtion works similar to the 'timer' in the Linux/UNIX versions.
But I agree, having the 'timer' and fork you can do so much more. Unfortunately I dont's see a UNIX style fork (which creates an exact copy of the parent process) any time soon. The only version I ever saw is the one in cygwin, but I didn't find it to be reliable enough. Its just something Windows isn't build for. The Win32 thread facility turned out nice for the timer, but else doesn't have much use in newLISP.
Lutz
But I agree, having the 'timer' and fork you can do so much more. Unfortunately I dont's see a UNIX style fork (which creates an exact copy of the parent process) any time soon. The only version I ever saw is the one in cygwin, but I didn't find it to be reliable enough. Its just something Windows isn't build for. The Win32 thread facility turned out nice for the timer, but else doesn't have much use in newLISP.
Lutz
Cygwin -- no respect ;-)
Hey Lutz,
Sorry to see you dropped cygwin support. I was one of the (few?) cygwin users.
Say, has anyone approached you about supporting/porting to SGI IRIX 6.5 (mips, n32)? We have several here at work on which I'd love to run newlisp. I really don't know where to start; however, if (1) you don't have anyone else, (2) you can suggest how to start (i.e. which makefile I could start from), I could give it a shot in my spare time.
BTW, any IRIX users out there who have newlisp running on an IRIX box, or who are interested in a port to IRIX?
--Rick
Sorry to see you dropped cygwin support. I was one of the (few?) cygwin users.
Say, has anyone approached you about supporting/porting to SGI IRIX 6.5 (mips, n32)? We have several here at work on which I'd love to run newlisp. I really don't know where to start; however, if (1) you don't have anyone else, (2) you can suggest how to start (i.e. which makefile I could start from), I could give it a shot in my spare time.
BTW, any IRIX users out there who have newlisp running on an IRIX box, or who are interested in a port to IRIX?
--Rick
(λx. x x) (λx. x x)
Hi rickyboy,
I just finished a port of newLisp to Tru64Unix starting with the Makefile for Solaris.
The biggest trouble came from the fact that Tru64 Unix is a 64-bit operating system. NewLisp however expects pointers to be of 32-bit size. How about Irix?
I have a list of changes which I needed to put into the newLisp sources, would you be interested to see them, just to get an idea where you may run into?
Peter
I just finished a port of newLisp to Tru64Unix starting with the Makefile for Solaris.
The biggest trouble came from the fact that Tru64 Unix is a 64-bit operating system. NewLisp however expects pointers to be of 32-bit size. How about Irix?
I have a list of changes which I needed to put into the newLisp sources, would you be interested to see them, just to get an idea where you may run into?
Peter
Good to hear from you rickyboy,
About CYGWIN, sorry that had to hit you rickybody ;( with the drop of CYGWIN. I don't maintain a full CYGWIN environment on my Wintel machine anymore, using the MinGW compiler exclusively when in Cygwin, the next flavor to drop will be Borland BCC, I only keep it because of the nice turbo debugger helping me out.
If you have any problems compiling the Cygwin flavor let me know and I try to help. There could be some problems, because since introduction of signals and timers I have not compiled that flavor.
About an Irix port, I love those machines, having used them more then a decade ago. I would just start with the Solaris or BSD make file and go from there. Most likely one of the two will get you there quickly. These are the areas where you might run into tweaking:
signals 'signal'
timers 'timer'
shared memory 'share'
time date stuff (several newLISP functions)
sleep 'sleep' (no big deal -DNANOSLEEP or not)
vasprintf(), vsnprintf(), my_vasprintf() 'C' functions: read man pages for vasprintf() and vsnprint(). If you don't have vasprintf() take my_vasprintf() in nl-filesys.c. In that case check return value of vsnprintf() on your platform, see my_vasprintf() source for details.
Most of that stuff is in nl-filesys.c. Probably one of the other flavors has already what you want. If you have GCC for 32bits on your machine things will go smoothest. If you can give me an account on one of your IRIX machines I can help you. I can sign NDAs or whatever you might need for your employer.
The tru64 port Peter/pjot did was probably one of the toughest, and even that post was done in a few days in Peter's spare time.
Lutz
About CYGWIN, sorry that had to hit you rickybody ;( with the drop of CYGWIN. I don't maintain a full CYGWIN environment on my Wintel machine anymore, using the MinGW compiler exclusively when in Cygwin, the next flavor to drop will be Borland BCC, I only keep it because of the nice turbo debugger helping me out.
If you have any problems compiling the Cygwin flavor let me know and I try to help. There could be some problems, because since introduction of signals and timers I have not compiled that flavor.
About an Irix port, I love those machines, having used them more then a decade ago. I would just start with the Solaris or BSD make file and go from there. Most likely one of the two will get you there quickly. These are the areas where you might run into tweaking:
signals 'signal'
timers 'timer'
shared memory 'share'
time date stuff (several newLISP functions)
sleep 'sleep' (no big deal -DNANOSLEEP or not)
vasprintf(), vsnprintf(), my_vasprintf() 'C' functions: read man pages for vasprintf() and vsnprint(). If you don't have vasprintf() take my_vasprintf() in nl-filesys.c. In that case check return value of vsnprintf() on your platform, see my_vasprintf() source for details.
Most of that stuff is in nl-filesys.c. Probably one of the other flavors has already what you want. If you have GCC for 32bits on your machine things will go smoothest. If you can give me an account on one of your IRIX machines I can help you. I can sign NDAs or whatever you might need for your employer.
The tru64 port Peter/pjot did was probably one of the toughest, and even that post was done in a few days in Peter's spare time.
Lutz
1) Indeed the Win32 platform just does not have something like 'fork', it's not part of the OS. Still I wonder: is it not possible to simulate a 'fork' using threads, similar to the 'timer' function?Unfortunately I dont's see a UNIX style fork (which creates an exact copy of the parent process) any time soon. The only version I ever saw is the one in cygwin, but I didn't find it to be reliable enough. Its just something Windows isn't build for. The Win32 thread facility turned out nice for the timer, but else doesn't have much use in newLISP.
2) The Cygwin implementation is also a simulation, but is it really that bad? At least there is the possibility to use the 'fork' command in Windows. Besides Cygwin, also Perl uses a 'fork' emulation in a Win32 environment:
http://www.xav.com/perl/lib/Pod/perlfork.html
Though it has certain limitations, it will make newLisp more complete.
Peter
Well, so that is good news! :-)
...but serious, I am a little bit confused here... because a few messages back, you say:
Sorry to be so nagging, but it seems that a Cygwin-like 'fork' seems to work for many other Unix tools ported to Windows, including Perl. So why not use it for newLisp as well?
Peter
...but serious, I am a little bit confused here... because a few messages back, you say:
And here you say:UNIX fork gives you a copy of all the whole parent process, which is what I need.
So isn't this exactly what you want for Windows then? Or do I misunderstand you somewhere?Perl has a 'perl-clone' function copying all memory from the parent process when simulating fork() on Win32.
Sorry to be so nagging, but it seems that a Cygwin-like 'fork' seems to work for many other Unix tools ported to Windows, including Perl. So why not use it for newLisp as well?
Peter