mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
compile on win32
This commit is contained in:
parent
aebc5042f5
commit
671e3e5e85
@ -19,6 +19,7 @@
|
|||||||
// pass around a handle to an open file object.
|
// pass around a handle to an open file object.
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
typedef HANDLE FHandle;
|
typedef HANDLE FHandle;
|
||||||
static const HANDLE invalid_fhandle = INVALID_HANDLE_VALUE;
|
static const HANDLE invalid_fhandle = INVALID_HANDLE_VALUE;
|
||||||
|
@ -109,7 +109,7 @@ main(int argc, char *argv[]) {
|
|||||||
stringstream stream(interactive_console_str);
|
stringstream stream(interactive_console_str);
|
||||||
int flag;
|
int flag;
|
||||||
stream >> flag;
|
stream >> flag;
|
||||||
if (stream) {
|
if (!stream.fail()) {
|
||||||
interactive_console = (flag != 0);
|
interactive_console = (flag != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ P3DPythonRun(const char *program_name, const char *archive_file,
|
|||||||
|
|
||||||
// Open the error output before we do too much more.
|
// Open the error output before we do too much more.
|
||||||
_error_log.open_write(error_handle);
|
_error_log.open_write(error_handle);
|
||||||
if (_error_log) {
|
if (!_error_log.fail()) {
|
||||||
// Set up the indicated error log as the Notify output.
|
// Set up the indicated error log as the Notify output.
|
||||||
_error_log.setf(ios::unitbuf);
|
_error_log.setf(ios::unitbuf);
|
||||||
Notify::ptr()->set_ostream_ptr(&_error_log, false);
|
Notify::ptr()->set_ostream_ptr(&_error_log, false);
|
||||||
|
@ -974,7 +974,7 @@ start_p3dpython(P3DInstance *inst) {
|
|||||||
NULL, CREATE_ALWAYS, 0, NULL);
|
NULL, CREATE_ALWAYS, 0, NULL);
|
||||||
if (handle != INVALID_HANDLE_VALUE) {
|
if (handle != INVALID_HANDLE_VALUE) {
|
||||||
_error_handle = handle;
|
_error_handle = handle;
|
||||||
SetHandleInformation(error_handle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
|
SetHandleInformation(_error_handle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
|
||||||
_got_error_handle = true;
|
_got_error_handle = true;
|
||||||
} else {
|
} else {
|
||||||
nout << "Unable to open " << _log_pathname << "\n";
|
nout << "Unable to open " << _log_pathname << "\n";
|
||||||
@ -1240,7 +1240,7 @@ win_create_process() {
|
|||||||
PROCESS_INFORMATION process_info;
|
PROCESS_INFORMATION process_info;
|
||||||
BOOL result = CreateProcess
|
BOOL result = CreateProcess
|
||||||
(_p3dpython_exe.c_str(), command_line, NULL, NULL, TRUE, 0,
|
(_p3dpython_exe.c_str(), command_line, NULL, NULL, TRUE, 0,
|
||||||
(void *)_env.c_str(), _start_dir_cstr,
|
(void *)_env.c_str(), start_dir_cstr,
|
||||||
&startup_info, &process_info);
|
&startup_info, &process_info);
|
||||||
bool started_program = (result != 0);
|
bool started_program = (result != 0);
|
||||||
|
|
||||||
@ -1372,15 +1372,15 @@ p3dpython_thread_run() {
|
|||||||
size_t zero = _env.find('\0', p);
|
size_t zero = _env.find('\0', p);
|
||||||
while (zero != string::npos) {
|
while (zero != string::npos) {
|
||||||
const char *start = _env.data() + p;
|
const char *start = _env.data() + p;
|
||||||
|
#ifdef _WIN32
|
||||||
|
_putenv(start);
|
||||||
|
#else
|
||||||
const char *equals = strchr(start, '=');
|
const char *equals = strchr(start, '=');
|
||||||
if (equals != NULL) {
|
if (equals != NULL) {
|
||||||
string variable(start, equals - start);
|
string variable(start, equals - start);
|
||||||
#ifdef _WIN32
|
|
||||||
_putenv_s(variable.c_str(), equals + 1);
|
|
||||||
#else
|
|
||||||
setenv(variable.c_str(), equals + 1, true);
|
setenv(variable.c_str(), equals + 1, true);
|
||||||
#endif // _WIN32
|
|
||||||
}
|
}
|
||||||
|
#endif // _WIN32
|
||||||
p = zero + 1;
|
p = zero + 1;
|
||||||
zero = _env.find('\0', p);
|
zero = _env.find('\0', p);
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "run_p3dpython.h"
|
|
||||||
#include "p3dPythonRun.h"
|
#include "p3dPythonRun.h"
|
||||||
|
#include "run_p3dpython.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: run_p3dpython
|
// Function: run_p3dpython
|
||||||
|
@ -31,7 +31,7 @@ run_p3dpython_func(const char *program_name, const char *archive_file,
|
|||||||
FHandle input_handle, FHandle output_handle,
|
FHandle input_handle, FHandle output_handle,
|
||||||
FHandle error_handle, bool interactive_console);
|
FHandle error_handle, bool interactive_console);
|
||||||
|
|
||||||
EXPCL_P3DPYTHON extern "C" bool
|
extern "C" EXPCL_P3DPYTHON bool
|
||||||
run_p3dpython(const char *program_name, const char *archive_file,
|
run_p3dpython(const char *program_name, const char *archive_file,
|
||||||
FHandle input_handle, FHandle output_handle,
|
FHandle input_handle, FHandle output_handle,
|
||||||
FHandle error_handle, bool interactive_console);
|
FHandle error_handle, bool interactive_console);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user