> Being a raw graduate at the time, I didn't take much notice, but I am now
> wondering how that was actually accomplished?
[quoted text clipped - 4 lines]
>
> Can anyone shed some light on this?
m4?
Roy
weasel - 24 May 2007 11:49 GMT
In Queensland (Australia) this was very commonly done.
vi was aliased to a shell script called vi. If you typed
vi file.osq
then the vi script would open a file called file.osq.pp or file.oss.
When you exited this editor, it ran m4 and/or cpp against the file to
expand the macros into ABF code and write this into the .osq file.
this allowed us to write stuff like:
MQTBegin
(sql statement)
MQTCheck
(sql statement)
MQTCheck
MQTEnd
to manage a multi-query transaction with multiple retries, deadlock
handling, etc.
It sure is easier than manually writing the nested loops to achieve
that.
Being able to use #include and #define for constants also helped a lot
>hi all,
>
[quoted text clipped - 4 lines]
>Being a raw graduate at the time, I didn't take much notice, but I am now
>wondering how that was actually accomplished?
One way to do it is to rename $II_SYSTEM/ingres/bin/oslsql to
something like oslsql.real, and make oslsql be a shellscript
that runs the 4GL source code through a macro expander like
cpp or m4. That's brute force, and you need to temporarily
put things back when you apply Ingres upgrades and patches;
but it does work very well. That's how we used to do it
at Telesis, years ago.
Karl
OldSchool - 24 May 2007 20:42 GMT
On May 24, 9:31 am, Karl & Betty Schendel <schen...@kbcomputer.com>
wrote:
>.......expanded out to several lines of common code,
> that would be visible in the final object code.
>
> Being a raw graduate at the time, I didn't take much notice, but I am now
> wondering how that was actually accomplished?
You can also fiddle w/ ING_EDIT. one of the things that can be done
there is to make it a script that runs vi (or whatever) on the source,
and after exitting vi, run the macro processor (or visa-versa). you
might want to take a look at the "osq-debug" tool on the NAIUA web
site as it does something very similar to this in terms of processing.
simonl@unwired.com.au - 30 May 2007 10:39 GMT
A very cool idea, Karl.
Of course, a significantly more cool idea would be to go down the
Transforge path which allows you to use OpenROAD's include scripts.
But I won't get on that hobby horse right now.
> >hi all,
> >
[quoted text clipped - 14 lines]
>
> Karl
Sørensen.Henrik Georg HGS - 01 Jun 2007 08:46 GMT
As Karl has pointed out since the early days on Unix (in our case 6.1 Beta),
We've renamed oslsql to oslsql.real and made a shell-script instead replacing the handling of pre-compiling before calling the original oslsql.
The script could look like this.
#!/bin/sh
#
# OSLSQL February 1992
# UDV_HOME is our own development home-directoru
# UDV_INCL is the main catalog of our own include-files
[ "$UDV_HOME" = "" ] && $II_SYSTEM/ingres/bin/oslsql.real $*
a=${?}
[ "$UDV_HOME" = "" ] && exit $a
TMPFIL=/tmp/IICPP${$}.OSQ
/lib/cpp -P -C -I$UDV_INCL $6 | cat -r | pr -s -t -w16384 > $TMPFIL
set - $1 $2 $3 $4 $5 $TMPFIL $7 $8 $9
$II_SYSTEM/ingres/bin/oslsql.real $*
a=${?}
rm -f $TMPFIL
exit $a
Meaning you in your osq-files can write things like
#define DATETODAYNO((DATEVAR)\
int4(interval('days', DATEVAR - date('1899_12_31')))
update my_table
set dayno = DATETODAYNO(:my_date)
and of couse use #include-files as well
The cat-command with pr my be different on you platform but is meant to remove comments and were more than one "space"-line, and depending on length
Of your defines to make line-shifts.
Kind regards
Henrik Georg Sørensen, Denmark
-----Oprindelig meddelelse-----
Fra: info-ingres-bounces@kettleriverconsulting.com [mailto:info-ingres-bounces@kettleriverconsulting.com] På vegne af simonl@unwired.com.au
Sendt: 30. maj 2007 11:39
Til: info-ingres@kettleriverconsulting.com
Emne: Re: [Info-Ingres] Ingres ABF 4GL macros
A very cool idea, Karl.
Of course, a significantly more cool idea would be to go down the
Transforge path which allows you to use OpenROAD's include scripts.
But I won't get on that hobby horse right now.
Karl & Betty Schendel wrote:
> At 3:38 AM +0000 5/24/07, Paul M. via DBMonster.com wrote:
> >hi all,
[quoted text clipped - 15 lines]
>
> Karl
_______________________________________________
Info-Ingres mailing list
Info-Ingres@kettleriverconsulting.com
http://www.kettleriverconsulting.com/mailman/listinfo/info-ingres