Skip to content

Commit

Permalink
update extconf.rb and config.h with discount 2.x defines
Browse files Browse the repository at this point in the history
  • Loading branch information
rtomayko committed Jan 25, 2011
1 parent c602892 commit 712015c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ext/config.h
@@ -1,10 +1,13 @@
/*
* rdiscount extension discount configuration
*/
#ifndef __MARKDOWN_D
#define __MARKDOWN_D 1

/* rdiscount extension configuration */

#undef USE_AMALLOC

/* tabs are four spaces */
#define TABSTOP 4

/* these are setup by extconf.rb */
#if HAVE_RANDOM
#define COINTOSS() (random()&1)
#elif HAVE_RAND
Expand All @@ -17,5 +20,4 @@
#define INITRNG(x) srand((unsigned int)x)
#endif

#define RELAXED_EMPHASIS 1
#define SUPERSCRIPT 1
#endif/* __MARKDOWN_D */
13 changes: 13 additions & 0 deletions ext/extconf.rb
Expand Up @@ -7,4 +7,17 @@
HAVE_RAND = have_func('rand')
HAVE_SRAND = have_func('srand')

def sized_int(size, types)
types.find { |type| check_sizeof(type) == 4 } ||
abort("no int with size #{size}")
end

DWORD = sized_int(4, ["unsigned long", "unsigned int"])
WORD = sized_int(2, ["unsigned int", "unsigned short"])
BYTE = "unsigned char"

$defs.push("-DDWORD='#{DWORD}'")
$defs.push("-DWORD='#{WORD}'")
$defs.push("-DBYTE='#{BYTE}'")

create_makefile('rdiscount')

0 comments on commit 712015c

Please sign in to comment.