if(NOT PAPAGENO_TESTING_ENABLED)
return()
endif()
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
add_library(
papageno_char_strings
papageno_char_strings.c
)
target_link_libraries(
papageno_char_strings
papageno
)
function(ppg_generate_test)
set(multi_value_args "")
set(one_value_args "NAME;EXECUTABLE")
set(options "")
cmake_parse_arguments(args "${options}" "${one_value_args}"
"${multi_value_args}" ${ARGN} )
if("${PAPAGENO_PLATFORM_ACTUAL}" STREQUAL "avr-gcc")
add_test(
NAME "${args_NAME}"
COMMAND ${CMAKE_COMMAND} "-DCMD=${PAPAGENO_RUN_WRAPPER};${args_EXECUTABLE}"
-P "${CMAKE_CURRENT_SOURCE_DIR}/TestAndCheck.script.cmake"
${args_UNPARSED_ARGUMENTS}
)
else()
add_test(
NAME "${args_NAME}"
COMMAND ${PAPAGENO_RUN_WRAPPER} "${args_EXECUTABLE}"
${args_UNPARSED_ARGUMENTS}
)
endif()
endfunction()
function(ppg_add_test name)
set(multi_value_args "")
set(one_value_args "COMPILE_DEFINITIONS;LINK_LIBRARIES")
set(options "")
cmake_parse_arguments(args "${options}" "${one_value_args}"
"${multi_value_args}" ${ARGN} )
set(code_file "${CMAKE_CURRENT_SOURCE_DIR}/${name}/${name}.c")
# Add the normal test executable
#
set(run_target_name "${name}_run")
add_executable(
"${run_target_name}"
"${code_file}"
)
set_target_properties(
"${run_target_name}"
PROPERTIES COMPILE_FLAGS
"${args_COMPILE_DEFINITIONS}"
)
target_link_libraries(
"${run_target_name}"
papageno_char_strings
)
if(DEFINED args_LINK_LIBRARIES)
target_link_libraries(
"${run_target_name}"
"${args_LINK_LIBRARIES}"
)
endif()
ppg_generate_test(
NAME "${run_target_name}"
EXECUTABLE "${run_target_name}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
if(PAPAGENO_TEST_COVERAGE)
SETUP_TARGET_FOR_JOINT_COVERAGE(
NAME "${run_target_name}_coverage"
EXECUTABLE "${run_target_name}"
DEPENDENCIES "${run_target_name}"
)
endif()
endfunction()
function(ppg_add_compiler_test name)
if(NOT PAPAGENO_BUILD_GLOCKENSPIEL)
return()
endif()
set(multi_value_args "")
set(one_value_args "COMPILE_DEFINITIONS;LINK_LIBRARIES")
set(options "")
cmake_parse_arguments(args "${options}" "${one_value_args}"
"${multi_value_args}" ${ARGN})
# Add the normal test executable
#
set(run_target_name "${name}_compiled")
set(ppg_file "${CMAKE_CURRENT_SOURCE_DIR}/${name}/${name}_ppg.h")
set(code_file "${CMAKE_CURRENT_BINARY_DIR}/${name}/${name}_compiler_run.c")
set(compile_output_file "${CMAKE_CURRENT_BINARY_DIR}/${name}/${name}_ppg_compiled.c")
set(PPG_CS_COMPILED_CODE_INCLUDE_FILE "\"${compile_output_file}\"")
ppg_get_test_file_defines(
"${name}"
"functions;actions;context_initialization;tests;token_tree;includes;layers;ppg"
)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/test_with_compile.c.in" "${code_file}")
if(CMAKE_HOST_WIN32)
set(glockenspiel_executable_basename "glockenspiel.exe")
else()
set(glockenspiel_executable_basename "glockenspiel")
endif()
add_custom_command(
OUTPUT "${compile_output_file}"
DEPENDS "${ppg_file}" glockenspiel
COMMAND ${CMAKE_BINARY_DIR}/glockenspiel/${glockenspiel_executable_basename} -I "${CMAKE_CURRENT_SOURCE_DIR}/${name}" -i "${ppg_file}" -o "${compile_output_file}" --symbols_prefix "s" --macros_prefix "m"
# --no_join_note_sequences
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${name}"
)
add_custom_target("${run_target_name}_compile" DEPENDS "${compile_output_file}")
# set_source_files_properties("${compile_output_file}" PROPERTIES GENERATED TRUE)
add_dependencies(
"${run_target_name}_compile"
glockenspiel
)
add_executable(
"${run_target_name}"
"${code_file}"
)
add_dependencies(
"${run_target_name}"
"${run_target_name}_compile"
)
set_target_properties(
"${run_target_name}"
PROPERTIES COMPILE_FLAGS
"${args_COMPILE_DEFINITIONS}"
)
target_link_libraries(
"${run_target_name}"
papageno_char_strings
)
if(DEFINED args_LINK_LIBRARIES)
target_link_libraries(
"${run_target_name}"
"${args_LINK_LIBRARIES}"
)
endif()
ppg_generate_test(
NAME "${run_target_name}"
EXECUTABLE "${run_target_name}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
set_tests_properties("${run_target_name}" PROPERTIES DEPENDS "${run_target_name}_compile")
if(PAPAGENO_TEST_COVERAGE)
SETUP_TARGET_FOR_JOINT_COVERAGE(
NAME "${run_target_name}_coverage"
EXECUTABLE "${run_target_name}"
DEPENDENCIES "${run_target_name}"
)
endif()
endfunction()
macro(ppg_get_test_file_defines
name_
type_list_
)
foreach(type ${type_list_})
set(include_file "${CMAKE_CURRENT_SOURCE_DIR}/${name}/${name_}_${type}.h")
if(NOT EXISTS "${include_file}")
set(include_file "${CMAKE_CURRENT_SOURCE_DIR}/default_${type}.h")
endif()
string(TOUPPER "${type}" type_upper)
set(define_name "PPG_CS_${type_upper}_INCLUDE_FILE")
file(RELATIVE_PATH include_file_rel "${CMAKE_CURRENT_SOURCE_DIR}" "${include_file}")
set(${define_name} "\"${include_file_rel}\"")
endforeach()
endmacro()
function(ppg_add_test_full name)
ppg_add_compiler_test("${name}")
ppg_add_test_with_compression("${name}")
endfunction()
function(ppg_add_test_with_compression name)
set(multi_value_args "")
set(one_value_args "COMPILE_DEFINITIONS;LINK_LIBRARIES")
set(options "")
cmake_parse_arguments(args "${options}" "${one_value_args}"
"${multi_value_args}" ${ARGN} )
set(code_file "${CMAKE_CURRENT_SOURCE_DIR}/test_with_compression.c.in")
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
ppg_get_test_file_defines(
"${name}"
"functions;actions;context_initialization;tests;token_tree;includes;layers"
)
# message("file_defines: ${file_defines}")
# Add the normal test executable
#
set(run_target_name "${name}_run")
set(run_target_name_c "${CMAKE_CURRENT_BINARY_DIR}/${name}/${name}_compression_run.c")
configure_file("${code_file}" "${run_target_name_c}")
add_executable(
"${run_target_name}"
"${run_target_name_c}"
)
set_target_properties(
"${run_target_name}"
PROPERTIES COMPILE_FLAGS
"${args_COMPILE_DEFINITIONS}"
)
target_link_libraries(
"${run_target_name}"
papageno_char_strings
)
if(DEFINED args_LINK_LIBRARIES)
target_link_libraries(
"${run_target_name}"
"${args_LINK_LIBRARIES}"
)
endif()
ppg_generate_test(
NAME "${run_target_name}"
EXECUTABLE "${run_target_name}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
if(PAPAGENO_TEST_COVERAGE)
SETUP_TARGET_FOR_JOINT_COVERAGE(
NAME "${run_target_name}_coverage"
EXECUTABLE "${run_target_name}"
DEPENDENCIES "${run_target_name}"
)
endif()
# Add an executable that compresses the context
#
set(build_compress_executable_target_name "${name}_compress_build_executable")
set(compressed_code_file "${CMAKE_CURRENT_BINARY_DIR}/${name}/${build_compress_executable_target_name}_compressed_code.h")
set(build_compress_executable_target_name_c "${CMAKE_CURRENT_BINARY_DIR}/${name}/${build_compress_executable_target_name}.c")
configure_file("${code_file}" "${build_comp
没有合适的资源?快使用搜索试试~ 我知道了~
(源码)基于C语言的Papageno字符序列处理系统.zip
共482个文件
hpp:279个
h:95个
c:50个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 135 浏览量
2024-11-26
03:01:06
上传
评论
收藏 680KB ZIP 举报
温馨提示
# 基于C语言的Papageno字符序列处理系统 ## 项目简介 Papageno是一个高级的字符序列模式匹配库,旨在通过定义字符模式并分配相应的动作,实现当字符或整个模式匹配时触发特定动作的功能。该库受音乐和幻想文学中的魔法乐器启发,适用于多种应用场景,如可编程键盘、MIDI乐器、电脑游戏等。 ## 项目的主要特性和功能 模式定义支持定义包含单音符、和弦和音符集群的模式,并分配相应的动作。 动作触发当模式匹配时,触发用户定义的动作。 多输入支持适用于多种输入设备,如键盘、鼠标等。 层系统支持多层模式定义,不同层可以有不同的动作。 信号处理支持在模式匹配、匹配中断和超时等情况下触发信号回调。 压缩支持支持数据结构的压缩,减少内存占用。 ## 安装使用步骤 1. 复制仓库 sh cd papageno.git 2. 构建项目 sh mkdir p buildrelease
资源推荐
资源详情
资源评论
收起资源包目录
(源码)基于C语言的Papageno字符序列处理系统.zip (482个子文件)
ppg_compression.c 17KB
papageno_char_strings.c 16KB
ppg_pattern_matching_detail.c 15KB
ppg_token_detail.c 13KB
ppg_cluster.c 13KB
ppg_active_tokens_detail.c 11KB
ppg_note_detail.c 11KB
ppg_sequence.c 10KB
ppg_event_buffer_detail.c 9KB
ppg_aggregate_detail.c 8KB
ppg_chord.c 8KB
test_leader_sequences.c 7KB
large_systems.c 6KB
ppg_bitfield.c 6KB
ppg_global.c 6KB
ppg_pattern_detail.c 6KB
test_layers.c 5KB
test_chords.c 5KB
test_token_precedence.c 5KB
test_clusters.c 5KB
ppg_context_detail.c 4KB
test_strict_notes.c 4KB
context_switching.c 4KB
ppg_timeout.c 4KB
ppg_furcation_detail.c 4KB
ppg_compression_detail.c 3KB
ppg_leader_sequences.c 3KB
fallback.c 3KB
test_note_lines.c 3KB
ppg_event_buffer.c 3KB
ppg_event.c 3KB
ppg_tap_dance.c 3KB
enable_disable_timeout.c 3KB
ppg_note.c 3KB
enable_disable.c 3KB
ppg_context.c 3KB
ppg_global_detail.c 3KB
large_systems_2.c 3KB
ppg_time.c 2KB
test_abort_trigger.c 2KB
ppg_token_vtable_detail.c 2KB
ppg_pattern.c 2KB
ppg_time_detail.c 1KB
ppg_statistics.c 1KB
ppg_malloc_detail.c 1KB
ppg_signal_detail.c 1KB
ppg_action.c 1KB
ppg_debug.c 1KB
ppg_input_detail.c 799B
ppg_input.c 395B
CodeCoverage.cmake 11KB
TestingWithCompression.script.cmake 2KB
Toolchain-avr-gcc.cmake 2KB
platform_atmega32u4.cmake 1KB
platform_atmega1280.cmake 1KB
platform_generic.cmake 930B
TestAndCheck.script.cmake 451B
compiler.cmdline 791B
GLS_Parser.yacc.cpp 74KB
GLS_Parser.lex.cpp 65KB
GLS_CommandLineGengetopt.cpp 56KB
GLS_Global.cpp 24KB
GLS_Pattern.cpp 10KB
GLS_Aggregate.cpp 5KB
GLS_Token.cpp 5KB
GLS_Settings.cpp 4KB
GLS_Defaults.cpp 4KB
GLS_Phrase.cpp 3KB
GLS_Alias.cpp 3KB
GLS_Compiler.cpp 3KB
GLS_Cluster.cpp 3KB
GLS_Note.cpp 2KB
GLS_NextEntity.cpp 2KB
GLS_Sequence.cpp 2KB
GLS_Input.cpp 2KB
GLS_ParserToken.cpp 1KB
GLS_Chord.cpp 1KB
GLS_Node.cpp 850B
GLS_LocationOfDefinition.cpp 831B
GLS_CommandLine.cpp 665B
GLS_Action.cpp 541B
papageno_char_strings.h 13KB
ppg_token_detail.h 8KB
ppg_global.h 5KB
ppg_token.h 4KB
ppg_debug.h 4KB
ppg_note.h 3KB
ppg_leader_sequences.h 3KB
ppg_bitfield.h 3KB
clusters_tests.h 3KB
ppg_cluster.h 3KB
ppg_chord.h 3KB
chords_tests.h 3KB
ppg_event_buffer_detail.h 3KB
ppg_event.h 3KB
ppg_tap_dance.h 3KB
ppg_action.h 3KB
ppg_time.h 3KB
ppg_context_detail.h 3KB
ppg_sequence.h 3KB
共 482 条
- 1
- 2
- 3
- 4
- 5
资源评论
t0_54coder
- 粉丝: 2502
- 资源: 5535
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功