#define RCS_ACK "$Id$"
#endif
+#include <stdlib.h> /* size_t, free() */
+
/****************************************************************************/
/* User settable options */
/****************************************************************************/
#define p_cont(elem) ((path *)l_content(elem))
-/* Return values of setpath() */
-enum f_path { F_OK, F_NOMATCH, F_NOPATH } ;
-
/* Own routines */
-enum f_path getpath();
-enum f_path scan_end();
-extern void noodstop();
-extern char *getvar();
-extern char *keeps();
-extern char *basename();
-extern char *skipblank();
-extern char *firstblank();
-extern char *getcore();
-extern char *changecore();
+
+/* rmach.c */
+void setlist(char *);
+
+/* svars.c */
+void setsvar(char *, char *);
+void setpvar(char *, char *(*)(void));
+char *getvar(const char *);
+
+/* util.c */
+char *ack_basename(const char *);
+void clr_noscan(char *);
+char *skipblank(char *);
+char *firstblank(char *);
+void fatal(const char *, ...);
+void vprint(const char *, ...);
+#ifdef DEBUG
+void prns(const char *);
+#endif
+void fuerror(const char *, ...);
+void werror(const char *, ...);
+void quit(int);
+char *keeps(const char *);
+#define throws(str) free(str)
+void *getcore(size_t);
+void *changecore(void *, size_t);
#define freecore(area) free(area)
#define DEBUG 1 /* Allow debugging of Ack */
EXTERN path out; /* The current output pathname */
EXTERN path orig; /* The original input path */
EXTERN char *p_basename; /* The current basename */
-EXTERN char *p_suffix; /* The current input suffix */
+EXTERN const char *p_suffix; /* The current input suffix */
static char rcs_id[] = "$Id$" ;
#endif
-char *add_u(part,ptr) char *ptr ; {
+static char *add_u(int part, char *ptr) {
if ( part>=26 ) {
ptr=add_u(part/26-1,ptr) ;
}
return ptr+1 ;
}
-char *unique() {
+static char *unique(void) {
/* Get the next unique part of the internal filename */
static int u_next = 0 ;
static char buf[10] ;
return buf ;
}
-setfiles(phase) register trf *phase ; {
+int setfiles(trf *phase) {
/* Set the out structure according to the in structure,
the transformation and some global data */
growstring pathname ;
return 1 ;
}
-disc_files(phase) trf *phase ; {
- path temp ;
-
- if ( !phase->t_combine ) {
- file_final(&in) ;
- } else {
- disc_inputs(phase) ;
- }
- temp=in ; in=out ; out=temp ;
-}
-
-file_final(file) path *file ; {
+static void file_final(path *file) {
if ( file->p_path ) {
if ( !file->p_keep && t_flag<=1 ) {
if ( unlink(file->p_path)!=0 ) {
file->p_keep=NO ;
}
-disc_inputs(phase) trf *phase ; {
+void disc_files(trf *phase) {
+ path temp ;
+
+ if ( !phase->t_combine ) {
+ file_final(&in) ;
+ } else {
+ disc_inputs(phase) ;
+ }
+ temp=in ; in=out ; out=temp ;
+}
+
+void disc_inputs(trf *phase) {
/* Remove all the input files of this phase */
/* Only for combiners */
register path *l_in ;
l_clear(&phase->t_inputs) ;
}
-rmfile(file) path *file ; {
+void rmfile(path *file) {
/* Remove a file, do not complain when is does not exist */
if ( file->p_path ) {
if ( t_flag<=1 ) unlink(file->p_path) ;
}
}
-void
-rmtemps() {
+void rmtemps(void) {
/* Called in case of disaster, always remove the current output file!
*/
register list_elem *elem ;
}
}
-add_input(file,phase) path *file ; trf *phase ; {
+void add_input(path *file, trf *phase) {
register path *store ;
#ifdef DEBUG
if ( debug ) {
static char rcs_grows[] = RCS_GROWS ;
#endif
-gr_add(id,c) register growstring *id ; char c ; {
+int gr_add(growstring *id, int c) {
if ( id->gr_size==id->gr_max) {
if ( id->gr_size==0 ) { /* The first time */
id->gr_max= 2*GR_MORE ;
*(id->gr_string+id->gr_size++)= c ;
}
-gr_cat(id,string) growstring *id ; char *string ; {
- register char *ptr ;
+int gr_cat(growstring *id, const char *string) {
+ const char *ptr ;
#ifdef DEBUG
if ( id->gr_size && *(id->gr_string+id->gr_size-1) ) {
}
}
-void
-gr_throw(id) register growstring *id ; {
+void gr_throw(growstring *id) {
/* Throw the string away */
if ( id->gr_max==0 ) return ;
freecore(id->gr_string) ;
id->gr_size=0 ;
}
-gr_init(id) growstring *id ; {
+void gr_init(growstring *id) {
id->gr_size=0 ; id->gr_max=0 ;
}
-char *gr_final(id) growstring *id ; {
+char *gr_final(growstring *id) {
/* Throw away the bookkeeping, adjust the string to its final
length and return a pointer to a string to be get rid of with
throws
/* Routines used */
-extern void gr_throw() ; /* To free the core */
-extern int gr_add() ; /* To add one character */
-extern int gr_cat() ; /* concatenate the contents and the string */
-extern int gr_init() ; /* Initialize the bookkeeping */
-extern char *gr_final() ; /* Transform to a stable storage string */
+void gr_throw(growstring *) ; /* To free the core */
+int gr_add(growstring *, int) ; /* To add one character */
+int gr_cat(growstring *, const char *) ; /* To append a string */
+void gr_init(growstring *) ; /* Initialize the bookkeeping */
+char *gr_final(growstring *) ; /* Move to a stable storage string */
*/
-l_add(header,string) list_head *header ; char *string ; {
+void l_add(list_head *header, char *string) {
register list_elem *new;
/* NOSTRICT */
header->ca_last= new ;
}
-l_clear(header) list_head *header ; {
+void l_clear(list_head *header) {
register list_elem *old, *next;
for ( old=header->ca_first ; old ; old= next ) {
next= old->ca_next ;
header->ca_last = (list_elem *) 0 ;
}
-l_throw(header) list_head *header ; {
+void l_throw(list_head *header) {
register list_elem *old, *next;
for ( old=header->ca_first ; old ; old= next ) {
throws(l_content(*old)) ;
/* To be used for scanning lists, ptr is the running variable */
#define scanlist(elem,ptr) \
for ( ptr= elem ; ptr; ptr= l_next(*ptr) )
+
+void l_add(list_head *, char *);
+void l_clear(list_head *);
+void l_throw(list_head *);
static int sigs[] = { SIGINT, SIGHUP, SIGTERM, 0 } ;
static int arg_count;
-extern char *getenv();
-
-void vieuwargs();
-
-main(argc,argv) char **argv ; {
+static char *srcvar(void);
+static char *getsuffix(void);
+static void varinit(void);
+static void vieuwargs(int, char **);
+static void firstarg(char *);
+static int process(char *);
+static int startrf(trf *);
+static void block(trf *);
+static int mayprep(void);
+static void scanneeds(void);
+static void setneeds(const char *, int);
+static void noodstop(int);
+
+int main(int argc, char **argv) {
register list_elem *elem ;
register char *frontend ;
register int *n_sig ;
orig.p_path=phase->t_origname ;
if ( p_basename ) throws(p_basename) ;
if ( orig.p_path ) {
- p_basename= keeps(basename(orig.p_path)) ;
+ p_basename= keeps(ack_basename(orig.p_path)) ;
} else {
p_basename=0 ;
}
exit(0) ;
}
-char *srcvar() {
+static char *srcvar(void) {
return orig.p_path ;
}
-char *getsuffix() {
+static char *getsuffix(void) {
return strrchr(orig.p_path, SUFCHAR) ;
}
-varinit() {
+static void varinit(void) {
/* initialize the string variables */
register char *envstr ;
extern char *em_dir;
/************************* flag processing ***********************/
-void
-vieuwargs(argc,argv) char **argv ; {
+void vieuwargs(int argc, char **argv) {
register char *argp;
register int nextarg ;
register int eaten ;
case 'r': if ( argp[2]!=SUFCHAR ) {
error("-r must be followed by %c",SUFCHAR) ;
}
- keeptail(&argp[2]); eaten=1 ;
+ l_add(&tail_list, &argp[2]) ;
+ eaten=1 ;
break ;
case '.': if ( rts ) {
if ( strcmp(rts,&argp[1])!=0 )
fuerror("Two run-time systems?") ;
} else {
rts= &argp[1] ;
- keephead(rts) ; keeptail(rts) ;
+ l_add(&head_list, rts) ;
+ l_add(&tail_list, rts) ;
}
eaten=1 ;
break ;
register char *tokeep ;
tokeep=keeps(argp) ;
if ( argp[1]=='R' ) {
- do_Rflag(tokeep);
+ l_add(&R_list, tokeep) ;
} else {
*tokeep |= NO_SCAN ;
}
return ;
}
-firstarg(argp) register char *argp ; {
+static void firstarg(char *argp) {
register char *name ;
name=strrchr(argp,'/') ;
/************************* argument processing ***********************/
-process(arg) char *arg ; {
+static int process(char *arg) {
/* Process files & library arguments */
trf *phase ;
register trf *tmp ;
return 1 ;
}
if ( p_basename ) throws(p_basename) ;
- p_basename= keeps(basename(arg)) ;
+ p_basename= keeps(ack_basename(arg)) ;
/* Try to find a path through the transformations */
switch( getpath(&phase) ) {
case F_NOPATH :
return startrf(phase) ;
}
-int startrf(first) trf *first ; {
+static int startrf(trf *first) {
/* Start the transformations at the indicated phase */
register trf *phase ;
return 1 ;
}
-block(first) trf *first ; {
+static void block(trf *first) {
/* One of the input files of this phase could not be produced,
block all combiners taking their input from this one.
*/
if ( phase->t_combine ) phase->t_blocked=YES ;
}
}
-mayprep() {
+
+static int mayprep(void) {
int file ;
char fc ;
file=open(in.p_path,0);
return fc=='#' ;
}
-keephead(suffix) char *suffix ; {
- l_add(&head_list, suffix) ;
-}
-
-keeptail(suffix) char *suffix ; {
- l_add(&tail_list, suffix) ;
-}
-
-scanneeds() {
+static void scanneeds(void) {
register list_elem *elem ;
scanlist(l_first(head_list), elem) { setneeds(l_content(*elem),0) ; }
l_clear(&head_list) ;
l_clear(&tail_list) ;
}
-setneeds(suffix,tail) char *suffix ; {
+static void setneeds(const char *suffix, int tail) {
trf *phase ;
p_suffix= suffix ;
break ;
}
}
+
+static void noodstop(int sig) {
+ quit(-3) ;
+}
#define CALL "callname"
#define END "end"
-extern growstring scanb();
-extern growstring scanvars();
+/* trans.c */
+growstring scanb(const char *) ;
+growstring scanvars(const char *) ;
+
+static void intrf(void) ;
+static void open_in(char *) ;
+static void close_in(void) ;
+static int getinchar(void) ;
+static int getln(void) ;
-int getln() ;
-int getinchar() ;
static char *ty_name ;
static char *bol ;
-
-void open_in();
-
static char *inname ;
-setlist(name) char *name ; {
+void setlist(char *name) {
/* Name is sought in the internal tables,
if not present, the a file of that name is sought
in first the current and then the EM Lib directory
#endif
}
-static int inoptlist(nm)
- char *nm ;
-{
+static int inoptlist(char *nm) {
register char *p=Optlist ;
while ( p && *p ) {
return 0;
}
-intrf() {
+static void intrf(void) {
register trf *new ;
growstring bline ;
int twice ;
rts, new->t_rts) ;
}
rts= new->t_rts ;
- keephead(rts) ; keeptail(rts) ;
+ l_add(&head_list, rts) ;
+ l_add(&tail_list, rts) ;
}
#ifdef DEBUG
if ( debug>=3 ) {
static char *inptr ;
char *em_dir = EM_DIR;
-void
-open_in(name) register char *name ; {
+static void open_in(char *name) {
register dmach *cmac ;
gr_init(&rline) ;
}
}
-close_in() {
+static void close_in(void) {
if ( !incore ) fclose(infile) ;
gr_throw(&rline) ;
}
-char *readline() {
+static char *readline(void) {
/* Get a line from the input,
return 0 if at end,
The line is stored in a volatile buffer,
}
}
-int getinchar() {
+static int getinchar(void) {
register int token ;
if ( incore ) {
return token ;
}
-int getln() {
+static int getln(void) {
register char *c_ptr ;
do {
*/
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include "ack.h"
#include "list.h"
#define ARG_MORE 40 /* The size of args chunks to allocate */
-extern growstring scanvars();
+/* trans.c */
+growstring scanvars(const char *);
+
+static int run_exec(trf *, const char *);
+static void x_arg(char *);
static char **arglist ; /* The first argument */
static unsigned argcount ; /* The current number of arguments */
static unsigned argmax; /* The maximum number of arguments so far */
-int runphase(phase) register trf *phase ; {
+int runphase(trf *phase) {
register list_elem *elem ;
char *prog ; int result ;
growstring bline ;
return result ;
}
-int run_exec(phase,prog) trf *phase ; char *prog ; {
+static int run_exec(trf *phase, const char *prog) {
int status, child, waitchild ;
- do_flush();
+ fflush(stdout) ;
+ fflush(stderr) ;
while ( (child=fork())== -1 ) ;
if ( child ) {
/* The parent */
/*NOTREACHED*/
}
-x_arg(string) char *string ; {
+static void x_arg(char *string) {
/* Add one execute argument to the argument vector */
if ( argcount==argmax ) {
if ( argmax==0 ) {
static char rcs_id[] = "$Id$" ;
#endif
-void try();
+static void start_scan(void);
+static void try(list_elem *, const char *);
+static void scan_found(void);
+static int satisfy(trf *, const char *);
+static enum f_path scan_end(trf **);
+static void find_cpp(void);
-enum f_path getpath(first) register trf **first ; {
+enum f_path getpath(trf **first) {
/* Try to find a transformation path */
start_scan();
/******************** The hard work ********************/
-start_scan() {
+static void start_scan(void) {
register list_elem *scan ;
scanlist(l_first(tr_list),scan) {
last_ocount= 0 ;
}
-void
-try(f_scan,suffix) list_elem *f_scan; char *suffix; {
+static void try(list_elem *f_scan, const char *suffix) {
register list_elem *scan ;
register trf *trafo ;
/* Try to find a transformation path starting at f_scan for a
}
}
-scan_found() {
+static void scan_found(void) {
register list_elem *scan;
int ncount, ocount, pcount ;
}
}
-int satisfy(trafo,suffix) register trf *trafo; char *suffix ; {
+static int satisfy(trf *trafo, const char *suffix) {
register char *f_char, *l_char ;
/* Check whether this transformation is present for
the current machine and the parameter suffix is among
return 0 ;
}
-enum f_path scan_end(first) trf **first ; { /* Finalization */
+static enum f_path scan_end(trf **first) { /* Finalization */
/* Return value indicating whether a transformation was found */
/* Set the flags for the transformation up to, but not including,
the combiner
return F_OK ;
}
-find_cpp() {
+static void find_cpp(void) {
register list_elem *elem ;
scanlist( l_first(tr_list), elem ) {
if ( t_cont(*elem)->t_isprep ) {
*/
-extern char *getcore();
-extern fatal();
-
struct vars {
char *v_name;
enum { routine, string } v_type;
static struct vars *v_first ;
-static struct vars *newvar(name) char *name; {
+static struct vars *newvar(char *name) {
register struct vars *new ;
for ( new=v_first ; new ; new= new->v_next ) {
return new ;
}
}
- new= (struct vars *)getcore( (unsigned)sizeof (struct vars));
+ new= (struct vars *)getcore(sizeof (struct vars));
new->v_name= name ;
new->v_next= v_first ;
v_first= new ;
return new ;
}
-setsvar(name,str) char *name, *str ; {
+void setsvar(char *name, char *str) {
register struct vars *new ;
new= newvar(name);
new->v_value.v_string= str;
}
-setpvar(name,rout) char *name, *(*rout)() ; {
+void setpvar(char *name, char *(*rout)(void)) {
register struct vars *new ;
new= newvar(name);
new->v_value.v_routine= rout;
}
-char *getvar(name) char *name ; {
+char *getvar(const char *name) {
register struct vars *scan ;
for ( scan=v_first ; scan ; scan= scan->v_next ) {
static growstring tail ;
static int touch_tail= NO ;
-char *headvar(),*tailvar() ;
-
-void condit();
-void doassign();
-void set_Rflag();
-
-int transform(phase) register trf *phase ; {
+static char *headvar(void);
+static char *tailvar(void);
+static void set_Rflag(char *);
+static void condit(growstring *, list_head *, list_head *, char *);
+static int mapflag(list_head *, const char *);
+static int mapexpand(char *, const char *);
+static void getcallargs(trf *);
+
+int transform(trf *phase) {
int ok ;
if ( !setfiles(phase) ) {
/* Free the space occupied by the arguments,
except for the linker, since we are bound to exit soon
and do not foresee further need of memory space */
- if ( !phase->t_linker ) discardargs(phase) ;
+ if ( !phase->t_linker )
+ l_throw(&phase->t_args) ;
disc_files(phase) ;
return ok ;
}
-getmapflags(phase) register trf *phase ; {
+void getmapflags(trf *phase) {
register path *l_in ;
register list_elem *elem ;
int scanned ;
}
-do_Rflag(argp) char *argp ; {
- l_add(&R_list,argp) ;
-}
-
-char *headvar() {
+static char *headvar(void) {
if ( !touch_head) return "" ;
return gr_start(head) ;
}
-add_head(str) char *str; {
+void add_head(const char *str) {
if ( !touch_head) {
gr_init(&head) ;
touch_head=YES ;
gr_cat(&head,str) ;
}
-char *tailvar() {
+static char *tailvar(void) {
if ( !touch_tail ) return "" ;
return gr_start(tail) ;
}
-add_tail(str) char *str ; {
+void add_tail(const char *str) {
if ( !touch_tail ) {
gr_init(&tail) ;
touch_tail=YES ;
}
-transini() {
+void transini(void) {
register list_elem *elem ;
register trf *phase ;
setpvar(keeps(TAIL),tailvar) ;
}
-void
-set_Rflag(argp) register char *argp ; {
+static void set_Rflag(char *argp) {
register char *eos ;
register list_elem *prog ;
register int length ;
/* */
/**************************************************************************/
-growstring scanb(line) char *line ; {
+growstring scanb(const char *line) {
/* Scan a line for backslashes, setting the NO_SCAN bit in characters
preceded by a backslash.
*/
- register char *in_c ;
- register int token ;
+ const char *in_c ;
+ int token ;
growstring result ;
enum { TEXT, ESCAPED } state = TEXT ;
return result ;
}
-growstring scanvars(line) char *line ; {
+growstring scanvars(const char *line) {
/* Scan a line variable replacements started by S_VAR.
Two sequences exist: S_VAR name E_VAR, S_VAR name A_VAR text E_VAR.
neither name nor text may contain further replacements.
This to allow later recognition in mapflags, where B_SLASH
would be preventing any recognition.
*/
- register char *in_c ;
- register int token ;
- growstring result ;
- growstring name ;
- register char *tr ;
+ const char *in_c ;
+ int token ;
+ growstring result, name ;
+ char *tr ;
enum { TEXT, FIRST, NAME, SKIP, COPY } state = TEXT ;
gr_init(&result) ; gr_init(&name) ;
return result ;
}
-growstring scanexpr(line) char *line ; {
+static growstring scanexpr(const char *line) {
/* Scan a line for conditional or flag expressions,
dependent on the type. The format is
S_EXPR suflist M_EXPR suflist T_EXPR tail C_EXPR
growstring for futher treatment.
Nesting is not allowed.
*/
- register char *in_c ;
- char *heads ;
- register int token ;
- growstring sufs, tailval ;
- growstring result ;
+ const char *in_c, *heads ;
+ int token ;
+ growstring sufs, tailval, result ;
static list_head fsuff, lsuff ;
enum { TEXT, FDOT, FSUF, LDOT, LSUF, FTAIL } state = TEXT ;
return result ;
}
-void
-condit(line,fsuff,lsuff,tailval) growstring *line ;
- list_head *fsuff, *lsuff;
- char *tailval ;
+static void condit(growstring *line, list_head *fsuff, list_head *lsuff,
+ char *tailval)
{
register list_elem *first ;
register list_elem *last ;
#endif
}
-int mapflag(maplist,cflag) list_head *maplist ; char *cflag ; {
+static int mapflag(list_head *maplist, const char *cflag) {
/* Expand a flag expression */
/* The flag "cflag" is checked for each of the mapflags.
A mapflag entry has the form
return 0 ;
}
-int mapexpand(mapentry,cflag)
- char *mapentry, *cflag ;
-{
- register char *star ;
- register char *ptr ;
- register char *space ;
+static int mapexpand(char *mapentry, const char *cflag) {
+ const char *star ;
+ char *ptr, *space ;
int length ;
star=strchr(mapentry,STAR) ;
return 1 ;
}
-void
-doassign(line,star,length) char *line, *star ; {
+void doassign(const char *line, const char *star, int length) {
growstring varval, name, temp ;
- register char *ptr ;
+ const char *ptr ;
gr_init(&varval) ;
gr_init(&name) ;
#define ISBLANK(c) ( (c)==SPACE || (c)==TAB )
-unravel(line,action) char *line ; int (*action)() ; {
+static void unravel(char *line, void (*action)(char *)) {
/* Unravel the line, get arguments a la shell */
/* each argument is handled to action */
/* The input string is left intact */
}
}
-char *c_rep(string,place,rep) char *string, *place, *rep ; {
+static char *c_rep(char *string, char *place, char *rep) {
/* Produce a string in stable storage produced from 'string'
with the character at place replaced by rep
*/
static list_head *curargs ;
static list_head *comb_args ;
-void
-addargs(string) char *string ; {
+static void addargs(char *string) {
register char *temp, *repc ;
register list_elem *elem ;
l_add(curargs,temp) ;
}
-getcallargs(phase) register trf *phase ; {
+static void getcallargs(trf *phase) {
growstring arg1, arg2 ;
arg1= scanvars(phase->t_argd) ;
unravel( gr_start(arg2), addargs ) ;
gr_throw(&arg2) ;
}
-
-discardargs(phase) register trf *phase ; {
- l_throw(&phase->t_args) ;
-}
} ;
#define t_cont(elem) ((trf *)l_content(elem))
+
+/* files.c */
+int setfiles(trf *);
+void disc_files(trf *);
+void disc_inputs(trf *);
+void rmfile(path *);
+void rmtemps(void);
+void add_input(path *, trf *);
+
+/* run.c */
+int runphase(trf *);
+
+/* scan.c */
+enum f_path { F_OK, F_NOMATCH, F_NOPATH } ;
+enum f_path getpath(trf **);
+
+/* trans.c */
+int transform(trf *);
+void getmapflags(trf *);
+void add_head(const char *);
+void add_tail(const char *);
+void transini(void);
+void doassign(const char *, const char *, int);
# define STDOUT stderr
#endif
-void fuerror(const char* fmt, ...);
-void werror(const char* fmt, ...);
-
-char *basename(string) char *string ; {
+char *ack_basename(const char *string) {
static char retval[256] ;
- char *last_dot, *last_start ;
- register char *store;
- register char *fetch ;
- register int ctoken ;
+ const char *last_dot, *last_start, *fetch ;
+ char *store ;
+ int ctoken ;
last_dot= (char *)0 ;
last_start= string ;
return retval ;
}
-clr_noscan(str) char *str ; {
+void clr_noscan(char *str) {
register char *ptr ;
for ( ptr=str ; *ptr ; ptr++ ) {
*ptr&= ~NO_SCAN ;
}
}
-char *skipblank(str) char *str ; {
+char *skipblank(char *str) {
register char *ptr ;
for ( ptr=str ; *ptr==SPACE || *ptr==TAB ; ptr++ ) ;
return ptr ;
}
-char *firstblank(str) char *str ; {
+char *firstblank(char *str) {
register char *ptr ;
for ( ptr=str ; *ptr && *ptr!=SPACE && *ptr!=TAB ; ptr++ ) ;
}
#ifdef DEBUG
-prns(s) register char *s ; {
+void prns(const char *s) {
for ( ; *s ; s++ ) {
putc((*s&0377)&~NO_SCAN,STDOUT) ;
}
va_end(ap);
}
-do_flush() {
- fflush(stdout) ;
- fflush(stderr) ;
-}
-
-void
-noodstop() {
- quit(-3) ;
-}
-
-quit(code) {
+void quit(int code) {
rmtemps();
exit(code);
}
+
/******
char *keeps(string)
Keep the string in stable storage.
throws(string)
Remove the string stored by keep from stable storage.
+ throws() is now a macro in ack.h.
***********/
-char *keeps(str) char *str ; {
+char *keeps(const char *str) {
register char *result ;
result= getcore( (unsigned)(strlen(str)+1) ) ;
if ( !result ) fatal("Out of core") ;
return strcpy(result,str) ;
}
-throws(str) char *str ; {
- freecore(str) ;
-}
-
-char *getcore(size) unsigned size ; {
- register char *retptr ;
+void *getcore(size_t size) {
+ void *retptr ;
retptr= calloc(1,size) ;
if ( !retptr ) fatal("Out of memory") ;
return retptr ;
}
-char *changecore(ptr,size) char *ptr ; unsigned size ; {
- register char *retptr ;
+void *changecore(void *ptr, size_t size) {
+ void *retptr ;
retptr= realloc(ptr,size) ;
if ( !retptr ) fatal("Out of memory") ;