aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tbi
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-11-02 11:42:36 +0300
committerJoursoir <chat@joursoir.net>2021-11-02 11:43:37 +0300
commita5f15c8e9db0dc8e6a782392b4ed91ccee3eff98 (patch)
tree06f2f414cf723a4c47baa9966dd4d5b76690613a /lib/tbi
parent896e763d38bb91d3f3c8c5ebc26f431c58933bbc (diff)
downloadufm-a5f15c8e9db0dc8e6a782392b4ed91ccee3eff98.tar.gz
ufm-a5f15c8e9db0dc8e6a782392b4ed91ccee3eff98.tar.bz2
ufm-a5f15c8e9db0dc8e6a782392b4ed91ccee3eff98.zip
tbi/win: make front-end routines wprintf(), mvwprintf()
Diffstat (limited to 'lib/tbi')
-rw-r--r--lib/tbi/win.c27
-rw-r--r--lib/tbi/win.h28
2 files changed, 55 insertions, 0 deletions
diff --git a/lib/tbi/win.c b/lib/tbi/win.c
index f3f25a3..172f9a9 100644
--- a/lib/tbi/win.c
+++ b/lib/tbi/win.c
@@ -188,6 +188,33 @@ BOOLEAN mvwvline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 n)
return TRUE;
}
+UINTN EFIAPI wprintf(struct window *w, CONST CHAR16 *fmt, ...)
+{
+ VA_LIST arg;
+ UINTN retval;
+
+ VA_START(arg, fmt);
+ retval = wvprintf(w, fmt, arg);
+ VA_END(arg);
+ return retval;
+}
+
+UINTN EFIAPI mvwprintf(struct window *w, INT32 x, INT32 y, CONST CHAR16 *fmt, ...)
+{
+ VA_LIST arg;
+ UINTN retval;
+ BOOLEAN moved;
+
+ moved = wmove(w, x, y);
+ if(moved == FALSE)
+ return 0;
+
+ VA_START(arg, fmt);
+ retval = wvprintf(w, fmt, arg);
+ VA_END(arg);
+ return retval;
+}
+
UINTN EFIAPI wvprintf(struct window *w, CONST CHAR16 *fmt, VA_LIST args)
{
INT32 x, y;
diff --git a/lib/tbi/win.h b/lib/tbi/win.h
index 18f0153..3c42538 100644
--- a/lib/tbi/win.h
+++ b/lib/tbi/win.h
@@ -134,6 +134,34 @@ BOOLEAN mvwhline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 n);
BOOLEAN mvwvline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 n);
/*
+ * Prints formatted output on the cursor coordinates
+ *
+ * w: the window on which to operate
+ * fmt: a null-terminated unicode format string
+ * ...: variable arguments list whose contents are accessed based on the
+ fmt string specified by FormatString
+ *
+ * return: the number of unicode chars in the produced output buffer
+ not including the null-terminator
+*/
+UINTN EFIAPI wprintf(struct window *w, CONST CHAR16 *fmt, ...);
+
+/*
+ * Moves to specified coordinates, prints formatted output
+ *
+ * w: the window on which to operate
+ * x: the X(column) coordinate to move
+ * y: the Y(row) coordinate to move
+ * fmt: a null-terminated unicode format string
+ * ...: variable arguments list whose contents are accessed based on the
+ fmt string specified by FormatString
+ *
+ * return: the number of unicode chars in the produced output buffer
+ not including the null-terminator
+*/
+UINTN EFIAPI mvwprintf(struct window *w, INT32 x, INT32 y, CONST CHAR16 *fmt, ...);
+
+/*
* Prints output based on a null-terminated unicode format string
and a arguments list
*