147107Sbostic# 260710Sbostic# Copyright (c) 1991, 1993 360710Sbostic# The Regents of the University of California. All rights reserved. 447107Sbostic# 547107Sbostic# This code is derived from software contributed to Berkeley by 647107Sbostic# Kenneth Almquist. 747107Sbostic# 847107Sbostic# %sccs.include.redist.sh% 947107Sbostic# 10*69277Schristos# @(#)nodetypes 8.2 (Berkeley) 05/04/95 1147107Sbostic 1247107Sbostic# This file describes the nodes used in parse trees. Unindented lines 1347107Sbostic# contain a node type followed by a structure tag. Subsequent indented 1447107Sbostic# lines specify the fields of the structure. Several node types can share 1547107Sbostic# the same structure, in which case the fields of the structure should be 1647107Sbostic# specified only once. 1747107Sbostic# 1847107Sbostic# A field of a structure is described by the name of the field followed 1947107Sbostic# by a type. The currently implemented types are: 2047107Sbostic# nodeptr - a pointer to a node 2147107Sbostic# nodelist - a pointer to a list of nodes 2247107Sbostic# string - a pointer to a nul terminated string 2347107Sbostic# int - an integer 2447107Sbostic# other - any type that can be copied by assignment 2547107Sbostic# temp - a field that doesn't have to be copied when the node is copied 2647107Sbostic# The last two types should be followed by the text of a C declaration for 2747107Sbostic# the field. 2847107Sbostic 2947107SbosticNSEMI nbinary # two commands separated by a semicolon 3047107Sbostic type int 3147107Sbostic ch1 nodeptr # the first child 3247107Sbostic ch2 nodeptr # the second child 3347107Sbostic 3447107SbosticNCMD ncmd # a simple command 3547107Sbostic type int 3647107Sbostic backgnd int # set to run command in background 3747107Sbostic args nodeptr # the arguments 3847107Sbostic redirect nodeptr # list of file redirections 3947107Sbostic 4047107SbosticNPIPE npipe # a pipeline 4147107Sbostic type int 4247107Sbostic backgnd int # set to run pipeline in background 4347107Sbostic cmdlist nodelist # the commands in the pipeline 4447107Sbostic 4547107SbosticNREDIR nredir # redirection (of a compex command) 4647107Sbostic type int 4747107Sbostic n nodeptr # the command 4847107Sbostic redirect nodeptr # list of file redirections 4947107Sbostic 5047107SbosticNBACKGND nredir # run command in background 5147107SbosticNSUBSHELL nredir # run command in a subshell 5247107Sbostic 5347107SbosticNAND nbinary # the && operator 5447107SbosticNOR nbinary # the || operator 5547107Sbostic 5647107SbosticNIF nif # the if statement. Elif clauses are handled 5747107Sbostic type int # using multiple if nodes. 5847107Sbostic test nodeptr # if test 5947107Sbostic ifpart nodeptr # then ifpart 6047107Sbostic elsepart nodeptr # else elsepart 6147107Sbostic 6247107SbosticNWHILE nbinary # the while statement. First child is the test 6347107SbosticNUNTIL nbinary # the until statement 6447107Sbostic 6547107SbosticNFOR nfor # the for statement 6647107Sbostic type int 6747107Sbostic args nodeptr # for var in args 6847107Sbostic body nodeptr # do body; done 6947107Sbostic var string # the for variable 7047107Sbostic 7147107SbosticNCASE ncase # a case statement 7247107Sbostic type int 7347107Sbostic expr nodeptr # the word to switch on 7447107Sbostic cases nodeptr # the list of cases (NCLIST nodes) 7547107Sbostic 7647107SbosticNCLIST nclist # a case 7747107Sbostic type int 7847107Sbostic next nodeptr # the next case in list 7947107Sbostic pattern nodeptr # list of patterns for this case 8047107Sbostic body nodeptr # code to execute for this case 8147107Sbostic 8247107Sbostic 8347107SbosticNDEFUN narg # define a function. The "next" field contains 8447107Sbostic # the body of the function. 8547107Sbostic 8647107SbosticNARG narg # represents a word 8747107Sbostic type int 8847107Sbostic next nodeptr # next word in list 8947107Sbostic text string # the text of the word 9047107Sbostic backquote nodelist # list of commands in back quotes 9147107Sbostic 9247107SbosticNTO nfile # fd> fname 9347107SbosticNFROM nfile # fd< fname 9447107SbosticNAPPEND nfile # fd>> fname 9547107Sbostic type int 9647107Sbostic next nodeptr # next redirection in list 9747107Sbostic fd int # file descriptor being redirected 9847107Sbostic fname nodeptr # file name, in a NARG node 9947107Sbostic expfname temp char *expfname # actual file name 10047107Sbostic 10147107SbosticNTOFD ndup # fd<&dupfd 10247107SbosticNFROMFD ndup # fd>&dupfd 10347107Sbostic type int 10447107Sbostic next nodeptr # next redirection in list 10547107Sbostic fd int # file descriptor being redirected 10647107Sbostic dupfd int # file descriptor to duplicate 107*69277Schristos vname nodeptr # file name if fd>&$var 10847107Sbostic 109*69277Schristos 11047107SbosticNHERE nhere # fd<<\! 11147107SbosticNXHERE nhere # fd<<! 11247107Sbostic type int 11347107Sbostic next nodeptr # next redirection in list 11447107Sbostic fd int # file descriptor being redirected 11547107Sbostic doc nodeptr # input to command (NARG node) 11653177Smarc 11753177SmarcNNOT nnot # ! command (actually pipeline) 11853177Smarc type int 11953177Smarc com nodeptr 120