mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 04:52:06 +03:00
general cmark cleanup
This commit is contained in:
parent
801bf92893
commit
c4473250a0
5
i/n/a.h
5
i/n/a.h
@ -293,6 +293,11 @@
|
||||
void*
|
||||
u3a_malloc(size_t len_i);
|
||||
|
||||
/* u3a_calloc(): aligned storage measured in bytes.
|
||||
*/
|
||||
void*
|
||||
u3a_calloc(size_t num_i, size_t len_i);
|
||||
|
||||
/* u3a_realloc(): aligned realloc in bytes.
|
||||
*/
|
||||
void*
|
||||
|
20
j/g/dawn.c
20
j/g/dawn.c
@ -53,7 +53,7 @@ u3_noun list_item_to_noun(cmark_node * nod)
|
||||
|
||||
u3_noun code_block_to_noun(cmark_node * nod)
|
||||
{
|
||||
u3_atom str = u3i_string(nod->string_content.ptr); /* XX u3i_bytes */
|
||||
u3_atom str = u3i_string((c3_c *) nod->string_content.ptr); /* XX u3i_bytes */
|
||||
u3_noun res =
|
||||
u3nt(
|
||||
c3__code,
|
||||
@ -62,7 +62,7 @@ u3_noun code_block_to_noun(cmark_node * nod)
|
||||
u3_nul,
|
||||
nod->as.code.fence_char,
|
||||
nod->as.code.fence_length,
|
||||
u3i_tape(nod->as.code.info.ptr)
|
||||
u3i_tape((c3_c *) nod->as.code.info.ptr)
|
||||
)
|
||||
: u3_nul,
|
||||
u3qe_lore(str));
|
||||
@ -72,7 +72,7 @@ u3_noun code_block_to_noun(cmark_node * nod)
|
||||
|
||||
u3_noun html_to_noun(cmark_node * nod)
|
||||
{
|
||||
u3_atom str = u3i_string(nod->string_content.ptr); /* XX u3i_bytes */
|
||||
u3_atom str = u3i_string((c3_c *) nod->string_content.ptr); /* XX u3i_bytes */
|
||||
u3_noun res = u3nc(c3__html, u3qe_lore(str));
|
||||
u3z(str);
|
||||
return res;
|
||||
@ -101,7 +101,7 @@ u3_noun reference_def_to_noun(cmark_node * nod)
|
||||
|
||||
u3_noun text_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(u3_blip, u3i_tape(cmark_chunk_to_cstr(&nod->as.literal)));
|
||||
return u3nc(u3_blip, u3i_tape((c3_c *) cmark_chunk_to_cstr(&nod->as.literal)));
|
||||
}
|
||||
|
||||
u3_noun softbreak_to_noun(cmark_node * nod) // XXX
|
||||
@ -116,12 +116,12 @@ u3_noun linebreak_to_noun(cmark_node * nod)
|
||||
|
||||
u3_noun inline_code_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(c3__code, u3i_tape(cmark_chunk_to_cstr(&nod->as.literal)));
|
||||
return u3nc(c3__code, u3i_tape((c3_c *) cmark_chunk_to_cstr(&nod->as.literal)));
|
||||
}
|
||||
|
||||
u3_noun inline_html_to_noun(cmark_node * nod) // XXX
|
||||
{
|
||||
return u3nc(c3__htmt, u3i_string(cmark_chunk_to_cstr(&nod->as.literal)));
|
||||
return u3nc(c3__htmt, u3i_string((c3_c *) cmark_chunk_to_cstr(&nod->as.literal)));
|
||||
}
|
||||
|
||||
u3_noun emph_to_noun(cmark_node * nod)
|
||||
@ -141,10 +141,10 @@ u3_noun link_to_noun(cmark_node * nod)
|
||||
u3nt(
|
||||
c3__link,
|
||||
nod->as.link.url
|
||||
? u3i_tape(nod->as.link.url)
|
||||
? u3i_tape((c3_c *) nod->as.link.url)
|
||||
: u3_nul,
|
||||
nod->as.link.title
|
||||
? u3nc(u3_nul, u3i_tape(nod->as.link.title))
|
||||
? u3nc(u3_nul, u3i_tape((c3_c *) nod->as.link.title))
|
||||
: u3_nul),
|
||||
list_elems_to_noun(nod));
|
||||
}
|
||||
@ -155,9 +155,9 @@ u3_noun image_to_noun(cmark_node * nod)
|
||||
u3nc(
|
||||
u3nt(
|
||||
c3__blot,
|
||||
u3i_tape(nod->as.link.url),
|
||||
u3i_tape((c3_c *) nod->as.link.url),
|
||||
nod->as.link.title
|
||||
? u3nc(u3_nul, u3i_tape(nod->as.link.title))
|
||||
? u3nc(u3_nul, u3i_tape((c3_c *) nod->as.link.title))
|
||||
: u3_nul),
|
||||
list_elems_to_noun(nod));
|
||||
}
|
||||
|
14
n/a.c
14
n/a.c
@ -517,6 +517,20 @@ u3a_wfree(void* tox_v)
|
||||
u3t_off(mal_o);
|
||||
}
|
||||
|
||||
/* u3a_calloc(): allocate and zero-initialize array
|
||||
*/
|
||||
void*
|
||||
u3a_calloc(size_t num_i, size_t len_i)
|
||||
{
|
||||
size_t byt_i = num_i * len_i;
|
||||
c3_w* out_w = u3a_malloc(byt_i);
|
||||
memset(out_w, 0, byt_i);
|
||||
|
||||
fprintf(stderr,"callocing %d %d\r\n",num_i,len_i);
|
||||
|
||||
return out_w;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* u3a_malloc(): allocate storage measured in bytes.
|
||||
*/
|
||||
|
@ -13,10 +13,10 @@ set(PROJECT_VERSION_PATCH 1)
|
||||
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} )
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(api_test)
|
||||
add_subdirectory(man)
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
#add_subdirectory(api_test)
|
||||
#add_subdirectory(man)
|
||||
#enable_testing()
|
||||
#add_subdirectory(test)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
|
||||
|
@ -34,13 +34,14 @@ set(LIBRARY_SOURCES
|
||||
${HEADERS}
|
||||
)
|
||||
|
||||
set(PROGRAM "cmark")
|
||||
set(PROGRAM_SOURCES
|
||||
${LIBRARY_SOURCES}
|
||||
main.c
|
||||
)
|
||||
#set(PROGRAM "cmark")
|
||||
#set(PROGRAM_SOURCES
|
||||
# ${LIBRARY_SOURCES}
|
||||
# main.c
|
||||
# )
|
||||
|
||||
include_directories(. html ${CMAKE_CURRENT_BINARY_DIR})
|
||||
include_directories(../../../i)
|
||||
|
||||
set(RE2C re2c)
|
||||
if (MSVC)
|
||||
@ -62,12 +63,12 @@ endif(MSVC)
|
||||
|
||||
include (GenerateExportHeader)
|
||||
|
||||
add_executable(${PROGRAM} ${PROGRAM_SOURCES})
|
||||
add_compiler_export_flags()
|
||||
|
||||
# Disable the PUBLIC declarations when compiling the executable:
|
||||
set_target_properties(${PROGRAM} PROPERTIES
|
||||
COMPILE_FLAGS -DCMARK_STATIC_DEFINE)
|
||||
#add_executable(${PROGRAM} ${PROGRAM_SOURCES})
|
||||
#add_compiler_export_flags()
|
||||
#
|
||||
## Disable the PUBLIC declarations when compiling the executable:
|
||||
#set_target_properties(${PROGRAM} PROPERTIES
|
||||
# COMPILE_FLAGS -DCMARK_STATIC_DEFINE)
|
||||
|
||||
# Check integrity of node structure when compiled as debug:
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DCMARK_DEBUG_NODES")
|
||||
@ -90,15 +91,15 @@ set_property(TARGET ${LIBRARY}
|
||||
generate_export_header(${LIBRARY}
|
||||
BASE_NAME ${PROJECT_NAME})
|
||||
|
||||
if (MSVC)
|
||||
set_property(TARGET ${PROGRAM}
|
||||
APPEND PROPERTY LINK_FLAGS /INCREMENTAL:NO)
|
||||
endif(MSVC)
|
||||
#if (MSVC)
|
||||
# set_property(TARGET ${PROGRAM}
|
||||
# APPEND PROPERTY LINK_FLAGS /INCREMENTAL:NO)
|
||||
#endif(MSVC)
|
||||
|
||||
install(TARGETS ${PROGRAM} # SHARED ${LIBRARY}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
#install(TARGETS ${PROGRAM} # SHARED ${LIBRARY}
|
||||
# RUNTIME DESTINATION bin
|
||||
# LIBRARY DESTINATION lib
|
||||
# )
|
||||
|
||||
install(FILES cmark.h ${CMAKE_CURRENT_BINARY_DIR}/cmark_export.h
|
||||
DESTINATION include
|
||||
|
@ -15,3 +15,35 @@
|
||||
#else
|
||||
#define CMARK_ATTRIBUTE(list)
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#ifndef U3_ALL
|
||||
#define U3_ALL
|
||||
#define malloc(a) u3a_malloc(a)
|
||||
#define calloc(a,b) u3a_calloc(a,b)
|
||||
#define realloc(a,b) u3a_realloc(a,b)
|
||||
#define free(a) u3a_free(a)
|
||||
/* From i/n/a.h
|
||||
*/
|
||||
/* u3a_malloc(): aligned storage measured in bytes.
|
||||
*/
|
||||
void*
|
||||
u3a_malloc(size_t len_i);
|
||||
|
||||
/* u3a_calloc(): aligned storage measured in bytes.
|
||||
*/
|
||||
void*
|
||||
u3a_calloc(size_t num_i, size_t len_i);
|
||||
|
||||
/* u3a_realloc(): aligned realloc in bytes.
|
||||
*/
|
||||
void*
|
||||
u3a_realloc(void* lag_v, size_t len_i);
|
||||
|
||||
/* u3a_free(): free for aligned malloc.
|
||||
*/
|
||||
void
|
||||
u3a_free(void* tox_v);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user