chobie / php-sundown

php-sundown is just simple wrapper of sundown
Other
137 stars 16 forks source link

Windows support. #6

Closed chobie closed 12 years ago

chobie commented 12 years ago

for now, config.w32 does not specify latest files. let me fix it when i finished to implement Redcarpet2 like features.

chobie commented 12 years ago

could not resolve undefined functions _snprintf and _strcasecmp. let me make a patch for win32

stealth35 commented 12 years ago

here the fix for the compilation

Example

PHP_METHOD(sundown_render_html, blockCode)
{
    char *code, *block_code;
    int code_len, block_code_len;
    struct buf *input, *lang, *output;
    php_sundown_buffer_t *object;
    php_sundown_render_html_t *html;

    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
        "ss",&code, &code_len, &block_code, &block_code_len) == FAILURE) {
        return;
    }

    html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
    php_sundown_render_base_t *base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC);\
    input = str2buf(block_code, block_code_len);
    lang = str2buf(code, code_len);
    output = bufnew(128);
    html->cb.blockcode(output,lang,input, &base->html);
    bufrelease(input);
    bufrelease(lang);
    RETVAL_STRINGL(output->data, output->size,1);
    bufrelease(output);
}

Should be

PHP_METHOD(sundown_render_html, blockQuote)
{
    char *quote;
    int quote_len;
    struct buf *input, *output;
    php_sundown_buffer_t *object;
    php_sundown_render_html_t *html;
    php_sundown_render_base_t *base;

    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
        "s", &quote, &quote_len) == FAILURE) {
        return;
    }

    html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
    base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC);\
    input = str2buf(quote, quote_len);
    output = bufnew(128);
    html->cb.blockquote(output,input, &base->html);
    bufrelease(input);
    RETVAL_STRINGL(output->data, output->size,1);
    bufrelease(output);
}
stof commented 12 years ago

@stealth35 you should send a pull request :)

chobie commented 12 years ago

@stealth35 Thank you for your advice. I'm working win32-support branch. please tell me if you have any suggestions. Thanks

chobie commented 12 years ago

build

git clone https://github.com/chobie/php-sundown.git --recursive
cd php-sundown
phpize
configure --with-php-build="c:\php-sdk\php53dev\vc9\x86\deps" --with-sundwon
nmake

diff

https://github.com/chobie/php-sundown/compare/development...win32-support

probably this looks fine. I'll merge this into develop in this weekend.