AcePerl

 view release on metacpan or  search on metacpan

acelib/wh/regular.h  view on Meta::CPAN

UTIL_FUNC_DCL char* freeunprotect (char *text) ; /* reverse of protect, removes \ etc */

UTIL_VAR_DCL char FREE_UPPER[] ;
#define freeupper(x)	(FREE_UPPER[(x) & 0xff])  /* table is only 128 long */

UTIL_VAR_DCL char FREE_LOWER[] ;
#define freelower(x)	(FREE_LOWER[(x) & 0xff])




/**********************************************************************/
/******************** message routines - messubs.c ********************/
/**********************************************************************/

/* 'Internal' functions, do not call directly.                               */
UTIL_FUNC_DCL void uMessSetErrorOrigin(char *filename, int line_num) ;
UTIL_FUNC_DCL void uMessCrash(char *format, ...) ;

/* External Interface.                                                       */
/* Note that messcrash is a macro and that it makes use of the ',' operator  */
/* in C. This means that the messcrash macro will only produce a single C    */
/* statement and hence can be used within brackets etc. and will not break   */
/* existing code, e.g.                                                       */
/*                     funcblah(messcrash("hello")) ;                        */
/* will become:                                                              */
/* funcblah(uMessSetErrorOrigin(__FILE__, __LINE__), uMessCrash("hello")) ;  */
/*                                                                           */

UTIL_FUNC_DEF void messErrorInit (char *progname) ; /* Record the
					 applications name for use
					 in error messages, etc */
UTIL_FUNC_DEF char *messGetErrorProgram (void) ; /* Returns the
						    application name */

UTIL_FUNC_DCL char *messprintf (char *format, ...) ;	  
				/* sprintf into (static!) string */
				/* !!!! beware finite buffer size !!!! */

UTIL_FUNC_DCL void messbeep (void) ; /* make a beep */

UTIL_FUNC_DCL void messout (char *format, ...) ;  /* simple message */
UTIL_FUNC_DCL void messdump (char *format, ...) ; /* write to log file */
UTIL_FUNC_DCL void messerror (char *format, ...) ; /* error message and write to log file */
UTIL_FUNC_DCL void messExit(char *format, ...) ;  /* error message, write to log file & exit */
#define messcrash   uMessSetErrorOrigin(__FILE__, __LINE__), uMessCrash
						  /* abort - but see below */
UTIL_FUNC_DCL BOOL messQuery (char *text,...) ;	  /* ask yes/no question */
UTIL_FUNC_DCL BOOL messPrompt (char *prompt, char *dfault, char *fmt) ;
	/* ask for data satisfying format get results via freecard() */

UTIL_FUNC_DCL char* messSysErrorText (void) ; 
	/* wrapped system error message for use in messerror/crash() */

UTIL_FUNC_DCL int messErrorCount (void);
	/* return numbers of error so far */

UTIL_FUNC_DCL BOOL messIsInterruptCalled (void);
	/* return TRUE if an interrupt key has been pressed */

/**** registration of callbacks for messubs ****/

typedef void (*OutRoutine)(char*) ;
typedef BOOL (*QueryRoutine)(char*) ;
typedef BOOL (*PromptRoutine)(char*, char*, char*) ;
typedef BOOL (*IsInterruptRoutine)(void) ;

UTIL_FUNC_DCL VoidRoutine	messBeepRegister (VoidRoutine func) ;
UTIL_FUNC_DCL OutRoutine	messOutRegister (OutRoutine func) ;
UTIL_FUNC_DCL OutRoutine	messDumpRegister (OutRoutine func) ;
UTIL_FUNC_DCL OutRoutine	messErrorRegister (OutRoutine func) ;
UTIL_FUNC_DCL OutRoutine	messExitRegister (OutRoutine func) ;
UTIL_FUNC_DCL OutRoutine	messCrashRegister (OutRoutine func) ;
UTIL_FUNC_DCL QueryRoutine	messQueryRegister (QueryRoutine func) ;
UTIL_FUNC_DCL PromptRoutine	messPromptRegister (PromptRoutine func) ;
UTIL_FUNC_DCL IsInterruptRoutine messIsInterruptRegister (IsInterruptRoutine func) ;

/**** routines to catch crashes if necessary, e.g. when acedb dumping ****/

#include <setjmp.h>

UTIL_FUNC_DCL jmp_buf*	messCatchCrash (jmp_buf* ) ;
UTIL_FUNC_DCL jmp_buf*	messCatchError (jmp_buf* ) ;
UTIL_FUNC_DCL char*	messCaughtMessage (void) ;

  /* if a setjmp() stack context is set using messCatch*() then rather than
     exiting or giving an error message, messCrash() and messError() will
     longjmp() back to the context.
     messCatch*() return the previous value. Use argument = 0 to reset.
     messCaughtMessage() can be called from the jumped-to routine to get
     the error message that would have been printed.
  */

/********************************************************************/
/************** memory management - memsubs.c ***********************/
/********************************************************************/

typedef struct _STORE_HANDLE_STRUCT *STORE_HANDLE ; /* opaque outside memsubs.c */

UTIL_FUNC_DCL STORE_HANDLE handleHandleCreate (STORE_HANDLE handle) ;
#define handleCreate() handleHandleCreate(0)
#define handleDestroy(handle) messfree(handle)

#if defined(WIN32) && defined(_DEBUG)
#define MEM_DEBUG
#include <crtdbg.h>
#endif

#if !defined(MEM_DEBUG)

UTIL_FUNC_DCL void *handleAlloc (void (*final)(void *), STORE_HANDLE handle, int size) ;
    /* handleAlloc is deprecated, use halloc, and blockSetFinalize instead */
UTIL_FUNC_DCL void *halloc(int size, STORE_HANDLE handle) ;
UTIL_FUNC_DCL char *strnew(char *old, STORE_HANDLE handle) ;

#else		/* MEM_DEBUG from rbrusk */

void *halloc_dbg(int size, STORE_HANDLE handle, const char *hfname, int hlineno) ;
UTIL_FUNC_DCL void *handleAlloc_dbg(void (*final)(void *), STORE_HANDLE handle, int size,
					  const char *hfname, int hlineno) ;
UTIL_FUNC_DCL char *strnew_dbg(char *old, STORE_HANDLE handle, const char *hfname, int hlineno) ;



( run in 1.302 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )