Exemplo n.º 1
0
void
createSavedState()
{ char buf[1024];
  char *e;
  int n;

  strcpy(buf, "consult([");
  e = buf + strlen(buf);
  for(n=0; n<plfiles.size; n++)
  { if ( n > 0 )
      *e++ = ',';
    quoted_name(plfiles.list[n], e);
    e += strlen(e);
  }
  for(n=0; n<qlfiles.size; n++)
  { if ( n > 0 )
      *e++ = ',';
    quoted_name(qlfiles.list[n], e);
    e += strlen(e);
  }
  strcpy(e, "]),qsave_program(");
  e += strlen(e);
  quoted_name(pltmp, e);
  e += strlen(e);
  strcpy(e, ",[");
  e += strlen(e);
  e = put_pl_option(e, "goal",     plgoal);
  *e++ = ',';
  e = put_pl_option(e, "toplevel", pltoplevel);
  *e++ = ',';
  e = put_pl_option(e, "init_file", plinitfile);
  if ( plclass )
  { *e++ = ',';
    e = put_pl_option(e, "class", plclass);
  }
  strcpy(e, "])");
  e += strlen(e);

  appendArgList(&ploptions, "-f");
  appendArgList(&ploptions, "none");
  appendArgList(&ploptions, "-F");
  appendArgList(&ploptions, plsysinit);
  appendArgList(&ploptions, "-g");
  appendArgList(&ploptions, "true");
  appendArgList(&ploptions, "-t");
  appendArgList(&ploptions, buf);
  appendArgList(&tmpfiles, pltmp);

  callprog(pl, &ploptions);
}
Exemplo n.º 2
0
char *
put_pl_option(char *to, const char* name, const char *value)
{ strcpy(to, name);
  to += strlen(to);
  *to++ = '=';
  quoted_name(value, to);
  to += strlen(to);

  return to;
}
Exemplo n.º 3
0
Arquivo: io.c Projeto: Netping/DKSF-70
  for(int n=0; n<IO_MAX_CHANNEL; ++n)
    if(io_setup[n].pulse_dur == 0)
      io_setup[n].pulse_dur = 10; // 1s
  //
  io_restart();
}

void io_log(int ch)
{
#if PROJECT_CHAR == 'E'
  log_printf("Input/output: line %d%s: %s",
#else
  log_printf("Input/output: линия %d%s: %s",
#endif
     ch + 1,
     quoted_name(io_setup[ch].name),
     io_state[ch].level_filtered ? "0->1" : "1->0");
}

void io_send_notification(unsigned ch)
{
  // if(sys_setup.nf_disable) return; // 25.03.2015 // 2.06.2015
  if(ch >= IO_MAX_CHANNEL) return;
  unsigned lvl = io_state[ch].level_filtered;
#ifdef NOTIFY_MODULE
  struct binary_notify_s *ionf = &io_notify[ch];
  unsigned mask = lvl ? ionf->high : ionf->low;
  notify(mask, "IO%u=%u %s %s",
      ch + 1, lvl,
      io_setup[ch].name + 1,
      lvl ? ionf->legend_high + 1 : ionf->legend_low + 1 );