コード例 #1
0
ファイル: qusbstoragegadget.cpp プロジェクト: Camelek/qtmoko
/*!
    \reimp
*/
void QUsbStorageGadgetProvider::activate()
{
    if (!value("active", false).toBool()) {
        if (!d->manager)
            d->manager = new QUsbManager;

        if (d->manager->canActivate(GADGET_NAME)) {
            loadModule();
        } else {
            connect(d->manager, SIGNAL(deactivateCompleted()), this, SLOT(loadModule()));
            connect(d->manager, SIGNAL(deactivateAborted()), this, SLOT(abort()));
            d->manager->deactivateGadgets();
        }
    }
}
コード例 #2
0
ファイル: ASAP_Apollo.cpp プロジェクト: epi/asap
	BOOL __cdecl GetInfo(char *filename, int audioDataOffset, TrackInfo *trackInfo)
	{
		BYTE module[ASAPInfo_MAX_MODULE_LENGTH];
		int module_len;
		if (!loadModule(filename, module, &module_len))
			return FALSE;
		ASAPInfo *info = ASAPInfo_New();
		if (info == NULL)
			return FALSE;
		if (!ASAPInfo_Load(info, filename, module, module_len)) {
			ASAPInfo_Delete(info);
			return FALSE;
		}
		strcpy(trackInfo->suggestedTitle, ASAPInfo_GetTitle(info));
		trackInfo->fileSize = module_len;
		trackInfo->seekable = TRUE;
		trackInfo->hasEqualizer = FALSE;
		int duration = getSongDuration(info, ASAPInfo_GetDefaultSong(info));
		trackInfo->playingTime = duration >= 0 ? duration : -1;
		trackInfo->bitRate = 0;
		trackInfo->sampleRate = ASAP_SAMPLE_RATE;
		trackInfo->numChannels = ASAPInfo_GetChannels(info);
		trackInfo->bitResolution = BITS_PER_SAMPLE;
		strcpy(trackInfo->fileTypeDescription, "8-bit Atari music");
		ASAPInfo_Delete(info);
		return TRUE;
	}
コード例 #3
0
ファイル: network.c プロジェクト: psxdev/PS4-SDK
void initNetwork(void) {
	int libNet;
	loadModule("libSceNet.sprx", &libNet);

	RESOLVE(libNet, sceNetSocket);
	RESOLVE(libNet, sceNetSocketClose);
	RESOLVE(libNet, sceNetConnect);
	RESOLVE(libNet, sceNetSend);
	RESOLVE(libNet, sceNetBind);
	RESOLVE(libNet, sceNetListen);
	RESOLVE(libNet, sceNetAccept);
	RESOLVE(libNet, sceNetRecv);
	RESOLVE(libNet, sceNetSocketAbort);
	

	RESOLVE(libNet, sceNetGetsockname);
	RESOLVE(libNet, sceNetGetsockopt);
	RESOLVE(libNet, sceNetSetsockopt);

	RESOLVE(libNet, sceNetInetNtop);
	RESOLVE(libNet, sceNetInetPton);

	RESOLVE(libNet, sceNetHtonll);
	RESOLVE(libNet, sceNetHtonl);
	RESOLVE(libNet, sceNetHtons);
	RESOLVE(libNet, sceNetNtohll);
	RESOLVE(libNet, sceNetNtohl);
	RESOLVE(libNet, sceNetNtohs);
}
コード例 #4
0
ファイル: wasap.c プロジェクト: 070499/xbmc
static void LoadAndPlay(int song)
{
	byte module[ASAP_MODULE_MAX];
	int module_len;
	int duration;
	if (!loadModule(current_filename, module, &module_len))
		return;
	if (songs > 0) {
		ClearSongsMenu();
		StopPlayback();
		songs = 0;
		EnableMenuItem(hTrayMenu, IDM_SAVE_WAV, MF_BYCOMMAND | MF_GRAYED);
	}
	if (!DoLoad(&asap, module, module_len))
		return;
	if (!WaveOut_Open(asap.module_info.channels)) {
		ShowError("Error initalizing WaveOut");
		return;
	}
	if (song < 0)
		song = asap.module_info.default_song;
	songs = asap.module_info.songs;
	EnableMenuItem(hTrayMenu, IDM_SAVE_WAV, MF_BYCOMMAND | MF_ENABLED);
	updateInfoDialog(current_filename, song);
	SetSongsMenu(songs);
	CheckMenuRadioItem(hSongMenu, 0, songs - 1, song, MF_BYPOSITION);
	current_song = song;
	duration = asap.module_info.durations[song];
	if (asap.module_info.loops[song])
		duration = -1;
	ASAP_PlaySong(&asap, song, duration);
	Tray_Modify(hPlayIcon);
	WaveOut_Start();
}
コード例 #5
0
ファイル: dlfcn.c プロジェクト: Sathyaish/Practice
void * dlopen(const char * path, int mode)
{
    const struct stat * sbuf;
    struct dlstatus * dls;
    const char * fullPath;
    if (!path)
    {
        return &mainStatus;
    }    
    if (!(sbuf = findFile(path, &fullPath)))
    {
        error("file \"%s\" not found", path);
        return NULL;
    }
    /* Now checks that it hasn't been closed already */
    if ((dls = lookupStatus(sbuf)) && (dls->refs > 0))
    {
        /* debug("status found"); */
        return reference(dls, mode);    
    }
    if (isFlagSet(mode, RTLD_NOLOAD))
    {
        error("no existing handle and RTLD_NOLOAD specified");
        return NULL;
    }
    return reference(loadModule(fullPath, sbuf, mode),mode);
}
コード例 #6
0
void ModuleLoader::setModuleDirectory(const char* directory)
{
  DIR* dir;
  struct dirent* ent;
  const size_t len = strlen(directory) + 256 + 1;
  char* fname;
  IServiceManager* servmgr;

  dir = opendir(directory);
  if(!dir)
    return;

  fname = static_cast<char*>(malloc(len));
  servmgr = XPLC_getServiceManager();

  rewinddir(dir);
  while((ent = readdir(dir)) && fname && servmgr) {
    snprintf(fname, len, "%s/%s", directory, ent->d_name);

    loadModule(fname);
  }

  if(servmgr)
    servmgr->release();

  free(fname);

  closedir(dir);
}
コード例 #7
0
ファイル: eios.c プロジェクト: Brandon-T/CMML
bool loadEIOSClient(EIOSClient *client, char *path)
{
    memset(client, 0, sizeof(EIOSClient));
    client->libHandle = loadModule(path);

    if (client->libHandle == NULL)
        return false;

    client->requestTarget = (requestTargetT)getModuleFunc(client->libHandle, "EIOS_RequestTarget");
    client->releaseTarget = (releaseTargetT)getModuleFunc(client->libHandle, "EIOS_ReleaseTarget");

    client->getTargetDimensions = (getTargetDimensionsT)getModuleFunc(client->libHandle, "EIOS_GetTargetDimensions");
    client->getTargetPosition = (getTargetPositionT)getModuleFunc(client->libHandle, "EIOS_GetTargetPosition");

    client->getImageBuffer = (getImageBufferT)getModuleFunc(client->libHandle, "EIOS_GetImageBuffer");
    client->updateImageBuffer = (updateImageBufferT)getModuleFunc(client->libHandle, "EIOS_UpdateImageBuffer");
    client->updateImageBufferBox = (updateImageBufferBoxT)getModuleFunc(client->libHandle, "EIOS_UpdateImageBufferBounds");

    client->getMousePosition = (getMousePositionT)(getMousePositionT)getModuleFunc(client->libHandle, "EIOS_GetMousePosition");
    client->moveMouse = (moveMouseT)(moveMouseT)getModuleFunc(client->libHandle, "EIOS_MoveMouse");
    client->scrollMouse = (scrollMouseT)getModuleFunc(client->libHandle, "EIOS_ScrollMouse");
    client->holdMouse = (holdMouseT)getModuleFunc(client->libHandle, "EIOS_HoldMouse");
    client->releaseMouse = (releaseMouseT)getModuleFunc(client->libHandle, "EIOS_ReleaseMouse");
    client->isMouseButtonHeld = (isMouseButtonHeldT)getModuleFunc(client->libHandle, "EIOS_IsMouseButtonHeld");

    client->sendString = (sendStringT)getModuleFunc(client->libHandle, "EIOS_SendString");
    client->holdKey = (holdKeyT)getModuleFunc(client->libHandle, "EIOS_HoldKey");
    client->releaseKey = (releaseKeyT)getModuleFunc(client->libHandle, "EIOS_ReleaseKey");
    client->isKeyHeld = (isKeyHeldT)getModuleFunc(client->libHandle, "EIOS_IsKeyHeld");
    client->getKeyCode = (getKeyCodeT)getModuleFunc(client->libHandle, "EIOS_GetKeyCode");

    return true;
}
コード例 #8
0
ファイル: ls_lua_util.c プロジェクト: bizonix/openlitespeed
ls_lua_api_t * ls_lua_dl_loadModule( const char * name, char * errbuf )
{
    register ls_lua_api_t   *dlp;

    errbuf[0] = 0;
    if ( (dlp = findModuleByName( name )) )
    {
        return dlp;
    }
    dlp = ( ls_lua_api_t * )malloc( sizeof( ls_lua_api_t ) + strlen( name ) + 1 );
    if ( !dlp )
    {
        snprintf( errbuf, MAX_ERRBUF_SIZE, "NO MEMORY" );
        return NULL;
    }
    if ( !( dlp->moduleName = strdup( name ) ) )
    {
        snprintf( errbuf, MAX_ERRBUF_SIZE, "NO MEMORY" );
        free( dlp );
        return NULL;
    }

    if ( loadModule( dlp, errbuf ) )
    {
        /* problem in load module */
        free( dlp->moduleName );
        free( dlp );
        return NULL;
    }
    return dlp;
}
コード例 #9
0
void
ModuleManager::loadModules (std::string dirPath)
{
  GST_INFO ("Looking for modules in %s", dirPath.c_str() );
  boost::filesystem::path dir (dirPath);

  if (!boost::filesystem::is_directory (dir) ) {
    GST_WARNING ("Unable to load modules from:  %s, it is not a directory",
                 dirPath.c_str() );
    return;
  }

  boost::filesystem::directory_iterator end_itr;

  for ( boost::filesystem::directory_iterator itr ( dir ); itr != end_itr;
        ++itr ) {
    if (boost::filesystem::is_regular (*itr) ) {
      boost::filesystem::path extension = itr->path().extension();

      if (extension.string() == ".so") {

        loadModule (itr->path().string() );
      }
    } else if (boost::filesystem::is_directory (*itr) ) {
      this->loadModules (itr->path().string() );
    }
  }
}
コード例 #10
0
ファイル: in_asap.c プロジェクト: vitamin-caig/zxtune
static int play(char *fn)
{
	char filename[MAX_PATH];
	int song;
	const ASAPInfo *info;
	int channels;
	int maxlatency;
	DWORD threadId;
	strcpy(playing_filename_with_song, fn);
	song = extractSongNumber(fn, filename);
	if (!loadModule(filename, module, &module_len))
		return -1;
	if (!ASAP_Load(asap, filename, module, module_len))
		return 1;
	info = ASAP_GetInfo(asap);
	if (song < 0)
		song = ASAPInfo_GetDefaultSong(info);
	duration = playSong(song);
	channels = ASAPInfo_GetChannels(info);
	maxlatency = mod.outMod->Open(ASAP_SAMPLE_RATE, channels, BITS_PER_SAMPLE, -1, -1);
	if (maxlatency < 0)
		return 1;
	mod.SetInfo(BITS_PER_SAMPLE, ASAP_SAMPLE_RATE / 1000, channels, 1);
	mod.SAVSAInit(maxlatency, ASAP_SAMPLE_RATE);
	// the order of VSASetInfo's arguments in in2.h is wrong!
	// http://forums.winamp.com/showthread.php?postid=1841035
	mod.VSASetInfo(ASAP_SAMPLE_RATE, channels);
	mod.outMod->SetVolume(-666);
	seek_needed = -1;
	thread_run = TRUE;
	thread_handle = CreateThread(NULL, 0, playThread, NULL, 0, &threadId);
	setPlayingSong(filename, song);
	return thread_handle != NULL ? 0 : 1;
}
コード例 #11
0
ファイル: in_asap.c プロジェクト: vitamin-caig/zxtune
static void getFileInfo(char *file, char *title, int *length_in_ms)
{
	char filename[MAX_PATH];
	const char *hash;
	if (file == NULL || file[0] == '\0')
		file = playing_filename_with_song;
	title_song = extractSongNumber(file, filename);
	if (title_song < 0)
		expandPlaylistSongs();
	if (!loadModule(filename, module, &module_len))
		return;
	hash = atrFilenameHash(filename);
	if (!ASAPInfo_Load(title_info, hash != NULL ? hash + 1 : filename, module, module_len))
		return;
	if (title_song < 0)
		title_song = ASAPInfo_GetDefaultSong(title_info);
	if (title != NULL) {
		waFormatTitle fmt_title = {
			NULL, NULL, title, 512, tagFunc, tagFreeFunc
		};
		getTitle(title); // in case IPC_FORMAT_TITLE doesn't work...
		SendMessage(mod.hMainWindow, WM_WA_IPC, (WPARAM) &fmt_title, IPC_FORMAT_TITLE);
	}
	if (length_in_ms != NULL)
		*length_in_ms = getSongDuration(title_info, title_song);
}
コード例 #12
0
ファイル: libc.c プロジェクト: lhjay1/PS4-SDK
void initLibc(void) {
	int libc;
	loadModule("libSceLibcInternal.sprx", &libc);

	RESOLVE(libc, malloc);
	RESOLVE(libc, free);
	RESOLVE(libc, memset);
	RESOLVE(libc, memcpy);
	RESOLVE(libc, strcpy);
	RESOLVE(libc, strcat);
	RESOLVE(libc, strncat);
	RESOLVE(libc, strlen);
	RESOLVE(libc, strcmp);
	RESOLVE(libc, strncmp);
	RESOLVE(libc, sprintf);
	RESOLVE(libc, snprintf);
	RESOLVE(libc, sscanf);
	RESOLVE(libc, strchr);
	RESOLVE(libc, strrchr);

	RESOLVE(libc, asctime);
	RESOLVE(libc, asctime_r);
	RESOLVE(libc, ctime);
	RESOLVE(libc, ctime_r);
	RESOLVE(libc, gmtime);
	RESOLVE(libc, gmtime_r);
	RESOLVE(libc, localtime);
	RESOLVE(libc, localtime_r);
	RESOLVE(libc, mktime);
}
コード例 #13
0
ファイル: wrappy.cpp プロジェクト: islenv/wrappy
PythonObject callWithArgs(
    const std::string& name,
    const std::vector<PythonObject>& args,
    const std::vector<std::pair<std::string, PythonObject>>& kwargs)
{
    size_t cutoff;
    PythonObject module = loadModule(name, cutoff);
    PythonObject function;

    if (module) {
        function = loadFunction(module, name.substr(cutoff));
    } else {
        // No proper prefix was a valid module, but maybe it's a built-in
        function = loadBuiltin(name);
    }

    if (!function) {
        std::string error_message;
        if(cutoff != std::string::npos) {
            error_message = "Wrappy: Lookup of function " +
                name.substr(cutoff) + " in module " +
                name.substr(0,cutoff) + " failed.";
        } else {
            error_message = "Wrappy: Lookup of function " + name + "failed.";
        }

        throw WrappyError(error_message);
    }

    return callFunctionWithArgs(function, args, kwargs);
}
コード例 #14
0
ファイル: g_api.c プロジェクト: ETrun/ETrun
void G_loadAPI() {
	char homepath[512];
	char basepath[512];

	trap_Cvar_VariableStringBuffer("fs_homepath", homepath, sizeof (homepath));
	trap_Cvar_VariableStringBuffer("fs_basepath", basepath, sizeof (basepath));

	// Load the module
	if (!loadModule(basepath, homepath)) {
		printError();
		G_Error("Error loading %s\n", g_APImoduleName.string);
	}

	// Load the APIquery function
	if (!loadAPISymbols()) {
		printError();
		G_Error("Error loading symbols from %s\n", g_APImoduleName.string);
	}

	if (API_init(homepath, basepath, g_APImoduleName.string) != 0) {
		G_Error("Error calling API_init()");
	}

	G_Printf("%s: API module loaded!\n", GAME_VERSION);
}
コード例 #15
0
ファイル: llvm-lto.cpp プロジェクト: ispras/llvm-for-v8
  void codegen() {
    if (InputFilenames.size() != 1 && !OutputFilename.empty())
      report_fatal_error("Can't handle a single output filename and multiple "
                         "input files, do not provide an output filename and "
                         "the output files will be suffixed from the input "
                         "ones.");
    if (!ThinLTOIndex.empty())
      errs() << "Warning: -thinlto-index ignored for codegen stage";

    for (auto &Filename : InputFilenames) {
      LLVMContext Ctx;
      auto TheModule = loadModule(Filename, Ctx);

      auto Buffer = ThinGenerator.codegen(*TheModule);
      std::string OutputName = OutputFilename;
      if (OutputName.empty()) {
        OutputName = Filename + ".thinlto.o";
      }
      if (OutputName == "-") {
        outs() << Buffer->getBuffer();
        return;
      }

      std::error_code EC;
      raw_fd_ostream OS(OutputName, EC, sys::fs::OpenFlags::F_None);
      error(EC, "error opening the file '" + OutputName + "'");
      OS << Buffer->getBuffer();
    }
  }
コード例 #16
0
fcAACEncoder::~fcAACEncoder()
{
    if (!loadModule()) { return; }

    faacEncClose_imp(m_handle);
    m_handle = nullptr;
}
コード例 #17
0
ファイル: sthread.cpp プロジェクト: AReim1982/scummvm
ScriptThread &Script::createThread(uint16 scriptModuleNumber, uint16 scriptEntryPointNumber) {
	loadModule(scriptModuleNumber);
	if (_modules[scriptModuleNumber].entryPoints.size() <= scriptEntryPointNumber) {
		error("Script::createThread wrong scriptEntryPointNumber");
	}

	ScriptThread tmp;
	_threadList.push_front(tmp);
	ScriptThread &newThread = _threadList.front();
	newThread._instructionOffset = _modules[scriptModuleNumber].entryPoints[scriptEntryPointNumber].offset;
	newThread._commonBase = _commonBuffer.getBuffer();
	newThread._staticBase = _commonBuffer.getBuffer() + _modules[scriptModuleNumber].staticOffset;
	newThread._moduleBase = _modules[scriptModuleNumber].moduleBase.getBuffer();
	newThread._moduleBaseSize = _modules[scriptModuleNumber].moduleBase.size();
	newThread._strings = &_modules[scriptModuleNumber].strings;

	if (_vm->getGameId() == GID_IHNM)
		newThread._voiceLUT = &_globalVoiceLUT;
	else
		newThread._voiceLUT = &_modules[scriptModuleNumber].voiceLUT;

	newThread._stackBuf.resize(ScriptThread::THREAD_STACK_SIZE);
	newThread._stackTopIndex = ScriptThread::THREAD_STACK_SIZE - 2;
	debug(3, "createThread(). Total threads: %d", _threadList.size());
	return newThread;
}
コード例 #18
0
ファイル: llvm-lto.cpp プロジェクト: ispras/llvm-for-v8
  /// Load the combined index from disk, then load every file referenced by
  /// the index and add them to the generator, then performs the promotion and
  /// cross module importing on the files mentioned on the command line
  /// (these must match the index content).
  void import() {
    if (InputFilenames.size() != 1 && !OutputFilename.empty())
      report_fatal_error("Can't handle a single output filename and multiple "
                         "input files, do not provide an output filename and "
                         "the output files will be suffixed from the input "
                         "ones.");

    auto Index = loadCombinedIndex();
    auto InputBuffers = loadAllFilesForIndex(*Index);
    for (auto &MemBuffer : InputBuffers)
      ThinGenerator.addModule(MemBuffer->getBufferIdentifier(),
                              MemBuffer->getBuffer());

    for (auto &Filename : InputFilenames) {
      LLVMContext Ctx;
      auto TheModule = loadModule(Filename, Ctx);

      ThinGenerator.crossModuleImport(*TheModule, *Index);

      std::string OutputName = OutputFilename;
      if (OutputName.empty()) {
        OutputName = Filename + ".thinlto.imported.bc";
      }
      writeModuleToFile(*TheModule, OutputName);
    }
  }
コード例 #19
0
ファイル: in_asap.c プロジェクト: BigHNF/tcpmp-revive
static int play(char *fn)
{
	int song;
	int maxlatency;
	DWORD threadId;
	strcpy(current_filename_with_song, fn);
	song = extractSongNumber(fn, current_filename);
	if (!loadModule(current_filename, module, &module_len))
		return -1;
	if (!ASAP_Load(&asap, current_filename, module, module_len))
		return 1;
	if (song < 0)
		song = asap.module_info.default_song;
	duration = playSong(song);
	maxlatency = mod.outMod->Open(ASAP_SAMPLE_RATE, channels, BITS_PER_SAMPLE, -1, -1);
	if (maxlatency < 0)
		return 1;
	mod.SetInfo(BITS_PER_SAMPLE, ASAP_SAMPLE_RATE / 1000, channels, 1);
	mod.SAVSAInit(maxlatency, ASAP_SAMPLE_RATE);
	// the order of VSASetInfo's arguments in in2.h is wrong!
	// http://forums.winamp.com/showthread.php?postid=1841035
	mod.VSASetInfo(ASAP_SAMPLE_RATE, channels);
	mod.outMod->SetVolume(-666);
	seek_needed = -1;
	thread_run = TRUE;
	thread_handle = CreateThread(NULL, 0, playThread, NULL, 0, &threadId);
	if (playing_info)
		updateInfoDialog(current_filename, song);
	return thread_handle != NULL ? 0 : 1;
}
コード例 #20
0
bool DockContainer::dockModule(ConfigModule *module)
{
    if(module == _module)
        return true;

    if(_module && _module->isChanged())
    {

        int res = KMessageBox::warningYesNoCancel(this, module ? i18n("There are unsaved changes in the active module.\n"
                                                                      "Do you want to apply the changes before running "
                                                                      "the new module or discard the changes?")
                                                               : i18n("There are unsaved changes in the active module.\n"
                                                                      "Do you want to apply the changes before exiting "
                                                                      "the Control Center or discard the changes?"),
                                                  i18n("Unsaved Changes"), KStdGuiItem::apply(), KStdGuiItem::discard());
        if(res == KMessageBox::Yes)
            _module->module()->applyClicked();
        if(res == KMessageBox::Cancel)
            return false;
    }

    raiseWidget(_busyw);
    kapp->processEvents();

    deleteModule();
    if(!module)
        return true;

    ProxyWidget *widget = loadModule(module);

    KCGlobal::repairAccels(topLevelWidget());
    return (widget != 0);
}
コード例 #21
0
ファイル: sound.cpp プロジェクト: AReim1982/scummvm
void AmigaSound::playPattern(const char *base, int pattern) {
	_mixer->stopHandle(_patHandle);
	Audio::AudioStream *stream = loadModule(base, -pattern);
	if (stream) {
		_mixer->playStream(Audio::Mixer::kSFXSoundType, &_patHandle, stream);
	}
}
コード例 #22
0
ファイル: in_asap.c プロジェクト: BigHNF/tcpmp-revive
static void expandFileSongs(HWND playlistWnd, int index)
{
	const char *fn;
	fileinfo fi;
	int song;
	ASAP_ModuleInfo module_info;
	char *p;
	int j;
	fn = (const char *) SendMessage(mod.hMainWindow, WM_WA_IPC, index, IPC_GETPLAYLISTFILE);
	song = extractSongNumber(fn, fi.file);
	if (song >= 0 || !ASAP_IsOurFile(fi.file))
		return;
	if (!loadModule(fi.file, module, &module_len))
		return;
	if (!ASAP_GetModuleInfo(&module_info, fi.file, module, module_len))
		return;
	SendMessage(playlistWnd, WM_WA_IPC, IPC_PE_DELETEINDEX, index);
	p = fi.file + strlen(fi.file);
	for (j = 0; j < module_info.songs; j++) {
		COPYDATASTRUCT cds;
		sprintf(p, "#%d", j + 1);
		fi.index = index + j;
		cds.dwData = IPC_PE_INSERTFILENAME;
		cds.lpData = &fi;
		cds.cbData = sizeof(fileinfo);
		SendMessage(playlistWnd, WM_COPYDATA, 0, (LPARAM) &cds);
	}
}
コード例 #23
0
int CKernelOptions::exec(CMenuTarget * parent, const std::string & actionKey)
{
	int res = menu_return::RETURN_REPAINT;

	if (actionKey == "reset") {
		for (unsigned int i = 0; i < modules.size(); i++)
			modules[i].active = modules[i].active_orig;
		updateStatus();
		return res;
	}

	if (actionKey == "apply" || actionKey == "change") {
		bool needs_save = false;
		for (unsigned int i = 0; i < modules.size(); i++)
			if (modules[i].active != modules[i].active_orig) {
				needs_save = true;
				if (modules[i].active)
					loadModule(i);
				else
					unloadModule(i);
				modules[i].active_orig = modules[i].active;
			}
		if (needs_save)
			save();
		updateStatus();
		return res;
	}

	if (parent)
		parent->hide();

	Settings();

	return res;
}
コード例 #24
0
bool PythonTransform::setModuleFile(const QString &fileName)
{
    if (type == ModulesManagement::AUTO) {
        Q_EMIT error(tr("Not allowed to change the module for auto loaded modules"),id);
        return false;
    }
    if (fileName == moduleFileName) {
        qDebug() << "nothing to be done here, filename already set";
        return true; // nothing to be done here
    }

    QString val = moduleManagement->addModule(fileName, type);
    if (!val.isEmpty()) {
        PyGILState_STATE lgstate;
        lgstate = PyGILState_Ensure();
        Py_XDECREF(pModule);
        pModule = nullptr;
        moduleName = val;
        moduleFileName = fileName;

        if  (!loadModule()) {
           Q_EMIT error(tr("Error while loading module"),id);
        } else {
            qDebug() << "Module appeared to have been loaded successfully";
        }
        PyGILState_Release(lgstate);
        return true;
    }
    return false;
}
コード例 #25
0
//Enable lazy initialization
//Loads the function and arguments
void PythonHandler::init(std::string filename, std::string functionname, PythonArgList arg_list) {
	good = true;
	loadName(filename);
	loadModule();
	loadFunction(functionname);
	packArgs(arg_list);
}
コード例 #26
0
MsmWindow::MsmWindow(QWidget *parent) :
    QMainWindow(parent)
{
    // Prepare the view area
    stackedWidget = new QStackedWidget(this);
    setCentralWidget(stackedWidget);

    QQuickView *view = new QQuickView();
    menuView = QWidget::createWindowContainer(view, this);
    menuView->setFocusPolicy(Qt::TabFocus);
    view->setSource(QUrl("qrc:/qml/main.qml"));
    stackedWidget->addWidget(menuView);
    stackedWidget->setCurrentWidget(menuView);

    moduleView = new ModuleView();
    stackedWidget->addWidget(moduleView);

    QQuickItem *rootObject = view->rootObject();
    QQuickItem::connect(rootObject, SIGNAL(itemClicked(QString)),
                     this, SLOT(loadModule(QString)));

    ModuleView::connect(moduleView, &ModuleView::closeRequest,
                        [=]() {
        moduleView->resolveChanges();
        moduleView->closeModules();
        stackedWidget->setCurrentWidget(menuView);
    });

    init();
    readPositionSettings();
}
コード例 #27
0
ファイル: Completion.cpp プロジェクト: annulen/webkit
JSInternalPromise* loadModule(ExecState* exec, const String& moduleName)
{
    JSLockHolder lock(exec);
    RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable());
    RELEASE_ASSERT(!exec->vm().isCollectorBusy());

    return loadModule(lock, exec, exec->vmEntryGlobalObject(), Identifier::fromString(exec, moduleName));
}
コード例 #28
0
CUresult util::KernelExtractorDriver::cuModuleLoad(CUmodule *module, const char *fname) {
	trace();	
	CUresult res = cudaDriver.cuModuleLoad(module, fname);
	if (enabled) {
		loadModule(res, *module, 0, fname);
	}
	RETURN( res );
}
コード例 #29
0
ファイル: sound.cpp プロジェクト: AReim1982/scummvm
void AmigaSound::playModule(const char *base, int song) {
	_mixer->stopHandle(_modHandle);
	Audio::AudioStream *stream = loadModule(base, song);
	if (stream) {
		_mixer->playStream(Audio::Mixer::kMusicSoundType, &_modHandle, stream);
	}
	_fanfareCount = 0;
}
コード例 #30
0
ファイル: jawasd.c プロジェクト: cthulhuology/Jawas2
void loadModules() {
	struct dirent *file;
	debug("Loading modules in %s",module_path);
	DIR* dir = opendir(module_path);
	if (!dir) die(6,"Failed to open module directory path %s",module_path);
	while (file = readdir(dir)) loadModule(file->d_name);
	closedir(dir);	
}