#########################################################################
#
# This documents is a scratch pad - things talked about here
# should be moved to manuals, and in some cases are just a bunch of
# interesting ideas, or a reference to some information.
#
# The idea is that developers often won't have time to update 'propper'
# documentation, so it is better to have a place like this where they can
# just 'dump' at least something resembling a usefull thoughts.
#
# As things move from here to manual, they will be deleted here.
#
#
#
#
#########################################################################


Acceptable values of key (in lowercase or uppercase letters) for the ON KEY block are:

ACCEPT HELP NEXT or RETURN or ENTER
DELETE INSERT NEXTPAGE RIGHT
DOWN INTERRUPT PREVIOUS or TAB
ESC or ESCAPE LEFT PREVPAGE UP
F1 through F64
CONTROL-char (except A, D, H, I, J, L, M, R, or X)

==================================================================

copile Aubit programs into 4Js custom C runner to get instant PDF, XML,
Jabber, and RPC support.


====================================================================

1) how do we compile 4glc with no ODBC? Obviouisly, all DEFINE LIKE will
not compile... 4Js uses file to contain database schemma, so they can
compile without database on local system - can be usefull.


=================================================================

find way to embede HTML, like you embede C

=================================================================

Variables for establishing path to find libraryes

AIX 						LIBPATH
HP-UX 						SHLIB_PATH
Solaris and most other
platforms					LD_LIBRARY_PATH
Windows                     PATH

==============================================================

UESQLC - embeded SQL in C under GPL

http://uesqlc.dedalo-ing.com


========================================================================

Use Apache mod_fastcgi to keep Aubit CGI programs running between requests

================================================================

Michael John Kuzminski [mkuzminski@ldcglobal.com] :


Would it be possible to make a request for more character array functions
that would allow you to maniuplate those character arrays? For example, an
"instring" function which would locate the first occurence of a set of
characters? I have developed my own, but I know that this would be
beneficial as part of the language.

btw, here is my code:

FUNCTION instr(start_pos,searched,sought)
    DEFINE start_pos        INTEGER
    DEFINE pos_found        INTEGER
    DEFINE searched         CHAR(512)
    DEFINE sought           CHAR(128)
    DEFINE sought_len       INTEGER
    DEFINE len_start_pos    INTEGER
    DEFINE total_length     INTEGER
    #Description: Function to search for a character or string within
another string
    #Arguments  : start_pos - position in searched to being searching;
typically 1
    #           : searched - the string to be searched
    #           : sought - the string or character you are looking for
    #Returns    : the position where the sought string or character appears
    #           : returns a 0 (zero) if not found,
    #Author     : Michael Kuzminski
    #Date       : 10-4-01
    LET pos_found = 0
    LET sought_len = LENGTH(sought)
    LET len_start_pos = start_pos + LENGTH(sought)-1
    LET total_length = (LENGTH(searched) - LENGTH(sought)+1)

    #Error checking
    IF start_pos > LENGTH(searched) THEN
        ERROR "Function instr: Start position exceeds string length to be
searched!"
        SLEEP 5
    ELSE
        FOR start_pos = start_pos TO total_length
            IF searched[start_pos,len_start_pos] = sought THEN
                LET pos_found = start_pos
                EXIT FOR
            ELSE
                LET len_start_pos = len_start_pos + 1
            END IF
        END FOR
    END IF

RETURN pos_found
END FUNCTION

=================================================================

Move all temporary manual supplements from "docs" on SF to manual

=================================================================


BUGS ?
------

-----------------------------------------------------------

test whenever error in adbload.4gl:

WHENEVER ERROR CONTINIE don't work
whenever error is ignored

> I'm investigating the whenever error problem -
> for now - if you use :
> 	whenever any error continue
> 	whenever sqlerror continue
> 	whenever error continue


> > > Can't remember - I'll put it on my 'todo' list.
> > > I want to change that whole area anyway - its very messy at the

-------------------------------------------------------------

downshift not working

compiler stops after first error, why?

CONNECT can't take variables as parameters.
Theres a bug - it doesn't trim the username and password, so it logs you in
as 'mike         ' rather than 'mike'.


intervals partially implemented and their 'UNITS'.
There is still currently no maths allowed on datetime/intervals. (Ie no "00:03:00" + "00:02:00".)

Its worth bearing in mind that the error numbers and codes in a4gl and i4gl
will be different anyway...

#this works fine
                OPEN SESSION s_id1 TO DATABASE ptest as user "postgres" password "pg"
#this does not:
#				OPEN SESSION s_id1 TO DATABASE DSN_postgres as user "postgres" password "pg"
#this does not compile at all
#				OPEN SESSION s_id1 TO DATABASE _variable(DSN_postgres) as user "postgres" password "pg"


help files: No - it doesn't look for files anywhere but the current directory - this
will need fixing..

aubit programs need to look for .afr not .frm for forms to avoid colision with i4gl
when compiling in same directory

fcompile should produce afr files.

Is this fixed?: Another reason for a core dump on startup is if you haven't set SQLUID and
SQLPWD as environment variables, and you're accessing a database..


=============================================================

add #include - see note about include in amake docs

==============================================================

asql_yacc      ANSI-compliant SQL parser (LEX,YACC,C)
cfuncts        functions for use in 4GL, including a Soundex routine (C)
m4gl           m4 macro to provide define/include for 4GL
myexport       replacements for dbexport and dbimport (KSH,AWK)
sql_yacc       SQL parser (LEX,YACC,C)
sqlfmt         4GL cross-referencing program (C)

=========================================================================


adbload:

"where are you going to get a list of tables from ?"
> If your doing an informix only program - you can rely on using systables. If
> you're doing something more generic - you won't be able to.

PG have systable equivalent (thanks Mr Sonebraker!)

Then again, see SQL_ACCESSIBLE_TABLES at

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcsqlgetinfo.asp

> > Which I don't think you can't do. If ODBC 3.0 can - then fine.
> > But what are the ODBC calls to do it so I can add them..
>
> http://www.dbmsmag.com/9604d53.html
> http://msdn.microsoft.com/library/ (Data access->MDAC->ODBC)


============================================================


On Sat, 21 Jul 2001, Andrej Falout wrote:
>I found several posts where you discussed insert cursors; Quick
>question is: Is there a way to implement Informix insert cursors via
>ODBC (Aubit 4gl) ?

Not that I know of, but that is far from saying that it doesn't exist.

About the only offer I can make is http://www.informix.com/answers

Looking at index in the CLI 2.5 manual, under INSERT, it mentions
SQLParamOptions().  The manual page for SQLParamOptions() mentions 'bulk
inserts'.

------------------------------------------------------


Note that message files are specified in full - no implied extension -
where as form files are not specified in full - the extension is
implied.  Now, you could sensibly ensure that the extension for a
message file is in fact implied for Aubit -- that would be an
improvement.

-------------------------------------------------------

> You could also use this technique to define names such as fgiusr.c vs
> fglExt.c for the p-code runners.  Of course, it would be best if the
> p-code runners didn't have to be recompiled to add extensions; it should
> be able to dynamically load a shared library specified on the command
> line (or maybe in an initialization call made at the start of a program,
> such as:
>
>     CALL a4gl_load_ccode_library("myname.so")
>
> and then collect a well-known symbol from that library which is a
> pointer to the array of structs defining the function names and pointers
> for the I4GL code in the library.  Like Perl, Tcl/Tk, PHP, etc do.  I'm
> not sure whether the function call will work -- it depends on whether
> all symbols have to be resolved before the code starts running (as in
> Classic 4GL p-code) or not (as in Dynamic 4GL).


==================================================================

how to strip executables (and libraries) of any not called functions?

====================================================

Subject: Re: random value with 4GL
From: Scott MacKenzie <scottm@crystal.ncc.cc.nm.us>
Date: Thu, 02 Aug 2001 12:07:32 -0600
Organization: =?iso-8859-1?Q?Din=E9?= College


I dunno, rseed looks like a hash function, not a prng function.

Ronald Cole wrote:
>
> "Andrew Hamm" <ahamm@sanderson.net.au> writes:
> > Danny De Koster wrote in message <9k8snq$1i88$1@rivage.news.be.easynet.net>...
> > >I think that I once read about a function 'random'. I searched overall but
> > >no trace of this function. Did I dream about it of does it exist.
> > >Any information will be nice.
> >
> > Yup - you're dreaming ;-)
> > 4GL does not have a random function, but it would be trivial to link one
> > into the runner. Here's an interface to the standard C rand and srand
> > functions:
>
> I've used this code successfully.  I think I snagged the basic
> algorithm from the C faq.  The trick is finding a good source for the
> initial seed.  Maybe you can adapt one of the 4gl "datetime to
> number-of-seconds-since-midnight-1/1/70" functions posted here recently
> if you're in a pinch...
> -------------------------------------------------------------------------------
> DEFINE
>   rseed INTEGER
>
> FUNCTION seed(s)
>
>   DEFINE
>     s INTEGER
>
>   LET rseed = s
>
> END FUNCTION
>
> FUNCTION rand()
>
>   DEFINE
>     hi INTEGER,
>     lo INTEGER,
>     test INTEGER
>
>   LET hi = rseed / (2147483647 / 48271)
>   LET lo = rseed MOD (2147483647 / 48271)
>   LET test = 48271 * lo - (2147483647 MOD 48271) * hi;
>   IF test > 0 THEN
>     LET rseed = test;
>   ELSE
>     LET rseed = test + 2147483647
>   END IF
>   RETURN rseed / 2147483647
>
> END FUNCTION
>
> --
> Forte International, P.O. Box 1412, Ridgecrest, CA  93556-1412
> Ronald Cole <ronald@forte-intl.com>      Phone: (760) 499-9142
> President, CEO                             Fax: (760) 499-9152
> My GPG fingerprint: C3AF 4BE9 BEA6 F1C2 B084  4A88 8851 E6C8 69E3 B00B

--

   (                                               ______
   ))   .--- Scott MacKenzie;  Dine' College ---.   >===<--.
 C|~~| (>--- Phone/Voice Mail:  520-724-6639 ---<) |   = |-'
  `--'  `- Email:  scottm@crystal.ncc.cc.nm.us -'  `-----'
=============================================================


Things to implement in makefiles:

#foo:= a b c
#bar:= $(subst $(space),$(comma),$(foo))
### bar is now `a,b,c'.

#$(basename names...)

#find_files = $(wildcard $(dir)/*)
#dirs := a b c d
#files := $(foreach dir,$(dirs),$(find_files))

#$(if condition,then-part[,else-part])
===============================================================

see database engine specific funcions from 4Js fgldbutl.4gl
 - how 4Js detects different engines

==================================================================

library collections:

Make it:
4glpc a.4gl b.4gl c.4gl -o intermediate.aox


Use it:
4glpc new.4gl intermediate.aox -o outputfile.4ae


> > Won't this report missing MAIN when linking, since it will try to generate
> > executable, and there will be no MAIN on any of this 4gl files?
> >
>
> Normally the .o on the -o line will suppress the final linking stage...

So I'll need to apply same code used for *.o in 4glpc to *.aox

========================================


> >
> >"order of their appearance in the FORMAT section"
> >
>
> I've put in a fudge for this - it will take the order they are supplied in
> the parameter list if they are not explicitly defined.
> This will allow a compile - but this may not produce the expected results on
> execution.
>
>
> As the object of this exercise was to get it to compile - fixing this can be
> left until afterwards!

==================================================================

what happened to A4GL Wizard and program templates code?
Nothing - they are 'on hold'
Can you please send me that to include in CVS?

=========================================================

missing code and dummy functions:

> > I stuffed dummy functions in builtin.c
> >
> > aclfgl_startlog (char *filename)
> > aclfgl_errorlog (char *string)
> > aclfgl_showhelp (int helpnumber)

Also added Dummy function for DEFER QUIT def_quit()
to lib/fglwrap.c

/// in ERR_GET(status) implemented?????

> >FIXME: <keyword> not coded
> >
>
> There are a few 'exitwith("Not Implemented")'s knocking around for this kind
> of thing - but they are in the library - not in the compiler.
>
> I'll do an audit sometime soon to make sure everything in there outputs
> something (even if it is just a FIXME warning).

==================================================================

Jabber/IksEmEl libs:

/usr/local/include/iksemel.h
/usr/local/lib/libiksemel.la
/usr/local/lib/libiksemel.so
/usr/local/lib/libiksemel.a

ranlib /usr/local/lib/libiksemel.a

ldconfig -n /usr/local/lib

Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

----------------------------------------------------------------------


/usr/local/bin/JabberX
/usr/local/share/JabberX/inprogram.help

  JabberX --help

for command line options.


Configuration:
--------------

JabberX read its configuration from ".JabberXrc" file in your home
directory (you can change this by --config command line argument).
Format of the file is naturally XML. Here is an example:

<JabberX>
<jid>dean@unseen.edu</jid>
<password>bornToRune</password>
<logfile>/home/dean/logs/JabberX.xml</logfile>
</JabberX>

<jid> and <password> tags are evident. All the incoming/outgoing XML
data is stored in <logfile> (useful for debugging). If you left it
empty, logging is disabled.


ldd /usr/local/bin/JabberX
--------------------------
        libnsl.so.1 => /lib/libnsl.so.1 (0x4001a000)
        libdl.so.2 => /lib/libdl.so.2 (0x4002f000)
        libm.so.6 => /lib/libm.so.6 (0x40033000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x4004f000)
        libncurses.so.4 => /usr/lib/libncurses.so.4 (0x4007c000)
        libiksemel.so.0 => /usr/local/lib/libiksemel.so.0 (0x400b9000)
        libc.so.6 => /lib/libc.so.6 (0x400c0000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

=========================================================================

Take a look at ONC_RPC.tgz from Datafocus for nutCracker.

ftp://ftp.datafocus.com/reskit3/libs+utils/RPC/ONC/

They have a source code available for download which is patched to compile
with gcc and MSVC under nutCracker environment.  May be it will help you to
solve the rstat and rstat_svc  issues.

The DCE RPC source code also available from them at:
ftp://ftp.datafocus.com/reskit3/libs+utils/RPC/DCE/

Reagrds
Suhaib

>the new version of Sun RPC 4.0 on
>ftp://ftp.franken.de/pub/win32/develop/gnuwin32/cygwin32/porters/Vinschen_Corinna/B20
>
>named
> sunrpc-4.0.cygwin1.README
> sunrpc-4.0.cygwin1.bin.tar.gz
> sunrpc-4.0.cygwin1.src.tar.gz
>
>contains the missing patch to xdr_float.c for working float
>support in cygwin. Many thanks to
> Rafael Rodriguez Pappalardo <rafapa@simulux.us.es>
>for contributing the patch.
>
>Also in case of xdr_float, send further patches or complaints
>to me, please.
>
>The problem in compiling rstat and rstat_svc isn't solved yet.
>Does anyone have an interest in giving it a try?
>
>Regards,
>Corinna



====================================================================


FIXME: why is this not ASCII grapgics like on Unix?

    Ŀ
                        
        Hello  World    
                        
    


===================================================================

I've now added IN and EXISTS as valid 4GL expressions.
This means you can now :


IF a in (1,2,3) THEN

IF a not in (1,2,3) THEN

IF a in (select tabid from systables) THEN

IF exists (select * from systables where tabid=1)  THEN
IF NOT exists (select * from systables where tabid=1)  THEN

should all now work..

[ For ones using SQL - at the minute - you can't use any variables in the
SQL.. I'll fix this soon.. ]

(Is MATCHES allowed in 4gl ?) MATCHES should already be in there...

IF exists (variable_name )  THEN - is NOT implemented

===================================================================

> >1) "enable" keyword found in tools/test/gui
> >
> >	enable cal
> >	enable  a1,a2,a3,b1,b2,b3,c1,c2,c3
> >
> >	please describe usage for manual
>
> These enable and disable fields in GUI mode (see Plexus manuals -
> its in there)


====================================================================

> >2) .xpm picture format
> >
> >	How is this format generated.
> >	Can we use png, jpg, gif, bmp...?
> .xpm is the X format,
> I think we can use the others - but I need to go back to my GTK-LIST stuff
> to find out how!

--------------------------------------------


> >3) bug: forms using WIDGET="pixmap" core dump is pictures are not found.
>
> I'll investigate..
>

----------------------------------------------

Mark D. Stock wrote:
> Jonathan Leffler wrote:
> > tyson_oswald wrote:
> > > I am trying to connect to an Informix-Turbo 3.1 database from a
> > > Informix Dynamic Server 7x.  Everything seems to work but when I goto
> > > connect to it I get error 408: Invalid message type received from the
> > > sqlexec process.  What does this mean I read in the Informix error
> > > index that it has something to do with the database and the libraries
> > > having trouble communicating.  I also get this error when trying to
> > > connect to the local database.  By the way, I'm new to installing
> > > informix.
> >
> > Where to start?  We're going to need some platform details, and more
> > precise version numbers, probably.  Not being able to connect to the
> > local database means there's a big setup problem of some sort.
> >
> > More seriously, the Turbo 3.1 version has me completely puzzled.
> > Unless my memory is failing me (always a possibility), Turbo was
> > only available in versions 1.10.03x for x in a range of upper-case
> > letters (such as A..M).  It is also very, very obsolete.
>
> I seem to remember working with Turbo 4.00. I think it was this
> version that Plexus added multi-media support to and which Informix
> bought from them and released as OnLine 4.00. But I could be wrong.
> I certainly don't remember version 3.1 either, but that's not to say
> it didn't exist. There were version 3 products around, but most
> seemed to skip from 1.10/2.10 to 4.00 for some reason.
>
> Memories hey? If only we could remember them! :-)

Ancient history remembered through the haze...

In the beginning was C-ISAM, and then the original Informix product,
which reached version 3.30 on Unix, and apparently 3.60 on DOS.  This
product did not use SQL.

Then Informix-SQL 1.10 was released, with no support for NULLs; this
was released in 1985 or early 1986, I believe.

Then Informix-SQL 2.00 and Informix-4GL 1.00 were released in mid-1986;
C-ISAM and ESQL/C had release numbers 3.00, I believe.  This was also
the point at which I started working with Informix products.  My first
task was to learn enough to be able to teach I4GL and ISQL 2.00, only
to find that the machine I was to use for the course had ISQL 1.10
on it (it was a Z8000 box, and the superuser was called zeus, not root).

Then Informix-SQL 2.10 and Informix-4GL 1.10 were released, and I
think this was when I4GL-RDS and I4GL-ID appeared.

Since Informix 3.30 was still relatively recent, the next versions
were called ISQL 2.10.03 and I4GL et al 1.10.03 on Unix to avoid the
ineveitable confusion if it was called Informix SQL 3.00; I believe
the versions were 2.10.06 and 1.10.06 on DOS.  Also, Informix-Turbo
1.10.03 was released, and it was pointed out as a future direction
that SE would be separated from the ISQL and I4GL tools -- until then,
the engine had always been distributed with ISQL, I4GL and I4GL-RDS
(but not ID since you needed RDS to make any use of ID).

To avoid confusion with Informix 3.30, the subsequent release was
version 4.00 of Informix-SE, Informix-OnLine, ISQL and I4GL (and C-ISAM
and ESQL/C) - there was never a 3.x version of the main products
other than (perhaps) C-ISAM and ESQL/C.  It was also at about this
point that the Tools and Servers groups were split apart.

Now, Plexus certainly had a hand in the Turbo to OnLine transition,
but I don't know what versions they used -- they may even have had a
3.1 Turbo product, as the original questioner mentioned it.  I don't
know, and I don't think the original questioner has chimed in again
to help clarify what they've got.  It is safe to assume that any Turbo
product is seriously out of date -- OnLine 5.00 was released effectively
in January 1991 (officially 30th December 1990 or thereabouts), and
there was a version 4.10 between 4.00 and 5.00.

As to the connection question -- the revised opinion is that you should
be able to use a network connection to an I-Net that matches the version
of Turbo.  I'm not wholly sure when I-Net arrived on the scene; I-Star
definitely arrived with 4.00 and OnLine, but I-Net probably pre-dates
that.  However, it is not going to be officially supported, and an
upgrade would be recommended.

--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v0.62 -- see http://www.perl.com/CPAN
#include <disclaimer.h>

===================================================================

I'm just going through this very topic in my text book (Discovering Computers, Shelly
Cashman Series, 2001 edition), and here's how the book classifies the programming
languages:

"1GL - Machine Language

2GL - Assembly Languages

3GL - High-level languages, are machine-independent, use English-like words; require the
program to tell the computer not only WHAT to accomplish, but also HOW, therefore often
called procedural languages; use a compiler or interpreter to translate the source code
into machine language

4GL - use English-like statements; are NON-PROCEDURAL languages. The programmer only
specifies WHAT the program accomplish without explaining HOW. Many 4GLs work in
combination with a database. Example: SQL

5GL, or Natural Languages - do not have to follow a specific set of rules and syntax, like
4GLs. Are often associated with expert systems and AI. Popular in the medical field, but
are not widely used in business applications."

By the way, the book is being very nice to Cobol, and it states that ..."Cobol is one of
the more widely used procedural programming languages for business applications. Although
Cobol programs are often lengthy, their English-like statements make them easy to read,
write, and maintain... The most popular personal computer Cobol program is Micro Focus
Personal Cobol, which supports both procedural and object-oriented programming..."



3GLs are third-generation languages, such as BASIC,
Cobol, or Fortran. They were more advanced than "first
generation" machine languages and second generation
assemblers. 4GLs, originally defined as languages that
could offer a ten-fold (or was it a hundred-fold?)
increase in productivity relative to 3GLs, still exist in
forms such as Progress 4GL, Informix 4GL, Forte 4GL,
Cognos' PowerHouse 4GL, and Information Builders' FOCUS
4GL. More than a decade ago, Japan's MITI launched a 5GL
language project with the goal of embedding AI into
programming, but the effort fizzled.

INFORMIX-4GL: development environment composed by Menus (GUI generator), 
Forms (4GL code generator), ID (debugger), QuickStep (state machine) and a 
set of interfaces with C, Cobol, Adam Fortran.

INFORMIX-OpenCase: software development environment based on ToolBus (a software bus), ToolKit (interface with INFORMIX-4GL) and Encapsulator.

-------------------------------------------------------------------------

At that time, the product had a table-oriented, non-SQL C interface that
used the data dictionary, but otherwise it was like C-ISAM. This was also
in the non-SQL product, though I can't remember if it was in the SQL
product. Clearly, the SQL product needed a pre-compiler based product that
provided all of the SQL syntax and cursors to C programmers. Chris Maloney
and I felt that C was still too low level for most programmers of data
processing applications. We designed Informix-4GL as an elegant
combination of Betty Chang's Perform screen package, Roy's SQL engine,
and Bill's report writer, sewn together with a language that would
provide powerful leverage of the data dictionary. This idea worked very
well, and I am still very proud of that product. It allowed us to
succeed when larger companies like Oracle finally came to the UNIX
market in a serious way in the late 1980s.

http://www.informixhandbook.com/


Chris Maloney and Roger Sippl - co-designed Informix-4GL based on:

Betty Chang - Perform screen package
Roy Harrington - SQL engine (wrote a smaller UNIX clone, Cromix)
Bill Hedge - ACE report writer


Chris Maloney Roger Sippl Betty Chang Roy Harrington Bill Hedge


Maloney created the specification for the Informix flagship product Informix-4GL and led the development team for the Informix database data access system. Later he was responsible for development of Viewpoint, a Windows based tool set for "non-programmers" and directed a 100 person development group responsible for Informix's "shrink wrap" business products. At Pencel, Maloney is responsible for product development.
http://www.pencel.com/company/team.htm


======================================================================

On Friday 23 November 2001 8:25 am, Brett Geer wrote:
> Now, can we call gtk functions directly and imbed the values to call
> the 4gl functions? that'd be real cool.

Of course you can - you've just got to get the GtkObject associated with the
field in question - which can be done using :

	ID_TO_INT( field_name)

eg (and untested).

DEFINE obj integer
LET obj=ID_TO_INT(myfield)
code
gtk_entry_set_text (obj, "Test");
endcode


=======================================================================

menuhandlers - not currently for text mode - when?

Formhandlers and menuhandlers are autonomous units - ie you can have multiple
forms open - multiple menus. This is easy to do in GTK and windows etc -
because they are based on message passing and callbacks. The TUI is not...

It may be possible to have them - but how would you switch between windows ?
Do we assume they have a mouse ?
Do we dump the current TUI - because that works with loops rather than
callbacks..

I don't even think you can use the ncurses form library with callbacks - so
do we rewrite that too ?


It all starts to get very very messy..


--
Mike Aubury



=====================================================================
+ XDP AD32, Developer's Guide
  XDP AD32, Windows 4GL Statements
+ XDP AD32, Windows 4GL Functions
  XDP AD32, Troubleshooting and Error Messages




Formhandler
This section manipulates and exchanges data with a form. Each formhandler
section begins with the statement FORMHANDLER name and ends with the
statement END FORMHANDLER. A formhandler is active as long as its
form is open. Unlike functions, formhandlers cannot have input or return
parameters. For more information on formhandlers, see The Handler
Routines on page 141.

Menuhandler
This section contains Windows 4GL statements that accept input from menus
and programmable keys. Each menuhandler module begins with the
statement MENUHANDLER name and ends with the statement END
MENUHANDLER. A menuhandler is active as long as its menu is
displayed. Unlike functions, menuhandlers cannot have input or return
parameters. For more information on menuhandlers, see The Handler
Routines on page 141.

DDEhandler
This section processes all messages exchanged via a Dynamic Data
Exchange (DDE) between a client application and a server application. There
can only be one DDEhandler in an AD32 application. A DDEhandler routine
begins with the statement DDEHANDLER and ends with the statement END
DDEHANDLER. For more information on DDE, see the Dynamic Data
Exchange chapter starting on page 247.


curr_file_name CHAR(13) Current 4GL file name.
curr_line_no CONST Current 4GL line number; curr_line_no
is actually a CONST, but behaves like a
variable in that the value is equal to the
current line number.
err_file_name CHAR(13) 4GL file name where an error occurred.
err_line_no SMALLINT 4GL line number within the file where
an error occurred.


Use the user interface data types to access objects created or defined in the
UIBuilder.

FORM
A variable with the type FORM identifies a form, as defined in UIBuilder.
The predefined variable curr_form, used only within a formhandler, refers to
the form attached to that formhandler by an OPEN FORM statement.

STATUSBOX
Variables of type STATUSBOX identify a status box, which can be defined
in UIBuilder or Windows 4GL code.



======================================================================

					Perl code version
                    -----------------

1) 	Status
    ------

	The perl stuff is experimental and no where near fully functional - for
	example - I'm still working on getting function calls to work !

2)  Prerequisites
    -------------

	Install Perl (www.perl.org) , and then Swig (http://www.swig.org/)

	you need to compile swig up from source:

    ./configure
    make
    make install

3)  Make aubit 4gl Perl-generating compiler and libraries
    -----------------------------------------------------

	cd $AUBITDIR
	make perl

    this will create $AUBITDIR/bin/4glc_perl compiler, Perl libraries and
	compile up the swig interface and copy it to the right places.

4) Ussage:

	To compile 4gl program to Perl:

	4glc_perl hello.4gl

	This will generate hello.pl, to run

	$ perl hello.pl

    - or -

	$ chmod 777 hello.pl
	$ ./hello.pl







> By what i understand the generation modules (compile_c and compile_perl)
> have the same functions and when we link we define the target language.
>
> This implies that we can only link one generator each time to the parser.

Yes - for now - but I'll be doing a compile_dl eventually which should be
retargetable for those with shared library capabilities (most modern Unix's
and Windows via DLLs)..


---------------------------------------------------------------


18:39:18 root@aptiva /usr/aubit/aubit4glsrc/tools/test# perl test_build.pl
Can't locate aubit4gl.pm in @INC (@INC contains: /usr/lib/perl5/5.00503/i386-lin
ux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux /usr/lib/per
l5/site_perl/5.005 .) at test_build.pl line 2.


FIME:
We need to install aubit4gl.pm in perl modiles directory !


===========================================================


Use code/endcode blocks or shared library calls...
CODE
	call_some_jabber_c_function
ENDCODE

or - wrap that up in 4gl :

FUNCTION call_some_func(...)
code
	call_some_c_func
endcode
END FUNCTION

- compile this '--as-dll'
4glpc --as-dll some_module.4gl -o some_module.so

then use

CALL SHARED "call_some_func" IN "some_module.so" (...) RETURNING ...


[Without really messing with the compiler - it would be hard to implement as
a language construct (as andrejs original shows).]

============================================================

add jabber readme to manual

===========================================================

> To mark a tag you can use:
>   cvs rtag 0_3 : Marks a tag in the repositpry whithout needing for  co.
>   cvs rtag 0_3 -D <DATE> : Marks a tag in the repository in a specific date.
>   cvs tag 0_3 : Mark a tag but you need a co before and then a commit
>
> For the branches, i think that since this is by default a sticky tag you just
> need to create the branches, but im not shure.

==========================================================

Hi Jonathan,

can we continue on the Aubit list, please?

> >"either"? You have more then one?
>
> Of course.

On my... :-)

> I'm only referring to the ones that I've written.  I'm not
> counting Dave Snyder's version (db4glgen, available at the IIUG -- I'm
> sorry, I didn't mean to swear at you),

:-O

Can you please compare it with other 4gl code generators you know about?

> or the never-published M4-based
> system (igen) written by Informix staff in their spare time that I have
> copies of.

Hmm, M4 is good, is it not? Can we take a look at this too?

> And then there's Fourgen, and ...

Ahhh, and New Zealand's own, 5GL...

> >Of course they would be of interest!  How come I never heard anything
> >about them?  Where are you hiding them?
>
> I've not made them all that generally available previously.
> They're hiding on my computers, very dormant for the most part.

This is about to change. Oh, I love this...

> >OK, can you please explain what's on offer, if you have documentation,
> >and send it to me....
>
> Two possible products:
>
>     FGLBLD - Program to generate Perform-like programs with good
>              extensibility.  I've used this for real on some fairly
>              serious systems, and it helped me churn out a lot of code
>              very quickly.  It uses I4GL to collect the information and
>              some shell/sed scripts to generate the code.
>
>     FGLGEN - Meant to be the next generation of FGLBLD, with a little
>              language to describe what you want built and a system of
>              template files (and immense configurability) to outline the
>              code.  I've used it a bit; it works OK.  But it was
>              intended to do more complex things such as handle
>              master/detail forms or multi-screen input, and I didn't get
>              around to building enough intelligence into it before
>              moving to the USA, and I've done essentially nothing to it
>              since then.

Ok; so if I'm reading this correctly, BLD thing is good to be used as is, to quickly get Perform like functionality, with very little coding.

GEN thing is supposed to be much more, but needs more work, will require more coding to get results, but it will be much more powerful.

If this is correct, I would like them both in Aubit, since they cover two related, but ultimately different tasks.

BLD would probably make a nice extension to adbaccess code we already have in CVS, approaching "isql" functionality.

GEN would probably be a standalone tool, when it's finished, possibly integrated into your IDE code.

How does that sound?


> I've attached the documentation I have.  The FGLBLD stuff is based on
> troff and was last modified in 1990 - I told you these have been
> dormant!  Some of the files have .doc extensions; although MS Word
> probably did exist back then, it didn't as far as I was concerned.

Ok, I converted fglbld.big to PS/PDF/text - html don't work for some reason

16:23:19 root@aptiva /usr/aubit/fglcodegen/BLDManual# groff -Thtml fglbld.big
groff: can't find `DESC' file
groff:fatal error: invalid device `html'

All is in fglbld.big, right? All formatting lost unfortunately. See attached.

If you can confirm this is all, I can reformat it in HTML manually.

> The FGLGEN documentation is plain text, despite having similar *.doc
> file names.  Once upon a time, they would have been converted to troff.
> Nowadays, I'm not sure what I'd use - HTML or XML/DocBook probably.  I

If it's OK with you, I can translate them to HTML fairly quickly.

> did some work on fglgen back in 1998, but didn't get around to
> completing the conversion to use ANSI prototypes, for example.  The
> previous changes were circa 1992 or 1993.  When I was first developing
> it, the ANSI compilers were only just starting to be available, and
> portable code certainly did not use prototypes unconditionally.  So,
> again, you can see that this has been dormant for a long time, and
> that's why you've not heard about them before.

Must say, looks impressive to me. I expect we will have no problem generating sufficient interest to get the work needed started.

> >Then again, you have Aubit CVS account, so feel free to pump it in - if
> >you prefer.
>
> For the time being, let's see if you can make head or tail of it and
> whether it is worth putting into Aubit4GL.

I would say, this is exactly what I was looking for. Initially we should give it new CVS branch, like :

aubit4glsrc
aubit4gldoc
aubit4glwww
hy4gl
fgldocgen		- Sergio's tools
fgllib		- Starting with Power-4gl
..
fglgen/fglgen
fglgen/fglbld

But ultimately, I would like to see fglbld in adbaccess, or at least for this to be an option, and fglgen integrated in your IDE, or some other IDE, or at least for this to be an option.

BTW: I'm looking at NetBeans IDE (written in Java, but supports different languages) and "Source Navigator" (RedHat-ex. Cygnus). CodeCrusader is no longer OpenSource. I'm looking for IDE that is OpenSource, GPL, multiplatform, and have ability to be extended into supporting 4gl. Ideas?

I'm using GWD text processor, and I built in most of the functions of IDE in it using scripting inside it (ANSII C), but this is shareware, and not multiplatform (OK, I run it on Linux under Wine, but this is not what I want)


> If you need me to fix up the
> FGLBLD documents into postscript, then tell me -- I do have GNU troff
> around and I think I can get it to work OK.

If mine is not OK, please do. Especially if you can do -Thtml

Will you be sending me code for import, or do you want to do it yourself?

Thanks again,
Andrej

===========================================================

project.c


> >
> >I just want to tell some more things about-it (questions and remarks):
> >  - How it works the mechanism that fills this ? Its automatic ?

>
> Documentary only?  Or maybe there is an option somewhere that dumps the
> array to stdout.

4glc -vfull

========================================================================

HTML Application (HTA).

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/hta/overview/htaoverview.asp



<HTML>
<HEAD>
   <HTA:APPLICATION ID="oHTA"
    APPLICATIONNAME="myApp"
   >
   <SCRIPT>
      alert("commandLine    = " + oHTA.commandLine);
   </SCRIPT>
</HEAD>
<BODY SCROLL="no">

</BODY>
</HTML>




<IFRAME SRC="filename.htm" APPLICATION="yes">



<FRAME FRAMEBORDER=0 SCROLLING=NO SRC="sample.htm">


==============================================

add pragma: no-cache

=============================================

>
> decompile : decompile.c form_x_xdr.c dump_java.c
> 	cc decompile.c form_x_xdr.c dump_java.c -o decompile
> 	cp decompile ../../bin
>

Its missing because its very incomplete...

decompile should just use dump.c rather that dump_java.c...

fcompile and mcompile both compile source files to an XDR format file (hence
the .x).
For each - I've included a 'decompiler' which decode the XDR format file into
english (ish).

the dump_java.c was an attempt to decode the XDE format file into a java
class - I haven't  got past the first few lines yet..

--

======================================================================

Aubit compiler now by default compiles with dynamic SQL support.

This means that just by changing a value of A4GL_SQLTYPE environment variable,
you can decide at run-time which SQL libraries compiler and/or your programs will use.

At the moment, there are "noodbc" "iodbc" and "unixodbc" dynamic SQL libraries 
available; naturally, on Windows, you only have the choice of "noodbc" and "odbc32", 
but since Windows OS always have ODBC manager, this is down to "odbc32".

I see Mike already added new directory called "esqlc" - for native Informix support.

David, since you implemented PostgreSQL native support in your Hy4GL, is there 
any code there we can use, and would you possibly be interested in implementing 
this for Aubit compiler?

Since UI support is already dynamically loaded (?), I suspect Mike's next target
will be dynamic loading of language output modules in compiler (C, Perl, Java...)

Consequence of this, will be that I will reduce number of binary builds from 8 to 4:

unixodbc-gtk-nopdf iodbc-gtk-nopdf unixodbc-nogtk-nopdf iodbc-nogtk-nopdf
unixodbc-gtk-pdf unixodbc-nogtk-pdf iodbc-gtk-pdf iodbc-nogtk-pdf

to

gtk-nopdf nogtk-nopdf gtk-pdf nogtk-pdf

I can see no particular reason other then the size of the download, to separate 
GTK and noGTK builds, since if you don't have GTK libs installed, you can always 
use AUBITGUI=text. If this is correct, I can as well go down only to:

aubit-nopdf aubit-pdf

Then again, it is still not clear to me why do we have PDFlib linked in 4glc and 
all libraries. Mike, if this can also be loaded dynamically, we can go down to 
one binary distribution.

There is libpdf-dummy.c in tools/html, can we do the same thing as we did with 
noodbc.c ?

Configuration:
--------------

There is a new variable in "aubitenv":

############
#name of SQL library to use (defaults to nosql = libSQL_nosql.so)
#when compiler was build with dynamic SQL support
#Options: static nosql iodbc unixodbc
export A4GL_SQLTYPE=unixodbc


To compile compiler with dynamic SQL support, there are a few new variables in aubitbuild.mk

#defines how will SQL support be built into compiler: dynamic is default.
#if you enter "static", only SQL/ODBC library defined with "ODBC"
#parameter will be linked. Parameters "ODBC"
ODBC_LINK=dynamic

#If linking SQL support dynamically, you can have more then one SQL
#manager/driver installed on your system, and compiled Aubit to use them
#selecting it at run time with environment variable :
#A4GL_SQLTYPE=libSQL_<name>.so [name of library to use (defaults to nosql)]
#if you define more then one HAVE_xxxx variable here as "yes" you MUST use
#AUBITBUILDMKMULTI to define multiple libraries paths
HAVE_UNIXODBC=yes
HAVE_IODBC=yes

To accommodate the fact that now we need to know multiple library names and paths at the same build time, aubitbuild-muli.mk was changed.

For examples of all this configuration changes, please see *.example files in $AUBITDIR/etc

How does this impact you?

1) If you don't want to use dynamic SQL support loading, add ODBC_LINK=static to aubitbuild.mk, and all will (should!) be the same.

2) If you want to use it, add appropriate settings, "make cleanall" and then "make", and all should work now with dynamic loading.

Let us know if you have problems,

Yours, Andrej Falout, http://www.falout.com/disclaimer.html
Visit the OpenSource alternative, Aubit 4gl: http://aubit4gl.sourceforge.net
PLEASE NOTE: All HTML email sent to me WILL BE DELETED AUTOMATICALLY WITHOUT READING.

==================================================================


Andrej Falout wrote:

BTW, can anyone advise me on how a "proper" release should be created,CVS-wise ?release tags, branches, etc. I would like to be able to pull from CVSsource that was used to compile specific release version, if not buildtoo...
To mark a tag you can use:  cvs rtag 0_3 : Marks a tag in the repositpry whithout needing for  co.  cvs rtag 0_3 -D <DATE> : Marks a tag in the repository in a specific date.  cvs tag 0_3 : Mark a tag but you need a co before and then a commitFor the branches, i think that since this is by default a sticky tag you justneed to create the branches, but im not shure.
Thanks Sergio,I was hoping someone have some link to FAQ or something that explains proper version management on higher level. I doknow how to read manual, and execute commands, but I don't really have understanding of why, in which order, how to usetags once they are applied, what files they are applied to, etc.For instance, if I want to be able to pull a specific version of Aubit code from CVS, what do I do:a) to mark all files as belonging to specific version/buildb) to checkout this from CVS?

http://cvsbook.red-bean.com/


=====================================================================

I've just changed some of the PDF handing.

It now used A4GL_PDFTYPE to determine which library to link with when using
4glpc - there was no need to actually use DL linking for the PDFs.
You need to 'make' in the lib/libpdf directory..

make libPDF_NOPDF.so

or

make libPDF_PDF.so

a 'make' on its own will try to compile both...



A4GL_PDFTYPE defaults to NOPDF, you need to set this to PDF if you want to
use PDF reports...


(If you want to make this the default - you could modify the line in
lib/resources.c - possibly using #ifdef ... etc.)

============================================================

TODO : how can I automatically create list of changes from CVS logs?

=============================================================
I've made a couple of changes today (and fixed a couple of new bugs)

1) Resources
You can now have resources stored in files
Each line must be
VARIABLE=VALUE
with NO SPACES around the '='
(Use a # as a comment)

EG.

MYVAR=1 #Set Myvar=1
DBDATE=dmy4/
.
.
.


These are added as user resources (can be overridden by environment variables
though).

Resource are looked for in
1) /etc/aubitrc,
2) $AUBITDIR/etc/aubitrc,
3) ./.aubitrc (notice the '.' at the beginning of this one)
4) $A4GL_INIFILE

If more than one of these exist - entries are overwitten in the order given
above..
(eg /etc/aubitrc says DBDATE=dmy2, ./.aubitrc says DBDATE=dmy4 , DBDATE will
be read as dmy4)



2)
I've also added a aubit-config.c to lib/ which gets compiled up with
resource.c to form the "aubit-config" program

$ aubit-config DBDATE
dmy4/

This should be the first thing made and can then be used for the makefiles
where required..


3) Made a couple of changes to SHARED handling - removed the old method
(which looked bad) and introduced the "::" syntax as per perl (as someone
here suggested a while ago)

So I've added a new library in lib/extra_libs/file for file handling as an
example.

Try the 'file.4gl' example in tools/test...
Snippet :

        CALL A4GL_file::fopen("tmyextfile","r") returning afile

        IF afile=0 THEN
                ERROR "Unable to open a file called 'textfile'"
                        WAIT FOR KEY
                EXIT PROGRAM
        END IF

        DISPLAY "afile=",afile

        LET status=0
        CALL A4GL_file::fsize(afile) returning fsize

        IF status!=0 THEN
                DISPLAY "ERROR : ",A4GL_file::ferror(afile);
        END IF

        DISPLAY "Size=",fsize
        WHILE TRUE
                CALL A4GL_file::fgets(afile) returning buff
                IF A4GL_file::feof(afile) THEN
                        EXIT WHILE
                END IF
                DISPLAY "Read '",buff clipped,"' from file"
        END WHILE

-----------------------------------------------------------------------

*		Added an 'fshow' and 'fshow-gtk' utility which previews how a form will look

----------------------------------------------------------------

Mike,

1) can we prevent it from code dumping, and rise the error when DATABSE is found in prepare?

2) Any other statemnts affected, other then DATABASE?


>BTW - I don't get a core dump - I get
>
>Program stopped at 'prepdb.4gl', line number 5.
>Error status number -759.
>[unixODBC][OpenLink][ODBC][Informix Server]Cannot use database commands in an
>explicit database connection. (-759).

At least CREATE DATABASE, ROLLFORWARD DATABASE, START DATABASE, CLOSE
DATABASE, DROP DATABASE are also affected by that error.

If you do CONNECT TO '@server' then you can issue database commands.

Don't forget that DATABASE x and DATABASE :var and so on can be prepared
in I4GL, and - further - often are used.  Especially with retargetable
programs that can connect to arbitrary databases.



-----Original Message-----
From: nobody [mailto:nobody@sourceforge.net]On Behalf Of
noreply@sourceforge.net
Sent: Monday, 14 January 2002 05:37
To: noreply@sourceforge.net
Subject: [ aubit4gl-Bugs-464256 ] Valid prepared DATABASE stmt core
dumps


Bugs item #464256, was opened at 2001-09-23 20:16
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=405150&aid=464256&group_id=32409

Category: CoreDump
Group: Current CVS
>Status: Closed
>Resolution: Accepted
Priority: 9
Submitted By: Andrej Falout (afalout)
Assigned to: Mike Aubury (mikeaubury)
Summary: Valid prepared DATABASE stmt core dumps

Initial Comment:
main

define m_text, m_database char (20)


error "start"

let m_database = "maindb"

   WHENEVER ANY ERROR CONTINUE            -- GPA added

following test to figure

error "a2"

   LET m_text = "DATABASE ",m_database    -- out with

to use argval(1) as dbase

error "a3"

error m_text

   PREPARE test_database FROM m_text      -- or as

table for $E4GLDBNAME

error "a4"

   EXECUTE test_database

error "a5"

   WHENEVER ANY ERROR STOP

error "end"
end main



>Comment By: Mike Aubury (mikeaubury)
Date: 2002-01-13 08:37

Message:
Logged In: YES
user_id=285622

This is a known deficiency of using Aubit4GL - the SQL is

passed to the backend, not processed by 4GL.

4GL is the bit that understands how to connect to an ODBC

database.



As the database command accepts a variable, a suitable

workaround would be



DEFINE m_database CHAR(20)

.

.

LET m_database="maindb"

DATABASE m_database







This is not a bug - its a feature of how a4gl works.



For example - you wouldn't expect an Informix database to

accept a

'Database dbname' where dbname was a mysql database now

would you ?

----------------------------------------------------------------------

Hi *,

> All environment variables

...or other configuration variables/definitions, not nececaly coming from 
environment, but from configuration files like like aubitrc..

> will be check for A4GL_oldname - if thats found,
> its used. If its not - then it will work as before, eg
>
> $ A4GL_DBPATH=/home/aubit4gl
> $ export A4GL_DBPATH
> $ DBPATH=/home/informix
> $ export DBPATH
>
> would use /home/aubit4gl, but if you didn't set the A4GL_DBPATH - it would be
> /home/informix...

Sound good to me.

1) We should later remove checking for non-prefixed variables, maybe at 0.40 ?

2) I will modify aubitrc file to define everything with A4GL_ prefix.


-----------------------------------------------------------------------


> These are combined together into aclocal.m4 by aclocal.  I also have a
> simple shell script that automatically generates the configure files
> from a virgin source directory.  I call it acsetup.sh; I've also seen it
> called bootstrap.
>
>     :       "@(#)$Id: manaual_to-do.txt,v 1.34 2004/11/26 11:43:49 mikeaubury Exp $"
>     #
>     # Steps required to AutoConfigure SQLCMD
>     #
>     # Assumes MAKE is cognizant of RCS files.
>
>     CONFIG_FILES1="acconfig.h configure.in Makefile.in"
>     CONFIG_FILES2="actimer.m4 acdevstd.m4 acinformix.m4"
>     CONFIG_FILES3="install-sh acsetup.sh"
>
>     CONFIG_FILES="$CONFIG_FILES1 $CONFIG_FILES2 $CONFIG_FILES3"
>     ${MAKE:-make} -s -f /dev/null $CONFIG_FILES
>
>     rm -f aclocal.m4
>     aclocal -I .
>     autoheader
>     autoconf



I'll leave only "configure" in root; I'll move enverything in etc/config, and create a bootstrap script. Developers will use it. Users will not.

After I release 0.30 - I'm a little sick of delaying it more for whatever reasons. I need to make RPM and fow windows port - that's it.


> If you've not seen the "GNU Autoconf, Automake, and Libtool" book from
> New Riders (http://www.newriders.com/), it would be worth trying to get
> hold of a copy.  In chapter 7 (p70), they discuss a bootstrap script,
> with more details in chapter 8.  My revised code is pretty similar to
> what they do -- but not identical since they are using automake and I'm
> not directly doing so.



==============================================================

It may be useful - but dont forget - we have 'constants' now which do the
bulk of the #define's work...

DEFINE gc_arr_max CONST 100
DEFINE my_Arr ARRAY[gc_arr_max] OF ...
.
.
FOR a=1 TO gc_arr_max
  LET my_Arr[a]=..
END FOR

etc.

The bulk of the '#INCLUDE' functionality is
1) To set up constants (#defines)
2) To set up names for structures

As we don't have named structures this is a non-issue
For the constants defined in the #included file- we can use GLOBALS files
instead :

fseek.4gl:

GLOBALS
DEFINE
     gc_seek_set CONST 0,
     gc_seek_cur CONST 1,
     gc_seek_end CONST 2
END GLOBALS


myfile.4gl:

GLOBALS "fseek.4gl"

MAIN
   CALL fseek(somefile,gc_seek_set)
END MAIN

> I've explained how you can used
> DEFINE .. CONSTANT ..
> which replaces #define
>
> If you want #include you can use 'globals' for the #defines, and one of the
> database options for defining records thats been posted.
>
> If you want #ifdef - use #ifdef !
> code
> #ifdef SOMEDEF
> endcode
>
> which will work for most things


-----------------------------------------------------------------


About RPM package:
------------------

RPM installation includes automatic running of configure script, so only thing you need to do is:

	rpm -i aubit4gl-<version>-1.i586.rpm

You can of course use GUI RPM clients instead, but at this stage I don't recommend this, because if anything goes wrong,
you will not be able to see any messages, only that it failed. So please use command line rpm for now, so you can report
any potential problems.

There are still some problems with configure in binary tree, for example:

	checking for gcc... gcc
	checking whether we are using the GNU C compiler... no
	checking whether gcc accepts -g... no
	...

You can ignore this; it's not really relevant to binary builds at the moment, so go ahead and install it. Extensions
used by Aubit compiler (ODBC managers, GTK+ GUI libraries, PDF library, etc...), everything installed in standard paths,
that is relevant for binary distro should be detected automatically.

Since you cannot pass flags to RPM that would be passed to configure, things that require command line options (usually
because they are installed in non-standard locations) to "configure", like "--with-xxx=<path>" will of course NOT be
detected, and you will have to run "make CPARAM=--with-xxx=<path>" after RPM finishes to detect that things and create
new aubitrc configuration file - if you want. You can of course also manually edit aubitrc if you prefer.

Another way around this limitation of RPM is to create a file called "aubitconf" and place it somewhere in the path.
Make sure it will be in the $PATH when you run "rpm -i". In it, put only one line, for example:

./configure --with-something=/path/to/something --with-anotherthing=/another/path ...etc...


what will happen, is that if configure finds "aubitconf" in path, it will run it, instead of "normal" configure you
initially invoked:

For instance, on my system this will look like this:

====================================================================
[root@aptiva aubit4gl]# configure
checking for aubitconf... /bin/custom/aubitconf
Note: 'aubitconf' script found; running 'configure' via 'aubitconf'...

WARNING: if you provided command line options to 'configure', they will
be ignored, and ones provided in 'aubitconf' used instead. Use
--disable-aubitconf to disable this behavior.

Running ./configure with options:
--with-www-name=www.falout.com --with-dot=/mnt/disk2/data2/install_sources/doxygen/gv1.7c/bin --with-iksemel=/mnt/disk2/
usr/local --with-pdf=/mnt/disk2/usr/local --with-iodbc=/mnt/disk2/opt/iODBC_3beta/iODBC --with-informix --with-pgsql
checking for aubitconf... /bin/custom/aubitconf
Configuring binary distribution
checking build system type... i586-pc-linux-gnu
...etc...
====================================================================

Same thing will happen no matter how "configure" is invoked, for both source code and binary distributions. This is also
a very practical solution for not having to type all switches you need over and over again. Just create aubitconf for
your system, put it in, say, /usr/bin, and you will always get configure using them.

I was trying to be very conservative with "requires", so this RPM should work on all GLIBC 2.2/x systems. OTOH, I
probably missed some dependencies, since I had to disable automatic detection built in RPM, since it would declare ALL
Aubit compiler options as mandatory.

This RPM will require fairly recent version of RPM to work. I'm not sure which version is needed exactly, but you will
get a message to this effect if you need to upgrade RPM. Please let me know which version of RPM where you on, if this
happens.


---------------------------------------------------------------------


> 2) new file: dumpvars.out ?
>
> what should I put in manual about it? This one is now apparently created
> even when DEBUG is not set at all, how do I stop it from being generated on
> every 4gl file compile?

Line 839 in compilers/4glc/mod.c - commented out now...

_________________________________________________________________


> > 2)
> > I've also added a aubit-config.c to lib/ which gets compiled up with
> > resource.c to form the "aubit-config" program
> >
> > $ aubit-config DBDATE
> > dmy4/
> >
> > This should be the first thing made and can then be used for the
> > makefiles where required..
>


> 14) Is there a way to list all variables in user/default resources, as they
> would be returned by acl_getenv (if they are not overwritten from
> environment) ?

There is now :

$ aubit-config -a




------------------------------------------------------------------


> 9) When you say "old method", what exactly do you menan, since I need to
> remove from manual?

CALL SHARED function IN library (...)


---------------------------------------------------------------



>
> 11) Can you please explain
>
> 	IMPORT FUNCTION ferror(1)
>
All right.
Its a quick way of being able to call a simple C function.
A simple C function is one that accepts a series of 'int' sized arguments
(pointers are normally int sized - but doubles arn't), and returns a single
'int' sized argument.

For example :
	strcmp(a,b) is fine
	pow(x,y) is not (as x and y are both double)

To import strcmp this into 4gl you could :

FUNCTION strcmp(a,b)
DEFINE a,b CHAR(256)
DEFINE r INTEGER
code
r=strcmp(a,b);
endcode
RETURN r
END FUNCTION

But if you've got a few of these - its a little long winded - so the IMPORT
FUNCTION command does it for you (it will generate this function
automatically)

You need to specify the number of arguments so :

IMPORT FUNCTION strcmp(2)

----------------------------------------

I wrote this 4gltags program this morning so it's not fully tested yet,
but it seems to work fine.  It's written using flex (fast lex).  If you
don't have flex you can download the source from ftp.gnu.org/gnu/flex

This is analagous to ctags, but for 4gl source.  Below is a shell archive
containing the source and the makefile.  Move to a file and execute
sh 4gltags.shar

Let me know if there are issues.

travish@etcscan.com

--- cut here ---
:	"@(#)unshark.sh	0.2"
#
#	Created by:	travish@etcscan.com
#	On:		Thu May  6 13:57:47 PDT 1999
#	Contents:	an unknown package
#
#	This shell script will install several files (and possibly
#	directories) in your hard drive.
#	It is suggested that it be run from an empty subdir, since
#	failing to do so might result in partial file installation
#	and / or disk cluttering.
#	Be aware that its use and that of its contents may have
#	limitations as set forth in the welcome screen and the archive
#	contents itself.
#	Possible switches:
#
#	-n	doesn't check for file presence
#	-q	for (almost) quiet operation
#
#	Files in this archive:
#
#	4gltags.l
#	4gltags.makefile
#
#	Here's all the shell utilities usage that might cause problems.
#	Edit appropriately if you are stuck.
#
AWK=${AWK:-awk}

filesize()
{
    ls -l $1 | $AWK '{print $5}'
}

PG=`find /bin /usr/bin /usr/lbin -name pg -print`
if [ -z "$PG" ]
then
    PG=more
fi
#
#	get parms
#
QUIET=false
NOCHECK=false
while [ $# -ne 0 ]
do
    case $1 in
	-n)
	    NOCHECK=true
	    ;;
	-q)
	    QUIET=true
	    ;;
	*)
	    echo Usage: $0 [-c] [-q]
	    exit 1
	    ;;
    esac
    shift
done
#
#  display welcome text - it may not fit on the screen, so we need a
paginator
#
tput clear
$PG <<'EOF-entry'

	This shell script will install an unknown package
	If you are not running it from a suitable directory
	hit <DEL> now to abort installation

EOF-entry
#
# more does not wait for a key while displaying last screen
#
if [ $PG = more ]
then
    read a
    unset a
fi
#
# create directories as needed
#
#
#  begin 4gltags.l
#
if [ -f 4gltags.l -a $NOCHECK != true ]
then
    echo $0: 4gltags.l already exists
else
    if [ $QUIET != true ]
    then
        echo 4gltags.l \(5400 characters\)
    fi
    cat >4gltags.l <<'EOF-4gltags.l'
/*---
 * An Informix 4gl source tags file generator.
 *
 * Uses flex (fast lex)
 *
 * To create useable compiler droppings:
 *
 *    1.  flex -i -Cfe 4gltags.l                             -- creates
lex.yy.c
 *    2.  cc -o 4gltags lex.yy.c                             -- creates
4gltags binary
 * or
 *    1.  make -f /source/installed/4gltags.makefile         -- creates
4gltags binary
 *
 *
 * Travis Hume  (travish@etcscan.com)
 * Thu May  6 13:54:40 PDT 1999
 *
 *---
 *
 * Modification History
 *
 * 05/06/99  tjh  Initial release.
 *
 *---
 */

%{
   #include <limits.h>
%}

   struct tagLine
   {
      char*  tagName;
      char*  fileName;
      char*  line;
   };
   struct tagLine *tags;

   char  *curFileName;
   int   numTags = 0;
   short tagSQL  = TRUE;


WS            [ \t\v]
ID            [a-z][a-z0-9_]*

TAGGABLE      ^{WS}*function{WS}+{ID}.*$
TAGGABLE_SQL  ^{WS}*(declare|prepare){WS}+{ID}.*$


%x COMMENT
%s DO_SQL


%%


   if(tagSQL)
      BEGIN(DO_SQL);


{TAGGABLE}   {

   char* yycopy    = (char*) strdup( yytext);
   char* delimiter = " \t(";

   if((numTags % 100) == 0)
      tags = (struct tagLine*) realloc( tags, sizeof( struct
tagLine)*(numTags+100));

   strtok( yycopy, delimiter);

   tags[numTags].tagName  = (char*) strdup( strtok( NULL, delimiter));
   tags[numTags].fileName = (char*) strdup( curFileName);
   tags[numTags].line     = (char*) strdup( yytext);

   ++numTags;

   free( yycopy);
}


<DO_SQL>{TAGGABLE_SQL}   {

   char* yycopy    = (char*) strdup( yytext);
   char* delimiter = " \t(";

   if((numTags % 100) == 0)
      tags = (struct tagLine*) realloc( tags, sizeof( struct
tagLine)*(numTags+100));

   strtok( yycopy, delimiter);

   tags[numTags].tagName  = (char*) strdup( strtok( NULL, delimiter));
   tags[numTags].fileName = (char*) strdup( curFileName);
   tags[numTags].line     = (char*) strdup( yytext);

   ++numTags;

   free( yycopy);
}


"(#.*$)|(--.*$)"   /* eat up one line comments */
"{"                BEGIN(COMMENT);
<COMMENT>[^}\n]*   /* eat anything that's not a '}' */
<COMMENT>"}"       BEGIN(INITIAL);


.|\n ;



%%



/*---
 * Comparison function passed to qsort() to sort tags array.
 *
 */
int compareTags(const struct tagLine *a, const struct tagLine *b)
{
   return( strcmp( a->tagName, b->tagName));
}



/*---
 * Prints a usage statement.
 *
 */
void printUsage()
{
   printf("\n");
   printf("4gltags -- generate a tags file for 4gl source code.\n");
   printf("Usage:  4gltags [-(a|h|o(filename)|s)] (*.4gl|-)\n");
   printf("\n");
   printf("Options:\n");
   printf("   -a  --  append to exsisting tags file\n");
   printf("   -h  --  display this message\n");
   printf("   -o  --  output to supplied filename instead of tags\n");
   printf("   -s  --  don't generate tags for DECLARE and PREPARE
statements\n");
   printf("\n");
}



/*---
 *
 */
void writeTagsFile( char *outputFile, char *mode)
{
   int   i;
   FILE *outFile;


   outFile = fopen( outputFile, mode);

   /*
    * need to sort the tags now
    */
   qsort( tags, numTags, sizeof( struct tagLine), (void*) compareTags);

   /*
    * write the tags file.
    */
   for(i=0; i < numTags; ++i)
   {
      fprintf( outFile, "%s\t%s\t/^%s$/\n", tags[i].tagName,
tags[i].fileName, tags[i].line);
   }
}


/*
 *
 */
void appendCurrentTags( char *file)
{
   FILE *f = fopen( file, "r");
   char buf[LINE_MAX];
   char *delimiter = "\t";

   while( fgets( buf, LINE_MAX, f))
   {
      if((numTags % 100) == 0)
         tags = (struct tagLine*) realloc( tags, sizeof( struct
tagLine)*(numTags+100));

      tags[numTags].tagName  = (char*) strdup( strtok( buf, delimiter));
      tags[numTags].fileName = (char*) strdup( strdup( NULL, delimiter));
      tags[numTags].line     = (char*) strdup( strdup( NULL, delimiter));
   }

   fclose(f);
}



/*--
 *
 */
int yywrap()
{
   return 1;
}



/*--
 *
 *
 */
int main( int argc, char** argv)
{
   extern char *optarg;
   extern int   optind;

   int   i;
   int   c;
   char  *outputFile   = "tags";
   char  *openFileMode = "w";


   tags = (struct tagLine*) calloc( 100, sizeof( struct tagLine ));

   if(argc == 1)
   {
      printUsage();
      exit( 1);
   }

   while(( c = getopt( argc, argv, "ahso:")) != -1)
      switch( c)
      {
         /*
          * append to tags file, don't overwrite
          */
         case 'a':
            strcpy( openFileMode, "a");
            break;

         /*
          * print help
          */
         case 'h':
            printUsage();
            exit( 1);
            break;

         /*
          * don't include SQL cursor declarations and prepare
declarations
          */
         case 's':
            tagSQL = FALSE;
            break;

         /*
          * output to supplied argument instead of "tags"
          */
         case 'o':
            outputFile = (char*) strdup( optarg);
            break;

         /*
          * unknown option
          */
         case '?':
            fprintf( stderr, "What is '%c'?", c);
            exit( 1);
      }


   /*
    * for each source file given call the scanner yylex()
    *
    */
   for(i = optind; i < argc; ++i)
   {
      curFileName = argv[i];
      yyin = fopen( curFileName, "r");
      yylex();
   }


   if( strcmp( openFileMode, "a") == 0)
      appendCurrentTags( outputFile);


   if(numTags > 0)
      writeTagsFile( outputFile, openFileMode);
}

EOF-4gltags.l
    if [ `filesize 4gltags.l` -ne 5400 ]
    then
        echo $0: 4gltags.l extracted with wrong size
    fi
fi
#
#  end 4gltags.l
#
#  begin 4gltags.makefile
#
if [ -f 4gltags.makefile -a $NOCHECK != true ]
then
    echo $0: 4gltags.makefile already exists
else
    if [ $QUIET != true ]
    then
        echo 4gltags.makefile \(368 characters\)
    fi
    cat >4gltags.makefile <<'EOF-4gltags.makefile'
#---
# Makefile for 4gltags
#
#---

CC          = cc
BIN_DIR     = /source/testdb/programs
SOURCE_DIR  = /source/installed

#---

4gltags: lex.yy.c
	$(CC) -o 4gltags lex.yy.c

lex.yy.c: 4gltags.l
	flex -i -Cfe 4gltags.l

install: 4gltags
	strip 4gltags
	cp 4gltags $(BIN_DIR)
	cp 4gltags.l $(SOURCE_DIR)
	cp 4gltags.makefile $(SOURCE_DIR)

clean:
	rm lex.yy.c 4gltags
EOF-4gltags.makefile
    if [ `filesize 4gltags.makefile` -ne 368 ]
    then
        echo $0: 4gltags.makefile extracted with wrong size
    fi
fi
#
#  end 4gltags.makefile
#
echo All done.

===================================================================


Well, 4gl is weak in so many areas (as a language) that there are
occasions where you can't avoid using C-hooks.  gcj has a CNI, so
theoretically one could add "java hooks" via the C-hook mechanism
without adding the heft of a vm in your binary.  Embedding an
interpreted language like Perl or Python would be the "serious
mistake" IMO.

--
Forte International, P.O. Box 1412, Ridgecrest, CA  93556-1412
Ronald Cole <ronald@forte-intl.com>      Phone: (760) 499-9142
President, CEO                             Fax: (760) 499-9152
My GPG fingerprint: C3AF 4BE9 BEA6 F1C2 B084  4A88 8851 E6C8 69E3 B00B


----------------------------------------------------------------------


I've just updated the CVS with some new functionality
Aubit4gl will now help you with multilingual code !


There is an environment variable 'DUMPSTRINGS' which can be set, this will
generate a file called 'strings.lang' with all the strings from your 4gl
module.

$ export DUMPSTRINGS=
$ 4glpc m1.4gl -o m1

DUMPSTRINGS can also be set to 'ident' - more later.

The strings.lang file looks like this :

Hello:=
World:=

you can then rename this file (so it isn't overwritten) and then edit it eg.

$ cp strings.lang french.lang
(And then edit it to be:
Hello:=Bonjour
World:=Monde
)

When compiling the 4GL you can then use a second environment variable
'TRANSLATEFILE' to specify the new language
eg.

$ export TRANSLATEFILE=french.lang
$ 4glpc m1.4gl -o m1.french

This will replace any strings found in TRANSLATEFILE with the translated ones
associated with it.


If you want to select the language at runtime, you can do that too.

By setting DUMPSTRINGS=ident
you will generate a file like :

Hello:>0
World:>1

This allows you to assign a number to a string (notice :> rather than := ) .
You can then create your language files using these numbers - just like for
help files :

eg "french.msg" may contain

.0
Bonjour
.1
Monde

$ mkmess french
(This will create french.hlp)


All you need to do then is specify which language you want to use in your
program with :

OPTIONS LANGUAGE FILE "french.hlp"

If you want to be able to control which one - just use a variable instead of
'french.hlp'

Eg.
define lv_var char(20)
# Pick up our language from the environment
#
let lv_var=fgl_getenv("LANGUAGE")

if lv_var = " " or lv_var IS NULL then # default to english
        LET lv_var="english"
end if

let lv_var=lv_var clipped,".hlp"

options language file lv_var


There is an example in tools/test called lang.4gl, with associated .msg files
for english, french, german,spanish and italian as well as

Theres also a makefile to compile it all up and the source.lang file.

Just
$ make -f Makefile.lang

and you should be ok (make sure mkmess is in the bin directory - I had to
copy it manually for some reason).

========================================================================

GTK themes apply colours or images to applications that use GTK library.
The changes aare not made to windows borders or buttons (thosa are handeled
by a windows manager)

Themas source: gtk.themes.org

Installation:

When running GNOME:

Start-> Settings-> Gnome Controll Centr -> Desktop Theme selector.
Click on "Install new theme" and select your theme.

Not running GNOME:

Extract the downloaded theme tarball to some location, for eample
~/.gnome/themes (or /usr/share/themes for system wide)

make a file in your home directory called .gtkrc and add the following line
to it:

include~/.gnome/themes/our-theme-name-gtk/gtk/gtkrc


========================================================================

Instructions for seting up PostgreSQL ODBC:

http://www.redhat.com/support/resources/howto/database/database_odbc/


========================================================================


AUBITGUI is now "TUI" or "GTK"

====================================================================

bad rpcgen: (execl: No such file or directory) on armada:

-rwxr-xr-x    1 afalout  None        25600 Oct 29 20:59 /usr/local/bin/rpcgen

also bad: on armada:
-rwxr-xr-x    1 afalout  None       402727 Oct 29 20:54 /usr/local/bin/rpcgen


good rpcgen on istation:
-rwxr-xr-x    1 afalout  None        51280 Jun 11 2001 /usr/local/bin/rpcgen

good disrto includes rpcinfo.exe

========================================================================


Just added libUI_CONSOLE.

This is a stdin/stdout UI which features :
DISPLAY ERROR MESSAGE
MENU & PROMPT
(Trying to use any other screen UI (eg input/construct) will core dump)

Everything is read from the standard input and written to the standard output.
There are no control characters sent, no screen formatting.
Eg

basic.4gl:

main
define a char(40)

prompt "Enter your name :" for a
display "Hello ",a clipped

end main
--
$ 4glpc basic.4gl -o basic
$ AUBITGUI=CONSOLE
$ export AUBITGUI
$ ./basic
Enter your name :Mike
Hello Mike
$ echo "Mike" | ./basic
Enter your name :Hello Mike
$

menus look like this:


----cut----


Menu name

1. First Option
2. Secong option
3. Exit program



----cut----



This should effectively replace the old NOCURSES environment settings which
will be removed (at some point)...

No form related (fcompile, fshow, fdecompile) or menus (mcomile, mdecompile)
programs are compiled / installed in this environment, since they are unable
to do anything usefull without RPClib.


=======================================================================

add "How to report bugs" sestion to manual

======================================================================


USING SCROLL fieldname for linking display array with a scroolbar
(Not in TUI obviously)

added libstring

added basic display array to GTK GUI

added limites scroolbar support in GTK (for version 1.2)

=================================================================


BTW - why do you want hash tables ?
You do know that aubit 4GL has associate arrays I assume (i've committed the
following as tools/test/assoc2.4gl):

define lv_rate ASSOCIATE CHAR(3) WITH ARRAY[2000] OF RECORD
                lv_name CHAR(20),
                lv_rates float
end record
define lv_name ASSOCIATE CHAR(3) WITH ARRAY[2000] OF CHAR(20)

#
# Data correct on 19/04/2002
#
main
DEFINE i FLOAT
define cur char(3)
# Use USD as base
        LET lv_rate<<"USD">>.lv_name="US Dollars"
        LET lv_rate<<"USD">>.lv_rates=1.0

        LET lv_rate<<"EUR">>.lv_name="Euro"
        LET lv_rate<<"EUR">>.lv_rates=0.888477

        LET lv_rate<<"GBP">>.lv_name="UK Pounds"
        LET lv_rate<<"GBP">>.lv_rates=1.44621

        LET lv_rate<<"JPY">>.lv_name="Japan Yen"
        LET lv_rate<<"JPY">>.lv_rates=0.00766891

        LET lv_rate<<"NZD">>.lv_name="New Zealand Dollars"
        LET lv_rate<<"NZD">>.lv_rates=0.447180

        LET lv_rate<<"PTE">>.lv_name="Portugal Escudos"
        LET lv_rate<<"PTE">>.lv_rates=0.00443157

LET i=5
clear screen

options prompt line last
while true
PROMPT "Enter short code : " for cur
DISPLAY "" at 5,1
DISPLAY" if I have ",i using "#####&&.&&", " ",cur," (",
lv_rate<<cur>>.lv_name clipped,") thats about ",lv_rate<<cur>>.lv_rates*i,"
US Dollars" AT 5,1 attribute(red)
end while
sleep 2

end main

====================================================================

Nothing as elaborate - But we have a skeleton for something less
sophisticated :


define new type a1 as record
        tabid integer,
        tabname char(18),
        nrows integer,
        rowsize integer
end record


define a as a1


When I just tried it - it didn't work - so I'll need to check why...
As for the comparisons etc. - these are a lot more difficult and I can't
really see the point for complex types.

Anyway - if you head down that route then you'll have OO4GL by default...

You could have something along the lines of :

define new type a1 as record
	        tabid integer,
	        tabname char(18),
	        nrows integer,
	        rowsize integer
	end record

	function aaa ()
	..
	end function
end type



etc if you want to move to a more OO system..

define a as a1


Anything along these lines will probably have to wait quite a while though....

(One thing I would like to introduce though is the ability to add datatypes
at some point. I'd love to add the GMP datatypes/functions in (see
http://www.gnu.org/directory/gnump.html ).


=======================================================================

I haven't done the server yet - so its a little difficult. - you'll need to
create you're own server (or find a public one )

A4GL will pass in the parameters as an array...
At least one public server I've tried, uses PHP as the server - which in some
versions has a bug - best probably to roll your own...


Your client sourcecode would then look like this :

main
define x char(20)
#                           URL                                         METHOD
        call external "localhost/cgi-bin/sample-cgi.cgi":sample.addition[1]
(1,2)  returning x
        display "x=",x
end main


The [1] is ignored for XMLRPC..

===================================================================


Usage: nm [OPTION]... [FILE]...
List symbols from FILEs (a.out by default).


  Your VC install should include a tool called "depends.exe"
(usually installed under Microsoft Visual Studio\Common\Tools).
Loading your app app/dll within depends should show you what
import dependencies your app has on cygwin1.dll.

  The command line tool dumpbin will give you similar info;
where depends attempts to resolve the imports an associate
them with a particular DLL, though, dumpbin will just give
you the raw IAT dump.



Q) What preprocessor symbols does Cygwin define
A)  Use the tool Luke :-)

	gcc -E -dM - </dev/null


afalout@usf-cf-sparc-solaris-1:~/aubit4glsrc$ gcc -E -dM - </dev/null
#define __GCC_NEW_VARARGS__ 1
#define __sparc 1
#define __svr4__ 1
#define __GNUC_MINOR__ 95
#define __sun 1
#define sparc 1
#define __sun__ 1
#define __unix 1
#define __unix__ 1
#define __SVR4 1
#define sun 1
#define __GNUC__ 2
#define __sparc__ 1
#define unix 1


=====================================================================

Hello *,

I just posted diagram of proposed architecture for Aubit compiler header files includes consolidation, at:

http://aubit4gl.sourceforge.net/aubit4gldoc/architecture/Aubit4gl_includes.htm

also accessible from updated documentation menu page, that no includes 4GLworks manual:

http://aubit4gl.sourceforge.net/aubit4gldoc/index.html

BTW, I'm still hoping for some comments on Aubit compiler architecture diagram, now in version 0.20:

http://aubit4gl.sourceforge.net/aubit4gldoc/architecture/Aubit4gl_arch.htm

Header files includes diagram is simplified, and instead of showing all possible combinations, shows only target level,  with no separate items in target class (one level for all compilers, one for aubitlib, one level for all loadable modules)

Currently, we have 80 header files.

According to proposal, this would go down to 41 (40).

Following assumptions where made:

* One compile target - one header file (libubit4gl is a target, it gets one private (_int) header file , 4glc is a target, libUI_ is a target, and so on...

* Loadable modules targets get there private header for specific implementation (for UI this is TUI, GTK, CONSOLE) and one for each class (in this case UI)

* All declarations/definitions that stay in source code files (.c) are static and static only.

* External headers (ANSI, POSIX, GTK, ODBC...) are included from highest level header file that still needs them, not from .c code directly.

* All declarations/definitions that are internal to target class (library,executable) go in private header file (targetname_int.h)

* There is (should not) be a need for libaubit and modules libraries (libUI_, libSQL_, ...) to access functions/variables in any executables.

* Modules libraries access to aubitlib and vice versa would go via API only. There should be no access to variables directly, and function call interface should be used in all cases, and defined as part of API. This includes variables like status, sqlca... This way we will be sure we have "well defined API's", and that nothing is going in or out bypassing API.

* Only aubitlib and API headers need to be globally visible.

List of all header files to be created:

Top level (3 or 2):
----------------------------------------------------------

/incl/a4gl_4gldef.h (used only by Aubit compiled 4gl code)              *
/incl/a4gl_libaubit4gl.h (ex a4gl_aubit_lib.h)                          *
/incl/a4gl_4glgui.h (can we remove this one?)                           *

API declarations (9):
----------------------------------------------------------

/incl/a4gl_API_sql.h                                                    *
/incl/a4gl_API_ui_int.h     (_int ??? rename)                           *
/incl/a4gl_API_exreport.h
/incl/a4gl_API_form.h                                                   *
/incl/a4gl_API_menu.h                                                   *
/incl/a4gl_API_rpc.h
/incl/a4gl_API_msg.h                                                    *
/incl/a4gl_API_datatype.h
/incl/a4gl_API_lex.h                                                    *

Target specific declarations (14):
---------------------------------------------------------

/lib/libincl/a4gl_4glc_int.h                                            *
/lib/libincl/a4gl_mkmess_int.h                                          *
/lib/libincl/a4gl_fcompile_int.h                                        *
/lib/libincl/a4gl_mcompile_int.h                                        *
a4gl_ace_int.h                                                          *

/lib/libincl/a4gl_libaubit4gl_int.h                                     *

/lib/libincl/a4gl_lib_sql_int.h                                         *
/lib/libincl/a4gl_lib_ui_int.h                                          *
/lib/libincl/a4gl_lib_exreport_int.h                                    *
/lib/libincl/a4gl_lib_form_int.h                                        *
/lib/libincl/a4gl_lib_menu_int.h                                        *
/lib/libincl/a4gl_lib_rpc_int.h                                         *
/lib/libincl/a4gl_lib_msg_int.h                                         *
/lib/libincl/a4gl_lib_datatype_int.h
/lib/libincl/a4gl_lib_lex_int.h                                         *

Loadable module implementation specific declarations (15):
----------------------------------------------------------

/lib/libsql/a4gl_lib_sql_odbc_int.h                                     *
/lib/libsql/a4gl_lib_sql_esqlc_int.h                                    *
/lib/libsql/a4gl_lib_sql_pgsql_int.h

/lib/libui/a4gl_lib_ui_tui_int.h                                        *
/lib/libui/a4gl_lib_ui_gtk_int.h                                        *
/lib/libui/a4gl_lib_ui_console_int.h                                    *

/lib/libexreport/a4gl_lib_exreport_pdf_int.h                            *

/lib/libform/a4gl_lib_form_xdr_int.h                                    *

/lib/libmenu/a4gl_lib_menu_xdr_int.h                                    *

/lib/librpc/a4gl_lib_rpc_xdr_int.h                                      *
/lib/librpc/a4gl_lib_rpc_rpcxml_int.h                                   *

/lib/libmsg/a4gl_lib_msg_native_int.h                                   *

/lib/libexdata/a4gl_lib_datatype_mpz_int.h

/lib/liblex/a4gl_lib_lex_c_int.h                                        *
/lib/liblex/a4gl_lib_lex_perl_int.h                                     *

I will surround existing #include statements with #ifdef _OLD_HEADERS_ so we can go back easy if we have problems. I will NOT change or delete any existing header files untill this process is completed and fully tested.


Exceptions:
-------------

lib/libaubit4gl/error.c includes "../generated/tmperrs.h"
				/gui.c includes <errno.h> /* EINTR */
lib/libsql/sql.c includes headers from ODBC drivers
a4gl_lib_lex_int.h includes :
	#include "a4gl_lex_print_protos_c.h"
	#include "a4gl_4glc_4glc.h"




==========================================================================
Sorry for delay,

> FYI - I've just finished work on a modularised 'packer' for aubit4gl (which
> I'll commit when I'm happy - BTW - the datatypes stuff should work now [But i
> need to add automatic datatype loading at some point])

Can you please put something together for the manual - and consider the people
that have no idea what this is?

I myself am not clear about what exactly "modularized packer" is, and if it's
in any way associated with data types loading, of how exactly is this working...

> This takes the form of yet another compiler (xgen),

What does (this)?

> this processes a .x file
> and along with the .h file generated by rpcgen allows different formats for
> data storage for the reports/forms/menus etc.

But is still dependent on RPCLIB on client PC?


> It generates 3 files, an input.c output.c and header file. These in turn call
> a pack function, which actually writes or reads the data to/from a file.
>
> Each of the 'packers' is a separate .so and is called via a dlmagic'd script.
> which is obviously configurable.

Very cool.

> This means we can now store data in xdr, packed (simple data), and XML formats
> and also any others we want later on (for example - I've written a 'perl'
> packer which outputs something which can be directly incorporated into a perl
> script !).

OK, so you DO need RPCGEN to compile this...
Idea is fantastic, but Sun RPC is killing me...

Mike:

No - thats the point - you need the header file (.h) generated by rpcgen and
thats it.
If you remember we agreed that this would be used for the internal
representation. So this .h file (which we could edit a little) would be added
to CVS and you would no longer need RPC at all (just use the CVS version of
the header file). I may extend the Xgen compiler to output the required .h
file as well - but this gets pretty complicated so don't hold you're
breath....



> The XML bit it a little limited - it will only read data that it has written
> out (ie. its not a full XML parser - it relies on some of the line breaks
> being present and also relies on the data being exactly what its expecting
> and in that order etc.)

Can we use external XML parser library like Expat instead?

Mike:

You could try - but you need something to convert this into the internal
format (which may be difficult to do).

--------------------------------------------------

There can be more - the A4GL_FORMTYPE & A4GL_PACKER variables are used to
select which format is used.
The normal mode is the standard .frm, but this uses XDR for storing the data
(which is portable), this isn't easily readable from some other languages,
and is also hard to get hold of the libraries for on Win32.
For that reason - we plonked all the output routines into shared libraries so
you can pick and choose.

The A4GL_PACKER can be one of :

	PACKED *
	XML *
	PERL *
	XDR

This determines the library used to generate the output data.

The A4GL_FORMTYPE determines which of the master data output routines will be
used, this is either XDR or GENERIC.
Using XDR will just call the old routines, GENERIC will pick up the
PACKED,XML,PERL or XDR as set by the A4GL_PACKER.

To this extent - A4GL_FORMTYPE=XDR should probably be depreciated...
(This is from memory so I hope its right!)


I'll take a look at the escaping in XML - at the moment its just a set of C
code in libpacker/xml/pack_xml.c

> As a side effect of the generic - there is that strange looking PERL format.
>
> This outputs as a PERL variable (have a look at the PERL ace runner code stuff
> for an example).
>


------------------------

Hi,
Just to let you know I've just committed the new packer library.

Whats that then...

Well, basically forms and the new style menus (as well as anything else we
come up with) are stored in files in a format called XDR, which is a platform
independant format used by SUN RPC.
It was chosen because you can define the layout of the data (in a '.x' file)
and it will generate all the structures in a header file and the routines
required to read and write those structures automatically.

Anyway - to cut a long story shorter, this isn't ideal because :

1) The XDR format is not available on all platforms
2) The rpcgen program which processes the files we use isn't available on all
platforms
3) As we move to new languages (eg Java , Perl) we can't use the rpcgen'erated
code because thats pure 'C'.
4) Its not very readable

So we now have different 'packers', these are routines that take C structures
and turn them into files and vice versa. You can select which packer to use
by setting the environment variable "A4GL_PACKER"

I've implemented 4 so far:

1) PACKED
 This is very similar to XDR in that data is written in a hopefully portable
way (optionally non-portable if the required functions aren't available).
This will probably give the smalled output files

2) XDR
 This is the same as doing it the old way

3) XML (yes - that is XML)
 This stores and reads the data in an XML file. The reading is very limited
and can basically only read the XML files that it generates - IT IS NOT A
FULL BLOWN XML PARSER. It uses some odd constructs and isn't ideal - but
you'll get the idea when you see the output

4) PERL
This generates a data structure which can be used inside a perl program - its
pretty complicated stuff though using hashes for the data representation.
What you do with it after you've generated it is up to you, because this is
an output only library (ie it can't read back what its written).



It'll probably take a day or two to iron out any problems, so bear with me...

============================================================================

OK - I'm releasing this as beta code.
What's been done is to add a mechanism whereby datatypes can be added to the
4GL language.

This is done using shared libraries..

I've uploaded an example testmpz.4gl into the tools/test directory.

In order to use it -

$ cd lib/libexdata
$ make
(This will make the .so for the mpz datatype - assuming you have the gnu mp
[gmp] package installed)

The mpz datatype is a arbitrary precision integer datatype that can handle
very very large numbers...


This is the testmpz.4gl file :


import datatype mpz # Tell everything we need the mpz datatype
main
define a mpz
define b integer

call load_datatype("mpz") #actually load the datatype

let a=100 # simple assignment

for b=1 to 10
        call a:nextprime() returning a # This is a 'class' function which
						# returns a value
        display a
end for


display "Setting fib numbers"

for b=1 to 10
        call a:setfib(b)  # This has been defined as an 'inplace' function
				# ie change the variable itself
        display a
end for


end main


Enjoy!

===========================================================================


I actually put support for this in Hydra a number of versions ago, so
that the multiple page forms are correctly handled (although the
form compiler doesn't necessarily think so).

To select a given form page you can use:

DISPLAY PAGE pageno (where pageno is  number of pages-1)
[sorry it should be 1 to maxpageno for consistency, but its a minor
feature anyway].

Unfortunately, this isn't supported in any of our graphical clients.


> They are the packers for the file types (menus, reports, forms).
>
> This is used by the libpacker stuff so its all automated (you say how to write
> an integer in the packer, the libDATA_report.so will call this when required
> to write a report), this means that you don't need to write interface code
> for all file types for all data types...
>
>
>
> On Thursday 29 August 2002 12:59 pm, you wrote:
> > Mike
> >
> > Where are this guys loaded/used in code?
> >
> > libDATA_menu_list.so
> > libDATA_report.so
> > libDATA_struct_form.so
> >


SAPDB on RedHat > 6.2
---------------------

cd [...redhat i386 distribution/RPMS...]
rpm -ivh compat-libstdc++-6.2-2.9.0.16.i386.rpm

cd [ your SAPDB RPM's.../sapdb/7.3.00.18/linux]
rpm -ivh sap*

cd [ to this directory with the init scripts ]
./rh-inst

configure the instances you want to startup at boot in /etc/sysconfig/sapdb

=====================================================================

Use in my makefiles:
-fno-strict-aliasing
-march=i386
-mcpu=i686
-Wno-implicit-int
-Wno-comment


=======================================================================

To doc4gl manual:
> The idea of the @process tag is to let the people divide is system in
> sub-systems and define what sub-system the function implements. Ex:
>
> If you have an ERP, maybe the system have the folowing sub-systems:
>   ERP
>     +-- Account +-- Payable
>                           |
>                          +- Receivable
>
> This way in the functions that implement "Account Payable" could be
> marked with @process ACC_PAYABLE.
>
> You can then make some query(s) in the database (or use the JSP
> interface) to know wioch functions implement some functionality.
>
> >And "Account receivable" ACC_RECEIVABLE, but you would never be able to relate them to "Account"?
> >
> >
> Yes, because the processes are stored in a table (process i think) where
> you can set the hierarchy, where you can set the ACC_RECEIVABLE as a
> sub-process of ACCOUNT.
>

======================================================================

> what do one do with .aarc.xml files, that result from aace compiler?

Not alot..
You can convert it to perl script (which 99% works - with only a couple
of quirks!)

Or convert it to 4gl... (which also works)


--------------------------------------------------------------------------

> > compilers/ace/perl_runner ?
>
> I missed that dir - do you have anything that describe it's usage?


Firstly - you need to copy  the perl runner scripts (the .pm's) from
perl_runner to the perl library directory (I used
/usr/local/lib/perl5/site_perl - but yours maybe different)

Then - you need to make aace_perl :

make aace_perl

I think I added this back into the Makefile.in, so you should only need to
'configure' and then be able to 'make'.


Once you've got that - you can start

aace_perl myreport.aace

(a .aace is identical to a .ace)



When you want to run your report :

$ chmod 777 myreport.run.pl
$ myreport.run.pl


(You'll also have a myreport.aarc.pl - but that can be discarded).


Points to note :

The report runs via DBI - you'll need that set up in order to run any reports.

The connection is made using

	$dbh = DBI->connect("DBI:$dbtype:".$report->{"report"}{"dbname"});

Which may not suffice for some DBI database interfaces, the $dbtype is taken
from the AACE_DB environment variable and default to 'Informix' if not set.


The report compiles using the normal A4GL libraries (ie not DBI) so you'll
need those set up to compile the reports.

The report.pm is pretty much ok (there are a few bugs) - in particular there
is **NO** 'format every row end' section - you must use a proper format
section (PAGE HEADER, ON EVERY ROW etc).


Finally -

READ THE LICENSE INFO -

	# (c) 2002 Aubit Computing Ltd
	#
	# NOTE : This code is not covered by the GPL and is not part of the core
	#        Aubit4gl system or maintained by the Aubit4GL team.
	#
	#        If you wish to use this code the following condition applies :
	#
	#             You must NOT use this code in any commercial application
	#             without prior consent of Aubit Computing Ltd
	#
	# For full details of the licensing terms - please contact Aubit Computing
Ltd
	#





If you want to add this to the documentation then fine - but its not GPL - its
owned by me (as I think it could have serious commercial potential) - I may
remove/change this code at will !


Just to complete the extra ace stuff - there is also aace_4gl

This converts an ACE report to 4GL doing all the necessary conversions
en-route.
Eg:


	DATABASE stores END
	OUTPUT
	        REPORT TO "myfile.out"
	END

	SELECT

	    tabname,
	    tabid
	FROM systables END

	FORMAT
	ON EVERY ROW
		PRINT tabname," ",tabid
	END


Becomes :

	MAIN
	   CALL run_report_systables()
	END MAIN

	FUNCTION run_report_systables()
	# Variables
	DEFINE lv_data RECORD
	   x_tabname CHAR (18),
	   x_tabid INTEGER
	END RECORD
# end of initialisation

	DECLARE c_r_systables CURSOR FOR
	   SELECT tabname,tabid FROM systables

	START REPORT rep_systables

	FOREACH c_r_systables INTO lv_data.*

 	 OUTPUT TO REPORT rep_systables (lv_data.*)
	END FOREACH

	FINISH REPORT rep_systables

	END FUNCTION

	REPORT rep_systables(lv_data)
	DEFINE lv_data RECORD
	   x_tabname CHAR (18),
	   x_tabid INTEGER
	END RECORD
	OUTPUT
	  TOP MARGIN 3
	  BOTTOM MARGIN 3
	  LEFT MARGIN 5
	  RIGHT MARGIN 132
	  TOP OF PAGE ""
	 REPORT TO "myfile.out"


	FORMAT

	ON EVERY ROW
	   PRINT lv_data.x_tabname , " " , lv_data.x_tabid

	END REPORT





(I just fixed the REPORT TO myfile.out !)


To use it - compile your ace report :

	$ aace somereport.aace
then run the processor on the resultant .aarc file

	$ aace_4gl somereport.aarc

This will dump to stdout - so :
	$ aace_4gl somereport.aarc > somereport.4gl


This will ALWAYS shove the MAIN..END MAIN block in so it can be compiled into
a standalone program.

You'll obviously need to remove that in order to put it into a larger
program...

======================================================================



If your putting module level variables before the globals:

The current stratergy (which needs fixing for other reasons) uses an indicator
in the variable static to mark the end of the globals/start of the module
level and another for the end of the module level/start of the local level.

This will almost certainly screw up if you don't have them in that order....


========================================================================

Hi all

I have committed some major changes to API_sql.c, API_odbc.c and related
files, to effect the following:

- conversion of SQL syntax from one dialect to another is now handled
  in API_sql.c  (the interfaces in libsql no longer have to do this )

- conversion is only done if you set A4GL_SQLCONVERT=YES and only if
  the dialect used by the program differs from that used by the DBMS
  interface.

- by default the system assumes the 4GL application is using Informix SQL
  syntax, but this can be changed by setting, for example,
  A4GL_SQLDIALECT=ORACLE.

- a new function A4GLSQL_set_dialect( ... ) has been added, to allow for
  a new 4GL directive to change the default SQL dialect at runtime
  ( syntax still to be implememented - Mike ?)
  eg.
      SET SQL DIALECT TO ORACLE

- Sergio, conversion can be automated for the native Postgres interface
  if you just include the following function :

  char *
  A4GLSQL_dbms_dialect( void )
  {
     return "POSTGRESQL";
  }

Note - I had to fiddle calldll.c (changed nullfuunc from static) so that
       I could prevent Aubit from dropping dead if the interface doesn't
       have the new optional _dbms_xxx functions.

I will continue to expand sqlconvert.c over the next few weeks, and I
will also look at some kind of user editable conversion config file.


NB : MULTIPLE SIMULTANEOUS INTERFACES/CONNECTIONS

I had to change API_sql.c to keep a list of open sessions so that I could
keep track of what SQL conversions were required. If you look at the code,
particularly the use of the linked list of sessions - is it possible to
load more than one interface and include libptr along with the session
info and get the system to switch dll's on the fly each time you change
session ?

Philip Sterry


=========================================================================



Just to clarify about Aubit extensions in general;

Aubit 4gl compiler is a programming language translator, meaning, it takes the 4GL source code, and spits out another programming language, currently C or Perl.

Therefore, when using C output (default), extensions normally used by C compiler can be applied, and passed to 4glpc compiler script:

Typically, in C, that would be:
	4glpc -c module1.4gl -o module1.o
	4glpc -c module2.4gl -o module2.o
	4glpc -o program1 module1.o module2.o

...and this will work just fine. Now, there is an issue of distinguishing between Aubit compiled programs and objects, and there are some existing conventions that people coming with experience of other 4gl compilers are aware of, and familiar with. For instance, users if I-4gl, C-compiled compiler, are used to something like:

	4glpc -c module1.4gl -o module1.o
	4glpc -c module2.4gl -o module2.o
	4glpc -o program1.4ge module1.o module2.o

(i-4gl c compiled actually outputs .ec, which is compiled by ESQL/C compiler to C, and then with native compiler to .o)

...and this will work just fine. Now, there is an issue of multi-4gl compiler environments, and multi-4gl compiler make files and make rules, like in Aubit's own Amake: not only you want to know which objects are compiled with particular compiler, you _HAVE_ to know, because make rules are _EXTENSIONS_ based. Therefore, to make this environment work, and tools like Amake work, we have to "invent" unique extensions for every compilers, and every file type, even if we don't really need them to compile and rune one program (Good example of this is a executable name, that will compile and run just fine without ANY extension).

Inside Amake, for example, Aubit extensions are defined as:

A4GL_EXE_EXT=.4ae
A4GL_OBJ_EXT=.ao
A4GL_FRM_BASE_EXT=.afr
A4GL_XML_EXT=.xml
A4GL_PACKED_EXT=.dat
A4GL_HLP_EXT=.hlp
A4GL_LIB_EXT=.aox
A4GL_MNU_BASE_EXT=.mnu.xml

...in make include file called a4gl.mk. Same file for other compilers are called i4gl.mk, q4gl.mk and d4gl.mk, and contain equivalents for appropriate 4gl compiler.

NOTE: Aubit currently can have different extensions for forms and menus, that are dependent on the output packer used, but that's a different issue)

Same is defined in Aubit compiler and libraries, in file resource.c, as extensions used for compiling (now that 4glc can be used directly to compile objects and programs, instead of invoking it via 4glpc script) and at run-time, for opening form, help, and menu files.

Therefore, while not necessary, it is highly recommended to follow this naming scheme, in which case above commands will become:

	4glpc -c module1.4gl -o module1.ao
	4glpc -c module2.4gl -o module2.ao
	4glpc -o program1.4ae module1.ao module2.ao

While this extensions are not enforced, and can even be overridden form aubitrc, it is recommended way to do this.

HTH,

Yours, Andrej Falout, http://falout.org/disclaimer.html
Project manager, Aubit project: http://aubit4gl.sf.net
Software architect, MakeTXT.com
PLEASE NOTE: All HTML email sent to me WILL BE DELETED AUTOMATICALLY WITHOUT READING.

==========================================================================


if a<=1 then
        display "1"
elsif a>=1 then
        display "2"
elsif a=3 then
        display "3"
end if


I've just added it now...
(For now - i've put both 'elif' and 'elsif' as valid words for the 'elif'
token - ideally we should probably pick and stick to just one)

On Monday 27 January 2003 5:00 pm, Jonathan Leffler wrote:
> It depends on your viewpoint.  No, it isn't necessary; the language has
> survived over 15 years without it.  And CASE WHEN exp ... (as opposed to
> CASE exp WHEN ...) covers for it.  But personally, I'd like to see it in
> classic I4GL -- it bugs me every time I have to modify an IF/ELSE to deal
> with a third alternative that I have to rewrite so many lines of code.


Of course, 'elif' is used by the Bourne Shell and derivatives; Perl uses
'elsif' because Larry Wall chose not to use keywords which are another word
spelled backward -- a jibe at the Algol-like use of 'fi' and 'esac' in
Bourne Shell.  Of course, Bourne Shell is not self-consistent; for ... do
... done should use 'od' instead of 'done', but there was already a command
'od' - octal dump - when it was introduced, so the keyword was pre-empted
by the command.  I'd probably nominate ELSIF as 'the' choice for I4GL/A4GL,
but I'm not going to be fussed if you go with ELIF for some other reason.




==========================================================================




Just for the record, I'm currently working on a .EC lex library.
This is basically the same as the .C library for all but the SQL stuff.

I've kept the basic functionality of the current Aubit SQL stuff in
their too, so I imagine we'll eventually loose the liblex/lex_c
directory and generate the LEX_C and LEX_EC directly from the lex_esqlc
directory stuff..

The ESQL/C stuff is currently targeted at informix ESQL/C - but this
should be relatively straight forward to convert to others (possibly
that UESQL/C (c++) library I've seen on slashdot..)

The one thing to bear in mind is that this is completely different to
the esql/c connection library sergio is writing (that is a LIB_SQL
library).

If you use the .EC Lex - you'll get a .ec file you can compile up using
your esql equivalent. You'll then ONLY be able to connect to that
database. You'll completly ignore the libSQL stuff and therefore NOT be
able to retarget the database connectivity....


===========================================================================


I have done some further work on the SQL dialect conversion functionality.

CONFIG FILE BASED CONVERSIONS

convert_sql() now uses configuration files.  These are by default
located in /opt/aubit4gl/etc/convertsql/, but that can be changed
with A4GL_SQLCNVPATH.

The conversion files are named <source-<target>.cnv, eg.
INFORMIX-POSTGRES.cnv, and they contain a list of directives
indicating what conversions/translations are required.

Details are in /opt/aubit4gl/etc/convertsql/README.txt
I will put this into the aubit4gl manual (html) in the next few days.


COMMAND LINE CONVERSION TOOL
In tools/convertsql is a simple utility that can be used to convert SQL
script files.  I included this as many people use .sql scripts outsided of
their 4GL programs.
eg:
    convertsql  INFORMIX  POSTGRES < myscript.sql > myscript.pg

Andrej - my Makefile here needs work; please have a look.

NOTE

This stuff is far from complete - I still have more work to do on the
conversion routines, eg. oracle style outer joins with (+).

I also need assistance on building up the config/rule files, especially
for SAPDB and Oracle.

Actually, much remains to be done on this interface.

Some conversions can be done by simple search and replace rules,
but most require coding, either because the transformations are
considerable (beyond easy regex'ing), or because they apply in
specific contexts.

The idea is to gradually build up the 'coded' conversions while allowing
for search/replace rules to handle anything not yet covered.
I am trying to work on a simple way to include some context-sensitivity
into the REPLACE command.
eg. you might want "SELECT UNIQUE ..." to become "SELECT DISTINCT ...",
but you don't want "CREATE UNIQUE INDEX ..." changing to "CREATE DISTINCT
INDEX ..."
similarly, other conversions are only applicable when the search string
appears in an expression or as a column name (like 'user' or 'today').



===========================================================================


I've also included code for auto initializing module and function local
variables (but you need to set A4GL_AUTONULL=YES to get this)...

or is it just Y ?

===========================================================================


2) I've added an ansi warning mode.

You can enable it by setting either :

	A4GL_ANSI_WARN=Yes
or
	A4GL_ANSI_ERROR=Yes

At the minute this only picks up two errors - but we can expand it as we go
along.


For ANSI_WARN - it will display a warning if it sees anything amiss...
For ANSI_ERROR - it will bomb the compile (.err file etc)

If neither of these is set - then nothing happens at all and the compiler is
happy....

============================================================================

Added a FILESCHEMA sql library.
This is to be used **JUST** for compiling programs where either the database
doesn't exist yet - or you can't get immediate access to it..
This takes the 'database' as a filename (with a .schema extension) and uses
that to collect the data.

The format of the file is :

[table1]
column datatype size
column datatype size
column datatype size
[table2]
column datatype size
column datatype size
column datatype size

etc...

=============================================================================

> New feature :
>
> A4GL_BACKGROUND=xxxx
> where xxxx is a HEX code of a colour attribute - eg 1400 (for 0x1400)
> for blue and reverse...
>
> Applies to all windows created when no attribute is specified (including
> the main screen)


---------------------------------------------------------------------

exitwith("This is the error message");

There is a mkerror script which greps these out and makes the error
number/error message list...

On Wed, 2003-03-26 at 22:52, John O'Gorman wrote:

> What is the favoured way to error out.
> I usually do perror(errmsg); exit errno;
>
> In Aubit4gl, I expect there is an error routine
> to set an error number and message and leave it
> to A4GL to capture it with it with its whenever error mechanism
>

===================================================================

Yes - ish...

They are in lib/libaubit4gl/compat.c - I've only implemented the ones I've
come across so far, so its not complete..

The preferred mechanism is to use code/endcode instead for most things:

function do_somethin_in_4gl(lv_int,lv_char)
define lv_int integer
define lv_char char(80)
code
printf("int=%d char=%s\n",lv_int,lv_char);
endcode
end function


This takes a lot of the work out of doing it now - but doesn't help to much
when porting an older app..


On Wednesday 26 March 2003 4:06 am, John O'Gorman wrote:
> Hi guys
>
> Does Aubit4GL have pushquote(),  popquote() and friends?
>


=====================================================================

I've added the following function to Aubit4gl TUI mode (there is a blank
entry in GTK mode)

call aclfgl_dump_screen(filename)

This will dump the current screen to the file converting the drawing
characters for windows to +/|/- where required.

This will allow for us to compare with the output from informix...


I've tested the following routine with Informix c4gl and it seems to
work the same way :


#include <stdio.h>
#include <curses.h>
#include "fglsys.h"

FILE *f;

int scr_width = 80;
int scr_height = 24;



int
aclfgl_dump_screen (int n)
{
  int sh;
  int sw;
  int x, y;
  int attr;
  char *ptr = 0;
  WINDOW *w;
  int mode = 1;
  char buffer[255];
  char *buff;

//w=find_pointer ("screen", WINCODE);
  w = curscr;

  if (n == 1)
    {
      popquote (buffer, 255);
    }

  if (n == 2)
    {
      popint (&mode);
      popquote (buffer, 255);
    }

  ptr = buffer;
  trim (ptr);
  strcat (buffer, ".infx");

  if (mode == 3)
    {
      scr_dump (ptr);
      return 0;
    }

  sh = 24;
  sw = 80;

  f = fopen (ptr, "w");
  if (f == 0)
    return 0;

  for (y = 0; y < sh; y++)
    {
      for (x = 0; x < sw; x++)
        {
          attr = mvwinch (w, y, x);
          if (mode == 0)
            {
              buff = (char *) &attr;
              /* @todo - Fix for different ENDISMS */
              fprintf (f, "%c%c", buff[2], attr & 255);
            }

          if (mode == 1)
            {
              fprintf (f, "%c", attr & 255);
            }
        }
      fprintf (f, "\n");
    }
  fclose (f);
  return 0;
}


static char *
trim (char *s)
{
  int a;
  for (a = strlen (s) - 1; a >= 0; a--)
    {
      if (s[a] == ' ')
        s[a] = 0;
      else
        break;
    }
  return s;
}




Andrej - can you find a home for this ?

Note - the informix c4gl routine above appends .infx to the filename so
you can run the same program, compiled under the two compilers and
compare the outputs with no source code changes...

=======================================================================

I've modified the 'getting screen size' routines to use COLUMNS and
LINES environment variables if they are set (It will use A4GL_COLUMNS
and A4GL_LINES in preference if they are defined).

This should make it work with a normal (not xterm) terminal session.

As I don't have this particular problem on any of my systems (Andrej has
reported it) - I can't test if this provides a solution - so give it a
go...


=========================================================================


How about -

4glpc -N "myprefix" myfile.4gl
4glpc --namespace "myprefix" myfile.4gl

It defaults to "aclfgl_" (ie as it is at the minute), specifying "" will cause
it to work like the old informix way..

All function/report definitions and calls are prefixed with that namespace...


I put this in on thursday...

On Saturday 05 April 2003 4:03 am, Andrej Falout wrote:
> I'd say, namespacing is absolutely necessary. I'd also say, I'm happy
> putting a limited effort  to port code in this context, as long as it STAYS
> backward compatible (e.g. after the modifications, it is still usable with
> other compilers.
>
> As long as it's clearly explained in the manual, I expect that most
> developers will have no problems with this.
>
> Btw, I thought that aclfgl_ is reserved for Aubit library functions - maybe
> in context of user functions it should be something like a4gl_ or 4gluser_
> ?
>
> > -----Original Message-----
> > Subject: [Aubit4gl-developers] aclfgl_ prefix for functions....
> >
> >
> > Good or bad thing ?
> >
> > Good - because it means that Aubit4GL have their own 'namespace' (well
> > nearly) and can't interfere with other libraries functions...
> >
> > Bad - because porting any existing 4GL code with any user-C functions
> > becomes a bit of a hassle as you have to rename them...
> >
> >
> > As a halfway house I came up with the syntax (open to renaming!):
> >
> > 	IMPORT INFORMIX C FUNCTION functionname
> >
> > which creates a aclfgl_... wrapper around an existing C function...
> >


=======================================================================


Doc4gl:


>    - The ability to load the processes from an unl file (command option
> --process_file=file_name).

example.unl:

ERP|ERP|The open source ERP||A description of the ERP
AP|Acc Payable|Accounts Payable|ERP|
AR|Acc Receivable|Accounts Receivable|ERP|
GL|General Ledger|General Ledger an Cash Book|ERP|
UTL|Utility|Menu system and application setup|ERP|
CM|Contact Management|Contact Management|ERP|
ASP|ASP|Application Service Provider|ERP|



>    - The html generation it have now:
>         - Parameters
>         - Return values
>         - Todo list
>         - Function prototype




> > Can you please summarize what is expected to work (which tags, and in
> > which context) and what not? You say:
> >
> >>    - The html generation it have now:
> >>         - Parameters
> >>         - Return values
> >>         - Todo list
> >>         - Function prototype
> >
> > which is fine, but does this mean nothing else is extracted or just that
> > it's not generated in current HTML output?
>
> Currently the status of the tags is:
>   @file - Loaded. There is nothing to generate.
>   @process - Loaded and generated.
>   @param - Extracted and generated.
>   @return - Extracted and generated.
>   @todo - Extracted and generated.
>   @table - Extracted and generated.
>   @author - Extracted but not generated.
>   @revision - Extracted but not generated.
>   @version - An alias to revision.
>   @deprecated - Extracted but not generated.
>   @depreciated - Does not exist. Where did you found it ?.
>
>



===========================================================================

As for the options - there are two mechanisms for loading forms into 4GL
1) Using XDR (the original mechanism)
2) Using libpacker (new generic handling)
To choose one - set
	A4GL_FORMTYPE=XDR
or
	A4GL_FORMTYPE=GENERIC

(Look for libFORM_xxx.so - there is also a NULL version for machines with no
curses library - largely superceeded by libUI_console.so

For quite a few of Aubits environment variables - there is little checking on
the value itself - but rather on the existance of the respective .so file)


XDR BTW - is a routine thats used by the standard Unix RPC to encode data for
going across the network - I nicked the outline for encoding the data so it
will write it to a file instead...

If you are using libpacker (the generic one) you can then choose which packer
you want to use :
A4GL_PACKER=...

There are currently 4 possible values (look for libPACKER_xxx.so)

PACKED	- a standard packed format - should be quite small output
PERL 		- a special format that generates a complex perl variable
XDR 		- another way to generate XDR format files
XML 		- The XML version


There is also  "libPACKER_MEMPACKED.so" - this is used internally and
shouldn't be selected...


The standard should be XDR or PACKED.



The XML version (Which is slightly crippled with its strings at the moment -
they are written in hex rather than as strings) is a sort of half-way house
XML.

The files generated by fcompile can be read by any standard XML tool, but the
code to import the data within Aubit4GL expects it to be in exactly the
original format generated - no extra lines, no less lines etc. I didn't want
to get into having to add a whole XML parser to aubit4GL...

=============================================================================

Two new environment variables

A4GL_SIMPLE_GRAPHICS
if set to Y then +,|,- will be used to draw graphics characters instead of
proper borders (if available)

A4GL_EXTENDED_GRAPHICS
If set to Y allows forms to contain the additional graphics characters
<,>,^,v, and + to be used for tee's and an  intersection...

So the following (view with fixed font!):

\gp--v--q\g
\g|  |  |\g
\g>--+--<\g
\g|  |  |\g
\gb--^--d\g

Will draw a box with an intersecting horizonal and vertical line..

Note - you'll need to set EXTENDED_GRAPHICS before you compile the form as
well as for the 4gl executable...


=============================================================================
Aubit was honouring the size y by x in the form, this has been removed.

If you require to specify the size, it can still be used by setting
A4GL_USE_FORM_SIZE=Y (using this is an aubit extension - and not default
informix behaviour!)


=============================================================================
I'm going to start work on some test scripts soon and I needed a mechanism for
doing some automated testing...

I've added two new environment settings

	export A4GL_KEYFILE=(some filename in DBPATH)
	export A4GL_KEYDELAY=(time in usec 1000000 = 1 second, defaults to 0.1s)



=============================================================================


In order to reduce the possibility of breaking something when fixing something
else, I've started to create a set of test scripts (as I said before) they
can be found in :

tools/test/build_tests

(Currently they just have numerical ids..)

We are going to need **a lot** of these - so feel free to add any you want to
run before we build a new release (I'm currently running these scripts before
I do a commit to sf).

All you need is a makefile which implements a 'run' (a 'compile' and a 'clean'
would be nice too though!)

Eg:

expr.4ae: expr.4gl
        4glpc expr.4gl -o expr.4ae

compile: expr.4ae

run: expr.4ae
        sh ./run_expr


(Here run_expr is a script which executes the .4ae and does a 'diff' on what
we get and what we expected...)


If you're going to add any - just make sure to keep them small and to the
point, I'd rather have 10 tests than one exceedingly complicated one...


To run them just 'cd' to tools/test/build_tests and 'sh run_tests'


It may be ncurses specific for some of the tests (checking colours etc) and
have only been done on linux (so far) - so don't be suprised if you get
failures on windows or other unix, we'll just need to sort them out as they
come along..


For access to databases - you can assume a database exists called 'test1' (you
can't assume it has any tables though!)


Note :
If you don't have CVS write access - just email them to me :

	buildtests@aubit.com

and I'll put them up..


=============================================================================


The easiest way to connect to an informix database is to install the informix
Client SDK.
You can then use set the A4GL_LEXTYPE environment variable :

$ export A4GL_LEXTYPE=EC

You should then be able to compile your programs :

4glpc myprog.4gl -o myprog.4ae

And it will write and compile a .ec file using esql

In your other message - you mentioned postgres - you can do this using ESQL/C
using ecpg..

You'll need to tell aubit :

export A4GL_LEXDIALECT=POSTGRES

(LEXDIALECT defaults to INFORMIX)


If you want to connect via ODBC - you'll need to install and configure and ODBC
driver - which very much depends on which one you choose...


=============================================================================

> Probably no for postgres - the ecpg needs to be the absolute latest CVS
> version which has support for the "-C INFORMIX" flag (IIRC).
> Also - this version relies on a few backend changes for more Informix
> compatibilty - some of which won't make it into the official postgres
> releases and will need special patches...
> All these are available (open source etc) - they are just not what most people
> will have..
>


=============================================================================

On Sunday 20 July 2003 7:58 am, Andrej Falout wrote:
>
> 1) What is the version number of required ecpg - so I can autoconf-igure
> for that?

Don't know - I'd just leave this out for now - most of the changes will be in
postgres 7.4 when it goes live...
So I'd probably wait and check for that..

>
> 2) Where are the PG patches required?

I'll load them up to www.aubit.com/aubit4gl

>
> 3) Is there a way to test if the patch was applied to postmaster? Maybe
> test for a particular function in particular library file?

Not to my knowledge (but I'm not handling that side of things)

>
> 4) Will PG patched like that handle all Informix SQL dialect, or...?
>
Almost all..
There are a couple of exceptions, serials don't return sqlca.sqlerrd[2] and
datetimes are synonyms for timestamp - so you can't datetime year to day..

> > so how do you get created serial?
>
> You need to look at the oid (like rowid) of the last row inserted, and
> reselect it IIRC.


>
> 5) What is the status of libLEX_CS at the moment?
Still in the planning stage..

>
> 6) Which C# compiler do you use? Mono? What is the name of the executable
> of the C# compiler I need to test for in configure?

Mono - however I've only managed to get this installed on my laptop - not my
development box

>
> 7) What is the easiest way to test this functionality?
>

Don't for now - Its still very experimental, it will be a fair while until its
usable

>
> While on the subject, do you plan to update SWIG definitions to re-enable
> Aubit Perl output?

Yes - mostly from .spec files



=============================================================================
> lib/libDATA_menu_list.so
> lib/libDATA_report.so
> lib/libDATA_struct_form.so

These are used by the generic packers to detail the format of the output and
are required for a binary dist.

> lib/libesqlhelper_funcs.so

This is a set of functions that copy from and to a native datatype and Aubits.
For example - decimal - Informix, Postgres and Aubit have different types for
this, we need to copy from the database type to something neutral (like a
string for example), then down to Aubit, or from Aubit to something neutral
and down to a database type.
When compiling Aubit down to esql/ecpg - you need to add -lesqlhelper_funcs to
get these included (otherwise you get missing A4GL_copy_datatype functions).
Depending on which database you are targetting - you'd use a different
esqlhelper_funcs..
The one thats there at the minute compiles fine for Informix and Postgres.

> lib/libXDRPACKER_menu_list.so
> lib/libXDRPACKER_report.so
> lib/libXDRPACKER_struct_form.so

These are used by the XDR packers (in the same way as the libDATA stuff is for
Generic) and are required for a binary dist.

==============================================================================

lib/libesql Should be there now

Can you remove any references to libesqlhelper_funcs and replace it with
	libESQL_INFORMIX.so
or
	libESQL_POSTGRES.so

as applicable...

etc.

We'll need to write something for SAP ESQL/C - to handle converting between
native (SAP) datatypes and Aubit datatypes....


The extralibs/esqlc directory should now be depreciated...

==============================================================================

Subject: Informix to PostgreSQL (JDBC)
From: "Nicolas Bazin" <nbazin@ingenico.com.au>
Date: Fri, 12 Apr 2002 10:31:16 +1000

Just to let you know that you can use the transfer tool of the hsqldb JAVA database to transfer database from Informix to Postgres. I have used it  to transfer my application from IDS 7.3 to Postgres 7.2.1. Because it relies on JDBC, it can be used/expended to support other databases.

It supports:
- tables structure creation,
- default field value,
- index creation (unique or not),
- data transfer,
- foreign keys creation,
- it supports schema (to read the source)
- autoincrement fields

As it's  based on JDBC, it cannot extract VIEWs or store procedures. User privilege are not created even though it is available from the JDBC.
A further extension would then be:
support of GRANT and also the possibility to transfer to a specific schema.

You can download it at http://prdownloads.sourceforge.net/hsqldb/hsqldb_1_7_0_RC4.zip
The transfer tool is independent of the database. It's in the src/org/hsqldb/util directory you also need the src/org/hsqldb/lib directory.


==============================================================================

I've added

	SCHEMA dbname

to aubit4gl...



On Thursday 17 July 2003 1:00 am, Andrej Falout wrote:
> I like this Genero "SCHEMA" thingy...
>
> There will be other very interesting ideas in Genero - especially  in web
> services and XML space... Hope they finish it in this century.
>
> Just FYI
>
> Yours, Andrej Falout, http://falout.org/disclaimer.html
> Project manager, Aubit project: http://aubit4gl.sf.net
> Business Data Architect, http://encos.com
> HTML formatted email sent to me WILL BE DELETED AUTOMATICALLY
> PLEASE NOTE: afalout<at>xtra.co.nz account will expire soon.
> Please use andrej<at>falout<dot>org for all correspondence.
>
> -----Original Message-----
> From: owner-fourjs-users@4js.com [mailto:owner-fourjs-users@4js.com]On
> Behalf Of Michael Horst
> Sent: Thursday, 17 July 2003 04:46
> To: fourjs-users@4js.com
> Subject: Re: [fourjs-users] Re: DATABASE compiler directive
>
> Schmid, John wrote:
> >database development         # These could be in a globals.4gl file.
>
> This will force a connection to "development" at startup.
> It may fail at client side.
>
> The only way of making 4gl independent from database name is
>
> ----- with Genero:
> SCHEMA development
> MAIN
>     ...
>   DATABASE MyDeploymentDb
>     ...
> END MAIN
>
>
> ----- With BDL and Genero:
> DATABASE development
>
> FUNCTION main()
>     ...
>    DATABASE MyDeploymentDb
>     ...
> END FUNCTION
>
> In both cases fglrun will find main and starts up
> the same way except
>
> # does not make database connect
> FUNCTION main()
> END FUNCTION
>
> # includes database connect.
> MAIN
> END MAIN
>
> HIH Michael
>
> >define ...
> >
> >main
> >   # Get the actual name from the environment
> >   let other_db = fgl_getenv("MY_DATABASE")
> >   database other_db
> >   ...
> >end main


=====================================================================

http://groups.google.co.nz/groups?dq=&hl=en&lr=&ie=UTF-8&threadm=akipag%24t0m%241%40terabinaries.xmission.com&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.databases.informix


http://groups.google.co.nz/groups?dq=&hl=en&lr=&ie=UTF-8&threadm=3D6CE406.3040007%40hotmail.com&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.databases.informix

=====================================================================

On Saturday 26 July 2003 4:57 am, Andrej Falout wrote:
> I set up an A4GL_LEXDIALECT=SAPDB. (in 4glc - not in 4glpc)
>
> Surprisingly, it compiled everything I tried. Complains only on invalid SQL
> statements not supported by SAP DB.
>

> >
> > Most of the stuff should be very easy now a lot of work has been done for
> > postgres's ecpg...
> >

You'll probably find some of the invalid statements were invalid in postgres
and some work around has been added:


A4GL_USE_INDICATOR=YES
Adds indicators to SQL statements to check for nulls


A4GL_ESQL_UNLOAD=YES
Uses UNLOAD within ESQL if supported


A4GL_USE_ALIAS_AS=YES
Uses the 'AS' keyword for select column aliases , eg

select tabid tid from systables -> select tabid AS 'tid' from systables


A4GL_FIXUPDATE=YES
Rewrites the Update (col1,col2,col3)=(val1,val2,val3) -> update
col1=val1,col2=val2,col3=val3



A4GL_SQL_CURRENT_FUNCTION=somename
When SQL encounters CURRENT  - it calls this function instead with two string
parameters ('START' to 'END')

select current year to minute from systables where tabid=1 ->
select somename('year','minute') from systables where tabid=1



A4GL_OMIT_NO_LOG=YES
This does not include the ' WITH NO LOG' at the end of a create temp table
when the original SQL does.
create temp table a(a integer) WITH NO LOG ->
	create temp table a(a integer)



You'll also need to write a a4gl_esql_sapdb.h and edit a4gl_esql.h to include
it.
If you don't - it defaults to using informix's version

You'll also need to create an esqlhelper_funcs version to copy between sapdb
datatypes and aubit datatypes..
> > The first thing to do is write an esqlhelper_funcs routine (most of which
> > will be the same as the existing one...)



===========================================================================


I just committed SQLite ODBC driver and native connector plug-in support for Aubit compiler.

http://www.hwaci.com/sw/sqlite/

From the home page:

"SQLite is a C library that implements an embeddable SQL database engine. Programs that link with the SQLite library can have SQL database access without running a separate RDBMS process. The distribution comes with a standalone command-line access program (sqlite) that can be used to administer an SQLite database and which serves as an example of how to use the SQLite library.

SQLite is not a client library used to connect to a big database server. SQLite is the server. The SQLite library reads and writes directly to and from the database files on disk."

This should be the easiest way to get database support for Aubit so far - SQLite is a full SQL database engine (RDBMS) in single shared library. Key advantages over traditional RDBMS like MySQL, PostgreSQL or Informix are:

1) No need to install/configure ANY database engine to use/compile/develop with Aubit compiler - just drop one library file on your system, and you have database engine to use!

2) When using native connectivity to SQLite - no messing with database connectivity - no ODBC, no ESQL/C - nothing to do and nothing to go wrong. When using ODBC, I hope that following provided instructions should be simple enough.

3) You can create self sufficient distribution of your 4GL application - compile your 4GL code with Aubit compiler, add that and Aubit run-time (which will include SQLite engine library) to your package and your users/customers will be able to install and run your app in no time. You can even distribute your app with demo database with demo data.

4) Exchange of databases - SQLite databases are stored in just one file, and this file is portable between systems. This among other applications will be great for debugging.

5) SQLite is EXTREMELY fast, even faster then MySQL

Limitations:

a) See SQLite home page for SQL language limitations. Very few.

b) I did not see this explicitly stated, but I assume that SQLite is a single-user database.

TO-DO:

* Find out why Aubit generates "Error: Could not disconnect from database" when program exits.
* Test SQL compatibility
* use $DBPATH to find SQLite .db file, so that user don't have to specify full path & file name in DATABASE statement. Append .db extension automatically. DATABASE 'xyz' should be resolved to <full_path>xyz.db before calling dbopen()

HOW-TO
------

This instructions are for Linux/Intel, RPM based distributions ONLY.

0) update Aubit source code (from CVS or tgz file once it's refreshed)

1) Only if you wish to use ODBC connection:
If you are not sure if you have unixODBC or iODBC ODBC manager installed, run "./configure" to find out. Examine it's output, you should see:

Checking for iODBC support:
checking for main in -liodbc... yes

and/or

Checking for unixODBC support:
checking for main in -lodbc... yes
checking for sql.h... yes
checking for sqlext.h... yes
checking for odbcinst.h... yes

If you don't, install iODBC or unixODBC manager. SQLite ODBC driver uses there header files to compile, and on top of that, links created ODBC driver library with manager libraries. Don't ask why... Aubit native SQLite plug-in uses ODBC headers from Aubit source code tree, and does not link with anything other then SQLite itself, so you don't need to install anything else.

You can try using "make install.iodbc" and/or "make install.unixodbc"

1b) If you did not allready (in step 1), run ./configure to refresh make files.

2) Install SQLite: "make install.sqlite"

3) Install SQLite ODBC driver: "make install.sqlite.odbc" if you wish to use SQLite ODBC connector.

4) run "./configure". This will check for SQLite and SQLite ODBC driver, create SQLite test database (in tools/aubit.db) and add needed entry in your /etc/odbc.ini - you will need to be user "root" to do that! You should see:

Checking for SQLite library support:
checking for sqlite... /usr/bin/sqlite
checking for main in -lsqlite... yes
checking for sqlite.h... yes
checking for sqlite_libversion in -lsqlite... yes
checking for default SQLite database... Created in tools/aubit.db

Checking for SQLite ODBC library support:
checking for main in -lsqliteodbc... yes
checking for default SQLite odbc.ini entry... Added

5) run "make clean.all; make" to create Aubit SQLITE ODBC plug-in and compile Aubit source code.

6) run "make install"

7) run "test.sqlite". You should see message:

	"Aubit native connection to SQLite successful."

  If you installed SQLite ODBC, run "test.sqlite.odbc". You should see message:

	"Aubit connection to SQLite via ODBC successful."

Let me know if you don't...

Note: to use SQLite ODBC connection from your 4GL code, you will need to make sure that
A4GL_LEXTYPE=C and A4GL_SQLTYPE=sqliteodbc when compiling/running your 4GL code.

To use SQLite native connector, set A4GL_LEXTYPE=C and A4GL_SQLTYPE=sqlite (or A4GL_SQLTYPE=sqliteS for statically linked one)

Aubit native SQLite plug-in is built in two variants; dynamically linked against SQLite (libSQL_sqlite.so) and statically with SQLite engine (libSQL_sqliteS.so). Static one is primarily intended for distribution with Aubit binary distros (tgz, rpm and Windows installer).

Note #2: Aubit native SQLite connector plug-in is really a cheat: Aubit ODBC connector is linked together with modified code of SQLite ODBC driver to create it. So Aubit code calls API_sql, which calls Aubit ODBC plug-in code, which calls SQLite ODBC code, which calls SQLite library functions. I could make it a separate plug-in by replacing the ODBC calls with actual code form ODBC driver, but because of the nature of how SQLite works, I can see no motivation to do so.

Some hints:

If your connection via ODBC fails (with a message like "Error: Could not connect to database" from Aubit programs) use "isql" (this is NOT Informix "isql" - it's part of unixODBC package) tool to test your ODBC connection (if you installed unixODBC) or Aubit provide tools in "tools/odbctest"

Use "sqlite" tool to manipulate SQLite databases (see "sqlite -help"). You could also use Aubit provided equivalent of dbaccess, called misql.4ae (see tools/adbaccess) or your favorite ODBC front-end.

Why should you care about Aubit ODBC plug-ins for specific ODBC RDBMS sources, when you can connect to any ODBC source using ODBC managers anyway: Because not everyone will have ODBC manager installed on all systems.

Why should you care about native connectors, when you can connect via ODBC: Because ODBC connectivity, both direct and via ODBC managers will require ODBC driver for particular RDBMS to be installed on the system.

Why should you care about ODBC connectivity when you have native plug-in: because when using native plug-in you will only be able connect to that particular RDBMS at the same time, since Aubit does not have connection management (yet). OTOH, ODBC manager do, so you can open and use connections to different RDBMS at the same time.

Why should you care about any other method of connection to RDBMS when you can use Aubit ESQL/C output to perform connectivity (informix, PostgreSQL and SAP DB): Because code compiled that way will be able to connect ONLY to that RDBMS, and will need full recompile to change back-end RDBMS.

Why should you care about ESQL/C output, when you have native/and or ODBC connectors: because native ESQL/C compilers can work much close to the RDBMS API, allowing target-specific functionality not possible via ODBC or connection library API. For example, by using Aubit PostgreSQL EC output, your code can use most Informix specific SQL statements against PostgreSQL RDBMS (note: requires latest CVS version of PostgreSQL EC compiler (V 3.0), and patched PostgreSQL engine - at the moment, untill 7.4 is released)

============================================================================

PostgreSQL Informix comatibility:

> can you please comment on level of Informix SQL dialect compatibility that PG patched this way will have? Exceptions?
>
> Also, what are the chances to get this patches accepted in PG CVS?

We haven't done too much towards dialect compatibility;

update foo set (c1,c2,...) = ( v1, v2, ...) is now supported
select .... into table is somewhat supported
some aliases for things like today have been added
load/unload ala informix have been added
where current of on a with hold cursor is functional.

much of the compatibility is realized with ecpg.

There still remains a fundamental difference in the way postgres handles
transactions ( ie MVCC)

some of these patches may never make it into CVS, they likely won't make
it for 7.4, we were too late.

Dave

> > the major ones are in the tarball, load-HEAD.diff, and wherecur.diff.gz
> >
> > I will make a single unified diff and send it to you.
> >
> > At this moment there is no license information on them, but they retain
> > my copyright.
> >
> > Dave Cramer <dave@fastcrypt.com>
> > fastcrypt
>


> Is this patch expected to work against current PG CVS or do I need a particular version?
not cleanly, but you can try, it was synched a few days ago, but
postgres is changing fast.
>

Besides, this patch will be very unstable until 7.4 is released. It will
be more trouble to them than it's worth.



==========================================================================

A4GL_PRINTSCRKEY=...
This specifies a key to be used to trigger the automatic screen dump, an
example might be

export A4GL_PRINTSCRKEY=CONTROL-P
export A4GL_PRINTSCRKEY=F10


A4GL_PRINTSCRFILE=...

	This specifies the filename to output the screen dump to.
	This file will be overwritten by each subsequent screen dump operation
(perhaps this should be appended to - but for now - its overwritten)

	If this filename begins with a pipe character '|' - its pipe'd to a command
rather than a file.

Examples
	export A4GL_PRINTSCRFILE=mja1.out
		# print to a file called mja1.out

	export A4GL_PRINTSCRFILE=/tmp/abc123
		# print to a file called /tmp/abc123

	export A4GL_PRINTSCRFILE="|lp -s"
		# print to a 'lp' so it arrives on the printer (-s for silent mode)


The PRINTSCRFILE will also be used when calling aclfgl_dump_screen with no
parameters...



main
	display "Hello World" at 1,1
	CALL aclfgl_dump_screen()
end main


if no PRINTSCRFILE is specified and aclfgl_dump_screen is called the call will
be ignored.

You can't set PRINTSCRKEY and not specify PRINTSCRFILE !


=============================================================================


> I have some C libraries. How can i use the functions
> in those libraries in my Aubit programs?.
> How can i indicate to 4glpc for including those
> libraries in my Aubit-4gl program?
> Or does exist a way for calling my C libraries in my
> 4GL programs?


There are lots of ways the two most common :


1) You can use code and endcode, this embeds C code within the generated .c
file:

eg

Either write a wrapper :

FUNCTION fgl_print(a)
DEFINE a integer
code
/* This is normal C */
printf("a=%d\n",a);
endcode
# And back to 4GL
END FUNCTION



This is nice because it gives you a lot of flexibility in what can be handled,
but you still get 4GL to pop all the arguments off the stack so that
'fgl_print' can be used as a wrapper directly in your 4GL code...

Or  just call it direct (if the function is called multiple times - just wrap
each call in a 'code/endcode')





The other is to use 'import function', this has the limitation that the
function you are calling should have parameters which are all integers
(pointers like 'FILE *' etc can be treated like integers- but basically it
does a pop_int on them ...)


		import function ftell(1)

where the '1' is the number of these integer parameters...

This generates :

A4GL_FUNCTION aclfgl_ftell (int nargs) {
long _argc[1];
long _retval;
   if (nargs!=1) {a4gl_status=-30174;A4GL_pop_args(nargs);return 0;}
   _argc[0]=A4GL_pop_int();
_retval=(long)ftell(_argc[0]);
   A4GL_push_int(_retval);
   return 1;
}


Also - notice the aclfgl_.. prefix on the function - you'll need to use that
if you want to call your 4GL functions from within C.

This generates the code for a 4GL ftell function, which can be called.

In both cases - you'll need to append any libraries to the compile line
(normally using a -L to specify where to find it and a -llibname, just like
with gcc)

4glpc test1.4gl -o test1 -L/usr/local/lib/somelibsdir -lsomelib





Also - don't forget if you go the route of writing wrappers - you can compile
those into a callable shared library/dll.

Heres an example :

uid.4gl (which contains all our wrappers) :


	function wrapper_for_getuid()
	define a integer

	code
	a=getuid(); /* a standard unix function */
	endcode

	return a
	end function


$ 4glpc --as-dll uid.4gl -o libuid.so

We can then use this wrapper whenever we like *without* having to do anything
on our 4glpc line :

test1.4gl :

main
define a integer

        let a=uid::wrapper_for_getuid()

        display "UID=",a

end main



$ 4glpc test1.4gl -o test1
$ ./test1


The only problem with this is that at the minute - if it can't open the DLL
for some reason, or it can't find the function - you get a rather unhelpful :

Err:Program stopped at 'test1.4gl', line number 3.
Error status number -3001.
Wrong number of variables returned from function.



If you want to do this - have a look at the lib/extra_libs directories (eg
pop)

lib/libui/ui_gtk/assist.4gl gives examples of the code/endcode..


============================================================================

Aubit enhancement I'm afraid -

IF exists (select * from systables where tabid=a) then
	DISPLAY "There is a table with that ID"
END IF

On Monday 06 October 2003 5:28 am, Andrej Falout wrote:
>          if exists = 0 then
>
> |__________________^
> | Error at line 161, character 20
> | syntax error, unexpected EQUAL, expecting OPEN_BRACKET (=)
>
> Works with Informix, 4Js and Querix
>
>===========================================================================


> > I like my SELECT .. USING
>
> What is that?

database test1
define lv_systables linked to  systables primary key (tabid)

main
let lv_systables.tabid=1
select using lv_systables
display "Hello World : ",lv_systables.tabname
end main


Linking a table to a record (something you don't normally do in 4GL).
Here lv_systables is LINKED to the systables tabid - which has a primart key
of tabid (there should be support for multiple columns for the primary key -
but I'm not sure if thats implemented).


Anyway - using that you have

	INSERT USING lv_systables
	SELECT USING lv_systables
	UPDATE USING lv_systables
and
	DELETE USING lv_systables


(I'm not sure if the INSERT is implemented - but it can be if its not)

Basically - the compiler knows that tabid is the primary key - so that needs
to be set before a SELECT, UPDATE or DELETE,  it just generates the
appropriate WHERE x=y automatically...

eg
SELECT USING lv_systables == SELECT * into lv_systables.* from systables where
lv_systables.tabid=tabid


Further enhancements would be something like:
INSERT OR UPDATE USING lv_systables

where it would check to see if the row exists first, and then either insert it
or update a current entry

I'd like to extend this to linking records to other records too later on.


===============================================================================


TODO: write about ASSOCIATE stuff introduced in I-4gl 7.31

================================================================================

Its a throwback to being able to compile plexus reports

These can have lines like :

	PRINT mv_doc_type AT 0.6 INCHES; " "; mv_doc_desc;

I'm not exactly sure how it can be removed...
(I'll have a look - but its not #1 in my list of priorities)

=================================================================================

> BTW - I think I asked this onece, but does Aubit not need unique cursor
> names within a modile? It does not chech...
>


Nope - it doesn't care - do you think we should make it ?

===================================================================================












Logical reports
---------------

Logical reports take the print statements in an unmodified REPORT and log whats printed and the section in which its printed to a meta data file.

The report 'function' is unchanged - but the calling procedure is enhanced to include :

	START REPORT report-name TO CONVERTABLE 

as well as the familiar TO PIPE/TO FILE etc

This creates the meta data file (in /tmp) which can be processed later.

The processing is done via the "finish report" statement, "convert report" statement or via an external program "process_report". 

The enhanced FINISH REPORT now accepts the following syntax :



	FINISH REPORT report-name CONVERTING TO "filename" AS "type" [ USING "layout" ]
	FINISH REPORT report-name CONVERTING TO MANY


Converting to "filename"
------------------------
"type" can be any one of the conversions available on the system. 

These are in $AUBITDIR/lib called libLOGREPPROC_*.[so/dll]
On an average system you may have :

	libLOGREPPROC_CSV.so
	libLOGREPPROC_PDF.so
	libLOGREPPROC_TXT.so

This means you can process types of  "CSV", "TXT" or "PDF"
A special name of "SAVE" can also be used which copied the data verbatim from the meta data file into the filename specified. This file can then be used with the layout editor and/or the process_report program.

If USING "layout" is omitted a default layout will be used.



Default layouts
For PDF and TXT it is safe to setup a default layout.

These can be put in the $AUBITDIR/etc directory and have a .lrf extension.
The filename is made up of combinations of program/module/report name and the width of the page (<=80 = narrow <=132 = normal >132 = wide). The search order is complex - but basically it depends on :

 	program_module_report_type.lrf
 	program_report_type.lrf
 	program_module_type.lrf
 	module_report_type.lrf
 	report_type.lrf
 	module_type.lrf
 	program_type.lrf

If none of these are found - then it looks for

	default_type_narrow.lrf
	default_type_normal.lrf
	default_type_wide.lrf

depending in the width

Finally - it will use

	default_type.lrf


(Where type is PDF, TXT or CSV for example)

To create one of these defaults - use layout_engine (for PDF and TXT, you can edit using any meta data file as an input)



Converting to many
------------------
This allows multiple conversions. The meta data file is not automatically deleted so it is possible to use the same meta data to generate a text file, CSV output and PDF if required.

To do this you need to use the CONVERT statement


	CONVERT REPORT rep-name TO "filename" AS "type" USING "layout"

again - USING "layout" is omitted, one will be generated automatically..

Once you've done all your conversions, free report will delete the meta data.



Examples :

	start report r1 to convertable
	output to report r1 (1,2)
	finish report r1  converting to "myfile1.pdf" AS "PDF" using "layout1"


	start report r1 to convertable
	output to report r1 (1,2)
	finish report r1  converting to "myfile2.pdf" AS "PDF"  # uses default layout

	start report r1 to convertable
	output to report r1 (1,2)
	finish report r1  converting to many
        convert report r1 to "orig.output" AS "SAVE" 
        convert report r1 to "myfile3.pdf" AS "PDF"  
        convert report r1 to "myfile4.txt" AS "TXT"  
	free report r1




Saved Meta Data

There are 3 things you can use with the meta data

1) The Report Viewer
------------------------

This is a GTK2.0 application which displays the contents of the report in a 
tab'd window (one tab per page) - you can't print or anything, but its useful 
to see whats been put out in the meta data file and is used as the basis of 
the next app..

By default - it will only show you the first 10 and last 10 pages  (if your 
report is only 5 pages long - you'll still only see 5 pages!) - this is 
basically to limit the impact of a very large report in terms of creating GTK 
widgets!

You can change this by changing the MAX_PAGE and MIN_PAGE in 
report_viewer/report_viewer.

Invoke using :
        $ report_viewer filename

Where filename is the meta data file (ie the START REPORT TO "filename")

You will probably note that you can click on sections of the report and they 
change colour. These define the printed elements. When you click on an 
'element' everything that the report considers to be printed in the same 
place in your 4GL (not based on lines/columns etc) is highlighted..

Also - there is a series of '>' going down the left hand side - these indicate 
the block in which those elements are printed. Again clicking on one of these 
highlights all lines printed within that block (i have not done anything 
about have a print ... ; in an after then have a print in an on every row 
etc)

There is some debugging stuff which is printed to stdout (ie from the window 
you ran the application from) which will eventually be removed...




2) The layout editor
------------------------------

This is another GTK2 application which embeds the report viewer and allows you 
to edit a logical report output.

ATM - there are only two coded report output types :

        CSV
and
        TXT


Although all of the code has been abstracted into shared libraries :

        libLOGREP_???.so

You can't edit the TXT layout at all - so you get a 'no configurable options' 
for that.

For CSV mode - the libLOGREP creates a series of tables - one for each block 
which has seen something printed in the output...
(Eg before group/after group/ page header/on every row)

You can then drag&drop information from the report viewer into these tables to 
generate the report layout. Double clicking a cell removes the contents of 
that cell..

At the minute you are limited to 10 cells across - this will be changed to use 
a spin button like the number of lines...


You can use the 'Default' menu option to create you a default layout which you 
can then play with.

Unfortunately - the layout is indicated by using the block and entry ID for 
the printed output - so you'll see things like "0/1", "1/4" in the layout 
editor - if you want to see what they represent, a single click will 
highlight that section on the report viewer...

You can load a layout using the menu option..
When you're happy - save the file using the menu options...


Invocation :

$ layout_engine type filename

Where type is TXT or CSV (more to be added later!) and filename is the 
original 4GL report output (just like for the report_viewer)

eg

$ layout_engine CSV /tmp/r1.out

You can't change the report you're editing or the type from within the layout 
engine - you'll need to start it again.

All load/saves within the layout editor refer to the layout file - not the 
meta data report file!!!

An extension .lrf ( Logical Report Format) is used when it thinks its 
required...



3) The report processor

This a text mode application which takes a report meta data file and a report 
type and renders the report to the required output type with an optional 
layout file...

This is abstracted behind a shared library just like the report layout but its 
called libLOGREPPROC_?.so


If no layout file is supplied then a default one is generated before the 
report is processed...

Invocation

        $ process_report type filename 
or
        $ process_report type filename layoutfile



The output is currently stored in a temporary file (the name of which is 
displayed when the process completes)





Tips for CSV layouts

Copy to the same block type - the only exception might be for BEFORE GROUP OF 
to duplicate these details in an on every row..

========================================================================

