From DONOTREPLY at icculus.org Sun Apr 1 17:24:19 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 1 Apr 2007 17:24:19 -0400 Subject: r888 - trunk Message-ID: <20070401212419.21978.qmail@icculus.org> Author: icculus Date: 2007-04-01 17:24:19 -0400 (Sun, 01 Apr 2007) New Revision: 888 Modified: trunk/CHANGELOG.txt trunk/makeos2.cmd trunk/physfs.c trunk/physfs.h Log: Added PHYSFS_isInit() function. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-04-01 03:04:20 UTC (rev 887) +++ trunk/CHANGELOG.txt 2007-04-01 21:24:19 UTC (rev 888) @@ -2,6 +2,7 @@ * CHANGELOG. */ +04012007 - Added PHYSFS_isInit() function. 03312007 - Added a quick'n'dirty unpack utility to the extras directory. Moved DIR archiver to start of the list, so we don't have to have every other archiver fail to open a directory as a file before mounting Modified: trunk/makeos2.cmd =================================================================== --- trunk/makeos2.cmd 2007-04-01 03:04:20 UTC (rev 887) +++ trunk/makeos2.cmd 2007-04-01 21:24:19 UTC (rev 888) @@ -36,6 +36,7 @@ @echo "_PHYSFS_getLinkedVersion" >> bin\physfs.def @echo "_PHYSFS_init" >> bin\physfs.def @echo "_PHYSFS_deinit" >> bin\physfs.def + at echo "_PHYSFS_isInit" >> bin\physfs.def @echo "_PHYSFS_supportedArchiveTypes" >> bin\physfs.def @echo "_PHYSFS_freeList" >> bin\physfs.def @echo "_PHYSFS_getLastError" >> bin\physfs.def Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-04-01 03:04:20 UTC (rev 887) +++ trunk/physfs.c 2007-04-01 21:24:19 UTC (rev 888) @@ -856,6 +856,12 @@ } /* PHYSFS_deinit */ +int PHYSFS_isInit(void) +{ + return(initialized); +} /* PHYSFS_isInit */ + + const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void) { return(supported_types); Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-04-01 03:04:20 UTC (rev 887) +++ trunk/physfs.h 2007-04-01 21:24:19 UTC (rev 888) @@ -478,6 +478,7 @@ * gleaned from PHYSFS_getLastError(). * * \sa PHYSFS_deinit + * \sa PHYSFS_isInit */ __EXPORT__ int PHYSFS_init(const char *argv0); @@ -505,6 +506,7 @@ * undefined, and probably badly screwed up. * * \sa PHYSFS_init + * \sa PHYSFS_isInit */ __EXPORT__ int PHYSFS_deinit(void); @@ -1912,6 +1914,23 @@ /* Everything above this line is part of the PhysicsFS 1.0 API. */ /** + * \fn int PHYSFS_isInit(void) + * \brief Determine if the PhysicsFS library is initialized. + * + * Once PHYSFS_init() returns successfully, this will return non-zero. + * Before a successful PHYSFS_init() and after PHYSFS_deinit() returns + * successfully, this will return zero. This function is safe to call at + * any time. + * + * \return non-zero if library is initialized, zero if library is not. + * + * \sa PHYSFS_init + * \sa PHYSFS_deinit + */ +__EXPORT__ int PHYSFS_isInit(void); + + +/** * \struct PHYSFS_Allocator * \brief PhysicsFS allocation function pointers. * From DONOTREPLY at icculus.org Sun Apr 1 18:06:37 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 1 Apr 2007 18:06:37 -0400 Subject: r889 - trunk Message-ID: <20070401220637.2325.qmail@icculus.org> Author: icculus Date: 2007-04-01 18:06:37 -0400 (Sun, 01 Apr 2007) New Revision: 889 Modified: trunk/CHANGELOG.txt trunk/makeos2.cmd trunk/physfs.c trunk/physfs.h Log: Added PHYSFS_symbolicLinksPermitted(). Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-04-01 21:24:19 UTC (rev 888) +++ trunk/CHANGELOG.txt 2007-04-01 22:06:37 UTC (rev 889) @@ -2,7 +2,7 @@ * CHANGELOG. */ -04012007 - Added PHYSFS_isInit() function. +04012007 - Added PHYSFS_isInit() and PHYSFS_symbolicLinksPermitted() functions. 03312007 - Added a quick'n'dirty unpack utility to the extras directory. Moved DIR archiver to start of the list, so we don't have to have every other archiver fail to open a directory as a file before mounting Modified: trunk/makeos2.cmd =================================================================== --- trunk/makeos2.cmd 2007-04-01 21:24:19 UTC (rev 888) +++ trunk/makeos2.cmd 2007-04-01 22:06:37 UTC (rev 889) @@ -42,6 +42,7 @@ @echo "_PHYSFS_getLastError" >> bin\physfs.def @echo "_PHYSFS_getDirSeparator" >> bin\physfs.def @echo "_PHYSFS_permitSymbolicLinks" >> bin\physfs.def + at echo "_PHYSFS_symbolicLinksPermitted" >> bin\physfs.def @echo "_PHYSFS_getCdRomDirs" >> bin\physfs.def @echo "_PHYSFS_getBaseDir" >> bin\physfs.def @echo "_PHYSFS_getUserDir" >> bin\physfs.def Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-04-01 21:24:19 UTC (rev 888) +++ trunk/physfs.c 2007-04-01 22:06:37 UTC (rev 889) @@ -1173,6 +1173,12 @@ } /* PHYSFS_permitSymbolicLinks */ +int PHYSFS_symbolicLinksPermitted(void) +{ + return(allowSymLinks); +} /* PHYSFS_symbolicLinksPermitted */ + + /* string manipulation in C makes my ass itch. */ char *__PHYSFS_convertToDependent(const char *prepend, const char *dirName, Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-04-01 21:24:19 UTC (rev 888) +++ trunk/physfs.h 2007-04-01 22:06:37 UTC (rev 889) @@ -622,6 +622,8 @@ * you've called PHYSFS_init(), and is disabled by default. * * \param allow nonzero to permit symlinks, zero to deny linking. + * + * \sa PHYSFS_symbolicLinksPermitted */ __EXPORT__ void PHYSFS_permitSymbolicLinks(int allow); @@ -1931,6 +1933,21 @@ /** + * \fn int PHYSFS_symbolicLinksPermitted(void) + * \brief Determine if the symbolic links are permitted. + * + * This reports the setting from the last call to PHYSFS_permitSymbolicLinks(). + * If PHYSFS_permitSymbolicLinks() hasn't been called since the library was + * last initialized, symbolic links are implicitly disabled. + * + * \return non-zero if symlinks are permitted, zero if not. + * + * \sa PHYSFS_permitSymbolicLinks + */ +__EXPORT__ int PHYSFS_symbolicLinksPermitted(void); + + +/** * \struct PHYSFS_Allocator * \brief PhysicsFS allocation function pointers. * From DONOTREPLY at icculus.org Mon Apr 2 16:57:39 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Apr 2007 16:57:39 -0400 Subject: r890 - in trunk: . test Message-ID: <20070402205739.28475.qmail@icculus.org> Author: icculus Date: 2007-04-02 16:57:39 -0400 (Mon, 02 Apr 2007) New Revision: 890 Added: trunk/test/wxtest_physfs.cpp Modified: trunk/CHANGELOG.txt trunk/CMakeLists.txt Log: Added initial work on a wxWidgets-based test app. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-04-01 22:06:37 UTC (rev 889) +++ trunk/CHANGELOG.txt 2007-04-02 20:57:39 UTC (rev 890) @@ -2,6 +2,7 @@ * CHANGELOG. */ +04022007 - Added wxWidgets-based test program (incomplete). 04012007 - Added PHYSFS_isInit() and PHYSFS_symbolicLinksPermitted() functions. 03312007 - Added a quick'n'dirty unpack utility to the extras directory. Moved DIR archiver to start of the list, so we don't have to have every Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-04-01 22:06:37 UTC (rev 889) +++ trunk/CMakeLists.txt 2007-04-02 20:57:39 UTC (rev 890) @@ -297,7 +297,7 @@ SET_TARGET_PROPERTIES(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) ENDIF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC) -OPTION(PHYSFS_BUILD_TEST "Build test program." TRUE) +OPTION(PHYSFS_BUILD_TEST "Build stdio test program." TRUE) MARK_AS_ADVANCED(PHYSFS_BUILD_TEST) IF(PHYSFS_BUILD_TEST) CHECK_INCLUDE_FILE(readline/readline.h HAVE_READLINE_H) @@ -317,6 +317,24 @@ SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs") ENDIF(PHYSFS_BUILD_TEST) +OPTION(PHYSFS_BUILD_WX_TEST "Build wxWidgets test program." TRUE) +MARK_AS_ADVANCED(PHYSFS_BUILD_WX_TEST) +IF(PHYSFS_BUILD_WX_TEST) + SET(wxWidgets_USE_LIBS base core adv) + SET(wxWidgets_INCLUDE_DIRS_NO_SYSTEM 1) + FIND_PACKAGE(wxWidgets) + IF(wxWidgets_FOUND) + INCLUDE(${wxWidgets_USE_FILE}) + ADD_EXECUTABLE(wxtest_physfs test/wxtest_physfs.cpp) + SET_SOURCE_FILES_PROPERTIES(test/wxtest_physfs.cpp COMPILE_FLAGS ${wxWidgets_CXX_FLAGS}) + TARGET_LINK_LIBRARIES(wxtest_physfs ${PHYSFS_LIB_TARGET} ${wxWidgets_LIBRARIES} ${OTHER_LDFLAGS}) + SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";wxtest_physfs") + ELSE(wxWidgets_FOUND) + MESSAGE(STATUS "wxWidgets not found. Disabling wx test app.") + SET(PHYSFS_BUILD_WX_TEST FALSE) + ENDIF(wxWidgets_FOUND) +ENDIF(PHYSFS_BUILD_WX_TEST) + INSTALL(TARGETS ${PHYSFS_INSTALL_TARGETS} RUNTIME DESTINATION bin LIBRARY DESTINATION lib @@ -352,7 +370,8 @@ MESSAGE_BOOL_OPTION("Build own zlib" PHYSFS_INTERNAL_ZLIB) MESSAGE_BOOL_OPTION("Build static library" PHYSFS_BUILD_STATIC) MESSAGE_BOOL_OPTION("Build shared library" PHYSFS_BUILD_SHARED) -MESSAGE_BOOL_OPTION("Build test program" PHYSFS_BUILD_TEST) +MESSAGE_BOOL_OPTION("Build wxWidgets test program" PHYSFS_BUILD_WX_TEST) +MESSAGE_BOOL_OPTION("Build stdio test program" PHYSFS_BUILD_TEST) IF(PHYSFS_BUILD_TEST) MESSAGE_BOOL_OPTION(" Use readline in test program" HAVE_SYSTEM_READLINE) ENDIF(PHYSFS_BUILD_TEST) Added: trunk/test/wxtest_physfs.cpp =================================================================== --- trunk/test/wxtest_physfs.cpp (rev 0) +++ trunk/test/wxtest_physfs.cpp 2007-04-02 20:57:39 UTC (rev 890) @@ -0,0 +1,486 @@ +/** + * Test program for PhysicsFS, using wxWidgets. May only work on Unix. + * + * Please see the file LICENSE.txt in the source's root directory. + * + * This file written by Ryan C. Gordon. + */ + +#if ( (defined(__MACH__)) && (defined(__APPLE__)) ) +#define PLATFORM_MACOSX 1 +#include +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#include "physfs.h" + +#define TEST_VER_MAJOR 1 +#define TEST_VER_MINOR 1 +#define TEST_VER_PATCH 1 + +//static PHYSFS_uint32 do_buffer_size = 0; + +enum WxTestPhysfsMenuCommands +{ + // start with standard menu items, since using the wxIDs will map them + // to sane things in the platform's UI (gnome icons in GTK+, moves the + // about and quit items to the Apple menu on Mac OS X, etc). + MENUCMD_About = wxID_ABOUT, + MENUCMD_Quit = wxID_EXIT, + + // non-standard menu items go here. + MENUCMD_Init = wxID_HIGHEST, + MENUCMD_Deinit, + MENUCMD_AddArchive, + MENUCMD_Mount, + MENUCMD_Remove, + MENUCMD_GetCDs, + MENUCMD_SetWriteDir, + MENUCMD_PermitSymLinks, + MENUCMD_SetSaneConfig, + MENUCMD_MkDir, + MENUCMD_Delete, + MENUCMD_Cat, + MENUCMD_SetBuffer, + MENUCMD_StressBuffer, + MENUCMD_Append, + MENUCMD_Write, + MENUCMD_GetLastError, + +/* + { "getdirsep", cmd_getdirsep, 0, NULL }, + { "getsearchpath", cmd_getsearchpath, 0, NULL }, + { "getbasedir", cmd_getbasedir, 0, NULL }, + { "getuserdir", cmd_getuserdir, 0, NULL }, + { "getwritedir", cmd_getwritedir, 0, NULL }, + { "getrealdir", cmd_getrealdir, 1, "" }, + { "exists", cmd_exists, 1, "" }, + { "isdir", cmd_isdir, 1, "" }, + { "issymlink", cmd_issymlink, 1, "" }, + { "filelength", cmd_filelength, 1, "" }, + { "getlastmodtime", cmd_getlastmodtime, 1, "" }, +*/ +}; + + +class WxTestPhysfsFrame : public wxFrame +{ +public: + WxTestPhysfsFrame(const wxChar *argv0); + + void rebuildTree(); + + void onMenuInit(wxCommandEvent &evt); + void onMenuDeinit(wxCommandEvent &evt); + void onMenuAddArchive(wxCommandEvent &evt); + void onMenuGetCDs(wxCommandEvent &evt); + void onMenuPermitSymLinks(wxCommandEvent &evt); + +private: + wxTreeCtrl *fileTree; + wxTreeItemId stateItem; + wxTreeItemId fsItem; + + int err(int success); + void fillFileSystemTree(const char *path, const wxTreeItemId &item); + void doInit(const char *argv0); + void doDeinit(); + + DECLARE_EVENT_TABLE() +}; + +BEGIN_EVENT_TABLE(WxTestPhysfsFrame, wxFrame) + EVT_MENU(MENUCMD_Init, WxTestPhysfsFrame::onMenuInit) + EVT_MENU(MENUCMD_Deinit, WxTestPhysfsFrame::onMenuDeinit) + EVT_MENU(MENUCMD_AddArchive, WxTestPhysfsFrame::onMenuAddArchive) + EVT_MENU(MENUCMD_GetCDs, WxTestPhysfsFrame::onMenuGetCDs) + EVT_MENU(MENUCMD_PermitSymLinks, WxTestPhysfsFrame::onMenuPermitSymLinks) +END_EVENT_TABLE() + + + +// This is the the Application itself. +class WxTestPhysfsApp : public wxApp +{ +public: + WxTestPhysfsApp() : mainWindow(NULL) { /* no-op. */ } + virtual bool OnInit(); + +private: + WxTestPhysfsFrame *mainWindow; +}; + +DECLARE_APP(WxTestPhysfsApp) + + +static inline char *newstr(const char *str) +{ + char *retval = NULL; + if (str != NULL) + { + retval = new char[strlen(str) + 1]; + strcpy(retval, str); + } // if + return retval; +} // newstr + +static char *newutf8(const wxString &wxstr) +{ + #if wxUSE_UNICODE + size_t len = wxstr.Len() + 1; + char *utf8text = new char[len * 6]; + wxConvUTF8.WC2MB(utf8text, wxstr, len); + return utf8text; + #else + return newstr(wxstr); + #endif +} // newutf8 + + +WxTestPhysfsFrame::WxTestPhysfsFrame(const wxChar *argv0) + : wxFrame(NULL, -1, wxT("WxTestPhysfs")) +{ + this->CreateStatusBar(); + + wxMenuBar *menuBar = new wxMenuBar; + + wxMenu *stuffMenu = new wxMenu; + stuffMenu->Append(MENUCMD_Init, wxT("&Init")); + stuffMenu->Append(MENUCMD_Deinit, wxT("&Deinit")); + stuffMenu->Append(MENUCMD_AddArchive, wxT("&Add Archive")); + stuffMenu->Append(MENUCMD_Mount, wxT("&Mount Archive")); + stuffMenu->Append(MENUCMD_Remove, wxT("&Remove Archive")); + stuffMenu->Append(MENUCMD_GetCDs, wxT("&Get CD-ROM drives")); + stuffMenu->Append(MENUCMD_SetWriteDir, wxT("&Set Write Dir")); + stuffMenu->Append(MENUCMD_SetSaneConfig, wxT("Set Sane &Config")); + stuffMenu->Append(MENUCMD_MkDir, wxT("M&kDir")); + stuffMenu->Append(MENUCMD_Delete, wxT("D&elete")); + stuffMenu->Append(MENUCMD_Cat, wxT("&Cat")); + stuffMenu->Append(MENUCMD_SetBuffer, wxT("Set &Buffer")); + stuffMenu->Append(MENUCMD_StressBuffer, wxT("Stress &Test Buffer")); + stuffMenu->Append(MENUCMD_Append, wxT("&Append")); + stuffMenu->Append(MENUCMD_Write, wxT("&Write")); + stuffMenu->Append(MENUCMD_Write, wxT("&Update getLastError")); + stuffMenu->AppendCheckItem(MENUCMD_PermitSymLinks, wxT("&Permit symlinks")); + menuBar->Append(stuffMenu, wxT("&Stuff")); + + //wxMenu *helpMenu = new wxMenu; + //helpMenu->Append(MENUCMD_About, wxT("&About\tF1")); + //menuBar->Append(helpMenu, wxT("&Help")); + + this->SetMenuBar(menuBar); + + this->fileTree = new wxTreeCtrl(this, -1); + + // The sizer just makes sure that fileTree owns whole client area. + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add(this->fileTree, 1, wxALL | wxEXPAND | wxALIGN_CENTRE); + sizer->SetItemMinSize(this->fileTree, 1, 1); + this->SetSizer(sizer); + + char *utf8argv0 = newutf8(wxString(argv0)); + this->doInit(utf8argv0); + delete[] utf8argv0; +} // WxTestPhysfsFrame::WxTestPhysfsFrame + + +int WxTestPhysfsFrame::err(int success) +{ + if (success) + this->SetStatusText(wxT("")); + else + this->SetStatusText(wxString(PHYSFS_getLastError(), wxConvUTF8)); + return success; +} // WxTestPhysfsFrame::err + + +void WxTestPhysfsFrame::fillFileSystemTree(const char *path, + const wxTreeItemId &item) +{ + char **rc = PHYSFS_enumerateFiles(path); + char **i; + wxTreeItemId id; + + if (rc == NULL) + { + const wxString quote(wxT("'")); + wxString str(wxT("Enumeration error: ")); + str << quote << wxString(PHYSFS_getLastError(), wxConvUTF8) << quote; + id = this->fileTree->AppendItem(item, str); + this->fileTree->SetItemTextColour(id, wxColour(255, 0, 0)); + } // if + else + { + for (i = rc; *i != NULL; i++) + { + id = this->fileTree->AppendItem(item, wxString(*i, wxConvUTF8)); + const int len = strlen(path) + strlen(*i) + 2; + char *fname = new char[len]; + const char *origdir = path; + if (strcmp(origdir, "/") == 0) + origdir = ""; + snprintf(fname, len, "%s/%s", origdir, *i); + + if (PHYSFS_isDirectory(fname)) + { + this->fileTree->SetItemTextColour(id, wxColour(0, 0, 255)); + this->fillFileSystemTree(fname, id); + } // if + + else if (PHYSFS_isSymbolicLink(fname)) + { + this->fileTree->SetItemTextColour(id, wxColour(0, 255, 0)); + } // else if + + else // ...file. + { + } // else + + delete[] fname; + } // for + + PHYSFS_freeList(rc); + } // else +} // fillFileSystemTree + + +void WxTestPhysfsFrame::rebuildTree() +{ + const wxString dot(wxT(".")); + const wxString quote(wxT("'")); + wxTreeItemId item; + wxString str; + const char *cstr = NULL; + const bool wasInit = PHYSFS_isInit() ? true : false; + + this->fileTree->DeleteAllItems(); + wxTreeItemId root = this->fileTree->AddRoot(wxT("PhysicsFS")); + this->stateItem = this->fileTree->AppendItem(root, wxT("Library state")); + + str = wxT("Initialized: "); + str << ((wasInit) ? wxT("true") : wxT("false")); + this->fileTree->AppendItem(this->stateItem, str); + + this->fileTree->Expand(this->stateItem); + this->fileTree->Expand(root); + + // Fill in version information... + + PHYSFS_Version ver; + item = this->stateItem; + str = wxT("wxtest_physfs version: "); + str << TEST_VER_MAJOR << dot << TEST_VER_MINOR << dot << TEST_VER_PATCH; + this->fileTree->AppendItem(item, str); + PHYSFS_VERSION(&ver); + str = wxT("Compiled against PhysicsFS version: "); + str << (int) ver.major << dot << (int) ver.minor << dot << ver.patch; + this->fileTree->AppendItem(item, str); + PHYSFS_getLinkedVersion(&ver); + str = wxT("Linked against PhysicsFS version: "); + str << (int) ver.major << dot << (int) ver.minor << dot << ver.patch; + this->fileTree->AppendItem(item, str); + + if (!wasInit) + return; // nothing else to do before initialization... + + str = wxT("Symbolic links permitted: "); + str << ((PHYSFS_symbolicLinksPermitted()) ? wxT("true") : wxT("false")); + this->fileTree->AppendItem(this->stateItem, str); + + str = wxT("Native directory separator: "); + str << quote << wxString(PHYSFS_getDirSeparator(), wxConvUTF8) << quote; + this->fileTree->AppendItem(this->stateItem, str); + + // Fill in supported archives... + + item = this->fileTree->AppendItem(this->stateItem, wxT("Archivers")); + const PHYSFS_ArchiveInfo **arcs = PHYSFS_supportedArchiveTypes(); + if (*arcs == NULL) + this->fileTree->AppendItem(item, wxT("(none)")); + else + { + const PHYSFS_ArchiveInfo **i; + for (i = arcs; *i != NULL; i++) + { + const wxString ext((*i)->extension, wxConvUTF8); + const wxString desc((*i)->description, wxConvUTF8); + const wxString auth((*i)->author, wxConvUTF8); + const wxString url((*i)->url, wxConvUTF8); + wxTreeItemId arcitem = this->fileTree->AppendItem(item, ext); + this->fileTree->AppendItem(arcitem, desc); + this->fileTree->AppendItem(arcitem, auth); + this->fileTree->AppendItem(arcitem, url); + } // for + } // else + + + // Fill in the standard paths... + + item = this->fileTree->AppendItem(this->stateItem, wxT("Paths")); + str = wxT("Base directory: "); + str << quote << wxString(PHYSFS_getBaseDir(), wxConvUTF8) << quote; + this->fileTree->AppendItem(item, str); + str = wxT("User directory: "); + str << quote << wxString(PHYSFS_getUserDir(), wxConvUTF8) << quote; + this->fileTree->AppendItem(item, str); + str = wxT("Write directory: "); + if ((cstr = PHYSFS_getWriteDir()) == NULL) + str << wxT("(NULL)"); + else + str << quote << wxString(cstr ? cstr : "(NULL)", wxConvUTF8) << quote; + this->fileTree->AppendItem(item, str); + //str = wxT("Preference directory: "); + //str << wxString(PHYSFS_getUserDir(), wxConvUTF8); + //this->fileTree->AppendItem(item, str); + + // Fill in the CD-ROMs... + + item = this->fileTree->AppendItem(this->stateItem, wxT("CD-ROMs")); + char **cds = PHYSFS_getCdRomDirs(); + if (cds == NULL) + { + str = wxT("Error: "); + str << quote << wxString(PHYSFS_getLastError(), wxConvUTF8) << quote; + wxTreeItemId id = this->fileTree->AppendItem(item, str); + this->fileTree->SetItemTextColour(id, wxColour(255, 0, 0)); + } // if + else + { + if (*cds == NULL) + this->fileTree->AppendItem(item, wxT("(none)")); + else + { + char **i; + for (i = cds; *i != NULL; i++) + this->fileTree->AppendItem(item, wxString(*i, wxConvUTF8)); + } // else + PHYSFS_freeList(cds); + } // else + + // Fill in search path... + + item = this->fileTree->AppendItem(this->stateItem, wxT("Search path")); + char **sp = PHYSFS_getSearchPath(); + if (sp == NULL) + { + str = wxT("Error: "); + str << quote << wxString(PHYSFS_getLastError(), wxConvUTF8) << quote; + wxTreeItemId id = this->fileTree->AppendItem(item, str); + this->fileTree->SetItemTextColour(id, wxColour(255, 0, 0)); + } // if + else + { + if (*sp == NULL) + this->fileTree->AppendItem(item, wxT("(none)")); + else + { + char **i; + for (i = sp; *i != NULL; i++) + this->fileTree->AppendItem(item, wxString(*i, wxConvUTF8)); + } // else + PHYSFS_freeList(sp); + } // else + + // Now fill in the filesystem... + + this->fsItem = this->fileTree->AppendItem(root, wxT("Filesystem")); + this->fillFileSystemTree("/", this->fsItem); + this->fileTree->Expand(this->fsItem); +} // WxTestPhysfsFrame::rebuildTree + + +void WxTestPhysfsFrame::doInit(const char *argv0) +{ + if (!this->err(PHYSFS_init(argv0))) + ::wxMessageBox(wxT("PHYSFS_init() failed!"), wxT("wxTestPhysfs")); + this->rebuildTree(); +} // WxTestPhysfsFrame::doInit + + +void WxTestPhysfsFrame::doDeinit() +{ + if (!this->err(PHYSFS_deinit())) + ::wxMessageBox(wxT("PHYSFS_deinit() failed!"), wxT("wxTestPhysfs")); + this->rebuildTree(); +} // WxTestPhysfsFrame::doDeinit + + +void WxTestPhysfsFrame::onMenuInit(wxCommandEvent &evt) +{ + wxString argv0(wxGetApp().argv[0] == NULL ? wxT("") : wxGetApp().argv[0]); + wxString str(wxGetTextFromUser(wxT("PHYSFS_init"), + wxT("argv[0]? (cancel for NULL)"), argv0)); + char *cstr = str.IsEmpty() ? NULL : newutf8(str); + this->doInit(cstr); + delete[] cstr; +} // WxTestPhysfsFrame::onMenuInit + + +void WxTestPhysfsFrame::onMenuDeinit(wxCommandEvent &evt) +{ + this->doDeinit(); +} // WxTestPhysfsFrame::onMenuDeinit + + +void WxTestPhysfsFrame::onMenuAddArchive(wxCommandEvent &evt) +{ + wxString arc = wxFileSelector(wxT("Choose archive to add")); + if (!arc.IsEmpty()) + { + char *cstr = newutf8(arc); + // !!! FIXME: add to start/end? + if (!this->err(PHYSFS_addToSearchPath(cstr, 1))) + ::wxMessageBox(wxT("PHYSFS_addToSearchPath() failed!"), wxT("wxTestPhysfs")); + delete[] cstr; + this->rebuildTree(); + } // if +} // WxTestPhysfsFrame::onMenuAddArchive + + +void WxTestPhysfsFrame::onMenuGetCDs(wxCommandEvent &evt) +{ + this->rebuildTree(); // This will call PHYSFS_getCdRomDirs()... +} // WxTestPhysfsFrame::onMenuGetCDs + + +void WxTestPhysfsFrame::onMenuPermitSymLinks(wxCommandEvent &evt) +{ + PHYSFS_permitSymbolicLinks(evt.IsChecked() ? 1 : 0); + this->rebuildTree(); +} // WxTestPhysfsFrame::onMenuPermitSymLinks + + + +IMPLEMENT_APP(WxTestPhysfsApp) + +bool WxTestPhysfsApp::OnInit() +{ + #if PLATFORM_MACOSX + // This lets a stdio app become a GUI app. Otherwise, you won't get + // GUI events from the system and other things will fail to work. + // Putting the app in an application bundle does the same thing. + // TransformProcessType() is a 10.3+ API. SetFrontProcess() is 10.0+. + if (TransformProcessType != NULL) // check it as a weak symbol. + { + ProcessSerialNumber psn = { 0, kCurrentProcess }; + TransformProcessType(&psn, kProcessTransformToForegroundApplication); + SetFrontProcess(&psn); + } // if + #endif + + this->mainWindow = new WxTestPhysfsFrame(this->argv[0]); + this->mainWindow->Show(true); + SetTopWindow(this->mainWindow); + return true; +} // WxTestPhysfsApp::OnInit + +// end of wxtest_physfs.cpp ... + From DONOTREPLY at icculus.org Mon Apr 2 16:57:53 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Apr 2007 16:57:53 -0400 Subject: r891 - trunk Message-ID: <20070402205753.28683.qmail@icculus.org> Author: icculus Date: 2007-04-02 16:57:53 -0400 (Mon, 02 Apr 2007) New Revision: 891 Modified: trunk/ trunk/physfs.h Log: Updated. Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - physfs.spec docs build Debug debug Release release CMakeScripts CMakeCache.txt install_manifest.txt test_physfs CMakeTmp CMakeFiles Makefile *.a *.so *.so.* *.dylib *.dll *.exe *.xcodeproj *.build *.vcproj *.vcproj.* *.sln *.cmake *.make *.log *.dsp *.dsw *.dir *.ncb *.suo *.plg *.rule + physfs.spec docs build Debug debug Release release CMakeScripts CMakeCache.txt install_manifest.txt test_physfs wxtest_physfs CMakeTmp CMakeFiles Makefile *.a *.so *.so.* *.dylib *.dll *.exe *.xcodeproj *.build *.vcproj *.vcproj.* *.sln *.cmake *.make *.log *.dsp *.dsw *.dir *.ncb *.suo *.plg *.rule Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-04-02 20:57:39 UTC (rev 890) +++ trunk/physfs.h 2007-04-02 20:57:53 UTC (rev 891) @@ -628,6 +628,7 @@ __EXPORT__ void PHYSFS_permitSymbolicLinks(int allow); +/* !!! FIXME: const this? */ /** * \fn char **PHYSFS_getCdRomDirs(void) * \brief Get an array of paths to available CD-ROM drives. From DONOTREPLY at icculus.org Mon Apr 2 17:08:05 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Apr 2007 17:08:05 -0400 Subject: r892 - trunk Message-ID: <20070402210805.3291.qmail@icculus.org> Author: icculus Date: 2007-04-02 17:08:05 -0400 (Mon, 02 Apr 2007) New Revision: 892 Modified: trunk/physfs.h Log: It's now safe to call PHYSFS_* functions from callbacks, since mutexes are now recursive internally...removed warning in headers. Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-04-02 20:57:53 UTC (rev 891) +++ trunk/physfs.h 2007-04-02 21:08:05 UTC (rev 892) @@ -2075,10 +2075,6 @@ __EXPORT__ const char *PHYSFS_getMountPoint(const char *dir); -/* - * it is not safe to call physfs functions in these callbacks, as they may - * be holding non recursive mutexes. - */ /* !!! FIXME: comment! */ typedef void (*PHYSFS_StringCallback)(void *, const char *); typedef void (*PHYSFS_EnumFilesCallback)(void *, const char *, const char *); From DONOTREPLY at icculus.org Mon Apr 2 19:35:09 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Apr 2007 19:35:09 -0400 Subject: r893 - trunk Message-ID: <20070402233509.8588.qmail@icculus.org> Author: icculus Date: 2007-04-02 19:35:09 -0400 (Mon, 02 Apr 2007) New Revision: 893 Modified: trunk/CHANGELOG.txt trunk/physfs.h Log: Improved Doxygen comments. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-04-02 21:08:05 UTC (rev 892) +++ trunk/CHANGELOG.txt 2007-04-02 23:35:09 UTC (rev 893) @@ -2,7 +2,8 @@ * CHANGELOG. */ -04022007 - Added wxWidgets-based test program (incomplete). +04022007 - Added wxWidgets-based test program (incomplete). Filled in and + corrected some Doxygen comments. 04012007 - Added PHYSFS_isInit() and PHYSFS_symbolicLinksPermitted() functions. 03312007 - Added a quick'n'dirty unpack utility to the extras directory. Moved DIR archiver to start of the list, so we don't have to have every Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-04-02 21:08:05 UTC (rev 892) +++ trunk/physfs.h 2007-04-02 23:35:09 UTC (rev 893) @@ -639,8 +639,13 @@ * E: has a disc in it, then that's all you get. If the user inserts a disc * in D: and you call this function again, you get both drives. If, on a * Unix box, the user unmounts a disc and remounts it elsewhere, the next - * call to this function will reflect that change. Fun. + * call to this function will reflect that change. * + * This function refers to "CD-ROM" media, but it really means "inserted disc + * media," such as DVD-ROM, HD-DVD, CDRW, and Blu-Ray discs. It looks for + * filesystems, and as such won't report an audio CD, unless there's a + * mounted filesystem track on it. + * * The returned value is an array of strings, with a NULL entry to signify the * end of the list: * @@ -2009,7 +2014,7 @@ /** - * \fn int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath); + * \fn int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath) * \brief Add an archive or directory to the search path. * * If this is a duplicate, the entry is not added again, even though the @@ -2051,7 +2056,7 @@ __EXPORT__ int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath); /** - * \fn int PHYSFS_getMountPoint(const char *dir); + * \fn int PHYSFS_getMountPoint(const char *dir) * \brief Determine a mounted archive's mountpoint. * * You give this function the name of an archive or dir you successfully @@ -2075,14 +2080,176 @@ __EXPORT__ const char *PHYSFS_getMountPoint(const char *dir); -/* !!! FIXME: comment! */ -typedef void (*PHYSFS_StringCallback)(void *, const char *); -typedef void (*PHYSFS_EnumFilesCallback)(void *, const char *, const char *); +/** + * \typedef PHYSFS_StringCallback + * \brief Function signature for callbacks that report strings. + * + * These are used to report a list of strings to an original caller, one + * string per callback. All strings are UTF-8 encoded. Functions should not + * try to modify or free the string's memory. + * + * These callbacks are used, starting in PhysicsFS 1.1, as an alternative to + * functions that would return lists that need to be cleaned up with + * PHYSFS_freeList(). The callback means that the library doesn't need to + * allocate an entire list and all the strings up front. + * + * Be aware that promises data ordering in the list versions are not + * necessarily so in the callback versions. Check the documentation on + * specific APIs, but strings may not be sorted as you expect. + * + * \param data User-defined data pointer, passed through from the API + * that eventually called the callback. + * \param str The string data about which the callback is meant to inform. + * + * \sa PHYSFS_getCdRomDirsCallback + * \sa PHYSFS_getSearchPathCallback + */ +typedef void (*PHYSFS_StringCallback)(void *data, const char *str); + +/** + * \typedef PHYSFS_EnumFilesCallback + * \brief Function signature for callbacks that enumerate files. + * + * These are used to report a list of directory entries to an original caller, + * one file/dir/symlink per callback. All strings are UTF-8 encoded. + * Functions should not try to modify or free any string's memory. + * + * These callbacks are used, starting in PhysicsFS 1.1, as an alternative to + * functions that would return lists that need to be cleaned up with + * PHYSFS_freeList(). The callback means that the library doesn't need to + * allocate an entire list and all the strings up front. + * + * Be aware that promises data ordering in the list versions are not + * necessarily so in the callback versions. Check the documentation on + * specific APIs, but strings may not be sorted as you expect. + * + * \param data User-defined data pointer, passed through from the API + * that eventually called the callback. + * \param origdir A string containing the full path, in platform-independent + * notation, of the directory containing this file. In most + * cases, this is the directory on which you requested + * enumeration, passed in the callback for your convenience. + * \param fname The filename that is being enumerated. It may not be in + * alphabetical order compared to other callbacks that have + * fired, and it will not contain the full path. You can + * recreate the fullpath with $origdir/$fname ... The file + * can be a subdirectory, a file, a symlink, etc. + * + * \sa PHYSFS_enumerateFilesCallback + */ +typedef void (*PHYSFS_EnumFilesCallback)(void *data, const char *origdir, + const char *fname); + + +/** + * \fn void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d) + * \brief Enumerate CD-ROM directories, using an application-defined callback. + * + * Internally, PHYSFS_getCdRomDirs() just calls this function and then builds + * a list before returning to the application, so functionality is identical + * except for how the information is represented to the application. + * + * Unlike PHYSFS_getCdRomDirs(), this function does not return an array. + * Rather, it calls a function specified by the application once per + * detected disc: + * + * \code + * + * static void foundDisc(void *data, const char *cddir) + * { + * printf("cdrom dir [%s] is available.\n", cddir); + * } + * + * // ... + * PHYSFS_getCdRomDirsCallback(foundDisc, NULL); + * \endcode + * + * This call may block while drives spin up. Be forewarned. + * + * \param c Callback function to notify about detected drives. + * \param d Application-defined data passed to callback. Can be NULL. + * + * \sa PHYSFS_StringCallback + * \sa PHYSFS_getCdRomDirs + */ __EXPORT__ void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d); + +/** + * \fn void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d) + * \brief Enumerate the search path, using an application-defined callback. + * + * Internally, PHYSFS_getSearchPath() just calls this function and then builds + * a list before returning to the application, so functionality is identical + * except for how the information is represented to the application. + * + * Unlike PHYSFS_getSearchPath(), this function does not return an array. + * Rather, it calls a function specified by the application once per + * element of the search path: + * + * \code + * + * static void printSearchPath(void *data, const char *pathItem) + * { + * printf("[%s] is in the search path.\n", pathItem); + * } + * + * // ... + * PHYSFS_getSearchPathCallback(printSearchPath, NULL); + * \endcode + * + * Elements of the search path are reported in order search priority, so the + * first archive/dir that would be examined when looking for a file is the + * first element passed through the callback. + * + * \param c Callback function to notify about search path elements. + * \param d Application-defined data passed to callback. Can be NULL. + * + * \sa PHYSFS_StringCallback + * \sa PHYSFS_getSearchPath + */ __EXPORT__ void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d); + +/** + * \fn void PHYSFS_enumerateFilesCallback(const char *dir, PHYSFS_EnumFilesCallback c, void *d) + * \brief Get a file listing of a search path's directory, using an application-defined callback. + * + * Internally, PHYSFS_enumerateFiles() just calls this function and then builds + * a list before returning to the application, so functionality is identical + * except for how the information is represented to the application. + * + * Unlike PHYSFS_enumerateFiles(), this function does not return an array. + * Rather, it calls a function specified by the application once per + * element of the search path: + * + * \code + * + * static void printDir(void *data, const char *origdir, const char *fname) + * { + * printf(" * We've got [%s] in [%s].\n", fname, origdir); + * } + * + * // ... + * PHYSFS_enumerateFilesCallback("/some/path", printDir, NULL); + * \endcode + * + * Items sent to the callback are not guaranteed to be in any order whatsoever. + * There is no sorting done at this level, and if you need that, you should + * probably use PHYSFS_enumerateFiles() instead, which guarantees + * alphabetical sorting. This form reports whatever is discovered in each + * archive before moving on to the next. Even within one archive, we can't + * guarantee what order it will discover data. Any sorting you find in + * these callbacks is just pure luck. Do not rely on it. + * + * \param dir Directory, in platform-independent notation, to enumerate. + * \param c Callback function to notify about search path elements. + * \param d Application-defined data passed to callback. Can be NULL. + * + * \sa PHYSFS_EnumFilesCallback + * \sa PHYSFS_enumerateFiles + */ __EXPORT__ void PHYSFS_enumerateFilesCallback(const char *dir, PHYSFS_EnumFilesCallback c, void *d); From DONOTREPLY at icculus.org Mon Apr 2 20:57:11 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Apr 2007 20:57:11 -0400 Subject: r894 - trunk Message-ID: <20070403005711.12347.qmail@icculus.org> Author: icculus Date: 2007-04-02 20:57:11 -0400 (Mon, 02 Apr 2007) New Revision: 894 Modified: trunk/physfs.h Log: Fixed Doxygen comment (this was probably a Doxygen bug that was since fixed). Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-04-02 23:35:09 UTC (rev 893) +++ trunk/physfs.h 2007-04-03 00:57:11 UTC (rev 894) @@ -583,7 +583,7 @@ * \fn const char *PHYSFS_getDirSeparator(void) * \brief Get platform-dependent dir separator string. * - * This returns "\\\\" on win32, "/" on Unix, and ":" on MacOS. It may be more + * This returns "\\" on win32, "/" on Unix, and ":" on MacOS. It may be more * than one character, depending on the platform, and your code should take * that into account. Note that this is only useful for setting up the * search/write paths, since access into those dirs always use '/' From DONOTREPLY at icculus.org Mon Apr 2 20:58:33 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Apr 2007 20:58:33 -0400 Subject: r895 - branches/stable-1.0 Message-ID: <20070403005833.13088.qmail@icculus.org> Author: icculus Date: 2007-04-02 20:58:32 -0400 (Mon, 02 Apr 2007) New Revision: 895 Modified: branches/stable-1.0/CHANGELOG branches/stable-1.0/physfs.h Log: Merged r893:894 from trunk: Doxygen correction. Modified: branches/stable-1.0/CHANGELOG =================================================================== --- branches/stable-1.0/CHANGELOG 2007-04-03 00:57:11 UTC (rev 894) +++ branches/stable-1.0/CHANGELOG 2007-04-03 00:58:32 UTC (rev 895) @@ -4,6 +4,7 @@ -- stuff in the stable-1.0 branch, backported from 2.0.0 dev branch, etc --- +04022007 - Fixed Doxygen comment. 03312007 - Moved DIR archiver to start of the list, so we don't have to have every other archiver fail to open a directory as a file before adding it to the search path. Modified: branches/stable-1.0/physfs.h =================================================================== --- branches/stable-1.0/physfs.h 2007-04-03 00:57:11 UTC (rev 894) +++ branches/stable-1.0/physfs.h 2007-04-03 00:58:32 UTC (rev 895) @@ -499,7 +499,7 @@ * \fn const char *PHYSFS_getDirSeparator(void) * \brief Get platform-dependent dir separator string. * - * This returns "\\\\" on win32, "/" on Unix, and ":" on MacOS. It may be more + * This returns "\\" on win32, "/" on Unix, and ":" on MacOS. It may be more * than one character, depending on the platform, and your code should take * that into account. Note that this is only useful for setting up the * search/write paths, since access into those dirs always use '/' From DONOTREPLY at icculus.org Mon Apr 2 21:08:50 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Apr 2007 21:08:50 -0400 Subject: r896 - trunk Message-ID: <20070403010850.18494.qmail@icculus.org> Author: icculus Date: 2007-04-02 21:08:50 -0400 (Mon, 02 Apr 2007) New Revision: 896 Modified: trunk/TODO.txt Log: Updated. Modified: trunk/TODO.txt =================================================================== --- trunk/TODO.txt 2007-04-03 00:58:32 UTC (rev 895) +++ trunk/TODO.txt 2007-04-03 01:08:50 UTC (rev 896) @@ -4,9 +4,6 @@ Some might be dupes, some might be done already. UNICODE: -- Windows: Can use Unicode, but might only allow "codepages" ... Use - GetProcAddress() to find Unicode entry points on WinNT-based - systems, otherwise try to use a sane codepage. - OS/2: Codepages. No full Unicode in the filesystem, but we can probably make a conversion effort. From DONOTREPLY at icculus.org Mon Apr 2 21:48:09 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Apr 2007 21:48:09 -0400 Subject: r897 - in trunk: . extras Message-ID: <20070403014809.6085.qmail@icculus.org> Author: icculus Date: 2007-04-02 21:48:09 -0400 (Mon, 02 Apr 2007) New Revision: 897 Added: trunk/extras/makedist.sh Modified: trunk/CMakeLists.txt Log: Added a hack for "make dist" functionality. Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-04-03 01:08:50 UTC (rev 896) +++ trunk/CMakeLists.txt 2007-04-03 01:48:09 UTC (rev 897) @@ -348,6 +348,9 @@ MESSAGE(STATUS "Doxygen not found. You won't be able to build documentation.") ENDIF(DOXYGEN_FOUND) +IF(UNIX) + ADD_CUSTOM_TARGET(dist ./extras/makedist.sh ${PHYSFS_VERSION} COMMENT "Building source tarball") +ENDIF(UNIX) MACRO(MESSAGE_BOOL_OPTION _NAME _VALUE) IF(${_VALUE}) Added: trunk/extras/makedist.sh =================================================================== --- trunk/extras/makedist.sh (rev 0) +++ trunk/extras/makedist.sh 2007-04-03 01:48:09 UTC (rev 897) @@ -0,0 +1,50 @@ +#!/bin/sh + +# This shell script is roughly equivalent to what "make dist" did in the +# autotools build system and is called from a custom CMake target. + +# !!! FIXME: This code sort of sucks. Consider using CPack instead... + +if [ ! -f ./CMakeLists.txt ]; then + echo "you are in the wrong place." + exit 1 +fi + +if [ -z "$1" ]; then + echo "Wrong arguments." + exit 2 +fi + +set -e + +VERSION="$1" +BASENAME="physfs-$VERSION" +TARBALL="$BASENAME.tar.gz" +TMPCPDIR="../9sdkujy75jv932-physfstmp-$VERSION" +CPDIR="$TMPCPDIR/$BASENAME" + +echo "Packing PhysicsFS $VERSION source tarball..." +echo " + Setting up scratch dir..." +rm -rf $TMPCPDIR +mkdir $TMPCPDIR + +echo " + Making copy of source tree in scratch dir..." +cp -R . $CPDIR/ +echo " + Deleting cruft..." +pushd $CPDIR >/dev/null && rm -rf `svn propget svn:ignore .` && popd >/dev/null +rm -rf `find $CPDIR -type d -name '.svn'` +echo " + Deleting Subversion metadata..." +rm -rf `find $CPDIR -type d -name '.svn'` +echo " + Fixing up permissions..." +chmod -R a+rw $CPDIR +chmod a+x `find $CPDIR -type d` +echo " + Building final tarball..." +rm -f $TARBALL +tar -czf $TARBALL -C $TMPCPDIR $BASENAME +echo " + Cleaning up..." +rm -rf $TMPCPDIR +echo " + All done! Packed to '$TARBALL' ..." +set +e + +exit 0 + Property changes on: trunk/extras/makedist.sh ___________________________________________________________________ Name: svn:executable + * From DONOTREPLY at icculus.org Mon Apr 2 21:52:08 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Apr 2007 21:52:08 -0400 Subject: r898 - trunk Message-ID: <20070403015208.7932.qmail@icculus.org> Author: icculus Date: 2007-04-02 21:52:08 -0400 (Mon, 02 Apr 2007) New Revision: 898 Modified: trunk/ Log: Ignore generated source tarballs. Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - physfs.spec docs build Debug debug Release release CMakeScripts CMakeCache.txt install_manifest.txt test_physfs wxtest_physfs CMakeTmp CMakeFiles Makefile *.a *.so *.so.* *.dylib *.dll *.exe *.xcodeproj *.build *.vcproj *.vcproj.* *.sln *.cmake *.make *.log *.dsp *.dsw *.dir *.ncb *.suo *.plg *.rule + physfs.spec docs build Debug debug Release release CMakeScripts CMakeCache.txt install_manifest.txt test_physfs wxtest_physfs CMakeTmp CMakeFiles Makefile physfs-*.tar.gz *.a *.so *.so.* *.dylib *.dll *.exe *.xcodeproj *.build *.vcproj *.vcproj.* *.sln *.cmake *.make *.log *.dsp *.dsw *.dir *.ncb *.suo *.plg *.rule From DONOTREPLY at icculus.org Mon Apr 2 22:03:57 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Apr 2007 22:03:57 -0400 Subject: r899 - trunk Message-ID: <20070403020357.14736.qmail@icculus.org> Author: icculus Date: 2007-04-02 22:03:56 -0400 (Mon, 02 Apr 2007) New Revision: 899 Modified: trunk/ Log: More svn:ignore... Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - physfs.spec docs build Debug debug Release release CMakeScripts CMakeCache.txt install_manifest.txt test_physfs wxtest_physfs CMakeTmp CMakeFiles Makefile physfs-*.tar.gz *.a *.so *.so.* *.dylib *.dll *.exe *.xcodeproj *.build *.vcproj *.vcproj.* *.sln *.cmake *.make *.log *.dsp *.dsw *.dir *.ncb *.suo *.plg *.rule + physfs.spec docs build Debug debug Release release CMakeScripts CMakeCache.txt install_manifest.txt test_physfs wxtest_physfs CMakeTmp CMakeFiles Makefile physfs-*.tar.gz *.a *.so *.so.* *.dylib *.dll *.exe *.xcodeproj *.build *.vcproj *.vcproj.* *.sln *.cmake *.make *.log *.dsp *.dsw *.dir *.ncb *.suo *.plg *.rule *.opt From DONOTREPLY at icculus.org Mon Apr 2 22:17:43 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Apr 2007 22:17:43 -0400 Subject: r900 - trunk Message-ID: <20070403021743.23558.qmail@icculus.org> Author: icculus Date: 2007-04-02 22:17:43 -0400 (Mon, 02 Apr 2007) New Revision: 900 Modified: trunk/INSTALL.txt Log: Updated. Modified: trunk/INSTALL.txt =================================================================== --- trunk/INSTALL.txt 2007-04-03 02:03:56 UTC (rev 899) +++ trunk/INSTALL.txt 2007-04-03 02:17:43 UTC (rev 900) @@ -46,7 +46,8 @@ BeOS: Use the "Unix" instructions, above. The CMake port to BeOS is fairly new at - the time of this writing, but it works. You can get it from bebits.com ... + the time of this writing, but it works. You can get a build of CMake from + bebits.com or build it yourself from source from cmake.org. @@ -57,8 +58,15 @@ If you want to use Visual Studio, nmake, or the Platform SDK, you will need CMake (http://www.cmake.org/) 2.4 or later installed. Point CMake at the - CMakeLists.txt file in the root of the source directory and it will generate - project files for you. + CMakeLists.txt file in the root of the source directory and hit the + "Configure" button. After telling it what type of compiler you are targeting + (Borland, Visual Studio, etc), CMake will process for while and then give you + a list of options you can change (what archivers you want to support, etc). + If you aren't sure, the defaults are probably fine. Hit the "Configure" + button again, then "OK" once configuration has completed with options that + match your liking. Now project files for your favorite programming + environment will be generated for you in the directory you specified. + Go there and use them to build PhysicsFS. PhysicsFS will only link directly against system libraries that have existed since Windows 95 and Windows NT 3.51. If there's a newer API we want to use, @@ -114,14 +122,13 @@ You need Innotek GCC and libc installed (or kLIBC). I tried this on a stock Warp 4 install, no fixpaks. You need to install link386.exe (Selective - Install, "link object modules" option). Once libc and GCC are installed + Install, "link object modules" option). Once klibc and GCC are installed correctly, unpack the source to PhysicsFS and run the script file "makeos2.cmd". I know this isn't ideal, but I wanted to have this build - without users having to hunt down a "make" program (While several exist, EMX - doesn't come with one). If someone wants to hack some REXX to make this a bit - more picky about recompiling, I'll accept the patch. + without users having to hunt down a "make" program. -Someone please port CMake to OS/2. +Someone please port CMake to OS/2. Ideally I'd like to be able to target + Innotek GCC and OpenWatcom with CMake. If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for OS/2, I'd like to hear from you; send an email to icculus at icculus.org. From DONOTREPLY at icculus.org Tue Apr 3 01:01:13 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 3 Apr 2007 01:01:13 -0400 Subject: r901 - trunk/platform Message-ID: <20070403050113.11624.qmail@icculus.org> Author: icculus Date: 2007-04-03 01:01:13 -0400 (Tue, 03 Apr 2007) New Revision: 901 Modified: trunk/platform/unix.c Log: Reverted change r857:858...recursive mutex APIs sort of suck for portability. Modified: trunk/platform/unix.c =================================================================== --- trunk/platform/unix.c 2007-04-03 02:17:43 UTC (rev 900) +++ trunk/platform/unix.c 2007-04-03 05:01:13 UTC (rev 901) @@ -289,7 +289,6 @@ } /* __PHYSFS_platformSetDefaultAllocator */ - #if (defined PHYSFS_NO_PTHREADS_SUPPORT) PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) { return(0x0001); } @@ -300,6 +299,13 @@ #else +typedef struct +{ + pthread_mutex_t mutex; + pthread_t owner; + PHYSFS_uint32 count; +} PthreadMutex; + /* Just in case; this is a panic value. */ #if ((!defined SIZEOF_INT) || (SIZEOF_INT <= 0)) # define SIZEOF_INT 4 @@ -323,56 +329,62 @@ void *__PHYSFS_platformCreateMutex(void) { - pthread_mutex_t *m = NULL; - pthread_mutexattr_t attr; int rc; - - rc = pthread_mutexattr_init(&attr); - if (rc == 0) - { - rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - if (rc == 0) - { - m = (pthread_mutex_t *) allocator.Malloc(sizeof (pthread_mutex_t)); - if (m == NULL) - rc = ENOMEM; - else - rc = pthread_mutex_init(m, &attr); - } /* if */ - pthread_mutexattr_destroy(&attr); - } /* if */ - + PthreadMutex *m = (PthreadMutex *) allocator.Malloc(sizeof (PthreadMutex)); + BAIL_IF_MACRO(m == NULL, ERR_OUT_OF_MEMORY, NULL); + rc = pthread_mutex_init(&m->mutex, NULL); if (rc != 0) { allocator.Free(m); BAIL_MACRO(strerror(rc), NULL); } /* if */ + m->count = 0; + m->owner = (pthread_t) 0xDEADBEEF; return((void *) m); } /* __PHYSFS_platformCreateMutex */ void __PHYSFS_platformDestroyMutex(void *mutex) { - pthread_mutex_t *m = (pthread_mutex_t *) mutex; - pthread_mutex_destroy(m); + PthreadMutex *m = (PthreadMutex *) mutex; + + /* Destroying a locked mutex is a bug, but we'll try to be helpful. */ + if ((m->owner == pthread_self()) && (m->count > 0)) + pthread_mutex_unlock(&m->mutex); + + pthread_mutex_destroy(&m->mutex); allocator.Free(m); } /* __PHYSFS_platformDestroyMutex */ int __PHYSFS_platformGrabMutex(void *mutex) { - pthread_mutex_t *m = (pthread_mutex_t *) mutex; - if (pthread_mutex_lock(m) != 0) - return(0); + PthreadMutex *m = (PthreadMutex *) mutex; + pthread_t tid = pthread_self(); + if (m->owner != tid) + { + if (pthread_mutex_lock(&m->mutex) != 0) + return(0); + m->owner = tid; + } /* if */ + + m->count++; return(1); } /* __PHYSFS_platformGrabMutex */ void __PHYSFS_platformReleaseMutex(void *mutex) { - pthread_mutex_t *m = (pthread_mutex_t *) mutex; - pthread_mutex_unlock(m); + PthreadMutex *m = (PthreadMutex *) mutex; + if (m->owner == pthread_self()) + { + if (--m->count == 0) + { + m->owner = (pthread_t) 0xDEADBEEF; + pthread_mutex_unlock(&m->mutex); + } /* if */ + } /* if */ } /* __PHYSFS_platformReleaseMutex */ #endif /* !PHYSFS_NO_PTHREADS_SUPPORT */ From DONOTREPLY at icculus.org Tue Apr 3 01:01:24 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 3 Apr 2007 01:01:24 -0400 Subject: r902 - trunk Message-ID: <20070403050124.11748.qmail@icculus.org> Author: icculus Date: 2007-04-03 01:01:23 -0400 (Tue, 03 Apr 2007) New Revision: 902 Modified: trunk/CHANGELOG.txt Log: Updated. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-04-03 05:01:13 UTC (rev 901) +++ trunk/CHANGELOG.txt 2007-04-03 05:01:23 UTC (rev 902) @@ -2,6 +2,8 @@ * CHANGELOG. */ +04032007 - Reverted Unix recursive mutex code. There were some portability + issues I didn't anticipate. 04022007 - Added wxWidgets-based test program (incomplete). Filled in and corrected some Doxygen comments. 04012007 - Added PHYSFS_isInit() and PHYSFS_symbolicLinksPermitted() functions. From DONOTREPLY at icculus.org Tue Apr 3 01:13:50 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 3 Apr 2007 01:13:50 -0400 Subject: r903 - trunk/extras Message-ID: <20070403051350.18380.qmail@icculus.org> Author: icculus Date: 2007-04-03 01:13:49 -0400 (Tue, 03 Apr 2007) New Revision: 903 Modified: trunk/extras/makedist.sh Log: Fixes to the makedist.sh script. Modified: trunk/extras/makedist.sh =================================================================== --- trunk/extras/makedist.sh 2007-04-03 05:01:23 UTC (rev 902) +++ trunk/extras/makedist.sh 2007-04-03 05:13:49 UTC (rev 903) @@ -27,11 +27,15 @@ echo " + Setting up scratch dir..." rm -rf $TMPCPDIR mkdir $TMPCPDIR +mkdir $CPDIR echo " + Making copy of source tree in scratch dir..." cp -R . $CPDIR/ echo " + Deleting cruft..." -pushd $CPDIR >/dev/null && rm -rf `svn propget svn:ignore .` && popd >/dev/null +pushd $CPDIR >/dev/null +rm -rf `svn propget svn:ignore .` +rm -rf `svn status |grep '?' |sed -s 's/\?//'` +popd >/dev/null rm -rf `find $CPDIR -type d -name '.svn'` echo " + Deleting Subversion metadata..." rm -rf `find $CPDIR -type d -name '.svn'` From DONOTREPLY at icculus.org Tue Apr 3 01:24:08 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 3 Apr 2007 01:24:08 -0400 Subject: r904 - trunk Message-ID: <20070403052408.23136.qmail@icculus.org> Author: icculus Date: 2007-04-03 01:24:08 -0400 (Tue, 03 Apr 2007) New Revision: 904 Modified: trunk/CHANGELOG.txt Log: Updated. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-04-03 05:13:49 UTC (rev 903) +++ trunk/CHANGELOG.txt 2007-04-03 05:24:08 UTC (rev 904) @@ -2,8 +2,9 @@ * CHANGELOG. */ -04032007 - Reverted Unix recursive mutex code. There were some portability - issues I didn't anticipate. +04032007 - Added a "make dist" target for packing up source code releases. + Reverted Unix recursive mutex code. There were some portability + issues I didn't anticipate. Upped version to 1.1.1! 04022007 - Added wxWidgets-based test program (incomplete). Filled in and corrected some Doxygen comments. 04012007 - Added PHYSFS_isInit() and PHYSFS_symbolicLinksPermitted() functions. From DONOTREPLY at icculus.org Tue Apr 3 01:25:37 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 3 Apr 2007 01:25:37 -0400 Subject: r905 - tags Message-ID: <20070403052537.23785.qmail@icculus.org> Author: icculus Date: 2007-04-03 01:25:37 -0400 (Tue, 03 Apr 2007) New Revision: 905 Added: tags/release-1.1.1/ Log: Tagging 1.1.1 release. Copied: tags/release-1.1.1 (from rev 904, trunk) From DONOTREPLY at icculus.org Tue Apr 3 01:51:46 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 3 Apr 2007 01:51:46 -0400 Subject: r906 - trunk Message-ID: <20070403055146.5904.qmail@icculus.org> Author: icculus Date: 2007-04-03 01:51:46 -0400 (Tue, 03 Apr 2007) New Revision: 906 Modified: trunk/Doxyfile Log: Forgot to update the project version in the Doxygen file before release. Oh well. Modified: trunk/Doxyfile =================================================================== --- trunk/Doxyfile 2007-04-03 05:25:37 UTC (rev 905) +++ trunk/Doxyfile 2007-04-03 05:51:46 UTC (rev 906) @@ -23,7 +23,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.1.0 +PROJECT_NUMBER = 1.1.1 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. From DONOTREPLY at icculus.org Sun Apr 29 04:16:30 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 29 Apr 2007 04:16:30 -0400 Subject: r907 - in trunk: . archivers Message-ID: <20070429081630.12262.qmail@icculus.org> Author: icculus Date: 2007-04-29 04:16:30 -0400 (Sun, 29 Apr 2007) New Revision: 907 Modified: trunk/CHANGELOG.txt trunk/archivers/zip.c Log: Minor const correctness tweak in zip archiver. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-04-03 05:51:46 UTC (rev 906) +++ trunk/CHANGELOG.txt 2007-04-29 08:16:30 UTC (rev 907) @@ -2,6 +2,7 @@ * CHANGELOG. */ +04292007 - Minor const correctness tweak in zip archiver. 04032007 - Added a "make dist" target for packing up source code releases. Reverted Unix recursive mutex code. There were some portability issues I didn't anticipate. Upped version to 1.1.1! Modified: trunk/archivers/zip.c =================================================================== --- trunk/archivers/zip.c 2007-04-03 05:51:46 UTC (rev 906) +++ trunk/archivers/zip.c 2007-04-29 08:16:30 UTC (rev 907) @@ -836,7 +836,7 @@ } /* zip_version_does_symlinks */ -static int zip_entry_is_symlink(ZIPentry *entry) +static int zip_entry_is_symlink(const ZIPentry *entry) { return((entry->resolved == ZIP_UNRESOLVED_SYMLINK) || (entry->resolved == ZIP_BROKEN_SYMLINK) || @@ -1293,7 +1293,7 @@ static int ZIP_isSymLink(dvoid *opaque, const char *name, int *fileExists) { int isDir; - ZIPentry *entry = zip_find_entry((ZIPinfo *) opaque, name, &isDir); + const ZIPentry *entry = zip_find_entry((ZIPinfo *) opaque, name, &isDir); *fileExists = ((isDir) || (entry != NULL)); BAIL_IF_MACRO(entry == NULL, NULL, 0); return(zip_entry_is_symlink(entry));