GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
/****************************************************************************1**2*W utils.h XGAP Source Frank Celler3**4**5*Y Copyright 1995-1997, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany6*Y Copyright 1997, Frank Celler, Huerth, Germany7**8** This file contains the utility functions and macros used in XGAP,9** basically the list functions ('ELM', 'LEN', 'AddList', and 'List') and10** the debug macro ('DEBUG'). This file also includes all the necessary11** system and X11 include files and defines the following data types:12**13** Boolean "True" or "False" (defined by X11)14** Char a "Char" will be able to hold one character15** Int a 32-bit signed integer16** Long an integer able to hold a pointer17** Pointer a generic pointer18** Short a 16-bit signed integer19** String an array of chars20** UChar unsigned version of "Char"21** UInt a 32-bit unsigned integer22** ULong unsigned version of "Long"23** UShort a 16-bit unsigned integer24**25** List( <len> )26** -------------27** 'List' creates a new list able to hold <len> pointers of type 'Pointer'.28**29** AddList( <lst>, <elm> )30** -----------------------31** 'AddList' appends the new element <elm> of type 'Pointer' to <lst>,32** enlarging the list if necessary.33**34** ELM( <lst>, <i> )35** -----------------36** 'ELM' returns the <i>.th element of <lst>.37**38** LEN( <lst> )39** ------------40** 'LEN' returns the length of <lst>.41**42** DEBUG( <type>, ( <debug-text>, ... ) )43** --------------------------------------44** 'DEBUG' uses 'printf' to print the <debug-text> in case that 'Debug' &&45** <type> is true. The text is preceded by the line number and the source46** file name. The following types are available: D_LIST, D_XCMD, D_COMM.47*/48#ifndef _utils_h49#define _utils_h505152/****************************************************************************53**54*F Include . . . . . . . . . . . . . . . . . . . . . . system include files55*/56#include <config.h>5758#if HAVE_TERMIO_H59#undef HAVE_SGTTY_H60#define HAVE_SGTTY_H 061#endif6263#include <stdio.h> /* standard C i/o library */6465#if STDC_HEADERS66# include <stdlib.h> /* standard C library */67# include <stdarg.h> /* variable argument list */68#endif6970#if HAVE_LIBC_H71# include <libc.h> /* standard NeXT C library */72#endif7374#if HAVE_UNISTD_H75# include <unistd.h> /* another standard C library */76#endif7778#include <pwd.h>7980#if TIME_WITH_SYS_TIME81# include <sys/time.h>82# include <time.h>83#else84# if HAVE_SYS_TIME_H85# include <sys/time.h>86# else87# include <time.h>88# endif89#endif9091#if HAVE_FCNTL_H92#include <fcntl.h>93#endif9495#include <sys/errno.h>96#include <sys/stat.h>97#include <sys/types.h>98#include <sys/resource.h>99100#if HAVE_SYS_WAIT_H101# include <sys/wait.h>102#endif103104#include <sys/param.h>105106#if HAVE_TERMIOS_H107# include <termios.h>108#else109#if HAVE_TERMIO_H110# include <termio.h>111#else112# include <sgtty.h>113#endif114#endif115116#if HAVE_SIGNAL_H117# include <signal.h>118#endif119120#if HAVE_SYS_SELECT_H121# include <sys/select.h>122#endif123124125/****************************************************************************126**127*F Include . . . . . . . . . . . . . . . . . . . . . . . . X11 include files128*/129#include <X11/X.h> /* X11 basic definition */130#include <X11/Xos.h>131#include <X11/Xatom.h>132#include <X11/Xlib.h>133#include <X11/StringDefs.h>134#include <X11/keysym.h>135136#include <X11/Intrinsic.h> /* X Intrinsic */137#include <X11/IntrinsicP.h>138#include <X11/CoreP.h>139#include <X11/Composite.h>140#include <X11/Shell.h>141142#include <X11/cursorfont.h> /* cursor font */143144#include <X11/Xaw/AsciiText.h> /* Athena widgets */145#include <X11/Xaw/Box.h>146#include <X11/Xaw/Cardinals.h>147#include <X11/Xaw/Command.h>148#include <X11/Xaw/Dialog.h>149#include <X11/Xaw/Form.h>150#include <X11/Xaw/Label.h>151#include <X11/Xaw/List.h>152#include <X11/Xaw/MenuButton.h>153#include <X11/Xaw/Paned.h>154#include <X11/Xaw/Scrollbar.h>155#include <X11/Xaw/SimpleMenu.h>156#include <X11/Xaw/SmeBSB.h>157#include <X11/Xaw/SmeLine.h>158#include <X11/Xaw/Text.h>159#include <X11/Xaw/TextP.h>160#include <X11/Xaw/TextSink.h>161#include <X11/Xaw/TextSrc.h>162#include <X11/Xaw/TextSrcP.h>163#include <X11/Xaw/Viewport.h>164#include <X11/Xaw/ViewportP.h>165#include <X11/Xaw/XawInit.h>166167168/****************************************************************************169**170*F Prototypes . . . . . . . . . . . . . . . . . . . . . . system prototypes171*/172#if ! HAVE_UNISTD_H && ! HAVE_LIBC_H173extern int write();174#endif175176extern pid_t wait3();177extern int select();178179/* IRIX System V.4 running IRIX Release 5.3 already defines ioctl and */180/* therefore doesn't like the declaration of ioctl */181182/* extern int ioctl(); */183184185/****************************************************************************186**187188*T Char . . . . . . . . . . . . . . . . . . . . . . . . . . . . a character189*/190typedef char Char;191192193/****************************************************************************194**195*T Int . . . . . . . . . . . . . . . . . . . . . . . . . . . a signed 32-bit196*/197typedef int Int;198199200/****************************************************************************201**202*T Long . . . . . . . . . . . . . . a signed integer able to hold a pointer203*/204typedef long Long;205206207/****************************************************************************208**209*T Pointer . . . . . . . . . . . . . . . . . . . . . . . . a generic pointer210*/211typedef void * Pointer;212213214/****************************************************************************215**216*T Short . . . . . . . . . . . . . . . . . . . . . . . . . . a signed 16-bit217*/218typedef short Short;219220221/****************************************************************************222**223*T UChar . . . . . . . . . . . . . . . . . . . . . . . an unsigned character224*/225typedef unsigned char UChar;226227228/****************************************************************************229**230*T UInt . . . . . . . . . . . . . . . . . . . . . . . . an unsigned 32-bit231*/232typedef unsigned int UInt;233234235/****************************************************************************236**237*T ULong . . . . . . . . . . . . an unsigned integer able to hold a pointer238*/239typedef unsigned long ULong;240241242/****************************************************************************243**244*T UShort . . . . . . . . . . . . . . . . . . . . . . . an unsigned 16-bit245*/246typedef unsigned short UShort;247248249/****************************************************************************250**251252*F DEBUG(( <str> )) . . . . . . . . . . . . . . . print <str> as debug info253*/254extern Int Debug;255256#define D_LIST 1257#define D_XCMD 2258#define D_COMM 4259260#define DEBUG(a,b) { \261if ( Debug & a ) { \262printf( "%04d:%s: ", __LINE__, __FILE__ ); \263printf b; \264} \265} while(0)266267268/****************************************************************************269**270*F MAX( <a>, <b> ) . . . . . . . . . . . . . . . . . maximum of <a> and <b>271*/272#undef MAX273#define MAX(a,b) (((a) < (b)) ? (b) : (a))274275276/****************************************************************************277**278*F MIN( <a>, <b> ) . . . . . . . . . . . . . . . . . minimum of <a> and <b>279*/280#undef MIN281#define MIN(a,b) (((a) < (b)) ? (a) : (b))282283284/****************************************************************************285**286287*T TypeList . . . . . . . . . . . . . . . . . . . . . . . . list structure288*/289typedef struct _list290{291UInt size;292UInt len;293Pointer * ptr;294}295* TypeList;296297298/****************************************************************************299**300*F ELM( <lst>, <i> ) . . . . . . . . . . . . . . . . <i>th element of a list301*/302#define ELM(lst,i) (lst->ptr[i])303304305/****************************************************************************306**307*F LEN( <lst> ) . . . . . . . . . . . . . . . . . . . . . length of a list308*/309#define LEN(lst) (lst->len)310311312/****************************************************************************313**314*F AddList( <lst>, <elm> ) . . . . . . . . add list element <elm> to <list>315*/316#ifdef DEBUG_ON317extern void ADD_LIST( String, Int, TypeList, Pointer );318# define AddList(a,b) ADD_LIST( __FILE__, __LINE__, a, b )319#else320extern void AddList( TypeList, Pointer );321#endif322323324/****************************************************************************325**326*F List( <len> ) . . . . . . . . . . . . . . . . . . . create a new list327*/328#ifdef DEBUG_ON329extern TypeList LIST( String, Int, UInt );330# define List(a) LIST( __FILE__, __LINE__, a )331#else332extern TypeList List( UInt );333#endif334335#endif336337338/****************************************************************************339**340341*E utils.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here342*/343344345