]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_tparm.c
ncurses 5.6 - patch 20080804
[ncurses.git] / ncurses / tinfo / lib_tparm.c
index 4ff98679dde3850377984632d264ee1ab5c83980..dce6973af02dc365510473243fbb064ca02934dc 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -43,7 +43,7 @@
 #include <term.h>
 #include <tic.h>
 
-MODULE_ID("$Id: lib_tparm.c,v 1.72 2006/12/30 20:14:43 tom Exp $")
+MODULE_ID("$Id: lib_tparm.c,v 1.75 2008/08/03 22:37:22 tom Exp $")
 
 /*
  *     char *
@@ -105,43 +105,9 @@ MODULE_ID("$Id: lib_tparm.c,v 1.72 2006/12/30 20:14:43 tom Exp $")
  *     resulting in x mod y, not the reverse.
  */
 
-#define STACKSIZE      20
-
-typedef struct {
-    union {
-       int num;
-       char *str;
-    } data;
-    bool num_type;
-} stack_frame;
-
 NCURSES_EXPORT_VAR(int) _nc_tparm_err = 0;
 
-#define NUM_VARS 26
-
-typedef struct {
-#ifdef TRACE
-    const char *tname;
-#endif
-    const char *tparam_base;
-
-    stack_frame stack[STACKSIZE];
-    int stack_ptr;
-
-    char *out_buff;
-    size_t out_size;
-    size_t out_used;
-
-    char *fmt_buff;
-    size_t fmt_size;
-
-    int dynamic_var[NUM_VARS];
-    int static_vars[NUM_VARS];
-} tparm_state;
-
-static tparm_state tps;
-
-#define TPS(var) tps.var
+#define TPS(var) _nc_prescreen.tparm_state.var
 
 #if NO_LEAKS
 NCURSES_EXPORT(void)
@@ -538,11 +504,15 @@ tparam_internal(const char *string, va_list ap)
     TPS(stack_ptr) = 0;
     if (popcount == 0) {
        popcount = number;
-       for (i = number - 1; i >= 0; i--)
-           npush(param[i]);
+       for (i = number - 1; i >= 0; i--) {
+           if (p_is_s[i])
+               spush(p_is_s[i]);
+           else
+               npush(param[i]);
+       }
     }
 #ifdef TRACE
-    if (_nc_tracing & TRACE_CALLS) {
+    if (USE_TRACEF(TRACE_CALLS)) {
        for (i = 0; i < popcount; i++) {
            if (p_is_s[i] != 0)
                save_text(", %s", _nc_visbuf(p_is_s[i]), 0);
@@ -551,6 +521,7 @@ tparam_internal(const char *string, va_list ap)
        }
        _tracef(T_CALLED("%s(%s%s)"), TPS(tname), _nc_visbuf(cp), TPS(out_buff));
        TPS(out_used) = 0;
+       _nc_unlock_global(tracef);
     }
 #endif /* TRACE */