Exemple #1
0
int		output_core(t_info *info)
{
  t_outputfile	*output;
  char		*outputfile;
  t_word	*word;
  int		i;
  int		j;
  t_cmd_list	*cmdlist;

  output = output_init();
  cmdlist = info->tete_cmd;

  output_num_32(output, COREWAR_EXEC_MAGIC);
  output_num_32(output, info->size_prog);
  output_str(output, info->name, PROG_NAME_LENGTH);
  output_str(output, info->comment, PROG_COMMENT_LENGTH);
  while (cmdlist)
    {
      for (j = 0; (word = cmdlist->cmd[j]); j++)
	for (i = 0; i < word->size; i++)
	  output_char(output, invert_quartet(word->codage[i]));
      cmdlist = cmdlist->next;
    }
  outputfile = output_file(info->inputfile);
  output_write(output, outputfile);
  return 1;
}
Exemple #2
0
int main (void)  {                /* execution starts here                    */

#if 0
  	IOPIN=0x1;

	ram_test1();
#endif





  busyLoop(BUSY_LOOP_TIMES);
#if 0
  printf ("Hello World\n");       /* the 'printf' function call               */
#else
  output_str("Hello World\n");
#endif
  while (1) {                          /* An embedded program does not stop and       */
#if 1  	
  	IOPIN=0x1;
  	busyLoop(BUSY_LOOP_TIMES);
	IOPIN=0x0;
  	busyLoop(BUSY_LOOP_TIMES);
      /* ... */                       /* never returns. We use an endless loop.      */
#endif	  
  }                                    /* Replace the dots (...) with your own code.  */

}
Exemple #3
0
void main()
{
    char tmp;

    char a;
    char b;

    g_ch[0] = (char)'a';
    g_ch[1] = (char)'b';
    g_ch[2] = (char)0;

    output_str(g_ch);

    tmp = (char)'a';

    a = (char)'a';
    b = (char)'b';

    if (a > b) {
        output_char((char)'g');
    }
    else {
        output_char((char)'l');
        output_char((char)'e');
    }

    commit;
}
Exemple #4
0
void MeshAnalysisDialog::elementsMsgOutput(const std::vector<ElementErrorCode> &element_error_codes)
{
	std::array<std::string, static_cast<std::size_t>(ElementErrorFlag::MaxValue)> output_str(MeshLib::MeshValidation::ElementErrorCodeOutput(element_error_codes));

	this->zeroVolumeText->setText(QString::fromStdString(output_str[0]));
	this-> nonPlanarText->setText(QString::fromStdString(output_str[1]));
	this-> nonConvexText->setText(QString::fromStdString(output_str[2]));
	this-> nodeOrderText->setText(QString::fromStdString(output_str[3]));
}
Exemple #5
0
MeshValidation::MeshValidation(MeshLib::Mesh &mesh)
{
    INFO ("Mesh Quality Control:");
    INFO ("%Looking for unused nodes...");
    NodeSearch ns(mesh);
    ns.searchUnused();
    if (!ns.getSearchedNodeIDs().empty()) {
        INFO ("%d unused mesh nodes found.", ns.getSearchedNodeIDs().size());
    }
    MeshRevision rev(mesh);
    INFO ("Found %d potentially collapsable nodes.", rev.getNCollapsableNodes());

    const std::vector<ElementErrorCode> codes (this->testElementGeometry(mesh));
    std::array<std::string, static_cast<std::size_t>(ElementErrorFlag::MaxValue)> output_str (this->ElementErrorCodeOutput(codes));
    for (std::size_t i = 0; i < output_str.size(); ++i)
        INFO (output_str[i].c_str());
}
void LNRS_hash(char *arr,int size)
{
	int i,j;
	for(i=0;i<size;++i){
		memset(visit,0,sizeof(visit));
		visit[arr[i]] = 1;
		for(j=i+1;j<size;++j){
			if(visit[arr[j]] == 0){
				visit[arr[j]] = 1;
			}else{
				if(j-i > maxlen){
					maxindex = i;
					maxlen = j - i;
				}
				break;
			}
		}
		if(j == size && j-i>maxlen){
			maxindex = i;
			maxlen = j - i;
		}
	}
	output_str(arr);
}
Exemple #7
0
static void log_check_env(void)
{
    _log_level = LOG_LEVEL_DEFAULT;
    const char *levelstr = level_str(getenv(LOG_LEVEL_ENV));
    const char *outputstr = output_str(getenv(LOG_OUTPUT_ENV));
    const char *timestr = time_str(getenv(LOG_TIMESTAMP_ENV));
    int level = atoi(levelstr);
    int output = atoi(outputstr);
    int timestamp = atoi(timestr);

    switch (level) {
    case 1:
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
    case 7:
    case 8:
        _log_level = level;
        break;
    case 0:
        if (is_str_equal(levelstr, "error")) {
            _log_level = LOG_ERR;
        } else if (is_str_equal(levelstr, "warn")) {
            _log_level = LOG_WARNING;
        } else if (is_str_equal(levelstr, "notice")) {
            _log_level = LOG_NOTICE;
        } else if (is_str_equal(levelstr, "info")) {
            _log_level = LOG_INFO;
        } else if (is_str_equal(levelstr, "debug")) {
            _log_level = LOG_DEBUG;
        } else if (is_str_equal(levelstr, "verbose")) {
            _log_level = LOG_VERB;
        }
        break;
    default:
        break;
    }
    switch (output) {
    case 1:
    case 2:
    case 3:
    case 4:
        _log_output = output;
        break;
    case 0:
        if (is_str_equal(outputstr, "stderr")) {
            _log_output = LOG_STDERR;
        } else if (is_str_equal(outputstr, "file")) {
            _log_output = LOG_FILE;
        } else if (is_str_equal(outputstr, "rsyslog")) {
            _log_output = LOG_RSYSLOG;
        }
        break;
    default:
        break;
    }
    switch (timestamp) {
    case 1:
        UPDATE_LOG_PREFIX(_log_prefix, LOG_TIMESTAMP_BIT);
        break;
    case 0:
        if (is_str_equal(timestr, "y") ||
            is_str_equal(timestr, "yes") ||
            is_str_equal(timestr, "true")) {
             UPDATE_LOG_PREFIX(_log_prefix, LOG_TIMESTAMP_BIT);
        }
        break;
    default:
        break;
    }
    if (_log_level == LOG_DEBUG) {
        UPDATE_LOG_PREFIX(_log_prefix, LOG_FUNCLINE_BIT);
    }
    if (_log_level == LOG_VERB) {
        UPDATE_LOG_PREFIX(_log_prefix, LOG_VERBOSE_BIT);
    }
}