shithub: rgbds

Download patch

ref: afe33e116299979632123892f7fe0564a884ee91
parent: 618082bcabf83cbf1c46cdcf879b98fbd3f0fed9
author: Vegard Nossum <vegard.nossum@gmail.com>
date: Thu Jun 11 05:22:49 EDT 2009

link: move includes to include/link/

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>

--- /dev/null
+++ b/include/link/assign.h
@@ -1,0 +1,21 @@
+#ifndef ASMOTOR_LINK_ASSIGN_H
+#define ASMOTOR_LINK_ASSIGN_H
+
+#include "link/types.h"
+
+enum eBankDefine {
+	BANK_HOME = 0,
+	BANK_BSS = 256,
+	BANK_VRAM,
+	BANK_HRAM
+};
+
+#define MAXBANKS	259
+
+extern SLONG area_Avail(SLONG bank);
+extern void AssignSections(void);
+extern void CreateSymbolTable(void);
+extern SLONG MaxBankUsed;
+extern SLONG MaxAvail[MAXBANKS];
+
+#endif
--- /dev/null
+++ b/include/link/library.h
@@ -1,0 +1,6 @@
+#ifndef	ASMOTOR_LINK_LIBRARY_H
+#define	ASMOTOR_LINK_LIBRARY_H
+
+extern void AddNeededModules(void);
+
+#endif
--- /dev/null
+++ b/include/link/main.h
@@ -1,0 +1,19 @@
+#ifndef ASMOTOR_LINK_MAIN_H
+#define ASMOTOR_LINK_MAIN_H
+
+#include "link/types.h"
+
+extern void PrintUsage(void);
+extern void fatalerror(char *s);
+extern char temptext[1024];
+extern SLONG fillchar;
+extern char smartlinkstartsymbol[256];
+
+enum eOutputType {
+	OUTPUT_GBROM,
+	OUTPUT_PSION2
+};
+
+extern enum eOutputType outputtype;
+
+#endif
--- /dev/null
+++ b/include/link/mapfile.h
@@ -1,0 +1,11 @@
+#ifndef	ASMOTOR_LINK_MAPFILE_H
+#define	ASMOTOR_LINK_MAPFILE_H
+
+extern void SetMapfileName(char *name);
+extern void SetSymfileName(char *name);
+extern void CloseMapfile(void);
+extern void MapfileWriteSection(struct sSection *pSect);
+extern void MapfileInitBank(SLONG bank);
+extern void MapfileCloseBank(SLONG slack);
+
+#endif
--- /dev/null
+++ b/include/link/mylink.h
@@ -1,0 +1,112 @@
+#ifndef ASMOTOR_LINK_LINK_H
+#define ASMOTOR_LINK_LINK_H
+
+#if defined(AMIGA) || defined(__GNUC__)
+#define _MAX_PATH	512
+#endif
+
+#include "link/types.h"
+
+extern SLONG options;
+#define OPT_SMALL	0x01
+#define OPT_SMART_C_LINK	0x02
+
+enum eRpnData {
+	RPN_ADD = 0,
+	RPN_SUB,
+	RPN_MUL,
+	RPN_DIV,
+	RPN_MOD,
+	RPN_UNSUB,
+
+	RPN_OR,
+	RPN_AND,
+	RPN_XOR,
+	RPN_UNNOT,
+
+	RPN_LOGAND,
+	RPN_LOGOR,
+	RPN_LOGUNNOT,
+
+	RPN_LOGEQ,
+	RPN_LOGNE,
+	RPN_LOGGT,
+	RPN_LOGLT,
+	RPN_LOGGE,
+	RPN_LOGLE,
+
+	RPN_SHL,
+	RPN_SHR,
+
+	RPN_BANK,
+
+	RPN_HRAM,
+
+	RPN_PCEZP,
+
+	RPN_RANGECHECK,
+
+	RPN_CONST = 0x80,
+	RPN_SYM = 0x81
+};
+
+enum eSectionType {
+	SECT_BSS,
+	SECT_VRAM,
+	SECT_CODE,
+	SECT_HOME,
+	SECT_HRAM
+};
+
+struct sSection {
+	SLONG nBank;
+	SLONG nOrg;
+	BBOOL oAssigned;
+
+	SLONG nByteSize;
+	enum eSectionType Type;
+	UBYTE *pData;
+	SLONG nNumberOfSymbols;
+	struct sSymbol **tSymbols;
+	struct sPatch *pPatches;
+	struct sSection *pNext;
+};
+
+enum eSymbolType {
+	SYM_LOCAL,
+	SYM_IMPORT,
+	SYM_EXPORT
+};
+
+struct sSymbol {
+	char *pzName;
+	enum eSymbolType Type;
+	/* the following 3 items only valid when Type!=SYM_IMPORT */
+	SLONG nSectionID;	/* internal to object.c */
+	struct sSection *pSection;
+	SLONG nOffset;
+};
+
+enum ePatchType {
+	PATCH_BYTE = 0,
+	PATCH_WORD_L,
+	PATCH_LONG_L,
+	PATCH_WORD_B,
+	PATCH_LONG_B
+};
+
+struct sPatch {
+	char *pzFilename;
+	SLONG nLineNo;
+	SLONG nOffset;
+	enum ePatchType Type;
+	SLONG nRPNSize;
+	UBYTE *pRPN;
+	struct sPatch *pNext;
+	BBOOL oRelocPatch;
+};
+
+extern struct sSection *pSections;
+extern struct sSection *pLibSections;
+
+#endif
--- /dev/null
+++ b/include/link/object.h
@@ -1,0 +1,7 @@
+#ifndef	ASMOTOR_LINK_OBJECT_H
+#define	ASMOTOR_LINK_OBJECT_H
+
+extern void obj_Readfile(char *tzObjectfile);
+extern void lib_Readfile(char *tzLibfile);
+
+#endif
--- /dev/null
+++ b/include/link/output.h
@@ -1,0 +1,7 @@
+#ifndef	ASMOTOR_LINK_OUTPUT_H
+#define	ASMOTOR_LINK_OUTPUT_H
+
+void out_Setname(char *tzOutputfile);
+void Output(void);
+
+#endif
--- /dev/null
+++ b/include/link/patch.h
@@ -1,0 +1,9 @@
+#ifndef ASMOTOR_LINK_PATCH_H
+#define ASMOTOR_LINK_PATCH_H
+
+#include "link/types.h"
+
+void Patch(void);
+extern SLONG nPC;
+
+#endif
--- /dev/null
+++ b/include/link/symbol.h
@@ -1,0 +1,11 @@
+#ifndef ASMOTOR_LINK_SYMBOL_H
+#define ASMOTOR_LINK_SYMBOL_H
+
+#include "link/types.h"
+
+void sym_Init(void);
+void sym_CreateSymbol(char *tzName, SLONG nValue, SBYTE nBank);
+SLONG sym_GetValue(char *tzName);
+SLONG sym_GetBank(char *tzName);
+
+#endif
--- /dev/null
+++ b/include/link/types.h
@@ -1,0 +1,16 @@
+#ifndef ASMOTOR_LINK_TYPES_H
+#define ASMOTOR_LINK_TYPES_H
+
+#if defined(AMIGA) || defined(__GNUC__)
+#define	_MAX_PATH	512
+#endif
+
+typedef unsigned char UBYTE;
+typedef signed char SBYTE;
+typedef unsigned short UWORD;
+typedef signed short SWORD;
+typedef unsigned long ULONG;
+typedef signed long SLONG;
+typedef signed char BBOOL;
+
+#endif
--- a/src/link/Makefile
+++ b/src/link/Makefile
@@ -17,5 +17,5 @@
 	gcc -Wall -o $@ $^
 
 .c.o:
-	gcc -Wall -I. -I.. -Iinclude -g -c -o $@ $<
+	gcc -Wall -I. -I.. -I../../include -g -c -o $@ $<
 
--- a/src/link/assign.c
+++ b/src/link/assign.c
@@ -1,9 +1,10 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include "mylink.h"
-#include "main.h"
-#include "symbol.h"
-#include "assign.h"
+
+#include "link/mylink.h"
+#include "link/main.h"
+#include "link/symbol.h"
+#include "link/assign.h"
 
 struct sFreeArea {
 	SLONG nOrg;
--- a/src/link/include/assign.h
+++ /dev/null
@@ -1,21 +1,0 @@
-#ifndef ASSIGN_H
-#define ASSIGN_H
-
-#include "types.h"
-
-enum eBankDefine {
-	BANK_HOME = 0,
-	BANK_BSS = 256,
-	BANK_VRAM,
-	BANK_HRAM
-};
-
-#define MAXBANKS	259
-
-extern SLONG area_Avail(SLONG bank);
-extern void AssignSections(void);
-extern void CreateSymbolTable(void);
-extern SLONG MaxBankUsed;
-extern SLONG MaxAvail[MAXBANKS];
-
-#endif
--- a/src/link/include/library.h
+++ /dev/null
@@ -1,6 +1,0 @@
-#ifndef	LIBRARY_H
-#define	LIBRARY_H
-
-extern void AddNeededModules(void);
-
-#endif
--- a/src/link/include/main.h
+++ /dev/null
@@ -1,19 +1,0 @@
-#ifndef MAIN_H
-#define MAIN_H
-
-#include "types.h"
-
-extern void PrintUsage(void);
-extern void fatalerror(char *s);
-extern char temptext[1024];
-extern SLONG fillchar;
-extern char smartlinkstartsymbol[256];
-
-enum eOutputType {
-	OUTPUT_GBROM,
-	OUTPUT_PSION2
-};
-
-extern enum eOutputType outputtype;
-
-#endif
--- a/src/link/include/mapfile.h
+++ /dev/null
@@ -1,11 +1,0 @@
-#ifndef	MAPFILE_H
-#define	MAPFILE_H
-
-extern void SetMapfileName(char *name);
-extern void SetSymfileName(char *name);
-extern void CloseMapfile(void);
-extern void MapfileWriteSection(struct sSection *pSect);
-extern void MapfileInitBank(SLONG bank);
-extern void MapfileCloseBank(SLONG slack);
-
-#endif
--- a/src/link/include/mylink.h
+++ /dev/null
@@ -1,112 +1,0 @@
-#ifndef LINK_H
-#define LINK_H 1
-
-#if defined(AMIGA) || defined(__GNUC__)
-#define _MAX_PATH	512
-#endif
-
-#include "types.h"
-
-extern SLONG options;
-#define OPT_SMALL	0x01
-#define OPT_SMART_C_LINK	0x02
-
-enum eRpnData {
-	RPN_ADD = 0,
-	RPN_SUB,
-	RPN_MUL,
-	RPN_DIV,
-	RPN_MOD,
-	RPN_UNSUB,
-
-	RPN_OR,
-	RPN_AND,
-	RPN_XOR,
-	RPN_UNNOT,
-
-	RPN_LOGAND,
-	RPN_LOGOR,
-	RPN_LOGUNNOT,
-
-	RPN_LOGEQ,
-	RPN_LOGNE,
-	RPN_LOGGT,
-	RPN_LOGLT,
-	RPN_LOGGE,
-	RPN_LOGLE,
-
-	RPN_SHL,
-	RPN_SHR,
-
-	RPN_BANK,
-
-	RPN_HRAM,
-
-	RPN_PCEZP,
-
-	RPN_RANGECHECK,
-
-	RPN_CONST = 0x80,
-	RPN_SYM = 0x81
-};
-
-enum eSectionType {
-	SECT_BSS,
-	SECT_VRAM,
-	SECT_CODE,
-	SECT_HOME,
-	SECT_HRAM
-};
-
-struct sSection {
-	SLONG nBank;
-	SLONG nOrg;
-	BBOOL oAssigned;
-
-	SLONG nByteSize;
-	enum eSectionType Type;
-	UBYTE *pData;
-	SLONG nNumberOfSymbols;
-	struct sSymbol **tSymbols;
-	struct sPatch *pPatches;
-	struct sSection *pNext;
-};
-
-enum eSymbolType {
-	SYM_LOCAL,
-	SYM_IMPORT,
-	SYM_EXPORT
-};
-
-struct sSymbol {
-	char *pzName;
-	enum eSymbolType Type;
-	/* the following 3 items only valid when Type!=SYM_IMPORT */
-	SLONG nSectionID;	/* internal to object.c */
-	struct sSection *pSection;
-	SLONG nOffset;
-};
-
-enum ePatchType {
-	PATCH_BYTE = 0,
-	PATCH_WORD_L,
-	PATCH_LONG_L,
-	PATCH_WORD_B,
-	PATCH_LONG_B
-};
-
-struct sPatch {
-	char *pzFilename;
-	SLONG nLineNo;
-	SLONG nOffset;
-	enum ePatchType Type;
-	SLONG nRPNSize;
-	UBYTE *pRPN;
-	struct sPatch *pNext;
-	BBOOL oRelocPatch;
-};
-
-extern struct sSection *pSections;
-extern struct sSection *pLibSections;
-
-#endif
--- a/src/link/include/object.h
+++ /dev/null
@@ -1,7 +1,0 @@
-#ifndef	OBJECT_H
-#define	OBJECT_H
-
-extern void obj_Readfile(char *tzObjectfile);
-extern void lib_Readfile(char *tzLibfile);
-
-#endif
--- a/src/link/include/output.h
+++ /dev/null
@@ -1,7 +1,0 @@
-#ifndef	OUTPUT_H
-#define	OUTPUT_H
-
-void out_Setname(char *tzOutputfile);
-void Output(void);
-
-#endif
--- a/src/link/include/patch.h
+++ /dev/null
@@ -1,9 +1,0 @@
-#ifndef PATCH_H
-#define PATCH_H
-
-#include "types.h"
-
-void Patch(void);
-extern SLONG nPC;
-
-#endif
--- a/src/link/include/symbol.h
+++ /dev/null
@@ -1,11 +1,0 @@
-#ifndef SYMBOL_H
-#define SYMBOL_H
-
-#include "types.h"
-
-void sym_Init(void);
-void sym_CreateSymbol(char *tzName, SLONG nValue, SBYTE nBank);
-SLONG sym_GetValue(char *tzName);
-SLONG sym_GetBank(char *tzName);
-
-#endif
--- a/src/link/include/types.h
+++ /dev/null
@@ -1,16 +1,0 @@
-#ifndef TYPES_H
-#define TYPES_H 1
-
-#if	defined(AMIGA) || defined(__GNUC__)
-#define	_MAX_PATH	512
-#endif
-
-typedef unsigned char UBYTE;
-typedef signed char SBYTE;
-typedef unsigned short UWORD;
-typedef signed short SWORD;
-typedef unsigned long ULONG;
-typedef signed long SLONG;
-typedef signed char BBOOL;
-
-#endif
--- a/src/link/library.c
+++ b/src/link/library.c
@@ -1,9 +1,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "types.h"
-#include "mylink.h"
-#include "main.h"
+
+#include "link/types.h"
+#include "link/mylink.h"
+#include "link/main.h"
 
 static BBOOL symboldefined(char *name)
 {
--- a/src/link/main.c
+++ b/src/link/main.c
@@ -2,15 +2,16 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "object.h"
-#include "output.h"
-#include "assign.h"
-#include "patch.h"
 #include "asmotor.h"
-#include "mylink.h"
-#include "mapfile.h"
-#include "main.h"
-#include "library.h"
+
+#include "link/object.h"
+#include "link/output.h"
+#include "link/assign.h"
+#include "link/patch.h"
+#include "link/mylink.h"
+#include "link/mapfile.h"
+#include "link/main.h"
+#include "link/library.h"
 
 //      Quick and dirty...but it works
 #ifdef __GNUC__
--- a/src/link/mapfile.c
+++ b/src/link/mapfile.c
@@ -3,9 +3,10 @@
 #include <string.h>
 
 #include "asmotor.h"
-#include "main.h"
-#include "mylink.h"
-#include "assign.h"
+
+#include "link/main.h"
+#include "link/mylink.h"
+#include "link/assign.h"
 
 FILE *mf = NULL;
 FILE *sf = NULL;
--- a/src/link/object.c
+++ b/src/link/object.c
@@ -7,8 +7,8 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "mylink.h"
-#include "main.h"
+#include "link/mylink.h"
+#include "link/main.h"
 
 struct sSymbol **tSymbols;
 struct sSection *pSections = NULL;
--- a/src/link/output.c
+++ b/src/link/output.c
@@ -2,10 +2,10 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "mylink.h"
-#include "mapfile.h"
-#include "main.h"
-#include "assign.h"
+#include "link/mylink.h"
+#include "link/mapfile.h"
+#include "link/main.h"
+#include "link/assign.h"
 
 char tzOutname[_MAX_PATH];
 BBOOL oOutput = 0;
--- a/src/link/patch.c
+++ b/src/link/patch.c
@@ -1,9 +1,9 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "mylink.h"
-#include "symbol.h"
-#include "main.h"
+#include "link/mylink.h"
+#include "link/symbol.h"
+#include "link/main.h"
 
 struct sSection *pCurrentSection;
 SLONG rpnstack[256];
--- a/src/link/symbol.c
+++ b/src/link/symbol.c
@@ -1,9 +1,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "main.h"
-#include "patch.h"
-#include "types.h"
+
+#include "link/main.h"
+#include "link/patch.h"
+#include "link/types.h"
 
 #define HASHSIZE 73