HP 3000 Manuals

HP C/XL Enhancements [ COMMUNICATOR 3000/XL XL RELEASE 2.1 ] MPE/iX Communicators


COMMUNICATOR 3000/XL XL RELEASE 2.1

HP C/XL Enhancements 

Erryl Johnson 
Systems Technology Division 

The C/XL compiler, preprocessor, header files and libraries are enhanced
to provide complete conformance to the ANSI standard for the C language,
X3.159-1989.  Two new libraries have been added for ANSI conformance.  In
addition, a change was made to the "time" function that assures the
correct time will always be returned by "ctime".

ANSI MODE 

The -Aa option enables ANSI mode when compiling a C program.  The -Aa
option may be used with the CCXL, CCXLLK and CCXLGO commands, or when
running the C/XL compiler program CCOMXL.PUB.SYS directly.  For
example, to compile and link a program using ANSI mode, use CCXLLK
MYTEXT,MYPROG;INFO="-Aa".  If ANSI mode is not desired, use the -Ac
option.  If neither option is present ANSI mode will be disabled.

ANSI LIBRARIES 

Two new libraries have been added for ANSI conformance.  They are
LIBCANSI.LIB.SYS and LIBMANSI.LIB.SYS.

LIBCANSI contains a relocatable library that should be linked along with
LIBCINIT or LIBC if conformance to ANSI is desired.  It contains a flag
that specifies that certain functions, primarily those that perform
input/ output operations on text files, interrogate this flag and behave
accordingly.  If you use the CCXLLK or CCXLGO commands, then
LIBCANSI.LIB.SYS will automatically be added to the RL list in the link
step if you compiled in ANSI mode.

LIBMANSI contains an ANSI-conforming version of the existing mathematical
library, LIBM. The primary difference between the two libraries is in the
way they handle an error, such as attempting to compute the square root
of a negative value.  The ANSI version of the library will call a
user-written function named _matherr if one is provided, and no error
message will be displayed.  The older version of the library will call a
user written function named matherr if one is provided.  Otherwise, an
error message will be displayed.

CHANGE TO TIME FUNCTION 

Prior to XL Release 2.1, an incorrect result could be returned from the
ctime function if either the TZ variable or the hardware clock or both
were set incorrectly.  The time function, which is used in combination
with ctime, has been modified to eliminate the possibility of an
incorrect result.

How the TZ Variable is Applied 

In this release ctime works the same, but the time function no longer
accesses the hardware clock.  Instead, the time function uses the
CALENDAR and CLOCK intrinsics to access the system timer, then adjusts
that time according to the user's TZ variable to derive Greenwich Mean
Time (GMT). When the value returned by the time function is passed to
ctime, the TZ variable is applied again, in the opposite direction.  This
assures that the string returned by ctime will agree with the MPE XL
system time, which is the time used by practically all other subsystems
on MPE XL.

Now, none of the C time functions access the hardware clock, so errors in
setting that clock will not affect the C programmer.  Likewise, if the TZ
variable is not set, or is set incorrectly, the return from ctime will
always be correct and agree with the MPE XL system time.

Using the Time Function 

If you use the time function independently of the ctime function, to only
obtain GMT, the TZ variable must now be set.  Otherwise, the result from
the time function may be incorrect.  If the TZ variable is not set, or is
invalid, the default is Eastern Time.



MPE/iX Communicators