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

📄 mwutil.h

📁 博弈论自适应功率控制中的实现
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
 * @(#)mwutil.h    generated by: makeheader    Mon Aug 14 12:07:39 2000
 *
 *		built from:	cputime.c
 *				dconvert.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
 *				libm_ext.c
 *				lower.c
 *				memalloc.c
 *				memdebug.c
 *				multibyte.c
 *				mwclasses.c
 *				mwmem.c
 *				printf.c
 *				purifytools.c
 *				regexp.c
 *				set.c
 *				stacktrc.c
 *				strcat.c
 *				strcmp.c
 *				strcmpi.c
 *				strcpy.c
 *				strdup.c
 *				strlen.c
 *				strrstr.c
 *				tolower.c
 *				upper.c
 *				ut_alloca.c
 *				utassert.c
 *				utsignal.c
 *				wallclok.c
 *				array/array.c
 *				array/qa_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
 *				err/qa_error_context.c
 *				gtable/gtable.c
 *				gtable/qa_gtable.c
 *				hashtool/hashtool.c
 *				hashtool/qa_hashtools.c
 *				interval/fsi.c
 *				interval/qa_fsi.c
 *				keydata/keydata.c
 *				keydata/qa_keydata.c
 *				linebuf/linebuf.c
 *				linebuf/qa_linebuf.c
 *				mem/memory_context.c
 *				mem/qa_memory_context.c
 *				msg/message_context.c
 *				msg/qa_message_context.c
 *				nh/namehash.c
 *				nh/qa_namehash.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
 *				strbuf/qa_string_buffer.c
 *				strbuf/string_buffer.c
 *				tse/qa_tse.c
 *				tse/tse.c
 *				uhash/qa_uhash.c
 *				uhash/uhash.c
 *				warn/qa_warning_context.c
 *				warn/warning_context.c
 *				modver/modver.c
 *				include/msg_typedefs.h
 *				include/err_typedefs.h
 */

#ifndef mwutil_h
#define mwutil_h

#ifdef __cplusplus
    extern "C" {
#endif


/* $Revision: 1.11 $ */
/*********************************************************************/
/*                        R C S  information                         */
/*********************************************************************/

/* $Log: msg_typedefs.h,v $
 * Revision 1.11  2000/05/31 20:52:46  pax
 * A structure named _primary_table had its first two
 * fields defined to be const int's.  C++ compilers spew warnings
 * when they see that presumably because the structure is not initalized
 * right then and there.  I don't see the purpose of these const's do I am
 * removing them.
 * Code Reviewer: RickS
 *
 * Revision 1.10  2000/03/24 15:25:56  howie
 * Backed out last submission.  Warning shows up on sbcc, but
 * not apparently in BAT.
 * Code Reviewer: BAT
 *
 * Revision 1.9  2000/03/20  14:06:15  howie
 * Fixed compiler warning for compiling with c++.
 * Code Reviewer: pax
 *
 * Revision 1.8  1999/11/12 18:31:20  mkarr
 * Enclosed all definitions in extern "C" {...}, because of function prototypes.
 *
 * Code Reviewer: Brett Baker
 *
 * Revision 1.7  1999/10/12  15:17:29  ricks
 * When implementing the code strings, I made the assumption that a
 * message context could only support one primary table.  I have since
 * been enlightened and fixed the code strings implementation such that
 * each primary table has storage for a code strings table in the
 * message context.
 * Related Records: 66856
 * Code Reviewer: John Micco
 *
 * Revision 1.6  1999/09/10  20:39:49  ricks
 * fix the macros so that the message mnemonic strings aren't defined for
 * secondary language tables
 * Code Reviewer: mike karr
 *
 * Revision 1.5  1999/08/25 13:38:04  ricks
 * Add ability to get the message mnemonic as a string.  Added new function
 * ut_get_message_mnemonic.
 * Code Reviewer: micco
 *
 * Revision 1.4  1999/08/12 21:39:19  bbaker
 * Added ut_puts_to_putsn.
 *
 * Code Reviewer: John Micco
 *
 * Revision 1.3  1999/08/05  20:00:38  ricks
 * added support for custom format specifiers %U
 *
 * Related Records: 65167
 * Code Reviewer: Mike Karr
 *
 * Revision 1.2  1999/03/31  21:25:39  scott
 * Remove MSG_END_OF_ERROR code.
 *
 * Code Reviewer: jmicco
 *
 * Revision 1.1  1999/02/25  02:01:48  jmicco
 * Initial revision
 *
 */

#ifndef msg_typedefs_h
#define msg_typedefs_h

/*
 * NOTE: In order to add a new module for error messages, please assign a new index 
 * and add to the bottom of .../src/util/include/msg_table.h
 */

/*
 * The following Macros and type definitions are for handling localized 
 * error messages.  The full details of how to use this package can
 * be found in:
 * http://www-internal.mathworks.com/devel/R12/perfect/src/util/documentation/message_context.pdf
 *
 * Please do not modify this file without making changes to the specification
 * and seeing Michael Karr or John Micco
 */ 

#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 _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)) }

#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;
} _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;
  _string_table *code_strings; /* table with mneumonic code strings */
  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;

⌨️ 快捷键说明

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