From 3daecfb3dd357047e12bdd002ab114bbeb29c85d Mon Sep 17 00:00:00 2001
From: mc78 <mc78@outlook.de>
Date: Tue, 12 Nov 2019 13:08:33 +0100
Subject: [PATCH 100/170] Added enum for cc65 exit codes. replaced stdlib exit
code names constants in libsrc with cc65 exit code named constants
---
include/cc65.h | 6 ++++++
libsrc/common/_afailed.c | 2 +-
libsrc/common/abort.c | 2 +-
libsrc/dbg/dbg.c | 2 +-
libsrc/geos-apple/targetutil/convert.c | 5 +++--
libsrc/geos-common/common/_afailed.c | 2 +-
libsrc/geos-common/common/abort.c | 3 ++-
7 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/include/cc65.h b/include/cc65.h
index 7e9c2cae..99a8665c 100644
--- a/include/cc65.h
+++ b/include/cc65.h
@@ -36,6 +36,12 @@
#ifndef _CC65_H
#define _CC65_H
+typedef enum {
+ CC65_EXIT_SUCCESS,
+ CC65_EXIT_FAILURE,
+ CC65_EXIT_AFAILED,
+ CC65_EXIT_ABORT
+} cc65_exit_codes_t;
/*****************************************************************************/
diff --git a/libsrc/common/_afailed.c b/libsrc/common/_afailed.c
index ed93fc12..654025e1 100644
--- a/libsrc/common/_afailed.c
+++ b/libsrc/common/_afailed.c
@@ -17,5 +17,5 @@ void __fastcall__ _afailed (char* file, unsigned line)
{
raise (SIGABRT);
fprintf (stderr, "ASSERTION FAILED IN %s(%u)\n", file, line);
- exit (2);
+ exit (CC65_EXIT_AFAILED);
}
diff --git a/libsrc/common/abort.c b/libsrc/common/abort.c
index 43ad676a..e59adb7d 100644
--- a/libsrc/common/abort.c
+++ b/libsrc/common/abort.c
@@ -16,7 +16,7 @@ void abort (void)
{
raise (SIGABRT);
fputs ("ABNORMAL PROGRAM TERMINATION\n", stderr);
- exit (3);
+ exit (CC65_EXIT_ABORT);
}
diff --git a/libsrc/dbg/dbg.c b/libsrc/dbg/dbg.c
index 60b45279..1b08d775 100644
--- a/libsrc/dbg/dbg.c
+++ b/libsrc/dbg/dbg.c
@@ -1580,7 +1580,7 @@ void DbgEntry (void)
case 'q':
/* Quit program */
clrscr ();
- exit (1);
+ exit (CC65_EXIT_FAILURE);
}
}
diff --git a/libsrc/geos-apple/targetutil/convert.c b/libsrc/geos-apple/targetutil/convert.c
index ea9273fc..a4d07ac0 100644
--- a/libsrc/geos-apple/targetutil/convert.c
+++ b/libsrc/geos-apple/targetutil/convert.c
@@ -5,6 +5,7 @@
#include <dirent.h>
#include <device.h>
#include <dio.h>
+#include <cc65.h>
unsigned char info_signature[3] = {3, 21, 63 | 0x80};
@@ -69,7 +70,7 @@ static void err_exit(char *operation, unsigned char oserr)
operation);
}
getchar();
- exit(EXIT_FAILURE);
+ exit(CC65_EXIT_FAILURE);
}
@@ -342,5 +343,5 @@ int main(int argc, char* argv[])
printf("Convert to '%.*s' successful", dir_entry->storage_length.name_length,
dir_entry->file_name);
getchar();
- return EXIT_SUCCESS;
+ return CC65_EXIT_SUCCESS;
}
diff --git a/libsrc/geos-common/common/_afailed.c b/libsrc/geos-common/common/_afailed.c
index 2448534c..ec21a6b4 100644
--- a/libsrc/geos-common/common/_afailed.c
+++ b/libsrc/geos-common/common/_afailed.c
@@ -28,5 +28,5 @@ void _afailed (char* file, unsigned line)
DlgBoxOk(CBOLDON "ASSERTION FAILED", "PROGRAM TERMINATED" CPLAINTEXT);
- exit (2);
+ exit (CC65_EXIT_AFAILED);
}
diff --git a/libsrc/geos-common/common/abort.c b/libsrc/geos-common/common/abort.c
index b7cb35eb..665b7086 100644
--- a/libsrc/geos-common/common/abort.c
+++ b/libsrc/geos-common/common/abort.c
@@ -6,10 +6,11 @@
#include <stdlib.h>
#include <geos.h>
+#include <cc65.h>
void abort (void)
{
ExitTurbo();
DlgBoxOk(CBOLDON "ABNORMAL PROGRAM", "TERMINATION." CPLAINTEXT);
- exit(3);
+ exit(CC65_EXIT_ABORT);
}
--
2.26.0