Creating pool dictionaries
If you want to create a pool dictionary containing the constants defined in the source file, use the constants method of the AbtObjectTable class.
Creating pool dictionaries for C functions
For the C sample header (.H) file, enter the following code:
"Parse the C header file and initialize the OSObject subclass.
This assumes that the OSObject subclass SampleCATMStruct has
already been created. AbtRecordGenerator adds the specified
getter and setter selectors to the class."
"Also add the constants in the structure as a pool dictionary
so the constants can be used when calling the external
function."
| anObjectTable CATMConstants |
anObjectTable := AbtCLangParser parseFile: 'catm.h'.
AbtRecordGenerator new
generateAllFieldsFrom: (anObjectTable dataStructures
at: 'ATM_CUSTOMER' asSmalltalkGlobalIdentifier)
inClass: SampleCATMStruct.
CATMConstants := anObjectTable constants.
Smalltalk at: #SampleCATMConstants put: CATMConstants.
Creating pool dictionaries for COBOL functions
For the COBOL sample copybook, enter the following code:
"Parse the COBOL copy file and initialize the OSObject subclass.
This assumes that the OSObject subclass SampleCOBOLATMStruct has
already been created. AbtRecordGenerator adds the specified
getter and setter selectors to the class."
"Also add the constants in the structure as a pool dictionary
so the constants can be used when calling the external
function."
| anObjectTable COBOLATMConstants |
anObjectTable := AbtCOBOLLangParser parseFile: 'atm.cpy'.
AbtRecordGenerator new
generateAllFieldsFrom: (anObjectTable cobol01s
at: 'ATM-CUSTOMER' asSmalltalkGlobalIdentifier)
inClass: SampleCOBOLATMStruct.
COBOLATMConstants := anObjectTable constants.
Smalltalk at: #SampleCOBOLATMConstants put: COBOLATMConstants.
You can now use the constants in a method by modifying the method's class definition to include the pool dictionary you just created.
To view the constants in the pool dictionary you just created, type Smalltalk in the System Transcript window, select it, and select Inspect from its pop-up menu. Navigate the EsSmalltalkDictionary Inspector window to open a Dictionary Inspector on the pool dictionary you just created (SampleCATMConstants or SampleCOBOLATMConstants depending on the language you are using).
For more information on creating and loading pool dictionaries, refer to Programmer Reference.
Last modified date: 07/23/2020