E Module Generator by Jesse McClusky (thought@eskimo.com) SUMMARY: This program compiles E Module (.m) files for the Amiga E Compiler, version 2.1b (Copyright by Wouter van Oortmerssen.) Since I don't have a hard drive (yet), and the only Aminet CD-ROM I have is the first one (it came with my CD Drive), that's the only version I've used so far. Therefore, I have no idea if the modules generated by this are evenusable by the newer versions of Amiga E. I do, however, plan on making them compatible as soon as I get either (1) a newer Aminet CD-ROM, or (2) a hard drive. Number 2 should be occuring within a month, so not to worry. (: FORMAT: The file format this program accepts as input is similar in many respects to E code itself, but should be adhered to strictly. I haven't fully tested all possible compinations of invalid syntax, so try not to put much of it in there. However, if you do accidentally do so, and discover that it either crashes or generates incorrect output without warning you, let me know (at the above address, preferably with the code that bombed it). That said, the format for each of the 3 types follows: CONST name=val Creates a constant of the given name with the given value. This is almost exactly like the E keyword of the same spelling. If the name is not capitalized, it will be by the E Module compiler (EM from here on). The val may be any legal constant value as used by the E language (IE, integer, float (4.903), hex ($4fD), binary (%100110), and negative of any of the preceding types). If you wish to specify more than one constant at a time, you may separate them with 1 or more 'space' characters. A 'space' character is defined as any character with an ASCII value of less than 48 (30 hex), excluding the "-" and "." characters (45 and 46, respectively). This includes spaces, commas, linefeeds, carraige returns, tabs, quotes (single AND double), etc. After the space character, simply specify another name=val sequence. You may assign as many constants in a row as you wish. OBJECT objname member1:type ... ENDOBJECT Creates an object of the given name with the listed members. Very similar to the E OBJECT format. (The ... represents zero or more repetitions of the previous line) Members are separated by one or more 'space' characters (see above). The type may be CHAR, INT, LONG or a POSITIVE value which represents the size of a substructure. The value may be of the same format as used for constants (as defined above), provided it is greater than or equal to zero (0). LIBRARY 'libname.library', libbase FuncName(registers) ... ENDLIBRARY Creates a library and base variable of the given name with the functions listed. The function's name should start with a capital and then lowercase letters, and the name should be followed IMMEDIATELY by an open parenthesis "(" or you WILL get an error. The registers should have NO spaces in them, and should be either A0 to A7 or D0 to D7, separated by commas. Functions are separated by one or more space characters, and you may have as many as you wish. NOTE: A LIBRARY should be alone in a module, and belongs in the EMODULES: directory, and not a subdirectory. Also of note is that anything after the ENDLIBRARY will be ignored by both the EM compiler and the Amiga E Compiler. COMMENTS: Comments begin with the "/*" sequence and end with the "*/" sequence. Everything inside will be ignored. However, nested comments won't work because I didn't put in comment counting. I didn't feel it was necissary. If, however, someone really wants me to, I will. USAGE: em source Generates a module named source.m from the file source. MISC STUFF: If you use ShowModule (which comes with Amiga E) and redirect the module's output to a file, you can edit the file and recompile the module. First, you have to: ShowModule >output_file EMODULES:module.m where output_file is the name of the new file to send the module source to. module.m is the path and filename of the original module file. Next, you need to edit the output_file and delete the first three (3) lines. Then, if there are any OBJECT definitions in the file, delete the first 5 characters of each line (the '(---)') in the object. Then save the file and type: em output_file This will generate a file that should be exactly the same as the original '.m' file you got it from. The new file will have the same name as the source output_file, with a '.m' extension. You can use this procedure to modify existing modules, following the formatting guidelines given above. Although, why you'd want to modify perfectly fine existing modules is beyond me. Chances are you'll want to use the EM program to add modules for your own libraries. (: But this is a good test to make sure it works. (: DISCLAIMERS: I hate this stuff. No warrenty is either stated or implied that this program will operate as indicated, or is appropriate for any specific given purpose. The creater of this code is not held responsible for any damages this code incures. This code is Copyrighted (C) 1995 by Jesse McClusky. It may be distributed freely and without charge, and may NOT be modified in any way without the direct written permission of its author. FINALLY: Many thanks to the creator of the Amiga E Compiler, Wouter van Oortmerseen. If you need to contact me, I can be reached at: INTERNET: thought@eskimo.com Snail Mail: Jesse McClusky 13035 110th Ave N.E. Kirkland, WA 98034 USA