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

📄 bas.1

📁 unix v7是最后一个广泛发布的研究型UNIX版本
💻 1
字号:
.TH BAS 1 .SH NAMEbas \- basic.SH SYNOPSIS.B bas[ file ].SH DESCRIPTION.I Basis a dialect of Basic.If a file argument is provided,the file is used for input before the terminalis read..I Basaccepts lines of the form:.PP   statement   integer statement.PPInteger numbered statements(known as internal statements)are stored for later execution.They are stored in sorted ascending order.Non-numbered statements are immediately executed.The result of an immediate expression statement(that does not have `=' as its highest operator) is printed.Interrupts suspend computation..PPStatements have the following syntax:.HP 5expression.brThe expression is executed for its sideeffects (assignment or function call)or for printing as described above..HP 5.B comment.li....brThis statement is ignored.It is used to interject commentary in a program..HP 5.B done.brReturn to system level..HP 5.B dump.brThe name and current value of everyvariable is printed..HP 5.B edit.brThe UNIX editor,.I ed,is invoked with the.I fileargument.After the editor exits,this file is recompiled..HP 5.B forname.B =expression expression statement.br.br.ns.HP 5.B forname.B =expression expression.br.li....br.ns.HP 5.B next.brThe.I forstatementrepetitively executes astatement (first form)or a group of statements (second form)under control of a named variable.The variable takes on the value ofthe first expression,then is incremented by one on each loop,not to exceed the value ofthe second expression..HP 5.B gotoexpression.brThe expression is evaluated, truncated to an integerand execution goes to the corresponding integer numbered statment.If executed from immediate mode,the internal statements are compiled first..HP 5.B ifexpression statement.br.br.ns.HP 5.B ifexpression.br.li....br.ns.HP 5[.B else.br.li... ].br.ns.HP 5.B fi.brThe statement (first form)or group of statements (second form)is executed if the expression evaluatesto non-zero.In the second form,an optional.B elseallows for a group of statements to beexecuted when the first group is not..HP 5.B list[expression [expression]].br.br listis used to print out the stored internal statements.If no arguments are given, all internal statements are printed.If one argument is given, only thatinternal statement is listed.If two arguments are given, all internal statementsinclusively between the arguments are printed..HP 5.B printlist.brThe list of expressions and strings are concatenated andprinted.(A string is delimited by " characters.).HP 5.B promptlist.br.I Prompt is the same as.I printexcept that no newline character isprinted..HP 5.B return[expression].brThe expression is evaluated and the result is passedback as the value of a function call.If no expression is given, zero is returned..HP 5.B run.brThe internal statements are compiled.The symbol table is re-initialized.The random number generator is reset.Control is passed to the lowest numbered internalstatement..HP 5.B save[expression [expression]].br.I Saveis like.I listexcept that the outputis written on the.I fileargument.If no argument is given on the command,.B b.outis used..PPExpressions have the following syntax:.HP 5name.brA name is used to specify a variable.Names are composed of a letterfollowed by letters and digits.The first four characters of a name are significant..HP 5number.brA number is used to represent a constant value.A number is written in Fortran style,and contains digits, an optional decimal point,and possibly a scale factor consistingof an.B efollowed by a possibly signed exponent..HP 5.B (expression.B ).brParentheses are used to alter normal order of evaluation..HP 5_ expression.brThe result is the negation of the expression..HP 5expression operator expression.brCommon functions of two arguments are abbreviatedby the two arguments separated by an operator denoting the function.A complete list of operators is given below..HP 5expression.B ([expression [.B ,expression] ... ].B ).brFunctions of an arbitrary number of argumentscan be called by an expression followed by the argumentsin parentheses separated by commas.The expression evaluates to theline number of the entry of the function in theinternally stored statements.This causes the internal statements to be compiled.If the expression evaluates negative,a builtin function is called.The list of builtin functions appears below..HP 5name.B [expression[.B ,expression] ....B ].brEach expression is truncated to an integerand used as a specifier for the name.The result is syntactically identical to a name..B a[1,2]is the same as.B a[1][2].The truncated expressions are restricted to values between 0 and 32767..PPThe following is the list of operators:.TP==is the assignment operator.The left operand must be a name or an array element.The result is the right operand.Assignment binds right to left,.TP&  |&(logical and)has result zero if either of its arguments are zero.It has result one if both its arguments are non-zero.|(logical or)has result zero if both of its arguments are zero.It has result one if either of its arguments are non-zero..TP<  <=  >  >=  ==  <>The relational operators(< less than, <= less than or equal,> greater than,>= greater than or equal,== equal to,<> not equal to)return one if their arguments are in the specifiedrelation.They return zero otherwise.Relational operators at the same level extend as follows:a>b>c is the same as a>b&b>c..TP+ \-Add and subtract..TP* /Multiply and divide..TP^Exponentiation..PPThe following is a list of builtin functions:.TP 7.B arg(i)is the value of the.IR i " -th"actual parameter on the current levelof function call..TP 7.B exp(x)is the exponential function of.IR x ..TP 7.B log(x)is the natural logarithm of.IR x ..TP 7.B sqr(x)is the square root of.IR x ..TP 7.B sin(x)is the sine of.IR x ""(radians)..TP 7.B cos(x)is the cosine of.IR x ""(radians)..TP 7.B atn(x)is the arctangent of.IR x .Its valueis between \-\(*p/2 and \(*p/2..TP 7.B "rnd( )"is a uniformly distributed randomnumber between zero and one..TP 7.B "expr( )"is the only form of program input.A line is read from the input andevaluated as an expression.The resultant value is returned..TP 7.B abs(x)is the absolute value of.IR x ..TP 7.B int(x)returns.I xtruncated (towards 0) to an integer..SH FILES/tmp/btm?	temporary.brb.out		save file.br/bin/ed	for.B edit.SH DIAGNOSTICSSyntaxerrors cause the incorrect line to be typedwith an underscore where the parse failed.All other diagnostics are self explanatory..SH BUGSHas been known to give core images..brCatches interrupts even when they are turned off.

⌨️ 快捷键说明

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