src/commands/i86/cc.c File Reference

#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>

Go to the source code of this file.

Classes

struct  passinfo
struct  compile
struct  compile::compile::pass
struct  arglist

Defines

#define SHELL   "/bin/sh"
#define PP   "/usr/lib/ncpp"
#define IRREL   "/usr/lib/irrel"
#define CEM   "/usr/lib/ncem"
#define M2EM   "/usr/lib/nm2em"
#define ENCODE   "/usr/lib/em_encode"
#define OPT   "/usr/lib/nopt"
#define CG   "/usr/lib/ncg"
#define AS   "/usr/lib/as"
#define LD   "/usr/lib/ld"
#define CV   "/usr/lib/cv"
#define LIBDIR   "/usr/lib"
#define CRT   "/usr/lib/ncrtso.o"
#define PEM   "/usr/lib/npem"
#define PRT   "/usr/lib/nprtso.o"
#define M2RT   "/usr/lib/nm2rtso.o"
#define LIBC   "/usr/lib/libd.a", "/usr/lib/libc.a"
#define LIBP   "/usr/lib/libp.a", "/usr/lib/libc.a"
#define LIBM2   "/usr/lib/libm2.a", "/usr/lib/libc.a"
#define END   "/usr/lib/libe.a", "/usr/lib/end.a"
#define M2DEF   "-I/usr/lib/m2"
#define INPUT   01
#define OUTPUT   02
#define LOADER   04
#define STDIN   010
#define STDOUT   020
#define NOCLEAN   040
#define O_OUTPUT   0100
#define PREPALWAYS   0200
#define PREPCOND   0400
#define PREPNOLN   01000
#define MAXHEAD   10
#define MAXTAIL   5
#define MAXPASS   7
#define DEFLANG   010
#define PREP_FLAGS
#define MAXARGC   150
#define USTR_SIZE   64
#define init(a)   ((a)->al_argc = 1)
#define cleanup(str)   (str && remove(str))

Typedefs

typedef char USTRING [USTR_SIZE]

Functions

 _PROTOTYPE (char *library,(char *nm))
 _PROTOTYPE (void trapcc,(int sig))
 _PROTOTYPE (int main,(int argc, char *argv[]))
 _PROTOTYPE (int remove,(char *str))
 _PROTOTYPE (char *alloc,(unsigned u))
 _PROTOTYPE (int append,(struct arglist *al, char *arg))
 _PROTOTYPE (int concat,(struct arglist *al1, struct arglist *al2))
 _PROTOTYPE (char *mkstr,(char *dst, char *arg1, char *arg2, char *arg3))
 _PROTOTYPE (int basename,(char *str, char *dst))
 _PROTOTYPE (char *extension,(char *fln))
 _PROTOTYPE (int runvec,(struct arglist *vec, struct passinfo *pass, char *in, char *out))
 _PROTOTYPE (int prnum,(unsigned x))
 _PROTOTYPE (int pr_vec,(struct arglist *vec))
 _PROTOTYPE (int mktempname,(char *nm))
 _PROTOTYPE (int mkbase,(void))
 _PROTOTYPE (int needsprep,(char *name))
 _PROTOTYPE (char *apply,(struct passinfo *pinf, struct compile *cp, char *name, int passindex, int noremove, int first, char *resultname))
 _PROTOTYPE (int applicable,(struct passinfo *pinf, char *suffix))
 _PROTOTYPE (char *process,(char *name, int noremove))
 _PROTOTYPE (int mkvec,(struct arglist *call, char *in, char *out, struct pass *pass, struct passinfo *pinf))
 _PROTOTYPE (int callld,(struct arglist *in, char *out, struct pass *pass, struct passinfo *pinf))
 _PROTOTYPE (int clean,(struct arglist *c))
 _PROTOTYPE (int scanflags,(struct arglist *call, struct passinfo *pinf))
char * library (char *nm)
void trapcc (int sig)
 main (argc, argv)
 remove (char *str)
char * alloc (unsigned u)
 append (struct arglist *al, char *arg)
 concat (struct arglist *al1, struct arglist *al2)
char * mkstr (char *dst, char *arg1, char *arg2, char *arg3)
 basename (char *str, char *dst)
char * extension (char *fln)
 runvec (struct arglist *vec, struct passinfo *pass, char *in, char *out)
 prnum (unsigned x)
 prs (char *str)
 panic (char *str)
 pr_vec (struct arglist *vec)
 ex_vec (struct arglist *vec)
 mktempname (char *nm)
 mkbase ()
 mkloader ()
 needsprep (char *name)
 cfile (char *name)
char * apply (struct passinfo *pinf, struct compile *cp, char *name, passindex, noremove, first, char *resultname)
int applicable (struct passinfo *pinf, char *suffix)
char * process (char *name, noremove)
 mkvec (struct arglist *call, char *in, char *out, struct pass *pass, struct passinfo *pinf)
 callld (struct arglist *in, char *out, struct pass *pass, struct passinfo *pinf)
 clean (struct arglist *c)
 scanflags (struct arglist *call, struct passinfo *pinf)

Variables

struct passinfo passinfo []
struct pass preprocessor
struct pass prepnoln
struct pass irrel
struct compile passes []
struct arglist CALLVEC
int kids = -1
char * o_FILE = "a.out"
char * ProgCall = 0
int RET_CODE = 0
char * stopsuffix
int v_flag = 0
int t_flag = 0
int noexec = 0
int fp_lib = 1
int E_flag = 0
int i_flag = 1
USTRING curfil
USTRING newfil
struct arglist SRCFILES
struct arglist LDIRS
struct arglist LDFILES
struct arglist GEN_LDFILES
struct arglist FLAGS
char * tmpdir = "/tmp"
char tmpname [64]
struct compilecompbase
struct passloader
struct passinfoloaderinfo
char * source
int maxLlen


Define Documentation

#define AS   "/usr/lib/as"

Definition at line 27 of file cc.c.

#define CEM   "/usr/lib/ncem"

Definition at line 22 of file cc.c.

#define CG   "/usr/lib/ncg"

Definition at line 26 of file cc.c.

#define cleanup ( str   )     (str && remove(str))

Definition at line 212 of file cc.c.

#define CRT   "/usr/lib/ncrtso.o"

Definition at line 31 of file cc.c.

#define CV   "/usr/lib/cv"

Definition at line 29 of file cc.c.

#define DEFLANG   010

Definition at line 97 of file cc.c.

#define ENCODE   "/usr/lib/em_encode"

Definition at line 24 of file cc.c.

#define END   "/usr/lib/libe.a", "/usr/lib/end.a"

Definition at line 38 of file cc.c.

#define init ( a   )     ((a)->al_argc = 1)

Definition at line 211 of file cc.c.

#define INPUT   01

Definition at line 60 of file cc.c.

#define IRREL   "/usr/lib/irrel"

Definition at line 21 of file cc.c.

#define LD   "/usr/lib/ld"

Definition at line 28 of file cc.c.

#define LIBC   "/usr/lib/libd.a", "/usr/lib/libc.a"

Definition at line 35 of file cc.c.

#define LIBDIR   "/usr/lib"

Definition at line 30 of file cc.c.

#define LIBM2   "/usr/lib/libm2.a", "/usr/lib/libc.a"

Definition at line 37 of file cc.c.

#define LIBP   "/usr/lib/libp.a", "/usr/lib/libc.a"

Definition at line 36 of file cc.c.

#define LOADER   04

Definition at line 62 of file cc.c.

#define M2DEF   "-I/usr/lib/m2"

Definition at line 39 of file cc.c.

#define M2EM   "/usr/lib/nm2em"

Definition at line 23 of file cc.c.

#define M2RT   "/usr/lib/nm2rtso.o"

Definition at line 34 of file cc.c.

#define MAXARGC   150

Definition at line 195 of file cc.c.

#define MAXHEAD   10

Definition at line 72 of file cc.c.

#define MAXPASS   7

Definition at line 74 of file cc.c.

#define MAXTAIL   5

Definition at line 73 of file cc.c.

#define NOCLEAN   040

Definition at line 65 of file cc.c.

#define O_OUTPUT   0100

Definition at line 66 of file cc.c.

#define OPT   "/usr/lib/nopt"

Definition at line 25 of file cc.c.

#define OUTPUT   02

Definition at line 61 of file cc.c.

#define PEM   "/usr/lib/npem"

Definition at line 32 of file cc.c.

#define PP   "/usr/lib/ncpp"

Definition at line 20 of file cc.c.

#define PREP_FLAGS

Value:

"-D_EM_WSIZE=2", "-D_EM_PSIZE=2", "-D_EM_SSIZE=2", \
                        "-D_EM_LSIZE=4", "-D_EM_FSIZE=4", "-D_EM_DSIZE=8", \
                        "-D__ACK__", "-D__minix", "-D__i86"

Definition at line 115 of file cc.c.

#define PREPALWAYS   0200

Definition at line 67 of file cc.c.

#define PREPCOND   0400

Definition at line 68 of file cc.c.

#define PREPNOLN   01000

Definition at line 69 of file cc.c.

#define PRT   "/usr/lib/nprtso.o"

Definition at line 33 of file cc.c.

#define SHELL   "/bin/sh"

Definition at line 19 of file cc.c.

#define STDIN   010

Definition at line 63 of file cc.c.

#define STDOUT   020

Definition at line 64 of file cc.c.

#define USTR_SIZE   64

Definition at line 196 of file cc.c.


Typedef Documentation

typedef char USTRING[USTR_SIZE]

Definition at line 198 of file cc.c.


Function Documentation

_PROTOTYPE ( int  scanflags,
(struct arglist *call, struct passinfo *pinf)   
)

_PROTOTYPE ( int  clean,
(struct arglist *c  
)

_PROTOTYPE ( int  callld,
(struct arglist *in, char *out, struct pass *pass, struct passinfo *pinf)   
)

_PROTOTYPE ( int  mkvec,
(struct arglist *call, char *in, char *out, struct pass *pass, struct passinfo *pinf)   
)

_PROTOTYPE ( char *  process,
(char *name, int noremove)   
)

_PROTOTYPE ( int  applicable,
(struct passinfo *pinf, char *suffix  
)

_PROTOTYPE ( char *  apply,
(struct passinfo *pinf, struct compile *cp, char *name, int passindex, int noremove, int first, char *resultname)   
)

_PROTOTYPE ( int  needsprep,
(char *name  
)

_PROTOTYPE ( int  mkbase,
(void)   
)

_PROTOTYPE ( int  mktempname,
(char *nm)   
)

_PROTOTYPE ( int  pr_vec,
(struct arglist *vec)   
)

_PROTOTYPE ( int  prnum,
(unsigned x  
)

_PROTOTYPE ( int  runvec,
(struct arglist *vec, struct passinfo *pass, char *in, char *out)   
)

_PROTOTYPE ( char *  extension,
(char *fln)   
)

_PROTOTYPE ( int  basename,
(char *str, char *dst)   
)

_PROTOTYPE ( char *  mkstr,
(char *dst, char *arg1, char *arg2, char *arg3)   
)

_PROTOTYPE ( int  concat,
(struct arglist *al1, struct arglist *al2)   
)

_PROTOTYPE ( int  append,
(struct arglist *al, char *arg  
)

_PROTOTYPE ( char *  alloc,
(unsigned u)   
)

_PROTOTYPE ( int  remove,
(char *str  
)

_PROTOTYPE ( int  main,
(int argc, char *argv[])   
)

_PROTOTYPE ( void  trapcc,
(int sig  
)

_PROTOTYPE ( char *  library,
(char *nm)   
)

char* alloc ( unsigned  u  ) 

Definition at line 467 of file cc.c.

append ( struct arglist al,
char *  arg 
)

Definition at line 476 of file cc.c.

int applicable ( struct passinfo pinf,
char *  suffix 
)

Definition at line 833 of file cc.c.

char* apply ( struct passinfo pinf,
struct compile cp,
char *  name,
passindex  ,
noremove  ,
first  ,
char *  resultname 
)

Definition at line 769 of file cc.c.

basename ( char *  str,
char *  dst 
)

Definition at line 520 of file cc.c.

callld ( struct arglist in,
char *  out,
struct pass pass,
struct passinfo pinf 
)

Definition at line 943 of file cc.c.

cfile ( char *  name  ) 

Definition at line 758 of file cc.c.

clean ( struct arglist c  ) 

Definition at line 983 of file cc.c.

concat ( struct arglist al1,
struct arglist al2 
)

Definition at line 488 of file cc.c.

ex_vec ( struct arglist vec  ) 

Definition at line 672 of file cc.c.

char* extension ( char *  fln  ) 

Definition at line 542 of file cc.c.

char* library ( char *  nm  ) 

Definition at line 276 of file cc.c.

main ( argc  ,
argv   
)

Definition at line 311 of file cc.c.

mkbase (  ) 

Definition at line 713 of file cc.c.

mkloader (  ) 

Definition at line 733 of file cc.c.

char* mkstr ( char *  dst,
char *  arg1,
char *  arg2,
char *  arg3 
)

Definition at line 502 of file cc.c.

mktempname ( char *  nm  ) 

Definition at line 696 of file cc.c.

mkvec ( struct arglist call,
char *  in,
char *  out,
struct pass pass,
struct passinfo pinf 
)

Definition at line 914 of file cc.c.

needsprep ( char *  name  ) 

Definition at line 745 of file cc.c.

panic ( char *  str  ) 

Definition at line 649 of file cc.c.

pr_vec ( struct arglist vec  ) 

Definition at line 656 of file cc.c.

prnum ( unsigned  x  ) 

Definition at line 626 of file cc.c.

char* process ( char *  name,
noremove   
)

Definition at line 859 of file cc.c.

prs ( char *  str  ) 

Definition at line 642 of file cc.c.

remove ( char *  str  ) 

Definition at line 451 of file cc.c.

runvec ( struct arglist vec,
struct passinfo pass,
char *  in,
char *  out 
)

Definition at line 553 of file cc.c.

scanflags ( struct arglist call,
struct passinfo pinf 
)

Definition at line 995 of file cc.c.

void trapcc ( int  sig  ) 

Definition at line 301 of file cc.c.


Variable Documentation

struct arglist CALLVEC

Definition at line 205 of file cc.c.

struct compile* compbase

Definition at line 238 of file cc.c.

Definition at line 227 of file cc.c.

int E_flag = 0

Definition at line 223 of file cc.c.

struct arglist FLAGS

Definition at line 233 of file cc.c.

int fp_lib = 1

Definition at line 222 of file cc.c.

Definition at line 232 of file cc.c.

int i_flag = 1

Definition at line 224 of file cc.c.

struct pass irrel

Initial value:

 { "irrel",
                            {0}
                        }

Definition at line 129 of file cc.c.

int kids = -1

Definition at line 207 of file cc.c.

struct arglist LDFILES

Definition at line 231 of file cc.c.

struct arglist LDIRS

Definition at line 230 of file cc.c.

struct pass* loader

Definition at line 239 of file cc.c.

Definition at line 240 of file cc.c.

int maxLlen

Definition at line 242 of file cc.c.

Definition at line 228 of file cc.c.

int noexec = 0

Definition at line 221 of file cc.c.

char* o_FILE = "a.out"

Definition at line 209 of file cc.c.

struct compile passes[]

Definition at line 136 of file cc.c.

struct passinfo passinfo[]

Initial value:

 {
        { "cpp", PP, "CPP", "i", "wo=o,I*,D*,U*,P", INPUT|STDOUT },
        { "irrel", IRREL, "i", "i", "m", INPUT},
        { "cem", CEM, "i,c", "k", "m=o,p,wa=a,wo=o,ws=s,w,T*", INPUT|OUTPUT|PREPALWAYS },
        { "pc", PEM, "i,p", "k", "n=L,w,a,A,R", INPUT|OUTPUT|PREPCOND },
        { "m2", M2EM, "i,mod", "k", "n=L,w*,A,R,W*,3,I*", INPUT|OUTPUT|PREPCOND },
        { "encode", ENCODE, "i,e", "k", "", INPUT|STDOUT|PREPCOND|PREPNOLN },
        { "opt", OPT, "k", "m", "", STDIN|STDOUT },
        { "cg", CG, "m", "s", "O=p4", INPUT|OUTPUT },
        { "as", AS, "i,s", "o", "T*", INPUT|O_OUTPUT|PREPCOND },
        { "ld", LD, "o", "out", "i,s", INPUT|LOADER },  
        { "cv", CV, "out", 0, "", INPUT|OUTPUT|NOCLEAN },       
        { 0}
}

Definition at line 100 of file cc.c.

struct pass prepnoln

Initial value:

 { "cpp",
                            { PREP_FLAGS, "-P" }
                            , {0}
                            }

Definition at line 124 of file cc.c.

Initial value:

 { "cpp",
                            { PREP_FLAGS }
                            , {0}
                            }

Definition at line 119 of file cc.c.

char* ProgCall = 0

Definition at line 214 of file cc.c.

int RET_CODE = 0

Definition at line 216 of file cc.c.

char* source

Definition at line 241 of file cc.c.

struct arglist SRCFILES

Definition at line 229 of file cc.c.

char* stopsuffix

Definition at line 218 of file cc.c.

int t_flag = 0

Definition at line 220 of file cc.c.

char* tmpdir = "/tmp"

Definition at line 235 of file cc.c.

char tmpname[64]

Definition at line 236 of file cc.c.

int v_flag = 0

Definition at line 219 of file cc.c.


Generated on Tue Mar 9 04:36:33 2010 for Minix by  doxygen 1.5.8