Module Custop (.ml)


module Custop: sig .. end
Generic interface to create GUI for interpreters.

exception Error of string * int * int
The exception to use to report parse or execution error in input code. In Error (message, start, stop):

Parametrizing the interface

The elements box is the list of defined elements, on the left in the default (glade) interface.

The display box is the box used to display the value associated to the selected element.

The output view is the sourceview where output of evaluation is printed along with a copy of the input code.

The input view is where the use types in its code.

class type display_box = object .. end
What the display box must provide.
class virtual gui_base : object .. end
What the gui must provide.
class virtual ['a] param : object .. end
What the user of this library must provide.

Utilities


val syntax_highlight_box : 'a param -> Configwin.parameter_kind * (unit -> unit)
This function can be used to create a Configwin box to configure the style scheme used in sourceview.
val source_view_props_box : unit -> Configwin.parameter_kind * (unit -> unit)
This function can be used to create a Configwin box to configure the common preferences of the sourceview widgets.
val string_of_file : string -> string
string_of_file file returns the contents of the whole file as a string.

The list of elements



type 'a element = {
   element : 'a;
   pos : int;
}
To represent an element and its position in the output view, so that we can automatically scroll to the definition of the element when it is selected in the element list.
class ['a] elements : 'a param -> GText.view -> object .. end
The elements box.

Options


val op_ini : Config_file.group
The group of options. See Config_file.
val save_options : string -> unit
save_options file saves the options in the given file.
val load_options : string -> unit
load_file loads the options for the given file.
val color_output : Config_file.string_cp
The option for the color of (result) output.
val color_error : Config_file.string_cp
The option for the color of error in input view.
val elements_frame_width : Config_file.int_cp
The option for the width of the elements box.
val display_frame_width : Config_file.int_cp
The option for the width of the display box.
val output_frame_height : Config_file.int_cp
The option for the height of the output view.
val edit_options : 'a param -> bool
This function opens a window to make the user edit the default options above.
Returns true if options were modified.

The main window

Create an instance of this class with a param object and the main window will appear. GMain.Main.main () is not called, so you have to call it yourself.

class virtual gui : 'a param -> object .. end