equal
deleted
inserted
replaced
150 Current_PLC_EvalFB = (Current_PLC_EvalFB + 1) %% %(python_eval_fb_count)d; |
150 Current_PLC_EvalFB = (Current_PLC_EvalFB + 1) %% %(python_eval_fb_count)d; |
151 } |
151 } |
152 } |
152 } |
153 } |
153 } |
154 |
154 |
155 char* PythonIterator(char* result) |
155 char* PythonIterator(char* result, void** id) |
156 { |
156 { |
157 char* next_command; |
157 char* next_command; |
158 PYTHON_EVAL* data__; |
158 PYTHON_EVAL* data__; |
159 //printf("PythonIterator result %%s\n", result); |
159 //printf("PythonIterator result %%s\n", result); |
160 /*emergency exit*/ |
160 /*emergency exit*/ |
161 if(PythonState & PYTHON_FINISHED) return NULL; |
161 if(PythonState & PYTHON_FINISHED) return NULL; |
162 /* take python mutex to prevent changing PLC data while PLC running */ |
162 /* take python mutex to prevent changing PLC data while PLC running */ |
163 LockPython(); |
163 LockPython(); |
164 /* Get current FB */ |
164 /* Get current FB */ |
165 data__ = EvalFBs[Current_Python_EvalFB]; |
165 data__ = EvalFBs[Current_Python_EvalFB]; |
|
166 *id=data__; |
166 if(data__ && /* may be null at first run */ |
167 if(data__ && /* may be null at first run */ |
167 __GET_VAR(data__->STATE) == PYTHON_FB_PROCESSING){ /* some answer awaited*/ |
168 __GET_VAR(data__->STATE) == PYTHON_FB_PROCESSING){ /* some answer awaited*/ |
168 /* If result not None */ |
169 /* If result not None */ |
169 if(result){ |
170 if(result){ |
170 /* Get results len */ |
171 /* Get results len */ |