Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > SDL script for generating code > SDL script extensions for TDK > How customized reverse works (SDL script)
  
How customized reverse works (SDL script)
This topic applies to TDK SDL script extensions. For more information, see Overview of SDL script extensions for TDK (SDL script).
The following example explains how the reverse process takes place with ACS
SDL Script Extensions for TDK:
$in GenerateStart.sdl:
$ A variable where a generator model class...
%system %object OpTag
$ ... is istantiated. This class generates and reverses State Chart "actions". It definitely
$derives from a parent TBasicTag class. TBasicTag contains all the logic for implementing
$tagged generation code and reverse to model
OpTag = NewTActionTag ()
$We will have many tags in the system, so we add them to a special list in such a way
$we can easily reach them at reverse time
%system %list TagList
TagList = OpTag
$Another tag for State Chart guards
%system %object GuardTag
GuardTag = NewTGuardTag ()
TagList = TagList + GuardTag
$in Reverse.sdl:
$predefined variables set by the framewotk at time Reverse.sdl is invoked:
$%string sysFileName -> contains the full path/name of the file to be reversed
$%string sysActualFileContents -> contains the contents of the file saved by user to disk
$%string sysGeneratedFileContents -> contains the original contents of the file as
$ generated by ACS
%for TagList $ Iterate on the list
$ Will contain the offset in the file image (that is, in the sysActualFileContents string)
%localnumeric Index
Index = 0 $ So initially at the begin of the file
%localnumeric Once
Once = 0
$ Reverses the tags belonging to its category, returns true until no more tags
$ can be found. Sets the Index to the first file location not inspected yet
%while %current.Reverse (Index) != 0
Once = 1 $ Just remember something has been done
%endwhile
%if Once == 1 %then
%message "Reversing tag(s) in " & sysFileName
%endif
%endfor