login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for reading structures from a file revision 1 of 1

1
Editor: page
Time: 2007/11/12 23:41:29 GMT-8
Note: transferred from axiom-developer.org

changed:
-
This package provides operations that all take a filename and return an axiom structure which is supposed to be in some standard notation in this file. Geared towards polymake. Needs 'StringConversions'

\begin{axiom}
)lib STRCNV
\end{axiom}

\begin{axiom}
)abbrev package READFILE ReadFile
ReadFile(): Exports == Implementation where
    Exports == with

      getBoolean: FileName -> Boolean

      getInteger: FileName -> Integer

      getFraction: FileName -> Fraction Integer

      getListInteger: FileName -> List Integer

      getListFraction: FileName -> List Fraction Integer

      getVectorInteger: FileName -> Vector Integer

      getVectorFraction: FileName -> Vector Fraction Integer

      getSetInteger: FileName -> Set Integer

      getMatrixInteger: FileName -> Matrix Integer

      getMatrixFraction: FileName -> Matrix Fraction Integer

      getListSetInteger: FileName -> List Set Integer

    Implementation == add

      getBoolean polytmpfile ==
        f := open(polytmpfile)$TextFile
        read!(f)$TextFile
        r:String := read!(f)$TextFile
        close!(f)$TextFile

        (r="1")

      getInteger polytmpfile ==
        f := open(polytmpfile)$TextFile
        read!(f)$TextFile
        r:String := read!(f)$TextFile
        close!(f)$TextFile

        coerce(r)$StringConversions

      getFraction polytmpfile ==
        f := open(polytmpfile)$TextFile
        read!(f)$TextFile
        r:String := read!(f)$TextFile
        close!(f)$TextFile

        coerce(r)$StringConversions

      getListInteger polytmpfile ==
        f := open(polytmpfile)$TextFile
        read!(f)$TextFile
        r:String := read!(f)$TextFile
        close!(f)$TextFile
        coerce(r)$StringConversions

      getListFraction polytmpfile ==
        f := open(polytmpfile)$TextFile
        read!(f)$TextFile
        r:String := read!(f)$TextFile
        close!(f)$TextFile
        coerce(r)$StringConversions

      getVectorInteger polytmpfile == 
        vector(getListInteger polytmpfile)$Vector(Integer)

      getVectorFraction polytmpfile == 
        vector(getListFraction polytmpfile)$Vector(Fraction Integer)

      getSetInteger polytmpfile == 
        f := open(polytmpfile)$TextFile
        read!(f)$TextFile
        r:String := read!(f)$TextFile
        close!(f)$TextFile
        coerce(r)$StringConversions

      getMatrixInteger polytmpfile ==
        f := open(polytmpfile)$TextFile
        read!(f)$TextFile
        m: List List Integer := []
        r: String
        while not endOfFile?(f) repeat
          r := read!(f)$TextFile
          if not empty? r then 
            m := cons(coerce(r)$StringConversions, m)

        close!(f)$TextFile
        matrix(reverse m)$Matrix(Integer)

      getMatrixFraction polytmpfile ==
        f := open(polytmpfile)$TextFile
        read!(f)$TextFile
        m: List List Fraction Integer := []
        r: String
        while not endOfFile?(f) repeat
          r := read!(f)$TextFile
          if not empty? r then 
            m := cons(coerce(r)$StringConversions, m)

        close!(f)$TextFile
        matrix(reverse m)$Matrix(Fraction Integer)

      getListSetInteger polytmpfile ==
        f := open(polytmpfile)$TextFile
        read!(f)$TextFile
        m: List Set Integer := []
        r: String
        while not endOfFile?(f) repeat
          r := read!(f)$TextFile
          if not empty? r then 
            m := cons(coerce(r)$StringConversions, m)

        close!(f)$TextFile
        reverse m
\end{axiom}

This package provides operations that all take a filename and return an axiom structure which is supposed to be in some standard notation in this file. Geared towards polymake. Needs StringConversions

fricas
(1) -> )lib STRCNV
StringConversions is now explicitly exposed in frame initial StringConversions will be automatically loaded when needed from /var/aw/var/LatexWiki/STRCNV.NRLIB/STRCNV

fricas
)abbrev package READFILE ReadFile
ReadFile(): Exports == Implementation where
    Exports == with
getBoolean: FileName -> Boolean
getInteger: FileName -> Integer
getFraction: FileName -> Fraction Integer
getListInteger: FileName -> List Integer
getListFraction: FileName -> List Fraction Integer
getVectorInteger: FileName -> Vector Integer
getVectorFraction: FileName -> Vector Fraction Integer
getSetInteger: FileName -> Set Integer
getMatrixInteger: FileName -> Matrix Integer
getMatrixFraction: FileName -> Matrix Fraction Integer
getListSetInteger: FileName -> List Set Integer
Implementation == add
getBoolean polytmpfile == f := open(polytmpfile)$TextFile read!(f)$TextFile r:String := read!(f)$TextFile close!(f)$TextFile
(r="1")
getInteger polytmpfile == f := open(polytmpfile)$TextFile read!(f)$TextFile r:String := read!(f)$TextFile close!(f)$TextFile
coerce(r)$StringConversions
getFraction polytmpfile == f := open(polytmpfile)$TextFile read!(f)$TextFile r:String := read!(f)$TextFile close!(f)$TextFile
coerce(r)$StringConversions
getListInteger polytmpfile == f := open(polytmpfile)$TextFile read!(f)$TextFile r:String := read!(f)$TextFile close!(f)$TextFile coerce(r)$StringConversions
getListFraction polytmpfile == f := open(polytmpfile)$TextFile read!(f)$TextFile r:String := read!(f)$TextFile close!(f)$TextFile coerce(r)$StringConversions
getVectorInteger polytmpfile == vector(getListInteger polytmpfile)$Vector(Integer)
getVectorFraction polytmpfile == vector(getListFraction polytmpfile)$Vector(Fraction Integer)
getSetInteger polytmpfile == f := open(polytmpfile)$TextFile read!(f)$TextFile r:String := read!(f)$TextFile close!(f)$TextFile coerce(r)$StringConversions
getMatrixInteger polytmpfile == f := open(polytmpfile)$TextFile read!(f)$TextFile m: List List Integer := [] r: String while not endOfFile?(f) repeat r := read!(f)$TextFile if not empty? r then m := cons(coerce(r)$StringConversions, m)
close!(f)$TextFile matrix(reverse m)$Matrix(Integer)
getMatrixFraction polytmpfile == f := open(polytmpfile)$TextFile read!(f)$TextFile m: List List Fraction Integer := [] r: String while not endOfFile?(f) repeat r := read!(f)$TextFile if not empty? r then m := cons(coerce(r)$StringConversions, m)
close!(f)$TextFile matrix(reverse m)$Matrix(Fraction Integer)
getListSetInteger polytmpfile == f := open(polytmpfile)$TextFile read!(f)$TextFile m: List Set Integer := [] r: String while not endOfFile?(f) repeat r := read!(f)$TextFile if not empty? r then m := cons(coerce(r)$StringConversions, m)
close!(f)$TextFile reverse m
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7130290122364710480-25px.002.spad
      using old system compiler.
   READFILE abbreviates package ReadFile 
------------------------------------------------------------------------
   initializing NRLIB READFILE for ReadFile 
   compiling into NRLIB READFILE 
   compiling exported getBoolean : FileName -> Boolean
Time: 0 SEC.
compiling exported getInteger : FileName -> Integer Time: 0 SEC.
compiling exported getFraction : FileName -> Fraction Integer Time: 0 SEC.
compiling exported getListInteger : FileName -> List Integer Time: 0 SEC.
compiling exported getListFraction : FileName -> List Fraction Integer Time: 0 SEC.
compiling exported getVectorInteger : FileName -> Vector Integer Time: 0 SEC.
compiling exported getVectorFraction : FileName -> Vector Fraction Integer Time: 0.01 SEC.
compiling exported getSetInteger : FileName -> Set Integer Time: 0 SEC.
compiling exported getMatrixInteger : FileName -> Matrix Integer Time: 0 SEC.
compiling exported getMatrixFraction : FileName -> Matrix Fraction Integer Time: 0 SEC.
compiling exported getListSetInteger : FileName -> List Set Integer Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |ReadFile| REDEFINED
;;; *** |ReadFile| REDEFINED Time: 0 SEC.
Warnings: [1] getMatrixInteger: m has no value [2] getMatrixFraction: m has no value [3] getListSetInteger: m has no value
Cumulative Statistics for Constructor ReadFile Time: 0.04 seconds
finalizing NRLIB READFILE Processing ReadFile for Browser database: --->-->ReadFile(constructor): Not documented!!!! --->-->ReadFile((getBoolean ((Boolean) (FileName)))): Not documented!!!! --->-->ReadFile((getInteger ((Integer) (FileName)))): Not documented!!!! --->-->ReadFile((getFraction ((Fraction (Integer)) (FileName)))): Not documented!!!! --->-->ReadFile((getListInteger ((List (Integer)) (FileName)))): Not documented!!!! --->-->ReadFile((getListFraction ((List (Fraction (Integer))) (FileName)))): Not documented!!!! --->-->ReadFile((getVectorInteger ((Vector (Integer)) (FileName)))): Not documented!!!! --->-->ReadFile((getVectorFraction ((Vector (Fraction (Integer))) (FileName)))): Not documented!!!! --->-->ReadFile((getSetInteger ((Set (Integer)) (FileName)))): Not documented!!!! --->-->ReadFile((getMatrixInteger ((Matrix (Integer)) (FileName)))): Not documented!!!! --->-->ReadFile((getMatrixFraction ((Matrix (Fraction (Integer))) (FileName)))): Not documented!!!! --->-->ReadFile((getListSetInteger ((List (Set (Integer))) (FileName)))): Not documented!!!! --->-->ReadFile(): Missing Description ; compiling file "/var/aw/var/LatexWiki/READFILE.NRLIB/READFILE.lsp" (written 25 NOV 2024 11:08:48 PM):
; wrote /var/aw/var/LatexWiki/READFILE.NRLIB/READFILE.fasl ; compilation finished in 0:00:00.024 ------------------------------------------------------------------------ ReadFile is now explicitly exposed in frame initial ReadFile will be automatically loaded when needed from /var/aw/var/LatexWiki/READFILE.NRLIB/READFILE