Beispiel #1
0
int main(void)
{     
    char dst[10] = {0};
    char a[] = {'a', 'b', '\0'};
    char b[] = {'a', 'b'};

    printf("strcpy(dst, b) = %s\n", strcpy(dst, b)); //abab
    DIV_LINE;

    printf("strcpy1(dst, a) = %s\n", strcpy1(dst, a)); //ab
    DIV_LINE;

    printf("strcpy1(dst, b) = %s\n", strcpy1(dst, b)); //abab
    DIV_LINE;

    printf("strcpy1(dst, NULL) = %s\n", strcpy1(dst, '\0')); //assert();
    DIV_LINE;

    printf("strcpy1(dst, NULL) = %s\n", strcpy1(dst, NULL)); //assert();
    DIV_LINE;

    printf("strcpy(dst, NULL) = %s\n", strcpy(dst, NULL)); //segmentation fault
    DIV_LINE;

    return 0;
}
Beispiel #2
0
int getarg() { int arglen1; int i; char *c; arglen1=*arglen; 
  if (arglen1) {i=arglen1+0x81; c=i; *c=0; strcpy1(namein, argv); 
    strcpy1(namelst, namein); i=strlen1(namelst); i--; c=&namelst+i; *c='S'; }
  else {strcpy1(namein, "F.C"); strcpy1(namelst, "F.S"); }  
  fdin=open2 (namein);
  if(DOS_ERR !=0){print1("Datei fehlt: "); print1(namein); exit1(1); }
  fdout=creat1(namelst);
  if(DOS_ERR !=0){print1("Datei nicht erzeugbar: ");print1(namelst);exit1(2);}
  prs("\n;Arglen: "); prnum(arglen1); if(arglen1){prs(", Argv: "); prs(argv);}
}  
Beispiel #3
0
int main()
{
	char s[] = "bakaka";
	std::cout << strlen1(s) << '\n';
	strcpy1("ktoksdfsdfsdf56", s);
	std::cout << s << '\n';
	std::cout << strcmp1(s, "sdf") << ' ' << strcmp1(s, "ktoksdfsdfsdf56") << '\n';
	std::cout << strcmp1("sdf", s) << ' ' << strcmp1("ktoksdfsdfsdf56", s) << '\n';
	strcpy1("sdf", s);
	std::cout << strcmp1("sdf", s) << ' ' << strcmp1("ktoksdfsdfsdf56", s) << '\n';
}
Beispiel #4
0
int getlex() { char c; char *p; 
g1: c=next(); if (c == 0) return 0; if (c <= ' ') goto g1;
  if (c=='=') {if(thechar=='=') {next(); return T_EQ; }}
  if (c=='!') {if(thechar=='=') {next(); return T_NE; }}
  if (c=='<') {if(thechar=='=') {next(); return T_LE; }}
  if (c=='>') {if(thechar=='=') {next(); return T_GE; }}
  if (c=='<') {if(thechar=='<') {next(); return T_LESSLESS;  }}
  if (c=='>') {if(thechar=='>') {next(); return T_GREATGREAT;}}
  if (c=='+') {if(thechar=='+') {next(); return T_PLUSPLUS;  }}
  if (c=='-') {if(thechar=='-') {next(); return T_MINUSMINUS;}}
  if (c=='+') {if(thechar=='=') {next(); return T_PLUSASS;   }}
  if (c=='-') {if(thechar=='=') {next(); return T_MINUSASS;  }}
  if (c=='&') {if(thechar=='=') {next(); return T_ANDASS;    }}
  if (c=='|') {if(thechar=='=') {next(); return T_ORASS;     }}    
  if (c=='*') {if(thechar=='=') {next(); return T_MULASS;    }}
  if (c=='/') {if(thechar=='=') {next(); return T_DIVASS;    }}        
  if (instr1("()[]{},;*:%-><=+!&|#", c)) return c ;
  if (c == '/') { if (thechar == '*') { 
      g2: c=next(); if (c != '*') goto g2; if (thechar != '/') goto g2;
      c=next(); return getlex(); } else  return '/'; }
  if (c == '"') {getstring(c); return T_STRING;}
  if (digit(c)) { getdigit(c); return T_CONST; }
  if (c==39) { lexval=next();
    if (lexval==92) {lexval=next();
      if (lexval=='n') lexval=10; if (lexval=='t') lexval= 9;
      if (lexval=='0') lexval= 0; } next(); return T_CONST; }
  if (letter(c)) { 
    strcpy1(symboltemp, symbol); p=&symbol;  *p=c;  p++;
    while(letter(thechar)) {c=next(); *p=c;  p++; } 
      *p=0;
    if (eqstr(symbol,"signed"  )) return T_SIGNED;
    if (eqstr(symbol,"unsigned")) return T_UNSIGNED;
    if (eqstr(symbol,"void"    )) return T_VOID;
    if (eqstr(symbol,"int"     )) return T_INT;
    if (eqstr(symbol,"char"    )) return T_CHAR;
    if (eqstr(symbol,"asm"     )) return T_ASM;
    if (eqstr(symbol,"__asm"   )) return T_ASMBLOCK;
    if (eqstr(symbol,"__emit__")) return T_EMIT;
    if (eqstr(symbol,"return"  )) return T_RETURN;
    if (eqstr(symbol,"if"      )) return T_IF;
    if (eqstr(symbol,"else"    )) return T_ELSE;
    if (eqstr(symbol,"while"   )) return T_WHILE;
    if (eqstr(symbol,"do"      )) return T_DO;
    if (eqstr(symbol,"goto"    )) return T_GOTO;
    if (eqstr(symbol,"define"  )) return T_DEFINE;   
    if (eqstr(symbol,"include" )) return T_INCLUDE;   
    if (convertdefine() ) {strcpy1(symbol, symboltemp); return T_CONST;}
    return T_NAME; } error1("Zeichen nicht erkannt"); }
Beispiel #5
0
main() {
    char x[] = "1234567";
    char y[] = "abcdefg";
    printf("x: %s y: %s\n", x, y);
    strcpy1(x, y);
    printf("x: %s y: %s\n", x, y);
}
Beispiel #6
0
/*PLA V.88*/ 
#include ".\INCLUDE\CONST1.C"
#include ".\INCLUDE\VAR1.C"
#include ".\INCLUDE\DOS1.C"
int BCC=1; /*is Borland C, dann kein BSS */
unsigned char testa[]={148,153,129,154,0}; /*"öÖüÜ";*/
int test3( int i, unsigned int u){ 
_AX=0xB800;
}
char Nametemp[16];
int doglob() { int symlen; int j; int isstringarray; isstringarray=0;
  if (GTop >= GMAX) error1("Globale Tabelle voll");
  symlen = strlen1(symbol);
  if (symlen > 15 ) error1("Variable ist laenger als 15 Zeichen");
  if (istoken('[')) { istype='&';
    if (istoken(T_CONST)) {
      if (BCC == FALSE) {prs("\nAData = $\norg "); prnum(orgData);}
      prs("\n"); prs(symbol); 
      if (iswidth=='B') prs(" db "); else prs(" dw "); 
      prnum(lexval); prs(" dup (?)"); 
      if (BCC == FALSE) prs("\norg AData");
      orgData=orgData+lexval; if (iswidth=='W') orgData=orgData+lexval;
      GData[GTop]=lexval; expect(']'); 
    }else { expect(']');
      if (iswidth=='W') error1("Nur ByteArray erlaubt");
      prs("\n"); prs(symbol); prs(" db "); 
      isstringarray=1; strcpy1(Nametemp, symbol);
      expect('='); 
      if (istoken(T_STRING)) { 
        prc(34); prscomment(symbol); prc(34); prs(",0"); 
        symlen=strlen1(symbol); GData[GTop]=symlen; }
      else if (istoken('{' )) { narg=0;
        do { if(narg) prc(','); 
          expect(T_CONST); prnum(lexval); narg++; } 
        while (istoken(',')); expect('}'); }  
      else error1("String oder Zahlenarray erwartet");    
      }; 
  }else { expect('=');
    prs("\n"); prs(symbol); if (istype=='*') prs(" dw ");
    else { if(iswidth=='B') prs(" db "); else   prs(" dw "); }
    if(istoken('-')) prc('-');
    expect(T_CONST); prnum(lexval); }
  GSign [GTop]=issign; GWidth[GTop]=iswidth; GType [GTop]=istype;
  j=GTop*16; pt=&GNameField + j;  
  if (isstringarray) strcpy1(pt, Nametemp); else strcpy1(pt, symbol);
  GTop++; expect(';'); }
int addlocal() { int j;
  if(LTop >= LMAX) error1("Lokale Tabelle voll");
  GSign [LTop]=issign; GWidth[LTop]=iswidth; GType [LTop]=istype;
  j=LTop*16; pt=&GNameField + j;  
  strcpy1(pt, symbol);  LTop++; }
int gettypes(int i) {int j; char c;
  c=GSign [i]; if (c=='S') signi =1;    else signi =0;
  c=GWidth[i]; if (c=='W') widthi=wi=1; else widthi=wi=0;
  c=GType [i]; typei=0; if (c=='*') typei=wi=1; 
  if (c=='&')  typei=2;  
  return i; }  
int adrofname(int i) {int j; int k; j=i*16; k=&GNameField + j; return k; }  
int printName(int i) { i=adrofname(i); prs(i); }
int searchname() { int i; int j;
  i=LStart;while(i<LTop) {j=adrofname(i);if(eqstr(symbol,j))return i; i++;}
  i=0;     while(i<GTop) {j=adrofname(i);if(eqstr(symbol,j))return i; i++;}
  error1("Variable unbekannt"); }
    
int typeName() { int m; /*0=V,1=*,2=&*/
  issign='S';
  if(istoken(T_SIGNED))   issign='S';    if(istoken(T_UNSIGNED)) issign='U';
  if(istoken(T_VOID))     error1("Void ist unbekannt");
  iswidth='W';
  if(istoken(T_CHAR))     iswidth='B';   if(istoken(T_INT))      iswidth='W';
  istype='V'; m=0;
  if(istoken('*'))  { istype='*'; m=1; } if(istoken('&'))  { istype='&'; m=2; }   
  name1(); return m; }
int name1() {if (token!=T_NAME) error1("Name erwartet"); token=getlex(); }

int dofunc() { cloc=&co; strcpy1(fname, symbol);
  prs("\n\n"); prs(symbol); prs(" PROC");
  expect('('); narg=0; LTop=LStart;
  if (istoken(')')==0) { prs("\narg ");
    do { typeName();  addlocal();    
      if (narg) prc(','); prs(symbol); 
      if (istype!='*') {if (iswidth=='B') prs(":byte ");} narg++; }
    while (istoken(','));  expect(')'); }
  expect('{'); /*body*/
  nlocal=0; nreturn=0; nconst=0;
  if (isvariable()) prs("\nlocal ");
  while(isvariable()) {
    do { typeName();    addlocal();
      if (nlocal) prc(',');   prs(symbol); 
      if (istype!='*') {if (iswidth=='B') prs(":byte ");} nlocal++;
      if (istoken('[')){istype='&';GType[LTop]='&';expect(T_CONST);expect(']');
        prs(":BYTE:"); prnum(lexval);  }
      } while (istoken(',')); expect(';'); }
  while(istoken('}')==0)   stmt();
  if (nreturn) prs("\n@@retn:"); prs("\n ret\nENDP"); listproc(); }

int pexpr() {expect('('); iscmp=0; 
  if (token==T_NAME) {if (eqstr(symbol, "_")) {constantexpr(); return;}}   
  expr(); if (iscmp==0) prs("\n or  al, al\n je @@"); 
  expect(')'); }

int constantexpr() { int mode; int id1;int ids;
  token=getlex();   mode=typeName();  
  id1=searchname(); gettypes(id1); ids=signi;
  if (isrelational() ==0) error1("Vergleich erwartet");
  expect(T_CONST);
  prs("; constant expression");
  prs("\ncmp "); printName(id1); prs(", "); prnum(lexval); cmpneg(ids); 
   expect(')');
}  
int expr() { int mode; int id1; int ixarr; int ids;
  if (istoken(T_CONST)) {doconst(); return 1; }
  mode=typeName(); /*0=V,1=*,2=&*/
  if (token=='(')  {docall1(); goto e1; }
  if (isreg()) goto e1;
  id1=searchname(); gettypes(id1); ids=signi;
  ixarr=0;
  if (istoken('[')) { ixarr=searchname(); expect(T_NAME); expect(']');  
    gettypes(ixarr);
    if (widthi==0) error1("Arrayindex muss int sein"); } 
  if (istoken(T_PLUSPLUS  )) {if(mode)error1("Nur var erlaubt");doinc();goto e1;}
  if (istoken(T_MINUSMINUS)) {if(mode)error1("Nur var erlaubt");dodec();goto e1;}
  if (istoken(T_PLUSASS   )) {compoundass("add", mode); goto e1;}
  if (istoken(T_MINUSASS  )) {compoundass("sub", mode); goto e1;}
  if (istoken(T_ANDASS    )) {compoundass("and", mode); goto e1;}
  if (istoken(T_ORASS     )) {compoundass("or" , mode); goto e1;}    
  if (istoken(T_MULASS    )) {error1("nicht implementiert");}
  if (istoken(T_DIVASS    )) {error1("nicht implementiert");}      
  if (istoken('=')) { isconst=expr(); 
     if (isconst) { if(mode==0) {prs("\n;++++ mov  "); printName(id1); 
       prs(", "); prnum(lexval);  } }
     doassign(mode, id1, ixarr); goto e1;} 
  dovar1(mode, "mov", ixarr, id1);
e1:    if (istoken('+')) rterm("add");
  else if (istoken('-')) rterm("sub" );
  else if (istoken('&')) rterm("and" );
  else if (istoken('|')) rterm("or" );  
  else if (istoken(T_LESSLESS)) rterm("shl");
  else if (istoken(T_GREATGREAT)) rterm("shr");  
  else if (istoken('*')) domul (ids);
  else if (istoken('/')) doidiv(ids);
  else if (istoken('%')) domod (ids);
  if (isrelational()) { rterm("cmp"); cmpneg(ids);}
  return 0;
}
int compoundass(char *op, int mode) {
  if(mode) error1("Nur scalar Var erlaubt");
  prnl(); prs(op); prs("  "); prs(symbol); prs(", ");
  expect(T_CONST); prnum(lexval);
}
int dovar1(int mode, int op, int ixarr, int id1) { 
  gettypes(id1);
  if (mode==1) {prs("\n mov bx, "); printName(id1); prnl(); prs(op);
    if(widthi) prs(" ax, [bx]"); 
    else prs(" al, [bx]\n mov ah, 0"); return; }
  if (mode==2){prnl();prs(op);prs(" ax, offset ");printName(id1); return; }
  if (ixarr) {
    prs("\n mov bx, "); printName(ixarr);
    if (wi) prs("\n shl bx, 1");
    prs("\n "); prs(op);
    if (wi) prs(" ax, "); else prs(" al, ");
    printName(id1); prs(" [bx]"); return; }
  prnl();prs(op);
  if(wi) prs(" ax, "); else prs(" al, "); printName(id1);
}
int rterm(char *op) {int mode; int opint; int ixarr; int id1;
  if (istoken(T_CONST)) { prnl(); prs(op); 
    if (wi) prs(" ax, "); else prs(" al, "); prnum(lexval); return;}
  mode=typeName(); id1=searchname(); ixarr=0;
  if (istoken('[')) { ixarr=searchname(); expect(T_NAME); expect(']');  
    gettypes(ixarr);
    if (widthi==0) error1("Arrayindex muss int sein"); } 
  if (eqstr(symbol,"_AX")) return;
  opint=op; dovar1(mode, opint, ixarr, id1);
}
int isreg() {
  if (eqstr(symbol,"_AH")) {doreg("ah"); goto r1;}
  if (eqstr(symbol,"_AL")) {doreg("al"); goto r1;}  
  if (eqstr(symbol,"_AX")) {doreg("ax"); goto r1;}
  if (eqstr(symbol,"_BH")) {doreg("bh"); goto r1;}
  if (eqstr(symbol,"_BL")) {doreg("bl"); goto r1;}
  if (eqstr(symbol,"_BX")) {doreg("bx"); goto r1;}    
  if (eqstr(symbol,"_CH")) {doreg("ch"); goto r1;}
  if (eqstr(symbol,"_CL")) {doreg("cl"); goto r1;}
  if (eqstr(symbol,"_CX")) {doreg("cx"); goto r1;}    
  if (eqstr(symbol,"_DH")) {doreg("dh"); goto r1;}
  if (eqstr(symbol,"_DL")) {doreg("dl"); goto r1;}
  if (eqstr(symbol,"_DX")) {doreg("dx"); goto r1;}  
  if (eqstr(symbol,"_FLAGS")) {doreg("flags"); goto r1;}  
  return 0;   r1: return 1; 
}
int doreg(char *dr) { expect('=');
  prs("\n mov  "); prs(dr); prs(", ");
       if (istoken(T_CONST)) prunsign(lexval);
  else if (istoken(T_NAME )) {
    if (eqstr(symbol,"_DX")) prs("dx");
    else if (eqstr(symbol,"_CX")) prs("cx");
    else prs(symbol); }
  else error1("Nur Zahl oder Var erlaubt"); }

int doinc() { prs("\n inc  "); prs(symbol); }
int dodec() { prs("\n dec  "); prs(symbol); }

int doassign(int mode, int i, int ixarr) {
  gettypes(i);
  if (mode==1) {prs("\n mov  bx, ");printName(i);
    if (widthi) prs("\n mov  [bx], ax"); else  prs("\n mov  [bx], al"); return;}
  if (mode==2) {prs("\n mov  offset ");printName(i); prs(", ax"); return;}
  if (ixarr) {
    prs("\n mov bx, "); printName(ixarr);
    if (wi) prs("\n shl bx, 1");
    prs("\n mov "); printName(i);
    if (wi) prs(" [bx], ax"); else prs(" [bx], al"); return; }  
  prs("\n mov  "); printName(i); 
  if (wi) prs(", ax"); else prs(", al");  
}
int domul(int ids) {
  if (ids) rterm("imul"); else {
  if (istoken(T_CONST)) {prs("\n mov bx, "); prnum(lexval); prs("\n mul bx"); }
  else error1("Bei MUL nur Zahl als Multiplikator erlaubt"); } }
int doidiv(int ids) {
  if (istoken(T_CONST)) {
    prs("\n mov bx, "); prnum(lexval); 
    if (ids) prs("\n cwd\n idiv bx"); else prs("\n mov dx, 0\n div bx"); }
  else error1("Nur Zahl als Divisor erlaubt"); }
int domod(int ids) { doidiv(ids); prs("\n mov ax, dx"); }
int doconst() { prs("\n mov ax, "); prnum(lexval); }

int part1=0;int part2=0;int part3=0;int part4=0;int part5=0;int part6=0;
int parn1=0;int parn2=0;int parn3=0;int parn4=0;int parn5=0;int parn6=0; 
char procname[20]; /*1=CONST,2=String,3=&,4=Name*/
int docall1() {int i; int nargs; int t0; int n0; 
  nargs=0; strcpy1(&procname, symbol);expect('(');
	if (istoken(')') ==0 ) {
	  do { nargs++;
	    if (nargs >6 ) error1("Max. 6 Parameter");  t0=0;
      if(istoken(T_CONST)) {t0=1; n0=lexval; }
      if(istoken(T_STRING)){t0=2; n0=nconst;
        eprs("\n"); eprs(fname); eprc(95);eprnum(nconst);eprs(" db ");
        eprc(34);eprs(symbol);eprc(34);eprs(",0"); nconst++; }
      if(istoken('&'))     {t0=3; name1(); n0=searchname();}
      if(istoken(T_NAME))  {t0=4; n0=searchname();
        p1=&GType; p1=p1+n0; if (*p1=='&') t0=3; }
      if (t0==0) error1("Parameter nicht erkannt (kein * erlaubt)");
      if (nargs==1) {part1=t0; parn1=n0; } if (nargs==2) {part2=t0; parn2=n0; }
      if (nargs==3) {part3=t0; parn3=n0; } if (nargs==4) {part4=t0; parn4=n0; }  
      if (nargs==5) {part5=t0; parn5=n0; } if (nargs==6) {part6=t0; parn6=n0; }
    } while (istoken(','));
  	expect(')');  i=nargs;
    do {
      if (i==1) {t0=part1; n0=parn1; }     if (i==2) {t0=part2; n0=parn2; }
      if (i==3) {t0=part3; n0=parn3; }     if (i==4) {t0=part4; n0=parn4; }      
      if (i==5) {t0=part5; n0=parn5; }     if (i==6) {t0=part6; n0=parn6; }      
      if(t0==1){ prs("\n push "); prnum(n0);}
      if(t0==2){ prs("\n push offset "); prs(fname);prc(95);prnum(n0);}
      if(t0==3){ prs("\n lea  ax, "); printName(n0); prs("\n push ax");}
      if(t0==4){ gettypes(n0); 
        if(wi) { prs("\n push "); printName(n0);}
        else { prs("\n mov al, byte ptr "); printName(n0); 
        prs("\n mov ah, 0\n push ax"); } }
   i--; } while (i > 0);  }
	 prs("\n call "); prs(&procname);
	 if (nargs>0) {prs("\n add  sp, "); nargs=nargs+nargs; prnum(nargs); } }
Beispiel #7
0
fivePointFive() {
	/* s is an array while p is a point, the case below show the difference. 
	 * The same thing for them is both them can visit value by adding steps.*/

	char s[] = "i love you"; /* s can not be refered to another address, but string content can be modified.*/
	// s = "iii"; //this will cause a compile error, for s is not a pointer.
	*(s + 1) = 'i'; // this is well, because for an array, the value can be modified.
	printf("%s %c\n", s, *s);

	char *p = "i love you"; /* p can be refered to another address, but string content can not be modified. */
	p = "you love me"; // this is well, because p is a point, not a name of array.
	// *(p + 1) = 'u'; // this will cause a runtime error, for p can not modify the value.
	printf("%s %c\n", p, *p);

	// char *p = "you love me"; p will be pointed to an anonymous string, so it can't modify the value.

	// s = p; s++; //this will cause a compile error, for s is not a pointer.

	p = s; /* p now refered to an array and can be used just like s to modify the string content.*/
	*(p + 1) = ' ';
	printf("%s\n", p);

	// char *ss = "123"; This will cause a runtime error, for ss should be an array which its value is allowed to be modified.
	char ss[10] = "123";
	char *tt = "456"; // Here, use pointer is ok, for we just visit the value, no modification.
	printf("%s compared with %s: %d\n", ss, tt, strcmp(ss, tt));
	strcpy(ss, tt);
	strcpy1(ss, tt);
	strcpy2(ss, tt);
	strcpy3(ss, tt);
	strcpy4(ss, tt);
	printf("copy tt to ss get %s\n", ss);
	printf("%s compared with %s: %d\n", ss, tt, strcmp2(ss, tt));
}
Beispiel #8
0
void writeheading(char *jobnamec,char *heading,ITG *nheading_){
    
    /* writes the headers in the frd-file */
    
    FILE *f1;

    char p1[6]="    1",fneig[132]="",c[2]="C",
         text[67]="                                                                  ";

    ITG i;
    
    strcpy(fneig,jobnamec);
    strcat(fneig,".frd");
    
    if((f1=fopen(fneig,"ab"))==NULL){
	printf("*ERROR in frd: cannot open frd file for writing...");
	exit(0);
    }

    /* first line */

    fprintf(f1,"%5s%1s\n",p1,c);

    /* header lines */

    for(i=0;i<*nheading_;i++){
	strcpy1(text,&heading[66*i],66);
	fprintf(f1,"%5sU%66s\n",p1,text);
    }

    fclose(f1);
    
    return;
}
Beispiel #9
0
/* Refactored out, code to reset the camera after a frame size change. */
void camera_reset (unsigned int width) {
	imgWidth = width;
	if (width == 160) {
		imgHeight = 128;
		strcpy1(imgHead, "##IMJ3");
		camera_stop();
		i2cwrite(0x30, ov9655_qqvga, sizeof(ov9655_qqvga)>>1);
	} else if (width == 320) {
Beispiel #10
0
int dodefine() { int symlen; int j;
  expect(T_NAME);
    if (token==T_CONST) { 
      if (GTop >= GMAX) error1("Globale Tabelle (define) voll");
      symlen = strlen1(symbol);
      if (symlen > 15 ) error1("Define-Name ist länger als 15 Zeichen");
      GSign [GTop]='U'; GWidth[GTop]='B'; GType [GTop]='#'; 
      j=GTop*16; pt=&GNameField + j; strcpy1(pt, symbol); 
      prs(";  Define Nr "); prnum(GTop); prs(": ");
      printName(GTop); prc(' '); 
      GData[GTop]=lexval; prc('=');prnum(lexval);  expect(T_CONST); GTop++;  } 
}
Beispiel #11
0
void decl_global()
{
    get_token();  
    global_vars[gvar_index].var_type = tok;
    global_vars[gvar_index].value = 0;  
    do { 
        get_token();
        strcpy1(global_vars[gvar_index].var_name, token);
        get_token();
        gvar_index++;
    } while(*token==',');
    if(*token!=';') sntx_err(SEMI_EXPECTED);
}
Beispiel #12
0
void decl_local()
{
    struct variable_type i;
    get_token();  
    i.var_type = tok;
    i.value = 0;  
    do {
        get_token(); 
        strcpy1(i.var_name, token);
        local_push(i);
        get_token();
    } while(*token==',');
    if(*token!=';') sntx_err(SEMI_EXPECTED);
}
Beispiel #13
0
void eval_exp0(int *value)
{ char temp[ID_LEN];
    int temp_tok;
    if(token_type==IDENTIFIER) {
        if(is_var(token)) { 
            strcpy1(temp, token);
            temp_tok = token_type;
            get_token();
            if(*token=='=') {
                get_token();
                eval_exp0(value);    
                assign_var(temp, *value);
                return;
            }
            else {  
                putback();  
                strcpy1(token, temp);
                token_type = temp_tok;
            }
        }
    }
    eval_exp1(value);
}
Beispiel #14
0
/* Camera initial setup */
void camera_setup () {
  imgWidth = 320;
  imgHeight = 256;
  strcpy1(imgHead, "##IMJ5");
  i2cwrite(0x30, ov9655_setup, sizeof(ov9655_setup)>>1);
  i2cwrite(0x30, ov9655_qvga, sizeof(ov9655_qvga)>>1);
  camera_init((unsigned char *)DMA_BUF1, (unsigned char *)DMA_BUF2, imgWidth, imgHeight);
  camera_start();

	/* Initialise camera-related globals */
	framecount = 0;
	overlay_flag = 1;
	quality = 3; // Default JPEG quality.
}
Beispiel #15
0
int main(void)
{
    char s[100];
    char *t = "Test strcpy;";

    strcpy1(s,t);
    printf("%s\n", t);

    strcpy2(s,t);
    printf("%s\n", t);

    strcpy3(s,t);
    printf("%s\n", t);

    strcpy4(s,t);
    printf("%s\n", t);

    strcpy1(s+strlen1(s),t);
    printf("%s\n", s);
    printf("%d\n", strcmp1(s,t));
    printf("%d\n", strcmp2(s,t));

    return 0;
}
Beispiel #16
0
int doglob() { int symlen; int j; int isstringarray; isstringarray=0;
  if (GTop >= GMAX) error1("Globale Tabelle voll");
  symlen = strlen1(symbol);
  if (symlen > 15 ) error1("Variable ist laenger als 15 Zeichen");
  if (istoken('[')) { istype='&';
    if (istoken(T_CONST)) {
      if (BCC == FALSE) {prs("\nAData = $\norg "); prnum(orgData);}
      prs("\n"); prs(symbol); 
      if (iswidth=='B') prs(" db "); else prs(" dw "); 
      prnum(lexval); prs(" dup (?)"); 
      if (BCC == FALSE) prs("\norg AData");
      orgData=orgData+lexval; if (iswidth=='W') orgData=orgData+lexval;
      GData[GTop]=lexval; expect(']'); 
    }else { expect(']');
      if (iswidth=='W') error1("Nur ByteArray erlaubt");
      prs("\n"); prs(symbol); prs(" db "); 
      isstringarray=1; strcpy1(Nametemp, symbol);
      expect('='); 
      if (istoken(T_STRING)) { 
        prc(34); prscomment(symbol); prc(34); prs(",0"); 
        symlen=strlen1(symbol); GData[GTop]=symlen; }
      else if (istoken('{' )) { narg=0;
        do { if(narg) prc(','); 
          expect(T_CONST); prnum(lexval); narg++; } 
        while (istoken(',')); expect('}'); }  
      else error1("String oder Zahlenarray erwartet");    
      }; 
  }else { expect('=');
    prs("\n"); prs(symbol); if (istype=='*') prs(" dw ");
    else { if(iswidth=='B') prs(" db "); else   prs(" dw "); }
    if(istoken('-')) prc('-');
    expect(T_CONST); prnum(lexval); }
  GSign [GTop]=issign; GWidth[GTop]=iswidth; GType [GTop]=istype;
  j=GTop*16; pt=&GNameField + j;  
  if (isstringarray) strcpy1(pt, Nametemp); else strcpy1(pt, symbol);
  GTop++; expect(';'); }
Beispiel #17
0
void prescan()
{
    char *p;
    char temp[32];
    int    brace = 0;    
    p = prog;
    func_index = 0;
    do { 
        while(brace) { 
            get_token();
            if(*token=='{') brace++;
            if(*token=='}') brace--;
        }
        get_token();
        if(tok==CHAR || tok==INT) { 
            putback();
            decl_global();
        }            
        else if(token_type==IDENTIFIER) { 
            strcpy1(temp, token);
            get_token();
            if(*token=='(') {   
                func_table[func_index].loc = prog;
                strcpy1(func_table[func_index].func_name, temp);
                func_index++;
                while(*prog!=')') prog++;
                prog++;
            }
            else
                putback();
        }
        else if(*token=='{')
            brace++;
    } while(tok!=FINISHED);
    prog = p;
}
Beispiel #18
0
int main(void) {

	char *x = "fiddasdhellowww";
	char *s = "hello";	
	char *w = "hello";
	char *t = (char *)calloc(1, sizeof(6));
	
	printf("%d \n", strlen1(s));		// length 6
	printf("%s \n", strcpy1(t, s));
	printf("%d \n", strcmp1(s, w));
	printf("%s \n", findsub(x, s));
	
	zap(t);
	return 0;
}
Beispiel #19
0
int c(char *pc)
{
    p_buf = pc;
    //uart0SendString(p_buf);
    prog = p_buf; 
    prescan(); 
    gvar_index = 0; 
    lvartos = 0;    
    functos = 0;    
    prog = find_func("main");  
    prog--; 
    strcpy1(token, "main");
    call(); 
    return 0;
}
Beispiel #20
0
int ch4_string()
{
	char *test=malloc(256);
	debugStr(utoa1(1132,test));
	char *test2="abcdefg";
	debugInt((int)strlen1(test2));
	debugStr(strcat1(test,test2));
	debugStr(strcpy1(test,test2));
	debugInt(strend1(test,"g"));
	debugInt(strcmp1("1","2"));
	debugStr(strncpy1(test,"affgdtwsysgfdgfddsfad",2));
	debugStr(strncat1(test,"ABCDEFG",4));
	debugInt(strncmp1("12","12223",4));
	system("PAUSE");
	return 0;
}
Beispiel #21
0
int main()
{
    char *a = NULL,*b;
    a = new char [10];
    //cout<<"Enter string:"<<endl; Commented to check null string case
    //cin>>a;
    int n;
    for(n=0;a[n];n++);
    b = new char [n+1]; /*n+1 for null char*/
    strcpy1(a,b);
    if(b==NULL)
        cout<<"nothing";
    cout<<a<<" "<<b<<endl;
    delete a;
    return 1;
}
Beispiel #22
0
int main()
{
    char *s = "Hello World!";
    char *p;
    char *p2;

    strcpy1(p, s);

    printf("%s\n", p);

    strcpy2(p, s);

    printf("%s\n", p);

    strcpy3(p, s);

    printf("%s\n", p);
}
Beispiel #23
0
int dofunc() { cloc=&co; strcpy1(fname, symbol);
  prs("\n\n"); prs(symbol); prs(" PROC");
  expect('('); narg=0; LTop=LStart;
  if (istoken(')')==0) { prs("\narg ");
    do { typeName();  addlocal();    
      if (narg) prc(','); prs(symbol); 
      if (istype!='*') {if (iswidth=='B') prs(":byte ");} narg++; }
    while (istoken(','));  expect(')'); }
  expect('{'); /*body*/
  nlocal=0; nreturn=0; nconst=0;
  if (isvariable()) prs("\nlocal ");
  while(isvariable()) {
    do { typeName();    addlocal();
      if (nlocal) prc(',');   prs(symbol); 
      if (istype!='*') {if (iswidth=='B') prs(":byte ");} nlocal++;
      if (istoken('[')){istype='&';GType[LTop]='&';expect(T_CONST);expect(']');
        prs(":BYTE:"); prnum(lexval);  }
      } while (istoken(',')); expect(';'); }
  while(istoken('}')==0)   stmt();
  if (nreturn) prs("\n@@retn:"); prs("\n ret\nENDP"); listproc(); }
Beispiel #24
0
void get_params()
{
    struct variable_type *p;
    int i;

    i = lvartos-1;
    do { 
        get_token();    
        p = &local_var_stack[i];
        if(*token!=')') {
            if(tok!=INT && tok!=CHAR) sntx_err(TYPE_EXPECTED);
            p->var_type = token_type;
            get_token();
            strcpy1(p->var_name, token);
            get_token();
            i--;
        }
        else
            break;
    } while(*token==',');
    if(*token!=')') sntx_err(PAREN_EXPECTED); 
}
Beispiel #25
0
int main()
{
    char *str = "abcdef";
    int length = 0;
    length = strlen1(str);
    printf("str length = %d\n",length);
    
    char *temp = "123";
    printf("temp = %s\n",temp);
    printf("*temp = %c\n",*temp);
    printf("sizeof(temp) = %d\n",(int)sizeof(temp));
    char clone[20];
    strcpy(clone, str);
    printf("clone = %s\n",clone);

    char *p = (char*)malloc(10*sizeof(char));
    strcpy1(p,str);

    printf("p str = %s\n",p);
    char *p1 =(char*)malloc(sizeof(char));
    strcpy(p1,str);

    printf("p1 str = %s\n",p1);
}
Beispiel #26
0
void frdset(char *filabl,char *set,int *iset,int *istartset,int *iendset,
	    int *ialset,int *inum,int *noutloc,int *nout,int *nset,
	    int *noutmin,int *noutplus,int *iselect,int *ngraph){

  int j,k;

  char noset[81];
     
  /* check for a set, if any */

  strcpy1(noset,&filabl[6],81);
  for((*iset)=0;(*iset)<(*nset);(*iset)++){
    if(strcmp2(&set[81**iset],noset,81)==0) break;
  }
  (*iset)++;
  if(*iset>*nset)*iset=0;
  //    printf("iset,noutplus %d %d\n",*iset,*noutplus);

  /* determining the number of nodes in the set */

  if(*iset==0){

    /* no set defined */

    //    printf("iselect,noutplus %d %d\n",*iselect,*noutplus);

    if(*iselect==1){
      *noutloc=*noutplus;
    }else if(*iselect==-1){
      *noutloc=*noutmin;
    }else{
      *noutloc=*nout;
    }

  }else{

    /* a set was defined */

    *noutloc=0;
    for(j=istartset[*iset-1]-1;j<iendset[*iset-1];j++){
      if(ialset[j]>0){
	if(*iselect==-1){
	  if(inum[ialset[j]-1]<0) (*noutloc)++;
	}else if(*iselect==1){
	  if(inum[ialset[j]-1]>0) (*noutloc)++;
	}else{
	  if(inum[ialset[j]-1]!=0) (*noutloc)++;
	}
      }else{
	k=ialset[j-2];
	do{
	  k=k-ialset[j];
	  if(k>=ialset[j-1]) break;
	  if(*iselect==-1){
	    if(inum[k-1]<0) (*noutloc)++;
	  }else if(*iselect==1){
	    if(inum[k-1]>0) (*noutloc)++;
	  }else{
	    if(inum[k-1]!=0) (*noutloc)++;
	  }
	}while(1);
      }
    }
    if(*ngraph>1) (*noutloc)*=(*ngraph);
  }
    

}
Beispiel #27
0
char *strcat1(char *s,const char *a)
{
     char *aux=s+strlen(s);
     strcpy1(aux,a);
     return s;        
 }
Beispiel #28
0
void readinput(char *jobnamec, char **inpcp, ITG *nline, ITG *nset,
   ITG *ipoinp, ITG **inpp, ITG **ipoinpcp, ITG *ithermal){

  /*   reads and stores the input deck in inpcp; determines the
       number of sets  */

  FILE *f1[10];

  char buff[1320]="", fninp[132]="", includefn[132]="", *inpc=NULL,
       textpart[2112]="",*set=NULL;

  ITG i,j,k,n,in=0,nlinemax=100000,irestartread,irestartstep,
      icntrl,nload,nforc,nboun,nk,ne,nmpc,nalset,nmat,ntmat,npmat,
      norien,nam,nprint,mi[3],ntrans,ncs,namtot,ncmat,memmpc,ne1d,
      ne2d,nflow,*meminset=NULL,*rmeminset=NULL, *inp=NULL,ntie,
      nener,nstate,nentries=15,ifreeinp,ikey,lincludefn,nslavs,
      nbody,ncharmax=1000000,*ipoinpc=NULL,ichangefriction=0,nkon,
      ifile,mcs,initialtemperature=0,nprop,mortar,ifacecount,
      nintpoint,infree[4],iheading=0,ichangesurfacebehavior=0; 

  /* initialization */

  /* nentries is the number of different keyword cards for which
     the input deck order is important, cf keystart.f */

  NNEW(inpc,char,ncharmax);
  NNEW(ipoinpc,ITG,nlinemax+1);
  NNEW(inp,ITG,3*nlinemax);
  *nline=0;
  for(i=0;i<2*nentries;i++){ipoinp[i]=0;}
  ifreeinp=1;
  ikey=0;

  /* opening the input file */

  strcpy(fninp,jobnamec);
  strcat(fninp,".inp");
  if((f1[in]=fopen(fninp,"r"))==NULL){
      printf("*ERROR in read: cannot open file %s\n",fninp);
      exit(0);
  }

  /* starting to read the input file */

  do{
      if(fgets(buff,1320,f1[in])==NULL){
	  fclose(f1[in]);
	  if(in!=0){
	      in--;
	      continue;
	  }
	  else{break;}
      }
	  
      /* check for heading lines: should not be changed */

      if(iheading==1){
	  if((buff[0]=='*')&&(buff[1]!='*')){
	      iheading=0;
	  }
      }

      /* storing the significant characters */
      /* get rid of blanks  */
	
      k=0;
      i=-1;
      if(iheading==0){
	  do{
	      i++;
	      if((buff[i]=='\0')||(buff[i]=='\n')||(buff[i]=='\r')||(k==1320)) break;
	      if((buff[i]==' ')||(buff[i]=='\t')) continue;
	      buff[k]=buff[i];
	      k++;
	  }while(1);
      }else{
	  do{
	      i++;
	      if((buff[i]=='\0')||(buff[i]=='\n')||(buff[i]=='\r')||(k==1320)) break;
	      buff[k]=buff[i];
	      k++;
	  }while(1);
      }
	
      /* check for blank lines and comments */

      if(k==0) continue;
      if(strcmp1(&buff[0],"**")==0) continue;

      /* changing to uppercase except filenames */

      if(iheading==0){
	  j=0;
	  ifile=0;
	  do{
	      if(j>=6){
		  if(strcmp1(&buff[j-6],"INPUT=")==0) ifile=1;
	      }
	      if(j>=7){
		  if(strcmp1(&buff[j-7],"OUTPUT=")==0) ifile=1;
	      }
	      if(j>=9){
		  if(strcmp1(&buff[j-9],"FILENAME=")==0) ifile=1;
	      }
	      if(ifile==1){
		  do{
		      if(strcmp1(&buff[j],",")!=0){
			  j++;
		      }else{
			  ifile=0;
			  break;
		      }
		  }while(j<k);
	      }else{
		  buff[j]=toupper(buff[j]);
	      }
	      j++;
	  }while(j<k);
      }

      /* check for a *HEADING card */

      if(strcmp1(&buff[0],"*HEADING")==0){
	  iheading=1;
      }
	  
      /* check for include statements */
	  
      if(strcmp1(&buff[0],"*INCLUDE")==0){
	  lincludefn=k;
	  FORTRAN(includefilename,(buff,includefn,&lincludefn));
          includefn[lincludefn]='\0';
	  in++;
	  if(in>9){
	      printf("*ERROR in read: include statements can \n not be cascaded over more than 9 levels\n");
	  }
	  if((f1[in]=fopen(includefn,"r"))==NULL){
	      printf("*ERROR in read: cannot open file %s\n",includefn);
	      exit(0);
	  }
          continue;
      }

      /* adding a line */
	  
      (*nline)++;
      if(*nline>nlinemax){
	  nlinemax=(ITG)(1.1*nlinemax);
	  RENEW(ipoinpc,ITG,nlinemax+1);
	  RENEW(inp,ITG,3*nlinemax);
      }

      /* checking the total number of characters */

      if(ipoinpc[*nline-1]+k>ncharmax){
	  ncharmax=(ITG)(1.1*ncharmax);
	  RENEW(inpc,char,ncharmax);
      }
	  
      /* copying into inpc */

      for(j=0;j<k;j++){
	  inpc[ipoinpc[*nline-1]+j]=buff[j];
      }
      ipoinpc[*nline]=ipoinpc[*nline-1]+k;

      /* counting sets */
      
      if(strcmp1(&buff[0],"*AMPLITUDE")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"AMPLITUDE",
                          nline,&ikey));
			  }
      else if(strcmp1(&buff[0],"*CHANGEFRICTION")==0){
	ichangefriction=1;
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"REST",
                          nline,&ikey));
			  }
      else if(strcmp1(&buff[0],"*CHANGESURFACEBEHAVIOR")==0){
	ichangesurfacebehavior=1;
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"REST",
                          nline,&ikey));
			  }
      else if(strcmp1(&buff[0],"*CONDUCTIVITY")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*CONTACTDAMPING")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"SURFACEINTERACTION",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*CONTACTPAIR")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"CONTACTPAIR",
                          nline,&ikey));
			  }
      else if(strcmp1(&buff[0],"*CREEP")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*CYCLICHARDENING")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*DEFORMATIONPLASTICITY")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*DENSITY")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*DEPVAR")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*ELASTIC")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*ELECTRICALCONDUCTIVITY")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if((strcmp1(&buff[0],"*ELEMENT")==0)&&
              (strcmp1(&buff[0],"*ELEMENTOUTPUT")!=0)){
        (*nset)++;
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"ELEMENT",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*ELSET")==0){
        (*nset)++;
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"ELSET",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*EXPANSION")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*FLUIDCONSTANTS")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if((strcmp1(&buff[0],"*FRICTION")==0)&&(ichangefriction==0)){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"SURFACEINTERACTION",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*GAPCONDUCTANCE")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"SURFACEINTERACTION",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*HYPERELASTIC")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*HYPERFOAM")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*INITIALCONDITIONS")==0){
	  FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"INITIALCONDITIONS",
			    nline,&ikey));
	  FORTRAN(splitline,(buff,textpart,&n));
	  for(i=0;i<n;i++){
	      if(strcmp1(&textpart[(long long)132*i],"TYPE=TEMPERATURE")==0){
		  initialtemperature=1;
	      }
          }
      }
      else if(strcmp1(&buff[0],"*MAGNETICPERMEABILITY")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*MATERIAL")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if((strcmp1(&buff[0],"*NODE")==0)&&
	      (strcmp1(&buff[0],"*NODEPRINT")!=0)&&
	      (strcmp1(&buff[0],"*NODEOUTPUT")!=0)&&
	      (strcmp1(&buff[0],"*NODEFILE")!=0)){
        (*nset)++;
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"NODE",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*NSET")==0){
        (*nset)++;
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"NSET",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*ORIENTATION")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"ORIENTATION",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*PLASTIC")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*RESTART")==0){
	  irestartread=0;
	  irestartstep=0;
	  strcpy1(&buff[k]," ",1);
	  FORTRAN(splitline,(buff,textpart,&n));
	  for(i=0;i<n;i++){
	      if(strcmp1(&textpart[(long long)132*i],"READ")==0){
		  irestartread=1;
	      }
	      if(strcmp1(&textpart[(long long)132*i],"STEP")==0){
		  irestartstep=atoi(&textpart[(long long)132*i+5]);
	      }
          }
          if(irestartread==1){
            icntrl=0;
            FORTRAN(restartshort,(nset,&nload,&nbody,&nforc,&nboun,&nk,
              &ne,&nmpc,&nalset,&nmat,&ntmat,&npmat,&norien,&nam,
              &nprint,mi,&ntrans,&ncs,&namtot,&ncmat,&memmpc,
              &ne1d,&ne2d,&nflow,set,meminset,rmeminset,jobnamec,
	      &irestartstep,&icntrl,ithermal,&nener,&nstate,&ntie,
	      &nslavs,&nkon,&mcs,&nprop,&mortar,&ifacecount,&nintpoint,
              infree));
            FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"RESTART,READ",
                              nline,&ikey));
	  }
          else{
            FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"REST",
                              nline,&ikey));
          }

      }
      else if(strcmp1(&buff[0],"*SPECIFICGASCONSTANT")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*SPECIFICHEAT")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*SUBMODEL")==0){
	(*nset)+=2;
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"REST",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*SURFACEINTERACTION")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"SURFACEINTERACTION",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*SURFACEBEHAVIOR")==0){
	  if(ichangesurfacebehavior==0){
	      FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"SURFACEINTERACTION",
                          nline,&ikey));
	  }else{
	      FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"REST",
				nline,&ikey));
	  }
      }
      else if(strcmp1(&buff[0],"*SURFACE")==0){
        (*nset)++;
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"SURFACE",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*TIE")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"TIE",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*TRANSFORM")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"TRANSFORM",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*USERMATERIAL")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"MATERIAL",
                          nline,&ikey));
      }
      else if(strcmp1(&buff[0],"*")==0){
        FORTRAN(keystart,(&ifreeinp,ipoinp,inp,"REST",
                          nline,&ikey));

        /* checking whether the calculation is mechanical,
           thermal or thermomechanical: needed to know
           which mpc's to apply to 2-D elements */

	if((strcmp1(&buff[0],"*STATIC")==0)||
	   (strcmp1(&buff[0],"*VISCO")==0)||
	   (strcmp1(&buff[0],"*DYNAMIC")==0)){
	    if(ithermal[1]==0){
		if(initialtemperature==1)ithermal[1]=1;
	    }else if(ithermal[1]==2){
		ithermal[1]=3;
	    }
	}else if(strcmp1(&buff[0],"*HEATTRANSFER")==0){
	    if(ithermal[1]<2) ithermal[1]=ithermal[1]+2;
	}else if(strcmp1(&buff[0],"*COUPLEDTEMPERATURE-DISPLACEMENT")==0){
	    ithermal[1]=3;
	}else if(strcmp1(&buff[0],"*UNCOUPLEDTEMPERATURE-DISPLACEMENT")==0){
	    ithermal[1]=3;
	}
      }
  }while(1);

  inp[3*ipoinp[2*ikey-1]-2]=*nline;
  RENEW(inpc,char,(long long)132**nline);
  RENEW(inp,ITG,3*ipoinp[2*ikey-1]);
  *inpcp=inpc;
  *ipoinpcp=ipoinpc;
  *inpp=inp;
  
  //  FORTRAN(writeinput,(inpc,ipoinp,inp,nline,&ipoinp[2*ikey-1],ipoinpc));

  return;

}
Beispiel #29
0
int addlocal() { int j;
  if(LTop >= LMAX) error1("Lokale Tabelle voll");
  GSign [LTop]=issign; GWidth[LTop]=iswidth; GType [LTop]=istype;
  j=LTop*16; pt=&GNameField + j;  
  strcpy1(pt, symbol);  LTop++; }