Add parsehdr to the build

As requested in #22
This commit is contained in:
nemerle 2016-05-19 19:50:47 +02:00
parent 5f68987001
commit d5985b4b97
5 changed files with 1049 additions and 1311 deletions

View File

@ -1 +1,2 @@
add_subdirectory(makedsig) add_subdirectory(makedsig)
add_subdirectory(parsehdr)

View File

@ -0,0 +1,4 @@
add_executable(parselib parsehdr.cpp)
target_link_libraries(parselib dcc_hash)
qt5_use_modules(parselib Core)

View File

@ -1,23 +1,24 @@
#pragma once
/*$Log: locident.h,v $ /*$Log: locident.h,v $
* Revision 1.6 94/02/22 15:20:23 cifuente * Revision 1.6 94/02/22 15:20:23 cifuente
* Code generation is done. * Code generation is done.
* *
* Revision 1.5 93/12/10 09:38:20 cifuente * Revision 1.5 93/12/10 09:38:20 cifuente
* New high-level types * New high-level types
* *
* Revision 1.4 93/11/10 17:30:51 cifuente * Revision 1.4 93/11/10 17:30:51 cifuente
* Procedure header, locals * Procedure header, locals
* *
* Revision 1.3 93/11/08 12:06:35 cifuente * Revision 1.3 93/11/08 12:06:35 cifuente
* du1 analysis finished. Instantiates procedure arguments for user * du1 analysis finished. Instantiates procedure arguments for user
* declared procedures. * declared procedures.
* *
* Revision 1.2 93/10/25 11:01:00 cifuente * Revision 1.2 93/10/25 11:01:00 cifuente
* New SYNTHETIC instructions for d/u analysis * New SYNTHETIC instructions for d/u analysis
* *
* Revision 1.1 93/10/11 11:47:39 cifuente * Revision 1.1 93/10/11 11:47:39 cifuente
* Initial revision * Initial revision
* *
* File: locIdent.h * File: locIdent.h
* Purpose: High-level local identifier definitions * Purpose: High-level local identifier definitions
* Date: October 1993 * Date: October 1993
@ -26,92 +27,92 @@
/* Type definition */ /* Type definition */
typedef struct { typedef struct {
Int csym; /* # symbols used */ Int csym; /* # symbols used */
Int alloc; /* # symbols allocated */ Int alloc; /* # symbols allocated */
Int *idx; /* Array of integer indexes */ Int *idx; /* Array of integer indexes */
} IDX_ARRAY; } IDX_ARRAY;
/* Type definitions used in the decompiled program */ /* Type definitions used in the decompiled program */
typedef enum { typedef enum {
TYPE_UNKNOWN = 0, /* unknown so far */ TYPE_UNKNOWN = 0, /* unknown so far */
TYPE_BYTE_SIGN, /* signed byte (8 bits) */ TYPE_BYTE_SIGN, /* signed byte (8 bits) */
TYPE_BYTE_UNSIGN, /* unsigned byte */ TYPE_BYTE_UNSIGN, /* unsigned byte */
TYPE_WORD_SIGN, /* signed word (16 bits) */ TYPE_WORD_SIGN, /* signed word (16 bits) */
TYPE_WORD_UNSIGN, /* unsigned word (16 bits) */ TYPE_WORD_UNSIGN, /* unsigned word (16 bits) */
TYPE_LONG_SIGN, /* signed long (32 bits) */ TYPE_LONG_SIGN, /* signed long (32 bits) */
TYPE_LONG_UNSIGN, /* unsigned long (32 bits) */ TYPE_LONG_UNSIGN, /* unsigned long (32 bits) */
TYPE_RECORD, /* record structure */ TYPE_RECORD, /* record structure */
TYPE_PTR, /* pointer (32 bit ptr) */ TYPE_PTR, /* pointer (32 bit ptr) */
TYPE_STR, /* string */ TYPE_STR, /* string */
TYPE_CONST, /* constant (any type) */ TYPE_CONST, /* constant (any type) */
TYPE_FLOAT, /* floating point */ TYPE_FLOAT, /* floating point */
TYPE_DOUBLE, /* double precision float */ TYPE_DOUBLE, /* double precision float */
} hlType; } hlType;
static char *hlTypes[13] = {"", "char", "unsigned char", "int", "unsigned int", static char *hlTypes[13] = {"", "char", "unsigned char", "int", "unsigned int",
"long", "unsigned long", "record", "int *", "char *", "long", "unsigned long", "record", "int *", "char *",
"", "float", "double"}; "", "float", "double"};
typedef enum { typedef enum {
STK_FRAME, /* For stack vars */ STK_FRAME, /* For stack vars */
REG_FRAME, /* For register variables */ REG_FRAME, /* For register variables */
GLB_FRAME, /* For globals */ GLB_FRAME, /* For globals */
} frameType; } frameType;
/* Enumeration to determine whether pIcode points to the high or low part /* Enumeration to determine whether pIcode points to the high or low part
* of a long number */ * of a long number */
typedef enum { typedef enum {
HIGH_FIRST, /* High value is first */ HIGH_FIRST, /* High value is first */
LOW_FIRST, /* Low value is first */ LOW_FIRST, /* Low value is first */
} hlFirst; } hlFirst;
/* LOCAL_ID */ /* LOCAL_ID */
typedef struct { typedef struct {
hlType type; /* Probable type */ hlType type; /* Probable type */
boolT illegal;/* Boolean: not a valid field any more */ boolT illegal;/* Boolean: not a valid field any more */
IDX_ARRAY idx; /* Index into icode array (REG_FRAME only) */ IDX_ARRAY idx; /* Index into icode array (REG_FRAME only) */
frameType loc; /* Frame location */ frameType loc; /* Frame location */
boolT hasMacro;/* Identifier requires a macro */ boolT hasMacro;/* Identifier requires a macro */
char macro[10];/* Macro for this identifier */ char macro[10];/* Macro for this identifier */
char name[20];/* Identifier's name */ char name[20];/* Identifier's name */
union { /* Different types of identifiers */ union { /* Different types of identifiers */
byte regi; /* For TYPE_BYTE(WORD)_(UN)SIGN registers */ byte regi; /* For TYPE_BYTE(WORD)_(UN)SIGN registers */
struct { /* For TYPE_BYTE(WORD)_(UN)SIGN on the stack */ struct { /* For TYPE_BYTE(WORD)_(UN)SIGN on the stack */
byte regOff; /* register offset (if any) */ byte regOff; /* register offset (if any) */
Int off; /* offset from BP */ Int off; /* offset from BP */
} bwId; } bwId;
struct _bwGlb { /* For TYPE_BYTE(WORD)_(UN)SIGN globals */ struct _bwGlb { /* For TYPE_BYTE(WORD)_(UN)SIGN globals */
int16 seg; /* segment value */ int16 seg; /* segment value */
int16 off; /* offset */ int16 off; /* offset */
byte regi; /* optional indexed register */ byte regi; /* optional indexed register */
} bwGlb; } bwGlb;
struct _longId{ /* For TYPE_LONG_(UN)SIGN registers */ struct _longId{ /* For TYPE_LONG_(UN)SIGN registers */
byte h; /* high register */ byte h; /* high register */
byte l; /* low register */ byte l; /* low register */
} longId; } longId;
struct _longStkId { /* For TYPE_LONG_(UN)SIGN on the stack */ struct _longStkId { /* For TYPE_LONG_(UN)SIGN on the stack */
Int offH; /* high offset from BP */ Int offH; /* high offset from BP */
Int offL; /* low offset from BP */ Int offL; /* low offset from BP */
} longStkId; } longStkId;
struct { /* For TYPE_LONG_(UN)SIGN globals */ struct { /* For TYPE_LONG_(UN)SIGN globals */
int16 seg; /* segment value */ int16 seg; /* segment value */
int16 offH; /* offset high */ int16 offH; /* offset high */
int16 offL; /* offset low */ int16 offL; /* offset low */
byte regi; /* optional indexed register */ byte regi; /* optional indexed register */
} longGlb; } longGlb;
struct { /* For TYPE_LONG_(UN)SIGN constants */ struct { /* For TYPE_LONG_(UN)SIGN constants */
dword h; /* high word */ dword h; /* high word */
dword l; /* low word */ dword l; /* low word */
} longKte; } longKte;
} id; } id;
} ID; } ID;
typedef struct { typedef struct {
Int csym; /* No. of symbols in the table */ Int csym; /* No. of symbols in the table */
Int alloc; /* No. of symbols allocated */ Int alloc; /* No. of symbols allocated */
ID *id; /* Identifier */ ID *id; /* Identifier */
} LOCAL_ID; } LOCAL_ID;

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,17 @@
#pragma once
#include "Enums.h"
/* /*
*$Log: parsehdr.h,v $ *$Log: parsehdr.h,v $
*/ */
/* Header file for parsehdr.c */ /* Header file for parsehdr.c */
typedef unsigned long dword; /* 32 bits */ typedef unsigned long dword; /* 32 bits */
typedef unsigned char byte; /* 8 bits */ typedef unsigned char byte; /* 8 bits */
typedef unsigned short word; /* 16 bits */ typedef unsigned short word; /* 16 bits */
typedef unsigned char boolT; /* 8 bits */ typedef unsigned char boolT; /* 8 bits */
#define TRUE 1
#define FALSE 0
#define BUFF_SIZE 8192 /* Holds a declaration */ #define BUFF_SIZE 8192 /* Holds a declaration */
#define FBUF_SIZE 32700 /* Holds part of a header file */ #define FBUF_SIZE 32700 /* Holds part of a header file */
#define NARGS 15 #define NARGS 15
#define NAMES_L 160 #define NAMES_L 160
@ -38,11 +37,8 @@ void phWarning(char *errmsg);
#define SYMLEN 16 /* Including the null */ #define SYMLEN 16 /* Including the null */
#define Int long /* For locident.h */ #define Int long /* For locident.h */
#define int16 short int /* For locident.h */ //#include "locident.h" /* For the hlType enum */
#include "locident.h" /* For the hlType enum */ //#define bool unsigned char /* For internal use */
#define bool unsigned char /* For internal use */
#define TRUE 1
#define FALSE 0
typedef typedef
struct ph_func_tag struct ph_func_tag