// gRascal, the Advanced Scientific CALculator // Copyright (C) 2001, Sebastian Ritterbusch (Rascal@Ritterbusch.de) // // 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. // #include #include "calterm.cpp" static void rascal_load(string a,Calterm &b) { FILE *in=fopen(a.c_str(),"rt"); while(!feof(in)) { char buffer[1025]; int n=fread(buffer,1,1024,in); if(n>0) { buffer[n]=0; b.send_command(buffer); } } fclose(in); } static void rascal_save(string a,Calterm &c) { FILE *out=fopen(a.c_str(),"wt"); string b=c.do_command("variables;functions;\n"); int i; for(i=0;iL","Load Rascal File",rascal_load)); a.addMenu(new MenuFileSelect("/File/_Save","S","Save Rascal File",rascal_save)); a.addMenu(new MenuSeparator("/File/sep1")); a.addMenu(new MenuGtkFunction("/File/_Quit","Q",(GtkItemFactoryCallback)gtk_main_quit)); a.addMenu(new MenuTop("/_Show")); a.addMenu(new MenuSimpleSend("/Show/_Variables","","variables;\n")); a.addMenu(new MenuSimpleSend("/Show/_Functions","","functions;\n")); a.addMenu(new MenuSimpleSend("/Show/_Output Precision","","ShowPrecision;\n")); // a.addMenu(new MenuTop("/_Options")); // a.addMenu(new MenuFunction("/Options/Open Example Window","",window_example)); a.addMenu(new MenuTop("/_Examples")); a.addMenu(new MenuSimpleSend("/Examples/_Defining a function","","f(x)=sin(x)+(x*x);\nf(2)\n")); a.addMenu(new MenuSimpleSend("/Examples/_Inverting a matrix","","1/[1 2;3 4]\n")); a.addMenu(new MenuSimpleSend("/Examples/I_teration","","x=0;for(k=1;k<=10;k++) x=x+k\n")); a.addMenu(new MenuTopRightAlign("/_Help")); a.addMenu(new MenuSimpleSend("/Help/Introduction","","help;\n")); a.addMenu(new MenuSimpleSend("/Help/Modules","","modules;\n")); a.addMenu(new MenuSimpleSend("/Help/Index","","help index;\n")); a.addMenu(new MenuSimpleSend("/Help/Licence","","licence;\n")); a.addMenu(new MenuSimpleSend("/Help/Changelog","","help changes;\n")); a.addMenu(new MenuSeparator("/Help/sep2")); a.addMenu(new MenuShowUrl("/Help/Manual","","file:%%PREFIX%%/share/doc/rascal/html/index.html")); a.addMenu(new MenuSeparator("/Help/sep1")); a.addMenu(new MenuShowUrl("/Help/Rascal Homepage","","http://rascal.sourceforge.net/")); a.start(&argc,&argv); return 0; }