Main Page Alphabetical List Data Structures File List Data Fields Globals

# bbuf.c File Reference

## Functions
wmf_error_t | wmf_bbuf_input (wmfAPI *API, wmfRead fp_read, wmfSeek fp_seek, wmfTell fp_tell, void *user_data)
wmf_error_t | wmf_file_open (wmfAPI *API, char *file)
wmf_error_t | wmf_file_close (wmfAPI *API)
int | wmf_file_read (void *user_data)
int | wmf_file_seek (void *user_data, long pos)
long | wmf_file_tell (void *user_data)
wmf_error_t | wmf_mem_open (wmfAPI *API, unsigned char *mem, long length)
wmf_error_t | wmf_mem_close (wmfAPI *API)
int | wmf_mem_read (void *user_data)
int | wmf_mem_seek (void *user_data, long pos)
long | wmf_mem_tell (void *user_data)

## Function Documentation

wmf_error_t wmf_bbuf_input | ( | wmfAPI * | API,
|  | wmfRead | fp_read,
|  | wmfSeek | fp_seek,
|  | wmfTell | fp_tell,
|  | void * | user_data
| ) |

  | Set custom metafile input-stream handler functions. Parameters:
  API | the API handle
  fp_read | function to read a byte
  fp_seek | function to set position
  fp_tell | function to get position
  user_data | handle for user data
libwmf has simple methods for reading either from file or from memory, but many applications will want to use customized variants of these. wmf_bbuf_input() enables this.
    typedef int  (*wmfRead) (void* user_data);
    typedef int  (*wmfSeek) (void* user_data,long position);
    typedef long (*wmfTell) (void* user_data);
wmfRead returns unsigned char cast to int, or EOF (cf. fgetc()) wmfSeek returns (-1) on error, otherwise 0 (cf. fseek()) wmfTell returns (-1) on error, otherwise current position (cf. ftell()) Returns: Returns the library error state (wmf_E_None on success). Possible library error state of wmf_E_Glitch, if any of the three functions is zero.

wmf_error_t wmf_file_close | ( | wmfAPI * | API | ) |

  | Close metafile input file stream. Parameters:
  API | the API handle
Returns: Returns the library error state (wmf_E_None on success). Possible library error state of wmf_E_Glitch.

wmf_error_t wmf_file_open | ( | wmfAPI * | API,
|  | char * | file
| ) |

  | Open file as metafile. Parameters:
  API | the API handle
  file | file name
Simple method for reading from file. Returns: Returns the library error state (wmf_E_None on success). Possible library error states of wmf_E_Glitch or wmf_E_BadFile.

int wmf_file_read | ( | void * | user_data | ) |

| For internal use only.

int wmf_file_seek | ( | void * | user_data,
|  | long | pos
| ) |

| For internal use only.

long wmf_file_tell | ( | void * | user_data | ) |

| For internal use only.

wmf_error_t wmf_mem_close | ( | wmfAPI * | API | ) |

  | Close metafile input memory stream. Parameters:
  API | the API handle
Returns: Returns the library error state (wmf_E_None on success).

wmf_error_t wmf_mem_open | ( | wmfAPI * | API,
|  | unsigned char * | mem,
|  | long | length
| ) |

  | Open metafile in memory. Parameters:
  API | the API handle
  mem | the metafile in memory
  length | the length in bytes of metafile data
Simple method for reading from memory as array of unsigned char. Returns: Returns the library error state (wmf_E_None on success). Possible library error state of wmf_E_Glitch.

int wmf_mem_read | ( | void * | user_data | ) |

| For internal use only.

int wmf_mem_seek | ( | void * | user_data,
|  | long | pos
| ) |

| For internal use only.

long wmf_mem_tell | ( | void * | user_data | ) |

| For internal use only.