[SPEC2DEF/CMAKE]
authorJérôme Gardou <jerome.gardou@reactos.org>
Thu, 25 Sep 2014 18:25:02 +0000 (18:25 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Thu, 25 Sep 2014 18:25:02 +0000 (18:25 +0000)
 - add a way to enable "relay tracing" (à la wine) to modules.
This uses wine's TRACE routine, debug channel being "relay"
Use "WITH_RELAY" argument to cmake macro spec2def to activate.

svn path=/trunk/; revision=64281

reactos/cmake/gcc.cmake
reactos/include/reactos/stubs.h
reactos/tools/spec2def/spec2def.c

index cd6ce4a..9b92c7f 100644 (file)
@@ -306,14 +306,8 @@ endfunction()
 set(CMAKE_IMPLIB_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def <OBJECTS> --kill-at --output-lib=<TARGET>")
 set(CMAKE_IMPLIB_DELAYED_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def <OBJECTS> --kill-at --output-delaylib=<TARGET>")
 function(spec2def _dllname _spec_file)
 set(CMAKE_IMPLIB_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def <OBJECTS> --kill-at --output-lib=<TARGET>")
 set(CMAKE_IMPLIB_DELAYED_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def <OBJECTS> --kill-at --output-delaylib=<TARGET>")
 function(spec2def _dllname _spec_file)
-    # Do we also want to add importlib targets?
-    if(${ARGC} GREATER 2)
-        if(${ARGN} STREQUAL "ADD_IMPORTLIB")
-            set(__add_importlib TRUE)
-        else()
-            message(FATAL_ERROR "Wrong argument passed to spec2def, ${ARGN}")
-        endif()
-    endif()
+    
+    cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;WITH_RELAY" "" "" ${ARGN})
 
     # Get library basename
     get_filename_component(_file ${_dllname} NAME_WE)
 
     # Get library basename
     get_filename_component(_file ${_dllname} NAME_WE)
@@ -323,13 +317,17 @@ function(spec2def _dllname _spec_file)
         message(FATAL_ERROR "spec2def only takes spec files as input.")
     endif()
 
         message(FATAL_ERROR "spec2def only takes spec files as input.")
     endif()
 
+    if (__spec2def_WITH_RELAY)
+        set(__with_relay_arg "--with-tracing")
+    endif()
+
     # Generate exports def and C stubs file for the DLL
     add_custom_command(
         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
     # Generate exports def and C stubs file for the DLL
     add_custom_command(
         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
-        COMMAND native-spec2def -n=${_dllname} -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
+        COMMAND native-spec2def -n=${_dllname} -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
 
         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
 
-    if(__add_importlib)
+    if(__spec2def_ADD_IMPORTLIB)
         generate_import_lib(lib${_file} ${_dllname} ${_spec_file})
     endif()
 endfunction()
         generate_import_lib(lib${_file} ${_dllname} ${_spec_file})
     endif()
 endfunction()
index 322b89b..f81e53a 100644 (file)
@@ -1,13 +1,19 @@
 #include <stdarg.h>
 #define WIN32_NO_STATUS
 #include <windef.h>
 #include <stdarg.h>
 #define WIN32_NO_STATUS
 #include <windef.h>
-#include <winbase.h>
 
 #include <wine/config.h>
 #include <wine/exception.h>
 
 ULONG __cdecl DbgPrint(_In_z_ _Printf_format_string_ PCSTR Format, ...);
 
 
 #include <wine/config.h>
 #include <wine/exception.h>
 
 ULONG __cdecl DbgPrint(_In_z_ _Printf_format_string_ PCSTR Format, ...);
 
+VOID
+WINAPI
+RaiseException(_In_ DWORD dwExceptionCode,
+               _In_ DWORD dwExceptionFlags,
+               _In_ DWORD nNumberOfArguments,
+               _In_ CONST ULONG_PTR *lpArguments OPTIONAL);
+
 #define __wine_spec_unimplemented_stub(module, function) \
 { \
     ULONG_PTR args[2]; \
 #define __wine_spec_unimplemented_stub(module, function) \
 { \
     ULONG_PTR args[2]; \
index 0bb66a0..61357a2 100644 (file)
@@ -764,12 +764,20 @@ ParseFile(char* pcStart, FILE *fileDest, PFNOUTLINE OutputLine)
                     exp.nStackBytes += 8;
                     exp.anArgs[exp.nArgCount] = ARG_DBL;
                 }
                     exp.nStackBytes += 8;
                     exp.anArgs[exp.nArgCount] = ARG_DBL;
                 }
-                else if (CompareToken(pc, "ptr") ||
-                         CompareToken(pc, "str") ||
-                         CompareToken(pc, "wstr"))
+                else if (CompareToken(pc, "ptr"))
                 {
                     exp.nStackBytes += 4; // sizeof(void*) on x86
                 {
                     exp.nStackBytes += 4; // sizeof(void*) on x86
-                    exp.anArgs[exp.nArgCount] = ARG_PTR; // FIXME: handle strings
+                    exp.anArgs[exp.nArgCount] = ARG_PTR;
+                }
+                else if (CompareToken(pc, "str"))
+                {
+                    exp.nStackBytes += 4; // sizeof(void*) on x86
+                    exp.anArgs[exp.nArgCount] = ARG_STR;
+                }
+                else if (CompareToken(pc, "wstr"))
+                {
+                    exp.nStackBytes += 4; // sizeof(void*) on x86
+                    exp.anArgs[exp.nArgCount] = ARG_WSTR;
                 }
                 else if (CompareToken(pc, "int64"))
                 {
                 }
                 else if (CompareToken(pc, "int64"))
                 {