Sha256: b9666445f207eb34478f71964ba7106451bb3e878aae8ef41daeff22383b329d

Contents?: true

Size: 1005 Bytes

Versions: 91

Compression:

Stored size: 1005 Bytes

Contents

#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "cstring.h"
#include "markdown.h"
#include "amalloc.h"


/* putc() into a cstring
 */
void
Csputc(int c, Cstring *iot)
{
    EXPAND(*iot) = c;
}


/* printf() into a cstring
 */
int
Csprintf(Cstring *iot, char *fmt, ...)
{
    va_list ptr;
    int siz=100;

    do {
	RESERVE(*iot, siz);
	va_start(ptr, fmt);
	siz = vsnprintf(T(*iot)+S(*iot), ALLOCATED(*iot)-S(*iot), fmt, ptr);
	va_end(ptr);
    } while ( siz > (ALLOCATED(*iot)-S(*iot)) );

    S(*iot) += siz;
    return siz;
}


/* write() into a cstring
 */
int
Cswrite(Cstring *iot, char *bfr, int size)
{
    RESERVE(*iot, size);
    memcpy(T(*iot)+S(*iot), bfr, size);
    S(*iot) += size;
    return size;
}


/* reparse() into a cstring
 */
void
Csreparse(Cstring *iot, char *buf, int size, int flags)
{
    MMIOT f;
    ___mkd_initmmiot(&f, 0);
    ___mkd_reparse(buf, size, 0, &f);
    ___mkd_emblock(&f);
    SUFFIX(*iot, T(f.out), S(f.out));
    ___mkd_freemmiot(&f, 0);
}

Version data entries

91 entries across 85 versions & 10 rubygems

Version Path
chaptastic-rdiscount-1.4.1 ext/Csio.c
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/bluecloth-2.2.0/ext/Csio.c
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/bluecloth-2.1.0/ext/Csio.c
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/bluecloth-2.1.0/ext/Csio.c
challah-1.0.0.beta3 vendor/bundle/gems/rdiscount-2.0.7.2/ext/Csio.c
challah-1.0.0.beta3 vendor/bundle/gems/rdiscount-2.0.7.3/ext/Csio.c
rdiscount-2.0.7.3 ext/Csio.c
challah-1.0.0.beta2 vendor/bundle/gems/rdiscount-2.0.7.2/ext/Csio.c
challah-1.0.0.beta vendor/bundle/gems/rdiscount-2.0.7.1/ext/Csio.c
challah-1.0.0.beta vendor/bundle/gems/rdiscount-2.0.7.2/ext/Csio.c
challah-1.0.0.beta vendor/bundle/gems/rdiscount-1.6.8/ext/Csio.c
rdiscount-2.0.7.2 ext/Csio.c
rdiscount-2.0.7.1 ext/Csio.c
challah-0.9.1.beta.3 vendor/bundle/gems/rdiscount-1.6.8/ext/Csio.c
rdiscount-dsc-1.6.9 ext/Csio.c
rdiscount-2.0.7 ext/Csio.c
challah-0.9.1.beta vendor/bundle/gems/rdiscount-1.6.8/ext/Csio.c
challah-0.9.0 vendor/bundle/gems/rdiscount-1.6.8/ext/Csio.c
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/rdiscount-1.6.8/ext/Csio.c
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/rdiscount-1.6.8/ext/Csio.c