147efec2844ed9ce16dfa06ea221889c.ppt
- Количество слайдов: 22
Octave-GTK, a language bindings project Octave-GTK 24/02/05 Octave-GTK Team Hemant Muthu Rams Manik {gnufied, gnumuthu, chaosglare, manickam}@users. sourceforge. net] 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project Agenda ➔ Aims ➔ Rationale/Need ➔ Project Overview ➔ Development Tools ➔ Octave-GTK Today ➔ Octave-GTK demo ➔ What can you do? ➔ More Information 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project Aims Integrate Scientific programming environment with a world-class GUI. ➢ ➢ Octave+GTK = Octave-GTK ➢ Octave bindings for GTK+ ➢ Octave GUI 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project Terms Scientific Computing ➢Octave ➢GTK ➢GUI ➢Language Bindings ➢Language Interoperability ➢Advantages ➢ 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project Rationale/Need start Octave-GTK ? Why ➢ A Software Eco. System based around Octave. ➔Integration of free tools & libraries E nviroments: Lush, Sci. Lab, Num. Python L ibraries: GD , GTK, Fann, Image. Magick, Audiofile Octave-GUI O ctave-GUI using Octave-GTK itself. ➔Make porting easier ➔ O ctave-SWIG: for autogenerating bindings. Principle of least surprise ➔A Matlab clone. ➢RAD for scientific Applications ➔Stop Re-Inventing the wheel. ➔Reduce Reuse Recycle. GNU Way. ➢ 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project Project Overview ➢ Octave-GTK: ➔Octave bindings to GTK function calls from Octave. ✔Function call marshalling ✔Type conversion between Octave & C ✔ Octave bindings to Lib. Glade, Lib. Gnome. Ui, GDK ➔ Language bindings to Lib. Glade, for easier GUI programming ✔Lib. Gnome for real GNOME programs ✔Lib. GDK for graphics & color. Lib. GD already ported. ✔Octave-SWIG: for autogenerating bindings. ✔ Octave-GUI ➔Octave-GUI using Octave-GTK itself. ➢#1 Fun project! 24/02/05 ➢ © Octave-GTK Team
Octave-GTK, a language bindings project Development Tools Octave Bindings produced by Octave-GTK team. ➢ Octave-GTK ➔ O ctave bindings to GTK. Write GUI code from Octave. ➔ Octave-lib. Glade U se Glade UI designer. glade files ➔ GD-Octave Image processing from Octave. ➔ Octave-Glade G lade UI Editor customised. Octave Bindings due from Octave-GTK team ➢ Lib. Gnome for real GNOME programs ➔Lib. GDK 24/02/05 for graphics & color. Lib. GD already ported. ➔ © Octave-GTK Team
Octave-GTK, a language bindings project Octave-GTK Today Octave-GTK works today. ➔Maps about 2083 functions automagically. ➔Python code generator ➔Custom lexer. ➔Bindings autogenerated. ➔Exports C API directly. ➔Part of functions manually wrapped. ➔Glue code of 35, 208 lines of code. ➔gtk. cpp size 1336 Kb. ➔Binding library, gtk. oct 5572 Kb ➔ 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project Design Issues Callbacks are Ad. Hoc ➢ Must Write a custom Marshaller. ➢ Type Mapping ➢ Integer to Pointer ➢ Memory Management ➢ Reference counting problem ➢ Quality of binding, GObject. ➢ Native to C, and Octave. ➢ Lag between releases. ➢ C API always newer. ➢ 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project Components Octave-GTK (40%) ➢ Octave-Lib. Glade (80%) ➢ Difficult to write GUI's. ➔ Repetitive code ➔ Suitable for autogeneration ➔Tough API to learn. ➔Version 0. 1 ➔ 2083 functions. Easy to write GUI's. ➔Only Event Handlers ➔GUI Builder ➔Easy simple API to learn. ➔Version 0. 1 ➔ 13 functions ➔ Gd-Octave (80%) ➢ Read/Write Image files. ➔Easy Image Processing. ➔Convolution, FFT, DFT ➔Filtering, Analysis/Synthesis ➔Fairly mature. ➔Concise API to learn. ➔Version 0. 5 ➔ ➔ Octave-Glade (5%) ➢ Glade Hacked ➔History added? ➔Customised Window creation ➔Eliminate Boxed widget building. ➔Auto-Code generation of octave. ➔Version 0. 1 24/02/05 © Octave-GTK Team ➔
Octave-GTK, a language bindings project Demo #! /usr/bin/octave -q function main() gd() fp=fopen("mail. png", "wb") ip=gd. Image. Create(200, 40); color=gd. Image. Color. Allocate( ip, 0 xcc, 0 xdd, 0 xff) %draws a square grid for i=0: 20: 190 gd. Image. Line(ip, 0, i/5, 200, i/5, color); gd. Image. Line(ip, i, 0, i, 40, color); end Gd-Octave (80%) ➢ Read/Write Image files. ➔Easy Image Processing. ➔Convolution, FFT, DFT ➔Filtering, Analysis/Synthesis ➔Fairly mature. ➔Concise API to learn. ➔Version 0. 5 ➔ 75 functions ➔ gd. Image. String(ip, "Large", 0, 20, "gdoctave@sourceforge. net", color); gd. Image. Png(ip, fp); fclose(fp); gd. Free(ip); end main() 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project Demo #! /usr/bin/octave -q function main() gtk() %load library gtk_init() %initation w=gtk_window_new(0) b=gtk_vbox_new(0, 0) gtk_window_set_title(w, "Welcome to Octave-GTK"); entry=gtk_entry_new(); gtk_entry_set_text(entry, "Hello World"); okb=gtk_button_new_with_label("ok"); gtk_container_add(w, b); gtk_container_add(b, entry); gtk_container_add(b, okb); %hookup the signals g_signal_connect(okb, "clicked", "gtk_main_quit"); g_signal_connect(w, "destroy", "gtk_main_quit"); gtk_widget_show_all(w); gtk_main() %enter main loop end Octave-GTK (40%) ➢ Difficult to write GUI's. ➔ Repetitive code ➔ Suitable for autogeneration ➔Tough API to learn. ➔Version 0. 1 ➔ 2083 functions. ➔ main() 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project Demo [Lib. Glade] Octave-Lib. Glade (80%) ➢ Easy to write GUI's. ➔Only Event Handlers ➔GUI Builder ➔Easy simple API to learn. ➔Version 0. 1 ➔ 13 functions ➔ function main() global xml gtk() %Load GTK Library glade() %Load Lib. Glade gtk_init() %Initialize GTK Type system. xml=glade_xml_new("ohms. glade", "window 1", ""); win 1=glade_xml_get_widget(xml, "window 1"); glade_xml_signal_autoconnect(xml); gtk_widget_show_all(win 1); gtk_main() end main() 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project Demo [Lib. Glade. . . ] #! /usr/bin/octave -q xml="" disp('Ohms law example with octave-libglade') function calculate_cb() global xml disp('Hello World') i=glade_xml_get_widget(xml, "current") r=glade_xml_get_widget(xml, "resistance") v=glade_xml_get_widget(xml, "voltage") Octave-Lib. Glade (80%) ➢ Easy to write GUI's. ➔Only Event Handlers ➔GUI Builder ➔Easy simple API to learn. ➔Version 0. 1 ➔ 13 functions ➔ amp=str 2 num(gtk_entry_get_text(i)) ohm=str 2 num(gtk_entry_get_text(r)) gtk_entry_set_text(v, num 2 str(amp*ohm)) end 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project Demo [Complete App] Design the GUI with Octave. Glade ➢ ➢ Glade hacked & customised. Use the. glade file in your octave program. ➢ ➢ Standard Lib. Glade useage. Generate GUI from this using Octave-Lib. Glade ➢ ➢ Standard Lib. Glade useage. Write callbacks in Octave. ➢ ➢ Octave-Glade (5%) ➢ Glade Hacked ➔History added? ➔Customised Window creation ➔Eliminate Boxed widget building. ➔Auto-Code generation of octave. ➔Version 0. 1 ➔ Your Job! Application Logic Most of this stuff can easily be automated. ➢Done in Octave-Glade. ➢ 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project Time Line Project Launched First Octave-lib. Glade First Octave-GTK Gd-Octave ported to autogenerated/ First Octave-GTK First Gd-Octave autogenerated released GNU Autotools. Prototype autogenerated code b 2 Fe 5 00 5 4 4 00 00 v 2 b 2 No 00 04 20 t 2 Oc Fe 21 08 20 17 ly Ju 4 00 2 ly Ju 29 20 Listed as part of Debian Project http: //aliot. debian. org/octave-gtk/ GTK Project http: //www. gtk. org/bindings. html Octave Project: ? GNOME Project: ? Glade hacked 7 Jan 2005 24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project What can you do? Use Octave-Lib. Glade/Octave-GTK ➔For your science/Engineering projects ➔Make applications wit Octave. GTK. ➔Use Octave-GTK for your work. ➢Request features ➔Ask for newer libraries for Octave. GTK. ➔Ask for new type of API ➔ Ask for code/example/documents/demos. ➢ Write new Applications ➔Stress test Octave. GTK. ➔Report errors/results. ➢ Write Documentation ➔ Well how else could you get started? ➔ Support us! ➢ Write Code! ➔Hack with us! ➢ 24/02/05 © Octave-GTK Team
12/27/04 © ECE NIT-T, Muthiah A Octave-GTK, a language bindings project Evolution/Conclusion ➢ Octave-GTK Project is Evolving. 0. 1 ➢ Octave-GTK will be industrial strength ➢ ➢ Version 0. 2 slated for March 1 st We are working! ➢ Furiously Hacking? ➢ Gtk. Extra, Gtk. Widget. Factory ➢ SWIG : Simplified Wrapper Generator ➢ Debugger: Octave Debugger
12/27/04 © ECE NIT-T, Muthiah A Octave-GTK, a language bindings project Information ➢ http: //octave-gtk. sourceforge. net ➢ octave-gtk-devel@lists. sourceforge. net ➢ http: //www. sf. net/projects/octave-gtk/ ➢ gnumuthu@users. sf. net, manickam@users. sf. net, gnuified@users. sf. net, chaosglare@users. sf. net ➢ www. octave. org, www. gtk. org
12/27/04 © ECE NIT-T, Muthiah A Octave-GTK, a language bindings project The Team Hemant Kumar Chemical Engineer NIT-T C++, OOP, Octave gnufied@users. sourceforge. net Muthiah Electronics Engineer NIT-T GTK, C, Testing gnumuthu@users. sourceforge. net Ramasamy Chemical Engineer NIT-T C++, GUI, Octave chaosglare@users. sourceforge. net Saravana Manickam Mechanical Engineer NIT-T Python, SWIG, C manickam@users. sourceforge. net
12/27/04 © ECE NIT-T, Muthiah A Octave-GTK, a language bindings project Thanks ● The GNU movement, and free software. – Dr Richard Stallman ● GNU Octave ● GTK John Eaton Peter Mattis, Spencer Kimball, Havoc Pennington, Owen. Taylor et -al ● The GNU/Linux OS ● Py. GTK ● GNOME Miguel De Icaza ● CSG Head Mr. Arun, Mr. Pradeep & Mr. Victor Linus Torvalds et-al James Henstridge
12/27/04 © ECE NIT-T, Muthiah A Octave-GTK, a language bindings project Q &A ● Contents of this slides are licensed under GNU FDL
147efec2844ed9ce16dfa06ea221889c.ppt