⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mwutil.h

📁 《精通matlab与c++混合编程》的光盘内容
💻 H
📖 第 1 页 / 共 4 页
字号:
/*
 * @(#)mwutil.h    generated by: makeheader 3.10  Tue Jun 18 00:53:06 2002
 *
 *		built from:	../../src/include/copyright.h
 *				include/msg_typedefs.h
 *				include/exception_typedefs.h
 *				include/err_typedefs.h
 *				cputime.c
 *				dconvert.c
 *				demangle.c
 *				dynload.c
 *				emptystr.c
 *				enum_str.c
 *				exception.c
 *				expmatch.c
 *				f2cstr.c
 *				fgets.c
 *				filelink.c
 *				format.c
 *				fp_conv.c
 *				fpu.c
 *				getcwd.c
 *				hash.c
 *				incrfcn.c
 *				int_conv.c
 *				lower.c
 *				memalloc.c
 *				memdebug.c
 *				multibyte.c
 *				mwclasses.c
 *				mwmem.c
 *				printf.c
 *				purifytools.c
 *				regexp.c
 *				set.c
 *				special_nans.c
 *				stacktrc.c
 *				strcat.c
 *				strcmp.c
 *				strcmpi.c
 *				strcpy.c
 *				strdup.c
 *				strlen.c
 *				strrstr.c
 *				sysinfo.c
 *				tmpnam.c
 *				tolower.c
 *				upper.c
 *				ut_alloca.c
 *				utassert.c
 *				utsignal.c
 *				wallclok.c
 *				array/array.c
 *				basic/basic_contexts.c
 *				basic/qa_basic.c
 *				dsbuffer/dsbuffer.c
 *				dsbuffer/qa_dsbuffer.c
 *				dtoa/bigint.c
 *				dtoa/dtoa.c
 *				dtoa/except.c
 *				dtoa/fpc.c
 *				dtoa/g_fmt.c
 *				dtoa/gen.c
 *				dtoa/ieee_dp.c
 *				dtoa/intr.c
 *				dtoa/modmin.c
 *				dtoa/os.c
 *				dtoa/pack.c
 *				dtoa/precision.c
 *				dtoa/qa_dtoa.c
 *				dtoa/qa_fpc.c
 *				dtoa/random.c
 *				dtoa/round.c
 *				dtoa/spdp.c
 *				dtoa/stress.c
 *				dtoa/testrec.c
 *				dtoa/tests.c
 *				dtoa/ulp.c
 *				err/error_context.c
 *				ghash/ghash.c
 *				ghash/qa_ghash.c
 *				gtable/gtable.c
 *				gtable/qa_gtable.c
 *				hashtool/hashtool.c
 *				ihash/ihash.c
 *				ihash/qa_ihash.c
 *				interval/fsi.c
 *				libm/cmath1.c
 *				libm/double_scalar.c
 *				libm/double_vector.c
 *				libm/emath.c
 *				libm/fdlibm.c
 *				libm/libm_ext.c
 *				libm/qa_double_vector.c
 *				libm/qa_libm.c
 *				libm/qa_libm_cpp.cpp
 *				libm/remmod.c
 *				libm/v4rands.c
 *				libm/v5rands.c
 *				linebuf/linebuf.c
 *				linebuf/qa_linebuf.c
 *				mem/memory_context.c
 *				modver/modver.c
 *				msg/message_context.c
 *				nh/namehash.c
 *				nh/symtab.c
 *				platform/unix.c
 *				profile/profile.c
 *				profile/qa_profile.c
 *				qa/qa_format.c
 *				qa/qa_hash.c
 *				qa/qa_memdebug.c
 *				qa/qa_mwmem.c
 *				sort/qa_qsort.c
 *				sort/qsort.c
 *				strbuf/string_buffer.c
 *				threads/ut_thread.c
 *				tse/qa_tse.c
 *				tse/tse.c
 *				warn/qa_warning_context.c
 *				warn/qa_warnmgr.c
 *				warn/warning_context.c
 *				warn/warnmgr.c
 */

#ifndef mwutil_h
#define mwutil_h


/* $Revision: 1.4 $ */
/*
 * Copyright (c) 1984-2001 The MathWorks, Inc.
 * All Rights Reserved.
 */



/* $Revision: 1.16 $ */

#ifndef msg_typedefs_h
#define msg_typedefs_h

#ifdef __cplusplus
    extern "C" {
#endif

typedef int (*fn_puts)(const char *s, void *x);

#define _element(X) X,

#define ut_define_module_mnemonics(m) \
  enum { m##_START=m##_INDEX<<16, m##_message_mnemonics(_element) m##_END}

#define _message_mnemonic(mnemonic, string) mnemonic,
#define _message_string(mnemonic, string) string,
#define _message_mnemonic_string(mnemonic, string) #mnemonic,

#define _concat(X, Y, Z) X##Y##Z

#define _define_module_tables_(language, table, m) \
static int const _concat(table,_codes_,m)[] \
  = {  _concat(m,language,messages)(_message_mnemonic) -1}; \
static _string const _concat(table,_strings_,m)[] \
  = {  _concat(m,language,messages)(_message_string) };

#define _define_module_code_strings_(language, table, m) \
static _string const _concat(table,_code_strings_,m)[] \
  = {  _concat(m,language,messages)(_message_mnemonic_string) }; \

#define _first(X, Y) X
#define _second(X, Y) Y

#define _define_module_tables(language_and_table, m) \
  _define_module_tables_(_first language_and_table, _second language_and_table, m)
#define _define_module_code_strings(language_and_table, m) \
  _define_module_code_strings_(_first language_and_table, _second language_and_table, m)

#define _table_element_(language, table, m) _concat(table,_strings_,m),

#define _table_element(language_and_table, m) \
  _table_element_(_first language_and_table, _second language_and_table, m)

#define _values_element_(language, table, m) _concat(table,_codes_,m),

#define _values_element(language_and_table, m) \
  _values_element_(_first language_and_table, _second language_and_table, m)

#define _values_string_element_(language, table, m) _concat(table,_code_strings_,m),

#define _values_string_element(language_and_table, m) \
  _values_string_element_(_first language_and_table, _second language_and_table, m)

#define _max_code_element(table, m) m##_END - m##_START - 1,

#define _component_element(table, m) #m


#define _module_element(Y,X) X##_INDEX,

#define ut_define_language_tables(language, table) \
  message_modules(_define_module_tables, (language, table)) \
  static int const table##_modules[] \
    = { message_modules(_module_element, table) -1 }; \
  static _int_table const table##_codes[] \
    = { message_modules(_values_element, (language, table)) }; \
  static _string_table const table##_strings[] \
    = { message_modules(_table_element, (language, table)) }; \
  static int const table##_code_count[] \
    = { message_modules(_max_code_element, table) }

#define ut_define_primary_messages(table) \
  message_module(_define_module_tables,(_,table)) \
  message_module(_define_module_code_strings,(_,table)) \
  static _primary_table const table \
    = { message_module(_max_code_element, table) \
        message_module(_module_element, table) \
        message_module(_values_element,(_,table)) \
        message_module(_values_string_element,(_,table)) \
        message_module(_table_element,(_,table)) \
        message_module(_component_element,(_,table)) }

#define ut_define_secondary_messages(language, table) \
  ut_define_language_tables(_##language##_, table); \
  static _language_table const table \
    = { table##_modules, \
        table##_codes, \
        table##_strings, \
        table##_code_count }

#define msg_INDEX 0
#define msg_message_mnemonics(X) X(NO_MEMORY_FOR_MESSAGE_CONTEXT) \
X(MSG_MODULE_COUNT_MISMATCH) X(TOO_FEW_STRINGS)      X(TOO_MANY_STRINGS) X(WRONG_CODE) \
X(STRANDED_PER_CENT)     X(NON_TRIVIAL_PER_CENT) X(NON_TRIVIAL_S)    X(HOLE_NOT_PRESENT) \
X(DUPLICATE_REFERENCE)   X(ILLEGAL_PER_CENT)     X(OMITTED_HOLE)     X(BAD_MSG_CODE) \
X(MSG_MODULE_TABLE_MISMATCH) X(INVALID_PERCENT_U)

ut_define_module_mnemonics(msg);

typedef const char *_string;
typedef _string const *_string_table;
typedef int const *_int_table;

typedef struct {
  int const *modules;
  _int_table const *codes;
  _string_table const *strings;
  _int_table code_count;
} _language_table;

typedef struct {
  int code_count;
  int module;
  _int_table codes;
  _string_table code_strings;
  _string_table strings;
  _string component_string;
} _primary_table;

typedef const _language_table *language_table;
typedef const _primary_table *primary_table;

#include <stddef.h>  /* This has size_t */
#include <stdio.h>   /* required for FILE */
#include <stdarg.h>  /* required for va_list, etc. */

/*
 * _hole_type enumerator identifies the hole type (%s and %U)
 */
typedef enum {
    STANDARD_HOLE_TYPE,          /* ID for the standard hole types */
    STRING_HOLE_TYPE,            /* ID for %s string holes */
    FUNCTION_HOLE_TYPE           /* ID for %U holes */
} _hole_type;

/*
 * _hole_seen enumerator identifes the 'seen' status of a hole
 */
typedef enum {
    HOLE_NOT_SEEN,
    HOLE_SEEN
} _hole_seen;

/*
 * _hole_info - information associated with a hole - char * for a
 * string hole, a va_list for a function hole
 */
typedef struct __hole_info {
    _hole_type   hole_type;      /* the type of this hole */
    union {
	/*
	 * fields used only when adding secondary strings
	 */
        _hole_seen hole_seen;    /* seen status, used to mark this hole as visited */
	
	/*
	 * fields used only when processing messages
	 */
	char    *hole_string;    /* string for %s fields */
	va_list  hole_ap;        /* arglist for %U fields */
    } hole;
} _hole_info;

typedef struct _message_context {
  int highest_module;          /* The maximum used module index for the items in the strings_list */
  int max_module;              /* The current allocation for items in the strings_list */
  int *code_count;
  int *ref_count;
  _string_table *code_strings; /* table with mneumonic code strings */
  _string * component_string;  /* name of component as a string */
  int current_language;        /* The currently active language index */
  int max_holes;
  int max_specification;
  int max_hole_text;
  char *specification;         /* specifications for non-%s fields */
  _hole_info *hole_infos;      /* information for hole fields */
  char *hole_text;             /* text for non-%s fields */
  int secondary_count;
  const char **keys;
                               /* The 0 index is the primary table,
                                * 1..secondary_count are for secondary languages
                                */
  _string_table **strings_list;
} _message_context, *message_context;

typedef unsigned long message_code;

/* function types */
typedef void *(*fn_malloc)(size_t);
typedef void *(*fn_realloc)(void *p, size_t);
typedef void (*fn_free)(void *p);

/*
 * This is the type of a functional argument to printm.
 * Its job is to "print" a string of n characters (in practice,
 * either to a file or to message buffer).
 * Characters to print _may_ include null bytes!
 */
typedef
int (*fn_putsn)(  /* Returns number of characters printed >= 0, else some error */
  void *x,        /* "Destination" info, e.g., FILE *, or &buffer */
  const char *s,  /* Source string (ptr to chars to print) */ 
  int n           /* Number of chars to print from s */
  );

/*
 * typedef for the custom format specifier formatting function
 */
typedef
int (*fn_fmtfcn)(      /* returns the number of chars putsn'd after processing*/
  fn_putsn putsn,
  void *x,             /* destination info, e.g., FILE *, or &buffer */
  va_list *ap);        /* var args list to custom format specifier, on return
                          this is advanced past the custom format varargs */

/*
 * Below are a typedef and a function conforming to the fn_puts typedef that 
 * in turn calls a fn_putsn function, stored in the putsn_to_puts_args structure.
 */
typedef struct _putsn_to_puts_args
{
  fn_putsn putsn;
  void *   x;
} _putsn_to_puts_args, * putsn_to_puts_args;

typedef struct _puts_to_putsn_args
{
  fn_puts puts;
  void *   x;
} _puts_to_putsn_args, * puts_to_putsn_args;


typedef void (*fn_handler)( void *x, message_code code, ... );

#ifdef __cplusplus
    }	/* extern "C" */
#endif

#endif /* msg_typedefs_h */


/* $Revision: 1.2 $ */

#ifndef exception_typedefs_h
#define exception_typedefs_h

#ifdef __cplusplus
    extern "C" {
#endif

/*
 * setjmp/longjmp macros: To set a longjmp target for a body of code use the
 * BEGIN_SETJMP macro, code following this macro is always executed.  Use the
 * ELSE_SETJMP macro to bound the always executed code and start the code
 * that will be executed only in the event of a longjmp.  Use the END_SETJMP
 * to finish off the whole thing.  Below shows the two possible uses for these
 * macros.
 *
 * case 1:
 *
 *	BEGIN_SETJMP
 *
 *	code that is always executed
 *
 *	ELSE_SETJMP
 *
 *	code that is only executed if there is a longjump
 *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -