lotus

previous page: 6.5: GNO with ORCA: What goes in the 13/orcacdefs/defaults.h file?
  
page up: comp.sys.apple2. gno FAQ
  
next page: 6.7: GNO with ORCA: What libraries are used for the combination ofGNO v2.0.4 and ORCA/C v2.0.x?

6.6: GNO with ORCA: What header file modifications are necessary?




Description

This article is from the Apple II GNO FAQ, by Devin Reade with numerous contributions by others.

6.6: GNO with ORCA: What header file modifications are necessary?

    A#6.6:	=== See the CAVEAT in Q#6.1 ===

If you're using GNO v2.0.6, no modifications should be necessary
provided you've placed all the GNO header files into /usr/include
and /HFSinclude as appropriate.  This applies to both ORCA/C v2.0.3
and ORCA/C v2.1.x.

There are various header files included with the GNO v2.0.1
distribution.  These should all be copied into the /usr/include
directory hierarchy as discussed in Q#6.4. (Versions 2.0.2,
2.0.3, and 2.0.4 were incremental changes, not complete
distributions, and therefore did not include header files.)

If you are using the Multiuser package, then you should also 
copy over the <time.h> and <utmp.h> files from that package.

The files in the following lists are used instead of their ORCA/C
counterparts, except where noted by "+++"; those so marked need
to be modified as described.

Note the last section in this question is a list of suggested
changes to the GNO v2.0.4 header files.  These changes you should
make yourself.

GNO v2.0.4 with ORCA/C v2.0.3
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

	errno.h		This one has many GNO error codes added.
	fcntl.h		Differs in the prototypes of open(2), read(2),
			write(2), and definition of OPEN_MAX.
	signal.h	Completely different for GNO.
	stdio.h		Differs in the prototypes of fread(3) and
			fwrite(3).  The FILE structure uses an
			older name for one of its members, but it
			doesn't matter.  A prototype for fdopen(3)
			and the fileno() macro was added.
+++	stdlib.h	You should delete this one and copy the
			ORCA/C v2.0.3 stdlib.h from 
			/lang/orca/libraries/orcacdefs to
			/usr/include.  See the "common" changes
			below for more information on this file.
	string.h	Many new functions were added in the GNO one.
+++	types.h		You should delete this one and copy the
			ORCA/C v2.0.3 types.h from 
			/lang/orca/libraries/orcacdefs to
			/usr/include.  See the "common" changes
			below for more information on this file.

GNO v2.0.4 with ORCA/C v2.1.x
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

	errno.h		This one has many GNO error codes added.
	fcntl.h		Differs in the prototypes of open(2), read(2),
			write(2), and definition of OPEN_MAX.
	signal.h	Completely different for GNO.
+++	stdio.h		You should delete this file, then copy the
			one from your ORCA/C distribution into
			the /usr/include directory.  See the "common"
			changes below for more information on this
			file.  Note that there was a critical change
			to the FILE structure as of ORCA/C v2.1.1b2;
			ensure your header file matches your OrcaLib.
+++	stdlib.h	You should delete this one and copy the
			ORCA/C v2.1.x stdlib.h from 
			/lang/orca/libraries/orcacdefs to
			/usr/include.  See the "common" changes
			below for more information on this file.
+++	string.h	You should rename this file to something
			else (like "string.old"), then copy the
			one from your ORCA/C distribution into
			the /usr/include directory.  Finally, you
			should copy the prototypes for the following
			functions from the old GNO file into the new
			one copied from the ORCA/C distribution:
				bcopy		bzero
				index		rindex
				strdup		strupr
				strlwr		strset
				strnset		strrev
				strpblnks	strrpblnks
				strpad		strrpad
				stricmp		strncmp
+++	types.h		You should delete this one and copy the
			ORCA/C v2.1.x types.h from 
			/lang/orca/libraries/orcacdefs to 
			/usr/include.  See the "common" changes
			below for more information on this file.

GNO v2.0.4 common changes
^^^^^^^^^^^^^^^^^^^^^^^^^

The following is a list of suggested changes to the GNO v2.0.4
header files.  You have to make these changes yourself; they are
not part of the distributed header files.

For any files below that don't appear in /usr/include, you should
copy the file from /lang/orca/libraries/orcacdefs into /usr/include,
then edit the copy in /usr/include.  Do not modify files in 
/lang/orca/libraries/orcacdefs.

dirent.h (possibly sys/dirent.h):
	Ensure that in struct dirent, the d_namelen field
	appears before the d_name field, as described in the
	GNO v2.0.4 release notes.

gno/gno.h:
	Rename send(2) to procsend(2) and receive(2) to	procreceive(2).

stdio.h:
	Add the following:

		#define	fileno(f)	((f)->_file)
		#define	P_tmpdir	"/tmp"
		FILE *	fdopen(int, const char *);
		char *	tempnam(char *, char *);
		char *	mktemp(char *);
		int	mkstemp(char *);
		FILE *	popen(const char *, const char *);
		int	pclose(FILE *);

	Add the following if you're using ORCA/C v2.1.x:

		#define setbuffer(stream,buf,size) ((buf==NULL) ? \
			(void)__setvbuf(stream,NULL,_IONBF,0L) : \
			(void)__setvbuf(stream,buf,_IOFBF,\
				(size_t)size))
		#define	setlinebuf(stream) (__setvbuf(stream,NULL,\
			_IOLBF,0L))
		int	__fseek(FILE *, long, int);
		int	__setvbuf(FILE *, char *, int, size_t);

stdlib.h:
	Add the following declarations:

		int	initenv(void);
		void	popenv(void);
		int	pushenv(void);
		int	putenv(const char *);
		int	setenv(const char *, const char *, int);
		void	unsetenv(const char *);

sys/ports.h:
	Change the prototypes of pdelete(2) and preset(2) to:

		int	pdelete(int, int (*)(void));
		int	preset(int, int (*)(void));

sys/stat.h:
	Add the following prototype:

		int	umask(int);

	This header file contains the following guard macro:

		#ifndef __BSD_TYPES__
		#include <sys/types.h>
		#endif

	it should be changed to:

		#ifndef __SYS_TYPES__
		#include <sys/types.h>
		#endif

sys/times.h:
	The last line should be modified so that the text following
	the #endif is in a comment, otherwise it is not legal C
	source code:
		#endif	/* _SYS_TIMES_H_ */

sys/types.h:
	Change the typedef of sig_t to:
		typedef void (*sig_t)(void);

	The typedef for use_t has an extraneous '_' character.  Of
	course, if you hit this and aren't compiling the kernel
	you're doing something wrong since the _IN_KERNEL macro
	should not normally be defined:
		typedef unsigned char	use_t;

sys/wait.h:
	Add the following declaration:
		int	wait(union wait *);

time.h:
	Add the following declarations:

		void		tzset(void);
		#ifndef _SVR4
		struct tz *	timezone(void);
		#endif

types.h:
	Before the definition of TRUE, add in the following:

		#undef	TRUE
		#undef	true
		#undef	FALSE
		#undef	false

unistd.h:
	As explained in the lenviron documentation, rename the
	execve() system call to _execve() (if you have installed
	/usr/lib/lenviron as described in Q#6.7 or Q#6.8). Insert
	or uncomment prototypes for execl(), execlp(), execv(),
	execve(), and execvp().  The execve() prototype should be:

		int execve(const char *,char * const *,char * const *);

	Insert the following prototypes.  They are not yet defined
	in any standard, however they are common routines and are
	provided in libc for GNO v2.0.6:

		char *	dirname (const char *);
		char *	basename (const char *);
    

 

Continue to:













TOP
previous page: 6.5: GNO with ORCA: What goes in the 13/orcacdefs/defaults.h file?
  
page up: comp.sys.apple2. gno FAQ
  
next page: 6.7: GNO with ORCA: What libraries are used for the combination ofGNO v2.0.4 and ORCA/C v2.0.x?