/* 将格式化字符串输入到一个缓冲区去中... * 参数 resBuf 指定输出缓冲区 * 参数 nSize 指定输出缓冲区的大小 * 其他参数是格式化字符串信息 * 函数返回值为有效地字符串的大小 * */ int mySprintf(char *resBuf , int nSize , char *format , ...) { int nCount = -1; if(nSize < 0 || NULL == resBuf) return -1; nCount = 0; DO_ARG(resBuf , nSize , nCount , format); return nCount; }
void printDebugInfoWithoutTime(char *format , ...) { char msgBuf[MY_MAX_LINE]; int nSize = MY_MAX_LINE; if(NULL == format) { fprintf(stderr , "Hint : error input in printDebugInfo()!\n"); return ; } int nCount = 0; DO_ARG(msgBuf , nSize , nCount , format); msgBuf[nCount] = '\0'; do_print_debug_info(msgBuf , NULL); }
/* 将制定的内容格式化输出 * 参数是格式化形式的字符串,可变参数 */ void printDebugInfo(char *format , ...) { int nCount = -1; char msgBuf[MY_MAX_LINE]; char timeBuf[MY_MAX_LINE]; int nSize = MY_MAX_LINE; if(NULL == format) { fprintf(stderr , "Hint : error input in printDebugInfo()!\n"); return ; } nCount = 0; DO_ARG(msgBuf , nSize , nCount , format); msgBuf[nCount] = '\0'; getTime(timeBuf , MY_MAX_LINE); do_print_debug_info(msgBuf , timeBuf); }
//////////////////////////////////////////////////////////////////////////////// // Main Flight Plan // // Fly a 100m square at an altitude of 100m, beginning above the origin, pointing North #define SQUARE 1 const struct logoInstructionDef instructions[] = { SET_ALT(100) // Go Home and point North HOME REPEAT_FOREVER DO_ARG(SQUARE, 100) END TO (SQUARE) REPEAT(4) FD_PARAM RT(90) END END } ; //////////////////////////////////////////////////////////////////////////////// // RTL Flight Plan //