Vax 613 0S Instruction Manual Page 21

  • Download
  • Add to my manuals
  • Print
  • Page
    / 85
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 20
USER
GROUP
NEWS
Issue 3 - Vol 2
MDP
APPLICATIONS
INCLUDING
MATH
LIBRARIES
IN
NATIVE
C
PROGRAMS
Including
math
libraries
in
C programs with
the
optional
native
C package is
not
automatic
with
the
normal
cc
invocation.
To
gain access to
the
math
functions, use
the
-1m
option on
the
command
line.
The
following exam-
ple shows how
t.o
compile and
run
a
short
example using a square
root
function.
C program
'sqrt.c'
#include
<math.h>
mainO {
float
i=2.0;
printf(" sqrt(2.0) =
%I\n"
,sqrt(i));
}
Compilation:
cc
sqrt.c
-1m
Execution:
$ sqrt
sqrt(2.0) =
1.414214
$
The
-1m
option
is
not
documented
under"
cc"
because
it
is
a loader flag.
Use"
man
Id"
or
see"
Id" in section 6 of
the
TNIX
System Reference Manual.
When
used
with"
cc"
the
-1m
option
must
be
at
the
end
of
the
command
line.
Greg
Saville, Software Applications Manager
TNIX
COMMENT
LINES
ARE
NOT
IGNORED
In a
TNIX
command
file,
a line may become a
comment
by preceding
the
text
on
the
line
with
a
":
" (a colon
and
a space).
The
content
of a
commented
line however is still evaluated by the shell
and
then
ignored.
If
the
evalua-
tion uncovers
a problem,
the
execution
of
the
command
file
will be
terminated.
I
don't
want
this
line
executed.
The
above line
in
a
command
file
will fail due
to
the"
,,,
character in
the
line.
This feature
is
quite useful as
the
following example shows.
A
command
file
that
requires
three
parameters
be
passed
to
it
${1?}
${2?}
${3?}
MDL $1
$2
$3
If
the
command
is
invoked
without
all
parameters
being defined,
the
command
file
will fail and
exit
prior
to
exe-
cuting
the"
mdl"
command
and will
state
which
parameter
was missing.
The
TI\T]X
manual
section "Shell Programming" has a good description of
other
uses
of
the
"S{variable
- function
- variable} capability.
The
comment
line
"I
don't
want
this line executed" can be used as a
comment
if it
is
enclosed in quotes as shown
here.
Thus;
:
"I
don't
want
this line executed"
will
not
create a problem in a
command
file.
John Owens, Systems Applications
Manager
December 1983
TEKTRONIX
17
Page view 20
1 2 ... 16 17 18 19 20 21 22 23 24 25 26 ... 84 85

Comments to this Manuals

No comments