Revision 6237fafa gnuradio-core/src/lib/runtime/gr_msg_queue.i

b/gnuradio-core/src/lib/runtime/gr_msg_queue.i
104 104
gr_msg_queue_sptr.insert_tail = gr_py_msg_queue__insert_tail
105 105
gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail
106 106
%}
107
#endif
107
#endif	// SWIGPYTHON
108 108

109
/*
110
 * Similar trickery as above, only this time for Guile
111
 */
109 112
#ifdef SWIGGUILE
110
#warning "gr_msg_queue.i: gr_msg_queue_sptr needs to be implemented!"
111
#endif
113

114
%{
115
  struct arg_holder {
116
    gr_msg_queue_sptr	q;
117
    gr_message_sptr	msg;
118
  };
119

120
  void *insert_tail_shim(void *arg)
121
  {
122
    arg_holder *a = (arg_holder *)arg;
123
    a->q->insert_tail(a->msg);
124
    return 0;
125
  }
126

127
  void *delete_head_shim(void *arg)
128
  {
129
    arg_holder *a = (arg_holder *)arg;
130
    a->msg = a->q->delete_head();
131
    return 0;
132
  }
133
%}
134

135
%inline %{
136

137
  // handle and insert_tail are equivalent
138
  static void handle(gr_msg_queue_sptr q, gr_message_sptr msg)
139
  {
140
    arg_holder	a;
141
    a.q = q;
142
    a.msg = msg;
143
    scm_without_guile(insert_tail_shim, (void *) &a);
144
  }
145

146
  static void insert_tail(gr_msg_queue_sptr q, gr_message_sptr msg)
147
  {
148
    arg_holder	a;
149
    a.q = q;
150
    a.msg = msg;
151
    scm_without_guile(insert_tail_shim, (void *) &a);
152
  }
153

154
  static gr_message_sptr delete_head(gr_msg_queue_sptr q)
155
  {
156
    arg_holder	a;
157
    a.q = q;
158
    scm_without_guile(delete_head_shim, (void *) &a);
159
    return a.msg;
160
  }
161
%}
162

163
#endif	// SWIGGUILE

Also available in: Unified diff