/*============================================================================*/ int main (int argc, char **argv) { /* printf("argc=%d\n", argc); */ #ifdef PROOL if(argc==3) { exitif(strlen(argv[1])>195, "unical: sorry input file name too long.", NULL); strcpy(inname, argv[1]); exitif(strlen(argv[1])>195, "unical: sorry output file name too long.", NULL); strcpy(outname, argv[2]); printf("unical1, Copyright(C) 2011 Bernhardi \n"); printf("some modif. by prool, 2015. www.prool.kharkov.org\n"); printf("unical comes with ABSOLUTELY NO WARRANTY. This is free\n"); printf("software, and you are welcome to redistribute it under\n"); printf("certain conditions, see http://www.gnu.org/licenses/gpl.html\n\n"); } else { printf("unical: usage: unical inputfile outputfile\n"); exit(0); } #else if(argc==2) { exitif(strlen(argv[1])>195, "unical: sorry file name too long.", NULL); strcpy(problem, argv[1]); full=0; } else if(argc==3) { exitif(strncmp(argv[1],"-f",2)!=0, "unical: command not understood.", NULL); exitif(strlen(argv[2])>195, "unical: sorry file name too long.", NULL); strcpy(problem, argv[2]); full=1; } else { printf("unical: usage: unical [-f] unv_filename (without extension .unv)\n"); exit(0); } printf("unical1, Copyright(C) 2011 Bernhardi \n"); printf("unical comes with ABSOLUTELY NO WARRANTY. This is free\n"); printf("software, and you are welcome to redistribute it under\n"); printf("certain conditions, see http://www.gnu.org/licenses/gpl.html\n\n"); strcpy(inname, problem); strcat(inname, ".unv"); #endif #ifdef PROOL process_e(inname); // convert exponent letter D+00 to E+00 strcpy(inname,TMPNAME); #endif printf("unical: Reading from file %s\n",inname); fid = fopen(inname,"r"); exitif(fid==0,"Error reading from file ",inname); countuni(); /* determine number of elements, nodes, etc. */ printf("unical: maxnode=%d, sumele=%d\n", maxnode, sumele); allocate(); /* allocate large arrays. */ rewind(fid); readnodes(); /* read nodes: coordinates. */ rewind(fid); readelements(); /* read element connectivities. */ rewind(fid); readgroups(); /* read group information. */ /* close universal file */ printf("unical: closing universal file %s\n", inname); ret = fclose(fid); exitif(ret < 0,"while attempting to close file ",inname); #ifndef PROOL strcpy(outname, problem); strcat(outname, ".inp"); #endif printf("unical: writing to file %s\n",outname); fid = fopen(outname,"w"); exitif(fid==0,"Error opening file ",outname); writemesh(); /* write node point and element data to abaqus/calculix input file. */ surface(); /* process groups for boundary conditions. */ #ifndef PROOL /* write standard ABAQUS procedure calls: *frequency step. */ fprintf(fid,"*material, name=steel\n"); fprintf(fid,"*elastic\n"); fprintf(fid,"209000.0, 0.3\n"); fprintf(fid,"*density\n"); fprintf(fid,"7.85e-09\n"); fprintf(fid,"*step\n"); fprintf(fid,"*frequency\n"); fprintf(fid,"12\n"); fprintf(fid,"*nodefile\n"); fprintf(fid,"u\n"); fprintf(fid,"*elfile, output=3D\n"); fprintf(fid,"s, e\n"); fprintf(fid,"*endstep\n"); #endif /* close abaqus/calculix input file */ printf("unical: closing file %s\n", outname); ret = fclose(fid); exitif(ret < 0,"while attempting to close file ",outname); printf("unical: It was a pleasure serving you. Bye. \n"); printf("unical: returning to system. \n"); #ifdef PROOL if (remove(TMPNAME)) {printf("can't delete tmp file `%s'\n",TMPNAME); exit(1);} #endif exit(0); }
int processOperator(Drawing d, char *op) { int res = 0; // Look for which operator it is and then process it for (int i = 0; i < N_OPS_AVAILABLE; i++) { if (strlen(op) == strlen(OPS_AVAILABLE[i]) && strcmp(op, OPS_AVAILABLE[i]) == 0) { switch (i) { case 0: res = process_sum(d->stack); break; case 1: res = process_subtraction(d->stack); break; case 2: res = process_multiplication(d->stack); break; case 3: res = process_division(d->stack); break; case 4: res = process_pi(d->stack); break; case 5: res = process_sin(d->stack); break; case 6: res = process_cos(d->stack); break; case 7: res = process_deg(d->stack); break; case 8: res = process_cm(d->stack); break; case 9: res = process_mm(d->stack); break; case 10: res = process_pt(d->stack); break; case 11: res = process_copy(d->stack); break; case 12: res = process_translate(d->stack); break; case 13: res = process_mtranslate(d->stack); break; case 14: res = process_rotate(d->stack); break; case 15: res = process_mrotate(d->stack); break; case 16: res = process_line(d); break; case 17: res = process_circle(d); break; case 18: res = process_fillcircle(d); break; case 19: res = process_show(d->stack); break; case 20: res = process_tan(d->stack); break; case 21: res = process_arcsin(d->stack); break; case 22: res = process_arccos(d->stack); break; case 23: res = process_arctan(d->stack); break; case 24: res = process_eraseline(d); break; case 25: res = process_e(d->stack); break; case 26: res = process_lg(d->stack); break; case 27: res = process_ln(d->stack); break; case 28: res = process_log(d->stack); break; case 29: res = process_abs(d->stack); break; default: res = throw_error(op, PROCESSOR_ERROR_ILEGAL_OP); break; } break; } } return res; }