コード例 #1
0
ファイル: debug_pins.c プロジェクト: coolacid/RFIDler
BOOL debug_toggle(BYTE pin)
{
    BOOL state;

    state= debug_get(pin);
    return debug_set(pin, !state);
}
コード例 #2
0
ファイル: attr.c プロジェクト: basilgor/git
static int fill_one(const char *what, struct all_attrs_item *all_attrs,
		    const struct match_attr *a, int rem)
{
	int i;

	for (i = a->num_attr - 1; rem > 0 && i >= 0; i--) {
		const struct git_attr *attr = a->state[i].attr;
		const char **n = &(all_attrs[attr->attr_nr].value);
		const char *v = a->state[i].setto;

		if (*n == ATTR__UNKNOWN) {
			debug_set(what,
				  a->is_macro ? a->u.attr->name : a->u.pat.pattern,
				  attr, v);
			*n = v;
			rem--;
			rem = macroexpand_one(all_attrs, attr->attr_nr, rem);
		}
	}
	return rem;
}
コード例 #3
0
ファイル: top.c プロジェクト: alexandermerritt/dragonfly
void
do_arguments(globalstate *gstate, int ac, char **av)

{
    int i;

    /* this appears to keep getopt happy */
    optind = 1;

#ifdef HAVE_GETOPT_LONG
    while ((i = getopt_long(ac, av, "CDSIMTabcinqtuvs:d:U:o:m:", longopts, NULL)) != -1)
#else
    while ((i = getopt(ac, av, "CDSIMTabcinqtuvs:d:U:o:m:")) != EOF)
#endif
    {
	switch(i)
	{
#ifdef ENABLE_COLOR
	case 'C':
	    gstate->use_color = !gstate->use_color;
	    break;
#endif

	case 'D':
	    debug_set(1);
	    break;

	case 'v':
	    fprintf(stderr, "%s: version %s\n", myname, version_string());
	    exit(EX_OK);
	    break;

	case 'b':
	case 'n':
	    gstate->interactive = No;
	    break;

	case 'a':
	    gstate->displays = Infinity;
	    gstate->topn = Infinity;
	    break;

	case 'i':
	    gstate->interactive = Yes;
	    break;

	case 'o':
	    gstate->order_name = optarg;
	    break;

	case 'd':
	    i = atoiwi(optarg);
	    if (i == Invalid || i == 0)
	    {
		message_error(" Bad display count");
	    }
	    else
	    {
		gstate->displays = i;
	    }
	    break;

	case 's':
	    i = atoi(optarg);
	    if (i < 0 || (i == 0 && getuid() != 0))
	    {
		message_error(" Bad seconds delay");
	    }
	    else
	    {
		gstate->delay = i;
	    }
	    break;

	case 'u':
	    gstate->show_usernames = !gstate->show_usernames;
	    break;

	case 'U':
	    i = userid(optarg);
	    if (i == -1)
	    {
		message_error(" Unknown user '%s'", optarg);
	    }
	    else
	    {
		gstate->pselect.uid = i;
	    }
	    break;

	case 'm':
	    i = atoi(optarg);
	    gstate->pselect.mode = i;
	    break;

	case 'S':
	    gstate->pselect.system = !gstate->pselect.system;
	    break;

	case 'I':
	    gstate->pselect.idle = !gstate->pselect.idle;
	    break;

        case 'M':
	    enable_ncpus = 1;
            break;


#ifdef ENABLE_COLOR
	case 'T':
	    gstate->show_tags = 1;
	    break;
#endif

	case 'c':
	    gstate->pselect.fullcmd = !gstate->pselect.fullcmd;
	    break;

	case 't':
	    gstate->pselect.threads = !gstate->pselect.threads;
	    break;

	case 'q':		/* be quick about it */
	    /* only allow this if user is really root */
	    if (getuid() == 0)
	    {
		/* be very un-nice! */
		(void) nice(-20);
	    }
	    else
	    {
		message_error(" Option -q can only be used by root");
	    }
	    break;

	default:
	    fprintf(stderr, "\
Top version %s\n\
Usage: %s [-ISTabcinqu] [-d x] [-s x] [-o field] [-U username] [number]\n",
		    version_string(), myname);
	    exit(EX_USAGE);
	}
    }

    /* get count of top processes to display */
    if (optind < ac && *av[optind])
    {
	if ((i = atoiwi(av[optind])) == Invalid)
	{
	    message_error(" Process count not a number");
	}
	else
	{
	    gstate->topn = i;
	}
    }
}
コード例 #4
0
ファイル: debug_pins.c プロジェクト: coolacid/RFIDler
BOOL debug_off(BYTE pin)
{
    return debug_set(pin, DEBUG_PIN_OFF);
}
コード例 #5
0
ファイル: debug_pins.c プロジェクト: coolacid/RFIDler
BOOL debug_on(BYTE pin)
{
    return debug_set(pin, DEBUG_PIN_ON);
}
コード例 #6
0
ファイル: compiler.c プロジェクト: axelmuhr/Helios-NG
static void set_compile_options(int argc, char *argv[])
{
  int count, files = 0;
  char message[MAX_NAME];

   /* AM: the following code is intended to deal with things like          */
   /* __CLK_TCK (see <time.h>) being different for different targets.      */
   /* It probably needs better amalgamation into Acorn's code for predefs  */
#ifdef TARGET_PREDEFINES
    {   static char *predefs[] = TARGET_PREDEFINES;
        int i;
        for (i=0; i < sizeof(predefs)/sizeof(predefs[0]); i++)
            /* note that the arg may be of the form "name" or "name=toks" */
            /* the "name" for is equivalent to "name=1".                  */
            pp_predefine(predefs[i]);
    }
#endif

  for (count=1;  count < argc;  ++count)
  {   char *current = argv[count];
      if (current[0] == '-' && current[1] != 0)
      {
          switch (safe_toupper(current[1]))
          {
      case 'C': if (ccom_flags & FLG_PREPROCESS)
                    feature |= FEATURE_PPCOMMENT;
                else
                    ccom_flags |= FLG_NO_OBJECT_OUTPUT;
                break;

      case 'D': pp_predefine(current+2);      break;

      case 'E': /* do we wish to fault -Exxx more generally?            */
#ifdef DISABLE_ERRORS
                if (current[2])
                {   disable_errors(current+2);
                    break;
                }
#endif
#ifdef COMPILING_ON_MVS
                if (current[2])
                {   cc_msg(
       "Obsolete use of '%s' to suppress errors -- use '-zu' for PCC mode\n",
                           current);
                    break;
                }
#endif
                ccom_flags = (ccom_flags | FLG_PREPROCESS) & ~FLG_COMPILE;
                break;

      case 'F': feature_set(current+2);       break;

#ifdef TARGET_HAS_DEBUGGER
      case 'G': usrdbg_set(current+2);        break;
#endif

      case 'I': set_include_path(current+2, PE_USER);  break;

      case 'J': ccom_flags &= ~FLG_INSTORE_FILES_IMPLICITLY;
                set_include_path(current+2, PE_SYS);  break;

      case 'K': ccom_flags |= FLG_COUNTS;
                break;

#ifndef NO_LISTING_OUTPUT
      case 'L': ccom_flags |= FLG_LISTING;
                listingfile = current + 2;
                break;
#endif

      case 'M': ccom_flags |= FLG_MAKEFILE;
                if (current[2] == '<' || current[2] == 0)
                {   ccom_flags &= ~(FLG_COMPILE+FLG_NOSYSINCLUDES);
                    if (current[2] == '<') ccom_flags |= FLG_NOSYSINCLUDES;
                }
                else
                    makefile = current+2;
                break;

      case 'O': /*
                 * Hum, really we should never get here because this
                 * this should be done by -zpz1.
                 */
                break;

/* Paranoid define check. Tony 3/1/95 */
#ifdef TARGET_HAS_PROFILE
#error	Old style define TARGET_HAS_PROFILE (replaced by TARGET_HAS_PROFILER)
#endif

#ifdef TARGET_HAS_PROFILER
      case 'P': { int ch = safe_toupper(current[2]);
                  int32 profile = 1L;
                  if (ch == 0)
                    /* do nothing */;
                  else if (ch == 'G' || ch == 'X' && current[3] == 0)
                    profile = 2L;
                  else
                    cc_msg("unknown profile option %s: -p assumed\n",current);
                  var_profile_option = profile;
                }
                break;
#endif /* TARGET_HAS_PROFILER */

      case 'R':
#ifdef PASCAL /*ECN*/
                rtcheck_set(current+2);
#else
                feature &= ~FEATURE_WR_STR_LITS;
#endif
                break;

      case 'S': asmfile = current+2;  /* "" for -S */
#ifdef COMPILING_ON_MVS
                /* pesky cc163 compatibility */
                if (*asmfile == 0 && count+1<argc)
                    asmfile = argv[++count];
#endif
                break;

#ifdef TARGET_IS_XPUTER
      case 'T': /* -tn sets processor type == -tn */
	  	pragma_set(current + 1);
	  	break;
#endif
	  

      case 'U': pp_preundefine(current+2);          break;

      case 'W': disable_warnings(current+2);        break;

#ifdef TARGET_IS_MVS    /* TARGET_USES_CCOM_INTERFACE ??? */
/* The following case provides -Xcsectname for CC 163 compatibility.    */
/* It may be that the CCOM-style interface should stuff ALL unknown     */
/* options to mcdep_config_option()?                                    */
      case 'X': if (!mcdep_config_option(current[1], current+2))
                    cc_msg("unknown option %s: ignored\n", current);
                break;
#endif

      case 'Z': switch(safe_toupper(current[2]))
                {
          case 'B': target_lsbitfirst = !target_lsbytefirst;
                    if (isdigit(current[3]))
                        target_lsbitfirst = (current[3]-'0');
                    break;
#ifdef TARGET_ENDIANNESS_CONFIGURABLE
          case 'E': { int lsbytefirst = current[3] - '0';
                      if (lsbytefirst)
                          config &= ~CONFIG_BIG_ENDIAN;
                      else
                          config |= CONFIG_BIG_ENDIAN;
                      target_lsbitfirst = lsbytefirst;
                    }
                    break;
#endif
          case 'C': feature |= FEATURE_SIGNED_CHAR;
                    break;
          case 'F': feature = (feature | FEATURE_FUSSY) & ~FEATURE_LIMITED_PCC;
                    break;
          case 'I': pre_include(current+3);
                    break;
          case 'J': config |= CONFIG_INDIRECT_SETJMP;  /* related to -fR */
                    break;
          case 'P': pragma_set(current+3);
                    break;
          case 'O': feature |= FEATURE_AOF_AREA_PER_FN;
                    break;
          case 'Q': debug_set(current+3);
                    break;
#ifndef TARGET_IS_HELIOS
          case 'S': system_flavour = current+3;
                    break;
#endif
          case 'U': feature |= pcc_features();
                    break;
#ifdef TARGET_IS_TRAN
	      /*
	       * Addition to remove C++ warnings (for fussy IGM people).
	       * Tony 8/2/95.
	       */
	  case 'W':
	      feature |= FEATURE_NO_CPLUSPLUS_WARNINGS;
	      
	      break;
#endif /* TARGET_IS_TRAN */

#ifdef PASCAL /*ECN*/
          case 'Z': feature |= FEATURE_ISO;
                    break;
#endif
          default:  if (!mcdep_config_option(current[2], current+3))
                        cc_msg("unknown option %s: ignored\n", current);
                    break;
                }
                break;
      default:  cc_msg("unknown option %s: ignored\n", current);
                break;
          }
      }
      else
      {
          switch (++files)
          {
      case 1:   if (strcmp(current, "-") == 0)
                {   /* then just leave as stdin */
#ifdef COMPILING_ON_RISC_OS
#  ifndef OBSOLETE_ARM_NAMES
                    /* Hack round default no-buffering library.         */
                    setvbuf(stdin, NULL, _IOLBF, 256);
#  endif
#endif
                }
                else if (freopen(current,"r",stdin) != NULL)
                {   UnparsedName unparse;
                    char new_dir[MAX_NAME];
                    ccom_flags &= ~FLG_STDIN;
                    sourcefile = current;
                    /*
                     * Add path name of source file to the -I list.
                     */
                    translate_fname(current, &unparse, new_dir);
                    new_dir[unparse.un_pathlen] = '\0';
                    path_hd = mk_path_element(path_hd, PE_USER, new_dir);
/* Make sure path_tl is always the tail, even if file precedes -I    */
                    if (path_hd->link == 0) path_tl = path_hd;
                }
                else
                {
                    sprintf(message, "couldn't read file '%s'", current);
                    driver_abort(message);
                }
                break;
      case 2:   objectfile = current;
                break;
      default:  driver_abort("too many file arguments");
          }
      }
  }
  if (ccom_flags & FLG_STDIN)
  {   path_hd = mk_path_element(path_hd, PE_USER, "");
      if (path_hd->link == 0) path_tl = path_hd;
  }

#ifdef TARGET_HAS_SEPARATE_CODE_DATA_SEGS
  /* On machines like amd29000 code and data buses are separate    */
  /* so that all non-instruction data must go in the data segment. */
#if defined TARGET_IS_C40
  /*
   * Ho Hum
   *
   * The problem is that programs built with the -Zr option, (such as
   * the kernel and device drivers), do not have a static data area.
   * This means that strings MUST be placed into the code segment.  BUT
   * on the C40 data pointers can only address 1/4 of the address map, and
   * so they may not be able to reach the code segment.  (This is especially
   * true when you consider that the C40 has two address buses, and the plan
   * is to have data on one bus and code on the other).  HENCE by default we
   * want to disable placing strings in the code segment, but for -Zr programs
   * we have no choice ...
   */
  
  if (suppress_module != 1)
    {
      feature |= FEATURE_WR_STR_LITS;
    }
  else
    {
      feature &= ~FEATURE_WR_STR_LITS;
    }
#else
  feature |= FEATURE_WR_STR_LITS;
#endif /* TARGET_IS_C40 */
#endif /* TARGET_HAS_SEPARATE_CODE_DATA_SEGS */

  if (ccom_flags & FLG_COMPILE)
  {
      /* under the driver.c interface at most one of the following is true */
#ifndef NO_OBJECT_OUTPUT
      if (objectfile[0] != '\0' && !(ccom_flags & FLG_NO_OBJECT_OUTPUT))
      {   objstream = cc_open(objectfile, BINARY_FILE);
# ifdef COMPILING_ON_RISC_OS
          set_time_stamp(objectfile, NO);
# endif
      }
#endif
#ifndef NO_ASSEMBLER_OUTPUT
      if (asmfile[0] != '\0') asmstream = cc_open(asmfile, TEXT_FILE);
#endif
      if (objectfile[0] == '\0' && asmfile[0] == '\0')
      {
          asmstream = stdout;
          feature |= FEATURE_ANNOTATE;   /* simple test use */
      }

#ifndef NO_LISTING_OUTPUT
      if (ccom_flags & FLG_LISTING)
      {
          if (listingfile[0] != '\0')
          {
              listingstream = cc_open(listingfile, TEXT_FILE);
              if (listingstream != stdout)   /* @@@ get rid of this hack */
                  fprintf(listingstream, "     1  ");
          }
          else listingstream = stdout;
          if (ccom_flags & FLG_COUNTS)
          { FILE *map = fopen("counts", "rb");
            if (map == NULL) driver_abort("couldn't read \"counts\" file");
            if (!map_init(map)) driver_abort("malformed \"counts\" file");
          }
      }
#endif
  }

  if (ccom_flags & FLG_MAKEFILE)
  {
      if (makefile[0] == 0)
          makestream = stdout;
      else
      {
          makestream = cc_open(makefile, TEXT_FILE);
      }
      /*
       *  Print out source file and object file for -M option
       */
      fprintf(makestream, DEPEND_FORMAT, objectfile, sourcefile);
  }
}