HPlogo Accessing Files Programmer's Guide > Chapter 11 Accessing a File Using Mapped Access

New Intrinsics

MPE documents

Complete PDF
Table of Contents
Index

E0300 Edition 6 ♥
E0692 Edition 5

The following intrinsics have been added to make dealing with user mapped files simpler. The intrinsics provide for basic pointer manipulation, data movement and memory initialization. These intrinsics safely hadle all cross-SID buffer problems, removing the user from having to deal with these situations. These intrinsics can be safely used on long-mapped or large-mapped files.

HPFADDTOPOINTER


NM callable only.

This routine can be used to perform arithmetic on a 64-bit pointer value. Byte offsets can be added to or subtracted from a pointer by specifying eithger a positive or negative offset value.

Syntax


                   @64       I64     @64         I32
  HPFADDTOPOINTER (base_ptr, offset, return_ptr, status);

Parameters

base_ptr

64-bit pointer by reference (required)

The base_ptr can be a 64-bit pointer to an object of any type.

offset

64-bit signed integer by reference (required)

The offset can be any positive or negative value. Specifying a positive value will move the return_ptr forward from the previous base_ptr, while a negative value will move the return_ptr backward from the base_ptr.

return_ptr

64-bit pointer by reference (required)

The return_ptr is an output parameter that will have the new pointer value returned to it. It can be a 64-bit pointer to an object of any type

status

32-bit signed integer by reference (optional)

Returns the status of the HPFADDTOPOINTER call. If no errors or warnings are encountered, status returns 32 bits of zero. If errors or warnings are encountered, status is interpretted as two 16-bit fields.Bits (0:16) comprise status.info. A negative value indicates an error condition, and a positive value indicates a warning condition.Bits (16:16) comprise status.subsys. The value represents the subsystem that set the status information.

Operation Notes

No attemt is made to verify that the pointer value returned is a legitimate pointer to a valid object. Any invalid pointers will be detected and generate errors when the pointers are dereferenced.

Related Information

Manual

Accessing Files Programmer's Guide

HPFFILLDATA


NM callable only.

This routine can be used to efficiently initialize a buffer with a specified character value.

Syntax


               I64    @64         CV         I32
  HPFFILLDATA (count, buffer_ptr, fill_char, status);

Parameters

count

64-bit signed integer by reference (required)

A positive count of the number of bytes in the buffer indicated by the buffer_ptr parameter that should be initialized.

buffer_ptr

64-bit pointer by value (required)

A pointer to the buffer that should be initialized. The buffer_ptr may point to any valid object in your stack, heap, or a file that has been opened with user mapped access.

fill_char

Character value by value (required)

The character value that should be used to initialize the specified buffer. Any value in the range of 0 through 255 can be specified, including all printable and non-printable ASCII characters.

status

32-bit signed integer by reference (optional)

Returns the status of the HPFFILLDATA call. If no errors or warnings are encountered, status returns 32 bits of zero. If errors or warnings are encountered, status is interpretted as two 16-bit fields. Bits (0:16) comprise status.info. A negative value indicates an error condition, and a positive value indicates a warning condition. Bits (16:16) comprise status.subsys. The value represents the subsystem that set the status information.

Operation Notes

None.

Related Information

Manual

Accessing Files Programmer's Guide

HPFMOVEDATA


NM callable only.

This routine can be used to efficiently move data from a source buffer to a target buffer.

Syntax


               I64    @64         @64         I32
  HPFMOVEDATA (count, source_ptr, target_ptr, status);

Parameters

count

64-bit signed integer by reference (required)

The count parameter allows the caller to specify the number of bytes to move from the source buffer to the target buffer.

source_ptr

64-bit pointer by value (required)

The source_ptr can be a 64-bit pointer to any valid object that the calling process has access to. The buffer may be in the caller's stack, heap, or obtained by opening a file with user mapped access

target_ptr

64-bit pointer by value (required)

The target_ptr can be a 64-bi pointer to any valid object that the calling proceThis intrinsic is especially useful when the source and target buffers are overlapping. The HPFMOVEDATARTOL intrinsic is typically used when the target buffer's address is to the right (larger) of the source buffer's address. Moving the data from the right to the left ensures that the data in the source buffer is copied to the target buffer before it is overwritten itselfss has access to. The buffer may be in the caller's stack, heap, or obtained by opening a file with user mapped access.

status

32-bit signed integer by reference (optional)

Returns the status of the HPFMOVEDATA call. If no errors or warnings are encountered, status returns 32 bits of zero. If errors or warnings are encountered, status is interpretted as two 16-bit fields.Bits (0:16) comprise status.info. A negative value indicates an error condition, and a positive value indicates a warning condition.Bits (16:16) comprise status.subsys. The value represents the subsystem that set the status information.

Operation Notes

When calling the HPFMOVEDATA intrinsic it is important to ensure that the source and target buffers are not overlapping. The results of a HPFMOVEDATA call when source and target buffers are overlapping are undefined. If source and target buffers are overlapping, the HPFMOVEDATALTOR or HPFMOVEDATARTOL intrinsics should be used.

Related Information

Manual

Accessing Files Programmer's Guide

HPFMOVEDATALTOR


NM callable only.

This routine can be used to efficiently move data from a source buffer to a target buffer. If the source and target buffers were viewed horizontally, like a line of text, the data movement is performed by starting at leftmost position of the source buffer (to the leftmost position of the target buffer) and proceeding to the rightmost.

Syntax


                   I64    @64         @64         I32
  HPFMOVEDATALTOR (count, source_ptr, target_ptr, status);

Parameters

count

64-bit signed integer by reference (required)

The count parameter allows the caller to specify the number of bytes to move from the source buffer to the target buffer.

source_ptr

64-bit pointer by value (required)

The source_ptr can be a 64-bit pointer to any valid object that the calling process has access to. The buffer may be in the caller's stack, heap, or obtained by opening a file with user mapped access

target_ptr

64-bit pointer by value (required)

The target_ptr can be a 64-bi pointer to any valid object that the calling process has access to. The buffer may be in the caller's stack, heap, or obtained by opening a file with user mapped access.

status

32-bit signed integer by reference (optional)

Returns the status of the HPFMOVEDATALTOR call. If no errors or warnings are encountered, status returns 32 bits of zero. If errors or warnings are encountered, status is interpretted as two 16-bit fields.Bits (0:16) comprise status.info. A negative value indicates an error condition, and a positive value indicates a warning condition.Bits (16:16) comprise status.subsys. The value represents the subsystem that set the status information.

Operation Notes

This intrinsic is especially useful when the source and target buffers are overlapping. The HPFMOVEDATALTOR intrinsic is typically used when the target buffer's address is to the left (smaller) of the source buffer's address. Moving the data from the left to the right ensures that the data in the source buffer is copied to the target buffer before it is overwritten itself.

Related Information

Manual

Accessing Files Programmer's Guide

HPFMOVEDATARTOL


NM callable only.

This routine can be used to efficiently move data from a source buffer to a target buffer. If the source and target buffers were viewed horizontally, like a line of text, the data movement is performed by starting at rightmost position of the source buffer (to the rightmost position of the target buffer) and proceeding to the leftmost.

Syntax


                   I64    @64         @64         I32
  HPFMOVEDATARTOL (count, source_ptr, target_ptr, status);

Parameters

count

64-bit signed integer by reference (required)

The count parameter allows the caller to specify the number of bytes to move from the source buffer to the target buffer.

source_ptr

64-bit pointer by value (required)

The source_ptr can be a 64-bit pointer to any valid object that the calling process has access to. The buffer may be in the caller's stack, heap, or obtained by opening a file with user mapped access

target_ptr

64-bit pointer by value (required)

The target_ptr can be a 64-bi pointer to any valid object that the calling process has access to. The buffer may be in the caller's stack, heap, or obtained by opening a file with user mapped access.

status

32-bit signed integer by reference (optional)

Returns the status of the HPFMOVEDATARTOL call. If no errors or warnings are encountered, status returns 32 bits of zero. If errors or warnings are encountered, status is interpretted as two 16-bit fields.Bits (0:16) comprise status.info. A negative value indicates an error condition, and a positive value indicates a warning condition.Bits (16:16) comprise status.subsys. The value represents the subsystem that set the status information.

Operation Notes

This intrinsic is especially useful when the source and target buffers are overlapping. The HPFMOVEDATARTOL intrinsic is typically used when the target buffer's address is to the right (larger) of the source buffer's address. Moving the data from the right to the left ensures that the data in the source buffer is copied to the target buffer before it is overwritten itself.

Related Information

Manual

Accessing Files Programmer's Guide




Opening a File Mapped


Chapter 12 Sharing a File