summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt5
-rw-r--r--demo.cc3
-rw-r--r--dux/GNUmakefile1
-rw-r--r--dux/include-private/dux/prv/io.h2
-rw-r--r--dux/include/dux/fs.h10
-rw-r--r--dux/include/dux/io.h10
-rw-r--r--dux/source/io/crt.c2
-rw-r--r--dux/source/io/fil.c28
-rw-r--r--dux/source/io/opn.c6
-rw-r--r--dux_boxes.svg (renamed from logo/dux_boxes.svg)0
-rw-r--r--dux_old.svg (renamed from logo/dux_old.svg)0
-rw-r--r--u8c.svg (renamed from logo/u8c.svg)0
-rw-r--r--u8c_boxes.svg (renamed from logo/u8c_boxes.svg)0
-rw-r--r--u8c_braille.svg (renamed from logo/u8c_braille.svg)0
14 files changed, 52 insertions, 15 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 244931a..54b0a76 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -110,6 +110,11 @@
- Move current logo to root directory;
- Update logo;
+- Move all logos to the root directory;
+- Implement dfli, dflo, and log;
+- Rename dfli to idfl;
+- Rename dflo to odfl;
+
| 2↋
- Fix signal pipe being renamed to file;
diff --git a/demo.cc b/demo.cc
index d97eead..236e316 100644
--- a/demo.cc
+++ b/demo.cc
@@ -138,4 +138,7 @@ int main() {
err = ::dux_cls(fil);
chkerr("unable to close file");
+
+ err = ::dux_wrtstr(dux_odfl,"Goodbye!\n");
+ chkerr("unable to say goodbye");
}
diff --git a/dux/GNUmakefile b/dux/GNUmakefile
index 6e6817f..73d5140 100644
--- a/dux/GNUmakefile
+++ b/dux/GNUmakefile
@@ -17,6 +17,7 @@ OBJS := \
\
source/io/cls.o \
source/io/crt.o \
+ source/io/fil.o \
source/io/opn.o \
source/io/red.o \
source/io/wrt.o
diff --git a/dux/include-private/dux/prv/io.h b/dux/include-private/dux/prv/io.h
index f2503e4..99d2866 100644
--- a/dux/include-private/dux/prv/io.h
+++ b/dux/include-private/dux/prv/io.h
@@ -14,7 +14,7 @@
dux_prv_cdec
-struct dux_prv_fil {
+struct dux_det_fil {
int fd;
};
diff --git a/dux/include/dux/fs.h b/dux/include/dux/fs.h
index ebb821e..2709aad 100644
--- a/dux/include/dux/fs.h
+++ b/dux/include/dux/fs.h
@@ -16,16 +16,16 @@ dux_prv_cdec
typedef zp_i01 dux_prm;
-struct dux_prv_dsc {
+struct dux_det_dsc {
bool _dsc;
};
#if zp_std_cxx
-#define dux_kep (::dux_prv_dsc {false,})
-#define dux_dsc (::dux_prv_dsc {true,})
+#define dux_kep (::dux_det_dsc {false,})
+#define dux_dsc (::dux_det_dsc {true,})
#else
-#define dux_kep ((struct dux_prv_dsc) {._dsc = false,})
-#define dux_dsc ((struct dux_prv_dsc) {._dsc = true,})
+#define dux_kep ((struct dux_det_dsc) {._dsc = false,})
+#define dux_dsc ((struct dux_det_dsc) {._dsc = true,})
#endif
typedef struct {
diff --git a/dux/include/dux/io.h b/dux/include/dux/io.h
index f524a77..913427f 100644
--- a/dux/include/dux/io.h
+++ b/dux/include/dux/io.h
@@ -14,16 +14,16 @@
dux_prv_cdec
-struct dux_prv_fil;
-typedef struct dux_prv_fil dux_fil;
+struct dux_det_fil;
+typedef struct dux_det_fil dux_fil;
-extern dux_fil * dux_dfli;
-extern dux_fil * dux_dflo;
+extern dux_fil * dux_idfl;
+extern dux_fil * dux_odfl;
extern dux_fil * dux_log;
dux_err dux_crt( dux_fil * * fil,char const* pth,dux_prm prm);
dux_err dux_opn( dux_fil * * fil,char const* pth);
-dux_err dux_opnrw(dux_fil * * fil,char const* pth,struct dux_prv_dsc);
+dux_err dux_opnrw(dux_fil * * fil,char const* pth,struct dux_det_dsc);
dux_err dux_cls(dux_fil * fil);
diff --git a/dux/source/io/crt.c b/dux/source/io/crt.c
index a2552b1..073f514 100644
--- a/dux/source/io/crt.c
+++ b/dux/source/io/crt.c
@@ -17,7 +17,7 @@
extern int * __errno_location(void);
dux_err dux_crt(dux_fil * * const filptr,char const* const pth,dux_prm const prm) {
- dux_fil * fil = malloc(sizeof (struct dux_prv_fil));
+ dux_fil * fil = malloc(sizeof (struct dux_det_fil));
if (fil == zp_nulptr) {return dux_err_badalc;}
opn:;
diff --git a/dux/source/io/fil.c b/dux/source/io/fil.c
new file mode 100644
index 0000000..96cc85e
--- /dev/null
+++ b/dux/source/io/fil.c
@@ -0,0 +1,28 @@
+/*
+ Copyright 2019-2023 Gabriel Jensen.
+
+ This file is part of dux.
+ dux is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ dux is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public License along with dux. If not, see <https://www.gnu.org/licenses>.
+*/
+
+#include <dux/prv/io.h>
+
+#include <unistd.h>
+
+static dux_fil dux_det_idfl = {
+ .fd = STDIN_FILENO,
+};
+
+static dux_fil dux_det_odfl = {
+ .fd = STDOUT_FILENO,
+};
+
+static dux_fil dux_det_log = {
+ .fd = STDERR_FILENO,
+};
+
+dux_fil * dux_idfl = &dux_det_idfl;
+dux_fil * dux_odfl = &dux_det_odfl;
+dux_fil * dux_log = &dux_det_log;
diff --git a/dux/source/io/opn.c b/dux/source/io/opn.c
index bc02f91..f2415f1 100644
--- a/dux/source/io/opn.c
+++ b/dux/source/io/opn.c
@@ -16,8 +16,8 @@
extern int * __errno_location(void);
-static dux_err dux_det_opn(dux_fil * * const filptr,char const* const pth,bool const wrt,struct dux_prv_dsc const dsc) {
- dux_fil * fil = malloc(sizeof (struct dux_prv_fil));
+static dux_err dux_det_opn(dux_fil * * const filptr,char const* const pth,bool const wrt,struct dux_det_dsc const dsc) {
+ dux_fil * fil = malloc(sizeof (struct dux_det_fil));
if (fil == zp_nulptr) {return dux_err_badalc;}
opn:;
@@ -56,6 +56,6 @@ dux_err dux_opn(dux_fil * * const fil,char const* const pth) {
return dux_det_opn(fil,pth,false,dux_kep);
}
-dux_err dux_opnrw(dux_fil * * const fil,char const* const pth,struct dux_prv_dsc const dsc) {
+dux_err dux_opnrw(dux_fil * * const fil,char const* const pth,struct dux_det_dsc const dsc) {
return dux_det_opn(fil,pth,true,dsc);
}
diff --git a/logo/dux_boxes.svg b/dux_boxes.svg
index a55d0d2..a55d0d2 100644
--- a/logo/dux_boxes.svg
+++ b/dux_boxes.svg
diff --git a/logo/dux_old.svg b/dux_old.svg
index 802e233..802e233 100644
--- a/logo/dux_old.svg
+++ b/dux_old.svg
diff --git a/logo/u8c.svg b/u8c.svg
index b20c621..b20c621 100644
--- a/logo/u8c.svg
+++ b/u8c.svg
diff --git a/logo/u8c_boxes.svg b/u8c_boxes.svg
index d6bad80..d6bad80 100644
--- a/logo/u8c_boxes.svg
+++ b/u8c_boxes.svg
diff --git a/logo/u8c_braille.svg b/u8c_braille.svg
index b885474..b885474 100644
--- a/logo/u8c_braille.svg
+++ b/u8c_braille.svg