Merge branch 'master' into cmake

This commit is contained in:
Sam Edwards 2017-01-09 17:59:22 -07:00
commit f1da5ce92f
58 changed files with 511 additions and 1655 deletions

View File

@ -1,106 +0,0 @@
// This is a little wrapper to make it easy to run a python program from the
// command line. Basically, it just interfaces to the Python API and imports
// the module that was specified by the IMPORT_MODULE preprocessor definition
// when it was compiled.
#include "dtoolbase.h"
#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE
#include <Python.h>
#if PY_MAJOR_VERSION >= 3
#include <wchar.h>
#endif
#ifndef IMPORT_MODULE
#error IMPORT_MODULE must be defined when compiling ppython.cxx !
#endif
#define _STRINGIFY(s) #s
#define STRINGIFY(s) _STRINGIFY(s)
#define IMPORT_MODULE_STR STRINGIFY(IMPORT_MODULE)
#if defined(_WIN32) && PY_MAJOR_VERSION >= 3
// As Py_SetProgramName expects a wchar_t*, it's easiest to just use the wmain
// entry point.
int wmain(int argc, wchar_t *argv[]) {
Py_SetProgramName(argv[0]);
#elif PY_MAJOR_VERSION >= 3
// Convert from UTF-8 to wchar_t*.
int main(int argc, char *mb_argv[]) {
wchar_t **argv = new wchar_t*[argc + 1];
for (int i = 0; i < argc; ++i) {
size_t len = mbstowcs(NULL, mb_argv[i], 0);
argv[i] = new wchar_t[len + 1];
mbstowcs(argv[i], mb_argv[i], len);
argv[i][len] = 0;
}
// Just for good measure
argv[argc] = NULL;
Py_SetProgramName(argv[0]);
#else
// Python 2.
int main(int argc, char *argv[]) {
Py_SetProgramName(argv[0]);
#endif
// On Windows, we need to set pythonhome correctly. We'll try to find
// ppython.exe on the path and set pythonhome to its location.
#ifdef _WIN32
#if PY_MAJOR_VERSION >= 3
// Py_SetPythonHome expects a wchar_t in Python 3.
wchar_t *path = _wgetenv(L"PATH");
wchar_t *result = wcstok(path, L";");
while (result != NULL) {
struct _stat st;
wchar_t *ppython = (wchar_t*) malloc(wcslen(result) * 2 + 26);
wcscpy(ppython, result);
wcscat(ppython, L"\\python.exe");
if (_wstat(ppython, &st) == 0) {
Py_SetPythonHome(result);
free(ppython);
break;
}
result = wcstok(NULL, L";");
free(ppython);
}
#else
char *path = getenv("PATH");
char *result = strtok(path, ";");
while (result != NULL) {
struct stat st;
char *ppython = (char*) malloc(strlen(result) + 13);
strcpy(ppython, result);
strcat(ppython, "\\ppython.exe");
if (stat(ppython, &st) == 0) {
Py_SetPythonHome(result);
free(ppython);
break;
}
result = strtok(NULL, ";");
free(ppython);
}
#endif
#endif
Py_Initialize();
if (Py_VerboseFlag) {
fprintf(stderr, "Python %s\\n%s\\n", Py_GetVersion(), Py_GetCopyright());
}
PySys_SetArgv(argc, argv);
int sts = 0;
PyObject* m = PyImport_ImportModule(IMPORT_MODULE_STR);
if (m <= 0) {
PyErr_Print();
sts = 1;
}
Py_Finalize();
return sts;
}

View File

@ -87,8 +87,13 @@ class EggCacher:
TexturePool.releaseAllTextures()
progress += size
cacher = EggCacher(sys.argv[1:])
# Dummy main function so this can be added to console_scripts.
def main():
def main(args=None):
if args is None:
args = sys.argv[1:]
cacher = EggCacher(args)
return 0
if __name__ == '__main__':
sys.exit(main())

View File

@ -1,831 +0,0 @@
; Panda3D installation script for the Nullsoft Installation System (NSIS).
; Jon Parise <jparise@cmu.edu>
; with Ben Johnson <bkj@andrew.cmu.edu>
; with Jason Pratt <pratt@andrew.cmu.edu>
; mangled by Josh Yelon <jyelon@andrew.cmu.edu>
; Caller needs to define these variables:
;
; COMPRESSOR - either zlib or lzma
; NAME - name of what we're building (ie, "Panda3D" or "Airblade")
; SMDIRECTORY - where to put this in the start menu (ie, "Panda3D 1.1.0" or "Airblade 1.1.0")
; INSTALLDIR - where to install the program (ie, "C:\Program Files\Panda3D-1.1.0")
; OUTFILE - where to put the output file (ie, "..\nsis-output.exe")
; LICENSE - location of the license file (ie, "C:\Airblade\LICENSE.TXT")
; LANGUAGE - name of the Language file to use (ie, "English" or "Panda3DEnglish")
; RUNTEXT - text for run-box at end of installation (ie, "Run the Panda Greeting Card")
; IBITMAP - name of installer bitmap (ie, "C:\Airblade\Airblade.bmp")
; UBITMAP - name of uninstaller bitmap (ie, "C:\Airblade\Airblade.bmp")
;
; PANDA - location of panda install tree.
; PYVER - version of Python that Panda was built with (ie, "2.7")
; PANDACONF - name of panda config directory - usually $PANDA\etc
; PSOURCE - location of the panda source-tree if available, OR location of panda install tree.
; PYEXTRAS - directory containing python extras, if any.
; REGVIEW - either 32 or 64, depending on the build architecture.
;
; PPGAME - directory containing prepagaged game, if any (ie, "C:\My Games\Airblade")
; PPMAIN - python program containing prepackaged game, if any (ie, "Airblade.py")
; PPICON - file containing icon of prepackaged game.
;
!include "MUI.nsh"
!include "WinMessages.nsh"
Name "${NAME}"
InstallDir "${INSTALLDIR}"
OutFile "${OUTFILE}"
SetCompress auto
SetCompressor ${COMPRESSOR}
!define MUI_WELCOMEFINISHPAGE_BITMAP "${IBITMAP}"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${UBITMAP}"
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION runFunction
!define MUI_FINISHPAGE_RUN_TEXT "${RUNTEXT}"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${LICENSE}"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "${LANGUAGE}"
ShowInstDetails nevershow
ShowUninstDetails nevershow
LicenseData "${LICENSE}"
InstType "Typical"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
var READABLE
var MANPAGE
var TUTNAME
Function runFunction
!ifdef PPGAME
ExecShell "open" "$SMPROGRAMS\${SMDIRECTORY}\Play ${NAME}.lnk"
!else
ExecShell "open" "$SMPROGRAMS\${SMDIRECTORY}\Panda Manual.lnk"
!endif
FunctionEnd
Section "${SMDIRECTORY}" SecCore
SectionIn 1 2 3 RO
SetDetailsPrint none
SetOutPath $INSTDIR
SetOverwrite try
SetOutPath $INSTDIR
File "${PANDA}\LICENSE"
SetOutPath $INSTDIR\bin
File /r "${PANDA}\bin\*.dll"
File /nonfatal /r "${PANDA}\bin\*.pyd"
File /nonfatal /r "${PANDA}\bin\Microsoft.*.manifest"
SetOutPath $INSTDIR\etc
File /r "${PANDACONF}\*"
SetOutPath $INSTDIR\direct\directscripts
File /r /x CVS /x Opt?-Win32 "${PANDA}\direct\directscripts\*"
SetOutPath $INSTDIR\direct\filter
File /r /x CVS /x Opt?-Win32 "${PANDA}\direct\filter\*.sha"
SetOutPath $INSTDIR\direct
File /r /x CVS /x Opt?-Win32 "${PANDA}\direct\*.py"
Delete "$INSTDIR\panda3d.py"
Delete "$INSTDIR\panda3d.pyc"
Delete "$INSTDIR\panda3d.pyo"
SetOutPath $INSTDIR\pandac
File /r "${PANDA}\pandac\*.py"
SetOutPath $INSTDIR\panda3d
File /r "${PANDA}\panda3d\*.py"
File /r "${PANDA}\panda3d\*.pyd"
SetOutPath $INSTDIR\python
File /r "${PANDA}\python\*"
RMDir /r "$SMPROGRAMS\${SMDIRECTORY}"
CreateDirectory "$SMPROGRAMS\${SMDIRECTORY}"
!ifdef PPGAME
SetOutPath $INSTDIR\models
File /r /x CVS "${PANDA}\models\*"
SetOutPath $INSTDIR\bin
File /r "${PANDA}\bin\eggcacher.exe"
SetOutpath $INSTDIR\game
File /r "${PPGAME}\*"
CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Play ${NAME}.lnk" "$INSTDIR\python\ppython.exe" "-E ${PPMAIN}" "$INSTDIR\${PPICON}" 0 SW_SHOWMINIMIZED "" "Play ${NAME}"
# Preload all EGG files into the model-cache
SetOutPath $INSTDIR
SetDetailsPrint textonly
SetDetailsView show
nsExec::ExecToLog '"$INSTDIR\bin\eggcacher.exe" --concise game'
SetDetailsPrint none
SetDetailsView hide
!else
SetOutPath $INSTDIR\plugins
File /nonfatal /r "${PANDA}\plugins\*.dle"
File /nonfatal /r "${PANDA}\plugins\*.dlo"
File /nonfatal /r "${PANDA}\plugins\*.mll"
File /nonfatal /r "${PANDA}\plugins\*.mel"
File /nonfatal /r "${PANDA}\plugins\*.ms"
File "${PSOURCE}\doc\INSTALLING-PLUGINS.TXT"
SetOutPath $INSTDIR\pandac\input
File /r "${PANDA}\pandac\input\*"
SetOutPath $INSTDIR\bin
File /r "${PANDA}\bin\*.exe"
File /nonfatal /r "${PANDA}\bin\*.p3d"
SetOutPath $INSTDIR\lib
File /r /x *.exp "${PANDA}\lib\*"
SetOutPath $INSTDIR\include
File /r /x *.exp "${PANDA}\include\*"
SetOutPath $INSTDIR\Pmw
File /r /x CVS "${PANDA}\Pmw\*"
SetOutPath $INSTDIR\NSIS
File /r /x CVS "${NSISDIR}\*"
SetOutPath $INSTDIR
File /r /x CVS "${PANDA}\ReleaseNotes"
!ifdef PYEXTRAS
SetOutPath $INSTDIR\python\lib
File /nonfatal /r "${PYEXTRAS}\*"
!endif
SetOutPath $INSTDIR\models
File /r /x CVS "${PANDA}\models\*"
SetOutPath $INSTDIR\samples
File /nonfatal /r /x CVS "${PSOURCE}\samples\*"
MessageBox MB_YESNO|MB_ICONQUESTION \
"EGG caching is about to begin.$\nThis process may take a couple minute and approximately 270 MB of RAM.$\nWARNING : It might stuck if your computer resources are low.$\n$\nDo you really want to do this optional step ?" \
IDNO SkipCaching
# Preload all EGG files into the model-cache
SetOutPath $INSTDIR
SetDetailsPrint both
SetDetailsView show
nsExec::ExecToLog '"$INSTDIR\bin\eggcacher.exe" --concise models samples'
SetDetailsPrint none
SetDetailsView hide
SkipCaching:
SetOutPath $INSTDIR
WriteINIStr $INSTDIR\Website.url "InternetShortcut" "URL" "http://panda3d.org/"
WriteINIStr $INSTDIR\Manual.url "InternetShortcut" "URL" "http://panda3d.org/wiki/index.php"
WriteINIStr $INSTDIR\Samples.url "InternetShortcut" "URL" "http://panda3d.org/wiki/index.php/Sample_Programs_in_the_Distribution"
SetOutPath $INSTDIR
CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Panda Manual.lnk" "$INSTDIR\Manual.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Panda Manual"
CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Panda Website.lnk" "$INSTDIR\Website.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Panda Website"
CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Sample Program Manual.lnk" "$INSTDIR\Samples.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Sample Program Manual"
FindFirst $0 $1 $INSTDIR\samples\*
loop:
StrCmp $1 "" done
StrCmp $1 "." next
StrCmp $1 ".." next
Push $1
Push "-"
Push " "
Call StrRep
Pop $R0
StrCpy $READABLE $R0
Push $1
Push "-"
Push "_"
Call StrRep
Pop $R0
StrCpy $MANPAGE $R0
CreateDirectory "$SMPROGRAMS\${SMDIRECTORY}\Sample Programs\$READABLE"
SetOutPath $INSTDIR\samples\$1
WriteINIStr $INSTDIR\samples\$1\ManualPage.url "InternetShortcut" "URL" "http://panda3d.org/wiki/index.php/Sample_Programs:_$MANPAGE"
CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Sample Programs\$READABLE\Manual Page.lnk" "$INSTDIR\samples\$1\ManualPage.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Manual Entry on this Sample Program"
CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Sample Programs\$READABLE\View Source Code.lnk" "$INSTDIR\samples\$1"
FindFirst $2 $3 $INSTDIR\samples\$1\Tut-*.py
iloop:
StrCmp $3 "" idone
StrCpy $TUTNAME $3 -3 4
Push $TUTNAME
Push "-"
Push " "
Call StrRep
Pop $R0
StrCpy $TUTNAME $R0
CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Sample Programs\$READABLE\Run $TUTNAME.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\bin\eggcacher.exe" 0 SW_SHOWMINIMIZED "" "Run $TUTNAME"
CreateShortCut "$INSTDIR\samples\$1\Run $TUTNAME.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\bin\eggcacher.exe" 0 SW_SHOWMINIMIZED "" "Run $TUTNAME"
FindNext $2 $3
goto iloop
idone:
next:
FindNext $0 $1
Goto loop
done:
!endif
SectionEnd
Section -post
!ifdef REGVIEW
SetRegView ${REGVIEW}
!endif
!ifndef PPGAME
# Add the "bin" directory to the PATH.
Push "$INSTDIR\python"
Call RemoveFromPath
Push "$INSTDIR\python\Scripts"
Call RemoveFromPath
Push "$INSTDIR\bin"
Call RemoveFromPath
Push "$INSTDIR\python"
Call AddToPath
Push "$INSTDIR\python\Scripts"
Call AddToPath
Push "$INSTDIR\bin"
Call AddToPath
ReadRegStr $0 HKLM "Software\Python\PythonCore\${PYVER}\InstallPath" ""
StrCmp $0 "$INSTDIR\python" RegPath 0
StrCmp $0 "" RegPath 0
MessageBox MB_YESNO|MB_ICONQUESTION \
"Your system already has a copy of Python installed. Panda3D installs its own copy of Python ${PYVER}, which will install alongside your existing copy. Would you like to make Panda's copy the default Python? If you choose 'No', you will have to configure your existing copy of Python to use the Panda3D libraries, keeping in mind that this version of Panda3D can only run with Python ${PYVER}." \
IDNO SkipRegPath
RegPath:
DetailPrint "Adding registry keys for python..."
WriteRegStr HKLM "Software\Python\PythonCore\${PYVER}\InstallPath" "" "$INSTDIR\python"
SkipRegPath:
!endif
DetailPrint "Adding the uninstaller ..."
Delete "$INSTDIR\uninst.exe"
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SMDIRECTORY}" "DisplayName" "${SMDIRECTORY}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SMDIRECTORY}" "UninstallString" '"$INSTDIR\uninst.exe"'
SetOutPath $INSTDIR
CreateShortcut "$SMPROGRAMS\${SMDIRECTORY}\Uninstall ${NAME}.lnk" "$INSTDIR\uninst.exe" ""
SectionEnd
Section Uninstall
!ifdef REGVIEW
SetRegView ${REGVIEW}
!endif
!ifndef PPGAME
Push "$INSTDIR\python"
Call un.RemoveFromPath
Push "$INSTDIR\python\Scripts"
Call un.RemoveFromPath
Push "$INSTDIR\bin"
Call un.RemoveFromPath
ReadRegStr $0 HKLM "Software\Python\PythonCore\${PYVER}\InstallPath" ""
StrCmp $0 "$INSTDIR\python" 0 SkipUnReg
DeleteRegKey HKLM "Software\Python\PythonCore\${PYVER}"
SkipUnReg:
!endif
Delete "$INSTDIR\uninst.exe"
RMDir /r "$SMPROGRAMS\${SMDIRECTORY}"
RMDir /r "$INSTDIR"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SMDIRECTORY}"
SectionEnd
# --[ Utility Functions ]------------------------------------------------------
; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
Function IsNT
Push $0
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
StrCmp $0 "" 0 IsNT_yes
; we are not NT.
Pop $0
Push 0
Return
IsNT_yes:
; NT!!!
Pop $0
Push 1
FunctionEnd
; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
Function un.IsNT
Push $0
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
StrCmp $0 "" 0 unIsNT_yes
; we are not NT.
Pop $0
Push 0
Return
unIsNT_yes:
; NT!!!
Pop $0
Push 1
FunctionEnd
; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
Function StrStr
Push $0
Exch
Pop $0 ; $0 now have the string to find
Push $1
Exch 2
Pop $1 ; $1 now have the string to find in
Exch
Push $2
Push $3
Push $4
Push $5
StrCpy $2 -1
StrLen $3 $0
StrLen $4 $1
IntOp $4 $4 - $3
unStrStr_loop:
IntOp $2 $2 + 1
IntCmp $2 $4 0 0 unStrStrReturn_notFound
StrCpy $5 $1 $3 $2
StrCmp $5 $0 unStrStr_done unStrStr_loop
unStrStrReturn_notFound:
StrCpy $2 -1
unStrStr_done:
Pop $5
Pop $4
Pop $3
Exch $2
Exch 2
Pop $0
Pop $1
FunctionEnd
; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
Function un.StrStr
Push $0
Exch
Pop $0 ; $0 now have the string to find
Push $1
Exch 2
Pop $1 ; $1 now have the string to find in
Exch
Push $2
Push $3
Push $4
Push $5
StrCpy $2 -1
StrLen $3 $0
StrLen $4 $1
IntOp $4 $4 - $3
unStrStr_loop:
IntOp $2 $2 + 1
IntCmp $2 $4 0 0 unStrStrReturn_notFound
StrCpy $5 $1 $3 $2
StrCmp $5 $0 unStrStr_done unStrStr_loop
unStrStrReturn_notFound:
StrCpy $2 -1
unStrStr_done:
Pop $5
Pop $4
Pop $3
Exch $2
Exch 2
Pop $0
Pop $1
FunctionEnd
; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
; Commentary and smarter ';' checking by Jon Parise <jparise@cmu.edu>
Function AddToPath
Exch $0
Push $1
Push $2
Push $3
Call IsNT
Pop $1
StrCmp $1 1 AddToPath_NT
; We're not on NT, so modify the AUTOEXEC.BAT file.
StrCpy $1 $WINDIR 2
FileOpen $1 "$1\autoexec.bat" a
FileSeek $1 0 END
GetFullPathName /SHORT $0 $0
FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
FileClose $1
Goto AddToPath_done
AddToPath_NT:
ReadRegStr $1 HKCU "Environment" "PATH"
Call IsUserAdmin
Pop $3
; If this is an Admin user, use the System env. variable instead of the user's env. variable
StrCmp $3 1 0 +2
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
; If the PATH string is empty, jump over the mangling routines.
StrCmp $1 "" AddToPath_NTdoIt
; Pull off the last character of the PATH string. If it's a semicolon,
; we don't need to add another one, so jump to the section where we
; append the new PATH component(s).
StrCpy $2 $1 1 -1
StrCmp $2 ";" AddToPath_NTAddPath AddToPath_NTAddSemi
AddToPath_NTAddSemi:
StrCpy $1 "$1;"
Goto AddToPath_NTAddPath
AddToPath_NTAddPath:
StrCpy $0 "$1$0"
Goto AddToPath_NTdoIt
AddToPath_NTdoIt:
Call IsUserAdmin
Pop $3
StrCmp $3 1 0 NotAdmin
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0
Goto AddToPath_done
NotAdmin:
WriteRegExpandStr HKCU "Environment" "PATH" $0
AddToPath_done:
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
Function RemoveFromPath
Exch $0
Push $1
Push $2
Push $3
Push $4
Push $5
Call IsNT
Pop $1
StrCmp $1 1 unRemoveFromPath_NT
; Not on NT
StrCpy $1 $WINDIR 2
FileOpen $1 "$1\autoexec.bat" r
GetTempFileName $4
FileOpen $2 $4 w
GetFullPathName /SHORT $0 $0
StrCpy $0 "SET PATH=%PATH%;$0"
SetRebootFlag true
Goto unRemoveFromPath_dosLoop
unRemoveFromPath_dosLoop:
FileRead $1 $3
StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
StrCmp $3 "$0" unRemoveFromPath_dosLoop
StrCmp $3 "" unRemoveFromPath_dosLoopEnd
FileWrite $2 $3
Goto unRemoveFromPath_dosLoop
unRemoveFromPath_dosLoopEnd:
FileClose $2
FileClose $1
StrCpy $1 $WINDIR 2
Delete "$1\autoexec.bat"
CopyFiles /SILENT $4 "$1\autoexec.bat"
Delete $4
Goto unRemoveFromPath_done
unRemoveFromPath_NT:
StrLen $2 $0
Call IsUserAdmin
Pop $5
StrCmp $5 1 0 NotAdmin
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
Push $1
Push $0
Call StrStr ; Find $0 in $1
Pop $0 ; pos of our dir
IntCmp $0 -1 unRemoveFromPath_done
; else, it is in path
StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
StrLen $0 $1
StrCpy $1 $1 $0 $2
StrCpy $3 "$3$1"
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
Goto unRemoveFromPath_done
NotAdmin:
ReadRegStr $1 HKCU "Environment" "PATH"
Push $1
Push $0
Call StrStr ; Find $0 in $1
Pop $0 ; pos of our dir
IntCmp $0 -1 unRemoveFromPath_done
; else, it is in path
StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
StrLen $0 $1
StrCpy $1 $1 $0 $2
StrCpy $3 "$3$1"
WriteRegExpandStr HKCU "Environment" "PATH" $3
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
unRemoveFromPath_done:
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
Function un.RemoveFromPath
Exch $0
Push $1
Push $2
Push $3
Push $4
Push $5
Call un.IsNT
Pop $1
StrCmp $1 1 unRemoveFromPath_NT
; Not on NT
StrCpy $1 $WINDIR 2
FileOpen $1 "$1\autoexec.bat" r
GetTempFileName $4
FileOpen $2 $4 w
GetFullPathName /SHORT $0 $0
StrCpy $0 "SET PATH=%PATH%;$0"
SetRebootFlag true
Goto unRemoveFromPath_dosLoop
unRemoveFromPath_dosLoop:
FileRead $1 $3
StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
StrCmp $3 "$0" unRemoveFromPath_dosLoop
StrCmp $3 "" unRemoveFromPath_dosLoopEnd
FileWrite $2 $3
Goto unRemoveFromPath_dosLoop
unRemoveFromPath_dosLoopEnd:
FileClose $2
FileClose $1
StrCpy $1 $WINDIR 2
Delete "$1\autoexec.bat"
CopyFiles /SILENT $4 "$1\autoexec.bat"
Delete $4
Goto unRemoveFromPath_done
unRemoveFromPath_NT:
StrLen $2 $0
Call un.IsUserAdmin
Pop $5
StrCmp $5 1 0 NotAdmin
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
Push $1
Push $0
Call un.StrStr ; Find $0 in $1
Pop $0 ; pos of our dir
IntCmp $0 -1 unRemoveFromPath_done
; else, it is in path
StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
StrLen $0 $1
StrCpy $1 $1 $0 $2
StrCpy $3 "$3$1"
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
Goto unRemoveFromPath_done
NotAdmin:
ReadRegStr $1 HKCU "Environment" "PATH"
Push $1
Push $0
Call un.StrStr ; Find $0 in $1
Pop $0 ; pos of our dir
IntCmp $0 -1 unRemoveFromPath_done
; else, it is in path
StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
StrLen $0 $1
StrCpy $1 $1 $0 $2
StrCpy $3 "$3$1"
WriteRegExpandStr HKCU "Environment" "PATH" $3
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
unRemoveFromPath_done:
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
; From: http://nsis.sourceforge.net/archive/nsisweb.php?page=329&instances=0,11
; Localized by Ben Johnson (bkj@andrew.cmu.edu)
Function IsUserAdmin
Push $0
Push $1
Push $2
Push $3
Call IsNT
Pop $1
ClearErrors
UserInfo::GetName
;IfErrors Win9x
Pop $2
UserInfo::GetAccountType
Pop $3
; Compare results of IsNT with "1"
StrCmp $1 1 0 NotNT
;This is NT
StrCmp $3 "Admin" 0 NotAdmin
; Observation: I get here when running Win98SE. (Lilla)
; The functions UserInfo.dll looks for are there on Win98 too,
; but just don't work. So UserInfo.dll, knowing that admin isn't required
; on Win98, returns admin anyway. (per kichik)
; MessageBox MB_OK 'User "$R1" is in the Administrators group'
Pop $3
Pop $2
Pop $1
Pop $0
Push 1
Return
NotAdmin:
; You should still check for an empty string because the functions
; UserInfo.dll looks for may not be present on Windows 95. (per kichik)
#StrCmp $2 "" Win9x
#StrCpy $0 0
;MessageBox MB_OK 'User "$2" is in the "$3" group'
Pop $3
Pop $2
Pop $1
Pop $0
Push 0
Return
;Because we use IsNT, this is redundant.
#Win9x:
# ; comment/message below is by UserInfo.nsi author:
# ; This one means you don't need to care about admin or
# ; not admin because Windows 9x doesn't either
# ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
# StrCpy $0 0
NotNT:
;We are not NT
;Win9x doesn't have "admin" users.
;Let the user do whatever.
Pop $3
Pop $2
Pop $1
Pop $0
Push 1
FunctionEnd
Function un.IsUserAdmin
Push $0
Push $1
Push $2
Push $3
Call un.IsNT
Pop $1
ClearErrors
UserInfo::GetName
;IfErrors Win9x
Pop $2
UserInfo::GetAccountType
Pop $3
; Compare results of IsNT with "1"
StrCmp $1 1 0 NotNT
;This is NT
StrCmp $3 "Admin" 0 NotAdmin
; Observation: I get here when running Win98SE. (Lilla)
; The functions UserInfo.dll looks for are there on Win98 too,
; but just don't work. So UserInfo.dll, knowing that admin isn't required
; on Win98, returns admin anyway. (per kichik)
; MessageBox MB_OK 'User "$R1" is in the Administrators group'
Pop $3
Pop $2
Pop $1
Pop $0
Push 1
Return
NotAdmin:
; You should still check for an empty string because the functions
; UserInfo.dll looks for may not be present on Windows 95. (per kichik)
#StrCmp $2 "" Win9x
#StrCpy $0 0
;MessageBox MB_OK 'User "$2" is in the "$3" group'
Pop $3
Pop $2
Pop $1
Pop $0
Push 0
Return
;Because we use IsNT, this is redundant.
#Win9x:
# ; comment/message below is by UserInfo.nsi author:
# ; This one means you don't need to care about admin or
# ; not admin because Windows 9x doesn't either
# ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
# StrCpy $0 0
NotNT:
;We are not NT
;Win9x doesn't have "admin" users.
;Let the user do whatever.
Pop $3
Pop $2
Pop $1
Pop $0
Push 1
FunctionEnd
Function StrRep
;Written by dirtydingus 2003-02-20 04:30:09
; USAGE
;Push String to do replacement in (haystack)
;Push String to replace (needle)
;Push Replacement
;Call StrRep
;Pop $R0 result
;StrCpy $Result STR $R0
Exch $R4 ; $R4 = Replacement String
Exch
Exch $R3 ; $R3 = String to replace (needle)
Exch 2
Exch $R1 ; $R1 = String to do replacement in (haystack)
Push $R2 ; Replaced haystack
Push $R5 ; Len (needle)
Push $R6 ; len (haystack)
Push $R7 ; Scratch reg
StrCpy $R2 ""
StrLen $R5 $R3
StrLen $R6 $R1
loop:
StrCpy $R7 $R1 $R5
StrCmp $R7 $R3 found
StrCpy $R7 $R1 1 ; - optimization can be removed if U know len needle=1
StrCpy $R2 "$R2$R7"
StrCpy $R1 $R1 $R6 1
StrCmp $R1 "" done loop
found:
StrCpy $R2 "$R2$R4"
StrCpy $R1 $R1 $R6 $R5
StrCmp $R1 "" done loop
done:
StrCpy $R3 $R2
Pop $R7
Pop $R6
Pop $R5
Pop $R2
Pop $R1
Pop $R4
Exch $R3
FunctionEnd

View File

@ -1,424 +0,0 @@
#############################################################################
#
# packpanda - this is a tool that packages up a panda game into a
# convenient, easily-downloaded windows executable. Packpanda runs on linux
# and windows - on linux, it builds .debs and .rpms, on windows it relies on
# NSIS, the nullsoft scriptable install system, to do the hard work.
#
# This is intentionally a very simplistic game-packer with very
# limited options. The goal is simplicity, not feature richness.
# There are dozens of complex, powerful packaging tools already out
# there. This one is for people who just want to do it quick and
# easy.
#
##############################################################################
import sys, os, getopt, shutil, py_compile, subprocess
OPTIONLIST = [
("dir", 1, "Name of directory containing game"),
("name", 1, "Human-readable name of the game"),
("version", 1, "Version number to add to game name"),
("rmdir", 2, "Delete all directories with given name"),
("rmext", 2, "Delete all files with given extension"),
("fast", 0, "Use fast compression instead of good compression"),
("bam", 0, "Generate BAM files, change default-model-extension to BAM"),
("pyc", 0, "Generate PYC files"),
]
def ParseFailure():
print("")
print("packpanda usage:")
print("")
for (opt, hasval, explanation) in OPTIONLIST:
if (hasval):
print(" --%-10s %s"%(opt+" x", explanation))
else:
print(" --%-10s %s"%(opt+" ", explanation))
sys.exit(1)
def ParseOptions(args):
try:
options = {}
longopts = []
for (opt, hasval, explanation) in OPTIONLIST:
if (hasval==2):
longopts.append(opt+"=")
options[opt] = []
elif (hasval==1):
longopts.append(opt+"=")
options[opt] = ""
else:
longopts.append(opt)
options[opt] = 0
opts, extras = getopt.getopt(args, "", longopts)
for option, value in opts:
for (opt, hasval, explanation) in OPTIONLIST:
if (option == "--"+opt):
if (hasval==2): options[opt].append(value)
elif (hasval==1): options[opt] = value
else: options[opt] = 1
return options
except: ParseFailure();
OPTIONS = ParseOptions(sys.argv[1:])
##############################################################################
#
# Locate the relevant trees.
#
##############################################################################
PANDA=None
for dir in sys.path:
if (dir != "") and os.path.exists(os.path.join(dir,"direct")) and os.path.exists(os.path.join(dir,"pandac")):
PANDA=os.path.abspath(dir)
if (PANDA is None):
sys.exit("Cannot locate the panda root directory in the python path (cannot locate directory containing direct and pandac).")
print("PANDA located at "+PANDA)
if (os.path.exists(os.path.join(PANDA,"..","makepanda","makepanda.py"))) and (sys.platform != "win32" or os.path.exists(os.path.join(PANDA,"..","thirdparty","win-nsis","makensis.exe"))):
PSOURCE=os.path.abspath(os.path.join(PANDA,".."))
if (sys.platform == "win32"):
NSIS=os.path.abspath(os.path.join(PANDA,"..","thirdparty","win-nsis"))
else:
PSOURCE=PANDA
if (sys.platform == "win32"):
NSIS=os.path.join(PANDA,"nsis")
##############################################################################
#
# Identify the main parts of the game: DIR, NAME, MAIN, ICON, BITMAP, etc
#
##############################################################################
VER=OPTIONS["version"]
DIR=OPTIONS["dir"]
if (DIR==""):
print("You must specify the --dir option.")
ParseFailure()
DIR=os.path.abspath(DIR)
MYDIR=os.path.abspath(os.getcwd())
BASENAME=os.path.basename(DIR)
if (OPTIONS["name"] != ""):
NAME=OPTIONS["name"]
else:
NAME=BASENAME
SMDIRECTORY=NAME
if (VER!=""): SMDIRECTORY=SMDIRECTORY+" "+VER
PYTHONV="python"+sys.version[:3]
LICENSE=os.path.join(DIR, "license.txt")
OUTFILE=os.path.basename(DIR)
if (VER!=""): OUTFILE=OUTFILE+"-"+VER
if (sys.platform == "win32"):
ICON=os.path.join(DIR, "icon.ico")
BITMAP=os.path.join(DIR, "installer.bmp")
OUTFILE=os.path.abspath(OUTFILE+".exe")
INSTALLDIR='C:\\'+os.path.basename(DIR)
if (VER!=""): INSTALLDIR=INSTALLDIR+"-"+VER
COMPRESS="lzma"
if (OPTIONS["fast"]): COMPRESS="zlib"
if (OPTIONS["pyc"]): MAIN="main.pyc"
else: MAIN="main.py"
def PrintFileStatus(label, file):
if (os.path.exists(file)):
print("%-15s: %s"%(label, file))
else:
print("%-15s: %s (MISSING)"%(label, file))
PrintFileStatus("Dir", DIR)
print("%-15s: %s"%("Name", NAME))
print("%-15s: %s"%("Start Menu", SMDIRECTORY))
PrintFileStatus("Main", os.path.join(DIR, MAIN))
if (sys.platform == "win32"):
PrintFileStatus("Icon", ICON)
PrintFileStatus("Bitmap", BITMAP)
PrintFileStatus("License", LICENSE)
print("%-15s: %s"%("Output", OUTFILE))
if (sys.platform == "win32"):
print("%-15s: %s"%("Install Dir", INSTALLDIR))
if (os.path.isdir(DIR)==0):
sys.exit("Difficulty reading "+DIR+". Cannot continue.")
if (os.path.isfile(os.path.join(DIR, "main.py"))==0):
sys.exit("Difficulty reading main.py. Cannot continue.")
if (os.path.isfile(LICENSE)==0):
LICENSE=os.path.join(PANDA,"LICENSE")
if (sys.platform == "win32") and (os.path.isfile(BITMAP)==0):
BITMAP=os.path.join(NSIS,"Contrib","Graphics","Wizard","nsis.bmp")
if (sys.platform == "win32"):
if (os.path.isfile(ICON)==0):
PPICON="bin\\ppython.exe"
else:
PPICON="game\\icon.ico"
##############################################################################
#
# Copy the game to a temporary directory, so we can modify it safely.
#
##############################################################################
def limitedCopyTree(src, dst, rmdir):
if (os.path.isdir(src)):
if (os.path.basename(src) in rmdir):
return
if (not os.path.isdir(dst)): os.mkdir(dst)
for x in os.listdir(src):
limitedCopyTree(os.path.join(src,x), os.path.join(dst,x), rmdir)
else:
shutil.copyfile(src, dst)
TMPDIR=os.path.abspath("packpanda-TMP")
if (sys.platform == "win32"):
TMPGAME=os.path.join(TMPDIR,"game")
TMPETC=os.path.join(TMPDIR,"etc")
else:
TMPGAME=os.path.join(TMPDIR,"usr","share","games",BASENAME,"game")
TMPETC=os.path.join(TMPDIR,"usr","share","games",BASENAME,"etc")
print("")
print("Copying the game to "+TMPDIR+"...")
if (os.path.exists(TMPDIR)):
try: shutil.rmtree(TMPDIR)
except: sys.exit("Cannot delete "+TMPDIR)
try:
os.mkdir(TMPDIR)
rmdir = {}
for x in OPTIONS["rmdir"]:
rmdir[x] = 1
if not os.path.isdir( TMPGAME ):
os.makedirs(TMPGAME)
limitedCopyTree(DIR, TMPGAME, rmdir)
if not os.path.isdir( TMPETC ):
os.makedirs(TMPETC)
if sys.platform == "win32":
limitedCopyTree(os.path.join(PANDA, "etc"), TMPETC, {})
else:
shutil.copyfile("/etc/Config.prc", os.path.join(TMPETC, "Config.prc"))
shutil.copyfile("/etc/Confauto.prc", os.path.join(TMPETC, "Confauto.prc"))
except: sys.exit("Cannot copy game to "+TMPDIR)
##############################################################################
#
# If --bam requested, change default-model-extension .egg to bam.
#
##############################################################################
def ReadFile(wfile):
try:
srchandle = open(wfile, "rb")
data = srchandle.read()
srchandle.close()
return data
except: exit("Cannot read "+wfile)
def WriteFile(wfile,data):
try:
dsthandle = open(wfile, "wb")
dsthandle.write(data)
dsthandle.close()
except: exit("Cannot write "+wfile)
if OPTIONS["bam"]:
CONF=ReadFile(os.path.join(TMPETC,"Confauto.prc"))
CONF=CONF.replace("default-model-extension .egg","default-model-extension .bam")
WriteFile(os.path.join(TMPETC,"Confauto.prc"), CONF)
##############################################################################
#
# Compile all py files, convert all egg files.
#
# We do this as a sanity check, even if the user
# hasn't requested that his files be compiled.
#
##############################################################################
if (sys.platform == "win32"):
EGG2BAM=os.path.join(PANDA,"bin","egg2bam.exe")
else:
EGG2BAM=os.path.join(PANDA,"bin","egg2bam")
def egg2bam(file,bam):
present = os.path.exists(bam)
if (present): bam = "packpanda-TMP.bam";
cmd = 'egg2bam -noabs -ps rel -pd . "'+file+'" -o "'+bam+'"'
print("Executing: "+cmd)
if (sys.platform == "win32"):
res = os.spawnl(os.P_WAIT, EGG2BAM, cmd)
else:
res = os.system(cmd)
if (res != 0): sys.exit("Problem in egg file: "+file)
if (present) or (OPTIONS["bam"]==0):
os.unlink(bam)
def py2pyc(file):
print("Compiling python "+file)
pyc = file[:-3]+'.pyc'
pyo = file[:-3]+'.pyo'
if (os.path.exists(pyc)): os.unlink(pyc)
if (os.path.exists(pyo)): os.unlink(pyo)
try: py_compile.compile(file)
except: sys.exit("Cannot compile "+file)
if (OPTIONS["pyc"]==0):
if (os.path.exists(pyc)):
os.unlink(pyc)
if (os.path.exists(pyo)):
os.unlink(pyo)
def CompileFiles(file):
if (os.path.isfile(file)):
if (file.endswith(".egg")):
egg2bam(file, file[:-4]+'.bam')
elif (file.endswith(".egg.pz") or file.endswith(".egg.gz")):
egg2bam(file, file[:-7]+'.bam')
elif (file.endswith(".py")):
py2pyc(file)
else: pass
elif (os.path.isdir(file)):
for x in os.listdir(file):
CompileFiles(os.path.join(file, x))
def DeleteFiles(file):
base = os.path.basename(file).lower()
if (os.path.isdir(file)):
for pattern in OPTIONS["rmdir"]:
if pattern.lower() == base:
print("Deleting "+file)
shutil.rmtree(file)
return
for x in os.listdir(file):
DeleteFiles(os.path.join(file, x))
else:
for ext in OPTIONS["rmext"]:
if base[-(len(ext) + 1):] == ("." + ext).lower():
print("Deleting "+file)
os.unlink(file)
return
print("")
print("Compiling BAM and PYC files...")
os.chdir(TMPGAME)
CompileFiles(".")
DeleteFiles(".")
##############################################################################
#
# Now make the installer. Yay!
#
##############################################################################
INSTALLER_DEB_FILE="""
Package: BASENAME
Version: VERSION
Section: games
Priority: optional
Architecture: ARCH
Essential: no
Depends: PYTHONV
Provides: BASENAME
Description: NAME
Maintainer: Unknown
"""
INSTALLER_SPEC_FILE="""
Summary: NAME
Name: BASENAME
Version: VERSION
Release: 1
Group: Amusement/Games
License: See license file
BuildRoot: TMPDIR
BuildRequires: PYTHONV
%description
NAME
%files
%defattr(-,root,root)
/usr/bin/BASENAME
/usr/lib/games/BASENAME
/usr/share/games/BASENAME
"""
RUN_SCRIPT="""
#!/bin/sh
cd /usr/share/games/BASENAME/game
PYTHONPATH=/usr/lib/games/BASENAME:/usr/share/games/BASENAME
LD_LIBRARY_PATH=/usr/lib/games/BASENAME
PYTHONV MAIN
"""
if (sys.platform == "win32"):
CMD="\""+NSIS+"\\makensis.exe\" /V2 "
CMD=CMD+'/DCOMPRESSOR="'+COMPRESS+'" '
CMD=CMD+'/DNAME="'+NAME+'" '
CMD=CMD+'/DSMDIRECTORY="'+SMDIRECTORY+'" '
CMD=CMD+'/DINSTALLDIR="'+INSTALLDIR+'" '
CMD=CMD+'/DOUTFILE="'+OUTFILE+'" '
CMD=CMD+'/DLICENSE="'+LICENSE+'" '
CMD=CMD+'/DLANGUAGE="English" '
CMD=CMD+'/DRUNTEXT="Play '+NAME+'" '
CMD=CMD+'/DIBITMAP="'+BITMAP+'" '
CMD=CMD+'/DUBITMAP="'+BITMAP+'" '
CMD=CMD+'/DPANDA="'+PANDA+'" '
CMD=CMD+'/DPANDACONF="'+TMPETC+'" '
CMD=CMD+'/DPSOURCE="'+PSOURCE+'" '
CMD=CMD+'/DPPGAME="'+TMPGAME+'" '
CMD=CMD+'/DPPMAIN="'+MAIN+'" '
CMD=CMD+'/DPPICON="'+PPICON+'" '
CMD=CMD+'"'+PSOURCE+'\\direct\\directscripts\\packpanda.nsi"'
print("")
print(CMD)
print("packing...")
subprocess.call(CMD)
else:
os.chdir(MYDIR)
os.system("mkdir -p %s/usr/bin" % TMPDIR)
os.system("mkdir -p %s/usr/share/games/%s" % (TMPDIR, BASENAME))
os.system("mkdir -p %s/usr/lib/games/%s" % (TMPDIR, BASENAME))
os.system("cp --recursive %s/direct %s/usr/share/games/%s/direct" % (PANDA, TMPDIR, BASENAME))
os.system("cp --recursive %s/pandac %s/usr/share/games/%s/pandac" % (PANDA, TMPDIR, BASENAME))
os.system("cp --recursive %s/models %s/usr/share/games/%s/models" % (PANDA, TMPDIR, BASENAME))
os.system("cp --recursive %s/Pmw %s/usr/share/games/%s/Pmw" % (PANDA, TMPDIR, BASENAME))
os.system("cp %s %s/usr/share/games/%s/LICENSE" % (LICENSE, TMPDIR, BASENAME))
os.system("cp --recursive /usr/lib/panda3d/* %s/usr/lib/games/%s/" % (TMPDIR, BASENAME))
# Make the script to run the game
txt = RUN_SCRIPT[1:].replace("BASENAME",BASENAME).replace("PYTHONV",PYTHONV).replace("MAIN",MAIN)
WriteFile(TMPDIR+"/usr/bin/"+BASENAME, txt)
os.system("chmod +x "+TMPDIR+"/usr/bin/"+BASENAME)
if (os.path.exists("/usr/bin/rpmbuild")):
os.system("rm -rf %s/DEBIAN" % TMPDIR)
os.system("rpm -E '%_target_cpu' > packpanda-TMP.txt")
ARCH=ReadFile("packpanda-TMP.txt").strip()
os.remove("packpanda-TMP.txt")
txt = INSTALLER_SPEC_FILE[1:].replace("VERSION",VER).replace("TMPDIR",TMPDIR)
txt = txt.replace("BASENAME",BASENAME).replace("NAME",NAME).replace("PYTHONV",PYTHONV)
WriteFile("packpanda-TMP.spec", txt)
os.system("rpmbuild --define '_rpmdir "+TMPDIR+"' -bb packpanda-TMP.spec")
os.system("mv "+ARCH+"/"+BASENAME+"-"+VER+"-1."+ARCH+".rpm .")
os.rmdir(ARCH)
os.remove("packpanda-TMP.spec")
if (os.path.exists("/usr/bin/dpkg-deb")):
os.system("dpkg --print-architecture > packpanda-TMP.txt")
ARCH=ReadFile("packpanda-TMP.txt").strip()
os.remove("packpanda-TMP.txt")
txt = INSTALLER_DEB_FILE[1:].replace("VERSION",str(VER)).replace("PYTHONV",PYTHONV)
txt = txt.replace("BASENAME",BASENAME).replace("NAME",NAME).replace("ARCH",ARCH)
os.system("mkdir -p %s/DEBIAN" % TMPDIR)
os.system("cd %s ; (find usr -type f -exec md5sum {} \;) > DEBIAN/md5sums" % TMPDIR)
WriteFile(TMPDIR+"/DEBIAN/control",txt)
os.system("dpkg-deb -b "+TMPDIR+" "+BASENAME+"_"+VER+"_"+ARCH+".deb")
if not(os.path.exists("/usr/bin/rpmbuild") or os.path.exists("/usr/bin/dpkg-deb")):
exit("To build an installer, either rpmbuild or dpkg-deb must be present on your system!")
# Dummy main function so this can be added to console_scripts.
def main():
return 0

View File

@ -3450,8 +3450,8 @@ paint_window_osx_port() {
int y_size = min(_wparams.get_win_height(), _swbuffer->get_y_size());
size_t rowsize = _swbuffer->get_row_size();
Rect src_rect = {0, 0, y_size, x_size};
Rect ddrc_rect = {0, 0, y_size, x_size};
Rect src_rect = {0, 0, (short)y_size, (short)x_size};
Rect ddrc_rect = {0, 0, (short)y_size, (short)x_size};
QDErr err;
@ -3502,7 +3502,7 @@ paint_window_osx_cgcontext(CGContextRef context) {
int y_size = min(_wparams.get_win_height(), _swbuffer->get_y_size());
if (_buffer_image != NULL) {
CGRect region = { { 0, 0 }, { x_size, y_size } };
CGRect region = { { 0, 0 }, { (CGFloat)x_size, (CGFloat)y_size } };
CGContextDrawImage(context, region, _buffer_image);
}
}
@ -3538,7 +3538,7 @@ handle_event_osx_event_record(const P3D_event_data &event) {
// First, convert the coordinates from screen coordinates to browser
// window coordinates.
WindowRef window = handle._handle._osx_cgcontext._window;
CGPoint cgpt = { pt.h, pt.v };
CGPoint cgpt = { (CGFloat)pt.h, (CGFloat)pt.v };
HIPointConvert(&cgpt, kHICoordSpaceScreenPixel, NULL,
kHICoordSpaceWindow, window);

View File

@ -267,7 +267,7 @@ refresh() {
return;
}
if (_toplevel_window != NULL) {
Rect r = { 0, 0, _win_height, _win_width };
Rect r = { 0, 0, (short)_win_height, (short)_win_width };
InvalWindowRect(_toplevel_window, &r);
} else {
@ -345,7 +345,7 @@ paint_window_osx_cgcontext(CGContextRef context) {
CGColorSpaceRef rgb_space = CGColorSpaceCreateDeviceRGB();
CGColorRef bg = CGColorCreate(rgb_space, bg_components);
CGRect region = { { 0, 0 }, { _win_width, _win_height } };
CGRect region = { { 0, 0 }, { (CGFloat)_win_width, (CGFloat)_win_height } };
CGContextSetFillColorWithColor(context, bg);
CGContextFillRect(context, region);
@ -407,7 +407,7 @@ handle_event_osx_event_record(const P3D_event_data &event) {
// First, convert the coordinates from screen coordinates to browser
// window coordinates.
WindowRef window = handle._handle._osx_cgcontext._window;
CGPoint cgpt = { pt.h, pt.v };
CGPoint cgpt = { (CGFloat)pt.h, (CGFloat)pt.v };
HIPointConvert(&cgpt, kHICoordSpaceScreenPixel, NULL,
kHICoordSpaceWindow, window);
@ -617,7 +617,7 @@ paint_progress_bar(CGContextRef context) {
int bar_x, bar_y, bar_width, bar_height;
get_bar_placement(bar_x, bar_y, bar_width, bar_height);
CGRect bar_rect = { { bar_x, bar_y }, { bar_width, bar_height } };
CGRect bar_rect = { { (CGFloat)bar_x, (CGFloat)bar_y }, { (CGFloat)bar_width, (CGFloat)bar_height } };
// Clear the entire progress bar to white (or the background color).
CGContextSetFillColorWithColor(context, bar_bg);
@ -627,7 +627,7 @@ paint_progress_bar(CGContextRef context) {
if (_progress_known) {
int progress_width = (int)(bar_width * _install_progress + 0.5);
if (progress_width != 0) {
CGRect prog = { { bar_x, bar_y }, { progress_width, bar_height } };
CGRect prog = { { (CGFloat)bar_x, (CGFloat)bar_y }, { (CGFloat)progress_width, (CGFloat)bar_height } };
CGContextSetFillColorWithColor(context, bar);
CGContextFillRect(context, prog);
}
@ -642,7 +642,7 @@ paint_progress_bar(CGContextRef context) {
progress = block_travel * 2 - progress;
}
CGRect prog = { { bar_x + progress, bar_y }, { block_width, bar_height } };
CGRect prog = { { (CGFloat)(bar_x + progress), (CGFloat)bar_y }, { (CGFloat)block_width, (CGFloat)bar_height } };
CGContextSetFillColorWithColor(context, bar);
CGContextFillRect(context, prog);
}
@ -652,8 +652,8 @@ paint_progress_bar(CGContextRef context) {
// We offset the border by half a pixel, so we'll be drawing the one-pixel
// line through the middle of a pixel, and it won't try to antialias
// itself into a half-black two-pixel line.
CGRect border_rect = { { bar_x - 0.5, bar_y - 0.5 },
{ bar_width + 1, bar_height + 1 } };
CGRect border_rect = { { (CGFloat)(bar_x - 0.5), (CGFloat)(bar_y - 0.5) },
{ (CGFloat)(bar_width + 1), (CGFloat)(bar_height + 1) } };
CGContextBeginPath(context);
CGContextSetLineWidth(context, 1);

View File

@ -809,6 +809,8 @@ expand_manifests(const string &input_expr, bool expand_undefined,
// Here's an identifier. Is it "defined"?
if (ident == "defined") {
expand_defined_function(expr, q, p);
} else if (expand_undefined && ident == "__has_include") {
expand_has_include_function(expr, q, p, loc);
} else {
// Is it a manifest?
Manifests::const_iterator mi = _manifests.find(ident);
@ -817,6 +819,20 @@ expand_manifests(const string &input_expr, bool expand_undefined,
expand_manifest_inline(expr, q, p, manifest);
manifest_found = true;
} else if (ident == "__FILE__") {
// Special case: this is a dynamic definition.
string file = string("\"") + loc.file._filename_as_referenced.get_fullpath() + "\"";
expr = expr.substr(0, q) + file + expr.substr(p);
p = q + file.size();
manifest_found = true;
} else if (ident == "__LINE__") {
// So is this.
string line = format_string(loc.first_line);
expr = expr.substr(0, q) + line + expr.substr(p);
p = q + line.size();
manifest_found = true;
} else if (expand_undefined && ident != "true" && ident != "false") {
// It is not found. Expand it to 0, but only if we are currently
// parsing an #if expression.
@ -1486,14 +1502,10 @@ handle_undef_directive(const string &args, const YYLTYPE &loc) {
*/
void CPPPreprocessor::
handle_ifdef_directive(const string &args, const YYLTYPE &loc) {
Manifests::const_iterator mi = _manifests.find(args);
if (mi != _manifests.end()) {
// The macro is defined. We continue.
return;
if (!is_manifest_defined(args)) {
// The macro is undefined. Skip stuff.
skip_false_if_block(true);
}
// The macro is undefined. Skip stuff.
skip_false_if_block(true);
}
/**
@ -1501,17 +1513,12 @@ handle_ifdef_directive(const string &args, const YYLTYPE &loc) {
*/
void CPPPreprocessor::
handle_ifndef_directive(const string &args, const YYLTYPE &loc) {
Manifests::const_iterator mi = _manifests.find(args);
if (mi == _manifests.end()) {
// The macro is undefined. We continue.
return;
if (is_manifest_defined(args)) {
// The macro is defined. Skip stuff.
skip_false_if_block(true);
}
// The macro is defined. Skip stuff.
skip_false_if_block(true);
}
/**
*
*/
@ -1593,6 +1600,8 @@ handle_include_directive(const string &args, const YYLTYPE &loc) {
_angle_includes.insert(filename);
}
}
} else {
warning("Ignoring invalid #include directive", loc);
}
filename.set_text();
@ -1600,71 +1609,30 @@ handle_include_directive(const string &args, const YYLTYPE &loc) {
// Now look for the filename. If we didn't use angle quotes, look first in
// the current directory.
bool found_file = false;
CPPFile::Source source = CPPFile::S_none;
if (okflag) {
found_file = false;
if (find_include(filename, angle_quotes, source)) {
_last_c = '\0';
// Search the current directory.
if (!angle_quotes && !found_file && filename.exists()) {
found_file = true;
// If it was explicitly named on the command-line, mark it S_local.
filename.make_canonical();
if (_explicit_files.count(filename)) {
source = CPPFile::S_local;
}
// Search the same directory as the includer.
if (!angle_quotes && !found_file) {
Filename match(get_file()._filename.get_dirname(), filename);
if (match.exists()) {
filename = match;
found_file = true;
source = CPPFile::S_alternate;
}
CPPFile file(filename, filename_as_referenced, source);
// Don't include it if we included it before and it had #pragma once.
ParsedFiles::const_iterator it = _parsed_files.find(file);
if (it != _parsed_files.end() && it->_pragma_once) {
return;
}
// Now search the angle-include-path
if (angle_quotes && !found_file && filename.resolve_filename(_angle_include_path)) {
found_file = true;
source = CPPFile::S_system;
}
// Now search the quote-include-path
if (!angle_quotes && !found_file) {
for (size_t dir=0; dir<_quote_include_path.get_num_directories(); dir++) {
Filename match(_quote_include_path.get_directory(dir), filename);
if (match.exists()) {
filename = match;
found_file = true;
source = _quote_include_kind[dir];
}
}
}
if (!found_file) {
warning("Cannot find " + filename.get_fullpath(), loc);
} else {
_last_c = '\0';
// If it was explicitly named on the command-line, mark it S_local.
filename.make_canonical();
if (_explicit_files.count(filename)) {
source = CPPFile::S_local;
}
CPPFile file(filename, filename_as_referenced, source);
// Don't include it if we included it before and it had #pragma once.
ParsedFiles::const_iterator it = _parsed_files.find(file);
if (it != _parsed_files.end() && it->_pragma_once) {
return;
}
if (!push_file(file)) {
warning("Unable to read " + filename.get_fullpath(), loc);
}
if (!push_file(file)) {
warning("Unable to read " + filename.get_fullpath(), loc);
}
} else {
warning("Ignoring invalid #include directive", loc);
warning("Cannot find " + filename.get_fullpath(), loc);
}
}
@ -1779,6 +1747,69 @@ skip_false_if_block(bool consider_elifs) {
_save_comments = true;
}
/**
* Returns true if the given manifest is defined.
*/
bool CPPPreprocessor::
is_manifest_defined(const string &manifest_name) {
Manifests::const_iterator mi = _manifests.find(manifest_name);
if (mi != _manifests.end()) {
return true;
}
if (manifest_name == "__has_include" ||
manifest_name == "__FILE__" ||
manifest_name == "__LINE__") {
// Special built-in directives that are considered "defined".
return true;
}
return false;
}
/**
* Locates the given filename. Changes the first argument to the full path.
*/
bool CPPPreprocessor::
find_include(Filename &filename, bool angle_quotes, CPPFile::Source &source) {
// Now look for the filename. If we didn't use angle quotes, look first in
// the current directory.
if (!angle_quotes && filename.exists()) {
source = CPPFile::S_local;
return true;
}
// Search the same directory as the includer.
if (!angle_quotes) {
Filename match(get_file()._filename.get_dirname(), filename);
if (match.exists()) {
filename = match;
source = CPPFile::S_alternate;
return true;
}
}
// Now search the angle-include-path
if (angle_quotes && filename.resolve_filename(_angle_include_path)) {
source = CPPFile::S_system;
return true;
}
// Now search the quote-include-path
if (!angle_quotes) {
for (size_t dir = 0; dir < _quote_include_path.get_num_directories(); ++dir) {
Filename match(_quote_include_path.get_directory(dir), filename);
if (match.exists()) {
filename = match;
source = _quote_include_kind[dir];
return true;
}
}
}
return false;
}
/**
*
*/
@ -1885,6 +1916,14 @@ get_identifier(int c) {
if (mi != _manifests.end() && !should_ignore_manifest((*mi).second)) {
return expand_manifest((*mi).second);
}
if (name == "__FILE__") {
return get_literal(SIMPLE_STRING, loc, loc.file._filename_as_referenced);
}
if (name == "__LINE__") {
YYSTYPE result;
result.u.integer = loc.first_line;
return CPPToken(INTEGER, loc, "", result);
}
// Check for keywords.
int kw = check_keyword(name);
@ -2227,9 +2266,7 @@ expand_defined_function(string &expr, size_t q, size_t &p) {
vector_string args;
extract_manifest_args_inline("defined", 1, -1, args, expr, p);
if (args.size() >= 1) {
const string &manifest_name = args[0];
Manifests::const_iterator mi = _manifests.find(manifest_name);
if (mi != _manifests.end()) {
if (is_manifest_defined(args[0])) {
// The macro is defined; the result is "1".
result = "1";
} else {
@ -2242,6 +2279,70 @@ expand_defined_function(string &expr, size_t q, size_t &p) {
p = q + result.size();
}
/**
* Expands the __has_include(manifest) function to either 1 or 0, depending on
* whether the include file exists.
*/
void CPPPreprocessor::
expand_has_include_function(string &expr, size_t q, size_t &p, YYLTYPE loc) {
bool found_file = false;
// Skip whitespace till paren.
while (p < expr.size() && isspace(expr[p])) {
p++;
}
size_t args_begin = p + 1;
vector_string args;
extract_manifest_args_inline("__has_include", 1, -1, args, expr, p);
if (!args.empty() && args[0].size() >= 2) {
Filename filename;
bool angle_quotes = false;
string inc = args[0];
// Just to play things safe, since our manifest-expansion logic might not
// filter out quotes and angle brackets properly, we'll only expand
// manifests if we don't begin with a quote or bracket.
if (!inc.empty() && (inc[0] != '"' && inc[0] != '<')) {
inc = expand_manifests(inc, false, loc);
}
if (inc[0] == '"' && inc[inc.size() - 1] == '"') {
filename = inc.substr(1, inc.size() - 2);
} else if (inc[0] == '<' && inc[inc.size() - 1] == '>') {
filename = inc.substr(1, inc.size() - 2);
if (!_noangles) {
// If _noangles is true, we don't make a distinction between angle
// brackets and quote marks--all #inc statements are treated the
// same, as if they used quote marks.
angle_quotes = true;
}
} else {
loc.last_column += loc.first_column + p - 2;
loc.first_column += args_begin;
warning("invalid argument for __has_include() directive", loc);
expr = expr.substr(0, q) + "0" + expr.substr(p);
p = q + 1;
return;
}
filename.set_text();
CPPFile::Source source = CPPFile::S_none;
found_file = find_include(filename, angle_quotes, source);
} else {
loc.last_column += loc.first_column + p - 2;
loc.first_column += args_begin;
warning("invalid argument for __has_include() directive", loc);
}
string result = found_file ? "1" : "0";
expr = expr.substr(0, q) + result + expr.substr(p);
p = q + result.size();
}
/**
*
*/

View File

@ -143,6 +143,8 @@ private:
void handle_error_directive(const string &args, const YYLTYPE &loc);
void skip_false_if_block(bool consider_elifs);
bool is_manifest_defined(const string &manifest_name);
bool find_include(Filename &filename, bool angle_quotes, CPPFile::Source &source);
CPPToken get_quoted_char(int c);
CPPToken get_quoted_string(int c);
@ -153,6 +155,7 @@ private:
void extract_manifest_args(const string &name, int num_args,
int va_arg, vector_string &args);
void expand_defined_function(string &expr, size_t q, size_t &p);
void expand_has_include_function(string &expr, size_t q, size_t &p, YYLTYPE loc);
void expand_manifest_inline(string &expr, size_t q, size_t &p,
const CPPManifest *manifest);
void extract_manifest_args_inline(const string &name, int num_args,

View File

@ -71,7 +71,7 @@ allocate(size_t size, TypeHandle type_handle) {
// Allocate memory, and make sure the object starts at the proper alignment.
void *mem = NeverFreeMemory::alloc(alloc_size);
intptr_t pad = ((intptr_t)flag_reserved_bytes - (intptr_t)mem) % MemoryHook::get_memory_alignment();
intptr_t pad = (-(intptr_t)flag_reserved_bytes - (intptr_t)mem) % MemoryHook::get_memory_alignment();
obj = (ObjectNode *)((uintptr_t)mem + pad);
#ifdef USE_DELETEDCHAINFLAG
@ -80,7 +80,7 @@ allocate(size_t size, TypeHandle type_handle) {
void *ptr = node_to_buffer(obj);
#ifdef _DEBUG
#ifndef NDEBUG
assert(((uintptr_t)ptr % MemoryHook::get_memory_alignment()) == 0);
#endif

View File

@ -587,8 +587,11 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP
#define MAX_SIZE_T (~(size_t)0)
#ifndef USE_LOCKS /* ensure true if spin or recursive locks set */
#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \
(defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0))
#if (defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0)
#define USE_LOCKS 1
#else
#define USE_LOCKS 0
#endif
#endif /* USE_LOCKS */
#if USE_LOCKS /* Spin locks for gcc >= 4.1, older gcc on x86, MSC >= 1310 */
@ -647,7 +650,9 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP
#ifndef HAVE_MREMAP
#ifdef linux
#define HAVE_MREMAP 1
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* Turns on mremap() definition */
#endif
#else /* linux */
#define HAVE_MREMAP 0
#endif /* linux */

View File

@ -339,21 +339,26 @@ typedef struct _object PyObject;
#define ALIGN_4BYTE
#define ALIGN_8BYTE
#define ALIGN_16BYTE
#define ALIGN_32BYTE
#define ALIGN_64BYTE
#elif defined(_MSC_VER)
#define ALIGN_4BYTE __declspec(align(4))
#define ALIGN_8BYTE __declspec(align(8))
#define ALIGN_16BYTE __declspec(align(16))
#define ALIGN_32BYTE __declspec(align(32))
#define ALIGN_64BYTE __declspec(align(64))
#elif defined(__GNUC__)
#define ALIGN_4BYTE __attribute__ ((aligned (4)))
#define ALIGN_8BYTE __attribute__ ((aligned (8)))
#define ALIGN_16BYTE __attribute__ ((aligned (16)))
#define ALIGN_32BYTE __attribute__ ((aligned (32)))
#define ALIGN_64BYTE __attribute__ ((aligned (64)))
#else
#define ALIGN_4BYTE
#define ALIGN_8BYTE
#define ALIGN_16BYTE
#define ALIGN_32BYTE
#define ALIGN_64BYTE
#endif
// Do we need to implement memory-alignment enforcement within the MemoryHook

View File

@ -75,6 +75,7 @@ typedef int ios_seekdir;
#endif
#include <string>
#include <utility>
#ifdef HAVE_NAMESPACE
using namespace std;
@ -114,6 +115,20 @@ typedef ios::iostate ios_iostate;
typedef ios::seekdir ios_seekdir;
#endif
// Apple has an outdated libstdc++. Not all is lost, though, as we can fill
// in some important missing functions.
#if defined(__GLIBCXX__) && __GLIBCXX__ <= 20070719
typedef decltype(nullptr) nullptr_t;
template<class T> struct remove_reference {typedef T type;};
template<class T> struct remove_reference<T&> {typedef T type;};
template<class T> struct remove_reference<T&& >{typedef T type;};
template<class T> typename remove_reference<T>::type &&move(T &&t) {
return static_cast<typename remove_reference<T>::type&&>(t);
}
#endif
#ifdef _MSC_VER
#define ALWAYS_INLINE __forceinline
#elif defined(__GNUC__)
@ -134,7 +149,9 @@ typedef ios::seekdir ios_seekdir;
// Determine the availability of C++11 features.
#if defined(__has_extension) // Clang magic.
# if __has_extension(cxx_constexpr)
# define CONSTEXPR constexpr
# if !defined(__apple_build_version__) || __apple_build_version__ >= 5000000
# define CONSTEXPR constexpr
# endif
# endif
# if __has_extension(cxx_noexcept)
# define NOEXCEPT noexcept
@ -153,7 +170,7 @@ typedef ios::seekdir ios_seekdir;
#elif defined(__GNUC__) && (__cplusplus >= 201103L) // GCC
// GCC defines several macros which we can query. List of all supported
// builtin macros: https:gcc.gnu.orgprojectscxx0x.html
// builtin macros: https://gcc.gnu.org/projects/cxx-status.html
# if __cpp_constexpr >= 200704
# define CONSTEXPR constexpr
# endif

View File

@ -6198,7 +6198,7 @@ write_make_seq(ostream &out, Object *obj, const std::string &ClassName,
// the assumption that the called method doesn't do anything with this
// tuple other than unpack it (which is a fairly safe assumption to make).
out << " PyTupleObject args;\n";
out << " PyObject_INIT_VAR(&args, &PyTuple_Type, 1);\n";
out << " (void)PyObject_INIT_VAR(&args, &PyTuple_Type, 1);\n";
}
out <<

View File

@ -19,6 +19,7 @@
#include "pnotify.h"
#include "panda_getopt_long.h"
#include "preprocess_argv.h"
#include "pystub.h"
#include <time.h>
CPPParser parser;
@ -305,6 +306,8 @@ predefine_macro(CPPParser& parser, const string& inoption) {
int
main(int argc, char **argv) {
pystub();
preprocess_argv(argc, argv);
string command_line;
int i;

View File

@ -19,6 +19,7 @@
#include "interrogate_interface.h"
#include "interrogate_request.h"
#include "load_dso.h"
#include "pystub.h"
#include "pnotify.h"
#include "panda_getopt_long.h"
#include "preprocess_argv.h"
@ -379,6 +380,8 @@ int main(int argc, char *argv[]) {
extern int optind;
int flag;
pystub();
preprocess_argv(argc, argv);
flag = getopt_long_only(argc, argv, short_options, long_options, NULL);
while (flag != EOF) {

View File

@ -22,6 +22,7 @@
#include "cppGlobals.h"
#include "panda_getopt_long.h"
#include "preprocess_argv.h"
#include "pystub.h"
#include <stdlib.h>
CPPParser parser;
@ -193,6 +194,8 @@ show_nested_types(const string &str) {
int
main(int argc, char **argv) {
pystub();
extern char *optarg;
extern int optind;
const char *optstr = "I:S:D:o:l:vp";

View File

@ -0,0 +1,4 @@
#pragma once
#include <inttypes.h>
#include <netinet/in.h>

View File

@ -1,6 +1,74 @@
#pragma once
#include <stdtypedefs.h>
#include <string>
namespace std {
template<class Iterator> class iterator;
template<class Iterator> class reverse_iterator;
// Iterator tags
struct input_iterator_tag {};
struct output_iterator_tag {};
struct forward_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forward_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};
// Iterator traits
template<class Iterator> struct iterator_traits {
typedef typename Iterator::difference_type difference_type;
typedef typename Iterator::value_type value_type;
typedef typename Iterator::pointer pointer;
typedef typename Iterator::reference reference;
typedef typename Iterator::iterator_category iterator_category;
};
template<class T> struct iterator_traits<T*> {
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef T *pointer;
typedef T &reference;
typedef random_access_iterator_tag iterator_category;
};
template<class T> struct iterator_traits<const T*> {
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef const T *pointer;
typedef const T &reference;
typedef random_access_iterator_tag iterator_category;
};
// Iterators
template<class Category, class T, class Distance = ptrdiff_t,
class Pointer = T*, class Reference = T&> struct iterator {
typedef T value_type;
typedef Distance difference_type;
typedef Pointer pointer;
typedef Reference reference;
typedef Category iterator_category;
};
template<class Iterator>
class reverse_iterator : public
iterator<typename iterator_traits<Iterator>::iterator_category,
typename iterator_traits<Iterator>::value_type,
typename iterator_traits<Iterator>::difference_type,
typename iterator_traits<Iterator>::pointer,
typename iterator_traits<Iterator>::reference> {
public:
typedef Iterator iterator_type;
typedef typename iterator_traits<Iterator>::difference_type difference_type;
typedef typename iterator_traits<Iterator>::reference reference;
typedef typename iterator_traits<Iterator>::pointer pointer;
};
template<class T, class charT = char, class traits = char_traits<charT>,
class Distance = ptrdiff_t>
class istream_iterator;
template<class T, class charT = char, class traits = char_traits<charT>>
class ostream_iterator;
template<class charT, class traits = char_traits<charT>>
class istreambuf_iterator;
template <class charT, class traits = char_traits<charT>>
class ostreambuf_iterator;
};

View File

@ -122,7 +122,7 @@ namespace std {
struct is_always_equal;
template <class T> using rebind_alloc = size_t;
template <class T> using rebind_traits = allocator_traits<rebind_alloc<T> >;
//template <class T> using rebind_traits = allocator_traits<rebind_alloc<T> >;
};
template <class T> class allocator;

View File

@ -0,0 +1,9 @@
#pragma once
#include <inttypes.h>
#include <netinet/in.h>
struct hostent;
struct netent;
struct protoent;
struct servent;

View File

@ -17,6 +17,7 @@
#include "interrogate_request.h"
#include "load_dso.h"
#include "filename.h"
#include "pystub.h"
#include "panda_getopt.h"
#include "preprocess_argv.h"
@ -520,6 +521,8 @@ main(int argc, char **argv) {
extern int optind;
const char *optstr = "p:ftqh";
pystub();
bool all_functions = false;
bool all_types = false;
bool quick_load = false;

View File

@ -141,8 +141,9 @@ SectionGroup "Panda3D Libraries"
SetDetailsPrint listonly
SetOutPath "$INSTDIR"
File "${BUILT}\LICENSE"
File /r /x CVS "${BUILT}\ReleaseNotes"
File /nonfatal "${BUILT}\LICENSE"
File /nonfatal "${BUILT}\ReleaseNotes"
File /nonfatal "${BUILT}\pandaIcon.ico"
SetOutPath $INSTDIR\etc
File /r "${BUILT}\etc\*"
@ -532,15 +533,17 @@ Section "Sample programs" SecSamples
WriteINIStr $INSTDIR\Manual.url "InternetShortcut" "URL" "https://www.panda3d.org/manual/index.php"
WriteINIStr $INSTDIR\Samples.url "InternetShortcut" "URL" "https://www.panda3d.org/manual/index.php/Sample_Programs_in_the_Distribution"
SetOutPath $INSTDIR
CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Manual.lnk" "$INSTDIR\Manual.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Panda3D Manual"
CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Website.lnk" "$INSTDIR\Website.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Panda3D Website"
CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Program Manual.lnk" "$INSTDIR\Samples.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Sample Program Manual"
CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Manual.lnk" "$INSTDIR\Manual.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Panda3D Manual"
CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Website.lnk" "$INSTDIR\Website.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Panda3D Website"
CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Program Manual.lnk" "$INSTDIR\Samples.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Sample Program Manual"
FindFirst $0 $1 $INSTDIR\samples\*
loop:
StrCmp $1 "" done
StrCmp $1 "." next
StrCmp $1 ".." next
FindFirst $2 $3 $INSTDIR\samples\$1\*.py
StrCmp $3 "" next
Push $1
Push "-"
Push " "
@ -557,14 +560,13 @@ Section "Sample programs" SecSamples
DetailPrint "Creating shortcuts for sample program $READABLE"
CreateDirectory "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE"
SetOutPath $INSTDIR\samples\$1
WriteINIStr $INSTDIR\samples\$1\ManualPage.url "InternetShortcut" "URL" "http://panda3d.org/wiki/index.php/Sample_Programs:_$MANPAGE"
CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Manual Page.lnk" "$INSTDIR\samples\$1\ManualPage.url" "" "$INSTDIR\bin\eggcacher.exe" 0 "" "" "Manual Entry on this Sample Program"
WriteINIStr $INSTDIR\samples\$1\ManualPage.url "InternetShortcut" "URL" "https://www.panda3d.org/wiki/index.php/Sample_Programs:_$MANPAGE"
CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Manual Page.lnk" "$INSTDIR\samples\$1\ManualPage.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Manual Entry on this Sample Program"
CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\View Source Code.lnk" "$INSTDIR\samples\$1"
FindFirst $2 $3 $INSTDIR\samples\$1\*.py
iloop:
StrCmp $3 "" idone
CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\bin\eggcacher.exe" 0 SW_SHOWMINIMIZED "" "Run $3"
CreateShortCut "$INSTDIR\samples\$1\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\bin\eggcacher.exe" 0 SW_SHOWMINIMIZED "" "Run $3"
CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\pandaIcon.ico" 0 SW_SHOWMINIMIZED "" "Run $3"
CreateShortCut "$INSTDIR\samples\$1\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\pandaIcon.ico" 0 SW_SHOWMINIMIZED "" "Run $3"
FindNext $2 $3
goto iloop
idone:
@ -617,13 +619,10 @@ Section -post
DetailPrint "Preloading .egg files into the model cache..."
SetDetailsPrint listonly
; We need to set the $PATH for eggcacher.
SetOutPath $INSTDIR
ReadEnvStr $R0 "PATH"
StrCpy $R0 "$INSTDIR\python;$INSTDIR\bin;$R0"
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", R0).r2'
nsExec::ExecToLog '"$INSTDIR\bin\eggcacher.exe" --concise models samples'
nsExec::ExecToLog '"$INSTDIR\python\python.exe" -m direct.directscripts.eggcacher --concise models samples'
Pop $0
DetailPrint "Command returned exit status $0"
SetDetailsPrint both
DetailPrint "Writing the uninstaller ..."
@ -684,6 +683,10 @@ Section -post
DetailPrint "Broadcasting WM_WININICHANGE message..."
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=500
# Now dump the log to disk.
StrCpy $0 "$INSTDIR\install.log"
Push $0
Call DumpLog
SectionEnd
Section Uninstall
@ -1235,3 +1238,47 @@ done:
Exch $R3
FunctionEnd
!define LVM_GETITEMCOUNT 0x1004
!define LVM_GETITEMTEXT 0x102D
Function DumpLog
Exch $5
Push $0
Push $1
Push $2
Push $3
Push $4
Push $6
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1016
StrCmp $0 0 exit
FileOpen $5 $5 "w"
StrCmp $5 "" exit
SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
System::Alloc ${NSIS_MAX_STRLEN}
Pop $3
StrCpy $2 0
System::Call "*(i, i, i, i, i, i, i, i, i) i \
(0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
loop: StrCmp $2 $6 done
System::Call "User32::SendMessageA(i, i, i, i) i \
($0, ${LVM_GETITEMTEXT}, $2, r1)"
System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
FileWrite $5 "$4$\r$\n"
IntOp $2 $2 + 1
Goto loop
done:
FileClose $5
System::Free $1
System::Free $3
exit:
Pop $6
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
Exch $5
FunctionEnd

View File

@ -52,6 +52,7 @@ RUNTIME=0
DISTRIBUTOR=""
VERSION=None
DEBVERSION=None
WHLVERSION=None
RPMRELEASE="1"
GIT_COMMIT=None
P3DSUFFIX=None
@ -89,7 +90,7 @@ PkgListSet(["PYTHON", "DIRECT", # Python support
"ROCKET", "AWESOMIUM", # GUI libraries
"CARBON", "COCOA", # Mac OS X toolkits
"X11", # Unix platform support
"PANDATOOL", "PVIEW", "DEPLOYTOOLS", "DIRECTSCRIPTS",# Toolchain
"PANDATOOL", "PVIEW", "DEPLOYTOOLS", # Toolchain
"SKEL", # Example SKEL project
"PANDAFX", # Some distortion special lenses
"PANDAPARTICLESYSTEM", # Built in particle system
@ -163,7 +164,7 @@ def usage(problem):
def parseopts(args):
global INSTALLER,WHEEL,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION
global COMPRESSOR,THREADCOUNT,OSXTARGET,OSX_ARCHS,HOST_URL
global DEBVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX,RTDIST_VERSION
global DEBVERSION,WHLVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX,RTDIST_VERSION
global STRDXSDKVERSION, WINDOWS_SDK, MSVC_VERSION, BOOUSEINTELCOMPILER
longopts = [
"help","distributor=","verbose","runtime","osxtarget=",
@ -171,7 +172,7 @@ def parseopts(args):
"version=","lzma","no-python","threads=","outputdir=","override=",
"static","host=","debversion=","rpmrelease=","p3dsuffix=","rtdist-version=",
"directx-sdk=", "windows-sdk=", "msvc-version=", "clean", "use-icl",
"universal", "target=", "arch=", "git-commit=",
"universal", "target=", "arch=", "git-commit=", "no-directscripts",
"use-touchinput", "no-touchinput"]
anything = 0
optimize = ""
@ -206,8 +207,11 @@ def parseopts(args):
elif (option=="--arch"): target_arch = value.strip()
elif (option=="--nocolor"): DisableColors()
elif (option=="--version"):
VERSION=value
if (len(VERSION.split(".")) != 3): raise Exception
match = re.match(r'^\d+\.\d+\.\d+', value)
if not match:
usage("version requires three digits")
WHLVERSION = value
VERSION = match.group()
elif (option=="--lzma"): COMPRESSOR="lzma"
elif (option=="--override"): AddOverride(value.strip())
elif (option=="--static"): SetLinkAllStatic(True)
@ -220,6 +224,7 @@ def parseopts(args):
# Backward compatibility, OPENGL was renamed to GL
elif (option=="--use-opengl"): PkgEnable("GL")
elif (option=="--no-opengl"): PkgDisable("GL")
elif (option=="--no-directscripts"): pass
elif (option=="--directx-sdk"):
STRDXSDKVERSION = value.strip().lower()
if STRDXSDKVERSION == '':
@ -363,6 +368,9 @@ if VERSION is None:
else:
VERSION = ParsePandaVersion("dtool/PandaVersion.pp")
if WHLVERSION is None:
WHLVERSION = VERSION
print("Version: %s" % VERSION)
if RUNTIME or RTDIST:
print("Core API Version: %s" % COREAPI_VERSION)
@ -828,7 +836,11 @@ if (COMPILER=="GCC"):
SmartPkgEnable("ROCKET", "", rocket_libs, "Rocket/Core.h")
if not PkgSkip("PYTHON"):
SmartPkgEnable("PYTHON", "", SDK["PYTHONVERSION"], (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config")
python_lib = SDK["PYTHONVERSION"]
if not RTDIST:
# We don't link anything in the SDK with libpython.
python_lib = ""
SmartPkgEnable("PYTHON", "", python_lib, (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config")
SmartPkgEnable("OPENSSL", "openssl", ("ssl", "crypto"), ("openssl/ssl.h", "openssl/crypto.h"))
SmartPkgEnable("ZLIB", "zlib", ("z"), "zlib.h")
@ -1190,7 +1202,7 @@ def CompileCxx(obj,src,opts):
if (COMPILER=="GCC"):
if (src.endswith(".c")): cmd = GetCC() +' -fPIC -c -o ' + obj
else: cmd = GetCXX()+' -ftemplate-depth-70 -fPIC -c -o ' + obj
else: cmd = GetCXX()+' -std=gnu++0x -ftemplate-depth-70 -fPIC -c -o ' + obj
for (opt, dir) in INCDIRECTORIES:
if (opt=="ALWAYS") or (opt in opts): cmd += ' -I' + BracketNameWithQuotes(dir)
for (opt, dir) in FRAMEWORKDIRECTORIES:
@ -2867,14 +2879,16 @@ if tp_dir is not None:
CopyAllFiles(GetOutputDir() + "/bin/", tp_dir + "extras/bin/")
if not PkgSkip("PYTHON") and not RTDIST:
#XXX rdb I don't think we need to copy over the Python DLL, do we?
#pydll = "/" + SDK["PYTHONVERSION"].replace(".", "")
#if (GetOptimize() <= 2): pydll += "_d.dll"
#else: pydll += ".dll"
#CopyFile(GetOutputDir() + "/bin" + pydll, SDK["PYTHON"] + pydll)
# We need to copy the Python DLL to the bin directory for now.
pydll = "/" + SDK["PYTHONVERSION"].replace(".", "")
if GetOptimize() <= 2:
pydll += "_d.dll"
else:
pydll += ".dll"
CopyFile(GetOutputDir() + "/bin" + pydll, SDK["PYTHON"] + pydll)
#for fn in glob.glob(SDK["PYTHON"] + "/vcruntime*.dll"):
# CopyFile(GetOutputDir() + "/bin/", fn)
for fn in glob.glob(SDK["PYTHON"] + "/vcruntime*.dll"):
CopyFile(GetOutputDir() + "/bin/", fn)
# Copy the whole Python directory.
CopyTree(GetOutputDir() + "/python", SDK["PYTHON"])
@ -2893,7 +2907,7 @@ if tp_dir is not None:
else:
idents = ()
for ident in tree.findall('./{urn:schemas-microsoft-com:asm.v1}dependency/{urn:schemas-microsoft-com:asm.v1}dependentAssembly/{urn:schemas-microsoft-com:asm.v1}assemblyIdentity'):
for ident in idents:
sxs_name = '_'.join([
ident.get('processorArchitecture'),
ident.get('name').lower(),
@ -2945,6 +2959,7 @@ if GetTarget() == 'windows':
# Convert to Windows newlines so they can be opened by notepad.
WriteFile(GetOutputDir() + "/LICENSE", ReadFile("doc/LICENSE"), newline='\r\n')
WriteFile(GetOutputDir() + "/ReleaseNotes", ReadFile("doc/ReleaseNotes"), newline='\r\n')
CopyFile(GetOutputDir() + "/pandaIcon.ico", "panda/src/configfiles/pandaIcon.ico")
else:
CopyFile(GetOutputDir()+"/", "doc/LICENSE")
CopyFile(GetOutputDir()+"/", "doc/ReleaseNotes")
@ -4989,17 +5004,6 @@ if (PkgSkip("DIRECT")==0):
OPTS=['DIR:direct/src/directbase', 'PYTHON']
TargetAdd('p3directbase_directbase.obj', opts=OPTS+['BUILDING:DIRECT'], input='directbase.cxx')
if not PkgSkip("PYTHON") and not RTDIST and not RUNTIME and not PkgSkip("DIRECTSCRIPTS"):
DefSymbol("BUILDING:PACKPANDA", "IMPORT_MODULE", "direct.directscripts.packpanda")
TargetAdd('packpanda.obj', opts=OPTS+['BUILDING:PACKPANDA'], input='ppython.cxx')
TargetAdd('packpanda.exe', input='packpanda.obj')
TargetAdd('packpanda.exe', opts=['PYTHON'])
DefSymbol("BUILDING:EGGCACHER", "IMPORT_MODULE", "direct.directscripts.eggcacher")
TargetAdd('eggcacher.obj', opts=OPTS+['BUILDING:EGGCACHER'], input='ppython.cxx')
TargetAdd('eggcacher.exe', input='eggcacher.obj')
TargetAdd('eggcacher.exe', opts=['PYTHON'])
#
# DIRECTORY: direct/src/dcparser/
#
@ -6592,7 +6596,7 @@ def MakeInstallerNSIS(file, title, installdir):
AddToPathEnv("PATH", GetOutputDir() + "\\bin")
AddToPathEnv("PATH", GetOutputDir() + "\\plugins")
cmd = sys.executable + " -B -u direct\\src\\plugin_installer\\make_installer.py"
cmd = sys.executable + " -B -u " + os.path.join("direct", "src", "plugin_installer", "make_installer.py")
cmd += " --version %s --regview %s" % (VERSION, regview)
if GetTargetArch() == 'x64':
@ -6601,7 +6605,7 @@ def MakeInstallerNSIS(file, title, installdir):
cmd += " --install \"$PROGRAMFILES32\\Panda3D\" "
oscmd(cmd)
shutil.move("direct\\src\\plugin_installer\\p3d-setup.exe", file)
shutil.move(os.path.join("direct", "src", "plugin_installer", "p3d-setup.exe"), file)
return
print("Building "+title+" installer at %s" % (file))
@ -7257,7 +7261,7 @@ try:
if WHEEL:
ProgressOutput(100.0, "Building wheel")
from makewheel import makewheel
makewheel(VERSION, GetOutputDir())
makewheel(WHLVERSION, GetOutputDir())
finally:
SaveDependencyCache()

View File

@ -980,7 +980,10 @@ def WriteFile(wfile, data, newline=None):
data = data.replace('\n', newline)
try:
dsthandle = open(wfile, "w")
if sys.version_info >= (3, 0):
dsthandle = open(wfile, "w", newline='')
else:
dsthandle = open(wfile, "w")
dsthandle.write(data)
dsthandle.close()
except:
@ -1574,7 +1577,7 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
location = os.path.join(GetOutputDir(), "lib", os.path.basename(location))
LibName(target_pkg, location)
else:
print(GetColor("cyan") + "Couldn't find library lib" + libname + " in thirdparty directory " + pkg.lower() + GetColor())
print(GetColor("cyan") + "Couldn't find library lib" + libname + " in thirdparty directory " + thirdparty_dir + GetColor())
for d, v in defs.values():
DefSymbol(target_pkg, d, v)

View File

@ -551,7 +551,6 @@ def makewheel(version, output_dir, platform=default_platform):
# Add a panda3d-tools directory containing the executables.
entry_points = '[console_scripts]\n'
entry_points += 'eggcacher = direct.directscripts.eggcacher:main\n'
entry_points += 'packpanda = direct.directscripts.packpanda:main\n'
tools_init = ''
for file in os.listdir(bin_dir):
basename = os.path.splitext(file)[0]

View File

@ -424,8 +424,8 @@ get_sound(const string &file_name, bool positional, int) {
vfs->resolve_filename(path, get_model_path());
// Build a new AudioSound from the audio data.
PT(AudioSound) audioSound = 0;
PT(FmodAudioSound) fmodAudioSound = new FmodAudioSound(this, path, positional );
PT(AudioSound) audioSound;
PT(FmodAudioSound) fmodAudioSound = new FmodAudioSound(this, path, positional);
_all_sounds.insert(fmodAudioSound);

View File

@ -1022,7 +1022,6 @@ cleanup() {
OpenALAudioManager::SoundData::
SoundData() :
_manager(0),
_movie(0),
_sample(0),
_stream(NULL),
_length(0.0),

View File

@ -199,7 +199,7 @@ PT(CollisionEntry) CollisionBox::
test_intersection_from_sphere(const CollisionEntry &entry) const {
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
CPT(TransformState) wrt_space = entry.get_wrt_space();
CPT(TransformState) wrt_prev_space = entry.get_wrt_prev_space();
@ -402,7 +402,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionBox::
test_intersection_from_ray(const CollisionEntry &entry) const {
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
LPoint3 from_origin = ray->get_origin() * wrt_mat;
@ -483,7 +483,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionBox::
test_intersection_from_segment(const CollisionEntry &entry) const {
const CollisionSegment *seg;
DCAST_INTO_R(seg, entry.get_from(), 0);
DCAST_INTO_R(seg, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
LPoint3 from_origin = seg->get_point_a() * wrt_mat;
@ -564,7 +564,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionBox::
test_intersection_from_box(const CollisionEntry &entry) const {
const CollisionBox *box;
DCAST_INTO_R(box, entry.get_from(), 0);
DCAST_INTO_R(box, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();

View File

@ -125,7 +125,7 @@ compute_internal_bounds() const {
PT(CollisionEntry) CollisionFloorMesh::
test_intersection_from_ray(const CollisionEntry &entry) const {
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
LPoint3 from_origin = ray->get_origin() * entry.get_wrt_mat();
double fx = from_origin[0];
@ -190,7 +190,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionFloorMesh::
test_intersection_from_sphere(const CollisionEntry &entry) const {
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
LPoint3 from_origin = sphere->get_center() * entry.get_wrt_mat();
double fx = from_origin[0];

View File

@ -136,7 +136,7 @@ handle_entries() {
// currently we only support spheres as the collider
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entries.front()->get_from(), 0);
DCAST_INTO_R(sphere, entries.front()->get_from(), false);
from_node_path.set_pos(wrt_node, 0,0,0);
LPoint3 sphere_offset = (sphere->get_center() *

View File

@ -92,7 +92,7 @@ compute_internal_bounds() const {
PT(CollisionEntry) CollisionInvSphere::
test_intersection_from_sphere(const CollisionEntry &entry) const {
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -144,7 +144,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionInvSphere::
test_intersection_from_line(const CollisionEntry &entry) const {
const CollisionLine *line;
DCAST_INTO_R(line, entry.get_from(), 0);
DCAST_INTO_R(line, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -185,7 +185,7 @@ test_intersection_from_line(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionInvSphere::
test_intersection_from_ray(const CollisionEntry &entry) const {
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -228,7 +228,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionInvSphere::
test_intersection_from_segment(const CollisionEntry &entry) const {
const CollisionSegment *segment;
DCAST_INTO_R(segment, entry.get_from(), 0);
DCAST_INTO_R(segment, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();

View File

@ -107,7 +107,7 @@ compute_internal_bounds() const {
PT(CollisionEntry) CollisionPlane::
test_intersection_from_sphere(const CollisionEntry &entry) const {
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -146,7 +146,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionPlane::
test_intersection_from_line(const CollisionEntry &entry) const {
const CollisionLine *line;
DCAST_INTO_R(line, entry.get_from(), 0);
DCAST_INTO_R(line, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -191,7 +191,7 @@ test_intersection_from_line(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionPlane::
test_intersection_from_ray(const CollisionEntry &entry) const {
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -243,7 +243,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionPlane::
test_intersection_from_segment(const CollisionEntry &entry) const {
const CollisionSegment *segment;
DCAST_INTO_R(segment, entry.get_from(), 0);
DCAST_INTO_R(segment, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -300,7 +300,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionPlane::
test_intersection_from_tube(const CollisionEntry &entry) const {
const CollisionTube *tube;
DCAST_INTO_R(tube, entry.get_from(), 0);
DCAST_INTO_R(tube, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -371,7 +371,7 @@ test_intersection_from_tube(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionPlane::
test_intersection_from_parabola(const CollisionEntry &entry) const {
const CollisionParabola *parabola;
DCAST_INTO_R(parabola, entry.get_from(), 0);
DCAST_INTO_R(parabola, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -437,7 +437,7 @@ test_intersection_from_parabola(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionPlane::
test_intersection_from_box(const CollisionEntry &entry) const {
const CollisionBox *box;
DCAST_INTO_R(box, entry.get_from(), 0);
DCAST_INTO_R(box, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();

View File

@ -364,7 +364,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
}
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
CPT(TransformState) wrt_space = entry.get_wrt_space();
CPT(TransformState) wrt_prev_space = entry.get_wrt_prev_space();
@ -545,7 +545,7 @@ test_intersection_from_line(const CollisionEntry &entry) const {
}
const CollisionLine *line;
DCAST_INTO_R(line, entry.get_from(), 0);
DCAST_INTO_R(line, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -613,7 +613,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
}
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -686,7 +686,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
}
const CollisionSegment *segment;
DCAST_INTO_R(segment, entry.get_from(), 0);
DCAST_INTO_R(segment, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -761,7 +761,7 @@ test_intersection_from_parabola(const CollisionEntry &entry) const {
}
const CollisionParabola *parabola;
DCAST_INTO_R(parabola, entry.get_from(), 0);
DCAST_INTO_R(parabola, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -846,7 +846,7 @@ test_intersection_from_parabola(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionPolygon::
test_intersection_from_box(const CollisionEntry &entry) const {
const CollisionBox *box;
DCAST_INTO_R(box, entry.get_from(), 0);
DCAST_INTO_R(box, entry.get_from(), NULL);
// To make things easier, transform the box into the coordinate space of the
// plane.

View File

@ -120,7 +120,7 @@ compute_internal_bounds() const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_sphere(const CollisionEntry &entry) const {
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
CPT(TransformState) wrt_space = entry.get_wrt_space();
@ -231,7 +231,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_line(const CollisionEntry &entry) const {
const CollisionLine *line;
DCAST_INTO_R(line, entry.get_from(), 0);
DCAST_INTO_R(line, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -271,7 +271,7 @@ test_intersection_from_line(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_box(const CollisionEntry &entry) const {
const CollisionBox *box;
DCAST_INTO_R(box, entry.get_from(), 0);
DCAST_INTO_R(box, entry.get_from(), NULL);
// Instead of transforming the box into the sphere's coordinate space, we do
// it the other way around. It's easier that way.
@ -347,7 +347,7 @@ test_intersection_from_box(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_ray(const CollisionEntry &entry) const {
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -394,7 +394,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_segment(const CollisionEntry &entry) const {
const CollisionSegment *segment;
DCAST_INTO_R(segment, entry.get_from(), 0);
DCAST_INTO_R(segment, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -443,7 +443,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_tube(const CollisionEntry &entry) const {
const CollisionTube *tube;
DCAST_INTO_R(tube, entry.get_from(), 0);
DCAST_INTO_R(tube, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -499,7 +499,7 @@ test_intersection_from_tube(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_parabola(const CollisionEntry &entry) const {
const CollisionParabola *parabola;
DCAST_INTO_R(parabola, entry.get_from(), 0);
DCAST_INTO_R(parabola, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();

View File

@ -146,7 +146,7 @@ compute_internal_bounds() const {
PT(CollisionEntry) CollisionTube::
test_intersection_from_sphere(const CollisionEntry &entry) const {
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
CPT(TransformState) wrt_space = entry.get_wrt_space();
CPT(TransformState) wrt_prev_space = entry.get_wrt_prev_space();
@ -224,7 +224,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionTube::
test_intersection_from_line(const CollisionEntry &entry) const {
const CollisionLine *line;
DCAST_INTO_R(line, entry.get_from(), 0);
DCAST_INTO_R(line, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -272,7 +272,7 @@ test_intersection_from_line(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionTube::
test_intersection_from_ray(const CollisionEntry &entry) const {
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -333,7 +333,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionTube::
test_intersection_from_segment(const CollisionEntry &entry) const {
const CollisionSegment *segment;
DCAST_INTO_R(segment, entry.get_from(), 0);
DCAST_INTO_R(segment, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -397,7 +397,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionTube::
test_intersection_from_parabola(const CollisionEntry &entry) const {
const CollisionParabola *parabola;
DCAST_INTO_R(parabola, entry.get_from(), 0);
DCAST_INTO_R(parabola, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();

View File

@ -480,8 +480,8 @@ set_cull_result(PT(CullResult) cull_result, PT(SceneSetup) scene_setup,
Thread *current_thread) {
CDCullWriter cdata(_cycler_cull, true, current_thread);
#ifdef USE_MOVE_SEMANTICS
cdata->_cull_result = std::move(cull_result);
cdata->_scene_setup = std::move(scene_setup);
cdata->_cull_result = move(cull_result);
cdata->_scene_setup = move(scene_setup);
#else
swap(cdata->_cull_result, cull_result);
swap(cdata->_scene_setup, scene_setup);

View File

@ -807,7 +807,7 @@ load_client_certificate() {
// Rewind the "file" to the beginning in order to read the public key
// (which might appear first in the file).
BIO_reset(mbio);
(void)BIO_reset(mbio);
ERR_clear_error();
_client_certificate_pub =

View File

@ -40,6 +40,10 @@ PStatCollector FfmpegVideoCursor::_export_frame_pcollector("*:FFMPEG Convert Vid
#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
#endif
#if LIBAVCODEC_VERSION_MAJOR < 54
#define AV_CODEC_ID_VP8 CODEC_ID_VP8
#endif
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 74, 100)
#define AV_PIX_FMT_NONE PIX_FMT_NONE
#define AV_PIX_FMT_BGR24 PIX_FMT_BGR24
@ -116,6 +120,7 @@ init_from(FfmpegVideo *source) {
_eof_known = false;
_eof_frame = 0;
#if LIBAVUTIL_VERSION_MAJOR >= 52
// Check if we got an alpha format. Please note that some video codecs
// (eg. libvpx) change the pix_fmt after decoding the first frame, which is
// why we didn't do this earlier.
@ -123,7 +128,9 @@ init_from(FfmpegVideo *source) {
if (desc && (desc->flags & AV_PIX_FMT_FLAG_ALPHA) != 0) {
_num_components = 4;
_pixel_format = (int)AV_PIX_FMT_BGRA;
} else {
} else
#endif
{
_num_components = 3;
_pixel_format = (int)AV_PIX_FMT_BGR24;
}
@ -320,13 +327,13 @@ set_time(double timestamp, int loop_count) {
if (_eof_known) {
if (loop_count == 0) {
frame = frame % _eof_frame;
frame = frame % (_eof_frame + 1);
} else {
int last_frame = _eof_frame * loop_count;
int last_frame = (_eof_frame + 1) * loop_count;
if (frame < last_frame) {
frame = frame % _eof_frame;
frame = frame % (_eof_frame + 1);
} else {
frame = _eof_frame - 1;
frame = _eof_frame;
}
}
}

View File

@ -66,7 +66,7 @@ set_ram_image(PyObject *image, Texture::CompressionMode compression,
if (view.len % component_width != 0) {
PyErr_Format(PyExc_ValueError,
"byte buffer is not a multiple of %zu bytes",
"byte buffer is not a multiple of %d bytes",
component_width);
return;
}
@ -131,7 +131,7 @@ set_ram_image_as(PyObject *image, const string &provided_format) {
if (view.len % component_width != 0) {
PyErr_Format(PyExc_ValueError,
"byte buffer is not a multiple of %zu bytes",
"byte buffer is not a multiple of %d bytes",
component_width);
return;
}

View File

@ -19,6 +19,10 @@ get_pfm() {
return _pfm;
}
INLINE PfmVizzer::
~PfmVizzer() {
}
/**
* Returns the reference to the PfmFile manipulated by this PfmVizzer.
*/

View File

@ -30,6 +30,7 @@ class GeomVertexWriter;
class EXPCL_PANDA_GRUTIL PfmVizzer {
PUBLISHED:
PfmVizzer(PfmFile &pfm);
INLINE ~PfmVizzer();
INLINE PfmFile &get_pfm();
INLINE const PfmFile &get_pfm() const;

View File

@ -58,7 +58,9 @@ private:
#endif // HAVE_EIGEN
// This is as good a place as any to define this alignment macro.
#ifdef LINMATH_ALIGN
#if defined(LINMATH_ALIGN) && defined(HAVE_EIGEN) && defined(__AVX__)
#define ALIGN_LINMATH ALIGN_32BYTE
#elif defined(LINMATH_ALIGN)
#define ALIGN_LINMATH ALIGN_16BYTE
#else
#define ALIGN_LINMATH

View File

@ -72,14 +72,6 @@ operator [](int i) {
return _v(i);
}
/**
* Returns 2: the number of components of a LVecBase2.
*/
CONSTEXPR int FLOATNAME(LVecBase2)::
size() {
return 2;
}
/**
* Returns true if any component of the vector is not-a-number, false
* otherwise.
@ -178,14 +170,6 @@ get_data() const {
return &_v(0);
}
/**
* Returns the number of elements in the vector, two.
*/
CONSTEXPR int FLOATNAME(LVecBase2)::
get_num_components() {
return 2;
}
/**
* Returns an iterator that may be used to traverse the elements of the
* matrix, STL-style.

View File

@ -50,7 +50,7 @@ PUBLISHED:
INLINE_LINMATH FLOATTYPE operator [](int i) const;
INLINE_LINMATH FLOATTYPE &operator [](int i);
CONSTEXPR static int size();
CONSTEXPR static int size() { return 2; }
INLINE_LINMATH bool is_nan() const;
@ -74,7 +74,7 @@ PUBLISHED:
INLINE_LINMATH void add_y(FLOATTYPE value);
INLINE_LINMATH const FLOATTYPE *get_data() const;
CONSTEXPR static int get_num_components();
CONSTEXPR static int get_num_components() { return 2; }
public:
INLINE_LINMATH iterator begin();

View File

@ -89,14 +89,6 @@ operator [](int i) {
return _v(i);
}
/**
* Returns 3: the number of components of a LVecBase3.
*/
CONSTEXPR int FLOATNAME(LVecBase3)::
size() {
return 3;
}
/**
* Returns true if any component of the vector is not-a-number, false
* otherwise.
@ -246,14 +238,6 @@ get_data() const {
return &_v(0);
}
/**
* Returns the number of elements in the vector, three.
*/
CONSTEXPR int FLOATNAME(LVecBase3)::
get_num_components() {
return 3;
}
/**
* Returns an iterator that may be used to traverse the elements of the
* matrix, STL-style.

View File

@ -52,7 +52,7 @@ PUBLISHED:
INLINE_LINMATH FLOATTYPE operator [](int i) const;
INLINE_LINMATH FLOATTYPE &operator [](int i);
CONSTEXPR static int size();
CONSTEXPR static int size() { return 3; }
INLINE_LINMATH bool is_nan() const;
@ -87,7 +87,7 @@ PUBLISHED:
INLINE_LINMATH void add_z(FLOATTYPE value);
INLINE_LINMATH const FLOATTYPE *get_data() const;
CONSTEXPR static int get_num_components();
CONSTEXPR static int get_num_components() { return 3; }
public:
INLINE_LINMATH iterator begin();

View File

@ -118,14 +118,6 @@ operator [](int i) {
return _v(i);
}
/**
* Returns 4: the number of components of a LVecBase4.
*/
CONSTEXPR int FLOATNAME(LVecBase4)::
size() {
return 4;
}
/**
* Returns true if any component of the vector is not-a-number, false
* otherwise.
@ -288,14 +280,6 @@ get_data() const {
return &_v(0);
}
/**
* Returns the number of elements in the vector, four.
*/
CONSTEXPR int FLOATNAME(LVecBase4)::
get_num_components() {
return 4;
}
/**
* Returns an iterator that may be used to traverse the elements of the
* matrix, STL-style.
@ -958,14 +942,6 @@ operator [](int i) {
return _v(i);
}
/**
* Returns 4: the number of components of a LVecBase4.
*/
CONSTEXPR int FLOATNAME(UnalignedLVecBase4)::
size() {
return 4;
}
/**
* Returns the address of the first of the three data elements in the vector.
* The remaining elements occupy the next positions consecutively in memory.
@ -974,11 +950,3 @@ INLINE_LINMATH const FLOATTYPE *FLOATNAME(UnalignedLVecBase4)::
get_data() const {
return &_v(0);
}
/**
* Returns the number of elements in the vector, 4.
*/
CONSTEXPR int FLOATNAME(UnalignedLVecBase4)::
get_num_components() {
return 4;
}

View File

@ -62,7 +62,7 @@ PUBLISHED:
INLINE_LINMATH FLOATTYPE operator [](int i) const;
INLINE_LINMATH FLOATTYPE &operator [](int i);
CONSTEXPR static int size();
CONSTEXPR static int size() { return 4; }
INLINE_LINMATH bool is_nan() const;
@ -100,7 +100,7 @@ PUBLISHED:
INLINE_LINMATH void add_w(FLOATTYPE value);
INLINE_LINMATH const FLOATTYPE *get_data() const;
CONSTEXPR static int get_num_components();
CONSTEXPR static int get_num_components() { return 4; }
INLINE_LINMATH void extract_data(float*){};
public:
@ -236,10 +236,10 @@ PUBLISHED:
INLINE_LINMATH FLOATTYPE operator [](int i) const;
INLINE_LINMATH FLOATTYPE &operator [](int i);
CONSTEXPR static int size();
CONSTEXPR static int size() { return 4; }
INLINE_LINMATH const FLOATTYPE *get_data() const;
CONSTEXPR static int get_num_components();
CONSTEXPR static int get_num_components() { return 4; }
public:
typedef FLOATTYPE numeric_type;

View File

@ -29,7 +29,7 @@ get_data(dGeomID id) {
if (iter != data_map.end()) {
return iter->second;
}
return 0;
return NULL;
}
void OdeTriMeshData::

View File

@ -34,7 +34,7 @@ set_tri_mesh_data(OdeTriMeshData &data) {
INLINE PT(OdeTriMeshData) OdeTriMeshGeom::
get_tri_mesh_data() const {
nassertr(_id != 0 ,0);
nassertr(_id != 0, NULL);
return OdeTriMeshData::get_data(_id);
}

View File

@ -487,7 +487,7 @@ filter_to_max(int max_clip_planes) const {
CPT(RenderAttrib) ClipPlaneAttrib::
compose_off(const RenderAttrib *other) const {
const ClipPlaneAttrib *ta;
DCAST_INTO_R(ta, other, 0);
DCAST_INTO_R(ta, other, NULL);
if (_off_all_planes || (!ta->_off_all_planes && ta->_off_planes.empty())) {
// If we turn off all planes, or the other turns none off, the result is
@ -701,7 +701,7 @@ get_hash_impl() const {
CPT(RenderAttrib) ClipPlaneAttrib::
compose_impl(const RenderAttrib *other) const {
const ClipPlaneAttrib *ta;
DCAST_INTO_R(ta, other, 0);
DCAST_INTO_R(ta, other, NULL);
if (ta->_off_all_planes) {
// If the other type turns off all planes, it doesn't matter what we are.

View File

@ -39,7 +39,7 @@ PortalClipper::
PortalClipper(GeometricBoundingVolume *frustum, SceneSetup *scene_setup):
_reduced_viewport_min(-1,-1),
_reduced_viewport_max(1,1),
_clip_state(0)
_clip_state(NULL)
{
_previous = new GeomNode("my_frustum");

View File

@ -23,8 +23,9 @@
* Descriptor class for a character controller.
*/
class EXPCL_PANDAPHYSX PhysxControllerDesc {
PUBLISHED:
virtual ~PhysxControllerDesc() {};
virtual void set_to_default() = 0;
virtual bool is_valid() const = 0;

View File

@ -696,7 +696,7 @@ box_filter_line(const PNMImage &image,
// Get the final (partial) xel
float x_contrib = x1 - (float)x_last;
if (x_contrib > 0.0001f) {
if (x_contrib > 0.0001f && x < image.get_x_size()) {
box_filter_xel(image, x, y, x_contrib, y_contrib,
color, pixel_count);
}
@ -728,7 +728,7 @@ box_filter_region(const PNMImage &image,
// Get the final (partial) row
float y_contrib = y1 - (float)y_last;
if (y_contrib > 0.0001f) {
if (y_contrib > 0.0001f && y < image.get_y_size()) {
box_filter_line(image, x0, y, x1, y_contrib,
color, pixel_count);
}

View File

@ -307,7 +307,7 @@ template<class Key, class Value>
INLINE void WeakKeyHashMap<Key, Value>::
set_data(int n, Value &&data) {
nassertv(has_element(n));
_table[n]._data = std::move(data);
_table[n]._data = move(data);
}
#endif // USE_MOVE_SEMANTICS

View File

@ -212,21 +212,6 @@ private:
typedef pmap<GeomCollectorKey, GeomCollector> GeomCollectorMap;
struct QuadDef {
// Copying this class is a performance hotspot, hence we define the move
// constructor.
ALWAYS_INLINE QuadDef() {}
ALWAYS_INLINE QuadDef(const QuadDef &copy) :
_dimensions(copy._dimensions), _uvs(copy._uvs),
_slantl(copy._slantl), _slanth(copy._slanth),
_glyph(copy._glyph) {}
#ifdef USE_MOVE_SEMANTICS
ALWAYS_INLINE QuadDef(QuadDef &&from) NOEXCEPT :
_dimensions(from._dimensions), _uvs(from._uvs),
_slantl(from._slantl), _slanth(from._slanth),
_glyph(move(from._glyph)) {}
#endif
LVecBase4 _dimensions;
LVecBase4 _uvs;
PN_stdfloat _slantl, _slanth;

View File

@ -98,7 +98,7 @@
static XFile *x_file = (XFile *)NULL;
static XFileNode *current_node = (XFileNode *)NULL;
static PT(XFileDataDef) current_data_def = (XFileDataDef *)NULL;
static PT(XFileDataDef) current_data_def;
////////////////////////////////////////////////////////////////////
// Defining the interface to the parser.

View File

@ -32,7 +32,7 @@
static XFile *x_file = (XFile *)NULL;
static XFileNode *current_node = (XFileNode *)NULL;
static PT(XFileDataDef) current_data_def = (XFileDataDef *)NULL;
static PT(XFileDataDef) current_data_def;
////////////////////////////////////////////////////////////////////
// Defining the interface to the parser.