Skip to content

Commit

Permalink
Merge pull request #31 from jserv/compat-ccurl
Browse files Browse the repository at this point in the history
Implement cCurl-compatibile interface
  • Loading branch information
WEI, CHEN committed Mar 23, 2018
2 parents 4643fee + 8c1123b commit 0652373
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ OBJS += \
jni/iri-pearldiver-exlib.o
endif

ifeq ("$(BUILD_COMPAT)", "1")
OBJS += \
compat-ccurl.o
endif

OBJS := $(addprefix $(OUT)/, $(OBJS))
#deps := $(OBJS:%.o=%.o.d)

Expand Down
3 changes: 3 additions & 0 deletions mk/defs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ BUILD_GPU ?= 0

# Build JNI glue as the bridge between dcurl and IRI
BUILD_JNI ?= 0

# Build cCurl compatible interface
BUILD_COMPAT ?= 0
29 changes: 29 additions & 0 deletions src/compat-ccurl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2018 dcurl Developers.
* Use of this source code is governed by MIT license that can be
* found in the LICENSE file.
*/

#include "dcurl.h"
#include <stdbool.h>

static bool isInitialized = false;

char *ccurl_pow(char *trytes, int mwm)
{
if (!isInitialized) {
dcurl_init(1, 0);
isInitialized = true;
}
return (char *) dcurl_entry((int8_t *) trytes, mwm);
}

void ccurl_pow_finalize(void)
{
dcurl_destroy();
}

void ccurl_pow_interrupt(void)
{
/* Do Nothing */
}

0 comments on commit 0652373

Please sign in to comment.