--- a/ExternalFunction.st Fri Sep 10 14:00:17 2004 +0200
+++ b/ExternalFunction.st Fri Sep 10 14:04:29 2004 +0200
@@ -35,7 +35,7 @@
* CAVEAT: floats are not allowed.
*/
INT
-convertST_to_C(stObj)
+convertST_to_C(stObj)
OBJ stObj;
{
INT flags, nInst;
@@ -111,7 +111,7 @@
return 0;
}
-%}
+%}
! !
!ExternalFunction class methodsFor:'documentation'!
@@ -134,9 +134,9 @@
"
Instances of this class represent external (non-Smalltalk) functions.
- Also, the class provides access to custom functions
- These custom functions enable you to call c functions
- even if no stc compiler is available
+ Also, the class provides access to custom functions
+ These custom functions enable you to call c functions
+ even if no stc compiler is available
(they are kind of what user-primitives are in ST-80).
You can register your own custom C-functions in a private main.c
and relink ST/X from the binaries.
@@ -145,10 +145,10 @@
If you have the stc compiler, we recommend using inline primitive
code: its much easier to enter, compile, debug and maintain.
(especially, to maintain, since the primitive code is contained
- in the classes source/object file - while custom functions are
+ in the classes source/object file - while custom functions are
external to the classLibraries).
- Non custom externalFunctions are created, when a non-ST shared library is loaded,
+ Non custom externalFunctions are created, when a non-ST shared library is loaded,
and returned by the ObjectFileHandles>>getFunction: method.
The C functions contained in that lib are callable (instances of myself)
@@ -176,13 +176,13 @@
Notice, that no doubles can be passed; the reason is that the calling
conventions (on stack, in registers, in FPU registers etc.) are so different among
- machines (and even compilers), that a general solution is not possible (difficult)
+ machines (and even compilers), that a general solution is not possible (difficult)
to program here. To pass doubles, either use shortFloats, or pack them into a DoubleArray.
For functions with up to 2 double arguments, specialized call methods are provided.
Sorry for that inconvenience.
-
+
- - This is still in construction and NOT yet published for
+ - This is still in construction and NOT yet published for
general use. For now, either use inline C-code, or use the customFunction call
mechanism.
@@ -208,7 +208,7 @@
f := handle getFunction:'function1'.
call it:
-
+
f callWith:999
"
! !
@@ -245,7 +245,7 @@
"
ExternalFunction callCustomFunction:0
- ExternalFunction callCustomFunction:999
+ ExternalFunction callCustomFunction:999
"
"Modified: 22.4.1996 / 18:06:52 / cg"
@@ -278,7 +278,7 @@
callCustomFunction:nr with:arg1 with:arg2 with:arg3
"call the custom function #nr with three arguments"
- ^ self callCustomFunction:nr
+ ^ self callCustomFunction:nr
withArguments:(Array with:arg1 with:arg2 with:arg3)
"Modified: 22.4.1996 / 18:07:18 / cg"
@@ -385,8 +385,8 @@
^ nil
"
- ExternalFunction indexOfCustomFunctionNamed:'demoFunction0'
- ExternalFunction indexOfCustomFunctionNamed:'fooBar'
+ ExternalFunction indexOfCustomFunctionNamed:'demoFunction0'
+ ExternalFunction indexOfCustomFunctionNamed:'fooBar'
"
! !
@@ -420,7 +420,7 @@
call
"call the underlying C function, passing no argument.
- The return value is interpreted as an integer
+ The return value is interpreted as an integer
(and must be converted to an externalBytes object,
if it is a pointer to something).
@@ -462,7 +462,7 @@
callOWith:arg
"call the underlying C function, passing a single object argument.
- The return value must be a valid object.
+ The return value must be a valid object.
DANGER alert: This is an unprotected low-level entry.
Not for normal application usage.
@@ -482,7 +482,7 @@
callOWith:arg1 with:arg2
"call the underlying C function, passing two args.
- The return value must be a valid object.
+ The return value must be a valid object.
DANGER alert: This is an unprotected low-level entry.
Not for normal application usage.
@@ -502,7 +502,7 @@
callOWith:arg1 with:arg2 with:arg3
"call the underlying C function, passing three args.
- The return value must be a valid object.
+ The return value must be a valid object.
DANGER alert: This is an unprotected low-level entry.
Not for normal application usage.
@@ -524,7 +524,7 @@
"call the underlying C function, passing a single argument.
The argument arg is converted to a corresponding C data type,
as defined in the convertST_to_C() function.
- The return value is interpreted as an integer
+ The return value is interpreted as an integer
(and must be converted to an externalBytes object,
if it is a pointer to something).
@@ -548,7 +548,7 @@
"call the underlying C function, passing two args.
The arguments are converted to a corresponding C data type,
as defined in the convertST_to_C() function.
- The return value is interpreted as an integer
+ The return value is interpreted as an integer
(and must be converted to an externalBytes object,
if it is a pointer to something).
@@ -572,7 +572,7 @@
"call the underlying C function, passing three args.
The arguments are converted to a corresponding C data type,
as defined in the convertST_to_C() function.
- The return value is interpreted as an integer
+ The return value is interpreted as an integer
(and must be converted to an externalBytes object,
if it is a pointer to something).
@@ -596,7 +596,7 @@
"call the underlying C function, passing up to 10 arguments.
The arguments are converted to a corresponding C data type,
as defined in the convertST_to_C() function.
- The return value is interpreted as an integer
+ The return value is interpreted as an integer
(and must be converted to an externalBytes object,
if it is a pointer to something).
@@ -768,7 +768,7 @@
].
moduleHandle notNil ifTrue:[
- aStream nextPutAll:' from: ''';
+ aStream nextPutAll:' from: ''';
nextPutAll:(moduleHandle pathName asFilename baseName);
nextPutAll:''''.
].
@@ -791,7 +791,7 @@
!ExternalFunction class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ExternalFunction.st,v 1.20 2003-10-14 10:32:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ExternalFunction.st,v 1.21 2004-09-10 12:04:29 cg Exp $'
! !
ExternalFunction initialize!
--- a/Make.spec Fri Sep 10 14:00:17 2004 +0200
+++ b/Make.spec Fri Sep 10 14:04:29 2004 +0200
@@ -1,4 +1,4 @@
-# $Header: /cvs/stx/stx/libbasic/Make.spec,v 1.27 2004-08-22 18:44:45 stefan Exp $
+# $Header: /cvs/stx/stx/libbasic/Make.spec,v 1.28 2004-09-10 12:04:29 cg Exp $
#
# -------------- no need to change anything below ----------
@@ -72,6 +72,7 @@
$(OUTDIR)SequenceableCollection.$(O)\
$(OUTDIR)ArrayedCollection.$(O) \
$(OUTDIR)UninterpretedBytes.$(O) \
+ $(OUTDIR)ExternalBytes.$(O) \
$(OUTDIR)Array.$(O) \
$(OUTDIR)WeakArray.$(O) \
$(OUTDIR)ByteArray.$(O) \
@@ -192,6 +193,8 @@
$(OUTDIR)PrivateMetaclass.$(O)\
$(OUTDIR)AutoloadMetaclass.$(O) \
$(OUTDIR)ExecutableFunction.$(O) \
+ $(OUTDIR)ExternalFunction.$(O) \
+ $(OUTDIR)ExternalLibraryFunction.$(O) \
$(OUTDIR)CompiledCode.$(O) \
$(OUTDIR)Block.$(O) \
$(OUTDIR)VarArgBlock.$(O) \
@@ -252,8 +255,6 @@
$(OUTDIR)EncodedStream.$(O) \
$(OUTDIR)UndefinedObject.$(O) \
$(OUTDIR)ExternalAddress.$(O) \
- $(OUTDIR)ExternalBytes.$(O) \
- $(OUTDIR)ExternalFunction.$(O) \
$(OUTDIR)MethodDictionary.$(O) \
$(OUTDIR)OSHandle.$(O) \
$(OUTDIR)OSFileHandle.$(O) \
--- a/abbrev.stc Fri Sep 10 14:00:17 2004 +0200
+++ b/abbrev.stc Fri Sep 10 14:04:29 2004 +0200
@@ -125,6 +125,7 @@
ExternalAddress ExternalAddress stx:libbasic 'System-Support' 0
ExternalBytes ExternalBytes stx:libbasic 'System-Support' 0
ExternalFunction ExternalFunction stx:libbasic 'System-Support' 0
+ExternalLibraryFunction ExternalLibraryFunction stx:libbasic 'System-Support' 0
ExternalStream ExternalStream stx:libbasic 'Streams-External' 0
False False stx:libbasic 'Kernel-Objects' 0
FileDirectory FileDirectory stx:libbasic 'Obsolete' 0
--- a/libInit.cc Fri Sep 10 14:00:17 2004 +0200
+++ b/libInit.cc Fri Sep 10 14:04:29 2004 +0200
@@ -35,6 +35,7 @@
_SequenceableCollection_Init(pass,__pRT__,snd);
_ArrayedCollection_Init(pass,__pRT__,snd);
_UninterpretedBytes_Init(pass,__pRT__,snd);
+_ExternalBytes_Init(pass,__pRT__,snd);
_Array_Init(pass,__pRT__,snd);
_WeakArray_Init(pass,__pRT__,snd);
_ByteArray_Init(pass,__pRT__,snd);
@@ -87,11 +88,11 @@
_TerminateProcessRequest_Init(pass,__pRT__,snd);
_RestartProcessRequest_Init(pass,__pRT__,snd);
_Error_Init(pass,__pRT__,snd);
+_ProceedableError_Init(pass,__pRT__,snd);
_MessageNotUnderstood_Init(pass,__pRT__,snd);
_ElementBoundsError_Init(pass,__pRT__,snd);
_TimeoutError_Init(pass,__pRT__,snd);
_VMInternalError_Init(pass,__pRT__,snd);
-_ProceedableError_Init(pass,__pRT__,snd);
_DeepCopyError_Init(pass,__pRT__,snd);
_SubclassResponsibilityError_Init(pass,__pRT__,snd);
_StreamError_Init(pass,__pRT__,snd);
@@ -155,6 +156,8 @@
_PrivateMetaclass_Init(pass,__pRT__,snd);
_AutoloadMetaclass_Init(pass,__pRT__,snd);
_ExecutableFunction_Init(pass,__pRT__,snd);
+_ExternalFunction_Init(pass,__pRT__,snd);
+_ExternalLibraryFunction_Init(pass,__pRT__,snd);
_CompiledCode_Init(pass,__pRT__,snd);
_Block_Init(pass,__pRT__,snd);
_VarArgBlock_Init(pass,__pRT__,snd);
@@ -215,8 +218,6 @@
_EncodedStream_Init(pass,__pRT__,snd);
_UndefinedObject_Init(pass,__pRT__,snd);
_ExternalAddress_Init(pass,__pRT__,snd);
-_ExternalBytes_Init(pass,__pRT__,snd);
-_ExternalFunction_Init(pass,__pRT__,snd);
_MethodDictionary_Init(pass,__pRT__,snd);
_OSHandle_Init(pass,__pRT__,snd);
_OSFileHandle_Init(pass,__pRT__,snd);