Пример #1
0
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
0
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
0
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!");
	}
}
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");
    }
}
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
0
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 dom@R(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
0
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
0
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
0
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
0
void readFromFlash(void) {
	printMsg(logger, "readFromFlash()");
	persisted_configuration_state_e result = readConfiguration(logger);

	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!");
	}
}
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]);
    }
}
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;
}
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");
}
Пример #14
0
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");
}
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;
}
Пример #16
0
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) ;
}
static void onRTTResults (wifi_request_id id, unsigned num_results, wifi_rtt_result result[]) {

    printMsg("RTT results!!\n");
    printMsg("Addr\t\t\tts\t\tRSSI\tSpread\trtt\tsd\tspread\tdist\tsd\tspread\n");

    for (unsigned i = 0; i < num_results; i++) {
        printMsg("%02x:%02x:%02x:%02x:%02x:%02x\t%lld\t%d\t%d\t%lld\t%lld\t%lld\t%d\t%d\t%d\n",
                result[i].addr[0], result[i].addr[1], result[i].addr[2], result[i].addr[3],
                result[i].addr[4], result[i].addr[5], result[i].ts, result[i].rssi,
                result[i].rssi_spread, result[i].rtt, result[i].rtt_sd, result[i].rtt_spread,
                result[i].distance, result[i].distance_sd, result[i].distance_spread);
    }

    putEventInCache(EVENT_TYPE_RTT_RESULTS, "RTT results");
}
Пример #18
0
int FormatDisc(char *path){
  f = fopen(path, "r+");
  if (f == NULL){ // Validar que existe
      printMsg(strcat(path, " no existe. "));
      fclose(f);
      return -1;
  }

  fclose(f);


  // Calculos
  // Validar que esta umount
  //
  unsigned long discbytes;
  int blockbytes, fatSize_bytes;
  float references;
  nDisco.Name = path;
  blockbytes = (nDisco.header.BlockSize * cant_bytes);
  discbytes = nDisco.header.DiscSize * (unsigned long) cant_bytes * (unsigned long) cant_bytes;
  nDisco.header.ftable.nBlocks = discbytes / blockbytes;
  references =(float) (nDisco.header.ftable.nBlocks / (float) (blockbytes / 4));
  fatSize_bytes = references * blockbytes;
  getInfo();
  printf("\n\nblockbytes: %d\ndiscbytes: %d\nnBlocks: %d\nreferences: %f\nfatSize_bytes: %d", blockbytes, discbytes,nDisco.header.ftable.nBlocks, references, fatSize_bytes);

  //CreateFat
  CreateFat(fatSize_bytes);

  return 0;
}
Пример #19
0
WebUi::WebUi(WApplication *app) :
    AbstractUi(),
    m_app(app)
{
    app->setTitle("Quassel web interface");
    WVBoxLayout *layout = new WVBoxLayout;
    app->root()->setLayout(layout);
    
    /*m_loginButton = new WPushButton("Connect");
    m_loginButton->clicked().connect(this, &WebUi::connect);
    layout->addWidget(m_loginButton);*/

    _chatView = new WTableView(app->root());
    layout->addWidget(_chatView);

    _inputWidget = new WLineEdit(app->root());
    layout->addWidget(_inputWidget);
    

    QObject::connect(Client::coreConnection(), SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString)), SLOT(userAuthenticationRequired(CoreAccount*,bool*,QString)));
    QObject::connect(Client::coreConnection(), SIGNAL(connectionMsg(QString)), SLOT(printMsg(QString)));
    QObject::connect(Client::coreConnection(), SIGNAL(progressTextChanged(QString)), SLOT(printMsg(QString)));
    QObject::connect(Client::coreConnection(), SIGNAL(connectionError(QString)), SLOT(printMsg(QString)));
    QObject::connect(Client::coreConnection(), SIGNAL(connectionErrorPopup(QString)), SLOT(printMsg(QString)));
    //QObject::connect(Client::coreConnection(), SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString)), SLOT(userAuthenticationRequired(CoreAccount*,bool*,QString)));
    //Client::coreAccountModel()->load();
    //if (!Client::coreConnection()->connectToCore()) {
        bool ok;
        userAuthenticationRequired(0, &ok, "");
    //}
}
Пример #20
0
/*********************************
 *                               *
 *    printRecord                *
 *                               *
 *********************************/
void
printRecord(PE_RECORD **record)
{
     int   count        = 0;
     char *parent       = NULL;
     int   numStructors = 0;
     assert(record);

     parent = getStructorParent(record[0]->destr);
     numStructors = getNumStructors(parent);

     printf("(");

     for (count = 0; count < numStructors; count++) {
          if (record[count]) {
               if (count != 0)
                    printf(", ");
               printf("%s:", record[0]->destr);
               printExpr(record[0]->expr);
          }
          else {
               printMsg(WARN_MSG, "printRecord - incomplete number of destructors");
               /* !!!! set parse error flag */
          }
     }
     printf(")");
}
void getFeatureSetMatrix(void)
{
    feature_set set[MAX_FEATURE_SET];
    int size;

    int result = wifi_get_concurrency_matrix(wlan0Handle, MAX_FEATURE_SET, set, &size);

    if (result < 0) {
        printMsg("Error %d\n",result);
        return;
    }
    printFeatureListBitMask();
    for (int i = 0; i < size; i++)
        printMsg("Concurrent feature set - %x\n", set[i]);
    return;
}
Пример #22
0
/*********************************
 *                               *
 *    printFold                  *
 *                               *
 *********************************/
void
printFold(PE_FOLD **fold)
{
     int   count        = 0;
     int   numStructors = 0;
     char *parent       = NULL;

     assert(fold);

     parent = getStructorParent(fold[0]->constr);
     numStructors = getNumStructors(parent);

     printf("{| ");
     for (count = 0; count < numStructors; count++) {
          if (fold[count]) {
               if (count) printf(" | ");
               printf("%s:", fold[count]->constr);
               printList((LIST *) fold[count]->phrases);
          }
          else {
               printMsg(WARN_MSG, "printFold - incomplete number of contructors");
               /* !!!! set parse error flag */
          }
     }
     printf("|}");
}
Пример #23
0
/*********************************
 *                               *
 *    main                       *
 *                               *
 *********************************/
int
main(int argc, char **argv)
{
/*  yydebug = 1; */
  progname = argv[0];

  if (argc > 2) {
    fprintf(stderr, usage, progname);
    exit(1);
  }

  SystemConstruct();

  if (argc > 1) {
    yyin = fopen(argv[1], "r");
    if (yyin == NULL) {
      printMsg(ERROR_MSG, "%s: can not open %s\n", progname, argv[1]);
      yyin = stdin;
    }
  }
  ParseStream();

  SystemDestruct();

  printf ("\n");     /* [H-O] [FIX] SHOULD BE VIA I/O MODULE */

  return(0);
}
Пример #24
0
/***********************
 *                     *
 * vb_pmTranslate      *
 *                     *
 ***********************/ 
static
CT_VAR_BASE
*vb_pmTranslate(PE_VAR_BASE *vb)
{
     CT_VAR_BASE *result = NULL;

     if (vb) {
	  result = (CT_VAR_BASE *) MemHeapAlloc(parseHeapDesc, 1, sizeof(CT_VAR_BASE));
	  switch (vb->tag) {
	     case VB_BANG:
	       result->tag = CT_VB_BANG;
	       break;
	     case VB_VAR:
	       result->tag = CT_VB_VAR;
	       result->info.var = vb->info.var;
	       break;
	     case VB_PAIR:
	       result->tag = CT_VB_PAIR;	       
	       result->info.pair.l = vb_pmTranslate(vb->info.vbpair.l);
	       result->info.pair.r = vb_pmTranslate(vb->info.vbpair.r);
	       break;
	     default:
	       printMsg(FATAL_MSG, "vb_pmTranslate - Unkown variable base");
	       break;
	  }
     }
     return(result);
}
Пример #25
0
static PE_PATT *convert_PE_VAR_BASE_to_PE_PATT(PE_VAR_BASE *vb)
{
  PE_PATT *patt;

  if (!vb) return 0;
  patt = (PE_PATT *) MHA(tc_memory, 1, sizeof(PE_PATT));
  switch (vb->tag)
  {
    case VB_BANG:
      patt->tag = P_BANG;
      break;
    case VB_VAR:
      patt->tag = P_VAR;
      patt->info.var = vb->info.var;
      break;
    case VB_PAIR:
      patt->tag = P_PAIR;
      patt->info.ppair.l = convert_PE_VAR_BASE_to_PE_PATT(vb->info.vbpair.l);
      patt->info.ppair.r = convert_PE_VAR_BASE_to_PE_PATT(vb->info.vbpair.r);
      break;
    default:
      printMsg(FATAL_MSG,"(typecheck) convert_PE_VAR_BASE_to_PE_PATT: unknown tag");
  }
  return patt;
}
Пример #26
0
static void typecheck_structor(char *name, TYPE_EXPR *domain, TYPE_EXPR *codomain)
{
  TYPE_EXPR **types;
  TYPE_EXPR *parent;
  ST_KEY st_key;
  ST_TYPE_SIG *st_type_sig;

  st_key = st_NameToKey(name);
  if (st_key == 0) printMsg(FATAL_MSG,"typecheck_structor: unknown structor \"%s\"", name);
  else {
    st_type_sig = st_GetTypeSig(st_key);
    types = (TYPE_EXPR **) MHA(tc_memory, 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);
    types[2] = 0;

    parent = convert_ST_TYPE_to_TE(st_GetGenericStateType(st_key));     /* L(A) or R(A) */
    /* replace C (-1) by parent */
    types = subst_in_TEL(type_asmt(-1, parent), types);
    /* rename the A's */
    types = rename_vars_in_TEL(assign_new_vars(collect_vars_in_TE(parent)), types);

    add_equation_to_SubstList(domain, types[0]);
    add_equation_to_SubstList(types[1], codomain);
  }
}
Пример #27
0
serverState communication(){	
	
	char msg[MSG_MAX_SIZE];
	
	int length = 0;

	do{

	encType = cipherSpec.symmetric_cipher;	
		
	fprintf(stderr , "\n< Client message , communication > \n");			
	length = receive_and_decrypt(msg);	

	if(strncmp(msg , ClientCloseConnection , length) == 0 && length == strlen(ClientCloseConnection)){
		fprintf(stderr , "%s" , ClientCloseConnection);
		encType = PLAIN;
		return CLOSING;
	}
	encType = PLAIN;
		
	fprintf(stderr , "\n< Server response , communication >\n" );			
	encrypt_and_send(msg , length);	
	printMsg("" , msg ,(u_int16_t) length);
	
	}while(1);
		
}
Пример #28
0
int main(int argc, char** argv)
{

    pthread_t recvpid;
    pthread_t sendpid;
	MSG_S rcvmsg;
	int rcvData;

	MSGQUEUEHANDLE pCxt = createMsgQueue(SIZE);
	if (NULL == pCxt)
	{
		LOGE(TAG, "createMsgQueue failed!\n");	
		return -1;
	}


    pthread_create(&sendpid, NULL, sendThread, pCxt); 

	rcvmsg.m_pMsgData = &rcvData;

	while(1)
	{
		//sleep(1);
		recvMsg(pCxt, &rcvmsg);
		printMsg(&rcvmsg);
	}

	return 0;
}
void parseMacOUI(char *str, unsigned char *addr) {
    addr[0] = parseHexByte(str[0], str[1]);
    addr[1] = parseHexByte(str[3], str[4]);
    addr[2] = parseHexByte(str[6], str[7]);
    printMsg("read mac OUI: %02x:%02x:%02x\n", addr[0],
            addr[1], addr[2]);
}
Пример #30
0
/*
	GameOver just ends the game when its called.
*/
void CastleGame::gameOver()
{
	linetoprinton++;
	printMsg("Game Over:");
	fclose(fptr);
	playingstatus=ENDED;
}