<?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>eclipse &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<atom:link href="https://blog.sephiroth.it/tag/eclipse/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.sephiroth.it</link>
	<description>programmer by pure chance</description>
	<lastBuildDate>Sat, 22 Oct 2022 07:28:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://blog.sephiroth.it/wp-content/uploads/2019/03/cropped-sepy-big-32x32.png</url>
	<title>eclipse &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<link>https://blog.sephiroth.it</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How-to debug native code with Android</title>
		<link>https://blog.sephiroth.it/2010/12/14/how-to-debug-native-code-with-android/</link>
					<comments>https://blog.sephiroth.it/2010/12/14/how-to-debug-native-code-with-android/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Tue, 14 Dec 2010 14:01:39 +0000</pubDate>
				<category><![CDATA[android]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[native]]></category>
		<category><![CDATA[ndk]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[sequoyah]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1416</guid>

					<description><![CDATA[This is a step by step guide for executing and debugging native code on Android with Eclipse. 1. Prerequisites The SDK version used for this guide is Froyo with the NDK r4b ( crystax release ). Also Eclipse CDT plugin it&#8217;s very useful for our purposes, so install it. Last plugin to install it&#8217;s the &#8230; <a href="https://blog.sephiroth.it/2010/12/14/how-to-debug-native-code-with-android/" class="more-link">Continue reading <span class="screen-reader-text">How-to debug native code with Android</span></a>]]></description>
										<content:encoded><![CDATA[<p>This is a step by step guide for executing and debugging native code on Android with Eclipse.</p>
<h3>1. Prerequisites</h3>
<p>The <a href="http://developer.android.com/sdk/index.html">SDK</a> version used for this guide is Froyo with the NDK r4b ( <a href="3http://www.crystax.net/android/ndk-r4.php">crystax release</a> ).<br />
Also <a href="http://www.eclipse.org/cdt/downloads.php">Eclipse CDT</a> plugin it&#8217;s very useful for our purposes, so install it.<br />
Last plugin to install it&#8217;s the <a href="http://www.eclipse.org/sequoyah/downloads/index.php">Sequoyah</a> plugin for Eclipse.</p>
<h3>2. Project setup</h3>
<p><a href="https://blog.sephiroth.it/wp-content/uploads/2010/12/Screen-shot-2010-12-13-at-11.24.20.png"><img decoding="async" class="alignleft size-thumbnail wp-image-1422" title="android project setup" src="https://blog.sephiroth.it/wp-content/uploads/2010/12/Screen-shot-2010-12-13-at-11.24.20-150x150.png" alt="" width="150" height="150"/></a>At this point let&#8217;s create a new Android project, name it &#8220;Example&#8221; and use the &#8220;com.darkwavegames.com&#8221; package name, add also an Activity name of your choice.<br />
Select Android 2.2 as base SDK version and complete the project wizard.</p>
<p>Now you need to add the native support for the newly created project. Just right click on the project root element in the package explorer and select &#8220;add native support&#8221;.<a href="https://blog.sephiroth.it/wp-content/uploads/2010/12/Screen-shot-2010-12-13-at-11.29.15.png"><img decoding="async" class="alignright size-thumbnail wp-image-1424" title="add native support" src="https://blog.sephiroth.it/wp-content/uploads/2010/12/Screen-shot-2010-12-13-at-11.29.15-150x150.png" alt="" width="150" height="150"/></a></p>
<p>In the next dialog write the path of your NDK folder and give also name for your library.<br />
After this operation a new folder &#8220;jni&#8221; will be created with a .cpp file, header filer and an Android makefile, Android.mk, which can be edited to modify all the includes, linker and compiler options. In the Android.mk file you also need to specify all the source file you want to use within the LOCAL_SRC_FILE directive.</p>
<h3>3. Debug</h3>
<p>In order to enable debug of native code in Android you have to face different problems, based also on the device and the firmware version, and if the native code is multi thread or single thread.<br />
First of all you need to mofify the <strong>AndroidManifest.xml</strong> file adding the attribute &#8220;debuggable&#8221; to true ( remember also to enable the &#8220;Debug USB&#8221; option under the Application device menu ).<br />
At this point you can debug all the java code within your eclipse debugger, for for the native C debug you need more steps.</p>
<p><span id="more-1416"></span></p>
<h3>3.1 Rooting</h3>
<p>In case one of the below prerequisites are not available you need to root the device. For most of the device you just need to download from the market the application <a href="http://www.google.com/search?ie=UTF-8&amp;oe=UTF-8&amp;sourceid=navclient&amp;gfns=1&amp;q=z4root">z4root</a>.</p>
<h3>3.2 PackageManagerService</h3>
<p>The first thing needed in order to let the gdb-debug script works is the presence of the &#8220;<em>com.android.server.PackageManagerServices</em>&#8221; service on the device. This serve generates, for each installed application, a new entry inside the &#8220;<em>/data/system/packages.list</em>&#8221; file.<br />
This file is used by the the &#8220;<strong>run-as</strong>&#8221; command to know the process privileges and its folder content.<br />
If on your device this service is unavailable you need to create one.</p>
<p><em>( Just skip this step if you have the PackageManagerService on your device )</em><br />
The file format is very simple. every line has 4 columns: package name, user id, debug flasg (&#8220;0&#8221; or &#8220;1&#8221;), applicatio folder.<br />
You can do this: from Eclipse install the application just using the &#8220;Run as&#8221; command ( or via shell writing: adb install package.apk ). Now in a new terminal window write:</p>
<p>[cc]host:~ $ adb shell ps | grep com.darkwavegames.esempio[/cc]</p>
<p>First output entry will be the user associated with that process ( let&#8217;s say app_42 ). In order to obtain the user_id simply write:</p>
<p>[cc]host:~ $ adb shell su app_42[/cc]</p>
<p>Just copy the output ( which is the user_id, for instance 10042 ) and exit from shell ( using &#8220;exit&#8221; command).<br />
Now we have to get the app folder. Unfortunately the /data/data folder is protected, so you need to log into the device and obtain root access.</p>
<p>[cc]host:~ $ adb shell su<br />
# cd /data/data<br />
# ls -l -h[/cc]</p>
<p>Look for the folder&nbsp; associated to our user ( in our example is: com.darkwavegames.esempio ).<br />
Now we have all the informations for creating an entry for the packages.list:</p>
<p>[cc]host:~ $ adb shell su<br />
# cd /data/system<br />
# echo com.darkwavegames.esempio 10042 1 /data/data/com.darkwavegames.esempio &gt; packages.list[/cc]</p>
<p>Now the run-as command will find all the required informations.<strong><br />
<em>Note</em></strong><em> that in case you uninstall and reinstall the application you need to to repeat this steps because the system could have assigned a new user_id to that application.<br />
</em>Now you should be able to run the ndk-gdb script ( executing it inside the project folder ) and set breakpoints on the native code.</p>
<h3>3.3 NDK-GDB</h3>
<p>At this point starting ndk-gdb from the project folder should be enough. If you&#8217;ve verified all the above prerequisites and your code is simgle thread this should be enough.<br />
Instead, if your native code is multi thread, the gdbserver which comes with the r4b can&#8217;t debug your code ( probably it has been compiled without the multi thread <a href="http://code.google.com/p/android/issues/detail?id=9713">support</a> ).</p>
<p>In this case you need to obtain from the android repository <strong>git://android.git.kernel.org/platform/prebuilt.git</strong> the &#8220;prebuilt&#8221; folder of the SDK. Now that you have download it into your <strong>$PREBUILT</strong> folder you need to download the gdbserver with multi thread support from <a href="http://android.git.kernel.org/?p=platform/prebuilt. git;a=blob_plain;f=android-arm/gdbserver/gdbserver;hb= d4f4703a1b23e6a73becec455c3d561ae3829a65">this link</a>.<br />
Copy the gdbserver just downoaded into folder $ANDROID NDK PATH/build/prebuilt/$HOST ARCH/arm-eabi-4.4.0/bin where $HOST_ARCH is your developement architecture ( darwin-x86 if you&#8217;re with mac osx ).<br />
Copy $PREBUILT/$HOST ARCH/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gdb into $ANDROID NDK PATH/build/prebuilt/$HOST ARCH/arm-eabi-4.4.0/bin and use it as debugger.<br />
We&#8217;re close to the goal!</p>
<p>Now modify the &#8220;install-binary.mk&#8221; script inside $ANDROID_NDK_PATH and change the line</p>
<p>[cc]$(call cmd-strip, $(PRIVATE_DST))[/cc]</p>
<p>into</p>
<p>[cc]ifneq ($(APP_OPTIM),debug)<br />
$(call cmd-strip, $(PRIVATE_DST))<br />
endif[/cc]</p>
<p>In this way, if in out Android.mk file there&#8217;s a directive APP_OPTIM with the value &#8220;debug&#8221;, the symbol strip will not be executed.</p>
<p>Now in order to have the debug running we need to add a breakpoint in the <strong>Java</strong> code just before the <strong>System.loadLibrary()</strong> method and start a new debug session from Eclipse.<br />
As the code reach the breakpoint, open the terminal, enter the project folder and write these commands:</p>
<p>[cc]host:~ $ adb shell ps | grep com.darkwavegames.esempio app_42 4512 2377 648 332 c0318ffc afd0eafc S com.d&#8230;<br />
host:~ $ adb shell<br />
$ su<br />
# cd /data/data/com.darkwavegames.esempio/lib<br />
# ./gdbserver :5039 &#8211;attach 4512[/cc]</p>
<p>Without close terminal, open a new termina window and execute:</p>
<p>[cc]host:~ $ cd workspace/esempio<br />
host:esempio $ adb forward tcp:5039 tcp:5039<br />
host:esempio $ adb pull /system/bin/app_process \<br />
obj/local/armeabi/app_process<br />
host:esempio $ adb pull /system/lib/libc.so \<br />
obj/local/armeabi/libc.so<br />
host:esempio $ export NDK_BIN=$ANDROID_NDK_ROOT/build/prebuilt<br />
host:esempio $ $NDK_BIN/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-gdb \ -x obj/local/armeabi/gdb.setup -e obj/local/armeabi/app_process[/cc]</p>
<p>gdb.setup is generated by the ndk-gdb, but is created into the libs/armeabi folder. It&#8217;s important to copy it into the &#8220;obj&#8221; folder and add the line &#8220;target remote :5039&#8221;.<br />
Now from the gdb prompt it&#8217;s possible to add breakpoints and execute all the debug <a href="http://www.eecs.umich.edu/~sugih/pointers/summary.html" target="_blank" rel="noopener">instructions</a> such as step into, over, continue&#8230;</p>
<p><strong>All these steps</strong> are included in the &#8220;<a href="https://blog.sephiroth.it/wp-content/uploads/2010/12/remotegdb.sh.zip">remotegdb.sh</a>&#8221; file, so you don&#8217;t need to write all these commands every time! Just execute this script in the project folder ( the same folder where the AndroidManifest.xml is located ).</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2010/12/14/how-to-debug-native-code-with-android/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>Disable asset compression with Android aapt</title>
		<link>https://blog.sephiroth.it/2010/10/09/disable-asset-compression-with-android-aapt/</link>
					<comments>https://blog.sephiroth.it/2010/10/09/disable-asset-compression-with-android-aapt/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Sat, 09 Oct 2010 10:17:40 +0000</pubDate>
				<category><![CDATA[android]]></category>
		<category><![CDATA[aapt]]></category>
		<category><![CDATA[adt]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[eclipse]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1392</guid>

					<description><![CDATA[Trying to embed all the assets resources into my final apk was not so easy as I tought.. at least using the ADT Eclipse plugin for building project. In fact, using AssetManager.openFd to return to the C++ code a FileDescriptor does not work with compressed sources. When aapt compile the resources into the apk file &#8230; <a href="https://blog.sephiroth.it/2010/10/09/disable-asset-compression-with-android-aapt/" class="more-link">Continue reading <span class="screen-reader-text">Disable asset compression with Android aapt</span></a>]]></description>
										<content:encoded><![CDATA[<p>Trying to embed all the assets resources into my final apk was not so easy as I tought.. at least using the <a href="http://developer.android.com/sdk/eclipse-adt.html" target="_blank">ADT</a> Eclipse plugin for building project.<br />
In fact, using <a href="http://developer.android.com/reference/android/content/res/AssetManager.html#openFd(java.lang.String)">AssetManager.openFd</a> to return to the C++ code a FileDescriptor does not work with compressed sources.<br />
When <a href="http://developer.android.com/guide/developing/tools/aapt.html" target="_blank">aapt</a> compile the resources into the apk file it compress by default all the files which extensions are not recognized and those which recognize as text files.</p>
<p>These are the extensions not compressed:</p>
<p>[cc]<br />
static const char* kNoCompressExt[] = {<br />
&#8220;.jpg&#8221;, &#8220;.jpeg&#8221;, &#8220;.png&#8221;, &#8220;.gif&#8221;,<br />
 &#8220;.wav&#8221;, &#8220;.mp2&#8221;, &#8220;.mp3&#8221;, &#8220;.ogg&#8221;, &#8220;.aac&#8221;,<br />
 &#8220;.mpg&#8221;, &#8220;.mpeg&#8221;, &#8220;.mid&#8221;, &#8220;.midi&#8221;, &#8220;.smf&#8221;, &#8220;.jet&#8221;,<br />
 &#8220;.rtttl&#8221;, &#8220;.imy&#8221;, &#8220;.xmf&#8221;, &#8220;.mp4&#8221;, &#8220;.m4a&#8221;,<br />
 &#8220;.m4v&#8221;, &#8220;.3gp&#8221;, &#8220;.3gpp&#8221;, &#8220;.3g2&#8221;, &#8220;.3gpp2&#8221;,<br />
 &#8220;.amr&#8221;, &#8220;.awb&#8221;, &#8220;.wma&#8221;, &#8220;.wmv&#8221;<br />
};<br />
[/cc]</p>
<p>I was looking into the .project file of my Eclipse project but it seems that changing things inside that file ( like values into the tag ) does not affect the builder.</p>
<p>The first thing I tried was to remap the aapt executable using a shell script ( and renaming the original aapt file into _aapt ):</p>
<p>[cc]<br />
#!/bin/bash</p>
<p>strParams=&#8221;&#8221;<br />
CWD=’dirname $0’</p>
<p>for i in $@; do<br />
	if [ $i = &#8220;-S&#8221; ]; then<br />
		strParams=&#8221;$(echo $strParams) -v -0 \&#8221;\&#8221;&#8221;<br />
	fi<br />
	strParams=&#8221;$(echo $strParams) $i&#8221;<br />
done</p>
<p>tool=&#8221;$CWD/_aapt $strParams&#8221;<br />
$tool 1>&#038;2<br />
[/cc]</p>
<p>In fact, when building the project in eclipse I could see the whole output, but the files are still being compressed, even if I call the same command in a shell the assets aren’t compressed.<br />
I haven’t yet find a solution so for the meantime I decided to use ant to build my project overriding the default “-package-resources” target in this way:</p>
<p>[cce]<br />
    <target name="-package-resources"><br />
        <echo>Packaging resources</echo><br />
		<echo>${asset.absolute.dir}</echo><br />
        <aapt executable="${aapt}"<br />
                command=&#8221;package&#8221;<br />
				verbose=&#8221;${verbose}&#8221;<br />
                versioncode=&#8221;${version.code}&#8221;<br />
                manifest=&#8221;AndroidManifest.xml&#8221;<br />
                assets=&#8221;${asset.absolute.dir}&#8221;<br />
                androidjar=&#8221;${android.jar}&#8221;<br />
                apkfolder=&#8221;${out.absolute.dir}&#8221;<br />
                resourcefilename=&#8221;${resource.package.file.name}&#8221;<br />
                resourcefilter=&#8221;${aapt.resource.filter}&#8221;><br />
            <res path="${resource.absolute.dir}" /><br />
            <nocompress /></target></p>
<p>
[/cce]</p>
<p>In this way the project is being compiled correctly and all my assets are embedded not compressed!</p>
<p>P.S. my claim token is: 7C8AATS7Q5A3</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2010/10/09/disable-asset-compression-with-android-aapt/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Amethyst Actionscript editor</title>
		<link>https://blog.sephiroth.it/2010/05/25/amethyst-actionscript-editor/</link>
					<comments>https://blog.sephiroth.it/2010/05/25/amethyst-actionscript-editor/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Tue, 25 May 2010 15:44:10 +0000</pubDate>
				<category><![CDATA[general]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[visual studio]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=300</guid>

					<description><![CDATA[It&#8217;s since the first time I used Eclipse that I&#8217;m waiting for an actionscript editor non eclipse based! I never like eclipse and hated all its problems. Unfortunately Adobe decided to implement its editor over eclipse and also other nice editors, like fdt, used the eclipse framework to build their own editors. I used Visual &#8230; <a href="https://blog.sephiroth.it/2010/05/25/amethyst-actionscript-editor/" class="more-link">Continue reading <span class="screen-reader-text">Amethyst Actionscript editor</span></a>]]></description>
										<content:encoded><![CDATA[<p><a href="https://blog.sephiroth.it/wp-content/uploads/2010/05/flashplayer5.png"><img decoding="async" class="alignleft size-medium wp-image-361" style="margin: 5px; border: 1px solid black;" title="amethyst" src="https://blog.sephiroth.it/wp-content/uploads/2010/05/flashplayer5-300x117.png" alt="amethyst screenshot" width="300" height="117" srcset="https://blog.sephiroth.it/wp-content/uploads/2010/05/flashplayer5-300x117.png 300w, https://blog.sephiroth.it/wp-content/uploads/2010/05/flashplayer5-150x58.png 150w, https://blog.sephiroth.it/wp-content/uploads/2010/05/flashplayer5.png 581w" sizes="(max-width: 300px) 100vw, 300px" /></a>It&#8217;s since the first time I used <a title="Eclipse (software)" rel="ctag:means wikipedia" href="http://en.wikipedia.org/wiki/Eclipse_%28software%29">Eclipse</a> that I&#8217;m waiting for an actionscript editor non eclipse based!</p>
<div>I never like eclipse and hated all its problems.</div>
<div>Unfortunately <a title="NASDAQ: ADBE" rel="ctag:means googlefinance" href="http://www.google.com/finance?q=NASDAQ:ADBE">Adobe</a> decided to implement its editor over eclipse and also other nice editors, like fdt, used the eclipse framework to build their own editors.</div>
<div>I used <a title="Microsoft Visual Studio" rel="ctag:means wikipedia" href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio">Visual Studio</a> for a while but that was enough to make me fall in love with it.</div>
<div>Visual Studio is indeed the best editor at all, without doubts!</div>
<div>Finally I discovered an interesting project for editing actionscript projects integrated into Visual Studio.</div>
<div><a href="http://www.sapphiresteel.com/Amethyst-Product-Page">Amethyst</a> is still in beta and probably too premature to be used in large production environment, but it&#8217;s a great news for me.</div>
<div>I hope they&#8217;ll continue in the development and create a serious competitor for Flash Builder.</div>
<div>For more info visit their product page: <a href="http://www.sapphiresteel.com/Amethyst-Product-Page">http://www.sapphiresteel.com/Amethyst-Product-Page</a></div>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2010/05/25/amethyst-actionscript-editor/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>New Actionscript Editor coming?</title>
		<link>https://blog.sephiroth.it/2009/11/12/new-actionscript-editor-coming/</link>
					<comments>https://blog.sephiroth.it/2009/11/12/new-actionscript-editor-coming/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Thu, 12 Nov 2009 08:51:16 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[realaxy]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=283</guid>

					<description><![CDATA[See videos of an alpha editor from Realaxy:&#160;http://www.cleoag.ru/&#8230;-langru/ Hope not Eclipse based this time!]]></description>
										<content:encoded><![CDATA[<div><span style="font-family: 'Trebuchet MS', Tahoma, Arial; font-size: small;"><span style="font-size: 12px; line-height: 18px;"><span class="mt-enclosure mt-enclosure-image" style="display: inline;"> </span></span></span></div>
<div><span style="font-family: 'Trebuchet MS', Tahoma, Arial; font-size: 12px; line-height: 18px;"><a href="http://ve.m5yn67dl.vesrv.com/wp-content/uploads/2009/11/realaxy.png"><img loading="lazy" decoding="async" class="size-thumbnail wp-image-411 alignright" title="realaxy" src="http://ve.m5yn67dl.vesrv.com/wp-content/uploads/2009/11/realaxy-150x150.png" alt="" width="150" height="150" srcset="https://blog.sephiroth.it/wp-content/uploads/2009/11/realaxy-150x150.png 150w, https://blog.sephiroth.it/wp-content/uploads/2009/11/realaxy-64x64.png 64w" sizes="auto, (max-width: 150px) 100vw, 150px" /></a>See videos of an alpha editor from Realaxy: <span style="font-family: arial, helvetica, hirakakupro-w3, osaka, 'ms pgothic', sans-serif; font-size: 13px; line-height: normal;"><a style="text-decoration: underline;" href="http://www.cleoag.ru/2009/11/12/langenfew-secret-videos-langenlangru-langru/">http://www.cleoag.ru/&#8230;-langru/</a></span></span></div>
<div>
<div>Hope not Eclipse based this time!</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2009/11/12/new-actionscript-editor-coming/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>An experience with antlr, java and python</title>
		<link>https://blog.sephiroth.it/2006/12/01/an-experience-with-antlr-java-and-python/</link>
					<comments>https://blog.sephiroth.it/2006/12/01/an-experience-with-antlr-java-and-python/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Fri, 01 Dec 2006 19:09:11 +0000</pubDate>
				<category><![CDATA[general]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[antlr]]></category>
		<category><![CDATA[asdt]]></category>
		<category><![CDATA[bison]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[ecma]]></category>
		<category><![CDATA[gnu flex]]></category>
		<category><![CDATA[grammar]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[profiler]]></category>
		<category><![CDATA[psyco]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=187</guid>

					<description><![CDATA[I just wanted to share a little experience with generating an AS3 parser using antlr and python.I was trying first to create the parser using...
]]></description>
										<content:encoded><![CDATA[<p>I just wanted to share a little experience with generating an AS3 parser using <a href="http://www.antlr.org">antlr</a> and <a href="http://www.python.org">python</a>.<br />
I was trying first to create the parser using GNU <a title="gnu flex" href="http://www.gnu.org/software/flex/" target="_blank">Flex</a> and <a title="gnu bison" href="http://www.gnu.org/software/bison/" target="_blank">Bison</a> in C, probably the best way for a very performancing parser.<br />
Yeah, that&#8217;s right.. but looking at the antlr syntax I realized that&#8217;s easier and easier.<br />
Moreover I start using this very useful <a title="antlrstudio" href="http://www.placidsystems.com/antlrstudio.aspx" target="_blank">eclipse plugin</a> for antlr debugging which made my life easier!</p>
<p>The grammar file I created is a compromise between the <a title="as3.g" href="http://www.google.com/codesearch?hl=it&amp;q=+file:%5C.g%24+as3.g+show:gFeBx72kxIk:XKFG9i76Jiw:mSlmdOLa2XQ&amp;sa=N&amp;cd=1&amp;ct=rc&amp;cs_p=:pserver:anonymous%40aseclipseplugin.cvs.sourceforge.net:/cvsroot/aseclipseplugin+org.asdt.astview&amp;cs_f=src/org/asdt/core/internal/antlr/as3.g#a0" target="_blank">asdt grammar</a> file and the <a title="ECMA-262 specifications" href="http://www.ecma-international.org/publications/standards/Ecma-262.htm" target="_blank">ECMA-262 grammar</a> specification.</p>
<p>Once finished working on my eclipse project I&#8217;ve managed to parse succesfully all the adobe corelibs files using this java test file:<br />
<code lang="java">package org.sepy.core.parsers.as3;<br />
import java.io.File;<br />
import java.io.FileInputStream;<br />
import java.io.FileNotFoundException;<br />
import antlr.CommonAST;<br />
import antlr.RecognitionException;<br />
import antlr.TokenStreamException;<br />
public class Application {<br />
public static void main(String argv[])<br />
{<br />
if(argv.length &gt; 0)<br />
{<br />
File file = new File(argv[0]);<br />
if(file.exists())<br />
{<br />
FileInputStream is = null;<br />
try {<br />
is = new FileInputStream(file);<br />
} catch (FileNotFoundException e) {<br />
// TODO Auto-generated catch block<br />
e.printStackTrace();<br />
}<br />
AS3Lexer L = new AS3Lexer(is);<br />
AS3Parser P = new AS3Parser(L);<br />
try {<br />
P.compilationUnit();<br />
} catch (RecognitionException e) {<br />
// TODO Auto-generated catch block<br />
System.out.println(" line=" + e.line + ", column="+ e.column);<br />
System.out.println(e.getMessage());<br />
e.printStackTrace(System.err);<br />
} catch (TokenStreamException e) {<br />
// TODO Auto-generated catch block<br />
System.out.println(" line=" + L.getLine() + ", column="+ L.getColumn());<br />
System.out.println(L.getGuessInfo());<br />
System.out.println(e.getMessage());<br />
e.printStackTrace(System.err);<br />
}<br />
CommonAST.setVerboseStringConversion(false, P.getTokenNames());<br />
CommonAST ast = (CommonAST) P.getAST();<br />
System.out.println("Tree:");<br />
System.out.println(ast.toStringTree());<br />
}<br />
}<br />
}<br />
}</code><br />
Ok, done that I decided to export the grammar file for python (thanks to antrl python export feature).<br />
Everything works fine also for python, but I realized that the python script were so much slower than the java one!<br />
<code lang="python">import sys<br />
import antlr<br />
import AS3Parser<br />
import AS3Lexer<br />
L = AS3Lexer.Lexer(filename);<br />
P = AS3Parser.Parser(L);<br />
P.setFilename(filename)<br />
try:<br />
   P.compilationUnit();<br />
   ast = P.getAST();<br />
except:<br />
   pass<br />
</code><br />
On a 75Kb actionscript file the python script took about 7 seconds to run, while the java application only 2 seconds. I know python interpreter caould be slower than many other languages, but I never thought so much slower.<br />
So I run the python <a href="http://docs.python.org/lib/module-hotshot.html" target="_blank">hotshot profiler</a> to see which could be the bottleneck in the python script and I found most of the problems were due to unuseless antlr (the python module) method&#8217;s calls.<br />
After making corrections to the antlr.py file the same script took exactly half of the time. Now 3 seconds. Wow 🙂<br />
But not fast enough.<br />
So I enabled for the antlr python script <a href="http://psyco.sourceforge.net/" target="_blank">psyco</a> module and this time the same script took <strong>only 1.6 seconds.</strong><br />
Now the python script is fast enough, even if I&#8217;m sure I can make more optimizations in the antlr module&#8230;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2006/12/01/an-experience-with-antlr-java-and-python/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Flying away&#8230; holidays!!</title>
		<link>https://blog.sephiroth.it/2005/07/29/flying-away-holidays/</link>
					<comments>https://blog.sephiroth.it/2005/07/29/flying-away-holidays/#respond</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Sat, 30 Jul 2005 02:36:35 +0000</pubDate>
				<category><![CDATA[SEPY]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[holidays]]></category>
		<category><![CDATA[mtasc]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=96</guid>

					<description><![CDATA[Before leaving for my holidays i just want to make a quick post about the recent SE&#124;PY additions&#8230; 1. Quick search bar The new &#8220;quick search&#8221; bar at the bottom. Thanks to Eric Dolecki who suggested me a more usable and fast to use &#8220;search&#8221; control (thanks also to Eric new icons suggestions!) I use &#8230; <a href="https://blog.sephiroth.it/2005/07/29/flying-away-holidays/" class="more-link">Continue reading <span class="screen-reader-text">Flying away&#8230; holidays!!</span></a>]]></description>
										<content:encoded><![CDATA[<p>Before leaving for my holidays i just want to make a quick post about the recent SE|PY additions&#8230;</p>
<h2>1. Quick search bar</h2>
<figure id="attachment_651" aria-describedby="caption-attachment-651" style="width: 150px" class="wp-caption alignleft"><a href="https://blog.sephiroth.it/wp-content/uploads/2005/07/quick_search.gif"><img loading="lazy" decoding="async" class="size-thumbnail wp-image-651" title="quick search" src="https://blog.sephiroth.it/wp-content/uploads/2005/07/quick_search-150x84.gif" alt="" width="150" height="84" /></a><figcaption id="caption-attachment-651" class="wp-caption-text">sepy quick search</figcaption></figure>
<p>The new &#8220;quick search&#8221; bar at the bottom. Thanks to <a href="http://www.ericd.net">Eric Dolecki</a> who suggested me a more usable and fast to use &#8220;search&#8221; control (thanks also to Eric new icons suggestions!)<br />
I use <a href="http://www.mozilla.org/products/firefox/">Mozilla Firefox</a> from more than one year, i love the way it has implemented the find bar, and I never thought at using it in SEPY? yes.. that&#8217;s true 🙂</p>
<h2>2. Right border enhancement</h2>
<p><a href="https://blog.sephiroth.it/wp-content/uploads/2005/07/right_border.gif"><img loading="lazy" decoding="async" class="alignleft size-thumbnail wp-image-652" title="right border " src="https://blog.sephiroth.it/wp-content/uploads/2005/07/right_border-150x150.gif" alt="" width="150" height="150" srcset="https://blog.sephiroth.it/wp-content/uploads/2005/07/right_border-150x150.gif 150w, https://blog.sephiroth.it/wp-content/uploads/2005/07/right_border-64x64.gif 64w" sizes="auto, (max-width: 150px) 100vw, 150px" /></a>This is directly taken from an <a href="http://www.eclipse.org">Eclipse</a> feature i like a lot.<br />
For every bookmarked line or line with a &#8220;TODO&#8221; comment you will have in the right side of each document a small clickable rectangle, with different colors, which show you the absolute position of that line in the document.<br />
When you move the mouse over that rect you will see a tooltip telling you the content of the line and click on it for move to that line.<br />
Nothing particular, but I found it really useful.<br />
It&#8217;s now possible to customize the words SEPY is looking for (not only &#8220;todo&#8221;, but what you want)<br />
Moreover, with the last addition of a sqlite database once you open a document for the second time you will see all the previous bookmarked lines, and the cursor will be placed in the same position you previously closed the document.</p>
<h2>MTASC compile</h2>
<p><a href="https://blog.sephiroth.it/wp-content/uploads/2005/07/mtasc_frame.gif"><img loading="lazy" decoding="async" class="alignleft size-thumbnail wp-image-653" title="mtasc_frame" src="https://blog.sephiroth.it/wp-content/uploads/2005/07/mtasc_frame-150x150.gif" alt="" width="150" height="150" srcset="https://blog.sephiroth.it/wp-content/uploads/2005/07/mtasc_frame-150x150.gif 150w, https://blog.sephiroth.it/wp-content/uploads/2005/07/mtasc_frame-64x64.gif 64w" sizes="auto, (max-width: 150px) 100vw, 150px" /></a>Last addition is the <a href="http://www.mtasc.org">mtasc</a> compile dialog.<br />
Using this dialog window you can compile yuor script in SEPY using the mtasc compiler and see in the same dialog a preview of the created SWF.<br />
BTW, I will leave for my holidays on Monday (destination Tallinn, Estonia).<br />
See ya again by the end of August.. and great holidays to you all!!<br />
<a href="http://sourceforge.net/project/showfiles.php?group_id=90749&amp;package_id=114139">http://sourceforge.net/</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2005/07/29/flying-away-holidays/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Flash Platform Announcement</title>
		<link>https://blog.sephiroth.it/2005/06/06/flash-platform-announcement/</link>
					<comments>https://blog.sephiroth.it/2005/06/06/flash-platform-announcement/#respond</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Mon, 06 Jun 2005 19:53:17 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[platform]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=84</guid>

					<description><![CDATA[zorn
]]></description>
										<content:encoded><![CDATA[<p>This morning <a href="http://www.macromedia.com">Macromedia</a> made several press announcements regarding the Flash Platform, Flash Player, Macromedia’s support of the Eclipse Foundation, and an upcoming toolset for Flex development, code-named <span style="font-weight: bold;">Zorn</span>.</p>
<ul>
<li><a href="http://www.macromedia.com/macromedia/proom/pr/2005/unveiling_flashplatform.html">Flash Platform announcement</a></li>
<li><a href="http://www.macromedia.com/go/platform">Flash Platform microsite/info center</a></li>
<li><a href="http://www.macromedia.com/macromedia/proom/pr/2005/eclipse_flashplatform.html">Macromedia Joins the Eclipse Foundation</a></li>
<li><a href="http://www.macromedia.com/macromedia/proom/pr/2005/mobileecosystem_flashplatform.html">Mobile ecosystem &amp; the Flash Platform</a></li>
</ul>
<p><a href="http://www.macromedia.com/go/platform" target="_blank">http://www.macromedia.com/go/platform</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2005/06/06/flash-platform-announcement/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Update on SEPY 2</title>
		<link>https://blog.sephiroth.it/2005/05/06/update-on-sepy-2/</link>
					<comments>https://blog.sephiroth.it/2005/05/06/update-on-sepy-2/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Fri, 06 May 2005 19:59:57 +0000</pubDate>
				<category><![CDATA[SEPY]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[framework]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=80</guid>

					<description><![CDATA[sepy 2<br />
]]></description>
										<content:encoded><![CDATA[<p>As I announced some time ago the project for re-writing from scratch SEPY is already started..<br />
actually the framework is quite complete and at the state of art it&#8217;s a full basic text editor. Today I met Gabriele, the same guy who helped me in the preliminary phases of sepy1, and we decided some of the new SEPY2 guidelines and how we want to proceed..<br />
SE|PY 2 will be made using a similar, but more more simpler, process as the one used by Eclipse, that is plugin based.<br />
This can help us, but also everyone who want to extend it in the future, with panels (which will be completely independent from the main application), and document classes.<br />
As regarding panels we&#8217;re still thinking at the best solution for the workspace management.. maybe a solution similar to the one used by Macromedia software.<br />
any preference here?</p>
<p>BTW, the very first thing in the TODO list it&#8217;s indeed the autocompletion system, which must be written as powerful as possible, thus mantaining good performances. This is the first and the core feature, without that the editor could not live&#8230;</p>
<p>Other important features will be the support for Flex and all XML in general, maybe using DTD for the autocompletion (for xml files)&#8230;</p>
<p>If it will be possible, we have thought also in extending scintilla functionallity in order to have a custom lexer for &#8220;.as&#8221; files, with extended folding and colouring features.<br />
for example:<br />
//#region<br />
&#8230;<br />
//#endregion<br />
will create automatically folds region&#8230;</p>
<p>I hope that basing on the experienced I made with python in the last 2 years and thanks to all the feedback I received during this period to be able to create a better tool for developing flash..</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2005/05/06/update-on-sepy-2/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
