Web Site: https://www.victella.me/ETAC/
Alternative: etac.victella.me

e-mail: etac@victella.me

Victella

The Official Website of the
ETAC Programming Language

Site Last Updated:  1 February 2019

ETAC Products

This web page contains descriptions of substantial computer software that involves the ETAC programming language.

ETAC Code Generator

The ETAC Code Generator, written in the ETAC programming language, is a highly advanced programmable template-based universal text and program source code generator that uses a template language with capabilities extended by scripts written in the ETAC programming language.  The user specifies a template file and input arguments, either on the command line or in the input dialog box, to generate and maintain any computer program source code and other text files.

A template file is written in a unique sophisticated declarative template language (“ECGL”), containing special descriptive codes in the form of keywords and their arguments intermixed with special symbols and the text to be generated.  During the processing of a template file, the special symbols are replaced by the corresponding possibly modified input arguments.

ECGL incorporates the ability to use the procedural language ETAC for producing specialised output where required.  ECGL can also read and maintain existing or generated text and template files as part of its processing, making it suitable for updating code fragments of computer program source files.  The ETAC Code Generator updates existing text in a text file by matching pairs of text lines within the existing text and replacing or adding to the text between the matching lines.  The text lines that are matched are defined by the designer of the particular template file in use.

The ETAC scripts in a template file can utilise the full power of the ETAC programming language, and can communicate with the ETAC Code Generator via ETAC functions to access and modify various properties of the components of a template file, such as the values of special symbols.  The ETAC scripts utilise ETAC’s interactive debugger for visually tracing the activation of script tokens when running in debug mode.

The following ten template files are included with the ETAC Code Generator.

  • CPPModsRec.ecgt            General CPP Modifications Record
  • CPPSourceFiles.ecgt   General CPP Class Source Files
  • DataFileReg.ecgt          Data File Registration Entry File
  • ECGTSourceFile.ecgt   ETAC Code Generator Template Source File
  • ETACForApp.ecgt            ETAC Interpreter Access for an Application Program
  • ETACMainApp.ecgt          Main ETAC Application Program Source File
  • ETACModsRec.ecgt          General ETAC Modifications Record
  • ExternTACLib.ecgt        External TAC Library Source File
  • MakeEXE.ecgt                   EXE File Creator
  • MakeExtractor.ecgt      ZIP File Self-extractor

General Features

The ETAC Code Generator has at least the following capabilities.

  • From a single template line in the template file, a number of variant text lines can be generated based on a sequence of user-specified arguments.
  • Special symbols in template lines can be automatically replaced by user-specified arguments.
  • Template lines can be conditionally processed.
  • While a template file is being processed, the included instructions and commands can be modified and reprocessed (the internal copy of the template file is self-modifying).
  • Text lines can be automatically inserted into the template lines from any text file during processing.
  • Generated lines can be incorporated into a template file from the processed output of other template files.
  • Generated lines can be merged and aligned with parts of other generated lines or external text files.
  • Text lines can be edited via ETAC script after they have been generated.
  • ETAC scripts can be defined to edit blocks of text lines in a template file in any desired way while being generated.
  • ETAC scripts can provide user interaction during processing of the template files.

System Requirements

Because the ETAC Code Generator is written in the ETAC programming language, the system requirements are the same as for the Run ETAC Scripts system.  The system requirements are as follows.

The ETAC Code Generator is only released for the Windows® operating system using the x86 (32-bit) architecture (it can also run on the x64 (64-bit) architecture) beginning with Windows® XP.  Note that the ETAC Code Generator is not released for other platforms and non-Windows® operating systems.  It is expected to operate correctly on any Windows® operating system compatible with the one mentioned.  The ETAC Code Generator was formally tested on the Windows® XP (x86) and Windows® 7 (x64) operating systems only.

Template files and generated files, as well as other files used by the ETAC Code Generator, cannot contain Unicode characters.  A future version of the ETAC programming language is expected to process Unicode files, which will allow the said files to contain Unicode characters.

Release Type

The ETAC Code Generator is propriety software released under licence.  It is free of charge but its use is subject to licence restrictions.  The ETAC Code Generator is written entirely in the ETAC programming language.  The source code for the ETAC Code Generator is released to the public via the ETAC_Installers_2-ena.zip package.  An executable stand-alone implementation of the ETAC Code Generator is released via the ETACCodeGenEXE_Installer_1-ena.zip package.

Template Example

The following example illustrates the content of a template file.  Note that the example is for illustration purposes only; it is not a functional example (the actual functional example is included in the ETAC Code Generator package in the file ExternTACLib.ecgt).  The text before @endhead@ is information read by the ETAC Code Generator for generating the text files (this example generates and maintains two text files) and processing the input arguments.  The coloured text segments after @endhead@ outside the ETAC script block represent special codes, called “meta-codes”, that are understood by the ETAC Code Generator.  Meta-codes, always within angle brackets, constitute the unique sophisticated ETAC Code Generator template language (“ECGL”).  The black text after @endhead@ is produced in the generated text as given (except for the ending backslashes).  Notice the ETAC script block near the bottom of the template file.  ETAC script blocks in template files are rarely required when generating files that are not to be updated by the ETAC Code Generator.

@ECG V1@
@External TAC Library Source File@
@D=Template for creating and updating a C++ source file for compiling into an external TAC library (ETL).
@O=Desktop::?
@T={//GENFILE=(#gen-file)} {//FNTLST=(#fnt-name,#com-name,?)} {/ENTRY:(#[ENTRY-syntax],?)}
   ENTRY:[{//CLASS=(#cls-name)}{//COMOPS=(#comop,?)}]
@P=GEN_FILE 1 1; FNT_NAME 2 1; COM_NAME 2 2; ENTRYKW 3 0; ENTRY 3 1;
   CLS_NAME 1 1; COMOP 2 1;
@endhead@
***********************************************************
*  The generated code implements a C++ DLL skeleton source file for compiling into an ETAC External TAC Library (ETL).
*  It also implements a definition file (.def) for other programs to link into the ETL.
*
*  Date Generated (DMY): <&DATE:[([dd]/[MM]/[yyyy] [hh]:[mm]:[ss] [TT])]>
*
*  Generated Files:
<&FNT:[=({gGenFile;})]>
<&FNT:[=({gDefFile;})]>
*
*  ECGT Command Line Arguments:
<@EDIT:[SCRIPT=(TA :-; TA.tlIndentLines(2 " "); TA.tlIndentLines(1 "*"); TA;)]>
<&HPAR:[ARGS]>
<@END:[EDIT]>
*
***********************************************************
<&C:[( Process the CPP file. )]>
<@IF:[COND=("<ENTRYKW>" != "")]>
<@DO:[WITH:[IDXNAME=EIdx SNAME=ENTRY]]>
<@IF:[COND=({not ClassExists(gGenFile "
<ENTRY:EIdx/CLS_NAME>");})]>
<@OUTPUT:[PATH="<GEN_FILE>" MARK=A(.//=ECG:CLSCDE=//) ALIGNA OFFSET=-1 BACKUP]>
else
if ( strcmp(pClasses[Idx], "<ENTRY:EIdx/CLS_NAME>") == 0 )
{
   /* Comop class: <ENTRY:EIdx/CLS_NAME> */
<@DO:[WITH:[IDXNAME=CIdx SNAME=ENTRY:EIdx/COMOP]]>
   OutNameLst[LstIdx] = CNameLst[<&FNT:[=(ComopToOrd("<ENTRY:EIdx/COMOP:CIdx>") - gFirstOrd)]>]; // <ENTRY:EIdx/COMOP:CIdx>
   OutOrdLst[LstIdx] = COrdLst[<&FNT:[=(ComopToOrd("<ENTRY:EIdx/COMOP:CIdx>") - gFirstOrd)]>];
   LstIdx++;
<@END:[DO]>
  
//=ECG:CLS:<ENTRY:EIdx/CLS_NAME>=//
}
<@END:[OUTPUT]>
<@ELSE:[]>
<@OUTPUT:[PATH="<GEN_FILE>" MARK=A(.//=ECG:CLS:<ENTRY:EIdx/CLS_NAME>=//) ALIGNA OFFSET=-1 BACKUP]>
<@DO:[WITH:[IDXNAME=CIdx SNAME=ENTRY:EIdx/COMOP]]>
OutNameLst[LstIdx] = CNameLst[<&FNT:[=(ComopToOrd("<ENTRY:EIdx/COMOP:CIdx>") - gFirstOrd)]>]; // <ENTRY:EIdx/COMOP:CIdx>
OutOrdLst[LstIdx] = COrdLst[<&FNT:[=(ComopToOrd("<ENTRY:EIdx/COMOP:CIdx>") - gFirstOrd)]>];
LstIdx++;
<@END:[DO]>
<@END:[OUTPUT]>
<@END:[IF]>
<@END:[DO]>
<@OUTPUT:[PATH="<GEN_FILE>" MARK=A(.//=ECG:ELSEDEL=//) OFFSET=-1 DELETE=2]>
<@END:[OUTPUT]>
<@END:[IF]>
<@OUTPUT:[PATH="<GEN_FILE>" MARK=A(.//=ECG:FNTDEF=//) ALIGNA OFFSET=-1 BACKUP]>
\
// Comop: <COM_NAME:#2>\
cc_rtn_code ccTACAPI <FNT_NAME:#2>(ccTAC *pTAC)\
{\
ccRTNCODE; /* Declare the return code variable. */\
ccNEW_STRING (MyString);\
\
   // «Replace the following lines with your code.» //\
   MyString->strAssign("'<FNT_NAME:#2>()' not yet implemented.");\
   ccPUSH((0L));\
   ccPUSH(("New Function"));\
   ccPUSH((MyString));\
   ccCALLTAC(ccExecCmd("msg_box"));\
   pTAC->ccPop();\
\
ccEXITLBL:\
   /* Release resource interfaces. */\
   // «Replace the following line with your code.» //\
   ccFREE(MyString);\
\
   return (ccRTNCDE_VAR);\
}
<@END:[OUTPUT]>
<@OUTPUT:[PATH="
<GEN_FILE>" MARK=S(<&FNT:[=({gGenTimePat;})]>) OFFSET=-1 DELETE=1 BACKUP]>
<@EVAL:[]>
<@INSERT:[PATH="
<&FNT:[=({gGenFile;})]>" START=S(<&FNT:[=({gGenTimePat;})]>) OFFSET=-1 ENDOFF=2 DEFER]>
<@END:[EVAL]>
<@END:[OUTPUT]>

<&C:[( Process the DEF file. )]>
<@OUTPUT:[PATH="<&FNT:[=({gDefFile;})]>" MARK=A(;.=ECG:EXPENT=) ALIGN OFFSET=-1 BACKUP]>
<FNT_NAME:#2> @<&FNT:[=({ComopToOrd("<COM_NAME:#2>");})]>
<@END:[OUTPUT]>
<@OUTPUT:[PATH="
<&FNT:[=({gDefFile;})]>" MARK=S(<&FNT:[=({gGenTimePat;})]>) OFFSET=-1 DELETE=1 BACKUP]>
<@INSERT:[PATH="<&FNT:[=({gDefFile;})]>" START=S(<&FNT:[=({gGenTimePat;})]>) OFFSET=-1 ENDOFF=2 DEFER]>
<@END:[OUTPUT]>

<@SCRIPT:[]>
::define #ETA_MRK_CLASS_LAB ".//=ECG:CLS:%1%=//"

cg.
{
gGenTimePat :- ".$$? first generated by the ETAC Code Generator on";
gFirstOrd :- 2;
gComopLst :- ?;
gOrdLst :- ?;
gGenFile :- (@cgGetHeaderPar("GEND") + "\ <GEN_FILE>");
gDefFileName :- append_file_ext path_base_name "<GEN_FILE>" "def";
gDefFile :- (+ @cgGetHeaderPar("GEND") "\ " gDefFileName);

   [* Gets the ordinal number of the specified comop name. *]
   ComopToOrd :- fnt:(pComop[*str*]) [* => int *]
   {
   RtnOrd :- ?;

      RtnOrd := gOrdLst%[get_pos pComop gComopLst];
      RtnOrd; [*RETURN*]
   };

   [* Determines whether the class label exists in the specified file. *]
   ClassExists :- fnt:(pFilePath[*str*] pClass[*str*]) [* => bool *]
   {
   RtnVal :- false;
   FileData :- ?;

      FileData := @cgGetFileData(pFilePath);
      if ( FileData != ? ) then
         {RtnVal := ( FileData.tlFindMark(1 "A" @cgFormatStr(:#ETA_MRK_CLASS_LAB: [pClass]) ? 1 0) != -1 );}
      endif;

      RtnVal; [*RETURN*]
   };
};

[* Returns a string sequence of comop names supplied by the user. *]
GetComopLst :- fnt:() [* => str-seq *]
{
   ...
};

[* Returns an integer sequence of ordinal numbers corresponding to the user-supplied comop list. *]
GetOrdLst :- fnt:() [* => int-seq *]
{
   ...
};

   [* BEGIN *]
   gComopLst := GetComopLst();  gOrdLst := GetOrdLst();
<@END:[SCRIPT]>


A template file requires input arguments supplied by the user.  The following text is an example of input arguments used with the template above.

GENFILE=TestETL.cpp FNTLST=ShowWindow, ShowWin, FindChar, FindChar, ReplaceStr, RepStr
ENTRY:[CLASS=Strings COMOPS=FindChar, RepStr] [*This is optional*]
ENTRY:[CLASS=Window COMOPS=ShowWin] [*This is optional*]


Screenshot

The Gallery page contains a screenshot of the ETAC Code Generator.

Downloading the ETAC Code Generator

The ETAC Code Generator is released in two implementations.  Officially, the ETAC Code Generator is released as a compiled TAC binary instruction file named ETACCodeGen.btac along with the ETAC source files which are all contained in the ETAC_Installers_2-ena.zip package.  The Run ETAC Scripts package must therefore already be installed to use the ETAC Code Generator in this implementation.  The ETAC Code Generator is also released as a self-contained executable program named ETACCodeGen.exe, which does not require the Run ETAC Scripts package.  The self-contained executable is actually a silent installer that temporarily installs and runs a portable version of the ETAC Code Generator and Run ETAC Scripts.  Neither implementation of the ETAC Code Generator alters the system registry.

If the computer onto which the ETAC Code Generator is to be installed already has, or will have, the Run ETAC Scripts package installed, or the ETAC source code for the ETAC Code Generator is required, then the ETAC Code Generator is contained as a utility program (including the ETAC source code) within the Run ETAC Scripts package, and ETAC_Installers_2-ena.zip needs to be downloaded and installed.

If the computer onto which the ETAC Code Generator is to be installed does not or will not have the Run ETAC Scripts package installed, then the executable implementation of the ETAC Code Generator contained in ETACCodeGenEXE_Installer_1-ena.zip needs to be downloaded and installed.  The executable implementation of the ETAC Code Generator does not contain the ETAC source code.

See the Downloads page to download the ETAC Code Generator.  See the Documentation page to download or view the ETAC Code Generator documents and licences.