]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/read_entry.c
ncurses 5.9 - patch 20130824
[ncurses.git] / ncurses / tinfo / read_entry.c
index e67ced4897eeb8ac07ca3c966291d25ac6fe9f13..0c825d537e4c6e8106515b001fccf4e8547a5c3d 100644 (file)
@@ -41,7 +41,7 @@
 
 #include <tic.h>
 
-MODULE_ID("$Id: read_entry.c,v 1.123 2013/05/25 20:17:49 tom Exp $")
+MODULE_ID("$Id: read_entry.c,v 1.125 2013/08/17 19:06:59 tom Exp $")
 
 #define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
 
@@ -107,7 +107,7 @@ fake_read(char *src, int *offset, int limit, char *dst, unsigned want)
     return (int) want;
 }
 
-#define Read(buf, count) fake_read(buffer, &offset, limit, buf, (unsigned) count)
+#define Read(buf, count) fake_read(buffer, &offset, limit, (char *) buf, (unsigned) count)
 
 #define read_shorts(buf, count) \
        (Read(buf, (count)*2) == (int) (count)*2)
@@ -115,6 +115,36 @@ fake_read(char *src, int *offset, int limit, char *dst, unsigned want)
 #define even_boundary(value) \
     if ((value) % 2 != 0) Read(buf, 1)
 
+NCURSES_EXPORT(void)
+_nc_init_termtype(TERMTYPE *const tp)
+{
+    unsigned i;
+
+#if NCURSES_XNAMES
+    tp->num_Booleans = BOOLCOUNT;
+    tp->num_Numbers = NUMCOUNT;
+    tp->num_Strings = STRCOUNT;
+    tp->ext_Booleans = 0;
+    tp->ext_Numbers = 0;
+    tp->ext_Strings = 0;
+#endif
+    if (tp->Booleans == 0)
+       TYPE_MALLOC(NCURSES_SBOOL, BOOLCOUNT, tp->Booleans);
+    if (tp->Numbers == 0)
+       TYPE_MALLOC(short, NUMCOUNT, tp->Numbers);
+    if (tp->Strings == 0)
+       TYPE_MALLOC(char *, STRCOUNT, tp->Strings);
+
+    for_each_boolean(i, tp)
+       tp->Booleans[i] = FALSE;
+
+    for_each_number(i, tp)
+       tp->Numbers[i] = ABSENT_NUMERIC;
+
+    for_each_string(i, tp)
+       tp->Strings[i] = ABSENT_STRING;
+}
+
 /*
  * Return TGETENT_YES if read, TGETENT_NO if not found or garbled.
  */