📄 calc.man
字号:
CALC FILE SEARCH PATH.PPIf the environment variable.B $CALCPATHis undefined, or if itis defined and.B calcis invoked with the.B \-eflag, when a file name not beginning with.BR / ,.B ~or.BR ./ ,is specified as in:.sp 1.in +5n.nfcalc read myfile.fi.in -5n.sp 1.B calcsearches in succession:.sp 1.in +5n.nf./myfile./myfile.cal${LIBDIR}/myfile${LIBDIR}/myfile.cal${CUSTOMCALDIR}/myfile${CUSTOMCALDIR}/myfile.cal.fi.in -5n.sp 1If the file is found, thesearch stops and the commands in the file are executed.It is an error if no readable file with the specified name is found.An alternative search path can be specified by defining.B $CALCPATHin the same way as PATH is defined, as a ':' separatedlist of directories, and then invoking.B calcwithout the.B \-eflag..PP.B Calctreats all open files, other than stdin, stdout andstderr as files available for reading and writing.One maypresent.B calcwith an already open file using.BR sh (1),.BR ksh (1),.BR bash (1)-likeshells is to:.sp 1.in +5ncalc 3<open_file 4<open_file2.in -5n.sp 1For more information use the following.B calccommands:.sp 1.in +5n.nfhelp helphelp overviewhelp usagehelp environmenthelp config.fi.in -5n.sp 1.PP\&.brSHELL SCRIPT MODE.PPIf the first line of an executable file begins.B #!followed by the absolute pathname of the.B calcprogram and the flag.B \-fas in:.sp 1.in +5n.nf\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP.fi.in -5n.sp 1the rest of the file will be processed in.BR "shell script mode" .Note that.B \-fmust at the end of the intiial ``#!'' line.Any other optional.B "other_flags"must come beforethe.BR \-f ..sp 1In.B "shell script mode"the contents of the file are read andexecuted as if they were in a file being processed by a readcommand, except that a "command" beginning with '#' followed bywhitespace and ending at the next newline is treated as a comment.Any optional.B "other_flags"will be parsed first followed bythe later lines within the script itself..sp 1In.BR "shell script mode" ,.B \-sis always assumed.In addition,.B \-dand.B \-pare automatically set if.B \-iis not given..sp 1For example, ifthe file.BR /tmp/mersenne :.sp 1.in +5n.nf\fI#!${BINDIR}/calc\fP\ \&\fB\-q\fP \fB\-f\fP## mersenne - an example of a calc \fBshell script file\fP/* parse args */if (argv() != 1) { fprintf(files(2), "usage: %s exp\\n", config("program")); abort "must give one exponent arg";}/* print the mersenne number */print "2^": argv(0) : "-1 =", 2^eval(argv(0))-1;.fi.in -5n.sp 1is made an executable file by:.sp 1.in +5n.nfchmod +x /tmp/mersenne.fi.in -5n.sp 1then the command line:.sp 1.in +5n.nf/tmp/mersenne 127.fi.in -5n.sp 1will print:.sp 1.in +5n.nf2^127-1 = 170141183460469231731687303715884105727.fi.in -5n.sp 1Note that because.B \-sis assumed in.B "shell script mode"and non-dashed args are made available asstrings via the.BR argv ()builtin function.Therefore:.sp 1.in +5n.nf2^eval(argv(0))-1.fi.in -5n.sp 1will print the decimal value of 2^n-1but.sp 1.in +5n.nf2^argv(0)-1.fi.in -5n.sp 1will not..PP\&.brDATA TYPES.PPFundamental builtin data types include integers, real numbers,rational numbers, complex numbers and strings..PPBy use of an object, one may define an arbitrarily complexdata types.One may define how such objects behave a wide range ofoperations such as addition, subtraction,multiplication, division, negation, squaring, modulus,rounding, exponentiation, equality, comparison, printingand so on..PPFor more information use the following.B calccommands:.PP.in 1.0ihelp types.brhelp obj.brshow objfuncs.in -1.0i.PP\&.brVARIABLES.PPVariables in \fIcalc\fP are typeless.In other words, the fundamental type of a variable is determined by its content.Before a variable is assigned a value it has the value of zero..PPThe scope of a variable may be global, local to a file, or local to aprocedure.Values may be grouped together in a matrix, or into aa list that permits stack and queue style operations..PPFor more information use the following.B calccommands:.PP.in 1.0ihelp variable.brhelp mat.brhelp list.brshow globals.in -1.0i.PP\&.brINPUT/OUTPUT.PPA leading ``0x'' implies a hexadecimal value,a leading ``0b'' implies a binary value,and a ``0'' followed by a digit implies an octal value.Complex numbers are indicated by a trailing ``i'' such as in ``3+4i''.Strings may be delimited by either a pair of single or double quotes.By default, \fIcalc\fP prints values as if they were floating point numbers.One may change the default to print values in a number of modesincluding fractions, integers and exponentials..PPA number of stdio-like file I/O operations are provided.One may open, read, write, seek and close files.Filenames are subject to ``\~'' expansion to home directoriesin a way similar to that of the Korn or C-Shell..PPFor example:.PP.in 1.0i~/.calcrc.br~chongo/lib/fft_multiply.cal.in -1.0i.PPFor more information use the following.B calccommand:.PP.in 1.0ihelp file.in -1.0i.PP\&.brCALC LANGUAGE.PPThe \fIcalc\fP language is a C-like language.The language includes commands such as variable declarations,expressions, tests, labels, loops, file operations, function calls.These commands are very similar to their counterparts in C..PPThe language also include a number of commands particularto \fIcalc\fP itself.These include commands such as function definition, help,reading in resource files, dump files to a file, error notification,configuration control and status..PPFor more information use the following.B calccommand:.PP.in 1.0ihelp command.brhelp statement.brhelp expression.brhelp operator.brhelp config.in -1.0i.PP.SH FILES\&.br.PD 0.TP 5${BINDIR}/calccalc binary.sp 1.TP 5${SCRIPTDIR}/*calc shell scripts.sp 1.TP 5${LIBDIR}/*.calcalc standard resource files.sp 1.TP 5${LIBDIR}/help/*help files.sp 1.TP 5${LIBDIR}/bindingsnon-GNU-readline command line editor bindings.sp 1.TP 5${CALC_INCDIR}/*.hinclude files for C interface use.sp 1.TP 5${LIBDIR}/libcalc.acalc binary link library.sp 1.TP 5${LIBDIR}/libcustcalc.acustom binary link library.sp 1.TP 5${CUSTOMCALDIR}/*.calcustom resource files.sp 1.TP 5${CUSTOMHELPDIR}/*custom help files.sp 1.SH ENVIRONMENT\&.br.PD 0.TP 5CALCPATHA :-separated list of directories used to search for calcresource filenames that do not begin with /, ./ or ~..br.spDefault value: ${CALCPATH}.br.sp.TP 5CALCRCOn startup (unless \-h or \-q was given on the commandline),.B calcsearches for files along this :-separatedenvironment variable..br.spDefault value: ${CALCRC}.br.sp.TP 5CALCBINDINGSOn startup (unless \fI\-h\fP or \fI\-q\fP was given on the commandline, or \fI\-m\fP disallows opening files for reading),.B calcreadskey bindings from the filename specifiedby this environment variable.The key binding file is searched for along the $CALCPATH listof directories..spDefault value: binding.spThis variable is not used if calc was compiled with GNU-readline support.In that case, the standard readline mechanisms (see readline(3)) are used..sp.SH CREDIT\&.brThe main chunk of.B calcwas written by David I. Bell..spThe.B calcprimary mirror, calc mailing list and calc bug reportprocessing is performed by Landon Curt Noll..spLandon Curt Noll maintains the master reference source, performsrelease control functions as well as other calc maintenance functions..spThanks for suggestions and encouragement from Peter Miller,Neil Justusson, and Landon Noll..spThanks to Stephen Rothwell for writing the original version ofhist.c which is used to do the command line editing..spThanks to Ernest W. Bowen for supplying many improvements inaccuracy and generality for some numeric functions. Much ofthis was in terms of actual code which I gratefully accepted.Ernest also supplied the original text for many of the help files..spPortions of this program are derived from an earlier set ofpublic domain arbitrarily precision routines which was postedto the net around 1984.By now, there is almost no recognizablecode left from that original source..sp.SH "COPYING / CALC GNU LESSER GENERAL PUBLIC LICENSE"\&.spCalc is open software, and iscovered under version 2.1 of the GNU Lesser General Public License.You arewelcome to change it and/or distribute copies of it under certainconditions.The calc commands:.sp.in +0.5i.nfhelp copyrighthelp copyinghelp copying-lgpl.fi.in -0.5i.spshould display the contents of the COPYING and COPYING-LGPL files.Those files contain information about the calc's GNU Lesser GeneralPublic License, and in particular the conditions under which youare allowed to change it and/or distribute copies of it..spYou should have received a copy of the version 2.1 of the GNU Lesser GeneralPublic License.If you do not have these files, write to:.sp.in +0.5i.nfFree Software Foundation, Inc.59 Temple PlaceSuite 330Boston, MA 02111-1307USA.fi.in -0.5i.spCalc is copyrighted in several different ways.These ways include:.sp.in +0.5i.nfCopyright (C) year David I. BellCopyright (C) year David I. Bell and Landon Curt NollCopyright (C) year David I. Bell and Ernest BowenCopyright (C) year David I. Bell, Landon Curt Noll and Ernest BowenCopyright (C) year Landon Curt NollCopyright (C) year Ernest Bowen and Landon Curt NollCopyright (C) year Ernest Bowen.fi.in -0.5i.spThis man page is:.sp.in +0.5i.nfCopyright (C) 1999 Landon Curt Noll.fi.in -0.5i.spand is covered under version 2.1 GNU Lesser GeneralPublic License..sp.SH "CALC MAILING LIST / CALC UPDATES / ENHANCEMENTS"\&.br.spTo contribute comments, suggestions, enhancementsand interesting.B calcresource files, andshell scripts please join the low volume calc mailing list..spTo join the low volume calc mailing list, send EMail to:.sp.in +0.5i.nfcalc-tester-request at asthe dot com.fi.in -0.5i.spYour subject must contain the words:.sp.in +0.5i.nfcalc mailing list subscription.fi.in -0.5i.spYou may have additional words in your subject line..spYour message body must contain:.sp.in +0.5i.nfsubscribe calc-tester addressendname your_full_name.fi.in -0.5i.spwhere.B addresss your EMail address and.B your_full_nameis your full name.Feel free to follow the.B nameline with additional EMail text as desired..sp.SH "BUG REPORTS / BUG FIXES"\&.br.spSend bug reports and bug fixes to:.sp.in +0.5i.nfcalc-bugs at asthe dot com[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]][[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]].fi.in -0.5i.spYour subject must contain the words:.sp.in +0.5i.nfcalc bug report.fi.in -0.5i.spYou may have additional words in your subject line..spSee the.I BUGSsource file or use the.I calccommand:.sp.in +0.5i.nfhelp bugs.fi.in -0.5i.spfor more information about bug reporting..sp.SH "CALC WEB SITE"\&.brLandon Noll maintains the the.B calcweb site is located at:.sp.in +0.5iwww.isthe.com/chongo/tech/comp/calc/.in -0.5i.spShare and Enjoy! :\-)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -