shithub: rgbds

Download patch

ref: d7319ecd0020ff6b494578c2f81b2f37cbd7af89
parent: d661b3a5329756fe334548bf8b23d65bd67de4be
author: Anthony J. Bentley <[email protected]>
date: Tue Sep 23 23:03:42 EDT 2014

Remove rgblib.

I have never used it and it's probably been broken for years.

--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,5 @@
-rgbasm, rgblink, and rgblib are derived from Justin Lloyd's RGBDS, which
-is released under the following license:
+rgbasm, and rgblink are derived from Justin Lloyd's RGBDS, which is
+released under the following license:
 
                       DO WHATEVER PUBLIC LICENSE*
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
--- a/Makefile
+++ b/Makefile
@@ -27,11 +27,6 @@
 	src/extern/strlcpy.o \
 	src/extern/strlcat.o
 
-rgblib_obj := \
-	src/lib/library.o \
-	src/lib/main.o \
-	src/extern/err.o
-
 rgblink_obj := \
 	src/link/assign.o \
 	src/link/library.o \
@@ -47,12 +42,11 @@
 	src/fix/main.o \
 	src/extern/err.o
 
-all: rgbasm rgblib rgblink rgbfix
+all: rgbasm rgblink rgbfix
 
 clean:
 	$Qrm -rf rgbds.html
 	$Qrm -rf rgbasm rgbasm.exe ${rgbasm_obj} rgbasm.html
-	$Qrm -rf rgblib rgblib.exe ${rgblib_obj} rgblib.html
 	$Qrm -rf rgblink rgblink.exe ${rgblink_obj} rgblink.html
 	$Qrm -rf rgbfix rgbfix.exe ${rgbfix_obj} rgbfix.html
 	$Qrm -rf src/asm/asmy.c src/asm/asmy.h src/asm/asmy.y
@@ -61,7 +55,6 @@
 	$Qinstall -s -m 555 rgbasm ${BINPREFIX}/rgbasm
 	$Qinstall -s -m 555 rgbfix ${BINPREFIX}/rgbfix
 	$Qinstall -s -m 555 rgblink ${BINPREFIX}/rgblink
-	$Qinstall -s -m 555 rgblib ${BINPREFIX}/rgblib
 	$Qinstall -m 444 src/rgbds.7 ${MANPREFIX}/man7/rgbds.7 || \
 		(echo Installing manpages to ${MANPREFIX} failed. >&2 && \
 		 echo Check where your manpages are installed and set the \
@@ -74,15 +67,10 @@
 		${MANPREFIX}/man1/rgbfix.1
 	$Qinstall -m 444 src/link/rgblink.1 \
 		${MANPREFIX}/man1/rgblink.1
-	$Qinstall -m 444 src/lib/rgblib.1 \
-		${MANPREFIX}/man1/rgblib.1
 
 rgbasm: ${rgbasm_obj}
 	$Q${CC} ${REALCFLAGS} -o $@ ${rgbasm_obj} -lm
 
-rgblib: ${rgblib_obj}
-	$Q${CC} ${REALCFLAGS} -o $@ ${rgblib_obj}
-
 rgblink: ${rgblink_obj}
 	$Q${CC} ${REALCFLAGS} -o $@ ${rgblink_obj}
 
@@ -107,7 +95,6 @@
 	$Qenv PATH=/usr/local/mingw32/bin:/bin:/usr/bin:/usr/local/bin \
 		make CC=gcc CFLAGS="-I/usr/local/mingw32/include ${CFLAGS}"
 	$Qmv rgbasm rgbasm.exe
-	$Qmv rgblib rgblib.exe
 	$Qmv rgblink rgblink.exe
 	$Qmv rgbfix rgbfix.exe
 
@@ -122,8 +109,6 @@
 		rgbasm.html
 	$Qmandoc ${MANDOC} src/fix/rgbfix.1 | sed s/OpenBSD/General/ > \
 		rgbfix.html
-	$Qmandoc ${MANDOC} src/lib/rgblib.1 | sed s/OpenBSD/General/ > \
-		rgblib.html
 	$Qmandoc ${MANDOC} src/link/rgblink.1 | sed s/OpenBSD/General/ > \
 		rgblink.html
 
--- a/README
+++ b/README
@@ -7,7 +7,6 @@
 
   - rgbasm  (assembler)
   - rgblink (linker)
-  - rgblib  (library manager)
   - rgbfix  (checksum/header fixer)
 
 rgbds-linux is a fork of the original RGBDS which aims to make the programs
--- a/doc/index.htm
+++ b/doc/index.htm
@@ -12,7 +12,6 @@
 	<li><a href="geninfo.htm">ASMotor General Information</a>
 	<li><a href="asm.htm">xASM Documentation</a>
 	<li><a href="link.htm">xLink Documentation</a>
-	<li><a href="lib.htm">xLib Documentation</a>
 	<li><a href="fix.htm">RGBFix Documentation</a>
 	<li><a href="rgb0.htm">The RGB0-2 ObjectFileFormat</a>
 </ul>
--- a/doc/lib.htm
+++ /dev/null
@@ -1,47 +1,0 @@
-<!DOCTYPE HTML PUBliC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
-	<title>xLib</title>
-        <link rel="stylesheet" type="text/css" href="./style.css">
-</head>
-<body>
-<h1>xLib Documentation</h1>
-<h2>Table of Contents</h2>
-<ul>
-<li><a href="#history"> History</A>
-<li><a href="#usage"> Usage</A>
-<li><a href="#commands"> The commands</A>
-</ul>
-<hr>
-<h2 id="history">History</h2>
-<table>
-	<caption>The history of xLib</caption>
-<thead>
-<tr>
-	<th scope="col">Version</th>
-	<th scope="col">Dated</th>
-	<th scope="col">Release notes</th>
-</tr>
-</thead>
-<tr>
-	<td>1.0</td>
-	<td>21 Sep. 1997</td>
-	<td>First release</td>
-</tr>
-</table>
-<h2 id="usage">Usage</h2>
-<pre>    xlib library command [module1 module2 ... modulen]</pre>
-<h2 id="commands">The Commands</h2>
-<p>The <b>command</b> specified after <b>library</b> on the <a href="#Usage">commandline</a> tells xLib what to do.
-<p>The following commands are available:
-<ul>
-	<li>a — Adds (or replaces if already present) the modules to the library
-	<li>d — Deletes the modules specified from the library
-	<li>l — Lists the library contents
-	<li>x — Extracts the modules from the library
-</ul>
-<hr>
-<p>Last updated 21 September 1997 by <a href="mailto:[email protected]">Carsten Sorensen</a></p>
-</body>
-</html>
--- a/include/lib/library.h
+++ /dev/null
@@ -1,13 +1,0 @@
-#ifndef ASMOTOR_LIB_LIBRARY_H
-#define ASMOTOR_LIB_LIBRARY_H
-
-#include "lib/libwrap.h"
-
-extern sLibrary *lib_Read(char *filename);
-extern BBOOL lib_Write(sLibrary * lib, char *filename);
-extern sLibrary *lib_AddReplace(sLibrary * lib, char *filename);
-extern void lib_Free(sLibrary * lib);
-extern sLibrary *lib_DeleteModule(sLibrary * lib, char *filename);
-extern sLibrary *lib_Find(sLibrary * lib, char *filename);
-
-#endif
--- a/include/lib/libwrap.h
+++ /dev/null
@@ -1,19 +1,0 @@
-#ifndef ASMOTOR_LIB_LIBWRAP_H
-#define ASMOTOR_LIB_LIBWRAP_H
-
-#include "lib/types.h"
-
-#define MAXNAMELENGTH	256
-
-struct LibraryWrapper {
-	char tName[MAXNAMELENGTH];
-	UWORD uwTime;
-	UWORD uwDate;
-	SLONG nByteLength;
-	UBYTE *pData;
-	struct LibraryWrapper *pNext;
-};
-
-typedef struct LibraryWrapper sLibrary;
-
-#endif
--- a/include/lib/types.h
+++ /dev/null
@@ -1,14 +1,0 @@
-#ifndef ASMOTOR_LIB_TYPES_H
-#define ASMOTOR_LIB_TYPES_H
-
-#define	_MAX_PATH	512
-
-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/include/link/object.h
+++ b/include/link/object.h
@@ -2,6 +2,5 @@
 #define	ASMOTOR_LINK_OBJECT_H
 
 extern void obj_Readfile(char *tzObjectfile);
-extern void lib_Readfile(char *tzLibfile);
 
 #endif
--- a/src/asm/rgbasm.1
+++ b/src/asm/rgbasm.1
@@ -60,7 +60,6 @@
 .Sh SEE ALSO
 .Xr rgbds 7 ,
 .Xr rgbfix 1 ,
-.Xr rgblib 1 ,
 .Xr rgblink 1 ,
 .Xr gbz80 7
 .Sh HISTORY
--- a/src/fix/rgbfix.1
+++ b/src/fix/rgbfix.1
@@ -130,7 +130,6 @@
 .Sh SEE ALSO
 .Xr rgbds 7 ,
 .Xr rgbasm 1 ,
-.Xr rgblib 1 ,
 .Xr rgblink 1 ,
 .Xr gbz80 7
 .Sh HISTORY
--- a/src/lib/library.c
+++ /dev/null
@@ -1,295 +1,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "lib/types.h"
-#include "lib/libwrap.h"
-
-SLONG 
-file_Length(FILE * f)
-{
-	ULONG r, p;
-
-	p = ftell(f);
-	fseek(f, 0, SEEK_END);
-	r = ftell(f);
-	fseek(f, p, SEEK_SET);
-
-	return (r);
-}
-
-SLONG 
-file_ReadASCIIz(char *b, FILE * f)
-{
-	SLONG r = 0;
-
-	while ((*b++ = fgetc(f)) != 0)
-		r += 1;
-
-	return (r + 1);
-}
-
-void 
-file_WriteASCIIz(char *b, FILE * f)
-{
-	while (*b)
-		fputc(*b++, f);
-
-	fputc(0, f);
-}
-
-UWORD 
-file_ReadWord(FILE * f)
-{
-	UWORD r;
-
-	r = fgetc(f);
-	r |= fgetc(f) << 8;
-
-	return (r);
-}
-
-void 
-file_WriteWord(UWORD w, FILE * f)
-{
-	fputc(w, f);
-	fputc(w >> 8, f);
-}
-
-ULONG 
-file_ReadLong(FILE * f)
-{
-	ULONG r;
-
-	r = fgetc(f);
-	r |= fgetc(f) << 8;
-	r |= fgetc(f) << 16;
-	r |= fgetc(f) << 24;
-
-	return (r);
-}
-
-void 
-file_WriteLong(UWORD w, FILE * f)
-{
-	fputc(w, f);
-	fputc(w >> 8, f);
-	fputc(w >> 16, f);
-	fputc(w >> 24, f);
-}
-
-sLibrary *
-lib_ReadLib0(FILE * f, SLONG size)
-{
-	if (size) {
-		sLibrary *l = NULL, *first = NULL;
-
-		while (size > 0) {
-			if (l == NULL) {
-				l = malloc(sizeof *l);
-				if (!l) {
-					err(1, NULL);
-				}
-
-				first = l;
-			} else {
-				l->pNext = malloc(sizeof *l->pNext);
-				if (!l->pNext) {
-					err(1, NULL);
-				}
-
-				l = l->pNext;
-			}
-
-			size -= file_ReadASCIIz(l->tName, f);
-			l->uwTime = file_ReadWord(f);
-			size -= 2;
-			l->uwDate = file_ReadWord(f);
-			size -= 2;
-			l->nByteLength = file_ReadLong(f);
-			size -= 4;
-			if ((l->pData = malloc(l->nByteLength))) {
-				fread(l->pData, sizeof(UBYTE), l->nByteLength,
-				    f);
-				size -= l->nByteLength;
-			} else {
-				err(1, NULL);
-			}
-
-			l->pNext = NULL;
-		}
-		return (first);
-	}
-	return (NULL);
-}
-
-sLibrary *
-lib_Read(char *filename)
-{
-	FILE *f;
-
-	if ((f = fopen(filename, "rb"))) {
-		SLONG size;
-		char ID[5];
-
-		size = file_Length(f);
-		if (size == 0) {
-			fclose(f);
-			return (NULL);
-		}
-		fread(ID, sizeof(char), 4, f);
-		ID[4] = 0;
-		size -= 4;
-
-		if (strcmp(ID, "XLB0") == 0) {
-			sLibrary *r;
-
-			r = lib_ReadLib0(f, size);
-			fclose(f);
-			printf("Library '%s' opened\n", filename);
-			return (r);
-		} else {
-			fclose(f);
-			errx(1, "Not a valid xLib library");
-		}
-	} else {
-		printf
-		    ("Library '%s' not found, it will be created if necessary\n",
-		    filename);
-		return (NULL);
-	}
-}
-
-BBOOL 
-lib_Write(sLibrary * lib, char *filename)
-{
-	FILE *f;
-
-	if ((f = fopen(filename, "wb"))) {
-		fwrite("XLB0", sizeof(char), 4, f);
-		while (lib) {
-			file_WriteASCIIz(lib->tName, f);
-			file_WriteWord(lib->uwTime, f);
-			file_WriteWord(lib->uwDate, f);
-			file_WriteLong(lib->nByteLength, f);
-			fwrite(lib->pData, sizeof(UBYTE), lib->nByteLength, f);
-			lib = lib->pNext;
-		}
-
-		fclose(f);
-		printf("Library '%s' closed\n", filename);
-		return (1);
-	}
-	return (0);
-}
-
-sLibrary *
-lib_Find(sLibrary * lib, char *filename)
-{
-	if (strlen(filename) >= MAXNAMELENGTH) {
-		errx(1, "Module name too long: %s", filename);
-	}
-
-	while (lib) {
-		if (strcmp(lib->tName, filename) == 0)
-			break;
-
-		lib = lib->pNext;
-	}
-
-	return (lib);
-}
-
-sLibrary *
-lib_AddReplace(sLibrary * lib, char *filename)
-{
-	FILE *f;
-
-	if ((f = fopen(filename, "rb"))) {
-		sLibrary *module;
-
-		if (strlen(filename) >= MAXNAMELENGTH) {
-			errx(1, "Module name too long: %s\n", filename);
-		}
-
-		if ((module = lib_Find(lib, filename)) == NULL) {
-			module = malloc(sizeof *module);
-			if (!module) {
-				err(1, NULL);
-			}
-
-			module->pNext = lib;
-			lib = module;
-		} else {
-			/* Module already exists */
-			free(module->pData);
-		}
-
-		module->nByteLength = file_Length(f);
-		strcpy(module->tName, filename);
-		module->pData = malloc(module->nByteLength);
-		if (!module->pData) {
-			err(1, NULL);
-		}
-
-		fread(module->pData, sizeof(UBYTE), module->nByteLength, f);
-
-		printf("Added module '%s'\n", filename);
-
-		fclose(f);
-	}
-	return (lib);
-}
-
-sLibrary *
-lib_DeleteModule(sLibrary * lib, char *filename)
-{
-	sLibrary **pp, **first;
-	BBOOL found = 0;
-
-	pp = &lib;
-	first = pp;
-
-	if (strlen(filename) >= MAXNAMELENGTH) {
-		errx(1, "Module name too long: %s\n", filename);
-	}
-
-	while ((*pp) && (!found)) {
-		if (strcmp((*pp)->tName, filename) == 0) {
-			sLibrary *t;
-
-			t = *pp;
-
-			if (t->pData)
-				free(t->pData);
-
-			*pp = t->pNext;
-
-			free(t);
-			found = 1;
-		}
-		pp = &((*pp)->pNext);
-	}
-
-	if (!found) {
-		errx(1, "Module not found\n");
-	} else
-		printf("Module '%s' deleted from library\n", filename);
-
-	return (*first);
-}
-
-void 
-lib_Free(sLibrary * lib)
-{
-	while (lib) {
-		sLibrary *l;
-
-		if (lib->pData)
-			free(lib->pData);
-
-		l = lib;
-		lib = lib->pNext;
-		free(l);
-	}
-}
--- a/src/lib/main.c
+++ /dev/null
@@ -1,116 +1,0 @@
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "asmotor.h"
-
-#include "extern/err.h"
-#include "lib/types.h"
-#include "lib/library.h"
-
-/*
- * Print the usagescreen
- *
- */
-
-static void 
-usage(void)
-{
-	printf("RGBLib v" LIB_VERSION " (part of ASMotor " ASMOTOR_VERSION ")\n\n");
-	printf("usage: rgblib file [add | delete | extract | list] [module ...]\n");
-	exit(1);
-}
-/*
- * The main routine
- *
- */
-
-int 
-main(int argc, char *argv[])
-{
-	SLONG argn = 0;
-	char *libname;
-
-	argc -= 1;
-	argn += 1;
-
-	if (argc >= 2) {
-		sLibrary *lib;
-
-		lib = lib_Read(libname = argv[argn++]);
-		argc -= 1;
-
-		if (strcmp(argv[argn], "add") == 0) {
-			argn += 1;
-			argc -= 1;
-
-			while (argc) {
-				lib = lib_AddReplace(lib, argv[argn++]);
-				argc -= 1;
-			}
-			lib_Write(lib, libname);
-			lib_Free(lib);
-		} else if (strcmp(argv[argn], "delete") == 0) {
-			argn += 1;
-			argc -= 1;
-
-			while (argc) {
-				lib =
-				    lib_DeleteModule(lib, argv[argn++]);
-				argc -= 1;
-			}
-			lib_Write(lib, libname);
-			lib_Free(lib);
-		} else if (strcmp(argv[argn], "extract") == 0) {
-			argn += 1;
-			argc -= 1;
-
-			while (argc) {
-				sLibrary *l;
-
-				l = lib_Find(lib, argv[argn]);
-				if (l) {
-					FILE *f;
-
-					if ((f = fopen(argv[argn], "wb"))) {
-						fwrite(l->pData,
-						    sizeof(UBYTE),
-						    l->nByteLength,
-						    f);
-						fclose(f);
-						printf
-						    ("Extracted module '%s'\n",
-						    argv[argn]);
-					} else {
-						err(1,
-						    "Unable to write module '%s'", argv[argn]);
-					}
-				} else {
-					fprintf(stderr, "Module not found\n");
-					exit(1);
-				}
-
-				argn += 1;
-				argc -= 1;
-			}
-			lib_Free(lib);
-		} else if (strcmp(argv[argn], "list") == 0) {
-			sLibrary *l;
-
-			l = lib;
-
-			while (l) {
-				printf("%10ld %s\n",
-				    l->nByteLength,
-				    l->tName);
-				l = l->pNext;
-			}
-		} else
-			usage();
-	} else
-		usage();
-
-	return (0);
-}
--- a/src/lib/rgblib.1
+++ /dev/null
@@ -1,36 +1,0 @@
-.Dd $Mdocdate$
-.Dt RGBLIB 1
-.Os RGBDS Manual
-.Sh NAME
-.Nm rgblib
-.Nd Game Boy library manager
-.Sh SYNOPSIS
-.Nm rgblib
-.Ar library
-.Op add | delete | extract | list
-.Ar module ...
-.Sh DESCRIPTION
-The
-.Nm
-program manages libraries for use with
-.Xr rgblink 1 .
-.Bl -tag -width Ds
-.It add
-Add the given modules to the library.
-.It delete
-Delete the given modules from the library.
-.It extract
-Extract the given modules from the library.
-.It list
-List all the modules in the library.
-.El
-.Sh SEE ALSO
-.Xr rgbds 7 ,
-.Xr rgbasm 1 ,
-.Xr rgbfix 1 ,
-.Xr rgblink 1 ,
-.Xr gbz80 7
-.Sh HISTORY
-.Nm
-was originally released by Carsten S\(/orensen as part of the ASMotor package,
-and was later packaged in RGBDS by Justin Lloyd.
--- a/src/link/main.c
+++ b/src/link/main.c
@@ -37,7 +37,7 @@
 {
 	printf("RGBLink v" LINK_VERSION " (part of ASMotor " ASMOTOR_VERSION
 	    ")\n\n");
-	printf("usage: rgblink [-t] [-l library] [-m mapfile] [-n symfile] [-o outfile]\n");
+	printf("usage: rgblink [-t] [-m mapfile] [-n symfile] [-o outfile]\n");
 	printf("\t    [-s symbol] [-z pad_value] objectfile [...]\n");
 
 	exit(1);
@@ -59,9 +59,6 @@
 
 	while ((ch = getopt(argc, argv, "l:m:n:o:p:s:t")) != -1) {
 		switch (ch) {
-		case 'l':
-			lib_Readfile(optarg);
-			break;
 		case 'm':
 			SetMapfileName(optarg);
 			break;
--- a/src/link/object.c
+++ b/src/link/object.c
@@ -494,26 +494,3 @@
 		obj_ReadOpenFile(f, name);
 	}
 }
-
-void 
-lib_Readfile(char *tzLibfile)
-{
-	FILE *pObjfile;
-
-	oReadLib = 1;
-
-	pObjfile = fopen(tzLibfile, "rb");
-	if (pObjfile == NULL) {
-		err(1, "Unable to open object '%s'", tzLibfile);
-	}
-	char tzHeader[5];
-
-	fread(tzHeader, sizeof(char), 4, pObjfile);
-	tzHeader[4] = 0;
-	if (strcmp(tzHeader, "XLB0") == 0)
-		lib_ReadXLB0(pObjfile);
-	else {
-		errx(1, "'%s' is an invalid library", tzLibfile);
-	}
-	fclose(pObjfile);
-}
--- a/src/link/rgblink.1
+++ b/src/link/rgblink.1
@@ -29,12 +29,6 @@
 .Pp
 The arguments are as follows:
 .Bl -tag -width Ds
-.It Fl l Ar library
-Include a referenced library module created with
-.Xr rgblib 1 .
-Note that specified libraries will be included only if needed\(emthat is, if
-a SECTION from a library is referenced by an object file.
-Only the relevant SECTION will be included, rather than the entire module.
 .It Fl m Ar mapfile
 Write a mapfile to the given filename.
 .It Fl n Ar symfile
@@ -70,7 +64,6 @@
 .Xr rgbds 7 ,
 .Xr rgbasm 1 ,
 .Xr rgbfix 1 ,
-.Xr rgblib 1 ,
 .Xr gbz80 7
 .Sh HISTORY
 .Nm
--- a/src/rgbds.7
+++ b/src/rgbds.7
@@ -13,7 +13,6 @@
 .Sh SEE ALSO
 .Xr rgbasm 1 ,
 .Xr rgbfix 1 ,
-.Xr rgblib 1 ,
 .Xr rgblink 1 ,
 .Xr gbz80 7
 .Sh HISTORY