change init_contrib API
This commit is contained in:
parent
3e5fd1a54b
commit
6a038bc926
|
@ -7,7 +7,7 @@ if (REGEX_FOUND)
|
||||||
|
|
||||||
file(GLOB PICRIN_REGEX_SOURCES ${PROJECT_SOURCE_DIR}/contrib/10.regexp/src/*.c)
|
file(GLOB PICRIN_REGEX_SOURCES ${PROJECT_SOURCE_DIR}/contrib/10.regexp/src/*.c)
|
||||||
|
|
||||||
list(APPEND PICRIN_CONTRIB_INITS "void pic_init_regexp(pic_state *)\; pic_init_regexp(pic)\;")
|
list(APPEND PICRIN_CONTRIB_INITS regexp)
|
||||||
list(APPEND PICRIN_CONTRIB_LIBRARIES ${REGEX_LIBRARIES})
|
list(APPEND PICRIN_CONTRIB_LIBRARIES ${REGEX_LIBRARIES})
|
||||||
list(APPEND PICRIN_CONTRIB_SOURCES ${PICRIN_REGEX_SOURCES})
|
list(APPEND PICRIN_CONTRIB_SOURCES ${PICRIN_REGEX_SOURCES})
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -3,5 +3,3 @@ list(SORT CONTRIBS)
|
||||||
foreach(contrib ${CONTRIBS})
|
foreach(contrib ${CONTRIBS})
|
||||||
include(${contrib})
|
include(${contrib})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
add_definitions("-DPIC_CONTRIB_INITS=${PICRIN_CONTRIB_INITS}")
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
print <<EOL;
|
||||||
|
/**
|
||||||
|
* !!NOTICE!!
|
||||||
|
* This file was automatically generated by mkinit.pl, and includes all of
|
||||||
|
* the prelude files required by Picrin. PLEASE DO NOT EDIT THIS FILE, changes
|
||||||
|
* will be overwritten the next time the script runs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "picrin.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
pic_init_contrib(pic_state *pic)
|
||||||
|
{
|
||||||
|
EOL
|
||||||
|
|
||||||
|
foreach my $lib (@ARGV) {
|
||||||
|
print " void pic_init_$lib(pic_state *);\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print;
|
||||||
|
|
||||||
|
foreach my $lib (@ARGV) {
|
||||||
|
print " pic_init_$lib(pic);\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print <<EOL;
|
||||||
|
}
|
||||||
|
EOL
|
|
@ -1,8 +1,9 @@
|
||||||
|
find_package(Perl REQUIRED)
|
||||||
|
|
||||||
# xfile
|
# xfile
|
||||||
set(XFILE_SOURCES extlib/xfile/xfile.c)
|
set(XFILE_SOURCES extlib/xfile/xfile.c)
|
||||||
|
|
||||||
# piclib
|
# piclib
|
||||||
find_package(Perl REQUIRED)
|
|
||||||
set(PICLIB_SOURCE ${PROJECT_SOURCE_DIR}/src/load_piclib.c)
|
set(PICLIB_SOURCE ${PROJECT_SOURCE_DIR}/src/load_piclib.c)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${PICLIB_SOURCE}
|
OUTPUT ${PICLIB_SOURCE}
|
||||||
|
@ -11,9 +12,18 @@ add_custom_command(
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# contrib
|
||||||
|
set(CONTRIB_INIT ${PROJECT_SOURCE_DIR}/src/init_contrib.c)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${CONTRIB_INIT}
|
||||||
|
COMMAND ${PERL_EXECUTABLE} etc/mkinit.pl ${PICRIN_CONTRIB_INITS} > ${CONTRIB_INIT}
|
||||||
|
DEPENDS ${PICRIN_CONTRIB_SOURCES}
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
# build!
|
# build!
|
||||||
file(GLOB PICRIN_SOURCES ${PROJECT_SOURCE_DIR}/src/*.c)
|
file(GLOB PICRIN_SOURCES ${PROJECT_SOURCE_DIR}/src/*.c)
|
||||||
add_library(picrin SHARED ${PICRIN_SOURCES} ${PICLIB_SOURCE} ${XFILE_SOURCES} ${PICRIN_CONTRIB_SOURCES})
|
add_library(picrin SHARED ${PICRIN_SOURCES} ${PICLIB_SOURCE} ${XFILE_SOURCES} ${PICRIN_CONTRIB_SOURCES} ${CONTRIB_INIT})
|
||||||
target_link_libraries(picrin m ${PICRIN_CONTRIB_LIBRARIES})
|
target_link_libraries(picrin m ${PICRIN_CONTRIB_LIBRARIES})
|
||||||
|
|
||||||
# install
|
# install
|
||||||
|
|
|
@ -31,15 +31,10 @@ void pic_init_load(pic_state *);
|
||||||
void pic_init_write(pic_state *);
|
void pic_init_write(pic_state *);
|
||||||
void pic_init_read(pic_state *);
|
void pic_init_read(pic_state *);
|
||||||
void pic_init_dict(pic_state *);
|
void pic_init_dict(pic_state *);
|
||||||
|
void pic_init_contrib(pic_state *);
|
||||||
|
|
||||||
void pic_load_piclib(pic_state *);
|
void pic_load_piclib(pic_state *);
|
||||||
|
|
||||||
void
|
|
||||||
pic_init_contrib(pic_state *pic)
|
|
||||||
{
|
|
||||||
PIC_CONTRIB_INITS
|
|
||||||
}
|
|
||||||
|
|
||||||
#define push_sym(pic, name, list) \
|
#define push_sym(pic, name, list) \
|
||||||
pic_push(pic, pic_symbol_value(pic_intern_cstr(pic, name)), list)
|
pic_push(pic, pic_symbol_value(pic_intern_cstr(pic, name)), list)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue