HROOT-net (empty) → 0.10.0.1
raw patch · 17 files changed
+487/−0 lines, 17 filesdep +HROOT-coredep +HROOT-iodep +basebuild-type:Customsetup-changed
Dependencies added: HROOT-core, HROOT-io, base, fficxx, fficxx-runtime, stdcxx, template-haskell
Files
- CHANGES +60/−0
- HROOT-net.cabal +55/−0
- LICENSE +0/−0
- Setup.hs +27/−0
- csrc/HROOT-netType.h +13/−0
- csrc/HROOTNetTHttpServer.cpp +25/−0
- csrc/HROOTNetTHttpServer.h +61/−0
- src/HROOT/Net.hs +10/−0
- src/HROOT/Net/Ordinary.hs +6/−0
- src/HROOT/Net/TH.hs +12/−0
- src/HROOT/Net/THttpServer.hs +7/−0
- src/HROOT/Net/THttpServer/Cast.hs +19/−0
- src/HROOT/Net/THttpServer/FFI.hsc +77/−0
- src/HROOT/Net/THttpServer/Implementation.hs +64/−0
- src/HROOT/Net/THttpServer/Interface.hs +28/−0
- src/HROOT/Net/THttpServer/RawType.hs +16/−0
- src/HROOT/Net/Template.hs +7/−0
+ CHANGES view
@@ -0,0 +1,60 @@+# Changelog for HROOT++## 0.10.0.1+- Use hackage-version of fficxx (#18)+- Generate docs in CI (#17)+- Update flake.nix with recent fficxx and ormolu format (#16)+- Update fficxx to support GHC 9.4 (#15)+- Add TMutex and test multithreading with GUI (#12)+- HROOT now uses common stdcxx (#11)+- idealized gas simulation (#10)+- Add TMarker and Range. Test 2D graphics using gas example (#9)+- HROOT generation and packing via nix (#8)+- Revive umbrella package generation (#7)+- Static files (Config.hs, Setup.lhs) and custom-setup dependency (#6)+- Modernize HROOT with fficxx 0.5.1 (#5)++## 0.9.0.1++## 0.9+- HROOT-tree+- HROOT only support ROOT > 6++## 0.8+- separate packages into HROOT-core, HROOT-hist, HROOT-io, HROOT-math, HROOT-graf and HROOT is now an umbrella package++## 0.7+- separate all class interfaces and implementation in different modules+- overhaul Existential++## 0.7.1+- support for static methods+- add TROOT++## 0.6.9+- implement almost all class methods of TLine, TAttLine, TAttMarker, TAttText and TAttPad++## 0.6.8+- implement almost all class methods of TH2, TH3, TFormula, TF1 and TGraph++## 0.6.7+- implement almost all TH1 class methods++## 0.6.6+- do not need OverlappingInstances, IncoherentInstances, UndecidableInstances++## 0.6.4+- add many TH2 class methods++## 0.6.3+- Implement Existential Types++## 0.6+- implement Deletable. delete method for every object+- refactor HROOT generated file names (Interface.hs, Implementation.hs, FFI.hs)++## 0.5.1+- support for delete++## 0.5.0+- initial preview release
+ HROOT-net.cabal view
@@ -0,0 +1,55 @@+Cabal-version: 3.0+Name: HROOT-net+Version: 0.10.0.1+Synopsis: Haskell binding to ROOT Net modules+Description:+ HROOT is a haskell Foreign Function Interface (FFI) binding to ROOT.+ ROOT(http://root.cern.ch) is an object-oriented program and library+ developed by CERN for physics data analysis.+Homepage: https://wavewave.github.io/HROOT+license: LGPL-2.1-or-later+license-file: LICENSE+Author: Ian-Woo Kim+Maintainer: Ian-Woo Kim <ianwookim@gmail.com>+Category: Graphics, Statistics, Math, Numerical+Tested-with: GHC == 9.0.2 || == 9.2.4 || == 9.4.2 +Extra-source-files:+ CHANGES+ csrc/HROOTNetTHttpServer.h+ csrc/HROOTNetTHttpServer.cpp+Build-Type: Custom+custom-setup+ setup-depends: Cabal < 4, base > 4 && < 5, process++Source-repository head+ type: git+ location: https://github.com/wavewave/HROOT++Library+ default-language: Haskell2010+ hs-source-dirs: src+ ghc-options: -Wall -funbox-strict-fields -fno-warn-unused-do-bind -fno-warn-orphans -fno-warn-unused-imports+ cxx-options: -std=c++17+ Build-Depends: base > 4 && < 5, fficxx >= 0.7, fficxx-runtime >= 0.7, template-haskell, stdcxx, HROOT-core == 0.10.0.1, HROOT-io == 0.10.0.1+ Exposed-Modules:+ HROOT.Net+ HROOT.Net.Ordinary+ HROOT.Net.Template+ HROOT.Net.TH+ HROOT.Net.THttpServer+ HROOT.Net.THttpServer.RawType+ HROOT.Net.THttpServer.FFI+ HROOT.Net.THttpServer.Interface+ HROOT.Net.THttpServer.Cast+ HROOT.Net.THttpServer.Implementation+ Other-Modules:+ extra-lib-dirs: + extra-libraries: RHTTP+ Include-dirs: csrc + pkgconfig-depends: + Install-includes:+ HROOT-netType.h+ HROOTNetTHttpServer.h+ Cxx-sources:+ csrc/HROOTNetTHttpServer.cpp+
+ LICENSE view
+ Setup.hs view
@@ -0,0 +1,27 @@+import Distribution.Simple+import Distribution.Simple.Setup+import Distribution.PackageDescription+import Distribution.Simple.LocalBuildInfo+import Config++myconfigHook = simpleUserHooks { confHook = hookfunction }++hookfunction x y = do+ binfo <- confHook simpleUserHooks x y+ r_pbi <- config binfo+ let pkg_descr = localPkgDescr binfo++ let newbinfo = case r_pbi of+ Just pbi -> binfo { localPkgDescr = updatePackageDescription pbi pkg_descr }+ Nothing -> do+ let r_lib = library pkg_descr+ case r_lib of+ Just lib ->+ let binfo2 = libBuildInfo lib+ newlib = lib { libBuildInfo = binfo2 { cSources = [] }}+ in binfo { localPkgDescr = pkg_descr { library = Just newlib }}+ Nothing -> error "some library setting is wrong."+-- putStrLn (show (localPkgDescr newbinfo))+ return newbinfo++main = defaultMainWithHooks myconfigHook
+ csrc/HROOT-netType.h view
@@ -0,0 +1,13 @@++#ifdef __cplusplus+extern "C" {+#endif++#pragma once++// Opaque type definition for $classname+typedef struct THttpServer_tag THttpServer_t;typedef THttpServer_t * THttpServer_p;typedef THttpServer_t const* const_THttpServer_p;+#ifdef __cplusplus+}+#endif+
+ csrc/HROOTNetTHttpServer.cpp view
@@ -0,0 +1,25 @@++#include "MacroPatternMatch.h"++#include "HROOTCoreTNamed.h"++#include "THttpServer.h"++#include "HROOTNetTHttpServer.h"++using namespace ROOT;++#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)++#define TYPECASTMETHOD(cname,mname,oname) \+ FXIIF( CHECKPROTECT(cname,mname) ) ( \+ (from_nonconst_to_nonconst<oname,cname ## _t>), \+ (from_nonconst_to_nonconst<cname,cname ## _t>) )++TNAMED_DEF_VIRT(THttpServer)+TOBJECT_DEF_VIRT(THttpServer)+DELETABLE_DEF_VIRT(THttpServer)+THTTPSERVER_DEF_VIRT(THttpServer)+THTTPSERVER_DEF_NONVIRT(THttpServer)+THTTPSERVER_DEF_ACCESSOR(THttpServer)+
+ csrc/HROOTNetTHttpServer.h view
@@ -0,0 +1,61 @@++#ifdef __cplusplus+extern "C" {+#endif++#pragma once+++#include "HROOT-netType.h"++#include "HROOTCoreTNamed.h"++#include "HROOTCoreTObject.h"++#include "STDDeletable.h"++#include "HROOT-coreType.h"+++#define THTTPSERVER_DECL_VIRT(Type) \++++#define THTTPSERVER_DECL_NONVIRT(Type) \+Type##_p Type##_newTHttpServer ( const char* engine );\+void Type##_tHttpServer_SetReadOnly ( Type##_p p, bool readonly );+++#define THTTPSERVER_DECL_ACCESSOR(Type) \++++#define THTTPSERVER_DEF_VIRT(Type) \++++#define THTTPSERVER_DEF_NONVIRT(Type) \+Type##_p Type##_newTHttpServer ( const char* engine ) {\+Type* newp=new Type(engine);return from_nonconst_to_nonconst<Type##_t, Type>(newp);\+}\+\+void Type##_tHttpServer_SetReadOnly ( Type##_p p, bool readonly ) {\+((TYPECASTMETHOD(Type, tHttpServer_SetReadOnly, THttpServer))(p))->SetReadOnly(readonly);\+}+++#define THTTPSERVER_DEF_ACCESSOR(Type) \++++TNAMED_DECL_VIRT(THttpServer)+TOBJECT_DECL_VIRT(THttpServer)+DELETABLE_DECL_VIRT(THttpServer)+THTTPSERVER_DECL_VIRT(THttpServer)+THTTPSERVER_DECL_NONVIRT(THttpServer)+THTTPSERVER_DECL_ACCESSOR(THttpServer)++#ifdef __cplusplus+}+#endif+
+ src/HROOT/Net.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE FlexibleContexts, FlexibleInstances,+ ForeignFunctionInterface, InterruptibleFFI #-}+module HROOT.Net+ (module HROOT.Net.THttpServer, module HROOT.Net.Ordinary,+ module HROOT.Net.Template, module HROOT.Net.TH)+ where+import HROOT.Net.THttpServer+import HROOT.Net.Template+import HROOT.Net.TH+import HROOT.Net.Ordinary
+ src/HROOT/Net/Ordinary.hs view
@@ -0,0 +1,6 @@+{-# LANGUAGE FlexibleContexts, FlexibleInstances,+ ForeignFunctionInterface, InterruptibleFFI #-}+module HROOT.Net.Ordinary () where+import Foreign.C+import Foreign.Ptr+import FFICXX.Runtime.Cast
+ src/HROOT/Net/TH.hs view
@@ -0,0 +1,12 @@+{-# LANGUAGE FlexibleContexts, FlexibleInstances,+ ForeignFunctionInterface, InterruptibleFFI, TemplateHaskell #-}+module HROOT.Net.TH () where+import Data.Char+import Data.List+import Data.Monoid+import Foreign.C.Types+import Foreign.Ptr+import Language.Haskell.TH+import Language.Haskell.TH.Syntax+import FFICXX.Runtime.CodeGen.Cxx+import FFICXX.Runtime.TH
+ src/HROOT/Net/THttpServer.hs view
@@ -0,0 +1,7 @@+module HROOT.Net.THttpServer+ (THttpServer(..), ITHttpServer, upcastTHttpServer,+ downcastTHttpServer, newTHttpServer, tHttpServer_SetReadOnly)+ where+import HROOT.Net.THttpServer.RawType+import HROOT.Net.THttpServer.Interface+import HROOT.Net.THttpServer.Implementation
+ src/HROOT/Net/THttpServer/Cast.hs view
@@ -0,0 +1,19 @@+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,+ MultiParamTypeClasses, OverlappingInstances, IncoherentInstances+ #-}+module HROOT.Net.THttpServer.Cast where+import Foreign.Ptr+import FFICXX.Runtime.Cast+import System.IO.Unsafe+import HROOT.Net.THttpServer.RawType+import HROOT.Net.THttpServer.Interface++instance (ITHttpServer a, FPtr a) =>+ Castable (a) (Ptr RawTHttpServer)+ where+ cast x f = f (castPtr (get_fptr x))+ uncast x f = f (cast_fptr_to_obj (castPtr x))++instance () => Castable (THttpServer) (Ptr RawTHttpServer) where+ cast x f = f (castPtr (get_fptr x))+ uncast x f = f (cast_fptr_to_obj (castPtr x))
+ src/HROOT/Net/THttpServer/FFI.hsc view
@@ -0,0 +1,77 @@+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}+module HROOT.Net.THttpServer.FFI where+import Data.Word+import Data.Int+import Foreign.C+import Foreign.Ptr+import HROOT.Net.THttpServer.RawType+import HROOT.Net.THttpServer.RawType+import HROOT.Core.TObject.RawType+import HROOT.Core.TClass.RawType++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_SetName" c_thttpserver_setname+ :: Ptr RawTHttpServer -> CString -> IO ()++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_SetNameTitle"+ c_thttpserver_setnametitle ::+ Ptr RawTHttpServer -> CString -> CString -> IO ()++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_SetTitle" c_thttpserver_settitle+ :: Ptr RawTHttpServer -> CString -> IO ()++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_Clear" c_thttpserver_clear ::+ Ptr RawTHttpServer -> CString -> IO ()++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_Draw" c_thttpserver_draw ::+ Ptr RawTHttpServer -> CString -> IO ()++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_FindObject"+ c_thttpserver_findobject ::+ Ptr RawTHttpServer -> CString -> IO (Ptr RawTObject)++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_GetName" c_thttpserver_getname+ :: Ptr RawTHttpServer -> IO CString++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_IsA" c_thttpserver_isa ::+ Ptr RawTHttpServer -> IO (Ptr RawTClass)++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_Paint" c_thttpserver_paint ::+ Ptr RawTHttpServer -> CString -> IO ()++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_printObj" c_thttpserver_printobj+ :: Ptr RawTHttpServer -> CString -> IO ()++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_SaveAs" c_thttpserver_saveas ::+ Ptr RawTHttpServer -> CString -> CString -> IO ()++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_Write" c_thttpserver_write ::+ Ptr RawTHttpServer -> CString -> CInt -> CInt -> IO CInt++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_Write_" c_thttpserver_write_ ::+ Ptr RawTHttpServer -> IO CInt++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_delete" c_thttpserver_delete ::+ Ptr RawTHttpServer -> IO ()++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_newTHttpServer"+ c_thttpserver_newthttpserver :: CString -> IO (Ptr RawTHttpServer)++foreign import ccall interruptible+ "HROOTNetTHttpServer.h THttpServer_tHttpServer_SetReadOnly"+ c_thttpserver_thttpserver_setreadonly ::+ Ptr RawTHttpServer -> CBool -> IO ()
+ src/HROOT/Net/THttpServer/Implementation.hs view
@@ -0,0 +1,64 @@+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,+ ForeignFunctionInterface, IncoherentInstances,+ MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,+ TypeFamilies, TypeSynonymInstances #-}+module HROOT.Net.THttpServer.Implementation where+import Data.Monoid+import Data.Word+import Data.Int+import Foreign.C+import Foreign.Ptr+import Language.Haskell.TH+import Language.Haskell.TH.Syntax+import System.IO.Unsafe+import FFICXX.Runtime.Cast+import FFICXX.Runtime.CodeGen.Cxx+import FFICXX.Runtime.TH+import HROOT.Net.THttpServer.RawType+import HROOT.Net.THttpServer.FFI+import HROOT.Net.THttpServer.Interface+import HROOT.Net.THttpServer.Cast+import HROOT.Net.THttpServer.RawType+import HROOT.Net.THttpServer.Cast+import HROOT.Net.THttpServer.Interface+import HROOT.Core.TClass.RawType+import HROOT.Core.TClass.Cast+import HROOT.Core.TClass.Interface+import HROOT.Core.TNamed.RawType+import HROOT.Core.TNamed.Cast+import HROOT.Core.TNamed.Interface+import HROOT.Core.TObject.RawType+import HROOT.Core.TObject.Cast+import HROOT.Core.TObject.Interface+import STD.Deletable.RawType+import STD.Deletable.Cast+import STD.Deletable.Interface++instance () => ITHttpServer (THttpServer) where++instance () => ITNamed (THttpServer) where+ setName = xform1 c_thttpserver_setname+ setNameTitle = xform2 c_thttpserver_setnametitle+ setTitle = xform1 c_thttpserver_settitle++instance () => ITObject (THttpServer) where+ clear = xform1 c_thttpserver_clear+ draw = xform1 c_thttpserver_draw+ findObject = xform1 c_thttpserver_findobject+ getName = xform0 c_thttpserver_getname+ isA = xform0 c_thttpserver_isa+ paint = xform1 c_thttpserver_paint+ printObj = xform1 c_thttpserver_printobj+ saveAs = xform2 c_thttpserver_saveas+ write = xform3 c_thttpserver_write+ write_ = xform0 c_thttpserver_write_++instance () => IDeletable (THttpServer) where+ delete = xform0 c_thttpserver_delete++newTHttpServer :: (Castable c0 CString) => c0 -> IO THttpServer+newTHttpServer = xform0 c_thttpserver_newthttpserver++tHttpServer_SetReadOnly :: () => THttpServer -> CBool -> IO ()+tHttpServer_SetReadOnly+ = xform1 c_thttpserver_thttpserver_setreadonly
+ src/HROOT/Net/THttpServer/Interface.hs view
@@ -0,0 +1,28 @@+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,+ FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,+ MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,+ TypeSynonymInstances #-}+module HROOT.Net.THttpServer.Interface where+import Data.Word+import Data.Int+import Foreign.C+import Foreign.Ptr+import FFICXX.Runtime.Cast+import HROOT.Net.THttpServer.RawType+import HROOT.Core.TNamed.Interface++class (ITNamed a) => ITHttpServer a where++upcastTHttpServer ::+ forall a . (FPtr a, ITHttpServer a) => a -> THttpServer+upcastTHttpServer h+ = let fh = get_fptr h+ fh2 :: Ptr RawTHttpServer = castPtr fh+ in cast_fptr_to_obj fh2++downcastTHttpServer ::+ forall a . (FPtr a, ITHttpServer a) => THttpServer -> a+downcastTHttpServer h+ = let fh = get_fptr h+ fh2 = castPtr fh+ in cast_fptr_to_obj fh2
+ src/HROOT/Net/THttpServer/RawType.hs view
@@ -0,0 +1,16 @@+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,+ MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,+ EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}+module HROOT.Net.THttpServer.RawType where+import Foreign.Ptr+import FFICXX.Runtime.Cast++data RawTHttpServer++newtype THttpServer = THttpServer (Ptr RawTHttpServer)+ deriving (Eq, Ord, Show)++instance () => FPtr (THttpServer) where+ type Raw THttpServer = RawTHttpServer+ get_fptr (THttpServer ptr) = ptr+ cast_fptr_to_obj = THttpServer
+ src/HROOT/Net/Template.hs view
@@ -0,0 +1,7 @@+{-# LANGUAGE EmptyDataDecls, FlexibleInstances,+ ForeignFunctionInterface, InterruptibleFFI, MultiParamTypeClasses,+ TypeFamilies #-}+module HROOT.Net.Template () where+import Foreign.C.Types+import Foreign.Ptr+import FFICXX.Runtime.Cast