<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TamsPalm - the Palm OS / web OS Blog &#187; Sample code</title>
	<atom:link href="http://tamspalm.tamoggemon.com/category/development/19/feed/" rel="self" type="application/rss+xml" />
	<link>http://tamspalm.tamoggemon.com</link>
	<description>Palm OS / web OS news and opinion source</description>
	<lastBuildDate>Thu, 18 Mar 2010 10:00:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Use C and C++ code together &#8211; undefined reference galore</title>
		<link>http://tamspalm.tamoggemon.com/2009/08/03/use-c-and-c-code-together-undefined-reference-galore/</link>
		<comments>http://tamspalm.tamoggemon.com/2009/08/03/use-c-and-c-code-together-undefined-reference-galore/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 03:15:34 +0000</pubDate>
		<dc:creator>Tam Hanna, Site Founder</dc:creator>
				<category><![CDATA[Sample code]]></category>

		<guid isPermaLink="false">http://tamspalm.tamoggemon.com/?p=4858</guid>
		<description><![CDATA[If word on the street is to be believed, C and C++ can coexist peacefully. Just include the C library< 's header into your C++ file, put them both in a project as seen on the left, and you are set to go.
Unfortunately, this isn't the case - things like polymorphism and other properties of [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://tamoggemon.com/blog/contents/2009/August/thacc++/c-and-c++-code.png" style="float: left; margin:5px;" title="Use C and C++ code together   undefined reference galore" alt="c and c++ code Use C and C++ code together   undefined reference galore" />If word on the street is to be believed, C and C++ can coexist peacefully. Just include the C library< 's header into your C++ file, put them both in a project as seen on the left, and you are set to go.</p>
<p>Unfortunately, this isn't the case - things like polymorphism and other properties of C++ lead to loads of "Undefined reference" errors when trying to access C functions from C++ code and vice versa.</p>
<p>The solution consist of special extern directives - the two sites below should keep you covered:<br />
<a href="http://developers.sun.com/solaris/articles/mixing.html">Mixing C and C++ code in the same program<br />
<a href="http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html">How to mix C and C++</a></p>
<p>Good luck porting!</p>
]]></content:encoded>
			<wfw:commentRss>http://tamspalm.tamoggemon.com/2009/08/03/use-c-and-c-code-together-undefined-reference-galore/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PODS preprocessor trickery &#8211; raise errors from the preprocessor</title>
		<link>http://tamspalm.tamoggemon.com/2008/07/26/pods-preprocessor-trickery-raise-errors-from-the-preprocessor/</link>
		<comments>http://tamspalm.tamoggemon.com/2008/07/26/pods-preprocessor-trickery-raise-errors-from-the-preprocessor/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 11:50:39 +0000</pubDate>
		<dc:creator>Tam Hanna, Site Founder</dc:creator>
				<category><![CDATA[Sample code]]></category>

		<guid isPermaLink="false">http://tamspalm.tamoggemon.com/?p=2808</guid>
		<description><![CDATA[I am currently hacking around on a new DRM system for my applications which &#8211; surprise, surprise &#8211; will include OTA wherever its possible (aka at MobiHand&#8217;s). As I need to use variable URL&#8217;s for each distributor, I felt like using the preprocessor.
As I stumbled across a few interesting things, I felt like sharing the [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently hacking around on a new DRM system for my applications which &#8211; surprise, surprise &#8211; will include OTA wherever its possible (aka at MobiHand&#8217;s). As I need to use variable URL&#8217;s for each distributor, I felt like using the preprocessor.</p>
<p>As I stumbled across a few interesting things, I felt like sharing the code below:<br />
<code><br />
#if defined MOBIHAND<br />
WBM_OpenWebPage(0,"https://www.mobihand.com/mobilecart/mc1.asp?posid=162&#038;pid=8703");<br />
#elif defined PALMGEAR<br />
WBM_OpenWebPage(0,"http://www.palmgear.com/index.cfm?fuseaction=sc.buy&#038;prodid=137239&#038;buytoken=62745661");<br />
#else<br />
#error "no ESD Specified"<br />
#endif<br />
</code> </p>
<p>The first thing that I considered interesting is the #error macro &#8211; it allows you to stop the compilation process if some condition is not met. In the example above, the condition would be that no ESD flag is set. Furthermore, nesting definitions isn&#8217;t too easy either &#8211; the syntax involves the defined operator (which the PODS does NOT highlight).</p>
]]></content:encoded>
			<wfw:commentRss>http://tamspalm.tamoggemon.com/2008/07/26/pods-preprocessor-trickery-raise-errors-from-the-preprocessor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data encryption on Palm OS handhelds</title>
		<link>http://tamspalm.tamoggemon.com/2008/04/29/data-encryption-on-palm-os-handhelds/</link>
		<comments>http://tamspalm.tamoggemon.com/2008/04/29/data-encryption-on-palm-os-handhelds/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 08:46:40 +0000</pubDate>
		<dc:creator>Tam Hanna, Site Founder</dc:creator>
				<category><![CDATA[Sample code]]></category>

		<guid isPermaLink="false">http://tamspalm.tamoggemon.com/?p=2636</guid>
		<description><![CDATA[In case anyone of you frees like adding encryption to your applications, being a palm-dev-forum subscriber definitely pays out.
The folks there currently discuss the various encryption options available to Palm OS developers &#8211; if your apps need a security improvement, click the link below  to get to the first post:
Data encryption Palm OS
]]></description>
			<content:encoded><![CDATA[<p>In case anyone of you frees like adding encryption to your applications, being a palm-dev-forum subscriber definitely pays out.</p>
<p>The folks there currently discuss the various encryption options available to Palm OS developers &#8211; if your apps need a security improvement, click the link below  to get to the first post:<br />
<a href="http://news.palmos.com/read/messages?id=212737">Data encryption Palm OS</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tamspalm.tamoggemon.com/2008/04/29/data-encryption-on-palm-os-handhelds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Invalid Insertion Point Position via FldSetFocus &#8211; what to do</title>
		<link>http://tamspalm.tamoggemon.com/2008/02/26/invalid-insertion-point-position-via-fldsetfocus-what-to-do/</link>
		<comments>http://tamspalm.tamoggemon.com/2008/02/26/invalid-insertion-point-position-via-fldsetfocus-what-to-do/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 13:22:00 +0000</pubDate>
		<dc:creator>Tam Hanna, Site Founder</dc:creator>
				<category><![CDATA[Sample code]]></category>

		<guid isPermaLink="false">http://tamspalm.tamoggemon.com/2008/02/26/invalid-insertion-point-position-via-fldsetfocus-what-to-do/</guid>
		<description><![CDATA[The code below has worked well on all handhelds I ever put my paws on &#8211; but failed miserably on the simulator:

	case frmOpenEvent:
		createLVL();
		FrmDrawForm(pForm);
		StrCopy(vars.msg1,"Action!!");
		vars.msg1_framestolive=MSG_LIFETIME;
		lasttic=TimGetTicks();
		FrmSetFocus(pForm,FrmGetObjectIndex(pForm,FldShadow)); //allows GSPDA T9 keys to function
		handled = true;
		break;

The simulator gave an alert along the lines of &#8220;Invalid insertion point&#8221; &#8211; WTF?
The alert text above is a classic example for a completely unrelated [...]]]></description>
			<content:encoded><![CDATA[<p>The code below has worked well on all handhelds I ever put my paws on &#8211; but failed miserably on the simulator:<br />
<code><br />
	case frmOpenEvent:<br />
		createLVL();<br />
		FrmDrawForm(pForm);<br />
		StrCopy(vars.msg1,"Action!!");<br />
		vars.msg1_framestolive=MSG_LIFETIME;<br />
		lasttic=TimGetTicks();<br />
		FrmSetFocus(pForm,FrmGetObjectIndex(pForm,FldShadow)); //allows GSPDA T9 keys to function<br />
		handled = true;<br />
		break;<br />
</code></p>
<p>The simulator gave an alert along the lines of &#8220;Invalid insertion point&#8221; &#8211; WTF?</p>
<p>The alert text above is a classic example for a completely unrelated error message &#8211; the reason for the alert is simple: the text field FldShadow is not high enough for the text it should contain. Just increase the height of the field &#8211; and the fatal alert is gone for good!</p>
]]></content:encoded>
			<wfw:commentRss>http://tamspalm.tamoggemon.com/2008/02/26/invalid-insertion-point-position-via-fldsetfocus-what-to-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SDL beeing ported to Palm OS</title>
		<link>http://tamspalm.tamoggemon.com/2007/12/14/sdl-beeing-ported-to-palm-os/</link>
		<comments>http://tamspalm.tamoggemon.com/2007/12/14/sdl-beeing-ported-to-palm-os/#comments</comments>
		<pubDate>Fri, 14 Dec 2007 20:52:58 +0000</pubDate>
		<dc:creator>Tam Hanna, Site Founder</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Palm News]]></category>
		<category><![CDATA[Sample code]]></category>

		<guid isPermaLink="false">http://tamspalm.tamoggemon.com/2007/12/14/sdl-beeing-ported-to-palm-os/</guid>
		<description><![CDATA[A library called SDL is at the core of many(if not most) OpenSource projects &#8211; they use the library&#8217;s functions for various tasks like graphics and sound. WikiPedia describes the library as following:

Simple DirectMedia Layer (SDL) is a cross-platform, multimedia, free software library written in C that creates an abstraction over various platforms&#8217; graphics, sound, [...]]]></description>
			<content:encoded><![CDATA[<p>A library called SDL is at the core of many(if not most) OpenSource projects &#8211; they use the library&#8217;s functions for various tasks like graphics and sound. <a href="http://en.wikipedia.org/wiki/Simple_DirectMedia_Layer">WikiPedia</a> describes the library as following:</p>
<blockquote><p>
Simple DirectMedia Layer (SDL) is a cross-platform, multimedia, free software library written in C that creates an abstraction over various platforms&#8217; graphics, sound, and input APIs, allowing a developer to write a computer game or other multimedia application once and run it on many operating systems including Linux, Windows, Mac OS X, AmigaOS and its clone MorphOS. It manages video, events, digital audio, CD-ROM, sound, threads, shared object loading, networking and timers.
</p></blockquote>
<p>Now, an user called TomB has opened a <a href="http://www.nexave.de/forum/30709-erste-version-sdl-for-palmos-tester-gesucht.html?highlight=">thread on Nexave</a>, announcing that he is working on porting this very library to Palm OS. Here is a translation of his german post:</p>
<blockquote><p>
Dear Ladies and Gentlemen,</p>
<p>I have posted a first version of my port right here: <a href="https://sourceforge.net/project/showfiles.php?group_id=212180">https://sourceforge.net/project/showfiles.php?group_id=212180</a>. I have included a few t5est programs and games that run well on a Treo 650 and a Zodiac &#8211; a Tungsten E has had issues due to low RAM.</p>
<p>I would be very thankful for testers!<br />
For developers: I support all except OpenGL, CDRom and Threads. The libraries SDL_mixer, SDL_image and spritelib are included. Additionally, ARM versions of most standard C library calls are included as a bonus!
</p></blockquote>
<p>Should anyone of you feel like testing the SDL port for Palm OS, please leave a comment with your experiences here. Alexander Gratz and I will then post the URL of this post to Nexave in order to allow TomB to participate in the discussion!</p>
]]></content:encoded>
			<wfw:commentRss>http://tamspalm.tamoggemon.com/2007/12/14/sdl-beeing-ported-to-palm-os/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZLauncher Plug-In API for OnBoardC</title>
		<link>http://tamspalm.tamoggemon.com/2007/10/22/zlauncher-plug-in-api-for-onboardc/</link>
		<comments>http://tamspalm.tamoggemon.com/2007/10/22/zlauncher-plug-in-api-for-onboardc/#comments</comments>
		<pubDate>Mon, 22 Oct 2007 11:49:59 +0000</pubDate>
		<dc:creator>Tam Hanna, Site Founder</dc:creator>
				<category><![CDATA[Sample code]]></category>

		<guid isPermaLink="false">http://tamspalm.tamoggemon.com/2007/10/22/zlauncher-plug-in-api-for-onboardc/</guid>
		<description><![CDATA[ZLauncher is a very popular launcher replacement for Palm OS handhelds &#8211; it can easily be expanded by third party developers using the ZLauncher plug-in API. A sample for the API is contained in the distribution file &#8211; however, getting it ready for OnBoardC usage is not exactly easy.
This version of ZLPlugin.h has worked well [...]]]></description>
			<content:encoded><![CDATA[<p>ZLauncher is a very popular launcher replacement for Palm OS handhelds &#8211; it can easily be expanded by third party developers using the ZLauncher plug-in API. A sample for the API is contained in the distribution file &#8211; however, getting it ready for OnBoardC usage is not exactly easy.</p>
<p>This version of ZLPlugin.h has worked well for me with OnBoardC 2.4 and 2.6 &#8211; it allows you to use all ZLauncher functions except for ZLDrawChars(no idea why, but it kills the compile process). Additionally, the current build of ZLauncher seems to have a bug in the variable-length preference functions&#8230;the calls execute correctly, but don&#8217;t work(aka save/read data). </p>
<p>Anyways, here goes:<br />
<a href="http://tamoggemon.com/blog/contents/2007/October/thaobczl/ZLPlugin.h.pdb">ZLPlugin.h.pdb</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tamspalm.tamoggemon.com/2007/10/22/zlauncher-plug-in-api-for-onboardc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sine/Cosine lookup table</title>
		<link>http://tamspalm.tamoggemon.com/2007/09/18/sinecosine-lookup-table/</link>
		<comments>http://tamspalm.tamoggemon.com/2007/09/18/sinecosine-lookup-table/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 14:36:35 +0000</pubDate>
		<dc:creator>Tam Hanna, Site Founder</dc:creator>
				<category><![CDATA[Sample code]]></category>

		<guid isPermaLink="false">http://tamspalm.tamoggemon.com/2007/09/18/sinecosine-lookup-table/</guid>
		<description><![CDATA[After having followed a discussion about charting in the palm-dev-forum, I felt that the following lookup tables could potentially be useful for some of you. I generated them using SmallBASIC and use them in BallZ(the Palm OS JezzBall clone).
Anyways, the input is in traditional degrees, and the output is a float value. If you are [...]]]></description>
			<content:encoded><![CDATA[<p>After having followed a discussion about charting in the palm-dev-forum, I felt that the following lookup tables could potentially be useful for some of you. I generated them using SmallBASIC and use them in BallZ(the Palm OS JezzBall clone).</p>
<p>Anyways, the input is in traditional degrees, and the output is a float value. If you are short on memory, you could also transform the input to the sine table to get cosine or vice versa&#8230;although this IMHO doesn&#8217;t pay out(a simple lookup is faster)&#8230;</p>
<p><span id="more-2061"></span></p>
<p>Enjoy!</p>
<p>P.s. Non-coders&#8230;Sorry for the long post&#8230;<br />
<code><br />
float cosine[]={1,<br />
0.999847695,<br />
0.999390827,<br />
0.998629535,<br />
0.99756405,<br />
0.996194698,<br />
0.994521895,<br />
0.992546152,<br />
0.990268069,<br />
0.987688341,<br />
0.984807753,<br />
0.981627183,<br />
0.978147601,<br />
0.974370065,<br />
0.970295726,<br />
0.965925826,<br />
0.961261696,<br />
0.956304756,<br />
0.951056516,<br />
0.945518576,<br />
0.939692621,<br />
0.933580426,<br />
0.927183855,<br />
0.920504853,<br />
0.913545458,<br />
0.906307787,<br />
0.898794046,<br />
0.891006524,<br />
0.882947593,<br />
0.874619707,<br />
0.866025404,<br />
0.857167301,<br />
0.848048096,<br />
0.838670568,<br />
0.829037573,<br />
0.819152044,<br />
0.809016994,<br />
0.79863551,<br />
0.788010754,<br />
0.777145961,<br />
0.766044443,<br />
0.75470958,<br />
0.743144825,<br />
0.731353702,<br />
0.7193398,<br />
0.707106781,<br />
0.69465837,<br />
0.68199836,<br />
0.669130606,<br />
0.656059029,<br />
0.64278761,<br />
0.629320391,<br />
0.615661475,<br />
0.601815023,<br />
0.587785252,<br />
0.573576436,<br />
0.559192903,<br />
0.544639035,<br />
0.529919264,<br />
0.515038075,<br />
0.5,<br />
0.48480962,<br />
0.469471563,<br />
0.4539905,<br />
0.438371147,<br />
0.422618262,<br />
0.406736643,<br />
0.390731128,<br />
0.374606593,<br />
0.35836795,<br />
0.342020143,<br />
0.325568154,<br />
0.309016994,<br />
0.292371705,<br />
0.275637356,<br />
0.258819045,<br />
0.241921896,<br />
0.224951054,<br />
0.207911691,<br />
0.190808995,<br />
0.173648178,<br />
0.156434465,<br />
0.139173101,<br />
0.121869343,<br />
0.104528463,<br />
0.087155743,<br />
0.069756474,<br />
0.052335956,<br />
0.034899497,<br />
0.017452406,<br />
2.832769449E-16,<br />
-0.017452406,<br />
-0.034899497,<br />
-0.052335956,<br />
-0.069756474,<br />
-0.087155743,<br />
-0.104528463,<br />
-0.121869343,<br />
-0.139173101,<br />
-0.156434465,<br />
-0.173648178,<br />
-0.190808995,<br />
-0.207911691,<br />
-0.224951054,<br />
-0.241921896,<br />
-0.258819045,<br />
-0.275637356,<br />
-0.292371705,<br />
-0.309016994,<br />
-0.325568154,<br />
-0.342020143,<br />
-0.35836795,<br />
-0.374606593,<br />
-0.390731128,<br />
-0.406736643,<br />
-0.422618262,<br />
-0.438371147,<br />
-0.4539905,<br />
-0.469471563,<br />
-0.48480962,<br />
-0.5,<br />
-0.515038075,<br />
-0.529919264,<br />
-0.544639035,<br />
-0.559192903,<br />
-0.573576436,<br />
-0.587785252,<br />
-0.601815023,<br />
-0.615661475,<br />
-0.629320391,<br />
-0.64278761,<br />
-0.656059029,<br />
-0.669130606,<br />
-0.68199836,<br />
-0.69465837,<br />
-0.707106781,<br />
-0.7193398,<br />
-0.731353702,<br />
-0.743144825,<br />
-0.75470958,<br />
-0.766044443,<br />
-0.777145961,<br />
-0.788010754,<br />
-0.79863551,<br />
-0.809016994,<br />
-0.819152044,<br />
-0.829037573,<br />
-0.838670568,<br />
-0.848048096,<br />
-0.857167301,<br />
-0.866025404,<br />
-0.874619707,<br />
-0.882947593,<br />
-0.891006524,<br />
-0.898794046,<br />
-0.906307787,<br />
-0.913545458,<br />
-0.920504853,<br />
-0.927183855,<br />
-0.933580426,<br />
-0.939692621,<br />
-0.945518576,<br />
-0.951056516,<br />
-0.956304756,<br />
-0.961261696,<br />
-0.965925826,<br />
-0.970295726,<br />
-0.974370065,<br />
-0.978147601,<br />
-0.981627183,<br />
-0.984807753,<br />
-0.987688341,<br />
-0.990268069,<br />
-0.992546152,<br />
-0.994521895,<br />
-0.996194698,<br />
-0.99756405,<br />
-0.998629535,<br />
-0.999390827,<br />
-0.999847695,<br />
-1,-0.999847695,<br />
-0.999390827,<br />
-0.998629535,<br />
-0.99756405,<br />
-0.996194698,<br />
-0.994521895,<br />
-0.992546152,<br />
-0.990268069,<br />
-0.987688341,<br />
-0.984807753,<br />
-0.981627183,<br />
-0.978147601,<br />
-0.974370065,<br />
-0.970295726,<br />
-0.965925826,<br />
-0.961261696,<br />
-0.956304756,<br />
-0.951056516,<br />
-0.945518576,<br />
-0.939692621,<br />
-0.933580426,<br />
-0.927183855,<br />
-0.920504853,<br />
-0.913545458,<br />
-0.906307787,<br />
-0.898794046,<br />
-0.891006524,<br />
-0.882947593,<br />
-0.874619707,<br />
-0.866025404,<br />
-0.857167301,<br />
-0.848048096,<br />
-0.838670568,<br />
-0.829037573,<br />
-0.819152044,<br />
-0.809016994,<br />
-0.79863551,<br />
-0.788010754,<br />
-0.777145961,<br />
-0.766044443,<br />
-0.75470958,<br />
-0.743144825,<br />
-0.731353702,<br />
-0.7193398,<br />
-0.707106781,<br />
-0.69465837,<br />
-0.68199836,<br />
-0.669130606,<br />
-0.656059029,<br />
-0.64278761,<br />
-0.629320391,<br />
-0.615661475,<br />
-0.601815023,<br />
-0.587785252,<br />
-0.573576436,<br />
-0.559192903,<br />
-0.544639035,<br />
-0.529919264,<br />
-0.515038075,<br />
-0.5,<br />
-0.48480962,<br />
-0.469471563,<br />
-0.4539905,<br />
-0.438371147,<br />
-0.422618262,<br />
-0.406736643,<br />
-0.390731128,<br />
-0.374606593,<br />
-0.35836795,<br />
-0.342020143,<br />
-0.325568154,<br />
-0.309016994,<br />
-0.292371705,<br />
-0.275637356,<br />
-0.258819045,<br />
-0.241921896,<br />
-0.224951054,<br />
-0.207911691,<br />
-0.190808995,<br />
-0.173648178,<br />
-0.156434465,<br />
-0.139173101,<br />
-0.121869343,<br />
-0.104528463,<br />
-0.087155743,<br />
-0.069756474,<br />
-0.052335956,<br />
-0.034899497,<br />
-0.017452406,<br />
-1.07187544E-15,<br />
0.017452406,<br />
0.034899497,<br />
0.052335956,<br />
0.069756474,<br />
0.087155743,<br />
0.104528463,<br />
0.121869343,<br />
0.139173101,<br />
0.156434465,<br />
0.173648178,<br />
0.190808995,<br />
0.207911691,<br />
0.224951054,<br />
0.241921896,<br />
0.258819045,<br />
0.275637356,<br />
0.292371705,<br />
0.309016994,<br />
0.325568154,<br />
0.342020143,<br />
0.35836795,<br />
0.374606593,<br />
0.390731128,<br />
0.406736643,<br />
0.422618262,<br />
0.438371147,<br />
0.4539905,<br />
0.469471563,<br />
0.48480962,<br />
0.5,<br />
0.515038075,<br />
0.529919264,<br />
0.544639035,<br />
0.559192903,<br />
0.573576436,<br />
0.587785252,<br />
0.601815023,<br />
0.615661475,<br />
0.629320391,<br />
0.64278761,<br />
0.656059029,<br />
0.669130606,<br />
0.68199836,<br />
0.69465837,<br />
0.707106781,<br />
0.7193398,<br />
0.731353702,<br />
0.743144825,<br />
0.75470958,<br />
0.766044443,<br />
0.777145961,<br />
0.788010754,<br />
0.79863551,<br />
0.809016994,<br />
0.819152044,<br />
0.829037573,<br />
0.838670568,<br />
0.848048096,<br />
0.857167301,<br />
0.866025404,<br />
0.874619707,<br />
0.882947593,<br />
0.891006524,<br />
0.898794046,<br />
0.906307787,<br />
0.913545458,<br />
0.920504853,<br />
0.927183855,<br />
0.933580426,<br />
0.939692621,<br />
0.945518576,<br />
0.951056516,<br />
0.956304756,<br />
0.961261696,<br />
0.965925826,<br />
0.970295726,<br />
0.974370065,<br />
0.978147601,<br />
0.981627183,<br />
0.984807753,<br />
0.987688341,<br />
0.990268069,<br />
0.992546152,<br />
0.994521895,<br />
0.996194698,<br />
0.99756405,<br />
0.998629535,<br />
0.999390827,<br />
0.999847695,<br />
1};</code></p>
<p>float sine[]=<br />
{0,<br />
0.017452406,<br />
0.034899497,<br />
0.052335956,<br />
0.069756474,<br />
0.087155743,<br />
0.104528463,<br />
0.121869343,<br />
0.139173101,<br />
0.156434465,<br />
0.173648178,<br />
0.190808995,<br />
0.207911691,<br />
0.224951054,<br />
0.241921896,<br />
0.258819045,<br />
0.275637356,<br />
0.292371705,<br />
0.309016994,<br />
0.325568154,<br />
0.342020143,<br />
0.35836795,<br />
0.374606593,<br />
0.390731128,<br />
0.406736643,<br />
0.422618262,<br />
0.438371147,<br />
0.4539905,<br />
0.469471563,<br />
0.48480962,<br />
0.5,<br />
0.515038075,<br />
0.529919264,<br />
0.544639035,<br />
0.559192903,<br />
0.573576436,<br />
0.587785252,<br />
0.601815023,<br />
0.615661475,<br />
0.629320391,<br />
0.64278761,<br />
0.656059029,<br />
0.669130606,<br />
0.68199836,<br />
0.69465837,<br />
0.707106781,<br />
0.7193398,<br />
0.731353702,<br />
0.743144825,<br />
0.75470958,<br />
0.766044443,<br />
0.777145961,<br />
0.788010754,<br />
0.79863551,<br />
0.809016994,<br />
0.819152044,<br />
0.829037573,<br />
0.838670568,<br />
0.848048096,<br />
0.857167301,<br />
0.866025404,<br />
0.874619707,<br />
0.882947593,<br />
0.891006524,<br />
0.898794046,<br />
0.906307787,<br />
0.913545458,<br />
0.920504853,<br />
0.927183855,<br />
0.933580426,<br />
0.939692621,<br />
0.945518576,<br />
0.951056516,<br />
0.956304756,<br />
0.961261696,<br />
0.965925826,<br />
0.970295726,<br />
0.974370065,<br />
0.978147601,<br />
0.981627183,<br />
0.984807753,<br />
0.987688341,<br />
0.990268069,<br />
0.992546152,<br />
0.994521895,<br />
0.996194698,<br />
0.99756405,<br />
0.998629535,<br />
0.999390827,<br />
0.999847695,<br />
1,<br />
0.999847695,<br />
0.999390827,<br />
0.998629535,<br />
0.99756405,<br />
0.996194698,<br />
0.994521895,<br />
0.992546152,<br />
0.990268069,<br />
0.987688341,<br />
0.984807753,<br />
0.981627183,<br />
0.978147601,<br />
0.974370065,<br />
0.970295726,<br />
0.965925826,<br />
0.961261696,<br />
0.956304756,<br />
0.951056516,<br />
0.945518576,<br />
0.939692621,<br />
0.933580426,<br />
0.927183855,<br />
0.920504853,<br />
0.913545458,<br />
0.906307787,<br />
0.898794046,<br />
0.891006524,<br />
0.882947593,<br />
0.874619707,<br />
0.866025404,<br />
0.857167301,<br />
0.848048096,<br />
0.838670568,<br />
0.829037573,<br />
0.819152044,<br />
0.809016994,<br />
0.79863551,<br />
0.788010754,<br />
0.777145961,<br />
0.766044443,<br />
0.75470958,<br />
0.743144825,<br />
0.731353702,<br />
0.7193398,<br />
0.707106781,<br />
0.69465837,<br />
0.68199836,<br />
0.669130606,<br />
0.656059029,<br />
0.64278761,<br />
0.629320391,<br />
0.615661475,<br />
0.601815023,<br />
0.587785252,<br />
0.573576436,<br />
0.559192903,<br />
0.544639035,<br />
0.529919264,<br />
0.515038075,<br />
0.5,<br />
0.48480962,<br />
0.469471563,<br />
0.4539905,<br />
0.438371147,<br />
0.422618262,<br />
0.406736643,<br />
0.390731128,<br />
0.374606593,<br />
0.35836795,<br />
0.342020143,<br />
0.325568154,<br />
0.309016994,<br />
0.292371705,<br />
0.275637356,<br />
0.258819045,<br />
0.241921896,<br />
0.224951054,<br />
0.207911691,<br />
0.190808995,<br />
0.173648178,<br />
0.156434465,<br />
0.139173101,<br />
0.121869343,<br />
0.104528463,<br />
0.087155743,<br />
0.069756474,<br />
0.052335956,<br />
0.034899497,<br />
0.017452406,<br />
5.665538898E-16,<br />
-0.017452406,<br />
-0.034899497,<br />
-0.052335956,<br />
-0.069756474,<br />
-0.087155743,<br />
-0.104528463,<br />
-0.121869343,<br />
-0.139173101,<br />
-0.156434465,<br />
-0.173648178,<br />
-0.190808995,<br />
-0.207911691,<br />
-0.224951054,<br />
-0.241921896,<br />
-0.258819045,<br />
-0.275637356,<br />
-0.292371705,<br />
-0.309016994,<br />
-0.325568154,<br />
-0.342020143,<br />
-0.35836795,<br />
-0.374606593,<br />
-0.390731128,<br />
-0.406736643,<br />
-0.422618262,<br />
-0.438371147,<br />
-0.4539905,<br />
-0.469471563,<br />
-0.48480962,<br />
-0.5,<br />
-0.515038075,<br />
-0.529919264,<br />
-0.544639035,<br />
-0.559192903,<br />
-0.573576436,<br />
-0.587785252,<br />
-0.601815023,<br />
-0.615661475,<br />
-0.629320391,<br />
-0.64278761,<br />
-0.656059029,<br />
-0.669130606,<br />
-0.68199836,<br />
-0.69465837,<br />
-0.707106781,<br />
-0.7193398,<br />
-0.731353702,<br />
-0.743144825,<br />
-0.75470958,<br />
-0.766044443,<br />
-0.777145961,<br />
-0.788010754,<br />
-0.79863551,<br />
-0.809016994,<br />
-0.819152044,<br />
-0.829037573,<br />
-0.838670568,<br />
-0.848048096,<br />
-0.857167301,<br />
-0.866025404,<br />
-0.874619707,<br />
-0.882947593,<br />
-0.891006524,<br />
-0.898794046,<br />
-0.906307787,<br />
-0.913545458,<br />
-0.920504853,<br />
-0.927183855,<br />
-0.933580426,<br />
-0.939692621,<br />
-0.945518576,<br />
-0.951056516,<br />
-0.956304756,<br />
-0.961261696,<br />
-0.965925826,<br />
-0.970295726,<br />
-0.974370065,<br />
-0.978147601,<br />
-0.981627183,<br />
-0.984807753,<br />
-0.987688341,<br />
-0.990268069,<br />
-0.992546152,<br />
-0.994521895,<br />
-0.996194698,<br />
-0.99756405,<br />
-0.998629535,<br />
-0.999390827,<br />
-0.999847695,<br />
-1,<br />
-0.999847695,<br />
-0.999390827,<br />
-0.998629535,<br />
-0.99756405,<br />
-0.996194698,<br />
-0.994521895,<br />
-0.992546152,<br />
-0.990268069,<br />
-0.987688341,<br />
-0.984807753,<br />
-0.981627183,<br />
-0.978147601,<br />
-0.974370065,<br />
-0.970295726,<br />
-0.965925826,<br />
-0.961261696,<br />
-0.956304756,<br />
-0.951056516,<br />
-0.945518576,<br />
-0.939692621,<br />
-0.933580426,<br />
-0.927183855,<br />
-0.920504853,<br />
-0.913545458,<br />
-0.906307787,<br />
-0.898794046,<br />
-0.891006524,<br />
-0.882947593,<br />
-0.874619707,<br />
-0.866025404,<br />
-0.857167301,<br />
-0.848048096,<br />
-0.838670568,<br />
-0.829037573,<br />
-0.819152044,<br />
-0.809016994,<br />
-0.79863551,<br />
-0.788010754,<br />
-0.777145961,<br />
-0.766044443,<br />
-0.75470958,<br />
-0.743144825,<br />
-0.731353702,<br />
-0.7193398,<br />
-0.707106781,<br />
-0.69465837,<br />
-0.68199836,<br />
-0.669130606,<br />
-0.656059029,<br />
-0.64278761,<br />
-0.629320391,<br />
-0.615661475,<br />
-0.601815023,<br />
-0.587785252,<br />
-0.573576436,<br />
-0.559192903,<br />
-0.544639035,<br />
-0.529919264,<br />
-0.515038075,<br />
-0.5,<br />
-0.48480962,<br />
-0.469471563,<br />
-0.4539905,<br />
-0.438371147,<br />
-0.422618262,<br />
-0.406736643,<br />
-0.390731128,<br />
-0.374606593,<br />
-0.35836795,<br />
-0.342020143,<br />
-0.325568154,<br />
-0.309016994,<br />
-0.292371705,<br />
-0.275637356,<br />
-0.258819045,<br />
-0.241921896,<br />
-0.224951054,<br />
-0.207911691,<br />
-0.190808995,<br />
-0.173648178,<br />
-0.156434465,<br />
-0.139173101,<br />
-0.121869343,<br />
-0.104528463,<br />
-0.087155743,<br />
-0.069756474,<br />
-0.052335956,<br />
-0.034899497,<br />
-0.017452406,<br />
-1.13310778E-15};</p>
]]></content:encoded>
			<wfw:commentRss>http://tamspalm.tamoggemon.com/2007/09/18/sinecosine-lookup-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CamLibControl &#8211; the call that doesn&#8217;t work</title>
		<link>http://tamspalm.tamoggemon.com/2007/09/02/camlibcontrol-the-call-that-doesnt-work/</link>
		<comments>http://tamspalm.tamoggemon.com/2007/09/02/camlibcontrol-the-call-that-doesnt-work/#comments</comments>
		<pubDate>Sun, 02 Sep 2007 21:46:29 +0000</pubDate>
		<dc:creator>Tam Hanna, Site Founder</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Sample code]]></category>

		<guid isPermaLink="false">http://tamspalm.tamoggemon.com/2007/09/02/camlibcontrol-the-call-that-doesnt-work/</guid>
		<description><![CDATA[Ever since the Palm Treo 600, Palm OS Treos contain integrated CMOS cameras that can produce decent images. Since the Treo 650, these cameras can be controlled via the so-called Camera Manager, an API that should let you control brightness, contrast and saturation comfortably&#8230;
However, the API&#8217;s Palm itself provides do not work on any shipping [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since the Palm Treo 600, Palm OS Treos contain integrated CMOS cameras that can produce decent images. Since the Treo 650, these cameras can be controlled via the so-called Camera Manager, an API that should let you control brightness, contrast and saturation comfortably&#8230;</p>
<p>However, the API&#8217;s Palm itself provides do not work on any shipping Treo. I myself have tested the MiniCamera sample from the SDK on a Palm Treo 650 and a Treo 680 and can report that changing brightness and contrast of images(!!!) via CamLibControl works on neither. A comrade from 1src has tested MiniCamera on a Treo 755p(latest Palm device) and doesn&#8217;t report any successes either.</p>
<p>So, to cut a long story short, you can NOT programatically change image brightness/contrast on a Palm OS Treo. You need to live with what the camera manager provides&#8230;so much for the Treo being a high-tech smartphone. As for the MiniCamera API sample &#8230; do not ask me why it is in there if it doesn&#8217;t work <img src='http://tamspalm.tamoggemon.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' title="CamLibControl   the call that doesnt work" />  &#8230;</p>
<p>P.s. Sorry for the aggressive tune&#8230;but please, Palm, come on. I mean, every 100€ dumb phone can do that!</p>
]]></content:encoded>
			<wfw:commentRss>http://tamspalm.tamoggemon.com/2007/09/02/camlibcontrol-the-call-that-doesnt-work/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Globals in DAs</title>
		<link>http://tamspalm.tamoggemon.com/2007/08/29/globals-in-das/</link>
		<comments>http://tamspalm.tamoggemon.com/2007/08/29/globals-in-das/#comments</comments>
		<pubDate>Wed, 29 Aug 2007 16:27:54 +0000</pubDate>
		<dc:creator>Peter Thorstenson</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Sample code]]></category>

		<guid isPermaLink="false">http://tamspalm.tamoggemon.com/2007/08/29/globals-in-das/</guid>
		<description><![CDATA[Everybody who has tried to make DAs (Desk Accessories) knows you can&#8217;t use global variables in the code. There are ways to go around that problem, of course, but all I have seen are either slow, like reading and writing to databases, or complicated to use, like using Feature Memory (I never figured out how [...]]]></description>
			<content:encoded><![CDATA[<p>Everybody who has tried to make DAs (Desk Accessories) knows you can&#8217;t use global variables in the code. There are ways to go around that problem, of course, but all I have seen are either slow, like reading and writing to databases, or complicated to use, like using Feature Memory (I never figured out how to read from it!). The easiest way I found is to use Application-Defined Features to store pointers to variables in Dynamic Heap. It practically gives you real global variables to use in your DA! This is how it works:</p>
<p>1. Define your application creator<br />
<code>#define DACREATOR	        'myDA'</code></p>
<p>2. Define a the name of your feature ID giving it a unique number. To make it real easy, give it a name reminding of the global which pointer it will contain. I put an &#8220;f&#8221; in front of it.<br />
<code>#define fBuffer	        1</code></p>
<p>3. For ease of use, put in the following two functions already published on TamsPalm:<br />
<code>//------------------------------------<br />
MemPtr malloc(UInt16 size) {<br />
  MemHandle h = MemHandleNew(size);<br />
  if (!h) {<br />
    return NULL;<br />
  }<br />
  return (MemPtr) MemHandleLock(h);<br />
}</code></p>
<p><code>//------------------------------------<br />
void free(MemPtr ptr) {<br />
  MemHandle h = MemPtrRecoverHandle(ptr);<br />
  if(!h) return;<br />
  MemHandleUnlock(h);<br />
  MemHandleFree(h);<br />
  ptr = NULL;<br />
}</code></p>
<p>4. Put in two functions that will make it easy to set and get the App Defined Feature which will contain the pointers to the globals.<br />
<code>// ------------------------------------<br />
UInt32 GetFtr(UInt16 ftrID){<br />
  UInt32 test=0;<br />
  Err e=FtrGet(DACREATOR, ftrID, &#038;test);<br />
  if (e!=0){<br />
    FtrSet(DACREATOR, ftrID, 0);<br />
    test=0;<br />
  }<br />
  return test;<br />
}</code></p>
<p><code>// ------------------------------------<br />
void SetFtr(UInt16 ftrID, UInt32 val){<br />
  FtrSet(DACREATOR, ftrID, val);<br />
}</code></p>
<p>5. Declare your global variable and place them in the Dynamic Heap. To use the Dynamic Heap is really cool. You can almost put as much as you like up there without affecting the stack which has a limited space already used by the app running when the DA is launched.<br />
<code>char *Buffer=malloc(32000);</code></p>
<p>6. Set the pointer as a feature value.<br />
<code>SetFtr(fBuffer, (UInt32)Buffer);</code></p>
<p>7. To access the global variable in your functions, you need to get the pointer to it. That is done like this:<br />
<code>char *Buffer=GetFtr(fBuffer);<br />
StrCopy(Buffer,"Hello!");</code></p>
<p>or even use it directly as in this example:<br />
<code>StrCopy((char *)GetFtr(fBuffer),"Hello!");</code></p>
<p>8. When quitting the DA, you need to free the global variable. Don&#8217;t forget it! It&#8217;s more important for a DA than for normal app. Quitting a normal app releases the variables but quitting a DA does not.<br />
<code>free((char *)GetFtr(fBuffer));</code></p>
<p>That&#8217;s it. It&#8217;s easy, fast, powerful, and safe. It also works with structures, so you can easily have your DAappPrefs available in all functions. If you want to see how it works in a real DA, have a look at the thumbboardDA code.</p>
]]></content:encoded>
			<wfw:commentRss>http://tamspalm.tamoggemon.com/2007/08/29/globals-in-das/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>C gotchas for free: CERT C Programming Language Secure Coding Standard</title>
		<link>http://tamspalm.tamoggemon.com/2007/08/13/c-gotchas-for-free-cert-c-programming-language-secure-coding-standard/</link>
		<comments>http://tamspalm.tamoggemon.com/2007/08/13/c-gotchas-for-free-cert-c-programming-language-secure-coding-standard/#comments</comments>
		<pubDate>Mon, 13 Aug 2007 20:05:29 +0000</pubDate>
		<dc:creator>Tam Hanna, Site Founder</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Sample code]]></category>

		<guid isPermaLink="false">http://tamspalm.tamoggemon.com/2007/08/13/c-gotchas-for-free-cert-c-programming-language-secure-coding-standard/</guid>
		<description><![CDATA[While googling for something more-less unrelated, I stumbled upon this link which really is worth its price in gold:
https://www.securecoding.cert.org/confluence/display/seccode/CERT+C+Programming+Language+Secure+Coding+Standard
To cut a long story short, the CERT has posted a list of common C gotchas there. No, not the kind of gotchas you can find in a beginner&#8217;s book&#8230;but real gotchas from everyday development/porting work.
Take a [...]]]></description>
			<content:encoded><![CDATA[<p>While googling for something more-less unrelated, I stumbled upon this link which really is worth its price in gold:<br />
<a href="https://www.securecoding.cert.org/confluence/display/seccode/CERT+C+Programming+Language+Secure+Coding+Standard">https://www.securecoding.cert.org/confluence/display/seccode/CERT+C+Programming+Language+Secure+Coding+Standard</a></p>
<p>To cut a long story short, the CERT has posted a list of common C gotchas there. No, not the kind of gotchas you can find in a beginner&#8217;s book&#8230;but real gotchas from everyday development/porting work.</p>
<p>Take a look by all means&#8230;and plucker it if you feel like it!</p>
]]></content:encoded>
			<wfw:commentRss>http://tamspalm.tamoggemon.com/2007/08/13/c-gotchas-for-free-cert-c-programming-language-secure-coding-standard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
