Start to abstract model
This commit is contained in:
parent
bf1c7df8bb
commit
6afadafa1e
|
@ -1280,9 +1280,8 @@ void MainWindow::loadModel(string path) {
|
|||
|
||||
if(timer) timer->Stop();
|
||||
delete model;
|
||||
Model *tmpModel= new ModelGl();
|
||||
if(renderer) renderer->loadTheModel(tmpModel, modelPath);
|
||||
model= tmpModel;
|
||||
model = NULL;
|
||||
model = renderer? renderer->newModel(rsGlobal, modelPath): NULL;
|
||||
|
||||
statusbarText = getModelInfo();
|
||||
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " anim value: " + floatToStr(anim) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
||||
|
|
|
@ -196,9 +196,8 @@ Texture2D * Renderer::getNewTexture2D() {
|
|||
return newTexture;
|
||||
}
|
||||
|
||||
Model * Renderer::getNewModel() {
|
||||
Model *newModel = modelManager->newModel();
|
||||
return newModel;
|
||||
Model * Renderer::newModel(ResourceScope rs,const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader) {
|
||||
return modelManager->newModel(path,deletePixMapAfterLoad,loadedFileList,sourceLoader);
|
||||
}
|
||||
|
||||
void Renderer::init() {
|
||||
|
@ -416,13 +415,6 @@ void Renderer::toggleGrid() {
|
|||
grid= grid? false: true;
|
||||
}
|
||||
|
||||
void Renderer::loadTheModel(Model *model, string file) {
|
||||
model->setTextureManager(textureManager);
|
||||
model->loadG3d(file);
|
||||
textureManager->init();
|
||||
modelManager->init();
|
||||
}
|
||||
|
||||
void Renderer::renderTheModel(Model *model, float f) {
|
||||
if(model != NULL){
|
||||
modelRenderer->begin(true, true, !wireframe, false, &meshCallbackTeamColor);
|
||||
|
|
|
@ -137,7 +137,6 @@ public:
|
|||
void toggleWireframe();
|
||||
void toggleGrid();
|
||||
|
||||
void loadTheModel(Model *model, string file);
|
||||
void renderTheModel(Model *model, float f);
|
||||
|
||||
void manageParticleSystem(ParticleSystem *particleSystem);
|
||||
|
@ -146,9 +145,8 @@ public:
|
|||
Texture2D *getPlayerColorTexture(PlayerColor playerColor);
|
||||
|
||||
Texture2D * getNewTexture2D();
|
||||
Model * getNewModel();
|
||||
|
||||
Model *newModel(ResourceScope rs) { return getNewModel(); }
|
||||
Model *newModel(ResourceScope rs,const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string *sourceLoader=NULL);
|
||||
Texture2D *newTexture2D(ResourceScope rs) { return getNewTexture2D(); }
|
||||
|
||||
void initTextureManager();
|
||||
|
|
|
@ -170,10 +170,7 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d
|
|||
endPathWithSlash(currentPath);
|
||||
|
||||
string path= modelNode->getAttribute("path")->getRestrictedValue(currentPath);
|
||||
model= renderer->newModel(rsGame);
|
||||
if(model) {
|
||||
model->load(path, false, &loadedFileList, &parentLoader);
|
||||
}
|
||||
model= renderer->newModel(rsGame,path, false, &loadedFileList, &parentLoader);
|
||||
loadedFileList[path].push_back(make_pair(parentLoader,modelNode->getAttribute("path")->getRestrictedValue()));
|
||||
|
||||
if(modelNode->hasChild("cycles")) {
|
||||
|
|
|
@ -598,12 +598,10 @@ void Renderer::manageDeferredParticleSystems() {
|
|||
if(dynamic_cast<GameParticleSystem *>(ps) != NULL) {
|
||||
GameParticleSystem *gps = dynamic_cast<GameParticleSystem *>(ps);
|
||||
if(gps->getModelFileLoadDeferred() != "" && gps->getModel() == NULL) {
|
||||
Model *model= newModel(rsGame);
|
||||
if(model) {
|
||||
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||
model->load(gps->getModelFileLoadDeferred(), false, &loadedFileList, NULL);
|
||||
gps->setModel(model);
|
||||
}
|
||||
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||
Model *model= newModel(rsGame, gps->getModelFileLoadDeferred(), false, &loadedFileList, NULL);
|
||||
if(model)
|
||||
gps->setModel(model);
|
||||
}
|
||||
}
|
||||
manageParticleSystem(ps, rs);
|
||||
|
@ -886,12 +884,12 @@ void Renderer::endLastTexture(ResourceScope rs, bool mustExistInList) {
|
|||
textureManager[rs]->endLastTexture(mustExistInList);
|
||||
}
|
||||
|
||||
Model *Renderer::newModel(ResourceScope rs){
|
||||
Model *Renderer::newModel(ResourceScope rs,const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader){
|
||||
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return modelManager[rs]->newModel();
|
||||
return modelManager[rs]->newModel(path,deletePixMapAfterLoad,loadedFileList,sourceLoader);
|
||||
}
|
||||
|
||||
void Renderer::endModel(ResourceScope rs, Model *model,bool mustExistInList) {
|
||||
|
|
|
@ -458,7 +458,7 @@ public:
|
|||
void endTexture(ResourceScope rs, Texture *texture,bool mustExistInList=false);
|
||||
void endLastTexture(ResourceScope rs, bool mustExistInList=false);
|
||||
|
||||
Model *newModel(ResourceScope rs);
|
||||
Model *newModel(ResourceScope rs,const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string *sourceLoader=NULL);
|
||||
void endModel(ResourceScope rs, Model *model, bool mustExistInList=false);
|
||||
void endLastModel(ResourceScope rs, bool mustExistInList=false);
|
||||
|
||||
|
|
|
@ -208,10 +208,9 @@ Intro::Intro(Program *program):
|
|||
findAll(introPath, introModels, false, false);
|
||||
for(int i = 0; i < (int)introModels.size(); ++i) {
|
||||
string logo = introModels[i];
|
||||
Model *model= renderer.newModel(rsMenu);
|
||||
if(model) {
|
||||
model->load(getGameCustomCoreDataPath(data_path, "") + "data/core/menu/main_model/" + logo);
|
||||
models.push_back(model);
|
||||
Model *model= renderer.newModel(rsMenu, getGameCustomCoreDataPath(data_path, "") + "data/core/menu/main_model/" + logo);
|
||||
if(model) {
|
||||
models.push_back(model);
|
||||
//printf("#1 Intro model [%s]\n",model->getFileName().c_str());
|
||||
}
|
||||
}
|
||||
|
@ -222,9 +221,8 @@ Intro::Intro(Program *program):
|
|||
findAll(introPath, introModels, false, false);
|
||||
for(int i = 0; i < (int)introModels.size(); ++i) {
|
||||
string logo = introModels[i];
|
||||
Model *model= renderer.newModel(rsMenu);
|
||||
if(model) {
|
||||
model->load(data_path + "data/core/menu/main_model/" + logo);
|
||||
Model *model= renderer.newModel(rsMenu, data_path + "data/core/menu/main_model/" + logo);
|
||||
if(model) {
|
||||
models.push_back(model);
|
||||
//printf("#2 Intro model [%s]\n",model->getFileName().c_str());
|
||||
}
|
||||
|
|
|
@ -5160,8 +5160,7 @@ int glestMain(int argc, char** argv) {
|
|||
char szTextBuf[8096]="";
|
||||
for(unsigned int i =0; i < models.size(); ++i) {
|
||||
string &file = models[i];
|
||||
bool modelLoadedOk = false;
|
||||
|
||||
|
||||
renderer.clearBuffers();
|
||||
renderer.clearZBuffer();
|
||||
renderer.reset2d();
|
||||
|
@ -5187,23 +5186,18 @@ int glestMain(int argc, char** argv) {
|
|||
::Shared::Platform::Window::handleEvent();
|
||||
SDL_PumpEvents();
|
||||
|
||||
Model *model = renderer.newModel(rsGlobal);
|
||||
try {
|
||||
printf("About to load model [%s] [%u of " MG_SIZE_T_SPECIFIER "]\n",file.c_str(),i,models.size());
|
||||
model->load(file);
|
||||
modelLoadedOk = true;
|
||||
Model *model = renderer.newModel(rsGlobal, file);
|
||||
printf("About to save converted model [%s]\n",file.c_str());
|
||||
model->save(file,textureFormat,keepsmallest);
|
||||
Renderer::getInstance().endModel(rsGlobal, model);
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
result = 1;
|
||||
printf("ERROR loading model [%s] message [%s]\n",file.c_str(),ex.what());
|
||||
}
|
||||
|
||||
if(modelLoadedOk == true) {
|
||||
printf("About to save converted model [%s]\n",file.c_str());
|
||||
model->save(file,textureFormat,keepsmallest);
|
||||
}
|
||||
|
||||
Renderer::getInstance().endModel(rsGlobal, model);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
delete mainWindow;
|
||||
|
|
|
@ -98,23 +98,17 @@ MenuBackground::MenuBackground() : rps(NULL) {
|
|||
degToRad(startRotation.z))));
|
||||
|
||||
//load main model
|
||||
mainModel= renderer.newModel(rsMenu);
|
||||
if(mainModel) {
|
||||
string mainModelFile = "data/core/menu/main_model/menu_main.g3d";
|
||||
if(menuNode->hasChild("menu-background-model") == true) {
|
||||
//mainModel->load(data_path + "data/core/menu/main_model/menu_main.g3d");
|
||||
const XmlNode *mainMenuModelNode= menuNode->getChild("menu-background-model");
|
||||
mainModelFile = mainMenuModelNode->getAttribute("value")->getRestrictedValue();
|
||||
}
|
||||
mainModel->load(getGameCustomCoreDataPath(data_path, mainModelFile));
|
||||
}
|
||||
string mainModelFile = "data/core/menu/main_model/menu_main.g3d";
|
||||
if(menuNode->hasChild("menu-background-model") == true) {
|
||||
//mainModel->load(data_path + "data/core/menu/main_model/menu_main.g3d");
|
||||
const XmlNode *mainMenuModelNode= menuNode->getChild("menu-background-model");
|
||||
mainModelFile = mainMenuModelNode->getAttribute("value")->getRestrictedValue();
|
||||
}
|
||||
mainModel = renderer.newModel(rsMenu, getGameCustomCoreDataPath(data_path, mainModelFile));
|
||||
|
||||
//models
|
||||
for(int i=0; i<5; ++i){
|
||||
characterModels[i]= renderer.newModel(rsMenu);
|
||||
if(characterModels[i]) {
|
||||
characterModels[i]->load(getGameCustomCoreDataPath(data_path, "data/core/menu/about_models/character"+intToStr(i)+".g3d"));
|
||||
}
|
||||
for(int i=0; i<5; ++i) {
|
||||
characterModels[i] = renderer.newModel(rsMenu, getGameCustomCoreDataPath(data_path, "data/core/menu/about_models/character"+intToStr(i)+".g3d"));
|
||||
}
|
||||
|
||||
//about position
|
||||
|
|
|
@ -37,10 +37,7 @@ ObjectType::~ObjectType(){
|
|||
|
||||
TilesetModelType* ObjectType::loadModel(const string &path, std::map<string,vector<pair<string, string> > > *loadedFileList,
|
||||
string parentLoader) {
|
||||
Model *model= Renderer::getInstance().newModel(rsGame);
|
||||
if(model) {
|
||||
model->load(path, false, loadedFileList, &parentLoader);
|
||||
}
|
||||
Model *model= Renderer::getInstance().newModel(rsGame, path, false, loadedFileList, &parentLoader);
|
||||
color= Vec3f(0.f);
|
||||
if(model && model->getMeshCount()>0 && model->getMesh(0)->getTexture(0) != NULL) {
|
||||
const Pixmap2D *p= model->getMesh(0)->getTexture(0)->getPixmapConst();
|
||||
|
|
|
@ -110,10 +110,7 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
|
|||
const XmlNode *modelNode= typeNode->getChild("model");
|
||||
string modelPath= modelNode->getAttribute("path")->getRestrictedValue(currentPath);
|
||||
|
||||
model= renderer.newModel(rsGame);
|
||||
if(model) {
|
||||
model->load(modelPath, false, &loadedFileList, &sourceXMLFile);
|
||||
}
|
||||
model= renderer.newModel(rsGame, modelPath, false, &loadedFileList, &sourceXMLFile);
|
||||
loadedFileList[modelPath].push_back(make_pair(sourceXMLFile,modelNode->getAttribute("path")->getRestrictedValue()));
|
||||
|
||||
if(modelNode->hasChild("particles")){
|
||||
|
|
|
@ -419,10 +419,7 @@ void SkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
|||
for(unsigned int i = 0; i < animationList.size(); ++i) {
|
||||
string path= animationList[i]->getAttribute("path")->getRestrictedValue(currentPath);
|
||||
if(fileExists(path) == true) {
|
||||
Model *animation= Renderer::getInstance().newModel(rsGame);
|
||||
if(animation) {
|
||||
animation->load(path, false, &loadedFileList, &parentLoader);
|
||||
}
|
||||
Model *animation= Renderer::getInstance().newModel(rsGame, path, false, &loadedFileList, &parentLoader);
|
||||
loadedFileList[path].push_back(make_pair(parentLoader,animationList[i]->getAttribute("path")->getRestrictedValue()));
|
||||
|
||||
animations.push_back(animation);
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
virtual TextRenderer3D *newTextRenderer3D() {return new TextRenderer3DGl();}
|
||||
virtual ModelRenderer *newModelRenderer() {return new ModelRendererGl();}
|
||||
virtual Context *newContext() {return new ContextGl();}
|
||||
virtual Model *newModel() {return new ModelGl();}
|
||||
virtual Model *newModel(const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader) { return new ModelGl(path,deletePixMapAfterLoad,loadedFileList,sourceLoader); }
|
||||
virtual Texture2D *newTexture2D() {return new Texture2DGl();}
|
||||
virtual Font2D *newFont2D() {return new Font2DGl();}
|
||||
virtual Font3D *newFont3D() {return new Font3DGl();}
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
//models
|
||||
virtual ModelManager *newModelManager() {return new ModelManager();}
|
||||
virtual ModelRenderer *newModelRenderer() {return new ModelRendererGl();}
|
||||
virtual Model *newModel() {return new ModelGl();}
|
||||
virtual Model *newModel(const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader) { return new ModelGl(path,deletePixMapAfterLoad,loadedFileList,sourceLoader); }
|
||||
|
||||
//text
|
||||
virtual FontManager *newFontManager() {return new FontManager();}
|
||||
|
|
|
@ -22,6 +22,9 @@ namespace Shared{ namespace Graphics{ namespace Gl{
|
|||
// =====================================================
|
||||
|
||||
class ModelGl: public Model{
|
||||
friend class GraphicsFactoryGl;
|
||||
protected:
|
||||
ModelGl(const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader);
|
||||
public:
|
||||
virtual void init(){}
|
||||
virtual void end(){}
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
#define _SHARED_GRAPHICS_GRAPHICSFACTORY_H_
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
using std::string;
|
||||
|
||||
#include "leak_dumper.h"
|
||||
|
||||
namespace Shared{ namespace Graphics{
|
||||
|
@ -64,7 +69,7 @@ public:
|
|||
//models
|
||||
virtual ModelManager *newModelManager() {return NULL;}
|
||||
virtual ModelRenderer *newModelRenderer() {return NULL;}
|
||||
virtual Model *newModel() {return NULL;}
|
||||
virtual Model *newModel(const string &path,bool deletePixMapAfterLoad,std::map<string,std::vector<std::pair<string, string> > > *loadedFileList, string *sourceLoader) {return NULL;}
|
||||
|
||||
//text
|
||||
virtual FontManager *newFontManager() {return NULL;}
|
||||
|
|
|
@ -35,7 +35,7 @@ enum ResourceScope {
|
|||
class RendererInterface {
|
||||
public:
|
||||
virtual Texture2D *newTexture2D(ResourceScope rs) = 0;
|
||||
virtual Model *newModel(ResourceScope rs) = 0;
|
||||
virtual Model *newModel(ResourceScope rs,const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string *sourceLoader=NULL) = 0;
|
||||
|
||||
virtual ~RendererInterface() {}
|
||||
};
|
||||
|
|
|
@ -221,9 +221,7 @@ public:
|
|||
uint32 getVertexCount() const;
|
||||
|
||||
//io
|
||||
void load(const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string *sourceLoader=NULL);
|
||||
void save(const string &path, string convertTextureToFormat,bool keepsmallest);
|
||||
void loadG3d(const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string sourceLoader="");
|
||||
void saveG3d(const string &path, string convertTextureToFormat,bool keepsmallest);
|
||||
|
||||
void setTextureManager(TextureManager *textureManager) {this->textureManager= textureManager;}
|
||||
|
@ -234,6 +232,11 @@ public:
|
|||
void toEndian();
|
||||
void fromEndian();
|
||||
|
||||
protected:
|
||||
void load(const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string *sourceLoader=NULL);
|
||||
void loadG3d(const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string sourceLoader="");
|
||||
|
||||
|
||||
private:
|
||||
void buildInterpolationData() const;
|
||||
void autoJoinMeshFrames();
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
ModelManager();
|
||||
virtual ~ModelManager();
|
||||
|
||||
Model *newModel();
|
||||
Model *newModel(const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader);
|
||||
|
||||
void init();
|
||||
void end();
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#include "model_gl.h"
|
||||
|
||||
namespace Shared{ namespace Graphics{ namespace Gl{
|
||||
|
||||
ModelGl::ModelGl(const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader) {
|
||||
load(path,deletePixMapAfterLoad,loadedFileList,sourceLoader);
|
||||
}
|
||||
|
||||
}}}//end namespace
|
|
@ -40,8 +40,8 @@ ModelManager::~ModelManager(){
|
|||
end();
|
||||
}
|
||||
|
||||
Model *ModelManager::newModel(){
|
||||
Model *model= GraphicsInterface::getInstance().getFactory()->newModel();
|
||||
Model *ModelManager::newModel(const string &path,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader){
|
||||
Model *model= GraphicsInterface::getInstance().getFactory()->newModel(path,deletePixMapAfterLoad,loadedFileList,sourceLoader);
|
||||
model->setTextureManager(textureManager);
|
||||
models.push_back(model);
|
||||
return model;
|
||||
|
|
|
@ -121,55 +121,60 @@ static int getFileAndLine(char *function, void *address, char *file, size_t flen
|
|||
|
||||
// prepare command to be executed
|
||||
// our program need to be passed after the -e parameter
|
||||
#if __APPLE_CC__
|
||||
snprintf(buf, 8096,"xcrun atos -v -o %s %p",PlatformExceptionHandler::application_binary.c_str(),address);
|
||||
fprintf(stderr,"> %s\n",buf);
|
||||
#else
|
||||
snprintf(buf, 8096,"addr2line -C -e %s -f -i %p",PlatformExceptionHandler::application_binary.c_str(),address);
|
||||
|
||||
#endif
|
||||
FILE* f = popen (buf, "r");
|
||||
if (f == NULL) {
|
||||
perror (buf);
|
||||
return 0;
|
||||
}
|
||||
#if __APPLE_CC__
|
||||
//### TODO Will: still working this out
|
||||
int len = fread(buf,1,maxbufSize,f);
|
||||
buf[len] = 0;
|
||||
fprintf(stderr,"< %s",buf);
|
||||
return -1;
|
||||
#endif
|
||||
for(;function != NULL && function[0] != '\0';) {
|
||||
// get function name
|
||||
char *ret = fgets (buf, maxbufSize, f);
|
||||
if(ret == NULL) {
|
||||
pclose(f);
|
||||
return line;
|
||||
}
|
||||
//printf("Looking for [%s] Found [%s]\n",function,ret);
|
||||
if(strstr(ret,function) != NULL) {
|
||||
break;
|
||||
}
|
||||
// get file and line
|
||||
ret = fgets (buf, maxbufSize, f);
|
||||
if(ret == NULL) {
|
||||
pclose(f);
|
||||
return line;
|
||||
}
|
||||
|
||||
if(function != NULL && function[0] != '\0') {
|
||||
line = 0;
|
||||
for(;function != NULL && function[0] != '\0';) {
|
||||
// get function name
|
||||
char *ret = fgets (buf, maxbufSize, f);
|
||||
if(ret == NULL) {
|
||||
pclose(f);
|
||||
return line;
|
||||
}
|
||||
//printf("Looking for [%s] Found [%s]\n",function,ret);
|
||||
if(strstr(ret,function) != NULL) {
|
||||
break;
|
||||
}
|
||||
if(strlen(buf) > 0 && buf[0] != '?') {
|
||||
//int l;
|
||||
char *p = buf;
|
||||
// file name is until ':'
|
||||
while(*p != 0 && *p != ':') {
|
||||
p++;
|
||||
}
|
||||
|
||||
// get file and line
|
||||
ret = fgets (buf, maxbufSize, f);
|
||||
if(ret == NULL) {
|
||||
pclose(f);
|
||||
return line;
|
||||
}
|
||||
|
||||
if(strlen(buf) > 0 && buf[0] != '?') {
|
||||
//int l;
|
||||
char *p = buf;
|
||||
|
||||
// file name is until ':'
|
||||
while(*p != 0 && *p != ':') {
|
||||
p++;
|
||||
}
|
||||
|
||||
*p++ = 0;
|
||||
// after file name follows line number
|
||||
strcpy (file , buf);
|
||||
sscanf (p,"%10d", &line);
|
||||
}
|
||||
else {
|
||||
strcpy (file,"unknown");
|
||||
line = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
*p++ = 0;
|
||||
// after file name follows line number
|
||||
strcpy (file , buf);
|
||||
sscanf (p,"%10d", &line);
|
||||
}
|
||||
else {
|
||||
strcpy (file,"unknown");
|
||||
line = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// get file and line
|
||||
char *ret = fgets (buf, maxbufSize, f);
|
||||
|
|
Loading…
Reference in New Issue