static void putSrc(any s, any k) { if (!isNil(val(Dbg)) && !isExt(s) && InFile && InFile->name) { any x, y; cell c1; Push(c1, boxCnt(InFile->src)); data(c1) = cons(data(c1), mkStr(InFile->name)); x = get(s, Dbg); if (!k) { if (isNil(x)) put(s, Dbg, cons(data(c1), Nil)); else car(x) = data(c1); } else if (isNil(x)) put(s, Dbg, cons(Nil, cons(data(c1), Nil))); else { for (y = cdr(x); isCell(y); y = cdr(y)) if (caar(y) == k) { cdar(y) = data(c1); drop(c1); return; } cdr(x) = cons(cons(k, data(c1)), cdr(x)); } drop(c1); } }
int Instr::trans(MN x, GPRR dst , GPRR src) { START_TRANS(); GET_OPINFO(x,dst,src); transReg2Reg(d, (GPR)dst, (GPR)src); //! set r REX tRex; tRex.setW(); if( isOpcReg2RM()){ tRex.setR(isExt((GPR)src)); tRex.setB(isExt((GPR)dst)); } else { tRex.setR(isExt((GPR)dst)); tRex.setB(isExt((GPR)src)); } this->setRex(tRex); //! bytes return DM_SUCCESS; }
/*! * \brief StartPage::nextId * \return */ int StartPage::nextId() const { ModelingWizard * mw = dynamic_cast<ModelingWizard*>(wizard()); if(isExt()){ mw->getDataRef().setIs_ext(true); mw->getDataRef().setFilename(ui->lineEdit->text()); return ModelingWizard::HOLES_PAGE; }else{ mw->getDataRef().setIs_ext(false); return ModelingWizard::SIZE_PAGE; } }
static char *stripExt(const char *_path, const char *ext) { char *path = mc_strdup(_path); if (path == NULL) { return NULL; } else if (isExt(path, ext)) { int l = strlen(path) - strlen(ext); if (l > 0) { path[l] = '\0'; } } return path; }
static BOOL saveInfoAs(void) { _TCHAR filename[MAX_PATH]; _TCHAR filter[1024]; OPENFILENAME ofn = { sizeof(OPENFILENAME), infoDialog, 0, filter, NULL, 0, 1, filename, MAX_PATH, NULL, 0, NULL, _T("Select output file"), OFN_ENABLESIZING | OFN_EXPLORER | OFN_OVERWRITEPROMPT, 0, 0, NULL, 0, NULL, NULL }; LPTSTR ext; BOOL tag = FALSE; SendDlgItemMessage(infoDialog, IDC_FILENAME, WM_GETTEXT, MAX_PATH, (LPARAM) filename); ext = _tcsrchr(filename, '.'); if (ext != NULL) { *ext = '\0'; ofn.lpstrDefExt = ext + 1; } setSaveFilters(filter); if (!GetSaveFileName(&ofn)) return FALSE; if (isExt(filename, _T(".xex"))) { switch (MessageBox(infoDialog, _T("Do you want to display information during playback?"), _T("ASAP"), MB_YESNOCANCEL | MB_ICONQUESTION)) { case IDYES: tag = TRUE; break; case IDCANCEL: return FALSE; default: break; } } return saveFile(filename, tag); }
void updateInfoDialog(LPCTSTR filename, int song) { int songs; int i; if (infoDialog == NULL) return; if (edited_info == NULL) { edited_info = ASAPInfo_New(); if (astil == NULL) astil = ASTIL_New(); if (edited_info == NULL || astil == NULL) { closeInfoDialog(); return; } } else if (infoChanged()) return; if (!loadModule(filename, saved_module, &saved_module_len) || !ASAPInfo_Load(edited_info, filename, saved_module, saved_module_len)) { closeInfoDialog(); return; } setSaved(); can_save = isExt(filename, _T(".sap")); invalid_fields = 0; SendDlgItemMessage(infoDialog, IDC_FILENAME, WM_SETTEXT, 0, (LPARAM) filename); SendDlgItemMessage(infoDialog, IDC_AUTHOR, WM_SETTEXT, 0, (LPARAM) saved_author); SendDlgItemMessage(infoDialog, IDC_NAME, WM_SETTEXT, 0, (LPARAM) saved_title); SendDlgItemMessage(infoDialog, IDC_DATE, WM_SETTEXT, 0, (LPARAM) saved_date); SendDlgItemMessage(infoDialog, IDC_SONGNO, CB_RESETCONTENT, 0, 0); songs = ASAPInfo_GetSongs(edited_info); EnableWindow(GetDlgItem(infoDialog, IDC_SONGNO), songs > 1); for (i = 1; i <= songs; i++) { _TCHAR str[16]; _stprintf(str, _T("%d"), i); SendDlgItemMessage(infoDialog, IDC_SONGNO, CB_ADDSTRING, 0, (LPARAM) str); } if (song < 0) song = ASAPInfo_GetDefaultSong(edited_info); SendDlgItemMessage(infoDialog, IDC_SONGNO, CB_SETCURSEL, song, 0); setEditedSong(song); EnableWindow(GetDlgItem(infoDialog, IDC_SAVE), FALSE); updateTech(); }
static bool isa(any cls, any x) { any z; z = x = val(x); while (isCell(x)) { if (!isCell(car(x))) { while (isSym(car(x))) { if (isExt(car(x))) return NO; if (cls == car(x) || isa(cls, car(x))) return YES; if (!isCell(x = cdr(x)) || z == x) return NO; } return NO; } if (z == (x = cdr(x))) return NO; } return NO; }
static BOOL saveFile(LPCTSTR filename, BOOL tag) { BOOL isSap = isExt(filename, _T(".sap")); if (isSap) { int song = ASAPInfo_GetSongs(edited_info); while (--song >= 0 && ASAPInfo_GetDuration(edited_info, song) < 0); while (--song >= 0) { if (ASAPInfo_GetDuration(edited_info, song) < 0) { MessageBox(infoDialog, _T("Cannot save file because time not set for all songs"), _T("Error"), MB_OK | MB_ICONERROR); return FALSE; } } } if (!doSaveFile(filename, tag)) { MessageBox(infoDialog, _T("Cannot save file"), _T("Error"), MB_OK | MB_ICONERROR); // FIXME: delete file return FALSE; } if (isSap) setSaved(); return TRUE; }
// (try 'msg 'obj ['any ..]) -> any any doTry(any ex) { any x, y; cell c1, c2; x = cdr(ex), Push(c1, EVAL(car(x))); NeedSym(ex,data(c1)); x = cdr(x), Push(c2, EVAL(car(x))); if (isSym(data(c2))) { if (isExt(data(c2))) { if (!isLife(data(c2))) return Nil; db(ex,data(c2),1); } TheKey = data(c1), TheCls = NULL; if (y = method(data(c2))) { x = evMethod(data(c2), y, cdr(x)); drop(c1); return x; } } drop(c1); return Nil; }
static int isImage(const char *path) { return isExt(path, ".jpg") || isExt(path, ".jpeg") || isExt(path, ".png"); }
static int isCue(const char *path) { return isExt(path, ".cue"); }