Re: D4GL extension name and correct running. What has to do one with the
Posted in 2000
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
Warning: I know bugger all about D4GL!
But: try deleting all intermediate files and the final compiled file and
then recompile.
From: Evelio Mart'nez <programacionaf@sinix.net>
>
>This is a multi-part message in MIME format.
Please don't post MIME.
>--------------01C78571E8DA813B7FAAD737
>Content-Type: text/plain; charset=iso-8859-1
>Content-Transfer-Encoding: 8bit
>
>
>Hello.
>
>Poltergeist exists!
>
>I have attached a simple program (a.4gl) that call our own C function
>varamb().
>
>If I run the program with
>$ fglrun ./a.42r I have a memory fault(core dumped) when it>executes the varamb function.
>
>If I run the program with
>$ fglrun ./a I works ok>
>1) What has to do bacon with speed ?
>
>2) Any logical explanation, will be very much appreciated.
>
>- SCO 5.0.5
>- D4GL 3.00.UC1
>- SE 7.23.UC13
>
>--
>Evelio Mart'nez
>Tel: +34 96 337-95-80
>Fax: +34 96 337-81-18
>
>
>--------------01C78571E8DA813B7FAAD737
>Content-Type: text/plain; charset=us-ascii;
> name="a.4gl"
>Content-Transfer-Encoding: 7bit
>Content-Disposition: inline;
> filename="a.4gl"
>
>main
>
>--# call fgl_init4js()
>--# if fgl_fglgui() then
>--# call fgl_winmessage( "No por mucho madrugar ...", "info", "h")
>--# if fgl_wtkclient() then
>--# call fgl_winmessage( "WTK", "stop", "h")
>--# end if
>--# end if
>
>open window kk at 5,5 with 5 rows, 50 columns attribute (border)
>
>menu "f4gl"
> command "Usuario"
> call usuario()
> command "Tty"
> call tty()
> command "Entorno"
> call entorno()
> command "Salir"
> exit menu
>end menu
>
>
>end main
>
>function usuario()
>--------------------------------------------------------------------------------
>define
> usu char(8)
>
> let usu = c_logname()
> display "usuario: ", usu at 2,2
> error "No por mucho madrugar ..."
> sleep 1
>end function
>
>function tty()
>--------------------------------------------------------------------------------
>define
> tty char(15)
>
>let tty = c_ttyname()
>display tty sleep 1
>end function
>
>function entorno()
>--------------------------------------------------------------------------------
>define
> entorno char(128)
>
>let entorno= fgl_getenv("TERMCAP")
>display entorno clipped sleep 1
>let entorno= varamb("TERMCAP")
>display entorno clipped sleep 1
>end function
>
>--------------01C78571E8DA813B7FAAD737
>Content-Type: text/plain; charset=iso-8859-1;
> name="obsoletas.c"
>Content-Transfer-Encoding: 8bit
>Content-Disposition: inline;
> filename="obsoletas.c"
>
>/* RUTINAS QUE EN LA VERSION 7 YA NO SON NECESARIAS.
>
>SE MANTIENEN POR COMPATIBILIDAD CON VERSIONES ANTIGUAS.
>
>SI SE QUIEREN ELIMINAR, HAY QUE :
>
>- Eliminar de este fichero las que no se deseen.
> Si son todas, quitar este fichero de macro CREA
>- Quitar las correspondientes referencias en fgiusr.c
>- En los programas 4GL que las utilicen, reemplazar por la
> funci'n que corresponda, o simplemente eliminar, seg'n el caso.
>
>*/
>
>#include <stdio.h>
>#include "comun.h"
>
>/************************************** ALLOCAREA
>
>Estas rutinas correg'an el error interno -4518 de la versi'n 4.00
>Se pueden simplemente eliminar.
>
>****/
>
>ENTERO_4GL get_allocarea() { retint(0); return(1); }
>ENTERO_4GL set_allocarea() { ENTERO_POPINT n; popint(&n); return(0); }
>ENTERO_4GL chk_allocarea() { retint(0); retint(0); return(2); }
>ENTERO_4GL log_allocarea() { return(0); }
>
>/************************************** KEYERIC
>
>Se puede reemplazar por fgl_lastkey(), que devuelve lo mismo.
>Aparte de las estructuras, muy pocos programas llaman a esta funci'n.
>
>****/
>
>/*
>keyeric()
>{
>extern short eflastkey;
>retint(eflastkey);
>return(1);
>}
>*/
>
>keyeric()
>{
>retint(fgl_lastkey());
>return(1);
>}
>
>/******************************************** VARAMB
>
>Se puede reemplazar por fgl_getenv().
>
>****/
>
>varamb()
>{
>char nombre[80];
>popquote(nombre,sizeof(nombre));
>cortatira(nombre);
>retquote( getenv(nombre) );
>return(1);
>}
>
>/******************************************** LOGNAME
>
>Se puede reemplazar por fgl_getenv("LOGNAME").
>
>****/
>
>c_logname()
>{
> retquote( cuserid(NULL) );
>/* no se como le funciona a Jaume.
> logname no esta en las librerias del sistema.
> Probablemente venga del Xenix.
> cuserid si esta tanto en OpenServer como en UnixWare.
>*/
>// retquote( logname() );
>//retquote( getenv("LOGNAME") ); // esto seria lo mismo
>return(1);
>}
>
>
>--------------01C78571E8DA813B7FAAD737
>Content-Type: text/plain; charset=iso-8859-1;
> name="varias.c"
>Content-Transfer-Encoding: 8bit
>Content-Disposition: inline;
> filename="varias.c"
>
>
>/* RUTINAS VARIADAS PARA PROPOSITOS DIVERSOS */
>
>
>#include <stdio.h>
>#include <string.h>
>#include "comun.h"
>
>/*************************************************** DIMVEN
>
>Dimensionamiento de ventanas. LLamada desde utilidades.
>
>Hay un problema con esta rutina, y es que parece ser que si el formato
>tiene en alguna de sus l'neas espacios "invisibles" por la derecha,
>a veces no dimensiona bien. Puede deberse a que las variables con 80
>son demasiado cortas y si hay una l'nea m's larga se descontrola.
>
>Conviene mirarlo la pr'xima vez que se revise alguna de estas rutinas.
>
>***********************************/
>
>dimven()
>{
>FILE *fi ;
>char linea[80], lineaant[80], nombre[80];
>ENTERO dentro,lon,nlin,ncol,llv,plv,i;
>
>DEPURAR("dimven\\n");
>
>/* recoger el nombre del fichero que contiene el formato */
>popquote(nombre,sizeof(nombre));
>cortatira( nombre );
>
>/* abrir el fichero */
>fi=fopen(nombre,"r") ;
>
>/* si no existe, devolver ceros y salir */
>if ( fi == NULL ) { retint(0); retint(0); retint(0); retint(0); return(4);
>}
>
>/* EXPLICACION DE LA FALLA
>
>"dentro" indica que estamos dentro de la ventana, entre los { }
>
>"nlin" es el numero de lineas de la ventana
>"ncol" es el numero de columnas de la ventana, calculado como el maximo
> de las longitudes de las lineas que la componen
>
>"llv","plv"
> linea y columna del vertice superior izquierdo de la zona de la ventana
> en que se hace el display de las lineas en caso de ser una ventana
>lineal
>
> Se calculan buscando dos lineas consecutivas iguales cuyo primer
>caracter
> no
Obnoxio The Clown wrote: > > Warning: I know bugger all about D4GL! Aha! On this one point I can claim equality with the mighty Obnoxio! Because I know bolox all about D4GL too. > > But: try deleting all intermediate files and the final compiled file and > then recompile. That's always good advice. Remove any extraneous files and touch everything. One small point - you can get the logname from 7.23 without needing a c function, by selecting user from something - say for instance SELECT user FROM systables WHERE tabid = 1; And a handy way to "write" c functions is to download then from the iiug website. Then all you have to do is get the syntax _exactly_ right in fgiusr.c (or the D4GL equivalent which you posted). > From: Evelio Martínez <programacionaf@sinix.net> > > > >This is a multi-part message in MIME format. > > Please don't post MIME. > <much snipping of c and 4GL code and MIME crap> -- Andrew Pearson: "exactly what the web needs less of", 39 years, 364 days old: Aaargh!
Related threads
- Conversion to differeent characters sets
- Problem in changing locale via dbexport/dbimport
- RE: openlink error "Unable to load locale categories"