3 * libneuro, a light weight abstraction of high or lower libraries
4 * and toolkit for applications.
5 * Copyright (C) 2005-2006 Nicholas Niro, Robert Lemay
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #include "neuro_engine.h"
26 #include <stdlib.h> /* for the size_t type */
36 * <i>EBuf</i> stands for Engine Buffer.
37 * Its primary use is to make structures <i>allocation</i>
38 * and <i>reallocation</i> quick and easy; It provides
39 * <i>secure</i> and easy ways to dynamically <i>add</i>,
40 * <i>remove</i> and <i>modify</i> entries from a buffer.
43 * <h2>INTRODUCTION :</h2>
45 * This <i>manual</i> presents the way the module has
46 * to be used (which <i>functions</i> to call and in what order)
48 * without going into too much details. The goal of this <i>manual</i>
49 * is to give a general insight as to which functions are
50 * needed to attain a result.
53 * <h2>BEGINNING :</h2>
55 * To make use of even the slightest of this module, the first
56 * requirement is to create a <i>pointer</i> to an EBUF(3) type.
59 * <p><i>here's an example</i> : EBUF *abuffer;</p>
62 * You cannot use a direct variable like : EBUF abuffer --
63 * for parity reasons(safegard of the data integrity),
64 * the content of the structure is to remain hidden
65 * from external programs.
69 * The EBuf module is completely reentrant, meaning it does
70 * not contain global data in the module, making it
74 * <h2>INITIALISING AND FREEING :</h2>
77 * Now that the EBUF(3) pointer is created, the next step is to
78 * initialize it by using Neuro_CreateEBuf(3). Among other,
79 * it allocates enough memory for its own internal data and
80 * then resets them to default initial values.
84 * When no longer needed, the pointer should be freed by using
85 * Neuro_CleanEBuf(3). It frees the EBUF(3)'s internal buffer
86 * completely. In the case that the use of the EBUF(3) pointer
87 * is needed after it is freed, the call of Neuro_CreateEBuf(3)
88 * is required again. In the case that just one element
89 * in the buffer needs to be freed, the use of
90 * Neuro_SCleanEBuf(3) is required.
94 * In addition to normal freeing, you can also set a callback
95 * right after the initialization using Neuro_SetcallbEBuf(3).
96 * The callback will be called for every elements that the
97 * EBUF(3) contains right before they are freed (by either calling
98 * Neuro_CleanEBuf(3) or Neuro_SCleanEBuf(3)), permitting
99 * the manual freeing of allocated pointers inside the structure.
100 * Among other, this permits EBUF(3) pointers to contain other
101 * EBUF(3) pointers and/or manually allocated pointers and the
102 * hability to free them cleanly.
106 * <b>NOTE :</b> Neuro_SCleanEBuf(3) <i>doesn't</i> keep the data order in the
107 * buffer at all. It actually is made to break the data order in
108 * order to be more efficient.
112 * <i>here's an example</i>, 3 elements were allocated :
113 * elements 1, 2 and 3. The element number 4 is added to this
114 * buffer to form (1, 2, 3 and 4). The element number 2 is then
115 * removed from the buffer, which would <i>normally</i> do
116 * (1, 3 and 4) <i>but no</i>, this actually does (1, 4 and 3).
120 * The last element is <i>always</i> moved to the position of the
121 * deleted element which actually breaks the order of the data
122 * in the buffer completely (but is necessary for performance reasons).
126 * <i>In order to fix this sorting quirk</i>, all the steps in order to do so
127 * are stated in the <i>MOVING DATA</i> section of this very manual.
130 * <h2>ALLOCATING NEW DATA :</h2>
133 * by now, we have initalised and possibly set a callback to the
134 * instance, but we are still missing an important step :
135 * creating a structure template which the instance EBUF(3) will
136 * contain. Theres only two ways to allocate : Neuro_AllocEBuf(3)
137 * and Neuro_MultiAllocEBuf(3)
138 * A basic structure template was used in the example in
139 * the man page for the function Neuro_AllocEBuf(3) which is
140 * exactly the function we need to use to allocate a new element.
144 * <h2>READ AND WRITE :</h2>
147 * reading/writing from an ebuf element is quite easy, it works kind of
148 * the same as when you call malloc(). After calling Neuro_AllocEBuf(3)
149 * or Neuro_MultiAllocEBuf(3), you can use either Neuro_GiveEBuf(3)
150 * or Neuro_GiveCurEBuf(3). Those two functions return a void pointer
151 * which you simply put into the correct variable. You can then read
152 * or write from the structure directly. If you want to work on all the
153 * data of the buffer, you need to fetch how much elements are contained.
154 * For the purpose the function Neuro_GiveEBufCount(3) has to be used.
155 * Then, when looping, a simple call to Neuro_GiveEBuf(3) has to be used
156 * to get each data structs.
159 * <h2>MOVING DATA :</h2>
161 * on certain occasions, you might want to change the order by which
162 * the data in the EBUF(3) buffer is organised. This is needed when you
163 * want to sort the elements. For this effect, we actually need to use
164 * the function Neuro_SetEBuf(3) to copy a certain element to a
165 * precise address on the buffer. This can't be used directly, we
166 * actually need to get the address of the element we want to change.
167 * To get the address of a certain element, we need to use the function
168 * Neuro_GiveEBufAddr(3).
169 * Here's how we do it :
174 * -- in this code example, we will transfer the last element into --
175 * -- a certain position in the buffer and transfer that certain --
176 * -- position into the last place. --
178 * -- ST is a structure we use throughout the EBUF(3) man pages --
179 * -- if you have no idea whats it for, check a few man paged --
180 * -- on EBUF(3), especially the Neuro_SetcallbEBuf(3) one. --
181 * -- we assume this pointer already points to an EBUF(3) element --
187 * -- we need the array number of the element to call the next --
189 * if (Neuro_GiveEBufElem(myeng, element, &elem_value))
190 * return; -- an error occured so we bail out --
192 * -- we then copy the last element into that certain's element address --
193 * Neuro_SetEBuf(myeng, Neuro_GiveEBufAddr(myeng, elem_value), Neuro_GiveCurEBuf(myeng));
195 * -- now that we copied the address of the last element into --
196 * -- our certain element. we need to copy our certain element into --
197 * -- the last position. --
199 * Neuro_SetEBuf(myeng, Neuro_GiveEBufAddr(myeng, Neuro_GiveEBufCount(myeng)), element);
201 * And thats it folks! Now, next time we loop the buffer, the order will have
202 * a certain element at the end and the last element in what ever position our
203 * certain element was.
206 * <b>PLEASE NOTE :</b> you <b>can't</b> use the returned value of the function
207 * Neuro_GiveEBufCount(3) to figure if the EBUF(3) is <b>empty</b> (ie when it
208 * doesn't contain any elements or when still unallocated).
209 * <b>for this</b>, you have to use the function Neuro_EBufIsEmpty(3) which returns
210 * 1 if the buffer can <b>not</b> be used and 0 if it <b>can</b>. Any use of an EBUF(3)
211 * which returns 1 when you call Neuro_EBufIsEmpty(3) can create <b>very</b>
212 * unwanted results and <b>very</b> likely cause a segmentation fault.
215 * EBUF(3), Neuro_CreateEBuf(3), Neuro_SetcallbEBuf(3),
216 * Neuro_AllocEBuf(3), Neuro_MultiAllocEBuf(3),
217 * Neuro_CleanEBuf(3), Neuro_SCleanEBuf(3),
218 * Neuro_GiveEBufCount(3), Neuro_GiveEBufElem(3),
219 * Neuro_GiveCurEBuf(3), Neuro_GiveEBufAddr(3),
220 * Neuro_GiveEBuf(3), Neuro_GiveEBufCore(3),
221 * Neuro_SetEBuf(3), Neuro_CopyEBuf(3),
222 * Neuro_ResetEBuf(3), Neuro_EBufIsEmpty(3)
226 * This macro is to set the number of extra instances
227 * of memory needs to be allocated per allocations.
228 * In theory, this is absolutely not needed but since
229 * the allocation proccess is slow, the less we do it,
230 * the better. 10 is a good default.
232 #define MEMORY_ALLOC_OVERH 10
240 * the Engine Buffer object. A pointer variable
241 * of this type is required.
242 * Example : EBUF *myeng;
244 * -- this is the struct we want to have buffered,
245 * -- meaning EBUF will keep and create instances of this struct.
252 typedef struct EBUF EBUF
;
256 * sole constructor of an EBUF element.
259 * This function initializes and makes operationnal
263 * the address of an EBUF pointer.
267 * static EBUF *myeng;
271 * Neuro_CreateEBuf(&myeng);
276 * Neuro_CleanEBuf(3), Neuro_CleanEBuf2(3) Neuro_AllocEBuf(3), Neuro_SetcallbEBuf(3),
277 * Neuro_EBufIsEmpty(3)
280 extern void Neuro_CreateEBuf(EBUF
**eng
);
284 * creates an useable EBUF element
287 * This function returns an initialized EBUF elemnt.
291 * static EBUF *myeng;
295 * myeng = Neuro_CreateEBuf2();
300 * Neuro_CleanEBuf(3), Neuro_CleanEBuf2(3), Neuro_AllocEBuf(3), Neuro_SetcallbEBuf(3),
301 * Neuro_EBufIsEmpty(3)
303 extern EBUF
*Neuro_CreateEBuf2();
305 /** Neuro_SetcallbEBuf
307 * Set a callback that will be called for each array elements
308 * when the EBUF element is cleaning itself after a call to Neuro_CleanEBuf
309 * or Neuro_SCleanEBuf.
312 * This function is used to set a callback function to the EBUF element.
313 * This callback function will be called (during the cleaning
314 * time) for every arrays right before they are each freed.
315 * This is so you can free custom stuff that you allocated in the
316 * struct you put in EBUF. The callback function will need a single
317 * argument which will be a void pointer. This will point to the
318 * array(single element of the big array) which is being freed.
325 * a callback which itself contain an argument to a void pointer.
335 * static EBUF *myeng;
338 * callbackclean(void *src)
346 * if (temp->someString)
347 * free(temp->someString);
353 * Neuro_CreateEBuf(&myeng);
354 * Neuro_SetcallbEBuf(myeng, callbackclean);
360 * Neuro_AllocEBuf(myeng, sizeof(ST*), sizeof(ST));
362 * foo = Neuro_GiveCurEBuf(myeng);
364 * foo->someString = (char*)malloc(50);
368 * Neuro_CleanEBuf(&myeng);
371 * Neuro_CreateEBuf(3), Neuro_CleanEBuf(3)
374 extern void Neuro_SetcallbEBuf(EBUF
*eng
, void (*callback
)(void *src
));
378 * Simple Allocation and reallocation of an EBuf element.
381 * This function is pretty much the most useful function in the lot,
382 * it actually creates a new "slot" which can then be used to add
383 * data to an EBUF element. This function and Neuro_MultiAllocEBuf
384 * are the two only functions which allocate/reallocate memory in
387 * Take good note that an EBUF element can buffer
388 * any kinds of structure (so it can dynamically grow easily and avoid memory
389 * leaks). To support this, this function needs only 2 informations
390 * about the structure :
391 * the size of its pointer form and the size of its normal form. It might
392 * also be possible to work with other variable types than structures, although
393 * it is not really recommended unless you know what you are doing.
399 * the size of the pointer form of the structure (usually sizeof can be used to find it).
402 * the size of the normal form of the structure (usually sizeof can be used to find it).
411 * static EBUF *myeng;
416 * Neuro_CreateEBuf(&myeng);
420 * Neuro_AllocEBuf(myeng, sizeof(ST*), sizeof(ST));
424 * Neuro_CleanEBuf(&myeng);
427 * Neuro_GiveEBufCount(3), Neuro_GiveEBuf(3), Neuro_GiveCurEBuf(3),
428 * Neuro_MultiAllocEBuf(3)
430 extern void Neuro_AllocEBuf(EBUF
*eng
, size_t sptp
, size_t sobj
);
433 /** Neuro_MultiAllocEBuf
435 * initial allocation of a bigger amount of slots than one.
438 * This function works exactly the same as Neuro_AllocEBuf except
439 * for one single thing : It can allocate more than one slot at once.
440 * Take very good note that this will only work if the EBUF object hasn't
441 * been allocated before, ie only if it is empty. For security purpose, this
442 * function won't work if theres already allocated slots in the EBUF.
448 * the amount of slots to allocate.
451 * the size of the pointer form of the structure (usually sizeof can be used to find it).
454 * the size of the normal form of the structure (usually sizeof can be used to find it).*
457 * see the example in Neuro_AllocEBuf(3)
460 * Neuro_GiveEBufCount(3), Neuro_GiveEBuf(3), Neuro_GiveCurEBuf(3),
463 extern void Neuro_MultiAllocEBuf(EBUF
*eng
, u32 amount
, size_t sptp
, size_t sobj
);
467 * Standard destructor of an EBUF element.
473 * the address of an EBUF pointer.
477 * static EBUF *myeng;
481 * Neuro_CreateEBuf(&myeng);
485 * Neuro_CleanEBuf(&myeng);
488 * Neuro_CreateEBuf(3), Neuro_CreateEBuf2(3), Neuro_AllocEBuf(3), Neuro_SetcallbEBuf(3),
489 * Neuro_SCleanEBuf(3)
492 extern void Neuro_CleanEBuf(EBUF
**eng
);
496 * destructor of an EBUF element.
502 * static EBUF *myeng;
506 * myeng = Neuro_CreateEBuf2();
510 * Neuro_CleanEBuf2(myeng);
514 * Neuro_CreateEBuf(3), Neuro_CreateEBuf2(3), Neuro_AllocEBuf(3), Neuro_SetcallbEBuf(3),
515 * Neuro_SCleanEBuf(3)
518 extern void Neuro_CleanEBuf2(EBUF
*eng
);
522 * cleans/frees one element.
525 * This function's purpose is to clean elements in a similar
526 * manner as Neuro_CleanEBuf(3) but it only
527 * cleans one element. Take note that the callback
528 * which can be set using the function Neuro_SetcallbEBuf(3) is also called with this function.
534 * the pointer to an element contained in the EBUF buffer which needs to be cleaned.
543 * static EBUF *myeng;
547 * Neuro_CreateEBuf(&myeng);
553 * Neuro_AllocEBuf(myeng, sizeof(ST*), sizeof(ST));
555 * buf = Neuro_GetCurEBuf(myeng);
557 * buf->someString = "hello";
559 * -- lets say we no longer need the variable --
560 * -- we can clean it using this function --
561 * Neuro_SCleanEBuf(myeng, buf);
565 * Neuro_CleanEBuf(&myeng);
568 * Neuro_CreateEBuf(3), Neuro_AllocEBuf(3), Neuro_SetcallbEBuf(3), Neuro_CleanEBuf(3), Neuro_GiveEBuf(3), Neuro_GiveCurEBuf(3)
571 extern void Neuro_SCleanEBuf(EBUF
*eng
, void *object
);
573 /** Neuro_GiveEBufCount
576 * give the count of elements in the array
579 * This function returns the number of elements contained
580 * in the core buffer. Each elements in the buffer are ordered
581 * in the order they were "pushed" into the buffer thus this
582 * value can be used to loop the buffer for all the elements
583 * one after the other. NOTE This function returns 0 when theres only
584 * one element and it can't return negative values so it cannot
585 * be used to know if the buffer is empty or not! Use the function
586 * Neuro_EBufIsEmpty(3) to check if its empty or not.
592 * the amount of elements in the EBUF element.
596 * -- in this example, I ommited the initial creation of the buffer, --
597 * -- the final cleaning of the buffer, --
598 * -- the cleaning callback function, --
599 * -- the allocation of the buffer and --
600 * -- the struct ST and its typedef. --
601 * -- SEE the man page for the function Neuro_AllocEBuf(3) for those --
602 * -- and SEE the man page for Neuro_SetcallbEBuf(3) for the callback --
605 * unsigned int total = 0;
607 * -- we check if the buffer is empty --
608 * if (Neuro_EBufIsEmpty(myeng))
611 * -- we get the total number of elements in myeng --
612 * -- and also increment it by one because we will --
613 * -- loop the elements from finish to start --
614 * total = Neuro_GiveEBufCount(myeng) + 1;
616 * while (total-- > 0)
618 * buf = Neuro_GiveEBuf(myeng, total);
625 * Neuro_AllocEBuf(3), Neuro_GiveEBuf(3),
626 * Neuro_GiveCurEBuf(3), Neuro_EBufIsEmpty(3)
628 extern u32
Neuro_GiveEBufCount(EBUF
*eng
);
630 /** Neuro_GiveEBufElem
632 * output the array number of the element object
635 * This function is used to get the array number
636 * of a structure pointer which is inside
637 * the buffer eng. If the element is not
638 * contained inside the buffer, this will
639 * return 1 and 0 on success. Make sure to
640 * put either a real integer or an allocated
641 * one's address for the *elem argument.
647 * a void pointer of an element
648 * of which the array number will be put
649 * in the output integer.
652 * the array number of the element in the
656 * either 0 or 1. 1 on error (when the pointer object is not
657 * found in the buffer eng or when the buffer eng is NULL).
667 * -- we create a struct element --
668 * -- called an_element into which --
669 * -- we will put the address of an ebuf allocated element --
670 * -- this method can be used to track certain key elements inside the buffer. --
672 * static ST *an_element;
674 * static EBUF *myeng;
677 * callbackclean(void *src)
685 * if (temp->someString)
686 * free(temp->someString);
692 * Neuro_CreateEBuf(&myeng);
693 * Neuro_SetcallbEBuf(myeng, callbackclean);
699 * Neuro_AllocEBuf(myeng, sizeof(ST*), sizeof(ST));
701 * foo = Neuro_GiveCurEBuf(myeng);
704 * foo->someString = (char*)malloc(50);
706 * -- we set our variable to the address that the pointer foo points to --
707 * -- this makes it behave the exact same as if it was actually --
708 * -- the pointer foo... we can then access the data from it --
709 * -- for any purpose and fast. --
714 * -- in a certain function, we use the content of the pointer an_element --
715 * -- but for certain cases we also need to get its array number. --
716 * -- This only works if this particular pointer was allocated in an EBUF. --
718 * u32 elem_value = 0;
720 * if (Neuro_GiveEBufElem(myeng, an_element, &elem_value))
722 * printf("an error happened, the element (an_element) wasn't found in the buffer (myeng)\n");
726 * -- now, if there wasn't any errors, the variable an_element --
727 * -- contains the array number for the pointer an_element. --
728 * -- this number can be used with the function Neuro_GiveEBuf(3) or Neuro_GiveEBufAddr(3).
732 * Neuro_CleanEBuf(&myeng);
737 * Neuro_GiveEBufAddr(3), Neuro_GiveEBuf(3)
739 extern int Neuro_GiveEBufElem(EBUF
*eng
, void *object
, u32
*elem
);
741 /** Neuro_GiveCurEBuf
743 * outputs the last element of the buffer.
746 * before this function, we had to get the number of
747 * elements from the buffer using Neuro_GiveEBufCount(3)
748 * and then call Neuro_GiveEBuf(3) to get the element.
749 * Now, this function can be used to have the exact same
750 * result but in just one call.
756 * the pointer of the element. It returns NULL on error.
759 * -- see the man page for Neuro_GiveEBuf(3) for how this --
760 * -- function can be used. Also, almost all the functions --
761 * -- use this function in their examples so just check how --
762 * -- they use it... usually, this function is called right --
763 * -- after you allocate the buffer using Neuro_AllocEBuf(3), --
764 * -- because we need to get the pointer so we can populate it. --
767 * Neuro_AllocEBuf(3), Neuro_MultiAllocEBuf(3),
770 extern void *Neuro_GiveCurEBuf(EBUF
*eng
);
772 /** Neuro_GiveEBufAddr
775 * gives the real address of the element of the array number elem.
778 * this function is essential in the event that you want
779 * to change the order into which the EBUF buffer is.
785 * the array number of the element you want the pointer address.
788 * the pointer to a pointer which contains the address of the
792 * see the Neuro_EBuf(3) man page on section MOVING DATA for
793 * an example on how to use this function.
796 * Neuro_GiveEBufElem(3), Neuro_SetEBuf(3),
798 extern void **Neuro_GiveEBufAddr(EBUF
*eng
, u32 elem
);
803 * gives the element corresponding to the number input in
807 * This function is the default way of getting the
808 * pointer of an allocated element. The pointer can
809 * be used to access the data and read/write to it.
815 * this argument corresponds to the element number
816 * that you want to fetch from the buffer.
819 * the pointer to the element from the EBUF. As a void pointer
820 * so it is possible to "morph" it into any other pointer type.
830 * static EBUF *myeng;
833 * callbackclean(void *src)
841 * if (temp->someString)
842 * free(temp->someString);
848 * Neuro_CreateEBuf(&myeng);
849 * Neuro_SetcallbEBuf(myeng, callbackclean);
855 * Neuro_AllocEBuf(myeng, sizeof(ST*), sizeof(ST));
857 * foo = Neuro_GiveCurEBuf(myeng);
859 * foo->someString = (char*)malloc(50);
863 * -- this code outputs to the default output channel --
864 * -- the content of every elements of the buffer --
868 * if (Neuro_EBufIsEmpty(myeng))
871 * total = Neuro_GiveEBufCount(myeng) + 1;
873 * while (total-- > 0)
875 * temp = Neuro_GiveEBuf(myeng, total);
877 * printf("some value : %s\n", temp->someString);
882 * Neuro_CleanEBuf(&myeng);
885 * Neuro_AllocEBuf(3), Neuro_MultiAllocEBuf(3),
886 * Neuro_GiveEBufCount(3)
888 extern void *Neuro_GiveEBuf(EBUF
*eng
, u32 elem
);
890 /** Neuro_GiveEBufCore
892 * give the core buffer of the EBuf element
895 * this function should never be used, it returns
896 * the actual pointer of the CORE of an EBUF element.
897 * The need of this function is very close to Nill
898 * and it is strongly advised to avoid the use of this
899 * function at all cost.
905 * the CORE of the EBUF's main (and only) buffer.
908 * this function was initially made for bitmap loading
909 * in neuro extlib, it permitted to input simple string
910 * elements and then the ability to give this core
911 * to the pixmap library so it would load the bitmap
912 * from it. This use was considered a BIG HACK. The neuro
913 * bitmap loading code stopped using this function quite
914 * a long time ago so it is unused anywhere.
916 * Neuro_SCleanEBuf(3) Neuro_GiveEBufAddr(3)
917 * Neuro_GiveEBufAddr(3), Neuro_SetEBuf(3),
918 * Neuro_CopyEBuf(3), Neuro_ResetEBuf(3)
920 extern void **Neuro_GiveEBufCore(EBUF
*eng
);
926 * copy the actual content to another position in the
930 * this function is a key element for the task of sorting
931 * elements among the other elements in the buffer.
937 * the actual address of the pointer of an element from the EBUF.
938 * This informations can ONLY be given by the function
939 * Neuro_GiveEBufAddr(3).
942 * the pointer of the element to copy to the address to.
945 * see the Neuro_EBuf(3) man page on section MOVING DATA for
946 * an example on how to use this function. *
949 * Neuro_GiveEBufAddr(3), Neuro_GiveEBufElem(3)
951 extern void Neuro_SetEBuf(EBUF
*eng
, void **to
, void *from
);
955 * copy the content of an EBUF variable to another EBUF variable.
958 * nothing unusual with this function, it simply cleanly copies the
959 * content of an already created EBUF element to another one
960 * that wasn't created yet. If copy an EBUF to another that
961 * already contains data, you'll create a big memory leak.
962 * Note : this function is very fast because it is only copies addresses.
963 * Note2 : Also note that only one of the two needs to be cleaned;
964 * they both contain the same addresses.
970 * an EBUF pointer which gets copied into the EBUF to.
973 * static EBUF *myeng;
977 * Neuro_CreateEBuf(&myeng);
983 * Neuro_CopyEBuf(clone, myeng);
987 * Neuro_CleanEBuf(&myeng);
993 extern void Neuro_CopyEBuf(EBUF
*to
, EBUF
*from
);
997 * resets the EBUF variable WITHOUT FREEING IT -- Warning this
998 * is a mem leak if you didn't copy the content to another one
1001 * use the function Neuro_CopyEBuf(3) to backup the addresses for
1002 * the cleaning process prior to using this function please.
1010 extern void Neuro_ResetEBuf(EBUF
*eng
);
1012 /** Neuro_EBufIsEmpty
1014 * this is a simple boolean returning function that returns
1015 * 1 if [eng] is empty and 0 if it holds stuff.
1018 * this function is the only way to know if an EBUF is empty
1019 * or not, you CAN'T use the function Neuro_GiveEBufCount(3)
1026 * 1 if the EBUF is empty and should not be used and 0 if it
1027 * was created and populated.
1030 * Neuro_GiveEBufCount(3)
1032 extern u8
Neuro_EBufIsEmpty(EBUF
*eng
);
1038 #endif /* not __EBUF_H */