diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-06-09 17:32:43 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-06-09 17:32:43 -0700 |
commit | 1803dedae88457520f6c8edbb42f2508b9c30c0e (patch) | |
tree | 5d6d1e7057f77acbb4b0300096b73ede57202cf8 /nasmlib.h | |
parent | 5b80b2334666d03e0f9ff673bdbd1c8a24ca8d2b (diff) | |
download | nasm-1803dedae88457520f6c8edbb42f2508b9c30c0e.tar.gz nasm-1803dedae88457520f6c8edbb42f2508b9c30c0e.tar.bz2 nasm-1803dedae88457520f6c8edbb42f2508b9c30c0e.zip |
Move all the SAA code out of nasmlib
Move all the SAA code out of nasmlib; it's not used by anything than
nasm itself. Cleaning out the kitchen sink known as nasmlib is a good
thing, too.
Diffstat (limited to 'nasmlib.h')
-rw-r--r-- | nasmlib.h | 48 |
1 files changed, 1 insertions, 47 deletions
@@ -37,6 +37,7 @@ * An error reporting function should look like this. */ typedef void (*efunc) (int severity, const char *fmt, ...); +extern efunc nasm_malloc_error; /* * These are the error severity codes which get passed as the first @@ -330,53 +331,6 @@ int64_t raa_read(struct RAA *, int32_t); struct RAA *raa_write(struct RAA *r, int32_t posn, int64_t value); /* - * Routines to manage a dynamic sequential-access array, under the - * same restriction on maximum mallocable block. This array may be - * written to in two ways: a contiguous chunk can be reserved of a - * given size with a pointer returned OR single-byte data may be - * written. The array can also be read back in the same two ways: - * as a series of big byte-data blocks or as a list of structures - * of a given size. - */ - -struct SAA { - /* - * members `end' and `elem_len' are only valid in first link in - * list; `rptr' and `rpos' are used for reading - */ - size_t elem_len; /* Size of each element */ - size_t blk_len; /* Size of each allocation block */ - size_t nblks; /* Total number of allocated blocks */ - size_t nblkptrs; /* Total number of allocation block pointers */ - size_t length; /* Total allocated length of the array */ - size_t datalen; /* Total data length of the array */ - char **wblk; /* Write block pointer */ - size_t wpos; /* Write position inside block */ - size_t wptr; /* Absolute write position */ - char **rblk; /* Read block pointer */ - size_t rpos; /* Read position inside block */ - size_t rptr; /* Absolute read position */ - char **blk_ptrs; /* Pointer to pointer blocks */ -}; - -struct SAA *saa_init(size_t elem_len); /* 1 == byte */ -void saa_free(struct SAA *); -void *saa_wstruct(struct SAA *); /* return a structure of elem_len */ -void saa_wbytes(struct SAA *, const void *, size_t); /* write arbitrary bytes */ -void saa_wleb128u(struct SAA *, int); /* write unsigned LEB128 value */ -void saa_wleb128s(struct SAA *, int); /* write signed LEB128 value */ -void saa_rewind(struct SAA *); /* for reading from beginning */ -void *saa_rstruct(struct SAA *); /* return NULL on EOA */ -const void *saa_rbytes(struct SAA *, size_t *); /* return 0 on EOA */ -void saa_rnbytes(struct SAA *, void *, size_t); /* read a given no. of bytes */ -/* random access */ -void saa_fread(struct SAA *, size_t, void *, size_t); -void saa_fwrite(struct SAA *, size_t, const void *, size_t); - -/* dump to file */ -void saa_fpwrite(struct SAA *, FILE *); - -/* * Binary search routine. Returns index into `array' of an entry * matching `string', or <0 if no match. `array' is taken to * contain `size' elements. |