ack.7
来自「minix操作系统最新版本(3.1.1)的源代码」· 7 代码 · 共 2,091 行 · 第 1/5 页
7
2,091 行
.TH ACK 7.SH NAMEACK \- Additional information on the Amsterdam Compiler Kit compilers.SH DESCRIPTION.de SP.if t .sp 0.4.if n .sp...de XS.SP.in +.5i.nf...de XE.fi.in -.5i.SP...de NS.PP.B ANS\ \\$1...de UX\s-2UNIX\s+2...de MX.if n MINIX 3.if t \s-1MINIX 3\s-1...if n .ds Mx MINIX 3.if t .ds Mx \s-1MINIX 3\s-1.if n .ds Mp Minix-PC.if t .ds Mx \s-2MINIX-PC\s+2.if n .ds Mv Minix-vmd.if t .ds Mv \s-1MINIX 3\s-1-vmd.if n .ds Cw \fR.if t .ds Cw \fC.de CW.if n .ft R.if t .ft C...\"These are the details on the Amsterdam Compiler Kit compilers for thelanguages C, Modula-2, and Pascal. The design decisions that were madewhere the respective standards allowed or mandated this, and the extensionsthat were implemented..SH "ANSI C REPORT"This section specifies the implementation-defined behavior of the ANSI-Ccompiler as required by ANS X3.159-1989..NS A.6.3.1.IP \(buDiagnostics are placed on the standard error output. They have thefollowing specification:.XS"<file>", line <nr>: [(<class>)] <diagnostic>.XEThere are three classes of diagnostics: 'error', 'strict' and 'warning'.When the class is 'error', the class specification is absent.The class 'strict' is used for violations of the standard which arenot severe enough to stop compilation, for example the occurrenceof non white-space after an '#endif' preprocessingdirective. The class 'warning' is used for legal but dubiousconstructions, for example the declaration of a structure-tag in aparameter type list..NS A.6.3.2.IP \(buThe function 'main' can have zero or two parameters. When it has twoparameters, the first parameter is an integer specifying the number ofarguments on the command line (including the command). The secondparameter is a pointer to an array of pointers to the arguments(as strings)..IP \(buInteractive devices are terminals..NS A.6.3.3.IP \(buThe number of significant characters is 64.Corresponding upper-case and lower-case letters are different..NS A.6.3.4.IP \(buThe compiler assumes ASCII-characters in both the source and executioncharacter set..IP \(buThere are no multibyte characters..IP \(buThere are 8 bits in a character..IP \(buCharacter constants that cannot be represented in 8 bitsare truncated..IP \(buCharacter constants that are more than 1 character wide will have thefirst character specified in the least significant byte..IP \(buThe only supported locale is 'C'..IP \(buA plain 'char' has the same range of values as 'signed char'..NS A.6.3.5.IP \(buThe i80x86 and 68000 both have a two's complement binary-number system.Shorts are 2 bytes; ints are 2 bytes under 16-bits \*(Mp and 68000 \*(Mx, 4bytes under 32-bits \*(Mp; longs occupy 4 bytes..IP \(buConverting an integer to a shorter signed integer is implemented byignoring the high-order byte(s) of the former.Converting a unsigned integer to a signed integer of the same type isonly done in administration. This means that the bit-pattern remainsunchanged..IP \(buThe result of bitwise operations on signed integers are what can beexpected on a two's complement machine..IP \(buWhen either operand is negative, the result of the / operator is thelargest integer less than or equal to the algebraic quotient.The sign of the remainder on integer division is the sign of theenumerator..IP \(buThe right-shift of a negative value is negative..NS A.6.3.6.IP \(buThe compiler uses IEEE format for floating-point numbers.High-precision floating-point is used for constant folding..IP \(buTruncation is done to the nearest floating-point number that canbe represented..NS A.6.3.7.IP \(buThe type of the sizeof-operator (also known as size_t) is 'unsigned int'..IP \(buCasting an integer to a pointer or vice versa has no effect inbit-pattern when the sizes are equal. Otherwise the value will betruncated or zero-extended (depending on the direction of theconversion and the relative sizes)..IP \(buThe type of a 'ptrdiff_t' is 'int' on \*(Mp, and 'long' on the 68000\*(Mx versions..NS A.6.3.8.IP \(buSince the front end has only limited control over the registers, it canonly make it more likely that variables that are declared asregisters also end up in registers. The only things that can possibly beput into registers are plain ints and pointers..NS A.6.3.9.IP \(buWhen a member of a union object is accessed using a member of adifferent type, the resulting value will usually be garbage. Thecompiler makes no effort to catch these errors..IP \(buThe alignment of types under 16-bit \*(Mp is 1 byte for characters and 2bytes for all other types. Under other MINIX 3 versions 'int' and smallertypes are aligned to a multiple of their size, bigger scalar types arealigned like 'int'. Arrays have the same alignment as their elements;structs and unions are aligned like their field with the worst alignment..IP \(buA plain 'int' bit-field is taken as a 'signed int'. This means thata field with a size 1 bit-field can only store the values 0 and \(mi1..IP \(buIn bit-fields, high-order bits are allocated first..IP \(buAn enum has the same size as a plain 'int'..NS A.6.3.10.IP \(buAn access to a volatile object is either a load or a store. Justmentioning a volatile variable is not enough.E.g. the statement 'x;' where x is declared volatile, does notconstitute an access. When a volatile object should be read, but itsvalue ignored, 'if (x);' should do the trick..NS A.6.3.11.IP \(buThere is no fixed limit on the number of declarators that may modify anarithmetic, structure or union type, although specifying too many maycause the compiler to run out of memory..NS A.6.3.12.IP \(buThe maximum number of cases in a switch-statement is in the order of1e9, although the compiler may run out of memory somewhat earlier..NS A.6.3.13.IP \(buSince both the preprocessor and the compiler assume ASCII-characters, a single character constant in a conditional-inclusion directivematches the same value in the execution character set..IP \(buThe preprocessor recognizes \fI\(enI...\fR command-line options. Thedirectories thus specified are searched first. After that, /usr/include isvisited..IP \(buQuoted names are first looked for in the directory in which the filewhich does the include resides..IP \(buThe characters in a h- or q- char-sequence are taken to be.UXpaths..IP \(buNeither the front-end nor the preprocessor know any pragmas..IP \(buSince the compiler runs on .MX ,_\^_DATE_\^_ and _\^_TIME_\^_ will always bedefined..NS A.6.3.14.IP \(buNULL is defined as ((void *)0). This in order to detect dubiousconstructions like 'int x = NULL;'..IP \(buThe diagnostic printed by 'assert' is as follows:.XSAssertion "<expr>" failed, file "<file>", line <line>.XEwhere <expr> is the argument to the assert macro, printed as string.(the <file> and <line> should be clear).IP \(buThe sets for character test macros for the C locale are as follows:.XS.ta +\w'isalnum 'u\fBName Set\fR\fIisalnum\fR 0-9A-Za-z\fIisalpha\fR A-Za-z\fIiscntrl\fR \e000-\e037\e177\fIislower\fR a-z\fIisupper\fR A-Z\fIisprint\fR \e040-\e176.DT.XEAs an addition, there is an \fIisascii\fR macro, which tests whether a characteris an ASCII character. Characters in the range from \e000 to \e177 are ASCIIcharacters..IP \(buThe behavior of ACK mathematical functions on domain error is as follows:.XS.ta +\w'log10 'u\fBName Returns\fR\fIasin\fR 0.0\fIacos\fR 0.0\fIatan2\fR 0.0\fIfmod\fR 0.0\fIlog\fR \(miHUGE_VAL\fIlog10\fR \(miHUGE_VAL\fIpow\fR 0.0\fIsqrt\fR 0.0.DT.XE\*(Mv uses the BSD4.4 C library and the Sun FDLIBM C math library insteadof the ACK library. See.BR math (3)for details about the math functions. The \*(Mv libraries offer atleast the same functionality as the ACK library..IP \(buUnderflow range errors do not cause \fIerrno\fR to be set..IP \(buThe function \fIfmod\fR returns 0.0 and sets \fIerrno\fR to EDOM when the secondargument is 0.0..IP \(buThe set of signals for the \fIsignal\fR function is as described by.BR sigaction (2)..IP \(buA text-stream need not end in a new-line character..IP \(buWhite space characters before a new-line appear when read in..IP \(buThere may be any number of null characters appended to a binarystream..IP \(buThe file position indicator of an append mode stream is initiallypositioned at the beginning of the file..IP \(buA write on a text stream does not cause the associated file to betruncated beyond that point..IP \(buThe buffering intended by the standard is fully supported..IP \(buA zero-length file actually exists..IP \(buA file name can consist of any character, except for the '\e0' andthe '/'..IP \(buA file can be open multiple times..IP \(buWhen a \fIremove\fR is done on an open file, reading and writing behavejust as can be expected from a non-removed file. When the associatedstream is closed, however, all written data will be lost..IP \(buWhen a file exists prior to a call to \fIrename\fR, it is removed..IP \(buThe %p conversion in \fIfprintf\fR has the same effect as %#x on \*(Mp and%#lx on the 68000 versions of \*(Mx..IP \(buThe %p conversion in \fIfscanf\fR has the same effect as %x on \*(Mp and%lx on the 68000 versions of \*(Mx..IP \(buA \(mi character that is neither the first nor the last character in thescanlist for %[ conversion is taken to be a range indicator. When thefirst character has a higher ASCII-value than the second, the \(mi willjust be put into the scanlist..IP \(buThe value of \fIerrno\fR when \fIfgetpos\fR or \fIftell\fR failed is that of \fIlseek\fR.This means:.XS.ta +\w'ESPIPE 'u +\w'\- 'uEBADF \- when the stream is not validESPIPE \- when fildes is associated with a pipeEINVAL \- the resulting file pointer would be negative.XE.IP \(buThe messages generated by \fIperror\fR depend on the value of \fIerrno\fR.The mapping of errors to strings is done by \fIstrerror\fR..IP \(buWhen the requested size is zero, \fImalloc\fR, \fIcalloc\fR and \fIrealloc\fRreturn a null-pointer under \*(Mx. Under \*(Mv a unique non-null pointer isreturned..IP \(buWhen \fIabort\fR is called, output buffers will be flushed. Temporary files(made with the \fItmpfile\fR function) will have disappeared when SIGABRTis not caught or ignored..IP \(buThe \fIexit\fR function returns the low-order eight bits of its argumentto the environment..IP \(buThe predefined environment names are controlled by the user.Setting environment variables is done through the \fIputenv\fR function.This function accepts a pointer to char as its argument.To set, for example, the environment variable TERM to a230 one writes.XSstatic char terminal[] = "TERM=a230";putenv(terminal);.XEThe argument to \fIputenv\fR is stored in an internal table, so malloc'edstrings cannot be freed until another call to \fIputenv\fR (which sets thesame environment variable) is made. The argument to \fIputenv\fR must bewritable, which means that officially, the argument cannot be a stringconstant.The function returns 1 if it fails, 0 otherwise..LP.IP \(buThe argument to \fIsystem\fR is passed as argument to \fI/bin/sh \(enc\fR..IP \(buThe strings returned by \fIstrerror\fR depend on \fIerrno\fR. They arelisted in.BR intro (2).Everything else causes \fIstrerror\fR to return "unknown error" under \*(Mx,or the result of sprintf("Error %d", errno) under \*(Mv..IP \(buThe local time zone is per default GMT. This can bechanged through the TZ environment variable, e.g. TZ=EST6.See.BR TZ (5)..IP \(buThe \fIclock\fR function returns the number of ticks since processstartup..SS References.IP [1]ANS X3.159-1989.ft IAmerican National Standard for Information Systems -Programming Language C.ft R.SH "THE MINIX MODULA-2 COMPILER"This section describes the implementation-specific features of the.MXModula-2 compiler.It is not intended to teach Modula-2 programming.For a description of the Modula-2 language,the reader is referred to [1]..SS "The language implemented".PPThis paragraph discusses the deviations from the Modula-2 language as describedin the 'Report on The Programming Language Modula-2',as it appeared in [1],from now on referred to as 'the Report'.Also,the Report sometimes leaves room for interpretation.The section numbersmentioned are the section numbers of the Report..SS "Syntax (section 2)".PPThe syntax recognized is that of the Report,with some extensions toalso recognize the syntax of an earlier definition,given in [2].Only one compilation unit per file is accepted..SS "Vocabulary and Representation (section 3)".PPThe input '\*(Cw10..\fR' is parsed as two tokens: '\*(Cw10\fR' and '\*(Cw..\fR'..PPThe empty string \*(Cw""\fR has type.XS.CWARRAY [0 .. 0] OF CHAR.ft P.XEand contains one character: \*(Cw0C\fR..PPWhen the text of a comment starts with a '\*(Cw$\fR',it may be a pragma.Currently,the following pragmas exist:.nf.SP.CW(*$F (F stands for Foreign) *)(*$R[+|-] (Runtime checks, on or off, default on) *)(*$A[+|-] (Array bound checks, on or off, default off) *)(*$U (Allow for underscores within identifiers) *).ft P.SP.fiThe Foreign pragma is only meaningful in a \*(CwDEFINITION MODULE\fR,and indicates that this\*(CwDEFINITION MODULE\fR describes an interface to a module written in anotherlanguage (for instance C or Pascal).Runtime checks that can be disabled are:range checks,\*(CwCARDINAL\fR overflow checks,checks when assigning a \*(CwCARDINAL\fR to an \*(CwINTEGER\fR and vice versa,and checks that \*(CwFOR\fR-loop control-variables are not changedin the body of the loop.Array bound checks can be enabled,because many EM implementations do notimplement the array bound checking of the EM array instructions.When enabled,the compiler generates a check before generating anEM array instruction.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?