Yoba Perl
perl_stack.hpp
1 #ifndef YOBAPERL_PERL_STACK_HPP
2 #define YOBAPERL_PERL_STACK_HPP
3 
4 #include "yobaperl/common.hpp"
5 
6 namespace yoba {
7 
8 class Perl;
9 class Scalar;
10 class Array;
11 class Code;
12 
13 }
14 
15 namespace yoba { namespace priv {
16 
17 
18 
19 class PerlStack
20 {
21 public:
22  PerlStack(Perl & perl);
23  ~PerlStack();
24 
25  void extend(SSize_t size);
26 
27  void pushSV(SV * sv, bool extend);
28  SV * popSV();
29 
30  void pushScalar(Scalar arg);
31  void pushArray(Array args);
32  Scalar popScalar();
33  Array popArray();
34 
35  void call(Code code, I32 flags);
36  void callMethod(Code code, I32 flags);
37  void eval(const std::string & code, I32 flags);
38 
39 private:
40  Perl & _perl;
41  PerlInterpreter * _interpreter = nullptr;
42  SV ** sp = nullptr;
43 
44  I32 _returns_count = -1;
45 };
46 
47 
48 
49 }} // namespace yoba::priv
50 
51 #endif // YOBAPERL_PERL_STACK_HPP
Definition: array.cpp:5