example_0060.cpp
См. документацию.
1 #include <iostream>
2 #include <pyhrol.h>
3 
4 using namespace std;
5 using namespace pyhrol;
6 
8 {
9  int i;
10  const char *pch;
11  double f;
12 
13  PYHROL_PARSE_TUPLE_1(NULL, _args, i)
14  PYHROL_PARSE_TUPLE_1(NULL, _args, pch)
15  PYHROL_PARSE_TUPLE_1(NULL, _args, f)
16  PYHROL_PARSE_TUPLE_0(NULL, _args)
17  PYHROL_PARSE_TUPLE_3(NULL, _args, i, pch, f)
20 
21  cout
22  << __func__ << ": I am called" << endl
23  ;
24 
25  switch (_args.parsed_variant())
26  {
27  case 0:
28  cout
29  << " Signature 0: i = " << i << endl
30  ;
31  break;
32  case 1:
33  cout
34  << " Signature 1: pch = \"" << pch << "\"" << endl
35  ;
36  break;
37  case 2:
38  cout
39  << " Signature 2: f = " << f << endl
40  ;
41  break;
42  case 3:
43  cout
44  << " Signature 3: <no args>" << endl
45  ;
46  break;
47  case 4:
48  cout
49  << " Signature 4: i = " << i << ", pch = \"" << pch << "\", f = " << f << endl
50  ;
51  break;
52  }
53 
55 }
56 
57 static void __on_load() __attribute__ ((constructor));
58 
59 void __on_load()
60 {
61  PYHROL_REGISTER_FUNCTION(function_with_overloaded_args, "Function with some different argument signatures")
62 }
#define PYHROL_AFTER_BUILD_VALUE(container)
Definition: pyhrol_macro.h:18
#define PYHROL_AFTER_EXECUTE_DEFAULT(container)
Definition: pyhrol_macro.h:26
#define PYHROL_AFTER_PARSE_TUPLE(container)
Definition: pyhrol_macro.h:9
#define PYHROL_PARSE_TUPLE_3(description, container, arg1, arg2, arg3)
#define PYHROL_PARSE_TUPLE_1(description, container, arg1)
static void __on_load() __attribute__((constructor))
#define PYHROL_REGISTER_FUNCTION(function, help)
Definition: pyhrol_macro.h:34
virtual const uint8_t parsed_variant() const =0
void function_with_overloaded_args(Tuples &_args)
Definition: example_0060.cpp:7
#define PYHROL_PARSE_TUPLE_0(description, container)