inline void read1(char *s){ char ch=getchar(); for (;blank(ch);ch=getchar()); for (;!blank(ch);ch=getchar())*s++=ch; *s=0; }
bool isStartOfToken(const bool in_str, const string& s, size_t p) { return !in_str && (isStringBoundary(s[p]) || isParen(s[p]) || (!blank(in_str, s[p]) && (p == 0 || blank(in_str, s[p-1]) || isParen(s[p-1])))); }
static int display(Queenscreen *qs) { int max = 1024; int polys = 0; glClear(clearbits); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glRotatef(current_device_rotation(), 0, 0, 1); /* setup light attenuation */ /* #### apparently this does nothing */ glEnable(GL_COLOR_MATERIAL); glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.8/(0.01+findAlpha(qs))); glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.06); /** setup perspective */ glTranslatef(0.0, 0.0, -1.5*qs->BOARDSIZE); glRotatef(30.0, 1.0, 0.0, 0.0); gltrackball_rotate (qs->trackball); glRotatef(qs->theta*100, 0.0, 1.0, 0.0); glTranslatef(-0.5*qs->BOARDSIZE, 0.0, -0.5*qs->BOARDSIZE); /* find light positions */ qs->position[0] = qs->BOARDSIZE/2.0 + qs->BOARDSIZE/1.4*-sin(qs->theta*100*M_PI/180.0); qs->position[2] = qs->BOARDSIZE/2.0 + qs->BOARDSIZE/1.4*cos(qs->theta*100*M_PI/180.0); qs->position[1] = 6.0; if(!wire) { glEnable(GL_LIGHTING); glLightfv(GL_LIGHT0, GL_POSITION, qs->position); glEnable(GL_LIGHT0); } /* Since the lighting attenuation trick up there doesn't seem to be working, let's drop the old board down and drop the new board in. */ if (qs->steps < (max/8.0)) { GLfloat y = qs->steps / (max/8.0); y = sin (M_PI/2 * y); glTranslatef (0, 10 - (y * 10), 0); } else if (qs->steps > max-(max/8.0)) { GLfloat y = (qs->steps - (max-(max/8.0))) / (GLfloat) (max/8.0); y = 1 - sin (M_PI/2 * (1-y)); glTranslatef (0, -y * 15, 0); } /* draw reflections */ if(!wire) { polys += draw_reflections(qs); glEnable(GL_BLEND); } polys += drawBoard(qs); if(!wire) glDisable(GL_BLEND); glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.1); glTranslatef(0.5, 0.0, 0.5); polys += drawPieces(qs); /* rotate camera */ if(!qs->button_down_p) qs->theta += .002; /* zero out board, find new solution of size MINBOARD <= i <= MAXBOARD */ if(++qs->steps == max) { qs->steps = 0; blank(qs); qs->BOARDSIZE = MINBOARD + (random() % (MAXBOARD - MINBOARD + 1)); qs->colorset = (qs->colorset+1)%COLORSETS; go(qs); } return polys; }
status_t BnSurfaceComposer::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case CREATE_CONNECTION: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IBinder> b = createConnection()->asBinder(); reply->writeStrongBinder(b); } break; case CREATE_GRAPHIC_BUFFER_ALLOC: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IBinder> b = createGraphicBufferAlloc()->asBinder(); reply->writeStrongBinder(b); } break; case SET_TRANSACTION_STATE: { CHECK_INTERFACE(ISurfaceComposer, data, reply); size_t count = data.readInt32(); ComposerState s; Vector<ComposerState> state; state.setCapacity(count); for (size_t i=0 ; i<count ; i++) { s.read(data); state.add(s); } count = data.readInt32(); DisplayState d; Vector<DisplayState> displays; displays.setCapacity(count); for (size_t i=0 ; i<count ; i++) { d.read(data); displays.add(d); } uint32_t flags = data.readInt32(); setTransactionState(state, displays, flags); } break; case BOOT_FINISHED: { CHECK_INTERFACE(ISurfaceComposer, data, reply); bootFinished(); } break; case CAPTURE_SCREEN: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IBinder> display = data.readStrongBinder(); uint32_t reqWidth = data.readInt32(); uint32_t reqHeight = data.readInt32(); uint32_t minLayerZ = data.readInt32(); uint32_t maxLayerZ = data.readInt32(); sp<IMemoryHeap> heap; uint32_t w, h; PixelFormat f; status_t res = captureScreen(display, &heap, &w, &h, &f, reqWidth, reqHeight, minLayerZ, maxLayerZ); reply->writeStrongBinder(heap->asBinder()); reply->writeInt32(w); reply->writeInt32(h); reply->writeInt32(f); reply->writeInt32(res); } break; case AUTHENTICATE_SURFACE: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<ISurfaceTexture> surfaceTexture = interface_cast<ISurfaceTexture>(data.readStrongBinder()); int32_t result = authenticateSurfaceTexture(surfaceTexture) ? 1 : 0; reply->writeInt32(result); } break; case CREATE_DISPLAY_EVENT_CONNECTION: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IDisplayEventConnection> connection(createDisplayEventConnection()); reply->writeStrongBinder(connection->asBinder()); return NO_ERROR; } break; case CREATE_DISPLAY: { CHECK_INTERFACE(ISurfaceComposer, data, reply); String8 displayName = data.readString8(); bool secure = bool(data.readInt32()); sp<IBinder> display(createDisplay(displayName, secure)); reply->writeStrongBinder(display); return NO_ERROR; } break; case GET_BUILT_IN_DISPLAY: { CHECK_INTERFACE(ISurfaceComposer, data, reply); int32_t id = data.readInt32(); sp<IBinder> display(getBuiltInDisplay(id)); reply->writeStrongBinder(display); return NO_ERROR; } break; case BLANK: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IBinder> display = data.readStrongBinder(); blank(display); } break; case UNBLANK: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IBinder> display = data.readStrongBinder(); unblank(display); } break; case GET_DISPLAY_INFO: { CHECK_INTERFACE(ISurfaceComposer, data, reply); DisplayInfo info; sp<IBinder> display = data.readStrongBinder(); status_t result = getDisplayInfo(display, &info); memcpy(reply->writeInplace(sizeof(DisplayInfo)), &info, sizeof(DisplayInfo)); reply->writeInt32(result); } break; default: return BBinder::onTransact(code, data, reply, flags); } return NO_ERROR; }
void DreamWebEngine::useOpened() { if (_openedOb == 255) return; // cannot use opened object if (!_pickUp) { outOfOpen(); return; } ObjectRef objectId = findOpenPos(); if (objectId._index != 255) { swapWithOpen(); return; } if (_pickUp != 1) { blank(); return; } objectId._type = _objectType; objectId._index = _itemFrame; if (objectId != _oldSubject || _commandType != 227) { if (objectId == _oldSubject) _commandType = 227; _oldSubject = objectId; commandWithOb(35, objectId._type, objectId._index); } if (_mouseButton == _oldButton || !(_mouseButton & 1)) return; if (isItWorn(getEitherAd())) { wornError(); return; } delPointer(); if (_itemFrame == _openedOb && _objectType == _openedType) { errorMessage1(); return; } if (!checkObjectSize()) return; _pickUp = 0; DynObject *object = getEitherAd(); object->mapad[0] = _openedType; object->mapad[1] = _openedOb; object->mapad[2] = _lastInvPos; object->mapad[3] = _realLocation; fillOpen(); underTextLine(); readMouse(); useOpened(); showPointer(); workToScreen(); delPointer(); }
bool ossimIndexToRgbLutFilter::initializeLut(const ossimKeywordlist* kwl, const char* prefix) { theLut.clear(); const ossimString entry_kw ("entry"); ossimString keyword, base_keyword; ossimString indexStr, rgbStr; ossimString blank(" "); std::vector<ossimString> rgbList; double index; ossimRgbVector rgbVector (0,0,0); bool rtn_state = true; ossim_uint32 numEntries=0; while (true) { base_keyword = entry_kw + ossimString::toString(numEntries); if ((theMode == LITERAL) || (theMode == VERTICES)) { // Index and color are subentries for this mode: keyword = base_keyword + ".index"; indexStr = kwl->find(prefix, keyword.chars()); if (indexStr.empty()) break; index = indexStr.toDouble(); keyword = base_keyword + ".color"; rgbStr = kwl->find(prefix, keyword.chars()); } else { // REGULAR mode: index is computed later to arrive at equally-spaced vertices. For now, // just store entry number as index: index = (double) numEntries; keyword = base_keyword; rgbStr = kwl->find(prefix, keyword.chars()); if (rgbStr.empty()) { // Perhaps old bloated form with separate keywords for R, G, B rgbStr = kwl->find(prefix, (keyword + ".r").chars()); rgbStr += " "; rgbStr += kwl->find(prefix, (keyword + ".g").chars()); rgbStr += " "; rgbStr += kwl->find(prefix, (keyword + ".b").chars()); if (rgbStr.length() < 5) break; } } rgbStr.split(rgbList, blank, true); if (rgbList.size() != 3) { ossimNotify(ossimNotifyLevel_WARN)<<"ossimIndexToRgbLutFilter::initializeLut() -- " "Bad color specification in LUT KWL. LUT is not properly initialized."<<endl; return false; } rgbVector.setR(rgbList[0].toUInt8()); rgbVector.setG(rgbList[1].toUInt8()); rgbVector.setB(rgbList[2].toUInt8()); theLut.insert(std::pair<double, ossimRgbVector>(index, rgbVector)); rgbList.clear(); ++numEntries; } // For REGULAR mode, need to adjust the indices to reflect a piecewise linear LUT with equally // spaced vertices: if (theMode == REGULAR) { std::map<double, ossimRgbVector> orig_lut = theLut; std::map<double, ossimRgbVector>::iterator iter = orig_lut.begin(); theLut.clear(); if (numEntries == 1) { // Insert the implied start index at black and endpoint at specified color: theLut.insert(std::pair<double, ossimRgbVector>(theMinValue, ossimRgbVector (1, 1, 1))); theLut.insert(std::pair<double, ossimRgbVector>(theMaxValue, iter->second)); } else { // Loop to create equally-spaced vertices between min and max index values: double interval = (theMaxValue - theMinValue) / (numEntries - 1); while (iter != orig_lut.end()) { index = theMinValue + iter->first*interval; theLut.insert(std::pair<double, ossimRgbVector>(index, iter->second)); ++iter; } } } return rtn_state; }
bool ConfigReader::read() { std::string buf, line, key, val, err; std::ifstream reader(config_path); uint16_t nline, nsettings; size_t ind, set; int8_t open; nsettings = sizeof(settings) / sizeof(settings[0]); nline = set = open = 0; while (std::getline(reader, line)) { ++nline; /* remove commented sections of lines */ if ((ind = line.find('#')) != std::string::npos && line[ind - 1] != '\\') line = line.substr(0, ind); if (blank(line)) continue; if (!open) { remove_leading(line); if ((ind = line.find('=')) == std::string::npos) { err = "unrecognized token -- "; for (ind = 0; !isspace(line[ind]); ++ind) err += line[ind]; std::cerr << config_path << ": line " << nline << ": " << err << std::endl; return false; } key = line.substr(0, ind); while (isspace(key.back())) key.pop_back(); for (set = 0; set < nsettings; ++set) { if (key == settings[set].key) break; } if (set == nsettings) { std::cerr << config_path << ": line " << nline << ": unrecognized key -- " << key << std::endl; return false; } } if (settings[set].val_type == STRING) { if ((val = parse_string(line)).empty()) { std::cerr << config_path << ": line " << nline << ": no setting provided for " << key << std::endl; return false; } setmap[key] = val; } else { /* reading a list within a brace block */ ind = -1; while ((ind = line.find('{', ind + 1)) != std::string::npos) ++open; if (open) { remove_leading(line); buf += line + '\n'; ind = -1; while ((ind = line.find('}', ind + 1)) != std::string::npos) --open; } if (!open) { if ((val = parse_string(buf)).empty()) { std::cerr << config_path << ": line " << nline << ": no setting " "provided for " << key << std::endl; return false; } if (settings[set].val_type == LIST) val = parse_list(val, err); else val = parse_olist(key, val, err); if (val.empty()) { std::cerr << config_path << ": line " << nline << ": " << err << std::endl; return false; } setmap[key] = val; buf = ""; } } } if (open) { std::cerr << config_path << ": unexpected end of file" << std::endl; return false; } for (set = 0; set < nsettings; ++set) { if (setmap.find(settings[set].key) == setmap.end()) { std::cerr << config_path << ": missing required setting: " << settings[set].key << std::endl; return false; } } return true; }
static void numbergrid(int row, int col, int low_clue, int high_clue) { if (row == 2 && low_clue == 1 && !ALLBLOT) return; { static unsigned long count = 0; if (K > 0 && ++count >= K) { printf("At %d, %d:\n", row, col); show(); count = 0; } } if (high_clue - low_clue + 1 > squares_remaining(row, col)) { return; } if (col > N) { numbergrid(row + 1, 1, low_clue, high_clue); } else { int srow, scol, snum; srow = symmetric(row); scol = symmetric(col); snum = srow + 1; if (row > srow) { NUMBERUP(row, 1, N); if (low_clue == high_clue + 1) show(); } else if (row == symmetric(row) && col > symmetric(col)) { /*printf("Numbergrid up:\n"); show();*/ NUMBERUP(row, col, N); NUMBERUP(snum, 1, col - 2); if (low_clue == high_clue + 1) show(); } else { int newhi; if (across[low_clue] && (row != firstrow || col != firstcol) && !across[grid[row][col-1]] && !down[grid[row-1][col]] /* no 1-letter words */ && (newhi = high_clue, blot(srow, scol), blotted(snum, scol) ? 1 /* not blank; no numbergrid issues */ : blotted(snum, scol - 1) ? across[newhi] && down[newhi] /* OK to number */ ? (grid[snum][scol] = newhi--, 1) : 0 /* must number, but newhi won't work here */ : !across[newhi] && down[newhi] /* OK to number */ ? (grid[snum][scol] = newhi--, 1) : 0 /* must number, but newhi won't work here */ ) && (MINWORD <= 2 || !shortwords(row, col)) ) { blot(row, col); numbergrid(row, col + 1, low_clue, newhi); { if (!blotted(snum, scol)) blank(snum, scol, BLANK); } } if (row > firstrow || col >= firstcol) { if ((newhi = high_clue, blank(srow, scol, BLANK), blotted(snum, scol) ? 1 /* not blank; no numbergrid issues */ : blotted(snum, scol - 1) ? across[newhi] && !down[newhi] /* OK to number */ ? (blank(snum, scol, newhi--), 1) : 0 /* must number, but newhi won't work here */ : 1 /* no blot to left, therefore no number needed */ )) { if (numberable(row, col, low_clue) && low_clue <= high_clue) { blank(row, col, low_clue); numbergrid(row, col + 1, low_clue + 1, newhi); } else if (!numberable(row, col, ANY)) { blank(row, col, BLANK); numbergrid(row, col + 1, low_clue, newhi); } { if (!blotted(snum, scol)) blank(snum, scol, BLANK); } } } grid[row][col] = grid[srow][scol] = UNKNOWN; } } }
void Nixie_i2c::init() { _mcp.begin(_i2c_address); //Set all pins to o/p for (int i=0; i<16; ++i) _mcp.pinMode(i, OUTPUT); blank(); }
int main(int argc, char *argv[]) { char *fname = argv[1] ; int y, i, j, c ; HalfImage halfimage ; if (ReadImage(fname, image)) fprintf(stderr, "%s read successfully.\n", fname) ; /* downsample */ for (j=0; j<HALFHEIGHT; j++) { for (i=0; i<HALFWIDTH; i++) { for (c=0; c<3; c++) halfimage[j][i][c] = (image[2*j][2*i][c] + image[2*j+1][2*i][c] + image[2*j][2*i+1][c] + image[2*j+1][2*i+1][c]) / 4.0 ; } } /* now, color space convert */ for (j=0; j<HEIGHT; j++) { for (i=0; i<WIDTH; i++) { image[j][i][0] = 0.30 * image[j][i][0] + 0.59 * image[j][i][1] + 0.11 * image[j][i][2] ; } } /* and the half image */ for (j=0; j<HALFHEIGHT; j++) { for (i=0; i<HALFWIDTH; i++) { float y = 0.30 * halfimage[j][i][0] + 0.59 * halfimage[j][i][1] + 0.11 * halfimage[j][i][2] ; halfimage[j][i][1] = (halfimage[j][i][1] - y + 1.0) / 2.0 ; halfimage[j][i][2] = (halfimage[j][i][2] - y + 1.0) / 2.0 ; halfimage[j][i][0] = y ; } } sfinfo.channels = 1 ; sfinfo.samplerate = FILESAMPLERATE ; sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16 ; sf = sf_open(argv[2], SFM_WRITE, &sfinfo) ; /* generate the "vis" code. */ blank(500.0) ; Vis(128+8) ; for (y=0; y<HEIGHT; y += 2) ScanlinePair(image, halfimage, y) ; blank(500.0) ; BufferFlush() ; sf_close(sf) ; return 0 ; }
void clearActionLine() { std::string blank(buffersize, ' '); mvprintw(actionLineY, actionLineX1, blank.c_str()); move(actionLineY, actionLineX1); }
KBlankSaver::KBlankSaver(WId id) : KScreenSaver(id) { readSettings(); blank(); }
// set the color void KBlankSaver::setColor(const QColor &col) { color = col; blank(); }
inline void read1(char &c){for (c=getchar();blank(c);c=getchar());}
OVesaBlank& OVesaBlank::standby() { return(blank(OVesaBlank::off)); }
/* return 1 if a three attack can occur on horizon OR diagonal lines.*/ int three_attack(Game_state* state, int player, Pair** rmap) { int i, j, t_x, t_y; int h_left, h_right, v_upper, v_lower; int to_connect = state->num_to_connect; int lines = num_of_win_places(state->width, state->height, to_connect); for(i = 0; i < lines; i++) { /* does opponent have n-1 in a row on a line ? */ if(!state->score_array[player][i] == to_connect-1) continue; /* are those n-1 contiguous in a row? */ if(!has_n_in_row(state, rmap, player, i, to_connect-1)) continue; v_upper = v_lower = h_left = h_right = 0; /* is there a blank either side, two on one side? vulnerable! */ if(is_diagonal(state, rmap, i)) { for(j = 0; j < state->num_to_connect; j++) { t_x = rmap[i][j].x; t_y = rmap[i][j].y; /* upper right vertical */ if(valid_pos(state, t_x+1, t_y+1) && blank(state, t_x+1, t_y+1)) v_upper = 1; /* upper left vertical */ if(valid_pos(state, t_x-1, t_y+1) && blank(state, t_x-1, t_y+1)) v_upper = 1; /* lower right vertical */ if(valid_pos(state, t_x+1, t_y-1) && blank(state, t_x+1, t_y-1)) v_lower = 1; /* lower left vertical */ if(valid_pos(state, t_x-1, t_y-1) && blank(state, t_x-1, t_y-1)) v_lower = 1; if(v_upper && v_lower) return 1; } } else { for(j = 0; j < state->num_to_connect; j++) { t_x = rmap[i][j].x; t_y = rmap[i][j].y; /* check as we go for horizontal 3-attack */ if(state->board[t_x][t_y] == player) { /* left (horizontal) side is blank */ if(valid_pos(state, t_x-1, t_y) && blank(state, t_x-1, t_y)) { h_left = 1; } /* right (horizontal) side is blank */ if(valid_pos(state, t_x+1, t_y) && blank(state, t_x+1, t_y)) { h_right = 1; } } if(h_left && h_right) return 1; } } } /* if both blank conditions are not met, not three attack */ return 0; }
void sax_parser<_Handler,_Config>::doctype() { // Parse the root element first. sax::doctype_declaration param; name(param.root_element); blank(); // Either PUBLIC or SYSTEM. size_t len = remains(); if (len < 6) sax::malformed_xml_error("DOCTYPE section too short."); param.keyword = sax::doctype_declaration::keyword_private; char c = cur_char(); if (c == 'P') { if (next_char() != 'U' || next_char() != 'B' || next_char() != 'L' || next_char() != 'I' || next_char() != 'C') throw sax::malformed_xml_error("malformed DOCTYPE section."); param.keyword = sax::doctype_declaration::keyword_public; } else if (c == 'S') { if (next_char() != 'Y' || next_char() != 'S' || next_char() != 'T' || next_char() != 'E' || next_char() != 'M') throw sax::malformed_xml_error("malformed DOCTYPE section."); } next_check(); blank(); has_char_throw("DOCTYPE section too short."); // Parse FPI. value(param.fpi, false); has_char_throw("DOCTYPE section too short."); blank(); has_char_throw("DOCTYPE section too short."); if (cur_char() == '>') { // Optional URI not given. Exit. #if ORCUS_DEBUG_SAX_PARSER cout << "sax_parser::doctype: root='" << param.root_element << "', fpi='" << param.fpi << "'" << endl; #endif m_handler.doctype(param); next(); return; } // Parse optional URI. value(param.uri, false); has_char_throw("DOCTYPE section too short."); blank(); has_char_throw("DOCTYPE section too short."); if (cur_char() != '>') throw sax::malformed_xml_error("malformed DOCTYPE section - closing '>' expected but not found."); #if ORCUS_DEBUG_SAX_PARSER cout << "sax_parser::doctype: root='" << param.root_element << "', fpi='" << param.fpi << "' uri='" << param.uri << "'" << endl; #endif m_handler.doctype(param); next(); }
int execute(TREPTR argt, int execflg, int *pf1, int *pf2) { /* `stakbot' is preserved by this routine */ register TREPTR t; STKPTR sav = savstak(); sigchk(); if ((t = argt) && execbrk == 0) { register int treeflgs; int oldexit, type; register char **com; treeflgs = t->tretyp; type = treeflgs & COMMSK; oldexit = exitval; exitval = 0; switch (type) { case TCOM: { STRING a1; int argn, internal; ARGPTR schain = gchain; IOPTR io = t->treio; gchain = 0; argn = getarg((void *)t);/*FIXME*/ com = scan(argn); a1 = com[1]; gchain = schain; if ((internal = syslook(com[0], commands)) || argn == 0) setlist(((COMPTR) t)->comset, 0); if (argn && (flags & noexec) == 0) { /* print command if execpr */ if (flags & execpr) { argn = 0; prs(execpmsg); while (com[argn] != ENDARGS) { prs(com[argn++]); blank(); } newline(); } switch (internal) { case SYSDOT: if (a1) { register int f; if ((f = pathopen(getpath(a1), a1)) < 0) failed(a1, notfound); else execexp(0, f); } break; case SYSTIMES: { struct tms t; times(&t); prt(t.tms_cutime); blank(); prt(t.tms_cstime); newline(); } break; case SYSEXIT: exitsh(a1 ? stoi(a1) : oldexit); case SYSNULL: io = 0; break; case SYSCONT: execbrk = -loopcnt; break; case SYSBREAK: if ((execbrk = loopcnt) && a1) breakcnt = stoi(a1); break; case SYSTRAP: if (a1) { BOOL clear; if ((clear = digit(*a1)) == 0) ++com; while (*++com) { int i; if ((i = stoi(*com)) >= MAXTRAP || i < MINTRAP) failed(*com, badtrap); else if (clear) clrsig(i); else { replace(&trapcom[i], a1); if (*a1) getsig(i); else ignsig(i); } } } else { /* print out current traps */ int i; for (i = 0; i < MAXTRAP; i++) { if (trapcom[i]) { prn(i); prs(colon); prs(trapcom[i]); newline(); } } } break; case SYSEXEC: com++; initio(io); ioset = 0; io = 0; if (a1 == 0) break; case SYSLOGIN: flags |= forked; oldsigs(); execa((const char **)com); done(); case SYSCD: if (flags & rshflg) failed(com[0], restricted); else if ((a1 == 0 && (a1 = (char *)homenod.namval) == 0) || chdir(a1) < 0) /* FIXME */ failed(a1, baddir); break; case SYSSHFT: if (dolc < 1) error(badshift); else { dolv++; dolc--; } assnum(&dolladr, dolc); break; case SYSWAIT: await(-1); break; case SYSREAD: exitval = readvar(&com[1]); break; /* case SYSTST: exitval=testcmd(com); break; */ case SYSSET: if (a1) { int argc; argc = options(argn, (const char **)com); if (argc > 1) setargs((const char **)com + argn - argc); } else if (((COMPTR) t)->comset == 0) /* Scan name chain and print */ namscan(printnam); break; case SYSRDONLY: exitval = N_RDONLY; case SYSXPORT: if (exitval == 0) exitval = N_EXPORT;; if (a1) { while (*++com) attrib(lookup(*com), exitval); } else { namscan(printflg); } exitval = 0; break; case SYSEVAL: if (a1) execexp(a1, (UFD)&com[2]); /* FIXME */ break; case SYSUMASK: if (a1) { int c, i; i = 0; while ((c = *a1++) >= '0' && c <= '7') i = (i << 3) + c - '0'; umask(i); } else { int i, j; umask(i = umask(0)); prc('0'); for (j = 6; j >= 0; j -= 3) prc(((i >> j) & 07) + '0'); newline(); } break; default: internal = builtin(argn, com); } if (internal) { if (io) error(illegal); chktrap(); break; } } else if (t->treio == 0) break; } case TFORK: if (execflg && (treeflgs & (FAMP | FPOU)) == 0) parent = 0; else { while ((parent = fork()) == -1) { sigchk(); alarm(10); pause(); } } if (parent) { /* This is the parent branch of fork; */ /* it may or may not wait for the child. */ if (treeflgs & FPRS && flags & ttyflg) { prn(parent); newline(); } if (treeflgs & FPCL) closepipe(pf1); if ((treeflgs & (FAMP | FPOU)) == 0) await(parent); else if ((treeflgs & FAMP) == 0) post(parent); else assnum(&pcsadr, parent); chktrap(); break; } else { /* this is the forked branch (child) of execute */ flags |= forked; iotemp = 0; postclr(); settmp(); /* Turn off INTR and QUIT if `FINT' */ /* Reset ramaining signals to parent */ /* except for those `lost' by trap */ oldsigs(); if (treeflgs & FINT) { signal(INTR, SIG_IGN); signal(QUIT, SIG_IGN); } /* pipe in or out */ if (treeflgs & FPIN) { sh_rename(pf1[INPIPE], 0); close(pf1[OTPIPE]); } if (treeflgs & FPOU) { sh_rename(pf2[OTPIPE], 1); close(pf2[INPIPE]); } /* default std input for & */ if (treeflgs & FINT && ioset == 0) sh_rename(chkopen(devnull), 0); /* io redirection */ initio(t->treio); if (type != TCOM) execute(((FORKPTR) t)->forktre, 1, NULL, NULL); else if (com[0] != ENDARGS) { setlist(((COMPTR) t)->comset, N_EXPORT); execa((const char **)com); } done(); } case TPAR: sh_rename(dup(2), output); execute(((PARPTR) t)->partre, execflg, NULL, NULL); done(); case TFIL: { int pv[2]; chkpipe(pv); if (execute(((LSTPTR) t)->lstlef, 0, pf1, pv) == 0) execute(((LSTPTR) t)->lstrit, execflg, pv, pf2); else closepipe(pv); break; } case TLST: execute(((LSTPTR) t)->lstlef, 0, NULL, NULL); execute(((LSTPTR) t)->lstrit, execflg, NULL, NULL); break; case TAND: if (execute(((LSTPTR) t)->lstlef, 0, NULL, NULL) == 0) execute(((LSTPTR) t)->lstrit, execflg, NULL, NULL); break; case TORF: if (execute(((LSTPTR) t)->lstlef, 0, NULL, NULL) != 0) execute(((LSTPTR) t)->lstrit, execflg, NULL, NULL); break; case TFOR: { NAMPTR n = lookup(((FORPTR) t)->fornam); char **args; DOLPTR argsav = 0; if (((FORPTR) t)->forlst == 0) { args = (char **)dolv + 1; argsav = useargs(); } else { ARGPTR schain = gchain; gchain = 0; trim((args = scan(getarg(((FORPTR) t)->forlst)))[0]); gchain = schain; } loopcnt++; while (*args != ENDARGS && execbrk == 0) { assign(n, *args++); execute(((FORPTR) t)->fortre, 0, NULL, NULL); if (execbrk < 0) { execbrk = 0; } } if (breakcnt) breakcnt--; execbrk = breakcnt; loopcnt--; argfor = freeargs(argsav); break; } case TWH: case TUN: { int i = 0; loopcnt++; while (execbrk == 0 && (execute(((WHPTR) t)->whtre, 0, NULL, NULL) == 0) == (type == TWH)) { i = execute(((WHPTR) t)->dotre, 0, NULL, NULL); if (execbrk < 0) execbrk = 0; } if (breakcnt) breakcnt--; execbrk = breakcnt; loopcnt--; exitval = i; break; } case TIF: if (execute(((IFPTR) t)->iftre, 0, NULL, NULL) == 0) execute(((IFPTR) t)->thtre, execflg, NULL, NULL); else execute(((IFPTR) t)->eltre, execflg, NULL, NULL); break; case TSW: { register char *r = mactrim(((SWPTR) t)->swarg); t = (TREPTR) ((SWPTR) t)->swlst; while (t) { ARGPTR rex = ((REGPTR) t)->regptr; while (rex) { register char *s; if (gmatch(r, s = macro(rex->argval)) || (trim(s), eq(r, s))) { execute(((REGPTR)t)->regcom, 0, NULL, NULL); t = 0; break; } else rex = ((ARGPTR)rex)->argnxt; } if (t) t = (TREPTR) ((REGPTR) t)->regnxt; } } break; } exitset(); }
void DreamGenContext::checkcoords(const RectWithCallback *rectWithCallbacks) { if (data.byte(kNewlocation) != 0xff) return; const RectWithCallback *rectWithCallback = rectWithCallbacks; while (rectWithCallback->xMin() != 0xffff) { if (rectWithCallback->contains(data.word(kMousex), data.word(kMousey))) { uint16 callback = rectWithCallback->callback(); // common if(callback == addr_blank) blank(); else if(callback == addr_getbackfromob) getbackfromob(); else if(callback == addr_incryanpage) incryanpage(); else if(callback == addr_getback1) getback1(); else if(callback == addr_quitkey) quitkey(); else if(callback == addr_dosreturn) dosreturn(); else if(callback == addr_getbacktoops) getbacktoops(); else if(callback == addr_selectslot) selectslot(); // examlist else if(callback == addr_useobject) useobject(); else if(callback == addr_selectopenob) selectopenob(); else if(callback == addr_setpickup) setpickup(); else if(callback == addr_examinventory) examinventory(); // invlist1 else if(callback == addr_dropobject) dropobject(); else if(callback == addr_useopened) useopened(); else if(callback == addr_setpickup) setpickup(); else if(callback == addr_intoinv) intoinv(); // withlist1 else if(callback == addr_selectob) selectob(); // talklist else if(callback == addr_moretalk) moretalk(); // quitlist // destlist else if(callback == addr_nextdest) nextdest(); else if(callback == addr_lastdest) lastdest(); else if(callback == addr_lookatplace) lookatplace(); else if(callback == addr_destselect) destselect(); // keypadlist else if(callback == addr_buttonone) buttonone(); else if(callback == addr_buttontwo) buttontwo(); else if(callback == addr_buttonthree) buttonthree(); else if(callback == addr_buttonfour) buttonfour(); else if(callback == addr_buttonfive) buttonfive(); else if(callback == addr_buttonsix) buttonsix(); else if(callback == addr_buttonseven) buttonseven(); else if(callback == addr_buttoneight) buttoneight(); else if(callback == addr_buttonnine) buttonnine(); else if(callback == addr_buttonnought) buttonnought(); else if(callback == addr_buttonenter) buttonenter(); // menulist // folderlist else if(callback == addr_nextfolder) nextfolder(); else if(callback == addr_lastfolder) lastfolder(); // symbollist else if(callback == addr_quitsymbol) quitsymbol(); else if(callback == addr_settopleft) settopleft(); else if(callback == addr_settopright) settopright(); else if(callback == addr_setbotleft) setbotleft(); else if(callback == addr_setbotright) setbotright(); // diarylist else if(callback == addr_diarykeyn) diarykeyn(); else if(callback == addr_diarykeyp) diarykeyp(); else if(callback == addr_quitkey) quitkey(); // opslist else if(callback == addr_getbackfromops) getbackfromops(); else if(callback == addr_discops) discops(); // discopslist else if(callback == addr_loadgame) loadgame(); else if(callback == addr_savegame) savegame(); // mainlist, mainlist2 else if(callback == addr_look) look(); else if(callback == addr_inventory) inventory(); else if(callback == addr_zoomonoff) zoomonoff(); else if(callback == addr_saveload) saveload(); else if(callback == addr_madmanrun) madmanrun(); else if(callback == addr_identifyob) identifyob(); // decidelist else if(callback == addr_newgame) newgame(); else if(callback == addr_loadold) loadold(); // loadlist else if(callback == addr_actualload) actualload(); // savelist else if(callback == addr_actualsave) actualsave(); else { debug("__dispatch_call remaining in checkcoords! %d", (int)callback); __dispatch_call(callback); } return; } ++rectWithCallback; } }
void show_sell(int abortable) { #if 0 void *ss=make_find_symbol("sell_screens"); if (!DEFINEDP(symbol_value(ss))) { int sp=current_space; current_space=PERM_SPACE; // char *prog="((\"art/help.spe\" . \"sell2\")(\"art/help.spe\" . \"sell4\")(\"art/help.spe\" . \"sell3\")(\"art/endgame.spe\" . \"credit\"))"; char *prog="((\"art/endgame.spe\" . \"credit\") (\"art/help.spe\" . \"sell6\"))"; set_symbol_value(ss,compile(prog)); current_space=sp; } if (DEFINEDP(symbol_value(ss))) { image blank(2,2); blank.clear(); eh->set_mouse_shape(blank.copy(),0,0); // don't show mouse ss=symbol_value(ss); int quit=0; while (ss && !quit) { int im=cash.reg_object("art/help.spe",CAR(ss),SPEC_IMAGE,1); fade_in(cash.img(im),16); event ev; do { eh->flush_screen(); eh->get_event(ev); } while (ev.type!=EV_KEY); if (ev.key==JK_ESC && abortable) quit=1; fade_out(16); ss=CDR(ss); } eh->set_mouse_shape(cash.img(c_normal)->copy(),1,1); } #else image blank(2,2); blank.clear(); eh->set_mouse_shape(blank.copy(),0,0); // don't show mouse screen->clear(); image *im; event ev; int i; im=cash.img(cash.reg("art/endgame.spe","credit",SPEC_IMAGE,1)); char *str=lstring_value(eval(make_find_symbol("thanks_text"))); int dx=(xres+1)/2-im->width()/2,dy=(yres+1)/2-im->height()/2; im->put_image(screen,dx,dy); fade_in(0,16); uchar cmap[32]; for (i=0;i<32;i++) cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32); i = 0; int tx = 300, ty = 350, twx = 319, twy = 119; while (eh->event_waiting()) eh->get_event(ev); ev.type = EV_SPURIOUS; time_marker start; int txti = 0; do { im->put_part(screen,dx+tx,dy+ty,tx,ty,tx+twx,ty+twy); txti++; text_draw(twy+5-txti,dx+tx+15,dy+ty,dx+tx+twx-15,dy+ty+twy,str,eh->font(),cmap,eh->bright_color()); eh->flush_screen(); time_marker now; while (now.diff_time(&start)<0.10) now.get_time(); start.get_time(); while (eh->event_waiting() && ev.type!=EV_KEY) eh->get_event(ev); } while (txti<600 && ev.type!=EV_KEY && ev.type!=EV_MOUSE_BUTTON); fade_out(16); if (!abortable || !(ev.type==EV_KEY && ev.key==JK_ESC)) { im=cash.img(cash.reg("art/help.spe","sell6",SPEC_IMAGE,1)); fade_in(im,16); do { eh->flush_screen(); eh->get_event(ev); } while (ev.type!=EV_KEY && ev.type!=EV_MOUSE_BUTTON); fade_out(16); } eh->set_mouse_shape(cash.img(c_normal)->copy(),1,1); #endif }
int main(int argc, char* argv[]) { initscr(); scrollok(stdscr, TRUE); wprintw(stdscr, "Welcome to Scripted ver. %d.%d for the Brave Quest engine.\nCopyright 2012 Mad Science Inc.\nPlease do not redistrubute.\n",scriptedvernum,scriptedvernum2); stufffilename(); if(loadscript(filename) == 1) { wprintw(stdscr, "File not Found. Would you like to make a new file?\n"); if(bie() == 'y') { cleanfilebuff(); if(savescript(filename) == 1) { wprintw(stdscr, "Your disk sucks.\n"); bi(); return 1; } } else { wprintw(stdscr, "Goodbye.\n"); endwin(); return 1; } } currlinenum = linenum; menu(); wprintw(stdscr, "Press escape to go to the save menu\n"); for(;;) { wprintw(stdscr, "q= give, w= take, e= say, r= flag, t= move, y= battle, u= check flag, i= check item, o= party add, p= party remove, [ = check character\n"); wprintw(stdscr, "a= warp, s= check experience, d= give experience, f= make experience, g= exec script, h= screen effect, j= user input, k= goline, l= make health\n"); wprintw(stdscr, "m= blank, ,= show line, .= change line.\n"); input[0] = bie(); if(input[0] == 27) menu(); if(input[0] == 'q') give(); if(input[0] == 'w') take(); if(input[0] == 'e') say(); if(input[0] == 'r') flag(); if(input[0] == 't') move(); if(input[0] == 'y') battle(); if(input[0] == 'u') checkflag(); if(input[0] == 'i') checkitem(); if(input[0] == 'o') partyadd(); if(input[0] == 'p') partyrm(); if(input[0] == '[') checkparty(); if(input[0] == 'a') warp(); if(input[0] == 's') checkexp(); if(input[0] == 'd') giveexp(); if(input[0] == 'f') makeexp(); if(input[0] == 'g') execscript(); if(input[0] == 'h') screeneffect(); if(input[0] == 'j') userinput(); if(input[0] == 'k') goline(); if(input[0] == 'l') makehealth(); if(input[0] == 'm') blank(); if(input[0] == ',') showline(); if(input[0] == '.') changeline(); if(currlinenum > linenum) linenum = currlinenum; } return 0; };
int bfm_bd1_t::write_char(int data) { int change = 0; if ( m_user_def ) { m_user_def--; m_user_data <<= 8; m_user_data |= data; if ( m_user_def ) { return 0; } setdata( m_user_data, data); change ++; } else { if(data < 0x80)//characters { if (data > 0x3F) { // logerror("Undefined character %x \n", data); } setdata(BD1charset[(data & 0x3F)], data); } else { switch ( data & 0xF0 ) { case 0x80: // 0x80 - 0x8F Set display blanking { blank(data&0x03);//use the blanking data } break; case 0x90: // 0x90 - 0x9F Set cursor pos m_cursor_pos = data & 0x0F; m_scroll_active = 0; if ( m_display_mode == 2 ) { if ( m_cursor_pos >= m_window_end) m_scroll_active = 1; } break; case 0xA0: // 0xA0 - 0xAF Set display mode m_display_mode = data &0x03; break; case 0xB0: // 0xB0 - 0xBF Clear display area switch ( data & 0x03 ) { case 0x00: // clr nothing break; case 0x01: // clr inside window if ( m_window_size > 0 ) { memset(m_chars+m_window_start,0,m_window_size); memset(m_attrs+m_window_start,0,m_window_size); } break; case 0x02: // clr outside window if ( m_window_size > 0 ) { if ( m_window_start > 0 ) { for (int i = 0; i < m_window_start; i++) { memset(m_chars+i,0,i); memset(m_attrs+i,0,i); } } if (m_window_end < 15 ) { for (int i = m_window_end; i < 15- m_window_end ; i++) { memset(m_chars+i,0,i); memset(m_attrs+i,0,i); } } } case 0x03: // clr entire display { memset(m_chars, 0, sizeof(m_chars)); memset(m_attrs, 0, sizeof(m_attrs)); } } break; case 0xC0: // 0xC0 - 0xCF Set flash rate m_flash_rate = data & 0x0F; break; case 0xD0: // 0xD0 - 0xDF Set Flash control m_flash_control = data & 0x03; break; case 0xE0: // 0xE0 - 0xEF Set window start pos m_window_start = data &0x0F; m_window_size = (m_window_end - m_window_start)+1; break; case 0xF0: // 0xF0 - 0xFF Set window end pos m_window_end = data &0x0F; m_window_size = (m_window_end - m_window_start)+1; m_scroll_active = 0; if ( m_display_mode == 2 ) { if ( m_cursor_pos >= m_window_end) { m_scroll_active = 1; m_cursor_pos = m_window_end; } } break; } } } update_display(); return 0; }
void DreamWebEngine::getBackFromOb() { if (_pickUp != 1) getBack1(); else blank(); }
void TSoundTrack::blank(double t0, double t1) { blank(secondsToSamples(t0), secondsToSamples(t1)); }
int main(void) { DDRB |= _BV(DDB5); // debug LED // PIR Sensor input // make sure C0 is set to input and it's pullup is on DDRC &= ~_BV(DDC0); PORTC |= _BV(PORTC0); // HT1632 data bus DDRB |= _BV(DDB0); DDRB |= _BV(DDB1); DDRB |= _BV(DDB2); // HT1632 Chip Selects DDRD |= _BV(DDD3); //cs1 DDRD |= _BV(DDD5); //cs2 DDRD |= _BV(DDD6); //cs3 DDRD |= _BV(DDD7); //cs4 // Pull all the Chip Selects on the HT1632s high PORTD |= _BV(PORTD3) | _BV(PORTD5) | _BV(PORTD6) | _BV(PORTD7); // LPD8806 data bus DDRC |= _BV(DDC4); DDRC |= _BV(DDC5); // Setup each of the HT1632 displays CS1_LOW; init(); CS1_HIGH; CS2_LOW; init(); CS2_HIGH; CS3_LOW; init(); CS3_HIGH; CS4_LOW; init(); CS4_HIGH; CS1_LOW; blank(); CS1_HIGH; CS2_LOW; blank(); CS2_HIGH; CS3_LOW; blank(); CS3_HIGH; CS4_LOW; blank(); CS4_HIGH; // Set up the timer to tick every second cli(); TCCR1A = 0; TCCR1B = 0; // set compare match register to desired timer count: OCR1A = 156; TCCR1B |= (1 << WGM12); TCCR1B |= (1 << CS10) | (1 << CS12); // 1024 perscaler TIMSK1 |= (1 << OCIE1A); sei(); // Setup the data for the LPD8806 based string of LEDs. uint8_t buffer[32*3]; uint16_t i; for(i=0;i<32*3;i++) { buffer[i] = 0; } LPD8806_write(buffer,32*3); while(1) { for(i = 0; i < 32; ++i ) { HSVtoRGB( (int)((360/32)*i+j) % 360, 255, 255, buffer+1+i*3, buffer+0+i*3, buffer+2+i*3 ); } LPD8806_write(buffer,32*3); uint16_t leds = lrint(163.292 * log(22*OCCUPY/3600+1)); uint16_t row; for( row = 0; row < 128; row ++ ) { switch( row ){ case 0: CS4_HIGH; CS1_LOW; set_mode(write_mode); send_address(0); break; case 32: CS1_HIGH; CS2_LOW; set_mode(write_mode); send_address(0); break; case 64: CS2_HIGH; CS3_LOW; set_mode(write_mode); send_address(0); break; case 96: CS3_HIGH; CS4_LOW; set_mode(write_mode); send_address(0); break; } if( (row+1) * 8 <= leds ) { send_data(0xFF); send_data(0xFF); } else if( row * 8 > leds ) { send_data(0x0); send_data(0x0); } else { uint8_t temp = _BV(7); uint8_t lights_left = leds % 8; while( lights_left > 0 ) { --lights_left; temp >>= 1; temp |= 128; } send_data( temp ); swap(temp); send_data( temp ); } } CS4_HIGH; } return 0; }
// // Constructor EasDAQpack :: EasDAQpack() { // // Constructor blank(); }
void write_fini(void) { print_n_flush(gettext("Finalizing (Can take several minutes)...")); /* Some drives don't like this while in test write mode */ if (!simulation) { if (!finalize(target)) { /* * It is possible that the drive is busy writing the * buffered portion. So do not get upset yet. */ (void) sleep(10); if (!finalize(target)) { if (debug) { (void) printf("status %x, %x/%x/%x\n", uscsi_status, SENSE_KEY(rqbuf), ASC(rqbuf), ASCQ(rqbuf)); } /* * Different vendor drives return different * sense error info for CLOSE SESSION command. * The Panasonic drive that we are using is * one such drive. */ if (device_type == DVD_MINUS) { if (verbose) { (void) printf( "skipping finalizing\n"); } } else { /* l10n_NOTE : 'failed' as in finishing up...failed */ (void) printf(gettext("failed.\n")); err_msg(gettext( "Could not finalize the disc.\n")); exit(1); } } } if (vol_running) { (void) eject_media(target); } } else if (check_device(target, CHECK_MEDIA_IS_NOT_BLANK)) { /* * Some drives such as the pioneer A04 will retain a * ghost TOC after a simulation write is done. The * media will actually be blank, but the drive will * report a TOC. There is currently no other way to * re-initialize the media other than ejecting or * to ask the drive to clear the leadout. The laser * is currently off so nothing is written to the * media (on a good behaving drive). * NOTE that a device reset does not work to make * the drive re-initialize the media. */ blanking_type = "clear_ghost"; blank(); } /* l10n_NOTE : 'done' as in "Finishing up...done" */ (void) printf(gettext("done.\n")); }
OVesaBlank& OVesaBlank::sleep() { return(blank(OVesaBlank::suspend)); }
int blank_secondary_buf(void) { return blank(secondary_buf); }
inline void read(char &c){ for (c=nc();blank(c);c=nc()); if (IOerror){c=-1;return;} }