00001 #ifndef __WRKBUFF_H__ 00002 #define __WRKBUFF_H__ 00003 00004 /**********************************************************/ 00005 /*/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/ 00006 /* 00007 Copyright: 1995 - Grupo de Voz (DET) ETSII/IT-Bilbao 00008 00009 Nombre fuente................ wrkbuff.h 00010 Nombre paquete............... - 00011 Lenguaje fuente.............. C (Borland C/C++ 3.1) 00012 Estado....................... en desarrollo 00013 Dependencia Hard/OS.......... - 00014 Codigo condicional........... NDEBUG, NOWRKBUFF 00015 00016 Codificacion................. Borja Etxebarria 00017 00018 Version dd/mm/aa Autor Proposito de la edicion 00019 ------- -------- -------- ----------------------- 00020 0.0.0 07/06/95 Borja Codificacion inicial. 00021 00022 ======================== Contenido ======================== 00023 Cabecera de WRKBUFF.C. 00024 Para usar un buffer de trabajo global. 00025 Ver comentarios sobre utilizacion en WRKBUFF.C. 00026 =========================================================== 00027 */ 00028 /*/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/ 00029 /**********************************************************/ 00030 00031 #include "tdef.h" 00032 #include <assert.h> 00033 00034 /**********************************************************/ 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 /**********************************************************/ 00041 /* esta es la longitud del buffer global. */ 00042 00043 #define WRKBUFFLEN 10240 00044 00045 /**********************************************************/ 00046 00047 /* definir NOWRKBUFF para NO utilizar un buffer global */ 00048 00049 #define NOWRKBUFFxx 00050 00051 /**********************************************************/ 00052 00053 #ifdef NOWRKBUFF /* NOWRKBUFF esta definido */ 00054 00055 /* usamos buffer automatico en pila */ 00056 #define WRKBUFF(n) CHAR _wrkbuff[(n)] 00057 #define WRKBUFF_FREE() {} 00058 00059 #else /* NOWRKBUFF NO esta definido */ 00060 00061 /* asi que usamos buffer global {_wrkbuff}. WRKBUFF(n) comprueba 00062 que {_wrkbuff} tiene elementos suficientes. */ 00063 #ifdef NDEBUG 00064 #define WRKBUFF(n) {} 00065 #define WRKBUFF_FREE() {} 00066 #else 00067 #define WRKBUFF(n) { assert((n)<=WRKBUFFLEN); assert(!_wrkbuff_used); _wrkbuff_used=TRUE; } 00068 #define WRKBUFF_FREE() { assert(_wrkbuff_used); _wrkbuff_used=FALSE; } 00069 #endif 00070 00071 #ifndef __WRKBUFF_C__ 00072 00073 #ifdef __OS_MSDOS__ 00074 EXTERN CHAR _far *_wrkbuff; 00075 #else 00076 EXTERN CHAR *_wrkbuff; 00077 #endif 00078 00079 #ifndef NDEBUG 00080 EXTERN BOOL _wrkbuff_used; 00081 #endif 00082 #endif /* __WRKBUFF_C */ 00083 00084 #endif /* NOWRKBUFF */ 00085 00086 /**********************************************************/ 00087 00088 #ifdef __cplusplus 00089 } 00090 #endif 00091 00092 /**********************************************************/ 00093 00094 #endif