Applied patch for maintainer's update.

PR:		ports/30875
Submitted by:	the maintainer
This commit is contained in:
Yoshio MITA 2001-10-09 11:21:39 +00:00
parent eaebd1bcbc
commit c4f8b80b14
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=48597
3 changed files with 395 additions and 427 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= cider PORTNAME= cider
PORTVERSION= 1.b1 PORTVERSION= 1.b1
PORTREVISION= 1 PORTREVISION= 2
CATEGORIES= cad CATEGORIES= cad
MASTER_SITES= ftp://ic.eecs.berkeley.edu/pub/Cider/new/ MASTER_SITES= ftp://ic.eecs.berkeley.edu/pub/Cider/new/
DISTNAME= cider1b1 DISTNAME= cider1b1

View file

@ -1,213 +1,197 @@
*** spice/common/src/bin/main.c.orig Sat Mar 12 08:22:28 1994 --- spice/common/src/bin/main.c.orig Sat Mar 12 08:22:28 1994
--- spice/common/src/bin/main.c Tue Oct 24 03:32:20 2000 +++ spice/common/src/bin/main.c Wed Sep 19 11:06:34 2001
*************** @@ -25,6 +25,13 @@
*** 25,30 **** #include <pwd.h>
--- 25,37 ---- #endif
#include <pwd.h>
#endif
+ #ifdef HAS_GNUREADLINE +#ifdef HAS_GNUREADLINE
+ /* Added GNU Readline Support 11/3/97 -- Andrew Veliath <veliaa@rpi.edu> */ +/* Added GNU Readline Support 11/3/97 -- Andrew Veliath <veliaa@rpi.edu> */
+ #include <readline/readline.h> +#include <readline/readline.h>
+ #include <readline/history.h> +#include <readline/history.h>
+ #include "fteinput.h" +#include "fteinput.h"
+ #endif +#endif
+ +
#ifdef HAS_UNIX_SIGS #ifdef HAS_UNIX_SIGS
#include <signal.h> #include <signal.h>
#endif #endif
*************** @@ -36,6 +43,11 @@
*** 36,41 **** #endif
--- 43,53 ----
#endif
#include "patchlev.h" #include "patchlev.h"
+ +
+ #ifdef __FreeBSD__ +#ifdef __FreeBSD__
+ #include <ieeefp.h> +#include <ieeefp.h>
+ #endif +#endif
+ +
#include "suffix.h" #include "suffix.h"
/* (Virtual) Machine architecture parameters */ /* (Virtual) Machine architecture parameters */
*************** @@ -53,6 +65,11 @@
*** 53,58 **** bool ft_intrpt = false; /* Set by the (void) signal handlers. */
--- 65,75 ---- bool ft_setflag = false; /* Don't abort after an interrupt. */
bool ft_intrpt = false; /* Set by the (void) signal handlers. */
bool ft_setflag = false; /* Don't abort after an interrupt. */
+ #ifdef HAS_GNUREADLINE +#ifdef HAS_GNUREADLINE
+ char gnu_history_file[512]; +char gnu_history_file[512];
+ static char *application_name; +static char *application_name;
+ #endif +#endif
+ +
struct variable *(*if_getparam)( ); struct variable *(*if_getparam)( );
#ifdef BATCH #ifdef BATCH
*************** @@ -185,6 +202,95 @@
*** 185,190 ****
--- 202,294 ----
#endif #endif
+ #ifdef HAS_GNUREADLINE +#ifdef HAS_GNUREADLINE
+ /* Adapted ../lib/cp/lexical.c:prompt() for GNU Readline -- Andrew Veliath <veliaa@rpi.edu> */ +/* Adapted ../lib/cp/lexical.c:prompt() for GNU Readline -- Andrew Veliath <veliaa@rpi.edu> */
+ static char * +static char *
+ prompt() +prompt()
+ { +{
+ static char pbuf[128]; + static char pbuf[128];
+ int n = sizeof(pbuf); + int n = sizeof(pbuf);
+ char *p = pbuf, *s; + char *p = pbuf, *s;
+ +
+ if (cp_interactive == false) + if (cp_interactive == false)
+ return; + return;
+ if (cp_promptstring == NULL) + if (cp_promptstring == NULL)
+ s = "-> "; + s = "-> ";
+ else + else
+ s = cp_promptstring; + s = cp_promptstring;
+ if (cp_altprompt) + if (cp_altprompt)
+ s = cp_altprompt; + s = cp_altprompt;
+ while (*s && (n > 1)) { + while (*s && (n > 1)) {
+ int w; + int w;
+ switch (strip(*s)) { + switch (strip(*s)) {
+ case '!': + case '!':
+ w = snprintf(p, n, "%d", where_history() + 1); + w = snprintf(p, n, "%d", where_history() + 1);
+ w = (w >= n) ? n - 1 : w; + w = (w >= n) ? n - 1 : w;
+ p += w; + p += w;
+ n -= w; + n -= w;
+ break; + break;
+ default: + case '\\':
+ *p = strip(*s); ++p; + if (*(s + 1)) ++s;
+ --n; + default:
+ break; + *p = strip(*s); ++p;
+ } + --n;
+ s++; + break;
+ } + }
+ *p = 0; + s++;
+ return pbuf; + }
+ } + *p = 0;
+ return pbuf;
+}
+ +
+ /* Process device events in Readline's hook since there is no where +/* Process device events in Readline's hook since there is no where
+ else to do it now - AV */ + else to do it now - AV */
+ int rl_event_func() +int rl_event_func()
+ { +{
+ static REQUEST reqst = { checkup_option, 0 }; + static REQUEST reqst = { checkup_option, 0 };
+ Input(&reqst, NULL); + Input(&reqst, NULL);
+ return 0; + return 0;
+ } +}
+ +
+ /* Added GNU Readline Support -- Andrew Veliath <veliaa@rpi.edu> */ +/* Added GNU Readline Support -- Andrew Veliath <veliaa@rpi.edu> */
+ void app_rl_readlines() +void app_rl_readlines()
+ { +{
+ char *line, *expanded_line; + char *line, *expanded_line;
+ +
+ strcpy(gnu_history_file, getenv("HOME")); + strcpy(gnu_history_file, getenv("HOME"));
+ strcat(gnu_history_file, "/."); + strcat(gnu_history_file, "/.");
+ strcat(gnu_history_file, application_name); + strcat(gnu_history_file, application_name);
+ strcat(gnu_history_file, "_history"); + strcat(gnu_history_file, "_history");
+ +
+ using_history(); + using_history();
+ read_history(gnu_history_file); + read_history(gnu_history_file);
+ +
+ rl_readline_name = application_name; + rl_readline_name = application_name;
+ rl_instream = cp_in; + rl_instream = cp_in;
+ rl_outstream = cp_out; + rl_outstream = cp_out;
+ rl_event_hook = rl_event_func; + rl_event_hook = rl_event_func;
+ +
+ while (1) { + while (1) {
+ history_set_pos(history_length); + history_set_pos(history_length);
+ line = readline(prompt()); + line = readline(prompt());
+ if (line && *line) { + if (line && *line) {
+ int s = history_expand(line, &expanded_line); + int s = history_expand(line, &expanded_line);
+ +
+ if (s == 2) { + if (s == 2) {
+ fprintf(stderr, "-> %s\n", expanded_line); + fprintf(stderr, "-> %s\n", expanded_line);
+ } else if (s == -1) { + } else if (s == -1) {
+ fprintf(stderr, "readline: %s\n", expanded_line); + fprintf(stderr, "readline: %s\n", expanded_line);
+ } else { + } else {
+ cp_evloop(expanded_line); + cp_evloop(expanded_line);
+ add_history(expanded_line); + add_history(expanded_line);
+ } + }
+ free(expanded_line); + free(expanded_line);
+ } + }
+ if (line) free(line); + if (line) free(line);
+ else if (line == NULL) cp_evloop("quit"); + else if (line == NULL) cp_evloop("quit");
+ } + }
+ /* History gets written in ../fte/misccoms.c com_quit */ + /* History gets written in ../fte/misccoms.c com_quit */
+ } +}
+ #endif /* HAS_GNUREADLINE */ +#endif /* HAS_GNUREADLINE */
+ +
char *hlp_filelist[] = { "spice", 0 }; char *hlp_filelist[] = { "spice", 0 };
void void
*************** @@ -216,6 +322,10 @@
*** 216,221 ****
--- 320,329 ----
#endif #endif
+ #ifdef __FreeBSD__ +#ifdef __FreeBSD__
+ fpsetmask(fpgetmask() & ~FP_X_INV & ~FP_X_DZ & ~FP_X_OFL); + fpsetmask(fpgetmask() & ~FP_X_INV & ~FP_X_DZ & ~FP_X_OFL);
+ #endif +#endif
+ +
/* MFB tends to jump to 0 on errors. This tends to catch it. */ /* MFB tends to jump to 0 on errors. This tends to catch it. */
if (started) { if (started) {
fprintf(cp_err, "main: Internal Error: jump to zero\n"); fprintf(cp_err, "main: Internal Error: jump to zero\n");
*************** @@ -236,6 +346,13 @@
*** 236,241 **** ARCHsize = 1;
--- 344,356 ---- #endif /* PARALLEL_ARCH */
ARCHsize = 1;
#endif /* PARALLEL_ARCH */
+ #ifdef HAS_GNUREADLINE +#ifdef HAS_GNUREADLINE
+ if (!(application_name = strrchr(av[0],'/'))) + if (!(application_name = strrchr(av[0],'/')))
+ application_name = av[0]; + application_name = av[0];
+ else + else
+ ++application_name; + ++application_name;
+ #endif +#endif
+ +
#ifdef HAS_MAC_ARGCARGV #ifdef HAS_MAC_ARGCARGV
ac = initmac(&av); ac = initmac(&av);
#endif #endif
*************** @@ -472,7 +589,11 @@
*** 472,478 **** # ifdef HAS_UNIX_SIGS
--- 587,597 ---- /* Set up (void) signal handling */
# ifdef HAS_UNIX_SIGS if (!ft_batchmode) {
/* Set up (void) signal handling */ +# ifdef HAS_GNUREADLINE
if (!ft_batchmode) { + (void) signal(SIGINT, SIG_IGN);
+ # ifdef HAS_GNUREADLINE +# else
+ (void) signal(SIGINT, SIG_IGN); (void) signal(SIGINT, ft_sigintr);
+ # else +# endif
(void) signal(SIGINT, ft_sigintr); (void) signal(SIGFPE, sigfloat);
+ # endif # ifdef SIGTSTP
(void) signal(SIGFPE, sigfloat); (void) signal(SIGTSTP, sigstop);
# ifdef SIGTSTP @@ -668,7 +789,11 @@
(void) signal(SIGTSTP, sigstop); } else {
*************** (void) setjmp(jbuf);
*** 668,674 **** cp_interactive = true;
--- 787,797 ---- +#ifdef HAS_GNUREADLINE
} else { + app_rl_readlines();
(void) setjmp(jbuf); +#else
cp_interactive = true; while (cp_evloop((char *) NULL) == 1) ;
+ #ifdef HAS_GNUREADLINE +#endif /* ifelse HAS_GNUREADLINE */
+ app_rl_readlines(); }
+ #else
while (cp_evloop((char *) NULL) == 1) ;
+ #endif /* ifelse HAS_GNUREADLINE */
}
# else /* if BATCH */ # else /* if BATCH */
*************** @@ -708,7 +833,11 @@
*** 708,714 **** /* Nutmeg "main" */
--- 831,841 ---- (void) setjmp(jbuf);
/* Nutmeg "main" */ cp_interactive = true;
(void) setjmp(jbuf); +#ifdef HAS_GNUREADLINE
cp_interactive = true; + app_rl_readlines();
+ #ifdef HAS_GNUREADLINE +#else
+ app_rl_readlines(); while (cp_evloop((char *) NULL) == 1) ;
+ #else +#endif /* ifelse HAS_GNUREADLINE */
while (cp_evloop((char *) NULL) == 1) ;
+ #endif /* ifelse HAS_GNUREADLINE */
#endif #endif

View file

@ -1,213 +1,197 @@
*** cider/common/src/bin/main.c.orig Sat Mar 12 08:20:59 1994 --- cider/common/src/bin/main.c.orig Sat Mar 12 08:20:59 1994
--- cider/common/src/bin/main.c Tue Oct 24 03:37:38 2000 +++ cider/common/src/bin/main.c Wed Sep 19 11:07:47 2001
*************** @@ -25,6 +25,13 @@
*** 25,30 **** #include <pwd.h>
--- 25,37 ---- #endif
#include <pwd.h>
#endif
+ #ifdef HAS_GNUREADLINE +#ifdef HAS_GNUREADLINE
+ /* Added GNU Readline Support 11/3/97 -- Andrew Veliath <veliaa@rpi.edu> */ +/* Added GNU Readline Support 11/3/97 -- Andrew Veliath <veliaa@rpi.edu> */
+ #include <readline/readline.h> +#include <readline/readline.h>
+ #include <readline/history.h> +#include <readline/history.h>
+ #include "fteinput.h" +#include "fteinput.h"
+ #endif +#endif
+ +
#ifdef HAS_UNIX_SIGS #ifdef HAS_UNIX_SIGS
#include <signal.h> #include <signal.h>
#endif #endif
*************** @@ -36,6 +43,11 @@
*** 36,41 **** #endif
--- 43,53 ----
#endif
#include "patchlev.h" #include "patchlev.h"
+ +
+ #ifdef __FreeBSD__ +#ifdef __FreeBSD__
+ #include <ieeefp.h> +#include <ieeefp.h>
+ #endif +#endif
+ +
#include "suffix.h" #include "suffix.h"
/* (Virtual) Machine architecture parameters */ /* (Virtual) Machine architecture parameters */
*************** @@ -53,6 +65,11 @@
*** 53,58 **** bool ft_intrpt = false; /* Set by the (void) signal handlers. */
--- 65,75 ---- bool ft_setflag = false; /* Don't abort after an interrupt. */
bool ft_intrpt = false; /* Set by the (void) signal handlers. */
bool ft_setflag = false; /* Don't abort after an interrupt. */
+ #ifdef HAS_GNUREADLINE +#ifdef HAS_GNUREADLINE
+ char gnu_history_file[512]; +char gnu_history_file[512];
+ static char *application_name; +static char *application_name;
+ #endif +#endif
+ +
struct variable *(*if_getparam)( ); struct variable *(*if_getparam)( );
#ifdef BATCH #ifdef BATCH
*************** @@ -185,6 +202,95 @@
*** 185,190 ****
--- 202,294 ----
#endif #endif
+ #ifdef HAS_GNUREADLINE +#ifdef HAS_GNUREADLINE
+ /* Adapted ../lib/cp/lexical.c:prompt() for GNU Readline -- Andrew Veliath <veliaa@rpi.edu> */ +/* Adapted ../lib/cp/lexical.c:prompt() for GNU Readline -- Andrew Veliath <veliaa@rpi.edu> */
+ static char * +static char *
+ prompt() +prompt()
+ { +{
+ static char pbuf[128]; + static char pbuf[128];
+ int n = sizeof(pbuf); + int n = sizeof(pbuf);
+ char *p = pbuf, *s; + char *p = pbuf, *s;
+ +
+ if (cp_interactive == false) + if (cp_interactive == false)
+ return; + return;
+ if (cp_promptstring == NULL) + if (cp_promptstring == NULL)
+ s = "-> "; + s = "-> ";
+ else + else
+ s = cp_promptstring; + s = cp_promptstring;
+ if (cp_altprompt) + if (cp_altprompt)
+ s = cp_altprompt; + s = cp_altprompt;
+ while (*s && (n > 1)) { + while (*s && (n > 1)) {
+ int w; + int w;
+ switch (strip(*s)) { + switch (strip(*s)) {
+ case '!': + case '!':
+ w = snprintf(p, n, "%d", where_history() + 1); + w = snprintf(p, n, "%d", where_history() + 1);
+ w = (w >= n) ? n - 1 : w; + w = (w >= n) ? n - 1 : w;
+ p += w; + p += w;
+ n -= w; + n -= w;
+ break; + break;
+ default: + case '\\':
+ *p = strip(*s); ++p; + if (*(s + 1)) ++s;
+ --n; + default:
+ break; + *p = strip(*s); ++p;
+ } + --n;
+ s++; + break;
+ } + }
+ *p = 0; + s++;
+ return pbuf; + }
+ } + *p = 0;
+ return pbuf;
+}
+ +
+ /* Process device events in Readline's hook since there is no where +/* Process device events in Readline's hook since there is no where
+ else to do it now - AV */ + else to do it now - AV */
+ int rl_event_func() +int rl_event_func()
+ { +{
+ static REQUEST reqst = { checkup_option, 0 }; + static REQUEST reqst = { checkup_option, 0 };
+ Input(&reqst, NULL); + Input(&reqst, NULL);
+ return 0; + return 0;
+ } +}
+ +
+ /* Added GNU Readline Support -- Andrew Veliath <veliaa@rpi.edu> */ +/* Added GNU Readline Support -- Andrew Veliath <veliaa@rpi.edu> */
+ void app_rl_readlines() +void app_rl_readlines()
+ { +{
+ char *line, *expanded_line; + char *line, *expanded_line;
+ +
+ strcpy(gnu_history_file, getenv("HOME")); + strcpy(gnu_history_file, getenv("HOME"));
+ strcat(gnu_history_file, "/."); + strcat(gnu_history_file, "/.");
+ strcat(gnu_history_file, application_name); + strcat(gnu_history_file, application_name);
+ strcat(gnu_history_file, "_history"); + strcat(gnu_history_file, "_history");
+ +
+ using_history(); + using_history();
+ read_history(gnu_history_file); + read_history(gnu_history_file);
+ +
+ rl_readline_name = application_name; + rl_readline_name = application_name;
+ rl_instream = cp_in; + rl_instream = cp_in;
+ rl_outstream = cp_out; + rl_outstream = cp_out;
+ rl_event_hook = rl_event_func; + rl_event_hook = rl_event_func;
+ +
+ while (1) { + while (1) {
+ history_set_pos(history_length); + history_set_pos(history_length);
+ line = readline(prompt()); + line = readline(prompt());
+ if (line && *line) { + if (line && *line) {
+ int s = history_expand(line, &expanded_line); + int s = history_expand(line, &expanded_line);
+ +
+ if (s == 2) { + if (s == 2) {
+ fprintf(stderr, "-> %s\n", expanded_line); + fprintf(stderr, "-> %s\n", expanded_line);
+ } else if (s == -1) { + } else if (s == -1) {
+ fprintf(stderr, "readline: %s\n", expanded_line); + fprintf(stderr, "readline: %s\n", expanded_line);
+ } else { + } else {
+ cp_evloop(expanded_line); + cp_evloop(expanded_line);
+ add_history(expanded_line); + add_history(expanded_line);
+ } + }
+ free(expanded_line); + free(expanded_line);
+ } + }
+ if (line) free(line); + if (line) free(line);
+ else if (line == NULL) cp_evloop("quit"); + else if (line == NULL) cp_evloop("quit");
+ } + }
+ /* History gets written in ../fte/misccoms.c com_quit */ + /* History gets written in ../fte/misccoms.c com_quit */
+ } +}
+ #endif /* HAS_GNUREADLINE */ +#endif /* HAS_GNUREADLINE */
+ +
char *hlp_filelist[] = { "spice", "cider", 0 }; char *hlp_filelist[] = { "spice", "cider", 0 };
void void
*************** @@ -216,6 +322,10 @@
*** 216,221 ****
--- 320,329 ----
#endif #endif
+ #ifdef __FreeBSD__ +#ifdef __FreeBSD__
+ fpsetmask(fpgetmask() & ~FP_X_INV & ~FP_X_DZ & ~FP_X_OFL); + fpsetmask(fpgetmask() & ~FP_X_INV & ~FP_X_DZ & ~FP_X_OFL);
+ #endif +#endif
+ +
/* MFB tends to jump to 0 on errors. This tends to catch it. */ /* MFB tends to jump to 0 on errors. This tends to catch it. */
if (started) { if (started) {
fprintf(cp_err, "main: Internal Error: jump to zero\n"); fprintf(cp_err, "main: Internal Error: jump to zero\n");
*************** @@ -236,6 +346,13 @@
*** 236,241 **** ARCHsize = 1;
--- 344,356 ---- #endif /* PARALLEL_ARCH */
ARCHsize = 1;
#endif /* PARALLEL_ARCH */
+ #ifdef HAS_GNUREADLINE +#ifdef HAS_GNUREADLINE
+ if (!(application_name = strrchr(av[0],'/'))) + if (!(application_name = strrchr(av[0],'/')))
+ application_name = av[0]; + application_name = av[0];
+ else + else
+ ++application_name; + ++application_name;
+ #endif +#endif
+ +
#ifdef HAS_MAC_ARGCARGV #ifdef HAS_MAC_ARGCARGV
ac = initmac(&av); ac = initmac(&av);
#endif #endif
*************** @@ -472,7 +589,11 @@
*** 472,478 **** # ifdef HAS_UNIX_SIGS
--- 587,597 ---- /* Set up (void) signal handling */
# ifdef HAS_UNIX_SIGS if (!ft_batchmode) {
/* Set up (void) signal handling */ +# ifdef HAS_GNUREADLINE
if (!ft_batchmode) { + (void) signal(SIGINT, SIG_IGN);
+ # ifdef HAS_GNUREADLINE +# else
+ (void) signal(SIGINT, SIG_IGN); (void) signal(SIGINT, ft_sigintr);
+ # else +# endif
(void) signal(SIGINT, ft_sigintr); (void) signal(SIGFPE, sigfloat);
+ # endif # ifdef SIGTSTP
(void) signal(SIGFPE, sigfloat); (void) signal(SIGTSTP, sigstop);
# ifdef SIGTSTP @@ -668,7 +789,11 @@
(void) signal(SIGTSTP, sigstop); } else {
*************** (void) setjmp(jbuf);
*** 668,674 **** cp_interactive = true;
--- 787,797 ---- +#ifdef HAS_GNUREADLINE
} else { + app_rl_readlines();
(void) setjmp(jbuf); +#else
cp_interactive = true; while (cp_evloop((char *) NULL) == 1) ;
+ #ifdef HAS_GNUREADLINE +#endif /* ifelse HAS_GNUREADLINE */
+ app_rl_readlines(); }
+ #else
while (cp_evloop((char *) NULL) == 1) ;
+ #endif /* ifelse HAS_GNUREADLINE */
}
# else /* if BATCH */ # else /* if BATCH */
*************** @@ -708,7 +833,11 @@
*** 708,714 **** /* Nutmeg "main" */
--- 831,841 ---- (void) setjmp(jbuf);
/* Nutmeg "main" */ cp_interactive = true;
(void) setjmp(jbuf); +#ifdef HAS_GNUREADLINE
cp_interactive = true; + app_rl_readlines();
+ #ifdef HAS_GNUREADLINE +#else
+ app_rl_readlines(); while (cp_evloop((char *) NULL) == 1) ;
+ #else +#endif /* ifelse HAS_GNUREADLINE */
while (cp_evloop((char *) NULL) == 1) ;
+ #endif /* ifelse HAS_GNUREADLINE */
#endif #endif