bool ScummDebugger::Cmd_PrintBox(int argc, const char **argv) { int num, i = 0; if (argc > 1) { for (i = 1; i < argc; i++) printBox(atoi(argv[i])); } else { num = _vm->getNumBoxes(); DebugPrintf("\nWalk boxes:\n"); for (i = 0; i < num; i++) printBox(i); } return true; }
void printData(htmldata_t * dp) { unsigned char flags = dp->flags; char c; fprintf(stderr, "s%d(%d) ", dp->space, (flags & SPACE_SET ? 1 : 0)); fprintf(stderr, "b%d(%d) ", dp->border, (flags & BORDER_SET ? 1 : 0)); fprintf(stderr, "p%d(%d) ", dp->pad, (flags & PAD_SET ? 1 : 0)); switch (flags & HALIGN_MASK) { case HALIGN_RIGHT: c = 'r'; break; case HALIGN_LEFT: c = 'l'; break; default: c = 'n'; break; } fprintf(stderr, "%c", c); switch (flags & VALIGN_MASK) { case VALIGN_TOP: c = 't'; break; case VALIGN_BOTTOM: c = 'b'; break; default: c = 'c'; break; } fprintf(stderr, "%c ", c); printBox(dp->box); }
void addInventory() { FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); srand(time(NULL)); int b = rand()%1000+1; inv1.itemID=0; inv1.price=0; system("cls"); printBorders(95,31); printBox(5,4,85,23); gtc(36,6); printf("\xB2 ADD INVENTORY ITEMS \xB2"); gtc(19,10);printf("\xb10"); gtc(21,10);printf("Item Name: ");fgets(inv1.pName,sizeof(inv1.pName),stdin);nlfix(inv1.pName); gtc(19,10);printf(" "); gtc(19,12);printf("\xb10"); gtc(21,12);printf("Item Price: ");scanf("%f",&inv1.price); gtc(19,12);printf(" "); inv1.itemID=b; //save fi1=fopen("mainInv.data","ab+"); fseek(fi1,0,SEEK_END); fwrite(&inv1,sizeof(inv1),1,fi1); fclose(fi1); gtc(29,16);printf("Successfully added item into inventory."); getch(); returN(); menuInventory(); }
static void printGeom (PrintingContext &c, dxGeom *g) { unsigned long category = dGeomGetCategoryBits (g); if (category != (unsigned long)(~0)) { c.printIndent(); fprintf (c.file,"category_bits = %lu\n",category); } unsigned long collide = dGeomGetCollideBits (g); if (collide != (unsigned long)(~0)) { c.printIndent(); fprintf (c.file,"collide_bits = %lu\n",collide); } if (!dGeomIsEnabled (g)) { c.print ("disabled",1); } switch (g->type) { case dSphereClass: printSphere (c,g); break; case dBoxClass: printBox (c,g); break; case dCapsuleClass: printCapsule (c,g); break; case dCylinderClass: printCylinder (c,g); break; case dPlaneClass: printPlane (c,g); break; case dRayClass: printRay (c,g); break; case dConvexClass: printConvex (c,g); break; case dTriMeshClass: printTriMesh (c,g); break; case dHeightfieldClass: printHeightfieldClass (c,g); break; } }
void editInventory() { FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); fflush(stdin); system("cls"); printBorders(95,31); printBox(10,5,75,21); int fderp,found,id,loopZ=1; while(loopZ==1) { gtc(28,7); printf("Enter Item ID to be edited: "); scanf("%d",&id); fi1=fopen("mainInv.data","rb+"); while(fread(&inv1,sizeof(inv1),1,fi1)==1) { if(cID(id)==0) { found=1; gtc(14,10);printf("ITEM NAME: %s",inv1.pName); getchar(); gtc(53,10);printf("Enter New Name: ");fgets(inv1.pName,sizeof(inv1.pName),stdin); gtc(14,11);printf("ITEM PRICE: PHP %.2f",inv1.price); gtc(53,11);printf("Enter New Price: ");scanf("%f",&inv1.price); nlfix(inv1.pName); fseek(fi1,ftell(fi1)-sizeof(inv1),0); fwrite(&inv1,sizeof(inv1),1,fi1); fclose(fi1); break; } if(found==0){ gtc(37,15); printf(" NO ITEM FOUND."); if(getch()) break; } } fclose(fi1); fflush(stdin); loopZ=0; menuInventory(); } }
void *oompaChild(void *boxSize) { int size = ((candy_struct *)boxSize)->num; candy_struct* box = malloc(size * sizeof(candy_struct)); while (1){ //grab the stuff off the assembly line for (int i = 0; i < size; ++i) { pthread_mutex_lock(&mutex); if (!emptyBuffer()) { box[i] = removeCandy(); } else { --i; } // pthread_mutex_unlock(&mutex); // print the contents of the box if (i == size - 1) { // pthread_mutex_lock(&mu`tex); printBox(box, size); } pthread_mutex_unlock(&mutex); } } pthread_exit(NULL); }
void AGOSEngine_Waxworks::oww_printBox() { // 187: print box printBox(); }
void credits() { char hi[]="CARL'S S U P E R D U P E R MARKET POS SYSTEM"; char ma[]="MADE BY:"; char rv[]="\xB02 John Rovic Vargas "; char ca[]="Carl Allones"; char mc[]="Melle Christian Somera"; char ky[]="Kyler Kanapi"; char aa[]="Aaron Kent Alcala"; char it[]="IT11KA3"; system("cls"); system("color a"); printBorders(95,31); printBox(19,6,55,18); gtc(24,8); for(int a=0;a<=sizeof(hi)-1;a++) { printf("%c",hi[a]); Sleep(50); } Sleep(100); gtc(42,10); for(int b=0;b<=sizeof(ma)-1;b++) { printf("%c",ma[b]); Sleep(80); } Sleep(100); gtc(36,12); for(int c=0;c<=sizeof(rv)-1;c++) { printf("%c",rv[c]); Sleep(80); } Sleep(100); gtc(38,14); for(int d=0;d<=sizeof(aa)-1;d++) { printf("%c",aa[d]); Sleep(80); } Sleep(100); gtc(38,16); for(int e=0;e<=sizeof(mc)-1;e++) { printf("%c",mc[e]); Sleep(80); } Sleep(100); gtc(38,18); for(int f=0;f<=sizeof(ca)-1;f++) { printf("%c",ca[f]); Sleep(80); } Sleep(100); gtc(38,20); for(int g=0;g<=sizeof(ky)-1;g++) { printf("%c",ky[g]); Sleep(80); } gtc(38,22); for(int h=0;h<=sizeof(it)-1;h++) { printf("%c",it[h]); Sleep(80); } FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); gtc(30,26); printf("Press any key to return to menu."); getch(); returN(); menu(); }
/* ============================================================================ * Funktion: registrierung * Input: - * Output: - * * Beschreibung: Logik fuer komplette Registrierung eines Users * ============================================================================= */ void registrierung(void) { MYSQL_RES *result = NULL, *userresult = NULL; char cVorname[25], cNachname[25], cNickname[20], cPasswort[28]; char cQuery[300], c; MYSQL *Connection = MySQLConnect (); int iSuccess=0, num_fields=0; /* Fenstergroesse anpassen */ resizeWindow(50, 27); system("cls"); /* Ausgabe fuer Registrierungsinfos */ printTo(18,2,"R E G I S T E R", 0); printTo(18,3,"= = = = = = = =", 0); printBox(7, "First name:"); printBox(12, "Last name:"); printBox(17, "Username:"******"Password:"******"%s", &cVorname); fflush(stdin); gotoxy(24, 13); scanf("%s", &cNachname); fflush(stdin); gotoxy(24, 18); scanf("%s", &cNickname); fflush(stdin); gotoxy(24, 23); GetPassword(cPasswort); sprintf( cQuery, "SELECT id FROM accounts WHERE username = '******';", cNickname ); /* SQL Anfrage schicken */ userresult = QueryBuilder (Connection, cQuery); if( userresult ) /* Wenn Query erfolgreich */ { num_fields = mysql_num_rows(userresult); if(num_fields == 0) /* und Ergebnismenge 0 Zeilen lang */ { iSuccess=1; } mysql_free_result(userresult); } if(iSuccess) { /* Query festlegen */ sprintf( cQuery, "INSERT INTO accounts VALUES (NULL, '%s', '%s', '%s', MD5('%s'), %i, %i)", cVorname, cNachname, cNickname, cPasswort, WINDOW_WIDTH, WINDOW_HEIGHT ); /* SQL Anfrage schicken */ result = QueryBuilder (Connection, cQuery); /* Speicher freigeben und Verbindung beenden */ mysql_free_result(result); /* Ausgabe bei Erfolg */ system("cls"); printf("\nThank you for your registration.\n"); printf("Your account has been created.\n\n\n\n\n\n\n"); printf("Please press a key to return."); } else { system("cls"); printTo(0,0,"Error! The username is already token.\nReturning to the main menue.", 12); } MySQLClose (Connection); getchar(); return; }
/** * ============================================================================ * Funktion: login * Input: - * Output: userAccount * * Beschreibung: Prüft nach ob Passwort und User Name in der Datenbank * vorhanden und Korrekt sind. * Bei Erfolg gibt die Funktion Infos zum Nutzer in einer * ACCOUNT struct zurück. * ============================================================================ **/ ACCOUNT login(void) { /* Variablen initialisieren */ int iStatus=0, j=0, i=0, k=0; char cNickname[20], cPassword[28]="", c=' '; ACCOUNT userAccount; resizeWindow(50, 20); do { /* Passwort maskieren */ for(i=0; i<(sizeof(cPassword)/sizeof(char)); i++) { cPassword[i]='\0'; } /* Loginmaske darstellen */ system("cls"); printTo(20, 2,"L O G I N", 0); printTo(20, 3,"= = = = =", 0); printBox(10, "User:"******"Pasword:"); /* Fehlerausgaben: */ if(iStatus==0 && j!=0) { /* Wurde der Nutzer im letzten Schleifendurchlauf nicht gefunden, einen entsprechenden Fehler ausgeben */ printTo(10, 7, "Error! The user does not exsist.", 12); } else if( iStatus == 1) { /* Wurde im letzten Schleifendurchlauf ein falsches Kennwort angegeben, einen entsprechenden Fehler ausgeben */ printTo(14, 7, "Error! Wrong password", 12); } /* Nickname einlesen */ fflush(stdin); gotoxy(22, 11); scanf("%s", &cNickname); /* Kennwort einlesen */ fflush(stdin); gotoxy(22, 16); GetPassword( cPassword ); /* Status abfragen (-> Logindaten gueltig?) */ iStatus = authentificationStatus(cNickname, cPassword); j++; } while(iStatus!=2 && j<5); /* Abbruch wenn 5. Loginversuch fehlgeschlagen oder Nutzer erfolgreich angemeldet. */ /* Accountdaten abfragen */ if(iStatus == 2) { userAccount = getUser(cNickname, cPassword); } else { userAccount.ID = 0; } return userAccount; }
void sales() { system("cls"); fclose(fsal); fclose(fsaldel); fclose(fi1); FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); printBorders(95,31); system("color 8f"); gtc(40,2); printf("S A L E S"); printBox(3,4,35,25); printsales(); printBox(42,11,50,8); printBox(42,22,50,7); printBox(42,4,50,4); gtc(47,6); printf("Add Items"); gtc(60,6); printf("Void Items"); gtc(73,6); printf("Checkout"); gtc(86,6); printf("Exit"); gtc(53,14);printf("Choose from the options above."); gtc(45,6); printf("\xb10"); int a,b=45; while(getch()!=13) //THIS PART OMG. { a=getch(); if (a==0 || a==0xE0) a=getch(); if (a==27) { break; } else if (a==75) { if(b!=45) { gtc(b,6); printf(" "); b-=13; gtc(b,6); printf("\xb10"); } } else if (a==77) { if(b!=84) { gtc(b,6); printf(" "); b+=13; gtc(b,6); printf("\xb10"); } } } switch(b) { case 45: gtc(53,14);printf(" "); additem(); break; case 58: gtc(53,14);printf(" "); voiditem(); break; case 71: gtc(53,14);printf(" "); checkout(); break; case 84: menu(); exit(0); break; } getch(); }
std::string print (const ExpressionPtr & expression) { BoxPtr box = convertExpression (expression); return printBox (box); }
std::string print (const PrimitiveValue& val) { BoxPtr box = convertPrimitiveValue (val); return printBox (box); }
void menu() { fclose(fsaldel); fclose(fsal); FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); windowSize(96,32); int b=10; unsigned char a; system("cls"); system("color 1f"); printBorders(95,31); printBox(26,7,40,15); gtc(34,10);printf(" 1. Do Sales"); gtc(34,12);printf(" 2. Manage Inventory"); gtc(34,14);printf(" 3. Delete all data"); gtc(34,16);printf(" 4. Credits"); gtc(34,18);printf(" 5. Exit Program"); gtc(32,10); printf("\xb10"); while(getch()!=13) //THIS PART OMG. { a=getch(); if (a==0 || a==0xE0) a=getch(); if (a==27) { break; } else if (a==72) { if(b!=10) { gtc(32,b); printf(" "); b-=2; gtc(32,b); printf("\xb10"); } else { gtc(32,b); printf(" "); b+=8; gtc(32,b); printf("\xb10"); } } else if (a==80) { if(b!=18) { gtc(32,b); printf(" "); b+=2; gtc(32,b); printf("\xb10"); } } } switch(b) { case 10: sales(); break; case 12: menuInventory(); break; case 14: removedata(); break; case 16: credits(); break; case 18: exitR(); break; } }
void wikiPlot() /* wikiPlot - Quick plots of maps vs. each other. */ { boolean gotDir = cgiVarExists("contigDir"); double step; contigDir = cgiUsualString("contigDir", contigDir); mapX = cgiUsualString("mapX", mapX); mapY = cgiUsualString("mapY", mapY); pix = cgiUsualInt("pix", pix); xOff = cgiUsualDouble("xOff", xOff); yOff = cgiUsualDouble("yOff", yOff); zoom = cgiUsualDouble("zoom", zoom); step = 0.1 * 1/zoom; if (cgiVarExists("boxOut")) { double invZoom = 1.0/zoom; double xCen = xOff + invZoom*0.5; double yCen = yOff + invZoom*0.5; zoom /= 2; invZoom = 1.0/zoom; xOff = xCen - invZoom*0.5; yOff = yCen - invZoom*0.5; } else if (cgiVarExists("boxUp")) yOff -= step; else if (cgiVarExists("boxDown")) yOff += step; else if (cgiVarExists("boxLeft")) xOff -= step; else if (cgiVarExists("boxRight")) xOff += step; else if (cgiVarExists("boxUpLeft")) { yOff -= step; xOff -= step; } else if (cgiVarExists("boxUpRight")) { yOff -= step; xOff += step; } else if (cgiVarExists("boxDownLeft")) { yOff += step; xOff -= step; } else if (cgiVarExists("boxDownRight")) { yOff += step; xOff += step; } else if (cgiVarExists("unzoom")) { xOff = yOff = -0.05; zoom = 0.9; } printf("<FORM ACTION=\"../cgi-bin/wikiPlot\" METHOD=\"GET\">\n"); printf("<TABLE BORDER=0 WIDTH=\"100%%\">\n"); printf("<TR>\n"); printf("<TD WIDTH=\"78%%\">\n"); printf("<B>Wiki Plotter</B><BR>\n"); printf("<B>Contig: </B>"); cgiMakeTextVar("contigDir", contigDir, 0); if (gotDir) { cgiMakeButton("refresh", "refresh"); } else cgiMakeButton("submit", "submit"); printf("<BR>\n"); printf("<B>Map X: </B>"); cgiMakeTextVar("mapX", mapX, 12); printf("<B>Map Y: </B>"); cgiMakeTextVar("mapY", mapY, 12); printf("<B>Pixels: </B>"); cgiMakeIntVar("pix", pix, 4); printf("</TD>\n"); printf("<TD WIDTH=\"22%%\">\n"); if (gotDir) printBox(); printf("</TD>\n"); printf("</TR>\n"); printf("</TABLE>\n"); if (gotDir) { char xFile[512], yFile[512]; struct hash *xHash = NULL, *yHash = NULL; struct clonePos *xList = NULL, *yList = NULL; sprintf(xFile, "%s/%s", contigDir, mapX); sprintf(yFile, "%s/%s", contigDir, mapY); loadMaps(xFile, yFile, &xList, &yList, &xHash, &yHash); makePlot(xList, yList, yHash); } /* Save hidden vars. */ { char buf[256]; sprintf(buf, "%f", zoom); cgiMakeHiddenVar("zoom", buf); sprintf(buf, "%f", xOff); cgiMakeHiddenVar("xOff", buf); sprintf(buf, "%f", yOff); cgiMakeHiddenVar("yOff", buf); } printf("</FORM>\n"); }
std::string printCalcResult (const ExpressionPtr & exp, const std::string & connector, const PrimitiveValue & value) { shared_ptr<InfixFunctionBox> infixBox (new InfixFunctionBox(connector)); infixBox->addArgument(convertExpression(exp)); infixBox->addArgument(convertPrimitiveValue(value)); return printBox (infixBox); }
std::string printFractionResult (const PrimitiveValue& value, const std::string& connector, const std::string & decimal) { shared_ptr<InfixFunctionBox> infixBox (new InfixFunctionBox(connector)); infixBox->addArgument(convertPrimitiveValue(value)); infixBox->addArgument(BoxPtr (new TextBox(decimal))); return printBox (infixBox); }