diff options
Diffstat (limited to 'procyon/source/bs')
-rw-r--r-- | procyon/source/bs/dbglog.c | 11 | ||||
-rw-r--r-- | procyon/source/bs/exit.c | 15 | ||||
-rw-r--r-- | procyon/source/bs/init.c | 51 | ||||
-rw-r--r-- | procyon/source/bs/shipnm.c | 70 |
4 files changed, 0 insertions, 147 deletions
diff --git a/procyon/source/bs/dbglog.c b/procyon/source/bs/dbglog.c deleted file mode 100644 index d04174f..0000000 --- a/procyon/source/bs/dbglog.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <acm/bs.h> - -#include <stdarg.h> -#include <stdio.h> - -void acm_dbglog(char const * const _fmt,...) { - va_list args; - va_start(args,_fmt); - vfprintf(stderr,_fmt,args); - va_end(args); -} diff --git a/procyon/source/bs/exit.c b/procyon/source/bs/exit.c deleted file mode 100644 index e49dfc9..0000000 --- a/procyon/source/bs/exit.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <acm/bs.h> - -#include <GLFW/glfw3.h> -#include <stdlib.h> - -void acm_exit(acm_stat const _stat) { - int const cstat = _stat == acm_stat_ok ? EXIT_SUCCESS : EXIT_FAILURE; - free((void *)acm_dat.savloc); - if (acm_dat.gfxisinit) { - glfwDestroyWindow(acm_dat.win); - glfwTerminate(); - } - acm_log("Done (%X)\n",cstat); - exit(cstat); -} diff --git a/procyon/source/bs/init.c b/procyon/source/bs/init.c deleted file mode 100644 index 1f4c57e..0000000 --- a/procyon/source/bs/init.c +++ /dev/null @@ -1,51 +0,0 @@ -#include <acm/gfx.h> - -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <zap/mem.h> - -sig_atomic_t volatile acm_gotintr; - -typeof (acm_dat) acm_dat; - -static char * acm_getsavloc(void) { - char const * const hmdir = getenv("HOME"); - if (hmdir == nullptr) { - fprintf(stderr,"Unable to get home directory (HOME not set)\n"); - acm_exit(acm_stat_err); - } - char const * const savfilnm = ".procyon-save"; - zap_sz const hmdirlen = zap_strlen(hmdir); - zap_sz const savfilnmlen = zap_strlen(savfilnm); - zap_sz const savloclen = hmdirlen + 0x1u + savfilnmlen; - char * savloc = malloc(savloclen + 0x1u); - if (savloc == nullptr) { - fprintf(stderr,"Unable allocate memory\n"); - acm_exit(acm_stat_err); - } - zap_memcp(hmdir,hmdirlen,savloc); - savloc[hmdirlen] = '/'; - zap_memcp(savfilnm,savfilnmlen,savloc + hmdirlen + 0x1u); - savloc[savloclen] = 0x0u; - return savloc; -} - -static void acm_intrhandl(int const _sig) { - signal(_sig,acm_intrhandl); /* Ignore the return value. */ - acm_gotintr = 0x1; -} - -void acm_init(void) { - acm_gotintr = 0x0; - acm_dat.gfxisinit = false; - acm_dat.win = nullptr; - acm_log("Initialising data\n"); - acm_dat.savloc = acm_getsavloc(); - acm_log("Initialising signal handlers\n"); - if (signal(SIGINT,acm_intrhandl) == SIG_ERR) { - fprintf(stderr,"Unable to set SIGINT handler\n"); - acm_exit(acm_stat_err); - } - acm_initgfx(); -} diff --git a/procyon/source/bs/shipnm.c b/procyon/source/bs/shipnm.c deleted file mode 100644 index f1d8f4e..0000000 --- a/procyon/source/bs/shipnm.c +++ /dev/null @@ -1,70 +0,0 @@ -#include <acm/bs.h> - -char const * acm_shipnm(acm_shipid const _ship) { - switch (_ship) { - case acm_shipid_add: - return "Adder"; - case acm_shipid_ana: - return "Anaconda"; - case acm_shipid_asp: - return "Asp"; - case acm_shipid_boa: - return "Boa"; - case acm_shipid_cob: - return "Cobra"; - case acm_shipid_con: - return "Constrictor"; - case acm_shipid_cou: - return "Courier"; - case acm_shipid_cyg: - return "Cygnus"; - case acm_shipid_dov: - return "Dove"; - case acm_shipid_eag: - return "Eagle"; - case acm_shipid_falc: - return "Falcon"; - case acm_shipid_fer: - return "Fer-de-lance"; - case acm_shipid_frei: - return "Freighter"; - case acm_shipid_geck: - return "Gecko"; - case acm_shipid_haul: - return "Hauler"; - case acm_shipid_hawk: - return "Hawk"; - case acm_shipid_keel: - return "Keelback"; - case acm_shipid_kes: - return "Kestral"; - case acm_shipid_krait: - return "Krait"; - case acm_shipid_lift: - return "Lifter"; - case acm_shipid_lion: - return "Lion"; - case acm_shipid_mamba: - return "Mamba"; - case acm_shipid_moray: - return "Moray"; - case acm_shipid_osp: - return "Osprey"; - case acm_shipid_pan: - return "Panther"; - case acm_shipid_puma: - return "Puma"; - case acm_shipid_py: - return "Python"; - case acm_shipid_shut: - return "Shuttle"; - case acm_shipid_side: - return "Sidewinder"; - case acm_shipid_tran: - return "Transporter"; - case acm_shipid_vip: - return "Viper"; - case acm_shipid_vult: - return "Vulture"; - } -} |