fix: April 2023 archlinux
This commit is contained in:
parent
a25316aa9e
commit
15feb1c6c9
4 changed files with 2341 additions and 2587 deletions
2674
CORE/BuiltIn.c
2674
CORE/BuiltIn.c
File diff suppressed because it is too large
Load diff
594
CORE/Genbank.c
594
CORE/Genbank.c
|
@ -1,10 +1,12 @@
|
||||||
#include <sys/time.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <xview/xview.h>
|
#include <stdio.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <time.h>
|
||||||
#include <xview/panel.h>
|
#include <xview/panel.h>
|
||||||
#include "menudefs.h"
|
#include <xview/xview.h>
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "menudefs.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) 1989-1990, University of Illinois board of trustees. All
|
Copyright (c) 1989-1990, University of Illinois board of trustees. All
|
||||||
|
@ -19,223 +21,220 @@ Copyright (c) 1993, Steven Smith, all rights reserved.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ReadGen(filename,dataset,type)
|
ReadGen(filename, dataset, type) char *filename;
|
||||||
char *filename;
|
|
||||||
NA_Alignment *dataset;
|
NA_Alignment *dataset;
|
||||||
int type;
|
int type;
|
||||||
{
|
{
|
||||||
register int done = FALSE,len = 0, j=0;
|
register int done = FALSE, len = 0, j = 0;
|
||||||
int count,IS_REALLY_AA = FALSE;
|
int count, IS_REALLY_AA = FALSE;
|
||||||
char Inline[GBUFSIZ],c;
|
char Inline[GBUFSIZ], c;
|
||||||
char *buffer,*gencomments = NULL,fields[8][GBUFSIZ];
|
char *buffer, *gencomments = NULL, fields[8][GBUFSIZ];
|
||||||
int buflen = 0,genclen = 0,curelem = 0,n = 0,flag = 0;
|
int buflen = 0, genclen = 0, curelem = 0, n = 0, flag = 0;
|
||||||
int start_col = -1;
|
int start_col = -1;
|
||||||
|
|
||||||
NA_Sequence *this_elem;
|
NA_Sequence *this_elem;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
extern int Default_DNA_Trans[], Default_RNA_Trans[];
|
extern int Default_DNA_Trans[], Default_RNA_Trans[];
|
||||||
extern int Default_NA_RTrans[];
|
extern int Default_NA_RTrans[];
|
||||||
extern int Default_PROColor_LKUP[],Default_NAColor_LKUP[];
|
extern int Default_PROColor_LKUP[], Default_NAColor_LKUP[];
|
||||||
|
|
||||||
ErrorOut("No such file",file = fopen(filename,"r"));
|
ErrorOut("No such file", file = fopen(filename, "r"));
|
||||||
|
|
||||||
for(;fgets(Inline,GBUFSIZ,file) != 0;)
|
for (; fgets(Inline, GBUFSIZ, file) != 0;) {
|
||||||
{
|
if (Inline[strlen(Inline) - 1] == '\n')
|
||||||
if(Inline[strlen(Inline)-1] == '\n')
|
Inline[strlen(Inline) - 1] = '\0';
|
||||||
Inline[strlen(Inline)-1] = '\0';
|
if (Find(Inline, "LOCUS")) {
|
||||||
if(Find(Inline,"LOCUS"))
|
|
||||||
{
|
|
||||||
curelem = dataset->numelements++;
|
curelem = dataset->numelements++;
|
||||||
if(curelem == 0)
|
if (curelem == 0) {
|
||||||
{
|
dataset->element = (NA_Sequence *)Calloc(
|
||||||
dataset->element=(NA_Sequence*)
|
5, sizeof(NA_Sequence));
|
||||||
Calloc(5,sizeof(NA_Sequence));
|
|
||||||
dataset->maxnumelements = 5;
|
dataset->maxnumelements = 5;
|
||||||
}
|
}
|
||||||
else if (curelem==dataset->maxnumelements)
|
else if (curelem == dataset->maxnumelements) {
|
||||||
{
|
|
||||||
(dataset->maxnumelements) *= 2;
|
(dataset->maxnumelements) *= 2;
|
||||||
dataset->element =(NA_Sequence*)
|
dataset->element = (NA_Sequence *)Realloc(
|
||||||
Realloc(dataset->element,
|
dataset->element, dataset->maxnumelements *
|
||||||
dataset->maxnumelements * sizeof(NA_Sequence));
|
sizeof(NA_Sequence));
|
||||||
}
|
}
|
||||||
this_elem = &(dataset->element[curelem]);
|
this_elem = &(dataset->element[curelem]);
|
||||||
n = sscanf(Inline,"%s %s %s %s %s %s %s %s",
|
n = sscanf(Inline, "%s %s %s %s %s %s %s %s", fields[0],
|
||||||
fields[0],fields[1],fields[2],fields[3],fields[4],
|
fields[1], fields[2], fields[3], fields[4],
|
||||||
fields[5],fields[6],fields[7]);
|
fields[5], fields[6], fields[7]);
|
||||||
if(IS_REALLY_AA)
|
if (IS_REALLY_AA) {
|
||||||
{
|
InitNASeq(this_elem, PROTEIN);
|
||||||
InitNASeq(this_elem,PROTEIN);
|
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"DNA"))
|
else if (Find(Inline, "DNA")) {
|
||||||
{
|
InitNASeq(this_elem, DNA);
|
||||||
InitNASeq(this_elem,DNA);
|
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"RNA"))
|
else if (Find(Inline, "RNA")) {
|
||||||
{
|
InitNASeq(this_elem, RNA);
|
||||||
InitNASeq(this_elem,RNA);
|
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"MASK"))
|
else if (Find(Inline, "MASK")) {
|
||||||
{
|
InitNASeq(this_elem, MASK);
|
||||||
InitNASeq(this_elem,MASK);
|
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"TEXT"))
|
else if (Find(Inline, "TEXT")) {
|
||||||
{
|
InitNASeq(this_elem, TEXT);
|
||||||
InitNASeq(this_elem,TEXT);
|
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"PROT"))
|
else if (Find(Inline, "PROT")) {
|
||||||
{
|
InitNASeq(this_elem, PROTEIN);
|
||||||
InitNASeq(this_elem,PROTEIN);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
InitNASeq(this_elem,DNA);
|
InitNASeq(this_elem, DNA);
|
||||||
|
|
||||||
strncpy(this_elem->short_name,fields[1],31);
|
strncpy(this_elem->short_name, fields[1], 31);
|
||||||
AsciiTime(&(this_elem->t_stamp.origin),fields[n-1]);
|
AsciiTime(&(this_elem->t_stamp.origin), fields[n - 1]);
|
||||||
this_elem->attr = DEFAULT_X_ATTR;
|
this_elem->attr = DEFAULT_X_ATTR;
|
||||||
|
|
||||||
if( Find(Inline, "Circular") )
|
if (Find(Inline, "Circular"))
|
||||||
this_elem->attr |= IS_CIRCULAR;
|
this_elem->attr |= IS_CIRCULAR;
|
||||||
|
|
||||||
gencomments = NULL;
|
gencomments = NULL;
|
||||||
genclen = 0;
|
genclen = 0;
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"DEFINITION"))
|
else if (Find(Inline, "DEFINITION"))
|
||||||
strncpy(this_elem->description,&(Inline[12]),79);
|
strncpy(this_elem->description, &(Inline[12]), 79);
|
||||||
|
|
||||||
else if(Find(Inline,"AUTHOR"))
|
else if (Find(Inline, "AUTHOR"))
|
||||||
strncpy(this_elem->authority,&(Inline[12]),79);
|
strncpy(this_elem->authority, &(Inline[12]), 79);
|
||||||
|
|
||||||
else if(Find(Inline," ORGANISM"))
|
else if (Find(Inline, " ORGANISM"))
|
||||||
strncpy(this_elem->seq_name,&(Inline[12]),79);
|
strncpy(this_elem->seq_name, &(Inline[12]), 79);
|
||||||
|
|
||||||
else if(Find(Inline,"ACCESSION"))
|
else if (Find(Inline, "ACCESSION"))
|
||||||
strncpy(this_elem->id,&(Inline[12]),79);
|
strncpy(this_elem->id, &(Inline[12]), 79);
|
||||||
|
|
||||||
else if(Find(Inline,"ORIGIN"))
|
else if (Find(Inline, "ORIGIN")) {
|
||||||
{
|
|
||||||
done = FALSE;
|
done = FALSE;
|
||||||
len = 0;
|
len = 0;
|
||||||
for(;done == FALSE && fgets(Inline,GBUFSIZ,file) != 0;)
|
for (; done == FALSE &&
|
||||||
{
|
fgets(Inline, GBUFSIZ, file) != 0;) {
|
||||||
if(Inline[0] != '/')
|
if (Inline[0] != '/') {
|
||||||
{
|
if (buflen == 0) {
|
||||||
if(buflen == 0)
|
|
||||||
{
|
|
||||||
buflen = GBUFSIZ;
|
buflen = GBUFSIZ;
|
||||||
buffer = Calloc(sizeof(char) ,
|
buffer = Calloc(sizeof(char),
|
||||||
buflen);
|
buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (len+strlen(Inline) >= buflen)
|
else if (len + strlen(Inline) >=
|
||||||
{
|
buflen) {
|
||||||
buflen += GBUFSIZ;
|
buflen += GBUFSIZ;
|
||||||
buffer = Realloc(buffer,
|
buffer = Realloc(
|
||||||
sizeof(char)*buflen);
|
buffer,
|
||||||
for(j=buflen-GBUFSIZ
|
sizeof(char) * buflen);
|
||||||
;j<buflen;j++)
|
for (j = buflen - GBUFSIZ;
|
||||||
|
j < buflen; j++)
|
||||||
buffer[j] = '\0';
|
buffer[j] = '\0';
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Search for the fist column of data (whitespace-number-whitespace)data
|
* Search for the fist column of
|
||||||
*/
|
*data
|
||||||
if(start_col == -1)
|
*(whitespace-number-whitespace)data
|
||||||
{
|
*/
|
||||||
for(start_col=0; Inline[start_col] == ' ' ||
|
if (start_col == -1) {
|
||||||
Inline[start_col] == '\t';start_col++);
|
for (start_col = 0;
|
||||||
|
Inline[start_col] == ' ' ||
|
||||||
|
Inline[start_col] == '\t';
|
||||||
|
start_col++)
|
||||||
|
;
|
||||||
|
|
||||||
for(start_col++;strchr("1234567890",
|
for (start_col++;
|
||||||
Inline[start_col]) != NULL;start_col++);
|
strchr(
|
||||||
|
"1234567890",
|
||||||
for(start_col++; Inline[start_col] == ' ' ||
|
Inline[start_col]) !=
|
||||||
Inline[start_col] == '\t';start_col++);
|
NULL;
|
||||||
|
start_col++)
|
||||||
|
;
|
||||||
|
|
||||||
|
for (start_col++;
|
||||||
|
Inline[start_col] == ' ' ||
|
||||||
|
Inline[start_col] == '\t';
|
||||||
|
start_col++)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
for(j=start_col;(c = Inline[j]) != '\0';j++)
|
for (j = start_col;
|
||||||
{
|
(c = Inline[j]) != '\0'; j++) {
|
||||||
if((c != '\n') &&
|
if ((c != '\n') &&
|
||||||
((j-start_col + 1) % 11 !=0))
|
((j - start_col + 1) % 11 !=
|
||||||
|
0))
|
||||||
buffer[len++] = c;
|
buffer[len++] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
AppendNA(buffer, len,
|
||||||
AppendNA(buffer,len,&(dataset->
|
&(dataset->element[curelem]));
|
||||||
element[curelem]));
|
for (j = 0; j < len; j++)
|
||||||
for(j=0;j<len;j++)
|
|
||||||
buffer[j] = '\0';
|
buffer[j] = '\0';
|
||||||
len = 0;
|
len = 0;
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
dataset->element[curelem].comments
|
dataset->element[curelem].comments =
|
||||||
= gencomments;
|
gencomments;
|
||||||
dataset->element[curelem].comments_len=
|
dataset->element[curelem].comments_len =
|
||||||
genclen - 1;
|
genclen - 1;
|
||||||
dataset->element[curelem].
|
dataset->element[curelem]
|
||||||
comments_maxlen = genclen;
|
.comments_maxlen = genclen;
|
||||||
|
|
||||||
gencomments = NULL;
|
gencomments = NULL;
|
||||||
genclen = 0;
|
genclen = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Test if sequence should be converted by the translation table
|
* Test if sequence should be converted by
|
||||||
* If it looks like a protein...
|
*the translation table If it looks like a protein...
|
||||||
*/
|
*/
|
||||||
if(dataset->element[curelem].rmatrix &&
|
if (dataset->element[curelem].rmatrix &&
|
||||||
IS_REALLY_AA == FALSE)
|
IS_REALLY_AA == FALSE) {
|
||||||
{
|
IS_REALLY_AA = CheckType(
|
||||||
IS_REALLY_AA = CheckType(dataset->element[curelem].
|
dataset->element[curelem].sequence,
|
||||||
sequence,dataset->element[curelem].seqlen);
|
dataset->element[curelem].seqlen);
|
||||||
|
|
||||||
if(IS_REALLY_AA == FALSE)
|
if (IS_REALLY_AA == FALSE)
|
||||||
Ascii2NA(dataset->element[curelem].sequence,
|
Ascii2NA(
|
||||||
|
dataset->element[curelem].sequence,
|
||||||
dataset->element[curelem].seqlen,
|
dataset->element[curelem].seqlen,
|
||||||
dataset->element[curelem].rmatrix);
|
dataset->element[curelem].rmatrix);
|
||||||
else
|
else
|
||||||
/*
|
/*
|
||||||
* Force the sequence to be AA
|
* Force the sequence to be AA
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
dataset->element[curelem].elementtype = PROTEIN;
|
dataset->element[curelem].elementtype =
|
||||||
dataset->element[curelem].rmatrix = NULL;
|
PROTEIN;
|
||||||
dataset->element[curelem].tmatrix = NULL;
|
dataset->element[curelem].rmatrix =
|
||||||
|
NULL;
|
||||||
|
dataset->element[curelem].tmatrix =
|
||||||
|
NULL;
|
||||||
dataset->element[curelem].col_lut =
|
dataset->element[curelem].col_lut =
|
||||||
Default_PROColor_LKUP;
|
Default_PROColor_LKUP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Find(Inline,"ZZZZZ"))
|
else if (Find(Inline, "ZZZZZ")) {
|
||||||
{
|
|
||||||
Cfree(gencomments);
|
Cfree(gencomments);
|
||||||
genclen = 0;
|
genclen = 0;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (gencomments == NULL) {
|
||||||
if (gencomments == NULL)
|
|
||||||
{
|
|
||||||
gencomments = String(Inline);
|
gencomments = String(Inline);
|
||||||
genclen = strlen(gencomments)+1;
|
genclen = strlen(gencomments) + 1;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
genclen += strlen(Inline) + 1;
|
||||||
genclen += strlen(Inline)+1;
|
gencomments = Realloc(gencomments,
|
||||||
gencomments = Realloc(gencomments,genclen *
|
genclen * sizeof(char));
|
||||||
sizeof(char));
|
strncat(gencomments, Inline, GBUFSIZ);
|
||||||
strncat(gencomments,Inline,GBUFSIZ);
|
strncat(gencomments, "\n", GBUFSIZ);
|
||||||
strncat(gencomments,"\n",GBUFSIZ);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Cfree(buffer);
|
Cfree(buffer);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
for(j=0;j<dataset->numelements;j++)
|
for (j = 0; j < dataset->numelements; j++)
|
||||||
dataset->maxlen = MAX(dataset->maxlen,
|
dataset->maxlen =
|
||||||
dataset->element[j].seqlen+dataset->element[j].offset);
|
MAX(dataset->maxlen, dataset->element[j].seqlen +
|
||||||
|
dataset->element[j].offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct mya {
|
typedef struct mya {
|
||||||
int yy;
|
int yy;
|
||||||
int mm;
|
int mm;
|
||||||
|
@ -245,7 +244,7 @@ typedef struct mya {
|
||||||
int sc;
|
int sc;
|
||||||
} sA;
|
} sA;
|
||||||
|
|
||||||
AsciiTime(sA *a,char *asciitime)
|
AsciiTime(sA *a, char *asciitime)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
char temp[GBUFSIZ];
|
char temp[GBUFSIZ];
|
||||||
|
@ -254,186 +253,229 @@ AsciiTime(sA *a,char *asciitime)
|
||||||
a->dd = 0;
|
a->dd = 0;
|
||||||
a->yy = 0;
|
a->yy = 0;
|
||||||
a->mm = 0;
|
a->mm = 0;
|
||||||
sscanf(asciitime,"%d%5c%d",&(a->dd),temp,&(a->yy));
|
sscanf(asciitime, "%d%5c%d", &(a->dd), temp, &(a->yy));
|
||||||
temp[5] = '\0';
|
temp[5] = '\0';
|
||||||
for(j=0;j<12;j++)
|
for (j = 0; j < 12; j++)
|
||||||
if(strcmp(temp,month[j]) == 0)
|
if (strcmp(temp, month[j]) == 0) a->mm = j + 1;
|
||||||
a->mm = j+1;
|
if (a->dd < 0 || a->dd > 31 || a->yy < 0 || a->mm > 11) SetTime(a);
|
||||||
if(a->dd <0 || a->dd > 31 || a->yy < 0 || a->mm > 11)
|
|
||||||
SetTime(a);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WriteGen(aln, filename, method, maskable) NA_Alignment *aln;
|
||||||
WriteGen(aln,filename,method,maskable)
|
|
||||||
NA_Alignment *aln;
|
|
||||||
char *filename;
|
char *filename;
|
||||||
int method,maskable;
|
int method, maskable;
|
||||||
{
|
{
|
||||||
int i,j,k,mask = -1;
|
int i, j, k, mask = -1;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
NA_Sequence *this_elem;
|
NA_Sequence *this_elem;
|
||||||
extern char month[12][6];
|
extern char month[12][6];
|
||||||
char c;
|
char c;
|
||||||
if(aln == NULL)
|
if (aln == NULL) return;
|
||||||
return;
|
if (aln->na_ddata == NULL) return;
|
||||||
if(aln->na_ddata == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
file = fopen(filename,"w");
|
file = fopen(filename, "w");
|
||||||
if(file == NULL)
|
if (file == NULL) {
|
||||||
{
|
|
||||||
Warning("Cannot open file for output");
|
Warning("Cannot open file for output");
|
||||||
return(1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(maskable && method != SELECT_REGION)
|
if (maskable && method != SELECT_REGION)
|
||||||
for(j=0;j<aln->numelements;j++)
|
for (j = 0; j < aln->numelements; j++)
|
||||||
if(aln->element[j].elementtype == MASK &&
|
if (aln->element[j].elementtype == MASK &&
|
||||||
aln->element[j].selected)
|
aln->element[j].selected)
|
||||||
mask = j;
|
mask = j;
|
||||||
|
|
||||||
for(j=0;j<aln->numelements;j++)
|
for (j = 0; j < aln->numelements; j++) {
|
||||||
{
|
if ((aln->element[j].selected && j != mask &&
|
||||||
if((aln->element[j].selected && j!=mask && method != SELECT_REGION)
|
method != SELECT_REGION) ||
|
||||||
||(aln->element[j].subselected && method == SELECT_REGION)
|
(aln->element[j].subselected && method == SELECT_REGION) ||
|
||||||
|| (method == ALL))
|
(method == ALL)) {
|
||||||
{
|
|
||||||
this_elem = &(aln->element[j]);
|
this_elem = &(aln->element[j]);
|
||||||
fprintf(file,
|
fprintf(
|
||||||
|
file,
|
||||||
"LOCUS %10s%8d bp %4s %10s %2d%5s%4d\n",
|
"LOCUS %10s%8d bp %4s %10s %2d%5s%4d\n",
|
||||||
this_elem->short_name,this_elem->seqlen+this_elem->offset,
|
this_elem->short_name,
|
||||||
(this_elem->elementtype == DNA) ? "DNA":
|
this_elem->seqlen + this_elem->offset,
|
||||||
(this_elem->elementtype ==RNA)?"RNA":
|
(this_elem->elementtype == DNA) ? "DNA"
|
||||||
(this_elem->elementtype == MASK)?"MASK":
|
: (this_elem->elementtype == RNA) ? "RNA"
|
||||||
(this_elem->elementtype == PROTEIN)?"PROT":"TEXT",
|
: (this_elem->elementtype == MASK) ? "MASK"
|
||||||
this_elem->attr & IS_CIRCULAR?"Circular":"",
|
: (this_elem->elementtype == PROTEIN) ? "PROT"
|
||||||
|
: "TEXT",
|
||||||
|
this_elem->attr & IS_CIRCULAR ? "Circular" : "",
|
||||||
this_elem->t_stamp.origin.dd,
|
this_elem->t_stamp.origin.dd,
|
||||||
month[this_elem->t_stamp.origin.mm-1],
|
month[this_elem->t_stamp.origin.mm - 1],
|
||||||
this_elem->t_stamp.origin.yy>1900?this_elem->t_stamp.origin.yy:
|
this_elem->t_stamp.origin.yy > 1900
|
||||||
this_elem->t_stamp.origin.yy+1900);
|
? this_elem->t_stamp.origin.yy
|
||||||
if(this_elem->description[0])
|
: this_elem->t_stamp.origin.yy + 1900);
|
||||||
fprintf(file,"DEFINITION %s\n",this_elem->description);
|
if (this_elem->description[0])
|
||||||
if(this_elem->seq_name[0])
|
fprintf(file, "DEFINITION %s\n",
|
||||||
fprintf(file," ORGANISM %s\n",this_elem->seq_name);
|
this_elem->description);
|
||||||
if(this_elem->id[0])
|
if (this_elem->seq_name[0])
|
||||||
fprintf(file," ACCESSION %s\n",this_elem->id);
|
fprintf(file, " ORGANISM %s\n",
|
||||||
if(this_elem->authority[0])
|
this_elem->seq_name);
|
||||||
fprintf(file," AUTHORS %s\n",this_elem->authority);
|
if (this_elem->id[0])
|
||||||
if(this_elem->comments)
|
fprintf(file, " ACCESSION %s\n",
|
||||||
fprintf(file,"%s\n",this_elem->comments);
|
this_elem->id);
|
||||||
fprintf(file,"ORIGIN");
|
if (this_elem->authority[0])
|
||||||
if(this_elem->tmatrix)
|
fprintf(file, " AUTHORS %s\n",
|
||||||
{
|
this_elem->authority);
|
||||||
if(mask == -1)
|
if (this_elem->comments)
|
||||||
{
|
fprintf(file, "%s\n", this_elem->comments);
|
||||||
for(i=0,k=0;k<this_elem->seqlen+this_elem->offset;k++)
|
fprintf(file, "ORIGIN");
|
||||||
{
|
if (this_elem->tmatrix) {
|
||||||
if(method == SELECT_REGION)
|
if (mask == -1) {
|
||||||
{
|
for (i = 0, k = 0;
|
||||||
if(aln->selection_mask[k] == '1')
|
k < this_elem->seqlen +
|
||||||
{
|
this_elem->offset;
|
||||||
if(i%60 == 0)
|
k++) {
|
||||||
fprintf(file,"\n%9d",i+1);
|
if (method == SELECT_REGION) {
|
||||||
if(i%10 == 0)
|
if (aln->selection_mask
|
||||||
fprintf(file," ");
|
[k] == '1') {
|
||||||
fprintf(file,"%c",this_elem->tmatrix
|
if (i % 60 == 0)
|
||||||
[getelem(this_elem,k)]);
|
fprintf(
|
||||||
|
file,
|
||||||
|
"\n"
|
||||||
|
"%9"
|
||||||
|
"d",
|
||||||
|
i + 1);
|
||||||
|
if (i % 10 == 0)
|
||||||
|
fprintf(
|
||||||
|
file,
|
||||||
|
" ");
|
||||||
|
fprintf(
|
||||||
|
file, "%c",
|
||||||
|
this_elem->tmatrix
|
||||||
|
[getelem(
|
||||||
|
this_elem,
|
||||||
|
k)]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (i % 60 == 0)
|
||||||
if(i%60 == 0)
|
fprintf(file,
|
||||||
fprintf(file,"\n%9d",i+1);
|
"\n%9d",
|
||||||
if(i%10 == 0)
|
i + 1);
|
||||||
fprintf(file," ");
|
if (i % 10 == 0)
|
||||||
fprintf(file,"%c",this_elem->tmatrix
|
fprintf(file,
|
||||||
[getelem(this_elem,k)]);
|
" ");
|
||||||
|
fprintf(
|
||||||
|
file, "%c",
|
||||||
|
this_elem->tmatrix
|
||||||
|
[getelem(
|
||||||
|
this_elem,
|
||||||
|
k)]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
for (k = 0; k < this_elem->seqlen +
|
||||||
for(k=0;k<this_elem->seqlen+this_elem->offset;k++)
|
this_elem->offset;
|
||||||
{
|
k++) {
|
||||||
c =(char)getelem(&(aln->element[mask]),k);
|
c = (char)getelem(
|
||||||
if(c != '0' && c!= '-')
|
&(aln->element[mask]), k);
|
||||||
{
|
if (c != '0' && c != '-') {
|
||||||
if(k%60 == 0)
|
if (k % 60 == 0)
|
||||||
fprintf(file,"\n%9d",k+1);
|
fprintf(file,
|
||||||
if(k%10 == 0)
|
"\n%9d",
|
||||||
fprintf(file," ");
|
k + 1);
|
||||||
fprintf(file,"%c",this_elem->tmatrix
|
if (k % 10 == 0)
|
||||||
[getelem(this_elem,k)]);
|
fprintf(file,
|
||||||
|
" ");
|
||||||
|
fprintf(
|
||||||
|
file, "%c",
|
||||||
|
this_elem->tmatrix
|
||||||
|
[getelem(
|
||||||
|
this_elem,
|
||||||
|
k)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (mask == -1) {
|
||||||
if(mask == -1)
|
for (i = 0, k = 0;
|
||||||
{
|
k < this_elem->seqlen +
|
||||||
for(i=0,k=0;k<this_elem->seqlen+this_elem->offset;k++)
|
this_elem->offset;
|
||||||
{
|
k++) {
|
||||||
if(method == SELECT_REGION)
|
if (method == SELECT_REGION) {
|
||||||
{
|
if (aln->selection_mask
|
||||||
if(aln->selection_mask[k] == '1')
|
[k] == '1') {
|
||||||
{
|
if (i % 60 == 0)
|
||||||
if(i%60 == 0)
|
fprintf(
|
||||||
fprintf(file,"\n%9d",i+1);
|
file,
|
||||||
if(i%10 == 0)
|
"\n"
|
||||||
fprintf(file," ");
|
"%9"
|
||||||
fprintf(file,"%c", getelem(this_elem,k));
|
"d",
|
||||||
|
i + 1);
|
||||||
|
if (i % 10 == 0)
|
||||||
|
fprintf(
|
||||||
|
file,
|
||||||
|
" ");
|
||||||
|
fprintf(
|
||||||
|
file, "%c",
|
||||||
|
getelem(
|
||||||
|
this_elem,
|
||||||
|
k));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (i % 60 == 0)
|
||||||
if(i%60 == 0)
|
fprintf(file,
|
||||||
fprintf(file,"\n%9d",i+1);
|
"\n%9d",
|
||||||
if(i%10 == 0)
|
i + 1);
|
||||||
fprintf(file," ");
|
if (i % 10 == 0)
|
||||||
fprintf(file,"%c",getelem(this_elem,k));
|
fprintf(file,
|
||||||
|
" ");
|
||||||
|
fprintf(
|
||||||
|
file, "%c",
|
||||||
|
getelem(this_elem,
|
||||||
|
k));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
for (k = 0; k < this_elem->seqlen +
|
||||||
for(k=0;k<this_elem->seqlen+this_elem->offset;k++)
|
this_elem->offset;
|
||||||
{
|
k++) {
|
||||||
c =(char)getelem(&(aln->element[mask]),k);
|
c = (char)getelem(
|
||||||
if(c != '0' && c!= '-')
|
&(aln->element[mask]), k);
|
||||||
{
|
if (c != '0' && c != '-') {
|
||||||
if(k%60 == 0)
|
if (k % 60 == 0)
|
||||||
fprintf(file,"\n%9d",k+1);
|
fprintf(file,
|
||||||
if(k%10 == 0)
|
"\n%9d",
|
||||||
fprintf(file," ");
|
k + 1);
|
||||||
fprintf(file,"%c",getelem(this_elem,k));
|
if (k % 10 == 0)
|
||||||
|
fprintf(file,
|
||||||
|
" ");
|
||||||
|
fprintf(
|
||||||
|
file, "%c",
|
||||||
|
getelem(this_elem,
|
||||||
|
k));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(file,"\n//\n");
|
fprintf(file, "\n//\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SetTime(sA *a)
|
SetTime(sA *a)
|
||||||
{
|
{
|
||||||
struct tm *tim,*localtime();
|
struct tm *tim, *localtime();
|
||||||
long clock;
|
long clock;
|
||||||
|
|
||||||
clock = time(0);
|
clock = time(0);
|
||||||
tim = localtime(&clock);
|
tim = localtime(&clock);
|
||||||
|
|
||||||
a->yy = tim->tm_year;
|
a->yy = tim->tm_year;
|
||||||
a->mm = tim->tm_mon+1;
|
a->mm = tim->tm_mon + 1;
|
||||||
a->dd = tim->tm_mday;
|
a->dd = tim->tm_mday;
|
||||||
a->hr = tim->tm_hour;
|
a->hr = tim->tm_hour;
|
||||||
a->mn = tim->tm_min;
|
a->mn = tim->tm_min;
|
||||||
|
@ -442,24 +484,20 @@ SetTime(sA *a)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CheckType: Check base composition to see if the sequence
|
* CheckType: Check base composition to see if the sequence
|
||||||
* appears to be an amino acid sequence. If it is, pass back
|
* appears to be an amino acid sequence. If it is, pass back
|
||||||
* TRUE, else FALSE.
|
* TRUE, else FALSE.
|
||||||
*/
|
*/
|
||||||
CheckType(seq,len)
|
CheckType(seq, len) char *seq;
|
||||||
char *seq;
|
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
|
int j, count1 = 0, count2 = 0;
|
||||||
|
|
||||||
int j,count1 = 0,count2 = 0;
|
for (j = 0; j < len; j++)
|
||||||
|
if (((seq[j] | 32) < 'z') && ((seq[j] | 32) > 'a')) {
|
||||||
for(j=0;j<len;j++)
|
|
||||||
if(((seq[j]|32) < 'z') && ((seq[j]|32) > 'a'))
|
|
||||||
{
|
|
||||||
count1++;
|
count1++;
|
||||||
if(index("ACGTUNacgtun",seq[j]) == NULL)
|
if (index("ACGTUNacgtun", seq[j]) == NULL) count2++;
|
||||||
count2++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return( (count2 > count1/4)?TRUE:FALSE);
|
return ((count2 > count1 / 4) ? TRUE : FALSE);
|
||||||
}
|
}
|
||||||
|
|
952
CORE/HGLfile.c
952
CORE/HGLfile.c
File diff suppressed because it is too large
Load diff
690
CORE/ParseMenu.c
690
CORE/ParseMenu.c
|
@ -1,9 +1,10 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <xview/xview.h>
|
#include <stdio.h>
|
||||||
#include <xview/panel.h>
|
#include <xview/panel.h>
|
||||||
#include "menudefs.h"
|
#include <xview/xview.h>
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "menudefs.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ParseMenus(): Read in the menu config file, and generate the internal
|
ParseMenus(): Read in the menu config file, and generate the internal
|
||||||
|
@ -24,106 +25,98 @@ int num_menus;
|
||||||
|
|
||||||
ParseMenu()
|
ParseMenu()
|
||||||
{
|
{
|
||||||
int j,curmenu = -1,curitem = 0;
|
int j, curmenu = -1, curitem = 0;
|
||||||
int curchoice = 0 ,curarg = 0,curinput = 0, curoutput = 0;
|
int curchoice = 0, curarg = 0, curinput = 0, curoutput = 0;
|
||||||
char Inline[GBUFSIZ],temp[GBUFSIZ],head[GBUFSIZ];
|
char Inline[GBUFSIZ], temp[GBUFSIZ], head[GBUFSIZ];
|
||||||
char tail[GBUFSIZ],*home;
|
char tail[GBUFSIZ], *home;
|
||||||
Gmenu *thismenu;
|
Gmenu *thismenu;
|
||||||
GmenuItem *thisitem;
|
GmenuItem *thisitem;
|
||||||
GmenuItemArg *thisarg;
|
GmenuItemArg *thisarg;
|
||||||
GfileFormat *thisinput,*thisoutput;
|
GfileFormat *thisinput, *thisoutput;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char *resize;
|
char *resize;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the menu configuration file ".GDEmenus"
|
* Open the menu configuration file ".GDEmenus"
|
||||||
* First search the local directory, then the home directory.
|
* First search the local directory, then the home directory.
|
||||||
*/
|
*/
|
||||||
file=fopen(".GDEmenus","r");
|
file = fopen(".GDEmenus", "r");
|
||||||
if(file == NULL)
|
if (file == NULL) {
|
||||||
{
|
home = (char *)getenv("HOME");
|
||||||
home = (char*)getenv("HOME");
|
strcpy(temp, home);
|
||||||
strcpy(temp,home);
|
strcat(temp, "/.GDEmenus");
|
||||||
strcat(temp,"/.GDEmenus");
|
|
||||||
|
|
||||||
file=fopen(temp,"r");
|
file = fopen(temp, "r");
|
||||||
if(file == NULL)
|
if (file == NULL) {
|
||||||
{
|
home = (char *)getenv("GDE_HELP_DIR");
|
||||||
home = (char*)getenv("GDE_HELP_DIR");
|
if (home != NULL) {
|
||||||
if(home != NULL)
|
strcpy(temp, home);
|
||||||
{
|
strcat(temp, "/.GDEmenus");
|
||||||
strcpy(temp,home);
|
file = fopen(temp, "r");
|
||||||
strcat(temp,"/.GDEmenus");
|
|
||||||
file=fopen(temp,"r");
|
|
||||||
}
|
}
|
||||||
if(file == NULL)
|
if (file == NULL)
|
||||||
Error(
|
Error(
|
||||||
".GDEmenus file not in the home, local, or $GDE_HELP_DIR directory");
|
".GDEmenus file not in the home, local, or "
|
||||||
|
"$GDE_HELP_DIR directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read the .GDEmenus file, and assemble an internal representation
|
* Read the .GDEmenus file, and assemble an internal representation
|
||||||
* of the menu/menu-item hierarchy.
|
* of the menu/menu-item hierarchy.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for(;getline(file,Inline) != EOF;)
|
for (; gde_getline(file, Inline) != EOF;) {
|
||||||
{
|
/*
|
||||||
/*
|
* menu: chooses menu to use
|
||||||
* menu: chooses menu to use
|
*/
|
||||||
*/
|
if (Inline[0] == '#')
|
||||||
if(Inline[0] == '#');
|
;
|
||||||
else if(Find(Inline,"menu:"))
|
else if (Find(Inline, "menu:")) {
|
||||||
{
|
crop(Inline, head, temp);
|
||||||
crop(Inline,head,temp);
|
|
||||||
curmenu = -1;
|
curmenu = -1;
|
||||||
for(j=0;j<num_menus;j++)
|
for (j = 0; j < num_menus; j++)
|
||||||
if(Find(temp,menu[j].label))
|
if (Find(temp, menu[j].label)) curmenu = j;
|
||||||
curmenu=j;
|
/*
|
||||||
/*
|
* If menu not found, make a new one
|
||||||
* If menu not found, make a new one
|
*/
|
||||||
*/
|
if (curmenu == -1) {
|
||||||
if(curmenu == -1)
|
|
||||||
{
|
|
||||||
curmenu = num_menus++;
|
curmenu = num_menus++;
|
||||||
thismenu = &menu[curmenu];
|
thismenu = &menu[curmenu];
|
||||||
thismenu->label =
|
thismenu->label = (char *)calloc(
|
||||||
(char*)calloc(strlen(temp)+1,sizeof(char));
|
strlen(temp) + 1, sizeof(char));
|
||||||
|
|
||||||
if(thismenu->label == NULL)
|
if (thismenu->label == NULL) Error("Calloc");
|
||||||
Error("Calloc");
|
(void)strcpy(thismenu->label, temp);
|
||||||
(void)strcpy(thismenu->label,temp);
|
thismenu->numitems = 0;
|
||||||
thismenu->numitems = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* item: chooses menu item to use
|
* item: chooses menu item to use
|
||||||
*/
|
*/
|
||||||
else if(Find(Inline,"item:"))
|
else if (Find(Inline, "item:")) {
|
||||||
{
|
|
||||||
curarg = -1;
|
curarg = -1;
|
||||||
curinput = -1;
|
curinput = -1;
|
||||||
curoutput = -1;
|
curoutput = -1;
|
||||||
crop(Inline,head,temp);
|
crop(Inline, head, temp);
|
||||||
curitem = thismenu->numitems++;
|
curitem = thismenu->numitems++;
|
||||||
/*
|
/*
|
||||||
* Resize the item list for this menu (add one item);
|
* Resize the item list for this menu (add one
|
||||||
*/
|
*item);
|
||||||
if(curitem == 0)
|
*/
|
||||||
resize = (char*)calloc(1,sizeof(GmenuItem));
|
if (curitem == 0)
|
||||||
|
resize = (char *)calloc(1, sizeof(GmenuItem));
|
||||||
else
|
else
|
||||||
resize = realloc(thismenu->item,
|
resize = realloc(
|
||||||
thismenu -> numitems*sizeof(GmenuItem) );
|
thismenu->item,
|
||||||
|
thismenu->numitems * sizeof(GmenuItem));
|
||||||
|
|
||||||
if(resize == NULL)
|
if (resize == NULL) Error("Calloc");
|
||||||
Error ("Calloc");
|
thismenu->item = (GmenuItem *)resize;
|
||||||
thismenu->item =(GmenuItem*)resize;
|
|
||||||
|
|
||||||
thisitem = &(thismenu->item[curitem]);
|
thisitem = &(thismenu->item[curitem]);
|
||||||
thisitem->label = (char*)calloc(strlen(temp)+1,
|
thisitem->label =
|
||||||
sizeof(char));
|
(char *)calloc(strlen(temp) + 1, sizeof(char));
|
||||||
thisitem->meta = '\0';
|
thisitem->meta = '\0';
|
||||||
thisitem->numinputs = 0;
|
thisitem->numinputs = 0;
|
||||||
thisitem->numoutputs = 0;
|
thisitem->numoutputs = 0;
|
||||||
|
@ -131,74 +124,66 @@ ParseMenu()
|
||||||
thisitem->X = 0;
|
thisitem->X = 0;
|
||||||
thisitem->help = NULL;
|
thisitem->help = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create new item
|
* Create new item
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(thisitem->label == NULL)
|
if (thisitem->label == NULL) Error("Calloc");
|
||||||
Error("Calloc");
|
(void)strcpy(thisitem->label, temp);
|
||||||
(void)strcpy(thisitem->label,temp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* itemmethod: generic command line generated by this item
|
* itemmethod: generic command line generated by this item
|
||||||
*/
|
*/
|
||||||
else if(Find(Inline,"itemmethod:"))
|
else if (Find(Inline, "itemmethod:")) {
|
||||||
{
|
crop(Inline, head, temp);
|
||||||
crop(Inline,head,temp);
|
|
||||||
thisitem->method =
|
thisitem->method =
|
||||||
(char*)calloc(strlen(temp)+1,sizeof(char));
|
(char *)calloc(strlen(temp) + 1, sizeof(char));
|
||||||
if(thisitem->method == NULL)
|
if (thisitem->method == NULL) Error("Calloc");
|
||||||
Error("Calloc");
|
(void)strcpy(thisitem->method, temp);
|
||||||
(void)strcpy(thisitem->method,temp);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Help file
|
* Help file
|
||||||
*/
|
*/
|
||||||
else if(Find(Inline,"itemhelp:"))
|
else if (Find(Inline, "itemhelp:")) {
|
||||||
{
|
crop(Inline, head, temp);
|
||||||
crop(Inline,head,temp);
|
|
||||||
thisitem->help =
|
thisitem->help =
|
||||||
(char*)calloc(strlen(temp)+1,sizeof(char));
|
(char *)calloc(strlen(temp) + 1, sizeof(char));
|
||||||
if(thisitem->method == NULL)
|
if (thisitem->method == NULL) Error("Calloc");
|
||||||
Error("Calloc");
|
(void)strcpy(thisitem->help, temp);
|
||||||
(void)strcpy(thisitem->help,temp);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Meta key equiv
|
* Meta key equiv
|
||||||
*/
|
*/
|
||||||
else if(Find(Inline,"itemmeta:"))
|
else if (Find(Inline, "itemmeta:")) {
|
||||||
{
|
crop(Inline, head, temp);
|
||||||
crop(Inline,head,temp);
|
|
||||||
thisitem->meta = temp[0];
|
thisitem->meta = temp[0];
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* arg: defines the symbol for a command line arguement.
|
* arg: defines the symbol for a command line arguement.
|
||||||
* this is used for substitution into the itemmethod
|
* this is used for substitution into the
|
||||||
* definition.
|
*itemmethod definition.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if(Find(Inline,"arg:"))
|
else if (Find(Inline, "arg:")) {
|
||||||
{
|
crop(Inline, head, temp);
|
||||||
crop(Inline,head,temp);
|
curarg = thisitem->numargs++;
|
||||||
curarg=thisitem->numargs++;
|
if (curarg == 0)
|
||||||
if(curarg == 0)
|
resize =
|
||||||
resize = (char*)calloc(1,sizeof(GmenuItemArg));
|
(char *)calloc(1, sizeof(GmenuItemArg));
|
||||||
else
|
else
|
||||||
resize = realloc(thisitem->arg,
|
resize = realloc(
|
||||||
thisitem->numargs*sizeof(GmenuItemArg) );
|
thisitem->arg,
|
||||||
|
thisitem->numargs * sizeof(GmenuItemArg));
|
||||||
|
|
||||||
|
if (resize == NULL) Error("arg: Realloc");
|
||||||
|
|
||||||
if(resize == NULL)
|
(thisitem->arg) = (GmenuItemArg *)resize;
|
||||||
Error("arg: Realloc");
|
|
||||||
|
|
||||||
(thisitem->arg) = (GmenuItemArg*)resize;
|
|
||||||
thisarg = &(thisitem->arg[curarg]);
|
thisarg = &(thisitem->arg[curarg]);
|
||||||
thisarg->symbol = (char*)calloc(strlen(temp)+1,
|
thisarg->symbol =
|
||||||
sizeof(char));
|
(char *)calloc(strlen(temp) + 1, sizeof(char));
|
||||||
if(thisarg->symbol == NULL)
|
if (thisarg->symbol == NULL) Error("Calloc");
|
||||||
Error("Calloc");
|
(void)strcpy(thisarg->symbol, temp);
|
||||||
(void)strcpy(thisarg->symbol,temp);
|
|
||||||
thisarg->optional = FALSE;
|
thisarg->optional = FALSE;
|
||||||
thisarg->type = 0;
|
thisarg->type = 0;
|
||||||
thisarg->min = 0;
|
thisarg->min = 0;
|
||||||
|
@ -208,153 +193,145 @@ ParseMenu()
|
||||||
thisarg->textvalue = NULL;
|
thisarg->textvalue = NULL;
|
||||||
thisarg->value = 0;
|
thisarg->value = 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* argtype: Defines the type of argument (menu,chooser, text, slider)
|
* argtype: Defines the type of argument (menu,chooser,
|
||||||
*/
|
*text, slider)
|
||||||
else if(Find(Inline,"argtype:"))
|
*/
|
||||||
{
|
else if (Find(Inline, "argtype:")) {
|
||||||
crop(Inline,head,temp);
|
crop(Inline, head, temp);
|
||||||
if(strcmp(temp,"text")==0)
|
if (strcmp(temp, "text") == 0) {
|
||||||
{
|
thisarg->type = TEXTFIELD;
|
||||||
thisarg->type=TEXTFIELD;
|
|
||||||
thisarg->textvalue =
|
thisarg->textvalue =
|
||||||
(char*)calloc(GBUFSIZ,sizeof(char));
|
(char *)calloc(GBUFSIZ, sizeof(char));
|
||||||
if(thisarg->textvalue == NULL)
|
if (thisarg->textvalue == NULL) Error("Calloc");
|
||||||
Error("Calloc");
|
|
||||||
}
|
}
|
||||||
else if(strcmp(temp,"choice_list")==0)
|
else if (strcmp(temp, "choice_list") == 0)
|
||||||
thisarg->type=CHOICE_LIST;
|
thisarg->type = CHOICE_LIST;
|
||||||
else if(strcmp(temp,"choice_menu")==0)
|
else if (strcmp(temp, "choice_menu") == 0)
|
||||||
thisarg->type=CHOICE_MENU;
|
thisarg->type = CHOICE_MENU;
|
||||||
else if(strcmp(temp,"chooser")==0)
|
else if (strcmp(temp, "chooser") == 0)
|
||||||
thisarg->type=CHOOSER;
|
thisarg->type = CHOOSER;
|
||||||
else if(strcmp(temp,"slider")==0)
|
else if (strcmp(temp, "slider") == 0)
|
||||||
thisarg->type=SLIDER;
|
thisarg->type = SLIDER;
|
||||||
else
|
else
|
||||||
Error(sprintf(head,"Unknown argtype %s",temp));
|
Error(
|
||||||
|
sprintf(head, "Unknown argtype %s", temp));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* argtext: The default text value of the symbol.
|
* argtext: The default text value of the symbol.
|
||||||
* $argument is replaced by this value if it is not
|
* $argument is replaced by this value if it is not
|
||||||
* changed in the dialog box by the user.
|
* changed in the dialog box by the user.
|
||||||
*/
|
*/
|
||||||
else if(Find(Inline,"argtext:"))
|
else if (Find(Inline, "argtext:")) {
|
||||||
{
|
crop(Inline, head, temp);
|
||||||
crop(Inline,head,temp);
|
(void)strcpy(thisarg->textvalue, temp);
|
||||||
(void)strcpy(thisarg->textvalue,temp);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* arglabel: Text label displayed in the dialog box for
|
* arglabel: Text label displayed in the dialog box for
|
||||||
* this argument. It should be a discriptive label.
|
* this argument. It should be a discriptive
|
||||||
*/
|
*label.
|
||||||
else if(Find(Inline,"arglabel:"))
|
*/
|
||||||
{
|
else if (Find(Inline, "arglabel:")) {
|
||||||
crop(Inline,head,temp);
|
crop(Inline, head, temp);
|
||||||
thisarg->label=(char*)calloc(strlen(temp)+1,
|
thisarg->label =
|
||||||
sizeof(char));
|
(char *)calloc(strlen(temp) + 1, sizeof(char));
|
||||||
if(thisarg->label == NULL)
|
if (thisarg->label == NULL) Error("Calloc");
|
||||||
Error("Calloc");
|
(void)strcpy(thisarg->label, temp);
|
||||||
(void)strcpy(thisarg->label,temp);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Argument choice values use the following notation:
|
* Argument choice values use the following notation:
|
||||||
*
|
*
|
||||||
* argchoice:Displayed value:Method
|
* argchoice:Displayed value:Method
|
||||||
*
|
*
|
||||||
* Where "Displayed value" is the label displayed in the dialog box
|
* Where "Displayed value" is the label displayed in the
|
||||||
* and "Method" is the value passed back on the command line.
|
*dialog box and "Method" is the value passed back on the
|
||||||
*/
|
*command line.
|
||||||
else if(Find(Inline,"argchoice:"))
|
*/
|
||||||
{
|
else if (Find(Inline, "argchoice:")) {
|
||||||
crop(Inline,head,temp);
|
crop(Inline, head, temp);
|
||||||
crop(temp,head,tail);
|
crop(temp, head, tail);
|
||||||
curchoice = thisarg->numchoices++;
|
curchoice = thisarg->numchoices++;
|
||||||
if(curchoice == 0)
|
if (curchoice == 0)
|
||||||
resize = (char*)calloc(1,sizeof(GargChoice));
|
resize = (char *)calloc(1, sizeof(GargChoice));
|
||||||
else
|
else
|
||||||
resize = realloc(thisarg->choice,
|
resize = realloc(
|
||||||
thisarg->numchoices*sizeof(GargChoice));
|
thisarg->choice,
|
||||||
|
thisarg->numchoices * sizeof(GargChoice));
|
||||||
|
|
||||||
if(resize == NULL)
|
if (resize == NULL) Error("argchoice: Realloc");
|
||||||
Error("argchoice: Realloc");
|
thisarg->choice = (GargChoice *)resize;
|
||||||
thisarg->choice = (GargChoice*)resize;
|
|
||||||
|
|
||||||
(thisarg->choice[curchoice].label) = NULL;
|
(thisarg->choice[curchoice].label) = NULL;
|
||||||
(thisarg->choice[curchoice].method) = NULL;
|
(thisarg->choice[curchoice].method) = NULL;
|
||||||
|
|
||||||
(thisarg->choice[curchoice].label) =
|
(thisarg->choice[curchoice].label) =
|
||||||
(char*)calloc(strlen(head)+1,sizeof(char));
|
(char *)calloc(strlen(head) + 1, sizeof(char));
|
||||||
|
|
||||||
(thisarg->choice[curchoice].method) =
|
(thisarg->choice[curchoice].method) =
|
||||||
(char*)calloc(strlen(tail)+1,sizeof(char));
|
(char *)calloc(strlen(tail) + 1, sizeof(char));
|
||||||
|
|
||||||
if(thisarg->choice[curchoice].method == NULL ||
|
if (thisarg->choice[curchoice].method == NULL ||
|
||||||
thisarg->choice[curchoice].label == NULL)
|
thisarg->choice[curchoice].label == NULL)
|
||||||
Error("Calloc");
|
Error("Calloc");
|
||||||
|
|
||||||
(void)strcpy(thisarg->choice[curchoice].label,head);
|
(void)strcpy(thisarg->choice[curchoice].label, head);
|
||||||
(void)strcpy(thisarg->choice[curchoice].method,tail);
|
(void)strcpy(thisarg->choice[curchoice].method, tail);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* argmin: Minimum value for a slider
|
* argmin: Minimum value for a slider
|
||||||
*/
|
*/
|
||||||
else if(Find(Inline,"argmin:"))
|
else if (Find(Inline, "argmin:")) {
|
||||||
{
|
crop(Inline, head, temp);
|
||||||
crop(Inline,head,temp);
|
(void)sscanf(temp, "%d", &(thisarg->min));
|
||||||
(void)sscanf(temp,"%d",&(thisarg->min));
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* argmax: Maximum value for a slider
|
* argmax: Maximum value for a slider
|
||||||
*/
|
*/
|
||||||
else if(Find(Inline,"argmax:"))
|
else if (Find(Inline, "argmax:")) {
|
||||||
{
|
crop(Inline, head, temp);
|
||||||
crop(Inline,head,temp);
|
(void)sscanf(temp, "%d", &(thisarg->max));
|
||||||
(void)sscanf(temp,"%d",&(thisarg->max));
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* argmethod: Command line flag associated with this argument.
|
* argmethod: Command line flag associated with this
|
||||||
* Replaces argument in itemmethod description.
|
*argument. Replaces argument in itemmethod description.
|
||||||
*/
|
*/
|
||||||
else if(Find(Inline,"argmethod:"))
|
else if (Find(Inline, "argmethod:")) {
|
||||||
{
|
crop(Inline, head, temp);
|
||||||
crop(Inline,head,temp);
|
thisarg->method = (char *)calloc(GBUFSIZ, strlen(temp));
|
||||||
thisarg->method = (char*)calloc(GBUFSIZ,strlen(temp));
|
if (thisarg->method == NULL) Error("Calloc");
|
||||||
if(thisarg->method == NULL)
|
(void)strcpy(thisarg->method, tail);
|
||||||
Error("Calloc");
|
|
||||||
(void)strcpy(thisarg->method,tail);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* argvalue: default value for a slider
|
* argvalue: default value for a slider
|
||||||
*/
|
*/
|
||||||
else if(Find(Inline,"argvalue:"))
|
else if (Find(Inline, "argvalue:")) {
|
||||||
{
|
crop(Inline, head, temp);
|
||||||
crop(Inline,head,temp);
|
if (thisarg->type == TEXT)
|
||||||
if(thisarg->type == TEXT)
|
strcpy(thisarg->textvalue, temp);
|
||||||
strcpy(thisarg->textvalue,temp);
|
|
||||||
else
|
else
|
||||||
(void)sscanf(temp,"%d",&(thisarg->value));
|
(void)sscanf(temp, "%d", &(thisarg->value));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* argoptional: Flag specifying that an arguement is optional
|
* argoptional: Flag specifying that an arguement is
|
||||||
*/
|
*optional
|
||||||
else if(Find(Inline,"argoptional:"))
|
*/
|
||||||
|
else if (Find(Inline, "argoptional:"))
|
||||||
thisarg->optional = TRUE;
|
thisarg->optional = TRUE;
|
||||||
/*
|
/*
|
||||||
* in: Input file description
|
* in: Input file description
|
||||||
*/
|
*/
|
||||||
else if(Find(Inline,"in:"))
|
else if (Find(Inline, "in:")) {
|
||||||
{
|
crop(Inline, head, temp);
|
||||||
crop(Inline,head,temp);
|
|
||||||
curinput = (thisitem->numinputs)++;
|
curinput = (thisitem->numinputs)++;
|
||||||
if(curinput == 0)
|
if (curinput == 0)
|
||||||
resize = (char*)calloc(1,sizeof(GfileFormat));
|
resize = (char *)calloc(1, sizeof(GfileFormat));
|
||||||
else
|
else
|
||||||
resize = realloc(thisitem->input,
|
resize = realloc(thisitem->input,
|
||||||
(thisitem->numinputs)*sizeof(GfileFormat));
|
(thisitem->numinputs) *
|
||||||
|
sizeof(GfileFormat));
|
||||||
|
|
||||||
if(resize == NULL)
|
if (resize == NULL) Error("in: Realloc");
|
||||||
Error("in: Realloc");
|
thisitem->input = (GfileFormat *)resize;
|
||||||
thisitem->input = (GfileFormat*)resize;
|
|
||||||
thisinput = &(thisitem->input)[curinput];
|
thisinput = &(thisitem->input)[curinput];
|
||||||
thisinput->save = FALSE;
|
thisinput->save = FALSE;
|
||||||
thisinput->overwrite = FALSE;
|
thisinput->overwrite = FALSE;
|
||||||
|
@ -365,176 +342,155 @@ ParseMenu()
|
||||||
thisinput->select = SELECTED;
|
thisinput->select = SELECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* out: Output file description
|
* out: Output file description
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if(Find(Inline,"out:"))
|
else if (Find(Inline, "out:")) {
|
||||||
{
|
crop(Inline, head, temp);
|
||||||
crop(Inline,head,temp);
|
|
||||||
curoutput = (thisitem->numoutputs)++;
|
curoutput = (thisitem->numoutputs)++;
|
||||||
if(curoutput == 0)
|
if (curoutput == 0)
|
||||||
resize = (char*)calloc(1,sizeof(GfileFormat));
|
resize = (char *)calloc(1, sizeof(GfileFormat));
|
||||||
else
|
else
|
||||||
resize = realloc(thisitem->output,
|
resize = realloc(thisitem->output,
|
||||||
(thisitem->numoutputs)*sizeof(GfileFormat));
|
(thisitem->numoutputs) *
|
||||||
|
sizeof(GfileFormat));
|
||||||
|
|
||||||
if(resize == NULL)
|
if (resize == NULL) Error("out: Realloc");
|
||||||
Error("out: Realloc");
|
thisitem->output = (GfileFormat *)resize;
|
||||||
thisitem->output = (GfileFormat*)resize;
|
|
||||||
thisoutput = &(thisitem->output)[curoutput];
|
thisoutput = &(thisitem->output)[curoutput];
|
||||||
thisitem->output = (GfileFormat*)resize;
|
thisitem->output = (GfileFormat *)resize;
|
||||||
thisoutput = &(thisitem->output)[curoutput];
|
thisoutput = &(thisitem->output)[curoutput];
|
||||||
thisoutput->save = FALSE;
|
thisoutput->save = FALSE;
|
||||||
thisoutput->overwrite = FALSE;
|
thisoutput->overwrite = FALSE;
|
||||||
thisoutput->format = 0;
|
thisoutput->format = 0;
|
||||||
thisoutput->symbol= String(temp);
|
thisoutput->symbol = String(temp);
|
||||||
thisoutput->name = NULL;
|
thisoutput->name = NULL;
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"informat:"))
|
else if (Find(Inline, "informat:")) {
|
||||||
{
|
if (thisinput == NULL) Error("Problem with .GDEmenus");
|
||||||
if(thisinput == NULL)
|
crop(Inline, head, tail);
|
||||||
Error("Problem with .GDEmenus");
|
if (Find(tail, "genbank"))
|
||||||
crop(Inline,head,tail);
|
|
||||||
if(Find(tail,"genbank"))
|
|
||||||
thisinput->format = GENBANK;
|
thisinput->format = GENBANK;
|
||||||
else if(Find(tail,"gde"))
|
else if (Find(tail, "gde"))
|
||||||
thisinput->format = GDE;
|
thisinput->format = GDE;
|
||||||
else if(Find(tail,"na_flat"))
|
else if (Find(tail, "na_flat"))
|
||||||
thisinput->format = NA_FLAT;
|
thisinput->format = NA_FLAT;
|
||||||
else if(Find(tail,"colormask"))
|
else if (Find(tail, "colormask"))
|
||||||
thisinput->format = COLORMASK;
|
thisinput->format = COLORMASK;
|
||||||
else if(Find(tail,"flat"))
|
else if (Find(tail, "flat"))
|
||||||
thisinput->format = NA_FLAT;
|
thisinput->format = NA_FLAT;
|
||||||
else if(Find(tail,"status"))
|
else if (Find(tail, "status"))
|
||||||
thisinput->format = STATUS_FILE;
|
thisinput->format = STATUS_FILE;
|
||||||
else fprintf(stderr,"Warning, unknown file format %s\n"
|
else
|
||||||
,tail);
|
fprintf(stderr,
|
||||||
|
"Warning, unknown file format %s\n",
|
||||||
|
tail);
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"insave:"))
|
else if (Find(Inline, "insave:")) {
|
||||||
{
|
if (thisinput == NULL) Error("Problem with .GDEmenus");
|
||||||
if(thisinput == NULL)
|
|
||||||
Error("Problem with .GDEmenus");
|
|
||||||
thisinput->save = TRUE;
|
thisinput->save = TRUE;
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"inselect:"))
|
else if (Find(Inline, "inselect:")) {
|
||||||
{
|
if (thisinput == NULL) Error("Problem with .GDEmenus");
|
||||||
if(thisinput == NULL)
|
crop(Inline, head, tail);
|
||||||
Error("Problem with .GDEmenus");
|
if (Find(tail, "one"))
|
||||||
crop(Inline,head,tail);
|
thisinput->select = SELECT_ONE;
|
||||||
if(Find(tail,"one"))
|
else if (Find(tail, "region"))
|
||||||
thisinput->select = SELECT_ONE;
|
thisinput->select = SELECT_REGION;
|
||||||
else if(Find(tail,"region"))
|
else if (Find(tail, "all"))
|
||||||
thisinput->select = SELECT_REGION;
|
thisinput->select = ALL;
|
||||||
else if(Find(tail,"all"))
|
|
||||||
thisinput->select = ALL;
|
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"inmask:"))
|
else if (Find(Inline, "inmask:")) {
|
||||||
{
|
if (thisinput == NULL) Error("Problem with .GDEmenus");
|
||||||
if(thisinput == NULL)
|
|
||||||
Error("Problem with .GDEmenus");
|
|
||||||
thisinput->maskable = TRUE;
|
thisinput->maskable = TRUE;
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"outformat:"))
|
else if (Find(Inline, "outformat:")) {
|
||||||
{
|
if (thisoutput == NULL) Error("Problem with .GDEmenus");
|
||||||
if(thisoutput == NULL)
|
crop(Inline, head, tail);
|
||||||
Error("Problem with .GDEmenus");
|
if (Find(tail, "genbank"))
|
||||||
crop(Inline,head,tail);
|
|
||||||
if(Find(tail,"genbank"))
|
|
||||||
thisoutput->format = GENBANK;
|
thisoutput->format = GENBANK;
|
||||||
else if(Find(tail,"gde"))
|
else if (Find(tail, "gde"))
|
||||||
thisoutput->format = GDE;
|
thisoutput->format = GDE;
|
||||||
else if(Find(tail,"na_flat"))
|
else if (Find(tail, "na_flat"))
|
||||||
thisoutput->format = NA_FLAT;
|
thisoutput->format = NA_FLAT;
|
||||||
else if(Find(tail,"flat"))
|
else if (Find(tail, "flat"))
|
||||||
thisoutput->format = NA_FLAT;
|
thisoutput->format = NA_FLAT;
|
||||||
else if(Find(tail,"status"))
|
else if (Find(tail, "status"))
|
||||||
thisoutput->format = STATUS_FILE;
|
thisoutput->format = STATUS_FILE;
|
||||||
else if(Find(tail,"colormask"))
|
else if (Find(tail, "colormask"))
|
||||||
thisoutput->format = COLORMASK;
|
thisoutput->format = COLORMASK;
|
||||||
else fprintf(stderr,"Warning, unknown file format %s\n"
|
else
|
||||||
,tail);
|
fprintf(stderr,
|
||||||
|
"Warning, unknown file format %s\n",
|
||||||
|
tail);
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"outsave:"))
|
else if (Find(Inline, "outsave:")) {
|
||||||
{
|
if (thisoutput == NULL) Error("Problem with .GDEmenus");
|
||||||
if(thisoutput == NULL)
|
|
||||||
Error("Problem with .GDEmenus");
|
|
||||||
thisoutput->save = TRUE;
|
thisoutput->save = TRUE;
|
||||||
}
|
}
|
||||||
else if(Find(Inline,"outoverwrite:"))
|
else if (Find(Inline, "outoverwrite:")) {
|
||||||
{
|
if (thisoutput == NULL) Error("Problem with .GDEmenus");
|
||||||
if(thisoutput == NULL)
|
|
||||||
Error("Problem with .GDEmenus");
|
|
||||||
thisoutput->overwrite = TRUE;
|
thisoutput->overwrite = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Find(): Search the target string for the given key
|
Find(): Search the target string for the given key
|
||||||
*/
|
*/
|
||||||
Find(target,key)
|
Find(target, key) char *key, *target;
|
||||||
char *key,*target;
|
|
||||||
{
|
{
|
||||||
int i,j,len1,dif,flag = FALSE;
|
int i, j, len1, dif, flag = FALSE;
|
||||||
dif = (strlen(target)) - (len1 = strlen(key)) +1;
|
dif = (strlen(target)) - (len1 = strlen(key)) + 1;
|
||||||
|
|
||||||
if(len1>0)
|
if (len1 > 0)
|
||||||
for(j=0;j<dif && flag == FALSE;j++)
|
for (j = 0; j < dif && flag == FALSE; j++) {
|
||||||
{
|
|
||||||
flag = TRUE;
|
flag = TRUE;
|
||||||
for(i=0;i<len1 && flag;i++)
|
for (i = 0; i < len1 && flag; i++)
|
||||||
flag = (key[i] == target[i+j])?TRUE:FALSE;
|
flag = (key[i] == target[i + j]) ? TRUE : FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
return(flag);
|
return (flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Find2(target, key) char *key, *target;
|
||||||
Find2(target,key)
|
|
||||||
char *key,*target;
|
|
||||||
/*
|
/*
|
||||||
* Like find, but returns the index of the leftmost
|
* Like find, but returns the index of the leftmost
|
||||||
* occurence, and -1 if not found.
|
* occurence, and -1 if not found.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int i,j,len1,dif,flag = FALSE;
|
int i, j, len1, dif, flag = FALSE;
|
||||||
dif = (strlen(target)) - (len1 = strlen(key)) +1;
|
dif = (strlen(target)) - (len1 = strlen(key)) + 1;
|
||||||
|
|
||||||
if(len1>0)
|
if (len1 > 0)
|
||||||
for(j=0;j<dif && flag == FALSE;j++)
|
for (j = 0; j < dif && flag == FALSE; j++) {
|
||||||
{
|
|
||||||
flag = TRUE;
|
flag = TRUE;
|
||||||
for(i=0;i<len1 && flag;i++)
|
for (i = 0; i < len1 && flag; i++)
|
||||||
flag = (key[i] == target[i+j])?TRUE:FALSE;
|
flag = (key[i] == target[i + j]) ? TRUE : FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
return(flag?j-1:-1);
|
return (flag ? j - 1 : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Error(msg) char *msg;
|
||||||
Error(msg)
|
|
||||||
char *msg;
|
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr,"%s\n",msg);
|
(void)fprintf(stderr, "%s\n", msg);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int gde_getline(file, string)
|
||||||
int getline(file,string)
|
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char string[];
|
char string[];
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
int i;
|
int i;
|
||||||
for(i=0;((c=getc(file))!='\n') && (c!=EOF);i++)
|
for (i = 0; ((c = getc(file)) != '\n') && (c != EOF); i++)
|
||||||
string[i]=c;
|
string[i] = c;
|
||||||
string[i] = '\0';
|
string[i] = '\0';
|
||||||
if (i==0 && c==EOF) return (EOF);
|
if (i == 0 && c == EOF)
|
||||||
else return (0);
|
return (EOF);
|
||||||
|
else
|
||||||
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -543,24 +499,24 @@ Crop():
|
||||||
into: "this" and "that[:the_other]"
|
into: "this" and "that[:the_other]"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
crop(input,head,tail)
|
crop(input, head, tail) char input[], head[], tail[];
|
||||||
char input[],head[],tail[];
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Crop needs to be fixed so that whitespace is compressed off the end
|
* Crop needs to be fixed so that whitespace is compressed off the
|
||||||
* of tail
|
*end of tail
|
||||||
*/
|
*/
|
||||||
int offset,end,i,j,length;
|
int offset, end, i, j, length;
|
||||||
|
|
||||||
length=strlen(input);
|
length = strlen(input);
|
||||||
for(offset=0;offset<length && input[offset] != ':';offset++)
|
for (offset = 0; offset < length && input[offset] != ':'; offset++)
|
||||||
head[offset]=input[offset];
|
head[offset] = input[offset];
|
||||||
head[offset++] = '\0';
|
head[offset++] = '\0';
|
||||||
for(;offset<length && input[offset] == ' ';offset++);
|
for (; offset < length && input[offset] == ' '; offset++)
|
||||||
for(end=length-1;input[end] ==' ' && end>offset;end--);
|
;
|
||||||
|
for (end = length - 1; input[end] == ' ' && end > offset; end--)
|
||||||
|
;
|
||||||
|
|
||||||
for(j=0,i=offset;i<=end;i++,j++)
|
for (j = 0, i = offset; i <= end; i++, j++) tail[j] = input[i];
|
||||||
tail[j]=input[i];
|
|
||||||
tail[j] = '\0';
|
tail[j] = '\0';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue