⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 acd.1

📁 minix操作系统最新版本(3.1.1)的源代码
💻 1
📖 第 1 页 / 共 2 页
字号:
.TH ACD 1.SH NAMEacd \- a compiler driver.SH SYNOPSIS.B acd\fB\-v\fR[\fIn\fR]\fB\-vn\fR[\fIn\fR].BI \-name " name".BI \-descr " descr".BI \-T " dir".RI [ arg " ...]".SH DESCRIPTION.de SP.if t .sp 0.4.if n .sp...B Acdis a compiler driver, a program that calls the several passes that are neededto compile a source file.  It keeps track of all the temporary files usedbetween the passes.  It also defines the interface of the compiler, theoptions the user gets to see..PPThis text only describes.B acditself, it says nothing about the different options the C-compiler accepts.(It has nothing to do with any language, other than being a tool to givea compiler a user interface.).SH OPTIONS.B Acditself takes five options:.TP\fB\-v\fR[\fIn\fR]Sets the diagnostic level to.I n(by default.BR 2 ).The higher.I nis, the more output.B acdgenerates:.B \-v0does not produce any output..B \-v1prints the basenames of the programs called..B \-v2prints names and arguments of the programs called..B \-v3shows the commands executed from the description file too..B \-v4shows the program read from the description file too.  Levels 3 and 4 usebackspace overstrikes that look good when viewing the output with a smartpager..TP\fB\-vn\fR[\fIn\fR]Like.B \-vexcept that no command is executed.  The driver is just play-acting..TP.BI \-name " name".B Acdis normally linked to the name the compiler is to be called with by theuser.  The basename of this, say.BR cc ,is the call name of the driver.  It plays a role in selecting the properdescription file.  With the.B \-nameoption one can change this..B Acd \-name cchas the same effect as calling the program as.BR cc ..TP.BI \-descr " descr"Allows one to choose the pass description file of the driver.  By default.I descris the same as.IR name ,the call name of the program.  If.I descrdoesn't start with.BR / ,.BR ./ ,or.BR ../then the file.BI /usr/lib/ descr /descrwill be used for the description, otherwise.I descritself.  Thus.B cc \-descr newcccalls the C-compiler with a different description file without changing thecall name.  Finally, if.I descris \fB"\-"\fP, standard input is read.  (The default lib directory.BR /usr/lib ,may be changed to.I dirat compile time by \fB\-DLIB=\e"\fP\fIdir\fP\fB\e"\fP.  The default.I descrmay be set with \fB\-DDESCR=\e"\fP\fIdescr\fP\fB\e"\fP for simpleinstallations on a system without symlinks.).TP.BI \-T " dir"Temporary files are made in.B /tmpby default, which may be overridden by the environment variable.BR TMPDIR ,which may be overridden by the.B \-Toption..SH "THE DESCRIPTION FILE"The description file is a program interpreted by the driver.  It has variables,lists of files, argument parsing commands, and rules for transforming inputfiles..SS SyntaxThere are four simple objects:.PP.RSWords, Substitutions, Letters, and Operators..RE.PPAnd there are two ways to group objects:.PP.RSLists, forming sequences of anything but letters,.SPStrings, forming sequences of anything but Words and Operators..RE.PPEach object has the following syntax:.IP WordsThey are sequences of characters, like.BR cc ,.BR \-I/usr/include ,.BR /lib/cpp .No whitespace and no special characters.  The backslash character.RB ( \e )may be used to make special characters common, except whitespace.  A backslashfollowed by whitespace is completely removed from the input.  The sequence.B \enis changed to a newline..IP SubstitutionsA substitution (henceforth called 'subst') is formed with a.BR $ ,e.g..BR $opt ,.BR $PATH ,.BR ${lib} ,.BR $\(** .The variable name after the.B $is made of letters, digits and underscores, or any sequence of charactersbetween parentheses or braces, or a single other character.  A subst indicatesthat the value of the named variable must be substituted in the list or stringwhen fully evaluated..IP LettersLetters are the single characters that would make up a word..IP OperatorsThe characters.BR = ,.BR + ,.BR \- ,.BR \(** ,.BR < ,and.B >are the operators.  The first four must be surrounded by whitespace if theyare to be seen as special (they are often used in arguments).  The last twoare always special..IP ListsOne line of objects in the description file forms a list.  Put parenthesesaround it and you have a sublist.  The values of variables are lists..IP StringsAnything that is not yet a word is a string.  All it needs is that the substsin it are evaluated, e.g..BR $LIBPATH/lib$key.a .A single subst doesn't make a string, it expands to a list.  You need atleast one letter or other subst next to it.  Strings (and words) may alsobe formed by enclosing them in double quotes.  Only.B \eand.B $keep their special meaning within quotes..SS EvaluationOne thing has to be carefully understood: Substitutions are delayed untilthe last possible moment, and description files make heavy use of this.Only if a subst is tainted, either because its variable is declared local, orbecause a subst in its variable's value is tainted, is it immediatelysubstituted.  So if a list is assigned to a variable then this list is onlychecked for tainted substs.  Those substs are replaced by the valueof their variable.  This is called partial evaluation..PPFull evaluation expands all substs, the list is flattened, i.e. allparentheses are removed from sublists..PPImplosive evaluation is the last that has to be done to a list before itcan be used as a command to execute.  The substs within a string have beenevaluated to lists after full expansion, but a string must be turned intoa single word, not a list.  To make this happen, a string is first explodedto all possible combinations of words choosing one member of the lists withinthe string.  These words are tried one by one to see if they exist as afile.  The first one that exists is taken, if none exists than the firstchoice is used.  As an example, assume.B LIBPATHequals.BR "(/lib /usr/lib)" ,.B keyis.B (c)and.B keyhappens to be local.  Then we have:.PP.RS\fB"$LIBPATH/lib$key.a"\fP.RE.PPbefore evaluation,.PP.RS\fB"$LIBPATH/lib(c).a"\fP.RE.PPafter partial evaluation,.PP.RS\fB"(/lib/libc.a /usr/lib/libc.a)"\fP.RE.PPafter full evaluation, and finally.PP.RS.B /usr/lib/libc.a.RE.PPafter implosion, if the file exists..SS OperatorsThe operators modify the way evaluation is done and perform a specialfunction on a list:.TP.B \(**Forces full evaluation on all the list elements following it.  Use it toforce substitution of the current value of a variable.  This is the onlyoperator that forces immediate evaluation..TP.B +When a.B +exists in a list that is fully evaluated, then all the elements before the.B +are imploded and all elements after the.B +are imploded and added to the list if they are not already in the list.  Sothis operator can be used either for set addition, or to force implosiveexpansion within a sublist..TP.B \-Like.BR + ,except that elements after the.B \-are removed from the list..PPThe set operators can be used to gather options that exclude each otheror for their side effect of implosive expansion.  You may want to write:.PP.RS\fBcpp \-I$LIBPATH/include\fP.RE.PPto call cpp with an extra include directory, but.B $LIBPATHis expanded using a filename starting with.B \-Iso this won't work.  Given that any problem in Computer Science can be solvedwith an extra level of indirection, use this instead:.PP.RS.ft Bcpp \-I$INCLUDE.brINCLUDE = $LIBPATH/include +.ft P.RE.SS "Special Variables"There are three special variables used in a description file:.BR $\(** ,.BR $< ,and.BR $> .These variables are always local and mostly read-only.  They will beexplained later..SS "A Program"The lists in a description file form a program that is executed from thefirst to the last list.  The first word in a list may be recognized as abuiltin command (only if the first list element is indeed simply a word.)If it is not a builtin command then the list is imploded and used as a\s-2UNIX\s+2 command with arguments..PPIndentation (by tabs or spaces) is not just makeup for a program, but areused to group lines together.  Some builtin commands need a body.  Thesebodies are simply lines at a deeper indentation..PPEmpty lines are not ignored either, they have the same indentation level asthe line before it.  Comments (starting with a.B #and ending at end of line) have an indentation of their own and can be usedas null commands..PP.B Acdwill complain about unexpected indentation shifts and empty bodies.  Commandscan share the same body by placing them at the same indentation level beforethe indented body.  They are then "guards" to the same body, and are triedone by one until one succeeds, after which the body is executed..PPSemicolons may be used to separate commands instead of newlines.  The commandsare then all at the indentation level of the first..SS "Execution phases"The driver runs in three phases: Initialization, Argument scanning, andCompilation.  Not all commands work in all phases.  This is further explainedbelow..SS "The Commands"The commands accept arguments that are usually generic expressions thatimplode to a word or a list of words.  When.I varis specified, then a single word or subst needs to be given, soan assignment can be either.I name.B =.IR value ,or.BI $ name.B =.IR value ..TP.IB "var " = " expr ..."The partially evaluated list of expressions is assigned to.IR var .During the evaluation is.I varmarked as local, and after the assignment set from undefined to defined..TP.BI unset " var".I Varis set to null and is marked as undefined..TP.BI import " var"If.I varis defined in the environment of.B acdthen it is assigned to.IR var .The environment variable is split into words at whitespace and colons.  Emptyspace between two colons.RB ( :: )is changed to a dot..TP.BI mktemp " var " [ suffix ]Assigns to.I varthe name of a new temporary file, usually something like /tmp/acd12345x.  If.I suffixis present then it will be added to the temporary file's name.  (Use itbecause some programs require it, or just because it looks good.).B Acdremembers this file, and will delete it as soon as you stop referencing it..TP.BI temporary " word"Mark the file named by.I wordas a temporary file.  You have to make sure that the name is stored in somelist in imploded form, and not just temporarily created when.I wordis evaluated, because then it will be immediately removed and forgotten..TP.BI stop " suffix"Sets the target suffix for the compilation phase.  Something like.B stop .omeans that the source files must be compiled to object files.  At least one.B stopcommand must be executed before the compilation phase begins.  It may not bechanged during the compilation phase.  (Note: There is no restriction on.IR suffix ,it need not start with a dot.).TP.BI treat " file suffix"Marks the file as having the given suffix for the compile phase.  Usefulfor sending a.B \-loption directly to the loader by treating it as having the.B .asuffix..TP.BI numeric " arg"Checks if.I argis a number.  If not then.B acdwill exit with a nice error message..TP.BI error " expr ..."Makes the driver print the error message.I "expr ..."and exit..TP.BI if " expr " = " expr".B Iftests if the two expressions are equal using set comparison, i.e. eachexpression should contain all the words in the other expression.  If thetest succeeds then the if-body is executed..TP.BI ifdef " var"Executes the ifdef-body if.I varis defined..TP.BI ifndef " var"Executes the ifndef-body if.I varis undefined..TP.BI iftemp " arg"Executes the iftemp-body if.I argis a temporary file.  Use it when a command has the same file as input andoutput and you don't want to clobber the source file:.SP.RS.nf.ft B

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -