OSF DCE Application Development Guide--Core Components
OSF DCE Application Development Guide—Core Components
The test code for the example is as follows:
#include <dce/pthread_exc.h>
#include "rpcexc.h"
#include <stdio.h>
#include <stdlib.h>
#include <file.h>
#include <sys/file.h>
#include "es_array.h"
/*
* User state for incremental encode/decode
*/
typedef struct es_state_t {
idl_byte *malloced_addr;
int file_handle;
} es_state_t;
static es_state_t es_state;
#define OUT_BUFF_SIZE 2048
static idl_byte out_buff[OUT_BUFF_SIZE];
static idl_byte *out_data_addr;
static idl_ulong_int out_data_size;
/*
* User allocate routine for incremental encode
*/
void es_allocate(state, buf, size)
idl_void_p_t state;
idl_byte **buf;
idl_ulong_int *size;
{
idl_byte *malloced_addr;
es_state_t *p_es_state = (es_state_t *)state;
malloced_addr = (idl_byte *)malloc(*size);
p_es_state->malloced_addr = malloced_addr;
*buf = (idl_byte *)(((malloced_addr - (idl_byte *)0) + 7) & (˜7));
*size = (*size - (*buf - malloced_addr)) & (˜7);
}
16 − 50 Tandem Computers Incorporated 124245