Example #1
0
static void rOutputFill(struct fill *fill, FILE *f)
/* Recursively output fill and it's gaps. */
{
struct gap *gap;
struct chain *chain = fill->chain;
int subSize;
double subScore;

subchainInfo(chain, fill->start, fill->end, rOutQ, &subSize, &subScore);
if (subScore >= minScore && subSize >= minFill)
    {
    ++rOutDepth;
    if (rOutQ)
	fillOut(f, fill, fill->chain->tName, rOutDepth, subSize, subScore);
    else
	fillOut(f, fill, fill->chain->qName, rOutDepth, subSize, subScore);
    for (gap = fill->gapList; gap != NULL; gap = gap->next)
	rOutputGap(fill, gap, f);
    --rOutDepth;
    }
}
Example #2
0
int main(int argc, char *argv[])
{
  int t;
#define INPUTLEN 256
  char input[INPUTLEN];
  char cmd[INPUTLEN];
  int ins[MaxInputs];
  int outs[MaxOutputs];
  int index;

  /* check -addr 0x378 */
  for (t = 1; t < argc; t++)
    {
      if (!strcmp(argv[t], "-addr"))
        {
          if (t == argc - 1)
            {
              fprintf(stderr, "no address specified\n");
              exit(1);
            }
          else if (1 != sscanf(argv[t+1], "%li", &NC200_IO_ADDRESS))
            {
              fprintf(stderr, "bad address specified: %s\n", argv[t+1]);
              exit(1);
            }
          else
            {
              t++;              /* step over address */
              continue;
            }
        }
      else
        {
          fprintf(stderr, "syntax: %s -addr <io address>\n", argv[0]);
          exit(1);
        }
    }

  if (-1 == nc200DioInit(0))
    {
      fprintf(stderr, "can't init\n");
      exit(1);
    }

  while (! feof(stdin))
    {
      printf("nc200> ");
      fflush(stdout);

      if (NULL == fgets(input, INPUTLEN, stdin))
        {
          /* EOF */
          break;
        }

      if (1 != sscanf(input, "%s", cmd))
        {
          /* blank line-- print input */
          fillIn(ins);
          printIn(ins);
          continue;
        }

      if (! strcmp(cmd, "help") ||
          ! strcmp(cmd, "?"))
        {
          printf("help/?           print this help\n");
          printf("s <#>            set bit #\n");
          printf("c <#>            clear bit #\n");
          printf("k                check outputs\n");
          printf("ENTER            print inputs\n");
          printf("q                quit\n");
        }
      else if (! strcmp(cmd, "s"))
        {
          /* set */
          if (1 != sscanf(input, "%*s %d", &index))
            {
              printf("bad input: %s\n", input);
              continue;
            }

          if (0 != nc200DioWrite(index, 1))
            {
              printf("index out of range\n");
            }
        }
      else if (! strcmp(cmd, "c"))
        {
          /* set */
          if (1 != sscanf(input, "%*s %d", &index))
            {
              printf("bad input: %s\n", input);
              continue;
            }

          if (0 != nc200DioWrite(index, 0))
            {
              printf("index out of range\n");
            }
        }
      else if (! strcmp(cmd, "k"))
        {
          /* check outputs */
          fillOut(outs);
          printOut(outs);
        }
      else if (! strcmp(cmd, "q"))
        {
          break;
        }
      else
        {
          printf("?\n");
        }
    }

  nc200DioQuit();

  exit(0);
}