<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="http://blogs.forum.nokia.com/styles/rss.css" type="text/css"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  xmlns:admin="http://webns.net/mvcb/"
  xmlns="http://purl.org/rss/1.0/"
>
 <channel rdf:about="http://blogs.forum.nokia.com/rss.php?blogId=300055&amp;profile=rss10">
  <title>Harry Li&#039;s Forum Nokia Blog</title>
  <link>http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog</link>
  <description>A Forum Nokia Blog</description>
    <dc:creator>kcomex</dc:creator>
  <dc:date>2009-11-23T13:16:27Z</dc:date>
  <admin:generatorAgent rdf:resource="http://www.lifetype.net" />
  <items>
   <rdf:Seq>
       <rdf:li rdf:resource="http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog/2008/06/21/retrieve-stderr-in-open-c" />
       <rdf:li rdf:resource="http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog/2008/06/03/limitation-on-open-c-which-matters-huge-project-like-mozilla" />
       <rdf:li rdf:resource="http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog/2008/05/18/development-depends-on-dependency" />
       <rdf:li rdf:resource="http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog/2008/05/08/evaluate-the-project-before-porting" />
      </rdf:Seq>
  </items> 
 </channel>
  <item rdf:about="http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog/2008/06/21/retrieve-stderr-in-open-c">
  <title>Retrieve STDERR in Open C</title>
  <link>http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog/2008/06/21/retrieve-stderr-in-open-c</link>
  <dc:description>&lt;p&gt;
During the debugging and unit test cases running phase, open source projects usually write error string or other information to STDERR file. Quite unluckily, we can not retrieve lines from STDERR in Symbian with Open C. The stdioserver program comes with Open C SDK only redirects STDOUT to a file located on disk, but left STDERR no where to check out.
&lt;/p&gt;
&lt;p&gt;
So in my Mozilla porting days, I have to make a workaround for retrieving information written to STDERR because most of unit test cases write error information to STDERR. There are two workarounds which could be used according to different situation.
&lt;/p&gt;
&lt;p&gt;
If you have only one or not so many .c source files to fix, then I would like to recommend the first way. That is to modify the source code, add these lines as the top most statement:
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: courier new,courier; color: #0000ff&quot;&gt;
FILE* stderr_redirect = freopen(&amp;quot;C:\\data\\stderr.log&amp;quot;, &amp;quot;w&amp;quot;, stderr); // Top most line&lt;br /&gt;
/* Begin of original code lines */&lt;br /&gt;
... &lt;br /&gt;
&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style=&quot;font-family: courier new,courier; color: #0000ff&quot;&gt;...&lt;br /&gt;
&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style=&quot;font-family: courier new,courier; color: #0000ff&quot;&gt;...&lt;br /&gt;
&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style=&quot;font-family: courier new,courier; color: #0000ff&quot;&gt;/* End of original code lines */&lt;br /&gt;
&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style=&quot;font-family: courier new,courier; color: #0000ff&quot;&gt;fclose(stderr_redirect); // Bottom most line&lt;/span&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The other case is that you have many (maybe up to several hundreds) independent .c source files,&amp;nbsp; so it&#039;s almost impossible to adopt&amp;nbsp; the first way, like &lt;a href=&quot;http://lxr.mozilla.org/nspr/source/nsprpub/pr/tests/&quot; target=&quot;_blank&quot;&gt;NSPR test cases&lt;/a&gt;. We have to figure out another solution. Here I did a small trick, that is modify the &lt;span style=&quot;color: #3366ff&quot;&gt;&lt;em&gt;&lt;strong&gt;stdio.h&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;in &amp;lt;EPOCROOT&amp;gt;\Epoc32\include\stdapis in Open C SDK. The &lt;span style=&quot;color: #3366ff&quot;&gt;&lt;em&gt;&lt;strong&gt;stdio.h&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000&quot;&gt; &lt;/span&gt;in looks like this:
&lt;/p&gt;
&lt;p&gt;
&lt;span style=&quot;font-family: courier new,courier&quot;&gt;&lt;strong&gt;&lt;span style=&quot;color: #3366ff&quot;&gt;...&lt;br /&gt;
...&lt;br /&gt;
#ifndef __SYMBIAN32__&lt;br /&gt;
#define&amp;nbsp;&amp;nbsp;&amp;nbsp; stdin&amp;nbsp;&amp;nbsp;&amp;nbsp; __stdinp&lt;br /&gt;
#define&amp;nbsp;&amp;nbsp;&amp;nbsp; stdout&amp;nbsp;&amp;nbsp;&amp;nbsp; __stdoutp&lt;br /&gt;
#define&amp;nbsp;&amp;nbsp;&amp;nbsp; stderr&amp;nbsp;&amp;nbsp;&amp;nbsp; __stderrp&lt;br /&gt;
#else&lt;br /&gt;
__BEGIN_DECLS&lt;br /&gt;
IMPORT_C FILE *__stdin&amp;nbsp; (void);&lt;br /&gt;
IMPORT_C FILE *__stdout (void);&lt;br /&gt;
IMPORT_C FILE *__stderr (void);&lt;br /&gt;
IMPORT_C char * tmpdirname(void);&lt;br /&gt;
__END_DECLS&lt;br /&gt;
#define stdin &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; (__stdin())&lt;br /&gt;
#define stdout&amp;nbsp; (__stdout())&lt;br /&gt;
&lt;span style=&quot;background-color: #ffff99&quot;&gt;#ifdef STDERR_TO_STDOUT&lt;br /&gt;
#define stderr&amp;nbsp; (__stdout())&lt;br /&gt;
#else&lt;br /&gt;
#define stderr&amp;nbsp; (__stderr())&lt;br /&gt;
#endif&lt;br /&gt;
&lt;/span&gt;#endif&lt;br /&gt;
...&lt;br /&gt;
...&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
These lines are located around line 265 - 283 if you are using &lt;a href=&quot;http://www.forum.nokia.com/info/sw.nokia.com/id/91d89929-fb8c-4d66-bea0-227e42df9053/Open_C_SDK_Plug-In.html&quot; target=&quot;_blank&quot;&gt;Open C SDK v1.3&lt;/a&gt;. With the lines shown as light yellow marked, you could know I just let the compiler treats STDERR as STDOUT, sothat information written to STDERR are all redirected to STDOUT. Of course we have to define &lt;em&gt;&lt;span style=&quot;color: #3366ff&quot;&gt;&lt;strong&gt;MACRO STDERR_TO_STDOUT&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt; in that .MMP file. And because we don&#039;t want this trick infect other projects which don&#039;t have their STDERR touched, so we use this macro to mark the&amp;nbsp; fence. Once STDERR is redirected to STDOUT, then you could use the original stdioserver program comes with the Open C SDK to check out original STDERR information in STDOUT file.  
&lt;/p&gt;
&lt;p&gt;
All two ways are easy to understand and use, although I felt the latter one is not so perfect because this requires changing a SDK file. Hope this tip will be helpful in your daily work, and just give me any comments when you get any idea about this. &lt;img src=&quot;http://blogs.forum.nokia.com/js/tinymce/plugins/emotions/images/smiley-wink.gif&quot; border=&quot;0&quot; alt=&quot;Wink&quot; title=&quot;Wink&quot; /&gt;
&lt;/p&gt;</dc:description>
      
    <dc:subject>Open C</dc:subject>
      
    <dc:subject>Symbian C++</dc:subject>
     
    
  <dc:date>2008-06-21T14:38:34Z</dc:date>
    <dc:creator>kcomex</dc:creator>
 </item>
  <item rdf:about="http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog/2008/06/03/limitation-on-open-c-which-matters-huge-project-like-mozilla">
  <title>Limitation on Open C which matters HUGE project like Mozilla</title>
  <link>http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog/2008/06/03/limitation-on-open-c-which-matters-huge-project-like-mozilla</link>
  <dc:description>&lt;p&gt;Open C is a quite powerful tool when porting open source projects to Symbian OS platform. But a mobile kitty is not a desktop monster, it doesn&#039;t have a so powerful kernel, especially you encountered some design limitations. For small projects which don&#039;t utilize lower or system level functions, you will wield Open C without any pain. However, projects as large as Mozilla will meet the limitations and avoid using incomplete or absent functions. So marking those limitations with good documentation and practical experiences is very important. Here I will try to tell you some of my experiences.&lt;/p&gt;&lt;p&gt;First of all, you need to read Open C documents carefully, Nokia and Symbian try to explain every limitation they know as clear as possible. So you don&#039;t need go discussion board and ask questions before check the documents. *BUT ACTUALLY*, the problem is not all about checking Open C documents, there are possibilities the problem is not caused by Open C but your code. In this case, the situation is not easy. You need practical experiences from others, by talking with colleagues or searching discussion board.&lt;/p&gt;&lt;p&gt;Here comes the body. The most incomplete group is libc Signal Handling, but what&#039;s lucky is we can find absence of these functions, you don&#039;t need to determine where the problem comes from, your code or Open C. The second hard one to over come is using posix_spawn() instead of fork() and exec(). Here I would give you a suggestion, read the complete&amp;nbsp;&lt;a href=&quot;http://www.scit.wlv.ac.uk/cgi-bin/mansec?2+fork&quot; target=&quot;_blank&quot;&gt;fork() manual&lt;/a&gt;&amp;nbsp;and compare the difference between&amp;nbsp;&lt;a href=&quot;http://www.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html&quot; target=&quot;_blank&quot;&gt;posix_spawn()&lt;/a&gt;. Then check the context of your code, see if these differences applied. This technique is not so easy, even there are further hidden side effect, for example &amp;quot;In the child process created with popen3/popen/system/posix_spawn, operations on the inherited file may cause a panic.&amp;quot; in&amp;nbsp;&lt;a href=&quot;http://developer.symbian.com/wiki/download/attachments/1411/pips_readme_1_3.pdf?version=1&quot; target=&quot;_blank&quot;&gt;P.I.P.S. V1.3 Release Notes&lt;/a&gt;. Bear in mind those side effects from practice, then the job would be less tough. &lt;/p&gt;&lt;p&gt;With two big stop showers ahead, I think the most important is not getting those limitations one by one, but a skill to find if the bug comes from _my_ code or Open C. Once the debug tricks are at hand, there won&#039;t be anything &amp;quot;won&#039;t fix&amp;quot;&amp;nbsp;&lt;img src=&quot;http://blogs.forum.nokia.com/js/tinymce/plugins/emotions/images/smiley-wink.gif&quot; border=&quot;0&quot; alt=&quot;Wink&quot; title=&quot;Wink&quot; /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</dc:description>
      
    <dc:subject>Open C</dc:subject>
      
    <dc:subject>Symbian C++</dc:subject>
      
    <dc:subject>Testing</dc:subject>
      
    <dc:subject>Mozilla</dc:subject>
     
    
  <dc:date>2008-06-03T16:53:38Z</dc:date>
    <dc:creator>kcomex</dc:creator>
 </item>
  <item rdf:about="http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog/2008/05/18/development-depends-on-dependency">
  <title>Development Depends on Dependency</title>
  <link>http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog/2008/05/18/development-depends-on-dependency</link>
  <dc:description>&lt;p&gt;
It&#039;s quite a while since my last post. Although I&#039;m not there, just because of the terrible &lt;a href=&quot;http://en.wikipedia.org/wiki/2008_Sichuan_earthquake&quot; target=&quot;_blank&quot; title=&quot;earth quake&quot;&gt;earth quake&lt;/a&gt; happened in SiChuan China, I can&#039;t sleep well and concentrate on my codes while people there are suffering. God bless them, hope they could recover with time passes.
&lt;/p&gt;
&lt;p&gt;
Actually this has been done two weeks ago. After evaluate the amount of porting works, we could go on with the dependency check of a specific project. For Mozilla, I had shown a &lt;a href=&quot;http://weblogs.mozillazine.org/schrep/archives/2007/05/mozilla_platform.html&quot; target=&quot;_blank&quot;&gt;framework picture&lt;/a&gt;: 
&lt;/p&gt;
&lt;p&gt;
&lt;img src=&quot;http://blogs.forum.nokia.com//data/blogs/resources/300055/previews-med/theMozillaPlatform.png&quot; width=&quot;520&quot; height=&quot;392&quot; align=&quot;middle&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
From this picture we know the components in the lowest level are &amp;quot;NSPR&amp;quot; and Cairo&amp;quot;. Because &amp;quot;Cairo&amp;quot; is only a graphics base, so we will start from &lt;a href=&quot;http://www.mozilla.org/projects/nspr/&quot; target=&quot;_blank&quot; title=&quot;NSPR&quot;&gt;NSPR&lt;/a&gt; first.&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
For other open source projects without such a components diagram, then how we could know its internal components dependency? I would sugguest taking a look at the build(configure &amp;amp;&amp;amp; make) output, from this log everything is exposed even with any third party library used by that project. Anyway, large projects like Mozilla will take us more time to get everything clear. Also the more time we put on dependency check, the more clear we could get for a structural view, and the more easy for add or modify codes.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;</dc:description>
      
    <dc:subject>Open C</dc:subject>
      
    <dc:subject>Symbian C++</dc:subject>
      
    <dc:subject>Mozilla</dc:subject>
     
    
  <dc:date>2008-05-18T16:00:55Z</dc:date>
    <dc:creator>kcomex</dc:creator>
 </item>
  <item rdf:about="http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog/2008/05/08/evaluate-the-project-before-porting">
  <title>Evaluate the project before porting</title>
  <link>http://blogs.forum.nokia.com/blog/harry-lis-forum-nokia-blog/2008/05/08/evaluate-the-project-before-porting</link>
  <dc:description>&lt;p&gt;
Porting an open source project is quite different from developing a new application for mobile phones. During past days without &lt;a href=&quot;http://wiki.forum.nokia.com/index.php/Category:Open_C&quot; target=&quot;_blank&quot;&gt;Open C&lt;/a&gt;, we have to rewrite lots of code to satisfy both Symbian OS rules/limitation and difference between mobile devices and desktop computers. Touching so much code will cost more development time, but what&#039;s worse is that making changes too much will drive you thinking &amp;quot;Should I start a new project rather than using only a little from this existing project?&amp;quot;. So porting an existing application onto Symbian OS makes you keep concerning how much modification will you make, if too much consider starting a new one or just share the name or brand. As far as I know, &lt;a href=&quot;https://helixcommunity.org/&quot; target=&quot;_blank&quot;&gt;HelixCommunity&lt;/a&gt; is the first big and famous open source project ported to Symbian OS, and it supports as early as v6.1. I checked out its source in 2004 (means their code nowadays might be different a lot), this is one example of making too much changes so you can tell few difference between porting like this or making a new project. Since S60 3rd Edition, there is Open C we can utilize, the job is easier. But still we can not ignore this consideration because of the nature of mobile phones. In one word, first step of porting an existing project is evaluate how much changes will be made approximately. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://www.forum.nokia.com/main/resources/technologies/open_c/tips_for_selecting_open_source_code.html&quot; target=&quot;_blank&quot;&gt;This document&lt;/a&gt; in Forum Nokia web site is very helpful, and generally speaking smaller projects are always easier to make decision if it could be ported than bigger ones. Smaller ones are always based on some existing framework, if the framework exists or can be ported on Symbian OS then the project itself will be fine in most cases. Huge project like Mozilla or Helix will give us an impression that it is likely impossible to port cause it has so many dependencies and self owned framework. However, we want eveidence to support our decision. Let&#039;s get back to Mozilla, after searching its website, there is an &amp;quot;&lt;a href=&quot;http://developer.mozilla.org/en/docs/C%2B%2B_Portability_Guide&quot; target=&quot;_blank&quot;&gt;C/C++ Portability Guide&lt;/a&gt;&amp;quot; which shows us an amazing likeness of Symbian OS programming limitations. From this article, we could learn Mozilla code will probably contain very little exceptions, RTTI and others that Symbian OS C++ does not support. Then with the help of Open C, we could have better confidence about porting without changing too much code. 
&lt;/p&gt;
&lt;p&gt;
Next we have to&amp;nbsp; make&amp;nbsp; deeper&amp;nbsp; research on the inner&amp;nbsp; structure&amp;nbsp; of Mozilla platform, cause you can not start portting any piece of code without knowing which level it lies in and what it does actually. Stay tuned, I will bring more as the work goes on &lt;img src=&quot;http://blogs.forum.nokia.com/js/tinymce/plugins/emotions/images/smiley-smile.gif&quot; border=&quot;0&quot; alt=&quot;Smile&quot; title=&quot;Smile&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;</dc:description>
      
    <dc:subject>Open C</dc:subject>
      
    <dc:subject>S60</dc:subject>
      
    <dc:subject>Symbian C++</dc:subject>
      
    <dc:subject>Mozilla</dc:subject>
     
    
  <dc:date>2008-05-08T09:16:10Z</dc:date>
    <dc:creator>kcomex</dc:creator>
 </item>
 </rdf:RDF>