Back to index

wims  3.65+svn20090927
Functions
matrix.c File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void rawmatrix (char *p)

Function Documentation

void rawmatrix ( char *  p)

Definition at line 22 of file matrix.c.

{
    char *p1;
    char lbuf[MAX_LINELEN+1], obuf[MAX_LINELEN+1];
    int n, i, c=0, change=0;

    obuf[0]=0;
    p1=find_word_start(p); if(p1>p) strcpy(p,p1);
    strip_enclosing_par(p); strip_trailing_spaces(p);
    if(*p==0) return;
    rows2lines(p); n=linenum(p);
    if(itemnum(p)<=1 && wordnum(p)>=2*n) change=1;
    for(i=1;i<=n;i++) {
       fnd_line(p,i,lbuf);
       p1=find_word_start(lbuf); if(p1>lbuf) strcpy(lbuf,p1);
       strip_enclosing_par(lbuf);
       if(lbuf[0]==0) continue;
              /* Uniformize column separator to comma */
       if(change) words2items(lbuf);
       rawmath(lbuf);
       if(i==1) {
           strcpy(obuf,lbuf);
           c=itemnum(lbuf);
       }
       else {
           if(strlen(obuf)+strlen(lbuf)>=MAX_LINELEN-1)
             user_error("cmd_output_too_long");
           if(c!=itemnum(lbuf)) {
              force_setvar("wims_warn_rawmatrix","inconsistent_columns"); 
              return;
           }
           snprintf(obuf+strlen(obuf),sizeof(obuf)-strlen(obuf),
                   "\n%s",lbuf);
       }
    }
    strcpy(p,obuf);
}

Here is the call graph for this function: