Re: Source code control & revision numbers
Posted in 1997
Ian Goddard (igoddard@netcomuk.co.uk) wrote: : CHAR filename(60) : LET filename = "$RCSfile: main.4gl,v $" : RCS just looks for the strings and ignores the context. I've seen them : in {} style comments. Putting them into strings has the added advantage : that all that info goes into the binary so that you can inspect the : Does anyone know any trick to manage that with .per/.frm files? Haven't really tried it, but just thinking here... Create a no-entry field somewhere on the screen and enclose what you need to in a COMMENT statement for that field. Of course, if you're showing some sort of delimiter, you'll see something like a "[ ]" on the screen, leaving the users to wonder what it's for. We always use DELIMITERS " ", so it's not really a problem. As far as source code control, we use SCCS. There's a whole variety of variables available. All you have to do is add a statement like: LET inf_variable = "%x%" # where %x% is any SCCS key-word Some of the SCCS numbers get you version date (which can be turned into an Informix DATE variable), time, program name, major version, minor version, etc. Just make sure the variable you're putting it into is a char. Because when it's checked out it'll look like "%x%", which doesn't convert to a date, an integer, etc., only a char/varchar. : > Also, in C language, we have built-in macros like __FILE__ and __LINE__ : > and I'm wondering if we can use these in any way in 4GL? I already have : > tried explicitly using them in a 4GL file and the 4GL preprocessor : > downshifted the symbols, so that they would never have made it to the C : > compiler intact. Even not thinking about the C compiler, it was an : > error; it complains that the variable __file__ has not been defined. : > : > So is this possible any less direct way? (Please don't mention C; this : > must work within the the 4GL source module.) As is shown above, the filename can be automatically set by SCCS (and I assume RCS). As far as I know, line number's not available. At least it isn't in SCCS, maybe in RCS. Couldn't get 4GL to pass __FILE__ and __LINE__ to C in any form that C would recognize. And, even if it did, I'd probably get the C line number, not the original 4GL one. I try to do away with line numbers anyway, because they can vary. What's installed and crashing vs. my latest edits I'm working on can be very confusing when all you have is a line number. I find having a module name, function name, and what it's trying to do when it gets an error is much easier to use. I add a "module scope" variable and call an initialization routine to set it to the current module name (using SCCS keywords). Then, in each function, I set a "function scope" variable to the current function name. If I trap any errors, I can pass the module name and function name and a breif explaination of what I'm trying to do that will help me track down the problem. __________________________________________________________________________ Joel Schumacher JCPenney Co. - UNIX Network Systems jschumac@uns-dv1.jcpenney.com 12700 Park Central Pl (972) 591-7543 Dallas TX 75251