<?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>GuShH&#039;s Development Blog &#187; ascii</title>
	<atom:link href="http://gushh.net/blog/tag/ascii/feed/" rel="self" type="application/rss+xml" />
	<link>http://gushh.net/blog</link>
	<description>This blog is about software, electronics and game development.</description>
	<lastBuildDate>Wed, 08 Sep 2010 03:02:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Ascii helper routines, part 1</title>
		<link>http://gushh.net/blog/2008/06/11/ascii-helper-routines-part-1/</link>
		<comments>http://gushh.net/blog/2008/06/11/ascii-helper-routines-part-1/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 16:14:42 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ascii]]></category>
		<category><![CDATA[fiorenza]]></category>
		<category><![CDATA[GuShH]]></category>
		<category><![CDATA[is_alpha]]></category>
		<category><![CDATA[is_numeric]]></category>
		<category><![CDATA[is_symbol]]></category>
		<category><![CDATA[pb]]></category>
		<category><![CDATA[purebasic]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/index.php/2008/06/11/ascii-helper-routines-part-1/</guid>
		<description><![CDATA[Whenever I have to manipulate strings in PB, on a low-level (ie. per-character basis) I find it almost imperative to have the following routines included in my project: is_alpha(); is_numeric(); is_symbol(); They are amongst the most basic routines out there, however, they are still useful nonetheless. You can grab the include/source from here: http://gushh.net/dev/?file=pb/ascii_helpers.pb If [...]]]></description>
			<content:encoded><![CDATA[<!-- AdSense Now! V1.95 -->
<!-- Post[count: 3] -->
<div class="adsense adsense-leadin" style="text-align:center;margin: 12px;"><script type="text/javascript"><!--
google_ad_client = "pub-2462949361920197";
/* 468x15, created 4/6/10 */
google_ad_slot = "8315313616";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p>Whenever I have to manipulate strings in PB, on a low-level (ie. per-character basis) I find it almost imperative to have the following routines included in my project:</p>
<pre> is_alpha(); is_numeric(); is_symbol();</pre>
<p>They are amongst the most basic routines out there, however, they are still useful nonetheless.</p>
<p>You can grab the include/source from here:  <a href="http://gushh.net/dev/?file=pb/ascii_helpers.pb"><span style="font-family: 'Lucida Grande'; font-size: 12px; line-height: normal; white-space: pre" class="Apple-style-span">http://gushh.net/dev/?file=pb/ascii_helpers.pb</span></a></p>
<p>If you&#8217;re working on a Lexer, Parser, or similar&#8230; this will come in handy in case you don&#8217;t have it already.</p>
<p>Cheers.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://gushh.net/blog/2008/03/03/faster-ways-of-finding-a-character-inside-a-string-in-purebasic/" rel="bookmark" class="crp_title">Faster ways of finding a character inside a string, in PureBasic.</a></li><li><a href="http://gushh.net/blog/2009/09/05/automatic-declare-tool/" rel="bookmark" class="crp_title">Declar&#8217;em! &#8211; Automatic declaration of procedures.</a></li><li><a href="http://gushh.net/blog/2008/06/11/strescape-strquotemeta-from-php-to-pb-quotemeta-addslashes/" rel="bookmark" class="crp_title">StrEscape, StrQuoteMeta From PHP to PB. (quotemeta, addslashes)</a></li><li><a href="http://gushh.net/blog/2009/07/28/guitar-rig-3-a-couple-of-helpful-tools/" rel="bookmark" class="crp_title">Guitar Rig 3 &#8211; A couple of helpful tools.</a></li><li><a href="http://gushh.net/blog/2007/08/21/proper-coding-and-project-organization-part-1/" rel="bookmark" class="crp_title">Proper coding and project organization (Part 1)</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/2008/06/11/ascii-helper-routines-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Faster ways of finding a character inside a string, in PureBasic.</title>
		<link>http://gushh.net/blog/2008/03/03/faster-ways-of-finding-a-character-inside-a-string-in-purebasic/</link>
		<comments>http://gushh.net/blog/2008/03/03/faster-ways-of-finding-a-character-inside-a-string-in-purebasic/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 07:20:03 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PureBasic]]></category>
		<category><![CDATA[ascii]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[char]]></category>
		<category><![CDATA[findchar]]></category>
		<category><![CDATA[findstring]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[purebasic]]></category>
		<category><![CDATA[string manipulation]]></category>
		<category><![CDATA[unicode]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/index.php/2008/03/03/faster-ways-of-finding-a-character-inside-a-string-in-purebasic/</guid>
		<description><![CDATA[For those of you who either prototype or work with PureBasic on a daily basis, if you ever found yourself looking for faster ways of performing string manipulation, while still using the string system this language provides, be glad for I&#8217;ll be posting a few of my solutions to speed up the process. My first [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who either prototype or work with PureBasic on a daily basis, if you ever found yourself looking for faster ways of performing string manipulation, while still using the string system this language provides, be glad for I&#8217;ll be posting a few of my solutions to speed up the process.</p>
<p>My first entry is the FindChar() routine. Unlike the official FindString(), this one only searches for a single character. In situations where you&#8217;ll be dealing with single character string searches rather than multi-character, this routine will give you up to 2x speed increase in both Ascii and Unicode modes. Worst case scenario, you&#8217;ll get equal results speed-wise.</p>
<p align="center"><strong>The <em>FindChar() </em></strong><strong> code can be found at &gt; <a href="http://gushh.net/src.php?file=pb/FindChar.pb" target="_blank">here</a><a href="http://gushh.net/src.php?file=pb/FindChar.pb" target="_blank"><span style="font-weight: bold"></span></a> &lt;</strong></p>
<p align="center"><span id="more-16"></span></p>
<p>Due to the fact that Unicode characters are 2bytes long, we must use SizeOf() to perform certain displacement operations. However, this implies the use of at least one division for our final result, this will slow things down in the long-run. So, instead, we hack ourselves into a nastier method and we thank the FPU for it (granted, multiply by 0.5, since we know the character size is constant at 2) As nasty as it is, this allows us to outperform the official routine by almost 2x, still in Unicode.</p>
<p>There are certain things to take care of before doing anything with my routines, and this includes making sure we pass a valid string pointer, while ensuring we never pass negative displacement values and that we don&#8217;t attempt to displace over the limits of the string. Any self-respectable coder will do this before calling any routine, though. If you want an extra push of speed, get rid of the main IF statement in the routine.</p>
<p align="center">The ideal solution for this language would be to trash the actual string library and replace it with a proper one, but I fear this is a task for the author, not us. I also fear, we won&#8217;t be seeing this any time soon. So we might as well keep on sharing our solutions and &#8220;hope&#8221; the author reads a few books on proper software development, and that he understands them.</p>
<p style="font-style: italic">For those of you using Unicode, please beware that this routine has not been extensively tested on a production level. Even though it behaves equally to FindString(), I recommend you to perform at least a few tests before plugging this routine right into your main-code. It&#8217;s worth noting though, most of my string routines work on 0-based displacements but output equally to the official PB ones.</p>
<p align="left"><em> One of this days I&#8217;ll probably end up ranting quite badly on the fact that this sort of languages lack standad support for some really important routines&#8230; On the bright side, they provide quick means of prototyping small pieces of code before getting into production with your main language. Even so, theres no escape on the fact that the author lacks the real-world development experience to provide better solutions for his own product. </em></p>
<p align="left">&nbsp;</p>
<p> That&#8217;s it for now, I&#8217;ll be sharing more as I find time to post in here. Most of the rutines are being used on my in-house XML parser, just so you know. All benchmarks were done on multiple processors and results were averaged on a set of 20 tries per test.</p>
<p>Cheers.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://gushh.net/blog/2008/03/30/url-encoding-in-purebasic-the-proper-way/" rel="bookmark" class="crp_title">URL Encoding in PureBasic, the proper way.</a></li><li><a href="http://gushh.net/blog/2008/06/11/ascii-helper-routines-part-1/" rel="bookmark" class="crp_title">Ascii helper routines, part 1</a></li><li><a href="http://gushh.net/blog/2009/09/05/automatic-declare-tool/" rel="bookmark" class="crp_title">Declar&#8217;em! &#8211; Automatic declaration of procedures.</a></li><li><a href="http://gushh.net/blog/2007/08/21/proper-coding-and-project-organization-part-1/" rel="bookmark" class="crp_title">Proper coding and project organization (Part 1)</a></li><li><a href="http://gushh.net/blog/2008/06/12/game-proxy-theories/" rel="bookmark" class="crp_title">Game Proxy Theories, Problems and Solutions.</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/2008/03/03/faster-ways-of-finding-a-character-inside-a-string-in-purebasic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
