freeze;
 
/****-*-magma-* EXPORT DATE: 2004-03-08 ************************************
                                                                            
                     MODFORM: Modular Forms in MAGMA
 
                              William A. Stein        
                         
   FILE: creation.m

   $Header: /home/was/magma/packages/modform/code/RCS/input_output.m,v 1.1 2001/05/30 18:52:38 was Exp $

   $Log: input_output.m,v $
   Revision 1.1  2001/05/30 18:52:38  was
   Initial revision

      
 ***************************************************************************/

function PrintSideways(s)
   assert Type(s) in {SeqEnum, List};
   ans := "[";
   for i in [1..#s] do
      ans := ans*Sprintf("%o", s[i]);
      if i lt #s then
         ans := ans*", ";
      end if;
   end for;
   ans := ans*"]";
   return ans;
end function;

intrinsic HackobjPrintModFrm(M::ModFrm, level::MonStgElt)
   {}
   if IsRingOfAllModularForms(M) then
      printf "All modular forms over %o", BaseRing(M);
      return;
   end if;
   if IsGamma0(M) then
       printf "Space of modular forms on Gamma_0(%o) of weight %o and dimension %o over %o.", 
       Level(M), Weight(M), Dimension(M), BaseRing(M);
   elif IsGamma1(M) then
       printf "Space of modular forms on Gamma_1(%o) of weight %o and dimension %o over %o.", 
       Level(M), Weight(M), Dimension(M), BaseRing(M);
   else
       chars := DirichletCharacters(M);
       assert #chars gt 0;
       printf "Space of modular forms on Gamma_1(%o) with character%o all conjugates of %o, weight %o, and dimension %o over %o.", 
       Level(M), #chars eq 1 select "" else "s", PrintSideways(chars),  
           Weight(M), Dimension(M), BaseRing(M);
   end if;
end intrinsic;

intrinsic HackobjPrintModFrmElt(f::ModFrmElt, level::MonStgElt)
   {}
   printf "%o", PowerSeries(f);
end intrinsic;

intrinsic AssignNames(~M::ModFrm, s::[MonStgElt])
{}
   require #s eq 1 : "Number of names must be 1.";
   M`q_name := s[1];
end intrinsic;

intrinsic Name(M::ModFrm,i::RngIntElt) -> RngSerPowElt
   {Name the ith generator.}
   require i eq 1 : "Argument 2 must be 1";
   return PowerSeriesRing(BaseRing(M)).1;
end intrinsic;


/*
intrinsic Write(M::ModFrm, file::File)
{Write the space M of modular forms to the file.}
   error "Not written";
end intrinsic;

intrinsic ReadModFrm(file::File) -> ModFrm
{Read the next space of modular forms from the file.}
   error "Not written";
end intrinsic;

intrinsic Write(f::ModFrmElt, file::File)
{Write the modular form f to the file.}
   error "Not written";
end intrinsic;

intrinsic ReadModFrmElt(file::File) -> ModFrmElt
{Read the next modular form from the file.}
   error "Not written";
end intrinsic;

*/
