EXPORT i_SB()
BEGIN
LOCAL a,b,z,answer, i_Wert;
LOCAL event,loop_1,loop_2,loop_3,loop_3_count;
//initialize continuous loop counter variables
loop_1:=1;
loop_2:=1;
loop_3:=1;
WHILE loop_1==1 DO
a:=0; //clear variables
b:=0;
z:=0;
WHILE loop_2==1 DO
INPUT({a,b,z});
i_Wert:=(1/(2*π))*(ATAN((a*b)/(z*√(a^2+b^2+z^2)))+(a*b*z)/(√(a^2+b^2+z^2))*(1/(a^2+z^2)+1/(b^2+z^2)));
answer:=i_Wert;
loop_3_count:=0; //initialize loop 3 cycle counter
WHILE loop_3==1 DO //loop 3
loop_3_count:=loop_3_count+1;
//if there are no tap or key events after 3 WAIT(-1) cycles (3 minutes), exit program
IF loop_3_count==4 THEN
//exit program
BREAK(3); //exit loops 3, 2, and 1
END;
//draw G0 screen
RECT();
TEXTOUT_P("i-Wert nach Steinbrenner",10,15);
TEXTOUT_P("a = "+a,10,45);
TEXTOUT_P("b = "+b,10,60);
TEXTOUT_P("z = "+z,10,75);
TEXTOUT_P("i-Wert = "+i_Wert,10,105);
//TEXTOUT_P("Loop 3 WAIT(-1) counter = "+loop_3_count,10,135);
DRAWMENU("", "", "", "exit", "clear", "↩");
//pause up to 60 seconds to get a screen tap or key press and store the tap or key data into "event"
event:=WAIT(-1);
//key press handling procedues
IF TYPE(event)==0 THEN //Is the variable "event" a real number?
IF event==4 THEN //Was the "Esc" key pressed?
//exit the program by going to end of loop 1
BREAK(3); //exit loop 3, loop 2, loop 1
END;
END;
//mouse tap handling procedures
IF TYPE(event)==6 THEN //Is the variable "event" a list.
IF event(1)==3 THEN //Is the MOUSE event type a mouse click (i.e. screen tap)?
IF event(3) > 219 THEN //Was the y coordinate tap within the row of user tabs?
IF event(2) ≥ 0 AND event(2) ≤ 51 THEN //tab 1 Is the x coordinate within tab 1?
//no action
END;
IF event(2) ≥ 53 AND event(2) ≤ 104 THEN //tab 2
//no action
END;
IF event(2) ≥ 106 AND event(2) ≤ 157 THEN //tab 3
//no action
END;
IF event(2) ≥ 159 AND event(2) ≤ 210 THEN //tab 4 "exit"
//go to end of loop 1
BREAK(3); //exit loops 3, 2, and 1
END;
IF event(2) ≥ 212 AND event(2) ≤ 263 THEN //tab 5 "clear"
//go to end of loop 2, and then goes to the beginning of loop 1
BREAK(2); //exit loops 3, and 2
END;
IF event(2) ≥ 265 AND event(2) ≤ 319 THEN //tab 6 "↩"
//go to end of loop 3, and then goes to the beginning of loop 2
BREAK(1); //exit loop 3
END;
END;
END;
END; //if TYPE(event)==6
END; //loop 3
END; //loop 2
END; //loop 1
RETURN answer; //returns the answer to the home screen
END; //main program