packages feed

ply-loader 0.3.1 → 0.4

raw patch · 5 files changed

+29/−29 lines, 5 filesdep ~attoparsecPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: attoparsec

API changes (from Hackage documentation)

Files

ply-loader.cabal view
@@ -1,5 +1,5 @@ name:                ply-loader-version:             0.3.1+version:             0.4 synopsis:            PLY file loader.  description:         PLY is a lightweight file format for representing 3D@@ -35,8 +35,8 @@   exposed-modules:     PLY, PLY.Ascii, PLY.Binary, PLY.Conf, PLY.Types,                        PLY.Internal.Parsers, PLY.Internal.StrictReplicate                        -  build-depends:       base >= 4.6 && < 5, -                       attoparsec >= 0.10, +  build-depends:       base >= 4.6 && < 5,+                       attoparsec >= 0.12.0.0,                        bytestring >= 0.10,                        linear >= 0.2,                        lens >= 3.0,
src/PLY.hs view
@@ -28,13 +28,12 @@ import Control.Concurrent.ParallelIO (parallel) import Control.Monad ((>=>)) import Control.Monad.Trans.Error-import Data.Attoparsec.Char8+import Data.Attoparsec.ByteString.Char8 import Data.ByteString (ByteString) import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as BC import Data.Either (partitionEithers) import Data.Vector (Vector)-import qualified Data.Vector as VB import qualified Data.Vector.Storable as VS import Linear import System.Directory (canonicalizePath)
src/PLY/Ascii.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE ScopedTypeVariables #-} module PLY.Ascii where import Control.Applicative-import Data.Attoparsec.Char8+import Data.Attoparsec.ByteString.Char8 import Data.Vector (Vector) import qualified Data.Vector as V import qualified Data.Vector.Storable as VS
src/PLY/Conf.hs view
@@ -3,7 +3,7 @@ -- individual PLY models into a consistent coordinate frame. module PLY.Conf (parseConf, Transformation, Conf(..)) where import Control.Applicative-import Data.Attoparsec.Char8+import Data.Attoparsec.ByteString.Char8 import Data.ByteString (ByteString) import Linear.V3 import Linear.Quaternion@@ -31,13 +31,13 @@  -- |Parse a mesh file specification. mesh :: Fractional a => Parser (ByteString, Transformation a)-mesh = (,) <$> ("bmesh " .*> word) <*> transformation+mesh = (,) <$> ("bmesh " *> word) <*> transformation  -- |Parser for a Stanford .conf file. conf :: Fractional a => Parser (Conf a)-conf = Conf <$> ("camera " .*> transformation <* skipSpace)+conf = Conf <$> ("camera " *> transformation <* skipSpace)             <*> (skipSpace *> cybmesh *> many1 (skipSpace *> mesh))-  where cybmesh = skipMany ("mesh " .*> line) -- Not a PLY file!+  where cybmesh = skipMany ("mesh " *> line) -- Not a PLY file!  -- |Parse a Stanford .conf file. parseConf :: Fractional a => ByteString -> Either String (Conf a)
src/PLY/Internal/Parsers.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings, BangPatterns #-} module PLY.Internal.Parsers where import Control.Applicative-import Data.Attoparsec.Char8 hiding (char)+import Data.Attoparsec.ByteString.Char8 hiding (char) import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as BC import PLY.Types@@ -13,10 +13,10 @@  -- |Parse a PLY file format line format :: Parser Format-format = "format" .*> skipSpace *> (ascii <|> le <|> be)-  where ascii = "ascii 1.0" .*> pure ASCII-        le = "binary_little_endian 1.0" .*> pure Binary_LE-        be = "binary_big_endian 1.0" .*> pure Binary_BE+format = "format" *> skipSpace *> (ascii <|> le <|> be)+  where ascii = "ascii 1.0" *> pure ASCII+        le = "binary_little_endian 1.0" *> pure Binary_LE+        be = "binary_big_endian 1.0" *> pure Binary_BE  -- * Numeric type parsers @@ -46,25 +46,25 @@ line = BC.pack <$> manyTill anyChar endOfLine  scalarProperty :: Parser Property-scalarProperty = ScalarProperty <$> ("property " .*> scalarType) <*> line+scalarProperty = ScalarProperty <$> ("property " *> scalarType) <*> line  scalarType :: Parser ScalarT scalarType = choice $-             [ "char "   .*> pure Tchar-             , "uchar "  .*> pure Tuchar-             , "short "  .*> pure Tshort-             , "ushort " .*> pure Tushort-             , "int "    .*> pure Tint-             , "uint "   .*> pure Tuint-             , "float "  .*> pure Tfloat-             , "double " .*> pure Tdouble ]+             [ "char "   *> pure Tchar+             , "uchar "  *> pure Tuchar+             , "short "  *> pure Tshort+             , "ushort " *> pure Tushort+             , "int "    *> pure Tint+             , "uint "   *> pure Tuint+             , "float "  *> pure Tfloat+             , "double " *> pure Tdouble ]  -- |Take the next white space-delimited word. word :: Parser ByteString word = skipSpace *> takeTill isSpace <* skipSpace  listProperty :: Parser Property-listProperty = ListProperty <$> ("property list " .*> word *> scalarType)+listProperty = ListProperty <$> ("property list " *> word *> scalarType)                             <*> line  -- |Parse a monotyped list of values. All returned 'Scalar' values@@ -76,7 +76,7 @@ property = skip *> (scalarProperty <|> listProperty)  element :: Parser Element-element = Element <$> ("element " .*> takeTill isSpace) +element = Element <$> ("element " *> takeTill isSpace)                   <*> (skipSpace *> int <* skipSpace)                   <*> many1 property @@ -97,15 +97,16 @@         go acc (ScalarProperty t _:ps) = do !x <- parseScalar t                                             skipSpace                                             go (x:acc) ps-        go _ (ListProperty t _:_) = int <* skipSpace >>= flip count (parseScalar t)+        go _ (ListProperty t _:_) = int <* skipSpace+                                    >>= flip count (parseScalar t <* skipSpace)  -- FIXME: Support for list properties assumes that an element will not -- have any other properties if it has a list property!  -- |Parse a PLY header. header :: Parser (Format, [Element])-header = (,) <$> preamble <*> elements <*. "end_header" <* endOfLine-  where preamble = "ply" .*> skip *> format+header = (,) <$> preamble <*> elements <* "end_header" <* endOfLine+  where preamble = "ply" *> skip *> format         elements = many1 (skip *> element <* skipSpace)  -- |Advance a 'ByteString' to where a given 'Parser' finishes. An