DSM Template Services Manual
Display-Text Procedures
DSM Template Services Manual—427187-004
2-24
Procedures That Convert Variable-Length Tokens
3. Write the custom-formatting procedure itself, such as Example 2-3.
4. Place this procedure in the system-procedure library.
The SPI_BUFFER_FORMATNEXT_ procedure calls the abc_cvt_version
procedure each time it represents a token of type abc-ddl-version.
Procedures That Convert Variable-Length Tokens
This subsection discusses issues concerning custom-formatting procedures that
convert variable-length token values, not custom-formatting procedures in general.
Passing the Length
For most custom procedures, the internal-value parameter points to the first word
of the value to be converted. The exceptions are the procedures that convert token
types based on a variable-length (but nonextensible) structured token. For these
procedures, internal-value points to a length word for the variable-length value,
followed by the value.
Example 2-3. Example of a Custom-Formatting Procedure
! A custom-formatting procedure for tokens of type
! abc-ddl-def.
INT PROC abc_cvt_version(ival, num, str, context,
text:maxlen, len, st1, st2,
extra1, extra2, extra3)
EXTENSIBLE;
STRING .EXT ival;
INT num, str;
INT .EXT context;
STRING .EXT text;
INT maxlen;
INT .EXT len;
INT .EXT st1;
INT .EXT st2;
INT(32) extra1, extra2, extra3;
BEGIN ! PROC abc_cvt_version
INT .EXT intval = ival;
! Check for capital letter followed by binary integer
IF "A" <= intval.<0:7> AND intval.<0:7> <= "Z"
AND intval.<8:15> < 100 THEN
BEGIN
text := intval.<0:7>;
call DNUMOUT(text[1], $DBL(intval.<8:15>), 10, 2);
len := 3;
RETURN 0; ! Successful conversion
END
ELSE
BEGIN
RETURN -2; ! Input value is not a valid version
END;
END; ! PROC abc_cvt_version