New Template Expansion Method Templates for C, CMAC and Pascal are kept in global variables. The name of the global variable is '!<LANG_TYPE>.TMPLT0' where <LANG_TYPE> is up to the first three characters of the language type. The global string will contain all of the templates for the corresponding language type. The global variable will be initialized in the macro called '<LANG_TYPE>^<LANG_TYPE>SETX' which is called every time a file is loaded. The global variable will contain the text for the expansion and any formating characters as follows: '�C=' = Expansion case type. 0 = case sensitive. Keyword - case sensitive Expansion - verbatim. 1 = case insensitive. Keyword - case insensitive Expansion - All caps. 2 = case insensitive. Keyword - case insensitive Expansion - First letter caps. 3 = case insensitive. Keyword - case insensitive Expansion - dependent on keyword. '�M=' = Minimum number of characters in keyword required for an expansion to occurr. 238 - '�' = Parameter delimiter 127 - '' = Field separator 20 - '' = Carriage return (Run CR macro) 174 - '�' = Carriage return (Goto starting column) 196 - '�' = Record cursor position 17 - '' = Move cursor left 16 - '' = Move cursor right 24 - '' = Move cursor up 25 - '' = Move cursor down 64 - '@' = Translate next character literally 168 - '�' = Remember current column position 173 - '�' = Goto remembered column number 240 - '�' = Goto starting column 241 - '�' = Toggle Insert mode 251 - '�' = Run macro: "/*�C^CCOMMENT" 252 - '�' = Expand template for preceding character (be careful about infinite loops) 237 - '�' = Do nothing (used to stop 'keyword' interpretation) 242-'�' = Indent and set indent level 243-'�' = Undent and set indent level The following is an example global variable template setup for the C language found in the extension setup macro for the C language ('C^CSETX'): Set_Global_Str("!C.Tmplt0", "�C=0�M=3"+ "/*�C^BuildCMT"+ /* �C=0 case sensitive */ "//"+ /* �M=1 minimum expansion of 1 character */ "#define "+ "#else"+ "#elif "+ "#eilf "+ "#endif"+ "#error "+ "#include <�>"+ '#i"nclude �"'+ '#i<nclude �>'+ "#if "+ "#ifdef "+ "#idfef "+ "#ifndef "+ "#pragma "+ "#undef "+ "break;"+ "case �:"+ "continue;"+ "do �� while ( � );"+ "default:"+ "else"+ "eilse f ( � ) ��"+ "extern �;"+ "for ( � ) ��"+ "if ( � ) ��"+ "goto �;"+ "return �;"+ "switch ( � ) ����case :"+ "struct � ��;"+ "typedef �;"+ "union � ��;"+ "while ( � ) ��"+ "{��}�" + // FOR if ( ) { // } "��{�}" // FOR if ( ) // { // } //"���{�}" ); The old method of template expansion will still be supported. The following list is the minimum number of characters required to expand templates in the C, CMAC and PASCAL language types: C Language CMAC Language ��������������������������������ķ ��������������������������������ķ �Template Minimun expansion�� �Template Minimun expansion�� ��������������������������������� ��������������������������������� �/* / �� �/*/ �� �#define #d �� �#define#d �� �#else #e �� �#include#i �� �#elif #ei �� �breakb �� � #eli �� �casec �� �#endif #en �� �continueco �� �#error #er �� �defaultde �� �#include #i �� �dod �� � #i< �� �elsee �� � #i" �� �else ifei �� �#ifdef #id �� �forf �� � #ifd �� �gotog �� �#ifndef #ifn �� �ifi �� �#pragma #p �� �macrom �� �#undef #u �� �parse_intpi �� �break b �� �parse_strps �� �case c �� �switchs �� �continue co �� �whilew �� �do d �� ��������������������������������ͼ� �default de �� ��������������������������������� �else e �� PASCAL Language �else if ei �� ��������������������������������ķ � else i �� �Template Minimun expansion�� �extern ex �� ��������������������������������� �for f �� �begin b �� �if i �� �case c �� �goto g �� �for f �� �return r �� �function fu �� �switch s �� �if i �� �struct st �� �procedure p �� �typedef t �� �program prog �� �union u �� � pg �� �while w �� �repeat r �� �{} { �� �while w �� ��������������������������������ͼ� ��������������������������������ͼ� ��������������������������������� ���������������������������������
1/--страниц