mirror of
https://github.com/meekrosoft/fff
synced 2026-01-23 00:15:59 +01:00
Merge remote-tracking branch 'upstream/master' into refactorings
This commit is contained in:
10
fakegen.rb
10
fakegen.rb
@@ -199,7 +199,7 @@ def define_reset_fake_helper
|
||||
puts
|
||||
putd_backslash "#define DEFINE_RESET_FUNCTION(FUNCNAME)"
|
||||
indent {
|
||||
putd_backslash "void FUNCNAME##_reset(){"
|
||||
putd_backslash "void FUNCNAME##_reset(void){"
|
||||
indent {
|
||||
putd_backslash "memset(&FUNCNAME##_fake, 0, sizeof(FUNCNAME##_fake));"
|
||||
putd_backslash "FUNCNAME##_fake.arg_history_len = FFF_ARG_HISTORY_LEN;"
|
||||
@@ -315,11 +315,12 @@ def output_variables(arg_count, has_varargs, is_value_function)
|
||||
output_custom_function_array(arg_count, has_varargs, is_value_function)
|
||||
}
|
||||
putd_backslash "extern FUNCNAME##_Fake FUNCNAME##_fake;"
|
||||
putd_backslash "void FUNCNAME##_reset();"
|
||||
putd_backslash "void FUNCNAME##_reset(void);"
|
||||
end
|
||||
|
||||
#example: ARG0_TYPE arg0, ARG1_TYPE arg1
|
||||
def arg_val_list(args_count)
|
||||
return "void" if (args_count == 0)
|
||||
arguments = []
|
||||
args_count.times { |i| arguments << "ARG#{i}_TYPE arg#{i}" }
|
||||
arguments.join(", ")
|
||||
@@ -411,9 +412,10 @@ def output_function_body(arg_count, has_varargs, is_value_function)
|
||||
end
|
||||
|
||||
def define_fff_globals
|
||||
putd "typedef void (*fff_function_t)(void);"
|
||||
putd "typedef struct { "
|
||||
indent {
|
||||
putd "void * call_history[FFF_CALL_HISTORY_LEN];"
|
||||
putd "fff_function_t call_history[FFF_CALL_HISTORY_LEN];"
|
||||
putd "unsigned int call_history_idx;"
|
||||
}
|
||||
putd "} fff_globals_t;"
|
||||
@@ -437,7 +439,7 @@ def define_fff_globals
|
||||
indent {
|
||||
putd_backslash "if(fff.call_history_idx < FFF_CALL_HISTORY_LEN)"
|
||||
indent {
|
||||
putd "fff.call_history[fff.call_history_idx++] = (void *)function;"
|
||||
putd "fff.call_history[fff.call_history_idx++] = (fff_function_t)function;"
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user