📄 fdosguid.gml
字号:
.chap Using &product
.*
.section Command Line Format
.*
.np
This chapter describes the command-line oriented interface to
&cmpname..
The following chapter describes the editor interface to &cmpname..
&cmpname is invoked as follows:
.ix 'invoking &cmpname'
.ix 'command line' 'syntax'
.mbigbox begin
&cmpcmdup.[[options] [d:][path]filename[.ext] [options] [prog_parms]]
or
&cmp2cmdup.[[options] [d:][path]filename[.ext] [options] [prog_parms]]
.mbigbox end
.synote
.note []
The square brackets denote items which are optional.
.ix &cmpcmdup.
.note &cmpcmdup.
is the version of &cmpname which does not require the 80x87 numeric
data processor.
.ix &cmp2cmdup.
.note &cmp2cmdup.
is the version of &cmpname which requires the 80x87 numeric
data processor.
.note options
.ix 'options' 'specifying'
is a list of valid &cmpname options, each preceded by a slash.
The list of options may not contain any blank characters.
Options may be specified in any order.
.note d:
is an optional drive specification such as
:FNAME.&dr1:eFNAME., :FNAME.&dr2:eFNAME., etc.
If not specified, the default drive is assumed.
.note path
is an optional path specification such as
:FNAME.&pc.programs&pc.src&pc.:eFNAME..
If not specified, the current directory is assumed.
.note filename
is the file name of the file to be compiled.
.note ext
is the file extension of the file to be compiled.
If omitted, a file extension of :FNAME.&cxt:eFNAME. is assumed.
If the period "." is specified but not the extension, the file is
assumed to have no file extension.
.ix 'command line' 'arguments'
.ix 'FGETCMD'
.note prog_parms
is an optional list of program parameters that may be accessed by
the executing program through use of the library function
.id FGETCMD
or the functions
.id IARGC
and
.id IGETARG.
See the chapter entitled "The &cmpname Subprogram Library" for
more information on these functions.
.endnote
.np
The FORTRAN source file may consist of variable length ASCII records
separated by a "LF" (line feed) character optionally preceded by a
"CR" (carriage return) character.
Normally, &cmpname processes only the first 72 characters of any record.
The remainder, if any, is ignored.
Records which are shorter than 72 characters in length are treated as
if they had trailing blank characters.
.ix 'XLINE option'
.ix 'options' 'XLINE'
The "XLINE" compiler option can be used to extend the last column of
the statement portion of a line to column 132.
.*
.section Invoking &cmpname
.*
.np
.ix &cmpcmdup
In the following sections, we will use &cmpcmdup to illustrate
how to use &cmpname..
.ix &cmp2cmdup.
The name &cmp2cmdup. may be used in an equivalent manner when
the math coprocessor is present.
.np
Consider the following program which attempts to compute the
square root of a number and display the result.
.exam begin
* Program to compute a square root
NUMBER = -144
SQROOT = SQRT( NUMBER )
PRINT *, SQROOT
END
.exam end
.pc
This program consists of a
.us comment line
.ix 'comment line'
and some FORTRAN
.us statements.
.ix 'statement'
Let us assume that a copy of the above program is contained in the file
:FNAME.root&cxt.:eFNAME.
in the current directory.
Type the following command and press the "Enter" key.
.millust &prompt.&cmpcmd root
.np
.ix message interpretation
There are deliberate errors in the program so the message
.code begin
root&cxt.(4): *ERR* LI-12 column 15, INTEGER argument type is invalid
for this generic function
.code end
.pc
is displayed on the screen.
How should this message be interpreted?
.np
The message
.mono *ERR*
means that some violation of the rules of FORTRAN has been committed.
.ix message error
.ix error
.ix line
Specifically, on the fourth line of the source file
:FNAME.root&cxt.:eFNAME.
near column 15 an error was detected.
The error says that the argument of the generic FORTRAN function that
was used (in this case
.id SQRT
.ct )
cannot be an
.kw INTEGER
argument.
The
.us error code
.ix 'error code'
.mono LI-12
is composed of an error category and number.
The error code may be used to look up the message in the
diagnostic summary in the appendix entitled "&cmpname Diagnostic
Messages" at the end of this guide.
This appendix provides an explanation of all diagnostic messages
issued by &cmpname..
.np
In addition to the message that is displayed on the screen, a
source program listing file,
:FNAME.root.lst:eFNAME., is created by the compiler.
.ix listing source
If you examine the listing file, you will find something similar
to the following.
.code begin
.in -3
&product &ver &cdate
.cpyrit 1984
.trdmrk
Options: list,disk,extensions,reference,warnings,terminal,run,xtype,check,
arraycheck,statements=0,pages=0,time=0,codesize=524288,pagesize=66,fover
* Program to compute a square root
1 NUMBER = -144
2 SQROOT = SQRT( NUMBER )
$
*ERR* LI-12 INTEGER argument type is invalid for this generic function
3 PRINT *, SQROOT
4 END
Compile time (in seconds): 0 Execution time (in seconds): 0
Size of object code: 0 Number of extensions: 0
Size of local data area(s): 0 Number of warnings: 0
Size of global data area: 0 Number of errors: 1
Object bytes free: 0 Statements Executed: 0
.in +3
.code end
.np
In the listing file, we find a copy of the original source program and
some additional lines which the compiler has added.
The line that was in error is followed by a line containing an error
indicator or marker (a dollar sign "$").
An error message, similar to the one that was displayed on the screen,
follows that line.
.np
Near the start of the program listing is a line indicating which
options were in effect at the time the compilation of the program
began.
These and other options are described in the chapter entitled
"Compiler Options".
.ix statistics compile-time
.ix statistics execution-time
.ix 'compiler statistics'
At the end of the program listing, we find some statistics such as how
long it took to compile the program and the number of error messages
that were issued.
The compile and execution times are reported as actual elapsed time in
seconds using the "time-of-day" clock.
.np
Some statistics on memory utilization also appear.
The object code size is the number of bytes of executable code
generated by &cmpname for the program.
The local data area size includes scalar variables (undimensioned
variables), numeric and logical constants, and temporaries used
in evaluating expressions.
The global data area size includes character variables, dimensioned
variables, and common blocks.
The amount of unused memory is reflected in the "Object bytes free"
statistic.
This number represents the amount of memory still available to the compiler
for object code.
.ix 'CODESIZE option'
.ix 'options' 'CODESIZE'
The amount of memory used for object code can be set by using the "codesize="
option.
The default is 512k.
.np
A number appears to the left of
.us some
of the FORTRAN source lines.
This number is generated by the compiler for each FORTRAN statement.
It is used primarily at execution time when the compiler detects an
error and issues a message.
.ix 'statement number'
.ix 'internal statement number'
.ix 'ISN'
The statement number is sometimes referred to as an "Internal
Statement Number" or ISN.
We will demonstrate the usefulness of the ISN in a subsequent example.
.np
Upon checking out the rules about the use of the
.id SQRT
function, we find that the argument must be a floating-point
quantity of type real, double precision, complex, or double
precision complex.
Because of the rules of FORTRAN,
.id NUMBER
is an integer variable by default.
The program must be corrected either by changing the name of the
variable or by explicitly declaring the type of the variable.
.np
This is just one example of how &cmpname handles compile-time
errors.
.ix compile-time
We use the term "compile-time" since the error was detected
before any execution of the program was attempted.
.np
Change the program by adding a variable declaration so that it
resembles the following:
.exam begin
* Program to compute a square root
REAL NUMBER
NUMBER = -144
SQROOT = SQRT( NUMBER )
PRINT *, SQROOT
END
.exam end
.np
When you try to compile and execute the revised program, a different
message is displayed on the screen:
.code begin
*ERR* LI-03 argument must not be negative
- Executing in MAIN PROGRAM, statement 3 in file root&cxt.
.code end
.pc
.ix execution-time
This message is issued at execution time.
.ix trace-back
Execution-time messages are accompanied by a program "trace-back".
The trace-back is a sequence of one or more messages which describes
the state of the executing program at the time the error was detected.
.np
If you examine the listing file, you will find something similar to
the following.
.code begin
.in -3
&product &ver &cdate
.cpyrit 1984
.trdmrk
Options: list,disk,extensions,reference,warnings,terminal,run,xtype,check,
arraycheck,statements=0,pages=0,time=0,codesize=524288,pagesize=66,fover
* Program to compute a square root
1 REAL NUMBER
2 NUMBER = -144
3 SQROOT = SQRT( NUMBER )
4 PRINT *, SQROOT
5 END
*ERR* LI-03 argument must not be negative
- Executing in MAIN PROGRAM, statement 3 in file root&cxt.
Compile time (in seconds): 0 Execution time (in seconds): 0
Size of object code: 114 Number of extensions: 0
Size of local data area(s): 80 Number of warnings: 0
Size of global data area: 0 Number of errors: 1
Object bytes free: 524244 Statements Executed: 2
.in +3
.code end
.np
.ix ISN
Here, we see the use of the ISN.
The error has occurred in the third
.us statement
of the FORTRAN program.
Note that this is
.us not
the third line in the file.
.np
The name of the file which contained the program is also
displayed in the trace-back messages (in this case
:FNAME.root&cxt.:eFNAME.).
This is done since FORTRAN source lines can come from several
different files.
.np
The above illustrates the execution-time error detection
(or diagnostic) capability of &cmpname..
.np
We would like to close this discussion by correcting the program
so that it produces the desired result.
.exam begin
* Program to compute a square root
REAL NUMBER
NUMBER = 144
SQROOT = SQRT( NUMBER )
PRINT *, SQROOT
END
.exam end
.np
When you compile and execute the program, the result
.millust begin
12.0000000
.millust end
.pc
is displayed on the screen.
This is indeed the square root of the number 144.
The decimal point and trailing zeroes indicate that the result is
a floating-point quantity.
.np
The contents of the listing file are:
.code begin
.in -3
&product &ver &cdate
.cpyrit 1984
.trdmrk
Options: list,disk,extensions,reference,warnings,terminal,run,xtype,check,
arraycheck,statements=0,pages=0,time=0,codesize=524288,pagesize=66,fover
* Program to compute a square root
1 REAL NUMBER
2 NUMBER = 144
3 SQROOT = SQRT( NUMBER )
4 PRINT *, SQROOT
5 END
Compile time (in seconds): 0 Execution time (in seconds): 0
Size of object code: 114 Number of extensions: 0
Size of local data area(s): 80 Number of warnings: 0
Size of global data area: 0 Number of errors: 0
Object bytes free: 524100 Statements Executed: 4
.in +3
.code end
.np
You may have noticed that the printed result of this program appeared
on the screen but not in the listing file.
.ix listing
.ix 'printed result'
.ix 'NOXTYPE option'
.ix 'options' 'NOXTYPE'
&cmpname provides an option ("NOXTYPE") which allows you to direct
such printed results to the listing file instead of the screen.
Recompile the program but this time also specify the "NOXTYPE" option.
.millust &prompt.&cmpcmd./noxtype root
See the chapter entitled "Compiler Options" for more information on
the "NOXTYPE" option.
.*
.section More Examples Using Compiler Options
.*
.np
Assume that the file
:FNAME.test&cxt.:eFNAME.
contains the following statements.
.exam begin
X=12.
Y=X*-X
PRINT *,X,Y
END
.exam end
.pc
To compile and execute this program using &cmpname,
type
.millust &prompt.&cmpcmd./type test
On the screen will appear
something similar to the following:
.code begin
.in -3
&product &ver &cdate
.cpyrit 1984
.trdmrk
Options: list,extensions,reference,warnings,terminal,run,xtype,check,
arraycheck,statements=0,pages=0,time=0,codesize=524288,pagesize=66,fover
1 X=12.
2 Y=X*-X
$
*ERR* SX-02 bad sequence of operators
3 PRINT *,X,Y
4 END
Compile time (in seconds): 0 Execution time (in seconds): 0
Size of object code: 0 Number of extensions: 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -