Add support for the

set function none
	set method none
commands, cause the default extension of ".ft" to be tried on all
loaded fudgit files and adds support for C-style escape sequences in
fudgit commands (which was *implied* in the fudgitrc file distributed
in the sources but apparently never implemented).

Correct some minor typos in the on-line help.
Submitted by:	Don Yuniskis <dgy@rtd.com>
This commit is contained in:
Jean-Marc Zucconi 1996-08-05 14:06:09 +00:00
parent 4eaa69e219
commit dcc7e4d985
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=3528
2 changed files with 337 additions and 0 deletions

216
math/fudgit/files/patch-ab Normal file
View File

@ -0,0 +1,216 @@
*** src/command.c.orig Mon Nov 7 15:23:31 1994
--- src/command.c Mon Aug 5 06:32:38 1996
***************
*** 244,249 ****
--- 244,251 ----
"legendre series: n = 1,...N { Pn(X) }"},
{"lo!rentzian", do_stfunc, "set function lorentzian", "",
"Lorentzian series: n = 3, 6...N { A[n-1]*((X*A[n])^2/((X^2-A[n-2]^2)^2+(X*A[n])^2) }"},
+ {"n!one", do_stfunc, "set function none", "",
+ "none"},
{"p!olynomial", do_stfunc, "set function polynomial", "",
"power series: n = 1,...N { A[n]*X^(n-1) }"},
{"u!ser", do_stfunc, "set function user", "definition",
***************
*** 268,273 ****
--- 270,277 ----
"least square linear regression"},
{"m!l_fit", do_stmeth, "set method ml_fit", "",
"Marquardt-Levenberg iterative nonlinear fit"},
+ {"n!one", do_stmeth, "set method none", "",
+ "none"},
{"s!vd_fit", do_stmeth, "set method svd_fit", "",
"singular value decomposition linear fit"},
{ 0, 0, 0, 0, 0 }
*** src/fudgit.h.orig Thu Sep 8 16:02:47 1994
--- src/fudgit.h Mon Aug 5 06:32:38 1996
***************
*** 97,103 ****
* name.
* Ideally, this exception is left for .fudgitrc.
*/
! /* #define EXTENSION ".ft" */
/* The following are required when defining argument prototypes of
* loaded routines.
*/
--- 97,103 ----
* name.
* Ideally, this exception is left for .fudgitrc.
*/
! #define EXTENSION ".ft"
/* The following are required when defining argument prototypes of
* loaded routines.
*/
*** src/setshow.c.orig Mon Nov 7 07:57:49 1994
--- src/setshow.c Mon Aug 5 06:32:39 1996
***************
*** 67,73 ****
int Ft_Funci;
Meth Ft_Method[METHNUM] = {
! {"none", "none"},
{"ls_r!eg", "least square linear regression"},
{"lad!_reg", "least absolute deviation linear regression"},
{"ls_f!it", "least square linear fit"},
--- 67,73 ----
int Ft_Funci;
Meth Ft_Method[METHNUM] = {
! {"n!one", "none"},
{"ls_r!eg", "least square linear regression"},
{"lad!_reg", "least absolute deviation linear regression"},
{"ls_f!it", "least square linear fit"},
***************
*** 76,82 ****
};
Func Ft_Function[FUNCNUM] = {
! {"none", "none"},
{"str!aight", "straight line"},
{"po!lynomial", "polynomial"},
{"leg!endre", "Legendre polynomial"},
--- 76,82 ----
};
Func Ft_Function[FUNCNUM] = {
! {"n!one", "none"},
{"str!aight", "straight line"},
{"po!lynomial", "polynomial"},
{"leg!endre", "Legendre polynomial"},
*** src/vgetargp.c.orig Fri Sep 2 23:02:47 1994
--- src/vgetargp.c Mon Aug 5 06:32:39 1996
***************
*** 75,93 ****
/* go along the string */
while (*b != '\0' && argno < MAXTOKEN) {
! switch (*b) {
#ifdef BACKSLASH
! case '\\': /* only recognize \$ in non fmodes */
! if (leavequotes == ERRR) {
! leavequotes = ( Ft_almost(p[0], "pm!ode") ||
! Ft_almost(p[0], "cm!ode") ||
! Ft_almost(p[0], "le!t") );
! }
! if (expansion && b[1] != '\n' && (!leavequotes || b[1] == '$')) {
! b++;
! }
! COPY(b);
! break;
#endif
case SQUOTE: /* take following as one string, + turn off exp */
if (leavequotes == 1 || indquotes || inpar) {
--- 75,187 ----
/* go along the string */
while (*b != '\0' && argno < MAXTOKEN) {
! switch (*b)
! {
#ifdef BACKSLASH
! /* add support for C-style escape sequences */
! case '\\':
! {
! if (leavequotes == ERRR) {
! leavequotes = (
! Ft_almost(p[0], "pm!ode") ||
! Ft_almost(p[0], "cm!ode") ||
! Ft_almost(p[0], "le!t") );
! }
!
! /* only recognize escape sequences in non fmodes */
! if (expansion && b[1] != '\n' && (!leavequotes || b[1] == '$')) {
! int dummy = -1;
! int * dptr = &dummy;
! b++; /* skip over '\\' */
!
! switch (*b)
! {
! case '\0':
! break;
! case '\'':
! dummy = '\'';
! break;
! case '\"':
! dummy = '\"';
! break;
! case '$':
! dummy = '$';
! break;
! case '?':
! dummy = '\?';
! break;
! case 'a':
! dummy = '\a';
! break;
! case 'b':
! dummy = '\b';
! break;
! case 'f':
! dummy = '\f';
! break;
! case 'n':
! dummy = '\n';
! break;
! case 'r':
! dummy = '\r';
! break;
! case 't':
! dummy = '\t';
! break;
! case 'x':
! if (!isxdigit(b[1]))
! break;
! b++;
! dummy = tolower(*b) -
! (isdigit(*b) ? '0' : ('a' - 10));
! if (!isxdigit(b[1]))
! break;
! b++;
! dummy *= 16;
! dummy += tolower(*b) -
! (isdigit(*b) ? '0' : ('a' - 10));
! break;
! case 'v':
! dummy = '\v';
! break;
! case '0':
! case '1':
! case '2':
! case '3':
! case '4':
! case '5':
! case '6':
! case '7':
! dummy = *b - '0';
! if ((b[1] < '0') || (b[1] > '7'))
! break;
! b++;
! dummy *= 8;
! dummy += *b - '0';
! if ((b[1] < '0') || (b[1] > '7'))
! break;
! b++;
! dummy *= 8;
! dummy += *b - '0';
! break;
! case '\\':
! dummy = '\\';
! break;
! default:
! break;
! }
! if (dummy < 0) {
! dummy = '\\';
! } else {
! b++;
! }
! COPY(dptr);
! break;
! } else {
! COPY(b);
! break;
! }
! }
#endif
case SQUOTE: /* take following as one string, + turn off exp */
if (leavequotes == 1 || indquotes || inpar) {

121
math/fudgit/files/patch-ac Normal file
View File

@ -0,0 +1,121 @@
*** ./docs/reference.tmpl.orig Mon Nov 7 15:50:52 1994
--- ./docs/reference.tmpl Mon Aug 5 06:34:20 1996
***************
*** 988,994 ****
let String = "new.file"
let x = (String == "new.file")
let y = ("file1" == "file2")
! let Bing = "\a\a\a"
let Here = Cwd # Store the value of the current working directory
let Input = Read() # Read from stdin
let Test = FileName(ReadFile) - ".data"
--- 988,994 ----
let String = "new.file"
let x = (String == "new.file")
let y = ("file1" == "file2")
! let Bing = "\verb+\a+\verb+\a+\verb+\a+"
let Here = Cwd # Store the value of the current working directory
let Input = Read() # Read from stdin
let Test = FileName(ReadFile) - ".data"
***************
*** 996,1002 ****
let y = scan(Read(), "%lf")
let File = "STRING_23.4"
let number = scan("%*[_A-Z]%lf", File)
! let Message = "A tab \t and a newline\n"
\end{verbatim}
@ifhelp
--- 996,1002 ----
let y = scan(Read(), "%lf")
let File = "STRING_23.4"
let number = scan("%*[_A-Z]%lf", File)
! let Message = "A tab \verb+\t+ and a newline\verb+\n+"
\end{verbatim}
@ifhelp
***************
*** 1800,1806 ****
/* You have full use of math and stdio libraries too!!! */
fprintf(stderr,
! "BTW, Did you know that %lf is the sqrt(pi)?\n", sqrt(M_PI));
half_n = n >>1; /* half of n */
for (i=0;i<half_n;i++) { /* Standard C: indices from 0 to data-1 */
--- 1800,1806 ----
/* You have full use of math and stdio libraries too!!! */
fprintf(stderr,
! "BTW, Did you know that %lf is the sqrt(pi)?\verb+\n+", sqrt(M_PI));
half_n = n >>1; /* half of n */
for (i=0;i<half_n;i++) { /* Standard C: indices from 0 to data-1 */
***************
*** 2800,2806 ****
\nopagebreak\begin{verbatim}
set output stdout
cmode
! print x, y, "\n"
\end{verbatim}
@ifhelp
--- 2800,2806 ----
\nopagebreak\begin{verbatim}
set output stdout
cmode
! print x, y, "\verb+\n+"
\end{verbatim}
@ifhelp
***************
*** 2830,2836 ****
cmode
print x+2
print String, x, y, z
! print "Warning \a\a\a", "x = ", x, "\n"
\end{verbatim}
\Seealso
--- 2830,2836 ----
cmode
print x+2
print String, x, y, z
! print "Warning \verb+\a+\verb+\a+\verb+\a+", "x = ", x, "\verb+\n+"
\end{verbatim}
\Seealso
***************
*** 2876,2882 ****
b += a
a = c
}
! print "\n"
}
# The following 'for' loop is equivalent to the preceding fib()
proc fib2(x) {
--- 2876,2882 ----
b += a
a = c
}
! print "\verb+\n+"
}
# The following 'for' loop is equivalent to the preceding fib()
proc fib2(x) {
***************
*** 2885,2891 ****
for(a=0,b=1;b<x;c=b,b+=a,a=c) {
print b
}
! print "\n"
}
fib(1000) # A procedure as called from C-calculator mode.
fmode
--- 2885,2891 ----
for(a=0,b=1;b<x;c=b,b+=a,a=c) {
print b
}
! print "\verb+\n+"
}
fib(1000) # A procedure as called from C-calculator mode.
fmode