File: programming/cocoa/MacScare-Source.zip/MacScare-Source/glk.m


//
//  glk.m
//  CocoaGlk
//
//  Created by Andrew Hunter on Wed Jun 11 2003.
//  Copyright (c) 2003 Andrew Hunter. All rights reserved.
//
 
// The wrappers
 
// Oh, well then, everything's wrapped up in a neat little package
//     -- Homer Simpson
 
#import <Cocoa/Cocoa.h>
 
#import "glk.h"
#import "glkInternal.h"
#import "GlkSession.h"
#import "GlkStatus.h"
 
#import "GlkWriteBufferedStream.h"
 
#undef GLKLOG
 
// == Some convienience functions + macros ==
#define cStream ([ourStatus currentStream]->stream)
// == The actual functions ==
#ifdef GLKLOG
"glk_exit()");
#endif
#ifdef GLKLOG
"glk_set_interrupt_handler()");
#endif
 
    // Implement me
#ifdef GLKLOG
    // NSLog(@"glk_tick()");
#endif
 
    // [ourSession threadPoolFree];
    // [ourSession tick];
#ifdef GLKLOG
"glk_gestalt()");
#endif
#ifdef GLKLOG
"glk_gestalt_ext()");
#endif
#ifdef GLKLOG
    //NSLog(@"glk_char_to_lower()");
#endif
#ifdef GLKLOG
    //NSLog(@"glk_char_to_upper()");
#endif
#ifdef GLKLOG
"glk_window_get_root()");
#endif
#ifdef GLKLOG
"glk_window_open()");
#endif
// Set the root window if necessary
#ifdef GLKLOG
"glk_window_close()");
#endif
#ifdef GLKLOG
"glk_window_get_size()");
#endif
#ifdef GLKLOG
"glk_window_set_arrangement()");
#endif
#ifdef GLKLOG
"glk_window_get_arrangement()");
#endif
#ifdef GLKLOG
"glk_window_iterate()");
#endif
#ifdef GLKLOG
"glk_window_get_rock()");
#endif
#ifdef GLKLOG
"glk_window_get_type()");
#endif
#ifdef GLKLOG
"glk_window_get_parent()");
#endif
#ifdef GLKLOG
"glk_window_get_sibling()");
#endif
#ifdef GLKLOG
"glk_window_clear()");
#endif
#ifdef GLKLOG
"glk_window_move_cursor()");
#endif
#ifdef GLKLOG
"glk_window_get_stream()");
#endif
#ifdef GLKLOG
"glk_set_echo_stream()");
#endif
#ifdef GLKLOG
"glk_get_echo_stream()");
#endif
#ifdef GLKLOG
"glk_set_window()");
#endif
 
    [ourStatus setCurrentStream: cwin->stream];
 
    [[glkwin(cwin) view] focus];
    //[ourSession threadPoolFree];
    //[ourSession setGlkWindow: glkwin(cwin)];
#ifdef GLKLOG
"glk_stream_open_file()");
#endif
// -----------------------------------------------------------------------------
//	glkunix_stream_open_pathname:
//		Function that can be used by glkunix_startup_code() to open a stream for
//		a file outside the user-permitted folders. Using it at other times is
//		unportable. This may be used to open game files the user wants to open
//		at startup.
//
//	REVISIONS:
//		2004-03-13	witness	Created.
// -----------------------------------------------------------------------------
#ifdef GLKLOG
"glkunix_stream_open_pathname()");
#endif
	
	// TODO: Should we enforce that this is only available during glkunix_startup_code()?
#ifdef GLKLOG
"glk_stream_open_memory()");
#endif
#ifdef GLKLOG
"glk_stream_close()");
#endif
#ifdef GLKLOG
"glk_stream_iterate()");
#endif
#ifdef GLKLOG
"glk_stream_get_rock()");
#endif
#ifdef GLKLOG
"glk_stream_set_position()");
#endif
#ifdef GLKLOG
"glk_stream_get_position()");
#endif
#ifdef GLKLOG
"glk_stream_set_current()");
#endif
#ifdef GLKLOG
"glk_stream_get_current()");
#endif
#ifdef GLKLOG
"%c", ch);
#endif
#ifdef GLKLOG
"%c", ch);
#endif
#ifdef GLKLOG
"%s", s);
#endif
#ifdef GLKLOG
"%s", s);
#endif
 
    // [ourSession threadPoolFree];
#ifdef GLKLOG
"glk_put_buffer(): %@"#endif
 
    // [ourSession threadPoolFree];
#ifdef GLKLOG
"glk_put_buffer_stream()");
#endif
 
    // [ourSession threadPoolFree];
#ifdef GLKLOG
"glk_set_style()");
#endif
#ifdef GLKLOG
"glk_set_style_stream()");
#endif
#ifdef GLKLOG
    // NSLog(@"glk_get_char_stream()"); -- waay too many of these
#endif
#ifdef GLKLOG
"glk_get_line_stream()");
#endif
#ifdef GLKLOG
"glk_get_buffer_stream()");
#endif
#ifdef GLKLOG
"glk_stylehint_set()");
#endif
#ifdef GLKLOG
"glk_stylehint_clear()");
#endif
#ifdef GLKLOG
"glk_style_distinguish()");
#endif
#ifdef GLKLOG
"glk_style_measure()");
#endif
#ifdef GLKLOG
"glk_fileref_create_temp()");
#endif
#ifdef GLKLOG
"glk_fileref_create_by_name()");
#endif
#ifdef GLKLOG
"glk_fileref_create_by_prompt()");
#endif
#ifdef GLKLOG
"glk_fileref_create_from_fileref()");
#endif
#ifdef GLKLOG
"glk_fileref_destroy()");
#endif
#ifdef GLKLOG
"glk_fileref_iterate()");
#endif
#ifdef GLKLOG
"glk_fileref_get_rock()");
#endif
#ifdef GLKLOG
"glk_fileref_delete_file()");
#endif
#ifdef GLKLOG
"glk_fileref_does_file_exist()");
#endif
#ifdef GLKLOG
"glk_select()");
#endif
#ifdef GLKLOG
"glk_select_poll()");
#endif
#ifdef GLKLOG
"glk_request_timer_events()");
#endif
 
    BUG(@"glk_request_timer_events not implemented yet"#ifdef GLKLOG
"glk_request_line_event()");
#endif
#ifdef GLKLOG
"glk_request_char_event()");
#endif
#ifdef GLKLOG
"glk_request_mouse_event()");
#endif
#ifdef GLKLOG
"glk_cancel_line_event()");
#endif
#ifdef GLKLOG
"glk_cancel_char_event()");
#endif
#ifdef GLKLOG
"glk_cancel_mouse_event()");
#endif
 
    [glkwin(cwin) cancelMouseEvent];
}
 
#ifdef GLK_MODULE_IMAGE
#endif /* GLK_MODULE_IMAGE */
 
#ifdef GLK_MODULE_SOUND
"Function glk_schannel_create not implemented""Function glk_schannel_destroy not implemented""Function glk_schannel_iterate not implemented""Function glk_schannel_get_rock not implemented""Function glk_schannel_play not implemented""Function glk_schannel_play_ext not implemented""Function glk_schannel_stop not implemented""Function glk_schannel_set_volume not implemented""Function glk_sound_load_hint not implemented");
}
 
#endif /* GLK_MODULE_SOUND */
 
#ifdef GLK_MODULE_HYPERLINKS
"Function glk_set_hyperlink not implemented""Function glk_hyperlink_stream not implemented""Function glk_request_hyperlink_event not implemented""Function glk_cancel_hyperlink_event not implemented");
}
 
 
#endif /* GLK_MODULE_HYPERLINKS */

This code uses the PclZip Zip File reading code, which is subject to the GNU LGPL. It also uses the GeSHi syntax highlighter, subject to the GPL. Ask if you want this for your own web site, it's free.