[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
newlispfanclub.alh.net • View topic - imported function parameter question

imported function parameter question

Q&A's, tips, howto's

imported function parameter question

Postby HPW » Sat Dec 13, 2003 7:10 pm

HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Sat Dec 13, 2003 7:53 pm

Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby Lutz » Sat Dec 13, 2003 8:50 pm

Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby HPW » Tue Dec 16, 2003 3:26 pm

Since I am not a assembly guru ;) and no other local assembly guru is at hand, here a question, which was asked on the neobook forum:

DECLARE FUNCTION MessageBox LIB "USER32.DLL" ALIAS "MessageBoxA" (BYVAL hWnd AS DWORD, lpText AS ASCIIZ, lpCaption AS ASCIIZ, BYVAL dwType AS DWORD) AS LONG

That functions works with this:

(import "user32.dll" "MessageBoxA")
(MessageBoxA 0 "This is the body" "Caption" 1)

But the try with this:

DECLARE FUNCTION GetComputerName LIB "KERNEL32.DLL" ALIAS "GetComputerNameA" (lpBuffer AS ASCIIZ, nSize AS DWORD) AS LONG

(import "Kernel32.dll" "GetComputerNameA")
works so far.
But until now no way to call it without crash.
The difference might be the 'BYVAL' before the DWORD parameter.

Any idea?
HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Tue Dec 16, 2003 5:31 pm

Last edited by Lutz on Tue Dec 16, 2003 7:25 pm, edited 2 times in total.
Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby HPW » Tue Dec 16, 2003 6:14 pm

HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby HPW » Tue Dec 16, 2003 6:24 pm

HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby HPW » Tue Dec 16, 2003 6:32 pm

HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Tue Dec 16, 2003 7:17 pm

Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby HPW » Tue Dec 16, 2003 7:34 pm

HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Tue Dec 16, 2003 8:00 pm

Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby HPW » Tue Dec 16, 2003 8:04 pm

HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Sammo » Tue Dec 16, 2003 8:05 pm

Sammo
 
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Postby HPW » Tue Dec 16, 2003 8:08 pm

HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Tue Dec 16, 2003 9:24 pm

Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby HPW » Wed Dec 17, 2003 6:36 am

HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby HPW » Wed Dec 17, 2003 4:36 pm

HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Wed Dec 17, 2003 4:53 pm

actually there is one:

(printf "%g %s %d %c\n" 1.23 "hello" 999 65) ; the 1.23 is a float

it is so transparent to the user now, that it is easily overlooked :-)

I am glad the DLL has such a good work-out with you, I hopt that the 14 pareameter slots are enought. I remember in one of your posts you needed 5*2 + 3 = 13 already. I could have gone to 16. But just going from 10 to 14 added about 500 bytes to the executable.

Also, for initializing memory Sam's version seems to be the best (fastest) to me:

(define (repstr n char-index)
(join (map char (series char-index 1 n))))

I guess the original point of this 'initialize memory contest' for me is that a solution with 'dotimes' is most of the time not necessary in LISP, 'map' is much faster and elegant.

Lutz
Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby HPW » Wed Dec 17, 2003 8:09 pm

HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Wed Dec 17, 2003 10:11 pm

what I need is some 'C' function which looks like

vacall(*functionPtr, *args[])

then I could write something general for as many parameters as you want. But how things are at the moment, I have to code (see nl-import.c ):

result = (*function)(args[0], args[1] ...... );

for every n from 0 to 14 (or 9*2 + 4 = 22 in your post), and it wastes a lot of space for a functionality rarely used.

there are the va_list(), va_start(), va_arg() macros but that doesn't help me if I don't have a function to bring the args on the call stack.

does anybody have an idea?

Lutz
Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby HPW » Thu Dec 18, 2003 6:37 am

>But just going from 10 to 14 added about 500 bytes to the executable.

So does we speak about 1 KB for 14 to 22 ?

>for every n from 0 to 14 (or 9*2 + 4 = 22 in your post),
>and it wastes a lot of space for a functionality rarely used.

Lot of space is relativ, because newLISP is so incredibel small.
Of cource you are right. When it is so rarly used by the majority
of users, it must give other workarounds through wrapper-dlls.

>then I could write something general for as many parameters as you want.

General solution are always the best. :-) But they must be possible. :-(

>does anybody have an idea?

My C knowledge is only basic and far away from a professional level.
In my used programming enviroments I mostly do not think about stacks.
(Only when I get a stack overflow)
Thats why I love lisp in all flavours! The enviroments care for me.
HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby HPW » Thu Dec 18, 2003 7:44 am

HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany


Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 1 guest