OKlibrary  0.2.1.6
maxima-init.mac
Go to the documentation of this file.
00001 /* Oliver Kullmann, 4.1.2008 (Swansea) */
00002 /* Copyright 2008, 2009, 2010, 2011, 2012 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00008 define_variable(
00009   oklibrary_domain,
00010   "m4_SHELL(oklibrary_domain)",
00011   any);
00012 define_variable(
00013   OKplatform,
00014   "m4_SHELL(OKplatform)",
00015   any);
00016 define_variable(
00017   OKsystem,
00018   "m4_SHELL(OKsystem)",
00019   any);
00020 define_variable(
00021   build_identification_okl,
00022   "m4_SHELL(build_identification_okl)",
00023   any);
00024 define_variable(
00025   oklib_session_name,
00026   sconcat("Maxima_session_",build_identification_okl),
00027   any);
00028 define_variable(
00029   git_id_oklib,
00030   "m4_SHELL(git_id_oklib)",
00031   any);
00032 define_variable(
00033   maxima_lisp_name_okl,
00034   "m4_SHELL(maxima_lisp_name_okl)",
00035   any);
00036 define_variable(
00037   maximal_argument_length,
00038   if maxima_lisp_name_okl = "ecl" then 2^16 
00039     elseif maxima_lisp_name_okl = "clisp" then 2^12 - 1
00040     elseif maxima_lisp_name_okl = "sbcl" then 2^17
00041     else unknown,
00042   any); /* may take value inf or unknown */
00043 define_variable(
00044   environment_machine_bits,
00045   m4_SHELL(machine_bits_okl),
00046   fixnum);
00047 
00048 define_variable(
00049   eis_directory_okl,
00050   "m4_SHELL(maxima_eis_installation_dir_okl)",
00051   any);
00052 
00053 scalarmatrixp : false; /* now matrix([0]) . matrix([0]) = matrix([0]) */
00054 showtime : true; /* show how much run-time was needed */
00055 linel : 100; /* width for displaying expressions */
00056 stringdisp : true; /* show strings with quotation marks */
00057 stardisp : true; /* show multiplications via "*" */
00058 display2d : false; /* show output as strings (which can be copied!) */
00059 disp2d(x) := block([display2d:true], disp(x)); /* outputs x in 2d-format */
00060 set_plot_option([gnuplot_term, x11]);
00061 ratprint : false; /* no messages informing about conversion of floating point
00062 numbers to rational numbers */
00063 float2bf : true; /* no messages informing about conversion from float to 
00064 bfloat */
00065 bftorat : true; /* full precision when converting big floats to rational numbers */
00066 
00067 define_variable(
00068   oklib_monitor,
00069   false,
00070   boolean);
00071 define_variable(
00072   oklib_monitor_level,
00073   0,
00074   any); /* may take value inf */
00075 
00076 define_variable(
00077   oklib_test_level,
00078   0,
00079   any); /* may take value inf */
00080 define_variable(
00081   oklib_test_demos,
00082   false,
00083   boolean);
00084 define_variable(
00085   oklib_test_demos_level,
00086   0,
00087   any); /* may take value inf */
00088 
00089 
00090 /* Functions for loading files */
00091 
00092 define_variable(
00093   oklib_load_round,
00094   0,
00095   fixnum);
00096 oklib_loaded_files["maxima-init.mac"] : 0;
00097 
00098 define_variable(
00099   oklib_load_annotation,
00100   false,
00101   boolean);
00102 /* Whether or not oklib_load and oklib_include create functions 
00103    which annotate lists.
00104    oklib_batch, oklib_demo always lead to annotation of lists
00105    (that is, directly --- the invoked oklib_includes
00106    then are governed by oklib_load_annotation).
00107 */
00108 
00109 loadfile(sconcat(OKsystem,"/OKlib/ComputerAlgebra/MaximaInternals/optload.lisp"));
00110 loadfile(sconcat(eis_directory_okl,"/eis.lisp"));
00111 
00112 oklib_load(name) := oklib_plain_load(sconcat(OKsystem,"/",name));
00113 oklib_plain_load(name) := (
00114  oklib_load_round : oklib_load_round+1,
00115  oklib_loaded_files[name] : oklib_load_round,
00116  load(name, oklib_load_annotation));
00117 
00118 oklib_include(name) := oklib_plain_include(sconcat(OKsystem,"/",name));
00119 oklib_plain_include(name) := (
00120  if oklib_loaded_files[name] # oklib_load_round then (
00121   oklib_loaded_files[name] : oklib_load_round,
00122   load(name, oklib_load_annotation))
00123 );
00124 
00125 oklib_load_all() := oklib_load("OKlib/ComputerAlgebra/include.mac");
00126 
00127 oklib_batch(name) := oklib_plain_batch(sconcat(OKsystem,"/",name));
00128 oklib_plain_batch(name) := (
00129  oklib_load_round : oklib_load_round+1,
00130  oklib_loaded_files[name] : oklib_load_round,
00131  batch(name));
00132 
00133 oklib_demo(name) := oklib_plain_demo(sconcat(OKsystem,"/",name));
00134 oklib_plain_demo(name) := (
00135  oklib_load_round : oklib_load_round+1,
00136  oklib_loaded_files[name] : oklib_load_round,
00137  demo(name));
00138 
00139 define_variable(
00140   oklib_automatic_test,
00141   false,
00142   boolean);
00143 
00144 
00145 
00146 /* Storing all variables in fixed time intervals: */
00147 
00148 define_variable(
00149   oklib_store,
00150   false,
00151   boolean);
00152 define_variable(
00153   oklib_old_storing_time,
00154   0.0,
00155   number);
00156 define_variable(
00157   oklib_storage_interval,
00158   10, /* every 10 minutes */
00159   number);
00160 
00161 /* Returns true if storage action did happen: */
00162 /* If no arguments are given, then everything is saved,
00163    otherwise the arguments are passed to the save-function;
00164    so if they represent names of variables, then they need
00165    to be quoted. */
00166 oklib_save([L]) := if oklib_store then block(
00167  [ert : elapsed_run_time()],
00168   if ert - oklib_old_storing_time >= oklib_storage_interval * 60 then block(
00169    [file_output_append : false],
00170     if emptyp(L) then
00171       save(oklib_session_name,all)
00172     else
00173       apply(save, cons(oklib_session_name,L)),
00174     oklib_old_storing_time : ert,
00175     return(true)
00176   )
00177   else return(false))
00178  else false$
00179 
00180 
00181 /* Logging of output to file "Maxima_session_timestampe_string": */
00182 
00183 oklib_log(string) := writefile(sconcat(oklib_session_name,"_",string));
00184 oklib_log_close() := closefile();
00185 /* Remark: If a term t is to be computed in logging-mode, best is to use
00186      display(t)$
00187    which will also show t itself.
00188 */
00189 
00190 /* Constants for asserts handling floating-point numbers */
00191 
00192 define_variable(
00193   oklib_float_comparison_factor,
00194   1,
00195   rational);
00196 
00197 define_variable(
00198   oklib_float_comparison_exponent,
00199   15,
00200   fixnum);
00201 
00202 /* Constants for Ecl memory-management */
00203 
00204 define_variable(
00205   frame_stack_ecl,
00206   m4_SHELL(frame_stack_ecl_okl),
00207   fixnum);
00208 define_variable(
00209   binding_stack_ecl,
00210   m4_SHELL(binding_stack_ecl_okl),
00211   fixnum);
00212 define_variable(
00213   c_stack_ecl,
00214   m4_SHELL(c_stack_ecl_okl),
00215   fixnum);
00216 define_variable(
00217   heap_size_ecl,
00218   m4_SHELL(heap_size_ecl_okl),
00219   fixnum);
00220 define_variable(
00221   lisp_stack_ecl,
00222   m4_SHELL(lisp_stack_ecl_okl),
00223   fixnum);