* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
- need += out_used;
- if (need > out_size) {
- out_size = need * 2;
- out_buff = typeRealloc(char, out_size, out_buff);
- if (out_buff == 0)
+ need += TPS(out_used);
+ if (need > TPS(out_size)) {
+ TPS(out_size) = need * 2;
+ TPS(out_buff) = typeRealloc(char, TPS(out_size), TPS(out_buff));
+ if (TPS(out_buff) == 0)
- (void) sprintf(out_buff + out_used, fmt, s);
- out_used += strlen(out_buff + out_used);
+ (void) sprintf(TPS(out_buff) + TPS(out_used), fmt, s);
+ TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used));
- (void) sprintf(out_buff + out_used, fmt, number);
- out_used += strlen(out_buff + out_used);
+ (void) sprintf(TPS(out_buff) + TPS(out_used), fmt, number);
+ TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used));
- if (stack_ptr < STACKSIZE) {
- stack[stack_ptr].num_type = TRUE;
- stack[stack_ptr].data.num = x;
- stack_ptr++;
+ if (TPS(stack_ptr) < STACKSIZE) {
+ TPS(stack)[TPS(stack_ptr)].num_type = TRUE;
+ TPS(stack)[TPS(stack_ptr)].data.num = x;
+ TPS(stack_ptr)++;
- if (stack_ptr > 0) {
- stack_ptr--;
- if (stack[stack_ptr].num_type)
- result = stack[stack_ptr].data.num;
+ if (TPS(stack_ptr) > 0) {
+ TPS(stack_ptr)--;
+ if (TPS(stack)[TPS(stack_ptr)].num_type)
+ result = TPS(stack)[TPS(stack_ptr)].data.num;
- if (stack_ptr < STACKSIZE) {
- stack[stack_ptr].num_type = FALSE;
- stack[stack_ptr].data.str = x;
- stack_ptr++;
+ if (TPS(stack_ptr) < STACKSIZE) {
+ TPS(stack)[TPS(stack_ptr)].num_type = FALSE;
+ TPS(stack)[TPS(stack_ptr)].data.str = x;
+ TPS(stack_ptr)++;
- if (stack_ptr > 0) {
- stack_ptr--;
- if (!stack[stack_ptr].num_type && stack[stack_ptr].data.str != 0)
- result = stack[stack_ptr].data.str;
+ if (TPS(stack_ptr) > 0) {
+ TPS(stack_ptr)--;
+ if (!TPS(stack)[TPS(stack_ptr)].num_type
+ && TPS(stack)[TPS(stack_ptr)].data.str != 0)
+ result = TPS(stack)[TPS(stack_ptr)].data.str;
- if ((len2 = strlen(cp)) > fmt_size) {
- fmt_size = len2 + fmt_size + 2;
- if ((fmt_buff = typeRealloc(char, fmt_size, fmt_buff)) == 0)
- return 0;
+ if ((len2 = strlen(cp)) > TPS(fmt_size)) {
+ TPS(fmt_size) = len2 + TPS(fmt_size) + 2;
+ TPS(fmt_buff) = typeRealloc(char, TPS(fmt_size), TPS(fmt_buff));
+ if (TPS(fmt_buff) == 0)
+ return 0;
* variable-length argument list.
*/
number = _nc_tparm_analyze(cp, p_is_s, &popcount);
* variable-length argument list.
*/
number = _nc_tparm_analyze(cp, p_is_s, &popcount);
- for (i = 0; i < max(popcount, number); i++) {
+ if (number > NUM_PARM)
+ number = NUM_PARM;
+ if (popcount > NUM_PARM)
+ popcount = NUM_PARM;
+ num_args = max(popcount, number);
+
+ for (i = 0; i < num_args; i++) {
/*
* A few caps (such as plab_norm) have string-valued parms.
* We'll have to assume that the caller knows the difference, since
/*
* A few caps (such as plab_norm) have string-valued parms.
* We'll have to assume that the caller knows the difference, since
* the expansion of (for example) \E[%d;%dH work correctly in termcap
* style, which means tparam() will expand termcap strings OK.
*/
* the expansion of (for example) \E[%d;%dH work correctly in termcap
* style, which means tparam() will expand termcap strings OK.
*/
if (p_is_s[i] != 0)
save_text(", %s", _nc_visbuf(p_is_s[i]), 0);
else
if (p_is_s[i] != 0)
save_text(", %s", _nc_visbuf(p_is_s[i]), 0);
else
- save_number(", %d", param[i], 0);
+ save_number(", %d", (int) param[i], 0);
- _tracef(T_CALLED("%s(%s%s)"), tname, _nc_visbuf(cp), out_buff);
- out_used = 0;
+ _tracef(T_CALLED("%s(%s%s)"), TPS(tname), _nc_visbuf(cp), TPS(out_buff));
+ TPS(out_used) = 0;
+ _nc_unlock_global(tracef);
- tparam_base = cp++;
- cp = parse_format(cp, fmt_buff, &len);
+ TPS(tparam_base) = cp++;
+ cp = parse_format(cp, TPS(fmt_buff), &len);
return tparm_varargs(string, a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
#endif /* NCURSES_TPARM_VARARGS */
return tparm_varargs(string, a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
#endif /* NCURSES_TPARM_VARARGS */