本文整理汇总了C++中printMsg函数的典型用法代码示例。如果您正苦于以下问题:C++ printMsg函数的具体用法?C++ printMsg怎么用?C++ printMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printMsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void CLI::run() {
bool worktime = true;
while (worktime) {
m_qout << "----------------" << endl
<< "1 - Enter array" << endl
<< "2 - Enter string" << endl
<< "3 - Quit" << endl
<< "Enter command: " << flush;
switch (m_qin.readLine().toInt()) {
case 1:
processArray();
break;
case 2:
processString();
break;
case 3:
worktime = false;
printMsg("See you later..." );
break;
default:
printMsg("Undefined command");
}
m_qout << endl << flush;
}
}
示例2: main
int main( void )
{
char letter[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
int i=0;
// mapMem( (void *)0xB8000, (void *)0xB8000, 8, 0 );
// __map( (void *)0xB8000, (void *)0xB8000, 8 );
__sleep( 4000 );
printMsg("Hi!\rHello! I'm talking to the video server!\nTesting...");
print("Should've written something");
while( true )
{
printMsg("\f\n");
printMsg( letter );
if( letter[i] == 'z' )
letter[i] = 'a';
else
letter[i] = letter[i] + 1;
i++;
i %= 80;
}
return 0;
// return printMsg( "Hi!\rHello! I'm talking to the video server!\fTesting..." );
}
示例3: readFromFlash
void readFromFlash(void) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "read f");
printMsg(logger, "readFromFlash()");
flashRead(FLASH_ADDR, (char *) &persistentState, PERSISTENT_SIZE);
persisted_configuration_state_e result;
if (!isValidCrc(&persistentState)) {
result = CRC_FAILED;
resetConfigurationExt(logger, DEFAULT_ENGINE_TYPE PASS_ENGINE_PARAMETER);
} else if (persistentState.version != FLASH_DATA_VERSION || persistentState.size != PERSISTENT_SIZE) {
result = INCOMPATIBLE_VERSION;
resetConfigurationExt(logger, engineConfiguration->engineType PASS_ENGINE_PARAMETER);
} else {
/**
* At this point we know that CRC and version number is what we expect. Safe to assume it's a valid configuration.
*/
result = OK;
applyNonPersistentConfiguration(logger PASS_ENGINE_PARAMETER);
}
// we can only change the state after the CRC check
engineConfiguration->firmwareVersion = getRusEfiVersion();
if (result == CRC_FAILED) {
printMsg(logger, "Need to reset flash to default due to CRC");
} else if (result == INCOMPATIBLE_VERSION) {
printMsg(logger, "Resetting but saving engine type [%d]", engineConfiguration->engineType);
} else {
printMsg(logger, "Got valid configuration from flash!");
}
}
示例4: on_single_shot_scan_event
static void on_single_shot_scan_event(wifi_scan_event event, unsigned status) {
if (event == WIFI_SCAN_BUFFER_FULL) {
printMsg("Received scan complete event - WIFI_SCAN_BUFFER_FULL \n");
} else if(event == WIFI_SCAN_COMPLETE) {
printMsg("Received scan complete event - WIFI_SCAN_COMPLETE\n");
putEventInCache(EVENT_TYPE_SCAN_COMPLETE, "One scan completed");
}
}
示例5: printMsg
static void *eventThreadFunc(void *context) {
printMsg("starting wifi event loop\n");
wifi_event_loop(halHandle);
printMsg("out of wifi event loop\n");
return NULL;
}
示例6: typecheck_unfold
static void typecheck_unfold(TYPED_PATT_LIST *context, PE_UNFOLD **phrases, TYPE_EXPR *domain, TYPE_EXPR *codomain)
{
ST_KEY destr_key;
int num_phrases, i, j;
TYPE_EXPR **types;
ST_TYPE_SIG *st_type_sig;
PE_PATT patt;
TYPE_EXPR *ptype[3];
TYPE_ASMT *asmt1, *asmt2;
if (!phrases || !(phrases[0])) printMsg(FATAL_MSG,"typecheck_unfold: phrases is empty");
destr_key = st_NameToKey(phrases[0]->destr);
num_phrases = st_GetNumStructors(st_GetStructorParent(destr_key));
types = (TYPE_EXPR **) MHA(tc_memory, (num_phrases*2)+2, sizeof(TYPE_EXPR *));
types[0] = convert_ST_TYPE_to_TE(st_GetGenericStateType(destr_key)); /* R(A) */
for (i=0; i<num_phrases; i++) {
j=i*2;
st_type_sig = st_GetTypeSig(st_NameToKey(phrases[i]->destr));
types[j+1] = convert_ST_TYPE_to_TE(st_type_sig->domain);
types[j+2] = convert_ST_TYPE_to_TE(st_type_sig->codomain);
}
types[(num_phrases*2)+1] = 0;
/* rename the A's */
types = rename_vars_in_TEL(assign_new_vars(collect_vars_in_TE(types[0])), types);
/* @ : R(A) -> (C @ R(A)) */
ptype[0] = types[0]; /* R(A) */
ptype[1] = product_type_expr(domain, types[0]); /* dom @ R(A) */
next_AT_con--;
ptype[1]->id.con = next_AT_con; /* new @ type constructor (-2 and lower) */
ptype[2] = 0;
patt.tag = P_HOVAR;
patt.info.var = AT_NAME;
context = add_patt_to_context(context, &patt, ptype);
asmt1 = type_asmt(-1,domain); /* C := dom */
asmt2 = type_asmt(-1,ptype[1]); /* C := dom @ R(A) */
for (i=0; i<num_phrases; i++) {
j=i*2;
types[j+1] = subst_in_TE(asmt1,types[j+1]); /* replace C by dom in phrase domain */
types[j+2] = subst_in_TE(asmt2,types[j+2]); /* replace C by [email protected](A) in Fi(A,C) */
typecheck_PE_LIST_T_PHRASE(context, phrases[i]->phrases, types[j+1], types[j+2]);
}
add_equation_to_SubstList(types[0], codomain);
/* apply SubstList to codomain and check that it contains no @ from present level */
if (type_con_occurs_in_TE(next_AT_con, subst_all_in_TE(SubstList,codomain))) {
tc_close_typechecker(0);
printMsg(ERROR_MSG,"@ type occurs in unfold codomain");
}
/* remove all @ occurrences (present level only) from SubstList */
SubstList = eliminate_AT_in_TAL(next_AT_con, SubstList);
}
示例7: ckpmon_run
int ckpmon_run(char *arg)
{
extern lua_State *L;
gchar *pmon_input = NULL;
char *pmon_buf = NULL;
gsize length = 0;
GRegex *regex;
GMatchInfo *match_info;
GError *err = NULL;
printPrompt("PMON版本输入格式如下例:\"1.3.6\"\n请输入\n");
// get pmon spec version: pmon_input
int len = getTableNumElement(L, "con", "PMONVER_LEN");
pmon_input = getNCharsPrompt("PMON版本条码", len, TRUE);
if (pmon_input == NULL) {
printPrompt("未输入\n");
return 1;
}
printPrompt("输入版本号为:");
printMsg(pmon_input);
printMsg("\n");
// get pmon env version: pmon_env
g_file_get_contents ("/proc/cmdline", &pmon_buf, &length, NULL);
regex = g_regex_new (PMON_STR,
G_REGEX_NO_AUTO_CAPTURE | G_REGEX_OPTIMIZE | G_REGEX_DUPNAMES,
0, &err);
g_regex_match (regex, pmon_buf, 0, &match_info);
gchar *pmon_named = g_match_info_fetch_named(match_info, "pmonver");
g_print ("%s\n", pmon_named);
// cmp
gchar *text_pmon_env = g_strdup_printf("本机的版本号[cmdline]为:%s\n", pmon_named);
printPrompt(g_string_chunk_insert_const(text_chunk, text_pmon_env));
g_free(text_pmon_env);
if (strcasecmp(pmon_input, (const char *)pmon_named)) {
printNG("机器当前PMON版本号与标准不相符!\n");
return 1;
} else {
printOK("PMON版本号相符。\n");
}
g_free(pmon_input); // TODO: here free g_strdup, but have not test
g_free (pmon_named);
g_match_info_free (match_info);
g_regex_unref (regex);
return 0;
}
示例8: lcd_HD44780_init
void lcd_HD44780_init(Logging *sharedLogger) {
logger = sharedLogger;
addConsoleAction("lcdinfo", lcdInfo);
if (engineConfiguration->displayMode > DM_HD44780_OVER_PCF8574) {
firmwareError("Unexpected displayMode %d", engineConfiguration->displayMode);
return;
}
printMsg(logger, "lcd_HD44780_init %d", engineConfiguration->displayMode);
if (engineConfiguration->displayMode == DM_HD44780) {
// initialize hardware lines
mySetPadMode2("lcd RS", boardConfiguration->HD44780_rs, PAL_MODE_OUTPUT_PUSHPULL);
mySetPadMode2("lcd E", boardConfiguration->HD44780_e, PAL_MODE_OUTPUT_PUSHPULL);
mySetPadMode2("lcd DB4", boardConfiguration->HD44780_db4, PAL_MODE_OUTPUT_PUSHPULL);
mySetPadMode2("lcd DB6", boardConfiguration->HD44780_db5, PAL_MODE_OUTPUT_PUSHPULL);
mySetPadMode2("lcd DB7", boardConfiguration->HD44780_db6, PAL_MODE_OUTPUT_PUSHPULL);
mySetPadMode2("lcd DB8", boardConfiguration->HD44780_db7, PAL_MODE_OUTPUT_PUSHPULL);
// and zero values
palWritePad(getHwPort(boardConfiguration->HD44780_rs), getHwPin(boardConfiguration->HD44780_rs), 0);
palWritePad(getHwPort(boardConfiguration->HD44780_e), getHwPin(boardConfiguration->HD44780_e), 0);
palWritePad(getHwPort(boardConfiguration->HD44780_db4), getHwPin(boardConfiguration->HD44780_db4), 0);
palWritePad(getHwPort(boardConfiguration->HD44780_db5), getHwPin(boardConfiguration->HD44780_db5), 0);
palWritePad(getHwPort(boardConfiguration->HD44780_db6), getHwPin(boardConfiguration->HD44780_db6), 0);
palWritePad(getHwPort(boardConfiguration->HD44780_db7), getHwPin(boardConfiguration->HD44780_db7), 0);
}
chThdSleepMilliseconds(20); // LCD needs some time to wake up
lcd_HD44780_write(LCD_HD44780_RESET); // reset 1x
chThdSleepMilliseconds(1);
lcd_HD44780_write(LCD_HD44780_RESET); // reset 2x
lcd_HD44780_write(LCD_HD44780_RESET); // reset 3x
lcd_HD44780_write(LCD_HD44780_4_BIT_BUS); // 4 bit, 2 line
chThdSleepMicroseconds(40);
lcd_HD44780_write(LCD_HD44780_4_BIT_BUS); // 4 bit, 2 line
lcd_HD44780_write(0x80);
chThdSleepMicroseconds(40);
lcd_HD44780_write_command(0x08); // display and cursor control
chThdSleepMicroseconds(40);
lcd_HD44780_write_command(LCD_HD44780_DISPLAY_CLEAR);
chThdSleepMilliseconds(2);
lcd_HD44780_write_command(LCD_HD44780_SHIFT_CURSOR_RIGHT);
chThdSleepMilliseconds(2);
lcd_HD44780_write_command(LCD_HD44780_DISPLAY_ON);
lcd_HD44780_set_position(0, 0);
printMsg(logger, "lcd_HD44780_init() done");
}
示例9: typecheck_PE_FUNCTION
static void typecheck_PE_FUNCTION(TYPED_PATT_LIST *context, PE_FUNCTION *fn, TYPE_EXPR *domain, TYPE_EXPR *codomain)
{
TYPE_EXPR **types;
ST_KEY st_key;
ST_TYPE_SIG *st_type_sig;
int num_macros, i, j;
PE_LIST_T_PHRASE **params;
types = find_var_in_context(context, fn->fun_name); /* look in context first */
if (types) {
/* must be a higher-order variable */
if (TEL_length(types) != 2) printMsg(FATAL_MSG,"typecheck_PE_FUNCTION: illegal type for h.o. variable");
add_equation_to_SubstList(domain, types[0]);
add_equation_to_SubstList(types[1], codomain);
}
else {
/* must be a previously defined function */
st_key = st_NameToKey(fn->fun_name);
if (st_key == 0) printMsg(FATAL_MSG,"typecheck_PE_FUNCTION: unknown function \"%s\"", fn->fun_name);
st_type_sig = st_GetTypeSig(st_key);
num_macros = st_GetNumMacros(st_key);
/* get function and macro types from st and rename all type vars */
types = (TYPE_EXPR **) MHA(tc_memory, (num_macros*2)+3, sizeof(TYPE_EXPR *));
types[0] = convert_ST_TYPE_to_TE(st_type_sig->domain);
types[1] = convert_ST_TYPE_to_TE(st_type_sig->codomain);
for (i=0; i<num_macros; i++) {
j=(i*2);
types[j+2] = convert_ST_TYPE_to_TE(st_type_sig->params[i]->domain);
types[j+3] = convert_ST_TYPE_to_TE(st_type_sig->params[i]->codomain);
}
types[(num_macros*2)+2] = 0;
types = rename_vars_in_TEL(assign_new_vars(collect_vars_in_TEL(types)), types);
/* typecheck all the macro args passed to the function */
params = fn->macros;
for (i=0; i<num_macros; i++) {
j=i*2;
if (params[i]) {
typecheck_PE_LIST_T_PHRASE(context, params[i], types[j+2], types[j+3]);
}
else {
tc_close_typechecker(0);
printMsg(ERROR_MSG, "too few macro arguments to function %s", fn->fun_name);
}
}
if (params && (params[i])) {
tc_close_typechecker(0);
printMsg(ERROR_MSG, "too many macro arguments to function %s", fn->fun_name);
}
add_equation_to_SubstList(domain, types[0]);
add_equation_to_SubstList(types[1], codomain);
}
}
示例10: getChannelList
void getChannelList(void)
{
wifi_channel channel[MAX_CH_BUF_SIZE];
int num_channels = 0, i;
int result = wifi_get_valid_channels(wlan0Handle, band, MAX_CH_BUF_SIZE,
channel, &num_channels);
printMsg("Number of channels - %d\nChannel List:\n",num_channels);
for (i = 0; i < num_channels; i++) {
printMsg("%d MHz\n", channel[i]);
}
}
示例11: getFeatureSet
void getFeatureSet(void)
{
feature_set set;
int result = wifi_get_supported_feature_set(wlan0Handle, &set);
if (result < 0) {
printMsg("Error %d\n",result);
return;
}
printFeatureListBitMask();
printMsg("Supported feature set bit mask - %x\n", set);
return;
}
示例12: printSignificantChangeResult
void printSignificantChangeResult(wifi_significant_change_result *res) {
wifi_significant_change_result &result = *res;
printMsg("%02x:%02x:%02x:%02x:%02x:%02x ", result.bssid[0], result.bssid[1],
result.bssid[2], result.bssid[3], result.bssid[4], result.bssid[5]);
printMsg("%d\t", result.channel);
for (int i = 0; i < result.num_rssi; i++) {
printMsg("%d,", result.rssi[i]);
}
printMsg("\n");
}
示例13: FreeBlock
void FreeBlock(int n){
if (n >= nDisco.header.ftable.nBlocks)
printMsg("Bloque No Existe");
else
if (nDisco.header.ftable.Table[n] == -1)
printMsg("Bloque reservado a Header");
else
if (nDisco.header.ftable.Table[n] == -2){
WriteBlock(n, n);
printMsg("Bloque Liberado");
}
else
printMsg("Bloque No Alocado Actualmente");
}
示例14: linux_set_iface_flags
int linux_set_iface_flags(int sock, const char *ifname, int dev_up)
{
struct ifreq ifr;
int ret;
printMsg("setting interface %s flags (%s)\n", ifname, dev_up ? "UP" : "DOWN");
if (sock < 0) {
printMsg("Bad socket: %d\n", sock);
return -1;
}
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, ifname, IFNAMSIZ);
printMsg("reading old value\n");
if (ioctl(sock, SIOCGIFFLAGS, &ifr) != 0) {
ret = errno ? -errno : -999;
printMsg("Could not read interface %s flags: %d\n", ifname, errno);
return ret;
}else {
printMsg("writing new value\n");
}
if (dev_up) {
if (ifr.ifr_flags & IFF_UP) {
printMsg("interface %s is already up\n", ifname);
return 0;
}
ifr.ifr_flags |= IFF_UP;
}else {
if (!(ifr.ifr_flags & IFF_UP)) {
printMsg("interface %s is already down\n", ifname);
return 0;
}
ifr.ifr_flags &= ~IFF_UP;
}
if (ioctl(sock, SIOCSIFFLAGS, &ifr) != 0) {
ret = -errno;
printMsg("Could not set interface %s flags \n", ifname);
return ret;
}else {
printMsg("set interface %s flags (%s)\n", ifname, dev_up ? "UP" : "DOWN");
}
printMsg("Done\n");
return 0;
}
示例15: test_msg
void test_msg (void)
{
l2net_154 *l2 ;
printf ("STEP 1: create 2 empty messages\n") ;
Msg *m1 = initMsg(l2) ;
printMsg (m1) ;
Msg *m2 = initMsg(l2) ;
printMsg (m2) ;
printf ("STEP 2: create options\n") ;
option *oup1 = initOptionOpaque(MO_Uri_Path, (void *) PATH1, sizeof PATH1-1) ;
option *oup2 = initOptionOpaque(MO_Uri_Path, (void *) PATH2, sizeof PATH2-1) ;
option *ouq1 = initOptionOpaque(MO_Uri_Query, (void *) URIQUERY1, sizeof URIQUERY1-1) ;
option *ouq2 = initOptionOpaque(MO_Uri_Query, (void *) URIQUERY2, sizeof URIQUERY2-1) ;
option *ouq3 = initOptionOpaque(MO_Uri_Query, (void *) URIQUERY3, sizeof URIQUERY3-1) ;
// REGISTER message
set_type (m1, COAP_TYPE_CON) ;
set_code (m1, COAP_CODE_GET) ;
set_id (m1, 10) ;
printf ("STEP 3a: M1 add uriquery2\n") ;
push_option (m1, ouq2) ;
printMsg (m1) ; printf("\n") ;
printf ("STEP 3b: M1 add uripath1\n") ;
push_option (m1, oup1) ;
printMsg (m1) ; printf("\n") ;
printf ("STEP 3c: M1 add uripath2\n") ;
push_option (m1, oup2) ;
printMsg (m1) ; printf("\n") ;
printf ("STEP 3d: M1 add uriquery1\n") ;
push_option (m1, ouq1) ;
printMsg (m1) ; printf("\n") ;
printf("STEP 3e: M1 add uriquery3\n") ;
push_option (m1, ouq3) ;
printMsg (m1) ; printf("\n") ;
set_type (m2, COAP_TYPE_NON) ;
set_code (m2, COAP_CODE_POST) ;
set_id (m2, 11) ;
printf ("STEP 3f: M2 add oriquery2\n") ;
push_option (m2, ouq2) ;
printMsg (m2) ; printf("\n") ;
if (get_errno () != 0)
{
printf ("ERROR : ERRNO => ") ;
printf ("%d\n",get_errno ()) ;
reset_errno () ;
}
clock_delay (1000) ;
}