Jump to 
content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
»  Contact HP

 

HP C

HP C
User's Guide for OpenVMS Systems


Previous Contents Index

6.2.3.16 Move to Processor Register ( _MTPR)

The _MTPR function loads a value into one of the special processor registers. It is a privileged function.

The _MTPR function has the following format:

int _MTPR (int src, int register_num); 

src

The value to store into the processor register.

register_num

The number of a privileged register to be updated.

The return value is the V condition flag from the Processor Status Longword (PSL).

6.2.3.17 Probe Read Accessibility ( _PROBER)

The _PROBER function checks to see if you can read the first and last byte of the given address and length pair.

The _PROBER function has the following format:

typedef enum { _probe_not_accessible,  _probe_accessible}  _PROBE_STATUS; 

_PROBE_STATUS _PROBER (char __mode, unsigned short __length, const void *__address);

__mode

The processor mode used for checking the access.

__length

The length of the memory segment, in bytes. The length must be a value from 0 to 65,535.

On OpenVMS Alpha systems, this parameter is the offset to the last byte in the memory segment, and not the memory segment length.

__address

The pointer to the memory segment to be tested for read access.

There are two possible return values:

  • _probe_not_accessible (0) if one or both bytes are not accessible
  • _probe_accessible (1) if both bytes are accessible

6.2.3.18 Probe Write Accessibility ( _PROBEW)

The _PROBEW function checks the write accessibility of the first and last byte of the given address and length pair.

The _PROBEW function has the following format:

typedef enum { _probe_not_accessible,  _probe_accessible}  _PROBE_STATUS; 

_PROBE_STATUS _PROBEW (char __mode, unsigned short __length, const void *__address);

__mode

The processor mode used for checking the access.

__length

On OpenVMS VAX systems, the length of the memory segment, in bytes. The length must be a value from 0 to 65,535.

On OpenVMS Alpha systems, this parameter is the offset to the last byte in the memory segment, and not the memory segment length.

__address

The pointer to the memory segment to be tested for write access.

There are two possible return values:

  • _probe_not_accessible (0) if one or both bytes are not accessible
  • _probe_accessible (1) if both bytes are accessible

6.2.3.19 Read General-Purpose Register ( _READ_GPR)

The _READ_GPR function returns the value of a general-purpose register.

The _READ_GPR function has the following format:

int _READ_GPR (int register_num); 

register_num

An integer constant expression giving the number of the general-purpose register to be read.

The return value is the value of the general-purpose register.

6.2.3.20 Remove Entry from Queue at Head Interlocked ( _REMQHI)

The _REMQHI function removes the first entry from the queue in an indivisible manner. This operation is interlocked against similar operations by other processors or devices in the system.

The _REMQHI function has the following format:

typedef enum { _remqi_removed_more,  _remqi_not_removed,  _remqi_removed_empty, 

_remqi_empty} _REMQI_STATUS;
_REMQI_STATUS _REMQHI (void *__head, void *__removed_entry);

__head

A pointer to the queue header. The header must be aligned on a quadword boundary. (You can achieve alignment using the _align or __align storage-class modifier.)

__removed_entry

A pointer that _REMQHI sets to point to the removed entry.

There are four possible return values:

  • _remqi_removed_more (0) if the entry was removed and the queue has remaining entries
  • _remqi_not_removed (1) if the entry could not be removed because the secondary interlock failed
  • _remqi_removed_empty (2) if the entry was removed and the queue is now empty
  • _remqi_empty (3) if the queue was empty

6.2.3.21 Remove Entry from Queue at Tail Interlocked ( _REMQTI)

The _REMQTI function removes the last entry from the queue in an indivisible manner. This operation is interlocked against similar operations by other processors or devices in the system.

The _REMQTI function has the following format:

typedef enum { _remqi_removed_more,  _remqi_not_removed,  _remqi_removed_empty, 

_remqi_empty} _REMQI_STATUS;
_REMQI_STATUS _REMQTI (void *__head, void *__removed_entry);

__head

A pointer to the queue header. The header must be aligned on a quadword boundary. (You can achieve alignment using the _align or __align storage-class modifier.)

__removed_entry

A pointer to a pointer that _REMQTI sets to point to the removed entry.

There are four possible return values:

  • _remqi_removed_more (0) if the entry was removed and the queue has remaining entries
  • _remqi_not_removed (1) if the entry could not be removed because the secondary interlock failed
  • _remqi_removed_empty (2) if the entry was removed and the queue is now empty
  • _remqi_empty (3) if the queue was empty

6.2.3.22 Remove Entry from Queue ( _REMQUE)

The _REMQUE function removes an entry from a queue.

The _REMQUE function has the following format:

typedef enum { _remque_removed_more,  _remque_removed_empty, 

_remque_empty} _REMQUE_STATUS;
_REMQUE_STATUS _REMQUE (void *__entry, void *__removed_entry);

__entry

A pointer to the queue entry to be removed.

__removed_entry

A pointer to a pointer that _REMQUE sets to the address of the entry removed from the queue.

There are three possible return values:

  • _remque_removed_more (0) if the entry was removed and the queue has remaining entries
  • _remque_removed_empty (1) if the entry was removed and the queue is now empty
  • _remque_empty (2) if the queue was empty

6.2.3.23 Scan Characters ( _SCANC)

The _SCANC function locates the first character in a string with the desired attributes. The attributes are specified through a table and a mask.

The _SCANC function has the following format:

unsigned short  _SCANC (unsigned short  __length,  const char *__string, 

const char *__table, char __mask, ...);

__length

The length of the string to be scanned, in bytes. The length must be a value from 0 to 65,535.

__string

A pointer to the string to be scanned.

__table

A pointer to the table.

__mask

The mask.

...

An optional match argument, which is a pointer to a pointer to char. The _SCANC function sets this output argument to the address of the byte that matched. (If no match occurs, this argument is set to the address of the byte following the string.)

The return value is the number of bytes remaining in the string if a match was found; otherwise, the return value is 0.

6.2.3.24 Skip Character ( _SKPC)

The _SKPC function locates the first character in a string that does not match the target character.

The _SKPC function has the following format:

unsigned short  _SKPC (char  __target,  unsigned short  __length,  const char *__string, ... ); 

__target

The target character.

__length

The length of the string, in bytes. The length must be a value from 0 to 65,535.

__string

A pointer to the string to be scanned.

...

An optional position argument, which is a pointer to a pointer to char. The _SKPC function sets this output argument to the address of the nonmatching character. (If all the characters in the string match, this argument is set to the address of the first byte beyond the string.)

The return value is the number of bytes remaining in the string if an unequal byte was located; otherwise, the return value is 0.

6.2.3.25 Span Characters ( _SPANC)

The _SPANC function locates the first character in a string without certain attributes. The attributes are specified through a table and a mask.

The _SPANC function has the following format:

unsigned short  _SPANC (unsigned short  __length,  const char *__string, 

const char *__table, char __mask, ...);

__length

The length of the string, in bytes. The length must be a value from 0 to 65,535.

__string

A pointer. It points to the string to be scanned.

__table

A pointer to the table.

__mask

The mask.

...

An optional position argument, which is a pointer to a pointer to char. The _SPANC function sets this output argument to the address of the nonmatching character. (If all the characters in the string match, this argument is set to the address of the first byte beyond the string.)

The return value is the number of bytes remaining in the string if a match was found; otherwise, the return value is 0.


Appendix A
Migrating from VAX C

This appendix documents many features that distinguish HP C for OpenVMS Systems from VAX C Version 3.2.

This appendix was written for the first ANSI C Standard conforming release of the HP C (originally DEC C) compiler as a guide for installations migrating from VAX C to HP C. It is not intended as a compendium of new features for all HP C versions. For a summary of new features for the current version of the compiler, see the release notes and the New and Changed Features section in the Preface of this and the other HP C manuals. For additional help migrating from VAX C to HP C, see the DEC C Migration Guide for OpenVMS VAX Systems (VAX ONLY).

The major focus of HP C for OpenVMS Systems is to bring it into full conformance with the C Standard. The language described by the C Standard differs in many ways from the language originally implemented by VAX C. These differences include additional language features and constructs, the removal of obsolete features and usages, and a number of other changes that generally involve a tightening up of semantic rules.

Some of the new C standard features have already been implemented in previous versions of VAX C. Some of these are: support for function prototypes, the const and volatile type qualifiers, and the void type specifier.

Although every attempt has been made to maintain compatibility with earlier versions of the VAX C compiler, many of the changes required to bring the compiler into conformance with the C Standard would introduce unavoidable incompatibilities with these earlier versions. For example, VAX C supports a number of language and semantic extensions that are not standard-conformant.

Therefore, to provide compatibility with previous versions of the compiler, HP C for OpenVMS Systems supports several modes of operation:

  • Strict ANSI C Standard mode, in which all nonstandard constructs and usages (including VAX C extensions) are diagnosed
  • Relaxed mode (the default on OpenVMS systems), in which the compiler follows the ANSI C standard but also accepts additional HP keywords and predefined macros that do not begin with an underscore
  • VAX C mode, in which as many previously supported features as possible continue to be supported
  • Common mode, in which extensions to the ULTRIX portable C compiler (pcc) are supported

Note that some of the language changes dictated by the C Standard are present in VAX C mode. Some of these changes are quiet changes; that is, they cannot be detected as such by the compiler, so no diagnostic messages are issued. Also note that some extensions are permitted in the strict ANSI C mode. These extensions are diagnosed, but with no greater severity than Warning. Both types of changes are included in the following sections that describe all new and changed features.

A.1 Features Affecting the Compiler

This section describes HP C compiler features. ( Section A.2 describes features that affect the HP C run-time library and include files.)

A.1.1 HP C Qualifiers

Qualifiers new to HP C:

  • /[NO]ANSI_ALIAS (ALPHA ONLY)---Directs the compiler to assume the ANSI C aliasing rules. By so doing, the compiler has the freedom to generate better optimized code.
  • /ASSUME=(option,...)---Controls compiler assumptions.
  • /DECC---Invokes the HP C compiler. For OpenVMS VAX systems, the default is set to either /DECC or /VAXC during installation.
    For OpenVMS Alpha systems, specifying /DECC is equivalent to not specifying it; it is supported to provide compatibility with HP C on OpenVMS VAX systems.
  • /ENDIAN=option (ALPHA ONLY)---Controls whether big or little endian ordering of bytes is carried out in character constants.
  • /EXTERN_MODEL---In conjunction with the /[NO]SHARE_GLOBALS qualifier, controls the initial extern model of the compiler. Also see #pragma extern_model.
  • /FLOAT---Controls the format of floating-point variables. It replaces the /[NO]G_FLOAT qualifier, which is retained for compatibility.
  • /GRANULARITY (ALPHA ONLY)---Determines how much memory to effectively cache for memory reference, by the combination of the compiler and the underlying system.
  • /IEEE_MODE=option (ALPHA ONLY)---Selects the IEEE floating-point mode to be used if /FLOAT=IEEE_FLOAT is specified.
  • /L_DOUBLE_SIZE=option (ALPHA ONLY)---Determines how the compiler interprets the long double type.
  • /[NO]MEMBER_ALIGNMENT---Controls alignment of data structure members. For OpenVMS Alpha systems, the default is /MEMBER_ALIGNMENT, which aligns structure members on the next boundary appropriate to the type of the member. For OpenVMS VAX systems, the default is /NOMEMBER_ALIGNMENT, which aligns structure members on byte boundaries.
  • /NAMES---Converts all definitions and references of external symbols and psects to the specified case (UPPERCASE or AS_IS).
  • /NESTED_INCLUDE_DIRECTORY[=option]---Controls the directories that the compiler searches when looking for nested include files that are included using the quoted form of the #include preprocessor directive.
  • /OPTIMIZE---Determines whether HP C performs various code optimizations.
  • /[NO]PLUS_LIST_OPTIMIZE (ALPHA ONLY)---Provides improved optimization and code generation across file boundaries that would not be available if the files were compiled separately.
  • /[NO]PREFIX_LIBRARY_ENTRIES=(option,...)---Controls the HP C Run-Time LIbrary (RTL) name prefixing.
  • /REENTRANCY[=option] (ALPHA ONLY)---Controls the type of reentrancy that reentrant HP C RTL routines will exhibit. (See also the decc$set_reentrancy RTL routine.)
  • /ROUNDING_MODE=option (ALPHA ONLY)---Lets you select an IEEE rounding mode, if /FLOAT=IEEE_MODE is specified.
  • /[NO]SHARE_GLOBALS---Specifies whether external objects are to be marked share or noshare. Used in conjunction with /EXTERN_MODEL to control the initial extern model of the compiler. Also see the #pragma extern_model preprocessor directive.
  • /[NO]STANDARD---Enhanced to include the following options (in addition to /STANDARD=PORTABLE):
    • ANSI89
    • RELAXED
    • COMMON
    • VAXC
    • MIA
  • /[NO]TIE (ALPHA ONLY)---Enables the compiled code to be used in combination with translated images, either because the code might call into a translated image or might be called from a translated image.
  • /[NO]UNSIGNED_CHAR---By default, char is a signed character type. The /UNSIGNED_CHAR qualifier lets you change this default to an unsigned character type, which causes all plain char declarations to have the same representation and set of values as unsigned char declarations. The default is /NOUNSIGNED_CHAR.
  • /VAXC (VAX ONLY)---Invokes the VAX C compiler. The default is set to either /DECC or /VAXC during installation.

A.1.2 Comment Processing

VAX C treats a comment in a macro definition as if the comment were replaced with no characters. This allows comments to paste tokens together, as in the following example:


#define PASTE(X) X/*  */1 
int PASTE(VAR); 

This example declares the variable VAR1. Standard C requires that comments be treated as if they were replaced by a single space. In HP C, therefore, comments cannot be used to concatenate tokens when /STANDARD=ANSI89 or /STANDARD=RELAXED is specified. (The new operator ## is provided to allow token concatenation in macros.)

HP C for OpenVMS Systems continues to replace comments with no characters when /STANDARD=VAXC or /STANDARD=COMMON is specified; and /WARN=ENABLE=CHECK provides a diagnostic to flag comments that are used to concatenate tokens.

For /STANDARD=COMMON and /STANDARD=RELAXED, C++ style comments (//) are supported.

A.1.3 String Literal Concatenation

HP C introduces a new ANSI-conforming feature that allows convenient continuation of string literals. If string literals are separated only by white space, the string literals are concatenated to form one string literal. For example:


fputs("This is really " 
   "one string literal", stderr); 

String literal concatenation works for both normal string literals and wide string literals.

A.1.4 Recursive main() Function

In VAX C, main, or any function using the VAX C main_program option, is not recursively reentrant.

As required by standard C, the main function in HP C can now be called recursively.

A.1.5 Trigraph Sequences

Standard C defines an additional representation of some of the special characters in the C language source abstract character set. These additional representations are sequences of three characters called trigraphs. Table A-1 lists the trigraphs and the character each is mapped to.

Table A-1 Trigraphs
Trigraph Replacement
??= #
??( [
??/ \
??) ]
??' ^
??< {
??! |
??> }
??- ~

Conceptually, every trigraph is removed from the file and its replacement is substituted. Each ? that does not begin one of the trigraphs is not changed. Trigraph processing occurs before tokenization takes place. Thus, even trigraphs in string constants have their replacements substituted.

Trigraph support has the potential to change the meaning of existing C code that unintentionally contains a trigraph in a string literal. However, since such conflicts will be quite rare, there is no facility for disabling trigraph support.

Trigraph support is available in strict and relaxed mode.

A.1.6 Alert Escape Sequence

As specified by standard C, HP C defines a new escape sequence for the alert character. The escape sequence \a represents the ASCII BEL (Ctrl/G) character.

A.1.7 Hexadecimal Escape Sequence

VAX C limits hexadecimal escape sequences to at most 3 hex digits, but standard C allows an unlimited number of digits. HP C removes the limit imposed by VAX C.

This can cause some programs to behave differently. The string "\x0012" is currently interpreted by VAX C as a string with two characters in it: a Ctrl/A followed by the character "2". Under standard C rules, the string consists of a single character whose character code is hexadecimal 12 (Ctrl/R). However, this problem is unlikely to occur in practice.

A.1.8 Invalid Escape Sequences

HP C issues a warning message if it encounters an invalid escape sequence. VAX C did not diagnose such usage.


Previous Next Contents Index

Privacy statement Using this site means you accept its terms
© 2007 Hewlett-Packard Development Company, L.P.