author | Lolitech |
Fri, 04 Jun 2010 16:11:19 +0200 | |
changeset 563 | c74a37d156df |
parent 521 | 02cb9e5fb6f6 |
child 568 | 20a223828a06 |
permissions | -rw-r--r-- |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
1 |
/** |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
2 |
* Win32 specific code |
329 | 3 |
**/ |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
4 |
|
205 | 5 |
#include <stdio.h> |
6 |
#include <sys/timeb.h> |
|
7 |
#include <time.h> |
|
8 |
#include <windows.h> |
|
9 |
||
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
10 |
/* provided by POUS.C */ |
518
8e61b0066859
Fixed confusion about __common_ticktime type, redesigned LPC PLC timer support
edouard
parents:
484
diff
changeset
|
11 |
extern unsigned long long common_ticktime__; |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
12 |
|
244 | 13 |
long AtomicCompareExchange(long* atomicvar, long compared, long exchange) |
205 | 14 |
{ |
15 |
return InterlockedCompareExchange(atomicvar, exchange, compared); |
|
16 |
} |
|
17 |
||
18 |
struct _timeb timetmp; |
|
19 |
void PLC_GetTime(IEC_TIME *CURRENT_TIME) |
|
20 |
{ |
|
21 |
_ftime(&timetmp); |
|
329 | 22 |
|
205 | 23 |
(*CURRENT_TIME).tv_sec = timetmp.time; |
24 |
(*CURRENT_TIME).tv_nsec = timetmp.millitm * 1000000; |
|
25 |
} |
|
26 |
||
27 |
void PLC_timer_notify() |
|
28 |
{ |
|
29 |
PLC_GetTime(&__CURRENT_TIME); |
|
30 |
__run(); |
|
31 |
} |
|
32 |
||
33 |
HANDLE PLC_timer = NULL; |
|
518
8e61b0066859
Fixed confusion about __common_ticktime type, redesigned LPC PLC timer support
edouard
parents:
484
diff
changeset
|
34 |
void PLC_SetTimer(unsigned long long next, unsigned long long period) |
205 | 35 |
{ |
229 | 36 |
LARGE_INTEGER liDueTime; |
205 | 37 |
/* arg 2 of SetWaitableTimer take 100 ns interval*/ |
38 |
liDueTime.QuadPart = next / (-100); |
|
329 | 39 |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
40 |
if (!SetWaitableTimer(PLC_timer, &liDueTime, period/1000000, NULL, NULL, 0)) |
205 | 41 |
{ |
42 |
printf("SetWaitableTimer failed (%d)\n", GetLastError()); |
|
43 |
} |
|
229 | 44 |
} |
45 |
||
46 |
/* Variable used to stop plcloop thread */ |
|
47 |
void PlcLoop() |
|
48 |
{ |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
49 |
while(WaitForSingleObject(PLC_timer, INFINITE) == WAIT_OBJECT_0) |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
50 |
{ |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
51 |
PLC_timer_notify(); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
52 |
} |
205 | 53 |
} |
54 |
||
229 | 55 |
HANDLE PLC_thread; |
244 | 56 |
HANDLE debug_sem; |
329 | 57 |
HANDLE debug_wait_sem; |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
58 |
HANDLE python_sem; |
329 | 59 |
HANDLE python_wait_sem; |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
60 |
|
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
61 |
#define maxval(a,b) ((a>b)?a:b) |
229 | 62 |
int startPLC(int argc,char **argv) |
205 | 63 |
{ |
229 | 64 |
unsigned long thread_id = 0; |
397
6a7ff66a811d
Adding support for forcing tick count to return to zero as the same time than all tasks firing are synchronized
laurent
parents:
329
diff
changeset
|
65 |
/* Define Ttick to 1ms if common_ticktime not defined */ |
6a7ff66a811d
Adding support for forcing tick count to return to zero as the same time than all tasks firing are synchronized
laurent
parents:
329
diff
changeset
|
66 |
Ttick = common_ticktime__?common_ticktime__:1000000; |
205 | 67 |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
68 |
debug_sem = CreateSemaphore( |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
69 |
NULL, // default security attributes |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
70 |
1, // initial count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
71 |
1, // maximum count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
72 |
NULL); // unnamed semaphore |
329 | 73 |
if (debug_sem == NULL) |
244 | 74 |
{ |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
75 |
printf("startPLC CreateSemaphore debug_sem error: %d\n", GetLastError()); |
244 | 76 |
return; |
77 |
} |
|
329 | 78 |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
79 |
debug_wait_sem = CreateSemaphore( |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
80 |
NULL, // default security attributes |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
81 |
0, // initial count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
82 |
1, // maximum count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
83 |
NULL); // unnamed semaphore |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
84 |
|
329 | 85 |
if (debug_wait_sem == NULL) |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
86 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
87 |
printf("startPLC CreateSemaphore debug_wait_sem error: %d\n", GetLastError()); |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
88 |
return; |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
89 |
} |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
90 |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
91 |
python_sem = CreateSemaphore( |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
92 |
NULL, // default security attributes |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
93 |
1, // initial count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
94 |
1, // maximum count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
95 |
NULL); // unnamed semaphore |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
96 |
|
329 | 97 |
if (python_sem == NULL) |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
98 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
99 |
printf("startPLC CreateSemaphore python_sem error: %d\n", GetLastError()); |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
100 |
return; |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
101 |
} |
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
102 |
python_wait_sem = CreateSemaphore( |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
103 |
NULL, // default security attributes |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
104 |
0, // initial count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
105 |
1, // maximum count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
106 |
NULL); // unnamed semaphore |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
107 |
|
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
108 |
|
329 | 109 |
if (python_wait_sem == NULL) |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
110 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
111 |
printf("startPLC CreateSemaphore python_wait_sem error: %d\n", GetLastError()); |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
112 |
return; |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
113 |
} |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
114 |
|
329 | 115 |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
116 |
/* Create a waitable timer */ |
205 | 117 |
PLC_timer = CreateWaitableTimer(NULL, FALSE, "WaitableTimer"); |
118 |
if(NULL == PLC_timer) |
|
119 |
{ |
|
120 |
printf("CreateWaitableTimer failed (%d)\n", GetLastError()); |
|
121 |
return 1; |
|
122 |
} |
|
123 |
if( __init(argc,argv) == 0 ) |
|
124 |
{ |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
125 |
PLC_SetTimer(Ttick,Ttick); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
126 |
PLC_thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)PlcLoop, NULL, 0, &thread_id); |
205 | 127 |
} |
229 | 128 |
else{ |
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
129 |
return 1; |
229 | 130 |
} |
205 | 131 |
return 0; |
132 |
} |
|
397
6a7ff66a811d
Adding support for forcing tick count to return to zero as the same time than all tasks firing are synchronized
laurent
parents:
329
diff
changeset
|
133 |
static unsigned long __debug_tick; |
244 | 134 |
|
135 |
int TryEnterDebugSection(void) |
|
136 |
{ |
|
137 |
//printf("TryEnterDebugSection\n"); |
|
469 | 138 |
if(WaitForSingleObject(debug_sem, 0) == WAIT_OBJECT_0){ |
139 |
/* Only enter if debug active */ |
|
140 |
if(__DEBUG){ |
|
141 |
return 1; |
|
142 |
} |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
143 |
ReleaseSemaphore(debug_sem, 1, NULL); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
144 |
} |
469 | 145 |
return 0; |
244 | 146 |
} |
147 |
||
148 |
void LeaveDebugSection(void) |
|
149 |
{ |
|
150 |
ReleaseSemaphore(debug_sem, 1, NULL); |
|
151 |
//printf("LeaveDebugSection\n"); |
|
152 |
} |
|
229 | 153 |
|
154 |
int stopPLC() |
|
155 |
{ |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
156 |
CloseHandle(PLC_timer); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
157 |
WaitForSingleObject(PLC_thread, INFINITE); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
158 |
__cleanup(); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
159 |
CloseHandle(debug_wait_sem); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
160 |
CloseHandle(debug_sem); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
161 |
CloseHandle(python_wait_sem); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
162 |
CloseHandle(python_sem); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
163 |
CloseHandle(PLC_thread); |
229 | 164 |
} |
165 |
||
166 |
/* from plc_debugger.c */ |
|
446
1edde533db19
Some cleanup in PLC status - removed that \"Starting\" state ...
ed
parents:
397
diff
changeset
|
167 |
int WaitDebugData(unsigned long *tick) |
229 | 168 |
{ |
446
1edde533db19
Some cleanup in PLC status - removed that \"Starting\" state ...
ed
parents:
397
diff
changeset
|
169 |
*tick = __debug_tick; |
1edde533db19
Some cleanup in PLC status - removed that \"Starting\" state ...
ed
parents:
397
diff
changeset
|
170 |
/* Wait signal from PLC thread */ |
1edde533db19
Some cleanup in PLC status - removed that \"Starting\" state ...
ed
parents:
397
diff
changeset
|
171 |
return WaitForSingleObject(debug_wait_sem, INFINITE) != WAIT_OBJECT_0; |
229 | 172 |
} |
329 | 173 |
|
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
174 |
/* Called by PLC thread when debug_publish finished |
229 | 175 |
* This is supposed to unlock debugger thread in WaitDebugData*/ |
176 |
void InitiateDebugTransfer() |
|
177 |
{ |
|
244 | 178 |
/* remember tick */ |
179 |
__debug_tick = __tick; |
|
180 |
/* signal debugger thread it can read data */ |
|
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
181 |
ReleaseSemaphore(debug_wait_sem, 1, NULL); |
229 | 182 |
} |
244 | 183 |
|
469 | 184 |
void suspendDebug(int disable) |
185 |
{ |
|
244 | 186 |
/* Prevent PLC to enter debug code */ |
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
187 |
WaitForSingleObject(debug_sem, INFINITE); |
469 | 188 |
/*__DEBUG is protected by this mutex */ |
189 |
__DEBUG = !disable; |
|
484 | 190 |
if(disable) |
191 |
ReleaseSemaphore(debug_sem, 1, NULL); |
|
244 | 192 |
} |
193 |
||
194 |
void resumeDebug() |
|
195 |
{ |
|
290
3bd617ae7a05
Local Runtime (LOCAL://) now launched "on demand"
etisserant
parents:
280
diff
changeset
|
196 |
__DEBUG = 1; |
244 | 197 |
/* Let PLC enter debug code */ |
198 |
ReleaseSemaphore(debug_sem, 1, NULL); |
|
199 |
} |
|
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
200 |
|
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
201 |
/* from plc_python.c */ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
202 |
int WaitPythonCommands(void) |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
203 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
204 |
/* Wait signal from PLC thread */ |
329 | 205 |
return WaitForSingleObject(python_wait_sem, INFINITE); |
206 |
} |
|
207 |
||
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
208 |
/* Called by PLC thread on each new python command*/ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
209 |
void UnBlockPythonCommands(void) |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
210 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
211 |
/* signal debugger thread it can read data */ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
212 |
ReleaseSemaphore(python_wait_sem, 1, NULL); |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
213 |
} |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
214 |
|
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
215 |
int TryLockPython(void) |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
216 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
217 |
return WaitForSingleObject(python_sem, 0) == WAIT_OBJECT_0; |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
218 |
} |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
219 |
|
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
220 |
void UnLockPython(void) |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
221 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
222 |
ReleaseSemaphore(python_sem, 1, NULL); |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
223 |
} |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
224 |
|
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
225 |
void LockPython(void) |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
226 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
227 |
WaitForSingleObject(python_sem, INFINITE); |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
228 |
} |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
229 |
|
521
02cb9e5fb6f6
LPC transfer tested, added PLCInfo along MD5 checksum while invoking makefile
edouard
parents:
518
diff
changeset
|
230 |
int CheckRetainBuffer(void) |
02cb9e5fb6f6
LPC transfer tested, added PLCInfo along MD5 checksum while invoking makefile
edouard
parents:
518
diff
changeset
|
231 |
{ |
02cb9e5fb6f6
LPC transfer tested, added PLCInfo along MD5 checksum while invoking makefile
edouard
parents:
518
diff
changeset
|
232 |
return 1; |
02cb9e5fb6f6
LPC transfer tested, added PLCInfo along MD5 checksum while invoking makefile
edouard
parents:
518
diff
changeset
|
233 |
} |
02cb9e5fb6f6
LPC transfer tested, added PLCInfo along MD5 checksum while invoking makefile
edouard
parents:
518
diff
changeset
|
234 |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
235 |
void Retain(unsigned int offset, unsigned int count, void * p) |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
236 |
{ |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
237 |
unsigned int position; |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
238 |
for(position=0; position<count; position++ ){ |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
239 |
printf("%d : 0x%2.2x\n", offset+position, ((char*)p)[position]); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
240 |
} |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
241 |
} |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
242 |
|
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
243 |
void Remind(unsigned int offset, unsigned int count, void *p) |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
244 |
{ |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
245 |
} |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
246 |