% Spinach file for the unigate class % module unigatespi. import typechecker, wiresig, gatesig, unigatesig, spinach. % Extension % extends unigate gate. % Typechecker stuff %%%%%%%%%%%%%%%%%%% % Generated by: otype unigate ref wire -> ref wire -> aclass. % tcheck Theta unigate Cont tmod TC :- popmod (unigate Inwire Outwire) M, pi C\ tcheck ((tp C (tref unigate))::Theta) (M C) Cont tprog TC. tcheck Theta (new (unigate Inwire Outwire) P) Cont tcmd TC :- tcheck Theta Inwire nil (tref wire) nil, tcheck Theta Outwire nil (tref wire) nil, pi C\ tcheck ((tp C (tref unigate))::Theta) (P C) Cont tcmd TC. tcheck Theta (cons G (unigate Inwire Outwire)) Cont theadin TC :- tcheck Theta G nil (tref unigate) nil, tcheck ((tp Inwire (tref wire))::(tp Outwire (tref wire))::Theta) none Cont dot TC. tcheck Theta (cons G (unigate Inwire Outwire)) Cont theadout TC :- tcheck Theta none Cont dot TC. tcheck Theta (super C (unigate Inwire Outwire)) Cont tcmd TC :- tcheck Theta Inwire nil (tref wire) nil, tcheck Theta Outwire nil (tref wire) nil, tcheck Theta none Cont dot TC. % Private data % tcheck Theta (ppriv unigate inw) Cont (tref wire) TC :- tcheck Theta none Cont dot TC. % Methods % % Generated by: mtype out get_input ref unigate -> ref wire -> cmd. % tcheck Theta (get_input G W) Cont tcmd TC :- tcheck Theta G nil (tref unigate) nil, tcheck Theta W nil dot nil, tcheck ((tp W (tref wire))::Theta) none Cont dot TC. % read tcheck Theta (get_input G W) Cont ttest TC :- tcheck Theta G nil (tref unigate) nil, tcheck Theta W nil (tref wire) nil, tcheck Theta none Cont dot TC. % test tcheck Theta (get_input G W) Cont theadin TC :- tcheck Theta G nil (tref unigate) nil, tcheck Theta none Cont dot TC. % headin tcheck Theta (get_input G W) Cont theadout TC :- tcheck Theta W nil (tref wire) nil, tcheck Theta none Cont dot TC. % headout % Generated by: mtype in set_input ref unigate -> ref wire -> cmd. % tcheck Theta (set_input G W) Cont tcmd TC :- tcheck Theta G nil (tref unigate) nil, tcheck Theta W nil (tref wire) nil, tcheck Theta none Cont dot TC. % write tcheck Theta (set_input G W) Cont theadin TC :- tcheck Theta G nil (tref unigate) nil, tcheck ((tp W (tref wire))::Theta) none Cont dot TC. % headin tcheck Theta (set_input G W) Cont theadout TC :- tcheck Theta none Cont dot TC. % headout % Spinacher stuff %%%%%%%%%%%%%%%%% % Generated by: otype unigate ref wire -> ref wire -> aclass. % spinach Theta Mu (tref unigate) "Unigate". spinach Theta Mu unigate Java :- popmod (unigate Inwire Outwire) P, extends unigate O, spinach nil nil (tref O) SO, pi C\ spinach ((tp C (tref unigate))::Theta) ((np C "this")::Mu) (P C) JP, Java is "public abstract class " ^ "Unigate" ^ " extends " ^ SO ^ "{\n" ^ JP ^ "}\n". spihead Theta Mu (cons G (unigate Inwire Outwire)) (Inwire::Outwire::nil) Java "" :- spinach nil nil (tref wire) STW, spinach Theta Mu Inwire SInwire, spinach Theta Mu Outwire SOutwire, Java is "Unigate" ^ "(" ^ STW ^ " " ^ SInwire ^ ", " ^ STW ^ " " ^ SOutwire ^ "){\n". spinach Theta Mu (popnew (unigate Inwire Outwire) S P) Java :- pi O\ spinach ((tp Outwire (tref unigate))::nil) ((np O S)::Mu) (P O) JP, spinach nil nil (tref unigate) JS, spinach nil nil Inwire SInwire, spinach nil nil Outwire SOutwire, Java is JS ^ " " ^ S ^ " = new " ^ JS ^ "(" ^ SInwire ^ ", " ^ SOutwire ^ ");\n" ^ JP. spinach Theta Mu (super C (unigate Inwire Outwire)) Java :- spinach Theta Mu Inwire JI, spinach Theta Mu Outwire JO, Java is "super(" ^ JI ^ ", " ^ JO ^ ");\n". % Methods % % Generated by: mtype get_input out ref unigate -> ref wire -> cmd. % spihead Theta Mu (get_input G W) nil Java Jreturn :- spinach nil nil (tref wire) STG, Java is "public " ^ STG ^ " get_input" ^ "(" ^ "){\n", spinach Theta Mu W SW, Jreturn is "return " ^ SW ^ ";\n". spinach Theta Mu (get_input G W) Java :- spinach Theta Mu G SG, spinach Theta Mu W SW, Java is SW ^ "=" ^ SG ^ "." ^ "get_input" ^ "(" ^ ");\n". % Generated by: mtype set_input in ref unigate -> ref wire -> cmd. % spihead Theta Mu (set_input G W) (W::nil) Java "" :- spinach nil nil (tref wire) STW, spinach Theta Mu W SW, Java is "public void set_input" ^ "( " ^ STW ^ " " ^ SW ^ " ){\n". spinach Theta Mu (set_input G W) Java :- spinach Theta Mu G SG, spinach Theta Mu W SW, Java is SG ^ "." ^ "set_input" ^ "( " ^ SW ^ ");\n".