skelsym.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 491 行 · 第 1/2 页
C
491 行
/****************************************************************************
*
* 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!
*
****************************************************************************/
#include <string.h>
#include "skel.h"
/*
Stuff dealing with symbol handles.
*/
walk_result DIPENTRY DIPImpWalkSymList( imp_image_handle *ii,
symbol_source ss, void *source, IMP_SYM_WKR *wk,
imp_sym_handle *is, void *d )
{
//TODO:
/*
Walk the list of symbols. There can be a number of sources
of symbol lists. What kind you're walking is determined by the
'ss' parameter. It can take on the following values:
SS_MODULE:
The 'source' is a pointer to an imp_mod_handle. If
the *(imp_mod_handle *)source is NO_MOD, The list is
all the module scope/global symbols in the image, otherwise
it is the list of module scope/global symbols in the
indicated module.
SS_SCOPED:
The 'source' is a pointer at an address. Considering the
point of execution to be *(address *)source, the list
is all the lexically scoped symbols visible from that
point.
SS_TYPE:
The 'source' is a pointer to an imp_type_handle. If
*(imp_type_handle *)source represents an enumerated
type, the list is all the constant symbols of the
enumeration. If the type handle represents a structure
type, the list is all the field names in the structure.
When walking structures with a inherited classes, there is
a small trick. Just before starting to walk the fields
of an inherited class, the DIP should do a:
wk( ii, SWI_INHERIT_START, NULL, d )
This indicates to client that an inherited field list
is about to be started. If the client wishes the DIP to
actually walk the inherited list, it will return WR_CONTINUE.
If it wants you to skip the inherited fields it will return
WR_STOP. You should continue with the reminder of the fields
in the current structure that you're walking.
When you come to the end of the list of members for an
inherited class do a:
wk( ii, SWI_INHERIT_END, NULL, d )
SS_BLOCK:
The 'source' is a pointer to a scope_block structure.
Walk all the symbols in that lexical block _only_.
SS_SCOPESYM:
The 'source' is a pointer to an imp_sym_handle.
This is a request to walk all the symbols in the
scope identified by the imp_sym_handle. For example, if
the imp_sym_handle is of type SK_NAMESPACE, walk all the
symbols contained in that namespace.
PSEUDO-CODE:
for( each symbol in the list ) {
if( starting new inherited base class ) {
if( wk( ii, SWI_INHERIT_START, NULL, d ) != WR_CONTINUE ) {
skip it and continue with next field in current class
}
} else if( ending list of inherited base class ) {
wk( ii, SWI_INHERIT_END, NULL, d );
} else {
*is = fill in symbol handle information;
wr = wk( ii, SWI_SYMBOL, is, d );
if( wr != WR_CONTINUE ) return( wr );
}
}
*/
return( WR_CONTINUE );
}
walk_result DIPENTRY DIPImpWalkSymListEx( imp_image_handle *ii, symbol_source ss,
void *source, IMP_SYM_WKR *wk, imp_sym_handle *is,
location_context *lc, void *d )
{
/*
Just like DIPImpWalkSymList but it gets an "lc", just in case
we're debugging some wierd-ass language like javascript where
the fields of a structure can change dynamically
*/
lc=lc;
return( WR_CONTINUE );
}
imp_mod_handle DIPENTRY DIPImpSymMod( imp_image_handle *ii,
imp_sym_handle *is )
{
//TODO:
/*
Return the module that the implementation symbol handle comes from.
*/
return( NO_MOD );
}
unsigned DIPENTRY DIPImpSymName( imp_image_handle *ii,
imp_sym_handle *is, location_context *lc,
symbol_name sn, char *buff, unsigned max )
{
//TODO:
/*
Given the imp_sym_handle, copy the name of the symbol into 'buff'.
Do not copy more than 'max' - 1 characters into the buffer and
append a trailing '\0' character. Return the real length
of the symbol name (not including the trailing '\0' character) even
if you had to truncate it to fit it into the buffer. If something
went wrong and you can't get the symbol name, call DCStatus and
return zero. NOTE: the client might pass in zero for 'max'. In that
case, just return the length of the symbol name and do not attempt
to put anything into the buffer.
The 'sn' parameter indicates what type of symbol name the client
is interested in. It can have the following values:
SN_SOURCE:
The name of the symbol as it appears in the source code.
SN_OBJECT:
The name of the symbol as it appeared to the linker.
SN_DEMANGLED:
C++ names, with full typing (essentially it looks like
a function prototype). If the symbol is not a C++ symbol
(not mangled), return zero for the length.
SN_EXPRESSION:
Return whatever character string is necessary such that
when scanned in an expression, the symbol handle can
be reconstructed. Deprecated - never used.
*/
return( 0 );
}
dip_status DIPENTRY DIPImpSymType( imp_image_handle *ii,
imp_sym_handle *is, imp_type_handle *it )
{
//TODO:
/*
Get the implementation type handle for the type of the
given symbol.
*/
return( DS_FAIL );
}
dip_status DIPENTRY DIPImpSymLocation( imp_image_handle *ii,
imp_sym_handle *is, location_context *lc, location_list *ll )
{
/*
Get the location of the given symbol.
*/
return( DS_FAIL );
}
dip_status DIPENTRY DIPImpSymValue( imp_image_handle *ii,
imp_sym_handle *is, location_context *lc, void *buff )
{
//TODO:
/*
Copy the value of a constant symbol into 'buff'. You can get the
size required by doing a SymType followed by a TypeInfo.
*/
return( DS_FAIL );
}
dip_status DIPENTRY DIPImpSymInfo( imp_image_handle *ii,
imp_sym_handle *is, location_context *lc, sym_info *si )
{
//TODO:
/*
Get some generic information about a symbol.
*/
memset( si, 0, sizeof( *si ) );
return( DS_FAIL );
}
dip_status DIPENTRY DIPImpSymParmLocation( imp_image_handle *ii,
imp_sym_handle *is, location_context *lc,
location_list *ll, unsigned n )
{
//TODO:
/*
Get information about where a routine's parameters/return value
are located.
If the 'n' parameter is zero, fill in the location list structure
pointed at by 'll' with the information on the location of the
function's return value. Otherwise fill it in with the location
of the n'th parameter.
*/
return( DS_FAIL );
}
dip_status DIPENTRY DIPImpSymObjType( imp_image_handle *ii,
imp_sym_handle *is, imp_type_handle *it, type_info *ti )
{
//TODO:
/*
Fill in the imp_type_handle with the type of the 'this' object
for a C++ member function.
If 'ti' is not NULL, fill in the type_info with the kind of 'this'
pointer that the routine is expecting (near/far, 16/32). If the
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?