If you use it with two windows, one window (Calculator) is used to edit expressions, in the other one (*calcres*) the results are displayed.
File Edit Mode Search Buffers Windows System Help R(E1): 45 R(E2): "0: 0" "1: 1" "2: 4" [EOB] -**-----|V0.99.16| *calcres* () | 9/9,1------------------------- %-------------- :-) E1 a=0; for (i=0; i<10; i++) a+=i; a; %R: 45 %-------------- :-) E2 for (i=0; i<3; i++) sprintf ("%d: %d", i, i*i); %R: "2: 4" %-------------- :-) E3 [EOB] -**-----|V0.99.16| Calculator (SLangCalc) | 11/11,1-------------
The evaluation is started with calc_make_calculation()
(^C^A if ^C is
your _Reserved_Key_Prefix).
Use the calc_mode_hook to define your own bindings e.g. in your .jedrc:
define calc_mode_hook () { local_setkey ("calc_make_calculation", "^[^M"); % Alt-Return }The result of an expression is everything that is left on the SLang stack after the expression is evaluated. The result of evaluation of
1+1; 2+2;would be
2 4but only 4 is written into the expression buffer. The other results can be found in the result buffer using
calc_result_window()
(^C^W).
An expression can be any valid SLang code. Multiple expressions
can be divided by a tag with calc_next_expression()
(^C^N).
There are 25 predefined variables ([a-z]) that can be used without
declaration and displayed with calc_display_variables()
(^C^V).
Use calc_help()
(^C^H) (or look at the mode menu) for help on keys.
The display format for integer and float results can be changed from the mode menu. The combined mode displays integer results in dec, oct, hex and bin format.
autoload ("calc", "calc.sl"); autoload ("calc2", "calc.sl");in your .jedrc file.
Then you can invoke the calculator with M-x calc
or M-x calc2
for two-window mode.
To get a Calc menu entry insert in your .jedrc:
if you have jed 99.13:
static define load_popups_hook (menubar) { % menu_insert_item (3, "Global.S&ystem", "Ca&lculate", "calc"); } variable Menu_Load_Popups_Hook = &load_popups_hook;if you have a newer version than jed 99.13:
define calc_load_popup_hook (menubar) { menu_insert_item (7, "Global.S&ystem", "Ca&lculate", "calc"); } append_to_hook ("load_popup_hooks", &calc_load_popup_hook);or insert the
menu_insert_item()
function to an already defined
_load_popup_hook
.