CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 124 users online: 4 members, 91 guests and 29 bots.
Members: flyingfisch, gudenau, tifreak8x.
Bots: VoilaBot (1), Magpie Crawler (3), VoilaBot (5), Googlebot (18), MSN/Bing (2).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
Author Message
Tari


Systems Integrator


Joined: 03 Jul 2006
Posts: 2107
Location: Always-winter, Michigan

Posted: 30 May 2012 08:29:52 pm    Post subject: libfxcg moves forward: libc and Python

There was discussion recently on the feasibility of porting Python to the Prizm. Merth and I have been working on implementing big chunks of the C library to support Python, then.

The fruits of those efforts have been accumulating in the pycompat branch, and at this point many of the harder functions are done (I just finished implementing the core of printf).

I have yet to really get things running on the device (mucked about with serial, but I need a scope to figure out what I need to do with that before things will really work), but most of the functions have been tested in a cross-hosted environment (that is, on a PC).

Because there's nothing terribly interesting to look at right now, here's a screenshot from testing printf:


Edit by Merth: I'm stickying this.
_________________


Ask questions the smart way · タリ
Back to top
TheStorm


NOU!


Joined: 26 Mar 2007
Posts: 2375

Posted: 30 May 2012 09:29:06 pm    Post subject:

For serial you might want to see if the source to FXTerm is available, it should have all the code you need to implement it.
_________________

"Always code as if the person who will maintain your code is a maniac serial killer that knows where you live" -Unknown

"If you've done something right no one will know that you've done anything at all" -Futurama

"Have a nice day, or not, the choice is yours." Tom Steiner

<Michael_V> or create a Borg collective and call it The 83+
<Michael_V> Lower your slide cases and prepare to be silent linked. Memory clears are futile.
Back to top
Tari


Systems Integrator


Joined: 03 Jul 2006
Posts: 2107
Location: Always-winter, Michigan

Posted: 30 May 2012 10:00:24 pm    Post subject:

I was looking at that earlier and forgot about it by the time I got home from work.

Looks like the source for fxterm isn't available, though.
_________________


Ask questions the smart way · タリ
Back to top
MPoupe


New Member


Joined: 24 Feb 2012
Posts: 77

Posted: 31 May 2012 04:18:29 am    Post subject:

TheStorm wrote:
For serial you might want to see if the source to FXTerm is available, it should have all the code you need to implement it.
FXTerm is in-process and I will release next version with sources.
If you need just serial communication, you can use CGPlayerA, it uses syscalls to access COM. Unfortunately it was deleted from cemetech archive, so there is only download at omnimaga (see http://www.omnimaga.org/index.php?topic=12700.0 ).
But I would recommend you to read Simon's great manual (fx_calculators_SuperH_based_xxx.chm)
Back to top
Tari


Systems Integrator


Joined: 03 Jul 2006
Posts: 2107
Location: Always-winter, Michigan

Posted: 31 May 2012 11:47:15 am    Post subject:

Indeed, I referred to the .chm documentation when documenting those on WikiPrizm and subsequently adding them to libfxcg.

As far as the docs go everything was working (nothing returned failure), I just couldn't see anything electrically, so I chalked it up to a hardware configuration issue- hence I need to poke at it with a scope.
_________________


Ask questions the smart way · タリ
Back to top
elfprince13


OVER NINE THOUSAND!


Joined: 23 May 2005
Posts: 10232
Location: A galaxy far far away......

Posted: 31 May 2012 04:22:18 pm    Post subject:

Which Python version are you aiming to support initially? This sounds like a cool project Very Happy
_________________
StickFigure Graphic Productions || VSHI: Vermont Sustainable Heating Initiative


Back to top
Tari


Systems Integrator


Joined: 03 Jul 2006
Posts: 2107
Location: Always-winter, Michigan

Posted: 31 May 2012 04:26:06 pm    Post subject:

I've been working against the latest 3.x release (3.2.3). I even found a bug and got it fixed.

I can get good chunks of it to build at this point, but it's rather unhappy about some Unicode things, which I'll have to investigate further.
_________________


Ask questions the smart way · タリ
Back to top
elfprince13


OVER NINE THOUSAND!


Joined: 23 May 2005
Posts: 10232
Location: A galaxy far far away......

Posted: 31 May 2012 05:23:40 pm    Post subject:

How difficult would it be to maintain a 2.7 build alongside it?
_________________
StickFigure Graphic Productions || VSHI: Vermont Sustainable Heating Initiative


Back to top
Tari


Systems Integrator


Joined: 03 Jul 2006
Posts: 2107
Location: Always-winter, Michigan

Posted: 03 Jun 2012 12:49:10 am    Post subject:

Turns out it shouldn't be too difficult to build 2.7 as well. I've hit a few more functions 2.7 depends on for compiling, but they're things that I'm sure need to be implemented at some point to get the thing to link (fseek..).

The unicode issues I was having stemmed from bad configure values, which have now been resolved.

Current stumbling block is the import machinery depending on a stat() implementation, which I'd rather not have to implement (I'm against making this thing look like a POSIX system). It feels like a regression since things indicate that defining DONT_HAVE_STAT should avoid using it, but I have yet to investigate the use of such in 3.x (I know 2.7 is using it to check if things are directories).
EDIT: after poking at it some, I think I'll have to implement stat(), but only in a very basic form.
_________________


Ask questions the smart way · タリ
Back to top
Tari


Systems Integrator


Joined: 03 Jul 2006
Posts: 2107
Location: Always-winter, Michigan

Posted: 04 Jun 2012 12:47:24 pm    Post subject:

I've updated the nightlies to track our pycompat branch rather than master, as nothing's changing on master.

Tarball: http://media.taricorp.net/libfxcg-latest.tar.bz2
Build log: http://media.taricorp.net/libfxcg-latest.log

Highlights:
  • Simpler build. Compiling libfxcg itself can be done simply with `make' from the root of the source tree, and fewer linker options are required when compiling your own programs.
  • Many standard library components: math functions, string manipulation (including printf!) and file I/O wrappers.
  • Better header and function names.
Yes, you read that right. You can now use fopen() and friends.

Caveats: big chunks of the I/O stuff (particularly file I/O) are untested. There are probably also corner cases in other functions that need to be worked out yet. I/O to the standard streams (stdin, stdout, stderr) is directed to the serial port, which I'm not sure if it works (again, untested code).

Setting up this bleeding-edge version on your old PrizmSDK 0.3 should be fairly easy:
  • Unpack the include directory to the SDK include directory. Overwrite files where prompted, but do not overwrite types.h (just skip that one).
  • Unpack the contents of the lib directory to the SDK lib directory. Overwrite where applicable.
  • Modify your makefiles to use libc. This should just be a matter of removing "-lfxcg" and "-nostdlib" from the CFLAGS and adding "-nostartfiles" to LDFLAGS.
Some programs will now fail to compile since we've been removing some crufty headers. In most cases you'll simply have to change inclusions- post for help in such a situation.

I strongly encourage everyone to try out these new features so I can fix the inevitable bugs and get feedback on the changes. Get to it!
_________________


Ask questions the smart way · タリ
Back to top
gbl08ma


Power User


Joined: 26 Nov 2011
Posts: 475
Location: Portugal

Posted: 05 Jun 2012 12:35:08 pm    Post subject:

libfxcg now supporting printf and fopen, etc. - sweet! Smile

printf will save me from using dozens of concat()s and itoa()s, and file I/O will make porting existing code much easier.

Are the old file I/O functions (syscalls) still supported? This is important to allow older code to build.
_________________
My blog, where I write about random things... | tiny URL shortener
View JPEG images on your Prizm | Utilities for the Casio Prizm - clock, stopwatch, calendar/agenda, add-in manager and more!
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55742
Location: Earth, Sol, Milky Way

Posted: 05 Jun 2012 12:36:26 pm    Post subject:

Yes, they are building this as a separate set of new features rather than removing any existing features/support, as far as I can tell. I agree that it's great both that we're getting a solid stdlib and that Python support may be here soon.
_________________


Back to top
gbl08ma


Power User


Joined: 26 Nov 2011
Posts: 475
Location: Portugal

Posted: 05 Jun 2012 12:51:09 pm    Post subject:

I don't think Python will be much faster than Basic with the exception that IMO it's a "better" language, that can also be written on the calculator if a text editor is ever developed.
_________________
My blog, where I write about random things... | tiny URL shortener
View JPEG images on your Prizm | Utilities for the Casio Prizm - clock, stopwatch, calendar/agenda, add-in manager and more!
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55742
Location: Earth, Sol, Milky Way

Posted: 05 Jun 2012 12:52:22 pm    Post subject:

gbl08ma wrote:
I don't think Python will be much faster than Basic with the exception that IMO it's a "better" language, that can also be written on the calculator if a text editor is ever developed.
I don't think it will be hugely faster either, but it will be able to run a vast set of existing programs, plus the fact that it's a language many people already know.
_________________


Back to top
gbl08ma


Power User


Joined: 26 Nov 2011
Posts: 475
Location: Portugal

Posted: 05 Jun 2012 01:15:49 pm    Post subject:

OK... my failure to pass a parameter to the tar command made types.h be overwritten. Does anyone have the previous one, or from where can I get it...?

EDIT: this time my backup system worked and I have a copy of the old file...
_________________
My blog, where I write about random things... | tiny URL shortener
View JPEG images on your Prizm | Utilities for the Casio Prizm - clock, stopwatch, calendar/agenda, add-in manager and more!
Back to top
Tari


Systems Integrator


Joined: 03 Jul 2006
Posts: 2107
Location: Always-winter, Michigan

Posted: 05 Jun 2012 01:33:16 pm    Post subject:

gbl08ma wrote:
Are the old file I/O functions (syscalls) still supported? This is important to allow older code to build.
Yes, all the raw syscalls are still available. I hope to maintain support for any old code that's out there as well, as I've outlined over on WikiPrizm.

KermMartian wrote:
gbl08ma wrote:
I don't think Python will be much faster than Basic with the exception that IMO it's a "better" language, that can also be written on the calculator if a text editor is ever developed.
I don't think it will be hugely faster either, but it will be able to run a vast set of existing programs, plus the fact that it's a language many people already know.
No argument with any of that, but don't forget that Python is much better for interfacing with native code. It's very easy to write extension modules, so Python can be much more powerful than BASIC.
_________________


Ask questions the smart way · タリ
Back to top
gbl08ma


Power User


Joined: 26 Nov 2011
Posts: 475
Location: Portugal

Posted: 05 Jun 2012 01:41:22 pm    Post subject:

OK, so as said on SAX, here are a list of things that need fixing:
* disp_tools.hpp is broken
* keyboard.hpp is lacking the definition for KEY_PRGM_0 (it should be 71)
* there are conflicting types for malloc and realloc in stdlib.h

And here's my build log for CGlock, with some errors caused by the new libfxcg and others caused by my code: http://pastebin.com/dBrcTPPF
_________________
My blog, where I write about random things... | tiny URL shortener
View JPEG images on your Prizm | Utilities for the Casio Prizm - clock, stopwatch, calendar/agenda, add-in manager and more!
Back to top
merthsoft


File Archiver


Joined: 09 May 2010
Posts: 2735

Posted: 05 Jun 2012 02:12:14 pm    Post subject:

gbl08ma wrote:
OK, so as said on SAX, here are a list of things that need fixing:
* disp_tools.hpp is broken
* keyboard.hpp is lacking the definition for KEY_PRGM_0 (it should be 71)
* there are conflicting types for malloc and realloc in stdlib.h

And here's my build log for CGlock, with some errors caused by the new libfxcg and others caused by my code: http://pastebin.com/dBrcTPPF

Wanna tell us what's "broken" about disp_tools.hpp? We can't fix something if we don't know the problem.
_________________
Shaun
Back to top
Tari


Systems Integrator


Joined: 03 Jul 2006
Posts: 2107
Location: Always-winter, Michigan

Posted: 05 Jun 2012 02:15:31 pm    Post subject:

It's there in the build log. Smile

The problem stems from the removal of headers that correspond to things which we don't have source for. My plan is to extract the relevant object files from the old libfxcg.a and throw them in git as straight-up blobs, then re-add the relevant headers with _FXCG_MINICOMPAT guards.
_________________


Ask questions the smart way · タリ
Back to top
merthsoft


File Archiver


Joined: 09 May 2010
Posts: 2735

Posted: 05 Jun 2012 02:21:37 pm    Post subject:

Haha, whoops, soory. No more posting for me until I get some sleep.
_________________
Shaun
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page 1, 2  Next
» View previous topic :: View next topic  
Page 1 of 2 » All times are GMT - 5 Hours

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.045135 seconds.