std::string SyntaxTree::print(const std::string &search_string) { bool found=false; std::string output; // Clear the list of "seen" parameters before printing the tree _params_printed.clear(); if (_root) output = _root->print(-1, search_string, found); if (found) return preamble() + output + postscript(); else return ""; }
/*********************************************** main *********************************************** * arguments: infile : contains florplan details * * -help (or -h) : print command usage help * * -verbose (or -v) : enables verbose logging mode * * -postscript (or -p) : enables PostScript plotting * * -stepping (or -s) : choose stepping mode, should be followed by one of the following: * * wave (or w) : shows wave expansion (default) * * destination (or d) : shows routing of each destination * * net (or n) : shows routing of each net * * routeall (or r) : shows final routing result * ******************************************************************************************************/ int main(int argc, char *argv[]) { /* arguments parsing */ int argi; /* arguments index */ int fileNameArgInd=-1; /* file name argument index */ char psm,sm,tbm; for(argi=1;argi<argc;argi++) { /* check all argument */ if (argv[argi][0]=='-') { /* switch argument */ switch (tolower(argv[argi][1])) { /* consider first letter */ /* help */ case 'h': printf("Lee-Moore Shortest Path Maze Router\n"); printf("Usage:\n"); printf("\tmaze [OPTIONS] INFILE\n"); printf("Options:\n"); printf("\t-help (also -h): print this message\n"); printf("\t-verbose (also -v): verbose logging\n"); printf("\t-postscript (also -p): generate PostScript every step\n"); printf("\t-traceback (also -t): traceback mode, followed by one of the following\n"); printf("\t\tminturn (also m): avoid turns, try to keep same direction (default)\n"); printf("\t\tdirect (also d): use direct paths toward source\n"); printf("\t-stepping (also -s): stepping mode, followed by one of the following\n"); printf("\t\twave (also w): wave expansion (default)\n"); printf("\t\tdestination (also d): route one destination at once\n"); printf("\t\tnet (also n): route one net at once\n"); printf("\t\trouteall (also n): route all nets at once\n"); printf("\tinfile syntax:\n"); printf("\t\t<FLOORPLAN COORDINATES>\n"); printf("\t\t<BLOCKAGES#>\n"); printf("\t\t<BLOCKAGE 1 COORDINATE>\n"); printf("\t\t<BLOCKAGE 2 COORDINATE>\n"); printf("\t\t...\n"); printf("\t\t<BLOCKAGE b COORDINATE>\n"); printf("\t\t<NETS#>\n"); printf("\t\t<NET 1 TARGETS#> <DEST. 1 COORD.> ... <DEST. t1 COORD.>\n"); printf("\t\t...\n"); printf("\t\t<NET 2 TARGETS#> <DEST. 1 COORD.> ... <DEST. t2 COORD.>\n"); printf("\t\t<NET n TARGETS#> <DEST. 1 COORD.> ... <DEST. tm COORD.>\n"); printf("Examples:\n"); printf("\tmaze a.infile (using default options)\n"); printf("\tmaze a.infile -verbose -postscript -stepping destination\n"); printf("\tmaze a.infile -v -p -s d (same as above)\n"); printf("Report bugs to <*****@*****.**>\n"); return(1); /* verbose */ case 'v': verbose=1; /* set verbose */ break; /* PostScript mode */ case 'p': psEnable=1; /* enable ps creation */ break; /* stepping mode */ case 's': argi++; /* next argument */ if (argi>=argc) sm = 'X'; /* if index is out of range, exit */ else sm = toupper(argv[argi][0]); if ((sm!='W')&&(sm!='D')&&(sm!='N')&&(sm!='R')) { /* consider first letter */ printf("-E- stepping modes are: wave, destination, net, routeall! Exiting...\n"); exit(-1); } else steppingMode=sm; break; /* traceback mode */ case 't': argi++; /* next argument */ if (argi>=argc) tbm = 'X'; /* if index is out of range, exit */ else tbm = toupper(argv[argi][0]); if ((tbm!='M')&&(tbm!='D')) { /* consider first letter */ printf("-E- traceback modes are: minturn, direct! Exiting...\n"); exit(-1); } else tracebackMode=tbm; break; /* unknown argument */ default : printf("-E- unknown argument %s\n",argv[argi]); exit(-1); } /* switch */ } else fileNameArgInd = argi; /* file name argument index */ } /* check if infile is supplied */ if (fileNameArgInd<0) {printf(" -E- infile should be supplied\n"); exit(-1);} /* parse input file into floorplan database */ gfp = fpInfileParse(argv[fileNameArgInd]); /* initialize display with WHITE 1000x1000 background */ init_graphics((char*)"Lee-Moore Shortest Path Maze Router", WHITE, NULL); init_world (0.,0.,1000.,1000.); /* Create new buttons */ create_button ((char*)"Window" , (char*)"---1" , NULL ); /* Separator */ create_button ((char*)"---1" , (char*)"Wave Mode" , waveModeFunc); /* Show wave expansion */ create_button ((char*)"Wave Mode" , (char*)"Dest. Mode", destModeFunc); /* route each destination */ create_button ((char*)"Dest. Mode", (char*)"Wire Mode" , wireModeFunc); /* route each wire */ create_button ((char*)"Wire Mode" , (char*)"Route All" , routeAllFunc); /* route all at once */ /* update global message and wait for 'Proceed' to proceed */ strcpy(glabel,"Initial floorplan. Choose stepping mode then press 'Proceed' to make one step."); waitLoop(); if (psEnable) postscript(drawScreen); /* route all pins in floorplan */ fpRouteAll(gfp); /* finished! wait still until 'Exit" is pressed */ while(1) waitLoop(); /* free database */ fpDelete(gfp); }