![]() |
![]() |
![]() |
![]() |
![]() |
Appendix B: User defined ASCII encoding and decoding
The types CharStar, PId, UnionC, Userdef, VoidStar, VoidStarStar do not have a natural transformation to ASCII format. The desired encoding probably differs from application to application. The ASCII encoding procedure and the ASCII decoding procedures do not encode or decode these types, but they can invoke user written procedures for encoding and decoding them.
For threaded integrations, the PId value will be encoded/decoded by coding the memory address as an integer.
If you want to add encoding for these types, then do the following steps:
- Implement a C-function for encoding with input and output parameters compatible with tEncodeFunc, which is declared in file "coderucf.h". The encode functions in "coderascii.c" can be used as an example.
- Set static variable AsciiUserEncode to your encode function in xInitEnv.
If you want to add decoding for these types, then do the following steps:
- Implement a C-function for decoding with input and output parameters compatible with tDecodeFunc, which is declared in file "coderucf.h". The decode functions in "coderascii.c" can be used as an example.
- Set static variable AsciiUserDecode to your decode function in xInitEnv.
Example 470 User defined ASCII encoding
int MyAsciiEncoder( tBuffer Buf,tSDLTypeInfo* TypeNode,void* Value ){/* my error handling code for one or more ofCharStar, PId, UnionC, Userdef, VoidStar, VoidStarStar *//* return 1 if it was succesful,return 0 if it failed */}In xInitEnv:AsciiUserEncode = MyAsciiEncoder;
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |