Back to index

wims  3.65+svn20090927
Defines | Functions | Variables
octave.c File Reference
#include "common.h"
#include "common.c"

Go to the source code of this file.

Defines

#define fsizelim   131072
#define quitstring   "\nquit\n"
#define stringprinter   "\"%s\"\n"
#define homepage   "http://www.che.wisc.edu/octave/octave.html"
#define progname   "octave"

Functions

void check_parm (char *p)
void output (char *p)
void about (void)
char * dynsetup (char *ptr, char *end)
int main (int argc, char *argv[])

Variables

char ans_str [] = "ans ="
char * nameofcmd = "octave -Hf --no-line-editing"
int precision = 9
char header []
struct {
char * wname
char * defaultval
char * setname
setups []
char * illegal []
char * illpart []

Define Documentation

#define fsizelim   131072

Definition at line 26 of file octave.c.

#define homepage   "http://www.che.wisc.edu/octave/octave.html"

Definition at line 32 of file octave.c.

#define progname   "octave"

Definition at line 87 of file octave.c.

#define quitstring   "\nquit\n"

Definition at line 28 of file octave.c.

#define stringprinter   "\"%s\"\n"

Definition at line 30 of file octave.c.


Function Documentation

void about ( void  )

Definition at line 130 of file octave.c.

{
    char *p;

    prepabout(quitstring,outputfname,NULL);
    if(readabout()>0) {
       p=strchr(aboutbuf,'\n'); if(p!=NULL) *p=0;
       p=strchr(aboutbuf,'('); if(p!=NULL) *p=0;
       strip_trailing_spaces(aboutbuf);
       printf("<A HREF=\"%s\">%s</A>",homepage,aboutbuf);
    }
}

Here is the call graph for this function:

void check_parm ( char *  p)

Definition at line 92 of file octave.c.

{
    char *pp, *s;
    
         /* Underscore replacement */
    for(pp=strchr(p,'_'); pp!=NULL; pp=strchr(pp+1,'_')) {
       if(pp==p || !isalnum(*(pp-1))) *pp='K';
    }
    for(s=p;*s;s++) *s=tolower(*s);
    find_illegal(p);
}

Here is the call graph for this function:

char* dynsetup ( char *  ptr,
char *  end 
)

Definition at line 143 of file octave.c.

{
    int i;
    char *p, *pp;
    for(i=0;i<SETUP_NO;i++) {
       p=getenv(setups[i].wname);
       if(p!=NULL) for(pp=p;*pp;pp++) if(!isspace(*pp) && !isalnum(*pp)) p="";
       if(p==NULL || *p==0) p=setups[i].defaultval;
       snprintf(ptr,end-ptr,"%s=%s\n",setups[i].setname,p);
       ptr+=strlen(ptr);
       if(strstr(setups[i].wname,"octave_precision")!=NULL)
         precision=atoi(p);
       if(precision<0) precision=-precision;
    }
    return ptr;
}
int main ( int  argc,
char *  argv[] 
)

Definition at line 160 of file octave.c.

{
    prepare1();
    run();
    return 0;    
}

Here is the call graph for this function:

void output ( char *  p)

Definition at line 105 of file octave.c.

{
    int i,n;
    char *pp, *pe, *pt;

    pp=strchr(p,'\n');
    for(pp++; *pp; pp=pe) {
       pe=strchr(pp,'\n'); if(pe) *pe++=0; else pe=pp+strlen(pp);
       if(memcmp(pp,ans_str,strlen(ans_str))==0) pp+=strlen(ans_str);
       n=strlen(pp); if(n==0) {
           puts(""); continue;
       }
              /* make every output one-line */
       for(i=0;i<n;i++) {
           if(*(pp+i)=='\n' || *(pp+i)=='\%') *(pp+i)=' ';
       }
         /* strip leading and trailing spaces */
       while(isspace(*pp) && pp<pe) pp++;
       pt=pp+strlen(pp)-1;
       while(isspace(*pt) && pt>pp) *pt--=0;
       strip_zeros(pp);
       puts(pp);
    }
}

Here is the call graph for this function:


Variable Documentation

char ans_str[] = "ans ="

Definition at line 34 of file octave.c.

char header[]
Initial value:
"split_long_rows=0\n\
page_screen_output=0\n\
function y=sh(x) y=sinh(x); endfunction\n\
function y=ch(x) y=cosh(x); endfunction\n\
function y=th(x) y=tanh(x); endfunction\n\
function y=ln(x) y=log(x); endfunction\n\
function y=lg(x) y=log10(x); endfunction\n\
function y=sgn(x) y=sign(x); endfunction\n\
function y=tg(x) y=tan(x); endfunction\n\
function y=cotan(x) y=cot(x); endfunction\n\
function y=ctg(x) y=cot(x); endfunction\n\
function y=arcsin(x) y=asin(x); endfunction\n\
function y=arccos(x) y=acos(x); endfunction\n\
function y=arctan(x) y=atan(x); endfunction\n\
function y=arctg(x) y=atan(x); endfunction\n\
function y=argsh(x) y=asinh(x); endfunction\n\
function y=argch(x) y=acosh(x); endfunction\n\
function y=argth(x) y=atanh(x); endfunction\n\
function y=Argsh(x) y=asinh(x); endfunction\n\
function y=Argch(x) y=acosh(x); endfunction\n\
function y=Argth(x) y=atanh(x); endfunction\n\
function y=rint(x) y=round(x); endfunction\n\
PI=pi\n\
Pi=pi\n\
"

Definition at line 38 of file octave.c.

char* illegal[]
Initial value:
{
      "system","fopen","fclose","readdir","popen","mkdir","rmdir",
      "dir","ls","cd","chdir","more","save","load","diary",
      "fork","putenv","graw","eval",
      "scanf","exec","unlink","umask","lstat","stat","rename",
      "glob","tilde_expand","pclose","popen2","waitpid",
      
}

Definition at line 71 of file octave.c.

char* illpart[]
Initial value:
{
    "file", "debug", "plot"
}

Definition at line 81 of file octave.c.

char* nameofcmd = "octave -Hf --no-line-editing"

Definition at line 36 of file octave.c.

int precision = 9

Definition at line 37 of file octave.c.

struct { ... } setups[]