Search found 39 matches

by sunmountain
Tue Dec 13, 2011 12:35 pm
Forum: newLISP in the real world
Topic: Socket Callback into Vb
Replies: 12
Views: 1577

Re: Socket Callback into Vb

The form doesn't block or wait in a loop, it responds to commands. After the web page is downloaded a webbrowser0.downloadcomplete event fires and I can write code to respond. So the problem is solved ? I still think it is not more complex in .NET/C#: using System; using System.Collections.Generic;...
by sunmountain
Tue Dec 13, 2011 4:34 am
Forum: newLISP in the real world
Topic: Socket Callback into Vb
Replies: 12
Views: 1577

Re: Socket Callback into Vb

To get you right: you want to handle all network stuff with newlisp and have it inform the VB app an changed data ? Anyway: net-listen sets up a listening socket, essentially flagging the socket to be a server socket. Then, you have to net-accept on the socket, to catch new incoming requests. Normal...
by sunmountain
Mon Dec 12, 2011 8:48 pm
Forum: newLISP in the real world
Topic: Socket Callback into Vb
Replies: 12
Views: 1577

Re: Socket Callback into Vb

Anything is possible.
Perhaps you could just outline the idea a bit more or send some (pseudo) code ?
by sunmountain
Thu Dec 08, 2011 9:31 pm
Forum: newLISP in the real world
Topic: Support for structs in FFI on the way
Replies: 1
Views: 546

Support for structs in FFI on the way

Just to give everyone an update: It is now possible to have arguments and return values as struct types, e.g this is possible: Here is a small C lib, that uses structs: #include <stdio.h> typedef struct clock { char hour; int min; short int sec; } clock; clock addClock(clock in) { in.hour += 1; in.m...
by sunmountain
Wed Dec 07, 2011 7:15 pm
Forum: newLISP newS
Topic: newLISP development release v.10.3.8
Replies: 2
Views: 1675

Re: newLISP development release v.10.3.8

Good news !

Could you please explain the numbering scheme used for the versions ?
by sunmountain
Tue Dec 06, 2011 10:48 am
Forum: newLISP newS
Topic: extended import and callback API
Replies: 10
Views: 3340

Re: extended import and callback API

Hi lutz, I made a small fix, sent you the code. Under Windows (mingw, gcc 4.6.1, Win XP Pro SP 2 32 But) it adds 280590-274958 = 5632 Bytes, so the addition is neglectable I think. But to be fair: it is compute intensive, as it creates call information on the fly using assembler ninja technics. Now ...
by sunmountain
Sat Dec 03, 2011 9:54 pm
Forum: newLISP newS
Topic: extended import and callback API
Replies: 10
Views: 3340

Re: extended import and callback API

Hi, Yes I'm done with implementing the closure callback extention. Now you can write code like this: (import "msvcrt" "qsort" "void" "void*" "int" "int" "void*") (import "msvcrt" "atexit" "void" "void*") (define (bye) (println "See you ...")) (atexit (callback 'bye "void" "void")) (set 'l '()) (doti...
by sunmountain
Fri Nov 25, 2011 8:57 am
Forum: newLISP in the real world
Topic: FFI closures are on the way
Replies: 0
Views: 1002

FFI closures are on the way

This morning, while commuting, I did finish the foundation for ffi closures. That said, now I can create real ffi closures and get their addresses for later use, and more important, call them. Hopefully on my way back home I finish the marshalling code and can show some demo. To give you a clue on h...
by sunmountain
Thu Nov 24, 2011 4:16 am
Forum: newLISP in the real world
Topic: FFI fcall in principle working :-)
Replies: 12
Views: 1137

Re: FFI fcall in principle working :-)

I'm asking myself what was the best verb in newLisp for the ffi closures. Many people have some anticipation when they read closure, and would probably confuse or disappoint them. It could even be made a special case of the standard callback symbol, I think that would be natural, after fcall has bee...
by sunmountain
Wed Nov 23, 2011 9:13 pm
Forum: newLISP in the real world
Topic: FFI fcall in principle working :-)
Replies: 12
Views: 1137

Re: FFI fcall in principle working :-)

I see ... Cool :-) I did only make small progress today, but this now works as expected: (import "msvcrt" "sprintf") (set 'res (dup " " 50)) (set 'csprintf (fcall sprintf c_int c_string c_string c_int c_double)) (set 'PI 3.1415926) (println (csprintf res "the answer is always %i, or %.8f" 42 PI)) (p...
by sunmountain
Wed Nov 23, 2011 6:37 am
Forum: newLISP in the real world
Topic: FFI fcall in principle working :-)
Replies: 12
Views: 1137

Re: FFI fcall in principle working :-)

That seems reasonable: http://www.opensource.apple.com/source/libffi/libffi-18/include/ffi.h The problem to me seems to be, that this file may be present at several locations in an OSX install, for example the ruby cocoa bridge brings its own (newer) version. DLL hell reincarnated on Macintosh ... A...
by sunmountain
Wed Nov 23, 2011 4:13 am
Forum: newLISP in the real world
Topic: FFI fcall in principle working :-)
Replies: 12
Views: 1137

Re: FFI fcall in principle working :-)

Perhaps just run ldd on the newlisp binary on OSX to see which dylibs it requires.

Under Windows Dependcy Walker just lists libffi-5.dll (the internal) name, which is not present.
I'll take a look into this, now I don't know why it works.

BTW, which version of libffi is present in OSX ?
by sunmountain
Tue Nov 22, 2011 9:44 pm
Forum: newLISP in the real world
Topic: FFI fcall in principle working :-)
Replies: 12
Views: 1137

Re: FFI fcall in principle working :-)

I just incoporated the files, thanks. I've cleaned the code a bit, and patched another file (nl-filesys.c): CELL * p_makeDir(CELL * params) { char * dirString; UINT mode; mode = 0777; /* drwxrwxrwx gets user masked to drwxr-xr-x on most UNIX */ /* consume param regardless of OS */ params = getString...
by sunmountain
Tue Nov 22, 2011 1:40 pm
Forum: newLISP in the real world
Topic: FFI fcall in principle working :-)
Replies: 12
Views: 1137

Re: FFI fcall in principle working :-)

Now it is possible to return float values directly (which does not work with imported functions): (import "msvcrt.dll" "log10") log10<77C4D060> ; define a fcall object return type is double, takes one double as parameter (set 'clog10 (fcall log10 c_double c_double)) log10<77C4D060> (clog10 1000) 3 (...
by sunmountain
Tue Nov 22, 2011 7:56 am
Forum: newLISP in the real world
Topic: truth value of the empty list?
Replies: 1
Views: 715

Re: truth value of the empty list?

I can't wait for the answer - this can get philosophical. The key question is: what is value and when is it nil (as I remember there is no false in lisp, though) ? If you look over to python, "", empty lists, tuples and numeric 0 are false. That seems natural, but in lisp you work on lists, an (0) i...
by sunmountain
Mon Nov 21, 2011 10:26 pm
Forum: newLISP in the real world
Topic: FFI fcall in principle working :-)
Replies: 12
Views: 1137

FFI fcall in principle working :-)

This works now:

Code: Select all

(import "msvcrt" "printf" "cdecl")
(set 'cprintf (fcall printf c_int c_void_p c_int))
(cprintf "The answer is %i" 42)
(exit 0)
@lutz: please drop me a note with your email, I'll send you the tar file.
by sunmountain
Mon Nov 21, 2011 7:42 am
Forum: newLISP in the real world
Topic: errorProcExt2 failure
Replies: 3
Views: 644

Re: errorProcExt2 failure

It did not solve all problems (it still crashes at the same point), but first I will create functioning ffi interface (at least fcall), before digging into this. Yes, I took 10.3.7 and integrated my code. I think I'll have to ask gdb what is wrong here. Man, I learn alot these days. But as more as I...
by sunmountain
Sat Nov 19, 2011 10:12 am
Forum: newLISP in the real world
Topic: errorProcExt2 failure
Replies: 3
Views: 644

errorProcExt2 failure

Hi, in my FFI code, I need to sure that ffi_prep_cif went ok, so I added this: status = ffi_prep_cif(&cif,FFI_DEFAULT_ABI,2,&ffi_type_uint,argt); if(status != FFI_OK) { return(errorProcExt2(ERR_FFI_PREP_FAILED, stuffString(ffi->name))); } else { ffi_call(&cif,ffi->func,&result,aval); } For debugging...
by sunmountain
Fri Nov 18, 2011 10:13 pm
Forum: newLISP in the real world
Topic: Compile DLL
Replies: 18
Views: 2054

Re: Compile DLL

Hi Lutz, your work has laid the foundaition, so I could relatively easlily code a first demo (until now static variable pushing), but now this one here: (import "msvcrt" "printf" "cdecl") (println (fcall printf a b c)) (exit 0) gives this here: $ newlisp fcall.lsp Hello FFI - here's newLisp (and the...
by sunmountain
Fri Nov 18, 2011 6:46 pm
Forum: newLISP in the real world
Topic: Compile DLL
Replies: 18
Views: 2054

Re: Compile DLL

Is there any public cvs/git/svn/fossil/bazzar/mercurial repo ?

Or, do you prefere patches or complete tar files ?
by sunmountain
Fri Nov 18, 2011 6:38 pm
Forum: newLISP in the real world
Topic: Compile DLL
Replies: 18
Views: 2054

Re: Compile DLL

The way things are setup, no bad side effects to other portions of newLISP can happen. If you want, you can pull out executeLibFFI() and p_fcall() in extra file. development newlisp-10.3.6 will be released later today. But you can start with the "inprogess" version, if you want. Somebodys done my h...
by sunmountain
Fri Nov 18, 2011 10:52 am
Forum: newLISP in the real world
Topic: Compile DLL
Replies: 18
Views: 2054

Re: Compile DLL

newlisp-program -> newlisp-module -> 3rd-party-lib I guess the last one is, what you are shooting for. Exactly. About my motivation: My goal ist to make it easier working with more complex struct ures. Mostly these cause more work, due to pack/unpack. At first I thought it could be done solely with...
by sunmountain
Thu Nov 17, 2011 3:41 pm
Forum: newLISP in the real world
Topic: Compile DLL
Replies: 18
Views: 2054

Re: Compile DLL

I sat down an made a layout of my code. To be honest: I think it will be neccessary to create a new cell type (most likely types), for ffi calls, callbacks and some types. I'd like to be able to do something like this (later): (import "msvrcrt.dll" "printf" "cdecl") (set 'cprintf (fcall printf c_int...
by sunmountain
Thu Nov 17, 2011 11:10 am
Forum: newLISP in the real world
Topic: FASTCGI bugs
Replies: 6
Views: 934

Re: FASTCGI bugs

Perhaps you could just create your own function, which takes care of all the issues, or you use define-macro, to reduce the runtime overhead. Using a putchar on a string means you need to iterate over a list of chars, printf("%s\n","Hello, World!") is one call (one library call), putchar would need ...
by sunmountain
Wed Nov 16, 2011 7:35 pm
Forum: newLISP in the real world
Topic: Compile DLL
Replies: 18
Views: 2054

Re: Compile DLL

Taking care of LLP64 in Windows 7, will take a little bit more time and testing above all.
That's funny.
I was just wondering today, if there are automated tests as a regression after (automatic) newLisp builds.

Anyway, for the nl-ffi thing I'll write some.