*** 1.1	1991/07/03 14:40:46
--- aesutil.c	1991/07/03 21:05:54
***************
*** 51,58 ****
  #include <aesbind.h>
  #include <gemdefs.h>
  #include <obdefs.h>
! EXTERN WORD	global[15];
! #define AESversion global[0]
  #endif
  
  #include "portab.h"
--- 51,58 ----
  #include <aesbind.h>
  #include <gemdefs.h>
  #include <obdefs.h>
! #include <gemfast.h>
! #define AESversion gl_ap_version
  #endif
  
  #include "portab.h"
***************
*** 181,190 ****
   */
  MLOCAL VOID	FselInit( VOID )
  {
!     Supexec( init_fsvars );
      save_path[0] = (char)Dgetdrv() + 'A';
      save_path[1] = ':';
!     Dgetpath( &save_path[2], 0 );
  
  #if MWC
      if( AESversion >= 0x0140 )
--- 181,190 ----
   */
  MLOCAL VOID	FselInit( VOID )
  {
!     (void)Supexec( init_fsvars );
      save_path[0] = (char)Dgetdrv() + 'A';
      save_path[1] = ':';
!     (void)Dgetpath( &save_path[2], 0 );
  
  #if MWC
      if( AESversion >= 0x0140 )
***************
*** 543,549 ****
  {
      WORD	physid, pxy[8], clipxy[4];
  
! #if __TURBOC__
  MLOCAL MFDB	mfdb0;
  #else
  MLOCAL FDB	mfdb0;
--- 543,549 ----
  {
      WORD	physid, pxy[8], clipxy[4];
  
! #if __TURBOC__ || __GNUC__
  MLOCAL MFDB	mfdb0;
  #else
  MLOCAL FDB	mfdb0;
*** 1.1	1991/07/03 14:40:46
--- aesutil.h	1991/07/03 21:05:54
***************
*** 417,422 ****
--- 417,424 ----
  #endif
  /* Goofy GNU binding for evnt_timer is more logical, but wrong.
   * __OLD_WAY__ is provided for evnt_multi but not evnt_timer.
+  *
+  * This was corrected. ++jrb
   */
  
  VOID	FormExit __PROTO(( OBJECT *tree, GRECT *rstart ));
*** 1.1	1991/07/03 14:40:46
--- faces.c	1991/07/03 21:05:54
***************
*** 139,145 ****
  
      savedta = (struct _dta *)Fgetdta();
      Fsetdta( &dta ); /* suspicious pointer conversion in TC */
!     Fsfirst( fname, 7 );
      Fsetdta( savedta ); /* suspicious pointer conversion in TC */
  
      *pbuf = NULL;
--- 139,145 ----
  
      savedta = (struct _dta *)Fgetdta();
      Fsetdta( &dta ); /* suspicious pointer conversion in TC */
!     (void)Fsfirst( fname, 7 );
      Fsetdta( savedta ); /* suspicious pointer conversion in TC */
  
      *pbuf = NULL;
***************
*** 155,169 ****
  
      if( (fh = (short)Fopen(fname, 0)) < 0 )
      {
! 	Mfree( buf );
  	return (long)fh;
      }
  
      len = Fread( fh, dta.size, buf );
!     Fclose( fh );
      if( len != dta.size )
      {
! 	Mfree( buf );
  	return AEREADF;
      }
  
--- 155,169 ----
  
      if( (fh = (short)Fopen(fname, 0)) < 0 )
      {
! 	(void)Mfree( buf );
  	return (long)fh;
      }
  
      len = Fread( fh, dta.size, buf );
!     (void)Fclose( fh );
      if( len != dta.size )
      {
! 	(void)Mfree( buf );
  	return AEREADF;
      }
  
***************
*** 486,491 ****
  	form_alert( 1, alertp );
      }
  
!     Mfree( fbuf );
      return ret;
  }
--- 486,491 ----
  	form_alert( 1, alertp );
      }
  
!     (void)Mfree( fbuf );
      return ret;
  }
*** 1.1	1991/07/03 14:40:46
--- fontform.c	1991/07/03 21:05:55
***************
*** 43,48 ****
--- 43,50 ----
  #include <aesbind.h>
  #include <gemdefs.h>
  #include <obdefs.h>
+ #include <ctype.h>
+ #include <string.h>
  #define strupr(s) { short i; for(i=0;s[i];i++) s[i] = toupper(s[i]); }
  #endif
  
***************
*** 97,104 ****
--- 99,110 ----
  /* ----------------------------------------------------------------------
   * Exit cleanly, with a return code.
   */
+ #if ANSI_C
+ GLOBAL VOID	GemExit( short code )
+ #else
  GLOBAL VOID	GemExit( code )
  short		code;
+ #endif
  {
      if( wind > 0 )
      {
***************
*** 148,155 ****
      vsf_interior( wsid, 0 ); /* hollow fill */
      v_bar( wsid, pxy );
  
      if( !curstyle.pts 
!     ||	(pfont = FsmFont(curstyle.face, curstyle.fx, &fx)) == NULL )
      {
  	/*
  	 * No font selected, use system font.
--- 154,170 ----
      vsf_interior( wsid, 0 ); /* hollow fill */
      v_bar( wsid, pxy );
  
+     /*
+      * pfont hoisted out here: otherwise because of short-circuit
+      * condition evaluation, its possible it will never be evaluated.
+      * it is used below in the code.
+      *
+      *  ++jrb
+      */
+     pfont = FsmFont(curstyle.face, curstyle.fx, &fx);
+     
      if( !curstyle.pts 
!     ||	(pfont == NULL) )
      {
  	/*
  	 * No font selected, use system font.
***************
*** 321,327 ****
  	 * Sixth Commandment for C Programmers.
  	 */
  	Cconws( "\r\nError initializing GEM, hit a key..." );
! 	Cconin();
  	exit( apid );
      }
  
--- 336,342 ----
  	 * Sixth Commandment for C Programmers.
  	 */
  	Cconws( "\r\nError initializing GEM, hit a key..." );
! 	(void)Cconin();
  	exit( apid );
      }
  
*** 1.1	1991/07/03 14:40:46
--- fsmbind.h	1991/07/03 21:05:56
***************
*** 20,25 ****
--- 20,26 ----
  #define GDOS_FSM  0x5F46534DL	/* '_FSM' */
  #define GDOS_FNT  0x5F464E54L	/* '_FNT' */
  
+ #ifndef __GNUC__
  /* Functions
   * ----------------------------------------------------------------------
   */
***************
*** 67,71 ****
--- 68,75 ----
  VOID	vqt_get_tables __PROTO(( WORD handle, VOIDP *gascii, VOIDP *style ));
  /* Get FSM GASCII tables.
   */
+ #else /* __GNUC_ */
+ #include <vdibind.h>
+ #endif /* __GNUC__ */
  
  #endif FSMBIND_H
*** 1.1	1991/07/03 14:40:46
--- portab.h	1991/07/03 21:05:57
***************
*** 136,143 ****
--- 136,174 ----
  #endif
  
  typedef signed char	BYTE;		/* Signed 8 bit byte 		*/
+ 
+ #if 0
+  /* this is totally wrong: you want to define the user interface to bindings in
+     terms of the natural integer size (which is not necessarily 16 bits wide),
+     and take care of any specific width requirements in the bindings themselves.
+     (ie: dont put the burden of getting the interface type requirements right on
+      the user, but instead take care of it in the bindings).
+     this is particularly important when you are passing WORD pointers (WORD *)
+     to the bindings. If WORD is not defined as the natural integer, most times
+     you will end up with the wrong type of pointer, or the burden will be on
+     the user to define the correct pointer type (this is the worst assumption
+     you can make, and will result in maximum hassels in terms of users bitching
+     or not being able to figure out why their programs dont work). Ansi C compilers
+     will detect the situation, and give warnings of incompatible pointer types,
+     but will not cause an error, thus giving a false sense of security to the users.
+     non-Ansi C will of course not even detect the situation. Plus it is much more
+     natural to write stuff in terms of int, instead of WORD or some interface
+     defined type (think of constants, that will have to be cast, since they cannot
+     be declared to be of a particular type). Also defining WORD as short in a
+     16/32 bit integer compiler will result in widening problems when 32 bit ints
+     are used. If the user misses even one prototype, KBG! (Kiss Baghdad Goodbye :-).
+     i dont even want to think about what would happen with non-prototyping compilers
+     or when gcc -traditional is used, for 32 bit ints.
+ 
+     ++jrb
+ */
  typedef unsigned short	UWORD;		/* Unsigned 16 bit word		*/
  typedef short		WORD;		/* Signed 16 bit word		*/
+ #else
+ typedef unsigned int	UWORD;		/* Unsigned  word		*/
+ typedef int		WORD;		/* Signed  word			*/
+ #endif
+ 
  typedef unsigned long	ULONG;		/* Unsigned 32 bit long word	*/
  typedef signed long	LONG;		/* Signed 32 bit long word	*/
  typedef WORD		BOOLEAN;	/* WORD-sized true/false value	*/
***************
*** 185,192 ****
   * ======================================================================
   */
  
! #define REG	register		/* Register variable		*/
! #define LOCAL	auto			/* Local to function		*/
  #define EXTERN	extern			/* Externally defined		*/
  #define MLOCAL	static			/* Local to module		*/
  #define GLOBAL	/* */			/* Global variable/function	*/
--- 216,228 ----
   * ======================================================================
   */
  
! #ifndef __GNUC__ 	/* gnuc can do better allocation than humans can */
! #  define REG			/* Register variable		*/
! #  define LOCAL			/* Local to function		*/
! #else
! #  define REG	register		/* Register variable		*/
! #  define LOCAL	auto			/* Local to function		*/
! #endif
  #define EXTERN	extern			/* Externally defined		*/
  #define MLOCAL	static			/* Local to module		*/
  #define GLOBAL	/* */			/* Global variable/function	*/
***************
*** 228,235 ****
   *	 values to be passed to exit().
   */
  
! #define FALSE	0
! #define TRUE	!0
  #define YES	TRUE
  #define NO	FALSE
  #define SUCCESS TRUE			/* Function success return val	*/
--- 264,271 ----
   *	 values to be passed to exit().
   */
  
! #define FALSE	(0)
! #define TRUE	(!0)
  #define YES	TRUE
  #define NO	FALSE
  #define SUCCESS TRUE			/* Function success return val	*/
***************
*** 239,246 ****
  #define EOF	(-1)			/* EOF Value			*/
  #endif
  
! #ifndef NULL				/* This is defined by ANSI	*/
! #define NULL	( (VOIDP)0L )
  #endif
  
  #define NULLPTR NULL
--- 275,293 ----
  #define EOF	(-1)			/* EOF Value			*/
  #endif
  
! #ifndef __GNUC__
! #  ifndef NULL				/* This is defined by ANSI	*/
! #    define NULL	( (VOIDP)0L )
! #  endif
! #else
! #  ifndef NULL
! #    ifdef __MSHORT__
! #      define NULL ((void *)0)
! #    else
!        /* avoid complaints about misuse of NULL :-)*/
! #      define NULL (0)
! #    endif
! #  endif
  #endif
  
  #define NULLPTR NULL
*** 1.1	1991/07/03 14:40:46
--- pragma.h	1991/07/03 21:05:57
***************
*** 22,28 ****
--- 22,31 ----
   * GDOS_FNT if FONT GDOS is installed, or
   * some other value (!= -2) if GDOS 1.1 (or G+PLUS or AMCGDOS) is installed.
   */
+ #ifndef __GNUC__  /* it is a define in gcc */
  long	vq_vgdos( void );
+ #endif
+ 
  #if LATTICE
  #pragma inline d0=vq_vgdos() {register d2,a2; "70FE"; "4E42"}
  				/* moveq #-2,d0 / trap #2 */
***************
*** 55,61 ****
  	/* movep.l d0,1(a0) / move.w d2,12(a0) / moveq #73,d0 / trap #2 */
  #endif
  
! #if __GNUC__
  #define vdicall(a,b,c,d) __vdi__((a),(b))
  #endif
  
--- 58,64 ----
  	/* movep.l d0,1(a0) / move.w d2,12(a0) / moveq #73,d0 / trap #2 */
  #endif
  
! #if 0 /* __GNUC__ */
  #define vdicall(a,b,c,d) __vdi__((a),(b))
  #endif
  
*** 1.1	1991/07/03 14:40:46
--- printout.c	1991/07/03 21:05:57
***************
*** 37,42 ****
--- 37,43 ----
  #include <aesbind.h>
  #include <gemdefs.h>
  #include <obdefs.h>
+ #include <ctype.h>
  #define strupr(s) { short i; for(i=0;s[i];i++) s[i] = toupper(s[i]); }
  #endif
  
*** 1.1	1991/07/03 14:40:46
--- strtol.c	1991/07/03 21:05:59
***************
*** 1,3 ****
--- 1,8 ----
+ /*
+  * kbad: this whole file needs to be replaced
+  *
+  */
+ 
  /* ANSI strtol() to replace Lattice lib version 5.04
   * ----------------------------------------------------------------------
   * 901219 kbad MWC update, add strtoul()
*** 1.1	1991/07/03 14:40:46
--- styles.c	1991/07/03 21:05:59
***************
*** 159,169 ****
  /* FIDO */	{ 0,	  FxBOLD, FxSKEW, FxBS }
  };
  
  /* Local functions
   * ----------------------------------------------------------------------
   */
- MLOCAL int STDARGS DrawFxobj __PROTO(( PARMBLK *parm ));
- MLOCAL int STDARGS PrintSample __PROTO(( PARMBLK *parm ));
  
  MLOCAL BOOLEAN	FlagFsmFx __PROTO(( Style *ps, BOOLEAN draw ));
  MLOCAL VOID	FixFx __PROTO(( WORD obj, UWORD fx, Style *ps ));
--- 159,170 ----
  /* FIDO */	{ 0,	  FxBOLD, FxSKEW, FxBS }
  };
  
+ EXTERN int STDARGS DrawFxobj __PROTO(( PARMBLK *parm ));
+ EXTERN int STDARGS PrintSample __PROTO(( PARMBLK *parm ));
+ 
  /* Local functions
   * ----------------------------------------------------------------------
   */
  
  MLOCAL BOOLEAN	FlagFsmFx __PROTO(( Style *ps, BOOLEAN draw ));
  MLOCAL VOID	FixFx __PROTO(( WORD obj, UWORD fx, Style *ps ));
*** 1.1	1991/07/03 14:40:46
--- userdef.c	1991/07/03 21:05:59
***************
*** 34,39 ****
--- 34,40 ----
  #include <aesbind.h>
  #include <gemdefs.h>
  #include <obdefs.h>
+ #include <ctype.h>
  #define strupr(s) { short i; for(i=0;s[i];i++) s[i] = toupper(s[i]); }
  #endif
  
