From d94c76012aa747d661499cfad23749379f52348e Mon Sep 17 00:00:00 2001 From: Marenz Date: Sat, 30 Apr 2011 14:39:04 +0200 Subject: [PATCH] more work on the d binding --- include/d/psyc/{psyc.d => common.d} | 12 +++++------- include/d/psyc/parser.d | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) rename include/d/psyc/{psyc.d => common.d} (94%) diff --git a/include/d/psyc/psyc.d b/include/d/psyc/common.d similarity index 94% rename from include/d/psyc/psyc.d rename to include/d/psyc/common.d index cb66937..efb5a90 100644 --- a/include/d/psyc/psyc.d +++ b/include/d/psyc/common.d @@ -16,7 +16,9 @@ * etc... */ -EPOCH = 1440444041 // 2015-08-24 21:20:41 CET (Monday) +module psyc.common; + +const EPOCH = 1440444041; // 2015-08-24 21:20:41 CET (Monday) extern (C): @@ -119,9 +121,6 @@ struct MatchVar */ String newString (char *str, size_t strlen); -#define C2STR(_string) {sizeof(_string)-1, _string} -#define C2ARG(_string) _string, sizeof(_string)-1 - /* intermediate struct for a PSYC variable modification */ struct Modifier { @@ -239,8 +238,7 @@ int matches(char *sho, size_t slen, * number of bytes written. 0 is a legal return value. Should the * callback return -1, text leaves the original template text as is. */ -typedef int (*textCB)(char *match, size_t mlen, - char **buffer, size_t *blen); +alias extern (C) int function (char *match, size_t mlen, char **buffer, size_t *blen) textCB; /** * Fills out text templates by asking a callback for content. @@ -255,7 +253,7 @@ typedef int (*textCB)(char *match, size_t mlen, * * See also http://about..eu/text */ -int text(char *template, size_t tlen, +int text(char *_template, size_t tlen, char **buffer, size_t *blen, textCB lookupValue, char *braceOpen, char *braceClose); diff --git a/include/d/psyc/parser.d b/include/d/psyc/parser.d index 19e343f..4345d52 100644 --- a/include/d/psyc/parser.d +++ b/include/d/psyc/parser.d @@ -1,6 +1,6 @@ module psyc.parser; -import psyc.psyc; +import psyc.common; /** * @file d/psyc/parser.d