From 0d238d06aba2c61198ef638424e6e35a2b29a978 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 30 Oct 2000 18:49:38 +0000 Subject: [PATCH] *** empty log message *** --- dtool/Config.pp | 20 ++- dtool/LocalSetup.pp | 3 + dtool/pptempl/Global.pp | 139 ++++++++++++++----- dtool/pptempl/Template.msvc.pp | 20 +-- dtool/pptempl/Template.unix.pp | 16 +-- panda/metalibs/pandagl/Sources.pp | 4 +- panda/metalibs/pandaglut/Sources.pp | 22 --- panda/metalibs/pandaglut/pandaglut.cxx | 9 -- panda/src/builder/mesherFanMaker.I | 4 +- panda/src/chan/animChannelMatrixXfmTable.cxx | 10 +- panda/src/chan/animChannelScalarTable.cxx | 6 +- panda/src/chan/animGroup.cxx | 4 +- panda/src/chan/movingPartMatrix.cxx | 6 +- panda/src/chan/movingPartScalar.cxx | 4 +- panda/src/chan/partGroup.cxx | 14 +- panda/src/collide/collisionNode.cxx | 2 +- panda/src/device/clientBase.cxx | 32 ++++- panda/src/device/clientBase.h | 13 +- panda/src/dgraph/describe_data_verbose.cxx | 2 +- panda/src/downloader/Sources.pp | 1 + panda/src/downloader/asyncUtility.cxx | 15 ++ panda/src/downloader/asyncUtility.h | 13 +- panda/src/downloader/downloader.I | 2 + panda/src/downloader/downloader.cxx | 14 +- panda/src/downloader/downloader.h | 9 +- panda/src/downloader/extractor.cxx | 6 +- panda/src/downloader/patcher.cxx | 5 +- panda/src/downloadertools/Sources.pp | 10 +- panda/src/event/event.cxx | 2 +- panda/src/event/eventQueue.cxx | 2 + panda/src/event/eventQueue.h | 5 + panda/src/express/Sources.pp | 7 +- panda/src/express/datagramGenerator.cxx | 21 +-- panda/src/express/datagramGenerator.h | 8 +- panda/src/express/datagramOutputFile.I | 56 ++++++++ panda/src/framework/framework.cxx | 12 +- panda/src/glutdisplay/Sources.pp | 1 + panda/src/gobj/fog.cxx | 31 +++-- panda/src/gobj/geom.cxx | 2 - panda/src/gobj/imageBuffer.cxx | 2 +- panda/src/gobj/pixelBuffer.cxx | 2 +- panda/src/gobj/texture.cxx | 1 - panda/src/graph/boundedObject.cxx | 2 +- panda/src/graph/node.cxx | 7 +- panda/src/ipc/Sources.pp | 2 + panda/src/ipc/ipc_file.I | 93 ------------- panda/src/ipc/ipc_file.h | 23 --- panda/src/linmath/coordinateSystem.cxx | 10 +- panda/src/loader/bamFile.cxx | 26 +++- panda/src/loader/bamFile.h | 6 +- panda/src/loader/loader.cxx | 5 +- panda/src/loader/loaderFileTypeRegistry.cxx | 2 +- panda/src/mathutil/frustum.I | 18 +-- panda/src/pstatclient/Sources.pp | 2 +- panda/src/pstatclient/pStatClient.cxx | 19 ++- panda/src/pstatclient/pStatClient.h | 27 +++- panda/src/pstatclient/pStatCollector.I | 22 +++ panda/src/pstatclient/pStatThread.I | 7 + panda/src/putil/bamReader.I | 12 -- panda/src/putil/bamReader.cxx | 5 +- panda/src/putil/bamReader.h | 3 - panda/src/putil/bamWriter.h | 1 - panda/src/sgidisplay/Sources.pp | 1 + panda/src/sgmanip/nodePathCollection.cxx | 2 +- panda/src/sgraph/geomNode.cxx | 2 +- panda/src/sgraphutil/sceneGraphAnalyzer.cxx | 7 + panda/src/text/textNode.I | 2 +- pandatool/src/gtk-stats/Sources.pp | 2 + pandatool/src/pstatserver/Sources.pp | 3 + pandatool/src/text-stats/Sources.pp | 3 + 70 files changed, 527 insertions(+), 344 deletions(-) delete mode 100644 panda/metalibs/pandaglut/Sources.pp delete mode 100644 panda/metalibs/pandaglut/pandaglut.cxx create mode 100644 panda/src/express/datagramOutputFile.I diff --git a/dtool/Config.pp b/dtool/Config.pp index 7a677f2f3d..72f7563cd6 100644 --- a/dtool/Config.pp +++ b/dtool/Config.pp @@ -137,7 +137,13 @@ #define PYTHON_LPATH #defer HAVE_PYTHON $[isdir $[PYTHON_IPATH]] -// Is NSPR installed, and where? +// Is NSPR installed, and where? This is the Netscape Portable +// Runtime library, downloadable as part of the Mozilla package from +// mozilla.org. It provides portable threading and networking +// services to Panda. Panda should compile without it, although +// without any threading or networking capabilities; eventually, +// native support for these capabilities may be added for certain +// platforms. See also HAVE_IPC and HAVE_NET. #define NSPR_IPATH /usr/include/nspr #define NSPR_LPATH #define NSPR_LIBS nspr4 @@ -211,8 +217,16 @@ #define MIKMOD_CONFIG libmikmod-config #defer HAVE_MIKMOD $[bintest $[MIKMOD_CONFIG]] +// Do you want to build in support for threading (inter-process +// control)? What additional libraries are required? Currently, this +// requires NSPR to compile correctly. +#define IPC_IPATH +#define IPC_LPATH +#define IPC_LIBS +#defer HAVE_IPC $[HAVE_NSPR] + // Do you want to build the network interface? What additional libraries -// are required? +// are required? Currently, this requires NSPR. #define NET_IPATH #define NET_LPATH #if $[eq $[PLATFORM],Win32] @@ -220,7 +234,7 @@ #else #define NET_LIBS #endif -#define HAVE_NET 1 +#defer HAVE_NET $[HAVE_NSPR] // Do you want to build the audio interface? What additional // libraries are required? diff --git a/dtool/LocalSetup.pp b/dtool/LocalSetup.pp index d12869110c..d82023bb93 100644 --- a/dtool/LocalSetup.pp +++ b/dtool/LocalSetup.pp @@ -58,6 +58,9 @@ $[cdefine HAVE_RIB] /* Define if we want to use mikmod for audio. */ $[cdefine HAVE_MIKMOD] +/* Define if we want to compile the ipc code. */ +$[cdefine HAVE_IPC] + /* Define if we want to compile the net code. */ $[cdefine HAVE_NET] diff --git a/dtool/pptempl/Global.pp b/dtool/pptempl/Global.pp index 1dbed258d6..ed04394f20 100644 --- a/dtool/pptempl/Global.pp +++ b/dtool/pptempl/Global.pp @@ -90,6 +90,18 @@ #define gl_libs $[GL_LIBS] #endif +#if $[HAVE_GLX] + #define glx_ipath $[wildcard $[GLX_IPATH]] + #define glx_lpath $[wildcard $[GLX_LPATH]] + #define glx_libs $[GLX_LIBS] +#endif + +#if $[HAVE_GLUT] + #define glut_ipath $[wildcard $[GLUT_IPATH]] + #define glut_lpath $[wildcard $[GLUT_LPATH]] + #define glut_libs $[GLUT_LIBS] +#endif + #if $[HAVE_DX] #define dx_ipath $[wildcard $[DX_IPATH]] #define dx_lpath $[wildcard $[DX_LPATH]] @@ -123,6 +135,12 @@ #define maya_ld $[MAYA_LOCATION]/bin/mayald #endif +#if $[HAVE_IPC] + #define ipc_ipath $[wildcard $[IPC_IPATH]] + #define ipc_lpath $[wildcard $[IPC_LPATH]] + #define ipc_libs $[IPC_LIBS] +#endif + #if $[HAVE_NET] #define net_ipath $[wildcard $[NET_IPATH]] #define net_lpath $[wildcard $[NET_LPATH]] @@ -156,6 +174,7 @@ $[or $[not $[DIRECTORY_IF_VRPN]],$[HAVE_VRPN]], \ $[or $[not $[DIRECTORY_IF_GTKMM]],$[HAVE_GTKMM]], \ $[or $[not $[DIRECTORY_IF_MAYA]],$[HAVE_MAYA]], \ + $[or $[not $[DIRECTORY_IF_IPC]],$[HAVE_IPC]], \ $[or $[not $[DIRECTORY_IF_NET]],$[HAVE_NET]], \ $[or $[not $[DIRECTORY_IF_AUDIO]],$[HAVE_AUDIO]], \ 1 ] @@ -180,6 +199,7 @@ $[or $[not $[TARGET_IF_VRPN]],$[HAVE_VRPN]], \ $[or $[not $[TARGET_IF_GTKMM]],$[HAVE_GTKMM]], \ $[or $[not $[TARGET_IF_MAYA]],$[HAVE_MAYA]], \ + $[or $[not $[TARGET_IF_IPC]],$[HAVE_IPC]], \ $[or $[not $[TARGET_IF_NET]],$[HAVE_NET]], \ $[or $[not $[TARGET_IF_AUDIO]],$[HAVE_AUDIO]], \ 1 ] @@ -194,6 +214,11 @@ #defer active_libs $[active_local_libs] $[active_component_libs] +// This variable, when evaluated within a target, will either be empty +// string if the target is not to be built, or the target name if it +// is. +#defer active_target $[if $[build_target],$[TARGET]] + // This subroutine will set up the sources variable to reflect the // complete set of sources for this target, and also set the // alt_cflags, alt_libs, etc. as appropriate according to how the @@ -204,6 +229,8 @@ #defer get_sources \ $[SOURCES] \ $[if $[HAVE_ZLIB],$[IF_ZLIB_SOURCES]] \ + $[if $[HAVE_IPC],$[IF_IPC_SOURCES]] \ + $[if $[HAVE_NET],$[IF_NET_SOURCES]] \ $[if $[HAVE_PYTHON],$[IF_PYTHON_SOURCES]] // This variable returns the set of sources that are to be @@ -232,7 +259,7 @@ // current metalib target should include one, or empty string if it // should not. #defer get_igatemscan \ - $[if $[and $[run_interrogate],$[components $[IGATESCAN],$[COMPONENT_LIBS]]], \ + $[if $[and $[run_interrogate],$[components $[IGATESCAN],$[active_component_libs]]], \ $[TARGET]] @@ -243,31 +270,40 @@ #defun get_cflags #define alt_cflags $[nspr_cflags] $[python_cflags] - #if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[COMPONENT_LIBS]],] + #if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[active_component_libs]],] #set alt_cflags $[alt_cflags] $[zlib_cflags] #endif - #if $[ne $[USE_GL] $[components $[USE_GL],$[COMPONENT_LIBS]],] + #if $[ne $[USE_GL] $[components $[USE_GL],$[active_component_libs]],] #set alt_cflags $[alt_cflags] $[gl_cflags] #endif - #if $[ne $[USE_DX] $[components $[USE_DX],$[COMPONENT_LIBS]],] + #if $[ne $[USE_GLX] $[components $[USE_GLX],$[active_component_libs]],] + #set alt_cflags $[alt_cflags] $[glx_cflags] + #endif + #if $[ne $[USE_GLUT] $[components $[USE_GLUT],$[active_component_libs]],] + #set alt_cflags $[alt_cflags] $[glut_cflags] + #endif + #if $[ne $[USE_DX] $[components $[USE_DX],$[active_component_libs]],] #set alt_cflags $[alt_cflags] $[dx_cflags] #endif - #if $[ne $[USE_SOXST] $[components $[USE_SOXST],$[COMPONENT_LIBS]],] + #if $[ne $[USE_SOXST] $[components $[USE_SOXST],$[active_component_libs]],] #set alt_cflags $[alt_cflags] $[soxst_cflags] #endif - #if $[ne $[USE_NET] $[components $[USE_NET],$[COMPONENT_LIBS]],] + #if $[ne $[USE_IPC] $[components $[USE_IPC],$[active_component_libs]],] + #set alt_cflags $[alt_cflags] $[ipc_cflags] + #endif + #if $[ne $[USE_NET] $[components $[USE_NET],$[active_component_libs]],] #set alt_cflags $[alt_cflags] $[net_cflags] #endif - #if $[ne $[USE_AUDIO] $[components $[USE_AUDIO],$[COMPONENT_LIBS]],] + #if $[ne $[USE_AUDIO] $[components $[USE_AUDIO],$[active_component_libs]],] #set alt_cflags $[alt_cflags] $[audio_cflags] #endif - #if $[ne $[USE_MIKMOD] $[components $[USE_MIKMOD],$[COMPONENT_LIBS]],] + #if $[ne $[USE_MIKMOD] $[components $[USE_MIKMOD],$[active_component_libs]],] #set alt_cflags $[alt_cflags] $[mikmod_cflags] #endif - #if $[ne $[USE_GTKMM] $[components $[USE_GTKMM],$[COMPONENT_LIBS]],] + #if $[ne $[USE_GTKMM] $[components $[USE_GTKMM],$[active_component_libs]],] #set alt_cflags $[alt_cflags] $[gtkmm_cflags] #endif - #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[COMPONENT_LIBS]],] + #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[active_component_libs]],] #set alt_cflags $[alt_cflags] $[maya_cflags] #endif @@ -281,31 +317,40 @@ #defun get_ipath #define alt_ipath $[nspr_ipath] $[python_ipath] - #if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[COMPONENT_LIBS]],] + #if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[active_component_libs]],] #set alt_ipath $[alt_ipath] $[zlib_ipath] #endif - #if $[ne $[USE_GL] $[components $[USE_GL],$[COMPONENT_LIBS]],] + #if $[ne $[USE_GL] $[components $[USE_GL],$[active_component_libs]],] #set alt_ipath $[alt_ipath] $[gl_ipath] #endif - #if $[ne $[USE_DX] $[components $[USE_DX],$[COMPONENT_LIBS]],] + #if $[ne $[USE_GLX] $[components $[USE_GLX],$[active_component_libs]],] + #set alt_ipath $[alt_ipath] $[glx_ipath] + #endif + #if $[ne $[USE_GLUT] $[components $[USE_GLUT],$[active_component_libs]],] + #set alt_ipath $[alt_ipath] $[glut_ipath] + #endif + #if $[ne $[USE_DX] $[components $[USE_DX],$[active_component_libs]],] #set alt_ipath $[alt_ipath] $[dx_ipath] #endif - #if $[ne $[USE_SOXST] $[components $[USE_SOXST],$[COMPONENT_LIBS]],] + #if $[ne $[USE_SOXST] $[components $[USE_SOXST],$[active_component_libs]],] #set alt_ipath $[alt_ipath] $[soxst_ipath] #endif - #if $[ne $[USE_NET] $[components $[USE_NET],$[COMPONENT_LIBS]],] + #if $[ne $[USE_IPC] $[components $[USE_IPC],$[active_component_libs]],] + #set alt_ipath $[alt_ipath] $[ipc_ipath] + #endif + #if $[ne $[USE_NET] $[components $[USE_NET],$[active_component_libs]],] #set alt_ipath $[alt_ipath] $[net_ipath] #endif - #if $[ne $[USE_AUDIO] $[components $[USE_AUDIO],$[COMPONENT_LIBS]],] + #if $[ne $[USE_AUDIO] $[components $[USE_AUDIO],$[active_component_libs]],] #set alt_ipath $[alt_ipath] $[audio_ipath] #endif - #if $[ne $[USE_MIKMOD] $[components $[USE_MIKMOD],$[COMPONENT_LIBS]],] + #if $[ne $[USE_MIKMOD] $[components $[USE_MIKMOD],$[active_component_libs]],] #set alt_ipath $[alt_ipath] $[mikmod_ipath] #endif - #if $[ne $[USE_GTKMM] $[components $[USE_GTKMM],$[COMPONENT_LIBS]],] + #if $[ne $[USE_GTKMM] $[components $[USE_GTKMM],$[active_component_libs]],] #set alt_ipath $[alt_ipath] $[gtkmm_ipath] #endif - #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[COMPONENT_LIBS]],] + #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[active_component_libs]],] #set alt_ipath $[alt_ipath] $[maya_ipath] #endif @@ -319,31 +364,40 @@ #defun get_lpath #define alt_lpath $[nspr_lpath] $[python_lpath] - #if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[COMPONENT_LIBS]],] + #if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[active_component_libs]],] #set alt_lpath $[alt_lpath] $[zlib_lpath] #endif - #if $[ne $[USE_GL] $[components $[USE_GL],$[COMPONENT_LIBS]],] + #if $[ne $[USE_GL] $[components $[USE_GL],$[active_component_libs]],] #set alt_lpath $[alt_lpath] $[gl_lpath] #endif - #if $[ne $[USE_DX] $[components $[USE_DX],$[COMPONENT_LIBS]],] + #if $[ne $[USE_GLX] $[components $[USE_GLX],$[active_component_libs]],] + #set alt_lpath $[alt_lpath] $[glx_lpath] + #endif + #if $[ne $[USE_GLUT] $[components $[USE_GLUT],$[active_component_libs]],] + #set alt_lpath $[alt_lpath] $[glut_lpath] + #endif + #if $[ne $[USE_DX] $[components $[USE_DX],$[active_component_libs]],] #set alt_lpath $[alt_lpath] $[dx_lpath] #endif - #if $[ne $[USE_SOXST] $[components $[USE_SOXST],$[COMPONENT_LIBS]],] + #if $[ne $[USE_SOXST] $[components $[USE_SOXST],$[active_component_libs]],] #set alt_lpath $[alt_lpath] $[soxst_lpath] #endif - #if $[ne $[USE_NET] $[components $[USE_NET],$[COMPONENT_LIBS]],] + #if $[ne $[USE_IPC] $[components $[USE_IPC],$[active_component_libs]],] + #set alt_lpath $[alt_lpath] $[ipc_lpath] + #endif + #if $[ne $[USE_NET] $[components $[USE_NET],$[active_component_libs]],] #set alt_lpath $[alt_lpath] $[net_lpath] #endif - #if $[ne $[USE_AUDIO] $[components $[USE_AUDIO],$[COMPONENT_LIBS]],] + #if $[ne $[USE_AUDIO] $[components $[USE_AUDIO],$[active_component_libs]],] #set alt_lpath $[alt_lpath] $[audio_lpath] #endif - #if $[ne $[USE_MIKMOD] $[components $[USE_MIKMOD],$[COMPONENT_LIBS]],] + #if $[ne $[USE_MIKMOD] $[components $[USE_MIKMOD],$[active_component_libs]],] #set alt_lpath $[alt_lpath] $[mikmod_lpath] #endif - #if $[ne $[USE_GTKMM] $[components $[USE_GTKMM],$[COMPONENT_LIBS]],] + #if $[ne $[USE_GTKMM] $[components $[USE_GTKMM],$[active_component_libs]],] #set alt_lpath $[alt_lpath] $[gtkmm_lpath] #endif - #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[COMPONENT_LIBS]],] + #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[active_component_libs]],] #set alt_lpath $[alt_lpath] $[maya_lpath] #endif @@ -358,35 +412,44 @@ #defun get_libs #define alt_libs $[nspr_libs] $[python_libs] - #if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[COMPONENT_LIBS]],] + #if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[active_component_libs]],] #set alt_libs $[alt_libs] $[zlib_libs] #endif - #if $[ne $[USE_GL] $[components $[USE_GL],$[COMPONENT_LIBS]],] + #if $[ne $[USE_GL] $[components $[USE_GL],$[active_component_libs]],] #set alt_libs $[alt_libs] $[gl_libs] #endif - #if $[ne $[USE_DX] $[components $[USE_DX],$[COMPONENT_LIBS]],] + #if $[ne $[USE_GLX] $[components $[USE_GLX],$[active_component_libs]],] + #set alt_libs $[alt_libs] $[glx_libs] + #endif + #if $[ne $[USE_GLUT] $[components $[USE_GLUT],$[active_component_libs]],] + #set alt_libs $[alt_libs] $[glut_libs] + #endif + #if $[ne $[USE_DX] $[components $[USE_DX],$[active_component_libs]],] #set alt_libs $[alt_libs] $[dx_libs] #endif - #if $[ne $[USE_SOXST] $[components $[USE_SOXST],$[COMPONENT_LIBS]],] + #if $[ne $[USE_SOXST] $[components $[USE_SOXST],$[active_component_libs]],] #set alt_libs $[alt_libs] $[soxst_libs] #endif - #if $[ne $[USE_NET] $[components $[USE_NET],$[COMPONENT_LIBS]],] + #if $[ne $[USE_IPC] $[components $[USE_IPC],$[active_component_libs]],] + #set alt_libs $[alt_libs] $[ipc_libs] + #endif + #if $[ne $[USE_NET] $[components $[USE_NET],$[active_component_libs]],] #set alt_libs $[alt_libs] $[net_libs] #endif - #if $[ne $[USE_AUDIO] $[components $[USE_AUDIO],$[COMPONENT_LIBS]],] + #if $[ne $[USE_AUDIO] $[components $[USE_AUDIO],$[active_component_libs]],] #set alt_libs $[alt_libs] $[audio_libs] #endif - #if $[ne $[USE_MIKMOD] $[components $[USE_MIKMOD],$[COMPONENT_LIBS]],] + #if $[ne $[USE_MIKMOD] $[components $[USE_MIKMOD],$[active_component_libs]],] #set alt_libs $[alt_libs] $[mikmod_libs] #endif - #if $[ne $[USE_GTKMM] $[components $[USE_GTKMM],$[COMPONENT_LIBS]],] + #if $[ne $[USE_GTKMM] $[components $[USE_GTKMM],$[active_component_libs]],] #set alt_libs $[alt_libs] $[gtkmm_libs] #endif - #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[COMPONENT_LIBS]],] + #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[active_component_libs]],] #set alt_libs $[alt_libs] $[maya_libs] #endif #if $[UNIX_PLATFORM] - #set alt_libs $[alt_libs] $[UNIX_SYS_LIBS] $[components $[UNIX_SYS_LIBS],$[COMPONENT_LIBS]] + #set alt_libs $[alt_libs] $[UNIX_SYS_LIBS] $[components $[UNIX_SYS_LIBS],$[active_component_libs]] #endif $[alt_libs] diff --git a/dtool/pptempl/Template.msvc.pp b/dtool/pptempl/Template.msvc.pp index da5840dcc8..db4e23ad3e 100644 --- a/dtool/pptempl/Template.msvc.pp +++ b/dtool/pptempl/Template.msvc.pp @@ -53,17 +53,17 @@ // $[bin_targets] the list of binaries. $[test_bin_targets] is the // list of binaries that are to be built only when specifically asked // for. -#define lib_targets $[patsubst %,$[so_dir]\lib%$[dllext].dll,$[TARGET(metalib_target noinst_lib_target)] $[real_lib_targets]] -#define static_lib_targets $[TARGET(static_lib_target):%=$[st_dir]\lib%$[dllext].lib] +#define lib_targets $[patsubst %,$[so_dir]\lib%$[dllext].dll,$[active_target(metalib_target noinst_lib_target)] $[real_lib_targets]] +#define static_lib_targets $[active_target(static_lib_target):%=$[st_dir]\lib%$[dllext].lib] #define bin_targets \ - $[TARGET(bin_target noinst_bin_target):%=$[st_dir]\%.exe] \ - $[TARGET(sed_bin_target):%=$[st_dir]\%] -#define test_bin_targets $[TARGET(test_bin_target):%=$[st_dir]\%.exe] + $[active_target(bin_target noinst_bin_target):%=$[st_dir]\%.exe] \ + $[active_target(sed_bin_target):%=$[st_dir]\%] +#define test_bin_targets $[active_target(test_bin_target):%=$[st_dir]\%.exe] // And these variables will define the various things we need to // install. -#define install_lib $[TARGET(metalib_target static_lib_target)] $[real_lib_targets] -#define install_bin $[TARGET(bin_target)] +#define install_lib $[active_target(metalib_target static_lib_target)] $[real_lib_targets] +#define install_bin $[active_target(bin_target)] #define install_scripts $[sort $[INSTALL_SCRIPTS(metalib_target lib_target static_lib_target bin_target)] $[INSTALL_SCRIPTS]] #define install_headers $[sort $[INSTALL_HEADERS(metalib_target lib_target static_lib_target bin_target)] $[INSTALL_HEADERS]] #define install_parser_inc $[sort $[INSTALL_PARSER_INC]] @@ -214,13 +214,13 @@ cleanall : clean $[if $[install_config],$[install_config_dir]] \ $[if $[install_igatedb],$[install_igatedb_dir]] \ ] \ - $[TARGET(metalib_target lib_target static_lib_target):%=install-lib%] \ - $[TARGET(bin_target sed_bin_target):%=install-%] \ + $[active_target(metalib_target lib_target static_lib_target):%=install-lib%] \ + $[active_target(bin_target sed_bin_target):%=install-%] \ $[installed_files] install : all $[install_targets] -uninstall : $[TARGET(metalib_target lib_target static_lib_target):%=uninstall-lib%] $[TARGET(bin_target):%=uninstall-%] +uninstall : $[active_target(metalib_target lib_target static_lib_target):%=uninstall-lib%] $[active_target(bin_target):%=uninstall-%] #if $[installed_files] del /f $[sort $[installed_files]] #endif diff --git a/dtool/pptempl/Template.unix.pp b/dtool/pptempl/Template.unix.pp index 89bafa75d7..b0a91a4981 100644 --- a/dtool/pptempl/Template.unix.pp +++ b/dtool/pptempl/Template.unix.pp @@ -38,15 +38,15 @@ // $[bin_targets] the list of binaries. $[test_bin_targets] is the // list of binaries that are to be built only when specifically asked // for. -#define lib_targets $[TARGET(metalib_target lib_target noinst_lib_target):%=$[so_dir]/lib%.so] -#define static_lib_targets $[TARGET(static_lib_target):%=$[st_dir]/lib%.a] -#define bin_targets $[TARGET(bin_target noinst_bin_target sed_bin_target):%=$[st_dir]/%] -#define test_bin_targets $[TARGET(test_bin_target):%=$[st_dir]/%] +#define lib_targets $[active_target(metalib_target lib_target noinst_lib_target):%=$[so_dir]/lib%.so] +#define static_lib_targets $[active_target(static_lib_target):%=$[st_dir]/lib%.a] +#define bin_targets $[active_target(bin_target noinst_bin_target sed_bin_target):%=$[st_dir]/%] +#define test_bin_targets $[active_target(test_bin_target):%=$[st_dir]/%] // And these variables will define the various things we need to // install. -#define install_lib $[TARGET(metalib_target lib_target static_lib_target)] -#define install_bin $[TARGET(bin_target)] +#define install_lib $[active_target(metalib_target lib_target static_lib_target)] +#define install_bin $[active_target(bin_target)] #define install_scripts $[sort $[INSTALL_SCRIPTS(metalib_target lib_target static_lib_target bin_target)] $[INSTALL_SCRIPTS]] #define install_headers $[sort $[INSTALL_HEADERS(metalib_target lib_target static_lib_target bin_target)] $[INSTALL_HEADERS]] #define install_parser_inc $[sort $[INSTALL_PARSER_INC]] @@ -197,8 +197,8 @@ cleanall : clean $[if $[install_config],$[install_config_dir]] \ $[if $[install_igatedb],$[install_igatedb_dir]] \ ] \ - $[TARGET(metalib_target lib_target static_lib_target):%=install-lib%] \ - $[TARGET(bin_target sed_bin_target):%=install-%] \ + $[active_target(metalib_target lib_target static_lib_target):%=install-lib%] \ + $[active_target(bin_target sed_bin_target):%=install-%] \ $[installed_files] install : all $[install_targets] diff --git a/panda/metalibs/pandagl/Sources.pp b/panda/metalibs/pandagl/Sources.pp index d73d7c3d55..7a6ab62bfb 100644 --- a/panda/metalibs/pandagl/Sources.pp +++ b/panda/metalibs/pandagl/Sources.pp @@ -10,7 +10,9 @@ #define BUILDING_DLL BUILDING_PANDAGL #define COMPONENT_LIBS \ - glgsg glxdisplay wgldisplay // sgiglxdisplay + glgsg glxdisplay wgldisplay glutdisplay \ + sgidisplay sgiglxdisplay sgiglutdisplay + #define LOCAL_LIBS gsgbase display express #define OTHER_LIBS dtool diff --git a/panda/metalibs/pandaglut/Sources.pp b/panda/metalibs/pandaglut/Sources.pp deleted file mode 100644 index 97a2cd485d..0000000000 --- a/panda/metalibs/pandaglut/Sources.pp +++ /dev/null @@ -1,22 +0,0 @@ -#define DIRECTORY_IF_GLUT yes - -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILDING_DLL BUILDING_PANDAGLUT - -#define COMPONENT_LIBS \ - glutdisplay // sgiglutdisplay - -#define LOCAL_LIBS glgsg display express -#define OTHER_LIBS dtool - -#begin metalib_target - #define TARGET pandaglut - - #define SOURCES pandaglut.cxx -#end metalib_target diff --git a/panda/metalibs/pandaglut/pandaglut.cxx b/panda/metalibs/pandaglut/pandaglut.cxx deleted file mode 100644 index a9bb983c4f..0000000000 --- a/panda/metalibs/pandaglut/pandaglut.cxx +++ /dev/null @@ -1,9 +0,0 @@ -// Filename: pandaglut.cxx -// Created by: drose (15May00) -// -//////////////////////////////////////////////////////////////////// - -// This is a dummy file whose sole purpose is to give the compiler -// something to compile when making libpandaglut.so in NO_DEFER mode, -// which generates an empty library that itself links with all the -// other shared libraries that make up libpandaglut. diff --git a/panda/src/builder/mesherFanMaker.I b/panda/src/builder/mesherFanMaker.I index 61678ee728..0e0ed704c7 100644 --- a/panda/src/builder/mesherFanMaker.I +++ b/panda/src/builder/mesherFanMaker.I @@ -102,8 +102,8 @@ compute_angle() const { Edges::const_iterator ei; for (ei = _edges.begin(); ei != _edges.end(); ++ei) { - Normalf v1 = (Vertexf &)(*ei)->_a->get_coord_value(*_bucket) - v0; - Normalf v2 = (Vertexf &)(*ei)->_b->get_coord_value(*_bucket) - v0; + Normalf v1 = (*ei)->_a->get_coord_value(*_bucket) - v0; + Normalf v2 = (*ei)->_b->get_coord_value(*_bucket) - v0; v1 = normalize(v1); v2 = normalize(v2); diff --git a/panda/src/chan/animChannelMatrixXfmTable.cxx b/panda/src/chan/animChannelMatrixXfmTable.cxx index d0c8e089b4..4368d497a0 100644 --- a/panda/src/chan/animChannelMatrixXfmTable.cxx +++ b/panda/src/chan/animChannelMatrixXfmTable.cxx @@ -149,7 +149,7 @@ void AnimChannelMatrixXfmTable:: set_table(char table_id, const CPTA_float &table) { int num_frames = _root->get_num_frames(); - if (table.size() > 1 && table.size() < num_frames) { + if (table.size() > 1 && (int)table.size() < num_frames) { // The new table has an invalid number of frames--it doesn't match // the bundle's requirement. return; @@ -231,7 +231,7 @@ write_datagram(BamWriter *manager, Datagram &me) // Write out everything the old way, as floats. for(int i = 0; i < num_tables; i++) { me.add_uint16(_tables[i].size()); - for(int j = 0; j < _tables[i].size(); j++) { + for(int j = 0; j < (int)_tables[i].size(); j++) { me.add_float64(_tables[i][j]); } } @@ -243,7 +243,7 @@ write_datagram(BamWriter *manager, Datagram &me) int i; for(i = 0; i < 3; i++) { me.add_uint16(_tables[i].size()); - for(int j = 0; j < _tables[i].size(); j++) { + for(int j = 0; j < (int)_tables[i].size(); j++) { me.add_uint16((int)max(min(_tables[i][j]*256.0, 65535.0), 0.0)); } } @@ -251,7 +251,7 @@ write_datagram(BamWriter *manager, Datagram &me) // Now, write out the joint angles. These are in the range 0 .. 360. for(i = 3; i < 6; i++) { me.add_uint16(_tables[i].size()); - for(int j = 0; j < _tables[i].size(); j++) { + for(int j = 0; j < (int)_tables[i].size(); j++) { me.add_uint16((unsigned int)(_tables[i][j] * 65536.0 / 360.0)); } } @@ -260,7 +260,7 @@ write_datagram(BamWriter *manager, Datagram &me) // -1000 .. 1000. for(i = 6; i < 9; i++) { me.add_uint16(_tables[i].size()); - for(int j = 0; j < _tables[i].size(); j++) { + for(int j = 0; j < (int)_tables[i].size(); j++) { me.add_int16((int)max(min(_tables[i][j] * 32767.0 / 1000.0, 32767.0), -32767.0)); } } diff --git a/panda/src/chan/animChannelScalarTable.cxx b/panda/src/chan/animChannelScalarTable.cxx index 5b2f2ff823..c6973e47b0 100644 --- a/panda/src/chan/animChannelScalarTable.cxx +++ b/panda/src/chan/animChannelScalarTable.cxx @@ -78,7 +78,7 @@ void AnimChannelScalarTable:: set_table(const CPTA_float &table) { int num_frames = _root->get_num_frames(); - if (table.size() > 1 && table.size() < num_frames) { + if (table.size() > 1 && (int)table.size() < num_frames) { // The new table has an invalid number of frames--it doesn't match // the bundle's requirement. return; @@ -122,7 +122,7 @@ write_datagram(BamWriter *manager, Datagram &me) if (!quantize_bam_channels) { // Write out everything the old way, as floats. me.add_uint16(_table.size()); - for(int i = 0; i < _table.size(); i++) { + for(int i = 0; i < (int)_table.size(); i++) { me.add_float64(_table[i]); } @@ -131,7 +131,7 @@ write_datagram(BamWriter *manager, Datagram &me) // We quantize morphs within the range -100 .. 100. me.add_uint16(_table.size()); - for(int i = 0; i < _table.size(); i++) { + for(int i = 0; i < (int)_table.size(); i++) { me.add_int16((int)max(min(_table[i] * 32767.0 / 100.0, 32767.0), -32767.0)); } } diff --git a/panda/src/chan/animGroup.cxx b/panda/src/chan/animGroup.cxx index ae0463a9da..ccc3606b6b 100644 --- a/panda/src/chan/animGroup.cxx +++ b/panda/src/chan/animGroup.cxx @@ -52,7 +52,7 @@ get_num_children() const { //////////////////////////////////////////////////////////////////// AnimGroup *AnimGroup:: get_child(int n) const { - nassertr(n >= 0 && n < _children.size(), NULL); + nassertr(n >= 0 && n < (int)_children.size(), NULL); return _children[n]; } @@ -149,7 +149,7 @@ write_datagram(BamWriter *manager, Datagram &me) //Write out the root manager->write_pointer(me, this->_root); me.add_uint16(_children.size()); - for(int i = 0; i < _children.size(); i++) + for(int i = 0; i < (int)_children.size(); i++) { manager->write_pointer(me, _children[i]); } diff --git a/panda/src/chan/movingPartMatrix.cxx b/panda/src/chan/movingPartMatrix.cxx index c24f36d8ea..cb8ddcbd5d 100644 --- a/panda/src/chan/movingPartMatrix.cxx +++ b/panda/src/chan/movingPartMatrix.cxx @@ -38,7 +38,7 @@ get_blend_value(const PartBundle *root) { AnimControl *control = (*blend.begin()).first; int channel_index = control->get_channel_index(); - nassertv(channel_index >= 0 && channel_index < _channels.size()); + nassertv(channel_index >= 0 && channel_index < (int)_channels.size()); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); nassertv(channel != NULL); @@ -59,7 +59,7 @@ get_blend_value(const PartBundle *root) { nassertv(effect != 0.0); int channel_index = control->get_channel_index(); - nassertv(channel_index >= 0 && channel_index < _channels.size()); + nassertv(channel_index >= 0 && channel_index < (int)_channels.size()); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); nassertv(channel != NULL); @@ -90,7 +90,7 @@ get_blend_value(const PartBundle *root) { nassertv(effect != 0.0); int channel_index = control->get_channel_index(); - nassertv(channel_index >= 0 && channel_index < _channels.size()); + nassertv(channel_index >= 0 && channel_index < (int)_channels.size()); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); nassertv(channel != NULL); diff --git a/panda/src/chan/movingPartScalar.cxx b/panda/src/chan/movingPartScalar.cxx index 5335c7b4f7..1ba7ff077d 100644 --- a/panda/src/chan/movingPartScalar.cxx +++ b/panda/src/chan/movingPartScalar.cxx @@ -36,7 +36,7 @@ get_blend_value(const PartBundle *root) { AnimControl *control = (*blend.begin()).first; int channel_index = control->get_channel_index(); - nassertv(channel_index >= 0 && channel_index < _channels.size()); + nassertv(channel_index >= 0 && channel_index < (int)_channels.size()); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); nassertv(channel != NULL); @@ -54,7 +54,7 @@ get_blend_value(const PartBundle *root) { nassertv(effect != 0.0); int channel_index = control->get_channel_index(); - nassertv(channel_index >= 0 && channel_index < _channels.size()); + nassertv(channel_index >= 0 && channel_index < (int)_channels.size()); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); nassertv(channel != NULL); diff --git a/panda/src/chan/partGroup.cxx b/panda/src/chan/partGroup.cxx index a6e7302f54..5d560bd3e9 100644 --- a/panda/src/chan/partGroup.cxx +++ b/panda/src/chan/partGroup.cxx @@ -94,7 +94,7 @@ get_num_children() const { //////////////////////////////////////////////////////////////////// PartGroup *PartGroup:: get_child(int n) const { - nassertr(n >= 0 && n < _children.size(), NULL); + nassertr(n >= 0 && n < (int)_children.size(), NULL); return _children[n]; } @@ -265,20 +265,18 @@ check_hierarchy(const AnimGroup *anim, const PartGroup *, } } - while (i < get_num_children()) { - PartGroup *pc = get_child(i); + if (i < get_num_children()) { + // There's at least one extra part. if ((hierarchy_match_flags & HMF_ok_part_extra) == 0) { return false; } - i++; } - while (j < anim->get_num_children()) { - AnimGroup *ac = anim->get_child(j); + if (j < anim->get_num_children()) { + // There's at least one extra anim channel. if ((hierarchy_match_flags & HMF_ok_anim_extra) == 0) { return false; } - j++; } return true; @@ -399,7 +397,7 @@ write_datagram(BamWriter *manager, Datagram &me) int i; me.add_string(get_name()); me.add_uint16(_children.size()); - for(i = 0; i < _children.size(); i++) + for(i = 0; i < (int)_children.size(); i++) { manager->write_pointer(me, _children[i]); } diff --git a/panda/src/collide/collisionNode.cxx b/panda/src/collide/collisionNode.cxx index c1082dfaef..31f3040d25 100644 --- a/panda/src/collide/collisionNode.cxx +++ b/panda/src/collide/collisionNode.cxx @@ -190,7 +190,7 @@ write_datagram(BamWriter *manager, Datagram &me) NamedNode::write_datagram(manager, me); me.add_uint16(_solids.size()); - for(i = 0; i < _solids.size(); i++) + for(i = 0; i < (int)_solids.size(); i++) { manager->write_pointer(me, _solids[i]); } diff --git a/panda/src/device/clientBase.cxx b/panda/src/device/clientBase.cxx index 46bd0092e8..7a50c5e9d6 100644 --- a/panda/src/device/clientBase.cxx +++ b/panda/src/device/clientBase.cxx @@ -17,9 +17,11 @@ TypeHandle ClientBase::_type_handle; //////////////////////////////////////////////////////////////////// ClientBase:: ClientBase(const string &server) : - _sleep_time(1000000/60), _server(server), - _forked(false), _shutdown(false) + _sleep_time(1000000/60), _server(server), _forked(false) { +#ifdef HAVE_IPC + _shutdown = false; +#endif } @@ -31,6 +33,7 @@ ClientBase(const string &server) : ClientBase:: ~ClientBase() { +#ifdef HAVE_IPC if (asynchronous_clients && _forked == true) { { //Make sure that you grab all locks before setting shutdown to @@ -48,6 +51,7 @@ ClientBase:: void *ret; _client_thread->join(&ret); } +#endif } //////////////////////////////////////////////////////////////////// // Function: ClientBase::fork_asynchronous_thread @@ -56,6 +60,7 @@ ClientBase:: //////////////////////////////////////////////////////////////////// void ClientBase:: fork_asynchronous_thread(void) { +#ifdef HAVE_IPC if (asynchronous_clients) { _client_thread = thread::create(&st_callback, this); _forked = true; @@ -65,6 +70,7 @@ fork_asynchronous_thread(void) { << endl; } } +#endif } //////////////////////////////////////////////////////////////////// @@ -79,6 +85,7 @@ set_poll_time(float poll_time) { } +#ifdef HAVE_IPC //////////////////////////////////////////////////////////////////// // Function: ClientBase::st_callback // Access: Private, static @@ -117,6 +124,7 @@ callback(void) { ipc_traits::sleep(0, _sleep_time); } } +#endif // HAVE_IPC //////////////////////////////////////////////////////////////////// // Function: ClientBase::get_tracker_data @@ -136,7 +144,9 @@ get_tracker_data(const string &tracker, int sensor) { } //Make sure to prevent simultaneous write and read of device +#ifdef HAVE_IPC mutex_lock lock(_tracker_lock); +#endif if ((find(_trackers.begin(), _trackers.end(), tracker) != _trackers.end()) || (find(_sensors[tracker].begin(), _sensors[tracker].end(), sensor) @@ -174,7 +184,9 @@ get_analog_data(const string &analog) { } //Make sure to prevent simultaneous write and read of device +#ifdef HAVE_IPC mutex_lock lock(_analog_lock); +#endif if (find(_analogs.begin(), _analogs.end(), analog) != _analogs.end()) { if (_analog_datas.find(analog) != _analog_datas.end()) { @@ -209,7 +221,9 @@ get_button_data(const string &button) { } //Make sure to prevent simultaneous write and read of device +#ifdef HAVE_IPC mutex_lock lock(_button_lock); +#endif if (find(_buttons.begin(), _buttons.end(), button) != _buttons.end()) { if (_button_datas.find(button) != _button_datas.end()) { @@ -242,7 +256,9 @@ get_dial_data(const string &dial) { } //Make sure to prevent simultaneous write and read of device +#ifdef HAVE_IPC mutex_lock lock(_dial_lock); +#endif if (find(_dials.begin(), _dials.end(), dial) != _dials.end()) { if (_dial_datas.find(dial) != _dial_datas.end()) { @@ -267,7 +283,9 @@ void ClientBase:: push_tracker_position(const string &tracker, const int &sensor, const double &ptime, const LPoint3f &pos, const LVector4f &pquat) { //Make sure to prevent simultaneous write and read of device +#ifdef HAVE_IPC mutex_lock lock(_tracker_lock); +#endif _tracker_datas[tracker][sensor].ptime = ptime; _tracker_datas[tracker][sensor].position = pos; @@ -284,7 +302,9 @@ void ClientBase:: push_tracker_velocity(const string &tracker, int sensor, const double &vtime, const LPoint3f &vel, const LVector4f &vquat, const float &dt) { //Make sure to prevent simultaneous write and read of device +#ifdef HAVE_IPC mutex_lock lock(_tracker_lock); +#endif _tracker_datas[tracker][sensor].vtime = vtime; _tracker_datas[tracker][sensor].velocity = vel; @@ -302,7 +322,9 @@ void ClientBase:: push_tracker_acceleration(const string &tracker, const int &sensor, const double &atime, const LPoint3f &acc, const LVector4f &aquat, const float &dt) { //Make sure to prevent simultaneous write and read of device +#ifdef HAVE_IPC mutex_lock lock(_tracker_lock); +#endif _tracker_datas[tracker][sensor].atime = atime; _tracker_datas[tracker][sensor].acceleration = acc; @@ -320,7 +342,9 @@ void ClientBase:: push_analog(const string &analog, const float &atime, const double *channels, int num_channels) { //Make sure to prevent simultaneous write and read of device +#ifdef HAVE_IPC mutex_lock lock(_analog_lock); +#endif _analog_datas[analog].atime = atime; @@ -341,7 +365,9 @@ void ClientBase:: push_button(const string &button, const float &btime, const int &button_id, const int &state) { //Make sure to prevent simultaneous write and read of device +#ifdef HAVE_IPC mutex_lock lock(_button_lock); +#endif _button_datas[button].btime = btime; _button_datas[button].button_id = button_id; @@ -358,7 +384,9 @@ void ClientBase:: push_dial(const string &dial, const float &dtime, const int &dial_id, const float &change) { //Make sure to prevent simultaneous write and read of device +#ifdef HAVE_IPC mutex_lock lock(_dial_lock); +#endif _dial_datas[dial].dtime = dtime; _dial_datas[dial].dial_id = dial_id; diff --git a/panda/src/device/clientBase.h b/panda/src/device/clientBase.h index 7dbe1c3218..15ae8b90f0 100644 --- a/panda/src/device/clientBase.h +++ b/panda/src/device/clientBase.h @@ -15,11 +15,14 @@ #include #include +#include +#include + +#ifdef HAVE_IPC #include #include #include -#include -#include +#endif #include @@ -60,7 +63,9 @@ protected: private: int _sleep_time; const string _server; - + bool _forked; + +#ifdef HAVE_IPC //Device locks and conditionals mutex _tracker_lock; mutex _analog_lock; @@ -69,11 +74,11 @@ private: //Thread variables and functions thread *_client_thread; - bool _forked; bool _shutdown; static void* st_callback(void *arg); void callback(void); +#endif protected: //Device polling functions diff --git a/panda/src/dgraph/describe_data_verbose.cxx b/panda/src/dgraph/describe_data_verbose.cxx index b9424e2cb0..ba6e03ce07 100644 --- a/panda/src/dgraph/describe_data_verbose.cxx +++ b/panda/src/dgraph/describe_data_verbose.cxx @@ -48,7 +48,7 @@ describe_data_verbose(ostream &out, const NodeAttributes &state, } indent(out, indent_level) << name; - if (name.length() < data_indent_level) { + if ((int)name.length() < data_indent_level) { indent(out, data_indent_level - name.length()); } else { out << " "; diff --git a/panda/src/downloader/Sources.pp b/panda/src/downloader/Sources.pp index 96997cb5cf..89fcf9bbf3 100644 --- a/panda/src/downloader/Sources.pp +++ b/panda/src/downloader/Sources.pp @@ -1,6 +1,7 @@ #define LOCAL_LIBS event ipc express pandabase #define OTHER_LIBS interrogatedb:c dconfig:c dtoolutil:c dtoolbase:c dtool:m #define USE_ZLIB yes +#define USE_IPC yes #begin lib_target #define TARGET downloader diff --git a/panda/src/downloader/asyncUtility.cxx b/panda/src/downloader/asyncUtility.cxx index 0faa9b764e..c5ce0cf9ea 100644 --- a/panda/src/downloader/asyncUtility.cxx +++ b/panda/src/downloader/asyncUtility.cxx @@ -32,7 +32,10 @@ AsyncUtility(float frequency) : _frequency(frequency) { _shutdown = false; _threaded = false; _threads_enabled = true; + +#ifdef HAVE_IPC _request_cond = new condition_variable(_lock); +#endif } //////////////////////////////////////////////////////////////////// @@ -42,7 +45,9 @@ AsyncUtility(float frequency) : _frequency(frequency) { //////////////////////////////////////////////////////////////////// AsyncUtility:: ~AsyncUtility() { +#ifdef HAVE_IPC delete _request_cond; +#endif } //////////////////////////////////////////////////////////////////// @@ -52,12 +57,14 @@ AsyncUtility:: //////////////////////////////////////////////////////////////////// void AsyncUtility:: create_thread(void) { +#ifdef HAVE_IPC if (_threaded == false && _threads_enabled == true) { downloader_cat.debug() << "AsyncUtility::create_thread()" << endl; _thread = thread::create(&st_callback, this); _threaded = true; } +#endif } //////////////////////////////////////////////////////////////////// @@ -67,6 +74,7 @@ create_thread(void) { //////////////////////////////////////////////////////////////////// void AsyncUtility:: destroy_thread(void) { +#ifdef HAVE_IPC if (_threaded == false) return; @@ -81,6 +89,7 @@ destroy_thread(void) { // thread returns. void *ret; _thread->join(&ret); +#endif } //////////////////////////////////////////////////////////////////// @@ -97,8 +106,10 @@ destroy_thread(void) { //////////////////////////////////////////////////////////////////// void* AsyncUtility:: st_callback(void *arg) { +#ifdef HAVE_IPC nassertr(arg != NULL, NULL); ((AsyncUtility *)arg)->callback(); +#endif return NULL; } @@ -110,12 +121,14 @@ st_callback(void *arg) { //////////////////////////////////////////////////////////////////// void AsyncUtility:: callback(void) { +#ifdef HAVE_IPC while (process_request()) { // Sleep until a signal arrives _lock.lock(); _request_cond->wait(); _lock.unlock(); } +#endif } //////////////////////////////////////////////////////////////////// @@ -125,6 +138,7 @@ callback(void) { //////////////////////////////////////////////////////////////////// void AsyncUtility:: nap(void) const { +#ifdef HAVE_IPC #ifdef WIN32 _sleep(1000 * _frequency); #else @@ -133,4 +147,5 @@ nap(void) const { tv.tv_usec = (long)(1000000 * _frequency); select(0, NULL, NULL, NULL, &tv); #endif +#endif // HAVE_IPC } diff --git a/panda/src/downloader/asyncUtility.h b/panda/src/downloader/asyncUtility.h index 074455c5f0..9a8dea306c 100644 --- a/panda/src/downloader/asyncUtility.h +++ b/panda/src/downloader/asyncUtility.h @@ -11,10 +11,14 @@ //////////////////////////////////////////////////////////////////// #include #include +#include + +#ifdef HAVE_IPC #include #include #include -#include +#endif + //////////////////////////////////////////////////////////////////// // Class : AsyncUtility @@ -41,11 +45,14 @@ protected: int _next_token; bool _shutdown; bool _threaded; + float _frequency; + bool _threads_enabled; + +#ifdef HAVE_IPC mutex _lock; condition_variable *_request_cond; thread *_thread; - float _frequency; - bool _threads_enabled; +#endif }; #include "asyncUtility.I" diff --git a/panda/src/downloader/downloader.I b/panda/src/downloader/downloader.I index 03dbbceb7f..23159b9362 100644 --- a/panda/src/downloader/downloader.I +++ b/panda/src/downloader/downloader.I @@ -13,7 +13,9 @@ //////////////////////////////////////////////////////////////////// INLINE void Downloader:: set_bandwidth(float bytes) { +#ifdef HAVE_IPC mutex_lock lock(_bandwidth_frequency_lock); +#endif _bandwidth = bytes; } diff --git a/panda/src/downloader/downloader.cxx b/panda/src/downloader/downloader.cxx index ca63c0bc33..893d0e1fb3 100644 --- a/panda/src/downloader/downloader.cxx +++ b/panda/src/downloader/downloader.cxx @@ -18,9 +18,12 @@ #include #include -#if !defined(WIN32) +#if !defined(WIN32_VC) // #define errno wsaGetLastError() #include + #include + #include + #include #endif //////////////////////////////////////////////////////////////////// @@ -247,7 +250,9 @@ request_download(const string &file_name, const Filename &file_dest, } // We need to grab the lock in order to signal the condition variable +#ifdef HAVE_IPC _lock.lock(); +#endif if (_token_board->_waiting.is_full()) { downloader_cat.error() @@ -265,9 +270,10 @@ request_download(const string &file_name, const Filename &file_dest, partial_content); _token_board->_waiting.insert(tok); +#ifdef HAVE_IPC _request_cond->signal(); - _lock.unlock(); +#endif } else { // If we're not running asynchronously, process the load request @@ -480,9 +486,13 @@ download(const string &file_name, Filename file_dest, for (;;) { if (_download_enabled) { // Ensure that these don't change while we're computing read_size +#ifdef HAVE_IPC _bandwidth_frequency_lock.lock(); +#endif int read_size = (int)(_bandwidth * _frequency); +#ifdef HAVE_IPC _bandwidth_frequency_lock.unlock(); +#endif // Ensure we have enough room in the buffer to download read_size // If we don't have enough room, write the buffer to disk diff --git a/panda/src/downloader/downloader.h b/panda/src/downloader/downloader.h index 6fa0c66925..5c9afc5763 100644 --- a/panda/src/downloader/downloader.h +++ b/panda/src/downloader/downloader.h @@ -16,8 +16,12 @@ #include #include "asyncUtility.h" -#if defined(WIN32) +#if defined(WIN32_VC) #include +#else + #include + #include + #include #endif class DownloaderToken; @@ -91,7 +95,10 @@ private: bool _connected; +#ifdef HAVE_IPC mutex _bandwidth_frequency_lock; +#endif + int _socket; PT(Buffer) _buffer; float _bandwidth; diff --git a/panda/src/downloader/extractor.cxx b/panda/src/downloader/extractor.cxx index 59a2a983b2..a99e5fb1c7 100644 --- a/panda/src/downloader/extractor.cxx +++ b/panda/src/downloader/extractor.cxx @@ -106,7 +106,9 @@ request_extract(const Filename &source_file, const string &event_name, } // We need to grab the lock in order to signal the condition variable +#ifdef HAVE_IPC _lock.lock(); +#endif if (_token_board->_waiting.is_full()) { downloader_cat.error() @@ -123,9 +125,10 @@ request_extract(const Filename &source_file, const string &event_name, rel_path); _token_board->_waiting.insert(tok); +#ifdef HAVE_IPC _request_cond->signal(); - _lock.unlock(); +#endif } else { // If we're not running asynchronously, process the load request @@ -239,7 +242,6 @@ extract(Filename &source_file, const Filename &rel_path) { handled_all_input = true; nap(); - } read_stream.close(); diff --git a/panda/src/downloader/patcher.cxx b/panda/src/downloader/patcher.cxx index d0b9cc0c15..baf38b1564 100644 --- a/panda/src/downloader/patcher.cxx +++ b/panda/src/downloader/patcher.cxx @@ -103,7 +103,9 @@ request_patch(const Filename &patch, const Filename &infile, } // We need to grab the lock in order to signal the condition variable +#ifdef HAVE_IPC _lock.lock(); +#endif if (_token_board->_waiting.is_full()) { downloader_cat.error() @@ -119,9 +121,10 @@ request_patch(const Filename &patch, const Filename &infile, tok = new PatcherToken(_next_token++, patch, infile, event_name); _token_board->_waiting.insert(tok); +#ifdef HAVE_IPC _request_cond->signal(); - _lock.unlock(); +#endif } else { // If we're not running asynchronously, process the load request diff --git a/panda/src/downloadertools/Sources.pp b/panda/src/downloadertools/Sources.pp index 80c7b54c92..334cb3971a 100644 --- a/panda/src/downloadertools/Sources.pp +++ b/panda/src/downloadertools/Sources.pp @@ -1,6 +1,7 @@ #define OTHER_LIBS interrogatedb:c dconfig:c dtoolutil:c dtoolbase:c dtool:m pystub #define LOCAL_LIBS downloader express event ipc -#define USE_ZLIB yes +#define USE_IPC yes +#define DIRECTORY_IF_IPC yes #begin bin_target #define TARGET apply_patch @@ -23,6 +24,7 @@ #begin bin_target #define TARGET check_adler #define TARGET_IF_ZLIB yes + #define USE_ZLIB yes #define SOURCES \ check_adler.cxx @@ -31,6 +33,8 @@ #begin bin_target #define TARGET check_crc + #define TARGET_IF_ZLIB yes + #define USE_ZLIB yes #define SOURCES \ check_crc.cxx @@ -47,6 +51,8 @@ #begin bin_target #define TARGET pcompress + #define TARGET_IF_ZLIB yes + #define USE_ZLIB yes #define SOURCES \ pcompress.cxx @@ -55,6 +61,8 @@ #begin bin_target #define TARGET pdecompress + #define TARGET_IF_ZLIB yes + #define USE_ZLIB yes #define SOURCES \ pdecompress.cxx diff --git a/panda/src/event/event.cxx b/panda/src/event/event.cxx index ceefc92fb3..46964a9db1 100644 --- a/panda/src/event/event.cxx +++ b/panda/src/event/event.cxx @@ -82,7 +82,7 @@ get_num_parameters() const { //////////////////////////////////////////////////////////////////// EventParameter Event:: get_parameter(int n) const { - nassertr(n >= 0 && n < _parameters.size(), EventParameter(0)); + nassertr(n >= 0 && n < (int)_parameters.size(), EventParameter(0)); return _parameters[n]; } diff --git a/panda/src/event/eventQueue.cxx b/panda/src/event/eventQueue.cxx index 4e63a7d691..66ca7a744c 100644 --- a/panda/src/event/eventQueue.cxx +++ b/panda/src/event/eventQueue.cxx @@ -34,7 +34,9 @@ EventQueue:: //////////////////////////////////////////////////////////////////// void EventQueue:: queue_event(CPT_Event event) { +#ifdef HAVE_IPC mutex_lock lock(_lock); +#endif if (_queue.is_full()) { event_cat.error() << "Ignoring event " << *event << "; event queue full.\n"; diff --git a/panda/src/event/eventQueue.h b/panda/src/event/eventQueue.h index b267a5299b..b0a2dc08ab 100644 --- a/panda/src/event/eventQueue.h +++ b/panda/src/event/eventQueue.h @@ -12,7 +12,10 @@ #include "pt_Event.h" #include + +#ifdef HAVE_IPC #include +#endif //////////////////////////////////////////////////////////////////// // Class : EventQueue @@ -42,7 +45,9 @@ protected: static void make_global_event_queue(); static EventQueue *_global_event_queue; +#ifdef HAVE_IPC mutex _lock; +#endif }; #include "eventQueue.I" diff --git a/panda/src/express/Sources.pp b/panda/src/express/Sources.pp index f9614d2b11..468d345f2e 100644 --- a/panda/src/express/Sources.pp +++ b/panda/src/express/Sources.pp @@ -10,7 +10,9 @@ circBuffer.I circBuffer.h clockObject.I clockObject.cxx \ clockObject.h config_express.cxx config_express.h datagram.I \ datagram.cxx datagram.h datagramGenerator.I datagramGenerator.cxx \ - datagramGenerator.h datagramIterator.cxx datagramIterator.h \ + datagramGenerator.h datagramInputFile.I datagramInputFile.h \ + datagramInputFile.cxx datagramIterator.cxx datagramIterator.h \ + datagramOutputFile.I datagramOutputFile.h datagramOutputFile.cxx \ datagramSink.I datagramSink.cxx datagramSink.h \ get_config_path.cxx get_config_path.h \ indent.I indent.cxx indent.h littleEndian.I \ @@ -27,7 +29,8 @@ #define INSTALL_HEADERS \ bigEndian.I bigEndian.h buffer.I buffer.h circBuffer.I \ circBuffer.h clockObject.I clockObject.h config_express.h \ - datagram.I datagram.h datagramIterator.h \ + datagram.I datagram.h datagramInputFile.I datagramInputFile.h \ + datagramIterator.h datagramOutputFile.I datagramOutputFile.h \ datagramSink.I datagramSink.h datagramGenerator.I \ datagramGenerator.h get_config_path.h \ indent.I indent.h littleEndian.I littleEndian.h \ diff --git a/panda/src/express/datagramGenerator.cxx b/panda/src/express/datagramGenerator.cxx index d57305823c..4297a7867d 100644 --- a/panda/src/express/datagramGenerator.cxx +++ b/panda/src/express/datagramGenerator.cxx @@ -1,16 +1,17 @@ -// Filename: datagramGenerator.cxx -// Created by: jason (07Jun00) -// +// Filename: datagramGenerator.cxx +// Created by: jason (07Jun00) +// #include #include "datagramGenerator.h" -//////////////////////////////////////////////////////////////////// -// Function: DatagramGenerator::Destructor -// Access: Public -// Description: Does nothing since this is class is just -// the definition of an interface -//////////////////////////////////////////////////////////////////// -DatagramGenerator::~DatagramGenerator(void){ +//////////////////////////////////////////////////////////////////// +// Function: DatagramGenerator::Destructor +// Access: Public, Virtual> +// Description: Does nothing since this is class is just +// the definition of an interface +//////////////////////////////////////////////////////////////////// +DatagramGenerator:: +~DatagramGenerator() { } diff --git a/panda/src/express/datagramGenerator.h b/panda/src/express/datagramGenerator.h index 52810a363d..a770e899fe 100644 --- a/panda/src/express/datagramGenerator.h +++ b/panda/src/express/datagramGenerator.h @@ -17,12 +17,12 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEXPRESS DatagramGenerator { public: - INLINE DatagramGenerator(void); - virtual ~DatagramGenerator(void); + INLINE DatagramGenerator(); + virtual ~DatagramGenerator(); virtual bool get_datagram(Datagram& dataBlock) = 0; - virtual bool empty(void) = 0; - virtual bool is_valid(void) = 0; + virtual bool is_eof() = 0; + virtual bool is_error() = 0; }; #include "datagramGenerator.I" diff --git a/panda/src/express/datagramOutputFile.I b/panda/src/express/datagramOutputFile.I new file mode 100644 index 0000000000..ee9621ee69 --- /dev/null +++ b/panda/src/express/datagramOutputFile.I @@ -0,0 +1,56 @@ +// Filename: datagramOutputFile.I +// Created by: drose (27Oct00) +// +//////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////// +// Function: DatagramOutputFile::Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE DatagramOutputFile:: +DatagramOutputFile() { + _error = true; + _wrote_first_datagram = false; +} + +//////////////////////////////////////////////////////////////////// +// Function: DatagramOutputFile::open +// Access: Public +// Description: Opens the indicated filename for reading. Returns +// true if successful, false on failure. +//////////////////////////////////////////////////////////////////// +INLINE bool DatagramOutputFile:: +open(Filename filename) { + // DatagramOutputFiles are always binary. + _wrote_first_datagram = false; + _error = false; + filename.set_binary(); + return filename.open_write(_out); +} + +//////////////////////////////////////////////////////////////////// +// Function: DatagramOutputFile::is_error +// Access: Public +// Description: Returns true if the file has reached an error +// condition. +//////////////////////////////////////////////////////////////////// +INLINE bool DatagramOutputFile:: +is_error() { + if (_out.fail()) { + _error = true; + } + return _error; +} + +//////////////////////////////////////////////////////////////////// +// Function: DatagramOutputFile::close +// Access: Public +// Description: Closes the file. This is also implicitly done when +// the DatagramOutputFile destructs. +//////////////////////////////////////////////////////////////////// +INLINE void DatagramOutputFile:: +close() { + _out.close(); +} diff --git a/panda/src/framework/framework.cxx b/panda/src/framework/framework.cxx index 67f403c98d..1f177d624b 100644 --- a/panda/src/framework/framework.cxx +++ b/panda/src/framework/framework.cxx @@ -80,7 +80,6 @@ #include #include #include -#include #include #include #include @@ -88,6 +87,7 @@ #include #ifdef USE_IPC +#include #include #include #endif @@ -408,10 +408,12 @@ void event_esc(CPT_Event) { rib_pipe = NULL; rib_win = NULL; +#ifdef HAVE_NET if (PStatClient::get_global_pstats()->is_connected()) { nout << "Disconnecting from stats host" << endl; PStatClient::get_global_pstats()->disconnect(); } +#endif exit(0); } @@ -434,17 +436,25 @@ void event_f(CPT_Event) { } void event_S(CPT_Event) { +#ifdef HAVE_NET nout << "Connecting to stats host" << endl; PStatClient::get_global_pstats()->connect(); +#else + nout << "Stats host not supported." << endl; +#endif } void event_A(CPT_Event) { +#ifdef HAVE_NET if (PStatClient::get_global_pstats()->is_connected()) { nout << "Disconnecting from stats host" << endl; PStatClient::get_global_pstats()->disconnect(); } else { nout << "Stats host is already disconnected." << endl; } +#else + nout << "Stats host not supported." << endl; +#endif } void setup_framerate(void) { diff --git a/panda/src/glutdisplay/Sources.pp b/panda/src/glutdisplay/Sources.pp index 0b57c2fed6..7e0775d378 100644 --- a/panda/src/glutdisplay/Sources.pp +++ b/panda/src/glutdisplay/Sources.pp @@ -3,6 +3,7 @@ #define OTHER_LIBS interrogatedb:c dconfig:c dtoolutil:c dtoolbase:c dtool:m #define USE_GL yes +#define USE_GLUT yes #begin lib_target #define TARGET glutdisplay diff --git a/panda/src/gobj/fog.cxx b/panda/src/gobj/fog.cxx index f3a8c03f6a..21d9f4d2e0 100644 --- a/panda/src/gobj/fog.cxx +++ b/panda/src/gobj/fog.cxx @@ -69,19 +69,22 @@ void Fog::compute_density(void) { _density = 1.0f; float opaque_multiplier; switch (_mode) { - case M_linear: - break; - case M_exponential: - // Multiplier = ln(2^bits) - opaque_multiplier = MathNumbers::ln2 * _hardware_bits; - _density = opaque_multiplier / (_opaque + _opaque_offset); - break; - case M_super_exponential: - // Multiplier = ln(squrt(2^bits)) - opaque_multiplier = 0.5f * MathNumbers::ln2 * _hardware_bits; - opaque_multiplier *= opaque_multiplier; - _density = opaque_multiplier / (_opaque + _opaque_offset); - break; + case M_linear: + break; + case M_exponential: + // Multiplier = ln(2^bits) + opaque_multiplier = MathNumbers::ln2 * _hardware_bits; + _density = opaque_multiplier / (_opaque + _opaque_offset); + break; + case M_super_exponential: + // Multiplier = ln(squrt(2^bits)) + opaque_multiplier = 0.5f * MathNumbers::ln2 * _hardware_bits; + opaque_multiplier *= opaque_multiplier; + _density = opaque_multiplier / (_opaque + _opaque_offset); + break; + case M_spline: + // *** What's this? + break; } } @@ -102,5 +105,7 @@ output(ostream &out) const { out << "(" << _hardware_bits << "," << _density << "," << _opaque << "," << _opaque_offset << ")"; break; + case M_spline: + break; }; } diff --git a/panda/src/gobj/geom.cxx b/panda/src/gobj/geom.cxx index bf2e0513be..26d4bbbc6c 100644 --- a/panda/src/gobj/geom.cxx +++ b/panda/src/gobj/geom.cxx @@ -20,8 +20,6 @@ #include #include -#include - //////////////////////////////////////////////////////////////////// // Static variables //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/imageBuffer.cxx b/panda/src/gobj/imageBuffer.cxx index d01f59e794..db8f68bd5c 100644 --- a/panda/src/gobj/imageBuffer.cxx +++ b/panda/src/gobj/imageBuffer.cxx @@ -50,7 +50,7 @@ write_datagram(BamWriter *, Datagram &me) default: gobj_cat.error() - << "Unsupported bam-texture-mode: " << bam_texture_mode << "\n"; + << "Unsupported bam-texture-mode: " << (int)bam_texture_mode << "\n"; } me.add_string(filename); diff --git a/panda/src/gobj/pixelBuffer.cxx b/panda/src/gobj/pixelBuffer.cxx index dfa0cdb7b5..25587868c7 100644 --- a/panda/src/gobj/pixelBuffer.cxx +++ b/panda/src/gobj/pixelBuffer.cxx @@ -225,7 +225,7 @@ store(PNMImage &pnmimage) const { gobj_cat.error() << "Couldn't write image for " << get_name() - << "; inappropriate type " << _type << ".\n"; + << "; inappropriate type " << (int)_type << ".\n"; return false; } diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 3ea2da817c..a2066cc7a4 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -196,7 +196,6 @@ clear_gsg(GraphicsStateGuardianBase *gsg) { Contexts::iterator ci; ci = _contexts.find(gsg); if (ci != _contexts.end()) { - TextureContext *tc = (*ci).second; _contexts.erase(ci); } else { // If this assertion fails, clear_gsg() was called on a GSG which diff --git a/panda/src/graph/boundedObject.cxx b/panda/src/graph/boundedObject.cxx index ed95e5d7b8..d515026dfd 100644 --- a/panda/src/graph/boundedObject.cxx +++ b/panda/src/graph/boundedObject.cxx @@ -47,7 +47,7 @@ recompute_bound() { default: graph_cat.error() - << "Unexpected _bound_type: " << _bound_type + << "Unexpected _bound_type: " << (int)_bound_type << " in BoundedObject::recompute_bound()\n"; _bound = NULL; } diff --git a/panda/src/graph/node.cxx b/panda/src/graph/node.cxx index a7e1c945ad..f720df310b 100644 --- a/panda/src/graph/node.cxx +++ b/panda/src/graph/node.cxx @@ -4,7 +4,6 @@ #include "node.h" #include "nodeRelation.h" -#include #include #include #include @@ -187,7 +186,8 @@ get_parent(TypeHandle type, int index) const { UpRelations::const_iterator uri; uri = _parents.find(type); nassertr(uri != _parents.end(), (NodeRelation *)NULL); - nassertr(index >= 0 && index < (*uri).second.size(), (NodeRelation *)NULL); + nassertr(index >= 0 && index < (int)(*uri).second.size(), + (NodeRelation *)NULL); return (*uri).second[index]; } @@ -220,7 +220,8 @@ get_child(TypeHandle type, int index) const { DownRelations::const_iterator dri; dri = _children.find(type); nassertr(dri != _children.end(), (NodeRelation *)NULL); - nassertr(index >= 0 && index < (*dri).second.size(), (NodeRelation *)NULL); + nassertr(index >= 0 && index < (int)(*dri).second.size(), + (NodeRelation *)NULL); return (*dri).second[index]; } diff --git a/panda/src/ipc/Sources.pp b/panda/src/ipc/Sources.pp index 2ba165d4be..d5741610e0 100644 --- a/panda/src/ipc/Sources.pp +++ b/panda/src/ipc/Sources.pp @@ -1,6 +1,8 @@ #define LOCAL_LIBS express pandabase #define OTHER_LIBS interrogatedb:c dconfig:c dtoolutil:c dtoolbase:c dtool:m #define USE_NSPR yes +#define USE_IPC yes +#define DIRECTORY_IF_IPC yes #begin lib_target #define TARGET ipc diff --git a/panda/src/ipc/ipc_file.I b/panda/src/ipc/ipc_file.I index e56b2b07b0..7f71cd49eb 100644 --- a/panda/src/ipc/ipc_file.I +++ b/panda/src/ipc/ipc_file.I @@ -1,96 +1,3 @@ // Filename: ipc_file.I // Created by: jason (07Jun00) // - -#include -#include -#include - -INLINE bool datagram_file:: -open(file_mode mode, string header){ - //By definition a file should not be opened for both - //reading and writing - nassertr(mode != FILE_BOTH, false); - _mode = mode; - - if (!base_file::open(mode)) return false; - - if (!header.empty()) - { - if (mode == FILE_READ) - { - string file_header; - if (readin(file_header,header.size()) != (int)header.size()) return false; - if (file_header != header) - { - //Note! Using nout until a config_ipc file is made and therefore - //ipc_cat is made - nout << "File is either damaged or not valid" << endl; - return false; - } - } - else - { - if (writeout(header) != (int)header.size()) return false; - } - } - - _valid = true; - return true; -} - -INLINE bool datagram_file:: -is_valid(void) -{ - return _valid; -} - -INLINE bool datagram_file:: -empty(void){ - return file::empty(); -} - -INLINE bool datagram_file:: -get_datagram(Datagram& dataBlock) { - //Only perform reads when mode is set to - //FILE_READ. This is because datagram_file - //can only read or write. - nassertr(_mode == FILE_READ, false); - - string header, packet; - - if (readin(header,sizeof(PN_uint32)) != sizeof(PN_uint32)) return false; - - Datagram size(header.data(), header.size()); - DatagramIterator sizescan(size); - - PN_uint32 packetsize = sizescan.get_uint32(); - - if (readin(packet, packetsize) != (int)packetsize) return false; - dataBlock.append_data(packet.data(), packetsize); - - return true; -} - -INLINE bool datagram_file:: -put_datagram(const Datagram& dataBlock) { - //Only perform writes when mode is set to - //FILE_READ or FILE_APPEND. This is because datagram_file - //can only read or write. - nassertr(_mode == FILE_APPEND || _mode == FILE_WRITE, false); - DatagramIterator scanin(dataBlock); - Datagram out; - int datalen = dataBlock.get_length(); - - //Determine the size of the datagram and add it into the data to be - //written to the file. Then append the message. - out.add_uint32(datalen); - out.append_data(scanin.get_remaining_bytes().data(), datalen); - - DatagramIterator scanout(out); - if (writeout(scanout.get_remaining_bytes()) != (int)out.get_length()) return false; - - return true; -} - - diff --git a/panda/src/ipc/ipc_file.h b/panda/src/ipc/ipc_file.h index 8f18365e59..09e709ad38 100644 --- a/panda/src/ipc/ipc_file.h +++ b/panda/src/ipc/ipc_file.h @@ -31,29 +31,6 @@ private: file_class* _file; }; -class datagram_file : public DatagramGenerator, public DatagramSink, public base_file { -public: - INLINE datagram_file() : base_file(), _valid(false) {} - INLINE datagram_file(const string& file) : base_file(file) {} - virtual ~datagram_file(void){}; - - INLINE bool open(file_mode mode, string header = ""); - INLINE bool empty(void); - - INLINE bool get_datagram(Datagram& dataBlock); - INLINE bool put_datagram(const Datagram& dataBlock); - INLINE bool is_valid(void); - -protected: - //When someone has a datagram_file, they shouldn't be directly reading from or - //writing to the file - INLINE int readin(string& buffer, int numBytes) {return base_file::readin(buffer, numBytes);} - INLINE int writeout(const string& buffer) {return base_file::writeout(buffer);} -private: - file_mode _mode; - bool _valid; -}; - typedef base_file file; typedef file::file_mode file_mode; diff --git a/panda/src/linmath/coordinateSystem.cxx b/panda/src/linmath/coordinateSystem.cxx index d238b73681..c1317ade4b 100644 --- a/panda/src/linmath/coordinateSystem.cxx +++ b/panda/src/linmath/coordinateSystem.cxx @@ -58,11 +58,13 @@ is_right_handed(CoordinateSystem cs) { case CS_zup_left: case CS_yup_left: return false; + + default: + linmath_cat.error() + << "Invalid coordinate system value: " << (int)cs << "\n"; + nassertr(false, false); + return false; } - linmath_cat.error() - << "Invalid coordinate system value: " << (int)cs << "\n"; - nassertr(false, false); - return false; } ostream & diff --git a/panda/src/loader/bamFile.cxx b/panda/src/loader/bamFile.cxx index 6787c9e77c..5f725ff298 100644 --- a/panda/src/loader/bamFile.cxx +++ b/panda/src/loader/bamFile.cxx @@ -59,12 +59,18 @@ open_read(const Filename &filename, bool report_errors) { loader_cat.info() << "Reading " << bam_filename << "\n"; - _dfile.setFile(bam_filename.to_os_specific()); - if (!_dfile.open(file::FILE_READ, _bam_header)) { + if (!_din.open(bam_filename)) { + loader_cat.error() << "Could not open " << bam_filename << "\n"; return false; } - _reader = new BamReader(&_dfile); + string head = _din.read_header(_bam_header.size()); + if (head != _bam_header) { + loader_cat.error() << bam_filename << " is not a valid BAM file.\n"; + return false; + } + + _reader = new BamReader(&_din); if (!_reader->init()) { close(); return false; @@ -129,12 +135,17 @@ open_write(const Filename &filename, bool) { loader_cat.info() << "Writing " << filename << "\n"; - _dfile.setFile(filename.to_os_specific()); - if (!_dfile.open(file::FILE_WRITE, _bam_header)) { + if (!_dout.open(filename)) { + loader_cat.error() << "Unable to open " << filename << "\n"; return false; } - _writer = new BamWriter(&_dfile); + if (!_dout.write_header(_bam_header)) { + loader_cat.error() << "Unable to write to " << filename << "\n"; + return false; + } + + _writer = new BamWriter(&_dout); if (!_writer->init()) { close(); @@ -186,7 +197,8 @@ close() { delete _writer; _writer = NULL; } - _dfile.close(); + _din.close(); + _dout.close(); } diff --git a/panda/src/loader/bamFile.h b/panda/src/loader/bamFile.h index b6b1356d17..df81dc432e 100644 --- a/panda/src/loader/bamFile.h +++ b/panda/src/loader/bamFile.h @@ -8,7 +8,8 @@ #include -#include +#include +#include class BamReader; class BamWriter; @@ -43,7 +44,8 @@ public: int get_current_minor_ver(); private: - datagram_file _dfile; + DatagramInputFile _din; + DatagramOutputFile _dout; BamReader *_reader; BamWriter *_writer; }; diff --git a/panda/src/loader/loader.cxx b/panda/src/loader/loader.cxx index 4e6bb23835..d1e6136eff 100644 --- a/panda/src/loader/loader.cxx +++ b/panda/src/loader/loader.cxx @@ -132,7 +132,9 @@ request_load(const Filename &filename, const string &event_name) { } // We need to grab the lock in order to signal the condition variable +#ifdef HAVE_IPC _lock.lock(); +#endif if (_token_board->_waiting.is_full()) { loader_cat.error() @@ -148,9 +150,10 @@ request_load(const Filename &filename, const string &event_name) { tok = new LoaderToken(_next_token++, filename, event_name); _token_board->_waiting.insert(tok); +#ifdef HAVE_IPC _request_cond->signal(); - _lock.unlock(); +#endif } else { // If we're not running asynchronously, process the load request diff --git a/panda/src/loader/loaderFileTypeRegistry.cxx b/panda/src/loader/loaderFileTypeRegistry.cxx index 4785a90977..b6c1c7986d 100644 --- a/panda/src/loader/loaderFileTypeRegistry.cxx +++ b/panda/src/loader/loaderFileTypeRegistry.cxx @@ -63,7 +63,7 @@ get_num_types() const { //////////////////////////////////////////////////////////////////// LoaderFileType *LoaderFileTypeRegistry:: get_type(int n) const { - nassertr(n >= 0 && n < _types.size(), NULL); + nassertr(n >= 0 && n < (int)_types.size(), NULL); return _types[n]; } diff --git a/panda/src/mathutil/frustum.I b/panda/src/mathutil/frustum.I index 702bc332c7..5734213f2e 100644 --- a/panda/src/mathutil/frustum.I +++ b/panda/src/mathutil/frustum.I @@ -212,11 +212,12 @@ get_perspective_projection_mat(CoordinateSystem cs) const { case CS_yup_left: return LMatrix4::convert_mat(CS_yup_right, CS_yup_left) * get_perspective_projection_mat(CS_yup_right); + + default: + mathutil_cat.error() + << "Invalid coordinate system!\n"; + return LMatrix4::ident_mat(); } - - mathutil_cat.error() - << "Invalid coordinate system!\n"; - return LMatrix4::ident_mat(); } //////////////////////////////////////////////////////////////////// @@ -258,9 +259,10 @@ get_ortho_projection_mat(CoordinateSystem cs) const { case CS_yup_left: return LMatrix4::convert_mat(CS_yup_right, CS_yup_left) * get_ortho_projection_mat(CS_yup_right); - } - mathutil_cat.error() - << "Invalid coordinate system!\n"; - return LMatrix4::ident_mat(); + default: + mathutil_cat.error() + << "Invalid coordinate system!\n"; + return LMatrix4::ident_mat(); + } } diff --git a/panda/src/pstatclient/Sources.pp b/panda/src/pstatclient/Sources.pp index e020b1920b..2f3082be81 100644 --- a/panda/src/pstatclient/Sources.pp +++ b/panda/src/pstatclient/Sources.pp @@ -3,7 +3,7 @@ #begin lib_target #define TARGET pstatclient #define LOCAL_LIBS \ - net linmath putil + net linmath putil express #define SOURCES \ config_pstats.cxx config_pstats.h pStatClient.I pStatClient.cxx \ diff --git a/panda/src/pstatclient/pStatClient.cxx b/panda/src/pstatclient/pStatClient.cxx index d1a3870393..4bfcd03f0d 100644 --- a/panda/src/pstatclient/pStatClient.cxx +++ b/panda/src/pstatclient/pStatClient.cxx @@ -4,6 +4,13 @@ //////////////////////////////////////////////////////////////////// #include "pStatClient.h" + +#ifdef HAVE_NET +// This file only defines anything interesting if we have a network +// interface, in which case the PStatClient actually does something. +// If we don't have a network interface, there's nothing to define +// here. + #include "pStatClientControlMessage.h" #include "pStatServerControlMessage.h" #include "pStatCollector.h" @@ -312,7 +319,7 @@ make_collector(int parent_index, const string &fullname) { string name = fullname.substr(start); - nassertr(parent_index >= 0 && parent_index < _collectors.size(), + nassertr(parent_index >= 0 && parent_index < (int)_collectors.size(), PStatCollector()); Collector &parent = _collectors[parent_index]; @@ -329,7 +336,7 @@ make_collector(int parent_index, const string &fullname) { if (ni != parent._children.end()) { // We already had a collector by this name; return it. int index = (*ni).second; - nassertr(index >= 0 && index < _collectors.size(), PStatCollector()); + nassertr(index >= 0 && index < (int)_collectors.size(), PStatCollector()); return PStatCollector(this, (*ni).second); } @@ -363,7 +370,7 @@ make_collector(int parent_index, const string &fullname, const RGBColorf &suggested_color, int sort) { PStatCollector c = make_collector(parent_index, fullname); nassertr(c._client == this, PStatCollector()); - nassertr(c._index >= 0 && c._index < _collectors.size(), PStatCollector()); + nassertr(c._index >= 0 && c._index < (int)_collectors.size(), PStatCollector()); PStatCollectorDef *def = _collectors[c._index]._def; nassertr(def != (PStatCollectorDef *)NULL, PStatCollector()); @@ -399,7 +406,7 @@ make_thread(const string &name) { if (ni != _threads_by_name.end()) { // We already had a thread by this name; return it. int index = (*ni).second; - nassertr(index >= 0 && index < _threads.size(), PStatThread()); + nassertr(index >= 0 && index < (int)_threads.size(), PStatThread()); return PStatThread(this, (*ni).second); } @@ -484,7 +491,7 @@ start(int collector_index, int thread_index, double as_of) { //////////////////////////////////////////////////////////////////// void PStatClient:: stop(int collector_index, int thread_index, double as_of) { - nassertv(collector_index >= 0 && collector_index < _collectors.size()); + nassertv(collector_index >= 0 && collector_index < (int)_collectors.size()); nassertv(thread_index >= 0 && thread_index < (int)_threads.size()); if (_threads[thread_index]._is_active) { @@ -753,3 +760,5 @@ connection_reset(const PT(Connection) &connection) { << "Ignoring spurious connection_reset() message\n"; } } + +#endif // HAVE_NET diff --git a/panda/src/pstatclient/pStatClient.h b/panda/src/pstatclient/pStatClient.h index c26a2db4ed..2ec5ee4ff1 100644 --- a/panda/src/pstatclient/pStatClient.h +++ b/panda/src/pstatclient/pStatClient.h @@ -10,13 +10,16 @@ #include "pStatFrameData.h" +#include +#include +#include + +#ifdef HAVE_NET #include #include #include #include -#include -#include -#include +#endif class PStatServerControlMessage; class PStatCollector; @@ -27,7 +30,12 @@ class PStatThread; // Class : PStatClient // Description : Manages the communications to report statistics via a // network connection to a remote PStatServer. +// +// If HAVE_NET is not defined, we don't have a network +// interface, and therefore this class can't do very +// much. It's therefore defined as a stub class. //////////////////////////////////////////////////////////////////// +#ifdef HAVE_NET class EXPCL_PANDA PStatClient : public ConnectionManager { public: PStatClient(); @@ -133,4 +141,17 @@ private: #include "pStatClient.I" +#else // HAVE_NET + +class EXPCL_PANDA PStatClient { +public: + PStatClient() { } + ~PStatClient() { } + + static void main_tick() { } +}; + +#endif // HAVE_NET + #endif + diff --git a/panda/src/pstatclient/pStatCollector.I b/panda/src/pstatclient/pStatCollector.I index abc06c24c0..f644de3da8 100644 --- a/panda/src/pstatclient/pStatCollector.I +++ b/panda/src/pstatclient/pStatCollector.I @@ -52,11 +52,16 @@ PStatCollector(PStatClient *client, int index) : INLINE PStatCollector:: PStatCollector(const string &name, const RGBColorf &suggested_color, int sort, PStatClient *client) { +#ifdef HAVE_NET if (client == (PStatClient *)NULL) { client = PStatClient::get_global_pstats(); } PStatCollector collector(client->make_collector(0, name, suggested_color, sort)); (*this) = collector; +#else + _client = (PStatClient *)NULL; + _index = 0; +#endif } //////////////////////////////////////////////////////////////////// @@ -85,10 +90,15 @@ PStatCollector(const string &name, const RGBColorf &suggested_color, INLINE PStatCollector:: PStatCollector(const PStatCollector &parent, const string &name, const RGBColorf &suggested_color, int sort) { +#ifdef HAVE_NET nassertv(parent._client != (PStatClient *)NULL); PStatCollector collector(parent._client->make_collector (parent._index, name, suggested_color, sort)); (*this) = collector; +#else + _client = (PStatClient *)NULL; + _index = 0; +#endif } //////////////////////////////////////////////////////////////////// @@ -122,7 +132,9 @@ operator = (const PStatCollector ©) { //////////////////////////////////////////////////////////////////// INLINE void PStatCollector:: start() { +#ifdef HAVE_NET _client->start(_index, 0, _client->_clock.get_real_time()); +#endif } //////////////////////////////////////////////////////////////////// @@ -132,7 +144,9 @@ start() { //////////////////////////////////////////////////////////////////// INLINE void PStatCollector:: start(const PStatThread &thread) { +#ifdef HAVE_NET _client->start(_index, thread._index, _client->_clock.get_real_time()); +#endif } //////////////////////////////////////////////////////////////////// @@ -146,7 +160,9 @@ start(const PStatThread &thread) { //////////////////////////////////////////////////////////////////// INLINE void PStatCollector:: start(const PStatThread &thread, double as_of) { +#ifdef HAVE_NET _client->start(_index, thread._index, as_of); +#endif } //////////////////////////////////////////////////////////////////// @@ -157,7 +173,9 @@ start(const PStatThread &thread, double as_of) { //////////////////////////////////////////////////////////////////// INLINE void PStatCollector:: stop() { +#ifdef HAVE_NET _client->stop(_index, 0, _client->_clock.get_real_time()); +#endif } //////////////////////////////////////////////////////////////////// @@ -167,7 +185,9 @@ stop() { //////////////////////////////////////////////////////////////////// INLINE void PStatCollector:: stop(const PStatThread &thread) { +#ifdef HAVE_NET _client->stop(_index, thread._index, _client->_clock.get_real_time()); +#endif } //////////////////////////////////////////////////////////////////// @@ -181,5 +201,7 @@ stop(const PStatThread &thread) { //////////////////////////////////////////////////////////////////// INLINE void PStatCollector:: stop(const PStatThread &thread, double as_of) { +#ifdef HAVE_NET _client->stop(_index, thread._index, as_of); +#endif } diff --git a/panda/src/pstatclient/pStatThread.I b/panda/src/pstatclient/pStatThread.I index d0f75ab05f..f0660dc038 100644 --- a/panda/src/pstatclient/pStatThread.I +++ b/panda/src/pstatclient/pStatThread.I @@ -40,11 +40,16 @@ PStatThread(PStatClient *client, int index) : //////////////////////////////////////////////////////////////////// INLINE PStatThread:: PStatThread(const string &name, PStatClient *client) { +#ifdef HAVE_NET if (client == (PStatClient *)NULL) { client = PStatClient::get_global_pstats(); } PStatThread thread(client->make_thread(name)); (*this) = thread; +#else + _client = (PStatClient *)NULL; + _index = 0; +#endif } //////////////////////////////////////////////////////////////////// @@ -80,5 +85,7 @@ operator = (const PStatThread ©) { //////////////////////////////////////////////////////////////////// INLINE void PStatThread:: new_frame() { +#ifdef HAVE_NET _client->new_frame(_index); +#endif } diff --git a/panda/src/putil/bamReader.I b/panda/src/putil/bamReader.I index 2538415940..74ba000a8d 100644 --- a/panda/src/putil/bamReader.I +++ b/panda/src/putil/bamReader.I @@ -125,18 +125,6 @@ clear_queue(void) _deferred_reads.clear(); } -//////////////////////////////////////////////////////////////////// -// Function: BamReader::empty -// Access: Public -// Description: Returns if BamReader has read all that it can from -// the given DatagramGenerator -//////////////////////////////////////////////////////////////////// -INLINE void BamReader:: -empty(void) -{ - _source->empty(); -} - //////////////////////////////////////////////////////////////////// // Function: parse_params // Access: Private, Static diff --git a/panda/src/putil/bamReader.cxx b/panda/src/putil/bamReader.cxx index 9ccba23119..d69b91e224 100644 --- a/panda/src/putil/bamReader.cxx +++ b/panda/src/putil/bamReader.cxx @@ -4,7 +4,6 @@ #include #include -#include #include "bam.h" #include "bamReader.h" @@ -49,7 +48,7 @@ init(void) { Datagram header; - if (!_source->is_valid()) + if (_source->is_error()) { return false; } @@ -176,7 +175,7 @@ read_object(void) // return TypedWriteable::Null; //} - if (!_source->is_valid()) + if (_source->is_error()) { return TypedWriteable::Null; } diff --git a/panda/src/putil/bamReader.h b/panda/src/putil/bamReader.h index 425113c427..2dc98946cb 100644 --- a/panda/src/putil/bamReader.h +++ b/panda/src/putil/bamReader.h @@ -7,7 +7,6 @@ #include #include -#include #include "typedWriteable.h" #include "datagramGenerator.h" @@ -60,8 +59,6 @@ public: INLINE BamReader(DatagramGenerator *generator); ~BamReader(void); - INLINE void empty(void); - bool init(void); TypedWriteable* read_object(void); //When a client class asks BamReader to read out an object that it diff --git a/panda/src/putil/bamWriter.h b/panda/src/putil/bamWriter.h index 9237dc8ff7..eba31c796d 100644 --- a/panda/src/putil/bamWriter.h +++ b/panda/src/putil/bamWriter.h @@ -7,7 +7,6 @@ #include #include -#include #include "typedWriteable.h" #include "datagramSink.h" diff --git a/panda/src/sgidisplay/Sources.pp b/panda/src/sgidisplay/Sources.pp index 5393b77f1f..394983b8db 100644 --- a/panda/src/sgidisplay/Sources.pp +++ b/panda/src/sgidisplay/Sources.pp @@ -6,6 +6,7 @@ #define TARGET sgidisplay #define UNIX_SYS_LIBS \ Xsgivc + #define LOCAL_LIBS display #define SOURCES \ config_sgidisplay.cxx config_sgidisplay.h sgiGraphicsPipe.cxx \ diff --git a/panda/src/sgmanip/nodePathCollection.cxx b/panda/src/sgmanip/nodePathCollection.cxx index 240729d2db..ea08e4c10c 100644 --- a/panda/src/sgmanip/nodePathCollection.cxx +++ b/panda/src/sgmanip/nodePathCollection.cxx @@ -216,7 +216,7 @@ get_num_paths() const { //////////////////////////////////////////////////////////////////// NodePath NodePathCollection:: get_path(int index) const { - nassertr(index >= 0 && index < _node_paths.size(), NodePath()); + nassertr(index >= 0 && index < (int)_node_paths.size(), NodePath()); return NodePath(_node_paths[index]); } diff --git a/panda/src/sgraph/geomNode.cxx b/panda/src/sgraph/geomNode.cxx index 92174a3011..744a369854 100644 --- a/panda/src/sgraph/geomNode.cxx +++ b/panda/src/sgraph/geomNode.cxx @@ -250,7 +250,7 @@ write_datagram(BamWriter *manager, Datagram &me) //Write out all of the Geom objects that this node //stores me.add_uint16(_geoms.size()); - for(int i = 0; i < _geoms.size(); i++) + for(int i = 0; i < (int)_geoms.size(); i++) { manager->write_pointer(me, _geoms[i]); } diff --git a/panda/src/sgraphutil/sceneGraphAnalyzer.cxx b/panda/src/sgraphutil/sceneGraphAnalyzer.cxx index 99985f04e6..933cdfd126 100644 --- a/panda/src/sgraphutil/sceneGraphAnalyzer.cxx +++ b/panda/src/sgraphutil/sceneGraphAnalyzer.cxx @@ -284,6 +284,9 @@ collect_statistics(Geom *geom) { case G_PER_VERTEX: _num_normals += num_verts; break; + + case G_OFF: + break; } if (geom->get_binding(G_TEXCOORD) == G_PER_VERTEX) { @@ -359,6 +362,10 @@ collect_statistics(Texture *texture) { case Texture::FT_nearest_mipmap_linear: case Texture::FT_linear_mipmap_linear: is_mipmapped = true; + break; + + default: + break; } if (is_mipmapped) { diff --git a/panda/src/text/textNode.I b/panda/src/text/textNode.I index 8dd69de28f..5007b90a52 100644 --- a/panda/src/text/textNode.I +++ b/panda/src/text/textNode.I @@ -936,7 +936,7 @@ get_upper_left_3d() const { } //////////////////////////////////////////////////////////////////// -// Function: TextNode::get_upper_left_3d +// Function: TextNode::get_lower_right_3d // Access: Public, Scheme // Description: Returns the lower-right extent of the text object, // after it has been transformed into 3-d space by diff --git a/pandatool/src/gtk-stats/Sources.pp b/pandatool/src/gtk-stats/Sources.pp index 0da0af4f9b..96635e2530 100644 --- a/pandatool/src/gtk-stats/Sources.pp +++ b/pandatool/src/gtk-stats/Sources.pp @@ -1,5 +1,7 @@ #define DIRECTORY_IF_GTKMM yes #define USE_GTKMM yes +#define DIRECTORY_IF_NET yes +#define USE_NET yes #begin bin_target #define TARGET gtk-stats diff --git a/pandatool/src/pstatserver/Sources.pp b/pandatool/src/pstatserver/Sources.pp index 1cb9682ba8..9278b77568 100644 --- a/pandatool/src/pstatserver/Sources.pp +++ b/pandatool/src/pstatserver/Sources.pp @@ -1,3 +1,6 @@ +#define DIRECTORY_IF_NET yes +#define USE_NET yes + #begin lib_target #define TARGET pstatserver #define LOCAL_LIBS pandatoolbase diff --git a/pandatool/src/text-stats/Sources.pp b/pandatool/src/text-stats/Sources.pp index b776bf95c2..8bed0cfa19 100644 --- a/pandatool/src/text-stats/Sources.pp +++ b/pandatool/src/text-stats/Sources.pp @@ -1,3 +1,6 @@ +#define DIRECTORY_IF_NET yes +#define USE_NET yes + #begin bin_target #define TARGET text-stats #define LOCAL_LIBS \