/* ** interpret.c ** ** interprets and executes lines in the Xgc syntax. */ /* $XFree86: xc/programs/xgc/interpret.c,v 1.4 2002/01/07 20:38:30 dawes Exp $ */ #include #include #include #include #include "xgc.h" #include "tile" /* interpret(string) ** ----------------- ** Takes string, which is a line written in the xgc syntax, figures ** out what it means, and passes the buck to the right procedure. ** That procedure gets called with feedback set to FALSE; interpret() ** is only called if the user is selecting things interactively. ** ** This procedure will go away when I can figure out how to make yacc ** and lex read from strings as well as files. */ void interpret(const char *string) { char word1[20], word2[80]; int i; sscanf(string,"%s",word1); if (!strcmp(word1,"run")) run_test(); else { sscanf(string,"%s %s",word1,word2); print_if_recording(string); /* So word1 is the first word on the line and word2 is the second. Now the fun begins... */ if (!strcmp(word1,TestStuff.choice.text)) { for (i=0;i XXX_XXX_ => [3,1,3,1] */ void GC_change_dashlist(int dashlist, Boolean feedback) { char dasharray[DASHLENGTH]; /* what we're gonna pass to XSetDashes */ int dashnumber = 0; /* which element of dasharray we're currently modifying */ int i; /* which bit of the dashlist we're on */ int state = 1; /* whether the list bit we checked was on (1) or off (0) */ /* Initialize the dasharray */ for (i = 0; i < DASHLENGTH; ++i) dasharray[i] = 0; if (dashlist == 0) return; /* having no dashes at all is bogus */ /* XSetDashes expects the dashlist to start with an on bit, so if it ** doesn't, we keep on rotating it until it does */ while (!(dashlist&1)) dashlist /= 2; /* Go through all the bits in dashlist, and update the dasharray ** accordingly */ for (i = 0; i < DASHLENGTH; ++i) { /* the following if statements checks to see if the bit we're looking ** at as the same on or offness as the one before it (state). If ** so, we increment the length of the current dash. */ if (((dashlist&1< 100) return; X.percent = (float) percent / 100.0; if (feedback) update_slider(percent); }