TAL2C For converting Tandem TAL to ANSI C =================================== ======================================================================== Contents ------------------------------------------------------------------------ 1. Software Installation Information 2. Software Evaluation License Agreement 3. Contacting Gresham Computing Pty Ltd 4. Change History 5. Known Problems Remaining ======================================================================== 1. Software Installation Information ------------------------------------------------------------------------ 1.1 Pre-Installation Requirements ----------------------------------- Check the following workstation and Tandem system pre-installation requirements. 1.1.1 Workstation System Requirements -------------------------------------- Minimum: IBM-compatible Pentium 133MHz workstation; 32MB RAM; 10MB disk space; pointing device (such as a mouse); Windows NT 4.0. Recommended: IBM-compatible Pentium Pro 200MHz workstation; 64MB (or more) RAM; 10MB disk space; pointing device (such as a mouse); Windows NT 4.0. You can run the TAL2C installation program after choosing Run from the Windows NT Start button, or from the Windows NT command (DOS) prompt. You must run TAL2C from the 32-bit Command (DOS) Prompt. 1.1.2 Tandem System Requirements --------------------------------- You must have access to a TAL compiler to confirm that your TAL source code compiles before converting the TAL code to C. 1.2 Installation Instructions ------------------------------ This section summarizes the steps required to install TAL2C. Refer to Chapter 1, "Installing TAL2C," in the TAL2C User's Guide for complete installation instructions. 1.2.1 Installing TAL2C ----------------------- The method you use to install the software, depends on how you obtained it. Obtained From the Gresham Web Site ---------------------------------- If you obtained the software from the Gresham web site, the software is packaged as a self-extracting compressed file. The file name is TAL2Cnnn.EXE (where nnn represents a version number). To install the software: 1. Create a directory for the TAL2C files created during installation, for example C:\TAL2C. 2. Copy TAL2Cnnn.EXE to the \tal2c directory. 3. Change directory to the \tal2c directory. 4. Run the TAL2Cnnn.EXE. This extracts the files from the compressed file to the \tal2c directory. 5. Run INSTALL.BAT (this renames files to the correct names, as the self-extracting compressed file does not support long filenames). 6. Confirm that all TAL2C files exist. 7. Delete the TAL2Cnnn.EXE from the \tal2c directory. 8. Include the name of the \tal2c directory in your search path. 9. Test that the TAL2C search path is correct. 10. If you wish to convert the supplied test and demonstration example code, copy the supplied .license.dmo file to .license. WARNING: If you already have a full license, ensure you make a copy of it first. 11. Verify that TAL2C is correctly installed. Obtained on Diskettes or CD --------------------------- If you obtained the software on diskettes or CD, the software is packaged as one or more uncompressed files. NOTE: The following installation steps do not apply if you downloaded the software from the Gresham web site on CD. In this case, follow the instructions in "Obtained From the Gresham Web Site", above. To install the software: 1. Create a directory for the TAL2C files created during installation, for example C:\TAL2C. 2. Copy the files to \tal2c directory. 3. Run INSTALL.BAT (this renames files to the correct names, as the self-extracting compressed file does not support long filenames). 4. Confirm that all TAL2C files exist. 5. Include the name of the \tal2c directory in your search path. 6. Test that the TAL2C search path is correct. 7. If you wish to convert the supplied test and demonstration example code, copy the supplied .license.dmo file to .license. WARNING: If you already have a full license, ensure you make a copy of it first. 8. Verify that TAL2C is correctly installed. 1.2.2 Files Created During Installation ---------------------------------------- Refer to Chapter 1, "Installing TAL2C," in the TAL2C User's Guide for the list of files created during installation. There is an additional file in this release of TAL2C: INSTALL.BAT, which must be run as part of the installation procedure (see step 4a above). 1.3 Post-Installation Requirements ---------------------------------- TAL2C generates ANSI-compliant C source code. To compile your C output code, after conversion from TAL, you must use an ANSI-compliant C compiler. 1.4 Execution -------------- Refer to Chapter 4, "Executing TAL2C," in the TAL2C User's Guide for the complete TAL2C command syntax. For a brief description of valid TAL2C flags, run TAL2C with no flags by entering the following command: tal2c The simplest way to convert the TAL file 'myprogs' to the C file 'myprog.c' is: tal2c myprogs 1.5 Converting the demonstration code -------------------------------------- The supplied files t2cdirs and t2cextns are a working TAL program that will count files and allocated pages (see the source for details). This section describes how to convert and run the program. First, make sure the demonstration license file .license.dmo has been copied to .license, and that you have a backup of any full license file. Run tal2c to convert the TAL source. Because the demonstration code uses defines, you must run tal2c twice, as follows: tal2c -e t2cdirs tal2c -e t2cdirs Transfer the source files t2cdirs, t2cextns and t2cdir.c to your Tandem system. If you have not already done so, also transfer ctal.c, ctal.h and t2cmains. Compile t2cdirs using your TAL compiler. The object file is runnable. (Note: this requires TAL version D20 or later.) Compile t2cdirc and ctalc with your C compiler. (Note: this requires C version D20 or later.) Compile t2cmains with your TAL compiler. Build an executable with binder, e.g. bind add * from t2cdiro add * from ctalo add * from t2cmaino select search $system.system.clarge set highrequesters on build t2cdir! The executables should work identically. NOTE: do not change the source in t2cdirs or t2cextns; if you do TAL2C will no longer convert them. 1.6 Licensing -------------- TAL2C runs as a demonstration version until you obtain a full license from Gresham. The demonstration license file is included in the distribution, and allows you to convert the demonstration code which is also provided. To obtain a full license you must provide Gresham with certain information. Refer to Chapter 5," Licensing TAL2C," in the TAL2C User's Guide for details. ======================================================================== 2. Software Evaluation License Agreement ------------------------------------------------------------------------ This Software Evaluation License Agreement ("Agreement") is for TAL2C. Please read this Agreement carefully. If you agree to be bound by all the terms and conditions listed here then you will be granted a license to use the accompanying software according to the terms and conditions. If you do not agree with any statement in this Agreement you are not permitted to use the software and you must delete it from your computers and purge all copies. The accompanying software (the "Software") is owned by Insession U.S. Corporation ARBN 078 950 320 (the "Owner"). The Software is distributed by Gresham Computing Pty Ltd ACN 077 642 132, an Australian corporation (the "Distributor"). The Distributor warrants that it has the right to sublicense the Software and in doing so that it has the permission of the Owner. The term "Software" includes all programs, files, documentation and online help that are delivered together as one package and any and all updates and replacements. Subject to the terms and conditions listed in this Agreement you (the "Licensee") are permitted to use the Software for evaluation purposes only. Ownership and all rights to and in the Software will remain with the Owner and/or the Distributor at all times. The Software is licensed to you as the end user for evaluation purposes only. You are permitted to make unlimited copies of the Software for your own evaluation and for others' evaluation providing that you copy all files, including the file that contains this Agreement and files that contain other notices that were delivered with the Software. If you copy the Software for another person or organization you are not permitted to make a charge for doing so. You are not permitted to alter any of the conditions listed in this Agreement or imply that you have any right to make alterations. You are not permitted to sell, rent, lease or sublicense the Software. You are not permitted to represent the Owner and/or the Distributor in any manner whatsoever. The Software covered by this Agreement contains valuable trade secrets of the Owner and/or the Distributor. The Software is licensed in object form. You are not permitted to adapt, change, update, modify, translate or enhance the Software in any way. You are not permitted to reverse assemble or reverse compile the object code of the Software in whole or in part. You are not permitted to reverse engineer or create any derivative works based on the Software. You are not permitted to produce any commercial software product that in whole or part performs essentially the same function as the Software. You are not permitted to use the software for any purpose other than evaluation and assessment of suitability and fitness for your purposes. You are not permitted to use any outputs from the software for any business purpose other than to assist with your evaluation of the Software. During your evaluation you agree to promptly notify the Distributor of any failures of the Software, such notifications to include your name and your company name, your contact details (phone, fax, email), the time and date of the failure, the operating system version and Software version and sufficient information for the Distributor to be able to diagnose the cause of the failure. Notification may be via email, fax or phone (in order of preference). Upon completion of your evaluation you agree to: a) Permanently remove the Software from your computer systems and not to retain any copies, and b) Destroy all outputs that were generated by the Software during your evaluation and never attempt to use such outputs for any business purpose. On being requested by the Distributor you agree to furnish to the Distributor a statement certified by an authorised representative of your company stating that your usage of the Software has been reviewed and complies with the terms and conditions of this Agreement. If at any time you are found to have used the Software for business purposes which are other than evaluation purposes the Distributor is entitled to charge you the full current purchase price of the Software in effect at the time and you agree to pay said amount within seven days of the presentation of an invoice. To the best of the Distributor's knowledge full permission of the owner or owners of sublicensed components has been granted and use of sublicensed components in the Software does not infringe any condition imposed by the owner of such sublicensed component. However, the Software is delivered as is. In deciding whether to use the Software you agree and accept that you have used your own skill and judgement. To the full extent permitted by applicable laws neither the Owner nor the Distributor provides any warranty whatsoever regarding non-infringement of third parties, merchantability, performance or behaviour of the Software whether express, implied, statutory or otherwise. Neither the Owner nor the Distributor warrants that the Software is error free or that its use will be uninterrupted. IN NO EVENT WILL THE DISTRIBUTOR BE LIABLE FOR (1) SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES, OR (2) ANY DAMAGES RESULTING FROM USE, LOSS OF USE, LOSS OF DATA, LOSS OF PROFITS OR LOSS OF SAVINGS ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT OR THE USE, LOSS OF USE OR PERFORMANCE OF ANY LICENSED PRODUCT, WHETHER IN AN ACTION BASED ON CONTRACT OR TORT, INCLUDING NEGLIGENCE WHETHER OR NOT THE OWNER OR THE DISTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT WILL THE DISTRIBUTOR'S TOTAL LIABILITY FOR ANY DAMAGES IN ANY ACTION BASED ON CONTRACT OR TORT ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT EXCEED THE TOTAL FEES PAID TO THE DISTRIBUTOR PURSUANT TO THIS AGREEMENT. IN NO EVENT WILL THE DISTRIBUTOR BE LIABLE TO ANY PERSON, FIRM OR CORPORATION THAT IS NOT A PARTY TO THIS AGREEMENT. If a fault is detected in the Software that prevents its use for evaluation purposes by the Licensee then the Distributor's entire liability will be at its sole discretion to replace the Software with another version or to withdraw the Software from use. This Agreement will be governed by the laws of the state of New South Wales, Australia. This agreement will automatically terminate if you fail to comply with any of its terms and conditions. This Agreement covers your use of the Software for evaluation purposes. If you install the Software on any computer you are deemed to have read and understood and accepted all the terms and conditions listed in this Agreement. If you agree to be bound by the terms and conditions listed in the Agreement then you are hereby granted a license to make use of the Software for evaluation purposes. This Agreement is the sole agreement covering the use of the Software and supersedes all previous agreements in whatever form. Copyright 2006 Gresham Computing Pty Ltd Rev 6. November 2006 ======================================================================== 3. Contacting Gresham Computing Pty Ltd ------------------------------------------------------------------------ You can contact Gresham Computing as follows: Email: Tal2c@greshamsoftwarelabs.com Web: http://www.greshamsoftwarelabs.com/ Post: Level 3, 90 Mount St PO Box 6409 North Sydney NSW 2060 Australia Phone: Local, 02 9955 7660; International, +61 2 9955 7660 Fax: Local, 02 9955 7687; International, +61 2 9955 7687 ======================================================================== 4. Change History ------------------------------------------------------------------------ Version 2.9 (Current Release) ------------------------------ Tal2c would abend in some cases of extra white spacing. This is now fixed. Tal2c would not process expressions in FILLER declarations. This is now fixed. Tal2c would not process SG pointers and equivalencing to 'SG'. This is now fixed. In some cases strings used as numbers were not converted properly. This is now fixed. Function $intr was converted to INT macro which does not round the values. New macro INTR has been created in ctal.h to cater for rounding of values. Also, erroneous warnings were output if $intr was applied to a int,fixed,real or real(64) variable. This is now fixed. TAL2C was not converting properly int32 constants which were in boolean representation. This is now fixed. $bitoffset was converted incorrectly to "sizeof". This is now fixed. Warning is now output when using $len on the structures that finish on an odd byte boundary. Tal2c would not consider a $DBLL(string,string) expression as constant and would issue, in some cases, erroneous warnings. Version 2.8 ------------------------------ Address offset calculation with WADDR would produce incorrect result in cases when the result of calculation is assigned or compared with word addressed pointer. New command line switch has been added "--cast_waddr" which fixes this defect. When it's on it casts waddr's to (short *) in specified cases. Currently,default is on. Regardless of the state of the switch: --new warnings are issued, which point out locations of any waddr's involved in arithmetics. --waddr's are no longer cast to (ushort) when involved in arithmetic operations. In some cases of relational operations, missing set of brackets would cause lhs type cast to be applied only to the part of the rhs expression, instead of being applied to the whole expression. This has now been fixed. Tal2c would create a define in C with a null body when the define is used in a deleted code. This has now been fixed. Sometimes a subprocedure would not be within the domain of its' section. This has now been fixed. Specific locations of delete toggles,such as the beginning or the end of the included file, would cause an incorrect deletion of the code. This has now been fixed. Tal2c now generates correct code for address calculation involving $XADR. Tal2c was not producing correct code for equivalencing when a directive was located between the equivalence head and the equivalenced variable. Example: proc m; begin int a := 5; ?source defs int b=a; end; This has now been fixed. Tal2c would sometimes incorrectly convert source and length of move statements. This has now been fixed. Tal2c would trap while converting forward declaration of an entry point of a subprocedure. This has now been fixed. Tal2c would not convert properly embedded defines when comments existed before, after or on the same line as the define's usage. This has now been fixed. In addition placement of comments has been improved. Tal2c would not correctly convert string array initializations with binary 0, followed by an equivalence of the string array. This has now been fixed. Toggled out and not used defines are no longer reported in unused defines report. Tal2c is now able to support $OPTIONAL code. Usage of op_arg's is now limited to only those parameters for which the subproc issued a $PARAM statement. Tal2c would trap while trying to convert small fixed numbers. This has now been fixed.In addition, initialization of fixed numbers, when declared decimal places differ from actual, is working properly now. Tal2c would sometimes cast to a substructure that has no template. This has now been fixed. Tal2c would not convert properly arithmetics with LAND operator. This has now been fixed. Tal2c would sometimes produce unnecessary and erroneous cast in case of initialization of extended arrays. Tal2c would not properly covert arrays with non zero lower bound defined with DDL definitions, This has now been fixed. Tal2c would not cast const arrays passed as arguments to their formal argument types when the const arrays were declared without bounds. This has now been fixed. Additionally ctal.c and ctal.h files have been modified to cater for passing const arrays to scan functions. All scan functions now have a constant first formal argument. Tal2c would not correctly generate a dereference for a pointer inside an array, which was an element of an IF statement.This has now been fixed. TAL2C now casts sizeof to short when it is an operand in a signed arithmetic operation. Tal2c now converts large fixed numbers correctly. Tal2c will now treat several literals in one literal declaration as ENUM and translate them as lower case. This can be switched off by encasing the literal declaration with --~begin_not_enums and --~end_not_enums directives. Tal2c would fail to recognise ".EXT" as a field when used in a structure. This has now been fixed. Tal2c would sometimes miss casting enum true bit expressions. This has now been fixed. (support for working with Toggle 14 or 15) Blocks of code inside the directives --~begin_create_version_procs and --~end_create_version_procs will not be processed except for code within Toggle , where is 14 or 15. (casting TRUE enum bit flags to unsigned) A cast to unsigned short is generated where bit flags are set to enum true. This can be turned off using the "--enum_nocast" option. Alternatively, it can also be toggled off for a specific define by surrounding it with --~% comments. "--unused_defines" switch now actually appears in the list of command line options. Determination of reference parent variables passed to subprocs was incorrect if the variable was a parameter to a system proc with missing optional compound arguments. This has now been fixed. Multiple consecutive BLOCK_MOVE_STR are now concatenated into a single BLOCK_MOVE_STR. Tests for equality that call COMPARE_STR or memcmp would be incorrect for values multiplied by -1. This has now been fixed. Multi-lined define calls would sometimes be missing a right parenthesis. This has now been fixed. Tal2c did not recognize special cases of block move when literals were used. This has now been fixed. Parenthesis were sometimes placed unnecessarily inside a define, thus creating a dynamic define.This is now fixed. Dynamic Defines would sometimes be missing braces and/or a comma, which could cause the converted code not to compile. This is now fixed. Const arrays passed as arguments are now cast to their formal argument types. ?source statements inside subprocs now work properly. $MIN and $MAX are translated correctly for FIXED, REAL and REAL64 numbers. OP_ARG and OP_ARG2 were being used generically instead of only in subprocs and entry points.This is now fixed. OP_ARG and OP_ARG2 now work correctly with cast and pointer arguments. Tal2c sometimes would add an extra right bracket ")" with OP_ARG and OP_ARG2 usage.This is now fixed. OP_ARG and OP_ARG2 are now used with subprocs. Casting of fixed arithmetic variables is now correct. Defines set as --~ used with the "--defclass" switch are now redirected correctly. Unused defines are now only reported if they are never used, rather than if they are not used in the context in which they were included. (unused defines) The new command line switch --unused_defines causes any defines which are unused to be listed at the end of the conversion. This switch can be used without specifying a file name to list the unused defines from earlier conversions (ie. since the last cleanup). Linecount Version 2.6 (Current Release) --------------------------------------- The new command line option -e has been added to linecount. This option causes any files found in Include directories to return a line count of -2. Version 2.7 ------------------------------ Negative integer literals specified in non-decimal notation (e.g. %HF000) would cause problems when the width of a C int is 32 bits. These value of these literals is now cast to short to correct this. Defines incorporating the FOR statement could sometimes be converted incorrectly. This is now fixed. The semicolons after the block move statement in the define inside a case statement was incorrectly included in the define. This is now fixed. The translation of some constructs when using DDL generated was incorrect (e.g. $offset, $occurs). This is now fixed. Defines used as an unlabelled case statement were translated incorrectly (surrounding case, break, semicolon were included). This is now fixed. Formatting of multiple case labels is improved. If a word pointer was converted to string pointer by shifting and then was added to, the added value was incorrectly doubled. This is now fixed. $ABS of a fixed value was being incorrectly scaled. This is now fixed. If file A includes a section in file B and file B includes a section in file C, and this results in a redirected define from file C, and both B and C were specified as dynamic redirection sources, the redirection #include was incorrectly placed in file B. It is now placed in file A, i.e. the nearest file that is not a dynamic redirection source. In some circumstances, the #include for a redirection could specify sections that didn't exist in the output. This is now fixed. Defines set as expand inline (--~@) are no longer treated as new defines for the purpose of redirection. When there is a "-" at the end of a line inside a define statement, sections could sometimes be repeated in the C code. This is now fixed. The "ushort" conflict with Compaq header files is now remedied. You should replace any existing copies of ctal.h with the one from this release. There is now a #pragma list at the end of ctal.h to match the #pragma no list at the beginning. Version 2.6d ------------------------------ Extended arrays are no longer mapped lowmem. Case labels use mb2 instead of ms2. Version 2.6c ------------ In a single folder work environment, where multiple program conversions are done, a later conversion wiped out the work of an earlier translation. This is now fixed. Version 2.6b ------------ Licensing changes. Version 2.6a ------------ The command line options: --redirect_on and --defclass_limited have been added to support redirection of dynamically generated defines. Two new sections in the configuration file have also been added to facilitate this change. They are: dynamic_define_redirection_source and dynamic_define_redirection_target. When using redirection, the following applies: Comments are redirected if the corresponding define is redirected. The defclass label is added to all new defines. Unused defines are not redirected. Dynamic defines that have been generated in a previous pass are not redirected. If any new defines are used when redirecting dynamic defines, TAL2C requires two passes be made. A notice is output on the first pass stating this. When the option --tandem is specified, TAL2C will now generate variable arguments using the Tandem C extensions method. Specifying the --varargs_ansi option will disable this feature. The --varargs_tandem option explicitly requests the new behaviour. The --varargs_tandem option is ignored unless the --tandem option is also present. The OP_ARG and OP_ARG2 macros have been added to ctal.h These are used with the new extensible entry point functions. If a section was sourced multiple times, comments in that section would sometimes be moved to the end of the section. They would also be concatenated to each other causing very long line lengths. This is now fixed. If a structure contained an array and the array was referenced without specifying an element, and the array had a non zero lower bound, then in some cases, the array would not be correctly dereferenced. Files specified in the tal_proc_files section of the configuration file would not be converted as such if they were also included from a directory specified with the -I option on the command line. This is now fixed. The tal_procs and tal_proc_files sections in the configuration file are now case insensitive. In some cases, the struct keyword was not removed from the declaration of ddl generated structures. This is now fixed. The entries in the ddl generated section of the configuration file are no longer case sensitive. When a ddl generated spi string variable was part of an array inside the ddl struct, TAL2C would erroniously include ".byte" in the generated C. This is now fixed. The .defines file stored the paths and name of files used in dynamic defines. This caused problems when using the same .defines file in a different directory. This is now fixed. If there was a structure similar to the following: STRUCT S; BEGIN STRUCT K; BEGIN STRING STR[0:1]; END; END; TAL2C would not recognise that the address of S.K.STR was the same as the address of S.K - This would cause problems with block moves. This is now fixed. More extraneous blank lines have been removed. When a variable was called the same name as a standard C function, the C compiler would not compile that generated C code. This is now fixed. In some cases when an IF-THEN-ELSE expression contained a define, TAL2C would generate incorrect C code. This is now fixed. Version 2.6 ----------- Packaged for general release. Version 2.5c ------------ When a template consisting of a substructure within a substructure was passed as x in $len(x) * $occurs(x), TAL2C produced incorrect code. This is now fixed. Linecount Version 2.5 --------------------------------------- The new command line option -d has been added to linecount. It takes a filename which is used as the database file. Passing lcout as the database file is equivalent to not using this option. Version 2.5b ------------ Assignments in the form: STRING .S[a:b] := [ 0 ]; or STRING .S[a:b] := [ c * [ 0 ]]; were not converting correctly. This is now fixed. When a ddl generated structure was used in another structure, TAL2C would, in some cases, fail recognise spi references. This is now fixed. When a ddl generated spi string variable was referenced with an implied index, TAL2C would omit the required array reference in the generated C. This is now fixed. The -t and -l command line options would cause TAL2C to abend if they were not followed by their expected values. i.e. TAL2C.EXE mytal -t or TAL2C.EXE mytal -l would cause an abend. This is now fixed. In some cases, block moves in the form: x[n + 1] ':=' x[n] FOR l where x was a substructure of a substructure, were not converting correctly. This is now fixed. Files in the ddl_generated section of the configuration file are now case insensitive. Spurious function arguments were generated when a subproc used a variable which was initialised with a ddl map, and which was declared in the parent proc. This is now fixed. In some instances, if a macro was the last token before a new case in a labeled case list, then TAL2C would incorrectly convert the macro. This is now fixed. Some more extraneous blank lines have been removed. Version 2.5a ------------ A warning is now issued if $OCCURS is used in a subproc on an array which is declared in the parent proc, and which uses $LEN of a struct to calculate the array's size. A structure template should be used instead of the structure. TAL2C now understands temporary pointers. The TAL: Unsigned(x) where x is the number of bits, would, in some cases generate incorrect C. This is now fixed. Spurious errors are no longer generated when ? is not followed by anything. For example: ? INT a; Will now convert without errors. This is consistent with the TAL implementation. The ?INVALID_FOR_PTAL pragma is now recognised. The .ctrans file has had the following added to the tal_procs section: readlock cc_status writeupdateunlock cc_status User defined toggles containing the '^' character, were not being converted correctly. The '^' needed to be converted to '_'. This is now fixed. If a structure was declared using a template of the same name For example: STRUCT s ( s ); Then TAL2C would abend. This is now fixed. Version 2.5 ----------- Packaged for general release. ======================================================================== 5. Known Problems Remaining ------------------------------------------------------------------------ 5.1 In some cases it is impossible to correctly convert a TAL define into a C define. A particular case is defining a trailing bit-extraction, e.g. define x = thing.<1>#; which works okay when x is not preceded by an identifier, but fails if it is preceded by an identifier, e.g. z.y.x This is because the generated code includes BE(z.y.thing, 1), where the BE( thing, 1) belongs to the define x, but z.y. does not. It is not possible to define a C #define that can achieve this. However, it may be possible to modify the TAL define to work for both TAL and C, e.g. define x(prefix) = prefix.thing.<1>#; Then use x(z.y) 5.2 Equivalencing from a subproc to a variable declared in the enclosing proc generates incorrect C code. This can be worked around by changing the equivalence to be declared in the enclosing proc. For example: !problem code proc outside; begin int x; subproc inside; begin int a = x; ... !workaround code proc outside; begin int x; int a = x; subproc inside; begin ... 5.3 ?source used inside a procedure can cause code to be misplaced when subprocs are involved and there is no declaration between the ?source and the subproc. In this case, reorganize the TAL source so that a declaration comes after the ?source, or add a dummy declaration there. 5.4 If a TAL comment contains the C comment termination symbol (*/), the resulting C code will contain two of them and have compilation errors. It is recommended that you remove any C comment termination symbols from your TAL comments. 5.5 It is possible in TAL to reassign the address of an indirect array or structure. As TAL2C converts indirect arrays to C arrays and indirect structures to C structures, this operation is not possible in C. However, TAL2C fails to diagnose this situation and generates C code that causes compilation errors. You will need to rework either the original TAL source or the output C source. 5.6 TAL2C does not support using TAL keywords as define arguments. You must change any offending arguments to non-keywords. 5.7 Some versions of the TAL compiler allow you to omit a required comma on a multi-line ?source directive. If your TAL code makes use of this "feature", you must insert the required comma(s). 5.8 An incorrect syntax error is displayed for STACK and STORE statements which have a list of operands. You can safely ignore the error. However, remember that STACK and STORE must be converted by hand. 5.9 Passing define arguments that expand to more than themselves in the corresponding C can cause TAL2C to generate incorrect define code. For example: define compare(f, op) = a.f op b.f for 23 elements#; ... if compare( field, < ) then ... will not convert correctly because the C code requires code to be wrapped around the op. To work around this problem you can use --~@ to expand the macro in the output C code, or rework the C code by hand, or modify the TAL source. For example, the above code could be reworked as define compare_lt(f) = a.f < b.f for 23 elements#; ... if compare_lt(field) then ... Note that the following converts correctly define compare(f, op) = a.f op b.f#; ... if compare( field, < ) then ... if field is a basic type, because the resulting C does not require wrapping. 5.10 Equivalencing different sized variables when one of them is a procedure argument is not supported and produces an error message. A possible workaround is to copy the argument to another variable and equivalence to that. 5.11 The FIELDALIGN keyword is only recognized and not acted upon. If you are compiling the C code on a Tandem and require the fieldalign functionality, you can use the FIELDALIGN pragma on the C compiler run line, or modify the C source. 5.12 TAL2C does not allow any spaces after the percent sign (%) in a numeric literal. It is recommended that you remove any of these spaces from the TAL source. 5.13 TAL2C does not correctly handle the use of $offset in expressions defining an initializer, e.g.: literal len = $offset(structure.elt1) - $offset(structure.elt2); string s[0:len-1] := len * [" "]; The workaround is to evaluate len manually and use it in the initializer, e.g.: literal s[0:len-1] := 8 * [" "]; 5.14 If --all_toggles is used and a ?endif appears at the end of a set of statements in a case, the corresponding #endif in the C will be misplaced. The workaround is to enclosed the statements in a begin/end pair. For example: case i of begin 1 -> call a; ?if 15 call b; ?endif 15 otherwise call c; end; will get the #endif incorrectly placed after the C break statement. Changing the code to: case i of begin 1 -> begin call a; ?if 15 call b; ?endif 15 end; otherwise call c; end; will result in the #endif correctly placed before the C break statement. 5.15 TAL2C does not allow comma separated structure definitions. It is recommended that you replace the comma with a semi-colon and the STRUCT keyword. e.g.: (Unsupported) (Supported) STRUCT STRUCT a; a; BEGIN BEGIN INT z; INT z; END, END; STRUCT b; b; BEGIN BEGIN INT z; INT z; END; END; ============================= END OF FILE ==============================