Presentation is loading. Please wait.

Presentation is loading. Please wait.

GTK Binding for Alice Robert Grabowski Eine GTK-Schnittstelle für Alice.

Similar presentations


Presentation on theme: "GTK Binding for Alice Robert Grabowski Eine GTK-Schnittstelle für Alice."— Presentation transcript:

1 GTK Binding for Alice Robert Grabowski Eine GTK-Schnittstelle für Alice

2 Overview Concepts Implementation Demo Outlook

3 Overview Concepts –GTK+ –Mapping C Libraries to Alice –Event Handling –Garbage Collection Implementation Demo Outlook

4 Collection of libraries: OS APIGDK - platform graphics abstraction GTK - widget collection GnomeCanvas - a special widget GTK+

5 GTK+ - Main Ideas widgets attributes connect callback functions for handling events event-driven main loop automatic memory management

6 Mapping C Libraries to Alice functions  wrapper (marshalling) structures  field accessor functions constants  datatype constructors C Libary contains:Alice Mapping:

7 callbackprogram C Event Handling in C delegate control to main loop......which invokes registered callback functions check events idle handle events event

8 callbackprogram Alice C Naive Approach main loop never returns  breaks concurrency model ? cannot register Alice functions check events idle handle events event

9 Alice C handle events check events idle event Solution split main loop callback  marshaller id dispatcher id  id asynchronous callback function call

10 Alice 5 C Garbage Collection GTK: own memory management reference counters Problem: GTK may delete object too early 0 ?

11 5 Alice C Solution keep reference to object while visible in Alice 6 1

12 3 Alice C Solution keep reference to object while visible in Alice 1 Alice finalization decreases counter

13 0 Alice C Solution keep reference to object while visible in Alice Alice finalization decreases counter

14 Overview Concepts Implementation –Design –Generator –Type Mapping –Examples Demo Outlook

15 Design generated interface –function wrappers, constants, field accessors GTK+ core hand-written core –main loop, event handling, garbage collection generated interface Alice C

16 Design generated interface –function wrappers, constants, field accessors GTK+ hand-written core –main loop, event handling, garbage collection Alice C FFI coregenerated interface

17 Generator GTK+ header files all declarations C preprocessor, clean-up programs Abstract Syntax Tree CKIT own representation Mapper generated components: native high-level

18 Type Mapping

19 Constants C-Deklaration: typedef enum { GTK_WINDOW_TOPLEVEL, GTK_WINDOW_POPUP } GtkWindowType; Alice-Deklaration: datatype GtkWindowType = WINDOW_TOPLEVEL | WINDOW_POPUP

20 Examples void gtk_scale_set_draw_value(GtkScale*, gboolean) val scaleSetDrawValue : object * bool  unit Simple example val entryGetLayoutOffsets’ : object * int * int  int * int Input/Output argument example void gtk_entry_get_layout_offsets (GtkEntry*, int*, int*) val entryGetLayoutOffsets : object  int * int

21 Overview Concepts Implementation Demo Outlook

22 Overview Concepts Implementation Demo Outlook

23 Outlook GTK –high-level functional UI design –GtkBuilder –use advanced Alice features Generic Generator Tool –work in progress by Sven Woop


Download ppt "GTK Binding for Alice Robert Grabowski Eine GTK-Schnittstelle für Alice."

Similar presentations


Ads by Google