/* PakArchive::write * Writes the pak archive to a MemChunk * Returns true if successful, false otherwise *******************************************************************/ bool PakArchive::write(MemChunk& mc, bool update) { // Clear current data mc.clear(); // Get archive tree as a list vector<ArchiveEntry*> entries; getEntryTreeAsList(entries); // Process entry list int32_t dir_offset = 12; int32_t dir_size = 0; for (unsigned a = 0; a < entries.size(); a++) { // Ignore folder entries if (entries[a]->getType() == EntryType::folderType()) continue; // Increment directory offset and size dir_offset += entries[a]->getSize(); dir_size += 64; } // Init data size mc.reSize(dir_offset + dir_size, false); // Write header char pack[4] = { 'P', 'A', 'C', 'K' }; mc.seek(0, SEEK_SET); mc.write(pack, 4); mc.write(&dir_offset, 4); mc.write(&dir_size, 4); // Write directory mc.seek(dir_offset, SEEK_SET); int32_t offset = 12; for (unsigned a = 0; a < entries.size(); a++) { // Skip folders if (entries[a]->getType() == EntryType::folderType()) continue; // Update entry if (update) { entries[a]->setState(0); entries[a]->exProp("Offset") = (int)offset; } // Check entry name string name = entries[a]->getPath(true); name.Remove(0, 1); // Remove leading / if (name.Len() > 56) { wxLogMessage("Warning: Entry %s path is too long (> 56 characters), putting it in the root directory", name); wxFileName fn(name); name = fn.GetFullName(); if (name.Len() > 56) name.Truncate(56); } // Write entry name char name_data[56]; memset(name_data, 0, 56); memcpy(name_data, CHR(name), name.Length()); mc.write(name_data, 56); // Write entry offset mc.write(&offset, 4); // Write entry size int32_t size = entries[a]->getSize(); mc.write(&size, 4); // Increment/update offset offset += size; } // Write entry data mc.seek(12, SEEK_SET); for (unsigned a = 0; a < entries.size(); a++) { // Skip folders if (entries[a]->getType() == EntryType::folderType()) continue; // Write data mc.write(entries[a]->getData(), entries[a]->getSize()); } return true; }
static boolean iter_declaration( struct tgsi_iterate_context *iter, struct tgsi_full_declaration *decl ) { struct dump_ctx *ctx = (struct dump_ctx *)iter; boolean patch = decl->Semantic.Name == TGSI_SEMANTIC_PATCH || decl->Semantic.Name == TGSI_SEMANTIC_TESSINNER || decl->Semantic.Name == TGSI_SEMANTIC_TESSOUTER || decl->Semantic.Name == TGSI_SEMANTIC_PRIMID; TXT( "DCL " ); TXT(tgsi_file_name(decl->Declaration.File)); /* all geometry shader inputs and non-patch tessellation shader inputs are * two dimensional */ if (decl->Declaration.File == TGSI_FILE_INPUT && (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY || (!patch && (iter->processor.Processor == TGSI_PROCESSOR_TESS_CTRL || iter->processor.Processor == TGSI_PROCESSOR_TESS_EVAL)))) { TXT("[]"); } /* all non-patch tess ctrl shader outputs are two dimensional */ if (decl->Declaration.File == TGSI_FILE_OUTPUT && !patch && iter->processor.Processor == TGSI_PROCESSOR_TESS_CTRL) { TXT("[]"); } if (decl->Declaration.Dimension) { CHR('['); SID(decl->Dim.Index2D); CHR(']'); } CHR('['); SID(decl->Range.First); if (decl->Range.First != decl->Range.Last) { TXT(".."); SID(decl->Range.Last); } CHR(']'); _dump_writemask( ctx, decl->Declaration.UsageMask ); if (decl->Declaration.Array) { TXT( ", ARRAY(" ); SID(decl->Array.ArrayID); CHR(')'); } if (decl->Declaration.Local) TXT( ", LOCAL" ); if (decl->Declaration.Semantic) { TXT( ", " ); ENM( decl->Semantic.Name, tgsi_semantic_names ); if (decl->Semantic.Index != 0 || decl->Semantic.Name == TGSI_SEMANTIC_TEXCOORD || decl->Semantic.Name == TGSI_SEMANTIC_GENERIC) { CHR( '[' ); UID( decl->Semantic.Index ); CHR( ']' ); } } if (decl->Declaration.File == TGSI_FILE_RESOURCE) { TXT(", "); ENM(decl->Resource.Resource, tgsi_texture_names); if (decl->Resource.Writable) TXT(", WR"); if (decl->Resource.Raw) TXT(", RAW"); } if (decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) { TXT(", "); ENM(decl->SamplerView.Resource, tgsi_texture_names); TXT(", "); if ((decl->SamplerView.ReturnTypeX == decl->SamplerView.ReturnTypeY) && (decl->SamplerView.ReturnTypeX == decl->SamplerView.ReturnTypeZ) && (decl->SamplerView.ReturnTypeX == decl->SamplerView.ReturnTypeW)) { ENM(decl->SamplerView.ReturnTypeX, tgsi_return_type_names); } else { ENM(decl->SamplerView.ReturnTypeX, tgsi_return_type_names); TXT(", "); ENM(decl->SamplerView.ReturnTypeY, tgsi_return_type_names); TXT(", "); ENM(decl->SamplerView.ReturnTypeZ, tgsi_return_type_names); TXT(", "); ENM(decl->SamplerView.ReturnTypeW, tgsi_return_type_names); } } if (decl->Declaration.Interpolate) { if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT && decl->Declaration.File == TGSI_FILE_INPUT) { TXT( ", " ); ENM( decl->Interp.Interpolate, tgsi_interpolate_names ); } if (decl->Interp.Location != TGSI_INTERPOLATE_LOC_CENTER) { TXT( ", " ); ENM( decl->Interp.Location, tgsi_interpolate_locations ); } if (decl->Interp.CylindricalWrap) { TXT(", CYLWRAP_"); if (decl->Interp.CylindricalWrap & TGSI_CYLINDRICAL_WRAP_X) { CHR('X'); } if (decl->Interp.CylindricalWrap & TGSI_CYLINDRICAL_WRAP_Y) { CHR('Y'); } if (decl->Interp.CylindricalWrap & TGSI_CYLINDRICAL_WRAP_Z) { CHR('Z'); } if (decl->Interp.CylindricalWrap & TGSI_CYLINDRICAL_WRAP_W) { CHR('W'); } } } if (decl->Declaration.Invariant) { TXT( ", INVARIANT" ); } EOL(); return TRUE; }
static boolean iter_instruction( struct tgsi_iterate_context *iter, struct tgsi_full_instruction *inst ) { struct dump_ctx *ctx = (struct dump_ctx *) iter; uint instno = ctx->instno++; const struct tgsi_opcode_info *info = tgsi_get_opcode_info( inst->Instruction.Opcode ); uint i; boolean first_reg = TRUE; INSTID( instno ); TXT( ": " ); ctx->indent -= info->pre_dedent; for(i = 0; (int)i < ctx->indent; ++i) TXT( " " ); ctx->indent += info->post_indent; if (inst->Instruction.Predicate) { CHR( '(' ); if (inst->Predicate.Negate) CHR( '!' ); TXT( "PRED[" ); SID( inst->Predicate.Index ); CHR( ']' ); if (inst->Predicate.SwizzleX != TGSI_SWIZZLE_X || inst->Predicate.SwizzleY != TGSI_SWIZZLE_Y || inst->Predicate.SwizzleZ != TGSI_SWIZZLE_Z || inst->Predicate.SwizzleW != TGSI_SWIZZLE_W) { CHR( '.' ); ENM( inst->Predicate.SwizzleX, tgsi_swizzle_names ); ENM( inst->Predicate.SwizzleY, tgsi_swizzle_names ); ENM( inst->Predicate.SwizzleZ, tgsi_swizzle_names ); ENM( inst->Predicate.SwizzleW, tgsi_swizzle_names ); } TXT( ") " ); } TXT( info->mnemonic ); switch (inst->Instruction.Saturate) { case TGSI_SAT_NONE: break; case TGSI_SAT_ZERO_ONE: TXT( "_SAT" ); break; case TGSI_SAT_MINUS_PLUS_ONE: TXT( "_SATNV" ); break; default: assert( 0 ); } for (i = 0; i < inst->Instruction.NumDstRegs; i++) { const struct tgsi_full_dst_register *dst = &inst->Dst[i]; if (!first_reg) CHR( ',' ); CHR( ' ' ); _dump_register_dst( ctx, dst ); _dump_writemask( ctx, dst->Register.WriteMask ); first_reg = FALSE; } for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *src = &inst->Src[i]; if (!first_reg) CHR( ',' ); CHR( ' ' ); if (src->Register.Negate) CHR( '-' ); if (src->Register.Absolute) CHR( '|' ); _dump_register_src(ctx, src); if (src->Register.SwizzleX != TGSI_SWIZZLE_X || src->Register.SwizzleY != TGSI_SWIZZLE_Y || src->Register.SwizzleZ != TGSI_SWIZZLE_Z || src->Register.SwizzleW != TGSI_SWIZZLE_W) { CHR( '.' ); ENM( src->Register.SwizzleX, tgsi_swizzle_names ); ENM( src->Register.SwizzleY, tgsi_swizzle_names ); ENM( src->Register.SwizzleZ, tgsi_swizzle_names ); ENM( src->Register.SwizzleW, tgsi_swizzle_names ); } if (src->Register.Absolute) CHR( '|' ); first_reg = FALSE; } if (inst->Instruction.Texture) { TXT( ", " ); ENM( inst->Texture.Texture, tgsi_texture_names ); for (i = 0; i < inst->Texture.NumOffsets; i++) { TXT( ", " ); ENM( inst->TexOffsets[i].File, tgsi_file_names); CHR( '[' ); SID( inst->TexOffsets[i].Index ); CHR( ']' ); CHR( '.' ); ENM( inst->TexOffsets[i].SwizzleX, tgsi_swizzle_names); ENM( inst->TexOffsets[i].SwizzleY, tgsi_swizzle_names); ENM( inst->TexOffsets[i].SwizzleZ, tgsi_swizzle_names); } } switch (inst->Instruction.Opcode) { case TGSI_OPCODE_IF: case TGSI_OPCODE_ELSE: case TGSI_OPCODE_BGNLOOP: case TGSI_OPCODE_ENDLOOP: case TGSI_OPCODE_CAL: TXT( " :" ); UID( inst->Label.Label ); break; } /* update indentation */ if (inst->Instruction.Opcode == TGSI_OPCODE_IF || inst->Instruction.Opcode == TGSI_OPCODE_ELSE || inst->Instruction.Opcode == TGSI_OPCODE_BGNLOOP) { ctx->indentation += indent_spaces; } EOL(); return TRUE; }
/* * prefixes - implement various special prefixes */ static void prefixes(struct vars * v) { /* literal string doesn't get any of this stuff */ if (v->cflags & REG_QUOTE) return; /* initial "***" gets special things */ if (HAVE(4) && NEXT3('*', '*', '*')) switch (*(v->now + 3)) { case CHR('?'): /* "***?" error, msg shows version */ ERR(REG_BADPAT); return; /* proceed no further */ break; case CHR('='): /* "***=" shifts to literal string */ NOTE(REG_UNONPOSIX); v->cflags |= REG_QUOTE; v->cflags &= ~(REG_ADVANCED | REG_EXPANDED | REG_NEWLINE); v->now += 4; return; /* and there can be no more prefixes */ break; case CHR(':'): /* "***:" shifts to AREs */ NOTE(REG_UNONPOSIX); v->cflags |= REG_ADVANCED; v->now += 4; break; default: /* otherwise *** is just an error */ ERR(REG_BADRPT); return; break; } /* BREs and EREs don't get embedded options */ if ((v->cflags & REG_ADVANCED) != REG_ADVANCED) return; /* embedded options (AREs only) */ if (HAVE(3) && NEXT2('(', '?') && iscalpha(*(v->now + 2))) { NOTE(REG_UNONPOSIX); v->now += 2; for (; !ATEOS() && iscalpha(*v->now); v->now++) switch (*v->now) { case CHR('b'): /* BREs (but why???) */ v->cflags &= ~(REG_ADVANCED | REG_QUOTE); break; case CHR('c'): /* case sensitive */ v->cflags &= ~REG_ICASE; break; case CHR('e'): /* plain EREs */ v->cflags |= REG_EXTENDED; v->cflags &= ~(REG_ADVF | REG_QUOTE); break; case CHR('i'): /* case insensitive */ v->cflags |= REG_ICASE; break; case CHR('m'): /* Perloid synonym for n */ case CHR('n'): /* \n affects ^ $ . [^ */ v->cflags |= REG_NEWLINE; break; case CHR('p'): /* ~Perl, \n affects . [^ */ v->cflags |= REG_NLSTOP; v->cflags &= ~REG_NLANCH; break; case CHR('q'): /* literal string */ v->cflags |= REG_QUOTE; v->cflags &= ~REG_ADVANCED; break; case CHR('s'): /* single line, \n ordinary */ v->cflags &= ~REG_NEWLINE; break; case CHR('t'): /* tight syntax */ v->cflags &= ~REG_EXPANDED; break; case CHR('w'): /* weird, \n affects ^ $ only */ v->cflags &= ~REG_NLSTOP; v->cflags |= REG_NLANCH; break; case CHR('x'): /* expanded syntax */ v->cflags |= REG_EXPANDED; break; default: ERR(REG_BADOPT); return; } if (!NEXT1(')')) { ERR(REG_BADOPT); return; } v->now++; if (v->cflags & REG_QUOTE) v->cflags &= ~(REG_EXPANDED | REG_NEWLINE); } }
/* TextureXList::writeTEXTUREXData * Writes the texture list in TEXTUREX format to [texturex], using * [patch_table] for patch information. Returns true on success, * false otherwise *******************************************************************/ bool TextureXList::writeTEXTUREXData(ArchiveEntry* texturex, PatchTable& patch_table) { // Check entry was given if (!texturex) return false; if (texturex->isLocked()) return false; wxLogMessage("Writing " + getTextureXFormatString() + " format TEXTUREx entry"); /* Total size of a TEXTUREx lump, in bytes: Header: 4 + (4 * numtextures) Textures: 22 * numtextures (normal format) 14 * numtextures (nameless format) 18 * numtextures (Strife 1.1 format) Patches: 10 * sum of patchcounts (normal and nameless formats) 6 * sum of patchcounts (Strife 1.1 format) */ size_t numpatchrefs = 0; size_t numtextures = textures.size(); for (size_t i = 0; i < numtextures; ++i) { numpatchrefs += textures[i]->nPatches(); } wxLogMessage("%i patch references in %i textures", numpatchrefs, numtextures); size_t datasize = 0; size_t headersize = 4 + (4 * numtextures); switch (txformat) { case TXF_NORMAL: datasize = 4 + (26 * numtextures) + (10 * numpatchrefs); break; case TXF_NAMELESS: datasize = 4 + (18 * numtextures) + (10 * numpatchrefs); break; case TXF_STRIFE11: datasize = 4 + (22 * numtextures) + ( 6 * numpatchrefs); break; // Some compilers insist on having default cases. default: return false; } MemChunk txdata(datasize); int32_t* offsets = new int32_t[numtextures]; int32_t foo = wxINT32_SWAP_ON_BE((signed) numtextures); // Write header txdata.seek(0, SEEK_SET); SAFEFUNC(txdata.write(&foo, 4)); // Go to beginning of texture definitions SAFEFUNC(txdata.seek(4 + (numtextures*4), SEEK_SET)); // Write texture entries for (size_t i = 0; i < numtextures; ++i) { // Get texture to write CTexture* tex = textures[i]; // Set offset offsets[i] = (signed)txdata.currentPos(); // Write texture entry switch (txformat) { case TXF_NORMAL: { // Create 'normal' doom format texture definition ftdef_t txdef; memset(txdef.name, 0, 8); // Set texture name to all 0's (to ensure compatibility with XWE) strncpy(txdef.name, CHR(tex->getName().Upper()), tex->getName().Len()); txdef.flags = 0; txdef.scale[0] = (tex->getScaleX()*8); txdef.scale[1] = (tex->getScaleY()*8); txdef.width = tex->getWidth(); txdef.height = tex->getHeight(); txdef.columndir[0] = 0; txdef.columndir[1] = 0; txdef.patchcount = tex->nPatches(); // Check for WorldPanning flag if (tex->world_panning) txdef.flags |= TX_WORLDPANNING; // Write texture definition SAFEFUNC(txdata.write(&txdef, 22)); break; } case TXF_NAMELESS: { // Create nameless texture definition nltdef_t txdef; txdef.flags = 0; txdef.scale[0] = (tex->getScaleX()*8); txdef.scale[1] = (tex->getScaleY()*8); txdef.width = tex->getWidth(); txdef.height = tex->getHeight(); txdef.columndir[0] = 0; txdef.columndir[1] = 0; txdef.patchcount = tex->nPatches(); // Write texture definition SAFEFUNC(txdata.write(&txdef, 8)); break; } case TXF_STRIFE11: { // Create strife format texture definition stdef_t txdef; memset(txdef.name, 0, 8); // Set texture name to all 0's (to ensure compatibility with XWE) strncpy(txdef.name, CHR(tex->getName().Upper()), tex->getName().Len()); txdef.flags = 0; txdef.scale[0] = (tex->getScaleX()*8); txdef.scale[1] = (tex->getScaleY()*8); txdef.width = tex->getWidth(); txdef.height = tex->getHeight(); txdef.patchcount = tex->nPatches(); // Check for WorldPanning flag if (tex->world_panning) txdef.flags |= TX_WORLDPANNING; // Write texture definition SAFEFUNC(txdata.write(&txdef, 18)); break; } default: return false; } // Write patch references for (size_t k = 0; k < tex->nPatches(); ++k) { // Get patch to write CTPatch* patch = tex->getPatch(k); // Create patch definition tx_patch_t pdef; pdef.left = patch->xOffset(); pdef.top = patch->yOffset(); // Check for 'invalid' patch if (patch->getName().StartsWith("INVPATCH")) { // Get raw patch index from name string number = patch->getName(); number.Replace("INVPATCH", ""); long index; number.ToLong(&index); pdef.patch = index; } else pdef.patch = patch_table.patchIndex(patch->getName()); // Note this will be -1 if the patch doesn't exist in the patch table. This should never happen with the texture editor, though. // Write common data SAFEFUNC(txdata.write(&pdef, 6)); // In non-Strife formats, there's some added rubbish if (txformat != TXF_STRIFE11) { foo = 0; SAFEFUNC(txdata.write(&foo, 4)); } } } // Write offsets SAFEFUNC(txdata.seek(4, SEEK_SET)); SAFEFUNC(txdata.write(offsets, 4*numtextures)); // Write data to the TEXTUREx entry texturex->importMemChunk(txdata); // Update entry type EntryType::detectEntryType(texturex); // Clean up delete[] offsets; return true; }
/* * next - get next token */ static int /* 1 normal, 0 failure */ next(struct vars * v) { chr c; /* errors yield an infinite sequence of failures */ if (ISERR()) return 0; /* the error has set nexttype to EOS */ /* remember flavor of last token */ v->lasttype = v->nexttype; /* REG_BOSONLY */ if (v->nexttype == EMPTY && (v->cflags & REG_BOSONLY)) { /* at start of a REG_BOSONLY RE */ RETV(SBEGIN, 0); /* same as \A */ } /* if we're nested and we've hit end, return to outer level */ if (v->savenow != NULL && ATEOS()) { v->now = v->savenow; v->stop = v->savestop; v->savenow = v->savestop = NULL; } /* skip white space etc. if appropriate (not in literal or []) */ if (v->cflags & REG_EXPANDED) switch (v->lexcon) { case L_ERE: case L_BRE: case L_EBND: case L_BBND: skip(v); break; } /* handle EOS, depending on context */ if (ATEOS()) { switch (v->lexcon) { case L_ERE: case L_BRE: case L_Q: RET(EOS); break; case L_EBND: case L_BBND: FAILW(REG_EBRACE); break; case L_BRACK: case L_CEL: case L_ECL: case L_CCL: FAILW(REG_EBRACK); break; } assert(NOTREACHED); } /* okay, time to actually get a character */ c = *v->now++; /* deal with the easy contexts, punt EREs to code below */ switch (v->lexcon) { case L_BRE: /* punt BREs to separate function */ return brenext(v, c); break; case L_ERE: /* see below */ break; case L_Q: /* literal strings are easy */ RETV(PLAIN, c); break; case L_BBND: /* bounds are fairly simple */ case L_EBND: switch (c) { case CHR('0'): case CHR('1'): case CHR('2'): case CHR('3'): case CHR('4'): case CHR('5'): case CHR('6'): case CHR('7'): case CHR('8'): case CHR('9'): RETV(DIGIT, (chr) DIGITVAL(c)); break; case CHR(','): RET(','); break; case CHR('}'): /* ERE bound ends with } */ if (INCON(L_EBND)) { INTOCON(L_ERE); if ((v->cflags & REG_ADVF) && NEXT1('?')) { v->now++; NOTE(REG_UNONPOSIX); RETV('}', 0); } RETV('}', 1); } else FAILW(REG_BADBR); break; case CHR('\\'): /* BRE bound ends with \} */ if (INCON(L_BBND) && NEXT1('}')) { v->now++; INTOCON(L_BRE); RET('}'); } else FAILW(REG_BADBR); break; default: FAILW(REG_BADBR); break; } assert(NOTREACHED); break; case L_BRACK: /* brackets are not too hard */ switch (c) { case CHR(']'): if (LASTTYPE('[')) RETV(PLAIN, c); else { INTOCON((v->cflags & REG_EXTENDED) ? L_ERE : L_BRE); RET(']'); } break; case CHR('\\'): NOTE(REG_UBBS); if (!(v->cflags & REG_ADVF)) RETV(PLAIN, c); NOTE(REG_UNONPOSIX); if (ATEOS()) FAILW(REG_EESCAPE); (DISCARD) lexescape(v); switch (v->nexttype) { /* not all escapes okay here */ case PLAIN: return 1; break; case CCLASS: switch (v->nextvalue) { case 'd': lexnest(v, brbackd, ENDOF(brbackd)); break; case 's': lexnest(v, brbacks, ENDOF(brbacks)); break; case 'w': lexnest(v, brbackw, ENDOF(brbackw)); break; default: FAILW(REG_EESCAPE); break; } /* lexnest done, back up and try again */ v->nexttype = v->lasttype; return next(v); break; } /* not one of the acceptable escapes */ FAILW(REG_EESCAPE); break; case CHR('-'): if (LASTTYPE('[') || NEXT1(']')) RETV(PLAIN, c); else RETV(RANGE, c); break; case CHR('['): if (ATEOS()) FAILW(REG_EBRACK); switch (*v->now++) { case CHR('.'): INTOCON(L_CEL); /* might or might not be locale-specific */ RET(COLLEL); break; case CHR('='): INTOCON(L_ECL); NOTE(REG_ULOCALE); RET(ECLASS); break; case CHR(':'): INTOCON(L_CCL); NOTE(REG_ULOCALE); RET(CCLASS); break; default: /* oops */ v->now--; RETV(PLAIN, c); break; } assert(NOTREACHED); break; default: RETV(PLAIN, c); break; } assert(NOTREACHED); break; case L_CEL: /* collating elements are easy */ if (c == CHR('.') && NEXT1(']')) { v->now++; INTOCON(L_BRACK); RETV(END, '.'); } else RETV(PLAIN, c); break; case L_ECL: /* ditto equivalence classes */ if (c == CHR('=') && NEXT1(']')) { v->now++; INTOCON(L_BRACK); RETV(END, '='); } else RETV(PLAIN, c); break; case L_CCL: /* ditto character classes */ if (c == CHR(':') && NEXT1(']')) { v->now++; INTOCON(L_BRACK); RETV(END, ':'); } else RETV(PLAIN, c); break; default: assert(NOTREACHED); break; } /* that got rid of everything except EREs and AREs */ assert(INCON(L_ERE)); /* deal with EREs and AREs, except for backslashes */ switch (c) { case CHR('|'): RET('|'); break; case CHR('*'): if ((v->cflags & REG_ADVF) && NEXT1('?')) { v->now++; NOTE(REG_UNONPOSIX); RETV('*', 0); } RETV('*', 1); break; case CHR('+'): if ((v->cflags & REG_ADVF) && NEXT1('?')) { v->now++; NOTE(REG_UNONPOSIX); RETV('+', 0); } RETV('+', 1); break; case CHR('?'): if ((v->cflags & REG_ADVF) && NEXT1('?')) { v->now++; NOTE(REG_UNONPOSIX); RETV('?', 0); } RETV('?', 1); break; case CHR('{'): /* bounds start or plain character */ if (v->cflags & REG_EXPANDED) skip(v); if (ATEOS() || !iscdigit(*v->now)) { NOTE(REG_UBRACES); NOTE(REG_UUNSPEC); RETV(PLAIN, c); } else { NOTE(REG_UBOUNDS); INTOCON(L_EBND); RET('{'); } assert(NOTREACHED); break; case CHR('('): /* parenthesis, or advanced extension */ if ((v->cflags & REG_ADVF) && NEXT1('?')) { NOTE(REG_UNONPOSIX); v->now++; switch (*v->now++) { case CHR(':'): /* non-capturing paren */ RETV('(', 0); break; case CHR('#'): /* comment */ while (!ATEOS() && *v->now != CHR(')')) v->now++; if (!ATEOS()) v->now++; assert(v->nexttype == v->lasttype); return next(v); break; case CHR('='): /* positive lookahead */ NOTE(REG_ULOOKAHEAD); RETV(LACON, 1); break; case CHR('!'): /* negative lookahead */ NOTE(REG_ULOOKAHEAD); RETV(LACON, 0); break; default: FAILW(REG_BADRPT); break; } assert(NOTREACHED); } if (v->cflags & REG_NOSUB) RETV('(', 0); /* all parens non-capturing */ else RETV('(', 1); break; case CHR(')'): if (LASTTYPE('(')) NOTE(REG_UUNSPEC); RETV(')', c); break; case CHR('['): /* easy except for [[:<:]] and [[:>:]] */ if (HAVE(6) && *(v->now + 0) == CHR('[') && *(v->now + 1) == CHR(':') && (*(v->now + 2) == CHR('<') || *(v->now + 2) == CHR('>')) && *(v->now + 3) == CHR(':') && *(v->now + 4) == CHR(']') && *(v->now + 5) == CHR(']')) { c = *(v->now + 2); v->now += 6; NOTE(REG_UNONPOSIX); RET((c == CHR('<')) ? '<' : '>'); } INTOCON(L_BRACK); if (NEXT1('^')) { v->now++; RETV('[', 0); } RETV('[', 1); break; case CHR('.'): RET('.'); break; case CHR('^'): RET('^'); break; case CHR('$'): RET('$'); break; case CHR('\\'): /* mostly punt backslashes to code below */ if (ATEOS()) FAILW(REG_EESCAPE); break; default: /* ordinary character */ RETV(PLAIN, c); break; } /* ERE/ARE backslash handling; backslash already eaten */ assert(!ATEOS()); if (!(v->cflags & REG_ADVF)) { /* only AREs have non-trivial escapes */ if (iscalnum(*v->now)) { NOTE(REG_UBSALNUM); NOTE(REG_UUNSPEC); } RETV(PLAIN, *v->now++); } (DISCARD) lexescape(v); if (ISERR()) FAILW(REG_EESCAPE); if (v->nexttype == CCLASS) { /* fudge at lexical level */ switch (v->nextvalue) { case 'd': lexnest(v, backd, ENDOF(backd)); break; case 'D': lexnest(v, backD, ENDOF(backD)); break; case 's': lexnest(v, backs, ENDOF(backs)); break; case 'S': lexnest(v, backS, ENDOF(backS)); break; case 'w': lexnest(v, backw, ENDOF(backw)); break; case 'W': lexnest(v, backW, ENDOF(backW)); break; default: assert(NOTREACHED); FAILW(REG_ASSERT); break; } /* lexnest done, back up and try again */ v->nexttype = v->lasttype; return next(v); } /* otherwise, lexescape has already done the work */ return !ISERR(); }
/* * lexdigits - slurp up digits and return chr value */ static chr /* chr value; errors signalled via ERR */ lexdigits(struct vars * v, int base, int minlen, int maxlen) { uchr n; /* unsigned to avoid overflow misbehavior */ int len; chr c; int d; const uchr ub = (uchr) base; n = 0; for (len = 0; len < maxlen && !ATEOS(); len++) { c = *v->now++; switch (c) { case CHR('0'): case CHR('1'): case CHR('2'): case CHR('3'): case CHR('4'): case CHR('5'): case CHR('6'): case CHR('7'): case CHR('8'): case CHR('9'): d = DIGITVAL(c); break; case CHR('a'): case CHR('A'): d = 10; break; case CHR('b'): case CHR('B'): d = 11; break; case CHR('c'): case CHR('C'): d = 12; break; case CHR('d'): case CHR('D'): d = 13; break; case CHR('e'): case CHR('E'): d = 14; break; case CHR('f'): case CHR('F'): d = 15; break; default: v->now--; /* oops, not a digit at all */ d = -1; break; } if (d >= base) { /* not a plausible digit */ v->now--; d = -1; } if (d < 0) break; /* NOTE BREAK OUT */ n = n * ub + (uchr) d; } if (len < minlen) ERR(REG_EESCAPE); return (chr) n; }
/* DatArchive::write * Writes the dat archive to a MemChunk * Returns true if successful, false otherwise *******************************************************************/ bool DatArchive::write(MemChunk& mc, bool update) { // Only two bytes are used for storing entry amount, // so abort for excessively large files: if (numEntries() > 65535) return false; // Determine directory offset, name offsets & individual lump offsets uint32_t dir_offset = 10; uint16_t name_offset = numEntries() * 12; uint32_t name_size = 0; string previousname = ""; uint16_t* nameoffsets = new uint16_t[numEntries()]; ArchiveEntry* entry = NULL; for (uint16_t l = 0; l < numEntries(); l++) { entry = getEntry(l); setEntryOffset(entry, dir_offset); dir_offset += entry->getSize(); // Does the entry has a name? string name = entry->getName(); if (l > 0 && previousname.length() > 0 && name.length() > previousname.length() && !previousname.compare(0, previousname.length(), name, 0, previousname.length()) && name.at(previousname.length()) == '+') { // This is a fake name name = ""; nameoffsets[l] = 0; } else { // This is a true name previousname = name; nameoffsets[l] = uint16_t(name_offset + name_size); name_size += name.length() + 1; } } // Clear/init MemChunk mc.clear(); mc.seek(0, SEEK_SET); mc.reSize(dir_offset + name_size + numEntries() * 12); // Write the header uint16_t num_lumps = wxINT16_SWAP_ON_BE(numEntries()); dir_offset = wxINT32_SWAP_ON_BE(dir_offset); uint32_t unknown = 0; mc.write(&num_lumps, 2); mc.write(&dir_offset, 4); mc.write(&unknown, 4); // Write the lumps for (uint16_t l = 0; l < numEntries(); l++) { entry = getEntry(l); mc.write(entry->getData(), entry->getSize()); } // Write the directory for (uint16_t l = 0; l < num_lumps; l++) { entry = getEntry(l); uint32_t offset = wxINT32_SWAP_ON_BE(getEntryOffset(entry)); uint32_t size = wxINT32_SWAP_ON_BE(entry->getSize()); uint16_t nameofs = wxINT16_SWAP_ON_BE(nameoffsets[l]); uint16_t flags = wxINT16_SWAP_ON_BE((entry->isEncrypted() == ENC_SCRLE0) ? 1 : 0); mc.write(&offset, 4); // Offset mc.write(&size, 4); // Size mc.write(&nameofs, 2); // Name offset mc.write(&flags, 2); // Flags if (update) { entry->setState(0); entry->exProp("Offset") = (int)wxINT32_SWAP_ON_BE(offset); } } // Write the names for (uint16_t l = 0; l < num_lumps; l++) { uint8_t zero = 0; entry = getEntry(l); if (nameoffsets[l]) { mc.write(CHR(entry->getName()), entry->getName().length()); mc.write(&zero, 1); } } // Clean-up delete[] nameoffsets; // Finished! return true; }
static HRESULT OnInitDialog(PWLAN_INFO psInfo) { HRESULT hr = S_OK; TBBUTTONINFO tbbi = {0}; HMENU hMenu; // Size the dialog: full screen. SHINITDLGINFO sidi = {0}; sidi.dwMask = SHIDIM_FLAGS; sidi.dwFlags = SHIDIF_SIZEDLG | SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN; sidi.hDlg = psInfo->hDlg; SHInitDialog(&sidi); SHMENUBARINFO mbi = {0}; mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = psInfo->hDlg; mbi.nToolBarId = IDR_WZC_SKBAR_NETWORK; mbi.hInstRes = HINST_RESDLL; mbi.dwFlags = SHCMBF_HMENU | SHCMBF_HIDESIPBUTTON; SHCreateMenuBar(&mbi); psInfo->hwndNetListMB = mbi.hwndMB; tbbi.cbSize = sizeof(TBBUTTONINFO); tbbi.dwMask = TBIF_COMMAND; tbbi.dwMask |= TBIF_BYINDEX; VBR(SendMessage(mbi.hwndMB, TB_GETBUTTONINFO, 1, (LPARAM)&tbbi) == 1); hMenu = (HMENU)SendMessage(psInfo->hwndNetListMB, SHCMBM_GETSUBMENU, 0, tbbi.idCommand); VWR(hMenu); psInfo->pNetworkObject = new CNetworkObject; VPR(psInfo->pNetworkObject); SHLoadMenuExtensions((IUnknown*)psInfo->pNetworkObject, gc_szMenuNamespace, gc_szSofkeyExtensions, &psInfo->hSoftKeyExt); // Initialize the dialog contents hr = InitNetworkListView(psInfo); CHR(hr); // Override notification UI hr = SetCallbackRegistration(TRUE, psInfo); CHR(hr); // Get the "home activate" message to ensure proper // notification behavior if the user leaves the CPL g_uMsgActivateHome = RegisterWindowMessage(gc_szMsgActivateHome); CWR(0 != g_uMsgActivateHome); // Initialize the filter hr = InitFilterCombo(psInfo); CHR(hr); psInfo->dwHWFlags = SHWZCGetHardwareFlags(); // Populate the network list hr = PopulateNetworkList(psInfo); CHR(hr); // We assume that we have hardware if we're here psInfo->fWirelessCardPresent = TRUE; ListView_SetItemState(psInfo->hwndNetList, 0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED); Error: return hr; };
static inline void modifUnit(IPackage&p,IConnection*c) { uint32 subnet; uint16 numunits; int err; SUnit unit,ounit; IPackage op("set"); op<<QString("modify unit"); op<<subnet<<numunits; char buf[256]; for(int i=0;i<numunits;i++){ getUnit(unit,p); ounit=unit; //check for existance if(!(unit.mask&UNUM)){ int num=krui_createDefaultUnit(); if(num<0){ ounit.errcode="Unable to create unit."; setUnit(ounit,op); continue; } unit.id=ounit.id=num; } if(unit.id==0||unit.id>krui_getNoOfUnits()){ ounit.mask=UERR|UNUM; ounit.errcode="Unit doesn't exist."; setUnit(ounit,op); continue; } //prototype if(unit.mask&UPROTO){ err=krui_setUnitFType(unit.id,CHR(buf,unit.prototype)); if(err){ ounit.prototype=krui_getUnitFTypeName(unit.id); ounit.mask|=UERR; ounit.errcode=krui_error(err); } } //position if(unit.mask&UPOS){ PosType pos; pos.x=unit.xpos; pos.y=unit.ypos; pos.z=unit.zpos; krui_setUnitPosition(unit.id,&pos); krui_getUnitPosition(unit.id,&pos); ounit.xpos=pos.x; ounit.ypos=pos.y; ounit.zpos=pos.z; } //bias if(unit.mask&UBIAS){ krui_setUnitBias(unit.id,unit.bias); } //i_activation if(unit.mask&UIACT){ krui_setUnitInitialActivation(unit.id,unit.iact); } //activation if(unit.mask&UACT){ err=krui_setUnitActivation(unit.id,unit.act); if(err){ ounit.act=krui_getUnitActivation(unit.id); ounit.mask|=UERR; ounit.errcode=krui_error(err); } } //actfunc if(unit.mask&UACTF){ err=krui_setUnitActFunc(unit.id,CHR(buf,unit.actfunc)); if(err){ ounit.mask|=UERR; ounit.errcode=krui_error(err); ounit.actfunc=krui_getUnitActFuncName(unit.id); } } //outfunc if(unit.mask&UOUTF){ err=krui_setUnitOutFunc(unit.id,CHR(buf,unit.outfunc)); if(err){ ounit.mask|=UERR; ounit.errcode=krui_error(err); ounit.outfunc=krui_getUnitOutFuncName(unit.id); } } //name if(unit.mask&UNAME){ err=krui_setUnitName(unit.id,CHR(buf,unit.name)); if(err){ ounit.mask|=UERR; ounit.errcode=krui_error(err); ounit.name=krui_getUnitName(unit.id); } } //store setUnit(ounit,op); } c->send(op); }
static inline void creatUnit(IPackage&p,IConnection*c) { uint32 subnet; uint16 numunits; SUnit unit,ounit; p>>subnet>>numunits; IPackage op("set"); op<<QString("create unit"); op<<subnet<<numunits; int num,err; //yet no check for subnet/layer defined, SNNS itself gives damn //buffer for string ops: char buf[256]; //create units for(int i=0;i<numunits;i++){ getUnit(unit,p); ounit=unit; num=krui_createDefaultUnit(); if(num<0){//error ounit.mask=UERR; ounit.errcode=(QString)krui_error(-num); setUnit(ounit,op); //proceed with next unit continue; }else{//success ounit.mask|=UNUM; ounit.id=num; } //subnet/layer krui_setUnitLayerNo(num,subnet&0xffff); int subn=(subnet>>16)&0xffff; subn-=32736; krui_setUnitSubnetNo(num,subn); //name if(unit.mask&UNAME){ err=krui_setUnitName(num,CHR(buf,unit.name)); if(err){ ounit.mask|=UERR; ounit.errcode=krui_error(err); } } //output function if(unit.mask&UOUTF){ err=krui_setUnitOutFunc(num,CHR(buf,unit.outfunc)); if(err){ ounit.mask|=UERR; ounit.errcode=krui_error(err); } }//must be for error and nomask, doesn't hurt anyway ounit.mask|=UOUTF; ounit.outfunc=krui_getUnitOutFuncName(num); //activation function if(unit.mask&UACTF){ err=krui_setUnitActFunc(num,CHR(buf,unit.actfunc)); if(err){ ounit.mask|=UERR; ounit.errcode=krui_error(err); } } ounit.mask|=UACTF; ounit.actfunc=krui_getUnitActFuncName(num); //initial activation if(unit.mask&UIACT) krui_setUnitInitialActivation(num,unit.iact); //activation if(unit.mask&UACT) krui_setUnitActivation(num,unit.act); //bias if(unit.mask&UBIAS) krui_setUnitBias(num,unit.bias); //prototype if(unit.mask&UPROTO){ err=krui_setUnitFType(num,CHR(buf,unit.prototype)); if(err){ ounit.mask|=UERR; ounit.errcode=krui_error(err); ounit.prototype=(char*)0; //take this as non-fatal and proceed } } //position if(unit.mask&UPOS){ struct PosType pos; pos.x=unit.xpos; pos.y=unit.ypos; pos.z=unit.zpos; krui_setUnitPosition(num,&pos); //the above doesn't transport errors, so ... krui_getUnitPosition(num,&pos); ounit.xpos=pos.x; ounit.ypos=pos.y; ounit.zpos=pos.z; }else { struct PosType pos; ounit.mask|=UPOS; krui_getUnitPosition(num,&pos); ounit.xpos=pos.x; ounit.ypos=pos.y; ounit.zpos=pos.z; } //send back setUnit(ounit,op); } c->send(op); }
void SFD_AssignLookups(SplineFont1 *sf) { PST1 *pst, *pst2; int isv; KernPair1 *kp, *kp2; KernClass1 *kc, *kc2; FPST1 *fpst; ASM1 *sm; AnchorClass1 *ac, *ac2; int gid, gid2, cnt, i, k, isgpos; SplineFont1 *subsf; SplineChar *sc, *sc2; OTLookup *otl, **all; struct lookup_subtable *sub; /* Fix up some gunk from really old versions of the sfd format */ SFDCleanupAnchorClasses(&sf->sf); if ( sf->sf.uni_interp==ui_unset ) sf->sf.uni_interp = interp_from_encoding(sf->sf.map->enc,ui_none); /* Fixup for an old bug */ if ( sf->sf.pfminfo.os2_winascent < sf->sf.ascent/4 && !sf->sf.pfminfo.winascent_add ) { sf->sf.pfminfo.winascent_add = true; sf->sf.pfminfo.os2_winascent = 0; sf->sf.pfminfo.windescent_add = true; sf->sf.pfminfo.os2_windescent = 0; } /* First handle the PSTs, no complications here */ k=0; do { subsf = sf->sf.subfontcnt==0 ? sf : (SplineFont1 *) (sf->sf.subfonts[k]); for ( gid=0; gid<subsf->sf.glyphcnt; ++gid ) if ( (sc=subsf->sf.glyphs[gid])!=NULL ) { for ( pst = (PST1 *) (sc->possub); pst!=NULL; pst = (PST1*) (pst->pst.next) ) { if ( pst->pst.type == pst_lcaret || pst->pst.subtable!=NULL ) continue; /* Nothing to do, or already done */ otl = CreateLookup(sf,pst->tag,pst->script_lang_index,pst->flags,pst->pst.type); sub = CreateSubtable(otl,sf); /* There might be another PST with the same flags on this glyph */ /* And we must fixup the current pst */ for ( pst2=pst ; pst2!=NULL; pst2 = (PST1 *) (pst2->pst.next) ) { if ( pst2->tag==pst->tag && pst2->script_lang_index==pst->script_lang_index && pst2->flags==pst->flags && pst2->pst.type==pst->pst.type ) pst2->pst.subtable = sub; } for ( gid2=gid+1; gid2<subsf->sf.glyphcnt; ++gid2 ) if ( (sc2=subsf->sf.glyphs[gid2])!=NULL ) { for ( pst2 = (PST1 *) (sc2->possub); pst2!=NULL; pst2 = (PST1 *) (pst2->pst.next) ) { if ( pst2->tag==pst->tag && pst2->script_lang_index==pst->script_lang_index && pst2->flags==pst->flags && pst2->pst.type==pst->pst.type ) pst2->pst.subtable = sub; } } } } ++k; } while ( k<sf->sf.subfontcnt ); /* Now kerns. May need to merge kernclasses to kernpair lookups (different subtables, of course */ for ( isv=0; isv<2; ++isv ) { k=0; do { subsf = sf->sf.subfontcnt==0 ? sf : (SplineFont1 *) (sf->sf.subfonts[k]); for ( gid=0; gid<subsf->sf.glyphcnt; ++gid ) if ( (sc=subsf->sf.glyphs[gid])!=NULL ) { for ( kp = (KernPair1 *) (isv ? sc->vkerns : sc->kerns); kp!=NULL; kp = (KernPair1 *) (kp->kp.next) ) { if ( kp->kp.subtable!=NULL ) continue; /* already done */ otl = CreateLookup(sf,isv ? CHR('v','k','r','n') : CHR('k','e','r','n'), kp->sli,kp->flags,pst_pair); sub = CreateSubtable(otl,sf); /* There might be another kp with the same flags on this glyph */ /* And we must fixup the current kp */ for ( kp2=kp ; kp2!=NULL; kp2 = (KernPair1 *) (kp2->kp.next) ) { if ( kp2->sli==kp->sli && kp2->flags==kp->flags ) kp2->kp.subtable = sub; } for ( gid2=gid+1; gid2<subsf->sf.glyphcnt; ++gid2 ) if ( (sc2=subsf->sf.glyphs[gid2])!=NULL ) { for ( kp2 = (KernPair1 *) (isv ? sc2->vkerns : sc2->kerns); kp2!=NULL; kp2 = (KernPair1 *) (kp2->kp.next) ) { if ( kp2->sli==kp->sli && kp2->flags==kp->flags ) kp2->kp.subtable = sub; } } /* And there might be a kerning class... */ for ( kc=(KernClass1 *) (isv ? sf->sf.vkerns : sf->sf.kerns); kc!=NULL; kc = (KernClass1 *) (kc->kc.next) ) { if ( kc->sli == kp->sli && kc->flags == kp->flags && kc->kc.subtable==NULL) { sub = CreateSubtable(otl,sf); sub->per_glyph_pst_or_kern = false; sub->kc = &kc->kc; kc->kc.subtable = sub; } } } } ++k; } while ( k<sf->sf.subfontcnt ); /* Or there might be a kerning class all by its lonesome */ for ( kc=(KernClass1 *) (isv ? sf->sf.vkerns : sf->sf.kerns); kc!=NULL; kc = (KernClass1 *) (kc->kc.next) ) { if ( kc->kc.subtable==NULL) { otl = CreateLookup(sf,isv ? CHR('v','k','r','n') : CHR('k','e','r','n'), kc->sli,kc->flags,pst_pair); for ( kc2=kc; kc2!=NULL; kc2=(KernClass1 *) (kc2->kc.next) ) { if ( kc->sli == kc2->sli && kc->flags == kc2->flags && kc2->kc.subtable==NULL) { sub = CreateSubtable(otl,sf); sub->per_glyph_pst_or_kern = false; sub->kc = &kc2->kc; kc2->kc.subtable = sub; } } } } } /* Every FPST and ASM lives in its own lookup with one subtable */ /* But the old format refered to nested lookups by tag, and now we refer */ /* to the lookup itself, so fix that up */ for ( fpst=(FPST1 *) sf->sf.possub; fpst!=NULL; fpst=((FPST1 *) fpst->fpst.next) ) { otl = CreateLookup(sf,fpst->tag, fpst->script_lang_index, fpst->flags,fpst->fpst.type); sub = CreateSubtable(otl,sf); sub->per_glyph_pst_or_kern = false; sub->fpst = &fpst->fpst; fpst->fpst.subtable = sub; FPSTReplaceTagsWithLookups(&fpst->fpst,sf); } for ( sm=(ASM1 *) sf->sf.sm; sm!=NULL; sm=((ASM1 *) sm->sm.next) ) { otl = CreateMacLookup(sf,sm); sub = CreateSubtable(otl,sf); sub->per_glyph_pst_or_kern = false; sub->sm = &sm->sm; sm->sm.subtable = sub; if ( sm->sm.type==asm_context ) ASMReplaceTagsWithLookups(&sm->sm,sf); } /* We retained the old nested feature tags so we could do the above conversion */ /* of tag to lookup. Get rid of them now */ for ( isgpos=0; isgpos<2; ++isgpos ) { for ( otl = isgpos ? sf->sf.gpos_lookups : sf->sf.gsub_lookups ; otl != NULL; otl=otl->next ) { if ( otl->features!=NULL && otl->features->scripts==NULL ) { chunkfree(otl->features,sizeof(FeatureScriptLangList)); otl->features = NULL; } } } /* Anchor classes are complicated, because I foolishly failed to distinguish */ /* between mark to base and mark to ligature classes. So one AC might have */ /* both. If so we need to turn it into two ACs, and have separate lookups */ /* for each */ for ( ac=(AnchorClass1 *) (sf->sf.anchor); ac!=NULL; ac=(AnchorClass1 *) ac->ac.next ) { ACHasBaseLig(sf,ac); if ( ac->has_ligatures && !ac->has_bases ) ac->ac.type = act_mklg; else if ( ac->has_ligatures && ac->has_bases ) ACDisassociateLigatures(sf,ac); } for ( ac=(AnchorClass1 *) (sf->sf.anchor); ac!=NULL; ac=(AnchorClass1 *) ac->ac.next ) { if ( ac->ac.subtable==NULL ) { otl = CreateACLookup(sf,ac); sub = CreateSubtable(otl,sf); for ( ac2=ac; ac2!=NULL; ac2 = (AnchorClass1 *) ac2->ac.next ) { if ( ac2->feature_tag == ac->feature_tag && ac2->script_lang_index == ac->script_lang_index && ac2->flags == ac->flags && ac2->ac.type == ac->ac.type && ac2->merge_with == ac->merge_with ) ac2->ac.subtable = sub; } } } /* Now I want to order the gsub lookups. I shan't bother with the gpos */ /* lookups because I didn't before */ for ( otl=sf->sf.gsub_lookups, cnt=0; otl!=NULL; otl=otl->next, ++cnt ); if ( cnt!=0 ) { all = malloc(cnt*sizeof(OTLookup *)); for ( otl=sf->sf.gsub_lookups, cnt=0; otl!=NULL; otl=otl->next, ++cnt ) { all[cnt] = otl; otl->lookup_index = GSubOrder(sf,otl->features); } qsort(all,cnt,sizeof(OTLookup *),order_lookups); sf->sf.gsub_lookups = all[0]; for ( i=1; i<cnt; ++i ) all[i-1]->next = all[i]; all[cnt-1]->next = NULL; free( all ); } for ( isgpos=0; isgpos<2; ++isgpos ) { for ( otl = isgpos ? sf->sf.gpos_lookups : sf->sf.gsub_lookups , cnt=0; otl!=NULL; otl = otl->next ) { otl->lookup_index = cnt++; NameOTLookup(otl,&sf->sf); } } }
static int TTFFeatureIndex( uint32 tag, struct table_ordering *ord ) { /* This is the order in which features should be executed */ int cnt = 0; if ( ord!=NULL ) { for ( cnt=0; ord->ordered_features[cnt]!=0; ++cnt ) if ( ord->ordered_features[cnt]==tag ) break; return( cnt ); } cnt+=2; switch ( tag ) { /* GSUB ordering */ case CHR('c','c','m','p'): /* Must be first? */ return( cnt-2 ); case CHR('l','o','c','l'): /* Language dependent letter forms (serbian uses some different glyphs than russian) */ return( cnt-1 ); case CHR('i','s','o','l'): return( cnt ); case CHR('j','a','l','t'): /* must come after 'isol' */ return( cnt+1 ); case CHR('f','i','n','a'): return( cnt+2 ); case CHR('f','i','n','2'): case CHR('f','a','l','t'): /* must come after 'fina' */ return( cnt+3 ); case CHR('f','i','n','3'): return( cnt+4 ); case CHR('m','e','d','i'): return( cnt+5 ); case CHR('m','e','d','2'): return( cnt+6 ); case CHR('i','n','i','t'): return( cnt+7 ); case CHR('r','t','l','a'): return( cnt+100 ); case CHR('s','m','c','p'): case CHR('c','2','s','c'): return( cnt+200 ); case CHR('r','l','i','g'): return( cnt+300 ); case CHR('c','a','l','t'): return( cnt+301 ); case CHR('l','i','g','a'): return( cnt+302 ); case CHR('d','l','i','g'): case CHR('h','l','i','g'): return( cnt+303 ); case CHR('c','s','w','h'): return( cnt+304 ); case CHR('m','s','e','t'): return( cnt+305 ); case CHR('f','r','a','c'): return( cnt+306 ); /* Indic processing */ case CHR('n','u','k','t'): case CHR('p','r','e','f'): return( cnt+301 ); case CHR('a','k','h','n'): return( cnt+302 ); case CHR('r','p','h','f'): return( cnt+303 ); case CHR('b','l','w','f'): return( cnt+304 ); case CHR('h','a','l','f'): case CHR('a','b','v','f'): return( cnt+305 ); case CHR('p','s','t','f'): return( cnt+306 ); case CHR('v','a','t','u'): return( cnt+307 ); case CHR('p','r','e','s'): return( cnt+310 ); case CHR('b','l','w','s'): return( cnt+311 ); case CHR('a','b','v','s'): return( cnt+312 ); case CHR('p','s','t','s'): return( cnt+313 ); case CHR('c','l','i','g'): return( cnt+314 ); case CHR('h','a','l','n'): return( cnt+320 ); /* end indic ordering */ case CHR('a','f','r','c'): case CHR('l','j','m','o'): case CHR('v','j','m','o'): return( cnt+350 ); case CHR('v','r','t','2'): case CHR('v','e','r','t'): return( cnt+1010 ); /* Documented to come last */ /* Unknown things come after everything but vert/vrt2 */ default: return( cnt+1000 ); } }
// ---------------------------------------------------------------------------- // Tokenizer::readNext // // Reads the next token from the data and writes it to [target] if specified // ---------------------------------------------------------------------------- bool Tokenizer::readNext(Token* target) { if (data_.empty() || state_.position >= state_.size) { if (target) target->valid = false; return false; } // Process until the end of a token or the end of the data state_.done = false; while (state_.position < state_.size && !state_.done) { // Check for newline if (data_[state_.position] == '\n' && state_.state != TokenizeState::State::Token) ++state_.current_line; // Process current character depending on state switch (state_.state) { case TokenizeState::State::Unknown: tokenizeUnknown(); break; case TokenizeState::State::Whitespace: tokenizeWhitespace(); break; case TokenizeState::State::Token: tokenizeToken(); break; case TokenizeState::State::Comment: tokenizeComment(); break; } } // Write to target token (if specified) if (target) { // How is this slower than using += in a loop as below? Just wxString things >_> //target->text.assign( // data_.data() + state_.current_token.pos_start, // state_.position - state_.current_token.pos_start //); target->text.Empty(); for (unsigned a = state_.current_token.pos_start; a < state_.position; ++a) { if (state_.current_token.quoted_string && data_[a] == '\\') ++a; target->text += data_[a]; } target->line_no = state_.current_token.line_no; target->quoted_string = state_.current_token.quoted_string; target->pos_start = state_.current_token.pos_start; target->pos_end = state_.position; target->length = target->pos_end - target->pos_start; target->valid = true; // Convert to lowercase if configured to and it isn't a quoted string if (read_lowercase_ && !target->quoted_string) target->text.LowerCase(); } // Skip closing " if it was a quoted string if (state_.current_token.quoted_string) ++state_.position; if (debug_) Log::debug(S_FMT("%d: \"%s\"", token_current_.line_no, CHR(token_current_.text))); return true; }
lexnest(struct vars * v, const chr *beginp, /* start of interpolation */ const chr *endp) /* one past end of interpolation */ { assert(v->savenow == NULL); /* only one level of nesting */ v->savenow = v->now; v->savestop = v->stop; v->now = beginp; v->stop = endp; } /* * string constants to interpolate as expansions of things like \d */ static const chr backd[] = { /* \d */ CHR('['), CHR('['), CHR(':'), CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'), CHR(':'), CHR(']'), CHR(']') }; static const chr backD[] = { /* \D */ CHR('['), CHR('^'), CHR('['), CHR(':'), CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'), CHR(':'), CHR(']'), CHR(']') }; static const chr brbackd[] = { /* \d within brackets */ CHR('['), CHR(':'), CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'), CHR(':'), CHR(']') }; static const chr backs[] = { /* \s */ CHR('['), CHR('['), CHR(':'),
static HRESULT PopulateNetworkList(PWLAN_INFO psInfo) { HRESULT hr = S_OK; LPCTSTR pszConnected, pszConnecting, pszAvailable, pszUnavailable; LV_ITEM lv = { 0 }; UINT i, cConfigs; BOOL fNetAvailable = FALSE; CBREx(psInfo, E_INVALIDARG); // Load strings pszConnected = (LPCTSTR)LoadString(HINST_RESDLL, IDS_WZC_ACTIVE, NULL, 0); CBRA(NULL != pszConnected); pszConnecting = (LPCTSTR)LoadString(HINST_RESDLL, IDS_WZC_CONNECTING, NULL, 0); CBRA(NULL != pszConnecting); pszAvailable = (LPCTSTR)LoadString(HINST_RESDLL, IDS_WZC_AIRING, NULL, 0); CBRA(NULL != pszAvailable); pszUnavailable = (LPCTSTR)LoadString(HINST_RESDLL, IDS_WZC_SILENT, NULL, 0); CBRA(NULL != pszUnavailable); // Add the first setting item hr = InsertFirstSettingsItem(psInfo); CHR(hr); // Get the network list hr = SHWZCGetAllNetworks(psInfo->hshwzc, &psInfo->hdsaNetworks); CHR(hr); // Are there any items? cConfigs = DSA_GetItemCount(psInfo->hdsaNetworks); CBREx(0 != cConfigs, S_FALSE); ListView_SetItemCount(psInfo->hwndNetList, cConfigs + 1); // Add the networks to the list for (i = 0; i != cConfigs; ++i) { PCSHWZCNET pwzcnet = (PSHWZCNET)DSA_GetItemPtr(psInfo->hdsaNetworks, i); BOOL fAdhoc = (SHWZCF_NET_ADHOC & pwzcnet->dwFlags); BOOL fSecure; LPCTSTR pszDesc; int nIndex; BOOL fUseSignalStrength = FALSE; // If this network is AP, mark it if (FALSE == fAdhoc) { psInfo->fAPAir = TRUE; fUseSignalStrength = TRUE; } // network is considered secure if it's 802.1x, or not OPEN and without // encryption enabled fSecure = BOOLIFY(pwzcnet->dwFlags & SHWZCF_NET_8021X) || !( ( (Ndis802_11Encryption1Enabled != pwzcnet->dwEncryptionType) && (Ndis802_11Encryption2Enabled != pwzcnet->dwEncryptionType) && (Ndis802_11Encryption3Enabled != pwzcnet->dwEncryptionType) ) && (Ndis802_11AuthModeOpen == pwzcnet->dwAuthentication) ); // Get the icon and the description for the network if (SHWZCF_NET_CONNECTED & pwzcnet->dwFlags) { lv.iImage = fAdhoc ? WZCIMG_ADHOC_ACTIVE : 0; pszDesc = pszConnected; } else if (SHWZCF_NET_CONNECTING & pwzcnet->dwFlags) { lv.iImage = fAdhoc ? WZCIMG_ADHOC_AIRING : 0; pszDesc = pszConnecting; } else if (SHWZCF_NET_BROADCAST & pwzcnet->dwFlags) { lv.iImage = fAdhoc ? WZCIMG_ADHOC_AIRING : 0; pszDesc = pszAvailable; } else { ASSERT(SHWZCF_NET_PREFERRED & pwzcnet->dwFlags); lv.iImage = fAdhoc ? WZCIMG_ADHOC_SILENT : WZCIMG_INFRA_SILENT; pszDesc = pszUnavailable; // no need to get signal strength fUseSignalStrength = FALSE; } if (SHWZCF_NET_BROADCAST & pwzcnet->dwFlags) { fNetAvailable = TRUE; } // Update the icon to have signal strength if we're in Infrastructure mode if (fUseSignalStrength) { UINT uiStrength = pwzcnet->nRssi; if (uiStrength) { lv.iImage = WZCIMG_SIGNAL_1 + uiStrength - 1; if (fSecure) { lv.iImage += WZCIMG_SIGNAL_SECURE_1 - WZCIMG_SIGNAL_1; } } else { lv.iImage = WZCIMG_INFRA_SILENT; } } ASSERT(lv.iImage); // Insert the item into the listview lv.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; lv.iItem = i; lv.iSubItem = 0; lv.pszText = (LPTSTR)pwzcnet->szName; lv.lParam = (LPARAM)pwzcnet; nIndex = ListView_InsertItem(psInfo->hwndNetList, &lv); CBR(0 <= nIndex); // Set the state text lv.mask = LVIF_TEXT; lv.iItem = nIndex; lv.iSubItem = 1; lv.pszText = (LPTSTR)pszDesc; CBR(ListView_SetItem(psInfo->hwndNetList, &lv)); } // Sort the networks CBREx(ListView_SortItems(psInfo->hwndNetList, CompareNetworks, NULL), E_OUTOFMEMORY); Error: if(psInfo) { SetCursor(psInfo->hOldCursor); psInfo->hOldCursor = NULL; // We just turned power on, but didn't find any broadcasting networks if((psInfo->bUserInitiatedSearch) && (!fNetAvailable) && (psInfo->dwHWFlags & SHWZCF_HW_ON)) { psInfo->bUserInitiatedSearch = FALSE; SH_BOXEX sbex = {0}; sbex.cbSize = sizeof(sbex); sbex.dwStyle = SHBEXF_CLOSE_ON_ACTIVATION_LOSS|SHBEXF_SUPRESS_DEFAULT_SOUND; sbex.nTimeOut = 0; sbex.hwndOwner = psInfo->hDlg; sbex.sbextype = sbextTextBox; sbex.info.ti.pszText = LoadStringEtc(HINST_RESDLL, IDS_WZC_WIFI_SEARCH_ERROR, NULL); sbex.info.ti.bi.cButtons = 1; SHBoxEx(&sbex); } psInfo->bUserInitiatedSearch = FALSE; } return hr; }
/* * newline - return the chr for a newline * * This helps confine use of CHR to this source file. */ static chr newline(void) { return CHR('\n'); }
HRESULT IsNetworkSecure(__in __opt LPCTSTR pszSSID, BOOL fUse8021x, DWORD dwAuthentication, DWORD dwEncryption, __out __opt LPTSTR *ppszSSIDDisplay, DWORD cxpExtent, BOOL fEscapeHtml) { HRESULT hr = S_FALSE; BOOL fSecure; HDC hdcScreen = NULL; // if 802.1x or NOT open and unencrypted then it's secure fSecure = fUse8021x || !( (Ndis802_11AuthModeOpen == dwAuthentication) && !CWZCManagerWireless::IsEncrypted(dwEncryption) ); hr = fSecure ? S_OK : S_FALSE; if (NULL != ppszSSIDDisplay) { TCHAR szSSIDEllipsized[MAX_SSID_LEN + ARRAYSIZE(c_szEllipsis)]; LPVOID rgpvArgs[] = {szSSIDEllipsized}; int cchTry, cchSSID, cchFit; SIZE size; CPREx(pszSSID, E_INVALIDARG); // caller wants the string *ppszSSIDDisplay = NULL; hdcScreen = GetDC(NULL); cchSSID = lstrlen(pszSSID); // work backwards from the full string less one char for (cchTry = cchSSID; cchTry >= 0; cchTry--) { hr = StringCchCopyN(szSSIDEllipsized, ARRAYSIZE(szSSIDEllipsized), pszSSID, cchTry); CHR(hr); if (cchTry < cchSSID) { // second and successive times, ellipsize hr = StringCchCat(szSSIDEllipsized, ARRAYSIZE(szSSIDEllipsized), c_szEllipsis); VHR(hr); } LocalFree(*ppszSSIDDisplay); CWR(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, (LPTSTR)LoadString(HINST_RESDLL, fSecure ? IDS_WZC_NETSEL_FORMAT_SECURE_NETWORK : IDS_WZC_NETSEL_FORMAT_OPEN_NETWORK, NULL, 0), 0, 0, (LPTSTR)ppszSSIDDisplay, 0, (va_list *)rgpvArgs)); VBR(GetTextExtentExPoint(hdcScreen, *ppszSSIDDisplay, lstrlen(*ppszSSIDDisplay), cxpExtent, &cchFit, NULL, &size)); // need to continue lopping? if (size.cx <= (int)cxpExtent) { if (fEscapeHtml) { // Create the escaped version of the SSID hr = EscapeHtmlString(szSSIDEllipsized, ARRAYSIZE(szSSIDEllipsized)); CHR(hr); CWR(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, (LPTSTR)LoadString(HINST_RESDLL, fSecure ? IDS_WZC_NETSEL_FORMAT_SECURE_NETWORK : IDS_WZC_NETSEL_FORMAT_OPEN_NETWORK, NULL, 0), 0, 0, (LPTSTR)ppszSSIDDisplay, 0, (va_list *)rgpvArgs)); } break; } } ASSERT(cchTry >= 0); } Error: if (FAILED(hr) && (NULL != ppszSSIDDisplay) && (NULL != *ppszSSIDDisplay)) { LocalFree(*ppszSSIDDisplay); *ppszSSIDDisplay = NULL; } if (NULL != hdcScreen) { ReleaseDC(NULL, hdcScreen); } return hr; }
/* * lexescape - parse an ARE backslash escape (backslash already eaten) * Note slightly nonstandard use of the CCLASS type code. */ static int /* not actually used, but convenient for RETV */ lexescape(struct vars * v) { chr c; static chr alert[] = { CHR('a'), CHR('l'), CHR('e'), CHR('r'), CHR('t') }; static chr esc[] = { CHR('E'), CHR('S'), CHR('C') }; const chr *save; assert(v->cflags & REG_ADVF); assert(!ATEOS()); c = *v->now++; if (!iscalnum(c)) RETV(PLAIN, c); NOTE(REG_UNONPOSIX); switch (c) { case CHR('a'): RETV(PLAIN, chrnamed(v, alert, ENDOF(alert), CHR('\007'))); break; case CHR('A'): RETV(SBEGIN, 0); break; case CHR('b'): RETV(PLAIN, CHR('\b')); break; case CHR('B'): RETV(PLAIN, CHR('\\')); break; case CHR('c'): NOTE(REG_UUNPORT); if (ATEOS()) FAILW(REG_EESCAPE); RETV(PLAIN, (chr) (*v->now++ & 037)); break; case CHR('d'): NOTE(REG_ULOCALE); RETV(CCLASS, 'd'); break; case CHR('D'): NOTE(REG_ULOCALE); RETV(CCLASS, 'D'); break; case CHR('e'): NOTE(REG_UUNPORT); RETV(PLAIN, chrnamed(v, esc, ENDOF(esc), CHR('\033'))); break; case CHR('f'): RETV(PLAIN, CHR('\f')); break; case CHR('m'): RET('<'); break; case CHR('M'): RET('>'); break; case CHR('n'): RETV(PLAIN, CHR('\n')); break; case CHR('r'): RETV(PLAIN, CHR('\r')); break; case CHR('s'): NOTE(REG_ULOCALE); RETV(CCLASS, 's'); break; case CHR('S'): NOTE(REG_ULOCALE); RETV(CCLASS, 'S'); break; case CHR('t'): RETV(PLAIN, CHR('\t')); break; case CHR('u'): c = lexdigits(v, 16, 4, 4); if (ISERR()) FAILW(REG_EESCAPE); RETV(PLAIN, c); break; case CHR('U'): c = lexdigits(v, 16, 8, 8); if (ISERR()) FAILW(REG_EESCAPE); RETV(PLAIN, c); break; case CHR('v'): RETV(PLAIN, CHR('\v')); break; case CHR('w'): NOTE(REG_ULOCALE); RETV(CCLASS, 'w'); break; case CHR('W'): NOTE(REG_ULOCALE); RETV(CCLASS, 'W'); break; case CHR('x'): NOTE(REG_UUNPORT); c = lexdigits(v, 16, 1, 255); /* REs >255 long outside spec */ if (ISERR()) FAILW(REG_EESCAPE); RETV(PLAIN, c); break; case CHR('y'): NOTE(REG_ULOCALE); RETV(WBDRY, 0); break; case CHR('Y'): NOTE(REG_ULOCALE); RETV(NWBDRY, 0); break; case CHR('Z'): RETV(SEND, 0); break; case CHR('1'): case CHR('2'): case CHR('3'): case CHR('4'): case CHR('5'): case CHR('6'): case CHR('7'): case CHR('8'): case CHR('9'): save = v->now; v->now--; /* put first digit back */ c = lexdigits(v, 10, 1, 255); /* REs >255 long outside spec */ if (ISERR()) FAILW(REG_EESCAPE); /* ugly heuristic (first test is "exactly 1 digit?") */ if (v->now == save || ((int) c > 0 && (int) c <= v->nsubexp)) { NOTE(REG_UBACKREF); RETV(BACKREF, (chr) c); } /* oops, doesn't look like it's a backref after all... */ v->now = save; /* and fall through into octal number */ case CHR('0'): NOTE(REG_UUNPORT); v->now--; /* put first digit back */ c = lexdigits(v, 8, 1, 3); if (ISERR()) FAILW(REG_EESCAPE); RETV(PLAIN, c); break; default: assert(iscalpha(c)); FAILW(REG_EESCAPE); /* unknown alphabetic escape */ break; } assert(NOTREACHED); }
DWORD RasEapInvokeInteractiveUI( IN DWORD dwEapTypeId, IN HWND hwndParent, IN BYTE* pUIContextData, IN DWORD dwSizeofUIContextData, OUT BYTE** ppDataFromInteractiveUI, OUT DWORD* pdwSizeOfDataFromInteractiveUI ) { HRESULT hr = E_FAIL; // assume not supported UNREFERENCED_PARAMETER(dwSizeofUIContextData); if (PPP_EAP_TLS == dwEapTypeId) { EAPEXTUI_INPUT *pExtUIInput; *ppDataFromInteractiveUI = NULL; *pdwSizeOfDataFromInteractiveUI = 0; pExtUIInput = (EAPEXTUI_INPUT *)pUIContextData; if (NULL != pExtUIInput && pExtUIInput->dwVersion == 1 && pExtUIInput->dwSize >= sizeof(EAPEXTUI_INPUT) ) { hr = S_OK; // assume success switch(pExtUIInput->dwCode) { default: CBR(FALSE); case EAPEXTUI_CODE_CLIENTAUTH_ERROR: break; case EAPEXTUI_CODE_SERVERAUTH_ERROR: { TCHAR szMutexName[64]; LPCTSTR pszErrorTitle; LPCTSTR pszErrorString; UINT uStringID; UINT uType = MB_OK; HANDLE hMutex; if (pExtUIInput->fFlags & EAPEXTUI_FLAG_RESPONSE) { // response expected uType = MB_YESNO; } switch (pExtUIInput->dwStatus) { case SEC_E_UNTRUSTED_ROOT: uStringID = IDS_NETUI_UNKNOWN_ROOT_ERROR; break; case SEC_E_CERT_UNKNOWN: uStringID = IDS_NETUI_UNKNOWN_CERT_ERROR; break; case SEC_E_CERT_EXPIRED: uStringID = IDS_NETUI_CERT_EXPIRED_ERROR; break; default: uStringID = IDS_NETUI_GENERIC_CERT_ERROR; break; } pszErrorTitle = (LPCTSTR)LoadString(HINST_RESDLL, IDS_NETUI_SERVER_VALIDATION_ERROR, NULL, 0); CBRA(NULL != pszErrorTitle); pszErrorString = (LPCTSTR)LoadString(HINST_RESDLL, uStringID, NULL, 0); CBRA(NULL != pszErrorString); hr = StringCchPrintf(szMutexName, ARRAYSIZE(szMutexName), TEXT("%s%X"), TEXT("IPInteractUI"), uStringID); CHR(hr); hMutex = CheckPrevInstance(szMutexName); if(INVALID_HANDLE_VALUE != hMutex) { int nRet = MessageBox(SHGetLastActiveWindow(hwndParent), pszErrorString, pszErrorTitle, uType | MB_TOPMOST | MB_SETFOREGROUND); CloseHandle(hMutex); if (pExtUIInput->fFlags & EAPEXTUI_FLAG_RESPONSE) { // response expected EAPEXTUI_OUTPUT *pExtUIOutput = (EAPEXTUI_OUTPUT *)LocalAlloc(LPTR, sizeof(EAPEXTUI_OUTPUT)); if (pExtUIOutput) { pExtUIOutput->dwVersion =1; pExtUIOutput->dwSize = sizeof(EAPEXTUI_OUTPUT); pExtUIOutput->dwValue = nRet; *ppDataFromInteractiveUI = (PBYTE)pExtUIOutput; *pdwSizeOfDataFromInteractiveUI = pExtUIOutput->dwSize; } } } } // case EAPEXTUI_CODE_SERVERAUTH_ERROR break; } } } Error: return SUCCEEDED(hr) ? NO_ERROR : ERROR_NOT_SUPPORTED; }
/* * brenext - get next BRE token * * This is much like EREs except for all the stupid backslashes and the * context-dependency of some things. */ static int /* 1 normal, 0 failure */ brenext(struct vars * v, chr pc) { chr c = (chr) pc; switch (c) { case CHR('*'): if (LASTTYPE(EMPTY) || LASTTYPE('(') || LASTTYPE('^')) RETV(PLAIN, c); RET('*'); break; case CHR('['): if (HAVE(6) && *(v->now + 0) == CHR('[') && *(v->now + 1) == CHR(':') && (*(v->now + 2) == CHR('<') || *(v->now + 2) == CHR('>')) && *(v->now + 3) == CHR(':') && *(v->now + 4) == CHR(']') && *(v->now + 5) == CHR(']')) { c = *(v->now + 2); v->now += 6; NOTE(REG_UNONPOSIX); RET((c == CHR('<')) ? '<' : '>'); } INTOCON(L_BRACK); if (NEXT1('^')) { v->now++; RETV('[', 0); } RETV('[', 1); break; case CHR('.'): RET('.'); break; case CHR('^'): if (LASTTYPE(EMPTY)) RET('^'); if (LASTTYPE('(')) { NOTE(REG_UUNSPEC); RET('^'); } RETV(PLAIN, c); break; case CHR('$'): if (v->cflags & REG_EXPANDED) skip(v); if (ATEOS()) RET('$'); if (NEXT2('\\', ')')) { NOTE(REG_UUNSPEC); RET('$'); } RETV(PLAIN, c); break; case CHR('\\'): break; /* see below */ default: RETV(PLAIN, c); break; } assert(c == CHR('\\')); if (ATEOS()) FAILW(REG_EESCAPE); c = *v->now++; switch (c) { case CHR('{'): INTOCON(L_BBND); NOTE(REG_UBOUNDS); RET('{'); break; case CHR('('): RETV('(', 1); break; case CHR(')'): RETV(')', c); break; case CHR('<'): NOTE(REG_UNONPOSIX); RET('<'); break; case CHR('>'): NOTE(REG_UNONPOSIX); RET('>'); break; case CHR('1'): case CHR('2'): case CHR('3'): case CHR('4'): case CHR('5'): case CHR('6'): case CHR('7'): case CHR('8'): case CHR('9'): NOTE(REG_UBACKREF); RETV(BACKREF, (chr) DIGITVAL(c)); break; default: if (iscalnum(c)) { NOTE(REG_UBSALNUM); NOTE(REG_UUNSPEC); } RETV(PLAIN, c); break; } assert(NOTREACHED); return 0; }
DWORD EapTlsInvokeConfigUI( IN DWORD dwEapTypeId, IN HWND hwndParent, IN DWORD dwFlags, IN BYTE* pConnectionDataIn, IN DWORD dwSizeOfConnectionDataIn, OUT BYTE** ppConnectionDataOut, OUT DWORD* pdwSizeOfConnectionDataOut ) { UNREFERENCED_PARAMETER(dwFlags); EAPTLS_CONN_PROPERTIES_V1* pConnProp = NULL; PCCERT_CONTEXT pCertContext = NULL; HCERTSTORE hMyStore = NULL; DWORD dwErr = NO_ERROR; HRESULT hr = S_OK; DWORD cbHash = 0, dwConnFlags; BYTE bHash[MAX_HASH_SIZE], *pbHashCert = NULL; BOOL bSuccess, fCapi2 = FALSE; INT cnCerts = 0, nSelected = -1; DWORD dwValidServerClert, dwType, cb; hr = LoadCAPI2(); CHR(hr); fCapi2 = TRUE; dwConnFlags = (dwEapTypeId == PPP_EAP_PEAP) ? EAPTLS_CONN_FLAG_NO_CLIENT_CERT : 0; cb = sizeof(dwValidServerClert); if (ERROR_SUCCESS == SHRegQueryValueEx(HKEY_CURRENT_USER, c_szValidateServerCert, (DWORD *)c_szRegistryKey, &dwType, (BYTE *)&dwValidServerClert, &cb)) { CBR(REG_DWORD == dwType); // dwValidServerClert = 0 - don't validate server certification if (dwValidServerClert == 0) { dwConnFlags |= EAPTLS_CONN_FLAG_NO_VALIDATE_CERT; // we do not validate server cert by default } } else { // We dvalidates server cert by default } pConnProp = InitConnectionData(pConnectionDataIn, dwSizeOfConnectionDataIn, dwConnFlags); CPR(pConnProp); hMyStore = pfnCertOpenStore(CERT_STORE_PROV_SYSTEM_W, CRYPT_ASN_ENCODING, 0, CERT_SYSTEM_STORE_CURRENT_USER, TEXT("MY")); CBR(hMyStore); // Enum on personal cert store while (NULL != (pCertContext = pfnCertEnumCertificatesInStore(hMyStore, pCertContext))) { BYTE bHashTemp[MAX_HASH_SIZE]; DWORD cbHashTemp = ARRAYSIZE(bHashTemp); bSuccess = pfnCertGetCertificateContextProperty(pCertContext, CERT_HASH_PROP_ID, bHashTemp, &cbHashTemp); if ( nSelected < 0 // There is matched cert && cbHashTemp && cbHashTemp == pConnProp->UserHash.cbHash // The size of certs are equal && memcmp(bHashTemp, pConnProp->UserHash.pbHash, cbHashTemp) == 0) { nSelected = cnCerts; cbHash = cbHashTemp; memcpy(bHash, bHashTemp, cbHash); } cnCerts++; } if (cnCerts == 0) { // There is no cert on the device, warrning! MessageBox(SHGetLastActiveWindow(hwndParent), (PTSTR)LoadString(HINST_RESDLL, IDS_NETUI_EAPTLS_NO_CERT, NULL, 0), (PTSTR)LoadString(HINST_RESDLL, IDS_NETUI_WRN_TITLE_WARNING, NULL, 0), MB_OK | MB_SETFOREGROUND); dwErr = ERROR_NOT_FOUND; } else if (cnCerts > 0) { DWORD cbHashCert = 0; // Need to let user choice one hr = PickCertificateDlg(NULL, TEXT("MY"), c_szPickCertHelpLink, (PTSTR)LoadString(HINST_RESDLL, IDS_NETUI_EAPTLS_DESC, NULL, 0), bHash, cbHash, &pbHashCert, &cbHashCert); CHR(hr); CBRA(cbHashCert <= MAX_HASH_SIZE); memcpy(pConnProp->UserHash.pbHash, pbHashCert, cbHashCert); pConnProp->UserHash.cbHash = cbHashCert; *ppConnectionDataOut = (BYTE*)pConnProp; *pdwSizeOfConnectionDataOut = pConnProp->dwSize; } Error: pfnCertFreeCertificateContext(pCertContext); pfnCertCloseStore(hMyStore, 0); LocalFree(pbHashCert); if (fCapi2) { FreeCAPI2(); } return FAILED(hr) ? ERROR_NOT_FOUND : dwErr; }
// ----------------------------------------------------------------------------- // Writes the disk archive to a MemChunk. // Returns true if successful, false otherwise // ----------------------------------------------------------------------------- bool DiskArchive::write(MemChunk& mc, bool update) { // Clear current data mc.clear(); // Get archive tree as a list vector<ArchiveEntry*> entries; getEntryTreeAsList(entries); // Process entry list uint32_t num_entries = 0; uint32_t size_entries = 0; for (unsigned a = 0; a < entries.size(); a++) { // Ignore folder entries if (entries[a]->getType() == EntryType::folderType()) continue; // Increment directory offset and size size_entries += entries[a]->getSize(); ++num_entries; } // Init data size uint32_t start_offset = 8 + (num_entries * 72); uint32_t offset = start_offset; mc.reSize(size_entries + start_offset, false); // Write header num_entries = wxUINT32_SWAP_ON_LE(num_entries); mc.seek(0, SEEK_SET); mc.write(&num_entries, 4); // Write directory for (unsigned a = 0; a < entries.size(); a++) { // Skip folders if (entries[a]->getType() == EntryType::folderType()) continue; // Update entry if (update) { entries[a]->setState(0); entries[a]->exProp("Offset") = (int)offset; } // Check entry name string name = entries[a]->getPath(true); name.Replace("/", "\\"); // The leading "GAME:\" part of the name means there is only 58 usable characters for path if (name.Len() > 58) { LOG_MESSAGE( 1, "Warning: Entry %s path is too long (> 58 characters), putting it in the root directory", name); wxFileName fn(name); name = fn.GetFullName(); if (name.Len() > 57) name.Truncate(57); // Add leading "\" name = "\\" + name; } name = "GAME:" + name; DiskEntry dent; // Write entry name // The names field are padded with FD for doom.disk, FE for doom2.disk. No idea whether // a non-null padding is actually required, though. It probably should work with anything. memset(dent.name, 0xFE, 64); memcpy(dent.name, CHR(name), name.Length()); dent.name[name.Length()] = 0; // Write entry offset dent.offset = wxUINT32_SWAP_ON_LE(offset - start_offset); // Write entry size dent.length = wxUINT32_SWAP_ON_LE(entries[a]->getSize()); // Actually write stuff mc.write(&dent, 72); // Increment/update offset offset += wxUINT32_SWAP_ON_LE(dent.length); } // Finish writing header size_entries = wxUINT32_SWAP_ON_LE(size_entries); mc.write(&size_entries, 4); // Write entry data for (unsigned a = 0; a < entries.size(); a++) { // Skip folders if (entries[a]->getType() == EntryType::folderType()) continue; // Write data mc.write(entries[a]->getData(), entries[a]->getSize()); } return true; }
/* Console::execute * Attempts to execute the command line given *******************************************************************/ void Console::execute(string command) { wxLogMessage("> %s", command); // Don't bother doing anything else with an empty command if (command.size() == 0) return; // Add the command to the log cmd_log.insert(cmd_log.begin(), command); // Announce that a command has been executed MemChunk mc; announce("console_execute", mc); // Tokenize the command string Tokenizer tz; tz.openString(command); // Get the command name string cmd_name = tz.getToken(); // Get all args string arg = tz.getToken(); vector<string> args; while (arg != "") { args.push_back(arg); arg = tz.getToken(); } // Check that it is a valid command for (size_t a = 0; a < commands.size(); a++) { // Found it, execute and return if (commands[a].getName() == cmd_name) { commands[a].execute(args); return; } } // Check if it is a cvar CVar* cvar = get_cvar(cmd_name); if (cvar) { // Arg(s) given, set cvar value if (args.size() > 0) { if (cvar->type == CVAR_BOOLEAN) { if (args[0] == "0" || args[0] == "false") *((CBoolCVar*)cvar) = false; else *((CBoolCVar*)cvar) = true; } else if (cvar->type == CVAR_INTEGER) *((CIntCVar*)cvar) = atoi(CHR(args[0])); else if (cvar->type == CVAR_FLOAT) *((CFloatCVar*)cvar) = (float)atof(CHR(args[0])); else if (cvar->type == CVAR_STRING) *((CStringCVar*)cvar) = args[0]; } // Print cvar value string value = ""; if (cvar->type == CVAR_BOOLEAN) { if (cvar->GetValue().Bool) value = "true"; else value = "false"; } else if (cvar->type == CVAR_INTEGER) value = S_FMT("%d", cvar->GetValue().Int); else if (cvar->type == CVAR_FLOAT) value = S_FMT("%1.4f", cvar->GetValue().Float); else value = ((CStringCVar*)cvar)->value; logMessage(S_FMT("\"%s\" = \"%s\"", cmd_name, value)); if (cmd_name == "log_verbosity") Global::log_verbosity = cvar->GetValue().Int; return; } // Toggle global debug mode if (cmd_name == "debug") { Global::debug = !Global::debug; if (Global::debug) logMessage("Debugging stuff enabled"); else logMessage("Debugging stuff disabled"); return; } // Command not found logMessage(S_FMT("Unknown command: \"%s\"", cmd_name)); return; }
static void _dump_register_dst( struct dump_ctx *ctx, const struct tgsi_full_dst_register *dst ) { TXT(tgsi_file_name(dst->Register.File)); if (dst->Register.Dimension) { if (dst->Dimension.Indirect) { CHR( '[' ); TXT(tgsi_file_name(dst->DimIndirect.File)); CHR( '[' ); SID( dst->DimIndirect.Index ); TXT( "]." ); ENM( dst->DimIndirect.Swizzle, tgsi_swizzle_names ); if (dst->Dimension.Index != 0) { if (dst->Dimension.Index > 0) CHR( '+' ); SID( dst->Dimension.Index ); } CHR( ']' ); if (dst->DimIndirect.ArrayID) { CHR( '(' ); SID( dst->DimIndirect.ArrayID ); CHR( ')' ); } } else { CHR('['); SID(dst->Dimension.Index); CHR(']'); } } if (dst->Register.Indirect) { CHR( '[' ); TXT(tgsi_file_name(dst->Indirect.File)); CHR( '[' ); SID( dst->Indirect.Index ); TXT( "]." ); ENM( dst->Indirect.Swizzle, tgsi_swizzle_names ); if (dst->Register.Index != 0) { if (dst->Register.Index > 0) CHR( '+' ); SID( dst->Register.Index ); } CHR( ']' ); if (dst->Indirect.ArrayID) { CHR( '(' ); SID( dst->Indirect.ArrayID ); CHR( ')' ); } } else { CHR( '[' ); SID( dst->Register.Index ); CHR( ']' ); } }
// ----------------------------------------------------------------------------- // Writes the gzip archive to a MemChunk // Returns true if successful, false otherwise // ----------------------------------------------------------------------------- bool GZipArchive::write(MemChunk& mc, bool update) { // Clear current data mc.clear(); if (numEntries() == 1) { MemChunk stream; if (Compression::GZipDeflate(getEntry(0)->getMCData(), stream, 9)) { const uint8_t* data = stream.getData(); uint32_t working = 0; size_t size = stream.getSize(); if (size < 18) return false; // zlib will have given us a minimal header, so we make our own uint8_t header[4]; header[0] = GZIP_ID1; header[1] = GZIP_ID2; header[2] = GZIP_DEFLATE; header[3] = flags_; mc.write(header, 4); // Update mtime if the file was modified if (getEntry(0)->getState()) { mtime_ = ::wxGetLocalTime(); } // Write mtime working = wxUINT32_SWAP_ON_BE(mtime_); mc.write(&working, 4); // Write other stuff mc.write(&xfl_, 1); mc.write(&os_, 1); // Any extra content that may have been there if (flags_ & GZIP_FLG_FXTRA) { uint16_t xlen = wxUINT16_SWAP_ON_BE(xtra_.getSize()); mc.write(&xlen, 2); mc.write(xtra_.getData(), xtra_.getSize()); } // File name, if not extrapolated from archive name if (flags_ & GZIP_FLG_FNAME) { mc.write(CHR(getEntry(0)->getName()), getEntry(0)->getName().length()); uint8_t zero = 0; mc.write(&zero, 1); // Terminate string } // Comment, if there were actually one if (flags_ & GZIP_FLG_FCMNT) { mc.write(CHR(comment_), comment_.length()); uint8_t zero = 0; mc.write(&zero, 1); // Terminate string } // And finally, the half CRC, which we recalculate if (flags_ & GZIP_FLG_FHCRC) { uint32_t fullcrc = Misc::crc(mc.getData(), mc.getSize()); uint16_t hcrc = (fullcrc & 0x0000FFFF); hcrc = wxUINT16_SWAP_ON_BE(hcrc); mc.write(&hcrc, 2); } // Now that the pleasantries are dispensed with, // let's get with the meat of the matter return mc.write(data + 10, size - 10); } } return false; }
static boolean iter_declaration( struct tgsi_iterate_context *iter, struct tgsi_full_declaration *decl ) { struct dump_ctx *ctx = (struct dump_ctx *)iter; TXT( "DCL " ); ENM(decl->Declaration.File, tgsi_file_names); /* all geometry shader inputs are two dimensional */ if (decl->Declaration.File == TGSI_FILE_INPUT && iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) { TXT("[]"); } if (decl->Declaration.Dimension) { CHR('['); SID(decl->Dim.Index2D); CHR(']'); } CHR('['); SID(decl->Range.First); if (decl->Range.First != decl->Range.Last) { TXT(".."); SID(decl->Range.Last); } CHR(']'); _dump_writemask( ctx, decl->Declaration.UsageMask ); if (decl->Declaration.Local) TXT( ", LOCAL" ); if (decl->Declaration.Semantic) { TXT( ", " ); ENM( decl->Semantic.Name, tgsi_semantic_names ); if (decl->Semantic.Index != 0 || decl->Semantic.Name == TGSI_SEMANTIC_GENERIC) { CHR( '[' ); UID( decl->Semantic.Index ); CHR( ']' ); } } if (decl->Declaration.File == TGSI_FILE_RESOURCE) { TXT(", "); ENM(decl->Resource.Resource, tgsi_texture_names); if (decl->Resource.Writable) TXT(", WR"); if (decl->Resource.Raw) TXT(", RAW"); } if (decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) { TXT(", "); ENM(decl->SamplerView.Resource, tgsi_texture_names); TXT(", "); if ((decl->SamplerView.ReturnTypeX == decl->SamplerView.ReturnTypeY) && (decl->SamplerView.ReturnTypeX == decl->SamplerView.ReturnTypeZ) && (decl->SamplerView.ReturnTypeX == decl->SamplerView.ReturnTypeW)) { ENM(decl->SamplerView.ReturnTypeX, tgsi_type_names); } else { ENM(decl->SamplerView.ReturnTypeX, tgsi_type_names); TXT(", "); ENM(decl->SamplerView.ReturnTypeY, tgsi_type_names); TXT(", "); ENM(decl->SamplerView.ReturnTypeZ, tgsi_type_names); TXT(", "); ENM(decl->SamplerView.ReturnTypeW, tgsi_type_names); } } if (decl->Declaration.Interpolate) { if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT && decl->Declaration.File == TGSI_FILE_INPUT) { TXT( ", " ); ENM( decl->Interp.Interpolate, tgsi_interpolate_names ); } if (decl->Interp.Centroid) { TXT( ", CENTROID" ); } if (decl->Interp.CylindricalWrap) { TXT(", CYLWRAP_"); if (decl->Interp.CylindricalWrap & TGSI_CYLINDRICAL_WRAP_X) { CHR('X'); } if (decl->Interp.CylindricalWrap & TGSI_CYLINDRICAL_WRAP_Y) { CHR('Y'); } if (decl->Interp.CylindricalWrap & TGSI_CYLINDRICAL_WRAP_Z) { CHR('Z'); } if (decl->Interp.CylindricalWrap & TGSI_CYLINDRICAL_WRAP_W) { CHR('W'); } } } if (decl->Declaration.Invariant) { TXT( ", INVARIANT" ); } if (decl->Declaration.File == TGSI_FILE_IMMEDIATE_ARRAY) { unsigned i; char range_indent[4]; TXT(" {"); if (decl->Range.Last < 10) range_indent[0] = '\0'; else if (decl->Range.Last < 100) { range_indent[0] = ' '; range_indent[1] = '\0'; } else if (decl->Range.Last < 1000) { range_indent[0] = ' '; range_indent[1] = ' '; range_indent[2] = '\0'; } else { range_indent[0] = ' '; range_indent[1] = ' '; range_indent[2] = ' '; range_indent[3] = '\0'; } dump_imm_data(iter, decl->ImmediateData.u, 4, TGSI_IMM_FLOAT32); for(i = 1; i <= decl->Range.Last; ++i) { /* indent by strlen of: * "DCL IMMX[0..1] {" */ CHR('\n'); TXT( " " ); TXT( range_indent ); dump_imm_data(iter, decl->ImmediateData.u + i, 4, TGSI_IMM_FLOAT32); } TXT(" }"); } EOL(); return TRUE; }
static struct lookup_subtable *VSubtableFromH(struct lookupmap *lookupmap,struct lookup_subtable *sub) { int i, lc, sc; OTLookup *otl; struct lookup_subtable *nsub, *prev, *test, *ls; FeatureScriptLangList *fl; for ( i=0 ; i<lookupmap->sc; ++i ) if ( lookupmap->smap[i].from == sub ) return( lookupmap->smap[i].to ); if ( lookupmap->lmap==NULL ) { for ( otl = lookupmap->sf->gpos_lookups, lc=sc=0; otl!=NULL; otl=otl->next ) { if ( otl->lookup_type==gpos_pair ) { ++lc; for ( ls=otl->subtables; ls!=NULL; ls=ls->next ) ++sc; } } lookupmap->lmap = malloc(lc*sizeof(struct otlmap)); lookupmap->smap = malloc(sc*sizeof(struct submap)); } for ( i=0 ; i<lookupmap->lc; ++i ) if ( lookupmap->lmap[i].from == sub->lookup ) break; if ( i==lookupmap->lc ) { ++lookupmap->lc; lookupmap->lmap[i].from = sub->lookup; lookupmap->lmap[i].to = otl = chunkalloc(sizeof(OTLookup)); otl->lookup_type = gpos_pair; otl->features = FeatureListCopy(sub->lookup->features); for ( fl=otl->features; fl!=NULL; fl=fl->next ) if ( fl->featuretag == CHR('k','e','r','n') ) fl->featuretag = CHR('v','k','r','n'); otl->lookup_name = strconcat("V",sub->lookup->lookup_name); otl->next = sub->lookup->next; sub->lookup->next = otl; } else otl = lookupmap->lmap[i].to; sc = lookupmap->sc++; lookupmap->smap[sc].from = sub; lookupmap->smap[sc].to = nsub = chunkalloc(sizeof(struct lookup_subtable)); nsub->subtable_name = strconcat("V",sub->subtable_name); nsub->per_glyph_pst_or_kern = sub->per_glyph_pst_or_kern; nsub->vertical_kerning = true; nsub->lookup = otl; /* Order the subtables of the new lookup the same way they are ordered */ /* in the old. However there may be holes (subtables which don't get */ /* converted) */ prev = NULL; for ( test=sub->lookup->subtables; test!=NULL && test!=sub; test=test->next ) { for ( i=0 ; i<lookupmap->sc; ++i ) if ( lookupmap->smap[i].from == test ) { prev = lookupmap->smap[i].to; break; } } if ( prev!=NULL ) { nsub->next = prev->next; prev->next = nsub; } else { nsub->next = otl->subtables; otl->subtables = nsub; } return( nsub ); }
static void _dump_register_src( struct dump_ctx *ctx, const struct tgsi_full_src_register *src ) { ENM(src->Register.File, tgsi_file_names); if (src->Register.Dimension) { if (src->Dimension.Indirect) { CHR( '[' ); ENM( src->DimIndirect.File, tgsi_file_names ); CHR( '[' ); SID( src->DimIndirect.Index ); TXT( "]." ); ENM( src->DimIndirect.SwizzleX, tgsi_swizzle_names ); if (src->Dimension.Index != 0) { if (src->Dimension.Index > 0) CHR( '+' ); SID( src->Dimension.Index ); } CHR( ']' ); } else { CHR('['); SID(src->Dimension.Index); CHR(']'); } } if (src->Register.Indirect) { CHR( '[' ); ENM( src->Indirect.File, tgsi_file_names ); CHR( '[' ); SID( src->Indirect.Index ); TXT( "]." ); ENM( src->Indirect.SwizzleX, tgsi_swizzle_names ); if (src->Register.Index != 0) { if (src->Register.Index > 0) CHR( '+' ); SID( src->Register.Index ); } CHR( ']' ); } else { CHR( '[' ); SID( src->Register.Index ); CHR( ']' ); } }
// ----------------------------------------------------------------------------- // Initialises the start page // ----------------------------------------------------------------------------- void SStartPage::init() { // wxWebView #ifdef USE_WEBVIEW_STARTPAGE html_startpage_ = wxWebView::New( this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxWebViewBackendDefault, wxBORDER_NONE); html_startpage_->SetZoomType(App::platform() == App::MacOS ? wxWEBVIEW_ZOOM_TYPE_TEXT : wxWEBVIEW_ZOOM_TYPE_LAYOUT); // wxHtmlWindow #else html_startpage_ = new wxHtmlWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_NEVER, "startpage"); #endif // Add to sizer GetSizer()->Add(html_startpage_, 1, wxEXPAND); // Bind events #ifdef USE_WEBVIEW_STARTPAGE html_startpage_->Bind(wxEVT_WEBVIEW_NAVIGATING, &SStartPage::onHTMLLinkClicked, this); html_startpage_->Bind( wxEVT_WEBVIEW_ERROR, [&](wxWebViewEvent& e) { Log::error(S_FMT("wxWebView Error: %s", CHR(e.GetString()))); }); if (App::platform() == App::Platform::Windows) { html_startpage_->Bind(wxEVT_WEBVIEW_LOADED, [&](wxWebViewEvent& e) { html_startpage_->Reload(); }); } Bind(wxEVT_THREAD_WEBGET_COMPLETED, [&](wxThreadEvent& e) { latest_news_ = e.GetString(); latest_news_.Trim(); if (latest_news_ == "connect_failed" || latest_news_.empty()) latest_news_ = "<center>Unable to load latest SLADE news</center>"; load(false); }); #else html_startpage_->Bind(wxEVT_COMMAND_HTML_LINK_CLICKED, &SStartPage::onHTMLLinkClicked, this); #endif // Get data used to build the page auto res_archive = App::archiveManager().programResourceArchive(); if (res_archive) { entry_base_html_ = res_archive->entryAtPath(App::useWebView() ? "html/startpage.htm" : "html/startpage_basic.htm"); entry_css_ = res_archive->entryAtPath(web_dark_theme ? "html/theme-dark.css" : "html/theme-light.css"); entry_export_.push_back(res_archive->entryAtPath("html/base.css")); entry_export_.push_back(res_archive->entryAtPath("fonts/FiraSans-Regular.woff")); entry_export_.push_back(res_archive->entryAtPath("fonts/FiraSans-Italic.woff")); entry_export_.push_back(res_archive->entryAtPath("fonts/FiraSans-Medium.woff")); entry_export_.push_back(res_archive->entryAtPath("fonts/FiraSans-Bold.woff")); entry_export_.push_back(res_archive->entryAtPath("fonts/FiraSans-Heavy.woff")); entry_export_.push_back(res_archive->entryAtPath("logo_icon.png")); entry_export_.push_back(res_archive->entryAtPath("icons/entry_list/Rounded/archive.png")); entry_export_.push_back(res_archive->entryAtPath("icons/entry_list/Rounded/wad.png")); entry_export_.push_back(res_archive->entryAtPath("icons/entry_list/Rounded/zip.png")); entry_export_.push_back(res_archive->entryAtPath("icons/entry_list/Rounded/folder.png")); entry_export_.push_back(res_archive->entryAtPath("icons/general/open.png")); entry_export_.push_back(res_archive->entryAtPath("icons/general/newarchive.png")); entry_export_.push_back(res_archive->entryAtPath("icons/general/newzip.png")); entry_export_.push_back(res_archive->entryAtPath("icons/general/mapeditor.png")); entry_export_.push_back(res_archive->entryAtPath("icons/general/wiki.png")); // Load tips auto entry_tips = res_archive->entryAtPath("tips.txt"); if (entry_tips) { Tokenizer tz; tz.openMem((const char*)entry_tips->getData(), entry_tips->getSize(), entry_tips->getName()); while (!tz.atEnd() && tz.peekToken() != "") tips_.push_back(tz.getToken()); } } }