/* RIGSNSApplication.m - Some additional code to properly wrap the NSApplication class in Ruby $Id: RIGSNSApplication.m,v 1.3 2001/10/04 14:51:33 ljulliar Exp $ Copyright (C) 2001 Free Software Foundation, Inc. Written by: Laurent Julliard Date: August 2001 This file is part of the GNUstep RubyInterface Library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #include #include #include "RIGS.h" #include "RIGSCore.h" #import "RIGSNSApplication.h" // Ruvy view of the NSApp global GNUstep variable static VALUE rb_NSApp = Qnil; VALUE _RIGS_get_NSApp(ID rb_id, VALUE *data, global_entry_ptr entry) { DATA_PTR(rb_NSApp) = NSApp; return rb_NSApp; } void _RIGS_set_NSApp(VALUE value, ID rb_id, VALUE *data, global_entry_ptr entry) { Data_Get_Struct(value, NSApplication, NSApp); DATA_PTR(rb_NSApp) = NSApp; NSDebugLog(@"Setting NSApp to 0x%lx", NSApp); } void _RIGS_rebuild_argc_argv(VALUE rb_argc, VALUE rb_argv) { int i; // +1 in arcg for the script name that is not in ARGV in Ruby ourargc = FIX2INT(rb_argc)+1; ourargv = malloc(sizeof(char *) * ourargc); ourargv[0] = STR2CSTR(rb_gv_get("$0")); NSDebugLog(@"Argc=%d\n",ourargc); NSDebugLog(@"Argv[0]=%s\n",ourargv[0]); for (i=1;i