package com.commonsware.cwac.anddown;

public class AndDown {
  static {
    System.loadLibrary("anddown");
  }

  public static native String markdownToHtml(String raw);
  public static native String markdownToHtml(String raw, int extensions);
  
  public interface Extensions {
    public static final int HOEDOWN_EXT_TABLES = (1 << 0);
    public static final int HOEDOWN_EXT_FENCED_CODE = (1 << 1);
    public static final int HOEDOWN_EXT_FOOTNOTES = (1 << 2);

    /* span-level extensions */
    public static final int HOEDOWN_EXT_AUTOLINK = (1 << 3);
    public static final int HOEDOWN_EXT_STRIKETHROUGH = (1 << 4);
    public static final int HOEDOWN_EXT_UNDERLINE = (1 << 5);
    public static final int HOEDOWN_EXT_HIGHLIGHT = (1 << 6);
    public static final int HOEDOWN_EXT_QUOTE = (1 << 7);
    public static final int HOEDOWN_EXT_SUPERSCRIPT = (1 << 8);
    public static final int HOEDOWN_EXT_MATH = (1 << 9);

    /* other flags */
    public static final int HOEDOWN_EXT_NO_INTRA_EMPHASIS = (1 << 11);
    public static final int HOEDOWN_EXT_SPACE_HEADERS = (1 << 12);
    public static final int HOEDOWN_EXT_MATH_EXPLICIT = (1 << 13);

    /* negative flags */
    public static final int HOEDOWN_EXT_DISABLE_INDENTED_CODE = (1 << 14);
  }
}

@@ -254,17 +254,12 @@
 lic 
-interface
+enum
  Ext
@@ -276,32 +276,8 @@
     
-public static final int 
 HOED
@@ -290,18 +290,16 @@
 T_TABLES
- =
  (1 %3C%3C 0
@@ -303,38 +303,14 @@
 %3C 0)
-;
+,
 %0A    
-public static final int 
 HOED
@@ -324,26 +324,24 @@
 _FENCED_CODE
- =
  (1 %3C%3C 1);%0A 
@@ -341,38 +341,14 @@
 %3C 1)
-;
+,
 %0A    
-public static final int 
 HOED
@@ -364,18 +364,16 @@
 OOTNOTES
- =
  (1 %3C%3C 2
@@ -373,17 +373,17 @@
 (1 %3C%3C 2)
-;
+,
 %0A%0A    /*
@@ -416,32 +416,8 @@
     
-public static final int 
 HOED
@@ -432,18 +432,16 @@
 AUTOLINK
- =
  (1 %3C%3C 3
@@ -445,38 +445,14 @@
 %3C 3)
-;
+,
 %0A    
-public static final int 
 HOED
@@ -472,18 +472,16 @@
 ETHROUGH
- =
  (1 %3C%3C 4
@@ -485,38 +485,14 @@
 %3C 4)
-;
+,
 %0A    
-public static final int 
 HOED
@@ -508,18 +508,16 @@
 NDERLINE
- =
  (1 %3C%3C 5
@@ -521,38 +521,14 @@
 %3C 5)
-;
+,
 %0A    
-public static final int 
 HOED
@@ -544,18 +544,16 @@
 IGHLIGHT
- =
  (1 %3C%3C 6
@@ -557,38 +557,14 @@
 %3C 6)
-;
+,
 %0A    
-public static final int 
 HOED
@@ -576,18 +576,16 @@
 XT_QUOTE
- =
  (1 %3C%3C 7
@@ -589,38 +589,14 @@
 %3C 7)
-;
+,
 %0A    
-public static final int 
 HOED
@@ -614,18 +614,16 @@
 ERSCRIPT
- =
  (1 %3C%3C 8
@@ -627,38 +627,14 @@
 %3C 8)
-;
+,
 %0A    
-public static final int 
 HOED
@@ -645,18 +645,16 @@
 EXT_MATH
- =
  (1 %3C%3C 9
@@ -654,17 +654,17 @@
 (1 %3C%3C 9)
-;
+,
 %0A%0A    /*
@@ -687,32 +687,8 @@
     
-public static final int 
 HOED
@@ -712,18 +712,16 @@
 EMPHASIS
- =
  (1 %3C%3C 1
@@ -726,38 +726,14 @@
  11)
-;
+,
 %0A    
-public static final int 
 HOED
@@ -753,18 +753,16 @@
 _HEADERS
- =
  (1 %3C%3C 1
@@ -767,37 +767,13 @@
  12)
-;%0A    public static final int
+,%0A   
  HOE
@@ -794,18 +794,16 @@
 EXPLICIT
- =
  (1 %3C%3C 1
@@ -804,17 +804,17 @@
 1 %3C%3C 13)
-;
+,
 %0A%0A    /*
@@ -840,32 +840,8 @@
     
-public static final int 
 HOED
@@ -873,10 +873,8 @@
 CODE
- =
  (1 
@@ -881,14 +881,190 @@
 %3C%3C 14);%0A
+    %0A    private final int value;%0A    %0A    private Extensions (int value)%0A    %7B%0A      this.value = value;%0A    %7D%0A    %0A    public int getValue ()%0A    %7B%0A      return value;%0A    %7D%0A
   %7D%0A%7D%0A

convert MarkDown extension constants to enum to make it iterable