Aelve Codesearch

grep over package repositories
Please provide a string to search for.
3+ characters are required.
Index updated about a month ago

total matches: more than 1000

3dmodels-0.3.0
9 matches
Graphics/Model/DirectX.hs
reverseHand :: XOF -> XOF
reverseHand xof@XOF{_xofMesh=DxMesh{..}, ..} =
	xof { _xofMesh = (_xofMesh xof) {
		_dxVertices = fmap rhVtx _dxVertices,
		_dxFaces = fmap rhFace _dxFaces,
		_dxNormals = fmap rhVtx _dxNormals,
		_dxNormalIndexes = fmap rhFace _dxNormalIndexes
	}}
	where rhVtx (V3 x y z) = V3 x y (-z)
	      rhFace (Right (V3 a b c)) = Right $ V3 b a c
	      rhFace (Left (V4 a b c d)) = Left $ V4 a d c b


            
Graphics/Model/DirectX.hs
		<$> option [] meshTextureCoords <* skipSpace
		<*> option [] meshVertexColors <* skipSpace

meshFace = fmap Left meshFace4 <|> fmap Right meshFace3
meshFace4 = do
	char '4' >> semicolon
	sequenceA $ V4 (decimal <* comma) (decimal <* comma)
		(decimal <* comma) (decimal <* char ';')
meshFace3 = do

            
Graphics/Model/DirectX.hs
meshVertexColors = section "MeshVertexColors" $
	getIntField >>= getArray indexedColor

indexedColor = (,) <$> fmap fromIntegral getIntField <*> getVector


            
Graphics/Model/MikuMikuDance/Loader.hs
ltrTrans (V3 x y z) = V3 x y (-z)
ltrEular (V3 x y z) = V3 (-x) (-y) z
ltrQuat (V4 t i j k) = V4 (-t) i j k
getPos = fmap ltrTrans getV3
getEular = fmap ltrEular getV3
getQuat = fmap ltrQuat getV4


-- * PMX

loadMMD :: FilePath -> IO MMD 

            
Graphics/Model/MikuMikuDance/Loader.hs
		-- 0:Base, 1:Brow, 2: Eye, 3: Lip, 4:Other
		-- XXX 'base' should be ignored (0,0,0)???
		vMorph <- replicateM numVertices $
			VertexMorph <$> fmap fromIntegral getWord32LE <*> getPos
		return $ MMDMorph name "" facial vMorph
		
	faceListLen <- getWord8Int
	faceList <- replicateM faceListLen getMorphIndex


            
Graphics/Model/MikuMikuDance/Loader.hs
	let root = "R\NULo\NULo\NULt\NUL"
	let rootGroup = MMDGroup root root True [Left 0]
	let faceGroup = MMDGroup "h\136\197`" "E\NULx\NULp\NUL" True
			(map Right faceList)
	let groups = rootGroup : faceGroup :
		zipWith3 (\i j e ->
			MMDGroup j e False $
				map (Left . fst) $
					filter ((== i).snd) groupedBones
		) [1..] boneGroups bGsEn
		-- group 0 ('center') is reserved for the root bone
	
	-- toon texture list since MMD 4.03

            
Graphics/Model/MikuMikuDance/Types.hs
	, mSpecular :: V3 Float -- ^ RGB
	, mSpecularFactor :: Float
	, mAmbient :: V3 Float -- ^ RGB
	-- | 1:cullface=both, 2:drop shadow, 4:render to self shadow map,
	-- 8:render to self shadow, 16:draw edges,
	-- /Since 2.1/ => 32:vertex color, 64:As Points, 128:As Lines
	, mOptions :: Word8
	, mEdgeColor :: V4 Float -- ^ RGBA
	-- | /Since 2.1/ Point size (See mOptions)

            
Graphics/Model/Obj.hs
	normals <- many (parseVn <* comments)
	mtl2 <- optional parseUsemtl <* comments
	faces <- many (parseF <* comments)
	let mtl = fmap (path,) (maybe mtl2 Just mtl1)
	return $ ObjMesh group mtl vertices uvs normals faces

getString, parseMtllib, parseG, parseUsemtl :: Parser String
getString = many1 (satisfy (/= '\n'))
parseMtllib = string "mtllib " >> getString

            
Graphics/Model/Obj.hs
	diff <- string "Kd" >> float3 <* comments
	spec <- string "Ks" >> float3 <* comments
	shine <- string "Ns " >> float
	-- XXX map_Kd
	return $ ObjMaterial mtl amb diff spec shine


            
AC-PPM-1.1.1
4 matches
Codec/PPM/Binary.hs
-}
stringPPM :: (Integer,Integer) -> [(Word8,Word8,Word8)] -> BIN.ByteString
stringPPM (sx,sy) ps =
  BIN.pack (map (fromIntegral . fromEnum) $ "P6\n" ++ show sx ++ " " ++ show sy ++ "\n255\n") `BIN.append`
  BIN.concat (map (\(r,g,b) -> BIN.pack [r,g,b]) ps)

{-|
  Convenience function: Generate PPM data and write it to the
  specified 'Handle'. The handle is not closed or flushed afterwards.
  This allows writing PPM data to network streams, etc. This function

            
Codec/PPM/Binary.hs
  other PPM functions.
-}
fn_list :: ((Integer,Integer) -> (Word8,Word8,Word8)) -> (Integer, Integer) -> [(Word8,Word8,Word8)]
fn_list fn (sx, sy) = map fn [ (x,y) | y <- [0..sy-1], x <- [0..sx-1] ]

            
Codec/PPM/Text.hs
stringPPM :: (Integer,Integer) -> [(Word8,Word8,Word8)] -> TXT.ByteString
stringPPM (sx,sy) ps =
  TXT.pack ("P3\n" ++ show sx ++ " " ++ show sy ++ "\n255\n") `TXT.append`
  TXT.unlines (map (\(r,g,b) -> TXT.pack $ unwords [show r, show g,show b]) ps)

{-|
  Convenience function: Generate PPM data and write it to the
  specified 'Handle'. The handle is not closed or flushed afterwards.
  This allows writing PPM data to network streams, etc. This function

            
Codec/PPM/Text.hs
  other PPM functions.
-}
fn_list :: ((Integer,Integer) -> (Word8,Word8,Word8)) -> (Integer, Integer) -> [(Word8,Word8,Word8)]
fn_list fn (sx, sy) = map fn [ (x,y) | y <- [0..sy-1], x <- [0..sx-1] ]

            
AES-0.2.9
2 matches
Codec/Crypto/AES/Monad.hs
    return crypted

instance Cryptable BL.ByteString where
  crypt (BL.toChunks -> chunks) = snd <$> listen (mapM_ crypt chunks)

            
Codec/Crypto/AES/Random.hs
  where gen = unsafeInterleaveIO $ do
          bytes <- prandBytes 64
          let chunks = unfoldr (\b -> if B.null b then Nothing else Just (B.splitAt intSizeInBinary b)) bytes
              ints = map ((\(Right i) -> i) . decode) chunks
          moreInts <- gen
          return (ints ++ moreInts)

            
AMI-0.1
1 matches
Network/AMI.hs
    formatParams $ [("Action", name), ("ActionID", packID i)] ++ ps

formatParams :: Parameters -> B.ByteString
formatParams pairs = B.intercalate "\r\n" $ map one pairs
  where
    one (k,v) = k `B.append` ": " `B.append` v


            
Agda-2.6.0.1
14 matches
src/full/Agda/Interaction/Highlighting/JSON.hs
-- | Encode meta information into a JSON Value
showAspects
  :: ModuleToSource
     -- ^ Must contain a mapping for the definition site's module, if any.
  -> (Range, Aspects) -> Value
showAspects modFile (range, aspect) = object
  [ "range" .= [from range, to range]
  , "atoms" .= toAtoms aspect
  , "tokenBased" .= tokenBased aspect

            
src/full/Agda/Interaction/Highlighting/JSON.hs
  , "atoms" .= toAtoms aspect
  , "tokenBased" .= tokenBased aspect
  , "note" .= note aspect
  , "definitionSite" .= fmap defSite (definitionSite aspect)
  ]
  where
    defSite (DefinitionSite mdl position _ _) = object
      [ "filepath" .= filePath (Map.findWithDefault __IMPOSSIBLE__ mdl modFile)
      , "position" .= position

            
src/full/Agda/Interaction/Highlighting/JSON.hs
  -> RemoveTokenBasedHighlighting
  -> HighlightingMethod
  -> ModuleToSource
     -- ^ Must contain a mapping for every definition site's module.
  -> IO Value
jsonifyHighlightingInfo info remove method modFile =
  case chooseHighlightingMethod info method of
    Direct   -> direct
    Indirect -> indirect

            
src/full/Agda/Interaction/Highlighting/JSON.hs
      [ "remove" .= case remove of
          RemoveHighlighting -> True
          KeepHighlighting -> False
      , "payload" .= map (showAspects modFile) (ranges info)
      ]

    direct :: IO Value
    direct = return $ object
      [ "kind"   .= String "HighlightingInfo"

            
src/full/Agda/Interaction/Highlighting/LaTeX.hs
-- with spaces.

replaceSpaces :: Text -> Text
replaceSpaces = T.map (\c -> if isSpaceNotNewline c then ' ' else c)


-- | If the `Token` consists of spaces, the internal column counter is advanced
--   by the length of the token. Otherwise, `moveColumnForToken` is a no-op.
moveColumnForToken :: Token -> LaTeX ()

            
src/full/Agda/Interaction/Highlighting/LaTeX.hs
-- * Output generation from a stream of labelled tokens.

processLayers :: [(LayerRole, Tokens)] -> LaTeX ()
processLayers = mapM_ $ \(layerRole,toks) -> do
  case layerRole of
    L.Markup  -> processMarkup  toks
    L.Comment -> processComment toks
    L.Code    -> processCode    toks


            
src/full/Agda/Interaction/Highlighting/LaTeX.hs
processMarkup, processComment, processCode :: Tokens -> LaTeX ()

-- | Deals with markup, which is output verbatim.
processMarkup = mapM_ $ \t -> do
  moveColumnForToken t
  output (Text (text t))

-- | Deals with literate text, which is output verbatim
processComment = mapM_ $ \t -> do

            
src/full/Agda/Interaction/Highlighting/LaTeX.hs
  output (Text (text t))

-- | Deals with literate text, which is output verbatim
processComment = mapM_ $ \t -> do
  unless ("%" == T.take 1 (T.stripStart (text t))) $ do
    moveColumnForToken t
  output (Text (text t))

-- | Deals with code blocks. Every token, except spaces, is pretty

            
src/full/Agda/Interaction/Highlighting/LaTeX.hs
processCode toks' = do
  output $ Text nl
  enterCode
  mapM_ go toks'
  ptOpenWhenColumnZero =<< gets column
  output $ Text $ ptClose <+> nl
  leaveCode

  where

            
src/full/Agda/Interaction/Highlighting/LaTeX.hs
            -- to its aspect (if any) and other aspects (e.g. error, unsolved meta)
            foldr (\c t -> cmdPrefix <+> T.pack c <+> cmdArg t)
                  (escape tok)
                  $ map fromOtherAspect (toList $ otherAspects $ info tok') ++
                    concatMap fromAspect (toList $ aspect $ info tok')

    -- Non-whitespace tokens at the start of a line trigger an
    -- alignment column.
    ptOpenWhenColumnZero col =

            
src/full/Agda/Interaction/Highlighting/LaTeX.hs
-- properly
stringLiteral :: Token -> Tokens
stringLiteral t | aspect (info t) == Just String =
  map (\ x -> t { text = x })
          $ concatMap leadingSpaces
          $ List.intersperse "\n"
          $ T.lines (text t)
  where
  leadingSpaces :: Text -> [Text]

            
src/full/Agda/Interaction/Highlighting/LaTeX.hs
  inAbsPath <- liftM filePath (Find.findFile mod)

  liftIO $ do
    latex <- E.encodeUtf8 `fmap`
               toLaTeX (O.optCountClusters $ O.optPragmaOptions options)
                       (mkAbsolute inAbsPath) (iSource i) hi
    createDirectoryIfMissing True $ dir </> takeDirectory outPath
    BS.writeFile (dir </> outPath) latex


            
src/full/Agda/Interaction/Highlighting/LaTeX.hs

groupByFst :: forall a b. Eq a => [(a,b)] -> [(a,[b])]
groupByFst =
    map (\xs -> case xs of                     -- Float the grouping to the top level
          []           -> __IMPOSSIBLE__
          (tag, _): _ -> (tag, map snd xs))

  . List.groupBy ((==) `on` fst)  -- Group together characters in the same
                                  -- role.

-- | Transforms the source code into LaTeX.

            
src/full/Agda/Interaction/Highlighting/LaTeX.hs

  = processTokens cc

  . map (\(role, tokens) -> (role,) $
      -- This bit fixes issue 954
      (if L.isCode role then
        -- Remove trailing whitespace from the
        -- final line; the function spaces
        -- expects trailing whitespace to be