Commit fccd82a0 by kollo

added new pointer parameter type to CALL

parent 66e0d090
......@@ -10,4 +10,4 @@ Release notes for Version 1.25 (Sept 2016 -- 2017)
- improved USB functions (linux)
- make use of fftw library when available
- improved memory handling in 64bit versions
- new parameter list types for CALL
......@@ -11,16 +11,28 @@ DESCRIPTION:
If you want to specify other types, please use prefixes:
----*
D: -- double (8-Bytes)
F: -- float (4-Bytes)
L: -- long int, pointer (4-Bytes)
D: -- double (8 bytes)
F: -- float (4 bytes)
L: -- integer (4 bytes)
R: -- long integer (8 bytes)
W: -- short integer (2 bytes)
B: -- byte (1 byte)
P: -- pointer (4 bytes or 8 bytes, depending on the OS)
*----
COMMENT:
The Option P: behaves the same as L: on 32bit operating systems. But you
should use P: for pointers (VARPTR() etc...) into memory so that it can
be translated from X11-Basic internal 32bit representation to the 64bit
adresses on 64it operating systems.
The B: and W: options behave the same as the L: option.
EXAMPLE:
DIM result(100)
LINK #1,"simlib.so"
adr%=SYM_ADR(#1,"CalcBeta")
CALL adr%,D:1.2,L:0,L:VARPTR(result(0))
CALL adr%,D:1.2,L:0,P:VARPTR(result(0))
UNLINK #1
SEE ALSO: CALL(), EXEC
......
......@@ -1636,6 +1636,12 @@ int f_call(PARAMETER *plist,int e) {
} else if(strncmp(w1,"F:",2)==0) {
*((float *)(&gtt.feld[i-1]))=(float)parser(w1+2);
if(sizeof(float)>(sizeof(int))) i+=(sizeof(float)/sizeof(int))-1;
} else if(strncmp(w1,"P:",2)==0) { /* Pointer */
*((void **)(&gtt.feld[i-1]))=(void *)INT2POINTER((int)parser(w1+2));
if(sizeof(void *)>(sizeof(int))) i+=(sizeof(void *)/sizeof(int))-1;
} else if(strncmp(w1,"R:",2)==0) { /* Long Long Int */
*((long long *)(&gtt.feld[i-1]))=(long long)parser(w1+2);
if(sizeof(long long)>(sizeof(int))) i+=(sizeof(long long)/sizeof(int))-1;
} else if(strncmp(w1,"L:",2)==0) gtt.feld[i-1]=(int)parser(w1+2);
else if(strncmp(w1,"W:",2)==0) gtt.feld[i-1]=(int)parser(w1+2);
else if(strncmp(w1,"B:",2)==0) gtt.feld[i-1]=(int)parser(w1+2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment