<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Palm OS Codewarrior 9.3 w/ broken tolower, toupper in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Palm-OS-Codewarrior-9-3-w-broken-tolower-toupper/m-p/130820#M487</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I'm trying to change the character string to upper case or lower case. I find it strange that Palm OS API has a StrToLower function but no StrToUpper function but StrToLower Palm OS API does&amp;nbsp;work but I need to convert to lower and upper and so I resort to tolower and toupper as portable solutions.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;First I tried to do it the std C++ way with std::transform(s.begin(), s.end(), s.begin, ::toupper);&lt;/DIV&gt;&lt;DIV&gt;and this compiled and linked but its execution erased my string - obliterated it, so then I tried&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;// Explicit cast forces the compiler to choose the function def over the macro&lt;/DIV&gt;&lt;DIV&gt;std::transform(s.begin(), s.end(), s.begin, (int(*)(int))toupper);&lt;/DIV&gt;&lt;DIV&gt;This gave a compiler error and I had to abandon it. If toupper is a macro then no forcing it will work.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Finally I resorted the std hack:&lt;/DIV&gt;&lt;DIV&gt;strupr((char*)s.c_str()); -- this wouldn't compile, strupr wasn't found even though I had string.h included.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Finally I then I just wrote my own function&lt;/DIV&gt;&lt;DIV&gt;strupr(char* s)&lt;/DIV&gt;&lt;DIV&gt;which called&lt;/DIV&gt;&lt;DIV&gt;s[i] = toupper(s[i])&lt;/DIV&gt;&lt;DIV&gt;and s[i] which had the character string "abc"&lt;/DIV&gt;&lt;DIV&gt;but got a 0 result.&lt;/DIV&gt;&lt;DIV&gt;0 &amp;lt;= s[i] = toupper(s[i]) even though s[i] was = to 'A'&lt;/DIV&gt;&lt;DIV&gt;toupper was not working. I was thinking this had to something to do w/ the locale.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;All I can conclude is that toupper and tolower do not work with the Palm OS Metrowerks compiler.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Finally I put at the top of the .cpp file, since the IDE doesn't let one define a -D_MSL_USE_INLINE anywhere which a typical compiler - GUI or cmd line usually does...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#define _MSL_USE_INLINE 1&lt;/DIV&gt;&lt;DIV&gt;and now FINALLY toupper works...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;What is going wrong?&lt;/DIV&gt;&lt;DIV&gt;I isolated the code to the file &amp;lt;cctype&amp;gt; and I'm using the latest 9.3.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Is there a configuration for this compiler that lets me write std C++ code or at least close to it.&lt;/DIV&gt;&lt;DIV&gt;Is there a way to use -D_MSL_USE_INLINE or do I need to use the cmd line compiler for that. Is it even advisable to use this macro - if I don't it - it compiles and links&amp;nbsp;but tolower and toupper always return 0.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm porting an existing app that is fairly small and I don't want to have to write all the std C and C++ functions just for the Palm OS and do all these mental gymnastics.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Sep 2006 08:00:34 GMT</pubDate>
    <dc:creator>ascheurer</dc:creator>
    <dc:date>2006-09-20T08:00:34Z</dc:date>
    <item>
      <title>Palm OS Codewarrior 9.3 w/ broken tolower, toupper</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Palm-OS-Codewarrior-9-3-w-broken-tolower-toupper/m-p/130820#M487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I'm trying to change the character string to upper case or lower case. I find it strange that Palm OS API has a StrToLower function but no StrToUpper function but StrToLower Palm OS API does&amp;nbsp;work but I need to convert to lower and upper and so I resort to tolower and toupper as portable solutions.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;First I tried to do it the std C++ way with std::transform(s.begin(), s.end(), s.begin, ::toupper);&lt;/DIV&gt;&lt;DIV&gt;and this compiled and linked but its execution erased my string - obliterated it, so then I tried&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;// Explicit cast forces the compiler to choose the function def over the macro&lt;/DIV&gt;&lt;DIV&gt;std::transform(s.begin(), s.end(), s.begin, (int(*)(int))toupper);&lt;/DIV&gt;&lt;DIV&gt;This gave a compiler error and I had to abandon it. If toupper is a macro then no forcing it will work.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Finally I resorted the std hack:&lt;/DIV&gt;&lt;DIV&gt;strupr((char*)s.c_str()); -- this wouldn't compile, strupr wasn't found even though I had string.h included.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Finally I then I just wrote my own function&lt;/DIV&gt;&lt;DIV&gt;strupr(char* s)&lt;/DIV&gt;&lt;DIV&gt;which called&lt;/DIV&gt;&lt;DIV&gt;s[i] = toupper(s[i])&lt;/DIV&gt;&lt;DIV&gt;and s[i] which had the character string "abc"&lt;/DIV&gt;&lt;DIV&gt;but got a 0 result.&lt;/DIV&gt;&lt;DIV&gt;0 &amp;lt;= s[i] = toupper(s[i]) even though s[i] was = to 'A'&lt;/DIV&gt;&lt;DIV&gt;toupper was not working. I was thinking this had to something to do w/ the locale.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;All I can conclude is that toupper and tolower do not work with the Palm OS Metrowerks compiler.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Finally I put at the top of the .cpp file, since the IDE doesn't let one define a -D_MSL_USE_INLINE anywhere which a typical compiler - GUI or cmd line usually does...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#define _MSL_USE_INLINE 1&lt;/DIV&gt;&lt;DIV&gt;and now FINALLY toupper works...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;What is going wrong?&lt;/DIV&gt;&lt;DIV&gt;I isolated the code to the file &amp;lt;cctype&amp;gt; and I'm using the latest 9.3.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Is there a configuration for this compiler that lets me write std C++ code or at least close to it.&lt;/DIV&gt;&lt;DIV&gt;Is there a way to use -D_MSL_USE_INLINE or do I need to use the cmd line compiler for that. Is it even advisable to use this macro - if I don't it - it compiles and links&amp;nbsp;but tolower and toupper always return 0.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm porting an existing app that is fairly small and I don't want to have to write all the std C and C++ functions just for the Palm OS and do all these mental gymnastics.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Sep 2006 08:00:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Palm-OS-Codewarrior-9-3-w-broken-tolower-toupper/m-p/130820#M487</guid>
      <dc:creator>ascheurer</dc:creator>
      <dc:date>2006-09-20T08:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Palm OS Codewarrior 9.3 w/ broken tolower, toupper</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Palm-OS-Codewarrior-9-3-w-broken-tolower-toupper/m-p/130821#M488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Freescale no longer provides technical support for CW 9.3 for PalmOS. For that, you'll have to go the Palm &lt;A href="http://www.palm.com/us/developers/palmos.html" rel="nofollow" target="_blank"&gt;site&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;---Tom&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Sep 2006 21:38:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Palm-OS-Codewarrior-9-3-w-broken-tolower-toupper/m-p/130821#M488</guid>
      <dc:creator>J2MEJediMaster</dc:creator>
      <dc:date>2006-09-20T21:38:49Z</dc:date>
    </item>
  </channel>
</rss>

