Beispiel #1
0
static void ioSuppInit(         // INITIALIZE IO SUPPORT
    INITFINI* defn )            // - definition
{
    defn = defn;
    outFileChecked = 0;
    tempBlock = 0;
    tempname = NULL;
    temphandle = -1;
    workFile[5] = '0';
    FNameBuf = CMemAlloc( _MAX_PATH );
    carve_buf = CarveCreate( sizeof( BUF_ALLOC ), 8 );
    setPaths( pathSrc );
    setPaths( pathHdr );
    setPaths( pathCmd );
}
Beispiel #2
0
/*
 * initialize (this always needs to be done)
 */
int init(char const * archivePath, char  const * archiveName, char const * workpath)
{
#ifdef WIN32
	char *p;
#endif

	if (workpath) {
		f_workpath = (char *)workpath;
#ifdef WIN32
		strcpy(f_temppathraw, f_workpath);
		for ( p = f_temppathraw; *p; p++ )
			if (*p == '/')
				*p = '\\';
#endif
	}

	/* Set up paths */
	if (setPaths(archivePath, archiveName))
		return -1;

	/* Open the archive */
	if (openArchive())
		return -1;

	return 0;
}
Beispiel #3
0
/*
 * initialize (this always needs to be done)
 */
int init(ARCHIVE_STATUS *status, char const * archivePath, char  const * archiveName)
{
	/* Set up paths */
	if (setPaths(status, archivePath, archiveName))
		return -1;

	/* Open the archive */
	if (openArchive(status))
		return -1;

	return 0;
}
Beispiel #4
0
/*
 * Launch an archive with the given fully-qualified path name
 * No command line, no extracting of binaries
 * Designed for embedding situations.
 */
int launchembedded(char const * archivePath, char  const * archiveName)
{
	char pathnm[_MAX_PATH];

	VS("START\n");
	strcpy(pathnm, archivePath);
	strcat(pathnm, archiveName);
	/* Set up paths */
	if (setPaths(archivePath, archiveName))
		return -1;
	VS("Got Paths\n");
	/* Open the archive */
	if (openArchive())
		return -1;
	VS("Opened Archive\n");
	/* Load Python DLL */
	if (loadPython())
		return -1;

	/* Start Python with silly command line */
	if (startPython(1, (char**)&pathnm))
		return -1;
	VS("Started Python\n");

	/* a signal to scripts */
	PyRun_SimpleString("import sys;sys.frozen='dll'\n");
	VS("set sys.frozen\n");
	/* Import modules from archive - this is to bootstrap */
	if (importModules())
		return -1;
	VS("Imported Modules\n");
	/* Install zlibs - now import hooks are in place */
	if (installZlibs())
		return -1;
	VS("Installed Zlibs\n");
	/* Run scripts */
	if (runScripts())
		return -1;
	VS("All scripts run\n");
	if (PyErr_Occurred()) {
		// PyErr_Print();
		//PyErr_Clear();
		VS("Some error occurred\n");
	}
	VS("OK.\n");

	return 0;
}
Beispiel #5
0
// constructor
Interpolation::Interpolation(const char *ipath, const char *opath)
{
  setPaths(ipath, opath);
}
Beispiel #6
0
Themes::Themes(const QString &themename, const QString &configname)
	: QObject(), ThemesList(), ThemesPaths(), additional(),
	ConfigName(configname), Name(themename), ActualTheme("Custom"), entries()
{
	setPaths(QStringList());
}
Beispiel #7
0
int launch(char const * archivePath, char  const * archiveName)
{
	PyObject *obHandle;
	int loadedNew = 0;
	char pathnm[_MAX_PATH];

    VS("START");
	strcpy(pathnm, archivePath);
	strcat(pathnm, archiveName);
    /* Set up paths */
    if (setPaths(archivePath, archiveName))
        return -1;
	VS("Got Paths");
    /* Open the archive */
    if (openArchive())
        return -1;
	VS("Opened Archive");
    /* Load Python DLL */
    if (attachPython(&loadedNew))
        return -1;

	if (loadedNew) {
		/* Start Python with silly command line */
		PyEval_InitThreads();
		if (startPython(1, (char**)&pathnm))
			return -1;
		VS("Started new Python");
		thisthread = PyThreadState_Swap(NULL);
		PyThreadState_Swap(thisthread);
	}
	else {
		VS("Attached to existing Python");

		/* start a mew interp */
		thisthread = PyThreadState_Swap(NULL);
		PyThreadState_Swap(thisthread);
		if (thisthread == NULL) {
			thisthread = Py_NewInterpreter();
			VS("created thisthread");
		}
		else
			VS("grabbed thisthread");
		PyRun_SimpleString("import sys;sys.argv=[]");
	}

	/* a signal to scripts */
	PyRun_SimpleString("import sys;sys.frozen='dll'\n");
	VS("set sys.frozen");
	/* Create a 'frozendllhandle' as a counterpart to
	   sys.dllhandle (which is the Pythonxx.dll handle)
	*/
	obHandle = Py_BuildValue("i", gInstance);
	PySys_SetObject("frozendllhandle", obHandle);
	Py_XDECREF(obHandle);
    /* Import modules from archive - this is to bootstrap */
    if (importModules())
        return -1;
	VS("Imported Modules");
    /* Install zlibs - now import hooks are in place */
    if (installZlibs())
        return -1;
	VS("Installed Zlibs");
    /* Run scripts */
    if (runScripts())
        return -1;
	VS("All scripts run");
    if (PyErr_Occurred()) {
		// PyErr_Print();
		//PyErr_Clear();
		VS("Some error occurred");
    }
	VS("PGL released");
	// Abandon our thread state.
	PyEval_ReleaseThread(thisthread);
    VS("OK.");
    return 0;
}