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


C++ printInteger函数代码示例

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


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

示例1: writeConstructor

static void writeConstructor(A2PWriter writer, A2PType expected, ATermAppl constructor){
	A2PConstructorType t = (A2PConstructorType) expected->theType;
	A2PTupleType children = ((A2PTupleType) t->children->theType);
	int nrOfChildren = typeArraySize(children->fieldTypes);
	
	ISIndexedSet sharedTypes = writer->typeSharingMap;
	int typeHash = hashType(expected);
	int constructorTypeId = ISget(sharedTypes, (void*) expected, typeHash);
	int arity = ATgetArity(ATgetAFun(constructor));
	int i;
	
	if(arity != nrOfChildren){ fprintf(stderr, "Arity (%d) is unequal to the number of children (%d); term was:\n%s\n", arity, nrOfChildren, ATwriteToString((ATerm) constructor)); exit(1);}
	
	if(constructorTypeId == -1){
		writeByteToBuffer(writer->buffer, PDB_CONSTRUCTOR_HEADER);
		
		doWriteType(writer, expected);
		
		ISstore(sharedTypes, (void*) expected, typeHash);
	}else{
		writeByteToBuffer(writer->buffer, PDB_CONSTRUCTOR_HEADER | PDB_TYPE_SHARED_FLAG);
		
		printInteger(writer->buffer, constructorTypeId);
	}
	
	printInteger(writer->buffer, arity);
	
	for(i = 0; i < arity; i++){
		doSerialize(writer, children->fieldTypes[i], ATgetArgument(constructor, i));
	}
}
开发者ID:cwi-swat,项目名称:eclipse-meta-environment,代码行数:31,代码来源:aterm2pbf.c

示例2: writeTupleType

static void writeTupleType(A2PWriter writer, A2PType tupleType){
	A2PTupleType t = (A2PTupleType) tupleType->theType;
	A2PType *fieldTypes = t->fieldTypes;
	char **fieldNames = t->fieldNames;
	int nrOfFields = typeArraySize(fieldTypes);
	int hasFieldNames = (fieldNames == NULL) ? 0 : 1;
	int i;
	
	if(hasFieldNames == 0){
		writeByteToBuffer(writer->buffer, PDB_TUPLE_TYPE_HEADER);
		
		printInteger(writer->buffer, nrOfFields);
		
		for(i = 0; i < nrOfFields; i++){
			writeType(writer, t->fieldTypes[i]);
		}
	}else{
		writeByteToBuffer(writer->buffer, PDB_TUPLE_TYPE_HEADER | PDB_HAS_FIELD_NAMES);
		
		printInteger(writer->buffer, nrOfFields);
		
		for(i = 0; i < nrOfFields; i++){
			char *fieldName = fieldNames[i];
			int fieldNameLength = dataArraySize(fieldName);
			
			writeType(writer, t->fieldTypes[i]);
			
			printInteger(writer->buffer, fieldNameLength);
			writeDataToBuffer(writer->buffer, fieldName, fieldNameLength);
		}
	}
}
开发者ID:cwi-swat,项目名称:eclipse-meta-environment,代码行数:32,代码来源:aterm2pbf.c

示例3: printDouble

void printDouble(double val, uint8_t precision){
  if(val < 0.0){
    printByte('-');
    val = -val;
  }
  printInteger((long)val);
  if(precision > 0) {
    printByte('.');
    unsigned long frac;
    unsigned long mult = 1;
    uint8_t padding = precision -1;
    while(precision--)
      mult *=10;
    if(val >= 0)
      frac = (val - (int)val) * mult;
    else
      frac = ((int)val- val) * mult;
    unsigned long frac1 = frac;
    while(frac1 /= 10 )
      padding--;
    while(padding--)
      printByte('0');
    printInteger(frac);
  }
}
开发者ID:olilarkin,项目名称:OwlWare,代码行数:25,代码来源:serial.c

示例4: writeSet

static void writeSet(A2PWriter writer, A2PType expected, ATermList set){
	A2PSetType setType = (A2PSetType) expected->theType;
	
	A2PType elementType = setType->elementType;
	ISIndexedSet sharedTypes = writer->typeSharingMap;
	int elementHash = hashType(elementType);
	int elementTypeId = ISget(sharedTypes, (void*) elementType, elementHash);
	int size = ATgetLength(set);
	ATermList next;
	
	if(elementTypeId == -1){
		writeByteToBuffer(writer->buffer, PDB_SET_HEADER);
		
		doWriteType(writer, elementType);
		
		ISstore(sharedTypes, (void*) elementType, elementHash);
	}else{
		writeByteToBuffer(writer->buffer, PDB_SET_HEADER | PDB_TYPE_SHARED_FLAG);
		
		printInteger(writer->buffer, elementTypeId);
	}
	
	printInteger(writer->buffer, size);
	next = set;
	while(!ATisEmpty(next)){
		ATerm current = ATgetFirst(next);
		next = ATgetNext(next);
		
		doSerialize(writer, elementType, current);
	}
}
开发者ID:cwi-swat,项目名称:eclipse-meta-environment,代码行数:31,代码来源:aterm2pbf.c

示例5: writeRelation

static void writeRelation(A2PWriter writer, A2PType expected, ATermList relation){
	A2PRelationType relationType = (A2PRelationType) expected->theType;
	
	A2PType tupleType = relationType->tupleType;
	ISIndexedSet sharedTypes = writer->typeSharingMap;
	int tupleHash = hashType(tupleType);
	int tupleTypeId = ISget(sharedTypes, (void*) tupleType, tupleHash);
	int size = ATgetLength(relation);
	ATermList next;
	
	if(tupleTypeId == -1){
		writeByteToBuffer(writer->buffer, PDB_RELATION_HEADER);
		
		doWriteType(writer, tupleType);
		
		ISstore(sharedTypes, (void*) tupleType, tupleHash);
	}else{
		writeByteToBuffer(writer->buffer, PDB_RELATION_HEADER | PDB_TYPE_SHARED_FLAG);
		
		printInteger(writer->buffer, tupleTypeId);
	}
	
	printInteger(writer->buffer, size);
	next = relation;
	while(!ATisEmpty(next)){
		ATerm current = ATgetFirst(next);
		next = ATgetNext(next);
		
		doSerialize(writer, tupleType, current);
	}
}
开发者ID:cwi-swat,项目名称:eclipse-meta-environment,代码行数:31,代码来源:aterm2pbf.c

示例6: writeNode

static void writeNode(A2PWriter writer, A2PType expected, ATermAppl node){
	AFun fun = ATgetAFun(node);
	int arity = ATgetArity(fun);
	char *name = ATgetName(fun);
	int i;
	
	unsigned int hash = hashString(name);
	int nodeNameId = ISstore(writer->nameSharingMap, (void*) name, hash);
	if(nodeNameId == -1){
		int nameLength = dataArraySize(name);
		
		writeByteToBuffer(writer->buffer, PDB_NODE_HEADER);
		
		printInteger(writer->buffer, nameLength);
		writeDataToBuffer(writer->buffer, name, nameLength);
	}else{
		writeByteToBuffer(writer->buffer, PDB_NODE_HEADER | PDB_NAME_SHARED_FLAG);
		
		printInteger(writer->buffer, nodeNameId);
	}
	
	printInteger(writer->buffer, arity);
	
	for(i = 0; i < arity; i++){
		doSerialize(writer, A2PvalueType(), ATgetArgument(node, i));
	}
}
开发者ID:cwi-swat,项目名称:eclipse-meta-environment,代码行数:27,代码来源:aterm2pbf.c

示例7: status_message

static void status_message(int status_code) 
{
  if (status_code == 0) {
    int32_t* pos=get_current_position();
    printPgmString(PSTR("ok"));
    printPgmString(PSTR(" W:"));
    printInteger(pos[0]);
    printPgmString(PSTR(" X:"));
    printInteger(pos[1]);
    printPgmString(PSTR(" Y:"));
    printInteger(pos[2]);
    printPgmString(PSTR(" Z:"));
    printInteger(pos[3]);
    printPgmString(PSTR("\r\n"));
  } else {
    printPgmString(PSTR("error: "));
    switch(status_code) {          
      case STATUS_BAD_NUMBER_FORMAT:
      printPgmString(PSTR("Bad number format\r\n")); break;
      case STATUS_EXPECTED_COMMAND_LETTER:
      printPgmString(PSTR("Expected command letter\r\n")); break;
      case STATUS_UNSUPPORTED_STATEMENT:
      printPgmString(PSTR("Unsupported statement\r\n")); break;
      case STATUS_FLOATING_POINT_ERROR:
      printPgmString(PSTR("Floating point error\r\n")); break;
      default:
      printInteger(status_code);
      printPgmString(PSTR("\r\n"));
    }
  }
}
开发者ID:fablabnbg,项目名称:xxl-cnc-heissdraht,代码行数:31,代码来源:protocol.c

示例8: writeAnnotatedConstructorType

static void writeAnnotatedConstructorType(A2PWriter writer, A2PType constructorType){
	A2PConstructorType t = (A2PConstructorType) constructorType->theType;
	char *name = t->name;
        int nameLength = dataArraySize(name);
	HTHashtable hashtable = t->declaredAnnotations;
	HTIterator iterator = HTcreateIterator(hashtable);
	int nrOfAnnotations = HTsize(hashtable);
	HTEntry *nextAnnotation;

        writeByteToBuffer(writer->buffer, PDB_ANNOTATED_CONSTRUCTOR_TYPE_HEADER);

        printInteger(writer->buffer, nameLength);
        writeDataToBuffer(writer->buffer, name, nameLength);

        writeType(writer, t->children);

        writeType(writer, t->adt);
	
	printInteger(writer->buffer, nrOfAnnotations);
	
	while((nextAnnotation = HTgetNext(iterator)) != NULL){
		char *label = (char*) nextAnnotation->key;
		int labelLength = dataArraySize(label);
		
		printInteger(writer->buffer, labelLength);
		writeDataToBuffer(writer->buffer, label, labelLength);
		
		writeType(writer, (A2PType) nextAnnotation->value);
	}
}
开发者ID:cwi-swat,项目名称:eclipse-meta-environment,代码行数:30,代码来源:aterm2pbf.c

示例9: writeAnnotatedNode

static void writeAnnotatedNode(A2PWriter writer, A2PType expected, ATermAppl node, ATermList annotations){
	A2PNodeType t = (A2PNodeType) expected->theType;
	
	AFun fun = ATgetAFun(node);
	int arity = ATgetArity(fun);
	char *name = ATgetName(fun);
	int nrOfAnnotations = ATgetLength(annotations);
	int i;
	ATerm annotationLabel;
	ATerm annotationValue;
	
	unsigned int hash = hashString(name);
	int nodeNameId = ISstore(writer->nameSharingMap, (void*) name, hash);
	if(nodeNameId == -1){
		int nameLength = dataArraySize(name);
		
		writeByteToBuffer(writer->buffer, PDB_ANNOTATED_NODE_HEADER);
		
		printInteger(writer->buffer, nameLength);
		writeDataToBuffer(writer->buffer, name, nameLength);
	}else{
		writeByteToBuffer(writer->buffer, PDB_ANNOTATED_NODE_HEADER | PDB_NAME_SHARED_FLAG);
	
		printInteger(writer->buffer, nodeNameId);
	}
	
	printInteger(writer->buffer, arity);
	
	for(i = 0; i < arity; i++){
		doSerialize(writer, A2PvalueType(), ATgetArgument(node, i));
	}
	
	/* Annotations. */
	if((nrOfAnnotations % 2) == 1){ fprintf(stderr, "Detected corrupt annotations (Unbalanced).\n"); exit(1); }
	
	printInteger(writer->buffer, nrOfAnnotations);
	
	do{
		char *label;
		int labelLength;
		A2PType annotationType;
		
		annotationLabel = ATgetFirst(annotations);
		annotations = ATgetNext(annotations);
		annotationValue = ATgetFirst(annotations);
		annotations = ATgetNext(annotations);
		
		if(ATgetType(annotationLabel) != AT_APPL){ fprintf(stderr, "Detected corrupt annotation; label term is not a 'string'.\n"); exit(1); }
		
		label = ATgetName(ATgetAFun((ATermAppl) annotationLabel));
		labelLength = dataArraySize(label);
		
		printInteger(writer->buffer, labelLength);
		writeDataToBuffer(writer->buffer, label, labelLength);
		
		annotationType = (A2PType) HTget(t->declaredAnnotations, (void*) label, hashString(label));
		doSerialize(writer, annotationType, annotationValue);
	}while(!ATisEmpty(annotations));
}
开发者ID:cwi-swat,项目名称:eclipse-meta-environment,代码行数:59,代码来源:aterm2pbf.c

示例10: writeAnnotatedConstructor

static void writeAnnotatedConstructor(A2PWriter writer, A2PType expected, ATermAppl constructor, ATermList annotations){
	A2PConstructorType t = (A2PConstructorType) expected->theType;
	
	ISIndexedSet sharedTypes = writer->typeSharingMap;
	int typeHash = hashType(expected);
	int constructorTypeId = ISget(sharedTypes, (void*) expected, typeHash);
	int arity = ATgetArity(ATgetAFun(constructor));
	int nrOfAnnotations = ATgetLength(annotations);
	int i;
	ATerm annotationLabel;
	ATerm annotationValue;
	
	if(constructorTypeId == -1){
		writeByteToBuffer(writer->buffer, PDB_ANNOTATED_CONSTRUCTOR_HEADER);
		
		doWriteType(writer, expected);
		
		ISstore(sharedTypes, (void*) expected, typeHash);
	}else{
		writeByteToBuffer(writer->buffer, PDB_ANNOTATED_CONSTRUCTOR_HEADER | PDB_TYPE_SHARED_FLAG);
		
		printInteger(writer->buffer, constructorTypeId);
	}
	
	printInteger(writer->buffer, arity);
	
	for(i = 0; i < arity; i++){
		doSerialize(writer, ((A2PTupleType) t->children->theType)->fieldTypes[i], ATgetArgument(constructor, i));
	}
	
	/* Annotations. */
	if((nrOfAnnotations % 2) == 1){ fprintf(stderr, "Detected corrupt annotations (Unbalanced).\n"); exit(1); }
	
	printInteger(writer->buffer, nrOfAnnotations);
	
	do{
		char *label;
		int labelLength;
		A2PType annotationType;
		
		annotationLabel = ATgetFirst(annotations);
		annotations = ATgetNext(annotations);
		annotationValue = ATgetFirst(annotations);
		annotations = ATgetNext(annotations);
		
		if(ATgetType(annotationLabel) != AT_APPL){ fprintf(stderr, "Detected corrupt annotation; label term is not a 'string'.\n"); exit(1); }
		
		label = ATgetName(ATgetAFun((ATermAppl) annotationLabel));
		labelLength = dataArraySize(label);
		
		printInteger(writer->buffer, labelLength);
		writeDataToBuffer(writer->buffer, label, labelLength);
		
		annotationType = (A2PType) HTget(t->declaredAnnotations, (void*) label, hashString(label));
		doSerialize(writer, annotationType, annotationValue);
	}while(!ATisEmpty(annotations));
}
开发者ID:cwi-swat,项目名称:eclipse-meta-environment,代码行数:57,代码来源:aterm2pbf.c

示例11: report_gcode_modes

// Print current gcode parser mode state
void report_gcode_modes()
{
  switch (gc.motion_mode) {
    case MOTION_MODE_SEEK : printPgmString(PSTR("[G0")); break;
    case MOTION_MODE_LINEAR : printPgmString(PSTR("[G1")); break;
    case MOTION_MODE_CW_ARC : printPgmString(PSTR("[G2")); break;
    case MOTION_MODE_CCW_ARC : printPgmString(PSTR("[G3")); break;
    case MOTION_MODE_CANCEL : printPgmString(PSTR("[G80")); break;
  }

  printPgmString(PSTR(" G"));
  printInteger(gc.coord_select+54);
  
  if (gc.plane_axis_0 == X_AXIS) {
    if (gc.plane_axis_1 == Y_AXIS) { printPgmString(PSTR(" G17")); }
    else { printPgmString(PSTR(" G18")); }
  } else { printPgmString(PSTR(" G19")); }
  
  if (gc.inches_mode) { printPgmString(PSTR(" G20")); }
  else { printPgmString(PSTR(" G21")); }
  
  if (gc.absolute_mode) { printPgmString(PSTR(" G90")); }
  else { printPgmString(PSTR(" G91")); }
  
  if (gc.inverse_feed_rate_mode) { printPgmString(PSTR(" G93")); }
  else { printPgmString(PSTR(" G94")); }
    
  switch (gc.program_flow) {
    case PROGRAM_FLOW_RUNNING : printPgmString(PSTR(" M0")); break;
    case PROGRAM_FLOW_PAUSED : printPgmString(PSTR(" M1")); break;
    case PROGRAM_FLOW_COMPLETED : printPgmString(PSTR(" M2")); break;
  }

  switch (gc.spindle_direction) {
    case SPINDLE_ENABLE_CW : printPgmString(PSTR(" M3")); break;
    case SPINDLE_ENABLE_CCW : printPgmString(PSTR(" M4")); break;
    case SPINDLE_DISABLE : printPgmString(PSTR(" M5")); break;
  }
  
  switch (gc.coolant_mode) {
    case COOLANT_DISABLE : printPgmString(PSTR(" M9")); break;
    case COOLANT_FLOOD_ENABLE : printPgmString(PSTR(" M8")); break;
    #ifdef ENABLE_M7
      case COOLANT_MIST_ENABLE : printPgmString(PSTR(" M7")); break;
    #endif
  }
  
  printPgmString(PSTR(" T"));
  printInteger(gc.tool);
  
  printPgmString(PSTR(" F"));
  if (gc.inches_mode) { printFloat(gc.feed_rate*INCH_PER_MM); }
  else { printFloat(gc.feed_rate); }

  printPgmString(PSTR("]\r\n"));
}
开发者ID:rustyoz,项目名称:grbl,代码行数:57,代码来源:report.c

示例12: getsym

//	Parse the next token from the input stream.
void getsym(void) {

	// dispatch to handler for this type of char
	(*tokenhandlers[chartype(inchar)])();

#ifdef PARSER_TRACE
	if (trace) {
		sp(" sym="); printInteger(sym); sp(" v="); printInteger(symval); spb(' ');
	}
#endif
}
开发者ID:jquinnell,项目名称:arduino,代码行数:12,代码来源:bitlash-parser.c

示例13: writeBool

static void writeBool(A2PWriter writer, ATermAppl boolean){
	char *boolName = ATgetName(ATgetAFun(boolean));
	
	writeByteToBuffer(writer->buffer, PDB_BOOL_HEADER);
	
	if(strncmp(boolName, "true", 4) == 0){
		printInteger(writer->buffer, 1);
	}else{
		printInteger(writer->buffer, 0);
	}
}
开发者ID:cwi-swat,项目名称:eclipse-meta-environment,代码行数:11,代码来源:aterm2pbf.c

示例14: settings_dump

void settings_dump() {
  printPgmString(PSTR("$0 = ")); printFloat(settings.steps_per_mm[X_AXIS]);
  printPgmString(PSTR(" (steps/mm x)\r\n$1 = ")); printFloat(settings.steps_per_mm[Y_AXIS]);
  printPgmString(PSTR(" (steps/mm y)\r\n$2 = ")); printFloat(settings.steps_per_mm[Z_AXIS]);
  printPgmString(PSTR(" (steps/mm z)\r\n$3 = ")); printInteger(settings.pulse_microseconds);
  printPgmString(PSTR(" (microseconds step pulse)\r\n$4 = ")); printFloat(settings.default_feed_rate);
  printPgmString(PSTR(" (mm/min default feed rate)\r\n$5 = ")); printFloat(settings.default_seek_rate);
  printPgmString(PSTR(" (mm/min default seek rate)\r\n$6 = ")); printFloat(settings.mm_per_arc_segment);
  printPgmString(PSTR(" (mm/arc segment)\r\n$7 = ")); printInteger(settings.invert_mask); 
  printPgmString(PSTR(" (step port invert mask. binary = ")); printIntegerInBase(settings.invert_mask, 2);  
  printPgmString(PSTR(")\r\n$8 = ")); printFloat(settings.acceleration/(60*60)); // Convert from mm/min^2 for human readability
  printPgmString(PSTR(" (acceleration in mm/sec^2)\r\n$9 = ")); printFloat(settings.junction_deviation);
  printPgmString(PSTR(" (cornering junction deviation in mm)"));
  printPgmString(PSTR("\r\n'$x=value' to set parameter or just '$' to dump current settings\r\n"));
}
开发者ID:AVRsteffen,项目名称:grbl,代码行数:15,代码来源:settings.c

示例15: main

int main(void)
{
	
	ConfigPins();
	initUART();
	initSysTick();	
	RValue = initAccel();	
	printInteger(RValue);
	if (RValue == 0) {
		printString("Boldly going :)\r\n");
	} else {
		printString("Inertia sensors offline :(\r\n");
	}
	while (1) { 		
		Temperature = getTemperature();		
		printShort(Temperature);		
		printString(" ");					
		getMotion(&m);
		printShort(m.x_a);		
		printString(" ");
		printShort(m.y_a);		
		printString(" ");
		printShort(m.z_a);		
		printString(" ");		
		printString("\r\n");				
		GPIO0DATA ^= BIT2;				
		delay(10000);
	}

	return 0;
}
开发者ID:cs8425,项目名称:lpc1114-gcc-code,代码行数:31,代码来源:main.c


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