home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / Asuka / source / main.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  3.5 KB  |  111 lines

  1. //    Asuka - VirtualDub Build/Post-Mortem Utility
  2. //    Copyright (C) 2005-2007 Avery Lee
  3. //
  4. //    This program is free software; you can redistribute it and/or modify
  5. //    it under the terms of the GNU General Public License as published by
  6. //    the Free Software Foundation; either version 2 of the License, or
  7. //    (at your option) any later version.
  8. //
  9. //    This program is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. //    GNU General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU General Public License
  15. //    along with this program; if not, write to the Free Software
  16. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. #pragma warning(disable: 4786)        // SHUT UP
  19.  
  20. #include "stdafx.h"
  21. #include <windows.h>
  22.  
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include <stddef.h>
  26.  
  27. #include <vd2/system/vdtypes.h>
  28. #include <vd2/system/vdstl.h>
  29. #include <vd2/system/error.h>
  30.  
  31. #include <vector>
  32. #include <algorithm>
  33.  
  34. #include "utils.h"
  35.  
  36. using namespace std;
  37.  
  38. void tool_verinc(bool amd64);
  39. void tool_lookup(const vdfastvector<const char *>& args, const vdfastvector<const char *>& switches, bool amd64);
  40. void tool_mapconv(const vdfastvector<const char *>& args, const vdfastvector<const char *>& switches, bool amd64);
  41. void tool_fxc(const vdfastvector<const char *>& args, const vdfastvector<const char *>& switches, bool amd64);
  42. void tool_makearray(const vdfastvector<const char *>& args, const vdfastvector<const char *>& switches);
  43. void tool_glc(const vdfastvector<const char *>& args, const vdfastvector<const char *>& switches);
  44. void tool_fontextract(const vdfastvector<const char *>& args, const vdfastvector<const char *>& switches);
  45. void tool_snapsetup();
  46. void tool_filecreate(const vdfastvector<const char *>& args, const vdfastvector<const char *>& switches);
  47. void tool_maketables(const vdfastvector<const char *>& args, const vdfastvector<const char *>& switches);
  48. void tool_psa(const vdfastvector<const char *>& args, const vdfastvector<const char *>& switches);
  49.  
  50. int main(int argc, char **argv) {
  51.     --argc;
  52.     ++argv;
  53.  
  54.     vdfastvector<const char *> switches, args;
  55.     bool amd64 = false;
  56.  
  57.     while(const char *s = *argv++) {
  58.         if (s[0] == '/') {
  59.             if (!_stricmp(s+1, "amd64"))
  60.                 amd64 = true;
  61.             else
  62.                 switches.push_back(s+1);
  63.         } else {
  64.             args.push_back(s);
  65.         }
  66.     }
  67.  
  68.     // look for mode
  69.     if (args.empty())
  70.         help();
  71.  
  72.     const char *s = args[0];
  73.  
  74.     args.erase(args.begin());
  75.  
  76.     try {
  77.         if (!_stricmp(s, "verinc")) {
  78.             read_version();
  79.             tool_verinc(amd64);
  80.         } else if (!_stricmp(s, "lookup"))
  81.             tool_lookup(args, switches, amd64);
  82.         else if (!_stricmp(s, "mapconv")) {
  83.             read_version();
  84.             tool_mapconv(args, switches, amd64);
  85.         } else if (!_stricmp(s, "fxc")) {
  86.             tool_fxc(args, switches, amd64);
  87.         } else if (!_stricmp(s, "makearray")) {
  88.             tool_makearray(args, switches);
  89.         } else if (!_stricmp(s, "glc")) {
  90.             tool_glc(args, switches);
  91.         } else if (!_stricmp(s, "fontextract")) {
  92.             tool_fontextract(args, switches);
  93.         } else if (!_stricmp(s, "snapsetup")) {
  94.             tool_snapsetup();
  95.         } else if (!_stricmp(s, "filecreate")) {
  96.             tool_filecreate(args, switches);
  97.         } else if (!_stricmp(s, "maketables")) {
  98.             tool_maketables(args, switches);
  99.         } else if (!_stricmp(s, "psa")) {
  100.             tool_psa(args, switches);
  101.         } else
  102.             help();
  103.     } catch(const char *s) {
  104.         fail("%s", s);
  105.     } catch(const MyError& e) {
  106.         fail("%s", e.gets());
  107.     }
  108.  
  109.     return 0;
  110. }
  111.