2010-09-03 21:50:35 -07:00
|
|
|
#include <cstring>
|
2009-07-26 10:07:13 +00:00
|
|
|
#include "ASTree.h"
|
|
|
|
|
2010-09-03 21:50:35 -07:00
|
|
|
#ifdef WIN32
|
|
|
|
# define PATHSEP '\\'
|
|
|
|
#else
|
|
|
|
# define PATHSEP '/'
|
|
|
|
#endif
|
|
|
|
|
2009-07-26 10:07:13 +00:00
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
if (argc < 2) {
|
2018-01-28 10:32:44 -08:00
|
|
|
fputs("No input file specified\n", stderr);
|
2009-07-26 10:07:13 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
PycModule mod;
|
|
|
|
mod.loadFromFile(argv[1]);
|
2009-08-03 23:13:50 +00:00
|
|
|
if (!mod.isValid()) {
|
|
|
|
fprintf(stderr, "Could not load file %s\n", argv[1]);
|
|
|
|
return 1;
|
|
|
|
}
|
2010-09-03 21:50:35 -07:00
|
|
|
const char* dispname = strrchr(argv[1], PATHSEP);
|
|
|
|
dispname = (dispname == NULL) ? argv[1] : dispname + 1;
|
2018-01-28 10:32:44 -08:00
|
|
|
fputs("# Source Generated with Decompyle++\n", pyc_output);
|
2011-10-23 19:04:06 -07:00
|
|
|
fprintf(pyc_output, "# File: %s (Python %d.%d%s)\n\n", dispname, mod.majorVer(), mod.minorVer(),
|
|
|
|
(mod.majorVer() < 3 && mod.isUnicode()) ? " Unicode" : "");
|
2009-07-27 00:23:49 +00:00
|
|
|
decompyle(mod.code(), &mod);
|
2009-07-26 10:07:13 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|