diff -u --recursive smalltalk-1.96/ChangeLog so/ChangeLog --- smalltalk-1.96/ChangeLog Fri May 4 09:42:40 2001 +++ so/ChangeLog Thu Oct 18 04:02:18 2001 @@ -1,3 +1,10 @@ +Wed Oct 17 19:48:14 2001 David Forster (address@hidden) + + * libgst/cint.c: add uInt and uLong support for C interface. + Change longType return to use fromCLong. + * libgst/symc.c: add uIntSymbol and uLongSymbol. + * doc/gst.texi: update C callout description. + Fri May 4 17:32:00 2001 Paolo Bonzini (address@hidden) * examples/modules/regex.st: added a Regex class diff -u --recursive smalltalk-1.96/doc/gst.texi so/doc/gst.texi --- smalltalk-1.96/doc/gst.texi Fri May 4 09:57:54 2001 +++ so/doc/gst.texi Wed Oct 17 19:44:10 2001 @@ -2107,9 +2107,15 @@ @item int A C int value address@hidden uInt +A C unsigned int value + @item long A C long value address@hidden uLong +A C unsigned long value + @item double A C double, converted to an instance of Float @@ -2169,9 +2175,15 @@ @item int passed as @code{int} address@hidden uInt +passed as @code{unsigned int} + @item long passed as @code{long} address@hidden uLong +passed as @code{unsigned long} + @item double passed as @code{double} @@ -2215,8 +2227,12 @@ @item double @tab Float @tab double (C promotion) @item int @tab Boolean (True, False)@tab int @item int @tab Integer @tab int address@hidden uInt @tab Boolean (True, False)@tab unsigned int address@hidden uInt @tab Integer @tab unsigned int @item long @tab Boolean (True, False)@tab long @item long @tab Integer @tab long address@hidden uLong @tab Boolean (True, False)@tab unsigned long address@hidden uLong @tab Integer @tab unsigned long @item smalltalk, selfSmalltalk @tab anything @tab OOP @item string @tab String @tab char * @item string @tab Symbol @tab char * diff -u --recursive smalltalk-1.96/libgst/cint.c so/libgst/cint.c --- smalltalk-1.96/libgst/cint.c Fri May 4 09:54:17 2001 +++ so/libgst/cint.c Thu Oct 18 04:06:38 2001 @@ -101,7 +101,9 @@ byteArrayOutType, booleanType, intType, + uIntType, longType, + uLongType, floatType, doubleType, voidType, /* valid only as a return type */ @@ -145,12 +147,12 @@ } StringInfo; typedef union CParamUnionUnion { - int intVal; - long longVal; - voidPtr ptrVal; - float floatVal; - double doubleVal; - int valueVec[sizeof(double) / sizeof(int)]; + int intVal; + long longVal; + voidPtr ptrVal; + float floatVal; + double doubleVal; + int valueVec[sizeof(double) / sizeof(int)]; } CParamUnion; /* Element type for the name-to-C-function mapping table. */ @@ -202,7 +204,9 @@ "char *", /* byteArrayOutType */ "int", /* booleanType */ "int", /* intType */ + "unsigned int", /* uIntType */ "long", /* longType */ + "unsigned long", /* uLongType */ "float", /* floatType */ "double", /* doubleType */ "void?", /* voidType */ @@ -225,7 +229,9 @@ { &byteArrayOutSymbol, byteArrayOutType }, { &booleanSymbol, booleanType }, { &intSymbol, intType }, + { &uIntSymbol, uIntType }, { &longSymbol, longType }, + { &uLongSymbol, uLongType }, { &floatSymbol, floatType }, { &doubleSymbol, doubleType }, { &voidSymbol, voidType }, @@ -865,20 +871,20 @@ errorf("Attempted to pass a non-CObject as a cObjectPtr"); } } else if (isAKindOf(class, integerClass)) { - if (cType == longType || cType == unknownType) { + if (cType == longType || cType == uLongType || cType == unknownType) { u.longVal = toCLong(oop); pushObj(&u, longAlign); - } else if (cType == intType || cType == charType) { + } else if (cType == intType || cType == uIntType || cType == charType) { u.intVal = toCInt(oop); pushObj(&u, intAlign); } else { badType(class, cType); } } else if (oop == trueOOP || oop == falseOOP) { - if (cType == intType || cType == booleanType || cType == charType || cType == unknownType) { + if (cType == intType || cType == uIntType || cType == booleanType || cType == charType || cType == unknownType) { u.intVal = (oop == trueOOP); pushObj(&u, intAlign); - } else if (cType == longType) { + } else if (cType == longType || cType == uLongType ) { u.longVal = (oop == trueOOP); pushObj(&u, longAlign); } else { @@ -1039,7 +1045,9 @@ CFuncDescriptor desc; { int intResult; + unsigned int uIntResult; long longResult; + unsigned long uLongResult; double doubleResult; pVoidFunc cFunction; CDataType returnType; @@ -1084,9 +1092,19 @@ setStackTopInt((long)intResult); break; + case uIntType: + uIntResult = doTheCall(unsigned int); + setStackTopInt((long)uIntResult); + break; + case longType: longResult = doTheCall(long); - setStackTop(fromInt(longResult)); + setStackTop(fromCLong(longResult)); + break; + + case uLongType: + uLongResult = doTheCall(unsigned long); + setStackTop(fromCULong(uLongResult)); break; case stringType: diff -u --recursive smalltalk-1.96/libgst/sym.c so/libgst/sym.c --- smalltalk-1.96/libgst/sym.c Fri May 4 09:55:23 2001 +++ so/libgst/sym.c Wed Oct 17 19:43:41 2001 @@ -105,8 +105,8 @@ doesNotUnderstandColonSymbol, mustBeBooleanSymbol, terminateSymbol, asScaledDecimalSymbol, unknownSymbol, charSymbol, stringSymbol, - stringOutSymbol, symbolSymbol, intSymbol, - longSymbol, floatSymbol, doubleSymbol, + stringOutSymbol, symbolSymbol, intSymbol, uIntSymbol, + longSymbol, uLongSymbol, floatSymbol, doubleSymbol, booleanSymbol, voidSymbol, variadicSymbol, cObjectSymbol, cObjectPtrSymbol, smalltalkSymbol, byteArraySymbol, byteArrayOutSymbol, undeclaredSymbol, @@ -163,10 +163,12 @@ { &ifTrueColonSymbol, "ifTrue:" }, { &integerDivideSymbol, "//" }, { &intSymbol, "int" }, + { &uIntSymbol, "uInt" }, { &isNilSymbol, "isNil" }, { &lessEqualSymbol, "<=" }, { &lessThanSymbol, "<" }, { &longSymbol, "long" }, + { &uLongSymbol, "uLong" }, { &minusSymbol, "-" }, { &mustBeBooleanSymbol, "mustBeBoolean" }, { &newColonSymbol, "new:" }, diff -u --recursive smalltalk-1.96/libgst/sym.h so/libgst/sym.h --- smalltalk-1.96/libgst/sym.h Fri May 4 09:55:12 2001 +++ so/libgst/sym.h Wed Oct 17 20:07:52 2001 @@ -95,8 +95,8 @@ doesNotUnderstandColonSymbol, mustBeBooleanSymbol, terminateSymbol, asScaledDecimalSymbol, unknownSymbol, charSymbol, stringSymbol, - stringOutSymbol, symbolSymbol, intSymbol, - longSymbol, floatSymbol, doubleSymbol, + stringOutSymbol, symbolSymbol, intSymbol, uIntSymbol, + longSymbol, uLongSymbol, floatSymbol, doubleSymbol, booleanSymbol, voidSymbol, variadicSymbol, cObjectSymbol, cObjectPtrSymbol, smalltalkSymbol, byteArraySymbol, byteArrayOutSymbol, undeclaredSymbol,