• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ print_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

int main(void) {
   u16 i;
   u08 data[2];
   int j=0;

   init();
   test_motor();
   clear_screen();

   _delay_ms(100);

   data[0] = 0x1; //change to WAKE mode
   send_address(0x2A,0);
   write_register(&data[0], 1);
   _delay_ms(100);
   unlock_bus();
   //send_address(0x2);
   //read_register(&data[1], 1);
   print_num(data[0]);
   //while(1) {}
   while(1) {
      //X
      send_address(0x1,1);
      read_register(&(data[0]), 1);
      print_num(data[0]);
      print_string(" ",1);

      //Y
      send_address(0x3,1);
      read_register(&(data[0]), 1);
      print_num(data[0]);
      print_string(" ", 1);

      //Z
      lcd_cursor(0,1);
      send_address(0x5,1);
      read_register(&(data[0]), 1);
      print_num(data[0]);
      print_string(" ",1);
      print_num(SP);
      _delay_ms(150);
      clear_screen();
   }





/*



   USI_TWI_Master_Initialize();
   i2cMessageBuf[0] = 0x1c << 1; // Odd numbers for read
   i2cMessageBuf[1] = 0x0d; // Register 0 contains version number
   i2cMessageBuf[2] = (0x1c << 1) + 1; // Odd numbers for read
   i2cMessageBuf[3] = 0x00; // Register 0 contains version number
   USI_TWI_Start_Read_Write( i2cMessageBuf, 1 );

   */
   while(get_sw1() == 0) {}

   DDRD |= _BV(IR_PIN);

   led_on(1);
   led_on(0);

   clear_screen();

   while(1) {
      _delay_ms(1500);

      if (j) {
         clear_screen();
         print_string("test",4);
         led_on(1);
         led_off(0);
         //sbi(PORTC,LCD_E_PIN);
         //sbi(PORTC,LCD_RS_PIN);
         //PORTA = 0xff;

         sbi(PORTD,IR_PIN); //turn on IR pin

         sbi(PORTC,SERVO0_PIN); //set servo pins
         sbi(PORTC,SERVO1_PIN);
         sbi(PORTC,SERVO2_PIN);
         sbi(PORTF,SERVO3_PIN);

         //test i2c pins
         //sbi(PORTE,4);
         //sbi(PORTE,5);
         
         //motor test
         sbi(PORTB,MOTOR0_EN_PIN);
         sbi(PORTB,MOTOR1_EN_PIN);
         sbi(PORTD,MOTOR0_DIR0_PIN); 
         sbi(PORTD,MOTOR0_DIR1_PIN);
         sbi(PORTD,MOTOR1_DIR0_PIN);
         sbi(PORTD,MOTOR1_DIR1_PIN);
         j=0;
//.........这里部分代码省略.........
开发者ID:jsseng,项目名称:arduino_robot,代码行数:101,代码来源:main.c


示例2: handle_message


//.........这里部分代码省略.........

  if (show)
  {
    mutex_lock(&output_mutex);
    printf("%s ", rule->identifier);

    if (show_tags)
    {
      printf("[");

      tag_name = rule->tags;
      tag_length = tag_name != NULL ? strlen(tag_name) : 0;

      while (tag_length > 0)
      {
        printf("%s", tag_name);
        tag_name += tag_length + 1;
        tag_length = strlen(tag_name);

        if (tag_length > 0)
          printf(",");
      }

      printf("] ");
    }

    // Show meta-data.

    if (show_meta)
    {
      meta = rule->metas;

      printf("[");

      while(!META_IS_NULL(meta))
      {
        if (meta->type == META_TYPE_INTEGER)
          printf("%s=%d", meta->identifier, meta->integer);
        else if (meta->type == META_TYPE_BOOLEAN)
          printf("%s=%s", meta->identifier, meta->integer ? "true" : "false");
        else
          printf("%s=\"%s\"", meta->identifier, meta->string);

        meta++;

        if (!META_IS_NULL(meta))
          printf(",");
      }

      printf("] ");
    }

    printf("%s\n", (char*) data);

    // Show matched strings.

    if (show_strings)
    {
      string = rule->strings;

      while (!STRING_IS_NULL(string))
      {
        string_found = STRING_FOUND(string);

        if (string_found)
        {
          match = STRING_MATCHES(string).head;

          while (match != NULL)
          {
            printf("0x%" PRIx64 ":%s: ", match->first_offset, string->identifier);

            if (STRING_IS_HEX(string))
            {
              print_hex_string(match->data, match->length);
            }
            else
            {
              print_string(match->data, match->length);
            }

            match = match->next;
          }
        }

        string++;
      }
    }

    mutex_unlock(&output_mutex);
  }

  if (is_matching)
    count++;

  if (limit != 0 && count >= limit)
    return CALLBACK_ABORT;

  return CALLBACK_CONTINUE;
}
开发者ID:mianskulls,项目名称:yara-project,代码行数:101,代码来源:yara.c


示例3: list_ppkg_types

/*
** list_ppkg_types:
** Print a list of packages.  If package_id is 0, list all packages; otherwise
** list the single package specified.  If successful, return the number of
** items listed; otherwise return -1.
*/ 
int
list_ppkg_types(int package_id)
{
    struct fields {
	int   package_id;
	char  display_value[80 + 1];
    };

    int  success;
    int  ret;
    int  no_items;
    int  item_cnt;
    ABP_PPKG_TYPE  keys = NULL, item = NULL, list = NULL;   

    for (success = 0; !success; success = 1) {
	keys = new_abp_ppkg_type();
	if (keys == NULL) {
	    logprintf(LOG_ERR, "new_abp_ppkg_type() failed\n");
	    break;
	}

	unset_abp_ppkg_type(keys);
	if (package_id > 0) {
	    set_abp_ppkg_type_package_id(keys, package_id);
	}

	ret = list_abp_ppkg_types(g_dbhandle, keys, &list);
	if (ret < 0) {
	    LOG_API_ERROR(g_dbhandle, ret);
	    break;
	}
	no_items = ret;

	printf("\n");
	printf("Product Package Type\n");
	printf("--------------------\n");

	for (item = list, item_cnt = 0;
	     item != NULL;
	     item = next_abp_ppkg_type(item), item_cnt++)
	{
	    struct fields f;
	    char *label;
	
	    label = "package_id:";
	    ret = get_abp_ppkg_type_package_id(item, &f.package_id);
	    print_int(ret, label, f.package_id);

	    label = "display_value:";
	    ret = get_abp_ppkg_type_display_value(item, f.display_value);
	    print_string(ret, label, f.display_value);

	    printf("\n");
	}

	if (item_cnt != no_items) {
	    logprintf(LOG_ERR, "item_cnt != no_items\n");
	    break;
	}
    }

    delete_abp_ppkg_type(keys);
    abp_delete_objects(list);

    return success ? item_cnt : -1;
}
开发者ID:huilang22,项目名称:Projects,代码行数:72,代码来源:ppkg_nav.c


示例4: draw_string

// draw string in OpenGL at position x, y
void draw_string(GLfloat x, GLfloat y, const char* word)
{
	glColor4f(1.0, 1.0, 1.0, 0.0);
	glRasterPos2f(x, y);
	print_string(font_base, word);
}
开发者ID:ewerlopes,项目名称:behavior_trees,代码行数:7,代码来源:display.cpp


示例5: main

void main(void)
{
  x = 'Q';
  print_int(x);
  print_string("\n");
}
开发者ID:gizmo385,项目名称:C-Minus-Minus,代码行数:6,代码来源:test17.c


示例6: load_file


//.........这里部分代码省略.........

    qsort((void *)file_list, num_files, sizeof(u8 *), sort_function);
    qsort((void *)dir_list, num_dirs, sizeof(u8 *), sort_function);

    closedir(current_dir);

    current_dir_length = strlen(current_dir_name);

    if(current_dir_length > 80)
    {
      memcpy(current_dir_short, "...", 3);
      memcpy(current_dir_short + 3,
       current_dir_name + current_dir_length - 77, 77);
      current_dir_short[80] = 0;
    }
    else
    {
      memcpy(current_dir_short, current_dir_name,
       current_dir_length + 1);
    }

    repeat = 1;

    if(num_files == 0)
      current_column = 1;

    clear_screen(COLOR_BG);
    u8 print_buffer[81];

    while(repeat)
    {
      flip_screen();

      print_string(current_dir_short, COLOR_ACTIVE_ITEM, COLOR_BG, 0, 0);
#if defined(ZAURUS) || defined(DINGUX_ON_WIN32)
      print_string("Press Cancel to return to the main menu.",
       COLOR_HELP_TEXT, COLOR_BG, 20, 220);
      for(i = 0, current_file_number = i + current_file_scroll_value;
       i < FILE_LIST_ROWS; i++, current_file_number++)
      {
        if(current_file_number < num_files)
        {
          strncpy(print_buffer,file_list[current_file_number],38);
		  print_buffer[38] = 0;
          if((current_file_number == current_file_selection) &&
           (current_column == 0))
          {
            print_string(print_buffer, COLOR_ACTIVE_ITEM,
             COLOR_BG, FILE_LIST_POSITION, ((i + 1) * 10));
          }
          else
          {
            print_string(print_buffer, COLOR_INACTIVE_ITEM,
             COLOR_BG, FILE_LIST_POSITION, ((i + 1) * 10));
          }
        }
      }

      for(i = 0, current_dir_number = i + current_dir_scroll_value;
       i < FILE_LIST_ROWS; i++, current_dir_number++)
      {
        if(current_dir_number < num_dirs)
        {
          strncpy(print_buffer,dir_list[current_dir_number], 13);
		  print_buffer[14] = 0;
          if((current_dir_number == current_dir_selection) &&
开发者ID:dmitrysmagin,项目名称:gpsp-rzx50,代码行数:67,代码来源:gui.c


示例7: print_string_init

static int __init print_string_init(void)
{
	print_string("The module has been inserted.  Hello world!");
	return 0;
}
开发者ID:AmitKrJoshi,项目名称:LDP,代码行数:5,代码来源:print_string.c


示例8: print_prompt

/*
 * プロンプトを表示する
 * */
void  print_prompt(FILE *fp) {
    print_string(PROMPT, fp);
}
开发者ID:twhs,项目名称:kernel-projects-for-linux,代码行数:6,代码来源:myshell.c


示例9: printk

/**********************************************************************
 * Description:
 * 		Prints Formatted strings for STD out. Format specifiers
 * provide what type of data to be printed and the data value is taken
 * from the argument list.
 *
 * Input:
 * 		One or more Formatted string messages to be printed allong with
 * other data values to be printed.
 *
 * Output:
 * 		Number of characters actually printed. -1 if failure.
 *********************************************************************/
int printk(char *fmt, ...)
{
	va_list arg;
	int ret = 0;
	uint32_t val;
	uint64_t val64;

	//Check if valid putc() is registered.
	if (_putc == NULL)
		return -1;

	// Variable argument processing
	va_start(arg, fmt);

	// Till the end of string
	while(*fmt != '\0')
	{
		// Format the data to be printed
		if(*fmt == '%')
		{
			fmt++;
			switch(*fmt)
			{
			case 'd':	// Print the integer
				val = va_arg(arg,int);
				ret += print_int32((int)val);
				break;
			case 'x':	// Print Hex
				val = va_arg(arg, uint32_t);
				ret += print_hex32(val, 1);
				break;
			case 'c':	// Print the char
				val = va_arg(arg, int);
				_putc((char)val);
				ret++;
				break;
			case 'u':	// Print unsigned int
				val = va_arg(arg, uint32_t);
				ret += print_uint32(val);
				break;
			case 's':	// Print the string
				val = va_arg(arg, uint32_t);
				ret += print_string((char*)val);
				break;
			case 'l':	// Long data
				switch(*(++fmt))
				{
				case 'u':
					val64 = va_arg(arg, uint64_t);
					ret += print_uint64(val64);
					break;
				case 'd':
					val64 = va_arg(arg, int64_t);
					ret += print_int64(val64);
					break;
				case 'x':
					val64 = va_arg(arg, uint64_t);
					ret += print_hex64(val64);
					break;
				default:
					val64 = va_arg(arg, int64_t);
					ret += print_int64(val64);
					break;
				}
				break;
			default:
				_putc(*fmt);
				ret++;
				break;
			}
		}
		else
		{
开发者ID:skaramoosh,项目名称:Pritha,代码行数:86,代码来源:printk.c


示例10: Print

void Print( const Value* value, std::ostream& result )
{
    // TODO: switch on typeid?

    if( !value )
    {
        return;
    }

    const IntegerValue* integervalue = dynamic_cast<const IntegerValue*>(
        value );
    if( integervalue )
    {
        print_integer( integervalue, result );
        return;
    }

    const DecimalValue* decimalvalue = dynamic_cast<const DecimalValue*>(
        value );
    if( decimalvalue )
    {
        print_decimal( decimalvalue, result );
        return;
    }

    const StringValue* stringvalue = dynamic_cast<const StringValue*>(
        value );
    if( stringvalue )
    {
        print_string( stringvalue, result );
        return;
    }

    const TrueValue* truevalue = dynamic_cast<const TrueValue*>(
        value );
    if( truevalue )
    {
        print_true( truevalue, result );
        return;
    }

    const FalseValue* falsevalue = dynamic_cast<const FalseValue*>(
        value );
    if( falsevalue )
    {
        print_false( falsevalue, result );
        return;
    }

    const NilValue* nilvalue = dynamic_cast<const NilValue*>(
        value );
    if( nilvalue )
    {
        print_nil( nilvalue, result );
        return;
    }

    const CombinationValue* combovalue = dynamic_cast<
        const CombinationValue*>( value );
    if( combovalue )
    {
        print_combination( combovalue, result );
        return;
    }

    const SymbolValue* symbolvalue = dynamic_cast<
        const SymbolValue*>( value );
    if( symbolvalue )
    {
        print_symbol( symbolvalue, result );
        return;
    }

    const NativeFunctionValue* fnvalue = dynamic_cast<
        const NativeFunctionValue*>( value );
    if( fnvalue )
    {
        print_built_in_procedure( fnvalue, result );
        return;
    }

    const CompoundProcedureValue* procvalue = dynamic_cast<
        const CompoundProcedureValue*>( value );
    if( procvalue )
    {
        print_compound_procedure( procvalue, result );
        return;
    }

    const PairValue* pairvalue = dynamic_cast<
        const PairValue*>( value );
    if( pairvalue )
    {
        print_pair( pairvalue, result );
        return;
    }

    result << "<<UNPRINTABLE TYPE " << typeid(value).name() << ">>";
}
开发者ID:s-cherepanov,项目名称:subs-scheme,代码行数:99,代码来源:prettyprinter.cpp


示例11: vti6_parse_opt


//.........这里部分代码省略.........
			okey = rta_getattr_u32(vtiinfo[IFLA_VTI_OKEY]);

		if (vtiinfo[IFLA_VTI_LINK])
			link = rta_getattr_u8(vtiinfo[IFLA_VTI_LINK]);

		if (vtiinfo[IFLA_VTI_FWMARK])
			fwmark = rta_getattr_u32(vtiinfo[IFLA_VTI_FWMARK]);

		free(answer);
	}

	while (argc > 0) {
		if (!matches(*argv, "key")) {
			NEXT_ARG();
			ikey = okey = tnl_parse_key("key", *argv);
		} else if (!matches(*argv, "ikey")) {
			NEXT_ARG();
			ikey = tnl_parse_key("ikey", *argv);
		} else if (!matches(*argv, "okey")) {
			NEXT_ARG();
			okey = tnl_parse_key("okey", *argv);
		} else if (!matches(*argv, "remote")) {
			NEXT_ARG();
			get_addr(&daddr, *argv, AF_INET6);
		} else if (!matches(*argv, "local")) {
			NEXT_ARG();
			get_addr(&saddr, *argv, AF_INET6);
		} else if (!matches(*argv, "dev")) {
			NEXT_ARG();
			link = ll_name_to_index(*argv);
			if (!link)
				exit(nodev(*argv));
		} else if (strcmp(*argv, "fwmark") == 0) {
			NEXT_ARG();
			if (get_u32(&fwmark, *argv, 0))
				invarg("invalid fwmark\n", *argv);
		} else {
			vti6_print_help(lu, argc, argv, stderr);
			return -1;
		}
		argc--; argv++;
	}

	addattr32(n, 1024, IFLA_VTI_IKEY, ikey);
	addattr32(n, 1024, IFLA_VTI_OKEY, okey);
	if (is_addrtype_inet_not_unspec(&saddr))
		addattr_l(n, 1024, IFLA_VTI_LOCAL, saddr.data, saddr.bytelen);
	if (is_addrtype_inet_not_unspec(&daddr))
		addattr_l(n, 1024, IFLA_VTI_REMOTE, daddr.data, daddr.bytelen);
	addattr32(n, 1024, IFLA_VTI_FWMARK, fwmark);
	if (link)
		addattr32(n, 1024, IFLA_VTI_LINK, link);

	return 0;
}

static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
	char s2[64];

	if (!tb)
		return;

	tnl_print_endpoint("remote", tb[IFLA_VTI_REMOTE], AF_INET6);
	tnl_print_endpoint("local", tb[IFLA_VTI_LOCAL], AF_INET6);

	if (tb[IFLA_VTI_LINK]) {
		__u32 link = rta_getattr_u32(tb[IFLA_VTI_LINK]);

		if (link) {
			print_string(PRINT_ANY, "link", "dev %s ",
				     ll_index_to_name(link));
		}
	}

	if (tb[IFLA_VTI_IKEY]) {
		struct rtattr *rta = tb[IFLA_VTI_IKEY];
		__u32 key = rta_getattr_u32(rta);

		if (key && inet_ntop(AF_INET, RTA_DATA(rta), s2, sizeof(s2)))
			print_string(PRINT_ANY, "ikey", "ikey %s ", s2);
	}

	if (tb[IFLA_VTI_OKEY]) {
		struct rtattr *rta = tb[IFLA_VTI_OKEY];
		__u32 key = rta_getattr_u32(rta);

		if (key && inet_ntop(AF_INET, RTA_DATA(rta), s2, sizeof(s2)))
			print_string(PRINT_ANY, "okey", "okey %s ", s2);
	}

	if (tb[IFLA_VTI_FWMARK]) {
		__u32 fwmark = rta_getattr_u32(tb[IFLA_VTI_FWMARK]);

		if (fwmark) {
			print_0xhex(PRINT_ANY,
				    "fwmark", "fwmark %#llx ", fwmark);
		}
	}
}
开发者ID:eworm-de,项目名称:iproute2,代码行数:101,代码来源:link_vti6.c


示例12: vti_parse_opt


//.........这里部分代码省略.........
			NEXT_ARG();
			if (!strcmp(*argv, "any")) {
				fprintf(stderr, "invalid value for \"local\": \"%s\"\n", *argv);
				exit(-1);
			} else {
				saddr = get_addr32(*argv);
			}
		} else if (!matches(*argv, "dev")) {
			NEXT_ARG();
			link = if_nametoindex(*argv);
			if (link == 0) {
				fprintf(stderr, "Cannot find device \"%s\"\n",
					*argv);
				exit(-1);
			}
		} else if (strcmp(*argv, "fwmark") == 0) {
			NEXT_ARG();
			if (get_u32(&fwmark, *argv, 0))
				invarg("invalid fwmark\n", *argv);
		} else
			usage();
		argc--; argv++;
	}

	addattr32(n, 1024, IFLA_VTI_IKEY, ikey);
	addattr32(n, 1024, IFLA_VTI_OKEY, okey);
	addattr_l(n, 1024, IFLA_VTI_LOCAL, &saddr, 4);
	addattr_l(n, 1024, IFLA_VTI_REMOTE, &daddr, 4);
	addattr32(n, 1024, IFLA_VTI_FWMARK, fwmark);
	if (link)
		addattr32(n, 1024, IFLA_VTI_LINK, link);

	return 0;
}

static void vti_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
	const char *local = "any";
	const char *remote = "any";
	__u32 key;
	unsigned int link;
	char s2[IFNAMSIZ];

	if (!tb)
		return;

	if (tb[IFLA_VTI_REMOTE]) {
		unsigned int addr = rta_getattr_u32(tb[IFLA_VTI_REMOTE]);

		if (addr)
			remote = format_host(AF_INET, 4, &addr);
	}

	print_string(PRINT_ANY, "remote", "remote %s ", remote);

	if (tb[IFLA_VTI_LOCAL]) {
		unsigned int addr = rta_getattr_u32(tb[IFLA_VTI_LOCAL]);

		if (addr)
			local = format_host(AF_INET, 4, &addr);
	}

	print_string(PRINT_ANY, "local", "local %s ", local);

	if (tb[IFLA_VTI_LINK] &&
	    (link = rta_getattr_u32(tb[IFLA_VTI_LINK]))) {
		const char *n = if_indextoname(link, s2);

		if (n)
			print_string(PRINT_ANY, "link", "dev %s ", n);
		else
			print_uint(PRINT_ANY, "link_index", "dev %u ", link);
	}

	if (tb[IFLA_VTI_IKEY] &&
	    (key = rta_getattr_u32(tb[IFLA_VTI_IKEY])))
		print_0xhex(PRINT_ANY, "ikey", "ikey %#x ", ntohl(key));


	if (tb[IFLA_VTI_OKEY] &&
	    (key = rta_getattr_u32(tb[IFLA_VTI_OKEY])))
		print_0xhex(PRINT_ANY, "okey", "okey %#x ", ntohl(key));

	if (tb[IFLA_VTI_FWMARK]) {
		__u32 fwmark = rta_getattr_u32(tb[IFLA_VTI_FWMARK]);

		if (fwmark) {
			SPRINT_BUF(b1);

			snprintf(b1, sizeof(b1), "0x%x", fwmark);
			print_string(PRINT_ANY, "fwmark", "fwmark %s ", s2);
		}
	}
}

static void vti_print_help(struct link_util *lu, int argc, char **argv,
	FILE *f)
{
	print_usage(f);
}
开发者ID:6WIND,项目名称:iproute2,代码行数:101,代码来源:link_vti.c


示例13: print_fp

void print_fp(float number) {
  char s[10];

  dtostre(number,s,3,0);
  print_string(s);
}
开发者ID:trainman419,项目名称:slash-atmel,代码行数:6,代码来源:lcd.c


示例14: print_int

void print_int(u16 number) {
  u08 test[7];

  print_string((char*)itoa(number,test,10
  ));
}
开发者ID:trainman419,项目名称:slash-atmel,代码行数:6,代码来源:lcd.c


示例15: switch

/* Render a value to text. */
static char *print_value(cJSON *item, int depth, int fmt, printbuffer *p)
{
    char *out = 0;
    if (!item) return 0;
    if (p)
    {
        switch ((item->type) & 255)
        {
            case cJSON_NULL:
            {
                out = ensure(p, 5);
                if (out) strcpy(out, "null");
                break;
            }
            case cJSON_False:
            {
                out = ensure(p, 6);
                if (out) strcpy(out, "false");
                break;
            }
            case cJSON_True:
            {
                out = ensure(p, 5);
                if (out) strcpy(out, "true");
                break;
            }
            case cJSON_Number:
                out = print_number(item, p);
                break;
            case cJSON_String:
                out = print_string(item, p);
                break;
            case cJSON_Array:
                out = print_array(item, depth, fmt, p);
                break;
            case cJSON_Object:
                out = print_object(item, depth, fmt, p);
                break;
        }
    }
    else
    {
        switch ((item->type) & 255)
        {
            case cJSON_NULL:
                out = cJSON_strdup("null");
                break;
            case cJSON_False:
                out = cJSON_strdup("false");
                break;
            case cJSON_True:
                out = cJSON_strdup("true");
                break;
            case cJSON_Number:
                out = print_number(item, 0);
                break;
            case cJSON_String:
                out = print_string(item, 0);
                break;
            case cJSON_Array:
                out = print_array(item, depth, fmt, 0);
                break;
            case cJSON_Object:
                out = print_object(item, depth, fmt, 0);
                break;
        }
    }
    return out;
}
开发者ID:EagleSmith,项目名称:OneNET_demo_code_kylin,代码行数:70,代码来源:cJSON.c


示例16: print_string_exit

static void __exit print_string_exit(void)
{
    print_string("Goodbye world!");
}
开发者ID:Andrealphus,项目名称:Drivers-for-USB-storage-Zhao,代码行数:4,代码来源:abcc.c


示例17: submenu_savestate

 void submenu_savestate()
 {
   print_string("Savestate options:", COLOR_ACTIVE_ITEM, COLOR_BG, 10, 70);
   menu_change_state();
 }
开发者ID:dmitrysmagin,项目名称:gpsp-rzx50,代码行数:5,代码来源:gui.c


示例18: main

int main(int argc, char* argv[])
{
    codecs_t *cl;
    FILE *f1;
    FILE *f2;
    int c,d,i;
    int pos;
    int section=-1;
    int nr_codecs;
    int win32=-1;
    int dshow=-1;
    int win32ex=-1;

    /*
     * Take path to codecs.conf from command line, or fall back on
     * etc/codecs.conf
     */
    if (!(nr_codecs = parse_codec_cfg((argc>1)?argv[1]:"etc/codecs.conf")))
        exit(1);
    if (codecs_conf_release < CODEC_CFG_MIN)
        exit(1);

    if (argc > 1) {
        int i, j;
        const char* nm[2];
        codecs_t* cod[2];
        int nr[2];

        nm[0] = "builtin_video_codecs";
        cod[0] = video_codecs;
        nr[0] = nr_vcodecs;

        nm[1] = "builtin_audio_codecs";
        cod[1] = audio_codecs;
        nr[1] = nr_acodecs;

        printf("/* GENERATED FROM %s, DO NOT EDIT! */\n\n",argv[1]);
        printf("#include <stddef.h>\n");
        printf("#include \"codec-cfg.h\"\n\n");
        printf("#define CODEC_CFG_MIN %i\n\n", codecs_conf_release);

        for (i=0; i<2; i++) {
            printf("const codecs_t %s[] = {\n", nm[i]);
            for (j = 0; j < nr[i]; j++) {
                printf("{");

                print_int_array(cod[i][j].fourcc, CODECS_MAX_FOURCC);
                printf(", /* fourcc */\n");

                print_int_array(cod[i][j].fourccmap, CODECS_MAX_FOURCC);
                printf(", /* fourccmap */\n");

                print_int_array(cod[i][j].outfmt, CODECS_MAX_OUTFMT);
                printf(", /* outfmt */\n");

                print_char_array(cod[i][j].outflags, CODECS_MAX_OUTFMT);
                printf(", /* outflags */\n");

                print_int_array(cod[i][j].infmt, CODECS_MAX_INFMT);
                printf(", /* infmt */\n");

                print_char_array(cod[i][j].inflags, CODECS_MAX_INFMT);
                printf(", /* inflags */\n");

                print_string(cod[i][j].name);    printf(", /* name */\n");
                print_string(cod[i][j].info);    printf(", /* info */\n");
                print_string(cod[i][j].comment); printf(", /* comment */\n");
                print_string(cod[i][j].dll);     printf(", /* dll */\n");
                print_string(cod[i][j].drv);     printf(", /* drv */\n");

                printf("{ 0x%08lx, %hu, %hu,",
                       cod[i][j].guid.f1,
                       cod[i][j].guid.f2,
                       cod[i][j].guid.f3);
                print_char_array(cod[i][j].guid.f4, sizeof(cod[i][j].guid.f4));
                printf(" }, /* GUID */\n");
                printf("%hd /* flags */, %hd /* status */, %hd /* cpuflags */ }\n",
                       cod[i][j].flags,
                       cod[i][j].status,
                       cod[i][j].cpuflags);
                if (j < nr[i]) printf(",\n");
            }
            printf("};\n\n");
        }
        exit(0);
    }

    f1=fopen("DOCS/tech/codecs-in.html","rb"); if(!f1) exit(1);
    f2=fopen("DOCS/codecs-status.html","wb"); if(!f2) exit(1);

    while((c=fgetc(f1))>=0){
        if(c!='%'){
            fputc(c,f2);
            continue;
        }
        d=fgetc(f1);
        if(d>='0' && d<='9'){
            // begin section
            section=d-'0';
            //printf("BEGIN %d\n",section);
//.........这里部分代码省略.........
开发者ID:AlexanderDenkMA,项目名称:TypeChef-mplayerAnalysis,代码行数:101,代码来源:codec-cfg.c


示例19: print_option

static ssize_t
print_option(char *s, ssize_t len, int type, int dl, const uint8_t *data)
{
	const uint8_t *e, *t;
	uint16_t u16;
	int16_t s16;
	uint32_t u32;
	int32_t s32;
	struct in_addr addr;
	ssize_t bytes = 0;
	ssize_t l;
	char *tmp;

	if (type & RFC3397) {
		l = decode_rfc3397(NULL, 0, dl, data);
		if (l < 1)
			return l;
		tmp = xmalloc(l);
		decode_rfc3397(tmp, l, dl, data);
		l = print_string(s, len, l - 1, (uint8_t *)tmp);
		free(tmp);
		return l;
	}

	if (type & RFC3442)
		return decode_rfc3442(s, len, dl, data);

	if (type & STRING) {
		/* Some DHCP servers return NULL strings */
		if (*data == '\0')
			return 0;
		return print_string(s, len, dl, data);
	}

	if (!s) {
		if (type & UINT8)
			l = 3;
		else if (type & UINT16)
			l = 5;
		else if (type & SINT16)
			l = 6;
		else if (type & UINT32)
			l = 10;
		else if (type & SINT32)
			l = 11;
		else if (type & IPV4)
			l = 16;
		else {
			errno = EINVAL;
			return -1;
		}
		return (l + 1) * dl;
	}

	t = data;
	e = data + dl;
	while (data < e) {
		if (data != t) {
			*s++ = ' ';
			bytes++;
			len--;
		}
		if (type & UINT8) {
			l = snprintf(s, len, "%d", *data);
			data++;
		} else if (type & UINT16) {
			memcpy(&u16, data, sizeof(u16));
			u16 = ntohs(u16);
			l = snprintf(s, len, "%d", u16);
			data += sizeof(u16);
		} else if (type & SINT16) {
			memcpy(&s16, data, sizeof(s16));
			s16 = ntohs(s16);
			l = snprintf(s, len, "%d", s16);
			data += sizeof(s16);
		} else if (type & UINT32) {
			memcpy(&u32, data, sizeof(u32));
			u32 = ntohl(u32);
			l = snprintf(s, len, "%d", u32);
			data += sizeof(u32);
		} else if (type & SINT32) {
			memcpy(&s32, data, sizeof(s32));
			s32 = ntohl(s32);
			l = snprintf(s, len, "%d", s32);
			data += sizeof(s32);
		} else if (type & IPV4) {
			memcpy(&addr.s_addr, data, sizeof(addr.s_addr));
			l = snprintf(s, len, "%s", inet_ntoa(addr));
			data += sizeof(addr.s_addr);
		} else
			l = 0;
		len -= l;
		bytes += l;
		s += l;
	}

	return bytes;
}
开发者ID:Andproject,项目名称:platform_external_dhcpcd,代码行数:98,代码来源:dhcp.c


示例20: arp_process

void arp_process(u8* arp_buff, int length)
{
	u32 i = 0;
	u8* ptr = NULL;
	ARP_HDR* arp_buff_ptr = (ARP_HDR*)arp_buff;
	u8 dev_mac_addr[6] = {9, 8, 7, 6, 5, 4};

	u8 src_ip_addr[4] = {192, 168, 1, 20};
	ARP_HDR arp_send_buf;
	u8 host_ip_addr[4];
	u8 host_mac_addr[6];
	
	switch(ADJUST_ENDIAN(arp_buff_ptr->opcode))
	{
//		printf_string("arp_buff_ptr->opcode = 0x%x\n", ADJUST_ENDIAN(arp_buff_ptr->opcode));
		case 1:	/* Arp request packet */
			/* 1. Construct arp ack packet */
			memcpy(arp_send_buf.eth_hdr.d_mac, arp_buff_ptr->src_mac, 6);
			memcpy(arp_send_buf.eth_hdr.s_mac,arp_buff_ptr->dst_mac, 6);
			arp_send_buf.eth_hdr.type = ADJUST_ENDIAN(0x0806);

			arp_send_buf.hw_type = ADJUST_ENDIAN(0x01);
			arp_send_buf.protocol = ADJUST_ENDIAN(0x0800);
			arp_send_buf.hw_len = 6;
			arp_send_buf.protocol_len = 4;
			arp_send_buf.opcode = ADJUST_ENDIAN(0x02);
			
			memcpy(arp_send_buf.src_mac, dev_mac_addr, 6);
			memcpy(arp_send_buf.src_ip_addr, src_ip_addr, 4);
			
			memcpy(arp_send_buf.dst_mac, arp_buff_ptr->src_mac, 6);				
			memcpy(arp_send_buf.dst_ip_addr, arp_buff_ptr->src_ip_addr, 4);		
			
			/* 2. Send request packet*/			
			dm9000_send((u8*)&arp_send_buf, (14 + 28));
			
			break;

		case 2: /* Arp ack packet */
			memcpy(host_ip_addr, (*arp_buff_ptr).src_ip_addr, 4);
			memcpy(host_mac_addr, (*arp_buff_ptr).src_mac, 6);
			
			print_string("\nHost ip = ");
			for(i = 0; i < 4; i++)
			{
				printf_string("%d ", host_ip_addr[i]);
			}
			
			print_string("\nHost mac = ");
			for(i = 0; i < 6; i++)
			{
				printf_string("%C ", host_mac_addr[i]);
			}
			print_string("\n");
			
			break;
			
		default:
			break;
	}
}
开发者ID:Kevin-l-wu,项目名称:Mini2440,代码行数:61,代码来源:Arp.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ print_string_ptr函数代码示例发布时间:2022-05-30
下一篇:
C++ print_status函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap