[BACK]Return to convert_formats.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Main

Annotation of OpenXM_contrib/PHC/Ada/Main/convert_formats.adb, Revision 1.1.1.1

1.1       maekawa     1: with text_io;                            use text_io;
                      2: with Communications_with_User;           use Communications_with_User;
                      3: with Standard_Complex_Poly_Systems;      use Standard_Complex_Poly_Systems;
                      4: with Standard_Complex_Poly_Systems_io;   use Standard_Complex_Poly_Systems_io;
                      5: with Tableau_Formats;
                      6:
                      7: procedure convert_formats is
                      8:
                      9: -- DESCRIPTION :
                     10: --   This program allows to convert between formats of polynomial systems.
                     11: --
                     12: -- SYMBOLIC FORMAT :
                     13: --
                     14: --   2
                     15: --    x*y**2 - x**2 + 3;
                     16: --    x + 2;
                     17: --
                     18: -- TABLEAU FORMAT :
                     19: --
                     20: --   2
                     21: --    x y
                     22: --   3
                     23: --    1 2
                     24: --    2 0
                     25: --    0 0
                     26: --  2
                     27: --    1 0
                     28: --    0 0
                     29: --    1.0 0.0
                     30: --   -1.0 0.0
                     31: --    3.0 0.0
                     32: --    1.0 0.0
                     33: --    2.0 0.0
                     34:
                     35:   procedure Tableau_to_Symbolic ( infile,outfile : in file_type;
                     36:                                   flt : in boolean ) is
                     37:
                     38:     lp : Link_to_Poly_Sys;
                     39:
                     40:   begin
                     41:     Tableau_Formats.get(infile,flt,lp);
                     42:     put(outfile,lp'last,lp.all);
                     43:   end Tableau_to_Symbolic;
                     44:
                     45:   procedure Symbolic_to_Tableau ( infile,outfile : in file_type;
                     46:                                   flt : in boolean ) is
                     47:
                     48:     lp : Link_to_Poly_Sys;
                     49:
                     50:   begin
                     51:     get(infile,lp);
                     52:     Tableau_Formats.put(outfile,flt,lp.all);
                     53:   end Symbolic_to_Tableau;
                     54:
                     55:   procedure Main is
                     56:
                     57:     infile,outfile : file_type;
                     58:     ans : character;
                     59:     flt,sym2tab : boolean;
                     60:     lp : Link_to_Poly_Sys;
                     61:
                     62:   begin
                     63:     new_line;
                     64:     put_line("Conversion between symbolic and tableau formats.");
                     65:     new_line;
                     66:     put_line("Choose one of the following : ");
                     67:     put_line("  1. Convert from symbolic to tableau format");
                     68:     put_line("  2. Convert from tableau to symbolic format");
                     69:     put("Type 1 or 2 to select : "); Ask_Alternative(ans,"12");
                     70:     sym2tab := (ans = '1');
                     71:     new_line;
                     72:     put_line("Reading the name of the input file.");
                     73:     Read_Name_and_Open_File(infile);
                     74:     new_line;
                     75:     put_line("Reading the name of the output file.");
                     76:     Read_Name_and_Create_File(outfile);
                     77:     new_line;
                     78:     put("Are the coefficients real or complex ? (r/c) ");
                     79:     Ask_Alternative(ans,"rc");
                     80:     flt := (ans = 'r');
                     81:     if sym2tab
                     82:      then Symbolic_to_Tableau(infile,outfile,flt);
                     83:      else Tableau_to_Symbolic(infile,outfile,flt);
                     84:     end if;
                     85:   end Main;
                     86:
                     87: begin
                     88:   Main;
                     89: end convert_formats;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>