Example #1
0
int				is_invalid_line(char *line, t_map *map)
{
	if (is_empty_line(line))
		return (1);

	/*if (is_comment(line) == 0)
	{
		printf("pas un comment  ");
		if (is_attribute(line, map) == 0)
		{
			printf("pas un attr  ");
			if (is_room(line) == 0)
			{
				printf("pas une room  ");
				if (is_link(line) == 0)
				{
					printf("pas un link  ");
					if (is_nbr_ant(line) == 0)
					{
						printf("pas le nb de fourmi\n");
						return (1);
					}
					else
						printf("c le nb fourmi\n");
				}
				printf("c un link  ");
				return (0);
			}
			printf("c une rooom  ");
			return (0);
		}
		printf("c un attr  ");
		return (0);
	}
	printf("c un comment  ");
	return (0);*/
	return (!is_comment(line) && !is_attribute(line, map) && !is_room(line)
			&& !is_link(line) && !is_nbr_ant(line));
}
Example #2
0
const char *format_subject(struct strbuf *sb, const char *msg,
			   const char *line_separator)
{
	int first = 1;

	for (;;) {
		const char *line = msg;
		int linelen = get_one_line(line);

		msg += linelen;
		if (!linelen || is_empty_line(line, &linelen))
			break;

		if (!sb)
			continue;
		strbuf_grow(sb, linelen + 2);
		if (!first)
			strbuf_addstr(sb, line_separator);
		strbuf_add(sb, line, linelen);
		first = 0;
	}
	return msg;
}
Example #3
0
static void
skipblanksb(void)
{
    while (lback(DOT.l) != buf_head(curbp) && is_empty_line(DOT))
	DOT.l = lback(DOT.l);
}
Example #4
0
static void
skipblanksf(void)
{
    while (lforw(DOT.l) != buf_head(curbp) && is_empty_line(DOT))
	DOT.l = lforw(DOT.l);
}
Example #5
0
void
POParser::parse()
{
	next_line();

	// skip UTF-8 intro that some text editors produce
	// see http://en.wikipedia.org/wiki/Byte-order_mark
	if (current_line.size() >= 3 &&
	    current_line[0] == static_cast<char>(0xef) &&
	    current_line[1] == static_cast<char>(0xbb) &&
	    current_line[2] == static_cast<char>(0xbf))
	{
		current_line = current_line.substr(3);
	}

	// Parser structure
	while (!eof)
	{
		try
		{
			bool        fuzzy       = false;
			bool        has_msgctxt = false;
			std::string msgctxt;
			std::string msgid;

			while (prefix("#"))
			{
				if (current_line.size() >= 2 && current_line[1] == ',')
				{
					// FIXME: Rather simplistic hunt for fuzzy flag
					if (current_line.find("fuzzy", 2) != std::string::npos)
					{
						fuzzy = true;
					}
				}

				next_line();
			}

			if (!is_empty_line())
			{
				if (prefix("msgctxt"))
				{
					has_msgctxt = true;
					msgctxt     = get_string(7);
				}

				if (prefix("msgid"))
				{
					msgid = get_string(5);
				}
				else
				{
					error("expected 'msgid'");
				}

				if (prefix("msgid_plural"))
				{
					std::string              msgid_plural = get_string(12);
					std::vector<std::string> msgstr_num;
					bool                     saw_nonempty_msgstr = false;

next:
					if (is_empty_line())
					{
						if (msgstr_num.empty())
						{
							error("expected 'msgstr[N] (0 <= N <= 9)'");
						}
					}
					else if (prefix("msgstr[") &&
					         current_line.size() > 8 &&
					         isdigit(current_line[7]) && current_line[8] == ']')
					{
						unsigned int number = static_cast<unsigned int>(current_line[7] - '0');
						std::string  msgstr = get_string(9);

						if (!msgstr.empty())
						{
							saw_nonempty_msgstr = true;
						}

						if (number >= msgstr_num.size())
						{
							msgstr_num.resize(number + 1);
						}

						msgstr_num[number] = conv.convert(msgstr);
						goto next;
					}
					else
					{
						error("expected 'msgstr[N]'");
					}

					if (!is_empty_line())
					{
						error("expected 'msgstr[N]' or empty line");
					}

					if (saw_nonempty_msgstr)
					{
						if (use_fuzzy || !fuzzy)
						{
							if (!dict.get_plural_forms())
							{
								warning("msgstr[N] seen, but no Plural-Forms given");
							}
							else
							{
								if (msgstr_num.size() != dict.get_plural_forms().get_nplural())
								{
									warning("msgstr[N] count doesn't match Plural-Forms.nplural");
								}
							}

							if (has_msgctxt)
							{
								dict.add_translation(msgctxt, msgid, msgid_plural, msgstr_num);
							}
							else
							{
								dict.add_translation(msgid, msgid_plural, msgstr_num);
							}
						}

						if (0)
						{
							std::cout << (fuzzy ? "fuzzy" : "not-fuzzy") << std::endl;
							std::cout << "msgid \"" << msgid << "\"" << std::endl;
							std::cout << "msgid_plural \"" << msgid_plural << "\"" << std::endl;
							for (std::vector<std::string>::size_type i = 0; i < msgstr_num.size(); ++i)
								std::cout << "msgstr[" << i << "] \"" << conv.convert(msgstr_num[i]) << "\"" << std::endl;
							std::cout << std::endl;
						}
					}
				}
				else if (prefix("msgstr"))
				{
					std::string msgstr = get_string(6);

					if (msgid.empty())
					{
						parse_header(msgstr);
					}
					else if (!msgstr.empty())
					{
						if (use_fuzzy || !fuzzy)
						{
							if (has_msgctxt)
							{
								dict.add_translation(msgctxt, msgid, conv.convert(msgstr));
							}
							else
							{
								dict.add_translation(msgid, conv.convert(msgstr));
							}
						}

						if (0)
						{
							std::cout << (fuzzy ? "fuzzy" : "not-fuzzy") << std::endl;
							std::cout << "msgid \"" << msgid << "\"" << std::endl;
							std::cout << "msgstr \"" << conv.convert(msgstr) << "\"" << std::endl;
							std::cout << std::endl;
						}
					}
				}
				else
				{
					error("expected 'msgstr' or 'msgid_plural'");
				}
			}

			if (!is_empty_line())
			{
				error("expected empty line");
			}

			next_line();
		}
		catch (POParserError&)
		{
		}
	}
}
Example #6
0
void parse_line(const char* line, size_t line_count, Operation* op)
{
	if (op == NULL)
		return;

	size_t length = strlen(line);

	if (length <= 0)
		return;

	if (line[0] == '#')
		return;

	if (is_empty_line(line, length))
		return;

	char* ac = NULL;
	char* bc = NULL;
	char* cc = NULL;

	char* token = strtok((char*)line, " \n");
	char* number_end = NULL;

	uint8_t code_number = INVALID_OPERATION_CODE;

	while (token != NULL)
	{
		if (strlen(token))
		{
			if (code_number == INVALID_OPERATION_CODE)
			{
				code_number = get_operation_code(token);

				if (code_number == INVALID_OPERATION_CODE)
				{
					fprintf(stderr, "COMPILATION ERROR: Invalid operation '%s' found at line %zu\n", token, line_count);
					exit(ERR_COMPILATION_FAILED);
				}
			}
			else if (ac == NULL)
			{
				ac = token;
			}
			else if (bc == NULL)
			{
				bc = token;
			}
			else
			{
				cc = token;
			}
		}

		token = strtok(NULL, " \n");
	}

	if (code_number < 13)
	{
		if (ac == NULL || bc == NULL || cc == NULL)
		{
			fprintf(stderr, "COMPILATION ERROR: Wrong number of arguments at line %zu\n", line_count);
			exit(ERR_COMPILATION_FAILED);
		}

		uint8_t a = strtol(ac, &number_end, 10);
		uint8_t b = strtol(bc, &number_end, 10);
		uint8_t c = strtol(cc, &number_end, 10);

		if (errno == ERANGE)
		{
			fprintf(stderr, "COMPILATION ERROR: One of the registers as a wrong value at line %zu\n", line_count);
			exit(ERR_COMPILATION_FAILED);
		}

		if (a >= 8)
		{
			fprintf(stderr, "COMPILATION ERROR: Wrong register number for a '%d' at line %zu\n", a, line_count);
			exit(ERR_COMPILATION_FAILED);
		}

		if (b >= 8)
		{
			fprintf(stderr, "COMPILATION ERROR: Wrong register number for b '%d' at line %zu\n", a, line_count);
			exit(ERR_COMPILATION_FAILED);
		}

		if (c >= 8)
		{
			fprintf(stderr, "COMPILATION ERROR: Wrong register number for c '%d' at line %zu\n", a, line_count);
			exit(ERR_COMPILATION_FAILED);
		}

		op->standard.number = code_number;
		op->standard.a = a;
		op->standard.b = b;
		op->standard.c = c;
	}
	else
	{
		if (ac == NULL || bc == NULL)
		{
			fprintf(stderr, "COMPILATION ERROR: Wrong number of arguments at line %zu\n", line_count);
			exit(ERR_COMPILATION_FAILED);
		}

		uint8_t a = strtol(ac, &number_end, 10);
		uint32_t value = strtol(bc, &number_end, 10);

		if (errno == ERANGE)
		{
			fprintf(stderr, "COMPILATION ERROR: The register or value has a wrong value at line %zu\n", line_count);
			exit(ERR_COMPILATION_FAILED);
		}

		if (a >= 8)
		{
			fprintf(stderr, "COMPILATION ERROR: Wrong register number for a '%d' at line %zu\n", a, line_count);
			exit(ERR_COMPILATION_FAILED);
		}

		if (value >= 33554432) // 25 bits
		{
			fprintf(stderr, "COMPILATION ERROR: Out of range value '%d' at line %zu\n", value, line_count);
			exit(ERR_COMPILATION_FAILED);
		}

		op->put.number = code_number;
		op->put.a = a;
		op->put.value = value;
	}
}
Example #7
0
unsigned long pretty_print_commit(enum cmit_fmt fmt, const char *msg, unsigned long len, char *buf, unsigned long space)
{
	int hdr = 1, body = 0;
	unsigned long offset = 0;
	int parents = 0;
	int indent = (fmt == CMIT_FMT_ONELINE) ? 0 : 4;

	for (;;) {
		const char *line = msg;
		int linelen = get_one_line(msg, len);

		if (!linelen)
			break;

		/*
		 * We want some slop for indentation and a possible
		 * final "...". Thus the "+ 20".
		 */
		if (offset + linelen + 20 > space) {
			memcpy(buf + offset, "    ...\n", 8);
			offset += 8;
			break;
		}

		msg += linelen;
		len -= linelen;
		if (hdr) {
			if (linelen == 1) {
				hdr = 0;
				if (fmt != CMIT_FMT_ONELINE)
					buf[offset++] = '\n';
				continue;
			}
			if (fmt == CMIT_FMT_RAW) {
				memcpy(buf + offset, line, linelen);
				offset += linelen;
				continue;
			}
			if (!memcmp(line, "parent ", 7)) {
				if (linelen != 48)
					die("bad parent line in commit");
				offset += add_parent_info(fmt, buf + offset, line, ++parents);
			}

			/*
			 * MEDIUM == DEFAULT shows only author with dates.
			 * FULL shows both authors but not dates.
			 * FULLER shows both authors and dates.
			 */
			if (!memcmp(line, "author ", 7))
				offset += add_user_info("Author", fmt,
							buf + offset,
							line + 7);
			if (!memcmp(line, "committer ", 10) &&
			    (fmt == CMIT_FMT_FULL || fmt == CMIT_FMT_FULLER))
				offset += add_user_info("Commit", fmt,
							buf + offset,
							line + 10);
			continue;
		}

		if (is_empty_line(line, linelen)) {
			if (!body)
				continue;
			if (fmt == CMIT_FMT_SHORT)
				break;
		} else {
			body = 1;
		}

		memset(buf + offset, ' ', indent);
		memcpy(buf + offset + indent, line, linelen);
		offset += linelen + indent;
		if (fmt == CMIT_FMT_ONELINE)
			break;
	}
	if (fmt == CMIT_FMT_ONELINE) {
		/* We do not want the terminating newline */
		if (buf[offset - 1] == '\n')
			offset--;
	}
	else {
		/* Make sure there is an EOLN */
		if (buf[offset - 1] != '\n')
			buf[offset++] = '\n';
	}
	buf[offset] = '\0';
	return offset;
}
Example #8
0
static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int collect_hits)
{
	char *bol;
	char *peek_bol = NULL;
	unsigned long left;
	unsigned lno = 1;
	unsigned last_hit = 0;
	int binary_match_only = 0;
	unsigned count = 0;
	int try_lookahead = 0;
	int show_function = 0;
	struct userdiff_driver *textconv = NULL;
	enum grep_context ctx = GREP_CONTEXT_HEAD;
	xdemitconf_t xecfg;

	if (!opt->output)
		opt->output = std_output;

	if (opt->pre_context || opt->post_context || opt->file_break ||
	    opt->funcbody) {
		/* Show hunk marks, except for the first file. */
		if (opt->last_shown)
			opt->show_hunk_mark = 1;
		/*
		 * If we're using threads then we can't easily identify
		 * the first file.  Always put hunk marks in that case
		 * and skip the very first one later in work_done().
		 */
		if (opt->output != std_output)
			opt->show_hunk_mark = 1;
	}
	opt->last_shown = 0;

	if (opt->allow_textconv) {
		grep_source_load_driver(gs);
		/*
		 * We might set up the shared textconv cache data here, which
		 * is not thread-safe.
		 */
		grep_attr_lock();
		textconv = userdiff_get_textconv(gs->driver);
		grep_attr_unlock();
	}

	/*
	 * We know the result of a textconv is text, so we only have to care
	 * about binary handling if we are not using it.
	 */
	if (!textconv) {
		switch (opt->binary) {
		case GREP_BINARY_DEFAULT:
			if (grep_source_is_binary(gs))
				binary_match_only = 1;
			break;
		case GREP_BINARY_NOMATCH:
			if (grep_source_is_binary(gs))
				return 0; /* Assume unmatch */
			break;
		case GREP_BINARY_TEXT:
			break;
		default:
			die("BUG: unknown binary handling mode");
		}
	}

	memset(&xecfg, 0, sizeof(xecfg));
	opt->priv = &xecfg;

	try_lookahead = should_lookahead(opt);

	if (fill_textconv_grep(textconv, gs) < 0)
		return 0;

	bol = gs->buf;
	left = gs->size;
	while (left) {
		char *eol, ch;
		int hit;

		/*
		 * look_ahead() skips quickly to the line that possibly
		 * has the next hit; don't call it if we need to do
		 * something more than just skipping the current line
		 * in response to an unmatch for the current line.  E.g.
		 * inside a post-context window, we will show the current
		 * line as a context around the previous hit when it
		 * doesn't hit.
		 */
		if (try_lookahead
		    && !(last_hit
			 && (show_function ||
			     lno <= last_hit + opt->post_context))
		    && look_ahead(opt, &left, &lno, &bol))
			break;
		eol = end_of_line(bol, &left);
		ch = *eol;
		*eol = 0;

		if ((ctx == GREP_CONTEXT_HEAD) && (eol == bol))
			ctx = GREP_CONTEXT_BODY;

		hit = match_line(opt, bol, eol, ctx, collect_hits);
		*eol = ch;

		if (collect_hits)
			goto next_line;

		/* "grep -v -e foo -e bla" should list lines
		 * that do not have either, so inversion should
		 * be done outside.
		 */
		if (opt->invert)
			hit = !hit;
		if (opt->unmatch_name_only) {
			if (hit)
				return 0;
			goto next_line;
		}
		if (hit) {
			count++;
			if (opt->status_only)
				return 1;
			if (opt->name_only) {
				show_name(opt, gs->name);
				return 1;
			}
			if (opt->count)
				goto next_line;
			if (binary_match_only) {
				opt->output(opt, "Binary file ", 12);
				output_color(opt, gs->name, strlen(gs->name),
					     opt->color_filename);
				opt->output(opt, " matches\n", 9);
				return 1;
			}
			/* Hit at this line.  If we haven't shown the
			 * pre-context lines, we would need to show them.
			 */
			if (opt->pre_context || opt->funcbody)
				show_pre_context(opt, gs, bol, eol, lno);
			else if (opt->funcname)
				show_funcname_line(opt, gs, bol, lno);
			show_line(opt, bol, eol, gs->name, lno, ':');
			last_hit = lno;
			if (opt->funcbody)
				show_function = 1;
			goto next_line;
		}
		if (show_function && (!peek_bol || peek_bol < bol)) {
			unsigned long peek_left = left;
			char *peek_eol = eol;

			/*
			 * Trailing empty lines are not interesting.
			 * Peek past them to see if they belong to the
			 * body of the current function.
			 */
			peek_bol = bol;
			while (is_empty_line(peek_bol, peek_eol)) {
				peek_bol = peek_eol + 1;
				peek_eol = end_of_line(peek_bol, &peek_left);
			}

			if (match_funcname(opt, gs, peek_bol, peek_eol))
				show_function = 0;
		}
		if (show_function ||
		    (last_hit && lno <= last_hit + opt->post_context)) {
			/* If the last hit is within the post context,
			 * we need to show this line.
			 */
			show_line(opt, bol, eol, gs->name, lno, '-');
		}

	next_line:
		bol = eol + 1;
		if (!left)
			break;
		left--;
		lno++;
	}

	if (collect_hits)
		return 0;

	if (opt->status_only)
		return 0;
	if (opt->unmatch_name_only) {
		/* We did not see any hit, so we want to show this */
		show_name(opt, gs->name);
		return 1;
	}

	xdiff_clear_find_func(&xecfg);
	opt->priv = NULL;

	/* NEEDSWORK:
	 * The real "grep -c foo *.c" gives many "bar.c:0" lines,
	 * which feels mostly useless but sometimes useful.  Maybe
	 * make it another option?  For now suppress them.
	 */
	if (opt->count && count) {
		char buf[32];
		if (opt->pathname) {
			output_color(opt, gs->name, strlen(gs->name),
				     opt->color_filename);
			output_sep(opt, ':');
		}
		xsnprintf(buf, sizeof(buf), "%u\n", count);
		opt->output(opt, buf, strlen(buf));
		return 1;
	}
	return !!last_hit;
}
Example #9
0
static void
parse_line(GSList    **cookies_p,
           const char *line,
           const char *end,
           const char *domain_filter,
           int         port_filter,
           const char *name_filter,
           HippoBrowserKind browser)
{
    const char *p;
    const char *start;
    int field;
    Field fields[N_FIELDS];
    
    // see if it's an empty or comment line
    if (is_empty_line(line, end))
        return;
        
    for (field = 0; field < N_FIELDS; ++field) {
        fields[field].which = field;
        fields[field].text = NULL;
    }
    
    start = line;
    field = 0;
    for (p = line; p <= end; ++p) {
        g_assert(p >= start);
        if (*p == '\t' || p == end) {
            
            if (field >= N_FIELDS) {
                // too many fields on this line, give up
                goto out;
            }
            
            fields[field].text = g_strndup(start, p - start);
            
            start = p + 1;
            ++field;
        }
    }
    
    /* ATTR_VALUE is optional, the other fields are not */
    for (field = 0; field < N_FIELDS; ++field) {
        if (field != ATTR_VALUE && fields[field].text == NULL)
            goto out;
    }    
    
    {
        char *domain;
        int port;
        gboolean all_hosts_match;
        gboolean secure_connection_required;
        GTime timestamp;

        if (!parse_bool(fields[DOMAIN_FLAG].text, &all_hosts_match))
            goto out;
            
        if (!parse_bool(fields[SECURE_FLAG].text, &secure_connection_required))
            goto out;
            
        if (!parse_time(fields[TIMESTAMP].text, &timestamp))
            goto out;

        if (!parse_domain(fields[DOMAIN].text, &domain, &port))
            goto out;
        
        if ((domain_filter == NULL || strcmp(domain_filter, domain) == 0) &&
            (port_filter < 0 || port_filter == port) &&
            (name_filter == NULL || strcmp(name_filter, fields[ATTR_NAME].text) == 0)) {
            HippoCookie *cookie;
            cookie = hippo_cookie_new(browser,
                                      domain, port, all_hosts_match,
                                      fields[PATH].text,
                                      secure_connection_required, timestamp,
                                      fields[ATTR_NAME].text,
                                      fields[ATTR_VALUE].text);
            *cookies_p = g_slist_prepend(*cookies_p, cookie);
        }
                                  
        g_free(domain);
    }
                        
  out:
    for (field = 0; field < N_FIELDS; ++field) {
        g_free(fields[field].text);
    }    
}
Example #10
0
File: pretty.c Project: Pistos/git
void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,
			 struct strbuf *sb, int abbrev,
			 const char *subject, const char *after_subject,
			 enum date_mode dmode, int need_8bit_cte)
{
	unsigned long beginning_of_body;
	int indent = 4;
	const char *msg = commit->buffer;
	char *reencoded;
	const char *encoding;

	if (fmt == CMIT_FMT_USERFORMAT) {
		format_commit_message(commit, user_format, sb);
		return;
	}

	encoding = (git_log_output_encoding
		    ? git_log_output_encoding
		    : git_commit_encoding);
	if (!encoding)
		encoding = "utf-8";
	reencoded = logmsg_reencode(commit, encoding);
	if (reencoded) {
		msg = reencoded;
	}

	if (fmt == CMIT_FMT_ONELINE || fmt == CMIT_FMT_EMAIL)
		indent = 0;

	/*
	 * We need to check and emit Content-type: to mark it
	 * as 8-bit if we haven't done so.
	 */
	if (fmt == CMIT_FMT_EMAIL && need_8bit_cte == 0) {
		int i, ch, in_body;

		for (in_body = i = 0; (ch = msg[i]); i++) {
			if (!in_body) {
				/* author could be non 7-bit ASCII but
				 * the log may be so; skip over the
				 * header part first.
				 */
				if (ch == '\n' && msg[i+1] == '\n')
					in_body = 1;
			}
			else if (non_ascii(ch)) {
				need_8bit_cte = 1;
				break;
			}
		}
	}

	pp_header(fmt, abbrev, dmode, encoding, commit, &msg, sb);
	if (fmt != CMIT_FMT_ONELINE && !subject) {
		strbuf_addch(sb, '\n');
	}

	/* Skip excess blank lines at the beginning of body, if any... */
	for (;;) {
		int linelen = get_one_line(msg);
		int ll = linelen;
		if (!linelen)
			break;
		if (!is_empty_line(msg, &ll))
			break;
		msg += linelen;
	}

	/* These formats treat the title line specially. */
	if (fmt == CMIT_FMT_ONELINE || fmt == CMIT_FMT_EMAIL)
		pp_title_line(fmt, &msg, sb, subject,
			      after_subject, encoding, need_8bit_cte);

	beginning_of_body = sb->len;
	if (fmt != CMIT_FMT_ONELINE)
		pp_remainder(fmt, &msg, sb, indent);
	strbuf_rtrim(sb);

	/* Make sure there is an EOLN for the non-oneline case */
	if (fmt != CMIT_FMT_ONELINE)
		strbuf_addch(sb, '\n');

	/*
	 * The caller may append additional body text in e-mail
	 * format.  Make sure we did not strip the blank line
	 * between the header and the body.
	 */
	if (fmt == CMIT_FMT_EMAIL && sb->len <= beginning_of_body)
		strbuf_addch(sb, '\n');
	free(reencoded);
}
QStringList tabtoh::parse_and_convert_instr(QStringList &instr_desc){
    QString instr_name;
    QString instr_name_stripped;
    QString instr_name_quoted;
    QString mem_type_str;
    QString tempr_domain_str;
    QString volt_domain_str;
    QString freq_domain_str;
    QString num_of_operands;

    QStringList converted_instr;
    QStringList init_names;
    QStringList init_values;

    QString mem_sz_str;
    QString tempr_sz_str;
    QString volt_sz_str;
    QString freq_sz_str;
    QString num_of_ops_sz;

    instr_name = instr_desc.at(0).section("\t", 1, 1);
    instr_name_quoted = instr_name;
    instr_name_quoted.prepend("\"");
    instr_name_quoted.append("\"");
    instr_name_stripped = convert_dot_to_slash(instr_name);

    detect_domain_sizes(instr_desc, mem_sz_str, tempr_sz_str, volt_sz_str, freq_sz_str, num_of_ops_sz);

    insert_struct("const instruction_t", instr_name_stripped.toLatin1().data(), 0, converted_instr);
    insert_struct_field("instr_mnemonic", instr_name_quoted.toLatin1().data(), 1, converted_instr);
    insert_struct_field("num_of_mem_domains", mem_sz_str.toLatin1().data(), 1, converted_instr);
    insert_struct_field("num_of_tempr_domains", tempr_sz_str.toLatin1().data(), 1, converted_instr);
    insert_struct_field("num_of_volt_domains", volt_sz_str.toLatin1().data(), 1, converted_instr);
    insert_struct_field("num_of_freq_domains", freq_sz_str.toLatin1().data(), 1, converted_instr);
    insert_struct_field("num_of_operand_domains", num_of_ops_sz.toLatin1().data(), 1, converted_instr);
    insert_struct_struct_field("domains", 1, converted_instr);

    for(int i = 2; i < instr_desc.size(); i++){
        if(is_empty_line(instr_desc.at(i))){
            break;
        }

        mem_type_str = instr_desc.at(i).section('\t', 0, 0);
        tempr_domain_str = instr_desc.at(i).section('\t', 1, 1);
        volt_domain_str = instr_desc.at(i).section('\t', 2, 2);
        freq_domain_str = instr_desc.at(i).section('\t', 3, 3);
        num_of_operands = instr_desc.at(i).section('\t', 4, 4);

        init_names << "mem_addr";
        init_values << "0";
        init_names << "mem_type";
        init_values << mem_type_str;
        init_names << "tempr_domain";
        init_values << tempr_domain_str;
        init_names << "volt_domain";
        init_values << volt_domain_str;
        init_names << "freq_domain";
        init_values << freq_domain_str;
        init_names << "num_of_operands";
        init_values << num_of_operands;

        {
            QString energy_time, energy_current;
            energy_time = instr_desc.at(i).section('\t', 5, 5);
            init_names << "consumed_time";
            init_values << energy_time.section(',', 0, 0);
            init_names << "consumed_current";
            init_values << energy_time.section(',', 1, 1);
        }

        insert_struct_initializers(init_names, init_values, 2, converted_instr);

        init_names.clear();
        init_values.clear();
    }

    converted_instr << "\t}\r\n";
    converted_instr << "};\r\n\r\n";

    return converted_instr;
}