Search found 39 matches

by sunmountain
Wed Nov 16, 2011 11:05 am
Forum: newLISP in the real world
Topic: FASTCGI bugs
Replies: 6
Views: 2642

Re: FASTCGI bugs

But it's not perfect if user need change % to %% by hand
That is not neccessary if you take FCGI_puts as underlying "printer".
by sunmountain
Wed Nov 16, 2011 11:04 am
Forum: newLISP in the real world
Topic: How to do string like binary?
Replies: 3
Views: 1560

Re: How to do string like binary?

Could you please tell the rest of us, what exactly you did ? BTW, the correct codes should be: 中 20013 文 25991 a 97 b 98 c 99 (verified by Python 2.7.2). There you have to explicitly mark a string as unicode via u'the string' (this changed in Python 3.x, where all strings are unicode by default). I'...
by sunmountain
Wed Nov 16, 2011 8:00 am
Forum: newLISP in the real world
Topic: Compile DLL
Replies: 18
Views: 5354

Re: Compile DLL

Hi Lutz, Perhaps you can create a nl-ffi.c and, compile with: gcc -DFFI and have #ifdef FFI for primes.h and protos.h. Then it is easy to turn it on and off. That was (is) exactly my plan. I'll take 10.3.6 as the base for this. Due to the fact that I have a Win 7 dev box (and 32 bit only), I'm not a...
by sunmountain
Tue Nov 15, 2011 9:43 pm
Forum: newLISP in the real world
Topic: Compile DLL
Replies: 18
Views: 5354

Re: Compile DLL

But I think libffi is too big for what newLISP tries to accomplish. Not really. When stripped, it ads about 25 kB. I try to accomplish to do the same things with newLisp as with Python: penetration testing, automation, regression tests, gui development etc etc You will lose newLISP's small size and...
by sunmountain
Tue Nov 15, 2011 1:27 pm
Forum: newLISP in the real world
Topic: FASTCGI bugs
Replies: 6
Views: 2642

Re: FASTCGI bugs

There is probably no bug there. Are you using FCGI_printf ? Then % starts a format specifier, which might eventually misinterpreted by the underlying vfprintf implementation. You could try to mask the % with another %, so writing something like this: <% (print "Content-type: text/html\r\n\r\n") ;(mo...
by sunmountain
Tue Nov 15, 2011 7:35 am
Forum: newLISP in the real world
Topic: Compile DLL
Replies: 18
Views: 5354

Re: Compile DLL

I should have read the fine manual before, though. I guess it has internally to do with the fact, that floats can't be represented as normal numbers (duality pointer <-> long). Time for a FFI library :-) I took a look at several ffi libs, and I think it would be the easiest to extend newLisp's vocab...
by sunmountain
Mon Nov 14, 2011 11:24 pm
Forum: newLISP in the real world
Topic: Compile DLL
Replies: 18
Views: 5354

Compile DLL

Hi there, I got here in test.cpp this extern "C" { __declspec(dllexport) double adder(double a,double b) { return (a+b); } } I then compile this with C:\Users\stefan\ffi>cl /LD /DLL test.cpp Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 Copyright (C) Microsoft Corpo...
by sunmountain
Sun Nov 13, 2011 2:01 pm
Forum: newLISP in the real world
Topic: Why IMPORT c failed
Replies: 3
Views: 1496

Re: Why IMPORT c failed

First, you should always end with \r\n. Second, be nice an end with 0, if everything is OK. Third, is the script callable (chmod +755 /tmp/fcgi.lsp) ? Forth, if you import libfcgi, your standard out channel is not changed to the one the FCGI server offers. A print in newlisp will still go to stdout....
by sunmountain
Sat Nov 12, 2011 11:24 pm
Forum: newLISP in the real world
Topic: Number of callbacks
Replies: 4
Views: 1464

Re: Number of callbacks

I looked into it a few years back and thought, it was too big, does too many things. But somebody could build an interface to libffi using the 'import' function? For 90% of lib imports the existing 'import' facility gives what is needed. For anything else, write a 'C' interface stub, which then get...
by sunmountain
Sat Nov 12, 2011 10:55 pm
Forum: newLISP in the real world
Topic: Number of callbacks
Replies: 4
Views: 1464

Re: Number of callbacks

And later here means later in program flow ?
So you override the callback no. 4 with another one ?

Any plans to adopt to libffi ?
by sunmountain
Sat Nov 12, 2011 7:47 pm
Forum: newLISP in the real world
Topic: Number of callbacks
Replies: 4
Views: 1464

Number of callbacks

Hi,
yould someone show me some code for this:
If more than sixteen callback functions are required, slots can be reassigned to a different callback function.
Please :-)
by sunmountain
Sat Nov 12, 2011 7:23 pm
Forum: newLISP in the real world
Topic: newLISP and IUP UI library oddness
Replies: 3
Views: 1379

Re: newLISP and IUP UI library oddness

I think I can imagine what goes on. I just did this: (IupStoreAttribute dialog "TITLE" (date)) and now it works reliably. I guess that if I pass a temporary string, it's thrown away after the last reference is away. This is right after the ")". So the reference is gone. Why this works after IupShow ...
by sunmountain
Sat Nov 12, 2011 11:49 am
Forum: newLISP in the real world
Topic: newLISP and IUP UI library oddness
Replies: 3
Views: 1379

newLISP and IUP UI library oddness

Hi there, I just played around with newLisp and its import capabilites. My poi there was the famous IUP library, an UI lib, which is C-only. So here is the code: (import "iup.dll" "IupOpen") (import "iup.dll" "IupClose") (import "iup.dll" "IupText") (import "iup.dll" "IupButton") (import "iup.dll" "...
by sunmountain
Tue Mar 15, 2011 5:14 am
Forum: newLISP in the real world
Topic: for loop weiredness
Replies: 2
Views: 1548

for loop weiredness

Trivial:

Code: Select all

> (for (i 1 10 1) (println i))
1
2
3
4
5
6
7
8
9
10
Now this:

Code: Select all

> (import "msvcrt.dll" "printf")
printf<7714C5B9>
> (for (i 1 10 1) (printf "%i\n" i))
0
0
0
0
0
0
0
0
0
0
Could someone please explain what is going on here ?