#include #include "tledit.h" #include "tledit.m" static void src_printnodes(TLNODE &node, int x, int &y, int &maxx) { const char *title = node.title.get(); int len = node.title.getlen(); if (node.type == TLNODE_CALL){ printf ("// %s call %s %s // %s\n" ,node.start.get() ,node.title.get(),node.rest.get() ,node.comment.get()); printf ("TLMPCALL(\"%s\",%d,%d,%d)\n",title,len,x,y); y-=2; }else if (node.type == TLNODE_F){ printf ("TLMPF(\"%s\",%d,%d,%d)\n",title,len,x,y); y--; }else if (node.type == TLNODE_OBJ){ printf ("// obj %s %s %s\n",node.title.get(),node.rest.get() ,node.comment.get()); printf ("TLMPOBJ(\"%s\",%d,%d,%d)\n",title,len,x,y); y-=2; }else if (node.type == TLNODE_GLOCAL){ }else if (node.type == TLNODE_MAIN){ printf ("// mod %s\n",node.title.get()); printf ("TLMPFUNCTION(\"%s\",%d,%d,%d)\n",title,len,x,y); y-=2; }else if (node.type != TLNODE_TEXT){ #if 0 printf ("[%d,%d] %d %s\n",x,y,node.type,node.title.get()); printf ("\tstart: %s\n",node.start.get()); printf ("\trest : %s\n",node.rest.get()); printf ("\tcomment: %s\n",node.comment.get()); printf ("\ttext : %s\n",node.text.get()); #endif } int lasty = y; int x1 = x+2; if (x1 > maxx) maxx = x1; for (int i=0; iy; j--){ // Connect the tubes together in case // there are spaces between functags printf ("TLMPTUBE(%d,%d,%d)\n",len,x0,j); } // Put some tubing to connect the functags lasty = y; if (i == 0){ if (i == node.sub.getnb()-1){ // Only one functag printf ("TLMPTUBE_ONE(%d,%d,%d)\n",len,x0,lasty); }else{ printf ("TLMPTUBE_MIDDLE(%d,%d,%d)\n",len,x0,lasty); } }else if (i == node.sub.getnb()-1){ // Last printf ("TLMPTUBE_LAST(%d,%d,%d)\n",len,x0,lasty); }else{ printf ("TLMPTUBE_MIDDLE(%d,%d,%d)\n",len,x0,lasty); } } TLNODE *sub = node.sub.getitem(i); src_printnodes (*sub,x1,y,maxx); } } /* Compute the height of the presentation */ static int src_getheight(TLNODE &node) { int ret = 0; if (node.type == TLNODE_CALL){ ret = 2; }else if (node.type == TLNODE_F){ ret = 1; }else if (node.type == TLNODE_OBJ){ ret = 2; }else if (node.type == TLNODE_GLOCAL){ }else if (node.type == TLNODE_MAIN){ ret = 2; }else if (node.type != TLNODE_TEXT){ } for (int i=0; i int main (int argc, char *argv[]) { int ret = (argc, argv,"tlmpwork"); fprintf (stderr,MSG_U(I_SNAPSHOTVERSION ,"src_screenshot version %d.%d\n"),TLMPWORK_VERSION ,TLMPWORK_RELEASE); fprintf (stderr,"\n"); fprintf (stderr,"src_snapshot file.tlcc\n"); return -1; int ret = -1; for (int i=0; i\n",maxx); printf ("\tup <0, %d, 0>\n",height); printf ("\tlocation <%d, %d, %d>\n",maxx/2,height/2,-height); printf ("\tlook_at <%d, %d, 0>\n",maxx/2,height/2); printf ("}\n"); printf ("//VIEWPARAMS -W%d -H700\n",maxx*700/height); } } return ret; return ret; }