tests/python/c_code@c_ext/cfile.xml
changeset 1457 ff7cfce737ca
parent 1401 611fded24ce4
child 1463 de311ffe3961
equal deleted inserted replaced
1456:e723c1dd6faa 1457:ff7cfce737ca
    12     <xhtml:p><![CDATA[
    12     <xhtml:p><![CDATA[
    13 volatile long Lock=0;
    13 volatile long Lock=0;
    14 volatile char PtoC=1,CtoP=2;
    14 volatile char PtoC=1,CtoP=2;
    15 
    15 
    16 extern long AtomicCompareExchange(long*,long, long);
    16 extern long AtomicCompareExchange(long*,long, long);
       
    17 extern char *PLCID;
    17 
    18 
    18 int Simple_C_Call(int val){
    19 int Simple_C_Call(int val){
    19   return val+1;
    20   return val+1;
    20 }
    21 }
    21 
    22 
    32     *fromC=CtoP;
    33     *fromC=CtoP;
    33     AtomicCompareExchange((long*)&Lock, 1, 0);
    34     AtomicCompareExchange((long*)&Lock, 1, 0);
    34     res=1;
    35     res=1;
    35   }
    36   }
    36   printf("C code called by Python: toC %d fromC %d\n",toC,*fromC);
    37   printf("C code called by Python: toC %d fromC %d\n",toC,*fromC);
       
    38   printf("PLCID id %s\n",PLCID);
    37   return res;
    39   return res;
    38 }
    40 }
    39 
    41 
    40 int PLC_C_Call(char fromPLC, char *toPLC){
    42 int PLC_C_Call(char fromPLC, char *toPLC){
    41   /* PLC also have to be realy carefull not to 
    43   /* PLC also have to be realy carefull not to