Back to index

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

Go to the source code of this file.

Defines

#define fsizelim   131072
#define gapprompt   "gap> "
#define quitstring   "\nquit;\n"
#define stringprinter   "Print(\"%s\\n\");\n"
#define homepage   "http://www-gap.dcs.st-and.ac.uk/~gap"
#define progname   "gap"

Functions

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

Variables

char * nameofcmd = "gap.sh -T -n"
int precision = 20
char header []
struct {
char * wname
char * defaultval
setups []
char * illegal []
char * illpart []

Define Documentation

#define fsizelim   131072

Definition at line 23 of file gap.c.

#define gapprompt   "gap> "

Definition at line 25 of file gap.c.

#define homepage   "http://www-gap.dcs.st-and.ac.uk/~gap"

Definition at line 31 of file gap.c.

#define progname   "gap"

Definition at line 55 of file gap.c.

#define quitstring   "\nquit;\n"

Definition at line 27 of file gap.c.

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

Definition at line 29 of file gap.c.


Function Documentation

void about ( void  )

Definition at line 106 of file gap.c.

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

Definition at line 60 of file gap.c.

{
    char *pp; int l;
         /* Underscore replacement */
    for(pp=strchr(pm,'_'); pp!=NULL; pp=strchr(pp+1,'_')) *pp='K';
    strip_trailing_spaces(pm); l=strlen(pm);
    if(l>0 && pm[l-1]!=';') strcat(pm,";");
    find_illegal(pm);
}

Here is the call graph for this function:

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

Definition at line 120 of file gap.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;
    }
    return ptr;
}
int main ( int  argc,
char *  argv[] 
)

Definition at line 132 of file gap.c.

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

Here is the call graph for this function:

void output ( char *  p)

Definition at line 71 of file gap.c.

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

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

Variable Documentation

char header[]
Initial value:
"\n\
"

Definition at line 35 of file gap.c.

char* illegal[]
Initial value:
{
      "Reread","Process","Exec","Filename","SaveWorkspace"
}

Definition at line 44 of file gap.c.

char* illpart[]
Initial value:
{
    "File", "Path", "Read", "To"
}

Definition at line 49 of file gap.c.

char* nameofcmd = "gap.sh -T -n"

Definition at line 33 of file gap.c.

int precision = 20

Definition at line 34 of file gap.c.

struct { ... } setups[]