ExternalFunction.st
author james
Thu, 25 Oct 2001 08:04:22 +0200
changeset 6102 7fdf73f3256b
parent 5164 005ca26bf53a
child 7257 b9f0fb923c72
permissions -rw-r--r--
initial checkin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
ExecutableFunction subclass:#ExternalFunction
1542
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
    14
	instanceVariableNames:'name moduleHandle'
1184
e15a6702c812 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    15
	classVariableNames:'InvalidCustomFunctionSignal'
e15a6702c812 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    16
	poolDictionaries:''
e15a6702c812 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    17
	category:'System-Support'
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
!
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    19
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
    20
!ExternalFunction primitiveDefinitions!
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
    21
%{
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
    22
typedef INT  (*LINTFUNC)();
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
    23
%}
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
    24
! !
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
!ExternalFunction primitiveFunctions!
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
%{
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
/*
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 * given an ST-object, make something useful for C
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 * cast it to an int
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 *
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 * CAVEAT: floats are not allowed.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 */
2769
2fd416e4b589 alpha64 changes
Claus Gittinger <cg@exept.de>
parents: 1547
diff changeset
    35
INT
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
convertST_to_C(stObj) 
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
    OBJ stObj;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
{
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    39
        INT flags, nInst;
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    40
        OBJ *oP;
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
    41
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    42
        if (__isString(stObj) || __isSymbol(stObj)) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    43
            return (INT)(__stringVal(stObj));
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    44
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    45
        if (__isByteArray(stObj)) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    46
            return (INT)(__ByteArrayInstPtr(stObj)->ba_element);
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    47
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    48
        if (__isExternalBytes(stObj)) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    49
            return (INT)(__externalBytesAddress(stObj));
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    50
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    51
        if (__isExternalAddress(stObj)) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    52
            return (INT)(__externalAddressVal(stObj));
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    53
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    54
        if (__isExternalFunction(stObj)) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    55
            return (INT)(__externalFunctionVal(stObj));
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    56
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    57
        if (__isSmallInteger(stObj)) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    58
            return (INT)(__intVal(stObj));
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    59
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    60
        if (__isLargeInteger(stObj)) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    61
            return (INT)(__signedLongIntVal(stObj));
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    62
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    63
        if (__isCharacter(stObj)) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    64
            return (INT)(__intVal(__characterVal(stObj)));
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    65
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    66
        if (stObj == nil) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    67
            return 0;
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    68
        }
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
    69
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    70
        if (__qClass(stObj) == @global(ShortFloat)) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    71
            return (INT)(__shortFloatVal(stObj));
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    72
        }
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
    73
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
    74
        flags = __intVal(__ClassInstPtr(__qClass(stObj))->c_flags) & ARRAYMASK;
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    75
        nInst = __intVal(__ClassInstPtr(__qClass(stObj))->c_ninstvars);
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    76
        oP = (OBJ *)__InstPtr(stObj)->i_instvars[nInst];
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
    77
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    78
        if (flags & FLOATARRAY) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    79
            return (INT)(oP);
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    80
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    81
        if (flags & DOUBLEARRAY) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    82
            return (INT)(oP);
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    83
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    84
        if (flags & DOUBLEARRAY) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    85
            return (INT)(oP);
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    86
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    87
        if (flags & BYTEARRAY) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    88
            return (INT)(oP);
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    89
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    90
        if (flags & WORDARRAY) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    91
            return (INT)(oP);
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    92
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    93
        if (flags & LONGARRAY) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    94
            return (INT)(oP);
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    95
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    96
        if (flags & SWORDARRAY) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    97
            return (INT)(oP);
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    98
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
    99
        if (flags & SLONGARRAY) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   100
            return (INT)(oP);
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   101
        }
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   102
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   103
        if (stObj == true) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   104
            return 1;
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   105
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   106
        if (stObj == false) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   107
            return 0;
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   108
        }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   109
        return 0;
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
}
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
%}   
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
! !
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   115
!ExternalFunction class methodsFor:'documentation'!
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
copyright
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
"
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
 COPYRIGHT (c) 1994 by Claus Gittinger
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
	      All Rights Reserved
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
 This software is furnished under a license and may be used
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
 only in accordance with the terms of that license and with the
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
 inclusion of the above copyright notice.   This software may not
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
 be provided or otherwise made available to, or used by, any
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
 other person.  No title to or ownership of the software is
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
 hereby transferred.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
"
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
!
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
documentation
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
"
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    Instances of this class represent external (non-Smalltalk) functions.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
    Also, the class provides access to custom functions 
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   136
    These custom functions enable you to call c functions 
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   137
    even if no stc compiler is available 
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   138
    (they are kind of what user-primitives are in ST-80).
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   139
    You can register your own custom C-functions in a private main.c
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   140
    and relink ST/X from the binaries.
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    (see the demo functions provided in main.c).
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   143
    If you have the stc compiler, we recommend using inline primitive
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   144
    code: its much easier to enter, compile, debug and maintain.
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   145
    (especially, to maintain, since the primitive code is contained
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   146
     in the classes source/object file - while custom functions are 
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   147
     external to the classLibraries).
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   149
    Non custom externalFunctions are created, when a non-ST shared library is loaded, 
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   150
    and returned by the ObjectFileHandles>>getFunction: method.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   151
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   152
    The C functions contained in that lib are callable (instances of myself)
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   153
    with the call / callWith: methods.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   154
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   155
    ST-arguments are converted to C as follows:
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   156
	ST class	    C argument
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   157
	------------------------------
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   158
	SmallInteger	    int
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   159
	LargeInteger	    int	(must be 4-byte unsigned largeInteger)
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   160
	String		    char *
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   161
	Symbol		    char *
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   162
	Character	    int
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   163
	ExternalBytes	    char *
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   164
	ExternalAddress	    char *
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   165
	ExternalFunction    char *
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   166
	FloatArray	    float *
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   167
	DoubleArray	    double *
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   168
	ByteArray	    char *
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   169
	ShortFloat	    float
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   170
	true		    1
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   171
	false		    0
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   172
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   173
    The returned value is converted to an unsigned integer (smallInteger or largeInteger).
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   174
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   175
    Notice, that no doubles can be passed; the reason is that the calling
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   176
    conventions (on stack, in registers, in FPU registers etc.) are so different among
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   177
    machines (and even compilers), that a general solution is not possible (difficult) 
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   178
    to program here. To pass doubles, either use shortFloats, or pack them into a DoubleArray.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   179
    For functions with up to 2 double arguments, specialized call methods are provided.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   180
    Sorry for that inconvenience.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   181
    
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   182
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   183
    - This is still in construction and NOT yet published for 
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   184
      general use. For now, either use inline C-code, or use the customFunction call
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   185
      mechanism.
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   186
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   187
    [author:]
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   188
        Claus Gittinger
1317
cc737e0fdf48 examples
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
   189
cc737e0fdf48 examples
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
   190
    [see also:]
cc737e0fdf48 examples
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
   191
        ExternalAddress ExternalBytes
cc737e0fdf48 examples
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
   192
        ( how to write primitive code :html: programming/primitive.html )
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
"
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   194
!
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   195
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   196
examples
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   197
"
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   198
    see a sample demo c file in doc/coding/cModules;
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   199
    compile and link (shared) it to an object module.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   200
    Load it into the system:
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   201
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   202
	handle := ObjectFileLoader loadDynamicObject:'demo1.o'.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   203
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   204
    get a C-function (an instance of ExternalFunction):
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   205
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   206
	f := handle getFunction:'function1'.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   207
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   208
    call it:
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   209
	
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   210
	f callWith:999
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   211
"
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
! !
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   214
!ExternalFunction class methodsFor:'initialization'!
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
initialize
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   217
    "create signals"
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   218
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
    InvalidCustomFunctionSignal isNil ifTrue:[
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   220
        InvalidCustomFunctionSignal := ExecutionErrorSignal newSignalMayProceed:true.
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   221
        InvalidCustomFunctionSignal nameClass:self message:#invalidCustomFunctionSignal.
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   222
        InvalidCustomFunctionSignal notifierString:'attempt to execute unknown custom function'.
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
    ]
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   224
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   225
    "Modified: 22.4.1996 / 18:08:55 / cg"
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
! !
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   228
!ExternalFunction class methodsFor:'Signal constants'!
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
invalidCustomFunctionSignal
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
    "return the signal raised when a non existent custom function is
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
     called for."
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
    ^ InvalidCustomFunctionSignal
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
! !
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   237
!ExternalFunction class methodsFor:'calling custom functions'!
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
callCustomFunction:nr
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   240
    "call the custom function #nr without arguments"
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   241
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
    ^ self callCustomFunction:nr withArguments:#()
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
     ExternalFunction callCustomFunction:0
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
     ExternalFunction callCustomFunction:999 
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
    "
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   248
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   249
    "Modified: 22.4.1996 / 18:06:52 / cg"
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
!
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
callCustomFunction:nr with:arg
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   253
    "call the custom function #nr with a single argument"
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   254
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
    ^ self callCustomFunction:nr withArguments:(Array with:arg)
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
     ExternalFunction callCustomFunction:1 with:'hello world'
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
    "
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   260
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   261
    "Modified: 22.4.1996 / 18:07:03 / cg"
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
!
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
callCustomFunction:nr with:arg1 with:arg2
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   265
    "call the custom function #nr with two arguments"
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   266
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
    ^ self callCustomFunction:nr withArguments:(Array with:arg1 with:arg2)
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
     ExternalFunction callCustomFunction:2 with:(Float pi) with:1.0
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
    "
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   272
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   273
    "Modified: 22.4.1996 / 18:07:11 / cg"
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
!
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
callCustomFunction:nr with:arg1 with:arg2 with:arg3
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   277
    "call the custom function #nr with three arguments"
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   278
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
    ^ self callCustomFunction:nr 
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   280
                withArguments:(Array with:arg1 with:arg2 with:arg3)
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   281
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   282
    "Modified: 22.4.1996 / 18:07:18 / cg"
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
!
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
callCustomFunction:nr withArguments:argArray
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   286
    "call the custom function #nr with arguments from argArray"
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   287
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
    |retVal called|
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
%{
917
57dd3973f35f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 856
diff changeset
   291
#ifndef __stxNCustomFunctions__
856
d2c9f9ecedcf renamed customFunction-globals
Claus Gittinger <cg@exept.de>
parents: 848
diff changeset
   292
    extern int __stxNCustomFunctions__;
d2c9f9ecedcf renamed customFunction-globals
Claus Gittinger <cg@exept.de>
parents: 848
diff changeset
   293
    extern CUSTOMFUNCTION __stxCustomFunctions__[];
917
57dd3973f35f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 856
diff changeset
   294
#endif
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
    int (* func)();
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
    called = false;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
    if (__isSmallInteger(nr) && __isArray(argArray)) {
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   299
        int nargs = __arraySize(argArray);
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   300
        int functionNr;
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   302
        functionNr = __intVal(nr);
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   303
        if ((functionNr >= 0) && (functionNr < __stxNCustomFunctions__)) {
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   304
            /*
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   305
             * now, call the function; passing nargs and arg-vector
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   306
             */
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   307
            func = __stxCustomFunctions__[functionNr].func;
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   308
            if (func) {
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   309
                int ok;
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   311
                retVal = self;
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   312
                ok = (*func)(nargs, &retVal, __ArrayInstPtr(argArray)->a_element);
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   313
                if (ok) {
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   314
                    RETURN (retVal);
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   315
                }
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   316
                called = true;
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   317
            }
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   318
        }
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
    }
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
%}.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
    called ifTrue:[
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   322
        "
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   323
         the customFunction returned 0 (failure)
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   324
        "
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   325
        ^ self primitiveFailed
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
    ].
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
     an invalid customFunction-nr was given,
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
    InvalidCustomFunctionSignal raise
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
     ExternalFunction callCustomFunction:2 withArguments:#(1.0 1.0)
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
     ExternalFunction callCustomFunction:999 withArguments:#(1.0 1.0)
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
!
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
callCustomFunctionNamed:name withArguments:argArray
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   341
    "call a custom function by name with arguments from argArray"
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   342
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
    |index|
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
    index := self indexOfCustomFunctionNamed:name.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
    index notNil ifTrue:[
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   347
        ^ self callCustomFunction:index withArguments:argArray
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
    ].
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
     no such function exists
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
    InvalidCustomFunctionSignal raise
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
     ExternalFunction callCustomFunctionNamed:'demoFunction0'
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   356
                                withArguments:#()
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
    "
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   358
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   359
    "Modified: 22.4.1996 / 18:08:09 / cg"
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
!
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
indexOfCustomFunctionNamed:functionName
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   363
    "return the index of a named custom function"
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
%{  /* NOCONTEXT */
917
57dd3973f35f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 856
diff changeset
   366
#ifndef __stxNCustomFunctions__
856
d2c9f9ecedcf renamed customFunction-globals
Claus Gittinger <cg@exept.de>
parents: 848
diff changeset
   367
    extern int __stxNCustomFunctions__;
d2c9f9ecedcf renamed customFunction-globals
Claus Gittinger <cg@exept.de>
parents: 848
diff changeset
   368
    extern CUSTOMFUNCTION __stxCustomFunctions__[];
917
57dd3973f35f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 856
diff changeset
   369
#endif
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
    if (__isString(functionName)) {
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   372
        char *nm;
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   373
        int i;
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   375
        nm = (char *)__stringVal(functionName);
1257
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   376
        for (i=0; i < __stxNCustomFunctions__; i++) {
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   377
           if (strcmp(__stxCustomFunctions__[i].name, nm) == 0) {
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   378
                RETURN (__MKSMALLINT(i));
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   379
           }
f98014b76dd1 commentary
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   380
        }
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
    }
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
%}.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
    ^ nil
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
     ExternalFunction indexOfCustomFunctionNamed:'demoFunction0'  
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
     ExternalFunction indexOfCustomFunctionNamed:'fooBar' 
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
! !
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   391
!ExternalFunction class methodsFor:'queries'!
1184
e15a6702c812 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   392
e15a6702c812 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   393
isBuiltInClass
1267
e285a3a94d9e commentary
Claus Gittinger <cg@exept.de>
parents: 1257
diff changeset
   394
    "return true if this class is known by the run-time-system.
e285a3a94d9e commentary
Claus Gittinger <cg@exept.de>
parents: 1257
diff changeset
   395
     Here, true is returned for myself, false for subclasses."
1184
e15a6702c812 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   396
e15a6702c812 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   397
    ^ self == ExternalFunction
e15a6702c812 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   398
e15a6702c812 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   399
    "Created: 16.4.1996 / 11:24:50 / cg"
1267
e285a3a94d9e commentary
Claus Gittinger <cg@exept.de>
parents: 1257
diff changeset
   400
    "Modified: 23.4.1996 / 15:58:55 / cg"
1184
e15a6702c812 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   401
! !
e15a6702c812 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   402
1542
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   403
!ExternalFunction methodsFor:'accessing'!
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   404
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   405
moduleHandle
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   406
    "return the functions moduleHandle (nil if not loaded dynamically)"
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   407
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   408
    ^ moduleHandle
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   409
!
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   410
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   411
name
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   412
    "return the functions name"
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   413
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   414
    ^ name
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   415
! !
cdcf4ad7556f need name & moduleHandle for the ObjectFileLoader to be able to recreate
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   416
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
!ExternalFunction methodsFor:'function calling'!
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
call
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
    "call the underlying C function, passing no argument.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
     The return value is interpreted as an integer 
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
     (and must be converted to an externalBytes object,
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
      if it is a pointer to something).
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
     DANGER alert: This is an unprotected low-level entry.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
     Not for normal application usage.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
%{
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   429
    LINTFUNC func;
2769
2fd416e4b589 alpha64 changes
Claus Gittinger <cg@exept.de>
parents: 1547
diff changeset
   430
    INT retVal;
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   432
    func = (LINTFUNC) __INST(code_);
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   433
    if (func) {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   434
        retVal = (*func)();
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   435
        RETURN (__MKINT(retVal));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   436
    }
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   437
%}.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   438
    self primitiveFailed
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
!
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
5164
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   441
callO
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   442
    "call the underlying C function, passing no argument.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   443
     The return value must be a valid object.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   444
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   445
     DANGER alert: This is an unprotected low-level entry.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   446
     Not for normal application usage.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   447
    "
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   448
%{
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   449
    OBJFUNC func;
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   450
    OBJ retVal;
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   451
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   452
    func = (OBJFUNC) __INST(code_);
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   453
    if (func) {
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   454
        retVal = (*func)();
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   455
        RETURN (retVal);
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   456
    }
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   457
%}.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   458
    self primitiveFailed
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   459
!
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   460
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   461
callOWith:arg
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   462
    "call the underlying C function, passing a single object argument.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   463
     The return value must be a valid object. 
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   464
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   465
     DANGER alert: This is an unprotected low-level entry.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   466
     Not for normal application usage.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   467
    "
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   468
%{
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   469
    OBJFUNC func;
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   470
    OBJ retVal;
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   471
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   472
    func = (OBJFUNC) __INST(code_);
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   473
    if (func) {
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   474
        retVal = (*func)(arg);
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   475
        RETURN (retVal);
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   476
    }
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   477
%}.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   478
    self primitiveFailed
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   479
!
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   480
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   481
callOWith:arg1 with:arg2
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   482
    "call the underlying C function, passing two args.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   483
     The return value must be a valid object. 
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   484
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   485
     DANGER alert: This is an unprotected low-level entry.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   486
     Not for normal application usage.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   487
    "
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   488
%{
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   489
    OBJFUNC func;
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   490
    OBJ retVal;
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   491
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   492
    func = (OBJFUNC) __INST(code_);
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   493
    if (func) {
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   494
        retVal = (*func)(arg1, arg2);
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   495
        RETURN (retVal);
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   496
    }
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   497
%}.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   498
    self primitiveFailed
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   499
!
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   500
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   501
callOWith:arg1 with:arg2 with:arg3
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   502
    "call the underlying C function, passing three args.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   503
     The return value must be a valid object. 
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   504
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   505
     DANGER alert: This is an unprotected low-level entry.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   506
     Not for normal application usage.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   507
    "
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   508
%{
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   509
    OBJFUNC func;
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   510
    INT retVal;
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   511
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   512
    func = (OBJFUNC) __INST(code_);
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   513
    if (func) {
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   514
        retVal = (*func)(arg1, arg2, arg3);
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   515
        RETURN (retVal);
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   516
    }
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   517
%}.
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   518
    self primitiveFailed
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   519
!
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   520
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
callWith:arg
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
    "call the underlying C function, passing a single argument.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
     The argument arg is converted to a corresponding C data type,
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
     as defined in the convertST_to_C() function.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
     The return value is interpreted as an integer 
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
     (and must be converted to an externalBytes object,
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
      if it is a pointer to something).
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
     DANGER alert: This is an unprotected low-level entry.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
     Not for normal application usage.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
%{
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   533
    LINTFUNC func;
2769
2fd416e4b589 alpha64 changes
Claus Gittinger <cg@exept.de>
parents: 1547
diff changeset
   534
    INT retVal;
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   536
    func = (LINTFUNC) __INST(code_);
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   537
    if (func) {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   538
        retVal = (*func)(convertST_to_C(arg));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   539
        RETURN (__MKINT(retVal));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   540
    }
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   541
%}.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   542
    self primitiveFailed
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
!
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   545
callWith:arg1 with:arg2
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   546
    "call the underlying C function, passing two args.
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   547
     The arguments are converted to a corresponding C data type,
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   548
     as defined in the convertST_to_C() function.
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   549
     The return value is interpreted as an integer 
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   550
     (and must be converted to an externalBytes object,
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   551
      if it is a pointer to something).
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   552
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   553
     DANGER alert: This is an unprotected low-level entry.
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   554
     Not for normal application usage.
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   555
    "
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   556
%{
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   557
    LINTFUNC func;
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   558
    INT retVal;
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   559
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   560
    func = (LINTFUNC) __INST(code_);
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   561
    if (func) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   562
        retVal = (*func)(convertST_to_C(arg1), convertST_to_C(arg2));
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   563
        RETURN (__MKINT(retVal));
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   564
    }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   565
%}.
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   566
    self primitiveFailed
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   567
!
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   568
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   569
callWith:arg1 with:arg2 with:arg3
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   570
    "call the underlying C function, passing three args.
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   571
     The arguments are converted to a corresponding C data type,
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   572
     as defined in the convertST_to_C() function.
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   573
     The return value is interpreted as an integer 
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   574
     (and must be converted to an externalBytes object,
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   575
      if it is a pointer to something).
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   576
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   577
     DANGER alert: This is an unprotected low-level entry.
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   578
     Not for normal application usage.
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   579
    "
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   580
%{
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   581
    LINTFUNC func;
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   582
    INT retVal;
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   583
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   584
    func = (LINTFUNC) __INST(code_);
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   585
    if (func) {
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   586
        retVal = (*func)(convertST_to_C(arg1), convertST_to_C(arg2), convertST_to_C(arg3));
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   587
        RETURN (__MKINT(retVal));
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   588
    }
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   589
%}.
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   590
    self primitiveFailed
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   591
!
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   592
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   593
callWithArguments:argArray
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   594
    "call the underlying C function, passing up to 10 arguments.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   595
     The arguments are converted to a corresponding C data type,
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   596
     as defined in the convertST_to_C() function.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   597
     The return value is interpreted as an integer 
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   598
     (and must be converted to an externalBytes object,
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
      if it is a pointer to something).
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   600
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
     DANGER alert: This is an unprotected low-level entry.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   602
     Not for normal application usage.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
    "
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   604
%{
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   605
    LINTFUNC func;
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   606
#   define NUMARGS 10
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   607
    INT args[NUMARGS];
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   608
    INT retVal;
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
    OBJ *ap;
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   610
    INT convertST_to_C();
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   612
    func = (LINTFUNC) __INST(code_);
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   613
    if (func && __isArray(argArray)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   614
	int n = __arraySize(argArray);
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
	int i;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
	if (n <= 10) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   618
	    ap = __ArrayInstPtr(argArray)->a_element;
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
	    for (i=0; i<NUMARGS; i++) {
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
		args[i] = convertST_to_C(*ap++);
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
	    }
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
	}
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
	switch (n) {
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
	    case 0:
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
		retVal = (*func)();
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
		break;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
	    case 1:
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
		retVal = (*func)(args[0]);
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
		break;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
	    case 2:
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   631
		retVal = (*func)(args[0], args[1]);
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
		break;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
	    case 3:
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
		retVal = (*func)(args[0], args[1], args[2]);
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
		break;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
	    case 4:
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
		retVal = (*func)(args[0], args[1], args[2], args[3]);
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
		break;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
	    case 5:
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
		retVal = (*func)(args[0], args[1], args[2], args[3],
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
				 args[4]);
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
		break;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
	    case 6:
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
		retVal = (*func)(args[0], args[1], args[2], args[3],
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
				 args[4], args[5]);
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
		break;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
	    case 7:
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
		retVal = (*func)(args[0], args[1], args[2], args[3],
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
				 args[4], args[5], args[6]);
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
		break;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
	    case 8:
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
		retVal = (*func)(args[0], args[1], args[2], args[3],
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
				 args[4], args[5], args[6], args[7]);
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
		break;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
	    case 9:
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
		retVal = (*func)(args[0], args[1], args[2], args[3],
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
				 args[4], args[5], args[6], args[7],
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
				 args[8]);
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
		break;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   660
	    case 10:
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
		retVal = (*func)(args[0], args[1], args[2], args[3],
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
				 args[4], args[5], args[6], args[7],
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   663
				 args[8], args[9]);
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
		break;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
	    default:
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
		goto err;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
	}
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
	RETURN (__MKINT(retVal));
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
    }
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
  err: ;
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
%}.
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
    self primitiveFailed
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   673
!
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   674
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   675
callWithDouble:aFloatArg returnsDouble:doubleFlag
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   676
    "call the underlying C function, passing a single double argument.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   677
     The returnsDouble flag specifies if the returnValue is a double; if false,
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   678
     an integer returnValue is assumed."
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   679
%{
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   680
    typedef double  (*DOUBLEFUNC)();
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   681
    LINTFUNC func;
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   682
    DOUBLEFUNC dfunc;
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   683
    double arg, dretVal;
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   684
    INT retVal;
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   685
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   686
    func = (LINTFUNC) __INST(code_);
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   687
    if (func) {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   688
        if (__isFloat(aFloatArg)) {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   689
	    arg = __floatVal(aFloatArg);
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   690
	} else if (__isShortFloat(aFloatArg)) {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   691
	    arg = (double)(__shortFloatVal(aFloatArg));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   692
	} else {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   693
	    arg = (double)(__signedLongIntVal(aFloatArg));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   694
	}
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   695
	if (doubleFlag == true) {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   696
	    dfunc = (DOUBLEFUNC)func;
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   697
	    dretVal = (*dfunc)(arg);
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   698
	    RETURN (__MKFLOAT(dretVal));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   699
	} else {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   700
	    retVal = (*func)(arg);
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   701
	    RETURN (__MKINT(retVal));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   702
	}
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   703
    }
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   704
%}.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   705
    self primitiveFailed
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   706
!
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   707
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   708
callWithDouble:aFloatArg1 withDouble:aFloatArg2 returnsDouble:doubleFlag
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   709
    "call the underlying C function, passing two double arguments.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   710
     The returnsDouble flag specifies if the returnValue is a double; if false,
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   711
     an integer returnValue is assumed."
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   712
%{
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   713
    typedef double  (*DOUBLEFUNC)();
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   714
    LINTFUNC func;
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   715
    DOUBLEFUNC dfunc;
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   716
    double arg1, arg2, dretVal;
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   717
    int retVal;
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   718
2880
87d9ea943024 alpha stuff
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
   719
    func = (LINTFUNC) __INST(code_);
1545
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   720
    if (func) {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   721
        if (__isFloat(aFloatArg1)) {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   722
            arg1 = __floatVal(aFloatArg1);
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   723
        } else if (__isShortFloat(aFloatArg1)) {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   724
            arg1 = (double)(__shortFloatVal(aFloatArg1));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   725
        } else {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   726
            arg1 = (double)(__signedLongIntVal(aFloatArg1));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   727
        }
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   728
        if (__isFloat(aFloatArg2)) {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   729
            arg2 = __floatVal(aFloatArg2);
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   730
        } else if (__isShortFloat(aFloatArg2)) {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   731
            arg2 = (double)(__shortFloatVal(aFloatArg2));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   732
        } else {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   733
            arg2 = (double)(__signedLongIntVal(aFloatArg2));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   734
        }
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   735
        if (doubleFlag == true) {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   736
            dfunc = (DOUBLEFUNC)func;
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   737
            dretVal = (*dfunc)(arg1, arg2);
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   738
            RETURN (__MKFLOAT(dretVal));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   739
        } else {
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   740
            retVal = (*func)(arg1, arg2);
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   741
            RETURN (__MKINT(retVal));
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   742
        }
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   743
    }
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   744
%}.
01e11b46ca65 more possible argument types
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   745
    self primitiveFailed
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   746
! !
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   747
1547
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   748
!ExternalFunction methodsFor:'printing & storing'!
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   749
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   750
printOn:aStream
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   751
    "append a printed representation of the receiver to aStream"
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   752
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   753
    |addr|
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   754
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   755
    name isNil ifTrue:[^ super printOn:aStream].
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   756
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   757
    aStream nextPutAll:self class name; nextPutAll:'(name: ''';
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   758
            nextPutAll:name; nextPutAll:''' address: '.
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   759
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   760
    addr := self code.
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   761
    addr isNil ifTrue:[
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   762
        aStream nextPutAll:'** unloaded **'
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   763
    ] ifFalse:[
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   764
        aStream nextPutAll:'0x';
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   765
                nextPutAll:(addr hexPrintString)
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   766
    ].
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   767
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   768
    moduleHandle notNil ifTrue:[
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   769
        aStream nextPutAll:' from: '''; 
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   770
                nextPutAll:(moduleHandle pathName asFilename baseName);
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   771
                nextPutAll:''''.
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   772
    ].
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   773
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   774
    aStream nextPutAll:')'
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   775
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   776
    "Modified: 12.7.1996 / 23:31:49 / cg"
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   777
! !
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   778
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   779
!ExternalFunction methodsFor:'private loader access'!
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   780
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   781
setName:aString moduleHandle:aHandle
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   782
    "set the name & moduleHandle.
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   783
     This is a private interface for the objectFileLoader; not for public use."
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   784
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   785
    name := aString.
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   786
    moduleHandle := aHandle
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   787
! !
fa7cc4070fc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   788
3612
5d6fc1e8e578 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
   789
!ExternalFunction class methodsFor:'documentation'!
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   790
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
version
5164
005ca26bf53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
   792
    ^ '$Header: /cvs/stx/stx/libbasic/ExternalFunction.st,v 1.17 2000-01-10 13:37:09 cg Exp $'
848
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
! !
76a83f34c26a moved ExtBytes & ExtFunc from libbasic2
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   794
ExternalFunction initialize!