From: <ny...@us...> - 2007-02-10 15:23:30
|
Revision: 325 http://svn.sourceforge.net/pmplib/?rev=325&view=rev Author: nyaochi Date: 2007-02-10 07:23:26 -0800 (Sat, 10 Feb 2007) Log Message: ----------- [Win32GUI] - Configurable source location of playlists - Configurable music and playlist location in the player - Disable Unicode JSPL for now Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj trunk/pmplib/frontend/easypmp/win32gui/maindlg.h trunk/pmplib/frontend/easypmp/win32gui/preference.h trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h trunk/pmplib/frontend/easypmp/win32gui/resource.h trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp trunk/pmplib/lib/playlist/contrib/js/jsapi.h trunk/pmplib/lib/playlist/contrib/js/jscpucfg.h trunk/pmplib/lib/playlist/contrib/js/jslong.h trunk/pmplib/lib/playlist/contrib/js/jsosdep.h trunk/pmplib/lib/playlist/contrib/js/jsotypes.h trunk/pmplib/lib/playlist/contrib/js/jspubtd.h trunk/pmplib/lib/playlist/contrib/js/jstypes.h trunk/pmplib/lib/playlist/contrib/js/win32/debug/js32.dll trunk/pmplib/lib/playlist/contrib/js/win32/js32.lib trunk/pmplib/lib/playlist/contrib/js/win32/js32d.lib trunk/pmplib/lib/playlist/contrib/js/win32/release/js32.dll trunk/pmplib/lib/playlist/jspl.c trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 15:23:26 UTC (rev 325) @@ -76,9 +76,9 @@ MODE_DATABASE_REPR = 0x00000004, MODE_PLAYLIST = 0x00000010, MODE_PLAYLIST_RECONVERT = 0x00000100, - MODE_PLAYLIST_FIND = 0x00000200, - MODE_PLAYLIST_SKIP = 0x00000400, - MODE_PLAYLIST_JSPL = 0x00000800, + MODE_PLAYLIST_FIND = 0x00000200, + MODE_PLAYLIST_SKIP = 0x00000400, + MODE_PLAYLIST_JSPL = 0x00000800, MODE_LIST_DEVICES = 0x00001000, MODE_HELP = 0x00010000, MODE_HELP_VARIABLE = 0x00020000, @@ -98,9 +98,10 @@ ucs2char_t** strip_words; int num_strip_words; - char *path_to_pmp_music; - char *path_to_pmp_playlist; - char *path_to_playlist_source; + ucs2char_t* path_to_pmp_music; + ucs2char_t* path_to_pmp_playlist; + ucs2char_t* path_to_playlist_source; + int subdir_playlist_source; } option_t; typedef struct { Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-10 15:23:26 UTC (rev 325) @@ -189,7 +189,7 @@ // Decode the playlist path prefix for system path separators if (opt->path_to_playlist_source) { - mbstoucs2(path, MAX_PATH, opt->path_to_playlist_source, strlen(opt->path_to_playlist_source)+1); + ucs2cpy(path, opt->path_to_playlist_source); } else { filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); } @@ -197,7 +197,7 @@ filepath_decode(path); ret = find_file( path, - pmp->info.playlist_flag & PMPPF_RECURSIVE ? 1 : 0, + opt->subdir_playlist_source, found_playlist_file, &ed ); Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 15:23:26 UTC (rev 325) @@ -313,10 +313,10 @@ // Modify the default setting. if (opt.path_to_pmp_music) { - mbstoucs2(pmp->info.path_to_music, MAX_PATH, opt.path_to_pmp_music, strlen(opt.path_to_pmp_music)+1); + ucs2cpy(pmp->info.path_to_music, opt.path_to_pmp_music); } if (opt.path_to_pmp_playlist) { - mbstoucs2(pmp->info.path_to_playlist, MAX_PATH, opt.path_to_pmp_playlist, strlen(opt.path_to_pmp_playlist)+1); + ucs2cpy(pmp->info.path_to_playlist, opt.path_to_pmp_playlist); } // Generate open flag. Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-10 15:23:26 UTC (rev 325) @@ -128,6 +128,9 @@ ucs2free(opt->strip_words[i]); } ucs2free(opt->strip_words); + ucs2free(opt->path_to_pmp_music); + ucs2free(opt->path_to_pmp_playlist); + ucs2free(opt->path_to_playlist_source); free(opt->system_encoding); free(opt->music_encoding); memset(opt, 0, sizeof(*opt)); @@ -217,8 +220,8 @@ opt->verb |= MODE_PLAYLIST; break; case 'P': - free(opt->path_to_playlist_source); - opt->path_to_playlist_source = strdup(optarg); + ucs2free(opt->path_to_playlist_source); + opt->path_to_playlist_source = mbsdupucs2(optarg); break; case 'r': opt->verb |= MODE_PLAYLIST_RECONVERT; @@ -238,11 +241,11 @@ break; case 's': if (strncmp("pmp_music:", optarg, 10) == 0) { - free(opt->path_to_pmp_music); - opt->path_to_pmp_music = strdup(optarg+10); + ucs2free(opt->path_to_pmp_music); + opt->path_to_pmp_music = mbsdupucs2(optarg+10); } else if (strncmp("pmp_playlist:", optarg, 13) == 0) { - free(opt->path_to_pmp_playlist); - opt->path_to_pmp_playlist = strdup(optarg+13); + ucs2free(opt->path_to_pmp_playlist); + opt->path_to_pmp_playlist = mbsdupucs2(optarg+13); } else { fprintf(fpe, "Unrecognized variable: %s\n", optarg); return -1; Modified: trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2007-02-10 15:23:26 UTC (rev 325) @@ -92,51 +92,60 @@ // Dialog // -IDD_PREFERENCE DIALOGEX 0, 0, 263, 234 +IDD_PREFERENCE DIALOGEX 0, 0, 263, 265 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU CAPTION "EasyPMP [Win32 GUI]" FONT 8, "MS Shell Dlg", 400, 0, 0x80 BEGIN - DEFPUSHBUTTON "OK",IDOK,144,210,48,12 - PUSHBUTTON "Cancel",IDCANCEL,204,210,48,12 + DEFPUSHBUTTON "OK",IDOK,144,240,48,12 + PUSHBUTTON "Cancel",IDCANCEL,204,240,48,12 GROUPBOX "Media database",IDC_STATIC,12,12,240,48 CONTROL "&None",IDC_RADIO_DATABASE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,24,24,72,8 CONTROL "&Update",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,96,24,72,8 CONTROL "&Rebuild",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,168,24,72,8 - LTEXT "Source of media information (&z):",IDC_STATIC,24,42,108,12 - COMBOBOX IDC_COMBO_MEDIAINFO_SOURCE,138,42,102,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Playlist conversion",IDC_STATIC,12,66,240,60 + LTEXT "Source of media information (&z):",IDC_STATIC,24,36,108,12 + COMBOBOX IDC_COMBO_MEDIAINFO_SOURCE,138,36,102,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Playlist conversion",IDC_STATIC,12,66,240,72 CONTROL "N&one",IDC_RADIO_PLAYLIST,"Button",BS_AUTORADIOBUTTON | WS_GROUP,24,78,72,8 CONTROL "&Update",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,96,78,72,8 CONTROL "Re&convert",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,168,78,72,8 - LTEXT "Conversion option:",IDC_STATIC,24,96,72,8 - CONTROL "&Find missing",IDC_CHECK_PL_FIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,96,72,8 - CONTROL "&Skip missing",IDC_CHECK_PL_SKIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,96,72,8 - CONTROL "Use &JavaScript playlist",IDC_CHECK_PL_JSPL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,108,144,8 - GROUPBOX "Portable Player Device",IDC_STATIC,12,132,240,72 - LTEXT "&Location:",IDC_STATIC,24,145,42,12,SS_CENTERIMAGE - COMBOBOX IDC_COMBO_DEVICE_LOCATION,78,145,42,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Sa&ve log",IDC_CHECK_SAVE_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,145,66,12 - LTEXT "&Identifier:",IDC_STATIC,24,162,42,12,SS_CENTERIMAGE - COMBOBOX IDC_COMBO_DEVICE_ID,78,162,162,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Description:",IDC_STATIC,24,180,42,12,SS_CENTERIMAGE - LTEXT "?X?^?e?B?b?N",IDC_STATIC_PLAYER_DESCRIPTION,78,180,162,12,0,WS_EX_CLIENTEDGE + LTEXT "Conversion option:",IDC_STATIC,24,90,72,8,SS_CENTERIMAGE + CONTROL "Find &missing",IDC_CHECK_PL_FIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,90,72,8 + CONTROL "&Skip missing",IDC_CHECK_PL_SKIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,90,72,8 + LTEXT "Source folder(s):",IDC_STATIC,24,102,72,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_PLAYLIST_SOURCE,96,102,144,12,ES_AUTOHSCROLL + PUSHBUTTON "Re&fer",IDC_BUTTON_REFER_PLAYLIST_SOURCE,96,115,30,12 + CONTROL "Include su&b folders",IDC_CHECK_PLAYLIST_SUBFOLDERS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,117,72,8 + GROUPBOX "Portable Player Device",IDC_STATIC,12,144,240,90 + LTEXT "&Location:",IDC_STATIC,24,157,42,12,SS_CENTERIMAGE + COMBOBOX IDC_COMBO_DEVICE_LOCATION,72,156,42,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Sa&ve log",IDC_CHECK_SAVE_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,156,66,12 + LTEXT "&Identifier:",IDC_STATIC,24,174,42,12,SS_CENTERIMAGE + COMBOBOX IDC_COMBO_DEVICE_ID,72,174,168,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "Description:",IDC_STATIC,24,192,42,12,SS_CENTERIMAGE + LTEXT "",IDC_STATIC_PLAYER_DESCRIPTION,72,192,168,12,0,WS_EX_CLIENTEDGE + LTEXT "Music folder:",IDC_STATIC,24,210,48,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_DEVICE_MUSIC,72,210,54,12,ES_AUTOHSCROLL + LTEXT "Playlist folder:",IDC_STATIC,138,210,48,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_DEVICE_PLAYLIST,186,210,54,12,ES_AUTOHSCROLL CONTROL "E&ject the player on completion",IDC_CHECK_SAFEREMOVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,120,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,240,120,12 + PUSHBUTTON "&Default",IDC_BUTTON_DEFAULT_PLAYLIST_SOURCE,126,115,30,12 END -IDD_PROCESSING DIALOGEX 0, 0, 263, 234 +IDD_PROCESSING DIALOGEX 0, 0, 263, 265 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU CAPTION "EasyPMP [Win32 GUI]" FONT 8, "MS Shell Dlg", 400, 0, 0x80 BEGIN - DEFPUSHBUTTON "OK",IDOK,144,210,48,12,NOT WS_VISIBLE - PUSHBUTTON "Cancel",IDCANCEL,204,210,48,12 + DEFPUSHBUTTON "OK",IDOK,144,240,48,12,NOT WS_VISIBLE + PUSHBUTTON "Cancel",IDCANCEL,204,240,48,12 CONTROL "",IDC_LIST_PROGRESS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER,12,12,240,84 - EDITTEXT IDC_EDIT_LOG,12,96,240,102,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL + EDITTEXT IDC_EDIT_LOG,12,96,240,138,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL CONTROL "E&ject the player on completion",IDC_CHECK_SAFEREMOVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,120,12 - CONTROL "Don't &close",IDC_CHECK_DONT_CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,210,48,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,240,120,12 + CONTROL "Don't &close",IDC_CHECK_DONT_CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,240,48,12 END @@ -153,7 +162,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 256 TOPMARGIN, 7 - BOTTOMMARGIN, 227 + BOTTOMMARGIN, 258 END IDD_PROCESSING, DIALOG @@ -161,7 +170,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 256 TOPMARGIN, 7 - BOTTOMMARGIN, 227 + BOTTOMMARGIN, 258 END END #endif // APSTUDIO_INVOKED @@ -197,8 +206,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,13,0,2 - PRODUCTVERSION 0,13,0,2 + FILEVERSION 0,14,0,2 + PRODUCTVERSION 0,14,0,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -214,12 +223,12 @@ BLOCK "040904b0" BEGIN VALUE "FileDescription", "EasyPMP [Win32 GUI] application" - VALUE "FileVersion", "0, 13, 0, 2" + VALUE "FileVersion", "0, 14, 0, 2" VALUE "InternalName", "easypmp_win32gui" VALUE "LegalCopyright", "Copyright 2005-2007 Nyaochi" VALUE "OriginalFilename", "easypmp_win32gui.exe" VALUE "ProductName", "EasyPMP [Win32 GUI]" - VALUE "ProductVersion", "0, 13, 0, 2" + VALUE "ProductVersion", "0, 14, 0, 2" END END BLOCK "VarFileInfo" Modified: trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 2007-02-10 15:23:26 UTC (rev 325) @@ -4,6 +4,7 @@ Version="8.00" Name="easypmp_win32gui" ProjectGUID="{45CCFC7B-42B4-4FF9-AF43-FC3626B1672F}" + RootNamespace="easypmp_win32gui" > <Platforms> <Platform @@ -236,6 +237,10 @@ > </File> <File + RelativePath=".\folderdialog.h" + > + </File> + <File RelativePath=".\maindlg.h" > </File> Modified: trunk/pmplib/frontend/easypmp/win32gui/maindlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2007-02-10 15:23:26 UTC (rev 325) @@ -24,10 +24,6 @@ #pragma once -/** - * \addtogroup win32 - * @{ - */ class CMainDlg : public CDialogImpl<CMainDlg>, public CUpdateUI<CMainDlg>, @@ -72,7 +68,7 @@ DDX_RADIO(IDC_RADIO_PLAYLIST, m_setting.iPlaylistProcess) DDX_CHECK(IDC_CHECK_PL_FIND, m_setting.bSearchMissing) DDX_CHECK(IDC_CHECK_PL_SKIP, m_setting.bSkipMissing) - DDX_CHECK(IDC_CHECK_PL_JSPL, m_setting.bJSPL) + DDX_CHECK(IDC_CHECK_PLAYLIST_SUBFOLDERS, m_setting.bPlaylistSourceSubdirs) DDX_CHECK(IDC_CHECK_SAVE_LOG, m_setting.bSaveLog) DDX_CHECK(IDC_CHECK_SAFEREMOVE, m_setting.bSafelyRemove) END_DDX_MAP() @@ -82,6 +78,8 @@ MESSAGE_HANDLER(WM_APP, OnInitialize) COMMAND_ID_HANDLER(IDOK, OnOK) COMMAND_ID_HANDLER(IDCANCEL, OnCancel) + COMMAND_ID_HANDLER(IDC_BUTTON_REFER_PLAYLIST_SOURCE, OnClickReferPlaylistSource) + COMMAND_ID_HANDLER(IDC_BUTTON_DEFAULT_PLAYLIST_SOURCE, OnClickDefaultPlaylistSource) COMMAND_HANDLER(IDC_COMBO_DEVICE_LOCATION, CBN_SELCHANGE, OnLocationSelChange) END_MSG_MAP() @@ -227,6 +225,24 @@ return 0; } + LRESULT OnClickReferPlaylistSource(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + CFolderDialog2 fd(m_hWnd, _T("Choose a folder for source playlists")); + fd.SetFolderPath(m_setting.strPlaylistSourceLocation); + if (fd.DoModal() == IDOK) { + m_setting.strPlaylistSourceLocation = fd.m_szFolderPath; + updateUI(FALSE); + } + return 0; + } + + LRESULT OnClickDefaultPlaylistSource(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + m_setting.strPlaylistSourceLocation = _T(""); + updateUI(FALSE); + return 0; + } + LRESULT OnLocationSelChange(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { CString strPlayerLocation; @@ -275,6 +291,9 @@ m_cmbPlayerLocation.GetLBText(m_cmbPlayerLocation.GetCurSel(), m_setting.strPlayerLocation); m_cmbPlayerIdentifier.GetLBText(m_cmbPlayerIdentifier.GetCurSel(), m_setting.strPlayerIdentifier); m_setting.iMediaInfoSource = m_cmbMediaInfoSource.GetCurSel(); + GetDlgItemText(IDC_EDIT_DEVICE_MUSIC, m_setting.strPlayerMusicLocation); + GetDlgItemText(IDC_EDIT_DEVICE_PLAYLIST, m_setting.strPlayerPlaylistLocation); + GetDlgItemText(IDC_EDIT_PLAYLIST_SOURCE, m_setting.strPlaylistSourceLocation); } else { if (m_cmbPlayerLocation.SelectString(-1, m_setting.strPlayerLocation) == CB_ERR) { m_cmbPlayerLocation.SetCurSel(-1); @@ -284,6 +303,9 @@ } m_cmbMediaInfoSource.SetCurSel(m_setting.iMediaInfoSource); SetDlgItemText(IDC_STATIC_PLAYER_DESCRIPTION, m_setting.strPlayerDescription); + SetDlgItemText(IDC_EDIT_DEVICE_MUSIC, m_setting.strPlayerMusicLocation); + SetDlgItemText(IDC_EDIT_DEVICE_PLAYLIST, m_setting.strPlayerPlaylistLocation); + SetDlgItemText(IDC_EDIT_PLAYLIST_SOURCE, m_setting.strPlaylistSourceLocation); } } @@ -352,5 +374,3 @@ m_strIniFile = strIniFile; } }; -/** @} */ - Modified: trunk/pmplib/frontend/easypmp/win32gui/preference.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-02-10 15:23:26 UTC (rev 325) @@ -24,10 +24,6 @@ #pragma once -/** - * \addtogroup win32 - * @{ - */ class CEasyPMPSetting { public: int iDBProces; @@ -36,10 +32,13 @@ int iPlaylistProcess; BOOL bSearchMissing; BOOL bSkipMissing; - BOOL bJSPL; + CString strPlaylistSourceLocation; + BOOL bPlaylistSourceSubdirs; CString strPlayerLocation; CString strPlayerIdentifier; CString strPlayerDescription; + CString strPlayerMusicLocation; + CString strPlayerPlaylistLocation; BOOL bSaveLog; BOOL bSafelyRemove; int iCodePage; @@ -53,10 +52,13 @@ iPlaylistProcess = 2; bSearchMissing = TRUE; bSkipMissing = FALSE; - bJSPL = FALSE; - strPlayerLocation = _T(""); // Initialize empty. - strPlayerIdentifier = _T(""); // Initialize empty. - strPlayerDescription = _T(""); // Initialize empty. + strPlaylistSourceLocation = _T(""); // Initialize empty. + bPlaylistSourceSubdirs = FALSE; + strPlayerLocation = _T(""); // Initialize empty. + strPlayerIdentifier = _T(""); // Initialize empty. + strPlayerDescription = _T(""); // Initialize empty. + strPlayerMusicLocation = _T(""); + strPlayerPlaylistLocation = _T(""); bSaveLog = FALSE; bSafelyRemove = FALSE; iCodePage = CP_ACP; @@ -103,9 +105,12 @@ persistInt(iPlaylistProcess, _T("Playlist"), _T("Process"), szSettingFile, storing); persistBool(bSearchMissing, _T("Playlist"), _T("SearchMissing"), szSettingFile, storing); persistBool(bSkipMissing, _T("Playlist"), _T("SkipMissing"), szSettingFile, storing); - persistBool(bJSPL, _T("Playlist"), _T("JSPL"), szSettingFile, storing); + persistString(strPlaylistSourceLocation, _T("Playlist"), _T("SourceLocation"), szSettingFile, storing); + persistBool(bPlaylistSourceSubdirs, _T("Playlist"), _T("SourceSubdirs"), szSettingFile, storing); persistString(strPlayerLocation, _T("Player"), _T("Location"), szSettingFile, storing); persistString(strPlayerIdentifier, _T("Player"), _T("Identifier"), szSettingFile, storing); + persistString(strPlayerMusicLocation, _T("Player"), _T("MusicLocation"), szSettingFile, storing); + persistString(strPlayerPlaylistLocation, _T("Player"), _T("PlaylistLocation"), szSettingFile, storing); persistBool(bSafelyRemove, _T("General"), _T("SafelyRemove"), szSettingFile, storing); persistInt(iCodePage, _T("General"), _T("CodePage"), szSettingFile, storing); if (!storing) { @@ -206,9 +211,13 @@ strPlayerDescription += _T(" "); strPlayerDescription += A2CT(pmp->info.decl.mode); } + strPlayerMusicLocation = UCS2CT(pmp->info.path_to_music); + strPlayerPlaylistLocation = UCS2CT(pmp->info.path_to_playlist); } else { strPlayerIdentifier = _T(""); strPlayerDescription = _T(""); + strPlayerMusicLocation = _T(""); + strPlayerPlaylistLocation = _T(""); } } @@ -323,4 +332,3 @@ } }; -/** @} */ Modified: trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-02-10 15:23:26 UTC (rev 325) @@ -280,8 +280,17 @@ } if (m_preference.bSearchMissing) opt.verb |= MODE_PLAYLIST_FIND; if (m_preference.bSkipMissing) opt.verb |= MODE_PLAYLIST_SKIP; - if (m_preference.bJSPL) opt.verb |= MODE_PLAYLIST_JSPL; + if (opt.verb & MODE_PLAYLIST) { + opt.verb |= MODE_PLAYLIST_JSPL; + } + if (!m_preference.strPlaylistSourceLocation.IsEmpty()) { + opt.path_to_playlist_source = ucs2dup(T2CUCS(m_preference.strPlaylistSourceLocation)); + } + if (m_preference.bPlaylistSourceSubdirs) { + opt.subdir_playlist_source = 1; + } + // Set path to the root folder. m_preference.GetPathToPlayerRoot(str); ucs2cpy(opt.path_to_root, T2CUCS(str)); @@ -329,6 +338,14 @@ return 1; } + // Modify the default setting. + if (!m_preference.strPlayerMusicLocation.IsEmpty()) { + ucs2cpy(pmp->info.path_to_music, T2CUCS(m_preference.strPlayerMusicLocation)); + } + if (!m_preference.strPlayerPlaylistLocation.IsEmpty()) { + ucs2cpy(pmp->info.path_to_playlist, T2CUCS(m_preference.strPlayerPlaylistLocation)); + } + // Generate open flag. int openflag = 0; if (opt.verb & MODE_DATABASE) { Modified: trunk/pmplib/frontend/easypmp/win32gui/resource.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/resource.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/resource.h 2007-02-10 15:23:26 UTC (rev 325) @@ -31,6 +31,13 @@ #define IDC_STATIC_PLAYER_DESCRIPTION 1021 #define IDC_CHECK_DONT_CLOSE 1021 #define IDC_LIST_PROGRESS 1031 +#define IDC_EDIT_PLAYLIST_SOURCE 1033 +#define IDC_BUTTON_REFER_PLAYLIST_SOURCE 1034 +#define IDC_CHECK_PLAYLIST_SUBFOLDERS 1035 +#define IDC_EDIT_DEVICE_MUSIC 1036 +#define IDC_EDIT_DEVICE_PLAYLIST 1037 +#define IDC_BUTTON1 1038 +#define IDC_BUTTON_DEFAULT_PLAYLIST_SOURCE 1038 // Next default values for new objects // @@ -38,7 +45,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 205 #define _APS_NEXT_COMMAND_VALUE 32772 -#define _APS_NEXT_CONTROL_VALUE 1033 +#define _APS_NEXT_CONTROL_VALUE 1039 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif Modified: trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-02-10 15:23:26 UTC (rev 325) @@ -34,6 +34,7 @@ #include <easypmp.h> #include "ejectdevice.h" +#include "folderdialog.h" #include "progress_with_caption.h" #include "preference.h" #include "processingdlg.h" Modified: trunk/pmplib/lib/playlist/contrib/js/jsapi.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jsapi.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jsapi.h 2007-02-10 15:23:26 UTC (rev 325) @@ -135,6 +135,19 @@ #define JSFUN_FLAGS_MASK 0xf8 /* overlay JSFUN_* attributes */ /* + * Re-use JSFUN_LAMBDA, which applies only to scripted functions, for use in + * JSFunctionSpec arrays that specify generic native prototype methods, i.e., + * methods of a class prototype that are exposed as static methods taking an + * extra leading argument: the generic |this| parameter. + * + * If you set this flag in a JSFunctionSpec struct's flags initializer, then + * that struct must live at least as long as the native static method object + * created due to this flag by JS_DefineFunctions or JS_InitClass. Typically + * JSFunctionSpec structs are allocated in static arrays. + */ +#define JSFUN_GENERIC_NATIVE JSFUN_LAMBDA + +/* * Well-known JS values. The extern'd variables are initialized when the * first JSContext is created by JS_NewContext (see below). */ @@ -437,10 +450,26 @@ #define JSOPTION_PRIVATE_IS_NSISUPPORTS \ JS_BIT(3) /* context private data points to an nsISupports subclass */ -#define JSOPTION_COMPILE_N_GO JS_BIT(4) /* one-shot compile+execute, - enables compile-time scope - chain resolution of consts - in many cases, e.g. */ +#define JSOPTION_COMPILE_N_GO JS_BIT(4) /* caller of JS_Compile*Script + promises to execute compiled + script once only; enables + compile-time scope chain + resolution of consts. */ +#define JSOPTION_ATLINE JS_BIT(5) /* //@line number ["filename"] + option supported for the + XUL preprocessor and kindred + beasts. */ +#define JSOPTION_XML JS_BIT(6) /* EMCAScript for XML support: + parse <!-- --> as a token, + not backward compatible with + the comment-hiding hack used + in HTML script tags. */ +#define JSOPTION_NATIVE_BRANCH_CALLBACK \ + JS_BIT(7) /* the branch callback set by + JS_SetBranchCallback may be + called with a null script + parameter, by native code + that loops intensively */ extern JS_PUBLIC_API(uint32) JS_GetOptions(JSContext *cx); @@ -490,6 +519,15 @@ extern JS_PUBLIC_API(JSBool) JS_EnumerateStandardClasses(JSContext *cx, JSObject *obj); +/* + * Enumerate any already-resolved standard class ids into ida, or into a new + * JSIdArray if ida is null. Return the augmented array on success, null on + * failure with ida (if it was non-null on entry) destroyed. + */ +extern JS_PUBLIC_API(JSIdArray *) +JS_EnumerateResolvedStandardClasses(JSContext *cx, JSObject *obj, + JSIdArray *ida); + extern JS_PUBLIC_API(JSObject *) JS_GetScopeChain(JSContext *cx); @@ -562,13 +600,67 @@ * JS_GC entry point clears them for the context on which GC is being forced. * Embeddings may need to do likewise for all contexts. * - * XXXbe See bug 40757 (http://bugzilla.mozilla.org/show_bug.cgi?id=40757), - * which proposes switching (with an #ifdef, alas, if we want to maintain API - * compatibility) to a JNI-like extensible local root frame stack model. + * See the scoped local root API immediately below for a better way to manage + * newborns in cases where native hooks (functions, getters, setters, etc.) + * create many GC-things, potentially without connecting them to predefined + * local roots such as *rval or argv[i] in an active native function. Using + * JS_EnterLocalRootScope disables updating of the context's per-gc-thing-type + * newborn roots, until control flow unwinds and leaves the outermost nesting + * local root scope. */ extern JS_PUBLIC_API(void) JS_ClearNewbornRoots(JSContext *cx); +/* + * Scoped local root management allows native functions, getter/setters, etc. + * to avoid worrying about the newborn root pigeon-holes, overloading local + * roots allocated in argv and *rval, or ending up having to call JS_Add*Root + * and JS_RemoveRoot to manage global roots temporarily. + * + * Instead, calling JS_EnterLocalRootScope and JS_LeaveLocalRootScope around + * the body of the native hook causes the engine to allocate a local root for + * each newborn created in between the two API calls, using a local root stack + * associated with cx. For example: + * + * JSBool + * my_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) + * { + * JSBool ok; + * + * if (!JS_EnterLocalRootScope(cx)) + * return JS_FALSE; + * ok = my_GetPropertyBody(cx, obj, id, vp); + * JS_LeaveLocalRootScope(cx); + * return ok; + * } + * + * NB: JS_LeaveLocalRootScope must be called once for every prior successful + * call to JS_EnterLocalRootScope. If JS_EnterLocalRootScope fails, you must + * not make the matching JS_LeaveLocalRootScope call. + * + * In case a native hook allocates many objects or other GC-things, but the + * native protects some of those GC-things by storing them as property values + * in an object that is itself protected, the hook can call JS_ForgetLocalRoot + * to free the local root automatically pushed for the now-protected GC-thing. + * + * JS_ForgetLocalRoot works on any GC-thing allocated in the current local + * root scope, but it's more time-efficient when called on references to more + * recently created GC-things. Calling it successively on other than the most + * recently allocated GC-thing will tend to average the time inefficiency, and + * may risk O(n^2) growth rate, but in any event, you shouldn't allocate too + * many local roots if you can root as you go (build a tree of objects from + * the top down, forgetting each latest-allocated GC-thing immediately upon + * linking it to its parent). + */ +extern JS_PUBLIC_API(JSBool) +JS_EnterLocalRootScope(JSContext *cx); + +extern JS_PUBLIC_API(void) +JS_LeaveLocalRootScope(JSContext *cx); + +extern JS_PUBLIC_API(void) +JS_ForgetLocalRoot(JSContext *cx, void *thing); + #ifdef DEBUG extern JS_PUBLIC_API(void) JS_DumpNamedRoots(JSRuntime *rt, @@ -647,8 +739,16 @@ extern JS_PUBLIC_API(JSBool) JS_IsAboutToBeFinalized(JSContext *cx, void *thing); +typedef enum JSGCParamKey { + JSGC_MAX_BYTES = 0, /* maximum nominal heap before last ditch GC */ + JSGC_MAX_MALLOC_BYTES = 1 /* # of JS_malloc bytes before last ditch GC */ +} JSGCParamKey; + +extern JS_PUBLIC_API(void) +JS_SetGCParameter(JSRuntime *rt, JSGCParamKey key, uint32 value); + /* - * Add an external string finalizer, one created by JS_NewExternalString (see + * Add a finalizer for external strings created by JS_NewExternalString (see * below) using a type-code returned from this function, and that understands * how to free or release the memory pointed at by JS_GetStringChars(str). * @@ -730,9 +830,21 @@ JSXDRObjectOp xdrObject; JSHasInstanceOp hasInstance; JSMarkOp mark; - jsword spare; + JSReserveSlotsOp reserveSlots; }; +struct JSExtendedClass { + JSClass base; + JSEqualityOp equality; + JSObjectOp outerObject; + JSObjectOp innerObject; + jsword reserved0; + jsword reserved1; + jsword reserved2; + jsword reserved3; + jsword reserved4; +}; + #define JSCLASS_HAS_PRIVATE (1<<0) /* objects have private slot */ #define JSCLASS_NEW_ENUMERATE (1<<1) /* has JSNewEnumerateOp hook */ #define JSCLASS_NEW_RESOLVE (1<<2) /* has JSNewResolveOp hook */ @@ -742,6 +854,9 @@ object in prototype chain passed in via *objp in/out parameter */ +#define JSCLASS_CONSTRUCT_PROTOTYPE (1<<6) /* call constructor on class + prototype */ +#define JSCLASS_DOCUMENT_OBSERVER (1<<7) /* DOM document observer */ /* * To reserve slots fetched and stored via JS_Get/SetReservedSlot, bitwise-or @@ -751,14 +866,21 @@ #define JSCLASS_RESERVED_SLOTS_SHIFT 8 /* room for 8 flags below */ #define JSCLASS_RESERVED_SLOTS_WIDTH 8 /* and 16 above this field */ #define JSCLASS_RESERVED_SLOTS_MASK JS_BITMASK(JSCLASS_RESERVED_SLOTS_WIDTH) -#define JSCLASS_HAS_RESERVED_SLOTS(n) (((n) & JSCLASS_RESERVED_SLOTS_MASK) \ +#define JSCLASS_HAS_RESERVED_SLOTS(n) (((n) & JSCLASS_RESERVED_SLOTS_MASK) \ << JSCLASS_RESERVED_SLOTS_SHIFT) #define JSCLASS_RESERVED_SLOTS(clasp) (((clasp)->flags \ - >> JSCLASS_RESERVED_SLOTS_SHIFT) \ + >> JSCLASS_RESERVED_SLOTS_SHIFT) \ & JSCLASS_RESERVED_SLOTS_MASK) +#define JSCLASS_HIGH_FLAGS_SHIFT (JSCLASS_RESERVED_SLOTS_SHIFT + \ + JSCLASS_RESERVED_SLOTS_WIDTH) + +/* True if JSClass is really a JSExtendedClass. */ +#define JSCLASS_IS_EXTENDED (1<<(JSCLASS_HIGH_FLAGS_SHIFT+0)) + /* Initializer for unused members of statically initialized JSClass structs. */ #define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,0,0,0 +#define JSCLASS_NO_RESERVED_MEMBERS 0,0,0,0,0 /* For detailed comments on these function pointer types, see jspubtd.h. */ struct JSObjectOps { @@ -791,6 +913,15 @@ JSSetRequiredSlotOp setRequiredSlot; }; +struct JSXMLObjectOps { + JSObjectOps base; + JSGetMethodOp getMethod; + JSSetMethodOp setMethod; + JSEnumerateValuesOp enumerateValues; + JSEqualityOp equality; + JSConcatenateOp concatenate; +}; + /* * Classes that expose JSObjectOps via a non-null getObjectOps class hook may * derive a property structure from this struct, return a pointer to it from @@ -819,8 +950,21 @@ extern JS_PUBLIC_API(JSBool) JS_IdToValue(JSContext *cx, jsid id, jsval *vp); +/* + * The magic XML namespace id is int-tagged, but not a valid integer jsval. + * Global object classes in embeddings that enable JS_HAS_XML_SUPPORT (E4X) + * should handle this id specially before converting id via JSVAL_TO_INT. + */ +#define JS_DEFAULT_XML_NAMESPACE_ID ((jsid) JSVAL_VOID) + +/* + * JSNewResolveOp flag bits. + */ #define JSRESOLVE_QUALIFIED 0x01 /* resolve a qualified property id */ #define JSRESOLVE_ASSIGNING 0x02 /* resolve on the left of assignment */ +#define JSRESOLVE_DETECTING 0x04 /* 'if (o.p)...' or '(o.p) ?...:...' */ +#define JSRESOLVE_DECLARING 0x08 /* var, const, or function prolog op */ +#define JSRESOLVE_CLASSNAME 0x10 /* class name used when constructing */ extern JS_PUBLIC_API(JSBool) JS_PropertyStub(JSContext *cx, JSObject *obj, jsval id, jsval *vp); @@ -886,6 +1030,9 @@ extern JS_PUBLIC_API(JSBool) JS_InstanceOf(JSContext *cx, JSObject *obj, JSClass *clasp, jsval *argv); +extern JS_PUBLIC_API(JSBool) +JS_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp); + extern JS_PUBLIC_API(void *) JS_GetPrivate(JSContext *cx, JSObject *obj); @@ -958,6 +1105,18 @@ uintN *attrsp, JSBool *foundp); /* + * The same, but if the property is native, return its getter and setter via + * *getterp and *setterp, respectively (and only if the out parameter pointer + * is not null). + */ +extern JS_PUBLIC_API(JSBool) +JS_GetPropertyAttrsGetterAndSetter(JSContext *cx, JSObject *obj, + const char *name, + uintN *attrsp, JSBool *foundp, + JSPropertyOp *getterp, + JSPropertyOp *setterp); + +/* * Set the attributes of a property on a given object. * * If the object does not have a property by that name, *foundp will be @@ -978,12 +1137,23 @@ const char *alias); extern JS_PUBLIC_API(JSBool) +JS_HasProperty(JSContext *cx, JSObject *obj, const char *name, JSBool *foundp); + +extern JS_PUBLIC_API(JSBool) JS_LookupProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp); extern JS_PUBLIC_API(JSBool) +JS_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, const char *name, + uintN flags, jsval *vp); + +extern JS_PUBLIC_API(JSBool) JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp); extern JS_PUBLIC_API(JSBool) +JS_GetMethod(JSContext *cx, JSObject *obj, const char *name, JSObject **objp, + jsval *vp); + +extern JS_PUBLIC_API(JSBool) JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp); extern JS_PUBLIC_API(JSBool) @@ -1011,6 +1181,18 @@ uintN *attrsp, JSBool *foundp); /* + * The same, but if the property is native, return its getter and setter via + * *getterp and *setterp, respectively (and only if the out parameter pointer + * is not null). + */ +extern JS_PUBLIC_API(JSBool) +JS_GetUCPropertyAttrsGetterAndSetter(JSContext *cx, JSObject *obj, + const jschar *name, size_t namelen, + uintN *attrsp, JSBool *foundp, + JSPropertyOp *getterp, + JSPropertyOp *setterp); + +/* * Set the attributes of a property on a given object. * * If the object does not have a property by that name, *foundp will be @@ -1030,6 +1212,11 @@ uintN attrs); extern JS_PUBLIC_API(JSBool) +JS_HasUCProperty(JSContext *cx, JSObject *obj, + const jschar *name, size_t namelen, + JSBool *vp); + +extern JS_PUBLIC_API(JSBool) JS_LookupUCProperty(JSContext *cx, JSObject *obj, const jschar *name, size_t namelen, jsval *vp); @@ -1072,6 +1259,9 @@ JS_AliasElement(JSContext *cx, JSObject *obj, const char *name, jsint alias); extern JS_PUBLIC_API(JSBool) +JS_HasElement(JSContext *cx, JSObject *obj, jsint index, JSBool *foundp); + +extern JS_PUBLIC_API(JSBool) JS_LookupElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp); extern JS_PUBLIC_API(JSBool) @@ -1092,7 +1282,23 @@ extern JS_PUBLIC_API(JSIdArray *) JS_Enumerate(JSContext *cx, JSObject *obj); +/* + * Create an object to iterate over enumerable properties of obj, in arbitrary + * property definition order. NB: This differs from longstanding for..in loop + * order, which uses order of property definition in obj. + */ +extern JS_PUBLIC_API(JSObject *) +JS_NewPropertyIterator(JSContext *cx, JSObject *obj); + +/* + * Return true on success with *idp containing the id of the next enumerable + * property to visit using iterobj, or JSVAL_VOID if there is no such property + * left to visit. Return false on error. + */ extern JS_PUBLIC_API(JSBool) +JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp); + +extern JS_PUBLIC_API(JSBool) JS_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode, jsval *vp, uintN *attrsp); @@ -1112,12 +1318,16 @@ */ struct JSPrincipals { char *codebase; + + /* XXX unspecified and unused by Mozilla code -- can we remove these? */ void * (* JS_DLL_CALLBACK getPrincipalArray)(JSContext *cx, JSPrincipals *); JSBool (* JS_DLL_CALLBACK globalPrivilegesEnabled)(JSContext *cx, JSPrincipals *); /* Don't call "destroy"; use reference counting macros below. */ jsrefcount refcount; - void (* JS_DLL_CALLBACK destroy)(JSContext *cx, struct JSPrincipals *); + + void (* JS_DLL_CALLBACK destroy)(JSContext *cx, JSPrincipals *); + JSBool (* JS_DLL_CALLBACK subsume)(JSPrincipals *, JSPrincipals *); }; #ifdef JS_THREADSAFE @@ -1142,7 +1352,7 @@ JS_SetPrincipalsTranscoder(JSRuntime *rt, JSPrincipalsTranscoder px); extern JS_PUBLIC_API(JSObjectPrincipalsFinder) -JS_SetObjectPrincipalsFinder(JSContext *cx, JSObjectPrincipalsFinder fop); +JS_SetObjectPrincipalsFinder(JSRuntime *rt, JSObjectPrincipalsFinder fop); /************************************************************************/ @@ -1183,6 +1393,12 @@ JS_GetFunctionFlags(JSFunction *fun); /* + * Return the arity (length) of fun. + */ +extern JS_PUBLIC_API(uint16) +JS_GetFunctionArity(JSFunction *fun); + +/* * Infallible predicate to test whether obj is a function object (faster than * comparing obj's class name to "Function", but equivalent unless someone has * overwritten the "Function" identifier with a different constructor and then @@ -1198,6 +1414,11 @@ JS_DefineFunction(JSContext *cx, JSObject *obj, const char *name, JSNative call, uintN nargs, uintN attrs); +extern JS_PUBLIC_API(JSFunction *) +JS_DefineUCFunction(JSContext *cx, JSObject *obj, + const jschar *name, size_t namelen, JSNative call, + uintN nargs, uintN attrs); + extern JS_PUBLIC_API(JSObject *) JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent); @@ -1543,6 +1764,44 @@ extern JS_PUBLIC_API(JSBool) JS_MakeStringImmutable(JSContext *cx, JSString *str); +/* + * Return JS_TRUE if C (char []) strings passed via the API and internally + * are UTF-8. The source must be compiled with JS_C_STRINGS_ARE_UTF8 defined + * to get UTF-8 support. + */ +JS_PUBLIC_API(JSBool) +JS_StringsAreUTF8(); + +/* + * Character encoding support. + * + * For both JS_EncodeCharacters and JS_DecodeBytes, set *dstlenp to the size + * of the destination buffer before the call; on return, *dstlenp contains the + * number of bytes (JS_EncodeCharacters) or jschars (JS_DecodeBytes) actually + * stored. To determine the necessary destination buffer size, make a sizing + * call that passes NULL for dst. + * + * On errors, the functions report the error. In that case, *dstlenp contains + * the number of characters or bytes transferred so far. If cx is NULL, no + * error is reported on failure, and the functions simply return JS_FALSE. + * + * NB: Neither function stores an additional zero byte or jschar after the + * transcoded string. + * + * If the source has been compiled with the #define JS_C_STRINGS_ARE_UTF8 to + * enable UTF-8 interpretation of C char[] strings, then JS_EncodeCharacters + * encodes to UTF-8, and JS_DecodeBytes decodes from UTF-8, which may create + * addititional errors if the character sequence is malformed. If UTF-8 + * support is disabled, the functions deflate and inflate, respectively. + */ +JS_PUBLIC_API(JSBool) +JS_EncodeCharacters(JSContext *cx, const jschar *src, size_t srclen, char *dst, + size_t *dstlenp); + +JS_PUBLIC_API(JSBool) +JS_DecodeBytes(JSContext *cx, const char *src, size_t srclen, jschar *dst, + size_t *dstlenp); + /************************************************************************/ /* @@ -1552,6 +1811,7 @@ JSLocaleToUpperCase localeToUpperCase; JSLocaleToLowerCase localeToLowerCase; JSLocaleCompare localeCompare; + JSLocaleToUnicode localeToUnicode; }; /* @@ -1697,6 +1957,9 @@ extern JS_PUBLIC_API(void) JS_ClearPendingException(JSContext *cx); +extern JS_PUBLIC_API(JSBool) +JS_ReportPendingException(JSContext *cx); + /* * Save the current exception state. This takes a snapshot of cx's current * exception state without making any change to that state. @@ -1727,6 +1990,14 @@ extern JS_PUBLIC_API(JSErrorReport *) JS_ErrorFromException(JSContext *cx, jsval v); +/* + * Given a reported error's message and JSErrorReport struct pointer, throw + * the corresponding exception on cx. + */ +extern JS_PUBLIC_API(JSBool) +JS_ThrowReportedError(JSContext *cx, const char *message, + JSErrorReport *reportp); + #ifdef JS_THREADSAFE /* @@ -1744,7 +2015,7 @@ extern JS_PUBLIC_API(jsword) JS_SetContextThread(JSContext *cx); -extern JS_PUBLIC_API(intN) +extern JS_PUBLIC_API(jsword) JS_ClearContextThread(JSContext *cx); #endif /* JS_THREADSAFE */ Modified: trunk/pmplib/lib/playlist/contrib/js/jscpucfg.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jscpucfg.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jscpucfg.h 2007-02-10 15:23:26 UTC (rev 325) @@ -42,54 +42,13 @@ #include "jsosdep.h" -#ifdef XP_MAC -#undef IS_LITTLE_ENDIAN -#define IS_BIG_ENDIAN 1 +#if defined(XP_WIN) || defined(XP_OS2) || defined(WINCE) -#define JS_BYTES_PER_BYTE 1L -#define JS_BYTES_PER_SHORT 2L -#define JS_BYTES_PER_INT 4L -#define JS_BYTES_PER_INT64 8L -#define JS_BYTES_PER_LONG 4L -#define JS_BYTES_PER_FLOAT 4L -#define JS_BYTES_PER_DOUBLE 8L -#define JS_BYTES_PER_WORD 4L -#define JS_BYTES_PER_DWORD 8L +#ifdef __WATCOMC__ +#define HAVE_VA_LIST_AS_ARRAY +#endif -#define JS_BITS_PER_BYTE 8L -#define JS_BITS_PER_SHORT 16L -#define JS_BITS_PER_INT 32L -#define JS_BITS_PER_INT64 64L -#define JS_BITS_PER_LONG 32L -#define JS_BITS_PER_FLOAT 32L -#define JS_BITS_PER_DOUBLE 64L -#define JS_BITS_PER_WORD 32L - -#define JS_BITS_PER_BYTE_LOG2 3L -#define JS_BITS_PER_SHORT_LOG2 4L -#define JS_BITS_PER_INT_LOG2 5L -#define JS_BITS_PER_INT64_LOG2 6L -#define JS_BITS_PER_LONG_LOG2 5L -#define JS_BITS_PER_FLOAT_LOG2 5L -#define JS_BITS_PER_DOUBLE_LOG2 6L -#define JS_BITS_PER_WORD_LOG2 5L - -#define JS_ALIGN_OF_SHORT 2L -#define JS_ALIGN_OF_INT 4L -#define JS_ALIGN_OF_LONG 4L -#define JS_ALIGN_OF_INT64 2L -#define JS_ALIGN_OF_FLOAT 4L -#define JS_ALIGN_OF_DOUBLE 4L -#define JS_ALIGN_OF_POINTER 4L -#define JS_ALIGN_OF_WORD 4L - -#define JS_BYTES_PER_WORD_LOG2 2L -#define JS_BYTES_PER_DWORD_LOG2 3L -#define PR_WORDS_PER_DWORD_LOG2 1L - -#elif defined(XP_WIN) || defined(XP_OS2) - -#if defined( _WIN32) || defined(XP_OS2) +#if defined(_WIN32) || defined(XP_OS2) || defined(WINCE) #define IS_LITTLE_ENDIAN 1 #undef IS_BIG_ENDIAN @@ -133,7 +92,7 @@ #define JS_BYTES_PER_WORD_LOG2 2L #define JS_BYTES_PER_DWORD_LOG2 3L #define PR_WORDS_PER_DWORD_LOG2 1L -#endif /* _WIN32 || XP_OS2 */ +#endif /* _WIN32 || XP_OS2 || WINCE*/ #if defined(_WINDOWS) && !defined(_WIN32) /* WIN16 */ #define IS_LITTLE_ENDIAN 1 @@ -189,7 +148,7 @@ #else -#error "Must define one of XP_BEOS, XP_MAC, XP_OS2, XP_WIN, or XP_UNIX" +#error "Must define one of XP_BEOS, XP_OS2, XP_WIN, or XP_UNIX" #endif Modified: trunk/pmplib/lib/playlist/contrib/js/jslong.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jslong.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jslong.h 2007-02-10 15:23:26 UTC (rev 325) @@ -185,7 +185,7 @@ /*********************************************************************** ** MACROS: JSLL_UDIVMOD ** DESCRIPTION: -** Produce both a quotient and a remainder given an unsigned +** Produce both a quotient and a remainder given an unsigned ** INPUTS: JSUint64 a: The dividend of the operation ** JSUint64 b: The quotient of the operation ** OUTPUTS: JSUint64 *qp: pointer to quotient Modified: trunk/pmplib/lib/playlist/contrib/js/jsosdep.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jsosdep.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jsosdep.h 2007-02-10 15:23:26 UTC (rev 325) @@ -52,21 +52,6 @@ #endif #endif /* XP_WIN || XP_OS2 */ -#ifdef XP_MAC -#define JS_HAVE_LONG_LONG - -JS_BEGIN_EXTERN_C - -#include <stddef.h> - -extern void* reallocSmaller(void* block, size_t newSize); - -extern char* strdup(const char* str); - -JS_END_EXTERN_C - -#endif /* XP_MAC */ - #ifdef XP_BEOS #define JS_HAVE_LONG_LONG #endif Modified: trunk/pmplib/lib/playlist/contrib/js/jsotypes.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jsotypes.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jsotypes.h 2007-02-10 15:23:26 UTC (rev 325) @@ -75,7 +75,7 @@ typedef JSUintn uintn; typedef JSUint64 uint64; -#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2) +#if !defined(_WIN32) && !defined(XP_OS2) typedef JSUint32 uint32; #else typedef unsigned long uint32; @@ -102,7 +102,7 @@ #ifdef HPUX #include <model.h> #else -#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2) +#if !defined(_WIN32) && !defined(XP_OS2) typedef JSInt32 int32; #else typedef long int32; @@ -112,14 +112,14 @@ #endif /* HPUX */ #endif /* AIX && HAVE_SYS_INTTYPES_H */ -#endif /* XP_BEOS */ +#endif /* XP_BEOS */ typedef JSFloat64 float64; /* Re: jsbit.h */ -#define TEST_BIT JS_TEST_BIT -#define SET_BIT JS_SET_BIT -#define CLEAR_BIT JS_CLEAR_BIT +#define TEST_BIT JS_TEST_BIT +#define SET_BIT JS_SET_BIT +#define CLEAR_BIT JS_CLEAR_BIT /* Re: prarena.h->plarena.h */ #define PRArena PLArena @@ -199,13 +199,4 @@ #define PR_CompareStrings PL_CompareStrings #define PR_CompareValues PL_CompareValues -#ifdef XP_MAC -#ifndef TRUE /* Mac standard is lower case true */ - #define TRUE 1 -#endif -#ifndef FALSE /* Mac standard is lower case false */ - #define FALSE 0 -#endif -#endif - #endif /* !defined(PROTYPES_H) */ Modified: trunk/pmplib/lib/playlist/contrib/js/jspubtd.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jspubtd.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jspubtd.h 2007-02-10 15:23:26 UTC (rev 325) @@ -69,6 +69,7 @@ JSVERSION_1_4 = 140, JSVERSION_ECMA_3 = 148, JSVERSION_1_5 = 150, + JSVERSION_1_6 = 160, JSVERSION_DEFAULT = 0, JSVERSION_UNKNOWN = -1 } JSVersion; @@ -84,6 +85,8 @@ JSTYPE_STRING, /* string */ JSTYPE_NUMBER, /* number */ JSTYPE_BOOLEAN, /* boolean */ + JSTYPE_NULL, /* null */ + JSTYPE_XML, /* xml object */ JSTYPE_LIMIT } JSType; @@ -112,6 +115,7 @@ /* Struct typedefs. */ typedef struct JSClass JSClass; +typedef struct JSExtendedClass JSExtendedClass; typedef struct JSConstDoubleSpec JSConstDoubleSpec; typedef struct JSContext JSContext; typedef struct JSErrorReport JSErrorReport; @@ -123,11 +127,12 @@ typedef struct JSObject JSObject; typedef struct JSObjectMap JSObjectMap; typedef struct JSObjectOps JSObjectOps; +typedef struct JSXMLObjectOps JSXMLObjectOps; typedef struct JSRuntime JSRuntime; -typedef struct JSRuntime JSTaskState; /* XXX deprecated name */ +typedef struct JSRuntime JSTaskState; /* XXX deprecated name */ typedef struct JSScript JSScript; typedef struct JSString JSString; -typedef struct JSXDRState JSXDRState; +typedef struct JSXDRState JSXDRState; typedef struct JSExceptionState JSExceptionState; typedef struct JSLocaleCallbacks JSLocaleCallbacks; @@ -203,6 +208,9 @@ * * JSRESOLVE_QUALIFIED a qualified property id: obj.id or obj[id], not id * JSRESOLVE_ASSIGNING obj[id] is on the left-hand side of an assignment + * JSRESOLVE_DETECTING 'if (o.p)...' or similar detection opcode sequence + * JSRESOLVE_DECLARING var, const, or function prolog declaration opcode + * JSRESOLVE_CLASSNAME class name used when constructing * * The *objp out parameter, on success, should be null to indicate that id * was not resolved; and non-null, referring to obj or one of its prototypes, @@ -263,12 +271,17 @@ * Thus JSClass (which pre-dates JSObjectOps in the API) provides a low-level * interface to class-specific code and data, while JSObjectOps allows for a * higher level of operation, which does not use the object's class except to - * find the class's JSObjectOps struct, by calling clasp->getObjectOps. + * find the class's JSObjectOps struct, by calling clasp->getObjectOps, and to + * finalize the object. * * If this seems backwards, that's because it is! API compatibility requires * a JSClass *clasp parameter to JS_NewObject, etc. Most host objects do not * need to implement the larger JSObjectOps, and can share the common JSScope * code and data used by the native (js_ObjectOps, see jsobj.c) ops. + * + * Further extension to preserve API compatibility: if this function returns + * a pointer to JSXMLObjectOps.base, not to JSObjectOps, then the engine calls + * extended hooks needed for E4X. */ typedef JSObjectOps * (* JS_DLL_CALLBACK JSGetObjectOps)(JSContext *cx, JSClass *clasp); @@ -326,6 +339,21 @@ typedef uint32 (* JS_DLL_CALLBACK JSMarkOp)(JSContext *cx, JSObject *obj, void *arg); +/* + * The optional JSClass.reserveSlots hook allows a class to make computed + * per-instance object slots reservations, in addition to or instead of using + * JSCLASS_HAS_RESERVED_SLOTS(n) in the JSClass.flags initializer to reserve + * a constant-per-class number of slots. Implementations of this hook should + * return the number of slots to reserve, not including any reserved by using + * JSCLASS_HAS_RESERVED_SLOTS(n) in JSClass.flags. + * + * NB: called with obj locked by the JSObjectOps-specific mutual exclusion + * mechanism appropriate for obj, so don't nest other operations that might + * also lock obj. + */ +typedef uint32 +(* JS_DLL_CALLBACK JSReserveSlotsOp)(JSContext *cx, JSObject *obj); + /* JSObjectOps function pointer typedefs. */ /* @@ -372,11 +400,7 @@ */ typedef JSBool (* JS_DLL_CALLBACK JSLookupPropOp)(JSContext *cx, JSObject *obj, jsid id, - JSObject **objp, JSProperty **propp -#if defined JS_THREADSAFE && defined DEBUG - , const char *file, uintN line -#endif - ); + JSObject **objp, JSProperty **propp); /* * Define obj[id], a direct property of obj named id, having the given initial @@ -472,10 +496,31 @@ (* JS_DLL_CALLBACK JSGetRequiredSlotOp)(JSContext *cx, JSObject *obj, uint32 slot); -typedef void +typedef JSBool (* JS_DLL_CALLBACK JSSetRequiredSlotOp)(JSContext *cx, JSObject *obj, uint32 slot, jsval v); +typedef JSObject * +(* JS_DLL_CALLBACK JSGetMethodOp)(JSContext *cx, JSObject *obj, jsid id, + jsval *vp); + +typedef JSBool +(* JS_DLL_CALLBACK JSSetMethodOp)(JSContext *cx, JSObject *obj, jsid id, + jsval *vp); + +typedef JSBool +(* JS_DLL_CALLBACK JSEnumerateValuesOp)(JSContext *cx, JSObject *obj, + JSIterateOp enum_op, + jsval *statep, jsid *idp, jsval *vp); + +typedef JSBool +(* JS_DLL_CALLBACK JSEqualityOp)(JSContext *cx, JSObject *obj, jsval v, + JSBool *bp); + +typedef JSBool +(* JS_DLL_CALLBACK JSConcatenateOp)(JSContext *cx, JSObject *obj, jsval v, + jsval *vp); + /* Typedef for native functions called by the JS VM. */ typedef JSBool @@ -502,13 +547,19 @@ JSErrorReport *report); typedef struct JSErrorFormatString { + /* The error format string (UTF-8 if JS_C_STRINGS_ARE_UTF8 is defined). */ const char *format; - uintN argCount; + + /* The number of arguments to expand in the formatted error message. */ + uint16 argCount; + + /* One of the JSExnType constants above. */ + int16 exnType; } JSErrorFormatString; typedef const JSErrorFormatString * (* JS_DLL_CALLBACK JSErrorCallback)(void *userRef, const char *locale, - const uintN errorNumber); + const uintN errorNumber); #ifdef va_start #define JS_ARGUMENT_FORMATTER_DEFINED 1 @@ -532,6 +583,9 @@ JSString *src1, JSString *src2, jsval *rval); +typedef JSBool +(* JS_DLL_CALLBACK JSLocaleToUnicode)(JSContext *cx, char *src, jsval *rval); + /* * Security protocol types. */ Modified: trunk/pmplib/lib/playlist/contrib/js/jstypes.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jstypes.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jstypes.h 2007-02-10 15:23:26 UTC (rev 325) @@ -107,22 +107,19 @@ #define JS_STATIC_DLL_CALLBACK(__x) __x JS_DLL_CALLBACK #endif /* _WINDLL */ -#elif defined(XP_MAC) -#define JS_EXTERN_API(__type) extern __declspec(export) __type -#define JS_EXPORT_API(__type) __declspec(export) __type -#define JS_EXTERN_DATA(__type) extern __declspec(export) __type -#define JS_EXPORT_DATA(__type) __declspec(export) __type +#else /* Unix */ -#define JS_DLL_CALLBACK -#define JS_STATIC_DLL_CALLBACK(__x) static __x +#ifdef HAVE_VISIBILITY_PRAGMA +#define JS_EXTERNAL_VIS __attribute__((visibility ("default"))) +#else +#define JS_EXTERNAL_VIS +#endif -#else /* Unix */ +#define JS_EXTERN_API(__type) extern JS_EXTERNAL_VIS __type +#define JS_EXPORT_API(__type) JS_EXTERNAL_VIS __type +#define JS_EXTERN_DATA(__type) extern JS_EXTERNAL_VIS __type +#define JS_EXPORT_DATA(__type) JS_EXTERNAL_VIS __type -#define JS_EXTERN_API(__type) extern __type -#define JS_EXPORT_API(__type) __type -#define JS_EXTERN_DATA(__type) extern __type -#define JS_EXPORT_DATA(__type) __type - #define JS_DLL_CALLBACK #define JS_STATIC_DLL_CALLBACK(__x) static __x @@ -141,7 +138,7 @@ #if defined(_WIN32) && !defined(__MWERKS__) # define JS_IMPORT_DATA(__x) __declspec(dllimport) __x #else -# define JS_IMPORT_DATA(__x) __x +# define JS_IMPORT_DATA(__x) JS_EXPORT_DATA (__x) #endif /* @@ -203,6 +200,19 @@ #define JS_BITMASK(n) (JS_BIT(n) - 1) /*********************************************************************** +** MACROS: JS_PTR_TO_INT32 +** JS_PTR_TO_UINT32 +** JS_INT32_TO_PTR +** JS_UINT32_TO_PTR +** DESCRIPTION: +** Integer to pointer and pointer to integer conversion macros. +***********************************************************************/ +#define JS_PTR_TO_INT32(x) ((jsint)((char *)(x) - (char *)0)) +#define JS_PTR_TO_UINT32(x) ((jsuint)((char *)(x) - (char *)0)) +#define JS_INT32_TO_PTR(x) ((void *)((char *)0 + (jsint)(x))) +#define JS_UINT32_TO_PTR(x) ((void *)((char *)0 + (jsuint)(x))) + +/*********************************************************************** ** MACROS: JS_HOWMANY ** JS_ROUNDUP ** JS_MIN @@ -215,13 +225,13 @@ #define JS_MIN(x,y) ((x)<(y)?(x):(y)) #define JS_MAX(x,y) ((x)>(y)?(x):(y)) -#if (defined(XP_MAC) || defined(XP_WIN)) && !defined(CROSS_COMPILE) +#if (defined(XP_WIN) && !defined(CROSS_COMPILE)) || defined (WINCE) # include "jscpucfg.h" /* Use standard Mac or Windows configuration */ #elif defined(XP_UNIX) || defined(XP_BEOS) || defined(XP_OS2) || defined(CROSS_COMPILE) # include "jsautocfg.h" /* Use auto-detected configuration */ # include "jsosdep.h" /* ...and platform-specific flags */ #else -# error "Must define one of XP_BEOS, XP_MAC, XP_OS2, XP_WIN or XP_UNIX" +# error "Must define one of XP_BEOS, XP_OS2, XP_WIN or XP_UNIX" #endif JS_BEGIN_EXTERN_C @@ -231,7 +241,7 @@ ** JSInt8 ** DESCRIPTION: ** The int8 types are known to be 8 bits each. There is no type that -** is equivalent to a plain "char". +** is equivalent to a plain "char". ************************************************************************/ #if JS_BYTES_PER_BYTE == 1 typedef unsigned char JSUint8; @@ -244,7 +254,7 @@ ** TYPES: JSUint16 ** JSInt16 ** DESCRIPTION: -** The int16 t... [truncated message content] |