Re: blob in embedded c code
Mike Aubury <[email protected]>
| Newsgroups | gmane.comp.lang.4gl.aubit.general |
|---|---|
| Message-ID | <CAGAq4WErJeJwP2caqqHiwKzxAY0SKjteXPRq=utiq7rjqfhTaw@mail.gmail.com> |
Arrays start from 1 in Aubit4GL and informix 4gl.. Internally - it should subtract 1 in the C code generated - because in C - arrays start at 0 - but you should never see that in 4gl.. If you have Aubit4GL doing something different - let me know - it will be a bug.. For Prompts - they are done in Screen mode when A4GL_UI=TUI - you can set (as you say) A4GL_UI=CONSOLE - and it will use the console mode (no windows/screens). This should use "fgets(..,stdin)" internally for the prompts , printf's for displays etc.. For clearing the program at exit - this is 'ncurses' restoring the original session, and will depend on your terminal type. You can try setting : export NO_ALT_SCR=Y and see if that helps. This trys to turn off ncurses alternate screen mode - but again - it will depend on the terminal type. On 11 January 2012 10:28, Michal Hajek <[email protected]> wrote: > It looks nice, thanks :-) > > I was using Informix 4gl for over 10 years, but now I do not have it > on new server, so I migrate some small projects/programs to Aubit. > > Till now, I really do not like two things > - prompt clears screen (and yes, i know about the A4GL_UI, but it does > not solve the problem) (and, relative problem, a4gl clears screen on > program end, not very nice too) > - arrays are not comaptible between i4gl and aubit - one start from 1, > the other one from 0. This is nasty. > > Can these things be changed anyhow (via different aubit compiling > settings or something else)? > > Thanks once again, > Michal > > > > On Wed, Jan 11, 2012 at 10:57 AM, Mike Aubury <[email protected]> > wrote: > > There are "A4GL_file" and "channel" libraries you can use. > > > > Using the "A4GL_file" library is just a wrapper around fopen & friends - > so > > might be more familiar if you know 'C' - eg : > > > > > > { > > This is example for new SHARED handling of libraries - old method was > > removed > > (which looked bad) and introduced the "::" syntax as per perl > > > > This code uses library from lib/extra_libs/file for file handling as an > > example. > > } > > > > main > > define afile integer > > define fsize integer > > define buff CHAR(80) > > > > WHENEVER SQLERROR CONTINUE > > WHENEVER ERROR CONTINUE > > WHENEVER ANY ERROR CONTINUE > > > > CALL A4GL_file::fopen("file.4gl","r") returning afile > > > > IF afile=0 THEN > > ERROR "Unable to open a file called 'file.4gl'" > > 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 > > > > end main > > > > > > [ You can see the sourcecode in lib/extra_libs/file ] > > > > > > > > Its also very easy for you to write your own extension libraries that use > > the "::" format - just compile your normal 4gls with : > > (Assuming a unix platform) : > > > > 4glpc --as-dll -o somelib.so somelib.4gl > > > > You can then reference any 4gl function in this "somelib" directly in > code > > (so long as its on the LD_LIBRARY_PATH) > > CALL somelib::somefunc(1,2) > > > > > > Nice thing about this is that there's no direct link between somelib and > the > > the usage in your 4gl - so you can embed code in there that will change > > often - and you wont need to recompile your .4ae/.4ge's :) > > > > In fact - "somelib.so" doesn't even need to exist when you compile your > 4gl > > that uses it ! > > > > > > > > > > > > > > > > On 10 January 2012 18:46, Michal Hajek <[email protected]> wrote: > >> > >> Thanks for your comment .-) > >> > >> Is there any way how to write/append to files without C code and not > >> using reports? Such Aubit native 4gl functions would be handy. I drop > >> into C just for the files operations. > >> > >> Michal > >> > >> On Tue, Jan 10, 2012 at 4:53 PM, Mike Aubury <[email protected]> > >> wrote: > >> > Excellent :) > >> > Yes - it downshifts all the variable names used in 4gl (which is case > >> > insensitive) - but always leaves everything in the code..endcode > >> > completely > >> > unchanged.. > >> > > >> > > >> > (The other potential "gotcha" when dropping into c is the prefix > >> > (aclfgl_) > >> > we apply to function names to stop them clashing with the builtin C > >> > functions..) > >> > > >> > > >> > > >> > On 10 January 2012 15:14, Michal Hajek <[email protected]> wrote: > >> >> > >> >> Eh, solved. > >> >> > >> >> Compiler downshifts the varnames - but not insinde code section and > the > >> >> address of the text is xxx.ptr (name "ptr" found in headers in incl > >> >> directory). > >> >> > >> >> ok=printf("%s\n",xxx.ptr); > >> >> > >> >> seems to be ok. > >> >> > >> >> Michal > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > ------------------------------------------------------------------------------ > >> >> Write once. Port to many. > >> >> Get the SDK and tools to simplify cross-platform app development. > >> >> Create > >> >> new or port existing apps to sell to consumers worldwide. Explore the > >> >> Intel AppUpSM program developer opportunity. > >> >> appdeveloper.intel.com/join > >> >> http://p.sf.net/sfu/intel-appdev > >> >> _______________________________________________ > >> >> Aubit4gl-discuss mailing list > >> >> [email protected] > >> >> https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss > >> > > >> > > >> > >> > >> > ------------------------------------------------------------------------------ > >> Write once. Port to many. > >> Get the SDK and tools to simplify cross-platform app development. Create > >> new or port existing apps to sell to consumers worldwide. Explore the > >> Intel AppUpSM program developer opportunity. > appdeveloper.intel.com/join > >> http://p.sf.net/sfu/intel-appdev > >> _______________________________________________ > >> Aubit4gl-discuss mailing list > >> [email protected] > >> https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss > > > > > > > ------------------------------------------------------------------------------ > Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex > infrastructure or vast IT resources to deliver seamless, secure access to > virtual desktops. With this all-in-one solution, easily deploy virtual > desktops for less than the cost of PCs and save 60% on VDI infrastructure > costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox > _______________________________________________ > Aubit4gl-discuss mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss > ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Aubit4gl-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss