/[projet1]/public/pc/tools/osdk/main/FloppyBuilder/FloppyBuilder.cpp
Defence Force logotype

Diff of /public/pc/tools/osdk/main/FloppyBuilder/FloppyBuilder.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1337 by dbug, Sat Oct 24 20:40:51 2015 UTC revision 1338 by dbug, Thu Jan 7 18:51:26 2016 UTC
# Line 90  bool GetNextToken(std::string& returnedT Line 90  bool GetNextToken(std::string& returnedT
90    return false;    return false;
91  }  }
92    
93    
94    class FloppyBuilder : public ArgumentParser
95    {
96    public:
97      FloppyBuilder(int argc,char *argv[])
98        : ArgumentParser(argc,argv)
99      {
100      }
101    
102      int Main();
103    
104    
105    private:
106    };
107    
108    
109  int main(int argc, char *argv[])  int main(int argc, char *argv[])
110  {  {
111    //    try
112    // Some initialization for the common library    {
113    //      //
114    SetApplicationParameters(      // Some initialization for the common library
115      "FloppyBuilder",      //
116      TOOL_VERSION_MAJOR,      SetApplicationParameters(
117      TOOL_VERSION_MINOR,        "FloppyBuilder",
118      "{ApplicationName} - Version {ApplicationVersion} - This program is a part of the OSDK\r\n"        TOOL_VERSION_MAJOR,
119      "\r\n"        TOOL_VERSION_MINOR,
120      "Author:\r\n"        "{ApplicationName} - Version {ApplicationVersion} - This program is a part of the OSDK\r\n"
121      "  (c) 2002 Debrune Jerome for the initial version \r\n"        "\r\n"
122      "  (c) 2015 Pointier Mickael for the subsequent changes \r\n"        "Author:\r\n"
123      "\r\n"        "  (c) 2002 Debrune Jerome for the initial version \r\n"
124      "Purpose:\r\n"        "  (c) 2015 Pointier Mickael for the subsequent changes \r\n"
125      "  Generating bootable floppies for the Oric computer.\r\n"        "\r\n"
126      "\r\n"        "Purpose:\r\n"
127      "Usage:\r\n"        "  Generating bootable floppies for the Oric computer.\r\n"
128      "  {ApplicationName} <init|build|extract> <description file path>\r\n"        "\r\n"
129      "\r\n"        "Usage:\r\n"
130      );        "  {ApplicationName} <init|build|extract> <description file path>\r\n"
131          "\r\n"
132          );
133    
134        FloppyBuilder floppyBuilder(argc,argv);
135        return floppyBuilder.Main();
136      }
137    
138      catch (std::exception& e)
139      {
140        ShowError("Exception thrown: %s",e.what());
141      }
142    }
143    
144    
145    
146    int FloppyBuilder::Main()
147    {
148    
149    // makedisk filetobuild.txt default.dsk ..\build\%OSDKDISK%    // makedisk filetobuild.txt default.dsk ..\build\%OSDKDISK%
150    
151    long param=1;    long param=1;
152    
153    if (argc>1)    if (m_argc>1)
154    {    {
155      for (;;)      for (;;)
156      {      {
157        long nb_arg=argc;        long nb_arg=m_argc;
158        //const char *ptr_arg=argv[param];        //const char *ptr_arg=argv[param];
159    
160        if (nb_arg==argc)   break;        if (nb_arg==m_argc)   break;
161      }      }
162    }    }
163    
164    
165    if (argc!=3)    if (m_argc!=3)
166    {    {
167      ShowError(nullptr);      ShowError(nullptr);
168    }    }
# Line 137  int main(int argc, char *argv[]) Line 170  int main(int argc, char *argv[])
170    Floppy floppy;    Floppy floppy;
171    
172    bool extract=false;    bool extract=false;
173    if (!strcmp(argv[param],"init"))    if (!strcmp(m_argv[param],"init"))
174    {    {
175      floppy.AllowMissingFiles(true);      floppy.AllowMissingFiles(true);
176    }    }
177    else    else
178    if (!strcmp(argv[param],"extract"))    if (!strcmp(m_argv[param],"extract"))
179    {    {
180      floppy.AllowMissingFiles(true);      floppy.AllowMissingFiles(true);
181      extract=true;      extract=true;
182    }    }
183    else    else
184    if (!strcmp(argv[param],"build"))    if (!strcmp(m_argv[param],"build"))
185    {    {
186      floppy.AllowMissingFiles(false);      floppy.AllowMissingFiles(false);
187    }    }
# Line 162  int main(int argc, char *argv[]) Line 195  int main(int argc, char *argv[])
195    //    //
196    // Open the description file    // Open the description file
197    //    //
198    const char* description_name(argv[param]);    const char* description_name(m_argv[param]);
199    std::vector<std::string> script;    std::vector<std::string> script;
200    if (!LoadText(description_name,script))    if (!LoadText(description_name,script))
201    {    {
# Line 477  int main(int argc, char *argv[]) Line 510  int main(int argc, char *argv[])
510        printf("Successfully created '%s'\n",targetFloppyDiskName.c_str());        printf("Successfully created '%s'\n",targetFloppyDiskName.c_str());
511      }      }
512    }    }
513      return 0;
514  }  }

Legend:
Removed from v.1337  
changed lines
  Added in v.1338

  ViewVC Help
Powered by ViewVC 1.1.26