directiv.h

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 441 行 · 第 1/2 页

H
441
字号
/****************************************************************************
*
*                            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:  directives declarations
*
****************************************************************************/


#ifndef _DIRECTIV_H_
#define _DIRECTIV_H_

#include "objrec.h"

#define MAX_LNAME       255
#define LNAME_NULL      0

typedef int     direct_idx;     // directive index, such as segment index,
                                // group index or lname index, etc.

/* Paul Edwards
   Note that there is code that is dependent on the ordering
   of these model types. */
typedef enum {
    MOD_NONE,
    MOD_TINY,
    MOD_SMALL,
    MOD_COMPACT,
    MOD_FLAT,
    MOD_MEDIUM,
    MOD_LARGE,
    MOD_HUGE,
} mod_type;             // Memory model type

typedef enum {
    STACK_NONE,
    STACK_NEAR,
    STACK_FAR,
} dist_type;            // Stack distance
#define NUM_STACKTYPE 3

typedef enum {
    VIS_PRIVATE,
    VIS_PUBLIC,
    VIS_EXPORT,
} vis_type;             // Type of visibility for procedure

typedef enum {
    LANG_NONE,
    LANG_BASIC,
    LANG_FORTRAN,
    LANG_PASCAL,
    LANG_C,
    LANG_WATCOM_C,
    LANG_STDCALL,
    LANG_SYSCALL
} lang_type;            // Type of language specified in procedure defn

typedef enum {
    OPSYS_DOS,
    OPSYS_OS2
} os_type;              // Type of operating system
#define NUM_OS 2

enum {
    TAB_FIRST = 0,
    TAB_SEG = TAB_FIRST,  // order seg, grp, lname is important
    TAB_GRP,
    TAB_PUB,
    TAB_LIB,
    TAB_EXT,
    TAB_CONST,
    TAB_PROC,
    TAB_MACRO,
    TAB_LNAME,
    TAB_CLASS_LNAME,
    TAB_STRUCT,
    TAB_GLOBAL,
    TAB_LAST,
    TAB_COMM             // TAB_COMM is not included in tables, it is assigned to TAB_EXT
};                       // tables for definitions

enum {
    QUERY_COMMENT,
    QUERY_COMMENT_DELIM,
    START_COMMENT,
    END_COMMENT
};                      // parms to Comment

enum irp_type {
    IRP_CHAR,
    IRP_WORD,
    IRP_REPEAT
};

typedef enum {
    SEGTYPE_UNDEF = -1,
    SEGTYPE_ISDATA,
    SEGTYPE_ISCODE
} seg_type;

/*---------------------------------------------------------------------------*/

typedef struct stacknode {
    void    *next;
    void    *elt;
} stacknode;

/*---------------------------------------------------------------------------*/
/* Structures for grpdef, segdef, externdef, pubdef, included library,       */
/* procedure and symbolic integer constants.                                 */
/*---------------------------------------------------------------------------*/

typedef struct seg_list {
    struct seg_list     *next;
    struct dir_node     *seg;
} seg_list;

typedef struct {
    direct_idx          idx;            // its group index
    seg_list            *seglist;       // list of segments in the group
    uint                numseg;         // number of segments in the group
    direct_idx          lname_idx;
} grp_info;

typedef struct {
    obj_rec             *segrec;
    struct asm_sym      *group;         // its group
    uint_32             start_loc;      // starting offset of current ledata or lidata
    unsigned            readonly:1;     // if the segment is readonly
    unsigned            ignore:1;       // ignore this if the seg is redefined
    seg_type            iscode;         // segment is belonging to "CODE" or 'DATA' class
    direct_idx          lname_idx;
    uint_32             current_loc;    // current offset in current ledata or lidata
} seg_info;

typedef struct {
    uint                idx;            // external definition index
    unsigned            use32:1;
    unsigned            comm:1;
} ext_info;

typedef struct {
    uint                idx;            // external definition index
    unsigned            use32:1;
    unsigned            comm:1;
    unsigned long       size;
    uint                distance;
} comm_info;

typedef struct {
//    char              *string;        // string assigned to the symbol
    unsigned            redefine:1;     // whether it is redefinable or not
    unsigned            expand_early:1; // if TRUE expand before parsing
    int                 count;          // number of tokens
    struct asm_tok      *data;          // array of asm_tok's to replace symbol
} const_info;

typedef struct regs_list {
    struct regs_list    *next;
    char                *reg;
} regs_list;

typedef struct label_list {
    struct label_list   *next;
    char                *label;         // name of parameter
    char                *replace;       // string that replaces the label
    int                 size;           // size of parameter
    int                 factor;         // for local var only
    union {
        unsigned        is_vararg:1;    // if it is a vararg
        int             count;          // number of element in this label
    };
} label_list;

typedef struct {
    regs_list           *regslist;      // list of registers to be saved
    vis_type            visibility;     // PUBLIC, PRIVATE or EXPORT
    lang_type           langtype;       // language type
    label_list          *paralist;      // list of parameters
    label_list          *locallist;     // list of local variables
    int                 parasize;       // total no. of bytes used by parameters
    int                 localsize;      // total no. of bytes used by local variables
    memtype             mem_type;       // distance of procedure: near or far
    unsigned            is_vararg:1;    // if it has a vararg
    unsigned            pe_type:1;      // prolog/epilog code type 0:8086/186 1:286 and above
} proc_info;

typedef struct parm_list {
    struct parm_list    *next;
    char                *label;         // name of parameter
    char                *replace;       // string that replaces the label
    char                required;       // is parm required ( T/F )
    char                *def;           // is there a default parm?
} parm_list;

typedef struct asmlines {
    struct asmlines     *next;
    char                *line;

⌨️ 快捷键说明

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