static uint8_t *compile1(struct dict *d, uint16_t dn, uint8_t *pc) { uint16_t **p=d->def; print_atom(dn); putchar('['); for(;*p;p++) { uint16_t *def=*p; print_atom(def[2]); putchar(' '); #ifdef DEBUG putchar('\n'); putchar(' '); putchar(' '); putchar(' '); #endif if(def[1]==makeatom(0,0x060f121408LL)) { // forth pc=compile_def(pc,def,d,dn); } else if(def[1]==makeatom(0,0x04090314LL)) { // dict uint16_t *def=*p; if(d!=(struct dict *)(def+4)) { pc=compile1((struct dict *)(def+4),def[2],pc); } } } putchar(']'); putchar(' '); return pc; }
/* print info about bond "k", return its owner atom */ bool print_bond (int iw, int k) { register int i,j; if (n[iw].suppress_printout) return(FALSE); if (n[iw].bond_mode == BOND_MODE_USER) { i = CylinderAtoms[2*k]; j = CylinderAtoms[2*k+1]; } else { for (i=0; i<np; i++) if (k < N->idx[i+1]) break; j = N->list[k]; } printf ("\n"); printf ("=============================================================\n"); printf ("Bond %d (0-%d) is between\n", k, C->n_cylinders-1); printf ("-------------------------------------------------------------"); print_atom(iw,i); printf ("-------------------------------------------------------------"); print_atom(iw,j); printf ("-------------------------------------------------------------\n"); printf ("direction = [%g %g %g], L = %g A.\n", C->CYLINDER[k].axis[0], C->CYLINDER[k].axis[1], C->CYLINDER[k].axis[2], C->CYLINDER[k].axis[3]); printf ("=============================================================\n"); return (FALSE); } /* end print_bond() */
void forthcall(uint16_t a, uint16_t d) { struct caddr *c=atom2caddr(d,a); if(!c->c) { printf("no code address for"); print_atom(a); printf(" @ "); print_atom(d); printf("\n"); abort(); } llcall(c->c); }
static void checkcaddrs() { struct caddr *p=caddrs,*e=caddrs+1024; for(;p<e;p++) { if(p->len==-1) { printf("unresolved address for"); print_atom(p->word); printf("@"); print_atom(p->dict); printf("\n"); abort(); } } }
void print_atom(struct value_t *v) { int i; if (!v) { printf("(nil)"); return; } switch(v->type_tag) { case 1: printf("(int) %ld", v->int_val); break; case 2: printf("(bool) %s", !v->bool_val ? "false" : "true"); break; case 3: printf("(string len %ld) %s", v->array_len, v->string_val); break; case 4: printf("(array len %ld) [", v->array_len); for (i = 0; i < v->array_len; i++) { struct value_t *el = (v->array_val)[i]; print_atom(el); printf(";"); } printf("]"); break; case 6: printf("(double) %f", v->dbl_val); break; case 8: printf("(char) %c", v->char_val); break; default: printf("Don't know how to print type %d", v->type_tag); } }
acseg_result_t * acseg_full_seg(acseg_index_t *acseg_index, acseg_str_t *text,int max_seek) { int j,current_pos,tmp_j; acseg_str_t atom,atom2,tmp_atom; acseg_result_t *seg_result; acseg_index_item_t *index_item, *s_index_item,* tmp_s_index_item; seg_result = acseg_result_init(); // int max_seek=5; int seeks=0; if (acseg_index->state != AC_INDEX_FIXED) { return seg_result; } current_pos=j = 0; index_item = acseg_index->root; while (j < text->len) { seeks=0; atom.data = &(text->data[j]); atom.len = get_mblen( ((u_char) atom.data[0]) ); tmp_atom = atom; tmp_s_index_item = s_index_item = find_child_index_item(index_item, &atom); while( tmp_s_index_item ==NULL && seeks<max_seek && current_pos <(text->len)){ atom2.data = &(text->data[current_pos+tmp_atom.len]); atom2.len = get_mblen( ((u_char) atom2.data[0]) ); print_atom(&atom2); tmp_s_index_item = find_child_index_item(index_item, &atom2); seeks++; if(tmp_s_index_item!=NULL){ current_pos = j = current_pos +tmp_atom.len; atom = atom2; s_index_item = tmp_s_index_item; break; } else{ current_pos = current_pos +tmp_atom.len; tmp_atom = atom2; } } while(s_index_item == NULL) { if (index_item == acseg_index->root) { s_index_item = index_item; break; } index_item = index_item->failure; s_index_item = find_child_index_item(index_item, &atom); } index_item = s_index_item; add_to_result(seg_result, index_item->output); add_to_result(seg_result, index_item->extra_outputs); current_pos = tmp_j = j = j + atom.len; } return seg_result; }
void _print_stack(){ struct atom ** i; for(i=usp-1; i >= stack; i--){ print_atom_type(*i); print_atom(*i); } }
static int VECTOR_print (uclptr_t vector_exemplair, char *buffer) { ucl_vector_t *vector = VECTOR_data(vector_exemplair); int total_length = 0; uint32_t i; char *ptr; /* посчитаем общую длину печати */ if (buffer != 0) { buffer[total_length] = '['; buffer[total_length+1] = ' '; } total_length += 2; for (i = 0; i < vector->length; i++) { uclptr_t index = vector->ptr[i]; ptr = (buffer == 0)? 0 : &buffer[total_length]; if (index == NIL) { total_length += (print_atom(index, ptr) + 1 ); if (buffer != 0) buffer[total_length - 1] = ' '; } else if (TAG(index) == TAG_ATOM) { ucltype_t *typeid = atom_type_of(index); total_length += (typeid->print(_CDR(index), ptr) + 1); /* включая пробел */ if (buffer != 0) buffer[total_length - 1] = ' '; } else if (TAG(index) == TAG_CONS)
/** * Prints externalizable datum. */ void simple_print(FILE *out, obj_t obj) { if (eq(obj, unspecific)) return; print_atom(out, obj); putc('\n', out); }
void _print(){ struct atom *a; a = u_pop_atom(); print_atom(a); free(a); }
static uint8_t *compile_forth(uint8_t *pc,uint16_t w, uint16_t dn, int tailcall) { struct caddr *c=atom2caddr(dn,w); *pc++=tailcall?0xe9:0xe8; int32_t *o=(int32_t*)pc; pc+=4; if(c->c) { *o=c->c-pc; } else { #ifdef DEBUG printf("\nbackref for %lu (%hu,%hu) ",c-caddrs,dn,w); print_atom(w); printf(" @ "); print_atom(dn); printf("to %p\n",o); #endif backref(c,o); } return pc; }
static void print_list(FILE *out, obj_t obj) { putc('(', out); print_atom(out, car(obj)); for (obj = cdr(obj); is_pair(obj); obj = cdr(obj)) { putc(' ', out); print_atom(out, car(obj)); } if (is_null(obj)) { putc(')', out); } else { fputs(" . ", out); print_atom(out, obj); putc(')', out); } }
extern struct value_t *print(int nargs, struct value_t **env, ...) { struct value_t *ret; va_list ap; va_start(ap, env); struct value_t *v = va_arg(ap, struct value_t *); print_atom(v); va_end(ap); ret = malloc(sizeof(struct value_t)); ret->int_val = 0; ret->type_tag = 1; return ret; }
void print_s(CELLP cp, int mode) // S式の表示 { if (cp->id != _CELL) { print_atom(cp, mode); } else { fputc('(', cur_fpo); for (;;) { print_s(cp->car, mode); cp = cp->cdr; if (cp->id != _CELL) { break; } fputc(' ', cur_fpo); } if (cp != (CELLP)nil) { fprintf(cur_fpo, " . "); print_atom(cp, mode); } fputc(')', cur_fpo); } }
void print_section(FILE *f,section *sec) { atom *p; taddr pc=sec->org; fprintf(f,"section %s (attr=<%s> align=%d):\n",sec->name,sec->attr,sec->align); for(p=sec->first; p; p=p->next) { pc=(pc+p->align-1)/p->align*p->align; fprintf(f,"%8llx: ",((unsigned long long)pc)&taddrmask); print_atom(f,p); fprintf(f,"\n"); pc+=atom_size(p,sec,pc); } }
void print_expr(struct expr * e, int depth) { const char *fmt; if (!e) { printf("(null)"); return; } if (e->t == LATOM) print_atom(e, depth); else if (e->t == LLIST) print_list(e, depth); else printf("(expression of unknown type)"); }
int makeatom(uint64_t pre,uint64_t nm) { struct atom *p=atoms; for(;p->name[1];p++) { if(p->name[0]==pre && p->name[1]==nm) { return p-atoms; } } p->name[0]=pre; p->name[1]=nm; #ifdef DEBUG printf("NEW ATOM: "); print_atom(p-atoms); printf("(%lu)",p-atoms); printf("[%lu][%lu]",p->name[0],p->name[1]); printf("\n"); #endif return p-atoms; }
bool find_atom (int iw) { static int last_atom = 0; int i; char question[MAX_FILENAME_SIZE],danswer[MAX_FILENAME_SIZE],*answer; xterm_get_focus(iw); clear_stdin_buffer(); sprintf (question, "\nFind atom [0-%d]", np-1); sprintf (danswer, "%d", last_atom); answer = readline_gets(question,danswer); sscanf (answer, "%d", &i); xterm_release_focus(iw); if ((i < 0) || (i >= np)) printf("find_atom: illegal index\n"); else { n[iw].anchor = i; print_atom(iw,i); last_atom = i; } return (FALSE); } /* end find_atom() */
static int print_quotation(FILE *out, obj_t obj) { obj_t sym = car(obj); if (!is_symbol(sym)) return 0; if (!is_pair(cdr(obj))) return 0; if (!is_null(cdr(cdr(obj)))) return 0; register_quotation_symbols(); if (fetch_symbol(sym) == S_QUOTE) { fputs("'", out); } else if (fetch_symbol(sym) == S_QUASIQUOTE) { fputs("`", out); } else if (fetch_symbol(sym) == S_UNQUOTE) { fputs(",", out); } else if (fetch_symbol(sym) == S_UNQUOTE_SPLICING) { fputs(",@", out); } else { return 0; } print_atom(out, car(cdr(obj))); return 1; }
int main(int argc,char *argv[]) { FILE *fpw,*fpd,*fout; fpw=fopen(argv[1],"r"); fpd=fopen(argv[2],"r"); char store[100],store2[100]; int cnt=0,cnt2=0,totres_f1,totres_f2,secAt=0; int start_patch=atoi(argv[3]),end_patch=atoi(argv[4]); pdb frag1[50000],frag2[50000]; cout<<"Start:"<<start_patch<<" End:"<<end_patch<<endl; //scanning information from the first fragment while(fgets(store,100,fpw)!=NULL) { sscanf(store,"%s %d %s %s %d %lf %lf %lf",frag1[cnt].atom,&frag1[cnt].atomNo,frag1[cnt].atomtype,// frag1[cnt].amino,&frag1[cnt].aminoNo,&frag1[cnt].x,&frag1[cnt].y,&frag1[cnt].z); if(frag1[cnt].aminoNo==end_patch-1) { secAt=frag1[cnt].atomNo; } cnt++; } //scanning information from the second fragment while(fgets(store2,100,fpd)!=NULL) { sscanf(store2,"%s %d %s %s %d %lf %lf %lf",frag2[cnt2].atom,&frag2[cnt2].atomNo,frag2[cnt2].atomtype,// frag2[cnt2].amino,&frag2[cnt2].aminoNo,&frag2[cnt2].x,&frag2[cnt2].y,&frag2[cnt2].z); cnt2++; } fclose(fpw); fclose(fpd); totres_f1=cnt; totres_f2=cnt2; cout<<"total number of atoms in two fragments "<<totres_f1<<" "<<totres_f2<<endl; //First part: Calculating values of l,m and n and reference atoms double l,m,n,a,b,c; pdb p1,p2,p1d,p2d,ref,refd,temp; int len=(end_patch-start_patch)+1,i,f1=0,f2=0,f3=0; for(i=0;i<cnt;i++)//Taking only Backbone atoms for calculations from first fragment { if(frag1[i].aminoNo==(start_patch +1) && f1==0)//Reference is first atom of second AA { ref=frag1[i]; f1++; } if(frag1[i].aminoNo==(start_patch +2) && f2==0) { p1=frag1[i]; f2++; } if(frag1[i].aminoNo==(start_patch +3) && f3==0) { p2=frag1[i]; f3++; } } print_atom(ref); print_atom(p1); print_atom(p2); f1=0;f2=0;f3=0; for(i=0;i<cnt2;i++)//Taking only backbone atoms for calculations from second fragment { if(frag2[i].aminoNo==2 && f1==0)//Reference is first atom of second AA { refd=frag2[i]; f1++; } if(frag2[i].aminoNo==3 && f2==0) { p1d=frag2[i]; f2++; } if(frag2[i].aminoNo==4 && f3==0) { p2d=frag2[i]; f3++; } } print_atom(refd); print_atom(p1d); print_atom(p2d); //Finding coordinates of p1,p2 wrt ref pdb r1,r2,r1d,r2d; r1=p1;r2=p2;r1d=p1d;r2d=p2d; r1.x=p1.x-ref.x; r1.y=p1.y-ref.y; r1.z=p1.z-ref.z; r2.x=p2.x-ref.x; r2.y=p2.y-ref.y; r2.z=p2.z-ref.z; r1d.x=p1d.x-refd.x; r1d.y=p1d.y-refd.y; r1d.z=p1d.z-refd.z; r2d.x=p2d.x-refd.x; r2d.y=p2d.y-refd.y; r2d.z=p2d.z-refd.z; double dx1,dx2,dy1,dy2,dz1,dz2; dx1=r1d.x-r1.x; dx2=r2d.x-r2.x; dy1=r1d.y-r1.y; dy2=r2d.y-r2.y; dz1=r1d.z-r1.z; dz2=r2d.z-r2.z; //Finding values of l,m and n if(dx1==0.0 && dx2==0.0 && dy1==0.0 && dy2==0.0 && dz1==0.0 && dz2==0.0) { l=0; m=0; n=1; } else { a=((dy1*dz2)-(dy2*dz1)); b=((dz1*dx2)-(dz2*dx1)); c=((dx1*dy2)-(dx2*dy2)); l=a/(pow(((a*a)+(b*b)+(c*c)),0.5)); m=b/(pow(((a*a)+(b*b)+(c*c)),0.5)); n=c/(pow(((a*a)+(b*b)+(c*c)),0.5)); } //Finding values of (root 1-x^2) for l,m and n double ls,ms,ns; ls=pow((1-l*l),0.5); ms=pow((1-m*m),0.5); ns=pow((1-n*n),0.5); print_atom(r1); print_atom(r2); print_atom(r1d); print_atom(r2d); //Part two: Finding the rotation angle between the two sets of coordinates double xf,xfd,yf,yfd,zf,zfd,xs,xsd,ys,ysd,zs,zsd,cosphi,sinphi; //First rotation about X axis xf=r1.x; xfd=r1d.x; yf=((n*r1.y)-(m*r1.z))/(pow((n*n)+(m*m),0.5)); yfd=((n*r1d.y)-(m*r1d.z))/(pow((n*n)+(m*m),0.5)); zf=((m*r1.y)+(n*r1.z))/(pow((n*n)+(m*m),0.5)); zfd=((m*r1d.y)+(n*r1d.z))/(pow((n*n)+(m*m),0.5)); //Second rotation about Y axis xs=(ls*xf)-(l*zf); ys=yf; zs=(l*xf)+(ls*zf); xsd=(ls*xfd)-(l*zfd); ysd=yfd; zsd=(l*xfd)+(ls*zfd); //Angle between two fragments when axis of rotation is z axis cosphi=((xs*xsd)+(ys*ysd))/((xsd*xsd)+(ysd*ysd)); sinphi=((xs*ysd)-(ys*xsd))/((xsd*xsd)+(ysd*ysd)); //Part three: Finding the coordinates of the atoms of the second fragment wrt reference atom for(i=0;i<cnt2;i++) { temp=frag2[i]; frag2[i].x=temp.x-refd.x; frag2[i].y=temp.y-refd.y; frag2[i].z=temp.z-refd.z; } //Part four: Rotation about reference atom for second fragment for(i=0;i<cnt2;i++) { double c1,c2,c3,ca,cb,x,y,z,xd,yd,zd,xdd,ydd,zdd; x=frag2[i].x; y=frag2[i].y; z=frag2[i].z; //Applying first rotation xd=x; yd=((n*y)-(m*z))/pow((m*m)+(n*n),0.5); zd=((m*y)+(n*z))/pow((m*m)+(n*n),0.5); //Applying second rotation xdd=(ls*xd)-(l*zd); ydd=yd; zdd=(l*xd)+(ls*zd); //Applying third rotation c1=(xdd*cosphi)+(ydd*sinphi); c2=(ydd*cosphi)-(xdd*sinphi); c3=zdd; //Moving frag2 elements to relative frag1 position frag2[i].x=((c1*pow((m*m)+(n*n),0.5))-c3)/((m*m)+(n*n)-l); ca=(c3-(l*frag2[i].x)); cb=(c2*pow((m*m)+(n*n),0.5)); frag2[i].y=((m*ca)+(n*cb))/((m*m)+(n*n)); frag2[i].z=((n*ca)-(m*cb))/((m*m)+(n*n)); } //Part five: Translation of atoms of second fragment to the first one for(i=0;i<cnt2;i++) { temp=frag2[i]; frag2[i].x=(temp.x)+(ref.x); frag2[i].y=(temp.y)+(ref.y); frag2[i].z=(temp.z)+(ref.z); print_atom(frag2[i]); } //Part Six: Merging frag2 with frag1 int op=0; for(i=0;i<cnt2;i++) { if((frag2[i].aminoNo<len)) { op++; } } //changing residue number of frag 2 for(i=op;i<cnt2;i++) { frag2[i].aminoNo=frag2[i].aminoNo+(start_patch-1); frag2[i].atomNo=secAt+1; frag1[secAt]=frag2[i]; secAt++; } // Calculating new value of Total Residues totres_f1=secAt; //writing output of patching fout=fopen(argv[5],"w"); for(int t=0;t<totres_f1;t++) //fragment 1 contains the updated patched coordinates { if(strlen(frag1[t].atom)==4) fprintf(fout,"ATOM %5d %-4s %3s %4d%12.3lf%8.3lf%8.3lf\n",frag1[t].atomNo,// frag1[t].atomtype,frag1[t].amino,frag1[t].aminoNo,frag1[t].x,frag1[t].y,frag1[t].z); else fprintf(fout,"ATOM %5d %-3s %3s %4d%12.3lf%8.3lf%8.3lf\n",frag1[t].atomNo,// frag1[t].atomtype,frag1[t].amino,frag1[t].aminoNo,frag1[t].x,frag1[t].y,frag1[t].z); } }
bool print_status (int iw) { int i; double x[3], V[3][3]; SimpleStatistics ss; /* xterm_get_focus(iw); */ for (i=0; i<CONFIG_num_auxiliary; i++) { CalculateSimpleStatistics (np, CHARP(CONFIG_auxiliary[i]), sizeof(double), IOVAL_DOUBLE, &ss); printf("\nauxiliary[%d]=%s [%s], threshold=[%g, %g]\n", i, CONFIG_auxiliary_name[i], CONFIG_auxiliary_unit[i], n[iw].auxiliary_threshold[i][0], n[iw].auxiliary_threshold[i][1]); printf("[%g(%d), %g(%d)], avg=%g, std.dev.=%g\n", ss.min, ss.idx_min, ss.max, ss.idx_max, ss.average, ss.standard_deviation); } printf("\n======================= Status of Viewport #%d " "=======================\n",iw); V3EQV (AX_3D[iw].x, x); V3pr ("Viewpoint is at %M A,\n", x); M3inv (H, V); V3mM3 (AX_3D[iw].x, V, x); V3pr("in reduced coordinates it is %M;\n", x); M3EQV(AX_3D[iw].V, V); S3PR("viewport axes = %M;\n", V); printf ("window width = %d, height = %d pixels,\n", AX_size[iw].width, AX_size[iw].height); printf ("and conversion factor is %g pixel/radian,\n", AX_3D[iw].k); printf ("which converts to %g x %g degrees of field of view.\n", RADIAN_TO_DEGREE(2*atan(AX_size[iw].width/2/AX_3D[iw].k)), RADIAN_TO_DEGREE(2*atan(AX_size[iw].height/2/AX_3D[iw].k))); printf ("The viewport is now anchored to %s", (n[iw].anchor>=0)? "atom" : "hook" ); if (n[iw].anchor >= 0) print_atom(iw,n[iw].anchor); else { M3inv (H, V); V3mM3 (n[iw].hook, V, x); printf("\nx = [%g %g %g] A, or s = [%g %g %g].\n", n[iw].hook[0], n[iw].hook[1], n[iw].hook[2], x[0], x[1], x[2]); } printf("parallel projection mode is turned %s.\n", n[iw].parallel_projection?"ON":"OFF"); printf("term printout suppression is turned %s.\n", n[iw].suppress_printout?"ON":"OFF"); V3pr ("background color = %M.\n", n[iw].bgcolor); printf ("atom r_ratio = %f, bond radius = %f A.\n", n[iw].atom_r_ratio, n[iw].bond_radius); printf("bond mode is turned %s.\n", n[iw].bond_mode?"ON":"OFF"); printf("system average IS%s subtracted off from atomistic strains.\n", shear_strain_subtract_mean ? "" : "N'T"); printf("wireframe mode is %s.\n", (n[iw].wireframe_mode==WIREFRAME_MODE_CONTRAST)?"CONTRAST": (n[iw].wireframe_mode==WIREFRAME_MODE_NONE)?"NONE": (n[iw].wireframe_mode==WIREFRAME_MODE_RGBO)?"RGBO": (n[iw].wireframe_mode==WIREFRAME_MODE_RGBK)?"RGBK": (n[iw].wireframe_mode==WIREFRAME_MODE_RGB)?"RGB": "UNKNOWN"); if (n[iw].xtal_mode) { printf ("Xtal mode is turned ON:\n"); V3mM3 (n[iw].xtal_origin, HI, x); V3TRIM (x, x); V3pr ("xtal_origin = %M.\n", x); } else printf ("Xtal mode is turned OFF.\n"); printf ("color mode = %s.\n", (n[iw].color_mode==COLOR_MODE_NORMAL)? "NORMAL" : (n[iw].color_mode==COLOR_MODE_COORD)? "COORDINATION" : (n[iw].color_mode==COLOR_MODE_AUXILIARY)? "Auxiliary Properties" : (n[iw].color_mode==COLOR_MODE_SCRATCH)? "SCRATCH" : "UNKNOWN"); if (n[iw].shell_viewer_mode) printf("Shell viewer auto-invoke is turned ON.\n"); else printf("Shell viewer auto-invoke is turned OFF.\n"); printf("s[%d]=%d surface is now seen or selected.\n", n[iw].last_surface_id/2, n[iw].last_surface_id%2); if (rcut_patching) printf ("Neighbor distance cutoff between %s = %g.\n", rcut_patch_pairname, rcut_patch[rcut_patch_item].rcut); printf ("rate of change = %g.\n", n[iw].delta); if (n[iw].color_mode==COLOR_MODE_AUXILIARY) { i = n[iw].auxiliary_idx; if (i < CONFIG_num_auxiliary) printf("auxiliary[%d] = %s [%s], threshold = [%g, %g],\n", i, CONFIG_auxiliary_name[i], CONFIG_auxiliary_unit[i], n[iw].auxiliary_threshold[i][0], n[iw].auxiliary_threshold[i][1]); else printf("auxiliary = %s, threshold = [%g, %g],\n", geolist[i-CONFIG_MAX_AUXILIARY].token, n[iw].auxiliary_threshold[i][0], n[iw].auxiliary_threshold[i][1]); CalculateSimpleStatistics (np, CHARP(INW(n[iw].auxiliary_idx,CONFIG_num_auxiliary) ? CONFIG_auxiliary[i] : geo[i-CONFIG_MAX_AUXILIARY]), sizeof(double), IOVAL_DOUBLE, &ss); printf("[%g(%d),%g(%d)], avg=%g, std.dev.=%g,\n", ss.min, ss.idx_min, ss.max, ss.idx_max, ss.average, ss.standard_deviation); printf("auxiliaries' colormap = %s \"%s\".\n", AX_cmap_funs[n[iw].auxiliary_cmap].name, AX_cmap_funs[n[iw].auxiliary_cmap].description); printf("invisible outside auxiliary thresholds flag = %s.\n", n[iw].auxiliary_thresholds_saturation?"OFF":"ON"); printf("floating auxiliary thresholds flag = %s.\n", n[iw].auxiliary_thresholds_rigid?"OFF":"ON"); } printf ("clicked atoms = [ "); for (i=0; i<ATOM_STACK_SIZE; i++) printf ("%d ", n[iw].atom_stack[i]); printf ("];\n"); for (i=0; i<AX_3D_MAX_FILTER_PLANE; i++) if (AX_V3NEZERO(AX_3D[iw].fp[i].dx)) printf("%s fp %d: dx = [%g %g %g], s = [%g %g %g]\n", (n[iw].just_activated_fp==i) ? "*" : " ", i, V3E(AX_3D[iw].fp[i].dx), V3E(n[iw].fp[i].s0)); printf("==============================================" "=======================\n"); return(FALSE); } /* end print_status() */
void visit(const Id& n) { print_atom(os, n); }
void visit(const Bool& e) { print_atom(os, e); }
static uint8_t *compile_def(uint8_t *pc, uint16_t *def, struct dict *d, uint16_t dn) { struct caddr *c=atom2caddr(dn,def[2]); #ifdef DEBUG printf("(atom2caddr(%hu,%hu)=%lu)\n",dn,def[2],c-caddrs); #endif c->c=pc; backrefs(c); int32_t *lbacks[16], **lback=lbacks; uint16_t *p=def+4; int l=def[0]/sizeof(uint16_t); for(;l--;p++) { #ifdef DEBUG uint8_t *bc=pc; print_atom(*p); #endif if(l&&p[1]==makeatom(0,0x3c)) { pc=compile_number(pc,*p); l--; p++; continue; } if(number(*p)) { uint64_t n=make_num(*p); #ifdef DEBUG printf("NUMBER(%lx)",n); #endif if(l&&p[1]==makeatom(0,0x37)) { // # pc=compile_kick(pc,n); p++; l--; } else { pc=compile_number(pc,n); } } else { uint16_t ww,wdn,*sdef; if(l>1&&p[1]==makeatom(0,0x36)) { // @ int idx; ww=*p; wdn=p[2]; idx=atom2idx(p[2],dict); if(0x10000&idx) { printf("\nunknown dict "); print_atom(p[2]); printf(" for "); print_atom(*p); printf("\n"); abort(); } struct dict *d1=(struct dict *)(dict->def[idx]+4); idx=atom2idx(*p,d1); if(idx&0x10000) { printf("unknown word "); print_atom(*p); printf(" @ "); print_atom(p[2]); printf("\n"); abort(); } sdef=d1->def[idx]; p+=2; l-=2; } else if(*p==makeatom(0,0x33)) { // { *lback++=(int32_t*)pc; pc+=4; continue; } else if(*p==makeatom(0,0x34)) { // } lback--; **lback=pc-(((uint8_t*)(*lback))+4); continue; } else { int idx=atom2idx(*p,d); ww=*p; wdn=dn; if(0x10000&idx) { idx=atom2idx(*p,dict); wdn=makeatom(0,0x030f1205); if(0x10000&idx) { printf("unknown word"); print_atom(*p); printf("\n"); abort(); } sdef=dict->def[idx]; } else { sdef=d->def[idx]; } } if(sdef[1]==makeatom(0,0x060f121408LL)) { // forth pc=compile_forth(pc,ww,wdn,(!l)||(p[1]==makeatom(0,0x2b))); } else if(sdef[1]==makeatom(0,0x090e0c090e05LL)) { // inline pc=compile_inline(pc,sdef); } else if(sdef[1]==makeatom(0,0x04011401)) { // data pc=compile_data(pc,sdef); } else if(sdef[1]==makeatom(0,0x04090314)) { // dict pc=compile_data(pc,sdef); } else { printf("unknown type "); print_atom(sdef[1]); printf("\n"); abort(); } } #ifdef DEBUG putchar('['); hexdump(bc,pc-bc); putchar(']'); #endif } *pc++=0xc3; c->len=pc-c->c; #ifdef DEBUG printf("%p -> %p",c->c,pc); hexdump(c->c,c->len); #endif return pc; }
static void print_ter_db(char *ff,char C,int nb,t_hackblock tb[], gpp_atomtype_t atype) { FILE *out; int i,j,k,bt,nrepl,nadd,ndel; char buf[STRLEN],nname[STRLEN]; sprintf(buf,"%s-%c_new.tdb",ff,C); out = gmx_fio_fopen(buf,"w"); for(i=0; (i<nb); i++) { fprintf(out,"[ %s ]\n",tb[i].name); /* first count: */ nrepl=0; nadd=0; ndel=0; for(j=0; j<tb[i].nhack; j++) if ( tb[i].hack[j].oname!=NULL && tb[i].hack[j].nname!=NULL ) nrepl++; else if ( tb[i].hack[j].oname==NULL && tb[i].hack[j].nname!=NULL ) nadd++; else if ( tb[i].hack[j].oname!=NULL && tb[i].hack[j].nname==NULL ) ndel++; else if ( tb[i].hack[j].oname==NULL && tb[i].hack[j].nname==NULL ) gmx_fatal(FARGS,"invalid hack (%s) in termini database",tb[i].name); if (nrepl) { fprintf(out,"[ %s ]\n",kw_names[ekwRepl-ebtsNR-1]); for(j=0; j<tb[i].nhack; j++) if ( tb[i].hack[j].oname!=NULL && tb[i].hack[j].nname!=NULL ) { fprintf(out,"%s\t",tb[i].hack[j].oname); print_atom(out,tb[i].hack[j].atom,atype,tb[i].hack[j].nname); } } if (nadd) { fprintf(out,"[ %s ]\n",kw_names[ekwAdd-ebtsNR-1]); for(j=0; j<tb[i].nhack; j++) if ( tb[i].hack[j].oname==NULL && tb[i].hack[j].nname!=NULL ) { print_ab(out,&(tb[i].hack[j]),tb[i].hack[j].nname); print_atom(out,tb[i].hack[j].atom,atype,tb[i].hack[j].nname); } } if (ndel) { fprintf(out,"[ %s ]\n",kw_names[ekwDel-ebtsNR-1]); for(j=0; j<tb[i].nhack; j++) if ( tb[i].hack[j].oname!=NULL && tb[i].hack[j].nname==NULL ) fprintf(out,"%s\n",tb[i].hack[j].oname); } for(bt=0; bt<ebtsNR; bt++) if (tb[i].rb[bt].nb) { fprintf(out,"[ %s ]\n", btsNames[bt]); for(j=0; j<tb[i].rb[bt].nb; j++) { for(k=0; k<btsNiatoms[bt]; k++) fprintf(out,"%s%s",k?"\t":"",tb[i].rb[bt].b[j].a[k]); if ( tb[i].rb[bt].b[j].s ) fprintf(out,"\t%s",tb[i].rb[bt].b[j].s); fprintf(out,"\n"); } } fprintf(out,"\n"); } gmx_fio_fclose(out); }
void visit(const Int& e) { print_atom(os, e); }