Beispiel #1
0
static void conf_choice(struct menu *menu)
{
	const char *prompt = menu_get_prompt(menu);
	struct menu *child;
	struct symbol *active;

	while (1) {
		current_menu = menu;
		active = sym_get_choice_value(menu->sym);
		cdone(); cinit();
		for (child = menu->list; child; child = child->next) {
			if (!menu_is_visible(child))
				continue;
			cmake();
			cprint_tag("%p", child);
			cprint_name("%s", menu_get_prompt(child));
			items[item_no - 1]->selected = (child->sym == active);
		}

		switch (dialog_checklist(prompt ? prompt : "Main Menu",
					radiolist_instructions, 15, 70, 6,
					item_no, items, FLAG_RADIO)) {
		case 0:
			if (sscanf(first_sel_item(item_no, items)->tag, "%p", &menu) != 1)
				break;
			sym_set_tristate_value(menu->sym, yes);
			return;
		case 1:
			show_help(menu);
			break;
		case 255:
			return;
		}
	}
}
Beispiel #2
0
void compute_chest_cilk(task *taskX) {
  symbol_data *symbolData = taskX->symbolData;
  int rx = taskX->rx;
  int layer = taskX->layer;
  int res_power[4];
  mf(&symbolData->data->in_data[symbolData->slot][3][rx][symbolData->startSc], &symbolData->data->in_rs[symbolData->slot][symbolData->startSc][layer], symbolData->nmbSc, symbolData->layer_data[layer][rx], &symbolData->pow[rx]);
  ifft(symbolData->layer_data[layer][rx], symbolData->nmbSc, symbolData->data->fftw[symbolData->slot]);
  chest(symbolData->layer_data[layer][rx], symbolData->pow[rx], symbolData->nmbSc, symbolData->layer_data[layer][rx], &res_power[rx]);
  symbolData->R[layer][rx] = cmake(res_power[rx],0);
  fft(symbolData->layer_data[layer][rx], symbolData->nmbSc, symbolData->data->fftw[symbolData->slot]);
}
Beispiel #3
0
static int cprint_tag(const char *fmt, ...)
{
	va_list ap;
	int res;

	if (!item_no)
		cmake();
	va_start(ap, fmt);
	res = vsnprintf(items[item_no - 1]->tag, 32, fmt, ap);
	va_end(ap);

	return res;
}
Beispiel #4
0
static int cprint_name(const char *fmt, ...)
{
	va_list ap;
	int res;

	if (!item_no)
		cmake();
	va_start(ap, fmt);
	res = vsnprintf(items[item_no - 1]->name + items[item_no - 1]->namelen,
			512 - items[item_no - 1]->namelen, fmt, ap);
	if (res > 0)
		items[item_no - 1]->namelen += res;
	va_end(ap);

	return res;
}
Beispiel #5
0
inline void compute_chest(task *task) {
  symbol_data *symbolData = task->symbolData;
  int rx = task->rx;
  int layer = task->layer;
  int res_power[4] = {0, 0, 0, 0};

  mf(&symbolData->data->in_data[symbolData->slot][3][rx][symbolData->startSc], &symbolData->data->in_rs[symbolData->slot][symbolData->startSc][layer], symbolData->nmbSc, symbolData->layer_data[layer][rx], &symbolData->pow[rx]);
  ifft(symbolData->layer_data[layer][rx], symbolData->nmbSc, symbolData->data->fftw[symbolData->slot]);
  chest(symbolData->layer_data[layer][rx], symbolData->pow[rx], symbolData->nmbSc, symbolData->layer_data[layer][rx], &res_power[rx]);
  /* Put power values in the R matrix */
  symbolData->R[layer][rx] = cmake(res_power[rx],0);
  fft(symbolData->layer_data[layer][rx], symbolData->nmbSc, symbolData->data->fftw[symbolData->slot]);
  /* Mark the task as computed */
  mem_fence();
  task->computed = true;
}
Beispiel #6
0
bool uwsgiProcess::findProjectDir(const QDir &dir, QDir *projectDir)
{
    QFile cmake(dir.absoluteFilePath(QStringLiteral("CMakeLists.txt")));
    if (cmake.exists()) {
        if (cmake.open(QFile::ReadOnly | QFile::Text)) {
            while (!cmake.atEnd()) {
                QByteArray line = cmake.readLine();
                if (line.toLower().startsWith(QByteArrayLiteral("project"))) {
                    *projectDir = dir;
                    return true;
                }
            }
        }
    }

    QDir localDir = dir;
    if (localDir.cdUp()) {
        return findProjectDir(localDir, projectDir);
    }
    return false;
}
Beispiel #7
0
bool test_code_generation(Language lang, IDL idl, Format format)
{
    bool result = true;
#ifdef _WIN32
    std::string codegen_bash("bin/dsn.cg.bat");
#else
    std::string codegen_bash("bin/dsn.cg.sh");
#endif
    std::string codegen_cmd = combine(DSN_ROOT, codegen_bash)\
                              + std::string(" counter.")\
                              + (idl == idl_protobuf ? "proto" : "thrift")\
                              + (lang == lang_cpp ? " cpp" : " csharp")\
                              + " src "\
                              + (format == format_binary ? "binary" : "json")\
                              + " single";
    create_dir("src", result);
    execute(codegen_cmd, result);
    std::vector<std::string> src_files;
    std::string src_root(lang == lang_cpp ? "repo/cpp" : "repo/csharp");
    if (lang == lang_cpp)
    {
        src_files.push_back("counter.main.cpp");
    } else
    {
        src_files.push_back("counter.main.cs");
    }
    for (auto i : src_files)
    {
        copy_file(combine(combine(RESOURCE_ROOT, src_root), i), file("src"), result);
    }
    cmake(lang, result);
    rm_dir("data", result);
    rm_dir("builder", result);
    rm_dir("src", result);
    return result;
}
Beispiel #8
0
static void conf(struct menu *menu)
{
	struct dialog_list_item *active_item = NULL;
	struct menu *submenu;
	const char *prompt = menu_get_prompt(menu);
	struct symbol *sym;
	char active_entry[40];
	int stat, type;

	unlink("lxdialog.scrltmp");
	active_entry[0] = 0;
	while (1) {
		indent = 0;
		child_count = 0;
		current_menu = menu;
		cdone(); cinit();
		build_conf(menu);
		if (!child_count)
			break;
		if (menu == &rootmenu) {
			cmake(); cprint_tag(":"); cprint_name("--- ");
			cmake(); cprint_tag("L"); cprint_name("Load an Alternate Configuration File");
			cmake(); cprint_tag("S"); cprint_name("Save Configuration to an Alternate File");
		}
		dialog_clear();
		stat = dialog_menu(prompt ? prompt : "Main Menu",
				menu_instructions, rows, cols, rows - 10,
				active_entry, item_no, items);
		if (stat < 0)
			return;

		if (stat == 1 || stat == 255)
			break;

		active_item = first_sel_item(item_no, items);
		if (!active_item)
			continue;
		active_item->selected = 0;
		strncpy(active_entry, active_item->tag, sizeof(active_entry));
		active_entry[sizeof(active_entry)-1] = 0;
		type = active_entry[0];
		if (!type)
			continue;

		sym = NULL;
		submenu = NULL;
		if (sscanf(active_entry + 1, "%p", &submenu) == 1)
			sym = submenu->sym;

		switch (stat) {
		case 0:
			switch (type) {
			case 'm':
				if (single_menu_mode)
					submenu->data = (void *) (long) !submenu->data;
				else
					conf(submenu);
				break;
			case 't':
				if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)
					conf_choice(submenu);
				else if (submenu->prompt->type == P_MENU)
					conf(submenu);
				break;
			case 's':
				conf_string(submenu);
				break;
			case 'L':
				conf_load();
				break;
			case 'S':
				conf_save();
				break;
			}
			break;
		case 2:
			if (sym)
				show_help(submenu);
			else
				show_helptext("README", mconf_readme);
			break;
		case 3:
			if (type == 't') {
				if (sym_set_tristate_value(sym, yes))
					break;
				if (sym_set_tristate_value(sym, mod))
					show_textbox(NULL, setmod_text, 6, 74);
			}
			break;
		case 4:
			if (type == 't')
				sym_set_tristate_value(sym, no);
			break;
		case 5:
			if (type == 't')
				sym_set_tristate_value(sym, mod);
			break;
		case 6:
			if (type == 't')
				sym_toggle_tristate_value(sym);
			else if (type == 'm')
				conf(submenu);
			break;
		case 7:
			search_conf();
			break;
		}
	}
}
Beispiel #9
0
static void build_conf(struct menu *menu)
{
	struct symbol *sym;
	struct property *prop;
	struct menu *child;
	int type, tmp, doint = 2;
	tristate val;
	char ch;

	if (!menu_is_visible(menu))
		return;

	sym = menu->sym;
	prop = menu->prompt;
	if (!sym) {
		if (prop && menu != current_menu) {
			const char *prompt = menu_get_prompt(menu);
			switch (prop->type) {
			case P_MENU:
				child_count++;
				cmake();
				cprint_tag("m%p", menu);

				if (single_menu_mode) {
					cprint_name("%s%*c%s",
						menu->data ? "-->" : "++>",
						indent + 1, ' ', prompt);
				} else {
					cprint_name("   %*c%s  --->", indent + 1, ' ', prompt);
				}

				if (single_menu_mode && menu->data)
					goto conf_childs;
				return;
			default:
				if (prompt) {
					child_count++;
					cmake();
					cprint_tag(":%p", menu);
					cprint_name("---%*c%s", indent + 1, ' ', prompt);
				}
			}
		} else
			doint = 0;
		goto conf_childs;
	}

	cmake();
	type = sym_get_type(sym);
	if (sym_is_choice(sym)) {
		struct symbol *def_sym = sym_get_choice_value(sym);
		struct menu *def_menu = NULL;

		child_count++;
		for (child = menu->list; child; child = child->next) {
			if (menu_is_visible(child) && child->sym == def_sym)
				def_menu = child;
		}

		val = sym_get_tristate_value(sym);
		if (sym_is_changable(sym)) {
			cprint_tag("t%p", menu);
			switch (type) {
			case S_BOOLEAN:
				cprint_name("[%c]", val == no ? ' ' : '*');
				break;
			case S_TRISTATE:
				switch (val) {
				case yes: ch = '*'; break;
				case mod: ch = 'M'; break;
				default:  ch = ' '; break;
				}
				cprint_name("<%c>", ch);
				break;
			}
		} else {
			cprint_tag("%c%p", def_menu ? 't' : ':', menu);
			cprint_name("   ");
		}

		cprint_name("%*c%s", indent + 1, ' ', menu_get_prompt(menu));
		if (val == yes) {
			if (def_menu) {
				cprint_name(" (%s)", menu_get_prompt(def_menu));
				cprint_name("  --->");
				if (def_menu->list) {
					indent += 2;
					build_conf(def_menu);
					indent -= 2;
				}
			}
			return;
		}
	} else {
		if (menu == current_menu) {
			cprint_tag(":%p", menu);
			cprint_name("---%*c%s", indent + 1, ' ', menu_get_prompt(menu));
			goto conf_childs;
		}
		child_count++;
		val = sym_get_tristate_value(sym);
		if (sym_is_choice_value(sym) && val == yes) {
			cprint_tag(":%p", menu);
			cprint_name("   ");
		} else {
			switch (type) {
			case S_BOOLEAN:
				cprint_tag("t%p", menu);
				if (sym_is_changable(sym))
					cprint_name("[%c]", val == no ? ' ' : '*');
				else
					cprint_name("---");
				break;
			case S_TRISTATE:
				cprint_tag("t%p", menu);
				switch (val) {
				case yes: ch = '*'; break;
				case mod: ch = 'M'; break;
				default:  ch = ' '; break;
				}
				if (sym_is_changable(sym))
					cprint_name("<%c>", ch);
				else
					cprint_name("---");
				break;
			default:
				cprint_tag("s%p", menu);
				tmp = cprint_name("(%s)", sym_get_string_value(sym));
				tmp = indent - tmp + 4;
				if (tmp < 0)
					tmp = 0;
				cprint_name("%*c%s%s", tmp, ' ', menu_get_prompt(menu),
					(sym_has_value(sym) || !sym_is_changable(sym)) ?
					"" : " (NEW)");
				goto conf_childs;
			}
		}
		cprint_name("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu),
			(sym_has_value(sym) || !sym_is_changable(sym)) ?
			"" : " (NEW)");
		if (menu->prompt->type == P_MENU) {
			cprint_name("  --->");
			return;
		}
	}

conf_childs:
	indent += doint;
	for (child = menu->list; child; child = child->next)
		build_conf(child);
	indent -= doint;
}
Beispiel #10
0
bool TargetRunner::Load()
{
    LOG (INFO) << "Reading config file...";
    TiXmlDocument doc( VFS->GetRelativePath(this->configPath).c_str());
    bool status = doc.LoadFile();
    if (!status)
    {
        LOG (LERROR) << "LERROR on loading xml document!";
        return false;
    }

    TiXmlElement *target = doc
                    .FirstChildElement(Constants::XML_TAG_BUILD_CONFIG)
                    ->FirstChildElement(Constants::XML_TAG_BUILD_TARGET);
    TiXmlElement *opt;
    while (target)
    {
        const char* value = target->Attribute(Constants::XML_ATTR_TARGET_NAME);
        if (!value)
        {
            LOG(LERROR) << "Every target must have a name!";
            return false;
        }
        cpp0x::shared_ptr<Target> buildTarget (new Target());
        cpp0x::shared_ptr<std::string> name(new std::string(value));
        buildTarget->SetTargetName(name);

        if (std::string(value).compare(Constants::DEFAULT_TARGET_NAME) == 0)
        {
            value = target->Attribute(Constants::XML_ATTR_TO_BE_BUILT);
            if (value)
            {
                defaultTargetName = std::string(value);
            }
        }

        if (opt = target->FirstChildElement(Constants::XML_TAG_PLATFORM))
        {
            cpp0x::shared_ptr<std::string> platform(new std::string(opt->GetText()));
            buildTarget->SetPlatform(platform);
        }

        if (opt = target->FirstChildElement(Constants::XML_TAG_PROJECT_DIR))
        {
            cpp0x::shared_ptr<std::string> projectDir(new std::string(opt->GetText()));
            buildTarget->SetProjectDir(projectDir);
        }

        if (opt = target->FirstChildElement(Constants::XML_TAG_BUILD_DIR))
        {
            cpp0x::shared_ptr<std::string> buildDir(new std::string(opt->GetText()));
            buildTarget->SetBuildDir(buildDir);
        }

        if (opt = target->FirstChildElement(Constants::XML_TAG_CMAKE_PROJECT_TYPE))
        {
            cpp0x::shared_ptr<std::string> cmakeProjectType(new std::string(opt->GetText()));
            buildTarget->SetCmakeProjectType(cmakeProjectType);
        }

        if (opt = target->FirstChildElement(Constants::XML_TAG_CUSTOM_ARGS))
        {
            cpp0x::shared_ptr<std::string> customArgs(new std::string(opt->GetText()));
            buildTarget->SetCustomArgs(customArgs);
        }

        if (opt = target->FirstChildElement(Constants::XML_TAG_PROJECTS_ROOT_DIR))
        {
            cpp0x::shared_ptr<std::string> projectsRootDir(new std::string(opt->GetText()));
            buildTarget->SetProjectsRootDir(projectsRootDir);
        }

        if (opt = target->FirstChildElement(Constants::XML_TAG_KRAL_PATH))
        {
            cpp0x::shared_ptr<std::string> kralPath(new std::string(opt->GetText()));
            buildTarget->SetKralPath(kralPath);
        }

        if (opt = target->FirstChildElement(Constants::XML_TAG_CMAKE))
        {
            cpp0x::shared_ptr<std::string> cmake(new std::string(opt->GetText()));
            buildTarget->SetCmake(cmake);
        }

        if (opt = target->FirstChildElement(Constants::XML_TAG_ANDROID_API_LEVEL))
        {
            cpp0x::shared_ptr<std::string> androidApiLevel(new std::string(opt->GetText()));
            buildTarget->SetAndroidApiLevel(androidApiLevel);
        }

        if (opt = target->FirstChildElement(Constants::XML_TAG_ANDROID_ARM_TARGET))
        {
            cpp0x::shared_ptr<std::string> value(new std::string(opt->GetText()));
            buildTarget->SetAndroidArmTarget(value);
        }

           if (opt = target->FirstChildElement(Constants::XML_TAG_BUILD_TYPE))
        {
            cpp0x::shared_ptr<std::string> value(new std::string(opt->GetText()));
            buildTarget->SetBuildType(value);
        } else {
            cpp0x::shared_ptr<std::string> value(new std::string("Debug"));
            buildTarget->SetBuildType(value);
        }

           if (opt = target->FirstChildElement(Constants::XML_TAG_ANDROID_ASSETS))
        {
            cpp0x::shared_ptr<std::string> value(new std::string(opt->GetText()));
            buildTarget->SetAssets(value);
        }
   
        if (opt = target->FirstChildElement(Constants::XML_TAG_COMPILER_CUSTOM_OPTS))
        {
            cpp0x::shared_ptr<std::string> value(new std::string(opt->GetText()));
            buildTarget->SetCompilerCustomOptions(value);
        }
        
        if (opt = target->FirstChildElement(Constants::XML_TAG_PACKAGE_DIRS))
        {
            cpp0x::shared_ptr<std::string> value(new std::string(opt->GetText()));
            buildTarget->SetPackageDirs(value);
        }

        if (buildTarget->GetTargetName()->compare(Constants::DEFAULT_TARGET_NAME) == 0)
        {
            this->defaultTarget = buildTarget;
        } else {
            this->targets.push_back(buildTarget);
        }
        target = target->NextSiblingElement();
    }
    return true;
}