Back to index

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

Go to the source code of this file.

Defines

#define fsizelim   131072
#define quitstring   "\nexit;\n"
#define stringprinter   "print(\"%s\");\n"
#define homepage   "http://www.math.uiuc.edu/Macaulay2/"
#define progname   "m2"

Functions

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

Variables

char * nameofcmd = "M2"
int precision = 20
char header []
struct {
char * wname
char * defaultval
char * setname
setups []
char * illegal []
char * illpart []

Define Documentation

#define fsizelim   131072

Definition at line 23 of file m2.c.

#define homepage   "http://www.math.uiuc.edu/Macaulay2/"

Definition at line 29 of file m2.c.

#define progname   "m2"

Definition at line 56 of file m2.c.

#define quitstring   "\nexit;\n"

Definition at line 25 of file m2.c.

#define stringprinter   "print(\"%s\");\n"

Definition at line 27 of file m2.c.


Function Documentation

void about ( void  )

Definition at line 111 of file m2.c.

{
    char *p;

    cmdparm=""; prepabout(quitstring,"/dev/null",outputfname);
    if(readabout()>0) {
       p=strchr(aboutbuf,'\n'); 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 *  pm)

Definition at line 61 of file m2.c.

{
    find_illegal(pm);
}

Here is the call graph for this function:

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

Definition at line 123 of file m2.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,"m2_precision")!=NULL)
         precision=atoi(p);
       if(precision<0) precision=-precision;
    }
    return ptr;
}
char* find_prompt ( char *  p)

Definition at line 66 of file m2.c.

{
    char *pp=p, *pt;
    redo:
    if(*pp==0) return NULL;
    pp=strstr(pp,"\ni");
    pt=pp;
    if(pp!=NULL) {
       pp+=2; while(isdigit(*pp)) pp++;
       if(*pp!=' ') goto redo;
       while(*pp==' ') pp++;
       if(*pp!=':' || *(pp+1)!=' ') goto redo;
    }
    return pt;
}

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 141 of file m2.c.

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

Here is the call graph for this function:

void output ( char *  p)

Definition at line 83 of file m2.c.

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

    pp=find_prompt(p);
    while(pp!=NULL && *pp!=0) {
       pe=find_prompt(pp+1); pp=strchr(pp+1,'\n');
       if(pp==NULL) return;
       if(pe==NULL) pe=pp+strlen(pp); else *pe++=0;
       pp++;
       if(strlen(pp)==0) {
           emptyline:
           puts(""); pp=pe; continue;
       }
       n=strlen(pp); if(n==0) goto emptyline;
         /* strip leading and trailing spaces */
       while(isspace(*pp) && pp<pe) pp++;
       pt=pp+strlen(pp)-1;
       while(pt>=pp && isspace(*pt)) *pt--=0;
              /* make every output one-line */
       for(i=0;i<n;i++) {
           if(*(pp+i)=='\n') *(pp+i)='#';
       }
       puts(pp); pp=pe;
    }
}

Here is the call graph for this function:


Variable Documentation

char header[]
Initial value:
"\
"

Definition at line 33 of file m2.c.

char* illegal[]
Initial value:
{
      "exec","run","fork",
      "input",  
      "tmpname",
      "getWWW",
}

Definition at line 43 of file m2.c.

char* illpart[]
Initial value:
{
}

Definition at line 51 of file m2.c.

char* nameofcmd = "M2"

Definition at line 31 of file m2.c.

int precision = 20

Definition at line 32 of file m2.c.

struct { ... } setups[]