Download



CodeWorker is distributed under the terms of the GNU Lesser General Public License.
The Linux version compiles under gcc 3.2 20020927.
CodeWorker runs under Cygwin correctly since version 2.09.

Under Linux, please read the Makefile before compiling.

Under Windows platform, you might have to download msvcp60.dll in "‰SystemRoot‰/System32", if you don't have it.

Please do not hesitate to contact us for any trouble (source recompiling, binaries, constructive criticisms, suggestions, ...).

 To subscribe to new releases.

CodeWorker 3.2, 24nov2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries -4 CodeWorker_WIN3_2.zip
Any platform (?) sources -4 CodeWorker_SRC3_2.zip
Changes
Date Type Caller Description
22nov2003 feature - The BNF directive #trace traces the resolution steps of an extended–BNF script.

Hit a key to interrupt the display of trace information and to pause the controlling sequence.

22nov2003 function -
  • function inputKey(echo : bool) : string
    ParameterTypeDescription
    echoboolasks for echoing the standard input on the console

    Returns a character extracted from the standard input, the keyboard generally. If no key was pressed, it returns an empty string.

    See statement modifiers file_as_standard_input (file as standard input) and string_as_standard_input (string as standard input) to change the source of the standard input.

    If the source of the standard input is the keyboard, the argument echo has no effects. Otherwise, the input text is displayed into the console only if echo is worth true.

20nov2003 bug_fix Gwenael CHAZAL CodeWorker crashed when an expression was passed to a node parameter of any non–terminal BNF symbol, instead of passing a tree node. Now, it raises an error.
20nov2003 feature Maxime BOURGET A BNF symbol resolved with success, has accepted the assignment of its scanned portion of sentence to a variable for a long time: B:v means that the text covered by B is assigned to v.

Now, you can specify to concatenate the covered text to the ancient value of the variable: B:+v.

Example:
If v is worth "nebula:" and if the sentence starts with "Orion.", then v becomes "nebula:Orion" after the resolution of #readIdentifier:+v.

20nov2003 improvement - The template functions accept a template–based script to define their body. The specialization of a function for a given template instantiation key is resolved at runtime.

Example:

function f(x : node) {/*is a synonym of f<"">(x : node)*/}

function f<T>(x : node) {{
      // ‘{{‘ announces a template–based script, which
      // will generate the correct implementation during the instantiation
      insert x.@T@ = "@T@";
      f<"@T.rsubString(1)@">(x);
@
      // ‘}}‘ announces the end of the template–based script
}}

f<"field">(project);
traceObject(project);

Output:

Tracing variable ‘project‘:
      field = "field"
      fiel = "fiel"
      fie = "fie"
      fi = "fi"
      f = "f"
End of variable‘s trace ‘project‘.

19nov2003 improvement - The engine has improved the compilation‘s speed of scripts.
17nov2003 feature Maxime BOURGET A new BNF binary operator ‘|>‘ was added.

The sequence A |> B is understood as considering the sub sentence scanned by A, which delimits the portion of text left visible to B. B starts scanning at the beginning of the sub sentence covered by A and cannot go beyond.

When the operator has achieved with success, the cursor points to the end of the sub sentence covered by A.

You‘ll find below the different steps processed by the operator:

  • the BNF literal A is executed,
  • if success, the cursor comes back to the beginning of the sub sentence covered by A
  • then, B is executed, knowing that the operator forces the end of the sub sentence where A had finished,
  • if success, the cursor points to the end of A, even if B hadn‘t scan up to the end of the sentence.

Example:

We want to recognize all colons present on a line. The sub sentence we would like to scan is a line: –>‘\n‘. Recognizing colons is like: [–>‘:‘]*, which asks for jumping from a colon to another, without considering the end of line.
–>‘\n‘ |> [–>‘:‘]* restricts the colon recognition to the line.

17nov2003 improvement Maxime BOURGET The BNF operator ‘–>‘ admits a syntax extension, for the adjustment of its internal mechanism.

–>A jumps just after the the first matching of A in the sentence. It processes the equivalent piece of extended–BNF script:

=> local iLocation;
~[A => iLocation = getInputLocation();]*
=> setInputLocation(iLocation);

To intervene on the boundaries of the repeated sequence [A ...]*, an extension was added to the syntax: –>boundaries A, where boundaries gives the multiplicity of the bracketed sequence (‘?‘, ‘+‘, ‘2..*‘, #repeat(iBegin, iEnd) ...).
Note: the boundaries must be declared just after the arrow.

The text covered by –>A includes the unmatched characters plus the sub sentence scanned by A, so –>A:v assigns the complete covered text to the variable v. This is sometimes a drawback: perhaps do you want to take the unmatched character or the sub sentence scanned by A.
So now, you can specify the variables intended to receive these intermediate values:
–>(:varBefore –:varAfter)A:varTotal
Note: the intermediate variables are declared just before the BNF symbol A, after the boundaries if any.

Example:
We will apply [–>(:varBefore –:varAfter) #readNumeric]:varTotal on the sentence "Garfield.laziness 99.99 percent":

  • varBefore = "Garfield.laziness "
  • varAfter = "99.99"
  • varTotal = "Garfield.laziness 99.99"

The last extension brought to the jump operator –>A is to allow the execution of a BNF sequence at the beginning of the sub sequence matched by A. This BNF sequence is declared into the parenthesis used for the intermediate variables, behind these variables, if any:
–>(:varBefore –:varAfter B)A
The advantage of infiltrating the BNF sequence B is that the intermediate variables are populated, and that the cursor doesn‘t point after the matching of A yet, but at the beginning of the sub sentence matched by A.

15nov2003 function Maxime BOURGET
  • function getVariableAttributes(variable : treereflist : tree) : int
    ParameterTypeDescription
    variabletreerefthe variable to explore
    listtreewill contain the name and type (reference to another node or not) of each attribute

    Populates a list with all attribute names of a tree node. The name of branches just below the node variable are put into list.

    The attribute‘s name is a key in the list and there is no value assigned to the item, except for attributes that point to another node (a reference). In that case, the item is worth the complete name of the referenced node.

    The function returns the number of attributes found, or a negative value (–1) if the tree node variable doesn‘t exist.

    Note: use #evaluateVariable() to navigate along a tree node, where the complete name is determined at runtime.

CodeWorker 3.1, 12nov2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2303028 CodeWorker_WIN3_1.zip
Any platform (?) sources 1370834 CodeWorker_SRC3_1.zip
Changes
Date Type Caller Description
11nov2003 feature Maxime BOURGET More than one customized ignore–clause is accepted now. Before, the customized ignore clause was written: #ignore ::= /*production rule*/;.

Now, customized ignore clauses are declared with a key between brackets :
#ignore["designate this ignore clause"] ::= /*production rule*/;.

Into production rules, you specify the change with #ignore(textit{"designate this ignore clause")}.

11nov2003 feature Maxime BOURGET A new BNF directive is added: #break. It leaves successfully the closer repeat token into which the directive was put.

Example:

["–––" #break | attribute]+

Here, the engine reads at least one attribute, and leaves with success when it encounters the string "–––".

09nov2003 bug_fix - Now, the procedure executeString() sees the scope of functions declared in the script that calls the procedure.
09nov2003 improvement - The procedure expand() allows the pattern script passed as a block of instructions, instead of a script file name (behaviour already existing for generate()).
08nov2003 improvement - A function name cannot be a reserved keyword anymore (should have been done a long time ago).
04nov2003 function Maxime BOURGET
  • function joinStrings(list : treeseparator : string) : string
    ParameterTypeDescription
    listtreethe list that contains the strings to join
    separatorstringthe sequence of chars that separates the strings

    This function returns the concatenation of all strings put into list, putting a separator between each of them.

    If the list is empty, the function will return an empty string.

31oct2003 improvement - The foreach statement allows the reverse iteration of unsorted items too.
30oct2003 function -
  • function equalsIgnoreCase(left : stringright : string) : bool
    ParameterTypeDescription
    leftstringfirst string to compare
    rightstringsecond string to compare

    Compares two strings, ignoring the case. It returns true when the comparison succeeds.

20oct2003 improvement - The building of plug–in packages (dynamic libraries written in C++) accepts some new features:
  • more functions to handle parse trees,
  • call of CodeWorker‘s functions from the plug–in
CodeWorker 3.0, 10oct2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2277244 CodeWorker_WIN3_0.zip
Any platform (?) sources 1363933 CodeWorker_SRC3_0.zip
Changes
Date Type Caller Description
05oct2003 feature - A new fundamental feature: extension of the language via packages implemented in executable modules (dynamic libraries), like in Tcl or other scripting languages.

You can integrate your own functions or interface layers to work with databases or any other gluing requirements.

01oct2003 function -
  • procedure appendFile(filename : stringcontent : string)
    ParameterTypeDescription
    filenamestringname of the file to append
    contentstringsequence of characters to write at the end of the file

    Writes the text content at the end of the file filename.

    If the file doesn‘t exist, the function creates it.

  • function composeSQLLikeString(text : string) : string
    ParameterTypeDescription
    textstringa sequence of character to convert to a SQL-like string

    Returns the conversion of the sequence of characters given by argument text to a SQL–like string, without single quote delimiters. It means that special characters of text are replaced by their escape sequence, the rest remaining the same.

    It recognizes the following escape sequences:

    • ‘\\‘ as backslash (\), ASCII value 92,
    • ‘\‘ ‘ as single quotation mark (‘), ASCII value 39,
    • ‘\"‘ as double quotation mark ("), ASCII value 34,
    • ‘\a‘ as alert (BEL), ASCII value 7,
    • ‘\b‘ as backspace (BS), ASCII value 8,
    • ‘\f‘ as formfeed (FF), ASCII value 12,
    • ‘\n‘ as newline (LF), ASCII value 10,
    • ‘\r‘ as carriage return (CR), ASCII value 13,
    • ‘\t‘ as horizontal tab (HT), ASCII value 9,
    • ‘\v‘ as vertical tab (VT), ASCII value 11,
    The function translates the single quote to an escape sequence "\‘", instead of repeating twice the single quote as in the SQL–standard. It presents the advantage of being more readable, but if you encounters a drawback in using this translation, apply replaceString() to change "\‘" in "‘‘".
30sep2003 improvement - Improvement that concerns formatDate()/completeDate(): ‘%Q‘ is a new date/time format specifier that represents a SQL timestamp (equivalent to ‘%Y–%m–%d %H:%M:%S.%L‘).
CodeWorker 2.19.2, 30sep2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2226078 CodeWorker_WIN2_19_2.zip
Any platform (?) sources 1340624 CodeWorker_SRC2_19_2.zip
Changes
Date Type Caller Description
28sep2003 function -
  • function getOutputFilename() : string
    Returns the path of the output file being generated.
25sep2003 bug_fix - Very important: some troubles may have appeared on the use of first() and last() index functions in a recursive call to a foreach loop.
CodeWorker 2.19.1, 19sep2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2224846 CodeWorker_WIN2_19_1.zip
Any platform (?) sources 1334448 CodeWorker_SRC2_19_1.zip
Changes
Date Type Caller Description
18sep2003 function -
  • function ceil(number : double) : int
    ParameterTypeDescription
    numberdoublethe floating-point number to ceil

    Returns the smallest integer that is greater than or equal to number. If number isn‘t a number, the function returns 0.

  • function exp(x : double) : double
    ParameterTypeDescription
    xdoublethe floating-point whose exponential is to compute

    Returns the exponential of x.

    On underflow, it returns 0.
    On overflow, it returns infinite.

  • function log(x : double) : double
    ParameterTypeDescription
    xdoublethe floating-point whose logarithm is to compute

    Returns the logarithm of x.

    If x is negative, it throws an error.
    If x is 0, it returns infinite.

18sep2003 bug_fix - Functions put into an arithmetic expression (between ‘$‘ symbols) didn‘t accept to pass string expressions to parameters.
14sep2003 bug_fix - An embedded script now ignores insignificant characters following the trailing bracket:
generate({...the embedded script...} /* insignificant characters */, project, "bubblegum.txt");
13sep2003 bug_fix - Now, the engine doesn‘t allow the user to choose a non–terminal amongst reserved keywords function, declare or external.
CodeWorker 2.19, 12sep2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2218753 CodeWorker_WIN2_19.zip
Any platform (?) sources 1304090 CodeWorker_SRC2_19.zip
Changes
Date Type Caller Description
10sep2003 feature - Now, procedures running a script (for parsing / generating / translating / interpreting) accept the script to be embedded between { and }, instead of to give the path of the script necessary.

It avoids the writing of a specific script file each time the developer requires a task of parsing or code generation.

Example:

//generation of an HTML file, which shows the title and the content
//of some financial market news previously extracted

generate(
{
<html>
   <body>
@
foreach i in this.news {
     @@composeHTMLLikeString(i.title)@<br>@endl()@@
     @<table><tr><td>@endl()@@
       @@composeHTMLLikeString(i.body) + endl()@@
     @</td></tr></table>@endl()@@
}
@   </body>
</html>
@}, project, "news.html");

  • It avoids the writing of 2 files, as it was unavoidable before:

    generate("news2HTML.gen", project, "news.html");

  • such as "news2HTML.gen", which contains:

    <html>
       <body>
    @
    foreach i in this.news {
         @@composeHTMLLikeString(i.title)@<br>@endl()@@
         @<table><tr><td>@endl()@@
           @@composeHTMLLikeString(i.body) + endl()@@
         @</td></tr></table>@endl()@@
    }
    @   </body>
    </html>

10sep2003 feature - Add of a new boolean operator that checks whether the result of an expression belongs to a set or not:
sHTMLTag in { ‘i‘, "kbd" }
returns true if sHTMLTag is worth ‘i‘ or "kbd" and false in all other cases.
09sep2003 bug_fix Gilles GHATTAS Now, the engine checks whether a function is allowed for a type of script.

Example: getInputFilename() isn‘t allowed in a common script, because it should be present in parse scripts only (it gives the name of the file being currently parsed). Now, if you try to use this function in a common script, a syntax error occurs.

08sep2003 function -
  • function resolveFilePath(filename : string) : string
    ParameterTypeDescription
    filenamestringthe path of the file to resolve

    Searches the file filename in the current directory and, if fails, it continues searching it in the include directories (‘–I‘ switch on the command line).

    It returns the location of the file in directories, removing any ambiguity.
    If the file doesn‘t exist, the function returns an empty string.
    If filename points to a virtual file, the function returns filename.

CodeWorker 2.18, 08sep2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2194114 CodeWorker_WIN2_18.zip
Any platform (?) sources 1318051 CodeWorker_SRC2_18.zip
Changes
Date Type Caller Description
04sep2003 improvement - Add of the unary negation operator in arithmetic expressions.
04sep2003 improvement Eric NICOLAS An arithmetic expression between ‘$‘ or an expression between parenthesis wasn‘t admitted by the parser as an expression to flush in the output file of a template–based script (expression embedded between ‘@‘).
03sep2003 bug_fix Gwenael CHAZAL Removal of superfluous ‘0‘ that may have appeared in some cases on floating–point numbers.
02sep2003 bug_fix Eric NICOLAS The indentation of C++ files was incorrect when the algorithm was confronted to "::" in functions indentFile() or indentText().
01sep2003 function -
  • function countInputLines() : int
    Determines the current line number where the parse cursor points to.
  • function getInputFilename() : string
    Returns the path of the input file being parsed.
31aug2003 feature - Add of a new BNF directive called #skipIgnore, which forces the skipping of insignificant characters (set by the #ignore(...) directive) at the current position of the parse cursor.

The directive is always true, even if the parsing has already reached the end of file or if there are no insignificant characters.

CodeWorker 2.17.4, 08sep2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2181698 CodeWorker_WIN2_17_4.zip
Any platform (?) sources 1307333 CodeWorker_SRC2_17_4.zip
Changes
Date Type Caller Description
20aug2003 function -
  • function skipEmptyCppExceptDoxygen() : bool
    Ignores all blank characters and all C++/JAVA–like comments, except when the comment conforms to the Doxygen format. The current file position moves to the first character that must be kept.
Changes on private version 2.17.3
Date Type Caller Description
19aug2003 bug_fix - While parsing C++ comments, Ada–like comments were detected too.
CodeWorker 2.17.2, 13aug2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2181994 CodeWorker_WIN2_17_2.zip
Any platform (?) sources 1271448 CodeWorker_SRC2_17_2.zip
Changes
Date Type Caller Description
13aug2003 bug_fix Gwenael CHAZAL A bug has appeared in the last version 2.17.1: sometimes, assignment instructions not prefixed by a set statement may raise a syntax error (‘;‘ expected).
04aug2003 improvement - Before, template functions had a specific body for each function instantiation:
function f<"a">() { /*body of f<"a">()*/ }
function f<"b">() { /*body of f<"b">()*/ }
but no generic template body, such as generic programming with C++ templates. Now, it exists:
function f<T>() {
/*generic template body when no specific
function instantiation is found*/
}

Classical example:

function f<1>() { return 1; }
function f<N>() { return $N*f<$N – 1$>()$; }
traceLine("10! = " + f<10>());

CodeWorker 2.17.1, 01aug2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2177557 CodeWorker_WIN2_17_1.zip
Any platform (?) sources 1268530 CodeWorker_SRC2_17_1.zip
Changes
Date Type Caller Description
31jul2003 bug_fix - The method–like syntax for calling a procedure wasn‘t parsed correctly:
now, myHTMLContext.clearVariable() is well–recognized and is worth clearVariable(myHTMLContext).
17jul2003 bug_fix - Parsing error when an arithmetic shift operator was following an identifier:
writing $iValue << 1$ was raising the unrelevant error literal expected.
CodeWorker 2.17, 11jul2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2178583 CodeWorker_WIN2_17.zip
Any platform (?) sources 1195033 CodeWorker_SRC2_17.zip
Changes
Date Type Caller Description
08jul2003 feature - Now, a BNF sequence may be repeated a variable number of times:

[BNF–sequence]#repeat(begin–expression[, end–expression])


where #repeat specifies how many times the sequence must be repeated, after resolving the boundary values given by the arithmetic expressions.
07jul2003 function -
  • function hostToNetworkLong(bytes : string) : string
    ParameterTypeDescription
    bytesstringa 4-bytes representation of a long integer sorted in the host bytes order

    Converts a 4–bytes representation of a long integer to the network bytes order. CodeWorker stores a byte as a 2–hexadecimal digits; the function raises an error if the argument bytes is malformed.

    Use longToBytes() and bytesToLong() to swap between decimal and host binary representation of a long integer.

  • function networkLongToHost(bytes : string) : string
    ParameterTypeDescription
    bytesstringa 4-bytes representation of a long integer sorted in the network bytes order

    Converts a 4–bytes representation of a long integer to the host bytes order. CodeWorker stores a byte as a 2–hexadecimal digits; the function raises an error if the argument bytes is malformed.

    Use longToBytes() and bytesToLong() to swap between decimal and host binary representation of a long integer.

  • function hostToNetworkShort(bytes : string) : string
    ParameterTypeDescription
    bytesstringa 2-bytes representation of a short integer sorted in the host bytes order

    Converts a 2–bytes representation of a short integer to the network bytes order. CodeWorker stores a byte as a 2–hexadecimal digits; the function raises an error if the argument bytes is malformed.

    Use shortToBytes() and bytesToShort() to swap between decimal and host binary representation of a short integer.

  • function networkShortToHost(bytes : string) : string
    ParameterTypeDescription
    bytesstringa 2-bytes representation of a short integer sorted in the network bytes order

    Converts a 2–bytes representation of a short integer to the host bytes order. CodeWorker stores a byte as a 2–hexadecimal digits; the function raises an error if the argument bytes is malformed.

    Use shortToBytes() and bytesToShort() to swap between decimal and host binary representation of a short integer.

07jul2003 function -
  • function longToBytes(long : ulong) : string
    ParameterTypeDescription
    longulongan unsigned long integer using the decimal base

    Converts an unsigned long integer in decimal base to its 4–bytes representation. Bytes are ordered in the host order (memory storage).

  • function shortToBytes(short : ushort) : string
    ParameterTypeDescription
    shortushortan unsigned short integer using the decimal base

    Converts an unsigned short integer in decimal base to its 2–bytes representation. Bytes are ordered in the host order (memory storage).

  • function bytesToShort(bytes : string) : ushort
    ParameterTypeDescription
    bytesstringa 2-bytes representation of an unsigned short integer (host bytes order)

    Converts a 2–bytes representation of an unsigned short integer to its decimal representation. Bytes are ordered in the host order (memory storage).

    If the argument bytes is malformed, the function raises an error.

  • function bytesToLong(bytes : string) : ulong
    ParameterTypeDescription
    bytesstringa 4-bytes representation of an unsigned long integer (host bytes order)

    Converts a 4–bytes representation of an unsigned long integer to its decimal representation. Bytes are ordered in the host order (memory storage).

    If the argument bytes is malformed, the function raises an error.

06jul2003 feature - Two new BNF directives have appeared:
  • #readBytes(length–expr): to read a sequence of bytes, where the arithmetic expression length–expr determines how many bytes to read,
  • #readChars(length–expr): to read a sequence of characters, where the arithmetic expression length–expr determines the length of the text,
05jul2003 function -
  • function createINETClientSocket(remoteAddress : stringport : int) : int
    ParameterTypeDescription
    remoteAddressstringa remote IP address (Internet namespace)
    portinta remote port number

    This function creates a client socket and connects it to the specified remote port, at the specified address IP remoteAddress, and returns a new socket descriptor. The socket is of type stream.

    Once the creation has achieved, use directly the send/receive functions or attachInputToSocket()/attachOutputToSocket for reading/writing to the socket via a BNF–parsing/template–based script.

  • function createINETServerSocket(port : intbackLog : int) : int
    ParameterTypeDescription
    portinta local port number
    backLogintmaximum queue length for incoming connection (1-5)

    This function creates a server socket bound to port and returns a new socket descriptor. The socket is of type stream.

    The argument backLog specifies the size of the queue connection. A new connection is refused when the queue is full.

    Once the creation has achieved, use the function acceptSocket() to wait for a new client connection (blocking call).

  • function acceptSocket(serverSocket : int) : int
    ParameterTypeDescription
    serverSocketinta server socket previously created via \samp{createINETServerSocket()}

    This function blocks until a client connection arrives, and returns the corresponding socket descriptor.

    Once a connection has been established, use directly the send/receive functions or attachInputToSocket()/attachOutputToSocket for reading/writing to the socket via a BNF–parsing/template–based script.

  • procedure attachInputToSocket(socket : int)
    ParameterTypeDescription
    socketinta client socket descriptor

    Joins the input stream of a parsing script to a socket stream: each time that the input stream pointer reaches the end, the interpreter waits for bytes coming from the socket.

    Waiting for bytes is a blocking process, so once you don‘t expect for other bytes anymore, don‘t forget to detach the socket via the procedure detachInputFromSocket() before reaching the end of the stream.

  • procedure detachInputFromSocket(socket : int)
    ParameterTypeDescription
    socketinta client socket descriptor

    Disconnects the input stream of a parsing script from a socket stream. You should have join the socket to the input stream before, via the procedure attachInputToSocket().

  • procedure attachOutputToSocket(socket : int)
    ParameterTypeDescription
    socketinta client socket descriptor

    Joins the output stream of a template–based or translation script so that to send the generated text to the socket.

    The generated text is sent at the end of the complete script execution.

  • procedure detachOutputFromSocket(socket : int)
    ParameterTypeDescription
    socketinta client socket descriptor

    Disconnects the output stream of a parsing script from a socket stream. You should have join the socket to the output stream before, via the procedure attachOutputToSocket().

    To call only if you have changed your mind and don‘t want the generated text to be sent to the socket at the end of the template–based script execution anymore.

  • function flushOutputToSocket(socket : int) : bool
    ParameterTypeDescription
    socketinta client socket descriptor

    Sends to a socket the complete text or binary data already generated by the template–based or translation script. The function then purges the output stream.

    This function has no link with attachOutputToSocket(). It only requires that the socket descriptor exists and is opened correctly.

  • function receiveBinaryFromSocket(socket : intlength : int) : string
    ParameterTypeDescription
    socketinta client socket descriptor
    lengthintnumber of bytes to read

    This function waits for length bytes to read from socket, and returns a sequence of bytes (CodeWorker represents a byte with 2 hexadecimal digits).

    If an error occurs, the function returns an empty string.

  • function receiveFromSocket(socket : intisText : boolref) : string
    ParameterTypeDescription
    socketinta client socket descriptor
    isTextboolrefthe function will populate this parameter with \samp{true} if read bytes designate a string and \samp{false} if they are binary data

    This function waits for bytes to read from socket and returns them. If an error occurs, the function returns an empty string.

    The function sets isText to:

    • true if it has received a text,
    • false if it has received binary data: the returned string is then a sequence of bytes (CodeWorker represents a byte with 2 hexadecimal digits),
  • function receiveTextFromSocket(socket : intlength : int) : string
    ParameterTypeDescription
    socketinta client socket descriptor
    lengthintsize of the text to read

    This function waits for length bytes to read from socket, and returns a string.

    If an error occurs, the function returns an empty string.

  • function sendTextToSocket(socket : inttext : string) : bool
    ParameterTypeDescription
    socketinta client socket descriptor
    textstringthe text to write

    This function writes a text to a socket and returns true if it has achieved successfully.

  • function sendBinaryToSocket(socket : intbytes : string) : bool
    ParameterTypeDescription
    socketinta client socket descriptor
    bytesstringa sequence of bytes to write

    This function writes binary data to a socket and returns true if it has achieved successfully.

    The function raises an error if a byte passed to bytes is malformed: CodeWorker expects 2 hexadecimal digits to represent a byte.

  • procedure closeSocket(socket : int)
    ParameterTypeDescription
    socketinta \textit{client}/\textit{server} socket descriptor

    This procedure closes the socket descriptor specified to the argument socket.

01jul2003 behaviour - Now, the function getFloatingLocation() raises an error if the floating location doesn‘t exist.
29jun2003 function -
  • procedure insertTextToFloatingLocation(location : stringtext : string)
    ParameterTypeDescription
    locationstringthe name of a floating location
    textstringsequence of characters to insert

    Inserts a sequence of characters passed to argument text, at the position of the floating location, whose name is given by the argument location.

    If the floating location doesn‘t exist, the function raises an error.

    In expansion mode, the floating location might point into a markup area previously generated. So, on the contrary of insertText(), the function permits to insert text out of the current markup area.

  • procedure insertTextOnceToFloatingLocation(location : stringtext : string)
    ParameterTypeDescription
    locationstringthe name of a floating location
    textstringsequence of characters to insert

    Inserts a sequence of characters passed to argument text, at the position of the floating location, whose name is given by the argument location, but only if the text has never been encountered previously by a insertTextOnce() or a writeTextOnce()procedure.

    If the floating location doesn‘t exist, the function raises an error.

    In expansion mode, the floating location might point into a markup area previously generated. So, on the contrary of insertTextOnce(), the function permits to insert text out of the current markup area.

  • function existFloatingLocation(key : stringparent : bool) : bool
    ParameterTypeDescription
    keystringname of a floating position into the output stream
    parentboolwhile expanding a file, search into precedent markup area if this floating location exists or not

    Returns true if the floating location, whose name is passed to argument key, already exists.

    If required (parameter parent set to true) and if the current output file is being expanded, the function searches the floating location in precedent visited markup areas.

29jun2003 bug_fix Gwenael CHAZAL The function completeDate() didn‘t work correctly on the Excel–like date format %t (fractionable number of days since december 30th, 1899).
28jun2003 bug_fix - Now, the functions send/get/postHTTPRequest() extract binary data correctly.
CodeWorker 2.16, 23jun2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2106940 CodeWorker_WIN2_16.zip
Any platform (?) sources 1497884 CodeWorker_SRC2_16.zip
Changes
If you wish to recompile sources, please note that from now on, CodeWorker doesn‘t need SWORD and ACE libraries anymore. Nevertheless, it requires libcurl as a dynamic library from now.

The tool uses libcurl for sending HTTP requests only. If you don‘t need this functionality, you might recompile sources after having disabled the preprocessor definition CODEWORKER_CURL_LIB.

Date Type Caller Description
13jun2003 feature Gwenael CHAZAL Now, foreach statement may iterate in reverse order:

foreach i in reverse sorted list ...

CodeWorker 2.15, 11jun2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2075146 CodeWorker_WIN2_15.zip
Any platform (?) sources 1263521 CodeWorker_SRC2_15.zip
Changes
Date Type Caller Description
10jun2003 function -
  • procedure autoexpand(outputFileName : stringthis : treeref)
    ParameterTypeDescription
    outputFileNamestringthe existing file to expand
    thistreerefthe current node that will be accessed with \textit{this} variable

    Expands an existing file whose name is passed to the argument outputFileName, executing template–based scripts located at each markup. The file contains its own scripts for expanding code.

    Expanding a file consists of generating code into marked out areas only, the rest of the file remaining the same. The markup is put into a comment, knowing that the syntax of the comment must conform to the type of the expanded file outputFileName. So, an HTML file expects <!– – and – –>, a JAVA file is waiting for // and "\n", ... The markup is announced by ##markup## followed by a string that represents the markup key. Don‘t forget to configure correctly the syntax of comment boundaries with procedures setCommentBegin() (see setCommentBegin()) and setCommentEnd() (see setCommentEnd()).

    When the procedure is called, CodeWorker jumps from a markup to another. To handle a markup, it checks whether text was already generated, put between tags ##begin##"markup–key" and ##end##"markup–key", added automatically the first time an expansion is required, to demarquate the portion of code that doesn‘t belong to the user. Then, it extracts all protected areas, if any, and it generates code at the position of the markup, adding begin/end tags seen before.

    The interpreter reclaims the tags ##script## just after the markup. It extracts the embedded text, considered as a template–based script, eventually put between comments, and the interpreter executes this embedded script.

    Note that some data might be put between tags ##data##, accessible in the template–based script via the function getMarkupValue() (see getMarkupValue()). This block of custom data comes after the ##script## tag, if present.

    Be careful not to confuse this prodedure with generate() that doesn‘t care about markups and that overwrites the output file completely, except protected areas of course.

09jun2003 feature - Add of a BNF general directive called #parameters.
08jun2003 improvement - When looking for an included script (#include "included–script.gen") in the filesystem, if the included script is known as a relative path, the preprocessor starts searching from the directory of the caller script.
Before, the preprocessor was starting from the current directory.
06jun2003 bug_fix - In expansion mode only, the interpreter was forgotting to keep for checking the protected areas that weren‘t interesting anymore the template–based script.
05jun2003 feature - Add of the extended–BNF directive ‘#super‘ to call an overloaded non–terminal.
CodeWorker 2.14, 04jun2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2053598 CodeWorker_WIN2_14.zip
Any platform (?) sources 1139467 CodeWorker_SRC2_14.zip
Changes
Date Type Caller Description
04jun2003 function -
  • procedure traceEngine()
    Traces some states about the interpreter and the current script.
04jun2003 option - Add of a new option on the command line: -insert
03jun2003 feature - A translation script might require to transform scanned characters before copying them implicitely in the output:
#implicitCopy(composeHTMLLikeString)
means that each scanned character is transformed to HTML before writing it by implicit copy.
03jun2003 feature - BNF production rules are overloadable thanks to the directive #overload:
#overload nonterminal ::= ...;
replaces the ancient nonterminal clause by a new production rule.
01jun2003 note - Function getMarkerKey() is deprecated and replaced by getMarkupKey().
01jun2003 function -
  • function getMarkupValue() : string
    This function must be called into a pattern script that runs in expansion mode. It returns the current markup value, if any, put between tags ‘##data##‘ after declaring the markup key.
01jun2003 improvement - Add of a data section, attached to expansion markups (put between ##data## tags just after the ##markup## tag).
01jun2003 note - For expansion mode, ##markup## replaces the tag ##marker##.
28may2003 function -
  • function changeFileTime(filename : stringaccessTime : stringmodificationTime : string) : int
    ParameterTypeDescription
    filenamestringname of the file to set
    accessTimestringdate-time of the last access
    modificationTimestringdate-time of the last modification

    The function changes the access and modification times of the file filename. The user ID of the process must be the owner of the file, or the process must have appropriate privileges.

    In case of failure, the function returns a negative integer:

    • –1: unknown error that shouldn‘t appear,
    • –2: permission denied,
    • –3: too many files have been opened,
    • –4: file not found,
    • –5: invalid times argument,
CodeWorker 2.13, 27may2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2662129 CodeWorker_WIN2_13.zip
Any platform (?) sources 1095172 CodeWorker_SRC2_13.zip
Changes
Date Type Caller Description
27may2003 bug_fix - When called via a C++ binding, bad context variable passed to CGRuntime::expand(), CGRuntime::parseAsBNF() and CGRuntime::generate().
26may2003 feature - Add of template BNF clauses (non–terminal symbols) where the instantiation isn‘t resolved.

Example:
nonterminal<"Case 1"> ::= ...;
nonterminal<"Case 2"> ::= ...;

are instantiations of nonterminal resolved for "Case 1" and "Case 2".
nonterminal<T> ::= ...;
is a template BNF clause where the instantiation isn‘t resolved and that describes the generic implementation of the production rule. It will be called for "Case 3" or any constant different of "Case 1" and "Case 2".

CodeWorker 2.12, 22may2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2656478 CodeWorker_WIN2_12.zip
Any platform (?) sources 1086858 CodeWorker_SRC2_12.zip
Changes
Date Type Caller Description
19may2003 function Gwenael CHAZAL
  • procedure randomSeed(seed : int)
    ParameterTypeDescription
    seedinta new seed for generating pseudorandom integers

    Sets the seed for generating a series of pseudorandom integers. To change the seed to a given starting point, choose any positive value different of 1 as the seed argument. A value of 1 reinitializes the generator. Any negative value let CodeWorker choose a random seed for you.

  • function randomInteger() : int
    Generates a pseudorandom number.
19may2003 function -
  • procedure copyGenerableFile(sourceFileName : stringdestinationFileName : string)
    ParameterTypeDescription
    sourceFileNamestringthe name of the file to copy
    destinationFileNamestringthe name of the copy

    This procedure copies a generable file sourceFileName to another location destinationFileName if the files have differences in the hand–typed text. It raises an error if something wrong has happened (either the source file doesn‘t exist or permissions are insufficient for copy).

    A generable file is any source file containing protected areas or expandable markups.

15may2003 feature - Add of the ternary operator:
ternary–expr ::= boolean–expr ‘?‘ expression1 ‘:‘ expression2
where expression1 is executed if the condition is verified, and expression2 otherwise.
12may2003 function Eric NICOLAS
  • function UUID() : string
    This function generates an UUID and returns it as a string. An UUID is a 128–bit universally unique id, used by Microsoft and being proposed as an internet standard.
CodeWorker 2.11, 25apr2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2618310 CodeWorker_WIN2_11.zip
Any platform (?) sources 1062258 CodeWorker_SRC2_11.zip
Changes
Date Type Caller Description
24apr2003 function -
  • procedure environTable(table : tree)
    ParameterTypeDescription
    tabletreewill contain the list of all environment variable names

    The procedure returns the array of all environment variable in the argument table. The name of the environment variable is assigned to the value of the item.

24apr2003 bug_fix - The BNF operator –> had a strange behaviour when the matched input was assigned to a variable (–>BNF–expression:variable).
While translating a file in #implicitCopy mode, the content of the variable was written in the destination file, whereas the matched input of BNF–expression had already been copied.
Consequence: the matched input of BNF–expression was appearing twice in the destination file.
24apr2003 function -
  • procedure setFloatingLocation(key : stringlocation : int)
    ParameterTypeDescription
    keystringname of a floating position to put into the output stream
    locationintthe position into the output stream to assign to the key, starting at \samp{0}

    Assigns a position to the floating location whose name is passed to argument key.

22apr2003 function -
  • procedure openLogFile(filename : string)
    ParameterTypeDescription
    filenamestringname of the file where log information will be put

    Creates (or erases if already exists) a log file, which remains valid upto the end of the execution. Each trace function (traceLine(), traceText(), traceStack()) will write in the log file.
    This function is very convenient for debugging a CGI script, where the standard output is devoted to the result page.

    Note that passing an empty filename stops the log mechanism.

22apr2003 function Gwenael CHAZAL
  • function completeDate(date : stringformat : string) : string
    ParameterTypeDescription
    datestringa date-time representation to complete
    formatstringthe format that the \samp{date} argument conforms to

    Completes the date passed to the argument date, so as it conforms to the syntax of a date in CodeWorker meaning: "%d%b%Y %H:%M:%S.%L".

    Starting from today date with reset time (00:00:00.0), it replaces date–time characteristics with those of the parameter date and returns the result of the substitutions.

22apr2003 improvement Gwenael CHAZAL Add of two new formats in formatDate():
  • ‘%w‘ means that the weekday must be written as an integer (0–6; 0 is sunday),
  • ‘%W‘ means that the weekday must be written as the complete english name,
CodeWorker 2.10, 18apr2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2597932 CodeWorker_WIN2_10.zip
Any platform (?) sources 1050598 CodeWorker_SRC2_10.zip
Changes
From now, CodeWorker is able to run as a CGI program. It may be attached to the ".gen" file extension. See the script repository for discovering some use–cases.
Date Type Caller Description
18apr2003 feature - CodeWorker can run as a CGI program.
17apr2003 function -
  • function encodeURL(URL : string) : string
    ParameterTypeDescription
    URLstringreadable URL to encode

    Encode an URL for an HTTP request, meaning that the space character changes in ‘+‘ and all non–alphanumeric characters are encoded in hexadecimal, preceded by ‘%‘.

    Note that conversions are transparent while doing HTTP requests.

  • function decodeURL(URL : string) : string
    ParameterTypeDescription
    URLstringreadable URL to encode

    Decode an URL from an HTTP request, meaning that the ‘+‘ character changes in a space and all hexadecimal descriptions of bytes (2 digits preceded by ‘%‘) are converted to characters.

    Note that conversions are transparent while doing HTTP requests.

Changes on private version 2.09
This version runs under CygWin correctly. One should be able to make a Linux version from source files (not checked yet, next step).
Date Type Caller Description
16apr2003 bug_fix Laurent RIESTERER The function saveProject() didn‘t write node references. Now, a node reference is announced with the keyword __REFERENCE in the XML output of the project.
14apr2003 function -
  • function getNow() : string
    Returns the current date–time, conforming to the format:
    %d%b%Y %H:%M:%S.%L

    For explanations about format types, see function formatDate at {formatDate()}.

  • procedure setNow(constantDateTime : string)
    ParameterTypeDescription
    constantDateTimestringthe current date-time is fixed to this value

    Fixes the current date–time to the value passed to argument constantDateTime, conforming to the format:
    %d%b%Y %H:%M:%S.%L

    The procedure doesn‘t change the system time. now is just frozen for the scripting language when calling getNow(). One passes an empty date–time to unfreeze the time.

    For explanations about format types, see function formatDate at {formatDate()}.

07apr2003 feature - The scripting language offers to declare global variables. Up to now, the only way to declare global variables was to put them somewhere in the project main tree.

The global statement was added to provide the feature:
global–statement ::= "global" variable [‘=‘ expression–to–assign]?

04apr2003 function -
  • function existEnv(variable : string) : bool
    ParameterTypeDescription
    variablestringthe environment variable name

    The function returns true if the environment table entry contains the variable.

CodeWorker 2.08, 03apr2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2539560 CodeWorker_WIN2_08.zip
Any platform (?) sources 1011071 CodeWorker_SRC2_08.zip
Changes
Date Type Caller Description
01apr2003 function -
  • procedure setWorkingPath(path : string)
    ParameterTypeDescription
    pathstringthe new working path

    Changes the output directory that was assigned to the option –path on the command line.

31mar2003 function -
  • function getIncludePath() : string
    It returns the include path passed to the command line with one or more times the setting of option –I, or the latest include path set via the procedure setIncludePath().

    The include path is a concatenation of paths separated by semi–commas ( extbf{‘;‘}).

  • procedure setIncludePath(path : string)
    ParameterTypeDescription
    pathstringa concatenation of paths separated by \textbf{';'}

    It changes the include path passed to the command line with one or more times the setting of the option –I.

    The include path expects a concatenation of paths separated by semi–commas (‘;‘).

26mar2003 function -
  • procedure overwritePortion(location : inttext : stringsize : int)
    ParameterTypeDescription
    locationintpoints to a position in the output stream
    textstringsequence of characters to write
    sizeintsize of the portion to overwrite

    Writes a sequence of characters passed to argument text, at the position of the output stream given by argument location. The text overwrites up to size characters and inserts the rest if any. The position starts counting at 0.
    About the behaviour of the overwriting:

    • If there are more than size characters in text, all floating locations that point to location + size, or after, are impacted by the insertion of the remaining characters of text, and shift for an offset that is worth the size of the text minus the size of the portion to overwrite.
    • overwritePortion(pos, text, 0) is worth insertText(pos, text).
    • If the portion to overwrite is bigger than the length of text, all not overwritten characters of the portion are removed.
    • overwritePortion(pos, "", size) removes size characters from the output stream at position pos.

    If the position isn‘t valid, negative or bigger than the end of the output stream, an error is raised.

    In expansion mode, the position 0 points to the first character written for expansion and cannot exceed the last character written for expansion.

    Generally, the position is given by the function getFloatingLocation().

26mar2003 improvement - translation scripts admit calls to both parsing and code generation functions in the procedural statement blocks (e.g. announced by the symbol =>).
26mar2003 improvement - BNF–parsing scripts admit calls to parsing functions in the procedural statement blocks (e.g. announced by the symbol => in the production rules).
24mar2003 function -
  • function findNextString(text : stringfind : stringposition : int) : int
    ParameterTypeDescription
    textstringa sequence of characters to explore
    findstringa substring to find into \samp{text}
    positionintthe position in the string (starting at 0) the search must begin

    Returns the lowest beginning index of the substring find that matches the sequence of characters passed to argument text, starting the search at position. The index starts counting to 0.

    If the substring find doesn‘t belong to text (starting at position), the negative value –1 is returned.

10mar2003 feature - Add of motif expressions that enable to operate on the logical structure of a tree. It allows filtering and selecting the nodes of a tree, which match a motif. This is something like XPath, but working on a parse tree of CodeWorker instead of an XML tree.
10mar2003 feature - Add of a new statement called select, which operates a little like the foreach statement, but iterating a list of nodes that match a motif expression. It is similar to the <xsl:foreach select=motif > XSL statement.
CodeWorker 2.07, 06mar2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2487490 CodeWorker_WIN2_07.zip
Any platform (?) sources 2017720 CodeWorker_SRC2_07.zip
Changes
Date Type Caller Description
06mar2003 bug_fix - The function readIdentifier() didn‘t match the rule [‘a‘..‘z‘ | ‘A‘..‘Z‘ | ‘_‘][‘a‘..‘z‘ | ‘A‘..‘Z‘ | ‘_‘ | ‘0‘..‘9‘]* correctly.
06mar2003 feature - Now, the scripting language accepts char literals, written as in C/JAVA and converted to a string literal.
Changes on private version 2.06
If you wish to recompile sources, please note that from now on, CodeWorker requires both SWORD and ACE libraries as static.
Date Type Caller Description
05mar2003 feature - Add of a new BNF directive: #insert(variable) sequence–of–BNF–instructions. The directive creates a new node variable (if it doesn‘t exist yet) and executes the sequence of BNF instructions that follow. If the sequence fails and if the node was created by the directive, variable is removed.
05mar2003 bug_fix - When #pushItem had created the variable to which push a new item, it wasn‘t removed in case of failure in the sequence of tokens.
05mar2003 function -
  • procedure removeVariable(node : tree)
    ParameterTypeDescription
    nodetreethe node to remove from the tree

    All attributes of the argument node are deleted, its array of nodes is cleared and its value becomes an empty string. If the node was referring to another node, the link is cleared. Once these task are completed, the variable node is removed from the tree it belongs to (as an attribute or an element).

    Note that trying to remove a local variable throws an error.

04mar2003 function -
  • function getHTTPRequest(URL : stringHTTPSession : treearguments : tree) : string
    ParameterTypeDescription
    URLstringURL of the HTTP server
    HTTPSessiontreean object to describe the HTTP session
    argumentstreelist of the arguments to GET; the key contains the name of the argument and the element gives the value

    This function sends an HTTP‘s GET request to the HTTP server pointed to by the parameter URL with the list of arguments put into the the parameter arguments.

    The function returns the document read from the HTTP server.

    The function sendHTTPRequest() (see {sendHTTPRequest()}) describes the structure of the HTTP session object.

  • function postHTTPRequest(URL : stringHTTPSession : treearguments : tree) : string
    ParameterTypeDescription
    URLstringURL of the HTTP server
    HTTPSessiontreean object to describe the HTTP session
    argumentstreelist of the arguments to POST; the key contains the name of the argument and the element gives the value

    This function sends an HTTP‘s POST request to the HTTP server pointed to by the parameter URL with the list of arguments put into the the parameter arguments.

    The function returns the document read from the HTTP server.

    The function sendHTTPRequest() (see {sendHTTPRequest()}) describes the structure of the HTTP session object.

  • function sendHTTPRequest(URL : stringHTTPSession : tree) : string
    ParameterTypeDescription
    URLstringURL of the HTTP server
    HTTPSessiontreean object to describe the HTTP session

    This function sends an HTTP request to the HTTP server pointed to by the argument URL, and returns the document read from the HTTP server.

    If the request fails, an error message is thrown.

    The well–named argument HTTPSession specifies some information into devoted attributes:

    • agent (optional) is the browser name, "CodeWorker" by default,
    • referer (optional),
    • proxy (optional):
      • proxy.host (compulsory),
      • proxy.port (compulsory),
    • cookies (optional) is a list of nodes such as:
      • name (compulsory),
      • value (optional) is worth by default,
      • path (optional),
      • domain (optional),
      • expires (optional) for a permanent cookie,
Changes on private version 2.05
Date Type Caller Description
28feb2003 feature - Add of the arithmetic bit shift operators << and >>, available in arithmetic expressions only.
28feb2003 feature - Add of the arithmetic bitwise not operator ~, available in. arithmetic expressions only.
27feb2003 bug_fix - File handles weren‘t closed after calling any function like file*(...) (fileSize(...), fileLastModification(...), ...).
CodeWorker 2.04, 26feb2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2369560 CodeWorker_WIN2_04.zip
Any platform (?) sources 3095268 CodeWorker_SRC2_04.zip
Changes
Date Type Caller Description
26feb2003 feature - Add of directive #evaluateVariable(expression) to resolve a branch at runtime:

pushItem #evaluateVariable("variable.list");


is equivalent to:

pushItem variable.list;


and is useful when the branch is known at runtime exclusively. Below, an new item is added to an attribute of a variable v, and the name of the attribute is held by the variable a:

function f(v : variable, a : value) {
    pushItem #evaluateVariable("v." + a);

It allows building the structure of the parse tree dynamically. It is the case when parsing an XML file with no information about its DTD.

26feb2003 feature - Add of a new BNF directive: #pushItem(variable) sequence–of–BNF–instructions. The directive pushes a new item into the array of the node variable and executes the sequence of BNF instructions that follow. If the sequence fails, the last element of the array variable is removed.
21feb2003 improvement Gwenael CHAZAL The memory space of parse trees has been reduced, and will be more later.
17feb2003 function -
  • procedure removeFirstElement(list : tree)
    ParameterTypeDescription
    listtreean array of nodes

    Removes the first element from the array of nodes called list.

    Nothing occurs if list doesn‘t exist or is empty.

  • procedure removeLastElement(list : tree)
    ParameterTypeDescription
    listtreean array of nodes

    Removes the last element from the array of nodes called list.

    Nothing occurs if list doesn‘t exist or is empty.

17feb2003 bug_fix - Use of free memory might have occurred on function removeElement().
12feb2003 function -
  • function octalToDecimal(octalNumber : string) : int
    ParameterTypeDescription
    octalNumberstringan octal integer to convert to a decimal number

    Converts an octal integer, passed to the argument octalNumber, to a signed decimal integer and returns the result. If octalNumber doesn‘t conform to the syntax of an octal number (octalNumber ::= #!ignore [‘0‘..‘8‘]+), the function raises an error.

  • function hexaToDecimal(hexaNumber : string) : int
    ParameterTypeDescription
    hexaNumberstringan hexadecimal integer to convert to a decimal number

    Converts an hexadecimal integer, passed to the argument hexaNumber, to a signed decimal integer and returns the result. If hexaNumber doesn‘t conform to the syntax of an hexadecimal number (hexaNumber ::= #!ignore [‘0‘..‘9‘ | #noCase ‘A‘..‘F‘]+), the function raises an error.

06feb2003 improvement - Now, the option ‘–c++‘ admits a second optional parameter, which is the root path of CodeWorker either in development or distributed state (subfolders aren‘t the same).
06feb2003 improvement - Better way to ignore insignificant characters between tokens. May have corrected strange behaviors in some use cases.
06feb2003 feature - Add of a new predefined BNF clause: #readCompleteIdentifier is valid if and only if the current position of the input stream coincides with the beginning of an identifier.

Examples: if the current position points to the fifth character...

  • #readCompleteIdentifier scans "room" from the input stream "1234room",
  • #readCompleteIdentifier fails to scan the input stream "mushroom", because "room" doesn‘t coincide with the beginning of an identifier, but is a part of "mushroom".
06feb2003 bug_fix - The implicit copy of source–to–source translation (running the BNF–translation script in #implicitCopy mode) wasn‘t working correctly while copying ignored characters (specified by #ignore(...)) to the output stream.
06feb2003 bug_fix - The implicit copy of source–to–source translation (running the BNF–translation script in #implicitCopy mode) wasn‘t working correctly on token operator –>.
05feb2003 feature - Add of two new predefined BNF clauses:
  • #readInteger to scan an integer ; equivalent to #!ignore [‘0‘..‘9‘]+,
  • #readNumeric to scan a floating–point number ; equivalent to #!ignore [#readInteger [‘.‘ [‘0‘..‘9‘]*]? | ‘.‘ [‘0‘..‘9‘]*] [[‘e‘ | ‘E‘] [‘+‘ | ‘–‘]? [‘0‘..‘9‘]+]?,
05feb2003 function -
  • function readByte() : string
    Returns the byte read at the current file position, or an empty string if the end of file has been reached. If succeeded, the position of the input file moves to the next character.

    The byte is returned as a 2–hexadecimal digit.

  • procedure writeBytes(bytes : string)
    ParameterTypeDescription
    bytesstringsequence of bytes to write at the current position of the output stream

    Writes a sequence of bytes passed to argument bytes, at the current position of the output stream.

    A byte is a couple of hexadecimal digits.

05feb2003 feature - Add of a new predefined BNF clause: #readByte to scan a byte (converted to a) 2–hexadecimal digit in the parse tree).
05feb2003 bug_fix - When a BNF token with a set of constant to check didn‘t match the input stream, the error message was writing the token expression badly.
03feb2003 bug_fix Gwenael CHAZAL While compiling the C++ translation of scripts:
  • 3 parameters expected to initialize the runtime environment of a BNF–parsing script since version 2.03,
  • conversion to string expected for the name of files to generate (C++ translation of functions generate(), expand(), translate()),
31jan2003 function -
  • function byteToChar(byte : string) : string
    ParameterTypeDescription
    bytestringan hexadecimal number of 2 digits exactly

    Converts a byte to a character. A byte is considered as an hexadecimal number of 2 digits exactly.

    If the argument byte doesn‘t contain an hexadecimal number of 2 digits, an error is raised. If byte is worth ‘00‘, the function returns an empty string.

  • function charToByte(char : string) : string
    ParameterTypeDescription
    charstringa character

    Converts a character to its hexadecimal representation, taking 2 digits, even if less than 0x10.

    If the argument char is empty, the function returns ‘00‘. If it contains more than one character, an error is raised.

31jan2003 function -
  • function loadBinaryFile(file : string) : string
    ParameterTypeDescription
    filestringname of the binary file to load

    Returns the binary content of the file whose name is passed to argument file. The content concatenates a sequence of hexadecimal digits, so a byte is stored in 2 characters:
    binary–content ::= [byte]*;
    byte ::= [‘0‘..‘9‘ | ‘A‘..‘F‘ | ‘a‘..‘f‘]2;

    If the file doesn‘t exist or can‘t be read with success, an error occurs.

  • procedure saveBinaryToFile(filename : stringcontent : string)
    ParameterTypeDescription
    filenamestringname of the binary file to write into
    contentstringsequence of bytes (2 hexadecimal digits) to write into the file

    Saves the binary content to the file filename. The parameter content concatenates a sequence of hexadecimal digits, so a byte is stored in 2 characters:
    binary–content ::= [byte]*;
    byte ::= [‘0‘..‘9‘ | ‘A‘..‘F‘ | ‘a‘..‘f‘]2;

    The hexadecimal pairs of digit are converted to binary (8 bits) before writing the content.

    If the file cannot be created, an error is raised. If the file already exists, its content is replaced by the new binary content.

  • procedure saveToFile(filename : stringcontent : string)
    ParameterTypeDescription
    filenamestringname of the text file to write into
    contentstringsequence of characters to write into the file

    Saves the text content to the file filename.

    If the file cannot be created, an error is raised. If the file already exists, its content is replaced by the new text content.

31jan2003 feature - Add of the statement modifier parsed_file(filename) statement and of a new BNF–script directive #parsedFile(filename)BNF–sequence
31jan2003 option - Add of a new option on the command line: -parseBNF
CodeWorker 2.03, 31jan2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2256234 CodeWorker_WIN2_03.zip
Any platform (?) sources 975153 CodeWorker_SRC2_03.zip
Changes
Date Type Caller Description
30jan2003 feature Laurent RIESTERER CodeWorker enables to come back up the parent of a node into the parse tree. the syntax is myVariable#parent to take back the parent of myVariable.
30jan2003 bug_fix - Bad translation in C++ of myVariable#back, which was generated as myVariable#front with the option ‘–c++‘ on the command line!
30jan2003 option - Add of a new option on the command line: -translate
28jan2003 feature apm35 Add of two directives in the Extended BNF grammar: #implicitCopy and #explicitCopy, used into a translation script:
  • #implicitCopy means that the scanned text is copied to the output stream during the pattern matching. If a rule fails, the scanned text is removed from the output stream, up to the last valid token,
  • #explicitCopy means that the translation doesn‘t take in charge of populating the output stream. You have to specify it (the classical mode).
It simplifies scripts for source transformations in source–to–source translations (function translate()), where both the input and the output are written in the same language and that only some little transformation may occur on the output. Example: to scan all variable identifiers and to rename them after applying a coding rule.
28jan2003 function -
  • function getOutputLocation() : int
    Returns the current file position for writing to the output stream.
  • procedure resizeOutputStream(newSize : int)
    ParameterTypeDescription
    newSizeintnew size of the output stream

    This procedure changes the size of the output stream to newSize. The only allowed resizing is to reduce the stream (the request is ignored otherwise). If the current position becomes out of the boundaries, it points to the new end of the output stream.

  • procedure setOutputLocation(location : int)
    ParameterTypeDescription
    locationintpoints to a position of the output stream

    This procedure moves the position of the output stream elsewhere. The position passed to the argument location starts at 0.

24jan2003 feature - Add of a new kind of regular expression for the BNF parsing scripts: –> followed by a token means that the parser has to find the next occurrence of the token into the imput stream. In case of success, the position moves just after the matched token.

–>expression
is equivalent to
[~expression]* expression

24jan2003 bug_fix Gwenael CHAZAL Normally, the option –stack prevents infinite loops of functions calling, but a bug has hidden another:
  • When the internal function–call stack had reached a depth of more than 128 entries, raising an error had caused to crash the interpreter,
  • The stack allocated by the VC++ linker wasn‘t sufficient,
CodeWorker 2.02.1, 23jan2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2216925 CodeWorker_WIN2_02_1.zip
Any platform (?) sources 923022 CodeWorker_SRC2_02_1.zip
Changes
Date Type Caller Description
23jan2003 improvement - Correction of some spelling mistakes into the documentation and the source code.
CodeWorker 2.02, 22jan2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2216973 CodeWorker_WIN2_02.zip
Any platform (?) sources 925066 CodeWorker_SRC2_02.zip
Changes
Date Type Caller Description
22jan2003 bug_fix Laurent RIESTERER The function coreString(text, pos, last) didn‘t work correctly when pos was equal to 0 (an empty string was returned systematically).
CodeWorker 2.01, 22jan2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2217184 CodeWorker_WIN2_01.zip
Any platform (?) sources 922151 CodeWorker_SRC2_01.zip
Changes
Date Type Caller Description
20jan2003 feature - A BNF clause may precise a different #ignore mode, which will be applied just before running it by the caller. For example:

myClause #ignore(blanks) ::= ... ;

and

myCallerClause ::= #ignore(C++) ... myClause

means that when myCallerClause will arrive on the myClause expression, it won‘t ignore all what match the C++ empty characters (#ignore(C++) was put at the beginning), but it will ignore blanks only (as specified into the declaration of the clause myClause).

CodeWorker 2.0, 21jan2003
Platform Type Size Archive
WINDOWS 98/2000/NT/XP binaries 2216065 CodeWorker_WIN2_0.zip
Any platform (?) sources 923724 CodeWorker_SRC2_0.zip
Changes
Date Type Caller Description
19jan2003 note - First valid publication of the tool on Internet.
 CodeWorker is maintained by Cedric Lemaire. Please send a mail to Submit a bug or feature