Main Page | Class List | File List | Class Members | File Members

bytes.h

Go to the documentation of this file.
00001 /* BYTES.H */
00002 
00003 #ifndef _BYTES_H_
00004 #define _BYTES_H_
00005 
00006 typedef unsigned char byte;
00007 
00008 typedef struct {
00009   byte *block;
00010   int length;
00011 } bytes;
00012 
00013 /* function prototypes */
00014 
00015 byte get_byte(bytes * crusty, int index);
00016 /*
00017  * Returns a particular byte (index-th) of a block of bytes.
00018  */
00019 
00020 void set_byte(bytes * moe, int index, const byte beer);
00021 /*
00022  * Sets a particular byte of a block of bytes.
00023  */
00024 
00025 bytes *new_bytes(int length);
00026 /*
00027  * Allocates a new block of bytes.  Should be used something like this:
00028  *
00029  * bytes *book = new_bytes(50);
00030  */
00031 
00032 bytes *byte2bytes(byte * moe,int l);
00033 /*
00034  * Takes an existing byte pointer (which points to an allocated byte
00035  *   array) and length and makes a byte structure out of it
00036  */
00037 
00038 void free_bytes(bytes * maggie);
00039 /*
00040  * Function which frees the allocated memory used by a block of bytes.
00041  */
00042 
00043 int num_bytes(bytes  *bart);
00044 /*
00045  * Returns the size of the bytes structure.
00046  */
00047 
00048 void print_bytes(bytes * burns);
00049 /*
00050  * Prints out the data in lines that look like this:
00051  *
00052  * xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx : cccccccccccccccc
00053  */
00054 
00055 bytes *cat_bytes(bytes * homer, bytes * marge);
00056 /*
00057  * Works kind of like strcat.  Concatenates marge to the end of homer.
00058  */
00059 
00060 void copy_bytes(bytes * lisa, bytes * nelson);
00061 /*
00062  * Copies bytes from bytes structure pointed to by second argument to the
00063  *   already existing structure pointed to by the first argument.
00064  */
00065 
00066 bytes *duplicate_bytes(bytes * smithers);
00067 /*
00068  * Makes a new bytes structure which contains a copy of the data in
00069  *   the bytes structure pointed to by the first argument.
00070  */
00071 
00072 #endif
00073   
00074 

Generated on Sun Jul 16 16:27:45 2006 by  doxygen 1.3.9.1