IBM
Contents Index Previous Next



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:

If you want to add decoding for these types, then do the following steps:

Example 470 User defined ASCII encoding

int MyAsciiEncoder( tBuffer Buf,
                  tSDLTypeInfo* TypeNode,
                  void* Value ) 
{
  /* my error handling code for one or more of
     CharStar, 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
Contents Index Previous Next