diff options
Diffstat (limited to 'misc/pascal/include/pofflib.h')
-rw-r--r-- | misc/pascal/include/pofflib.h | 153 |
1 files changed, 75 insertions, 78 deletions
diff --git a/misc/pascal/include/pofflib.h b/misc/pascal/include/pofflib.h index ee68bfa92..44013623c 100644 --- a/misc/pascal/include/pofflib.h +++ b/misc/pascal/include/pofflib.h @@ -2,7 +2,7 @@ * pofflib.h * Interfaces to the POFF library * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -38,13 +38,10 @@ #define __POFFLIB_H /*************************************************************************** - * Compilation Switches - ***************************************************************************/ - -/*************************************************************************** * Included Files ***************************************************************************/ +#include <stdint.h> #include "keywords.h" #include "poff.h" @@ -74,7 +71,7 @@ struct poffLibSymbol_s * See the STT_ definitions in poff.h. */ - ubyte type; + uint8_t type; /* For data section symbols, the following provides the required * data space alignment for the symbol memory representation. For @@ -82,13 +79,13 @@ struct poffLibSymbol_s * definitions in poff.h */ - ubyte align; + uint8_t align; /* These flags describe the characteristics of the symbol. See the * STF_ definitions above. */ - ubyte flags; + uint8_t flags; /* name is a reference to the symbol name in the string table * section data. @@ -103,13 +100,13 @@ struct poffLibSymbol_s * valid can be used as as addend. */ - uint32 value; + uint32_t value; /* For data section symbols, this is the size of the initialized * data region associated with the symbol. */ - uint32 size; + uint32_t size; }; typedef struct poffLibSymbol_s poffLibSymbol_t; @@ -121,7 +118,7 @@ struct poffLibLineNumber_s { /* This is the source file line number */ - uint32 lineno; + uint32_t lineno; /* This is the full filename of the file containing the line number. */ @@ -131,7 +128,7 @@ struct poffLibLineNumber_s * associated with this line number. */ - uint32 offset; + uint32_t offset; }; typedef struct poffLibLineNumber_s poffLibLineNumber_t; @@ -150,29 +147,29 @@ struct poffLibDebugFuncInfo_s * point. */ - uint32 value; + uint32_t value; /* This is the size of the value returned by the function in * bytes (zero for procedures). */ - uint32 retsize; + uint32_t retsize; /* This is the number of parameters accepted by the function/ * procedure. */ - uint32 nparms; + uint32_t nparms; /* This is the beginning of a table of input parameter sizes * the actually allocate size will be nparms entries. */ - uint32 argsize[1]; + uint32_t argsize[1]; }; typedef struct poffLibDebugFuncInfo_s poffLibDebugFuncInfo_t; -#define SIZEOFDEBUFINFO(n) (sizeof(poffLibDebugFuncInfo_t) + ((n)-1)*sizeof(uint32)) +#define SIZEOFDEBUFINFO(n) (sizeof(poffLibDebugFuncInfo_t) + ((n)-1)*sizeof(uint32_t)) /*************************************************************************** * Public Variables @@ -190,57 +187,57 @@ extern void poffResetAccess(poffHandle_t handle); /* Functions to manage writing a POFF file */ -extern void poffSetFileType(poffHandle_t handle, ubyte fh_type, - uint16 nfiles, const char *name); -extern void poffSetArchitecture(poffHandle_t handle, ubyte fh_arch); -extern void poffSetEntryPoint(poffHandle_t handle, uint32 entryPoint); -extern sint32 poffFindString(poffHandle_t handle, const char *string); -extern uint32 poffAddString(poffHandle_t handle, const char *string); -extern uint32 poffAddFileName(poffHandle_t handle, const char *name); -extern void poffAddProgByte(poffHandle_t handle, ubyte progByte); +extern void poffSetFileType(poffHandle_t handle, uint8_t fh_type, + uint16_t nfiles, const char *name); +extern void poffSetArchitecture(poffHandle_t handle, uint8_t fh_arch); +extern void poffSetEntryPoint(poffHandle_t handle, uint32_t entryPoint); +extern int32_t poffFindString(poffHandle_t handle, const char *string); +extern uint32_t poffAddString(poffHandle_t handle, const char *string); +extern uint32_t poffAddFileName(poffHandle_t handle, const char *name); +extern void poffAddProgByte(poffHandle_t handle, uint8_t progByte); #if 0 /* not used */ -extern uint32 poffAddRoDataByte(poffHandle_t handle, ubyte dataByte); +extern uint32_t poffAddRoDataByte(poffHandle_t handle, uint8_t dataByte); #endif -extern uint32 poffAddRoDataString(poffHandle_t handle, - const char *string); -extern uint32 poffAddSymbol(poffHandle_t handle, - poffLibSymbol_t *symbol); -extern uint32 poffAddLineNumber(poffHandle_t handle, - uint16 lineNumber, uint16 fileNumber, - uint32 progSectionDataOffset); -extern uint32 poffAddDebugFuncInfo(poffHandle_t handle, - poffLibDebugFuncInfo_t *pContainer); -extern uint32 poffAddRelocation(poffHandle_t handle, - ubyte relocType, uint32 symIndex, - uint32 sectionDataOffset); +extern uint32_t poffAddRoDataString(poffHandle_t handle, + const char *string); +extern uint32_t poffAddSymbol(poffHandle_t handle, + poffLibSymbol_t *symbol); +extern uint32_t poffAddLineNumber(poffHandle_t handle, + uint16_t lineNumber, uint16_t fileNumber, + uint32_t progSectionDataOffset); +extern uint32_t poffAddDebugFuncInfo(poffHandle_t handle, + poffLibDebugFuncInfo_t *pContainer); +extern uint32_t poffAddRelocation(poffHandle_t handle, + uint8_t relocType, uint32_t symIndex, + uint32_t sectionDataOffset); extern void poffWriteFile(poffHandle_t handle, FILE *poffFile); /* Functions to manage reading a POFF file */ -extern uint16 poffReadFile(poffHandle_t handle, FILE *poffFile); -extern ubyte poffGetFileType(poffHandle_t handle); -extern ubyte poffGetArchitecture(poffHandle_t handle); -extern uint32 poffGetEntryPoint(poffHandle_t handle); +extern uint16_t poffReadFile(poffHandle_t handle, FILE *poffFile); +extern uint8_t poffGetFileType(poffHandle_t handle); +extern uint8_t poffGetArchitecture(poffHandle_t handle); +extern uint32_t poffGetEntryPoint(poffHandle_t handle); extern const char *poffGetFileHdrName(poffHandle_t handle); -extern uint32 poffGetRoDataSize(poffHandle_t handle); -extern sint32 poffGetFileName(poffHandle_t handle, const char **fname); +extern uint32_t poffGetRoDataSize(poffHandle_t handle); +extern int32_t poffGetFileName(poffHandle_t handle, const char **fname); extern int poffGetProgByte(poffHandle_t handle); -extern sint32 poffGetSymbol(poffHandle_t handle, - poffLibSymbol_t *symbol); -extern const char *poffGetString(poffHandle_t handle, uint32 index); -extern sint32 poffGetLineNumber(poffHandle_t handle, - poffLibLineNumber_t *lineno); -extern sint32 poffGetRawLineNumber(poffHandle_t handle, - poffLineNumber_t *lineno); -extern sint32 poffGetRawRelocation(poffHandle_t handle, - poffRelocation_t *reloc); +extern int32_t poffGetSymbol(poffHandle_t handle, + poffLibSymbol_t *symbol); +extern const char *poffGetString(poffHandle_t handle, uint32_t index); +extern int32_t poffGetLineNumber(poffHandle_t handle, + poffLibLineNumber_t *lineno); +extern int32_t poffGetRawLineNumber(poffHandle_t handle, + poffLineNumber_t *lineno); +extern int32_t poffGetRawRelocation(poffHandle_t handle, + poffRelocation_t *reloc); extern poffLibDebugFuncInfo_t *poffGetDebugFuncInfo(poffHandle_t handle); -extern poffLibDebugFuncInfo_t *poffCreateDebugInfoContainer(uint32 nparms); +extern poffLibDebugFuncInfo_t *poffCreateDebugInfoContainer(uint32_t nparms); extern void poffReleaseDebugFuncContainer(poffLibDebugFuncInfo_t *pDebugFuncInfo); extern void poffDiscardDebugFuncInfo(poffHandle_t handle); -extern sint32 poffProgTell(poffHandle_t handle); -extern int poffProgSeek(poffHandle_t handle, uint32 offset); -extern uint32 poffGetProgSize(poffHandle_t handle); +extern int32_t poffProgTell(poffHandle_t handle); +extern int poffProgSeek(poffHandle_t handle, uint32_t offset); +extern uint32_t poffGetProgSize(poffHandle_t handle); extern void poffReleaseProgData(poffHandle_t handle); /* Functions used to manage modifications to a POFF file using a @@ -250,12 +247,12 @@ extern void poffReleaseProgData(poffHandle_t handle); extern poffProgHandle_t poffCreateProgHandle(void); extern void poffDestroyProgHandle(poffProgHandle_t handle); extern void poffResetProgHandle(poffProgHandle_t handle); -extern uint16 poffAddTmpProgByte(poffProgHandle_t handle, - ubyte progByte); -extern uint16 poffWriteTmpProgBytes(ubyte *buffer, uint32 nbyte, - poffProgHandle_t handle); +extern uint16_t poffAddTmpProgByte(poffProgHandle_t handle, + uint8_t progByte); +extern uint16_t poffWriteTmpProgBytes(uint8_t *buffer, uint32_t nbyte, + poffProgHandle_t handle); extern void poffReplaceProgData(poffHandle_t handle, - poffProgHandle_t progHandle); + poffProgHandle_t progHandle); /* Functions used to manage modifications to a POFF file using a * temporary container for the new symbol data. @@ -264,23 +261,23 @@ extern void poffReplaceProgData(poffHandle_t handle, extern poffSymHandle_t poffCreateSymHandle(void); extern void poffDestroySymHandle(poffSymHandle_t handle); extern void poffResetSymHandle(poffSymHandle_t handle); -extern uint32 poffAddTmpSymbol(poffHandle_t handle, poffSymHandle_t symHandle, - poffLibSymbol_t *symbol); +extern uint32_t poffAddTmpSymbol(poffHandle_t handle, poffSymHandle_t symHandle, + poffLibSymbol_t *symbol); extern void poffReplaceSymbolTable(poffHandle_t handle, - poffSymHandle_t symHandle); + poffSymHandle_t symHandle); /* Functions used to extract/insert whole data sections from/into a POFF * file container */ -extern uint32 poffExtractProgramData(poffHandle_t handle, - ubyte **progData); +extern uint32_t poffExtractProgramData(poffHandle_t handle, + uint8_t **progData); extern void poffInsertProgramData(poffHandle_t handle, - ubyte *progData, uint32 progSize); -extern uint32 poffExtractRoData(poffHandle_t handle, - ubyte **roData); + uint8_t *progData, uint32_t progSize); +extern uint32_t poffExtractRoData(poffHandle_t handle, + uint8_t **roData); extern void poffAppendRoData(poffHandle_t handle, - ubyte *roData, uint32 roDataSize); + uint8_t *roData, uint32_t roDataSize); /* Functions to manage printing of the POFF file content */ @@ -293,23 +290,23 @@ extern void poffDumpRelocTable(poffHandle_t handle, FILE *outFile); * just store and retrieve information by label number. */ -extern void poffAddToDefinedLabelTable(uint32 label, uint32 pc); -extern void poffAddToUndefinedLabelTable(uint32 label, - uint32 symIndex); -extern int poffGetSymIndexForUndefinedLabel(uint32 label); -extern int poffGetPcForDefinedLabel(uint32 label); +extern void poffAddToDefinedLabelTable(uint32_t label, uint32_t pc); +extern void poffAddToUndefinedLabelTable(uint32_t label, + uint32_t symIndex); +extern int poffGetSymIndexForUndefinedLabel(uint32_t label); +extern int poffGetPcForDefinedLabel(uint32_t label); extern void poffReleaseLabelReferences(void); /* Helper functions for line numbers */ extern void poffReadLineNumberTable(poffHandle_t handle); -extern poffLibLineNumber_t *poffFindLineNumber(uint32 offset); +extern poffLibLineNumber_t *poffFindLineNumber(uint32_t offset); extern void poffReleaseLineNumberTable(void); /* Helper functions for debug information */ extern void poffReadDebugFuncInfoTable(poffHandle_t handle); -extern poffLibDebugFuncInfo_t *poffFindDebugFuncInfo(uint32 offset); +extern poffLibDebugFuncInfo_t *poffFindDebugFuncInfo(uint32_t offset); extern void poffReplaceDebugFuncInfo(poffHandle_t handle); extern void poffReleaseDebugFuncInfoTable(void); |