Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-igraph
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-igraph
Commits
82384162
Commit
82384162
authored
Jun 02, 2015
by
Kai Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unnecessary c codes
parent
31107168
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
20 deletions
+13
-20
haskelligraph.c
cbits/haskelligraph.c
+5
-12
Attribute.chs
src/IGraph/Internal/Attribute.chs
+6
-4
Data.chs
src/IGraph/Internal/Data.chs
+2
-4
No files found.
cbits/haskelligraph.c
View file @
82384162
...
...
@@ -3,11 +3,12 @@
#include <igraph/igraph.h>
igraph_strvector_t
*
igraph_strvector_new
(
long
int
size
)
igraph_integer_t
igraph_get_eid_
(
igraph_t
*
graph
,
igraph_integer_t
pfrom
,
igraph_integer_t
pto
,
igraph_bool_t
directed
,
igraph_bool_t
error
)
{
igraph_
strvector_t
*
vector
=
(
igraph_strvector_t
*
)
malloc
(
sizeof
(
igraph_strvector_t
))
;
igraph_
strvector_init
(
vector
,
size
);
return
vector
;
igraph_
integer_t
eid
;
igraph_
get_eid
(
graph
,
&
eid
,
pfrom
,
pto
,
directed
,
error
);
return
eid
;
}
char
**
igraph_strvector_get_
(
igraph_strvector_t
*
s
,
long
int
i
)
...
...
@@ -17,14 +18,6 @@ char** igraph_strvector_get_(igraph_strvector_t* s, long int i)
return
x
;
}
igraph_integer_t
igraph_get_eid_
(
igraph_t
*
graph
,
igraph_integer_t
pfrom
,
igraph_integer_t
pto
,
igraph_bool_t
directed
,
igraph_bool_t
error
)
{
igraph_integer_t
eid
;
igraph_get_eid
(
graph
,
&
eid
,
pfrom
,
pto
,
directed
,
error
);
return
eid
;
}
void
haskelligraph_init
()
{
/* attach attribute table */
...
...
src/IGraph/Internal/Attribute.chs
View file @
82384162
...
...
@@ -12,7 +12,7 @@ import System.IO.Unsafe (unsafePerformIO)
{#import IGraph.Internal.Graph #}
{#import IGraph.Internal.Data #}
#include "
cbits/haskelligraph.c
"
#include "
igraph/igraph.h
"
makeAttributeRecord :: Show a => String -> [a] -> AttributeRecord
makeAttributeRecord name xs = unsafePerformIO $ do
...
...
@@ -21,7 +21,6 @@ makeAttributeRecord name xs = unsafePerformIO $ do
return $ AttributeRecord ptr 2 value
data AttributeRecord = AttributeRecord CString Int StrVectorPtr
deriving (Show)
instance Storable AttributeRecord where
sizeOf _ = {#sizeof igraph_attribute_record_t #}
...
...
@@ -29,11 +28,14 @@ instance Storable AttributeRecord where
peek p = AttributeRecord
<$> ({#get igraph_attribute_record_t->name #} p)
<*> liftM fromIntegral ({#get igraph_attribute_record_t->type #} p)
<*> liftM castPtr ({#get igraph_attribute_record_t->value #} p)
<*> ( do ptr <- {#get igraph_attribute_record_t->value #} p
fptr <- newForeignPtr_ . castPtr $ ptr
return $ StrVectorPtr fptr )
poke p (AttributeRecord name t vptr) = do
{#set igraph_attribute_record_t.name #} p name
{#set igraph_attribute_record_t.type #} p $ fromIntegral t
{#set igraph_attribute_record_t.value #} p $ castPtr vptr
withStrVectorPtr vptr $ \ptr ->
{#set igraph_attribute_record_t.value #} p $ castPtr ptr
{#fun pure igraph_cattribute_has_attr as ^ { `IGraphPtr', `Int', `String' } -> `Bool' #}
...
...
src/IGraph/Internal/Data.chs
View file @
82384162
...
...
@@ -79,12 +79,10 @@ vectorPPtrToList vpptr = do
fptr <- newForeignPtr_ $ castPtr vptr
vectorPtrToList $ VectorPtr fptr
data StrVector
{#pointer *igraph_strvector_t as StrVectorPtr -> StrVector #}
{#
fun igraph_strvector_new as ^ { `Int' } -> `StrVectorPtr'
#}
{#
pointer *igraph_strvector_t as StrVectorPtr foreign finalizer igraph_strvector_destroy newtype
#}
{#fun igraph_strvector_
destroy as ^ { `StrVectorPtr' } -> `()
' #}
{#fun igraph_strvector_
init as igraphStrvectorNew { +, `Int' } -> `StrVectorPtr
' #}
{#fun igraph_strvector_get_ as igraphStrvectorGet' { `StrVectorPtr', `Int' } -> `Ptr CString' id #}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment