From: Ryan Norton Date: Thu, 7 Oct 2004 08:53:48 +0000 (+0000) Subject: 2.5.3 - cleanups, fixes, etc. etc. - X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/dcb68102796280b3e54979ae95738089914ce842 2.5.3 - cleanups, fixes, etc. etc. - 1. Various stubs for wxCocoa (and the bakefile entries for them) 2. Definitions for some wxCocoa cocoa types in defs.h 3. Hack to attempt to fix SYNC sound for mac carbon 4. Fix for wxCocoa and 10.2 (Dave - I'm already around doing some stuff anyway - I'll go ahead and save you the trouble). 5. 10.2 unicode layer 6. Strings null-char fixes (stems from chartraits patch - essentially the patch minus the chartraits part - HAHA :)) [note to self - swap the 2nd and 3rd params of wxMemchr if you use chartraits and vice versa] * If you have time please run the strings and stdstrings cppunit test suite * Also add more test suites if you want - more is always better :) * This does not include any fixes for mbtowc etc functions as outlined on the ml 7. An attempt to update wxArray docs a little 8. wx/process.h build fix for wxCocoa 9. Unicode fixes in app.mm for wxCocoa 10. Remove newer font panel after Stefan's suggestion git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 0b70e561cc..19c0060111 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -1615,7 +1615,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/mac/carbon/dnd.cpp src/mac/carbon/filedlg.cpp src/mac/carbon/font.cpp - src/mac/carbon/fontdlg.mm + src/mac/carbon/fontdlg.cpp src/mac/carbon/fontenum.cpp src/mac/carbon/fontutil.cpp src/mac/carbon/frame.cpp @@ -1885,6 +1885,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/cocoa/checklst.mm src/cocoa/choice.mm src/cocoa/clipbrd.mm + src/cocoa/colordlg.mm src/cocoa/colour.mm src/cocoa/combobox.mm src/cocoa/control.mm @@ -1896,8 +1897,12 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/cocoa/dcmemory.mm src/cocoa/dcscreen.cpp src/cocoa/dialog.mm + src/cocoa/display.mm + src/cocoa/drawer.mm src/cocoa/evtloop.mm + src/cocoa/filedlg.mm src/cocoa/font.cpp + src/cocoa/fontdlg.mm src/cocoa/fontenum.mm src/cocoa/fontutil.cpp src/cocoa/frame.mm @@ -1910,6 +1915,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/cocoa/mdi.mm src/cocoa/menu.mm src/cocoa/menuitem.mm + src/cocoa/msgdlg.mm src/cocoa/notebook.mm src/cocoa/pen.mm src/cocoa/radiobox.mm @@ -1918,16 +1924,18 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/cocoa/scrolbar.mm src/cocoa/settings.cpp src/cocoa/slider.mm + src/cocoa/sound.mm src/cocoa/spinbutt.mm src/cocoa/statbmp.mm src/cocoa/statbox.mm src/cocoa/statline2.mm src/cocoa/stattext.mm + src/cocoa/taskbar.mm src/cocoa/textctrl.mm src/cocoa/toolbar.mm src/cocoa/toplevel.mm src/cocoa/utils.cpp - src/cocoa/utilsexc.cpp + src/cocoa/utilsexc.mm src/cocoa/window.mm src/generic/accel.cpp @@ -1973,6 +1981,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/cocoa/checklst.h wx/cocoa/choice.h wx/cocoa/clipbrd.h + wx/cocoa/colordlg.h wx/cocoa/colour.h wx/cocoa/combobox.h wx/cocoa/control.h @@ -1985,7 +1994,11 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/cocoa/dcmemory.h wx/cocoa/dcscreen.h wx/cocoa/dialog.h + wx/cocoa/display.h + wx/cocoa/drawer.h + wx/cocoa/filedlg.h wx/cocoa/font.h + wx/cocoa/fontdlg.h wx/cocoa/frame.h wx/cocoa/gauge.h wx/cocoa/gdiobj.h @@ -1996,6 +2009,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/cocoa/mdi.h wx/cocoa/menu.h wx/cocoa/menuitem.h + wx/cocoa/msgdlg.h wx/cocoa/notebook.h wx/cocoa/pen.h wx/cocoa/radiobox.h @@ -2003,11 +2017,13 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/cocoa/region.h wx/cocoa/scrolbar.h wx/cocoa/slider.h + wx/cocoa/sound.h wx/cocoa/spinbutt.h wx/cocoa/statbmp.h wx/cocoa/statbox.h wx/cocoa/statline.h wx/cocoa/stattext.h + wx/cocoa/taskbar.h wx/cocoa/textctrl.h wx/cocoa/toolbar.h wx/cocoa/toplevel.h diff --git a/docs/latex/wx/array.tex b/docs/latex/wx/array.tex index c576f7c0d0..dad60a8150 100644 --- a/docs/latex/wx/array.tex +++ b/docs/latex/wx/array.tex @@ -161,7 +161,29 @@ default for the array iterators by these macros only makes sense if the array element type is not a pointer itself and, although it still works, this provokes warnings from some compilers and to avoid them you should use the {\tt \_PTR} versions of the macros above. For example, to define an array of -pointers to {\tt double} you should use +pointers to {\tt double} you should use. + +If that isn't complicated enough, the above macros are generally only useful for +wxObject types. There are seperate macros for declaring an array of a simple type, +such as an int. + +The following simple types are supported: +int\\ +long\\ +size_t\\ +double + +To create an array of a simple type, simply append the type you want in CAPS to +the array definition. + +For example, for an integer array, you'd use one of the following variants: + +\helpref{WX\_DEFINE\_ARRAY\_INT}{wxdefinearray}\\ +\helpref{WX\_DEFINE\_EXPORTED\_ARRAY\_INT}{wxdefinearray}\\ +\helpref{WX\_DEFINE\_USER\_EXPORTED\_ARRAY\_INT}{wxdefinearray}\\ +\helpref{WX\_DEFINE\_SORTED\_ARRAY\_INT}{wxdefinesortedarray}\\ +\helpref{WX\_DEFINE\_SORTED\_EXPORTED\_ARRAY\_INT}{wxdefinesortedarray}\\ +\helpref{WX\_DEFINE\_SORTED\_USER\_EXPORTED\_ARRAY\_INT}{wxdefinesortedarray}\\ \begin{verbatim} WX_DEFINE_ARRAY_PTR(double *, MyArrayOfDoublePointers); @@ -255,7 +277,7 @@ needed for exporting an array from a user DLL. Example: \begin{verbatim} -WX_DEFINE_ARRAY(int, wxArrayInt); +WX_DEFINE_ARRAY_INT(wxArrayInt); class MyClass; WX_DEFINE_ARRAY(MyClass *, wxArrayOfMyClass); @@ -280,7 +302,7 @@ needed for exporting an array from a user DLL. Example: \begin{verbatim} -WX_DEFINE_SORTED_ARRAY(int, wxSortedArrayInt); +WX_DEFINE_SORTED_ARRAY_INT(wxSortedArrayInt); class MyClass; WX_DEFINE_SORTED_ARRAY(MyClass *, wxArrayOfMyClass); diff --git a/include/wx/cocoa/colordlg.h b/include/wx/cocoa/colordlg.h new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/include/wx/cocoa/colordlg.h @@ -0,0 +1 @@ + diff --git a/include/wx/cocoa/display.h b/include/wx/cocoa/display.h new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/include/wx/cocoa/display.h @@ -0,0 +1 @@ + diff --git a/include/wx/cocoa/drawer.h b/include/wx/cocoa/drawer.h new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/include/wx/cocoa/drawer.h @@ -0,0 +1 @@ + diff --git a/include/wx/cocoa/filedlg.h b/include/wx/cocoa/filedlg.h new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/include/wx/cocoa/filedlg.h @@ -0,0 +1 @@ + diff --git a/include/wx/cocoa/fontdlg.h b/include/wx/cocoa/fontdlg.h new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/include/wx/cocoa/fontdlg.h @@ -0,0 +1 @@ + diff --git a/include/wx/cocoa/msgdlg.h b/include/wx/cocoa/msgdlg.h new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/include/wx/cocoa/msgdlg.h @@ -0,0 +1 @@ + diff --git a/include/wx/cocoa/sound.h b/include/wx/cocoa/sound.h new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/include/wx/cocoa/sound.h @@ -0,0 +1 @@ + diff --git a/include/wx/cocoa/taskbar.h b/include/wx/cocoa/taskbar.h new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/include/wx/cocoa/taskbar.h @@ -0,0 +1 @@ + diff --git a/include/wx/defs.h b/include/wx/defs.h index 59d8729291..ea65618572 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -2248,16 +2248,23 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep); DECLARE_WXCOCOA_OBJC_CLASS(NSBox); DECLARE_WXCOCOA_OBJC_CLASS(NSButton); DECLARE_WXCOCOA_OBJC_CLASS(NSColor); +DECLARE_WXCOCOA_OBJC_CLASS(NSColorPanel); DECLARE_WXCOCOA_OBJC_CLASS(NSControl); +DECLARE_WXCOCOA_OBJC_CLASS(NSCursor); DECLARE_WXCOCOA_OBJC_CLASS(NSEvent); +DECLARE_WXCOCOA_OBJC_CLASS(NSFontPanel); DECLARE_WXCOCOA_OBJC_CLASS(NSImage); DECLARE_WXCOCOA_OBJC_CLASS(NSLayoutManager); DECLARE_WXCOCOA_OBJC_CLASS(NSMenu); +DECLARE_WXCOCOA_OBJC_CLASS(NSMenuExtra); DECLARE_WXCOCOA_OBJC_CLASS(NSMenuItem); DECLARE_WXCOCOA_OBJC_CLASS(NSMutableArray); DECLARE_WXCOCOA_OBJC_CLASS(NSNotification); +DECLARE_WXCOCOA_OBJC_CLASS(NSObject); DECLARE_WXCOCOA_OBJC_CLASS(NSPanel); DECLARE_WXCOCOA_OBJC_CLASS(NSScrollView); +DECLARE_WXCOCOA_OBJC_CLASS(NSSound); +DECLARE_WXCOCOA_OBJC_CLASS(NSStatusItem); DECLARE_WXCOCOA_OBJC_CLASS(NSTableColumn); DECLARE_WXCOCOA_OBJC_CLASS(NSTableView); DECLARE_WXCOCOA_OBJC_CLASS(NSTextContainer); diff --git a/include/wx/process.h b/include/wx/process.h index 10d830890f..adefc2620a 100644 --- a/include/wx/process.h +++ b/include/wx/process.h @@ -59,8 +59,8 @@ public: // ctors - wxProcess(wxEvtHandler *parent = (wxEvtHandler *) NULL, int id = wxID_ANY) - { Init(parent, id, wxPROCESS_DEFAULT); } + wxProcess(wxEvtHandler *parent = (wxEvtHandler *) NULL, int nId = wxID_ANY) + { Init(parent, nId, wxPROCESS_DEFAULT); } wxProcess(int flags) { Init(NULL, wxID_ANY, flags); } @@ -142,7 +142,7 @@ END_DECLARE_EVENT_TYPES() class WXDLLIMPEXP_BASE wxProcessEvent : public wxEvent { public: - wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0) : wxEvent(id) + wxProcessEvent(int nId = 0, int pid = 0, int exitcode = 0) : wxEvent(nId) { m_eventType = wxEVT_END_PROCESS; m_pid = pid; diff --git a/include/wx/string.h b/include/wx/string.h index 6758399c79..f2ba5dfa68 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -572,17 +572,15 @@ public: // All compare functions return -1, 0 or 1 if the [sub]string is less, // equal or greater than the compare() argument. - // just like strcmp() - int compare(const wxStringBase& str) const - { return wxStrcmp(c_str(), str.c_str()); } + // comparison with another string + int compare(const wxStringBase& str) const; // comparison with a substring int compare(size_t nStart, size_t nLen, const wxStringBase& str) const; // comparison of 2 substrings int compare(size_t nStart, size_t nLen, const wxStringBase& str, size_t nStart2, size_t nLen2) const; - // just like strcmp() - int compare(const wxChar* sz) const - { return wxStrcmp(c_str(), sz); } + // comparison with a c string + int compare(const wxChar* sz) const; // substring comparison with first nCount characters of sz int compare(size_t nStart, size_t nLen, const wxChar* sz, size_t nCount = npos) const; @@ -971,9 +969,11 @@ public: // string comparison // case-sensitive comparison (returns a value < 0, = 0 or > 0) - int Cmp(const wxChar *psz) const { return wxStrcmp(c_str(), psz); } + int Cmp(const wxChar *psz) const; + int Cmp(const wxString& s) const; // same as Cmp() but not case-sensitive - int CmpNoCase(const wxChar *psz) const { return wxStricmp(c_str(), psz); } + int CmpNoCase(const wxChar *psz) const; + int CmpNoCase(const wxString& s) const; // test for the string equality, either considering case or not // (if compareWithCase then the case matters) bool IsSameAs(const wxChar *psz, bool compareWithCase = true) const diff --git a/include/wx/wxchar.h b/include/wx/wxchar.h index d42b7701ab..515d80ddfe 100644 --- a/include/wx/wxchar.h +++ b/include/wx/wxchar.h @@ -361,7 +361,52 @@ #define wxAsctime _tasctime #define wxCtime _tctime #else /* !TCHAR-aware compilers */ - #if wxUSE_UNICODE + + /* No UNICODE in the c library except wchar_t typedef on mac OSX 10.2 and less - roll our own */ + #if wxUSE_UNICODE && __DARWIN__ && ( MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 ) && !defined(__MWERKS__) + + /* we need everything! */ + #define wxNEED_WX_STRING_H + #define wxNEED_WX_CTYPE_H + + #define wxFgetchar(c) wxFgetc(c, stdin) + #define wxFputc wxPutc + #define wxFputchar(c) wxPutc(c, stdout) + #define wxGetc wxFgetc + #define wxGetchar(c) wxFgetc(c, stdin) + + #include + + #define wxNEED_FGETC + #define wxNEED_FGETS + #define wxNEED_GETS + #define wxNEED_UNGETC + + #define wxNEED_FPUTS + #define wxNEED_PUTC + + int wxFputs(const wxChar *ch, FILE *stream); + int wxPutc(wxChar ch, FILE *stream); + + WXDLLIMPEXP_BASE size_t wxStrlen_(const wxChar *s); + + #define wxPutchar(wch) wxPutc(wch, stdout) + #define wxPuts(ws) wxFputs(ws, stdout) + + #define wxNEED_PRINTF_CONVERSION + #define wxNEED_WX_STDIO_H + #define wxNEED_WX_STDLIB_H + #define wxNEED_WX_TIME_H + + /* even though they are defined and "implemented", they are bad and just + stubs so we need our own */ + #define mbstowcs wxInternalMbstowcs + #define wcstombs wxInternalWcstombs + + WXDLLIMPEXP_BASE size_t wxInternalMbstowcs (wchar_t *, const char *, size_t); + WXDLLIMPEXP_BASE size_t wxInternalWcstombs (char *, const wchar_t *, size_t); + + #elif wxUSE_UNICODE #include /* this is probably glibc-specific */ @@ -817,7 +862,7 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */ /* ctype.h functions */ -/* VZ: note that this is never defined currently */ +/* RN: Used only under OSX <= 10.2 currently */ #ifdef wxNEED_WX_CTYPE_H WXDLLIMPEXP_BASE int wxIsalnum(wxChar ch); WXDLLIMPEXP_BASE int wxIsalpha(wxChar ch); @@ -874,7 +919,6 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */ #define wxIsctrl wxIscntrl /* string.h functions */ - #ifndef strdup #if defined(__MWERKS__) && !defined(__MACH__) && (__MSL__ < 0x00008000) #define wxNEED_STRDUP @@ -889,29 +933,28 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */ WXDLLIMPEXP_BASE char *strdup(const char* s); #endif -/* VZ: this is never defined neither currently */ +/* RN: Used only under OSX <= 10.2 currently */ #ifdef wxNEED_WX_STRING_H WXDLLIMPEXP_BASE wxChar * wxStrcat(wxChar *dest, const wxChar *src); WXDLLIMPEXP_BASE const wxChar * wxStrchr(const wxChar *s, wxChar c); - WXDLLIMPEXP_BASE wxChar * wxStrchr(wxChar *s, wxChar c) + inline wxChar * wxStrchr(wxChar *s, wxChar c) { return (wxChar *)wxStrchr((const wxChar *)s, c); } WXDLLIMPEXP_BASE int wxStrcmp(const wxChar *s1, const wxChar *s2); WXDLLIMPEXP_BASE int wxStrcoll(const wxChar *s1, const wxChar *s2); WXDLLIMPEXP_BASE wxChar * wxStrcpy(wxChar *dest, const wxChar *src); WXDLLIMPEXP_BASE size_t wxStrcspn(const wxChar *s, const wxChar *reject); - WXDLLIMPEXP_BASE size_t wxStrlen(const wxChar *s); WXDLLIMPEXP_BASE wxChar * wxStrncat(wxChar *dest, const wxChar *src, size_t n); WXDLLIMPEXP_BASE int wxStrncmp(const wxChar *s1, const wxChar *s2, size_t n); WXDLLIMPEXP_BASE wxChar * wxStrncpy(wxChar *dest, const wxChar *src, size_t n); WXDLLIMPEXP_BASE const wxChar * wxStrpbrk(const wxChar *s, const wxChar *accept); - WXDLLIMPEXP_BASE wxChar * wxStrpbrk(wxChar *s, const wxChar *accept) + inline wxChar * wxStrpbrk(wxChar *s, const wxChar *accept) { return (wxChar *)wxStrpbrk((const wxChar *)s, accept); } WXDLLIMPEXP_BASE const wxChar * wxStrrchr(const wxChar *s, wxChar c); - WXDLLIMPEXP_BASE wxChar * wxStrrchr(wxChar *s, wxChar c) + inline wxChar * wxStrrchr(wxChar *s, wxChar c) { return (wxChar *)wxStrrchr((const wxChar *)s, c); } WXDLLIMPEXP_BASE size_t wxStrspn(const wxChar *s, const wxChar *accept); WXDLLIMPEXP_BASE const wxChar * wxStrstr(const wxChar *haystack, const wxChar *needle); - WXDLLIMPEXP_BASE wxChar *wxStrstr(wxChar *haystack, const wxChar *needle) + inline wxChar *wxStrstr(wxChar *haystack, const wxChar *needle) { return (wxChar *)wxStrstr((const wxChar *)haystack, needle); } WXDLLIMPEXP_BASE double wxStrtod(const wxChar *nptr, wxChar **endptr); WXDLLIMPEXP_BASE long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base); @@ -1012,6 +1055,7 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #define wxWX2WC wxMB2WC #endif #else /* !wxUSE_UNICODE */ +#error ha /* No wxUSE_WCHAR_T: we have to do something (JACS) */ #define wxMB2WC wxStrncpy #define wxWC2MB wxStrncpy @@ -1021,5 +1065,75 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #define wxWX2WC wxMB2WC #endif +// +// RN: The following are not normal versions of memcpy et al., rather +// these are either char or widechar versions depending on +// if unicode is used or not. +// + +#ifdef __cplusplus + + // + // RN: We could do the usual tricky compiler detection here, + // and use their variant (such as wmemchr, etc.). The problem + // is that these functions are quite rare, even though they are + // part of the current POSIX standard. In addition, most compilers + // (including even MSC) inline them just like we do right in their + // headers. + // + #if wxUSE_UNICODE + #include //for mem funcs + + //implement our own wmem variants + inline wxChar* wxMemchr(const wxChar* s, wxChar c, size_t l) + { + for(;l && *s != c;--l, ++s) {} + + if(l) + return (wxChar*)s; + return NULL; + } + + inline int wxMemcmp(const wxChar* sz1, const wxChar* sz2, size_t len) + { + for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {} + + if(len) + return *sz1 < *sz2 ? -1 : *sz1 > *sz2; + else + return 0; + } + + inline wxChar* wxMemcpy(wxChar* szOut, const wxChar* szIn, size_t len) + { + return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar)); + } + + inline wxChar* wxMemmove(wxChar* szOut, const wxChar* szIn, size_t len) + { + return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar)); + } + + inline wxChar* wxMemset(wxChar* szOut, const wxChar cIn, size_t len) + { + wxChar* szRet = szOut; + + while (len--) + *szOut++ = cIn; + + return szRet; + } + + #else //!wxUSE_UNICODE + # define wxMemchr memchr + # define wxMemcmp memcmp + # define wxMemcpy memcpy + # define wxMemmove memmove + # define wxMemset memset + #endif + +#endif /*__cplusplus*/ + + #endif /* _WX_WXCHAR_H_ */ diff --git a/src/cocoa/app.mm b/src/cocoa/app.mm index f8f064934f..0d66e8f44a 100644 --- a/src/cocoa/app.mm +++ b/src/cocoa/app.mm @@ -6,13 +6,15 @@ // Created: 2002/11/27 // RCS-ID: $Id$ // Copyright: (c) David Elliott -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #include "wx/wxprec.h" #ifndef WX_PRECOMP #include "wx/defs.h" #include "wx/app.h" + #include "wx/frame.h" + #include "wx/dialog.h" #include "wx/dc.h" #include "wx/intl.h" #include "wx/log.h" @@ -23,7 +25,6 @@ #include "wx/cocoa/ObjcPose.h" #include "wx/cocoa/autorelease.h" #include "wx/cocoa/mbarman.h" -#include "wx/cocoa/NSApplication.h" #if wxUSE_WX_RESOURCES # include "wx/resource.h" @@ -31,11 +32,11 @@ #import #import +#import +#import #import #import #import -#import -#import // ======================================================================== // wxPoseAsInitializer @@ -70,45 +71,49 @@ WX_IMPLEMENT_POSER(wxPoserNSApplication); plan on stopping the event loop, it is wise to send an event through the queue to ensure this method will return. See wxEventLoop::Exit() for more information. + + RN: We used to use nil as the untilDate in previous versions since nil + is a shorter and more concise way of specifying an infinite amount of + time than [NSDate distantPast]. However, Apple neglects to mention in + their documentation that nil is not handled correctly in OSX 10.2 + (and possibly lower) and when the call is reached the system comes to + a screeching halt, therefore we need to specify [NSDate distantPast] + explicitly so that wxCocoa will work correctly in OSX 10.2. */ - (NSEvent *)nextEventMatchingMask:(unsigned int)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)flag { // Get the same events except don't block - NSEvent *event = [super nextEventMatchingMask:mask untilDate:nil/* equivalent to [NSDate distantPast] */ inMode:mode dequeue:flag]; + NSEvent *event = [super nextEventMatchingMask:mask untilDate:[NSDate distantPast] inMode:mode dequeue:flag]; // If we got one, simply return it if(event) return event; // No events, try doing some idle stuff - if(sg_needIdle -#ifdef __WXDEBUG__ - && !wxTheApp->IsInAssert() -#endif - && ([NSDefaultRunLoopMode isEqualToString:mode] || [NSModalPanelRunLoopMode isEqualToString:mode])) + if(sg_needIdle /*&& !wxTheApp->IsInAssert()*/ && ([NSDefaultRunLoopMode isEqualToString:mode] || [NSModalPanelRunLoopMode isEqualToString:mode])) { sg_needIdle = false; - wxLogTrace(wxTRACE_COCOA,wxT("Processing idle events")); + wxLogDebug(wxT("Processing idle events")); while(wxTheApp->ProcessIdle()) { // Get the same events except don't block - NSEvent *event = [super nextEventMatchingMask:mask untilDate:nil/* equivalent to [NSDate distantPast] */ inMode:mode dequeue:flag]; + NSEvent *event = [super nextEventMatchingMask:mask untilDate:[NSDate distantPast]/* equivalent to [NSDate distantPast] */ inMode:mode dequeue:flag]; // If we got one, simply return it if(event) return event; // we didn't get one, do some idle work - wxLogTrace(wxTRACE_COCOA,wxT("Looping idle events")); + wxLogDebug(wxT("Looping idle events")); } // No more idle work requested, block - wxLogTrace(wxTRACE_COCOA,wxT("Finished idle processing")); + wxLogDebug(wxT("Finished idle processing")); } else - wxLogTrace(wxTRACE_COCOA,wxT("Avoiding idle processing sg_needIdle=%d"),sg_needIdle); + wxLogDebug(wxT("Avoiding idle processing sg_needIdle=%d"),sg_needIdle); return [super nextEventMatchingMask:mask untilDate:expiration inMode:mode dequeue:flag]; } - (void)sendEvent: (NSEvent*)anEvent { - wxLogTrace(wxTRACE_COCOA,wxT("SendEvent")); + wxLogDebug(wxT("SendEvent")); sg_needIdle = true; [super sendEvent: anEvent]; } @@ -118,10 +123,22 @@ WX_IMPLEMENT_POSER(wxPoserNSApplication); // ======================================================================== // wxNSApplicationDelegate // ======================================================================== +@interface wxNSApplicationDelegate : NSObject +{ +} + +// Delegate methods +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication; +- (void)applicationWillBecomeActive:(NSNotification *)notification; +- (void)applicationDidBecomeActive:(NSNotification *)notification; +- (void)applicationWillResignActive:(NSNotification *)notification; +- (void)applicationDidResignActive:(NSNotification *)notification; +@end // interface wxNSApplicationDelegate : NSObject + @implementation wxNSApplicationDelegate : NSObject // NOTE: Terminate means that the event loop does NOT return and thus -// cleanup code doesn't properly execute. Furthermore, wxWidgets has its +// cleanup code doesn't properly execute. Furthermore, wxWindows has its // own exit on frame delete mechanism. - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication { @@ -148,11 +165,6 @@ WX_IMPLEMENT_POSER(wxPoserNSApplication); wxTheApp->CocoaDelegate_applicationDidResignActive(); } -- (void)controlTintChanged:(NSNotification *)notification -{ - wxLogDebug("TODO: send EVT_SYS_COLOUR_CHANGED as appropriate"); -} - @end // implementation wxNSApplicationDelegate : NSObject // ======================================================================== @@ -206,8 +218,6 @@ void wxApp::CleanUp() wxMenuBarManager::DestroyInstance(); [m_cocoaApp setDelegate:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:m_cocoaAppDelegate - name:NSControlTintDidChangeNotification object:nil]; [m_cocoaAppDelegate release]; m_cocoaAppDelegate = NULL; @@ -261,13 +271,11 @@ bool wxApp::OnInitGui() m_cocoaApp = [NSApplication sharedApplication]; m_cocoaAppDelegate = [[wxNSApplicationDelegate alloc] init]; [m_cocoaApp setDelegate:m_cocoaAppDelegate]; - [[NSNotificationCenter defaultCenter] addObserver:m_cocoaAppDelegate - selector:@selector(controlTintChanged:) - name:NSControlTintDidChangeNotification object:nil]; wxMenuBarManager::CreateInstance(); wxDC::CocoaInitializeTextSystem(); +// [ m_cocoaApp setDelegate:m_cocoaApp ]; return TRUE; } @@ -317,16 +325,12 @@ bool wxApp::Yield(bool onlyIfNeeded) s_inYield = true; // Run the event loop until it is out of events - while(1) - { - wxAutoNSAutoreleasePool pool; - NSEvent *event = [GetNSApplication() + while(NSEvent *event = [GetNSApplication() nextEventMatchingMask:NSAnyEventMask - untilDate:nil /* ==[NSDate distantPast] */ + untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode - dequeue: YES]; - if(!event) - break; + dequeue: YES]) + { [GetNSApplication() sendEvent: event]; } diff --git a/src/cocoa/colordlg.mm b/src/cocoa/colordlg.mm new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/src/cocoa/colordlg.mm @@ -0,0 +1 @@ + diff --git a/src/cocoa/display.mm b/src/cocoa/display.mm new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/src/cocoa/display.mm @@ -0,0 +1 @@ + diff --git a/src/cocoa/drawer.mm b/src/cocoa/drawer.mm new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/src/cocoa/drawer.mm @@ -0,0 +1 @@ + diff --git a/src/cocoa/filedlg.mm b/src/cocoa/filedlg.mm new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/src/cocoa/filedlg.mm @@ -0,0 +1 @@ + diff --git a/src/cocoa/fontdlg.mm b/src/cocoa/fontdlg.mm new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/src/cocoa/fontdlg.mm @@ -0,0 +1 @@ + diff --git a/src/cocoa/msgdlg.mm b/src/cocoa/msgdlg.mm new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/src/cocoa/msgdlg.mm @@ -0,0 +1 @@ + diff --git a/src/cocoa/sound.mm b/src/cocoa/sound.mm new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/src/cocoa/sound.mm @@ -0,0 +1 @@ + diff --git a/src/cocoa/taskbar.mm b/src/cocoa/taskbar.mm new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/src/cocoa/taskbar.mm @@ -0,0 +1 @@ + diff --git a/src/cocoa/utilsexc.mm b/src/cocoa/utilsexc.mm new file mode 100644 index 0000000000..7d01c682fc --- /dev/null +++ b/src/cocoa/utilsexc.mm @@ -0,0 +1,175 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: utilsexec.mm +// Purpose: Execution-related utilities for wxCocoa +// Author: Ryan Norton +// Modified by: +// Created: 2004-10-05 +// RCS-ID: $Id$ +// Copyright: (c) Ryan Norton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "wx/utils.h" + +#include "wx/process.h" +#include "wx/stream.h" + +#include "wx/cocoa/string.h" + +#import +#import + +class wxPipeInputStream : public wxInputStream +{ +public: + wxPipeInputStream(NSPipe* thePipe) : + m_thePipe(thePipe), + m_theHandle([m_thePipe fileHandleForReading]) + { + } + + ~wxPipeInputStream() + { + [m_thePipe release]; + } + +protected: + virtual size_t OnSysRead(void *buffer, size_t size) + { + NSData* theData = [m_theHandle readDataOfLength:size]; + memcpy(buffer, [theData bytes], [theData length]); + return [theData length]; + } + + + NSPipe* m_thePipe; + NSFileHandle* m_theHandle; +}; + +class wxPipeOutputStream : public wxOutputStream +{ +public: + wxPipeOutputStream(NSPipe* thePipe) : + m_thePipe(thePipe), + m_theHandle([m_thePipe fileHandleForWriting]) + { + } + + ~wxPipeOutputStream() + { + [m_thePipe release]; + } + +protected: + + virtual size_t OnSysWrite(const void *buffer, size_t bufsize) + { + NSData* theData = [NSData dataWithBytesNoCopy:(void*)buffer + length:bufsize]; + [m_theHandle writeData:theData]; + return bufsize; + } + + NSPipe* m_thePipe; + NSFileHandle* m_theHandle; +}; + +@interface wxTaskHandler : NSObject +{ + long m_pid; + void* m_handle; +} +-(id)init:(void*)handle processIdentifier:(long)pid; +- (void)termHandler:(NSNotification *)aNotification; +@end + +@implementation wxTaskHandler : NSObject + +-(id)init:(void*)handle processIdentifier:(long)pid +{ + self = [super init]; + + m_handle = handle; + m_pid = pid; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(termHandler:) + name:NSTaskDidTerminateNotification + object:nil]; + return self; +} + +- (void)termHandler:(NSNotification *)aNotification +{ + NSTask* theTask = [aNotification object]; + + if ([theTask processIdentifier] == m_pid) + { + ((wxProcess*)m_handle)->OnTerminate([theTask processIdentifier], + [theTask terminationStatus]); + + [self release]; + } +} + +@end + +long wxExecute(const wxString& command, + int sync = wxEXEC_ASYNC, + wxProcess *handle = NULL) +{ + NSTask* theTask = [[NSTask alloc] init]; + + if (handle && handle->IsRedirected()) + { + NSPipe* theStdinPipe = [[NSPipe alloc] init]; + NSPipe* theStderrPipe = [[NSPipe alloc] init]; + NSPipe* theStdoutPipe = [[NSPipe alloc] init]; + + [theTask setStandardInput:theStdinPipe]; + [theTask setStandardError:theStderrPipe]; + [theTask setStandardOutput:theStdoutPipe]; + + handle->SetPipeStreams(new wxPipeInputStream(theStdoutPipe), + new wxPipeOutputStream(theStdinPipe), + new wxPipeInputStream(theStderrPipe) ); + } + + NSArray* theQuoteArguments = + [wxNSStringWithWxString(command) componentsSeparatedByString:@"\""]; + + NSMutableArray* theSeperatedArguments = + [NSMutableArray arrayWithCapacity:10]; + + for (unsigned i = 0; i < [theQuoteArguments count]; ++i) + { + [theSeperatedArguments addObjectsFromArray: + [[theQuoteArguments objectAtIndex:i] componentsSeparatedByString:@" "] + ]; + + if(++i < [theQuoteArguments count]) + [theSeperatedArguments addObject:[theQuoteArguments objectAtIndex:i]]; + } + + [theTask setLaunchPath:[theSeperatedArguments objectAtIndex:0]]; + [theTask setArguments:theSeperatedArguments]; + [theTask launch]; + + if(sync & wxEXEC_ASYNC) + { + [[wxTaskHandler alloc]init:handle + processIdentifier:[theTask processIdentifier]]; + + return 0; + } + else + { + [theTask waitUntilExit]; + + return [theTask terminationStatus]; + } +} \ No newline at end of file diff --git a/src/cocoa/window.mm b/src/cocoa/window.mm index 666f6ba6a4..96e4777abe 100644 --- a/src/cocoa/window.mm +++ b/src/cocoa/window.mm @@ -884,7 +884,7 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y) } // Get the window with the focus -wxWindow *wxWindowBase::FindFocus() +wxWindow *wxWindowBase::DoFindFocus() { // TODO return NULL; diff --git a/src/common/string.cpp b/src/common/string.cpp index 07a532d180..5e14e76ff9 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -474,9 +474,27 @@ size_t wxStringBase::find(const wxStringBase& str, size_t nStart) const wxASSERT( str.GetStringData()->IsValid() ); wxASSERT( nStart <= length() ); - const wxChar *p = wxStrstr(c_str() + nStart, str.c_str()); + //anchor + const wxChar* p = wxMemchr(c_str() + nStart, + str.c_str()[0], + length() - nStart); + + if(!p) + return npos; + + while(p - c_str() + str.length() <= length() && + wxMemcmp(p, str.c_str(), str.length()) ) + { + //anchor again + p = wxMemchr(++p, + str.c_str()[0], + length() - (p - c_str())); - return p == NULL ? npos : p - c_str(); + if(!p) + return npos; + } + + return (p - c_str() + str.length() <= length()) ? p - c_str() : npos; } size_t wxStringBase::find(const wxChar* sz, size_t nStart, size_t n) const @@ -488,7 +506,7 @@ size_t wxStringBase::find(wxChar ch, size_t nStart) const { wxASSERT( nStart <= length() ); - const wxChar *p = wxStrchr(c_str() + nStart, ch); + const wxChar *p = wxMemchr(c_str() + nStart, ch, length() - nStart); return p == NULL ? npos : p - c_str(); } @@ -515,8 +533,8 @@ size_t wxStringBase::rfind(const wxStringBase& str, size_t nStart) const const wxChar *cursor = c_str() + top; do { - if ( memcmp(cursor, str.c_str(), - str.length() * sizeof(wxChar)) == 0 ) + if ( wxMemcmp(cursor, str.c_str(), + str.length()) == 0 ) { return cursor - c_str(); } @@ -555,12 +573,21 @@ size_t wxStringBase::rfind(wxChar ch, size_t nStart) const size_t wxStringBase::find_first_of(const wxChar* sz, size_t nStart) const { - const wxChar *start = c_str() + nStart; - const wxChar *firstOf = wxStrpbrk(start, sz); - if ( firstOf ) - return firstOf - c_str(); - else + wxASSERT(nStart <= length()); + + size_t len = wxStrlen(sz); + + size_t i; + for(i = nStart; i < this->length(); ++i) + { + if (wxMemchr(sz, *(c_str() + i), len)) + break; + } + + if(i == this->length()) return npos; + else + return i; } size_t wxStringBase::find_first_of(const wxChar* sz, size_t nStart, @@ -581,9 +608,11 @@ size_t wxStringBase::find_last_of(const wxChar* sz, size_t nStart) const _T("invalid index in find_last_of()") ); } + size_t len = wxStrlen(sz); + for ( const wxChar *p = c_str() + nStart; p >= c_str(); --p ) { - if ( wxStrchr(sz, *p) ) + if ( wxMemchr(sz, *p, len) ) return p - c_str(); } @@ -607,11 +636,19 @@ size_t wxStringBase::find_first_not_of(const wxChar* sz, size_t nStart) const wxASSERT( nStart <= length() ); } - size_t nAccept = wxStrspn(c_str() + nStart, sz); - if ( nAccept >= length() - nStart ) - return npos; - else - return nStart + nAccept; + size_t len = wxStrlen(sz); + + size_t i; + for(i = nStart; i < this->length(); ++i) + { + if (!wxMemchr(sz, *(c_str() + i), len)) + break; + } + + if(i == this->length()) + return npos; + else + return i; } size_t wxStringBase::find_first_not_of(const wxChar* sz, size_t nStart, @@ -644,10 +681,12 @@ size_t wxStringBase::find_last_not_of(const wxChar* sz, size_t nStart) const wxASSERT( nStart <= length() ); } + size_t len = wxStrlen(sz); + for ( const wxChar *p = c_str() + nStart; p >= c_str(); --p ) { - if ( !wxStrchr(sz, *p) ) - return p - c_str(); + if ( !wxMemchr(sz, *p,len) ) + return p - c_str(); } return npos; @@ -876,15 +915,15 @@ static inline int wxDoCmp(const wxChar* s1, size_t l1, const wxChar* s2, size_t l2) { if( l1 == l2 ) - return wxStrncmp(s1, s2, l1); + return wxMemcmp(s1, s2, l1); else if( l1 < l2 ) { - int ret = wxStrncmp(s1, s2, l1); + int ret = wxMemcmp(s1, s2, l1); return ret == 0 ? -1 : ret; } else if( l1 > l2 ) { - int ret = wxStrncmp(s1, s2, l2); + int ret = wxMemcmp(s1, s2, l2); return ret == 0 ? +1 : ret; } @@ -892,15 +931,11 @@ static inline int wxDoCmp(const wxChar* s1, size_t l1, return 0; // quiet compilers } -#if wxUSE_STL - int STRINGCLASS::compare(const wxStringBase& str) const { return ::wxDoCmp(data(), length(), str.data(), str.length()); } -#endif - int STRINGCLASS::compare(size_t nStart, size_t nLen, const wxStringBase& str) const { @@ -923,16 +958,12 @@ int STRINGCLASS::compare(size_t nStart, size_t nLen, return ::wxDoCmp(data() + nStart, nLen, str.data() + nStart2, nLen2); } -#if wxUSE_STL - int STRINGCLASS::compare(const wxChar* sz) const { size_t nLen = wxStrlen(sz); return ::wxDoCmp(data(), length(), sz, nLen); } -#endif - int STRINGCLASS::compare(size_t nStart, size_t nLen, const wxChar* sz, size_t nCount) const { @@ -1221,6 +1252,66 @@ wxString operator+(const wxChar *psz, const wxString& str) // other common string functions // =========================================================================== +int wxString::Cmp(const wxString& s) const +{ + return compare(s); +} + +int wxString::Cmp(const wxChar* psz) const +{ + return compare(psz); +} + +static inline int wxDoCmpNoCase(const wxChar* s1, size_t l1, + const wxChar* s2, size_t l2) +{ + size_t i; + + if( l1 == l2 ) + { + for(i = 0; i < l1; ++i) + { + if(wxTolower(s1[i]) != wxTolower(s2[i])) + break; + } + return i == l1 ? 0 : s1[i] < s2[i] ? -1 : 1; + } + else if( l1 < l2 ) + { + for(i = 0; i < l1; ++i) + { + if(wxTolower(s1[i]) != wxTolower(s2[i])) + break; + } + return i == l1 ? -1 : s1[i] < s2[i] ? -1 : 1; + } + else if( l1 > l2 ) + { + for(i = 0; i < l2; ++i) + { + if(wxTolower(s1[i]) != wxTolower(s2[i])) + break; + } + return i == l2 ? 1 : s1[i] < s2[i] ? -1 : 1; + } + + wxFAIL; // must never get there + return 0; // quiet compilers +} + +int wxString::CmpNoCase(const wxString& s) const +{ + return wxDoCmpNoCase(data(), length(), s.data(), s.length()); +} + +int wxString::CmpNoCase(const wxChar* psz) const +{ + int nLen = wxStrlen(psz); + + return wxDoCmpNoCase(data(), length(), psz, nLen); +} + + #if wxUSE_UNICODE #ifdef __MWERKS__ @@ -2176,7 +2267,7 @@ size_t wxArrayString::Add(const wxString& str, size_t nInsert) while ( lo < hi ) { i = (lo + hi)/2; - res = wxStrcmp(str, m_pItems[i]); + res = str.Cmp(m_pItems[i]); if ( res < 0 ) hi = i; else if ( res > 0 ) @@ -2345,7 +2436,7 @@ wxStringCompareFunction(const void *first, const void *second) } else { // maybe we should use wxStrcoll - int result = wxStrcmp(strFirst->c_str(), strSecond->c_str()); + int result = strFirst->Cmp(*strSecond); return gs_sortAscending ? result : -result; } @@ -2406,10 +2497,10 @@ bool wxArrayString::operator==(const wxArrayString& a) const int wxCMPFUNC_CONV wxStringSortAscending(wxString* s1, wxString* s2) { - return wxStrcmp(s1->c_str(), s2->c_str()); + return s1->Cmp(*s2); } int wxCMPFUNC_CONV wxStringSortDescending(wxString* s1, wxString* s2) { - return -wxStrcmp(s1->c_str(), s2->c_str()); + return -s1->Cmp(*s2); } diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index 6dfee33c81..42d9449b8b 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -1043,6 +1043,84 @@ WXDLLEXPORT int wxTolower(wxChar ch) { return (wxChar)CharLower((LPTSTR)(ch)); } WXDLLEXPORT int wxToupper(wxChar ch) { return (wxChar)CharUpper((LPTSTR)(ch)); } #endif +#if wxUSE_UNICODE && __DARWIN__ && ( MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 ) + +WXDLLEXPORT size_t wxInternalMbstowcs (wchar_t * out, const char * in, size_t outlen) +{ + if (!out) + { + size_t outsize = 0; + while(*in++) + outsize++; + return outsize; + } + + const char* origin = in; + + while (outlen-- && *in) + { + *out++ = (wchar_t) *in++; + } + + *out = '\0'; + + return in - origin; +} + +WXDLLEXPORT size_t wxInternalWcstombs (char * out, const wchar_t * in, size_t outlen) +{ + if (!out) + { + size_t outsize = 0; + while(*in++) + outsize++; + return outsize; + } + + const wchar_t* origin = in; + + while (outlen-- && *in) + { + *out++ = (char) *in++; + } + + *out = '\0'; + + return in - origin; +} + +#if defined(wxNEED_WX_CTYPE_H) + +#include + +CFCharacterSetRef cfalnumset = CFCharacterSetGetPredefined(kCFCharacterSetAlphaNumeric); +CFCharacterSetRef cfalphaset = CFCharacterSetGetPredefined(kCFCharacterSetLetter); +CFCharacterSetRef cfcntrlset = CFCharacterSetGetPredefined(kCFCharacterSetControl); +CFCharacterSetRef cfdigitset = CFCharacterSetGetPredefined(kCFCharacterSetDecimalDigit); +//CFCharacterSetRef cfgraphset = kCFCharacterSetControl && !' ' +CFCharacterSetRef cflowerset = CFCharacterSetGetPredefined(kCFCharacterSetLowercaseLetter); +//CFCharacterSetRef cfprintset = !kCFCharacterSetControl +CFCharacterSetRef cfpunctset = CFCharacterSetGetPredefined(kCFCharacterSetPunctuation); +CFCharacterSetRef cfspaceset = CFCharacterSetGetPredefined(kCFCharacterSetWhitespaceAndNewline); +CFCharacterSetRef cfupperset = CFCharacterSetGetPredefined(kCFCharacterSetUppercaseLetter); + +WXDLLEXPORT int wxIsalnum(wxChar ch) { return CFCharacterSetIsCharacterMember(cfalnumset, ch); } +WXDLLEXPORT int wxIsalpha(wxChar ch) { return CFCharacterSetIsCharacterMember(cfalphaset, ch); } +WXDLLEXPORT int wxIscntrl(wxChar ch) { return CFCharacterSetIsCharacterMember(cfcntrlset, ch); } +WXDLLEXPORT int wxIsdigit(wxChar ch) { return CFCharacterSetIsCharacterMember(cfdigitset, ch); } +WXDLLEXPORT int wxIsgraph(wxChar ch) { return !CFCharacterSetIsCharacterMember(cfcntrlset, ch) && ch != ' '; } +WXDLLEXPORT int wxIslower(wxChar ch) { return CFCharacterSetIsCharacterMember(cflowerset, ch); } +WXDLLEXPORT int wxIsprint(wxChar ch) { return !CFCharacterSetIsCharacterMember(cfcntrlset, ch); } +WXDLLEXPORT int wxIspunct(wxChar ch) { return CFCharacterSetIsCharacterMember(cfpunctset, ch); } +WXDLLEXPORT int wxIsspace(wxChar ch) { return CFCharacterSetIsCharacterMember(cfspaceset, ch); } +WXDLLEXPORT int wxIsupper(wxChar ch) { return CFCharacterSetIsCharacterMember(cfupperset, ch); } +WXDLLEXPORT int wxIsxdigit(wxChar ch) { return wxIsdigit(ch) || (ch>='a' && ch<='f') || (ch>='A' && ch<='F'); } +WXDLLEXPORT int wxTolower(wxChar ch) { return (wxChar)tolower((char)(ch)); } +WXDLLEXPORT int wxToupper(wxChar ch) { return (wxChar)toupper((char)(ch)); } +#endif + +#endif + #ifndef wxStrdupA WXDLLEXPORT char *wxStrdupA(const char *s) @@ -1139,6 +1217,16 @@ WXDLLEXPORT wxChar * wxStrcpy(wxChar *dest, const wxChar *src) return ret; } +WXDLLEXPORT size_t wxStrlen_(const wxChar *s) +{ + size_t n = 0; + while ( *s++ ) + n++; + + return n; +} + + WXDLLEXPORT wxChar * wxStrncat(wxChar *dest, const wxChar *src, size_t n) { wxChar *ret = dest; @@ -1196,7 +1284,7 @@ WXDLLEXPORT size_t wxStrspn(const wxChar *s, const wxChar *accept) WXDLLEXPORT const wxChar *wxStrstr(const wxChar *haystack, const wxChar *needle) { - wxCHECK_RET( needle, NULL, _T("NULL argument in wxStrstr") ); + wxASSERT_MSG( needle != NULL, _T("NULL argument in wxStrstr") ); // VZ: this is not exactly the most efficient string search algorithm... @@ -1259,7 +1347,7 @@ WXDLLEXPORT long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base) while ((wxIsdigit(*nptr) && (*nptr - wxT('0') < base)) || (wxIsalpha(*nptr) && (wxToupper(*nptr) - wxT('A') + 10 < base))) nptr++; - wxString data(nptr, nptr-start); + wxString data(start, nptr-start); wxWX2MBbuf dat = data.mb_str(wxConvLocal); char *rdat = wxMBSTRINGCAST dat; long int ret = strtol(dat, &rdat, base); @@ -1268,6 +1356,12 @@ WXDLLEXPORT long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base) return ret; } + +WXDLLEXPORT unsigned long int wxStrtoul(const wxChar *nptr, wxChar **endptr, int base) +{ + return (unsigned long int) wxStrtol(nptr, endptr, base); +} + #endif // wxNEED_WX_STRING_H #ifdef wxNEED_WX_STDIO_H @@ -1436,7 +1530,6 @@ char *strdup(const char *s) strcpy( dest , s ) ; return dest ; } - #endif // wxNEED_STRDUP #if defined(__WXWINCE__) && (_WIN32_WCE <= 211) diff --git a/src/mac/carbon/fontdlg.mm b/src/mac/carbon/fontdlg.mm deleted file mode 100644 index 408fa848bd..0000000000 --- a/src/mac/carbon/fontdlg.mm +++ /dev/null @@ -1,427 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: fontdlg.cpp -// Purpose: wxFontDialog class. -// Author: Ryan Norton -// Modified by: -// Created: 2004-10-03 -// RCS-ID: $Id$ -// Copyright: (c) Ryan Norton -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// =========================================================================== -// declarations -// =========================================================================== - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -#ifdef __GNUG__ -#pragma implementation "fontdlg.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/cmndata.h" - #include "wx/fontdlg.h" - #include "wx/fontutil.h" - #include "wx/log.h" -#endif - -#if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) -#endif - -// ============================================================================ -// implementation -// ============================================================================ - -//Mac OSX 10.2+ only -#if defined( __WXMAC_OSX__ ) && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 ) - -// Cocoa headers -#include "wx/cocoa/autorelease.h" -#include "wx/cocoa/string.h" - -#import -#import -#import -#import -#import - -// --------------------------------------------------------------------------- -// wxWCDelegate - Window Closed delegate -// --------------------------------------------------------------------------- - -@interface wxWCDelegate : NSObject -{ - bool m_bIsClosed; -} - -// Delegate methods -- (id)init; -- (BOOL)windowShouldClose:(id)sender; -- (BOOL)isClosed; -@end // interface wxNSFontPanelDelegate : NSObject - -@implementation wxWCDelegate : NSObject - -- (id)init -{ - [super init]; - m_bIsClosed = false; - - return self; -} - -- (BOOL)windowShouldClose:(id)sender -{ - m_bIsClosed = true; - - [NSApp abortModal]; - [NSApp stopModal]; - return YES; -} - -- (BOOL)isClosed -{ - return m_bIsClosed; -} - -@end // wxNSFontPanelDelegate - -// --------------------------------------------------------------------------- -// wxWCODelegate - Window Closed or Open delegate -// --------------------------------------------------------------------------- - -@interface wxWCODelegate : NSObject -{ - bool m_bIsClosed; - bool m_bIsOpen; -} - -// Delegate methods -- (id)init; -- (BOOL)windowShouldClose:(id)sender; -- (void)windowDidUpdate:(NSNotification *)aNotification; -- (BOOL)isClosed; -- (BOOL)isOpen; -@end // interface wxNSFontPanelDelegate : NSObject - -@implementation wxWCODelegate : NSObject - -- (id)init -{ - [super init]; - m_bIsClosed = false; - m_bIsOpen = false; - - return self; -} - -- (BOOL)windowShouldClose:(id)sender -{ - m_bIsClosed = true; - m_bIsOpen = false; - - [NSApp abortModal]; - [NSApp stopModal]; - return YES; -} - -- (void)windowDidUpdate:(NSNotification *)aNotification -{ - if (m_bIsOpen == NO) - { - m_bIsClosed = false; - m_bIsOpen = true; - - [NSApp abortModal]; - [NSApp stopModal]; - } -} - -- (BOOL)isClosed -{ - return m_bIsClosed; -} - -- (BOOL)isOpen -{ - return m_bIsOpen; -} - -@end // wxNSFontPanelDelegate - -// --------------------------------------------------------------------------- -// wxFontDialog -// --------------------------------------------------------------------------- - -wxFontDialog::wxFontDialog() -{ -} - -wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData& data) -{ - Create(parent, data); -} - -wxFontDialog::~wxFontDialog() -{ -} - -bool wxFontDialog::Create(wxWindow *parent, const wxFontData& data) -{ - m_fontData = data; - - // - // This is the key call - this initializes - // events and window stuff for cocoa for carbon - // applications. - // - // This is also the only call here that is - // 10.2+ specific (the rest is OSX only), - // which, ironically, the carbon font - // panel requires. - // - bool bOK = NSApplicationLoad(); - - //autorelease pool - req'd for carbon - NSAutoreleasePool *thePool; - thePool = [[NSAutoreleasePool alloc] init]; - - //Get the initial wx font - wxFont& thewxfont = m_fontData.m_initialFont; - - //if the font is valid set the default (selected) font of the - //NSFontDialog to that font - if (thewxfont.Ok()) - { - NSFontTraitMask theMask = 0; - - if(thewxfont.GetStyle() == wxFONTSTYLE_ITALIC) - theMask |= NSItalicFontMask; - - if(thewxfont.IsFixedWidth()) - theMask |= NSFixedPitchFontMask; - - NSFont* theDefaultFont = - [[NSFontManager sharedFontManager] fontWithFamily: - wxNSStringWithWxString(thewxfont.GetFaceName()) - traits:theMask - weight:thewxfont.GetWeight() == wxBOLD ? 9 : - thewxfont.GetWeight() == wxLIGHT ? 0 : 5 - size: (float)(thewxfont.GetPointSize()) - ]; - - wxASSERT_MSG(theDefaultFont, wxT("Invalid default font for wxCocoaFontDialog!")); - - //set the initial font of the NSFontPanel - //(the font manager calls the appropriate NSFontPanel method) - [[NSFontManager sharedFontManager] setSelectedFont:theDefaultFont isMultiple:NO]; - - } - - if([NSColorPanel sharedColorPanelExists] == NO) - { - //The color panel has an annoying tendancy to start - //out at a WHITE color - so when the user - //chooses his first font he would probably be in - //for an unpleasent surprise if we didn't setup - //the color panel to use black :) - [[NSColorPanel sharedColorPanel] setColor:[NSColor blackColor]]; - } - - //We're done - free up the pool - [thePool release]; - - return bOK; -} - -int wxFontDialog::ShowModal() -{ - //Start the pool. Required for carbon interaction - //(For those curious, the only thing that happens - //if you don't do this is a bunch of error - //messages about leaks on the console, - //with no windows shown or anything). - NSAutoreleasePool *thePool; - thePool = [[NSAutoreleasePool alloc] init]; - - //Get the shared color and font panel - NSFontPanel* theFontPanel = [NSFontPanel sharedFontPanel]; - NSColorPanel* theColorPanel = [NSColorPanel sharedColorPanel]; - - //Create and assign the delegates (cocoa event handlers) so - //we can tell if a window has closed/open or not - wxWCDelegate* theFPDelegate = [[wxWCDelegate alloc] init]; - [theFontPanel setDelegate:theFPDelegate]; - - wxWCODelegate* theCPDelegate = [[wxWCODelegate alloc] init]; - [theColorPanel setDelegate:theCPDelegate]; - - // - // Begin the modal loop for the font and color panels - // - // The idea is that we first make the font panel modal, - // but if the color panel is opened, unless we stop the - // modal loop the color panel opens behind the font panel - // with no input acceptable to it - which makes it useless. - // - // So we set up delegates for both the color and font panels, - // and the if the font panel opens the color panel, we - // stop the modal loop, and start a seperate modal loop for - // the color panel until the color panel closes, switching - // back to the font panel modal loop once it does close. - // - do - { - // - // Start the font panel modal loop - // - NSModalSession session = [NSApp beginModalSessionForWindow:theFontPanel]; - for (;;) - { - [NSApp runModalSession:session]; - - //If the font panel is closed or the font panel - //opened the color panel, break - if ([theFPDelegate isClosed] || [theCPDelegate isOpen]) - break; - } - [NSApp endModalSession:session]; - - //is the color panel open? - if ([theCPDelegate isOpen]) - { - // - // Start the color panel modal loop - // - NSModalSession session = [NSApp beginModalSessionForWindow:theColorPanel]; - for (;;) - { - [NSApp runModalSession:session]; - - //If the color panel is closed, return the font panel modal loop - if ([theCPDelegate isClosed]) - break; - } - [NSApp endModalSession:session]; - } - //If the font panel is still alive (I.E. we broke - //out of its modal loop because the color panel was - //opened) return the font panel modal loop - }while([theFPDelegate isClosed] == NO); - - //free up the memory for the delegates - we don't need them anymore - [theFPDelegate release]; - [theCPDelegate release]; - - //Get the font the user selected - NSFont* theFont = [theFontPanel panelConvertFont:[NSFont userFontOfSize:0]]; - - //Get more information about the user's chosen font - NSFontTraitMask theTraits = [[NSFontManager sharedFontManager] traitsOfFont:theFont]; - int theFontWeight = [[NSFontManager sharedFontManager] weightOfFont:theFont]; - int theFontSize = (int) [theFont pointSize]; - - //Set the wx font to the appropriate data - if(theTraits & NSFixedPitchFontMask) - m_fontData.m_chosenFont.SetFamily(wxTELETYPE); - - m_fontData.m_chosenFont.SetFaceName(wxStringWithNSString([theFont familyName])); - m_fontData.m_chosenFont.SetPointSize(theFontSize); - m_fontData.m_chosenFont.SetStyle(theTraits & NSItalicFontMask ? wxFONTSTYLE_ITALIC : 0); - m_fontData.m_chosenFont.SetWeight(theFontWeight < 5 ? wxLIGHT : - theFontWeight >= 9 ? wxBOLD : wxNORMAL); - - //Get the shared color panel along with the chosen color and set the chosen color - NSColor* theColor = [[theColorPanel color] colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; - - m_fontData.m_fontColour.Set((unsigned char) ([theColor redComponent] * 255.0), - (unsigned char) ([theColor greenComponent] * 255.0), - (unsigned char) ([theColor blueComponent] * 255.0)); - - //Friendly debug stuff -#ifdef FONTDLGDEBUG - wxPrintf(wxT("---Font Panel---\n--NS--\nSize:%f\nWeight:%i\nTraits:%i\n--WX--\nFaceName:%s\nPointSize:%i\nStyle:%i\nWeight:%i\nColor:%i,%i,%i\n---END Font Panel---\n"), - - (float) theFontSize, - theFontWeight, - theTraits, - - m_fontData.m_chosenFont.GetFaceName().c_str(), - m_fontData.m_chosenFont.GetPointSize(), - m_fontData.m_chosenFont.GetStyle(), - m_fontData.m_chosenFont.GetWeight(), - m_fontData.m_fontColour.Red(), - m_fontData.m_fontColour.Green(), - m_fontData.m_fontColour.Blue() ); -#endif - - //Release the pool, we're done :) - [thePool release]; - - //Return ID_OK - there are no "apply" buttons or the like - //on either the font or color panel - return wxID_OK; -} - -//old api stuff (REMOVE ME) -bool wxFontDialog::IsShown() const -{ - return false; -} - -#else - //10.2+ only - -// --------------------------------------------------------------------------- -// wxFontDialog stub for mac OS's without a native font dialog -// --------------------------------------------------------------------------- - -wxFontDialog::wxFontDialog() -{ - m_dialogParent = NULL; -} - -wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData& data) -{ - Create(parent, data); -} - -void wxFontDialog::SetData(wxFontData& fontdata) -{ - m_fontData = fontdata; -} - -bool wxFontDialog::Create(wxWindow *parent, const wxFontData& data) -{ - m_dialogParent = parent; - - m_fontData = data; - - // TODO: you may need to do dialog creation here, unless it's - // done in ShowModal. - return TRUE; -} - -bool wxFontDialog::IsShown() const -{ - return false; -} - -int wxFontDialog::ShowModal() -{ - // TODO: show (maybe create) the dialog - return wxID_CANCEL; -} - -#endif // 10.2+ diff --git a/src/mac/carbon/sound.cpp b/src/mac/carbon/sound.cpp index f165552bf8..af1144a5d7 100644 --- a/src/mac/carbon/sound.cpp +++ b/src/mac/carbon/sound.cpp @@ -474,8 +474,10 @@ bool wxSound::DoPlay(unsigned flags) const wxASSERT_MSG(!(flags & wxSOUND_LOOP), wxT("Can't loop and play syncronously at the same time")); //Play movie until it ends, then exit + //Note that due to quicktime caching this may not always + //work 100% correctly while (!IsMovieDone(movie)) - MoviesTask(movie, 0); + MoviesTask(movie, 1); DisposeMovie(movie); } diff --git a/tests/strings/stdstrings.cpp b/tests/strings/stdstrings.cpp index 5bdc4ac791..4548182651 100644 --- a/tests/strings/stdstrings.cpp +++ b/tests/strings/stdstrings.cpp @@ -208,6 +208,33 @@ void StdStringTestCase::StdFind() CPPUNIT_ASSERT( s1.find(s2) == 6u ); CPPUNIT_ASSERT( s1.find(s2, 7) == wxString::npos ); CPPUNIT_ASSERT( s1.find(s2, 6) == 6u ); + + // 0 1 2 + // 0123456 78901234567 8901234567 + //wxString _s1 = _T("abcdefg\0ABCDEFGabc\0ABCabcABC"); + //wxString _s2 = _T("g\0AB"); + wxString _s1 = _T("abcdefgABCDEFGabcABCabcABC"); + wxString _s2 = _T("gAB"); + + _s1.insert(7, 1, '\0'); + _s1.insert(18, 1, '\0'); + _s2.insert(1, 1, '\0'); + + CPPUNIT_ASSERT( _s1.find(_T('A')) == 8u ); + CPPUNIT_ASSERT( _s1.find(_T('A'), 8) == 8u ); + CPPUNIT_ASSERT( _s1.find(_T('Z')) == wxString::npos ); + CPPUNIT_ASSERT( _s1.find(_T('C'), 22) == 27u ); + + CPPUNIT_ASSERT( _s1.find(_T("AB")) == 8u ); + CPPUNIT_ASSERT( _s1.find(_T("AB"), 26) == wxString::npos ); + CPPUNIT_ASSERT( _s1.find(_T("AB"), 23) == 25u ); + + CPPUNIT_ASSERT( _s1.find(_T("ABZZZ"), 2, 2) == 8u ); + CPPUNIT_ASSERT( _s1.find(_T("ABZZZ"), 26, 2) == wxString::npos ); + + CPPUNIT_ASSERT( _s1.find(_s2) == 6u ); + CPPUNIT_ASSERT( _s1.find(_s2, 7) == wxString::npos ); + CPPUNIT_ASSERT( _s1.find(_s2, 6) == 6u ); } void StdStringTestCase::StdFindFirst() @@ -343,6 +370,28 @@ void StdStringTestCase::StdRFind() CPPUNIT_ASSERT( s1.rfind(s2, 5) == wxString::npos ); CPPUNIT_ASSERT( s1.rfind(s2, 6) == 6u ); CPPUNIT_ASSERT( s1.rfind(s3, 1) == 0u ); + + + // 0 1 2 + // 01234 56789012 345678901234567 +// wxString s1 = _T("abcde\0fgABCDE\0FGabcABCabcABC"); +// wxString s2 = _T("gAB"); +// wxString s3 = _T("ab"); + + s1.insert(5,1,'\0'); + s1.insert(13,1,'\0'); + + CPPUNIT_ASSERT( s1.rfind(_T('A')) == 25u ); + CPPUNIT_ASSERT( s1.rfind(_T('A'), 8) == 8u ); + CPPUNIT_ASSERT( s1.rfind(_T('Z')) == wxString::npos ); + CPPUNIT_ASSERT( s1.rfind(_T('C'), 22) == 21u ); + + CPPUNIT_ASSERT( s1.rfind(_T("cAB")) == 24u ); + CPPUNIT_ASSERT( s1.rfind(_T("cAB"), 15) == wxString::npos ); + CPPUNIT_ASSERT( s1.rfind(_T("cAB"), 21) == 18u ); + + CPPUNIT_ASSERT( s1.rfind(_T("gABZZZ"), 8, 3) == 7u ); + CPPUNIT_ASSERT( s1.rfind(_T("gABZZZ"), 5, 3) == wxString::npos ); } void StdStringTestCase::StdResize() @@ -370,5 +419,24 @@ void StdStringTestCase::StdSubstr() CPPUNIT_ASSERT( s1.substr( 1, 13 ) == _T("bcdefgABCDEFG") ); CPPUNIT_ASSERT( s1.substr( 1, 20 ) == _T("bcdefgABCDEFG") ); CPPUNIT_ASSERT( s1.substr( 14, 30 ) == _T("") ); + + +// 1 +// 012 34567 89012 3456 +// wxString s1 = _T("abc\0defg\0ABCD\0EFG"); + + s1.insert(3,1,'\0'); + s1.insert(8,1,'\0'); + s1.insert(13,1,'\0'); + + wxString s2 = wxT("bcdefgABCDEFG"); + s2.insert(2,1,'\0'); + s2.insert(7,1,'\0'); + s2.insert(12,1,'\0'); + + CPPUNIT_ASSERT( s1.substr( 0, 17 ) == s1 ); + CPPUNIT_ASSERT( s1.substr( 1, 17 ) == s2 ); + CPPUNIT_ASSERT( s1.substr( 1, 20 ) == s2 ); + CPPUNIT_ASSERT( s1.substr( 17, 30 ) == _T("") ); } diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp index d8dc4fa3c2..83c1cc24a6 100644 --- a/tests/strings/strings.cpp +++ b/tests/strings/strings.cpp @@ -49,6 +49,8 @@ private: CPPUNIT_TEST( Replace ); CPPUNIT_TEST( Match ); CPPUNIT_TEST( CaseChanges ); + CPPUNIT_TEST( Compare ); + CPPUNIT_TEST( CompareNoCase ); CPPUNIT_TEST_SUITE_END(); void String(); @@ -65,6 +67,8 @@ private: void Replace(); void Match(); void CaseChanges(); + void Compare(); + void CompareNoCase(); DECLARE_NO_COPY_CLASS(StringTestCase) }; @@ -337,3 +341,85 @@ void StringTestCase::CaseChanges() } #endif // !wxUSE_UNICODE } + +void StringTestCase::Compare() +{ + wxString s1 = wxT("AHH"); + wxString eq = wxT("AHH"); + wxString neq1 = wxT("HAH"); + wxString neq2 = wxT("AH"); + wxString neq3 = wxT("AHHH"); + wxString neq4 = wxT("AhH"); + + CPPUNIT_ASSERT( s1 == eq ); + CPPUNIT_ASSERT( s1 != neq1 ); + CPPUNIT_ASSERT( s1 != neq2 ); + CPPUNIT_ASSERT( s1 != neq3 ); + CPPUNIT_ASSERT( s1 != neq4 ); + +// wxString _s1 = wxT("A\0HH"); +// wxString _eq = wxT("A\0HH"); +// wxString _neq1 = wxT("H\0AH"); +// wxString _neq2 = wxT("A\0H"); +// wxString _neq3 = wxT("A\0HHH"); +// wxString _neq4 = wxT("A\0hH"); + s1.insert(1,1,'\0'); + eq.insert(1,1,'\0'); + neq1.insert(1,1,'\0'); + neq2.insert(1,1,'\0'); + neq3.insert(1,1,'\0'); + neq4.insert(1,1,'\0'); + + CPPUNIT_ASSERT( s1 == eq ); + CPPUNIT_ASSERT( s1 != neq1 ); + CPPUNIT_ASSERT( s1 != neq2 ); + CPPUNIT_ASSERT( s1 != neq3 ); + CPPUNIT_ASSERT( s1 != neq4 ); +} + +void StringTestCase::CompareNoCase() +{ + wxString s1 = wxT("AHH"); + wxString eq = wxT("AHH"); + wxString eq2 = wxT("AhH"); + wxString eq3 = wxT("ahh"); + wxString neq = wxT("HAH"); + wxString neq2 = wxT("AH"); + wxString neq3 = wxT("AHHH"); + + #define CPPUNIT_CNCEQ_ASSERT(s1, s2) CPPUNIT_ASSERT( s1.CmpNoCase(s2) == 0) + #define CPPUNIT_CNCNEQ_ASSERT(s1, s2) CPPUNIT_ASSERT( s1.CmpNoCase(s2) != 0) + + CPPUNIT_CNCEQ_ASSERT( s1, eq ); + CPPUNIT_CNCEQ_ASSERT( s1, eq2 ); + CPPUNIT_CNCEQ_ASSERT( s1, eq3 ); + + CPPUNIT_CNCNEQ_ASSERT( s1, neq ); + CPPUNIT_CNCNEQ_ASSERT( s1, neq2 ); + CPPUNIT_CNCNEQ_ASSERT( s1, neq3 ); + + +// wxString _s1 = wxT("A\0HH"); +// wxString _eq = wxT("A\0HH"); +// wxString _eq2 = wxT("A\0hH"); +// wxString _eq3 = wxT("a\0hh"); +// wxString _neq = wxT("H\0AH"); +// wxString _neq2 = wxT("A\0H"); +// wxString _neq3 = wxT("A\0HHH"); + + s1.insert(1,1,'\0'); + eq.insert(1,1,'\0'); + eq2.insert(1,1,'\0'); + eq3.insert(1,1,'\0'); + neq.insert(1,1,'\0'); + neq2.insert(1,1,'\0'); + neq3.insert(1,1,'\0'); + + CPPUNIT_CNCEQ_ASSERT( s1, eq ); + CPPUNIT_CNCEQ_ASSERT( s1, eq2 ); + CPPUNIT_CNCEQ_ASSERT( s1, eq3 ); + + CPPUNIT_CNCNEQ_ASSERT( s1, neq ); + CPPUNIT_CNCNEQ_ASSERT( s1, neq2 ); + CPPUNIT_CNCNEQ_ASSERT( s1, neq3 ); +} \ No newline at end of file