;w Menu * { - Enterprise Calculation:/dialog -md Math Math - } alias F6 { /dialog -md Math Math } Dialog Math { Title "Enterprise Calculation By Ano" size -1 -1 150 100 option dbu Edit "Vraag", 1, 2 2 98 10 Edit "Antwoord", 2, 2 14 98 10, read Button "1", 3, 2 26 15 15 Button "2", 4, 17 26 15 15 Button "3", 5, 32 26 15 15 Button "4", 6, 2 41 15 15 Button "5", 7, 17 41 15 15 Button "6", 8, 32 41 15 15 Button "7", 9, 2 56 15 15 Button "8", 10, 17 56 15 15 Button "9", 11, 32 56 15 15 Button "0", 12, 2 71 15 15 Button ".", 13, 17 71 15 15 Button "-", 14, 32 71 15 15 Button ":", 15, 50 26 15 15 Button "X", 16, 50 41 15 15 Button "-", 17, 50 56 15 15 Button "+", 18, 50 71 15 15 Button "Ok", 19, 2 88 78 10 Button "²", 20, 65 26 15 15 Button "^", 21, 65 41 15 15 Button "Sqrt", 22, 65 56 15 15 Button "xSqrt", 23, 65 71 15 15 Button "[", 24, 83 71 15 15 Button "]", 25, 98 71 15 15 Button "Sin", 26, 83 26 15 15 Button "aSin", 27, 98 26 15 15 Button "Cos", 28, 83 41 15 15 Button "aCos", 29, 98 41 15 15 Button "Tan", 30, 83 56 15 15 Button "aTan", 31, 98 56 15 15 Button "(", 32, 83 88 15 10 Button ")", 33, 98 88 15 10 } on *:dialog:math:sclick:*: { if (%thingie == on) { set %thingie off did -r $dname 1 } if ($did == 16) { did -a $dname 1 * halt } if ($did isnum 3-21 || $did isnum 24-25 || $did isnum 32-33)) && ($did != 19) { if ($did(math,1) == vraag) did -r $dname 1 set %calc $did(math,1) $+ $did(math,$did) did -ra $dname 1 %calc } if ($did isnum 26-31 || $did isnum 22-23) { if ($did(math,1) == vraag) did -r $dname 1 set %calc $did(math,1) $+ $iif($right($did(math,1),1) == [, $+,$chr(32)) $+ $did(math,$did) $+ ( did -ra $dname 1 $remove(%calc,]) } elseif ($did == 19) { set %tocalc $did(math,1) //echo -a test set %tocalc1 $replacex(%tocalc,:,/,asin,$chr(36) $+ asin,atan,$chr(36) $+ atan,acos,$chr(36) $+ acos,sin,$chr(36) $+ sin,cos,$chr(36) $+ cos,tan,$chr(36) $+ tan,²,^2,sqrt,$chr(36) $+ sqrt) //echo -a test if (x$sqrt isin %tocalc1) wortel if ($chr(40) isin %tocalc1) replica 40 if ($chr(41) isin %tocalc1) replica 40 if ($chr(91) isin %tocalc1) replica 50 yep if ($chr(93) isin %tocalc1) replica 50 yep set %tocalc3 $eval(%tocalc2,2) set %tocalc4 $calc(%tocalc3) did -ra $dname 2 %tocalc4 set %thingie on } else { } } alias wortel { set %wortel $pos(%tocalc1,x$sqrt,1) var %x = $calc(%wortel - 1) while ($right($left(%tocalc1,%x),1)) { if (%x > 20) break if ($right($left(%tocalc1,%x),1) == $chr(41)) { //echo -a $right($left(%tocalc1,%x),%wortel) } inc %x } } alias replica { unset %repinc* :rep if (%tocalc1) { if ($1 == 40) { set %chr1 40 set %chr2 41 } if ($1 == 50) { set %chr1 91 set %chr2 93 } unset %replica var %r = 1 while ($right($left(%tocalc1,%r),1)) { if ($lower($right($left(%tocalc1,%r),1)) == $chr(%chr1)) { inc %replica if ($2) set %repinc [ $+ [ %r ] ] %r $+ T } if ($lower($right($left(%tocalc1,%r),1)) == $chr(%chr2)) { dec %replica if ($2) { set %repinc [ $+ [ %r ] ] %r $+ F set %rep $var(%repinc*,0) set %imp $calc($left($eval($var(%repinc*,%rep),2),-1) -1) set %imp2 $left($eval($var(%repinc*,$calc(%rep - 1)),2),-1) set %imp3 $calc(%imp - %imp2) set %imp4 $calc($right($left(%tocalc1,%imp),%imp3)) set %imp5 $left(%tocalc1,$calc(%imp2 - 1)) set %imp6 $right(%tocalc1,$calc($len(%tocalc) - $calc(%imp + 1))) set %tocalc2 %imp5 $iif(%imp5 isnum,*) $iif(%imp4 != 0,%imp4, $+ ) $iif(%imp6 isnum,*) $remove(%imp6,],[) break } } if (%r >= $len(%tocalc1)) break inc %r } if (%replica > 0) && (%chr1 == 40) set %tocalc1 $did(math,1) $+ $str($chr(%chr2),%replica) if (%replica < 0) did -ra math 1 Error } unset %chr1 unset %chr2 }