Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / September 2005



Tip: Looking for answers? Try searching our database.

Standard lib for unicode

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Denis @ TheOffice - 12 Sep 2005 13:42 GMT
Is there any standard lib like strncpy,,, that handle Unicode version?

Thanks
Ron L - 12 Sep 2005 19:50 GMT
>Is there any standard lib like strncpy,,, that handle Unicode version?
>
>Thanks

Wide variety,  look in MSL C Reference for all the wide string functions.

Ron

Signature

CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
       --   http://www.codewarrior.com/community  --

Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com

Denis @ TheOffice - 12 Sep 2005 20:21 GMT
Yes, I did and it raise two problems:

1- when I include wtype.h and wstring.h  it does not compile because there is a multiple definition
for wchar_t.
One is define as long and the other as short...

2- many of equivalent from type and string.h are not there?

Thanks

> >Is there any standard lib like strncpy,,, that handle Unicode version?
> >
[quoted text clipped - 3 lines]
>
> Ron
Ron L - 13 Sep 2005 18:41 GMT
>Yes, I did and it raise two problems:
>
>1- when I include wtype.h and wstring.h  it does not compile because there is
>a multiple definition
>for wchar_t.

I don't know what wtype.h is but wctype.h and wchar.h both work fine
together for me.

ansiPprefix.mach.h is the file for this.

#ifndef _MSL_WCHAR_T_TYPE
  #if defined(__MWERKS__)
     #if __option(ushort_wchar_t)
        #define _MSL_WCHAR_T_TYPE unsigned short
     #else
        #define _MSL_WCHAR_T_TYPE int
     #endif
  #else
     #define _MSL_WCHAR_T_TYPE int
  #endif
#endif

>One is define as long and the other as short...
>
>2- many of equivalent from type and string.h are not there?

wcsncpy is there.

Ron

>> >Is there any standard lib like strncpy,,, that handle Unicode version?
>> >
[quoted text clipped - 3 lines]
>>
>> Ron

Signature

CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
       --   http://www.codewarrior.com/community  --

Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com

Denis @ TheOffice - 13 Sep 2005 19:38 GMT
Sorry I just misstyped the c.

Here in wCtype.h at line 96

#ifndef _WCTYPE_T
typedef unsigned long wctype_t;
#define _WCTYPE_T
#endif

And here in ansi.h at line 55

#ifndef _BSD_WCHAR_T_DEFINED_
#define _BSD_WCHAR_T_DEFINED_
...

typedef wchar_t wctype_t;
typedef int  mbstate_t;
typedef wchar_t Wint_t;

Those are two different type...

> >Yes, I did and it raise two problems:
> >
[quoted text clipped - 34 lines]
> >>
> >> Ron
Denis @ TheOffice - 14 Sep 2005 20:13 GMT
Now what's next Ron ?

Should I just #define _WCTYPE_T
in between the 2 files.

PLUS : Which one is right LONG or SHORT ?

Denis

> Sorry I just misstyped the c.
>
[quoted text clipped - 55 lines]
> > >>
> > >> Ron
Ron L - 14 Sep 2005 21:25 GMT
>Now what's next Ron ?
>
>Should I just #define _WCTYPE_T
>in between the 2 files.
>
>PLUS : Which one is right LONG or SHORT ?

If you have the BSD prefix file it is one if  you have the MSL prefix
file it is the other.  they are conditioned to check wheter you are
using MSL.  If you get a redefined error you probably don't have a
prefix file but are including MSL in the project.

Both are correct, it is an implementation option and as long as you use
the same headers all the way through it doesn't matter and does not have
a problem.

Ron

>> Sorry I just misstyped the c.
>>
[quoted text clipped - 57 lines]
>> > >>
>> > >> Ron

Signature

CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
       --   http://www.codewarrior.com/community  --

Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com

Denis @ TheOffice - 14 Sep 2005 22:35 GMT
Yeah, but that just bring me back to square one.

I need the standard lib say strlen and I need wcslen both at the same time.

> >Now what's next Ron ?
> >
[quoted text clipped - 75 lines]
> >> > >>
> >> > >> Ron
Ron L - 15 Sep 2005 17:08 GMT
>Yeah, but that just bring me back to square one.
>
>I need the standard lib say strlen and I need wcslen both at the same time.

And there is absolutely no problem in doing that.  

USE MSL C Library  use the prefix file that has MSL that starts it and
make sure that /include is below MSL in the access paths.

Your problem is not with including wide string and standard libs your
problem is including headers from BSD and MSL at the stame time.

Ron

>> >Now what's next Ron ?
>> >
[quoted text clipped - 76 lines]
>> >> > >>
>> >> > >> Ron

Signature

CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
       --   http://www.codewarrior.com/community  --

Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com

Denis @ TheOffice - 15 Sep 2005 18:31 GMT
It does not work or I am missing an info. Can you give me a step through or an example project,
please?

> >Yeah, but that just bring me back to square one.
> >
[quoted text clipped - 90 lines]
> >> >> > >>
> >> >> > >> Ron
Ron L - 16 Sep 2005 17:03 GMT
>It does not work or I am missing an info. Can you give me a step through or an
>example project,
>please?

I can not duplicate your error at all.  Every stationery and example
should work fine.  

All I can say is send me an example project that duplicates this.

Ron

Signature

CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
       --   http://www.codewarrior.com/community  --

Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com

Denis @ TheOffice - 16 Sep 2005 18:01 GMT
okay, I'll send it direct

Denis

> >It does not work or I am missing an info. Can you give me a step through or an
> >example project,
[quoted text clipped - 6 lines]
>
> Ron
Denis @ TheOffice - 19 Sep 2005 17:29 GMT
I have new info in this topic.

Last Friday I bought another Mac with Tiger, and install everything from scratch.
It build/compiles fine.

I went back to 10.3.x old system rebuild all libs.
I am still unable to include that "wCtype.h" What can I do ?

Thanks

> >It does not work or I am missing an info. Can you give me a step through or an
> >example project,
[quoted text clipped - 6 lines]
>
> Ron
Ron L - 20 Sep 2005 20:46 GMT
>I have new info in this topic.
>
[quoted text clipped - 4 lines]
>I went back to 10.3.x old system rebuild all libs.
>I am still unable to include that "wCtype.h" What can I do ?

it is wctype.h  but I suspect you meant that.  I suspect there is a
problem with the access path order or maybe a missing file.  I'm not
sure where it comes from.

It is possibly one of several things including a corrupt search cache.

Sorry, look at precompiled headers first, look at access paths next,

Ron

>> >It does not work or I am missing an info. Can you give me a step through or
>> >an
[quoted text clipped - 7 lines]
>>
>> Ron

Signature

CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
       --   http://www.codewarrior.com/community  --

Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com

Denis @ TheOffice - 20 Sep 2005 21:19 GMT
I did rebuild the precompiled library.

Is there any way to clean that beside reinstalling the system?

> >I have new info in this topic.
> >
[quoted text clipped - 26 lines]
> >>
> >> Ron
Ron L - 21 Sep 2005 17:08 GMT
>I did rebuild the precompiled library.
>
>Is there any way to clean that beside reinstalling the system?

make sure your access path is in the right order, that the \usr and \lib
is underneath the MSL stuff.

Check to see that OS X Volume is set right globally as a source tree.

Make sure that there isn't any other settings for it in your project.

Remove object code and re-search for files

create a new project from scratch and see if that works there.

that might help, if not,  then move the way wctype.h is included from ""
to <> or vice versa,  maybe put it up at the top of the include list.

Ron

>> >I have new info in this topic.
>> >
[quoted text clipped - 27 lines]
>> >>
>> >> Ron

Signature

CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
       --   http://www.codewarrior.com/community  --

Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com

Denis @ TheOffice - 21 Sep 2005 20:31 GMT
I changed the order like you suggested and now I am having this error:

#if !_MSL_USING_MW_C_HEADERS
#error You must have the non-MSL C header file access path before the
MSL access path
#else

Plus I just re-install the entire system from scratch still not capable of including the wctype.

> >I did rebuild the precompiled library.
> >
[quoted text clipped - 47 lines]
> >> >>
> >> >> Ron
Ron L - 21 Sep 2005 22:19 GMT
>I changed the order like you suggested and now I am having this error:
>
>#if !_MSL_USING_MW_C_HEADERS
>#error You must have the non-MSL C header file access path before the
>MSL access path
>#else

The problem is in your target's access path or the precompiled header
that you are using.

Send me your project file, just that and I'll show you what is wrong.

Ron

Signature

CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
       --   http://www.codewarrior.com/community  --

Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com

Denis @ TheOffice - 27 Sep 2005 15:33 GMT
Don't give up on me.

Have you received my project?

I have found a very interesting difference between Tiger and 10.3.9,
the file wctype.h are very different. And the funny part is on 10.3.9 it is newer than 10.4 ???
So there is a conflict with that file. Who would have change/update that file???
XCold 1.5?
Also do you have an alternative instead of using from /usr/include/wctype.h ?

Regards,
Denis

> >I changed the order like you suggested and now I am having this error:
> >
[quoted text clipped - 9 lines]
>
> Ron
Ron L - 27 Sep 2005 22:18 GMT
>Don't give up on me.
>
[quoted text clipped - 7 lines]
>XCold 1.5?
>Also do you have an alternative instead of using from /usr/include/wctype.h ?

I don't think you seem to understand this.  You can use MSL C or you can
use BSD C (in user/include/ )  but you can not mix them and each one
needs to use the precompiled header that was designed for that version
of the C Library.

You can not mix the BSD wctype.h with the MSL wctype.h

To use BSD you move the access path above the MSL path in the Targets
Access paths preferences.   You are getting this error because of that.

You simply need to move that path below the MSL and path and it should
all build nicely.

Ron

>Regards,
>Denis
[quoted text clipped - 12 lines]
>>
>> Ron

Signature

CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
       --   http://www.codewarrior.com/community  --

Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com

Denis @ TheOffice - 27 Sep 2005 22:45 GMT
I would not mind but many functions I am using does not find Include or anything.

Here is a list of include requirement That I have:
   #include <stdio.h>
   #include <string.h>
   #include <stdlib.h>
   #include <ctype.h>
   #include <memory.h>
   #include <paths.h>
   #include <time.h>
   #include <cmath>                    // for sqrt() and pow()

   #include <wctype.h>
   #include <wchar.h>

   #include <unistd.h>
   #include <fcntl.h>
   #include <termios.h>
   #include <errno.h>

   #include <sys/ioctl.h>
   #include <sys/param.h>

   #include <mach/mach.h>

   ///////////////////////////////////////////////////////////////////////////////////////////////
   #include <Carbon/Carbon.h>
   #include <CoreFoundation/CoreFoundation.h>

   #include <IOKit/IOKitLib.h>
   #include <IOKit/serial/IOSerialKeys.h>
   #include <IOKit/IOBSD.h>

   #include <IOKit/IOCFPlugIn.h>
   #include <IOKit/usb/IOUSBLib.h>

   ///////////////////////////////////////////////////////////////////////////////////////////////
   #include <QuickTime/QuickTime.h>

I did try to place the access path before but then I am having other errors.

DC

> >Don't give up on me.
> >
[quoted text clipped - 39 lines]
> >>
> >> Ron
Ron L - 28 Sep 2005 18:10 GMT
>I would not mind but many functions I am using does not find Include or
>anything.

THEY ALL DO  it is in the prefix file you are using.

In the target settings  preprocessor settings

If you aren't using one then you need to use one, to set switches if
MSL uses its math or BSD's and other things.

What you need to do is create a little project that is simple that
duplicates this and send it to me, or preprocess one file that has the
errors and send that and a project to me.  

>I did try to place the access path before but then I am having other errors.

Do you understand I'm talking about the target settings and the access
paths options in that, not the source file.

Ron

Signature

CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
       --   http://www.codewarrior.com/community  --

Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com

Denis @ TheOffice - 28 Sep 2005 18:54 GMT
> What you need to do is create a little project that is simple that
> duplicates this and send it to me, or preprocess one file that has the
> errors and send that and a project to me.

I did twice already directly to your mailbox : ron.liechty@freescale.com
If the email is wrong pls, give me another one.

> Do you understand I'm talking about the target settings and the access
> paths options in that, not the source file.

I do understand, I did all that!

First thing first: Are you on Tiger or Panther 10.3.9
If you are on Tiger then the problem will not rise.

On Panther 10.3.9
If you just take the default preset C++ project mac toolbox with nib.
and put those includes:
   #include <stdio.h>
   #include <string.h>
   #include <stdlib.h>
   #include <ctype.h>
   #include <memory.h>
   #include <paths.h>
   #include <time.h>
   #include <cmath>                    // for sqrt() and pow()

   #include <wctype.h>
   #include <wchar.h>

   #include <unistd.h>
   #include <fcntl.h>
   #include <termios.h>
   #include <errno.h>

   #include <sys/ioctl.h>
   #include <sys/param.h>

   #include <mach/mach.h>

   ///////////////////////////////////////////////////////////////////////////////////////////////
   #include <Carbon/Carbon.h>
   #include <CoreFoundation/CoreFoundation.h>

   #include <IOKit/IOKitLib.h>
   #include <IOKit/serial/IOSerialKeys.h>
   #include <IOKit/IOBSD.h>

   #include <IOKit/IOCFPlugIn.h>
   #include <IOKit/usb/IOUSBLib.h>

   ///////////////////////////////////////////////////////////////////////////////////////////////
   #include <QuickTime/QuickTime.h>

voilà! it does not need more to start complaining...

Denis

> >I would not mind but many functions I am using does not find Include or
> >anything.
[quoted text clipped - 16 lines]
>
> Ron
Ron L - 29 Sep 2005 16:52 GMT
>> What you need to do is create a little project that is simple that
>> duplicates this and send it to me, or preprocess one file that has the
>> errors and send that and a project to me.
>>
>I did twice already directly to your mailbox : ron.liechty@freescale.com
>If the email is wrong pls, give me another one.

The mail must be getting bounced by spam filters.

>> Do you understand I'm talking about the target settings and the access
>> paths options in that, not the source file.
[quoted text clipped - 46 lines]
>
>voilà! it does not need more to start complaining...

Compiled without error for me.

Try reinstalling XCode and rebuild your precompiled headers.

Ron

Signature

CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
       --   http://www.codewarrior.com/community  --

Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com

Denis @ TheOffice - 15 Sep 2005 14:45 GMT
I am a bit confuse with, as I am still relatively new to that concept of prefix...

> If you have the BSD prefix file it is one if  you have the MSL prefix
> file it is the other.  they are conditioned to check wheter you are
> using MSL.  If you get a redefined error you probably don't have a
> prefix file but are including MSL in the project.

Are you suggesting to remove or use a certain prefix file?
Which one will allow me to use both.

> >Now what's next Ron ?
> >
[quoted text clipped - 75 lines]
> >> > >>
> >> > >> Ron
Denis @ TheOffice - 15 Sep 2005 17:28 GMT
There is that enable wchar_t support in the project setting panel.

Should I remove this in order to use the wctype.h?

> >Now what's next Ron ?
> >
[quoted text clipped - 75 lines]
> >> > >>
> >> > >> Ron
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.