File: DisassembleMain.C

package info (click to toggle)
guavac 1.2-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,728 kB
  • ctags: 2,387
  • sloc: cpp: 20,367; yacc: 1,664; makefile: 504; lex: 348; ansic: 286; sh: 263
file content (34 lines) | stat: -rw-r--r-- 798 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 1995  David Engberg  All rights reserved
// $Id: DisassembleMain.C,v 1.5 1998/04/12 22:17:13 geppetto Exp $
#include "cppstring.h"
#include "JavaClassFile.h"

#ifdef __GNUG__
  #include <iostream.h>
  #include <fstream.h>
#else
  #include <iostream>
  #include <fstream>
#endif

#include "JavaConstant.h"

int
main(int argc, char** argv) {
  for (int count=1; count < argc; count++) {
    ifstream infile;
    infile.open(argv[count]);
    if (infile.is_open() == 0) {
      cerr << "File " << argv[count] << " can't be opened\n";
    } else {
      CJavaClassFile* file = CJavaClassFile::ParseFromStream(infile);
      cout << ((file != 0) ? "success" : "failure") << endl;
      if (file != 0) {
	file->DisassembleClass(cout);
      }
      delete file;
    }
  }
  return 0;
}