# HDF Reference Manual

> ##

> [DFP Interface][Top]

> DFPaddpal/dpapal

> intn DFPaddpal(char *filename, VOIDP palette)

> | filename | IN: | Name of the HDF file
> | palette | IN: | Buffer containing the palette to be written

> | Purpose | Appends a palette to a file.
> | Return value | Returns `SUCCEED` (or 0) if successful and FAIL (or -1) otherwise.
> | Description | If the named file does not exist, it is created and the palette written to it. The palette buffer should beat least 768 bytes in length.

> | FORTRAN | integer function dpapal(filename, palette)
> |  | character*(*) filename, palette

> ##

> [DFP Interface][Top]

> DFPgetpal/dpgpal

> intn DFPgetpal(char *filename, VOIDP palette)

> | filename | IN: | Name of the HDF file
> | palette | OUT: | Buffer for the returned palette

> | Purpose | Retrieves the next palette from file and stores it in the buffer palette.
> | Return value | Returns `SUCCEED` (or 0) if successful and FAIL (or -1) otherwise.
> | Description | The palette buffer is assumed to be at least 768 bytes long. Successive calls to DFPgetpal retrieve the palettes in the sequence they are stored in the file.

> | FORTRAN | integer function dpgpal(filename, palette)
> |  | character*(*) filename. palette

> ##

> [DFP Interface][Top]

> DFPlastref/dplref

> uint16 DFPlastref(void)

> | Purpose | Returns the value of the reference number most recently read or written by a palette function call.
> | Return value | Returns the reference number if successful and FAIL (or -1) otherwise.

> | FORTRAN | integer function dplref( )

> ##

> [DFP Interface][Top]

> DFPnpals/dpnpals

> intn DFPnpals(char *filename)

> | filename | IN: | Name of the file

> | Purpose | Indicates the number of palettes in the specified file.
> | Return value | Returns the number of palettes if successful and FAIL (or -1) otherwise.

> | FORTRAN | integer function dpnpals(filename)
> |  | character*(*) filename

> ##

> [DFP Interface][Top]

> DFPputpal/dpppal

> intn DFPputpal (char *filename, VOIDP palette, intn overwrite, char *filemode)

> | filename | IN: | Name of the file
> | palette | IN: | Buffer containing the palette to be written
> | overwrite | IN: | Flag identifying the palette to be written
> | filemode | IN: | File access mode

> | Purpose | Writes a palette to the file.
> | Return value | Returns `SUCCEED` (or 0) if successful and FAIL (or -1) otherwise.
> | Description | This routine provides more control of palette write operations than DFPaddpal. Note that the combination filemode="w" and overwrite=1 has no meaning and will result in an error condition. To overwrite a palette, filename must be the same filename as the last file accessed through the DFP interface.
> |  | Valid values for overwrite are: 1 to overwrite last palette; 0 to write a new palette.
> |  | Valid values for filemode are: "a" to append the palette to the file and "w" to create a new file.
> |  | The palette buffer must be at least 768 bytes in length.

> | FORTRAN | integer function dpppal(filename, palette, overwrite, filemode)
> |  | character*(*) filename, palette, filemode
> |  | integer overwrite

> ##

> [DFP Interface][Top]

> DFPreadref/dprref

> intn DFPreadref(char *filename, uint16 ref)

> | filename | IN: | Name of the file
> | ref | IN: | Reference number to be used in next DFPgetpal call

> | Purpose | Retrieves the reference number of the palette to be retrieved next by DFPgetpal.
> | Return value | Returns `SUCCEED` (or 0) if the palette with the specified reference number exists and FAIL (or -1) otherwise.
> | Description | Used to set the reference number of the next palette to be retrieved.

> | FORTRAN | integer function dprref(filename, ref)
> |  | character*(*) filename
> |  | integer ref

> ##

> [DFP Interface][Top]

> DFPrestart/dprest

> intn DFPrestart( )

> | Purpose | Specifies that DFPgetpal will read the first palette in the file, rather than the next unread palette.
> | Return value | Returns `SUCCEED` (or 0) if successful and FAIL (or -1) otherwise.

> | FORTRAN | integer function dprest( )

> ##

> [DFP Interface][Top]

> DFPwriteref/dpwref

> intn DFPwriteref(char *filename, uint16 ref)

> | filename | IN: | Name of the file
> | ref | IN: | Reference number to be assigned to the next palette written to a file

> | Purpose | Determines the reference number of the next palette to be written.
> | Return value | Returns `SUCCEED` (or 0) if successful and FAIL (or -1) otherwise.
> | Description | The file name is ignored. The next palette written, regardless of the filename, is assigned the reference number ref.

> | FORTRAN | integer function dpwref(filename, ref)
> |  | character*(*) filename
> |  | integer ref

HDF4.2r4 - February 2009 Copyright | The HDF Group www.hdfgroup.org