View Single Post
Old 01-12-2010, 05:40 AM   #1
leobueno
Junior Member
leobueno has learned how to read e-booksleobueno has learned how to read e-booksleobueno has learned how to read e-booksleobueno has learned how to read e-booksleobueno has learned how to read e-booksleobueno has learned how to read e-booksleobueno has learned how to read e-books
 
Posts: 5
Karma: 770
Join Date: Oct 2009
Device: hanlin
Leo's Hanlin V3 eBook SDK

After hard work, I've uploaded the first version of Leo's Hanlin eBook V3 SDK. This is the development environment was used for the development of Leo's Void (planetarium) and Leo's Wikipedia Reader. It also includes a programming language Script (similar to javascript) in order to develop applications quickly.

The sources include complete sources of Leo's Void and Leo's Wikipedia Reader.

It is released as a GNU project under the GPL. So the code is open and is available for download at:

http://sourceforge.net/projects/ebooksdk/

[size=14]Development philosophy.[/size]

Native development.

Development in this SDK is mainly done in windows with Visual Studio using an emulation of the device. Once developed and refined the code uses the cross compiler and SDK provided by Jinke (Tools that run on Linux) to compile ultimately for the Hanlin.

The hello world program in this sdk is as native program:

Code:
Code:
//Include the sdk main include 
//This is all the code you make for a Helloword app. 
#include   "../sdk/EBookApp.h" 



IMPLEMENT_EBOOKAPP   //Include this macro in one cpp file to implement the main variables. 

//The hello world app is only a page object. 
class   HelloPage : public EBookApp 
{ 
public: 
//Every page (or control) has two abstract methods that must be overloaded. draw the page and onkey as key event handler. 
   void   draw(EBookPort *port) 
   { 
      port->begin(); 
      port->clear(ColorWhite); 
      port->setFont(50, TextStyleBold); 
      port->drawString(50, 350, "Hello world!", ColorBlack); 
      port->end(); 
   } 
   void   onkey(EBookPort *port, int code) 
   { 
      if (code == KEY_BACK) 
         port->terminate(); 
   } 
}; 

//The main page object. 
static   HelloPage   page; 

//The startup application. In this case do nothing because the app is a static object. 
void      ebookMain(EBookPort *port, int language, std::vector<std::string> &params) 
{ 
} 

//Return the current application 
EBookApp   *ebookApp() { return &page; } 

//Terminate and cleanup application. In this case nothing 
void      ebookTerminate() {}
Includes virtual planetarium sources Leo's Void and Leo's Wikipedia Reader as an example of serious develop.

Ebookscript Development

The development is done in Windows in the simulator to interpret and only needs to load in the Hanlin program source code and the interpreter of ebookscript own.

The language has built sqlite SQL server and is able to control applications using linux inlet and outlet pipes (This is how the shell is controlled and gnuchess).

The hello world program in script is:

Code:
Code:
//Include USPL constants and other stuff 
import   "const.uspl"; 
//Include the debugger. 
import  "debugger.uspl"; 

//The hello world program in EBookScript 
public class Hello extends Page 
{ 
//Draw handler. Every page draw must do a port.begin and port.end. 
   public function draw(port) 
   { 
      port.begin(); 
      port.clear(Const.Color.White); 
      port.setFont(50, Const.TextStyle.Bold); 
      port.drawString(50, 350, "Hello world!", Const.Color.Black); 
      port.end(); 
   } 
//Key handler. If the key is back then terminate. 
   public function onkey(port, code) 
   { 
      switch (code) 
      { 
      case Const.Key.Back: 
         port.terminate(); 
         break; 
//The intro key calls the debugger. The debugger is also invocated in error condition. 
      case Const.Key.Intro: 
         EReader.debugger("hello world!"); 
         break; 
      } 
   } 
/* 
   Main entry point. A static function named main on any class. Notice: every static member 
   main is executed on startup  but is not guaranteed the order execution of these functions. 
   It is highly recomended to define only one main entry point. 
*/ 
   public static function main(args) 
   { 
      EReader.push(new Hello()); 
   } 
}
Hybrid Development

ebookscript has ability to call native functions in shared libraries or dlls. The library can be scheduled to compile as dll and a shared library. An example can be seen in the example of sudoku, in which the solution and generation of Sudoku is done in C and other scripting language.

The language has a number of examples that are in turn useful applications. If all you're interested only in run samples download this file:

ebookscript_hanlin_binaries_1_0.zip

This file contains everything needed to test the examples including a dictionary and a map of Madrid. Extract the folder to a SD and run leoscript.exe

Examples are:

A Chess built as a frontend of gnuchess (It includes a compilation of chess)




A caculator and other programming samples

There is lack of documentation.

Last edited by Nate the great; 01-12-2010 at 09:13 AM.
leobueno is offline   Reply With Quote