3. GCI and FFI Changes

Previous chapter

Next chapter

Added GCI functions

The following functions have been added:

GciCheckNetldiName

(BoolType) GciCheckNetldiName(
    const char* aName
    );

Return FALSE if GEMSTONE_NRS_ALL environment variable is defined and contents of GEMSTONE_NRS_ALL disagrees with specified netldi name.

GciExecuteStr__

(OopType) GciExecuteStr__(
	const char source[], 
	OopType symbolList);

This is a variant of GciExecuteStr/GciExecuteStr_, which does not take the enviromentId argument and returns returns OOP_ILLEGAL in case of error.

GciFetchDateTime_

(BoolType) GciFetchDateTime_(
	OopType datetimeObj, 
	GciDateTimeSType *result);

this is a variant of GciFetchDateTime, but returns a BoolType instead of (void).

GciFetchGbjInfo

(BoolType) GciFetchGbjInfo(
    OopType theObject,
    int64 startIndex,
    int64 bufSize,
    GciGbjInfoSType *info,
    ByteType *buffer
    );

Similar to GciFetchObjInfo, but does not add theObject to export set. The value of *info is a GciGbjInfoSType

GciNewStringFromUtf16

(OopType) GciNewStringFromUtf16(
    ushort* words,
    int64 numWords,
    int unicodeKind
    );

The value of *words must be UTF16 encoded data. This method returns OOP_ILLEGAL if an error occurred. unicodeKind may be:

  • 0 create a String, DoubleByteString or QuadByteString
  • 1 create a Unicode7, Unicode16 or Unicode32
  • -1 create a string or unicode string per (Globals at:#StringConfiguration)

GCI_OOP_TO_CHAR_

(uint) GCI_OOP_TO_CHAR_(
	OopType anOop);

This is the same as GciOopToChar, but does not check that anOop’s class is Character. This is an optimization for when anOop’s class in known.

GciOopToFlt_

(BoolType) GciOopToFlt_(
	OopType theObject, 
	double* result);

This is a variant of the existing GciOopToFlt function, which returns a boolean and puts the result into the result argument double*.

GciPerform__

(OopType) GciPerform__(
	OopType receiver,
	const char selector[],
	const OopType args[],
	int numArgs);

This is a variant of GciPerform/GciPerform_, which does not require the environmentId argument, and returns OOP_ILLEGAL in case of error.

GciPerformFetchOops

(int) GciPerformFetchOops(
    OopType receiver,
    const char *selector,
    const OopType *args,
    int numArgs,
    OopType *result,
    int maxResultSize
    );

Do a perform of selector on receiver, with args and numArgs. The result of the perform is expected to be an oop format object. Return up to maxResultSize of the instVars of the result of the perform. The result of the perform is not added to the export set nor is it returned.

GciSetSessionId_

(BoolType) GciSetSessionId_(
   GciSessionIdType sessionId);

This is a variant of GciSetSessionId, which returns false if the argument is not valid.

Changed Functions

The following function has changes:

GciHostInstallFaultHandler

GciHostInstallFaultHandler no longer expects arguments.

Added Thread-safe GCI functions

GciTsDirtyExportedObjs

(BoolType) GciTsDirtyExportedObjs(
    GciSession sess,
    OopType theOops[],
    int *numOops,
    GciErrSType *err
    );

This function returns a list of objects which are in the ExportedDirtyObjs, i.e. objects in the PureExportSet and whose state has been changed by one of the following:

1. Smalltalk execution

2. Calls to GciStorePaths, GciSymDictAtObjPut, GciSymDictAtPut,GciStrKeyValueDictAtObjPut, GciStrKeyValueDictAtPut

3. Any GCI call from within a user action.

4. Committed by another transaction if a commit or abort was executed.

5. Aborted the modified state of a committed object.

GciTsDirtyObjsInit() must be called once after login before GciTsDirtyExportedObjs() can be used. Calls to Ghostwrites functions do NOT put the modified object into the set of dirty objects. The assumption is that the client does not want the dirty set to include modifications that the client has explicitly made. EXCEPTION: GciStore*, etc, calls from within a user action WILL put the modified object into the set of dirty objects. The numOops argument is used as both an input and an output parameter.

On input the value of numOops should be set to the maximum number of oops that can be returned in this call, i.e., the size (in oops) of the buffer specified by the first argument. On output the numOops argument is set to the number of oops returned in the buffer.

The function result indicates whether the operation of returning the dirty objects is done. If not done, i.e. FALSE, it is expected that the user will make repeated calls to this function until it returns a TRUE to indicate that all of the dirty objects have been returned. If repeated calls are not made, then the unreturned objects will persist in the list until the function is next called.

GciTsFetchGbjInfo

(int64) GciTsFetchGbjInfo(
    GciSession sess,
    OopType objId,
    BoolType addToExportSet,
    GciTsGbjInfo *result,
    ByteType *buffer,
    size_t bufSize,
    GciErrSType *err
    );

The function result is >= 0 for success, -2 if the object does not exist, and -1 if an error other than read authorization failure was returned in *err.

addToExportSet has an effect only if the function result is 1.

If buffer not NULL, then up to bufSize bytes of the body of the object are returned in *buffer, and function result is the number of instVars returned. If buffer == NULL then function result is 0 for success or -1 for error.

If read authorization is denied for objId, then result->access == 0, the rest of *result other than result->objId is zero, and function result is zero.

GciTsGbjInfo includes additional information about the class of the object, to allow faster handling of varying kinds of results. See extraBits field of GciTsGbjInfo.

GciTsKeepAliveCount

(int64) GciTsKeepAliveCount(
    GciSession sess,
    GciErrSType *err
    );

For use in testing the libgcits library. This functions returns number of keep alive bytes received by the session, or -1 if an error was returned in *err

GciTsKeyfilePermissions

(int64) GciTsKeyfilePermissions(
    GciSession sess,
    GciErrSType *err
    );

Returns -1 for error, or the uint32 value of keyfilePermissions from the stone process

GciTsNewStringFromUtf16

(OopType) GciTsNewStringFromUtf16(
    GciSession sess,
    ushort *words,
    int64 nWords,
    int unicodeKind,
    GciErrSType *err
    );

The *words argument must be UTF16 encoded data. This function returns OOP_ILLEGAL if an error occurred.

unicodeKind may be:

  • 0 create a String, DoubleByteString or QuadByteString
  • 1 create a Unicode7, Unicode16 or Unicode32
  • -1 create a string or unicode string per (Globals at:#StringConfiguration)

GciTsPerformFetchOops

(int) GciTsPerformFetchOops(
    GciSession sess,
    OopType receiver,
    const char* selectorStr,
    const OopType *args,
    int numArgs,
    OopType *result,
    int maxResultSize,
    GciErrSType *err
    );

Do a perform of selector on receiver, with args and numArgs. The result of the perform is expected to be an oop format object. Return up to maxResultSize of the instVars of the result of the perform. The result of the perform is not added to the export set nor is it returned.

Other GCI changes

GciRtlLoad, GciRtlLoadA, GciTsLoad ignored path arg

These methods includes a path argument which is intended to allow searching for shared libraries that are not in the standard locations. This argument was not actually used; only the standard locations were being searched. (#50958)

Linked GCI application now also looks for gem.conf

When searching for an executable configuration file, the default name that a linked GCI application is an application name set by GciInitAppName. If this has not been set, it will now also look for a file named gem.conf, as well as the documented default name gci.conf. The search order is appName.conf, gci.conf, gem.conf.

Int16Array, Int32Array, Int64Array at:put: did not have correct range checking

The methodat:put: was previously inherited for the classes Int16Array, Int32Array, Int64Array; the inherited range checking was incorrectly for unsigned rather than the signed range.

FFI Changes

Incorrect error from CByteArray >> encodeUTF8From:into:allowCodePointZero:

CByteArray>>encodeUTF8From:into:allowCodePointZero: returned an error indicating an incorrect source class in cases where the destination CByteArray is too small for the converted source string. (#50974)

 

Previous chapter

Next chapter