From: Wolfgang K. <wol...@xm...> - 2009-10-11 13:55:51
|
It seems that the pop2 instruction is used to clean up the stack here. Your code computes minimum and maximum of two values but simply ignores the computed value. To remove this computation result pop2 seems to be used. Until we implement the missing instruction you can simply assign the results from the calls to Math.min and Math.max to variables. In my case this removed the pop2 from the class file. One last thing: Could you please upload a patch file for your additions to Math.m/h to our review site (http://xmlvm-reviews.appspot.com/) or create a patch and send that instead of sending the whole files? This makes it easier to merge in case if concurrent modifications. -- Wolfgang Joseph Rukshan Fonseka wrote: > Hi, yes I did. I fixed the pow function name as suggested by Bjorn. I > have managed to compile it, but fails during linking. Attached is my > maths file and android source code. > > The compile error I get is: > > w.o obj/org_xmlvm_iphone_UITouch.o obj/org_xmlvm_iphone_UIView.o > obj/org_xmlvm_iphone_UIWindow.o obj/org_xmlvm_iphone_gl_BufferUtils.o > obj/org_xmlvm_iphone_gl_CAEAGLLayer.o > obj/org_xmlvm_iphone_gl_EAGLContext.o > obj/org_xmlvm_iphone_gl_EAGLDrawable.o obj/org_xmlvm_iphone_gl_GL.o > obj/org_xmlvm_iphone_gl_GLView.o obj/xmlvm.o > Undefined symbols: > "_ERROR", referenced from: > -[com_home_imageviewer_ImageViewer > onCreate___android_os_Bundle:] in com_home_imageviewer_ImageViewer.o > -[com_home_imageviewer_ImageViewer > onCreate___android_os_Bundle:] in com_home_imageviewer_ImageViewer.o > ld: symbol(s) not found > collect2: ld returned 1 exit status > make: *** [build/test.app/test] Error 1 > > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > > > On 11/10/2009, at 6:09 PM, Wolfgang Korn wrote: > >> Did you run the ant script to rebuild the library jars after >> implementing these Math methods? If yes - please send me a patch file >> with your implementation so that it is a little bit easier for me to >> add things to my workspace. Then I will have a look at what's going >> wrong and come back to as soon as possible. >> >> -- Wolfgang >> >> >> Joseph Rukshan Fonseka wrote: >>> Ok I added these to java_lang_Math.m >>> + (float) pow___float: (float) x : (float) y >>> { >>> return pow(x, y); >>> } >>> >>> + (double) pow___double: (double) x : (double) y >>> { >>> return pow(x, y); >>> } >>> + (float) max___float_float :(float) x :(float) y >>> { >>> return x < y ? y : x; >>> } >>> >>> + (double) max___double_double :(double) x :(double) y >>> { >>> return x < y ? y : x; >>> } >>> >>> + (int) max___int_int :(int) x :(int) y >>> { >>> return x < y ? y : x; >>> } >>> >>> + (float) min___float_float :(float) x :(float) y >>> { >>> return x > y ? y : x; >>> } >>> >>> + (double) min___double_double :(double) x :(double) y >>> { >>> return x > y ? y : x; >>> } >>> >>> + (int) min___int_int :(int) x :(int) y >>> { >>> return x > y ? y : x; >>> } >>> >>> and corresponding prototypes to the header file. >>> >>> However this android code: >>> public class ImageViewer extends Activity { >>> /** Called when the activity is first created. */ >>> @SuppressWarnings("deprecation") >>> @Override >>> public void onCreate(Bundle savedInstanceState) { >>> super.onCreate(savedInstanceState); >>> >>> AbsoluteLayout layout = new AbsoluteLayout(this); >>> layout.setLayoutParams(new >>> LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); >>> ImageView viewer = new ImageView(this); >>> viewer.setImageResource(R.drawable.cat); >>> layout.addView(viewer, new >>> AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT, >>> AbsoluteLayout.LayoutParams.WRAP_CONTENT, 0, 100)); >>> TextView text = new TextView(this); >>> layout.addView(text, new >>> AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT, >>> AbsoluteLayout.LayoutParams.WRAP_CONTENT, 0, 0)); >>> setContentView(layout); >>> >>> Math.pow(1.5,2*5); >>> Math.min(1.2, 3.0); >>> Math.max(3.4, 4.5); >>> } >>> } >>> >>> However cross compiling to iphone give me this error message: >>> com_home_imageviewer_ImageViewer.m:131: warning: ‘java_lang_Math’ >>> may not respond to ‘+pow___double_double::’ >>> com_home_imageviewer_ImageViewer.m:131: warning: (Messages without a >>> matching method signature >>> com_home_imageviewer_ImageViewer.m:131: warning: will be assumed to >>> return ‘id’ and accept >>> com_home_imageviewer_ImageViewer.m:131: warning: ‘...’ as arguments.) >>> com_home_imageviewer_ImageViewer.m:131: error: incompatible types in >>> assignment >>> com_home_imageviewer_ImageViewer.m:133: warning: implicit >>> declaration of function ‘ERROR’ >>> >>> >>> I am pretty confident it is due to the Math functions I am calling >>> at the end of my activity. Any idea what I am doing wrong? >>> >>> >>> On 09/10/2009, at 2:48 AM, Joseph Rukshan Fonseka wrote: >>> >>>> Ok I tried to convert an android application to iphone and noticed >>>> quite a few of the Maths functions don't compile such as >>>> >>>> Math.max() >>>> Math.min() >>>> Math.pow() >>>> >>>> I am guessing they aren't supported yet? I would like to extend the >>>> Maths library to have these functions. Which file should I be looking >>>> at to add these? >>>> >>>> Regards, >>>> Rukshan Fonseka. >>>> >>>> ------------------------------------------------------------------------------ >>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >>>> is the only developer event you need to attend this year. Jumpstart >>>> your >>>> developing skills, take BlackBerry mobile applications to market >>>> and stay >>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now! >>>> http://p.sf.net/sfu/devconference >>>> _______________________________________________ >>>> xmlvm-users mailing list >>>> xml...@li... >>>> <mailto:xml...@li...> >>>> https://lists.sourceforge.net/lists/listinfo/xmlvm-users >>> >>> ------------------------------------------------------------------------ >>> >>> ------------------------------------------------------------------------------ >>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >>> is the only developer event you need to attend this year. Jumpstart your >>> developing skills, take BlackBerry mobile applications to market and stay >>> ahead of the curve. Join us from November 9 - 12, 2009. Register now! >>> http://p.sf.net/sfu/devconference >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> xmlvm-users mailing list >>> xml...@li... >>> https://lists.sourceforge.net/lists/listinfo/xmlvm-users >>> >> >> >> ------------------------------------------------------------------------------ >> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >> is the only developer event you need to attend this year. Jumpstart your >> developing skills, take BlackBerry mobile applications to market and >> stay >> ahead of the curve. Join us from November 9 - 12, 2009. Register now! >> http://p.sf.net/sfu/devconference_______________________________________________ >> xmlvm-users mailing list >> xml...@li... >> https://lists.sourceforge.net/lists/listinfo/xmlvm-users > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > ------------------------------------------------------------------------ > > _______________________________________________ > xmlvm-users mailing list > xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlvm-users > |