directiv.h

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

H
441
字号
    char                parmcount;
} asmlines;

typedef struct  fname_list {
        struct  fname_list *next;
        time_t  mtime;
        char    *name;
        char    *fullname;
} FNAME;

typedef struct {
    parm_list           *parmlist;  // list of parameters
    asmlines            *data;      // the guts of the macro - LL of strings
    const FNAME         *srcfile;
    char                hidden;     // if TRUE don't print error messages
} macro_info;

typedef struct {
    direct_idx          idx;                // lname index
} lname_info;

typedef struct field_list {
    struct field_list   *next;
    char                *initializer;
    char                *value;
} field_list;

typedef struct {
    unsigned short      size;       // size in bytes ( including alignment )
    unsigned short      alignment;
    field_list          *head;
    field_list          *tail;
} struct_info;

union entry {
    seg_info            *seginfo;       // info about segment definition
    grp_info            *grpinfo;       // info about group definition
    ext_info            *extinfo;       // info about external definition
    const_info          *constinfo;     // info about symbolic integer constants
    proc_info           *procinfo;
    macro_info          *macroinfo;
    lname_info          *lnameinfo;
    struct_info         *structinfo;
    comm_info           *comminfo;
};

typedef struct dir_node {
    struct asm_sym      sym;
    union entry         e;
    unsigned long       line_num;     // line number of the directive in source file
    struct dir_node     *next, *prev; // linked list of this type of symbol
} dir_node;         // List of grpdef, segdef, pubdef, externdef, included lib
                    // and symbolic integer constants.

typedef struct {
    dir_node            *head;
    dir_node            *tail;
} symbol_queue;     // tables array - queues of symbols of 1 type ie: segments
                    // the data are actually part of the symbol table

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

/* global structure */

typedef struct a_definition_struct {
    unsigned short      struct_depth;
    stacknode           *struct_stack;      // stack of nested structs being defined
    dir_node            *curr_struct;
} a_definition_struct;

extern a_definition_struct      Definition;
extern uint                     LnamesIdx;      // Number of LNAMES definition

typedef struct {
    dist_type           distance;        // stack distance;
    mod_type            model;           // memory model;
    lang_type           langtype;        // language;
    os_type             ostype;          // operating system;
    unsigned            use32:1;         // If 32-bit segment is used
    unsigned            init:1;
    unsigned            cmdline:1;
    unsigned            defUse32:1;      // default segment size 32-bit
    unsigned            mseg:1;          // mixed segments (16/32-bit)
    unsigned            flat_idx;        // index of FLAT group
    char                name[_MAX_FNAME];// name of module
    const FNAME         *srcfile;
} module_info;                           // Information about the module

enum assume_reg {
    ASSUME_DS=0,
    ASSUME_ES,
    ASSUME_SS,
    ASSUME_FS,
    ASSUME_GS,
    ASSUME_CS,
    ASSUME_ERROR,
    ASSUME_NOTHING
};

#define ASSUME_FIRST    ASSUME_DS
#define ASSUME_LAST     ASSUME_ERROR

extern module_info      ModuleInfo;

#define IS_PROC_FAR()   ( ModuleInfo.model > MOD_FLAT )

extern seg_list         *CurrSeg;       // points to stack of opened segments

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

extern dir_node         *dir_insert( const char *, int );
extern void             dir_change( dir_node *, int );

extern void             IdxInit( void );
/* Initialize all the index variables */

extern direct_idx       GetLnameIdx( char * );

extern direct_idx       LnameInsert( char * );  // Insert a lname
extern uint_32          GetCurrAddr( void );    // Get offset from current segment

extern dir_node         *GetCurrSeg( void );
/* Get current segment; NULL means none */

extern uint             GetGrpIdx( struct asm_sym * );
/* get symbol's group index, from the symbol itself or from the symbol's segment */

extern uint             GetSegIdx( struct asm_sym * );
/* get symbol's segment index, from the symbol itself */

extern uint             GetExtIdx( struct asm_sym * );
/* Get the index of an extrn defn */

extern int              GlobalDef( int );       // define an global symbol
extern int              ExtDef( int );          // define an external symbol
extern int              CommDef( int );         // define an communal symbol
extern struct asm_sym   *MakeExtern( char *name, memtype type, bool already_defd );
extern int              PubDef( int );          // define a public symbol
extern int              GrpDef( int );          // define a group
extern int              SegDef( int );          // open or close a segment
extern int              SetCurrSeg( int );      // open or close a segment in
                                                // the second pass
extern int              ProcDef( int );         // define a procedure
extern int              LocalDef( int );        // define local variables to procedure
extern int              ProcEnd( int );         // end a procedure
extern int              Ret( int, int, int );   // emit return statement from procedure
extern int              WritePrologue( void );  // emit prologue statement after the
                                                // declaration of a procedure
extern int              MacroDef( int, bool );  // define a macro
extern int              MacroEnd( bool );       // end a macro
extern int              Startup( int );         // handle .startup & .exit
extern int              SimSeg( int );          // handle simplified segment
extern int              Include( int );         // handle an INCLUDE statement
extern int              IncludeLib( int );      // handle an INCLUDELIB statement
extern int              Model( int );           // handle .MODEL statement

extern void             ModuleInit( void );
/* Initializes the information about the module, which are contained in
   ModuleInfo */

extern int              ModuleEnd( int );       // handle END statement

extern uint_32          GetCurrSegStart(void);
/* Get offset of segment at the start of current LEDATA record */

#define GetSeg( x )     (dir_node *)x->segment

#define SEGISCODE( x )  ( x->seg->e.seginfo->iscode == SEGTYPE_ISCODE )

extern struct asm_sym   *GetGrp( struct asm_sym * );

extern void             AssumeInit( void );     // init all assumed-register table
extern int              SetAssume( int );       // Assume a register

extern enum assume_reg  GetAssume( struct asm_sym*, enum assume_reg );
/* Return the assumed register of the symbol, and determine the frame and
   frame_datum of its fixup */

extern enum assume_reg  GetPrefixAssume( struct asm_sym*, enum assume_reg );
/* Determine the frame and frame_datum of a symbol with a register prefix */

extern int              FixOverride( int );
/* Get the correct frame and frame_datum for a label when there is a segment
   or group override. */

extern void             GetSymInfo( struct asm_sym * );
/* Store location information about a symbol */
extern int              NameDirective( int );

extern int              Comment( int, int ); /* handle COMMENT directives */

extern int              AddAlias( int );
extern void             FreeInfo( dir_node * );
extern void             push( void **stack, void *elt );
extern void             *pop( void **stack );
extern uint_32          GetCurrSegAlign( void );
extern void             wipe_space( char *token );
extern int              SetUse32Def( bool );

/*---------------------------------------------------------------------------
 *   included from write.c
 *---------------------------------------------------------------------------*/

extern dir_node         *CurrProc;      // current procedure
extern unsigned long    LineNumber;
extern int_8            PhaseError;

extern void             FlushCurrSeg( void );
extern const FNAME      *AddFlist( char const *filename );
extern void             OutSelect( bool );
extern void             WriteObjModule( void );

/*---------------------------------------------------------------------------
 *   included from asmline.c
 *---------------------------------------------------------------------------*/

extern const FNAME      *get_curr_srcfile( void );

#endif

⌨️ 快捷键说明

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