# HG changeset patch # User Max Samukha # Date 1277318083 -10800 # Node ID da423530122486ae4a4861803b183a0bcb245a26 # Parent 958e8b9a89bd2897eeaf60bf1ad5b601d07ad6dc Fixed VoidFunc. Updated to dmd.2.047. diff -r 958e8b9a89bd -r da4235301224 cmake/FindD.cmake --- a/cmake/FindD.cmake Fri Jun 11 20:09:25 2010 +0300 +++ b/cmake/FindD.cmake Wed Jun 23 21:34:43 2010 +0300 @@ -4,21 +4,21 @@ ## Find D compiler and parse its version. find_program(DC NAMES dmd ldc) -if (DC) +if (DC) get_filename_component(dc_path ${DC} PATH) if("${dc_path}" STREQUAL ${CMAKE_BINARY_DIR}) get_filename_component(DC ${DC} NAME) endif("${dc_path}" STREQUAL ${CMAKE_BINARY_DIR}) - exec_program(${DC} ARGS "" OUTPUT_VARIABLE d_output) + exec_program(${DC} ARGS "" OUTPUT_VARIABLE d_output) string(REGEX MATCH "Digital Mars D Compiler v[0-9]\\.[0-9]+" dmd_version "${d_output}") if (dmd_version) set(D_IS_MARS true) set(D_IS_DMD true) set(D_COMPILER_NAME "Digital Mars D Compiler") string(REGEX REPLACE "Digital Mars D Compiler v([0-9])\\.[0-9]+" "\\1" D_VERSION "${dmd_version}") - string(REGEX REPLACE "Digital Mars D Compiler v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${dmd_version}") + string(REGEX REPLACE "Digital Mars D Compiler v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${dmd_version}") else (dmd_version) - string(REGEX MATCH "LLVM-based D Compiler" is_ldc "${d_output}") + string(REGEX MATCH "LLVM-based D Compiler" is_ldc "${d_output}") if (is_ldc) exec_program(${DC} ARGS "--version" OUTPUT_VARIABLE d_output) string(REGEX MATCH "based on DMD v[0-9]\\.[0-9]+" ldc_version "${d_output}") @@ -28,17 +28,17 @@ set(D_IS_LLVM true) set(D_COMPILER_NAME "LLVM-based D Compiler") string(REGEX REPLACE "based on DMD v([0-9])\\.[0-9]+" "\\1" D_VERSION "${ldc_version}") - string(REGEX REPLACE "based on DMD v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${ldc_version}") + string(REGEX REPLACE "based on DMD v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${ldc_version}") else(ldc_version) message(FATAL_ERROR "LDC compiler found, but the version can not be processed") endif(ldc_version) - else (is_ldc) - message(FATAL_ERROR "D compiler are not found") + else (is_ldc) + message(FATAL_ERROR "D compiler is not found") endif(is_ldc) - endif(dmd_version) + endif(dmd_version) message(STATUS "D compiler found -- ${D_COMPILER_NAME} v${D_VERSION}.${D_FRONTEND}") else (DC) - message(FATAL_ERROR "D compliler are not found") + message(FATAL_ERROR "D compliler is not found") endif (DC) ## Get D compiler path. @@ -49,7 +49,7 @@ mark_as_advanced(dc_path_tmp) endif("${DC_PATH}" STREQUAL "") get_filename_component(dc_parent_dir ${DC_PATH} NAME) -if("${dc_parent_dir}" STREQUAL "bin") +if("${dc_parent_dir}" STREQUAL "bin") get_filename_component(DC_PATH ${DC_PATH} PATH) endif("${dc_parent_dir}" STREQUAL "bin") @@ -61,7 +61,7 @@ set(opt_tmp "ON") else(D_IS_MARS) set(opt_tmp "OFF") - endif(D_IS_MARS) + endif(D_IS_MARS) option(SINGLE_D_OBJECT "Build all d sources to one object file" ${opt_tmp}) if(D_IS_LLVM) set(D_FLAGS ${D_FLAGS} -singleobj) @@ -88,7 +88,7 @@ endif(D_IS_LLVM) if(CMAKE_HOST_WIN32) set(D_RELEASE_FLAGS ${D_RELEASE_FLAGS} -L/subsystem:windows) -endif(CMAKE_HOST_WIN32) +endif(CMAKE_HOST_WIN32) set(D_DEBUG_FLAGS ${D_DEBUG_FLAGS} ${D_DEBUG_FLAG}) # Unittest flags. @@ -107,11 +107,11 @@ set(D_LIB_SUFFIX .a) set(D_LIB_PREFIX lib) endif(D_IS_MARS) -elseif(CMAKE_HOST_UNIX) +elseif(CMAKE_HOST_UNIX) set(D_LIB_SUFFIX .a) set(D_LIB_PREFIX lib) set(D_OBJECT_SUFFIX .o) -endif(CMAKE_HOST_WIN32) +endif(CMAKE_HOST_WIN32) ##-------------------------------------------- ## Macros and functions. @@ -146,7 +146,7 @@ # Enclose with UNESCAPED quotes. This means we need to escape our # quotes once here, i.e. with \" set(${pathname} \"${${pathname}}\") - endif(CMAKE_HOST_WIN32) + endif(CMAKE_HOST_WIN32) endmacro(make_native_path) ## @@ -178,7 +178,7 @@ regex_safe_string(cbd_safe_tmp ${CMAKE_CURRENT_BINARY_DIR}) regex_safe_string(csd_safe_tmp ${CMAKE_CURRENT_SOURCE_DIR}) set(regexp_str_tmp "(${cbd_safe_tmp}/|${csd_safe_tmp}/|)(.+)") - string(REGEX REPLACE ${regexp_str_tmp} "\\2" ${path} "${${path}}") + string(REGEX REPLACE ${regexp_str_tmp} "\\2" ${path} "${${path}}") endmacro(obj_path path) ## Compile d files. @@ -188,7 +188,7 @@ macro(compile_d_files target objects_list) set(${objects_list}) set(tmp_dir_tmp ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir) - + set(type_tmp SOURCES) set(SOURCES_tmp ) set(FLAGS_tmp ) @@ -199,12 +199,12 @@ set(found_type_tmp) if(NOT found_type_tmp) foreach(param_tmp ${params_tmp}) - if(arg_tmp STREQUAL param_tmp) + if(arg_tmp STREQUAL param_tmp) set(type_tmp ${param_tmp}) set(found_type_tmp 1) break(param_tmp ${params_tmp}) endif(arg_tmp STREQUAL param_tmp) - endforeach(param_tmp ${params_tmp}) + endforeach(param_tmp ${params_tmp}) endif(NOT found_type_tmp) if(NOT found_type_tmp) set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp}) @@ -221,7 +221,7 @@ obj_path(d_source_tmp) set(d_obj_tmp ${tmp_dir_tmp}/${d_source_tmp}${D_OBJECT_SUFFIX}) set(${objects_list} ${${objects_list}} ${d_obj_tmp}) - get_filename_component(path_tmp ${d_obj_tmp} PATH) + get_filename_component(path_tmp ${d_obj_tmp} PATH) file(MAKE_DIRECTORY ${path_tmp}) set(d_obj_out_tmp ${d_obj_tmp}) obj_path(d_obj_out_tmp) @@ -264,7 +264,7 @@ obj_path(d_obj_out_tmp) set(parameters_tmp ${FLAGS_tmp} -c ${files${id_tmp}_tmp} -of${object_tmp}) set(parameters_list_file_tmp ${tmp_dir_tmp}/parameters${id_tmp}_obj) - if(CMAKE_HOST_WIN32) + if(CMAKE_HOST_WIN32) file(REMOVE ${parameters_list_file_tmp}) foreach(arg_tmp ${parameters_tmp}) file(APPEND ${parameters_list_file_tmp} "${arg_tmp}\n") @@ -323,21 +323,21 @@ ## Parse parameters list. set(params_tmp TYPE INCLUDES FLAGS SOURCES NO_DEPS_SOURCES OBJECTS LIBS LIB_PATHS DEPENDS OUTPUT_PATH) - + foreach(arg_tmp ${ARGN}) set(found_type_tmp) - if(${arg_tmp} STREQUAL "NOT_DETECT_DEPENDS") + if(${arg_tmp} STREQUAL "NOT_DETECT_DEPENDS") set(detect_deps_tmp 0) set(found_type_tmp 1) endif(${arg_tmp} STREQUAL "NOT_DETECT_DEPENDS") if(NOT found_type_tmp) foreach(param_tmp ${params_tmp}) - if(arg_tmp STREQUAL param_tmp) + if(arg_tmp STREQUAL param_tmp) set(type_tmp ${param_tmp}) set(found_type_tmp 1) break(param_tmp ${params_tmp}) endif(arg_tmp STREQUAL param_tmp) - endforeach(param_tmp ${params_tmp}) + endforeach(param_tmp ${params_tmp}) endif(NOT found_type_tmp) if(NOT found_type_tmp) set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp}) @@ -354,7 +354,7 @@ if(ARCHIVE_OUTPUT_DIRECTORY) set(output_name_tmp ${ARCHIVE_OUTPUT_DIRECTORY}) else(ARCHIVE_OUTPUT_DIRECTORY) - set(output_name_tmp ${CMAKE_CURRENT_BINARY_DIR}/lib) + set(output_name_tmp ${CMAKE_CURRENT_BINARY_DIR}/lib) endif(ARCHIVE_OUTPUT_DIRECTORY) endif(NOT OUTPUT_PATH_tmp) set(output_name_tmp ${output_name_tmp}/${D_LIB_PREFIX}${name}${D_LIB_SUFFIX}) @@ -364,7 +364,7 @@ if(RUNTIME_OUTPUT_DIRECTORY) set(output_name ${RUNTIME_OUTPUT_DIRECTORY}) else(RUNTIME_OUTPUT_DIRECTORY) - set(output_name_tmp ${CMAKE_CURRENT_BINARY_DIR}/bin) + set(output_name_tmp ${CMAKE_CURRENT_BINARY_DIR}/bin) endif(RUNTIME_OUTPUT_DIRECTORY) endif(NOT OUTPUT_PATH_tmp) set(output_name_tmp ${output_name_tmp}/${name}${CMAKE_EXECUTABLE_SUFFIX}) @@ -376,21 +376,21 @@ if(LIBRARY_OUTPUT_DIRECTORY) set(output_name_tmp ${LIBRARY_OUTPUT_DIRECTORY}) else(LIBRARY_OUTPUT_DIRECTORY) - set(output_name_tmp ${CMAKE_CURRENT_BINARY_DIR}/lib) + set(output_name_tmp ${CMAKE_CURRENT_BINARY_DIR}/lib) endif(LIBRARY_OUTPUT_DIRECTORY) endif(NOT OUTPUT_PATH_tmp) set(build_binary 1) set(output_name_tmp ${output_name_tmp}/${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}) set(link_flags_tmp ${compile_flags_tmp} -L-shared) - else("${TYPE_tmp}" STREQUAL "STATIC") + else("${TYPE_tmp}" STREQUAL "STATIC") message(FATAL_ERROR "D target ${TYPE_tmp} not supported") endif("${TYPE_tmp}" STREQUAL "STATIC") ## Include paths. foreach(inc_tmp ${INCLUDES_tmp} ${D_INCLUDES}) - set(compile_flags_tmp ${compile_flags_tmp} -I${inc_tmp}) + set(compile_flags_tmp ${compile_flags_tmp} -I${inc_tmp}) endforeach(inc_tmp ${INCLUDES_tmp} ${D_INCLUDES}) - + ## Libraries and paths of them. set(libs_tmp) if(build_binary_tmp) @@ -412,14 +412,14 @@ endforeach(lib_path_tmp ${LIB_PATHS_tmp} ${D_LIB_PATHS}) endif(D_IS_MARS AND CMAKE_HOST_WIN32) foreach(lib_tmp ${LIBS_tmp} ${D_LIBS}) - if(D_IS_MARS AND CMAKE_HOST_WIN32) + if(D_IS_MARS AND CMAKE_HOST_WIN32) set(link_flags_tmp ${link_flags_tmp} -L+${lib_tmp}) else(D_IS_MARS AND CMAKE_HOST_WIN32) set(link_flags_tmp ${link_flags_tmp} -L-l${lib_tmp}) endif(D_IS_MARS AND CMAKE_HOST_WIN32) endforeach(lib_tmp ${LIBS_tmp} ${D_LIBS}) endif(build_binary_tmp) - + set(not_obj_tmp ${ONE_BUILD_COMMAND}) ## Ldc not support -lib flag. if(ONE_BUILD_COMMAND AND ${TYPE_tmp} STREQUAL "STATIC" AND D_IS_LLVM) @@ -441,7 +441,7 @@ set(SOURCES_tmp ${tmp}) endif(detect_deps_tmp) set(SOURCES_tmp ${SOURCES_tmp} ${NO_DEPS_SOURCES_tmp}) - + set(used_ar_tmp) get_filename_component(output_path_tmp ${output_name_tmp} PATH) if (NOT not_obj_tmp) @@ -450,7 +450,7 @@ if(NOT D_IS_MARS AND ${TYPE_tmp} STREQUAL "STATIC") set(parameters_tmp rcs ${output_name_tmp} ${SOURCES_tmp} ${OBJECTS_tmp}) set(parameters_list_file_tmp ${tmp_dir_tmp}/parameters) - if(CMAKE_HOST_WIN32) + if(CMAKE_HOST_WIN32) file(REMOVE ${parameters_list_file_tmp}) foreach(arg_tmp ${parameters_tmp}) file(APPEND ${parameters_list_file_tmp} "${arg_tmp}\n") @@ -478,7 +478,7 @@ endif(D_IS_MARS) set(parameters_tmp ${compile_flags_tmp} ${link_flags_tmp} ${SOURCES_tmp} ${OBJECTS_tmp} -of${output_name_native_tmp}) set(parameters_list_file_tmp ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${name}.dir/parameters) - if(CMAKE_HOST_WIN32) + if(CMAKE_HOST_WIN32) file(REMOVE ${parameters_list_file_tmp}) foreach(arg_tmp ${parameters_tmp}) file(APPEND ${parameters_list_file_tmp} "${arg_tmp}\n") @@ -486,7 +486,7 @@ set(param_tmp @${parameters_list_file_tmp}) elseif(CMAKE_HOST_UNIX) set(param_tmp ${parameters_tmp}) - endif(CMAKE_HOST_WIN32) + endif(CMAKE_HOST_WIN32) #get_imported_files(depends_tmp ${SOURCES_tmp}) add_custom_command( OUTPUT ${output_name_tmp} @@ -531,10 +531,10 @@ execute_process(COMMAND ${DC} -c -o- -v ${compile_flags_tmp} ${ARGN} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE dc_output_tmp - + ) string(REGEX MATCHALL "import[^(]*([^)]*)" dc_output_tmp "${dc_output_tmp}") - + ## Initial filter. regex_safe_string(tmp ${CMAKE_CURRENT_SOURCE_DIR}) regex_safe_string(tmp2 ${CMAKE_CURRENT_BINARY_DIR}) @@ -547,7 +547,7 @@ ## Filtering. string(REPLACE "\\" "/" import_tmp ${import_tmp}) string(REGEX MATCH "(${regex_includes_tmp})" found "${import_tmp}") - if(CMAKE_HOST_WIN32) + if(CMAKE_HOST_WIN32) string(SUBSTRING "${import_tmp}" 1 2 first_sym_tmp) set(full_path_tmp) if(${first_sym_tmp} STREQUAL ":/") @@ -559,10 +559,10 @@ if(${first_sym_tmp} STREQUAL "/") set(full_path_tmp 1) endif(${first_sym_tmp} STREQUAL "/") - endif(CMAKE_HOST_WIN32) + endif(CMAKE_HOST_WIN32) if(found OR NOT full_path_tmp) - set(${imported} ${${imported}} ${import_tmp}) - endif(found OR NOT full_path_tmp) + set(${imported} ${${imported}} ${import_tmp}) + endif(found OR NOT full_path_tmp) endforeach(import_tmp ${dc_output_tmp}) endmacro(get_imported_files_old imported) @@ -584,7 +584,7 @@ if(NOT founded_tmp) set(${read_now_tmp}_tmp ${${read_now_tmp}_tmp} ${arg_tmp}) endif(NOT founded_tmp) - endforeach(arg_tmp ${ARGN}) + endforeach(arg_tmp ${ARGN}) regex_safe_string(include_tmp ${includes_tmp}) set(regex_include_tmp) set(is_first_tmp 1) @@ -596,9 +596,9 @@ endif(is_first_tmp) set(regex_includes_tmp ${regex_includes_tmp}${include_tmp}) endforeach(include_tmp ${include_tmp}) - foreach(path_tmp ${paths_tmp}) - file(TO_CMAKE_PATH path_tmp ${path_tmp}) - string(REGEX MATCH "(${regex_includes_tmp})[^/]*" found "${path_tmp}") + foreach(path_tmp ${paths_tmp}) + file(TO_CMAKE_PATH path_tmp ${path_tmp}) + string(REGEX MATCH "(${regex_includes_tmp})[^/]*" found "${path_tmp}") set(full_path_tmp 1) if(locale_tmp) string(SUBSTRING "${path_tmp}" 0 1 first_sym_tmp) @@ -608,9 +608,9 @@ endif(${first_sym_tmp} STREQUAL "/") endif(locale_tmp) if(NOT found AND full_path_tmp) - else(NOT found AND full_path_tmp) + else(NOT found AND full_path_tmp) set(${result} ${${result}} ${path_tmp}) - endif(NOT found AND full_path_tmp) + endif(NOT found AND full_path_tmp) endforeach(path_tmp ${paths_tmp}) endmacro(filter_paths ) diff -r 958e8b9a89bd -r da4235301224 d2/qt/core/QMetaObject.d --- a/d2/qt/core/QMetaObject.d Fri Jun 11 20:09:25 2010 +0300 +++ b/d2/qt/core/QMetaObject.d Wed Jun 23 21:34:43 2010 +0300 @@ -4,15 +4,16 @@ qt.QGlobal, qt.core.QObject, qtd.QtdObject, - std.algorithm, qtd.meta.Runtime, qtd.meta.Compiletime, qtd.Marshal, qtd.MOC, - std.string, + qtd.String, std.typetuple, std.c.stdlib; +import std.string : indexOf; + class QMetaArgument : Meta { } diff -r 958e8b9a89bd -r da4235301224 d2/qtd/Marshal.d --- a/d2/qtd/Marshal.d Fri Jun 11 20:09:25 2010 +0300 +++ b/d2/qtd/Marshal.d Wed Jun 23 21:34:43 2010 +0300 @@ -3,10 +3,9 @@ import std.traits, qtd.meta.Compiletime, + qtd.String, qtd.ctfe.Format; -import std.string : startsWith; - template isQObjectType(T) // { diff -r 958e8b9a89bd -r da4235301224 d2/qtd/Signal.d --- a/d2/qtd/Signal.d Fri Jun 11 20:09:25 2010 +0300 +++ b/d2/qtd/Signal.d Wed Jun 23 21:34:43 2010 +0300 @@ -13,18 +13,18 @@ import core.stdc.stdlib : crealloc = realloc, cfree = free; import core.stdc.string : memmove; +import std.string : strip; import core.thread, core.exception, - std.algorithm, std.typetuple, std.conv, std.traits, - std.string, qt.QGlobal, + qtd.String, qtd.Marshal, qtd.meta.Compiletime, qtd.ctfe.Format; @@ -126,12 +126,12 @@ res ~= "protected "; res ~= "Args[0] " ~ name; - + if (signalKind == SignalKind.BindQtSignal) res ~= "_emit"; res ~= "("; - + foreach (i; 1..argCount) { auto iStr = to!string(i); diff -r 958e8b9a89bd -r da4235301224 d2/qtd/String.d --- a/d2/qtd/String.d Fri Jun 11 20:09:25 2010 +0300 +++ b/d2/qtd/String.d Wed Jun 23 21:34:43 2010 +0300 @@ -75,5 +75,16 @@ })); +// to work around the standard startsWith not being runnable at compile time. +size_t startsWith(string s, string pattern) +{ + if (pattern.length <= s.length && s[0..pattern.length] == pattern) + return pattern.length; + return 0; +} + + + + diff -r 958e8b9a89bd -r da4235301224 d2/qtd/meta/Compiletime.d --- a/d2/qtd/meta/Compiletime.d Fri Jun 11 20:09:25 2010 +0300 +++ b/d2/qtd/meta/Compiletime.d Wed Jun 23 21:34:43 2010 +0300 @@ -6,13 +6,12 @@ module qtd.meta.Compiletime; import + qtd.String, std.traits, std.conv, std.variant, std.typetuple; -import std.string : startsWith; - /** */ enum standardNamespace = "qtd"; diff -r 958e8b9a89bd -r da4235301224 include/qtd_core.h --- a/include/qtd_core.h Fri Jun 11 20:09:25 2010 +0300 +++ b/include/qtd_core.h Wed Jun 23 21:34:43 2010 +0300 @@ -9,6 +9,7 @@ #include #define QTD_EXTERN extern "C" +QTD_EXTERN typedef void (*VoidFunc)(); #ifdef WIN32 @@ -17,8 +18,6 @@ #ifdef CPP_SHARED - QTD_EXTERN typedef void (*VoidFunc)(); - #define QTD_EXPORT_DECL(MODULE, TYPE, NAME, ARGS) \ QTD_EXTERN typedef TYPE (*qtd_##NAME##_t)ARGS; \ QTD_EXTERN { extern QTD_##MODULE##_DLL_PUBLIC qtd_##NAME##_t qtd_##NAME; }