aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Tim Segers <tsegers@pm.me>2025-04-29 15:40:44 +0200
committerGravatar Tim Segers <tsegers@pm.me>2025-04-29 16:03:28 +0200
commit53ce5968216eb135f9299fb25cd88b894f0647aa (patch)
tree83994c164a0cc9e6ab8073210d690f954b4c1cb7
parentb4582977251dbf07c13c4d69a4f7be04e75612d6 (diff)
downloadopendeco-53ce5968216eb135f9299fb25cd88b894f0647aa.tar.gz
Remove wchardevelop
-rw-r--r--src/opendeco-cli.c11
-rw-r--r--src/opendeco-conf.c3
-rw-r--r--src/opendeco.c19
-rw-r--r--src/output.c20
-rw-r--r--src/output.h14
5 files changed, 31 insertions, 36 deletions
diff --git a/src/opendeco-cli.c b/src/opendeco-cli.c
index e3fd852..bd0ed04 100644
--- a/src/opendeco-cli.c
+++ b/src/opendeco-cli.c
@@ -3,7 +3,6 @@
#include <argp.h>
#include <stdlib.h>
#include <string.h>
-#include <wchar.h>
#include "opendeco-cli.h"
@@ -52,17 +51,17 @@ static void print_xxd_arr(char *name, unsigned char *content, unsigned int len)
exit(EXIT_FAILURE);
}
- wprintf(L"--------\n\n");
- wprintf(L"License for: %s\n\n", name);
- wprintf(L"%s", tmp);
- wprintf(L"\n");
+ printf("--------\n\n");
+ printf("License for: %s\n\n", name);
+ printf("%s", tmp);
+ printf("\n");
free(tmp);
}
static void print_licenses()
{
- wprintf(L"THIRD-PARTY LICENSES:\n\n");
+ printf("THIRD-PARTY LICENSES:\n\n");
print_xxd_arr("cktan/tomlc99", toml_LICENSE, toml_LICENSE_len);
print_xxd_arr("siu/minunit", minunit_LICENSE, minunit_LICENSE_len);
}
diff --git a/src/opendeco-conf.c b/src/opendeco-conf.c
index e19440b..6bf960d 100644
--- a/src/opendeco-conf.c
+++ b/src/opendeco-conf.c
@@ -2,7 +2,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <wchar.h>
#include <errno.h>
#include "opendeco-conf.h"
@@ -26,7 +25,7 @@ int opendeco_conf_parse(const char *confpath, struct arguments *arguments)
if (!od_conf)
return -EINVAL;
- fwprintf(stderr, L"Picked up options from %s\n", confpath);
+ fprintf(stderr, "Picked up options from %s\n", confpath);
/* set options in arguments */
toml_table_t *dive = toml_table_in(od_conf, "dive");
diff --git a/src/opendeco.c b/src/opendeco.c
index b57004b..b2431d5 100644
--- a/src/opendeco.c
+++ b/src/opendeco.c
@@ -6,7 +6,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <wchar.h>
#include "deco.h"
#include "opendeco-cli.h"
@@ -55,15 +54,15 @@ void print_gas_use(void)
{
static char gasbuf[12];
- wprintf(L"\nRMV dive: %.2f%lc/min\n", RMV_DIVE, LTR);
- wprintf(L"RMV deco: %.2f%lc/min\n\n", RMV_DECO, LTR);
+ printf("\nRMV dive: %.2f%s/min\n", RMV_DIVE, LTR);
+ printf("RMV deco: %.2f%s/min\n\n", RMV_DECO, LTR);
- wprintf(L"Gas use:\n", RMV_DECO, LTR);
+ printf("Gas use:\n");
for (int i = 0; i < 10; i++) {
if (gas_usage[i].gas) {
format_gas(gasbuf, len(gasbuf), gas_usage[i].gas);
strcat(gasbuf, ":");
- wprintf(L"%-12s%5i%lc\n", gasbuf, (int) ceil(gas_usage[i].usage), LTR);
+ printf("%-12s%5i%sn", gasbuf, (int) ceil(gas_usage[i].usage), LTR);
}
}
}
@@ -73,7 +72,7 @@ void print_segment_callback_fn(const decostate_t *ds, segtype_t type, void *arg)
static double last_depth;
static double last_runtime;
- wchar_t sign;
+ char *sign;
double time_diff;
/* first time initialization */
@@ -126,12 +125,12 @@ int parse_gasses(gas_t **gasses, char *str)
*gasses = realloc(*gasses, nof_gasses * sizeof(gas_t));
if (*gasses == NULL) {
- wprintf(L"Cannot reserve space. Aborting!\n");
+ printf("Cannot reserve space. Aborting!\n");
exit(EXIT_FAILURE);
}
if (scan_gas(&(*gasses)[nof_gasses - 1], token)) {
- wprintf(L"Invalid gas (%s). Aborting!\n", token);
+ printf("Invalid gas (%s). Aborting!\n", token);
exit(EXIT_FAILURE);
}
}
@@ -198,7 +197,7 @@ int main(int argc, char *argv[])
init_decostate(&ds, arguments.gflow, arguments.gfhigh, xsw_to_bar(msw_or_fsw(3, 10)));
if (scan_gas(&bottom_gas, arguments.gas)) {
- wprintf(L"Invalid gas (%s). Aborting!\n", arguments.gas);
+ printf("Invalid gas (%s). Aborting!\n", arguments.gas);
exit(EXIT_FAILURE);
}
@@ -233,7 +232,7 @@ int main(int argc, char *argv[])
decoinfo_t di_p5 = calc_deco(&ds_p5, deco_gasses, nof_gasses, NULL);
/* output deco info and disclaimer */
- wprintf(L"\nNDL: %imin TTS: %imin TTS @+5: %imin\n", (int) floor(di.ndl), (int) ceil(di.tts),
+ printf("\nNDL: %imin TTS: %imin TTS @+5: %imin\n", (int) floor(di.ndl), (int) ceil(di.tts),
(int) ceil(di_p5.tts));
print_planfoot(&ds);
print_gas_use();
diff --git a/src/output.c b/src/output.c
index 07eacbe..cb3b281 100644
--- a/src/output.c
+++ b/src/output.c
@@ -76,12 +76,12 @@ match:
void print_planhead(void)
{
- wprintf(L"DIVE PLAN\n\n");
- wprintf(L" %-1s %6s %8s %-7s %1s %-9s %4s %5s\n", "", "Depth", "Duration", "Runtime", "", "Gas", "pO2",
+ printf("DIVE PLAN\n\n");
+ printf(" %-1s %6s %8s %-7s %1s %-9s %4s %5s\n", "", "Depth", "Duration", "Runtime", "", "Gas", "pO2",
"EAD");
}
-void print_planline(wchar_t sign, double depth, double time, double runtime, const gas_t *gas)
+void print_planline(char *sign, double depth, double time, double runtime, const gas_t *gas)
{
static char gasbuf[11];
static char runbuf[8];
@@ -94,7 +94,7 @@ void print_planline(wchar_t sign, double depth, double time, double runtime, con
const int depth_x = round(bar_to_xsw(gauge_depth(depth)));
const int ead_x = round(bar_to_xsw(max(0, gauge_depth(ead(depth, gas)))));
- wchar_t swi = L' ';
+ char *swi = " ";
snprintf(runbuf, len(runbuf), "(%i)", (int) ceil(runtime));
format_gas(gasbuf, len(gasbuf), gas);
@@ -107,7 +107,7 @@ void print_planline(wchar_t sign, double depth, double time, double runtime, con
}
/* only print ead and pO2 on stops */
- if (sign == LVL) {
+ if (!strcmp(sign, LVL)) {
snprintf(eadbuf, 6, "%3i%s", ead_x, DEPTHUNIT);
snprintf(pO2buf, 5, "%4.2f", ppO2(depth, gas));
} else {
@@ -115,7 +115,7 @@ void print_planline(wchar_t sign, double depth, double time, double runtime, con
snprintf(pO2buf, 5, "%4s", "-");
}
- wprintf(L" %lc %4i%2s %8s %-7s %lc %-9s %s %s\n", sign, depth_x, DEPTHUNIT, timbuf, runbuf, swi, gasbuf,
+ printf(" %s %4i%2s %8s %-7s %s %-9s %s %s\n", sign, depth_x, DEPTHUNIT, timbuf, runbuf, swi, gasbuf,
pO2buf, eadbuf);
}
@@ -142,12 +142,12 @@ void print_planfoot(const decostate_t *ds)
else
rq = "???";
- wprintf(L"\nDeco model: Buhlmann %s\n", model);
- wprintf(L"Conservatism: GF %i/%i, Rq = %s\n", ds->gflo, ds->gfhi, rq);
- wprintf(L"Surface pressure: %4.3fbar\n", SURFACE_PRESSURE);
+ printf("\nDeco model: Buhlmann %s\n", model);
+ printf("Conservatism: GF %i/%i, Rq = %s\n", ds->gflo, ds->gfhi, rq);
+ printf("Surface pressure: %4.3fbar\n", SURFACE_PRESSURE);
}
void print_disclaimer(void)
{
- wprintf(L"\nWARNING: DIVE PLAN MAY BE INACCURATE AND MAY CONTAIN\nERRORS THAT COULD LEAD TO INJURY OR DEATH.\n");
+ printf("\nWARNING: DIVE PLAN MAY BE INACCURATE AND MAY CONTAIN\nERRORS THAT COULD LEAD TO INJURY OR DEATH.\n");
}
diff --git a/src/output.h b/src/output.h
index ca390d4..eb17e16 100644
--- a/src/output.h
+++ b/src/output.h
@@ -3,19 +3,17 @@
#ifndef OUTPUT_H
#define OUTPUT_H
-#include <wchar.h>
-
#include "deco.h"
-#define ASC 0x2197 /* Unicode North East Arrow */
-#define LVL 0x2192 /* Unicode Rightwards Arrow */
-#define DEC 0x2198 /* Unicode South East Arrow */
-#define SWI 0x21BB /* Clockwise Open Circle Arrow */
-#define LTR 0x2113 /* Script Small L */
+#define ASC "\xe2\x86\x97" /* Unicode North East Arrow */
+#define LVL "\xe2\x86\x92" /* Unicode Rightwards Arrow */
+#define DEC "\xe2\x86\x98" /* Unicode South East Arrow */
+#define SWI "\xe2\x86\xBB" /* Clockwise Open Circle Arrow */
+#define LTR "\xe2\x84\x93" /* Script Small L */
/* functions */
void print_planhead(void);
-void print_planline(wchar_t sign, double depth, double time, double runtime, const gas_t *gas);
+void print_planline(char *sign, double depth, double time, double runtime, const gas_t *gas);
void print_planfoot(const decostate_t *ds);
void print_disclaimer(void);