当前位置: 首页>>代码示例>>C++>>正文


C++ printf_debug函数代码示例

本文整理汇总了C++中printf_debug函数的典型用法代码示例。如果您正苦于以下问题:C++ printf_debug函数的具体用法?C++ printf_debug怎么用?C++ printf_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了printf_debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: srcTCPss_sendSegment

/**
 * @brief Build a segment and notify the destination
 * @param src is a pointer to the source
 */
void srcTCPss_sendSegment(struct srcTCPSS_t * src)
{
   int segmentSize; 
   struct PDU_t * segment;

   // Send no more than available and MSS
   segmentSize = min(src->backlog, src->MSS);

   if (segmentSize > 0) {
      printf_debug(DEBUG_SRC, "Will send a segment of %d bytes (out of %d remaining)\n", segmentSize, src->backlog);

      src->backlog -= segmentSize;

      // We need to build this new segment
      segment = PDU_create(segmentSize, NULL);

      // We insert it in the outputQueue 
      filePDU_insert(src->outputQueue, segment);

      printf_debug(DEBUG_SRC, "Segment in the queue, notifying the destination\n");

      // Now we notify the destination 
      src->destProcessPDU(src->destination, srcTCPss_getPDU, src);
   }
}
开发者ID:Manu-31,项目名称:ndes,代码行数:29,代码来源:src-tcpss.c


示例2: printf_debug

void UVDDisasmOpcodeLookupTable::usedStats(void)
{
	int i = 0;
	int used = 0;
	int unused = 0;
	
	for( i = 0; i < 256; ++i )
	{
		std::string sOp = "non-encoding";
		if( m_lookupTable[i] )
		{
			sOp = m_lookupTable[i]->getHumanReadableUsage();
		}
		
		printf_debug("hits[0x%.2X] (%s): %d\n", i, sOp.c_str(), m_lookupTableHits[i]);
		if( m_lookupTableHits[i] )
		{
			++used;
		}
		else
		{
			++unused;
		}
	}
	printf_debug("Used opcodes: %d, unused opcodes: %d\n", used, unused);
}
开发者ID:Eltamih,项目名称:uvudec,代码行数:26,代码来源:opcode_table.cpp


示例3: srvGen_terminateProcess

/*
 * Fin de traitement d'une PDU
 */
void srvGen_terminateProcess(struct srvGen_t * srv)
{
   struct PDU_t * pdu;

   srv->srvState = srvStateIdle;

   printf_debug(DEBUG_SRV, " end of service\n");

   if (srv->serviceProbe) {
      probe_sample(srv->serviceProbe, motSim_getCurrentTime() - srv->serviceStartTime);
   }

   // On propose la PDU à la destination
   (void)srv->destProcessPDU(srv->destination, srvGen_getPDU, srv);

   // On va chercher la prochaine s'il y en a une
   // WARNING : et s'il y en a deux ?
   if (srv->source) {
      printf_debug(DEBUG_SRV, " looking for a new PDU\n");
      pdu = srv->getPDU(srv->source);
      // Est-elle encore prete ?
      if (pdu) {
         ndesLog_logLineF(PDU_getObject(pdu), "IN %d", srvGen_getObjectId(srv));
         srvGen_startService(srv, pdu);
      } else { // Si elle ne l'est plus, inutile d'y revenir pour le moment
         srv->source = NULL; 
      }
   }
}
开发者ID:Manu-31,项目名称:ndes,代码行数:32,代码来源:srv-gen.c


示例4: UV_ERR

/*
Opcodes are not allowed here as opposed to uvd_parse_syntax
This function also recursivly calls itself to handle function arguments
*/
uv_err_t UVDDisasmOpcodeLookupTable::uvd_parse_syntax_operand(UVDDisasmOperandShared **op_shared_in, const std::string cur)
{
	uv_err_t rc = UV_ERR_GENERAL;
	UVDConfigValue parsed_type;


	if( !op_shared_in )
	{
		UV_ERR(rc);
		goto error;
	}
	
	/* The bulk of the work is done here as data is identified */
	printf_debug("Parse syntax operand, parsing type: %s\n", cur.c_str());
	if( UV_FAILED(UVDConfigValue::parseType(cur, &parsed_type)) )
	{
		UV_ERR(rc);
		goto error;
	}
	
	printf_debug("Parse syntax operand, converting to operand struct: %s\n", cur.c_str());
	if( UV_FAILED(UVDDisasmOperandShared::uvd_parsed2opshared(&parsed_type, op_shared_in)) )
	{
		UV_ERR(rc);
		goto error;
	}
	rc = UV_ERR_OK;
	
error:
	return UV_DEBUG(rc);
}
开发者ID:Eltamih,项目名称:uvudec,代码行数:35,代码来源:opcode_table.cpp


示例5: srcTCPss_getPDU

/**
 * @brief get a PDU from a source
 * @param s is a pointer to the source
 * @result A PDU if available or NULL
 */
struct PDU_t * srcTCPss_getPDU(void * s)
{
   struct srcTCPSS_t * src = (struct srcTCPSS_t *) s;
   struct PDU_t * result = NULL;

   printf_debug(DEBUG_SRC, "IN\n");

  // If a PDU is available, we send it and (slow start) schedule 2 new
  // PDUs, if available
  if (filePDU_length(src->outputQueue) > 0) {
     printf_debug(DEBUG_SRC, "scheduling two more segments\n");
     motSim_scheduleNewEvent(srcTCPss_send2Segments, src, motSim_getCurrentTime() + src->RTT);
     result = filePDU_extract(src->outputQueue);
     src->nbSentSegments++;
     printf_debug(DEBUG_SRC, "returning a segment (nb %d)\n", src->nbSentSegments);
     if (srcTCPss_isEmpty(src)) {
        printf_debug(DEBUG_SRC, "(last for now)\n");
        // This is the end of the transmission, we need to save window
        // size for the next transmission, if any
        src->windowSize += src->nbSentSegments;
        src->nbSentSegments = 0;

        // Run any event in the list, if any.
        // WARNING : this this the EOT, not the end of reception !
        // You may need to wait for an extra RTT ...
        eventList_runList(src->EOTEventList);
     }
     return result; 
  } else { // Should not occur ...
     printf_debug(DEBUG_SRC, "OUT\n");
     return NULL;
  }
}
开发者ID:Manu-31,项目名称:ndes,代码行数:38,代码来源:src-tcpss.c


示例6: printf_debug

void UVDData::hexdump()
{
	uint32_t dataSize = 0;
	char *buffer = NULL;
	
	if( UV_FAILED(size(&dataSize)) )
	{
		printf_debug("Could not read data size\n"); 
		return;
	}
	
	if( UV_FAILED(readData(&buffer) ) )
	{
		printf_debug("Could not read data\n"); 
		return;
	}
	
	if( !buffer )
	{
		printf_debug("No data");
		return;
	}
	
	//::hexdump(buffer, dataSize);
	free(buffer);
}
开发者ID:Eltamih,项目名称:uvudec,代码行数:26,代码来源:data.cpp


示例7: X509_store_add_certs_from_files_and_dirs

/*
 * Try to load CA certificates from supplied files and/or directories.
 */
int X509_store_add_certs_from_files_and_dirs(SSL_CTX *ssl_ctx,
    const char **fname_p, const char **dirname_p)
{
	struct stat s;
	unsigned long err;
	int ret = -1;

	assert(ssl_ctx != NULL);

	if (fname_p != NULL) {
		while (*fname_p != NULL) {
			if ((stat(*fname_p, &s) == 0) &&
			   (s.st_mode & S_IFREG)) {
				/* Is file. */
				if (SSL_CTX_load_verify_locations(ssl_ctx,
				        *fname_p, NULL) == 0) {
					err = ERR_get_error();
					printf_debug(DEBUG_PREFIX_CERT,
					    "Cannot load certificate file "
					    "'%s'. Error: %s.\n", *fname_p,
					    ERR_error_string(err, NULL));
				}
				ret = 0; /* At least one success. */
			} else {
				printf_debug(DEBUG_PREFIX_CERT,
				    "'%s' is not a file.\n", *fname_p);
			}

			++fname_p;
		}
	}

	if (dirname_p != NULL) {
		while (*dirname_p != NULL) {
			if ((stat(*dirname_p, &s) == 0) &&
			   (s.st_mode & S_IFDIR)) {
				/* Is directory. */
				if (SSL_CTX_load_verify_locations(ssl_ctx,
				        NULL, *dirname_p) == 0) {
					err = ERR_get_error();
					printf_debug(DEBUG_PREFIX_CERT,
					    "Cannot load certificate "
					    "directory '%s'. Error: %s.\n",
					    *dirname_p,
					    ERR_error_string(err, NULL));
				}
				ret = 0; /* At least one success. */
			} else {
				printf_debug(DEBUG_PREFIX_CERT,
				    "'%s' is not a directory.\n", *dirname_p);
			}

			++dirname_p;
		}
	}

	return ret;
}
开发者ID:Cyb0org,项目名称:dnssec-validator,代码行数:61,代码来源:ca_store_directory.c


示例8: openCPAPDevice

int openCPAPDevice( void )
{
    int uartIndex;
    int io_descriptor;
    pthread_t threadTestUART[TEST_UART_NUMBER];

    if ( cpap_global.uart_fd != -1 )
    {
        printf_debug("close uart set fd:%d to -1\n" , cpap_global.uart_fd );
        close( cpap_global.uart_fd );
    }

    cpap_global.uart_fd=-1;

    for ( uartIndex=0 ; uartIndex<TEST_UART_NUMBER ; uartIndex++ )
    {
        threadTestUART[uartIndex] = -1;
        char *deviceName = cpap_global.uart_id[uartIndex].deviceName;

        bzero( deviceName , sizeof(deviceName) );
        sprintf( deviceName , "/dev/ttyUSB%d" , uartIndex );
        io_descriptor = rs232_open( deviceName , 9600 );

        if ( io_descriptor > 0 )
        {
            printf_debug( "open %s ok\n" , deviceName );
            cpap_global.uart_id[uartIndex].descriptor=io_descriptor;
            pthread_create( &threadTestUART[uartIndex] , 0 , functionTestUART , (void *)uartIndex );
            continue;
        }
        else
        {
            cpap_global.uart_id[uartIndex].descriptor = -1;
            printf_debug( "open %s error\n" , deviceName );
        }
    }

    for ( uartIndex=0 ; uartIndex<TEST_UART_NUMBER ; uartIndex++ )
    {
        if ( threadTestUART[uartIndex] != -1 )
            pthread_join( threadTestUART[uartIndex] , 0 );
    }

    int use_descriptor=GetCPAPDescriptor();

    if ( use_descriptor > 0 )
    {
        printf_debug( "use descriptor:%d\n" , use_descriptor );
        SetLed( 1 );
    }else{
        printf_debug("cant find any cpap device\n" );
        SetLed( 0 );
    }
    return use_descriptor;
}
开发者ID:hawkhsieh,项目名称:sigbox,代码行数:55,代码来源:cpap.c


示例9: motSim_create

/*
 * Création d'une instance du simulateur au sein de laquelle on pourra
 * lancer plusieurs simulations consécutives
 */
void motSim_create()
{
   struct sigaction act;

   __motSim = (struct motsim_t * )sim_malloc(sizeof(struct motsim_t));
   __motSim->currentTime = 0.0;

   printf_debug(DEBUG_MOTSIM, "Initialisation du simulateur ...\n");
   __motSim->events = eventList_create();
   __motSim->nbInsertedEvents = 0;
   __motSim->nbRanEvents = 0;
   __motSim->resetClient = NULL;

   printf_debug(DEBUG_MOTSIM, "gestion des signaux \n");
   // We want to close files on exit, even with ^c
   bzero(&act, sizeof(struct sigaction));
   act.sa_handler = mainHandler;
   act.sa_flags = SA_NOCLDWAIT;

   sigaction(SIGHUP, &act,NULL);
   sigaction(SIGINT, &act,NULL);
   sigaction(SIGQUIT, &act,NULL);
   sigaction(SIGCHLD, &act,NULL);

   // For periodic ping
   act.sa_handler = periodicHandler;
   sigaction(SIGALRM, &act,NULL);

   printf_debug(DEBUG_MOTSIM, "creation des sondes systeme\n");
   // Calcul de la durée moyenne des simulations
   __motSim->dureeSimulation = probe_createExhaustive();
   probe_setPersistent(__motSim->dureeSimulation);

   // Les sondes systeme
   PDU_createProbe = probe_createMean();
   probe_setName(PDU_createProbe, "created PDUs");

   PDU_reuseProbe = probe_createMean();
   probe_setName(PDU_reuseProbe, "reused PDUs");

   PDU_mallocProbe = probe_createMean();
   probe_setName(PDU_mallocProbe, "mallocd PDUs");

   PDU_releaseProbe = probe_createMean();
   probe_setName(PDU_releaseProbe, "released PDUs");

   // Intialisation des log
   printf_debug(DEBUG_MOTSIM, "Initialisation des log ...\n");
   ndesLog_init();

   printf_debug(DEBUG_MOTSIM, "Simulateur pret ...\n");
}
开发者ID:Manu-31,项目名称:ndes,代码行数:56,代码来源:motsim.c


示例10: received_file

FILE * received_file(const char *buffer, int len, char *filename)
{
    int iret = 0;
    char path[4096] = {'\0'};

    if (buffer[1] == '1')  //filename 
    {
        //if (fd != NULL) 
        //fclose(fd);
        strcpy(path, filename);
        iret = access(path, W_OK);
        if(iret != 0)
        {
            iret = mkdir(path, 0777);
            if(iret != 0)
            {
                printf("can not create dir");
                exit(1);
            }
        }
        strcat(path, "/");
        strcat(path, (buffer + 4));
        fd_now = fopen(path, "w+");
        if(fd_now == NULL)
        {
            printf("can not open file\n");
            printf("Maybe have not enough space\n");
            exit(1);
        }
        if (flag == 0) 
        {
            flag = 1;
            fd_before = fd_now;
        }
        if (fd_before != fd_now) 
        {
            fclose(fd_before);
            fd_before = fd_now;
        }
        printf("\nReceiving: %s ...\n",(buffer + 4));
    }
    if (buffer[1] == '0')  //file data
    {
        printf_debug("Received byte = %d\n",len);
        len = fwrite(buffer + 4, 1, len-4, fd_now);
        //printf_debug("write byte = %d\n",len);
        printf_debug("write byte = %d\n",len + 4);
    }

    return fd_now;
}
开发者ID:navyzhou926,项目名称:test.2,代码行数:51,代码来源:mycp_client_UDP_test_dm6467_2012019_11:36_OK.c


示例11: event_run

/**
 * @brief Run the destroy an event, whatever the date
 * @param event an event to run
 *
 * If the event is periodic, it is rescheduled an not destroyed.
 */
void event_run(struct event_t * event)
{
   printf_debug(DEBUG_EVENT, " running ev %p at %f\n", event, event->date);
 
   event->run(event->data);

   if (event->type &EVENT_PERIODIC) {
      event->date += event->period;
      motSim_scheduleEvent(event, event->date);
   } else {
      free_event(event);
   }

   printf_debug(DEBUG_EVENT, " end of ev %p at %f\n", event, event->date);
}
开发者ID:Manu-31,项目名称:ndes,代码行数:21,代码来源:event.c


示例12: push

inline void push(void * parser, SSUStruct * ssus)
{
	TokenAssign * assign;
	for(assign = tokenAssigns; assign->token != NULL; ++ assign)
	{
		if(strcmp(assign->token, ssus->word.c_str()) == 0)
		{
			printf_debug("%s %d\n", ssus->word.c_str(), assign->id);
			ssuParser(parser, assign->id, strdup(ssus->word.c_str()), ssus);
			return;
		}
	}
	printf_debug("%s\n", ssus->word.c_str());
	ssuParser(parser, TK_CUSTOM, strdup(ssus->word.c_str()), ssus);
}
开发者ID:pope88,项目名称:Servers,代码行数:15,代码来源:Parser.cpp


示例13: srvGen_startService

/*
 * Début de traitement d'une PDU
 */
void srvGen_startService(struct srvGen_t * srv, struct PDU_t * pdu)
{
   struct event_t * event;
   double date ; 

   assert(pdu != NULL);

   // Si le destinataire n'a pas récupéré la précédente, trop tard !
   if (srv->currentPDU != NULL) {
      PDU_free(srv->currentPDU);
   }

   srv->srvState = srvStateBusy;
   srv->serviceStartTime = motSim_getCurrentTime();
   srv->currentPDU = pdu;

   //Déterminer une date de fin en fonction du temps de traitement
   if (srv->serviceTime == serviceTimeProp){
      date = motSim_getCurrentTime() + PDU_size(pdu) * srv->serviceTimeParameter;
   } else {
      assert(srv->dateGenerator);
      date = dateGenerator_nextDate(srv->dateGenerator);
   }

   printf_debug(DEBUG_SRV, " PDU %d from %6.3f to %6.3f\n", PDU_id(pdu), motSim_getCurrentTime(), date);

   // On crée un événement
   event = event_create((eventAction_t)srvGen_terminateProcess, srv);

   // On ajoute cet événement au simulateur pour cette date
   motSim_scheduleEvent(event, date);
}
开发者ID:Manu-31,项目名称:ndes,代码行数:35,代码来源:srv-gen.c


示例14: ck2316_alarm_init

int ck2316_alarm_init(void)
{
    int i = 0;
    //15 01 02 03 04
    //打开存储门禁控制器一些参数的文件
    //一共存储5个参数,从上到下顺序为:
    //door_lock_relay_status_setup (1:常开, 0:常闭)   
    //door_contact_detection_mode_setup (1:开路,0:短路)
    //door_status (1:开门,0:关门)
    //client_set_door_hold_time (0-255s)
    //button_set_door_hold_time (0-255s)
    if ((fp_ck2316_config_file = fopen(CK2316_CONFIG_FILE, "a+")) == NULL)
    {
        printf("FUNC[%s] LINE[%d]\tOpen %s error!\n",__FUNCTION__, __LINE__, CK2316_CONFIG_FILE);
        return -1;
    }
    fseek(fp_ck2316_config_file, 0, SEEK_SET);
    if ((fscanf(fp_ck2316_config_file, "%02d ",&ck2316_alarm_data.ck2316_simulate_keyboard_address)) != 1)
    {
        ck2316_keyboard_address_code[0] = CK2316_KEYBOARD_ADDRESS;
        ck2316_actual_keyboard_address_code[0] = CK2316_ACTUAL_KEYBOARD_ADDRESS;
        ck2316_alarm_data.ck2316_simulate_keyboard_address = CK2316_ACTUAL_KEYBOARD_ADDRESS;
    }
    else
    {
        ck2316_actual_keyboard_address_code[0] = ck2316_alarm_data.ck2316_simulate_keyboard_address;
        ck2316_keyboard_address_code[0] = ck2316_actual_keyboard_address_code[0] - 1;
    }

    if ((fscanf(fp_ck2316_config_file, "%02d %02d %02d %02d",&ck2316_alarm_data.ck2316_user_password[0], &ck2316_alarm_data.ck2316_user_password[1], &ck2316_alarm_data.ck2316_user_password[2], &ck2316_alarm_data.ck2316_user_password[3])) != 4)
    {
        ck2316_alarm_data.ck2316_user_password[0] = CK2316_USER_PASSWORD_1;
        ck2316_alarm_data.ck2316_user_password[1] = CK2316_USER_PASSWORD_2;
        ck2316_alarm_data.ck2316_user_password[2] = CK2316_USER_PASSWORD_3;
        ck2316_alarm_data.ck2316_user_password[3] = CK2316_USER_PASSWORD_4;
    }
    else
    {
        //ck2316_user_password_setup(ck2316_alarm_data.ck2316_user_password);
        for (i = 0; i < 4; i++) 
        {
            system_defence_code[i][2] = (unsigned char)ck2316_alarm_data.ck2316_user_password[i];
            system_abandon_code[i][2] = (unsigned char)ck2316_alarm_data.ck2316_user_password[i];
            bypass_defence_area_code[i][2] = (unsigned char)ck2316_alarm_data.ck2316_user_password[i];
            alarm_host_reset_code[i][2] = (unsigned char)ck2316_alarm_data.ck2316_user_password[i];
        }
    }

    fclose(fp_ck2316_config_file);
    if ((fp_ck2316_config_file = fopen(CK2316_CONFIG_FILE, "w+")) == NULL)
    {
        printf("FUNC[%s] LINE[%d]\tOpen %s error!\n",__FUNCTION__, __LINE__, CK2316_CONFIG_FILE);
        return -1;
    }
    printf_debug("\n\nCK2316 initial status info: %02d %02d %02d %02d %02d\n\n",ck2316_alarm_data.ck2316_simulate_keyboard_address, ck2316_alarm_data.ck2316_user_password[0], ck2316_alarm_data.ck2316_user_password[1], ck2316_alarm_data.ck2316_user_password[2], ck2316_alarm_data.ck2316_user_password[3]);
    fprintf(fp_ck2316_config_file, "%02d %02d %02d %02d %02d",ck2316_alarm_data.ck2316_simulate_keyboard_address, ck2316_alarm_data.ck2316_user_password[0], ck2316_alarm_data.ck2316_user_password[1], ck2316_alarm_data.ck2316_user_password[2], ck2316_alarm_data.ck2316_user_password[3]);
    fflush(fp_ck2316_config_file);

    return 0;
}
开发者ID:github188,项目名称:integration_server_app,代码行数:60,代码来源:ck2316_alarm.c


示例15: DVBS2ll_create

/*
 * Création d'une entité DVB-S2 couche 2. Attention, elle ne contient
 * aucun MODCOD par défaut, il faut en ajouter.
 * 
 * Le débit est donnée en symboles/seconde
 */
struct DVBS2ll_t * DVBS2ll_create(void * destination,
				  processPDU_t destProcessPDU,
				  unsigned long symbolPerSecond,
				  unsigned int FECFrameBitLength)
{
   struct DVBS2ll_t * result = (struct DVBS2ll_t * )sim_malloc(sizeof(struct DVBS2ll_t));
 
   if (result) {
      result->nbModCods = 0;
      result->destination = destination;
      result->send = destProcessPDU;
      result->symbolPerSecond = symbolPerSecond;
      result->FECFrameBitLength = FECFrameBitLength;
      result->source = NULL;
      result->getPDU = NULL;
      result->dummyFecFrameProbe = NULL;
      result->available = 1;
 
      // Ajout à la liste des choses à réinitialiser avant une prochaine simu
      motsim_addToResetList(result, (void (*)(void *))DVBS2ll_reset);

      printf_debug(DEBUG_DVB, "%p created\n", result);
   }
   return result;
};
开发者ID:Manu-31,项目名称:ndes,代码行数:31,代码来源:dvb-s2-ll.c


示例16: DVBS2ll_processPDU

/*
 * Fonction invoquée pour fournir une nouvelle PDU
 */
int DVBS2ll_processPDU(struct DVBS2ll_t * dvbs2ll,
                        getPDU_t getPDU,
                        void * source)
{
   struct PDU_t * pdu;

   // Si c'est juste pour tester si je suis pret
   if ((getPDU == NULL) || (source == NULL)) {
      printf_debug(DEBUG_ALWAYS, "getPDU/source should not be NULL\n");
      return DVBS2ll_available(dvbs2ll); // WARNING il vaudrait mieux un DVBS2ll_processPDU
   }

   // Si on n'est pas dispo, on ne fait rien !
   // On reviendra voir plus tard (à la fin de la transmission) et
   // tant pis si on ne trouve plus rien !!!
   if (DVBS2ll_available(dvbs2ll)) {
      assert(getPDU != NULL);
      assert(source != NULL);

      pdu = getPDU(source);
  
      DVBS2ll_sendPDU(dvbs2ll, pdu);
   }
   return 1;
}
开发者ID:Manu-31,项目名称:ndes,代码行数:28,代码来源:dvb-s2-ll.c


示例17: uvd_parse_line

uv_err_t uvd_parse_line(const char *line_in, char **key_in, char **value_in)
{
	uv_err_t rc = UV_ERR_GENERAL;
	char *key = NULL;
	char *value = NULL;
	char *line = strdup(line_in);

	uv_assert(key_in);
	uv_assert(value_in);
	/* Double check we aren't a section */
	uv_assert(line[0] != '.');

	/*
	Skip comments, empty 
	Must be at beginning, some assemblers require # chars
	*/
	if( line[0] == 0 || line[0] == '#' )
	{
		rc = UV_ERR_BLANK;
		goto error;	
	}

	/* Setup key/value pairing */
	value = strstr(line, "=");
	if( !value )
	{
		UV_ERR(rc);
		goto error;
	}
	//Make equals zero for key
	value[0] = 0;
	//Skip equals
	++value;
	key = strdup(line);
	if( !key )
	{
		UV_ERR(rc);
		goto error;
	}
	/* Skip the equals sign, make key comparisons easier */
	value = strdup(value);
	if( !value )
	{
		free(key);
		free(value);
		//printf_debug("ERROR: out of memory allocating value string\n");
		UV_ERR(rc);
		goto error;
	}
	free(line);
	line = NULL;
	*key_in = key;
	*value_in = value;

	printf_debug("key: %s, value: %s\n", key, value);
	rc = UV_ERR_OK;
	
error:
	return UV_DEBUG(rc);
}
开发者ID:Eltamih,项目名称:uvudec,代码行数:60,代码来源:string.cpp


示例18: motSim_runUntil

void motSim_runUntil(motSimDate_t date)
{
   struct event_t * event;

   //event_periodicAdd(motSim_periodicMessage, NULL, 0.0, date/200.0);
   alarm(1);

   __motSim->finishTime=date;
   if (!__motSim->nbRanEvents) {
      __motSim->actualStartTime = time(NULL);
   }
   event = eventList_nextEvent(__motSim->events);

   while ((event) && (event_getDate(event) <= date)) {
      event = eventList_extractFirst(__motSim->events);

      printf_debug(DEBUG_EVENT, "next event at %f\n", event_getDate(event));
      assert(__motSim->currentTime <= event_getDate(event));
      __motSim->currentTime = event_getDate(event);
      event_run(event);
      __motSim->nbRanEvents ++;
      /*
afficher le message toutes les 
      n secondes de temps réel
 ou x % du temps simule passe

   Bof : moins on en rajoute à chaque event, mieux c'est !
      */
      event = eventList_nextEvent(__motSim->events);
   }
}
开发者ID:Manu-31,项目名称:ndes,代码行数:31,代码来源:motsim.c


示例19: main

int main( int argc , char **argv )
{
    socket_to_uart_standalone = malloc( sizeof( Socket2Uart ) );
    if ( access( "/etc/debug" , 0 ) == 0 )
        debug=1;

    if ( argc == 3)
    {
        socket_to_uart_standalone->port = atoi( argv[1] );
        strncpy( socket_to_uart_standalone->uart_name , argv[2] , sizeof( socket_to_uart_standalone->uart_name) );
    }
    else
    {
        printf("example:socket2uart 21 /dev/ttyUSB0\n");
        exit(1);
    }
    printf_debug("listen port:%d\n",port);
    /* Variable and structure definitions. */

    signal(SIGCHLD, handler);
    if (!fork())
    {
        return socket2uart( socket_to_uart_standalone->uart_name , socket_to_uart_standalone->port );
    }

    //father process sleep and wait SIGCHLD
    while(1) sleep(1);

}
开发者ID:hawkhsieh,项目名称:sigbox,代码行数:29,代码来源:socket2uart.c


示例20: graphic_receive

static void	graphic_receive(t_receiver *rec, char *msg)
{
  t_graphic	*graphic;

  printf_debug("graphic received: %s", msg);
  graphic = (t_graphic *)rec;
  graph_PI(graphic, msg);
}
开发者ID:Christopher-Steel,项目名称:zappy,代码行数:8,代码来源:graphic_create.c



注:本文中的printf_debug函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。