Re: File/function info
Posted in 1991
Path: emory!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!pyramid!infmx!johnl From: johnl@informix.com (Jonathan Leffler) Newsgroups: comp.databases.informix Message-ID: <1991Nov27.141812.3485@informix.com> Date: 27 Nov 91 14:18:12 GMT References: <1991Nov26.172748.176@wvus.org> Sender: Jonathan Leffler (johnl@informix.com) Organization: Informix Software, Inc. In article <1991Nov26.172748.176@wvus.org> cbruce@wvus.org (Corinne Bruce) writes: >In an attempt to provide consistency throughout our custom applications, we >have chosen to write a separate error processing interface. This interface >is written primarily in C, and is used for applications written in both C and >Informix 4GL. > >Our problem is this: we need to be able to return -- as part of the error >message -- the filename (or, better yet, the function name) in which the >error occurred. In C applications, this isn't a big deal. But, how do we >do this from 4GL programs? As far as we've been able to determine, there isn't >an elegant way to do this from 4GL, and we'd really rather not have to use >additional variables to hard-code this in the error processing function calls. > >Does anyone know if Informix 4GL has a way of doing this? Suggestions for >undocumented features are also welcome, as it appears this application is >being largely built on "undocumented features". Since your using C, you are also probably using compiled I4GL rather than I4GL-RDS. If you're using I4GL-RDS -- abandon hope all ye who enter here! Using compiled I4GL: you can always tweak the c4gl shell script to modify the compilation. Therefore, you could, in principle, hack a copy of c4gl to preprocess the some code/C (using cpp or sed or anything else that comes to hand (Perl?)). Preprocess the I4GL code; using cpp, you could simply write __FILE__ and __LINE__ where you wanted the file name and line number to appear, and you could run the file through CPP before submitting it to fglc. You'd have to use a different source file extension, and you'd have to use -- and {} comments (no # comments). It's not elegant, but it'll work. -- ------------------------------------------------------------------- Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>