(* This files contains definitions for bringing FrameMaker ascii equations
   into Mathematica.
   Execute this file from Mathematica and then select a FrameMaker math 
   equation as an object in FrameMaker. (Control Click)
   Paste the equation into Mathematica, execute, and 
   then run FrameConvert[%]
   *)


(* Alot of things can be converted with just aliases *)
plus ::= Plus
times ::= Times
cos ::= Cos
cosh ::= Cosh
acos ::= ArcCos
sin ::= Sin
sinh ::= Sinh
asin ::= ArcSin
tan ::= Tan
tanh ::= Tanh
atan ::= ArcTan
cot ::= Cot
coth ::= Coth
csc ::= Csc
csch ::= Csch
sec ::= Sec
sech ::= Sech
power ::= Power
minus ::= Minus
equal ::= Set
div ::= Divide
over ::= Divide
abs ::= Abs
bullet ::= Dot
log ::= Log

FrameConvert[st_] :=
	Block[ {FFFu}, FFFu = st;
		FFFu = FFFu //. char[e] -> E;
		FFFu = FFFu //. char[iota] -> I;
		FFFu = FFFu //. char[infty] -> Infinity;
		FFFu = FFFu //. char[pi] -> Pi;
		FFFu = FFFu //. prompt[] -> X;    (* missing input in Frame*)
		FFFu = FFFu //. id[x_] -> x;
		FFFu = FFFu //. num[x_,y_] -> x;
		FFFu = FFFu //. char[x_] -> x;
		(* Just an alias won't do for sqrt 
		       because we may have 1 or 2 params *)
		FFFu = FFFu //. sqrt[x_,p_:2] -> Power[x,1/p];
		(* FFFu = FFFu //. sum[f_,imin_:1,imax_:1] ->  Sum[f,{i,imin,imax}];   not done *)
		(* FFFu = FFFu //. prod[f_,imin_:1,imax_:1] -> Product[f,{i,imin,imax}];  not done *)
		FFFu = FFFu //. int[f_,x_] -> Integrate[f,x];
		FFFu = FFFu //. int[f_,x_,min_,max_] -> Integrate[f,{x,min,max}];
		FFFu = FFFu //. var[f_] -> Null;
		FFFu = FFFu //. lim[f_,l_] -> Limit[f,x->l];
		FFFu = FFFu //. cdot[x_,y_] -> Times[x,y];
		FFFu = FFFu //. lim[f_,l_] -> Limit[f,x->l];
		FFFu = FFFu //. function[optotal[x_,p_:1],f_] -> Derivative[p,x][f];
		FFFu = FFFu //. function[oppartial[x_],f_] -> D[f,x];
		FFFu = FFFu //. function[oppartial[x_,p_],f_] -> D[f,{x,p}];
				
		Print[InputForm[FFFu]];
		]
"Done Loading FrameMaker Input Functions"
