Forum OpenACS Development: ::tcl_precision

Collapse
Posted by Maurizio Martignano on
Dear All,
I've got a question about the global variable ::tcl_precision.

In TCL 8.4.x its default value was 12. In TCL 8.5.x its default value is 0.

In my application I need to use the old default value (i.e. 12).

Is there a proper place in the Aolserver/OpenACS ini/config files where I can put the instruction:

set ::tcl_precision 12

and have this new value visible in all TCL threads?

Alternatively I've introduced the following change in tclUtil.c:

-----------------------------------
void
Tcl_PrintDouble(
Tcl_Interp *interp, /* Interpreter whose tcl_precision variable
* used to be used to control printing. It's
* ignored now. */
double value, /* Value to print as string. */
char *dst) /* Where to store converted value; must have
* at least TCL_DOUBLE_SPACE characters. */
{
char *p, c;
int exp;
int signum;
char buffer[TCL_DOUBLE_SPACE];
Tcl_UniChar ch;

static int first_time = 1; /* This variable has been added to set the default value of ::tcl_precision to 12 */

int *precisionPtr = Tcl_GetThreadData(&precisionKey, (int)sizeof(int));

/*
* This code has been added to set the default value of ::tcl_precision to 12
*/
if (first_time) {
*precisionPtr = 12;
first_time = 0;
}

...
-----------------------------------

Of course I would prefer the first solution....

Any suggestion?

Thanks in advance,
Maurizio

Collapse
2: Re: ::tcl_precision (response to 1)
Posted by Tom Jackson on
You will have to experiment, but try setting it in the global init.tcl file ($home/modules/tcl/init.tcl).

Note that there are other differences in 8.5. The [switch] command is one example.

BTW, the 0 means 17, which is the new default.