symbol.h
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 368 行 · 第 1/2 页
H
368 行
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
* DESCRIBE IT HERE!
*
****************************************************************************/
// SYMBOL.H -- operations on symbols
//
// 91/11/06 -- J.W.Welch -- defined
// Macros
#include "intsupp.h"
#define SymAddrTaken(s) ( (s)->flag & SF_ADDR_TAKEN )
#define SymDbgAddrTaken(s) ( (s)->flag & SF_DBG_ADDR_TAKEN )
#define SymIsAnError(s) ( (s)->flag & SF_ERROR )
#define SymIsConstantInt(s) ( (s)->flag & SF_CONSTANT_INT )
#define SymIsConstantNoCode(s) ( (s)->flag & SF_CONST_NO_CODE )
#define SymIsInitialized(s) ( (s)->flag & SF_INITIALIZED )
#define SymIsReferenced(s) ( (s)->flag & SF_REFERENCED )
#define SymInVft(s) ( (s)->flag & SF_IN_VFT )
#define SymIsAnonymousMember(s) ( (s)->flag & SF_ANONYMOUS )
#define SymIsUninlineable(s) ( (s)->flag & SF_DONT_INLINE )
#define SymIsMustGen(s) ( (s)->flag & SF_MUST_GEN )
#define SymIsFnTemplateMatchable(s) ( (s)->flag & SF_TEMPLATE_FN )
#define SymIsAlias(s) ( (s)->flag & SF_ALIAS )
#define SymIsCatchAlias(s) ( (s)->id == SC_AUTO && ( (s)->flag & SF_CATCH_ALIAS ))
#define SymIsTypedef(s) ( (s)->id == SC_TYPEDEF )
#define SymIsDefArg(s) ( (s)->id == SC_DEFAULT )
#define SymIsEnumeration(s) ( (s)->id == SC_ENUM )
#define SymIsFunctionTemplateModel(s) ( ( (s)->id == SC_FUNCTION_TEMPLATE ) || ( (s)->id == SC_STATIC_FUNCTION_TEMPLATE ) )
#define SymIsClassTemplateModel(s) ( (s)->id == SC_CLASS_TEMPLATE )
#define SymIsNameSpace(s) ( (s)->id == SC_NAMESPACE )
#define SymFuncReturnType(s) ( SymUnmodifiedType(s)->of )
#define SymUnmodifiedType(s) ( TypedefModifierRemoveOnly( (s)->sym_type ) )
#define SymIsEllipsisFunc(s) ( TypeHasEllipsisArg( (s)->sym_type ) )
#define SymIsEnumAnonymousTypedef(s) ( TypeIsAnonymousEnum( (s)->sym_type ) )
#define SymAddressOf(s) (((s)->id == SC_ADDRESS_ALIAS ) ? (s)->u.alias : NULL )
#define SymIsComdatFun(s) ( SymComdatFunInfo((s)) != SCF_NULL )
#define SymIsGennedComdatFun(s) \
(( SymComdatFunInfo((s)) & (SCF_STATIC|SCF_COMDAT) ) == SCF_COMDAT )
typedef enum {
SCF_NULL = 0x00,
SCF_COMDAT = 0x01, // fn is a comdat function
SCF_STATIC = 0x02, // user wants comdat fn in the text segment
} scf_mask;
// Protoypes:
#ifndef NDEBUG
SYMBOL SymDeAlias( // REDUCE TO NON-ALIASED SYMBOL
SYMBOL sym ) // - the symbol
;
#else
#define SymDeAlias(s) ( SymIsAlias(s) ? s->u.alias : s )
#endif
TOKEN_LOCN* LocnForClass // GET DEFINITION LOCATION, IF POSSIBLE
( TYPE cltype ) // - a type
;
SYMBOL SymAllocReturn( // ALLOCATE A RETURN SYMBOL
SCOPE scope, // - scope for symbol
TYPE type ) // - symbol's type
;
SYMBOL SymBindConstant // BIND A CONSTANT TO A SYMBOL
( SYMBOL sym // - the symbol
, signed_64 con ) // - the constant
;
boolean SymCDtorExtraParm( // does the CTOR/DTOR need the extra int arg?
SYMBOL sym ) // - the symbol
;
TYPE SymClass( // GET TYPE FOR CLASS CONTAINING A SYMBOL
SYMBOL sym ) // - the symbol
;
boolean SymClassCorrupted( // TEST IF SYMBOL'S CLASS CORRUPTED
SYMBOL sym ) // - the symbol
;
CLASSINFO *SymClassInfo( // GET CLASSINFO FOR SYMBOL
SYMBOL sym ) // - the symbol
;
SYMBOL SymConstantValue // GET CONSTANT VALUE FOR SYMBOL
( SYMBOL sym // - the symbol
, INT_CONSTANT* pval ) // - addr[ value ]
;
SYMBOL SymCreate( // CREATE NEW SYMBOL
TYPE type, // - symbol type
symbol_class id, // - symbol class
symbol_flag flags, // - symbol flags
char* name, // - symbol name
SCOPE scope ) // - scope for insertion
;
SYMBOL SymCreateAtLocn( // CREATE NEW SYMBOL AT LOCATION
TYPE type, // - symbol type
symbol_class id, // - symbol class
symbol_flag flags, // - symbol flags
char* name, // - symbol name
SCOPE scope, // - scope for insertion
TOKEN_LOCN* locn ) // - location
;
SYMBOL SymCreateCurrScope( // CREATE NEW CURR-SCOPE SYMBOL
TYPE type, // - symbol type
symbol_class id, // - symbol class
symbol_flag flags, // - symbol flags
char* name ) // - symbol name
;
SYMBOL SymCreateFileScope( // CREATE NEW FILE-SCOPE SYMBOL
TYPE type, // - symbol type
symbol_class id, // - symbol class
symbol_flag flags, // - symbol flags
char* name ) // - symbol name
;
SYMBOL SymCreateTempScope( // CREATE NEW TEMP-SCOPE SYMBOL
TYPE type, // - symbol type
symbol_class id, // - symbol class
symbol_flag flags, // - symbol flags
char* name ) // - symbol name
;
SYMBOL SymDefaultBase( // REMOVE DEFAULT ARGUMENTS TO GET BASE SYMBOL
SYMBOL sym ) // - the symbol
;
SYMBOL SymDeriveThrowBits( // DERIVE SF_.._LONGJUMP BITS FROM SOURCE
SYMBOL tgt, // - target symbol
SYMBOL src ) // - source symbol
;
SYMBOL SymForClass // GET SYMBOL FOR CLASS IF IT EXISTS
( TYPE cltype ) // - a type
;
arg_list *SymFuncArgList( // GET FUNCTION ARG. LIST
SYMBOL func ) // - a function SYMBOL
;
SYMBOL SymFunctionReturn( // GET SYMBOL FOR RETURN
void )
;
SYMBOL SymIsAnonymous( // TEST IF SYMBOL IS AN ANONYMOUS UNION MEMBER
SYMBOL sym ) // - the symbol
;
#ifdef OPT_BR
boolean SymIsBrowsable // TEST IF SYMBOL CAN BE BROWSED
( SYMBOL sym ) // - the symbol
;
#endif
boolean SymIsArgument( // TEST IF SYMBOL IS AN ARGUMENT
SYMBOL sym ) // - symbol
;
boolean SymIsAutomatic( // TEST IF SYMBOL IS AUTOMATIC VARIABLE
SYMBOL sym ) // - the symbol
;
boolean SymIsClass( // DETERMINE IF SYMBOL IS A CLASS OBJECT
SYMBOL sym ) // - the symbol
;
boolean SymIsClassArray( // DETERMINE IF SYMBOL IS ARRAY OF CLASS ITEMS
SYMBOL sym ) // - the symbol
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?