Re: Four easy ones
Posted in 1996
}From: rrela@dc.uba.ar (Ramiro Rela) }Date: Tue, 5 Nov 1996 12:23:16 +0300 (GMT) }X-Informix-List-Id: <list.11971> } }Before I start asking, let me tell you I'm working on I4GL V4.1 under }AIX. Which version 4.1? You have a range of numbers to choose from: 4.10, 4.11, 4.12, 4.13, 4.14, 4.15 and 4.16. And whiuch version of AIX? }FIRST, }I'd like to show some debug messages while running my I4GL programs. I }mean having a window or something with messages of mine scrolling up where }I can read information about program flow and other stuff (like "verbose" }option on some software) } }Am I clear? } }I tried having a window allways opened and make it current when I'd like }to read my messages, but then I can't hide it 'cause I don't know how to }"send it back". Correct; there is no way to change to an arbitrary window unless you know which one is current. To do that, you have to track each window as it is opened and closed or made current, etc. Not easy. }SECOND, }Is there a way to write functions with variable amount of parameters in }I4GL 4.1? } }Example } DEFINE message CHAR(20), totalPrice SMALLINT } } LET message="Some trash..." } CALL PrintAllThisStuff(message, "Hello world!", totalPrice) } CALL PrintAllThisStuff("Blah, blah") } CALL PrintAllThisStuff("OOPS! We've got ", status, " error, babe.") Two parts, at least, and depending on which version of I4GL you've got you may or may not be able to do it without modifying the c4gl script. First of all, the I4GL code has to be compiled with the -z flag to allow the variable argument calls. Early (pre-4.12, or maybe 4.13) versions do not pass the -z flag through to the i4glc1 (fglc, fglc1) compiler and you have to hack the c4gl script to do that if you want to get it to compile. Second part: the function has to be written in C; you can't reliably code the varargs routine in I4GL. And that means that if you are using p-code, you have to be careful with the userfunc structure and the data you use in it. }THIRD, }Given } } BEGIN WORK } LOCK TABLE mytable IN EXCLUSIVE MODE } ... } COMMIT WORK } }Does the last statement shown above unlock mytable? Yes. }FOURTH. }Can I get the current line, current module (current function, am I asking }too much?) that was executing when a run-time error was ocurred? I need }this to be shown by a function (WHENEVER ERROR CALL). Does I4GL include }such debug information into the .4go or .4gi? No to all of these. Internally, I4GL has a limited knowledge of these, but it is impossible to get at the information. The I4GL-RDS system can handle it better (it could provide all of them), but it doesn't because there isn't a practical way to do it in I4GL and the two should behave identically. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>