Add wrappers for gtk_init() and gtk_main().

This commit is contained in:
Sergey Cherepanov 2012-11-24 19:35:58 +11:00 committed by Lassi Kortela
parent ad005e9685
commit 388ef489be
2 changed files with 33 additions and 0 deletions

View File

@ -1,3 +1,6 @@
;;; -*-Scheme-*-
(require 'gtk.la)
(gtk-init (command-line-args))
(gtk-main)

View File

@ -29,6 +29,36 @@
*/
#include "gtk.h"
#include "intern.h"
static Object P_Gtk_Init (Object args) {
int argc;
char **argv;
int i;
Check_List (args);
argc = Fast_Length (args) + 1;
argv = (char **)Safe_Malloc (sizeof (char *) * argc);
argv[0] = appname ? appname : "elk";
for (i = 1; i < argc; i++) {
Object arg = Car (args);
Check_Type (arg, T_String);
argv[i] = Get_String (arg);
args = Cdr (args);
}
gtk_init (&argc, &argv);
free (argv);
return Void;
}
static Object P_Gtk_Main () {
gtk_main ();
return Void;
}
void elk_init_gtk_gtkmain () {
Define_Primitive (P_Gtk_Init, "gtk-init", 1, 1, EVAL);
Define_Primitive (P_Gtk_Main, "gtk-main", 0, 0, EVAL);
}