Rewrote ConvertToStandardCommandArgs; resource.h correction; ntwxwin.mak

correction


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@822 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-10-14 08:13:09 +00:00
parent 0ed9fce61a
commit da36f5446f
6 changed files with 67 additions and 75 deletions

View File

@@ -262,7 +262,7 @@ Under Windows, OnEndSession is called in response to the WM\_ENDSESSION message.
\helpref{wxWindow::Close}{wxwindowclose},\rtfsp \helpref{wxWindow::Close}{wxwindowclose},\rtfsp
\helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp
\helpref{wxCloseEvent}{wxcloseevent},\rtfsp \helpref{wxCloseEvent}{wxcloseevent},\rtfsp
\helpref{wxApp::OnQueryEndSession}{wxappqueryonendsession} \helpref{wxApp::OnQueryEndSession}{wxapponqueryendsession}
\membersection{wxApp::OnInit}\label{wxapponinit} \membersection{wxApp::OnInit}\label{wxapponinit}

View File

@@ -25,8 +25,8 @@ This event applies to wxApp only.}
\helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp
\helpref{wxWindow::Close}{wxwindowclose},\rtfsp \helpref{wxWindow::Close}{wxwindowclose},\rtfsp
\helpref{wxApp::OnQueryEndSession}{wxappqueryendsession},\rtfsp \helpref{wxApp::OnQueryEndSession}{wxapponqueryendsession},\rtfsp
\helpref{wxApp::OnEndSession}{wxappendsession},\rtfsp \helpref{wxApp::OnEndSession}{wxapponendsession},\rtfsp
\helpref{Window deletion overview}{windowdeletionoverview} \helpref{Window deletion overview}{windowdeletionoverview}
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}

View File

@@ -171,7 +171,7 @@ extern wxMenuBar* WXDLLEXPORT wxResourceCreateMenuBar(const wxString& resource,
extern wxMenu* WXDLLEXPORT wxResourceCreateMenu(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL); extern wxMenu* WXDLLEXPORT wxResourceCreateMenu(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
extern bool WXDLLEXPORT wxResourceParseData(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL); extern bool WXDLLEXPORT wxResourceParseData(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
extern bool WXDLLEXPORT wxResourceParseFile(const wxString& filename, wxResourceTable *table = (wxResourceTable *) NULL); extern bool WXDLLEXPORT wxResourceParseFile(const wxString& filename, wxResourceTable *table = (wxResourceTable *) NULL);
extern bool WXDLLEXPORT wxResourceParseString(const wxString& s, wxResourceTable *table = (wxResourceTable *) NULL); extern bool WXDLLEXPORT wxResourceParseString(char* s, wxResourceTable *table = (wxResourceTable *) NULL);
extern void WXDLLEXPORT wxResourceClear(wxResourceTable *table = (wxResourceTable *) NULL); extern void WXDLLEXPORT wxResourceClear(wxResourceTable *table = (wxResourceTable *) NULL);
// Register XBM/XPM data // Register XBM/XPM data
extern bool WXDLLEXPORT wxResourceRegisterBitmapData(const wxString& name, char bits[], int width, int height, wxResourceTable *table = (wxResourceTable *) NULL); extern bool WXDLLEXPORT wxResourceRegisterBitmapData(const wxString& name, char bits[], int width, int height, wxResourceTable *table = (wxResourceTable *) NULL);

View File

@@ -344,87 +344,76 @@ bool wxApp::RegisterWindowClasses()
//// Convert Windows to argc, argv style //// Convert Windows to argc, argv style
// FIXME this code should be rewritten (use wxArrayString instead...)
void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine) void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine)
{ {
// Split command line into tokens, as in usual main(argc, argv) wxStringList args;
int para,count = 0;
char *buf = new char[strlen(lpCmdLine) + 1];
para=0; wxString cmdLine(lpCmdLine);
/* Model independent strcpy */ int count = 0;
unsigned int i;
for (i = 0; i<strlen(lpCmdLine); i++)
{
buf[i]=lpCmdLine[i];
if (isspace(lpCmdLine[i]))
para++;
}
buf[i]=0;
char **command = new char*[para+2];
// Get application name // Get application name
char name[260]; // 260 is MAX_PATH value from windef.h char name[500];
::GetModuleFileName(wxhInstance, name, WXSIZEOF(name)); ::GetModuleFileName(wxhInstance, name, WXSIZEOF(name));
// Is it only 16-bit Borland that already copies the program name // GNUWIN32 already fills in the first arg with the application name.
// to the first argv index?
#if !defined(__GNUWIN32__) #if !defined(__GNUWIN32__)
// #if ! (defined(__BORLANDC__) && !defined(__WIN32__)) args.Add(name);
command[count++] = copystring(name); count ++;
// #endif
#endif #endif
strcpy(name, wxFileNameFromPath(name)); strcpy(name, wxFileNameFromPath(name));
wxStripExtension(name); wxStripExtension(name);
wxTheApp->SetAppName(name); wxTheApp->SetAppName(name);
/* Break up string */ // Break up string
// Treat strings enclosed in double-quotes as single arguments // Treat strings enclosed in double-quotes as single arguments
char* str = buf; int i = 0;
while (*str) int len = cmdLine.Length();
while (i < len)
{ {
/* // Skip whitespace
if ( count == WXSIZEOF(command) ) while ((i < len) && isspace(cmdLine.GetChar(i)))
{ i ++;
wxFAIL_MSG("too many command line args.");
break;
}
*/
while ( *str && isspace(*str) ) // skip whitespace
str++;
if (*str == '"') if (i < len)
{ {
str++; if (cmdLine.GetChar(i) == '"') // We found the start of a string
command[count++] = str;
while (*str && *str != '"')
str++;
}
else if (*str)
{ {
command[count++] = str; i ++;
while (*str && !isspace(*str)) int first = i;
str++; while ((i < len) && (cmdLine.GetChar(i) != '"'))
i ++;
wxString arg(cmdLine.Mid(first, (i - first)));
args.Add(arg);
count ++;
if (i < len)
i ++; // Skip past 2nd quote
}
else // Unquoted argument
{
int first = i;
while ((i < len) && !isspace(cmdLine.GetChar(i)))
i ++;
wxString arg(cmdLine.Mid(first, (i - first)));
args.Add(arg);
count ++;
}
} }
if (*str)
*str++ = '\0';
} }
wxTheApp->argv = new char*[count + 1]; wxTheApp->argv = new char*[count + 1];
wxTheApp->argv[count] = NULL; /* argv[] is NULL terminated list! */
wxTheApp->argc = count;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
wxTheApp->argv[i] = copystring(command[i]); {
wxString arg(args[i]);
#if !defined(__GNUWIN32__) wxTheApp->argv[i] = copystring((const char*)arg);
// use copystring than delete this pointer }
delete [] command[0]; wxTheApp->argv[count] = NULL; // argv[] is a NULL-terminated list
#endif wxTheApp->argc = count;
delete [] command;
delete [] buf;
} }
//// Cleans up any wxWindows internal structures left lying around //// Cleans up any wxWindows internal structures left lying around
@@ -684,7 +673,7 @@ wxApp::~wxApp()
{ {
delete[] argv[i]; delete[] argv[i];
} }
delete argv; delete[] argv;
} }
bool wxApp::Initialized() bool wxApp::Initialized()

View File

@@ -1535,4 +1535,6 @@ $(WXDIR)\docs\ps\faq.ps: $(WXDIR)\docs\latex\faq\faq.dvi
move faq.ps $(WXDIR)\docs\ps\faq.ps move faq.ps $(WXDIR)\docs\ps\faq.ps
cd $(THISDIR) cd $(THISDIR)
# In order to force document reprocessing
touchmanual:
-touch $(WXDIR)\docs\latex\wx\manual.tex

View File

@@ -29,7 +29,8 @@ CPU=i386
OBJSUFF=obj OBJSUFF=obj
SRCSUFF=cpp SRCSUFF=cpp
WINFLAGS=-c -W3 -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1 -DWIN32 -D__WIN32__ $(WINVERSION) # If you set wxUSE_IOSTREAMH to 0, remove -Dtry=__try -Dexcept=__except -Dleave=__leave -Dfinally=__finally
WINFLAGS=-c -W3 -Dtry=__try -Dexcept=__except -Dleave=__leave -Dfinally=__finally -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1 -DWIN32 -D__WIN32__ $(WINVERSION)
#WINLINKFLAGS=/NODEFAULTLIB /INCREMENTAL:NO /NOLOGO -align:0x1000 -machine:$(CPU) -subsystem:windows,$(APPVER) #WINLINKFLAGS=/NODEFAULTLIB /INCREMENTAL:NO /NOLOGO -align:0x1000 -machine:$(CPU) -subsystem:windows,$(APPVER)
WINLINKFLAGS=/INCREMENTAL:NO /NOLOGO -align:0x1000 -machine:$(CPU) -subsystem:windows,$(APPVER) WINLINKFLAGS=/INCREMENTAL:NO /NOLOGO -align:0x1000 -machine:$(CPU) -subsystem:windows,$(APPVER)
#WINLIBS=kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib libc.lib oldnames.lib\ #WINLIBS=kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib libc.lib oldnames.lib\