Permalink
Browse files

Massive code base reorganization.

Moved everything used only by the roshask executable into
src/executable, and stripped off the module path prefix
(i.e. Ros.Core.Msg).

Simplifed the directory structure underneath Ros.

Renamed "Core" to "Internal" everywhere. The word "Core" was
unfortunate as it suggested a relationship with roscore.
  • Loading branch information...
1 parent 370d81a commit eb4c3964e4c5c0e0fc3defcaafa4b6fac649edb4 Anthony Cowley committed Feb 12, 2013
Showing with 179 additions and 171 deletions.
  1. +1 −1 Examples/NodeCompose/Setup.hs
  2. +1 −1 Examples/PubSub/Setup.hs
  3. +1 −1 Examples/Turtle/Setup.hs
  4. +4 −4 Tests/TopicInterp.hs
  5. +24 −24 roshask.cabal
  6. +1 −1 src/Ros/BinaryIter.hs
  7. +0 −5 src/Ros/Core/Msg/MsgInfo.hs
  8. +5 −5 src/Ros/{Core/Build → Internal}/DepFinder.hs
  9. +4 −4 src/Ros/{Core → Internal}/Header.hs
  10. +5 −5 src/Ros/{Core → Internal}/Log.hs
  11. +3 −3 src/Ros/{Core → Internal}/Msg/HeaderSupport.hs
  12. +5 −0 src/Ros/Internal/Msg/MsgInfo.hs
  13. +1 −1 src/Ros/{Core → Internal}/PathUtil.hs
  14. +3 −3 src/Ros/{Core → Internal}/RosBinary.hs
  15. +3 −3 src/Ros/{Core → Internal}/RosTime.hs
  16. +3 −2 src/Ros/{Core → Internal}/RosTypes.hs
  17. +2 −2 src/Ros/{Core/Build → Internal}/SetupUtil.hs
  18. +1 −1 src/Ros/{Core → Internal}/Util/AppConfig.hs
  19. +2 −2 src/Ros/{Core → Internal}/Util/ArgRemapping.hs
  20. +3 −3 src/Ros/{Core → Internal}/Util/BytesToVector.hs
  21. +3 −2 src/Ros/{Core → Internal}/Util/RingChan.hs
  22. +2 −1 src/Ros/{Core → Internal}/Util/StorableMonad.hs
  23. +6 −5 src/Ros/Logging.hs
  24. +1 −1 src/Ros/MasterAPI.hs
  25. +10 −9 src/Ros/Node.hs
  26. +3 −3 src/Ros/NodeType.hs
  27. +1 −1 src/Ros/ParameterServerAPI.hs
  28. +6 −5 src/Ros/RosTcp.hs
  29. +2 −2 src/Ros/RunNode.hs
  30. +1 −1 src/Ros/SlaveAPI.hs
  31. +3 −3 src/Ros/TopicStamped.hs
  32. +1 −1 src/Ros/TopicStats.hs
  33. +6 −7 src/{Ros/Core/Msg → executable}/Analysis.hs
  34. +5 −5 src/{Ros/Core/Msg → executable}/FieldImports.hs
  35. +9 −10 src/{Ros/Core/Msg → executable}/Gen.hs
  36. +3 −3 src/{Ros/Core/Msg → executable}/Instances/Binary.hs
  37. +2 −2 src/{Ros/Core/Msg → executable}/Instances/NFData.hs
  38. +4 −4 src/{Ros/Core/Msg → executable}/Instances/Storable.hs
  39. +4 −4 src/{Ros/Core/Msg → executable}/MD5.hs
  40. +11 −10 src/{Ros/Core/Msg → executable}/Main.hs
  41. +2 −2 src/{Ros/Core/Msg → executable}/Parse.hs
  42. +12 −10 src/{Ros/Core/Msg → executable}/PkgBuilder.hs
  43. +4 −3 src/{Ros/Core/Build/Init.hs → executable/PkgInit.hs}
  44. +2 −2 src/{Ros/Core/Msg → executable}/ResolutionTypes.hs
  45. +2 −2 src/{Ros/Core/Msg → executable}/Test.hs
  46. +1 −1 src/{Ros/Core/Msg → executable}/Types.hs
  47. +1 −1 src/{Ros/Core/Msg → executable}/Unregister.hs
@@ -1,5 +1,5 @@
import Distribution.Simple
-import Ros.Core.Build.SetupUtil
+import Ros.Internal.SetupUtil
main = defaultMainWithHooks $
simpleUserHooks { confHook = rosConf }
View
@@ -1,5 +1,5 @@
import Distribution.Simple
-import Ros.Core.Build.SetupUtil
+import Ros.Internal.SetupUtil
main = defaultMainWithHooks $
simpleUserHooks { confHook = rosConf }
View
@@ -1,5 +1,5 @@
import Distribution.Simple
-import Ros.Core.Build.SetupUtil
+import Ros.Internal.SetupUtil
main = defaultMainWithHooks $
simpleUserHooks { confHook = rosConf }
View
@@ -4,10 +4,10 @@ import Control.Concurrent
import Ros.Topic
import Ros.TopicUtil (forkTopic)
import Ros.TopicStamped
-import Ros.Core.Header
-import qualified Ros.Core.Header as H
-import Ros.Core.Msg.HeaderSupport
-import Ros.Core.RosTime
+import Ros.Internal.Header
+import qualified Ros.Internal.Header as H
+import Ros.Internal.Msg.HeaderSupport
+import Ros.Internal.RosTime
newtype CharMsg = CharMsg {unCM :: (Char, Header)}
View
@@ -1,5 +1,5 @@
Name: roshask
-Version: 0.1.1
+Version: 0.1.2
Synopsis: Haskell support for the ROS robotics framework.
License: BSD3
License-file: LICENSE
@@ -77,22 +77,22 @@ Library
Ros.TopicMT
Ros.TopicStamped
Ros.Rate
- Ros.Core.Msg.MsgInfo
- Ros.Core.Msg.HeaderSupport
- Ros.Core.Util.BytesToVector
- Ros.Core.Util.StorableMonad
- Ros.Core.RosTime
- Ros.Core.RosTypes
- Ros.Core.RosBinary
- Ros.Core.Build.SetupUtil
- Ros.Core.PathUtil
+ Ros.Internal.Msg.MsgInfo
+ Ros.Internal.Msg.HeaderSupport
+ Ros.Internal.Util.BytesToVector
+ Ros.Internal.Util.StorableMonad
+ Ros.Internal.RosTime
+ Ros.Internal.RosTypes
+ Ros.Internal.RosBinary
+ Ros.Internal.SetupUtil
+ Ros.Internal.PathUtil
Ros.Util.PID
-- The Log and Header message types must be generated by a
-- bootstrapped roshask.
if flag(logging)
Exposed-modules: Ros.Logging
- Other-modules: Ros.Core.Log Ros.Core.Header
+ Other-modules: Ros.Internal.Log Ros.Internal.Header
Build-depends: template-haskell
-- Packages needed in order to build this package.
@@ -128,11 +128,12 @@ Library
-- Modules not exported by this package.
Other-modules: Ros.MasterAPI Ros.SlaveAPI Ros.ParameterServerAPI
- Ros.NodeType Ros.RunNode
+ Ros.NodeType Ros.RunNode Ros.BinaryIter
Ros.RosTcp Ros.ConnectionHeader Ros.TopicStats
- Ros.BinaryIter Ros.Core.Util.RingChan
- Ros.Core.Util.ArgRemapping Ros.Core.Build.DepFinder
- Ros.Core.Util.AppConfig
+ Ros.Internal.Util.RingChan
+ Ros.Internal.Util.ArgRemapping
+ Ros.Internal.DepFinder
+ Ros.Internal.Util.AppConfig
Paths_roshask
-- The ROS .msg definition parser and Haskell code generation utility.
@@ -151,12 +152,11 @@ Executable roshask
pureMD5 >= 2.1,
filemanip > 0.3.6
- GHC-Options: -Odph -Wall -fno-warn-name-shadowing -fno-warn-duplicate-exports
- Main-Is: Ros/Core/Msg/Main.hs
- Other-modules: Ros.Core.Msg.Parse Ros.Core.Msg.Gen Ros.Core.Msg.Analysis
- Ros.Core.Msg.ResolutionTypes Ros.Core.Msg.MD5
- Ros.Core.Build.Init Ros.Core.Build.SetupUtil
- Ros.Core.Msg.Instances.Binary Ros.Core.Msg.Instances.Storable
- Ros.Core.Msg.FieldImports Ros.Core.Msg.Instances.NFData
- Ros.Core.Msg.Unregister Ros.Core.PathUtil Paths_roshask
- Hs-Source-Dirs: src
+ GHC-Options: -O2 -Wall
+ Main-Is: Main.hs
+ Other-modules: Analysis Gen MD5 Parse PkgInit ResolutionTypes
+ FieldImports Unregister
+ Instances.Binary Instances.Storable Instances.NFData
+ Ros.Internal.PathUtil Ros.Internal.DepFinder
+ Ros.Internal.SetupUtil Paths_roshask
+ Hs-Source-Dirs: src src/executable
View
@@ -11,7 +11,7 @@ import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BL
import System.IO (Handle)
import Ros.Topic
-import Ros.Core.RosBinary (RosBinary(get))
+import Ros.Internal.RosBinary (RosBinary(get))
-- Get the specified number of bytes from a 'Handle'. Returns a
-- wrapped-up 'Nothing' if the client shutdown (indicated by receiving
@@ -1,5 +0,0 @@
-module Ros.Core.Msg.MsgInfo where
-
-class MsgInfo a where
- sourceMD5 :: a -> String
- msgTypeName :: a -> String
@@ -1,10 +1,10 @@
-- Use a package's manifest.xml file to find paths to the packages on
-- which this package is dependent.
-module Ros.Core.Build.DepFinder (findPackageDeps, findPackageDepNames,
- findPackageDepsTrans,
- findMessages, findMessage, findMessagesInPkg,
- findDepsWithMessages, hasMsgs
- ) where
+module Ros.Internal.DepFinder (findPackageDeps, findPackageDepNames,
+ findPackageDepsTrans,
+ findMessages, findMessage, findMessagesInPkg,
+ findDepsWithMessages, hasMsgs
+ ) where
import Control.Applicative ((<$>))
import Control.Monad (when, filterM)
import Data.Maybe (mapMaybe, isNothing, fromJust)
@@ -1,11 +1,11 @@
{-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}
-module Ros.Core.Header where
+module Ros.Internal.Header where
import qualified Prelude as P
import qualified Data.Typeable as T
import Control.Applicative
-import Ros.Core.RosBinary
-import Ros.Core.Msg.MsgInfo
-import Ros.Core.RosTypes
+import Ros.Internal.RosBinary
+import Ros.Internal.Msg.MsgInfo
+import Ros.Internal.RosTypes
import qualified Data.Word as Word
data Header = Header { seq :: Word.Word32
@@ -1,14 +1,14 @@
{-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}
-module Ros.Core.Log where
+module Ros.Internal.Log where
import qualified Prelude as P
import Prelude ((.))
import qualified Data.Typeable as T
import Control.Applicative
-import Ros.Core.RosBinary
-import Ros.Core.Msg.MsgInfo
-import Ros.Core.Msg.HeaderSupport
+import Ros.Internal.RosBinary
+import Ros.Internal.Msg.MsgInfo
+import Ros.Internal.Msg.HeaderSupport
import qualified Data.Word as Word
-import qualified Ros.Core.Header as Header
+import qualified Ros.Internal.Header as Header
data Log = Log { header :: Header.Header
, level :: Word.Word8
@@ -1,10 +1,10 @@
-- |If a message type's first field is of type Header, its sequence
-- number is automatically incremented by the ROS Topic machinery.
-module Ros.Core.Msg.HeaderSupport where
+module Ros.Internal.Msg.HeaderSupport where
import Data.Binary (Put)
import Data.Word (Word32)
-import Ros.Core.RosBinary (RosBinary, put)
-import Ros.Core.RosTypes (ROSTime)
+import Ros.Internal.RosBinary (RosBinary, put)
+import Ros.Internal.RosTypes (ROSTime)
class HasHeader a where
getSequence :: a -> Word32
@@ -0,0 +1,5 @@
+module Ros.Internal.Msg.MsgInfo where
+
+class MsgInfo a where
+ sourceMD5 :: a -> String
+ msgTypeName :: a -> String
@@ -1,4 +1,4 @@
-module Ros.Core.PathUtil where
+module Ros.Internal.PathUtil where
import Data.Char (toUpper)
import Data.List (tails)
import System.Directory (doesFileExist)
@@ -3,7 +3,7 @@
-- ROS messages. This module is used by generated code for .msg types.
-- NOTE: The native byte ordering of the host is used to support the
-- common scenario of same-machine transport.
-module Ros.Core.RosBinary where
+module Ros.Internal.RosBinary where
import Control.Applicative ((<$>), (<*>))
import Control.Monad (replicateM)
import Data.Binary.Get
@@ -17,8 +17,8 @@ import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as BC8
import Foreign.Storable (sizeOf, Storable)
-import Ros.Core.RosTypes
-import Ros.Core.Util.BytesToVector
+import Ros.Internal.RosTypes
+import Ros.Internal.Util.BytesToVector
-- |A type class for binary serialization of ROS messages. Very like
-- the standard Data.Binary type class, but with different, more
@@ -1,10 +1,10 @@
-- |Utilities for working with ROS time values.
-module Ros.Core.RosTime (ROSTime, ROSDuration, toROSTime, fromROSTime,
- diffROSTime, getROSTime, diffSeconds) where
+module Ros.Internal.RosTime (ROSTime, ROSDuration, toROSTime, fromROSTime,
+ diffROSTime, getROSTime, diffSeconds) where
import Data.Time.Clock (UTCTime, NominalDiffTime)
import Data.Time.Clock.POSIX
import Data.Word (Word32)
-import Ros.Core.RosTypes
+import Ros.Internal.RosTypes
toROSTime :: UTCTime -> ROSTime
toROSTime = aux . properFraction . utcTimeToPOSIXSeconds
@@ -1,6 +1,7 @@
-- |Utility types for working with ROS.
-module Ros.Core.RosTypes (ROSTime, ROSDuration, URI, CallerID, TopicName,
- NodeName, ParamName, TopicType, ConnectionID) where
+module Ros.Internal.RosTypes (ROSTime, ROSDuration, URI, CallerID, TopicName,
+ NodeName, ParamName, TopicType,
+ ConnectionID) where
import Data.Word (Word32)
import Foreign.Storable.Tuple ()
@@ -1,6 +1,6 @@
{-# LANGUAGE TupleSections #-}
-- |Integration with the Cabal build system.
-module Ros.Core.Build.SetupUtil (rosBuild, rosConf) where
+module Ros.Internal.SetupUtil (rosBuild, rosConf) where
import Control.Applicative
import Data.List (intercalate)
import Distribution.Simple
@@ -10,7 +10,7 @@ import Distribution.Simple.Setup
import Distribution.PackageDescription hiding (Library)
import System.Directory (getCurrentDirectory)
import System.FilePath ((</>))
-import Ros.Core.Build.DepFinder
+import Ros.Internal.DepFinder
data Buildable = LibraryAndExecutables [String]
| Executables [String]
@@ -1,5 +1,5 @@
-- |Support for read-only executable application configurations.
-module Ros.Core.Util.AppConfig where
+module Ros.Internal.Util.AppConfig where
import Control.Monad.Reader
import Control.Concurrent
@@ -2,8 +2,8 @@
-- |Parses the ROS argument remapping syntax. This is the language used
-- to remap names and assign private parameter values from a command
-- line invocation of a Node.
-module Ros.Core.Util.ArgRemapping (parseRemappings, FromParam(..),
- ParamVal) where
+module Ros.Internal.Util.ArgRemapping (parseRemappings, FromParam(..),
+ ParamVal) where
import Control.Applicative ((<$>))
import Control.Monad.Identity (Identity)
import Data.Either (partitionEithers, lefts, rights)
@@ -1,7 +1,7 @@
{-# LANGUAGE ScopedTypeVariables #-}
-module Ros.Core.Util.BytesToVector (unsafeBytesToVector, bytesToVectorL,
- bytesToVector, unsafeVectorToBytes,
- vectorToBytes) where
+module Ros.Internal.Util.BytesToVector (unsafeBytesToVector, bytesToVectorL,
+ bytesToVector, unsafeVectorToBytes,
+ vectorToBytes) where
import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString as BS
import qualified Data.ByteString.Unsafe as BU
@@ -1,5 +1,6 @@
-module Ros.Core.Util.RingChan (RingChan, newRingChan, writeChan,
- readChan, getChanContents, getBuffered) where
+module Ros.Internal.Util.RingChan (RingChan, newRingChan, writeChan,
+ readChan, getChanContents,
+ getBuffered) where
import Control.Monad (join)
import Control.Concurrent.MVar
import Control.Concurrent.SSem (SSem)
@@ -1,7 +1,8 @@
-- |An applicative interface for working with Storable values. The idea
-- is that the underlying pointer is threaded through the computation
-- to make reading and writing consecutive values easier.
-module Ros.Core.Util.StorableMonad (peek, poke, runStorable, StorableM) where
+module Ros.Internal.Util.StorableMonad (peek, poke, runStorable,
+ StorableM) where
import Control.Monad.State.Strict
import Foreign.Ptr
import Foreign.Storable hiding (peek, poke)
View
@@ -7,14 +7,15 @@ module Ros.Logging (Log, LogLevel(..), enableLogging,
import Control.Concurrent.Chan
import Control.Monad (when)
import Data.IORef
-import System.IO.Unsafe
import Data.Word (Word8)
-import Ros.Core.Log (Log(Log))
-import qualified Ros.Core.Log as Log
-import Ros.Core.Header
+import Language.Haskell.TH
+import System.IO.Unsafe
+
+import Ros.Internal.Log (Log(Log))
+import qualified Ros.Internal.Log as Log
+import Ros.Internal.Header
import Ros.Node
import Ros.TopicUtil (fromList)
-import Language.Haskell.TH
emptyHeader :: Header
emptyHeader = Header 0 (0,0) ""
View
@@ -1,7 +1,7 @@
-- Client functionality for the ROS Master API
module Ros.MasterAPI where
import Network.XmlRpc.Client
-import Ros.Core.RosTypes
+import Ros.Internal.RosTypes
-- |Subscribe the caller to the specified topic. In addition to
-- receiving a list of current publishers, the subscriber will also
View
@@ -5,8 +5,8 @@
module Ros.Node (Node, runNode, advertise, advertiseBuffered,
subscribe, getShutdownAction, runHandler, getParam,
getParamOpt, getName, getNamespace,
- module Ros.Core.RosTypes, Topic(..), topicRate,
- module Ros.Core.RosTime, liftIO) where
+ module Ros.Internal.RosTypes, Topic(..), topicRate,
+ module Ros.Internal.RosTime, liftIO) where
import Control.Applicative ((<$>))
import Control.Concurrent (newEmptyMVar, readMVar, putMVar)
import Control.Concurrent.BoundedChan
@@ -20,19 +20,20 @@ import Control.Concurrent (forkIO, ThreadId)
import Data.Dynamic
import System.Environment (getEnvironment, getArgs)
import Network.XmlRpc.Internals (XmlRpcType)
-import Ros.Core.Msg.MsgInfo
+
+import Ros.Internal.Msg.MsgInfo
+import Ros.Internal.RosBinary (RosBinary)
+import Ros.Internal.RosTypes
+import Ros.Internal.RosTime
+import Ros.Internal.Util.AppConfig (Config, parseAppConfig, forkConfig, configured)
+import Ros.Internal.Util.ArgRemapping
import Ros.NodeType
import qualified Ros.ParameterServerAPI as P
-import Ros.Core.RosBinary (RosBinary)
-import Ros.Core.RosTypes
import Ros.RosTcp (subStream, runServer)
import qualified Ros.RunNode as RN
-import Ros.TopicStats (recvMessageStat, sendMessageStat)
-import Ros.Core.Util.AppConfig (Config, parseAppConfig, forkConfig, configured)
-import Ros.Core.Util.ArgRemapping
import Ros.Topic
+import Ros.TopicStats (recvMessageStat, sendMessageStat)
import Ros.TopicUtil (topicRate, share)
-import Ros.Core.RosTime
-- |Maximum number of items to buffer for a subscriber.
recvBufferSize :: Int
Oops, something went wrong.

0 comments on commit eb4c396

Please sign in to comment.