[comp.lang.icon] iconx.hdr size on a Sun-4.

flee@dictionopolis.cs.psu.edu (Felix Lee) (12/12/90)

12.8k is a little large.  The changes below will reduce the size to
2.6k.  Apply the patch below to src/icont/ixhdr.c, and add the
following to config/unix/sun4/define.h:
	#define MaxHdr	2688
	#define UseFakeFunctionsInHdr

UseFakeFunctionsInHdr will replace some standard C library functions
with smaller and simpler versions in ixhdr.c.

This may have benefit for systems other than Sun-4s; I haven't tried.

The real trick is to reduce the header to 20 bytes.
--
Felix Lee	flee@cs.psu.edu

*** /tmp/,RCSt1a04604	Tue Dec 11 16:30:01 1990
--- ixhdr.c	Tue Sep 11 19:22:57 1990
***************
*** 30,35 ****
--- 30,61 ----
  #define Iconx IconxPath
  #endif					/* Iconx */
  
+ #ifdef UseFakeFunctionsInHdr
+ /* fake functions to reduce executable size. */
+ novalue exit(x) int x; { _exit(x); }
+ 
+ /* small, inefficient strcpy(). */
+ char * strcpy(a, b) register char * a; register char * b;
+ {
+ 	while (*a++ = *b++) ;
+ 	return a;	/* note! this is incompatible with real strcpy */
+ }
+ /* small, inefficient strlen(). */
+ int strlen(s) char * s;
+ {
+ 	register char * p;
+ 	while (*p++) ;
+ 	return p - s;
+ }
+ /* small, inefficient strcat(). */
+ char * strcat(a, b) register char * a; register char * b;
+ {
+ 	while (*a++) ;
+ 	while (*a++ = *b++) ;
+ 	return a;	/* note! this is incompatible with real strcat */
+ }
+ #endif UseFakeFunctionsInHdr
+ 
  novalue main(argc, argv)
  int argc;
  char **argv;