void LatexDocVisitor::visit(DocAnchor *anc) { if (m_hide) return; m_t << "\\label{" << stripPath(anc->file()) << "_" << anc->anchor() << "}%" << endl; if (!anc->file().isEmpty() && Config_getBool("PDF_HYPERLINKS")) { m_t << "\\hypertarget{" << stripPath(anc->file()) << "_" << anc->anchor() << "}{}%" << endl; } }
void LatexDocVisitor::visitPre(DocSection *s) { if (m_hide) return; if (Config_getBool("PDF_HYPERLINKS")) { m_t << "\\hypertarget{" << stripPath(s->file()) << "_" << s->anchor() << "}{}"; } m_t << "\\" << getSectionName(s->level()) << "{"; filter(convertCharEntitiesToUTF8(s->title().data())); m_t << "}\\label{" << stripPath(s->file()) << "_" << s->anchor() << "}" << endl; }
void LatexDocVisitor::visit(DocAnchor *anc) { if (m_hide) { return; } m_t << "\\label{" << stripPath(anc->file()) << "_" << anc->anchor() << "}%" << endl; if (!anc->file().isEmpty() && Config::getBool("latex-hyper-pdf")) { m_t << "\\hypertarget{" << stripPath(anc->file()) << "_" << anc->anchor() << "}{}%" << endl; } }
void LatexDocVisitor::visitPre(DocSection *s) { if (m_hide) { return; } if (Config::getBool("latex-hyper-pdf")) { m_t << "\\hypertarget{" << stripPath(s->file()) << "_" << s->anchor() << "}{}"; } m_t << "\\" << getSectionName(s->level()) << "{"; filter(convertCharEntities(s->title())); m_t << "}\\label{" << stripPath(s->file()) << "_" << s->anchor() << "}" << endl; }
void LatexDocVisitor::startLink(const QString &ref, const QString &file, const QString &anchor) { if (ref.isEmpty() && Config::getBool("latex-hyper-pdf")) { // internal PDF link m_t << "\\hyperlink{"; if (! file.isEmpty()) { m_t << stripPath(file); } if (! file.isEmpty() && ! anchor.isEmpty()) { m_t << "_"; } if (!anchor.isEmpty()) { m_t << anchor; } m_t << "}{"; } else if (ref.isEmpty()) { // internal non-PDF link m_t << "\\doxyref{"; } else { // external link m_t << "{\\bf "; } }
void TSHPath::StripPath(LPTSTR pszPath) { static TModuleProcV1<LPTSTR> stripPath(GetModule(), StripPathStr); stripPath(pszPath); }
/* returns 1 if fname in list else return 0 * returns 0 if list is NULL or cnt is < 0 */ int matchname (TCHAR *fname, int cnt, TCHAR *list[], int junkPaths) { register TCHAR *t; int i; int path_sep; /* if nothing to compare with then return failure */ if ((list == NULL) || (cnt <= 0)) return 0; for (i = 0; i < cnt; i++) { /* get count of path components in current filelist entry */ path_sep = 0; if (!junkPaths) { for(t = list[i]; *t != '\0'; t++) if ((*t == '/') || (*t == '\\')) path_sep++; } if (ExprMatch(stripPath(path_sep, fname), list[i])) return 1; } return 0; /* no match */ }
void LatexDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor) { if (ref.isEmpty() && Config_getBool("PDF_HYPERLINKS")) // internal PDF link { if (ref.isEmpty()) { m_t << "\\hyperlink{"; if (!file.isEmpty()) m_t << stripPath(file); if (!file.isEmpty() && !anchor.isEmpty()) m_t << "_"; if (!anchor.isEmpty()) m_t << anchor; m_t << "}{"; } else { QCString *dest; m_t << "\\href{"; if ((dest=Doxygen::tagDestinationDict[ref])) m_t << *dest << "/"; if (!file.isEmpty()) m_t << file << Doxygen::htmlFileExtension; if (!anchor.isEmpty()) m_t << "#" << anchor; m_t << "}{"; } } else if (ref.isEmpty()) // internal non-PDF link { m_t << "\\doxyref{"; } else // external link { m_t << "{\\bf "; } }
SaveLoad_v6::SaveFile *SaveLoad_v6::getSaveFile(const char *fileName) { fileName = stripPath(fileName); for (int i = 0; i < ARRAYSIZE(_saveFiles); i++) if (!scumm_stricmp(fileName, _saveFiles[i].sourceName)) return &_saveFiles[i]; return 0; }
void LatexDocVisitor::startLink(const QString &ref,const QString &file,const QString &anchor) { if (ref.isEmpty() && Config_getBool("PDF_HYPERLINKS")) { m_t << "\\hyperlink{"; if (!file.isEmpty()) m_t << stripPath(file); if (!file.isEmpty() && !anchor.isEmpty()) m_t << "_"; if (!anchor.isEmpty()) m_t << anchor; m_t << "}{"; } else { m_t << "{\\bf "; } }
ZExport (ZProfile &) ZProfile::setPath (const ZString & aPath) { ZFUNCTRACE_DEVELOP ("ZProfile::setPath(const ZString& aPath)"); #ifdef ZC_WIN ZString newPath (stripPath (aPath)); if (iPath != newPath) { closePath (); iPath = newPath; } // if #endif #ifdef ZC_OS2 iPath = aPath; #endif return *this; } // setPath
InputStream* ZipFile::getInputStream( const String& name ) { String str = stripPath( name ); String namelower = str.toLowerCase(); for ( int i = 0 ; i < (int)m_this->entries.size() ; ++i ) { ZipFileImpl::Entry& entry = m_this->entries[i]; if ( entry.name == namelower ) { entry.used = true; return new MemoryInputStream( this, m_this->data.begin()+entry.begin, entry.size, m_this->name+"/"+entry.name ); } } return new FileInputStream( name ); }
bool WsdlGeneratorHelper::createOutputFile(void) { bool success = true; try { protoFilenameNoExt = stripExtension(proto->name()); protoFilenameNoExtNoPath = stripPath(protoFilenameNoExt); string wsdlName = protoFilenameNoExtNoPath; wsdlName.append(".wsdl"); wsdl = outputDirectory->Open(wsdlName); success = writeFileContents(); } catch (string s) { success = false; *error = s; } return success; }
ZExport0 ZProfile::ZProfile (const ZString & aRoot, const ZString & aPath) { ZFUNCTRACE_DEVELOP ("ZProfile::ZProfile(const ZString& aRoot, const ZString& aPath)"); #ifdef ZC_WIN iRootHandle = 0; iPathHandle = 0; iRoot = stripPath (aRoot); setPath (aPath); #endif #ifdef ZC_OS2 iHab = WinInitialize (0); if (iHab == 0) throwSysErr (WinInitializeName); iRoot = aRoot; iPath = aPath; #endif } // ZProfile
void LatexDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor) { if (ref.isEmpty() && Config_getBool("PDF_HYPERLINKS")) // internal PDF link { m_t << "\\hyperlink{"; if (!file.isEmpty()) m_t << stripPath(file); if (!file.isEmpty() && !anchor.isEmpty()) m_t << "_"; if (!anchor.isEmpty()) m_t << anchor; m_t << "}{"; } else if (ref.isEmpty()) // internal non-PDF link { m_t << "\\doxyref{"; } else // external link { m_t << "{\\bf "; } }
void LatexDocVisitor::visitPre(DocXRefItem *x) { if (m_hide) return; m_t << "\\begin{Desc}" << endl; bool anonymousEnum = x->file()=="@"; m_t << "\\item["; if (Config_getBool("PDF_HYPERLINKS") && !anonymousEnum) { m_t << "\\hyperlink{" << stripPath(x->file()) << "_" << x->anchor() << "}{"; } else { m_t << "{\\bf "; } m_insideItem=TRUE; filter(x->title()); m_insideItem=FALSE; m_t << "}]"; }
void MissionLighting::createInteriorVolume() { VolumeRWStream vol; // create the volume _assert( vol.createVolume( volumeFile.c_str() ), "Failed to create volume: %s\n", volumeFile.c_str() ); SimGroup * group = NULL; // go through and see if the volume has been added alredy for( int i = 0; i < m_volumes.size(); i++ ) { if( ( m_volumes[i]->getName() ) && ( !stricmp( m_volumes[i]->getName(), lightVolName ) ) ) { // remove the volume print( V_LOW, "Removing MissionLighting volume.\n" ); group = m_volumes[i]->getGroup(); if( group ) group->removeObject( m_volumes[i] ); } } print( V_MEDIUM, "Adding SimVolume to mission ( %s )\n", volumeFile.c_str() ); // add to the mission in the volumes group SimVolume * simVolume = new SimVolume; manager->addObject( simVolume, lightVolName ); simVolume->open( stripPath( volumeFile.c_str() ) ); // try and place in a volumes group if( !group ) { group = dynamic_cast<SimGroup*>( mission->findObject( "Volumes" ) ); if( !group ) group = mission; } group->addObject( simVolume, lightVolName ); }
void LatexDocVisitor::visitPre(DocXRefItem *x) { if (m_hide) { return; } if (x->title().isEmpty()) { return; } m_t << "\\begin{DoxyRefDesc}{"; filter(x->title()); m_t << "}" << endl; bool anonymousEnum = x->file() == "@"; m_t << "\\item["; if (Config::getBool("latex-hyper-pdf") && !anonymousEnum) { m_t << "\\hyperlink{" << stripPath(x->file()) << "_" << x->anchor() << "}{"; } else { m_t << "{\\bf "; } m_insideItem = true; filter(x->title()); m_insideItem = false; m_t << "}]"; }
int tapeInsert(char *name, const char *fileInZipFile) { FILE* file; Properties* pProperties = propGetGlobalProperties(); if (ramImageBuffer != NULL) { file = fopen(tapePosName, "w"); if (file != NULL) { char buffer[32]; sprintf(buffer, "POS:%d", ramImagePos); fwrite(buffer, 1, 32, file); fclose(file); } if (*tapeName && tapeRdWr) { tapeSave(tapeName, tapeFormat); } free(ramImageBuffer); ramImageBuffer = NULL; } *tapeName = 0; if(!name) { return 1; } // Create filename for tape position file sprintf(tapePosName, "%s" DIR_SEPARATOR "%s", tapeBaseDir, stripPath(name)); if (fileInZipFile == NULL) { strcpy(tapeName, name); } else { strcat(tapePosName, stripPath((char*)fileInZipFile)); } strcat(tapePosName, ".pos"); ramImagePos = 0; // Load and verify tape position file = fopen(tapePosName, "rb"); if (file != NULL) { char buffer[32] = { 0 }; fread(buffer, 1, 31, file); sscanf(buffer, "POS:%d", &ramImagePos); fclose(file); } if (fileInZipFile != NULL) { ramImageBuffer = zipLoadFile(name, fileInZipFile, &ramImageSize); if (ramImagePos > ramImageSize) { ramImagePos = ramImageSize; } } else { file = fopen(name,"rb"); if (file != NULL) { // Load file into RAM buffer fseek(file, 0, SEEK_END); ramImageSize = ftell(file); fseek(file, 0, SEEK_SET); ramImageBuffer = malloc(ramImageSize); if (ramImageBuffer != NULL) { if (ramImageSize != fread(ramImageBuffer, 1, ramImageSize, file)) { free(ramImageBuffer); ramImageBuffer = NULL; } } fclose(file); } } if (rewindNextInsert&&pProperties->cassette.rewindAfterInsert) ramImagePos=0; rewindNextInsert=0; if (ramImageBuffer != NULL) { UInt8* ptr = ramImageBuffer + ramImageSize - 17; int cntFMSXDOS = 0; int cntFMSX98 = 0; int cntSVICAS = 0; while (ptr >= ramImageBuffer) { if (!memcmp(ptr, hdrFMSXDOS, sizeof(hdrFMSXDOS))) { cntFMSXDOS++; } if (!memcmp(ptr, hdrFMSX98, sizeof(hdrFMSX98))) { cntFMSX98++; } if (!memcmp(ptr, hdrSVICAS, sizeof(hdrSVICAS))) { cntSVICAS++; } ptr--; } if (cntSVICAS > cntFMSXDOS && cntSVICAS > cntFMSX98) { tapeFormat = TAPE_SVICAS; tapeHeader = hdrSVICAS; tapeHeaderSize = sizeof(hdrSVICAS); } else if (cntFMSXDOS >= cntFMSX98) { tapeFormat = TAPE_FMSXDOS; tapeHeader = hdrFMSXDOS; tapeHeaderSize = sizeof(hdrFMSXDOS); } else { tapeFormat = TAPE_FMSX98AT; tapeHeader = hdrFMSX98; tapeHeaderSize = sizeof(hdrFMSX98); } } if (ramImagePos > ramImageSize) { ramImagePos = ramImageSize; } return ramImageBuffer != NULL; }
/** Writes the list of members to the output. * @param ol Output list to write to * @param cd non-null if this list is part of class documentation. * @param nd non-null if this list is part of namespace documentation. * @param fd non-null if this list is part of file documentation. * @param gd non-null if this list is part of group documentation. * @param title Title to use for the member list. * @param subtitle Sub title to use for the member list. * @param compoundType Container type for this member list. * @param showEnumValues Obsolete, always set to FALSE. * @param showInline if set to TRUE if title is rendered differently * @param inheritedFrom if not 0, the list is shown inside the * given class as inherited members, parameter cd points to the * class containing the members. * @param lt Type of list that is inherited from. */ void MemberList::writeDeclarations(OutputList &ol, ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, const char *title,const char *subtitle, const DefinitionIntf::DefType compoundType,bool showEnumValues, bool showInline,ClassDef *inheritedFrom,MemberListType lt) { (void)showEnumValues; // unused //printf("----- writeDeclaration() this=%p ---- inheritedFrom=%p\n",this,inheritedFrom); static bool optimizeVhdl = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); QCString inheritId; countDecMembers(/*showEnumValues*/FALSE,gd); // count members shown in this section Definition *ctx = cd; if (ctx==0 && nd) ctx = nd; if (ctx==0 && gd) ctx = gd; if (ctx==0 && fd) ctx = fd; //printf("%p: MemberList::writeDeclaration(title=`%s',subtitle=`%s')=%d inheritedFrom=%p\n", // this,title,subtitle,numDecMembers(),inheritedFrom); int num = numDecMembers(); if (inheritedFrom) { //if ( cd && !optimizeVhdl && countInheritableMembers(inheritedFrom)>0 ) if ( cd && !optimizeVhdl && cd->countMembersIncludingGrouped( m_listType,inheritedFrom,TRUE)>0 ) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); inheritId = substitute(listTypeAsString(lt),"-","_")+"_"+ stripPath(cd->getOutputFileBase()); if (title) { ol.writeInheritedSectionTitle(inheritId,cd->getReference(), cd->getOutputFileBase(), cd->anchor(),title,cd->displayName()); } ol.popGeneratorState(); } } else if (num>0) { if (title) { if (showInline) { ol.startInlineHeader(); } else { ol.startMemberHeader(listTypeAsString(m_listType)); } ol.parseText(title); if (showInline) { ol.endInlineHeader(); } else { ol.endMemberHeader(); } } if (subtitle) { QCString st=subtitle; st = st.stripWhiteSpace(); if (!st.isEmpty()) { ol.startMemberSubtitle(); ol.generateDoc("[generated]",-1,ctx,0,subtitle,FALSE,FALSE,0,FALSE,FALSE); ol.endMemberSubtitle(); } } } if (num>0) { // TODO: Two things need to be worked out for proper VHDL output: // 1. Signals and types under the group need to be // formatted to associate them with the group somehow // indentation, or at the very least, extra space after // the group is done // 2. This might need to be repeated below for memberGroupLists if (optimizeVhdl) // use specific declarations function { VhdlDocGen::writeVhdlDeclarations(this,ol,0,cd,0,0); } else { writePlainDeclarations(ol,cd,nd,fd,gd,compoundType,inheritedFrom,inheritId); } //printf("memberGroupList=%p\n",memberGroupList); if (memberGroupList) { MemberGroupListIterator mgli(*memberGroupList); MemberGroup *mg; while ((mg=mgli.current())) { bool hasHeader=!mg->header().isEmpty() && mg->header()!="[NOHEADER]"; if (inheritId.isEmpty()) { //printf("mg->header=%s hasHeader=%d\n",mg->header().data(),hasHeader); ol.startMemberGroupHeader(hasHeader); if (hasHeader) { ol.parseText(mg->header()); } ol.endMemberGroupHeader(); if (!mg->documentation().isEmpty()) { //printf("Member group has docs!\n"); ol.startMemberGroupDocs(); ol.generateDoc("[generated]",-1,ctx,0,mg->documentation()+"\n",FALSE,FALSE); ol.endMemberGroupDocs(); } ol.startMemberGroup(); } //printf("--- mg->writePlainDeclarations ---\n"); mg->writePlainDeclarations(ol,cd,nd,fd,gd,inheritedFrom,inheritId); if (inheritId.isEmpty()) { ol.endMemberGroup(hasHeader); } ++mgli; } } } if (inheritedFrom && cd) { // also add members that of this list type, that are grouped together // in a separate list in class 'inheritedFrom' cd->addGroupedInheritedMembers(ol,m_listType,inheritedFrom,inheritId); } //printf("----- end writeDeclaration() ----\n"); }
void printDecoderConfigFile() { string decoder_config_file = Prefix + ".Decoder.config" ; cerr << "writing decoder configuration file to " << decoder_config_file.c_str() <<'\n'; ofstream decoder(decoder_config_file.c_str()); if(!decoder){ cerr << "\nCannot write to " << decoder_config_file <<'\n'; exit(1); } decoder << "# Template for Configuration File for the Rewrite Decoder\n# Syntax:\n" << "# <Variable> = <value>\n# '#' is the comment character\n" << "#================================================================\n" << "#================================================================\n" << "# LANGUAGE MODEL FILE\n# The full path and file name of the language model file:\n"; decoder << "LanguageModelFile =\n"; decoder << "#================================================================\n" << "#================================================================\n" << "# TRANSLATION MODEL FILES\n# The directory where the translation model tables as created\n" << "# by Giza are located:\n#\n" << "# Notes: - All translation model \"source\" files are assumed to be in\n" << "# TM_RawDataDir, the binaries will be put in TM_BinDataDir\n" << "#\n# - Attention: RELATIVE PATH NAMES DO NOT WORK!!!\n" << "#\n# - Absolute paths (file name starts with /) will override\n" << "# the default directory.\n\n"; // strip file prefix info and leave only the path name in Prefix string path = Prefix.substr(0, Prefix.find_last_of("/")+1); if( path=="" ) path="."; decoder << "TM_RawDataDir = " << path << '\n'; decoder << "TM_BinDataDir = " << path << '\n' << '\n'; decoder << "# file names of the TM tables\n# Notes:\n" << "# 1. TTable and InversTTable are expected to use word IDs not\n" << "# strings (Giza produces both, whereby the *.actual.* files\n" << "# use strings and are THE WRONG CHOICE.\n" << "# 2. FZeroWords, on the other hand, is a simple list of strings\n" << "# with one word per line. This file is typically edited\n" << "# manually. Hoeever, this one listed here is generated by GIZA\n\n"; int lastmodel; if (Model5_Iterations>0) lastmodel = 5 ; else if (Model4_Iterations>0) lastmodel = 4 ; else if (Model3_Iterations>0) lastmodel = 3 ; else if (Model2_Iterations>0) lastmodel = 2 ; else lastmodel = 1 ; string lastModelName = str2Num(lastmodel); string p=Prefix + ".t" + /*lastModelName*/"3" +".final"; decoder << "TTable = " << stripPath(p.c_str()) << '\n'; p = Prefix + ".ti.final" ; decoder << "InverseTTable = " << stripPath(p.c_str()) << '\n'; p=Prefix + ".n" + /*lastModelName*/"3" + ".final"; decoder << "NTable = " << stripPath(p.c_str()) << '\n'; p=Prefix + ".d" + /*lastModelName*/"3" + ".final"; decoder << "D3Table = " << stripPath(p.c_str()) << '\n'; p=Prefix + ".D4.final"; decoder << "D4Table = " << stripPath(p.c_str()) << '\n'; p=Prefix + ".p0_"+ /*lastModelName*/"3" + ".final"; decoder << "PZero = " << stripPath(p.c_str()) << '\n'; decoder << "Source.vcb = " << SourceVocabFilename << '\n'; decoder << "Target.vcb = " << TargetVocabFilename << '\n'; // decoder << "Source.classes = " << SourceVocabFilename + ".classes" << '\n'; // decoder << "Target.classes = " << TargetVocabFilename + ".classes" <<'\n'; decoder << "Source.classes = " << SourceVocabFilename+".classes" << '\n'; decoder << "Target.classes = " << TargetVocabFilename + ".classes" <<'\n'; p=Prefix + ".fe0_"+ /*lastModelName*/"3" + ".final"; decoder << "FZeroWords = " <<stripPath(p.c_str()) << '\n' ; /* decoder << "# Translation Parameters\n" << "# Note: TranslationModel and LanguageModelMode must have NUMBERS as\n" << "# values, not words\n" << "# CORRECT: LanguageModelMode = 2\n" << "# WRONG: LanguageModelMode = bigrams # WRONG, WRONG, WRONG!!!\n"; decoder << "TMWeight = 0.6 # weight of TM for calculating alignment probability\n"; decoder << "TranslationModel = "<<lastmodel<<" # which model to use (3 or 4)\n"; decoder << "LanguageModelMode = 2 # (2 (bigrams) or 3 (trigrams)\n\n"; decoder << "# Output Options\n" << "TellWhatYouAreDoing = TRUE # print diagnostic messages to stderr\n" << "PrintOriginal = TRUE # repeat original sentence in the output\n" << "TopTranslations = 3 # number of n best translations to be returned\n" << "PrintProbabilities = TRUE # give the probabilities for the translations\n\n"; decoder << "# LOGGING OPTIONS\n" << "LogFile = - # empty means: no log, dash means: STDOUT\n" << "LogLM = true # log language model lookups\n" << "LogTM = true # log translation model lookups\n"; */ }
static int scsiDeviceInquiry(SCSIDEVICE* scsi) { int total = _diskGetTotalSectors(scsi->diskId); int length = scsi->length; UInt8* buffer = scsi->buffer; UInt8 type = (UInt8)(scsi->deviceType & 0xff); UInt8 removable; const char* fileName; int i; int fdsmode = (scsi->mode & MODE_FDS120) && (total > 0) && (total <= 2880); if (length == 0) return 0; if (fdsmode) { memcpy(buffer + 2, inqdata + 2, 6); memcpy(buffer + 8, fds120, 28); removable = 0x80; if (type != SDT_DirectAccess) { type = SDT_Processor; } } else { memcpy(buffer + 2, inqdata + 2, 34); removable = (scsi->mode & MODE_REMOVABLE) ? 0x80 : 0; if (scsi->productName == NULL) { int dt = scsi->deviceType; if (dt != SDT_DirectAccess) { if (dt > SDT_Communications) { dt = SDT_Communications + 1; } --dt; memcpy(buffer + 22, sdt_name[dt], 10); } } else { memcpy(buffer + 16, scsi->productName, 16); } } buffer[0] = type; buffer[1] = removable; if (!(scsi->mode & BIT_SCSI2)) { buffer[2] = 1; buffer[3] = 1; if (!fdsmode) buffer[20] = '1'; } else { if (scsi->mode & BIT_SCSI3) { buffer[2] = 5; if (!fdsmode) buffer[20] = '3'; } } if ((scsi->mode & MODE_CHECK2) && !fdsmode) { buffer[35] = 'A'; } if (scsi->mode & BIT_SCSI3) { if (length > 96) length = 96; buffer[4] = 91; if (length > 56) { memset(buffer + 56, 0, 40); buffer[58] = 0x03; buffer[60] = 0x01; buffer[61] = 0x80; } } else { if (length > 56) length = 56; } if (length > 36){ buffer += 36; memset(buffer, ' ', 20); fileName = strlen(scsi->disk.fileNameInZip) ? scsi->disk.fileNameInZip : scsi->disk.fileName; fileName = stripPath(fileName); for (i = 0; i < 20; ++i) { if (*fileName == 0) { break; } *buffer = *fileName; ++buffer; ++fileName; } } return length; }
void World::openMap(std::string mapName,int callbackRef) { _map.ParseFile(single<ResourceManager>().getMap(mapName).tmxFilePath()); //set the background color unsigned short r, g, b; auto c = Color{}; if (!_map.GetBackgroundColor().compare("")) { r = 0x00; g = 0x00; b = 0x00; } else { hexToRgb(_map.GetBackgroundColor(), c.r, c.g, c.b); } c.a = 0xFF; //load the tilesets into the resource manager const std::vector<Tmx::Tileset*> tilesets = _map.GetTilesets(); for (auto ts : tilesets) { auto tsimage = ts->GetImage(); auto texture = new Texture{}; texture->setName(ts->GetName()); texture->setFileSource("./assets/maps/tilesets/" + stripPath(tsimage->GetSource())); texture->initialize(); single<ResourceManager>().addTexture(std::unique_ptr<Texture>(texture)); } auto& lua = single<Core>().lua(); const std::vector<Tmx::Layer*> layers = _map.GetLayers(); for (auto layer : layers) { int x1, y1; int u1, v1; int layerWidth = layer->GetWidth(); int layerHeight = layer->GetHeight(); // so much shit code single<Core>().getSystemByName<PhysicsSystem>("Physics")->setGravity(Vec2{ layer->GetProperties().GetFloatProperty("defaultGravityX"), layer->GetProperties().GetFloatProperty("defaultGravityY") }); for (int y = 0; y < layerHeight; y++) { for (int x = 0; x < layerWidth; x++) { int tileId = layer->GetTileId(x, layerHeight - y - 1); int tilesetId = layer->GetTileTilesetIndex(x, layerHeight - y - 1); if (tilesetId >= 0) { auto thisSet = _map.GetTileset(tilesetId); auto tile = _map.GetTileset(tilesetId)->GetTile(tileId); //figure out which section of the texture this tile is auto setw = (thisSet->GetImage()->GetWidth() / thisSet->GetTileWidth()); auto seth = (thisSet->GetImage()->GetHeight() / thisSet->GetTileHeight()); u1 = tileId % setw; v1 = (tileId - u1) / setw; u1 *= thisSet->GetTileWidth(); v1 *= thisSet->GetTileHeight(); x1 = x * _map.GetTileWidth(); y1 = y * _map.GetTileHeight(); auto luaTile = LuaTile{}; luaTile.position[0] = x1; luaTile.position[1] = y1; luaTile.position[2] = 0; luaTile.dimensions[0] = thisSet->GetTileWidth(); luaTile.dimensions[1] = thisSet->GetTileHeight(); luaTile.sourceTextureRect[0] = u1; luaTile.sourceTextureRect[1] = v1; luaTile.sourceTextureRect[2] = thisSet->GetTileWidth(); luaTile.sourceTextureRect[3] = thisSet->GetTileHeight(); luaTile.textureName = thisSet->GetName(); auto& tileProperties = tile->GetProperties(); luaTile.tileProperties = tileProperties.GetList(); lua.call(callbackRef, luaTile); } } //end layer X loop } //end layer Y loop } //end layers loop for (auto objGroup : _map.GetObjectGroups()) { //get the associated tile layer auto tileLayer = objGroup->GetProperties().GetLiteralProperty("tileLayer"); auto physicsSystem = single<Core>().getSystemByName<PhysicsSystem>("Physics"); for (auto obj : objGroup->GetObjects()) { debug("Object at ", obj->GetX(), ", ", obj->GetY()); auto luaTile = LuaTile{}; luaTile.position[0] = obj->GetX(); luaTile.position[1] = _map.GetTileHeight() * objGroup->GetHeight() - obj->GetY() - obj->GetHeight(); luaTile.position[2] = 0; luaTile.dimensions[0] = obj->GetWidth(); luaTile.dimensions[1] = obj->GetHeight(); luaTile.isObject = true; luaTile.tileProperties = obj->GetProperties().GetList(); luaTile.tileProperties["name"] = obj->GetName(); luaTile.tileProperties["objectType"] = obj->GetType(); lua.call(callbackRef, luaTile); } //end objects loop } //end object layers loop lua.removeReference(callbackRef); }
void FileName::stripPath (void) { stripPath (fullName, istrlen (fullName)); }
FileName FileName::stripPath() const { return stripPath(str()); }
/*! Injects the info gathered by the XML parser into the Entry tree. * This tree contains the information extracted from the input in a * "unrelated" form. */ void TagFileParser::buildLists(Entry *root) { // build class list TagClassInfo *tci = m_tagFileClasses.first(); while (tci) { Entry *ce = new Entry; ce->section = Entry::CLASS_SEC; switch (tci->kind) { case TagClassInfo::Class: break; case TagClassInfo::Struct: ce->spec = Entry::Struct; break; case TagClassInfo::Union: ce->spec = Entry::Union; break; case TagClassInfo::Interface: ce->spec = Entry::Interface; break; case TagClassInfo::Exception: ce->spec = Entry::Exception; break; case TagClassInfo::Protocol: ce->spec = Entry::Protocol; break; case TagClassInfo::Category: ce->spec = Entry::Category; break; } ce->name = tci->name; if (tci->kind==TagClassInfo::Protocol) { ce->name+="-p"; } addDocAnchors(ce,tci->docAnchors); TagInfo *ti = new TagInfo; ti->tagName = m_tagName; ti->fileName = tci->filename; ce->tagInfo = ti; ce->lang = tci->isObjC ? SrcLangExt_ObjC : SrcLangExt_Unknown; // transfer base class list if (tci->bases) { delete ce->extends; ce->extends = tci->bases; tci->bases = 0; } if (tci->templateArguments) { if (ce->tArgLists==0) { ce->tArgLists = new QList<ArgumentList>; ce->tArgLists->setAutoDelete(TRUE); } ArgumentList *al = new ArgumentList; ce->tArgLists->append(al); QListIterator<QCString> sli(*tci->templateArguments); QCString *argName; for (;(argName=sli.current());++sli) { Argument *a = new Argument; a->type = "class"; a->name = *argName; al->append(a); } } buildMemberList(ce,tci->members); root->addSubEntry(ce); tci = m_tagFileClasses.next(); } // build file list TagFileInfo *tfi = m_tagFileFiles.first(); while (tfi) { Entry *fe = new Entry; fe->section = guessSection(tfi->name); fe->name = tfi->name; addDocAnchors(fe,tfi->docAnchors); TagInfo *ti = new TagInfo; ti->tagName = m_tagName; ti->fileName = tfi->filename; fe->tagInfo = ti; QCString fullName = m_tagName+":"+tfi->path+stripPath(tfi->name); fe->fileName = fullName; //printf("new FileDef() filename=%s\n",tfi->filename.data()); FileDef *fd = new FileDef(m_tagName+":"+tfi->path, tfi->name,m_tagName, tfi->filename ); FileName *mn; if ((mn=Doxygen::inputNameDict->find(tfi->name))) { mn->append(fd); } else { mn = new FileName(fullName,tfi->name); mn->append(fd); Doxygen::inputNameList->inSort(mn); Doxygen::inputNameDict->insert(tfi->name,mn); } buildMemberList(fe,tfi->members); root->addSubEntry(fe); tfi = m_tagFileFiles.next(); } // build namespace list TagNamespaceInfo *tni = m_tagFileNamespaces.first(); while (tni) { Entry *ne = new Entry; ne->section = Entry::NAMESPACE_SEC; ne->name = tni->name; addDocAnchors(ne,tni->docAnchors); TagInfo *ti = new TagInfo; ti->tagName = m_tagName; ti->fileName = tni->filename; ne->tagInfo = ti; buildMemberList(ne,tni->members); root->addSubEntry(ne); tni = m_tagFileNamespaces.next(); } // build package list TagPackageInfo *tpgi = m_tagFilePackages.first(); while (tpgi) { Entry *pe = new Entry; pe->section = Entry::PACKAGE_SEC; pe->name = tpgi->name; addDocAnchors(pe,tpgi->docAnchors); TagInfo *ti = new TagInfo; ti->tagName = m_tagName; ti->fileName = tpgi->filename; pe->tagInfo = ti; buildMemberList(pe,tpgi->members); root->addSubEntry(pe); tpgi = m_tagFilePackages.next(); } // build group list, but only if config file says to include it //if (Config_getBool("EXTERNAL_GROUPS")) //{ TagGroupInfo *tgi = m_tagFileGroups.first(); while (tgi) { Entry *ge = new Entry; ge->section = Entry::GROUPDOC_SEC; ge->name = tgi->name; ge->type = tgi->title; addDocAnchors(ge,tgi->docAnchors); TagInfo *ti = new TagInfo; ti->tagName = m_tagName; ti->fileName = tgi->filename; ge->tagInfo = ti; buildMemberList(ge,tgi->members); root->addSubEntry(ge); tgi = m_tagFileGroups.next(); } //} // build page list TagPageInfo *tpi = m_tagFilePages.first(); while (tpi) { Entry *pe = new Entry; pe->section = Entry::PAGEDOC_SEC; pe->name = tpi->name; pe->args = tpi->title; addDocAnchors(pe,tpi->docAnchors); TagInfo *ti = new TagInfo; ti->tagName = m_tagName; ti->fileName = tpi->filename; pe->tagInfo = ti; root->addSubEntry(pe); tpi = m_tagFilePages.next(); } }
int _tmain(int argc, _TCHAR* argv[]) { std::cout << stripPath("/xx/yy/zzzz.ff"); return 0; }