Example #1
0
bool feature_vector::setup_feature_vector( string timeStamp, config_handler *ch, audio_recorder *ar ) {
  
  string mn = "setup_feature_vector:";
  cout<<cn<<mn<<" Setting up feature vector basics ... "<<endl;
  
  
  // prep basics
  set_time_stamp( timeStamp );
  set_id( ch->get_rpid() );
  set_lat( ch->get_latitude() );
  set_lon( ch->get_longitude() );
  set_macaddr( utils::get_mac_address() );
  
  set_fv_file_name( ar->get_rec_file_name_core() + get_fv_ext() );

  if( ch->get_analysis() == true ) {
    // find all feature vector element file names
    find_feature_vector_files( timeStamp, ch, ar );
    
    // parse for feature vector base file names
    extract_feature_vector_file_names( );
    
    // read all of the feature files found
    read_features(); 
  }



  cout<<cn<<mn<<" Finished basic setup."<<endl;
  
  return true;
}
Example #2
0
static void cleanup(void)
{
  bind_cleanup();
  pp_tidyup();

  if (debugging(DEBUG_STORE))
  {
#ifndef TARGET_IS_HELIOS
      fprintf( stderr,"Time: %ldcs front-end %ldcs back-end\n",
               (long) tmuse_front,(long) tmuse_back);
#endif
      show_store_use();
  }

  cg_tidy();

#ifndef NO_OBJECT_OUTPUT
# ifdef COMPILING_ON_ACORN_KIT
  {   bool have_obj = (objstream != NULL);
      /* objstream cannot be stdout, so cc_close does a spurious test. */
      cc_close(&objstream, objectfile);
#   ifdef COMPILING_ON_RISC_OS
      if (have_obj) set_time_stamp(objectfile, YES);
#   endif
#   ifdef COMPILING_ON_UNIX
      if (have_obj && system_flavour != NULL)
      {   char *cmd;
          cmd = GlobAlloc(SU_Other,
                          24 + strlen(system_flavour) + strlen(objectfile));
          sprintf(cmd,"/usr/bin/symrename -%s %s",system_flavour,objectfile);
          system(cmd);
      }
#   endif
  }
# else
  cc_close(&objstream, objectfile);
# endif
#endif

#ifndef NO_ASSEMBLER_OUTPUT
  cc_close(&asmstream, asmfile);
#endif

  cc_close(&listingstream, listingfile);
  cc_close(&makestream, makefile);

  summarise();

#ifdef ENABLE_MAPSTORE
  if (debugging(DEBUG_MAPSTORE)) _mapstore();
#endif

  alloc_dispose();
}
Example #3
0
void feature_vector::init() {
  
  cn = " feature_vector::";
  
  feature_fnames.clear();
  feature_fnames_base.clear();
  set_time_stamp( "" );
  set_id( "" );
  set_lat( "" );
  set_lon( "" );
  set_macaddr( "" );
  set_fv_ext( ".dat" ); //feature vector json extention
  

  return;
}
int modem_err_indication_usr(int revocery, struct cbp_reset_info_s resetinfo)
{
   hwlog_info("%s %d revocery=%d\n",__func__,__LINE__,revocery);
   if(revocery){
        hwlog_info("%s %d MDM_EVT_NOTIFY_HD_ERR\n",__func__,__LINE__);
        /*1, check the rst_ind*/
        /*2, set GPIO_7_3 low*/
        hwlog_info("%s %d rst_ind %d\n", __func__, __LINE__, oem_gpio_get_cbp_rst_ind_value());
        oem_cbp_reset_by_ap(resetinfo);

        //cbp_need_apr = 1;
        set_time_stamp();
        //schedule_delayed_work(&apr_log_wk, 0);
        modem_notify_event(MDM_EVT_NOTIFY_HD_ERR);
    }
    else{
        hwlog_info("%s %d MDM_EVT_NOTIFY_HD_ENHANCE\n",__func__,__LINE__);
        modem_notify_event(MDM_EVT_NOTIFY_HD_ENHANCE);
    }
    return 0;
}
Example #5
0
int modem_err_indication_usr(int revocery)
{
	printk("%s %d revocery=%d\n",__func__,__LINE__,revocery);
	if(revocery){
		printk("%s %d MDM_EVT_NOTIFY_HD_ERR\n",__func__,__LINE__);
		/*1, check the rst_ind*/
		/*2, set GPIO_7_3 low*/
		pr_err("%s %d rst_ind %d\n", __func__, __LINE__, oem_gpio_get_value(cbp_rst_ind_gpio));

		oem_gpio_direction_output(cbp_backup_gpio, 1);
		mdelay(150);
		oem_gpio_direction_output(cbp_backup_gpio, 0);

		//cbp_need_apr = 1;
		set_time_stamp();
		//schedule_delayed_work(&apr_log_wk, 0);
		modem_notify_event(MDM_EVT_NOTIFY_HD_ERR);
	}
	else{
		printk("%s %d MDM_EVT_NOTIFY_HD_ENHANCE\n",__func__,__LINE__);
		modem_notify_event(MDM_EVT_NOTIFY_HD_ENHANCE);
	}
	return 0;
}
Example #6
0
void oem_power_on_modem(void)
{
   if(GPIO_OEM_VALID(cbp_pwr_en_gpio)){
   	printk("%s %d\n",__func__,__LINE__);
      if(GPIO_OEM_VALID(cbp_rst_gpio)){
	  	printk("%s %d\n",__func__,__LINE__);
		  oem_gpio_direction_output(GPIO_VIATEL_CRASH_CBP, 1);
          oem_gpio_direction_output(cbp_rst_gpio, 0);
          mdelay(MDM_RST_HOLD_DELAY);
		  printk("%s %d\n",__func__,__LINE__);
      }
      oem_gpio_direction_output(cbp_pwr_en_gpio, 1);
      mdelay(MDM_PWR_HOLD_DELAY);
	  printk("%s %d\n",__func__,__LINE__);
   }

   if (cbp_need_apr){
       set_time_stamp();
       schedule_delayed_work(&apr_log_wk, msecs_to_jiffies(60*1000));/*wait for 1 minute due to ramdump may later*/
       cbp_need_apr = 0;
   }
   printk("Warnning: power on vmodem\n");

}
/*FUNC: handles incoming REQF:s*/
int rwg_handle_reqf(rwg_header *rwghdr, packetBuffer *packetBuff, int outPipe)
{
  if(TRACE){printf("rwg_handle_refq: RWG packet is of type REQF\n");}
  
  //will be used for checking if incoming REQF matches REQF in buffer
  unsigned char packet_id[8];
  int match;
  memcpy(packet_id,rwghdr->origin,sizeof(unsigned char)*6);
  memcpy(packet_id+sizeof(unsigned char)*6,&rwghdr->sequenceNumber,sizeof(unsigned short int));

  unsigned short int* rVisited = rwghdr->recentVisited;
  unsigned short int* visited = rwghdr->visited;
  t_stamp stamp;

  //Checks if this packet already exists in the REQF buffer, and updates the visited list.
  // Also sets this node to the visited list(probably redundant)
 if((match = rwg_match_packetid(packet_id,packetBuff)) >= 0){
   if(TRACE){printPacket((unsigned char *)packetBuff->reqf[match].reqf,((rwg_header *)packetBuff->reqf[match].reqf)->packetLength);}
   rwg_bitvector_update(((rwg_header *)packetBuff->reqf[match].reqf)->visited,rwghdr->visited);
   rwg_bitvector_update(((rwg_header *)packetBuff->reqf[match].reqf)->recentVisited,rwghdr->recentVisited);
 }

 //checks if this node have messages that the sender of the incoming REQF do not have
  unsigned char incomingSender[6];
  memcpy(&incomingSender,rwghdr->sender,sizeof(unsigned char)*6);
  rwg_wake(incomingSender, packetBuff);


  //if already visited but not recent vistited (a message will empty recentVisited when hops > hopLimit)
  if(rwg_bitvector_lookup(visited, hashedAddr) && !rwg_bitvector_lookup(rVisited, hashedAddr)){
    if(TRACE){ printf("rwg_handle_reqf: Is already visited but not recentVisited");}
    if(match >= 0){
      //changes to the new recentVisited vector and changes the sender of the stored packet (so the ACK will be sent to)
      //the correct node)
      memcpy(((rwg_header *)packetBuff->reqf[match].reqf)->recentVisited,rwghdr->recentVisited,sizeof(((rwg_header *)packetBuff->reqf[match].reqf)->recentVisited));
      memcpy(((rwg_header *)packetBuff->reqf[match].reqf)->sender, rwghdr->sender,sizeof(((rwg_header *)packetBuff->reqf[match].reqf)->sender));
      rwg_bitvector_setbit(((rwg_header *)packetBuff->reqf[match].reqf)->recentVisited,hashedAddr);
      packetBuff->active_reqf.reqf = packetBuff->reqf[match].reqf;
      packetBuff->active_reqf.reqf_pos = match;
      SEND_ACK = 1;
      return 1;
    }else{
      if(TRACE){printf("rwg_handle_refq: REQF does not exist in buffer (perhaps restarted node)\n");}
    }

  //if already visited
    }else if(rwg_bitvector_lookup(visited, hashedAddr)){
    if(TRACE){ printf("rwg_handle_refq: Is already visited\n");}
    //Find buffered REFQ with matching packetid and schedule a send BS if groupSize < visted nodes
    if(match >= 0){
      //check size of visited list, save packet id and schedule send bs
      if(rwg_bitvector_count(((rwg_header *)packetBuff->reqf[match].reqf)->visited) >= ((rwg_header *)packetBuff->reqf[match].reqf)->groupSize){
	packetBuff->active_reqf.reqf = packetBuff->reqf[match].reqf;
	packetBuff->active_reqf.reqf_pos = match;
	SEND_BS = 1;
	return 1;
      }
      return 0;
    }else{
      if(TRACE){printf("rwg_handle_refq: REQF does not exist in buffer (perhaps restarted node)\n");}
    }
    //if not already recent visited
  }else if(!rwg_bitvector_lookup(rVisited, hashedAddr)){
    //new reqf have arrived
    if(TRACE){printf("rwg_handle_reqf: Not recent visited\n");}
    if(match < 0){
      //update recentVisited and visited
      rwg_bitvector_setbit(rwghdr->recentVisited,hashedAddr);
      rwg_bitvector_setbit(rwghdr->visited,hashedAddr);

      //writes the payload to the output buffer
      // if(!rwg_write_output((unsigned char *)rwghdr + sizeof(rwg_header),outPipe,rwghdr->packetLength-sizeof(rwg_header))){perror("rwg_handle_refq, failed to write to buffer\n");}
       if(!rwg_write_output((unsigned char *)rwghdr,outPipe,rwghdr->packetLength)){
	 perror("rwg_handle_refq, failed to write to buffer\n");
       }
      //copy packet and add a pointer of the copy to (reqf) packetBuffer buffer, add lenght n' increase counter
      unsigned char *reqfCopy = (unsigned char*)malloc(rwghdr->packetLength);
      memcpy(reqfCopy,rwghdr,rwghdr->packetLength);
      packetBuff->reqf[packetBuff->reqf_counter].reqf = reqfCopy;
      packetBuff->reqf[packetBuff->reqf_counter].wake = 0;
      //set the time stamp arrived_at in buffer
      set_time_stamp(&stamp);
      packetBuff->reqf[packetBuff->reqf_counter].arrived_at.seconds = stamp.seconds;
      packetBuff->reqf[packetBuff->reqf_counter].arrived_at.u_seconds = stamp.u_seconds;
      packetBuff->reqf[packetBuff->reqf_counter].reqf_pos = packetBuff->reqf_counter;
      packetBuff->active_reqf.reqf = packetBuff->reqf[packetBuff->reqf_counter].reqf;
      packetBuff->active_reqf.reqf_pos = packetBuff->reqf_counter;
      packetBuff->reqf_counter++;
      //check if the groupSize have been reached, if so send a BS
      if(rwg_bitvector_count(((rwg_header *)rwghdr)->visited) >= ((rwg_header *)rwghdr)->groupSize){
	SEND_BS = 1;
	return 1;
      }
    }else{
      //this have to be done due to possible missed acks
      if(TRACE){printf("rwg_handle_reqf: REQF exists in buffer but not recentVisited/visited, updates recentVisited\n");}
      rwg_bitvector_setbit(((rwg_header *)packetBuff->reqf[match].reqf)->recentVisited, hashedAddr);
      rwg_bitvector_setbit(((rwg_header *)packetBuff->reqf[match].reqf)->visited, hashedAddr);
      memcpy(((rwg_header *)packetBuff->reqf[match].reqf)->sender,rwghdr->sender,sizeof(char)*6); 
      packetBuff->active_reqf.reqf = packetBuff->reqf[match].reqf;
      packetBuff->active_reqf.reqf_pos = match;
      //Sends out a BS so it the other node will update its bitvectors
      SEND_BS = 1;
      return 1;
    }
    //schedule a send ACK
    SEND_ACK = 1;
    return 1;
  }
  
  if(TRACE){printf("rwg_handle_reqf, recent visited REQF\n");}

  return 0;
}
Example #8
0
  void emplace_back_entry(device_id device_id,
                          const event_time_stamp& event_time_stamp,
                          const class event& event,
                          event_type event_type,
                          const class event& original_event,
                          bool lazy = false) {
    auto t = event_time_stamp;
    t.set_time_stamp(t.get_time_stamp() + time_stamp_delay_);

    events_.emplace_back(device_id,
                         t,
                         event,
                         event_type,
                         original_event,
                         lazy);

    sort_events();

    // Update modifier_flag_manager

    if (auto key_code = event.get_key_code()) {
      if (auto modifier_flag = types::make_modifier_flag(*key_code)) {
        auto type = (event_type == event_type::key_down ? modifier_flag_manager::active_modifier_flag::type::increase
                                                        : modifier_flag_manager::active_modifier_flag::type::decrease);
        modifier_flag_manager::active_modifier_flag active_modifier_flag(type,
                                                                         *modifier_flag,
                                                                         device_id);
        modifier_flag_manager_.push_back_active_modifier_flag(active_modifier_flag);
      }
    }

    if (event.get_type() == event::type::caps_lock_state_changed) {
      if (auto integer_value = event.get_integer_value()) {
        auto type = (*integer_value ? modifier_flag_manager::active_modifier_flag::type::increase_lock
                                    : modifier_flag_manager::active_modifier_flag::type::decrease_lock);
        modifier_flag_manager::active_modifier_flag active_modifier_flag(type,
                                                                         modifier_flag::caps_lock,
                                                                         device_id);
        modifier_flag_manager_.push_back_active_modifier_flag(active_modifier_flag);
      }
    }

    // Update pointing_button_manager

    if (auto pointing_button = event.get_pointing_button()) {
      if (*pointing_button != pointing_button::zero) {
        auto type = (event_type == event_type::key_down ? pointing_button_manager::active_pointing_button::type::increase
                                                        : pointing_button_manager::active_pointing_button::type::decrease);
        pointing_button_manager::active_pointing_button active_pointing_button(type,
                                                                               *pointing_button,
                                                                               device_id);
        pointing_button_manager_.push_back_active_pointing_button(active_pointing_button);
      }
    }

    // Update manipulator_environment
    if (event.get_type() == event::type::device_grabbed) {
      if (auto v = event.find<device_properties>()) {
        manipulator_environment_.insert_device_properties(device_id, *v);
      }
    }
    if (event.get_type() == event::type::device_ungrabbed) {
      manipulator_environment_.erase_device_properties(device_id);
    }
    if (auto frontmost_application = event.get_frontmost_application()) {
      manipulator_environment_.set_frontmost_application(*frontmost_application);
    }
    if (auto properties = event.get_input_source_properties()) {
      manipulator_environment_.set_input_source_properties(*properties);
    }
    if (event_type == event_type::key_down) {
      if (auto set_variable = event.get_set_variable()) {
        manipulator_environment_.set_variable(set_variable->first,
                                              set_variable->second);
      }
    }
    if (auto properties = event.find<pqrs::osx::system_preferences::properties>()) {
      manipulator_environment_.set_system_preferences_properties(*properties);
    }
    if (auto code = event.find<hid_country_code>()) {
      manipulator_environment_.set_virtual_hid_keyboard_country_code(*code);
    }
  }
Example #9
0
void *file_read_thread_run(void *param)
{
	FILE *file = fopen(input_file, "r");
	int offset = 0;
	int i = 0;

	printf("DEBUG:\tFile read thread has started\n");

	if (file == NULL) {
		printf("ERROR:\tCould not open file %s: %s\n", input_file,
			strerror(errno));
		return NULL;
	}

	while (!stop_file_read_run) {
		sleep(1);
		if (!feof(file)) {
			fread(fr_in, sizeof(float), MAX_FRAMESIZE, file);
		} else {
			printf("DEBUG:\tReached end of file\n");
			break;
		}

		if (ferror(file)) {
			printf("ERROR:\tAn error occurred during file "
				"read\n");
			break;
		}

		set_time_stamp();

		frerr = applyPowerQuality(
				frpPQInst,
				fr_in,
				&frpqResult,
				NULL,
				timestamp_buffer + offset,
				FRAMES_PER_BLOCK);

		offset = i * 32;
		if (i == 4)
			i = 0;
		else
			i++;

		/* exit processing on error */
		if(frerr != PQ_NO_ERROR) {
			printf("TODO:\t\tError applying PQ-Lib\n\t\t\t");
			print_PQ_Error(frerr);
			stop_powqutyd_file_read();
			break;
		}

		/* EN50160 event detected */
		if (frpqResult.nmbPqEvents > 0)
			handle_event(frpqResult, config);

		if(frpqResult.HarmonicsExist) {
			store_to_file(frpqResult, config);
#ifdef MQTT
			publish_measurements(frpqResult);
#endif
		}
	}
	fclose(file);
	printf("DEBUG:\tFile read thread has ended\n");

	stop_powqutyd_file_read();

	return NULL;
}
Example #10
0
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);
  }
}