orpie-1.5.2/0000755000175000017500000000000012322115103011307 5ustar paulpaulorpie-1.5.2/big_int_str.ml0000644000175000017500000002150112322115103014143 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* string coercion functions for Big_int * * These functions accept a base parameter, unlike the functions in the Big_int * module itself. The algorithms are simple, but appear to be fast enough. *) open Big_int;; exception Big_int_string_failure of string;; let digits = "0123456789abcdefghijklmnopqrstuvwxyz";; (* 'values' maps characters to integer values; '0' = 0, '1' = 0, ... 'a' = 10, etc. *) let values = Hashtbl.create 36;; for i = 0 to pred (String.length digits) do Hashtbl.add values digits.[i] i done;; (* Represent an integer in a given base. (Continually divide the integer * by the base until the remainder is zero.) This uses ordinary integer * division, so it can be done in constant time (< Sys.word_size divisions). * This is not designed to be used externally; no error checking is performed * in order to keep it fast. *) let string_of_positive_int_base (num : int) (base : int) = let rec get_digit quotient zero_str str = if quotient = 0 then str else let quot = quotient / base and rem = quotient mod base in let digit = digits.[rem] in begin match rem with |0 -> get_digit quot ((String.make 1 digit) ^ zero_str) str |_ -> get_digit quot "" ((String.make 1 digit) ^ zero_str ^ str) end in get_digit num "" "" (* Divide a bignum by a power of 2, yielding a quotient and a remainder. * Faster than general case division because it can be done using bit blitting * and shifting. *) let quomod_power_2 bignum bits = let shift_words = bits / Sys.word_size and shift_bits = bits mod Sys.word_size in let quot = nat_of_big_int bignum in let quot_len = Nat.length_nat quot in let rem = Nat.create_nat (succ shift_words) in (* copy the 'shift_words' least significant words of quot over to rem *) Nat.blit_nat rem 0 quot 0 shift_words; Nat.set_to_zero_nat rem shift_words 1; (* shift over the remaining 'shift_bits' bits from quot to rem *) Nat.shift_right_nat quot shift_words (quot_len - shift_words) rem shift_words shift_bits; (* adjust the most significant word of rem *) let dummy = Nat.create_nat 1 in Nat.shift_right_nat rem shift_words 1 dummy 0 (Sys.word_size - shift_bits); let big_quot = big_int_of_nat (Nat.copy_nat quot shift_words (quot_len - shift_words)) and big_rem = big_int_of_nat rem in (big_quot, big_rem) (* Divide-and-conquer algorithm for conversion to bases that are powers of two * (binary, octal, and hex, for example). The big_int is divided by a power * of two that is also a power of 'base'; the power is chosen to approximately * cut the big_int in half. This division can be performed using only blits * and bit shifts, so it is much faster than ordinary big_int division. * The two pieces are recursively subdivided and the resulting strings are * concatenated together. O(n*log(n)) time. This function runs significantly * faster than string_of_big_int_base_gen. *) let string_of_big_int_base (num : big_int) (base : int) = let log2_base = match base with |2 -> 1 |4 -> 2 |8 -> 3 |16 -> 4 |32 -> 5 |_ -> let err_str = Printf.sprintf "Error: called string_of_big_int_base() with illegal base %d" base in raise (Big_int_string_failure err_str) in let rec str_of_big_int_aux (ival : big_int) = if is_int_big_int ival then string_of_positive_int_base (int_of_big_int ival) base else begin let num_words = num_digits_big_int ival in let half_binary_digits = num_words * Sys.word_size / 2 in (* rounded_digits mod log2_base = 0, therefore * division by (2^rounded_digits) will split ival * perfectly with respect to the base 'base'. *) let rounded_digits = half_binary_digits - (half_binary_digits mod log2_base) in let upper, lower = quomod_power_2 ival rounded_digits in let upper_string = str_of_big_int_aux upper and lower_string = str_of_big_int_aux lower in (* pad the lower_string with zeros as necessary *) let adj_len_lower = rounded_digits / log2_base in let zeros = String.make (adj_len_lower - (String.length lower_string)) '0' in upper_string ^ zeros ^ lower_string end in let s = str_of_big_int_aux (abs_big_int num) in match sign_big_int num with |0 -> "0" |1 -> s |(-1) -> "-" ^ s |x -> raise (Big_int_string_failure ("unmatched sign: " ^ (string_of_int x))) (* Divide-and-conquer algorithm for string representation of big_ints in a * desired base (general case--not necessarily a power of two). The big_int * is split approximately in half using this divisor: * base^(num_words * log_base(2^word_size) / 2) * Each half is split recursively, and the pieces are concatenated together. * Should run in O(n*log(n)) time, a big improvement on the standard O(n^2) * algorithm that requires one long division for every digit output. *) (* Note 1: This runs in logarithmic stack space, so we should be able to handle * some pretty large big_ints before worrying about blowing the stack. *) (* Note 2: A faster method for computing a divisor could make this go a * lot quicker yet; gprof indicates that most of the time is spent in * multiplication ==> the power_int_positive_int_base call. *) (* Note 3: This routine actually appears to outperform string_of_big_int() * for computing decimal representations. CPU time decrease looks to be around * a third. *) let string_of_big_int_base_gen (num : big_int) (base : int) = if base >= 2 && base <= 36 then let rec str_of_big_int_aux (ival : big_int) = if is_int_big_int ival then string_of_positive_int_base (int_of_big_int ival) base else begin let num_words = num_digits_big_int ival in let size_factor = (log (2.0 ** (float_of_int Sys.word_size))) /. (log (float_of_int base)) in let log_div = (num_words * (int_of_float size_factor)) / 2 in let divisor = power_int_positive_int base log_div in let (upper, lower) = quomod_big_int ival divisor in let upper_string = str_of_big_int_aux upper and lower_string = str_of_big_int_aux lower in (* pad the lower_string with zeros as necessary *) let zeros = String.make (log_div - (String.length lower_string)) '0' in upper_string ^ zeros ^ lower_string end in let s = str_of_big_int_aux (abs_big_int num) in match sign_big_int num with |0 -> "0" |1 -> s |(-1) -> "-" ^ s |x -> raise (Big_int_string_failure ("unmatched sign: " ^ (string_of_int x))) else raise (Big_int_string_failure ("unsupported base: " ^ (string_of_int base))) (* convert a string to a big_int, assuming base 'base' *) (* The algorithm is simple... add up the values of the digits. *) let big_int_of_string_base (str : string) (base : int) = let multiplier = ref unit_big_int and sum = ref zero_big_int in for i = pred (String.length str) downto 0 do match str.[i] with |'-' -> sum := minus_big_int !sum |'+' -> () |_ -> try let digit_value = (Hashtbl.find values str.[i]) in if digit_value < base then (let diff = mult_int_big_int digit_value !multiplier in sum := add_big_int !sum diff; multiplier := mult_int_big_int base !multiplier) else raise (Big_int_string_failure ("invalid digits for base " ^ (string_of_int base) ^ " integer data" )) with Not_found -> raise (Big_int_string_failure ("invalid digits for base " ^ (string_of_int base) ^ " integer data" )) done; !sum;; (* arch-tag: DO_NOT_CHANGE_16f12562-9499-46c4-8e3a-519da76c1622 *) orpie-1.5.2/pow.ml0000644000175000017500000001333712322115103012455 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) open Rpc_stack open Gsl_assist open Big_int let pow (stack : rpc_stack) (evaln : int -> unit) = evaln 2; let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in match gen_el1 with |RpcInt el1 -> ( match gen_el2 with |RpcInt el2 -> if (sign_big_int el2) <> (-1) then stack#push (RpcInt (power_big_int_positive_big_int el1 el2)) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "integer power function requires nonnegative power")) |RpcFloatUnit (el2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "cannot raise to a dimensioned power" end else let f_el1 = float_of_big_int el1 in let f_el2 = el2 in (* if power is nonnegative or if power is integer *) if f_el1 >= 0.0 || f_el2 = float_of_int (int_of_float f_el2) then let (f, u) = funit_of_float (f_el1 ** f_el2) in stack#push (RpcFloatUnit (f, u)) else let c_el1 = cmpx_of_float f_el1 in let c_el2 = cmpx_of_float f_el2 in let (c, u) = cunit_of_cpx (Complex.pow c_el1 c_el2) in stack#push (RpcComplexUnit (c, u)) |RpcComplexUnit (el2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "cannot raise to a dimensioned power" end else let c_el1 = cmpx_of_int el1 in let (c, u) = cunit_of_cpx (Complex.pow c_el1 el2) in stack#push (RpcComplexUnit (c, u)) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types")) ) |RpcFloatUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> let f_el2 = float_of_big_int el2 in stack#push (RpcFloatUnit (el1 ** f_el2, Units.pow uu1 f_el2)) |RpcFloatUnit (el2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "cannot raise to a dimensioned power" end else if el2 > 0.0 then begin stack#push (RpcFloatUnit (el1 ** el2, Units.pow uu1 el2)) end else let c_el1 = c_of_f el1 and c_el2 = c_of_f el2 in let c_prod = Complex.pow c_el1 c_el2 in if c_prod.Complex.im <> 0.0 then stack#push (RpcComplexUnit (c_prod, Units.pow uu1 el2)) else stack#push (RpcFloatUnit (c_prod.Complex.re, Units.pow uu1 el2)) |RpcComplexUnit (el2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "cannot raise to a dimensioned power" end else if uu1 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "cannot raise dimensioned value to complex power" end else let c_el1 = c_of_f el1 in let (c, u) = cunit_of_cpx (Complex.pow c_el1 el2) in stack#push (RpcComplexUnit (c, u)) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types")) ) |RpcComplexUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> let f_el2 = float_of_big_int el2 in let c_el2 = cmpx_of_int el2 in let c_prod = Complex.pow el1 c_el2 in stack#push (RpcComplexUnit (c_prod, Units.pow uu1 f_el2)) |RpcFloatUnit (el2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "cannot raise to a dimensioned power" end else let c_el2 = c_of_f el2 in let c_prod = Complex.pow el1 c_el2 in stack#push (RpcComplexUnit (c_prod, Units.pow uu1 el2)) |RpcComplexUnit (el2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "cannot raise to a dimensioned power" end else if uu1 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "cannot raise dimensioned value to complex power" end else let (c, u) = cunit_of_cpx (Complex.pow el1 el2) in stack#push (RpcComplexUnit (c, u)) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types")) ) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "invalid argument")) (* arch-tag: DO_NOT_CHANGE_55f98700-eb1e-4457-ae73-18170a816984 *) orpie-1.5.2/rcfile.ml0000644000175000017500000011435712322115103013120 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* rcfile.ml * This file includes everything associated with processing the orpierc file. * In particular, this includes a number of hashtables used to store the * bindings of curses keypresses to calculator operations. *) open Genlex;; open Curses;; open Operations;; exception Config_failure of string;; let config_failwith s = raise (Config_failure s);; (* These hashtables store conversions between curses keys and the operations * they are associated with. *) let table_key_function = Hashtbl.create 20;; let table_function_key = Hashtbl.create 20;; let table_key_command = Hashtbl.create 20;; let table_command_key = Hashtbl.create 20;; let table_key_edit = Hashtbl.create 20;; let table_edit_key = Hashtbl.create 20;; let table_key_browse = Hashtbl.create 20;; let table_browse_key = Hashtbl.create 20;; let table_abbrev_key = Hashtbl.create 20;; let table_key_abbrev = Hashtbl.create 20;; let table_intedit_key = Hashtbl.create 20;; let table_key_intedit = Hashtbl.create 20;; let table_key_macro = Hashtbl.create 20;; let table_key_varedit = Hashtbl.create 20;; let table_varedit_key = Hashtbl.create 20;; (* Default directory for orpie data *) let datadir = ref "~/.orpie" (* Default editor for fullscreen viewing *) let editor = ref "vi";; (* Whether or not to hide the help panel *) let hide_help = ref false;; (* Whether or not to conserve memory in favor of faster display *) let conserve_memory = ref false;; (* Autobinding keys *) let autobind_keys_list : (int * string * operation_t option * int) list ref = ref [];; let autobind_keys = ref (Array.make 1 (0, "", None, 0));; (* List of included rc files *) let included_rcfiles : (string list) ref = ref [];; (* Unit definition table *) let unit_table = ref Units.empty_unit_table;; let function_of_key key = Hashtbl.find table_key_function key;; let key_of_function f = Hashtbl.find table_function_key f;; let command_of_key key = Hashtbl.find table_key_command key;; let key_of_command command = Hashtbl.find table_command_key command;; let edit_of_key key = Hashtbl.find table_key_edit key;; let key_of_edit edit_op = Hashtbl.find table_edit_key edit_op;; let browse_of_key key = Hashtbl.find table_key_browse key;; let key_of_browse browse_op = Hashtbl.find table_browse_key browse_op;; let abbrev_of_key key = Hashtbl.find table_key_abbrev key;; let key_of_abbrev ex_op = Hashtbl.find table_abbrev_key ex_op;; let intedit_of_key key = Hashtbl.find table_key_intedit key;; let key_of_intedit edit_op = Hashtbl.find table_intedit_key edit_op;; let macro_of_key key = Hashtbl.find table_key_macro key;; let varedit_of_key key = Hashtbl.find table_key_varedit key;; let key_of_varedit edit_op = Hashtbl.find table_varedit_key edit_op;; let key_of_operation (op : operation_t) = match op with |Function x -> Hashtbl.find table_function_key x |Command x -> Hashtbl.find table_command_key x |Edit x -> Hashtbl.find table_edit_key x |Browse x -> Hashtbl.find table_browse_key x |Abbrev x -> Hashtbl.find table_abbrev_key x |IntEdit x -> Hashtbl.find table_intedit_key x |VarEdit x -> Hashtbl.find table_varedit_key x (* abbreviations used in abbreviation entry mode *) let abbrev_commands = ref [];; let abbrev_command_table = Hashtbl.create 50;; let command_abbrev_table = Hashtbl.create 50;; (* Register an abbreviation for an operation * This updates the string used in regexp matching, and * updates the hashtable used to find the corresponding operation. * Note: this list is generated in reverse order, so that * the list of matches can be generated rapidly in the opposite * order. *) let register_abbrev abbr op = (* Dummyproofing: if an abbreviation is a prefix of another * abbreviation, then it *must* lie earlier in the search order. * If not, it becomes impossible to execute the prefix command. *) let regex = Str.regexp_string abbr in let check_match (prev_result : bool) el = if prev_result then true else Str.string_match regex el 0 in if List.fold_left check_match false !abbrev_commands then (* if abbr is a prefix of some element, then it must * go at the end of the list *) abbrev_commands := !abbrev_commands @ [abbr] else (* if it has no prefix, then prepend it *) abbrev_commands := abbr :: !abbrev_commands; Hashtbl.add abbrev_command_table abbr op; Hashtbl.add command_abbrev_table op abbr;; (* tables used in for constant entry *) let constant_symbols = ref [];; let constants_table = Hashtbl.create 50;; (* Register a constant string. * This updates the string used in regexp matching, and * adds the constant definition to a lookup table. * Note: this list is generated in reverse order, so that * the list of matches can be generated rapidly in the opposite * order. *) let register_constant (const : string) (unit_def : Units.unit_def_t) = (* Dummyproofing: if a constant is a prefix of another * constant, then it *must* lie earlier in the search order. * If not, it becomes impossible to execute the prefix command. *) let regex = Str.regexp_string const in let check_match (prev_result : bool) el = if prev_result then true else Str.string_match regex el 0 in if List.fold_left check_match false !constant_symbols then (* if const is a prefix of some element, then it must * go at the end of the list *) constant_symbols := !constant_symbols @ [const] else (* if it has no prefix, then prepend it *) constant_symbols := const :: !constant_symbols; Hashtbl.add constants_table const unit_def;; (* remove an abbreviation for a command. *) let unregister_abbrev abbr = let remove_matching out_list el = if el = abbr then out_list else el :: out_list in let sublist = List.fold_left remove_matching [] !abbrev_commands in abbrev_commands := List.rev sublist; try let op = Hashtbl.find abbrev_command_table abbr in Hashtbl.remove abbrev_command_table abbr; Hashtbl.remove command_abbrev_table op with Not_found -> ();; let translate_abbrev abb = Hashtbl.find abbrev_command_table abb;; let abbrev_of_operation op = Hashtbl.find command_abbrev_table op;; let translate_constant const = Hashtbl.find constants_table const;; let decode_single_key_string key_string = let decode_alias str = match str with |"" -> 27 |"" -> 9 |"" -> Key.enter |"" -> 10 |"" -> Key.ic |"" -> Key.dc |"" -> Key.home |"" -> Key.end_ |"" -> Key.ppage |"" -> Key.npage |"" -> 32 |"" -> Key.backspace |"" -> Key.left |"" -> Key.right |"" -> Key.up |"" -> Key.down |"" -> (Key.f 1) |"" -> (Key.f 2) |"" -> (Key.f 3) |"" -> (Key.f 4) |"" -> (Key.f 5) |"" -> (Key.f 6) |"" -> (Key.f 7) |"" -> (Key.f 8) |"" -> (Key.f 9) |"" -> (Key.f 10) |"" -> (Key.f 11) |"" -> (Key.f 12) |_ -> if String.length key_string = 1 then int_of_char str.[0] else config_failwith ("Unrecognized key \"" ^ str ^ "\"") in (* This regexp is used to extract the ctrl and meta characters from a string * representing a keypress. * It matches \\M\\C or \\C\\M or \\C or \\M (or no such characters) followed * by an arbitrary string. *) (* Note: is there a way to use raw strings here? Getting tired of those * backslashes...*) let cm_re = Str.regexp "^\\(\\(\\\\M\\\\C\\|\\\\C\\\\M\\)\\|\\(\\\\M\\)\\|\\(\\\\C\\)\\)?\\(<.+>\\|.\\)" in if Str.string_match cm_re key_string 0 then let has_meta_ctrl = try let _ = Str.matched_group 2 key_string in true with Not_found -> false and has_meta = try let _ = Str.matched_group 3 key_string in true with Not_found -> false and has_ctrl = try let _ = Str.matched_group 4 key_string in true with Not_found -> false and main_key = Str.matched_group 5 key_string in if has_meta_ctrl then if String.length main_key = 1 then let uc_main_key = String.uppercase main_key in let mc_chtype = ((int_of_char uc_main_key.[0]) + 64) in let mc_str = "M-C-" ^ uc_main_key in (mc_chtype, mc_str) else config_failwith ("Cannot apply \\\\M\\\\C to key \"" ^ main_key ^ "\";\n" ^ "octal notation might let you accomplish this.") else if has_meta then if String.length main_key = 1 then let m_chtype = ((int_of_char main_key.[0]) + 128) in let m_str = "M-" ^ main_key in (m_chtype, m_str) else config_failwith ("Cannot apply \\\\M to key \"" ^ main_key ^ "\";\n" ^ "octal notation might let you accomplish this.") else if has_ctrl then if String.length main_key = 1 then let uc_main_key = String.uppercase main_key in let c_chtype = ((int_of_char uc_main_key.[0]) - 64) in let c_str = "C-" ^ uc_main_key in (c_chtype, c_str) else config_failwith ("Cannot apply \\\\C to key \"" ^ main_key ^ "\";\n" ^ "octal notation might let you accomplish this.") else let octal_regex = Str.regexp "^0o" in try let _ = Str.search_forward octal_regex key_string 0 in ((int_of_string key_string), ("\\" ^ Str.string_after key_string 2)) with _ -> ((decode_alias main_key), main_key) else config_failwith ("Unable to match binding string with standard regular expression.") (* Register a key binding. This adds hash table entries for translation * between curses chtypes and commands (in both directions). *) let register_binding_internal k k_string op = match op with |Function x -> Hashtbl.add table_key_function k x; Hashtbl.add table_function_key x k_string |Command x -> Hashtbl.add table_key_command k x; Hashtbl.add table_command_key x k_string |Edit x -> Hashtbl.add table_key_edit k x; Hashtbl.add table_edit_key x k_string |Browse x -> Hashtbl.add table_key_browse k x; Hashtbl.add table_browse_key x k_string |Abbrev x -> Hashtbl.add table_key_abbrev k x; Hashtbl.add table_abbrev_key x k_string |IntEdit x -> Hashtbl.add table_key_intedit k x; Hashtbl.add table_intedit_key x k_string |VarEdit x -> Hashtbl.add table_key_varedit k x; Hashtbl.add table_varedit_key x k_string (* convenience routine for previous *) let register_binding key_string op = (* given a string that represents a character, find the associated * curses chtype *) let k, string_rep = decode_single_key_string key_string in register_binding_internal k string_rep op (* Unregister key bindings. *) let unregister_function_binding key_string = let k, _ = decode_single_key_string key_string in try let op = Hashtbl.find table_key_function k in Hashtbl.remove table_key_function k; Hashtbl.remove table_function_key op with Not_found -> () let unregister_command_binding key_string = let k, _ = decode_single_key_string key_string in try let op = Hashtbl.find table_key_command k in Hashtbl.remove table_key_command k; Hashtbl.remove table_command_key op with Not_found -> () let unregister_edit_binding key_string = let k, _ = decode_single_key_string key_string in try let op = Hashtbl.find table_key_edit k in Hashtbl.remove table_key_edit k; Hashtbl.remove table_edit_key op with Not_found -> () let unregister_browse_binding key_string = let k, _ = decode_single_key_string key_string in try let op = Hashtbl.find table_key_browse k in Hashtbl.remove table_key_browse k; Hashtbl.remove table_browse_key op with Not_found -> () let unregister_abbrev_binding key_string = let k, _ = decode_single_key_string key_string in try let op = Hashtbl.find table_key_abbrev k in Hashtbl.remove table_key_abbrev k; Hashtbl.remove table_abbrev_key op with Not_found -> () let unregister_intedit_binding key_string = let k, _ = decode_single_key_string key_string in try let op = Hashtbl.find table_key_intedit k in Hashtbl.remove table_key_intedit k; Hashtbl.remove table_intedit_key op with Not_found -> () let unregister_varedit_binding key_string = let k, _ = decode_single_key_string key_string in try let op = Hashtbl.find table_key_varedit k in Hashtbl.remove table_key_varedit k; Hashtbl.remove table_varedit_key op with Not_found -> () (* Remove a key binding. *) let remove_binding k op = match op with |Function x -> Hashtbl.remove table_key_function k; Hashtbl.remove table_function_key x |Command x -> Hashtbl.remove table_key_command k; Hashtbl.remove table_command_key x |Edit x -> Hashtbl.remove table_key_edit k; Hashtbl.remove table_edit_key x |Browse x -> Hashtbl.remove table_key_browse k; Hashtbl.remove table_browse_key x |Abbrev x -> Hashtbl.remove table_key_abbrev k; Hashtbl.remove table_abbrev_key x |IntEdit x -> Hashtbl.remove table_key_intedit k; Hashtbl.remove table_intedit_key x |VarEdit x -> Hashtbl.remove table_key_varedit k; Hashtbl.remove table_varedit_key x (* Register a macro. This parses the macro string and divides it into multiple * whitespace-separated keypresses, then stores the list of keypresses in the * appropriate hashtable. *) let register_macro key keys_string = let macro_ch = fst (decode_single_key_string key) in let split_regex = Str.regexp "[ \t]+" in let keys_list = Str.split split_regex keys_string in let ch_of_key_string k_string = fst (decode_single_key_string k_string) in let ch_list = List.rev_map ch_of_key_string keys_list in Hashtbl.add table_key_macro macro_ch ch_list (* translate a command string to the command type it represents *) let operation_of_string command_str = begin match command_str with |"function_add" -> (Function Add) |"function_sub" -> (Function Sub) |"function_mult" -> (Function Mult) |"function_div" -> (Function Div) |"function_neg" -> (Function Neg) |"function_inv" -> (Function Inv) |"function_pow" -> (Function Pow) |"function_sq" -> (Function Sq) |"function_sqrt" -> (Function Sqrt) |"function_abs" -> (Function Abs) |"function_arg" -> (Function Arg) |"function_exp" -> (Function Exp) |"function_ln" -> (Function Ln) |"function_10_x" -> (Function Ten_x) |"function_log10" -> (Function Log10) |"function_conj" -> (Function Conj) |"function_sin" -> (Function Sin) |"function_cos" -> (Function Cos) |"function_tan" -> (Function Tan) |"function_asin" -> (Function Asin) |"function_acos" -> (Function Acos) |"function_atan" -> (Function Atan) |"function_sinh" -> (Function Sinh) |"function_cosh" -> (Function Cosh) |"function_tanh" -> (Function Tanh) |"function_asinh" -> (Function Asinh) |"function_acosh" -> (Function Acosh) |"function_atanh" -> (Function Atanh) |"function_re" -> (Function Re) |"function_im" -> (Function Im) |"function_gamma" -> (Function Gamma) |"function_lngamma" -> (Function LnGamma) |"function_erf" -> (Function Erf) |"function_erfc" -> (Function Erfc) |"function_factorial" -> (Function Fact) |"function_transpose" -> (Function Transpose) |"function_mod" -> (Function Mod) |"function_floor" -> (Function Floor) |"function_ceiling" -> (Function Ceiling) |"function_to_int" -> (Function ToInt) |"function_to_real" -> (Function ToFloat) |"function_solve_linear" -> (Function SolveLin) |"function_eval" -> (Function Eval) |"function_store" -> (Function Store) |"function_purge" -> (Function Purge) |"function_gcd" -> (Function Gcd) |"function_lcm" -> (Function Lcm) |"function_binomial_coeff" -> (Function Binom) |"function_permutation" -> (Function Perm) |"function_total" -> (Function Total) |"function_mean" -> (Function Mean) |"function_sumsq" -> (Function Sumsq) |"function_var_unbiased" -> (Function Var) |"function_var_biased" -> (Function VarBias) |"function_stdev_unbiased" -> (Function Stdev) |"function_stdev_biased" -> (Function StdevBias) |"function_minimum" -> (Function Min) |"function_maximum" -> (Function Max) |"function_utpn" -> (Function Utpn) |"function_standardize_units" -> (Function StandardizeUnits) |"function_convert_units" -> (Function ConvertUnits) |"function_unit_value" -> (Function UnitValue) |"function_trace" -> (Function Trace) |"edit_begin_integer" -> (Edit BeginInteger) |"edit_complex" -> (Edit BeginComplex) |"edit_matrix" -> (Edit BeginMatrix) |"edit_separator" -> (Edit Separator) |"edit_angle" -> (Edit Angle) |"edit_minus" -> (Edit Minus) |"edit_backspace" -> (Edit Backspace) |"edit_enter" -> (Edit Enter) |"edit_scientific_notation_base" -> (Edit SciNotBase) |"edit_begin_units" -> (Edit BeginUnits) |"command_drop" -> (Command Drop) |"command_clear" -> (Command Clear) |"command_swap" -> (Command Swap) |"command_dup" -> (Command Dup) |"command_undo" -> (Command Undo) |"command_begin_browsing" -> (Command BeginBrowse) |"command_begin_abbrev" -> (Command BeginAbbrev) |"command_begin_constant" -> (Command BeginConst) |"command_begin_variable" -> (Command BeginVar) |"command_quit" -> (Command Quit) |"command_rad" -> (Command SetRadians) |"command_deg" -> (Command SetDegrees) |"command_rect" -> (Command SetRect) |"command_polar" -> (Command SetPolar) |"command_bin" -> (Command SetBin) |"command_oct" -> (Command SetOct) |"command_dec" -> (Command SetDec) |"command_hex" -> (Command SetHex) |"command_toggle_angle_mode" -> (Command ToggleAngleMode) |"command_toggle_complex_mode" -> (Command ToggleComplexMode) |"command_cycle_base" -> (Command CycleBase) |"command_view" -> (Command View) |"command_refresh" -> (Command Refresh) |"command_about" -> (Command About) |"command_enter_pi" -> (Command EnterPi) |"command_rand" -> (Command Rand) |"command_edit_input" -> (Command EditInput) |"command_cycle_help" -> (Command CycleHelp) |"browse_end" -> (Browse EndBrowse) |"browse_scroll_left" -> (Browse ScrollLeft) |"browse_scroll_right" -> (Browse ScrollRight) |"browse_prev_line" -> (Browse PrevLine) |"browse_next_line" -> (Browse NextLine) |"browse_echo" -> (Browse Echo) |"browse_rolldown" -> (Browse RollDown) |"browse_rollup" -> (Browse RollUp) |"browse_view" -> (Browse ViewEntry) |"browse_drop" -> (Browse Drop1) |"browse_dropn" -> (Browse DropN) |"browse_keep" -> (Browse Keep) |"browse_keepn" -> (Browse KeepN) |"browse_edit" -> (Browse EditEntry) |"abbrev_exit" -> (Abbrev AbbrevExit) |"abbrev_enter" -> (Abbrev AbbrevEnter) |"abbrev_backspace" -> (Abbrev AbbrevBackspace) |"integer_cancel" -> (IntEdit IntEditExit) |"variable_cancel" -> (VarEdit VarEditExit) |"variable_enter" -> (VarEdit VarEditEnter) |"variable_backspace" -> (VarEdit VarEditBackspace) |"variable_complete" -> (VarEdit VarEditComplete) |"function_rand" -> config_failwith "operation \"function_rand\" is deprecated; please replace with \"command_rand\"." |"command_begin_extended" -> config_failwith "operation \"command_begin_extended\" is deprecated; please replace with \"command_begin_abbrev\"." |"extended_exit" -> config_failwith "operation \"extended_exit\" is deprecated; please replace with \"abbrev_exit\"." |"extended_enter" -> config_failwith "operation \"extended_enter\" is deprecated; please replace with \"abbrev_enter\"." |"extended_backspace" -> config_failwith "operation \"extended_backspace\" is deprecated; please replace with \"abbrev_backspace\"." |_ -> config_failwith ("Unknown command name \"" ^ command_str ^ "\"") end (* Parse a line from an Orpie configuration file. This operates on a stream * corresponding to a non-empty line from the file. It will match commands * of the form * bind key command * macro key multiple_keys * where 'key' is either a quoted string containing a key specifier or an octal * key representation of the form \xxx (unquoted), and multiple_keys is a quoted * string containing a number of keypresses to simulate. *) let parse_line line_stream = match line_stream with parser | [< 'Kwd "include" >] -> begin match line_stream with parser | [< 'String include_file >] -> included_rcfiles := include_file :: !included_rcfiles | [< >] -> config_failwith ("Expected a filename string after \"include\"") end | [< 'Kwd "bind" >] -> let bind_key key = begin match line_stream with parser | [< 'Ident command_str >] -> let command = operation_of_string command_str in register_binding key command | [< >] -> config_failwith ("Expected a command name after \"bind \"" ^ key ^ "\"") end in begin match line_stream with parser | [< 'String k >] -> bind_key k | [< 'Ident "\\" >] -> begin match line_stream with parser | [< 'Int octal_int >] -> begin try let octal_digits = "0o" ^ (string_of_int octal_int) in bind_key octal_digits with (Failure "int_of_string") -> config_failwith "Expected octal digits after \"\\\"" end | [< >] -> config_failwith "Expected octal digits after \"\\\"" end | [< >] -> config_failwith "Expected a key string after keyword \"bind\"" end | [< 'Kwd "unbind_function" >] -> begin match line_stream with parser | [< 'String k >] -> unregister_function_binding k | [< >] -> config_failwith ("Expected a key string after keyword \"unbind_function\"") end | [< 'Kwd "unbind_command" >] -> begin match line_stream with parser | [< 'String k >] -> unregister_command_binding k | [< >] -> config_failwith ("Expected a key string after keyword \"unbind_command\"") end | [< 'Kwd "unbind_edit" >] -> begin match line_stream with parser | [< 'String k >] -> unregister_edit_binding k | [< >] -> config_failwith ("Expected a key string after keyword \"unbind_edit\"") end | [< 'Kwd "unbind_browse" >] -> begin match line_stream with parser | [< 'String k >] -> unregister_browse_binding k | [< >] -> config_failwith ("Expected a key string after keyword \"unbind_browse\"") end | [< 'Kwd "unbind_abbrev" >] -> begin match line_stream with parser | [< 'String k >] -> unregister_abbrev_binding k | [< >] -> config_failwith ("Expected a key string after keyword \"unbind_abbrev\"") end | [< 'Kwd "unbind_integer" >] -> begin match line_stream with parser | [< 'String k >] -> unregister_intedit_binding k | [< >] -> config_failwith ("Expected a key string after keyword \"unbind_integer\"") end | [< 'Kwd "unbind_variable" >] -> begin match line_stream with parser | [< 'String k >] -> unregister_varedit_binding k | [< >] -> config_failwith ("Expected a key string after keyword \"unbind_variable\"") end | [< 'Kwd "autobind" >] -> begin match line_stream with parser | [< 'String k >] -> let key, key_string = decode_single_key_string k in autobind_keys_list := (key, key_string, None, 1) :: !autobind_keys_list | [< 'Ident "\\" >] -> begin match line_stream with parser | [< 'Int octal_int >] -> begin try let octal_digits = "0o" ^ (string_of_int octal_int) in let key, key_string = decode_single_key_string octal_digits in autobind_keys_list := (key, key_string, None, 1) :: !autobind_keys_list with (Failure "int_of_string") -> config_failwith "Expected octal digits after \"\\\"" end | [< >] -> config_failwith "Expected octal digits after \"\\\"" end | [< >] -> config_failwith "Expected a key string after keyword \"bind\"" end | [< 'Kwd "macro" >] -> begin match line_stream with parser | [< 'String key >] -> begin match line_stream with parser | [< 'String generated_keys >] -> register_macro key generated_keys | [< >] -> config_failwith ("Expected a key string after \"macro \"" ^ key ^ "\"") end | [< >] -> config_failwith "Expected a key string after keyword \"macro\"" end | [< 'Kwd "abbrev" >] -> begin match line_stream with parser | [< 'String abbr >] -> begin match line_stream with parser | [< 'Ident command_str >] -> let command = operation_of_string command_str in register_abbrev abbr command | [< >] -> config_failwith ("Expected a command name after \"abbrev \"" ^ abbr ^ "\"") end | [< >] -> config_failwith ("Expected an abbreviation string after \"abbrev\"") end | [< 'Kwd "unabbrev" >] -> begin match line_stream with parser | [< 'String abbr >] -> unregister_abbrev abbr | [< >] -> config_failwith ("Expected an abbreviation string after \"unabbrev\"") end | [< 'Kwd "set" >] -> begin match line_stream with parser | [< 'Ident "datadir" >] -> begin match line_stream with parser | [< 'Ident "=" >] -> begin match line_stream with parser | [< 'String dir >] -> datadir := dir | [< >] -> config_failwith ("Expected a directory string after " ^ "\"set datadir = \"") end | [< >] -> config_failwith ("Expected \"=\" after \"set datadir\"") end | [< 'Ident "editor" >] -> begin match line_stream with parser | [< 'Ident "=" >] -> begin match line_stream with parser | [< 'String executable >] -> ( (* Printf.fprintf stderr "using editor \"%s\"\n" executable; *) editor := executable) | [< >] -> config_failwith ("Expected an executable filename string after " ^ "\"set editor = \"") end | [< >] -> config_failwith ("Expected \"=\" after \"set editor\"") end | [< 'Ident "hide_help" >] -> begin match line_stream with parser | [< 'Ident "=" >] -> begin match line_stream with parser | [< 'String setting >] -> if setting = "true" then hide_help := true else if setting = "false" then hide_help := false else config_failwith ("Expected a boolean argument after " ^ "\"set hide_help = \"") | [< >] -> config_failwith ("Expected a boolean argument after " ^ "\"set hide_help = \"") end | [< >] -> config_failwith ("Expected \"=\" after \"set hide_help\"") end | [< 'Ident "conserve_memory" >] -> begin match line_stream with parser | [< 'Ident "=" >] -> begin match line_stream with parser | [< 'String setting >] -> if setting = "true" then conserve_memory := true else if setting = "false" then conserve_memory := false else config_failwith ("Expected a boolean argument after " ^ "\"set conserve_memory = \"") | [< >] -> config_failwith ("Expected a boolean argument after " ^ "\"set conserve_memory = \"") end | [< >] -> config_failwith ("Expected \"=\" after \"set conserve_memory\"") end | [< >] -> config_failwith ("Unmatched variable name after \"set\"") end | [< 'Kwd "base_unit" >] -> begin match line_stream with parser | [< 'String base_u; 'String prefix_s >] -> begin try let prefix = Units.prefix_of_string prefix_s in unit_table := Units.add_base_unit base_u prefix !unit_table with Not_found -> config_failwith ("Expected an SI prefix string (or null string) after: base_unit \"" ^ base_u ^ "\"") end | [< >] -> config_failwith ("Expected a unit string and prefix string after \"base_unit\"") end | [< 'Kwd "unit" >] -> begin match line_stream with parser | [< 'String unit_str; 'String unit_def_str >] -> begin try let unit_def = Units.unit_def_of_string unit_def_str !unit_table in unit_table := Units.add_unit unit_str unit_def !unit_table with Units.Units_error s -> config_failwith ("Illegal unit definition: unit \"" ^ unit_str ^ "\" \"" ^ unit_def_str ^ "\"; " ^ s) end | [< >] -> config_failwith ("Expected a unit string and definition after \"unit\"") end | [< 'Kwd "constant" >] -> begin match line_stream with parser | [< 'String const_str; 'String unit_def_str >] -> begin try let unit_def = Units.unit_def_of_string unit_def_str !unit_table in register_constant const_str unit_def with Units.Units_error s -> config_failwith ("Illegal constant definition: constant \"" ^ const_str ^ "\" \"" ^ unit_def_str ^ "\"; " ^ s) end | [< >] -> config_failwith ("Expected a constant name and definition after \"constant\"") end | [< 'Kwd "#" >] -> () | [< >] -> config_failwith "Expected a keyword at start of line";; (* obtain a valid autobinding array, eliminating duplicate keys *) let generate_autobind_array () = let candidates = Array.of_list (List.rev !autobind_keys_list) in let temp_arr = Array.make (Array.length candidates) (0, "", None, 0) in let pointer = ref 0 in for i = 0 to pred (Array.length candidates) do let (c_k, c_ss, c_bound_f, c_age) = candidates.(i) in let matched = ref false in for j = 0 to !pointer do let (t_k, t_ss, t_bound_f, t_age) = temp_arr.(j) in if c_k = t_k then matched := true else () done; if not !matched then begin temp_arr.(!pointer) <- candidates.(i); pointer := succ !pointer end else () done; autobind_keys := Array.sub temp_arr 0 !pointer (* compare a set of autobindings saved to disk to the set loaded from the * orpierc file. If the autobindings match and the hashtbl abbreviations * are the same, then use the saved version. *) let validate_saved_autobindings saved_autobind = if Array.length !autobind_keys = Array.length saved_autobind then let is_valid = ref true in for i = 0 to pred (Array.length saved_autobind) do let (s_key, s_key_str, s_bound_f, s_age) = saved_autobind.(i) and (n_key, n_key_str, n_bound_f, n_age) = !autobind_keys.(i) in if s_key = n_key then begin try begin match s_bound_f with |None -> () |Some op -> let _ = abbrev_of_operation op in () end with Not_found -> (* if the function has no associated abbreviation, then consider * the saved autobindings to be flawed *) is_valid := false end else (* if the autobindings are different from the saved set, then * consider the saved set to be flawed. *) is_valid := false done; if !is_valid then begin autobind_keys := saved_autobind; for i = 0 to pred (Array.length !autobind_keys) do let (n_key, n_key_str, n_bound_f, n_age) = !autobind_keys.(i) in match n_bound_f with |None -> () |Some op -> register_binding_internal n_key n_key_str op done end else () else () (* try opening the rc file, first looking at $HOME/.orpierc, * then looking at $PREFIX/etc/orpierc *) let open_rcfile rcfile_op = match rcfile_op with |None -> let home_rcfile = let homedir = Sys.getenv "HOME" in homedir ^ "/.orpierc" in let rcfile_fullpath = (* expand out any occurrences of ${prefix} that autoconf * decides to insert *) let prefix_regex = Str.regexp "\\${prefix}" in let expanded_sysconfdir = Str.global_replace prefix_regex Install.prefix Install.sysconfdir in Utility.join_path expanded_sysconfdir "orpierc" in begin try (open_in home_rcfile, home_rcfile) with Sys_error error_str -> begin try (open_in rcfile_fullpath, rcfile_fullpath) with Sys_error error_str -> failwith ("Could not open configuration file \"" ^ home_rcfile ^ "\" or \"" ^ rcfile_fullpath ^ "\" .") end end |Some file -> try (Utility.expand_open_in_ascii file, file) with Sys_error error_str -> config_failwith ("Could not open configuration file \"" ^ file ^ "\".") let rec process_rcfile rcfile_op = let line_lexer line = make_lexer ["include"; "bind"; "unbind_function"; "unbind_command"; "unbind_edit"; "unbind_browse"; "unbind_abbrev"; "unbind_integer"; "unbind_variable"; "autobind"; "abbrev"; "unabbrev"; "macro"; "set"; "base_unit"; "unit"; "constant"; "#"] (Stream.of_string line) in let empty_regexp = Str.regexp "^[\t ]*$" in let config_stream, rcfile_filename = open_rcfile rcfile_op in let line_num = ref 0 in try while true do line_num := succ !line_num; let line_string = input_line config_stream in (* Printf.fprintf stderr "read line %2d: %s\n" !line_num line_string; flush stderr; *) if Str.string_match empty_regexp line_string 0 then (* do nothing on an empty line *) () else try let line_stream = line_lexer line_string in parse_line line_stream; (* process any included rcfiles as they are encountered *) begin match !included_rcfiles with |[] -> () |head :: tail -> included_rcfiles := tail; process_rcfile (Some head) end with |Config_failure s -> (let error_str = Printf.sprintf "Syntax error on line %d of \"%s\": %s" !line_num rcfile_filename s in failwith error_str) |Stream.Failure -> failwith (Printf.sprintf "Syntax error on line %d of \"%s\"" !line_num rcfile_filename) done with End_of_file -> begin close_in config_stream; generate_autobind_array () end (* arch-tag: DO_NOT_CHANGE_614115ed-7d1d-4834-bda4-e6cf93ac3fcd *) orpie-1.5.2/orpierc0000644000175000017500000002653612322115103012711 0ustar paulpaul# orpierc # default key bindings and other settings for the Orpie calculator # directory for storing Orpie data set datadir="~/.orpie/" # editor used for fullscreen viewing of stack elements set editor="vi" # whether or not to hide the help panel set hide_help="false" # whether or not to conserve memory in favor of faster rendering set conserve_memory="false" # keys for "edit" operations, which affect the data that # is currently being entered bind "n" edit_minus bind "" edit_backspace bind "" edit_enter bind "`" edit_scientific_notation_base bind "" edit_scientific_notation_base bind "#" edit_begin_integer bind "(" edit_complex bind "[" edit_matrix bind "," edit_separator bind "<" edit_angle bind "_" edit_begin_units # keys for "integer edit" operations bind "#" integer_cancel # keys for "function" operations, which operate on an argument bind "+" function_add bind "-" function_sub bind "*" function_mult bind "/" function_div bind "n" function_neg bind "i" function_inv bind "^" function_pow bind "s" function_sqrt bind "a" function_abs bind "\\Ca" function_arg bind "e" function_exp bind "l" function_ln bind "c" function_conj bind "!" function_factorial bind "%" function_mod bind "S" function_store bind ";" function_eval # keys for "command" operations, which do not take an argument bind "\\" command_drop bind "|" command_clear bind "" command_swap bind "" command_swap bind "" command_dup bind "u" command_undo bind "" command_begin_browsing bind "'" command_begin_abbrev bind "C" command_begin_constant bind "@" command_begin_variable bind "r" command_toggle_angle_mode bind "p" command_toggle_complex_mode bind "b" command_cycle_base bind "v" command_view bind "\\Cl" command_refresh bind "P" command_enter_pi bind "E" command_edit_input bind "h" command_cycle_help bind "Q" command_quit # keys for "browse" operations, which are active during # stack browsing mode bind "q" browse_end bind "" browse_scroll_left bind "" browse_scroll_right bind "" browse_prev_line bind "" browse_next_line bind "r" browse_rolldown bind "R" browse_rollup bind "v" browse_view bind "" browse_echo bind "\\" browse_drop bind "d" browse_drop bind "D" browse_dropn bind "k" browse_keep bind "K" browse_keepn bind "E" browse_edit # keys for abbrev mode operations bind "'" abbrev_exit bind "" abbrev_enter bind "" abbrev_backspace # keys for variable edit mode operations bind "@" variable_cancel bind "" variable_enter bind "" variable_backspace bind "" variable_complete # autobound keys autobind "" autobind "" autobind "" autobind "" autobind "" autobind "" autobind "" autobind "" # abbrev command abbreviations # these should be given in the desired order of matching precedence abbrev "inv" function_inv abbrev "pow" function_pow abbrev "sq" function_sq abbrev "sqrt" function_sqrt abbrev "abs" function_abs abbrev "arg" function_arg abbrev "exp" function_exp abbrev "ln" function_ln abbrev "10^" function_10_x abbrev "log10" function_log10 abbrev "conj" function_conj abbrev "sin" function_sin abbrev "cos" function_cos abbrev "tan" function_tan abbrev "sinh" function_sinh abbrev "cosh" function_cosh abbrev "tanh" function_tanh abbrev "asinh" function_asinh abbrev "acosh" function_acosh abbrev "atanh" function_atanh abbrev "asin" function_asin abbrev "acos" function_acos abbrev "atan" function_atan abbrev "re" function_re abbrev "im" function_im abbrev "gamma" function_gamma abbrev "lngamma" function_lngamma abbrev "erf" function_erf abbrev "erfc" function_erfc abbrev "fact" function_factorial abbrev "trans" function_transpose abbrev "mod" function_mod abbrev "floor" function_floor abbrev "ceil" function_ceiling abbrev "toint" function_to_int abbrev "toreal" function_to_real abbrev "solvelin" function_solve_linear abbrev "eval" function_eval abbrev "store" function_store abbrev "purge" function_purge abbrev "gcd" function_gcd abbrev "lcm" function_lcm abbrev "binom" function_binomial_coeff abbrev "perm" function_permutation abbrev "total" function_total abbrev "mean" function_mean abbrev "sumsq" function_sumsq abbrev "var" function_var_unbiased abbrev "varbias" function_var_biased abbrev "stdev" function_stdev_unbiased abbrev "stdevbias" function_stdev_biased abbrev "min" function_minimum abbrev "max" function_maximum abbrev "utpn" function_utpn abbrev "ustand" function_standardize_units abbrev "uconvert" function_convert_units abbrev "uvalue" function_unit_value abbrev "trace" function_trace abbrev "drop" command_drop abbrev "clear" command_clear abbrev "swap" command_swap abbrev "dup" command_dup abbrev "undo" command_undo abbrev "quit" command_quit abbrev "rad" command_rad abbrev "deg" command_deg abbrev "rect" command_rect abbrev "polar" command_polar abbrev "bin" command_bin abbrev "oct" command_oct abbrev "dec" command_dec abbrev "hex" command_hex abbrev "view" command_view abbrev "refresh" command_refresh abbrev "pi" command_enter_pi abbrev "rand" command_rand abbrev "edit" command_edit_input abbrev "add" function_add abbrev "sub" function_sub abbrev "mult" function_mult abbrev "div" function_div abbrev "neg" function_neg abbrev "about" command_about # fundamental SI units base_unit "m" "" base_unit "g" "k" base_unit "s" "" base_unit "A" "" base_unit "K" "" base_unit "mol" "" base_unit "cd" "" # derived distance units unit "in" "2.54_cm" unit "ft" "12_in" unit "yd" "3_ft" unit "mi" "1760_yd" unit "pc" "3.085678e16_m" unit "AU" "1.49598e11_m" unit "Ang" "1e-10_m" unit "furlong" "660_ft" unit "point" "0.0138888888888888_in" unit "pica" "12_point" unit "nmi" "1852_m" unit "lyr" "63239.7139591_AU" # derived mass units unit "gr" "0.06479891_g" unit "oz" "437.5_gr" unit "lb" "16_oz" unit "slug" "14593.9029_g" unit "lbt" "5760_gr" unit "ton" "2000_lb" unit "tonl" "2240_lb" unit "tonm" "1e6_g" unit "ct" "0.2_g" # derived time units unit "min" "60_s" unit "hr" "60_min" unit "day" "24_hr" unit "yr" "365.242199_day" # derived temperature units unit "R" "0.555555555555556_K" # derived force units unit "N" "1_kg*m/s^2" unit "lbf" "4.44822162_N" unit "dyne" "1e-5_N" unit "kip" "1000_lbf" # derived energy units unit "J" "1_N*m" unit "erg" "1e-7_J" unit "cal" "4.1868_J" unit "BTU" "1055.05585252_J" unit "eV" "1.602176487e-19_J" # derived frequency units unit "Hz" "1_s^-1" # derived power units unit "W" "1_J/s" unit "hp" "33000_lbf*ft/min" # derived pressure units unit "Pa" "1_N/m^2" unit "bar" "1e5_Pa" unit "inHg" "3386_Pa" unit "mmHg" "133.307086614173_Pa" unit "atm" "760_mmHg" # various derived electrical units unit "C" "1_A*s" unit "V" "1_W/A" unit "Ohm" "1_V/A" unit "F" "1_C/V" unit "Wb" "1_V*s" unit "H" "1_Wb/A" unit "T" "1_Wb/m^2" unit "G" "1e-4_T" unit "Mw" "1e-8_Wb" # derived units of luminous flux and illuminance # (steridian is dropped because it is dimensionless) unit "lm" "1_cd" unit "lx" "1_lm/m^2" # derived units of (fluid) volume unit "L" "0.001_m^3" unit "ozfl" "29.573529562_mL" unit "cup" "8_ozfl" unit "pt" "2_cup" unit "qt" "2_pt" unit "gal" "4_qt" # various physical constants # Avagadro's number constant "NA" "6.0221367e23_mol^-1" # Boltzmann's constant constant "k" "1.380658e-23_J/K" # molar volume constant "Vm" "0.0224141_m^3/mol" # universal gas constant constant "R" "8.31451_J/mol/K" # standard temperature constant "stdT" "273.15_K" # standard pressure constant "stdP" "101.325_kPa" # Stephan-Boltzmann constant constant "sigma" "1_W/m^2/K^4" # speed of light constant "c" "299792458.0_m/s" # permittivity of free space constant "eps0" "8.85418781761e-12_F/m" # permeability of free space constant "u0" "1.25663706144e-6_H/m" # acceleration of gravity constant "g" "9.80665_m/s^2" # gravitational constant constant "G" "6.67259e-11_m^3/s^2/kg" # Planck's constant constant "h" "6.6260755e-34_J*s" # Dirac's constant constant "hbar" "1.05457266e-34_J*s" # electronic charge constant "e" "1.60217733e-19_C" # electronic mass constant "me" "9.1093897e-31_kg" # proton mass constant "mp" "1.6726231e-17_kg" # fine structure constant constant "alpha" "0.00729735308" # magnetic flux quantum constant "phi" "2.06783461e-15_Wb" # Faraday's constant constant "F" "96485.309_C/mol" # "infinity" Rydberg constant constant "Rinf" "10973731.534_m^-1" # Bohr radius constant "a0" "0.0529177249_nm" # Bohr magneton constant "uB" "9.2740154e-24_J/T" # nuclear magneton constant "uN" "5.0507866e-27_J/T" # 1eV photon wavelength constant "lam0" "1239.8425_nm" # 1eV photon frequency constant "f0" "2.4179883e14_Hz" # Compton wavelength constant "lamc" "0.00242631058_nm" # Wien's constant constant "c3" "0.002897756_m*K" # base 2 logarithm macro "L" "l 2 l /" # or alternatively, using abbrev command syntax: #macro "L" "' l n 2 ' l n /" # binary entropy function (makes use of the "L" macro) macro "H" " 1 - n L * L * + n" # registers macro "" "@ r 0 1 " macro "" "@ r 0 2 " macro "" "@ r 0 3 " macro "" "@ r 0 4 " # arch-tag: DO_NOT_CHANGE_bb2181f2-1288-4d0f-849b-36482daf59c5 orpie-1.5.2/rpc_stack.ml0000644000175000017500000011246312322115103013621 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* rpc_stack.ml -- implementation of internal calculator stack that holds * multiple data types * * The stack is implemented as a dynamically-allocated array. This approach * enables non-standard stack operations such as random access and cyclic rotation of * elements. * * Each stack element contains both data and string (option) representations * of the data. There can be multiple string representations, corresponding to * line-oriented and fullscreen displays, four different bases, two * different angle modes, and two different complex representations. The * string representations are created immediately when needed; if not * immediately needed, they will eventually be precomputed and filled in in by a * background thread (unless conserve_memory = false). * * Note: arguably, the rendering functions belong with the interface code * rather than with the stack code. I may make this change at some * point, to better abstract the interface away from the underlying * calculator object. *) open Big_int open Big_int_str open Printf exception Stack_error of string (* orpie_data_t values are returned by pop(), but the values * on the stack are in stack_data_t format *) type orpie_data_t = | RpcInt of Big_int.big_int | RpcFloatUnit of float * Units.unit_set_t | RpcComplexUnit of Complex.t * Units.unit_set_t | RpcFloatMatrixUnit of Gsl_matrix.matrix * Units.unit_set_t | RpcComplexMatrixUnit of Gsl_matrix_complex.matrix * Units.unit_set_t | RpcVariable of string type stack_int_string_t = {mutable i_bin_line : string option; mutable i_oct_line : string option; mutable i_dec_line : string option; mutable i_hex_line : string option; mutable i_bin_fs : string option; mutable i_oct_fs : string option; mutable i_dec_fs : string option; mutable i_hex_fs : string option} type stack_float_unit_string_t = {mutable fu : string option} type stack_cmpx_unit_string_t = {mutable c_rect : string option; mutable c_pol_rad : string option; mutable c_pol_deg : string option} type stack_fmat_unit_string_t = {mutable fmat_line : string option; mutable fmat_fs : string option} type stack_cmat_string_t = {mutable cmat_rect_line : string option; mutable cmat_pol_rad_line : string option; mutable cmat_pol_deg_line : string option; mutable cmat_rect_fs : string option; mutable cmat_pol_rad_fs : string option; mutable cmat_pol_deg_fs : string option} type stack_var_string_t = {mutable v_line : string option; mutable v_fs : string option} (* internal storage format of stack elements *) type stack_data_t = | StackInt of Big_int.big_int * stack_int_string_t | StackFloatUnit of float * Units.unit_set_t * stack_float_unit_string_t | StackComplexUnit of Complex.t * Units.unit_set_t * stack_cmpx_unit_string_t | StackFloatMatrixUnit of Gsl_matrix.matrix * Units.unit_set_t * stack_fmat_unit_string_t | StackComplexMatrixUnit of Gsl_matrix_complex.matrix * Units.unit_set_t * stack_cmat_string_t | StackVariable of string * stack_var_string_t let raise_invalid s = raise (Invalid_argument s) let orpie_data_of_stack_data (sd : stack_data_t) = match sd with |StackInt (ii, _) -> RpcInt ii |StackFloatUnit (ff, uu, _) -> RpcFloatUnit (ff, uu) |StackComplexUnit (cc, uu, _) -> RpcComplexUnit (cc, uu) |StackFloatMatrixUnit (fm, uu, _) -> RpcFloatMatrixUnit (fm, uu) |StackComplexMatrixUnit (cm, uu, _) -> RpcComplexMatrixUnit (cm, uu) |StackVariable (vv, _) -> RpcVariable vv let stack_data_of_orpie_data (od : orpie_data_t) = match od with |RpcInt ii -> StackInt (ii, {i_bin_line = None; i_oct_line = None; i_dec_line = None; i_hex_line = None; i_bin_fs = None; i_oct_fs = None; i_dec_fs = None; i_hex_fs = None}) |RpcFloatUnit (ff, uu) -> StackFloatUnit (ff, uu, {fu = None}) |RpcComplexUnit (cc, uu) -> StackComplexUnit (cc, uu, {c_rect = None; c_pol_rad = None; c_pol_deg = None}) |RpcFloatMatrixUnit (fm, uu) -> StackFloatMatrixUnit (fm, uu, {fmat_line = None; fmat_fs = None}) |RpcComplexMatrixUnit (cm, uu) -> StackComplexMatrixUnit (cm, uu, {cmat_rect_line = None; cmat_pol_rad_line = None; cmat_pol_deg_line = None; cmat_rect_fs = None; cmat_pol_rad_fs = None; cmat_pol_deg_fs = None}) |RpcVariable vv -> StackVariable (vv, {v_line = None; v_fs = None}) let funit_of_float (ff : float) : float * Units.unit_set_t = (ff, Units.empty_unit) let cunit_of_cpx cc = (cc, Units.empty_unit) let unorm uu = (1.0, uu) let c_of_f ff = {Complex.re = ff; Complex.im = 0.0} let has_units uu = uu <> Units.empty_unit type display_mode_t = | Line | Fullscreen type angle_mode = | Rad | Deg type base_mode = | Bin | Oct | Hex | Dec type complex_mode = | Rect | Polar type calculator_modes = {angle : angle_mode; base : base_mode; complex : complex_mode} let size_inc = 100 let pi = 3.14159265358979323846 class rpc_stack conserve_memory_in = object(self) val mutable len = 0 val mutable stack = let (f0, u0) = funit_of_float 0.0 in Array.make size_inc (stack_data_of_orpie_data (RpcFloatUnit (f0, u0))) val conserve_memory = conserve_memory_in val render_stack = Stack.create () method length = len method get_state () = (stack, len) method set_state (s, l) = stack <- s; len <- l method backup () = let b_stack = Array.copy stack in {< stack = b_stack >} method private expand_size () = (* allocate a new stack if necessary *) if len >= Array.length stack then begin let new_stack = Array.make ((Array.length stack) + size_inc) (stack_data_of_orpie_data (RpcFloatUnit (0.0, Units.empty_unit))) in Array.blit stack 0 new_stack 0 (Array.length stack); stack <- new_stack end else () method push (v : orpie_data_t) = self#expand_size (); let new_el = stack_data_of_orpie_data v in stack.(len) <- new_el; len <- len + 1; if conserve_memory then () else Stack.push new_el render_stack method pop () = (* compact stack memory by size_inc whenever we have 2 * size_inc * elements free *) if len < (Array.length stack) - 2 * size_inc then let new_stack = Array.sub stack 0 ((Array.length stack) - size_inc) in stack <- new_stack else (); let pop_result = if len > 0 then begin len <- len - 1; orpie_data_of_stack_data stack.(len) end else raise (Stack_error "cannot pop empty stack"); in pop_result (* duplicate the top stack element *) method dup () = self#expand_size (); if len > 0 then begin stack.(len) <- stack.(pred len); len <- succ len end else raise (Stack_error "cannot dup with empty stack") (* swap the top two stack elements *) method swap () = if len > 1 then begin let temp = ref stack.(pred len) in stack.(pred len) <- stack.(len - 2); stack.(len - 2) <- !temp end else raise (Stack_error "cannot swap with less than two elements") (* copy a stack element to the top of the stack *) method echo el_num = self#expand_size (); if el_num <= len then begin let actual_el_num = len - el_num in stack.(len) <- stack.(actual_el_num); len <- succ len end else raise (Invalid_argument "cannot echo nonexistant element") (* cyclically roll all stack elements downward (i.e. towards the top * of the stack), starting below element number 'num' (inclusive). *) method rolldown num = if num <= len then let temp = stack.(pred len) in for i = pred len downto len - num + 1 do stack.(i) <- stack.(pred i) done; stack.(len - num) <- temp else raise (Stack_error "insufficient stack elements"); (* cyclically roll all stack elements upward (i.e. away from the top * of the stack), starting below element number 'num' (inclusive). *) method rollup num = if num <= len then let temp = stack.(len - num) in for i = len - num to len - 2 do stack.(i) <- stack.(succ i) done; stack.(pred len) <- temp else raise (Stack_error "insufficient stack elements"); (* delete a particular element *) method delete num = if num <= len then (for i = (len - num) to len do stack.(i) <- stack.(succ i) done; len <- (pred len)) else raise (Stack_error "insufficient stack elements"); (* delete all elements below level N *) method deleteN num = if num <= len then len <- len - num else raise (Stack_error "insufficient stack elements"); (* keep only a particular stack element *) method keep num = if num <= len then (stack.(0) <- stack.(len - num); len <- 1) else raise (Stack_error "insufficient stack elements"); (* keep all elements below the selected (inclusive) *) method keepN num = if num <= len then begin for i = 0 to num - 1 do stack.(i) <- stack.(i + len - num) done; len <- num end else raise (Stack_error "insufficient stack elements"); (* return a particular stack element without removing it from the stack *) (* element 1 points to the top of the stack *) method peek el_num = let peek_result = if el_num <= len then let actual_el_num = len - el_num in orpie_data_of_stack_data stack.(actual_el_num) else let s = Printf.sprintf "cannot access nonexistant stack element %d" el_num in raise (Stack_error s); in peek_result method private get_display_string_wrap disp_mode line_num calc_modes = if line_num > 0 then if line_num <= len then (* this is the actual index into the array *) let index = len - line_num in self#lookup_or_create_string disp_mode calc_modes index else (* line_num > len *) "" else (* line_num <= 0 *) raise (Stack_error ("cannot display nonexistent stack element " ^ (string_of_int line_num))) (* lookup (or create) a line-oriented display string *) method get_display_string line_num calc_modes = self#get_display_string_wrap Line line_num calc_modes (* lookup (or create) a fullscreen-oriented display string *) method get_fullscreen_display_string line_num calc_modes = self#get_display_string_wrap Fullscreen line_num calc_modes (* perform a table lookup to obtain the string representation of * the desired stack element. If the table lookup fails, then create * the representation. *) method private lookup_or_create_string disp_mode calc_modes index = let stack_el = stack.(index) in let lookup_result = begin match stack_el with |StackInt (ii, ii_str) -> let lookup_int_str record = begin match record with |None -> self#create_int_string disp_mode calc_modes ii ii_str |Some ss -> ss end in begin match disp_mode with |Line -> begin match calc_modes.base with |Bin -> lookup_int_str ii_str.i_bin_line |Oct -> lookup_int_str ii_str.i_oct_line |Dec -> lookup_int_str ii_str.i_dec_line |Hex -> lookup_int_str ii_str.i_hex_line end |Fullscreen -> begin match calc_modes.base with |Bin -> lookup_int_str ii_str.i_bin_fs |Oct -> lookup_int_str ii_str.i_oct_fs |Dec -> lookup_int_str ii_str.i_dec_fs |Hex -> lookup_int_str ii_str.i_hex_fs end end |StackFloatUnit (ff, uu, fu_str) -> begin match fu_str.fu with |None -> self#create_float_unit_string ff uu fu_str |Some ss -> ss end |StackComplexUnit (cc, uu, cc_str) -> let lookup_cmpx_str record = begin match record with |None -> self#create_cmpx_unit_string calc_modes cc uu cc_str |Some ss -> ss end in begin match calc_modes.complex with |Rect -> lookup_cmpx_str cc_str.c_rect |Polar -> begin match calc_modes.angle with |Rad -> lookup_cmpx_str cc_str.c_pol_rad |Deg -> lookup_cmpx_str cc_str.c_pol_deg end end |StackFloatMatrixUnit (fm, uu, fm_str) -> begin match disp_mode with |Line -> begin match fm_str.fmat_line with |None -> self#create_fmat_unit_string disp_mode fm uu fm_str |Some ss -> ss end |Fullscreen -> begin match fm_str.fmat_fs with |None -> self#create_fmat_unit_string disp_mode fm uu fm_str |Some ss -> ss end end |StackComplexMatrixUnit (cm, uu, cm_str) -> let lookup_cmat_str record = begin match record with |None -> self#create_cmat_unit_string disp_mode calc_modes cm uu cm_str |Some ss -> ss end in begin match disp_mode with |Line -> begin match calc_modes.complex with |Rect -> lookup_cmat_str cm_str.cmat_rect_line |Polar -> begin match calc_modes.angle with |Rad -> lookup_cmat_str cm_str.cmat_pol_rad_line |Deg -> lookup_cmat_str cm_str.cmat_pol_deg_line end end |Fullscreen -> begin match calc_modes.complex with |Rect -> lookup_cmat_str cm_str.cmat_rect_fs |Polar -> begin match calc_modes.angle with |Rad -> lookup_cmat_str cm_str.cmat_pol_rad_fs |Deg -> lookup_cmat_str cm_str.cmat_pol_deg_fs end end end |StackVariable (vv, vv_str) -> begin match disp_mode with |Line -> begin match vv_str.v_line with |None -> self#create_var_string disp_mode vv vv_str |Some ss -> ss end |Fullscreen -> begin match vv_str.v_fs with |None -> self#create_var_string disp_mode vv vv_str |Some ss -> ss end end end; in lookup_result (* render all string representations of a particular stack element. *) method private render_all_strings stack_el = match stack_el with |StackInt (ii, ii_str) -> let lookup_int_str d_mode c_mode record = begin match record with |None -> let _ = self#create_int_string d_mode c_mode ii ii_str in () |Some ss -> () end in lookup_int_str Line {angle = Rad; base = Dec; complex = Rect} ii_str.i_dec_line; lookup_int_str Line {angle = Rad; base = Bin; complex = Rect} ii_str.i_bin_line; lookup_int_str Line {angle = Rad; base = Oct; complex = Rect} ii_str.i_oct_line; lookup_int_str Line {angle = Rad; base = Hex; complex = Rect} ii_str.i_hex_line (* the remaining integer strings will get filled in as * side-effects of the previous *) |StackFloatUnit (ff, uu, fu_str) -> begin match fu_str.fu with |None -> let _ = self#create_float_unit_string ff uu fu_str in () |Some ss -> () end |StackComplexUnit (cc, uu, cc_str) -> let lookup_cmpx_str c_mode record = begin match record with |None -> let _ = self#create_cmpx_unit_string c_mode cc uu cc_str in () |Some ss -> () end in lookup_cmpx_str {angle = Rad; base = Dec; complex = Rect} cc_str.c_rect; lookup_cmpx_str {angle = Rad; base = Dec; complex = Polar} cc_str.c_pol_rad; lookup_cmpx_str {angle = Deg; base = Dec; complex = Polar} cc_str.c_pol_deg |StackFloatMatrixUnit (fm, uu, fm_str) -> begin match fm_str.fmat_line with |None -> let _ = self#create_fmat_unit_string Line fm uu fm_str in () |Some ss -> () end; begin match fm_str.fmat_fs with |None -> let _ = self#create_fmat_unit_string Fullscreen fm uu fm_str in () |Some ss -> () end |StackComplexMatrixUnit (cm, uu, cm_str) -> let lookup_cmat_str d_mode c_mode record = begin match record with |None -> let _ = self#create_cmat_unit_string d_mode c_mode cm uu cm_str in () |Some ss -> () end in lookup_cmat_str Line {angle = Rad; base = Dec; complex = Rect} cm_str.cmat_rect_line; lookup_cmat_str Line {angle = Rad; base = Dec; complex = Polar} cm_str.cmat_pol_rad_line; lookup_cmat_str Line {angle = Deg; base = Dec; complex = Polar} cm_str.cmat_pol_deg_line; lookup_cmat_str Fullscreen {angle = Rad; base = Dec; complex = Rect} cm_str.cmat_rect_fs; lookup_cmat_str Fullscreen {angle = Rad; base = Dec; complex = Polar} cm_str.cmat_pol_rad_fs; lookup_cmat_str Fullscreen {angle = Deg; base = Dec; complex = Polar} cm_str.cmat_pol_deg_fs |StackVariable (vv, vv_str) -> begin match vv_str.v_line with |None -> let _ = self#create_var_string Line vv vv_str in () |Some ss -> () end (* fullscreen is filled in as side-effect of previous *) (* generate the string representation for an integer, taking into * account the desired display mode and base. Fullscreen and line * representations are computed concurrently because they share * most of the computation. *) method private create_int_string disp_mode calc_modes ii ii_str = match calc_modes.base with |Bin -> let s = string_of_big_int_base ii 2 in let line = "# " ^ s ^ "`b" and fs = "#" ^ s ^ "`b" in if conserve_memory then () else begin ii_str.i_bin_line <- Some line; ii_str.i_bin_fs <- Some fs end; begin match disp_mode with |Line -> line |Fullscreen -> fs end |Oct -> let s = string_of_big_int_base ii 8 in let line = "# " ^ s ^ "`o" and fs = "#" ^ s ^ "`o" in if conserve_memory then () else begin ii_str.i_oct_line <- Some line; ii_str.i_oct_fs <- Some fs end; begin match disp_mode with |Line -> line |Fullscreen -> fs end |Hex -> let s = string_of_big_int_base ii 16 in let line = "# " ^ s ^ "`h" and fs = "#" ^ s ^ "`h" in if conserve_memory then () else begin ii_str.i_hex_line <- Some line; ii_str.i_hex_fs <- Some fs end; begin match disp_mode with |Line -> line |Fullscreen -> fs end |Dec -> let s = string_of_big_int_base_gen ii 10 in let line = "# " ^ s ^ "`d" and fs = "#" ^ s ^ "`d" in if conserve_memory then () else begin ii_str.i_dec_line <- Some line; ii_str.i_dec_fs <- Some fs end; begin match disp_mode with |Line -> line |Fullscreen -> fs end (* generate a string representation for a floating-point value with a unit *) method private create_float_unit_string ff uu fu_str = let s = if uu <> Units.empty_unit then sprintf "%.15g_%s" ff (Units.string_of_units uu) else sprintf "%.15g" ff in if conserve_memory then () else fu_str.fu <- Some s; s (* generate a string representation for a complex value, taking * into account the representation mode and angle mode of the calc *) method private create_cmpx_unit_string calc_modes cc uu cc_str = let append_units ss = if uu <> Units.empty_unit then ss ^ "_" ^ (Units.string_of_units uu) else ss in match calc_modes.complex with |Rect -> let s = append_units (sprintf "(%.15g, %.15g)" cc.Complex.re cc.Complex.im) in if conserve_memory then () else cc_str.c_rect <- Some s; s |Polar -> let r = sqrt (cc.Complex.re *. cc.Complex.re +. cc.Complex.im *. cc.Complex.im) and theta = atan2 cc.Complex.im cc.Complex.re in begin match calc_modes.angle with |Rad -> let s = append_units (sprintf "(%.15g <%.15g)" r theta) in if conserve_memory then () else cc_str.c_pol_rad <- Some s; s |Deg -> let s = append_units (sprintf "(%.15g <%.15g)" r (180.0 /. pi *. theta)) in if conserve_memory then () else cc_str.c_pol_deg <- Some s; s end (* generate a string representation for a floating-point matrix, * taking into account the display mode. *) method private create_fmat_unit_string disp_mode fm uu fm_str = let append_units ss = if has_units uu then ss ^ "_" ^ Units.string_of_units uu else ss in match disp_mode with |Line -> let s = (* looks like [[ a11, a12 ][ a21, a22 ]] *) let rows, cols = (Gsl_matrix.dims fm) in let initial_string = "[" in let line = ref initial_string in for n = 0 to rows - 1 do line := !line ^ "[ "; for m = 0 to cols - 2 do line := !line ^ (sprintf "%.15g, " fm.{n, m}) done; line := !line ^ (sprintf "%.15g ]" fm.{n, cols-1}) done; line := !line ^ "]"; !line in let ss = append_units s in if conserve_memory then () else fm_str.fmat_line <- Some ss; ss |Fullscreen -> let s = (* looks like [[ a11, a12 ] * [ a21, a22 ]] * and the columns are aligned. *) let rows, cols = (Gsl_matrix.dims fm) in (* first get the maximum field width for each column *) let max_width = Array.make cols 0 in for m = 0 to pred cols do for n = 0 to pred rows do let dummy_string = sprintf "%-.15g" fm.{n, m} in let ds_len = String.length dummy_string in if ds_len > max_width.(m) then max_width.(m) <- ds_len else () done done; (* now use the maximum field widths to align the columns * during string creation *) let initial_string = "[" in let line = ref initial_string in for n = 0 to rows - 1 do line := !line ^ "[ "; for m = 0 to cols - 2 do line := !line ^ (sprintf "%*.15g, " max_width.(m) fm.{n, m}) done; line := !line ^ (sprintf "%*.15g ]" max_width.(cols-1) fm.{n, cols-1}); if n < pred rows then line := !line ^ "\n " else () done; line := !line ^ "]"; !line in let ss = append_units s in if conserve_memory then () else fm_str.fmat_fs <- Some ss; ss (* generate a string representation for a complex matrix, * taking into account the display mode. *) method private create_cmat_unit_string disp_mode calc_modes cm uu cm_str = let append_units ss = if uu <> Units.empty_unit then ss ^ "_" ^ Units.string_of_units uu else ss in match disp_mode with |Line -> let s = (* looks like [[ (a11re, a11im), (a12re, a12im) ][ (a21re, a21im), (a22re, a22im) ] *) let rows, cols = (Gsl_matrix_complex.dims cm) in let initial_string = "[" in let line = ref initial_string in for n = 0 to rows - 1 do line := !line ^ "[ "; for m = 0 to cols - 2 do match calc_modes.complex with |Rect -> line := !line ^ (sprintf "(%.15g, %.15g), " cm.{n, m}.Complex.re cm.{n, m}.Complex.im) |Polar -> let rr = cm.{n, m}.Complex.re and ii = cm.{n, m}.Complex.im in let r = sqrt (rr *. rr +. ii *. ii) and theta = atan2 ii rr in begin match calc_modes.angle with |Rad -> line := !line ^ (sprintf "(%.15g <%.15g), " r theta) |Deg -> line := !line ^ (sprintf "(%.15g <%.15g), " r (180.0 /. pi *. theta)) end done; match calc_modes.complex with |Rect -> line := !line ^ (sprintf "(%.15g, %.15g) ]" cm.{n, cols-1}.Complex.re cm.{n, cols-1}.Complex.im) |Polar -> let rr = cm.{n, cols-1}.Complex.re and ii = cm.{n, cols-1}.Complex.im in let r = sqrt (rr *. rr +. ii *. ii) and theta = atan2 ii rr in begin match calc_modes.angle with |Rad -> line := !line ^ (sprintf "(%.15g <%.15g) ]" r theta) |Deg -> line := !line ^ (sprintf "(%.15g <%.15g) ]" r (180.0 /. pi *. theta)) end done; line := !line ^ "]"; !line in let ss = append_units s in if conserve_memory then () else begin match calc_modes.complex with |Rect -> cm_str.cmat_rect_line <- Some ss; |Polar -> begin match calc_modes.angle with |Rad -> cm_str.cmat_pol_rad_line <- Some ss |Deg -> cm_str.cmat_pol_deg_line <- Some ss end end; ss |Fullscreen -> let s = (* looks like [[ (a11re, a11im), (a12re, a12im) ] * [ (a21re, a21im), (a22re, a22im) ] * with properly aligned columns *) let rows, cols = (Gsl_matrix_complex.dims cm) in (* first get the maximum field width for each column *) let max_width = Array.make_matrix cols 2 0 in for m = 0 to pred cols do for n = 0 to pred rows do match calc_modes.complex with |Rect -> let dummy_re = sprintf "%-.15g" cm.{n, m}.Complex.re in let dr_len = String.length dummy_re in if dr_len > max_width.(m).(0) then max_width.(m).(0) <- dr_len else (); let dummy_im = sprintf "%-.15g" cm.{n, m}.Complex.im in let di_len = String.length dummy_im in if di_len > max_width.(m).(1) then max_width.(m).(1) <- di_len else () |Polar -> let rr = cm.{n, m}.Complex.re and ii = cm.{n, m}.Complex.im in let r = sqrt (rr *. rr +. ii *. ii) and theta = atan2 ii rr in let dummy_r = sprintf "%-.15g" r in let r_len = String.length dummy_r in if r_len > max_width.(m).(0) then max_width.(m).(0) <- r_len else (); let dummy_theta = match calc_modes.angle with |Rad -> sprintf "%-.15g" theta |Deg -> sprintf "%-.15g" (180.0 /. pi *. theta) in let theta_len = String.length dummy_theta in if theta_len > max_width.(m).(1) then max_width.(m).(1) <- theta_len else (); done done; (* now use the maximum field widths to align the columns * during string creation *) let initial_string = "[" in let line = ref initial_string in for n = 0 to rows - 1 do line := !line ^ "[ "; for m = 0 to cols - 2 do match calc_modes.complex with |Rect -> line := !line ^ (sprintf "(%*.15g, %*.15g), " max_width.(m).(0) cm.{n, m}.Complex.re max_width.(m).(1) cm.{n, m}.Complex.im) |Polar -> begin let rr = cm.{n, m}.Complex.re and ii = cm.{n, m}.Complex.im in let r = sqrt (rr *. rr +. ii *. ii) and theta = atan2 ii rr in match calc_modes.angle with |Rad -> line := !line ^ (sprintf "(%*.15g <%*.15g), " max_width.(m).(0) r max_width.(m).(1) theta) |Deg -> line := !line ^ (sprintf "(%*.15g <%*.15g), " max_width.(m).(0) r max_width.(m).(1) (180.0 /. pi *. theta)) end done; begin match calc_modes.complex with |Rect -> line := !line ^ (sprintf "(%*.15g, %*.15g) ]" max_width.(cols-1).(0) cm.{n, cols-1}.Complex.re max_width.(cols-1).(1) cm.{n, cols-1}.Complex.im) |Polar -> begin let rr = cm.{n, cols-1}.Complex.re and ii = cm.{n, cols-1}.Complex.im in let r = sqrt (rr *. rr +. ii *. ii) and theta = atan2 ii rr in match calc_modes.angle with |Rad -> line := !line ^ (sprintf "(%*.15g <%*.15g) ]" max_width.(cols-1).(0) r max_width.(cols-1).(1) theta) |Deg -> line := !line ^ (sprintf "(%*.15g <%*.15g) ]" max_width.(cols-1).(0) r max_width.(cols-1).(1) (180.0 /. pi *. theta)) end end; if n < pred rows then line := !line ^ "\n " else () done; line := !line ^ "]"; !line in let ss = append_units s in if conserve_memory then () else begin match calc_modes.complex with |Rect -> cm_str.cmat_rect_fs <- Some ss; |Polar -> begin match calc_modes.angle with |Rad -> cm_str.cmat_pol_rad_fs <- Some ss |Deg -> cm_str.cmat_pol_deg_fs <- Some ss end end; ss (* generate a string representation for a complex matrix, * taking into account the display mode. *) method private create_var_string disp_mode vv vv_str = let line = "@ " ^ vv and fs = "@" ^ vv in if conserve_memory then () else begin vv_str.v_line <- Some line; vv_str.v_fs <- Some fs end; match disp_mode with |Line -> line |Fullscreen -> fs method launch_fill_in_thread () = let _ = Thread.create self#fill_in_all_strings () in () (* fill in any unknown string representations from the stack *) method private fill_in_all_strings () = try while true do let unrendered_el = Stack.pop render_stack in self#render_all_strings unrendered_el done with Stack.Empty -> () end (* arch-tag: DO_NOT_CHANGE_59b80e87-dfde-4203-a7a2-8e1f95813151 *) orpie-1.5.2/inv.ml0000644000175000017500000000747212322115103012447 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) open Rpc_stack open Gsl_error open Gsl_assist let inv (stack : rpc_stack) (evaln : int -> unit) = evaln 1; let gen_el = stack#pop () in match gen_el with |RpcFloatUnit (el, uu) -> stack#push (RpcFloatUnit (1.0 /. el, Units.div Units.empty_unit uu)) |RpcComplexUnit (el, uu) -> stack#push (RpcComplexUnit (Complex.inv el, Units.div Units.empty_unit uu)) |RpcFloatMatrixUnit (el, uu) -> let new_unit = Units.pow uu (~-. 1.0) in let n, m = (Gsl_matrix.dims el) in if n = m then let copy_el1 = Gsl_matrix.copy el and copy_el2 = Gsl_matrix.copy el and perm = Gsl_permut.create m and inv = Gsl_matrix.create m m and vv = Gsl_matrix.create m m and ss = Gsl_vector.create m and work = Gsl_vector.create m in begin (* test for singular matrix *) (* first factor out matrix norm, since the GSL SVD algorithm has * issues with large magnitude matrices *) let norm = Gsl_assist.one_norm copy_el1 in Gsl_matrix.scale copy_el1 (1.0 /. norm); (* now compute condition number as largest singular value * divided by smallest singular value *) Gsl_linalg._SV_decomp (`M copy_el1) (`M vv) (`V ss) (`V work); let condition_number = (Gsl_vector.get ss 0) /. (Gsl_vector.get ss (pred m)) in (* if the condition number is too large for machine precision, * then abort with error *) if condition_number > 1e14 then (stack#push gen_el; raise (Invalid_argument "cannot invert ill-conditioned matrix")) else let _ = Gsl_linalg._LU_decomp (`M copy_el2) perm in (Gsl_linalg._LU_invert (`M copy_el2) perm (`M inv); stack#push (RpcFloatMatrixUnit (inv, new_unit))) end else (stack#push gen_el; raise (Invalid_argument "cannot invert non-square matrix")) |RpcComplexMatrixUnit (el, uu) -> let new_unit = Units.pow uu (~-. 1.0) in let n, m = (Gsl_matrix_complex.dims el) in if n = m then let copy_el = Gsl_vectmat.cmat_convert ~protect:true (`CM el) and perm = Gsl_permut.create m and inv = Gsl_matrix_complex.create m m in try let _ = Gsl_linalg.complex_LU_decomp copy_el perm in Gsl_linalg.complex_LU_invert copy_el perm (`CM inv); stack#push (RpcComplexMatrixUnit (inv, new_unit)) with Gsl_exn _ -> (stack#push gen_el; raise (Invalid_argument "cannot invert singular matrix")) else (stack#push gen_el; raise (Invalid_argument "cannot invert non-square matrix")) |_ -> (stack#push gen_el; raise (Invalid_argument "inversion is undefined for this data type")) (* arch-tag: DO_NOT_CHANGE_d8ce074c-3d77-4448-b3c6-9e239b853aad *) orpie-1.5.2/curses_keys.ml0000644000175000017500000000277712322115103014215 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) open Curses;; begin let std = initscr () in assert (keypad std true); assert (cbreak ()); assert (noecho ()); assert (mvaddstr 1 0 "Type some keys to see the corresponding octal and string representations:"); assert (refresh ()) end; while true do let k = getch () in let s1 = Printf.sprintf " octal: \\%.3o" k and s2 = Printf.sprintf "string: \"%s\"" (Curses_assist.string_of_chtype k) in (assert (move 2 0); clrtoeol (); assert (addstr s1); assert (move 3 0); clrtoeol (); assert (addstr s2); assert (refresh ())) done; endwin ();; (* arch-tag: DO_NOT_CHANGE_31cbf03e-49f9-4f66-844c-ceb584edb920 *) orpie-1.5.2/depend0000644000175000017500000002370312322115103012476 0ustar paulpauladd.cmo: ./units/units.cmo rpc_stack.cmo rcfile.cmo \ ./gsl/gsl_matrix_complex.cmi ./gsl/gsl_matrix.cmi gsl_assist.cmo add.cmx: ./units/units.cmx rpc_stack.cmx rcfile.cmx \ ./gsl/gsl_matrix_complex.cmx ./gsl/gsl_matrix.cmx gsl_assist.cmx calc_test.cmo: txtin_parser.cmi txtin_lexer.cmo rpc_stack.cmo rpc_calc.cmo calc_test.cmx: txtin_parser.cmx txtin_lexer.cmx rpc_stack.cmx rpc_calc.cmx curses_assist.cmo: ./curses/curses.cmi curses_assist.cmx: ./curses/curses.cmx curses-keys.cmo: curses_assist.cmo ./curses/curses.cmi curses-keys.cmx: curses_assist.cmx ./curses/curses.cmx div.cmo: ./units/units.cmo rpc_stack.cmo ./gsl/gsl_vectmat.cmi \ ./gsl/gsl_permut.cmi ./gsl/gsl_matrix_complex.cmi ./gsl/gsl_matrix.cmi \ ./gsl/gsl_linalg.cmi ./gsl/gsl_error.cmi ./gsl/gsl_blas.cmi \ gsl_assist.cmo div.cmx: ./units/units.cmx rpc_stack.cmx ./gsl/gsl_vectmat.cmx \ ./gsl/gsl_permut.cmx ./gsl/gsl_matrix_complex.cmx ./gsl/gsl_matrix.cmx \ ./gsl/gsl_linalg.cmx ./gsl/gsl_error.cmx ./gsl/gsl_blas.cmx \ gsl_assist.cmx gsl_assist.cmo: ./gsl/gsl_vector_complex_flat.cmi \ ./gsl/gsl_vector_complex.cmi ./gsl/gsl_vectmat.cmi ./gsl/gsl_permut.cmi \ ./gsl/gsl_matrix_complex.cmi ./gsl/gsl_matrix.cmi ./gsl/gsl_linalg.cmi gsl_assist.cmx: ./gsl/gsl_vector_complex_flat.cmx \ ./gsl/gsl_vector_complex.cmx ./gsl/gsl_vectmat.cmx ./gsl/gsl_permut.cmx \ ./gsl/gsl_matrix_complex.cmx ./gsl/gsl_matrix.cmx ./gsl/gsl_linalg.cmx interface_draw.cmo: utility.cmo rpc_stack.cmo rpc_calc.cmo rcfile.cmo \ operations.cmo interface.cmo ./curses/curses.cmi interface_draw.cmx: utility.cmx rpc_stack.cmx rpc_calc.cmx rcfile.cmx \ operations.cmx interface.cmx ./curses/curses.cmx interface_main.cmo: utility.cmo ./units/units.cmo txtin_parser.cmi \ txtin_lexer.cmo statefile.cmo rpc_stack.cmo rpc_calc.cmo rcfile.cmo \ operations.cmo interface_draw.cmo interface.cmo \ ./gsl/gsl_matrix_complex.cmi ./gsl/gsl_matrix.cmi ./curses/curses.cmi \ big_int_str.cmo interface_main.cmx: utility.cmx ./units/units.cmx txtin_parser.cmx \ txtin_lexer.cmx statefile.cmx rpc_stack.cmx rpc_calc.cmx rcfile.cmx \ operations.cmx interface_draw.cmx interface.cmx \ ./gsl/gsl_matrix_complex.cmx ./gsl/gsl_matrix.cmx ./curses/curses.cmx \ big_int_str.cmx interface.cmo: rpc_calc.cmo operations.cmo ./curses/curses.cmi interface.cmx: rpc_calc.cmx operations.cmx ./curses/curses.cmx inv.cmo: ./units/units.cmo rpc_stack.cmo ./gsl/gsl_vector.cmi \ ./gsl/gsl_vectmat.cmi ./gsl/gsl_permut.cmi ./gsl/gsl_matrix_complex.cmi \ ./gsl/gsl_matrix.cmi ./gsl/gsl_linalg.cmi ./gsl/gsl_error.cmi \ gsl_assist.cmo inv.cmx: ./units/units.cmx rpc_stack.cmx ./gsl/gsl_vector.cmx \ ./gsl/gsl_vectmat.cmx ./gsl/gsl_permut.cmx ./gsl/gsl_matrix_complex.cmx \ ./gsl/gsl_matrix.cmx ./gsl/gsl_linalg.cmx ./gsl/gsl_error.cmx \ gsl_assist.cmx main.cmo: rpc_calc.cmo rcfile.cmo interface_main.cmo interface.cmo \ ./gsl/gsl_error.cmi ./curses/curses.cmi main.cmx: rpc_calc.cmx rcfile.cmx interface_main.cmx interface.cmx \ ./gsl/gsl_error.cmx ./curses/curses.cmx mult.cmo: ./units/units.cmo rpc_stack.cmo ./gsl/gsl_matrix_complex.cmi \ ./gsl/gsl_matrix.cmi ./gsl/gsl_blas.cmi gsl_assist.cmo mult.cmx: ./units/units.cmx rpc_stack.cmx ./gsl/gsl_matrix_complex.cmx \ ./gsl/gsl_matrix.cmx ./gsl/gsl_blas.cmx gsl_assist.cmx pow.cmo: ./units/units.cmo rpc_stack.cmo gsl_assist.cmo pow.cmx: ./units/units.cmx rpc_stack.cmx gsl_assist.cmx rcfile.cmo: utility.cmo ./units/units.cmo operations.cmo install.cmo \ ./curses/curses.cmi rcfile.cmx: utility.cmx ./units/units.cmx operations.cmx install.cmx \ ./curses/curses.cmx rpc_calc.cmo: ./units/units.cmo sub.cmo solvelin.cmo rpc_stack.cmo rcfile.cmo \ pow.cmo mult.cmo inv.cmo ./gsl/gsl_sf.cmo ./gsl/gsl_matrix_complex.cmi \ ./gsl/gsl_matrix.cmi ./gsl/gsl_math.cmi ./gsl/gsl_error.cmi \ ./gsl/gsl_complex.cmi ./gsl/gsl_blas.cmi gsl_assist.cmo div.cmo add.cmo rpc_calc.cmx: ./units/units.cmx sub.cmx solvelin.cmx rpc_stack.cmx rcfile.cmx \ pow.cmx mult.cmx inv.cmx ./gsl/gsl_sf.cmx ./gsl/gsl_matrix_complex.cmx \ ./gsl/gsl_matrix.cmx ./gsl/gsl_math.cmx ./gsl/gsl_error.cmx \ ./gsl/gsl_complex.cmx ./gsl/gsl_blas.cmx gsl_assist.cmx div.cmx add.cmx rpc_stack.cmo: ./units/units.cmo ./gsl/gsl_matrix_complex.cmi \ ./gsl/gsl_matrix.cmi big_int_str.cmo rpc_stack.cmx: ./units/units.cmx ./gsl/gsl_matrix_complex.cmx \ ./gsl/gsl_matrix.cmx big_int_str.cmx solvelin.cmo: ./units/units.cmo rpc_stack.cmo ./gsl/gsl_vector_complex.cmi \ ./gsl/gsl_matrix_complex.cmi ./gsl/gsl_matrix.cmi ./gsl/gsl_linalg.cmi \ gsl_assist.cmo solvelin.cmx: ./units/units.cmx rpc_stack.cmx ./gsl/gsl_vector_complex.cmx \ ./gsl/gsl_matrix_complex.cmx ./gsl/gsl_matrix.cmx ./gsl/gsl_linalg.cmx \ gsl_assist.cmx statefile.cmo: utility.cmo rpc_stack.cmo rpc_calc.cmo rcfile.cmo \ operations.cmo statefile.cmx: utility.cmx rpc_stack.cmx rpc_calc.cmx rcfile.cmx \ operations.cmx sub.cmo: ./units/units.cmo rpc_stack.cmo rcfile.cmo \ ./gsl/gsl_matrix_complex.cmi ./gsl/gsl_matrix.cmi gsl_assist.cmo sub.cmx: ./units/units.cmx rpc_stack.cmx rcfile.cmx \ ./gsl/gsl_matrix_complex.cmx ./gsl/gsl_matrix.cmx gsl_assist.cmx txtin_lexer.cmo: txtin_parser.cmi txtin_lexer.cmx: txtin_parser.cmx txtin_parser.cmo: utility.cmo ./units/units.cmo rpc_stack.cmo rcfile.cmo \ ./gsl/gsl_matrix_complex.cmi ./gsl/gsl_matrix.cmi big_int_str.cmo \ txtin_parser.cmi txtin_parser.cmx: utility.cmx ./units/units.cmx rpc_stack.cmx rcfile.cmx \ ./gsl/gsl_matrix_complex.cmx ./gsl/gsl_matrix.cmx big_int_str.cmx \ txtin_parser.cmi txtin_parser.cmi: rpc_stack.cmo units/test.cmo: ./units/units.cmo units/test.cmx: ./units/units.cmx curses/curses.cmo: curses/curses.cmi curses/curses.cmx: curses/curses.cmi curses/test.cmo: ./curses/curses.cmi curses/test.cmx: ./curses/curses.cmx gsl/gsl_blas.cmo: ./gsl/gsl_vector_complex.cmi ./gsl/gsl_vector.cmi \ ./gsl/gsl_matrix_complex.cmi ./gsl/gsl_matrix.cmi ./gsl/gsl_complex.cmi \ gsl/gsl_blas.cmi gsl/gsl_blas.cmx: ./gsl/gsl_vector_complex.cmx ./gsl/gsl_vector.cmx \ ./gsl/gsl_matrix_complex.cmx ./gsl/gsl_matrix.cmx ./gsl/gsl_complex.cmx \ gsl/gsl_blas.cmi gsl/gsl_complex.cmo: gsl/gsl_complex.cmi gsl/gsl_complex.cmx: gsl/gsl_complex.cmi gsl/gsl_error.cmo: gsl/gsl_error.cmi gsl/gsl_error.cmx: gsl/gsl_error.cmi gsl/gsl_fun.cmo: ./gsl/gsl_vector.cmi ./gsl/gsl_matrix.cmi gsl/gsl_fun.cmi gsl/gsl_fun.cmx: ./gsl/gsl_vector.cmx ./gsl/gsl_matrix.cmx gsl/gsl_fun.cmi gsl/gsl_linalg.cmo: ./gsl/gsl_vector_flat.cmi ./gsl/gsl_vectmat.cmi \ ./gsl/gsl_permut.cmi ./gsl/gsl_matrix.cmi ./gsl/gsl_fun.cmi \ ./gsl/gsl_complex.cmi gsl/gsl_linalg.cmi gsl/gsl_linalg.cmx: ./gsl/gsl_vector_flat.cmx ./gsl/gsl_vectmat.cmx \ ./gsl/gsl_permut.cmx ./gsl/gsl_matrix.cmx ./gsl/gsl_fun.cmx \ ./gsl/gsl_complex.cmx gsl/gsl_linalg.cmi gsl/gsl_math.cmo: gsl/gsl_math.cmi gsl/gsl_math.cmx: gsl/gsl_math.cmi gsl/gsl_matrix_complex_flat.cmo: ./gsl/gsl_vector_complex_flat.cmi \ ./gsl/gsl_complex.cmi gsl/gsl_matrix_complex_flat.cmi gsl/gsl_matrix_complex_flat.cmx: ./gsl/gsl_vector_complex_flat.cmx \ ./gsl/gsl_complex.cmx gsl/gsl_matrix_complex_flat.cmi gsl/gsl_matrix_complex.cmo: ./gsl/gsl_complex.cmi gsl/gsl_matrix_complex.cmi gsl/gsl_matrix_complex.cmx: ./gsl/gsl_complex.cmx gsl/gsl_matrix_complex.cmi gsl/gsl_matrix_flat.cmo: ./gsl/gsl_vector_flat.cmi gsl/gsl_matrix_flat.cmi gsl/gsl_matrix_flat.cmx: ./gsl/gsl_vector_flat.cmx gsl/gsl_matrix_flat.cmi gsl/gsl_matrix.cmo: gsl/gsl_matrix.cmi gsl/gsl_matrix.cmx: gsl/gsl_matrix.cmi gsl/gsl_permut.cmo: ./gsl/gsl_error.cmi ./gsl/gsl_complex.cmi \ gsl/gsl_permut.cmi gsl/gsl_permut.cmx: ./gsl/gsl_error.cmx ./gsl/gsl_complex.cmx \ gsl/gsl_permut.cmi gsl/gsl_sf.cmo: ./gsl/gsl_fun.cmi gsl/gsl_sf.cmx: ./gsl/gsl_fun.cmx gsl/gsl_vectmat.cmo: ./gsl/gsl_vector_flat.cmi \ ./gsl/gsl_vector_complex_flat.cmi ./gsl/gsl_vector_complex.cmi \ ./gsl/gsl_vector.cmi ./gsl/gsl_matrix_flat.cmi \ ./gsl/gsl_matrix_complex_flat.cmi ./gsl/gsl_matrix_complex.cmi \ ./gsl/gsl_matrix.cmi gsl/gsl_vectmat.cmi gsl/gsl_vectmat.cmx: ./gsl/gsl_vector_flat.cmx \ ./gsl/gsl_vector_complex_flat.cmx ./gsl/gsl_vector_complex.cmx \ ./gsl/gsl_vector.cmx ./gsl/gsl_matrix_flat.cmx \ ./gsl/gsl_matrix_complex_flat.cmx ./gsl/gsl_matrix_complex.cmx \ ./gsl/gsl_matrix.cmx gsl/gsl_vectmat.cmi gsl/gsl_vector_complex_flat.cmo: ./gsl/gsl_vector_flat.cmi \ ./gsl/gsl_complex.cmi gsl/gsl_vector_complex_flat.cmi gsl/gsl_vector_complex_flat.cmx: ./gsl/gsl_vector_flat.cmx \ ./gsl/gsl_complex.cmx gsl/gsl_vector_complex_flat.cmi gsl/gsl_vector_complex.cmo: ./gsl/gsl_complex.cmi gsl/gsl_vector_complex.cmi gsl/gsl_vector_complex.cmx: ./gsl/gsl_complex.cmx gsl/gsl_vector_complex.cmi gsl/gsl_vector_flat.cmo: gsl/gsl_vector_flat.cmi gsl/gsl_vector_flat.cmx: gsl/gsl_vector_flat.cmi gsl/gsl_vector.cmo: gsl/gsl_vector.cmi gsl/gsl_vector.cmx: gsl/gsl_vector.cmi gsl/gsl_blas.cmi: ./gsl/gsl_vector_complex.cmi ./gsl/gsl_vector.cmi \ ./gsl/gsl_matrix_complex.cmi ./gsl/gsl_matrix.cmi ./gsl/gsl_complex.cmi gsl/gsl_fun.cmi: ./gsl/gsl_vector.cmi ./gsl/gsl_matrix.cmi gsl/gsl_linalg.cmi: ./gsl/gsl_vector_flat.cmi ./gsl/gsl_vector.cmi \ ./gsl/gsl_vectmat.cmi ./gsl/gsl_permut.cmi ./gsl/gsl_matrix_flat.cmi \ ./gsl/gsl_matrix.cmi ./gsl/gsl_fun.cmi ./gsl/gsl_complex.cmi gsl/gsl_matrix_complex_flat.cmi: ./gsl/gsl_vector_complex_flat.cmi \ ./gsl/gsl_complex.cmi gsl/gsl_matrix_complex.cmi: ./gsl/gsl_vector_complex.cmi \ ./gsl/gsl_complex.cmi gsl/gsl_matrix_flat.cmi: ./gsl/gsl_vector_flat.cmi gsl/gsl_matrix.cmi: ./gsl/gsl_vector.cmi gsl/gsl_vectmat.cmi: ./gsl/gsl_vector_flat.cmi \ ./gsl/gsl_vector_complex_flat.cmi ./gsl/gsl_vector_complex.cmi \ ./gsl/gsl_vector.cmi ./gsl/gsl_matrix_flat.cmi \ ./gsl/gsl_matrix_complex_flat.cmi ./gsl/gsl_matrix_complex.cmi \ ./gsl/gsl_matrix.cmi ./gsl/gsl_complex.cmi gsl/gsl_vector_complex_flat.cmi: ./gsl/gsl_vector_flat.cmi \ ./gsl/gsl_complex.cmi gsl/gsl_vector_complex.cmi: ./gsl/gsl_complex.cmi orpie-1.5.2/sub.ml0000644000175000017500000002150312322115103012433 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) open Rpc_stack open Gsl_assist open Big_int let sub (stack : rpc_stack) (evaln : int -> unit) = evaln 2; let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in match gen_el1 with |RpcInt el1 -> ( match gen_el2 with |RpcInt el2 -> stack#push (RpcInt (sub_big_int el1 el2)) |RpcFloatUnit (el2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "inconsistent units" end else let (f, u) = funit_of_float ((float_of_big_int el1) -. el2) in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "inconsistent units" end else let c_el1 = cmpx_of_int el1 in let (c, u) = cunit_of_cpx (Complex.sub c_el1 el2) in stack#push (RpcComplexUnit (c, u)) |_ -> (* if the elements are incompatible, we have to put them back on the stack *) (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for subtraction")) ) |RpcFloatUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> if uu1 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "inconsistent units" end else let (f, u) = funit_of_float (el1 -. float_of_big_int el2) in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el2, uu2) -> begin try let conv = Units.conversion_factor uu1 uu2 !Rcfile.unit_table in stack#push (RpcFloatUnit (conv *. el1 -. el2, uu2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s end |RpcComplexUnit (el2, uu2) -> begin try let c_el1 = c_of_f (el1 *. (Units.conversion_factor uu1 uu2 !Rcfile.unit_table)) in stack#push (RpcComplexUnit (Complex.sub c_el1 el2, uu2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s end |_ -> (* if the elements are incompatible, we have to put them back on the stack *) (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for subtraction")) ) |RpcComplexUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> if uu1 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "inconsistent units" end else let c_el2 = cmpx_of_int el2 in let (c, u) = cunit_of_cpx (Complex.sub el1 c_el2) in stack#push (RpcComplexUnit (c, u)) |RpcFloatUnit (el2, uu2) -> begin try let conv = c_of_f (Units.conversion_factor uu1 uu2 !Rcfile.unit_table) in let c_el1 = Complex.mul el1 conv in let c_el2 = c_of_f el2 in stack#push (RpcComplexUnit (Complex.sub c_el1 c_el2, uu2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s end |RpcComplexUnit (el2, uu2) -> begin try let conv = c_of_f (Units.conversion_factor uu1 uu2 !Rcfile.unit_table) in let c_el1 = Complex.mul el1 conv in stack#push (RpcComplexUnit (Complex.sub c_el1 el2, uu2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s end |_ -> (* if the elements are incompatible, we have to put them back on the stack *) (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for subtraction")) ) |RpcFloatMatrixUnit (el1, u1) -> ( match gen_el2 with |RpcFloatMatrixUnit (el2, u2) -> let dim1 = (Gsl_matrix.dims el1) and dim2 = (Gsl_matrix.dims el2) in if dim1 = dim2 then try let conv = Units.conversion_factor u1 u2 !Rcfile.unit_table in let result = Gsl_matrix.copy el1 in Gsl_matrix.scale result conv; Gsl_matrix.sub result el2; stack#push (RpcFloatMatrixUnit (result, u2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for subtraction")) |RpcComplexMatrixUnit (el2, u2) -> let dim1 = (Gsl_matrix.dims el1) and dim2 = (Gsl_matrix_complex.dims el2) in if dim1 = dim2 then try let conv = c_of_f (Units.conversion_factor u1 u2 !Rcfile.unit_table) in let c_el1 = cmat_of_fmat el1 in Gsl_matrix_complex.scale c_el1 conv; Gsl_matrix_complex.sub c_el1 el2; stack#push (RpcComplexMatrixUnit (c_el1, u2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for subtraction")) |_ -> (* if the elements are incompatible, we have to put them back on the stack *) (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for subtraction")) ) |RpcComplexMatrixUnit (el1, u1) -> ( match gen_el2 with |RpcFloatMatrixUnit (el2, u2) -> let dim1 = (Gsl_matrix_complex.dims el1) and dim2 = (Gsl_matrix.dims el2) in if dim1 = dim2 then try let conv = c_of_f (Units.conversion_factor u1 u2 !Rcfile.unit_table) in let c_el2 = cmat_of_fmat el2 in let result = Gsl_matrix_complex.copy el1 in Gsl_matrix_complex.scale result conv; Gsl_matrix_complex.sub result c_el2; stack#push (RpcComplexMatrixUnit (result, u2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for subtraction")) |RpcComplexMatrixUnit (el2, u2) -> let dim1 = (Gsl_matrix_complex.dims el1) and dim2 = (Gsl_matrix_complex.dims el2) in if dim1 = dim2 then try let conv = c_of_f (Units.conversion_factor u1 u2 !Rcfile.unit_table) in let result = Gsl_matrix_complex.copy el1 in Gsl_matrix_complex.scale result conv; Gsl_matrix_complex.sub result el2; stack#push (RpcComplexMatrixUnit (result, u2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for subtraction")) |_ -> (* if the elements are incompatible, we have to put them back on the stack *) (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for subtraction")) ) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for subtraction")) (* arch-tag: DO_NOT_CHANGE_f9044e6f-03c7-465a-b8ab-87cf65a0bc37 *) orpie-1.5.2/curses/0000755000175000017500000000000012322115103012613 5ustar paulpaulorpie-1.5.2/curses/README0000644000175000017500000000046312322115103013476 0ustar paulpaulThese curses bindings for OCaml are derived from the Objective Caml Text Mode Kit (ocaml-tmk). This code is released under the GNU LGPL; for details, see 'COPYING'. The ocaml-tmk project may be found at http://www.nongnu.org/ocaml-tmk/ . # arch-tag: DO_NOT_CHANGE_462d13eb-d2c3-405a-8dca-8204539772d0 orpie-1.5.2/curses/curses.ml0000644000175000017500000010364512322115103014462 0ustar paulpaul type window type screen type terminal type chtype = int type attr_t = int type err = bool module Acs = struct type acs = { ulcorner: chtype; llcorner: chtype; urcorner: chtype; lrcorner: chtype; ltee: chtype; rtee: chtype; btee: chtype; ttee: chtype; hline: chtype; vline: chtype; plus: chtype; s1: chtype; s9: chtype; diamond: chtype; ckboard: chtype; degree: chtype; plminus: chtype; bullet: chtype; larrow: chtype; rarrow: chtype; darrow: chtype; uarrow: chtype; board: chtype; lantern: chtype; block: chtype; s3: chtype; s7: chtype; lequal: chtype; gequal: chtype; pi: chtype; nequal: chtype; sterling: chtype } let bssb a = a.ulcorner let ssbb a = a.llcorner let bbss a = a.urcorner let sbbs a = a.lrcorner let sbss a = a.rtee let sssb a = a.ltee let ssbs a = a.btee let bsss a = a.ttee let bsbs a = a.hline let sbsb a = a.vline let ssss a = a.plus end external addch : chtype -> err = "mlcurses_addch" external waddch : window -> chtype -> err = "mlcurses_waddch" external mvaddch : int -> int -> chtype -> err = "mlcurses_mvaddch" external mvwaddch : window -> int -> int -> chtype -> err = "mlcurses_mvwaddch" external echochar : chtype -> err = "mlcurses_echochar" external wechochar : window -> chtype -> err = "mlcurses_wechochar" external addchstr : chtype array -> err = "mlcurses_addchstr" (* int i,c=Wosize_val(aa),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i chtype array -> err = "mlcurses_waddchstr" (* int i,c=Wosize_val(ab),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i int -> chtype array -> err = "mlcurses_mvaddchstr" (* int i,c=Wosize_val(ac),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i int -> int -> chtype array -> err = "mlcurses_mvwaddchstr" (* int i,c=Wosize_val(ad),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i int -> int -> err = "mlcurses_addchnstr" (* int i0=Int_val(ab); int i,c=Int_val(ac),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i chtype array -> int -> int -> err = "mlcurses_waddchnstr" (* int i0=Int_val(ac); int i,c=Int_val(ad),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i int -> chtype array -> int -> int -> err = "mlcurses_mvaddchnstr" (* int i0=Int_val(ad); int i,c=Int_val(ae),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i int -> int -> chtype array -> int -> int -> err = "mlcurses_mvwaddchnstr_bytecode" "mlcurses_mvwaddchnstr_native" (* int i0=Int_val(ae); int i,c=Int_val(af),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i err = "mlcurses_addstr" external waddstr : window -> string -> err = "mlcurses_waddstr" external mvaddstr : int -> int -> string -> err = "mlcurses_mvaddstr" external mvwaddstr : window -> int -> int -> string -> err = "mlcurses_mvwaddstr" external addnstr : string -> int -> int -> err = "mlcurses_addnstr" (* r_err(addnstr(a_string(aa)+a_int(ab),a_int(ac))); *) external waddnstr : window -> string -> int -> int -> err = "mlcurses_waddnstr" (* r_err(waddnstr(a_window(aa),a_string(ab)+a_int(ac),a_int(ad))); *) external mvaddnstr : int -> int -> string -> int -> int -> err = "mlcurses_mvaddnstr" (* r_err(mvaddnstr(a_int(aa),a_int(ab), a_string(ac)+a_int(ad),a_int(ae))); *) external mvwaddnstr : window -> int -> int -> string -> int -> int -> err = "mlcurses_mvwaddnstr_bytecode" "mlcurses_mvwaddnstr_native" (* r_err(mvwaddnstr(a_window(aa),a_int(ab),a_int(ac), a_string(ad)+a_int(ae),a_int(af))); *) external attroff : int -> unit = "mlcurses_attroff" external wattroff : window -> int -> unit = "mlcurses_wattroff" external attron : int -> unit = "mlcurses_attron" external wattron : window -> int -> unit = "mlcurses_wattron" external attrset : int -> unit = "mlcurses_attrset" external wattrset : window -> int -> unit = "mlcurses_wattrset" external standend : unit -> unit = "mlcurses_standend" external wstandend : window -> unit = "mlcurses_wstandend" external standout : unit -> unit = "mlcurses_standout" external wstandout : window -> unit = "mlcurses_wstandout" external attr_off : attr_t -> unit = "mlcurses_attr_off" (* attr_off(a_attr_t(aa),NULL); CAMLreturn(Val_unit); *) external wattr_off : window -> attr_t -> unit = "mlcurses_wattr_off" (* wattr_off(a_window(aa),a_attr_t(ab),NULL); CAMLreturn(Val_unit); *) external attr_on : attr_t -> unit = "mlcurses_attr_on" (* attr_on(a_attr_t(aa),NULL); CAMLreturn(Val_unit); *) external wattr_on : window -> attr_t -> unit = "mlcurses_wattr_on" (* wattr_on(a_window(aa),a_attr_t(ab),NULL); CAMLreturn(Val_unit); *) external attr_set : attr_t -> int -> unit = "mlcurses_attr_set" (* attr_set(a_attr_t(aa),a_int(ab),NULL); CAMLreturn(Val_unit); *) external wattr_set : window -> attr_t -> int -> unit = "mlcurses_wattr_set" (* wattr_set(a_window(aa),a_attr_t(ab),a_int(ac),NULL); CAMLreturn(Val_unit); *) external chgat : int -> attr_t -> int -> unit = "mlcurses_chgat" (* chgat(a_int(aa),a_attr_t(ab),a_int(ac),NULL); CAMLreturn(Val_unit); *) external wchgat : window -> int -> attr_t -> int -> unit = "mlcurses_wchgat" (* wchgat(a_window(aa),a_int(ab),a_attr_t(ac),a_int(ad),NULL); CAMLreturn(Val_unit); *) external mvchgat : int -> int -> int -> attr_t -> int -> unit = "mlcurses_mvchgat" (* mvchgat(a_int(aa),a_int(ab),a_int(ac),a_attr_t(ad),a_int(ae),NULL); CAMLreturn(Val_unit); *) external mvwchgat : window -> int -> int -> int -> attr_t -> int -> unit = "mlcurses_mvwchgat_bytecode" "mlcurses_mvwchgat_native" (* mvwchgat(a_window(aa),a_int(ab),a_int(ac),a_int(ad),a_attr_t(ae), a_int(af),NULL); CAMLreturn(Val_unit); *) external beep : unit -> err = "mlcurses_beep" external flash : unit -> err = "mlcurses_flash" external bkgdset : chtype -> unit = "mlcurses_bkgdset" external wbkgdset : window -> chtype -> unit = "mlcurses_wbkgdset" external bkgd : chtype -> unit = "mlcurses_bkgd" external wbkgd : window -> chtype -> unit = "mlcurses_wbkgd" external getbkgd : window -> chtype = "mlcurses_getbkgd" external border : chtype -> chtype -> chtype -> chtype -> chtype -> chtype -> chtype -> chtype -> unit = "mlcurses_border_bytecode" "mlcurses_border_native" external wborder : window -> chtype -> chtype -> chtype -> chtype -> chtype -> chtype -> chtype -> chtype -> unit = "mlcurses_wborder_bytecode" "mlcurses_wborder_native" external box : window -> chtype -> chtype -> unit = "mlcurses_box" external hline : chtype -> int -> unit = "mlcurses_hline" external whline : window -> chtype -> int -> unit = "mlcurses_whline" external vline : chtype -> int -> unit = "mlcurses_vline" external wvline : window -> chtype -> int -> unit = "mlcurses_wvline" external mvhline : int -> int -> chtype -> int -> unit = "mlcurses_mvhline" external mvwhline : window -> int -> int -> chtype -> int -> unit = "mlcurses_mvwhline" external mvvline : int -> int -> chtype -> int -> unit = "mlcurses_mvvline" external mvwvline : window -> int -> int -> chtype -> int -> unit = "mlcurses_mvwvline" external erase : unit -> unit = "mlcurses_erase" external werase : window -> unit = "mlcurses_werase" external clear : unit -> unit = "mlcurses_clear" external wclear : window -> unit = "mlcurses_wclear" external clrtobot : unit -> unit = "mlcurses_clrtobot" external wclrtobot : window -> unit = "mlcurses_wclrtobot" external clrtoeol : unit -> unit = "mlcurses_clrtoeol" external wclrtoeol : window -> unit = "mlcurses_wclrtoeol" external start_color : unit -> err = "mlcurses_start_color" external init_pair : int -> int -> int -> err = "mlcurses_init_pair" external init_color : int -> int -> int -> int -> err = "mlcurses_init_color" external has_colors : unit -> bool = "mlcurses_has_colors" external can_change_color : unit -> bool = "mlcurses_can_change_color" external color_content : int -> int*int*int = "mlcurses_color_content" (* short x,y,z; if(color_content(Int_val(aa),&x,&y,&z)==ERR) x=y=z=-1; r_int_int_int(x,y,z); *) external pair_content : int -> int*int = "mlcurses_pair_content" (* short x,y; if(pair_content(Int_val(aa),&y,&x)==ERR) x=y=-1; r_int_int(x,y); *) external colors : unit -> int = "mlcurses_colors" (* r_int(COLORS); *) external color_pairs : unit -> int = "mlcurses_color_pairs" (* r_int(COLOR_PAIRS); *) external use_default_colors : unit -> err = "mlcurses_use_default_colors" external delch : unit -> err = "mlcurses_delch" external wdelch : window -> err = "mlcurses_wdelch" external mvdelch : int -> int -> err = "mlcurses_mvdelch" external mvwdelch : window -> int -> int -> err = "mlcurses_mvwdelch" external deleteln : unit -> err = "mlcurses_deleteln" external wdeleteln : window -> err = "mlcurses_wdeleteln" external insdelln : int -> err = "mlcurses_insdelln" external winsdelln : window -> int -> err = "mlcurses_winsdelln" external insertln : unit -> err = "mlcurses_insertln" external winsertln : window -> err = "mlcurses_winsertln" external mvgetch : int -> int -> int = "mlcurses_mvgetch" external mvwgetch : window -> int -> int -> int = "mlcurses_mvwgetch" external ungetch : int -> err = "mlcurses_ungetch" external getstr : string -> err = "mlcurses_getstr" (* r_err(getnstr(a_string(aa),string_length(aa))); *) external wgetstr : window -> string -> err = "mlcurses_wgetstr" (* r_err(wgetnstr(a_window(aa),a_string(ab),string_length(ab))); *) external mvgetstr : int -> int -> string -> err = "mlcurses_mvgetstr" (* r_err(mvgetnstr(a_int(aa),a_int(ab),a_string(ac),string_length(ac))); *) external mvwgetstr : window -> int -> int -> string -> err = "mlcurses_mvwgetstr" (* r_err(mvwgetnstr(a_window(aa),a_int(ab),a_int(ac),a_string(ad), string_length(ad))); *) external getnstr : string -> int -> int -> err = "mlcurses_getnstr" (* r_err(getnstr(a_string(aa)+a_int(ab),a_int(ac))); *) external wgetnstr : window -> string -> int -> int -> err = "mlcurses_wgetnstr" (* r_err(wgetnstr(a_window(aa),a_string(ab)+a_int(ac),a_int(ad))); *) external mvgetnstr : int -> int -> string -> int -> int -> err = "mlcurses_mvgetnstr" (* r_err(mvgetnstr(a_int(aa),a_int(ab),a_string(ac)+a_int(ad), a_int(ae))); *) external mvwgetnstr : window -> int -> int -> string -> int -> int -> err = "mlcurses_mvwgetnstr_bytecode" "mlcurses_mvwgetnstr_native" (* r_err(mvwgetnstr(a_window(aa),a_int(ab),a_int(ac),a_string(ad)+a_int(ae), a_int(af))); *) external getyx : window -> int*int = "mlcurses_getyx" (* int x,y; getyx(a_window(aa),y,x); r_int_int(x,y); *) external getparyx : window -> int*int = "mlcurses_getparyx" (* int x,y; getparyx(a_window(aa),y,x); r_int_int(x,y); *) external getbegyx : window -> int*int = "mlcurses_getbegyx" (* int x,y; getbegyx(a_window(aa),y,x); r_int_int(x,y); *) external getmaxyx : window -> int*int = "mlcurses_getmaxyx" (* int x,y; getmaxyx(a_window(aa),y,x); r_int_int(x,y); *) external inch : unit -> chtype = "mlcurses_inch" external winch : window -> chtype = "mlcurses_winch" external mvinch : int -> int -> chtype = "mlcurses_mvinch" external mvwinch : window -> int -> int -> chtype = "mlcurses_mvwinch" external inchstr : chtype array -> err = "mlcurses_inchstr" (* int i,ne=Wosize_val(aa); chtype *tbl=malloc((ne+1)*sizeof(chtype)); int ret=inchnstr(tbl,ne); for(i=0;i chtype array -> err = "mlcurses_winchstr" (* int i,ne=Wosize_val(ab); chtype *tbl=malloc((ne+1)*sizeof(chtype)); int ret=winchnstr(a_window(aa),tbl,ne); for(i=0;i int -> chtype array -> err = "mlcurses_mvinchstr" (* int i,ne=Wosize_val(ac); chtype *tbl=malloc((ne+1)*sizeof(chtype)); int ret=mvinchnstr(a_int(aa),a_int(ab),tbl,ne); for(i=0;i int -> int -> chtype array -> err = "mlcurses_mvwinchstr" (* int i,ne=Wosize_val(ad); chtype *tbl=malloc((ne+1)*sizeof(chtype)); int ret=mvwinchnstr(a_window(aa),a_int(ab),a_int(ac),tbl,ne); for(i=0;i int -> int -> err = "mlcurses_inchnstr" (* int i0=a_int(ab); int i,ne=Wosize_val(aa)-i0; chtype *tbl=malloc((ne+1)*sizeof(chtype)); int ret=inchnstr(tbl,a_int(ac)); for(i=0;i chtype array -> int -> int -> err = "mlcurses_winchnstr" (* int i0=a_int(ac); int i,ne=Wosize_val(ab)-i0; chtype *tbl=malloc((ne+1)*sizeof(chtype)); int ret=winchnstr(a_window(aa),tbl,a_int(ad)); for(i=0;i int -> chtype array -> int -> int -> err = "mlcurses_mvinchnstr" (* int i0=a_int(ad); int i,ne=Wosize_val(ac)-i0; chtype *tbl=malloc((ne+1)*sizeof(chtype)); int ret=mvinchnstr(a_int(aa),a_int(ab),tbl,a_int(ae)); for(i=0;i int -> int -> chtype array -> int -> int -> err = "mlcurses_mvwinchnstr_bytecode" "mlcurses_mvwinchnstr_native" (* int i0=a_int(ae); int i,ne=Wosize_val(ad)-i0; chtype *tbl=malloc((ne+1)*sizeof(chtype)); int ret=mvwinchnstr(a_window(aa),a_int(ab),a_int(ac),tbl,a_int(af)); for(i=0;i err = "mlcurses_insch" external winsch : window -> chtype -> err = "mlcurses_winsch" external mvinsch : int -> int -> chtype -> err = "mlcurses_mvinsch" external mvwinsch : window -> int -> int -> chtype -> err = "mlcurses_mvwinsch" external initscr : unit -> window = "mlcurses_initscr" external endwin : unit -> unit = "mlcurses_endwin" external isendwin : unit -> bool = "mlcurses_isendwin" external newterm : string -> Unix.file_descr -> Unix.file_descr -> screen = "mlcurses_newterm" (* CAMLlocal1(r); int fda=dup(a_int(ab)),fdb=dup(a_int(ac)); FILE *fa=fdopen(fda,"w"),*fb=fdopen(fdb,"r"); SCREEN *s; AWB(r); r=alloc_tuple(3); Store_field(r,0,Val_int(fa)); Store_field(r,1,Val_int(fb)); s=newterm(a_string(aa),fa,fb); if(s==NULL){ fclose(fa); fclose(fb); failwith("newterm"); } Store_field(r,2,(value)s); CAMLreturn(r); *) external set_term : screen -> unit = "mlcurses_set_term" external delscreen : screen -> unit = "mlcurses_delscreen" (* delscreen(a_screen(aa)); fclose((FILE * )Field(aa,0)); fclose((FILE * )Field(aa,1)); CAMLreturn(Val_unit); *) external stdscr : unit -> window = "mlcurses_stdscr" (* r_window(stdscr); *) external null_window : unit -> window = "mlcurses_null_window" (* r_window(NULL); *) external insstr : string -> err = "mlcurses_insstr" (* r_err(insnstr(a_string(aa),string_length(aa))); *) external winsstr : window -> string -> err = "mlcurses_winsstr" (* r_err(winsnstr(a_window(aa),a_string(ab),string_length(ab))); *) external mvinsstr : int -> int -> string -> err = "mlcurses_mvinsstr" (* r_err(mvinsnstr(a_int(aa),a_int(ab),a_string(ac),string_length(ac))); *) external mvwinsstr : window -> int -> int -> string -> err = "mlcurses_mvwinsstr" (* r_err(mvwinsnstr(a_window(aa),a_int(ab),a_int(ac), a_string(ad),string_length(ad))); *) external insnstr : string -> int -> int -> err = "mlcurses_insnstr" (* r_err(insnstr(a_string(aa)+a_int(ab),a_int(ac))); *) external winsnstr : window -> string -> int -> int -> err = "mlcurses_winsnstr" (* r_err(winsnstr(a_window(aa),a_string(ab)+a_int(ac),a_int(ad))); *) external mvinsnstr : int -> int -> string -> int -> int -> err = "mlcurses_mvinsnstr" (* r_err(mvinsnstr(a_int(aa),a_int(ab),a_string(ac)+a_int(ad),a_int(ae))); *) external mvwinsnstr : window -> int -> int -> string -> int -> int -> err = "mlcurses_mvwinsnstr_bytecode" "mlcurses_mvwinsnstr_native" (* r_err(mvwinsnstr(a_window(aa),a_int(ab),a_int(ac), a_string(ad)+a_int(ae),a_int(af))); *) external instr : string -> err = "mlcurses_instr" (* r_err(innstr(a_string(aa),string_length(aa))); *) external winstr : window -> string -> err = "mlcurses_winstr" (* r_err(winnstr(a_window(aa),a_string(ab),string_length(ab))); *) external mvinstr : int -> int -> string -> err = "mlcurses_mvinstr" (* r_err(mvinnstr(a_int(aa),a_int(ab),a_string(ac),string_length(ac))); *) external mvwinstr : window -> int -> int -> string -> err = "mlcurses_mvwinstr" (* r_err(mvwinnstr(a_window(aa),a_int(ab),a_int(ac), a_string(ad),string_length(ad))); *) external innstr : string -> int -> int -> err = "mlcurses_innstr" (* r_err(innstr(a_string(aa)+a_int(ab),a_int(ac))); *) external winnstr : window -> string -> int -> int -> err = "mlcurses_winnstr" (* r_err(winnstr(a_window(aa),a_string(ab)+a_int(ac),a_int(ad))); *) external mvinnstr : int -> int -> string -> int -> int -> err = "mlcurses_mvinnstr" (* r_err(mvinnstr(a_int(aa),a_int(ab),a_string(ac)+a_int(ad),a_int(ae))); *) external mvwinnstr : window -> int -> int -> string -> int -> int -> err = "mlcurses_mvwinnstr_bytecode" "mlcurses_mvwinnstr_native" (* r_err(mvwinnstr(a_window(aa),a_int(ab),a_int(ac), a_string(ad)+a_int(ae),a_int(af))); *) external cbreak : unit -> err = "mlcurses_cbreak" external nocbreak : unit -> err = "mlcurses_nocbreak" external echo : unit -> err = "mlcurses_echo" external noecho : unit -> err = "mlcurses_noecho" external halfdelay : int -> err = "mlcurses_halfdelay" external intrflush : window -> bool -> err = "mlcurses_intrflush" external keypad : window -> bool -> err = "mlcurses_keypad" external meta : window -> bool -> err = "mlcurses_meta" external nodelay : window -> bool -> err = "mlcurses_nodelay" external raw : unit -> err = "mlcurses_raw" external noraw : unit -> err = "mlcurses_noraw" external noqiflush : unit -> unit = "mlcurses_noqiflush" external qiflush : unit -> unit = "mlcurses_qiflush" external notimeout : window -> bool -> err = "mlcurses_notimeout" external timeout : int -> unit = "mlcurses_timeout" external wtimeout : window -> int -> unit = "mlcurses_wtimeout" external typeahead : Unix.file_descr -> err = "mlcurses_typeahead" (* r_err(typeahead(a_int(aa))); *) external notypeahead : unit -> err = "mlcurses_notypeahead" (* r_err(typeahead(-1)); *) external def_prog_mode : unit -> unit = "mlcurses_def_prog_mode" external def_shell_mode : unit -> unit = "mlcurses_def_shell_mode" external reset_prog_mode : unit -> unit = "mlcurses_reset_prog_mode" external reset_shell_mode : unit -> unit = "mlcurses_reset_shell_mode" external resetty : unit -> unit = "mlcurses_resetty" external savetty : unit -> unit = "mlcurses_savetty" external getsyx : unit -> int*int = "mlcurses_getsyx" (* int x,y; getsyx(y,x); r_int_int(x,y); *) external setsyx : int -> int -> unit = "mlcurses_setsyx" external curs_set : int -> err = "mlcurses_curs_set" external napms : int -> unit = "mlcurses_napms" external ripoffline : bool -> unit = "mlcurses_ripoffline" (* ripoffline(Bool_val(aa)?1:-1,ripoff_callback); CAMLreturn(Val_unit); *) external get_ripoff : unit -> window*int = "mlcurses_get_ripoff" (* if(ripoff_niv==0) failwith("get_ripoff"); ripoff_niv--; r_int_int(ripoff_w[ripoff_niv],ripoff_l[ripoff_niv]); *) external mousemask : int -> int*int = "mlcurses_mousemask" (* mmask_t r=1234,n=Int_val(aa); n=mousemask(n,&r); r_int_int(n,r); *) external move : int -> int -> err = "mlcurses_move" external wmove : window -> int -> int -> err = "mlcurses_wmove" external clearok : window -> bool -> unit = "mlcurses_clearok" external idlok : window -> bool -> unit = "mlcurses_idlok" external idcok : window -> bool -> unit = "mlcurses_idcok" external immedok : window -> bool -> unit = "mlcurses_immedok" external leaveok : window -> bool -> unit = "mlcurses_leaveok" external setscrreg : int -> int -> err = "mlcurses_setscrreg" external wsetscrreg : window -> int -> int -> err = "mlcurses_wsetscrreg" external scrollok : window -> bool -> unit = "mlcurses_scrollok" external nl : unit -> unit = "mlcurses_nl" external nonl : unit -> unit = "mlcurses_nonl" external overlay : window -> window -> err = "mlcurses_overlay" external overwrite : window -> window -> err = "mlcurses_overwrite" external copywin : window -> window -> int -> int -> int -> int -> int -> int -> bool -> err = "mlcurses_copywin_bytecode" "mlcurses_copywin_native" external newpad : int -> int -> window = "mlcurses_newpad" external subpad : window -> int -> int -> int -> int -> window = "mlcurses_subpad" external prefresh : window -> int -> int -> int -> int -> int -> int -> err = "mlcurses_prefresh_bytecode" "mlcurses_prefresh_native" external pnoutrefresh : window -> int -> int -> int -> int -> int -> int -> err = "mlcurses_pnoutrefresh_bytecode" "mlcurses_pnoutrefresh_native" external pechochar : window -> chtype -> err = "mlcurses_pechochar" external refresh : unit -> err = "mlcurses_refresh" external wrefresh : window -> err = "mlcurses_wrefresh" external wnoutrefresh : window -> err = "mlcurses_wnoutrefresh" external doupdate : unit -> err = "mlcurses_doupdate" external redrawwin : window -> err = "mlcurses_redrawwin" external wredrawln : window -> int -> int -> err = "mlcurses_wredrawln" external wresize : window -> int -> int -> err = "mlcurses_wresize" external resizeterm : int -> int -> err = "mlcurses_resizeterm" external scr_dump : string -> err = "mlcurses_scr_dump" external scr_restore : string -> err = "mlcurses_scr_restore" external scr_init : string -> err = "mlcurses_scr_init" external scr_set : string -> err = "mlcurses_scr_set" external scroll : window -> err = "mlcurses_scroll" external scrl : int -> err = "mlcurses_scrl" external wscrl : window -> int -> err = "mlcurses_wscrl" external slk_init : int -> err = "mlcurses_slk_init" external slk_set : int -> string -> int -> err = "mlcurses_slk_set" external slk_refresh : unit -> err = "mlcurses_slk_refresh" external slk_noutrefresh : unit -> err = "mlcurses_slk_noutrefresh" external slk_label : int -> string = "mlcurses_slk_label" external slk_clear : unit -> err = "mlcurses_slk_clear" external slk_restore : unit -> err = "mlcurses_slk_restore" external slk_touch : unit -> err = "mlcurses_slk_touch" external slk_attron : attr_t -> err = "mlcurses_slk_attron" external slk_attroff : attr_t -> err = "mlcurses_slk_attroff" external slk_attrset : attr_t -> err = "mlcurses_slk_attrset" external baudrate : unit -> int = "mlcurses_baudrate" external erasechar : unit -> char = "mlcurses_erasechar" external has_ic : unit -> bool = "mlcurses_has_ic" external has_il : unit -> bool = "mlcurses_has_il" external killchar : unit -> char = "mlcurses_killchar" external longname : unit -> string = "mlcurses_longname" external termattrs : unit -> attr_t = "mlcurses_termattrs" external termname : unit -> string = "mlcurses_termname" external tgetent : string -> bool = "mlcurses_tgetent" (* CAMLreturn(Val_bool(tgetent(NULL,String_val(aa))==1)); *) external tgetflag : string -> bool = "mlcurses_tgetflag" external tgetnum : string -> int = "mlcurses_tgetnum" external tgetstr : string -> bool = "mlcurses_tgetstr" (* r_string(tgetstr(String_val(aa),NULL)); *) external tgoto : string -> int -> int -> string = "mlcurses_tgoto" external setupterm : string -> Unix.file_descr -> err = "mlcurses_setupterm" (* int r; r_err(setupterm(a_string(aa),a_int(ab),&r)); *) external setterm : string -> err = "mlcurses_setterm" external cur_term : unit -> terminal = "mlcurses_cur_term" (* r_terminal(cur_term); *) external set_curterm : terminal -> terminal = "mlcurses_set_curterm" external del_curterm : terminal -> err = "mlcurses_del_curterm" external restartterm : string -> Unix.file_descr -> err = "mlcurses_restartterm" (* int r; r_err(restartterm(a_string(aa),a_int(ab),&r)); *) external putp : string -> err = "mlcurses_putp" external vidattr : chtype -> err = "mlcurses_vidattr" external mvcur : int -> int -> int -> int -> err = "mlcurses_mvcur" external tigetflag : string -> bool = "mlcurses_tigetflag" (* r_bool(tigetflag(a_string(aa))>0); *) external tigetnum : string -> int = "mlcurses_tigetnum" external tigetstr : string -> string = "mlcurses_tigetstr" (* char *s=tigetstr(a_string(aa)); if((s==NULL)||(s==(char * )-1)) failwith("tigetstr"); CAMLreturn(copy_string(s)); *) external tputs : string -> int -> (char->unit) -> err = "mlcurses_tputs" (* putc_function=ac; r_err(tputs(a_string(aa),a_int(ab),putc_callback)); *) external vidputs : chtype -> (char->unit) -> err = "mlcurses_vidputs" (* putc_function=ab; r_err(vidputs(a_chtype(aa),putc_callback)); *) external tparm : string -> int array -> string = "mlcurses_tparm" (* int t[10],i,n=Wosize_val(ab); if(n>10) n=10; for(i=0;i string*string*string = "mlcurses_bool_terminfo_variable" (* CAMLlocal1(s); int n=a_int(aa); AWB(s) s=alloc_tuple(3); Store_field(s,0,Val_unit); Store_field(s,1,Val_unit); Store_field(s,2,Val_unit); if((boolnames[n]==NULL)||(boolcodes[n]==NULL)||(boolfnames[n]==NULL)){ CAMLlocal1(ns); AWB(ns) ns=copy_string(""); Store_field(s,0,ns); Store_field(s,1,ns); Store_field(s,2,ns); }else{ Store_field(s,0,copy_string(boolnames[n])); Store_field(s,1,copy_string(boolcodes[n])); Store_field(s,2,copy_string(boolfnames[n])); } CAMLreturn(s); *) external num_terminfo_variable : int -> string*string*string = "mlcurses_num_terminfo_variable" (* CAMLlocal1(s); int n=a_int(aa); AWB(s) s=alloc_tuple(3); Store_field(s,0,Val_unit); Store_field(s,1,Val_unit); Store_field(s,2,Val_unit); if((numnames[n]==NULL)||(numcodes[n]==NULL)||(numfnames[n]==NULL)){ CAMLlocal1(ns); AWB(ns) ns=copy_string(""); Store_field(s,0,ns); Store_field(s,1,ns); Store_field(s,2,ns); }else{ Store_field(s,0,copy_string(numnames[n])); Store_field(s,1,copy_string(numcodes[n])); Store_field(s,2,copy_string(numfnames[n])); } CAMLreturn(s); *) external str_terminfo_variable : int -> string*string*string = "mlcurses_str_terminfo_variable" (* CAMLlocal1(s); int n=a_int(aa); AWB(s) s=alloc_tuple(3); Store_field(s,0,Val_unit); Store_field(s,1,Val_unit); Store_field(s,2,Val_unit); if((strnames[n]==NULL)||(strcodes[n]==NULL)||(strfnames[n]==NULL)){ CAMLlocal1(ns); AWB(ns) ns=copy_string(""); Store_field(s,0,ns); Store_field(s,1,ns); Store_field(s,2,ns); }else{ Store_field(s,0,copy_string(strnames[n])); Store_field(s,1,copy_string(strcodes[n])); Store_field(s,2,copy_string(strfnames[n])); } CAMLreturn(s); *) external touchwin : window -> err = "mlcurses_touchwin" external touchline : window -> int -> int -> err = "mlcurses_touchline" external untouchwin : window -> err = "mlcurses_untouchwin" external wtouchln : window -> int -> int -> bool -> err = "mlcurses_wtouchln" external is_linetouched : window -> int -> int = "mlcurses_is_linetouched" external is_wintouched : window -> bool = "mlcurses_is_wintouched" external unctrl : chtype -> string = "mlcurses_unctrl" external keyname : int -> string = "mlcurses_keyname" external filter : unit -> unit = "mlcurses_filter" external use_env : bool -> unit = "mlcurses_use_env" external putwin : window -> Unix.file_descr -> err = "mlcurses_putwin" (* int fd=dup(a_int(ab)); FILE *f=fdopen(fd,"w"); int r=putwin(a_window(aa),f); fclose(f); r_err(r); *) external getwin : Unix.file_descr -> window = "mlcurses_getwin" (* int fd=dup(a_int(aa)); FILE *f=fdopen(fd,"r"); int r=putwin(a_window(aa),f); fclose(f); r_err(r); *) external delay_output : int -> err = "mlcurses_delay_output" external flushinp : unit -> unit = "mlcurses_flushinp" external newwin : int -> int -> int -> int -> window = "mlcurses_newwin" external delwin : window -> err = "mlcurses_delwin" external mvwin : window -> int -> int -> err = "mlcurses_mvwin" external subwin : window -> int -> int -> int -> int -> window = "mlcurses_subwin" external derwin : window -> int -> int -> int -> int -> window = "mlcurses_derwin" external mvderwin : window -> int -> int -> err = "mlcurses_mvderwin" external dupwin : window -> window = "mlcurses_dupwin" external wsyncup : window -> unit = "mlcurses_wsyncup" external syncok : window -> bool -> err = "mlcurses_syncok" external wcursyncup : window -> unit = "mlcurses_wcursyncup" external wsyncdown : window -> unit = "mlcurses_wsyncdown" external get_acs_codes : unit -> Acs.acs = "mlcurses_get_acs_codes" (* CAMLlocal1(tr); AWB(tr) tr=alloc_tuple(32); Store_field(tr,0,Val_int(ACS_ULCORNER)); Store_field(tr,1,Val_int(ACS_LLCORNER)); Store_field(tr,2,Val_int(ACS_URCORNER)); Store_field(tr,3,Val_int(ACS_LRCORNER)); Store_field(tr,4,Val_int(ACS_LTEE)); Store_field(tr,5,Val_int(ACS_RTEE)); Store_field(tr,6,Val_int(ACS_BTEE)); Store_field(tr,7,Val_int(ACS_TTEE)); Store_field(tr,8,Val_int(ACS_HLINE)); Store_field(tr,9,Val_int(ACS_VLINE)); Store_field(tr,10,Val_int(ACS_PLUS)); Store_field(tr,11,Val_int(ACS_S1)); Store_field(tr,12,Val_int(ACS_S9)); Store_field(tr,13,Val_int(ACS_DIAMOND)); Store_field(tr,14,Val_int(ACS_CKBOARD)); Store_field(tr,15,Val_int(ACS_DEGREE)); Store_field(tr,16,Val_int(ACS_PLMINUS)); Store_field(tr,17,Val_int(ACS_BULLET)); Store_field(tr,18,Val_int(ACS_LARROW)); Store_field(tr,19,Val_int(ACS_RARROW)); Store_field(tr,20,Val_int(ACS_DARROW)); Store_field(tr,21,Val_int(ACS_UARROW)); Store_field(tr,22,Val_int(ACS_BOARD)); Store_field(tr,23,Val_int(ACS_LANTERN)); Store_field(tr,24,Val_int(ACS_BLOCK)); Store_field(tr,25,Val_int(ACS_S3)); Store_field(tr,26,Val_int(ACS_S7)); Store_field(tr,27,Val_int(ACS_LEQUAL)); Store_field(tr,28,Val_int(ACS_GEQUAL)); Store_field(tr,29,Val_int(ACS_PI)); Store_field(tr,30,Val_int(ACS_NEQUAL)); Store_field(tr,31,Val_int(ACS_STERLING)); CAMLreturn(tr); *) external winch_handler_on : unit -> unit = "mlcurses_winch_handler_on" (* signal(SIGWINCH,winch_handler); CAMLreturn(Val_unit); *) external winch_handler_off : unit -> unit = "mlcurses_winch_handler_off" (* signal(SIGWINCH,SIG_IGN); CAMLreturn(Val_unit); *) external get_size : unit -> int*int = "mlcurses_get_size" (* struct winsize ws; ioctl(0,TIOCGWINSZ,&ws); r_int_int(ws.ws_row,ws.ws_col); *) external get_size_fd : Unix.file_descr -> int*int = "mlcurses_get_size_fd" (* struct winsize ws; ioctl(a_int(aa),TIOCGWINSZ,&ws); r_int_int(ws.ws_row,ws.ws_col); *) (* these two were written separately in ml_curses.c, * to permit proper threading behavior *) external getch : unit -> int = "mlcurses_getch" external wgetch : window -> int = "mlcurses_wgetch" let null_window = null_window () let bool_terminfo_variables = Hashtbl.create 67 let num_terminfo_variables = Hashtbl.create 67 let str_terminfo_variables = Hashtbl.create 601 let () = let rec ins f h n = let (a, b, c) = f n in if a = "" then () else ( Hashtbl.add h c (a, b); ins f h (n + 1) ) in ins bool_terminfo_variable bool_terminfo_variables 0; ins num_terminfo_variable num_terminfo_variables 0; ins str_terminfo_variable str_terminfo_variables 0 module A = struct let normal = 0 let attributes = 0x7FFFFF00 let chartext = 0x000000FF let color = 0x0000FF00 let standout = 0x00010000 let underline = 0x00020000 let reverse = 0x00040000 let blink = 0x00080000 let dim = 0x00100000 let bold = 0x00200000 let altcharset = 0x00400000 let invis = 0x00800000 let protect = 0x01000000 let horizontal = 0x02000000 let left = 0x04000000 let low = 0x08000000 let right = 0x10000000 let top = 0x20000000 let vertical = 0x40000000 let combine = List.fold_left (lor) 0 let color_pair n = (n lsl 8) land color let pair_number a = (a land color) lsr 8 end (* *) module WA = A module Color = struct let black = 0 let red = 1 let green = 2 let yellow = 3 let blue = 4 let magenta = 5 let cyan = 6 let white = 7 end module Key = struct let code_yes = 0o400 let min = 0o401 let break = 0o401 let down = 0o402 let up = 0o403 let left = 0o404 let right = 0o405 let home = 0o406 let backspace = 0o407 let f0 = 0o410 let dl = 0o510 let il = 0o511 let dc = 0o512 let ic = 0o513 let eic = 0o514 let clear = 0o515 let eos = 0o516 let eol = 0o517 let sf = 0o520 let sr = 0o521 let npage = 0o522 let ppage = 0o523 let stab = 0o524 let ctab = 0o525 let catab = 0o526 let enter = 0o527 let sreset = 0o530 let reset = 0o531 let print = 0o532 let ll = 0o533 let a1 = 0o534 let a3 = 0o535 let b2 = 0o536 let c1 = 0o537 let c3 = 0o540 let btab = 0o541 let beg = 0o542 let cancel = 0o543 let close = 0o544 let command = 0o545 let copy = 0o546 let create = 0o547 let end_ = 0o550 let exit = 0o551 let find = 0o552 let help = 0o553 let mark = 0o554 let message = 0o555 let move = 0o556 let next = 0o557 let open_ = 0o560 let options = 0o561 let previous = 0o562 let redo = 0o563 let reference = 0o564 let refresh = 0o565 let replace = 0o566 let restart = 0o567 let resume = 0o570 let save = 0o571 let sbeg = 0o572 let scancel = 0o573 let scommand = 0o574 let scopy = 0o575 let screate = 0o576 let sdc = 0o577 let sdl = 0o600 let select = 0o601 let send = 0o602 let seol = 0o603 let sexit = 0o604 let sfind = 0o605 let shelp = 0o606 let shome = 0o607 let sic = 0o610 let sleft = 0o611 let smessage = 0o612 let smove = 0o613 let snext = 0o614 let soptions = 0o615 let sprevious = 0o616 let sprint = 0o617 let sredo = 0o620 let sreplace = 0o621 let sright = 0o622 let srsume = 0o623 let ssave = 0o624 let ssuspend = 0o625 let sundo = 0o626 let suspend = 0o627 let undo = 0o630 let mouse = 0o631 let resize = 0o632 let max = 0o777 let f n = f0 + n end orpie-1.5.2/curses/ncurses.txt0000644000175000017500000000146412322115103015043 0ustar paulpaul/* TODO: (souris) */ curs_addch(3X) * curs_addchstr(3X) * curs_addstr(3X) * curs_attr(3X) * curs_beep(3X) * curs_bkgd(3X) * curs_border(3X) * curs_clear(3X) * curs_color(3X) * curs_delch(3X) * curs_deleteln(3X) * curs_getch(3X) * curs_getstr(3X) * curs_getyx(3X) * curs_inch(3X) * curs_inchstr(3X) * curs_initscr(3X) * curs_inopts(3X) * curs_insch(3X) * curs_insstr(3X) * curs_instr(3X) * curs_kernel(3X) * curs_mouse(3X) /* I am lazy */ curs_move(3X) * curs_outopts(3X) * curs_overlay(3X) * curs_pad(3X) * curs_printw(3X) /* I will not do it */ curs_refresh(3X) * curs_resize(3x) * curs_scanw(3X) /* I will not do it */ curs_scr_dump(3X) * curs_scroll(3X) * curs_slk(3X) * curs_termattrs(3X) * curs_termcap(3X) * curs_terminfo(3X) * curs_touch(3X) * curs_util(3X) * curs_window(3X) * orpie-1.5.2/curses/curses.ml.in0000644000175000017500000001111512322115103015055 0ustar paulpaultype window type screen type terminal type chtype = int type attr_t = int type err = bool #define quote(a) #a #define ML0(f,tr) \ external f : unit -> tr = quote(mlcurses_##f) #define ML1(f,tr,ta) \ external f : ta -> tr = quote(mlcurses_##f) #define ML2(f,tr,ta,tb) \ external f : ta -> tb -> tr = quote(mlcurses_##f) #define ML3(f,tr,ta,tb,tc) \ external f : ta -> tb -> tc -> tr = quote(mlcurses_##f) #define ML4(f,tr,ta,tb,tc,td) \ external f : ta -> tb -> tc -> td -> tr = quote(mlcurses_##f) #define ML5(f,tr,ta,tb,tc,td,te) \ external f : ta -> tb -> tc -> td -> te -> tr = quote(mlcurses_##f) #define ML6(f,tr,ta,tb,tc,td,te,tf) \ external f : ta -> tb -> tc -> td -> te -> tf -> tr \ = quote(mlcurses_##f##_bytecode) quote(mlcurses_##f##_native) #define ML7(f,tr,ta,tb,tc,td,te,tf,tg) \ external f : ta -> tb -> tc -> td -> te -> tf -> tg -> tr \ = quote(mlcurses_##f##_bytecode) quote(mlcurses_##f##_native) #define ML8(f,tr,ta,tb,tc,td,te,tf,tg,th) \ external f : ta -> tb -> tc -> td -> te -> tf -> tg -> th -> tr \ = quote(mlcurses_##f##_bytecode) quote(mlcurses_##f##_native) #define ML9(f,tr,ta,tb,tc,td,te,tf,tg,th,ti) \ external f : ta -> tb -> tc -> td -> te -> tf -> tg -> th -> ti -> tr \ = quote(mlcurses_##f##_bytecode) quote(mlcurses_##f##_native) #define ML0d(f,tr) ML0(f,tr) #define ML1d(f,tr,ta) ML1(f,tr,ta) #define ML2d(f,tr,ta,tb) ML2(f,tr,ta,tb) #define ML3d(f,tr,ta,tb,tc) ML3(f,tr,ta,tb,tc) #define ML4d(f,tr,ta,tb,tc,td) ML4(f,tr,ta,tb,tc,td) #define ML5d(f,tr,ta,tb,tc,td,te) ML5(f,tr,ta,tb,tc,td,te) #define ML6d(f,tr,ta,tb,tc,td,te,tf) ML6(f,tr,ta,tb,tc,td,te,tf) #define BEG (* #define BEG0 BEG #define BEG1 BEG #define BEG2 BEG #define BEG3 BEG #define BEG4 BEG #define BEG5 BEG #define BEG6 BEG #define BEG7 BEG #define BEG8 BEG #define BEG9 BEG #define END *) module Acs = struct type acs = { ulcorner: chtype; llcorner: chtype; urcorner: chtype; lrcorner: chtype; ltee: chtype; rtee: chtype; btee: chtype; ttee: chtype; hline: chtype; vline: chtype; plus: chtype; s1: chtype; s9: chtype; diamond: chtype; ckboard: chtype; degree: chtype; plminus: chtype; bullet: chtype; larrow: chtype; rarrow: chtype; darrow: chtype; uarrow: chtype; board: chtype; lantern: chtype; block: chtype; s3: chtype; s7: chtype; lequal: chtype; gequal: chtype; pi: chtype; nequal: chtype; sterling: chtype } let bssb a = a.ulcorner let ssbb a = a.llcorner let bbss a = a.urcorner let sbbs a = a.lrcorner let sbss a = a.rtee let sssb a = a.ltee let ssbs a = a.btee let bsss a = a.ttee let bsbs a = a.hline let sbsb a = a.vline let ssss a = a.plus end #include "functions.c" (* these two were written separately in ml_curses.c, * to permit proper threading behavior *) ML0(getch,int) ML1(wgetch,int,window) let null_window = null_window () let bool_terminfo_variables = Hashtbl.create 67 let num_terminfo_variables = Hashtbl.create 67 let str_terminfo_variables = Hashtbl.create 601 let () = let rec ins f h n = let (a, b, c) = f n in if a = "" then () else ( Hashtbl.add h c (a, b); ins f h (n + 1) ) in ins bool_terminfo_variable bool_terminfo_variables 0; ins num_terminfo_variable num_terminfo_variables 0; ins str_terminfo_variable str_terminfo_variables 0 /* (* Bon, je vais recopier les constantes directement, parceque je n'ai * aucune idée de comment générer ça automatiquement proprement. Si ça ne * marche pas chez vous, il vous suffit de regarder l'include, et de * corriger à la main. Faites-le moi savoir, à tout hasard... *) */ module A = struct let normal = 0 let attributes = 0x7FFFFF00 let chartext = 0x000000FF let color = 0x0000FF00 let standout = 0x00010000 let underline = 0x00020000 let reverse = 0x00040000 let blink = 0x00080000 let dim = 0x00100000 let bold = 0x00200000 let altcharset = 0x00400000 let invis = 0x00800000 let protect = 0x01000000 let horizontal = 0x02000000 let left = 0x04000000 let low = 0x08000000 let right = 0x10000000 let top = 0x20000000 let vertical = 0x40000000 let combine = List.fold_left (lor) 0 let color_pair n = (n lsl 8) land color let pair_number a = (a land color) lsr 8 end (*/* Je sais, c'est moche, mais ça marche */*) module WA = A module Color = struct let black = 0 let red = 1 let green = 2 let yellow = 3 let blue = 4 let magenta = 5 let cyan = 6 let white = 7 end module Key = struct #include "keys.ml" let f n = f0 + n end orpie-1.5.2/curses/curses.mli0000644000175000017500000005571412322115103014636 0ustar paulpaultype window and screen and terminal and chtype = int and attr_t = int and err = bool module Acs : sig type acs = { ulcorner : chtype; llcorner : chtype; urcorner : chtype; lrcorner : chtype; ltee : chtype; rtee : chtype; btee : chtype; ttee : chtype; hline : chtype; vline : chtype; plus : chtype; s1 : chtype; s9 : chtype; diamond : chtype; ckboard : chtype; degree : chtype; plminus : chtype; bullet : chtype; larrow : chtype; rarrow : chtype; darrow : chtype; uarrow : chtype; board : chtype; lantern : chtype; block : chtype; s3 : chtype; s7 : chtype; lequal : chtype; gequal : chtype; pi : chtype; nequal : chtype; sterling : chtype; } val bssb : acs -> chtype val ssbb : acs -> chtype val bbss : acs -> chtype val sbbs : acs -> chtype val sbss : acs -> chtype val sssb : acs -> chtype val ssbs : acs -> chtype val bsss : acs -> chtype val bsbs : acs -> chtype val sbsb : acs -> chtype val ssss : acs -> chtype end external addch : chtype -> err = "mlcurses_addch" external waddch : window -> chtype -> err = "mlcurses_waddch" external mvaddch : int -> int -> chtype -> err = "mlcurses_mvaddch" external mvwaddch : window -> int -> int -> chtype -> err = "mlcurses_mvwaddch" external echochar : chtype -> err = "mlcurses_echochar" external wechochar : window -> chtype -> err = "mlcurses_wechochar" external addchstr : chtype array -> err = "mlcurses_addchstr" external waddchstr : window -> chtype array -> err = "mlcurses_waddchstr" external mvaddchstr : int -> int -> chtype array -> err = "mlcurses_mvaddchstr" external mvwaddchstr : window -> int -> int -> chtype array -> err = "mlcurses_mvwaddchstr" external addchnstr : chtype array -> int -> int -> err = "mlcurses_addchnstr" external waddchnstr : window -> chtype array -> int -> int -> err = "mlcurses_waddchnstr" external mvaddchnstr : int -> int -> chtype array -> int -> int -> err = "mlcurses_mvaddchnstr" external mvwaddchnstr : window -> int -> int -> chtype array -> int -> int -> err = "mlcurses_mvwaddchnstr_bytecode" "mlcurses_mvwaddchnstr_native" external addstr : string -> err = "mlcurses_addstr" external waddstr : window -> string -> err = "mlcurses_waddstr" external mvaddstr : int -> int -> string -> err = "mlcurses_mvaddstr" external mvwaddstr : window -> int -> int -> string -> err = "mlcurses_mvwaddstr" external addnstr : string -> int -> int -> err = "mlcurses_addnstr" external waddnstr : window -> string -> int -> int -> err = "mlcurses_waddnstr" external mvaddnstr : int -> int -> string -> int -> int -> err = "mlcurses_mvaddnstr" external mvwaddnstr : window -> int -> int -> string -> int -> int -> err = "mlcurses_mvwaddnstr_bytecode" "mlcurses_mvwaddnstr_native" external attroff : int -> unit = "mlcurses_attroff" external wattroff : window -> int -> unit = "mlcurses_wattroff" external attron : int -> unit = "mlcurses_attron" external wattron : window -> int -> unit = "mlcurses_wattron" external attrset : int -> unit = "mlcurses_attrset" external wattrset : window -> int -> unit = "mlcurses_wattrset" external standend : unit -> unit = "mlcurses_standend" external wstandend : window -> unit = "mlcurses_wstandend" external standout : unit -> unit = "mlcurses_standout" external wstandout : window -> unit = "mlcurses_wstandout" external attr_off : attr_t -> unit = "mlcurses_attr_off" external wattr_off : window -> attr_t -> unit = "mlcurses_wattr_off" external attr_on : attr_t -> unit = "mlcurses_attr_on" external wattr_on : window -> attr_t -> unit = "mlcurses_wattr_on" external attr_set : attr_t -> int -> unit = "mlcurses_attr_set" external wattr_set : window -> attr_t -> int -> unit = "mlcurses_wattr_set" external chgat : int -> attr_t -> int -> unit = "mlcurses_chgat" external wchgat : window -> int -> attr_t -> int -> unit = "mlcurses_wchgat" external mvchgat : int -> int -> int -> attr_t -> int -> unit = "mlcurses_mvchgat" external mvwchgat : window -> int -> int -> int -> attr_t -> int -> unit = "mlcurses_mvwchgat_bytecode" "mlcurses_mvwchgat_native" external beep : unit -> err = "mlcurses_beep" external flash : unit -> err = "mlcurses_flash" external bkgdset : chtype -> unit = "mlcurses_bkgdset" external wbkgdset : window -> chtype -> unit = "mlcurses_wbkgdset" external bkgd : chtype -> unit = "mlcurses_bkgd" external wbkgd : window -> chtype -> unit = "mlcurses_wbkgd" external getbkgd : window -> chtype = "mlcurses_getbkgd" external border : chtype -> chtype -> chtype -> chtype -> chtype -> chtype -> chtype -> chtype -> unit = "mlcurses_border_bytecode" "mlcurses_border_native" external wborder : window -> chtype -> chtype -> chtype -> chtype -> chtype -> chtype -> chtype -> chtype -> unit = "mlcurses_wborder_bytecode" "mlcurses_wborder_native" external box : window -> chtype -> chtype -> unit = "mlcurses_box" external hline : chtype -> int -> unit = "mlcurses_hline" external whline : window -> chtype -> int -> unit = "mlcurses_whline" external vline : chtype -> int -> unit = "mlcurses_vline" external wvline : window -> chtype -> int -> unit = "mlcurses_wvline" external mvhline : int -> int -> chtype -> int -> unit = "mlcurses_mvhline" external mvwhline : window -> int -> int -> chtype -> int -> unit = "mlcurses_mvwhline" external mvvline : int -> int -> chtype -> int -> unit = "mlcurses_mvvline" external mvwvline : window -> int -> int -> chtype -> int -> unit = "mlcurses_mvwvline" external erase : unit -> unit = "mlcurses_erase" external werase : window -> unit = "mlcurses_werase" external clear : unit -> unit = "mlcurses_clear" external wclear : window -> unit = "mlcurses_wclear" external clrtobot : unit -> unit = "mlcurses_clrtobot" external wclrtobot : window -> unit = "mlcurses_wclrtobot" external clrtoeol : unit -> unit = "mlcurses_clrtoeol" external wclrtoeol : window -> unit = "mlcurses_wclrtoeol" external start_color : unit -> err = "mlcurses_start_color" external use_default_colors : unit -> err = "mlcurses_use_default_colors" external init_pair : int -> int -> int -> err = "mlcurses_init_pair" external init_color : int -> int -> int -> int -> err = "mlcurses_init_color" external has_colors : unit -> bool = "mlcurses_has_colors" external can_change_color : unit -> bool = "mlcurses_can_change_color" external color_content : int -> int * int * int = "mlcurses_color_content" external pair_content : int -> int * int = "mlcurses_pair_content" external colors : unit -> int = "mlcurses_colors" external color_pairs : unit -> int = "mlcurses_color_pairs" external delch : unit -> err = "mlcurses_delch" external wdelch : window -> err = "mlcurses_wdelch" external mvdelch : int -> int -> err = "mlcurses_mvdelch" external mvwdelch : window -> int -> int -> err = "mlcurses_mvwdelch" external deleteln : unit -> err = "mlcurses_deleteln" external wdeleteln : window -> err = "mlcurses_wdeleteln" external insdelln : int -> err = "mlcurses_insdelln" external winsdelln : window -> int -> err = "mlcurses_winsdelln" external insertln : unit -> err = "mlcurses_insertln" external winsertln : window -> err = "mlcurses_winsertln" external getch : unit -> int = "mlcurses_getch" external wgetch : window -> int = "mlcurses_wgetch" external mvgetch : int -> int -> int = "mlcurses_mvgetch" external mvwgetch : window -> int -> int -> int = "mlcurses_mvwgetch" external ungetch : int -> err = "mlcurses_ungetch" external getstr : string -> err = "mlcurses_getstr" external wgetstr : window -> string -> err = "mlcurses_wgetstr" external mvgetstr : int -> int -> string -> err = "mlcurses_mvgetstr" external mvwgetstr : window -> int -> int -> string -> err = "mlcurses_mvwgetstr" external getnstr : string -> int -> int -> err = "mlcurses_getnstr" external wgetnstr : window -> string -> int -> int -> err = "mlcurses_wgetnstr" external mvgetnstr : int -> int -> string -> int -> int -> err = "mlcurses_mvgetnstr" external mvwgetnstr : window -> int -> int -> string -> int -> int -> err = "mlcurses_mvwgetnstr_bytecode" "mlcurses_mvwgetnstr_native" external getyx : window -> int * int = "mlcurses_getyx" external getparyx : window -> int * int = "mlcurses_getparyx" external getbegyx : window -> int * int = "mlcurses_getbegyx" external getmaxyx : window -> int * int = "mlcurses_getmaxyx" external inch : unit -> chtype = "mlcurses_inch" external winch : window -> chtype = "mlcurses_winch" external mvinch : int -> int -> chtype = "mlcurses_mvinch" external mvwinch : window -> int -> int -> chtype = "mlcurses_mvwinch" external inchstr : chtype array -> err = "mlcurses_inchstr" external winchstr : window -> chtype array -> err = "mlcurses_winchstr" external mvinchstr : int -> int -> chtype array -> err = "mlcurses_mvinchstr" external mvwinchstr : window -> int -> int -> chtype array -> err = "mlcurses_mvwinchstr" external inchnstr : chtype array -> int -> int -> err = "mlcurses_inchnstr" external winchnstr : window -> chtype array -> int -> int -> err = "mlcurses_winchnstr" external mvinchnstr : int -> int -> chtype array -> int -> int -> err = "mlcurses_mvinchnstr" external mvwinchnstr : window -> int -> int -> chtype array -> int -> int -> err = "mlcurses_mvwinchnstr_bytecode" "mlcurses_mvwinchnstr_native" external insch : chtype -> err = "mlcurses_insch" external winsch : window -> chtype -> err = "mlcurses_winsch" external mvinsch : int -> int -> chtype -> err = "mlcurses_mvinsch" external mvwinsch : window -> int -> int -> chtype -> err = "mlcurses_mvwinsch" external initscr : unit -> window = "mlcurses_initscr" external endwin : unit -> unit = "mlcurses_endwin" external isendwin : unit -> bool = "mlcurses_isendwin" external newterm : string -> Unix.file_descr -> Unix.file_descr -> screen = "mlcurses_newterm" external set_term : screen -> unit = "mlcurses_set_term" external delscreen : screen -> unit = "mlcurses_delscreen" external stdscr : unit -> window = "mlcurses_stdscr" external insstr : string -> err = "mlcurses_insstr" external winsstr : window -> string -> err = "mlcurses_winsstr" external mvinsstr : int -> int -> string -> err = "mlcurses_mvinsstr" external mvwinsstr : window -> int -> int -> string -> err = "mlcurses_mvwinsstr" external insnstr : string -> int -> int -> err = "mlcurses_insnstr" external winsnstr : window -> string -> int -> int -> err = "mlcurses_winsnstr" external mvinsnstr : int -> int -> string -> int -> int -> err = "mlcurses_mvinsnstr" external mvwinsnstr : window -> int -> int -> string -> int -> int -> err = "mlcurses_mvwinsnstr_bytecode" "mlcurses_mvwinsnstr_native" external instr : string -> err = "mlcurses_instr" external winstr : window -> string -> err = "mlcurses_winstr" external mvinstr : int -> int -> string -> err = "mlcurses_mvinstr" external mvwinstr : window -> int -> int -> string -> err = "mlcurses_mvwinstr" external innstr : string -> int -> int -> err = "mlcurses_innstr" external winnstr : window -> string -> int -> int -> err = "mlcurses_winnstr" external mvinnstr : int -> int -> string -> int -> int -> err = "mlcurses_mvinnstr" external mvwinnstr : window -> int -> int -> string -> int -> int -> err = "mlcurses_mvwinnstr_bytecode" "mlcurses_mvwinnstr_native" external cbreak : unit -> err = "mlcurses_cbreak" external nocbreak : unit -> err = "mlcurses_nocbreak" external echo : unit -> err = "mlcurses_echo" external noecho : unit -> err = "mlcurses_noecho" external halfdelay : int -> err = "mlcurses_halfdelay" external intrflush : window -> bool -> err = "mlcurses_intrflush" external keypad : window -> bool -> err = "mlcurses_keypad" external meta : window -> bool -> err = "mlcurses_meta" external nodelay : window -> bool -> err = "mlcurses_nodelay" external raw : unit -> err = "mlcurses_raw" external noraw : unit -> err = "mlcurses_noraw" external noqiflush : unit -> unit = "mlcurses_noqiflush" external qiflush : unit -> unit = "mlcurses_qiflush" external notimeout : window -> bool -> err = "mlcurses_notimeout" external timeout : int -> unit = "mlcurses_timeout" external wtimeout : window -> int -> unit = "mlcurses_wtimeout" external typeahead : Unix.file_descr -> err = "mlcurses_typeahead" external notypeahead : unit -> err = "mlcurses_notypeahead" external def_prog_mode : unit -> unit = "mlcurses_def_prog_mode" external def_shell_mode : unit -> unit = "mlcurses_def_shell_mode" external reset_prog_mode : unit -> unit = "mlcurses_reset_prog_mode" external reset_shell_mode : unit -> unit = "mlcurses_reset_shell_mode" external resetty : unit -> unit = "mlcurses_resetty" external savetty : unit -> unit = "mlcurses_savetty" external getsyx : unit -> int * int = "mlcurses_getsyx" external setsyx : int -> int -> unit = "mlcurses_setsyx" external curs_set : int -> err = "mlcurses_curs_set" external napms : int -> unit = "mlcurses_napms" external ripoffline : bool -> unit = "mlcurses_ripoffline" external get_ripoff : unit -> window * int = "mlcurses_get_ripoff" external mousemask : int -> int * int = "mlcurses_mousemask" external move : int -> int -> err = "mlcurses_move" external wmove : window -> int -> int -> err = "mlcurses_wmove" external clearok : window -> bool -> unit = "mlcurses_clearok" external idlok : window -> bool -> unit = "mlcurses_idlok" external idcok : window -> bool -> unit = "mlcurses_idcok" external immedok : window -> bool -> unit = "mlcurses_immedok" external leaveok : window -> bool -> unit = "mlcurses_leaveok" external setscrreg : int -> int -> err = "mlcurses_setscrreg" external wsetscrreg : window -> int -> int -> err = "mlcurses_wsetscrreg" external scrollok : window -> bool -> unit = "mlcurses_scrollok" external nl : unit -> unit = "mlcurses_nl" external nonl : unit -> unit = "mlcurses_nonl" external overlay : window -> window -> err = "mlcurses_overlay" external overwrite : window -> window -> err = "mlcurses_overwrite" external copywin : window -> window -> int -> int -> int -> int -> int -> int -> bool -> err = "mlcurses_copywin_bytecode" "mlcurses_copywin_native" external newpad : int -> int -> window = "mlcurses_newpad" external subpad : window -> int -> int -> int -> int -> window = "mlcurses_subpad" external prefresh : window -> int -> int -> int -> int -> int -> int -> err = "mlcurses_prefresh_bytecode" "mlcurses_prefresh_native" external pnoutrefresh : window -> int -> int -> int -> int -> int -> int -> err = "mlcurses_pnoutrefresh_bytecode" "mlcurses_pnoutrefresh_native" external pechochar : window -> chtype -> err = "mlcurses_pechochar" external refresh : unit -> err = "mlcurses_refresh" external wrefresh : window -> err = "mlcurses_wrefresh" external wnoutrefresh : window -> err = "mlcurses_wnoutrefresh" external doupdate : unit -> err = "mlcurses_doupdate" external redrawwin : window -> err = "mlcurses_redrawwin" external wredrawln : window -> int -> int -> err = "mlcurses_wredrawln" external wresize : window -> int -> int -> err = "mlcurses_wresize" external resizeterm : int -> int -> err = "mlcurses_resizeterm" external scr_dump : string -> err = "mlcurses_scr_dump" external scr_restore : string -> err = "mlcurses_scr_restore" external scr_init : string -> err = "mlcurses_scr_init" external scr_set : string -> err = "mlcurses_scr_set" external scroll : window -> err = "mlcurses_scroll" external scrl : int -> err = "mlcurses_scrl" external wscrl : window -> int -> err = "mlcurses_wscrl" external slk_init : int -> err = "mlcurses_slk_init" external slk_set : int -> string -> int -> err = "mlcurses_slk_set" external slk_refresh : unit -> err = "mlcurses_slk_refresh" external slk_noutrefresh : unit -> err = "mlcurses_slk_noutrefresh" external slk_label : int -> string = "mlcurses_slk_label" external slk_clear : unit -> err = "mlcurses_slk_clear" external slk_restore : unit -> err = "mlcurses_slk_restore" external slk_touch : unit -> err = "mlcurses_slk_touch" external slk_attron : attr_t -> err = "mlcurses_slk_attron" external slk_attroff : attr_t -> err = "mlcurses_slk_attroff" external slk_attrset : attr_t -> err = "mlcurses_slk_attrset" external baudrate : unit -> int = "mlcurses_baudrate" external erasechar : unit -> char = "mlcurses_erasechar" external has_ic : unit -> bool = "mlcurses_has_ic" external has_il : unit -> bool = "mlcurses_has_il" external killchar : unit -> char = "mlcurses_killchar" external longname : unit -> string = "mlcurses_longname" external termattrs : unit -> attr_t = "mlcurses_termattrs" external termname : unit -> string = "mlcurses_termname" external tgetent : string -> bool = "mlcurses_tgetent" external tgetflag : string -> bool = "mlcurses_tgetflag" external tgetnum : string -> int = "mlcurses_tgetnum" external tgetstr : string -> bool = "mlcurses_tgetstr" external tgoto : string -> int -> int -> string = "mlcurses_tgoto" external setupterm : string -> Unix.file_descr -> err = "mlcurses_setupterm" external setterm : string -> err = "mlcurses_setterm" external cur_term : unit -> terminal = "mlcurses_cur_term" external set_curterm : terminal -> terminal = "mlcurses_set_curterm" external del_curterm : terminal -> err = "mlcurses_del_curterm" external restartterm : string -> Unix.file_descr -> err = "mlcurses_restartterm" external putp : string -> err = "mlcurses_putp" external vidattr : chtype -> err = "mlcurses_vidattr" external mvcur : int -> int -> int -> int -> err = "mlcurses_mvcur" external tigetflag : string -> bool = "mlcurses_tigetflag" external tigetnum : string -> int = "mlcurses_tigetnum" external tigetstr : string -> string = "mlcurses_tigetstr" external tputs : string -> int -> (char -> unit) -> err = "mlcurses_tputs" external vidputs : chtype -> (char -> unit) -> err = "mlcurses_vidputs" external tparm : string -> int array -> string = "mlcurses_tparm" external bool_terminfo_variable : int -> string * string * string = "mlcurses_bool_terminfo_variable" external num_terminfo_variable : int -> string * string * string = "mlcurses_num_terminfo_variable" external str_terminfo_variable : int -> string * string * string = "mlcurses_str_terminfo_variable" external touchwin : window -> err = "mlcurses_touchwin" external touchline : window -> int -> int -> err = "mlcurses_touchline" external untouchwin : window -> err = "mlcurses_untouchwin" external wtouchln : window -> int -> int -> bool -> err = "mlcurses_wtouchln" external is_linetouched : window -> int -> int = "mlcurses_is_linetouched" external is_wintouched : window -> bool = "mlcurses_is_wintouched" external unctrl : chtype -> string = "mlcurses_unctrl" external keyname : int -> string = "mlcurses_keyname" external filter : unit -> unit = "mlcurses_filter" external use_env : bool -> unit = "mlcurses_use_env" external putwin : window -> Unix.file_descr -> err = "mlcurses_putwin" external getwin : Unix.file_descr -> window = "mlcurses_getwin" external delay_output : int -> err = "mlcurses_delay_output" external flushinp : unit -> unit = "mlcurses_flushinp" external newwin : int -> int -> int -> int -> window = "mlcurses_newwin" external delwin : window -> err = "mlcurses_delwin" external mvwin : window -> int -> int -> err = "mlcurses_mvwin" external subwin : window -> int -> int -> int -> int -> window = "mlcurses_subwin" external derwin : window -> int -> int -> int -> int -> window = "mlcurses_derwin" external mvderwin : window -> int -> int -> err = "mlcurses_mvderwin" external dupwin : window -> window = "mlcurses_dupwin" external wsyncup : window -> unit = "mlcurses_wsyncup" external syncok : window -> bool -> err = "mlcurses_syncok" external wcursyncup : window -> unit = "mlcurses_wcursyncup" external wsyncdown : window -> unit = "mlcurses_wsyncdown" external get_acs_codes : unit -> Acs.acs = "mlcurses_get_acs_codes" external winch_handler_on : unit -> unit = "mlcurses_winch_handler_on" external winch_handler_off : unit -> unit = "mlcurses_winch_handler_off" external get_size : unit -> int * int = "mlcurses_get_size" external get_size_fd : Unix.file_descr -> int * int = "mlcurses_get_size_fd" val null_window : window val bool_terminfo_variables : (string, string * string) Hashtbl.t val num_terminfo_variables : (string, string * string) Hashtbl.t val str_terminfo_variables : (string, string * string) Hashtbl.t module A : sig val normal : int val attributes : int val chartext : int val color : int val standout : int val underline : int val reverse : int val blink : int val dim : int val bold : int val altcharset : int val invis : int val protect : int val horizontal : int val left : int val low : int val right : int val top : int val vertical : int val combine : int list -> int val color_pair : int -> int val pair_number : int -> int end module WA : sig val normal : int val attributes : int val chartext : int val color : int val standout : int val underline : int val reverse : int val blink : int val dim : int val bold : int val altcharset : int val invis : int val protect : int val horizontal : int val left : int val low : int val right : int val top : int val vertical : int val combine : int list -> int val color_pair : int -> int val pair_number : int -> int end module Color : sig val black : int val red : int val green : int val yellow : int val blue : int val magenta : int val cyan : int val white : int end module Key : sig val code_yes : int val min : int val break : int val down : int val up : int val left : int val right : int val home : int val backspace : int val f0 : int val dl : int val il : int val dc : int val ic : int val eic : int val clear : int val eos : int val eol : int val sf : int val sr : int val npage : int val ppage : int val stab : int val ctab : int val catab : int val enter : int val sreset : int val reset : int val print : int val ll : int val a1 : int val a3 : int val b2 : int val c1 : int val c3 : int val btab : int val beg : int val cancel : int val close : int val command : int val copy : int val create : int val end_ : int val exit : int val find : int val help : int val mark : int val message : int val move : int val next : int val open_ : int val options : int val previous : int val redo : int val reference : int val refresh : int val replace : int val restart : int val resume : int val save : int val sbeg : int val scancel : int val scommand : int val scopy : int val screate : int val sdc : int val sdl : int val select : int val send : int val seol : int val sexit : int val sfind : int val shelp : int val shome : int val sic : int val sleft : int val smessage : int val smove : int val snext : int val soptions : int val sprevious : int val sprint : int val sredo : int val sreplace : int val sright : int val srsume : int val ssave : int val ssuspend : int val sundo : int val suspend : int val undo : int val mouse : int val resize : int val max : int val f : int -> int end orpie-1.5.2/curses/functions.c.in0000644000175000017500000004473512322115103015411 0ustar paulpaul/* addch */ ML1(addch,err,chtype) ML2(waddch,err,window,chtype) ML3(mvaddch,err,int,int,chtype) ML4(mvwaddch,err,window,int,int,chtype) ML1(echochar,err,chtype) ML2(wechochar,err,window,chtype) /* addchstr */ #define copie(l,id,ar) int i,c=l,r; \ chtype *t=malloc((c+1)*sizeof(chtype)); \ if(t==NULL) failwith("Out of memory"); \ for(i=0;i0); END ML1(tigetnum,int,string) ML1d(tigetstr,string,string) BEG1 char *s=tigetstr(a_string(aa)); if((s==NULL)||(s==(char * )-1)) failwith("tigetstr"); CAMLreturn(copy_string(s)); END ML3d(tputs,err,string,int,(char->unit)) BEG3 putc_function=ac; r_err(tputs(a_string(aa),a_int(ab),putc_callback)); END ML2d(vidputs,err,chtype,(char->unit)) BEG2 putc_function=ab; r_err(vidputs(a_chtype(aa),putc_callback)); END ML2d(tparm,string,string,int array) BEG2 int t[10],i,n=Wosize_val(ab); if(n>10) n=10; for(i=0;i 64 + x) let () = assert (addchnstr t 10 3) let () = assert (mvaddnstr 8 40 "Bonjour" 1 3) let () = assert (mvinsstr 8 40 "toto ") let t = [|0; 0; 0; 0 |] let () = assert (inchnstr t 0 3) let () = winch_handler_on () let kup = tigetstr "kcuu1" let () = assert (addstr kup) let acs = get_acs_codes () let () = assert (addch acs.Acs.ulcorner) let i = getch () let (nc, np, can) = (colors (), color_pairs (), can_change_color ()) let (c1, c2) = pair_content 1 let l = ref [] let () = assert (tputs "totoping" 1 (fun c -> l := (int_of_char c) :: !l)) let (tr, tc) = get_size () let () = endwin () let () = Array.iter (fun x -> print_int x; print_newline ()) t let () = print_string "key="; print_int i; print_newline () let () = print_int tr; print_string " "; print_int tc; print_newline () let () = print_int nc; print_string " " let () = print_int np; print_string " " let () = print_string (if can then "oui" else "non"); print_newline () let () = print_int c1; print_string " " let () = print_int c2; print_newline () let () = print_int ncol; print_newline () let () = List.iter (fun x -> print_int x; print_string " ") !l; print_newline () (*let i = ref 0 let () = while let (a, b, c) = str_terminfo_variable !i in (a <> "") && (print_string (a ^ "\t" ^ b ^ "\t" ^ c); print_newline (); true) do i := !i + 1 done*) (*let () = Hashtbl.iter (fun a (b,c) -> print_string (a ^ "\t" ^ b ^ "\t" ^ c); print_newline ()) str_terminfo_variables*) orpie-1.5.2/curses/Makefile0000644000175000017500000000052212322115103014252 0ustar paulpaul# Generate cpp-processed versions of a couple of files. # This should be done before creating a source archive, as cpp # does the wrong thing (!) at least under OS X. all: curses.ml functions.c curses.ml: curses.ml.in functions.c cpp -P -xassembler-with-cpp -o $@ $< functions.c: functions.c.in cpp -P -xassembler-with-cpp -o $@ $< orpie-1.5.2/curses/COPYING0000644000175000017500000006347612322115103013666 0ustar paulpaul GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! orpie-1.5.2/curses/keys.ml0000644000175000017500000000323712322115103014125 0ustar paulpaullet code_yes = 0o400 let min = 0o401 let break = 0o401 let down = 0o402 let up = 0o403 let left = 0o404 let right = 0o405 let home = 0o406 let backspace = 0o407 let f0 = 0o410 let dl = 0o510 let il = 0o511 let dc = 0o512 let ic = 0o513 let eic = 0o514 let clear = 0o515 let eos = 0o516 let eol = 0o517 let sf = 0o520 let sr = 0o521 let npage = 0o522 let ppage = 0o523 let stab = 0o524 let ctab = 0o525 let catab = 0o526 let enter = 0o527 let sreset = 0o530 let reset = 0o531 let print = 0o532 let ll = 0o533 let a1 = 0o534 let a3 = 0o535 let b2 = 0o536 let c1 = 0o537 let c3 = 0o540 let btab = 0o541 let beg = 0o542 let cancel = 0o543 let close = 0o544 let command = 0o545 let copy = 0o546 let create = 0o547 let end_ = 0o550 let exit = 0o551 let find = 0o552 let help = 0o553 let mark = 0o554 let message = 0o555 let move = 0o556 let next = 0o557 let open_ = 0o560 let options = 0o561 let previous = 0o562 let redo = 0o563 let reference = 0o564 let refresh = 0o565 let replace = 0o566 let restart = 0o567 let resume = 0o570 let save = 0o571 let sbeg = 0o572 let scancel = 0o573 let scommand = 0o574 let scopy = 0o575 let screate = 0o576 let sdc = 0o577 let sdl = 0o600 let select = 0o601 let send = 0o602 let seol = 0o603 let sexit = 0o604 let sfind = 0o605 let shelp = 0o606 let shome = 0o607 let sic = 0o610 let sleft = 0o611 let smessage = 0o612 let smove = 0o613 let snext = 0o614 let soptions = 0o615 let sprevious = 0o616 let sprint = 0o617 let sredo = 0o620 let sreplace = 0o621 let sright = 0o622 let srsume = 0o623 let ssave = 0o624 let ssuspend = 0o625 let sundo = 0o626 let suspend = 0o627 let undo = 0o630 let mouse = 0o631 let resize = 0o632 let max = 0o777 orpie-1.5.2/curses/ml_curses.c0000644000175000017500000001453512322115103014763 0ustar paulpaul#include #include #include #include #include #include #include #ifdef CURSES_HEADER #include CURSES_HEADER #else #ifdef HAVE_NCURSES_H #include #else #include #endif #endif #include /* Du travail pour les esclaves de M$ */ #include #include #include #define AWB(x) caml__dummy_##x=caml__dummy_##x; /* anti-warning bugware */ #define r_unit(f) f; CAMLreturn(Val_unit); #define r_window(f) CAMLreturn((value)f) #define r_terminal(f) CAMLreturn((value)f) #define r_err(f) CAMLreturn(Val_bool((f)!=ERR)) #define r_int(f) CAMLreturn(Val_int(f)) #define r_char(f) CAMLreturn(Val_int((f)&255)) #define r_chtype(f) CAMLreturn(Val_int(f)) #define r_attr_t(f) CAMLreturn(Val_int(f)) #define r_bool(f) CAMLreturn(Val_bool(f)) #define r_int_int(x,y) \ { CAMLlocal1(ret); AWB(ret); \ ret=alloc_tuple(2); \ Store_field(ret,0,Val_int(x)); \ Store_field(ret,1,Val_int(y)); \ CAMLreturn(ret); } #define r_int_int_int(x,y,z) \ { CAMLlocal1(ret); AWB(ret); \ ret=alloc_tuple(3); \ Store_field(ret,0,Val_int(x)); \ Store_field(ret,1,Val_int(y)); \ Store_field(ret,2,Val_int(z)); \ CAMLreturn(ret); } #define r_string(f) \ { char *ret=f; \ if(ret==NULL) failwith("Null pointer"); \ CAMLreturn(copy_string(ret)); } #define a_window(a) ((WINDOW * )a) #define a_terminal(a) ((TERMINAL * )a) #define a_screen(a) ((SCREEN * )Field(a,2)) #define a_int(a) Int_val(a) #define a_bool(a) Bool_val(a) #define a_chtype(a) Int_val(a) #define a_attr_t(a) Int_val(a) #define a_string(a) String_val(a) #define RA0 CAMLparam0(); #define RA1 CAMLparam1(aa); AWB(aa); #define RA2 CAMLparam2(aa,ab); AWB(aa); #define RA3 CAMLparam3(aa,ab,ac); AWB(aa); #define RA4 CAMLparam4(aa,ab,ac,ad); AWB(aa); #define RA5 CAMLparam5(aa,ab,ac,ad,ae); AWB(aa); #define RA6 CAMLparam5(aa,ab,ac,ad,ae); CAMLxparam1(af); AWB(aa); AWB(af); #define RA7 CAMLparam5(aa,ab,ac,ad,ae); CAMLxparam2(af,ag); AWB(aa); AWB(af); #define RA8 CAMLparam5(aa,ab,ac,ad,ae); CAMLxparam3(af,ag,ah); AWB(aa); AWB(af); #define RA9 CAMLparam5(aa,ab,ac,ad,ae); CAMLxparam4(af,ag,ah,ai); AWB(aa); AWB(af); #define ML0(f,tr) \ value mlcurses_##f(void) \ { RA0 r_##tr(f()); } #define ML1(f,tr,ta) \ value mlcurses_##f(value aa) \ { RA1 r_##tr(f(a_##ta(aa))); } #define ML2(f,tr,ta,tb) \ value mlcurses_##f(value aa,value ab) \ { RA2 r_##tr(f(a_##ta(aa),a_##tb(ab))); } #define ML3(f,tr,ta,tb,tc) \ value mlcurses_##f(value aa,value ab,value ac) \ { RA3 r_##tr(f(a_##ta(aa),a_##tb(ab),a_##tc(ac))); } #define ML4(f,tr,ta,tb,tc,td) \ value mlcurses_##f(value aa,value ab,value ac,value ad) \ { RA4 r_##tr(f(a_##ta(aa),a_##tb(ab),a_##tc(ac),a_##td(ad))); } #define ML5(f,tr,ta,tb,tc,td,te) \ value mlcurses_##f(value aa,value ab,value ac,value ad,value ae) \ { RA5 r_##tr(f(a_##ta(aa),a_##tb(ab),a_##tc(ac),a_##td(ad),a_##te(ae))); } #define ML7(f,tr,ta,tb,tc,td,te,tf,tg) \ value mlcurses_##f##_bytecode(value *a,int n) \ { RA0 r_##tr(f(a_##ta(a[0]),a_##tb(a[1]),a_##tc(a[2]),a_##td(a[3]), \ a_##te(a[4]),a_##tf(a[5]),a_##tg(a[6]))); } \ value mlcurses_##f##_native(value aa,value ab,value ac,value ad, \ value ae,value af,value ag) \ { RA7 r_##tr(f(a_##ta(aa),a_##tb(ab),a_##tc(ac),a_##td(ad), \ a_##te(ae),a_##tf(af),a_##tg(ag))); } #define ML8(f,tr,ta,tb,tc,td,te,tf,tg,th) \ value mlcurses_##f##_bytecode(value *a,int n) \ { RA0 r_##tr(f(a_##ta(a[0]),a_##tb(a[1]),a_##tc(a[2]),a_##td(a[3]), \ a_##te(a[4]),a_##tf(a[5]),a_##tg(a[6]),a_##th(a[7]))); } \ value mlcurses_##f##_native(value aa,value ab,value ac,value ad, \ value ae,value af,value ag,value ah) \ { RA8 r_##tr(f(a_##ta(aa),a_##tb(ab),a_##tc(ac),a_##td(ad), \ a_##te(ae),a_##tf(af),a_##tg(ag),a_##th(ah))); } #define ML9(f,tr,ta,tb,tc,td,te,tf,tg,th,ti) \ value mlcurses_##f##_bytecode(value *a,int n) \ { RA0 r_##tr(f(a_##ta(a[0]),a_##tb(a[1]),a_##tc(a[2]),a_##td(a[3]),a_##te(a[4]), \ a_##tf(a[5]),a_##tg(a[6]),a_##th(a[7]),a_##ti(a[8]))); } \ value mlcurses_##f##_native(value aa,value ab,value ac,value ad,value ae, \ value af,value ag,value ah,value ai) \ { RA9 r_##tr(f(a_##ta(aa),a_##tb(ab),a_##tc(ac),a_##td(ad),a_##te(ae), \ a_##tf(af),a_##tg(ag),a_##th(ah),a_##ti(ai))); } #define ML0d(f,tr) value mlcurses_##f(void) #define ML1d(f,tr,ta) value mlcurses_##f(value aa) #define ML2d(f,tr,ta,tb) value mlcurses_##f(value aa,value ab) #define ML3d(f,tr,ta,tb,tc) value mlcurses_##f(value aa,value ab,value ac) #define ML4d(f,tr,ta,tb,tc,td) value mlcurses_##f(value aa,value ab,\ value ac,value ad) #define ML5d(f,tr,ta,tb,tc,td,te) value mlcurses_##f(value aa,value ab,\ value ac,value ad,value ae) #define ML6d(f,tr,ta,tb,tc,td,te,tf) value mlcurses_##f##_native(value,value,\ value,value,value,value); \ value mlcurses_##f##_bytecode(value *a,int n) \ { return(mlcurses_##f##_native(a[0],a[1],a[2],a[3],a[4],a[5])); } \ value mlcurses_##f##_native(value aa,value ab,value ac,value ad,value ae,value af) #define BEG0 { RA0 { #define BEG1 { RA1 { #define BEG2 { RA2 { #define BEG3 { RA3 { #define BEG4 { RA4 { #define BEG5 { RA5 { #define BEG6 { RA6 { #define BEG7 { RA7 { #define BEG8 { RA8 { #define BEG9 { RA9 { #define END }} static WINDOW *ripoff_w[5]; static int ripoff_l[5]; static int ripoff_niv=0; static int ripoff_callback(WINDOW *w,int l) { if(ripoff_niv==5) return(0); ripoff_w[ripoff_niv]=w; ripoff_l[ripoff_niv]=l; ripoff_niv++; return(0); } value putc_function; static int putc_callback(int c) { CAMLparam0(); CAMLlocal1(ret); AWB(ret); ret=callback_exn(putc_function,Val_int(c&255)); CAMLreturn(Is_exception_result(ret)?-1:0); } /* Du travail pour les esclaves de M$ */ static void winch_handler(int n) { signal(n,winch_handler); ungetch(KEY_RESIZE); } #include "functions.c" #include "caml/signals.h" /* The following routines were rewritten 07/14/04 by Paul Pelzl * to allow other threads to run while getch() is blocking */ value mlcurses_getch(void) { CAMLparam0(); int ch; enter_blocking_section(); ch = getch(); leave_blocking_section(); CAMLreturn(Val_int(ch)); } value mlcurses_wgetch(value win) { CAMLparam1(win); int ch; WINDOW* w; caml__dummy_win = caml__dummy_win; w = (WINDOW *) win; enter_blocking_section(); ch = wgetch(w); leave_blocking_section(); CAMLreturn(Val_int(ch)); } orpie-1.5.2/curses/functions.c0000644000175000017500000004777312322115103015011 0ustar paulpaul ML1(addch,err,chtype) ML2(waddch,err,window,chtype) ML3(mvaddch,err,int,int,chtype) ML4(mvwaddch,err,window,int,int,chtype) ML1(echochar,err,chtype) ML2(wechochar,err,window,chtype) ML1d(addchstr,err,chtype array) BEG1 int i,c=Wosize_val(aa),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i0); END ML1(tigetnum,int,string) ML1d(tigetstr,string,string) BEG1 char *s=tigetstr(a_string(aa)); if((s==NULL)||(s==(char * )-1)) failwith("tigetstr"); CAMLreturn(copy_string(s)); END ML3d(tputs,err,string,int,(char->unit)) BEG3 putc_function=ac; r_err(tputs(a_string(aa),a_int(ab),putc_callback)); END ML2d(vidputs,err,chtype,(char->unit)) BEG2 putc_function=ab; r_err(vidputs(a_chtype(aa),putc_callback)); END ML2d(tparm,string,string,int array) BEG2 int t[10],i,n=Wosize_val(ab); if(n>10) n=10; for(i=0;i Orpie v1.5 User Manual

Orpie v1.5 User Manual

Paul J. Pelzl

September 13, 2007

“Because the equals key is for the weak.”

Contents

1  Introduction

Orpie is a console-based RPN (reverse polish notation) desktop calculator. The interface is similar to that of modern Hewlett-PackardTM calculators, but has been optimized for efficiency on a PC keyboard. The design is also influenced to some degree by the Mutt email client and the Vim editor.

Orpie does not have graphing capability, nor does it offer much in the way of a programming interface; other applications such as GNU Octave. are already very effective for such tasks. Orpie focuses specifically on helping you to crunch numbers quickly.

Orpie is written in Objective Caml (aka OCaml), a high-performance functional programming language with a whole lot of nice features. I highly recommend it.

2  Installation

This section describes how to install Orpie by compiling from source. Volunteers have pre-packaged Orpie for several popular operating systems, so you may be able to save yourself some time by installing from those packages. Please check the Orpie website for up-to-date package information.

Before installing Orpie, you should have installed the GNU Scientific Library (GSL) version 1.4 or greater. You will also need a curses library (e.g. ncurses), which is almost certainly already installed on your system. Finally, OCaml 3.07 or higher is required to compile the sources. You will need the Nums library that is distributed with OCaml; if you install OCaml from binary packages distributed by your OS vendor, you may find that separate Nums packages must also be installed.

I will assume you have received this program in the form of a source tarball, e.g. “orpie-x.x.tar.gz”. You have undoubtedly extracted this archive already (e.g. using “tar xvzf orpie-x.x.tar.gz”). Enter the root of the Orpie installation directory, e.g. “cd orpie-x.x”. You can compile the sources with the following sequence:

$ ./configure
$ make

Finally, run “make install” (as root) to install the executables. “configure” accepts a number of parameters that you can learn about with “./configure --help”. Perhaps the most common of these is the --prefix option, which lets you install to a non-standard directory1.

3  Quick Start

This section describes how to use Orpie in its default configuration. After familiarizing yourself with the basic operations as outlined in this section, you may wish to consult Section 4 to see how Orpie can be configured to better fit your needs.

3.1  Overview

You can start the calculator by executing orpie. The interface has two panels. The left panel combines status information with context-sensitive help; the right panel represents the calculator’s stack. (Note that the left panel will be hidden if Orpie is run in a terminal with less than 80 columns.)

In general, you perform calculations by first entering data on to the stack, then executing functions that operate on the stack data. As an example, you can hit 1<enter>2<enter>+ in order to add 1 and 2.

3.2  Entering Data

3.2.1  Entering Real Numbers

To enter a real number, just type the desired digits and hit enter. The space bar will begin entry of a scientific notation exponent. The ’n’ key is used for negation. Here are some examples:

KeypressesResulting Entry
1.23<enter>1.23
1.23<space>23n<enter>1.23e-23
1.23n<space>23<enter>-1.23e23

3.2.2  Entering Complex Numbers

Orpie can represent complex numbers using either cartesian (rectangular) or polar coordinates. See Section 3.5 to see how to change the complex number display mode.

A complex number is entered by first pressing ’(’, then entering the real part, then pressing ’,’ followed by the imaginary part. Alternatively, you can press ’(’ followed by the magnitude, then ’<’ followed by the phase angle. The angle will be interpreted in degrees or radians, depending on the current setting of the angle mode (see Section 3.5). Examples:

KeypressesResulting Entry
(1.23, 4.56<enter>(1.23, 4.56)
(0.7072<45<enter>(0.500065915655126, 0.50006591...
(1.23n,4.56<space>10<enter>(-1.23, 45600000000)

3.2.3  Entering Matrices

You can enter matrices by pressing ’[’. The elements of the matrix may then be entered as described in the previous sections, and should be separated using ’,’. To start a new row of the matrix, press ’[’ again. On the stack, each row of the matrix is enclosed in a set of brackets; for example, the matrix

12
34

would appear on the stack as [[1, 2][3, 4]].

Examples of matrix entry:

KeypressesResulting Entry
[1,2[3,4<enter>[[1, 2][3, 4]]
[1.2<space>10,0[3n,5n<enter>[[ 12000000000, 0 ][ -3, -5 ]]
[(1,2,3,4[5,6,7,8<enter>[[ (1, 2), (3, 4) ][ (5, 6), (...

3.2.4  Entering Data With Units

Real and complex scalars and matrices can optionally be labeled with units. After typing in the numeric portion of the data, press ’_’ followed by a units string. The format of units strings is described in Section 3.8.

Examples of entering dimensioned data:

KeypressesResulting Entry
1.234_N*mm^2/s<enter>1.234_N*mm^2*s^-1
(2.3,5_s^-4<enter>(2.3, 5)_s^-4
[1,2[3,4_lbf*in<enter>[[ 1, 2 ][ 3, 4 ]]_lbf*in
_nm<enter>1_nm

3.2.5  Entering Exact Integers

An exact integer may be entered by pressing ’#’ followed by the desired digits. The base of the integer will be assumed to be the same as the current calculator base mode (see Section 3.5 to see how to set this mode). Alternatively, the desired base may be specified by pressing space and appending one of {b, o, d, h}, to represent binary, octal, decimal, or hexadecimal, respectively. On the stack, the representation of the integer will be changed to match the current base mode. Examples:

KeypressesResulting Entry
#123456<enter># 123456`d
#ffff<space>h<enter># 65535`d
#10101n<space>b<enter># -21`d

Note that exact integers may have unlimited length, and the basic arithmetic operations (addition, subtraction, multiplication, division) will be performed using exact arithmetic when both arguments are integers.

3.2.6  Entering Variable Names

A variable name may be entered by pressing ’@’ followed by the desired variable name string. The string may contain alphanumeric characters, dashes, and underscores. Example:

KeypressesResulting Entry
@myvar@ myvar

Orpie also supports autocompletion of variable names. The help panel displays a list of pre-existing variables that partially match the name currently being entered. You can press ’<tab>’ to iterate through the list of matching variables.

As a shortcut, keys <f1>-<f4> will enter the variables (“registers”) @ r01 through @ r04.

3.2.7  Entering Physical Constants

Orpie includes definitions for a number of fundamental physical constants. To enter a constant, press ’C’, followed by the first few letters/digits of the constant’s symbol, then hit enter. Orpie offers an autocompletion feature for physical constants, so you only need to type enough of the constant to identify it uniquely. A list of matching constants will appear in the left panel of the display, to assist you in finding the desired choice.

The following is a list of Orpie’s physical constant symbols:

SymbolPhysical Constant
NAAvagadro’s number
kBoltzmann constant
Vmmolar volume
Runiversal gas constant
stdTstandard temperature
stdPstandard pressure
sigmaStefan-Boltzmann constant
cspeed of light
eps0permittivity of free space
u0permeability of free space
gacceleration of gravity
GNewtonian gravitational constant
hPlanck’s constant
hbarDirac’s constant
eelectron charge
meelectron mass
mpproton mass
alphafine structure constant
phimagnetic flux quantum
FFaraday’s constant
Rinf“infinity” Rydberg constant
a0Bohr radius
uBBohr magneton
uNnuclear magneton
lam0wavelength of a 1eV photon
f0frequency of a 1eV photon
lamcCompton wavelength
c3Wien’s constant

All physical constants are defined in the Orpie run-configuration file; consult Section 4 if you wish to define your own constants or change the existing definitions.

3.2.8  Entering Data With an External Editor

Orpie can also parse input entered via an external editor. You may find this to be a convenient method for entering large matrices. Pressing ’E’ will launch the external editor, and the various data types may be entered as illustrated by the examples below:

Data TypeSample Input String
exact integer#12345678`d, where the trailing letter is one of the base characters {b, o, d, h}
real number-123.45e67
complex number(1e10, 2) or (1 <90)
real matrix[[1, 2][3.1, 4.5e10]]
complex matrix[[(1, 0), 5][1e10, (2 <90)]]
variable@myvar

Real and complex numbers and matrices may have units appended; just add a units string such as “_N*m/s” immediately following the numeric portion of the expression.

Notice that the complex matrix input parser is quite flexible; real and complex matrix elements may be mixed, and cartesian and polar complex formats may be mixed as well.

Multiple stack entries may be specified in the same file, if they are separated by whitespace. For example, entering (1, 2) 1.5 into the editor will cause the complex value (1, 2) to be placed on the stack, followed by the real value 1.5.

The input parser will discard whitespace where possible, so feel free to add any form of whitespace between matrix rows, matrix elements, real and complex components, etc.

3.3  Executing Basic Function Operations

Once some data has been entered on the stack, you can apply operations to that data. For example, ’+’ will add the last two elements on the stack. By default, the following keys have been bound to such operations:

KeysOperations
+add last two stack elements
-subtract element 1 from element 2
*multiply last two stack elements
/divide element 2 by element 1
^raise element 2 to the power of element 1
nnegate last element
iinvert last element
ssquare root function
aabsolute value function
eexponential function
lnatural logarithm function
ccomplex conjugate function
!factorial function
%element 2 mod element 1
Sstore element 2 in (variable) element 1
;evaluate variable to obtain contents

As a shortcut, function operators will automatically enter any data that you were in the process of entering. So instead of the sequence 2<enter>2<enter>+, you could type simply 2<enter>2+ and the second number would be entered before the addition operation is applied.

As an additional shortcut, any variable names used as function arguments will be evaluated before application of the function. In other words, it is not necessary to evaluate variables before performing arithmetic operations on them.

3.4  Executing Function Abbreviations

One could bind nearly all calculator operations to specific keypresses, but this would rapidly get confusing since the PC keyboard is not labeled as nicely as a calculator keyboard is. For this reason, Orpie includes an abbreviation syntax.

To activate an abbreviation, press ’’ (quote key), followed by the first few letters/digits of the abbreviation, then hit enter. Orpie offers an autocompletion feature for abbreviations, so you only need to type enough of the operation to identify it uniquely. The matching abbreviations will appear in the left panel of the display, to assist you in finding the appropriate operation.

To avoid interface conflicts, abbreviations may be entered only when the entry buffer (the bottom line of the screen) is empty.

The following functions are available as abbreviations:

AbbreviationsFunctions
invinverse function
powraise element 2 to the power of element 1
sqsquare last element
sqrtsquare root function
absabsolute value function
expexponential function
lnnatural logarithm function
10^base 10 exponential function
log10base 10 logarithm function
conjcomplex conjugate function
sinsine function
coscosine function
tantangent function
sinhhyperbolic sine function
coshhyperbolic cosine function
tanhhyperbolic tangent function
asinarcsine function
acosarccosine function
atanarctangent function
asinhinverse hyperbolic sine function
acoshinverse hyperbolic cosine function
atanhinverse hyperbolic tangent function
rereal part of complex number
imimaginary part of complex number
gammaEuler gamma function
lngammanatural log of Euler gamma function
erferror function
erfccomplementary error function
factfactorial function
gcdgreatest common divisor function
lcmleast common multiple function
binombinomial coefficient function
permpermutation function
transmatrix transpose
tracetrace of a matrix
solvelinsolve a linear system of the form Ax = b
modelement 2 mod element 1
floorfloor function
ceilceiling function
tointconvert a real number to an integer type
torealconvert an integer type to a real number
addadd last two elements
subsubtract element 1 from element 2
multmultiply last two elements
divdivide element 2 by element 1
negnegate last element
storestore element 2 in (variable) element 1
evalevaluate variable to obtain contents
purgedelete a variable
totalsum the columns of a real matrix
meancompute the sample means of the columns of a real matrix
sumsqsum the squares of the columns of a real matrix
varcompute the unbiased sample variances of the columns of a real matrix
varbiascompute the biased (population) sample variances of the columns of a real matrix
stdevcompute the unbiased sample standard deviations of the columns of a real matrix
stdevbiascompute the biased (pop.) sample standard deviations of the columns of a matrix
minfind the minima of the columns of a real matrix
maxfind the maxima of the columns of a real matrix
utpncompute the upper tail probability of a normal distribution
uconvertconvert element 2 to an equivalent expression with units matching element 1
ustandconvert to equivalent expression using SI standard base units
uvaluedrop the units of the last element

Entering abbreviations can become tedious when performing repetitive calculations. To save some keystrokes, Orpie will automatically bind recently-used operations with no prexisting binding to keys <f5>-<f12>. The current autobindings can be viewed by pressing ’h’ to cycle between the various pages of the help panel.

3.5  Executing Basic Command Operations

In addition to the function operations listed in Section 3.3, a number of basic calculator commands have been bound to single keypresses:

KeysOperations
\drop last element
|clear all stack elements
<pagedown>swap last two elements
<enter>duplicate last element (when entry buffer is empty)
uundo last operation
rtoggle angle mode between degrees and radians
ptoggle complex display mode between rectangular and polar
bcycle base display mode between binary, octal, decimal, hex
hcycle through multiple help windows
vview last stack element in a fullscreen editor
Ecreate a new stack element using an external editor
Penter 3.1415…on the stack
C-Lrefresh the display
<up>begin stack browsing mode
Qquit Orpie

3.6  Executing Command Abbreviations

In addition to the function operations listed in Section 3.4, there are a large number of calculator commands that have been implemented using the abbreviation syntax:

AbbreviationsCalculator Operation
dropdrop last element
clearclear all stack elements
swapswap last two elements
dupduplicate last element
undoundo last operation
radset angle mode to radians
degset angle mode to degrees
rectset complex display mode to rectangular
polarset complex display mode to polar
binset base display mode to binary
octset base display mode to octal
decset base display mode to decimal
hexset base display mode to hexidecimal
viewview last stack element in a fullscreen editor
editcreate a new stack element using an external editor
pienter 3.1415…on the stack
randgenerate a random number between 0 and 1 (uniformly distributed)
refreshrefresh the display
aboutdisplay a nifty “About Orpie” screen
quitquit Orpie

3.7  Browsing the Stack

Orpie offers a stack browsing mode to assist in viewing and manipulating stack data. Press <up> to enter stack browsing mode; this should highlight the last stack element. You can use the up and down arrow keys to select different stack elements. The following keys are useful in stack browsing mode:

KeysOperations
qquit stack browsing mode
<left>scroll selected entry to the left
<right>scroll selected entry to the right
rcyclically “roll” stack elements downward, below the selected element (inclusive)
Rcyclically “roll” stack elements upward, below the selected element (inclusive)
vview the currently selected element in a fullscreen editor
Eedit the currently selected element with an external editor
<enter>duplicate the currently selected element

The left and right scrolling option may prove useful for viewing very lengthy stack entries, such as large matrices. The edit option provides a convenient way to correct data after it has been entered on the stack.

3.8  Units Formatting

A units string is a list of units separated by ’*’ to indicate multiplication and ’/’ to indicate division. Units may be raised to real-valued powers using the ’^’ character. A contrived example of a valid unit string would be "N*nm^2*kg/s/in^-3*GHz^2.34".

Orpie supports the standard SI prefix set, {y, z, a, f, p, n, u, m, c, d, da, h, k, M, G, T, P, E, Z, Y} (note the use of ’u’ for micro-). These prefixes may be applied to any of the following exhaustive sets of units:

StringLength Unit
mmeter
ftfoot
ininch
ydyard
mimile
pcparsec
AUastronomical unit
Angangstrom
furlongfurlong
ptPostScript point
picaPostScript pica
nminautical mile
lyrlightyear
StringMass Unit
ggram
lbpound mass
ozounce
slugslug
lbtTroy pound
ton(USA) short ton
tonl(UK) long ton
tonmmetric ton
ctcarat
grgrain
StringTime Unit
ssecond
minminute
hrhour
dayday
yryear
HzHertz
StringTemperature Unit
KKelvin
RRankine

Note: No, Celsius and Fahrenheit will not be supported. Because these temperature units do not share a common zero point, their behavior is ill-defined under many operations.

String“Amount of Substance” Unit
molMole
StringForce Unit
NNewton
lbfpound force
dyndyne
kipkip
StringEnergy Unit
JJoule
ergerg
calcalorie
BTUbritish thermal unit
eVelectron volt
StringElectrical Unit
AAmpere
CCoulomb
Vvolt
OhmOhm
FFarad
HHenry
TTesla
GGauss
WbWeber
MxMaxwell
StringPower Unit
WWatt
hphorsepower
StringPressure Unit
PaPascal
atmatmosphere
barbar
OhmOhm
mmHgmillimeters of mercury
inHginches of mercury
StringLuminance Unit
cdcandela
lmlumen
lxlux

Note: Although the lumen is defined by 1_lm = 1_cd * sr, Orpie drops the steridian because it is a dimensionless unit and therefore is of questionable use to a calculator.

StringVolume Unit
ozflfluid ounce (US)
cupcup (US)
ptpint (US)
qtquart (US)
galgallon (US)
Lliter

All units are defined in the Orpie run-configuration file; consult Section 4 if you wish to define your own units or change the existing definitions.

4  Advanced Configuration

Orpie reads a run-configuration textfile (generally /etc/orpierc or /usr/local/etc/orpierc) to determine key and command bindings. You can create a personalized configuration file in $HOME/.orpierc, and select bindings that match your usage patterns. The recommended procedure is to “include” the orpierc file provided with Orpie (see Section 4.1.1), and add or remove settings as desired.

4.1  orpierc Syntax

You may notice that the orpierc syntax is similar to the syntax used in the configuration file for the Mutt email client (muttrc).

Within the orpierc file, strings should be enclosed in double quotes ("). A double quote character inside a string may be represented by \" . The backslash character must be represented by doubling it (\\).

4.1.1  Including Other Rcfiles

Syntax: include filename_string

This syntax can be used to include one run-configuration file within another. This command could be used to load the default orpierc file (probably found in /etc/orpierc) within your personalized rcfile, ~/.orpierc. The filename string should be enclosed in quotes.

4.1.2  Setting Configuration Variables

Syntax: set variable=value_string

Several configuration variables can be set using this syntax; check Section 4.2 to see a list. The variables are unquoted, but the values should be quoted strings.

4.1.3  Creating Key Bindings

Syntax: bind key_identifier operation

This command will bind a keypress to execute a calculator operation. The various operations, which should not be enclosed in quotes, may be found in Section 4.3. Key identifiers may be specified by strings that represent a single keypress, for example "m" (quotes included). The key may be prefixed with "\\C" or "\\M" to represent Control or Meta (Alt) modifiers, respectively; note that the backslash must be doubled. A number of special keys lack single-character representations, so the following strings may be used to represent them:

  • "<esc>"
  • "<tab>"
  • "<enter>"
  • "<return>"
  • "<insert>"
  • "<home>"
  • "<end>"
  • "<pageup>"
  • "<pagedown>"
  • "<space>"
  • "<left>"
  • "<right>"
  • "<up>"
  • "<down>"
  • "<f1>" to "<f12>"

Due to differences between various terminal emulators, this key identifier syntax may not be adequate to describe every keypress. As a workaround, Orpie will also accept key identifiers in octal notation. As an example, you could use \024 (do not enclose it in quotes) to represent Ctrl-T.

Orpie includes a secondary executable, orpie-curses-keys, that prints out the key identifiers associated with keypresses. You may find it useful when customizing orpierc.

Multiple keys may be bound to the same operation, if desired.

4.1.4  Removing Key Bindings

Syntax:
unbind_function key_identifier
unbind_command key_identifier
unbind_edit key_identifier
unbind_browse key_identifier
unbind_abbrev key_identifier
unbind_variable key_identifier
unbind_integer key_identifier

These commands will remove key bindings associated with the various entry modes (functions, commands, editing operations, etc.). The key identifiers should be defined using the syntax described in the previous section.

4.1.5  Creating Key Auto-Bindings

Syntax: autobind key_identifier

In order to make repetitive calculations more pleasant, Orpie offers an automatic key binding feature. When a function or command is executed using its abbreviation, one of the keys selected by the autobind syntax will be automatically bound to that operation (unless the operation has already been bound to a key). The current set of autobindings can be viewed in the help panel by executing command_cycle_help (bound to ’h’ by default).

The syntax for the key identifiers is provided in the previous section.

4.1.6  Creating Operation Abbreviations

Syntax: abbrev operation_abbreviation operation

You can use this syntax to set the abbreviations used within Orpie to represent the various functions and commands. A list of available operations may be found in Section 4.3. The operation abbreviations should be quoted strings, for example "sin" or "log".

Orpie performs autocompletion on these abbreviations, allowing you to type usually just a few letters in order to select the desired command. The order of the autocompletion matches will be the same as the order in which the abbreviations are registered by the rcfile–so you may wish to place the more commonly used operation abbreviations earlier in the list.

Multiple abbreviations may be bound to the same operation, if desired.

4.1.7  Removing Operation Abbreviations

Syntax: unabbrev operation_abbreviation

This syntax can be used to remove an operation abbreviation. The operation abbreviations should be quoted strings, as described in the previous section.

4.1.8  Creating Macros

Syntax: macro key_identifier macro_string

You can use this syntax to cause a single keypress (the key_identifier) to be interpreted as the series of keypresses listed in macro_string. The syntax for defining a keypress is the same as that defined in Section 4.1.3. The macro string should be a list of whitespace-separated keypresses, e.g. "2 <return> 2 +" (including quotes).

This macro syntax provides a way to create small programs; by way of example, the default orpierc file includes macros for the base 2 logarithm and the binary entropy function (bound to L and H, respectively), as well as “register” variable shortcuts (<f1> to <f12>).

Macros may call other macros recursively. However, take care that a macro does not call itself recursively; Orpie will not trap the infinite loop.

Note that operation abbreviations may be accessed within macros. For example, macro "A" "’ a b o u t <return>" would bind A to display the “about Orpie” screen.

4.1.9  Creating Units

Syntax:
base_unit unit_symbol preferred_prefix
unit unit_symbol unit_definition

Units are defined in a two-step process:

  1. Define a set of orthogonal “base units.” All other units must be expressible in terms of these base units. The base units can be given a preferred SI prefix, which will be used whenever the units are standardized (e.g. via ustand). The unit symbols and preferred prefixes should all be quoted strings; to prefer no prefix, use the empty string ("").

    It is expected that most users will use the fundamental SI units for base units.

  2. Define all other units in terms of either base units or previously-defined units. Again, the unit symbol and unit definition should be quoted strings. The definition should take the form of a numeric value followed by a units string, e.g. "2.5_kN*m/s". See Section 3.8 for more details on the unit string format.

4.1.10  Creating Constants

Syntax: constant constant_symbol constant_definition

This syntax can be used to define a physical constant. Both the constant symbol and definition must be quoted strings. The constant definition should be a numeric constant followed by a units string e.g. "1.60217733e-19_C". All units used in the constant definition must already have been defined.

4.2  Configuration Variables

The following configuration variables may be set as described in Section 4.1.2:

  • datadir
    This variable should be set to the full path of the Orpie data directory, which will contain the calculator state save file, temporary buffers, etc. The default directory is "~/.orpie/".
  • editor
    This variable may be set to the fullscreen editor of your choice. The default value is "vi". It is recommended that you choose an editor that offers horizontal scrolling in place of word wrapping, so that the columns of large matrices can be properly aligned. (The Vim editor could be used in this fashion by setting editor to "vim -c ’set nowrap’".)
  • hide_help
    Set this variable to "true" to hide the left help/status panel, or leave it on the default of "false" to display the help panel.
  • conserve_memory
    Set this variable to "true" to minimize memory usage, or leave it on the default of "false" to improve rendering performance. (By default, Orpie caches multiple string representations of all stack elements. Very large integers in particular require significant computation for string representation, so caching these strings can make display updates much faster.)

4.3  Calculator Operations

Every calculator operation can be made available to the interface using the syntax described in Sections 4.1.3 and 4.1.6. The following is a list of every available operation.

4.3.1  Functions

The following operations are functions–that is, they will consume at least one argument from the stack. Orpie will generally abort the computation and provide an informative error message if a function cannot be successfully applied (for example, if you try to compute the transpose of something that is not a matrix).

For the exact integer data type, basic arithmetic operations will yield an exact integer result. Division of two exact integers will yield the quotient of the division. The more complicated functions will generally promote the integer to a real number, and as such the arithmetic will no longer be exact.

  • function_10_x
    Raise 10 to the power of the last stack element (inverse of function_log10).
  • function_abs
    Compute the absolute value of the last stack element.
  • function_acos
    Compute the inverse cosine of the last stack element. For real numbers, The result will be provided either in degrees or radians, depending on the angle mode of the calculator.
  • function_acosh
    Compute the inverse hyperbolic cosine of the last stack element.
  • function_add
    Add last two stack elements.
  • function_arg
    Compute the argument (phase angle of complex number) of the last stack element. The value will be provided in either degrees or radians, depending on the current angle mode of the calculator.
  • function_asin
    Compute the inverse sine of the last stack element. For real numbers, The result will be provided either in degrees or radians, depending on the angle mode of the calculator.
  • function_asinh
    Compute the inverse hyperbolic sine of the last stack element.
  • function_atan
    Compute the inverse tangent of the last stack element. For real numbers, The result will be provided either in degrees or radians, depending on the angle mode of the calculator.
  • function_atanh
    Compute the inverse hyperbolic tangent of the last stack element.
  • function_binomial_coeff
    Compute the binomial coefficient (“n choose k”) formed by the last two stack elements. If these arguments are real, the coefficient is computed using a fast approximation to the log of the gamma function, and therefore the result is subject to rounding errors. For exact integer arguments, the coefficient is computed using exact arithmetic; this has the potential to be a slow operation.
  • function_ceiling
    Compute the ceiling of the last stack element.
  • function_convert_units
    Convert stack element 2 to an equivalent expression in the units of element 1. Element 1 should be real-valued, and its magnitude will be ignored when computing the conversion.
  • function_cos
    Compute the cosine of the last stack element. If the argument is real, it will be assumed to be either degrees or radians, depending on the angle mode of the calculator.
  • function_cosh
    Compute the hyperbolic cosine of the last stack element.
  • function_conj
    Compute the complex conjugate of the last stack element.
  • function_div
    Divide element 2 by element 1.
  • function_erf
    Compute the error function of the last stack element.
  • function_erfc
    Compute the complementary error function of the last stack element.
  • function_eval
    Obtain the contents of the variable in the last stack position.
  • function_exp
    Evaluate the exponential function of the last stack element.
  • function_factorial
    Compute the factorial of the last stack element. For a real argument, this is computed using a fast approximation to the gamma function, and therefore the result may be subject to rounding errors (or overflow). For an exact integer argument, the factorial is computed using exact arithmetic; this has the potential to be a slow operation.
  • function_floor
    Compute the floor of the last stack element.
  • function_gamma
    Compute the Euler gamma function of the last stack element.
  • function_gcd
    Compute the greatest common divisor of the last two stack elements. This operation may be applied only to integer type data.
  • function_im
    Compute the imaginary part of the last stack element.
  • function_inv
    Compute the multiplicative inverse of the last stack element.
  • function_lcm
    Compute the least common multiple of the last two stack elements. This operation may be applied only to integer type data.
  • function_ln
    Compute the natural logarithm of the last stack element.
  • function_lngamma
    Compute the natural logarithm of the Euler gamma function of the last stack element.
  • function_log10
    Compute the base-10 logarithm of the last stack element.
  • function_maximum
    Find the maximum values of each of the columns of a real NxM matrix, returning a 1xM matrix as a result.
  • function_minimum
    Find the minimum values of each of the columns of a real NxM matrix, returning a 1xM matrix as a result.
  • function_mean
    Compute the sample means of each of the columns of a real NxM matrix, returning a 1xM matrix as a result.
  • function_mod
    Compute element 2 mod element 1. This operation can be applied only to integer type data.
  • function_mult
    Multiply last two stack elements.
  • function_neg
    Negate last stack element.
  • function_permutation
    Compute the permutation coefficient determined by the last two stack elements ’n’ and ’k’: the number of ways of obtaining an ordered subset of k elements from a set of n elements. If these arguments are real, the coefficient is computed using a fast approximation to the log of the gamma function, and therefore the result is subject to rounding errors. For exact integer arguments, the coefficient is computed using exact arithmetic; this has the potential to be a slow operation.
  • function_pow
    Raise element 2 to the power of element 1.
  • function_purge
    Delete the variable in the last stack position.
  • function_re
    Compute the real part of the last stack element.
  • function_sin
    Compute the sine of the last stack element. If the argument is real, it will be assumed to be either degrees or radians, depending on the angle mode of the calculator.
  • function_sinh
    Compute the hyperbolic sine of the last stack element.
  • function_solve_linear
    Solve a linear system of the form Ax = b, where A and b are the last two elements on the stack. A must be a square matrix and b must be a matrix with one column. This function does not compute inv(A), but obtains the solution by a more efficient LU decomposition method. This function is recommended over explicitly computing the inverse, especially when solving linear systems with relatively large dimension or with poorly conditioned matrices.
  • function_sq
    Square the last stack element.
  • function_sqrt
    Compute the square root of the last stack element.
  • function_standardize_units
    Convert the last stack element to an equivalent expression using the SI standard base units (kg, m, s, etc.).
  • function_stdev_unbiased
    Compute the unbiased sample standard deviation of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48’s sdev function.)
  • function_stdev_biased
    Compute the biased (population) sample standard deviation of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48’s psdev function.)
  • function_store
    Store element 2 in (variable) element 1.
  • function_sub
    Subtract element 1 from element 2.
  • function_sumsq
    Sum the squares of each of the columns of a real NxM matrix, returning a 1xM matrix as a result.
  • function_tan
    Compute the tangent of the last stack element. If the argument is real, it will be assumed to be either degrees or radians, depending on the angle mode of the calculator.
  • function_tanh
    Compute the hyperbolic tangent of the last stack element.
  • function_to_int
    Convert a real number to an integer type.
  • function_to_real
    Convert an integer type to a real number.
  • function_total
    Sum each of the columns of a real NxM matrix, returning a 1xM matrix as a result.
  • function_trace
    Compute the trace of a square matrix.
  • function_transpose
    Compute the matrix transpose of the last stack element.
  • function_unit_value
    Drop the units of the last stack element.
  • function_utpn
    Compute the upper tail probability of a normal distribution.
    UTPN(m, v, x) = Integrate[ 1/Sqrt[2 Pi v] Exp[-(m-y)2/(2 v)], {y, x, Infinity}]
  • function_var_unbiased
    Compute the unbiased sample variance of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48’s var function.)
  • function_var_biased
    Compute the biased (population) sample variance of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48’s pvar function.)

4.3.2  Commands

The following operations are referred to as commands; they differ from functions because they do not take an argument. Many calculator interface settings are implemented as commands.

  • command_about
    Display a nifty “about Orpie” credits screen.
  • command_begin_abbrev
    Begin entry of an operation abbreviation.
  • command_begin_browsing
    Enter stack browsing mode.
  • command_begin_constant
    Begin entry of a physical constant.
  • command_begin_variable
    Begin entry of a variable name.
  • command_bin
    Set the base of exact integer representation to 2 (binary).
  • command_clear
    Clear all elements from the stack.
  • command_cycle_base
    Cycle the base of exact integer representation between 2, 8, 10, and 16 (bin, oct, dec, and hex).
  • command_cycle_help
    Cycle through multiple help pages. The first page displays commonly used bindings, and the second page displays the current autobindings.
  • command_dec
    Set the base of exact integer representation to 10 (decimal).
  • command_deg
    Set the angle mode to degrees.
  • command_drop
    Drop the last element off the stack.
  • command_dup
    Duplicate the last stack element.
  • command_enter_pi
    Enter 3.1415…on the stack.
  • command_hex
    Set the base of exact integer representation to 16 (hexadecimal).
  • command_oct
    Set the base of exact integer representation to 8 (octal).
  • command_polar
    Set the complex display mode to polar.
  • command_rad
    Set the angle mode to radians.
  • command_rand
    Generate a random real-valued number between 0 (inclusive) and 1 (exclusive). The deviates are uniformly distributed.
  • command_rect
    Set the complex display mode to rectangular (cartesian).
  • command_refresh
    Refresh the display.
  • command_swap
    Swap stack elements 1 and 2.
  • command_quit
    Quit Orpie.
  • command_toggle_angle_mode
    Toggle the angle mode between degrees and radians.
  • command_toggle_complex_mode
    Toggle the complex display mode between rectangular and polar.
  • command_undo
    Undo the last calculator operation.
  • command_view
    View the last stack element in an external fullscreen editor.
  • command_edit_input
    Create a new stack element using an external editor.

4.3.3  Edit Operations

The following operations are related to editing during data entry. These commands cannot be made available as operation abbreviations, since abbreviations are not accessible while entering data. These operations should be made available as single keypresses using the bind keyword.

  • edit_angle
    Begin entering the phase angle of a complex number. (Orpie will assume the angle is in either degrees or radians, depending on the current angle mode.)
  • edit_backspace
    Delete the last character entered.
  • edit_begin_integer
    Begin entering an exact integer.
  • edit_begin_units
    Begin appending units to a numeric expression.
  • edit_complex
    Begin entering a complex number.
  • edit_enter
    Enter the data that is currently being edited.
  • edit_matrix
    Begin entering a matrix, or begin entering the next row of a matrix.
  • edit_minus
    Enter a minus sign in input.
  • edit_scientific_notation_base
    Begin entering the scientific notation exponent of a real number, or the base of an exact integer.
  • edit_separator
    Begin editing the next element of a complex number or matrix. (This will insert a comma between elements.)

4.3.4  Browsing Operations

The following list of operations is available only in stack browsing mode. As abbreviations are unavailable while browsing the stack, these operations should be bound to single keypresses using the bind keyword.

  • browse_echo
    Echo the currently selected element to stack level 1.
  • browse_end
    Exit stack browsing mode.
  • browse_drop
    Drop the currently selected stack element.
  • browse_dropn
    Drop all stack elements below the current selection (inclusive).
  • browse_keep
    Drop all stack elements except the current selection. (This is complementary to browse_drop.
  • browse_keepn
    Drop all stack elements above the current selection (non-inclusive). (This is complementary to browse_dropn.
  • browse_next_line
    Move the selection cursor down one line.
  • browse_prev_line
    Move the selection cursor up one line.
  • browse_rolldown
    Cyclically “roll” stack elements downward, below the selected element (inclusive).
  • browse_rollup
    Cyclically “roll” stack elements upward, below the selected element (inclusive) .
  • browse_scroll_left
    Scroll the selected element to the left (for viewing very large entries such as matrices).
  • browse_scroll_right
    Scroll the selected element to the right.
  • browse_view
    View the currently selected stack element in a fullscreen editor.
  • browse_edit
    Edit the currently selected stack element using an external editor.

4.3.5  Abbreviation Entry Operations

The following list of operations is available only while entering a function or command abbreviation, or while entering a physical constant. These operations must be bound to single keypresses using the bind keyword.

  • abbrev_backspace
    Delete a character from the abbreviation string.
  • abbrev_enter
    Execute the operation associated with the selected abbreviation.
  • abbrev_exit
    Cancel abbreviation entry.

4.3.6  Variable Entry Operations

The following list of operations is available only while entering a variable name. As abbreviations are unavailable while entering variables, these operations should be bound to single keypresses using the bind keyword.

  • variable_backspace
    Delete a character from the variable name.
  • variable_cancel
    Cancel entry of the variable name.
  • variable_complete
    Autocomplete the variable name.
  • variable_enter
    Enter the variable name on the stack.

4.3.7  Integer Entry Operations

The following operation is available only while entering an integer; it can be made accessible by binding it to a single keypress using the bind keyword.

  • integer_cancel
    Cancel entry of an integer.

5  Licensing

Orpie is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL), Version 2, as published by the Free Software Foundation. You should have received a copy of the GPL along with this program, in the file “COPYING”.

6  Credits

Orpie includes portions of the ocamlgsl bindings supplied by Olivier Andrieu, as well as the curses bindings from the OCaml Text Mode Kit written by Nicolas George. I would like to thank these authors for helping to make Orpie possible.

7  Contact info

Orpie author: Paul Pelzl <pelzlpj@gmail.com>
Orpie website: http://pessimization.com/software/orpie

Feel free to contact me if you have bugs, feature requests, patches, etc. I would also welcome volunteers interested in packaging Orpie for various platforms.


1
The default installation prefix is /usr/local. The orpierc file will be placed in $(prefix)/etc by default; use the --sysconfdir option to choose a different location.

This document was translated from LATEX by HEVEA.
orpie-1.5.2/doc/manual.pdf0000644000175000017500000036304412322115104014037 0ustar paulpaul%PDF-1.3 %Çì¢ 5 0 obj <> stream xœíœ[S7ÇgòȧØÇu§Vu¿<&i:“´is!íC¦ñ€€!ЯÑ~àI»ÖÑZk›b¨¹ ¬×Zí‘ôÓ_GG¾V”°ŠúŸæ÷öxã‡w¦Ú;Ý ÕÞÆ× ¾¬š_ÛãêÙ&°3„3¥ªÍÏñAVqΉºÒZAMµ9ÞøXÿ6 „ ®™‘õÉ1|àL;£ëÑ`¯äBWï†\:b¸«ÏS –. \2ê˜3µ‚²ŠBÙúªùÔ_K˙ʠ¬RÎéú$–•\Ô¯}eZ£ê­Tà0½â,]¢ÑJæ4ûsóUl8#N)æ®$šòj((PªÚÜ¿0IŒ·u+<­™€†ùú™ ð_ih.Sõ+_‚SÉ™„F†ÛVC pWpk¬ô}ã­qð ô6R!ë¿fîra¹7qÈ,ÑFUP‘Ð7Ѧ÷=5'«&ÓÊq1ÜFÓÕŸRÙ]Ô°“h¶v2ŒXSB¤Ëïã(hQót“/Íô2ö¶÷½=”œpaX5” zÉÊØ´¿½-T:.«ŸÅvj#yA:'E½.·©ôº>õOJJ•S-V¸zò•iﳬò¯=5â7œÆNÐ¥ûhUÔw#‡Úgõezãè4^+¡êÏG¨Ž“¶ ÕkÕ·jC±Éûá¶1ToLÂK]ÿƒº0vȾ¶_ÇÙª_¢!˜IlMFÖþ´ÀæØÈ+ÛܪˆH6¿Ízm„ºm?bê…ä=.3Ó€æþI±ÇÛ´«ƒÔ„yF™€§”hM,€‡Ák saYb\r˜…ç^¯Ãûw“)'ÈÚsdíæ¬/ #òm04N”fq¬üRQXë ¿oðæ„Ë@ƒOÖµÄåEA-)¨u‹Tš+ÍC<é àñÞ‹¸B) NÉ!ž¹=ðp¡½(õŽóúÇðšAàrÀt%F¹õëáGs–ãÏ^?á@œŽü)‘ó°!ð*È©‡p%0RgëwÞK_VsôäVrAâ¢`Á#ø5€«ÀI˼¥ñ§Ì¥™>yspp½—ž¶WûF%÷Á‘×… pë°ö*_S²¨|òøêÉ{žÈÃîÎø»H»~…wÜÔ‹f÷(ô594§W$²³²¬y¦¦Ýý~–ÄêYzêQày;¬]“ìY´•ÜM{© LšH'æ ®—9AÅ8#ÔšVÅf¤«ùº¸[(à&W[¿Â%š× „#ÆÁ~y;þèú1_ráªG9pйNß›¡\7sZµ’9OóµJ­\ÏE'蔽‚T1ôa—öâìyqÄÃæ.iÌ’ŠÊl]Ÿô¬Äh GLNÉæY…;™·Ø9[ÆŸ´Ø `W{# ]%·„ù#É’ÆØ¯(Ç~/‚¿EAµpH§pLbákô® ÄÏRôÁב¾æd‘×?aÕOu÷%•ÖOðKñyÌ.…2'¯ŠòV}78^êAÙíÁn®¥Ï¡èÌc‰ç1Kš!`YV¯òož¾Ú[ɹ0!gß_J!;NwGéîn±ìöônÁ^i})kß–-D—=;Q¼@]{Æçœ¯áTx4gîeiYš9Ðx¨Î^•šâ<“@÷͵ž(ÚŽudØÿ ¥&w\©i|·ùSîDH½k2ôÒF@Bäî “§â³ª¯Nòí50§?^ Ãb6]?†(›.S4;˜uxÚ ZÏ—~‚ך|*»Z袼£éœ8;áÅ!Ž9çĘbk1×:~Äqµ8¢„<WLè¤7qÞ¢Šúç{ÐÆÝæo^¶çg"ìZK;Ñ ±Qù:5g¡ ¥-±÷h ×ל¸‹TD ¹„«9l‹æ±‹~îPf^9 }|cn\çA¬.v!/ØÌÃŽZw]ì´wKÙmþƒc )[Êd™/fOoã×ËJœºe‰CÁÚ,.Œ×Ö!Z;gØŒ<Îq:36¥UDÑÇœö›^ig0Ä+íû½j ÑŽãz‡PQDoû”!ü¿5'såÁa¹0¡ª„ål¾N®Z¬ŽfÅ ñ © œëÛΠ†HèŒÎâ’È.‹äº K˜ÿ]/Òz±¹ñ~þ ªæüendstream endobj 6 0 obj 2261 endobj 15 0 obj <> stream xœíšMÛ6†õ+t” ˆ!9ïc$@ŠA·—¢‡ÄëâÝfã´è¿ÏPæHæz½È.V[>˜¢ÈñH|ôgäÏ¥ª”ñÓ/·Å³w®\)d¹.>ª=Yö_Ëmù|A5w›Kff]7ƒ ƒê—8•úÀ„~<™„jÙ6“fdüŠùR7^Zˆ•¨CN9«b“,ˆîQ›gçΟ‹Ÿ TFXâjqAqpljÇ‘Í0´!ü bèfÜÌ]¸oî~‹c4jé*>b³‹XyOc¦wëì–tnîåËO¸Š8Eˆ DoŠÅÇ0â²n\$ÊÝQÌ —©Ë±dIRš`ªÝû$q|LÐ*%œÑÒÎÀVÀ$éü `70ç¦Z¦½P./e. ­„&õ’†–;œBÉ‘’Xjem*‹›»ÍØj£M¼[¾ú½VzÃYæF6¬ÿ³ñi•8%4QkáÂÿÚø@îD  ÚÕ8Fá÷ªä”ØáZd BYÈ"Ëù´LíL#Á ñÂi¼b'®#ŒJÈષ)øþÅÜ\¥™‡x÷âË-N¤5^•qῈÅ|ÝdÓê;{¥Î öØÆÁ}¿G|ÕJhÉ×Yp•Ùô„䙳\Þ§ìNb¬…T“öx;@ê‚xwúTØt6!ám·L 9Rc¼l@¡»$vwmf‹83w¦4[C=Fé ñÁž›—méCKÉgb³ë’ eà»#e^Ñvªhç·šór'SBá˜áT±n/¡ŒÈÃDÞó|Â{UkŠt^Wÿ$êxÊšË|•ÄS!©Õ>—Îf+cHƒNž¦‹OwÑçàNJ}C&õå š)ƒý¬l"‘aÐ$JÐðtóÃ8c`ÅbÓÕß\*(^W˜t Á4ª´pûÿ8Ù‰mïgð^(;oæàN—ǵöù„"Çå´¼<8Umâòî…’!ñ]uÕ‹~Ú9/=íiŸÊÂÏ×Óõñà5ÇHáV]âð5#e„ЪV(‚§Ø½¾•ÈRïqA* ì‡ÔqhœÁ)Ì<æàÎ}hã³wJòÁ ‚`tI3 :»©Ùõäù›´[Ü,Ó’³×#—¼bÝï•SwŒ¬³NjÙ>RÆ tn¯{ðõC[­rÝ ›||‘v×µòB{âyxÁ=Œ ÖþÙbÜ[œ:¨ûœÒýsY§®XmutOv“ô-WœêâŠ&‹ãûù±n5¯;Üí"&ÿ h´6Â+,$‘Ù_Ó$Ã}¹(~¥Ï7Ä\ƒŠendstream endobj 16 0 obj 1050 endobj 20 0 obj <> stream xœÝ<Ér$Çuô _ƒÕ£P¹gJ'‹!ÓtÈ4)Žá|±Miª!¦Aú êƒõ^.•/—j4‡t8Â1‡ÉNäò2ß¾d}{>ì|ÂñÿëýÙåÌùý‡³éüþìÛ3æÿxÿ»ÞŸÿö €ŸLŽBj~þæî,Ìd熟›É“°çoögØîÂ97:g†ÏwÓ8I-ŒPô™aÖ‡Ý4™c\ O;fljs3<ÞøÜ6<çæµ¬œÓfèŒf\Ú*'‡Ç‡uôÿ¼ùÓÜ£›C(¹­pÚïÏÞüóŸ‡ÿ±\òÉÀÖ°š˜&)õðÞꌃö|»»àpÁÝ0mkÙp•º«Hk9ìŽ3Õ$”dþˆ° Š pu9MÊ©0&ö/·yîŽ5­ÕÃ7d«<„.CfÞ ,vÄÞ?@¯pNÂ|‰ƒÓ"_ì.àp#³|øËŽÊáäáØqÓÛ^Õlønǰ»À‚"ÝŸV»›Q;‘.έ8æL'¼ W'¹(îˆN8„C3©á0Ó¿ÐÙ…•ŒnH7™nûŽ®O—|áa<¢ÒO%,×¹ýì1?İ\åѰ ’›àb”Š'¼¹âÚ) ¤ÏØ0î.¤²£¶fxãï‘k#9\;R”fzʃ?â ¨Ž¢ënçFe9ÐüUp›ëz<®1áJ€„‚}öórU¬Žt„d牗m %~ðG¾Hg¾`bTRºpôGÂCw@|@PZ¸aOû[¤yš£‡|S¹ÿgfõ”괾ϔ—ÊM_zrf‚²Áô»úx-7™ƒTá æFg&æÅ ãg‹Ñ)gL¸À3ôFðá?q) ¿ï%âr2öü¢˜þsH1Ÿ‡"2·Ñ¿À½ „ɬ@vê°`¢ºpñ@§Cƒþ•· ÜÁÕÓç>ÒôxT#›ÜP²Ù¨ñoõdЛH)i•AùøO‰ÀÝó©Dj%‡O¼(Œûœ kQ–»F‚qf¾Ä­U w"K«P`%k”¸ÂÃodï;`Tø»Áu¶²½½Çú®[¾§\b¨räRUb%#„µ £|V϶ ˆá§ l«DdÛžñ*…Íò8`˜ïË‹àŽ't2ÐVÐ&l´”º/ g•Œû'ª«ž‰ò#<]"¨¢“Uªi4I~yÀø¦òÝ߆1p¿¥$B[ôœ¥ž\ (­ K,¾ÄÍe);×ý¢D€>„U°Ý!NÕ”’÷„íæ%ް…ºZæ‚Û(#'‘CÈ[Ê+æ(Õ¤tGH™‘OÖÕB꪿犵yÚi¼Ú§#sB£Jæ-™Ö9še \u6~ôl %,Ó²8°Ö›¿‚rS AWå¦DXî¸Ý@ƳÂdÃKŽ}ì÷‡0ZFÓ¸7ú†XÇ*‰ÌÒ` jµÅ½ù&ÌQ°éʇÞÇÝA÷5Óû,ŽI/åŠy™/;­FΕ@ Ä5‡ËÕ›V Ú#@% Œýæ »¶ŽFQ=Ç»š´-F ´,Iiãâ[/§ÂbŠ€†“í ËO•šŽ ;0Ö~ßCìT‹ä7;׿o¢(Až:]ij¦Ë«Õ¢C0ÀÓ&½Òö27”ŒÁùˆ[ÆÁ R@2TI´˜÷K¾ £´•Oæ×¶ü,‹…/róa€Z rC¡QEÖ=Àû=Ç«#ã˜A04Ê8=1.T¼"¿A¥9åe\žCnõ©àˆ²(î}yê3 BÙô%^—ê«Ø0Že\ô ¸ v¥—8ã`#Aq–r–Ä1ËGHk~`¨âPZ«Kõ®$¯µD\ŒH™Pe¬F{ äñèN',÷¼±'aÅ•J‹tK2˜,=BlZÒåY› æžHlYˆYŒL¥Q·ñ “)‡ °÷ò@8ù>ZZæ4eöçlR‹Dl(¨áÙZ›~øÛ¸HeÒ™û o¨ŠŸxSDÉ·õ2é¨Dç¼Ë» *ÀÊ=˜†#W]ñ© ’$‹¶û^ ©ï«©ñræÃ¡0Æý\´FhKº+½„¿’‰-Ë‚¬XACèÓÝÊ„ÙöKÜΘ2”EÆ”}\ÐPÆÛZCJGŒK>éQƒï†"ºìþ®å«Æ%ÀŒËuZ?€0­lÑP†ƒ‚›Nû/È‘þ%”¶ªëJîuŒƒý†_xYH[¬HBÍÄ$ÚŒÞó!¡´I¿¬‘ƒ¤HIëòÓ5ŸûPÞ×·i¦Ü$£› dt'͇$9˜ôG7HÌF‘LeØr䜳u)‚¤Éo’í¨ðNxqÀ™H±ä‡‰B».¥á$*Û6Ü`ª:½¢ì¡Ï#$ZŸDÙËK®¦¡È“ßo8¿7iE”_cô„ËÄ…P#ckF€¿–®øzsEâjÁ~ŸÈ­+šÛøÈE ë(ÍE¡!½ÄÖldäú'Q¤ Q[E¯Ð»Ðª|tãæÊrnÕÜj£fTEÑx0ô‡<Ø’‰ ‘àƒy+[B3Ë'8ÑQT"Òòú ¶6Á\DêMr¢«, AðÁæ rpKRí£ƒh·S@TØÐeˆú'ˆAî’bdÖ Ú1:4p‘jÙÉ ¼½Ï)9pƒic‚u¤O äÚ 5HSék¸MUùe ›Då%….ÝÙ¾+ÙæÉaÏëˆÛGßÂ.$xº˜ÒŒº#¶S¥=w#X¨óa^£µÇÓ°õ«p1; -ÛZ”»ï7f)ó&ÃÛ{pja‰¾rEí¸¤“¥wD­í‚WiÈ’þ³ Ò‚u©+6ðË£××ðëaà ÈIð¢Ê=øî©ô[éˆ%AìåOZœ‚È\ËÊ,õ+Oî¨Ô«$¦~J [°]Dþ]À>Z‚Ô5«Õ~wæ³$é¯ÅZº’V˜ÆEÔæj›¿ V˜O„_=zGpŸ3ÂV,SÄr¨§WçŒÑ™l+¨¦÷wßæçüˆF ª ´u– ZѺ*²áKßÔéA¸Æ;£û×e¦Øú›¡ïU—Ï+ˆh!úÑ·}š¦`χu££1:ŒÊŠš=-bïô7}¼ÈQ"w#ùêü>p º¤Že¶ †°’%‰o…HZç5Ÿ$˜ˆÜš®¼2ç»[k+H|â”ÍoƒÖž´yÕÐ 9³–7A= ο~S³……Pðj £ØQ ‹E%o¤§}n`î””„¿©NµõµßDUËT~Q ˆÏ2›|‘›ŒÀpÿúh8´2“æ*iwrÃïI¢µ0‚7\Q*C_Ò… Œ]xÇ™T‰ÄÉ1¾&‘7ºçk! ‰±SƆÕÑ…ÅܯBÕÓ5s!I‡d”·dÄ¢ä[Œb†“¨¶Äî‰&‰7ʦÒ6.e‰†`ŽaÞ5•vÂÜêïØðš&›®;º¾Œî#‰m?¤’'M1DÊS‹É€Cï‹`šEV­q ºUWTmá"<®¥%È6:VÞ=ÜR–Á4êrPE›®p¾)úéÀ§î1+ # k‹É\ýZ¼Íˆ)$:òœÀ4”Š|ò‘`¢]‹E™ð ØbÞéöW­maÀï)-^¯)2*¨ø+däòAp¼ˆšm8Yd™›l³%Lkwª}XUàx2)Y—¬ô¦ò,Peú^Zƒª’ÄÒˆAò0èP½âixnÚc ³à½©áߨ•77ÑÆˆ®C,ÔAXÖRÕúiÖô„á÷K¤9ÊùaÂÌ8Õþ"üéI°2”îÅâƒ6ÐýVxl3—°1þ&€Å1Ÿõ!—ì´°Èm˜ë€-ŒýUNõäGÃ"e-èL‡»¤3“0w­çˆðR²ºÙ$[AÝl}³®Ñ?bakÐSí ÐÁUŠ —J­+®}°¡×¾û%d•bªÌèÁÇ!VEqrЕ²E5îjÓ9ʺ°V^ëêðv€Lœ’fù ²™ [Þ…™“–GmTp„ú B¤>)éV— NŒé…LnYó5ã‘€BWIØÓú¨cô1Á¯e[ß(—£Åy’óU ×€[œg>@ÀeIMÝGƒ"D"5‚%FBÌÜÀ)ñ ¥ïÕ­ (#ýý¨ÃÓN¸Q0íµ>º¥¬-I£ó®TŠ6ù-s9ß'T¿Ð\tJ4€‚<˜¡nul!?‚†ê6H¨çgs{L áÀ„ú9®øJ×eÊǯlEY)UY?±–‘jßzÐ*ŽóSã+Öî|?Cþùî‚9ÔÔ¶1ö™u :Š"ºõV¡æpªžŽR˜_}’§xÌ fÂÛ´[à!Ð/„¡:?@PùÒ( p?V…›ONÂ¶ŽÆ>n%B©\wÛxgÊÊ#᪵›¬X¥<=.µ/Çö8`?3ã1éŠB Ê71Båñ–$nA”(p@ 1QÔµÖîw(–Íðã:$f)õj“k¹ñ8œQ£€Ã¦å±@0öιy›\äÞrïX÷úæ˜rïUwc²Â}îýÛÚÛ{ôWÛ5"þwrA!' Ãr”Ê—hw/äW[9Ò­8”·Ý 2(EùUÇPaUG•׿¡’©ðŸ3ÃëÌ$ MÜVÖ:®§y˹x¦Õ=l‰µ¨a#3ƒ¨˜t÷‚~Vé_ð%N*(æ|dK—Póê>º- l\Wìq w‚VØ:ñ,K:¾Ö…f‘üý€ïò€LÇ(hÀî™ÿXP£Ë;,HCŒ+?‚oot¥DGªç*l}Ìò5^ôK·©bªê÷ô`©’ü~qÔýÅO‹˜‡ÑVžjpP;l&Êê!€i\És«Á‰õž961Ñ5DçKæ'냊\Û£œ¤Ðûc¯±†4£TkÜù:SþMâiÜ÷>eúzŸ{çܼÍ͆Æ}¹·W©lGÅUA•kíƒ"D-¿íò£WÉtYªº6ÂeÐÆ8Ö–•Œ:AO0z3iûÑAŽ˜ZU£«•ßV=Y?Ñ(6SSË«qtͺÐÅWNÕiÑUK}K¸ó¹`BÕjQ~¶6½ë'ÕäR Ô¯AºHC`«á27¯3½Š•èc>P±½ö©|Ÿ{Ÿk™ê{o é¹ú£ Tû ÊUn¾«å?®Ù+ø‚Ãæ´n3Z3kαŽ`J ~ ok™IB S ûÇõê{÷®ÐpÖ‰õöµÎñ—R+jCI¯õ!ý{¹—(°%÷.ÇT•¯3—Y&Ày4ôØÍ `+Uà<¹B–I]TR¢ÂÃ+R\ÇH¨òÁîÓ£M˜vc8!,dxivœ²þ«^êzTE,½ü‰ Êð¸ðghN¸Žð¬ñè{ïj‰OøÇ7Ÿ³Éñ´«È~¥ÊÂ-VàÔŒ¢H^w›$ Q¼þÈ‚‡šjá?fàÚ2ý$éÃ7|n„¬øpìWÛE’Ø~T9D?AØu#°»§Ö7J³R5¥–GãJXÏhÍѸV,´$b¸¨úŽ¡²SÓ{”ïGëÍ2«-E¸Âꊨ¼Wf~óåZЋÓ* ˆMq™é®¡gßlè™Xé¾÷>7Ÿ»†—w?PMœÚÚyÛ5‡–ÜÌîAÏgf´ë[>>sfÈ—´*¡¤Û?ßk Ì²Vé¶ÆVs*>´9Í<c̦ µ'•b‰TªÄ!yßxh2_mÚ§®ÕÄR~LñÖQ~®º · a´(ÅšL"ؼÈʉ¸u]û`ÃÂøá˜ÞWjœl.nÚªÙì+ſ¶3[¯æÂí¥D¡>äÒŽd_ÂÃ)öÊ´}¤ÛWW,?{(…r{<¯üè;—ÎN[ €:¾Mµ Ò3õ :gk·GcBùݼV¾Ÿ oÑë‡ à€· ƒ„ÿ°Æú 4=`ø asÜHS|C)?D _SŠu‹øRáë<¶xâðD†“— oäÄOyà 8´Â~ÌÁØh¬øßyÃàáÒõ«œõ ƒß›‡W…ضÓvèê6¬†ß:8­ôÓ/Î|®3.Ž:2¥6OŒO³5“ Ô {‡°†¶›I~ÊREÜÖ©Øÿ±Ë é4èz7ük¾ü¯£GŒûòÄ»q[÷øæk^æ´Yø°L|ÒZ—VF2:1…9õê߈Þòݰ$~Ç©¶qüݳ&–P*·x¾R¹}Ó·,‹ï²øEƒú³lá éåÙT?ÇM ëD?’+«Y«Z˜ÌCÜ-´]'/åwஉhõ&øè'²†/…µ ÖdóØ!Ó²@hõI3¼)¢ûèrm%=«Â2X[ûõ†ÍW LJ=ֺʂ8%Åzf2ÝVR`ÇzSìáJ§?a÷ä¨Õ‘hìtû)ÂÄÒÓ:~³žMŠ\ýQéÕfV“¥´Nßo¼ì>TÞ[z~Y@’á½RìN--cT[§Ô¤|o6*„î÷æì+°+À`þþl:ÿìÌp°#œ¯â<ߟqåøús9ûzó{ö\/c”¥Ÿ{´9)°µÒ7'Ìzá’m`G§µð3¾ÐòÅÆ–aöÁ£óm˜1ë~8¼Ï?~}y‰,¿ŠfîÚÔÊž 8øìkï ’‘ƒGɬH=æ?<íÐã’Üzò brÖ‹2†'8Zvá“B§r2“xõße æp D©‹ÓÄ*=™ø²#ØqŒ6“ 5¹qU$p'ãÈ' ¶Næ^2ÿoPG°ríg¨QÀÖÇâÇø ¢GÄsù?Ó“?æZ¹ù(´Ê_­×WlJ¦ ½„ùÒfÆð|•סã)Ðñ—¯â{=®ú%ñ)Tb­=ÁÇsÿTÏ„V)•Ó³Ò™døMÞæmÞ†\vÁûdKBp—™d P–×ïtå!ýK’ÐOà!úC÷öŠATXd…Kzz2˜ÒÜÁÜJ¤jøx³˜º$ÄMðÀ›´+'RRj©ÃHðã‚~jXPÙ‰w4&ÏÜXP†ç!x=€–ø%ޏÊ!ÐWι¼BÜ‚Y”üüÉ@k¹~1àµÂ*CIƒrÖ‚‰­#¹û;$rý>Ë“ ïhKr>‡Fe EñL éíÄ@ó#¥+ÿ6‹¾ß÷¹š€Ìc4¾[ý!Âá×mÉ¥¯9r7ŒY°¤“MzçB /‹mÛ ÝO¤}™‡,¤û‘´¯Iûª;¼ƒ0…Bйx¾˜¸ã+Ò0–ù¶FÒXïˆ8Us—cõaD¸âÜ=“ömòÔ?WçÒOYýæˆë4Wá#žÄ’”‘X¿ï‹!±RáK~‘#Òh‘¨À÷.DKÅWëL™y{÷c ÖØ¬™È_‘S†Œ_¤¶÷õMøæ-q—»çÜüŒˆÅ.¾ÿ²¿È!w_·Ñ; 7’[ñî C2¾†9GDöþn„ÑB4<ì/ŒÈ²å€5óx§RÅ~¿•ˆ /*ˆÑ]6Iñ|…Ñâ—á0€–AŠƒç+§íÈwàÕaĤéo,’¶Ð™ÜGúo6èü)éÜ5Ö‰»â뉑õˆm„—šü»ääԡ ʈð/±_û3Z`èU|˜<%ƒÄ£lö߯ó_V¦Z“0UP¤›ˆèä5v—ÇZßÃ2Øù3B´#QlÝ20|2‡æÌŽ(ËŽ l{ò«³½ô}endstream endobj 21 0 obj 5890 endobj 27 0 obj <> stream xœÅK“7¹Šãžá>·ô@¦i½% ¨ àâ’ ì…Jr°½öf’™µãûßó}’Zú$µzgǸ¨ÒÖ~z|ï—4?n¦‘m&ü/þÿùñê×ÿ4›Ûû«is{õãóÜÄÿ=?nþp ðOÆF§Û\¿¼ 3ÙÆð™Ü8 »¹>^}=ˆ-¬*˜avásÒÊ*ë¶Ý±išFa†/aXHɆÿlÝè¸sËí&éILvxƒš)ÿç´Ò>9ãÂòö'Ü@±I ùíõßàˆÎ<ºÉùrü4›ëϯ®ùõðï-ƒcZa‡W8K:ã¤Þnw§8><Çí¤sR Oóç°ÑX3ÜãÎrš”SÃ)€XË%œÆ kõp à“pÃé»°Šá©q«UÜÇÏ$ûÈöoÉÄÙèôŠüá ®ÈáOÃ32ú>ìo™‚-™DÄØð¿ü /ò&a?c&öSð1œöwdµÛô‡@^Æ(}™•£æ¤àú‡ãƒÁOaœ^çÑ}þ|‘>ø&øhãyÝq»“NÀúk$´àRMrX"®rCqüA×3IL Drx "¦,w=æõ¬-¶!À÷ÌRÇÁ'®P ÊŠõh/Ì»+N Ê3 Lö¢%œÊ|åÈŒ™ÖFòe„Íp ˼\DÝž%@÷Î%”ãy¥’w¤®„aq•@B‚rxÇ™g›£RÂÖÎ5‰¤QžL§·DE‘Ö“I–%w)¶•b¤ñ#]tO¡P¯'9 B+bÁ'3ìAiÃ8PŸ(ªŸ©à˜²¤HSã4{G‡wä Ôl¼X ²?í·\ŽFh0+®'‚„‰ßÕ|‹„²ù·jä5ºÀŽU(Äþ–ÀPøS€—ŒŸ-Ññ4q¢ÅFâu‡eµ­Sƒ!¦(kB0`ël=<ÆÀ"ð2Dœ‰ÈpkxÃxmxÓa?Ù*°±ÊÙ ¥À,a¨ìG©«~ 롾Ð 0 ß dí/¼X*PÿB¼O3µ-yKÏë ±‹”ð:'eÔ¹yŽ×-X‹KðŠLDC(ü2°l’ÒqVž/^dq¢a…†æqàØ³R4¹šF­JÛ¾¿!ÿ¸!jHvº‹+r1ì_†e8÷ËL@*ƒ¯³·ÛÏøûûð­D©Ä9ÎûÄ>}#)Â"èó;çXX.êögêšH$\o†ü8øqʪ÷SaÙ‚¤àů"K¦4Jb*bªGbàãöÜ >Œßl½”1 D0®²ì%„§ÐpnIY ªh”dŸâzz”0üžÌ¤6úmÜrr…ÐÖ܉‹ŸåIpE>Âêë\PV«¨/l ò|³,W§§dªç.L¦ÿvÚ4.ÈOåj) &¡˜ÿü!˜tfÁŽ$›ž Yš7é$1†Åª8¸±ÊTìë@8Ê“-„åmÍÎøMÖ\àyvú¸¦Òòa;®ÀèÊÓ4fMÈ£RöÍfO´ì †¡áZfÑOˆJü0F¹"=é{ ‘,ŸÄðYv³)V¼¶fp£d‘Û,îq$VžÐOg§d[Û¿ßfËÞ¤„^»çsˆÊSnÕYü ¼QÊ’Ø6%A¿Û¦,)çC^Dâçi[%LöMý}þäÿûuýè¯ÒçB¦Æ˜ËgܨSìÙQ*D ßD· A¯·ɵ&ˆ2ˆŸc]!8JÑËmn"»¤òDÊaWäVQÕØ XŒ[HT¸ Õƒ›~Mƒç𯓻ª9;©@_¥9˜ó²²‘¿IAƒÎ¼ ØÀן¼ü‚2À±ŸæíÉÒy4#’Yƒ%A,ÄÈé?€jΡÐÓ-«NN2»ÐS“G§œTbGÒíLæáŸY‘ÉħÄ=ÏQpû‹ ü–nôÛCâ¡Æ3ú‡Â¼-¥ JØÏX ºÞ7jø&윣|»3&gn4ZûOÛæ.MdæIð§té·„ Ç2&Ô 8¤kh¸¸3|OÝNíÿq#È$NÔº•ÞÁŸœqÖyÄH±VEÛØsßÉØnâ Ö£«ìs! Ìä}‚ü¨—EÜD¾€bU6ŒÛóØ…¹™NÕ”­–YJ<;Ïó•¨QsF2M¿ãE÷´ €PŽÁ¾Ïˆ- N)¾¶NšÆÍÞÈFâ¡åÎû@máxa“_Ƴ1 3ÆJ4u%A̾·Ñ¾ˆKs–HŸ2l¹#v¨Èk#¡dn)hòP)½S¿ÿšhR/Úê ÌëdÝDÙëZY`ë3àO2a+¢“˜âÔ»5ß©&Ü¥¸à“Ù*ˆ 0c#è¾ÏnŽ&ª=K@°M¾RÏi½ø_eœ}¯użø¡e/52gN‰‹BÆrÌ™á/Y¼;Gª<ÈJC– (jE%2Á\ÒµãõúÉõÕWW`7?]M›?_1`0f£0\—bs¼’«¯"®þ¡ØFÞ£Õ•F¸f£ô@½ÖJUÅÎ · ”WÔX í•¿cqÐjßɱlëÏ(«u„¦r§ž"BNb¿yàBô„Ô`’+ô0vX=NY£k³´(êOˆ_1é™ïÈZãši$ã™$üÄ©T"â•é,$«ŠJ¸_`Ý*Í*Ë2Ë„¯AlÔÄG3Eš‘”bÌ;IDÔ¡ÿZnP7trÎQKFÆ3‹Ê…h ö–™‹ðœímÁÎ|6Âàt¸Ä)«0R$œšç=æ4ŒqXÓëtîǰê>Ã’~ÚÓüù|‘­Ëé!Ù";¨V0–“Æ:«\LFÁHd­$åÁù7B/Qõ< gß=ZˆµXBdÀoJê`û 2G7z´ÝÕÂäaïóèš0Õœ^¦/A‰¦Y¤.!iJÒ]>ACÝåyñhñIHb…C*ĘGVq–p5 9àbµqùbÆr5€ÌjÀ·)Á/B7’ß¿¦;Èòïf‡nÚ:A±Žâ¢×gô^'ø2oI ©¯ é|IKf½¶À]Ìö*4{逴QZì{ âŠA¾e{}ë# 1z´ÖQ°¢-O,uü;ý}Xfb®›•ìIËã6îZT^ö¡$ HÄú& Wv¬žOd;uâÆýSLl¹FZò×WCNE˜Ê{:wÕD•Ù=Ÿs=J¶o¶ ·ªdG)×^•K—ÕS°lJõîlœSŽm{”± A²ÿꢊ€ØÝBŠø¯ ÁùH€ŽÚ™eb½SâÁc-!P°¬%&MÍec]”;º3g޼¬½òéÖgbcØÅ8U­ïˆj‘NH+sÙ26Qt[w‹øZogå+Wª¶±"pÚ†ZCÙàÛ7•¯¶…™ên8ÒCvj†ãJ‹ø³X˜î‹˶/¨†.^‹uÈ)•[£Ú-^å< MëÖWÝôù­[fÁ|óÉà›l–TÚ†²UØu±E…d¸›Í˜D‡=X·JùµZ4— ËëY÷Áj_f¶­2!Õ§î­£å²|ç†\áVæ¼hº£EÓ92}•‰­)¥ß«L\©=BÊ, PL=òÇÕoÊ_\¾ q8DË(­]tˆð[rˆÓª,ö3b±ñ®*÷%¬æR’¿²?ÓZUÁ{%vZùöëô¯c w¦„••´}h2Âwoï)-ŠÛ{YêÞo5¨-`ØÈ'·Ö‹(ˆ~/:ÐÐ]`7p¦üyj4Ì^jp%X¯ú¼&YÉÄ OŒ,ë«Î•øÌFÀÏ—?=æTv(çö'ê0;ÍiÏ( XÓüù,©©Âön¢OÎËOË Õ´CÌJ{'3Z=ß׳²|wP™/>Ó”¨cš„a0SƒååMä/eM1äåÀ‚kÝšG-°³ÞÜR„q9Õ=¹.ùyWÍÏPÊSÕ?…Ã+¼!p¶^Û2.]¦B¸²³ªÍ34Z©âØ„qE„Xg?éúZºˆnRY §íÅ„¯cJbšcŽN4ÐMOnÃ6L™æÒ/È6e{÷½(#%$^Áîu>ãF@7ê» ô©íM 7•nÚ°‘þÛÓŸ@­Ò™vºç·D)Ïa {•›ÀÙŠÈk©“c§æ¬®¹™Aú¹]8_žu!­æä-´ù¦Äé ¾w1•-Z:«=¾Òn4Ž4ùœÑ£1¬Ãvßñ ä²H#XuC ËôF`l–û˜G„ÂÝ=°ap2XJ,8ý;{Üj1jŠa¹CˆªG¼RU`ˆÍ½VQ¨þ<ª¹çŸÅ<ª¹çÙ ‘LF4Dg©À7+ªŠ8RHÅdaŸB*8Þ{¸¨à¯9Dú°3ã°d¬NÇpË×™CyZâ­ð¦øïGI9 ±ž$cr)`£ÓTÕùó£4“8%b‘»Xò‹ˆe¹á-±ü§È ±H À¨<ªó'Xª¢•±„+‘º„ë,,ÜI|DGÅçÁÿ/‡"Ì䋜µ™¥ÇäÑ©­›D8ˆLÚ|”Ð,+™V…<]D+îø(„]$–?ÇT‹A•Ô°dT/Nsµ€ÖÍ´ZYÉ4^OËš/}Ù`Q sst@Fõâ´‹ZÍšÏEÉ-´&r4éˆÅ÷Å–èÈ<ï™Pp8¬ Öè3±wy4—[¢fÔ+¨dæâdè;{ÚÌÀÆõËÕÞOô~¤x]šm~ËY´ï—§}ÃU¾×ŠR õ|ßcâ­àM‰…Ó|è¾›ŸohàÏÌõU÷é1\‡W½]xÖÑÿ-‚ÎÄù÷Œj0•Îÿ`Ç³Ž˜3T¼Ð†Å”Öb'ºùoãŽÊ®½@ÁÍuï…OYãõýnF«Ò•ªú/2Ûµ¿Á‹œ¥¹Aw¸£Ê³cø[? i;æï9°°ûÏ·». ½T qŒ™Í΂QNÎO€w¯3II¤ú‹2³–|ßo&@¹~.®¬¥æ|dbŠjö‹tªÂä(Á=K´·2¢~Å(_Òl\ïa–8V8Jz{±}…^«dºy$Û¶ vÚŸ«©mÃy/Ï @“"T¦“㵉6À%F”f›1™dVÐâË·–¬ ªihØ-œ‘iß®9SçïuÆ^XÞë'Qÿ ÒÒ}GIèq¤«Bùge²gϰtº›#5¥ùø‡Ðá ôB¨ÍNªÚd*™÷YóWWÿA»tendstream endobj 28 0 obj 4513 endobj 36 0 obj <> stream xœÅ<]¹q@÷Gøáf m_ó›4ŒCÄ0ì1|Þ$ì{V+i♕¬»³þß“œª"›,’ݳ³½§;èA½5Õü¨/Öû¯›q›ÿ¥ÿoW_~í6o®ô0šÍ÷Wãæ7WAëAŒrãÆ -6Ç+#œBÈÃÕ#–6Œ‚¬ Xã a›·W½4ç&ýw{Üüó Ìë0„1ˆÍÍ›«¸±‘Jà † ƒ±ðÓñêOÛÝI=xëåön'`¶ ÅöÓnF¤2bû=Ü]ƒ Á{ ذQíÜh¶ÖãhBýQBЊƒ¿¹ùÝÕ¯o®þp%}°ƒVl—„ïòI;ÔZ^øz‡_Ã2Tðʸ¸"#…qE ü-Ûãá´¿g¾Ý]K3ÎlM/Hë´ÜrŒ§ £\Þgä0çæáûœ$° ú³’ / ÒèÈ¥(qžZBÌ‘KxÊ Ó V$rý ¶ ¥rÁn=ê ÌöEJz´£Ò —UAxQ º<þª<ÞÜû=µôø±à~•¡½ eª0©ZI-¼h©½t2(múÚŽb^%ô›‚ËFPÍk(ˆ‰Tí[ßdh/OyÏLÂòž³tXÛñ\^ð=#×È ®Ôeœ“æÎÉËÐÊ AU ú¡@_èmÞèW³³­ðµÐNPéñ~VfM‹ÀÄ—-§EèÄ—p?è9ñÍLªz“¼(áÍ&%g' ”ÉìX çŸƒKRË“L«ñLÔËõöºUR‹³fwmÐòk>VQ¦^ƒ2Ù+JdÏúbàAk®Aé½$-LÆôƒ²Ó ?o‹øŠV: *g¡õ%¨æÍP3+õ–s'#¸JþÇR‹LùVQžNyКë9Ê·j‘˜@àÖÂ#†àGàŸw³|Œsº#O>¯i¸$åsj`™íf1øCÁZèüa“YÑ*Oå¼pÀ w_"à,»Æ9v9L†ÁY9¥¢c傆eJþ‡Þ]Pz¯,¸hx’íЯ§l4£2\´Îoõ^F×"ù§ûˆß8}zû/ˆ"µMÙçc¾d ”>þ×Nø¼ì°ÝsŒwq¸Vø4ž7r[ÍñÕ(a²ÖYn|]‰`Öÿíêæ“sK[Nî¶òšÖšvvØ]+é£ ‡röuÄОŽÜD›÷»B¾#)Lð~û·ô¢•ÛÏFáë`ÏÜc~ˆƒˆ1$lzñžM_ÖwŒtD·;Ql[¯£|s ÓÖʹOCÛ7<óœöüN7¾¹Ã§4RÐÛW ç.‚•j”2 {.»þ¾ÈÌþôn¢¹®¢¾®ý‰sc€3Q‹A ½ý§2ÐÆÓÝÅ LÄ`áp77¯Aá>âDí¶§¥x0FJF9A:×kH™ð] æ ÜS{¾`¾‘# Ѹ˜D{=­öZ¨Áâ¢?0ÃÀÙ–deÔoz-1 Uõ›vh<šHoŠ4+ 'ö ÆW þÄ#Qt"ã3NïA.¿(ØÙ( ä ôPͶàx%‚4ƒÈ€'Îðþ`Fèd¢ÍýWº.]%/œN‡Ã{Ê€WÄå´–c¤˜„‡Ký§¸CTŒ—‰¦BžiÄðœPUðÝîåt@ G%·71Š×fÔÛ9ÆŠ¤ɰD3ÖBm¹½© Q¤’°[ º`W^›*qÙ®&’·ÝçD%— ùŽÛFÇÔ¨••Û}g–"Îë¤#‚“ÙùÇxÄ’ö3l6x«j¤¹05Ò\­“æVç»çÐ[À½~IRwp饔’1V*8ŒÊ;ì ‰gW:Iµºá±mz®$½äŽ?NlŒžM émò @8;öGöò}ÍÊ,Ò‹çM£T4¾¿Ä ýrW,‡–lôÆhëAdÁrÀÙ'À1Î4„QQJ £Eû2A´=zº}‘`Œ‚´ ÂéŸ<õ¬€™Ù3dåØy0fõÑ9[\ôJ>–yL2´:õHÌ%²Oû̲Ï, nQÉD‚T2!ð7Ãe‚ü·°&†ÓJA4l¤Âà4E\1iÃ^U %Àeg£#à˜zélD‹”!+Ö0W¡ëuþ{57„õZ Þö2Ú§_ä£pŒcÆH´Ã¿(‹4¿,·K«Îàm„þH>iCfvјµÌÃw˜c6-£Ë¶Ù:ݯSy瘦0[+vÏ`6Œlç˜Ýrr³i‡ñ‘âï¿·ûžD iÀDÓzNÁàUÌrêŒ~Ì*Y2q[áú¡ñÀ±•Û„ï­ª¸hܺ†!1è4OªÐ´«:µ¸:C‹((á'HU ˆ ÐÈJ3$\µC‘“WeAo*ÙÀ9T4‚΋ÇlmFÙ·‡áç?- ß+e\UÄ%¸,nŽïgŠ8/ TN¥©Ò¾6£¤¥a®3SBÑr´ƒRLF4Ä„‹õ2# lNHh¯Šº¾©tôœÌ•0ó[ï1éxákej¿X;‘É{nÍbÁÈ0<è1LÎ!%Tþs…>C/# ÆGR11>þX"ŸwÝ*Ák¨B÷4ç«` *8)µ‘ Ï ¦Æì|˜¡eã«õ’‘·ßÊ ¬K ³Àj‚¬ª‹h£)óuó9ë"lÄ¿5 ˆé™eÜOSVeû[£_²Êw%”*ñ2—X(–;Kbœª9˜¢yóVääƒÉ!Ñl¬ qJ¯YçåN¥*ÂStu®ßTVMÙCðSÐÈ®n` ø/ÍC¥ÔdSBÀ±µiS¯¥N†¥ÍUÄ!uÌWǵD~Ô*'Goé©ÊðóÊ´4Ì›LvÂý"Q0ˆ¥íEÙhZ¨è²Ñº‚²ÁöYÕ>i¿_ à4çX'ëö\PRÍ&åg±f­…¹a©Ÿ¹•™º˜D’Õ'| "eÚl'QÔ/lÛø^Ê1\Sª—ò®dCÉ^¿À¤º¦Ló}ÑÃýáŠ$*K)éß]+§y:wIûRÄÇDiPƒêÞÇÑf5ª6MÔ•zj.óÜr~5psñ¡Aù…%·|å\„é¾Hû)îÍ »PÝ<Ü–ço™–ð4qS%Ãz!z™êÅ}ÚXÐ#åõm†³n®MyH•Š •ÂÑ>šê.5&)ýd&žÇX2ûÓ¨Iü.ýgÎÃd_@‚//ë”Ë€•<ìz¬i¦Ô•‘‰¸¤ fHr«]®ygçÝa©nÑW´ãA·Ç:‹þ62Å:|ÚY¦Ûa0y­ ÀVn¦V ž¼·ú™ÖG Ê\,”8§«jtXm npÎ÷ªoKù- òa~µL›öÿ}Ò§¦.ƒóxÕ;qÆü'®¤0É-.½ò`HQ¤œ”“¢ÜÅÅZ'Ît†DÚ;~°ð9:RE”z¶a€oÁááº\ñŠ+ujŽ-~È|ùµªK2££|Úä›òÞœ;bð¦CÆfiˆ¹—ð=òPàZ+Pg›Óí5!Áo†GÖï2tn͘ëõ‚¤u¼mWíÏ,» à´G‡l¬Éƒ$ôÂEzËË¡ (½qîÏ8õI±ïIgo¢Ý0HY7g.x‡ aC8Õ”<;ýŒa˱{&Òºm ‘ Âx®Úl‘#ºÀ&ëø£Öavöæ|_0ƒgmO¤J´ÌX°o-sœ°Xæ-3v«íï‹;|™Gd„îJqÀR4†º+Ùv ÿ…­xÚëœë“Fì„®7*¼'a¡ƒaÁÖð%¦æƒØŸö<QÎX8Õ mrWAÉ"=¦­d¿Îi/Tw‚“o|&ø£|ÌÎ÷Åoݹ„sT¡ç;¦m§ï©¢åìcØn“LÝŠ²nbaâûnBW=iç? ÿŠK±—ì4¹;çmæWQòÁbÊ1Ï©ãgA¥ÛÇÙ£˜wQx±éÜoG¹O2„²?„XX…ƒÄ8Ô·]‚Bˆ¦”†C1¸Ÿº‹‚v6:¶Ã Y»Ct!ô­wx¶¢ ÿ»ÀE‚ð´. â.çd†°}NB¡F0\(¤ ô«\%ZIL¨¯Hk0æh¦@öt¢YI¬ð†ŠÇ ë¼HÇ.œK!%K!WyÜ,+™LžV’B çškI‘kó^Α‚Ý ÜŸe0ùyunz’‹¼'&;yO™å lã<Öbá×Õ×`B À^— :!(V`[xìniôCy|Y»[ZMÅ ù½Ÿï®HšLÌJ°VS™n@KË,E¶v-£Õ-ýYÁ}¥¨¼J˜Ò>² ŒÜ).9éµ5ÍMj°v dµç’Ó´‹ð\L“:hÛÎÀÌG'OìÖ“§Ö’°[¯~,³4Q¸°âä$°È´ÎòĺDdK÷§HδâV”øé4J5øÊeI'ÕÞÇ–ÜÔ'_ú¤’wËÓV'j¯–ƒ—M`À3N…ŒÃäÇ,øk·ý[s©êG 2ùÔˆ£•[» åS\øm½h¼! ¬0@0áò½ŒÃþ¸?5É"½iL^j÷®èF7 ðVÇ¹Ô ®ú+‘yÝûÛ´-ºx~ºzS ϯoœâÛ’ÊK×k®{¼LWRä`}Nt,_Å™øgSš9ÂzØ2R˃fËÅp^·±¤Ãrvh²¹Óµ%ÊÔv"|®:íŠF”‚—·jsßÏ_ÁšÙjz#jâÄL(íwzQ·:¦¤EÀ)tuƒ c^ì™Ò]È‹Pˆñ–R \è–®£Tw4jUõ˜ºáºO®ÆÀômÂæRS4U¹q *ΑÖeF;[BÁË´?¹ßQÒ`}š6™¦=;™_íš•lkqK—!±, £ ¢a¦V|ÓŽ]«­JTô~z«¢ûº>å\xñà9¹Ç[ô`\Îéÿcöç.juÀI‚ÕÏjuˆ$±=I"új°A=¿Z“×–Elº1Ŭ_a1Ó‹XD?N«Õ+îÍQ}Ô!ý¹î ~ª®=eüÔ÷ ð’h“Hn}KÌ~j~„,¦'¦Ft2ZU3 ø¹âoʱ2tl‹·)ë*ÝùLt§šÝ ³ÌLR:KŸ$ëE¢‹×KWÛ8vw>ö(Ó€Aó•é¦ÕòUÍ×Eó.ØÛr眿ø;¤Z:X×å¼5] w2‹l–µ†ß`z»P¤#[g±ÅlPŸ*â¨p /¿P›jxë·ê⟀_ˆx þ§ÿæX€¢Ú_¬Ý6jËvÏNX×÷þžž±Žœ lŸÂ6šÂQ31—ˆá"a°×ˆ‹„“X¼]“«¤¯TÁ,Vá'Eˆdåtä½ËŸ ô»òÈÒEåNLÇâ²Þ‰çk׫ðn=Ò®Zoî¯gwø>•¥Ÿ[oÀœ8“\¸WVœyeÀ±v¯äÉ¢ s ü:‹JÎßÇ“{‚ü› {òì%U=\´ß# u(/J<V¹®/ËrÈÁ*ϧåG؉°¤ýŽÉäB/Ýï> A]­ÁÊžužcœ·ð©Ã]ÉÏ&;ÏK%#ÀRžù„ñF,Šà"Ä©¥>¡…ëæ‡ôžmr']ãBn0ŒíFèygŸ–ø‰ŸcœHp1ûÊÙŠ?Œv g‰è&^Wå³5í¦[;Läô]´4óu’eWv®}!æ‡yÎôðÜ ðßá9S)dÂÀoþT ÃÃ7ú8 ½lªxìT¹t c¦æðѪsÑ¡(ûµäåªÅåt&¢ë*"lòU€€—€A¬·ÿ½#æ ê¾éo µ¿+DHé¬+#ñËY:<]*l¤·97Êj!ì>;yXݤ®z4§ƒ’`žtî¦ÅH[ѧN×Dè”ÈžKÜ–ü/I†dÓXÍÑkªÎÇk“lÎôg£Ü—:ÃÓ*ß}Ò§ÎÏjpz»æ=¢s¹ZκkZvçBO-'UŒ~÷퓜Hf½½1 TÎL#C] “øA™”AŒ¥¨ÓÞS  „2Û¿ìp§b Ž{w§–YüˆŒSµÈ²’tûÕï ”•Ⱥ×ÚÂ}]$n-?4-¡MLOÍX—Ù‘ØÒe»¤žã'pë™ëëúÿm†Ìvùâ®T¨:©/‰Âÿ¯Œ>õ–/"a0›”yæ³ ë±FÜ|3wÎú`o똭Ï3íFu”>PÆ–=•cç—­Ï.«UZ6¨íÍÿ\ó¦OxÊM{ÒSS/Š"€?\ý?›å, endstream endobj 37 0 obj 5068 endobj 43 0 obj <> stream xœ½\K$· œÛüо¹;ð”Ko)9Ù±cÀœµ=p9læÙp÷îz¦×öäo$?8Ô«DªJÕ³Õ3†î©ÕƒâGR$%ñçUß±UïÿKÿ¿ÜŸ}úYÝ>œõ«Û³ŸÏXøÇUúßå~õù4`þKçzÇV7g±'[¾2½ëzaWû³×bÓw½tÆI½î8þÃlÎszý%|ÎI£×o6çÐFõBI¶>ø?¸sÖêõ5´aÒZ.×÷á'´ëml/Š­o7ç\õ‘ëWþ³àJs±¾Û0Ùÿþ¸)m| Ù÷Ê©õö² þzSæßÁxÒuL‰õ_| .yoÖoÑ(dzÎÓK`é;ÄÞí5ÐîL§-óL*s¢¥îÞ£ïWh݈×~ÀSÚØ"µ¾.|„Ã3mÛ·›é £ÚŽ3·¾A<Àœ½MWÀ¿ðSõtLýþßÓÄåQà'ü&}<Ο€ #*& á…¿.cïÑ<¸ùµÙʼn´Ð Mî6ªë{«Ô1‘ ƒLŒ§å5 ÙÈ× j6^Þ73tøâ Ô¶ÛœK%:£õúbcˆ‘ã0Mœœ%+Î,ð€¾gÖ3™„É#Õ±Á,ÕÂY¡L¢zb¢O6çôƒ÷–0ö¾¶±+ò!*üµþ¸´Ž:DZiÀÆtæ‰7œ ãô„‚êNI6·E#¯? >—šuZ˜Õ9RÂņ7H1Cv»·.;Ë„[ÿZÔiæÕæœ9Þ9§×Xøýgҥׇ;¢á»ñˆÆÞmP6`~x.QÑkO•cZUq~R‰È:¨úMþ)V©í-1q\ÍY­²ž~ÑZ–}6…øx£`‰ÆQ ¤€™Â=±ÎÃC å½ìt¯jŠÑ´Vw„ñ»uë–‰!<öäZÎAiƒ& š¦²$ƽB ® Xi¶× JP&ÊrÀZ*°57Ój•6)4_#؈Î&!5ø+¶Ü×ÄV¸½Ajø˜Æ{¸ÍcZN8@|´Ÿk6)aòþu PÔ 6Zh^èÁ|–xÄì¶dÇŽ»]f ÝíÞ"õ&:ëÜ'…˜r@b~‡Ä<:±éÛè˜;gÔ ?¤Òï·Û]ŠœË¾_èúMõ®Æ”ÀÂû´T°¤>` ã 6!\1ž-\»§‡ÔÕJ2gC¢Ð y f´¥fZ¤}ó©âeÅ{eŸ¤9u–hˆ£zƒ‰ÅÃKX¹!¡kk÷°Õ§õ}a-fsrw‚\·Üz" Ò%|‡Bc7sÛpE¯â ½³x·»#kCt¡6h.)óngµ¿]зè[¦^ŠææUœNI”`‚9=øò(/@B¹àâûÑÁ|ï&cd<”$íH¶H–£w¦mtäýìæc«$±ÏåJ¦µk¶ÀÄ=þðþòâìÛ3°¹jõëY¿úê ÜKŸiYA@¦;fWû3ÙÖõzø²;û>µ2+á]g Qþd&Ú7j%yìTއÃ7kÜJ÷ l¼‹‰žïqbc¼Â$Y`YÀh)‰éÃr•”ÄW˜Ä»ôn)ˆå21ñÉG„ƒÇôd1 [“‚nNä˜wh¤!2G¸ç/wÐÉŽ#Ü¡‘ìÌÃú+Ä>Jû\&ÆÇw3êÓ`cm2\?ÛϨX!£w„Œy°0{Ñk"à )h'@¹Ê¯@‰U”5s{XáZÁÀ\)xgˆ:ø~âuB&×ùÝŒ:”©1Óç§žç0ž¹¥y›fd¯=ÁºùdÚÀ9ŸØ´´·…ªòƒaê%ÕhàZP\}Z–“*u[,³–°!B„`’ü>-: ZvôõbøB[% Ë‘'¤gkミc pŽq†p?ŽPsX:„8¥¿Èœï:xàO 9A<áÎ`4ôì„9Ð'ô!~5q!ƒ~„¸yˆ)mÏñìÁG„¸cÏCt ã•€ñ=¬-ñKÄ>š)¦E&â%ŽÆ"‘9NdDÐ< äLt'>R·$‚ƒq)w7#ej*#Ë%ÏL2ó»Û÷BŸcŠÖZ‡s´/ˆÔÀ‰ ;‚To ØŒ”ï&e³ÇÅXgGH…,9\%Ü Wd[PÚ0¸Gh›Ç‘öEÑãm#Á€ìwºkå~/ð†µ8M0‚XòŽã4Eî·\Ñ„¿îêTí/ÐAsWx-Fg4õÄ.‰ 9´ÎBÉEá…¤,P-8½p3ãá”…×`h,ÙçC?±(G˜Z–Ö$ö äÁuÛŸET`ØŽP1"ây0Ú£=¬‘ƒ0,ŒÀ"hOhø7Ž]“Üï`Hæô…w3(2*\–£€©h¥×0¿ÌgŒ/cþ°žÂ|%(f¾ï'NI° e:­Xq´óweoyW¾¢Íg&Á†èÄx¡sLæGØe ÷žÒMNw !N"[6“ùŽIWö’g…cD"Í¥ ¸Dù|?·HùÀcÖÁ˜²ë)bOøog.aìP44&ëÒmÍò|] ¾,ð,$ÜßJntrþZ‘‘ýŠ7®®Òb®¥w™ö#\Op1Dïݧȴ¿ÎàUæ®\ŽÚŸQöÔçk„á|%gê Æ *áÀœP㢠ŸïçåÕ’ï/óµ©Ï ñ)Ç›òõfßBFüqóøbÚþ[˜In6-2Ɇ¬ÿ—³c&¬râNŠæï^JPñüæO¼dx^XJäÄÑôl¢³8ý–ûàõ¢“JŒ¶æ™l+"£’ˆåøc*‡R8Ȟ͓û~¡ ee50«l‡MkèæN¹ðÆ-¬s£œ÷ç3( T`XŽP1 !âÃ@øÀ-tæQ Å#¯‘ähÖŠÎ;‹³V©Û p 1»ÁñÍ … Ðr80­;È$íF'Ãå)’•/†Ò°ô 7‚’¿N)qÆ*ts§d¬¸†y#vuÌö3çÍœ"Ò0˜GH›Ç®PöëÚõþKÌ ¡¦oYaüè…x´uÜ•K‰ƒtQžMïm?¤JU÷ÚËo” º l$‚áhî‹KÅ:‹s_¹ß ê q•’75æÓêZȨ¤`9攊£§x­¸ !—^f’óšnèŒÏ?H ±6öye``k-D¼»'q’-ôs§\Är:Ó³'Zƒ™ûˆ8,+Gˆ›— L[ãN?¹C7•õqòÙMIÆw ãÀ¬£i:`½¿½‹aLýNPe°LéúÖM(óÑRåBFárÀ0ÿØv*y&„Ùš"Hù;…eÁ5^øñgÆzã[oä/ÌëÏV[ñÞû:¿ˆÞoù7ŒÂ?„ÑòÙ%‡ñ”{Îç—~Hųs”*½œoaaA³•H&S‚øVņgmÃïú_œI>ímZlM4*‰à»}O@² lZyJä@Ž.8ÄújPl‰þ m¸é€jJ[xiéï'€ˆ¥—–­r˜®Ý¡HÉ÷è &zƈ7N’kaW™rÆ›ø[23÷,=cŠnÊwypN y*†™êIe’·ôŒ2°Æ× ˜ª|CŸZŽÉL­+cœæwœüx =¿Îtij>vöO'e^~ÈA¯Œ6NøZ×ur]&*uäWÅ×ÑWâ>‹Ò„ôɹÌ}°îo›5"«â‹Úºª‡½ìw*»Ô®ee_²–ÕEp%©ÑûvHØÁãâBºðþhq‡ë…®ËQ…Ï [_Çç·Æ4äíó›GUÐ ïÍXއ¾ÂÍ·¸Jògï‡y¥°˜þÀRXB³vÞõô~ö&6½Å›yûÖ7¿\ë_«ÔÍuìèíi<Ìû ‘“@Ëp£m¬½Ûm´˜FX18¥äîÓëÌ 7±|îXC3[%}ÞL³b—¬8§4aà©ÙÉ7xºÍ¹–¢“ðóŸàLÇ©6ïž;$Wò˜?6ÀUBÏT=¶©ø•„ ¥Ôñ8d°µ­òÏafÃs÷ðÓ™vE+pK5|¯C€qm«²GZ—J·WÓNÙª+¸ù=6neiQíê7µé·þb“n¸-!æ°²SÖæk\ÉÊùt½íÖ?®´ÌX?ŠŒô•¥C†ûÜ_?òw^a{Ûˆê›E'êíÆòPãàcúxwiÓq9”ýò†®Ä­GK„yV±^O%±þi­¬ÑzH6êÈ|3Q·ÂsZ=›z)cçÔ4A€d†š ø*[~ÄUzÂu€…IÃêçݨU™Vះ8¶Ðz|ê˜4ëuš|\wûC¹0¢I¿>&´^…A;™ ¯ÿhyœ§j¸¯=¹/>¼+$|Ü<áåªqÊB5k"-6—«~TÅæ‚“¢[dDCäpE\J†jj <ùÆ!`®V‚õ'VÊðé nÄê\øW‰yöê2Ì´{ök’©«endstream endobj 44 0 obj 4199 endobj 48 0 obj <> stream xœÕ\[“\7®‚·ýÔPÅLÈžÝ% (H(nIö-Ƀí];fv{œÄÿ€wøÁ´îÝ:GgvfìÊ>–%µÔ_«ojÍ·«q`«ÑÿI?Û_}ô³zñúJ£Z}5®þte¬8c+3:>H¶Ú_)!ÆÁ¸Ò²»úgì¥äJ;%' Wn^ã Mè5®^\}{ÅÍUúëÙ~õñ еÐ0¸Ñ±ÕÍ󫸶bL Ò9˜Ö JÃí¯¾Xÿa æ’fýÄJk¹\žl®¹tƒn}³1nÐnë·Ða”Ž ÅÖ/ý·…’l}W~uó—«On®>¿bZ1…¶[ðN[¾Á4]þ?7×uqÎI±Þ¿DkÝÝÁnÔ8h­×öÄÈaÏëû°&XãîoÐ÷!ò ™HåöWhží=ñ¢~nD17r æFè%d„±°L ‹t~ÃÓ‘:L©ÍOï6 Vé8[ÿ€ö…˜û Jä³” ‡4‡µ˜IPÂÜ÷ÐS¡)DbttƒŒ-J ÞáÏ`œ ãôš…Oé˜ZóÚ*j«¬­ª~êð©G S?mýüIí{[ZýN$ ƒ} XêÍ-,ìC/¨ „Y¦\¯¿^`aÁ"áj} Ýã9f<‰ldyBÓ˜Q­·»-:/ ÌùcShwuÄ«ØGj¶Þ¾Ž„…²ëD÷~f P¸Ëó8’;Ñ]òÓVþg–­_‡;+”©½eËØãëù q›ÓÞˆdQÐ`˜Ë0>§: d[ Çrg¼É÷n¢æÛùæ¯[Št}ÂÌT1[ÔQåð!­U_Ñ8ÚøSu§ø9:HÁÌJBhâ ż¯æ+¡]Ö<œÛd—öO''̲¨{ÊÆˆ6:²±#ºïìúÝ3ÔÖ‰ Zæ®~N4’ï;E·là¶W°TRRbtÓ¸“ѵ`FVLÙA1yð¬ÂˆÅ¼5ÚÙ„üu’x·P—]¶à_5Þæ—ëY¬ïf[ÇÚ çZ |™ä" úå†ÀÚð[³AË¢S0WLvÀ@yžG¦5Šls­¼³%ùú7µÕÕ…Ž“Õe+G…®0ºC"tr´€7:?.9?'zºÞs¡ƒñ ÏP){ì ã‘[äM%ªlÈØ‘-‘(¼‡/*│¢Ã&¢Ã,¯Úa¡UÔσ>•ä}P×EÄê'’é¯ÚÕÌKJa ‘Öæ&0w?‘ÓÕ“Œ´+-_âRít¦Ô”í´rtÔà ÍKMG;ÐÍÌñ®bdÀýSÇdŒ-ˆH«B¼`)#ZˆŸ§…¦7o ó[$Çñuü øûtÅÄ}òÆÌ`Á*x¾Ûp9Ø‘1éAíO‘ÑCúT¨âЉŒYñ‰ÂKþ]åþ¾ŠÎÛÚú]m}R[_-à×K`Ië-q1z SËÉ8€½SNùó÷ó÷î4Ù48a'¦P¢IìŒÜÆB)?`eAø‘R_âÝøXŒ—{4 ZâE?4•” ÿ^Ç¡o4ômšÂUq1Ї¦ûÎï2,ä..tɯàoys³íå„3@ÌvÁÍ¿2ÂD¶þ/&yrwU…Ä,E‡×r;ø“—gÂh¸ÎžÔñmjW6ƒæ”âbÀ!Ä0üÆ…é&fÎ4ÿSZË)„ݱœ å4÷çk ÿyºÊ€áƒäбOÉÙ×^ŸCLyÍ`´å‘cÌvÁ=öU—|>-7ö¶àƒ(jnKhþ_²ùk©` ËîBPûl÷{¤æÆÉ¢‰cJI×îmLfm|^£ ˆý‡Ýî!(zŸKŒÉu ¾Äè\''²u2Cp¢SúE“ãÓ Ö‡mTZ!t_³A'¦n擈/;DQr Bü½í¥—†pø˜H@DRʄ䧕ÏÆÃéh¿hmà_’nûr¾‹˜˜É®¥¡g(}Éad_çNºQ/+@m®:¬’ýd^.0o©è=ds{ðmµZÛJ]Qf‰ÎØõq†<îÕ:K`û´®ç½J6 ΠmÒš¥GcŒÓF¬±çœâöæÕ0ŽBLIyÁWQÅk‚±¤L0B(q¸Cß{ôM2ä¯ãPm !ô6îmFLŒ~U[ÂòÁ:¤£¨a=ÁÞ:Ó3}9ehÔ’—à{pŽeº¢¬,¨P+Á%é¶DÒ+O©¦*»ºtAûX¹ n‘²™Hí92¤ï°ì‘sù:UÍy}›f” Xéò !Ò8#qÊ06Ó-ƒ’ÿØÊìft]±ZkW ¤1 »Ã¶½ c`íp@Ø Üÿå;sŸ<Æ~'z-¨ÓëHÇ2Mââ·iFË[žÅU9²¬ŽÃ÷¬B°ýQ¼ øQG:ÁĦ]Lí•oOÅ÷ˆy]Õ°zÃÊ˪Q ˜´}û›qB*¨CÁ \W5g𢫥§ú=_Ì4÷O%±…ް¡ò}Ôttº.šoe‹/I°?:YUì‚\S4p¦ù»OˆÿÎȨEë”ø%)¡³3!ÅôF2iÙFÂË|¸‰úR‡4tãt"ˆÃÔ“b£—´…kÞÖ ÞfUgs->“"ñÀ—›šñ@™’¡Ž«‘s™`çe«Ú(²µ‡Íµ|¼x2Ú9N‚Ž‘ìYŽí¡ÇÏã­ÒUÛÝ.ÎÃÀì#ÝŒDôMU¶I¶¹<Ò±dS+¯ëd]ÑY›_‰ºôÍfN³ÌaÉ"§Ùj6C>ͼªË¦Ì@åwÆ\‰M :lbO€ ‘ó£gì61Aêær6 ÁTFfs—ÎÓùq+â1SÜ_A7†)ÙÚQÊ^@äp@„LHöED««’ÑíÅH'¥úgÓo'ˆs<ÖëÜ3N, QaÔÍ7W׌ÙÁ@ØK=¼›ÀJ®4@—öš€Ì"ìL¤0,bÏ«¥P_~#”³O~®‰g£p°zMžfÁµLFð6Í¢z•Ûç3è¤ÚKþœØ*Ü:¹ÊB€ß&û‘t7zÅÜøÂ_<@ú?¤ÝKK\Õ;¼ ,ÌMÜyz ÒÀ`ßA®„µTõ¸÷¡ãÞä»" ÷¸w Õaiɲ›Á+Ú§îN´©ÏâÑv±y'îGTWÂ&ݨ«§ä\•4Ða¢¢ É+N9 åëäÒ4áFÔ„#Ä‘ˆ ˆ¸0?nr´.,nûžÏ3C ‚÷GãI“.ã$¢<#^{ÄÀ~ùÑãwLô¢#/Ðý㊱Á)]8u>Áù·«›¾ªL0ÃlPý£VV8²£wóÌú“j—;OŸ1z_©~¿‰:ÞYwz³Ú˜±õŸŒ‹PïR{¼ÈVO¯?~R'›ã`É!˜D#ŸEAžÿzXi %‰'ËRŽƒ›—¢¸6x‡@rÔÎÄ8Œ„ŸŸA+x£qp(Ãt@Eæ3˜= VšúIä1TÊ|i“’³¹Ê:ŸLgl>«ÇêpjÀ©EP£.0–TÜJªq¬õ$uzZ…Vã|èÁõLŠgV©@g-mE¶¼k¬H¾ÁO"\ëƹõÔ“R š›K <|R?fôî?-ÆDß䵘N„W¥ˆšéÝ…Ì{šï¡Ó§Ã ŒZ7»œÁrÞDÆ[/¦ÎN©á!-«q‚pô=xc¦œÐn0ìý¬Kሠh’_)}VRå þrÉsÍw4©ï/â¦} ÔD…ñ²Å—r(ÙDá ×kÁj°Âãìê†JWÀ{‡ a{wж•·Ú°Ü´ˆw©²5™Çð½dc‘ëôü@¤ÄÒq…úÔããÅ`tƒw7>Þ”ån©{¹ù|Þ,“œÜ›âfw(‰_Û½²éäDK˜&)ª3EÃ!aèÂÆ"«œU€©¹2NoæSáÙ•…˜U»’k)n©š?ì·UDY\{ìkà€^ÖB:䤖´PYÁ¯6µØÃ2ê Äa¾2B2§S–yzÁÖ0P1¾*$µ@/IrF‹³£•iÊTò× &Úò>ôY¦Ë¸¿ìPhi©áì•qÁ}¥9]ÙgUlß¡]˜l&2ߢÝä¼ š°l,-·Ð lH Ì “ì9•<à&…pGX‹M¬‰êãeL2å‚ÑqÂË`ºÇ´>'W>3ÚÝW½gí®ÖîRºép“¬ú©ÒøÌ²* •g@åüý*†4»Q°ìwãóYD e ñùˆbº˜íXKb%|èœ3tŸS^¹“¡©#ÙüM¸‘_Ÿºk~M^›§‚Q8߈  ©Ù °~Ãì²<"‘q›êÑ?èKF!EååeÑÌÒYßSWd;ñß=!òý<ñ…qj«(²‚«¨ê[¬/@VhFÔG¶n >YL˜$x½ý7ܵïpëmõ³G'Ù9ç $Ê»©¼â>+p‰ÚX8Â…‘-öiÿ‚c¤ý8«/Aš‹pÁþï>Ò…4†þåe¤1áŽæÞÒËä±›‹ôè¬>ÍPÄ‹fâC Ò)Ÿ@Ï;Ålç å¢ä`ˆ,%dŠœŒ NÅ’“Æ] 9£´tð¾/9…t#JçKNK•AøB+®š…ô€õ¨ãÇÄG| JÙs …;Kq¿ý8{ÎKä ûˆ¼ÙvA©¤1JG(/‚B ßo„=.8‰¸g¢Ìø¦«c¢/Ǧn eidÄþÀ~‚ÖØX>Hi²CÛŦnÀ:J¸2¶WxÙ/ÊøÕ|:çaFëjMÜdT£‘ÂNz/.žbYXÕ¢K°Ôà§ ‰±ôãì9O1 –€Œy 7;XÒÜ#”—±l 'œ°·Bïz‘;L zš)bÉU‡ï ËÂ*‚nâUAN1à†2 »J¥`›ž¢ e¦Ü@{>’”ö‡y^£âv”3=àÙ]ò$Æ÷x3sZ4 v>G#/ ;ç)bO2ØXzЏëƒWH4ÏxÓYÐÄ1ÿ°ßOP§|²ÜpËõsûÅÆËèUOo‰Ïº¯Ó¼7Œ )ꎂìCì¦&/: ÜúÒÝú~¶ƒq¦Œ1?Bxâ–îiÅþš@èÞ@ Ç7¦€»µô-àÝV¼7x3ûÞ²9ÂlÔƒÀéÅ4ìtáo3¦4ßOûèÊîóÑÅtý—²FÎüQdã¤Ð(ŸBt·œ²{F²p¡ ƒÄœñÕ $?L^’êã¾ú4¥e~Þ©Rƨ!¼Œ¢ûN²:{Ìêr%wzÞîqyÊ‚ ¤š_ß|ðòz­Ò ¸—> stream xœ½ZKoäÆœÛüй™ìpûýÈ- l A€$†nvZi¤%Âew)ÅóïSÕÝ$«H¶,ØŽ¡ƒZÜbUu=¾zp?íE+÷Êï»óîýw~ÿøe'ö»O;™þq_~Ý÷º‚Ú(¢Üß<ìò‹rBµ{/b+tØßœwß7<ge”ðÍ—ÃQ)ÙZi›[|jBP¦¹ä§BkúôŽÂ mÌg•¶²é†î‰üy!däí>ómP¨h6Úæ#yó‰¼ùi´@Õ w‰MŒF7Ï„~x‡<苤Dr9H†º¹f™Á»æå L„””²Q`Œ¦#Ï?!ý ™€eÍW+Ï ùù4Ÿ‰A©ªôÊ„ú¾ÚYʯð0Ñ7DÃÄÏJã5S$Ç{4ÔÂÅ‹‘ßYú6€… )U•Þ†ÊÆ«5ÿ=üëæ¯;­|k ¤Äþ悪닇¨M xÊ}Ä#8!J—î°J0õóÒ¾ùùpšÏ“ÅäBÈD‘L¦b Á5ÔÅÙF;ÕL>ÕTÎ5=÷Ýqæ‰W?jcZíÝþ(uk‰Ù$L‰Á'§øh\rŠU­‘’)÷{Phø¸0?§K©° ¹²N…Ðtx”J…êNYõ ]óm2~0Ás&”œ Úfþ4k˜ÌÉR›õJXm (ck¼4xJŒAžÉµ(Jíà^P³Cˆ ÒY U„¸Ÿf ¬r~­A"¸ )Õ0Jšì Ö%a nôÄßç¶èB“ÂÅÖiI…FMöþ>“{Í“•åA¢ -^·‚]¤q¢éÑ_ w04í­úÌ0º@K¤J ÕÓ X$±òŽ]õõœJˆù朂{hÀ««¨¼ˆ +¢H»Ó}…ä¥%º+nËüû€i)Lc+¡Ò]+— Ö}C•à«c^·"`ë“Ü´ÎŒΚÖr[8nt“I|¥ ®Ã Cˆ_¡ÒÍt´ÏAÄz@еEGÓ̘ÛÔ\YëK’}t ÚúfQ¦sòd+ÞKÖ…öez;¥#«êG¥ è·êRòsèþ‘#$7AÎÏ=`êO…ÈÒ;Ñ‹Wòò>sV6»…H¹n] áP†ö•ÚNâ¬_Ì ÚBVªå¼D2‰ÝªÿÉ쮣®n›Çm>µ× mÊž¤ ™I^…`èd|›Ù™Åk"|eu°†ÏfŸ²±-ó jÊÁoS…ëî'ë¶‘Œøo׉IG“h4½þ¿,¸ò ­GúüÊÁ•ÍJ·4(Tûd7¦z¬²iÊØÂWã¯÷áxü«{ÐÉö†áÙÆ‡Î®¶ùì¶ŸL²ÍoŒ,¶ý!9SIƒ“ñþh´oe0Ù™a~‰¾¹Ùý~þbw¦jendstream endobj 54 0 obj 2358 endobj 58 0 obj <> stream xœÝœËn$·†,û)zÙZ˜æáK° dçdvA’,iÚèÍxÚqüyìu!Ï!«YR— P Ãèž²úçù~ÞN±æËž3Øóøßøyßí¾ý»Ý?}Ý)Æõþ÷ßÿ¸+I¹·Ü ¦`ßí”tŽY“®œvÿK¹½ñZ1/C©éJ(Å™²})¾Ú}ÙAÿ›ûñã¾ÛÿõCø].0Ï=ì?<î=°ëpnë™6᯺Ý?ßÝÁB nwá+W^H ÃwÍ¥Vpøõæ΄÷ΙÃÃPÌy+ÿF¥·ñ.Ê{%çã3ú›Oèû×xŹöú_þ¶ûþÃî§PÆ0!QS§+¸©¯j¦Ð‚.i3ˆ¿= ùí‚ÀûªThêR#†€1]Á˜Ø‡RïÿH¨;ÐLaê¡Hhf;MäN3c,Ž¡9BHëMß2!”Ýó®Öp’"„kQQôéFzf”A9¡‚ӌހ’‹àSÿPä¡óáë#*òÛ<¹®µ\_öh45ANMO€Lˆ³wY¬§ÅdV„VØ!BŸ3²çŒì÷²¤ˆ@\PÔF†a$¨ó+<žqæ }ïÐwŒêj†(;1Üć›œŸÇï2”øˆŠ?‹F—Ÿû± ú0ÐR˜ÂTñ7„Sl†Çñ²_­8¨DGuΠå¨D†xl$“ü£•bJaGõV8J;¦A ¿fG}IŽªm”d”ƺÞFTE¶Ë—›ùúv~ @î:¡"øŽí^oÀš[ EI’pS<H˜[¬7ñWr 7mhp IWÏý×iUÓLâßqmšTÛ[ÐÄ—Ñ$ü<ÓÕŒÙnàO±"(çja%Sãë­Àn¤@!½Í`ï2îl‚šqRTR¿žq)hä‡×‹=ñ ³?Oµ´a¢ƒ3âR:ÞŽqŠUI0IföXI«5€Á2§ýχ ø?ðçàAá½ §M—ª Ë/ïôb¦ÒIu6þ9þŸr‰3Þœ¦ùQltˆ á;Æ&áã<ì³ +­ É“ †øæ–Ö5¤@½!–€ƒˆ·e¸káÝ!u8á?ÝDSp£/ÞG²ëòm6"HÐcÐÚæ :VÒzkvsÖŒ}2kž{î/÷ܬˆaAQ“<t7O~fIîÀâ5jÐ?Sÿï@1qÊâdøvå]e–Ö°– ÐÕ0€¶kOù*¤EÚèÙõZÖYZèzÃ`™oa˜w>Pä–!†ÐÞ0.°!â§6k a$3ãnù~ÖŸòÕ_&HÚˆ-´µMPHAá˜vŸ3„Ó8(8…´¿Pû‘ì­áœ¢“ÒðÛ6fÃ!!ÅxbŒ_â­Lð<^çMõV8 ´ ÀTû¶ãœjîIQé„ë¹SA¹—éH>fÕ¶[xç¶•”)4ã8Ú×Ók¡ZšphuËÆæ*+"”µ™”‚fúTUÅvûàÜdOÓ¨ç™&Ý'ÖƒUÝGÈ0NÃÔ9£º}Y÷IмEmTDÆpŸª5ÑlvsëuPj=áEãZ…[`jc½Ô¸ómdœôó^W"½ ÖöñFþ¸°Æ½ðìá."9Žã}^%-öÕPf3ê)d¥0õÀÀ1S”}=X“¢T^‡E{Ù°Ú¢žÅ,ˆkR'Ú6¢þîIb  LeŒ§»Ê+Ìà“V¾lànš!‰+íq½°¶Ì𾧆ÔÒ)ÄFY†³d}5X“öTÆ…ðø*¯ý5Û¢z2=o‹IñÉ‚¶¶+Ji3äQ_\:» »õÔxÂh’SiŒ|Cµô´fªŠÞ}¦÷\2§—´<¯§WJkÓ»v¬¿Ô“3*­a'4ûj°&¡©°iA„ ž3ÔÛ—uɤ`^ÐÖ¦ZHkC}ƒ1×n·ßÍá!Ħ%•Mæ8-9Õ[X8V¿zÐmNËIg‰ÿzØXæú.îsÔKW×ÌàLf_V ýð꡿顤“¸jAgÛCXæûõÐ{Ü*$Äl@çém¸ÎñLõVX‹GO›WO@-ke¥Ù®·–ù~­õ¾7™Ké;â2'C7ÆIß¾¬IúJg™–0\L~zH.«M”d[-Èhš¨PÏ>%$óOK±=.,…&~^V§Ãe%Õz4gV"èî][{ …•¸h6YÆ£Ûg¨¦z+<`eXâÙêt×ð@’Qºâz‚‰û(ÿ/ÿc: «ÿLöH/ CìÑ?¿Äi뾬I[Ëø@JŽÛ ô 嬺Ò4ýDtÛ˜ˆ’Nâ¨mÿ`™ß÷‘JsE"*N9GÂʆV‘Çò]pßøðu»ãó91ÐŒ´ì—ÿ¤¿ÇzvUW†9ëDzjÌ=ЮüZ¨1'õü‚ú6f,~“]Ãu!.} oÅU‰‚í¼•âNÜf‹ÁBøSœàžê­ð–”,ü_àü5{ë1]­ý’•ºÞ/¥ ™)[ä™Zg ¸!©Ôâ’!Ú2¼sí«Ù5)g žY[Ÿ´5îgçûø¤@\ÐÖF†¥½lò]~kay­ðÍ1…–¸ÅÒ„vüÝ0Qas ÕVxƒGcÖ¹ÍøèAfã­Š¬­pËõÞ Òâ\KNáH¼òY»Û\hœ@nwÒ.‡¡ ‹9Š`0&p»¯f×ä°ûÁÅU+7”úùò`œœ ‚šôJ=ss4:-KõÞc}y™ÞQLÃê\›¾éi[_¹°RzúînõêÆ`ˆ©ëo·8̱'²4+.l\£â¬øTo…e⧬ë"Ït Ï$E¥‹®÷ 4Ÿ˜u„xµ#:²œ;ñîñ”Þ¹ÙnœÈÑ+}@¨Ð!þ˜z¬g×ä±…Ña$…|ö¹y4éynKP{!é$îXÐÙöB)“¦ê`73ÒÇþg w=ÆAi£ÁïÇ#®Ç çú§ð6ôIŠ,qŽ¥Ii¡\ƒ“ÒS½> ¸4Õ›×9]ˆ“ˆ-s$q¥]®7G©m!mLz;^– ÆsÝÛ­ór0JÂøG¥lœò¿0]yuÈ$—L„ÝàôÙψûi÷?õzòªendstream endobj 59 0 obj 2384 endobj 63 0 obj <> stream xœÝ\[o·Ú·ýzËnQMy¿m¦HƒŠ4zKú`K²½í®$Û+Ûù÷=¼’3³Ú(€ ÃÐhDrù}çJμ½ ½ î_üy½_ýáßúâõû•ˆ¼ø¸"ß®4#šX6z±_I!É U¾³[ýàZ Dè e¥,‡Vé´"üt­ÈÅëÕÛõÏ»ˆ?®÷__Á3 Ü,±ôâêÕ*ÈB/´¬V †µƒTð§ýêÇõ_7 ,ŒèõË{ˆÕV¨t͸¤ëw›K2pBÜ¿Ý01kÄúj±}áFÆ0±>lïÑ_îÐõûÍ%ƒÉr£×?­Ý˜ÌZcÔúºtö]%áRÔ]¿ÚP=%ÕúðÓ¦týÏÕ?Vß\­¾_Q “#­XºƒWì¤Õ¢†ÊÐzµþîž|œ6ÌÇZÁÓbH*4o×Ä"DZ™'á©`Ðâ <GhÀsü¯m •ƒÀ´&0ÁùE t–3FŠÆU8ÀD\JàF¾|Q.ïÂ¥¥&ê.¹¶#`e9|Gåœ ‹¹Ç¬|‡·ýLYÖ´&a 7„Õúax?Ž'èH¿ƒ6ϸ`'œÁRD3>×M²%ði³ÑO„ïºÀw;_–³ôˆœóðUböÈx(‘¹¸ EqSñ*À+¸€~þÒp›èàÑ=D›ÆÀô9:ä¾by’Â8ÇŒb#»-@LšAR–â}Áæ¾\îÊå‡1ÄRww[îåì!ÍiA>ÒzEK0`» 6pí!€!ìv[l<‹‚a}ÈÀl­±?Ohé²O¢Òv<Š#ÞTÏ‚Qæšd!Sé·ŠEg+9Sëd‚(_ÿ9>¦òº34 3+" bk1]·èÎ$" `¥‰&u”ˆ7ù²gT–¨â؉慺-Æ`‡®÷\ÌœCXj‡+ì1è7é>6äiðÀ–ãƒÓ óŠ`d[Î4„Ä@Æn €äLÖíÕ¨¹ï.Ý2¼›ñYÎðóáÅbþÇ[88Ĉ%Å7²RÇÇñÈëy©PµÃ,O³±ÂŒòÊi»>R,Ìż҆•¸.ÐÜ–Ëmã¨Y’U ‘l¢V°ì޳^lk‹ý:@¤…y6ˆÂ1`qŠB ÃR"×g>D œŠ.¨ºÅÅć…ÊBVà–q2ÑâvP’ѵwÃ-”Ø—’/«"+Ü¢óÍÁ|Æ~†U@?¢ë=N9ëÇïhׇû·S<ø]¹[‘<¼‹* ~þÍŽ­'<^Þf.vŒËPa bÆI£BŠçúH¹€tÒº¤ÏΑõ·…t/ÆâÂŽE䊑GDž¥`%ñ/LÁ_‹ê hMÁ}@`÷Üo9XऌhejçR5¢aê¶€†pÁ¨  ¢Ôñfì²gY–¨åÝù,kŠ,»A,»I^¼%‚¦Ê b&©ãáãžG˜rÑFŽO g =e4+ð¤U Ïu“j x ÖLw©åc¹|9ƒ]¨Bóˆ@óØUò0°r¼D8ŽTüÂã¸!©›='Š=iä WUÔ‚ŸŽ£“”Er³à™l:Ä)+ >³C(X?ˆ¦n øO£Tu) " J"3Þ% ײé|îT²aÆì[\­Ûý™˜cÚÙ寠ýy-x+49“Á¥\ßM.)åJ®`€X#EöŪfÔ?KTzD¢y[ò¶‚ÛlМ™z³7A®ùül•° N„ÏS(+‰!ëb°¤Æ²Rg×.RgÆÁËD{{7šW¾ž!@–¨¢Ä‰æ Ð TÐ¥°DÄå;õÃm ½žàÉO†¯ƒ*ÏcG]%RÀ†*v[±!ôUàÙÀÿHݾÈÙBz>€µ˜„¦N“ý&*¡.ñ•Yo·(›‹ÑYð–D(TÕtkÿ®d~k·ç˜’Ð%áÄ´-Ș4ŒÃ`Í qu×w£Kª»ÂJX?TLí<ŽîgÇ"\ų#ÂͲª‘ p´”è„(¥Ø"ì°çGˆfK!E×ñ*x!·ª@LnÜþ€v%<1}iñÆðÔùáH$Á g-yÊÒc6Ѻ¢,4¬*ÁåÔmy ¸Ž¥Ú‡Ñ¸Õ"^?É:9[fÏ#,f<Œª2æ ªr-¡ÏT ©Ì¶Á²‚N =ລïE—”–…2`{g«H‡Î8äv3È%1+(ˆ9–r*1LÛkZOnÒMè]e3öc'UÔÔvà¹Åϳö óÂbÒк¸-$e©Hz-àˆ”Ó¢Ëún;bÔåížY¶†*ç‹6QRÜãä#Õ[L3“ !Y¹Ëí“ó÷°VEÉžRz’SŸ {%£†vj¦Ù›Ñ¯é\±–eP¸Pî{Ñ%…r!è09#ß„8ý¾X¸·3.‹YQûˆ˜óL®¤<ÛÂá®o'x?áµêïÀRõÇi>3Žžja3°˜´´.£ X\FOÝ”™êXµ¹KÕó1KÔ2ô|>bžÃ²âö˜¡¾ë·[¶}FïÂ^Œ}:¤AÌ©¦ú¤(nâTg£2Þ¬Ož@ëÂXS'¨ŒäšÎiL{ÔM7™v¶ÙH5²Æˆ3­z¦^£B•ÆP"…÷.|7º(*¡†¤OÓ˜´Ñœ€CñìÌñÔ"}¥oG¤Ÿ×.,üshN;FÔ¨9žšÕˆ©ºh‚ö>1Ù¦$Ã%¸éãß¹ˆbNޝžAiŸ“ò4?† š²Pg[/·Lgw¹Pƒå øvuìšUÞÌl¬Í´ŽÉ¸Õp+Ï©Ûå%Îh¨¹r&Ú@‡>L«i‘³UÜóÕ‹ù%:ÁªD;¡:¸P2¡uù¨$mÊ*N[CÉdÜÍ¿#âCPñ…¨fåN[E,Üm4³RDÃÁkà=@ß.ÙäF’Ó%Š¸È·–9Uj|dN³J[Méóö­ƒs•œØAiúe©v|ýë©¡òó«öYÁoa/ÖcZïÜr÷âÁ»5©ÛµÕÜ•º’\Ìt,],µjx¾Òa~ƒkß!µKdl2ÚW§ö¶ûíÉòë•"PbuÎ9¿³J¤†l·ü‰)¼Õì»Ñ%[ÍÜGá¬ãJ¬>Íp+KT±íˆDóÜÂ-âÂáÓ8ËNŒ6>û‚W ÓŽÖûÍ܃* æºéE ²£ãž.ªÅ¢Àm$Îl*á* nžpX¶çûÚëö¸9~Ÿ ;òmÂZãA¦N%â°ebƒr»ÛÒa'6YûEÅÄž:ᱡ«4õù®*X©¸ûrCáQ’èz‘ûà»üŽÞ™˜ïº1¢Ì²AáñÔm½9àGoôöÎý½q\¢íòæÕÜ©Ê2‘V9ÎW<_ôÌþ²Ó>ñ4îñAÐpSû!át¡"f¼¼´;"‘r¹¸·V»•)¥Dªy¯z‡l„¯?º®á½Ñ-—ü‚âTa{HîFª:ÄE±46RÝËZèÜch½C×{t}ú¹ÇB×F[+å¤R¸rì{é%g8X­m§›ãé/ÊcïŠÞÌha’¸RË#Ï+!øUB¬?_–¦`±«öè{‰ßÔ®ðaelÿ] ù…|†,ºsÃA}üƒ¸5\–Wß©˜WìÔ¡S¬Ä@¬hº>'âƒL+Vèµ@¯ˆ^;BÛ6>¯×«,q£içëøf‚ƒXÉJ)çÔŠn±Ä'ŸûxÂK ‹6—Å­9”>5ɳAøk3éÎÉ«o ˜°fÌPw &¬þ7žÍL*–%õŸ: wù«ªLã§‘ƒQ)5òÍñ‹BÝWŒ²ñ‡I¡ãY_1Ž@–a›\G!^,)Ö/ôM$›ZJ[­BfÜá±Kûãî(Zx3.À]Y¹‡ñØŠ½šÈ,ª\Œ"ÑÇD.;ñØÃöœôØæÇÓ‚áb 2£»ë¸æÆñ´ÖïQÆ(hÜlŽ‡Í¥ÖfІ¯¯6¼¬Èï ¸¸í —®XW®7mOB9ñ/]Ƀ€…º¤îíuÉÃ4þ·qÁ%4»Q•¾jâ•e,‹òëƒdÖâž¿³B(à¼þ—çÿ$V Ù&çN¨+0ãKóínîëZ'ñ—²U:]©Ò ^¸7·¨%ƒljðÈ¥ßÄ”Nn|'¸²Ž»ŸË€—íW FbŠºØï—£©m?A¹žZ:wÓ£Bt©@zl’À‰Ô!–×N…’ŽÄWldSÃŒ=´ºíŸiÅ#¡Ñhg^横žá°Ýw{JÐÓE$D@ô`Ó”þTâŠð™Ã4[Ër÷/åò²4ïFË]ÖŽày*§Ü7¾ ‹úïêR‚j)5[r$½Bîï ÒhÐ.ÞSzÜ4¶7*f:{}jBqÎ]fö4µ<ØÒû}x˜ vÚCºZÉÆCúÛÊ4n9xkB &­|~8#Ú×÷üm;]'{J¢ÑͲdµ- J*ñð+OEÀ%¿)Ô)wG¨ÃøÀ„ÊLv:âˆ`R…±c‡–o"î8Œ¯ßmƒ 0•ö‘n d÷Dð¨UŒ6¢^è 4L÷‰†œ$9©é>ÏåÆc¦¯¸ú…P¼b¸ðPy x °.ÑñЍžH%#}¹U Š#ðaIá.ØX)¤î„†¾¸úçêêw?®¹kÏ©2n%c(Áâή¿ùTšÜºe¥ÀH½¯Ñõc°ÖX³ bLؤŒûoL”¯SN¡Ö_¿(ƒ{–3"apÏ뙘èß¼Rƒc¡l;îýØJJÁ«ë06Ó¾@ìoœNú$â(¡}d1ÑÖåT¹Eœ&ô{TZ‡j(«ã,ÁWh,ë}i€Ÿg&Õ1‚ùÅK‘ýÒTÖ Û¼ý¶õ×Au‚Òræö®FxIa«ˆºË£E¦3}E4•|¢ŽŽ ˆMÆNz"ÌzWè[“ +e}Jäø¯*§ ãÚµY4`G·ü ¦\B\O!ÂccQnÌÈÌ|DÅG>¢;óços1µQ‚#!ˆPƒÄID” £G‘&r ¯•š:ñ°Ç¥Ü)·œñ«+¼!CB·…Bœ}¡ëø¶ÁÚi„b¢­O¹ZðXÓר&Éžä€Ë¡fFR¤ÚOb嘗¦€Û† ñö=΂¿P°dî;[J„%CÅï5©=/¾|¿ú?I1Ø«endstream endobj 64 0 obj 3946 endobj 68 0 obj <> stream xœÝ\ÍŽ·¾Ïä6Ç™ÀjóŸÍ 0àFÄ@b[7;‡Õîj5ÈŽV–F–ø-’N±›dÙÝœŽV†ÜK‘Íb}«ŠÅêùyÍ:¾fþ¿ðÿëýêËïíúîÍJuL¯ß­Øú/+.œíŒX[æD§øz¿R½€'›ZîW?„^fmœV“Ð+¶@/æ{û^l}·úyŇ9×á×ûõŸžÂ¼=4tŽ9¾~ú|5ÊÃ×ܺN°^ë:màŸö«7ß ÕõÆòÍí–ÃlNð͇-ë˜rBj¾y³}32¦þ×Ó¿­¾yºún%˜åÕD¾ØBå;K6ÁeÇa`&Û?@.´fóŠˆt뛕sJn^{é$\¨Í6v¤ÿË#Ë!d9±….'B½$Ámø3­çÚÝSaÁu¥ÈyÄœî,Âôº3‹²Â &ùLVhÝIëß©ü'¬¸Åô0ËŠ×ØúUÅ.$é3‘¾:žZë·™…†g ݧÙàÔƒÞŽÃè£VœKu¾^Þs±ùiC\ø;tø/PÆ[´c/#Ù2”½šº¥h±žm¹ëz ØPM<÷ÑÒ`Ÿ1òÿAiµÙ½Ÿu´Zðžoö449ÐÐé§-Š2åwÂ>c|L+arÊï0î¯%9šr¤ÈÛ ;ÓÜ%_ÛÙYN=¢Ý òѶ&'¥‡’â—Ç‹SØ’RJ 3ظÌ" ?H«K0ãÖ“wTÜë fãÄ„G&®Fç=P%Ý!Jw¤ùþvģ療_–#iwof”ÞìJ$üÆWJ»xÖ1¤93Ã<ÖÈâÕi0– E-±=·ýÛ¤YZãM$®X¢•bw…ædrX‘®—ÚN‰8"ñ2 hÇü›¡Dôƒ.`!Säjdë ÓÄ/ÛYHç=—…Ŀё{êÃÑ·ï7ïO¤É¢&‡Ž$ˆFgÃÝ'£òëy§E–|8aRC|O¨ –oJhN îÃò —ýaâLÆpÊgÝÛ1Nùìi}¥µóš îÙ2¥qîŒäG殲:›úz6ù’ìB@¦2ê,¸ÅhÞ/ÉGãqˆ/ⱟ'_Ïî%J•`ITgt'¸â›/ÂVpå&ôÙwÿ† 7¥Ðc—k|ÜíË¡>`eý˜æîCJ°Ë1r'#{àNb·õÁ‘%ìŽã.`·µ (=RìE…Ýiî’ïíì¦SŸÅîÕðR’‰Ú,jË^„3 ƒÃGf×;j¡p¾PéUâ'¡2¥'%у?HXïAHçÚùU^Ò$#Xà˜MIáÇis )ŒìLÈýRáDš:cÉ‘©ëœ(fN{þÖkÏ1îµ7:HuRòðq“V˜ÛE[%½Á .ÜegƷĘÞS¹ˆ, îzÆ&æçÛÌ‚gñyã”a ÀŒsÀÄ'e@TzZ‰ã.`ì,ÎÍô7Š¥¹KÒµSŒN}\õeÆ#ÄfWÁ:‘1b iï‘'4ýT¤ÖŒÎI-Òºî«)©$½ãyOg)OÈÁàRIhÚ8 ¥¨ï_aú›1b•Ý|=*žÏ„mä·+WþièÜ[ˆj^o¹õšfŒ—úÞ‰á¼Â%3ÎR™¯°u\”&ëð€^’†)xb5ã£<úöÛÕÓßÿ¸ùëH¦”\4V.¥’óuÐyW^kÀX;\_³šñЃ©ó™ÜÔh&µŠø¾6‡©Â?D1…œ^Ê„.·8¶¥ˆ”Ûùóâ}æÆÙ¡i”–¸‹òÀ€†ð(³mC‚ézyâQUZ;!6wŠü1d–üÖ˜„N³quÔr~»øA`›ë*tÖ™g(:ìûøT®/ŠßþÙPA#µèdobHñz|‡¿Ï§jx>6»:Åü4EFš—Êå© ÎC†f)úýbÚyñŽäI\ØîïC”×QöåX<ÊðMÞƒû8€øe4’pî_HyJ§=o_$žR§ÅCé3ìÜœ{\ŠÉêé:&Eb¢OÍp«òŒMeŸ†%N?lç·òäxé‘ôXçÇyð¸àË87ÜøB=†-ƒ'äXH§-Á‡þOåk*]ƒ¯çàC!Š‘TÆBþõàÆ8¢©Þ‚MË÷¸Ä`2£7j2O,Rä|-¬…,1´´¯Ò´­Ê—éÝ-4(›í“{b§»;ð ÜÝÃÝ‘|„*N ’€D#ßT‘:ÐE‡Ë¥@Ø‚Ôé½Ïï#uàßecq`àN¯Á>[,Ä™V‘z1¬8›Ž‚!ŽÊV¼”íX¶ýž·¤sÀ3-8›V;Bcz*)píHYð±Nî1¹G¤He×¶ÎÔa$ˆPÆÆvÐJ1ƒùœ*><“j2´^­L(éKh·Õóx5„ý±"î IJ4¯NÛˆ(E¹¥Z/ašËvZ‰&ôÛ–h¸%m ªZ-ÇÊ5Šj;ŒÊßùʉ=MúL±Ci 4Û±+š‹¶O­´ ÷ŸÀ¸&Ed("lš„™ïÛV¶0“¼3±z + Cùì€Aò¡²õ‚TÍ–²¶„])Ø\ÖT‡è‹aµq@mT ¿Ô8œD‚èû¶#ÈûŽÇÊ+ôwÔ ÞTvŠBl‡J“W»”':85>Fýá!2Aò% §…}±t9Ñ)ˆ.à°Iaˆ3 k åO ç¶Ú§€-SŽõGd’:÷» ¶( E»¥ *ÁKúÍáý8e¢ Î3)aå@[Ñj(òÍP Ça¼žlc5 |ñ“† êD°‚ͨg²GýS—s2PÈ)epK–ác–eNJárV!8ÉUVªPL”HÖVIXe­Ÿ®¨&~<¡Î87)ãZŠŽ¿ˆ”ÿôª—Ú#IÒ0rF/#´ëC=åL;IŒ/3òÛñޤüšjÊ”¦`H;¨@Ç qj­­O®ÚÇ®§,8»hv!˜Dgü@B(PØX{“øÑVxá?œˆÅ/$v„8TÒPŠ´Tã$BP>cBTK cåV}Ò&R!Vã `CJqÚêpöÒx­ÔBÎë ö( eCKNž ôc?_°AiêÙx4‹´àÔp'B¥E;„Äú‚³ã …ij}oÚ }Q˜ó·öe±:HnSºSΠ`”E-…@‰3¥lIÇ-åì>qôè¥Äá›ëO]Î ¼ œ} Z‚iÈI¶þæþZoŸÓ°™wcn%VèNíawÒ™V0±™w™lä"hš8VâpÿíKÜ/Ϩp`®øööã—¸‡ï½–‰»xÆBÐ3ò"[­ÿMHÖ¡7¿ ÍÎ{Ñî&ñ]…–IÊÓ#BÔYI…È*a* |¼šv)z¾þ¤5íÐQ;'©xn´/ K@½Ûq†£ºWu%O~˜ä¦‚>Ê•ó¡}*Z^‘6»éO¸ É~H Ùª…ÞKÕah8ö ÆÔjã–DïÒK¿Îúj›áuìñŸàØ9û©â éÈ­Û\øg³¿O!æ\t:VÓ忤² ¿ŸÂl¦±ÃÂ@ó?}2l’Ä=ºƒpËÀ’Àޤ-ã{ó .9üúhQK|?ÇVR›C|þlù„6í œî²#²×7U&{éÜëÚò‰HßùÂë‰9ô‰Æ¦<æ’mL AÜ9¹ãà FXfB:toGZñÎÙp@*:ž!|$ÛDÊ*Ù&"cs;¨TÌ ’Æ Ÿ(fûÿð? ú϶‡×°¦_£©¢Ölòuõ8}Ï,Pæ¬6ÿ F»øþäÔóCqgZp+á’Q ¹%”ôŸEì Õø%žWô¿ù˜²èÄã F)vD¶:¡JÙæ<ÛGøePtaàÉz¥–Ð…w&¦’|[Î^¡ ieÖ1/ÃÉ‚øŒÙùnõ?ÒÆ¼ªendstream endobj 69 0 obj 3694 endobj 75 0 obj <> stream xœÝ\Ks·®Ê‘¿bošu‰ãÁHR©²«lj“øA;…¤¨-í’4µ’ÍüßãœÆc€n`f–\º’²KÍB Ñýõ=ún5ôl5ø?éïóÝÉû_˜ÕÕ›“auuòÝ ÿ¸JïVžÁøÉXï”b«³—'ñM¶2|e×®Îv'ßtb « f˜ízx´²ÊºÎ¬OÙ0 ½0݇wkfz78Õݬ]ï˜Ó®ûÞÏU|0RuoÖ§CÏá—PÝÆ9ãÂòîÚ îì º«õ)—°+ÌÞûJsk»WhÆ%ÌP°¦ë¾D£hò‹@(7Âuç~ÓðËu¯ãlk¬üçÙŸáØøà© §æþѬÎ>=9{ï›îï~ .êî.¼6 RêîÖŸE:ãàyãép èpÚ0ÇbÝË5—½TFÁ“?­sÖj ”ÖrLÃÀnSVEªÃŒHÃÔi ü5ärv¢|”à€Óûhóó5ƒÕ”´þ´:пЄ»µ”½ó2Ä4{ ç¤ÑdéÍ5šsdpÜ]àŽ\“U.ÐsíÉxŒ-ü«JNXÞmq\`ÿ´_7°)Ü­D`1cÏjÂkFgÁFIK‚Y°¶AÍ]ÁǦŒ^•ÑWet_Fi&E4Ou€øEüÚ…øÁÑPÌ|Òšú´`9MЕ8¡c=P…®ã]‹2>8–Qw HÈ[WØ8 xçóÉIp»AAÁßv{Ÿ„"u÷Ÿé¨»„íö§3?4{Œâlö8†ËÊξp½ x60Ãæbl¼ÖóäI5­ÄaJËv­§ÒíˆÝ™0½É·RUE»‰fp ¼EÏ»¹ºK$Ëoÿm‡ÔŽøw´ëv.Þ¤4Zøºäú¿ó° AÛ»¦õª‡ç•f=Tre†õпfÔSQ€ò _,(bÞ›¨æ½—5oý+×DZ@©ÕŽë«?¨ãR»pFýdµ‹î«veÿwµó¥ =X¢kQýõˆUqYë2¨‰&Pg%“‚Ã^Xíü{Oɬ”/^ ¡ÿnAëòÖDŸX5;×w ƒ.à13à8lÂ"ÂÈmë[å‚!V€öÛûIîç€ã싳Zàˆ+>/Ò9!TkjEcy«!'ªRy˜ìK³Ž(.)îo¦YÚâ7à ºJ ¹3€/ ßôÚð+@K’åþh¾yëÐÇã팂n|‘Ë–=¿éÕ_.~q‘W|Ñ Ï#¼TÞ~ÀËÍÔ¹ð–ØóŽl–?’3Rjl(3Ízc0”ý{‚=%«åpN¡›¬ö²dª×“ù+ª  x)«ÍÔý8@ý²6`â1ç1¨q¼1FQèÂ(Ö/S ‚V9`ˆ÷n(`@oþ¢m~ ¾,Ç$˜T†UL9”2ì8òhéY Â#&ƒÂ$_œîZ”æù¾24exÿ““*¾TÚÇ)Ì‘^#\¤œHh¡P”¯•lð¾Wi!ÁH Ž™*çé×õH¨ ] ÷qØiNÞ¥Tø8Ð)žrYÔÓï…7ÌÜm×]œ!aÆãÛ4Òq«œ± 'îËÜí ¶¯Ò=”ëµTèN731F/ôf±‘v¶Vµ™i½ðùŠù¾ Ã9žÑL¡ áXtßÁãû[-‹ðz/Þ î©VXðüÁмñ,1‚%Ããy+å92¡mä1ü<å?:!“‰W"Î[þâeÌYNœ_pzÖ\×M”Òš¬d¬Æ¼‰kzÃR[F PóÍjmä·ESèÝ`Ø ¿_ýă-¬y.aDï7øÕÒ’bö~pÿ<…ü‚Ö¶ü·‚2zI@­°˜‚,Ñû„ç`u}6  ”Ðè‹ÉÑ—“£·dT9çaŒÕÍ};1j“ž´æÑØâÓŽ^¤‡/JЄWäµH$6Ïó[ëŒ÷†ËÊžþ5Ú0ýøLOŽžMlÈ»Ï&¨×èrþcrôë*ĬHè,ò« d²õ´yr¼+N¨GAVÁmÞ³aâÖÆ»T̯֙ +}0#12义Ü¥‡ÅÚ~ê®±*.* ØÌ\5bªqo¿Ó$<Q[hìÏË7üa=7ÇÕ0a«µý‘4 ‡ŸÑûï.j—弄cLͳªˆ_‚ÞÇÀ"|ô«î¼EÞ{psØ7Œ*µFËÀx•c¼D^‡¶ ¤°\8üùÕTo1ü˜¹¬{5íæ ¾O¨bU}ÜßE35aíã½ÐX-T­j¨!|49â5ч \ÿéJÈÁAL½ÚcËO¦0¹As%LÉ#r0]<þÒÅg¢`FW~X5^º·¹ÇµÒÆS@$Ô[Bâ8r4‰N÷ViJâ§HU§¯Ôp <_ý.eÈEÀx q:DA‡ÈãÆ_!d¥ŸD`L€^ ,0®}QçˆZnlðþ»Ð";vĶRI”½³lï½, ²5b?MÛ£ÌÆLSau¡iä¼l<ƒw áƒL¤ã™Œ‰¤£ð¨´ð7 DdT,=ž”ŠIG¼x‹ÍBUÍTÂB«Y¯±¥ï±e5\f¡ÿ>X‰ß^/°°™z€ŒER*šF¹¦öÑ20ÓDXÊ,e ñù*æ_zí ü3º×ãG<(Æ¿Xà_¦¢bèñ쫉8P"ºXâäH]ÍZÂH冸}eí1ìdNjѳñó—bQÒßr²Ax{ÄG8™•„Š º…n9•w§¼s”UR©èPjæ=U>Z;ÄPx¾ÀªBFżãYUSqu3Éöù‡3Ñ5Ï ‡C3€ÆöïóéFf°Ð¢§(>( þjÁ… Ìò#¾âÈüÅDÌ}®ßdHÑß`Š}ÏnæŽ&÷¹¹¥*i+ |h"2Nåì„ Ë'½v„€´ò_Ò¯8ç½´|Põòj>ˆBUÂ;^Vˆž™k-¶"Ä}F£¬&ø)¯%@>H þ3Ü¿Çi!äÂÿ °ÏàºTj½-¿+£Ûòxóhéê±¼P¿,Jüd»3V¤íŒ&MåHY™l",Nsæ {æDü{G5*ÆŠ9Õ á[yƒ…(‘¹~LÓòÈcBÅg8ç¼™>ÉL‘]"×.¤.µºˆúY©™>ÈQ(åäDp†jƒx¾×‰i|ï1ARî¯H˜q}¬HLèR㼌¾˜WD\%Îã…‡iûß ¯m9˜ Ê¡kI¹iÉý-°£’4G¥æÉÕ0ÿýŒMù1ª«£²ùfAX…",¾- «&h"îÂN|¿àóSgýr [Î@¤ah‚ÏÔ ãôPKã ¼÷·²"¥ÖÈ©ÜOy–÷…¢JÇóž4ß\Œ“°Ë)€O~)Ù› ¯E€KU¡ÃÞ¨±T5þ|ôÙÄ0ôJêÕXcˆv>áñ>?ù/> stream xœ­[ËŽ\·²ì¯èåm ÃðýÈ. œ6Àö8›8 i4’îž‘¥¶ é7œN/Åûì¹#xÑW4‡ç‹U$çç=gbÏñ¿ô{wÞýé;·ûq§7ûßv|ÿ÷ÔÆ0c÷ŽÉ´ØŸwÊZÍ´.%§Ý÷}-+ö6Í‚‚Z¹jq¦]¬Å÷ow?ïDsŸ~îÎû·0®‡xûÛ7»ØK#˜ÑØm ð¿Î»ÿtßn8ã:HeDwù€ÿR\ ©»ãáþŸ·õû¿·_ᄎÝ}»“^ æ…™J(̧A„v†â?#(#” ÝKÀ!tZu±Xsn‚Áo©=sBt?` i”´Àñr(À#çŠÏ%xÖ j)"Tüg£’†iªT©-O_ˆÉù;Á¬5Ð'v”æÜKi¹ÒcêëØUŒÕ±—©Œ¶!CðÞ&œã¦;OðZP¦ ªÂ’uOyÃvFnáÍ]î­“°Ø\þTxë^ÅOå‚SXaPRW`,SHQ¼'>’ï_ðÛ‰ª±Ó×hÉH³„å±çï1õe6i6…h££-ŸGb<ƒz㙲Ÿôc¥þóõÆ@ŒíÔQ4t§ï‡Jý]¥ø¾¸–1«èç†UÍ= ²Ší’»x"«LH:è<”ñý|>VVO…Õ8³Tºä)*8Êþ ¸e®[lÕ@O¿ wŽHö˜Ö‚©!zè_¥SLJkj·…V0`U ØkÕ‚›è. TV@r·SIÝ!•íèvüxƒK•ݧ~³“Ö>ݹŒwñB}™ÕPžF ¡Œ~†Â1oB?ñÊyr Q‰‡%*Ì še(š;Â>‰*šˆé/µüÇCﺵòÍjx7£ÝO/}S¬»ÞÃElÙG‡†‰ø:vg}ìe)†C—p>A@*@âå Ùï'sÉÌnÁY¨8 oñÀFQ&±ÚôÓ:fLÇ8È®äÒS¡7 üVD”ñDËüR@â¾¥îUäiÑdú0Úz§jIˆ2ÅF¬4Å"„æhTšÔîÒhÍDŸ—ªÒLÞß$!*¢XÛ¥ʼÓ`r+¶ÄjA7ä¹a/Ñ£ƒixÞöÆ'³ ›±5ɾ~ª¬’[±÷ ¬VD”çmo{«C@Å1¿/TŽù+8Fócœì ¥…ÐUPJb-å=ÃýO¨¸uC-¼Èª””ZÐB„ ±ö¹”À"òùIÿÏzñÜ †á Fù¯ $EØlèÓ8C ð«Iâiù\Êõá€ì”5Í#‹œ.é«và('“É%t6Y:¨ÅÓ ÿ$].i¤óF¡Ã:1ûß-Ëì¶?á!àéè뉓4©Cg‘ÖG^Ôd0pÍ0æ›Éø5³\àUÞ+¾Â–Yƒ¤üa;½éîÉ(Ã>aýštïs_ÝP½Ä›|íœH¬€Í+x–YÂi,ZO¯»ÂYÓðšðÎ Äüý{Ö¯Ï`Åí襹RžÊ¨iPKëv‡pÆOÖN£˜={¹%3-H‡”7k<ôT”`l·òwJ+ã_åÍéE%ø¶üÃ<Áa|ÓßMe‚)œWC&Sös¼Û÷ɽûÅã™ã[ÚúL*N©©µ '¬¾»Ì»0ÿÝUGAŽ¥•+µÛöÚ\k }Íܼʿ‹\#*ŠV´í 1d2§à/†‘:9ñMÁü¯x˜êMh3ÞÓõe:C1šmSAšÚ¿cÎÛf*ÙpÏ™†.¥ Õ„Ïüv÷Å…¦Fendstream endobj 81 0 obj 2923 endobj 85 0 obj <> stream xœµ[Érd9€]~E.Óš@4Mt05mšÍÂeW¹2"Ó®Á¦ ¾ž+= ÷ê i¿4Q‹Ì’õ¤£s¤;éåÇ-gbËã¿üysÜüâon{÷y£7Û7|ûõFj[ǃdZle•dÆ×–Ãæ»ÜËnm0š½J ôâL»Ô‹oï67"͹Í7Çío¯`^ ,ð ¶Wï6±•0𓆠ÌXøÓqóÏÝw—œq¤2b÷ø)þOq)¤Þíï/Ú_îÚ÷]}³ùêjóíFz§˜3fnÁ0_1(¦Œ¡¿J ¤6\ïoˆÐ!hµ»i_)ðáÎq³»n}—R&ŒÞý=¶J£¤ÝáEî/êâ]4Z\iÁ‹+zB/…ÄLÿ%Jza˜ÆJBXþ2EBLrä4óFÀ˜†Y‘9ú ,CJË•ËÓæn‚œ{Yž~êLæñbómS!©#CðÞc®+RÄ~EZ™³.°à1—ñ9#ÏáÒI8¤nXÐï¸lscvO̽Ìe?µæÜ³{@T>¡ïü‡ã›‰sYÉ«` Ál%ÏhÍ´ÆtæçΠÓxf„ÖôýmîŽàõtâ©ÿ}! –°y˜:æIÏáJsÏBÀ\Åçòa!WVÀ‚ã˜`_Àf$À©\íÞ§¯Êøãƒ æô¢e{@ùp¿Çûn‚ÁŠ„pÚB (µÁ æçÎØmJ€çTàß/pÕæîØ[ÏZ 6yì˜PóíÒ¹­8{n “B‚®gÐ(\<+ÃZþ°@cž³zbâeûyó~Cž;iLèb»'3áK”„ÓŒ²RƹŒŸGÊé rÍ”ÐÃJ®lcN×3HçµaØ…ˆÀÏ‘´ìX× ¸"#tV±÷ÅD¢ï#"RBmFZ¹tÑ~8Äeyn?ñp,<Œé˜fXÐ?š?ySýɘÖ£#z=­…‡¹E [E.¸ï1©gO3!ü=㓟W{©V1›c´?5N¿,pÚP`–O X攀ˆ4¡LÀ[õ "õÇISz8Œ]wÃJ˜ÎXK޽ “ (Í)-©—< Æ0ÚòbB/caTW[Z/hSRŬøØZt ÜÖ¸bˆ£”0ʧ:?« :k ±´¬…¨8LÃ-…øW ñáBBnùÑŒj° ™ôÏË]ó-¡¶ %TÅ”0"V,·Å„WÑ|!Å×|UàæasÅ™%8©zS5–¢Í]Å9=÷²têbŸÐQzœ"´i7 •®=˜©ø˜]›ÐË@üç‹—zß Ð‡ T(ª(0‹'P,sÖƒh»· Ïrª%ª|¨QÛ°ïýœ­šô…ø²<¢M^^ÝÚ\§ ¶vnI½OæK!™McÅü_Zj/®»a"•QJK²ìš2J´ˆçÀÉóM–)!––Õa$.%…HLF8iâïOý©^ʨ¤UϲlQ oÑJk ZiÖçDØÜB„µÊ0K„uìߪڜ,€¯×–@nXh«çõz⼩Œ&çIËâQÙ)Vh®j:&¿"ErT¤•DÍFÀ´æçÖЪ’µÖÉžæèºÑú¸\+)|6DçëîçqÄ6³Œ+¤Ø†N›½Éji!½.§†È ¬ŽfñH…«òÜ"88¦ÃªßLínXü æ¢ez@…ÕéBÌ˜Ê ‰›!U⤠ƒGí¸=ƒIiÁ^¼¸øWx«€:j×Ùã9Qû+l =¡„>yŒ5˜¿ôت<¨÷[-€F•£¸FTþšèk…¬ä:ç˜lØ·kò‘B%Á¶?öGtÆûóÞB¦èCŒ‘$ªz—ãÿ vÇ™{d¾ŸZ€5ª–õ5Ç"X%€jˆ„*@ú ±‚ñ1·ê ª˜w9¦Ü7­î_ª`ƒ†%=mQ@ G$èâqÆ„ôRÎŽduuÜ¢ÿ+ DW§IXl´m-,*-Cºoƒh_yH‘ÜPÁ²žA¸ZZj/PVÅ«@1Üå/![cÌã¼xw±¸ð Q±WÂl ±´¬†èC$€ ü#ºÆAî‘DŽhf'½¶ŒÕòy×ÓQW[Ð⪖r#I´Ì-DK£ s ki!ü—«áhÿ!Q°mñÌ7í$ßNUβ: FSð$ŒE½z™òëvÖîÛY»éÔãÐzU¨‘.reSD0¿ù¹3ø…¸ÏèaÊŽùm0:ÆWóK@C0}‰3&°bê)%Ærˆ#Æ&>'WŲ…ÀXè,n8YÚÍt5˜Ò0 $ 0_¦n¸2CaQvG_‚±òøä /†êÀ2s –%ß3ý9)-¹+.ÎmI`óË‹Kíãû:¿$’z“Ó4$³¯9Ü¡>ï/.„ &fzÔáB;d<1MØuÞËH¤>ŽûÝþóð˜˜8ä ñO°»¹Ÿ6·yDiHªÑ¹åѾ‹•CØÏ|{u 쉩HFº¸ãeG e,„2¡¶¬Ùå@Qሕ¸´çDB~]¾ú)l rWŠM¥÷ÕÎÁ#0Ùa›õ"€‡`ìRÀ8΋ş¤póH—ÏmÄOdÄ~›ÃÃñ:ëósÙ8&yÀiŽ?Ps_6¢òdcá¸ïs\({R‡™½=TTð€'Ÿ.#…§£ïñ´ûëÖ)mÍ|˜¸pzÜ´¯è¹ÑgPWjc82kÐÑ’h”Hó%ØHà)*Kç`,¿·Èdì'¼Dú®›ìAÀ'ó€{W|2)Ks†‰+H»P´l2Z—ÛÜCÊ^žÚ}úå¶ëOŠ?*~B–!Eb0áUf.óû8c*gª¯û‡~Ýã`ô er€#ÂìwéMñCæFÅss˜‰¯ÓyÍ×Ì(KñµË ÄŽµ Wj {Œšó°Ó’Os6^g•–ÁñétG#æÌ ÑVn‰½Õš0'¦rÒ§kx…ÌDFÑ1ÄÒ²¢çn4…øý…`œ…£¯¿!þUòg¾ùÆÜÖ¼ÈdT¼/Â2å"“æ(™â5©_ƒNp–`L Ád&á¡9€ÿ¶¢Â»ÖÚüáX ®Jvܲ@ÛOñÂGn_펞PÊ‚WI#Þý°C›©KvîÍNu®ëoÊ·õWÁ¤5Ìk,a|nÝ«Tàt•šT\Ã8o|j~XЭ!ÂJ®zǪèÖšx9èCs¯À}]Q£¾•™€KaêóckbE'ÒA•kÀdtÉ2滢èXOw¢ž ´í‘û~¾Ëz0Ý4gÞ`¾Óc«jØ…ož£a©ŸÅ7‚AXS®.„÷(¦LÎÌ{­Eÿ6§­*¨«3%å¹õ6Gø¸—rÁ·•šñµÖ‚¯@ˆ:•VkÒ¢÷²Ãpß¼Å+PÒKBpR ÞH²î%_w0™6ºTUç‰n3cêÏ06dæÃ~t73z1ÓRê°Åˆ}DùùЕ–£`c ,Œ€q,þñÍPW‰?pŠ/n‰©8¡d<1͈bgqÊCs˜ÔˆY®’Läb¨ÏíúD“]¿÷9î0“|f’zkGº<ácÐÆ¾D]»žK‰HáçnÆüa–PnÓ'Z ¦„yÉ ø—k¿‚> ê9Øæ^£9<æ©Àî’ãŠUø7rc˜"¾ÏµÓqØíߥ`_AÚ |-V¡ÒVf]5~këïóØÂ ùbî>ÚXCÕ!o,åD¿¯²ô PˆLq-L~¿Œ ò†YWˆ¾ŒåkiCªPh+O¨Aó¡r¹gIáóS»Û»i —:ûÃD¥³Dï0ö褤4-Þ‰˜KA^öÝÓÌŸù»âÄ‹«žûùžoHÑ%l£íö2ÖÓO°J¡³<£'ráo7ÿ€½ÿendstream endobj 86 0 obj 3031 endobj 90 0 obj <> stream xœÕ\IoÇ|ä%aäÐhZ]{U¶ad5 [D‚ÀÎA)j¢R"‡²”¿‘òsó^-]¯ºª[CZø šbÕ«í-ß[Ú¯WCÏVþÿ}¶?yü­Y]Þž «Ë“×'Ìÿqÿy¶_}~ à'“½š¯NŸŸ„™leøÊ ®„]îO¾ëäzãœë3ÝgëÍÐF0£uw¾†Õ ‡_Ý›5ƒ~îd÷ô*÷>ÃÑL9§MwAÚçë Wð‹»î JðšÌý$7/ï|›YÛÝ*Oþ,×݆ V7¸DÆÿýôpJ Çîá Éeo…ƒ“ýùäô—ßu_ãP.ù`m1 Rêî’“Î8hoa뜱ÞÚ8†;g­†ÁTi-‡Cû¦sRøK™\(ÖÝâDÞKIˆ‚ÄŒ›Ô ”dÝ&l… ƒ‚Ki_Ï ÿÄ_büqIÝ‘A7„&Ùïa[Rõû„Íu‡‹5SýÀº·äTüµK7ct÷}èÃe؃bÒˆxKÆÀªW„ÐEÞ½§yôn÷.ÉXñ’ÌÀz Xöô¸ô1Œæ\Bz✠ãtwȽÏr“Œ½Îcorï«ÜÜ6éÞ´è6ØÍ½UÊ¥MÒ»&çnîU‚5Žw—·q›{o¦Çóv¹Nj¹áq˾÷ét¬@(T—9¥ð8÷V—雯ò€m“îM‹nã2™=Hdº’ï×È~¦çÈ­äfqæF*Ñ+¸Ñ ƒ¥taÊ9‘ëÈ‚ÂJäõ’£œì·TÌ€Û™zÉy÷r úP²;Aƒ:ÇY÷þl]¯m’/¯(ó8ÂÉ(Õ~Ä5±ß/L…µáDÝᡸ?/içUüA¤ñ'nïz¸= )œèþêÛ¡^,ô.l×0N•Ñ«tbAÜEp1tÎx“5£o •”nS?Dzqÿƒrª¡ ý© Ùþ3“!Šh|¾¨]c»Py—kä.Á5X»QõP5Nwë·¢8³¬V³þfÁêDÝ- úÔ_“Å ¶Ôƒr½RY=ü"KÓï³4}{¿ÊÍ/›rÞ41v¬×;ï­OÿÒjLÏlV%¢°Ž¡ï¯' w™@F(Çìˆi&|À‰ÌqK†FâYæ á§fõ6²Ìu‡¤ŸÈî!l’+ÑQ‘>í¼Th/bé&8²õMmx‰¨@û¢»½ˆ÷Åt!aTD8¨9¾šY T‡ÕÈ€®;õüÎ¥d÷bºªB|N!̈Þ~1÷îMõÙ==ÆuZi{gFëñ, çEnžOo¿k8†‚XA¢ŠÝ¿2Á‚»È𻻥£…1ÿŽ/WrYÐÒ ›tÌ`ø”ÈÀƒsв*Š©o¾ÊÍmnV"-SË" k*©GmTR%˜.^¬¨ã ÌùGzlØë¾oá’B?hÏëèé‚û^eyÚ¦]Á»R>'‹¦á óO¨A ’CUM…ªqc’ƒ/•»{6÷‘͸¡Gq6pÞ¼Fô#8ŸóD¢Çe¤šBPœ(=|l é>¾Œ²èãAËú¿‡»¼0s[‡C@ˆS“ÁâQûx6(@]”¯î%µ6OÌå—N(xôÊ!«Å¸_G9ß\¥¢œXÀmä„£!Ž&Ÿ‡ ô½=´²ÊºŽùnÆ-rœ’0à– ÚõÍ«íÅÍ34kÓ5’2Øi:È“ :Þy—¾ ÝÖ RA¡SîÓ<âíØlˆâÆb `á‡é°P‚w6=¾Ç¿w‰+ õ.rŠ.YŒ‚Ô֠׋0^k¹d ýB¶¥Èü¦ÿ3 m¤ŽS­“^åÞmî ú‹8E~À¢›6Ñ_”«©m¦7r @óm¼4°‡ÛÄÉ 1”Ìv¿ÝáL’§¼ëgËéýD•Ã̆æÐBC¡b%é*Q=Vxg¡©[ÆÌÕÖ ßM-êPNç˜够f¤Ôm0•[7s«‰qÀ2¼´õ‡ƒ×¦@Cp3q!©r$ºÝe.'â±Û,Z¼VØÊ~0?ñûr'T¿²Á@Äþ àh!`ô †þëZ€zÃ×܆[ÈØv#@Ÿss™T¨ ¸PÞT¸žK;‡)Æ»û(Ü$/Ť¸º%k$àÂ@U“é•T€F…6 z.ìýŠ(”™!5[ך°ŒÌ¤Ò­T‘`QÆµì ®z_䬮p¬dÓ\HN¦±À™Ø %¿×?Š.@ Q/g䟅R+UÄšëT(º¼¿ì‰×¤5 òýb8ÄÇ‹ºÄ'Ô‰ì_y}£#MñÿêIwÍ' ßÏðÉxA÷Vµ¤À™,HÐ!hv»R§ŒÈ ëAŒX3eÉÁØ4vFfÿ…À|€«½–Á&²“4Er)ӟųàþ@õŠšUjœî¨—{NGm‹9—Ù¹ýú@¶ý‚*ù!`ºo×£÷N°Í4ÅÔ…Vb/:è ‚,`Ë»@Y"!”L ^™d†òWoߟldƒ‚'âZ„ÿ¡R c{Ŋ⡤^ÔsÅr.ë'®Àùª’Õµ_H…jN-aÙêFJ*¾“íªhP1 ýš‚±ÖTŠÿ³@s³ÏÍ*…D²Â^Bª¬°ï­B°ØÛŠ€_N+Õ¦Œ÷Z«–í¦®2ðlpˆÚn¢?ö)œ)ÍÑA#[ÙE!1ÅZŽ“Ý‹…Э*¸÷ø‘¦ë‘žêX׃g×ãÉŒW@=‡Cù-_£ûb=ºl0…Ͳ¸ •麑ølÞD#$ H¸ûËÚ,/fÞäSmiÿÙÿ‡_sÛ”âŒÏ[¾ ×`€²±}“Iÿƒ(blIýÙYîmú5Í`xIRŽZã·‹Ûœ«m·Ú{TxLñ•^ †v^’$€ý±ç^’FÐ)ô:•ßþ4^€1\©ô’&ÒÉ%NÐEæw_ò岑߰”n‡!2Õs!¨SDÓ‡<ÑØ^ö BZq*–¸. ¿ÁÛ¿Pì¤ÿŒ"ÉIÜžÓ–Q‘²øÍ/èLýÇî‰(U¿!ðæü?ZÖw6"@˦¾ÒÑJ? =˜û½°^»¹ bU³ãi¼ŒÇô´ ÂûF"–¢Öf¦2"\¢(+#xzM¼ \ˆ™97e¼s ‰c S»-}ûÑ›ÃÜä{é튖‡Þ/në7ÍM’­ß5Ç’c~:E¾~4.i—S·‹È)Gb’Ÿ`ø •¯^±ÖEq¤Ÿ_«RÛøhÿ7'ÿ’‚ô¾endstream endobj 91 0 obj 4346 endobj 97 0 obj <> stream xœå[Ýo·úx/ýyÚ+|Ûå7Yœ´(ÒIEÒY_ÞúN’­•õ¯ï É]wIù,K‹"9¹äpæ7œ¿]w-[wø_üÿÉ~õÛïÍúâfÕ­/VoWÌÿå:þïd¿þê ”ÖuŽ­ÎWáK¶¶¶š³µé\ÛÁ’£ýêÇæ×›®í¤3Nêý¾e,û ßÂê/`5çÂ8ÝüÞÿ”Ž©æu¢^%ê>QÏõËDýb¢†“s®·ãÑ[Î[Õ¹ÀÀS°{–¨—‰zš¨_&jÚáÃ<2ût<^'êq¢^Ez›¨×Ÿ,è_ê§E ÝUõ\í¦(óãD=)âí‘ÈzJôïŠâ?OÔá³ô»Dí‹z¨ÃgeÂOj–O‰€ÿ1S#Ðd1–ñ%yÛu‚G W#.+rÄZÎ${ Gü ôåB³]+­a¹ÐþŸ0.yg<†¢üÀZ·‚«ÖHŽ·€ß²uVxmÆ 5ýù¨RXäq ;gm°s&­åÌiNvN ¯ñq““´š¬¸ 'jf›Wd1Y1Ü%¾ ™~‰{èV Û¼GFmǘ÷™q©gNt6iz¯(Ť£ü„á¬üé¾§×!ûï‚;á(ƒ{ºý.,7¦SV²nð·ì:åTóö”²í8à5UÅM8L*Ó¼Ù¸ÖIÖ¡¸hÍqÖ܇¿F±ô§eÒ[ ý¯ðÐ|•çò]ØHÀ9”¯û âMHÖ27¢9ÛÐ_TqfYóóˆ&Óì ydPL¿¤R¢D•›¡"@Mö[\3ßòí\qaÉ0n‚›[ð6ÞqËD«¤Œ~ò43/Ra“æ:¡"Î)z: «ûùE:ÛJ†ˆA1÷{T"±…a݇¯h§¬útÀµG9°#YÁ6ýÎT«ôw»ÙJ«[£eó2YÞM8ÛŽÃO¼÷ݼN×Ù\{ôÀ7 “Ñ5-¹ª(Š‚ã4Yí‹€*Îyó­çOñgvt÷g#³¶¹K«ûÚ,¼W„Î ™Êá*êÈYºä$Ý(šX×õ Æxˆå o7k¥–£áäf‹+™ù(³U° ôQ dIeM‘ÃrES f1ÉF× ”ZQUÑš‡’iÿeþÄ—¢¶H¾ æEåíOI‘KLƒsI–xœ,qOå¿#pØpÕµ63“+b&·°@‚U NCU¾‚l}š–ÏâÈ„ ¤¼RfÃ:Õ*Sr¢¥=¾pSÑ¥¤€§¤@>”@* ´œ’¢Ÿb1ļ‰ŒË˜6-Ç·~Áóçþ»ÀÓ­Õ:aÿ,!XãUU®^•Zƒ± A ,€ÉFɪï'Áȓܜ[PæO›°£TÚçCAÉy ®˜ûÒÑz?Q†DnÏã-\óõfZ<Ð w[ÂÀÑÆ LÌ[ ƒ‹ƒ™Í¢Õ·ÉÓPDyFÉ-$wÚ5}%]ÛQžƒÈ£ nÃ,z˸céê~1QrÍuÐcŽ«áÏQZGúó,ˆÎö-Aqë48ïÈ—/6ÅlÞÀi|rãáµ£;!é³ò:Qûôó,ýܦµ'‰z;ßÌÿ$u³9•læ¾)®½/}V²R|ª¤‡ ºMgÚS–‡Ù AZʪ5dÈ&¬¸jì÷ƒÌŽÑjØ2V<$¸V£‹8spå³û,uôÈðP‚„h›nC—h;'bèÑiޏÂA’= dI/ÇXa<†zL 3ùœ aeI;ePÿ€,еž_¹:s2&ÿÁþî'jöðÈM?.á“{wË×ZÉ¥ž™ëè^µ¢Iàë9@F¿ˆÌ2¼ÚéÙcnßÿ›(“Þébr;%Â¾ØØ'ú²6øË /•.¾y8 Ôxô¯UxûZ5‹óòTL@\º%Ú ý,Íòò…+|‡7a)œ1ÂÂ+ÁböLò^åäZNVSY_8d›ñL¥ÄµíÇ%Bfؾ.C‡æÔAVä‘3p3ýy¸,·rù¢ÍÒÏd_I6è§í¼º¼¢¦Ax‚c‡·$™µÜ¤|ºeôr³ue ›ï“÷!^aïY‘¬ ¤„‚6`iïi–qülÐÙÅèÎdó|ýÁ-Ýoƒh¾Ú “uÒèq‹¤Þ´_þWeK-eÄâC¯þº:úÍÍtÏû¥Æ¼4hÒ@Ÿ ¿+' ãÛ%œb»JµPüù*ýìç ¼5‡ÂêXˆüãÑ껕F×w«ný' ؘ9®…âùÄzÅàfe·ú¡ÚÒ›ñ°CËñû–™ÐÏ#µÉÛ‰Ê$iLz9©­_%êev!xbˆì©oCð•£7\¤3~·û‰:É„NèµAÎèV›ƒ‘ó0 rmt&Š~®™yªu™~s§íמîÊK¨ÚBó\åÞúéÐ5AJXÛrC!)†”°­æ*ò$1Qîïîõ¸„"ÿ"xhL4¬±-¼”ÉõfÅò ë×€ÄÐsæX ©ÜG~N$¡¢¹œ¥ªÏ€$ÊÈS¤<IX6,ò¬(H"§!cm®$œpa?(Ú‚[ —3øúÔ]®‚ÃZˆ¤ùõÄIÙù> N þK'çÕðgÀ à “£8‰”Gã,Wqù*1ñ®™îuñ䮡óiæãf@˜]vgë÷:èÎø`A$ìný9¸îÙ ðQâ¹àÃe­•>#å±ðÁâlI‚Ы$È2¨ˆxß?+|È#|¹óÃðÉný™Á磼½tKƒT$<²ñœÍ¡[ÃÜ4pDÞ¤¢O’GR“%O\òJ©æÀOö±Ò+¸„ÖØžóHk&Ê#óH§qð$¿\…¤GWyù ÚÁ¶´àÌLñΫúAga85¦-ø¥Ó±Š»@´¡)eˆAÎ+Ä/P­%‹•;@|öv§Ÿ¥‘q?/éÌå¼Éìf÷pÿ4e‹ :ÏžòY­È@>B‡|*™'!gQó!´%e@õç³|Ö)LÔ+ptç³y²™"7 øš1åo/syfS4W!ℱœB Çú“ÀŸ´…’8QãaWÊó YÞ,Ѳå?‘rr»T ªd¹9ðeEów4§ŽIV˜ã¨ ”F)ä5HVÃp sbm…±oV' TFK@e0Ôèbɶ3xÚyÎ8¤ˆ8ôÛ8š#Î'Ýæ“u²œ:rªMºürtlCäúÌh(0^-µ‘íÇÜ̳—ƒ§$8ChVÇÏ¢õÌÈ¢ôíò¡t ú!ó*^ò¶6tž$ä™ 6œzHt´:ϽRg‰ô}ÒÉP†s) ã”ªÔ¢ÐqþgÐIUÑ/X‘> stream xœí\Io$·rÔ¯høâîdºRÜÉ80àYØ1l+‡ÀÎA-n»5’¥Ûú6ò{óÉ*>n¥žÅãK0‡©¦Xä#ù–ï-¬ïVãÀV#þ‹ÿ?¿9ùýçfuýp2®®O¾;aþ«øßó›ÕŸN¡ƒ…†ÁŽ­N¯N‹leøÊŒn…]Þœ|¹~¾A¥sR¬_Âã(Š­ï7Ûqã(¥Îž/S÷¤ûa³åF Jóõö–ã¨œŠ½­årî!ùú–¼xš­rë³ÔÙS¢F¡$ }K~œ“Ww”€‹Þ®ÉÛ8™ŒqqÙ~²3º$ßA—Ítš9_O§¹Üp ûËìú‚+Á³ ºk“Î Iad úºú0¹Î›çQöwQë;Òã¬}ôÅøžÎ·íqîrÀ~$ýˆO~3Èûa‹ŒU<ø!Ö‡bwÿsú`5Æ(¯Á*5à·Ó‹ÈbœëQHôœ ãôú¦ùxæ-7Ü/+¶^Ì­8Ý_NO>;‘@Ðêàÿ¿HáÜ ò5‡\ÝœH)üÓÔ²?ù¢+%9铘ÀWµ¨D‚™¤uŸ/·×Ì»szµn­ùœ·iNÊîÓ"¤nX¾Rv·å‘ÆçaR¤#å[ä"<½Ú‚T‚:òL$ ã ŒþЛ­Uhþì-’䣵1;p«%=¹3ÊNdñ¸qT½ûÓ2zýéooÕÝc&@ÆÌ퇹]”¬æ9ðŸÕ†áÓ–‹']R¶Ì匦€R8¬:;¬° ðLN¨¥%à‘éÕéÇ'§¿ýrý]p%‰qËsILíhÛEÀ̹I %|™c*>úÖûÔz™Z¿Ÿ[ÃNÐ9$€)æfeI î]s42¡çZw©õ6òóãlß@GÀ{+-˜ŒûÆ™íçæ–%û–¯b²o0è ƒ#lÁ¾%2ÎË-ô­÷éñ2=~ŸúîR+ì{‹Þê‘ïÒÆdLéd÷ 3”$t·µàÏ-ƒÃÅÝfÔÚpÄÿÞ°…Þ®‰µD× ñs¬ë;hUê3¢Ä|mM®DQsãw½Ž½ ÌœÖh÷ V-x ØÃ‚¶(Õ¸§L+º$j×éó=Q ´3#kEGé+é¸lÉÌ–QøïWÞñvùNN§`ÌúÓÔ‰|—TÙî2lž†lž,Ö7Ð7p³Aò¤ g…2ÐŒ<'$–»NÎ8Ž®sh1ÑvŽ,ú'Š3›Ï½ëÁF²·Çôåó4üçàQRj–ðé´ø€O•HþKÜR:ÓÍ „”Ý/:¼19Ê9Lß–kð†ÁKÛÑ.‡Ð®‹©®B³Ã…0D5™Š­dìöäýeQ:ò]vŽÄª'Ž:V48¸7# ñ¸-ž¿ã:Aƒ”µF4vœ©±ò 4FŒ‡Ïà;ÑžÏû´Âܧ $ ÇÅÕ„Û¥K7=n*[ÞÔI¼€)BË)è0²ß#™s£¶£â²™”0¬qŒ Ü-–©ºæžï+aŠ Í] sb£&0.Öße–«š,`-b."0-P÷!ò-ƒŸ‹a ùgH‚„wôúîÌÅ­É"&ÍPÌ =ú}"¸éÖ KˉÞK(à¡ 6 }0ACL¡°Á%GÛŽÆ6("Á‚V®¥Mî7ÈÕé7€eœEKR„‚ ŒnKŠ:Ò]Ýy®Á³·‹Ú+žä©Îí7Þ‰cƒ`G!Iì0³w¤ÏžSË5Ì¥uþöÜ\!yœšùM˜Ãï å’ÃÁ„eb¿¿Åñ…½¤¨çERí×q¥Öf€1×+~uèÈ"ÎñÝAUhÿüì}UaÙ€h$ØÜÙ뢈JÜïã¤Ê®¿©à]T„‡ÐÇž¥9¯šÊ÷‡xDи'VàpÈLB¹ã™ê ºT3ŒÊº”jGªù.2KÅ‚ƒ(: Øïª`]ºÐ›h¯ÌŒÆ³Wh’÷itž]Gç9¨\%dQ®&ÐU¾é¤h¹G°b°ü%Ë1ÑÕ õ2¦h.ÔX[A4¿¹¼³/™ üu Ãô°fîtt X®x†Â$ÕÕ-³¨$@x¿ D”_B9\_+±íà–R"w3¿ªhóChuÀ£OŒ™¥Ð<¢ü°Êå{8iÍ`ÁÎÿÌ ÓîS~{ëšJh6: Ÿ~µiÑÒËÁ^Dß0«´’Κè2…-ðxXùšÎ™AªN ·Z{ºŠ¬/íÍH!ŒŸÅ‘)³ÿ·cŠn#J.Z¸ºòO”×éØñœG\îiL ÷>rdA]Ïl^ro+€¨OO}àŒˆÏ›û¡0¿ŸW'ëxÅìôÏcÖÎpXDßæ,;¹-ÀŠ˜]0ïZP0ý`M o@ÇýŽô™’(Àc‹É] ]ºõ!¼?Gó3Ìû‰ß.°D`õò¼Ò®ÐúÁ[âì]ïæ7€‡h¼#¥ÍJc€ ärªpŠÌç~½g‡ˆMžÈÝÐÍ¥î×ìQÊ_$Êñ,RF~w5¹…ÝÌá€'æ¬(l9"äžJ™”ú<™1ÂÉ7žé@×Á&á>c 8ãŒ4÷q ¯þ? T²Å›gP ¢k<ü2óörCÊ£z;¹¡£“!7Ä ¸pn%¸ýÀÃ7'hÓ¹å5rC.ÖGc~õÜÐbæ¶iõ™ëìr9€ÏŒ Ö7…·€®@ãb¡Æ ÆVàæV8 ¤¬Âò܆ŸܧàJzžnÄ qh?U… UEŽeߢþëÕò]FJ¼ ªá¬í² ª-¼áR=àJ÷RÖæ•×üvbÇÈ´F¾Nì8œ»`M¦Ÿï»Î«tÈÚ;ЬŒN•®Å­;ªß¯ÉssÓš"²¹¬E ˆfy²óêÕ9ðí±%0´rð0Ô®±¿\qË'øª®·zÉŽ¦è`ÞæûòÍ»U¥7ܤ<‘˜ódú[8AÀ‘=»¯ß¦!.ÓÙÞÊ3m9ø'+¡Ý8`3 “SëÛx- `+£'ø¢‰[ŽªÀм*­y‰î§J©8•à?ÂsÚ·‚ò1Ú "m ·8®~ý-î [òP"ràå2Iéº`ƒ´ðÑú™Ž-71t_(7ñÜb¹‰1ƒy£ÜÄ8|rÓ‚íõHBß4ÎÃ-,è2¼§|çðX8wu¦Ñ²+Òpí ˶Ý_*ÖˆS>B@ Æ Ýˆ :¹£(å™zRXvÎ’3¿ƒè*b‰‰Šô¥÷=; ÉȃˆKæ ׈å(ðj{n:s¡ñ-0IÑý À>ÚuWæ(âk?¥Ö|ÉL #®ª4¬zõ篩Dz²æ%•,BÑ)eIÕ.r¯7”ï¡óM‹ÃœÇÈ… ÉC¨æÒ5¨€}Ìô*!6–Z?œ[Þ8º_©¬ò))î»?97?’Œ¬ ÿËÈnQÄ[뜃wªtQI+”ïuRW…ÁÀ<¿e®¬Â]Öû2­¯àUùm¥^eü}˜ÍçME`eH`â!Ì£•í!®åï£T®Uw9êRÞãÂ7x½€¼÷ˆÑ æ5Tôogɾ)⓲£iz¿Á„ ÄÐbÖÛg t©æ×;º:Jߨð ‡Ä\#X1ƒû2ŽÑØ '0ùr,]o!J±rãaGƼŠê¶<çÃÄãÒ™9È8$1™1«óß4B…FãÍ@rwèW÷W›–|ëecz»c9ªï©x¸wú$†%¶E$VJØÀÉmšÍXfSªÃ{¡ý 檕©.Ù´1ëüE bWvÉš°úRÆÕwA熎Oäÿnªì‘" Þô£ƒ‡)Ù †*ƒ‡DÈé–<Ò¦…÷΀§ø ySæ{ÊÐÅèÆEÀ¬Z®Ò– E˜aH!ÖùZåžG\qÈv¿¨“öÄÔ‰ÜV[……¨Ôr"`ú’‡ŸŽ©'®Nc'™Qz”Ο£i¨„5VWóõ_½µ;ƒû1šùsI)5ßuJñ–¾j;¥M{Þ¿íçñËÏ ‘øÒ-•<\ ¬Òkïa‡¿~C;¼ŸZSN;x›á‹QÕ¥ÍØßáŒ!vås¾Së!µVA³2;O¾-ñ²Ù—|øéÃÔú^Fhùu3ÜÃTÿæöd&xIê{^Ý^†âÇùÔ>ZB^`žµsœÀ¹Â9‹ÇQq Þ}<ñ„×—ð§â蟚¦ý<×óï±"dà¨ÌÓü<õ¼@èéx‘y²ó½Bh£° øØBh÷Ë ý+—•JïèË¿ruÐ,Àa†XEŒŸÊ:Kéñr~œ3ž° Ä•+Œ†˜cÆN?¼6µ¼úË`„…°D.¤<Û5Ф`'éŒf½šI>;6¯8Z,]ÂvºT×=ÄQKí/i‰'_*¹Ûý˜ˆ#:Ÿ”{“í}Rôw³¦¡–€/‘ê¦ê‹4e]ép‘i°X¼„¶O“]áF(,ñzý]ÁøŠÎ÷äUVD ™~,,BÎp[ûUz²/¿¿H»ôxȤ Åh\¼£ ,‰ƒQ¹c Å‘Ñð¢wsËk0šX#ø¨ËÛb´#——sÌ>­Õdyœa–¿Áò`„ÁøÈò.J^(ì{Q¶Ô/ÞcèUÇ1a=Uyu\fHRë0EÜ´í…Âf Þ½Pôj%:_ýœ?‚dzá³ébÀ†€Žxq‘vÛ6]Y”oöÛŽJ'Oàø¬ÀVD‘ÞÆ[‹[»ÊȨ&‡ežë>;ùÎhgendstream endobj 103 0 obj 4880 endobj 107 0 obj <> stream xœ½<Ër$¹q>òâ_èØ‹»Û5x?ä“%+R8ìЊ±Éî3ÓÞnrwس»ÔoØ®3T!ñ*69#ŦˆF%‰|g¢~ܰ‰oþKÿ¿=]½ùÆnÞ?^±Íû«¯xøq“þ{{Úüæ&8˜<ó|sýî*¾È7NOFj±±ÌOLºÍõéêÏ[¾cSÞze¶Ón¯¼Ÿ¼ÑÛ…a.”`v{‡Ê9¡¶ÿ°Û‡ÙBj¾½ßåç»Ý^J5Y§¶7ø('ïÌö§+Æ´×Ê9ÎÞoŒw†’åðGs< ?„IšI­øö}=ÞÁñ&``-ÓÛc\Šs³ýŸ0ê½’ÛïšÉa8íB8)â>asÖo? –9œé¶§EBµýßÝ^>§·ÿˆ«¥0Û㌊(ðŽÕ€®L” xœIÄ×—ÇIP?ÑY­ù\¹ëe{xê\MÞ ¾ý…Løap0w»ÿºþÕv2V³]ßk…¥wRÛâù@—<¦5¹6ÛÃ}DY·=‡mkÁ]¹ÒiÞžÐ-÷ÈÉp[r Cq Ù{oö<ŒÛÜK ОK ³òq»Í‰$Þ¬dÌLƸíuXAh#äöCu \dñ K&Á‚ÙÀW^¬c€ á—íÛ,ˆâ}œ`˜oQ¾±ÃN€°KÔŸM°»¼u±³\­ðÎÂßïúÃtvx–LðrÉÛ¸Žcnû'ª¤~Qáê¢õ ýFùþk#Ü$ÌÏYxé¡Þf0Òþ¥£³AÖIcúD6p‚QŽÄd…ìÉaçÛ™Êz„™\*k8=ÏEsz‹´’i_KRDH¼®|£²Ô'w”¥´× KZz²åYWÝdŽ¥‹Ý'SèZ··¿æ9%ã®'»ý˶A3ÌžÞ“•@~…w ¿¨G g p[o¾áœš`¯'ÇŸOé'„´mäòx†É(™éñ>?Þ.sã…•—6aݼÄ_vDPÒ~R`ž“ÒQš©Zé ¸ë¨‘åtãY* '2åDùšªçã#¾ Ìæ]©vèy 31÷·Wˆ‰Rî*"¹.Í Âó¬´r«’ž)u3÷&₊"ZØZQà0øM?>D©+Â:¦@ñL÷| gA•ýcÔI šŠìµýçÝõ_í•´“e¦²ƒçXL þÒ:Ãq´Y‹qdv_1»wv‘§ûšQX;R˜8½x~‘’ôW6!lÓ”SÙfœâ@v“*5Þ[¾ŒsAW:QlÎO <×¥6\9³ð:µQ“EÖï©#°Àÿ ¾Ê*æ«5ÄcNûŠ êœ{´À<$8â÷Ô…OÛ)?<Æg-Íš»™HOxƒ¸0g2ŒL®Ùdµ, 1Ëê ª‡6Ï1+ǺœÕ1óvÀ”Ôf?ôüŒ’%>1Ê;²Ò§4±õO…kFXŒÌ™qÔ­ÿ„4晀'ž£-°|ÈX~L`\ÇÝqתZ4:Gà|+=3aò®“FK\(%"~³è¯$.»/é‚ñw[S¾Šg¬'Æe'Ž£îØÂ6B™‰³î´#LÅ}ˆŒ„B ™9¾á¾Ócœb@þ«À¡H^hµÃ8 ˆ©‹Ï lºÕÏ1GÜEÖÏh•°@ïÔUža«‘8©O²8„­Žoªò`¯^&]‚ßÊdÏÕ,¹—Ìp8÷¿ßijñ Eþu<t1[e1køÌ‡¢°ô—ùhIx¸Ÿ˜IÑ­V2n°v—"YœJt2 #ã –Œ?Cÿ8¿ÜϦyî#$À¢8îQV¨qµðÝ6øÂa ̱êTEæ8W¹Ø>÷™u‘`uõªsŽH¹NÁ.GÊ„Øe9«‰‚Ôt|¿Eª8Ëhê&“Ð7…·÷IWÁ–¸¥ÈõÌŒã<'8:ÍËŠ÷´OƒDìñ]‹q0jÆ‹ õø©&5É%¤KÏ·Ü¡Üñ!,Àåœ>¨Í ’ÖzÐÝ¥Þ}JÃ!WµÏX âÀOJÆáÏ1O¢Úq&¼Lk¢S¢ym¼Ié ´ìy“bñ&áÕeT/íw×W¼“®7?_±Í¿] ú  Æp»›ŒXПn9^ýi˜ø®0K™o€€l‹€WbâûûŒÐNoðr…³Å˜Îñ¸«_HÌÎy»)¦œ2Ä7yãµs=èœkV×òŹF­ÀðDé[}—XŽ~4åm>ÈVÎ2[IØÍŒè×\9˜PKº´Ü3Þ±¸Q¸ÎÔøg¾UrÛE²ã#øŽ(P;ˆ¯Zùòˆ7H8†ôðR•—Ix¡µˆn©“Ny)Ȧ]h ãs4RÖÊØ,À…ŒÁ«ÀIZëHaÖ•—Kzå.IªÜ& J…d"¾ tx±ë{ÁØ\ëƒ  Ñæ‡F7N—›§Xˆ-Ó%+é‰Už;ÕŒ6ßq;iPá¿Ù-Ó«dB"nkÃîÀ¿þRØÄ•8súWYÌ,Ì ìÂx2É*êVW)ÿxÐ#7!†Òò碚™aÚ’÷lúSt›6RzîßùÀ:—…݆Ñõ,ûâÅK«&xã%îw³*$4Ž…jìZ‘±ô…$–Áò‹Ï!ZPŸd"$cÍ«‚Ìð.HV]#‡r“ˆÌå3!_›"Ã/@±_RPf¢•þr†!Ý,4K¨ŠŠmUÒÅÍ;^‡aØçÍ?S‚µØÛ!.v}gð• â¾ý¼¿R–b”£$hUž§ühò#Ë6Pd—‡çQ›Gm•yTæÑ»<ºÏ£<úŠ[æÐ1‚ø à#p »Ó>¼<Ú 95B†õÑIømÆè«ÊU\«±L±e€ñ9{¼ó¥¤`×B ’–¿Ìè¤l3Vðš vŒü’òŠVæ™Üàe™­PýYíz ‹ISØòA˜ô‹ÅVƒ`…žæeü¶¬1qÌ‚)[ôT¤¢N]Å]„¬hЈ$±),ÔGGd#98>:Š,Ç?pžžÙxrÉ-0Š)8oø$r& Hc÷2 ¬§¢K’fßGãäÝ\(OÏïó”OqØak` 4µ A8EXé£÷ ιèýr!¨– ŒÌÜöۇ݀t%á÷—IV@ 3¾#XÃŒè­ã{ÚÃxäÁ„%φ¦#Ïz>ð¹ª-x$¥{…\ðä/1íEîœ:T ¨î§åЮ,V ÑŽ)%ãU;ß"5K=TÏ9‘0ü´pz‡GÕ¢ÕHAÍÒ«EUÂ÷dOpÚŠiÒ*Ìa#Ÿ•Nt…N|U¶-lYÌIž(£<•’ä$U*%m'ñkl®xó,ƒ<É Ö­Ëšæ?fîëffYÈOÎÆ$÷Ñ$F?µAæòèÇÝJºdʆRõ6ÃRšhø¬éà"}U‘]scÛ(QúsT b±C¶fAiÄ  z&t¹ ^•¡@,2(ÙëÍd¨‡Ðh”æ ?à=ɶ– °™15±½Çmÿ3;–T^ÈËîâò¦ÊÎÒåoÀº‡nÐ#CÄêܤEO; ؇£Ýz3e4jRÕßA¬³prÓ_'‘Ôe|m䔉çûD庵|9CAAÒÚ.X‹Ìi)‘Û™öó~J×yÔöxž-‹(#Ëèuåz^‡/MѪKë’/â×¢‰JÏÀ|Ðá¥] e °¶ šß¡¨+LoP±¨#µ6Q‘u“”…j>eœä`öW+¨É4ÌÄ»]¨¿…‰ g»4‰/(ÉÔÇ´\™/u¹° ܆%0 U¶ÿ˪úM%7’HÌ <¨Q"¨a’м«… «ma–c 2›¯¾ñÒ î¢éâN½Æv¼n³=jr¨a”ä’?.£ƒdïyƒ%uðî?Ã`! ðDæ<Åalލó0Œ±ÃØáŒÐ¦ý€H×¶l#”ªšWØ¢Ö=jœ=²jÕå¯ì$lFÒ­â{ ¼.lcÓGUUyšÑR} ³ËÄë(³D³·´¦qÍjÇE¤\G_Dõ^é‹ÙD‡Îƒå^zƒŽóQî»¤Ó ¼N*!æoz"‚0™® ïíêÊöª·õç@#/ëöÍÀi^4ØíuUUL[åHZ8›ôÁéDæ”}F#ûy/[>¥ÁÆ7üµ8‡q ÛL5꽋P„ôõÅšÛ\.%0ß2ßÛÑ"ùaG¶¤—X¼yÁî³ÐjíŸ×J;iDÑw¯F¿”r“› VC ·… ¯ùt;¸©÷E´»È$̪Fñhì^üy‚šyL€Û´¡âþOãÅõ(Jôy¥ó&u­Æ}BŒ9¬ ] + ÎÖ…|aÛ2á&ËG)…¨ƒÒ§*‡¯*)›X†1—s,’ÜN!}ô¾^{pl‘ 8WÙùž²^–/rŽÈ}"J{—ß3~|kñapPƒòÁñ)¯Dyýð>Û§¶{”$à tV½šÀ#*ÚôW=W$pï·;ÃðEˆáN霥%kµ à3EÛ:áR+#ãøÆ?‰ªÛÜr÷ªZ ÄÊ!æJϵ—U˜“ÙºÇOÚ9-)×7€¹#®n ÓôØÅtÔèºòù@-QÕ(TÛdïa þenëØMïXjþ¶Ï—Éè9wéÐkÁ;ÃO ÒvpŠý¸|ŸGßîöÚûp)õŸò(¹½v—GÏÂ}½½0÷çz§õ¥·ò\²Újÿ—ïŽ/þK¼BoU1‰p|²ZÍQÉk‚’5ëÔY.IåŠö x¿Ô½°Xq^b[â<òŠŠ“‡â*ðø&/T¬8}衳ß4ÄF{ ŒŒl­‘NmàEWV•ƒU{ÛJ5þ®åg&ûLìV|ŽÛ,Ñu‰I|H‚àO™»îjF‰ŸyòTürVŠ2j$:ÿ.Aõòv8Žç±¾—ÌÂ9Aw«½ÉþPÓõfTt;Wj: 8÷ƒäàÄ“1VOºr>F€°j±‘˜Ÿ’`¤ÊüT …Š]š¸9+*¯22—>¹: «AY•Ä ôäµ7S*‹*ù‚ ĪÃU±Ë+Z¤+Ùcž@lÁWËhWô<Þ2å•å£÷* CO¼u‡—4CLÏuüÂpÕªî.¡ì•ÊB/`–x)j®AVŠwV¢ŸQÉxI%!{ÎQÛ×SÒ¯¥óÞ;†JZk=)»Œ¼BI`i„€×ž¢’>u•ô©»=¢¶žVU·6ÀÊ?”ü³¢º%v£ºñÆš /L{AD€âþ¬ê6ÀÛ^ÿu·-<§€œãt*¢³Ã‰F¼w‘xWíDœú¶ý=guÃ|ï‡DzÊ8iþ:~çÄ7æˆ1èÔKm ¼õAÑÆ3n:»Ãþ;iCÄþsô,‚6âEjVKp€üßIÏb22+õš;÷J ¼‘P…ã‡Ó8š _u ÞU£<ØzŽ«³¦Oþ\^Ó›«7æ+¤N*eU231kË@–t¯>͊Ϩº„úX pž.,nŠëAº`á«2€µr¢l%:ž…y—âe½jý†>¼À½ãqáðâ‰;)¤´SÐÏ‚N„Ú£Zç|‘²ézŒHÕ|O ‰€9òúËx¢å·.ÎýÄÛ÷•D¥í–K©Ã@k‘£KëÍÇ”0ý»ývÇ!ÎUN$ç)}ˆÈûÂ/Šé*S'«ÂÔº[÷œ>RàÜHgW_À¢¤aé»VáëDÂ?}óL3amuyyAbUtPª]g=”ó–ÎTmïtƒ÷D¼Šn<¢VÚc±}Q þDv)’gš%lš‹‘–sM«ºL ê],d&’zA',Pƒ×êë¿»`ÎYá´¥õ¬pðííàR-¼Z7õ>žAÄ©ó‰ô_Õê>÷cœÒEd¤*ÒÅñ¦±÷¹ÓNúgB¡Tå$ÄX"¡Ò9£K"wʆUkva>›B)?6÷‹Åœ¥UÃ)”ßtÐèõ9ÛKaUÝœôásÝœ²ßÍIš$cc$—¡¶š;*i'™B^Œ œýEÒµ™¾ùÁ\´Û+¼?&Ñ;²íàl¯w†.¸=ßÁ‰Š¥þß‘RÿOÑoÓm­,õo>ŵգç×õuÌ"×^¼F±nKí×n.íÝDˆÚŠŽa¨Â6ïá—Á¨¤Ýv¦X]„Ñ•³æ#äfDÕµÙ8Ç4f·k&£TA Ûªºùzt€·òÙ1mïçSbU~P#˜›@:ÛûUñ¿¤Ã) ™øOÔÀ´-ªùÊ¢mDt3eS°Œ ™M€×ü³LOÂïF”6YfÆ—•åÜ4+G^Áü¡&P?U;,ùÃÐ?’]Çyå>v‰áw¥^ø†^ï5"˜•|¼t4Û›cadÈ•‚Ú{ÆïyL„¯-2ÛÿVf§ÌÉ}½¤ÍßNzay“&‹[ÞXNyB`÷¢2›=æStdzx.?/)µ?^ý?²ZÙªendstream endobj 108 0 obj 5188 endobj 112 0 obj <> stream xœí\K#·rÔ%AG)ð´ù~ §¼$0Ø™›ÃÎseK3ëY­wý;ä÷¦Šdw›dFÚqÆÆÂ‡ÕÐìb±X¯Š–¬ãK†ÿ¥/w‹Ï¿¶ËÛ· ¶¼]ü°àá.Ó?—»åϡǖÎ3Ï—ç7‹ø%_Z±´ÌwLºåùnñÍJ­YÇ”·^™U'é|}æ½ïœ4«/Ög¬“B!Wïð7ÓLjÅWwôKøš+ï•\í±]xïœYmî×ÞâŠ1íõ¿Îÿ,;ʱÀŸvyþåâüw߬Π¯ ›×ë3©]g¥\Ý„.Œ)h¾]„Ô|µÝÞ¯…ê—jõyJ0»ÚÜ‘>·HÆvÞùìÓ7„õë0=ç„Z=é½›÷ú-%ÿÉûNAûS2׉nûyठpeeF/ŠÚZ¦çíÅ»úïHgÿšôy•­JÒ9¾ÚÐO?ƒv§wŸz½æ &ùê§ô¥ôI¾Z X÷ív¤Htãvß‘öݰĦƮ¾›IJpèªÊ&ï¤A«8¿3¸Ë&Çc>RÓ‚Ã ÖÜvN¡ªŒ]'|)¹A®ICÓ‚?ÄUVt"Zˆ´¨ÄÞ̨©´!„yI¼¶«=áðrüù=ù² ó=ë'|Æe§µôqÞÿíá˜ÏbaZHü›gæƒË+$ï—™LÈbÜÍ ó ½·ÛŸâH\efrAŒ*%³O_:Yˆ ÛAV-ܽMƒ.çžêZòaÉIo2æéT¯3¢—cÁî=ÚŽóÚ­~$=6Wã(ƒÐóAâÐZæÞë&#]r—Í¢5 ÇGNPÌ8¢Å]Â⌚Ë]ÂõEÍj,ýM”÷v²hÀ wzµ¹‰SVM;®¥öÙ„é¢>2Ÿúȸ<HÂË]ƒ"%’λ¤ŸTË•htI&Áè”JF×;&PéŒ{¢¡ä'Y ú!õn-qD‹Rî½¥EÃUÑí† v?õR¬¾]‘f” û+X×¼à«õXCŽzoˆ5BÃ3Wé 0õEx»[ Î’*gš5g ê÷ý4šA¨é®#y£léT€¤ß—¾,D廑$]¨7‰Ð>ºñå\ÞDf„Ï)¦h&\§Úe¶—ðå|Šy‚d„¨`‚d8©‹ BhŸµ \`ëU‘´Éñ$zT\ªß®ÉÿéCç‘j²¾ \×= R@W2Ù±)¾¹ŽíJËÇ•ò’ ¹ø™vG»ODœk…¼Äˆ/zÕÀY¯OàöT³‰’õCøÅM0‰‹:Aª›Ëž¸£]¨ßdÚÞ÷ÃתDÁÕ©DË`Ù@Á@;[âD”6ðOåAÑö*õ1rC«TýòBc±¼<Ú'è ÚùÞhŠ…Ö8Ú ¶éñ`Ô8Ï'8¾õ2¯¼ïÖgʲü™‚e"J¦m@ÑZŒ†‘í$ÖP#Abxç …Ú¿_CªÅDXih¸O5‘ð™<ÆDq½,AÎWbKhAÖT"0€*8àÌí,æ‡,XL¼VJ‡6 ÀºO,H_øa ^ Ð]Z—~\T DÊEím¶e/ &RéÎàIé¯Ò«£BL-_²Í$+r@ÜnHrI]÷u4­ÁÁÛÞh†5à§b²ÌMज़cä6Y䃩Öb4¢£¡4¡4¹p”Œs¤ÉP’+‡•ËLkGÿØ_ѯޱ™ý­"ˆFŒaÖ—N(Z ͯú`žGð,‡-°l?¼ô0m™Ï~¬ÈƒN@zÕLô‰r¾îi˜&ò:.ºõËR(Žæ§p?6ƒ«)Ýn°•r±‚b ‹¥'¹A4 Qg(<<)lE\ôù×2+”“Ȭ Ëð¯Ð.Rþí¨‘ñ+”CymH×n ·Òúh¼fÎ#ŒM­—cë~lÝŒ­÷cëÝЊ#ÿå|ñÕBÌ–ïlù×ÌFt–/µ÷Ìl¹ƒ0¯ÿhhy¯°IË_´’ ²¤:NPqá:km¡â—UÖÞf¬=£¶{˜®p¥*yX"g—iåÔå;S—$˜ñ4¦›YBwWŽÎ&Ó¸‰ÌJSI³fVï¡‹`ë= Ä Ã~ºÞŸ—ï˜L_t+K¾À‰žËúvÜ61¢ÍéÇdYR9kc 2Å1A6V‰I‚Üïö1ez³{rÁ&I\–yÎÖð¢\BÏøQû?eþJš‡­<œM^%j¼™¨Tâ¼@%Ða>n(|å;2erI¶&å>¿+$ר3¿"6´™f”Y]8à4¥Ÿ<ìOTu¥Q¬Ì3T"ó,‹õkåV9"õã¹h^`':4l&è¼RsU!)ŸŒ±‰ÁÓ A™‡niY§²‘‘|s4€xçßUž„L‰'„÷²žr ÔÇà×·ý”±+õäè\Ó°o0ìç€}§°9…SÉËõì\Œ:˜Ê¡2Ãm«D9_ñSQÆ×_®”êe—R¦ÓžWj9Á¸”ê”6…q]Ì]aFXe ês¯’Ó7½_âYY¨Ðþ‰tCyËšš"+j’™Ù–ünª ¥~˜Ê¼ha>üK4&µœ 1x¢Ñ¸BcFæn6Çëa.¨€‡ºœÎÿ…eì‹#e‰øŽ¨GQÑ‚)ë¼ EvqÊ3~õC`Ê>¿€çç?ë:-üA›KãFLJ4ÈbŽJÒœ±•ºBä«¶ ù³þºø´4ìÊQ»HÐ+ Ù·ä÷®ÏA@3¼ª8ÄL •µs‰LgZiIãM+-á a%_ j#gÏ,%>ólü‘LÆ>’ÈGŠhúñÄÌå´l%Ûjd+ͳ Yæ0{Üçg+ÄNßM¥V9éw]f’šÛ€ç,€‰Î=œRšKƒ~åOƒtã|[Òœ¥õí4H£“â¼YßFÓò—Pù“†I ·}Ëñá(€S)És6-æækZy)wÆ•)T¾Ñ§¤<„©&!Æ{K†)Ί`s'gÝ\Â.âÀûâ¡é# |ëwv5 |q•÷Οϧå=cAÕÜ\T ‚'˜û¬q-ÖRz“›+ïEÖMy.-¬ÂEeõ ;|®ê^äúSuï…ÄËOÕ½—ß8˜‰§Õ½¾å„øÆyǽ|r|ûTÝ{´º÷húüËx/$ «ñ\ 1¢¾åx# F– q?2÷ªÅÜ3n[ÞÕö‡- GæO1Ьü׊3甀=%˴Dz€-ëlÏW2  ^c8а·9GJ+:ægö‰ÓÛ'†Î†Ù¹OŒêˆ5¢HÆ{koÔ2£X9j›´ÀgèHÝgÄ]±OŒ#iù\H2Í,Ï­>!ÉOHòÿƒ$_x 6J‘dßrB¦s¦D’ÁOHòQ$¹?À˜9Ì>ö–ñóeþåïÿqÏ „Hbf}Ëñf€P:o{QeŽLä~lÝUû“܆Ÿ†I5LD0§Ñ+Œœ»N‰&:§y>‘Ëal*Úë±õ¦ö³æ/8Çk Ó·Ž*²@圗ÍpÑgø&ËïèYÉÝfR7DP.Mk‘ØÂ î})mÔê7hf}¾6Íí dQM®ü›šYè!³Kr¯§3¨üžÖŠQ>{ã?#AÜ®ÄVòì–¹H!½È}•œÜ*ú)5—7¥âšÌ™Q&|¼j­§HÏöÐH¼Ó„×!„n탲ÚM½=R cñH©_ý-t8(\€«*,Ÿni&þòüñãlÅã¥f0&MNáÐCòÚ¾ZqI‹Þ€•*³T L*×ÜhÿXv‚ÎÌÄËF8¢8æáºår•u)ë@´Æ15 3Jál<¸/«š·Þ÷ñ޼õĦ@£H°J»£÷ï6;‚Ž‹×C_ñ‚UÜfÐgöf¹j8 ?½\“æY xlö²òŒA"s»Î®åîÈó iû r“ßa½œ›½ßE_²í?ø Ï„+ˆrÙÕJWÜ㊨²aDkiæÛÊ*ºø[1UªéÝçªÂÛ?@O÷ñèD«?u¾ß+ÊŸ?“Þ“ñý‘ð»¥v­«Ò3É'ÒÓηÐsû™žú}6p¹V X°™M@‘Kß響?\a=ä½…¨¶rïùñW`l¯2¥?þ-®I ¨²¯)*1¨4Û„}pùJÞÜËálEt¡^¢›7OvoBØfú“7‡»áØ—ü 7!z½ñ¹˜£ngü>Xüäâêð2•nÙÉžÊA€>‰k=³o„Ä Zé=}YhZÖK§WÈ+8ôï‚R¿OøIÂd‡Tlöí•Æ“=ªÐ:ÉbÀ˜ù%Ôg8×Ð/MSË ‰#¸Ÿp?uÌ·H’5ÝéÛV[IÕæ ‡LŸõR'ñÄÄ6Ûâù§PÅ,« øìV‚„aåüÅ´Ÿ± "¤ufíPÈWéÒßÑ¿uújñ?r*Gendstream endobj 113 0 obj 3747 endobj 117 0 obj <> stream xœíËr·ñÛ^ò {Vy'Ïò-‰“J.)'¼Å9Ð\“yV¤Ä•%ý}43ËÕ®i‘²K¡š˜F£Ñïî}³f-_3ÿ/ý½[ýéßf}û°bëÛÕ›\§ÿ®wë?_â°is|}y³Š_òµµ-hÁ׆¹–á–ËÝê¿Í/Xˤ3Nêÿ]þ¿å¼øÖ/Åï/·¸ûw Æéæ]XJÇUó:C¯3tŸ¡]†ÞeèëêOþærõíJ¶L­ßãÝþ¾âJˆÖjE+ùz‡¥ZiFH¿úÏ"&·H@ ­ÒªäÀu¦ènöN?gèúvî¦ãEB½`J´ÎA=bhÙ’úø š¤$wºÏˇqŸº’ g: Ýph•”.¾ø_ðpNšÈŠãYàZ-•DîpÙZ+d`—aùöbƒG9g­F6ÀxË–Œ)‡L»ÊÛ¯óò'¿¿•@ñõd½‹k¤ •’†s4".™EèÝ€°¹¢ßÅ z :@ßlïȺ»²5šY¼,®,ãœ"ë!8‚LrNðæÙpOÖ”cŸ1L£ë®|Œ ~‰B%šŽÜlÿ#ÙóCdƒ³åÕ(½Ýþ!nòSü7Œ‚C¹¯­G”;².Yà% @·RéÁˆp²¡½ØH-ZÆ\ó¿m¤8wd/7ˆq|ïÀ$p”ièýïÞ¶ß&ùPÐ|_ðk8Ôß`3\!(‡‚¤õ£ ¥²±![‚ô§TCd¿7=5~¹%à¯ð¥kÖôËÀ Å@IŽ»ã!â3 …\0¦Ù‘ý·dùp®BñóZÔÜ÷ òH méût˜ã–…c5…îv*c#}…À<`‚ YÞ;"Çg%‡þ8Ϥ×ùÚ×JOÙÝçÓé5÷!ë6Rn´­”&0€/¢vådj£¼R¡’9Qß $ÝzŒ $¨—¯*G¾-_oÐ5*–„ðyyðÁmkå4j3qÛät·Z ‡¼öCቧNi| tl¥/x¸$8Q] ÉñRa9šR]K‹õ¶¬phwMaÁ©ú&”ÜÉ©áõ`-jc¶×ôÄØî5n¡æ¼nØNDú§¸omáãzÑëz Ž CÝùÑè@:C_ Lj&ß^pÓZdµ”éœ~¼&4ÝC\¼ò‚m¡†ÙÛTëZe½LXÀÖ†.1qjè‚$ŒQ×¢{åjP7ªôõ}â‡ÛÈ*©UˆV{P¶fNäÊQëÒí+³X™è½Q1´SiÛs|CV>@íÞ눧<žZvN(ˆ+ÚÙï®æŸ–Šmr€CƒíôÊñËû œ}$õlƒÏ›±þÒ6Ó¨Êû–ÝK>apÊÂ~pŠR5»»bF?+*ílœQ¡Ú+]å ±¿ÎëwùžÔTìË÷R>:å>‹v¦©Aô!Áïpû¬ýÇ`Žkêwä ¿Ã<·ttõåLæüŠXÙÛ Da},CÍíhâÝ©Ï;Q`lkU‚9C À´Úš¨ÛYâ~¡Ç‹þ_Cø)3©ê¤Rr \懢övd­ÌËåÒ×Êb¾]Ö?>ŽÑÏ©¨Å¤ÐóâM)ã¶E‰%ÈRÄ0»ãɖΗoŽ—¢1² º2Ð55¬C Á¹qKU{LÛ‰‘ÝWµÍd¸¦†SújÀrtþ" çóyLI '"òät‘G ˆ@'òä"Ÿ7˜>2|xÜ:E\¤ø˜â!Á¯wTŠF’m¯ ’GEKÛIDBÏ'™áÑzök(þõL8˜êY‚œ¡g…Cœ©ž‘næU†ö'èÙ¿r¬ò}-âA |;*ÖVfj¥‡U«xâ…ŠÎØé˜èÄ(µb8U;g ©íäQ}£e)z½~@â+„£Öð_Ï Q“³˜€O•{4/_YÀG¢,äteA ­ºR–™¸ûãã0%S–ZšJ HÍ?kôbóo6_<-¶”“-e«Kv”J|Ÿ¢x¦÷*/5íeT«i)t€œ¡(þN¥Pr‘«L) ígI&‘^7ÅæTúqù´5# úìÌ „ð9µO\|È* *K¤k?IxÆøl¢I×UùÓ/¬Y8žRˆŽT¿ÛéS˜ 9œiþºÛ¬Ž==n©=‡"ÝÚÓ|‹—geåô&àWˆ/Ø 3}KÐNÆ5RˆÆ8²'¶Ê&ÂZxÚ´L Ú:šÑÐm_¥(¶]þ²+”ö›Ì+DÌ Õ¡“˜qÄ šM¢© ÀˆTR1_+¢Wý@öw;êy*ûmLè»…ÖdXÏdIgÚ×>‹Ñ–"ŽSêL7’סo èIåRÿm›…ŠÐ2Ы§­n–s,"ÑñJ5öĆÅɪ¬Å’÷iF·0Žëb>¦kTƒIñ)›Ëtû+Ò&b¿X|ìŽ×xQ¬mZš:Ü\Ír®1ŒÔƒ1‰]&&r2<ãYdo¾k½RÑõŽ7*ÅÝ8§óèäâü:‡ÚCüGBÞóÝÙî'!0kÓ`˜K.+Š1®ÕÂ.Ät•]e²ô™q%¿÷¹‰q»(üþKgä/g}…mêhΟ£8Ÿš9z™¨îKÚÖѶ¶Çǃ‹ Æq €¥~äâàW9kxÈå±6µc!Ÿs е´|›§Çÿ~PIKSÅÿý,i¤%üv„~ÞBn´é4CžÉ–‡æ…]H[ÅïM‡'Z)Ñ*µ r†ØJ‰þGF±½Íd´u—¡» ½:^lŸt|V’ŠØ± ]‚xšù8\Ƭò (çü6§³Æÿ¤ˆèE‚œ¡Þ^é!9Ï6<± IE] ñp††øˆÁT"ò´c0•7D(¯ú‘»*L½]™á„d06)f3èIwY·¼b?˜\OÀy°œq'žÌTüTúOß_àƒ0¡½ ‹Ä2w¬2!°ò“•‰bǬB> Í%ùÏ4(õ7Ò‡#µ:¾J¹)`Ô1þ€h¦FY•u)}ŽX>¦—æu€$­˜Ý¾_ ªïŠ9íñ)¿ŒT•³uß%ÍP5˜l„è7´{Õ É[h÷úÍÕtç$^ײZõ’õ˸r¼e4b §[F®,þ-E ¤L½+Èø|qlWý²k®ø2ím&­Dt!7 ÐÁG;ø"½þ3—mÌÿè‰Èv‚œ!ÛˆCÁJ¶3'Í.>…˜ïÊBiGqõqáEJ¯ E…o¬&té·Ë ª `%úT: 4 ‚qLÐ_ñ}'_M¬ôpA¿]ý}µyendstream endobj 118 0 obj 2734 endobj 122 0 obj <> stream xœíËn$·ðq.ù…¹¹°¾É-‰$€ØÑ-Èa¬×¶=-É»£¬õ÷©"ÙÝÅf÷h4Ò&+ÃØƒzKd±X¬w•~^s&ÖÿåŸÝê÷ß»õ͇_߬~^‰øËuþqÑ­ÿt ” <ˆõùõ*íkR¬ŒÃ’ónõ¯æwθ.hûïó¿Ã^!нøé<ì?¿„Õ×°ZJå‚mâ§Â4·#ôb„îGh;BïFèíÅ“¿>_}·ÒŒ›õG¸Û_WÂHÉ\¤V2-Ö@ŒaÚ ÝꟋ˜Ü"s00cMÉÝ,õÝMl)8zf,“A‡õ™PÌhøˆÜù3ìQ!hgã5­RÑt÷øÕÑ"²­ÿÅþjs¦„f¹fÿŽü"ÂSÊ4»+€ í½ÔÍvüü°9ãLsn2VKfŽÈ+îÈ¡]Gé¹Mص[Rrvûöžþ·§Â¸â:× ìñ‰+¢%3¶&Jª¦8&l³ÿ¸†ri OôÀm‹ÅÉÅøùS¾­ÒÍÕÝ‘ïŽ|ßRvSìls+<ú9B•öɆާýè‚åÅýï‹;ÃIF /š÷ˆF†à½M•ÀûvŽõ*4Yô˜ÁV6?ØQö4÷ÌŠAɶûªv-¡ërüb;ëÑEÑ5*‹nIä(9; ‚¡›=<”4œ9œ¶`ìÕ¤¯ÞÜL™“žá}¢qñã"/#vk5¥¹!R@%‚m’^–¦î¬·Wg`< Ï—û¼l\oج 䎶rºa \•]+©8h̉8ŘÅ÷3µ]À·÷¢ÔFú®g¥GÉœí²zø¤ôÜl@ò¼×ˆCq)`c[Óh&6 i—A-Ð.Ù´ˆÑø#­W\ ¶î¹Ö뉽þœ%.¶‡J|†¼@â%z¨Ú•dD›”¡Û9Ÿ?#tû ·oÔoš2§)_'‡ª ׎w‡€hÒe(E8Æ„JÇÓòÒÕ…v%w’r9ÇMík{UûDª®‚ÇàhO\òÅø9UõÝ‘ïŽ|ßFíVÖAdk“b¢ÊŸÿXk¼rÙû4Þx‡BG4¾‡œ®ñ€^ÏT7«ñb„ògèöKBú§t›†x ’F‚þ3¢å‚ìäY¼¤ÿ<¢Pú7‡ø”z€9cJSõȨ‡LBÕƒ89âú~™%¹›½ô)yð7øì½v™Â%¼¶U˜uUR`orV”$ÿ¢cmG=_—ÑÀ†ÿl¤fž Q¸À‡9SÜg Ïš »Õxºx;:"¯ïúÔ^ÀºNäãÅt 8èÆ‚ÔŽòêC¢J…*ýÎ'm{ä…zW7H •Ö ÈeÿPi ãMÎx¿ÍÇéá’O-LÝðnpL‰2!>mOïF×Ðkòq“ÉÔXìH10>è%µí*–hZ½§gí 7˜.²fà2…ÆD9]fEÕMër ÔݯÁHqá™(|x†¼ÀHqa¿©ŒT;{‘W5R}Ô~ØH9ÉÄœ•8àmºbC[”Ѻ´LB”ølãûl]nC0pí8ã„Gs±„bîBÜëÓ¬RkýÒQÛÌ.ðìÇÙ§È4}È>áÂ=Ã>9Ϩ^×>E«þz¤A$S­ÔƒzÎÑÎíö)âvSûù¬+û”Ïû¨Ï»¦ñ'8¨rº ŒsW¨«‘¸íqŸ°¾f=˜“0c¸è3é+‹SàÜåõÁ–¡5QÆ* qÌñ™(Ä1ãý‘!“3£jÒ]¹pubÌäÁ£ÎDg‰Úm¾}PÇFM⨃Q“c µQ{b”ÐÎÉ×4J)Rò ôrlä{ŠÃQ“‹¦å‰¨ nk'V©/äX)^æÛ¾¢?sÙ׉›ôgm—¸4àþ¨]ÊØ%.Z‰Y"µËgÄB¯Qå ¯I{•‹Y{Úé…ndßZCD½ìáÏ/ ôÅŒP=Ãöl€tñœÔ&§Í>Ü æùp³¯®§ÐòlU€Äv™Ô3ÑW(!>,Û~©ÆR˜¢'z} áeß +‹9”EcCϤ†^,¾ˆº¡gÀÿ)U7ô†ngªßšiC/…B‚q+z….äêÎ^¶9ä{Aó•à³ÞDƤ¬5Œê}œ®ö€¤¶GÈ5H%tB8òm”h#” K\<Ž"³[žGHeò0tùf ƒ¶Ï”#2½Ë‚B<Û”Mþ·Û*Å58P*KòaRpœÕI˜É$¶ èÇKPŠ4æ/y@ÒæN|ÖÁqXù”øˆùqA Ã8ÈñžèíK¼‚²ˆtôÓ¥0`!IÇý¬t¼¡¤uú0g€h–” –ÃSµãguS„>-uúÍWDàUÖ!<øˆùüÂ*™9ÈßâY-¹”Êü×X,Ò¢ñ/biªîoRWŸ†tb7tŸHwÊî• Þ/„.e‹,ºÌ„OºUù¤™” —kîu…âV¬A£_µþØÑ¯H•šñ sÕÒ+àVÜýr!§ú2….  Ô ž¶š”\î§Ýÿf}ºÛº=øf ìEzùo ¢ê/ŸŸcJÀ2Ùe\?Û«ánÿû:SÜG"¶8ø&sa ÿ@6ÒwkéYñŸ›„[ç„€Û„Þˆ²7Cµ®–î)/&2±u–II+“îkÒD" ¢¶5/³ÁÇyD¤[©$6‡bÎ^§0i#)Û´SNJ>SºªPÕ\ÒšÄo|}`aòéšéðºµaëæLµ<¯7â‘ÒTŒjÉ||Õ³ÁïŽ2(Ä´£ŒÓK)*Ä«[o,+aXð3æ5 ’¥*RÙ < ²S`EöµK¤ô"â£Ì•ÕïÌÒ§,ý-ÆýöDôûBžrOØ^Ò—ŒÅ샧l¥¯—.9Àɬ 0Z"8ÌxìÄÇǪ*ÜCÁ/ÞÍSÓ×]!X4£ »«V¥Cí¤ƒƒåfn‹jçR¹5…‚Óà°/À³}ìGSíá*ñ³þ$„ªß|ÓCr-Ê‘¶ò‚’˜xµª$Aºèñ]ï7C逈[FÔ¹ÏQ8¦cû(l¶9Fœéyâ9 ï¥´GÁ‹·ËÍÇ™?ª±õ´GÝ<¡}{3rÒ>yë#LÂzŽ?G¡ì!§ ¥°àÓ¬¯„’\„ÔÉnFèÕ ¢ú— ©­Nå°/ñ •Õ¥ÁãÙq¤ÂÜ8Íëw=ÔÛ2ü©þVfÉqÆ®&ð+`%,G8C^ ÀJ€0ä<"ªWÿ¿1ù#2î>|)c„éÜ{Æ1Xäzø÷müé—„œG:»†Ø²|.ë%YH¬ö Bß­þ _L:Üendstream endobj 123 0 obj 2845 endobj 127 0 obj <> stream xœí\Ko$·rÔ%A·ô«NóMrp‚ qq¬œâôÜxFZI-í®}Нf‘l¶F3ë@k,|Xª†M‹õøªHúîxèÉñ`ÿ ÿ^l~ÿ/uüöáh8~{twDÜÇ់íñO¡Ó@éÍ`Èñéõ‘ÿ’kÝ3IɱL?@—ÓíѺ߮†~àF.ÿ{ú7ø–ì[ÛT¾?½„Þ×ЛR¦Œì]“"º›D½HÔ1Q׉z›¨7ÕÎüçÓ£ïx?ˆã°¶¿Ai¯·´çäx !z®&Êæè‡¦ŠU À½"—ÀÃ,ŸiM^,™DO„ì©áæø„°^ph8éü ¾aÆp%Ý2A¬” ÒmßÛ?ÄÀ'Nlñ‡ñju¨–d7¾C?8ºèÀÝÉÐóaFt뛹>&›ìÚI¤n É»ÍÐ FY6üè»hir2ê~‘š?…ÞÄŽ=Q7¨½EmÌùدNS½!¬ûÖNÄJ€¯Èº"MÖ+÷+¢z }‹ºbé6§ËTÝúÁOI —A¢ 7o 3çþÃ8ˆfÝÛ… §[o6I†ç3K`Æ((ÑÄK™Í„ÊÚ+«sLª^ MÏ/Çxfa¬oC›ÓÖŒèÃu!Øé·|jŒÖNßOâäNÁ ~™}LD? ¹üÑ0Xо©5ÈÖI¬47‘{O¥†fCœ¥ï.‘ ­Ïæwk-l2ô¢×Ó—ï+²›ˆ¿ôÆ'W –ìØU\g«¸ñs^é¯%kB»ãX„›+?¸ä¢ÛÞ6˜‰C2Z¿#kr€,Ø3£Ô ºÍEj?¦ubO1æû%xo Ø~¿òþ19'1nœ€CPŸ×kb€5—=£(ÀDÊþFè9Û-¾tï2ÞCÍd‰û„§UB4Tƒ¢û„~Âc!ÁŠ=Î-ê¾Y_D-&‹!Œr zÄ^ªÅ !ÌY Ð;†0×›‰=BØójOô«V{XH/1®Š”Ôž²ž‰WÝ&æ6‰ú”¨WÚò|jmz¦0Ÿ8'ì>8RJs>7¥‘ääÀx`Î5ÏRó~ ÂDFЀó[ûƒUÉh"™¹<­·Zàtơ̿ 8•[uÁ§²E ïý—Rçè tfh”­Ÿ Ô ²C ëtjé ìÿ¡¦Û70˜ŠƒÃоIHé£ç–‘îq–1ÙømÞ¬ ½D,ˆÁ[ †ù|3Çqy€÷2œOµvË®‘µ›e0‹nÉÊãøa*­ÄÛ 6†|7rð+JF_1>ø±#3ÕØ9–áÍaÒ‹Ôü } BP4°˜o¢^šnûXjWqåQd`7O“ ˜JjIœ¾KiÅEwW¢û`¹æ#Ð ƒ€7ƒæuqŸõG?Ÿô"¿0úeèAÓ ×œY-Ú^Û¶·Z›t»Ö¶E¨kÄꕸ¢YJ Å×R¾Ã½7Yft“ï,´¢ºSÇ åbà™Ù$É20ðÜÞNÄã!$9®K¥ ëÃPövU˜ô”¹IA™n½Ç&é^+Méo Œf²Äq’·à„€,€ªŸP—;¤<ȇý¸Bô7Aã79Z;_ðp"„t”ˆŸÉxÆê9ÒC \²`ÅC\cÆiКihSê-‚¯=a=þ¨Š:=¶ÃCs[äo¹Ö΋¾^Q4òo\¬µe}•Ú(׊R‚\÷ïHCÿf1Íü®a ™& ˜•¡Ôy±ØU#&3Á·25k^ƒÕ L*°€ÊÀ`| c^#•zÌXÀ2ó¡ü>!S(˜åXj4úLzŽ|¾_“SÙmóðÓJDQQb"çïÌÿ­E:Îß>M­<¹`‚†¶T‹‰ %æ“›eL_®ÇÍ'û1ƒŸM‡~À@«íÖy>îLRU¢€;B _‘/¤BXµP[ORq`“w®Kn“f¯qŸ@vM7~1€aÛ®â)ÙǬ€Àœ7EJ7W^ˆ»*L†*lÑÆ@¶D'H‰”aÑY⮾¬ ¡àpƵõDJŠjãBßOA.„gßùz£xý¶\¯ëàu>°ãÝ?guÙl½-kMÉ£'ÿƒu6V•(i•̼\8T€ ÎòxW{:”zÌTììÒ}B¬ZÞ³Y+ýϤ7Ho/SÙ¬ ƒÐÄ «øòsoÁC‰·ûsÿ¬>¬û.c`·#Œ,E½C:ƒåövEÉ™ú§-VmЧ3uÂÄ\ÝÆuG}ªÛd¡cƒ3Ú_oÝ¢¶.’Ô'Rö×  $_Ð TîÜ¿L¯~‰zåi¢SU‘1kØaƲ¢”U„ÛBoKáås…JÂø×Bås / éö—‘r€ÂKø Æ.>©v(õ̹˜¨g³Æá;¸ á:5NR5qZ)¥šôF •RÈ­ýå+… 4ùJG7åŽ8ꘚŸ¥•fÒŽV ²hcþÉ­](]fÌè °òR Q6îBlg6A– Ê~{¸ß½ºA¨Ìë‹~ ™­Vþ)â&F ¢–HVÜ,qÁä©¥4©y(ë`–R >Q"é–H»Võ«<µÝIkûT@þ­§3i·Òáy"­’MY-à-è™aô´ÒËÀ çY1£qüd¼™v¯]µ:q­òš.”âäÀÖ°h>¬nëÚ"ŽÌæe£°ìuÐý%Ð\Ég.'¥²¦0¶Éuã#ý¿ô#ÚÌ÷@®2+íl"¬}—iÑŸÔEœ‰SÀ¬Û¶ó<Õ+ò'J‡ê†¡”´d.Y£„‚Ðà;/uÅ«ã:K¦zæ2™Û ò‚Ã_|ðŸŠ÷ƙ΢œ‹(ã|9Ø¢Ñ*º\© BPªûÇ ¦)¾óS0@¼[\¼)Îq2_Ë“pݪø½äLRïrwy¥~Ä¢À#e‘ (…ùz‹vÕq—U˜Ž ‘Ú®?/ŸO9¸ŸÝ€Š7§ Ã5î­a¥ÇKÚŒ® mÏC ßZÛÇ@Ï3£Z8µÌÀ:Dä8'Ý_ÓÆþ‡|ŽFÔ¨ý;w¥HeØb.HQ¦! M!ÁÔÚ¡;êÓ’¤ºˆx‡o¡¢ŒÐv¤Ùðl±ƒŒû ¸Å$W£ð)û‡gü—ü¬áñÂó|†ðœñy^ ¥EÊTâ].Št»‹ñÁ_0(}?ä^J¾$à: ¿ô_êÉOçTÕ”gŽÌá,DÂÔ¶öb@ ß=¾Û…-\ôÚ#¾3{¢*Žï°)ëkÙÌz]º[|wCðÖÕÛ½Ï/oñÝÇcr¢Ó…â"Ð3k+5¤àƒ;˜< ç¦`‹øn•Ç,Åw<˜4 '·üÂÔRˆÌÓ,tô\ªë¿]ŒêñV1þãm d{EõÆýŽPÄË‹‚–*õ•EuwÓü¢º†6°âûÒ©–µµ*À7ü+³˜:éünÇëè¬ð™ŸnÌWžQ?‹/!gÄÞ‡Ä7 #å€O S³ás÷‰zµ´»œZÕë¢ÿ`^|läAÞÑ÷݉x° šÇÈPÊ“²uü€ÃŽËTž³ æNøË‹þÑ!æë˯Q%i/1”ýFèa«*EE 9ß]%'—©$>‘ÂûÅ´ùBõ´—ò¥%Ii±l}mãá”ÞGóÜœ åeš÷º“ àľMDš(h@«a¨_‰ …lõ!Qï>§>†Í6ª}jÐAkV¿°HGêùCÔì(¦:uÔwá‰8äÙÓn×bçß©¡™žGkø'Z1]Än>NK²B½D4çQ wy¶”…A¯*@¯K$ìû 3]=œÐ/_¬Õåè7Ýòuè×_-µú&[ùEþB2¿óŒË^Õþeàò!ì_åÿ20»—Þ¿ æÎæò _åÌÝs¬ÌSúãS|J[=Œ¬Ÿ½”!Gò~ µ[ÁùÌN?©X¼›¨‚qÕ¬-w3`@B苃¥»zïßÈï íü.õj°þ™ÞA;Æãah U^åžufoÂM~-ÜCh7ŠæÕChGŸyae­‡‰gáR57ÙxËÞ‹‡Ðnð*.KµíA·¦Üë!t`0·¯¡¿>„ûõ’‡Ð¯;»"‚‹žbŒ)ûÇ ¡g”íƒ~õ/¡[åéêFùBNÿbEÿ¬o¥÷ s_zöG ¼õÈ"å˰orde·3\HñKc.”û?~Â…rl2.ª×Ï…ÜælÒ^Þ"œ—>Ï=@î¶–‰VYÎ'ZX³„7GxzgJŸc/‡CúÉó¼i wð´nYò}Hr!qkÇR¾“ðCÒSûx–‚izÑâ² jOÊòýÑÿÀE¶`endstream endobj 128 0 obj 3416 endobj 132 0 obj <> stream xœÕ[Ks#·Ι—$ÇÜx ™ Çx?Ê•‹WR©¼lë–ä ]I»ŒII^s½ñïH~p>wyž+*à{ò½ÕQcÎùU·Nš®á´é1±jî’¦_Žzð+yg-OOyl¾J>Ÿùî‰ÉV¦\\¢iÚø( vK“«»Æ˜(ƒCî&çA!"‹ÕŽ˜?åØgŽÚÕäIŒŽŸßObÑŽ|ïÉw•t~ú°Ñ&èÒØô”ÇÃ:ëL‚ÍûY€l õ0#œ²óŠ ç„³dsº3¶í‡rÅ,û (u¦S£ó»˜5)Ál•'P ¿ï O5AIA|KÀ½=´Ó½ËíÙ á@ás€æe§?Z8lÝPÐdÊ ¬Õ49”ÌwZAóAã}eÎ…O]TÓò~0Ob†Û¾Ú°¢šÙ-Ÿ‰yRòv·E•Ÿ¸ × ,$Û¢&z×a?S .WtÝ ;U¾õjͱ”rªÖò¶nLs2Ë*»Ñø”øüÓââWÁR°‚ÖLKŒÕ4Ãb÷QjÍLä†xo­ÌÀ« &-$ã=†þ±ŠÃ­†aέ¯0Ú3ÓßxÏ­[}¾Þpcáe9<+ª˜5>{ªµ8[HåÝœ „WE54lmg^ý&ÌDåo³HÂW*rœpËðuWšþuФÇñxž=‡TK &ŒÇI¶–;»ÜHÔmi OŠRÂä)BЇ.QÆmPõëmšw…*>«_ÈÐiЯŽ!ÆKáx ¢™' HìýÃ*ð1R1jeøÁµëÄ@8êbê=>Æ«ÎGž@3ÏÑï>Ù¦‘bAv& œ £ÁËP á¸fNðìx*H‚}$ D¥„±ºƒ¡16øö_À¤`úÜGë‚Ñ9f…Ÿ³#Žøa!~'”qÙ®Ãcµ32Ï!UãĤp¤ áÌ™æ‰ÉÏŠ+˜‹`0xn˜€×¥“~22Ý‘‚pÖÑfu'­dšb.œ;§þbÅ€Á`· •Šh˜ºrY#i÷­ç˜ctô± 朓½¶G;€ÝFÉ lkÙ¹ ÛƒûÑ®^Z½ &ˆsÀ:ÁƒÐ8v.(€õŽÙ1oŽFÂék˜#‚/S0lj ŽìðøëŒiÎÏÇö3ò챃42Ÿ«âóQ¤è0›B ¦á5R(HëùKL¡ò5KŸI)ì "“Lª§<>“RV•.ñ|Ž_nE(ñï™:&ÐjiyTP˜*Ôä¿ö23gÁÇŸhP±°¡<#aŽlf—f­Žܸ„s90åPy$̦ؖ—¯Ó¾FT:xûn3ýljwîyôpçn?&ºö7:éÎ]Ÿðta]ûsD×<7 >¿+æW¡LçýÐp»/¾nâ²#õxœu£Øõ¤q–Ö¶¼ªmq²ã6Zœ(˱*vÕIú±Þx,+¥Aù"¥rÏqAðRäïÔí¼¬D$çpEßóLt^k Ÿ¡M–Z¬QIBüN2ØABÌ\¯G¦TCv»»è/9ÎåCÙÇ$‘+ÔÔÅgiä(žšGPd±oéøÚ¤}pÓ×ÍÄwD{ L3¯òæB<ºËßñ M…rËCS°åš÷ûFH¹ª·9àùóÀÒÇFô( „'‚Xý1)%4Í«æýM8-%QPÞÌïç]Ú2jDë¢bŸ·l‚ch­U14×ÎÁ\>Xîüjòœ0EŠ×£À“>ßµ–Ÿ*]'~ʘY­!N5´ÖŸ«âÍK”Cž(ß®á:gT겚êò¬2ƒþh夹EU'xÿ4´ ìI£;É„H1S©¨¹Ô¾^1¨)·ê¯•êGz´–&†<“%ÀŽî˜â”Ñ“G­³èzÓNø™W‡ÑhÈóŸFÂy8Œ|PmW!ìª G¶7NÇ׿Qž™=EúU~)ýØ#ĪZ}¼G =ÏÌMzŠ~FÅ÷ºÄ]òòt_¨ûõ\ÁBº}u•’Ê*¥‘eº¥ä¼ó |j <¢°Â)1!‡Îº\X‰^‰H JªØC%縚wÖwÛÖK „á’Ö¶nc·4ü —ºÈ þ3‹>ê ©ÑОË!þµ¤mÔÆï‹gÞ«þoÉýˆm6ƒÙÄaHgë—}³)Iõ|OžÕ¼…Õ>4 Šy÷”Ç›78„ôiÒ7 ?fxS¨¤›p;#g~zDäLOÎ3==ª¤œ!‘½dñ´»ñÃúÉ+¤¾·ñÅzèm ŽëŽ1)+o¿½ÍPPUYH ¾ªVàwä+áÒGé§Ëlsìµ-ÈÓïPHí0/)qÔ›y aò|/–žk¡K¥5ÅZ¦œµðó-žkEÎŒµÇ‹™±Ö’<Ü%ïCi*nÇêŽÔ7Ãçq}—/Iõ8“UÏ¢ìÜË»ñòo '¶>” ±èÔ†”õÜ(8S«=E _$}ª``Òÿ ™rXø]‡Z093/f•r^Çä¶‚ àP>'ê 8 ÿ—p4$•4}»«»øªb¾‹°mwý¯M«:i½…?4Š–g|û¬ˆâÆâ/­TzÊãž jažQD΄¨3ÄLˆª¤|èâ¬ñžƒln7—ë½äo@Ôø6h’ÈÑ»¯WdÉÝÐD¯±@¯ >2æ¼Àb‡Kn:c(B2å „HÞ)#]’ÖX8©j¯~ìJûDåaöäåJ¸‘¶õ{ò ŸÐ0š>‹‰¿M•¹ÉèEýjcþ7µ¹xwìñ?×­Z»õúœÔàŽZ% ýÍÝ\ý™¯îŽDi)V—T 2© Ñ€ Ý eôF&ãG°pOo–Þûþée™#Ë÷`Ë_-þ Nãendstream endobj 133 0 obj 3267 endobj 143 0 obj <> stream xœí[Mo#7ö¨ËžsÓ±Œ~“}Ín`/‹™ø–ä0cyl!’í±å™¿Å&»ùØêÖHê,`mÜ(“Å*òÕc±Hšs&æ<ü¤ß×ÛÙ÷ïÜüöyÆç·³O3Ñüqž~]oç?\QåIÂj^‹ùÕÇYì)æÞ3e¥˜;^3NM®¶³_ª¿/8ãºvµ¶¿]ý‹ú Qô ŸÎSÿ«µ¾¦ÖR*WÛê¡ùÔµ0Õ6K·Yú>Kï³tÕIÃp?^ÍÞÎ4ãfþ™úi&´qLú`¢dZÌ·$©ƒd3ûyÔížéÉmÒÀ¸”¥ÛàÈ&w“¥ï³ô©0ùûwÅä.I»3r¾Š­ë8Oÿ .ª®µ#õA)ÙPkÕ(Ú{©IéRÁx­QºÙ˜4ÖuuRøÞ‚ºû¸vRQ힃BÕÔÕÇÅ’,®kïm§û~€öÛ8P®ÚÝü&ʽÕsèª97µ©vïó°×ùówèÉqzJð-[-¥`Þò4A¯v-Ö¬S°ÖJÎÇi`VÉ=¬}Í} ÙN/«5ÚéenŠ™Þ0ëJ+? bÿ9K£i–+=Þ2=_'ŸÍM­Õr…ª±«œ]kW@ücT.kI-„¦ ’¢ú2¬î:GØ.… ¯ÖE€%ÞW·…¥Ž§4ž31ê—‚ôA‹G舛8ÇMϯáPŸ›ïÖèñ}2]•ÓzvŸÃ·4JZ#5^8«* :Þ$ÕÆW~X,@ÌšxŽ­R ) %¶!E(3D‰ ~­`ÞÐÉb±Þ´ìæ D4«l¤ð4‰o¢Ÿ4«þ\Å&кõ¡N¥#>”@†qN ‚ÀûuNŒð¦"¾Ô½bÞT^“È›I27‰ÑˆcþXÞÌv&Þ<ßÌÄ›hå]Ÿ!{6Yúx,ouoZÏ\ÝÛ½Çvû—ðm¸2ZìuôÐjRøn_@¾Ù­¡KÏQ ×=tg““*e šƒ¡Md<¶XRŠJq檫†B¥6\Wý­!˜beõ·Ð¤p=Qn‘¹„ö4Éö8³¢rŠs$…5*ŒCüKNƒ\ªç¨&4¬Z‘~mKÞ†©ÿ×–¿”:,¼2IjÕ® gÃU$RJ7­j©¡hp;2N ='iMëC´× ?°7«¤Ç v› X‚àÀ2yÐD‹Q‰\Õed¯j»‘…0xŽoÌh²i†ÜÓHBy}±Á§½Ä¢Cˆ…ÎØ‡ŒÇõÈì}cµ»àûvO'×¶_kæìC­äü}ˆ4„<.2|þº°èЩ°ƒêÏ _%L`R–ÖÛ QÀ­r³`k¥N΂CzÄÕŦÁ‚×!RRJ,z jë”P&#W9–Ààðõ¦kó¸Ô÷RÃÇhÊö±ÔÒJ&„Q”³Ö‡ÂçöøðÑjrø¡ß¤B›6~(ƒ/6çÕGm”dÉÞ¢ÉøKå#(Í‚.I‚’YkII2IÂSê¦öô”-zÈÒÇNz4'ÿ3,Ô’»Ñäù±]h=ºïcÆÐO>›ãñéõ¼öxª{l.5£ù6¯‡øsð4…#3»$8u¤€ôø=Ô½d{毮P{)à­5lÁ°b».…„Á@4ÍaÐß3Øñtߣˆ½XühG$S(I& H»PÕŒº´h7¸/> Ø™ `g,dL032 +3¢«õA(YüëÆÊ&€é€^£VÇQ­´LÙ\çû®Ùì!D EXÍ”’^´­‡Š ‘’²£Â å®5mm\ØWŒk":x#®“d®E(,}}9ÿ:½šƒ‘>ÝáÁ¨Ip›¬½r:ÎacÕÐ)êp5üÕo"Š#„`k%ç›r–Ž1Ö Ë½ÚCþŠµËˆ5Ÿ>)a+ì! ª?½Úð*ãD KË‚q’$âD ¦¥ÞKcÀz¸9ïe‡™^„`?@z±-JÏÙ_2RΨZ§¾~ –Ñ;:µ Q¨|ØWß@ñiaÈHG=/†ÜR"ƒU¯V2†Ü2.Ò©ñip«ã÷ðõÿ¸ê…¬9²ý¯4÷™á„¥¿`IÇ=¹j%ç#ˆ40+ä!Ýg骓 ¦Ÿ] ¢÷T ¬`C(…Z„²>¼"qüChØÓÈè½ESá²ÐȱÛ1L—Ðä?¡æòӺث+7ÌÆXWîàØx;òjæ)ö”FOzWÓŒNtÎÓ'å@EPä8×#!ý¯÷-÷4´m4SC†„!L¬.ò«ÞõmšÑ·©[„¼5·ÈR2o†XºÅÝ·2]úF+•×}+c¿^ú¿´VÑ„èö€uºÿ¤&aN÷¶3t[A£ô (=ùAŸ£eðb{8 ŒWÏÉíòF=F ¯ñ&îõ)´|ÕvÓîÒòÀ¿Ã.ë A<¬S)r¨Ê‚¼}¡÷’ƒÙ‚Y“d³’¯ÖŠ=f¼ÐMǪ“îþïó‘cÐÔn„d0ßxÙ7,e”ñ¼fë’A=hG[v#¶½Ôã„·w¯>ùÞj¦=„H+9?DÂ]ÔöPˆ|ÌR¸€ƒòös–ÞÖ•¼[tß€ÑÆ^³C\÷»–TýèMÉac 9#êËŒ¡ÑhÛÀ$ÉÀ„ÒL:uÃ;ñσf5;|Ôþ¼ÁlQœjÓ[e£N¸ÚE’{êÿVˆ4¤²rªö%0> ¾Xäc™Â‚M+™€az :Ÿ²Ep¿º>g7î˜äíbðªuݽ¬ÓÕ¿sd¤€5`#.Ÿä‚Iî|ˆI|° Œ†Ë¬ów7•ogÿ>DG€endstream endobj 144 0 obj 2131 endobj 148 0 obj <> stream xœÕ[Ko#¹rÔ%AG)ˆ¸|?®› »ëä’ÍÁ#{<•Æ^[Žgÿ}Šn»IIVÏ`ÌaÚ¥f±ŠüêIöoKJØ’úéÿí~ñÝOfy÷´ Ë»Åo ~\¦ÿ¶ûå÷Wð‚°@!Ž:¶¼ú°ˆ#ÙÒZ"4gKC¡ðÊÕ~ñïÕ×”P錓ú?W‡±Œcý£±0þêÞÞÂÛœ ãôê>Ñ1›90+Èèu¿_ãÛ¬GJ îÐó¾ð§Y’CÐ2¾ê>¥)+Ýß@MaTüŒYŒÁ™H< 6ÄÏÊÕåçœýívXãmúíPBR‘´‘mdzÞACþsŽ•€ç{sF¢´“°˜í¤§\n*Àp-ÙÄM¨ËÔC%Ÿ4ÊŰlÆ1ÂÍÙ Ob‘à [W]¬‡L}ÎÉÙáhrÌ­2#ƒþ €£+urúÑ¡÷)˜æ@N9+l zO}I/Hó ÛvBÎ0nˆðœªºîâDÔé±ý‡P)¿¸ý_h¢Œ›ÇÏØ˜¨w)XÜ=™mtEDùÇÆ9¿=zõ.oñ—¼Oº´rÜÈÕø—B×hч%ÅäMu*€äðÈôòê‹«?ù"Á»=®4«H9ÄG R—¹èî>€Žv^rVÔ•‰ñ†SG¤ÓÓì£P:hŠ7ÿ™}~jl9žó– Ò˜²þKËqWŽhÌû?e qóp¦¬£Û¡?ð,ÑGº×{Ó+^– ×Åz m v¹^‰`hÇ2ñÓ¶X:Êñ;ï‘u½o@.Ä p"¤«£ŽÙi«€ñgÀib¹­x~ žÓ0Œ˜Û(°±Ey…œ<¤dA`ð™O)ÃÊ J2ŠË¬ß{ÑèÓ·€<êßÍkSÂC=Õ ˆYDiÙ€_·”†ORö@ÍMÔZ.d‹jêÔ2½¬a,„ÏÒ3àÆԨú80 Ò°a¸e—T}N° ÑR*ÇÁÁøÂ‰;©÷@¹ pâŽ+=B©kõÏv™š©UNpÀ$•N߯‡¼:3 Qt`C¯‹`((»Ä‡e­²¢+OÔ› >ÎIº?¢®K§œlu€'ýx˜^Šm"ÒñP ú7˜hfe…?Ày¯Á(Üa£Ý7:ê¸b‚ b¡‰ôË ÅÒrÃK‹«ë—ÂïºÝ.Ò}`)3§ªë)äíw…Éên)§Ëô2&«Ð6˜Uuù¹ þ™ÉÔÈò"2ƒ£V7õ`C8ë·«rB:BîÄõFã¸/SÖ5(ƒ]­ìx+§ÄÑ«k s”ó…ȨÕH¥aä4§X`Q<ëŸp R"¹o¾Uv7DJ½jtÆqš×m(&¥Î(kŸAO@⧇ôÈ)ÕÀ‡ü²ÎÒ|­3›YÁQム‰2#8ÀoЦï³×Y8ÔÅü5SŸ2õ!SQxÙ^H¤JÖ¿®‡¦Å´÷Õ÷†ÆÛ—9Êi„‰†en QpÄ &]v¹¦ùÿÑÆö™Ê7£0Ê€i!0ö”ËÁ {d0æ› 8SAç7Ÿ €E957þ.’Sûc>GN(”häå¬÷¢§¤Gkÿx, †ºÎ7bØ(ˆœ—gùî­Ô³ó¬àñ ìGCÎð¤]‹Ô•¦¢Œ*‡œü`¦‰ ÿšÇ鳬AR¨4¶†D™a ’ú„éËZC–³·†Ëåì­ËY?Õ¯." !'qÿÊú"á7µç&@‰;ÎcðØî€JíЖ"Z§C£D¹ºmß.Ð ‹›Ñ$˜sà“ÑY¶F•¿\ŠL-fXUE˜ÆUµñ¡-Jwª·ëÒUµóêf)¾¥?ðxÁÝ1/‹Ð³JÔ·ˆ.îïsàÕS.Çp †OŽÕO¦ ¯Rï ß¡#ÃJÒÙ'´ñŒ³™7;ÜŠÖb$>™èc¼Š•yðƒìì•õß]"(Nd;VûvŠåõ¾á°rµ~¸]Ùë++Âzï¥Òñ fËG—N’,Å^bšxU šï§èI[3©;]Á`:‡BìÏoߨ?aÆv 3̈úû6fbFÕÄ<åÉg¤ÁõîÈë¼<Þ³®°ûï;ly5©ÃPNHfT¢;ƒ¼„éCƒÿám!ÔAÇûžr9˜Vþ륀Ô'ÛVe»­âãP}÷C•º­hç Ë2 kç¬!ÒÌÑÎA–­U¡:Ê» ¨×ùQ‘ð÷™š™åO<3>ºe=¸J>Cÿµ$…ïÇÙž2õÄ'ÀÒØ·àZ Ýô^m<åOÛk÷|g­¯>Ù‘8ŒïÁDéZ×'ßSÄl¯ f­ó¿|P‘œŽVNkí~"¿ ª`úT‰>a`£³>”0´‚7fÞÒÍÈB/ “mÍÑqÚø77éÖÅwÑ}¯cݺ ˜‹cµÝ:!4‘J3Ÿ/ów‰‘ÏO”>µóßRŒœ>rïè~2Ê­«Ôú7~—„gy!AÁÍZ섊sÇÉýÉð¾›@YP ÎÌœ•‡zFXlEøtçÈÍæ0rrîî©Ìy0G1†/â^qîÔ2XÉé¤Hè…:7UÞHËÂE·âоuÔØ^W©íä¤ÞÓ­u/Ë‹_Õ[]‡8Ô1™WÒ‡Œà„Œ7Ö›àø†iÐVY5-Í“Cï79@G²Æô4aW_{ǾtÈ•õs@Þ)2¸"ÁpI¾ˆ£ñª*x’ÿî¾|endstream endobj 149 0 obj 3024 endobj 153 0 obj <> stream xœí[É’#·½óâ_à±è0!ìËQ²ŽpØáÅðEòaÜ+=Õ‹º9Óšï?؉­¨…MV÷XlcSL‚‰D"ßCfú§%%lIý¿ôÿÙÍâ«¿™åÕã‚.¯?-Xør™þ;»Y~³ÌKˆ£Ž-7—‹øK¶4|i¨#TØåæfñC#W”P錓º!«µsŽX¡›o@.œ“F7+f wF5w+Gœd”5Oð5ã’SÓ<®Ö”HJ•SÍöÖ Š %YsµZsE‰Ñ¬ùë=þâÂÿZ‚vÊý£µ\6ï¢)\(ÖìüpºÙÞ¡/âéšú›?,^?÷f¹ùóbóÛš+¸Ò\4×hÑ`¤¦DI×\†!”Jã9ÛönÅ%±LH¼pXlÖ ®ƒÕµ[ì’]úÂØJçeœ–¯ñýªï¥àšäŽwE¼ë¹¦ò ׌0&›ícœŠ¿e°ƒB¨æcXe,é ›±mчbd/)ÓLMÙ~J+/ù8ð㵨ãc‡ôŸ•Ç÷i´äÕ¬xÕi¤J; ×ýÐëí†%ΪæÛ{ŽžQ’ÕZHNêוöà7e¢g–>Ôĵsa›s€Ô”ÕÞjÇŒ—[¤.m¡†ì ß5áâ¢0 ¶!X¤öÜv*½‡Iêí…œ±»®¶0NÄÄX”ˆœ•Ç÷[¿Km_a7+ì$‡`FÓC¤Î§%ñ~°‚z%m5+6 ÿïv{žÂj_wWÒŤ•-牳…kvwI·`û¶¦S“÷|OŠ‹8ΚO®{ˆˆâšè‚¨èOc¨ªæÏÂYQ_‚´ó ¨±€GŽ{8P>P´!Ê0AϹ0b>éc‘^tR?Ç·›Åw q³|‚|æ &#V-µà [Þ,˜~Ь“´‹ï§³6–õ€"W@¨N™ÏE1謘y]¤w•™½[KAx¿EY¢šº Er’¼Ð/? ’»[37õ.œÀ'Y¾ºñ-zFðÁ­c…I­EÏ7è¹2 r‡e|’;ö$a´òù£Áq ‡ !˜Š IC ìùˆÏÑ"žÙ_7â»0gš9‹ÃDª›o(Øà e@ÁJ©]­\ˆ¥tR2¼ÒQŸw’ãÁ ˆÔ‚ÂÕTÂÖ7ù~ßaÈ5a†¥õÃþnþ5Òà–HfN‹%XM$΃³d6)‚b¤<š?Wº!…&Š>?Ja×ü@‚ÌJf¤ÿ©•¢™èøß….u¢:nï¸tM£\³W£6¯OR÷ÒÔ#øÖPñšiŠ ×/ÏT”e*k«-1<§GÉ1›Ø>g}òõ«£Ì¤g › ŒMÑ!ùÛûsØ7„(÷sì»Îæ×ãg` )Ãp?%Kæ³°¸–ê•‹á{™Òîåc °äÜœVõ'aÁÅ_Ì÷/÷'sJQoÇlÙX’îF,ÓŽ‡ó¶³Ìp¨{enemZ[ŒØŽmrÏiýÓ²ÁdÿÅÙ_(æË½»HÚÕ<_Þ¸ƒ^wÐݘ*Éè»à™¢í|óõ!j‘²n¼•2µ{šçcÓ|›‹W©šv[qTïTòa5'ç/Y21 €Pò—ûQ‹Qþòq1ȶ™Ø–0S÷Ì€œ<äjY~v|œÊy"eÄ)Œ$™ÐXà1Šå•̶HÏGÇ¢Rðvo¸ŽôÄ¿êîNáW¸8wÜ¢(Bx/Ñø¾ªj~)CuD º¶ýwnxbOOe³øÏòýØkk´J\ `]ùR†~•.葥ë½ ×J\Îkˆ˜}kˆ|[!æÿRÝÁ°WMD ±šHÓLP€PXúÔ(8žŽ) IæS Ðqw<|Kå|Kú¿öú ê#Û×ü_&²'»Ï"{ì=FD;÷mƒ 9ì-èÉÛ B ÈÛÄi›K=k`gÉl`scˆÕév²]â9îÅb ¥bm±ª|™Å(»gq;æ·æ²Hc}«©c¤¹µì‘Î÷ø65¢š©~c÷æÅvƒòàæá¹C•žúá‘7†¦^œ` ^"và”58/'Ü‘ópeë{¹ñº.e§3[Ô/ì.¢ÊñÞæ¿Oel[Q$ƒÐPÀ#W#‹Í”§ðÖnÑ LÕºÞAL?ˆ–®óÝßøÍ×.¡üËtµ9ÞÜà[ÊÕìH_}³#¹ƒ²aˆ9±>—ïÚûk‰ˆ»’d>wARc©ølÜU,ÎÜ5ßâÄ]Øbd*毊ôºã®ƒi¬+ê¿PÃ,±Å,€Çt;èTú]ÜM$ngÉ|ÜPELê(} ‹1ƒŸyG'S‰þ÷•öé-ϤoýUð§”bN×—yO­¤¾ÛÛÝï’·4¯Îbôwm‹íêã;G“VóÇ?%pU‘€KŠí®>ÑœÜL|Km0¦­ï»gÉl؀ؒá}÷óbÛ¶ŸxQíâ;Áõn<Ï̧žšìÿ àIGÃäûâa‚IÆe5B]ùs|%{×ÏA“ë?+†—|yº8e„½\[ Yr¢TŽ~ Ësôß-þ¬—trendstream endobj 154 0 obj 2437 endobj 158 0 obj <> stream xœå[KoÇrÜKþÂgí¸ßää$Šà@°äˆ6`Ø>PKŠh—”É•dþŽä§ú1ÝÕÓ3«å’Œ:°Ùì©WWUW}ÝúuI:º$î_ü¹Þ.¾ú·^^Ü,Èòbñë‚ú?.ãõvù·X@ÝLg‰¥Ë“7‹ð%]j¶ÔÄv„›åÉvñS#ZÒaµªé8þE¶+kmg¸j¾†yÊ#ºyÝ”ÒTÁh«%áRÐæº¥¦cF²æ¼¥¢³–Ñæc Æ¸¤MŠ~Ù¹/™µÆ¨¦¿B¸lWL¯Ì4Oaš[+´r³™þöÚ‰%Œa¢¹ _j®›ïÃz*4iÜ Ããj?¬„á„~•0‰Ì B¤•¿œü Œk°m™êåÉóÅÉ_~jNÍZ3K%¶Èuž=ϳÓ¬ãñôdñÝB€°ËOPQ=[PnÁ$r©¸ÑUËí‚ ÈŠ¦™ÍâÕ|ÝE§ê. Ð 퀪"Ô^HÌÓ,æ:Ͼ˳7yö}žEꯧÜoÞ±Ñfÿ#'b”o7(k@¾õ–RÌåRà…¡ÅÉï-ÚnT9Ìë‚4NNŽ 3"œ²©ÐËcœ<¶A«è8|‚„”53…FuÆŒ¸ï(œN”A^¦ä]}&¥ˆÏãé¨X .þ»‹ „)ð qæøX ðCÒ HŠË,Û.ÏžçÙëý[ Ìñ•ä¿ùtF„Á®ŽÜçír¤ÊÁ\4@»ñpEuð$ªñšể†¿DÅftÔPxžçñÙ@¼¨™{Ð)ÎWçOÒ»¬4r„ÆëÏ0•…w *bA%•’ ' ªaæè P˜*¨~˲õyvWȶ'’†’ýïmjË‘—⢠ø, c ¯Cß½Fß}¦9Q|ÊöÄŸï0ùÛ ÎP‰RÂ&+¦;¦,TĜ߰`…yÐDeÐä‡Ö•óDÓn@(DÀD’ú䨤ÓV=‚óBBROóÀH”G !ê .î„EÅ¢ug”¨Xox4$DÛŽ¨ˆ„+æ«¥{@!@+¹ q&l?â¬òx,ľ¼‹û7­RAb¯v®–…(sØ¢¾*'ײÓVùøë¬ñ`oÁ¾ ö1l¸¶˜iÕ<úÃ0  Qþ²øþ€"£4…sˆºýŽ“)2-s©›É „%;…_#Äl–<aqd87•Uíq…T2à(~âh‹Ž3ÑO¢ ^#úX ˜¶ÃL±\ª1èwÄØ [p 8*Žø±p•š&]A2Û|€š~ApÄ1„= jÚ;#UÐö!Á‘qôű‘ãêÕYI/\ 2Pm»É³¹ýÊU¬Ù4] ÉaC|+¥tEè0sD ¤’@A21†“(ÂEÔÉ §¶^*psaG­äÿ1Tr¯ÃÜaã,-ß"ÉöøbOf{|œ¹‡ÇCÄk®‚ǯ'¹{ñ¸ÕÜ"ïuèT~<@GwXŸÛ²ª&÷^l'ï–uy—Ââå–2f§%rËaæx· Ò¼rË«,Üv2åNŠ\zeßä¬è!BÓÕp˜ßÒ"â>o2_Cýq_œ)ÆÿH>(„-Â>gîáƒÂccŒ—&' â‰yØxŸ´Ò_0òãýEìñ—¸„5SÀ—˜ªÕì=4Š˜wèËC1:”¦ó˜ÎØ7H€Y0 úYfdo{ :æ!iq:6óhéèØA{R!îŽ92”«½¢’‡p¹±Ô÷C¸¼¦£®wŒpžû_ûx:Êâ}<áò¬ÇâJ«‘}w±÷3¦h«gý¨hˆBjš~wÆ(yèæf`)tx5Uƒß…¶_êŽæWB~-dÍ›ZOÇøËD߇å!°ÁÜ„–GݰSål_3¸@žµkX*[ï€w8w£¹¹2)îÀ¯?‡x¸¼a&ZxZ#émãdrÂÙô&P–#ègÏs•˜‡&±-G~òH‡®Z1UB¾“EW:—yöl_…ÅLQ|Î Ө߭%ÓàÍ«c¸½f÷5*M÷œÿT¡xàlÌ,™º3ÚßÇY'Uš9æ>Îv„1G¡“F`¶V7Ï-N °pDŒô/÷V.Z—ÚÏÑØÉ^êÒÞxy ‹ZôúûE;Yp‚Ã9ÿ"Ð×è<ŽüÞiÆ_%ø“Æ Èÿ³|b=NCÞ6ñSKYó /Ç1@´ ‘Ì5›«Mqwl)Öq®Šd€iˆümáQ£TB,Õ”wüiEq,ÔÏh†³úµ«3 ×o4\øªp²‚,,Ý2W…fõUPÃn×AHÎu³½šYß¿9>°¢ 6f‹%«øâ'éþ¸¸Ê©ç%>?*—ðÈÑ5Z,½¾ úk[G »õ«ÀóHZ6Ïr=õm~À֢ƿlG1Zß{¡Zfw_òæepO_D`;5aŸ “PDmKà9ª{TDÕ埯ñ=‘ 5%›Ÿ$ó³¦/qaV?·èƒ'ÁîÎðZJÝ3q9WR…@õ?À´hšv´é4)ȸÓÌŠod*[?+ïÄgnÐÎþ¼ªåüôÄ» è˜!7M>Þç&i÷^>rÔôi•›ª::;¨k6F8w€Á8Žñ©>¾±§àe,UÏå{"ðAÙiè ~é˜_rL¶Â%óÁWƒ —eK:*(= £rJšAsÓ«êdJú ší]O¦%5-Ô=é•ÿ/ábåBÀU±;½)Nƒ¦Ñ€e˜âë¯TðäR©Ý¨ÉžtŸòNÙT=#¾”ö‚Íq~ì6BH‰ ô•½éļ.Ækê‹äí“ÀË5è}*{&®^"2ó'¹OáÍ2MWÑÅ`~‘óK„>ü˜§¿A²£äŽ2ú3åPT1è¤PË•¦®Ö ;ˆ“’.÷ÜWÎß-þxc”Çendstream endobj 159 0 obj 2853 endobj 163 0 obj <> stream xœ­Ù’ÛDð]_¡Ç1…å¹-ŠR‚p$à·Û»1‘ìÍZ» ùzzyz, ’ª”Üjõt÷ôÝz_Ó†ÕÔÿÒÿ¦«V¿›úöTÑú¶z_±ð²N›®þn ðÈd#¤æõú¦Š'Ymxm¨k¨°õº«^½X:çç y¶XÒ†ÁŒÖä~Á¬§";eÊ9mÈv á@BöR«œ$} `ÀA““ÇJmœûsýè`A©ÆQǼ \6V8ûsµþâ5ùÍ3ã’S€… TJMî gÀ{Î)¼â ð_p¡Ùø³ÒZ.Iû€ð^Aª¨P’âgšSdC{‡¨ˆ:¨À³V“~DTD50Ò’`’›Å’y#JCú·VßäQ{ç¤ ×ìÚÛ ‰I#¼ ÚHJ•S¤] Æ43”c2ímu-§)Óõz δáRQ¥'쯭“õ²8ó)m5ØŽðé¡Ô2šƒ cÜÍÀí~—¯¾|$W…:ÿD³z–1X”àN. ’Œ¤š˜–P¡T½dÂÛÁÅð¹A©‹ÓÇ{÷’¶LŽï xåƒg /rI§ì)ÜySJš¬ü– Ä9åáoÄ·Oò„$¿•Êé¾PÃ0ò"«±ï'ÓN@UÔΧrÆD¸ÿL;Óðr™K2¡ ±GÑwˆZqÍ.s" '¿f6{TR°åÛë"0üIȉçÁ:>Õß4Vñ€H›ÅRÀ 9äÇÈU3×¥–¬pø¶ÛáRÒøÝJ¦°Æœ=—êÉÏô"9Pþàˆ}—8ÚQlátC‰%ÁÝC¬cÁ¥´I‘{Á–‚ÅHè ò`ÉÉŒ^-®‡%VÆbæI&s1ó”H™7XÊê#Á¬ó.¾‡ž;êµIßBXÌ5I\ä Y#ÈGh‹o“r¨œE„÷:9 ff9ò¸‡Œë Iú¤5xIÐÁß,œŸo&IvBõé™)†Pz˜ ¡«˜C šÇK_Å,µzŽaª}úìË`¡bÄ ^o? x°:ÃWeJ¢†!0DÏW@ι0.ÞŽ¦Äm¨)Ñl/ì_ü&ƒ·™¶ËØë î'ù6»Éà1ƒ]¦ýúŒðí2ݸL›OtñS&Gqýf&)ö="ºštƒ6Йüð6_¦Ï~è'½s•±«Œ]ýŸ'O{ÊØý¥A‘KÁ‡IŸõ“´È;‡ ŽT Ì0連0~ó·ô ÿã°à> /Contents 5 0 R >> endobj 14 0 obj <> /Contents 15 0 R >> endobj 19 0 obj <> /Contents 20 0 R >> endobj 26 0 obj <> /Contents 27 0 R >> endobj 35 0 obj <> /Contents 36 0 R >> endobj 42 0 obj <> /Contents 43 0 R >> endobj 47 0 obj <> /Contents 48 0 R >> endobj 52 0 obj <> /Contents 53 0 R >> endobj 57 0 obj <> /Contents 58 0 R >> endobj 62 0 obj <> /Contents 63 0 R >> endobj 67 0 obj <> /Contents 68 0 R >> endobj 74 0 obj <> /Contents 75 0 R >> endobj 79 0 obj <> /Contents 80 0 R >> endobj 84 0 obj <> /Contents 85 0 R >> endobj 89 0 obj <> /Contents 90 0 R >> endobj 96 0 obj <> /Contents 97 0 R >> endobj 101 0 obj <> /Contents 102 0 R >> endobj 106 0 obj <> /Contents 107 0 R >> endobj 111 0 obj <> /Contents 112 0 R >> endobj 116 0 obj <> /Contents 117 0 R >> endobj 121 0 obj <> /Contents 122 0 R >> endobj 126 0 obj <> /Contents 127 0 R >> endobj 131 0 obj <> /Contents 132 0 R >> endobj 142 0 obj <> /Contents 143 0 R >> endobj 147 0 obj <> /Contents 148 0 R >> endobj 152 0 obj <> /Contents 153 0 R >> endobj 157 0 obj <> /Contents 158 0 R >> endobj 162 0 obj <> /Contents 163 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 4 0 R 14 0 R 19 0 R 26 0 R 35 0 R 42 0 R 47 0 R 52 0 R 57 0 R 62 0 R 67 0 R 74 0 R 79 0 R 84 0 R 89 0 R 96 0 R 101 0 R 106 0 R 111 0 R 116 0 R 121 0 R 126 0 R 131 0 R 142 0 R 147 0 R 152 0 R 157 0 R 162 0 R ] /Count 28 >> endobj 1 0 obj <> endobj 7 0 obj <>endobj 12 0 obj <> endobj 13 0 obj <> endobj 17 0 obj <> endobj 18 0 obj <> endobj 24 0 obj <> endobj 25 0 obj <> endobj 33 0 obj <> endobj 34 0 obj <> endobj 40 0 obj <> endobj 41 0 obj <> endobj 45 0 obj <> endobj 46 0 obj <> endobj 50 0 obj <> endobj 51 0 obj <> endobj 55 0 obj <> endobj 56 0 obj <> endobj 60 0 obj <> endobj 61 0 obj <> endobj 65 0 obj <> endobj 66 0 obj <> endobj 72 0 obj <> endobj 73 0 obj <> endobj 77 0 obj <> endobj 78 0 obj <> endobj 82 0 obj <> endobj 83 0 obj <> endobj 87 0 obj <> endobj 88 0 obj <> endobj 94 0 obj <> endobj 95 0 obj <> endobj 99 0 obj <> endobj 100 0 obj <> endobj 104 0 obj <> endobj 105 0 obj <> endobj 109 0 obj <> endobj 110 0 obj <> endobj 114 0 obj <> endobj 115 0 obj <> endobj 119 0 obj <> endobj 120 0 obj <> endobj 124 0 obj <> endobj 125 0 obj <> endobj 129 0 obj <> endobj 130 0 obj <> endobj 140 0 obj <> endobj 141 0 obj <> endobj 145 0 obj <> endobj 146 0 obj <> endobj 150 0 obj <> endobj 151 0 obj <> endobj 155 0 obj <> endobj 156 0 obj <> endobj 160 0 obj <> endobj 161 0 obj <> endobj 165 0 obj <> endobj 166 0 obj <> endobj 38 0 obj <> endobj 175 0 obj <> endobj 31 0 obj <> endobj 29 0 obj <> endobj 176 0 obj <> endobj 22 0 obj <> endobj 177 0 obj <> endobj 138 0 obj <> endobj 136 0 obj <> endobj 10 0 obj <> endobj 178 0 obj <> endobj 134 0 obj <> endobj 179 0 obj <> endobj 93 0 obj <> endobj 11 0 obj <> endobj 180 0 obj <> endobj 9 0 obj <> endobj 181 0 obj <> endobj 92 0 obj <> endobj 70 0 obj <> endobj 182 0 obj <> endobj 8 0 obj <> endobj 183 0 obj <> endobj 39 0 obj <> endobj 167 0 obj <>stream xœ-Ï]HSaÀñ÷¸é޶´‚em'ATÄ¢/„>ŒÊÓ,Ö<ÛŽs;6[¤Çù±g_êvšl&•µjèèB”n¤›Ân»ª é""覤À0zh¼•ð8)‹•!jMuD“ÁpªžhÖë D‹tR&£ƒh72VÒnd¤G?ÑA›(’ñµg¬ 3pº±Ñív7íƒ ´Ór®®žpSŒ•¸A’NÙK´Ñ†¸j´“„ŒkG+mbH'ÑN÷’NB¨9Ì„ž¢³èbÐmT"E!%ªCwÑoìöJ”æxoû"ðŠB ïÕ¤æ ö€W÷g©Äë·{Rºr! F3Ûil]8¤ªE—&þ >: 8—HpˆL>ԉ߷/L¤ÓÃp˜õùØ ã#»‹‚yA ÒßÿQÁç„¿È?ùÀcÓñp,S87l¾³%¤ï« l¦>«ƒ …&C~?LÀè$CþU ×e!\ìRl«ä²}ƒ]–3À%¥aÝ•XWvøm Èá¼Y+c)[Ö•q$é™Ïs+ð—HëþçnÊ5>ªÙjÞ¬ÑÉæªã›'xôëëæ–v×mÍTFv÷‹¥0Ý»,bã² g9Hüø¶ö)¬å%÷2dó/_/.EæÃrìˆ.ƺsìZ€“A’û d»—L/Ú’à>Ø:Ý{ÿšm¶3ê“ó$wÏŒ7k˸GŸK\ÇË ççKÄJN•/ËïÑ–)šGÔ¥ùGjµtö"ô^.– endstream endobj 32 0 obj <> endobj 168 0 obj <>stream xœM”{LÓWÇ¥ßO(EZÔµM$ NŠAeˆl>¶1śѬCì(ÒB)…Âx•B¡íi« <ì¥ Ýä1@˜:K$S·EC3“±—âc˜ûc—?öþYNrsoÎ=ßsÎçÜ\Áó#8Ž )y—"zv·‚YÊa–ù1¯p»¦UÓf>¹ äYÆÏ#c0:„R\';Ïœ”£+Ògf¨ òðô¹"..vµ|mttœ,\î#·™à¼ m$“G‹÷Þ üóÑH²jód’Çñ¦4æS.ì¦QÙ9r¡s¨¯Ç`>|+61]åÐÉJ[ÁJÄ´áû8Œƒ‹úQ9ÝÕ×w¡­Ã×3àrP>2צµç‚Re6»†lµ+ƒb(®(«¶$LJÄ?3׃jCÁí>°o·Cpèœs·ÀaÚ1‰é58`ÊN[„jȧÏÑ0hk›o+ßUÕnðv~qý‡;+CŽ™šŠÁfs‰ÎNiÈ.Çe§—¥ð¥½Ë6w}/9 l;MíHÛŠ6{ŧ ó˜¾}±„A1ï)‘Íü)(™÷œ‰˜ìjýw·‡3y…‹â*\àü¤#qJ´Ðæ>´¡à¦F«‹ª«qY*[±d§ôìW޹ ñ 8ðæ_ÃA¿¾]TíWÝÿ¤Q1«=ˆ\4Ü3¡À=ˆ¿½v£(KMÅ ¶–"Ù“ðoq `à„ñ›x!—•ƒ ¬”åHMmýoß#ÉUéòkD\xȶ²O¤×wŽ•ÖýÄECÓ‹è6p¤ÉïÄ@°³ñÀUí fÜd†µ\!ÍÒº] ŸµGÐmV©°6ôÊf¥î¢©©g>ñðRNÌÏJr—~ùE#鵋ð4 ÷±ó£ÖîWswã@GQ‡ºÒv«ô䋽W€š8»>nþ{’ex>l2±µç…J¦RpmæëÕÚ*eEIUåvȇÙúóOßF ;‰üŸ}×.D¼×Ÿ£ ¿'¼X,Á:‹¦èñSWnÁÏÔxÌåWW$ìH8ì-ìôy¼Ã Dê»0ÖÔÔÀ¥|E¹-%W)ÓîÏ´êí•ö<[TÚ«ìPAIfL¦:h–žŒ÷nÀ˶d+?ÚÔ|U-ë®öy¡êÑy²ó²J•ÑlG$š˜x.eSÃø»÷–·ÎFK|LKxè.KÅÑëÈ ›)QZ  ¸Faµo``Že™hkè‘=zê[ÉìgÙ×›­P^)Å×f2Ùÿµûhl +³€/Ê÷2IÍ(»¡Ö+ÀIŸÿÍ©?/Ö#\à=.Þô â?LŒ•¬ endstream endobj 30 0 obj <> endobj 169 0 obj <>stream xœU]HSaÇß×­yªi4 :ÎÓE 1L#+#ЉVØ‚$¨æv<íCŽgÎõ1™ôøº#5%eøqTÄ5ô¡E´ˆ²«îº)/‚ ìBºÈ猷¢£vãÅÃóüžçÿ?FÆ„1εל¾TVº2îÕvcÍÑ „]ž×~¥7³˜Ù[Û!½ &·€º1CñäØÌówö`cDô ‰+rse‡mÜÒÒ î¤Ÿ½.g€«qJÞï”tðq‚.//E¸¢cIj<º8.qú›J‚¢p¼ØÆ…½’‡«å›x±™ws•Á€Äuúyn-aÉZ³ý!‰¹š ›õ¢Óu—||ƒTï„ÿ¸j…"X9žò®Í«¼‰D§Oâ[$„І–­ÛjîÂwãVIÿ2¢"TÞãø™Ö™¯éoɰÌÏ %cEG ¤2Ô­ïÀ¡)Ó:¨kD…ºb7^¥)¸uÍw6»g„5- c¨úhÐî±Y›%ÑÕë&ŒjR’ݽ=rBV …™‹™È¡. âD;ÛaìpZQˆBL_œ´FeÒÞfµUp´°’ ×è.‰–z”ÐØc:eôÖ„ûa=éêk¸™Œ3ëÜ¿éîÿ,Y¤«à ­ƒÐíT㦑ø™D k#±ŽžŽ„\8åy嘧9€¨#M ¡qò»’šé ­¢gdYî$L¬—ôõ'H²×ºøy ?€ð T8D \7õýý¡Ž~Ê.}Uñëmç‚Æÿ-QzD¸R«{ù•æÁÉžä(`&Cý-áPÔù…çíâÜ—¯ªµÿå > endobj 170 0 obj <>stream xœuSylužaËv„¶ ¦É6à̆ Gˆ¤4!mÑ¥…nÛa{°Ýköì¹;{¿ÝÙsö¢-Ý-e©l)g9å†*Š‚ ‰D5f`ŠqÄ?Lüç—÷ûã}ïû¾÷=É›€ (*.+/_µèyõ&? å§OàßPûôÆ“e¡@yCÓÅ¢©œz W÷*·ñ5$E[µV[™ReÒ4É)é¬úÙÒ·/^8Gº`þüÅÒR©iª—µJËeT#©Q¹Ï6ée}I™¤³–6R”jɼyƒa®L¡«ÔÈß›=Gjh¢¥•¤–ÔèÉé e+%­)Hé vs_¼eJ…JG‘i¹²Ô´ªšÉ×Måk%²ÙˆT!s‘w‘ Ôƒ`9mHÒ.E0&Òäѧò®">aÉðDå&_çdŠx;ßÚ N­R­n Û"4ž6$”ЂլZ„üÚÆôåsC·ÆðØ& ½ØÙ-ŸÔ̪ftYCÎpÜd|ðÇѽ#€%#V-e¥,¢J˜êl†m˜€Þ3\à–\áNÝÄ‹ø–Lò>W~?™A÷<äî<ñn~fñ–nw81]O{*5Ü3záƒí[«Éæ ×YßW9Œ aŠòù°˜/cˆô±§;Ч”ºjèÂÖª[à0v¬“Ër*@ úı(/–6%tªVЬ9©>ufßÁ=½xªêu0ã¦dXš±u¹maXY¹î#Àšµ©Ã;‚éÄy"4”ú)З8½wô(`ú;°">%Ôf²?zaÞç³WE|’/,ö'À!l§!Øå <êNÜí°ÊúÕ‚MâqÕ.YX•yäèÅá{é‹»“‰ä<·eè´Pzš²™ˆºæ PÍþV}éøpzïXci 75×Õ«7ƒHÆ0tÆï? AlÀ×ëÍUÕ£õß<âòïr…CxÑÓdùgYôéþbö€/r °t ú`"„b± \Ði/ÿZ²€ÿ̹ÓãS@‰0MlêcG¶gwC›ÓãquÂëãÁ®jÝJw‰½Ëc²h–ðCš¹·!éŠÀ§3ýIè‹uûl„Ü«Â^0 ðrÓùƒ¯ø·qŽióv' $¡h0ÂÏ{"–x=ÂŒñËVÒM—B‰± ŒNÆù¼ â ñ/0à L¼`kv™Àg&ô>7ø‚Þ@nçÔ=>ˆòøGÅ‘¯ï`7ÅÅš7jìµáîöXÁuF\Á¨?ØÇ໸'&ºÀ„ÿ Ö€lú ¡Tâv¸h°ctÈŽú=Aü÷Îî7'.ñ×C»œ“$ã)+éêž %-0z ³g×Uvß‹3pÍ•,œÓŸè•–Ÿšhaœ~ˆƒßëgX¬èé²—×ödÉÕÀuWÍ-*f’ì~&ɰÁë d¿<’̆s8ûvèj´vª{3aS›WÚUí«%³MŒê£ã½ÉX,„3Áðp ?}Oò%q¼élöäñ#_6Ò¯¯^+ò›‹Úe#Vy\9úû!Nÿ7ë¸v‘Œ$k£Ùt:œbwÉýG¸|8}·~¤lE¥¼|3Nßy¿w=Ô@EÛÚ2ÛØ¦L54‚FonÒV[ªr¶¾L­0„ÇNö^: Ø`P£39Œt3á¦Û?tvlÞ’8ÛíšÜUÿ—xnw-ýÜã+(7~NÄíãÑb._¬Ÿo*…R°AmT—±t/`©tß@ÈãsFý±öpÒp8yã ÅÛ! l8eâ¹ðg4`Æ…gb=PµI.WÖ€-GÐf}L8ˆŸ¼~)׈]·ÎøX(ܺÜÖn1€Ó÷X¶ïg÷ßíÇ‹ôý|rª~±PËæï™tk2>)oᎂW2þ‚ù)4ëè endstream endobj 139 0 obj <> endobj 171 0 obj <>stream xœcœþCMR6$øøø‹‹ø®ù-‹ ‹ ­÷Ó÷W÷T÷Qmq€Copyright (c) 1997, 2009 American Mathematical Society (), with Reserved Font Name CMR6.CMR6Computer Modern2wøˆø÷‹å÷ç÷ä²Ó÷÷•ðø®÷Of‰}I|€„…:‹}‹ûO÷ó­¦ä˪©©©´¾‹Ò÷ûÔûû16-X¶…–¤¨¯¡~«_¢¾È±Ð‹ôÃ=:D\BEKûûmŠŠ‹løGv øCš÷o•“ ûa–² Þ  7Ÿ «’ Þœ (±‰% endstream endobj 137 0 obj <> endobj 172 0 obj <>stream xœEÏ]HSað÷¸¯ãv´4øµ½ ‘Ò˜Ó3$© 1/b AkžÜÄíÌyr‰àüJ§ÏX’ÙÔ]¸‹PÉ•FEiT „WEØEB!<ÇÞˆ¶«xàáÿÜüø?QgŽã4vGÓÑL8¤qJq–R¢Sºö†4 ¨@PßR>å£+û°i?Qqœ¯kÀ.zƒÞvLËÜå´²¦¦ÚB«l¶zÂ'½n—Ÿ:\²Gô¹äôÑI›%·W”{iY­G–Ç**B¡Õåë¶JÁöãåòÊÚ$v‹Á±ÖK~™6º|"ÍT³f–]ò.Êb:¤61è'„¨ËÊ+«É&z’OMú¢&N²Bþr%’«T²Xòwó<÷ë ·YÌ8‡ø•‰hÿŒ™• Ñ‹€€«hÀ¢õG³3Ñ(Lò“cWûZœCÃ&VȨÄ€ Àä﬋ðÿMŒ¤Ñ Œa§µÔ·~µ}è~022:ãñ°)+Xf§Y­0+vží€Q~462X[¿6eÂB¤‹Ø(¤éEH)Ë©i;ü^…›{yÆ…ñhÀtÞ}¦Û|‡nžÃ«þÏ´îB$l1y:´«±mx˜žÏ°YJS%¿cÎPñçî÷låÞÆsÆÄÜýTbvãåëð…GÃáw, µ¶ªÖ{#³É›swŸ¶@Ø´ôvóÆà¿=®­.=YÇô,ÇÌòÙÁðŒC°@1k—ð”¦S ·„/]®ƒ>àY½6·'©ØçPšžJj™ëº.¥ß2˜ôêêy!{qR¶B!ÿÿ¿µ endstream endobj 135 0 obj <> endobj 173 0 obj <>stream xœcd`ab`dddsö Ž´±TH3þaú!ËÜýÏÿWý_Önæn–…?¦ }/üžÍÿ=M€•‘1¯¸©s¢s~AeQfzF‰‚F²¦‚¡¥¥¹Ž‚‘¥‚cnjQfrbž‚obIFjnb “£œŸœ™ZR© a“QRR`¥¯_^^®—˜[¬—_”n§©£PžY’¡”ZœZT–š¢à–ŸW¢à—˜›ªv˜tÎÏ-(-I-RðÍOI-Ê+JL™œ™—–™—YRÉÀÀÀÌP`ÈÀ°Œ±‹±ì9M†>F‰|?Ï}/ßÉøä§4óOÿï墳v/ZTÚ]-ÿç"[uiwIÉÂîÙò|¿8ÿù/ø2ŸñêÏkÌ? þ>ýøC¢mZû„ænÉöîήÆU‰Ú¦î¶îŽÖ ÍSú{»§N—›1yþ¬9Ó¿§ýq–˜RÙß=µ{Nw߄ɳ”ÿ²•˜<³»·»Ÿczã´ººöæº9¾_»7þàÞÈxlù/žåÌ?6|_&p©yrÆÒØu~Ë<»9~ó™+üæþÍyï7Ãw·}¸'ÌeróºÂ' Îvs|ç»ÿí;÷wN‹ï ¿¹-µ~ XȯLÝxêî§ï\Ýߎkj9:\ùΣ-o› šêc©ò(£àÿæé›«×?>æô›çµ<_ñâŸö Ø~ËMgßɵ“{ç\ æe`«S߯ endstream endobj 71 0 obj <> endobj 174 0 obj <>stream xœ”mL[×ǯcp-!Í4kEëîõš-M%’&­´(kµ¤eYB#B $ ØØ&Æ/ü‚1~·ñcƒßÁÄæ%¼’2B a-!K“}è6©“JÖˆj6¤ê8½š6é´jÙ—}º÷~¸çùŸÿHÙF0ŒíÙ¹¹9l¼îIü‘xe[âGÌjšûôñÓ÷S! é)¯l_ÿÖïÂÂøâKD ƒ!©3[³%Rµ\X%PpöV¼Î9xøð¡,Λæ¼+æÉ…ÜN.W!à‰¹ŠäÇeÎYI…§Psö¾#P(¤?ã ¥R¹Ÿ+®Ý/‘Wýâõ,ŽR¨pòyµX% ª4¨„y`C?¸üNgÌCFFoŠt¢z»^wŽÊH]8ˆ³6ƒ'~öˆ9Mg°MÂfs) &=¨Ln›—êƒþ–8\ƒaû̦ïv‡ 0@c´ù‚SøP[/ª‰ ~#¼ ïÁ¯­å¯)ºPU)¢ óe]üÍ4FµZ¨; öÿN ›x »Þ¦¡–õì¶¾¾xgûÈ`[Ðd /ODoWó(á± "> Ýç¸Z‚TþG²îÌAœe,ÂÄ剟°×XQÿf65õk¿êŽ‚Ešü»Ä!0’•ô[©ûXJ¨š¼¥VYÙô˜MjT0ΛÿûâFÓ&°v½•,Û]X+To]ëqµµF’M=x†—X,1ñú;P>"»#ÐÝÝ1 ý\h•ÃÖh'ϪŽs·ˆozG¨8&ZÚýã­í™înÿx2Xg£Ok•9„&Rõ^)ÝTè°U¼ý s†é±…ø¯> ‚î0\AÓÕcEY|ú§Æ­ê\n²÷‹ñ±q@¾Gu­¾Æ¢¥ø{ës¡e=ϯŒNÇ"dFBõ,/cÙ¿„°ÆLˆ=/ëPËkeu:·% '»”!T!î)ZM§WŒÌ-ôý~ðs²-òï¹ûxß™Ûÿ·ëÝý€¼¨–¤f5UJ#] ”!šXm˜Áï,â?Ï%GÿN =ÆÜÇ¡£ÿ ¾ÿ„‰¿ÀwØž«ÝO>7ô@—NbUÊ¡5T}±¡Îɹ¼°ðŒ PÑDÊW ü5€vçÓlùÆ\o‹Ë碆¿^éteÄxæ²æŸæP ¹n)X@õ¡^w¬ ⨯ΫËeÕ%³Ê+£ŸzZÈ ´r Ðú"f÷n 16ÛÌÍ”ˆs¼¶PeÃÐpòn$Ùêhnljuê?'4‰]ìÖ0¸ m“”¡Á¢5’ÍVÓe›Ú,3K-ÒKô‰—mÚ²c9€ÎëoŒÍD>^¥:~Ý€èóõ­M [̬¢*~¬Î‡‹èÍOÄw'†#ñ8©;×T\Q(òjJ .µh&: á ßç%q J[ QCqÑ þÇëë_âÔx²éÈ&dÌŸbL>d&BO°à×i³ŒÍÒä°XA‡š|Ð~Ëe6våiÚ «é»™týý½gßœ?Dg[.Q^îˆèÖÿ:Íš÷Õy値ö«Ñ­ëp2̶ª¡Y«)ý ¼A¨¨ñÎÄìÞÙ=C Þ›t/|Øbi¶8¬TÆ7Û¶ŽâÓÿ¯åf‰ILIh¤Q)RÊ%Ò¨ìZ0Ôêó“-.§Ó Èét4¾+8-Qz=4'—5»mîÀŸ>ÃiIÄ÷õ]øŸ1ð㙸3‘ÆÆ©,½×X'@ R¯Ð_°´'¥ÞÕõ€Ë¦jÁ=ˆÃí¶ùÀÂ,Vh†{êAEÑ«¬:àAéEA¥¬$Ù¿ŒA¯«Õë!?üì#ˆZdUÓ; èÜ&m2‡©:L¡o|,H†gÀšEu±Dv Ââ‹æ¶¾ðèEò…”CÑô´^Oz:Aü _ûÛw endstream endobj 2 0 obj <>endobj xref 0 184 0000000000 65535 f 0000103722 00000 n 0000120410 00000 n 0000103461 00000 n 0000098878 00000 n 0000000015 00000 n 0000002346 00000 n 0000103770 00000 n 0000110094 00000 n 0000109402 00000 n 0000108541 00000 n 0000109238 00000 n 0000103811 00000 n 0000103841 00000 n 0000099038 00000 n 0000002366 00000 n 0000003488 00000 n 0000103902 00000 n 0000103932 00000 n 0000099200 00000 n 0000003509 00000 n 0000009471 00000 n 0000107768 00000 n 0000114068 00000 n 0000103973 00000 n 0000104003 00000 n 0000099362 00000 n 0000009492 00000 n 0000014077 00000 n 0000107320 00000 n 0000112983 00000 n 0000106987 00000 n 0000111269 00000 n 0000104066 00000 n 0000104096 00000 n 0000099524 00000 n 0000014098 00000 n 0000019238 00000 n 0000106476 00000 n 0000110277 00000 n 0000104170 00000 n 0000104200 00000 n 0000099686 00000 n 0000019259 00000 n 0000023530 00000 n 0000104263 00000 n 0000104293 00000 n 0000099848 00000 n 0000023551 00000 n 0000028399 00000 n 0000104345 00000 n 0000104375 00000 n 0000100010 00000 n 0000028420 00000 n 0000030850 00000 n 0000104438 00000 n 0000104468 00000 n 0000100172 00000 n 0000030871 00000 n 0000033327 00000 n 0000104529 00000 n 0000104559 00000 n 0000100334 00000 n 0000033348 00000 n 0000037366 00000 n 0000104600 00000 n 0000104630 00000 n 0000100496 00000 n 0000037387 00000 n 0000041153 00000 n 0000109640 00000 n 0000118311 00000 n 0000104682 00000 n 0000104712 00000 n 0000100658 00000 n 0000041174 00000 n 0000045556 00000 n 0000104786 00000 n 0000104816 00000 n 0000100820 00000 n 0000045577 00000 n 0000048572 00000 n 0000104888 00000 n 0000104918 00000 n 0000100982 00000 n 0000048593 00000 n 0000051696 00000 n 0000104959 00000 n 0000104989 00000 n 0000101144 00000 n 0000051717 00000 n 0000056135 00000 n 0000109572 00000 n 0000109167 00000 n 0000105030 00000 n 0000105060 00000 n 0000101306 00000 n 0000056156 00000 n 0000059519 00000 n 0000105145 00000 n 0000105175 00000 n 0000101469 00000 n 0000059540 00000 n 0000064494 00000 n 0000105259 00000 n 0000105290 00000 n 0000101635 00000 n 0000064516 00000 n 0000069778 00000 n 0000105363 00000 n 0000105394 00000 n 0000101801 00000 n 0000069800 00000 n 0000073621 00000 n 0000105478 00000 n 0000105509 00000 n 0000101967 00000 n 0000073643 00000 n 0000076451 00000 n 0000105573 00000 n 0000105604 00000 n 0000102133 00000 n 0000076473 00000 n 0000079392 00000 n 0000105657 00000 n 0000105688 00000 n 0000102299 00000 n 0000079414 00000 n 0000082904 00000 n 0000105741 00000 n 0000105772 00000 n 0000102465 00000 n 0000082926 00000 n 0000086267 00000 n 0000108679 00000 n 0000117444 00000 n 0000108360 00000 n 0000116498 00000 n 0000108205 00000 n 0000115836 00000 n 0000105825 00000 n 0000105856 00000 n 0000102631 00000 n 0000086289 00000 n 0000088494 00000 n 0000106003 00000 n 0000106034 00000 n 0000102797 00000 n 0000088516 00000 n 0000091614 00000 n 0000106098 00000 n 0000106129 00000 n 0000102963 00000 n 0000091636 00000 n 0000094147 00000 n 0000106193 00000 n 0000106224 00000 n 0000103129 00000 n 0000094169 00000 n 0000097096 00000 n 0000106297 00000 n 0000106328 00000 n 0000103295 00000 n 0000097118 00000 n 0000098856 00000 n 0000106392 00000 n 0000106423 00000 n 0000110532 00000 n 0000111549 00000 n 0000113265 00000 n 0000114294 00000 n 0000116047 00000 n 0000116740 00000 n 0000117679 00000 n 0000118551 00000 n 0000106851 00000 n 0000107607 00000 n 0000108120 00000 n 0000108624 00000 n 0000109056 00000 n 0000109318 00000 n 0000109486 00000 n 0000110000 00000 n 0000110177 00000 n trailer << /Size 184 /Root 1 0 R /Info 2 0 R /ID [] >> startxref 120615 %%EOF orpie-1.5.2/doc/remove-tt.py0000644000175000017500000000076512322115103014360 0ustar paulpaul#!/usr/bin/env python # Strip out all the \texttt{} occurrences (not perfect, but good enough) import re, sys infilename = sys.argv[1] outfilename = sys.argv[2] infile = open(infilename, "r").read() tt_regex = re.compile("\\\\texttt\{([^}]+)}") def tt_replace(m): return m.group(1) replaced_string = re.sub(tt_regex, tt_replace, infile) outfile = open(outfilename, "w") outfile.write(replaced_string) outfile.close() # arch-tag: DO_NOT_CHANGE_97d4155d-0a4e-42ae-ae0a-0d064c1a7b71 orpie-1.5.2/doc/orpie-curses-keys.tex0000644000175000017500000000216112322115103016167 0ustar paulpaul% orpie-curses-keys manpage % % Notes: % This document is designed to be processed with the 'latex2man' perl % script. \documentclass[11pt,notitlepage]{article} \usepackage{latex2man} \setVersion{1.0} % end preamble %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{Name}{1}{orpie-curses-keys}{Paul J. Pelzl}{a configuration utility for orpierc}{orpie-curses-keys manpage} \Prog{orpie-curses-keys} is a small utility designed to assist in the creation of an \Cmd{orpierc}{5} file. \end{Name} \section{Synopsis} \Prog{orpie-curses-keys} \section{Description} \Prog{orpie-curses-keys} is a small interactive utility designed to help users of the \Cmd{orpie}{1} calculator to create a customized \Cmd{orpierc}{5} file. \Prog{orpie-curses-keys} translates keypresses into octal and string representations that can be used with the 'bind' command inside orpierc. Ctrl-C will exit the program. \section{See Also} \Cmd{orpie}{1}, \Cmd{orpierc}{5} \section{Author} This manpage is written by Paul J. Pelzl . \LatexManEnd % arch-tag: DO_NOT_CHANGE_d7f0503b-18fb-4c3a-b7cc-1a96db5322a3 orpie-1.5.2/doc/manual.tex.in0000644000175000017500000021515312322115103014467 0ustar paulpaul% Orpie documentation % % Notes: % This document is designed to be processed with the 'latex2man' perl % script. This script has a preprocessor, which is the source of the % IF LATEX ... ELSE ... END IF comments. % "latex2man -CLATEX -L" will output pure tex source, which can be % handled either via latex or hevea. (Also, latex2man sucks. If you know % of a better tool that does the same job, I'd love to hear about it.) % Hevea has its own preprocessor, which is the source of the BEGIN LATEX % and HEVEA comments. (Hevea doesn't suck.) \documentclass[11pt,notitlepage]{article} %@% IF LATEX %@% \usepackage{times} \usepackage{amsmath} \usepackage{fullpage} %@% ELSE %@% \usepackage{latex2man} \setVersion{1.4} %@% END-IF %@% % End preamble %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} %@% IF LATEX %@% \title{Orpie v1.5 User Manual} \author{Paul J. Pelzl} \date{September 13, 2007} \maketitle \begin{center} \emph{``Because the equals key is for the weak.''} \end{center} %@% IF LATEX %@% \tableofcontents \clearpage %@% ELSE %@% %@% END-IF %@% \section{Introduction} Orpie is a console-based RPN (reverse polish notation) desktop calculator. The interface is similar to that of modern Hewlett-Packard${}^{TM}$ calculators, but has been optimized for efficiency on a PC keyboard. The design is also influenced to some degree by the %BEGIN LATEX Mutt email client\footnote{http://www.mutt.org} %END LATEX %HEVEA \begin{rawhtml} Mutt email client \end{rawhtml} and the %BEGIN LATEX Vim editor\footnote{http://vim.sf.net}. %END LATEX %HEVEA \begin{rawhtml} Vim editor. \end{rawhtml} Orpie does not have graphing capability, nor does it offer much in the way of a programming interface; other applications such as %BEGIN LATEX GNU Octave\footnote{http://www.octave.org} %END LATEX %HEVEA \begin{rawhtml} GNU Octave. \end{rawhtml} are already very effective for such tasks. Orpie focuses specifically on helping you to crunch numbers quickly. Orpie is written in %BEGIN LATEX Objective Caml (aka OCaml)\footnote{http://caml.inria.fr/}, %END LATEX %HEVEA \begin{rawhtml} Objective Caml (aka OCaml), \end{rawhtml} a high-performance functional programming language with a whole lot of nice features. I highly recommend it. \section{Installation} This section describes how to install Orpie by compiling from source. Volunteers have pre-packaged Orpie for several popular operating systems, so you may be able to save yourself some time by installing from those packages. Please check the Orpie website for up-to-date package information. Before installing Orpie, you should have installed the %BEGIN LATEX GNU Scientific Library (GSL)\footnote{http://sources.redhat.com/gsl/} %END LATEX %HEVEA \begin{rawhtml} GNU Scientific Library (GSL) \end{rawhtml} version 1.4 or greater. You will also need a curses library (e.g. %BEGIN LATEX ncurses\footnote{http://www.gnu.org/software/ncurses/ncurses.html}), %END LATEX %HEVEA \begin{rawhtml} ncurses), \end{rawhtml} which is almost certainly already installed on your system. Finally, OCaml 3.07 or higher is required to compile the sources. You will need the Nums library that is distributed with OCaml; if you install OCaml from binary packages distributed by your OS vendor, you may find that separate Nums packages must also be installed. I will assume you have received this program in the form of a source tarball, e.g. ``\texttt{orpie-x.x.tar.gz}''. You have undoubtedly extracted this archive already (e.g. using ``\texttt{tar xvzf orpie-x.x.tar.gz}''). Enter the root of the Orpie installation directory, e.g. ``\texttt{cd orpie-x.x}''. You can compile the sources with the following sequence: \begin{verbatim} $ ./configure $ make \end{verbatim} Finally, run ``\texttt{make install}'' (as root) to install the executables. ``\texttt{configure}'' accepts a number of parameters that you can learn about with ``\texttt{./configure --help}''. Perhaps the most common of these is the {\tt --prefix} option, which lets you install to a non-standard directory\footnote{The default installation prefix is \texttt{/usr/local}. The \texttt{orpierc} file will be placed in \texttt{\$(prefix)/etc} by default; use the \texttt{--sysconfdir} option to choose a different location.}. %@% ELSE %@% %@% IF ORPIERC %@% \begin{Name}{5}{orpierc}{Paul J. Pelzl}{configuration file for the Orpie calculator}{orpierc manpage} \texttt{orpierc} is the configuration textfile for the \Cmd{orpie}{1} console calculator. \end{Name} %@% ELSE %@% \begin{Name}{1}{orpie}{Paul J. Pelzl}{a console-based RPN calculator}{Orpie 1.0 Manpage} \Prog{orpie} is a console-based RPN calculator with an interactive visual stack. \end{Name} \section{Synopsis} \Prog{orpie} %@% END-IF %@% %@% END-IF %@% %@% IF !ORPIERC %@% \section{Quick Start} %@% IF !LATEX %@% CAUTION: while this manpage should be suitable as a quick reference, it may be subject to miscellaneous shortcomings in typesetting. The definitive documentation is the user manual provided with Orpie in PDF format. %@% END-IF %@% This section describes how to use Orpie in its default configuration. After familiarizing yourself with the basic operations as outlined in this section, you may wish to consult %@% IF LATEX %@% Section \ref{advanced} %@% ELSE %@% the \Cmd{orpierc}{5} manpage %@% END-IF %@% to see how Orpie can be configured to better fit your needs. \subsection{Overview} %@% IF LATEX %@% You can start the calculator by executing \texttt{orpie}. %@% END-IF %@% The interface has two panels. The left panel combines status information with context-sensitive help; the right panel represents the calculator's stack. (Note that the left panel will be hidden if Orpie is run in a terminal with less than 80 columns.) In general, you perform calculations by first entering data on to the stack, then executing functions that operate on the stack data. As an example, you can hit \texttt{12+} in order to add 1 and 2. %@% IF LATEX %@% \subsection{Entering Data} \subsubsection{Entering Real Numbers} %@% ELSE %@% \subsection{Entering Real Numbers} %@% END-IF %@% To enter a real number, just type the desired digits and hit enter. The space bar will begin entry of a scientific notation exponent. The '\texttt{n}' key is used for negation. Here are some examples: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|r|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Keypresses & Resulting Entry \\ \hline \texttt{1.23} & \texttt{1.23} \\ \texttt{1.2323n} & \texttt{1.23e-23} \\ \texttt{1.23n23} & \texttt{-1.23e23} \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \subsubsection{Entering Complex Numbers} %@% ELSE %@% \subsection{Entering Complex Numbers} %@% END-IF %@% Orpie can represent complex numbers using either cartesian (rectangular) or polar coordinates. See %@% IF LATEX %@% Section \ref{rectpolar} %@% ELSE %@% PERFORMING BASIC COMMAND OPERATIONS %@% END-IF %@% to see how to change the complex number display mode. A complex number is entered by first pressing '\texttt{(}', then entering the real part, then pressing '\texttt{,}' followed by the imaginary part. Alternatively, you can press '\texttt{(}' followed by the magnitude, then '\texttt{<}' followed by the phase angle. The angle will be interpreted in degrees or radians, depending on the current setting of the angle mode %@% IF LATEX %@% (see Section \ref{anglemode}). %@% ELSE %@% (see PERFORMING BASIC COMMAND OPERATIONS). %@% END-IF %@% Examples: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|r|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Keypresses & Resulting Entry \\ \hline \texttt{(1.23, 4.56} & \texttt{(1.23, 4.56)} \\ \texttt{(0.7072<45} & \texttt{(0.500065915655126, 0.50006591...} \\ \texttt{(1.23n,4.5610} & \texttt{(-1.23, 45600000000)} \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \subsubsection{Entering Matrices} %@% ELSE %@% \subsection{Entering Matrices} %@% END-IF %@% You can enter matrices by pressing '\texttt{[}'. The elements of the matrix may then be entered as described in the previous sections, and should be separated using '\texttt{,}'. To start a new row of the matrix, press '\texttt{[}' again. On the stack, each row of the matrix is enclosed in a set of brackets; for example, the matrix %@% IF LATEX %@% %BEGIN LATEX \begin{displaymath} \left[ \begin{matrix} 1 & 2 \\ 3 & 4 \end{matrix} \right] \end{displaymath} %END LATEX %HEVEA \begin{center}\begin{tabular}{|cc|}1 & 2 \\ 3 & 4 \end{tabular}\end{center} %@% ELSE %@% \begin{Table}{2} 1 & 2 \\ 3 & 4 \end{Table} %@% END-IF %@% would appear on the stack as \texttt{[[1, 2][3, 4]]}. Examples of matrix entry: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|r|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Keypresses & Resulting Entry \\ \hline \texttt{[1,2[3,4} & \texttt{[[1, 2][3, 4]]} \\ \texttt{[1.210,0[3n,5n} & \texttt{[[ 12000000000, 0 ][ -3, -5 ]]} \\ \texttt{[(1,2,3,4[5,6,7,8} & \texttt{[[ (1, 2), (3, 4) ][ (5, 6), (...} \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \subsubsection{Entering Data With Units} %@% ELSE %@% \subsection{Entering Data With Units} %@% END-IF %@% Real and complex scalars and matrices can optionally be labeled with units. After typing in the numeric portion of the data, press '\texttt{\_}' followed by a units string. The format of units strings is described in %@% IF LATEX %@% Section \ref{unitsformat}. %@% ELSE %@% the UNITS FORMATTING section. %@% END-IF %@% Examples of entering dimensioned data: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|r|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Keypresses & Resulting Entry \\ \hline %@% IF LATEX %@% \texttt{1.234\_N*mm\^{}2/s} & \texttt{1.234\_N*mm\^{}2*s\^{}-1} \\ \texttt{(2.3,5\_s\^{}-4} & \texttt{(2.3, 5)\_s\^{}-4} \\ %@% ELSE %@% \texttt{1.234\_N*mm\Circum2/s} & \texttt{1.234\_N*mm\Circum2*s\Circum-1} \\ \texttt{(2.3,5\_s\Circum-4} & \texttt{(2.3, 5)\_s\Circum-4} \\ %@% END-IF %@% \texttt{[1,2[3,4\_lbf*in} & \texttt{[[ 1, 2 ][ 3, 4 ]]\_lbf*in} \\ \texttt{\_nm} & \texttt{1\_nm} \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \subsubsection{Entering Exact Integers} %@% ELSE %@% \subsection{Entering Exact Integers} %@% END-IF %@% An exact integer may be entered by pressing '\texttt{\#}' followed by the desired digits. The base of the integer will be assumed to be the same as the current calculator base mode (see %@% IF LATEX %@% Section \ref{basemode} %@% ELSE %@% PERFORMING BASIC COMMAND OPERATIONS %@% END-IF %@% to see how to set this mode). Alternatively, the desired base may be specified by pressing space and appending one of \{\texttt{b, o, d, h}\}, to represent binary, octal, decimal, or hexadecimal, respectively. On the stack, the representation of the integer will be changed to match the current base mode. Examples: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|r|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Keypresses & Resulting Entry \\ \hline %@% IF LATEX %@% \texttt{\#123456} & \texttt{\# 123456\`{}d} \\ \texttt{\#ffffh} & \texttt{\# 65535\`{}d} \\ \texttt{\#10101nb} & \texttt{\# -21\`{}d} \\ %@% ELSE %@% \texttt{\#123456} & \texttt{\# 123456`d} \\ \texttt{\#ffffh} & \texttt{\# 65535`d} \\ \texttt{\#10101nb} & \texttt{\# -21`d} \\ %@% END-IF %@% \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% Note that exact integers may have unlimited length, and the basic arithmetic operations (addition, subtraction, multiplication, division) will be performed using exact arithmetic when both arguments are integers. %@% IF LATEX %@% \subsubsection{Entering Variable Names} %@% ELSE %@% \subsection{Entering Variable Names} %@% END-IF %@% A variable name may be entered by pressing '\texttt{@}' followed by the desired variable name string. The string may contain alphanumeric characters, dashes, and underscores. Example: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|r|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Keypresses & Resulting Entry \\ \hline \texttt{@myvar} & \texttt{@ myvar}\\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% Orpie also supports autocompletion of variable names. The help panel displays a list of pre-existing variables that partially match the name currently being entered. You can press '\texttt{}' to iterate through the list of matching variables. As a shortcut, keys \texttt{-} will enter the variables (``registers'') \texttt{@ r01} through \texttt{@ r04}. %@% IF LATEX %@% \subsubsection{Entering Physical Constants} %@% ELSE %@% \subsection{Entering Physical Constants} %@% END-IF %@% Orpie includes definitions for a number of fundamental physical constants. To enter a constant, press '\texttt{C}', followed by the first few letters/digits of the constant's symbol, then hit enter. Orpie offers an autocompletion feature for physical constants, so you only need to type enough of the constant to identify it uniquely. A list of matching constants will appear in the left panel of the display, to assist you in finding the desired choice. The following is a list of Orpie's physical constant symbols: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Symbol & Physical Constant \\ \hline \texttt{NA} & Avagadro's number \\ \texttt{k} & Boltzmann constant \\ \texttt{Vm} & molar volume \\ \texttt{R} & universal gas constant \\ \texttt{stdT} & standard temperature \\ \texttt{stdP} & standard pressure \\ \texttt{sigma} & Stefan-Boltzmann constant \\ \texttt{c} & speed of light \\ \texttt{eps0} & permittivity of free space \\ \texttt{u0} & permeability of free space \\ \texttt{g} & acceleration of gravity \\ \texttt{G} & Newtonian gravitational constant \\ \texttt{h} & Planck's constant \\ \texttt{hbar} & Dirac's constant \\ \texttt{e} & electron charge \\ \texttt{me} & electron mass \\ \texttt{mp} & proton mass \\ \texttt{alpha} & fine structure constant \\ \texttt{phi} & magnetic flux quantum \\ \texttt{F} & Faraday's constant \\ \texttt{Rinf} & ``infinity'' Rydberg constant \\ \texttt{a0} & Bohr radius \\ \texttt{uB} & Bohr magneton \\ \texttt{uN} & nuclear magneton \\ \texttt{lam0} & wavelength of a 1eV photon \\ \texttt{f0} & frequency of a 1eV photon \\ \texttt{lamc} & Compton wavelength \\ \texttt{c3} & Wien's constant \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% All physical constants are defined in the Orpie run-configuration file; consult %@% IF LATEX %@% Section \ref{advanced} %@% ELSE %@% the \Cmd{orpierc}{5} manpage %@% END-IF %@% if you wish to define your own constants or change the existing definitions. %@% IF LATEX %@% \subsubsection{Entering Data With an External Editor} \label{editor} %@% ELSE %@% \subsection{Entering Data With an External Editor} %@% END-IF %@% Orpie can also parse input entered via an external editor. You may find this to be a convenient method for entering large matrices. Pressing '\texttt{E}' will launch the external editor, and the various data types may be entered as illustrated by the examples below: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Data Type & Sample Input String \\ \hline %@% IF LATEX %@% exact integer & \texttt{\#12345678\`{}d}, where the trailing letter is one of the base characters \{b, o, d, h\} \\ %@% ELSE %@% exact integer & \texttt{\#12345678`d}, where the trailing letter is one of the base characters \{b, o, d, h\} \\ %@% END-IF %@% real number & \texttt{-123.45e67} \\ complex number & \texttt{(1e10, 2)} or \texttt{(1 <90)} \\ real matrix & \texttt{[[1, 2][3.1, 4.5e10]]} \\ complex matrix & \texttt{[[(1, 0), 5][1e10, (2 <90)]]} \\ variable & \texttt{@myvar} \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% Real and complex numbers and matrices may have units appended; just add a units string such as ``\texttt{\_N*m/s}'' immediately following the numeric portion of the expression. Notice that the complex matrix input parser is quite flexible; real and complex matrix elements may be mixed, and cartesian and polar complex formats may be mixed as well. Multiple stack entries may be specified in the same file, if they are separated by whitespace. For example, entering \texttt{(1, 2) 1.5} into the editor will cause the complex value \texttt{(1, 2)} to be placed on the stack, followed by the real value \texttt{1.5}. The input parser will discard whitespace where possible, so feel free to add any form of whitespace between matrix rows, matrix elements, real and complex components, etc. \subsection{Executing Basic Function Operations} %@% IF LATEX %@% \label{functionops} %@% END-IF %@% Once some data has been entered on the stack, you can apply operations to that data. For example, '\texttt{+}' will add the last two elements on the stack. By default, the following keys have been bound to such operations: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Keys & Operations \\ \hline \texttt{+} & add last two stack elements \\ \texttt{-} & subtract element 1 from element 2 \\ \texttt{*} & multiply last two stack elements \\ \texttt{/} & divide element 2 by element 1 \\ %@% IF LATEX %@% \texttt{\^{}} & raise element 2 to the power of element 1 \\ %@% ELSE %@% \texttt{\Circum} & raise element 2 to the power of element 1 \\ %@% END-IF %@% \texttt{n} & negate last element \\ \texttt{i} & invert last element \\ \texttt{s} & square root function \\ \texttt{a} & absolute value function \\ \texttt{e} & exponential function \\ \texttt{l} & natural logarithm function \\ \texttt{c} & complex conjugate function \\ \texttt{!} & factorial function \\ \texttt{\%} & element 2 mod element 1 \\ \texttt{S} & store element 2 in (variable) element 1 \\ \texttt{;} & evaluate variable to obtain contents \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% As a shortcut, function operators will automatically enter any data that you were in the process of entering. So instead of the sequence \texttt{22+}, you could type simply \texttt{22+} and the second number would be entered before the addition operation is applied. As an additional shortcut, any variable names used as function arguments will be evaluated before application of the function. In other words, it is not necessary to evaluate variables before performing arithmetic operations on them. \subsection{Executing Function Abbreviations} %@% IF LATEX %@% \label{abbrevfunctions} %@% END-IF %@% One could bind nearly all calculator operations to specific keypresses, but this would rapidly get confusing since the PC keyboard is not labeled as nicely as a calculator keyboard is. For this reason, Orpie includes an \emph{abbreviation} syntax. To activate an abbreviation, press '\texttt{'}' (quote key), followed by the first few letters/digits of the abbreviation, then hit enter. Orpie offers an autocompletion feature for abbreviations, so you only need to type enough of the operation to identify it uniquely. The matching abbreviations will appear in the left panel of the display, to assist you in finding the appropriate operation. To avoid interface conflicts, abbreviations may be entered only when the entry buffer (the bottom line of the screen) is empty. The following functions are available as abbreviations: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|l|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Abbreviations & Functions \\ \hline \texttt{inv} & inverse function \\ \texttt{pow} & raise element 2 to the power of element 1 \\ \texttt{sq} & square last element \\ \texttt{sqrt} & square root function \\ \texttt{abs} & absolute value function \\ \texttt{exp} & exponential function \\ \texttt{ln} & natural logarithm function \\ %@% IF LATEX %@% \texttt{10\^{}} & base 10 exponential function \\ %@% ELSE %@% \texttt{10\Circum} & base 10 exponential function \\ %@% END-IF %@% \texttt{log10} & base 10 logarithm function \\ \texttt{conj} & complex conjugate function \\ \texttt{sin} & sine function \\ \texttt{cos} & cosine function \\ \texttt{tan} & tangent function \\ \texttt{sinh} & hyperbolic sine function \\ \texttt{cosh} & hyperbolic cosine function \\ \texttt{tanh} & hyperbolic tangent function \\ \texttt{asin} & arcsine function \\ \texttt{acos} & arccosine function \\ \texttt{atan} & arctangent function \\ \texttt{asinh} & inverse hyperbolic sine function \\ \texttt{acosh} & inverse hyperbolic cosine function \\ \texttt{atanh} & inverse hyperbolic tangent function \\ \texttt{re} & real part of complex number \\ \texttt{im} & imaginary part of complex number \\ \texttt{gamma} & Euler gamma function \\ \texttt{lngamma} & natural log of Euler gamma function \\ \texttt{erf} & error function \\ \texttt{erfc} & complementary error function \\ \texttt{fact} & factorial function \\ \texttt{gcd} & greatest common divisor function \\ \texttt{lcm} & least common multiple function \\ \texttt{binom} & binomial coefficient function \\ \texttt{perm} & permutation function \\ %@% IF LATEX %@% %BEGIN LATEX \hline \end{tabular} \end{center} \begin{center} \begin{tabular}[t]{|l|l|} \hline Abbreviations (con't) & Functions \\ \hline %END LATEX %@% END-IF %@% \texttt{trans} & matrix transpose \\ \texttt{trace} & trace of a matrix \\ \texttt{solvelin} & solve a linear system of the form Ax = b \\ \texttt{mod} & element 2 mod element 1 \\ \texttt{floor} & floor function \\ \texttt{ceil} & ceiling function \\ \texttt{toint} & convert a real number to an integer type \\ \texttt{toreal} & convert an integer type to a real number \\ \texttt{add} & add last two elements \\ \texttt{sub} & subtract element 1 from element 2 \\ \texttt{mult} & multiply last two elements \\ \texttt{div} & divide element 2 by element 1 \\ \texttt{neg} & negate last element \\ \texttt{store} & store element 2 in (variable) element 1 \\ \texttt{eval} & evaluate variable to obtain contents \\ \texttt{purge} & delete a variable \\ \texttt{total} & sum the columns of a real matrix \\ \texttt{mean} & compute the sample means of the columns of a real matrix \\ \texttt{sumsq} & sum the squares of the columns of a real matrix \\ \texttt{var} & compute the unbiased sample variances of the columns of a real matrix \\ \texttt{varbias} & compute the biased (population) sample variances of the columns of a real matrix \\ \texttt{stdev} & compute the unbiased sample standard deviations of the columns of a real matrix \\ \texttt{stdevbias} & compute the biased (pop.) sample standard deviations of the columns of a matrix \\ \texttt{min} & find the minima of the columns of a real matrix \\ \texttt{max} & find the maxima of the columns of a real matrix \\ \texttt{utpn} & compute the upper tail probability of a normal distribution \\ \texttt{uconvert} & convert element 2 to an equivalent expression with units matching element 1 \\ \texttt{ustand} & convert to equivalent expression using SI standard base units \\ \texttt{uvalue} & drop the units of the last element \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% Entering abbreviations can become tedious when performing repetitive calculations. To save some keystrokes, Orpie will automatically bind recently-used operations with no prexisting binding to keys \texttt{-}. The current autobindings can be viewed by pressing \texttt{'h'} to cycle between the various pages of the help panel. \subsection{Executing Basic Command Operations} %@% IF LATEX %@% \label{rectpolar} \label{anglemode} \label{basemode} %@% END-IF %@% In addition to the function operations listed in %@% IF LATEX %@% Section \ref{functionops}, %@% ELSE %@% the section EXECUTING BASIC FUNCTION OPERATIONS, %@% END-IF %@% a number of basic calculator commands have been bound to single keypresses: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Keys & Operations \\ \hline %@% IF LATEX %@% \texttt{$\backslash$} & drop last element \\ %@% ELSE %@% \texttt{\Bs} & drop last element \\ %@% END-IF %@% \texttt{|} & clear all stack elements \\ \texttt{} & swap last two elements \\ \texttt{} & duplicate last element (when entry buffer is empty) \\ \texttt{u} & undo last operation \\ \texttt{r} & toggle angle mode between degrees and radians \\ \texttt{p} & toggle complex display mode between rectangular and polar \\ \texttt{b} & cycle base display mode between binary, octal, decimal, hex \\ \texttt{h} & cycle through multiple help windows \\ \texttt{v} & view last stack element in a fullscreen editor \\ \texttt{E} & create a new stack element using an external editor \\ %@% IF LATEX %@% %BEGIN LATEX \texttt{P} & enter $\pi$ on the stack \\ %END LATEX %HEVEA \texttt{P} & enter 3.1415\dots on the stack \\ %@% ELSE %@% \texttt{P} & enter 3.14159265 on the stack \\ %@% END-IF %@% \texttt{C-L} & refresh the display \\ \texttt{} & begin stack browsing mode \\ \texttt{Q} & quit Orpie \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% \subsection{Executing Command Abbreviations} In addition to the function operations listed in %@% IF LATEX %@% Section \ref{abbrevfunctions}, %@% ELSE %@% the section EXECUTING FUNCTION ABBREVIATIONS, %@% END-IF %@% there are a large number of calculator commands that have been implemented using the abbreviation syntax: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|l|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Abbreviations & Calculator Operation \\ \hline \texttt{drop} & drop last element \\ \texttt{clear} & clear all stack elements \\ \texttt{swap} & swap last two elements \\ \texttt{dup} & duplicate last element \\ \texttt{undo} & undo last operation \\ \texttt{rad} & set angle mode to radians \\ \texttt{deg} & set angle mode to degrees \\ \texttt{rect} & set complex display mode to rectangular \\ \texttt{polar} & set complex display mode to polar \\ \texttt{bin} & set base display mode to binary \\ \texttt{oct} & set base display mode to octal \\ \texttt{dec} & set base display mode to decimal \\ \texttt{hex} & set base display mode to hexidecimal \\ \texttt{view} & view last stack element in a fullscreen editor \\ \texttt{edit} & create a new stack element using an external editor \\ %@% IF LATEX %@% %BEGIN LATEX \texttt{pi} & enter $\pi$ on the stack \\ %END LATEX %HEVEA \texttt{pi} & enter 3.1415\dots on the stack \\ %@% ELSE %@% \texttt{pi} & enter 3.14159265 on the stack \\ %@% END-IF %@% \texttt{rand} & generate a random number between 0 and 1 (uniformly distributed) \\ \texttt{refresh} & refresh the display \\ \texttt{about} & display a nifty ``About Orpie'' screen \\ \texttt{quit} & quit Orpie \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% \subsection{Browsing the Stack} Orpie offers a \emph{stack browsing mode} to assist in viewing and manipulating stack data. Press \texttt{} to enter stack browsing mode; this should highlight the last stack element. You can use the up and down arrow keys to select different stack elements. The following keys are useful in stack browsing mode: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline Keys & Operations \\ \hline \texttt{q} & quit stack browsing mode \\ \texttt{} & scroll selected entry to the left \\ \texttt{} & scroll selected entry to the right \\ \texttt{r} & cyclically ``roll'' stack elements downward, below the selected element (inclusive) \\ \texttt{R} & cyclically ``roll'' stack elements upward, below the selected element (inclusive) \\ \texttt{v} & view the currently selected element in a fullscreen editor \\ \texttt{E} & edit the currently selected element with an external editor \\ \texttt{} & duplicate the currently selected element \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% The left and right scrolling option may prove useful for viewing very lengthy stack entries, such as large matrices. The edit option provides a convenient way to correct data after it has been entered on the stack. \subsection{Units Formatting} A units string is a list of units separated by '\texttt{*}' to indicate multiplication and '\texttt{/}' to indicate division. Units may be raised to real-valued powers %@% IF LATEX %@% \label{unitsformat} using the '\texttt{\^{}}' character. A contrived example of a valid unit string would be "\texttt{N*nm\^{}2*kg/s/in\^{}-3*GHz\^{}2.34}". %@% ELSE %@% using the '\texttt{\Circum}' character. A contrived example of a valid unit string would be "\texttt{N*nm\Circum2*kg/s/in\Circum-3*GHz\Circum2.34}". %@% END-IF %@% Orpie supports the standard SI prefix set, \texttt{\{y, z, a, f, p, n, u, m, c, d, da, h, k, M, G, T, P, E, Z, Y\}} (note the use of '\texttt{u}' for micro-). These prefixes may be applied to any of the following exhaustive sets of units: %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline String & Length Unit \\ \hline \texttt{m} & meter \\ \texttt{ft} & foot \\ \texttt{in} & inch \\ \texttt{yd} & yard \\ \texttt{mi} & mile \\ \texttt{pc} & parsec \\ \texttt{AU} & astronomical unit \\ \texttt{Ang} & angstrom \\ \texttt{furlong} & furlong \\ \texttt{pt} & PostScript point \\ \texttt{pica} & PostScript pica \\ \texttt{nmi} & nautical mile \\ \texttt{lyr} & lightyear \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline String & Mass Unit \\ \hline \texttt{g} & gram \\ \texttt{lb} & pound mass \\ \texttt{oz} & ounce \\ \texttt{slug} & slug \\ \texttt{lbt} & Troy pound \\ \texttt{ton} & (USA) short ton \\ \texttt{tonl} & (UK) long ton \\ \texttt{tonm} & metric ton \\ \texttt{ct} & carat \\ \texttt{gr} & grain \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline String & Time Unit \\ \hline \texttt{s} & second \\ \texttt{min} & minute \\ \texttt{hr} & hour \\ \texttt{day} & day \\ \texttt{yr} & year \\ \texttt{Hz} & Hertz \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline String & Temperature Unit \\ \hline \texttt{K} & Kelvin \\ \texttt{R} & Rankine \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% Note: No, Celsius and Fahrenheit will not be supported. Because these temperature units do not share a common zero point, their behavior is ill-defined under many operations. %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline String & ``Amount of Substance'' Unit \\ \hline \texttt{mol} & Mole \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline String & Force Unit \\ \hline \texttt{N} & Newton \\ \texttt{lbf} & pound force \\ \texttt{dyn} & dyne \\ \texttt{kip} & kip \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline String & Energy Unit \\ \hline \texttt{J} & Joule \\ \texttt{erg} & erg \\ \texttt{cal} & calorie \\ \texttt{BTU} & british thermal unit \\ \texttt{eV} & electron volt \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline String & Electrical Unit \\ \hline \texttt{A} & Ampere \\ \texttt{C} & Coulomb \\ \texttt{V} & volt \\ \texttt{Ohm} & Ohm \\ \texttt{F} & Farad \\ \texttt{H} & Henry \\ \texttt{T} & Tesla \\ \texttt{G} & Gauss \\ \texttt{Wb} & Weber \\ \texttt{Mx} & Maxwell \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline String & Power Unit \\ \hline \texttt{W} & Watt \\ \texttt{hp} & horsepower \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline String & Pressure Unit \\ \hline \texttt{Pa} & Pascal \\ \texttt{atm} & atmosphere \\ \texttt{bar} & bar \\ \texttt{Ohm} & Ohm \\ \texttt{mmHg} & millimeters of mercury \\ \texttt{inHg} & inches of mercury \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline String & Luminance Unit \\ \hline \texttt{cd} & candela \\ \texttt{lm} & lumen \\ \texttt{lx} & lux \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% Note: Although the lumen is defined by \texttt{1\_lm = 1\_cd * sr}, Orpie drops the steridian because it is a dimensionless unit and therefore is of questionable use to a calculator. %@% IF LATEX %@% \begin{center} \begin{tabular}[t]{|r|l|} %@% ELSE %@% \begin{Table}{2} %@% END-IF %@% \hline String & Volume Unit \\ \hline \texttt{ozfl} & fluid ounce (US) \\ \texttt{cup} & cup (US) \\ \texttt{pt} & pint (US) \\ \texttt{qt} & quart (US) \\ \texttt{gal} & gallon (US) \\ \texttt{L} & liter \\ \hline %@% IF LATEX %@% \end{tabular} \end{center} %@% ELSE %@% \end{Table} %@% END-IF %@% All units are defined in the Orpie run-configuration file; consult %@% IF LATEX %@% Section \ref{advanced} %@% ELSE %@% the \Cmd{orpierc}{5} manpage %@% END-IF %@% if you wish to define your own units or change the existing definitions. %@% END-IF %@% % (!ORPIERC) %@% IF LATEX || ORPIERC %@% %@% IF LATEX %@% \section{Advanced Configuration} \label{advanced} %@% ELSE %@% \section{Introduction} CAUTION: while this manpage should be suitable as a quick reference, it may be subject to miscellaneous shortcomings in typesetting. The definitive documentation is the user manual provided with Orpie in PDF format. %@% END-IF %@% Orpie reads a run-configuration textfile (generally \texttt{/etc/orpierc} or \texttt{/usr/local/etc/orpierc}) to determine key and command bindings. You can create a personalized configuration file in \texttt{\$HOME/.orpierc}, and select bindings that match your usage patterns. The recommended procedure is to ``include'' the \texttt{orpierc} file provided with Orpie %@% IF LATEX %@% (see Section \ref{include}), %@% ELSE %@% (see INCLUDING OTHER RCFILES), %@% END-IF %@% and add or remove settings as desired. %@% IF LATEX %@% \subsection{\texttt{orpierc} Syntax} %@% ELSE %@% \section{\texttt{orpierc} Syntax} %@% END-IF %@% You may notice that the \texttt{orpierc} syntax is similar to the syntax used in the configuration file for the Mutt email client (muttrc). Within the \texttt{orpierc} file, strings should be enclosed in double quotes (\texttt{"}). A double quote character inside a string may be represented by %@% IF LATEX %@% \texttt{$\backslash$"} . %@% ELSE %@% \Bs " . %@% END-IF %@% The backslash character must be represented by doubling it %@% IF LATEX %@% (\texttt{$\backslash\backslash$}). %@% ELSE %@% (\Bs\Bs). %@% END-IF %@% %@% IF LATEX %@% \subsubsection{Including Other Rcfiles} \label{include} Syntax: \texttt{include \emph{filename\_string}} \\ \\ %@% ELSE %@% \subsection{Including Other Rcfiles} Syntax: include \emph{filename\_string} \\ \\ %@% END-IF %@% This syntax can be used to include one run-configuration file within another. This command could be used to load the default \texttt{orpierc} file (probably found in \texttt{/etc/orpierc}) within your personalized rcfile, \texttt{\~{}/.orpierc}. The filename string should be enclosed in quotes. %@% IF LATEX %@% \subsubsection{Setting Configuration Variables} \label{setvar} Syntax: \texttt{set \emph{variable}=\emph{value\_string}} \\ \\ %@% ELSE %@% \subsection{Setting Configuration Variables} Syntax: set \emph{variable}=\emph{value\_string} \\ \\ %@% END-IF %@% Several configuration variables can be set using this syntax; check %@% IF LATEX %@% Section \ref{variables} %@% ELSE %@% the CONFIGURATION VARIABLES description %@% END-IF %@% to see a list. The variables are unquoted, but the values should be quoted strings. %@% IF LATEX %@% \subsubsection{Creating Key Bindings} \label{bindings} %@% ELSE %@% \subsection{Creating Key Bindings} %@% END-IF %@% Syntax: \texttt{bind \emph{key\_identifier operation}} \\ \\ This command will bind a keypress to execute a calculator operation. The various operations, which should not be enclosed in quotes, may be found in %@% IF LATEX %@% Section \ref{operationslist}. %@% ELSE %@% the section on CALCULATOR OPERATIONS. %@% END-IF %@% Key identifiers may be specified by strings that represent a single keypress, for example \texttt{"m"} (quotes included). The key may be prefixed with %@% IF LATEX %@% \texttt{"$\backslash\backslash$C"} or \texttt{"$\backslash\backslash$M"} %@% ELSE %@% "\Bs\Bs C" or "\Bs\Bs M" %@% END-IF %@% to represent Control or Meta (Alt) modifiers, respectively; note that the backslash must be doubled. A number of special keys lack single-character representations, so the following strings may be used to represent them: \begin{itemize} \item \texttt{""} \item \texttt{""} \item \texttt{""} \item \texttt{""} \item \texttt{""} \item \texttt{""} \item \texttt{""} \item \texttt{""} \item \texttt{""} \item \texttt{""} \item \texttt{""} \item \texttt{""} \item \texttt{""} \item \texttt{""} \item \texttt{""} to \texttt{""} \end{itemize} Due to differences between various terminal emulators, this key identifier syntax may not be adequate to describe every keypress. As a workaround, Orpie will also accept key identifiers in octal notation. As an example, you could use %@% IF LATEX %@% \texttt{$\backslash$024} %@% ELSE %@% \Bs 024 %@% END-IF %@% (do \emph{not} enclose it in quotes) to represent Ctrl-T. Orpie includes a secondary executable, \texttt{orpie-curses-keys}, that prints out the key identifiers associated with keypresses. You may find it useful when customizing \texttt{orpierc}. Multiple keys may be bound to the same operation, if desired. %@% IF LATEX %@% \subsubsection{Removing Key Bindings} \label{unbindings} %@% ELSE %@% \subsection{Removing Key Bindings} %@% END-IF %@% Syntax: \\ \texttt{unbind\_function \emph{key\_identifier}} \\ \texttt{unbind\_command \emph{key\_identifier}} \\ \texttt{unbind\_edit \emph{key\_identifier}} \\ \texttt{unbind\_browse \emph{key\_identifier}} \\ \texttt{unbind\_abbrev \emph{key\_identifier}} \\ \texttt{unbind\_variable \emph{key\_identifier}} \\ \texttt{unbind\_integer \emph{key\_identifier}} \\ \\ These commands will remove key bindings associated with the various entry modes (functions, commands, editing operations, etc.). The key identifiers should be defined using the syntax described in the previous section. %@% IF LATEX %@% \subsubsection{Creating Key Auto-Bindings} \label{autobindings} %@% ELSE %@% \subsection{Creating Key Auto-Bindings} %@% END-IF %@% Syntax: \texttt{autobind \emph{key\_identifier}} \\ \\ In order to make repetitive calculations more pleasant, Orpie offers an automatic key binding feature. When a function or command is executed using its abbreviation, one of the keys selected by the \texttt{autobind} syntax will be automatically bound to that operation (unless the operation has already been bound to a key). The current set of autobindings can be viewed in the help panel by executing \texttt{command\_cycle\_help} (bound to \texttt{'h'} by default). The syntax for the key identifiers is provided in the previous section. %@% IF LATEX %@% \subsubsection{Creating Operation Abbreviations} \label{abbreviations} %@% ELSE %@% \subsection{Creating Operation Abbreviations} %@% END-IF %@% Syntax: \texttt{abbrev \emph{operation\_abbreviation operation}} \\ \\ You can use this syntax to set the abbreviations used within Orpie to represent the various functions and commands. A list of available operations may be found in %@% IF LATEX %@% Section \ref{operationslist}. %@% ELSE %@% the CALCULATOR OPERATIONS section. %@% END-IF %@% The operation abbreviations should be quoted strings, for example \texttt{"sin"} or \texttt{"log"}. Orpie performs autocompletion on these abbreviations, allowing you to type usually just a few letters in order to select the desired command. The order of the autocompletion matches will be the same as the order in which the abbreviations are registered by the rcfile--so you may wish to place the more commonly used operation abbreviations earlier in the list. Multiple abbreviations may be bound to the same operation, if desired. %@% IF LATEX %@% \subsubsection{Removing Operation Abbreviations} \label{unabbreviations} %@% ELSE %@% \subsection{Removing Operation Abbreviations} %@% END-IF %@% Syntax: \texttt{unabbrev \emph{operation\_abbreviation}} \\ \\ This syntax can be used to remove an operation abbreviation. The operation abbreviations should be quoted strings, as described in the previous section. %@% IF LATEX %@% \subsubsection{Creating Macros} \label{macros} %@% ELSE %@% \subsection{Creating Macros} %@% END-IF %@% Syntax: \texttt{macro \emph{key\_identifier macro\_string}} \\ \\ You can use this syntax to cause a single keypress (the \emph{key\_identifier}) to be interpreted as the series of keypresses listed in \emph{macro\_string}. The syntax for defining a keypress is the same as that defined in %@% IF LATEX %@% Section \ref{bindings}. %@% ELSE %@% the section on CREATING KEY BINDINGS. %@% END-IF %@% The macro string should be a list of whitespace-separated keypresses, e.g. \texttt{"2 2 +"} (including quotes). This macro syntax provides a way to create small programs; by way of example, the default orpierc file includes macros for the base 2 logarithm and the binary entropy function (bound to \texttt{L} and \texttt{H}, respectively), as well as ``register'' variable shortcuts (\texttt{} to \texttt{}). Macros may call other macros recursively. However, take care that a macro does not call \emph{itself} recursively; Orpie will not trap the infinite loop. Note that operation abbreviations may be accessed within macros. For example, \texttt{macro "A" "' a b o u t "} would bind \texttt{A} to display the ``about Orpie'' screen. %@% IF LATEX %@% \subsubsection{Creating Units} \label{units} %@% ELSE %@% \subsection{Creating Units} %@% END-IF %@% Syntax: \\ \texttt{base\_unit \emph{unit\_symbol preferred\_prefix}} \\ \texttt{unit \emph{unit\_symbol unit\_definition}} \\ \\ Units are defined in a two-step process: \begin{enumerate} \item Define a set of orthogonal ``base units.'' All other units must be expressible in terms of these base units. The base units can be given a preferred SI prefix, which will be used whenever the units are standardized (e.g. via \texttt{ustand}). The unit symbols and preferred prefixes should all be quoted strings; to prefer \emph{no} prefix, use the empty string (\texttt{""}). It is expected that most users will use the fundamental SI units for base units. \item Define all other units in terms of either base units or previously-defined units. Again, the unit symbol and unit definition should be quoted strings. The definition should take the form of a numeric value followed by a units string, e.g. \texttt{"2.5\_kN*m/s"}. See %@% IF LATEX %@% Section \ref{unitsformat} %@% ELSE %@% the UNITS FORMATTING section %@% END-IF %@% for more details on the unit string format. \end{enumerate} %@% IF LATEX %@% \subsubsection{Creating Constants} \label{constants} %@% ELSE %@% \subsection{Creating Constants} %@% END-IF %@% Syntax: \texttt{constant \emph{constant\_symbol constant\_definition}} \\ \\ This syntax can be used to define a physical constant. Both the constant symbol and definition must be quoted strings. The constant definition should be a numeric constant followed by a units string e.g. \texttt{"1.60217733e-19\_C"}. All units used in the constant definition must already have been defined. %@% IF LATEX %@% \subsection{Configuration Variables} \label{variables} The following configuration variables may be set as described in Section \ref{setvar}: %@% ELSE %@% \section{Configuration Variables} The following configuration variables may be set as described in the SETTING CONFIGURATION VARIABLES section. %@% END-IF %@% \begin{itemize} \item \texttt{datadir} \\ This variable should be set to the full path of the Orpie data directory, which will contain the calculator state save file, temporary buffers, etc. The default directory is %@% IF LATEX %@% \texttt{"\~{}/.orpie/"}. %@% ELSE %@% "\Bs\Tilde /.orpie/". %@% END-IF %@% \item \texttt{editor} \\ This variable may be set to the fullscreen editor of your choice. The default value is \texttt{"vi"}. It is recommended that you choose an editor that offers horizontal scrolling in place of word wrapping, so that the columns of large matrices can be properly aligned. (The Vim editor could be used in this fashion by setting \texttt{editor} to \texttt{"vim -c 'set nowrap'"}.) \item \texttt{hide\_help} \\ Set this variable to \texttt{"true"} to hide the left help/status panel, or leave it on the default of \texttt{"false"} to display the help panel. \item \texttt{conserve\_memory} \\ Set this variable to \texttt{"true"} to minimize memory usage, or leave it on the default of \texttt{"false"} to improve rendering performance. (By default, Orpie caches multiple string representations of all stack elements. Very large integers in particular require significant computation for string representation, so caching these strings can make display updates much faster.) \end{itemize} %@% IF LATEX %@% \subsection{Calculator Operations} \label{operationslist} %@% ELSE %@% \section{Calculator Operations} %@% END-IF %@% Every calculator operation can be made available to the interface using the syntax described in %@% IF LATEX %@% Sections \ref{bindings} and \ref{abbreviations}. %@% ELSE %@% the sections on CREATING KEY BINDINGS and CREATING OPERATION ABBREVIATIONS. %@% END-IF %@% The following is a list of every available operation. %@% IF LATEX %@% \subsubsection{Functions} \label{functions} %@% ELSE %@% \subsection{Functions} %@% END-IF %@% The following operations are functions--that is, they will consume at least one argument from the stack. Orpie will generally abort the computation and provide an informative error message if a function cannot be successfully applied (for example, if you try to compute the transpose of something that is not a matrix). For the exact integer data type, basic arithmetic operations will yield an exact integer result. Division of two exact integers will yield the quotient of the division. The more complicated functions will generally promote the integer to a real number, and as such the arithmetic will no longer be exact. \begin{itemize} \item \texttt{function\_10\_x} \\ Raise 10 to the power of the last stack element (inverse of function\_log10). \item \texttt{function\_abs} \\ Compute the absolute value of the last stack element. \item \texttt{function\_acos} \\ Compute the inverse cosine of the last stack element. For real numbers, The result will be provided either in degrees or radians, depending on the angle mode of the calculator. \item \texttt{function\_acosh} \\ Compute the inverse hyperbolic cosine of the last stack element. \item \texttt{function\_add} \\ Add last two stack elements. \item \texttt{function\_arg} \\ Compute the argument (phase angle of complex number) of the last stack element. The value will be provided in either degrees or radians, depending on the current angle mode of the calculator. \item \texttt{function\_asin} \\ Compute the inverse sine of the last stack element. For real numbers, The result will be provided either in degrees or radians, depending on the angle mode of the calculator. \item \texttt{function\_asinh} \\ Compute the inverse hyperbolic sine of the last stack element. \item \texttt{function\_atan} \\ Compute the inverse tangent of the last stack element. For real numbers, The result will be provided either in degrees or radians, depending on the angle mode of the calculator. \item \texttt{function\_atanh} \\ Compute the inverse hyperbolic tangent of the last stack element. \item \texttt{function\_binomial\_coeff} \\ Compute the binomial coefficient (``n choose k'') formed by the last two stack elements. If these arguments are real, the coefficient is computed using a fast approximation to the log of the gamma function, and therefore the result is subject to rounding errors. For exact integer arguments, the coefficient is computed using exact arithmetic; this has the potential to be a slow operation. \item \texttt{function\_ceiling} \\ Compute the ceiling of the last stack element. \item \texttt{function\_convert\_units} \\ Convert stack element 2 to an equivalent expression in the units of element 1. Element 1 should be real-valued, and its magnitude will be ignored when computing the conversion. \item \texttt{function\_cos} \\ Compute the cosine of the last stack element. If the argument is real, it will be assumed to be either degrees or radians, depending on the angle mode of the calculator. \item \texttt{function\_cosh} \\ Compute the hyperbolic cosine of the last stack element. \item \texttt{function\_conj} \\ Compute the complex conjugate of the last stack element. \item \texttt{function\_div} \\ Divide element 2 by element 1. \item \texttt{function\_erf} \\ Compute the error function of the last stack element. \item \texttt{function\_erfc} \\ Compute the complementary error function of the last stack element. \item \texttt{function\_eval} \\ Obtain the contents of the variable in the last stack position. \item \texttt{function\_exp} \\ Evaluate the exponential function of the last stack element. \item \texttt{function\_factorial} \\ Compute the factorial of the last stack element. For a real argument, this is computed using a fast approximation to the gamma function, and therefore the result may be subject to rounding errors (or overflow). For an exact integer argument, the factorial is computed using exact arithmetic; this has the potential to be a slow operation. \item \texttt{function\_floor} \\ Compute the floor of the last stack element. \item \texttt{function\_gamma} \\ Compute the Euler gamma function of the last stack element. \item \texttt{function\_gcd} \\ Compute the greatest common divisor of the last two stack elements. This operation may be applied only to integer type data. \item \texttt{function\_im} \\ Compute the imaginary part of the last stack element. \item \texttt{function\_inv} \\ Compute the multiplicative inverse of the last stack element. \item \texttt{function\_lcm} \\ Compute the least common multiple of the last two stack elements. This operation may be applied only to integer type data. \item \texttt{function\_ln} \\ Compute the natural logarithm of the last stack element. \item \texttt{function\_lngamma} \\ Compute the natural logarithm of the Euler gamma function of the last stack element. \item \texttt{function\_log10} \\ Compute the base-10 logarithm of the last stack element. \item \texttt{function\_maximum} \\ Find the maximum values of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. \item \texttt{function\_minimum} \\ Find the minimum values of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. \item \texttt{function\_mean} \\ Compute the sample means of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. \item \texttt{function\_mod} \\ Compute element 2 mod element 1. This operation can be applied only to integer type data. \item \texttt{function\_mult} \\ Multiply last two stack elements. \item \texttt{function\_neg} \\ Negate last stack element. \item \texttt{function\_permutation} \\ Compute the permutation coefficient determined by the last two stack elements 'n' and 'k': the number of ways of obtaining an ordered subset of k elements from a set of n elements. If these arguments are real, the coefficient is computed using a fast approximation to the log of the gamma function, and therefore the result is subject to rounding errors. For exact integer arguments, the coefficient is computed using exact arithmetic; this has the potential to be a slow operation. \item \texttt{function\_pow} \\ Raise element 2 to the power of element 1. \item \texttt{function\_purge} \\ Delete the variable in the last stack position. \item \texttt{function\_re} \\ Compute the real part of the last stack element. \item \texttt{function\_sin} \\ Compute the sine of the last stack element. If the argument is real, it will be assumed to be either degrees or radians, depending on the angle mode of the calculator. \item \texttt{function\_sinh} \\ Compute the hyperbolic sine of the last stack element. \item \texttt{function\_solve\_linear} \\ Solve a linear system of the form Ax = b, where A and b are the last two elements on the stack. A must be a square matrix and b must be a matrix with one column. This function does not compute inv(A), but obtains the solution by a more efficient LU decomposition method. This function is recommended over explicitly computing the inverse, especially when solving linear systems with relatively large dimension or with poorly conditioned matrices. \item \texttt{function\_sq} \\ Square the last stack element. \item \texttt{function\_sqrt} \\ Compute the square root of the last stack element. \item \texttt{function\_standardize\_units} \\ Convert the last stack element to an equivalent expression using the SI standard base units (kg, m, s, etc.). \item \texttt{function\_stdev\_unbiased} \\ Compute the unbiased sample standard deviation of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48's \texttt{sdev} function.) \item \texttt{function\_stdev\_biased} \\ Compute the biased (population) sample standard deviation of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48's \texttt{psdev} function.) \item \texttt{function\_store} \\ Store element 2 in (variable) element 1. \item \texttt{function\_sub} \\ Subtract element 1 from element 2. \item \texttt{function\_sumsq} \\ Sum the squares of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. \item \texttt{function\_tan} \\ Compute the tangent of the last stack element. If the argument is real, it will be assumed to be either degrees or radians, depending on the angle mode of the calculator. \item \texttt{function\_tanh} \\ Compute the hyperbolic tangent of the last stack element. \item \texttt{function\_to\_int} \\ Convert a real number to an integer type. \item \texttt{function\_to\_real} \\ Convert an integer type to a real number. \item \texttt{function\_total} \\ Sum each of the columns of a real NxM matrix, returning a 1xM matrix as a result. \item \texttt{function\_trace} \\ Compute the trace of a square matrix. \item \texttt{function\_transpose} \\ Compute the matrix transpose of the last stack element. \item \texttt{function\_unit\_value} \\ Drop the units of the last stack element. \item \texttt{function\_utpn} \\ Compute the upper tail probability of a normal distribution. \\ %@% IF LATEX %@% %BEGIN LATEX $utpn(m, v, x) = \int_x^\infty \frac{1}{\sqrt{2 \pi v}} \exp \left(- \frac{(m - y)^2}{2 v} \right) \,dy$ %END LATEX %HEVEA UTPN(m, v, x) = Integrate[ 1/Sqrt[2 Pi v] Exp[-(m-y)${}^2$/(2 v)], \{y, x, Infinity\}] %@% ELSE %@% UTPN(m, v, x) = Integrate[ 1/Sqrt[2 Pi v] Exp[-(m-y)^2/(2 v)], {y, x, Infinity}] %@% END-IF %@% \item \texttt{function\_var\_unbiased} \\ Compute the unbiased sample variance of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48's \texttt{var} function.) \item \texttt{function\_var\_biased} \\ Compute the biased (population) sample variance of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48's \texttt{pvar} function.) \end{itemize} %@% IF LATEX %@% \subsubsection{Commands} \label{commands} %@% ELSE %@% \subsection{Commands} %@% END-IF %@% The following operations are referred to as commands; they differ from functions because they do not take an argument. Many calculator interface settings are implemented as commands. \begin{itemize} \item \texttt{command\_about} \\ Display a nifty ``about Orpie'' credits screen. \item \texttt{command\_begin\_abbrev} \\ Begin entry of an operation abbreviation. \item \texttt{command\_begin\_browsing} \\ Enter stack browsing mode. \item \texttt{command\_begin\_constant} \\ Begin entry of a physical constant. \item \texttt{command\_begin\_variable} \\ Begin entry of a variable name. \item \texttt{command\_bin} \\ Set the base of exact integer representation to 2 (binary). \item \texttt{command\_clear} \\ Clear all elements from the stack. \item \texttt{command\_cycle\_base} \\ Cycle the base of exact integer representation between 2, 8, 10, and 16 (bin, oct, dec, and hex). \item \texttt{command\_cycle\_help} \\ Cycle through multiple help pages. The first page displays commonly used bindings, and the second page displays the current autobindings. \item \texttt{command\_dec} \\ Set the base of exact integer representation to 10 (decimal). \item \texttt{command\_deg} \\ Set the angle mode to degrees. \item \texttt{command\_drop} \\ Drop the last element off the stack. \item \texttt{command\_dup} \\ Duplicate the last stack element. \item \texttt{command\_enter\_pi} \\ %@% IF LATEX %@% %BEGIN LATEX Enter $\pi$ on the stack. %END LATEX %HEVEA Enter 3.1415\dots on the stack. %@% ELSE %@% Enter 3.1415\Dots on the stack. %@% END-IF %@% \item \texttt{command\_hex} \\ Set the base of exact integer representation to 16 (hexadecimal). \item \texttt{command\_oct} \\ Set the base of exact integer representation to 8 (octal). \item \texttt{command\_polar} \\ Set the complex display mode to polar. \item \texttt{command\_rad} \\ Set the angle mode to radians. \item \texttt{command\_rand} \\ Generate a random real-valued number between 0 (inclusive) and 1 (exclusive). The deviates are uniformly distributed. \item \texttt{command\_rect} \\ Set the complex display mode to rectangular (cartesian). \item \texttt{command\_refresh} \\ Refresh the display. \item \texttt{command\_swap} \\ Swap stack elements 1 and 2. \item \texttt{command\_quit} \\ Quit Orpie. \item \texttt{command\_toggle\_angle\_mode} \\ Toggle the angle mode between degrees and radians. \item \texttt{command\_toggle\_complex\_mode} \\ Toggle the complex display mode between rectangular and polar. \item \texttt{command\_undo} \\ Undo the last calculator operation. \item \texttt{command\_view} \\ View the last stack element in an external fullscreen editor. \item \texttt{command\_edit\_input} \\ Create a new stack element using an external editor. \end{itemize} %@% IF LATEX %@% \subsubsection{Edit Operations} \label{edits} %@% ELSE %@% \subsection{Edit Operations} %@% END-IF %@% The following operations are related to editing during data entry. These commands cannot be made available as operation abbreviations, since abbreviations are not accessible while entering data. These operations should be made available as single keypresses using the \texttt{bind} keyword. \begin{itemize} \item \texttt{edit\_angle} \\ Begin entering the phase angle of a complex number. (Orpie will assume the angle is in either degrees or radians, depending on the current angle mode.) \item \texttt{edit\_backspace} \\ Delete the last character entered. \item \texttt{edit\_begin\_integer} \\ Begin entering an exact integer. \item \texttt{edit\_begin\_units} \\ Begin appending units to a numeric expression. \item \texttt{edit\_complex} \\ Begin entering a complex number. \item \texttt{edit\_enter} \\ Enter the data that is currently being edited. \item \texttt{edit\_matrix} \\ Begin entering a matrix, or begin entering the next row of a matrix. \item \texttt{edit\_minus} \\ Enter a minus sign in input. \item \texttt{edit\_scientific\_notation\_base} \\ Begin entering the scientific notation exponent of a real number, or the base of an exact integer. \item \texttt{edit\_separator} \\ Begin editing the next element of a complex number or matrix. (This will insert a comma between elements.) \end{itemize} %@% IF LATEX %@% \subsubsection{Browsing Operations} \label{browse} %@% ELSE %@% \subsection{Browsing Operations} %@% END-IF %@% The following list of operations is available only in stack browsing mode. As abbreviations are unavailable while browsing the stack, these operations should be bound to single keypresses using the \texttt{bind} keyword. \begin{itemize} \item \texttt{browse\_echo} \\ Echo the currently selected element to stack level 1. \item \texttt{browse\_end} \\ Exit stack browsing mode. \item \texttt{browse\_drop} \\ Drop the currently selected stack element. \item \texttt{browse\_dropn} \\ Drop all stack elements below the current selection (inclusive). \item \texttt{browse\_keep} \\ Drop all stack elements \emph{except} the current selection. (This is complementary to \texttt{browse\_drop}. \item \texttt{browse\_keepn} \\ Drop all stack elements above the current selection (non-inclusive). (This is complementary to \texttt{browse\_dropn}. \item \texttt{browse\_next\_line} \\ Move the selection cursor down one line. \item \texttt{browse\_prev\_line} \\ Move the selection cursor up one line. \item \texttt{browse\_rolldown} \\ Cyclically ``roll'' stack elements downward, below the selected element (inclusive). \item \texttt{browse\_rollup} \\ Cyclically ``roll'' stack elements upward, below the selected element (inclusive) . \item \texttt{browse\_scroll\_left} \\ Scroll the selected element to the left (for viewing very large entries such as matrices). \item \texttt{browse\_scroll\_right} \\ Scroll the selected element to the right. \item \texttt{browse\_view} \\ View the currently selected stack element in a fullscreen editor. \item \texttt{browse\_edit} \\ Edit the currently selected stack element using an external editor. \end{itemize} %@% IF LATEX %@% \subsubsection{Abbreviation Entry Operations} \label{abbrevoperations} %@% ELSE %@% \subsection{Abbreviation Entry Operations} %@% END-IF %@% The following list of operations is available only while entering a function or command abbreviation, or while entering a physical constant. These operations must be bound to single keypresses using the \texttt{bind} keyword. \begin{itemize} \item \texttt{abbrev\_backspace} \\ Delete a character from the abbreviation string. \item \texttt{abbrev\_enter} \\ Execute the operation associated with the selected abbreviation. \item \texttt{abbrev\_exit} \\ Cancel abbreviation entry. \end{itemize} %@% IF LATEX %@% \subsubsection{Variable Entry Operations} \label{variableoperations} %@% ELSE %@% \subsection{Variable Entry Operations} %@% END-IF %@% The following list of operations is available only while entering a variable name. As abbreviations are unavailable while entering variables, these operations should be bound to single keypresses using the \texttt{bind} keyword. \begin{itemize} \item \texttt{variable\_backspace} \\ Delete a character from the variable name. \item \texttt{variable\_cancel} \\ Cancel entry of the variable name. \item \texttt{variable\_complete} \\ Autocomplete the variable name. \item \texttt{variable\_enter} \\ Enter the variable name on the stack. \end{itemize} %@% IF LATEX %@% \subsubsection{Integer Entry Operations} \label{integeroperations} %@% ELSE %@% \subsection{Integer Entry Operations} %@% END-IF %@% The following operation is available only while entering an integer; it can be made accessible by binding it to a single keypress using the \texttt{bind} keyword. \begin{itemize} \item \texttt{integer\_cancel} \\ Cancel entry of an integer. \end{itemize} % end ORPIERC %@% END-IF %@% %@% IF !ORPIERC %@% \section{Licensing} Orpie is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL), Version 2, as published by the Free Software Foundation. You should have received a copy of the GPL along with this program, in the file ``COPYING''. \section{Credits} Orpie includes portions of the %@% IF LATEX %@% %BEGIN LATEX ocamlgsl\footnote{http://oandrieu.nerim.net/ocaml/gsl/} %END LATEX %HEVEA \begin{rawhtml} ocamlgsl \end{rawhtml} %@% ELSE %@% ocamlgsl [1] %@% END-IF %@% bindings supplied by Olivier Andrieu, as well as the curses bindings from the %@% IF LATEX %@% %BEGIN LATEX OCaml Text Mode Kit\footnote{http://www.nongnu.org/ocaml-tmk/} %END LATEX %HEVEA \begin{rawhtml} OCaml Text Mode Kit \end{rawhtml} %@% ELSE %@% OCaml Text Mode Kit [2] %@% END-IF %@% written by Nicolas George. I would like to thank these authors for helping to make Orpie possible. \section{Contact info} Orpie author: Paul Pelzl \texttt{} \\ %@% IF LATEX %@% Orpie website: \texttt{http://pessimization.com/software/orpie} \\ %@% ELSE %@% Orpie website: \URL{http://pessimization.com/software/orpie} \\ %@% END-IF %@% \noindent Feel free to contact me if you have bugs, feature requests, patches, etc. I would also welcome volunteers interested in packaging Orpie for various platforms. %@% IF !LATEX && !ORPIERC %@% \section{References} \begin{Table}{2} [1] & \URL{http://oandrieu.nerim.net/ocaml/gsl/} \\ [2] & \URL{http://www.nongnu.org/ocaml-tmk/} [3] & \URL{http://www.gnu.org/software/gnu-arch/}. \end{Table} \section{See Also} \Cmd{orpierc}{5}, \Cmd{orpie-curses-keys}{1} %@% END-IF %@% %@% END-IF %@% % !ORPIERC %@% IF !LATEX %@% %@% IF ORPIERC %@% \section{See Also} \Cmd{orpie}{1}, \Cmd{orpie-curses-keys}{1} \section{Author} This manpage is written by Paul J. Pelzl . %@% END-IF %@% \LatexManEnd %@% END-IF %@% \end{document} % arch-tag: DO_NOT_CHANGE_db7ed8b2-8ea4-4e32-b0f6-50482487cb00 orpie-1.5.2/doc/orpie-curses-keys.10000644000175000017500000000171412322115107015536 0ustar paulpaul'\" t .\" Manual page created with latex2man on Fri Apr 11 20:43:35 CDT 2014 .\" NOTE: This file is generated, DO NOT EDIT. .de Vb .ft CW .nf .. .de Ve .ft R .fi .. .TH "ORPIE\-CURSES\-KEYS" "1" "11 April 2014" "a configuration utility for orpierc " "a configuration utility for orpierc " .SH NAME orpie\-curses\-keys is a small utility designed to assist in the creation of an \fIorpierc\fP(5) file. .PP .SH SYNOPSIS orpie\-curses\-keys .PP .SH DESCRIPTION orpie\-curses\-keys is a small interactive utility designed to help users of the \fIorpie\fP(1) calculator to create a customized \fIorpierc\fP(5) file. orpie\-curses\-keys translates keypresses into octal and string representations that can be used with the \&'bind\&' command inside orpierc. Ctrl\-C will exit the program. .PP .SH SEE ALSO \fIorpie\fP(1), \fIorpierc\fP(5) .PP .SH AUTHOR This manpage is written by Paul J. Pelzl . .PP .\" NOTE: This file is generated, DO NOT EDIT. orpie-1.5.2/doc/.arch-inventory0000644000175000017500000000053712322115103015032 0ustar paulpaulexclude ^(.arch-ids|\{arch\})$ junk ^(,.*|requests|traces\.0)$ precious ^(\+.*|.*\.(dvi|ps|pdf|html|log|aux|[1-7])|output\.0|\.gdbinit|\.#ckpts-lock|=build\.*|=install\.*|RCS|RCSLOG|SCCS|TAGS)$ backup ^.*(~|\.~[0-9]+~|\.bak|\.orig|\.rej|\.original|\.modified|\.reject)$ unrecognized ^(.*\.(so|core|so(\.[[:digit:]]+)*)|core)$ source ^[_=a-zA-Z0-9].*$ orpie-1.5.2/doc/TODO0000644000175000017500000000053712322115103012551 0ustar paulpaulOrpie To-Do List (roughly in order of priority) -------------------------------------------------------------------------------- Orpie is pretty much in maintenance mode at the moment. Please report bugs to . New features are unlikely to be implemented by the Orpie maintaner, but reasonable patches will certainly be accepted. orpie-1.5.2/doc/Makefile0000644000175000017500000000213212322115103013512 0ustar paulpaul# Orpie documentation makefile all: manual.pdf manual.html post-build-cleanup orpie.1 orpierc.5 orpie-curses-keys.1 manual.ps: dvi dvips -tletterSize -Ppdf -G0 manual.dvi dvi: manual.tex latex manual.tex latex manual.tex manual.tex: manual.tex.in latex2man -CLATEX -L manual.tex.in manual.tex manual.pdf: manual.ps ps2pdf13 manual.ps manual.html: manual.tex hevea -fix manual.tex hevea -fix manual.tex manual.tex.stripped: manual.tex.in python remove-tt.py manual.tex.in manual.tex.stripped orpie.1: manual.tex.stripped latex2man -M manual.tex.stripped orpie.1 orpierc.5: manual.tex.stripped latex2man -CORPIERC -M manual.tex.stripped orpierc.5 orpie-curses-keys.1: orpie-curses-keys.tex latex2man -M orpie-curses-keys.tex orpie-curses-keys.1 post-build-cleanup: manual.pdf manual.html orpie.1 orpierc.5 orpie-curses-keys.1 rm -f *.aux *.log *.toc *.haux *.htoc *.dvi *.ps *.stripped manual.tex clean: rm -f manual.tex *.aux *.log *.toc *.haux *.htoc *.dvi *.ps *.pdf *.html *.stripped orpie.1 orpierc.5 orpie-curses-keys.1 # arch-tag: DO_NOT_CHANGE_a5d62ea3-3a73-4de2-a2b3-a70bb310823f orpie-1.5.2/doc/orpie.10000644000175000017500000005043412322115107013266 0ustar paulpaul'\" t .\" Manual page created with latex2man on Fri Apr 11 20:43:35 CDT 2014 .\" NOTE: This file is generated, DO NOT EDIT. .de Vb .ft CW .nf .. .de Ve .ft R .fi .. .TH "ORPIE" "1" "11 April 2014" "a console\-based RPN calculator " "a console\-based RPN calculator " .SH NAME orpie is a console\-based RPN calculator with an interactive visual stack. .PP .SH SYNOPSIS orpie .PP .SH QUICK START CAUTION: while this manpage should be suitable as a quick reference, it may be subject to miscellaneous shortcomings in typesetting. The definitive documentation is the user manual provided with Orpie in PDF format. .PP This section describes how to use Orpie in its default configuration. After familiarizing yourself with the basic operations as outlined in this section, you may wish to consult the \fIorpierc\fP(5) manpage to see how Orpie can be configured to better fit your needs. .PP .SS OVERVIEW The interface has two panels. The left panel combines status information with context\-sensitive help; the right panel represents the calculator\&'s stack. (Note that the left panel will be hidden if Orpie is run in a terminal with less than 80 columns.) .PP In general, you perform calculations by first entering data on to the stack, then executing functions that operate on the stack data. As an example, you can hit 12+ in order to add 1 and 2. .PP .SS ENTERING REAL NUMBERS To enter a real number, just type the desired digits and hit enter. The space bar will begin entry of a scientific notation exponent. The \&'n\&' key is used for negation. Here are some examples: .PP .TS H l l . _ Keypresses Resulting Entry _ 1.23 1.23 1.2323n 1.23e\-23 1.23n23 \-1.23e23 _ .TE .PP .SS ENTERING COMPLEX NUMBERS Orpie can represent complex numbers using either cartesian (rectangular) or polar coordinates. See PERFORMING BASIC COMMAND OPERATIONS to see how to change the complex number display mode. .PP A complex number is entered by first pressing \&'(\&', then entering the real part, then pressing \&',\&' followed by the imaginary part. Alternatively, you can press \&'(\&' followed by the magnitude, then \&'<\&' followed by the phase angle. The angle will be interpreted in degrees or radians, depending on the current setting of the angle mode (see PERFORMING BASIC COMMAND OPERATIONS). Examples: .PP .TS H l l . _ Keypresses Resulting Entry _ (1.23, 4.56 (1.23, 4.56) (0.7072<45 (0.500065915655126, 0.50006591... (1.23n,4.5610 (\-1.23, 45600000000) _ .TE .PP .SS ENTERING MATRICES You can enter matrices by pressing \&'[\&'\&. The elements of the matrix may then be entered as described in the previous sections, and should be separated using \&',\&'\&. To start a new row of the matrix, press \&'[\&' again. On the stack, each row of the matrix is enclosed in a set of brackets; for example, the matrix .PP .TS H l l . 1 2 3 4 .TE .PP would appear on the stack as [[1, 2][3, 4]]. .PP Examples of matrix entry: .PP .TS H l l . _ Keypresses Resulting Entry _ [1,2[3,4 [[1, 2][3, 4]] [1.210,0[3n,5n [[ 12000000000, 0 ][ \-3, \-5 ]] [(1,2,3,4[5,6,7,8 [[ (1, 2), (3, 4) ][ (5, 6), (... _ .TE .PP .SS ENTERING DATA WITH UNITS Real and complex scalars and matrices can optionally be labeled with units. After typing in the numeric portion of the data, press \&'_\&' followed by a units string. The format of units strings is described in the UNITS FORMATTING section. .PP Examples of entering dimensioned data: .PP .TS H l l . _ Keypresses Resulting Entry _ 1.234_N*mm^2/s 1.234_N*mm^2*s^\-1 (2.3,5_s^\-4 (2.3, 5)_s^\-4 [1,2[3,4_lbf*in [[ 1, 2 ][ 3, 4 ]]_lbf*in _nm 1_nm _ .TE .PP .SS ENTERING EXACT INTEGERS An exact integer may be entered by pressing \&'#\&' followed by the desired digits. The base of the integer will be assumed to be the same as the current calculator base mode (see PERFORMING BASIC COMMAND OPERATIONS to see how to set this mode). Alternatively, the desired base may be specified by pressing space and appending one of {b, o, d, h}, to represent binary, octal, decimal, or hexadecimal, respectively. On the stack, the representation of the integer will be changed to match the current base mode. Examples: .PP .TS H l l . _ Keypresses Resulting Entry _ #123456 # 123456`d #ffffh # 65535`d #10101nb # \-21`d _ .TE .PP Note that exact integers may have unlimited length, and the basic arithmetic operations (addition, subtraction, multiplication, division) will be performed using exact arithmetic when both arguments are integers. .PP .SS ENTERING VARIABLE NAMES A variable name may be entered by pressing \&'@\&' followed by the desired variable name string. The string may contain alphanumeric characters, dashes, and underscores. Example: .PP .TS H l l . _ Keypresses Resulting Entry _ @myvar @ myvar _ .TE .PP Orpie also supports autocompletion of variable names. The help panel displays a list of pre\-existing variables that partially match the name currently being entered. You can press \&'\&' to iterate through the list of matching variables. .PP As a shortcut, keys \- will enter the variables (``registers\&'') @ r01 through @ r04. .PP .SS ENTERING PHYSICAL CONSTANTS Orpie includes definitions for a number of fundamental physical constants. To enter a constant, press \&'C\&', followed by the first few letters/digits of the constant\&'s symbol, then hit enter. Orpie offers an autocompletion feature for physical constants, so you only need to type enough of the constant to identify it uniquely. A list of matching constants will appear in the left panel of the display, to assist you in finding the desired choice. .PP The following is a list of Orpie\&'s physical constant symbols: .PP .TS H l l . _ Symbol Physical Constant _ NA Avagadro\&'s number k Boltzmann constant Vm molar volume R universal gas constant stdT standard temperature stdP standard pressure sigma Stefan\-Boltzmann constant c speed of light eps0 permittivity of free space u0 permeability of free space g acceleration of gravity G Newtonian gravitational constant h Planck\&'s constant hbar Dirac\&'s constant e electron charge me electron mass mp proton mass alpha fine structure constant phi magnetic flux quantum F Faraday\&'s constant Rinf ``infinity\&'' Rydberg constant a0 Bohr radius uB Bohr magneton uN nuclear magneton lam0 wavelength of a 1eV photon f0 frequency of a 1eV photon lamc Compton wavelength c3 Wien\&'s constant _ .TE .PP All physical constants are defined in the Orpie run\-configuration file; consult the \fIorpierc\fP(5) manpage if you wish to define your own constants or change the existing definitions. .PP .SS ENTERING DATA WITH AN EXTERNAL EDITOR Orpie can also parse input entered via an external editor. You may find this to be a convenient method for entering large matrices. Pressing \&'E\&' will launch the external editor, and the various data types may be entered as illustrated by the examples below: .PP .TS H l l . _ Data Type Sample Input String _ exact integer #12345678`d, where the trailing letter is one of the base characters {b, o, d, h} real number \-123.45e67 complex number (1e10, 2) or (1 <90) real matrix [[1, 2][3.1, 4.5e10]] complex matrix [[(1, 0), 5][1e10, (2 <90)]] variable @myvar _ .TE .PP Real and complex numbers and matrices may have units appended; just add a units string such as ``_N*m/s\&'' immediately following the numeric portion of the expression. .PP Notice that the complex matrix input parser is quite flexible; real and complex matrix elements may be mixed, and cartesian and polar complex formats may be mixed as well. .PP Multiple stack entries may be specified in the same file, if they are separated by whitespace. For example, entering (1, 2) 1.5 into the editor will cause the complex value (1, 2) to be placed on the stack, followed by the real value 1.5. .PP The input parser will discard whitespace where possible, so feel free to add any form of whitespace between matrix rows, matrix elements, real and complex components, etc. .PP .SS EXECUTING BASIC FUNCTION OPERATIONS Once some data has been entered on the stack, you can apply operations to that data. For example, \&'+\&' will add the last two elements on the stack. By default, the following keys have been bound to such operations: .PP .TS H l l . _ Keys Operations _ + add last two stack elements \- subtract element 1 from element 2 * multiply last two stack elements / divide element 2 by element 1 ^ raise element 2 to the power of element 1 n negate last element i invert last element s square root function a absolute value function e exponential function l natural logarithm function c complex conjugate function ! factorial function % element 2 mod element 1 S store element 2 in (variable) element 1 ; evaluate variable to obtain contents _ .TE .PP As a shortcut, function operators will automatically enter any data that you were in the process of entering. So instead of the sequence 22+, you could type simply 22+ and the second number would be entered before the addition operation is applied. .PP As an additional shortcut, any variable names used as function arguments will be evaluated before application of the function. In other words, it is not necessary to evaluate variables before performing arithmetic operations on them. .PP .SS EXECUTING FUNCTION ABBREVIATIONS One could bind nearly all calculator operations to specific keypresses, but this would rapidly get confusing since the PC keyboard is not labeled as nicely as a calculator keyboard is. For this reason, Orpie includes an \fIabbreviation\fP syntax. .PP To activate an abbreviation, press \&''' (quote key), followed by the first few letters/digits of the abbreviation, then hit enter. Orpie offers an autocompletion feature for abbreviations, so you only need to type enough of the operation to identify it uniquely. The matching abbreviations will appear in the left panel of the display, to assist you in finding the appropriate operation. .PP To avoid interface conflicts, abbreviations may be entered only when the entry buffer (the bottom line of the screen) is empty. .PP The following functions are available as abbreviations: .PP .TS H l l . _ Abbreviations Functions _ inv inverse function pow raise element 2 to the power of element 1 sq square last element sqrt square root function abs absolute value function exp exponential function ln natural logarithm function 10^ base 10 exponential function log10 base 10 logarithm function conj complex conjugate function sin sine function cos cosine function tan tangent function sinh hyperbolic sine function cosh hyperbolic cosine function tanh hyperbolic tangent function asin arcsine function acos arccosine function atan arctangent function asinh inverse hyperbolic sine function acosh inverse hyperbolic cosine function atanh inverse hyperbolic tangent function re real part of complex number im imaginary part of complex number gamma Euler gamma function lngamma natural log of Euler gamma function erf error function erfc complementary error function fact factorial function gcd greatest common divisor function lcm least common multiple function binom binomial coefficient function perm permutation function trans matrix transpose trace trace of a matrix solvelin solve a linear system of the form Ax = b mod element 2 mod element 1 floor floor function ceil ceiling function toint convert a real number to an integer type toreal convert an integer type to a real number add add last two elements sub subtract element 1 from element 2 mult multiply last two elements div divide element 2 by element 1 neg negate last element store store element 2 in (variable) element 1 eval evaluate variable to obtain contents purge delete a variable total sum the columns of a real matrix mean compute the sample means of the columns of a real matrix sumsq sum the squares of the columns of a real matrix var compute the unbiased sample variances of the columns of a real matrix varbias compute the biased (population) sample variances of the columns of a real matrix stdev compute the unbiased sample standard deviations of the columns of a real matrix stdevbias compute the biased (pop.) sample standard deviations of the columns of a matrix min find the minima of the columns of a real matrix max find the maxima of the columns of a real matrix utpn compute the upper tail probability of a normal distribution uconvert convert element 2 to an equivalent expression with units matching element 1 ustand convert to equivalent expression using SI standard base units uvalue drop the units of the last element _ .TE .PP Entering abbreviations can become tedious when performing repetitive calculations. To save some keystrokes, Orpie will automatically bind recently\-used operations with no prexisting binding to keys \-. The current autobindings can be viewed by pressing \&'h\&' to cycle between the various pages of the help panel. .PP .SS EXECUTING BASIC COMMAND OPERATIONS In addition to the function operations listed in the section EXECUTING BASIC FUNCTION OPERATIONS, a number of basic calculator commands have been bound to single keypresses: .PP .TS H l l . _ Keys Operations _ \\ drop last element | clear all stack elements swap last two elements duplicate last element (when entry buffer is empty) u undo last operation r toggle angle mode between degrees and radians p toggle complex display mode between rectangular and polar b cycle base display mode between binary, octal, decimal, hex h cycle through multiple help windows v view last stack element in a fullscreen editor E create a new stack element using an external editor P enter 3.14159265 on the stack C\-L refresh the display begin stack browsing mode Q quit Orpie _ .TE .PP .SS EXECUTING COMMAND ABBREVIATIONS In addition to the function operations listed in the section EXECUTING FUNCTION ABBREVIATIONS, there are a large number of calculator commands that have been implemented using the abbreviation syntax: .PP .TS H l l . _ Abbreviations Calculator Operation _ drop drop last element clear clear all stack elements swap swap last two elements dup duplicate last element undo undo last operation rad set angle mode to radians deg set angle mode to degrees rect set complex display mode to rectangular polar set complex display mode to polar bin set base display mode to binary oct set base display mode to octal dec set base display mode to decimal hex set base display mode to hexidecimal view view last stack element in a fullscreen editor edit create a new stack element using an external editor pi enter 3.14159265 on the stack rand generate a random number between 0 and 1 (uniformly distributed) refresh refresh the display about display a nifty ``About Orpie\&'' screen quit quit Orpie _ .TE .PP .SS BROWSING THE STACK Orpie offers a \fIstack browsing mode\fP to assist in viewing and manipulating stack data. Press to enter stack browsing mode; this should highlight the last stack element. You can use the up and down arrow keys to select different stack elements. The following keys are useful in stack browsing mode: .PP .TS H l l . _ Keys Operations _ q quit stack browsing mode scroll selected entry to the left scroll selected entry to the right r cyclically ``roll\&'' stack elements downward, below the selected element (inclusive) R cyclically ``roll\&'' stack elements upward, below the selected element (inclusive) v view the currently selected element in a fullscreen editor E edit the currently selected element with an external editor duplicate the currently selected element _ .TE .PP The left and right scrolling option may prove useful for viewing very lengthy stack entries, such as large matrices. The edit option provides a convenient way to correct data after it has been entered on the stack. .PP .SS UNITS FORMATTING A units string is a list of units separated by \&'*\&' to indicate multiplication and \&'/\&' to indicate division. Units may be raised to real\-valued powers using the \&'^\&'character. A contrived example of a valid unit string would be "N*nm^2*kg/s/in^\-3*GHz^2.34". .PP Orpie supports the standard SI prefix set, {y, z, a, f, p, n, u, m, c, d, da, h, k, M, G, T, P, E, Z, Y} (note the use of \&'u\&' for micro\-). These prefixes may be applied to any of the following exhaustive sets of units: .PP .TS H l l . _ String Length Unit _ m meter ft foot in inch yd yard mi mile pc parsec AU astronomical unit Ang angstrom furlong furlong pt PostScript point pica PostScript pica nmi nautical mile lyr lightyear _ .TE .PP .TS H l l . _ String Mass Unit _ g gram lb pound mass oz ounce slug slug lbt Troy pound ton (USA) short ton tonl (UK) long ton tonm metric ton ct carat gr grain _ .TE .PP .TS H l l . _ String Time Unit _ s second min minute hr hour day day yr year Hz Hertz _ .TE .PP .TS H l l . _ String Temperature Unit _ K Kelvin R Rankine _ .TE .PP Note: No, Celsius and Fahrenheit will not be supported. Because these temperature units do not share a common zero point, their behavior is ill\-defined under many operations. .PP .TS H l l . _ String ``Amount of Substance\&'' Unit _ mol Mole _ .TE .PP .TS H l l . _ String Force Unit _ N Newton lbf pound force dyn dyne kip kip _ .TE .PP .TS H l l . _ String Energy Unit _ J Joule erg erg cal calorie BTU british thermal unit eV electron volt _ .TE .PP .TS H l l . _ String Electrical Unit _ A Ampere C Coulomb V volt Ohm Ohm F Farad H Henry T Tesla G Gauss Wb Weber Mx Maxwell _ .TE .PP .TS H l l . _ String Power Unit _ W Watt hp horsepower _ .TE .PP .TS H l l . _ String Pressure Unit _ Pa Pascal atm atmosphere bar bar Ohm Ohm mmHg millimeters of mercury inHg inches of mercury _ .TE .PP .TS H l l . _ String Luminance Unit _ cd candela lm lumen lx lux _ .TE .PP Note: Although the lumen is defined by 1_lm = 1_cd * sr, Orpie drops the steridian because it is a dimensionless unit and therefore is of questionable use to a calculator. .PP .TS H l l . _ String Volume Unit _ ozfl fluid ounce (US) cup cup (US) pt pint (US) qt quart (US) gal gallon (US) L liter _ .TE .PP All units are defined in the Orpie run\-configuration file; consult the \fIorpierc\fP(5) manpage if you wish to define your own units or change the existing definitions. .PP .SH LICENSING Orpie is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL), Version 2, as published by the Free Software Foundation. You should have received a copy of the GPL along with this program, in the file ``COPYING\&''\&. .PP .SH CREDITS Orpie includes portions of the ocamlgsl [1] bindings supplied by Olivier Andrieu, as well as the curses bindings from the OCaml Text Mode Kit [2] written by Nicolas George. I would like to thank these authors for helping to make Orpie possible. .PP .SH CONTACT INFO Orpie author: Paul Pelzl .br Orpie website: \fBhttp://pessimization.com/software/orpie\fP .br .PP Feel free to contact me if you have bugs, feature requests, patches, etc. I would also welcome volunteers interested in packaging Orpie for various platforms. .PP .SH REFERENCES .PP .TS H l l . [1] \fBhttp://oandrieu.nerim.net/ocaml/gsl/\fP [2] \fBhttp://www.nongnu.org/ocaml\-tmk/\fP [3] \fBhttp://www.gnu.org/software/gnu\-arch/\fP\&. .TE .PP .SH SEE ALSO \fIorpierc\fP(5), \fIorpie\-curses\-keys\fP(1) .PP .\" NOTE: This file is generated, DO NOT EDIT. orpie-1.5.2/doc/orpierc.50000644000175000017500000006304212322115107013616 0ustar paulpaul'\" t .\" Manual page created with latex2man on Fri Apr 11 20:43:35 CDT 2014 .\" NOTE: This file is generated, DO NOT EDIT. .de Vb .ft CW .nf .. .de Ve .ft R .fi .. .TH "ORPIERC" "5" "11 April 2014" "configuration file for the Orpie calculator " "configuration file for the Orpie calculator " .SH NAME orpierc is the configuration textfile for the \fIorpie\fP(1) console calculator. .PP .SH INTRODUCTION CAUTION: while this manpage should be suitable as a quick reference, it may be subject to miscellaneous shortcomings in typesetting. The definitive documentation is the user manual provided with Orpie in PDF format. .PP Orpie reads a run\-configuration textfile (generally /etc/orpierc or /usr/local/etc/orpierc) to determine key and command bindings. You can create a personalized configuration file in $HOME/.orpierc, and select bindings that match your usage patterns. The recommended procedure is to ``include\&'' the orpierc file provided with Orpie (see INCLUDING OTHER RCFILES), and add or remove settings as desired. .PP .SH ORPIERC SYNTAX You may notice that the orpierc syntax is similar to the syntax used in the configuration file for the Mutt email client (muttrc). .PP Within the orpierc file, strings should be enclosed in double quotes ("). A double quote character inside a string may be represented by \\" \&. The backslash character must be represented by doubling it (\\\\). .PP .SS INCLUDING OTHER RCFILES Syntax: include \fIfilename_string\fP .br .br This syntax can be used to include one run\-configuration file within another. This command could be used to load the default orpierc file (probably found in /etc/orpierc) within your personalized rcfile, {/.orpierc}. The filename string should be enclosed in quotes. .PP .SS SETTING CONFIGURATION VARIABLES Syntax: set \fIvariable\fP=\fIvalue_string\fP .br .br Several configuration variables can be set using this syntax; check the CONFIGURATION VARIABLES description to see a list. The variables are unquoted, but the values should be quoted strings. .PP .SS CREATING KEY BINDINGS Syntax: bind \fIkey_identifier operation\fP .br .br This command will bind a keypress to execute a calculator operation. The various operations, which should not be enclosed in quotes, may be found in the section on CALCULATOR OPERATIONS. Key identifiers may be specified by strings that represent a single keypress, for example "m" (quotes included). The key may be prefixed with "\\\\C" or "\\\\M" to represent Control or Meta (Alt) modifiers, respectively; note that the backslash must be doubled. A number of special keys lack single\-character representations, so the following strings may be used to represent them: .TP .B * "" .TP .B * "" .TP .B * "" .TP .B * "" .TP .B * "" .TP .B * "" .TP .B * "" .TP .B * "" .TP .B * "" .TP .B * "" .TP .B * "" .TP .B * "" .TP .B * "" .TP .B * "" .TP .B * "" to "" .PP Due to differences between various terminal emulators, this key identifier syntax may not be adequate to describe every keypress. As a workaround, Orpie will also accept key identifiers in octal notation. As an example, you could use \\024 (do \fInot\fP enclose it in quotes) to represent Ctrl\-T. .PP Orpie includes a secondary executable, orpie\-curses\-keys, that prints out the key identifiers associated with keypresses. You may find it useful when customizing orpierc. .PP Multiple keys may be bound to the same operation, if desired. .PP .SS REMOVING KEY BINDINGS Syntax: .br unbind_function \fIkey_identifier\fP .br unbind_command \fIkey_identifier\fP .br unbind_edit \fIkey_identifier\fP .br unbind_browse \fIkey_identifier\fP .br unbind_abbrev \fIkey_identifier\fP .br unbind_variable \fIkey_identifier\fP .br unbind_integer \fIkey_identifier\fP .br .br These commands will remove key bindings associated with the various entry modes (functions, commands, editing operations, etc.). The key identifiers should be defined using the syntax described in the previous section. .PP .SS CREATING KEY AUTO\-BINDINGS Syntax: autobind \fIkey_identifier\fP .br .br In order to make repetitive calculations more pleasant, Orpie offers an automatic key binding feature. When a function or command is executed using its abbreviation, one of the keys selected by the autobind syntax will be automatically bound to that operation (unless the operation has already been bound to a key). The current set of autobindings can be viewed in the help panel by executing command_cycle_help (bound to \&'h\&' by default). .PP The syntax for the key identifiers is provided in the previous section. .PP .SS CREATING OPERATION ABBREVIATIONS Syntax: abbrev \fIoperation_abbreviation operation\fP .br .br You can use this syntax to set the abbreviations used within Orpie to represent the various functions and commands. A list of available operations may be found in the CALCULATOR OPERATIONS section. The operation abbreviations should be quoted strings, for example "sin" or "log". .PP Orpie performs autocompletion on these abbreviations, allowing you to type usually just a few letters in order to select the desired command. The order of the autocompletion matches will be the same as the order in which the abbreviations are registered by the rcfile\-\-so you may wish to place the more commonly used operation abbreviations earlier in the list. .PP Multiple abbreviations may be bound to the same operation, if desired. .PP .SS REMOVING OPERATION ABBREVIATIONS Syntax: unabbrev \fIoperation_abbreviation\fP .br .br This syntax can be used to remove an operation abbreviation. The operation abbreviations should be quoted strings, as described in the previous section. .PP .SS CREATING MACROS Syntax: macro \fIkey_identifier macro_string\fP .br .br You can use this syntax to cause a single keypress (the \fIkey_identifier\fP) to be interpreted as the series of keypresses listed in \fImacro_string\fP\&. The syntax for defining a keypress is the same as that defined in the section on CREATING KEY BINDINGS. The macro string should be a list of whitespace\-separated keypresses, e.g. "2 2 +" (including quotes). .PP This macro syntax provides a way to create small programs; by way of example, the default orpierc file includes macros for the base 2 logarithm and the binary entropy function (bound to L and H, respectively), as well as ``register\&'' variable shortcuts ( to ). .PP Macros may call other macros recursively. However, take care that a macro does not call \fIitself\fP recursively; Orpie will not trap the infinite loop. .PP Note that operation abbreviations may be accessed within macros. For example, macro "A" "\&' a b o u t " would bind A to display the ``about Orpie\&'' screen. .PP .SS CREATING UNITS Syntax: .br base_unit \fIunit_symbol preferred_prefix\fP .br unit \fIunit_symbol unit_definition\fP .br .br Units are defined in a two\-step process: .TP 1. Define a set of orthogonal ``base units.\&'' All other units must be expressible in terms of these base units. The base units can be given a preferred SI prefix, which will be used whenever the units are standardized (e.g. via ustand). The unit symbols and preferred prefixes should all be quoted strings; to prefer \fIno\fP prefix, use the empty string (""). .PP It is expected that most users will use the fundamental SI units for base units. .TP 2. Define all other units in terms of either base units or previously\-defined units. Again, the unit symbol and unit definition should be quoted strings. The definition should take the form of a numeric value followed by a units string, e.g. "2.5_kN*m/s". See the UNITS FORMATTING section for more details on the unit string format. .PP .SS CREATING CONSTANTS Syntax: constant \fIconstant_symbol constant_definition\fP .br .br This syntax can be used to define a physical constant. Both the constant symbol and definition must be quoted strings. The constant definition should be a numeric constant followed by a units string e.g. "1.60217733e\-19_C". All units used in the constant definition must already have been defined. .PP .SH CONFIGURATION VARIABLES The following configuration variables may be set as described in the SETTING CONFIGURATION VARIABLES section. .TP .B * datadir .br This variable should be set to the full path of the Orpie data directory, which will contain the calculator state save file, temporary buffers, etc. The default directory is "\\~/.orpie/". .TP .B * editor .br This variable may be set to the fullscreen editor of your choice. The default value is "vi". It is recommended that you choose an editor that offers horizontal scrolling in place of word wrapping, so that the columns of large matrices can be properly aligned. (The Vim editor could be used in this fashion by setting editor to "vim \-c \&'set nowrap\&'".) .TP .B * hide_help .br Set this variable to "true" to hide the left help/status panel, or leave it on the default of "false" to display the help panel. .TP .B * conserve_memory .br Set this variable to "true" to minimize memory usage, or leave it on the default of "false" to improve rendering performance. (By default, Orpie caches multiple string representations of all stack elements. Very large integers in particular require significant computation for string representation, so caching these strings can make display updates much faster.) .PP .SH CALCULATOR OPERATIONS Every calculator operation can be made available to the interface using the syntax described in the sections on CREATING KEY BINDINGS and CREATING OPERATION ABBREVIATIONS. The following is a list of every available operation. .PP .SS FUNCTIONS The following operations are functions\-\-that is, they will consume at least one argument from the stack. Orpie will generally abort the computation and provide an informative error message if a function cannot be successfully applied (for example, if you try to compute the transpose of something that is not a matrix). .PP For the exact integer data type, basic arithmetic operations will yield an exact integer result. Division of two exact integers will yield the quotient of the division. The more complicated functions will generally promote the integer to a real number, and as such the arithmetic will no longer be exact. .TP .B * function_10_x .br Raise 10 to the power of the last stack element (inverse of function_log10). .TP .B * function_abs .br Compute the absolute value of the last stack element. .TP .B * function_acos .br Compute the inverse cosine of the last stack element. For real numbers, The result will be provided either in degrees or radians, depending on the angle mode of the calculator. .TP .B * function_acosh .br Compute the inverse hyperbolic cosine of the last stack element. .TP .B * function_add .br Add last two stack elements. .TP .B * function_arg .br Compute the argument (phase angle of complex number) of the last stack element. The value will be provided in either degrees or radians, depending on the current angle mode of the calculator. .TP .B * function_asin .br Compute the inverse sine of the last stack element. For real numbers, The result will be provided either in degrees or radians, depending on the angle mode of the calculator. .TP .B * function_asinh .br Compute the inverse hyperbolic sine of the last stack element. .TP .B * function_atan .br Compute the inverse tangent of the last stack element. For real numbers, The result will be provided either in degrees or radians, depending on the angle mode of the calculator. .TP .B * function_atanh .br Compute the inverse hyperbolic tangent of the last stack element. .TP .B * function_binomial_coeff .br Compute the binomial coefficient (``n choose k\&'') formed by the last two stack elements. If these arguments are real, the coefficient is computed using a fast approximation to the log of the gamma function, and therefore the result is subject to rounding errors. For exact integer arguments, the coefficient is computed using exact arithmetic; this has the potential to be a slow operation. .TP .B * function_ceiling .br Compute the ceiling of the last stack element. .TP .B * function_convert_units .br Convert stack element 2 to an equivalent expression in the units of element 1. Element 1 should be real\-valued, and its magnitude will be ignored when computing the conversion. .TP .B * function_cos .br Compute the cosine of the last stack element. If the argument is real, it will be assumed to be either degrees or radians, depending on the angle mode of the calculator. .TP .B * function_cosh .br Compute the hyperbolic cosine of the last stack element. .TP .B * function_conj .br Compute the complex conjugate of the last stack element. .TP .B * function_div .br Divide element 2 by element 1. .TP .B * function_erf .br Compute the error function of the last stack element. .TP .B * function_erfc .br Compute the complementary error function of the last stack element. .TP .B * function_eval .br Obtain the contents of the variable in the last stack position. .TP .B * function_exp .br Evaluate the exponential function of the last stack element. .TP .B * function_factorial .br Compute the factorial of the last stack element. For a real argument, this is computed using a fast approximation to the gamma function, and therefore the result may be subject to rounding errors (or overflow). For an exact integer argument, the factorial is computed using exact arithmetic; this has the potential to be a slow operation. .TP .B * function_floor .br Compute the floor of the last stack element. .TP .B * function_gamma .br Compute the Euler gamma function of the last stack element. .TP .B * function_gcd .br Compute the greatest common divisor of the last two stack elements. This operation may be applied only to integer type data. .TP .B * function_im .br Compute the imaginary part of the last stack element. .TP .B * function_inv .br Compute the multiplicative inverse of the last stack element. .TP .B * function_lcm .br Compute the least common multiple of the last two stack elements. This operation may be applied only to integer type data. .TP .B * function_ln .br Compute the natural logarithm of the last stack element. .TP .B * function_lngamma .br Compute the natural logarithm of the Euler gamma function of the last stack element. .TP .B * function_log10 .br Compute the base\-10 logarithm of the last stack element. .TP .B * function_maximum .br Find the maximum values of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. .TP .B * function_minimum .br Find the minimum values of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. .TP .B * function_mean .br Compute the sample means of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. .TP .B * function_mod .br Compute element 2 mod element 1. This operation can be applied only to integer type data. .TP .B * function_mult .br Multiply last two stack elements. .TP .B * function_neg .br Negate last stack element. .TP .B * function_permutation .br Compute the permutation coefficient determined by the last two stack elements \&'n\&' and \&'k\&': the number of ways of obtaining an ordered subset of k elements from a set of n elements. If these arguments are real, the coefficient is computed using a fast approximation to the log of the gamma function, and therefore the result is subject to rounding errors. For exact integer arguments, the coefficient is computed using exact arithmetic; this has the potential to be a slow operation. .TP .B * function_pow .br Raise element 2 to the power of element 1. .TP .B * function_purge .br Delete the variable in the last stack position. .TP .B * function_re .br Compute the real part of the last stack element. .TP .B * function_sin .br Compute the sine of the last stack element. If the argument is real, it will be assumed to be either degrees or radians, depending on the angle mode of the calculator. .TP .B * function_sinh .br Compute the hyperbolic sine of the last stack element. .TP .B * function_solve_linear .br Solve a linear system of the form Ax = b, where A and b are the last two elements on the stack. A must be a square matrix and b must be a matrix with one column. This function does not compute inv(A), but obtains the solution by a more efficient LU decomposition method. This function is recommended over explicitly computing the inverse, especially when solving linear systems with relatively large dimension or with poorly conditioned matrices. .TP .B * function_sq .br Square the last stack element. .TP .B * function_sqrt .br Compute the square root of the last stack element. .TP .B * function_standardize_units .br Convert the last stack element to an equivalent expression using the SI standard base units (kg, m, s, etc.). .TP .B * function_stdev_unbiased .br Compute the unbiased sample standard deviation of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48\&'s sdev function.) .TP .B * function_stdev_biased .br Compute the biased (population) sample standard deviation of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48\&'s psdev function.) .TP .B * function_store .br Store element 2 in (variable) element 1. .TP .B * function_sub .br Subtract element 1 from element 2. .TP .B * function_sumsq .br Sum the squares of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. .TP .B * function_tan .br Compute the tangent of the last stack element. If the argument is real, it will be assumed to be either degrees or radians, depending on the angle mode of the calculator. .TP .B * function_tanh .br Compute the hyperbolic tangent of the last stack element. .TP .B * function_to_int .br Convert a real number to an integer type. .TP .B * function_to_real .br Convert an integer type to a real number. .TP .B * function_total .br Sum each of the columns of a real NxM matrix, returning a 1xM matrix as a result. .TP .B * function_trace .br Compute the trace of a square matrix. .TP .B * function_transpose .br Compute the matrix transpose of the last stack element. .TP .B * function_unit_value .br Drop the units of the last stack element. .TP .B * function_utpn .br Compute the upper tail probability of a normal distribution. .br UTPN(m, v, x) = Integrate[ 1/Sqrt[2 Pi v] Exp[\-(m\-y)^2/(2 v)], {y, x, Infinity}] .TP .B * function_var_unbiased .br Compute the unbiased sample variance of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48\&'s var function.) .TP .B * function_var_biased .br Compute the biased (population) sample variance of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48\&'s pvar function.) .PP .SS COMMANDS The following operations are referred to as commands; they differ from functions because they do not take an argument. Many calculator interface settings are implemented as commands. .TP .B * command_about .br Display a nifty ``about Orpie\&'' credits screen. .TP .B * command_begin_abbrev .br Begin entry of an operation abbreviation. .TP .B * command_begin_browsing .br Enter stack browsing mode. .TP .B * command_begin_constant .br Begin entry of a physical constant. .TP .B * command_begin_variable .br Begin entry of a variable name. .TP .B * command_bin .br Set the base of exact integer representation to 2 (binary). .TP .B * command_clear .br Clear all elements from the stack. .TP .B * command_cycle_base .br Cycle the base of exact integer representation between 2, 8, 10, and 16 (bin, oct, dec, and hex). .TP .B * command_cycle_help .br Cycle through multiple help pages. The first page displays commonly used bindings, and the second page displays the current autobindings. .TP .B * command_dec .br Set the base of exact integer representation to 10 (decimal). .TP .B * command_deg .br Set the angle mode to degrees. .TP .B * command_drop .br Drop the last element off the stack. .TP .B * command_dup .br Duplicate the last stack element. .TP .B * command_enter_pi .br Enter 3.1415\&... on the stack. .TP .B * command_hex .br Set the base of exact integer representation to 16 (hexadecimal). .TP .B * command_oct .br Set the base of exact integer representation to 8 (octal). .TP .B * command_polar .br Set the complex display mode to polar. .TP .B * command_rad .br Set the angle mode to radians. .TP .B * command_rand .br Generate a random real\-valued number between 0 (inclusive) and 1 (exclusive). The deviates are uniformly distributed. .TP .B * command_rect .br Set the complex display mode to rectangular (cartesian). .TP .B * command_refresh .br Refresh the display. .TP .B * command_swap .br Swap stack elements 1 and 2. .TP .B * command_quit .br Quit Orpie. .TP .B * command_toggle_angle_mode .br Toggle the angle mode between degrees and radians. .TP .B * command_toggle_complex_mode .br Toggle the complex display mode between rectangular and polar. .TP .B * command_undo .br Undo the last calculator operation. .TP .B * command_view .br View the last stack element in an external fullscreen editor. .TP .B * command_edit_input .br Create a new stack element using an external editor. .PP .SS EDIT OPERATIONS The following operations are related to editing during data entry. These commands cannot be made available as operation abbreviations, since abbreviations are not accessible while entering data. These operations should be made available as single keypresses using the bind keyword. .TP .B * edit_angle .br Begin entering the phase angle of a complex number. (Orpie will assume the angle is in either degrees or radians, depending on the current angle mode.) .TP .B * edit_backspace .br Delete the last character entered. .TP .B * edit_begin_integer .br Begin entering an exact integer. .TP .B * edit_begin_units .br Begin appending units to a numeric expression. .TP .B * edit_complex .br Begin entering a complex number. .TP .B * edit_enter .br Enter the data that is currently being edited. .TP .B * edit_matrix .br Begin entering a matrix, or begin entering the next row of a matrix. .TP .B * edit_minus .br Enter a minus sign in input. .TP .B * edit_scientific_notation_base .br Begin entering the scientific notation exponent of a real number, or the base of an exact integer. .TP .B * edit_separator .br Begin editing the next element of a complex number or matrix. (This will insert a comma between elements.) .PP .SS BROWSING OPERATIONS The following list of operations is available only in stack browsing mode. As abbreviations are unavailable while browsing the stack, these operations should be bound to single keypresses using the bind keyword. .TP .B * browse_echo .br Echo the currently selected element to stack level 1. .TP .B * browse_end .br Exit stack browsing mode. .TP .B * browse_drop .br Drop the currently selected stack element. .TP .B * browse_dropn .br Drop all stack elements below the current selection (inclusive). .TP .B * browse_keep .br Drop all stack elements \fIexcept\fP the current selection. (This is complementary to browse_drop. .TP .B * browse_keepn .br Drop all stack elements above the current selection (non\-inclusive). (This is complementary to browse_dropn. .TP .B * browse_next_line .br Move the selection cursor down one line. .TP .B * browse_prev_line .br Move the selection cursor up one line. .TP .B * browse_rolldown .br Cyclically ``roll\&'' stack elements downward, below the selected element (inclusive). .TP .B * browse_rollup .br Cyclically ``roll\&'' stack elements upward, below the selected element (inclusive) \&. .TP .B * browse_scroll_left .br Scroll the selected element to the left (for viewing very large entries such as matrices). .TP .B * browse_scroll_right .br Scroll the selected element to the right. .TP .B * browse_view .br View the currently selected stack element in a fullscreen editor. .TP .B * browse_edit .br Edit the currently selected stack element using an external editor. .PP .SS ABBREVIATION ENTRY OPERATIONS The following list of operations is available only while entering a function or command abbreviation, or while entering a physical constant. These operations must be bound to single keypresses using the bind keyword. .TP .B * abbrev_backspace .br Delete a character from the abbreviation string. .TP .B * abbrev_enter .br Execute the operation associated with the selected abbreviation. .TP .B * abbrev_exit .br Cancel abbreviation entry. .PP .SS VARIABLE ENTRY OPERATIONS The following list of operations is available only while entering a variable name. As abbreviations are unavailable while entering variables, these operations should be bound to single keypresses using the bind keyword. .TP .B * variable_backspace .br Delete a character from the variable name. .TP .B * variable_cancel .br Cancel entry of the variable name. .TP .B * variable_complete .br Autocomplete the variable name. .TP .B * variable_enter .br Enter the variable name on the stack. .PP .SS INTEGER ENTRY OPERATIONS The following operation is available only while entering an integer; it can be made accessible by binding it to a single keypress using the bind keyword. .TP .B * integer_cancel .br Cancel entry of an integer. .PP .SH SEE ALSO \fIorpie\fP(1), \fIorpie\-curses\-keys\fP(1) .PP .SH AUTHOR This manpage is written by Paul J. Pelzl . .\" NOTE: This file is generated, DO NOT EDIT. orpie-1.5.2/interface_main.ml0000644000175000017500000021205512322115103014612 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* interface_main.ml * This file has the bulk of the implementation of the curses-based interface, * including the main program loop that grabs keypresses and processes them. * The screen rendering code is found in interface_draw.ml . *) open Curses;; open Printf;; open Rpc_calc;; open Rpc_stack;; open Complex;; open Big_int;; open Operations;; open Interface;; open Interface_draw;; exception Interrupt_exception;; (*******************************************************************) (* RESIZE HANDLER *) (*******************************************************************) (* create the (new) windows corresponding to the different areas of the screen *) let create_windows screen = let height, width = get_size () in if height >= 24 then if width >= 80 && not !Rcfile.hide_help then (* full two-pane window provided *) let left_win = Some (newwin (height - 2) 40 0 0) and right_win = newwin (height - 2) 40 0 40 and bottom_win = newwin 2 80 (height - 2) 0 in {stdscr = screen; lines = height; cols = width; help_win = left_win; hw_lines = (height - 2); hw_cols = 40; stack_win = right_win; sw_lines = (height - 2); sw_cols = 40; entry_win = bottom_win; ew_lines = 2; ew_cols = 80} else if width >= 40 then (* only the stack window is provided *) let right_win = newwin (height - 2) 40 0 0 and bottom_win = newwin 2 width (height - 2) 0 in {stdscr = screen; lines = height; cols = width; help_win = None; hw_lines = 0; hw_cols = 0; stack_win = right_win; sw_lines = (height - 2); sw_cols = 40; entry_win = bottom_win; ew_lines = 2; ew_cols = 40} else (endwin (); failwith "Orpie requires at least a 40 column window.") else (endwin (); failwith "Orpie requires at least a 24 line window.");; (* resize the various windows to fit the new terminal size *) let resize_subwins scr = let height, width = get_size () in if height >= 24 then if width >= 80 && not !Rcfile.hide_help then (* full two-pane window provided *) begin scr.lines <- height; scr.cols <- width; begin match scr.help_win with |None -> scr.help_win <- Some (newwin (height - 2) 40 0 0) |Some win -> assert (wresize win (height - 2) 40); end; scr.hw_lines <- height - 2; scr.hw_cols <- 40; assert (wresize scr.stack_win (height - 2) 40); assert (mvwin scr.stack_win 0 40); scr.sw_lines <- height - 2; scr.sw_cols <- 40; assert (wresize scr.entry_win 2 80); assert (mvwin scr.entry_win (height - 2) 0); scr.ew_lines <- 2; scr.ew_cols <- 80 end else if width >= 40 then (* only the stack window is provided *) begin scr.lines <- height; scr.cols <- width; begin match scr.help_win with |None -> () |Some win -> assert (delwin win); scr.help_win <- None; end; scr.hw_lines <- 0; scr.hw_cols <- 0; assert (wresize scr.stack_win (height - 2) 40); assert (mvwin scr.stack_win 0 0); scr.sw_lines <- height - 2; scr.sw_cols <- 40; assert (wresize scr.entry_win 2 40); assert (mvwin scr.entry_win (height - 2) 0); scr.ew_lines <- 2; scr.ew_cols <- 40 end else (endwin (); failwith "Orpie requires at least a 40 column window.") else (endwin (); failwith "Orpie requires at least a 24 line window.");; (* refresh the screen *) let handle_refresh (iface : interface_state_t) = begin match iface.scr.help_win with |None -> () |Some win -> let _ = touchwin win in () end; let _ = touchwin iface.scr.stack_win in let _ = touchwin iface.scr.entry_win in draw_help iface; draw_stack iface; draw_update_entry iface; draw_update_stack iface (* handle a terminal resize *) let handle_resize (iface : interface_state_t) = (* reset ncurses *) endwin (); assert (refresh ()); resize_subwins iface.scr; handle_refresh iface;; (*******************************************************************) (* OBTAINING AN OBJECT FROM THE ENTRY BUFFER *) (*******************************************************************) (* parse the entry buffers to obtain a stack object *) let get_entry_from_buffer (iface : interface_state_t) = (* get a float from strings representing the mantissa and exponent *) let get_float_el mantissa exponent = if String.length mantissa > 0 then if String.length exponent > 0 then if exponent = "-" || exponent = "+" then float_of_string mantissa else float_of_string (mantissa ^ "e" ^ exponent) else float_of_string mantissa else 0.0 in match iface.entry_type with |IntEntry -> let base_mode = if iface.is_entering_base then match iface.int_base_string with |"b" -> Bin |"o" -> Oct |"d" -> Dec |"h" -> Hex |_ -> (iface.calc#get_modes ()).base else (iface.calc#get_modes ()).base in let base = match base_mode with |Bin -> 2 |Oct -> 8 |Dec -> 10 |Hex -> 16 in begin try let ival = Big_int_str.big_int_of_string_base iface.int_entry_buffer base in RpcInt ival with Big_int_str.Big_int_string_failure error_msg -> raise (Invalid_argument error_msg) end |FloatEntry -> begin let buffer = iface.gen_buffer.(0) in try let ff = get_float_el buffer.re_mantissa buffer.re_exponent in let uu = Units.units_of_string iface.units_entry_buffer !Rcfile.unit_table in RpcFloatUnit (ff, uu) with |Failure "float_of_string" -> raise (Invalid_argument "improperly formatted floating-point data") |Units.Units_error ss -> raise (Invalid_argument ss) end |ComplexEntry -> begin let buffer = iface.gen_buffer.(0) in try begin match buffer.is_polar with |false -> let real_part = get_float_el buffer.re_mantissa buffer.re_exponent and imag_part = get_float_el buffer.im_mantissa buffer.im_exponent in let cc = {re = real_part; im = imag_part} and uu = Units.units_of_string iface.units_entry_buffer !Rcfile.unit_table in RpcComplexUnit (cc, uu) (* if is_polar==true, then the data in the buffer represents * polar data... so convert it to rect notation before storing * it as a complex number. *) |true -> let r = get_float_el buffer.re_mantissa buffer.re_exponent and theta = match (iface.calc#get_modes ()).angle with |Rad -> get_float_el buffer.im_mantissa buffer.im_exponent |Deg -> (pi /. 180.0 *. (get_float_el buffer.im_mantissa buffer.im_exponent)) in let cc = {re = r *. (cos theta); im = r *. (sin theta)} and uu = Units.units_of_string iface.units_entry_buffer !Rcfile.unit_table in RpcComplexUnit (cc, uu) end with |Failure "float_of_string" -> raise (Invalid_argument "improperly formatted complex floating-point data") |Units.Units_error ss -> raise (Invalid_argument ss) end |FloatMatrixEntry -> begin let matrix_rows = if iface.has_multiple_rows then succ (iface.curr_buf / iface.matrix_cols) else 1 in let temp_arr = Array.make (matrix_rows * iface.matrix_cols) 0.0 in try for i = 0 to iface.curr_buf do temp_arr.(i) <- (get_float_el iface.gen_buffer.(i).re_mantissa iface.gen_buffer.(i).re_exponent) done; let uu = Units.units_of_string iface.units_entry_buffer !Rcfile.unit_table in RpcFloatMatrixUnit (Gsl_matrix.of_array temp_arr matrix_rows iface.matrix_cols, uu) with Failure "float_of_string" -> raise (Invalid_argument "improperly formatted floating-point matrix data") end |ComplexMatrixEntry -> begin let matrix_rows = if iface.has_multiple_rows then succ (iface.curr_buf / iface.matrix_cols) else 1 in let temp_arr = Array.make (matrix_rows * iface.matrix_cols) {re = 0.0; im = 0.0} in try for i = 0 to iface.curr_buf do begin match iface.gen_buffer.(i).is_polar with |false -> let re_part = get_float_el iface.gen_buffer.(i).re_mantissa iface.gen_buffer.(i).re_exponent and im_part = get_float_el iface.gen_buffer.(i).im_mantissa iface.gen_buffer.(i).im_exponent in temp_arr.(i) <- {re = re_part; im = im_part} (* if is_polar==true, then the data in the buffer represents * polar data... so convert it to rect notation before storing * it as a complex number. *) |true -> let r = get_float_el iface.gen_buffer.(i).re_mantissa iface.gen_buffer.(i).re_exponent and theta = match (iface.calc#get_modes ()).angle with |Rad -> get_float_el iface.gen_buffer.(i).im_mantissa iface.gen_buffer.(i).im_exponent |Deg -> (pi /. 180.0 *. (get_float_el iface.gen_buffer.(i).im_mantissa iface.gen_buffer.(i).im_exponent)) in temp_arr.(i) <- {re = r *. (cos theta); im = r *. (sin theta)} end done; let uu = Units.units_of_string iface.units_entry_buffer !Rcfile.unit_table in RpcComplexMatrixUnit (Gsl_matrix_complex.of_array temp_arr matrix_rows iface.matrix_cols, uu) with Failure "float_of_string" -> raise (Invalid_argument "improperly formatted complex floating-point matrix data") end |VarEntry -> RpcVariable iface.variable_entry_buffer (* parse the entry buffers to obtain a stack object, then stack#push it *) let push_entry (iface : interface_state_t) = (* perform this cleanup routine after every entry, so we are prepared to receive a new object. *) let post_entry_cleanup () = iface.has_entry <- false; iface.entry_type <- FloatEntry; iface.int_entry_buffer <- ""; iface.int_base_string <- ""; iface.is_entering_base <- false; iface.is_entering_exponent <- false; for i = 0 to pred max_matrix_size do iface.gen_buffer.(i) <- {re_mantissa = ""; re_exponent = ""; im_mantissa = ""; im_exponent = ""; is_polar = false} done; iface.curr_buf <- 0; iface.is_entering_imag <- false; iface.matrix_cols <- 1; iface.has_multiple_rows <- false; iface.variable_entry_buffer <- ""; iface.units_entry_buffer <- ""; iface.is_entering_units <- false; draw_update_entry iface in begin try iface.calc#push (get_entry_from_buffer iface) with Invalid_argument error_msg -> (post_entry_cleanup (); (* raise the EXN again, so it can be caught within do_main_loop *) raise (Invalid_argument error_msg)) end; post_entry_cleanup () (***********************************************************************) (* HANDLERS FOR EDITING KEYSTROKES *) (***********************************************************************) (* handle an 'enter' keypress *) let handle_enter (iface : interface_state_t) = iface.interface_mode <- StandardEditMode; draw_help iface; try if iface.has_entry then push_entry iface else raise Not_handled; draw_update_stack iface with Invalid_argument error_msg -> draw_error iface error_msg; assert (doupdate ()) (* handle a 'begin_int' keypress *) let handle_begin_int (iface : interface_state_t) = if iface.entry_type = FloatEntry then (iface.entry_type <- IntEntry; iface.interface_mode <- IntEditMode; iface.int_entry_buffer <- ""; draw_help iface; draw_update_entry iface) else () (* handle a 'begin_complex' keypress *) let handle_begin_complex (iface : interface_state_t) = iface.has_entry <- true; match iface.entry_type with |FloatEntry -> (iface.entry_type <- ComplexEntry; draw_update_entry iface) |FloatMatrixEntry -> (iface.entry_type <- ComplexMatrixEntry; draw_update_entry iface) |_ -> () (* handle a 'begin_matrix' keypress *) let handle_begin_matrix (iface : interface_state_t) = iface.has_entry <- true; match iface.entry_type with |FloatEntry -> (iface.entry_type <- FloatMatrixEntry; draw_update_entry iface) |ComplexEntry -> (iface.entry_type <- ComplexMatrixEntry; draw_update_entry iface) |FloatMatrixEntry -> if not iface.has_multiple_rows then (iface.has_multiple_rows <- true; iface.curr_buf <- succ iface.curr_buf; iface.matrix_cols <- iface.curr_buf; iface.is_entering_exponent <- false; draw_update_entry iface) else if (succ iface.curr_buf) mod iface.matrix_cols = 0 then (iface.curr_buf <- succ iface.curr_buf; iface.is_entering_exponent <- false; (*FIXME: any other items to reset here?*) draw_update_entry iface) else () |ComplexMatrixEntry -> if not iface.has_multiple_rows then (iface.has_multiple_rows <- true; iface.curr_buf <- succ iface.curr_buf; iface.matrix_cols <- iface.curr_buf; iface.is_entering_exponent <- false; iface.is_entering_imag <- false; draw_update_entry iface) else if (succ iface.curr_buf) mod iface.matrix_cols = 0 then (iface.curr_buf <- succ iface.curr_buf; iface.is_entering_exponent <- false; iface.is_entering_imag <- false; (*FIXME: any other items to reset here?*) draw_update_entry iface) else () |_ -> () (* handle a 'separator' keypress *) let handle_separator (iface : interface_state_t) = match iface.entry_type with |ComplexEntry -> if not iface.is_entering_imag then (iface.is_entering_imag <- true; iface.is_entering_exponent <- false; draw_update_entry iface) else () |FloatMatrixEntry -> if iface.curr_buf < pred max_matrix_size then (iface.curr_buf <- succ iface.curr_buf; iface.is_entering_exponent <- false; (if not iface.has_multiple_rows then iface.matrix_cols <- succ iface.curr_buf else ()); (*FIXME: any other items to reset here?*) draw_update_entry iface) else () |ComplexMatrixEntry -> if iface.is_entering_imag then if iface.curr_buf < pred max_matrix_size then (iface.curr_buf <- succ iface.curr_buf; iface.is_entering_exponent <- false; iface.is_entering_imag <- false; (if not iface.has_multiple_rows then iface.matrix_cols <- succ iface.curr_buf else ()); (*FIXME: any other items to reset here?*) draw_update_entry iface) else () else (iface.is_entering_imag <- true; iface.is_entering_exponent <- false; draw_update_entry iface) |_ -> () (* handle an 'angle' keypress *) let handle_angle (iface : interface_state_t) = match iface.entry_type with |ComplexEntry -> if not iface.is_entering_imag then (iface.is_entering_imag <- true; iface.gen_buffer.(iface.curr_buf).is_polar <- true; iface.is_entering_exponent <- false; draw_update_entry iface) else () |ComplexMatrixEntry -> if iface.is_entering_imag then () else (iface.is_entering_imag <- true; iface.gen_buffer.(iface.curr_buf).is_polar <- true; iface.is_entering_exponent <- false; draw_update_entry iface) |_ -> () (* cancel integer entry mode *) let handle_exit_int (iface : interface_state_t) = iface.interface_mode <- StandardEditMode; iface.entry_type <- FloatEntry; iface.is_entering_base <- false; iface.int_base_string <- ""; if (String.length iface.gen_buffer.(0).re_mantissa > 0) || (String.length iface.gen_buffer.(0).re_exponent > 0) || (String.length iface.gen_buffer.(0).im_mantissa > 0) || (String.length iface.gen_buffer.(0).im_exponent > 0) then iface.has_entry <- true else iface.has_entry <- false; draw_help iface; draw_update_entry iface (* handle a 'backspace' keypress *) let handle_backspace (iface : interface_state_t) = let buffer = iface.gen_buffer.(iface.curr_buf) in begin match iface.entry_type with |IntEntry -> if iface.is_entering_base then begin iface.is_entering_base <- false; iface.int_base_string <- "" end else if String.length iface.int_entry_buffer > 0 then begin let len = String.length iface.int_entry_buffer in iface.int_entry_buffer <- String.sub iface.int_entry_buffer 0 (len - 1) end else handle_exit_int iface |FloatEntry -> if iface.is_entering_exponent then if String.length buffer.re_exponent > 0 then (let len = String.length buffer.re_exponent in buffer.re_exponent <- String.sub buffer.re_exponent 0 (len - 1)) else (iface.is_entering_exponent <- false; draw_update_entry iface) else if String.length buffer.re_mantissa > 1 then (let len = String.length buffer.re_mantissa in buffer.re_mantissa <- String.sub buffer.re_mantissa 0 (len - 1)) else (iface.has_entry <- false; buffer.re_mantissa <- "") |ComplexEntry -> if iface.is_entering_imag then if iface.is_entering_exponent then if String.length buffer.im_exponent > 0 then (let len = String.length buffer.im_exponent in buffer.im_exponent <- String.sub buffer.im_exponent 0 (len - 1)) else iface.is_entering_exponent <- false else if String.length buffer.im_mantissa > 0 then (let len = String.length buffer.im_mantissa in buffer.im_mantissa <- String.sub buffer.im_mantissa 0 (len - 1)) else begin iface.is_entering_imag <- false; buffer.is_polar <- false; (if String.length buffer.re_exponent > 0 then iface.is_entering_exponent <- true else ()) end (* not entering imag/angle *) else if iface.is_entering_exponent then if String.length buffer.re_exponent > 0 then (let len = String.length buffer.re_exponent in buffer.re_exponent <- String.sub buffer.re_exponent 0 (len - 1)) else iface.is_entering_exponent <- false else if String.length buffer.re_mantissa > 0 then (let len = String.length buffer.re_mantissa in buffer.re_mantissa <- String.sub buffer.re_mantissa 0 (len - 1)) else (iface.entry_type <- FloatEntry; iface.has_entry <- false) |FloatMatrixEntry -> if iface.is_entering_exponent then if String.length buffer.re_exponent > 0 then (let len = String.length buffer.re_exponent in buffer.re_exponent <- String.sub buffer.re_exponent 0 (len - 1)) else iface.is_entering_exponent <- false else if String.length buffer.re_mantissa > 0 then (let len = String.length buffer.re_mantissa in buffer.re_mantissa <- String.sub buffer.re_mantissa 0 (len - 1)) else if iface.curr_buf > 0 then begin iface.curr_buf <- pred iface.curr_buf; (if String.length iface.gen_buffer.(iface.curr_buf).re_exponent > 0 then iface.is_entering_exponent <- true else ()); (if succ iface.curr_buf <= iface.matrix_cols then (iface.matrix_cols <- succ iface.curr_buf; iface.has_multiple_rows <- false) else ()) end else begin iface.entry_type <- FloatEntry; iface.has_entry <- false end |ComplexMatrixEntry -> if iface.is_entering_imag then if iface.is_entering_exponent then if String.length buffer.im_exponent > 0 then (let len = String.length buffer.im_exponent in buffer.im_exponent <- String.sub buffer.im_exponent 0 (len - 1)) else iface.is_entering_exponent <- false else if String.length buffer.im_mantissa > 0 then (let len = String.length buffer.im_mantissa in buffer.im_mantissa <- String.sub buffer.im_mantissa 0 (len - 1)) else begin iface.is_entering_imag <- false; buffer.is_polar <- false; (if String.length buffer.re_exponent > 0 then iface.is_entering_exponent <- true else ()) end (* not entering imag/angle *) else if iface.is_entering_exponent then if String.length buffer.re_exponent > 0 then (let len = String.length buffer.re_exponent in buffer.re_exponent <- String.sub buffer.re_exponent 0 (len - 1)) else iface.is_entering_exponent <- false else if String.length buffer.re_mantissa > 0 then (let len = String.length buffer.re_mantissa in buffer.re_mantissa <- String.sub buffer.re_mantissa 0 (len - 1)) else if iface.curr_buf > 0 then begin iface.curr_buf <- pred iface.curr_buf; iface.is_entering_imag <- true; (if String.length iface.gen_buffer.(iface.curr_buf).im_exponent > 0 then iface.is_entering_exponent <- true else ()); (if succ iface.curr_buf <= iface.matrix_cols then (iface.matrix_cols <- succ iface.curr_buf; iface.has_multiple_rows <- false) else ()) end else begin iface.entry_type <- FloatEntry; iface.has_entry <- false end |_ -> failwith "caught unhandled backspace" end; draw_update_entry iface (* handle a 'scientific_notation' (or base change) keypress *) let handle_scientific_notation (iface : interface_state_t) = begin match iface.entry_type with |IntEntry -> if String.length iface.int_entry_buffer > 0 then (iface.is_entering_base <- true; draw_update_entry iface) else () |FloatEntry | FloatMatrixEntry -> if String.length iface.gen_buffer.(iface.curr_buf).re_mantissa > 0 then (iface.is_entering_exponent <- true; draw_update_entry iface) else () |ComplexEntry | ComplexMatrixEntry -> if iface.is_entering_imag then if String.length iface.gen_buffer.(iface.curr_buf).im_mantissa > 0 then (iface.is_entering_exponent <- true; draw_update_entry iface) else () else if String.length iface.gen_buffer.(0).re_mantissa > 0 then (iface.is_entering_exponent <- true; draw_update_entry iface) else () |_ -> failwith "caught unhandled scientific notation" end; draw_update_entry iface (* handle a 'minus' keypress *) let handle_minus (iface : interface_state_t) = if iface.has_entry then match iface.entry_type with |IntEntry -> (begin match iface.int_entry_buffer.[0] with |'-' -> iface.int_entry_buffer.[0] <- '+' |'+' -> iface.int_entry_buffer.[0] <- '-' |_ -> iface.int_entry_buffer <- "-" ^ iface.int_entry_buffer end; draw_update_entry iface) |FloatEntry | FloatMatrixEntry -> begin let buffer = iface.gen_buffer.(iface.curr_buf) in if iface.is_entering_exponent then if String.length buffer.re_exponent > 0 then match buffer.re_exponent.[0] with |'-' -> buffer.re_exponent.[0] <- '+' |'+' -> buffer.re_exponent.[0] <- '-' |_ -> buffer.re_exponent <- "-" ^ buffer.re_exponent else () else if String.length buffer.re_mantissa > 0 then match buffer.re_mantissa.[0] with |'-' -> buffer.re_mantissa.[0] <- '+' |'+' -> buffer.re_mantissa.[0] <- '-' |_ -> buffer.re_mantissa <- "-" ^ buffer.re_mantissa else () end; draw_update_entry iface |ComplexEntry | ComplexMatrixEntry -> begin let buffer = iface.gen_buffer.(iface.curr_buf) in let mantissa = if iface.is_entering_imag then buffer.im_mantissa else buffer.re_mantissa and exponent = if iface.is_entering_imag then buffer.im_exponent else buffer.re_exponent in if iface.is_entering_exponent then if String.length exponent > 0 then match exponent.[0] with |'-' -> exponent.[0] <- '+' |'+' -> exponent.[0] <- '-' |_ -> if iface.is_entering_imag then buffer.im_exponent <- "-" ^ buffer.im_exponent else buffer.re_exponent <- "-" ^ buffer.re_exponent else () else if String.length mantissa > 0 then match mantissa.[0] with |'-' -> mantissa.[0] <- '+' |'+' -> mantissa.[0] <- '-' |_ -> if iface.is_entering_imag then buffer.im_mantissa <- "-" ^ buffer.im_mantissa else buffer.re_mantissa <- "-" ^ buffer.re_mantissa else () end; draw_update_entry iface |_ -> failwith "caught unhandled minus key" else raise Not_handled (* handle entry of a digit *) let handle_digit (iface : interface_state_t) key = let process_float_digit buffer is_imag = let exponent_buffer = if is_imag then buffer.im_exponent else buffer.re_exponent and mantissa_buffer = if is_imag then buffer.im_mantissa else buffer.re_mantissa in let has_decimal = let dot_regex = Str.regexp "^.*\\..*$" in Str.string_match dot_regex mantissa_buffer 0 in begin if iface.is_entering_exponent then let explen = (if String.length exponent_buffer > 0 then match exponent_buffer.[0] with |'-' | '+'-> 4 |_ -> 3 else 3) in if String.length exponent_buffer < explen then let digits = "0123456789" in try let c = char_of_int key in if String.contains digits c then (* need this hack to be able to perform * the mutable field assignment... *) (if is_imag then buffer.im_exponent <- exponent_buffer ^ (String.make 1 c) else buffer.re_exponent <- exponent_buffer ^ (String.make 1 c); draw_update_entry iface) else () with Invalid_argument "char_of_int" -> () else () else if String.length mantissa_buffer < 17 then let digits = if has_decimal then "0123456789" else "0123456789." in try let c = char_of_int key in if String.contains digits c then begin (if is_imag then buffer.im_mantissa <- mantissa_buffer ^ (String.make 1 c) else buffer.re_mantissa <- mantissa_buffer ^ (String.make 1 c)); iface.has_entry <- true; draw_update_entry iface end else () with Invalid_argument "char_of_int" -> () else () end in match iface.entry_type with |IntEntry -> begin if iface.is_entering_base then let base_chars = "bodh" in try let c = char_of_int key in if String.contains base_chars c then (iface.int_base_string <- String.make 1 c; draw_update_entry iface) else () with Invalid_argument "char_of_int" -> () else let digits = "0123456789abcdefABCDEF" in try let c = char_of_int key in if String.contains digits c then (iface.int_entry_buffer <- iface.int_entry_buffer ^ (String.make 1 c); iface.has_entry <- true; draw_update_entry iface) else () with Invalid_argument "char_of_int" -> () end |FloatEntry | FloatMatrixEntry -> let buffer = iface.gen_buffer.(iface.curr_buf) in process_float_digit buffer false |ComplexEntry | ComplexMatrixEntry -> let buffer = iface.gen_buffer.(iface.curr_buf) in if iface.is_entering_imag then process_float_digit buffer true else process_float_digit buffer false |_ -> failwith "caught unhandled digit" (* begin abbrev entry *) let handle_begin_abbrev (iface : interface_state_t) = if iface.interface_mode <> AbbrevEditMode then begin iface.interface_mode <- AbbrevEditMode; iface.abbrev_or_const <- IsAbbrev; draw_help iface; draw_update_entry iface (* do other cleanup stuff *) end else () (* begin constant entry *) let handle_begin_const (iface : interface_state_t) = if iface.interface_mode <> AbbrevEditMode then begin iface.interface_mode <- AbbrevEditMode; iface.abbrev_or_const <- IsConst; draw_help iface; draw_update_entry iface (* do other cleanup stuff *) end else () (* begin entry of a variable name *) let handle_begin_variable (iface : interface_state_t) = if iface.interface_mode <> VarEditMode then begin iface.interface_mode <- VarEditMode; iface.entry_type <- VarEntry; (* FIXME: generation of the sorted variable list can be done far * more efficiently *) let add_variable var_str var_binding var_list = var_str :: var_list in let all_variables = Hashtbl.fold add_variable (iface.calc#get_variables ()) [] in iface.sorted_variables <- List.stable_sort String.compare all_variables; iface.matched_variables <- iface.sorted_variables; draw_help iface; draw_update_entry iface end else () (* begin entry of units *) let handle_begin_units (iface : interface_state_t) = match iface.entry_type with |FloatEntry -> if iface.gen_buffer.(0).re_mantissa = "" then iface.gen_buffer.(0).re_mantissa <- "1" else (); iface.has_entry <- true; iface.interface_mode <- UnitEditMode; iface.is_entering_units <- true; draw_update_entry iface |ComplexEntry -> if iface.gen_buffer.(0).re_mantissa = "" then iface.gen_buffer.(0).re_mantissa <- "0" else (); if iface.gen_buffer.(0).im_mantissa = "" && iface.is_entering_imag then iface.gen_buffer.(0).im_mantissa <- "0" else (); iface.has_entry <- true; iface.interface_mode <- UnitEditMode; iface.is_entering_units <- true; draw_update_entry iface |FloatMatrixEntry | ComplexMatrixEntry -> iface.has_entry <- true; iface.interface_mode <- UnitEditMode; iface.is_entering_units <- true; draw_update_entry iface (* FIXME: add other matches as units code gets filled out *) |_ -> () (***********************************************************************) (* HANDLERS FOR BROWSING-RELATED KEYSTROKES *) (***********************************************************************) (* begin stack browsing *) let handle_begin_browse (iface : interface_state_t) = if iface.calc#get_stack_size () > 0 then ( (* fprintf stderr "beginning browse\n"; flush stderr; *) iface.interface_mode <- BrowsingMode; iface.calc#backup (); draw_help iface; draw_update_stack iface) else () (* handle exit of browsing mode *) let handle_end_browse (iface : interface_state_t) = iface.horiz_scroll <- 0; iface.stack_selection <- 1; iface.stack_bottom_row <- 1; iface.interface_mode <- StandardEditMode; draw_help iface; draw_update_stack iface (* handle scrolling left in browsing mode *) let handle_scroll_left (iface : interface_state_t) = (if iface.horiz_scroll > 0 then iface.horiz_scroll <- pred iface.horiz_scroll else ()); draw_update_stack iface (* handle scrolling right in browsing mode *) let handle_scroll_right (iface : interface_state_t) = let s = iface.calc#get_display_line iface.stack_selection in let len = String.length s in (if iface.horiz_scroll < len - iface.scr.sw_cols + 7 then iface.horiz_scroll <- succ iface.horiz_scroll else ()); draw_update_stack iface (* handle cyclic rolldown in browsing mode *) let handle_rolldown (iface : interface_state_t) = iface.calc#rolldown iface.stack_selection; draw_update_stack iface (* handle cyclic rollup in browsing mode *) let handle_rollup (iface : interface_state_t) = iface.calc#rollup iface.stack_selection; draw_update_stack iface (* handle moving up a line in browsing mode *) let handle_prev_line (iface : interface_state_t) = if iface.stack_selection < iface.calc#get_stack_size () then (iface.stack_selection <- succ iface.stack_selection; iface.horiz_scroll <- 0; let num_stack_lines = begin match iface.scr.help_win with |Some win -> iface.scr.sw_lines |None -> iface.scr.sw_lines - 2 end in (if iface.stack_selection > pred (iface.stack_bottom_row + num_stack_lines) then iface.stack_bottom_row <- iface.stack_selection - num_stack_lines + 1 else ()); draw_update_stack iface) else () (* handle moving down a line in browsing mode *) let handle_next_line (iface : interface_state_t) = if iface.stack_selection > 1 then (iface.stack_selection <- pred iface.stack_selection; iface.horiz_scroll <- 0; (if iface.stack_selection < iface.stack_bottom_row then iface.stack_bottom_row <- iface.stack_selection else ()); draw_update_stack iface) else () (* handle echoing stack selection (browsing mode) *) let handle_browse_echo (iface : interface_state_t) = iface.calc#echo iface.stack_selection; handle_prev_line iface (* handle fullscreen viewing of a selected stack element *) let handle_browse_view (iface : interface_state_t) = try let fs_string = iface.calc#get_fullscreen_display iface.stack_selection in let fs_file = Utility.join_path !(Rcfile.datadir) "fullscreen" in let buf = Utility.open_or_create_out_ascii fs_file in output_string buf fs_string; close_out buf; let _ = Sys.command (!(Rcfile.editor) ^ " " ^ fs_file) in (); draw_help iface; draw_stack iface; draw_update_entry iface with Sys_error ss -> draw_error iface ss; assert (doupdate ()) (* drop a particular stack element *) let handle_browse_drop1 (iface : interface_state_t) = iface.calc#delete iface.stack_selection; (if iface.stack_selection > iface.calc#get_stack_size () then iface.stack_selection <- iface.calc#get_stack_size () else ()); (if iface.stack_selection < iface.stack_bottom_row then iface.stack_bottom_row <- iface.stack_selection else ()); if iface.calc#get_stack_size () < 1 then handle_end_browse iface else draw_update_stack iface (* drop all elements below selected element (inclusive) *) let handle_browse_dropn (iface : interface_state_t) = iface.calc#deleteN iface.stack_selection; iface.stack_selection <- 1; iface.stack_bottom_row <- 1; if iface.calc#get_stack_size () < 1 then handle_end_browse iface else draw_update_stack iface (* keep only the selected stack element *) let handle_browse_keep (iface : interface_state_t) = iface.calc#keep iface.stack_selection; iface.stack_selection <- 1; iface.stack_bottom_row <- 1; draw_update_stack iface (* keep only stack elements below the current selection (inclusive) *) let handle_browse_keepn (iface : interface_state_t) = iface.calc#keepN iface.stack_selection; draw_update_stack iface (* call !Rcfile.editor to edit the input textfile buffer, then * parse it to generate one or more stack elements. * If is_browsing = true, then the stack element will be * bumped up to the selected stack level. *) let edit_parse_input_textfile (iface : interface_state_t) (is_browsing) = try let input_file = Utility.join_path !(Rcfile.datadir) "input" in let _ = Sys.command (!(Rcfile.editor) ^ " " ^ input_file) in (); (* wake up curses again, and check for resize *) assert (refresh ()); resize_subwins iface.scr; handle_refresh iface; let edited_buf = Utility.expand_open_in_ascii input_file in let lexbuf = Lexing.from_channel edited_buf in let data = (* need to call completely different parsers when using degrees * or when using radians *) begin match (iface.calc#get_modes ()).angle with |Rad -> Txtin_parser.decode_data_rad Txtin_lexer.token lexbuf |Deg -> Txtin_parser.decode_data_deg Txtin_lexer.token lexbuf end in let push_data el = if is_browsing then begin iface.calc#delete iface.stack_selection; iface.calc#push el; iface.calc#rolldown iface.stack_selection end else iface.calc#push el; in List.iter push_data data; close_in edited_buf; handle_refresh iface with |Parsing.Parse_error -> draw_help iface; draw_stack iface; draw_error iface "syntax error in input"; draw_update_entry iface |Utility.Txtin_error ss -> draw_help iface; draw_stack iface; draw_error iface ss; draw_update_entry iface |Big_int_str.Big_int_string_failure ss -> draw_help iface; draw_stack iface; draw_error iface ss; draw_update_entry iface |Units.Units_error ss -> draw_help iface; draw_stack iface; draw_error iface ss; draw_update_entry iface |Failure ss -> draw_help iface; draw_stack iface; draw_error iface "syntax error in input"; draw_update_entry iface (* edit the selected stack element with an external editor *) let handle_browse_edit (iface : interface_state_t) = try let fs_string = iface.calc#get_fullscreen_display iface.stack_selection in let input_file = Utility.join_path !(Rcfile.datadir) "input" in let buf = Utility.open_or_create_out_ascii input_file in output_string buf fs_string; close_out buf; edit_parse_input_textfile iface true with Sys_error ss -> (draw_help iface; draw_stack iface; draw_error iface ss; draw_update_entry iface) (* view the last stack element in fullscreen *) let handle_view (iface : interface_state_t) = try let fs_string = iface.calc#get_fullscreen_display 1 in let fs_file = Utility.join_path !(Rcfile.datadir) "fullscreen" in let buf = Utility.open_or_create_out_ascii fs_file in output_string buf fs_string; close_out buf; let _ = Sys.command (!(Rcfile.editor) ^ " " ^ fs_file) in (); draw_help iface; draw_stack iface; draw_update_entry iface with Sys_error ss -> draw_error iface ss; assert (doupdate ()) (* handle a call to edit a new input buffer *) let handle_edit_input (iface : interface_state_t) = try edit_parse_input_textfile iface false with Sys_error ss -> (draw_help iface; draw_stack iface; draw_error iface ss; draw_update_entry iface) (* display an "about" screen *) let handle_about (iface : interface_state_t) = draw_about iface; let _ = getch () in (); erase (); assert (refresh ()); handle_refresh iface (* cycle the help screen *) let handle_cycle_help (iface : interface_state_t) = if iface.help_page < 1 then iface.help_page <- succ iface.help_page else iface.help_page <- 0; draw_help iface; assert (doupdate ()) (* quit the calculator *) let handle_quit (iface : interface_state_t) = Statefile.save_state (iface.calc#get_state ()); iface.run_calc <- false (***********************************************************************) (* HANDLERS FOR STANDARD CALCULATOR FUNCTIONS AND COMMANDS *) (***********************************************************************) (* register an autobinding. * The autobindings are stored both in an array for quick ordered * access, and in the standard keybinding hashtables. *) let register_autobinding (op : operation_t) = (* find oldest autobinding *) let oldest = ref 0 in let oldest_age = ref (-1) in for i = 0 to pred (Array.length !Rcfile.autobind_keys) do let (key, key_string, bound_f, age) = !Rcfile.autobind_keys.(i) in if age > !oldest_age then begin oldest := i; oldest_age := age end else (); (* make all autobindings "older" *) !Rcfile.autobind_keys.(i) <- (key, key_string, bound_f, (succ age)) done; if Array.length !Rcfile.autobind_keys > 0 then begin let (key, key_string, bound_f, age) = !Rcfile.autobind_keys.(!oldest) in begin match bound_f with |None -> () |Some op -> Rcfile.remove_binding key op end; Rcfile.register_binding_internal key key_string op; !Rcfile.autobind_keys.(!oldest) <- (key, key_string, Some op, 0) end else () (* handle a call to a function (which first pushes the item in the * entry buffer) *) let handle_function_call (iface : interface_state_t) calc_function = try if iface.has_entry then push_entry iface else (); calc_function (); draw_update_stack iface with Invalid_argument error_msg -> draw_error iface error_msg; assert (doupdate ()) (* handle a call to the simple commands that require no argument *) let handle_command_call (iface : interface_state_t) calc_command = try calc_command (); draw_update_stack iface with Invalid_argument error_msg -> draw_error iface error_msg; assert (doupdate ()) (* handle a call to an interruptible function *) let handle_interr_function_call (iface : interface_state_t) calc_function = try if iface.has_entry then push_entry iface else (); draw_message iface "Working... (press a key to abort)"; assert (doupdate ()); assert (nodelay iface.scr.entry_win true); while not (calc_function ()) do let key = wgetch iface.scr.entry_win in if key <> ~-1 then raise Interrupt_exception else () done; assert (nodelay iface.scr.entry_win false); draw_update_stack iface with |Invalid_argument error_msg -> assert (nodelay iface.scr.entry_win false); draw_error iface error_msg; assert (doupdate ()) |Interrupt_exception -> assert (nodelay iface.scr.entry_win false); iface.calc#abort_computation (); draw_message iface "Computation aborted."; assert (doupdate ()) let process_function (iface : interface_state_t) ff = begin match ff with |Add -> handle_function_call iface iface.calc#add |Sub -> handle_function_call iface iface.calc#sub |Mult -> handle_function_call iface iface.calc#mult |Div -> handle_function_call iface iface.calc#div |Neg -> handle_function_call iface iface.calc#neg |Inv -> handle_function_call iface iface.calc#inv |Pow -> handle_function_call iface iface.calc#pow |Sq -> handle_function_call iface iface.calc#sq |Sqrt -> handle_function_call iface iface.calc#sqrt |Abs -> handle_function_call iface iface.calc#abs |Arg -> handle_function_call iface iface.calc#arg |Exp -> handle_function_call iface iface.calc#exp |Ln -> handle_function_call iface iface.calc#ln |Ten_x -> handle_function_call iface iface.calc#ten_pow_x |Log10 -> handle_function_call iface iface.calc#log10 |Conj -> handle_function_call iface iface.calc#conj |Sin -> handle_function_call iface iface.calc#sin |Cos -> handle_function_call iface iface.calc#cos |Tan -> handle_function_call iface iface.calc#tan |Sinh -> handle_function_call iface iface.calc#sinh |Cosh -> handle_function_call iface iface.calc#cosh |Tanh -> handle_function_call iface iface.calc#tanh |Asin -> handle_function_call iface iface.calc#asin |Acos -> handle_function_call iface iface.calc#acos |Atan -> handle_function_call iface iface.calc#atan |Asinh -> handle_function_call iface iface.calc#asinh |Acosh -> handle_function_call iface iface.calc#acosh |Atanh -> handle_function_call iface iface.calc#atanh |Re -> handle_function_call iface iface.calc#re |Im -> handle_function_call iface iface.calc#im |Gamma -> handle_function_call iface iface.calc#gamma |LnGamma -> handle_function_call iface iface.calc#lngamma |Erf -> handle_function_call iface iface.calc#erf |Erfc -> handle_function_call iface iface.calc#erfc |Fact -> handle_interr_function_call iface iface.calc#fact |Transpose -> handle_function_call iface iface.calc#transpose |Mod -> handle_function_call iface iface.calc#mod_int |Floor -> handle_function_call iface iface.calc#floor |Ceiling -> handle_function_call iface iface.calc#ceiling |ToInt -> handle_function_call iface iface.calc#to_int |ToFloat -> handle_function_call iface iface.calc#to_float |SolveLin -> handle_function_call iface iface.calc#solve_linear |Eval -> handle_function_call iface iface.calc#eval |Store -> handle_function_call iface iface.calc#store |Purge -> handle_function_call iface iface.calc#purge |Gcd -> handle_interr_function_call iface iface.calc#gcd |Lcm -> handle_interr_function_call iface iface.calc#lcm |Binom -> handle_interr_function_call iface iface.calc#binom |Perm -> handle_interr_function_call iface iface.calc#permutations |Total -> handle_function_call iface iface.calc#total |Mean -> handle_function_call iface iface.calc#mean |Sumsq -> handle_function_call iface iface.calc#sum_squares |Var -> handle_function_call iface iface.calc#variance_unbiased |VarBias -> handle_function_call iface iface.calc#variance_biased |Stdev -> handle_function_call iface iface.calc#standard_deviation_unbiased |StdevBias -> handle_function_call iface iface.calc#standard_deviation_biased |Min -> handle_function_call iface iface.calc#minimum |Max -> handle_function_call iface iface.calc#maximum |Utpn -> handle_function_call iface iface.calc#upper_tail_prob_normal |StandardizeUnits -> handle_function_call iface iface.calc#standardize_units |ConvertUnits -> handle_function_call iface iface.calc#convert_units |UnitValue -> handle_function_call iface iface.calc#unit_value |Trace -> handle_function_call iface iface.calc#trace end let process_command (iface : interface_state_t) cc = begin match cc with |Drop -> handle_command_call iface iface.calc#drop |Clear -> handle_command_call iface iface.calc#clear |Swap -> handle_command_call iface iface.calc#swap |Dup -> handle_command_call iface iface.calc#dup |Undo -> handle_command_call iface iface.calc#undo |BeginBrowse -> handle_begin_browse iface |BeginAbbrev -> handle_begin_abbrev iface |BeginConst -> handle_begin_const iface |BeginVar -> handle_begin_variable iface |Quit -> handle_quit iface |SetRadians -> handle_command_call iface iface.calc#mode_rad; draw_help iface; draw_update_stack iface |SetDegrees -> handle_command_call iface iface.calc#mode_deg; draw_help iface; draw_update_stack iface |SetRect -> handle_command_call iface iface.calc#mode_rect; draw_help iface; draw_update_stack iface |SetPolar -> handle_command_call iface iface.calc#mode_polar; draw_help iface; draw_update_stack iface |SetBin -> handle_command_call iface iface.calc#mode_bin; draw_help iface; draw_update_stack iface |SetOct -> handle_command_call iface iface.calc#mode_oct; draw_help iface; draw_update_stack iface |SetDec -> handle_command_call iface iface.calc#mode_dec; draw_help iface; draw_update_stack iface |SetHex -> handle_command_call iface iface.calc#mode_hex; draw_help iface; draw_update_stack iface |ToggleAngleMode -> handle_command_call iface iface.calc#toggle_angle_mode; draw_help iface; draw_update_stack iface |ToggleComplexMode -> handle_command_call iface iface.calc#toggle_complex_mode; draw_help iface; draw_update_stack iface |CycleBase -> handle_command_call iface iface.calc#cycle_base; draw_help iface; draw_update_stack iface |View -> handle_view iface |About -> handle_about iface |Refresh -> handle_refresh iface |EnterPi -> handle_command_call iface iface.calc#enter_pi |Rand -> handle_command_call iface iface.calc#rand |EditInput -> handle_edit_input iface |CycleHelp -> handle_cycle_help iface end (****************************************************************) (* IMPLEMENTATION OF ABBREVIATION AND CONSTANT ENTRY SYSTEM *) (****************************************************************) (* exit abbrev entry *) let handle_exit_abbrev (iface : interface_state_t) = if iface.interface_mode = AbbrevEditMode then begin iface.interface_mode <- StandardEditMode; iface.abbrev_entry_buffer <- ""; draw_help iface; draw_update_entry iface end else () (* search through a list of commands and find all that match * iface.abbrev_entry_buffer. * The list is built up in reverse order using Str.search_backward, * so the head of the list is actually the first match. *) let match_abbrev_buffer (iface : interface_state_t) buf = if String.length buf > 0 then let regex = Str.regexp_string buf in let find_matches prev_matches el = if Str.string_match regex el 0 then el :: prev_matches else prev_matches in let match_list = match iface.abbrev_or_const with |IsAbbrev -> List.fold_left find_matches [] !Rcfile.abbrev_commands |IsConst -> List.fold_left find_matches [] !Rcfile.constant_symbols in if List.length match_list = 0 then raise Not_found else match_list else raise Not_found (* backspace during abbrev entry *) let handle_abbrev_backspace (iface : interface_state_t) = let len = String.length iface.abbrev_entry_buffer in if len > 0 then begin iface.abbrev_entry_buffer <- Str.string_before iface.abbrev_entry_buffer (pred len); begin try iface.matched_abbrev_list <- match_abbrev_buffer iface iface.abbrev_entry_buffer with Not_found -> () end; draw_help iface; draw_update_entry iface end else () (* handle entry of an arbitrary character in abbrev mode *) let handle_abbrev_character (iface : interface_state_t) key = try let ch = char_of_int key in let test_buffer = iface.abbrev_entry_buffer ^ (String.make 1 ch) in (* search through the list of commands for the first one that matches * iface.abbrev_entry_buffer *) iface.matched_abbrev_list <- match_abbrev_buffer iface test_buffer; iface.abbrev_entry_buffer <- test_buffer; draw_help iface; draw_update_entry iface with Not_found | Invalid_argument "char_of_int" -> let _ = beep () in () (* enter an abbrev entry *) let handle_enter_abbrev (iface : interface_state_t) = if iface.interface_mode = AbbrevEditMode then begin iface.interface_mode <- StandardEditMode; begin try iface.matched_abbrev_list <- match_abbrev_buffer iface iface.abbrev_entry_buffer; let first_abbrev_match = if iface.matched_abbrev_list = [] then "" else List.hd iface.matched_abbrev_list in begin match iface.abbrev_or_const with |IsAbbrev -> let operation = Rcfile.translate_abbrev first_abbrev_match in begin match operation with |Function ff -> process_function iface ff |Command cc -> process_command iface cc |_ -> failwith "found abbrev command that is neither Function nor Command" end; (* check whether ff should be autobound *) begin try let _ = Rcfile.key_of_operation operation in () with Not_found -> register_autobinding operation end |IsConst -> let const = Rcfile.translate_constant first_abbrev_match in iface.calc#enter_const const.Units.coeff const.Units.comp_units; draw_update_stack iface end with Not_found -> () end; iface.abbrev_entry_buffer <- ""; draw_help iface; draw_update_entry iface end else () (****************************************************************) (* IMPLEMENTATION OF VARIABLE ENTRY SYSTEM *) (****************************************************************) (* exit variable entry *) let handle_exit_variable (iface : interface_state_t) = if iface.interface_mode = VarEditMode then begin iface.interface_mode <- StandardEditMode; iface.entry_type <- FloatEntry; iface.variable_entry_buffer <- ""; draw_help iface; draw_update_entry iface end else () (* search through a list of variables and find all that match * iface.variable_entry_buffer. *) let match_variable_buffer (iface : interface_state_t) buf = let buf_regex = Str.regexp_string buf in let find_matches prev_result el = if Str.string_match buf_regex el 0 then el :: prev_result else prev_result in List.fold_left find_matches [] (List.rev iface.sorted_variables) (* backspace during variable entry *) let handle_variable_backspace (iface : interface_state_t) = let len = String.length iface.variable_entry_buffer in if len > 0 then begin iface.completion <- None; iface.variable_entry_buffer <- Str.string_before iface.variable_entry_buffer (pred len); iface.matched_variables <- match_variable_buffer iface iface.variable_entry_buffer; draw_help iface; draw_update_entry iface end else () (* handle entry of an arbitrary character in variable entry mode *) let handle_variable_character (iface : interface_state_t) key = (* variables with long strings simply aren't useful, and * it's possible that deleting them could become difficult. *) if String.length iface.variable_entry_buffer < 25 then let allowable_regex = Str.regexp "[-a-zA-Z0-9_]" in let ch = char_of_int key in let ss = String.make 1 ch in if Str.string_match allowable_regex ss 0 then let test_buffer = iface.variable_entry_buffer ^ ss in (* search through the list of variables for the first one that matches * iface.variable_entry_buffer *) begin try iface.completion <- None; iface.matched_variables <- match_variable_buffer iface test_buffer; iface.variable_entry_buffer <- test_buffer; draw_help iface; draw_update_entry iface with Not_found -> iface.matched_variables <- []; iface.variable_entry_buffer <- test_buffer; draw_help iface; draw_update_entry iface end else let _ = beep () in () else () (* enter an variable entry *) let handle_enter_variable (iface : interface_state_t) = if iface.interface_mode = VarEditMode then begin if String.length iface.variable_entry_buffer > 0 then push_entry iface else iface.entry_type <- FloatEntry; iface.interface_mode <- StandardEditMode; iface.completion <- None; iface.variable_entry_buffer <- ""; draw_help iface; draw_stack iface; draw_update_entry iface end else () (* autocomplete a variable *) let handle_complete_variable (iface : interface_state_t) = if List.length iface.matched_variables > 0 then begin begin match iface.completion with |None -> iface.completion <- Some 0; iface.variable_entry_buffer_back <- iface.variable_entry_buffer; iface.variable_entry_buffer <- List.nth iface.matched_variables 0 |Some i -> if i < List.length iface.matched_variables - 1 then begin iface.completion <- Some (succ i); iface.variable_entry_buffer <- List.nth iface.matched_variables (succ i) end else begin iface.completion <- None; iface.variable_entry_buffer <- iface.variable_entry_buffer_back end end; draw_help iface; draw_update_entry iface end else let _ = beep () in () (****************************************************************) (* IMPLEMENTATION OF UNITS ENTRY SYSTEM *) (****************************************************************) (* exit units entry *) let handle_exit_units (iface : interface_state_t) = if iface.interface_mode = UnitEditMode then begin iface.interface_mode <- StandardEditMode; iface.units_entry_buffer <- ""; iface.is_entering_units <- false; draw_update_entry iface end else () (* backspace during units entry *) let handle_units_backspace (iface : interface_state_t) = let len = String.length iface.units_entry_buffer in if len > 0 then begin iface.units_entry_buffer <- Str.string_before iface.units_entry_buffer (pred len); draw_update_entry iface end else begin iface.interface_mode <- StandardEditMode; iface.is_entering_units <- false; draw_update_entry iface end (* handle entry of an arbitrary character in units entry mode *) let handle_units_character (iface : interface_state_t) key = try let allowable_regex = Str.regexp "[a-zA-Z0-9\\.\\^\\*/-]" in let ch = char_of_int key in let ss = String.make 1 ch in if Str.string_match allowable_regex ss 0 then begin iface.units_entry_buffer <- iface.units_entry_buffer ^ ss; draw_update_entry iface end else let _ = beep () in () with Invalid_argument "char_of_int" -> let _ = beep () in () (****************************************************************) (* MAIN LOOP *) (****************************************************************) (* handle a keypress in standard entry mode *) let handle_keypress_standard key (iface : interface_state_t) = (* check whether this keypress is a macro *) begin try let ch_list = Rcfile.macro_of_key key in let rec push_macro chars = match chars with | [] -> () | head :: tail -> let _ = ungetch head in push_macro tail in push_macro ch_list with Not_found -> (* if it's not a macro, go ahead and process it *) begin try (* editing operations take priority *) let edit_op = Rcfile.edit_of_key key in begin match edit_op with |Digit -> handle_digit iface key |Enter -> handle_enter iface |Backspace -> handle_backspace iface |Minus -> handle_minus iface |BeginInteger -> handle_begin_int iface |BeginComplex -> handle_begin_complex iface |BeginMatrix -> handle_begin_matrix iface |Separator -> handle_separator iface |Angle -> handle_angle iface |SciNotBase -> handle_scientific_notation iface |BeginUnits -> handle_begin_units iface end with Not_found | Not_handled -> (* next we try to match on functions *) try let function_op = Rcfile.function_of_key key in process_function iface function_op with Not_found -> if iface.has_entry then (* finally we try entry of digits *) handle_digit iface key else (* commands are only suitable when there is no entry *) try let command_op = Rcfile.command_of_key key in process_command iface command_op with Not_found -> handle_digit iface key end end (* handle a keypress in integer editing mode *) let handle_keypress_intedit key (iface : interface_state_t) = begin try let edit_op = Rcfile.edit_of_key key in begin match edit_op with |Digit -> handle_digit iface key |Enter -> handle_enter iface |Backspace -> handle_backspace iface |Minus -> handle_minus iface |SciNotBase -> handle_scientific_notation iface |_ -> raise Not_handled end with Not_found | Not_handled -> try let intedit_op = Rcfile.intedit_of_key key in begin match intedit_op with |IntEditExit -> handle_exit_int iface end with Not_found | Not_handled -> handle_digit iface key end (* handle a keypress in units entry mode *) let handle_keypress_unitedit key (iface : interface_state_t) = begin try let edit_op = Rcfile.edit_of_key key in begin match edit_op with |Enter -> handle_enter iface |Backspace -> handle_units_backspace iface |_ -> handle_units_character iface key end with Not_found | Not_handled -> handle_units_character iface key end (* handle a keypress in abbrev entry mode *) let handle_keypress_abbrev key (iface : interface_state_t) = begin try let abbrev_op = Rcfile.abbrev_of_key key in begin match abbrev_op with |AbbrevExit -> handle_exit_abbrev iface |AbbrevEnter -> handle_enter_abbrev iface |AbbrevBackspace -> handle_abbrev_backspace iface end with Not_found -> handle_abbrev_character iface key end (* handle a keypress in variable editing mode *) let handle_keypress_varedit key (iface : interface_state_t) = begin try let varedit_op = Rcfile.varedit_of_key key in begin match varedit_op with |VarEditExit -> handle_exit_variable iface |VarEditEnter -> handle_enter_variable iface |VarEditBackspace -> handle_variable_backspace iface |VarEditComplete -> handle_complete_variable iface end with Not_found -> handle_variable_character iface key end (* handle a keypress in stack browsing mode *) let handle_keypress_browse key (iface : interface_state_t) = try let browse_op = Rcfile.browse_of_key key in begin match browse_op with |EndBrowse -> handle_end_browse iface |ScrollLeft -> handle_scroll_left iface |ScrollRight -> handle_scroll_right iface |RollDown -> handle_rolldown iface |RollUp -> handle_rollup iface |PrevLine -> handle_prev_line iface |NextLine -> handle_next_line iface |Echo -> handle_browse_echo iface |ViewEntry -> handle_browse_view iface |Drop1 -> handle_browse_drop1 iface |DropN -> handle_browse_dropn iface |Keep -> handle_browse_keep iface |KeepN -> handle_browse_keepn iface |EditEntry -> handle_browse_edit iface end with Not_found | Not_handled -> () let do_main_loop (iface : interface_state_t) = while iface.run_calc do iface.calc#launch_fill_in_thread (); let key = wgetch iface.scr.entry_win in (* using the ncurses SIGWINCH handler to catch window resize events *) if key = Key.resize then handle_resize iface else match iface.interface_mode with |StandardEditMode -> handle_keypress_standard key iface |IntEditMode -> handle_keypress_intedit key iface |AbbrevEditMode -> handle_keypress_abbrev key iface |VarEditMode -> handle_keypress_varedit key iface |UnitEditMode -> handle_keypress_unitedit key iface |BrowsingMode -> handle_keypress_browse key iface done (* initialize the interface and begin the main loop *) let run (iface : interface_state_t) = iface.calc#backup (); assert (keypad iface.scr.entry_win true); (* initialize buffers for matrix entry *) for i = 1 to pred max_matrix_size do iface.gen_buffer.(i) <- {re_mantissa = ""; re_exponent = ""; im_mantissa = ""; im_exponent = ""; is_polar = false} done; begin try iface.calc#set_state (Statefile.load_state ()); draw_stack iface; draw_help iface; draw_update_entry iface; with Invalid_argument err -> draw_stack iface; draw_help iface; draw_error iface err; draw_update_entry iface end; do_main_loop iface (* arch-tag: DO_NOT_CHANGE_b4519dd2-7e94-4cbf-931a-bb5f97445cbf *) orpie-1.5.2/units/0000755000175000017500000000000012322115103012451 5ustar paulpaulorpie-1.5.2/units/units.ml0000644000175000017500000004125212322115103014151 0ustar paulpaul(* ocaml-units -- a module for handling standard operations on * physical units * * Copyright (C) 2007 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send feedback, bug reports, patches, etc. to * . *) exception Units_error of string let units_failwith ss = raise (Units_error ss) (* SI prefixes. *) type prefix_t = | NoPrefix | Yocto | Zepto | Atto | Femto | Pico | Nano | Micro | Milli | Centi | Deci | Deka | Hecto | Kilo | Mega | Giga | Tera | Peta | Exa | Zetta | Yotta (* A unit is viewed as a composite of one or more base units. The Map structure * works well for this purpose; the string representation of a unit is the key, * and this key maps to the (float) power of that unit. This data structure * allows nice lookup semantics when multiplying units together, etc. *) module SMap = Map.Make (String) (* Any number of units can be attached to a numeric value. We call this a * "unit set", and it is a mapping from the string representations of the * units to the float powers which they are raised to. *) type unit_set_t = float SMap.t (* A unit *definition* is given in terms of a coefficient and a set of * component units. *) type unit_def_t = { coeff : float; comp_units : unit_set_t } (* A *representation* of a unit involves both the prefix and the string * that identifies the base unit. (e.g. Kilo and "g") *) type unit_rep_t = { prefix : prefix_t; base : string } (* The table of base units maps string representations of units to the preferred * SI prefix. Typically most base units will prefer NoPrefix, but (for example) * the SI standard prefers Kilo for the unit 'g'. *) type base_unit_table_t = prefix_t SMap.t (* The unit definition table maps string representations of units to * sets of base units. *) type unit_def_table_t = unit_def_t SMap.t type unit_table_t = { base_table : base_unit_table_t; def_table : unit_def_table_t } let empty_unit = SMap.empty let empty_unit_table = { base_table = SMap.empty; def_table = SMap.empty } (* Multiply a single unit by a set of units, collecting like terms. *) let mult_aux (unit_str : string) (unit_pow : float) (unit_set : unit_set_t) = let existing_pow = if SMap.mem unit_str unit_set then SMap.find unit_str unit_set else 0.0 in let new_pow = existing_pow +. unit_pow in if new_pow <> 0.0 then SMap.add unit_str new_pow unit_set else (* if unit powers happen to cancel exactly, remove them completely *) SMap.remove unit_str unit_set (* Create a new base unit with a preferred SI prefix. *) let add_base_unit (unit_str : string) (preferred_prefix : prefix_t) (known_units : unit_table_t) : unit_table_t = if SMap.mem unit_str known_units.base_table then units_failwith ("base unit \"" ^ unit_str ^ "\" already declared") else (* We also enter this base unit into the main unit definion table * as an A->A mapping, so that base units can be "expanded" just * like any other unit. (Base units expand to themselves.) *) let unit_def = { coeff = 1.0; comp_units = SMap.add unit_str 1.0 SMap.empty } in { base_table = SMap.add unit_str preferred_prefix known_units.base_table; def_table = SMap.add unit_str unit_def known_units.def_table } let prefix_string_table = Hashtbl.create 25;; Hashtbl.add prefix_string_table "y" Yocto;; Hashtbl.add prefix_string_table "z" Zepto;; Hashtbl.add prefix_string_table "a" Atto;; Hashtbl.add prefix_string_table "f" Femto;; Hashtbl.add prefix_string_table "p" Pico;; Hashtbl.add prefix_string_table "n" Nano;; Hashtbl.add prefix_string_table "u" Micro;; Hashtbl.add prefix_string_table "m" Milli;; Hashtbl.add prefix_string_table "c" Centi;; Hashtbl.add prefix_string_table "d" Deci;; Hashtbl.add prefix_string_table "da" Deka;; Hashtbl.add prefix_string_table "h" Hecto;; Hashtbl.add prefix_string_table "k" Kilo;; Hashtbl.add prefix_string_table "M" Mega;; Hashtbl.add prefix_string_table "G" Giga;; Hashtbl.add prefix_string_table "T" Tera;; Hashtbl.add prefix_string_table "P" Peta;; Hashtbl.add prefix_string_table "E" Exa;; Hashtbl.add prefix_string_table "Z" Zetta;; Hashtbl.add prefix_string_table "Y" Yotta;; Hashtbl.add prefix_string_table "" NoPrefix;; let prefix_of_string s = Hashtbl.find prefix_string_table s;; let prefix_list = ["y"; "z"; "a"; "f"; "p"; "n"; "u"; "m"; "c"; "da"; "d"; "h"; "k"; "M"; "G"; "T"; "P"; "E"; "Z"; "Y"];; let prefix_value (pre : prefix_t) = match pre with | NoPrefix -> 1.0 | Yocto -> 1e-24 | Zepto -> 1e-21 | Atto -> 1e-18 | Femto -> 1e-15 | Pico -> 1e-12 | Nano -> 1e-9 | Micro -> 1e-6 | Milli -> 1e-3 | Centi -> 0.01 | Deci -> 0.1 | Deka -> 10.0 | Hecto -> 100.0 | Kilo -> 1e3 | Mega -> 1e6 | Giga -> 1e9 | Tera -> 1e12 | Peta -> 1e15 | Exa -> 1e18 | Zetta -> 1e21 | Yotta -> 1e24 let string_of_prefix (pre : prefix_t) = match pre with | NoPrefix -> "" | Yocto -> "y" | Zepto -> "z" | Atto -> "a" | Femto -> "f" | Pico -> "p" | Nano -> "n" | Micro -> "u" | Milli -> "m" | Centi -> "c" | Deci -> "d" | Deka -> "da" | Hecto -> "h" | Kilo -> "k" | Mega -> "M" | Giga -> "G" | Tera -> "T" | Peta -> "P" | Exa -> "E" | Zetta -> "Z" | Yotta -> "Y" (* Is 'pre' a prefix of 'word'? *) let is_prefix pre word = if String.length word >= String.length pre then pre = (String.sub word 0 (String.length pre)) else false (* Given a string like "kg", try to parse it as the representation of a unit * with prefix. *) let unit_rep_of_string (ss : string) (known_units : unit_table_t) : unit_rep_t = let rec test_prefixes plist = match plist with | [] -> raise Not_found | head :: tail -> if is_prefix head ss then let suffix = Str.string_after ss (String.length head) in if SMap.mem suffix known_units.def_table then let si_prefix = Hashtbl.find prefix_string_table head in { prefix = si_prefix; base = suffix } else test_prefixes tail else test_prefixes tail in (* Look first for matches with no prefix, so we can catch * units like "mmHg" *) if SMap.mem ss known_units.def_table then { prefix = NoPrefix; base = ss } else test_prefixes prefix_list (* Given a leading coefficient and a set of unit definitions (mappings to base * units) considered to be multiplied together, compute an equivalent singular * unit definition (collecting like terms). * * In effect, this is doing an operation like * (3)*(5_m/s)*(10_m^2)*(0.5_g) -> 75_m^3*g/s . *) let collect (terms : float * (unit_def_t SMap.t)) : unit_def_t = let (leading_coeff, uncollected) = terms in let collect_single (unit_str : string) (unit_def : unit_def_t) (collection : unit_def_t) = { coeff = collection.coeff *. unit_def.coeff; comp_units = SMap.fold mult_aux unit_def.comp_units collection.comp_units } in SMap.fold collect_single uncollected {coeff = leading_coeff; comp_units = SMap.empty} (* Given a unit definition (mapping to other known units), expand * out all the known units in terms of base units. The leading * coefficient is prepended. * * In effect, this is doing an operation like * 0.1_N*Hz^2 -> (100)*(1_g*m/s^2)*(1_s^-2) . *) let expand (unit_def : unit_def_t) (known_units : unit_table_t) : (float * (unit_def_t SMap.t)) = let expand_single (unit_rep_str : string) (unit_pow : float) = let unit_rep = unit_rep_of_string unit_rep_str known_units in let base_def = SMap.find unit_rep.base known_units.def_table in (* The powers of all the base units need to be multiplied * by the power of this unit, and the coefficient needs * to be exponentiated. *) let prefix_base_coeff = (prefix_value unit_rep.prefix) *. base_def.coeff in let exponentiate base_unit_pow = base_unit_pow *. unit_pow in { coeff = prefix_base_coeff ** unit_pow; comp_units = SMap.map exponentiate base_def.comp_units } in let base_expansion = SMap.mapi expand_single unit_def.comp_units in (unit_def.coeff, base_expansion) (* Add a unit definition to the table. The definition is immediately * recast in terms of base units only, and is stored in this form. *) let add_unit (unit_str : string) (unit_def : unit_def_t) (known_units : unit_table_t) : unit_table_t = if SMap.mem unit_str known_units.def_table then units_failwith ("unit \"" ^ unit_str ^ "\" already declared") else begin try let unit_base_def = collect (expand unit_def known_units) in {known_units with def_table = SMap.add unit_str unit_base_def known_units.def_table} with Not_found -> units_failwith ("unit \"" ^ unit_str ^ "\" depends on an undefined unit") end (* Is this string a known unit (possibly with a prefix)? *) let is_known_unit (ss : string) (known_units : unit_table_t) = try let _ = unit_rep_of_string ss known_units in true with _ -> false (* Convert a string into an appropriate set of units. Units should be * multiplied with '*', divided with '/', and raised to powers with '^'. * So the following would be a valid example: "kg^2*m/s^2/h*ft^-2". *) let units_of_string (ss : string) (known_units : unit_table_t) : unit_set_t = let mult_regex = Str.regexp "\\*" and div_regex = Str.regexp "/" and pow_regex = Str.regexp "\\^" in (* Given a string like "mm^3" parse it into a unit representation * and floating-point power. *) let unit_of_term (tt : string) : (string * float) = match Str.split pow_regex tt with | [] -> units_failwith "empty power split in unit_of_string()" | unit_str :: [] -> if String.contains tt '^' then units_failwith "illegal unit exponentiation syntax" else if is_known_unit unit_str known_units then (unit_str, 1.0) else units_failwith ("unrecognized unit \"" ^ unit_str ^ "\"") | unit_str :: pow_str :: [] -> let pow = try float_of_string pow_str with _ -> units_failwith ("illegal unit power: \"" ^ pow_str ^ "\"") in if is_known_unit unit_str known_units then (unit_str, pow) else units_failwith ("unrecognized unit \"" ^ unit_str ^ "\"") | _ -> units_failwith ("too many exponentiations in unit term \"" ^ tt ^ "\"") in let rec build_unit_set mlist set = match mlist with | [] -> set | head :: tail -> let div_list = Str.split div_regex head in if List.length div_list = 0 then units_failwith "empty unit string" else if List.length div_list = 1 && String.contains head '/' then units_failwith "illegal unit division syntax" else (* the tail of div_list consists of terms which followed division * operators, so we negate the exponents before multiplying out * these terms *) let mult_inverse set div_str = let (div_unit_str, div_unit_pow) = unit_of_term div_str in mult_aux div_unit_str (~-. div_unit_pow) set in let set_with_inverses = List.fold_left mult_inverse set (List.tl div_list) in (* the head of div_list is multiplied, not divided, because it * preceded a division operator *) let (mult_unit_str, mult_unit_pow) = unit_of_term (List.hd div_list) in let next_set = mult_aux mult_unit_str mult_unit_pow set_with_inverses in build_unit_set tail next_set in let mult_terms = Str.split mult_regex ss in build_unit_set mult_terms SMap.empty (* Generate a string representation of a set of units. * FIXME: this will generate an alphabetical unit ordering. * That's probably a little too simplistic. *) let string_of_units (u : unit_set_t) : string = let gen_string unit_str unit_pow str_list = if unit_pow <> 0.0 then let str_rep = if unit_pow <> 1.0 then Printf.sprintf "%s^%g" unit_str unit_pow else unit_str in str_rep :: str_list else str_list in let str_list_rev = SMap.fold gen_string u [] in String.concat "*" (List.rev str_list_rev) (* Convert a string into an appropriate unit definition. Units are specified * as above, but a float coefficient is prepended like so: * "2.3_N*m^2". This can also handle a pure numeric constant. *) let unit_def_of_string (ss : string) (known_units : unit_table_t) : unit_def_t = let split_regex = Str.regexp "_" in let split_str = Str.split split_regex ss in begin try if List.length split_str <> 2 then let c = float_of_string ss in { coeff = c; comp_units = empty_unit } else let float_str = List.hd split_str and units_str = List.hd (List.tl split_str) in let c = float_of_string float_str and u = units_of_string units_str known_units in { coeff = c; comp_units = u } with Failure "float_of_string" -> units_failwith ("unrecognized format for unit definition \"" ^ ss ^ "\"") end let string_of_unit_def (unit_def : unit_def_t) : string = Printf.sprintf "%g_%s" unit_def.coeff (string_of_units unit_def.comp_units) (* Print out the tables of known units. *) let dump_table (known_units : unit_table_t) = let print_base_entry base_unit_str preferred_prefix = Printf.printf "%s (prefix \"%s\")\n" base_unit_str (string_of_prefix preferred_prefix) in let print_entry unit_str unit_def = Printf.printf "%s -> %g_%s\n" unit_str unit_def.coeff (string_of_units unit_def.comp_units) in Printf.printf "BASE UNITS:\n--------------------------\n"; SMap.iter print_base_entry known_units.base_table; Printf.printf "\nUNIT DEFINITIONS:\n--------------------------\n"; SMap.iter print_entry known_units.def_table (* Refactor a set of units in terms of base units. *) let standardize_units (u : unit_set_t) (known_units : unit_table_t) : unit_def_t = let units = {coeff = 1.0; comp_units = u} in let base_units = collect (expand units known_units) in (* base_units doesn't have any prefixes, so we need to add those in *) let add_prefix unit_str unit_pow unit_total = let prefix = SMap.find unit_str known_units.base_table in let prefix_str = string_of_prefix prefix in let total_prefix_value = (prefix_value prefix) ** unit_pow in { coeff = unit_total.coeff /. total_prefix_value; comp_units = SMap.add (prefix_str ^ unit_str) unit_pow unit_total.comp_units } in SMap.fold add_prefix base_units.comp_units {coeff = base_units.coeff; comp_units = SMap.empty} (* conversion_factor a b t * computes the conversion factor 'f' such that a == f*b. * Raises an exception if the units are dimensionally incompatible. *) let conversion_factor (a : unit_set_t) (b : unit_set_t) (known_units : unit_table_t) : float = let a_std = standardize_units a known_units and b_std = standardize_units b known_units in if a_std.comp_units <> b_std.comp_units then units_failwith "units are dimensionally incompatible" else a_std.coeff /. b_std.coeff (* Raise a set of units to a power. *) let pow (u : unit_set_t) (p : float) : unit_set_t = let f x = x *. p in SMap.map f u (* Multiply two unit sets together. *) let mult (a : unit_set_t) (b : unit_set_t) = SMap.fold mult_aux a b (* Divide two unit sets (a/b). *) let div (a : unit_set_t) (b : unit_set_t) = let div_aux unit_str unit_pow unit_set = mult_aux unit_str (~-. unit_pow) unit_set in SMap.fold div_aux b a orpie-1.5.2/units/test.ml0000644000175000017500000001122012322115103013756 0ustar paulpaul(* ocaml-units -- a module for handling standard operations on * physical units * * Copyright (C) 2004 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send feedback, bug reports, patches, etc. to * . *) (* testing for Units code *) open Units;; let masses = [| "g"; "lb"; "oz"; "slug"; "ton"; "tonl"; "tonm"; "ct"; "gr" |];; let dists = [| "m"; "ft"; "in"; "yd"; "mi"; "pc"; "AU"; "Ang"; "furlong"; "pt"; "pica"; "nmi"; "lyr" |];; let times = [| "s"; "min"; "hr"; "day"; "yr" |];; let currs = [| "A" |];; let temps = [| "K"; "R" |];; let forces = [| "N"; "lbf"; "dyn"; "kip" |];; let enrgs = [| "J"; "erg"; "BTU"; "cal"; "eV" |];; let freqs = [| "Hz" |];; let pows = [| "W"; "hp" |];; let press = [| "Pa"; "atm"; "bar"; "mmHg"; "inHg" |];; let volts = [| "V" |];; let resis = [| "Ohm" |];; let caps = [| "F" |];; let inds = [| "H" |];; let mags = [| "T"; "G" |];; let fluxs = [| "Wb"; "Mx" |];; let all_groups = [| masses; dists; times; currs; temps; forces; enrgs; freqs; pows; press; volts; resis; caps; inds; mags; fluxs |];; let shuffle arr = for k = 0 to 1000 do let i1 = Random.int (Array.length arr) in let i2 = Random.int (Array.length arr) in let temp = arr.(i1) in arr.(i1) <- arr.(i2); arr.(i2) <- temp done;; (* For each group of consistent units, compute conversion factors from each * element to the next and take the product; should be very nearly 1.0. * Repeat many times, shuffling the order of the units each iteration. *) for group = 0 to pred (Array.length all_groups) do Printf.printf "Testing unit group %d/%d\n" (succ group) (Array.length all_groups); flush stdout; for iter = 0 to 100 do shuffle all_groups.(group); let cfactor = ref Complex.one in let len = Array.length all_groups.(group) in begin try for i = 0 to pred len do let u1 = unit_of_string all_groups.(group).(i) and u2 = unit_of_string all_groups.(group).((i + 1) mod len) in cfactor := Complex.mul !cfactor (conversion_factor u1 u2) done with Units_error s -> Printf.printf "Caught Units exception: \"%s\"\n" s; print_endline "units_array:"; Array.iter print_endline all_groups.(group); failwith s end; if abs_float ((!cfactor).Complex.re -. 1.0) > 1e-15 then begin Printf.printf "Encountered bad round-trip conversion factor: %.18g\n" (!cfactor).Complex.re; print_endline "units array:"; Array.iter print_endline all_groups.(group); failwith "" end else () done done;; (* exceedingly contrived example to test expansion and grouping of units *) let s1 = "g^3*lb/oz*slug^-1/ton^2*slug/lb*tonl^4*Mtonm^-3*ct/gr^2*tonm^2" and s2 = "*km^3*ft/in^2*mi^-4*yd^-2/AU/pc*Ang^4*furlong*yd^5/pt" and s3 = "*s^-3*min*hr^2*day*min*nyr*min^-2" and s4 = "*A^4" and s5 = "*R^2/K" and s6 = "*mN^3/lbf/dyn^2/kip^3*lbf/lbf^2*Gkip^3" and s7 = "*dJ/merg^2/BTU^3*erg*cal^3*eV*eV" and s8 = "*Hz^2" and s9 = "*W^-3*hp^3" and s10 = "*mPa*atm^0.0*bar^3/mmHg^2/inHg" and s11 = "*V^-2" and s12 = "*Ohm^2" and s13 = "*F^2*F^-3" and s14 = "*H" and s15 = "*T^4/G^3" and s16 = "*Wb^-1/Mx*nWb^2" in let total_s = s1 ^ s2 ^ s3 ^ s4 ^ s5 ^ s6 ^ s7 ^ s8 ^ s9 ^ s10 ^ s11 ^ s12 ^ s13 ^ s14 ^ s15 ^ s16 in let contrived = unit_of_string total_s in let grouped_units = group_units contrived false in let gu_str = string_of_unit grouped_units.factors in print_endline ("grouped = " ^ (string_of_float grouped_units.coeff.Complex.re) ^ gu_str); print_endline ("expected = 1.76804093547e-37G*H*F^-1*Ohm^2*V^-2*mPa*Hz^2*eV^2*lbf^-1*K*A^4*tonm^2*km^3*day"); let stand_units = standardize_units contrived in print_endline ("standardized = " ^ (string_of_float stand_units.coeff.Complex.re) ^ (string_of_unit stand_units.factors)); print_endline ("expected = 8.81537531531e-63K*A^-3*kg^7*m^9*s^-13");; (* arch-tag: DO_NOT_CHANGE_4d4f58ad-d94a-40ad-9582-4782ed4828a2 *) orpie-1.5.2/units/Makefile0000644000175000017500000000042312322115103014110 0ustar paulpaulall: units.cmo test: test.ml units.cmx ocamlopt -o test str.cmxa units.cmx test.ml units.cmo: units.ml ocamlc -c units.ml units.cmx: units.ml ocamlopt -c units.ml clean: rm -f *.cmo *.cmi *.mli test # arch-tag: DO_NOT_CHANGE_0bfec0da-df85-45c5-8615-10d4efc283c6 orpie-1.5.2/units/COPYING0000644000175000017500000004312712322115103013513 0ustar paulpaul GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. orpie-1.5.2/README0000644000175000017500000000034512322115103012171 0ustar paulpaulOrpie README file ------------------------------------------------------------------------ Check the 'doc' subdirectory for installation and usage instructions. # arch-tag: DO_NOT_CHANGE_f1ca0e5d-8b08-41cd-9053-ee9e3289de99 orpie-1.5.2/prep-release.sh0000755000175000017500000000077712322115103014245 0ustar paulpaul#!/bin/bash # 'prep-release' script # Make all the last-minute changes to prepare the sources for packaging # in a release tarball # # Usage: prep-release.sh DESTDIR # echo "Exporting revision..." bzr export $1 echo "Exporting dependencies..." bzr export $1/curses $HOME/src/bzr-repo/libcurses-ocaml-dev bzr export $1/units $HOME/src/bzr-repo/ocaml-units-dev cd $1 echo "Generating ./configure ..." autoconf && rm -rf autom4te.cache echo "Creating documentation..." cd doc && make &> /dev/null echo "Done." orpie-1.5.2/install.ml.in0000644000175000017500000000027512322115103013720 0ustar paulpaul(* Hard-code the installation prefix and sysconfdir. *) let prefix = "@prefix@";; let sysconfdir = "@sysconfdir@";; (* arch-tag: DO_NOT_CHANGE_b0af51b9-3cf0-479c-a33a-f9221e29ed48 *) orpie-1.5.2/interface.ml0000644000175000017500000001717512322115103013614 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* interface.ml * This file defines the data structure (a record) that stores the * interface state. The state includes information on the curses screen, * the current editing mode, the data stored in entry string buffers, etc. *) open Curses;; open Rpc_calc;; open Operations;; open Complex;; exception Not_handled;; (* help_win is provided as an option, because it may be dropped if * the screen width is too small *) type screen_t = {stdscr:window; mutable lines:int; mutable cols:int; mutable help_win:window option; mutable hw_lines:int; mutable hw_cols:int; mutable stack_win:window; mutable sw_lines:int; mutable sw_cols:int; mutable entry_win:window; mutable ew_lines:int; mutable ew_cols:int};; type entry_t = | IntEntry | FloatEntry | ComplexEntry | FloatMatrixEntry | ComplexMatrixEntry | VarEntry;; type interface_mode_t = | StandardEditMode | IntEditMode | AbbrevEditMode | VarEditMode | UnitEditMode | BrowsingMode;; type abbrev_const_t = IsAbbrev | IsConst;; type complex_entry_element_t = {mutable re_mantissa : string; mutable re_exponent : string; mutable im_mantissa : string; mutable im_exponent : string; mutable is_polar : bool};; let max_matrix_size = 1000;; let all_taglines = [| "RPN for the masses"; "'=' is for the weak"; "swap drop dup view"; "I hate the mouse"; "now w/ 800% more stack"; "powered by OCaml"; "compute _this_"; "interface as art"; "kick that data's ass"; "Nice."; "configurability is key"; ":wq"; "the \"Mutt\" of calcs"|]; (* everything you need to know about the interface state goes in this variable *) type interface_state_t = {version : string; (* program version string *) tagline : string; calc : rpc_calc; mutable scr : screen_t; (* curses screen with two or three subwindows *) mutable run_calc : bool; (* exit when run_true becomes false *) mutable stack_bottom_row : int; (* controls what portion of the stack is viewable *) mutable stack_selection : int; (* in stack browsing mode, this item is selected *) mutable interface_mode : interface_mode_t; (* standard mode or stack browsing mode *) mutable horiz_scroll : int; (* controls how far an element is scrolled left/right *) mutable help_page : int; (* which help page is being viewed *) mutable has_entry : bool; (* whether or not the entry buffer has anything in it *) mutable entry_type : entry_t; (* the current type of data being entered *) mutable int_entry_buffer : string; (* holds characters entered for int data type *) mutable is_entering_base : bool; (* is the user is entering a base *) mutable int_base_string : string; (* one-character representation of the base *) mutable is_entering_exponent : bool; (* is the user entering a scientific notation exponent *) mutable abbrev_entry_buffer : string; (* stores characters entered in abbrev entry mode *) mutable matched_abbrev_list : string list; (* stores the list of all possible command completions *) gen_buffer : complex_entry_element_t array; (* storage for floating-point (array)-based types *) mutable abbrev_or_const : abbrev_const_t; (* in AbbrevEntryMode, are we entering an abbrev or a constant? *) mutable variable_entry_buffer : string; (* stores characters entered in variable entry mode *) mutable variable_entry_buffer_back : string; (* used in variable completion *) mutable matched_variables : string list; (* stores the list of all matching variable completions *) mutable sorted_variables : string list; (* stores an alphabetically sorted list of all variables *) mutable completion : int option; (* which one of the list elements to complete variables with *) mutable curr_buf : int; (* which element of gen_buffer is being edited *) mutable is_entering_imag : bool; (* is the imaginary component being edited *) mutable matrix_cols : int; (* how many cols in the matrix being entered *) mutable has_multiple_rows : bool; (* does the matrix being entered have >1 row *) mutable units_entry_buffer : string; (* stores unit characters entered *) mutable is_entering_units : bool} (* is the user appending units *) (* create and initialize an interface with default settings *) let make (c : rpc_calc) (std : screen_t) = Random.self_init (); let tagline_index = Random.int (Array.length all_taglines) in let iface = { version = Version.version; tagline = all_taglines.(tagline_index); calc = c; scr = std; run_calc = true; stack_bottom_row = 1; stack_selection = 1; interface_mode = StandardEditMode; horiz_scroll = 0; help_page = 0; has_entry = false; entry_type = FloatEntry; int_entry_buffer = ""; is_entering_base = false; int_base_string = ""; is_entering_exponent = false; abbrev_entry_buffer = ""; matched_abbrev_list = []; abbrev_or_const = IsAbbrev; variable_entry_buffer = ""; variable_entry_buffer_back = ""; matched_variables = []; sorted_variables = []; completion = None; gen_buffer = Array.make max_matrix_size {re_mantissa = ""; re_exponent = ""; im_mantissa = ""; im_exponent = ""; is_polar = false}; curr_buf = 0; is_entering_imag = false; matrix_cols = 1; has_multiple_rows = false; units_entry_buffer = ""; is_entering_units = false } in iface (* arch-tag: DO_NOT_CHANGE_2e912989-cdb2-498a-9bb3-b6d76e94f3a5 *) orpie-1.5.2/add.ml0000644000175000017500000002145112322115103012374 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) open Rpc_stack open Gsl_assist open Big_int let add (stack : rpc_stack) (evaln : int -> unit) = evaln 2; let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in match gen_el1 with |RpcInt el1 -> ( match gen_el2 with |RpcInt el2 -> stack#push (RpcInt (add_big_int el1 el2)) |RpcFloatUnit (el2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "inconsistent units" end else let (f, u) = funit_of_float ((float_of_big_int el1) +. el2) in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "inconsistent units" end else let c_el1 = cmpx_of_int el1 in let (c, u) = cunit_of_cpx (Complex.add c_el1 el2) in stack#push (RpcComplexUnit (c, u)) |_ -> (* if the elements are incompatible, we have to put them back on the stack *) (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for addition")) ) |RpcFloatUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> if uu1 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "inconsistent units" end else let (f, u) = funit_of_float (el1 +. float_of_big_int el2) in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el2, uu2) -> begin try let conv = Units.conversion_factor uu1 uu2 !Rcfile.unit_table in stack#push (RpcFloatUnit (el1 *. conv +. el2, uu2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s end |RpcComplexUnit (el2, uu2) -> begin try let conv = Units.conversion_factor uu1 uu2 !Rcfile.unit_table in let c_el1 = c_of_f (el1 *. conv) in stack#push (RpcComplexUnit (Complex.add c_el1 el2, uu2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s end |_ -> (* if the elements are incompatible, we have to put them back on the stack *) (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for addition")) ) |RpcComplexUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> if uu1 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "inconsistent units" end else let c_el2 = cmpx_of_int el2 in let (c, u) = cunit_of_cpx (Complex.add el1 c_el2) in stack#push (RpcComplexUnit (c, u)) |RpcFloatUnit (el2, uu2) -> begin try let conv = c_of_f (Units.conversion_factor uu1 uu2 !Rcfile.unit_table) in let c_el1 = Complex.mul conv el1 in let c_el2 = c_of_f el2 in stack#push (RpcComplexUnit (Complex.add c_el1 c_el2, uu2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s end |RpcComplexUnit (el2, uu2) -> begin try let conv = c_of_f (Units.conversion_factor uu1 uu2 !Rcfile.unit_table) in let c_el1 = Complex.mul conv el1 in stack#push (RpcComplexUnit (Complex.add c_el1 el2, uu2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s end |_ -> (* if the elements are incompatible, we have to put them back on the stack *) (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for addition")) ) |RpcFloatMatrixUnit (el1, u1) -> ( match gen_el2 with |RpcFloatMatrixUnit (el2, u2) -> let dim1 = (Gsl_matrix.dims el1) and dim2 = (Gsl_matrix.dims el2) in if dim1 = dim2 then try let conv = Units.conversion_factor u1 u2 !Rcfile.unit_table in let result = Gsl_matrix.copy el1 in Gsl_matrix.scale result conv; Gsl_matrix.add result el2; stack#push (RpcFloatMatrixUnit (result, u2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s else begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for addition") end |RpcComplexMatrixUnit (el2, u2) -> let dim1 = (Gsl_matrix.dims el1) and dim2 = (Gsl_matrix_complex.dims el2) in if dim1 = dim2 then try let conv = c_of_f (Units.conversion_factor u1 u2 !Rcfile.unit_table) in let c_el1 = cmat_of_fmat el1 in Gsl_matrix_complex.scale c_el1 conv; Gsl_matrix_complex.add c_el1 el2; stack#push (RpcComplexMatrixUnit (c_el1, u2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for addition")) |_ -> (* if the elements are incompatible, we have to put them back on the stack *) (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for addition")) ) |RpcComplexMatrixUnit (el1, u1) -> ( match gen_el2 with |RpcFloatMatrixUnit (el2, u2) -> let dim1 = (Gsl_matrix_complex.dims el1) and dim2 = (Gsl_matrix.dims el2) in if dim1 = dim2 then try let conv = c_of_f (Units.conversion_factor u1 u2 !Rcfile.unit_table) in let c_el2 = cmat_of_fmat el2 in let copy = Gsl_matrix_complex.copy el1 in Gsl_matrix_complex.scale copy conv; Gsl_matrix_complex.add copy c_el2; stack#push (RpcComplexMatrixUnit (copy, u2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for addition")) |RpcComplexMatrixUnit (el2, u2) -> let dim1 = (Gsl_matrix_complex.dims el1) and dim2 = (Gsl_matrix_complex.dims el2) in if dim1 = dim2 then try let conv = c_of_f (Units.conversion_factor u1 u2 !Rcfile.unit_table) in let copy = Gsl_matrix_complex.copy el1 in Gsl_matrix_complex.scale copy conv; Gsl_matrix_complex.add copy el2; stack#push (RpcComplexMatrixUnit (copy, u2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for addition")) |_ -> (* if the elements are incompatible, we have to put them back on the stack *) (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for addition")) ) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for addition")) (* arch-tag: DO_NOT_CHANGE_f59cab0f-755e-4d09-9d30-114114945b38 *) orpie-1.5.2/configure0000755000175000017500000036750312322115103013234 0ustar paulpaul#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="rpc_calc.ml" ac_subst_vars='LTLIBOBJS LIBOBJS GSL_LIB GSL_CFLAGS CURSES_LIB EXE OCAMLWIN32 OCAMLLIB OCAMLVERSION OCAMLBEST GSLCONFIG OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC OCAMLYACC OCAMLLEXDOTOPT OCAMLLEX OCAMLDEP OCAMLOPTDOTOPT OCAMLCDOTOPT OCAMLOPT OCAMLC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_gsl_config_dir with_ncurses ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --gsl-config-dir=DIR location of 'gsl-config' from GNU Scientific Library --with-ncurses Force the use of ncurses over curses Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check whether --with-gsl-config-dir was given. if test "${with_gsl_config_dir+set}" = set; then : withval=$with_gsl_config_dir; GSLCONFIGPATH=$PATH:$with_gsl_config_dir else GSLCONFIGPATH=$PATH fi # Check for Ocaml compilers # we first look for ocamlc in the path; if not present, we fail # Extract the first word of "ocamlc", so it can be a program name with args. set dummy ocamlc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLC"; then ac_cv_prog_OCAMLC="$OCAMLC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OCAMLC="ocamlc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_OCAMLC" && ac_cv_prog_OCAMLC="no" fi fi OCAMLC=$ac_cv_prog_OCAMLC if test -n "$OCAMLC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLC" >&5 $as_echo "$OCAMLC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$OCAMLC" = no ; then as_fn_error $? "Cannot find ocamlc." "$LINENO" 5 fi # we extract Ocaml version number and library path OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version *\(.*\)$|\1|p' ` echo "ocaml version is $OCAMLVERSION" OCAMLLIB=`$OCAMLC -v | tail -1 | cut -f 4 -d " "` echo "ocaml library path is $OCAMLLIB" # then we look for ocamlopt; if not present, we issue a warning # if the version is not the same, we also discard it # we set OCAMLBEST to "opt" or "byte", whether ocamlopt is available or not # Extract the first word of "ocamlopt", so it can be a program name with args. set dummy ocamlopt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLOPT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLOPT"; then ac_cv_prog_OCAMLOPT="$OCAMLOPT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OCAMLOPT="ocamlopt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_OCAMLOPT" && ac_cv_prog_OCAMLOPT="no" fi fi OCAMLOPT=$ac_cv_prog_OCAMLOPT if test -n "$OCAMLOPT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPT" >&5 $as_echo "$OCAMLOPT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi OCAMLBEST=byte if test "$OCAMLOPT" = no ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find ocamlopt; bytecode compilation only." >&5 $as_echo "$as_me: WARNING: Cannot find ocamlopt; bytecode compilation only." >&2;} else { $as_echo "$as_me:${as_lineno-$LINENO}: checking ocamlopt version" >&5 $as_echo_n "checking ocamlopt version... " >&6; } TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' ` if test "$TMPVERSION" != "$OCAMLVERSION" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: differs from ocamlc; ocamlopt discarded." >&5 $as_echo "differs from ocamlc; ocamlopt discarded." >&6; } OCAMLOPT=no else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } OCAMLBEST=opt fi fi # checking for ocamlc.opt # Extract the first word of "ocamlc.opt", so it can be a program name with args. set dummy ocamlc.opt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLCDOTOPT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLCDOTOPT"; then ac_cv_prog_OCAMLCDOTOPT="$OCAMLCDOTOPT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OCAMLCDOTOPT="ocamlc.opt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_OCAMLCDOTOPT" && ac_cv_prog_OCAMLCDOTOPT="no" fi fi OCAMLCDOTOPT=$ac_cv_prog_OCAMLCDOTOPT if test -n "$OCAMLCDOTOPT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLCDOTOPT" >&5 $as_echo "$OCAMLCDOTOPT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$OCAMLCDOTOPT" != no ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking ocamlc.opt version" >&5 $as_echo_n "checking ocamlc.opt version... " >&6; } TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' ` if test "$TMPVERSION" != "$OCAMLVERSION" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: differs from ocamlc; ocamlc.opt discarded." >&5 $as_echo "differs from ocamlc; ocamlc.opt discarded." >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } OCAMLC=$OCAMLCDOTOPT fi fi # checking for ocamlopt.opt if test "$OCAMLOPT" != no ; then # Extract the first word of "ocamlopt.opt", so it can be a program name with args. set dummy ocamlopt.opt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLOPTDOTOPT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLOPTDOTOPT"; then ac_cv_prog_OCAMLOPTDOTOPT="$OCAMLOPTDOTOPT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OCAMLOPTDOTOPT="ocamlopt.opt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_OCAMLOPTDOTOPT" && ac_cv_prog_OCAMLOPTDOTOPT="no" fi fi OCAMLOPTDOTOPT=$ac_cv_prog_OCAMLOPTDOTOPT if test -n "$OCAMLOPTDOTOPT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPTDOTOPT" >&5 $as_echo "$OCAMLOPTDOTOPT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$OCAMLOPTDOTOPT" != no ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking ocamlc.opt version" >&5 $as_echo_n "checking ocamlc.opt version... " >&6; } TMPVER=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' ` if test "$TMPVER" != "$OCAMLVERSION" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: differs from ocamlc; ocamlopt.opt discarded." >&5 $as_echo "differs from ocamlc; ocamlopt.opt discarded." >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } OCAMLOPT=$OCAMLOPTDOTOPT fi fi fi # ocamldep should also be present in the path # Extract the first word of "ocamldep", so it can be a program name with args. set dummy ocamldep; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLDEP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLDEP"; then ac_cv_prog_OCAMLDEP="$OCAMLDEP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OCAMLDEP="ocamldep" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_OCAMLDEP" && ac_cv_prog_OCAMLDEP="no" fi fi OCAMLDEP=$ac_cv_prog_OCAMLDEP if test -n "$OCAMLDEP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLDEP" >&5 $as_echo "$OCAMLDEP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$OCAMLDEP" = no ; then as_fn_error $? "Cannot find ocamldep." "$LINENO" 5 fi # Extract the first word of "ocamllex", so it can be a program name with args. set dummy ocamllex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLLEX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLLEX"; then ac_cv_prog_OCAMLLEX="$OCAMLLEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OCAMLLEX="ocamllex" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_OCAMLLEX" && ac_cv_prog_OCAMLLEX="no" fi fi OCAMLLEX=$ac_cv_prog_OCAMLLEX if test -n "$OCAMLLEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLLEX" >&5 $as_echo "$OCAMLLEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$OCAMLLEX" = no ; then as_fn_error $? "Cannot find ocamllex." "$LINENO" 5 else # Extract the first word of "ocamllex.opt", so it can be a program name with args. set dummy ocamllex.opt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLLEXDOTOPT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLLEXDOTOPT"; then ac_cv_prog_OCAMLLEXDOTOPT="$OCAMLLEXDOTOPT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OCAMLLEXDOTOPT="ocamllex.opt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_OCAMLLEXDOTOPT" && ac_cv_prog_OCAMLLEXDOTOPT="no" fi fi OCAMLLEXDOTOPT=$ac_cv_prog_OCAMLLEXDOTOPT if test -n "$OCAMLLEXDOTOPT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLLEXDOTOPT" >&5 $as_echo "$OCAMLLEXDOTOPT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$OCAMLLEXDOTOPT" != no ; then OCAMLLEX=$OCAMLLEXDOTOPT fi fi # Extract the first word of "ocamlyacc", so it can be a program name with args. set dummy ocamlyacc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLYACC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLYACC"; then ac_cv_prog_OCAMLYACC="$OCAMLYACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OCAMLYACC="ocamlyacc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_OCAMLYACC" && ac_cv_prog_OCAMLYACC="no" fi fi OCAMLYACC=$ac_cv_prog_OCAMLYACC if test -n "$OCAMLYACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLYACC" >&5 $as_echo "$OCAMLYACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$OCAMLYACC" = no ; then as_fn_error $? "Cannot find ocamlyacc." "$LINENO" 5 fi # platform { $as_echo "$as_me:${as_lineno-$LINENO}: checking platform" >&5 $as_echo_n "checking platform... " >&6; } if echo "let _ = Sys.os_type" | ocaml | grep -q Win32; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Win32" >&5 $as_echo "Win32" >&6; } OCAMLWIN32=yes EXE=.exe else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not Win32" >&5 $as_echo "not Win32" >&6; } OCAMLWIN32=no EXE= fi # check for curses ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check whether --with-ncurses was given. if test "${with_ncurses+set}" = set; then : withval=$with_ncurses; fi mp_save_LIBS="$LIBS" CURSES_LIB="" if test "$with_ncurses" != yes then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working curses" >&5 $as_echo_n "checking for working curses... " >&6; } if ${mp_cv_curses+:} false; then : $as_echo_n "(cached) " >&6 else LIBS="$LIBS -lcurses" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : mp_cv_curses=yes else mp_cv_curses=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mp_cv_curses" >&5 $as_echo "$mp_cv_curses" >&6; } if test "$mp_cv_curses" = yes then $as_echo "#define HAVE_CURSES_H 1" >>confdefs.h CURSES_LIB="-lcurses" fi fi if test ! "$CURSES_LIB" then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working ncurses" >&5 $as_echo_n "checking for working ncurses... " >&6; } if ${mp_cv_ncurses+:} false; then : $as_echo_n "(cached) " >&6 else LIBS="$mp_save_LIBS -lncurses" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : mp_cv_ncurses=yes else mp_cv_ncurses=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mp_cv_ncurses" >&5 $as_echo "$mp_cv_ncurses" >&6; } if test "$mp_cv_ncurses" = yes then $as_echo "#define HAVE_NCURSES_H 1" >>confdefs.h CURSES_LIB="-lncurses" fi fi LIBS="$mp_save_LIBS" if test ! "$CURSES_LIB"; then as_fn_error $? "Cannot find a curses library. Perhaps you failed to install an ncurses development package?" "$LINENO" 5 fi # check for GSL # Extract the first word of "gsl-config", so it can be a program name with args. set dummy gsl-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_GSLCONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $GSLCONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_GSLCONFIG="$GSLCONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $GSLCONFIGPATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GSLCONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_GSLCONFIG" && ac_cv_path_GSLCONFIG="not found" ;; esac fi GSLCONFIG=$ac_cv_path_GSLCONFIG if test -n "$GSLCONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GSLCONFIG" >&5 $as_echo "$GSLCONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$GSLCONFIG" != x"not found"; then GSL_CFLAGS=`$GSLCONFIG --cflags` GSL_LIB=`$GSLCONFIG --libs` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU Scientific Library" >&5 $as_echo_n "checking for GNU Scientific Library... " >&6; } gsl_save_libs="$LIBS" gsl_save_cflags="$CFLAGS" LIBS="$LIBS $GSL_LIB" CFLAGS="$CFLAGS $GSL_CFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { gsl_complex a; GSL_SET_COMPLEX(&a, 1.0, 1.0); gsl_complex_logabs(a); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : HAS_GSL_LIB=yes else HAS_GSL_LIB=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$HAS_GSL_LIB" = no; then as_fn_error $? "Cannot find the GNU Scientific Library. Perhaps you failed to install a libgsl development package?" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi LIBS="$gsl_save_libs" CFLAGS="$gsl_save_cflags" else as_fn_error $? "Could not find gsl-config. Perhaps you failed to install a libgsl development package?" "$LINENO" 5 fi # substitutions to perform # Finally create the Makefile from Makefile.in ac_config_files="$ac_config_files Makefile install.ml" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "install.ml") CONFIG_FILES="$CONFIG_FILES install.ml" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi chmod a-w Makefile # arch-tag: DO_NOT_CHANGE_3852958f-9da5-4ee1-8a22-ac63ac00aaac orpie-1.5.2/main.ml0000644000175000017500000000322112322115103012563 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) open Interface;; open Curses;; (* load orpierc *) Rcfile.process_rcfile None;; let initialize_screen () = let std = initscr () in assert (keypad std true); assert (cbreak ()); assert (noecho ()); Interface_main.create_windows std;; (* Global: this is the interface state variable used for the calculator *) let calc = new Rpc_calc.rpc_calc !Rcfile.conserve_memory;; let iface = Interface.make calc (initialize_screen ());; (* initialize the error handler *) Gsl_error.init ();; try Interface_main.run iface with error -> endwin (); Printf.fprintf stderr "Caught error at toplevel:\n%s\n" (Printexc.to_string error);; (* For some reason this call fails if it is moved to interface_draw... *) endwin ();; (* arch-tag: DO_NOT_CHANGE_eeac13df-e93f-4359-8b70-44fefc40e225 *) orpie-1.5.2/Makefile.in0000644000175000017500000002455712322115103013371 0ustar paulpaul# # sample Makefile for Objective Caml # Copyright (C) 2001 Jean-Christophe FILLIATRE # # modified 10/26/2003 by Paul Pelzl, for the purpose of building Orpie # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License version 2, as published by the Free Software Foundation. # # 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 version 2 for more details # (enclosed in the file LGPL). # where to install the binaries, rcfiles, manpages, etc. prefix = @prefix@ exec_prefix = @exec_prefix@ sysconfdir = @sysconfdir@ datarootdir = @datarootdir@ BINDIR = $(DESTDIR)/@bindir@ MANDIR = $(DESTDIR)/@mandir@ # other variables set by ./configure OCAMLC = @OCAMLC@ OCAMLOPT = @OCAMLOPT@ OCAMLDEP = @OCAMLDEP@ OCAMLLIB = @OCAMLLIB@ OCAMLBEST = @OCAMLBEST@ OCAMLLEX = @OCAMLLEX@ OCAMLYACC = @OCAMLYACC@ OCAMLVERSION = @OCAMLVERSION@ OCAMLWIN32 = @OCAMLWIN32@ EXE = @EXE@ DEFS = @DEFS@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ CURSES_LIB = @CURSES_LIB@ GSL_LIB = @GSL_LIB@ INCLUDES = -I ./curses -I ./gsl -I ./units BFLAGS = -pp camlp4o -g $(INCLUDES) -thread OFLAGS = -pp camlp4o $(INCLUDES) -thread BLFLAGS = -custom -cclib '$(LDFLAGS) $(CURSES_LIB) $(GSL_LIB) -lm' OLFLAGS = -cclib '$(LDFLAGS) $(CURSES_LIB) $(GSL_LIB) -lm' DEPFLAGS = -pp camlp4o # main target ############# NAME = orpie NAME2 = orpie-curses-keys all: $(OCAMLBEST) # bytecode and native-code compilation ###################################### CMO = big_int_str.cmo gsl_assist.cmo install.cmo operations.cmo utility.cmo \ version.cmo rcfile.cmo rpc_stack.cmo add.cmo sub.cmo mult.cmo div.cmo inv.cmo \ pow.cmo solvelin.cmo rpc_calc.cmo txtin_parser.cmo txtin_lexer.cmo \ statefile.cmo interface.cmo interface_draw.cmo interface_main.cmo main.cmo CMX = $(CMO:.cmo=.cmx) CMA = nums.cma bigarray.cma str.cma unix.cma threads.cma CMXA = $(CMA:.cma=.cmxa) CURSES_CMO = curses/curses.cmo CURSES_CMX = curses/curses.cmx CURSES_COBJS = curses/ml_curses.o CURSES_BOBJS = $(CURSES_CMO) $(CURSES_COBJS) CURSES_OOBJS = $(CURSES_CMX) $(CURSES_COBJS) GSL_CMO = gsl/gsl_error.cmo gsl/gsl_blas.cmo gsl/gsl_complex.cmo gsl/gsl_matrix.cmo gsl/gsl_matrix_complex.cmo \ gsl/gsl_vector.cmo gsl/gsl_vector_complex.cmo gsl/gsl_vector_flat.cmo gsl/gsl_matrix_flat.cmo \ gsl/gsl_vector_complex_flat.cmo gsl/gsl_matrix_complex_flat.cmo gsl/gsl_vectmat.cmo \ gsl/gsl_permut.cmo gsl/gsl_linalg.cmo gsl/gsl_fun.cmo GSL_CMX = $(GSL_CMO:.cmo=.cmx) GSL_COBJS = gsl/mlgsl_error.o gsl/mlgsl_blas.o gsl/mlgsl_blas_complex.o gsl/mlgsl_complex.o gsl/mlgsl_blas_float.o \ gsl/mlgsl_blas_complex_float.o gsl/mlgsl_matrix_complex.o gsl/mlgsl_matrix_double.o gsl/mlgsl_matrix_float.o \ gsl/mlgsl_matrix_complex_float.o gsl/mlgsl_vector_double.o gsl/mlgsl_vector_float.o \ gsl/mlgsl_permut.o gsl/mlgsl_linalg.o gsl/mlgsl_linalg_complex.o gsl/mlgsl_fun.o gsl/mlgsl_math.o gsl/mlgsl_sf.o GSL_BOBJS = $(GSL_COBJS) $(GSL_CMO) GSL_OOBJS = $(GSL_COBJS) $(GSL_CMX) UNITS_CMO = units/units.cmo UNITS_CMX = $(UNITS_CMO:.cmo=.cmx) TEST_CMO = big_int_str.cmo gsl_assist.cmo install.cmo operations.cmo utility.cmo \ version.cmo rpc_stack.cmo add.cmo sub.cmo mult.cmo div.cmo inv.cmo pow.cmo \ solvelin.cmo rpc_calc.cmo txtin_parser.cmo txtin_lexer.cmo calc_test.cmo TEST_CMX = $(TEST_CMO:.cmo=.cmx) GENERATED = version.ml # special case: generated parser depends on the .cmi file txtin_parser.cmo: txtin_parser.ml txtin_parser.cmi $(OCAMLC) -c $(BFLAGS) $< txtin_parser.cmx: txtin_parser.ml txtin_parser.cmi $(OCAMLOPT) -c $(OFLAGS) $< byte: $(NAME).byte $(NAME2).byte opt: $(NAME).opt $(NAME2).opt static: $(NAME).static-opt $(NAME2).static-opt $(NAME).byte: $(CURSES_BOBJS) $(GSL_BOBJS) $(UNITS_CMO) $(CMO) $(OCAMLC) $(BFLAGS) $(BLFLAGS) -o $@ $(CURSES_BOBJS) $(CMA) $(GSL_BOBJS) $(UNITS_CMO) $(CMO) $(NAME2).byte: $(CURSES_BOBJS) curses_assist.cmo curses_keys.cmo $(OCAMLC) $(BFLAGS) $(BLFLAGS) -o $@ $(CURSES_BOBJS) $(CMA) curses_assist.cmo curses_keys.cmo $(NAME).opt: $(CURSES_OOBJS) $(GSL_OOBJS) $(UNITS_CMX) $(CMX) $(OCAMLOPT) $(OFLAGS) -o $@ $(CURSES_OOBJS) $(CMXA) $(GSL_OOBJS) $(UNITS_CMX) $(CMX) $(OLFLAGS) $(NAME2).opt: $(CURSES_OOBJS) curses_assist.cmx curses_keys.cmx $(OCAMLOPT) $(OFLAGS) -o $@ $(CURSES_OOBJS) $(CMXA) curses_assist.cmx curses_keys.cmx $(OLFLAGS) # static build seems to require mashing all the C objects into a library $(NAME).static-opt: $(UNITS_CMX) $(CMX) $(CURSES_OOBJS) $(GSL_OOBJS) my-static-libs $(OCAMLOPT) $(OFLAGS) -I . -ccopt -static -cclib '$(LDFLAGS) -lmycurses -lmygsl $(CURSES_LIB) $(GSL_LIB) -lm' -o $@ $(CMXA) \ curses.cmx $(GSL_CMX) $(UNITS_CMX) $(CMX) strip $(NAME).static-opt $(NAME2).static-opt: $(CURSES_OOBJS) curses_assist.cmx curses_keys.cmx my-static-libs $(OCAMLOPT) $(OFLAGS) -I . -ccopt -static -cclib '$(LDFLAGS) -lmycurses $(CURSES_LIB) -lm' -o $@ $(CMXA) curses.cmx \ curses_assist.cmx curses_keys.cmx strip $(NAME2).static-opt my-static-libs: ar cr libmycurses.a curses/*.o ar cr libmygsl.a gsl/*.o # calculator testing program test.opt: $(GSL_OOBJS) $(UNITS_CMX) $(TEST_CMX) $(OCAMLOPT) $(OFLAGS) -o $@ $(CMXA) $(GSL_OOBJS) $(UNITS_CMX) $(TEST_CMX) -cclib '$(GSL_LIB) -lm' VERSION=1.5.2 version.ml: Makefile echo "let version = \""$(VERSION)"\"" > version.ml echo "let date = \""`date`"\"" >> version.ml # installation ############## install-indep: mkdir -p $(BINDIR) mkdir -p $(DESTDIR)/$(sysconfdir) mkdir -p $(MANDIR)/man1 mkdir -p $(MANDIR)/man5 install -m 644 orpierc $(DESTDIR)/$(sysconfdir) install -m 644 doc/orpie.1 $(MANDIR)/man1/orpie.1 install -m 644 doc/orpie-curses-keys.1 $(MANDIR)/man1/orpie-curses-keys.1 install -m 644 doc/orpierc.5 $(MANDIR)/man5/orpierc.5 install: install-indep install -m 755 $(NAME).$(OCAMLBEST) $(BINDIR)/$(NAME)$(EXE) install -m 755 $(NAME2).$(OCAMLBEST) $(BINDIR)/$(NAME2)$(EXE) install-byte: install-indep install -m 755 $(NAME).byte $(BINDIR)/$(NAME)$(EXE) install -m 755 $(NAME2).byte $(BINDIR)/$(NAME2)$(EXE) install-opt: install-indep install -m 755 $(NAME).opt $(BINDIR)/$(NAME)$(EXE) install -m 755 $(NAME2).opt $(BINDIR)/$(NAME2)$(EXE) install-static: install-indep install -m 755 -D $(NAME).static-opt $(BINDIR)/$(NAME)$(EXE) install -m 755 -D $(NAME2).static-opt $(BINDIR)/$(NAME2)$(EXE) uninstall: rm -f $(BINDIR)/$(NAME)$(EXE) rm -f $(BINDIR)/$(NAME2)$(EXE) rm -f $(DESTDIR)/$(sysconfdir)/orpierc rm -f $(MANDIR)/man1/orpie.1 rm -f $(MANDIR)/man1/orpie-curses-keys.1 rm -f $(MANDIR)/man5/orpierc.5 # generic rules ############### .SUFFIXES: # GSL build rules gsl-opt: $(GSL_OOBJS) gsl-byte: $(GSL_BOBJS) GSL_INCLUDES = -I ./gsl GSL_BFLAGS = -g $(GSL_INCLUDES) -thread GSL_OFLAGS = $(GSL_INCLUDES) -thread GSL_CFLAGS = @GSL_CFLAGS@ $(CPPFLAGS) $(CFLAGS) -DHAVE_INLINE -DHAVE_FENV -g -O2 gsl/%.cmi : gsl/%.mli $(OCAMLC) -c $(GSL_BFLAGS) $< gsl/%.cmo : gsl/%.ml $(OCAMLC) -c $(GSL_BFLAGS) $< gsl/%.o : gsl/%.ml $(OCAMLOPT) -c $(GSL_OFLAGS) $< gsl/%.cmx : gsl/%.ml $(OCAMLOPT) -c $(GSL_OFLAGS) $< gsl/%.o : gsl/%.c cd gsl && $(OCAMLC) -ccopt "$(GSL_CFLAGS)" -c $*.c # curses build rules curses-opt: $(CURSES_OOBJS) curses-byte: $(CURSES_BOBJS) curses/curses.ml: curses/curses.ml.in curses/functions.c $(MAKE) -C curses curses/functions.c: curses/functions.c.in $(MAKE) -C curses CURSES_INCLUDES = -I ./curses CURSES_BFLAGS = -g $(CURSES_INCLUDES) -thread CURSES_OFLAGS = $(CURSES_INCLUDES) -thread CURSES_CFLAGS = -Wall -fPIC -DPIC $(CPPFLAGS) $(CFLAGS) curses/%.cmi : curses/%.mli $(OCAMLC) -c $(CURSES_BFLAGS) $< curses/%.cmo : curses/%.ml $(OCAMLC) -c $(CURSES_BFLAGS) $< curses/%.o : curses/%.ml $(OCAMLOPT) -c $(CURSES_OFLAGS) $< curses/%.cmx : curses/%.ml $(OCAMLOPT) -c $(CURSES_OFLAGS) $< curses/%.o : curses/%.c cd curses && $(OCAMLC) -ccopt "$(CURSES_CFLAGS)" -c $*.c # Units build rules gsl-opt: $(UNITS_CMX) gsl-byte: $(UNITS_CMO) UNITS_INCLUDES = -I ./units UNITS_BFLAGS = -g $(UNITS_INCLUDES) -thread UNITS_OFLAGS = $(UNITS_INCLUDES) -thread units/%.cmi : units/%.mli $(OCAMLC) -c $(UNITS_BFLAGS) $< units/%.cmo : units/%.ml $(OCAMLC) -c $(UNITS_BFLAGS) $< units/%.o : units/%.ml $(OCAMLOPT) -c $(UNITS_OFLAGS) $< units/%.cmx : units/%.ml $(OCAMLOPT) -c $(UNITS_OFLAGS) $< # generic build rules for toplevel directory %.cmi : %.mli $(OCAMLC) -c $(BFLAGS) $< %.cmo : %.ml $(OCAMLC) -c $(BFLAGS) $< %.o : %.ml $(OCAMLOPT) -c $(OFLAGS) $< %.cmx : %.ml $(OCAMLOPT) -c $(OFLAGS) $< %.ml : %.mll $(OCAMLLEX) $< %.ml : %.mly $(OCAMLYACC) -v $< %.mli : %.mly $(OCAMLYACC) -v $< # Emacs tags ############ tags: find . -name "*.ml*" | sort -r | xargs \ etags "--regex=/let[ \t]+\([^ \t]+\)/\1/" \ "--regex=/let[ \t]+rec[ \t]+\([^ \t]+\)/\1/" \ "--regex=/and[ \t]+\([^ \t]+\)/\1/" \ "--regex=/type[ \t]+\([^ \t]+\)/\1/" \ "--regex=/exception[ \t]+\([^ \t]+\)/\1/" \ "--regex=/val[ \t]+\([^ \t]+\)/\1/" \ "--regex=/module[ \t]+\([^ \t]+\)/\1/" # vi tags ######### vtags: otags -vi -o tags *.ml # Makefile is rebuilt whenever Makefile.in or configure.in is modified ###################################################################### Makefile: Makefile.in config.status ./config.status config.status: configure ./config.status --recheck configure: configure.in autoconf # clean ####### partly-clean:: rm -f *.cm[iox] *.o *.a *~ txtin*.ml txtin*.mli *.output rm -f $(GENERATED) parser.output rm -f $(NAME).byte $(NAME).opt $(NAME2).byte $(NAME2).opt $(NAME).static-opt $(NAME2).static-opt rm -f *.aux *.log $(NAME).tex $(NAME).dvi $(NAME).ps gsl-clean:: rm -f gsl/*.cm[iox] gsl/*.o *~ curses-clean:: rm -f curses/*.cm[iox] curses/*.o *~ units-clean:: rm -f units/*.cm[iox] units/*.o *~ clean:: partly-clean gsl-clean curses-clean units-clean dist-clean distclean:: clean rm -f Makefile config.cache config.log config.status install.ml # depend ######## depend:: $(MAKE) txtin_lexer.ml $(MAKE) txtin_parser.ml $(OCAMLDEP) -pp camlp4o $(INCLUDES) *.ml *.mli > depend $(OCAMLDEP) -pp camlp4o $(INCLUDES) units/*.ml units/*.mli >> depend $(OCAMLDEP) -pp cpp -I ./curses curses/*.ml curses/*.mli >> depend $(OCAMLDEP) -I ./gsl gsl/*.ml gsl/*.mli >> depend include depend # arch-tag: DO_NOT_CHANGE_bdb62873-ffd0-4d79-819e-880467e18f28 orpie-1.5.2/configure.in0000644000175000017500000001364712322115103013633 0ustar paulpaul# # autoconf input for Objective Caml programs # Copyright (C) 2001 Jean-Christophe Filliâtre # from a first script by Georges Mariano # # modified 10/26/03 by Paul Pelzl, for inclusion with Orpie # (added ocaml-gsl detection, removed unnecessary checks) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License version 2, as published by the Free Software Foundation. # # 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 version 2 for more details # (enclosed in the file LGPL). # the script generated by autoconf from this input will set the following # variables: # OCAMLC "ocamlc" if present in the path, or a failure # or "ocamlc.opt" if present with same version number as ocamlc # OCAMLOPT "ocamlopt" (or "ocamlopt.opt" if present), or "no" # OCAMLBEST either "byte" if no native compiler was found, # or "opt" otherwise # OCAMLDEP "ocamldep" # OCAMLLIB the path to the ocaml standard library # OCAMLVERSION the ocaml version number # OCAMLWIN32 "yes"/"no" depending on Sys.os_type = "Win32" # EXE ".exe" if OCAMLWIN32=yes, "" otherwise # check for one particular file of the sources # ADAPT THE FOLLOWING LINE TO YOUR SOURCES! AC_INIT(rpc_calc.ml) AC_ARG_WITH(gsl-config-dir, [ --gsl-config-dir=DIR location of 'gsl-config' from GNU Scientific Library], [GSLCONFIGPATH=$PATH:$with_gsl_config_dir], [GSLCONFIGPATH=$PATH]) # Check for Ocaml compilers # we first look for ocamlc in the path; if not present, we fail AC_CHECK_PROG(OCAMLC,ocamlc,ocamlc,no) if test "$OCAMLC" = no ; then AC_MSG_ERROR(Cannot find ocamlc.) fi # we extract Ocaml version number and library path OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version *\(.*\)$|\1|p' ` echo "ocaml version is $OCAMLVERSION" OCAMLLIB=`$OCAMLC -v | tail -1 | cut -f 4 -d " "` echo "ocaml library path is $OCAMLLIB" # then we look for ocamlopt; if not present, we issue a warning # if the version is not the same, we also discard it # we set OCAMLBEST to "opt" or "byte", whether ocamlopt is available or not AC_CHECK_PROG(OCAMLOPT,ocamlopt,ocamlopt,no) OCAMLBEST=byte if test "$OCAMLOPT" = no ; then AC_MSG_WARN(Cannot find ocamlopt; bytecode compilation only.) else AC_MSG_CHECKING(ocamlopt version) TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' ` if test "$TMPVERSION" != "$OCAMLVERSION" ; then AC_MSG_RESULT(differs from ocamlc; ocamlopt discarded.) OCAMLOPT=no else AC_MSG_RESULT(ok) OCAMLBEST=opt fi fi # checking for ocamlc.opt AC_CHECK_PROG(OCAMLCDOTOPT,ocamlc.opt,ocamlc.opt,no) if test "$OCAMLCDOTOPT" != no ; then AC_MSG_CHECKING(ocamlc.opt version) TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' ` if test "$TMPVERSION" != "$OCAMLVERSION" ; then AC_MSG_RESULT(differs from ocamlc; ocamlc.opt discarded.) else AC_MSG_RESULT(ok) OCAMLC=$OCAMLCDOTOPT fi fi # checking for ocamlopt.opt if test "$OCAMLOPT" != no ; then AC_CHECK_PROG(OCAMLOPTDOTOPT,ocamlopt.opt,ocamlopt.opt,no) if test "$OCAMLOPTDOTOPT" != no ; then AC_MSG_CHECKING(ocamlc.opt version) TMPVER=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' ` if test "$TMPVER" != "$OCAMLVERSION" ; then AC_MSG_RESULT(differs from ocamlc; ocamlopt.opt discarded.) else AC_MSG_RESULT(ok) OCAMLOPT=$OCAMLOPTDOTOPT fi fi fi # ocamldep should also be present in the path AC_CHECK_PROG(OCAMLDEP,ocamldep,ocamldep,no) if test "$OCAMLDEP" = no ; then AC_MSG_ERROR(Cannot find ocamldep.) fi AC_CHECK_PROG(OCAMLLEX,ocamllex,ocamllex,no) if test "$OCAMLLEX" = no ; then AC_MSG_ERROR(Cannot find ocamllex.) else AC_CHECK_PROG(OCAMLLEXDOTOPT,ocamllex.opt,ocamllex.opt,no) if test "$OCAMLLEXDOTOPT" != no ; then OCAMLLEX=$OCAMLLEXDOTOPT fi fi AC_CHECK_PROG(OCAMLYACC,ocamlyacc,ocamlyacc,no) if test "$OCAMLYACC" = no ; then AC_MSG_ERROR(Cannot find ocamlyacc.) fi # platform AC_MSG_CHECKING(platform) if echo "let _ = Sys.os_type" | ocaml | grep -q Win32; then AC_MSG_RESULT(Win32) OCAMLWIN32=yes EXE=.exe else AC_MSG_RESULT(not Win32) OCAMLWIN32=no EXE= fi # check for curses MP_WITH_CURSES if test ! "$CURSES_LIB"; then AC_MSG_ERROR(Cannot find a curses library. Perhaps you failed to install an ncurses development package?) fi # check for GSL AC_PATH_PROG(GSLCONFIG, gsl-config, not found, $GSLCONFIGPATH) if test x"$GSLCONFIG" != x"not found"; then GSL_CFLAGS=`$GSLCONFIG --cflags` GSL_LIB=`$GSLCONFIG --libs` AC_MSG_CHECKING(for GNU Scientific Library) gsl_save_libs="$LIBS" gsl_save_cflags="$CFLAGS" LIBS="$LIBS $GSL_LIB" CFLAGS="$CFLAGS $GSL_CFLAGS" AC_TRY_LINK([#include ], [gsl_complex a; GSL_SET_COMPLEX(&a, 1.0, 1.0); gsl_complex_logabs(a);], HAS_GSL_LIB=yes, HAS_GSL_LIB=no) if test "$HAS_GSL_LIB" = no; then AC_MSG_ERROR(Cannot find the GNU Scientific Library. Perhaps you failed to install a libgsl development package?) else AC_MSG_RESULT(yes) fi LIBS="$gsl_save_libs" CFLAGS="$gsl_save_cflags" else AC_MSG_ERROR(Could not find gsl-config. Perhaps you failed to install a libgsl development package?) fi # substitutions to perform AC_SUBST(OCAMLC) AC_SUBST(OCAMLOPT) AC_SUBST(OCAMLDEP) AC_SUBST(OCAMLLEX) AC_SUBST(OCAMLYACC) AC_SUBST(OCAMLBEST) AC_SUBST(OCAMLVERSION) AC_SUBST(OCAMLLIB) AC_SUBST(OCAMLWIN32) AC_SUBST(EXE) AC_SUBST(CURSES_LIB) AC_SUBST(GSL_CFLAGS) AC_SUBST(GSL_LIB) AC_SUBST(DEFS) AC_SUBST(CC) AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) # Finally create the Makefile from Makefile.in AC_OUTPUT(Makefile install.ml) chmod a-w Makefile # arch-tag: DO_NOT_CHANGE_3852958f-9da5-4ee1-8a22-ac63ac00aaac orpie-1.5.2/ChangeLog0000644000175000017500000001752312322115103013071 0ustar paulpaulOrpie ChangeLog ------------------------------------------------------------------------ v1.5 2014-04-11 Version 1.5.2 release. Catch division by zero when invoking the modulo operator. 2010-03-06 Minor changes for compatibility with OCaml 3.11. Honor custom CFLAGS and LDFLAGS settings more carefully. 2007-09-17 ln() and log10() now return complex values for negative real arguments. 2007-09-13 Version 1.5.1 release. pow() now avoids using complex arithmetic in some cases, leading to more pleasant results for expressions like 2^3 - 7. Fixed "invalid argument" crash bug when typing an unprintable character during entry of units. Made a minor syntactical change for compatibility with OCaml 3.10.0. 2007-09-13 Version 1.5.0 release. 2007-07-01 Complete rewrite of units implementation, allowing user-defined units and physical constants. 2007-05-06 Updated included ocamlgsl bindings to 0.6.0. 2006-11-13 Square root of a negative value now returns a complex result. 2006-11-12 gcd(), lcd(), and mod() now accept real-valued arguments. Fix for crash in abbrev mode. 2004-09-09 Made a minor Makefile change to correct linking errors under Gentoo (maybe others). Numerous code cleanups. Calculator code has been better separated from interface code. 2004-09-07 Support --sysconfdir configure option. (Anyone packaging for the filesystem hierarchy standard will now need to use something like "./configure --prefix=/usr --sysconfdir=/etc".) 2004-09-03 Implemented entry of most fundamental physical constants. 2004-08-31 Fixed incorrect error message regarding deprecated extended_enter command. v1.4 2005-10-29 Version 1.4.3 release. Backported a bugfix for crash when executing uconvert() with only one element on the stack. 2005-09-21 Version 1.4.2 release. 2005-09-20 Updated build script for better support on FreeBSD and OS X. 2004-09-17 Version 1.4.1 release. 2004-09-15 Updated the build dependency tree, so parallel make should work properly again. 2004-09-09 Made a minor Makefile change to correct linking errors under Gentoo (maybe others). 2004-09-01 Made some minor documentation fixes. 2004-08-31 Fixed incorrect error message regarding deprecated extended_enter command. 2004-08-30 Version 1.4.0 release. Started work on a testing framework for the rpc_calc object. (I'd really appreciate help writing test cases--see calc_test.ml .) Implemented matrix trace. 2004-08-29 Integrated unit handling code. Real and complex scalars and matrices can are now dimensioned quantities. Unit conversion and base standardization operators were added. When entering external data, the integer base separator character was changed from '_' to '`'. 2004-08-27 Raising a negative real number to a noninteger power now produces a complex value rather than real-valued 'nan'. 2004-08-23 Deprecated "extended_" operation identifiers in favor of somewhat more clear "abbrev_" identifiers. Added methods to include (i.e. source) rcfiles within each other, remove key bindings, and remove operation abbreviations. 2004-07-19 Implemented automatic key bindings. Deprecated operation "function_rand" in favor of "command_rand" because it does not take an argument. v1.3 2004-07-22 Version 1.3.1 release. Ocaml 3.08 support: an include string is provided to the compiler when building curses bindings. Added a fix for a possible crash when drawing help panel and using a custom minimalist orpierc. 2004-07-18 User variables are now evaluated before being passed as arguments to var(). 2004-07-17 Version 1.3.0 release. Added permutation function and random number generator. Implemented common single-variable statistics functions, and an upper tail normal probability function. 2004-07-16 Included "register" variable shortcut macros in orpierc. Added a configuration option to conserve memory by turning off string caching. Added a background thread that precomputes string representations of stack elements. 2004-07-13 Implemented memoization of string representations for stack elements. 2004-07-08 Replaced general integer base conversion algorithm with fast (N*log(N) or better) divide-and- -conquer algorithms. 2004-07-04 Added binomial coefficient function. 2004-07-03 Added LCM function. 2004-06-27 Implemented a method for handling interruptible computations. Added exact factorial and GCD functions. v1.2 2004-06-16 Version 1.2.0 release. 2004-06-15 Fixed the build script to support parallel make. Replaced 'datafile', 'buffer', and 'input_buffer' orpierc variables with the 'datadir' variable. Fixed crash due to displaying 'about' screen in a very small terminal window. 2004-06-14 Implemented user-defined variables and autocompletion routines. 2004-06-13 mod() now has a check for >1 stack elements. 2004-04-22 Orpie no longer generates an error message if it is run without a preexisting calculator state file. v1.1 2004-04-17 Version 1.1.1 release. Added Chris Petersen's orpie.spec file for building RPMs. 2004-04-16 Version 1.1 release. 2004-04-14 Added a linear system solver that avoids computation of an inverse matrix. 2004-04-13 Created a parser and associated routines that enable Orpie to read data entered in an external editor. 2004-04-10 Added a check for inversion of ill-conditioned real matrices. Implemented Mutt-like rcfile macros. 2004-04-09 Added a configuration variable to enable hiding the help panel. v1.0 2004-04-07 Version 1.0.2 release. Added a manpage for orpie-curses-keys(1). 2004-04-05 Version 1.0.1 release. Minor changes to the build script, to assist in package creation (thanks to Uwe Steinmann for the patch). 2004-04-01 Version 1.0 release. orpie-1.5.2/gsl_assist.ml0000644000175000017500000000436112322115103014020 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* gsl_assist.ml * * Contains a bunch of helper functions that make ocamlgsl a bit easier * to work with. *) (* simplifying functions for use with ocamlgsl bindings *) let cmpx_of_int i = {Complex.re=Big_int.float_of_big_int i; Complex.im=0.0} let cmpx_of_float f = {Complex.re=f; Complex.im=0.0} let cmat_of_fmat fm = let rows, cols = Gsl_matrix.dims fm and f_array = Gsl_matrix.to_array fm in let c_array = Array.map cmpx_of_float f_array in Gsl_matrix_complex.of_array c_array rows cols (* 1-norm of matrix *) let one_norm mat = let n, m = Gsl_matrix.dims mat in let maxval = ref (-1.0) in let sum = ref 0.0 in for j = 0 to pred m do sum := 0.0; for i = 0 to pred n do sum := !sum +. (abs_float mat.{i, j}) done; if !sum > !maxval then maxval := !sum else () done; !maxval (* solve a complex linear system using LU decomposition *) let solve_complex_LU ?(protect=true) mat b = let mA = Gsl_vectmat.cmat_convert ~protect mat in let vB = (`CV (Gsl_vector_complex.copy b)) in let (len, _) = Gsl_vectmat.dims mA in let p = Gsl_permut.create len in let _ = Gsl_linalg.complex_LU_decomp mA p in let x = Gsl_vector_complex_flat.create len in Gsl_linalg.complex_LU_solve mA p vB (`CVF x); Gsl_vector_complex_flat.to_complex_array x (* arch-tag: DO_NOT_CHANGE_a19e0df2-6d6b-4925-87eb-be2a2926ffbb *) orpie-1.5.2/calc_test.ml0000644000175000017500000004154112322115103013607 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* calc_test.ml * a testing framework for the rpc_calc object *) (* The basic testing procedure is as follows: * - load some data on the stack using load_data(), * which supports the string syntax described in the manual * under "Entering Data With an External Editor." * - perform desired operations on the data using various * calculator functions provided by rpc_calc.ml * - compute a distortion metric between the calculator * result and the expected result, and raise an error * if it's not within tolerance * - repeat many many times * * Use "make test.opt" to build the testing executable. * * Writing test cases is a big job, and I would really appreciate * some help with this. It's a good project for other developers * to chip away on, because * 1) it doesn't require very deep knowledge of the calculator * internals * 2) testing development can be done in parallel with development * of the calculator itself * 3) since the calculator object handles most of the dirty work, * relatively little OCaml knowledge is necessary * *) open Rpc_calc;; open Rpc_stack;; let calc = new Rpc_calc.rpc_calc false in (* load data into the calculator using its string representation *) let load_data (data_str : string) = let lexbuf = Lexing.from_string data_str in let data = (* need to call completely different parsers when using degrees * or when using radians *) begin match (calc#get_modes ()).angle with |Rad -> Txtin_parser.decode_data_rad Txtin_lexer.token lexbuf |Deg -> Txtin_parser.decode_data_deg Txtin_lexer.token lexbuf end in List.iter calc#push data in let get_result () = calc#get_display_line 1 in let underscore = Str.regexp "_" in (* grab only the numeric portion of a value with units *) let num_part (num_and_units : string) = List.hd (Str.split underscore num_and_units) in (* grab only the units portion of a value with units *) let units_part (num_and_units : string) = List.hd (List.tl (Str.split underscore num_and_units)) in let print_indent s = print_endline (" " ^ s) in (* test whether the calculator result exactly matches the given * string, or raise an exception *) let test_result_exact (expected : string) (test_stage : string) = print_indent test_stage; let result = get_result () in if result <> expected then begin print_endline ("calculator result: \"" ^ result ^ "\""); print_endline (" expected: \"" ^ expected ^ "\""); failwith test_stage end else () in let test_result_float (expected : float) (tol : float) (test_stage : string) (normalized : bool) = print_indent test_stage; let result = get_result () in let ff = float_of_string (num_part result) in let test = if normalized then (abs_float ((ff -. expected) /. expected)) > tol else (abs_float (ff -. expected)) > tol in if test then begin print_endline ("calculator result: " ^ (num_part result)); print_endline (" expected: " ^ (string_of_float expected)); failwith test_stage end else () in (* test whether the calculator result is a floating-point value * which is within the specified tolerance (normalized) *) let test_result_float_tolnorm (expected : float) (tol : float) (test_stage : string) = test_result_float expected tol test_stage true in (* test whether the calculator result is a floating-point value * which is within the specified tolerance (not normalized) *) let test_result_float_tol (expected : float) (tol : float) (test_stage : string) = test_result_float expected tol test_stage false in (* machine precision tolerance *) let mprec = 1e-15 in (* unit conversion tolerance *) let uprec = 1e-6 in (* ad-hoc matrix norm *) let mat_norm () = calc#dup (); calc#transpose (); calc#conj (); calc#mult (); calc#trace (); calc#abs (); calc#sqrt () in (* get a normlized error metric for a matrix result. *) (* Assumes the last two stack elements are result matrix * and expected result matrix. *) let mat_error () = calc#dup (); calc#rolldown 3; calc#sub (); mat_norm (); calc#swap (); mat_norm (); calc#div () in let cpx_error () = calc#dup (); calc#rolldown 3; calc#sub (); calc#swap (); calc#div (); calc#abs () in (************************************************) (* ADDITION *) (************************************************) print_endline "testing add()..."; load_data "#10`d #20`d"; calc#add (); test_result_exact "# 30`d" "add-int-int-1"; load_data "#10`o #20`h"; calc#add (); test_result_exact "# 40`d" "add-int-int-2"; load_data "#10`d 10.0"; calc#add (); test_result_float_tolnorm 20.0 mprec "add-int-float-1"; load_data "(20.0, 20.0) #10`d (10.0, 20.0)"; calc#add (); calc#sub (); calc#abs (); test_result_float_tol 0.0 mprec "add-int-complex-1"; load_data "10.0 #10`d"; calc#add (); test_result_float_tolnorm 20.0 mprec "add-float-int-1"; load_data "10.0 20.0"; calc#add (); test_result_float_tolnorm 30.0 mprec "add-float-float-1"; load_data "10.0_kg*m/s 20.0_ft*lb/min"; calc#add (); test_result_float_tolnorm 4359.80831073 uprec "add-float-float-2"; load_data "(20.0, 20.0) 10.0 (10.0, 20.0)"; calc#add (); calc#sub (); calc#abs (); test_result_float_tol 0.0 mprec "add-float-complex-1"; load_data "(76.66666666667, 20.0)_yd^2/min 10.0_ft^2/s (10.0, 20.0)_yd^2/min"; calc#add (); calc#sub (); calc#abs (); test_result_float_tol 0.0 uprec "add-float-complex-2"; load_data "(20.0, 20.0) (10.0, 20.0) #10`d"; calc#add (); calc#sub (); calc#abs (); test_result_float_tol 0.0 mprec "add-complex-int-1"; load_data "(20.0, 20.0) (10.0, 20.0) 10.0"; calc#add (); calc#sub (); calc#abs (); test_result_float_tol 0.0 mprec "add-complex-float-1"; load_data "(40.0, 60.0) (10.0, 20.0) (30.0, 40.0)"; calc#add (); calc#sub (); calc#abs (); test_result_float_tol 0.0 mprec "add-complex-complex-1"; load_data "(10.254, 20.508)_m (10.0, 20.0)_in (10.0, 20.0)_m"; calc#add (); calc#sub (); calc#abs (); test_result_float_tol 0.0 uprec "add-complex-complex-2"; load_data "[[6, 8][10, 12]] [[1, 2][3, 4]] [[5, 6][7, 8]]"; calc#add (); mat_error (); test_result_float_tol 0.0 mprec "add-fmat-fmat-1"; load_data "[[55.1676416, 106.3352832][157.5029248, 208.6705664]]_m^2/min [[1, 2][3, 4]]_yd^2/s [[5, 6][7, 8]]_m^2/min"; calc#add (); mat_error (); test_result_float_tol 0.0 uprec "add-fmat-fmat-2"; load_data "[[(6, 6), (9, 8)][(12, 10), (15, 12)]] [[1, 2][3, 4]] [[(5, 6), (7, 8)][(9, 10), (11, 12)]]"; calc#add (); mat_error (); test_result_float_tol 0.0 mprec "add-fmat-cmat-1"; load_data "[[(55.1676416, 10.0), (106.3352832, 20.0)] [(157.5029248, 30.0), (208.6705664, 40.0)]]_m^2/min [[1, 2][3, 4]]_yd^2/s [[(5, 10.0), (6, 20.0)][(7, 30.0), (8, 40.0)]]_m^2/min"; calc#add (); mat_error (); test_result_float_tol 0.0 uprec "add_fmat_cmat_2"; load_data "[[(6, 6), (9, 8)][(12, 10), (15, 12)]] [[(5, 6), (7, 8)][(9, 10), (11, 12)]] [[1, 2][3, 4]]"; calc#add (); mat_error (); test_result_float_tol 0.0 mprec "add-cmat-fmat-1"; load_data "[[(55.1676416, 10.0), (106.3352832, 20.0)] [(157.5029248, 30.0), (208.6705664, 40.0)]]_m^2/min [[(5, 10.0), (6, 20.0)][(7, 30.0), (8, 40.0)]]_m^2/min [[1, 2][3, 4]]_yd^2/s"; calc#add (); load_data "1_m^2/min"; calc#convert_units (); mat_error (); test_result_float_tol 0.0 uprec "add-cmat-fmat-2"; load_data "[[(-4, 12), (17, 24)][(105, 9), (-5, -7)]] [[(1, 2), (3, 4)][(5, 6), (7, 8)]] [[(-5, 10), (14, 20)][(100, 3), (-12, -15)]]"; calc#add (); mat_error (); test_result_float_tol 0.0 mprec "add-cmat-cmat-1"; load_data "[[(12.0231131092, 20.0462262185), (9.22773573109, 144.092452437)] [(65.4323583529, 76.1386786555), (8.63698097479, 58.184904874)]]_lb [[(5, 10), (6, 20)][(7, 30), (8, 40)]]_kg [[(1, -2), (-4, 100)][(50, 10), (-9, -30)]]_lb"; calc#add (); mat_error (); test_result_float_tol 0.0 uprec "add-cmat-cmat-2"; calc#clear (); (************************************************) (* SUBTRACTION *) (************************************************) print_endline "testing sub()..."; load_data "#10`d #20`d"; calc#sub (); test_result_exact "# -10`d" "sub-int-int-1"; load_data "#60`o #20`h"; calc#sub (); test_result_exact "# 16`d" "sub-int-int-2"; load_data "#50`d 10.0"; calc#sub (); test_result_float_tolnorm 40.0 mprec "sub-int-float-1"; load_data "(20.0, -20.0) #30`d (10.0, 20.0)"; calc#sub (); cpx_error (); test_result_float_tol 0.0 mprec "sub-int-complex-1"; load_data "30.0 #10`d"; calc#sub (); test_result_float_tolnorm 20.0 mprec "sub-float-int-1"; load_data "50.0 20.0"; calc#sub (); test_result_float_tolnorm 30.0 mprec "sub-float-float-1"; load_data "10.0_kg*m/s 4359.80831073_ft*lb/min"; calc#sub (); test_result_float_tolnorm (-20.0000000041) uprec "sub-float-float-2"; load_data "(20.0, -20.0) 30.0 (10.0, 20.0)"; calc#sub (); cpx_error (); test_result_float_tol 0.0 mprec "sub-float-complex-1"; load_data "(36.6666666667, -20)_yd^2/min 10.0_ft^2/s (30, 20)_yd^2/min"; calc#sub (); cpx_error (); test_result_float_tol 0.0 uprec "sub-float-complex-2"; load_data "(20.0, 20.0) (30.0, 20.0) #10`d"; calc#sub (); cpx_error (); test_result_float_tol 0.0 mprec "sub-complex-int-1"; load_data "(20.0, 20.0) (30.0, 20.0) 10.0"; calc#sub (); cpx_error (); test_result_float_tol 0.0 mprec "sub-complex-float-1"; load_data "(-20.0, -30.0) (10.0, 20.0) (30.0, 50.0)"; calc#sub (); cpx_error (); test_result_float_tol 0.0 mprec "sub-complex-complex-1"; load_data "(-10.0, -20.0)_m (10.0, 20.0)_in (10.254, 20.508)_m"; calc#sub (); cpx_error (); test_result_float_tol 0.0 uprec "sub-complex-complex-2"; load_data "[[-4, -1][2, 6]] [[1, 5][9, 14]] [[5, 6][7, 8]]"; calc#sub (); mat_error (); test_result_float_tol 0.0 mprec "sub-fmat-fmat-1"; load_data "[[-5, -6][-7, -8]]_m^2/min [[1, 2][3, 4]]_yd^2/s [[55.1676416, 106.3352832][157.5029248, 208.6705664]]_m^2/min"; calc#sub (); mat_error (); test_result_float_tol 0.0 uprec "sub-fmat-fmat-2"; load_data "[[(-5, -6), (-7, -8)][(-9, -10), (-11, -12)]] [[1, 2][3, 4]] [[(6, 6), (9, 8)][(12, 10), (15, 12)]]"; calc#sub (); mat_error (); test_result_float_tol 0.0 mprec "sub-fmat-cmat-1"; load_data "[[(-5, -10.0), (-6, -20.0)][(-7, -30.0), (-8, -40.0)]]_m^2/min [[1, 2][3, 4]]_yd^2/s [[(55.1676416, 10.0), (106.3352832, 20.0)] [(157.5029248, 30.0), (208.6705664, 40.0)]]_m^2/min"; calc#sub (); mat_error (); test_result_float_tol 0.0 uprec "sub_fmat_cmat_2"; load_data "[[(4, 6), (5, 8)][(6, 10), (7, 12)]] [[(5, 6), (7, 8)][(9, 10), (11, 12)]] [[1, 2][3, 4]]"; calc#sub (); mat_error (); test_result_float_tol 0.0 mprec "sub-cmat-fmat-1"; load_data "[[(5, 10), (6, 20)][(7, 30), (8, 40)]]_m^2/min [[(55.1676416, 10), (106.3352832, 20)] [(157.5029248, 30), (208.6705664, 40)]]_m^2/min [[1, 2][3, 4]]_yd^2/s"; calc#sub (); load_data "1_m^2/min"; calc#convert_units (); mat_error (); test_result_float_tol 0.0 uprec "sub-cmat-fmat-2"; load_data "[[(6, -8), (-11, -16)][(-95, 3), (19, 23)]] [[(1, 2), (3, 4)][(5, 6), (7, 8)]] [[(-5, 10), (14, 20)][(100, 3), (-12, -15)]]"; calc#sub (); mat_error (); test_result_float_tol 0.0 mprec "sub-cmat-cmat-1"; load_data "[[(-1, 2), (4, -100)][(-50, -10), (9, 30)]]_lb [[(5, 10), (6, 20)][(7, 30), (8, 40)]]_kg [[(12.0231131092, 20.0462262185), (9.22773573109, 144.092452437)] [(65.4323583529, 76.1386786555), (8.63698097479, 58.184904874)]]_lb"; calc#sub (); mat_error (); test_result_float_tol 0.0 uprec "sub-cmat-cmat-2"; calc#clear (); (************************************************) (* MULTIPLICATION *) (************************************************) print_endline "testing mult()..."; load_data "#15`d #-5`d"; calc#mult (); test_result_exact "# -75`d" "mult-int-int-1"; load_data "#65`o #9f`h"; calc#mult (); test_result_exact "# 8427`d" "mult-int-int-2"; load_data "#10`d 20"; calc#mult (); test_result_float_tolnorm 200.0 mprec "mult-int-float-1"; load_data "#10`d 20_m^2/s"; calc#mult (); test_result_float_tolnorm 200.0 mprec "mult-int-float-1"; load_data "(200, -300)_ft^3*s #10`d (20, -30)_ft^3*s"; calc#mult (); cpx_error (); test_result_float_tol 0.0 mprec "mult-int-complex-1"; load_data "30 #15`d"; calc#mult (); test_result_float_tolnorm 450.0 mprec "mult-float-int-1"; load_data "30_ft^2 #15`d"; calc#mult (); test_result_float_tolnorm 450.0 mprec "mult-float-int-2"; load_data "20 30"; calc#mult (); test_result_float_tolnorm 600.0 mprec "mult-float-float-1"; load_data "50_m/s 60_kg/hr"; calc#mult (); test_result_float_tolnorm 0.833333333333333 mprec "mult-float-float-2"; load_data "(-800, 160) -20 (40, -8)"; calc#mult (); cpx_error (); test_result_float_tol 0.0 mprec "mult-float-complex-1"; load_data "(-74.322432, 14.8644864)_m^3 -20_m/s (40, -8)_ft^2*s"; calc#mult (); cpx_error (); test_result_float_tol 0.0 uprec "mult-float-complex-2"; load_data "(300, -600) (10, -20) #30`d"; calc#mult (); cpx_error (); test_result_float_tol 0.0 mprec "mult-complex-int-1"; load_data "(300, -600)_m^2 (10, -20)_m^2 #30`d"; calc#mult (); cpx_error (); test_result_float_tol 0.0 mprec "mult-complex-int-2"; load_data "(-300, 450) (-20, 30) 15"; calc#mult (); cpx_error (); test_result_float_tol 0.0 mprec "mult-complex-float-1"; load_data "(-661.386786555, 992.080179832)_lb^3/s (-20, 30)_lb^2 15_kg/s"; calc#mult (); cpx_error (); test_result_float_tol 0.0 uprec "mult-complex-float-2"; load_data "(1100, 200) (10, 20) (30, -40)"; calc#mult (); cpx_error (); test_result_float_tol 0.0 mprec "mult-complex-complex-1"; load_data "(43307.0866143, 7874.0157481)_kg*in^2/s (10, 20)_in/s^2 (30, -40)_kg*m*s"; calc#mult (); cpx_error (); test_result_float_tol 0.0 uprec "mult-complex-complex-2"; calc#clear (); (************************************************) (* DIVISION *) (************************************************) print_endline "testing div()..."; load_data "#75`d #-5`d"; calc#div (); test_result_exact "# -15`d" "div-int-int-1"; load_data "#20353`o #9f`h"; calc#div (); test_result_exact "# 53`d" "div-int-int-2"; load_data "#10`d 20"; calc#div (); test_result_float_tolnorm 0.5 mprec "div-int-float-1"; load_data "#10`d 20_m^2/s"; calc#div (); test_result_float_tolnorm 0.5 mprec "div-int-float-1"; load_data "(4, 2)_ft^-3*s^-1 #10`d (2, -1)_ft^3*s"; calc#div (); cpx_error (); test_result_float_tol 0.0 mprec "div-int-complex-1"; load_data "30 #15`d"; calc#div (); test_result_float_tolnorm 2.0 mprec "div-float-int-1"; load_data "30_ft^2 #15`d"; calc#div (); test_result_float_tolnorm 2.0 mprec "div-float-int-2"; load_data "30 20"; calc#div (); test_result_float_tolnorm 1.5 mprec "div-float-float-1"; load_data "50_m/s 60_kg/hr"; calc#div (); test_result_float_tolnorm 3000.0 mprec "div-float-float-2"; load_data "(-4, -2) -20 (4, -2)"; calc#div (); cpx_error (); test_result_float_tol 0.0 mprec "div-float-complex-1"; load_data "(-1.5773268726, -0.315465374521)_ft^-1*s^-2 -20_m/s (40, -8)_ft^2*s"; calc#div (); cpx_error (); test_result_float_tol 0.0 uprec "div-float-complex-2"; load_data "(1, -2) (30, -60) #30`d"; calc#div (); cpx_error (); test_result_float_tol 0.0 mprec "div-complex-int-1"; load_data "(1, -2)_m^2 (30, -60)_m^2 #30`d"; calc#div (); cpx_error (); test_result_float_tol 0.0 mprec "div-complex-int-2"; load_data "(-2, 3) (-30, 45) 15"; calc#div (); cpx_error (); test_result_float_tol 0.0 mprec "div-complex-float-1"; load_data "(-0.274328050829, 0.411492076245)_kg*s (-20, 30)_lb^2 15_kg/s"; calc#div (); cpx_error (); test_result_float_tol 0.0 uprec "div-complex-float-2"; load_data "(-0.2, 0.4) (10, 20) (30, -40)"; calc#div (); cpx_error (); test_result_float_tol 0.0 mprec "div-complex-complex-1"; load_data "(-0.00508, 0.01016)_kg^-1*s^-3 (10, 20)_in/s^2 (30, -40)_kg*m*s"; calc#div (); cpx_error (); test_result_float_tol 0.0 uprec "div-complex-complex-2"; print_endline "rpc_calc tested OK!";; (* arch-tag: DO_NOT_CHANGE_f6a7a71b-838a-4128-8858-14708a0c2f69 *) orpie-1.5.2/aclocal.m40000644000175000017500000000221012322115103013142 0ustar paulpauldnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/mp_with_curses.html dnl AC_DEFUN([MP_WITH_CURSES], [AC_ARG_WITH(ncurses, [ --with-ncurses Force the use of ncurses over curses],,) mp_save_LIBS="$LIBS" CURSES_LIB="" if test "$with_ncurses" != yes then AC_CACHE_CHECK([for working curses], mp_cv_curses, [LIBS="$LIBS -lcurses" AC_TRY_LINK( [#include ], [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ], mp_cv_curses=yes, mp_cv_curses=no)]) if test "$mp_cv_curses" = yes then AC_DEFINE(HAVE_CURSES_H) CURSES_LIB="-lcurses" fi fi if test ! "$CURSES_LIB" then AC_CACHE_CHECK([for working ncurses], mp_cv_ncurses, [LIBS="$mp_save_LIBS -lncurses" AC_TRY_LINK( [#include ], [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ], mp_cv_ncurses=yes, mp_cv_ncurses=no)]) if test "$mp_cv_ncurses" = yes then AC_DEFINE(HAVE_NCURSES_H) CURSES_LIB="-lncurses" fi fi LIBS="$mp_save_LIBS" ])dnl orpie-1.5.2/interface_draw.ml0000644000175000017500000007465112322115103014633 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* interface_draw.ml * This file has all code concerned with rendering the stack, help panel, * and data entry line. *) open Curses;; open Printf;; open Rpc_calc;; open Rpc_stack;; open Complex;; open Big_int;; open Operations;; open Interface;; type abbrev_help_display_t = {functions : string list; modes : string list; misc : string list} (* display the stack, where the bottom line of the display * corresponds to stack level 'stack_bottom_row' *) let draw_stack (iface : interface_state_t) = let print_numbered_line l_num = let num_len = String.length (string_of_int (pred (iface.stack_bottom_row + iface.scr.sw_lines))) in if num_len <= 2 then (sprintf "%2d: %s" l_num) else if num_len = 3 then (sprintf "%3d: %s" l_num) else if num_len = 4 then (sprintf "%4d: %s" l_num) else (* if the line number is really huge, truncate to least * significant digits *) let l_num_str = string_of_int l_num in let str_len = String.length l_num_str in let trunc_num = Str.string_after l_num_str (str_len - 4) in (sprintf "%s: %s" trunc_num) in (* if there is no help window, then print the calculator mode * information above the stack *) let num_stack_lines = begin match iface.scr.help_win with |Some win -> iface.scr.sw_lines |None -> let modes = iface.calc#get_modes () in assert (wmove iface.scr.stack_win 0 0); wclrtoeol iface.scr.stack_win; wattron iface.scr.stack_win WA.bold; assert (mvwaddstr iface.scr.stack_win 0 2 "angle: base: complex:"); wattroff iface.scr.stack_win WA.bold; let angle_str = match modes.angle with |Rad -> "RAD" |Deg -> "DEG" in assert (mvwaddstr iface.scr.stack_win 0 9 angle_str); let base_str = match modes.base with |Bin -> "BIN" |Oct -> "OCT" |Hex -> "HEX" |Dec -> "DEC" in assert (mvwaddstr iface.scr.stack_win 0 20 base_str); let complex_str = match modes.complex with |Rect -> "REC" |Polar -> "POL" in assert (mvwaddstr iface.scr.stack_win 0 34 complex_str); assert (mvwaddstr iface.scr.stack_win 1 0 (String.make (iface.scr.sw_cols) '-')); iface.scr.sw_lines - 2 end in (* display the stack data itself *) for line = iface.stack_bottom_row to pred (iface.stack_bottom_row + num_stack_lines) do let s = iface.calc#get_display_line line in let len = String.length s in assert (wmove iface.scr.stack_win (iface.scr.sw_lines + iface.stack_bottom_row - 1 - line) 0); wclrtoeol iface.scr.stack_win; if line = iface.stack_selection && iface.interface_mode = BrowsingMode then wattron iface.scr.stack_win WA.reverse else (); if len > iface.scr.sw_cols - 7 then begin (* need to truncate the string *) let line_string = if line = iface.stack_selection && iface.interface_mode = BrowsingMode then let sub_s = if iface.horiz_scroll < len - iface.scr.sw_cols + 7 then String.sub s iface.horiz_scroll (iface.scr.sw_cols - 7) else String.sub s (len - iface.scr.sw_cols + 7) (iface.scr.sw_cols - 7) in print_numbered_line line sub_s else let sub_s = String.sub s 0 (iface.scr.sw_cols - 10) in print_numbered_line line (sub_s ^ "...") in assert (waddstr iface.scr.stack_win line_string) end else begin let spacer = String.make (iface.scr.sw_cols - 7 - len) ' ' in let line_string = print_numbered_line line (spacer ^ s) in assert (waddstr iface.scr.stack_win line_string) end; if line = iface.stack_selection && iface.interface_mode = BrowsingMode then wattroff iface.scr.stack_win WA.reverse else (); done; assert (wnoutrefresh iface.scr.stack_win); assert (wmove iface.scr.entry_win (iface.scr.ew_lines - 1) (iface.scr.ew_cols - 1)) let draw_update_stack iface = draw_stack iface; assert (doupdate ()) (* display the data that the user is in the process of entering *) let draw_entry (iface : interface_state_t) = assert (mvwaddstr iface.scr.entry_win 0 0 (String.make iface.scr.ew_cols '-')); assert (wmove iface.scr.entry_win 1 0); wclrtoeol iface.scr.entry_win; (* Safely draw a string into the entry window, with "..." when * truncation occurs. Highlight the first 'highlight_len' * characters. *) let draw_entry_string str highlight_len = let len_str = String.length str in begin if len_str > iface.scr.ew_cols - 1 then let trunc_str = String.sub str (len_str - iface.scr.ew_cols + 4) (iface.scr.ew_cols - 4) in assert (mvwaddstr iface.scr.entry_win 1 0 ("..." ^ trunc_str)) else if highlight_len <= len_str then begin (* highlight the first 'highlight_len' characters *) wattron iface.scr.entry_win WA.bold; assert (mvwaddstr iface.scr.entry_win 1 (iface.scr.ew_cols - len_str - 1) (Str.string_before str (highlight_len))); wattroff iface.scr.entry_win WA.bold; assert (mvwaddstr iface.scr.entry_win 1 (iface.scr.ew_cols - len_str - 1 + highlight_len) (Str.string_after str (highlight_len))) end else assert (mvwaddstr iface.scr.entry_win 1 (iface.scr.ew_cols - len_str - 1) str) end; assert (wnoutrefresh iface.scr.entry_win) in (* draw a string for a single floating-point number *) let get_float_str is_current mantissa exponent = let sign_space = if String.length exponent > 0 then match exponent.[0] with |'-' -> "" |'+' -> "" |_ -> " " else " " in if (is_current && iface.is_entering_exponent) || String.length exponent > 0 then mantissa ^ " x10^" ^ sign_space ^ exponent else if is_current || String.length mantissa > 0 then mantissa else "0" in (* get a string representation of the data that is in the entry buffer *) let data_string = match iface.entry_type with |IntEntry -> if iface.is_entering_base then "# " ^ iface.int_entry_buffer ^ "`" ^ iface.int_base_string else "# " ^ iface.int_entry_buffer |FloatEntry -> let mantissa_str = iface.gen_buffer.(0).re_mantissa and exponent_str = iface.gen_buffer.(0).re_exponent in let ff = get_float_str true mantissa_str exponent_str in if iface.is_entering_units then ff ^ "_" ^ iface.units_entry_buffer else ff |ComplexEntry -> let buffer = iface.gen_buffer.(0) in let cc = if iface.is_entering_imag then let temp = get_float_str false buffer.re_mantissa buffer.re_exponent in let re_str = if String.length temp > 0 then temp else "0" in let im_str = get_float_str true buffer.im_mantissa buffer.im_exponent in match buffer.is_polar with |false -> "(" ^ re_str ^ ", " ^ im_str ^ ")" |true -> "(" ^ re_str ^ " <" ^ im_str ^ ")" else let re_str = get_float_str true buffer.re_mantissa buffer.re_exponent in "(" ^ re_str ^ ")" in if iface.is_entering_units then cc ^ "_" ^ iface.units_entry_buffer else cc |FloatMatrixEntry -> let ss = ref "[[" in for el = 0 to pred iface.curr_buf do let temp_re = get_float_str false iface.gen_buffer.(el).re_mantissa iface.gen_buffer.(el).re_exponent in if iface.has_multiple_rows && ((succ el) mod iface.matrix_cols) = 0 then ss := !ss ^ temp_re ^ "][" else ss := !ss ^ temp_re ^ ", " done; let temp_re = get_float_str true iface.gen_buffer.(iface.curr_buf).re_mantissa iface.gen_buffer.(iface.curr_buf).re_exponent in ss := !ss ^ temp_re ^ "]]"; if iface.is_entering_units then !ss ^ "_" ^ iface.units_entry_buffer else !ss |ComplexMatrixEntry -> let ss = ref "[[" in for el = 0 to pred iface.curr_buf do let temp_re = get_float_str false iface.gen_buffer.(el).re_mantissa iface.gen_buffer.(el).re_exponent and temp_im = get_float_str false iface.gen_buffer.(el).im_mantissa iface.gen_buffer.(el).im_exponent in (if iface.has_multiple_rows && ((succ el) mod iface.matrix_cols) = 0 then match iface.gen_buffer.(el).is_polar with |false -> ss := !ss ^ "(" ^ temp_re ^ ", " ^ temp_im ^ ")][" |true -> ss := !ss ^ "(" ^ temp_re ^ " <" ^ temp_im ^ ")][" else match iface.gen_buffer.(el).is_polar with |false -> ss := !ss ^ "(" ^ temp_re ^ ", " ^ temp_im ^ "), " |true -> ss := !ss ^ "(" ^ temp_re ^ " <" ^ temp_im ^ "), ") done; (if iface.is_entering_imag then let temp_re = get_float_str false iface.gen_buffer.(iface.curr_buf).re_mantissa iface.gen_buffer.(iface.curr_buf).re_exponent and temp_im = get_float_str true iface.gen_buffer.(iface.curr_buf).im_mantissa iface.gen_buffer.(iface.curr_buf).im_exponent in match iface.gen_buffer.(iface.curr_buf).is_polar with |false -> ss := !ss ^ "(" ^ temp_re ^ ", " ^ temp_im ^ ")]]" |true -> ss := !ss ^ "(" ^ temp_re ^ " <" ^ temp_im ^ ")]]" else let temp_re = get_float_str true iface.gen_buffer.(iface.curr_buf).re_mantissa iface.gen_buffer.(iface.curr_buf).re_exponent in ss := !ss ^ "(" ^ temp_re ^ ")]]"); if iface.is_entering_units then !ss ^ "_" ^ iface.units_entry_buffer else !ss |VarEntry -> "@ " ^ iface.variable_entry_buffer in begin match iface.interface_mode with |StandardEditMode -> draw_entry_string data_string 0 |IntEditMode -> draw_entry_string data_string 0 |AbbrevEditMode -> let first_abbrev_match = if iface.matched_abbrev_list = [] then "" else List.hd iface.matched_abbrev_list in let highlight_len = String.length iface.abbrev_entry_buffer in if highlight_len = 0 then begin match iface.abbrev_or_const with |IsAbbrev -> draw_entry_string "" 0 |IsConst -> draw_entry_string "" 0 end else begin match iface.abbrev_or_const with |IsAbbrev -> let is_function = match (Rcfile.translate_abbrev first_abbrev_match) with |Function ff -> true |_ -> false in if is_function then draw_entry_string (first_abbrev_match ^ "( )") highlight_len else draw_entry_string first_abbrev_match highlight_len |IsConst -> draw_entry_string first_abbrev_match highlight_len end |BrowsingMode -> () |VarEditMode -> if String.length iface.variable_entry_buffer = 0 then draw_entry_string "" 0 else draw_entry_string data_string 0 |UnitEditMode -> draw_entry_string data_string 0 end; assert (wmove iface.scr.entry_win (iface.scr.ew_lines - 1) (iface.scr.ew_cols - 1)) let draw_update_entry iface = draw_entry iface; assert (doupdate ()) (* create the lists of abbreviations to display in the abbrev command * help screen *) let generate_abbrev_help () = let rec trunc_list lst n = if n = 0 then [] else match lst with |[] -> [] |head :: tail -> head :: (trunc_list tail (pred n)) in let get_abbr op = try Rcfile.abbrev_of_operation op with Not_found -> "" in let functions_str = (get_abbr (Function Sin)) ^ " " ^ (get_abbr (Function Asin)) ^ " " ^ (get_abbr (Function Cos)) ^ " " ^ (get_abbr (Function Acos)) ^ " " ^ (get_abbr (Function Tan)) ^ " " ^ (get_abbr (Function Atan)) ^ " " ^ (get_abbr (Function Exp)) ^ " " ^ (get_abbr (Function Ln)) ^ " " ^ (get_abbr (Function Ten_x)) ^ " " ^ (get_abbr (Function Log10)) ^ " " ^ (get_abbr (Function Sq)) ^ " " ^ (get_abbr (Function Sqrt)) ^ " " ^ (get_abbr (Function Inv)) ^ " " ^ (get_abbr (Function Gamma)) ^ " " ^ (get_abbr (Function LnGamma)) ^ " " ^ (get_abbr (Function Erf)) ^ " " ^ (get_abbr (Function Erfc)) ^ " " ^ (get_abbr (Function Transpose)) ^ " " ^ (get_abbr (Function Re)) ^ " " ^ (get_abbr (Function Im)) ^ " " ^ (get_abbr (Function Mod)) ^ " " ^ (get_abbr (Function Floor)) ^ " " ^ (get_abbr (Function Ceiling)) ^ " " ^ (get_abbr (Function ToInt)) ^ " " ^ (get_abbr (Function ToFloat)) ^ " " ^ (get_abbr (Function Eval)) ^ " " ^ (get_abbr (Function Store)) ^ " " ^ (get_abbr (Function Purge)) in let functions_str_wrap = trunc_list (Utility.wordwrap_nspace functions_str 34 2) 5 in let modes_str = (get_abbr (Command SetRadians)) ^ " " ^ (get_abbr (Command SetDegrees)) ^ " " ^ (get_abbr (Command SetBin)) ^ " " ^ (get_abbr (Command SetOct)) ^ " " ^ (get_abbr (Command SetDec)) ^ " " ^ (get_abbr (Command SetHex)) ^ " " ^ (get_abbr (Command SetRect)) ^ " " ^ (get_abbr (Command SetPolar)) in let modes_str_wrap = trunc_list (Utility.wordwrap_nspace modes_str 34 2) 2 in let misc_str = (get_abbr (Command EnterPi)) ^ " " ^ (get_abbr (Command Undo)) ^ " " ^ (get_abbr (Command View)) in let misc_str_wrap = trunc_list (Utility.wordwrap_nspace misc_str 34 2) 1 in {functions = functions_str_wrap; modes = modes_str_wrap; misc = misc_str_wrap} (* create the list of constants to display in the abbrev command * help screen *) let generate_const_help () = let rec trunc_list lst n = if n = 0 then [] else match lst with |[] -> [] |head :: tail -> head :: (trunc_list tail (pred n)) in let rec make_symbols_string symbols_list symbols_str = match symbols_list with | [] -> symbols_str | head :: tail -> make_symbols_string tail (head ^ " " ^ symbols_str) in let symbols = make_symbols_string !Rcfile.constant_symbols "" in trunc_list (Utility.wordwrap_nspace symbols 34 2) 5 (* draw the help page in standard entry mode *) let draw_help_standard iface win mvwaddstr_safe try_find = if iface.help_page = 0 then begin wattron win WA.bold; assert (mvwaddstr win 5 0 "Common Operations:"); wattroff win WA.bold; mvwaddstr_safe win 6 2 ("enter : " ^ try_find (Edit Enter)); mvwaddstr_safe win 7 2 ("drop : " ^ try_find (Command Drop)); mvwaddstr_safe win 8 2 ("swap : " ^ try_find (Command Swap)); mvwaddstr_safe win 9 2 ("backspace: " ^ try_find (Edit Backspace)); mvwaddstr_safe win 10 2 ("add : " ^ try_find (Function Add)); mvwaddstr_safe win 11 2 ("subtract : " ^ try_find (Function Sub)); mvwaddstr_safe win 12 2 ("multiply : " ^ try_find (Function Mult)); mvwaddstr_safe win 13 2 ("divide : " ^ try_find (Function Div)); mvwaddstr_safe win 14 2 ("y^x : " ^ try_find (Function Pow)); mvwaddstr_safe win 15 2 ("negation : " ^ try_find (Function Neg)); wattron win WA.bold; mvwaddstr_safe win 16 0 "Miscellaneous:"; wattroff win WA.bold; mvwaddstr_safe win 17 2 ("scientific notation : " ^ try_find (Edit SciNotBase)); mvwaddstr_safe win 18 2 ("abbreviation entry mode : " ^ try_find (Command BeginAbbrev)); mvwaddstr_safe win 19 2 ("stack browsing mode : " ^ try_find (Command BeginBrowse)); mvwaddstr_safe win 20 2 ("refresh display : " ^ try_find (Command Refresh)); mvwaddstr_safe win 21 2 ("quit : " ^ try_find (Command Quit)); assert (wnoutrefresh win) end else begin let adjust_len s len = if String.length s < len then s ^ (String.make (len - (String.length s)) ' ') else Str.string_before s len in let make_string colon_pos key_string abbr = (adjust_len key_string colon_pos) ^ ": " ^ abbr in wattron win WA.bold; mvwaddstr_safe win 5 0 "Autobindings:"; wattroff win WA.bold; if Array.length !Rcfile.autobind_keys <= 0 then mvwaddstr_safe win 6 2 "(none)" else for i = 0 to pred (min (iface.scr.hw_lines - 6) (Array.length !Rcfile.autobind_keys)) do let (key, key_string, bound_f, age) = !Rcfile.autobind_keys.(i) in let abbr = match bound_f with |None -> "(none)" |Some op -> Rcfile.abbrev_of_operation op in mvwaddstr_safe win (i + 6) 2 (make_string 12 key_string abbr) done; assert (wnoutrefresh win) end (* draw help page in integer editing mode *) let draw_help_intedit iface win mvwaddstr_safe try_find = wattron win WA.bold; mvwaddstr_safe win 5 0 "Integer Editing Operations:"; wattroff win WA.bold; mvwaddstr_safe win 6 2 ("enter : " ^ try_find (Edit Enter)); mvwaddstr_safe win 7 2 ("set base : " ^ try_find (Edit SciNotBase)); mvwaddstr_safe win 8 2 ("cancel : " ^ try_find (IntEdit IntEditExit)); assert (wnoutrefresh win) (* draw help page in abbrev/constant entry mode *) let draw_help_abbrev iface win mvwaddstr_safe try_find = if String.length iface.abbrev_entry_buffer = 0 then begin let abbr_strings = generate_abbrev_help () in let const_strings = generate_const_help () in let rec print_help_lines lines v_pos = begin match lines with |[] -> () |head :: tail -> mvwaddstr_safe win v_pos 2 head; print_help_lines tail (succ v_pos) end in begin match iface.abbrev_or_const with |IsAbbrev -> wattron win WA.bold; mvwaddstr_safe win 5 0 "Abbreviations:"; wattroff win WA.bold; mvwaddstr_safe win 6 1 "Common Functions:"; print_help_lines abbr_strings.functions 7; mvwaddstr_safe win 13 1 "Change Modes:"; print_help_lines abbr_strings.modes 14; mvwaddstr_safe win 17 1 "Miscellaneous:"; print_help_lines abbr_strings.misc 18; mvwaddstr_safe win 20 1 ("execute abbreviation : " ^ try_find (Abbrev AbbrevEnter)); mvwaddstr_safe win 21 1 ("cancel abbreviation : " ^ try_find (Abbrev AbbrevExit)); |IsConst -> wattron win WA.bold; mvwaddstr_safe win 5 0 "Constants:"; wattroff win WA.bold; print_help_lines const_strings 7; mvwaddstr_safe win 12 1 ("enter constant : " ^ try_find (Abbrev AbbrevEnter)); end; assert (wnoutrefresh win) end else begin wattron win WA.bold; assert (mvwaddstr win 5 0 "Matched Abbreviations:"); wattroff win WA.bold; let highlight_len = String.length iface.abbrev_entry_buffer in let rec draw_matches v_pos match_list = if v_pos < iface.scr.hw_lines then begin match match_list with |[] -> () |m :: tail -> begin (* highlight the first 'highlight_len' characters *) wattron win WA.bold; mvwaddstr_safe win v_pos 2 (Str.string_before m (highlight_len)); wattroff win WA.bold; mvwaddstr_safe win v_pos (2 + highlight_len) (Str.string_after m (highlight_len)); draw_matches (succ v_pos) tail end end else () in draw_matches 6 iface.matched_abbrev_list; assert (wnoutrefresh win) end (* draw help page in variable editing mode *) let draw_help_varedit iface win mvwaddstr_safe try_find = wattron win WA.bold; mvwaddstr_safe win 5 0 "Variable Mode Commands:"; wattroff win WA.bold; mvwaddstr_safe win 6 2 ("enter variable : " ^ try_find (VarEdit VarEditEnter)); mvwaddstr_safe win 7 2 ("complete variable: " ^ try_find (VarEdit VarEditComplete)); mvwaddstr_safe win 8 2 ("cancel entry : " ^ try_find (VarEdit VarEditExit)); wattron win WA.bold; mvwaddstr_safe win 10 0 "Matched variables:"; wattroff win WA.bold; let highlight_len = begin match iface.completion with |None -> String.length iface.variable_entry_buffer |Some _ -> 0 end in let rec draw_matches v_pos match_list count = if v_pos < iface.scr.hw_lines then begin match match_list with |[] -> () |m :: tail -> begin match iface.completion with |None -> (* highlight the first 'highlight_len' characters *) wattron win WA.bold; mvwaddstr_safe win v_pos 2 (Str.string_before m (highlight_len)); wattroff win WA.bold; mvwaddstr_safe win v_pos (2 + highlight_len) (Str.string_after m (highlight_len)); |Some num -> (* highlight the entire selected match *) if count = num then begin wattron win WA.bold; mvwaddstr_safe win v_pos 2 m; wattroff win WA.bold; end else mvwaddstr_safe win v_pos 2 m; end; draw_matches (succ v_pos) tail (succ count) end else () in if List.length iface.matched_variables = 0 then mvwaddstr_safe win 11 2 "(none)" else draw_matches 11 iface.matched_variables 0; assert (wnoutrefresh win) (* draw help page in stack browsing mode *) let draw_help_browsing iface win mvwaddstr_safe try_find = wattron win WA.bold; mvwaddstr_safe win 5 0 "Browsing Operations:"; wattroff win WA.bold; mvwaddstr_safe win 6 2 ("prev : " ^ try_find (Browse PrevLine)); mvwaddstr_safe win 7 2 ("next : " ^ try_find (Browse NextLine)); mvwaddstr_safe win 8 2 ("scroll left : " ^ try_find (Browse ScrollLeft)); mvwaddstr_safe win 9 2 ("scroll right: " ^ try_find (Browse ScrollRight)); mvwaddstr_safe win 10 2 ("roll down : " ^ try_find (Browse RollDown)); mvwaddstr_safe win 11 2 ("roll up : " ^ try_find (Browse RollUp)); mvwaddstr_safe win 12 2 ("dup : " ^ try_find (Command Dup)); mvwaddstr_safe win 13 2 ("view : " ^ try_find (Browse ViewEntry)); mvwaddstr_safe win 14 2 ("edit : " ^ try_find (Browse EditEntry)); mvwaddstr_safe win 15 2 ("drop : " ^ try_find (Browse Drop1)); mvwaddstr_safe win 16 2 ("dropn : " ^ try_find (Browse DropN)); mvwaddstr_safe win 17 2 ("keep : " ^ try_find (Browse Keep)); mvwaddstr_safe win 18 2 ("keepn : " ^ try_find (Browse KeepN)); mvwaddstr_safe win 20 1 ("exit browsing mode: " ^ try_find (Browse EndBrowse)); assert (wnoutrefresh win) (* display the help window *) let draw_help (iface : interface_state_t) = let mvwaddstr_safe w vert horiz st = let st_trunc = if String.length st > 36 then Str.string_before st 36 else st in assert (mvwaddstr w vert horiz st_trunc) in let modes = iface.calc#get_modes () in begin match iface.scr.help_win with |None -> () |Some win -> wclear win; wattron win WA.bold; let s = sprintf "Orpie v%s" iface.version in mvwaddstr_safe win 0 0 s; wattroff win WA.bold; let h_pos = String.length s in mvwaddstr_safe win 0 (h_pos + 1) ("-- " ^ iface.tagline); assert (mvwaddstr win 1 0 "--------------------------------------"); for i = 0 to pred iface.scr.hw_lines do assert (mvwaddch win i 38 (int_of_char '|')) done; wattron win WA.bold; assert (mvwaddstr win 2 0 "Calculator Modes:"); assert (mvwaddstr win 3 2 "angle: base: complex:"); wattroff win WA.bold; let angle_str = match modes.angle with |Rad -> "RAD" |Deg -> "DEG" in assert (mvwaddstr win 3 9 angle_str); let base_str = match modes.base with |Bin -> "BIN" |Oct -> "OCT" |Hex -> "HEX" |Dec -> "DEC" in assert (mvwaddstr win 3 20 base_str); let complex_str = match modes.complex with |Rect -> "REC" |Polar -> "POL" in assert (mvwaddstr win 3 34 complex_str); let try_find op = try Rcfile.key_of_operation op with Not_found -> "(N/A)" in begin match iface.interface_mode with |StandardEditMode | UnitEditMode -> draw_help_standard iface win mvwaddstr_safe try_find |IntEditMode -> draw_help_intedit iface win mvwaddstr_safe try_find |AbbrevEditMode -> draw_help_abbrev iface win mvwaddstr_safe try_find |VarEditMode -> draw_help_varedit iface win mvwaddstr_safe try_find |BrowsingMode -> draw_help_browsing iface win mvwaddstr_safe try_find end end; assert (wmove iface.scr.entry_win (iface.scr.ew_lines - 1) (iface.scr.ew_cols - 1)) let draw_message (iface : interface_state_t) msg = draw_stack iface; let error_lines = Utility.wordwrap msg (iface.scr.sw_cols-2) in let trunc_error_lines = if List.length error_lines > 4 then (List.nth error_lines 0) :: (List.nth error_lines 1) :: (List.nth error_lines 2) :: (List.nth error_lines 3) :: [] else error_lines in let top_line = begin match iface.scr.help_win with |Some win -> 0 |None -> 2 end in for i = 0 to pred (List.length trunc_error_lines) do assert (wmove iface.scr.stack_win (i + top_line) 0); wclrtoeol iface.scr.stack_win; assert (mvwaddstr iface.scr.stack_win (i + top_line) 1 (List.nth trunc_error_lines i)) done; let s = String.make iface.scr.sw_cols '-' in assert (mvwaddstr iface.scr.stack_win ((List.length trunc_error_lines) + top_line) 0 s); assert (wnoutrefresh iface.scr.stack_win); assert (wmove iface.scr.entry_win (iface.scr.ew_lines - 1) (iface.scr.ew_cols - 1)) (* write an error message to the stack window *) let draw_error (iface : interface_state_t) msg = draw_message iface ("Error: " ^ msg) (* display the "about" screen *) let draw_about (iface : interface_state_t) = erase (); (* draw the box outline *) let horiz_line = String.make iface.scr.cols '*' in let vert_line_piece = String.make iface.scr.cols ' ' in vert_line_piece.[0] <- '*'; vert_line_piece.[pred iface.scr.cols] <- '*'; assert (mvaddstr 0 0 horiz_line); assert (mvaddstr (iface.scr.lines - 2) 0 horiz_line); for i = 1 to iface.scr.lines - 3 do assert (mvaddstr i 0 vert_line_piece) done; (* draw the text *) let vert_center = (iface.scr.lines - 2) / 2 and horiz_center = iface.scr.cols / 2 in let left_shift = 17 in attron A.bold; assert (mvaddstr (vert_center - 6) (horiz_center - left_shift) ("Orpie v" ^ iface.version)); attroff A.bold; assert (mvaddstr (vert_center - 5) (horiz_center - left_shift) "Copyright (C) 2004 Paul Pelzl"); assert (mvaddstr (vert_center - 3) (horiz_center - left_shift) "\"Because, frankly, GUI calculator"); assert (mvaddstr (vert_center - 2) (horiz_center - left_shift) " programs are pure evil. "); attron A.bold; assert (mvaddstr (vert_center - 2) (horiz_center - left_shift + 26) "Orpie"); attroff A.bold; assert (mvaddstr (vert_center - 2) (horiz_center - left_shift + 31) ", on"); assert (mvaddstr (vert_center - 1) (horiz_center - left_shift) " the other hand, is only a little"); assert (mvaddstr (vert_center + 0) (horiz_center - left_shift) " bit evil.\""); assert (mvaddstr (vert_center + 2) (horiz_center - left_shift) "Orpie comes with ABSOLUTELY NO"); assert (mvaddstr (vert_center + 3) (horiz_center - left_shift) "WARRANTY. This is free software,"); assert (mvaddstr (vert_center + 4) (horiz_center - left_shift) "and you are welcome to redistribute"); assert (mvaddstr (vert_center + 5) (horiz_center - left_shift) "it under certain conditions; see"); assert (mvaddstr (vert_center + 6) (horiz_center - left_shift) "'COPYING' for details."); assert (mvaddstr (iface.scr.lines - 4) (horiz_center - 12) "Press any key to continue."); assert (move (iface.scr.lines - 1) (iface.scr.cols - 1)); assert (refresh ()) (* arch-tag: DO_NOT_CHANGE_044cbd96-d20b-48c6-92e7-62709c2aa3df *) orpie-1.5.2/gsl/0000755000175000017500000000000012322115103012074 5ustar paulpaulorpie-1.5.2/gsl/gsl_vector.ml0000644000175000017500000001013212322115103014572 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) open Bigarray type double_vector_bigarr = (float, float64_elt, c_layout) Bigarray.Array1.t type vector = double_vector_bigarr let create ?init len = let barr = Array1.create float64 c_layout len in begin match init with | None -> () | Some x -> Array1.fill barr x end ; barr let length = Array1.dim let of_array arr = Array1.of_array float64 c_layout arr let to_array v = Array.init (Array1.dim v) (Array1.get v) let get (v : vector) i = Array1.get v i let set (v : vector) i x = Array1.set v i x let set_all = Array1.fill let set_zero v = set_all v 0. let set_basis v i = set_zero v ; set v i 1. let subvector v ~off ~len = Array1.sub v off len let memcpy ~src:v ~dst:w = if length v <> length w then invalid_arg "Gsl_vector.memcpy" ; Array1.blit v w let copy v = let w = create (length v) in memcpy v w ; w let swap_element v i j = let d = get v i in let d' = get v j in set v j d ; set v i d' let reverse v = let len = length v in for i=0 to pred (len/2) do swap_element v i (pred len - i) done external add : vector -> vector -> unit = "ml_gsl_vector_add" external sub : vector -> vector -> unit = "ml_gsl_vector_sub" external mul : vector -> vector -> unit = "ml_gsl_vector_mul" external div : vector -> vector -> unit = "ml_gsl_vector_div" external scale : vector -> float -> unit = "ml_gsl_vector_scale" external add_constant : vector -> float -> unit = "ml_gsl_vector_add_constant" external is_null : vector -> bool = "ml_gsl_vector_isnull" external max : vector -> float = "ml_gsl_vector_max" external min : vector -> float = "ml_gsl_vector_min" external minmax : vector -> float * float = "ml_gsl_vector_minmax" external max_index : vector -> int = "ml_gsl_vector_maxindex" external min_index : vector -> int = "ml_gsl_vector_minindex" external minmax_index : vector -> int * int = "ml_gsl_vector_minmaxindex" module Single = struct type float_vector_bigarr = (float, float32_elt, c_layout) Bigarray.Array1.t type vector = float_vector_bigarr let create ?init len = let barr = Array1.create float32 c_layout len in begin match init with | None -> () | Some x -> Array1.fill barr x end ; barr let length = length let of_array arr = Array1.of_array float32 c_layout arr let to_array = to_array let get (v : vector) i = Array1.get v i let set (v : vector) i x = Array1.set v i x let set_all = set_all let set_zero = set_zero let set_basis v i = set_zero v ; set v i 1. let subvector = subvector let memcpy = memcpy let copy v = let w = create (length v) in memcpy v w ; w let swap_element v i j = let d = get v i in let d' = get v j in set v j d ; set v i d' let reverse v = let len = length v in for i=0 to pred (len/2) do swap_element v i (pred len - i) done external add : vector -> vector -> unit = "ml_gsl_vector_float_add" external sub : vector -> vector -> unit = "ml_gsl_vector_float_sub" external mul : vector -> vector -> unit = "ml_gsl_vector_float_mul" external div : vector -> vector -> unit = "ml_gsl_vector_float_div" external scale : vector -> float -> unit = "ml_gsl_vector_float_scale" external add_constant : vector -> float -> unit = "ml_gsl_vector_float_add_constant" external is_null : vector -> bool = "ml_gsl_vector_float_isnull" external max : vector -> float = "ml_gsl_vector_float_max" external min : vector -> float = "ml_gsl_vector_float_min" external minmax : vector -> float * float = "ml_gsl_vector_float_minmax" external max_index : vector -> int = "ml_gsl_vector_float_maxindex" external min_index : vector -> int = "ml_gsl_vector_float_minindex" external minmax_index : vector -> int * int = "ml_gsl_vector_float_minmaxindex" end orpie-1.5.2/gsl/mlgsl_linalg.c0000644000175000017500000004774312322115103014723 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include "mlgsl_matrix_double.h" #include "mlgsl_vector_double.h" #include "mlgsl_permut.h" /* simple matrix operations */ CAMLprim value ml_gsl_linalg_matmult_mod(value A, value omodA, value B, value omodB, value C) { gsl_linalg_matrix_mod_t modA = Opt_arg(omodA, Int_val, GSL_LINALG_MOD_NONE); gsl_linalg_matrix_mod_t modB = Opt_arg(omodB, Int_val, GSL_LINALG_MOD_NONE); _DECLARE_MATRIX3(A, B, C); _CONVERT_MATRIX3(A, B, C); gsl_linalg_matmult_mod(&m_A, modA, &m_B, modB, &m_C); return Val_unit; } /* LU decomposition */ CAMLprim value ml_gsl_linalg_LU_decomp(value A, value P) { int sign; GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX(A); _CONVERT_MATRIX(A); gsl_linalg_LU_decomp(&m_A, &perm_P, &sign); return Val_int(sign); } CAMLprim value ml_gsl_linalg_LU_solve(value LU, value P, value B, value X) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX(LU); _DECLARE_VECTOR2(B,X); _CONVERT_MATRIX(LU); _CONVERT_VECTOR2(B,X); gsl_linalg_LU_solve(&m_LU, &perm_P, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_LU_svx(value LU, value P, value X) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX(LU); _DECLARE_VECTOR(X); _CONVERT_MATRIX(LU); _CONVERT_VECTOR(X); gsl_linalg_LU_svx(&m_LU, &perm_P, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_LU_refine(value A, value LU, value P, value B, value X, value RES) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX2(A, LU); _DECLARE_VECTOR3(B, X, RES); _CONVERT_MATRIX2(A, LU); _CONVERT_VECTOR3(B, X, RES); gsl_linalg_LU_refine(&m_A, &m_LU, &perm_P, &v_B, &v_X, &v_RES); return Val_unit; } CAMLprim value ml_gsl_linalg_LU_refine_bc(value *argv, int argc) { return ml_gsl_linalg_LU_refine(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_linalg_LU_invert(value LU, value P, value INV) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX2(LU, INV); _CONVERT_MATRIX2(LU, INV); gsl_linalg_LU_invert(&m_LU, &perm_P, &m_INV); return Val_unit; } CAMLprim value ml_gsl_linalg_LU_det(value LU, value sig) { _DECLARE_MATRIX(LU); _CONVERT_MATRIX(LU); return copy_double(gsl_linalg_LU_det(&m_LU, Int_val(sig))); } CAMLprim value ml_gsl_linalg_LU_lndet(value LU) { _DECLARE_MATRIX(LU); _CONVERT_MATRIX(LU); return copy_double(gsl_linalg_LU_lndet(&m_LU)); } CAMLprim value ml_gsl_linalg_LU_sgndet(value LU, value sig) { _DECLARE_MATRIX(LU); _CONVERT_MATRIX(LU); return Val_int(gsl_linalg_LU_sgndet(&m_LU, Int_val(sig))); } /* QR decomposition */ CAMLprim value ml_gsl_linalg_QR_decomp(value A, value TAU) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(TAU); _CONVERT_MATRIX(A); _CONVERT_VECTOR(TAU); gsl_linalg_QR_decomp(&m_A, &v_TAU); return Val_unit; } CAMLprim value ml_gsl_linalg_QR_solve(value QR, value TAU, value B, value X) { _DECLARE_MATRIX(QR); _DECLARE_VECTOR3(B,X,TAU); _CONVERT_MATRIX(QR); _CONVERT_VECTOR3(B,X,TAU); gsl_linalg_QR_solve(&m_QR, &v_TAU, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_QR_svx(value QR, value TAU, value X) { _DECLARE_MATRIX(QR); _DECLARE_VECTOR2(TAU, X); _CONVERT_MATRIX(QR); _CONVERT_VECTOR2(TAU, X); gsl_linalg_QR_svx(&m_QR, &v_TAU, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_QR_lssolve(value QR, value TAU, value B, value X, value RES) { _DECLARE_MATRIX(QR); _DECLARE_VECTOR4(TAU, RES, B, X); _CONVERT_MATRIX(QR); _CONVERT_VECTOR4(TAU, RES, B, X); gsl_linalg_QR_lssolve(&m_QR, &v_TAU, &v_B, &v_X, &v_RES); return Val_unit; } CAMLprim value ml_gsl_linalg_QR_QTvec(value QR, value TAU, value V) { _DECLARE_MATRIX(QR); _DECLARE_VECTOR2(TAU, V); _CONVERT_MATRIX(QR); _CONVERT_VECTOR2(TAU, V); gsl_linalg_QR_QTvec(&m_QR, &v_TAU, &v_V); return Val_unit; } CAMLprim value ml_gsl_linalg_QR_Qvec(value QR, value TAU, value V) { _DECLARE_MATRIX(QR); _DECLARE_VECTOR2(TAU, V); _CONVERT_MATRIX(QR); _CONVERT_VECTOR2(TAU, V); gsl_linalg_QR_Qvec(&m_QR, &v_TAU, &v_V); return Val_unit; } CAMLprim value ml_gsl_linalg_QR_Rsolve(value QR, value B, value X) { _DECLARE_MATRIX(QR); _DECLARE_VECTOR2(B,X); _CONVERT_MATRIX(QR); _CONVERT_VECTOR2(B,X); gsl_linalg_QR_Rsolve(&m_QR, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_QR_Rsvx(value QR, value X) { _DECLARE_MATRIX(QR); _DECLARE_VECTOR(X); _CONVERT_MATRIX(QR); _CONVERT_VECTOR(X); gsl_linalg_QR_Rsvx(&m_QR, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_QR_unpack(value QR, value TAU, value Q, value R) { _DECLARE_MATRIX3(QR, Q, R); _DECLARE_VECTOR(TAU); _CONVERT_MATRIX3(QR, Q, R); _CONVERT_VECTOR(TAU); gsl_linalg_QR_unpack(&m_QR, &v_TAU, &m_Q, &m_R); return Val_unit; } CAMLprim value ml_gsl_linalg_QR_QRsolve(value Q, value R, value B, value X) { _DECLARE_MATRIX2(Q, R); _DECLARE_VECTOR2(B, X); _CONVERT_MATRIX2(Q, R); _CONVERT_VECTOR2(B, X); gsl_linalg_QR_QRsolve(&m_Q, &m_R, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_QR_update(value Q, value R, value W, value V) { _DECLARE_MATRIX2(Q, R); _DECLARE_VECTOR2(W, V); _CONVERT_MATRIX2(Q, R); _CONVERT_VECTOR2(W, V); gsl_linalg_QR_update(&m_Q, &m_R, &v_W, &v_V); return Val_unit; } CAMLprim value ml_gsl_linalg_R_solve(value R, value B, value X) { _DECLARE_MATRIX(R); _DECLARE_VECTOR2(B, X); _CONVERT_MATRIX(R); _CONVERT_VECTOR2(B, X); gsl_linalg_R_solve(&m_R, &v_B, &v_X); return Val_unit; } /* missing ? */ /* value ml_gsl_linalg_R_svx(value R, value X) */ /* { */ /* DECLARE_MATRIX(R); */ /* DECLARE_VECTOR(X); */ /* gsl_linalg_R_svx(&m_R, &v_X); */ /* return Val_unit; */ /* } */ /* QR Decomposition with Column Pivoting */ CAMLprim value ml_gsl_linalg_QRPT_decomp(value A, value TAU, value P, value NORM) { int signum; GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX(A); _DECLARE_VECTOR2(TAU, NORM); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(TAU, NORM); gsl_linalg_QRPT_decomp(&m_A, &v_TAU, &perm_P, &signum, &v_NORM); return Val_int(signum); } CAMLprim value ml_gsl_linalg_QRPT_decomp2(value A, value Q, value R, value TAU, value P, value NORM) { int signum; GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX3(A, Q, R); _DECLARE_VECTOR2(TAU, NORM); _CONVERT_MATRIX3(A, Q, R); _CONVERT_VECTOR2(TAU, NORM); gsl_linalg_QRPT_decomp2(&m_A, &m_Q, &m_R, &v_TAU, &perm_P, &signum, &v_NORM); return Val_int(signum); } CAMLprim value ml_gsl_linalg_QRPT_decomp2_bc(value *argv, int argc) { return ml_gsl_linalg_QRPT_decomp2(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_linalg_QRPT_solve(value QR, value TAU, value P, value B, value X) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX(QR); _DECLARE_VECTOR3(TAU, B, X); _CONVERT_MATRIX(QR); _CONVERT_VECTOR3(TAU, B, X); gsl_linalg_QRPT_solve(&m_QR, &v_TAU, &perm_P, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_QRPT_svx(value QR, value TAU, value P, value X) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX(QR); _DECLARE_VECTOR2(TAU, X); _CONVERT_MATRIX(QR); _CONVERT_VECTOR2(TAU, X); gsl_linalg_QRPT_svx(&m_QR, &v_TAU, &perm_P, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_QRPT_QRsolve(value Q, value R, value P, value B, value X) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX2(Q, R); _DECLARE_VECTOR2(B, X); _CONVERT_MATRIX2(Q, R); _CONVERT_VECTOR2(B, X); gsl_linalg_QRPT_QRsolve(&m_Q, &m_R, &perm_P, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_QRPT_update(value Q, value R, value P, value U, value V) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX2(Q, R); _DECLARE_VECTOR2(U, V); _CONVERT_MATRIX2(Q, R); _CONVERT_VECTOR2(U, V); gsl_linalg_QRPT_update(&m_Q, &m_R, &perm_P, &v_U, &v_V); return Val_unit; } CAMLprim value ml_gsl_linalg_QRPT_Rsolve(value QR, value P, value B, value X) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX(QR); _DECLARE_VECTOR2(B, X); _CONVERT_MATRIX(QR); _CONVERT_VECTOR2(B, X); gsl_linalg_QRPT_Rsolve(&m_QR, &perm_P, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_QRPT_Rsvx(value QR, value P, value X) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX(QR); _DECLARE_VECTOR(X); _CONVERT_MATRIX(QR); _CONVERT_VECTOR(X); gsl_linalg_QRPT_Rsvx(&m_QR, &perm_P, &v_X); return Val_unit; } /* Singular Value Decomposition */ CAMLprim value ml_gsl_linalg_SV_decomp(value A, value V, value S, value WORK) { _DECLARE_MATRIX2(A, V); _DECLARE_VECTOR2(S, WORK); _CONVERT_MATRIX2(A, V); _CONVERT_VECTOR2(S, WORK); gsl_linalg_SV_decomp(&m_A, &m_V, &v_S, &v_WORK); return Val_unit; } CAMLprim value ml_gsl_linalg_SV_decomp_mod(value A, value X, value V, value S, value WORK) { _DECLARE_MATRIX3(A, V, X); _DECLARE_VECTOR2(S, WORK); _CONVERT_MATRIX3(A, V, X); _CONVERT_VECTOR2(S, WORK); gsl_linalg_SV_decomp_mod(&m_A, &m_X, &m_V, &v_S, &v_WORK); return Val_unit; } CAMLprim value ml_gsl_linalg_SV_decomp_jacobi(value A, value V, value S) { _DECLARE_MATRIX2(A, V); _DECLARE_VECTOR(S); _CONVERT_MATRIX2(A, V); _CONVERT_VECTOR(S); gsl_linalg_SV_decomp_jacobi(&m_A, &m_V, &v_S); return Val_unit; } CAMLprim value ml_gsl_linalg_SV_solve(value U, value V, value S, value B, value X) { _DECLARE_MATRIX2(U, V); _DECLARE_VECTOR3(S, B, X); _CONVERT_MATRIX2(U, V); _CONVERT_VECTOR3(S, B, X); gsl_linalg_SV_solve(&m_U, &m_V, &v_S, &v_B, &v_X); return Val_unit; } /* LQ decomposition */ CAMLprim value ml_gsl_linalg_LQ_decomp(value A, value TAU) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(TAU); _CONVERT_MATRIX(A); _CONVERT_VECTOR(TAU); gsl_linalg_LQ_decomp(&m_A, &v_TAU); return Val_unit; } CAMLprim value ml_gsl_linalg_LQ_solve_T(value LQ, value TAU, value B, value X) { _DECLARE_MATRIX(LQ); _DECLARE_VECTOR3(B,X,TAU); _CONVERT_MATRIX(LQ); _CONVERT_VECTOR3(B,X,TAU); gsl_linalg_LQ_solve_T(&m_LQ, &v_TAU, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_LQ_svx_T(value LQ, value TAU, value X) { _DECLARE_MATRIX(LQ); _DECLARE_VECTOR2(TAU, X); _CONVERT_MATRIX(LQ); _CONVERT_VECTOR2(TAU, X); gsl_linalg_LQ_svx_T(&m_LQ, &v_TAU, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_LQ_lssolve_T(value LQ, value TAU, value B, value X, value RES) { _DECLARE_MATRIX(LQ); _DECLARE_VECTOR4(TAU, RES, B, X); _CONVERT_MATRIX(LQ); _CONVERT_VECTOR4(TAU, RES, B, X); gsl_linalg_LQ_lssolve_T(&m_LQ, &v_TAU, &v_B, &v_X, &v_RES); return Val_unit; } CAMLprim value ml_gsl_linalg_LQ_Lsolve_T(value LQ, value B, value X) { _DECLARE_MATRIX(LQ); _DECLARE_VECTOR2(B,X); _CONVERT_MATRIX(LQ); _CONVERT_VECTOR2(B,X); gsl_linalg_LQ_Lsolve_T(&m_LQ, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_LQ_Lsvx_T(value LQ, value X) { _DECLARE_MATRIX(LQ); _DECLARE_VECTOR(X); _CONVERT_MATRIX(LQ); _CONVERT_VECTOR(X); gsl_linalg_LQ_Lsvx_T(&m_LQ, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_L_solve_T(value L, value B, value X) { _DECLARE_MATRIX(L); _DECLARE_VECTOR2(B,X); _CONVERT_MATRIX(L); _CONVERT_VECTOR2(B,X); gsl_linalg_L_solve_T(&m_L, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_LQ_vecQ(value LQ, value TAU, value V) { _DECLARE_MATRIX(LQ); _DECLARE_VECTOR2(V,TAU); _CONVERT_MATRIX(LQ); _CONVERT_VECTOR2(V,TAU); gsl_linalg_LQ_vecQ(&m_LQ, &v_TAU, &v_V); return Val_unit; } CAMLprim value ml_gsl_linalg_LQ_vecQT(value LQ, value TAU, value V) { _DECLARE_MATRIX(LQ); _DECLARE_VECTOR2(V,TAU); _CONVERT_MATRIX(LQ); _CONVERT_VECTOR2(V,TAU); gsl_linalg_LQ_vecQT(&m_LQ, &v_TAU, &v_V); return Val_unit; } CAMLprim value ml_gsl_linalg_LQ_unpack(value LQ, value TAU, value Q, value L) { _DECLARE_MATRIX3(LQ,Q,L); _DECLARE_VECTOR(TAU); _CONVERT_MATRIX3(LQ,Q,L); _CONVERT_VECTOR(TAU); gsl_linalg_LQ_unpack(&m_LQ, &v_TAU, &m_Q, &m_L); return Val_unit; } CAMLprim value ml_gsl_linalg_LQ_update(value LQ, value R, value V, value W) { _DECLARE_MATRIX2(LQ,R); _DECLARE_VECTOR2(V,W); _CONVERT_MATRIX2(LQ,R); _CONVERT_VECTOR2(V,W); gsl_linalg_LQ_update(&m_LQ, &m_R, &v_V, &v_W); return Val_unit; } CAMLprim value ml_gsl_linalg_LQ_LQsolve(value Q, value L, value B, value X) { _DECLARE_MATRIX2(Q,L); _DECLARE_VECTOR2(B,X); _CONVERT_MATRIX2(Q,L); _CONVERT_VECTOR2(B,X); gsl_linalg_LQ_LQsolve(&m_Q, &m_L, &v_B, &v_X); return Val_unit; } /* P^T L Q decomposition */ CAMLprim value ml_gsl_linalg_PTLQ_decomp (value A, value TAU, value P, value NORM) { int signum; _DECLARE_MATRIX(A); _DECLARE_VECTOR2(TAU,NORM); GSL_PERMUT_OF_BIGARRAY(P); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(TAU,NORM); gsl_linalg_PTLQ_decomp (&m_A, &v_TAU, &perm_P, &signum, &v_NORM); return Val_int (signum); } CAMLprim value ml_gsl_linalg_PTLQ_decomp2 (value A, value Q, value R, value TAU, value P, value NORM) { int signum; _DECLARE_MATRIX3(A,Q,R); _DECLARE_VECTOR2(TAU,NORM); GSL_PERMUT_OF_BIGARRAY(P); _CONVERT_MATRIX3(A,Q,R); _CONVERT_VECTOR2(TAU,NORM); gsl_linalg_PTLQ_decomp2 (&m_A, &m_Q, &m_R, &v_TAU, &perm_P, &signum, &v_NORM); return Val_int (signum); } CAMLprim value ml_gsl_linalg_PTLQ_decomp2_bc (value *argv, int argc) { return ml_gsl_linalg_PTLQ_decomp2 (argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_linalg_PTLQ_solve_T (value QR, value TAU, value P, value B, value X) { _DECLARE_MATRIX(QR); _DECLARE_VECTOR3(TAU,B,X); GSL_PERMUT_OF_BIGARRAY(P); _CONVERT_MATRIX(QR); _CONVERT_VECTOR3(TAU,B,X); gsl_linalg_PTLQ_solve_T (&m_QR, &v_TAU, &perm_P, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_PTLQ_svx_T (value QR, value TAU, value P, value X) { _DECLARE_MATRIX(QR); _DECLARE_VECTOR2(TAU,X); GSL_PERMUT_OF_BIGARRAY(P); _CONVERT_MATRIX(QR); _CONVERT_VECTOR2(TAU,X); gsl_linalg_PTLQ_svx_T (&m_QR, &v_TAU, &perm_P, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_PTLQ_LQsolve_T (value Q, value L, value P, value B, value X) { _DECLARE_MATRIX2(Q,L); _DECLARE_VECTOR2(B,X); GSL_PERMUT_OF_BIGARRAY(P); _CONVERT_MATRIX2(Q,L); _CONVERT_VECTOR2(B,X); gsl_linalg_PTLQ_LQsolve_T (&m_Q, &m_L, &perm_P, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_PTLQ_Lsolve_T (value LQ, value P, value B, value X) { _DECLARE_MATRIX(LQ); _DECLARE_VECTOR2(B,X); GSL_PERMUT_OF_BIGARRAY(P); _CONVERT_MATRIX(LQ); _CONVERT_VECTOR2(B,X); gsl_linalg_PTLQ_Lsolve_T (&m_LQ, &perm_P, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_PTLQ_Lsvx_T (value LQ, value P, value X) { _DECLARE_MATRIX(LQ); _DECLARE_VECTOR(X); GSL_PERMUT_OF_BIGARRAY(P); _CONVERT_MATRIX(LQ); _CONVERT_VECTOR(X); gsl_linalg_PTLQ_Lsvx_T (&m_LQ, &perm_P, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_PTLQ_update (value Q, value L, value P, value V, value W) { _DECLARE_MATRIX2(Q,L); _DECLARE_VECTOR2(V,W); GSL_PERMUT_OF_BIGARRAY(P); _CONVERT_MATRIX2(Q,L); _CONVERT_VECTOR2(V,W); gsl_linalg_PTLQ_update (&m_Q, &m_L, &perm_P, &v_V, &v_W); return Val_unit; } /* Cholesky decomposition */ CAMLprim value ml_gsl_linalg_cholesky_decomp(value A) { _DECLARE_MATRIX(A); _CONVERT_MATRIX(A); gsl_linalg_cholesky_decomp(&m_A); return Val_unit; } CAMLprim value ml_gsl_linalg_cholesky_solve(value CHO, value B, value X) { _DECLARE_MATRIX(CHO); _DECLARE_VECTOR2(B, X); _CONVERT_MATRIX(CHO); _CONVERT_VECTOR2(B, X); gsl_linalg_cholesky_solve(&m_CHO, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_cholesky_svx(value CHO, value X) { _DECLARE_MATRIX(CHO); _DECLARE_VECTOR(X); _CONVERT_MATRIX(CHO); _CONVERT_VECTOR(X); gsl_linalg_cholesky_svx(&m_CHO, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_cholesky_decomp_unit(value CHO, value D) { _DECLARE_MATRIX(CHO); _DECLARE_VECTOR(D); _CONVERT_MATRIX(CHO); _CONVERT_VECTOR(D); gsl_linalg_cholesky_decomp_unit(&m_CHO, &v_D); return Val_unit; } /* Tridiagonal Decomposition of Real Symmetric Matrices */ CAMLprim value ml_gsl_linalg_symmtd_decomp(value A, value TAU) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(TAU); _CONVERT_MATRIX(A); _CONVERT_VECTOR(TAU); gsl_linalg_symmtd_decomp(&m_A, &v_TAU); return Val_unit; } CAMLprim value ml_gsl_linalg_symmtd_unpack(value A, value TAU, value Q, value DIAG, value SUBDIAG) { _DECLARE_MATRIX2(A, Q); _DECLARE_VECTOR3(TAU, DIAG, SUBDIAG); _CONVERT_MATRIX2(A, Q); _CONVERT_VECTOR3(TAU, DIAG, SUBDIAG); gsl_linalg_symmtd_unpack(&m_A, &v_TAU, &m_Q, &v_DIAG, &v_SUBDIAG); return Val_unit; } CAMLprim value ml_gsl_linalg_symmtd_unpack_T(value A, value DIAG, value SUBDIAG) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(DIAG, SUBDIAG); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(DIAG, SUBDIAG); gsl_linalg_symmtd_unpack_T(&m_A, &v_DIAG, &v_SUBDIAG); return Val_unit; } /* Tridiagonal Decomposition of Hermitian Matrices */ /* Bidiagonalization */ CAMLprim value ml_gsl_linalg_bidiag_decomp(value A, value TAU_U, value TAU_V) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(TAU_U, TAU_V); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(TAU_U, TAU_V); gsl_linalg_bidiag_decomp(&m_A, &v_TAU_U, &v_TAU_V); return Val_unit; } CAMLprim value ml_gsl_linalg_bidiag_unpack(value A, value TAU_U, value U, value TAU_V, value V, value DIAG, value SUPERDIAG) { _DECLARE_MATRIX3(A, U, V); _DECLARE_VECTOR4(TAU_U, TAU_V, DIAG, SUPERDIAG); _CONVERT_MATRIX3(A, U, V); _CONVERT_VECTOR4(TAU_U, TAU_V, DIAG, SUPERDIAG); gsl_linalg_bidiag_unpack(&m_A, &v_TAU_U, &m_U, &v_TAU_V, &m_V, &v_DIAG, &v_SUPERDIAG); return Val_unit; } CAMLprim value ml_gsl_linalg_bidiag_unpack_bc(value *argv, int argc) { return ml_gsl_linalg_bidiag_unpack(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_linalg_bidiag_unpack2(value A, value TAU_U, value TAU_V, value V) { _DECLARE_MATRIX2(A, V); _DECLARE_VECTOR2(TAU_U, TAU_V); _CONVERT_MATRIX2(A, V); _CONVERT_VECTOR2(TAU_U, TAU_V); gsl_linalg_bidiag_unpack2(&m_A, &v_TAU_U, &v_TAU_V, &m_V); return Val_unit; } CAMLprim value ml_gsl_linalg_bidiag_unpack_B(value A, value DIAG, value SUPERDIAG) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(DIAG, SUPERDIAG); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(DIAG, SUPERDIAG); gsl_linalg_bidiag_unpack_B(&m_A, &v_DIAG, &v_SUPERDIAG); return Val_unit; } /* Householder solver */ CAMLprim value ml_gsl_linalg_HH_solve(value A, value B, value X) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(B,X); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(B,X); gsl_linalg_HH_solve(&m_A, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_HH_svx(value A, value X) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_linalg_HH_svx(&m_A, &v_X); return Val_unit; } /* Tridiagonal Systems */ CAMLprim value ml_gsl_linalg_solve_symm_tridiag(value DIAG, value E, value B, value X) { _DECLARE_VECTOR4(DIAG, E, B, X); _CONVERT_VECTOR4(DIAG, E, B, X); gsl_linalg_solve_symm_tridiag(&v_DIAG, &v_E, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_solve_tridiag(value DIAG, value ABOVE, value BELOW, value B, value X) { _DECLARE_VECTOR5(DIAG, ABOVE, BELOW, B, X); _CONVERT_VECTOR5(DIAG, ABOVE, BELOW, B, X); gsl_linalg_solve_tridiag(&v_DIAG, &v_ABOVE, &v_BELOW, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_solve_symm_cyc_tridiag(value DIAG, value E, value B, value X) { _DECLARE_VECTOR4(DIAG, E, B, X); _CONVERT_VECTOR4(DIAG, E, B, X); gsl_linalg_solve_symm_cyc_tridiag(&v_DIAG, &v_E, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_solve_cyc_tridiag(value DIAG, value ABOVE, value BELOW, value B, value X) { _DECLARE_VECTOR5(DIAG, ABOVE, BELOW, B, X); _CONVERT_VECTOR5(DIAG, ABOVE, BELOW, B, X); gsl_linalg_solve_cyc_tridiag(&v_DIAG, &v_ABOVE, &v_BELOW, &v_B, &v_X); return Val_unit; } /* exponential */ #define GSL_MODE_val Int_val CAMLprim value ml_gsl_linalg_exponential_ss(value A, value eA, value mode) { _DECLARE_MATRIX2(A, eA); _CONVERT_MATRIX2(A, eA); gsl_linalg_exponential_ss(&m_A, &m_eA, GSL_MODE_val(mode)); return Val_unit; } orpie-1.5.2/gsl/gsl_complex.mli0000644000175000017500000001047412322115103015121 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005, 2003 - Olivier Andrieu, Paul Pelzl *) (* distributed under the terms of the GPL version 2 *) (** Complex arithmetic and simple functions *) type complex = Complex.t = { re : float ; im : float } val complex : re:float -> im:float -> complex type complex_array = float array val set : complex_array -> int -> complex -> unit val get : complex_array -> int -> complex val unpack : complex_array -> complex array val pack : complex array -> complex_array val mult : complex_array -> complex_array -> unit (* added by Paul Pelzl 2003/12/25 *) val rect : float -> float -> complex val polar : float -> float -> complex (** {4 Properties of complex numbers} *) val arg : complex -> float val abs : complex -> float val abs2 : complex -> float external logabs : complex -> float = "ml_gsl_complex_logabs" (** {4 Complex arithmetic operators} *) val add : complex -> complex -> complex val sub : complex -> complex -> complex val mul : complex -> complex -> complex val div : complex -> complex -> complex val add_real : complex -> float -> complex val sub_real : complex -> float -> complex val mul_real : complex -> float -> complex val div_real : complex -> float -> complex val add_imag : complex -> float -> complex val sub_imag : complex -> float -> complex val mul_imag : complex -> float -> complex val div_imag : complex -> float -> complex val conjugate : complex -> complex val inverse : complex -> complex val negative : complex -> complex (** {4 Elementary complex functions} *) external sqrt : complex -> complex = "ml_gsl_complex_sqrt" external sqrt_real : float -> complex = "ml_gsl_complex_sqrt_real" external pow : complex -> complex -> complex = "ml_gsl_complex_pow" external pow_real : complex -> float -> complex = "ml_gsl_complex_pow_real" external exp : complex -> complex = "ml_gsl_complex_exp" external log : complex -> complex = "ml_gsl_complex_log" external log10 : complex -> complex = "ml_gsl_complex_log10" external log_b : complex -> complex -> complex = "ml_gsl_complex_log_b" (** {4 Complex trigonometric functions} *) external sin : complex -> complex = "ml_gsl_complex_sin" external cos : complex -> complex = "ml_gsl_complex_cos" external tan : complex -> complex = "ml_gsl_complex_tan" external sec : complex -> complex = "ml_gsl_complex_sec" external csc : complex -> complex = "ml_gsl_complex_csc" external cot : complex -> complex = "ml_gsl_complex_cot" (** {4 Inverse complex trigonometric functions} *) external arcsin : complex -> complex = "ml_gsl_complex_arcsin" external arcsin_real : float -> complex = "ml_gsl_complex_arcsin_real" external arccos : complex -> complex = "ml_gsl_complex_arccos" external arccos_real : float -> complex = "ml_gsl_complex_arccos_real" external arctan : complex -> complex = "ml_gsl_complex_arctan" external arcsec : complex -> complex = "ml_gsl_complex_arcsec" external arcsec_real : float -> complex = "ml_gsl_complex_arcsec_real" external arccsc : complex -> complex = "ml_gsl_complex_arccsc" external arccsc_real : float -> complex = "ml_gsl_complex_arccsc_real" external arccot : complex -> complex = "ml_gsl_complex_arccot" (** {4 Complex hyperbolic functions} *) external sinh : complex -> complex = "ml_gsl_complex_sinh" external cosh : complex -> complex = "ml_gsl_complex_cosh" external tanh : complex -> complex = "ml_gsl_complex_tanh" external sech : complex -> complex = "ml_gsl_complex_sech" external csch : complex -> complex = "ml_gsl_complex_csch" external coth : complex -> complex = "ml_gsl_complex_coth" (** {4 Inverse complex hyperbolic functions} *) external arcsinh : complex -> complex = "ml_gsl_complex_arcsinh" external arccosh : complex -> complex = "ml_gsl_complex_arccosh" external arccosh_real : float -> complex = "ml_gsl_complex_arccosh_real" external arctanh : complex -> complex = "ml_gsl_complex_arctanh" external arctanh_real : float -> complex = "ml_gsl_complex_arctanh_real" external arcsech : complex -> complex = "ml_gsl_complex_arcsech" external arccsch : complex -> complex = "ml_gsl_complex_arccsch" external arccoth : complex -> complex = "ml_gsl_complex_arccoth" orpie-1.5.2/gsl/gsl_math.mli0000644000175000017500000000314112322115103014374 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Mathematical constants and some simple functions *) (** {3 Constants} *) val e : float (** e *) val log2e : float (** log_2 (e) *) val log10e : float (** log_10 (e) *) val sqrt2 : float (** sqrt(2) *) val sqrt1_2 : float (** sqrt(1/2) *) val sqrt3 : float (** sqrt(3) *) val pi : float (** pi *) val pi_2 : float (** pi/2 *) val pi_4 : float (** pi/4 *) val sqrtpi : float (** sqrt(pi) *) val i_2_sqrtpi : float (** 2/sqrt(pi) *) val i_1_pi : float (** 1/pi *) val i_2_pi : float (** 2/pi *) val ln10 : float (** ln(10) *) val ln2 : float (** ln(2) *) val lnpi : float (** ln(pi) *) val euler : float (** Euler constant *) (** {3 Simple Functions} *) val pow_int : float -> int -> float external log1p : float -> float = "ml_gsl_log1p" "gsl_log1p" "float" external expm1 : float -> float = "ml_gsl_expm1" "gsl_expm1" "float" external hypot : float -> float -> float = "ml_gsl_hypot" "gsl_hypot" "float" external acosh : float -> float = "ml_gsl_acosh" "gsl_acosh" "float" external asinh : float -> float = "ml_gsl_asinh" "gsl_asinh" "float" external atanh : float -> float = "ml_gsl_atanh" "gsl_atanh" "float" external fcmp : float -> float -> epsilon:float -> int = "ml_gsl_fcmp" orpie-1.5.2/gsl/mlgsl_matrix_complex.c0000644000175000017500000000007612322115103016474 0ustar paulpaul #include "mlgsl_matrix_complex.h" #include "mlgsl_matrix.c" orpie-1.5.2/gsl/mlgsl_vector_float.h0000644000175000017500000000025712322115103016136 0ustar paulpaul#include "wrappers.h" #define BASE_TYPE float #undef CONV_FLAT #define TYPE(t) CONCAT2(t,BASE_TYPE) #define FUNCTION(a,b) CONCAT3(a,BASE_TYPE,b) #include "mlgsl_vector.h" orpie-1.5.2/gsl/mlgsl_error.c0000644000175000017500000000305712322115103014574 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include #include #include #include #include CAMLprim value ml_gsl_version(value unit) { return copy_string(gsl_version); } CAMLprim value ml_gsl_strerror(value ml_errno) { int c_errno = Int_val(ml_errno); int gsl_errno = (c_errno <= 1) ? (c_errno - 2) : (c_errno - 1) ; return copy_string(gsl_strerror(gsl_errno)); } static inline int conv_err_code(int gsl_errno) { if(gsl_errno < 0) return gsl_errno + 2 ; else return gsl_errno + 1 ; } static value *ml_gsl_exn; static void ml_gsl_raise_exn(const char *msg, int gsl_errno) { CAMLlocal2(exn_msg, exn_arg); exn_msg = copy_string(msg); exn_arg = alloc_small(2, 0); Field(exn_arg, 0) = Val_int(conv_err_code(gsl_errno)); Field(exn_arg, 1) = exn_msg; if(ml_gsl_exn != NULL) raise_with_arg(*ml_gsl_exn, exn_arg); else failwith("GSL error"); } static void ml_gsl_error_handler(const char *reason, const char *file, int line, int gsl_errno) { ml_gsl_raise_exn(reason, gsl_errno); } CAMLprim value ml_gsl_error_init(value init) { static gsl_error_handler_t *old; if(ml_gsl_exn == NULL) ml_gsl_exn = caml_named_value("mlgsl_exn"); if(Bool_val(init)) old = gsl_set_error_handler(&ml_gsl_error_handler); else gsl_set_error_handler(old); return Val_unit; } orpie-1.5.2/gsl/mlgsl_complex.c0000644000175000017500000000443412322115103015112 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2003 - Paul Pelzl */ /* distributed under the terms of the GPL version 2 */ #include #include #include "mlgsl_complex.h" #define _COMPLEX_HANDLER(funct) \ CAMLprim value ml_gsl_complex_##funct(value Z) { \ _DECLARE_COMPLEX2(Z,temp); \ _CONVERT_COMPLEX(Z); \ z_temp = gsl_complex_##funct(z_Z); \ return copy_complex(&z_temp); \ } #define _COMPLEX_HANDLER2(funct) \ CAMLprim value ml_gsl_complex_##funct(value Z, value A) { \ _DECLARE_COMPLEX3(Z, A, temp); \ _CONVERT_COMPLEX2(Z, A); \ z_temp = gsl_complex_##funct(z_Z, z_A); \ return copy_complex(&z_temp); \ } #define _COMPLEX_HANDLER_DOUBLE(funct) \ CAMLprim value ml_gsl_complex_##funct(value X) { \ gsl_complex temp; \ temp = gsl_complex_##funct(Double_val(X)); \ return copy_complex(&temp); \ } /* properties of complex numbers */ CAMLprim value ml_gsl_complex_logabs(value Z) { _DECLARE_COMPLEX(Z); _CONVERT_COMPLEX(Z); return copy_double(gsl_complex_logabs(z_Z)); } _COMPLEX_HANDLER(sqrt) _COMPLEX_HANDLER_DOUBLE(sqrt_real) _COMPLEX_HANDLER2(pow) CAMLprim value ml_gsl_complex_pow_real(value Z, value X) { _DECLARE_COMPLEX2(Z, temp); _CONVERT_COMPLEX(Z); z_temp = gsl_complex_pow_real(z_Z, Double_val(X)); return copy_complex(&z_temp); } _COMPLEX_HANDLER(exp) _COMPLEX_HANDLER(log) _COMPLEX_HANDLER(log10) _COMPLEX_HANDLER2(log_b) _COMPLEX_HANDLER(sin) _COMPLEX_HANDLER(cos) _COMPLEX_HANDLER(tan) _COMPLEX_HANDLER(sec) _COMPLEX_HANDLER(csc) _COMPLEX_HANDLER(cot) _COMPLEX_HANDLER(arcsin) _COMPLEX_HANDLER_DOUBLE(arcsin_real) _COMPLEX_HANDLER(arccos) _COMPLEX_HANDLER_DOUBLE(arccos_real) _COMPLEX_HANDLER(arctan) _COMPLEX_HANDLER(arcsec) _COMPLEX_HANDLER_DOUBLE(arcsec_real) _COMPLEX_HANDLER(arccsc) _COMPLEX_HANDLER_DOUBLE(arccsc_real) _COMPLEX_HANDLER(arccot) _COMPLEX_HANDLER(sinh) _COMPLEX_HANDLER(cosh) _COMPLEX_HANDLER(tanh) _COMPLEX_HANDLER(sech) _COMPLEX_HANDLER(csch) _COMPLEX_HANDLER(coth) _COMPLEX_HANDLER(arcsinh) _COMPLEX_HANDLER(arccosh) _COMPLEX_HANDLER_DOUBLE(arccosh_real) _COMPLEX_HANDLER(arctanh) _COMPLEX_HANDLER_DOUBLE(arctanh_real) _COMPLEX_HANDLER(arcsech) _COMPLEX_HANDLER(arccsch) _COMPLEX_HANDLER(arccoth) orpie-1.5.2/gsl/mlgsl_math.c0000644000175000017500000000110212322115103014361 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include #include "wrappers.h" ML1(gsl_log1p, Double_val, copy_double) ML1(gsl_expm1, Double_val, copy_double) ML2(gsl_hypot, Double_val, Double_val, copy_double) ML1(gsl_acosh, Double_val, copy_double) ML1(gsl_asinh, Double_val, copy_double) ML1(gsl_atanh, Double_val, copy_double) ML3(gsl_fcmp, Double_val, Double_val, Double_val, Val_int) orpie-1.5.2/gsl/mlgsl_vector_float.c0000644000175000017500000000007412322115103016126 0ustar paulpaul #include "mlgsl_vector_float.h" #include "mlgsl_vector.c" orpie-1.5.2/gsl/mlgsl_fun.h0000644000175000017500000000435212322115103014237 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include #include #include #include #include #include struct callback_params { value closure ; /* the closure(s) for the caml callback */ value dbl; /* a preallocated caml float array for monte callbacks */ union { gsl_function gf; gsl_function_fdf gfdf; gsl_monte_function mf; gsl_multiroot_function mrf; gsl_multiroot_function_fdf mrfdf; gsl_multimin_function mmf; gsl_multimin_function_fdf mmfdf; gsl_multifit_function_fdf mffdf; } gslfun ; }; extern double gslfun_callback(double, void *); extern double gslfun_callback_indir(double, void *); extern double gslfun_callback_f(double, void *); extern double gslfun_callback_df(double, void *); extern void gslfun_callback_fdf(double, void *, double *, double*); extern double gsl_monte_callback(double *, size_t , void *); extern double gsl_monte_callback_fast(double *, size_t , void *); extern int gsl_multiroot_callback(const gsl_vector *, void *, gsl_vector *); extern int gsl_multiroot_callback_f(const gsl_vector *, void *, gsl_vector *); extern int gsl_multiroot_callback_df(const gsl_vector *, void *, gsl_matrix *); extern int gsl_multiroot_callback_fdf(const gsl_vector *, void *, gsl_vector *, gsl_matrix *); extern double gsl_multimin_callback(const gsl_vector *, void *); extern double gsl_multimin_callback_f(const gsl_vector *, void *); extern void gsl_multimin_callback_df(const gsl_vector *, void *, gsl_vector *); extern void gsl_multimin_callback_fdf(const gsl_vector *, void *, double *, gsl_vector *); extern int gsl_multifit_callback_f(const gsl_vector *, void *, gsl_vector *); extern int gsl_multifit_callback_df(const gsl_vector *, void *, gsl_matrix *); extern int gsl_multifit_callback_fdf(const gsl_vector *, void *, gsl_vector *, gsl_matrix *); #define GSLFUN_CLOSURE(gf,v) \ gsl_function gf = { \ /*.function =*/ &gslfun_callback_indir, \ /*.params =*/ &v } orpie-1.5.2/gsl/gsl_vector_flat.ml0000644000175000017500000000522412322115103015606 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) type double_vector_flat = { data : float array ; off : int ; len : int ; stride : int ; } type vector = double_vector_flat let check v = let size = Array.length v.data in if v.off < 0 || v.len < 0 || v.stride < 1 || v.off + (v.len - 1) * v.stride >= size then failwith "Gsl_vector_flat.check" ; v let create ?(init=0.) len = { data = Array.create len init; off = 0; len = len; stride = 1; } let of_array arr = { data = Array.copy arr; off = 0; len = Array.length arr; stride = 1; } let length { len = len } = len let get v i = v.data.(v.off + i*v.stride) let set v i d = v.data.(v.off + i*v.stride) <- d let set_all v d = for i=0 to pred v.len do set v i d done let set_zero v = set_all v 0. let set_basis v i = set_zero v ; set v i 1. let to_array v = Array.init v.len (get v) let subvector ?(stride=1) v ~off ~len = check { v with off = off * v.stride + v.off ; len = len ; stride = stride * v.stride ; } let view_array ?(stride=1) ?(off=0) ?len arr = let len = match len with | None -> Array.length arr | Some l -> l in check { data = arr ; off = off ; stride = stride ; len = len } let memcpy ~src:v ~dst:w = if v.len <> w.len then invalid_arg "Gsl_vector.memcpy" ; for i=0 to pred v.len do set w i (get v i) done let copy v = { v with data = Array.copy v.data } let swap_element v i j = let d = get v i in let d' = get v j in set v j d ; set v i d' let reverse v = for i=0 to pred (v.len/2) do swap_element v i (pred v.len - i) done external add : vector -> vector -> unit = "ml_gsl_vector_add" external sub : vector -> vector -> unit = "ml_gsl_vector_sub" external mul : vector -> vector -> unit = "ml_gsl_vector_mul" external div : vector -> vector -> unit = "ml_gsl_vector_div" external scale : vector -> float -> unit = "ml_gsl_vector_scale" external add_constant : vector -> float -> unit = "ml_gsl_vector_add_constant" external is_null : vector -> bool = "ml_gsl_vector_isnull" external max : vector -> float = "ml_gsl_vector_max" external min : vector -> float = "ml_gsl_vector_min" external minmax : vector -> float * float = "ml_gsl_vector_minmax" external max_index : vector -> int = "ml_gsl_vector_maxindex" external min_index : vector -> int = "ml_gsl_vector_minindex" external minmax_index : vector -> int * int = "ml_gsl_vector_minmaxindex" orpie-1.5.2/gsl/wrappers.h0000644000175000017500000000577312322115103014124 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #ifndef _MLGSL_WRAPPERS_ #define _MLGSL_WRAPPERS_ #include #include #include #ifdef ARCH_ALIGN_DOUBLE #error "Architectures with double-word alignment for doubles are not supported" #endif #define IS_CUSTOM(v) (Tag_val(v) == Custom_tag) #define Unoption(v) (Field((v), 0)) #define Opt_arg(v, conv, def) (Is_block(v) ? conv(Field((v),0)) : (def)) #define Val_none Val_int(0) #define Val_negbool(x) Val_not(Val_bool(x)) #define Array_length(v) (Wosize_val(v)) #define Double_array_length(v) (Wosize_val(v) / Double_wosize) #define Double_array_val(v) ((double *)v) #define Unit(v) ((v), Val_unit) static inline value copy_two_double(double a, double b) { CAMLparam0(); CAMLlocal3(r, va, vb); va = copy_double(a); vb = copy_double(b); r = alloc_small(2, 0); Field(r, 0) = va; Field(r, 1) = vb; CAMLreturn(r); } static inline value copy_two_double_arr(double a, double b) { value r; r=alloc_small(2 * Double_wosize, Double_array_tag); Store_double_field(r, 0, a); Store_double_field(r, 1, b); return r; } #define Abstract_ptr(v, p) \ ( v=alloc_small(1, Abstract_tag), Field(v, 0)=Val_bp(p) ) #define ML1(name, conv1, convr) \ CAMLprim value ml_##name(value arg1) \ { CAMLparam1(arg1); \ CAMLreturn(convr(name(conv1(arg1)))) ; } #define ML1_alloc(name, conv1, convr) \ CAMLprim value ml_##name(value arg1) \ { CAMLparam1(arg1); CAMLlocal1(res); \ convr(res, name(conv1(arg1))); \ CAMLreturn(res); } #define ML2(name, conv1, conv2, convr) \ CAMLprim value ml_##name(value arg1, value arg2) \ { CAMLparam2(arg1, arg2); \ CAMLreturn(convr(name(conv1(arg1), conv2(arg2)))) ; } #define ML3(name, conv1, conv2, conv3, convr) \ CAMLprim value ml_##name(value arg1, value arg2, value arg3) \ { CAMLparam3(arg1, arg2, arg3); \ CAMLreturn(convr(name(conv1(arg1), conv2(arg2), conv3(arg3)))) ; } #define ML4(name, conv1, conv2, conv3, conv4, convr) \ CAMLprim value ml_##name(value arg1, value arg2, value arg3, value arg4) \ { CAMLparam4(arg1, arg2, arg3, arg4); \ CAMLreturn(convr(name(conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4)))) ; } #define ML5(name, conv1, conv2, conv3, conv4, conv5, convr) \ CAMLprim value ml_##name(value arg1, value arg2, value arg3, value arg4, value arg5) \ { CAMLparam5(arg1, arg2, arg3, arg4, arg5); \ CAMLreturn(convr(name(conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4), conv5(arg5)))) ; } #define CONCAT2x(a,b) a ## _ ## b #define CONCAT2(a,b) CONCAT2x(a,b) #define CONCAT3x(a,b,c) a ## _ ## b ## _ ## c #define CONCAT3(a,b,c) CONCAT3x(a,b,c) #if defined (__GNUC__) || defined (DONT_USE_ALLOCA) #define LOCALARRAY(type, x, len) type x [(len)] #else #include #define LOCALARRAY(type, x, len) type * x = ( type *) alloca(sizeof( type ) * (len)) #endif #endif /* _MLGSL_WRAPPERS_ */ orpie-1.5.2/gsl/gsl_matrix_flat.mli0000644000175000017500000000451212322115103015760 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Matrices of floats implemented with [float array] *) type double_mat_flat = private { data : float array ; off : int ; dim1 : int ; dim2 : int ; tda : int ; } type matrix = double_mat_flat val create : ?init:float -> int -> int -> matrix val dims : matrix -> int * int val of_array : float array -> int -> int -> matrix val of_arrays : float array array -> matrix val to_array : matrix -> float array val to_arrays : matrix -> float array array val to_array : matrix -> float array val get : matrix -> int -> int -> float val set : matrix -> int -> int -> float -> unit val set_all : matrix -> float -> unit val set_zero : matrix -> unit val set_id : matrix -> unit val memcpy : src:matrix -> dst:matrix -> unit val copy : matrix -> matrix external add : matrix -> matrix -> unit = "ml_gsl_matrix_add" external sub : matrix -> matrix -> unit = "ml_gsl_matrix_sub" external mul_elements : matrix -> matrix -> unit = "ml_gsl_matrix_mul" external div_elements : matrix -> matrix -> unit = "ml_gsl_matrix_div" external scale : matrix -> float -> unit = "ml_gsl_matrix_scale" external add_constant : matrix -> float -> unit = "ml_gsl_matrix_add_constant" external add_diagonal : matrix -> float -> unit = "ml_gsl_matrix_add_diagonal" external is_null : matrix -> bool = "ml_gsl_matrix_isnull" external swap_rows : matrix -> int -> int -> unit = "ml_gsl_matrix_swap_rows" external swap_columns : matrix -> int -> int -> unit = "ml_gsl_matrix_swap_columns" external swap_rowcol : matrix -> int -> int -> unit = "ml_gsl_matrix_swap_rowcol" external transpose : matrix -> matrix -> unit = "ml_gsl_matrix_transpose_memcpy" external transpose_in_place : matrix -> unit = "ml_gsl_matrix_transpose" open Gsl_vector_flat val submatrix : matrix -> k1:int -> k2:int -> n1:int -> n2:int -> matrix val row : matrix -> int -> vector val column : matrix -> int -> vector val diagonal : matrix -> vector val subdiagonal : matrix -> int -> vector val superdiagonal : matrix -> int -> vector val view_array : float array -> ?off:int -> int -> ?tda:int -> int -> matrix val view_vector : vector -> ?off:int -> int -> ?tda:int -> int -> matrix orpie-1.5.2/gsl/gsl_matrix.ml0000644000175000017500000001173612322115103014607 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) open Bigarray type double_mat_bigarr = (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array2.t type matrix = double_mat_bigarr let create ?init dimx dimy = let barr = Array2.create float64 c_layout dimx dimy in begin match init with | None -> () | Some x -> Array2.fill barr x end ; barr let dims mat = (Array2.dim1 mat, Array2.dim2 mat) let of_array arr dim1 dim2 = let mat = create dim1 dim2 in for i=0 to pred dim1 do for j=0 to pred dim2 do mat.{i,j} <- arr.(dim2*i+j) done done ; mat let of_arrays arr = Array2.of_array float64 c_layout arr let to_array (mat : matrix) = let d1 = Array2.dim1 mat in let d2 = Array2.dim2 mat in Array.init (d1*d2) (fun i -> mat.{i/d2, i mod d2}) let to_arrays (mat : matrix) = let d1 = Array2.dim1 mat in let d2 = Array2.dim2 mat in let a = Array.init d1 (fun _ -> Array.make d2 0.) in for i=0 to pred d1 do for j=0 to pred d2 do a.(i).(j) <- mat.{i,j} done done ; a let get (m : matrix) i j = Array2.get m i j let set (m : matrix) i j x = Array2.set m i j x let set_all = Array2.fill let set_zero m = set_all m 0. let set_id m = set_zero m ; for i=0 to pred (min (Array2.dim1 m) (Array2.dim2 m)) do set m i i 1. done let memcpy ~src ~dst = Array2.blit src dst let copy m = let m' = create (Array2.dim1 m) (Array2.dim2 m) in Array2.blit m m' ; m' external add : matrix -> matrix -> unit = "ml_gsl_matrix_add" external sub : matrix -> matrix -> unit = "ml_gsl_matrix_sub" external mul_elements : matrix -> matrix -> unit = "ml_gsl_matrix_mul" external div_elements : matrix -> matrix -> unit = "ml_gsl_matrix_div" external scale : matrix -> float -> unit = "ml_gsl_matrix_scale" external add_constant : matrix -> float -> unit = "ml_gsl_matrix_add_constant" external add_diagonal : matrix -> float -> unit = "ml_gsl_matrix_add_diagonal" external is_null : matrix -> bool = "ml_gsl_matrix_isnull" external swap_rows : matrix -> int -> int -> unit = "ml_gsl_matrix_swap_rows" external swap_columns : matrix -> int -> int -> unit = "ml_gsl_matrix_swap_columns" external swap_rowcol : matrix -> int -> int -> unit = "ml_gsl_matrix_swap_rowcol" external transpose : matrix -> matrix -> unit = "ml_gsl_matrix_transpose_memcpy" external transpose_in_place : matrix -> unit = "ml_gsl_matrix_transpose" let row = Array2.slice_left module Single = struct type float_mat_bigarr = (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array2.t type matrix = float_mat_bigarr let create ?init dimx dimy = let barr = Array2.create float32 c_layout dimx dimy in begin match init with | None -> () | Some x -> Array2.fill barr x end ; barr let dims = dims let of_array arr dim1 dim2 = let mat = create dim1 dim2 in for i=0 to pred dim1 do for j=0 to pred dim2 do mat.{i,j} <- arr.(dim2*i+j) done done ; mat let of_arrays arr = Array2.of_array float32 c_layout arr let to_array (mat : matrix) = let d1 = Array2.dim1 mat in let d2 = Array2.dim2 mat in Array.init (d1*d2) (fun i -> mat.{i/d2, i mod d2}) let to_arrays (mat : matrix) = let d1 = Array2.dim1 mat in let d2 = Array2.dim2 mat in let a = Array.init d1 (fun _ -> Array.make d2 0.) in for i=0 to pred d1 do for j=0 to pred d2 do a.(i).(j) <- mat.{i,j} done done ; a let get (m : matrix) i j = Array2.get m i j let set (m : matrix) i j x = Array2.set m i j x let set_all = set_all let set_zero = set_zero let set_id m = set_zero m ; for i=0 to pred (min (Array2.dim1 m) (Array2.dim2 m)) do set m i i 1. done let memcpy = memcpy let copy m = let m' = create (Array2.dim1 m) (Array2.dim2 m) in Array2.blit m m' ; m' let row = row external add : matrix -> matrix -> unit = "ml_gsl_matrix_float_add" external sub : matrix -> matrix -> unit = "ml_gsl_matrix_float_sub" external mul_elements : matrix -> matrix -> unit = "ml_gsl_matrix_float_mul" external div_elements : matrix -> matrix -> unit = "ml_gsl_matrix_float_div" external scale : matrix -> float -> unit = "ml_gsl_matrix_float_scale" external add_constant : matrix -> float -> unit = "ml_gsl_matrix_float_add_constant" external add_diagonal : matrix -> float -> unit = "ml_gsl_matrix_float_add_diagonal" external is_null : matrix -> bool = "ml_gsl_matrix_float_isnull" external swap_rows : matrix -> int -> int -> unit = "ml_gsl_matrix_float_swap_rows" external swap_columns : matrix -> int -> int -> unit = "ml_gsl_matrix_float_swap_columns" external swap_rowcol : matrix -> int -> int -> unit = "ml_gsl_matrix_float_swap_rowcol" external transpose : matrix -> matrix -> unit = "ml_gsl_matrix_float_transpose_memcpy" external transpose_in_place : matrix -> unit = "ml_gsl_matrix_float_transpose" end orpie-1.5.2/gsl/mlgsl_blas.c0000644000175000017500000001577412322115103014375 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include "mlgsl_vector_double.h" #include "mlgsl_matrix_double.h" #include "mlgsl_blas.h" /* LEVEL1 double */ CAMLprim value ml_gsl_blas_ddot(value X, value Y) { double r; _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_ddot(&v_X, &v_Y, &r); return copy_double(r); } CAMLprim value ml_gsl_blas_dnrm2(value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); return copy_double(gsl_blas_dnrm2(&v_X)); } CAMLprim value ml_gsl_blas_dasum(value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); return copy_double(gsl_blas_dasum(&v_X)); } CAMLprim value ml_gsl_blas_idamax(value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); return Val_int(gsl_blas_idamax(&v_X)); } CAMLprim value ml_gsl_blas_dswap(value X, value Y) { _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_dswap(&v_X, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_dcopy(value X, value Y) { _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_dcopy(&v_X, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_daxpy(value alpha, value X, value Y) { _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_daxpy(Double_val(alpha), &v_X, &v_Y); return Val_unit; } /* FIXME: drotg drotmg drotm */ CAMLprim value ml_gsl_blas_drot(value X, value Y, value c, value s) { _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_drot(&v_X, &v_Y, Double_val(c), Double_val(s)); return Val_unit; } CAMLprim value ml_gsl_blas_dscal(value alpha, value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); gsl_blas_dscal(Double_val(alpha), &v_X); return Val_unit; } /* LEVEL2 double */ CAMLprim value ml_gsl_blas_dgemv(value transa, value alpha, value A, value X, value beta, value Y) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X, Y); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X, Y); gsl_blas_dgemv(CBLAS_TRANS_val(transa), Double_val(alpha), &m_A, &v_X, Double_val(beta), &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_dgemv_bc(value *argv, int argc) { return ml_gsl_blas_dgemv(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_dtrmv(value uplo, value transa, value diag, value A, value X) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_blas_dtrmv(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), &m_A, &v_X); return Val_unit; } CAMLprim value ml_gsl_blas_dtrsv(value uplo, value transa, value diag, value A, value X) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_blas_dtrsv(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), &m_A, &v_X); return Val_unit; } CAMLprim value ml_gsl_blas_dsymv(value uplo, value alpha, value A, value X, value beta, value Y) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X, Y); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X, Y); gsl_blas_dsymv(CBLAS_UPLO_val(uplo), Double_val(alpha), &m_A, &v_X, Double_val(beta), &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_dsymv_bc(value *argv, int argc) { return ml_gsl_blas_dsymv(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_dger(value alpha, value X, value Y, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X, Y); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X, Y); gsl_blas_dger(Double_val(alpha), &v_X, &v_Y, &m_A); return Val_unit; } CAMLprim value ml_gsl_blas_dsyr(value uplo ,value alpha, value X, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_blas_dsyr(CBLAS_UPLO_val(uplo), Double_val(alpha), &v_X, &m_A); return Val_unit; } CAMLprim value ml_gsl_blas_dsyr2(value uplo ,value alpha, value X, value Y, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X, Y); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X, Y); gsl_blas_dsyr2(CBLAS_UPLO_val(uplo), Double_val(alpha), &v_X, &v_Y, &m_A); return Val_unit; } /* LEVEL3 double */ CAMLprim value ml_gsl_blas_dgemm(value transa, value transb, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _CONVERT_MATRIX3(A, B, C); gsl_blas_dgemm(CBLAS_TRANS_val(transa), CBLAS_TRANS_val(transb), Double_val(alpha), &m_A, &m_B, Double_val(beta), &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_dgemm_bc(value *argv, int argc) { return ml_gsl_blas_dgemm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_dsymm(value side, value uplo, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _CONVERT_MATRIX3(A, B, C); gsl_blas_dsymm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), Double_val(alpha), &m_A, &m_B, Double_val(beta), &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_dsymm_bc(value *argv, int argc) { return ml_gsl_blas_dsymm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_dtrmm(value side, value uplo, value transa, value diag, value alpha, value A, value B) { _DECLARE_MATRIX2(A, B); _CONVERT_MATRIX2(A, B); gsl_blas_dtrmm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), Double_val(alpha), &m_A, &m_B); return Val_unit; } CAMLprim value ml_gsl_blas_dtrmm_bc(value *argv, int argc) { return ml_gsl_blas_dtrmm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_dtrsm(value side, value uplo, value transa, value diag, value alpha, value A, value B) { _DECLARE_MATRIX2(A, B); _CONVERT_MATRIX2(A, B); gsl_blas_dtrsm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), Double_val(alpha), &m_A, &m_B); return Val_unit; } CAMLprim value ml_gsl_blas_dtrsm_bc(value *argv, int argc) { return ml_gsl_blas_dtrsm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_dsyrk(value uplo, value trans, value alpha, value A, value beta, value C) { _DECLARE_MATRIX2(A, C); _CONVERT_MATRIX2(A, C); gsl_blas_dsyrk(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(trans), Double_val(alpha), &m_A, Double_val(beta), &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_dsyrk_bc(value *argv, int argc) { return ml_gsl_blas_dsyrk(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_dsyr2k(value uplo, value trans, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _CONVERT_MATRIX3(A, B, C); gsl_blas_dsyr2k(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(trans), Double_val(alpha), &m_A, &m_B, Double_val(beta), &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_dsyr2k_bc(value *argv, int argc) { return ml_gsl_blas_dsyr2k(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } orpie-1.5.2/gsl/mlgsl_blas_complex_float.c0000644000175000017500000002303112322115103017272 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #define FLOAT_COMPLEX #include "mlgsl_complex.h" #include "mlgsl_vector_complex_float.h" #include "mlgsl_matrix_complex_float.h" #include "mlgsl_blas.h" /* LEVEL1 complex float */ CAMLprim value ml_gsl_blas_cdotu(value X, value Y) { gsl_complex_float r; _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_cdotu(&v_X, &v_Y, &r); return copy_complex(&r); } CAMLprim value ml_gsl_blas_cdotc(value X, value Y) { gsl_complex_float r; _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_cdotc(&v_X, &v_Y, &r); return copy_complex(&r); } CAMLprim value ml_gsl_blas_scnrm2(value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); return copy_double(gsl_blas_scnrm2(&v_X)); } CAMLprim value ml_gsl_blas_scasum(value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); return copy_double(gsl_blas_scasum(&v_X)); } CAMLprim value ml_gsl_blas_icamax(value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); return Val_int(gsl_blas_icamax(&v_X)); } CAMLprim value ml_gsl_blas_cswap(value X, value Y) { _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_cswap(&v_X, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_ccopy(value X, value Y) { _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_ccopy(&v_X, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_caxpy(value alpha, value X, value Y) { _DECLARE_VECTOR2(X, Y); _DECLARE_COMPLEX(alpha); _CONVERT_VECTOR2(X, Y); _CONVERT_COMPLEX(alpha); gsl_blas_caxpy(z_alpha, &v_X, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_cscal(value alpha, value X) { _DECLARE_VECTOR(X); _DECLARE_COMPLEX(alpha); _CONVERT_VECTOR(X); _CONVERT_COMPLEX(alpha); gsl_blas_cscal(z_alpha, &v_X); return Val_unit; } CAMLprim value ml_gsl_blas_csscal(value alpha, value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); gsl_blas_csscal(Double_val(alpha), &v_X); return Val_unit; } /* LEVEL2 complex float */ CAMLprim value ml_gsl_blas_cgemv(value transa, value alpha, value A, value X, value beta, value Y) { _DECLARE_MATRIX(A); _DECLARE_COMPLEX2(alpha, beta); _DECLARE_VECTOR2(X, Y); _CONVERT_MATRIX(A); _CONVERT_COMPLEX2(alpha, beta); _CONVERT_VECTOR2(X, Y); gsl_blas_cgemv(CBLAS_TRANS_val(transa), z_alpha, &m_A, &v_X, z_beta, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_cgemv_bc(value *argv, int argc) { return ml_gsl_blas_cgemv(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_ctrmv(value uplo, value transa, value diag, value A, value X) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_blas_ctrmv(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), &m_A, &v_X); return Val_unit; } CAMLprim value ml_gsl_blas_ctrsv(value uplo, value transa, value diag, value A, value X) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_blas_ctrsv(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), &m_A, &v_X); return Val_unit; } CAMLprim value ml_gsl_blas_chemv(value uplo, value alpha, value A, value X, value beta, value Y) { _DECLARE_MATRIX(A); _DECLARE_COMPLEX2(alpha, beta); _DECLARE_VECTOR2(X,Y); _CONVERT_MATRIX(A); _CONVERT_COMPLEX2(alpha, beta); _CONVERT_VECTOR2(X,Y); gsl_blas_chemv(CBLAS_UPLO_val(uplo), z_alpha, &m_A, &v_X, z_beta, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_chemv_bc(value *argv, int argc) { return ml_gsl_blas_chemv(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_cgeru(value alpha, value X, value Y, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X,Y); _DECLARE_COMPLEX(alpha); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X,Y); _CONVERT_COMPLEX(alpha); gsl_blas_cgeru(z_alpha, &v_X, &v_Y, &m_A); return Val_unit; } CAMLprim value ml_gsl_blas_cgerc(value alpha, value X, value Y, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X,Y); _DECLARE_COMPLEX(alpha); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X,Y); _CONVERT_COMPLEX(alpha); gsl_blas_cgerc(z_alpha, &v_X, &v_Y, &m_A); return Val_unit; } CAMLprim value ml_gsl_blas_cher(value uplo, value alpha, value X, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_blas_cher(CBLAS_UPLO_val(uplo), Double_val(alpha), &v_X, &m_A); return Val_unit; } CAMLprim value ml_gsl_blas_cher2(value uplo, value alpha, value X, value Y, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X,Y); _DECLARE_COMPLEX(alpha); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X,Y); _CONVERT_COMPLEX(alpha); gsl_blas_cher2(CBLAS_UPLO_val(uplo), z_alpha, &v_X, &v_Y, &m_A); return Val_unit; } /* LEVEL3 complex float */ CAMLprim value ml_gsl_blas_cgemm(value transa, value transb, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _DECLARE_COMPLEX2(alpha, beta); _CONVERT_MATRIX3(A, B, C); _CONVERT_COMPLEX2(alpha, beta); gsl_blas_cgemm(CBLAS_TRANS_val(transa), CBLAS_TRANS_val(transb), z_alpha, &m_A, &m_B, z_beta, &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_cgemm_bc(value *argv, int argc) { return ml_gsl_blas_cgemm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_csymm(value side, value uplo, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _DECLARE_COMPLEX2(alpha, beta); _CONVERT_MATRIX3(A, B, C); _CONVERT_COMPLEX2(alpha, beta); gsl_blas_csymm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), z_alpha, &m_A, &m_B, z_beta, &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_csymm_bc(value *argv, int argc) { return ml_gsl_blas_csymm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_csyrk(value uplo, value trans, value alpha, value A, value beta, value C) { _DECLARE_MATRIX2(A, C); _DECLARE_COMPLEX2(alpha, beta); _CONVERT_MATRIX2(A, C); _CONVERT_COMPLEX2(alpha, beta); gsl_blas_csyrk(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(trans), z_alpha, &m_A, z_beta, &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_csyrk_bc(value *argv, int argc) { return ml_gsl_blas_csyrk(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_csyr2k(value uplo, value trans, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _DECLARE_COMPLEX2(alpha, beta); _CONVERT_MATRIX3(A, B, C); _CONVERT_COMPLEX2(alpha, beta); gsl_blas_csyr2k(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(trans), z_alpha, &m_A, &m_B, z_beta, &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_csyr2k_bc(value *argv, int argc) { return ml_gsl_blas_csyr2k(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_ctrmm(value side, value uplo, value transa, value diag, value alpha, value A, value B) { _DECLARE_MATRIX2(A, B); _DECLARE_COMPLEX(alpha); _CONVERT_MATRIX2(A, B); _CONVERT_COMPLEX(alpha); gsl_blas_ctrmm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), z_alpha, &m_A, &m_B); return Val_unit; } CAMLprim value ml_gsl_blas_ctrmm_bc(value *argv, int argc) { return ml_gsl_blas_ctrmm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_ctrsm(value side, value uplo, value transa, value diag, value alpha, value A, value B) { _DECLARE_MATRIX2(A, B); _DECLARE_COMPLEX(alpha); _CONVERT_MATRIX2(A, B); _CONVERT_COMPLEX(alpha); gsl_blas_ctrsm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), z_alpha, &m_A, &m_B); return Val_unit; } CAMLprim value ml_gsl_blas_ctrsm_bc(value *argv, int argc) { return ml_gsl_blas_ctrsm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_chemm(value side, value uplo, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _DECLARE_COMPLEX2(alpha, beta); _CONVERT_MATRIX3(A, B, C); _CONVERT_COMPLEX2(alpha, beta); gsl_blas_chemm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), z_alpha, &m_A, &m_B, z_beta, &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_chemm_bc(value *argv, int argc) { return ml_gsl_blas_chemm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_cherk(value uplo, value trans, value alpha, value A, value beta, value C) { _DECLARE_MATRIX2(A, C); _CONVERT_MATRIX2(A, C); gsl_blas_cherk(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(trans), Double_val(alpha), &m_A, Double_val(beta), &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_cherk_bc(value *argv, int argc) { return ml_gsl_blas_cherk(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_cher2k(value uplo, value trans, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _DECLARE_COMPLEX(alpha); _CONVERT_MATRIX3(A, B, C); _CONVERT_COMPLEX(alpha); gsl_blas_cher2k(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(trans), z_alpha, &m_A, &m_B, Double_val(beta), &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_cher2k_bc(value *argv, int argc) { return ml_gsl_blas_cher2k(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } orpie-1.5.2/gsl/gsl_blas.ml0000644000175000017500000002706712322115103014230 0ustar paulpaul (** BLAS support *) type order = | RowMajor | ColMajor type transpose = | NoTrans | Trans | ConjTrans type uplo = | Upper | Lower type diag = | NonUnit | Unit type side = | Left | Right open Gsl_matrix open Gsl_vector (** {3 LEVEL 1} *) external dot : vector -> vector -> float = "ml_gsl_blas_ddot" external nrm2 : vector -> float = "ml_gsl_blas_dnrm2" external asum : vector -> float = "ml_gsl_blas_dasum" external iamax : vector -> int = "ml_gsl_blas_idamax" external swap : vector -> vector -> unit = "ml_gsl_blas_dswap" external copy : vector -> vector -> unit = "ml_gsl_blas_dcopy" external axpy : float -> vector -> vector -> unit = "ml_gsl_blas_daxpy" external rot : vector -> vector -> float -> float -> unit = "ml_gsl_blas_drot" external scal : float -> vector -> unit = "ml_gsl_blas_dscal" (** {3 LEVEL 2} *) external gemv : transpose -> alpha:float -> a:matrix -> x:vector -> beta:float -> y:vector -> unit = "ml_gsl_blas_dgemv_bc" "ml_gsl_blas_dgemv" external trmv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_dtrmv" external trsv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_dtrsv" external symv : uplo -> alpha:float -> a:matrix -> x:vector -> beta:float -> y:vector -> unit = "ml_gsl_blas_dsymv_bc" "ml_gsl_blas_dsymv" external dger : alpha:float -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_dger" external syr : uplo -> alpha:float -> x:vector -> a:matrix -> unit = "ml_gsl_blas_dsyr" external syr2 : uplo -> alpha:float -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_dsyr2" (** {3 LEVEL 3} *) external gemm : ta:transpose -> tb:transpose -> alpha:float -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_dgemm_bc" "ml_gsl_blas_dgemm" external symm : side -> uplo -> alpha:float -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_dsymm_bc" "ml_gsl_blas_dsymm" external trmm : side -> uplo -> transpose -> diag -> alpha:float -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_dtrmm_bc" "ml_gsl_blas_dtrmm" external trsm : side -> uplo -> transpose -> diag -> alpha:float -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_dtrsm_bc" "ml_gsl_blas_dtrsm" external syrk : uplo -> transpose -> alpha:float -> a:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_dsyrk_bc" "ml_gsl_blas_dsyrk" external syr2k : uplo -> transpose -> alpha:float -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_dsyr2k_bc" "ml_gsl_blas_dsyr2k" (** {3 Single precision} *) open Gsl_vector.Single open Gsl_matrix.Single module Single = struct (** {4 LEVEL 1} *) external sdsdot : alpha:float -> vector -> vector -> float = "ml_gsl_blas_sdsdot" external dsdot : vector -> vector -> float = "ml_gsl_blas_dsdot" external dot : vector -> vector -> float = "ml_gsl_blas_sdot" external nrm2 : vector -> float = "ml_gsl_blas_snrm2" external asum : vector -> float = "ml_gsl_blas_sasum" external iamax : vector -> int = "ml_gsl_blas_isamax" external swap : vector -> vector -> unit = "ml_gsl_blas_sswap" external copy : vector -> vector -> unit = "ml_gsl_blas_scopy" external axpy : float -> vector -> vector -> unit = "ml_gsl_blas_saxpy" external rot : vector -> vector -> float -> float -> unit = "ml_gsl_blas_srot" external scal : float -> vector -> unit = "ml_gsl_blas_sscal" (** {4 LEVEL 2} *) external gemv : transpose -> alpha:float -> a:matrix -> x:vector -> beta:float -> y:vector -> unit = "ml_gsl_blas_sgemv_bc" "ml_gsl_blas_sgemv" external trmv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_strmv" external trsv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_strsv" external symv : uplo -> alpha:float -> a:matrix -> x:vector -> beta:float -> y:vector -> unit = "ml_gsl_blas_ssymv_bc" "ml_gsl_blas_ssymv" external dger : alpha:float -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_sger" external syr : uplo -> alpha:float -> x:vector -> a:matrix -> unit = "ml_gsl_blas_ssyr" external syr2 : uplo -> alpha:float -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_ssyr2" (** {4 LEVEL 3} *) external gemm : ta:transpose -> tb:transpose -> alpha:float -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_sgemm_bc" "ml_gsl_blas_sgemm" external symm : side -> uplo -> alpha:float -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_ssymm_bc" "ml_gsl_blas_ssymm" external syrk : uplo -> transpose -> alpha:float -> a:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_ssyrk_bc" "ml_gsl_blas_ssyrk" external syr2k : uplo -> transpose -> alpha:float -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_ssyr2k_bc" "ml_gsl_blas_ssyr2k" external trmm : side -> uplo -> transpose -> diag -> alpha:float -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_strmm_bc" "ml_gsl_blas_strmm" external trsm : side -> uplo -> transpose -> diag -> alpha:float -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_strsm_bc" "ml_gsl_blas_strsm" end (** {3 Complex} *) open Gsl_vector_complex open Gsl_matrix_complex open Gsl_complex module Complex = struct (** {4 LEVEL 1} *) external dotu : vector -> vector -> complex = "ml_gsl_blas_zdotu" external dotc : vector -> vector -> complex = "ml_gsl_blas_zdotc" external nrm2 : vector -> float = "ml_gsl_blas_znrm2" external asum : vector -> float = "ml_gsl_blas_zasum" external iamax : vector -> int = "ml_gsl_blas_izamax" external swap : vector -> vector -> unit = "ml_gsl_blas_zswap" external copy : vector -> vector -> unit = "ml_gsl_blas_zcopy" external axpy : complex -> vector -> vector -> unit = "ml_gsl_blas_zaxpy" external scal : complex -> vector -> unit = "ml_gsl_blas_zscal" external zdscal : float -> vector -> unit = "ml_gsl_blas_zdscal" (** {4 LEVEL 2} *) external gemv : transpose -> alpha:complex -> a:matrix -> x:vector -> beta:complex -> y:vector -> unit = "ml_gsl_blas_zgemv_bc" "ml_gsl_blas_zgemv" external trmv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_ztrmv" external trsv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_ztrsv" external hemv : uplo -> alpha:complex -> a:matrix -> x:vector -> beta:complex -> y:vector -> unit = "ml_gsl_blas_zhemv_bc" "ml_gsl_blas_zhemv" external geru : alpha:complex -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_zgeru" external gerc : alpha:complex -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_zgerc" external her : uplo -> alpha:float -> x:vector -> a:matrix -> unit = "ml_gsl_blas_zher" external her2 : uplo -> alpha:complex -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_zher2" (** {4 LEVEL 3} *) external gemm : ta:transpose -> tb:transpose -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_zgemm_bc" "ml_gsl_blas_zgemm" external symm : side -> uplo -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_zsymm_bc" "ml_gsl_blas_zsymm" external syrk : uplo -> transpose -> alpha:complex -> a:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_zsyrk_bc" "ml_gsl_blas_zsyrk" external syr2k : uplo -> transpose -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_zsyr2k_bc" "ml_gsl_blas_zsyr2k" external trmm : side -> uplo -> transpose -> diag -> alpha:complex -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_ztrmm_bc" "ml_gsl_blas_ztrmm" external trsm : side -> uplo -> transpose -> diag -> alpha:complex -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_ztrsm_bc" "ml_gsl_blas_ztrsm" external hemm : side -> uplo -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_zhemm_bc" "ml_gsl_blas_zhemm" external herk : uplo -> transpose -> alpha:float -> a:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_zherk_bc" "ml_gsl_blas_zherk" external her2k : uplo -> transpose -> alpha:complex -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_zher2k_bc" "ml_gsl_blas_zher2k" end (** {3 Complex single precision} *) open Gsl_vector_complex.Single open Gsl_matrix_complex.Single open Gsl_complex module Complex_Single = struct (** {4 LEVEL 1} *) external dotu : vector -> vector -> complex = "ml_gsl_blas_cdotu" external dotc : vector -> vector -> complex = "ml_gsl_blas_cdotc" external nrm2 : vector -> float = "ml_gsl_blas_scnrm2" external asum : vector -> float = "ml_gsl_blas_scasum" external iamax : vector -> int = "ml_gsl_blas_icamax" external swap : vector -> vector -> unit = "ml_gsl_blas_cswap" external copy : vector -> vector -> unit = "ml_gsl_blas_ccopy" external axpy : complex -> vector -> vector -> unit = "ml_gsl_blas_caxpy" external scal : complex -> vector -> unit = "ml_gsl_blas_cscal" external csscal : float -> vector -> unit = "ml_gsl_blas_csscal" (** {4 LEVEL 2} *) external gemv : transpose -> alpha:complex -> a:matrix -> x:vector -> beta:complex -> y:vector -> unit = "ml_gsl_blas_cgemv_bc" "ml_gsl_blas_cgemv" external trmv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_ctrmv" external trsv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_ctrsv" external hemv : uplo -> alpha:complex -> a:matrix -> x:vector -> beta:complex -> y:vector -> unit = "ml_gsl_blas_chemv_bc" "ml_gsl_blas_chemv" external geru : alpha:complex -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_cgeru" external gerc : alpha:complex -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_cgerc" external her : uplo -> alpha:float -> x:vector -> a:matrix -> unit = "ml_gsl_blas_cher" external her2 : uplo -> alpha:complex -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_cher2" (** {4 LEVEL 3} *) external gemm : ta:transpose -> tb:transpose -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_cgemm_bc" "ml_gsl_blas_cgemm" external symm : side -> uplo -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_csymm_bc" "ml_gsl_blas_csymm" external syrk : uplo -> transpose -> alpha:complex -> a:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_csyrk_bc" "ml_gsl_blas_csyrk" external syr2k : uplo -> transpose -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_csyr2k_bc" "ml_gsl_blas_csyr2k" external trmm : side -> uplo -> transpose -> diag -> alpha:complex -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_ctrmm_bc" "ml_gsl_blas_ctrmm" external trsm : side -> uplo -> transpose -> diag -> alpha:complex -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_ctrsm_bc" "ml_gsl_blas_ctrsm" external hemm : side -> uplo -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_chemm_bc" "ml_gsl_blas_chemm" external herk : uplo -> transpose -> alpha:float -> a:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_cherk_bc" "ml_gsl_blas_cherk" external her2k : uplo -> transpose -> alpha:complex -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_cher2k_bc" "ml_gsl_blas_cher2k" end orpie-1.5.2/gsl/mlgsl_matrix_complex_float.c0000644000175000017500000000010412322115103017651 0ustar paulpaul #include "mlgsl_matrix_complex_float.h" #include "mlgsl_matrix.c" orpie-1.5.2/gsl/gsl_matrix_complex.ml0000644000175000017500000001446312322115103016336 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) open Bigarray open Gsl_complex type complex_mat_bigarr = (Complex.t, Bigarray.complex64_elt, Bigarray.c_layout) Bigarray.Array2.t type matrix = complex_mat_bigarr let create ?init dimx dimy = let barr = Array2.create complex64 c_layout dimx dimy in begin match init with | None -> () | Some x -> Array2.fill barr x end ; barr let dims mat = (Array2.dim1 mat, Array2.dim2 mat) let of_array arr dim1 dim2 = let mat = create dim1 dim2 in for i=0 to pred dim1 do for j=0 to pred dim2 do mat.{i,j} <- arr.(dim2*i+j) done done ; mat let of_complex_array arr dim1 dim2 = let mat = create dim1 dim2 in for i=0 to pred dim1 do for j=0 to pred dim2 do let k = 2 * (dim2*i+j) in mat.{i,j} <- complex arr.(k) arr.(k+1) done done ; mat let of_arrays arr = Array2.of_array complex64 c_layout arr let to_array (mat : matrix) = let d1 = Array2.dim1 mat in let d2 = Array2.dim2 mat in Array.init (d1*d2) (fun i -> mat.{i/d2, i mod d2}) let to_complex_array (mat : matrix) = let d1 = Array2.dim1 mat in let d2 = Array2.dim2 mat in let arr = Array.create (2*d1*d2) 0. in for i=0 to pred (d1*d2) do let { re = re; im = im } = mat.{i/d2, i mod d2} in arr.(2*i) <- re ; arr.(2*i+1) <- im done ; arr let to_arrays (mat : matrix) = let d1 = Array2.dim1 mat in let d2 = Array2.dim2 mat in let a = Array.init d1 (fun _ -> Array.make d2 Complex.zero) in for i=0 to pred d1 do for j=0 to pred d2 do a.(i).(j) <- mat.{i,j} done done ; a let get (m : matrix) i j = Array2.get m i j let set (m : matrix) i j x = Array2.set m i j x let set_all = Array2.fill let set_zero m = set_all m Complex.zero let set_id m = set_zero m ; for i=0 to pred (min (Array2.dim1 m) (Array2.dim2 m)) do set m i i Complex.one done let memcpy ~src ~dst = Array2.blit src dst let copy m = let m' = create (Array2.dim1 m) (Array2.dim2 m) in Array2.blit m m' ; m' let row = Array2.slice_left external add : matrix -> matrix -> unit = "ml_gsl_matrix_complex_add" external sub : matrix -> matrix -> unit = "ml_gsl_matrix_complex_sub" external mul_elements : matrix -> matrix -> unit = "ml_gsl_matrix_complex_mul" external div_elements : matrix -> matrix -> unit = "ml_gsl_matrix_complex_div" external scale : matrix -> complex -> unit = "ml_gsl_matrix_complex_scale" external add_constant : matrix -> complex -> unit = "ml_gsl_matrix_complex_add_constant" external add_diagonal : matrix -> complex -> unit = "ml_gsl_matrix_complex_add_diagonal" external is_null : matrix -> bool = "ml_gsl_matrix_complex_isnull" external swap_rows : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_swap_rows" external swap_columns : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_swap_columns" external swap_rowcol : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_swap_rowcol" external transpose : matrix -> matrix -> unit = "ml_gsl_matrix_complex_transpose_memcpy" external transpose_in_place : matrix -> unit = "ml_gsl_matrix_complex_transpose" module Single = struct type complex_float_mat_bigarr = (Complex.t, Bigarray.complex32_elt, Bigarray.c_layout) Bigarray.Array2.t type matrix = complex_float_mat_bigarr let create ?init dimx dimy = let barr = Array2.create complex32 c_layout dimx dimy in begin match init with | None -> () | Some x -> Array2.fill barr x end ; barr let dims = dims let of_array arr dim1 dim2 = let mat = create dim1 dim2 in for i=0 to pred dim1 do for j=0 to pred dim2 do mat.{i,j} <- arr.(dim2*i+j) done done ; mat let of_complex_array arr dim1 dim2 = let mat = create dim1 dim2 in for i=0 to pred dim1 do for j=0 to pred dim2 do let k = 2 * (dim2*i+j) in mat.{i,j} <- complex arr.(k) arr.(k+1) done done ; mat let of_arrays arr = Array2.of_array complex32 c_layout arr let to_array (mat : matrix) = let d1 = Array2.dim1 mat in let d2 = Array2.dim2 mat in Array.init (d1*d2) (fun i -> mat.{i/d2, i mod d2}) let to_complex_array (mat : matrix) = let d1 = Array2.dim1 mat in let d2 = Array2.dim2 mat in let arr = Array.create (2*d1*d2) 0. in for i=0 to pred (d1*d2) do let { re = re; im = im } = mat.{i/d2, i mod d2} in arr.(2*i) <- re ; arr.(2*i+1) <- im done ; arr let to_arrays (mat : matrix) = let d1 = Array2.dim1 mat in let d2 = Array2.dim2 mat in let a = Array.init d1 (fun _ -> Array.make d2 Complex.zero) in for i=0 to pred d1 do for j=0 to pred d2 do a.(i).(j) <- mat.{i,j} done done ; a let get (m : matrix) i j = Array2.get m i j let set (m : matrix) i j x = Array2.set m i j x let set_all = set_all let set_zero = set_zero let set_id m = set_zero m ; for i=0 to pred (min (Array2.dim1 m) (Array2.dim2 m)) do set m i i Complex.one done let memcpy = memcpy let copy m = let m' = create (Array2.dim1 m) (Array2.dim2 m) in Array2.blit m m' ; m' let row = row external add : matrix -> matrix -> unit = "ml_gsl_matrix_complex_float_add" external sub : matrix -> matrix -> unit = "ml_gsl_matrix_complex_float_sub" external mul_elements : matrix -> matrix -> unit = "ml_gsl_matrix_complex_float_mul" external div_elements : matrix -> matrix -> unit = "ml_gsl_matrix_complex_float_div" external scale : matrix -> complex -> unit = "ml_gsl_matrix_complex_float_scale" external add_constant : matrix -> complex -> unit = "ml_gsl_matrix_complex_float_add_constant" external add_diagonal : matrix -> complex -> unit = "ml_gsl_matrix_complex_float_add_diagonal" external is_null : matrix -> bool = "ml_gsl_matrix_complex_float_isnull" external swap_rows : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_float_swap_rows" external swap_columns : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_float_swap_columns" external swap_rowcol : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_float_swap_rowcol" external transpose : matrix -> matrix -> unit = "ml_gsl_matrix_complex_float_transpose_memcpy" external transpose_in_place : matrix -> unit = "ml_gsl_matrix_complex_float_transpose" end orpie-1.5.2/gsl/gsl_vector_complex.ml0000644000175000017500000000600212322115103016322 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) open Bigarray type complex_double_vector_bigarr = (Complex.t, complex64_elt, c_layout) Bigarray.Array1.t type vector = complex_double_vector_bigarr let create ?init len = let barr = Array1.create complex64 c_layout len in begin match init with | None -> () | Some x -> Array1.fill barr x end ; barr let length = Array1.dim let of_array arr = Array1.of_array complex64 c_layout arr let to_array v = Array.init (Array1.dim v) (Array1.get v) let of_complex_array arr = let n = (Array.length arr) / 2 in let barr = create n in for i=0 to pred n do barr.{i} <- Gsl_complex.get arr i done ; barr let to_complex_array barr = let n = Array1.dim barr in let arr = Array.create (2*n) 0. in for i=0 to pred n do Gsl_complex.set arr i barr.{i} done ; arr let get (v : vector) i = Array1.get v i let set (v : vector) i x = Array1.set v i x let set_all = Array1.fill let set_zero v = set_all v Complex.zero let set_basis v i = set_zero v ; set v i Complex.one let subvector v ~off ~len = Array1.sub v off len let memcpy ~src:v ~dst:w = if length v <> length w then invalid_arg "Gsl_vector.memcpy" ; Array1.blit v w let copy v = let w = create (length v) in memcpy v w ; w let swap_element v i j = let d = get v i in let d' = get v j in set v j d ; set v i d' let reverse v = let len = length v in for i=0 to pred (len/2) do swap_element v i (pred len - i) done module Single = struct type complex_float_vector_bigarr = (Complex.t, complex32_elt, c_layout) Bigarray.Array1.t type vector = complex_float_vector_bigarr let create ?init len = let barr = Array1.create complex32 c_layout len in begin match init with | None -> () | Some x -> Array1.fill barr x end ; barr let length = length let of_array arr = Array1.of_array complex32 c_layout arr let to_array = to_array let of_complex_array arr = let n = (Array.length arr) / 2 in let barr = create n in for i=0 to pred n do barr.{i} <- Gsl_complex.get arr i done ; barr let to_complex_array barr = let n = Array1.dim barr in let arr = Array.create (2*n) 0. in for i=0 to pred n do Gsl_complex.set arr i barr.{i} done ; arr let get (v : vector) i = Array1.get v i let set (v : vector) i x = Array1.set v i x let set_all = set_all let set_zero = set_zero let set_basis v i = set_zero v ; set v i Complex.one let subvector = subvector let memcpy = memcpy let copy v = let w = create (length v) in memcpy v w ; w let swap_element v i j = let d = get v i in let d' = get v j in set v j d ; set v i d' let reverse v = let len = length v in for i=0 to pred (len/2) do swap_element v i (pred len - i) done end orpie-1.5.2/gsl/mlgsl_matrix_float.h0000644000175000017500000000042512322115103016135 0ustar paulpaul #include "wrappers.h" #define BASE_TYPE float #undef CONV_FLAT #define TYPE(t) CONCAT2(t,BASE_TYPE) #define _DECLARE_BASE_TYPE(v) double conv_##v #define _CONVERT_BASE_TYPE(v) conv_##v = Double_val(v) #define FUNCTION(a,b) CONCAT3(a,BASE_TYPE,b) #include "mlgsl_matrix.h" orpie-1.5.2/gsl/mlgsl_matrix_complex_float.h0000644000175000017500000000052012322115103017660 0ustar paulpaul #include "wrappers.h" #define BASE_TYPE complex_float #undef CONV_FLAT #define TYPE(t) CONCAT2(t,BASE_TYPE) #define _DECLARE_BASE_TYPE(v) gsl_complex_float conv_##v #define _CONVERT_BASE_TYPE(v) GSL_SET_COMPLEX(&conv_##v,Double_field(v, 0), Double_field(v,1)) #define FUNCTION(a,b) CONCAT3(a,BASE_TYPE,b) #include "mlgsl_matrix.h" orpie-1.5.2/gsl/gsl_matrix_complex_flat.ml0000644000175000017500000001324112322115103017335 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) type complex_mat_flat = { data : float array ; off : int ; dim1 : int ; dim2 : int ; tda : int ; } type matrix = complex_mat_flat open Gsl_complex let create ?(init=Complex.zero) dim1 dim2 = let mat = { data = Array.create (2 * dim1 * dim2) init.Complex.re ; off = 0 ; dim1 = dim1 ; dim2 = dim2 ; tda = dim2 } in if init.Complex.im <> init.Complex.re then for i=0 to pred (dim1*dim2) do mat.data.(2*i+1) <- init.Complex.im done ; mat let dims mat = (mat.dim1, mat.dim2) let get m i j = let k = 2 * (m.off + i*m.tda + j) in complex m.data.(k) m.data.(k+1) let set m i j c = let k = 2 * (m.off + i*m.tda + j) in m.data.(k) <- c.re ; m.data.(k+1) <- c.im let of_arrays arr = let dim1 = Array.length arr in if dim1 = 0 then invalid_arg "of_arrays" ; let dim2 = Array.length arr.(0) in let tab = Array.make (2 * dim1 * dim2) 0. in let mat = { data = tab ; off = 0 ; dim1 = dim1 ; dim2 = dim2 ; tda = dim2 } in for i=0 to pred dim1 do let a = arr.(i) in for j=0 to pred dim2 do set mat i j a.(j) done done ; mat let to_arrays mat = let arr = Array.make_matrix mat.dim1 mat.dim2 Complex.zero in for i=0 to pred mat.dim1 do let a = arr.(i) in for j=0 to pred mat.dim2 do a.(j) <- get mat i j done done ; arr let of_array arr dim1 dim2 = let len = Array.length arr in if dim1 * dim2 <> len then invalid_arg "of_array" ; let tab = Array.make (2 * dim1 * dim2) 0. in let mat = { data = tab ; off = 0 ; dim1 = dim1 ; dim2 = dim2 ; tda = dim2 } in for i=0 to pred dim1 do for j=0 to pred dim2 do set mat i j arr.(i*dim2+j) done done ; mat let to_array mat = let arr = Array.make (mat.dim1 * mat.dim2) Complex.zero in for i=0 to pred mat.dim1 do for j=0 to pred mat.dim2 do arr.(i*mat.dim2+j) <- get mat i j done done ; arr let of_complex_array arr dim1 dim2 = let len = Array.length arr in if 2 * dim1 * dim2 <> len then invalid_arg "of_array" ; { data = Array.copy arr ; off = 0 ; dim1 = dim1 ; dim2 = dim2 ; tda = dim2 } let to_complex_array mat = if mat.tda = mat.dim2 && mat.off = 0 then Array.copy mat.data else begin let tab = Array.create (2*mat.dim1*mat.dim2) 0. in for i=0 to pred mat.dim1 do for j=0 to pred mat.dim2 do Gsl_complex.set tab (i*mat.dim2 + j) (get mat i j) done done ; tab end let set_all m c = for i=0 to pred m.dim1 do for j=0 to pred m.dim2 do set m i j c done done let set_zero m = set_all m Complex.zero let set_id m = set_zero m ; for i=0 to pred (min m.dim1 m.dim2) do set m i i Complex.one done let memcpy ~src:m ~dst:m' = if m.dim1 <> m'.dim1 || m.dim2 <> m'.dim2 then invalid_arg "wrong dimensions" ; for i=0 to pred m.dim1 do Array.blit m.data (2 * (m.off + i*m.tda)) m'.data (2 * (m'.off + i*m'.tda)) (2 * m.dim2) done let copy m = let m' = create m.dim1 m.dim2 in memcpy m m' ; m' let submatrix m ~k1 ~k2 ~n1 ~n2 = { m with off = m.off + (k1*m.tda)+k2 ; dim1 = n1 ; dim2 = n2 ; tda = m.tda ; } let view_complex_array arr ?(off=0) dim1 ?tda dim2 = let tda = match tda with | None -> dim2 | Some v -> v in let len = Array.length arr in if dim1 * tda > len/2 - off || dim2 > tda then invalid_arg "view_array" ; { data = arr; off = off; dim1 = dim1; dim2 = dim2; tda = tda } external add : matrix -> matrix -> unit = "ml_gsl_matrix_complex_add" external sub : matrix -> matrix -> unit = "ml_gsl_matrix_complex_sub" external mul_elements : matrix -> matrix -> unit = "ml_gsl_matrix_complex_mul" external div_elements : matrix -> matrix -> unit = "ml_gsl_matrix_complex_div" external scale : matrix -> float -> unit = "ml_gsl_matrix_complex_scale" external add_constant : matrix -> float -> unit = "ml_gsl_matrix_complex_add_constant" external add_diagonal : matrix -> complex -> unit = "ml_gsl_matrix_complex_add_diagonal" external is_null : matrix -> bool = "ml_gsl_matrix_complex_isnull" external swap_rows : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_swap_rows" external swap_columns : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_swap_columns" external swap_rowcol : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_swap_rowcol" external transpose : matrix -> matrix -> unit = "ml_gsl_matrix_complex_transpose_memcpy" external transpose_in_place : matrix -> unit = "ml_gsl_matrix_complex_transpose" let row m i = Gsl_vector_complex_flat.view_complex_array ~off:(m.off + i * m.tda) ~len:m.dim2 m.data let column m j = Gsl_vector_complex_flat.view_complex_array ~stride:m.tda ~off:(m.off + j) ~len:m.dim1 m.data let diagonal m = Gsl_vector_complex_flat.view_complex_array ~stride:(m.tda + 1) ~off:m.off ~len:(min m.dim1 m.dim2) m.data let subdiagonal m k = Gsl_vector_complex_flat.view_complex_array ~stride:(m.tda + 1) ~off:(m.off + k * m.tda) ~len:(min (m.dim1 - k) m.dim2) m.data let superdiagonal m k = Gsl_vector_complex_flat.view_complex_array ~stride:(m.tda + 1) ~off:(m.off + k) ~len:(min m.dim1 (m.dim2 - k)) m.data let view_vector v ?(off=0) dim1 ?tda dim2 = let tda = match tda with | None -> dim2 | Some v -> v in let len = Gsl_vector_complex_flat.length v in if dim1 * tda > len - off || dim2 > tda then invalid_arg "view_vector" ; { data = v.Gsl_vector_complex_flat.data; off = v.Gsl_vector_complex_flat.off + off; dim1 = dim1; dim2 = dim2; tda = tda } orpie-1.5.2/gsl/gsl_error.ml0000644000175000017500000000655712322115103014441 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) external gsl_version : unit -> string = "ml_gsl_version" let version = gsl_version () type errno = | CONTINUE (* iteration has not converged *) | FAILURE | EDOM (* input domain error, e.g sqrt(-1) *) | ERANGE (* output range error, e.g. exp(1e100) *) | EFAULT (* invalid pointer *) | EINVAL (* invalid argument supplied by user *) | EFAILED (* generic failure *) | EFACTOR (* factorization failed *) | ESANITY (* sanity check failed - shouldn't happen *) | ENOMEM (* malloc failed *) | EBADFUNC (* problem with user-supplied function *) | ERUNAWAY (* iterative process is out of control *) | EMAXITER (* exceeded max number of iterations *) | EZERODIV (* tried to divide by zero *) | EBADTOL (* user specified an invalid tolerance *) | ETOL (* failed to reach the specified tolerance *) | EUNDRFLW (* underflow *) | EOVRFLW (* overflow *) | ELOSS (* loss of accuracy *) | EROUND (* failed because of roundoff error *) | EBADLEN (* matrix, vector lengths are not conformant *) | ENOTSQR (* matrix not square *) | ESING (* apparent singularity detected *) | EDIVERGE (* integral or series is divergent *) | EUNSUP (* requested feature is not supported by the hardware *) | EUNIMPL (* requested feature not (yet) implemented *) | ECACHE (* cache limit exceeded *) | ETABLE (* table limit exceeded *) | ENOPROG (* iteration is not making progress towards solution *) | ENOPROGJ (* jacobian evaluations are not improving the solution *) | ETOLF (* cannot reach the specified tolerance in F *) | ETOLX (* cannot reach the specified tolerance in X *) | ETOLG (* cannot reach the specified tolerance in gradient *) | EOF (* end of file *) exception Gsl_exn of (errno * string) external raise_caml_exn : bool -> unit = "ml_gsl_error_init" let _ = Callback.register_exception "mlgsl_exn" (Gsl_exn (CONTINUE, "")) let init () = raise_caml_exn true let uninit () = raise_caml_exn false external strerror : errno -> string = "ml_gsl_strerror" let string_of_errno = function | CONTINUE -> "CONTINUE" | FAILURE -> "FAILURE" | EDOM -> "EDOM" | ERANGE -> "ERANGE" | EFAULT -> "EFAULT" | EINVAL -> "EINVAL" | EFAILED -> "EFAILED" | EFACTOR -> "EFACTOR" | ESANITY -> "ESANITY" | ENOMEM -> "ENOMEM" | EBADFUNC -> "EBADFUNC" | ERUNAWAY -> "ERUNAWAY" | EMAXITER -> "EMAXITER" | EZERODIV -> "EZERODIV" | EBADTOL -> "EBADTOL" | ETOL -> "ETOL" | EUNDRFLW -> "EUNDRFLW" | EOVRFLW -> "EOVRFLW" | ELOSS -> "ELOSS" | EROUND -> "EROUND" | EBADLEN -> "EBADLEN" | ENOTSQR -> "ENOTSQR" | ESING -> "ESING" | EDIVERGE -> "EDIVERGE" | EUNSUP -> "EUNSUP" | EUNIMPL -> "EUNIMPL" | ECACHE -> "ECACHE" | ETABLE -> "ETABLE" | ENOPROG -> "ENOPROG" | ENOPROGJ -> "ENOPROGJ" | ETOLF -> "ETOLF" | ETOLX -> "ETOLX" | ETOLG -> "ETOLG" | EOF -> "EOF" let pprint_exn = function | Gsl_exn (errno, msg) -> Printf.sprintf "GSL error: %s, %s\n %s" (string_of_errno errno) (strerror errno) msg | e -> Printexc.to_string e let handle_exn f x = try f x with exn -> prerr_endline (pprint_exn exn) ; raise exn orpie-1.5.2/gsl/README0000644000175000017500000000053112322115103012753 0ustar paulpaulOrpie makes use of a portion of the GSL bindings provided by Olivier Andrieu's OcamlGSL project (v 0.6.0). This code is released under the GNU GPL; for details, see COPYING in the 'gsl' subdirectory. The OcamlGSL project may be found at http://oandrieu.nerim.net/ocaml/gsl/ . # arch-tag: DO_NOT_CHANGE_cac38517-e49e-4a2c-9a2a-7ff33e99eced orpie-1.5.2/gsl/mlgsl_matrix_complex.h0000644000175000017500000000120612322115103016475 0ustar paulpaul #include "wrappers.h" #define BASE_TYPE complex #define CONV_FLAT #define TYPE(t) CONCAT2(t,BASE_TYPE) #define _DECLARE_BASE_TYPE(v) gsl_complex conv_##v #define _CONVERT_BASE_TYPE(v) GSL_SET_COMPLEX(&conv_##v,Double_field(v, 0), Double_field(v,1)) #define FUNCTION(a,b) CONCAT3(a,BASE_TYPE,b) #include "mlgsl_matrix.h" #define _DECLARE_COMPLEX_MATRIX(a) gsl_matrix_complex m_##a #define _DECLARE_COMPLEX_MATRIX2(a,b) _DECLARE_COMPLEX_MATRIX(a); _DECLARE_COMPLEX_MATRIX(b) #define _CONVERT_COMPLEX_MATRIX(a) mlgsl_mat_of_value_complex(&m_##a, a) #define _CONVERT_COMPLEX_MATRIX2(a,b) _CONVERT_COMPLEX_MATRIX(a); _CONVERT_COMPLEX_MATRIX(b) orpie-1.5.2/gsl/mlgsl_matrix.c0000644000175000017500000000572212322115103014750 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #ifndef FUNCTION #error pb with include files #endif CAMLprim value FUNCTION(ml_gsl_matrix,memcpy)(value A, value B) { _DECLARE_MATRIX2(A,B); _CONVERT_MATRIX2(A,B); FUNCTION(gsl_matrix,memcpy)(&m_B, &m_A); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_matrix,add)(value A, value B) { _DECLARE_MATRIX2(A,B); _CONVERT_MATRIX2(A,B); FUNCTION(gsl_matrix,add)(&m_A, &m_B); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_matrix,sub)(value A, value B) { _DECLARE_MATRIX2(A,B); _CONVERT_MATRIX2(A,B); FUNCTION(gsl_matrix,sub)(&m_A, &m_B); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_matrix,mul)(value A, value B) { _DECLARE_MATRIX2(A,B); _CONVERT_MATRIX2(A,B); FUNCTION(gsl_matrix,mul_elements)(&m_A, &m_B); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_matrix,div)(value A, value B) { _DECLARE_MATRIX2(A,B); _CONVERT_MATRIX2(A,B); FUNCTION(gsl_matrix,div_elements)(&m_A, &m_B); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_matrix,scale)(value A, value X) { _DECLARE_MATRIX(A); _DECLARE_BASE_TYPE(X); _CONVERT_MATRIX(A); _CONVERT_BASE_TYPE(X); FUNCTION(gsl_matrix,scale)(&m_A, conv_X); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_matrix,add_constant)(value A, value X) { _DECLARE_MATRIX(A); _DECLARE_BASE_TYPE(X); _CONVERT_MATRIX(A); _CONVERT_BASE_TYPE(X); FUNCTION(gsl_matrix,add_constant)(&m_A, conv_X); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_matrix,add_diagonal)(value A, value X) { _DECLARE_MATRIX(A); _DECLARE_BASE_TYPE(X); _CONVERT_MATRIX(A); _CONVERT_BASE_TYPE(X); FUNCTION(gsl_matrix,add_diagonal)(&m_A, conv_X); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_matrix,isnull)(value A) { int r; _DECLARE_MATRIX(A); _CONVERT_MATRIX(A); r = FUNCTION(gsl_matrix,isnull)(&m_A); return Val_bool(r); } CAMLprim value FUNCTION(ml_gsl_matrix,swap_rows)(value A, value i, value j) { _DECLARE_MATRIX(A); _CONVERT_MATRIX(A); FUNCTION(gsl_matrix,swap_rows)(&m_A, Int_val(i), Int_val(j)); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_matrix,swap_columns)(value A, value i, value j) { _DECLARE_MATRIX(A); _CONVERT_MATRIX(A); FUNCTION(gsl_matrix,swap_columns)(&m_A, Int_val(i), Int_val(j)); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_matrix,swap_rowcol)(value A, value i, value j) { _DECLARE_MATRIX(A); _CONVERT_MATRIX(A); FUNCTION(gsl_matrix,swap_rowcol)(&m_A, Int_val(i), Int_val(j)); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_matrix,transpose_memcpy)(value A, value B) { _DECLARE_MATRIX2(A, B); _CONVERT_MATRIX2(A, B); FUNCTION(gsl_matrix,transpose_memcpy)(&m_A, &m_B); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_matrix,transpose)(value A) { _DECLARE_MATRIX(A); _CONVERT_MATRIX(A); FUNCTION(gsl_matrix,transpose)(&m_A); return Val_unit; } orpie-1.5.2/gsl/gsl_vector_complex_flat.mli0000644000175000017500000000246012322115103017505 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Vector of complex numbers implemented with a [float array] *) type complex_vector_flat = private { data : float array ; off : int ; len : int ; stride : int ; } type vector = complex_vector_flat (** {3 Operations} *) open Gsl_complex val create : ?init:complex -> int -> vector val of_array : complex array -> vector val to_array : vector -> complex array val of_complex_array : complex_array -> vector val to_complex_array : vector -> complex_array val length : vector -> int val get : vector -> int -> complex val set : vector -> int -> complex -> unit val set_all : vector -> complex -> unit val set_zero : vector -> unit val set_basis : vector -> int -> unit val memcpy : vector -> vector -> unit val copy : vector -> vector val swap_element : vector -> int -> int -> unit val reverse : vector -> unit (** {3 No-copy operations} *) val subvector : ?stride:int -> vector -> off:int -> len:int -> vector val view_complex_array : ?stride:int -> ?off:int -> ?len:int -> complex_array -> vector val real : vector -> Gsl_vector_flat.vector val imag : vector -> Gsl_vector_flat.vector orpie-1.5.2/gsl/gsl_vector_flat.mli0000644000175000017500000000406112322115103015755 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Vector of floats implemented with a [float array] *) type double_vector_flat = private { data : float array; off : int; len : int; stride : int; } type vector = double_vector_flat val check : vector -> vector (** @raise Failure if [off], [len] or [stride] designate an invalid subvector of [data] *) (** {3 Operations} *) val create : ?init:float -> int -> vector val of_array : float array -> vector val to_array : vector -> float array val length : vector -> int val get : vector -> int -> float val set : vector -> int -> float -> unit val set_all : vector -> float -> unit val set_zero : vector -> unit val set_basis : vector -> int -> unit val memcpy : src:vector -> dst:vector -> unit val copy : vector -> vector val swap_element : vector -> int -> int -> unit val reverse : vector -> unit external add : vector -> vector -> unit = "ml_gsl_vector_add" external sub : vector -> vector -> unit = "ml_gsl_vector_sub" external mul : vector -> vector -> unit = "ml_gsl_vector_mul" external div : vector -> vector -> unit = "ml_gsl_vector_div" external scale : vector -> float -> unit = "ml_gsl_vector_scale" external add_constant : vector -> float -> unit = "ml_gsl_vector_add_constant" external is_null : vector -> bool = "ml_gsl_vector_isnull" external max : vector -> float = "ml_gsl_vector_max" external min : vector -> float = "ml_gsl_vector_min" external minmax : vector -> float * float = "ml_gsl_vector_minmax" external max_index : vector -> int = "ml_gsl_vector_maxindex" external min_index : vector -> int = "ml_gsl_vector_minindex" external minmax_index : vector -> int * int = "ml_gsl_vector_minmaxindex" (** {3 No-copy operations} *) val subvector : ?stride:int -> vector -> off:int -> len:int -> vector val view_array : ?stride:int -> ?off:int -> ?len:int -> float array -> vector orpie-1.5.2/gsl/gsl_fun.ml0000644000175000017500000000212312322115103014061 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) type result = { res : float ; err : float ; } type result_e10 = { res_e10 : float ; err_e10 : float ; e10 : int ; } type mode = | DOUBLE | SIMPLE | APPROX external smash : result_e10 -> result = "ml_gsl_sf_result_smash_e" type gsl_fun = float -> float type gsl_fun_fdf = { f : float -> float ; df : float -> float ; fdf : float -> float * float ; } type monte_fun = float array -> float open Gsl_vector type multi_fun = x:vector -> f:vector -> unit type multi_fun_fdf = { multi_f : x:vector -> f:vector -> unit ; multi_df : x:vector -> j:Gsl_matrix.matrix -> unit ; multi_fdf : x:vector -> f:vector -> j:Gsl_matrix.matrix -> unit ; } type multim_fun = x:vector -> float type multim_fun_fdf = { multim_f : x:vector -> float ; multim_df : x:vector -> g:vector -> unit ; multim_fdf : x:vector -> g:vector -> float ; } orpie-1.5.2/gsl/mlgsl_vector_complex_float.h0000644000175000017500000000027012322115103017660 0ustar paulpaul #include "wrappers.h" #define BASE_TYPE complex_float #undef CONV_FLAT #define TYPE(t) CONCAT2(t,BASE_TYPE) #define FUNCTION(a,b) CONCAT3(a,BASE_TYPE,b) #include "mlgsl_vector.h" orpie-1.5.2/gsl/gsl_vector.mli0000644000175000017500000000716712322115103014761 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Vector of floats implemented with [Bigarray] *) (** {3 Double precision} *) type double_vector_bigarr = (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t type vector = double_vector_bigarr (** {4 Operations} *) val create : ?init:float -> int -> vector val of_array : float array -> vector val to_array : vector -> float array val length : vector -> int val get : vector -> int -> float val set : vector -> int -> float -> unit val set_all : vector -> float -> unit val set_zero : vector -> unit val set_basis : vector -> int -> unit val memcpy : src:vector -> dst:vector -> unit val copy : vector -> vector val swap_element : vector -> int -> int -> unit val reverse : vector -> unit external add : vector -> vector -> unit = "ml_gsl_vector_add" external sub : vector -> vector -> unit = "ml_gsl_vector_sub" external mul : vector -> vector -> unit = "ml_gsl_vector_mul" external div : vector -> vector -> unit = "ml_gsl_vector_div" external scale : vector -> float -> unit = "ml_gsl_vector_scale" external add_constant : vector -> float -> unit = "ml_gsl_vector_add_constant" external is_null : vector -> bool = "ml_gsl_vector_isnull" external max : vector -> float = "ml_gsl_vector_max" external min : vector -> float = "ml_gsl_vector_min" external minmax : vector -> float * float = "ml_gsl_vector_minmax" external max_index : vector -> int = "ml_gsl_vector_maxindex" external min_index : vector -> int = "ml_gsl_vector_minindex" external minmax_index : vector -> int * int = "ml_gsl_vector_minmaxindex" (** {4 No-copy operations} *) val subvector : vector -> off:int -> len:int -> vector (** {3 Single precision} *) module Single : sig type float_vector_bigarr = (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t type vector = float_vector_bigarr val create : ?init:float -> int -> vector val of_array : float array -> vector val to_array : vector -> float array val length : vector -> int val get : vector -> int -> float val set : vector -> int -> float -> unit val set_all : vector -> float -> unit val set_zero : vector -> unit val set_basis : vector -> int -> unit val memcpy : src:vector -> dst:vector -> unit val copy : vector -> vector val swap_element : vector -> int -> int -> unit val reverse : vector -> unit external add : vector -> vector -> unit = "ml_gsl_vector_float_add" external sub : vector -> vector -> unit = "ml_gsl_vector_float_sub" external mul : vector -> vector -> unit = "ml_gsl_vector_float_mul" external div : vector -> vector -> unit = "ml_gsl_vector_float_div" external scale : vector -> float -> unit = "ml_gsl_vector_float_scale" external add_constant : vector -> float -> unit = "ml_gsl_vector_float_add_constant" external is_null : vector -> bool = "ml_gsl_vector_float_isnull" external max : vector -> float = "ml_gsl_vector_float_max" external min : vector -> float = "ml_gsl_vector_float_min" external minmax : vector -> float * float = "ml_gsl_vector_float_minmax" external max_index : vector -> int = "ml_gsl_vector_float_maxindex" external min_index : vector -> int = "ml_gsl_vector_float_minindex" external minmax_index : vector -> int * int = "ml_gsl_vector_float_minmaxindex" (** {4 No-copy operations} *) val subvector : vector -> off:int -> len:int -> vector end orpie-1.5.2/gsl/gsl_permut.mli0000644000175000017500000000216112322115103014760 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Permutations *) type permut = (int, Bigarray.int_elt, Bigarray.c_layout) Bigarray.Array1.t val of_array : int array -> permut val to_array : permut -> int array val init : permut -> unit val create : int -> permut val make : int -> permut val swap : permut -> int -> int -> unit val size : permut -> int val valid : permut -> bool external reverse : permut -> unit = "ml_gsl_permutation_reverse" val inverse : permut -> permut external next : permut -> unit = "ml_gsl_permutation_next" external prev : permut -> unit = "ml_gsl_permutation_prev" external permute : permut -> 'a array -> unit = "ml_gsl_permute" external permute_barr : permut -> ('a, 'b, 'c) Bigarray.Array1.t -> unit = "ml_gsl_permute_barr" external permute_inverse : permut -> 'a array -> unit = "ml_gsl_permute_inverse" external permute_inverse_barr : permut -> ('a, 'b, 'c) Bigarray.Array1.t -> unit = "ml_gsl_permute_inverse_barr" orpie-1.5.2/gsl/mlgsl_blas_float.c0000644000175000017500000001653512322115103015556 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include "mlgsl_vector_float.h" #include "mlgsl_matrix_float.h" #include "mlgsl_blas.h" /* LEVEL1 float */ CAMLprim value ml_gsl_blas_sdsdot(value alpha, value X, value Y) { float r; _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_sdsdot(Double_val(alpha), &v_X, &v_Y, &r); return copy_double(r); } CAMLprim value ml_gsl_blas_dsdot(value X, value Y) { double r; _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_dsdot(&v_X, &v_Y, &r); return copy_double(r); } CAMLprim value ml_gsl_blas_sdot(value X, value Y) { float r; _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_sdot(&v_X, &v_Y, &r); return copy_double(r); } CAMLprim value ml_gsl_blas_snrm2(value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); return copy_double(gsl_blas_snrm2(&v_X)); } CAMLprim value ml_gsl_blas_sasum(value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); return copy_double(gsl_blas_sasum(&v_X)); } CAMLprim value ml_gsl_blas_isamax(value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); return Val_int(gsl_blas_isamax(&v_X)); } CAMLprim value ml_gsl_blas_sswap(value X, value Y) { _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_sswap(&v_X, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_scopy(value X, value Y) { _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_scopy(&v_X, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_saxpy(value alpha, value X, value Y) { _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_saxpy(Double_val(alpha), &v_X, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_srot(value X, value Y, value c, value s) { _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_srot(&v_X, &v_Y, Double_val(c), Double_val(s)); return Val_unit; } CAMLprim value ml_gsl_blas_sscal(value alpha, value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); gsl_blas_sscal(Double_val(alpha), &v_X); return Val_unit; } /* LEVEL2 float */ CAMLprim value ml_gsl_blas_sgemv(value transa, value alpha, value A, value X, value beta, value Y) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X, Y); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X, Y); gsl_blas_sgemv(CBLAS_TRANS_val(transa), Double_val(alpha), &m_A, &v_X, Double_val(beta), &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_sgemv_bc(value *argv, int argc) { return ml_gsl_blas_sgemv(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_strmv(value uplo, value transa, value diag, value A, value X) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_blas_strmv(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), &m_A, &v_X); return Val_unit; } CAMLprim value ml_gsl_blas_strsv(value uplo, value transa, value diag, value A, value X) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_blas_strsv(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), &m_A, &v_X); return Val_unit; } CAMLprim value ml_gsl_blas_ssymv(value uplo, value alpha, value A, value X, value beta, value Y) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X, Y); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X, Y); gsl_blas_ssymv(CBLAS_UPLO_val(uplo), Double_val(alpha), &m_A, &v_X, Double_val(beta), &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_ssymv_bc(value *argv, int argc) { return ml_gsl_blas_ssymv(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_sger(value alpha, value X, value Y, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X, Y); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X, Y); gsl_blas_sger(Double_val(alpha), &v_X, &v_Y, &m_A); return Val_unit; } CAMLprim value ml_gsl_blas_ssyr(value uplo ,value alpha, value X, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_blas_ssyr(CBLAS_UPLO_val(uplo), Double_val(alpha), &v_X, &m_A); return Val_unit; } CAMLprim value ml_gsl_blas_ssyr2(value uplo ,value alpha, value X, value Y, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X, Y); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X, Y); gsl_blas_ssyr2(CBLAS_UPLO_val(uplo), Double_val(alpha), &v_X, &v_Y, &m_A); return Val_unit; } /* LEVEL3 float */ CAMLprim value ml_gsl_blas_sgemm(value transa, value transb, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _CONVERT_MATRIX3(A, B, C); gsl_blas_sgemm(CBLAS_TRANS_val(transa), CBLAS_TRANS_val(transb), Double_val(alpha), &m_A, &m_B, Double_val(beta), &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_sgemm_bc(value *argv, int argc) { return ml_gsl_blas_sgemm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_ssymm(value side, value uplo, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _CONVERT_MATRIX3(A, B, C); gsl_blas_ssymm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), Double_val(alpha), &m_A, &m_B, Double_val(beta), &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_ssymm_bc(value *argv, int argc) { return ml_gsl_blas_ssymm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_ssyrk(value uplo, value trans, value alpha, value A, value beta, value C) { _DECLARE_MATRIX2(A, C); _CONVERT_MATRIX2(A, C); gsl_blas_ssyrk(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(trans), Double_val(alpha), &m_A, Double_val(beta), &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_ssyrk_bc(value *argv, int argc) { return ml_gsl_blas_ssyrk(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_ssyr2k(value uplo, value trans, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _CONVERT_MATRIX3(A, B, C); gsl_blas_ssyr2k(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(trans), Double_val(alpha), &m_A, &m_B, Double_val(beta), &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_ssyr2k_bc(value *argv, int argc) { return ml_gsl_blas_ssyr2k(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_strmm(value side, value uplo, value transa, value diag, value alpha, value A, value B) { _DECLARE_MATRIX2(A, B); _CONVERT_MATRIX2(A, B); gsl_blas_strmm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), Double_val(alpha), &m_A, &m_B); return Val_unit; } CAMLprim value ml_gsl_blas_strmm_bc(value *argv, int argc) { return ml_gsl_blas_strmm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_strsm(value side, value uplo, value transa, value diag, value alpha, value A, value B) { _DECLARE_MATRIX2(A, B); _CONVERT_MATRIX2(A, B); gsl_blas_strsm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), Double_val(alpha), &m_A, &m_B); return Val_unit; } CAMLprim value ml_gsl_blas_strsm_bc(value *argv, int argc) { return ml_gsl_blas_strsm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } orpie-1.5.2/gsl/gsl_error.mli0000644000175000017500000000426512322115103014604 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Error reporting *) (** version of GSL library *) val version : string type errno = | CONTINUE (** iteration has not converged *) | FAILURE | EDOM (** input domain error, e.g sqrt(-1) *) | ERANGE (** output range error, e.g. exp(1e100) *) | EFAULT (** invalid pointer *) | EINVAL (** invalid argument supplied by user *) | EFAILED (** generic failure *) | EFACTOR (** factorization failed *) | ESANITY (** sanity check failed - shouldn't happen *) | ENOMEM (** malloc failed *) | EBADFUNC (** problem with user-supplied function *) | ERUNAWAY (** iterative process is out of control *) | EMAXITER (** exceeded max number of iterations *) | EZERODIV (** tried to divide by zero *) | EBADTOL (** user specified an invalid tolerance *) | ETOL (** failed to reach the specified tolerance *) | EUNDRFLW (** underflow *) | EOVRFLW (** overflow *) | ELOSS (** loss of accuracy *) | EROUND (** failed because of roundoff error *) | EBADLEN (** matrix, vector lengths are not conformant *) | ENOTSQR (** matrix not square *) | ESING (** apparent singularity detected *) | EDIVERGE (** integral or series is divergent *) | EUNSUP (** requested feature is not supported by the hardware *) | EUNIMPL (** requested feature not (yet) implemented *) | ECACHE (** cache limit exceeded *) | ETABLE (** table limit exceeded *) | ENOPROG (** iteration is not making progress towards solution *) | ENOPROGJ (** jacobian evaluations are not improving the solution *) | ETOLF (** cannot reach the specified tolerance in F *) | ETOLX (** cannot reach the specified tolerance in X *) | ETOLG (** cannot reach the specified tolerance in gradient *) | EOF (** end of file *) exception Gsl_exn of (errno * string) val init : unit -> unit val uninit : unit -> unit external strerror : errno -> string = "ml_gsl_strerror" val string_of_errno : errno -> string val pprint_exn : exn -> string val handle_exn : ('a -> 'b) -> 'a -> 'b orpie-1.5.2/gsl/mlgsl_vector_double.c0000644000175000017500000000007512322115103016274 0ustar paulpaul #include "mlgsl_vector_double.h" #include "mlgsl_vector.c" orpie-1.5.2/gsl/mlgsl_blas_complex.c0000644000175000017500000002272612322115103016117 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include "mlgsl_complex.h" #include "mlgsl_vector_complex.h" #include "mlgsl_matrix_complex.h" #include "mlgsl_blas.h" /* LEVEL1 complex */ CAMLprim value ml_gsl_blas_zdotu(value X, value Y) { gsl_complex r; _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_zdotu(&v_X, &v_Y, &r); return copy_complex(&r); } CAMLprim value ml_gsl_blas_zdotc(value X, value Y) { gsl_complex r; _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_zdotc(&v_X, &v_Y, &r); return copy_complex(&r); } CAMLprim value ml_gsl_blas_znrm2(value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); return copy_double(gsl_blas_dznrm2(&v_X)); } CAMLprim value ml_gsl_blas_zasum(value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); return copy_double(gsl_blas_dzasum(&v_X)); } CAMLprim value ml_gsl_blas_izamax(value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); return Val_int(gsl_blas_izamax(&v_X)); } CAMLprim value ml_gsl_blas_zswap(value X, value Y) { _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_zswap(&v_X, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_zcopy(value X, value Y) { _DECLARE_VECTOR2(X, Y); _CONVERT_VECTOR2(X, Y); gsl_blas_zcopy(&v_X, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_zaxpy(value alpha, value X, value Y) { _DECLARE_VECTOR2(X, Y); _DECLARE_COMPLEX(alpha); _CONVERT_VECTOR2(X, Y); _CONVERT_COMPLEX(alpha); gsl_blas_zaxpy(z_alpha, &v_X, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_zscal(value alpha, value X) { _DECLARE_VECTOR(X); _DECLARE_COMPLEX(alpha); _CONVERT_VECTOR(X); _CONVERT_COMPLEX(alpha); gsl_blas_zscal(z_alpha, &v_X); return Val_unit; } CAMLprim value ml_gsl_blas_zdscal(value alpha, value X) { _DECLARE_VECTOR(X); _CONVERT_VECTOR(X); gsl_blas_zdscal(Double_val(alpha), &v_X); return Val_unit; } /* LEVEL2 complex */ CAMLprim value ml_gsl_blas_zgemv(value transa, value alpha, value A, value X, value beta, value Y) { _DECLARE_MATRIX(A); _DECLARE_COMPLEX2(alpha, beta); _DECLARE_VECTOR2(X, Y); _CONVERT_MATRIX(A); _CONVERT_COMPLEX2(alpha, beta); _CONVERT_VECTOR2(X, Y); gsl_blas_zgemv(CBLAS_TRANS_val(transa), z_alpha, &m_A, &v_X, z_beta, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_zgemv_bc(value *argv, int argc) { return ml_gsl_blas_zgemv(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_ztrmv(value uplo, value transa, value diag, value A, value X) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_blas_ztrmv(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), &m_A, &v_X); return Val_unit; } CAMLprim value ml_gsl_blas_ztrsv(value uplo, value transa, value diag, value A, value X) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_blas_ztrsv(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), &m_A, &v_X); return Val_unit; } CAMLprim value ml_gsl_blas_zhemv(value uplo, value alpha, value A, value X, value beta, value Y) { _DECLARE_MATRIX(A); _DECLARE_COMPLEX2(alpha, beta); _DECLARE_VECTOR2(X,Y); _CONVERT_MATRIX(A); _CONVERT_COMPLEX2(alpha, beta); _CONVERT_VECTOR2(X,Y); gsl_blas_zhemv(CBLAS_UPLO_val(uplo), z_alpha, &m_A, &v_X, z_beta, &v_Y); return Val_unit; } CAMLprim value ml_gsl_blas_zhemv_bc(value *argv, int argc) { return ml_gsl_blas_zhemv(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_zgeru(value alpha, value X, value Y, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X,Y); _DECLARE_COMPLEX(alpha); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X,Y); _CONVERT_COMPLEX(alpha); gsl_blas_zgeru(z_alpha, &v_X, &v_Y, &m_A); return Val_unit; } CAMLprim value ml_gsl_blas_zgerc(value alpha, value X, value Y, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X,Y); _DECLARE_COMPLEX(alpha); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X,Y); _CONVERT_COMPLEX(alpha); gsl_blas_zgerc(z_alpha, &v_X, &v_Y, &m_A); return Val_unit; } CAMLprim value ml_gsl_blas_zher(value uplo, value alpha, value X, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR(X); _CONVERT_MATRIX(A); _CONVERT_VECTOR(X); gsl_blas_zher(CBLAS_UPLO_val(uplo), Double_val(alpha), &v_X, &m_A); return Val_unit; } CAMLprim value ml_gsl_blas_zher2(value uplo, value alpha, value X, value Y, value A) { _DECLARE_MATRIX(A); _DECLARE_VECTOR2(X,Y); _DECLARE_COMPLEX(alpha); _CONVERT_MATRIX(A); _CONVERT_VECTOR2(X,Y); _CONVERT_COMPLEX(alpha); gsl_blas_zher2(CBLAS_UPLO_val(uplo), z_alpha, &v_X, &v_Y, &m_A); return Val_unit; } /* LEVEL3 complex */ CAMLprim value ml_gsl_blas_zgemm(value transa, value transb, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _DECLARE_COMPLEX2(alpha, beta); _CONVERT_MATRIX3(A, B, C); _CONVERT_COMPLEX2(alpha, beta); gsl_blas_zgemm(CBLAS_TRANS_val(transa), CBLAS_TRANS_val(transb), z_alpha, &m_A, &m_B, z_beta, &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_zgemm_bc(value *argv, int argc) { return ml_gsl_blas_zgemm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_zsymm(value side, value uplo, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _DECLARE_COMPLEX2(alpha, beta); _CONVERT_MATRIX3(A, B, C); _CONVERT_COMPLEX2(alpha, beta); gsl_blas_zsymm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), z_alpha, &m_A, &m_B, z_beta, &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_zsymm_bc(value *argv, int argc) { return ml_gsl_blas_zsymm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_zsyrk(value uplo, value trans, value alpha, value A, value beta, value C) { _DECLARE_MATRIX2(A, C); _DECLARE_COMPLEX2(alpha, beta); _CONVERT_MATRIX2(A, C); _CONVERT_COMPLEX2(alpha, beta); gsl_blas_zsyrk(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(trans), z_alpha, &m_A, z_beta, &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_zsyrk_bc(value *argv, int argc) { return ml_gsl_blas_zsyrk(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_zsyr2k(value uplo, value trans, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _DECLARE_COMPLEX2(alpha, beta); _CONVERT_MATRIX3(A, B, C); _CONVERT_COMPLEX2(alpha, beta); gsl_blas_zsyr2k(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(trans), z_alpha, &m_A, &m_B, z_beta, &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_zsyr2k_bc(value *argv, int argc) { return ml_gsl_blas_zsyr2k(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_ztrmm(value side, value uplo, value transa, value diag, value alpha, value A, value B) { _DECLARE_MATRIX2(A, B); _DECLARE_COMPLEX(alpha); _CONVERT_MATRIX2(A, B); _CONVERT_COMPLEX(alpha); gsl_blas_ztrmm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), z_alpha, &m_A, &m_B); return Val_unit; } CAMLprim value ml_gsl_blas_ztrmm_bc(value *argv, int argc) { return ml_gsl_blas_ztrmm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_ztrsm(value side, value uplo, value transa, value diag, value alpha, value A, value B) { _DECLARE_MATRIX2(A, B); _DECLARE_COMPLEX(alpha); _CONVERT_MATRIX2(A, B); _CONVERT_COMPLEX(alpha); gsl_blas_ztrsm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa), CBLAS_DIAG_val(diag), z_alpha, &m_A, &m_B); return Val_unit; } CAMLprim value ml_gsl_blas_ztrsm_bc(value *argv, int argc) { return ml_gsl_blas_ztrsm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_zhemm(value side, value uplo, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _DECLARE_COMPLEX2(alpha, beta); _CONVERT_MATRIX3(A, B, C); _CONVERT_COMPLEX2(alpha, beta); gsl_blas_zhemm(CBLAS_SIDE_val(side), CBLAS_UPLO_val(uplo), z_alpha, &m_A, &m_B, z_beta, &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_zhemm_bc(value *argv, int argc) { return ml_gsl_blas_zhemm(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } CAMLprim value ml_gsl_blas_zherk(value uplo, value trans, value alpha, value A, value beta, value C) { _DECLARE_MATRIX2(A, C); _CONVERT_MATRIX2(A, C); gsl_blas_zherk(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(trans), Double_val(alpha), &m_A, Double_val(beta), &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_zherk_bc(value *argv, int argc) { return ml_gsl_blas_zherk(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_blas_zher2k(value uplo, value trans, value alpha, value A, value B, value beta, value C) { _DECLARE_MATRIX3(A, B, C); _DECLARE_COMPLEX(alpha); _CONVERT_MATRIX3(A, B, C); _CONVERT_COMPLEX(alpha); gsl_blas_zher2k(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(trans), z_alpha, &m_A, &m_B, Double_val(beta), &m_C); return Val_unit; } CAMLprim value ml_gsl_blas_zher2k_bc(value *argv, int argc) { return ml_gsl_blas_zher2k(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } orpie-1.5.2/gsl/gsl_vectmat.mli0000644000175000017500000000703512322115103015114 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Generic variant types for vectors and matrices *) (** {3 Real values} *) type vec = [ | `V of Gsl_vector.vector | `VF of Gsl_vector_flat.vector ] val vec_convert : ?protect:bool -> [< `A of float array | `VF of Gsl_vector_flat.vector | `V of Gsl_vector.vector] -> [> vec] type mat = [ | `M of Gsl_matrix.matrix | `MF of Gsl_matrix_flat.matrix ] val mat_convert : ?protect:bool -> [< `M of Gsl_matrix.matrix | `MF of Gsl_matrix_flat.matrix | `A of float array * int * int | `AA of float array array] -> [> mat] val mat_flat : ?protect:bool -> [< `M of Gsl_matrix.matrix | `MF of Gsl_matrix_flat.matrix | `A of float array * int * int | `AA of float array array] -> Gsl_matrix_flat.matrix (** {3 Complex values} *) type cvec = [ | `CV of Gsl_vector_complex.vector | `CVF of Gsl_vector_complex_flat.vector ] type cmat = [ | `CM of Gsl_matrix_complex.matrix | `CMF of Gsl_matrix_complex_flat.matrix ] val cmat_convert : ?protect:bool -> [< `CM of Gsl_matrix_complex.matrix | `CMF of Gsl_matrix_complex_flat.matrix | `CA of Gsl_complex.complex_array * int * int ] -> [> cmat] (** {3 Generic vector operations} *) val length : [< vec| cvec] -> int val to_array : [< vec] -> float array val v_copy : [< vec] -> [> vec] val subvector : [< vec] -> off:int -> len:int -> [> vec] external v_memcpy : [< vec] -> [< vec] -> unit = "ml_gsl_vector_memcpy" external v_add : [< vec] -> [< vec] -> unit = "ml_gsl_vector_add" external v_sub : [< vec] -> [< vec] -> unit = "ml_gsl_vector_sub" external v_mul : [< vec] -> [< vec] -> unit = "ml_gsl_vector_mul" external v_div : [< vec] -> [< vec] -> unit = "ml_gsl_vector_div" external v_max : [< vec] -> float = "ml_gsl_vector_max" external v_min : [< vec] -> float = "ml_gsl_vector_min" external v_minmax : [< vec] -> float * float = "ml_gsl_vector_minmax" external v_max_index : [< vec] -> int = "ml_gsl_vector_maxindex" external v_min_index : [< vec] -> int = "ml_gsl_vector_minindex" external v_minmax_index : [< vec] -> int * int = "ml_gsl_vector_minmaxindex" (** {3 Generic matrix operations} *) val dims : [< mat| cmat] -> int * int val tmp : [< mat] -> [> `M of Gsl_matrix.matrix] val to_arrays : [< mat] -> float array array val m_copy : [< mat] -> [> mat] external m_memcpy : [< mat] -> [< mat] -> unit = "ml_gsl_matrix_memcpy" external m_add : [< mat] -> [< mat] -> unit = "ml_gsl_matrix_add" external m_sub : [< mat] -> [< mat] -> unit = "ml_gsl_matrix_sub" external m_mul : [< mat] -> [< mat] -> unit = "ml_gsl_matrix_mul" external m_div : [< mat] -> [< mat] -> unit = "ml_gsl_matrix_div" external m_add_diagonal : [< mat] -> float -> unit = "ml_gsl_matrix_add_diagonal" external swap_rows : [< mat] -> int -> int -> unit = "ml_gsl_matrix_swap_rows" external swap_columns : [< mat] -> int -> int -> unit = "ml_gsl_matrix_swap_columns" external swap_rowcol : [< mat] -> int -> int -> unit = "ml_gsl_matrix_swap_rowcol" external transpose : [< mat] -> [< mat] -> unit = "ml_gsl_matrix_transpose_memcpy" external transpose_in_place : [< mat] -> unit = "ml_gsl_matrix_transpose" (** {3 Other generic operations} *) val is_null : [< vec | mat] -> bool val scale : [< vec | mat] -> float -> unit val add_constant : [< vec | mat] -> float -> unit orpie-1.5.2/gsl/gsl_linalg.ml0000644000175000017500000002472012322115103014546 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) open Gsl_vectmat open Gsl_complex (* Simple matrix multiplication *) external matmult : a:mat -> ?transpa:bool -> b:mat -> ?transpb:bool -> mat -> unit = "ml_gsl_linalg_matmult_mod" (* LU decomposition *) (* Low-level functions *) external _LU_decomp : mat -> Gsl_permut.permut -> int = "ml_gsl_linalg_LU_decomp" external _LU_solve : mat -> Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_LU_solve" external _LU_svx : mat -> Gsl_permut.permut -> vec -> unit = "ml_gsl_linalg_LU_svx" external _LU_refine : a:mat -> lu:mat -> Gsl_permut.permut -> b:vec -> x:vec -> res:vec -> unit = "ml_gsl_linalg_LU_refine_bc" "ml_gsl_linalg_LU_refine" external _LU_invert : mat -> Gsl_permut.permut -> mat -> unit = "ml_gsl_linalg_LU_invert" external _LU_det : mat -> int -> float = "ml_gsl_linalg_LU_det" external _LU_lndet : mat -> float = "ml_gsl_linalg_LU_lndet" external _LU_sgndet : mat -> int -> int = "ml_gsl_linalg_LU_sgndet" (* Higher-level functions *) (* With these, the arguments are protected (copied) and necessary intermediate datastructures are allocated; *) let decomp_LU ?(protect=true) mat = let mA = mat_convert ~protect mat in let (len, _) = Gsl_vectmat.dims mA in let p = Gsl_permut.create len in let sign = _LU_decomp mA p in (mA, p, sign) let solve_LU ?(protect=true) mat b = let mA = mat_convert ~protect mat in let vB = vec_convert b in let (len, _) = Gsl_vectmat.dims mA in let p = Gsl_permut.create len in let _ = _LU_decomp mA p in let x = Gsl_vector_flat.create len in _LU_solve mA p vB (`VF x) ; x.Gsl_vector_flat.data let det_LU ?(protect=true) mat = let (lu, _, sign) = decomp_LU ~protect mat in _LU_det lu sign let invert_LU ?(protect=true) ?result mat = let (lu, lu_p, _) = decomp_LU ~protect mat in let result = match result with | Some r -> r | None -> Gsl_vectmat.tmp lu in _LU_invert lu lu_p result ; result (* Complex LU decomposition *) external complex_LU_decomp : cmat -> Gsl_permut.permut -> int = "ml_gsl_linalg_complex_LU_decomp" external complex_LU_solve : cmat -> Gsl_permut.permut -> b:cvec -> x:cvec -> unit = "ml_gsl_linalg_complex_LU_solve" external complex_LU_svx : cmat -> Gsl_permut.permut -> cvec -> unit = "ml_gsl_linalg_complex_LU_svx" external complex_LU_refine : a:cmat -> lu:cmat -> Gsl_permut.permut -> b:cvec -> x:cvec -> res:cvec -> unit = "ml_gsl_linalg_complex_LU_refine_bc" "ml_gsl_linalg_complex_LU_refine" external complex_LU_invert : cmat -> Gsl_permut.permut -> cmat -> unit = "ml_gsl_linalg_complex_LU_invert" external complex_LU_det : cmat -> int -> complex = "ml_gsl_linalg_complex_LU_det" external complex_LU_lndet : cmat -> float = "ml_gsl_linalg_complex_LU_lndet" external complex_LU_sgndet : cmat -> int -> complex = "ml_gsl_linalg_complex_LU_sgndet" (* QR decomposition *) external _QR_decomp : mat -> vec -> unit = "ml_gsl_linalg_QR_decomp" external _QR_solve : mat -> vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_QR_solve" external _QR_svx : mat -> vec -> x:vec -> unit = "ml_gsl_linalg_QR_svx" external _QR_lssolve : mat -> vec -> b:vec -> x:vec -> res:vec -> unit = "ml_gsl_linalg_QR_lssolve" external _QR_QTvec : mat -> vec -> v:vec -> unit = "ml_gsl_linalg_QR_QTvec" external _QR_Qvec : mat -> vec -> v:vec -> unit = "ml_gsl_linalg_QR_Qvec" external _QR_Rsolve : mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_QR_Rsolve" external _QR_Rsvx : mat -> x:vec -> unit = "ml_gsl_linalg_QR_Rsvx" external _QR_unpack : mat -> tau:vec -> q:mat -> r:mat -> unit = "ml_gsl_linalg_QR_unpack" external _QR_QRsolve : mat -> r:mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_QR_QRsolve" external _QR_update : mat -> r:mat -> w:vec -> v:vec -> unit = "ml_gsl_linalg_QR_update" external _R_solve : r:mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_R_solve" (* external _R_svx : r:mat -> x:vec -> unit*) (* = "ml_gsl_linalg_R_svx"*) (* QR Decomposition with Column Pivoting *) external _QRPT_decomp : a:mat -> tau:vec -> p:Gsl_permut.permut -> norm:vec -> int = "ml_gsl_linalg_QRPT_decomp" external _QRPT_decomp2 : a:mat -> q:mat -> r:mat -> tau:vec -> p:Gsl_permut.permut -> norm:vec -> int = "ml_gsl_linalg_QRPT_decomp2_bc" "ml_gsl_linalg_QRPT_decomp2" external _QRPT_solve : qr:mat -> tau:vec -> p:Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_QRPT_solve" external _QRPT_svx : qr:mat -> tau:vec -> p:Gsl_permut.permut -> x:vec -> unit = "ml_gsl_linalg_QRPT_svx" external _QRPT_QRsolve : q:mat -> r:mat -> p:Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_QRPT_QRsolve" external _QRPT_update : q:mat -> r:mat -> p:Gsl_permut.permut -> u:vec -> v:vec -> unit = "ml_gsl_linalg_QRPT_update" external _QRPT_Rsolve : qr:mat -> p:Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_QRPT_Rsolve" external _QRPT_Rsvx : qr:mat -> p:Gsl_permut.permut -> x:vec -> unit = "ml_gsl_linalg_QRPT_Rsolve" (* Singular Value Decomposition *) external _SV_decomp : a:mat -> v:mat -> s:vec -> work:vec -> unit = "ml_gsl_linalg_SV_decomp" external _SV_decomp_mod : a:mat -> x:mat -> v:mat -> s:vec -> work:vec -> unit = "ml_gsl_linalg_SV_decomp_mod" external _SV_decomp_jacobi : a:mat -> v:mat -> s:vec -> unit = "ml_gsl_linalg_SV_decomp_jacobi" external _SV_solve : u:mat -> v:mat -> s:vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_SV_solve" (* LQ decomposition *) external _LQ_decomp : a:mat -> tau:vec -> unit = "ml_gsl_linalg_LQ_decomp" external _LQ_solve_T : lq:mat -> tau:vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_LQ_solve_T" external _LQ_svx_T : lq:mat -> tau:vec -> x:vec -> unit = "ml_gsl_linalg_LQ_svx_T" external _LQ_lssolve_T : lq:mat -> tau:vec -> b:vec -> x:vec -> res:vec -> unit = "ml_gsl_linalg_LQ_lssolve_T" external _LQ_Lsolve_T : lq:mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_LQ_Lsolve_T" external _LQ_Lsvx_T : lq:mat -> x:vec -> unit = "ml_gsl_linalg_LQ_Lsvx_T" external _L_solve_T : l:mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_L_solve_T" external _LQ_vecQ : lq:mat -> tau:vec -> v:vec -> unit = "ml_gsl_linalg_LQ_vecQ" external _LQ_vecQT : lq:mat -> tau:vec -> v:vec -> unit = "ml_gsl_linalg_LQ_vecQT" external _LQ_unpack : lq:mat -> tau:vec -> q:mat -> l:mat -> unit = "ml_gsl_linalg_LQ_unpack" external _LQ_update : q:mat -> r:mat -> v:vec -> w:vec -> unit = "ml_gsl_linalg_LQ_update" external _LQ_LQsolve : q:mat -> l:mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_LQ_LQsolve" (* P^T L Q decomposition *) external _PTLQ_decomp : a:mat -> tau:vec -> Gsl_permut.permut -> norm:vec -> int = "ml_gsl_linalg_PTLQ_decomp" external _PTLQ_decomp2 : a:mat -> q:mat -> r:mat -> tau:vec -> Gsl_permut.permut -> norm:vec -> int = "ml_gsl_linalg_PTLQ_decomp2_bc" "ml_gsl_linalg_PTLQ_decomp2" external _PTLQ_solve_T : qr:mat -> tau:vec -> Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_PTLQ_solve_T" external _PTLQ_svx_T : lq:mat -> tau:vec -> Gsl_permut.permut -> x:vec -> unit = "ml_gsl_linalg_PTLQ_svx_T" external _PTLQ_LQsolve_T : q:mat -> l:mat -> Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_PTLQ_LQsolve_T" external _PTLQ_Lsolve_T : lq:mat -> Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_PTLQ_Lsolve_T" external _PTLQ_Lsvx_T : lq:mat -> Gsl_permut.permut -> x:vec -> unit = "ml_gsl_linalg_PTLQ_Lsvx_T" external _PTLQ_update : q:mat -> l:mat -> Gsl_permut.permut -> v:vec -> w:vec -> unit = "ml_gsl_linalg_PTLQ_update" (* Cholesky decomposition *) external cho_decomp : mat -> unit = "ml_gsl_linalg_cholesky_decomp" external cho_solve : mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_cholesky_solve" external cho_svx : mat -> vec -> unit = "ml_gsl_linalg_cholesky_svx" external cho_decomp_unit : mat -> vec -> unit = "ml_gsl_linalg_cholesky_decomp_unit" (* Tridiagonal Decomposition of Real Symmetric Matrices *) external symmtd_decomp : a:mat -> tau:vec -> unit = "ml_gsl_linalg_symmtd_decomp" external symmtd_unpack : a:mat -> tau:vec -> q:mat -> diag:vec -> subdiag:vec -> unit = "ml_gsl_linalg_symmtd_unpack" external symmtd_unpack_T : a:mat -> diag:vec -> subdiag:vec -> unit = "ml_gsl_linalg_symmtd_unpack_T" (* Tridiagonal Decomposition of Hermitian Matrices *) external hermtd_decomp : a:cmat -> tau:cvec -> unit = "ml_gsl_linalg_hermtd_decomp" external hermtd_unpack : a:cmat -> tau:cvec -> q:cmat -> diag:vec -> subdiag:vec -> unit = "ml_gsl_linalg_hermtd_unpack" external hermtd_unpack_T : a:cmat -> diag:vec -> subdiag:vec -> unit = "ml_gsl_linalg_hermtd_unpack_T" (* Bidiagonalization *) external bidiag_decomp : a:mat -> tau_u:vec -> tau_v:vec -> unit = "ml_gsl_linalg_bidiag_decomp" external bidiag_unpack : a:mat -> tau_u:vec -> u:mat -> tau_v:vec -> v:mat -> diag:vec -> superdiag:vec -> unit = "ml_gsl_linalg_bidiag_unpack_bc" "ml_gsl_linalg_bidiag_unpack" external bidiag_unpack2 : a:mat -> tau_u:vec -> tau_v:vec -> v:mat -> unit = "ml_gsl_linalg_bidiag_unpack2" external bidiag_unpack_B : a:mat -> diag:vec -> superdiag:vec -> unit = "ml_gsl_linalg_bidiag_unpack_B" (* Householder solver *) external _HH_solve : mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_HH_solve" external _HH_svx : mat -> vec -> unit = "ml_gsl_linalg_HH_svx" let solve_HH ?(protect=true) mat b = let mA = mat_convert ~protect mat in let vB = vec_convert b in let vX = Gsl_vector_flat.create (Gsl_vectmat.length vB) in _HH_solve mA vB (`VF vX) ; vX.Gsl_vector_flat.data (* Tridiagonal Systems *) external solve_symm_tridiag : diag:vec -> offdiag:vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_solve_symm_tridiag" external solve_tridiag : diag:vec -> abovediag:vec -> belowdiag:vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_solve_tridiag" external solve_symm_cyc_tridiag : diag:vec -> offdiag:vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_solve_symm_cyc_tridiag" external solve_cyc_tridiag : diag:vec -> abovediag:vec -> belowdiag:vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_solve_cyc_tridiag" (* exponential *) external _exponential : mat -> mat -> Gsl_fun.mode -> unit = "ml_gsl_linalg_exponential_ss" let exponential ?(mode=Gsl_fun.DOUBLE) mat = let mA = Gsl_vectmat.mat_convert mat in let eA = Gsl_vectmat.tmp mA in _exponential mA (eA : [`M of Gsl_matrix.matrix] :> mat) mode ; eA orpie-1.5.2/gsl/mlgsl_vector_double.h0000644000175000017500000000017512322115103016302 0ustar paulpaul #define BASE_TYPE double #define CONV_FLAT #define TYPE(t) t #define FUNCTION(a,b) a ## _ ## b #include "mlgsl_vector.h" orpie-1.5.2/gsl/gsl_vectmat.ml0000644000175000017500000001317312322115103014743 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) type vec = [ | `V of Gsl_vector.vector | `VF of Gsl_vector_flat.vector ] let vec_convert ?(protect=false) = function | `A arr when protect -> `VF (Gsl_vector_flat.of_array arr) | `A arr -> `VF (Gsl_vector_flat.view_array arr) | `VF vec when protect -> `VF (Gsl_vector_flat.copy vec) | `VF vec as v -> v | `V vec when protect -> `V (Gsl_vector.copy vec) | `V vec as v -> v type mat = [ | `M of Gsl_matrix.matrix | `MF of Gsl_matrix_flat.matrix ] let mat_convert ?(protect=false) = function | `M mat when protect -> `M (Gsl_matrix.copy mat) | `M mat as m -> m | `MF mat when protect -> `MF (Gsl_matrix_flat.copy mat) | `MF mat as m -> m | `A (arr, d1, d2) when protect -> `MF (Gsl_matrix_flat.of_array arr d1 d2) | `A (arr, d1, d2) -> `MF (Gsl_matrix_flat.view_array arr d1 d2) | `AA arr -> `MF (Gsl_matrix_flat.of_arrays arr) let mat_flat ?(protect=false) = function | `M mat -> let (d1, d2) = Gsl_matrix.dims mat in let arr = Gsl_matrix.to_array mat in Gsl_matrix_flat.view_array arr d1 d2 | `MF mat when protect -> Gsl_matrix_flat.copy mat | `MF mat -> mat | `A (arr, d1, d2) when protect -> Gsl_matrix_flat.of_array arr d1 d2 | `A (arr, d1, d2) -> Gsl_matrix_flat.view_array arr d1 d2 | `AA arr -> Gsl_matrix_flat.of_arrays arr (* Complex values *) type cvec = [ | `CV of Gsl_vector_complex.vector | `CVF of Gsl_vector_complex_flat.vector ] type cmat = [ | `CM of Gsl_matrix_complex.matrix | `CMF of Gsl_matrix_complex_flat.matrix ] let cmat_convert ?(protect=false) = function | `CM mat when protect -> `CM (Gsl_matrix_complex.copy mat) | `CM mat as m -> m | `CMF mat when protect -> `CMF (Gsl_matrix_complex_flat.copy mat) | `CMF mat as m -> m | `CA (arr, d1, d2) when protect -> `CMF (Gsl_matrix_complex_flat.of_complex_array arr d1 d2) | `CA (arr, d1, d2) -> `CMF (Gsl_matrix_complex_flat.view_complex_array arr d1 d2) (* Generic vector operations *) let length = function | `VF v -> Gsl_vector_flat.length v | `V v -> Gsl_vector.length v | `CV v -> Gsl_vector_complex.length v | `CVF v -> Gsl_vector_complex_flat.length v let to_array = function | `VF v -> Gsl_vector_flat.to_array v | `V v -> Gsl_vector.to_array v let v_copy = function | `VF v -> `VF (Gsl_vector_flat.copy v) | `V v -> `V (Gsl_vector.copy v) let subvector v ~off ~len = match v with | `VF v -> `VF (Gsl_vector_flat.subvector v ~off ~len) | `V v -> `V (Gsl_vector.subvector v ~off ~len) external v_memcpy : [< vec]-> [< vec]-> unit = "ml_gsl_vector_memcpy" external v_add : [< vec]-> [< vec]-> unit = "ml_gsl_vector_add" external v_sub : [< vec]-> [< vec]-> unit = "ml_gsl_vector_sub" external v_mul : [< vec]-> [< vec]-> unit = "ml_gsl_vector_mul" external v_div : [< vec]-> [< vec]-> unit = "ml_gsl_vector_div" external v_scale : [< vec]-> float -> unit = "ml_gsl_vector_scale" external v_add_constant : [< vec]-> float -> unit = "ml_gsl_vector_add_constant" external v_is_null : [< vec]-> bool = "ml_gsl_vector_isnull" external v_max : [< vec]-> float = "ml_gsl_vector_max" external v_min : [< vec]-> float = "ml_gsl_vector_min" external v_minmax : [< vec]-> float * float = "ml_gsl_vector_minmax" external v_max_index : [< vec]-> int = "ml_gsl_vector_maxindex" external v_min_index : [< vec]-> int = "ml_gsl_vector_minindex" external v_minmax_index : [< vec]-> int * int = "ml_gsl_vector_minmaxindex" (* Generic matrix operations *) let dims = function | `MF v -> Gsl_matrix_flat.dims v | `M v -> Gsl_matrix.dims v | `CM m -> Gsl_matrix_complex.dims m | `CMF m -> Gsl_matrix_complex_flat.dims m let to_arrays = function | `M mat -> Gsl_matrix.to_arrays mat | `MF mat -> Gsl_matrix_flat.to_arrays mat let tmp mat = let (d1, d2) = dims mat in `M (Gsl_matrix.create d1 d2) let m_copy = function | `MF v -> `MF (Gsl_matrix_flat.copy v) | `M v -> `M (Gsl_matrix.copy v) external m_memcpy : [< mat] -> [< mat] -> unit = "ml_gsl_matrix_memcpy" external m_add : [< mat] -> [< mat] -> unit = "ml_gsl_matrix_add" external m_sub : [< mat] -> [< mat] -> unit = "ml_gsl_matrix_sub" external m_mul : [< mat] -> [< mat] -> unit = "ml_gsl_matrix_mul" external m_div : [< mat] -> [< mat] -> unit = "ml_gsl_matrix_div" external m_scale : [< mat] -> float -> unit = "ml_gsl_matrix_scale" external m_add_constant : [< mat] -> float -> unit = "ml_gsl_matrix_add_constant" external m_add_diagonal : [< mat] -> float -> unit = "ml_gsl_matrix_add_diagonal" external m_is_null : [< mat] -> bool = "ml_gsl_matrix_isnull" external swap_rows : [< mat] -> int -> int -> unit = "ml_gsl_matrix_swap_rows" external swap_columns : [< mat] -> int -> int -> unit = "ml_gsl_matrix_swap_columns" external swap_rowcol : [< mat] -> int -> int -> unit = "ml_gsl_matrix_swap_rowcol" external transpose : [< mat] -> [< mat] -> unit = "ml_gsl_matrix_transpose_memcpy" external transpose_in_place : [< mat] -> unit = "ml_gsl_matrix_transpose" let is_null x = match x with | `VF _ | `V _ as v -> v_is_null v | `MF _ | `M _ as m -> m_is_null m let scale x c = match x with | `VF _ | `V _ as v -> v_scale v c | `MF _ | `M _ as m -> m_scale m c let add_constant x c = match x with | `VF _ | `V _ as v -> v_add_constant v c | `MF _ | `M _ as m -> m_add_constant m c orpie-1.5.2/gsl/mlgsl_matrix_double.h0000644000175000017500000000034212322115103016300 0ustar paulpaul #define BASE_TYPE double #define CONV_FLAT #define TYPE(t) t #define _DECLARE_BASE_TYPE(v) double conv_##v #define _CONVERT_BASE_TYPE(v) conv_##v = Double_val(v) #define FUNCTION(a,b) a ## _ ## b #include "mlgsl_matrix.h" orpie-1.5.2/gsl/gsl_vector_complex_flat.ml0000644000175000017500000000465112322115103017340 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) type complex_vector_flat = { data : float array ; off : int ; len : int ; stride : int ; } type vector = complex_vector_flat let create ?(init=Complex.zero) len = let arr = { data = Array.create (2*len) init.Complex.re ; off = 0; len = len; stride = 1; } in if init.Complex.im <> init.Complex.re then for i=0 to pred len do arr.data.(2*i+1) <- init.Complex.im done ; arr let of_array arr = let carr = Gsl_complex.pack arr in { data = carr; off = 0; len = Array.length arr; stride = 1; } let length { len = len } = len let get v i = Gsl_complex.get v.data (v.off + i*v.stride) let set v i d = Gsl_complex.set v.data (v.off + i*v.stride) d let set_all v d = for i=0 to pred v.len do set v i d done let set_zero v = set_all v Complex.zero let set_basis v i = set_zero v ; set v i Complex.one let to_array v = Array.init v.len (get v) let of_complex_array carr = { data = Array.copy carr; off = 0; len = (Array.length carr)/2; stride = 1; } let to_complex_array arr = let carr = Array.create (2*arr.len) 0. in for i=0 to pred arr.len do Gsl_complex.set carr i (get arr i) done ; carr let real carr = Gsl_vector_flat.view_array ~stride:(2 * carr.stride) ~off:(2 * carr.off) ~len:carr.len carr.data let imag carr = Gsl_vector_flat.view_array ~stride:(2 * carr.stride) ~off:(2 * carr.off + 1) ~len:carr.len carr.data let subvector ?(stride=1) v ~off ~len = { v with off = off * v.stride + v.off ; len = len ; stride = stride * v.stride ; } let view_complex_array ?(stride=1) ?(off=0) ?len arr = let alen = Array.length arr in if alen mod 2 <> 0 then invalid_arg "complex_array dim" ; let len = match len with | None -> alen / 2 | Some l -> l in { data = arr ; off = off ; stride = stride ; len = len } let memcpy v w = if v.len <> w.len then invalid_arg "Gsl_vector.memcpy" ; for i=0 to pred v.len do set w i (get v i) done let copy v = { v with data = Array.copy v.data } let swap_element v i j = let d = get v i in let d' = get v j in set v j d ; set v i d' let reverse v = for i=0 to pred (v.len/2) do swap_element v i (pred v.len - i) done orpie-1.5.2/gsl/gsl_blas.mli0000644000175000017500000002705612322115103014377 0ustar paulpaul (** BLAS support *) type order = | RowMajor | ColMajor type transpose = | NoTrans | Trans | ConjTrans type uplo = | Upper | Lower type diag = | NonUnit | Unit type side = | Left | Right open Gsl_matrix open Gsl_vector (** {3 LEVEL 1} *) external dot : vector -> vector -> float = "ml_gsl_blas_ddot" external nrm2 : vector -> float = "ml_gsl_blas_dnrm2" external asum : vector -> float = "ml_gsl_blas_dasum" external iamax : vector -> int = "ml_gsl_blas_idamax" external swap : vector -> vector -> unit = "ml_gsl_blas_dswap" external copy : vector -> vector -> unit = "ml_gsl_blas_dcopy" external axpy : float -> vector -> vector -> unit = "ml_gsl_blas_daxpy" external rot : vector -> vector -> float -> float -> unit = "ml_gsl_blas_drot" external scal : float -> vector -> unit = "ml_gsl_blas_dscal" (** {3 LEVEL 2} *) external gemv : transpose -> alpha:float -> a:matrix -> x:vector -> beta:float -> y:vector -> unit = "ml_gsl_blas_dgemv_bc" "ml_gsl_blas_dgemv" external trmv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_dtrmv" external trsv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_dtrsv" external symv : uplo -> alpha:float -> a:matrix -> x:vector -> beta:float -> y:vector -> unit = "ml_gsl_blas_dsymv_bc" "ml_gsl_blas_dsymv" external dger : alpha:float -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_dger" external syr : uplo -> alpha:float -> x:vector -> a:matrix -> unit = "ml_gsl_blas_dsyr" external syr2 : uplo -> alpha:float -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_dsyr2" (** {3 LEVEL 3} *) external gemm : ta:transpose -> tb:transpose -> alpha:float -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_dgemm_bc" "ml_gsl_blas_dgemm" external symm : side -> uplo -> alpha:float -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_dsymm_bc" "ml_gsl_blas_dsymm" external trmm : side -> uplo -> transpose -> diag -> alpha:float -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_dtrmm_bc" "ml_gsl_blas_dtrmm" external trsm : side -> uplo -> transpose -> diag -> alpha:float -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_dtrsm_bc" "ml_gsl_blas_dtrsm" external syrk : uplo -> transpose -> alpha:float -> a:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_dsyrk_bc" "ml_gsl_blas_dsyrk" external syr2k : uplo -> transpose -> alpha:float -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_dsyr2k_bc" "ml_gsl_blas_dsyr2k" (** {3 Single precision} *) open Gsl_vector.Single open Gsl_matrix.Single module Single : sig (** {4 LEVEL 1} *) external sdsdot : alpha:float -> vector -> vector -> float = "ml_gsl_blas_sdsdot" external dsdot : vector -> vector -> float = "ml_gsl_blas_dsdot" external dot : vector -> vector -> float = "ml_gsl_blas_sdot" external nrm2 : vector -> float = "ml_gsl_blas_snrm2" external asum : vector -> float = "ml_gsl_blas_sasum" external iamax : vector -> int = "ml_gsl_blas_isamax" external swap : vector -> vector -> unit = "ml_gsl_blas_sswap" external copy : vector -> vector -> unit = "ml_gsl_blas_scopy" external axpy : float -> vector -> vector -> unit = "ml_gsl_blas_saxpy" external rot : vector -> vector -> float -> float -> unit = "ml_gsl_blas_srot" external scal : float -> vector -> unit = "ml_gsl_blas_sscal" (** {4 LEVEL 2} *) external gemv : transpose -> alpha:float -> a:matrix -> x:vector -> beta:float -> y:vector -> unit = "ml_gsl_blas_sgemv_bc" "ml_gsl_blas_sgemv" external trmv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_strmv" external trsv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_strsv" external symv : uplo -> alpha:float -> a:matrix -> x:vector -> beta:float -> y:vector -> unit = "ml_gsl_blas_ssymv_bc" "ml_gsl_blas_ssymv" external dger : alpha:float -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_sger" external syr : uplo -> alpha:float -> x:vector -> a:matrix -> unit = "ml_gsl_blas_ssyr" external syr2 : uplo -> alpha:float -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_ssyr2" (** {4 LEVEL 3} *) external gemm : ta:transpose -> tb:transpose -> alpha:float -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_sgemm_bc" "ml_gsl_blas_sgemm" external symm : side -> uplo -> alpha:float -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_ssymm_bc" "ml_gsl_blas_ssymm" external syrk : uplo -> transpose -> alpha:float -> a:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_ssyrk_bc" "ml_gsl_blas_ssyrk" external syr2k : uplo -> transpose -> alpha:float -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_ssyr2k_bc" "ml_gsl_blas_ssyr2k" external trmm : side -> uplo -> transpose -> diag -> alpha:float -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_strmm_bc" "ml_gsl_blas_strmm" external trsm : side -> uplo -> transpose -> diag -> alpha:float -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_strsm_bc" "ml_gsl_blas_strsm" end (** {3 Complex} *) open Gsl_vector_complex open Gsl_matrix_complex open Gsl_complex module Complex : sig (** {4 LEVEL 1} *) external dotu : vector -> vector -> complex = "ml_gsl_blas_zdotu" external dotc : vector -> vector -> complex = "ml_gsl_blas_zdotc" external nrm2 : vector -> float = "ml_gsl_blas_znrm2" external asum : vector -> float = "ml_gsl_blas_zasum" external iamax : vector -> int = "ml_gsl_blas_izamax" external swap : vector -> vector -> unit = "ml_gsl_blas_zswap" external copy : vector -> vector -> unit = "ml_gsl_blas_zcopy" external axpy : complex -> vector -> vector -> unit = "ml_gsl_blas_zaxpy" external scal : complex -> vector -> unit = "ml_gsl_blas_zscal" external zdscal : float -> vector -> unit = "ml_gsl_blas_zdscal" (** {4 LEVEL 2} *) external gemv : transpose -> alpha:complex -> a:matrix -> x:vector -> beta:complex -> y:vector -> unit = "ml_gsl_blas_zgemv_bc" "ml_gsl_blas_zgemv" external trmv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_ztrmv" external trsv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_ztrsv" external hemv : uplo -> alpha:complex -> a:matrix -> x:vector -> beta:complex -> y:vector -> unit = "ml_gsl_blas_zhemv_bc" "ml_gsl_blas_zhemv" external geru : alpha:complex -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_zgeru" external gerc : alpha:complex -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_zgerc" external her : uplo -> alpha:float -> x:vector -> a:matrix -> unit = "ml_gsl_blas_zher" external her2 : uplo -> alpha:complex -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_zher2" (** {4 LEVEL 3} *) external gemm : ta:transpose -> tb:transpose -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_zgemm_bc" "ml_gsl_blas_zgemm" external symm : side -> uplo -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_zsymm_bc" "ml_gsl_blas_zsymm" external syrk : uplo -> transpose -> alpha:complex -> a:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_zsyrk_bc" "ml_gsl_blas_zsyrk" external syr2k : uplo -> transpose -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_zsyr2k_bc" "ml_gsl_blas_zsyr2k" external trmm : side -> uplo -> transpose -> diag -> alpha:complex -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_ztrmm_bc" "ml_gsl_blas_ztrmm" external trsm : side -> uplo -> transpose -> diag -> alpha:complex -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_ztrsm_bc" "ml_gsl_blas_ztrsm" external hemm : side -> uplo -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_zhemm_bc" "ml_gsl_blas_zhemm" external herk : uplo -> transpose -> alpha:float -> a:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_zherk_bc" "ml_gsl_blas_zherk" external her2k : uplo -> transpose -> alpha:complex -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_zher2k_bc" "ml_gsl_blas_zher2k" end (** {3 Complex single precision} *) open Gsl_vector_complex.Single open Gsl_matrix_complex.Single open Gsl_complex module Complex_Single : sig (** {4 LEVEL 1} *) external dotu : vector -> vector -> complex = "ml_gsl_blas_cdotu" external dotc : vector -> vector -> complex = "ml_gsl_blas_cdotc" external nrm2 : vector -> float = "ml_gsl_blas_scnrm2" external asum : vector -> float = "ml_gsl_blas_scasum" external iamax : vector -> int = "ml_gsl_blas_icamax" external swap : vector -> vector -> unit = "ml_gsl_blas_cswap" external copy : vector -> vector -> unit = "ml_gsl_blas_ccopy" external axpy : complex -> vector -> vector -> unit = "ml_gsl_blas_caxpy" external scal : complex -> vector -> unit = "ml_gsl_blas_cscal" external csscal : float -> vector -> unit = "ml_gsl_blas_csscal" (** {4 LEVEL 2} *) external gemv : transpose -> alpha:complex -> a:matrix -> x:vector -> beta:complex -> y:vector -> unit = "ml_gsl_blas_cgemv_bc" "ml_gsl_blas_cgemv" external trmv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_ctrmv" external trsv : uplo -> transpose -> diag -> a:matrix -> x:vector -> unit = "ml_gsl_blas_ctrsv" external hemv : uplo -> alpha:complex -> a:matrix -> x:vector -> beta:complex -> y:vector -> unit = "ml_gsl_blas_chemv_bc" "ml_gsl_blas_chemv" external geru : alpha:complex -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_cgeru" external gerc : alpha:complex -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_cgerc" external her : uplo -> alpha:float -> x:vector -> a:matrix -> unit = "ml_gsl_blas_cher" external her2 : uplo -> alpha:complex -> x:vector -> y:vector -> a:matrix -> unit = "ml_gsl_blas_cher2" (** {4 LEVEL 3} *) external gemm : ta:transpose -> tb:transpose -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_cgemm_bc" "ml_gsl_blas_cgemm" external symm : side -> uplo -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_csymm_bc" "ml_gsl_blas_csymm" external syrk : uplo -> transpose -> alpha:complex -> a:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_csyrk_bc" "ml_gsl_blas_csyrk" external syr2k : uplo -> transpose -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_csyr2k_bc" "ml_gsl_blas_csyr2k" external trmm : side -> uplo -> transpose -> diag -> alpha:complex -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_ctrmm_bc" "ml_gsl_blas_ctrmm" external trsm : side -> uplo -> transpose -> diag -> alpha:complex -> a:matrix -> b:matrix -> unit = "ml_gsl_blas_ctrsm_bc" "ml_gsl_blas_ctrsm" external hemm : side -> uplo -> alpha:complex -> a:matrix -> b:matrix -> beta:complex -> c:matrix -> unit = "ml_gsl_blas_chemm_bc" "ml_gsl_blas_chemm" external herk : uplo -> transpose -> alpha:float -> a:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_cherk_bc" "ml_gsl_blas_cherk" external her2k : uplo -> transpose -> alpha:complex -> a:matrix -> b:matrix -> beta:float -> c:matrix -> unit = "ml_gsl_blas_cher2k_bc" "ml_gsl_blas_cher2k" end orpie-1.5.2/gsl/mlgsl_matrix.h0000644000175000017500000000347212322115103014755 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include #include "wrappers.h" #ifndef TYPE #error pb with include files #endif static inline void TYPE(mlgsl_mat_of_bigarray)(TYPE(gsl_matrix) *cmat, value vmat){ struct caml_bigarray *bigarr = Bigarray_val(vmat); cmat->block = NULL; cmat->owner = 0; cmat->size1 = bigarr->dim[0]; cmat->size2 = bigarr->dim[1]; cmat->tda = bigarr->dim[1]; cmat->data = bigarr->data; } #ifdef CONV_FLAT static inline void TYPE(mlgsl_mat_of_floatarray)(TYPE(gsl_matrix) *cmat, value vmat){ cmat->block = NULL; cmat->owner = 0; cmat->size1 = Int_val(Field(vmat, 2)); cmat->size2 = Int_val(Field(vmat, 3)); cmat->tda = Int_val(Field(vmat, 4)); cmat->data = (double *) Field(vmat, 0) + Int_val(Field(vmat, 1)); } #endif static inline void TYPE(mlgsl_mat_of_value)(TYPE(gsl_matrix) *cmat, value vmat){ if(Tag_val(vmat) == 0 && Wosize_val(vmat) == 2) /* value is a polymorphic variant */ vmat = Field(vmat, 1); if(Tag_val(vmat) == Custom_tag) /* value is a bigarray */ TYPE(mlgsl_mat_of_bigarray)(cmat, vmat); #ifdef CONV_FLAT else /* value is a record wrapping a float array */ TYPE(mlgsl_mat_of_floatarray)(cmat, vmat); #endif } #define _DECLARE_MATRIX(a) TYPE(gsl_matrix) m_##a #define _DECLARE_MATRIX2(a,b) _DECLARE_MATRIX(a); _DECLARE_MATRIX(b) #define _DECLARE_MATRIX3(a,b,c) _DECLARE_MATRIX2(a,b); _DECLARE_MATRIX(c) #define _CONVERT_MATRIX(a) TYPE(mlgsl_mat_of_value)(&m_##a, a) #define _CONVERT_MATRIX2(a,b) _CONVERT_MATRIX(a); _CONVERT_MATRIX(b) #define _CONVERT_MATRIX3(a,b,c) _CONVERT_MATRIX2(a,b); _CONVERT_MATRIX(c) orpie-1.5.2/gsl/gsl_vector_complex.mli0000644000175000017500000000363612322115103016505 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Vector of complex numbers implemented with a [Bigarray] *) open Bigarray open Gsl_complex type complex_double_vector_bigarr = (Complex.t, complex64_elt, c_layout) Array1.t type vector = complex_double_vector_bigarr val create : ?init:complex -> int -> vector val of_array : complex array -> vector val to_array : vector -> complex array val of_complex_array : complex_array -> vector val to_complex_array : vector -> complex_array val length : vector -> int val get : vector -> int -> complex val set : vector -> int -> complex -> unit val set_all : vector -> complex -> unit val set_zero : vector -> unit val set_basis : vector -> int -> unit val memcpy : src:vector -> dst:vector -> unit val copy : vector -> vector val swap_element : vector -> int -> int -> unit val reverse : vector -> unit val subvector : vector -> off:int -> len:int -> vector module Single : sig type complex_float_vector_bigarr = (Complex.t, complex32_elt, c_layout) Array1.t type vector = complex_float_vector_bigarr val create : ?init:complex -> int -> vector val of_array : complex array -> vector val to_array : vector -> complex array val of_complex_array : complex_array -> vector val to_complex_array : vector -> complex_array val length : vector -> int val get : vector -> int -> complex val set : vector -> int -> complex -> unit val set_all : vector -> complex -> unit val set_zero : vector -> unit val set_basis : vector -> int -> unit val memcpy : src:vector -> dst:vector -> unit val copy : vector -> vector val swap_element : vector -> int -> int -> unit val reverse : vector -> unit val subvector : vector -> off:int -> len:int -> vector end orpie-1.5.2/gsl/gsl_permut.ml0000644000175000017500000000341612322115103014613 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) open Bigarray type permut = (int, int_elt, c_layout) Array1.t let of_array arr = Array1.of_array int c_layout arr let to_array perm = let len = Array1.dim perm in Array.init len (Array1.get perm) external init : permut -> unit = "ml_gsl_permutation_init" let create len = Array1.create int c_layout len let make len = let p = create len in init p ; p let swap p i j = let tmp_i = p.{i} in let tmp_j = p.{j} in p.{i} <- tmp_j ; p.{j} <- tmp_i let size = Array1.dim external _valid : permut -> bool = "ml_gsl_permutation_valid" let valid p = try _valid p with Gsl_error.Gsl_exn (Gsl_error.FAILURE, _) -> false external reverse : permut -> unit = "ml_gsl_permutation_reverse" external _inverse : src:permut -> dst:permut -> unit = "ml_gsl_permutation_inverse" let inverse p = let i = create (size p) in _inverse p i ; i external next : permut -> unit = "ml_gsl_permutation_next" external prev : permut -> unit = "ml_gsl_permutation_prev" external permute : permut -> 'a array -> unit = "ml_gsl_permute" external permute_barr : permut -> ('a, 'b, 'c) Bigarray.Array1.t -> unit = "ml_gsl_permute_barr" external permute_complex : permut -> Gsl_complex.complex_array -> unit = "ml_gsl_permute_complex" external permute_inverse : permut -> 'a array -> unit = "ml_gsl_permute_inverse" external permute_inverse_barr : permut -> ('a, 'b, 'c) Bigarray.Array1.t -> unit = "ml_gsl_permute_inverse_barr" external permute_inverse_complex : permut -> Gsl_complex.complex_array -> unit = "ml_gsl_permute_inverse_complex" orpie-1.5.2/gsl/mlgsl_matrix_float.c0000644000175000017500000000007412322115103016130 0ustar paulpaul #include "mlgsl_matrix_float.h" #include "mlgsl_matrix.c" orpie-1.5.2/gsl/mlgsl_sf.c0000644000175000017500000004156512322115103014061 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include #include #include #include #include "wrappers.h" static inline value val_of_result(gsl_sf_result *result) { return copy_two_double_arr(result->val, result->err); } static value val_of_result_pair (gsl_sf_result *re, gsl_sf_result *im) { CAMLparam0 (); CAMLlocal3 (v, v_re, v_im); v_re = val_of_result (re); v_im = val_of_result (im); v = alloc_small (2, 0); Field (v, 0) = v_re; Field (v, 1) = v_im; CAMLreturn (v); } static inline value val_of_result_e10(gsl_sf_result_e10 *result) { CAMLparam0(); CAMLlocal3(r, v, e) ; v = copy_double(result->val); e = copy_double(result->err); r = alloc_small(3, 0); Field(r, 0) = v; Field(r, 1) = e; Field(r, 2) = Val_int(result->e10); CAMLreturn(r); } CAMLprim value ml_gsl_sf_result_smash_e(value e10) { gsl_sf_result r; gsl_sf_result_e10 e = { /*.val =*/ Double_val(Field(e10, 0)), /*.err =*/ Double_val(Field(e10, 1)), /*.e10 =*/ Int_val(Field(e10, 2)) } ; gsl_sf_result_smash_e(&e, &r); return val_of_result(&r); } #define GSL_MODE_val Int_val #define ML1_res(name, conv1) \ CAMLprim value ml_##name(value arg1) \ { gsl_sf_result res; \ name(conv1(arg1), &res); \ return val_of_result(&res); } #define ML2_res(name, conv1, conv2) \ CAMLprim value ml_##name(value arg1, value arg2) \ { gsl_sf_result res; \ name(conv1(arg1), conv2(arg2), &res); \ return val_of_result(&res); } #define ML3_res(name, conv1, conv2, conv3) \ CAMLprim value ml_##name(value arg1, value arg2, value arg3) \ { gsl_sf_result res; \ name(conv1(arg1), conv2(arg2), conv3(arg3), &res); \ return val_of_result(&res); } #define ML4_res(name, conv1, conv2, conv3, conv4) \ CAMLprim value ml_##name(value arg1, value arg2, value arg3, value arg4) \ { gsl_sf_result res; \ name(conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4), &res); \ return val_of_result(&res); } #define ML5_res(name, conv1, conv2, conv3, conv4, conv5) \ CAMLprim value ml_##name(value arg1, value arg2, value arg3, value arg4, value arg5) \ { gsl_sf_result res; \ name(conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4), conv5(arg5), &res); \ return val_of_result(&res); } #define SF1(name, conv1) \ ML1(gsl_sf_##name, conv1, copy_double) \ ML1_res(gsl_sf_##name##_e, conv1) #define SF2(name, conv1, conv2) \ ML2(gsl_sf_##name, conv1, conv2, copy_double) \ ML2_res(gsl_sf_##name##_e, conv1, conv2) #define SF3(name, conv1, conv2, conv3) \ ML3(gsl_sf_##name, conv1, conv2, conv3, copy_double) \ ML3_res(gsl_sf_##name##_e, conv1, conv2, conv3) #define SF4(name, conv1, conv2, conv3, conv4) \ ML4(gsl_sf_##name, conv1, conv2, conv3, conv4, copy_double) \ ML4_res(gsl_sf_##name##_e, conv1, conv2, conv3, conv4) #define SF5(name, conv1, conv2, conv3, conv4, conv5) \ ML5(gsl_sf_##name, conv1, conv2, conv3, conv4, conv5, copy_double) \ ML5_res(gsl_sf_##name##_e, conv1, conv2, conv3, conv4, conv5) /* AIRY functions */ SF2(airy_Ai, Double_val, GSL_MODE_val) SF2(airy_Bi, Double_val, GSL_MODE_val) SF2(airy_Ai_scaled, Double_val, GSL_MODE_val) SF2(airy_Bi_scaled, Double_val, GSL_MODE_val) SF2(airy_Ai_deriv, Double_val, GSL_MODE_val) SF2(airy_Bi_deriv, Double_val, GSL_MODE_val) SF2(airy_Ai_deriv_scaled, Double_val, GSL_MODE_val) SF2(airy_Bi_deriv_scaled, Double_val, GSL_MODE_val) SF1(airy_zero_Ai, Int_val) SF1(airy_zero_Bi, Int_val) SF1(airy_zero_Ai_deriv, Int_val) SF1(airy_zero_Bi_deriv, Int_val) /* BESSEL functions */ #define BESSEL_CYL(l) \ SF1(bessel_##l##0, Double_val) \ SF1(bessel_##l##1, Double_val) \ SF2(bessel_##l##n, Int_val, Double_val) \ value ml_gsl_sf_bessel_##l##n_array(value nmin, value x, value r_arr){\ int NMIN=Int_val(nmin); \ int NMAX=NMIN+Double_array_length(r_arr)-1; \ gsl_sf_bessel_##l##n_array(NMIN, NMAX, Double_val(x), Double_array_val(r_arr));\ return Val_unit; } #define BESSEL_CYL_SCALED(l) \ SF1(bessel_##l##0_scaled, Double_val) \ SF1(bessel_##l##1_scaled, Double_val) \ SF2(bessel_##l##n_scaled, Int_val, Double_val) \ value ml_gsl_sf_bessel_##l##n_scaled_array(value nmin, value x, value r_arr){\ int NMIN=Int_val(nmin); \ int NMAX=NMIN+Double_array_length(r_arr)-1; \ gsl_sf_bessel_##l##n_array(NMIN, NMAX, Double_val(x), Double_array_val(r_arr));\ return Val_unit; } BESSEL_CYL(J) BESSEL_CYL(Y) BESSEL_CYL(I) BESSEL_CYL_SCALED(I) BESSEL_CYL(K) BESSEL_CYL_SCALED(K) #define BESSEL_SPH(c) \ SF1(bessel_##c##0, Double_val) \ SF1(bessel_##c##1, Double_val) \ SF1(bessel_##c##2, Double_val) \ SF2(bessel_##c##l, Int_val, Double_val) \ value ml_gsl_sf_bessel_##c##l_array(value x, value r_arr){\ int LMAX=Double_array_length(r_arr)-1; \ gsl_sf_bessel_##c##l_array(LMAX, Double_val(x), Double_array_val(r_arr));\ return Val_unit; } #define BESSEL_SPH_SCALED(c) \ SF1(bessel_##c##0_scaled, Double_val) \ SF1(bessel_##c##1_scaled, Double_val) \ SF2(bessel_##c##l_scaled, Int_val, Double_val) \ value ml_gsl_sf_bessel_##c##l_scaled_array(value x, value r_arr){\ int LMAX=Double_array_length(r_arr)-1; \ gsl_sf_bessel_##c##l_scaled_array(LMAX, Double_val(x), Double_array_val(r_arr));\ return Val_unit; } BESSEL_SPH(j) CAMLprim value ml_gsl_sf_bessel_jl_steed_array(value x, value x_arr) { gsl_sf_bessel_jl_steed_array(Double_array_length(x_arr)-1, Double_val(x), Double_array_val(x_arr)); return Val_unit; } BESSEL_SPH(y) BESSEL_SPH_SCALED(i) BESSEL_SPH_SCALED(k) SF2(bessel_Jnu, Double_val, Double_val) CAMLprim value ml_gsl_sf_bessel_sequence_Jnu_e(value nu, value mode, value x) { gsl_sf_bessel_sequence_Jnu_e(Double_val(nu), GSL_MODE_val(mode), Double_array_length(x), Double_array_val(x)); return Val_unit; } SF2(bessel_Ynu, Double_val, Double_val) SF2(bessel_Inu, Double_val, Double_val) SF2(bessel_Inu_scaled, Double_val, Double_val) SF2(bessel_Knu, Double_val, Double_val) SF2(bessel_lnKnu, Double_val, Double_val) SF2(bessel_Knu_scaled, Double_val, Double_val) SF1(bessel_zero_J0, Int_val) SF1(bessel_zero_J1, Int_val) SF2(bessel_zero_Jnu, Double_val, Int_val) /* CLAUSEN functions */ SF1(clausen, Double_val) /* COULOMB functions */ SF2(hydrogenicR_1, Double_val, Double_val) SF4(hydrogenicR, Int_val, Int_val, Double_val, Double_val) /* FIXME: COULOMB wave functions */ ML2_res(gsl_sf_coulomb_CL_e, Double_val, Double_val) CAMLprim value ml_gsl_sf_coulomb_CL_array(value lmin, value eta, value c_arr) { gsl_sf_coulomb_CL_array(Double_val(lmin), Double_array_length(c_arr)-1, Double_val(eta), Double_array_val(c_arr)); return Val_unit; } /* FIXME: coupling coeffs */ /* DAWSON function */ SF1(dawson, Double_val) /* DEBYE functions */ SF1(debye_1, Double_val) SF1(debye_2, Double_val) SF1(debye_3, Double_val) SF1(debye_4, Double_val) SF1(debye_5, Double_val) SF1(debye_6, Double_val) /* DILOGARITHM */ SF1(dilog, Double_val) CAMLprim value ml_gsl_sf_complex_dilog_e(value r, value theta) { gsl_sf_result re,im; gsl_sf_complex_dilog_e(Double_val(r), Double_val(theta), &re, &im); return val_of_result_pair (&re, &im); } CAMLprim value ml_gsl_sf_complex_dilog_xy_e(value x, value y) { gsl_sf_result re, im; gsl_sf_complex_dilog_xy_e (Double_val(x), Double_val(y), &re, &im); return val_of_result_pair (&re, &im); } CAMLprim value ml_gsl_sf_complex_spence_xy_e(value x, value y) { gsl_sf_result re, im; gsl_sf_complex_spence_xy_e (Double_val(x), Double_val(y), &re, &im); return val_of_result_pair (&re, &im); } /* ELEMENTARY operations */ ML2_res(gsl_sf_multiply_e, Double_val, Double_val) ML4_res(gsl_sf_multiply_err_e, Double_val, Double_val, Double_val, Double_val) /* ELLIPTIC integrals */ SF2(ellint_Kcomp, Double_val, GSL_MODE_val) SF2(ellint_Ecomp, Double_val, GSL_MODE_val) SF3(ellint_Pcomp, Double_val, Double_val, GSL_MODE_val) SF2(ellint_Dcomp, Double_val, GSL_MODE_val) SF3(ellint_F, Double_val, Double_val, GSL_MODE_val) SF3(ellint_E, Double_val, Double_val, GSL_MODE_val) SF4(ellint_P, Double_val, Double_val, Double_val, GSL_MODE_val) SF4(ellint_D, Double_val, Double_val, Double_val, GSL_MODE_val) SF3(ellint_RC, Double_val, Double_val, GSL_MODE_val) SF4(ellint_RD, Double_val, Double_val, Double_val, GSL_MODE_val) SF4(ellint_RF, Double_val, Double_val, Double_val, GSL_MODE_val) SF5(ellint_RJ, Double_val, Double_val, Double_val, Double_val, GSL_MODE_val) /* FIXME: gsl_sf_elljac_e */ /* ERROR functions */ SF1(erf, Double_val) SF1(erfc, Double_val) SF1(log_erfc, Double_val) SF1(erf_Z, Double_val) SF1(erf_Q, Double_val) /* EXPONENTIAL functions */ SF1(exp, Double_val) CAMLprim value ml_gsl_sf_exp_e10_e(value x) { gsl_sf_result_e10 res; gsl_sf_exp_e10_e(Double_val(x), &res); return val_of_result_e10(&res); } SF2(exp_mult, Double_val, Double_val) CAMLprim value ml_gsl_sf_exp_mult_e10_e(value x, value y) { gsl_sf_result_e10 res; gsl_sf_exp_mult_e10_e(Double_val(x), Double_val(y), &res); return val_of_result_e10(&res); } SF1(expm1, Double_val) SF1(exprel, Double_val) SF1(exprel_2, Double_val) SF2(exprel_n, Int_val, Double_val) ML2_res(gsl_sf_exp_err_e, Double_val, Double_val) CAMLprim value ml_gsl_sf_exp_err_e10_e(value x, value dx) { gsl_sf_result_e10 res; gsl_sf_exp_err_e10_e(Double_val(x), Double_val(dx), &res); return val_of_result_e10(&res); } ML4_res(gsl_sf_exp_mult_err_e, Double_val, Double_val, Double_val, Double_val) CAMLprim value ml_gsl_sf_exp_mult_err_e10_e(value x, value dx, value y, value dy) { gsl_sf_result_e10 res; gsl_sf_exp_mult_err_e10_e(Double_val(x), Double_val(dx), Double_val(y), Double_val(dy), &res); return val_of_result_e10(&res); } /* EXPONENTIAL integrals */ SF1(expint_E1, Double_val) SF1(expint_E2, Double_val) SF1(expint_E1_scaled, Double_val) SF1(expint_E2_scaled, Double_val) SF1(expint_Ei, Double_val) SF1(expint_Ei_scaled, Double_val) SF1(Shi, Double_val) SF1(Chi, Double_val) SF1(expint_3, Double_val) SF1(Si, Double_val) SF1(Ci, Double_val) SF1(atanint, Double_val) /* FERMI-DIRAC functions */ SF1(fermi_dirac_m1, Double_val) SF1(fermi_dirac_0, Double_val) SF1(fermi_dirac_1, Double_val) SF1(fermi_dirac_2, Double_val) SF2(fermi_dirac_int, Int_val, Double_val) SF1(fermi_dirac_mhalf, Double_val) SF1(fermi_dirac_half, Double_val) SF1(fermi_dirac_3half, Double_val) SF2(fermi_dirac_inc_0, Double_val, Double_val) /* GAMMA function */ SF1(gamma, Double_val) SF1(lngamma, Double_val) CAMLprim value ml_gsl_sf_lngamma_sgn_e(value x) { gsl_sf_result res; double sgn; gsl_sf_lngamma_sgn_e(Double_val(x), &res, &sgn); { CAMLparam0(); CAMLlocal3(v,r,s); r=val_of_result(&res); s=copy_double(sgn); v=alloc_small(2, 0); Field(v, 0)=r; Field(v, 1)=s; CAMLreturn(v); } } SF1(gammastar, Double_val) SF1(gammainv, Double_val) CAMLprim value ml_gsl_sf_lngamma_complex_e(value zr, value zi) { gsl_sf_result lnr, arg; gsl_sf_lngamma_complex_e(Double_val(zr), Double_val(zi),&lnr, &arg); return val_of_result_pair (&lnr, &arg); } SF2(taylorcoeff, Int_val, Double_val) SF1(fact, Int_val) SF1(doublefact, Int_val) SF1(lnfact, Int_val) SF1(lndoublefact, Int_val) SF2(choose, Int_val, Int_val) SF2(lnchoose, Int_val, Int_val) SF2(poch, Double_val, Double_val) SF2(lnpoch, Double_val, Double_val) CAMLprim value ml_gsl_sf_lnpoch_sgn_e(value a, value x) { gsl_sf_result res; double sgn; gsl_sf_lnpoch_sgn_e(Double_val(a), Double_val(x), &res, &sgn); { CAMLparam0(); CAMLlocal3(v,r,s); r=val_of_result(&res); s=copy_double(sgn); v=alloc_small(2, 0); Field(v, 0)=r; Field(v, 1)=s; CAMLreturn(v); } } SF2(pochrel, Double_val, Double_val) SF2(gamma_inc_Q, Double_val, Double_val) SF2(gamma_inc_P, Double_val, Double_val) SF2(gamma_inc, Double_val, Double_val) SF2(beta, Double_val, Double_val) SF2(lnbeta, Double_val, Double_val) CAMLprim value ml_gsl_sf_lnbeta_sgn_e(value x, value y) { gsl_sf_result res; double sgn; gsl_sf_lnbeta_sgn_e(Double_val(x), Double_val(y), &res, &sgn); { CAMLparam0(); CAMLlocal3(v,r,s); r=val_of_result(&res); s=copy_double(sgn); v=alloc_small(2, 0); Field(v, 0)=r; Field(v, 1)=s; CAMLreturn(v); } } SF3(beta_inc, Double_val, Double_val, Double_val) /* GEGENBAUER functions */ SF2(gegenpoly_1, Double_val, Double_val) SF2(gegenpoly_2, Double_val, Double_val) SF2(gegenpoly_3, Double_val, Double_val) SF3(gegenpoly_n, Int_val, Double_val, Double_val) CAMLprim value ml_gsl_sf_gegenpoly_array(value lambda, value x, value r_arr) { gsl_sf_gegenpoly_array(Double_array_length(r_arr)-1, Double_val(lambda), Double_val(x), Double_array_val(r_arr)); return Val_unit; } /* HYPERGEOMETRIC functions */ /* FIXME */ /* LAGUERRE functions */ SF2(laguerre_1, Double_val, Double_val) SF2(laguerre_2, Double_val, Double_val) SF2(laguerre_3, Double_val, Double_val) SF3(laguerre_n, Int_val, Double_val, Double_val) /* LAMBERT W functions */ SF1(lambert_W0, Double_val) SF1(lambert_Wm1, Double_val) /* LEGENDRE functions */ SF1(legendre_P1, Double_val) SF1(legendre_P2, Double_val) SF1(legendre_P3, Double_val) SF2(legendre_Pl, Int_val, Double_val) CAMLprim value ml_gsl_sf_legendre_Pl_array(value x, value r_arr) { gsl_sf_legendre_Pl_array(Double_array_length(r_arr)-1, Double_val(x), Double_array_val(r_arr)); return Val_unit; } SF1(legendre_Q0, Double_val) SF1(legendre_Q1, Double_val) SF2(legendre_Ql, Int_val, Double_val) /* Associated Legendre Polynomials and Spherical Harmonics */ SF3(legendre_Plm, Int_val, Int_val, Double_val) CAMLprim value ml_gsl_sf_legendre_Plm_array(value lmax, value m, value x, value result_array) { gsl_sf_legendre_Plm_array(Int_val(lmax), Int_val(m), Double_val(x), Double_array_val(result_array)); return Val_unit; } SF3(legendre_sphPlm, Int_val, Int_val, Double_val) CAMLprim value ml_gsl_sf_legendre_sphPlm_array(value lmax, value m, value x, value result_array) { gsl_sf_legendre_sphPlm_array(Int_val(lmax), Int_val(m), Double_val(x), Double_array_val(result_array)); return Val_unit; } CAMLprim value ml_gsl_sf_legendre_array_size(value lmax, value m) { CAMLparam2(lmax, m); CAMLlocal1(ret); int gsl_ret; gsl_ret = gsl_sf_legendre_array_size(Int_val(lmax), Int_val(m)); ret = Val_int(gsl_ret); CAMLreturn(ret); } /* LOGARITHM and related functions */ SF1(log, Double_val) SF1(log_abs, Double_val) CAMLprim value ml_gsl_sf_complex_log_e(value zr, value zi) { gsl_sf_result lnr, theta; gsl_sf_complex_log_e(Double_val(zr), Double_val(zi), &lnr, &theta); return val_of_result_pair (&lnr, &theta); } SF1(log_1plusx, Double_val) SF1(log_1plusx_mx, Double_val) /* POWER function */ SF2(pow_int, Double_val, Int_val) /* PSI functions */ SF1(psi_int, Int_val) SF1(psi, Double_val) SF1(psi_1piy, Double_val) CAMLprim value ml_gsl_sf_complex_psi_e(value x, value y) { gsl_sf_result r_re, r_im; gsl_sf_complex_psi_e (Double_val(x), Double_val(y), &r_re, &r_im); return val_of_result_pair (&r_re, &r_im); } SF1(psi_1_int, Int_val) SF1(psi_1, Double_val) SF2(psi_n, Int_val, Double_val) /* SYNCHROTRON functions */ SF1(synchrotron_1, Double_val) SF1(synchrotron_2, Double_val) /* TRANSPORT functions */ SF1(transport_2, Double_val) SF1(transport_3, Double_val) SF1(transport_4, Double_val) SF1(transport_5, Double_val) /* TRIGONOMETRIC functions */ SF1(sin, Double_val) SF1(cos, Double_val) SF2(hypot, Double_val, Double_val) SF1(sinc, Double_val) CAMLprim value ml_gsl_sf_complex_sin_e(value zr, value zi) { gsl_sf_result szr, szi; gsl_sf_complex_sin_e(Double_val(zr), Double_val(zi), &szr, &szi); return val_of_result_pair (&szr, &szi); } CAMLprim value ml_gsl_sf_complex_cos_e(value zr, value zi) { gsl_sf_result szr, szi; gsl_sf_complex_cos_e(Double_val(zr), Double_val(zi), &szr, &szi); return val_of_result_pair (&szr, &szi); } CAMLprim value ml_gsl_sf_complex_logsin_e(value zr, value zi) { gsl_sf_result lszr, lszi; gsl_sf_complex_logsin_e(Double_val(zr), Double_val(zi), &lszr, &lszi); return val_of_result_pair (&lszr, &lszi); } SF1(lnsinh, Double_val) SF1(lncosh, Double_val) CAMLprim value ml_gsl_sf_polar_to_rect(value r, value theta) { gsl_sf_result x, y; gsl_sf_polar_to_rect(Double_val(r), Double_val(theta), &x, &y); return val_of_result_pair (&x, &y); } CAMLprim value ml_gsl_sf_rect_to_polar(value x, value y) { gsl_sf_result r, theta; gsl_sf_rect_to_polar(Double_val(x), Double_val(y), &r, &theta); return val_of_result_pair (&r, &theta); } ML1(gsl_sf_angle_restrict_symm, Double_val, copy_double) ML1(gsl_sf_angle_restrict_pos, Double_val, copy_double) ML2_res(gsl_sf_sin_err_e, Double_val, Double_val) ML2_res(gsl_sf_cos_err_e, Double_val, Double_val) /* ZETA functions */ SF1(zeta_int, Int_val) SF1(zeta, Double_val) SF2(hzeta, Double_val, Double_val) SF1(eta_int, Int_val) SF1(eta, Double_val) orpie-1.5.2/gsl/mlgsl_vector.h0000644000175000017500000000404712322115103014752 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include #include "wrappers.h" #ifndef TYPE #error pb with include files #endif static inline void TYPE(mlgsl_vec_of_bigarray)(TYPE(gsl_vector) *cvec, value vvec){ struct caml_bigarray *bigarr = Bigarray_val(vvec); cvec->block = NULL; cvec->owner = 0; cvec->size = bigarr->dim[0]; cvec->stride = 1; cvec->data = bigarr->data; } #ifdef CONV_FLAT static inline void TYPE(mlgsl_vec_of_floatarray)(TYPE(gsl_vector) *cvec, value vvec){ cvec->block = NULL; cvec->owner = 0; cvec->size = Int_val(Field(vvec, 2)); cvec->stride = Int_val(Field(vvec, 3)); cvec->data = (double *)Field(vvec, 0) + Int_val(Field(vvec, 1)); } #endif static inline void TYPE(mlgsl_vec_of_value)(TYPE(gsl_vector) *cvec, value vvec){ if(Tag_val(vvec) == 0 && Wosize_val(vvec) == 2) /* value is a polymorphic variant */ vvec = Field(vvec, 1); if(Tag_val(vvec) == Custom_tag) /* value is a bigarray */ TYPE(mlgsl_vec_of_bigarray)(cvec, vvec); #ifdef CONV_FLAT else /* value is a record wrapping a float array */ TYPE(mlgsl_vec_of_floatarray)(cvec, vvec); #endif } #define _DECLARE_VECTOR(a) TYPE(gsl_vector) v_##a #define _DECLARE_VECTOR2(a,b) _DECLARE_VECTOR(a); _DECLARE_VECTOR(b) #define _DECLARE_VECTOR3(a,b,c) _DECLARE_VECTOR2(a,b); _DECLARE_VECTOR(c) #define _DECLARE_VECTOR4(a,b,c,d) _DECLARE_VECTOR2(a,b); _DECLARE_VECTOR2(c,d) #define _DECLARE_VECTOR5(a,b,c,d,e) _DECLARE_VECTOR4(a,b,c,d); _DECLARE_VECTOR(e) #define _CONVERT_VECTOR(a) TYPE(mlgsl_vec_of_value)(&v_##a, a) #define _CONVERT_VECTOR2(a,b) _CONVERT_VECTOR(a); _CONVERT_VECTOR(b) #define _CONVERT_VECTOR3(a,b,c) _CONVERT_VECTOR2(a,b); _CONVERT_VECTOR(c) #define _CONVERT_VECTOR4(a,b,c,d) _CONVERT_VECTOR2(a,b); _CONVERT_VECTOR2(c,d) #define _CONVERT_VECTOR5(a,b,c,d,e) _CONVERT_VECTOR4(a,b,c,d); _CONVERT_VECTOR(e) orpie-1.5.2/gsl/mlgsl_fun.c0000644000175000017500000002603312322115103014232 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include #include #include #include #include #include #include "wrappers.h" #include "mlgsl_fun.h" /* CALLBACKS */ double gslfun_callback(double x, void *params) { struct callback_params *p=params; value res; value v_x = copy_double(x); res=callback_exn(p->closure, v_x); if(Is_exception_result(res)) return GSL_NAN; return Double_val(res); } double gslfun_callback_indir(double x, void *params) { value res; value v_x = copy_double(x); value *closure = params; res=callback_exn(*closure, v_x); if(Is_exception_result(res)) return GSL_NAN; return Double_val(res); } /* FDF CALLBACKS */ double gslfun_callback_f(double x, void *params) { struct callback_params *p=params; value res; value v_x=copy_double(x); res=callback_exn(Field(p->closure, 0), v_x); if(Is_exception_result(res)) return GSL_NAN; return Double_val(res); } double gslfun_callback_df(double x, void *params) { struct callback_params *p=params; value res; value v_x=copy_double(x); res=callback_exn(Field(p->closure, 1), v_x); if(Is_exception_result(res)) return GSL_NAN; return Double_val(res); } void gslfun_callback_fdf(double x, void *params, double *f, double *df) { struct callback_params *p=params; value res; value v_x=copy_double(x); res=callback_exn(Field(p->closure, 2), v_x); if(Is_exception_result(res)){ *f=GSL_NAN; *df=GSL_NAN; return; } *f =Double_val(Field(res, 0)); *df=Double_val(Field(res, 1)); } /* MONTE CALLBACKS */ double gsl_monte_callback(double *x_arr, size_t dim, void *params) { struct callback_params *p=params; value res; memcpy(Double_array_val(p->dbl), x_arr, dim*sizeof(double)); res=callback_exn(p->closure, p->dbl); if(Is_exception_result(res)) return GSL_NAN; return Double_val(res); } double gsl_monte_callback_fast(double *x_arr, size_t dim, void *params) { struct callback_params *p=params; value res; res=callback_exn(p->closure, (value)x_arr); if(Is_exception_result(res)) return GSL_NAN; return Double_val(res); } /* MULTIROOT CALLBACKS */ int gsl_multiroot_callback(const gsl_vector *x, void *params, gsl_vector *F) { int barr_flags = BIGARRAY_FLOAT64 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL; struct callback_params *p=params; value x_barr, f_barr; int len = x->size; LOCALARRAY(double, x_arr, len); LOCALARRAY(double, f_arr, len); gsl_vector_view x_v, f_v; value res; x_v = gsl_vector_view_array(x_arr, len); f_v = gsl_vector_view_array(f_arr, len); gsl_vector_memcpy(&x_v.vector, x); x_barr = alloc_bigarray_dims(barr_flags, 1, x_arr, len); f_barr = alloc_bigarray_dims(barr_flags, 1, f_arr, len); res=callback2_exn(p->closure, x_barr, f_barr); if(Is_exception_result(res)) return GSL_FAILURE; gsl_vector_memcpy(F, &f_v.vector); return GSL_SUCCESS; } int gsl_multiroot_callback_f(const gsl_vector *x, void *params, gsl_vector *F) { int barr_flags = BIGARRAY_FLOAT64 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL; struct callback_params *p=params; value x_barr, f_barr; int len = x->size; LOCALARRAY(double, x_arr, len); LOCALARRAY(double, f_arr, len); gsl_vector_view x_v, f_v; value res; x_v = gsl_vector_view_array(x_arr, len); f_v = gsl_vector_view_array(f_arr, len); gsl_vector_memcpy(&x_v.vector, x); x_barr = alloc_bigarray_dims(barr_flags, 1, x_arr, len); f_barr = alloc_bigarray_dims(barr_flags, 1, f_arr, len); res=callback2_exn(Field(p->closure, 0), x_barr, f_barr); if(Is_exception_result(res)) return GSL_FAILURE; gsl_vector_memcpy(F, &f_v.vector); return GSL_SUCCESS; } int gsl_multiroot_callback_df(const gsl_vector *x, void *params, gsl_matrix *J) { int barr_flags = BIGARRAY_FLOAT64 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL; struct callback_params *p=params; value x_barr, j_barr; int len = x->size; LOCALARRAY(double, x_arr, len); LOCALARRAY(double, j_arr, len*len); gsl_vector_view x_v; gsl_matrix_view j_v; value res; x_v = gsl_vector_view_array(x_arr, len); j_v = gsl_matrix_view_array(j_arr, len, len); gsl_vector_memcpy(&x_v.vector, x); x_barr = alloc_bigarray_dims(barr_flags, 1, x_arr, len); j_barr = alloc_bigarray_dims(barr_flags, 2, j_arr, len, len); res=callback2_exn(Field(p->closure, 1), x_barr, j_barr); if(Is_exception_result(res)) return GSL_FAILURE; gsl_matrix_memcpy(J, &j_v.matrix); return GSL_SUCCESS; } int gsl_multiroot_callback_fdf(const gsl_vector *x, void *params, gsl_vector *F, gsl_matrix *J) { int barr_flags = BIGARRAY_FLOAT64 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL; struct callback_params *p=params; value x_barr, f_barr, j_barr; int len = x->size; LOCALARRAY(double, x_arr, len); LOCALARRAY(double, f_arr, len); LOCALARRAY(double, j_arr, len*len); gsl_vector_view x_v, f_v; gsl_matrix_view j_v; value res; x_v = gsl_vector_view_array(x_arr, len); f_v = gsl_vector_view_array(f_arr, len); j_v = gsl_matrix_view_array(j_arr, len, len); gsl_vector_memcpy(&x_v.vector, x); x_barr = alloc_bigarray_dims(barr_flags, 1, x_arr, len); f_barr = alloc_bigarray_dims(barr_flags, 1, f_arr, len); j_barr = alloc_bigarray_dims(barr_flags, 2, j_arr, len, len); res=callback3_exn(Field(p->closure, 2), x_barr, f_barr, j_barr); if(Is_exception_result(res)) return GSL_FAILURE; gsl_vector_memcpy(F, &f_v.vector); gsl_matrix_memcpy(J, &j_v.matrix); return GSL_SUCCESS; } /* MULTIMIN CALLBACKS */ double gsl_multimin_callback(const gsl_vector *x, void *params) { int barr_flags = BIGARRAY_FLOAT64 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL; struct callback_params *p=params; value x_barr; int len = x->size; LOCALARRAY(double, x_arr, len); gsl_vector_view x_v; value res; x_v = gsl_vector_view_array(x_arr, len); gsl_vector_memcpy(&x_v.vector, x); x_barr = alloc_bigarray_dims(barr_flags, 1, x_arr, len); res=callback_exn(p->closure, x_barr); if(Is_exception_result(res)) return GSL_NAN; return Double_val(res); } double gsl_multimin_callback_f(const gsl_vector *x, void *params) { int barr_flags = BIGARRAY_FLOAT64 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL; struct callback_params *p=params; value x_barr; int len = x->size; LOCALARRAY(double, x_arr, len); gsl_vector_view x_v; value res; x_v = gsl_vector_view_array(x_arr, len); gsl_vector_memcpy(&x_v.vector, x); x_barr = alloc_bigarray_dims(barr_flags, 1, x_arr, len); res=callback_exn(Field(p->closure, 0), x_barr); if(Is_exception_result(res)) return GSL_NAN; return Double_val(res); } void gsl_multimin_callback_df(const gsl_vector *x, void *params, gsl_vector *G) { int barr_flags = BIGARRAY_FLOAT64 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL; struct callback_params *p=params; value x_barr, g_barr; int len = x->size; LOCALARRAY(double, x_arr, len); LOCALARRAY(double, g_arr, len); gsl_vector_view x_v, g_v; value res; x_v = gsl_vector_view_array(x_arr, len); g_v = gsl_vector_view_array(g_arr, len); gsl_vector_memcpy(&x_v.vector, x); x_barr = alloc_bigarray_dims(barr_flags, 1, x_arr, len); g_barr = alloc_bigarray_dims(barr_flags, 1, g_arr, len); res=callback2_exn(Field(p->closure, 1), x_barr, g_barr); if(Is_exception_result(res)){ /* the caml functions raised an exception but there's no way we can indicate this to GSL since the return type is void. So we set the out param G to NaN. */ gsl_vector_set_all(G, GSL_NAN); return; } gsl_vector_memcpy(G, &g_v.vector); } void gsl_multimin_callback_fdf(const gsl_vector *x, void *params, double *f, gsl_vector *G) { int barr_flags = BIGARRAY_FLOAT64 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL; struct callback_params *p=params; value x_barr, g_barr; int len = x->size; LOCALARRAY(double, x_arr, len); LOCALARRAY(double, g_arr, len); gsl_vector_view x_v, g_v; value res; x_v = gsl_vector_view_array(x_arr, len); g_v = gsl_vector_view_array(g_arr, len); gsl_vector_memcpy(&x_v.vector, x); x_barr = alloc_bigarray_dims(barr_flags, 1, x_arr, len); g_barr = alloc_bigarray_dims(barr_flags, 1, g_arr, len); res=callback2_exn(Field(p->closure, 2), x_barr, g_barr); if(Is_exception_result(res)){ *f=GSL_NAN; return; } gsl_vector_memcpy(G, &g_v.vector); *f=Double_val(res); } /* MULTIFIT CALLBACKS */ int gsl_multifit_callback_f(const gsl_vector *X, void *params, gsl_vector *F) { int barr_flags = BIGARRAY_FLOAT64 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL; struct callback_params *parms=params; value x_barr, f_barr; size_t p = X->size; size_t n = F->size; LOCALARRAY(double, x_arr, p); LOCALARRAY(double, f_arr, n); gsl_vector_view x_v, f_v; value res; x_v = gsl_vector_view_array(x_arr, p); f_v = gsl_vector_view_array(f_arr, n); gsl_vector_memcpy(&x_v.vector, X); x_barr = alloc_bigarray_dims(barr_flags, 1, x_arr, p); f_barr = alloc_bigarray_dims(barr_flags, 1, f_arr, n); res=callback2_exn(Field(parms->closure, 0), x_barr, f_barr); if(Is_exception_result(res)) return GSL_FAILURE; gsl_vector_memcpy(F, &f_v.vector); return GSL_SUCCESS; } int gsl_multifit_callback_df(const gsl_vector *X, void *params, gsl_matrix *J) { int barr_flags = BIGARRAY_FLOAT64 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL; struct callback_params *parms=params; value x_barr, j_barr; size_t p = X->size; size_t n = J->size1; LOCALARRAY(double, x_arr, p); LOCALARRAY(double, j_arr, n*p); gsl_vector_view x_v; gsl_matrix_view j_v; value res; x_v = gsl_vector_view_array(x_arr, p); j_v = gsl_matrix_view_array(j_arr, n, p); gsl_vector_memcpy(&x_v.vector, X); x_barr = alloc_bigarray_dims(barr_flags, 1, x_arr, p); j_barr = alloc_bigarray_dims(barr_flags, 2, j_arr, n, p); res=callback2_exn(Field(parms->closure, 1), x_barr, j_barr); if(Is_exception_result(res)) return GSL_FAILURE; gsl_matrix_memcpy(J, &j_v.matrix); return GSL_SUCCESS; } int gsl_multifit_callback_fdf(const gsl_vector *X, void *params, gsl_vector *F, gsl_matrix *J) { int barr_flags = BIGARRAY_FLOAT64 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL; struct callback_params *parms=params; value x_barr, f_barr, j_barr; size_t p = X->size; size_t n = F->size; LOCALARRAY(double, x_arr, p); LOCALARRAY(double, f_arr, n); LOCALARRAY(double, j_arr, n*p); gsl_vector_view x_v, f_v; gsl_matrix_view j_v; value res; x_v = gsl_vector_view_array(x_arr, p); f_v = gsl_vector_view_array(f_arr, n); j_v = gsl_matrix_view_array(j_arr, n, p); gsl_vector_memcpy(&x_v.vector, X); x_barr = alloc_bigarray_dims(barr_flags, 1, x_arr, p); f_barr = alloc_bigarray_dims(barr_flags, 1, f_arr, n); j_barr = alloc_bigarray_dims(barr_flags, 2, j_arr, n, p); res=callback3_exn(Field(parms->closure, 2), x_barr, f_barr, j_barr); if(Is_exception_result(res)) return GSL_FAILURE; gsl_vector_memcpy(F, &f_v.vector); gsl_matrix_memcpy(J, &j_v.matrix); return GSL_SUCCESS; } orpie-1.5.2/gsl/gsl_matrix_complex.mli0000644000175000017500000001020512322115103016475 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Matrices of complex numbers implemented with [Bigarray] *) open Bigarray open Gsl_complex type complex_mat_bigarr = (Complex.t, complex64_elt, c_layout) Array2.t type matrix = complex_mat_bigarr val create : ?init:complex -> int -> int -> matrix val dims : matrix -> int * int val of_array : complex array -> int -> int -> matrix val of_arrays : complex array array -> matrix val to_array : matrix -> complex array val to_arrays : matrix -> complex array array val of_complex_array : complex_array -> int -> int -> matrix val to_complex_array : matrix -> complex_array val get : matrix -> int -> int -> complex val set : matrix -> int -> int -> complex -> unit val set_all : matrix -> complex -> unit val set_zero : matrix -> unit val set_id : matrix -> unit val memcpy : src:matrix -> dst:matrix -> unit val copy : matrix -> matrix val row : matrix -> int -> Gsl_vector_complex.vector external add : matrix -> matrix -> unit = "ml_gsl_matrix_complex_add" external sub : matrix -> matrix -> unit = "ml_gsl_matrix_complex_sub" external mul_elements : matrix -> matrix -> unit = "ml_gsl_matrix_complex_mul" external div_elements : matrix -> matrix -> unit = "ml_gsl_matrix_complex_div" external scale : matrix -> complex -> unit = "ml_gsl_matrix_complex_scale" external add_constant : matrix -> complex -> unit = "ml_gsl_matrix_complex_add_constant" external add_diagonal : matrix -> complex -> unit = "ml_gsl_matrix_complex_add_diagonal" external is_null : matrix -> bool = "ml_gsl_matrix_complex_isnull" external swap_rows : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_swap_rows" external swap_columns : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_swap_columns" external swap_rowcol : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_swap_rowcol" external transpose : matrix -> matrix -> unit = "ml_gsl_matrix_complex_transpose_memcpy" external transpose_in_place : matrix -> unit = "ml_gsl_matrix_complex_transpose" module Single : sig type complex_float_mat_bigarr = (Complex.t, complex32_elt, c_layout) Array2.t type matrix = complex_float_mat_bigarr val create : ?init:complex -> int -> int -> matrix val dims : matrix -> int * int val of_array : complex array -> int -> int -> matrix val of_arrays : complex array array -> matrix val to_array : matrix -> complex array val to_arrays : matrix -> complex array array val of_complex_array : complex_array -> int -> int -> matrix val to_complex_array : matrix -> complex_array val get : matrix -> int -> int -> complex val set : matrix -> int -> int -> complex -> unit val set_all : matrix -> complex -> unit val set_zero : matrix -> unit val set_id : matrix -> unit val memcpy : src:matrix -> dst:matrix -> unit val copy : matrix -> matrix val row : matrix -> int -> Gsl_vector_complex.Single.vector external add : matrix -> matrix -> unit = "ml_gsl_matrix_complex_float_add" external sub : matrix -> matrix -> unit = "ml_gsl_matrix_complex_float_sub" external mul_elements : matrix -> matrix -> unit = "ml_gsl_matrix_complex_float_mul" external div_elements : matrix -> matrix -> unit = "ml_gsl_matrix_complex_float_div" external scale : matrix -> complex -> unit = "ml_gsl_matrix_complex_float_scale" external add_constant : matrix -> complex -> unit = "ml_gsl_matrix_complex_float_add_constant" external add_diagonal : matrix -> complex -> unit = "ml_gsl_matrix_complex_float_add_diagonal" external is_null : matrix -> bool = "ml_gsl_matrix_complex_float_isnull" external swap_rows : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_float_swap_rows" external swap_columns : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_float_swap_columns" external swap_rowcol : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_float_swap_rowcol" external transpose : matrix -> matrix -> unit = "ml_gsl_matrix_complex_float_transpose_memcpy" external transpose_in_place : matrix -> unit = "ml_gsl_matrix_complex_float_transpose" end orpie-1.5.2/gsl/mlgsl_permut.h0000644000175000017500000000066312322115103014764 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #define GSL_PERMUT_OF_BIGARRAY(arr) \ struct caml_bigarray *bigarr_##arr = Bigarray_val(arr); \ gsl_permutation perm_##arr = { \ /*.size =*/ bigarr_##arr->dim[0], \ /*.data =*/ bigarr_##arr->data } orpie-1.5.2/gsl/mlgsl_permut.c0000644000175000017500000001152212322115103014753 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include #include "wrappers.h" #include "mlgsl_permut.h" CAMLprim value ml_gsl_permutation_init(value p) { GSL_PERMUT_OF_BIGARRAY(p); gsl_permutation_init(&perm_p); return Val_unit; } CAMLprim value ml_gsl_permutation_valid(value p) { int r; GSL_PERMUT_OF_BIGARRAY(p); r = gsl_permutation_valid(&perm_p); return Val_negbool(r); } CAMLprim value ml_gsl_permutation_reverse(value p) { GSL_PERMUT_OF_BIGARRAY(p); gsl_permutation_reverse(&perm_p); return Val_unit; } CAMLprim value ml_gsl_permutation_inverse(value src, value dst) { GSL_PERMUT_OF_BIGARRAY(src); GSL_PERMUT_OF_BIGARRAY(dst); gsl_permutation_inverse(&perm_dst, &perm_src); return Val_unit; } CAMLprim value ml_gsl_permutation_next(value p) { GSL_PERMUT_OF_BIGARRAY(p); gsl_permutation_next(&perm_p); return Val_unit; } CAMLprim value ml_gsl_permutation_prev(value p) { GSL_PERMUT_OF_BIGARRAY(p); gsl_permutation_prev(&perm_p); return Val_unit; } CAMLprim value ml_gsl_permute(value p, value arr) { GSL_PERMUT_OF_BIGARRAY(p); if(Tag_val(arr) == Double_array_tag) gsl_permute(perm_p.data, Double_array_val(arr), 1, Double_array_length(arr)); else gsl_permute_long(perm_p.data, (value *)arr, 1, Array_length(arr)); return Val_unit; } CAMLprim value ml_gsl_permute_barr(value p, value arr) { GSL_PERMUT_OF_BIGARRAY(p); struct caml_bigarray *barr = Bigarray_val(arr); enum caml_bigarray_kind kind = (barr->flags) & BIGARRAY_KIND_MASK ; switch(kind){ case BIGARRAY_FLOAT32: gsl_permute_float(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_FLOAT64: gsl_permute(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_SINT8: gsl_permute_char(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_UINT8: gsl_permute_uchar(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_SINT16: gsl_permute_short(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_UINT16: gsl_permute_ushort(perm_p.data, barr->data, 1, barr->dim[0]); break; #ifdef ARCH_SIXTYFOUR case BIGARRAY_INT64: #else case BIGARRAY_INT32: #endif case BIGARRAY_CAML_INT: case BIGARRAY_NATIVE_INT: gsl_permute_long(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_COMPLEX32: gsl_permute_complex_float(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_COMPLEX64: gsl_permute_complex(perm_p.data, barr->data, 1, barr->dim[0]); break; default: GSL_ERROR("data type not supported", GSL_EUNIMPL); } return Val_unit; } CAMLprim value ml_gsl_permute_complex(value p, value arr) { GSL_PERMUT_OF_BIGARRAY(p); gsl_permute_complex(perm_p.data, Double_array_val(arr), 1, Double_array_length(arr)/2); return Val_unit; } CAMLprim value ml_gsl_permute_inverse(value p, value arr) { GSL_PERMUT_OF_BIGARRAY(p); if(Tag_val(arr) == Double_array_tag) gsl_permute_inverse(perm_p.data, Double_array_val(arr), 1, Double_array_length(arr)); else gsl_permute_long_inverse(perm_p.data, (value *)arr, 1, Array_length(arr)); return Val_unit; } CAMLprim value ml_gsl_permute_inverse_barr(value p, value arr) { GSL_PERMUT_OF_BIGARRAY(p); struct caml_bigarray *barr = Bigarray_val(arr); enum caml_bigarray_kind kind = (barr->flags) & BIGARRAY_KIND_MASK ; switch(kind){ case BIGARRAY_FLOAT32: gsl_permute_float_inverse(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_FLOAT64: gsl_permute_inverse(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_SINT8: gsl_permute_char_inverse(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_UINT8: gsl_permute_uchar_inverse(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_SINT16: gsl_permute_short_inverse(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_UINT16: gsl_permute_ushort_inverse(perm_p.data, barr->data, 1, barr->dim[0]); break; #ifdef ARCH_SIXTYFOUR case BIGARRAY_INT64: #else case BIGARRAY_INT32: #endif case BIGARRAY_CAML_INT: case BIGARRAY_NATIVE_INT: gsl_permute_long_inverse(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_COMPLEX32: gsl_permute_complex_float_inverse(perm_p.data, barr->data, 1, barr->dim[0]); break; case BIGARRAY_COMPLEX64: gsl_permute_complex_inverse(perm_p.data, barr->data, 1, barr->dim[0]); break; default: GSL_ERROR("data type not supported", GSL_EUNIMPL); } return Val_unit; } CAMLprim value ml_gsl_permute_inverse_complex(value p, value arr) { GSL_PERMUT_OF_BIGARRAY(p); gsl_permute_complex_inverse(perm_p.data, Double_array_val(arr), 1, Double_array_length(arr)/2); return Val_unit; } orpie-1.5.2/gsl/gsl_matrix_complex_flat.mli0000644000175000017500000000505412322115103017511 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Matrices of complex number simplemented with [float array] *) type complex_mat_flat = private { data : float array; off : int; dim1 : int; dim2 : int; tda : int; } type matrix = complex_mat_flat open Gsl_complex val create : ?init:complex -> int -> int -> matrix val dims : matrix -> int * int val of_arrays : complex array array -> matrix val of_array : complex array -> int -> int -> matrix val to_arrays : matrix -> complex array array val to_array : matrix -> complex array val of_complex_array : float array -> int -> int -> matrix val to_complex_array : matrix -> complex_array val get : matrix -> int -> int -> complex val set : matrix -> int -> int -> complex -> unit val set_all : matrix -> complex -> unit val set_zero : matrix -> unit val set_id : matrix -> unit val memcpy : src:matrix -> dst:matrix -> unit val copy : matrix -> matrix external add : matrix -> matrix -> unit = "ml_gsl_matrix_complex_add" external sub : matrix -> matrix -> unit = "ml_gsl_matrix_complex_sub" external mul_elements : matrix -> matrix -> unit = "ml_gsl_matrix_complex_mul" external div_elements : matrix -> matrix -> unit = "ml_gsl_matrix_complex_div" external scale : matrix -> float -> unit = "ml_gsl_matrix_complex_scale" external add_constant : matrix -> float -> unit = "ml_gsl_matrix_complex_add_constant" external add_diagonal : matrix -> complex -> unit = "ml_gsl_matrix_complex_add_diagonal" external is_null : matrix -> bool = "ml_gsl_matrix_complex_isnull" external swap_rows : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_swap_rows" external swap_columns : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_swap_columns" external swap_rowcol : matrix -> int -> int -> unit = "ml_gsl_matrix_complex_swap_rowcol" external transpose : matrix -> matrix -> unit = "ml_gsl_matrix_complex_transpose_memcpy" external transpose_in_place : matrix -> unit = "ml_gsl_matrix_complex_transpose" open Gsl_vector_complex_flat val submatrix : matrix -> k1:int -> k2:int -> n1:int -> n2:int -> matrix val row : matrix -> int -> vector val column : matrix -> int -> vector val diagonal : matrix -> vector val subdiagonal : matrix -> int -> vector val superdiagonal : matrix -> int -> vector val view_complex_array : complex_array -> ?off:int -> int -> ?tda:int -> int -> matrix val view_vector : vector -> ?off:int -> int -> ?tda:int -> int -> matrix orpie-1.5.2/gsl/COPYING0000644000175000017500000004311112322115103013127 0ustar paulpaul GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. orpie-1.5.2/gsl/gsl_math.ml0000644000175000017500000000402212322115103014222 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) let e = 2.71828182845904523536028747135 (* e *) let log2e = 1.44269504088896340735992468100 (* log_2 (e) *) let log10e = 0.43429448190325182765112891892 (* log_10 (e) *) let sqrt2 = 1.41421356237309504880168872421 (* sqrt(2) *) let sqrt1_2 = 0.70710678118654752440084436210 (* sqrt(1/2) *) let sqrt3 = 1.73205080756887729352744634151 (* sqrt(3) *) let pi = 3.14159265358979323846264338328 (* pi *) let pi_2 = 1.57079632679489661923132169164 (* pi/2 *) let pi_4 = 0.78539816339744830966156608458 (* pi/4 *) let sqrtpi = 1.77245385090551602729816748334 (* sqrt(pi) *) let i_2_sqrtpi = 1.12837916709551257389615890312 (* 2/sqrt(pi) *) let i_1_pi = 0.31830988618379067153776752675 (* 1/pi *) let i_2_pi = 0.63661977236758134307553505349 (* 2/pi *) let ln10 = 2.30258509299404568401799145468 (* ln(10) *) let ln2 = 0.69314718055994530941723212146 (* ln(2) *) let lnpi = 1.14472988584940017414342735135 (* ln(pi) *) let euler = 0.57721566490153286060651209008 (* Euler constant *) let rec unsafe_pow_int x = function | 1 -> x | n when n mod 2 = 0 -> unsafe_pow_int (x *. x) (n/2) | n -> x *. (unsafe_pow_int x (pred n)) let pow_int x = function | 0 -> 1. | n when n > 0 -> unsafe_pow_int x n | _ -> invalid_arg "pow_int" external log1p : float -> float = "ml_gsl_log1p" "gsl_log1p" "float" external expm1 : float -> float = "ml_gsl_expm1" "gsl_expm1" "float" external hypot : float -> float -> float = "ml_gsl_hypot" "gsl_hypot" "float" external acosh : float -> float = "ml_gsl_acosh" "gsl_acosh" "float" external asinh : float -> float = "ml_gsl_asinh" "gsl_asinh" "float" external atanh : float -> float = "ml_gsl_atanh" "gsl_atanh" "float" external fcmp : float -> float -> epsilon:float -> int = "ml_gsl_fcmp" orpie-1.5.2/gsl/mlgsl_blas.h0000644000175000017500000000156312322115103014371 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ static inline CBLAS_ORDER_t CBLAS_ORDER_val(v) { CBLAS_ORDER_t conv[] = { CblasRowMajor, CblasColMajor }; return conv[ Int_val(v) ]; } static inline CBLAS_TRANSPOSE_t CBLAS_TRANS_val(v) { CBLAS_TRANSPOSE_t conv[] = { CblasNoTrans, CblasTrans, CblasConjTrans }; return conv[ Int_val(v) ]; } static inline CBLAS_UPLO_t CBLAS_UPLO_val(v) { CBLAS_UPLO_t conv[] = { CblasUpper, CblasLower }; return conv[ Int_val(v) ]; } static inline CBLAS_DIAG_t CBLAS_DIAG_val(v) { CBLAS_DIAG_t conv[] = { CblasNonUnit, CblasUnit }; return conv[ Int_val(v) ]; } static inline CBLAS_SIDE_t CBLAS_SIDE_val(v) { CBLAS_SIDE_t conv[] = { CblasLeft, CblasRight }; return conv[ Int_val(v) ]; } orpie-1.5.2/gsl/mlgsl_linalg_complex.c0000644000175000017500000000734212322115103016441 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include "mlgsl_matrix_complex.h" #include "mlgsl_vector_complex.h" #include "mlgsl_permut.h" #include "mlgsl_complex.h" /* Complex LU decomposition */ CAMLprim value ml_gsl_linalg_complex_LU_decomp(value A, value P) { int sign; GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX(A); _CONVERT_MATRIX(A); gsl_linalg_complex_LU_decomp(&m_A, &perm_P, &sign); return Val_int(sign); } CAMLprim value ml_gsl_linalg_complex_LU_solve(value LU, value P, value B, value X) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX(LU); _DECLARE_VECTOR2(B,X); _CONVERT_MATRIX(LU); _CONVERT_VECTOR2(B,X); gsl_linalg_complex_LU_solve(&m_LU, &perm_P, &v_B, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_complex_LU_svx(value LU, value P, value X) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX(LU); _DECLARE_VECTOR(X); _CONVERT_MATRIX(LU); _CONVERT_VECTOR(X); gsl_linalg_complex_LU_svx(&m_LU, &perm_P, &v_X); return Val_unit; } CAMLprim value ml_gsl_linalg_complex_LU_refine(value A, value LU, value P, value B, value X, value RES) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX2(A, LU); _DECLARE_VECTOR3(B, X, RES); _CONVERT_MATRIX2(A, LU); _CONVERT_VECTOR3(B, X, RES); gsl_linalg_complex_LU_refine(&m_A, &m_LU, &perm_P, &v_B, &v_X, &v_RES); return Val_unit; } CAMLprim value ml_gsl_linalg_complex_LU_refine_bc(value *argv, int argc) { return ml_gsl_linalg_complex_LU_refine(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } CAMLprim value ml_gsl_linalg_complex_LU_invert(value LU, value P, value INV) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX2(LU, INV); _CONVERT_MATRIX2(LU, INV); gsl_linalg_complex_LU_invert(&m_LU, &perm_P, &m_INV); return Val_unit; } CAMLprim value ml_gsl_linalg_complex_LU_det(value LU, value sig) { gsl_complex z; _DECLARE_MATRIX(LU); _CONVERT_MATRIX(LU); z = gsl_linalg_complex_LU_det(&m_LU, Int_val(sig)); return copy_complex(&z); } CAMLprim value ml_gsl_linalg_complex_LU_lndet(value LU) { _DECLARE_MATRIX(LU); _CONVERT_MATRIX(LU); return copy_double(gsl_linalg_complex_LU_lndet(&m_LU)); } CAMLprim value ml_gsl_linalg_complex_LU_sgndet(value LU, value sig) { gsl_complex z; _DECLARE_MATRIX(LU); _CONVERT_MATRIX(LU); z = gsl_linalg_complex_LU_sgndet(&m_LU, Int_val(sig)) ; return copy_complex(&z); } /* Hermitian to symmetric tridiagonal decomposition */ /* Those are tricky 'coz they mix real & complex matrices ... */ #undef BASE_TYPE #undef TYPE #undef _DECLARE_BASE_TYPE #undef _CONVERT_BASE_TYPE #undef DECLARE_BASE_TYPE #undef FUNCTION #include "mlgsl_matrix_double.h" #include "mlgsl_vector_double.h" CAMLprim value ml_gsl_linalg_hermtd_decomp (value A, value tau) { _DECLARE_COMPLEX_MATRIX(A); _DECLARE_COMPLEX_VECTOR(tau); _CONVERT_COMPLEX_MATRIX(A); _CONVERT_COMPLEX_VECTOR(tau); gsl_linalg_hermtd_decomp(&m_A, &v_tau); return Val_unit; } CAMLprim value ml_gsl_linalg_hermtd_unpack (value A, value tau, value Q, value diag, value subdiag) { _DECLARE_COMPLEX_VECTOR(tau); _DECLARE_VECTOR2(diag,subdiag); _DECLARE_COMPLEX_MATRIX2(A,Q); _CONVERT_COMPLEX_VECTOR(tau); _CONVERT_VECTOR2(diag,subdiag); _CONVERT_COMPLEX_MATRIX2(A,Q); gsl_linalg_hermtd_unpack(&m_A, &v_tau, &m_Q, &v_diag, &v_subdiag); return Val_unit; } CAMLprim value ml_gsl_linalg_hermtd_unpack_T (value A, value diag, value subdiag) { _DECLARE_COMPLEX_MATRIX(A); _DECLARE_VECTOR2(diag,subdiag); _CONVERT_COMPLEX_MATRIX(A); _CONVERT_VECTOR2(diag,subdiag); gsl_linalg_hermtd_unpack_T(&m_A, &v_diag, &v_subdiag); return Val_unit; } orpie-1.5.2/gsl/gsl_fun.mli0000644000175000017500000000320612322115103014235 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Callbacks and types for error estimates *) (** {3 Types for special functions} *) (** These type are used by module {! Gsl_sf} *) type result = { res : float ; err : float ; } (** The result of a computation : [res] is the value and [err] an estimate of the absolute error in the value. *) type result_e10 = { res_e10 : float ; err_e10 : float ; e10 : int ; } (** Result of computation with a scaling exponent. Actual result is obtained as [res *. 10. ** e10]. *) type mode = | DOUBLE (** Double precision : 2 * 10^-16 *) | SIMPLE (** Single precision : 10^-7 *) | APPROX (** Approximate values : 5 * 10^-4 *) (** Reduce the accuracy of some evaluations to speed up computations. *) external smash : result_e10 -> result = "ml_gsl_sf_result_smash_e" (** {3 Callbacks} *) type gsl_fun = float -> float type gsl_fun_fdf = { f : float -> float ; df : float -> float ; fdf : float -> float * float ; } type monte_fun = float array -> float open Gsl_vector type multi_fun = x:vector -> f:vector -> unit type multi_fun_fdf = { multi_f : x:vector -> f:vector -> unit ; multi_df : x:vector -> j:Gsl_matrix.matrix -> unit ; multi_fdf : x:vector -> f:vector -> j:Gsl_matrix.matrix -> unit ; } type multim_fun = x:vector -> float type multim_fun_fdf = { multim_f : x:vector -> float ; multim_df : x:vector -> g:vector -> unit ; multim_fdf : x:vector -> g:vector -> float ; } orpie-1.5.2/gsl/gsl_linalg.mli0000644000175000017500000002561112322115103014717 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Simple linear algebra operations *) open Gsl_vectmat open Gsl_complex (** {3 Simple matrix multiplication} *) (** [matmult a ~transpa b ~transpb c] stores in matrix [c] the product of matrices [a] and [b]. [transpa] or [transpb] allow transposition of either matrix, so it can compute a.b or Trans(a).b or a.Trans(b) or Trans(a).Trans(b) . See also {!Gsl_blas.gemm}. *) external matmult : a:mat -> ?transpa:bool -> b:mat -> ?transpb:bool -> mat -> unit = "ml_gsl_linalg_matmult_mod" (** {3 LU decomposition} *) (** {4 Low-level functions } *) external _LU_decomp : mat -> Gsl_permut.permut -> int = "ml_gsl_linalg_LU_decomp" external _LU_solve : mat -> Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_LU_solve" external _LU_svx : mat -> Gsl_permut.permut -> vec -> unit = "ml_gsl_linalg_LU_svx" external _LU_refine : a:mat -> lu:mat -> Gsl_permut.permut -> b:vec -> x:vec -> res:vec -> unit = "ml_gsl_linalg_LU_refine_bc" "ml_gsl_linalg_LU_refine" external _LU_invert : mat -> Gsl_permut.permut -> mat -> unit = "ml_gsl_linalg_LU_invert" external _LU_det : mat -> int -> float = "ml_gsl_linalg_LU_det" external _LU_lndet : mat -> float = "ml_gsl_linalg_LU_lndet" external _LU_sgndet : mat -> int -> int = "ml_gsl_linalg_LU_sgndet" (** {4 Higher-level functions} *) (** With these, the arguments are protected (copied) and necessary intermediate datastructures are allocated; *) val decomp_LU : ?protect:bool -> [< `M of Gsl_matrix.matrix | `MF of Gsl_matrix_flat.matrix | `A of float array * int * int | `AA of float array array] -> mat * Gsl_permut.permut * int val solve_LU : ?protect:bool -> [< `M of Gsl_matrix.matrix | `MF of Gsl_matrix_flat.matrix | `A of float array * int * int | `AA of float array array] -> [< `A of float array | `VF of Gsl_vector_flat.vector | `V of Gsl_vector.vector] -> float array val det_LU : ?protect:bool -> [< `M of Gsl_matrix.matrix | `MF of Gsl_matrix_flat.matrix | `A of float array * int * int | `AA of float array array] -> float val invert_LU : ?protect:bool -> ?result:mat -> [< `M of Gsl_matrix.matrix | `MF of Gsl_matrix_flat.matrix | `A of float array * int * int | `AA of float array array] -> mat (** {3 Complex LU decomposition} *) external complex_LU_decomp : cmat -> Gsl_permut.permut -> int = "ml_gsl_linalg_complex_LU_decomp" external complex_LU_solve : cmat -> Gsl_permut.permut -> b:cvec -> x:cvec -> unit = "ml_gsl_linalg_complex_LU_solve" external complex_LU_svx : cmat -> Gsl_permut.permut -> cvec -> unit = "ml_gsl_linalg_complex_LU_svx" external complex_LU_refine : a:cmat -> lu:cmat -> Gsl_permut.permut -> b:cvec -> x:cvec -> res:cvec -> unit = "ml_gsl_linalg_complex_LU_refine_bc" "ml_gsl_linalg_complex_LU_refine" external complex_LU_invert : cmat -> Gsl_permut.permut -> cmat -> unit = "ml_gsl_linalg_complex_LU_invert" external complex_LU_det : cmat -> int -> complex = "ml_gsl_linalg_complex_LU_det" external complex_LU_lndet : cmat -> float = "ml_gsl_linalg_complex_LU_lndet" external complex_LU_sgndet : cmat -> int -> complex = "ml_gsl_linalg_complex_LU_sgndet" (** {3 QR decomposition} *) external _QR_decomp : mat -> vec -> unit = "ml_gsl_linalg_QR_decomp" external _QR_solve : mat -> vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_QR_solve" external _QR_svx : mat -> vec -> x:vec -> unit = "ml_gsl_linalg_QR_svx" external _QR_lssolve : mat -> vec -> b:vec -> x:vec -> res:vec -> unit = "ml_gsl_linalg_QR_lssolve" external _QR_QTvec : mat -> vec -> v:vec -> unit = "ml_gsl_linalg_QR_QTvec" external _QR_Qvec : mat -> vec -> v:vec -> unit = "ml_gsl_linalg_QR_Qvec" external _QR_Rsolve : mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_QR_Rsolve" external _QR_Rsvx : mat -> x:vec -> unit = "ml_gsl_linalg_QR_Rsvx" external _QR_unpack : mat -> tau:vec -> q:mat -> r:mat -> unit = "ml_gsl_linalg_QR_unpack" external _QR_QRsolve : mat -> r:mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_QR_QRsolve" external _QR_update : mat -> r:mat -> w:vec -> v:vec -> unit = "ml_gsl_linalg_QR_update" external _R_solve : r:mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_R_solve" (* external _R_svx : r:mat -> x:vec -> unit*) (* = "ml_gsl_linalg_R_svx"*) (** {3 QR Decomposition with Column Pivoting} *) external _QRPT_decomp : a:mat -> tau:vec -> p:Gsl_permut.permut -> norm:vec -> int = "ml_gsl_linalg_QRPT_decomp" external _QRPT_decomp2 : a:mat -> q:mat -> r:mat -> tau:vec -> p:Gsl_permut.permut -> norm:vec -> int = "ml_gsl_linalg_QRPT_decomp2_bc" "ml_gsl_linalg_QRPT_decomp2" external _QRPT_solve : qr:mat -> tau:vec -> p:Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_QRPT_solve" external _QRPT_svx : qr:mat -> tau:vec -> p:Gsl_permut.permut -> x:vec -> unit = "ml_gsl_linalg_QRPT_svx" external _QRPT_QRsolve : q:mat -> r:mat -> p:Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_QRPT_QRsolve" external _QRPT_update : q:mat -> r:mat -> p:Gsl_permut.permut -> u:vec -> v:vec -> unit = "ml_gsl_linalg_QRPT_update" external _QRPT_Rsolve : qr:mat -> p:Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_QRPT_Rsolve" external _QRPT_Rsvx : qr:mat -> p:Gsl_permut.permut -> x:vec -> unit = "ml_gsl_linalg_QRPT_Rsolve" (** {3 Singular Value Decomposition} *) external _SV_decomp : a:mat -> v:mat -> s:vec -> work:vec -> unit = "ml_gsl_linalg_SV_decomp" external _SV_decomp_mod : a:mat -> x:mat -> v:mat -> s:vec -> work:vec -> unit = "ml_gsl_linalg_SV_decomp_mod" external _SV_decomp_jacobi : a:mat -> v:mat -> s:vec -> unit = "ml_gsl_linalg_SV_decomp_jacobi" external _SV_solve : u:mat -> v:mat -> s:vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_SV_solve" (** {3 LQ decomposition} *) external _LQ_decomp : a:mat -> tau:vec -> unit = "ml_gsl_linalg_LQ_decomp" external _LQ_solve_T : lq:mat -> tau:vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_LQ_solve_T" external _LQ_svx_T : lq:mat -> tau:vec -> x:vec -> unit = "ml_gsl_linalg_LQ_svx_T" external _LQ_lssolve_T : lq:mat -> tau:vec -> b:vec -> x:vec -> res:vec -> unit = "ml_gsl_linalg_LQ_lssolve_T" external _LQ_Lsolve_T : lq:mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_LQ_Lsolve_T" external _LQ_Lsvx_T : lq:mat -> x:vec -> unit = "ml_gsl_linalg_LQ_Lsvx_T" external _L_solve_T : l:mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_L_solve_T" external _LQ_vecQ : lq:mat -> tau:vec -> v:vec -> unit = "ml_gsl_linalg_LQ_vecQ" external _LQ_vecQT : lq:mat -> tau:vec -> v:vec -> unit = "ml_gsl_linalg_LQ_vecQT" external _LQ_unpack : lq:mat -> tau:vec -> q:mat -> l:mat -> unit = "ml_gsl_linalg_LQ_unpack" external _LQ_update : q:mat -> r:mat -> v:vec -> w:vec -> unit = "ml_gsl_linalg_LQ_update" external _LQ_LQsolve : q:mat -> l:mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_LQ_LQsolve" (** {3 P^T L Q decomposition} *) external _PTLQ_decomp : a:mat -> tau:vec -> Gsl_permut.permut -> norm:vec -> int = "ml_gsl_linalg_PTLQ_decomp" external _PTLQ_decomp2 : a:mat -> q:mat -> r:mat -> tau:vec -> Gsl_permut.permut -> norm:vec -> int = "ml_gsl_linalg_PTLQ_decomp2_bc" "ml_gsl_linalg_PTLQ_decomp2" external _PTLQ_solve_T : qr:mat -> tau:vec -> Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_PTLQ_solve_T" external _PTLQ_svx_T : lq:mat -> tau:vec -> Gsl_permut.permut -> x:vec -> unit = "ml_gsl_linalg_PTLQ_svx_T" external _PTLQ_LQsolve_T : q:mat -> l:mat -> Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_PTLQ_LQsolve_T" external _PTLQ_Lsolve_T : lq:mat -> Gsl_permut.permut -> b:vec -> x:vec -> unit = "ml_gsl_linalg_PTLQ_Lsolve_T" external _PTLQ_Lsvx_T : lq:mat -> Gsl_permut.permut -> x:vec -> unit = "ml_gsl_linalg_PTLQ_Lsvx_T" external _PTLQ_update : q:mat -> l:mat -> Gsl_permut.permut -> v:vec -> w:vec -> unit = "ml_gsl_linalg_PTLQ_update" (** {3 Cholesky decomposition} *) external cho_decomp : mat -> unit = "ml_gsl_linalg_cholesky_decomp" external cho_solve : mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_cholesky_solve" external cho_svx : mat -> vec -> unit = "ml_gsl_linalg_cholesky_svx" external cho_decomp_unit : mat -> vec -> unit = "ml_gsl_linalg_cholesky_decomp_unit" (** {3 Tridiagonal Decomposition of Real Symmetric Matrices} *) external symmtd_decomp : a:mat -> tau:vec -> unit = "ml_gsl_linalg_symmtd_decomp" external symmtd_unpack : a:mat -> tau:vec -> q:mat -> diag:vec -> subdiag:vec -> unit = "ml_gsl_linalg_symmtd_unpack" external symmtd_unpack_T : a:mat -> diag:vec -> subdiag:vec -> unit = "ml_gsl_linalg_symmtd_unpack_T" (** {3 Tridiagonal Decomposition of Hermitian Matrices} *) external hermtd_decomp : a:cmat -> tau:cvec -> unit = "ml_gsl_linalg_hermtd_decomp" external hermtd_unpack : a:cmat -> tau:cvec -> q:cmat -> diag:vec -> subdiag:vec -> unit = "ml_gsl_linalg_hermtd_unpack" external hermtd_unpack_T : a:cmat -> diag:vec -> subdiag:vec -> unit = "ml_gsl_linalg_hermtd_unpack_T" (** {3 Bidiagonalization} *) external bidiag_decomp : a:mat -> tau_u:vec -> tau_v:vec -> unit = "ml_gsl_linalg_bidiag_decomp" external bidiag_unpack : a:mat -> tau_u:vec -> u:mat -> tau_v:vec -> v:mat -> diag:vec -> superdiag:vec -> unit = "ml_gsl_linalg_bidiag_unpack_bc" "ml_gsl_linalg_bidiag_unpack" external bidiag_unpack2 : a:mat -> tau_u:vec -> tau_v:vec -> v:mat -> unit = "ml_gsl_linalg_bidiag_unpack2" external bidiag_unpack_B : a:mat -> diag:vec -> superdiag:vec -> unit = "ml_gsl_linalg_bidiag_unpack_B" (** {3 Householder solver} *) external _HH_solve : mat -> b:vec -> x:vec -> unit = "ml_gsl_linalg_HH_solve" external _HH_svx : mat -> vec -> unit = "ml_gsl_linalg_HH_svx" val solve_HH : ?protect:bool -> [< `M of Gsl_matrix.matrix | `MF of Gsl_matrix_flat.matrix | `A of float array * int * int | `AA of float array array] -> [< `A of float array | `VF of Gsl_vector_flat.vector | `V of Gsl_vector.vector] -> float array (** {3 Tridiagonal Systems} *) external solve_symm_tridiag : diag:vec -> offdiag:vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_solve_symm_tridiag" external solve_tridiag : diag:vec -> abovediag:vec -> belowdiag:vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_solve_tridiag" external solve_symm_cyc_tridiag : diag:vec -> offdiag:vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_solve_symm_cyc_tridiag" external solve_cyc_tridiag : diag:vec -> abovediag:vec -> belowdiag:vec -> b:vec -> x:vec -> unit = "ml_gsl_linalg_solve_cyc_tridiag" (** {3 Exponential} *) external _exponential : mat -> mat -> Gsl_fun.mode -> unit = "ml_gsl_linalg_exponential_ss" val exponential : ?mode:Gsl_fun.mode -> [< `M of Gsl_matrix.matrix | `MF of Gsl_matrix_flat.matrix | `A of float array * int * int] -> [ `M of Gsl_matrix.matrix] orpie-1.5.2/gsl/gsl_matrix_flat.ml0000644000175000017500000001076012322115103015611 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) type double_mat_flat = { data : float array ; off : int ; dim1 : int ; dim2 : int ; tda : int ; } type matrix = double_mat_flat let create ?(init=0.) dim1 dim2 = { data = Array.create (dim1 * dim2) init ; off = 0 ; dim1 = dim1 ; dim2 = dim2 ; tda = dim2 } let dims mat = (mat.dim1, mat.dim2) let of_arrays arr = let dim1 = Array.length arr in if dim1 = 0 then invalid_arg "of_arrays" ; let dim2 = Array.length arr.(0) in let tab = Array.make (dim1 * dim2) 0. in Array.iteri (fun i a -> if Array.length a <> dim2 then invalid_arg "of_arrays" ; Array.blit a 0 tab (i * dim2) dim2) arr ; { data = tab ; off = 0 ; dim1 = dim1 ; dim2 = dim2 ; tda = dim2 } let to_array mat = if mat.tda = mat.dim2 && mat.off = 0 then Array.copy mat.data else begin let arr = Array.make (mat.dim1 * mat.dim2) 0. in for i=0 to pred mat.dim1 do Array.blit mat.data (mat.off + i * mat.tda) arr (i*mat.dim2) mat.dim2 done ; arr end let to_arrays mat = let arr = Array.make_matrix mat.dim1 mat.dim2 0. in for i=0 to pred mat.dim1 do Array.blit mat.data (mat.off + i * mat.tda) arr.(i) 0 mat.dim2 done ; arr let of_array arr dim1 dim2 = let len = Array.length arr in if dim1 * dim2 <> len then invalid_arg "of_array" ; { data = Array.copy arr; off = 0 ; dim1 = dim1 ; dim2 = dim2; tda = dim2 } let get m i j = m.data.(m.off + i*m.tda + j) let set m i j x = m.data.(m.off + i*m.tda + j) <- x let set_all m x = for i=0 to pred m.dim1 do Array.fill m.data (m.off + i*m.tda) m.dim2 x done let set_zero m = set_all m 0. let set_id m = set_zero m ; for i=0 to pred (min m.dim1 m.dim2) do set m i i 1. done let memcpy ~src:m ~dst:m' = if m.dim1 <> m'.dim1 || m.dim2 <> m'.dim2 then invalid_arg "wrong dimensions" ; for i=0 to pred m.dim1 do Array.blit m.data (m.off + i*m.tda) m'.data (m'.off + i*m'.tda) m.dim2 done let copy m = let m' = create m.dim1 m.dim2 in memcpy m m' ; m' let submatrix m ~k1 ~k2 ~n1 ~n2 = { m with off = m.off + (k1*m.tda)+k2 ; dim1 = n1 ; dim2 = n2 ; tda = m.tda ; } let row m i = Gsl_vector_flat.view_array ~off:(m.off + i * m.tda) ~len:m.dim2 m.data let column m j = Gsl_vector_flat.view_array ~stride:m.tda ~off:(m.off + j) ~len:m.dim1 m.data let diagonal m = Gsl_vector_flat.view_array ~stride:(m.tda + 1) ~off:m.off ~len:(min m.dim1 m.dim2) m.data let subdiagonal m k = Gsl_vector_flat.view_array ~stride:(m.tda + 1) ~off:(m.off + k * m.tda) ~len:(min (m.dim1 - k) m.dim2) m.data let superdiagonal m k = Gsl_vector_flat.view_array ~stride:(m.tda + 1) ~off:(m.off + k) ~len:(min m.dim1 (m.dim2 - k)) m.data let view_array arr ?(off=0) dim1 ?tda dim2 = let tda = match tda with | None -> dim2 | Some v -> v in let len = Array.length arr in if dim1 * tda > len - off || dim2 > tda then invalid_arg "view_array" ; { data = arr; off = off; dim1 = dim1; dim2 = dim2; tda = tda } let view_vector v ?(off=0) dim1 ?tda dim2 = let tda = match tda with | None -> dim2 | Some v -> v in let len = Gsl_vector_flat.length v in if dim1 * tda > len - off || dim2 > tda then invalid_arg "view_vector" ; { data = v.Gsl_vector_flat.data; off = v.Gsl_vector_flat.off + off; dim1 = dim1; dim2 = dim2; tda = tda } external add : matrix -> matrix -> unit = "ml_gsl_matrix_add" external sub : matrix -> matrix -> unit = "ml_gsl_matrix_sub" external mul_elements : matrix -> matrix -> unit = "ml_gsl_matrix_mul" external div_elements : matrix -> matrix -> unit = "ml_gsl_matrix_div" external scale : matrix -> float -> unit = "ml_gsl_matrix_scale" external add_constant : matrix -> float -> unit = "ml_gsl_matrix_add_constant" external add_diagonal : matrix -> float -> unit = "ml_gsl_matrix_add_diagonal" external is_null : matrix -> bool = "ml_gsl_matrix_isnull" external swap_rows : matrix -> int -> int -> unit = "ml_gsl_matrix_swap_rows" external swap_columns : matrix -> int -> int -> unit = "ml_gsl_matrix_swap_columns" external swap_rowcol : matrix -> int -> int -> unit = "ml_gsl_matrix_swap_rowcol" external transpose : matrix -> matrix -> unit = "ml_gsl_matrix_transpose_memcpy" external transpose_in_place : matrix -> unit = "ml_gsl_matrix_transpose" orpie-1.5.2/gsl/mlgsl_vector.c0000644000175000017500000000537412322115103014751 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #ifndef FUNCTION #error pb with include files #endif CAMLprim value FUNCTION(ml_gsl_vector,memcpy)(value a, value b) { _DECLARE_VECTOR2(a,b); _CONVERT_VECTOR2(a,b); FUNCTION(gsl_vector,memcpy)(&v_b, &v_a); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_vector,add)(value a, value b) { _DECLARE_VECTOR2(a,b); _CONVERT_VECTOR2(a,b); FUNCTION(gsl_vector,add)(&v_a, &v_b); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_vector,sub)(value a, value b) { _DECLARE_VECTOR2(a,b); _CONVERT_VECTOR2(a,b); FUNCTION(gsl_vector,sub)(&v_a, &v_b); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_vector,mul)(value a, value b) { _DECLARE_VECTOR2(a,b); _CONVERT_VECTOR2(a,b); FUNCTION(gsl_vector,mul)(&v_a, &v_b); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_vector,div)(value a, value b) { _DECLARE_VECTOR2(a,b); _CONVERT_VECTOR2(a,b); FUNCTION(gsl_vector,div)(&v_a, &v_b); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_vector,scale)(value a, value x) { _DECLARE_VECTOR(a); _CONVERT_VECTOR(a); FUNCTION(gsl_vector,scale)(&v_a, Double_val(x)); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_vector,add_constant)(value a, value x) { _DECLARE_VECTOR(a); _CONVERT_VECTOR(a); FUNCTION(gsl_vector,add_constant)(&v_a, Double_val(x)); return Val_unit; } CAMLprim value FUNCTION(ml_gsl_vector,isnull)(value a) { int r; _DECLARE_VECTOR(a); _CONVERT_VECTOR(a); r = FUNCTION(gsl_vector,isnull)(&v_a); return Val_bool(r); } CAMLprim value FUNCTION(ml_gsl_vector,max)(value a) { _DECLARE_VECTOR(a); _CONVERT_VECTOR(a); return copy_double(FUNCTION(gsl_vector,max)(&v_a)); } CAMLprim value FUNCTION(ml_gsl_vector,min)(value a) { _DECLARE_VECTOR(a); _CONVERT_VECTOR(a); return copy_double(FUNCTION(gsl_vector,min)(&v_a)); } CAMLprim value FUNCTION(ml_gsl_vector,minmax)(value a) { BASE_TYPE x,y; _DECLARE_VECTOR(a); _CONVERT_VECTOR(a); FUNCTION(gsl_vector,minmax)(&v_a, &x, &y); return copy_two_double(x, y); } CAMLprim value FUNCTION(ml_gsl_vector,maxindex)(value a) { _DECLARE_VECTOR(a); _CONVERT_VECTOR(a); return Val_int(FUNCTION(gsl_vector,max_index)(&v_a)); } CAMLprim value FUNCTION(ml_gsl_vector,minindex)(value a) { _DECLARE_VECTOR(a); _CONVERT_VECTOR(a); return Val_int(FUNCTION(gsl_vector,min_index)(&v_a)); } CAMLprim value FUNCTION(ml_gsl_vector,minmaxindex)(value a) { size_t x,y; value v; _DECLARE_VECTOR(a); _CONVERT_VECTOR(a); FUNCTION(gsl_vector,minmax_index)(&v_a, &x, &y); v=alloc_small(2, 0); Field(v, 0) = Val_int(x); Field(v, 1) = Val_int(y); return v; } orpie-1.5.2/gsl/mlgsl_matrix_double.c0000644000175000017500000000007512322115103016276 0ustar paulpaul #include "mlgsl_matrix_double.h" #include "mlgsl_matrix.c" orpie-1.5.2/gsl/gsl_complex.ml0000644000175000017500000001115712322115103014747 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005, 2003 - Olivier Andrieu, Paul Pelzl *) (* distributed under the terms of the GPL version 2 *) type complex = Complex.t = { re : float ; im : float } let complex ~re ~im = { re = re ; im = im } type complex_array = float array let set a i c = a.(2*i) <- c.re ; a.(2*i + 1) <- c.im let get a i = { re = a.(2*i); im = a.(2*i+1) } let unpack ca = let len = Array.length ca in if len mod 2 <> 0 then invalid_arg "unpack_complex_array" ; Array.init (len / 2) (get ca) let pack a = let len = Array.length a in let ca = Array.make (2 * len) 0. in for i=0 to pred len do ca.(2*i) <- a.(i).re ; ca.(2*i+1) <- a.(i).im done ; ca let mult a b = if Array.length a mod 2 <> 0 then invalid_arg "mult: not a complex array" ; let len = (Array.length a) / 2 in for i = 0 to pred len do let re = a.(2*i) *. b.(2*i) -. a.(2*i+1) *. b.(2*i+1) in let im = a.(2*i) *. b.(2*i+1) +. a.(2*i+1) *. b.(2*i) in a.(2*i) <- re ; a.(2*i+1) <- im done (* added by Paul Pelzl, 2003/12/25 *) let rect x y = {re = x; im = y} let polar = Complex.polar let arg = Complex.arg let abs = Complex.norm let abs2 = Complex.norm2 external logabs : complex -> float = "ml_gsl_complex_logabs" let add = Complex.add let sub = Complex.sub let mul = Complex.mul let div = Complex.div let add_real a x = {re = a.re +. x; im = a.im} let sub_real a x = {re = a.re -. x; im = a.im} let mul_real a x = {re = a.re *. x; im = a.im *. x} let div_real a x = {re = a.re /. x; im = a.im /. x} let add_imag a y = {re = a.re; im = a.im +. y} let sub_imag a y = {re = a.re; im = a.im -. y} let mul_imag a y = {re = a.im *. (~-. y); im = a.re *. y} let div_imag a y = {re = a.im /. y; im = a.re /. (~-. y)} let conjugate = Complex.conj let inverse = Complex.inv let negative = Complex.neg (* elementary complex functions *) external sqrt : complex -> complex = "ml_gsl_complex_sqrt" external sqrt_real : float -> complex = "ml_gsl_complex_sqrt_real" external pow : complex -> complex -> complex = "ml_gsl_complex_pow" external pow_real : complex -> float -> complex = "ml_gsl_complex_pow_real" external exp : complex -> complex = "ml_gsl_complex_exp" external log : complex -> complex = "ml_gsl_complex_log" external log10 : complex -> complex = "ml_gsl_complex_log10" external log_b : complex -> complex -> complex = "ml_gsl_complex_log_b" (* complex trigonometric functions *) external sin : complex -> complex = "ml_gsl_complex_sin" external cos : complex -> complex = "ml_gsl_complex_cos" external tan : complex -> complex = "ml_gsl_complex_tan" external sec : complex -> complex = "ml_gsl_complex_sec" external csc : complex -> complex = "ml_gsl_complex_csc" external cot : complex -> complex = "ml_gsl_complex_cot" (* inverse complex trigonometric functions *) external arcsin : complex -> complex = "ml_gsl_complex_arcsin" external arcsin_real : float -> complex = "ml_gsl_complex_arcsin_real" external arccos : complex -> complex = "ml_gsl_complex_arccos" external arccos_real : float -> complex = "ml_gsl_complex_arccos_real" external arctan : complex -> complex = "ml_gsl_complex_arctan" external arcsec : complex -> complex = "ml_gsl_complex_arcsec" external arcsec_real : float -> complex = "ml_gsl_complex_arcsec_real" external arccsc : complex -> complex = "ml_gsl_complex_arccsc" external arccsc_real : float -> complex = "ml_gsl_complex_arccsc_real" external arccot : complex -> complex = "ml_gsl_complex_arccot" (* complex hyperbolic functions *) external sinh : complex -> complex = "ml_gsl_complex_sinh" external cosh : complex -> complex = "ml_gsl_complex_cosh" external tanh : complex -> complex = "ml_gsl_complex_tanh" external sech : complex -> complex = "ml_gsl_complex_sech" external csch : complex -> complex = "ml_gsl_complex_csch" external coth : complex -> complex = "ml_gsl_complex_coth" (* inverse complex hyperbolic functions *) external arcsinh : complex -> complex = "ml_gsl_complex_arcsinh" external arccosh : complex -> complex = "ml_gsl_complex_arccosh" external arccosh_real : float -> complex = "ml_gsl_complex_arccosh_real" external arctanh : complex -> complex = "ml_gsl_complex_arctanh" external arctanh_real : float -> complex = "ml_gsl_complex_arctanh_real" external arcsech : complex -> complex = "ml_gsl_complex_arcsech" external arccsch : complex -> complex = "ml_gsl_complex_arccsch" external arccoth : complex -> complex = "ml_gsl_complex_arccoth" orpie-1.5.2/gsl/mlgsl_vector_complex.h0000644000175000017500000000076412322115103016503 0ustar paulpaul #include "wrappers.h" #define BASE_TYPE complex #define CONV_FLAT #define TYPE(t) CONCAT2(t,BASE_TYPE) #define FUNCTION(a,b) CONCAT3(a,BASE_TYPE,b) #include "mlgsl_vector.h" #define _DECLARE_COMPLEX_VECTOR(a) gsl_vector_complex v_##a #define _DECLARE_COMPLEX_VECTOR2(a,b) _DECLARE_COMPLEX_VECTOR(a); _DECLARE_COMPLEX_VECTOR(b) #define _CONVERT_COMPLEX_VECTOR(a) mlgsl_vec_of_value_complex(&v_##a, a) #define _CONVERT_COMPLEX_VECTOR2(a,b) _CONVERT_COMPLEX_VECTOR(a); _CONVERT_COMPLEX_VECTOR(b) orpie-1.5.2/gsl/gsl_matrix.mli0000644000175000017500000000721212322115103014752 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Matrices of floats implemented with [Bigarray] *) type double_mat_bigarr = (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array2.t type matrix = double_mat_bigarr val create : ?init:float -> int -> int -> matrix val dims : matrix -> int * int val of_array : float array -> int -> int -> matrix val of_arrays : float array array -> matrix val to_array : matrix -> float array val to_arrays : matrix -> float array array val get : matrix -> int -> int -> float val set : matrix -> int -> int -> float -> unit val set_all : matrix -> float -> unit val set_zero : matrix -> unit val set_id : matrix -> unit val memcpy : src:matrix -> dst:matrix -> unit val copy : matrix -> matrix val row : matrix -> int -> Gsl_vector.vector external add : matrix -> matrix -> unit = "ml_gsl_matrix_add" external sub : matrix -> matrix -> unit = "ml_gsl_matrix_sub" external mul_elements : matrix -> matrix -> unit = "ml_gsl_matrix_mul" external div_elements : matrix -> matrix -> unit = "ml_gsl_matrix_div" external scale : matrix -> float -> unit = "ml_gsl_matrix_scale" external add_constant : matrix -> float -> unit = "ml_gsl_matrix_add_constant" external add_diagonal : matrix -> float -> unit = "ml_gsl_matrix_add_diagonal" external is_null : matrix -> bool = "ml_gsl_matrix_isnull" external swap_rows : matrix -> int -> int -> unit = "ml_gsl_matrix_swap_rows" external swap_columns : matrix -> int -> int -> unit = "ml_gsl_matrix_swap_columns" external swap_rowcol : matrix -> int -> int -> unit = "ml_gsl_matrix_swap_rowcol" external transpose : matrix -> matrix -> unit = "ml_gsl_matrix_transpose_memcpy" external transpose_in_place : matrix -> unit = "ml_gsl_matrix_transpose" module Single : sig type float_mat_bigarr = (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array2.t type matrix = float_mat_bigarr val create : ?init:float -> int -> int -> matrix val dims : matrix -> int * int val of_array : float array -> int -> int -> matrix val of_arrays : float array array -> matrix val to_array : matrix -> float array val to_arrays : matrix -> float array array val get : matrix -> int -> int -> float val set : matrix -> int -> int -> float -> unit val set_all : matrix -> float -> unit val set_zero : matrix -> unit val set_id : matrix -> unit val memcpy : src:matrix -> dst:matrix -> unit val copy : matrix -> matrix val row : matrix -> int -> Gsl_vector.Single.vector external add : matrix -> matrix -> unit = "ml_gsl_matrix_float_add" external sub : matrix -> matrix -> unit = "ml_gsl_matrix_float_sub" external mul_elements : matrix -> matrix -> unit = "ml_gsl_matrix_float_mul" external div_elements : matrix -> matrix -> unit = "ml_gsl_matrix_float_div" external scale : matrix -> float -> unit = "ml_gsl_matrix_float_scale" external add_constant : matrix -> float -> unit = "ml_gsl_matrix_float_add_constant" external add_diagonal : matrix -> float -> unit = "ml_gsl_matrix_float_add_diagonal" external is_null : matrix -> bool = "ml_gsl_matrix_float_isnull" external swap_rows : matrix -> int -> int -> unit = "ml_gsl_matrix_float_swap_rows" external swap_columns : matrix -> int -> int -> unit = "ml_gsl_matrix_float_swap_columns" external swap_rowcol : matrix -> int -> int -> unit = "ml_gsl_matrix_float_swap_rowcol" external transpose : matrix -> matrix -> unit = "ml_gsl_matrix_float_transpose_memcpy" external transpose_in_place : matrix -> unit = "ml_gsl_matrix_float_transpose" end orpie-1.5.2/gsl/mlgsl_complex.h0000644000175000017500000000166212322115103015117 0ustar paulpaul/* ocamlgsl - OCaml interface to GSL */ /* Copyright (©) 2002-2005 - Olivier Andrieu */ /* distributed under the terms of the GPL version 2 */ #include #include "wrappers.h" static inline value #ifndef FLOAT_COMPLEX copy_complex(gsl_complex * c) #else copy_complex(gsl_complex_float * c) #endif /* FLOAT_COMPLEX */ { return copy_two_double_arr(GSL_COMPLEX_P_REAL(c), GSL_COMPLEX_P_IMAG(c)); } #ifndef FLOAT_COMPLEX #define _DECLARE_COMPLEX(v) gsl_complex z_##v #else #define _DECLARE_COMPLEX(v) gsl_complex_float z_##v #endif /* FLOAT_COMPLEX */ #define _DECLARE_COMPLEX2(v1,v2) _DECLARE_COMPLEX(v1); _DECLARE_COMPLEX(v2) #define _DECLARE_COMPLEX3(v1,v2,v3) _DECLARE_COMPLEX2(v1,v2); _DECLARE_COMPLEX(v3) #define _CONVERT_COMPLEX(v) GSL_SET_COMPLEX(&z_##v,Double_field(v, 0), Double_field(v,1)) #define _CONVERT_COMPLEX2(v1,v2) _CONVERT_COMPLEX(v1); _CONVERT_COMPLEX(v2) orpie-1.5.2/gsl/gsl_sf.ml0000644000175000017500000010221412322115103013703 0ustar paulpaul(* ocamlgsl - OCaml interface to GSL *) (* Copyright (©) 2002-2005 - Olivier Andrieu *) (* distributed under the terms of the GPL version 2 *) (** Special functions *) open Gsl_fun (* AIRY functions *) external airy_Ai : float -> mode -> float = "ml_gsl_sf_airy_Ai" external airy_Ai_e : float -> mode -> result = "ml_gsl_sf_airy_Ai_e" external airy_Bi : float -> mode -> float = "ml_gsl_sf_airy_Bi" external airy_Bi_e : float -> mode -> result = "ml_gsl_sf_airy_Bi_e" external airy_Ai_scaled : float -> mode -> float = "ml_gsl_sf_airy_Ai_scaled" external airy_Ai_scaled_e : float -> mode -> result = "ml_gsl_sf_airy_Ai_scaled_e" external airy_Bi_scaled : float -> mode -> float = "ml_gsl_sf_airy_Bi_scaled" external airy_Bi_scaled_e : float -> mode -> result = "ml_gsl_sf_airy_Bi_scaled_e" external airy_Ai_deriv : float -> mode -> float = "ml_gsl_sf_airy_Ai_deriv" external airy_Ai_deriv_e : float -> mode -> result = "ml_gsl_sf_airy_Ai_deriv_e" external airy_Bi_deriv : float -> mode -> float = "ml_gsl_sf_airy_Bi_deriv" external airy_Bi_deriv_e : float -> mode -> result = "ml_gsl_sf_airy_Bi_deriv_e" external airy_Ai_deriv_scaled : float -> mode -> float = "ml_gsl_sf_airy_Ai_deriv_scaled" external airy_Ai_deriv_scaled_e : float -> mode -> result = "ml_gsl_sf_airy_Ai_deriv_scaled_e" external airy_Bi_deriv_scaled : float -> mode -> float = "ml_gsl_sf_airy_Bi_deriv_scaled" external airy_Bi_deriv_scaled_e : float -> mode -> result = "ml_gsl_sf_airy_Bi_deriv_scaled_e" external airy_zero_Ai : int -> float = "ml_gsl_sf_airy_zero_Ai" external airy_zero_Ai_e : int -> result = "ml_gsl_sf_airy_zero_Ai_e" external airy_zero_Bi : int -> float = "ml_gsl_sf_airy_zero_Bi" external airy_zero_Bi_e : int -> result = "ml_gsl_sf_airy_zero_Bi_e" (* BESSEL functions *) external bessel_J0 : float -> float = "ml_gsl_sf_bessel_J0" "gsl_sf_bessel_J0" "float" external bessel_J0_e : float -> result = "ml_gsl_sf_bessel_J0_e" external bessel_J1 : float -> float = "ml_gsl_sf_bessel_J1" "gsl_sf_bessel_J1" "float" external bessel_J1_e : float -> result = "ml_gsl_sf_bessel_J1_e" external bessel_Jn : int -> float -> float = "ml_gsl_sf_bessel_Jn" external bessel_Jn_e : int -> float -> result = "ml_gsl_sf_bessel_Jn_e" external bessel_Jn_array : int -> float -> float array -> unit = "ml_gsl_sf_bessel_Jn_array" external bessel_Y0 : float -> float = "ml_gsl_sf_bessel_Y0" "gsl_sf_bessel_Y0" "float" external bessel_Y0_e : float -> result = "ml_gsl_sf_bessel_Y0_e" external bessel_Y1 : float -> float = "ml_gsl_sf_bessel_Y1" "gsl_sf_bessel_Y1" "float" external bessel_Y1_e : float -> result = "ml_gsl_sf_bessel_Y1_e" external bessel_Yn : int -> float -> float = "ml_gsl_sf_bessel_Yn" external bessel_Yn_e : int -> float -> result = "ml_gsl_sf_bessel_Yn_e" external bessel_Yn_array : int -> float -> float array -> unit = "ml_gsl_sf_bessel_Yn_array" external bessel_I0 : float -> float = "ml_gsl_sf_bessel_I0" "gsl_sf_bessel_I0" "float" external bessel_I0_e : float -> result = "ml_gsl_sf_bessel_I0_e" external bessel_I1 : float -> float = "ml_gsl_sf_bessel_I1" "gsl_sf_bessel_I1" "float" external bessel_I1_e : float -> result = "ml_gsl_sf_bessel_I1_e" external bessel_In : int -> float -> float = "ml_gsl_sf_bessel_In" external bessel_In_e : int -> float -> result = "ml_gsl_sf_bessel_In_e" external bessel_In_array : int -> float -> float array -> unit = "ml_gsl_sf_bessel_In_array" external bessel_K0 : float -> float = "ml_gsl_sf_bessel_K0" "gsl_sf_bessel_K0" "float" external bessel_K0_e : float -> result = "ml_gsl_sf_bessel_K0_e" external bessel_K1 : float -> float = "ml_gsl_sf_bessel_K1" "gsl_sf_bessel_K1" "float" external bessel_K1_e : float -> result = "ml_gsl_sf_bessel_K1_e" external bessel_Kn : int -> float -> float = "ml_gsl_sf_bessel_Kn" external bessel_Kn_e : int -> float -> result = "ml_gsl_sf_bessel_Kn_e" external bessel_Kn_array : int -> float -> float array -> unit = "ml_gsl_sf_bessel_Kn_array" external bessel_I0_scaled : float -> float = "ml_gsl_sf_bessel_I0_scaled" "gsl_sf_bessel_I0_scaled" "float" external bessel_I0_scaled_e : float -> result = "ml_gsl_sf_bessel_I0_scaled_e" external bessel_I1_scaled : float -> float = "ml_gsl_sf_bessel_I1_scaled" "gsl_sf_bessel_I1_scaled" "float" external bessel_I1_scaled_e : float -> result = "ml_gsl_sf_bessel_I1_scaled_e" external bessel_In : int -> float -> float = "ml_gsl_sf_bessel_In" external bessel_In_e : int -> float -> result = "ml_gsl_sf_bessel_In_e" external bessel_In_scaled_array : int -> float -> float array -> unit = "ml_gsl_sf_bessel_In_scaled_array" external bessel_K0_scaled : float -> float = "ml_gsl_sf_bessel_K0_scaled" "gsl_sf_bessel_K0_scaled" "float" external bessel_K0_scaled_e : float -> result = "ml_gsl_sf_bessel_K0_scaled_e" external bessel_K1_scaled : float -> float = "ml_gsl_sf_bessel_K1_scaled" "gsl_sf_bessel_K1_scaled" "float" external bessel_K1_scaled_e : float -> result = "ml_gsl_sf_bessel_K1_scaled_e" external bessel_Kn : int -> float -> float = "ml_gsl_sf_bessel_Kn" external bessel_Kn_e : int -> float -> result = "ml_gsl_sf_bessel_Kn_e" external bessel_Kn_scaled_array : int -> float -> float array -> unit = "ml_gsl_sf_bessel_Kn_scaled_array" external bessel_j0 : float -> float = "ml_gsl_sf_bessel_j0" "gsl_sf_bessel_j0" "float" external bessel_j0_e : float -> result = "ml_gsl_sf_bessel_j0_e" external bessel_j1 : float -> float = "ml_gsl_sf_bessel_j1" "gsl_sf_bessel_j1" "float" external bessel_j1_e : float -> result = "ml_gsl_sf_bessel_j1_e" external bessel_j2 : float -> float = "ml_gsl_sf_bessel_j2" "gsl_sf_bessel_j2" "float" external bessel_j2_e : float -> result = "ml_gsl_sf_bessel_j2_e" external bessel_jl : int -> float -> float = "ml_gsl_sf_bessel_jl" external bessel_jl_e : int -> float -> result = "ml_gsl_sf_bessel_jl_e" external bessel_jl_array : int -> float -> float array -> unit = "ml_gsl_sf_bessel_jl_array" external bessel_jl_steed_array : float -> float array -> unit = "ml_gsl_sf_bessel_jl_steed_array" external bessel_y0 : float -> float = "ml_gsl_sf_bessel_y0" "gsl_sf_bessel_y0" "float" external bessel_y0_e : float -> result = "ml_gsl_sf_bessel_y0_e" external bessel_y1 : float -> float = "ml_gsl_sf_bessel_y1" "gsl_sf_bessel_y1" "float" external bessel_y1_e : float -> result = "ml_gsl_sf_bessel_y1_e" external bessel_y2 : float -> float = "ml_gsl_sf_bessel_y2" "gsl_sf_bessel_y2" "float" external bessel_y2_e : float -> result = "ml_gsl_sf_bessel_y2_e" external bessel_yl : int -> float -> float = "ml_gsl_sf_bessel_yl" external bessel_yl_e : int -> float -> result = "ml_gsl_sf_bessel_yl_e" external bessel_yl_array : int -> float -> float array -> unit = "ml_gsl_sf_bessel_yl_array" external bessel_i0_scaled : float -> float = "ml_gsl_sf_bessel_i0_scaled" "gsl_sf_bessel_i0_scaled" "float" external bessel_i0_scaled_e : float -> result = "ml_gsl_sf_bessel_i0_scaled_e" external bessel_i1_scaled : float -> float = "ml_gsl_sf_bessel_i1_scaled" "gsl_sf_bessel_i1_scaled" "float" external bessel_i1_scaled_e : float -> result = "ml_gsl_sf_bessel_i1_scaled_e" external bessel_il_scaled : int -> float -> float = "ml_gsl_sf_bessel_il_scaled" external bessel_il_scaled_e : int -> float -> result = "ml_gsl_sf_bessel_il_scaled_e" external bessel_il_scaled_array : int -> float -> float array -> unit = "ml_gsl_sf_bessel_il_scaled_array" external bessel_k0_scaled : float -> float = "ml_gsl_sf_bessel_k0_scaled" "gsl_sf_bessel_k0_scaled" "float" external bessel_k0_scaled_e : float -> result = "ml_gsl_sf_bessel_k0_scaled_e" external bessel_k1_scaled : float -> float = "ml_gsl_sf_bessel_k1_scaled" "gsl_sf_bessel_k1_scaled" "float" external bessel_k1_scaled_e : float -> result = "ml_gsl_sf_bessel_k1_scaled_e" external bessel_kl_scaled : int -> float -> float = "ml_gsl_sf_bessel_kl_scaled" external bessel_kl_scaled_e : int -> float -> result = "ml_gsl_sf_bessel_kl_scaled_e" external bessel_kl_scaled_array : int -> float -> float array -> unit = "ml_gsl_sf_bessel_kl_scaled_array" external bessel_Jnu : float -> float -> float = "ml_gsl_sf_bessel_Jnu" "gsl_sf_bessel_Jnu" "float" external bessel_Jnu_e : float -> float -> result = "ml_gsl_sf_bessel_Jnu_e" external bessel_sequence_Jnu_e : float -> mode -> float array -> unit = "ml_gsl_sf_bessel_sequence_Jnu_e" external bessel_Ynu : float -> float -> float = "ml_gsl_sf_bessel_Ynu" "gsl_sf_bessel_Ynu" "float" external bessel_Ynu_e : float -> float -> result = "ml_gsl_sf_bessel_Ynu_e" external bessel_Inu : float -> float -> float = "ml_gsl_sf_bessel_Inu" "gsl_sf_bessel_Inu" "float" external bessel_Inu_e : float -> float -> result = "ml_gsl_sf_bessel_Inu_e" external bessel_Inu_scaled : float -> float -> float = "ml_gsl_sf_bessel_Inu_scaled" "gsl_sf_bessel_Inu_scaled" "float" external bessel_Inu_scaled_e : float -> float -> result = "ml_gsl_sf_bessel_Inu_scaled_e" external bessel_Knu : float -> float -> float = "ml_gsl_sf_bessel_Knu" "gsl_sf_bessel_Knu" "float" external bessel_Knu_e : float -> float -> result = "ml_gsl_sf_bessel_Knu_e" external bessel_lnKnu : float -> float -> float = "ml_gsl_sf_bessel_lnKnu" "gsl_sf_bessel_lnKnu" "float" external bessel_lnKnu_e : float -> float -> result = "ml_gsl_sf_bessel_lnKnu_e" external bessel_Knu_scaled : float -> float -> float = "ml_gsl_sf_bessel_Knu_scaled" "gsl_sf_bessel_Knu_scaled" "float" external bessel_Knu_scaled_e : float -> float -> result = "ml_gsl_sf_bessel_Knu_scaled_e" external bessel_zero_J0 : int -> float = "ml_gsl_sf_bessel_zero_J0" external bessel_zero_J0_e : int -> result = "ml_gsl_sf_bessel_zero_J0_e" external bessel_zero_J1 : int -> float = "ml_gsl_sf_bessel_zero_J1" external bessel_zero_J1_e : int -> result = "ml_gsl_sf_bessel_zero_J1_e" external bessel_zero_Jnu : float -> int -> float = "ml_gsl_sf_bessel_zero_Jnu" external bessel_zero_Jnu_e : float -> int -> result = "ml_gsl_sf_bessel_zero_Jnu_e" (* CLAUSEN functions *) external clausen : float -> float = "ml_gsl_sf_clausen" "gsl_sf_clausen" "float" external clausen_e : float -> result = "ml_gsl_sf_clausen_e" (* COULOMB functions *) external hydrogenicR_1 : float -> float -> float = "ml_gsl_sf_hydrogenicR_1" "gsl_sf_hydrogenicR_1" "float" external hydrogenicR_1_e : float -> float -> result = "ml_gsl_sf_hydrogenicR_1_e" external hydrogenicR : int -> int -> float -> float -> float = "ml_gsl_sf_hydrogenicR" external hydrogenicR_e : int -> int -> float -> float -> result = "ml_gsl_sf_hydrogenicR_e" (* FIXME: COULOMB wave functions *) external coulomb_CL_e : float -> float -> result = "ml_gsl_sf_coulomb_CL_e" external coulomb_CL_array : float -> float -> float array -> unit = "ml_gsl_sf_coulomb_CL_array" (* FIXME: coupling coeffs *) (* DAWSON functions *) external dawson : float -> float = "ml_gsl_sf_dawson" "gsl_sf_dawson" "float" external dawson_e : float -> result = "ml_gsl_sf_dawson_e" (* DEBYE functions *) external debye_1 : float -> float = "ml_gsl_sf_debye_1" "gsl_sf_debye_1" "float" external debye_1_e : float -> result = "ml_gsl_sf_debye_1_e" external debye_2 : float -> float = "ml_gsl_sf_debye_2" "gsl_sf_debye_2" "float" external debye_2_e : float -> result = "ml_gsl_sf_debye_2_e" external debye_3 : float -> float = "ml_gsl_sf_debye_3" "gsl_sf_debye_3" "float" external debye_3_e : float -> result = "ml_gsl_sf_debye_3_e" external debye_4 : float -> float = "ml_gsl_sf_debye_4" "gsl_sf_debye_4" "float" external debye_4_e : float -> result = "ml_gsl_sf_debye_4_e" external debye_5 : float -> float = "ml_gsl_sf_debye_5" "gsl_sf_debye_5" "float" external debye_5_e : float -> result = "ml_gsl_sf_debye_5_e" external debye_6 : float -> float = "ml_gsl_sf_debye_6" "gsl_sf_debye_6" "float" external debye_6_e : float -> result = "ml_gsl_sf_debye_6_e" (* DILOGARITHM *) external dilog : float -> float = "ml_gsl_sf_dilog" "gsl_sf_dilog" "float" external dilog_e : float -> result = "ml_gsl_sf_dilog_e" external complex_dilog_xy_e : float -> float -> result * result = "ml_gsl_sf_complex_dilog_xy_e" external complex_dilog_e : float -> float -> result * result = "ml_gsl_sf_complex_dilog_e" external complex_spence_xy_e : float -> float -> result * result = "ml_gsl_sf_complex_spence_xy_e" (* ELEMENTARY operations *) external multiply_e : float -> float -> result = "ml_gsl_sf_multiply_e" external multiply_err_e : x:float -> dx:float -> y:float -> dy:float -> result = "ml_gsl_sf_multiply_err_e" (* ELLIPTIC integrals *) external ellint_Kcomp : float -> mode -> float = "ml_gsl_sf_ellint_Kcomp" external ellint_Kcomp_e : float -> mode -> result = "ml_gsl_sf_ellint_Kcomp_e" external ellint_Ecomp : float -> mode -> float = "ml_gsl_sf_ellint_Ecomp" external ellint_Ecomp_e : float -> mode -> result = "ml_gsl_sf_ellint_Ecomp_e" external ellint_Pcomp : float -> float -> mode -> float = "ml_gsl_sf_ellint_Pcomp" external ellint_Pcomp_e : float -> float -> mode -> result = "ml_gsl_sf_ellint_Pcomp_e" external ellint_Dcomp : float -> mode -> float = "ml_gsl_sf_ellint_Dcomp" external ellint_Dcomp_e : float -> mode -> result = "ml_gsl_sf_ellint_Dcomp_e" external ellint_F : float -> float -> mode -> float = "ml_gsl_sf_ellint_F" external ellint_F_e : float -> float -> mode -> result = "ml_gsl_sf_ellint_F_e" external ellint_E : float -> float -> mode -> float = "ml_gsl_sf_ellint_E" external ellint_E_e : float -> float -> mode -> result = "ml_gsl_sf_ellint_E_e" external ellint_P : float -> float -> float -> mode -> float = "ml_gsl_sf_ellint_P" external ellint_P_e : float -> float -> float -> mode -> result = "ml_gsl_sf_ellint_P_e" external ellint_D : float -> float -> float -> mode -> float = "ml_gsl_sf_ellint_D" external ellint_D_e : float -> float -> float -> mode -> result = "ml_gsl_sf_ellint_D_e" external ellint_RC : float -> float -> mode -> float = "ml_gsl_sf_ellint_RC" external ellint_RC_e : float -> float -> mode -> result = "ml_gsl_sf_ellint_RC_e" external ellint_RD : float -> float -> float -> mode -> float = "ml_gsl_sf_ellint_RD" external ellint_RD_e : float -> float -> float -> mode -> result = "ml_gsl_sf_ellint_RD_e" external ellint_RF : float -> float -> float -> mode -> float = "ml_gsl_sf_ellint_RF" external ellint_RF_e : float -> float -> float -> mode -> result = "ml_gsl_sf_ellint_RF_e" external ellint_RJ : float -> float -> float -> float -> mode -> float = "ml_gsl_sf_ellint_RJ" external ellint_RJ_e : float -> float -> float -> float -> mode -> result = "ml_gsl_sf_ellint_RJ_e" (* FIXME: elljac_e *) (* ERROR function *) external erf : float -> float = "ml_gsl_sf_erf" "gsl_sf_erf" "float" external erf_e : float -> result = "ml_gsl_sf_erf_e" external erfc : float -> float = "ml_gsl_sf_erfc" "gsl_sf_erfc" "float" external erfc_e : float -> result = "ml_gsl_sf_erfc_e" external log_erfc : float -> float = "ml_gsl_sf_log_erfc" "gsl_sf_log_erfc" "float" external log_erfc_e : float -> result = "ml_gsl_sf_log_erfc_e" external erf_Z : float -> float = "ml_gsl_sf_erf_Z" "gsl_sf_erf_Z" "float" external erf_Z_e : float -> result = "ml_gsl_sf_erf_Z_e" external erf_Q : float -> float = "ml_gsl_sf_erf_Q" "gsl_sf_erf_Q" "float" external erf_Q_e : float -> result = "ml_gsl_sf_erf_Q_e" (* EXPONENTIAL functions *) external exp : float -> float = "ml_gsl_sf_exp" "gsl_sf_exp" "float" external exp_e : float -> result = "ml_gsl_sf_exp_e" external exp_e10 : float -> result_e10 = "ml_gsl_sf_exp_e10_e" external exp_mult : float -> float -> float = "ml_gsl_sf_exp_mult" "gsl_sf_exp_mult" "float" external exp_mult_e : float -> float -> result = "ml_gsl_sf_exp_mult_e" external exp_mult_e10 : float -> float -> result_e10 = "ml_gsl_sf_exp_mult_e10_e" external expm1 : float -> float = "ml_gsl_sf_expm1" "gsl_sf_expm1" "float" external expm1_e : float -> result = "ml_gsl_sf_expm1_e" external exprel : float -> float = "ml_gsl_sf_exprel" "gsl_sf_exprel" "float" external exprel_e : float -> result = "ml_gsl_sf_exprel_e" external exprel_2 : float -> float = "ml_gsl_sf_exprel_2" "gsl_sf_exprel_2" "float" external exprel_2_e : float -> result = "ml_gsl_sf_exprel_2_e" external exprel_n : int -> float -> float = "ml_gsl_sf_exprel_n" external exprel_n_e : int -> float -> result = "ml_gsl_sf_exprel_n_e" external exp_err_e : x:float -> dx:float -> result = "ml_gsl_sf_exp_err_e" external exp_err_e10 : x:float -> dx:float -> result_e10 = "ml_gsl_sf_exp_err_e10_e" external exp_mult_err_e : x:float -> dx:float -> y:float -> dy:float -> result = "ml_gsl_sf_exp_mult_err_e" external exp_mult_err_e10_e : x:float -> dx:float -> y:float -> dy:float -> result_e10 = "ml_gsl_sf_exp_mult_err_e10_e" (* EXPONENTIAL integrals *) external expint_E1 : float -> float = "ml_gsl_sf_expint_E1" "gsl_sf_expint_E1" "float" external expint_E1_e : float -> result = "ml_gsl_sf_expint_E1_e" external expint_E2 : float -> float = "ml_gsl_sf_expint_E2" "gsl_sf_expint_E2" "float" external expint_E2_e : float -> result = "ml_gsl_sf_expint_E2_e" external expint_E1_scaled : float -> float = "ml_gsl_sf_expint_E1_scaled" "gsl_sf_expint_E1_scaled" "float" external expint_E1_scaled_e : float -> result = "ml_gsl_sf_expint_E1_scaled_e" external expint_E2_scaled : float -> float = "ml_gsl_sf_expint_E2_scaled" "gsl_sf_expint_E2_scaled" "float" external expint_E2_scaled_e : float -> result = "ml_gsl_sf_expint_E2_scaled_e" external expint_Ei : float -> float = "ml_gsl_sf_expint_Ei" "gsl_sf_expint_Ei" "float" external expint_Ei_e : float -> result = "ml_gsl_sf_expint_Ei_e" external expint_Ei_scaled : float -> float = "ml_gsl_sf_expint_Ei_scaled" "gsl_sf_expint_Ei_scaled" "float" external expint_Ei_scaled_e : float -> result = "ml_gsl_sf_expint_Ei_scaled_e" external shi : float -> float = "ml_gsl_sf_Shi" external chi : float -> float = "ml_gsl_sf_Chi" external expint_3 : float -> float = "ml_gsl_sf_expint_3" "gsl_sf_expint_3" "float" external expint_3_e : float -> result = "ml_gsl_sf_expint_3_e" external si : float -> float = "ml_gsl_sf_Si" external ci : float -> float = "ml_gsl_sf_Ci" external atanint : float -> float = "ml_gsl_sf_atanint" "gsl_sf_atanint" "float" external atanint_e : float -> result = "ml_gsl_sf_atanint_e" (* fermi-dirac *) external fermi_dirac_m1 : float -> float = "ml_gsl_sf_fermi_dirac_m1" "gsl_sf_fermi_dirac_m1" "float" external fermi_dirac_m1_e : float -> result = "ml_gsl_sf_fermi_dirac_m1_e" external fermi_dirac_0 : float -> float = "ml_gsl_sf_fermi_dirac_0" "gsl_sf_fermi_dirac_0" "float" external fermi_dirac_0_e : float -> result = "ml_gsl_sf_fermi_dirac_0_e" external fermi_dirac_1 : float -> float = "ml_gsl_sf_fermi_dirac_1" "gsl_sf_fermi_dirac_1" "float" external fermi_dirac_1_e : float -> result = "ml_gsl_sf_fermi_dirac_1_e" external fermi_dirac_2 : float -> float = "ml_gsl_sf_fermi_dirac_2" "gsl_sf_fermi_dirac_2" "float" external fermi_dirac_2_e : float -> result = "ml_gsl_sf_fermi_dirac_2_e" external fermi_dirac_int : int -> float -> float = "ml_gsl_sf_fermi_dirac_int" external fermi_dirac_int_e : int -> float -> result = "ml_gsl_sf_fermi_dirac_int_e" external fermi_dirac_mhalf : float -> float = "ml_gsl_sf_fermi_dirac_mhalf" "gsl_sf_fermi_dirac_mhalf" "float" external fermi_dirac_mhalf_e : float -> result = "ml_gsl_sf_fermi_dirac_mhalf_e" external fermi_dirac_half : float -> float = "ml_gsl_sf_fermi_dirac_half" "gsl_sf_fermi_dirac_half" "float" external fermi_dirac_half_e : float -> result = "ml_gsl_sf_fermi_dirac_half_e" external fermi_dirac_3half : float -> float = "ml_gsl_sf_fermi_dirac_3half" "gsl_sf_fermi_dirac_3half" "float" external fermi_dirac_3half_e : float -> result = "ml_gsl_sf_fermi_dirac_3half_e" external fermi_dirac_inc_0 : float -> float -> float = "ml_gsl_sf_fermi_dirac_inc_0" "gsl_sf_fermi_dirac_inc_0" "float" external fermi_dirac_inc_0_e : float -> float -> result = "ml_gsl_sf_fermi_dirac_inc_0_e" (* Gamma function *) external gamma : float -> float = "ml_gsl_sf_gamma" "gsl_sf_gamma" "float" external gamma_e : float -> result = "ml_gsl_sf_gamma_e" external lngamma : float -> float = "ml_gsl_sf_lngamma" "gsl_sf_lngamma" "float" external lngamma_e : float -> result = "ml_gsl_sf_lngamma_e" external lngamma_sgn_e : float -> result * float = "ml_gsl_sf_lngamma_sgn_e" external gammastar : float -> float = "ml_gsl_sf_gammastar" "gsl_sf_gammastar" "float" external gammastar_e : float -> result = "ml_gsl_sf_gammastar_e" external gammainv : float -> float = "ml_gsl_sf_gammainv" "gsl_sf_gammainv" "float" external gammainv_e : float -> result = "ml_gsl_sf_gammainv_e" external lngamma_complex_e : float -> float -> result * result = "ml_gsl_sf_lngamma_complex_e" external taylorcoeff : int -> float -> float = "ml_gsl_sf_taylorcoeff" external taylorcoeff_e : int -> float -> result = "ml_gsl_sf_taylorcoeff_e" external fact : int -> float = "ml_gsl_sf_fact" external fact_e : int -> result = "ml_gsl_sf_fact_e" external doublefact : int -> float = "ml_gsl_sf_doublefact" external doublefact_e : int -> result = "ml_gsl_sf_doublefact_e" external lnfact : int -> float = "ml_gsl_sf_lnfact" external lnfact_e : int -> result = "ml_gsl_sf_lnfact_e" external lndoublefact : int -> float = "ml_gsl_sf_lndoublefact" external lndoublefact_e : int -> result = "ml_gsl_sf_lndoublefact_e" external choose : int -> int -> float = "ml_gsl_sf_choose" external choose_e : int -> int -> result = "ml_gsl_sf_choose_e" external lnchoose : int -> int -> float = "ml_gsl_sf_lnchoose" external lnchoose_e : int -> int -> result = "ml_gsl_sf_lnchoose_e" external poch : float -> float -> float = "ml_gsl_sf_poch" "gsl_sf_poch" "float" external poch_e : float -> float -> result = "ml_gsl_sf_poch_e" external lnpoch : float -> float -> float = "ml_gsl_sf_lnpoch" "gsl_sf_lnpoch" "float" external lnpoch_e : float -> float -> result = "ml_gsl_sf_lnpoch_e" external lnpoch_sgn_e : float -> float -> result * float = "ml_gsl_sf_lngamma_sgn_e" external pochrel : float -> float -> float = "ml_gsl_sf_pochrel" "gsl_sf_pochrel" "float" external pochrel_e : float -> float -> result = "ml_gsl_sf_pochrel_e" external gamma_inc_Q : float -> float -> float = "ml_gsl_sf_gamma_inc_Q" "gsl_sf_gamma_inc_Q" "float" external gamma_inc_Q_e : float -> float -> result = "ml_gsl_sf_gamma_inc_Q_e" external gamma_inc_P : float -> float -> float = "ml_gsl_sf_gamma_inc_P" "gsl_sf_gamma_inc_P" "float" external gamma_inc_P_e : float -> float -> result = "ml_gsl_sf_gamma_inc_P_e" external gamma_inc : float -> float -> float = "ml_gsl_sf_gamma_inc" "gsl_sf_gamma_inc" "float" external gamma_inc_e : float -> float -> result = "ml_gsl_sf_gamma_inc_e" external beta : float -> float -> float = "ml_gsl_sf_beta" "gsl_sf_beta" "float" external beta_e : float -> float -> result = "ml_gsl_sf_beta_e" external lnbeta : float -> float -> float = "ml_gsl_sf_lnbeta" "gsl_sf_lnbeta" "float" external lnbeta_e : float -> float -> result = "ml_gsl_sf_lnbeta_e" external lnbeta_sgn_e : float -> float -> result * float = "ml_gsl_sf_lnbeta_sgn_e" external beta_inc : float -> float -> float -> float = "ml_gsl_sf_beta_inc" "gsl_sf_beta_inc" "float" external beta_inc_e : float -> float -> float -> result = "ml_gsl_sf_beta_inc_e" (* GEGENBAUER functions *) external gegenpoly_1 : float -> float -> float = "ml_gsl_sf_gegenpoly_1" "gsl_sf_gegenpoly_1" "float" external gegenpoly_1_e : float -> float -> result = "ml_gsl_sf_gegenpoly_1_e" external gegenpoly_2 : float -> float -> float = "ml_gsl_sf_gegenpoly_2" "gsl_sf_gegenpoly_2" "float" external gegenpoly_2_e : float -> float -> result = "ml_gsl_sf_gegenpoly_2_e" external gegenpoly_3 : float -> float -> float = "ml_gsl_sf_gegenpoly_3" "gsl_sf_gegenpoly_3" "float" external gegenpoly_3_e : float -> float -> result = "ml_gsl_sf_gegenpoly_3_e" external gegenpoly_n : int -> float -> float -> float = "ml_gsl_sf_gegenpoly_n" external gegenpoly_n_e : int -> float -> float -> result = "ml_gsl_sf_gegenpoly_n_e" external gegenpoly_array : float -> float -> float array -> unit = "ml_gsl_sf_gegenpoly_array" (* HYPERGEOMETRIC functions *) (* FIXME *) (* LAGUERRE functions *) external laguerre_1 : float -> float -> float = "ml_gsl_sf_laguerre_1" "gsl_sf_laguerre_1" "float" external laguerre_1_e : float -> float -> result = "ml_gsl_sf_laguerre_1_e" external laguerre_2 : float -> float -> float = "ml_gsl_sf_laguerre_2" "gsl_sf_laguerre_2" "float" external laguerre_2_e : float -> float -> result = "ml_gsl_sf_laguerre_2_e" external laguerre_3 : float -> float -> float = "ml_gsl_sf_laguerre_3" "gsl_sf_laguerre_3" "float" external laguerre_3_e : float -> float -> result = "ml_gsl_sf_laguerre_3_e" external laguerre_n : int -> float -> float -> float = "ml_gsl_sf_laguerre_n" external laguerre_n_e : int -> float -> float -> result = "ml_gsl_sf_laguerre_n_e" (* LAMBERT W functions *) external lambert_W0 : float -> float = "ml_gsl_sf_lambert_W0" "gsl_sf_lambert_W0" "float" external lambert_W0_e : float -> result = "ml_gsl_sf_lambert_W0_e" external lambert_Wm1 : float -> float = "ml_gsl_sf_lambert_Wm1" "gsl_sf_lambert_Wm1" "float" external lambert_Wm1_e : float -> result = "ml_gsl_sf_lambert_Wm1_e" (* LEGENDRE functions *) external legendre_P1 : float -> float = "ml_gsl_sf_legendre_P1" "gsl_sf_legendre_P1" "float" external legendre_P1_e : float -> result = "ml_gsl_sf_legendre_P1_e" external legendre_P2 : float -> float = "ml_gsl_sf_legendre_P2" "gsl_sf_legendre_P2" "float" external legendre_P2_e : float -> result = "ml_gsl_sf_legendre_P2_e" external legendre_P3 : float -> float = "ml_gsl_sf_legendre_P3" "gsl_sf_legendre_P3" "float" external legendre_P3_e : float -> result = "ml_gsl_sf_legendre_P3_e" external legendre_Pl : int -> float -> float = "ml_gsl_sf_legendre_Pl" external legendre_Pl_e : int -> float -> result = "ml_gsl_sf_legendre_Pl_e" external legendre_Pl_array : float -> float array -> unit = "ml_gsl_sf_legendre_Pl_array" external legendre_Q0 : float -> float = "ml_gsl_sf_legendre_Q0" "gsl_sf_legendre_Q0" "float" external legendre_Q0_e : float -> result = "ml_gsl_sf_legendre_Q0_e" external legendre_Q1 : float -> float = "ml_gsl_sf_legendre_Q1" "gsl_sf_legendre_Q1" "float" external legendre_Q1_e : float -> result = "ml_gsl_sf_legendre_Q1_e" external legendre_Ql : int -> float -> float = "ml_gsl_sf_legendre_Ql" external legendre_Ql_e : int -> float -> result = "ml_gsl_sf_legendre_Ql_e" (* Associated LEGENDRE functions *) external legendre_Plm : int -> int -> float -> float = "ml_gsl_sf_legendre_Plm" external legendre_Plm_e : int -> int -> float -> result = "ml_gsl_sf_legendre_Plm_e" external legendre_Plm_array : int -> int -> float -> float array -> unit = "ml_gsl_sf_legendre_Plm_array" external legendre_sphPlm : int -> int -> float -> float = "ml_gsl_sf_legendre_sphPlm" external legendre_sphPlm_e : int -> int -> float -> result = "ml_gsl_sf_legendre_sphPlm_e" external legendre_sphPlm_array : int -> int -> float -> float array -> unit = "ml_gsl_sf_legendre_sphPlm_array" external legendre_array_size : int -> int -> int = "ml_gsl_sf_legendre_array_size" (* LOGARITHM and related functions *) external log : float -> float = "ml_gsl_sf_log" "gsl_sf_log" "float" external log_e : float -> result = "ml_gsl_sf_log_e" external log_abs : float -> float = "ml_gsl_sf_log_abs" "gsl_sf_log_abs" "float" external log_abs_e : float -> result = "ml_gsl_sf_log_abs_e" external log_complex_e : float -> float -> result * result = "ml_gsl_sf_complex_log_e" external log_1plusx : float -> float = "ml_gsl_sf_log_1plusx" "gsl_sf_log_1plusx" "float" external log_1plusx_e : float -> result = "ml_gsl_sf_log_1plusx_e" external log_1plusx_mx : float -> float = "ml_gsl_sf_log_1plusx_mx" "gsl_sf_log_1plusx_mx" "float" external log_1plusx_mx_e : float -> result = "ml_gsl_sf_log_1plusx_mx_e" (* POWER function *) external pow_int : float -> int -> float = "ml_gsl_sf_pow_int" external pow_int_e : float -> int -> result = "ml_gsl_sf_pow_int_e" (* PSI function *) external psi_int : int -> float = "ml_gsl_sf_psi_int" external psi_int_e : int -> result = "ml_gsl_sf_psi_int_e" external psi : float -> float = "ml_gsl_sf_psi" "gsl_sf_psi" "float" external psi_e : float -> result = "ml_gsl_sf_psi_e" external psi_1piy : float -> float = "ml_gsl_sf_psi_1piy" "gsl_sf_psi_1piy" "float" external psi_1piy_e : float -> result = "ml_gsl_sf_psi_1piy_e" external psi_complex_e : float -> float -> result * result = "ml_gsl_sf_complex_psi_e" external psi_1_int : int -> float = "ml_gsl_sf_psi_1_int" external psi_1_int_e : int -> result = "ml_gsl_sf_psi_1_int_e" external psi_1 : float -> float = "ml_gsl_sf_psi_1" "gsl_sf_psi_1" "float" external psi_1_e : float -> result = "ml_gsl_sf_psi_1_e" external psi_n : int -> float -> float = "ml_gsl_sf_psi_n" external psi_n_e : int -> float -> result = "ml_gsl_sf_psi_n_e" (* SYNCHROTRON functions *) external synchrotron_1 : float -> float = "ml_gsl_sf_synchrotron_1" "gsl_sf_synchrotron_1" "float" external synchrotron_1_e : float -> result = "ml_gsl_sf_synchrotron_1_e" external synchrotron_2 : float -> float = "ml_gsl_sf_synchrotron_2" "gsl_sf_synchrotron_2" "float" external synchrotron_2_e : float -> result = "ml_gsl_sf_synchrotron_2_e" (* TRANSPORT functions *) external transport_2 : float -> float = "ml_gsl_sf_transport_2" "gsl_sf_transport_2" "float" external transport_2_e : float -> result = "ml_gsl_sf_transport_2_e" external transport_3 : float -> float = "ml_gsl_sf_transport_3" "gsl_sf_transport_3" "float" external transport_3_e : float -> result = "ml_gsl_sf_transport_3_e" external transport_4 : float -> float = "ml_gsl_sf_transport_4" "gsl_sf_transport_4" "float" external transport_4_e : float -> result = "ml_gsl_sf_transport_4_e" external transport_5 : float -> float = "ml_gsl_sf_transport_5" "gsl_sf_transport_5" "float" external transport_5_e : float -> result = "ml_gsl_sf_transport_5_e" (* TRIGONOMETRIC functions *) external sin : float -> float = "ml_gsl_sf_sin" "gsl_sf_sin" "float" external sin_e : float -> result = "ml_gsl_sf_sin_e" external cos : float -> float = "ml_gsl_sf_cos" "gsl_sf_cos" "float" external cos_e : float -> result = "ml_gsl_sf_cos_e" external hypot : float -> float = "ml_gsl_sf_hypot" "gsl_sf_hypot" "float" external hypot_e : float -> result = "ml_gsl_sf_hypot_e" external sinc : float -> float = "ml_gsl_sf_sinc" "gsl_sf_sinc" "float" external sinc_e : float -> result = "ml_gsl_sf_sinc_e" external complex_sin_e : float -> float -> result * result = "ml_gsl_sf_complex_sin_e" external complex_cos_e : float -> float -> result * result = "ml_gsl_sf_complex_cos_e" external complex_logsin_e : float -> float -> result * result = "ml_gsl_sf_complex_logsin_e" external lnsinh : float -> float = "ml_gsl_sf_lnsinh" "gsl_sf_lnsinh" "float" external lnsinh_e : float -> result = "ml_gsl_sf_lnsinh_e" external lncosh : float -> float = "ml_gsl_sf_lncosh" "gsl_sf_lncosh" "float" external lncosh_e : float -> result = "ml_gsl_sf_lncosh_e" external rect_of_polar : r:float -> theta:float -> result * result = "ml_gsl_sf_polar_to_rect" external polar_of_rect : x:float -> y:float -> result * result = "ml_gsl_sf_rect_to_polar" external angle_restrict_symm : float -> float = "ml_gsl_sf_angle_restrict_symm" external angle_restrict_pos : float -> float = "ml_gsl_sf_angle_restrict_pos" external sin_err_e : float -> dx:float -> result = "ml_gsl_sf_sin_err_e" external cos_err_e : float -> dx:float -> result = "ml_gsl_sf_cos_err_e" (* ZETA functions *) external zeta_int : int -> float = "ml_gsl_sf_zeta_int" external zeta_int_e : int -> result = "ml_gsl_sf_zeta_int_e" external zeta : float -> float = "ml_gsl_sf_zeta" "gsl_sf_zeta" "float" external zeta_e : float -> result = "ml_gsl_sf_zeta_e" external hzeta : float -> float -> float = "ml_gsl_sf_hzeta" "gsl_sf_hzeta" "float" external hzeta_e : float -> float -> result = "ml_gsl_sf_hzeta_e" external eta_int : int -> float = "ml_gsl_sf_eta_int" external eta_int_e : int -> result = "ml_gsl_sf_eta_int_e" external eta : float -> float = "ml_gsl_sf_eta" "gsl_sf_eta" "float" external eta_e : float -> result = "ml_gsl_sf_eta_e" orpie-1.5.2/solvelin.ml0000644000175000017500000001432112322115103013475 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) open Rpc_stack (* solve a linear system Ax = b, with input nxn matrix A and output nx1 * matrix b *) let solve_linear (stack : rpc_stack) (evaln : int -> unit) = evaln 2; let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in match gen_el1 with |RpcFloatMatrixUnit (el1, u1) -> begin match gen_el2 with |RpcFloatMatrixUnit (el2, u2) -> let n1, m1 = Gsl_matrix.dims el1 in if n1 <> m1 then (stack#push gen_el2; stack#push gen_el1; raise (Invalid_argument "multiplier matrix must be square")) else let n2, m2 = Gsl_matrix.dims el2 in if m2 <> 1 then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "resultant matrix must be a column") end else if n2 <> m1 then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument ("dimensions of multiplier and " ^ "resultant matrices do not match")) end else begin let b = Gsl_matrix.to_array el2 in let x = Gsl_linalg.solve_LU (`M el1) (`A b) in let x_mat = Gsl_matrix.of_array x m1 1 in stack#push (RpcFloatMatrixUnit (x_mat, Units.div u2 u1)) end |RpcComplexMatrixUnit (el2, u2) -> let n1, m1 = Gsl_matrix.dims el1 in if n1 <> m1 then (stack#push gen_el2; stack#push gen_el1; raise (Invalid_argument "multiplier matrix must be square")) else let n2, m2 = Gsl_matrix_complex.dims el2 in if m2 <> 1 then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "resultant matrix must be a column") end else if n2 <> m1 then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument ("dimensions of multiplier and" ^ "resultant matrices do not match")) end else begin let a_cpx = Gsl_assist.cmat_of_fmat el1 in let b_arr = Gsl_matrix_complex.to_array el2 in let b_vec = Gsl_vector_complex.of_array b_arr in let x = Gsl_assist.solve_complex_LU (`CM a_cpx) b_vec in let x_mat = Gsl_matrix_complex.of_complex_array x m1 1 in stack#push (RpcComplexMatrixUnit (x_mat, Units.div u2 u1)) end |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "both arguments of solve_linear must be matrices")) end |RpcComplexMatrixUnit (el1, u1) -> begin match gen_el2 with |RpcFloatMatrixUnit (el2, u2) -> let n1, m1 = Gsl_matrix_complex.dims el1 in if n1 <> m1 then begin stack#push gen_el2; stack#push gen_el1; raise (Invalid_argument "multiplier matrix must be square") end else let n2, m2 = Gsl_matrix.dims el2 in if m2 <> 1 then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "resultant matrix must be a column") end else if n2 <> m1 then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument ("dimensions of multiplier and" ^ "resultant matrices do not match")) end else begin let b_cpx = Gsl_assist.cmat_of_fmat el2 in let b_arr = Gsl_matrix_complex.to_array b_cpx in let b_vec = Gsl_vector_complex.of_array b_arr in let x = Gsl_assist.solve_complex_LU (`CM el1) b_vec in let x_mat = Gsl_matrix_complex.of_complex_array x m1 1 in stack#push (RpcComplexMatrixUnit (x_mat, Units.div u2 u1)) end |RpcComplexMatrixUnit (el2, u2) -> let n1, m1 = Gsl_matrix_complex.dims el1 in if n1 <> m1 then begin stack#push gen_el2; stack#push gen_el1; raise (Invalid_argument "multiplier matrix must be square") end else let n2, m2 = Gsl_matrix_complex.dims el2 in if m2 <> 1 then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "resultant matrix must be a column") end else if n2 <> m1 then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument ("dimensions of multiplier and" ^ "resultant matrices do not match")) end else begin let b_arr = Gsl_matrix_complex.to_array el2 in let b_vec = Gsl_vector_complex.of_array b_arr in let x = Gsl_assist.solve_complex_LU (`CM el1) b_vec in let x_mat = Gsl_matrix_complex.of_complex_array x m1 1 in stack#push (RpcComplexMatrixUnit (x_mat, Units.div u2 u1)) end |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "both arguments of solve_linear must be matrices")) end |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "both arguments of solve_linear must be matrices")) (* arch-tag: DO_NOT_CHANGE_c11268a8-d37a-4573-98db-e985cc338e38 *) orpie-1.5.2/operations.ml0000644000175000017500000000714412322115103014032 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* A function will push any item in the entry buffer before performing the * operation. A command does not take input, so it is not allowed when data is * in the entry buffer. An edit is an operation that acts on the data in the * entry buffer (e.g. backspace). *) type function_operation_t = | Add | Sub | Mult | Div | Neg | Inv | Pow | Sqrt | Sq | Abs | Arg | Exp | Ln | Ten_x | Log10 | Conj | Sin | Cos | Tan | Asin | Acos | Atan | Sinh | Cosh | Tanh | Asinh | Acosh | Atanh | Re | Im | Gamma | LnGamma | Erf | Erfc | Fact | Transpose | Mod | Floor | Ceiling | ToInt | ToFloat | SolveLin | Eval | Store | Purge | Gcd | Lcm | Binom | Perm | Total | Mean | Sumsq | Var |VarBias | Stdev | StdevBias | Min | Max | Utpn | StandardizeUnits | ConvertUnits | UnitValue | Trace;; type command_operation_t = | Drop | Clear | Swap | Dup | Undo | BeginBrowse | BeginAbbrev | BeginVar | Quit | SetRadians | SetDegrees | SetRect | SetPolar | SetBin | SetOct | SetDec | SetHex | ToggleAngleMode | ToggleComplexMode | CycleBase | View | About | Refresh | EnterPi | Rand | EditInput | CycleHelp | BeginConst;; type edit_operation_t = | Digit | Enter | Backspace | Minus | SciNotBase | BeginInteger | BeginComplex | BeginMatrix | Separator | Angle | BeginUnits;; type browse_operation_t = | EndBrowse | ScrollLeft | ScrollRight | RollDown | RollUp | PrevLine | NextLine | Echo | ViewEntry | Drop1 | DropN | Keep | KeepN | EditEntry;; type abbrev_operation_t = | AbbrevExit | AbbrevEnter | AbbrevBackspace;; type integer_edit_operation_t = | IntEditExit;; type var_edit_operation_t = | VarEditExit | VarEditEnter | VarEditBackspace | VarEditComplete;; type operation_t = | Function of function_operation_t | Command of command_operation_t | Edit of edit_operation_t | Browse of browse_operation_t | Abbrev of abbrev_operation_t | IntEdit of integer_edit_operation_t | VarEdit of var_edit_operation_t;; (* arch-tag: DO_NOT_CHANGE_e761ca10-6bfd-4edf-a3de-53778a07ca21 *) orpie-1.5.2/orpie.spec0000644000175000017500000000321712322115103013304 0ustar paulpaulName: orpie Version: 1.5.0 Release: 1 Summary: A fullscreen console-based RPN calculator application. Group: Utilities/Math License: GPL URL: http://pessimization.com/software/orpie/ Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: ocaml BuildRequires: gsl-devel BuildRequires: ncurses-devel Requires: ocaml >= 3.07 Requires: gsl >= 1.4 Requires: ncurses %description orpie is a fullscreen console-based RPN calculator that uses the curses library. Its operation is similar to that of modern HP calculators, but data entry has been optimized for efficiency on a PC keyboard. Its features include extensive scientific calculator functionality, command completion, and a visible interactive stack. %prep %setup -q %build %configure make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT %check || : #make test #make check %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-, root, root) %config %{_sysconfdir}/orpierc %doc doc/manual.html doc/manual.pdf doc/manual.tex.in doc/TODO README COPYING ChangeLog %{_bindir}/* %{_mandir}/man[^3]/* %changelog * Mon Mar 21 2005 Chris Petersen - Update spec to match fedora guidelines * Mon Aug 2 2004 Chris Petersen - Minor changes to spec format for better consistency and readability * Tue Jun 15 2004 Chris Petersen - Update RPM for 1.2rc1, and include orpie-curses-keys man info * Tue Apr 6 2004 Chris Petersen - Built initial RPM orpie-1.5.2/txtin_parser.mly0000644000175000017500000002563112322115103014563 0ustar paulpaul%{ (* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* txtinr_parser.mly * * Orpie can handle input of data from a textfile created by an external editor. * editor_parser.mly generates a parser that works in conjunction with * editor_lexer.mll to enter this data on the stack. *) let pi = 3.14159265358979323846;; type f_or_c = | F of float | C of Complex.t (* decode a matrix of type CF and decide * whether it has float elements or complex elements, * then create the appropriate orpie_data_t type. *) let decode_float_complex_matrix mat u_str = let num_rows = Array.length mat and num_cols = Array.length mat.(0) in let flt_array = Array.make_matrix num_rows num_cols 0.0 and cpx_array = Array.make_matrix num_rows num_cols Complex.zero in let has_complex = ref false in for i = 0 to pred num_rows do if Array.length mat.(i) != num_cols then raise (Utility.Txtin_error "inconsistent number of columns in input matrix") else begin for j = 0 to pred num_cols do begin match mat.(i).(j) with |F el -> flt_array.(i).(j) <- el; cpx_array.(i).(j) <- {Complex.re = el; Complex.im = 0.0} |C el -> has_complex := true; cpx_array.(i).(j) <- el end done; end done; if !has_complex then Rpc_stack.RpcComplexMatrixUnit (Gsl_matrix_complex.of_arrays cpx_array, Units.units_of_string (Str.string_after u_str 1) !Rcfile.unit_table) else Rpc_stack.RpcFloatMatrixUnit (Gsl_matrix.of_arrays flt_array, Units.units_of_string (Str.string_after u_str 1) !Rcfile.unit_table) let rect_of_polar_rad r theta = let real = r *. (cos theta) and imag = r *. (sin theta) in {Complex.re = real; Complex.im = imag} let rect_of_polar_deg r theta = let rad_theta = theta /. 180.0 *. pi in rect_of_polar_rad r rad_theta (* convert an integer string to an RpcInt *) let decode_integer i_str = let int_str = i_str in let str_len = String.length int_str in let digits = Str.string_before int_str (str_len - 2) in let int_val = let base_char = int_str.[pred str_len] in if base_char = 'b' then Big_int_str.big_int_of_string_base digits 2 else if base_char = 'o' then Big_int_str.big_int_of_string_base digits 8 else if base_char = 'd' then Big_int_str.big_int_of_string_base digits 10 else if base_char = 'h' then Big_int_str.big_int_of_string_base digits 16 else let base_string = String.make 1 base_char in raise (Utility.Txtin_error ("illegal base character " ^ base_string)) in Rpc_stack.RpcInt int_val (* convert a floating point string and a unit string to an RpcFloatUnit *) let decode_float_units f_str u_str = Rpc_stack.RpcFloatUnit ((float_of_string f_str), Units.units_of_string (Str.string_after u_str 1) !Rcfile.unit_table) (* convert a cartesian complex number string and a unit string to an * RpcComplexUnit *) let decode_complex_rect_units re_str im_str u_str = let f1 = float_of_string re_str and f2 = float_of_string im_str in Rpc_stack.RpcComplexUnit ({Complex.re = f1; Complex.im = f2}, Units.units_of_string (Str.string_after u_str 1) !Rcfile.unit_table) (* convert a polar representation complex number string to an * RpcComplex. The rect_of_polar argument should take care of * any necessary degrees/radians conversion. *) let decode_complex_polar_units rect_of_polar mag_str ang_str u_str = let mag = float_of_string mag_str and ang = float_of_string ang_str in Rpc_stack.RpcComplexUnit ((rect_of_polar mag ang), Units.units_of_string (Str.string_after u_str 1) !Rcfile.unit_table) (* convert a polar representation complex number string to an * RpcComplex. Assumes radian representation of the angle. *) let decode_complex_polar_rad_units mag_str ang_str u_str = decode_complex_polar_units rect_of_polar_rad mag_str ang_str u_str (* convert a polar representation complex number string to an * RpcComplex. Assumes degree representation of the angle. *) let decode_complex_polar_deg_units mag_str ang_str u_str = decode_complex_polar_units rect_of_polar_deg mag_str ang_str u_str (* convert a matrix to an RpcFloatMatrixUnit or an RpcComplexMatrix. *) let decode_matrix_units mat_rows u_str = (* matrix_rows is a list of rows, each of which * is a list of elements; create a 2d array * from these lists, and generate the appropriate * orpie_data_t from the 2d array. *) let num_rows = List.length mat_rows in let num_cols = List.length (List.hd mat_rows) in let mat = Array.make_matrix num_rows num_cols (F 0.0) in let temp_arr = Array.of_list (List.rev mat_rows) in for i = 0 to pred num_rows do mat.(i) <- Array.of_list (List.rev temp_arr.(i)) done; (* create a float array or a complex array, depending * on whether or not any complex types are present * in this array. *) decode_float_complex_matrix mat u_str (* convert a variable string to an RpcVariable *) let decode_variable v_str = Rpc_stack.RpcVariable v_str %} /* declarations */ %token INTEGER %token FLOAT %token VARIABLE %token UNITS %token BEGINCOMPLEX %token ENDCOMPLEX %token SEPARATOR %token ANGLE %token BEGINMATRIX %token ENDMATRIX %token EOF /* parse the input under the assumption that angles * are provided using radian measure */ %start decode_data_rad %type decode_data_rad /* parse the input under the assumption that angles * are provided using degree measure */ %start decode_data_deg %type decode_data_deg %% /* rules */ /**************************************** * ANGLES PROVIDED USING RADIAN MEASURE * ****************************************/ decode_data_rad: datalist_rad EOF { List.rev $1 } ; datalist_rad: datalist_rad datagroup_rad { $2 :: $1 } | /* empty */ { [] } ; datagroup_rad: data_rad { $1 } ; data_rad: INTEGER { decode_integer $1 } | VARIABLE { decode_variable $1} | FLOAT UNITS { decode_float_units $1 $2 } | FLOAT { decode_float_units $1 "_" } | BEGINCOMPLEX FLOAT SEPARATOR FLOAT ENDCOMPLEX UNITS { decode_complex_rect_units $2 $4 $6 } | BEGINCOMPLEX FLOAT SEPARATOR FLOAT ENDCOMPLEX { decode_complex_rect_units $2 $4 "_" } | BEGINCOMPLEX FLOAT ANGLE FLOAT ENDCOMPLEX UNITS { decode_complex_polar_rad_units $2 $4 $6 } | BEGINCOMPLEX FLOAT ANGLE FLOAT ENDCOMPLEX { decode_complex_polar_rad_units $2 $4 "_" } | BEGINMATRIX matrix_rows_rad ENDMATRIX UNITS { decode_matrix_units $2 $4 } | BEGINMATRIX matrix_rows_rad ENDMATRIX { decode_matrix_units $2 "_" } ; matrix_rows_rad: matrix_rows_rad BEGINMATRIX matrix_row_elements_rad ENDMATRIX {$3 :: $1} | /* empty */ {[]} ; matrix_row_elements_rad: matrix_row_elements_rad SEPARATOR FLOAT { (F (float_of_string $3)) :: $1 } | matrix_row_elements_rad SEPARATOR BEGINCOMPLEX FLOAT SEPARATOR FLOAT ENDCOMPLEX { let f1 = float_of_string $4 and f2 = float_of_string $6 in (C {Complex.re = f1; Complex.im = f2}) :: $1 } | matrix_row_elements_rad SEPARATOR BEGINCOMPLEX FLOAT ANGLE FLOAT ENDCOMPLEX { let r = float_of_string $4 and th = float_of_string $6 in (C (rect_of_polar_rad r th)) :: $1 } | FLOAT { (F (float_of_string $1)) :: [] } | BEGINCOMPLEX FLOAT SEPARATOR FLOAT ENDCOMPLEX { let f1 = float_of_string $2 and f2 = float_of_string $4 in (C {Complex.re = f1; Complex.im = f2}) :: [] } | BEGINCOMPLEX FLOAT ANGLE FLOAT ENDCOMPLEX { let r = float_of_string $2 and th = float_of_string $4 in (C (rect_of_polar_rad r th)) :: [] } ; /**************************************** * ANGLES PROVIDED USING DEGREE MEASURE * ****************************************/ decode_data_deg: datalist_deg EOF { List.rev $1 } ; datalist_deg: datalist_deg datagroup_deg { $2 :: $1 } | /* empty */ { [] } ; datagroup_deg: data_deg { $1 } ; data_deg: INTEGER { decode_integer $1 } | VARIABLE { decode_variable $1} | FLOAT UNITS { decode_float_units $1 $2 } | FLOAT { decode_float_units $1 "_" } | BEGINCOMPLEX FLOAT SEPARATOR FLOAT ENDCOMPLEX UNITS { decode_complex_rect_units $2 $4 $6 } | BEGINCOMPLEX FLOAT SEPARATOR FLOAT ENDCOMPLEX { decode_complex_rect_units $2 $4 "_" } | BEGINCOMPLEX FLOAT ANGLE FLOAT ENDCOMPLEX UNITS { decode_complex_polar_deg_units $2 $4 $6 } | BEGINCOMPLEX FLOAT ANGLE FLOAT ENDCOMPLEX { decode_complex_polar_deg_units $2 $4 "_" } | BEGINMATRIX matrix_rows_deg ENDMATRIX UNITS { decode_matrix_units $2 $4 } | BEGINMATRIX matrix_rows_deg ENDMATRIX { decode_matrix_units $2 "_" } ; matrix_rows_deg: matrix_rows_deg BEGINMATRIX matrix_row_elements_deg ENDMATRIX {$3 :: $1} | /* empty */ {[]} ; matrix_row_elements_deg: matrix_row_elements_deg SEPARATOR FLOAT { (F (float_of_string $3)) :: $1 } | matrix_row_elements_deg SEPARATOR BEGINCOMPLEX FLOAT SEPARATOR FLOAT ENDCOMPLEX { let f1 = float_of_string $4 and f2 = float_of_string $6 in (C {Complex.re = f1; Complex.im = f2}) :: $1 } | matrix_row_elements_deg SEPARATOR BEGINCOMPLEX FLOAT ANGLE FLOAT ENDCOMPLEX { let r = float_of_string $4 and th = float_of_string $6 in (C (rect_of_polar_deg r th)) :: $1 } | FLOAT { (F (float_of_string $1)) :: [] } | BEGINCOMPLEX FLOAT SEPARATOR FLOAT ENDCOMPLEX { let f1 = float_of_string $2 and f2 = float_of_string $4 in (C {Complex.re = f1; Complex.im = f2}) :: [] } | BEGINCOMPLEX FLOAT ANGLE FLOAT ENDCOMPLEX { let r = float_of_string $2 and th = float_of_string $4 in (C (rect_of_polar_deg r th)) :: [] } ; /* arch-tag: DO_NOT_CHANGE_c65a2550-f00d-40f1-b51f-f5d654257785 */ orpie-1.5.2/COPYING0000644000175000017500000004312712322115103012351 0ustar paulpaul GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. orpie-1.5.2/txtin_lexer.mll0000644000175000017500000000431612322115103014366 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* txtin_lexer.mll * * Orpie can handle input of data from a textfile created by an external editor. * editor_lexer.mll generates a lexer that tokenizes this data. *) { open Txtin_parser } (* space, tab, CR, linefeed, vertical tab *) let whitespace = [' ' '\010' '\013' '\009' '\012'] let digit = ['0'-'9'] let hex_digit = ['0'-'9' 'a'-'f' 'A'-'F'] let base_ident = ['b' 'o' 'd' 'h'] let sign = ['-' '+'] let variable_char = ['a'-'z' 'A'-'Z' '0'-'9' '-' '_'] let units = ['a'-'z' 'A'-'Z' '0'-'9' '.' '-' '*' '/' '^'] rule token = parse whitespace+ {token lexbuf} | '#' sign? hex_digit+ '`' base_ident { let s = Lexing.lexeme lexbuf in let int_str = String.sub s 1 (String.length s - 1) in INTEGER int_str} | '@' variable_char+ { let s = Lexing.lexeme lexbuf in let var_str = String.sub s 1 (String.length s - 1) in VARIABLE var_str} | ((sign? digit+ ('.' digit*)?) | (sign? digit* '.' digit+)) ('e' sign? digit+)? { FLOAT (Lexing.lexeme lexbuf)} | '_' units* { UNITS (Lexing.lexeme lexbuf)} | '(' { BEGINCOMPLEX } | ')' { ENDCOMPLEX } | ',' { SEPARATOR } | '<' { ANGLE } | '[' { BEGINMATRIX } | ']' { ENDMATRIX } | eof { EOF} (* arch-tag: DO_NOT_CHANGE_d4979b04-40d1-47e1-aab6-a04c0ded49ff *) orpie-1.5.2/div.ml0000644000175000017500000002370612322115103012433 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) open Rpc_stack open Gsl_error open Gsl_assist open Big_int let div (stack : rpc_stack) (evaln : int -> unit) = evaln 2; let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in match gen_el1 with |RpcInt el1 -> ( match gen_el2 with |RpcInt el2 -> stack#push (RpcInt (div_big_int el1 el2)) |RpcFloatUnit (el2, uu2) -> let f_el1 = float_of_big_int el1 in stack#push (RpcFloatUnit (f_el1 /. el2, Units.div Units.empty_unit uu2)) |RpcComplexUnit (el2, uu2) -> let c_el1 = cmpx_of_int el1 in stack#push (RpcComplexUnit (Complex.div c_el1 el2, Units.div Units.empty_unit uu2)) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for division")) ) |RpcFloatUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> let f_el2 = float_of_big_int el2 in stack#push (RpcFloatUnit (el1 /. f_el2, uu1)) |RpcFloatUnit (el2, uu2) -> stack#push (RpcFloatUnit (el1 /. el2, Units.div uu1 uu2)) |RpcComplexUnit (el2, uu2) -> let c_el1 = c_of_f el1 in stack#push (RpcComplexUnit (Complex.div c_el1 el2, Units.div uu1 uu2)) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for division")) ) |RpcComplexUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> let c_el2 = cmpx_of_int el2 in stack#push (RpcComplexUnit (Complex.div el1 c_el2, uu1)) |RpcFloatUnit (el2, uu2) -> let c_el2 = c_of_f el2 in stack#push (RpcComplexUnit (Complex.div el1 c_el2, Units.div uu1 uu2)) |RpcComplexUnit (el2, uu2) -> stack#push (RpcComplexUnit (Complex.div el1 el2, Units.div uu1 uu2)) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for division")) ) |RpcFloatMatrixUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> let f_el2 = float_of_big_int el2 in let result = Gsl_matrix.copy el1 in (Gsl_matrix.scale result (1.0 /. f_el2)); stack#push (RpcFloatMatrixUnit (result, uu1)) |RpcFloatUnit (el2, uu2) -> let result = Gsl_matrix.copy el1 in (Gsl_matrix.scale result (1.0 /. el2)); stack#push (RpcFloatMatrixUnit (result, Units.div uu1 uu2)) |RpcComplexUnit (el2, uu2) -> let c_el1 = cmat_of_fmat el1 in Gsl_matrix_complex.scale c_el1 (Complex.inv el2); stack#push (RpcComplexMatrixUnit (c_el1, Units.div uu1 uu2)) |RpcFloatMatrixUnit (el2, uu2) -> let n1, m1 = (Gsl_matrix.dims el1) and n2, m2 = (Gsl_matrix.dims el2) in if n2 = m2 then if m1 = n2 then let copy_el2 = Gsl_vectmat.mat_convert ~protect:true (`M el2) and perm = Gsl_permut.create m1 and inv = Gsl_matrix.create m1 m1 in try let _ = Gsl_linalg._LU_decomp copy_el2 perm in Gsl_linalg._LU_invert copy_el2 perm (`M inv); let result = Gsl_matrix.create n1 m2 in Gsl_blas.gemm Gsl_blas.NoTrans Gsl_blas.NoTrans 1.0 el1 inv 0.0 result; stack#push (RpcFloatMatrixUnit (result, Units.div uu1 uu2)) with Gsl_exn _ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "divisor matrix is singular")) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible dimensions for division")) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "divisor matrix is non-square")) |RpcComplexMatrixUnit (el2, uu2) -> let n1, m1 = (Gsl_matrix.dims el1) and n2, m2 = (Gsl_matrix_complex.dims el2) in if n2 = m2 then if m1 = n2 then let copy_el2 = Gsl_matrix_complex.copy el2 and perm = Gsl_permut.create m1 and inv = Gsl_matrix_complex.create m1 m1 in try let _ = Gsl_linalg.complex_LU_decomp (`CM copy_el2) perm in Gsl_linalg.complex_LU_invert (`CM copy_el2) perm (`CM inv); let result = Gsl_matrix_complex.create n1 m2 in Gsl_blas.Complex.gemm Gsl_blas.NoTrans Gsl_blas.NoTrans Complex.one (cmat_of_fmat el1) inv Complex.zero result; stack#push (RpcComplexMatrixUnit (result, Units.div uu1 uu2)) with Gsl_exn _ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "divisor matrix is singular")) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for division")) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "divisor matrix is non-square")) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for division")) ) |RpcComplexMatrixUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> let c_el2 = cmpx_of_int el2 in let result = Gsl_matrix_complex.copy el1 in Gsl_matrix_complex.scale result (Complex.inv c_el2); stack#push (RpcComplexMatrixUnit (result, uu1)) |RpcFloatUnit (el2, uu2) -> let result = Gsl_matrix_complex.copy el1 in Gsl_matrix_complex.scale result (Complex.inv (c_of_f el2)); stack#push (RpcComplexMatrixUnit (result, Units.div uu1 uu2)) |RpcComplexUnit (el2, uu2) -> let result = Gsl_matrix_complex.copy el1 in Gsl_matrix_complex.scale result (Complex.inv el2); stack#push (RpcComplexMatrixUnit (result, Units.div uu1 uu2)) |RpcFloatMatrixUnit (el2, uu2) -> let n1, m1 = (Gsl_matrix_complex.dims el1) and n2, m2 = (Gsl_matrix.dims el2) in if n2 = m2 then if m1 = n2 then let copy_el2 = Gsl_matrix.copy el2 and perm = Gsl_permut.create m1 and inv = Gsl_matrix.create m1 m1 in try let _ = Gsl_linalg._LU_decomp (`M copy_el2) perm in Gsl_linalg._LU_invert (`M copy_el2) perm (`M inv); let result = Gsl_matrix_complex.create n1 m2 in Gsl_blas.Complex.gemm Gsl_blas.NoTrans Gsl_blas.NoTrans Complex.one el1 (cmat_of_fmat inv) Complex.zero result; stack#push (RpcComplexMatrixUnit (result, Units.div uu1 uu2)) with Gsl_exn _ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "divisor matrix is singular")) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for division")) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "divisor matrix is non-square")) |RpcComplexMatrixUnit (el2, uu2) -> let n1, m1 = (Gsl_matrix_complex.dims el1) and n2, m2 = (Gsl_matrix_complex.dims el2) in if n2 = m2 then if m1 = n2 then (* FIXME: do we need to use Gsl_vectmat.cmat_convert here? *) let copy_el2 = Gsl_matrix_complex.copy el2 and perm = Gsl_permut.create m1 and inv = Gsl_matrix_complex.create m1 m1 in try let _ = Gsl_linalg.complex_LU_decomp (`CM copy_el2) perm in Gsl_linalg.complex_LU_invert (`CM copy_el2) perm (`CM inv); let result = Gsl_matrix_complex.create n1 m2 in Gsl_blas.Complex.gemm Gsl_blas.NoTrans Gsl_blas.NoTrans Complex.one el1 inv Complex.zero result; stack#push (RpcComplexMatrixUnit (result, Units.div uu1 uu2)) with Gsl_exn _ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "divisor matrix is singular")) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for division")) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "divisor matrix is non-square")) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for division")) ) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for division")) (* arch-tag: DO_NOT_CHANGE_c2535853-756a-4574-8f36-1103a81d053b *) orpie-1.5.2/curses_assist.ml0000644000175000017500000000634112322115103014537 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* curses_assist.ml * Miscellaneous helper functions functions for dealing with the * Curses module *) open Curses (* translate a curses key to a printable string *) let string_of_chtype ch = let display_string_of_keyname str = match str with |"KEY_LEFT" -> "" |"KEY_RIGHT" -> "" |"KEY_UP" -> "" |"KEY_DOWN" -> "" |"KEY_BACKSPACE" -> "" |"KEY_IC" -> "" |"KEY_DC" -> "" |"KEY_HOME" -> "" |"KEY_END" -> "" |"KEY_PPAGE" -> "" |"KEY_NPAGE" -> "" |" " -> "" |"KEY_F(1)" -> "" |"KEY_F(2)" -> "" |"KEY_F(3)" -> "" |"KEY_F(4)" -> "" |"KEY_F(5)" -> "" |"KEY_F(6)" -> "" |"KEY_F(7)" -> "" |"KEY_F(8)" -> "" |"KEY_F(9)" -> "" |"KEY_F(10)" -> "" |"KEY_F(11)" -> "" |"KEY_F(12)" -> "" |"KEY_ENTER" -> "" |"\\" -> "\\\\" |_ -> str in (* regexp to check for meta and/or ctrl prefixes * matches either "M-^" or "M-" or "^" followed by some character string *) let mc_re = Str.regexp "^\\(\\(M-\\^\\)\\|\\(M-\\)\\|\\(\\^\\)\\)?\\(.+\\)" and key_string = (keyname ch) in if Str.string_match mc_re key_string 0 then let has_meta_ctrl = try let _ = Str.matched_group 2 key_string in true with Not_found -> false and has_meta = try let _ = Str.matched_group 3 key_string in true with Not_found -> false and has_ctrl = try let _ = Str.matched_group 4 key_string in true with Not_found -> false and main_key = Str.matched_group 5 key_string in if has_meta_ctrl then "\\\\M\\\\C" ^ (display_string_of_keyname main_key) else if has_meta then "\\\\M" ^ (display_string_of_keyname main_key) else if has_ctrl then if main_key = "J" then "" else if main_key = "I" then "" else "\\\\C" ^ (display_string_of_keyname main_key) else display_string_of_keyname main_key else Printf.sprintf "\\%.3o" ch (* arch-tag: DO_NOT_CHANGE_833e814a-273c-4faa-b6d0-123eca3c608d *) orpie-1.5.2/rpc_calc.ml0000644000175000017500000030046612322115103013420 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* rpc_calc.ml * This file defines Orpie's underlying calculator object. All calculator * functions and commands have a corresponding method in this object. *) open Rpc_stack;; open Gsl_assist;; open Big_int;; type interruptable_args_t = | Gcd_args of big_int * big_int * orpie_data_t * orpie_data_t | Lcm_args of big_int * big_int * big_int * orpie_data_t * orpie_data_t | Fact_args of big_int * big_int * orpie_data_t | Binom_args of big_int * big_int * big_int * big_int * orpie_data_t * orpie_data_t | Perm_args of big_int * big_int * big_int * orpie_data_t * orpie_data_t | NoArgs;; let pi = 3.14159265358979323846;; let c_of_f ff = { Complex.re = ff; Complex.im = 0.0 } class rpc_calc conserve_memory = object(self) val mutable stack = new rpc_stack conserve_memory val mutable backup_stack = new rpc_stack conserve_memory val mutable modes = {angle = Rad; base = Dec; complex = Rect} val mutable variables = Hashtbl.create 10 val mutable interr_args = NoArgs method backup () = backup_stack <- stack#backup () method undo () = stack <- backup_stack method mode_rad () = modes <- {angle = Rad; base = modes.base; complex = modes.complex} method mode_deg () = modes <- {angle = Deg; base = modes.base; complex = modes.complex} method mode_rect () = modes <- {angle = modes.angle; base = modes.base; complex = Rect} method mode_polar () = modes <- {angle = modes.angle; base = modes.base; complex = Polar} method mode_bin () = modes <- {angle = modes.angle; base = Bin; complex = modes.complex} method mode_oct () = modes <- {angle = modes.angle; base = Oct; complex = modes.complex} method mode_dec () = modes <- {angle = modes.angle; base = Dec; complex = modes.complex} method mode_hex () = modes <- {angle = modes.angle; base = Hex; complex = modes.complex} method get_variables () = variables method toggle_angle_mode () = match modes.angle with |Rad -> self#mode_deg () |Deg -> self#mode_rad () method toggle_complex_mode () = match modes.complex with |Rect -> self#mode_polar () |Polar -> self#mode_rect () method cycle_base () = match modes.base with |Bin -> self#mode_oct () |Oct -> self#mode_dec () |Dec -> self#mode_hex () |Hex -> self#mode_bin () method get_state () = (modes, variables, stack#get_state ()) method set_state (m, v, s_op) = begin match s_op with |Some st -> stack#set_state st |None -> () end; modes <- m; variables <- v; self#backup () method abort_computation () = match interr_args with |Gcd_args (a, b, el1, el2) -> stack#push el1; stack#push el2; interr_args <- NoArgs |Lcm_args (coeff, a, b, el1, el2) -> stack#push el1; stack#push el2; interr_args <- NoArgs |Fact_args (num, acc, el) -> stack#push el; interr_args <- NoArgs |Binom_args (n, k, num, denom, el1, el2) -> stack#push el1; stack#push el2; interr_args <- NoArgs |Perm_args (n, term, partial, el1, el2) -> stack#push el1; stack#push el2; interr_args <- NoArgs |NoArgs -> () (* all calc functions will need to have arguments checked * and a backup performed, so we handle it with a little wrapper function *) method private check_args (num_args : int) (fn_str : string) (fn : unit -> unit) = if stack#length >= num_args then begin self#backup (); fn () end else if stack#length = 0 then raise (Invalid_argument "empty stack") else raise (Invalid_argument ("insufficient arguments for " ^ fn_str)) method add () = self#check_args 2 "addition" self#internal_add method private internal_add () = Add.add stack self#evaln method sub () = self#check_args 2 "subtraction" self#internal_sub method private internal_sub () = Sub.sub stack self#evaln method mult () = self#check_args 2 "multiplication" self#internal_mult method private internal_mult () = Mult.mult stack self#evaln method div () = self#check_args 2 "division" self#internal_div method private internal_div () = Div.div stack self#evaln method inv () = self#check_args 1 "inv" self#internal_inv method private internal_inv () = Inv.inv stack self#evaln method pow () = self#check_args 2 "pow" self#internal_pow method private internal_pow () = Pow.pow stack self#evaln method get_modes () = modes method get_stack_size () = stack#length method dup () = self#check_args 1 "dup" self#internal_dup (* Warning: dup() creates multiple references to the same object. * Therefore all operations need to leave the original stack elements * unaltered. *) method private internal_dup () = stack#dup () method neg () = self#check_args 1 "neg" self#internal_neg method private internal_neg () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> stack#push (RpcInt (minus_big_int el)) |RpcFloatUnit (el, uu) -> stack#push (RpcFloatUnit (~-. el, uu)) |RpcComplexUnit (el, uu) -> stack#push (RpcComplexUnit (Complex.neg el, uu)) |RpcFloatMatrixUnit (el, uu) -> let copy = Gsl_matrix.copy el in (Gsl_matrix.scale copy (-1.0); stack#push (RpcFloatMatrixUnit (copy, uu))) |RpcComplexMatrixUnit (el, uu) -> let copy = Gsl_matrix_complex.copy el in (Gsl_matrix_complex.scale copy {Complex.re=(-1.0); Complex.im=0.0}; stack#push (RpcComplexMatrixUnit (copy, uu))) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) method sq () = self#check_args 1 "sq" self#internal_sq method private internal_sq () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> stack#push (RpcInt (mult_big_int el el)) |RpcFloatUnit (el, uu) -> stack#push (RpcFloatUnit (el *. el, Units.pow uu 2.)) |RpcComplexUnit (el, uu) -> stack#push (RpcComplexUnit (Complex.mul el el, Units.pow uu 2.)) |RpcFloatMatrixUnit (el, uu) -> let n, m = (Gsl_matrix.dims el) in if n = m then let result = Gsl_matrix.create n m in (Gsl_blas.gemm Gsl_blas.NoTrans Gsl_blas.NoTrans 1.0 el el 0.0 result; stack#push (RpcFloatMatrixUnit (result, Units.pow uu 2.))) else (stack#push gen_el; raise (Invalid_argument "matrix is non-square")) |RpcComplexMatrixUnit (el, uu) -> let n, m = (Gsl_matrix_complex.dims el) in if m = n then let result = Gsl_matrix_complex.create n m in Gsl_blas.Complex.gemm Gsl_blas.NoTrans Gsl_blas.NoTrans Complex.one el el Complex.zero result; stack#push (RpcComplexMatrixUnit (result, Units.pow uu 2.)) else (stack#push gen_el; raise (Invalid_argument "matrix is non-square")) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) method sqrt () = self#check_args 1 "sqrt" self#internal_sqrt method private internal_sqrt () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcFloatUnit (el, uu) -> if el < 0.0 then let cc = c_of_f el in stack#push (RpcComplexUnit (Complex.sqrt cc, Units.pow uu 0.5)) else stack#push (RpcFloatUnit (sqrt el, Units.pow uu 0.5)) |RpcComplexUnit (el, uu) -> stack#push (RpcComplexUnit (Complex.sqrt el, Units.pow uu 0.5)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method abs () = self#check_args 1 "abs" self#internal_abs method private internal_abs () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> stack#push (RpcInt (abs_big_int el)) |RpcFloatUnit (el, uu) -> stack#push (RpcFloatUnit (abs_float el, uu)) |RpcComplexUnit (el, uu) -> stack#push (RpcFloatUnit (Gsl_complex.abs el, uu)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method arg () = self#check_args 1 "arg" self#internal_arg method private internal_arg () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcComplexUnit (el, uu) -> begin match modes.angle with |Rad -> let (f, u) = funit_of_float (Gsl_complex.arg el) in stack#push (RpcFloatUnit (f, u)) |Deg -> let (f, u) = funit_of_float (180.0 /. pi *. (Gsl_complex.arg el)) in stack#push (RpcFloatUnit (f, u)) end |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method exp () = self#check_args 1 "exp" self#internal_exp method private internal_exp () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float (exp (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot exponentiate dimensioned value" end else let (f, u) = funit_of_float (exp el) in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot exponentiate dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.exp el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method ln () = self#check_args 1 "ln" self#internal_ln method private internal_ln () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float (log (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute logarithm of dimensioned value" end else if el >= 0.0 then begin let (f, u) = funit_of_float (log el) in stack#push (RpcFloatUnit (f, u)) end else let c_arg = c_of_f el in let (c, u) = cunit_of_cpx (Gsl_complex.log c_arg) in stack#push (RpcComplexUnit (c, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute logarithm of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.log el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method ten_pow_x () = self#check_args 1 "10_x" self#internal_ten_pow_x method private internal_ten_pow_x () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float (10.0 ** (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot exponentiate dimensioned value" end else let (f, u) = funit_of_float (10.0 ** el) in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot exponentiate dimensioned value" end else let (c, u) = cunit_of_cpx (Complex.pow (cmpx_of_float 10.0) el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method log10 () = self#check_args 1 "log10" self#internal_log10 method private internal_log10 () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float (log10 (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute logarithm of dimensioned value" end else if el >= 0.0 then begin let (f, u) = funit_of_float (log10 el) in stack#push (RpcFloatUnit (f, u)) end else let c_arg = c_of_f el in let (c, u) = cunit_of_cpx (Gsl_complex.log10 c_arg) in stack#push (RpcComplexUnit (c, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute logarithm of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.log10 el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method conj () = self#check_args 1 "conj" self#internal_conj method private internal_conj () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> stack#push (RpcInt el) |RpcFloatUnit (el, uu) -> stack#push (RpcFloatUnit (el, uu)) |RpcComplexUnit (el, uu) -> stack#push (RpcComplexUnit (Gsl_complex.conjugate el, uu)) |RpcFloatMatrixUnit (el, uu) -> stack#push (RpcFloatMatrixUnit (el, uu)) |RpcComplexMatrixUnit (el, uu) -> (* element-by-element conjugation *) let rows, cols = Gsl_matrix_complex.dims el and arr = Gsl_matrix_complex.to_array el in let conj_arr = Array.map Gsl_complex.conjugate arr in let conj_mat = Gsl_matrix_complex.of_array conj_arr rows cols in stack#push (RpcComplexMatrixUnit (conj_mat, uu)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) method sin () = self#check_args 1 "sin" self#internal_sin method private internal_sin () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float begin match modes.angle with |Rad -> sin (float_of_big_int el) |Deg -> sin (pi /. 180.0 *. (float_of_big_int el)) end in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute sine of dimensioned value" end else let (f, u) = funit_of_float begin match modes.angle with |Rad -> sin el |Deg -> sin (pi /. 180.0 *. el) end in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute sine of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.sin el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method cos () = self#check_args 1 "cos" self#internal_cos method private internal_cos () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float begin match modes.angle with |Rad -> cos (float_of_big_int el) |Deg -> cos (pi /. 180.0 *. (float_of_big_int el)) end in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute cosine of dimensioned value" end else let (f, u) = funit_of_float begin match modes.angle with |Rad -> cos el |Deg -> cos (pi /. 180.0 *. el) end in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute cosine of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.cos el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method tan () = self#check_args 1 "tan" self#internal_tan method private internal_tan () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float begin match modes.angle with |Rad -> tan (float_of_big_int el) |Deg -> tan (pi /. 180.0 *. (float_of_big_int el)) end in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute tangent of dimensioned value" end else let (f, u) = funit_of_float begin match modes.angle with |Rad -> tan el |Deg -> tan (pi /. 180.0 *. el) end in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute tangent of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.tan el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method asin () = self#check_args 1 "asin" self#internal_asin method private internal_asin () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float begin match modes.angle with |Rad -> asin (float_of_big_int el) |Deg -> 180.0 /. pi *. asin (float_of_big_int el) end in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute arcsine of dimensioned value" end else let (f, u) = funit_of_float begin match modes.angle with |Rad -> asin el |Deg -> 180.0 /. pi *. asin el end in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute arcsine of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.arcsin el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method acos () = self#check_args 1 "acos" self#internal_acos method private internal_acos () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float begin match modes.angle with |Rad -> acos (float_of_big_int el) |Deg -> 180.0 /. pi *. acos (float_of_big_int el) end in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute arccos of dimensioned value" end else let (f, u) = funit_of_float begin match modes.angle with |Rad -> acos el |Deg -> 180.0 /. pi *. acos el end in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute arccos of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.arccos el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method atan () = self#check_args 1 "atan" self#internal_atan method private internal_atan () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float begin match modes.angle with |Rad -> atan (float_of_big_int el) |Deg -> 180.0 /. pi *. atan (float_of_big_int el) end in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute arctan of dimensioned value" end else let (f, u) = funit_of_float begin match modes.angle with |Rad -> atan el |Deg -> 180.0 /. pi *. atan el end in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute arctan of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.arctan el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method sinh () = self#check_args 1 "sinh" self#internal_sinh method private internal_sinh () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float (sinh (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute sinh of dimensioned value" end else let (f, u) = funit_of_float (sinh el) in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute sinh of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.sinh el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method cosh () = self#check_args 1 "cosh" self#internal_cosh method private internal_cosh () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float (cosh (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute cosh of dimensioned value" end else let (f, u) = funit_of_float (cosh el) in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute cosh of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.cosh el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method tanh () = self#check_args 1 "tanh" self#internal_tanh method private internal_tanh () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float (tanh (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute tanh of dimensioned value" end else let (f, u) = funit_of_float (tanh el) in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute tanh of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.tanh el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method asinh () = self#check_args 1 "asinh" self#internal_asinh method private internal_asinh () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float (Gsl_math.asinh (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute asinh of dimensioned value" end else let (f, u) = funit_of_float (Gsl_math.asinh el) in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute asinh of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.arcsinh el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method acosh () = self#check_args 1 "acosh" self#internal_acosh method private internal_acosh () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float (Gsl_math.acosh (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute acosh of dimensioned value" end else let (f, u) = funit_of_float (Gsl_math.acosh el) in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute acosh of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.arccosh el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method atanh () = self#check_args 1 "atanh" self#internal_atanh method private internal_atanh () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float (Gsl_math.atanh (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute atanh of dimensioned value" end else let (f, u) = funit_of_float (Gsl_math.atanh el) in stack#push (RpcFloatUnit (f, u)) |RpcComplexUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute atanh of dimensioned value" end else let (c, u) = cunit_of_cpx (Gsl_complex.arctanh el) in stack#push (RpcComplexUnit (c, u)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method re () = self#check_args 1 "re" self#internal_re (* real part of complex (or complex matrix) *) method private internal_re () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> stack#push gen_el |RpcFloatUnit (el, uu) -> stack#push gen_el |RpcComplexUnit (el, uu) -> stack#push (RpcFloatUnit (el.Complex.re, uu)) |RpcFloatMatrixUnit (el, uu) -> stack#push gen_el |RpcComplexMatrixUnit (el, uu) -> let n, m = Gsl_matrix_complex.dims el and carr = Gsl_matrix_complex.to_array el in let farr = Array.make (n * m) 0.0 in for i = 0 to pred (n * m) do farr.(i) <- carr.(i).Complex.re done; stack#push (RpcFloatMatrixUnit (Gsl_matrix.of_array farr n m, uu)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) method im () = self#check_args 1 "im" self#internal_im (* imaginary part of complex (or complex matrix) *) method private internal_im () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> stack#push (RpcInt zero_big_int) |RpcFloatUnit (el, uu) -> stack#push (RpcFloatUnit (0.0, uu)) |RpcComplexUnit (el, uu) -> stack#push (RpcFloatUnit (el.Complex.im, uu)) |RpcFloatMatrixUnit (el, uu) -> let n, m = Gsl_matrix.dims el in let farr = Array.make (n * m) 0.0 in stack#push (RpcFloatMatrixUnit (Gsl_matrix.of_array farr n m, uu)) |RpcComplexMatrixUnit (el, uu) -> let n, m = Gsl_matrix_complex.dims el and carr = Gsl_matrix_complex.to_array el in let farr = Array.make (n * m) 0.0 in for i = 0 to pred (n * m) do farr.(i) <- carr.(i).Complex.im done; stack#push (RpcFloatMatrixUnit (Gsl_matrix.of_array farr n m, uu)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) method gamma () = self#check_args 1 "gamma" self#internal_gamma (* Euler gamma function *) method private internal_gamma () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> begin try let (f, u) = funit_of_float (Gsl_sf.gamma (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) with Gsl_error.Gsl_exn (err, errstr) -> (stack#push gen_el; raise (Invalid_argument errstr)) end |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute gamma of dimensioned value" end else begin try let (f, u) = funit_of_float (Gsl_sf.gamma el) in stack#push (RpcFloatUnit (f, u)) with Gsl_error.Gsl_exn (err, errstr) -> (stack#push gen_el; raise (Invalid_argument errstr)) end |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method lngamma () = self#check_args 1 "lngamma" self#internal_lngamma (* log_e of Euler gamma function *) method private internal_lngamma () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> begin try let (f, u) = funit_of_float (Gsl_sf.lngamma (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) with Gsl_error.Gsl_exn (err, errstr) -> (stack#push gen_el; raise (Invalid_argument errstr)) end |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute lngamma of dimensioned value" end else begin try let (f, u) = funit_of_float (Gsl_sf.lngamma el) in stack#push (RpcFloatUnit (f, u)) with Gsl_error.Gsl_exn (err, errstr) -> (stack#push gen_el; raise (Invalid_argument errstr)) end |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method erf () = self#check_args 1 "erf" self#internal_erf (* error function *) method private internal_erf () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> begin try let (f, u) = funit_of_float (Gsl_sf.erf (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) with Gsl_error.Gsl_exn (err, errstr) -> (stack#push gen_el; raise (Invalid_argument errstr)) end |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute error function of dimensioned value" end else begin try let (f, u) = funit_of_float (Gsl_sf.erf el) in stack#push (RpcFloatUnit (f, u)) with Gsl_error.Gsl_exn (err, errstr) -> (stack#push gen_el; raise (Invalid_argument errstr)) end |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) method erfc () = self#check_args 1 "erfc" self#internal_erfc (* complementary error function *) method private internal_erfc () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> begin try let (f, u) = funit_of_float (Gsl_sf.erfc (float_of_big_int el)) in stack#push (RpcFloatUnit (f, u)) with Gsl_error.Gsl_exn (err, errstr) -> (stack#push gen_el; raise (Invalid_argument errstr)) end |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute erfc of dimensioned value" end else begin try let (f, u) = funit_of_float (Gsl_sf.erfc el) in stack#push (RpcFloatUnit (f, u)) with Gsl_error.Gsl_exn (err, errstr) -> (stack#push gen_el; raise (Invalid_argument errstr)) end |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) (* factorial * calls gamma function for float arguments, and jumps * to an interruptible exact implementation for integer * arguments. * This function is designed to be called multiple times * until it returns true. If computation is aborted, the interface * should call abort_computation() to clean up. *) method fact () = match interr_args with |Fact_args (num, acc, el) -> if eq_big_int num zero_big_int then begin stack#push (RpcInt acc); interr_args <- NoArgs; true end else begin let next_num = pred_big_int num and next_acc = mult_big_int acc num in interr_args <- Fact_args (next_num, next_acc, el); false end |NoArgs -> if stack#length > 0 then begin self#backup (); self#evaln 1; let gen_el = stack#pop () in begin match gen_el with |RpcInt el -> if sign_big_int el >= 0 then begin interr_args <- Fact_args (el, unit_big_int, gen_el); false end else begin stack#push gen_el; raise (Invalid_argument "integer factorial requires non-negative argument") end |RpcFloatUnit (el, uu) -> if uu <> Units.empty_unit then begin stack#push gen_el; raise_invalid "cannot compute factorial of dimensioned value" end else begin try let (f, u) = funit_of_float (Gsl_sf.gamma (el +. 1.0)) in stack#push (RpcFloatUnit (f, u)); true with Gsl_error.Gsl_exn (err, errstr) -> (stack#push gen_el; raise (Invalid_argument errstr)) end |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "invalid argument")) end end else raise (Invalid_argument "empty stack") |_ -> (* shouldn't hit this point if interface is well-behaved *) self#abort_computation (); false method transpose () = self#check_args 1 "transpose" self#internal_transpose (* matrix transpose *) method private internal_transpose () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcFloatMatrixUnit (el, uu) -> let n, m = (Gsl_matrix.dims el) in let trans_mat = Gsl_matrix.create m n in Gsl_matrix.transpose trans_mat el; stack#push (RpcFloatMatrixUnit (trans_mat, uu)) |RpcComplexMatrixUnit (el, uu) -> let n, m = (Gsl_matrix_complex.dims el) in let trans_mat = Gsl_matrix_complex.create m n in Gsl_matrix_complex.transpose trans_mat el; stack#push (RpcComplexMatrixUnit (trans_mat, uu)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "transpose requires a matrix argument")) method mod_int () = self#check_args 2 "mod" self#internal_mod_int (* mod (remainder) *) method private internal_mod_int () = self#evaln 2; let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in match gen_el1 with |RpcInt el1 -> begin match gen_el2 with |RpcInt el2 -> if eq_big_int el2 zero_big_int then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "division by zero") end else stack#push (RpcInt (mod_big_int el1 el2)) |RpcFloatUnit (ff2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "cannot compute mod of dimensioned values") end else if (abs_float ff2) < 1e9 then let bi_el2 = big_int_of_int (int_of_float ff2) in if eq_big_int bi_el2 zero_big_int then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "division by zero") end else stack#push (RpcInt (mod_big_int el1 bi_el2)) else begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "real argument is too large to convert to integer") end |RpcVariable s -> stack#push gen_el1; stack#push gen_el2; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "mod can only be applied to arguments of type integer or real")) end |RpcFloatUnit (ff1, uu1) -> if uu1 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "cannot compute mod of dimensioned values") end else if (abs_float ff1) < 1e9 then begin let bi_el1 = big_int_of_int (int_of_float ff1) in begin match gen_el2 with |RpcInt el2 -> if eq_big_int el2 zero_big_int then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "division by zero") end else stack#push (RpcInt (mod_big_int bi_el1 el2)) |RpcFloatUnit (ff2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "cannot compute mod of dimensioned values") end else if (abs_float ff2) < 1e9 then let bi_el2 = big_int_of_int (int_of_float ff2) in if eq_big_int bi_el2 zero_big_int then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "division by zero") end else stack#push (RpcInt (mod_big_int bi_el1 bi_el2)) else begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "real argument is too large to convert to integer") end |RpcVariable s -> stack#push gen_el1; stack#push gen_el2; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "mod can only be applied to arguments of type integer or real")) end end else begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "real argument is too large to convert to integer") end |RpcVariable s -> stack#push gen_el1; stack#push gen_el2; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "mod can only be applied to arguments of type integer or real")) method floor () = self#check_args 1 "floor" self#internal_floor (* floor function *) method private internal_floor () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcFloatUnit (el, uu) -> stack#push (RpcFloatUnit (floor el, uu)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "floor can only be applied to real data")) method ceiling () = self#check_args 1 "ceiling" self#internal_ceiling (* ceiling function *) method private internal_ceiling () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcFloatUnit (el, uu) -> stack#push (RpcFloatUnit (ceil el, uu)) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "ceiling can only be applied to real data")) method to_int () = self#check_args 1 "toint" self#internal_to_int (* coerce to an integer type *) method private internal_to_int () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> stack#push gen_el |RpcFloatUnit (ff, uu) -> if (abs_float ff) < 1e9 then stack#push (RpcInt (big_int_of_int (int_of_float ff))) else (stack#push gen_el; raise (Invalid_argument "value is too large to convert to integer")) |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "to_int can only be applied to real data")) method to_float () = self#check_args 1 "toreal" self#internal_to_float (* coerce to a floating-point type *) method private internal_to_float () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcInt el -> let (f, u) = funit_of_float (float_of_big_int el) in stack#push (RpcFloatUnit (f, u)) |RpcFloatMatrixUnit (el, uu) -> let n, m = Gsl_matrix.dims el in if n = 1 && m = 1 then stack#push (RpcFloatUnit (el.{0, 0}, uu)) else begin stack#push gen_el; raise_invalid "matrix argument of to_float must be 1x1" end |RpcVariable s -> stack#push gen_el; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el; raise (Invalid_argument "to_float can only be applied to integer data")) method solve_linear () = self#check_args 2 "solvelin" self#internal_solve_linear (* solve a linear system Ax = b, with input nxn matrix A and output nx1 * matrix b *) method private internal_solve_linear () = Solvelin.solve_linear stack self#evaln method enter_pi () = self#backup (); let (f, u) = funit_of_float pi in stack#push (RpcFloatUnit (f, u)) method get_display_line line_num = stack#get_display_string line_num modes method get_fullscreen_display line_num = stack#get_fullscreen_display_string line_num modes (* fill in the display string lookup table *) method launch_fill_in_thread () = stack#launch_fill_in_thread () method drop () = self#check_args 1 "drop" self#internal_drop method private internal_drop () = let _ = stack#pop () in () method swap () = self#check_args 2 "swap" self#internal_swap method private internal_swap () = stack#swap () method clear () = self#backup (); for i = 1 to stack#length do let _ = stack#pop () in () done method push (v : orpie_data_t) = self#backup (); stack#push v method echo el_num = if el_num <= stack#length then stack#echo el_num else raise (Invalid_argument "cannot echo nonexistant element") method rolldown i = stack#rolldown i method rollup i = stack#rollup i method delete i = stack#delete i method deleteN i = stack#deleteN i method keep i = stack#keep i method keepN i = stack#keepN i method enter_int i = stack#push (RpcInt i) method enter_float f = stack#push (RpcFloatUnit (f, Units.empty_unit)) method enter_cmpx c = stack#push (RpcComplexUnit (c, Units.empty_unit)) method enter_fmat fm uu = stack#push (RpcFloatMatrixUnit (fm, uu)) method enter_cmat cm uu = stack#push (RpcComplexMatrixUnit (cm, uu)) method enter_const cc uu = stack#push (RpcFloatUnit (cc, uu)) (* evaluate last n variables of the stack (internal use only) *) method private evaln (num : int) = (* grab the last n stack elements into a list *) let rec grab_elements el_lst n = if n > 0 then let next_el = stack#pop () in grab_elements (next_el :: el_lst) (pred n) else el_lst in (* eval the list elements one-by-one; if there * is a lookup failure, push everything back on the stack. *) let rec eval_elements el_lst = match el_lst with |[] -> () |head :: tail -> begin match head with |RpcVariable s -> begin try let data = Hashtbl.find variables s in stack#push data; eval_elements tail with |Not_found -> let err_msg = Printf.sprintf "variable \"%s\" is not bound" s in List.iter stack#push el_lst; raise (Invalid_argument err_msg) end |_ -> stack#push head; eval_elements tail end in let raw_elements = grab_elements [] num in eval_elements raw_elements method eval () = if stack#length > 0 then begin (* the extra push and pop is necessary to be able to back up the * stack *only* when the eval() changes it *) let gen_el = stack#pop () in match gen_el with |RpcVariable s -> stack#push gen_el; self#backup (); self#evaln 1 |_ -> stack#push gen_el end else raise (Invalid_argument "empty stack") method store () = self#check_args 2 "store" self#internal_store (* store in a variable *) method private internal_store () = let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in match gen_el2 with |RpcVariable s -> begin match gen_el1 with |RpcVariable dummy -> stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "cannot store variables inside variables") |_ -> Hashtbl.remove variables s; Hashtbl.add variables s gen_el1 end |_ -> stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "cannot store inside non-variable") method purge () = self#check_args 1 "purge" self#internal_purge (* clear a variable *) method private internal_purge () = let gen_el = stack#pop () in match gen_el with |RpcVariable s -> Hashtbl.remove variables s |_ -> stack#push gen_el; raise (Invalid_argument "only variables can be purged") (* greatest common divisor * This is an interruptible computation, and should be * called multiple times until it returns true. * If computation is aborted, the interface should call * abort_computation() to clean up. *) method gcd () = match interr_args with |Gcd_args (a, b, el1, el2) -> if eq_big_int b zero_big_int then begin stack#push (RpcInt a); interr_args <- NoArgs; true end else begin let a_mod_b = mod_big_int a b in interr_args <- Gcd_args (b, a_mod_b, el1, el2); false end |NoArgs -> if stack#length > 1 then begin self#backup (); self#evaln 2; let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in begin match gen_el1 with |RpcInt a -> begin match gen_el2 with |RpcInt b -> let abs_a = abs_big_int a and abs_b = abs_big_int b in interr_args <- Gcd_args (abs_a, abs_b, gen_el1, gen_el2); false |RpcFloatUnit (ff2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "cannot compute gcd of dimensioned values") end else if (abs_float ff2) < 1e9 then begin let abs_a = abs_big_int a and abs_b = abs_big_int (big_int_of_int (int_of_float ff2)) in interr_args <- Gcd_args (abs_a, abs_b, gen_el1, gen_el2); false end else begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "real argument is too large to convert to integer") end |RpcVariable s -> stack#push gen_el1; stack#push gen_el2; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "gcd requires integer or real arguments") end |RpcFloatUnit (ff1, uu1) -> if uu1 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "cannot compute gcd of dimensioned values") end else if (abs_float ff1) < 1e9 then begin let abs_a = abs_big_int (big_int_of_int (int_of_float ff1)) in begin match gen_el2 with |RpcInt b -> let abs_b = abs_big_int b in interr_args <- Gcd_args (abs_a, abs_b, gen_el1, gen_el2); false |RpcFloatUnit (ff2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "cannot compute gcd of dimensioned values") end else if (abs_float ff2) < 1e9 then begin let abs_b = abs_big_int (big_int_of_int (int_of_float ff2)) in interr_args <- Gcd_args (abs_a, abs_b, gen_el1, gen_el2); false end else begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "real argument is too large to convert to integer") end |RpcVariable s -> stack#push gen_el1; stack#push gen_el2; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "gcd requires integer or real arguments") end end else begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "real argument is too large to convert to integer") end |RpcVariable s -> stack#push gen_el1; stack#push gen_el2; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "gcd requires integer or real arguments") end end else raise (Invalid_argument "insufficient arguments for gcd") |_ -> (* shouldn't hit this point if interface is well-behaved *) self#abort_computation (); false (* least common multiple * This is an interruptible computation, and should be * called multiple times until it returns true. * If computation is aborted, the interface should call * abort_computation() to clean up. *) method lcm () = match interr_args with |Lcm_args (coeff, a, b, el1, el2) -> if eq_big_int b zero_big_int then begin let result = div_big_int coeff a in stack#push (RpcInt result); interr_args <- NoArgs; true end else begin let a_mod_b = mod_big_int a b in interr_args <- Lcm_args (coeff, b, a_mod_b, el1, el2); false end |NoArgs -> if stack#length > 1 then begin self#backup (); self#evaln 2; let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in begin match gen_el1 with |RpcInt a -> begin match gen_el2 with |RpcInt b -> let coeff = mult_big_int a b and abs_a = abs_big_int a and abs_b = abs_big_int b in interr_args <- Lcm_args (coeff, abs_a, abs_b, gen_el1, gen_el2); false |RpcFloatUnit (ff2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "cannot compute lcm of dimensioned values") end else if (abs_float ff2) < 1e9 then begin let bi_b = big_int_of_int (int_of_float ff2) in let abs_a = abs_big_int a and abs_b = abs_big_int bi_b in let coeff = mult_big_int a bi_b in interr_args <- Lcm_args (coeff, abs_a, abs_b, gen_el1, gen_el2); false end else begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "real argument is too large to convert to integer") end |RpcVariable s -> stack#push gen_el1; stack#push gen_el2; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "lcm requires integer or real arguments") end |RpcFloatUnit (ff1, uu1) -> if uu1 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "cannot compute lcm of dimensioned values") end else if (abs_float ff1) < 1e9 then begin let bi_a = big_int_of_int (int_of_float ff1) in let abs_a = abs_big_int bi_a in begin match gen_el2 with |RpcInt b -> let coeff = mult_big_int bi_a b and abs_b = abs_big_int b in interr_args <- Lcm_args (coeff, abs_a, abs_b, gen_el1, gen_el2); false |RpcFloatUnit (ff2, uu2) -> if uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "cannot compute lcm of dimensioned values") end else if (abs_float ff2) < 1e9 then begin let bi_b = big_int_of_int (int_of_float ff2) in let abs_b = abs_big_int bi_b in let coeff = mult_big_int bi_a bi_b in interr_args <- Lcm_args (coeff, abs_a, abs_b, gen_el1, gen_el2); false end else begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "real argument is too large to convert to integer") end |RpcVariable s -> stack#push gen_el1; stack#push gen_el2; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "lcm requires integer or real arguments") end end else begin stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "real argument is too large to convert to integer") end |RpcVariable s -> stack#push gen_el1; stack#push gen_el2; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "lcm requires integer or real arguments") end end else raise (Invalid_argument "insufficient arguments for lcm") |_ -> (* shouldn't hit this point if interface is well-behaved *) self#abort_computation (); false (* binomial coefficient * For a float argument, this is computed using lngamma in order to avoid * overflow. For an integer argument, jump to an interruptible * exact arithmetic value. *) method binom () = match interr_args with |Binom_args (n, k, num, denom, el1, el2) -> if eq_big_int k zero_big_int then begin let result = div_big_int num denom in stack#push (RpcInt result); interr_args <- NoArgs; true end else begin let nmk = sub_big_int n k in let new_num = mult_big_int num (succ_big_int nmk) in let new_denom = mult_big_int denom k in interr_args <- Binom_args (n, (pred_big_int k), new_num, new_denom, el1, el2); false end |NoArgs -> if stack#length > 1 then begin self#backup (); self#evaln 2; let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in begin match gen_el1 with |RpcInt el1 -> begin match gen_el2 with |RpcInt el2 -> if sign_big_int el1 >= 0 && sign_big_int el2 >= 0 then if ge_big_int el1 el2 then (* save a little computation via a binomial identity *) let nmk = sub_big_int el1 el2 in if lt_big_int nmk el2 then begin interr_args <- Binom_args (el1, nmk, unit_big_int, unit_big_int, gen_el1, gen_el2); false end else begin interr_args <- Binom_args (el1, el2, unit_big_int, unit_big_int, gen_el1, gen_el2); false end else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "first argument to binom must be >= second argument")) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "integer binom requires nonnegative arguments")) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "binom requires either two integer or two real arguments")) end |RpcFloatUnit (el1, uu1) -> begin match gen_el2 with |RpcFloatUnit (el2, uu2) -> if uu1 <> Units.empty_unit || uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "cannot compute binom of dimensioned values" end else begin try let log_coeff = (Gsl_sf.lngamma (el1 +. 1.0)) -. (Gsl_sf.lngamma (el2 +. 1.0)) -. (Gsl_sf.lngamma (el1 -. el2 +. 1.0)) in let (f, u) = funit_of_float (exp log_coeff) in stack#push (RpcFloatUnit (f, u)); true with Gsl_error.Gsl_exn (err, errstr) -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument errstr)) end |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "binom requires either two integer or two real arguments")) end |RpcVariable s -> stack#push gen_el1; stack#push gen_el2; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "binom can only be applied to real or integer arguments")) end end else raise (Invalid_argument "insufficient arguments for binom") |_ -> (* shouldn't hit this point if interface is well-behaved *) self#abort_computation (); false (* # of permutations of subsets of a population * For a float argument, this is computed using lngamma in order to avoid * overflow. For an integer argument, jump to an interruptible * exact arithmetic value. *) method permutations () = match interr_args with |Perm_args (n, term, partial, el1, el2) -> if eq_big_int n term then begin stack#push (RpcInt partial); interr_args <- NoArgs; true end else begin let new_partial = mult_big_int n partial in interr_args <- Perm_args ((pred_big_int n), term, new_partial, el1, el2); false end |NoArgs -> if stack#length > 1 then begin self#backup (); self#evaln 2; let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in begin match gen_el1 with |RpcInt el1 -> begin match gen_el2 with |RpcInt el2 -> if sign_big_int el1 >= 0 && sign_big_int el2 >= 0 then if ge_big_int el1 el2 then let nmk = sub_big_int el1 el2 in interr_args <- Perm_args (el1, nmk, unit_big_int, gen_el1, gen_el2); false else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "first argument to perm must be >= second argument")) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "integer perm requires nonnegative arguments")) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "perm requires either two integer or two real arguments")) end |RpcFloatUnit (el1, uu1) -> begin match gen_el2 with |RpcFloatUnit (el2, uu2) -> if uu1 <> Units.empty_unit || uu2 <> Units.empty_unit then begin stack#push gen_el1; stack#push gen_el2; raise_invalid "cannot compute permutations of dimensioned values" end else begin try let log_perm = (Gsl_sf.lngamma (el1 +. 1.0)) -. (Gsl_sf.lngamma (el1 -. el2 +. 1.0)) in let (f, u) = funit_of_float (exp log_perm) in stack#push (RpcFloatUnit (f, u)); true with Gsl_error.Gsl_exn (err, errstr) -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument errstr)) end |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "perm requires either two integer or two real arguments")) end |RpcVariable s -> stack#push gen_el1; stack#push gen_el2; let err_msg = Printf.sprintf "variable \"%s\" has not been evaluated" s in raise (Invalid_argument err_msg) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "perm can only be applied to real or integer arguments")) end end else raise (Invalid_argument "insufficient arguments for perm") |_ -> (* shouldn't hit this point if interface is well-behaved *) self#abort_computation (); false method total () = self#check_args 1 "total" self#internal_total (* single-variable statistics: total *) method private internal_total () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcFloatMatrixUnit (mat, uu) -> (* multiply on the left by a row of ones *) let n, m = Gsl_matrix.dims mat in let ones_arr = Array.make n 1.0 in let ones = Gsl_matrix.of_array ones_arr 1 n in let result = Gsl_matrix.create 1 m in Gsl_blas.gemm Gsl_blas.NoTrans Gsl_blas.NoTrans 1.0 ones mat 0.0 result; stack#push (RpcFloatMatrixUnit (result, uu)) |_ -> stack#push gen_el; raise (Invalid_argument "total can only be applied to real matrices") method mean () = self#check_args 1 "mean" self#internal_mean (* single-variable statistics: sample mean *) method private internal_mean () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcFloatMatrixUnit (mat, uu) -> (* multiply on the left by a row of ones, divided by n *) let n, m = Gsl_matrix.dims mat in let ones_arr = Array.make n (1.0 /. (float_of_int n)) in let ones = Gsl_matrix.of_array ones_arr 1 n in let result = Gsl_matrix.create 1 m in Gsl_blas.gemm Gsl_blas.NoTrans Gsl_blas.NoTrans 1.0 ones mat 0.0 result; stack#push (RpcFloatMatrixUnit (result, uu)) |_ -> stack#push gen_el; raise (Invalid_argument "total can only be applied to real matrices") method sum_squares () = self#check_args 1 "sumsq" self#internal_sum_squares (* single-variable statistics: sum of squares *) method private internal_sum_squares () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcFloatMatrixUnit (mat, uu) -> let n, m = Gsl_matrix.dims mat in let result = Gsl_matrix.create 1 m in for col = 0 to pred m do result.{0, col} <- 0.0; for row = 0 to pred n do let squared_el = mat.{row, col} *. mat.{row, col} in result.{0, col} <- result.{0, col} +. squared_el done done; stack#push (RpcFloatMatrixUnit (result, Units.mult uu uu)) |_ -> stack#push gen_el; raise (Invalid_argument "sumsq can only be applied to real matrices") method variance_unbiased () = self#check_args 1 "var" self#internal_variance_unbiased (* single-variable statistics: bias-corrected sample variance *) method private internal_variance_unbiased () = self#evaln 1; let gen_el = stack#peek 1 in match gen_el with |RpcFloatMatrixUnit (mat, uu) -> let n, m = Gsl_matrix.dims mat in if n >= 2 then begin self#internal_variance_biased (); let n_over_nm1 = (float_of_int n) /. (float_of_int (pred n)) in let (f, u) = funit_of_float n_over_nm1 in stack#push (RpcFloatUnit (f, u)); self#internal_mult () end else raise (Invalid_argument "insufficient matrix rows for unbiased sample variance") |_ -> raise (Invalid_argument "varbias can only be applied to real matrices") method variance_biased () = self#check_args 1 "varbias" self#internal_variance_biased (* single-variable statistics: sample variance (biased) *) method private internal_variance_biased () = self#evaln 1; let gen_el = stack#peek 1 in match gen_el with |RpcFloatMatrixUnit (mat, uu) -> let n, m = Gsl_matrix.dims mat in let float_n = float_of_int n in (* computes variance as E[X^2] - E[X]^2 *) self#internal_dup (); self#internal_sum_squares (); let (f, u) = funit_of_float float_n in stack#push (RpcFloatUnit (f, u)); self#internal_div (); self#internal_swap (); self#internal_mean (); self#internal_sum_squares (); self#internal_sub () |_ -> raise (Invalid_argument "var can only be applied to real matrices") method standard_deviation_unbiased () = self#check_args 1 "stdev" self#internal_standard_deviation_unbiased (* single-variable statistics: unbiased sample standard deviation *) method private internal_standard_deviation_unbiased () = self#internal_variance_unbiased (); let gen_el = stack#pop () in match gen_el with |RpcFloatMatrixUnit (mat, uu) -> let n, m = Gsl_matrix.dims mat in let result = Gsl_matrix.create 1 m in for col = 0 to pred m do result.{0, col} <- sqrt mat.{0, col} done; stack#push (RpcFloatMatrixUnit (result, Units.pow uu 0.5)) |_ -> () method standard_deviation_biased () = self#check_args 1 "stdevbias" self#internal_standard_deviation_biased (* single-variable statistics: unbiased sample standard deviation *) method private internal_standard_deviation_biased () = self#internal_variance_biased (); let gen_el = stack#pop () in match gen_el with |RpcFloatMatrixUnit (mat, uu) -> let n, m = Gsl_matrix.dims mat in let result = Gsl_matrix.create 1 m in for col = 0 to pred m do result.{0, col} <- sqrt mat.{0, col} done; stack#push (RpcFloatMatrixUnit (result, Units.pow uu 0.5)) |_ -> () method minimum () = self#check_args 1 "min" self#internal_minimum (* single-variable statistics: minimum of set *) method private internal_minimum () = self#min_or_max true () method maximum () = self#check_args 1 "max" self#internal_maximum (* single-variable statistics: maximum of set *) method private internal_maximum () = self#min_or_max false () method private min_or_max operation_is_min () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcFloatMatrixUnit (mat, uu) -> let n, m = Gsl_matrix.dims mat in let result = Gsl_matrix.create 1 m in for col = 0 to pred m do result.{0, col} <- mat.{0, col}; for row = 1 to pred n do if operation_is_min then if mat.{row, col} < result.{0, col} then result.{0, col} <- mat.{row, col} else () else if mat.{row, col} > result.{0, col} then result.{0, col} <- mat.{row, col} else () done done; stack#push (RpcFloatMatrixUnit (result, uu)) |_ -> stack#push gen_el; raise (Invalid_argument "min can only be applied to real matrices") method upper_tail_prob_normal () = self#check_args 3 "utpn" self#internal_upper_tail_prob_normal method private internal_upper_tail_prob_normal () = self#evaln 3; let gen_el3 = stack#pop () in let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in let get_float_args gen_el = match gen_el with |RpcInt i_el -> funit_of_float (float_of_big_int i_el) |RpcFloatUnit (el, uu) -> (el, uu) |_ -> stack#push gen_el1; stack#push gen_el2; stack#push gen_el3; raise (Invalid_argument "utpn requires real scalar arguments") in let (mean_orig, mean_units) = get_float_args gen_el1 and (var_orig, var_units) = get_float_args gen_el2 and (cutoff, cutoff_units) = get_float_args gen_el3 in try (* check that units are consistent *) let mean = mean_orig *. (Units.conversion_factor mean_units cutoff_units !Rcfile.unit_table) in let var = var_orig *. (Units.conversion_factor var_units cutoff_units !Rcfile.unit_table) in if var <= 0.0 then begin stack#push gen_el1; stack#push gen_el2; stack#push gen_el3; raise (Invalid_argument "variance argument to utpn must be positive") end else begin let arg = (cutoff -. mean) /. (sqrt (2.0 *. var)) in let (f, u) = funit_of_float arg in stack#push (RpcFloatUnit (f, u)); self#internal_erfc (); stack#push (RpcFloatUnit (0.5, cutoff_units)); self#internal_mult () end with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; stack#push gen_el3; raise_invalid s (* random float between 0 and 1 *) method rand () = self#backup (); let (f, u) = funit_of_float (Random.float 1.0) in stack#push (RpcFloatUnit (f, u)) (* standardize units *) method standardize_units () = self#check_args 1 "ustand" self#internal_standardize_units method private internal_standardize_units () = self#evaln 1; let gen_el = stack#pop () in let get_std u = Units.standardize_units u !Rcfile.unit_table in match gen_el with |RpcFloatUnit (el, uu) -> let std = get_std uu in stack#push (RpcFloatUnit (el *. std.Units.coeff, std.Units.comp_units)) |RpcComplexUnit (el, uu) -> let std = get_std uu in let c_coeff = c_of_f std.Units.coeff in stack#push (RpcComplexUnit (Complex.mul el c_coeff, std.Units.comp_units)) |RpcFloatMatrixUnit (el, uu) -> let std = get_std uu in let result = Gsl_matrix.copy el in Gsl_matrix.scale result std.Units.coeff; stack#push (RpcFloatMatrixUnit (result, std.Units.comp_units)) |RpcComplexMatrixUnit (el, uu) -> let std = get_std uu in let c_coeff = c_of_f std.Units.coeff in let result = Gsl_matrix_complex.copy el in Gsl_matrix_complex.scale result c_coeff; stack#push (RpcComplexMatrixUnit (result, std.Units.comp_units)) |_ -> stack#push gen_el (* obtain the magnitude of a dimensioned value *) method unit_value () = self#check_args 1 "uvalue" self#internal_unit_value method private internal_unit_value () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcFloatUnit (el, uu) -> stack#push (RpcFloatUnit (el, Units.empty_unit)) |RpcComplexUnit (el, uu) -> stack#push (RpcComplexUnit (el, Units.empty_unit)) |RpcFloatMatrixUnit (el, uu) -> stack#push (RpcFloatMatrixUnit (el, Units.empty_unit)) |RpcComplexMatrixUnit (el, uu) -> stack#push (RpcComplexMatrixUnit (el, Units.empty_unit)) |_ -> stack#push gen_el (* obtain the magnitude of a dimensioned value *) method convert_units () = self#check_args 2 "uconvert" self#internal_convert_units method private internal_convert_units () = self#evaln 1; let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in match gen_el2 with |RpcFloatUnit (el2, uu2) -> begin match gen_el1 with |RpcFloatUnit (el1, uu1) -> begin try let conv = Units.conversion_factor uu1 uu2 !Rcfile.unit_table in stack#push (RpcFloatUnit (el1 *. conv, uu2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s end |RpcComplexUnit (el1, uu1) -> begin try let c_conv = { Complex.re = Units.conversion_factor uu1 uu2 !Rcfile.unit_table; Complex.im = 0.0 } in stack#push (RpcComplexUnit (Complex.mul el1 c_conv, uu2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s end |RpcFloatMatrixUnit (el1, uu1) -> begin try let conv = Units.conversion_factor uu1 uu2 !Rcfile.unit_table in let result = Gsl_matrix.copy el1 in Gsl_matrix.scale result conv; stack#push (RpcFloatMatrixUnit (result, uu2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s end |RpcComplexMatrixUnit (el1, uu1) -> begin try let conv = { Complex.re = Units.conversion_factor uu1 uu2 !Rcfile.unit_table; Complex.im = 0.0 } in let result = Gsl_matrix_complex.copy el1 in Gsl_matrix_complex.scale result conv; stack#push (RpcComplexMatrixUnit (result, uu2)) with Units.Units_error s -> stack#push gen_el1; stack#push gen_el2; raise_invalid s end |_ -> stack#push gen_el1; stack#push gen_el2; raise_invalid "cannot convert units for this data type" end |_ -> stack#push gen_el1; stack#push gen_el2; raise_invalid "unit conversion target must be real-valued" (* trace of a matrix *) method trace () = self#check_args 1 "trace" self#internal_trace method private internal_trace () = self#evaln 1; let gen_el = stack#pop () in match gen_el with |RpcFloatMatrixUnit (el, uu) -> let n, m = Gsl_matrix.dims el in if n = m then begin let result = ref 0.0 in for i = 0 to pred n do result := !result +. el.{i, i} done; stack#push (RpcFloatUnit (!result, uu)) end else begin stack#push gen_el; raise_invalid "argument of trace must be a square matrix" end |RpcComplexMatrixUnit (el, uu) -> let n, m = Gsl_matrix_complex.dims el in if n = m then begin let result = ref Complex.zero in for i = 0 to pred n do result := Complex.add !result el.{i, i} done; stack#push (RpcComplexUnit (!result, uu)) end else begin stack#push gen_el; raise_invalid "argument of trace must be a square matrix" end |_ -> stack#push gen_el; raise_invalid "argument of trace must be a square matrix" (* method print_stack () = let print_el line_num el = Printf.printf "%2d: %s\n" line_num el in for i = stack#length downto 1 do print_el i (stack#get_display_line i modes) done *) end;; (* arch-tag: DO_NOT_CHANGE_548916d4-da42-49b4-8941-c0d42306f1b7 *) orpie-1.5.2/mult.ml0000644000175000017500000002042012322115103012620 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) open Rpc_stack open Gsl_assist open Big_int let mult (stack : rpc_stack) (evaln : int -> unit) = evaln 2; let gen_el2 = stack#pop () in let gen_el1 = stack#pop () in match gen_el1 with |RpcInt el1 -> ( match gen_el2 with |RpcInt el2 -> stack#push (RpcInt (mult_big_int el1 el2)) |RpcFloatUnit (el2, uu2) -> let f_el1 = float_of_big_int el1 in stack#push (RpcFloatUnit (f_el1 *. el2, uu2)) |RpcComplexUnit (el2, uu2) -> let c_el1 = { Complex.re = float_of_big_int el1; Complex.im = 0.0 } in stack#push (RpcComplexUnit (Complex.mul c_el1 el2, uu2)) |RpcFloatMatrixUnit (el2, uu) -> let result = Gsl_matrix.copy el2 in Gsl_matrix.scale result (float_of_big_int el1); stack#push (RpcFloatMatrixUnit (result, uu)) |RpcComplexMatrixUnit (el2, uu) -> let c_el1 = cmpx_of_int el1 in let result = Gsl_matrix_complex.copy el2 in Gsl_matrix_complex.scale result c_el1; stack#push (RpcComplexMatrixUnit (result, uu)) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for multiplication")) ) |RpcFloatUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> let f_el2 = float_of_big_int el2 in stack#push (RpcFloatUnit (el1 *. f_el2, uu1)) |RpcFloatUnit (el2, uu2) -> stack#push (RpcFloatUnit (el1 *. el2, Units.mult uu1 uu2)) |RpcComplexUnit (el2, uu2) -> let c_el1 = c_of_f el1 in stack#push (RpcComplexUnit (Complex.mul c_el1 el2, Units.mult uu1 uu2)) |RpcFloatMatrixUnit (el2, uu2) -> let uprod = Units.mult uu1 uu2 in let result = Gsl_matrix.copy el2 in Gsl_matrix.scale result el1; stack#push (RpcFloatMatrixUnit (result, uprod)) |RpcComplexMatrixUnit (el2, uu2) -> let uprod = Units.mult uu1 uu2 in let result = Gsl_matrix_complex.copy el2 in Gsl_matrix_complex.scale result (c_of_f el1); stack#push (RpcComplexMatrixUnit (result, uprod)) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for multiplication")) ) |RpcComplexUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> let c_el2 = cmpx_of_int el2 in stack#push (RpcComplexUnit (Complex.mul el1 c_el2, uu1)) |RpcFloatUnit (el2, uu2) -> let c_el2 = c_of_f el2 in stack#push (RpcComplexUnit (Complex.mul el1 c_el2, Units.mult uu1 uu2)) |RpcComplexUnit (el2, uu2) -> stack#push (RpcComplexUnit (Complex.mul el1 el2, Units.mult uu1 uu2)) |RpcFloatMatrixUnit (el2, uu2) -> let c_el2 = cmat_of_fmat el2 in Gsl_matrix_complex.scale c_el2 el1; stack#push (RpcComplexMatrixUnit (c_el2, Units.mult uu1 uu2)) |RpcComplexMatrixUnit (el2, uu2) -> let result = Gsl_matrix_complex.copy el2 in Gsl_matrix_complex.scale result el1; stack#push (RpcComplexMatrixUnit (result, Units.mult uu1 uu2)) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for multiplication")) ) |RpcFloatMatrixUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> let result = Gsl_matrix.copy el1 in Gsl_matrix.scale result (float_of_big_int el2); stack#push (RpcFloatMatrixUnit (result, uu1)) |RpcFloatUnit (el2, uu2) -> let result = Gsl_matrix.copy el1 in Gsl_matrix.scale result el2; stack#push (RpcFloatMatrixUnit (result, Units.mult uu1 uu2)) |RpcComplexUnit (el2, uu2) -> let c_el1 = cmat_of_fmat el1 in Gsl_matrix_complex.scale c_el1 el2; stack#push (RpcComplexMatrixUnit (c_el1, Units.mult uu1 uu2)) |RpcFloatMatrixUnit (el2, uu2) -> let n1, m1 = (Gsl_matrix.dims el1) and n2, m2 = (Gsl_matrix.dims el2) in if m1 = n2 then let result = Gsl_matrix.create n1 m2 in Gsl_blas.gemm Gsl_blas.NoTrans Gsl_blas.NoTrans 1.0 el1 el2 0.0 result; stack#push (RpcFloatMatrixUnit (result, Units.mult uu1 uu2)) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for multiplication")) |RpcComplexMatrixUnit (el2, uu2) -> let n1, m1 = (Gsl_matrix.dims el1) and n2, m2 = (Gsl_matrix_complex.dims el2) in if m1 = n2 then let c_el1 = cmat_of_fmat el1 and result = Gsl_matrix_complex.create n1 m2 in Gsl_blas.Complex.gemm Gsl_blas.NoTrans Gsl_blas.NoTrans Complex.one c_el1 el2 Complex.zero result; stack#push (RpcComplexMatrixUnit (result, Units.mult uu1 uu2)) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for multiplication")) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for multiplication")) ) |RpcComplexMatrixUnit (el1, uu1) -> ( match gen_el2 with |RpcInt el2 -> let c_el2 = cmpx_of_int el2 in let result = Gsl_matrix_complex.copy el1 in Gsl_matrix_complex.scale result c_el2; stack#push (RpcComplexMatrixUnit (result, uu1)) |RpcFloatUnit (el2, uu2) -> let result = Gsl_matrix_complex.copy el1 in Gsl_matrix_complex.scale result Complex.one; stack#push (RpcComplexMatrixUnit (result, Units.mult uu1 uu2)) |RpcComplexUnit (el2, uu2) -> let result = Gsl_matrix_complex.copy el1 in Gsl_matrix_complex.scale result Complex.one; stack#push (RpcComplexMatrixUnit (result, Units.mult uu1 uu2)) |RpcFloatMatrixUnit (el2, uu2) -> let n1, m1 = (Gsl_matrix_complex.dims el1) and n2, m2 = (Gsl_matrix.dims el2) in if m1 = n2 then let c_el2 = cmat_of_fmat el2 and result = Gsl_matrix_complex.create n1 m2 in Gsl_blas.Complex.gemm Gsl_blas.NoTrans Gsl_blas.NoTrans Complex.one el1 c_el2 Complex.zero result; stack#push (RpcComplexMatrixUnit (result, Units.mult uu1 uu2)) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for multiplication")) |RpcComplexMatrixUnit (el2, uu2) -> let n1, m1 = (Gsl_matrix_complex.dims el1) and n2, m2 = (Gsl_matrix_complex.dims el2) in if m1 = n2 then let result = Gsl_matrix_complex.create n1 m2 in Gsl_blas.Complex.gemm Gsl_blas.NoTrans Gsl_blas.NoTrans Complex.one el1 el2 Complex.zero result; stack#push (RpcComplexMatrixUnit (result, Units.mult uu1 uu2)) else (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible matrix dimensions for multiplication")) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for multiplication")) ) |_ -> (stack#push gen_el1; stack#push gen_el2; raise (Invalid_argument "incompatible types for multiplication")) (* arch-tag: DO_NOT_CHANGE_5fc03e41-d1d3-40da-8b68-9a85d96148d0 *) orpie-1.5.2/statefile.ml0000644000175000017500000001054012322115103013621 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* statefile.ml * This file contains code for saving and loading the calculator * state. *) open Rpc_stack open Rpc_calc (* save to a datafile using the Marshal module *) let save_state ((modes : calculator_modes), (variables : (string, orpie_data_t) Hashtbl.t), ((data_stack : stack_data_t array), (data_len : int))) = try let version_file = Utility.join_path !(Rcfile.datadir) "version" in let version_channel = Utility.open_or_create_out_bin version_file in output_string version_channel Version.version; close_out version_channel; let save_file = Utility.join_path !(Rcfile.datadir) "calc_state" in let save_channel = Utility.open_or_create_out_bin save_file in Marshal.to_channel save_channel (modes, variables, !Rcfile.autobind_keys, data_stack, data_len) []; close_out save_channel with |Sys_error ss -> raise (Invalid_argument "can't open data file for writing") |Failure ff -> raise (Invalid_argument "can't serialize calculator data to file") (* load from a datafile using the Marshal module *) let load_state () = try (* check whether the version file exists *) let version_file = Utility.join_path !(Rcfile.datadir) "version" in if Sys.file_exists (Utility.expand_file version_file) then begin (* if it does exist, try loading it *) let version_channel = Utility.expand_open_in_ascii version_file in let ver_string = input_line version_channel in close_in version_channel; (* if the version strings match, then assume it's okay to use * Marshal. *) if ver_string = Version.version then begin (* check whether the state file exists *) let datafile = Utility.join_path !(Rcfile.datadir) "calc_state" in if Sys.file_exists (Utility.expand_file datafile) then begin (* if it does exist, try loading it *) let load_channel = Utility.expand_open_in_bin datafile in let data_modes, data_variables, data_autobind_keys, data_stack, data_len = (Marshal.from_channel load_channel : calculator_modes * ((string, orpie_data_t) Hashtbl.t) * (int * string * Operations.operation_t option * int) array * (stack_data_t array) * int) in close_in load_channel; Rcfile.validate_saved_autobindings data_autobind_keys; (data_modes, data_variables, Some (data_stack, data_len)) end else (* if the datafile is missing, do nothing as it will be * created later *) ({angle = Rad; base = Dec; complex = Rect}, Hashtbl.create 20, None) end else (* if the version strings don't match, don't try loading anything *) ({angle = Rad; base = Dec; complex = Rect}, Hashtbl.create 20, None) end else (* if the version file does not exist, don't try loading anything *) ({angle = Rad; base = Dec; complex = Rect}, Hashtbl.create 20, None) with (* this gets raised if, for example, we don't have read permission * on the state data file *) |Sys_error ss -> raise (Invalid_argument "can't open calculator state data file") (* this shouldn't happen unless the data file gets corrupted. *) |Failure ff -> raise (Invalid_argument "can't deserialize calculator data from file") (* arch-tag: DO_NOT_CHANGE_00dfe125-d9a3-4eca-842d-2a7e29cd29d0 *) orpie-1.5.2/utility.ml0000644000175000017500000001337712322115103013357 0ustar paulpaul(* Orpie -- a fullscreen RPN calculator for the console * Copyright (C) 2003-2004, 2005, 2006-2007, 2010 Paul Pelzl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, * as published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please send bug reports, patches, etc. to Paul Pelzl at * . *) (* utility.ml * * miscellaneous helper functions that don't really fit elsewhere *) (* for some reason this is unrecognized if I leave it in txtin_parser.mly *) exception Txtin_error of string (* Word wrap a string to a width of 'cols', placing 'num_spaces' spaces between * the words. Breaks lines on whitespace; if a word is too long, it will be * broken and hyphenated. Return value is a list of strings. *) let wordwrap_nspace s cols num_spaces = let space_str = String.make num_spaces ' ' in if String.length s <= cols then s :: [] else let rec process_words (word_list : string list) (wrapped_list : string list) = match word_list with |word :: word_tail -> begin match wrapped_list with |line :: line_tail -> let new_line = line ^ space_str ^ word in if String.length new_line <= cols then process_words word_tail (new_line :: line_tail) else if String.length word <= cols then process_words word_tail (word :: wrapped_list) else let len = String.length word in let partial_word = (String.sub word 0 (cols-1)) ^ "-" and remainder_word = "-" ^ (String.sub word (cols-1) (len-cols+1)) in process_words (remainder_word :: word_tail) (partial_word :: wrapped_list) |[] -> if String.length word <= cols then process_words word_tail (word :: wrapped_list) else let len = String.length word in let partial_word = (String.sub word 0 (cols-1)) ^ "-" and remainder_word = "-" ^ (String.sub word (cols-1) (len-cols+1)) in process_words (remainder_word :: word_tail) (partial_word :: wrapped_list) end |[] -> wrapped_list in let words = Str.split (Str.regexp "[ \t]+") s in List.rev (process_words words []) (* wordwrap with single space *) let wordwrap s cols = wordwrap_nspace s cols 1 (* append a file to a directory, with the proper number * of slashes *) let join_path dirname filename = let dir_last = dirname.[String.length dirname - 1] and file_first = filename.[0] in if dir_last = '/' && file_first = '/' then dirname ^ (Str.string_after filename 1) else if dir_last <> '/' && file_first <> '/' then dirname ^ "/" ^ filename else dirname ^ filename (* If the filename starts with "~", substitute $HOME *) let expand_file filename = if Str.string_before filename 2 = "~/" then let homedir = Sys.getenv "HOME" in homedir ^ Str.string_after filename 1 else filename (* Do whatever is necessary to open up a file for writing. If it already exists, * open it as-is. If it does not exist, make sure that all prefix directories * do exist, then open a new file. *) let open_or_create_out_gen is_binary filename = let exp_file = expand_file filename in (* Test whether the file exists *) if Sys.file_exists exp_file then if is_binary then open_out_bin exp_file else open_out exp_file else (* Check whether all directories exist *) let dir_path = Filename.dirname exp_file in let dir_list = Str.split (Str.regexp "/+") dir_path in (* if necessary, add the first "/" to the first directory *) let slash_dir_list = if not (Filename.is_relative dir_path) then ("/" ^ (List.hd dir_list)) :: (List.tl dir_list) else dir_list in let rec make_directories d_list = match d_list with | [] -> () | d :: tail -> begin try Sys.chdir d with Sys_error err_msg -> begin let _ = Sys.command ("mkdir " ^ d) in Sys.chdir d end end; make_directories tail in make_directories slash_dir_list; if is_binary then open_out_bin (Filename.basename exp_file) else open_out (Filename.basename exp_file) let open_or_create_out_bin filename = open_or_create_out_gen true filename let open_or_create_out_ascii filename = open_or_create_out_gen false filename (* open a filename, with tilde expansion *) let expand_open_in_gen is_binary filename = (* If the filename starts with "~", substitute $HOME *) if is_binary then open_in_bin (expand_file filename) else open_in (expand_file filename) let expand_open_in_bin filename = expand_open_in_gen true filename let expand_open_in_ascii filename = expand_open_in_gen false filename (* arch-tag: DO_NOT_CHANGE_a87790db-2dd0-496c-9620-ed968f3253fd *)