void Rubiks3LL::PrintMoves(void) { //Condense(); pRNode ptemp = phead; while (ptemp != ptail) { PrintKey(ptemp->data); ptemp = ptemp->next; } PrintKey(ptemp->data); }
int main(int argc, char *argv[]) { SDL_Event event; int done; /* Initialize SDL */ if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); exit(1); } atexit(SDL_Quit); /* Set 640x480 video mode */ if ( SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE) == NULL ) { fprintf(stderr, "Couldn't set 640x480 video mode: %s\n", SDL_GetError()); exit(2); } /* Enable UNICODE translation for keyboard input */ SDL_EnableUNICODE(1); /* Enable auto repeat for keyboard input */ SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); /* Watch keystrokes */ done = 0; while ( !done ) { /* Check for events */ SDL_WaitEvent(&event); switch (event.type) { case SDL_KEYDOWN: PrintKey(&event.key.keysym, 1); break; case SDL_KEYUP: PrintKey(&event.key.keysym, 0); break; case SDL_MOUSEBUTTONDOWN: /* Any button press quits the app... */ case SDL_QUIT: done = 1; break; default: break; } } return(0); }
void GTIFPrint(GTIF *gtif, GTIFPrintMethod print,void *aux) { int i; int numkeys = gtif->gt_num_keys; GeoKey *key = gtif->gt_keys; char message[1024]; if (!print) print = (GTIFPrintMethod) &DefaultPrint; if (!aux) aux=stdout; sprintf(message,FMT_GEOTIFF "\n"); print(message,aux); sprintf(message, "Version: %hd" ,gtif->gt_version); sprintf(message, FMT_VERSION,gtif->gt_version); print(" ",aux); print(message,aux); print("\n",aux); sprintf(message, FMT_REV,gtif->gt_rev_major, gtif->gt_rev_minor); print(" ",aux); print(message,aux); print("\n",aux); sprintf(message," %s\n",FMT_TAGS); print(message,aux); PrintGeoTags(gtif,print,aux); sprintf(message," %s\n",FMT_TAGEND); print(message,aux); sprintf(message," %s\n",FMT_KEYS); print(message,aux); for (i=0; i<numkeys; i++) PrintKey(++key,print,aux); sprintf(message," %s\n",FMT_KEYEND); print(message,aux); sprintf(message," %s\n",FMT_GEOEND); print(message,aux); }
void loop() { SDL_Event event; /* Check for events */ /*SDL_WaitEvent(&event); emscripten does not like waiting*/ while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_KEYDOWN: case SDL_KEYUP: PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE); break; case SDL_TEXTEDITING: PrintText("EDIT", event.text.text); break; case SDL_TEXTINPUT: PrintText("INPUT", event.text.text); break; case SDL_MOUSEBUTTONDOWN: /* Any button press quits the app... */ case SDL_QUIT: done = 1; break; default: break; } } #ifdef __EMSCRIPTEN__ if (done) { emscripten_cancel_main_loop(); } #endif }
int main(int argc, char *argv[]) { SDL_Window *window; SDL_Event event; int done; /* Initialize SDL */ if (SDL_Init(SDL_INIT_VIDEO) < 0) { fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); return (1); } /* Set 640x480 video mode */ window = SDL_CreateWindow("CheckKeys Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, 0); if (!window) { fprintf(stderr, "Couldn't create 640x480 window: %s\n", SDL_GetError()); quit(2); } #if __IPHONEOS__ /* Creating the context creates the view, which we need to show keyboard */ SDL_GL_CreateContext(window); #endif if (SDL_HasScreenKeyboardSupport(window)) { SDL_ShowScreenKeyboard(window); } /* Watch keystrokes */ done = 0; while (!done) { /* Check for events */ SDL_WaitEvent(&event); switch (event.type) { case SDL_KEYDOWN: case SDL_KEYUP: PrintKey(&event.key.keysym, event.key.state, event.key.repeat); break; case SDL_TEXTINPUT: PrintText(event.text.text); break; case SDL_MOUSEBUTTONDOWN: /* Any button press quits the app... */ case SDL_QUIT: done = 1; break; default: break; } } SDL_Quit(); return (0); }
int main(int argc, char *argv[]) { SDL_Event event; int done; Uint32 videoflags; /* Initialize SDL */ if (SDL_Init(SDL_INIT_VIDEO) < 0) { fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); return (1); } videoflags = SDL_SWSURFACE; while (argc > 1) { --argc; if (argv[argc] && !strcmp(argv[argc], "-fullscreen")) { videoflags |= SDL_FULLSCREEN; } else { fprintf(stderr, "Usage: %s [-fullscreen]\n", argv[0]); quit(1); } } /* Set 640x480 video mode */ if (SDL_SetVideoMode(640, 480, 0, videoflags) == NULL) { fprintf(stderr, "Couldn't set 640x480 video mode: %s\n", SDL_GetError()); quit(2); } /* Watch keystrokes */ done = 0; while (!done) { /* Check for events */ SDL_WaitEvent(&event); switch (event.type) { case SDL_KEYDOWN: case SDL_KEYUP: PrintKey(&event.key.keysym, event.key.state, event.key.repeat); break; case SDL_TEXTINPUT: PrintText(event.text.text); break; case SDL_MOUSEBUTTONDOWN: /* Any button press quits the app... */ case SDL_QUIT: done = 1; break; default: break; } } SDL_Quit(); return (0); }
/* hash table ------------ implement a hash table which the key is the name of the virus the value is the signature. inorder on search over the files we could use Boyer–Moore string search algorithm Version Alpha: Anti-Virus - Viruses and signatures save into a file then it loads up into a struct Version Beta: more complicated program that use hash table for searching and storing the database Iterate over the database stream to save them into structure. for example: "virusA" - "signature"\nVirusB" - "signature"\n\r\eof it will parse as: database info[1]; info[0]: name = "virusA" signature = "signature" hash = 1 info[1]: name = "virusB" signature = "signature" hash = 0 */ void ParseDatabase(char *data) { //char *token = "\"\n"; char *token = """=\n"""; char *ptr = strtok(data, token); int i = 0; Database *database = NULL; while(ptr != NULL) { if(i%2 == 0) PrintKey(ptr, database); else PrintValue(ptr, database); ptr = strtok(NULL, token); i++; } }
void loop() { SDL_Event event; /* Check for events */ /*SDL_WaitEvent(&event); emscripten does not like waiting*/ while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_KEYDOWN: case SDL_KEYUP: PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE); break; case SDL_TEXTEDITING: PrintText("EDIT", event.text.text); break; case SDL_TEXTINPUT: PrintText("INPUT", event.text.text); break; case SDL_MOUSEBUTTONDOWN: /* Left button quits the app, other buttons toggles text input */ if (event.button.button == SDL_BUTTON_LEFT) { done = 1; } else { if (SDL_IsTextInputActive()) { SDL_Log("Stopping text input\n"); SDL_StopTextInput(); } else { SDL_Log("Starting text input\n"); SDL_StartTextInput(); } } break; case SDL_QUIT: done = 1; break; default: break; } } #ifdef __EMSCRIPTEN__ if (done) { emscripten_cancel_main_loop(); } #endif }
PK11SymKey * FindKey(PK11SlotInfo *slot, char *name, SECItem *id, void *pwd) { PK11SymKey *key = NULL; SECStatus rv = PK11_Authenticate(slot, PR_FALSE, pwd); if (rv != SECSuccess) { return NULL; } if (id->data) { key = PK11_FindFixedKey(slot,CKM_INVALID_MECHANISM, id, pwd); } if (name && !key) { key = PK11_ListFixedKeysInSlot(slot,name, pwd); } if (key) { printf("Found a key\n"); PrintKey(key); } return key; }
SECStatus ListKeys(PK11SlotInfo *slot, int *printLabel, void *pwd) { PK11SymKey *keyList; SECStatus rv = PK11_Authenticate(slot, PR_FALSE, pwd); if (rv != SECSuccess) { return rv;; } keyList = PK11_ListFixedKeysInSlot(slot, NULL, pwd); if (keyList) { if (*printLabel) { printf(" Name Len Strength Type Data\n"); *printLabel = 0; } printf("%s:\n",PK11_GetTokenName(slot)); } while (keyList) { PK11SymKey *freeKey = keyList; PrintKey(keyList); keyList = PK11_GetNextSymKey(keyList); PK11_FreeSymKey(freeKey); } return SECSuccess; }
QString MenuCommands::Get(int ind, What w) const { int cur = 0; if (cur++ == ind) return (w == Key ? FileKey() : (w == Title? FileTitle() : "")); if (cur++ == ind) return (w == Key ? NewWinKey() : (w == Title? NewWinTitle() : GetStr(NewWinShortcuts()))); if (cur++ == ind) return (w == Key ? OpenFileKey() : (w == Title? OpenFileTitle() : GetStr(OpenFileShortcuts()))); if (cur++ == ind) return (w == Key ? OpenLocKey() : (w == Title? OpenLocTitle() : GetStr(OpenLocShortcuts()))); if (cur++ == ind) return (w == Key ? SaveAsKey() : (w == Title? SaveAsTitle() : GetStr(SaveAsShortcuts()))); if (cur++ == ind) return (w == Key ? SavePdfKey() : (w == Title? SavePdfTitle() : GetStr(SavePdfShortcuts()))); if (cur++ == ind) return (w == Key ? ImportKey() : (w == Title? ImportTitle() : "")); if (cur++ == ind) return (w == Key ? ImportIEKey() : (w == Title? ImportIETitle() : GetStr(ImportIEShortcuts()))); if (cur++ == ind) return (w == Key ? ImportFFKey() : (w == Title? ImportFFTitle() : GetStr(ImportFFShortcuts()))); if (cur++ == ind) return (w == Key ? ImportHtmlKey() : (w == Title? ImportHtmlTitle() : GetStr(ImportHtmlShortcuts()))); if (cur++ == ind) return (w == Key ? ImportXmlKey() : (w == Title? ImportXmlTitle() : GetStr(ImportXmlShortcuts()))); if (cur++ == ind) return (w == Key ? ExportKey() : (w == Title? ExportTitle() : GetStr(ExportShortcuts()))); if (cur++ == ind) return (w == Key ? PrintKey() : (w == Title? PrintTitle() : GetStr(PrintShortcuts()))); if (cur++ == ind) return (w == Key ? PreviewKey() : (w == Title? PreviewTitle() : GetStr(PreviewShortcuts()))); if (cur++ == ind) return (w == Key ? QuitKey() : (w == Title? QuitTitle() : GetStr(QuitShortcuts()))); if (cur++ == ind) return (w == Key ? EditKey() : (w == Title? EditTitle() : "")); if (cur++ == ind) return (w == Key ? UndoKey() : (w == Title? UndoTitle() : GetStr(UndoShortcuts()))); if (cur++ == ind) return (w == Key ? RedoKey() : (w == Title? RedoTitle() : GetStr(RedoShortcuts()))); if (cur++ == ind) return (w == Key ? CutKey() : (w == Title? CutTitle() : GetStr(CutShortcuts()))); if (cur++ == ind) return (w == Key ? CopyKey() : (w == Title? CopyTitle() : GetStr(CopyShortcuts()))); if (cur++ == ind) return (w == Key ? PasteKey() : (w == Title? PasteTitle() : GetStr(PasteShortcuts()))); if (cur++ == ind) return (w == Key ? FindKey() : (w == Title? FindTitle() : GetStr(FindShortcuts()))); if (cur++ == ind) return (w == Key ? NextKey() : (w == Title? NextTitle() : GetStr(NextShortcuts()))); if (cur++ == ind) return (w == Key ? PrevKey() : (w == Title? PrevTitle() : GetStr(PrevShortcuts()))); if (cur++ == ind) return (w == Key ? PrefsKey() : (w == Title? PrefsTitle() : GetStr(PrefsShortcuts()))); if (cur++ == ind) return (w == Key ? ViewKey() : (w == Title? ViewTitle() : "")); if (cur++ == ind) return (w == Key ? AppStylesKey() : (w == Title? AppStylesTitle() : "")); if (cur++ == ind) return (w == Key ? StatusKey() : (w == Title? StatusTitle() : GetStr(StatusShortcuts()))); if (cur++ == ind) return (w == Key ? MenuKey() : (w == Title? MenuTitle() : GetStr(MenuShortcuts()))); if (cur++ == ind) return (w == Key ? TabKey() : (w == Title? TabTitle() : GetStr(TabShortcuts()))); if (cur++ == ind) return (w == Key ? NavKey() : (w == Title? NavTitle() : GetStr(NavShortcuts()))); if (cur++ == ind) return (w == Key ? BooksKey() : (w == Title? BooksTitle() : GetStr(BooksShortcuts()))); // if (cur++ == ind) // return (w == Key ? Key() : (w == Title? Title() : GetStr(Shortcuts()))); if (cur++ == ind) return (w == Key ? StopKey() : (w == Title? StopTitle() : GetStr(StopShortcuts()))); if (cur++ == ind) return (w == Key ? ReloadKey() : (w == Title? ReloadTitle() : GetStr(ReloadShortcuts()))); if (cur++ == ind) return (w == Key ? LargerKey() : (w == Title? LargerTitle() : GetStr(LargerShortcuts()))); if (cur++ == ind) return (w == Key ? NormalKey() : (w == Title? NormalTitle() : GetStr(NormalShortcuts()))); if (cur++ == ind) return (w == Key ? SmallerKey() : (w == Title? SmallerTitle() : GetStr(SmallerShortcuts()))); if (cur++ == ind) return (w == Key ? TextOnlyKey() : (w == Title? TextOnlyTitle() : GetStr(TextOnlyShortcuts()))); if (cur++ == ind) return (w == Key ? EncodeKey() : (w == Title? EncodeTitle() : "")); if (cur++ == ind) return (w == Key ? SourceKey() : (w == Title? SourceTitle() : GetStr(SourceShortcuts()))); if (cur++ == ind) return (w == Key ? FullKey() : (w == Title? FullTitle() : GetStr(FullShortcuts()))); if (cur++ == ind) return (w == Key ? HistoryKey() : (w == Title? HistoryTitle() : "")); if (cur++ == ind) return (w == Key ? BackKey() : (w == Title? BackTitle() : GetStr(BackShortcuts()))); if (cur++ == ind) return (w == Key ? ForwKey() : (w == Title? ForwTitle() : GetStr(ForwShortcuts()))); if (cur++ == ind) return (w == Key ? HomeKey() : (w == Title? HomeTitle() : GetStr(HomeShortcuts()))); if (cur++ == ind) return (w == Key ? LastTabKey() : (w == Title? LastTabTitle() : GetStr(LastTabShortcuts()))); if (cur++ == ind) return (w == Key ? LastTabsKey() : (w == Title? LastTabsTitle() : GetStr(LastTabsShortcuts()))); if (cur++ == ind) return (w == Key ? SessionKey() : (w == Title? SessionTitle() : GetStr(SessionShortcuts()))); if (cur++ == ind) return (w == Key ? AllHistKey() : (w == Title? AllHistTitle() : GetStr(AllHistShortcuts()))); if (cur++ == ind) return (w == Key ? ClearKey() : (w == Title? ClearTitle() : GetStr(ClearShortcuts()))); if (cur++ == ind) return (w == Key ? BookmarksKey() : (w == Title? BookmarksTitle() : "")); if (cur++ == ind) return (w == Key ? AllBooksKey() : (w == Title? AllBooksTitle() : GetStr(AllBooksShortcuts()))); if (cur++ == ind) return (w == Key ? AddBookKey() : (w == Title? AddBookTitle() : GetStr(AddBookShortcuts()))); if (cur++ == ind) return (w == Key ? PrivacyKey() : (w == Title? PrivacyTitle() : "")); if (cur++ == ind) return (w == Key ? PrivateKey() : (w == Title? PrivateTitle() : GetStr(PrivateShortcuts()))); if (cur++ == ind) return (w == Key ? JavaScriptKey() : (w == Title? JavaScriptTitle() : GetStr(JavaScriptShortcuts()))); if (cur++ == ind) return (w == Key ? ImagesKey() : (w == Title? ImagesTitle() : GetStr(ImagesShortcuts()))); if (cur++ == ind) return (w == Key ? CookiesKey() : (w == Title? CookiesTitle() : GetStr(CookiesShortcuts()))); if (cur++ == ind) return (w == Key ? PlugInsKey() : (w == Title? PlugInsTitle() : GetStr(PlugInsShortcuts()))); if (cur++ == ind) return (w == Key ? AgentKey() : (w == Title? AgentTitle() : GetStr(AgentShortcuts()))); if (cur++ == ind) return (w == Key ? PopUpsKey() : (w == Title? PopUpsTitle() : GetStr(PopUpsShortcuts()))); if (cur++ == ind) return (w == Key ? ProxyKey() : (w == Title? ProxyTitle() : GetStr(ProxyShortcuts()))); if (cur++ == ind) return (w == Key ? EmptyKey() : (w == Title? EmptyTitle() : GetStr(EmptyShortcuts()))); if (cur++ == ind) return (w == Key ? ResetKey() : (w == Title? ResetTitle() : GetStr(ResetShortcuts()))); if (cur++ == ind) return (w == Key ? FullResetKey() : (w == Title? FullResetTitle() : GetStr(FullResetShortcuts()))); if (cur++ == ind) return (w == Key ? ToolsKey() : (w == Title? ToolsTitle() : "")); if (cur++ == ind) return (w == Key ? CompatKey() : (w == Title? CompatTitle() : "")); if (cur++ == ind) return (w == Key ? SearchKey() : (w == Title? SearchTitle() : GetStr(SearchShortcuts()))); if (cur++ == ind) return (w == Key ? KeyboardKey() : (w == Title? KeyboardTitle() : GetStr(KeyboardShortcuts()))); if (cur++ == ind) return (w == Key ? InspectorKey() : (w == Title? InspectorTitle() : GetStr(InspectorShortcuts()))); if (cur++ == ind) return (w == Key ? InspectKey() : (w == Title? InspectTitle() : GetStr(InspectShortcuts()))); if (cur++ == ind) return (w == Key ? OptionsKey() : (w == Title? OptionsTitle() : GetStr(OptionsShortcuts()))); if (cur++ == ind) return (w == Key ? WindowKey() : (w == Title? WindowTitle() : "")); if (cur++ == ind) return (w == Key ? NextTabKey() : (w == Title? NextTabTitle() : GetStr(NextTabShortcuts()))); if (cur++ == ind) return (w == Key ? PrevTabKey() : (w == Title? PrevTabTitle() : GetStr(PrevTabShortcuts()))); if (cur++ == ind) return (w == Key ? NewTabKey() : (w == Title? NewTabTitle() : GetStr(NewTabShortcuts()))); if (cur++ == ind) return (w == Key ? CloseTabKey() : (w == Title? CloseTabTitle() : GetStr(CloseTabShortcuts()))); if (cur++ == ind) return (w == Key ? CloseOtherKey() : (w == Title? CloseOtherTitle() : GetStr(CloseOtherShortcuts()))); if (cur++ == ind) return (w == Key ? CloneTabKey() : (w == Title? CloneTabTitle() : GetStr(CloneTabShortcuts()))); if (cur++ == ind) return (w == Key ? ReloadTabKey() : (w == Title? ReloadTabTitle() : GetStr(ReloadTabShortcuts()))); if (cur++ == ind) return (w == Key ? ReloadAllKey() : (w == Title? ReloadAllTitle() : GetStr(ReloadAllShortcuts()))); if (cur++ == ind) return (w == Key ? OpenNewTabKey() : (w == Title? OpenNewTabTitle() : GetStr(OpenNewTabShortcuts()))); if (cur++ == ind) return (w == Key ? OpenAdBlockKey() : (w == Title? OpenAdBlockTitle() : GetStr(OpenAdBlockShortcuts()))); if (cur++ == ind) return (w == Key ? SwapFocusKey() : (w == Title? SwapFocusTitle() : GetStr(SwapFocusShortcuts()))); if (cur++ == ind) return (w == Key ? CopyAddrKey() : (w == Title? CopyAddrTitle() : "")); if (cur++ == ind) return (w == Key ? DownsKey() : (w == Title? DownsTitle() : GetStr(DownsShortcuts()))); if (cur++ == ind) return (w == Key ? TorrentsKey() : (w == Title? TorrentsTitle() : GetStr(TorrentsShortcuts()))); if (cur++ == ind) return (w == Key ? HelpKey() : (w == Title? HelpTitle() : GetStr(HelpShortcuts()))); if (cur++ == ind) return (w == Key ? OnlineKey() : (w == Title? OnlineTitle() : GetStr(OnlineShortcuts()))); if (cur++ == ind) return (w == Key ? UpdatesKey() : (w == Title? UpdatesTitle() : GetStr(UpdatesShortcuts()))); if (cur++ == ind) return (w == Key ? AboutKey() : (w == Title? AboutTitle() : GetStr(AboutShortcuts()))); return ""; }