static sais_index_type LMSpostproc1(const void *T, sais_index_type *SA, sais_index_type n, sais_index_type m, int cs) { sais_index_type i, j, p, q, plen, qlen, name; sais_index_type c0, c1; sais_bool_type diff; /* compact all the sorted substrings into the first m items of SA 2*m must be not larger than n (proveable) */ assert(0 < n); for(i = 0; (p = SA[i]) < 0; ++i) { SA[i] = ~p; assert((i + 1) < n); } if(i < m) { for(j = i, ++i;; ++i) { assert(i < n); if((p = SA[i]) < 0) { SA[j++] = ~p; SA[i] = 0; if(j == m) { break; } } } } /* store the length of all substrings */ i = n - 1; j = n - 1; c0 = chr(n - 1); do { c1 = c0; } while((0 <= --i) && ((c0 = chr(i)) >= c1)); for(; 0 <= i;) { do { c1 = c0; } while((0 <= --i) && ((c0 = chr(i)) <= c1)); if(0 <= i) { SA[m + ((i + 1) >> 1)] = j - i; j = i + 1; do { c1 = c0; } while((0 <= --i) && ((c0 = chr(i)) >= c1)); } }
render_textureCube::render_textureCube(device* _dev, uint size, pixel_format f, pixel_format df) : _vp(vec2(size)), textureCube(_dev, CD3D11_TEXTURE2D_DESC((DXGI_FORMAT)f, size, size, 6, 1, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE)) { //create shared dsv CD3D11_TEXTURE2D_DESC dd( (DXGI_FORMAT)detail::get_texture_format_for_depth(df)/*DXGI_FORMAT_R24G8_TYPELESS*/, size, size); dd.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE; ComPtr<ID3D11Texture2D> dst; chr(_dev->ddevice()->CreateTexture2D(&dd, nullptr, &dst)); CD3D11_DEPTH_STENCIL_VIEW_DESC dsvd(dst.Get(), D3D11_DSV_DIMENSION_TEXTURE2D, (DXGI_FORMAT)df); chr(_dev->ddevice()->CreateDepthStencilView(dst.Get(), &dsvd, dsv.GetAddressOf())); //create each face's resources CD3D11_RENDER_TARGET_VIEW_DESC rtvd(D3D11_RTV_DIMENSION_TEXTURE2DARRAY, (DXGI_FORMAT)f); rtvd.Texture2DArray.ArraySize = 1; rtvd.Texture2DArray.MipSlice = 0; for (int i = 0; i < 6; ++i) { rtx[i] = nullptr; rtvd.Texture2DArray.FirstArraySlice = i; chr(_dev->ddevice()->CreateRenderTargetView(texd.Get(), &rtvd, &rtv[i])); } }
string CharMap_CellToChar(float c) { if(c == 13) return chr(127); else if(c < 32) return chr(c); else return chr(c + 96); }
unsigned int nameSubstr(unsigned int *SA, const unsigned char *s, unsigned int *s1, unsigned int n, unsigned int m, unsigned int n1, int level) { unsigned int i, j, cur_t, succ_t; // init the name array buffer for(i=n1; i<n; i++) SA[i]=EMP; // scan to compute the interim s1 unsigned int name, name_ctr=0; unsigned int pre_pos, pre_len=0; for(i=0; i<n1; i++) { bool diff=false; unsigned int len, pos=SA[i]; len=getLengthOfLMS(s, n, level, pos); if(len!=pre_len) diff=true; else for(unsigned int d=0; d<len; d++) if(pos+d==n-1 || pre_pos+d==n-1 || chr(pos+d)!=chr(pre_pos+d)) { diff=true; break; } if(diff) { name=i; name_ctr++; SA[name]=1; // a new name. pre_pos=pos; pre_len=len; } else SA[name]++; // count this name. SA[n1+pos/2]=name; } // compact the interim s1 sparsely stored // in SA[n1, n-1] into SA[m-n1, m-1]. for(i=n-1, j=m-1; i>=n1; i--) if(SA[i]!=EMP) SA[j--]=SA[i]; // rename each S-type character of the // interim s1 as the end of its bucket // to produce the final s1. succ_t=1; for(i=n1-1; i>0; i--) { int ch=s1[i], ch1=s1[i-1]; cur_t=(ch1< ch || (ch1==ch && succ_t==1))?1:0; if(cur_t==1) { s1[i-1]+=SA[s1[i-1]]-1; } succ_t=cur_t; } return name_ctr; }
shader::shader(ComPtr<ID3D11Device> device, datablob<byte>* vs_shaderData, datablob<byte>* ps_shaderData, const D3D11_INPUT_ELEMENT_DESC inputLayoutA[], int inputLayoutLength) { if (vs_shaderData != nullptr) chr(device->CreateVertexShader(vs_shaderData->data, vs_shaderData->length, nullptr, &vertexShader)); else vertexShader = nullptr; chr(device->CreateInputLayout(inputLayoutA, inputLayoutLength, vs_shaderData->data, vs_shaderData->length, &inputLayout)); if (ps_shaderData != nullptr) chr(device->CreatePixelShader(ps_shaderData->data, ps_shaderData->length, nullptr, &pixelShader)); else pixelShader = nullptr; }
static bool number(struct scanner *s, int64_t *out, int *out_tok) { bool is_float = false, is_hex = false; const char *start = s->s + s->pos; char *end; if (lit(s, "0x")) { while (is_xdigit(peek(s))) next(s); is_hex = true; } else { while (is_digit(peek(s))) next(s); is_float = chr(s, '.'); while (is_digit(peek(s))) next(s); } if (s->s + s->pos == start) return false; errno = 0; if (is_hex) *out = strtoul(start, &end, 16); else if (is_float) *out = strtod(start, &end); else *out = strtoul(start, &end, 10); if (errno != 0 || s->s + s->pos != end) *out_tok = ERROR_TOK; else *out_tok = (is_float ? FLOAT : INTEGER); return true; }
blargg_err_t Nes_Cart::load_ines( Auto_File_Reader in ) { RETURN_ERR( in.open() ); ines_header_t h; RETURN_ERR( in->read( &h, sizeof h ) ); if ( 0 != memcmp( h.signature, "NES\x1A", 4 ) ) return not_ines_file; if ( h.zero [7] ) // handle header defaced by a f*****g idiot's handle h.flags2 = 0; set_mapper( h.flags, h.flags2 ); if ( h.flags & 0x04 ) // skip trainer RETURN_ERR( in->skip( 512 ) ); RETURN_ERR( resize_prg( h.prg_count * 16 * 1024L ) ); RETURN_ERR( resize_chr( h.chr_count * 8 * 1024L ) ); RETURN_ERR( in->read( prg(), prg_size() ) ); RETURN_ERR( in->read( chr(), chr_size() ) ); return 0; }
// ----------------------------------------------------------------------------- // CNSPTestConsoleApp::GetStringFromConsole // ----------------------------------------------------------------------------- // TKeyCode CNSPTestConsoleApp::GetStringFromConsoleL( TDes& aBuffer ) { TKeyCode input = EKeyNull; const TInt startPos = iConsole->WhereX(); iConsole->Write( aBuffer ); do { input = iConsole->Getch(); if ( ( EKeyBackspace == input || EKeyDelete == input ) && startPos < iConsole->WhereX() ) // Backspace & Delete { iConsole->SetPos( iConsole->WhereX() - 1 ); iConsole->ClearToEndOfLine(); aBuffer.SetLength( 0 < aBuffer.Length() ? aBuffer.Length() - 1 : aBuffer.Length() ); } else{ TChar chr( input ); if ( chr.IsPrint() ) { aBuffer.Append( chr ); iConsole->Printf( _L("%c"), input ); } } } while ( EKeyEnter != input && EKeyEscape != input ); return input; }
sys_shlfunc() #define sys_shl sys_shlfunc() {register int st,i,v ; st=cre(1); fprintf ( bstdout, "Shell (0 to quit): "); read_str(st); while( len_str(st)==0 ){ fprintf ( bstdout, "\n"); fprintf ( bstdout, "Shell (0 to quit): "); read_str(st); } while( fst_str(st)!=ord('0') ){ itr_str(st,i,v,cstr_shl[i-1]=chr(v)); cstr_shl[len_str(st)]='\0'; fprintf ( bstdout, "\n"); system(cstr_shl); fprintf ( bstdout, "\n"); fprintf ( bstdout, "Shell (0 to quit): "); read_str(st); while( len_str(st)==0 ){ fprintf ( bstdout, "\n"); fprintf ( bstdout, "Shell (0 to quit): "); read_str(st); } } }
TEST_F(NodeTest, testPrioritySelector) { ai::PrioritySelector::Factory f; ai::TreeNodeFactoryContext ctx("testpriorityselector", "", ai::True::get()); ai::TreeNodePtr node = f.create(&ctx); ai::Idle::Factory idleFac; ai::TreeNodeFactoryContext idleCtx1("testidle", "2", ai::True::get()); ai::TreeNodePtr idle1 = idleFac.create(&idleCtx1); ai::TreeNodeFactoryContext idleCtx2("testidle2", "2", ai::True::get()); ai::TreeNodePtr idle2 = idleFac.create(&idleCtx2); node->addChild(idle1); node->addChild(idle2); ai::AIPtr e(new ai::AI(node)); ai::ICharacterPtr chr(new ai::ICharacter(1)); e->setCharacter(chr); e->update(1, true); e->getBehaviour()->execute(e, 1); ASSERT_EQ(ai::RUNNING, idle1->getLastStatus(e)); ASSERT_EQ(ai::UNKNOWN, idle2->getLastStatus(e)); e->update(1, true); e->getBehaviour()->execute(e, 1); ASSERT_EQ(ai::RUNNING, idle1->getLastStatus(e)); ASSERT_EQ(ai::UNKNOWN, idle2->getLastStatus(e)); e->update(1, true); e->getBehaviour()->execute(e, 1); ASSERT_EQ(ai::FINISHED, idle1->getLastStatus(e)); ASSERT_EQ(ai::UNKNOWN, idle2->getLastStatus(e)); }
depth_render_texture2d::depth_render_texture2d(device* _dev, uvec2 size, pixel_format df) : texture2d(_dev, CD3D11_TEXTURE2D_DESC((DXGI_FORMAT)detail::get_texture_format_for_depth(df)/*DXGI_FORMAT_R24G8_TYPELESS*/, size.x, size.y, 1, 1, D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE)), _vp(size) { CD3D11_DEPTH_STENCIL_VIEW_DESC dsvd(texd.Get(), D3D11_DSV_DIMENSION_TEXTURE2D, (DXGI_FORMAT)df /*DXGI_FORMAT_D24_UNORM_S8_UINT*/); chr(_dev->ddevice()->CreateDepthStencilView(texd.Get(), &dsvd, dsv.GetAddressOf())); }
SEXP list_as_chr(SEXP x) { int n = Rf_length(x); CharacterVector chr(n); for (int i = 0; i != n; ++i) { SEXP elt = VECTOR_ELT(x, i); switch (TYPEOF(elt)) { case STRSXP: if (Rf_length(chr) == 1) { chr[i] = elt; continue; } break; case SYMSXP: chr[i] = PRINTNAME(elt); continue; default: break; } stop("corrupt grouped data frame"); } return chr; }
/* find the start or end of each bucket */ static void getCounts(const void *T, sais_index_type *C, sais_index_type n, sais_index_type k, int cs) { sais_index_type i; for(i = 0; i < k; ++i) { C[i] = 0; } for(i = 0; i < n; ++i) { ++C[chr(i)]; } }
static fs_node_t* create(char* filename, unsigned int type) { fs_node_t* curdir = 0; if(filename[0] == '/') { curdir = fs_root; filename++; if(filename[0] == 0) return 0; } else curdir = current_task->cwd; char* s = str_dup(filename); int ret = 0; while(s) { if(chr(s, '/')) { char* p = chr(s, '/'); *p = 0; p++; if(strcmp(s, ".") == 0) curdir = curdir; else if(strcmp(s, "..") == 0) curdir = curdir->parent == 0 ? curdir : curdir->parent; else { fs_node_t* search = fs_finddir(curdir, s); if(!search) { ret = 0; break; } curdir = search; } s = p; }else { ret = fs_creat(curdir, s, type); break; } } kfree(s); return ret; }
/*** start: sais.C-alphabet.c */ static void getCounts(const void *T, int *C, int n, int k, int cs) { int i; for(i = 0; i < k; ++i) { C[i] = 0; } for(i = 0; i < n; ++i) { ++C[chr(i)]; } /* C: number of occurrences of each symbol */ }
void p_schleifen(void) { print_at(2,12); printf("1. DEMO: Schleifen\n"); print_at(1,14); printf(" FOR - NEXT\n"); for(i_long=2;i_long<=79;i_long++) { print_at(i_long,15); printf("%c\n",*chr(41+i_long)); } print_at(1,17); printf(" REPEAT - UNTIL\n"); i_long=2; do { print_at(i_long,18); printf("%c\n",*chr(123-i_long)); ++i_long; } while(!(i_long==80)); print_at(1,20); printf(" WHILE - WEND\n"); i_long=2; while(i_long <= 79) { print_at(i_long,21); printf("%c\n",*chr(64+(fmod((i_long-1) ,26)))); ++i_long; } print_at(1,23); printf(" DO - LOOP\n"); i_long=2; do { print_at(i_long,24); printf("%c",*chr(96+(fmod((i_long-1) ,26)))); ++i_long; if(i_long==80) goto M1; } while(1); M1: p_s_top(); printf("\33E"); }
inline char recv(char *serport) { char c; while( !chr(serport) ) sync(); c = GetPhysByte((paddr_t)serport+RCV); sync(); return c; }
TEST_F(NodeTest, testIdle) { ai::Idle::Factory f; ai::TreeNodeFactoryContext ctx("testidle", "1000", ai::True::get()); ai::TreeNodePtr node = f.create(&ctx); ai::AIPtr entity(new ai::AI(node)); ai::ICharacterPtr chr(new ai::ICharacter(1)); entity->setCharacter(chr); ASSERT_EQ(ai::RUNNING, node->execute(entity, 1)); ASSERT_EQ(ai::FINISHED, node->execute(entity, 1000)); }
void p_s_top(void) { s_long=2; z_long=0; do { if(even(s_long)) { print_at(s_long-1,72); printf(" %s ",z_char); } else { print_at(s_long,72); printf("%cp%s%cq",*chr(27),z_char,*chr(27)); } pause( 10); if(gemdos(11) != 0) { z_long=gemdos(1); } if(z_long==0) { ++s_long; z_long=d_iv(s_long,65); } else if(z_long==1) { --s_long; if(s_long==2) { z_long=0; } } pause( 10); if(bios(1,2) != 0) { z_long=inp(2); } } while(!(z_long>1)); }
void p_intro(void) { print_at(1,2); printf("\n"); printf(" %cp<<< ES IST SOWEIT !!! %c B_NACH_C %c IST DA !!! >>>%cq\n",*chr(27),*chr(42),*chr(42),*chr(27)); print_at(8,5); printf("%cp<<< DAS TRANSFORMATIONSPROGRAMM 'GFA-BASIC-KONVERTER-NACH-C' >>>%cq\n",*chr(27),*chr(27)); print_at(1,8); printf("\n"); printf(" Mit Hilfe dieses Programms k�nnen folgende Aufgaben optimal gel�st werden :\n"); printf("\n"); printf(" 1. Entwicklung eines Programms im kompfortablen GFA-BASIC,\n"); printf(" 2. Austesten des Programms in einem Interpreter (Turn-Around-Zeit !),\n"); printf(" 3. Programmtransformation in die weltweit verbreitete Computersprache 'C',\n"); printf(" 4. Portierung auf unterschiedlichste Rechner und Betriebssysteme,\n"); printf(" 5. Programmierung auf einem ATARI und Anwendung auf einer UNIX-Workstation,\n"); printf(" 6. M�gliche Steigerung der Geschwindigkeiten durch deren C-Compiler.\n"); print_at(3,20); printf("�-1989: O. VINZENT und PROF. DR. H.-J. PATT, Universit�t des Saarlandes,\n"); print_at(11,21); printf("Fachbereich Physik, Geb.8, D-6600 Saarbr�cken, Tel. 0681/302-3773\n"); print_at(11,22); printf("GFA-Systemtechnik GmbH, Heerdter Sandberg 30, D-4000 D�sseldorf 11\n"); p_s_top(); printf("\33E"); msprintf(a_char," DEMO-PROGRAMM F�R 'B_NACH_C.PRG' "); msprintf(b_char,"B_NACH_C WANDELT GFA-BASIC IM ASCII-FORMAT IN EINEN C-QUELLTEXT"); msprintf(c_char,"Ein GFA-BASIC-Listing wird nach 'C' gewandelt und ist "); msprintf(d_char,"sofort compilierbar !"); msprintf(e_char,"%s%s",c_char,d_char); msprintf(f_char,"%s",right(a_char,16)); print_at(24,2); printf("%cp%s%cq\n",*chr(27),a_char,*chr(27)); print_at(9,4); printf("%s\n",b_char); print_at(3,6); printf("%s\n",e_char); print_at(33,8); printf("%cp%s%cq\n",*chr(27),f_char,*chr(27)); print_at(26,10); printf("transformiert GFA-BASIC nach C\n"); }
/* sort all type LMS suffixes */ static void LMSsort1(const void *T, sais_index_type *SA, sais_index_type *C, sais_index_type *B, sais_index_type n, sais_index_type k, int cs) { sais_index_type bb, i, j; sais_index_type c0, c1; /* compute SAl */ if(C == B) { getCounts(T, C, n, k, cs); } getBuckets(C, B, k, 0); /* find starts of buckets */ j = n - 1; bb = B[c1 = chr(j)]; --j; SA[bb++] = (chr(j) < c1) ? ~j : j; for(i = 0; i < n; ++i) { if(0 < (j = SA[i])) { assert(chr(j) >= chr(j + 1)); if((c0 = chr(j)) != c1) { B[c1] = bb; bb = B[c1 = c0]; } assert(i < bb); --j; SA[bb] = (chr(j) < c1) ? ~j : j; ++bb; SA[i] = 0; } else if(j < 0) { SA[i] = ~j; } } /* compute SAs */ if(C == B) { getCounts(T, C, n, k, cs); } getBuckets(C, B, k, 1); /* find ends of buckets */ for(i = n - 1, bb = B[c1 = 0]; 0 <= i; --i) { if(0 < (j = SA[i])) { assert(chr(j) <= chr(j + 1)); if((c0 = chr(j)) != c1) { B[c1] = bb; bb = B[c1 = c0]; } assert((bb) <= i); --j; SA[--bb] = (chr(j) > c1) ? ~(j + 1) : j; SA[i] = 0; } } }
void getSAlms(unsigned int *SA, unsigned char *s, unsigned int *s1, unsigned int n, unsigned int n1, int level ) { unsigned int i, j, cur_t, succ_t; j=n1-1; s1[j--]=n-1; succ_t=0; // s[n-2] must be L-type for(i=n-2; i>0; i--) { cur_t=(chr(i-1)<chr(i) || (chr(i-1)==chr(i) && succ_t==1))?1:0; if(cur_t==0 && succ_t==1) s1[j--]=i; succ_t=cur_t; } for(i=0; i<n1; i++) SA[i]=s1[SA[i]]; // init SA[n1..n-1] for(i=n1; i<n; i++) SA[i]=level?EMPTY:0; }
std::string tostring() { std::string rt; unsigned int ii=0; for (; ii<NofPrevChar; ++ii) { textwolf::UChar ch = chr( NofPrevChar-ii-1); if (ch) rt.push_back( ch<256?(char)(unsigned char)ch:'_'); } return rt; }
/* sort all type LMS suffixes */ static void LMSsort1(const void *T, int *SA, int *C, int *B, int n, int k, int cs) { int *b, i, j; int c0, c1; /* compute SAl */ if(C == B) { getCounts(T, C, n, k, cs); } getBuckets(C, B, k, 0); /* find starts of buckets */ j = n - 1; b = SA + B[c1 = chr(j)]; --j; *b++ = (chr(j) < c1) ? ~j : j; for(i = 0; i < n; ++i) { if(0 < (j = SA[i])) { assert(chr(j) >= chr(j + 1)); if((c0 = chr(j)) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; } assert(i < (b - SA)); --j; *b++ = (chr(j) < c1) ? ~j : j; SA[i] = 0; } else if(j < 0) { SA[i] = ~j; } } /* compute SAs */ if(C == B) { getCounts(T, C, n, k, cs); } getBuckets(C, B, k, 1); /* find ends of buckets */ for(i = n - 1, b = SA + B[c1 = 0]; 0 <= i; --i) { if(0 < (j = SA[i])) { assert(chr(j) <= chr(j + 1)); if((c0 = chr(j)) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; } assert((b - SA) <= i); --j; *--b = (chr(j) > c1) ? ~(j + 1) : j; SA[i] = 0; } } }
/* compute SA */ static void induceSA(const unsigned char *T, int *SA, int *C, int *B, int n, int k, int cs) { int *b, i, j; int c0, c1; /* compute SAl */ if (C == B) getCounts(T, C, n, k, cs); getBuckets(C, B, k, 0); /* find starts of buckets */ j = n - 1; b = SA + B[c1 = chr(j)]; *b++ = ((0 < j) && (chr(j - 1) < c1)) ? ~j : j; for (i = 0; i < n; ++i) { j = SA[i], SA[i] = ~j; if (0 < j) { --j; if ((c0 = chr(j)) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; } *b++ = ((0 < j) && (chr(j - 1) < c1)) ? ~j : j; } } /* compute SAs */ if (C == B) getCounts(T, C, n, k, cs); getBuckets(C, B, k, 1); /* find ends of buckets */ for (i = n - 1, b = SA + B[c1 = 0]; 0 <= i; --i) { if (0 < (j = SA[i])) { --j; if ((c0 = chr(j)) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; } *--b = ((j == 0) || (chr(j - 1) > c1)) ? ~j : j; } else SA[i] = ~j; } }
/* * itoa * * Convert an integer value to a string in the number system specified * by base and store the string representation of value in str. */ char *itoa(uint32_t value, char *str, int base) { int num_digits = 0; int tmp; if (value == 0) { str[0] = chr(0); return str; } for (tmp = value; tmp != 0; tmp /= base) { num_digits++; } tmp = value; for (int i = 0; i < num_digits; i++) { if (tmp % base < 10) { str[num_digits - i - 1] = chr(tmp % base); } else { str[num_digits - i - 1] = 'A' + (tmp % base) - 10; } tmp /= base; } return str; }
blargg_err_t Nes_Cart::apply_ips_to_chr( Auto_File_Reader patch ) { RETURN_ERR( patch.open() ); long size = chr_size(); byte* chr_copy = (byte*) malloc( size ); CHECK_ALLOC( chr_copy ); memcpy( chr_copy, chr(), size ); const char* err = apply_ips_patch( *patch, &chr_copy, &size ); if ( !err ) { resize_chr( size ); memcpy( chr(), chr_copy, size ); } free( chr_copy ); return err; }
int main() { int ret = 0; Operation op; { Task * task; OpVector res; if (0) { task->TickOperation(op, res); } } Entity ent1("1", 1), ent2("2", 2); Character chr("3", 3); { Fell fell(chr, ent1, ent2); fell.nextTick(1.5); Atlas::Message::Element val; fell.getAttr("foo", val); assert(val.isNone()); fell.setAttr("foo", 1); fell.getAttr("foo", val); assert(val.isInt()); assert(!fell.obsolete()); OpVector res; assert(res.empty()); Atlas::Objects::Operation::Generic c; fell.initTask(c, res); assert(!res.empty()); fell.TickOperation(op, res); fell.irrelevant(); assert(fell.obsolete()); } return ret; }
void LibRnrsUnicode::CharGeneralCategory::func(KevesVM* vm, const_KevesIterator pc) { KevesChar chr(vm->acc_); const char* cat[] { "XX", "Mn", "Mc", "Me", "Nd", "Nl", "No", "Zs", "Zp", "Zl", "Cc", "Cf", "Cs", "Co", "Cn", "Lu", "Ll", "Lt", "Lm", "Lo", "Pc", "Pd", "Ps", "Pe", "Pi", "Pf", "Po", "Sm", "Sc", "Sk", "So", }; QChar::Category cat_n(chr.category()); StringKevWithArray<0x4> cat_str(cat[cat_n]); SymbolKev cat_sym(cat_str); vm->acc_ = &cat_sym; return KevesVM::returnValueSafe(vm, pc); }
VOID uart_wrport(WORD port, BYTE data) { int reg = port - uart_io_base; int retval; lprintf(LOG_DEBUG,"write of port: %x (%s) <- %02X", port, uart_reg_desc[reg], data); switch(reg) { case UART_BASE: if(uart_lcr_reg&UART_LCR_DLAB) { uart_divisor_latch_lsb = data; lprintf(LOG_DEBUG,"set divisor latch low byte: %02X", data); } else { lprintf(LOG_DEBUG,"WRITE DATA: %s", chr(data)); if(!WriteFile(wrslot,&data,sizeof(BYTE),&retval,NULL)) { lprintf(LOG_ERR,"!VDD_WRITE: WriteFile Error %d (size=%d)" ,GetLastError(),retval); } else { assert_interrupt(UART_IER_TX_EMPTY); reset_yield(); } } break; case UART_IER: if(uart_lcr_reg&UART_LCR_DLAB) { uart_divisor_latch_msb = data; lprintf(LOG_DEBUG,"set divisor latch high byte: %02X", data); } else uart_ier_reg = data; assert_interrupt(UART_IER_TX_EMPTY); /* should this be re-asserted for all writes? */ break; case UART_IIR: /* FCR not supported */ break; case UART_LCR: uart_lcr_reg = data; break; case UART_MCR: uart_mcr_reg = data; if((uart_mcr_reg&UART_MCR_DTR) == 0) /* Dropping DTR (i.e. "hangup") */ hangup(); break; case UART_SCRATCH: uart_scratch_reg = data; break; default: lprintf(LOG_ERR,"UNSUPPORTED register: %u", reg); break; } }