Jspice3
cpextern.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void cp_doalias ()
 
void cp_setalias ()
 
void cp_unalias ()
 
void cp_paliases ()
 
void com_alias ()
 
void com_unalias ()
 
void cp_bquote ()
 
void cp_ccom ()
 
wordlistcp_cctowl ()
 
void cp_ccon ()
 
bool cp_comlook ()
 
void cp_addcomm ()
 
void cp_remcomm ()
 
void cp_addkword ()
 
void cp_remkword ()
 
char * cp_kwswitch ()
 
void cp_ccfreetrie ()
 
void cp_ccrestart ()
 
void cp_init ()
 
wordlistcp_parse ()
 
void com_echo ()
 
void cp_redirect ()
 
void cp_ioreset ()
 
void cp_fixdescriptors ()
 
void com_shell ()
 
void com_rehash ()
 
void com_chdir ()
 
void com_strcmp ()
 
void com_codeblock ()
 
void cp_addblock ()
 
bool cp_isblockdef ()
 
void cp_freeblock ()
 
int cp_evloop ()
 
void cp_execcontrol ()
 
void cp_resetcontrol ()
 
void cp_popcontrol ()
 
void cp_pushcontrol ()
 
void cp_toplevel ()
 
void com_cdump ()
 
void cp_doglob ()
 
char * cp_tildexpand ()
 
void cp_pathfix ()
 
bool cp_globmatch ()
 
void cp_histsubst ()
 
void cp_addhistent ()
 
void cp_hprint ()
 
void com_history ()
 
wordlistcp_lexer ()
 
int cp_inchar ()
 
void out_winsize ()
 
void out_init ()
 
void out_send ()
 
void out_printf ()
 
void out_wlprint ()
 
void cp_wstrip ()
 
void cp_quoteword ()
 
void cp_printword ()
 
void cp_striplist ()
 
void cp_unquote ()
 
void cp_rehash ()
 
bool cp_unixcom ()
 
void cp_hstat ()
 
void cp_variablesubst ()
 
void cp_vprint ()
 
wordlistcp_varwl ()
 
void cp_vset ()
 
void cp_remvar ()
 
void com_set ()
 
struct variablecp_setparse ()
 
void com_unset ()
 
void com_shift ()
 
bool cp_getvar ()
 
struct variablecp_getvlist ()
 
void va_free ()
 
struct variableva_copy ()
 
void cp_pusharg ()
 
void cp_poparg ()
 
void ft_cpinit ()
 
bool cp_istrue ()
 
void cp_periodic ()
 
void cp_doquit ()
 
bool cp_oddcomm ()
 
bool cp_block ()
 
void cp_bind ()
 
void cp_unbind ()
 
double * ft_numparse ()
 
struct variablecp_enqvar ()
 
void cp_usrvars ()
 
int cp_usrset ()
 
void fatal ()
 

Variables

struct aliascp_aliases
 
char cp_back
 
bool cp_nocc
 
FILE * cp_in
 
FILE * cp_out
 
FILE * cp_err
 
FILE * cp_curin
 
FILE * cp_curout
 
FILE * cp_curerr
 
bool cp_debug
 
char cp_amp
 
char cp_gt
 
char cp_lt
 
char cp_chars []
 
bool cp_cwait
 
bool cp_dounixcom
 
char * cp_csep
 
char cp_cbrac
 
char cp_ccurl
 
char cp_comma
 
char cp_huh
 
char cp_obrac
 
char cp_ocurl
 
char cp_star
 
char cp_til
 
bool cp_didhsubst
 
char cp_bang
 
char cp_hat
 
int cp_maxhistlength
 
struct histentcp_lastone
 
FILE * cp_inp_cur
 
bool cp_bqflag
 
bool cp_interactive
 
char * cp_altprompt
 
char * cp_promptstring
 
char cp_hash
 
int cp_event
 
bool out_moremode
 
bool out_isatty
 
int out_width
 
int out_height
 
bool cp_ignoreeof
 
bool cp_noclobber
 
bool cp_noglob
 
bool cp_nonomatch
 
char cp_dol
 
struct commcp_coms
 
char * cp_program
 
char * cp_display
 
bool ft_nutmeg
 

Function Documentation

void com_alias ( )
void com_cdump ( )
void com_chdir ( )
void com_codeblock ( )
void com_echo ( )
void com_history ( )
void com_rehash ( )
void com_set ( )
void com_shell ( )
void com_shift ( )
void com_strcmp ( )
void com_unalias ( )
void com_unset ( )
void cp_addblock ( )
void cp_addcomm ( )
void cp_addhistent ( )
void cp_addkword ( )
void cp_bind ( )
bool cp_block ( )
void cp_bquote ( )
void cp_ccfreetrie ( )
void cp_ccom ( )
void cp_ccon ( )
void cp_ccrestart ( )
wordlist* cp_cctowl ( )
bool cp_comlook ( )
void cp_doalias ( )
void cp_doglob ( )
void cp_doquit ( )

Definition at line 329 of file cpitf.c.

330 {
331  com_quit((wordlist *) NULL);
332  return;
333 }
void com_quit()
#define NULL
Definition: spdefs.h:121
Definition: cpstd.h:21
struct variable* cp_enqvar ( )
int cp_evloop ( )
void cp_execcontrol ( )
void cp_fixdescriptors ( )

Definition at line 454 of file cshpar.c.

455 {
456  if (cp_in != stdin)
457  (void) dup2(fileno(cp_in), fileno(stdin));
458  if (cp_out != stdout)
459  (void) dup2(fileno(cp_out), fileno(stdout));
460  if (cp_err != stderr)
461  (void) dup2(fileno(cp_err), fileno(stderr));
462  return;
463 }
FILE * cp_err
Definition: cshpar.c:69
FILE * cp_in
Definition: cshpar.c:67
FILE * cp_out
Definition: cshpar.c:68
void cp_freeblock ( )
bool cp_getvar ( )
struct variable* cp_getvlist ( )
bool cp_globmatch ( )
void cp_histsubst ( )
void cp_hprint ( )
void cp_hstat ( )

Definition at line 215 of file unixcom.c.

216 {
217  htab_print(hashtabp,"i = %d, name = %s, path = %s\n");
218  htab_print(hashtabc,"i = %d, name = %s, path = %s\n");
219  htab_print(hashtabs,"i = %d, name = %s, path = %s\n");
220 }
static void * hashtabs
Definition: unixcom.c:39
static void * hashtabp
Definition: unixcom.c:37
static void * hashtabc
Definition: unixcom.c:38
void htab_print()
int cp_inchar ( )
void cp_init ( )

Definition at line 83 of file cshpar.c.

86 {
87  char *s, *singlec = "<>;&";
88 
90  bzero(cp_chars, 128);
91  for (s = singlec; *s; s++)
92  cp_chars[*s] = (CPC_BRR | CPC_BRL);
93  cp_vset("history", VT_NUM, (char *) &cp_maxhistlength);
94 
95  cp_curin = stdin;
96  cp_curout = stdout;
97  cp_curerr = stderr;
98 
99  cp_ioreset();
100 }
void cp_vset()
Definition: cddefs.h:119
#define CPC_BRL
Definition: cpdefs.h:67
void cp_internal_init()
Definition: options.c:555
FILE * cp_curout
Definition: cshpar.c:76
int bzero(char *ptr, int num)
Definition: string.c:357
void cp_ioreset()
Definition: cshpar.c:349
#define VT_NUM
Definition: cpstd.h:61
FILE * cp_curerr
Definition: cshpar.c:77
#define CPC_BRR
Definition: cpdefs.h:66
char cp_chars[128]
Definition: cshpar.c:79
FILE * cp_curin
Definition: cshpar.c:75
int cp_maxhistlength
Definition: history.c:35
void cp_ioreset ( )

Definition at line 349 of file cshpar.c.

350 {
351  // Careful not to double-close ">&" output.
352  FILE *fo = 0;
353  if (cp_in != cp_curin) {
354  if (cp_in && cp_in != stdin)
355  (void) fclose(cp_in);
356  cp_in = cp_curin;
357  }
358  if (cp_out != cp_curout) {
359  if (cp_out && cp_out != stdout) {
360  fo = cp_out;
361  (void) fclose(cp_out);
362  }
363  cp_out = cp_curout;
364  }
365  if (cp_err != cp_curerr) {
366  if (cp_err && cp_err != stderr && cp_err != stdout && cp_err != fo)
367  (void) fclose(cp_err);
368  cp_err = cp_curerr;
369  }
370 
371  /*** Minor bug here... */
372  out_isatty = true;
373  return;
374 }
FILE * cp_err
Definition: cshpar.c:69
FILE * cp_curout
Definition: cshpar.c:76
FILE * cp_in
Definition: cshpar.c:67
bool out_isatty
Definition: output.c:45
FILE * cp_curerr
Definition: cshpar.c:77
FILE * cp_curin
Definition: cshpar.c:75
FILE * cp_out
Definition: cshpar.c:68
bool cp_isblockdef ( )
bool cp_istrue ( )
char* cp_kwswitch ( )
wordlist* cp_lexer ( )
bool cp_oddcomm ( )
void cp_paliases ( )
wordlist* cp_parse ( )
void cp_pathfix ( )
void cp_periodic ( )

Definition at line 318 of file cpitf.c.

319 {
320  ft_setflag = ft_intrpt = false;
321  ft_ckspace();
322  ft_checkkids();
323  vec_gc();
324  return;
325 }
bool ft_intrpt
Definition: main.c:47
void vec_gc()
Definition: vectors.c:681
bool ft_setflag
Definition: main.c:48
void ft_checkkids()
Definition: aspice.c:449
void ft_ckspace()
Definition: resource.c:91
void cp_poparg ( )

Definition at line 1500 of file variable.c.

1502 {
1503  struct variable *vv, *vc, **pv = NULL;
1504  int *pc = NULL;
1505 
1506  if (stackp == 0)
1507  return;
1508 
1509  vv = (struct variable *)htab_get("argv",variables);
1510  if (vv)
1511  pv = &vv->va_vlist;
1512  vc = (struct variable *)htab_get("argc",variables);
1513  if (vc)
1514  pc = &vc->va_num;
1515 
1516  if (pc && pv) {
1517  stackp--;
1518  if (stackp == 0) {
1519 
1520  htab_delete("argv",variables);
1521  htab_delete("argc",variables);
1522  va_free(vv);
1523  va_free(vc);
1524  }
1525  else {
1526  va_free(*pv);
1527  *pv = av_stack[stackp].av;
1528  *pc = av_stack[stackp].ac;
1529  }
1530  }
1531 }
void va_free(struct variable *v)
Definition: variable.c:1357
void htab_delete()
static int stackp
Definition: variable.c:1421
#define NULL
Definition: spdefs.h:121
int ac
Definition: variable.c:1414
struct variable * av
Definition: variable.c:1415
static void * variables
Definition: variable.c:53
static struct avstack av_stack[DEPTH]
Definition: variable.c:1420
void * htab_get()
struct mfbpc pc
Definition: mfbopen.c:14
Definition: cpstd.h:41
void cp_popcontrol ( )

Definition at line 1051 of file front.c.

1054 {
1055  if (cp_debug)
1056  fprintf(cp_err, "pop: stackp: %d -> %d\n", stackp, stackp - 1);
1057  if (stackp < 1)
1058  fprintf(cp_err, "cp_popcontrol: Internal Error: stack empty\n");
1059  else
1060  stackp--;
1061  return;
1062 }
static int stackp
Definition: front.c:70
FILE * cp_err
Definition: help.c:101
bool cp_debug
Definition: cshpar.c:61
void cp_printword ( )
void cp_pusharg ( )
void cp_pushcontrol ( )

Definition at line 1066 of file front.c.

1067 {
1068  if (cp_debug)
1069  fprintf(cp_err, "push: stackp: %d -> %d\n", stackp, stackp + 1);
1070  if (stackp > CONTROLSTACKSIZE - 2) {
1071  fprintf(cp_err, "Error: stack overflow -- max depth = %d\n",
1073  stackp = 0;
1074  }
1075  else {
1076  stackp++;
1078  control[stackp] = cend[stackp] = NULL;
1079  }
1080  return;
1081 }
static int stackp
Definition: front.c:70
#define CONTROLSTACKSIZE
Definition: front.c:67
static struct control * cend[CONTROLSTACKSIZE]
Definition: front.c:69
FILE * cp_err
Definition: help.c:101
#define NULL
Definition: spdefs.h:121
Definition: front.c:25
static void freecontrol()
bool cp_debug
Definition: cshpar.c:61
void cp_quoteword ( )
void cp_redirect ( )
void cp_rehash ( )
void cp_remcomm ( )
void cp_remkword ( )
void cp_remvar ( )
void cp_resetcontrol ( )

Definition at line 1033 of file front.c.

1036 {
1037  if (cend[stackp] && cend[stackp]->co_parent)
1038  fprintf(cp_err, "Warning: EOF before block terminated\n");
1039  for (stackp = 0; stackp < CONTROLSTACKSIZE; stackp++) {
1040  if (!control[stackp]) break;
1041  freecontrol(control[stackp]);
1042  control[stackp] = cend[stackp] = NULL;
1043  }
1044  stackp = 0;
1045  (void) cp_kwswitch(CT_LABEL, (char *) NULL);
1046  return;
1047 }
static int stackp
Definition: front.c:70
#define CONTROLSTACKSIZE
Definition: front.c:67
static struct control * cend[CONTROLSTACKSIZE]
Definition: front.c:69
FILE * cp_err
Definition: help.c:101
#define NULL
Definition: spdefs.h:121
Definition: front.c:25
#define CT_LABEL
Definition: cpdefs.h:78
static void freecontrol()
char * cp_kwswitch()
void cp_setalias ( )
struct variable* cp_setparse ( )
void cp_striplist ( )
char* cp_tildexpand ( )
void cp_toplevel ( )

Definition at line 1086 of file front.c.

1089 {
1090  stackp = 0;
1091  if (cend[stackp])
1092  while (cend[stackp]->co_parent)
1094  return;
1095 }
static int stackp
Definition: front.c:70
static struct control * cend[CONTROLSTACKSIZE]
Definition: front.c:69
struct control * co_parent
Definition: front.c:31
void cp_unalias ( )
void cp_unbind ( )
bool cp_unixcom ( )
void cp_unquote ( )
int cp_usrset ( )
void cp_usrvars ( )
void cp_variablesubst ( )
wordlist* cp_varwl ( )
void cp_vprint ( )

Definition at line 638 of file variable.c.

639 {
640  struct variable *v;
641  struct variable *uv1, *uv2;
642  wordlist *wl, *wl0;
643  int i, j;
644  char *s;
645  struct xxx *vars;
646 
647  cp_usrvars(&uv1, &uv2);
648 
649  for (v = uv1, i = 0; v; v = v->va_next)
650  i++;
651  for (v = uv2; v; v = v->va_next)
652  i++;
653  wl0 = (wordlist*)htab_list(variables);
654  i += wl_length(wl0);
655 
656  vars = (struct xxx *) tmalloc(sizeof (struct xxx) * i);
657 
658  for (wl = wl0, i = 0; wl; wl = wl->wl_next, i++) {
659  vars[i].x_v = (struct variable*)((char**)wl->wl_word)[1];
660  vars[i].x_char = ' ';
661  }
662  for (v = uv1; v; v = v->va_next, i++) {
663  vars[i].x_v = v;
664  vars[i].x_char = '*';
665  }
666  for (v = uv2; v; v = v->va_next, i++) {
667  vars[i].x_v = v;
668  vars[i].x_char = '+';
669  }
670 
671  qsort((char *) vars, i, sizeof (struct xxx), vcmp);
672 
673  out_send("\n");
674  for (j = 0; j < i; j++) {
675  if (j && eq(vars[j].x_v->va_name, vars[j - 1].x_v->va_name))
676  continue;
677  v = vars[j].x_v;
678  if (v->va_type == VT_BOOL) {
679  out_printf("%c %-18s\n", vars[j].x_char, v->va_name);
680  }
681  else {
682  out_printf("%c %-18s", vars[j].x_char, v->va_name);
683  wl = vareval(v->va_name);
684  s = wl_flatten(wl);
685  wl_free(wl);
686  if (v->va_type == VT_LIST)
687  out_printf("( %s )\n", s);
688  else
689  out_printf("%s\n", s);
690  txfree(s);
691  }
692  }
693 
694  wl_free(wl0);
695  va_free(uv1);
696  va_free(uv2);
697  txfree((char*)vars);
698  out_send("\n");
699  return;
700 }
#define eq(a, b)
Definition: misc.h:29
Definition: variable.c:632
int wl_length()
static wordlist * vareval()
void va_free(struct variable *v)
Definition: variable.c:1357
void out_printf()
Definition: cddefs.h:119
#define VT_LIST
Definition: cpstd.h:64
Definition: library.c:18
char va_type
Definition: cpstd.h:42
void wl_free()
char * tmalloc()
char * va_name
Definition: cpstd.h:43
void txfree()
char x_char
Definition: variable.c:634
static int vcmp()
#define VT_BOOL
Definition: cpstd.h:60
Definition: cpstd.h:21
void cp_usrvars()
qsort()
Definition: string.c:375
static void * variables
Definition: variable.c:53
void out_send()
struct wordlist * wl_next
Definition: cpstd.h:23
char * wl_word
Definition: cpstd.h:22
char * wl_flatten()
struct variable * va_next
Definition: cpstd.h:51
struct variable * x_v
Definition: variable.c:633
Definition: cpstd.h:41
void * htab_list()
void cp_vset ( )
void cp_wstrip ( )
void fatal ( )

Definition at line 174 of file help.c.

176 {
177  fprintf(stderr, "fatal error\n");
178  exit(1);
179 }
void ft_cpinit ( )

Definition at line 21 of file cpitf.c.

22 {
23  wordlist *wl;
24  wordlist wl1, wl2, wl3;
25  bool found = false, t = true;
26  char buf[BSIZE_SP], **x, *s, *r;
27  struct comm *c;
28  int i;
29  FILE *fp;
30  double dv;
31  static char *predefs[] = {
32  "yes", "1",
33  "true", "1",
34  "no", "0",
35  "false", "0",
36  "pi", "3.14159265358979323846",
37  "e", "2.71828182844590452353",
38  "c", "2.997925e8",
39  "i", "0,1",
40  "kelvin", "-273.15",
41  "echarge", "1.60219e-19",
42  "boltz", "1.38062e-23",
43  "planck", "6.62620e-34"
44  } ;
45  static char *udfs[] = {
46  "max(x,y)", "(x gt y) * x + (x le y) * y",
47  "min(x,y)", "(x lt y) * x + (x ge y) * y",
48  "vdb(x)", "db(v(x))",
49  "vdb(x,y)", "db(v(x) - v(y))",
50  "vi(x)", "im(v(x))",
51  "vi(x,y)", "im(v(x) - v(y))",
52  "vm(x)", "mag(v(x))",
53  "vm(x,y)", "mag(v(x) - v(y))",
54  "vp(x)", "ph(v(x))",
55  "vp(x,y)", "ph(v(x) - v(y))",
56  "vr(x)", "re(v(x))",
57  "vr(x,y)", "re(v(x) - v(y))"
58  } ;
59 
60  cp_ccon(true); /* So the user can type ahead... */
61  cp_init();
62 
63  if (!cp_nocc) {
64  /* Add commands... */
65  for (c = cp_coms; c->co_func; c++) {
66  if (c->co_spiceonly && ft_nutmeg)
67  continue;
69  c->co_cctypes[1], c->co_cctypes[2],
70  c->co_cctypes[3]);
72  }
73  /* And keywords... These are the ones that are constant... */
74  if (!ft_nutmeg) {
75  cp_addkword(CT_LISTINGARGS, "deck");
76  cp_addkword(CT_LISTINGARGS, "logical");
77  cp_addkword(CT_LISTINGARGS, "physical");
78  cp_addkword(CT_LISTINGARGS, "expand");
79 
80  cp_addkword(CT_STOPARGS, "when");
81  cp_addkword(CT_STOPARGS, "after");
82  }
83 
84  cp_addkword(CT_PLOT, "new");
85 
86  cp_addkword(CT_PLOTKEYWORDS, "combplot");
87  cp_addkword(CT_PLOTKEYWORDS, "lingrid");
88  cp_addkword(CT_PLOTKEYWORDS, "linplot");
89  cp_addkword(CT_PLOTKEYWORDS, "loglog");
90  cp_addkword(CT_PLOTKEYWORDS, "nogrid");
91  cp_addkword(CT_PLOTKEYWORDS, "nointerp");
92  cp_addkword(CT_PLOTKEYWORDS, "pointplot");
93  cp_addkword(CT_PLOTKEYWORDS, "polar");
94  cp_addkword(CT_PLOTKEYWORDS, "samep");
95  cp_addkword(CT_PLOTKEYWORDS, "smith");
96  cp_addkword(CT_PLOTKEYWORDS, "title");
98  cp_addkword(CT_PLOTKEYWORDS, "xcomp");
99  cp_addkword(CT_PLOTKEYWORDS, "xcompress");
100  cp_addkword(CT_PLOTKEYWORDS, "xdel");
101  cp_addkword(CT_PLOTKEYWORDS, "xdelta");
102  cp_addkword(CT_PLOTKEYWORDS, "xind");
103  cp_addkword(CT_PLOTKEYWORDS, "xindices");
104  cp_addkword(CT_PLOTKEYWORDS, "xlabel");
105  cp_addkword(CT_PLOTKEYWORDS, "xlimit");
106  cp_addkword(CT_PLOTKEYWORDS, "xlog");
107  cp_addkword(CT_PLOTKEYWORDS, "ydel");
108  cp_addkword(CT_PLOTKEYWORDS, "ydelta");
109  cp_addkword(CT_PLOTKEYWORDS, "ylabel");
110  cp_addkword(CT_PLOTKEYWORDS, "ylimit");
111  cp_addkword(CT_PLOTKEYWORDS, "ylog");
112 
113  cp_addkword(CT_RUSEARGS, "accept");
114  cp_addkword(CT_RUSEARGS, "all");
115  cp_addkword(CT_RUSEARGS, "elapsed");
116  cp_addkword(CT_RUSEARGS, "everything");
117  cp_addkword(CT_RUSEARGS, "faults");
118  cp_addkword(CT_RUSEARGS, "fillin");
119  cp_addkword(CT_RUSEARGS, "loadtime");
120  cp_addkword(CT_RUSEARGS, "lutime");
121  cp_addkword(CT_RUSEARGS, "matsize");
122  cp_addkword(CT_RUSEARGS, "nonzero");
123  cp_addkword(CT_RUSEARGS, "rejected");
124  cp_addkword(CT_RUSEARGS, "solvetime");
125  cp_addkword(CT_RUSEARGS, "space");
126  cp_addkword(CT_RUSEARGS, "time");
127  cp_addkword(CT_RUSEARGS, "totaltime");
128  cp_addkword(CT_RUSEARGS, "totiter");
129  cp_addkword(CT_RUSEARGS, "traniter");
130  cp_addkword(CT_RUSEARGS, "tranpoints");
131  cp_addkword(CT_RUSEARGS, "transolvetime");
132  cp_addkword(CT_RUSEARGS, "trantime");
133 
134  cp_addkword(CT_VECTOR, "all");
135 
136  for (i = 0; ; i++) {
137  if (!(s = ft_typenames(i)))
138  break;
140  }
141  }
142 
143  cp_vset("program", VT_STRING, cp_program);
144 
145  /* Make the prompt use only the last component of the path... */
146 
147  if (DIR_TERM) {
148  for (s = cp_program; s && *s; s++)
149  ;
150  s--;
151  while ((s > cp_program) && (*s != DIR_TERM))
152  s--;
153  if (*s == DIR_TERM)
154  s++;
155  (void) strcpy(buf, s);
156  for (s = buf; *s && (*s != '.'); s++)
157  ;
158  *s = '\0';
159  (void) strcat(buf, " ! -> ");
160  }
161  else
162  (void) sprintf(buf, "%s ! -> ", cp_program);
163 
164  cp_vset("prompt", VT_STRING, buf);
165  cp_vset("noglob", VT_BOOL, (char *) &t);
166 
167  /* set these to a default (used in decks for loop and check
168  * commands)
169  */
170  dv = 0.0;
171  cp_vset("value1", VT_REAL, (char*)&dv);
172  cp_vset("value2", VT_REAL, (char*)&dv);
173 
174  /* Now do a bunch of things that used to be in the spiceinit file
175  * but were too slow to read in...
176  */
177  wl1.wl_next = &wl2;
178  wl1.wl_prev = NULL;
179  wl2.wl_next = NULL;
180  wl2.wl_prev = &wl1;
181  wl1.wl_word = "if";
182  wl2.wl_word = "1";
183  cp_setalias("begin", &wl1);
184  wl1.wl_next = NULL;
185  wl1.wl_word = "end";
186  cp_setalias("endif", &wl1);
187  cp_setalias("endwhile", &wl1);
188  cp_setalias("endforeach", &wl1);
189  cp_setalias("endrepeat", &wl1);
190  cp_setalias("enddowhile", &wl1);
191  wl1.wl_word = "help";
192  cp_setalias("?", &wl1);
193 
194  wl1.wl_next = &wl2;
195  wl2.wl_next = &wl3;
196  wl2.wl_prev = &wl1;
197  wl3.wl_prev = &wl2;
198  wl3.wl_next = NULL;
199  wl2.wl_word = "=";
200  for (i = 0; i < sizeof (predefs) / sizeof (char *); i += 2) {
201  wl1.wl_word = predefs[i];
202  wl3.wl_word = predefs[i + 1];
203  com_let(&wl1);
204  }
205 
206  wl2.wl_next = NULL;
207  for (i = 0; i < sizeof (udfs) / sizeof (char *); i += 2) {
208  wl1.wl_word = udfs[i];
209  wl2.wl_word = udfs[i + 1];
210  com_define(&wl1);
211  }
212 
213  /* Reset this for the front end. */
214  cp_hash = '*';
215 
216  if (Lib_Path && *Lib_Path) {
217  (void) sprintf(buf, "sourcepath = ( %s %s )", DIR_CWD, Lib_Path);
218  wl = cp_lexer(buf);
219  cp_doglob(&wl);
220  cp_striplist(wl);
221  com_set(wl);
222  wl_free(wl);
223 
224  /* Now source the standard startup file. */
225  s = Lib_Path;
226  while (*s) {
227  while (isspace(*s))
228  s++;
229  for (r = buf; *s && !isspace(*s); r++, s++)
230  *r = *s;
231  *r++ = '/';
232  (void) strcpy(r, "spinit");
233  cp_pathfix(buf);
234  if (fp = fopen(buf, "r")) {
235  cp_interactive = false;
236  inp_spsource(fp, true, buf);
237  cp_interactive = true;
238  (void) fclose(fp);
239  found = true;
240  break;
241  }
242  else if (ft_controldb)
243  fprintf(cp_err, "Note: can't open \"%s\".\n", buf);
244  }
245  if (!found)
246  fprintf(cp_err, "Note: can't find init file.\n");
247  }
248 
249  return;
250 }
void cp_pathfix(char *buf)
Definition: help.c:198
void cp_init()
Definition: cshpar.c:83
static char buf[MAXPROMPT]
Definition: arg.c:18
#define BSIZE_SP
Definition: misc.h:19
void cp_vset()
char * strcpy()
Definition: cddefs.h:119
#define CT_RUSEARGS
Definition: fteconst.h:92
void com_define()
char cp_hash
Definition: lexical.c:54
#define CT_PLOT
Definition: fteconst.h:90
void cp_setalias()
#define CT_STOPARGS
Definition: fteconst.h:93
#define CT_LISTINGARGS
Definition: fteconst.h:88
Definition: library.c:18
void cp_doglob()
void com_set()
struct comm * cp_coms
Definition: main.c:163
Definition: cpdefs.h:20
#define CT_TYPENAMES
Definition: fteconst.h:97
bool co_spiceonly
Definition: cpdefs.h:24
void wl_free()
void inp_spsource(FILE *fp, bool i, char *s)
Definition: main.c:195
FILE * cp_err
Definition: help.c:101
bool ft_controldb
Definition: options.c:30
struct wordlist * wl_prev
Definition: cpstd.h:24
char * Lib_Path
Definition: ivars.c:15
bool cp_interactive
Definition: help.c:100
#define NULL
Definition: spdefs.h:121
char * cp_program
Definition: main.c:43
static double c
Definition: vectors.c:16
#define VT_STRING
Definition: cpstd.h:63
wordlist * cp_lexer()
#define VT_BOOL
Definition: cpstd.h:60
char * ft_typenames()
Definition: cpstd.h:21
bool cp_nocc
Definition: complete.c:75
Definition: cddefs.h:162
struct wordlist * wl_next
Definition: cpstd.h:23
#define VT_REAL
Definition: cpstd.h:62
bool ft_nutmeg
Definition: main.c:161
void cp_striplist()
char * wl_word
Definition: cpstd.h:22
#define CT_COMMANDS
Definition: fteconst.h:85
void(* co_func)()
Definition: cpdefs.h:22
void cp_addcomm()
void cp_addkword()
char * co_comname
Definition: cpdefs.h:21
Definition: cddefs.h:192
void com_let()
#define CT_PLOTKEYWORDS
Definition: fteconst.h:91
long co_cctypes[4]
Definition: cpdefs.h:26
void cp_ccon()
#define CT_VECTOR
Definition: fteconst.h:96
double* ft_numparse ( )
void out_init ( )

Definition at line 128 of file output.c.

129 {
130  bool moremode;
131 
132  noprint = nopause = false;
133 
134  if (!out_moremode || !cp_interactive)
135  out_isatty = false;
136 
137  if (!out_isatty)
138  return;
139 
141  ysize -= 2; /* Fudge room... */
142  xpos = ypos = 0;
143 
144  return;
145 }
static bool noprint
Definition: output.c:51
static int xsize
Definition: output.c:49
void out_winsize(int *cols, int *rows)
Definition: output.c:55
bool out_moremode
Definition: output.c:44
bool out_isatty
Definition: output.c:45
static bool nopause
Definition: output.c:51
bool cp_interactive
Definition: help.c:100
static int ysize
Definition: output.c:49
static int xpos
Definition: output.c:50
static int ypos
Definition: output.c:50
void out_printf ( )
void out_send ( )
void out_winsize ( )
void out_wlprint ( )
struct variable* va_copy ( )
void va_free ( )

Variable Documentation

struct alias* cp_aliases

Definition at line 22 of file alias.c.

char* cp_altprompt

Definition at line 53 of file lexical.c.

char cp_amp

Definition at line 65 of file cshpar.c.

char cp_back

Definition at line 23 of file backq.c.

char cp_bang

Definition at line 37 of file history.c.

bool cp_bqflag

Definition at line 51 of file lexical.c.

char cp_cbrac

Definition at line 57 of file glob.c.

char cp_ccurl

Definition at line 53 of file glob.c.

char cp_chars[]

Definition at line 79 of file cshpar.c.

char cp_comma

Definition at line 51 of file glob.c.

struct comm* cp_coms

Definition at line 163 of file main.c.

char* cp_csep

Definition at line 121 of file front.c.

FILE* cp_curerr

Definition at line 77 of file cshpar.c.

FILE* cp_curin

Definition at line 75 of file cshpar.c.

FILE* cp_curout

Definition at line 76 of file cshpar.c.

bool cp_cwait

Definition at line 120 of file front.c.

bool cp_debug

Definition at line 61 of file cshpar.c.

bool cp_didhsubst

Definition at line 38 of file history.c.

char* cp_display

Definition at line 44 of file main.c.

char cp_dol

Definition at line 51 of file variable.c.

bool cp_dounixcom

Definition at line 123 of file front.c.

FILE* cp_err

Definition at line 101 of file help.c.

int cp_event

Definition at line 49 of file lexical.c.

char cp_gt

Definition at line 63 of file cshpar.c.

char cp_hash

Definition at line 54 of file lexical.c.

char cp_hat

Definition at line 36 of file history.c.

char cp_huh

Definition at line 54 of file glob.c.

bool cp_ignoreeof

Definition at line 49 of file variable.c.

FILE* cp_in

Definition at line 101 of file help.c.

FILE* cp_inp_cur

Definition at line 48 of file lexical.c.

bool cp_interactive

Definition at line 100 of file help.c.

struct histent* cp_lastone

Definition at line 34 of file history.c.

char cp_lt

Definition at line 64 of file cshpar.c.

int cp_maxhistlength

Definition at line 35 of file history.c.

bool cp_nocc

Definition at line 75 of file complete.c.

bool cp_noclobber

Definition at line 48 of file variable.c.

bool cp_noglob

Definition at line 46 of file variable.c.

bool cp_nonomatch

Definition at line 47 of file variable.c.

char cp_obrac

Definition at line 56 of file glob.c.

char cp_ocurl

Definition at line 52 of file glob.c.

FILE* cp_out

Definition at line 101 of file help.c.

char* cp_program

Definition at line 43 of file main.c.

char* cp_promptstring

Definition at line 52 of file lexical.c.

char cp_star

Definition at line 55 of file glob.c.

char cp_til

Definition at line 58 of file glob.c.

bool ft_nutmeg

Definition at line 161 of file main.c.

int out_height

Definition at line 47 of file output.c.

bool out_isatty

Definition at line 45 of file output.c.

bool out_moremode

Definition at line 44 of file output.c.

int out_width

Definition at line 46 of file output.c.