daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Aug 12th, 2017 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  <metadata>
  2.    <boxdefault>
  3.     <interface value="C4SNet"/>
  4.    </boxdefault>
  5.  </metadata>
  6.  
  7.  
  8.  net synchro {
  9.    net join connect [|{state}, {inval}|];
  10.    net id connect [{state} -> {state}];
  11.    box dec((state, inval) -> (state) | (outval));
  12.  
  13. } connect (join .. (id | dec)) * {outval};
  14.  
  15.  
  16. This is dec.c
  17. void *dec( void *hnd, c4snet_data_t *state, c4snet_data_t *inval)
  18. {
  19.   int int_a, int_b;
  20.   c4snet_data_t *resultA, *resultB;
  21.  
  22.   int_a= *(int *)C4SNetDataGetData(state);
  23.   int_b = *(int *) C4SNetDataGetData(inval);
  24.  
  25.   if (int_a != 0) {
  26.     resultA = C4SNetDataCreate( CTYPE_int, &int_b);
  27.     C4SNetOut( hnd, 1, resultA);
  28.   } else {
  29.     resultB = C4SNetDataCreate( CTYPE_int, &int_b);
  30.     C4SNetOut( hnd, 2, resultB);
  31.  }
  32.  
  33.   C4SNetDataFree(state);
  34.   C4SNetDataFree(inval);
  35.   return( hnd);
  36. }
  37.  
  38.  
  39. This is correct snet file:
  40. <metadata>
  41.   <boxdefault>
  42.     <interface value="C4SNet"/>
  43.   </boxdefault>
  44. </metadata>
  45.  
  46.  
  47. net synchro {
  48.   net join connect [|{state}, {inval}|];
  49.   net id connect [{inval} -> {inval}];
  50.   box dec((state, inval) -> (state) | (outval));
  51.  
  52. } connect (join .. (id | dec)) * {outval};
RAW Paste Data
Top