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

📄 pumana.n

📁 早期freebsd实现
💻 N
📖 第 1 页 / 共 2 页
字号:
.\" Copyright (c) 1980, 1993.\"	The Regents of the University of California.  All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\"    must display the following acknowledgement:.\"	This product includes software developed by the University of.\"	California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\"    may be used to endorse or promote products derived from this software.\"    without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\"	@(#)pumanA.n	8.1 (Berkeley) 6/8/93.\".if !\n(xx \{\.so tmac.p \}.ND.nr H1 0.af H1 A.NH Appendix to Wirth's Pascal Report.PPThis section is an appendix tothe definition of the Pascal language in Niklaus Wirth's.I "Pascal Report"and, with that Report, precisely defines theBerkeleyimplementation.This appendix includes a summary of extensions to the language,gives the ways in which the undefined specifications were resolved,gives limitations and restrictions of the current implementation,and lists the added functions and procedures available.It concludes with a list of differences with the commonly availablePascal 6000\-3.4 implementation,and some comments on standard and portable Pascal..NH 2Extensions to the language Pascal.PPThis section defines non-standard language constructs available in.UP .The.B sstandard Pascal option of the translators.PIand.PCcan be used to detect these extensions in programs which are to be transported..SHString padding.PP.UPwill pad constant strings with blanks in expressions and asvalue parameters to make them as long as is required.The following is a legal.UPprogram:.LS\*bprogram\fP x(output);\*bvar\fP z : \*bpacked\fP \*barray\fP [ 1 .. 13 ] \*bof\fP char;\*bbegin\fP    z := 'red';    writeln(z)\*bend\fP;.LEThe padded blanks are added on the right.Thus the assignment above is equivalent to:.LSz := 'red          '.LEwhich is standard Pascal..SHOctal constants, octal and hexadecimal write.PPOctal constants may be given as a sequence of octal digits followedby the character `b' or `B'.The forms.LSwrite(a:n \*boct\fP).LEand.LSwrite(a:n \*bhex\fP).LEcause the internal representation ofexpression.I a,which must be Boolean, character, integer, pointer, or a user-defined enumeratedtype,to be written in octal or hexadecimal respectively..SHAssert statement.PPAn.B assertstatement causes a.I Booleanexpression to be evaluatedeach time the statement is executed.A runtime error results if any of the expressions evaluates to be .I false .The.B assertstatement is treated as a comment if run-time tests are disabled.The syntax for.B assertis:.LS\*bassert\fP <expr>.LE.SHEnumerated type input-output.PPEnumerated types may be read and written.On output the string name associated with the enumeratedvalue is output.If the value is out of range,a runtime error occurs.On input an identifier is read and looked upin a table of names associated with thetype of the variable, andthe appropriate internal value is assigned to the variable beingread.If the name is not found in the tablea runtime error occurs..SHStructure returning functions.PPAn extension has been added which allows functions to return arbitrary sized structures rather than justscalars as in the standard..SHSeparate compilation.PPThe compiler.PChas been extended to allow separate compilation of programs.Procedures and functions declared at the global levelmay be compiled separately.Type checking of calls to separately compiled routines is performedat load time to insure that the program as a wholeis consistent.See section 5.10 for details..NH 2Resolution of the undefined specifications.SHFile name \- file variable associations.PPEach Pascal file variable is associated with a named.UXfile.Except for.I inputand.I output,which areexceptions to some of the rules, a name can become associatedwith a file in any of three ways:.IP "\ \ \ \ \ 1)" 10If a global Pascal file variable appears in the.B programstatementthen it is associated with.UXfile of the same name..IP "\ \ \ \ \ 2)"If a file was reset or rewritten using theextended two-argument form of.I resetor.I rewritethen the given nameis associated..IP "\ \ \ \ \ 3)"If a file which has never had.UXname associatedis reset or rewritten without specifying a namevia the second argument, then a temporary nameof the form `tmp.x'is associated with the file.Temporary names start with`tmp.1' and continue by incrementing the last character in the.SMUSASCII.NLordering.Temporary files are removed automaticallywhen their scope is exited..SHThe program statement.PPThe syntax of the.B programstatement is:.LS\*bprogram\fP <id> ( <file id> { , <file id > } ) ;.LEThe file identifiers (other than.I inputand.I output )must be declared as variables of.B filetype in the global declaration part..SHThe files input and output.PPThe formal parameters.I inputand.I outputare associated with the.UXstandard input and output and have asomewhat special status.The following rules must be noted:.IP "\ \ \ \ \ 1)" 10The program heading.B mustcontains the formal parameter.I output.If.I inputis used, explicitly or implicitly, then it mustalso be declared here..IP "\ \ \ \ \ 2)"Unlike all other files, thePascal files.I inputand.I outputmust not be defined in a declaration,as their declaration is automatically:.LS\*bvar\fP input, output: text.LE.IP "\ \ \ \ \ 3)"The procedure.I resetmay be used on.I input.If no.UXfile name has ever been associated with.I input,and no file name is given, then an attempt will be madeto `rewind'.I input.If this fails, a run timeerror will occur..I Rewritecalls to output act as for any other file, except that.I outputinitially has no associated file.This means that a simple.LSrewrite(output).LEassociates a temporary name with.I output..SHDetails for files.PPIf a file other than.I inputis to be read,then reading must be initiated by a call to theprocedure.I resetwhich causes the Pascal system to attempt to open theassociated.UXfile for reading.If this fails, then a runtime error occurs.Writing of a file other than.I outputmust be initiated by a.I rewritecall,which causes the Pascal system to create the associated.UXfile andto then open the file for writing only..SHBuffering.PPThe buffering for.I outputis determined by the value of the.B boptionat the end of the.B programstatement.If it has its default value 1,then.I outputisbuffered in blocks of up to 512 characters,flushed whenever a writeln occursand at each reference to the file.I input.If it has the value 0,.I outputis unbuffered.Any value of2 or more gives block buffering without line or.I inputreference flushing.All other output files are always buffered in blocks of 512 characters.All output buffers are flushed when the files are closed at scope exit,whenever the procedure.I messageis called, and can be flushed using thebuilt-in procedure.I flush..PPAn important point for an interactive implementation is the definitionof `input\(ua'.If.I inputis a teletype, and the Pascal system reads a character at the beginningof execution to define `input\(ua', then no prompt could be printedby the program before the user is required to type some input.For this reason, `input\(ua' is not defined by the system until its definitionis needed, reading from a file occurring only when necessary..SHThe character set.PPSeven bit.SM USASCIIis the character set used on.UX .The standard Pascalsymbols `and', 'or', 'not', '<=', '>=', '<>',and the uparrow `\(ua' (for pointer qualification)are recognized.\*(dg.FS\*(dgOn many terminals and printers, the up arrow is representedas a circumflex `^'.These are not distinct characters, but rather different graphicrepresentations of the same internal codes..FELess portable are the synonyms tilde `~'for.B not ,`&' for.B and ,and `|' for.B or ..PPUpper and lower case are considered to be distinct.\*(st.FS\*(stThe proposed standard for Pascal considers them to be the same..FEKeywords and built-in.B procedureand.B functionnames arecomposed of all lower case letters.Thus the identifiers GOTO and GOto are distinct both from each other andfrom the keyword\*bgoto\fP.The standard type `boolean' is also available as `Boolean'..PPCharacter strings and constants may be delimited by the character`\''or by the character `#';the latter is sometimes convenient when programs are to be transported.Note that the `#' character has special meaning .upwhen it is the first character on a line \- see.I "Multi-file programs"below..SHThe standard types.PPThe standard type.I integeris conceptually defined as.LS\*btype\fP integer = minint .. maxint;.LE.I Integeris implemented with 32 bit twos complement arithmetic.Predefined constants of type.I integerare:.LS\*bconst\fP maxint = 2147483647; minint = -2147483648;.LE.PPThe standard type.I charis conceptually defined as.LS\*btype\fP char = minchar .. maxchar;.LEBuilt-in character constants are `minchar' and `maxchar', `bell' and `tab';ord(minchar) = 0, ord(maxchar) = 127..PPThe type.I realis implemented using 64 bit floating point arithmetic.The floating point arithmetic is done in `rounded' mode, andprovides approximately 17 digits of precisionwith numbers as small as 10 to the negative 38th power and as large as10 to the 38th power..SHComments.PPComments can be delimited by either `{' and `}' or by `(*' and `*)'.If the character `{' appears in a comment delimited by `{' and `}',a warning diagnostic is printed.A similar warning will be printed if the sequence `(*' appears ina comment delimited by `(*' and `*)'.The restriction implied by this warning is not part of standard Pascal,but detects many otherwise subtle errors..SHOption control.PPOptions of the translators may be controlledin two distinct ways.A number of options may appear on the command line invoking the translator.These options are given as one or more strings of letters preceded by thecharacter `\-' and cause the default setting ofeach given option to be changed.This method of communication of options is expected to predominatefor.UX .Thus the command.LS% \*bpi \-l \-s foo.p\fR.LEtranslates the file foo.p with the listing option enabled (as it normallyis off), and with only standard Pascal features available..PPIf more control over the portions of the program where options are enabled isrequired, then option control in comments can and should be used.Theformat for option control in comments is identical to that used in Pascal6000\-3.4.One places the character `$' as the first character of the commentand follows it by a comma separated list of directives.Thus an equivalent to the command line example given above would be:.LS{$l+,s+ listing on, standard Pascal}.LEas the first line of the program.The `l'option is more appropriately specified on the command line,since it is extremely unlikely in an interactive environmentthat one wants a listing of the program each time it is translated..PPDirectives consist of a letter designating the option,followed either by a `+' to turn the option on, or by a `\-' to turn theoption off.The.B boption takes a single digit instead ofa `+' or `\-'..SH

⌨️ 快捷键说明

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