Browse Source

more characts for real number params

pre-master-46
h_vogt 16 years ago
parent
commit
005dae2462
  1. 6
      ChangeLog
  2. 7
      src/frontend/commands.c
  3. 32
      src/frontend/numparam/xpressn.c

6
ChangeLog

@ -1,3 +1,7 @@
2010-01-29 Holger Vogt
* commands.c: gnuplot need two args minimum
* xpressn.c: more characters for real number insertion (up to 15)
2010-01-27 Dietmar Warning
* cpl_ibm1.sp: fix the c matrix unsymmetry
* swec.h: set maximum cpl lines to eight
@ -15,7 +19,7 @@
various files: patches by Robert (Neval, Nintegrate) from Jan 3 2010 and
10 patches from Jan 16, 2010
* com_hardcopy.c: switching graphics context correctly for postscript output
* winmaun.c: parameter 4 to SystemParametersInfo() corrected
* winmain.c: parameter 4 to SystemParametersInfo() corrected
2010-01-16 Dietmar Warning
* tests/transmission: Only few tests should be easier, more examples under

7
src/frontend/commands.c

@ -71,8 +71,7 @@
/* gtri - end - wbk - add include files */
#endif
/* FIXME: Integrate spcp_coms and nutcp_coms into one variable. */
/* for the definition and decription of struct comm see cpdef.h */
/* Bool fields: stringargs, spiceonly, major */
@ -162,7 +161,7 @@ struct comm spcp_coms[] = {
(void (*)()) NULL,
"file plotargs : Send plot to Xgraph-11." } ,
{ "gnuplot", com_gnuplot, FALSE, FALSE, TRUE,
{ 1, 041000, 041000, 041000 }, E_DEFHMASK, 1, LOTS,
{ 1, 041000, 041000, 041000 }, E_DEFHMASK, 2, LOTS,
(void (*)()) NULL,
"file plotargs : Send plot to gnuplot." } ,
{ "hardcopy", com_hardcopy, FALSE, FALSE, TRUE,
@ -574,7 +573,7 @@ struct comm nutcp_coms[] = {
(void (*)()) NULL,
"file plotargs : Send plot to Xgraph-11." } ,
{ "gnuplot", com_gnuplot, FALSE, FALSE, TRUE,
{ 1, 041000, 041000, 041000 }, E_DEFHMASK, 1, LOTS,
{ 1, 041000, 041000, 041000 }, E_DEFHMASK, 2, LOTS,
(void (*)()) NULL,
"file plotargs : Send plot to gnuplot." } ,
{ "hardcopy", com_hardcopy, FALSE, FALSE, TRUE,

32
src/frontend/numparam/xpressn.c

@ -30,6 +30,10 @@ extern char *nupa_inst_name; /* see spicenum.c */
extern long dynsubst; /* see inpcom.c */
extern unsigned int dynLlen;
#define MAX_STRING_INSERT 17 /* max. string length to be inserted and replaced */
#define ACT_CHARACTS 15 /* actual string length to be inserted and replaced */
/* was 10, needs to be less or equal to MAX_STRING_INSERT - 2 */
static double
ternary_fcn (int conditional, double if_value, double else_value)
{
@ -1389,7 +1393,7 @@ evaluate (tdico * dico, char *q, char *t, unsigned char mode)
else
{
strf (u, 17, 10, q);
} /* strf() arg 2 doesnt work: always >10 significant digits ! */ ;
}
}
Strrem(v);
return err;
@ -1570,7 +1574,7 @@ scanline (tdico * dico, char *s, char *r, unsigned char err)
static void
compactfloatnb (char *v)
/* try to squeeze a floating pt format to 10 characters */
/* try to squeeze a floating pt format to MAXCHARACTS characters */
/* erase superfluous 000 digit streams before E */
/* bug: truncating, no rounding */
{
@ -1594,7 +1598,7 @@ compactfloatnb (char *v)
}
k = n - 1; /* mantissa is 0...k */
m = 17;
m = MAX_STRING_INSERT;
while (v[m] != ' ')
m--;
m++;
@ -1603,19 +1607,19 @@ compactfloatnb (char *v)
lem = k - m;
if ((lem + lex) > 10)
lem = 10 - lex;
if ((lem + lex) > ACT_CHARACTS)
lem = ACT_CHARACTS - lex;
pscopy (v, v, m+1, lem);
if (cpos('.', v) > 0) {
while (lem < 6) {
while (lem < ACT_CHARACTS - 4) {
cadd(v, '0');
lem++;
}
} else {
cadd(v, '.');
lem++;
while (lem < 6) {
while (lem < ACT_CHARACTS - 4) {
cadd(v, '0');
lem++;
}
@ -1627,7 +1631,7 @@ compactfloatnb (char *v)
m++;
lem = length(v) - m;
if (lem > 10) lem = 10;
if (lem > ACT_CHARACTS) lem = ACT_CHARACTS;
pscopy (v, v, m+1, lem);
}
}
@ -1646,10 +1650,10 @@ insertnumber (tdico * dico, int i, char *s, char *u)
scopy (v, u);
compactfloatnb (v);
while (length (v) < 17)
while (length (v) < MAX_STRING_INSERT)
cadd (v, ' ');
if (length (v) > 17)
if (length (v) > MAX_STRING_INSERT)
{
scopy (msg, " insertnumber fails: ");
sadd (msg, u);
@ -1683,12 +1687,12 @@ insertnumber (tdico * dico, int i, char *s, char *u)
}
if (found)
{ /* substitute at i-1 */
i--;
for (k = 0; k < 11; k++)
{ /* substitute at i-1-ACT_CHARACTS+11 */
for (k = 0; k < ACT_CHARACTS - 10; k++) i--;
for (k = 0; k < ACT_CHARACTS; k++)
s[i + k] = v[k];
i = i + 17;
i = i + MAX_STRING_INSERT;
}
else

Loading…
Cancel
Save