Exemple #1
0
void
gioInitializeDescriptor (GioDescriptor *descriptor) {
  descriptor->serial.parameters = NULL;
  initializeOptions(&descriptor->serial.options);
  descriptor->serial.options.inputTimeout = 100;

  descriptor->usb.channelDefinitions = NULL;
  initializeOptions(&descriptor->usb.options);
  descriptor->usb.options.inputTimeout = 1000;
  descriptor->usb.options.outputTimeout = 1000;

  descriptor->bluetooth.channelNumber = 0;
  initializeOptions(&descriptor->bluetooth.options);
  descriptor->bluetooth.options.inputTimeout = 100;
}
Exemple #2
0
void
MirfoxData::initializeMirfoxData()
{

	initializeMirandaAccounts();	//must be before initializeMirandaContacts
	initializeMirandaContacts();
	initializeOptions();

}
Exemple #3
0
void
interactive() {
  
  char *sbmlFilename;
  char *select;
  int quit;
  SBMLDocument_t *d  = NULL;
  Model_t        *m  = NULL;
  odeModel_t *om     = NULL;
  cvodeData_t * data = NULL;
  integratorInstance_t *ii = NULL;
  cvodeSettings_t *set = NULL;

  printf("\n\nWelcome to the simple SBML ODE solver.\n");
  printf("You have entered the interactive mode.\n");
  printf("All other commandline options have been ignored.\n");
  printf("Have fun!\n\n");

  initializeOptions();
  /* reset steady state */
  Opt.SteadyState = 0;
  /* activate printing of results to XMGrace */
  Opt.Xmgrace = 1;
  /* activate printing integrator messages */
  Opt.PrintMessage = 1;
  /* deactivate on the fly printing of results */
  Opt.PrintOnTheFly = 0;

  sbmlFilename = concat(Opt.ModelPath, Opt.ModelFile);

  if ( (d = parseModelWithArguments(sbmlFilename)) == 0 )
  {
    Warn(stderr, "%s:%d interactive(): Can't parse Model >%s<",
	  __FILE__, __LINE__, sbmlFilename);
    d = loadFile();
  }

  /* load models and default settings */
  m = SBMLDocument_getModel(d);
  om = ODEModel_create(m);
  set = CvodeSettings_create();
  SolverError_dumpAndClearErrors();
  
  quit = 0;
  data = NULL;
  
  while ( quit == 0 ) {

    printf("\n");
    printf("Press (h) for instructions or (q) to quit.\n");
    printf("> ");
    select = get_line( stdin );
    select = util_trim(select);
    printf("\n");

    if( strcmp(select,"l") == 0 ) {
      /* free all existing structures */
      if ( om != NULL )
	ODEModel_free(data->model);
      if ( d != NULL )
	SBMLDocument_free(d);
      if ( ii != NULL )
	IntegratorInstance_free(ii);

      /* load a new file */
      d = loadFile();
      
      /* load new models */
      m = SBMLDocument_getModel(d);
      om = ODEModel_create(m);
      SolverError_dumpAndClearErrors();            
    }

    if(strcmp(select,"h")==0)
      printMenu();
    
    if(strcmp(select,"s")==0)
      printModel(m, stdout);
    
    if(strcmp(select,"c")==0)
      printSpecies(m, stdout);
    
    if(strcmp(select,"r")==0)
      printReactions(m, stdout);
    
    if(strcmp(select,"o")==0)
      printODEs(om, stdout);

    /* integrate interface functions, asks for time and printsteps */
    if(strcmp(select,"i")==0){
      ii = callIntegrator(om, set);
      SolverError_dumpAndClearErrors();
    }

    if(strcmp(select,"x")==0){
      if ( Opt.Xmgrace == 1 ) {
	Opt.Xmgrace = 0;
	printf(" Printing results to stdout\n");
      }
      else if ( Opt.Xmgrace == 0 ) {
	Opt.Xmgrace = 1;
	printf(" Printing results to XMGrace\n");
      }
    }      
    if(strcmp(select,"st")==0)
      printConcentrationTimeCourse(ii->data, stdout);
    
    if(strcmp(select,"jt")==0)
      printJacobianTimeCourse(ii->data, stdout);

    
    if(strcmp(select,"ot")==0)
      printOdeTimeCourse(ii->data, stdout);

    
    if(strcmp(select,"rt")==0)
      printReactionTimeCourse(ii->data, m, stdout);
    
    if(strcmp(select,"xp")==0)
      printPhase(ii->data);
    
    
    if(strcmp(select,"set")==0)
      setValues(m);
    
    
    if(strcmp(select,"ss")==0){
      if ( Opt.SteadyState == 1 ) {
	Opt.SteadyState = 0;
	printf(" Not checking for steady states during integration.\n");
      }
      else if ( Opt.SteadyState == 0 ) {
	Opt.SteadyState = 1;
	printf(" Checking for steady states during integration.\n");
      }
    }

    if(strcmp(select,"uj")==0){
      if ( Opt.Jacobian == 1 ) {
	Opt.Jacobian = 0;
	printf(" Using CVODE's internal approximation\n");
	printf(" of the jacobian matrix for integration\n");
      }
      else if ( Opt.Jacobian == 0 ) {
	Opt.Jacobian = 1;
	printf(" Using automatically generated\n");
	printf(" jacobian matrix for integration\n");
      }
    }
    
    if(strcmp(select,"gf")==0)
      setFormat();
    
    if(strcmp(select,"rg")==0) {
      drawModel(m, sbmlFilename, Opt.GvFormat);
      SolverError_dumpAndClearErrors();
    }
    
    if(strcmp(select,"jg")==0){
      if ( ii == NULL ) {
	data = CvodeData_create(om);
	CvodeData_initialize(data, set, om, 0);
	drawJacoby(data, sbmlFilename, Opt.GvFormat);
	SolverError_dumpAndClearErrors();
	CvodeData_free(data);
      }
      else {
	drawJacoby(ii->data, sbmlFilename, Opt.GvFormat);
	SolverError_dumpAndClearErrors();
      }
    }

    
    if(strcmp(select,"j")==0) {
      if ( om->jacob == NULL )
	ODEModel_constructJacobian(om);
      printJacobian(om, stdout);
    }

    
    if(strcmp(select,"q")==0)
      quit = 1;
    
  }

  if ( ii != NULL )
    IntegratorInstance_free(ii);
  if ( om != NULL ) 
    ODEModel_free(om);

  SBMLDocument_free(d);
  SolverError_dumpAndClearErrors();
  printf("\n\nGood Bye. Thx for using.\n\n");
}
Exemple #4
0
void 
decodeCML (int argc, char *argv[])
{
  initializeOptions();
  processOptions(argc, argv);
}
BOOL CALLBACK ConfigDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
{
	LRESULT result;

	switch (Message)
	{
	case WM_INITDIALOG :
		{
			initializeOptions();
			goToCenter();

			Edit_LimitText(GetDlgItem(_hSelf, IDC_MAXDISPLAYFILES), 7);
			Edit_LimitText(GetDlgItem(_hSelf, IDC_MAXTRAVERSEFILES), 7);
			Edit_LimitText(GetDlgItem(_hSelf, IDC_SEARCHCONTEXTPATH), MAX_PATH);

			initTooltips();

			return TRUE;
		}

	case WM_COMMAND :
		{
			switch (LOWORD(wParam))
			{
			case IDC_RADIOSORTREMEMBER:
			case IDC_RADIOSORTINDEX:
			case IDC_RADIOSORTPATH:
			case IDC_RADIOSORTFILENAME:
				{
					enableOrDisableSortCheckBoxes();
					break;
				}
			case IDC_CHECKSORTDESCENDING :
			{
				_options->activeReversedSortOrder = (BST_CHECKED != ::SendDlgItemMessage(_hSelf, IDC_CHECKOVERRIDESORTWHENTABBING, BM_GETCHECK, 0, 0));
				break;
			}
			case IDC_CHECKDIALOGFORCTRLTAB :
				{
					bool checked = BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKDIALOGFORCTRLTAB, BM_GETCHECK, 0, 0);
					EnableWindow(GetDlgItem(_hSelf, IDC_CHECKREVERTSORTORDERDURINGTABBING), checked);
					break;
				}
			case IDC_CHECKCONFIGURESEARCHCONTEXT:
				{
					bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKCONFIGURESEARCHCONTEXT, BM_GETCHECK, 0, 0));
					EnableWindow(GetDlgItem(_hSelf, IDC_SEARCHCONTEXTPATH), isChecked);
					EnableWindow(GetDlgItem(_hSelf, IDC_MAXTRAVERSEFILES), isChecked);
					EnableWindow(GetDlgItem(_hSelf, IDC_MAXDISPLAYFILES), isChecked);
					EnableWindow(GetDlgItem(_hSelf, IDC_CHECKINCLUDEINDEX), !isChecked);
					EnableWindow(GetDlgItem(_hSelf, IDC_CHECKINCLUDEVIEW), !isChecked);
					EnableWindow(GetDlgItem(_hSelf, IDC_RADIOSORTINDEX), !isChecked);
					EnableWindow(GetDlgItem(_hSelf, IDC_CHECKONLYCURRENTVIEW), !isChecked);
					EnableWindow(GetDlgItem(_hSelf, IDC_CHECKSEPARATECOLUMNFORVIEW), !isChecked);

					if(BST_CHECKED && ::SendDlgItemMessage(_hSelf, IDC_RADIOSORTINDEX, BM_GETCHECK, 0, 0))
					{
						::SendDlgItemMessage(_hSelf, IDC_RADIOSORTFILENAME, BM_SETCHECK, BST_CHECKED, 0);
					}
					else if(!BST_CHECKED && ::SendDlgItemMessage(_hSelf, IDC_RADIOSORTINDEX, BM_GETCHECK, 0, 0))
					{
						::SendDlgItemMessage(_hSelf, IDC_RADIOSORTREMEMBER, BM_SETCHECK, BST_UNCHECKED, 0);
						::SendDlgItemMessage(_hSelf, IDC_RADIOSORTFILENAME, BM_SETCHECK, BST_UNCHECKED, 0);
						::SendDlgItemMessage(_hSelf, IDC_RADIOSORTPATH, BM_SETCHECK, BST_UNCHECKED, 0);
					}
					break;
				}
			case IDC_CHECKAUTOSIZECOLUMNS:
				{
					result = ::SendDlgItemMessage(_hSelf, IDC_CHECKAUTOSIZECOLUMNS, BM_GETCHECK, 0, 0);
					EnableWindow(GetDlgItem(_hSelf, IDC_CHECKAUTOSIZEWINDOW), BST_CHECKED == result);
					break;
				}
			case IDOK :
				{
					tstring error = _T("");
					_options->searchFlags = 0;

					result = ::SendDlgItemMessage(_hSelf, IDC_CHECKSTARTONLY, BM_GETCHECK, 0, 0);
					if (BST_CHECKED == result)
						_options->searchFlags |= SEARCHFLAG_STARTONLY;

					result = ::SendDlgItemMessage(_hSelf, IDC_CHECKCASE, BM_GETCHECK, 0, 0);
					if (BST_CHECKED == result)
						_options->searchFlags |= SEARCHFLAG_CASESENSITIVE;

					result = ::SendDlgItemMessage(_hSelf, IDC_CHECKINCLUDEPATH, BM_GETCHECK, 0, 0);
					if (BST_CHECKED == result)
						_options->searchFlags |= SEARCHFLAG_INCLUDEPATH;

					result = ::SendDlgItemMessage(_hSelf, IDC_CHECKINCLUDEFILENAME, BM_GETCHECK, 0, 0);
					if (BST_CHECKED == result)
						_options->searchFlags |= SEARCHFLAG_INCLUDEFILENAME;

					result = ::SendDlgItemMessage(_hSelf, IDC_CHECKINCLUDEINDEX, BM_GETCHECK, 0, 0);
					if (BST_CHECKED == result)
						_options->searchFlags |= SEARCHFLAG_INCLUDEINDEX;

					result = ::SendDlgItemMessage(_hSelf, IDC_CHECKINCLUDEVIEW, BM_GETCHECK, 0, 0);
					if (BST_CHECKED == result)
						_options->searchFlags |= SEARCHFLAG_INCLUDEVIEW;

					_options->hasConfiguredContext = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKCONFIGURESEARCHCONTEXT, BM_GETCHECK, 0, 0));

					if(
						(
							!_options->hasConfiguredContext
							&& !(_options->searchFlags & SEARCHFLAG_INCLUDEPATH)
							&& !(_options->searchFlags & SEARCHFLAG_INCLUDEFILENAME)
							&& !(_options->searchFlags & SEARCHFLAG_INCLUDEINDEX)
							&& !(_options->searchFlags & SEARCHFLAG_INCLUDEVIEW)
						)
						|| (
							_options->hasConfiguredContext
							&& !(_options->searchFlags & SEARCHFLAG_INCLUDEPATH)
							&& !(_options->searchFlags & SEARCHFLAG_INCLUDEFILENAME)
						)
					){
						tstring tmpMsg = _T("- Must select at least one item to include in your search");
						error.length() > 0
							? error.append(_T("\r\n")).append(tmpMsg)
							: error.append(tmpMsg);
					}

					_options->disabledSelectedSortOrder = NONE;
					if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_RADIOSORTREMEMBER, BM_GETCHECK, 0, 0))
					{
						if (IsWindowEnabled(GetDlgItem(_hSelf, IDC_RADIOSORTREMEMBER)))
							_options->defaultSortOrder = ALWAYSREMEMBER;
						else
							_options->disabledSelectedSortOrder = ALWAYSREMEMBER;
					}

					_options->reversedSortOrder = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKSORTDESCENDING, BM_GETCHECK, 0, 0));
					_options->resetSortOrder = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKRESETSORTORDER, BM_GETCHECK, 0, 0));

					if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_RADIOSORTFILENAME, BM_GETCHECK, 0, 0))
					{
						if (IsWindowEnabled(GetDlgItem(_hSelf, IDC_RADIOSORTFILENAME)))
						{
							_options->activeSortOrder = FILENAME;
							_options->defaultSortOrder = FILENAME;
						}
						else
							_options->disabledSelectedSortOrder = FILENAME;
					}

					if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_RADIOSORTPATH, BM_GETCHECK, 0, 0))
					{
						if (IsWindowEnabled(GetDlgItem(_hSelf, IDC_RADIOSORTPATH)))
						{
							_options->activeSortOrder = PATH;
							_options->defaultSortOrder = PATH;
						}
						else
							_options->disabledSelectedSortOrder = PATH;
					}

					if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_RADIOSORTINDEX, BM_GETCHECK, 0, 0))
					{
						if (IsWindowEnabled(GetDlgItem(_hSelf, IDC_RADIOSORTINDEX)))
						{
							_options->activeSortOrder = INDEX;
							_options->defaultSortOrder = INDEX;
						}
						else
							_options->disabledSelectedSortOrder = INDEX;
					}

					_options->overrideSortWhenTabbing = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKOVERRIDESORTWHENTABBING, BM_GETCHECK, 0, 0));

					_options->revertSortWhenTabbing = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKREVERTSORTORDERDURINGTABBING, BM_GETCHECK, 0, 0));

					_options->onlyUseCurrentView = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKONLYCURRENTVIEW, BM_GETCHECK, 0, 0));

					_options->autoSizeColumns = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKAUTOSIZECOLUMNS, BM_GETCHECK, 0, 0));

					_options->autoSizeWindow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKAUTOSIZEWINDOW, BM_GETCHECK, 0, 0));

					_options->columnForView = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKSEPARATECOLUMNFORVIEW, BM_GETCHECK, 0, 0));

					_options->showDialogForCtrlTab = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKDIALOGFORCTRLTAB, BM_GETCHECK, 0, 0));

					_options->useHomeForEdit = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKUSEHOMEFOREDIT, BM_GETCHECK, 0, 0));

					if(BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKWILDCARD, BM_GETCHECK, 0, 0))
						_options->searchFlags |= SEARCHFLAG_INCLUDEWILDCARD;

					if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECKCASE, BM_GETCHECK, 0, 0))
						_options->searchFlags |= SEARCHFLAG_CASESENSITIVE;

					bool isNumber = true;
					TCHAR bufMaxs[20];
					GetDlgItemText(_hSelf, IDC_MAXTRAVERSEFILES, bufMaxs, MAX_PATH);
					tstring tmpMaxs = bufMaxs;
					if(tmpMaxs.length() > 0 && is_number(tmpMaxs))
					{
						_options->maxTraverseFiles = _tstoi(tmpMaxs.c_str());
					}
					else
					{
						tstring tmpMsg = _T("- Maximum files traversed is not a valid number");
						error.length() > 0
							? error.append(_T("\r\n")).append(tmpMsg)
							: error.append(tmpMsg);
						isNumber = false;
					}

					GetDlgItemText(_hSelf, IDC_MAXDISPLAYFILES, bufMaxs, MAX_PATH);
					tmpMaxs = bufMaxs;
					if(tmpMaxs.length() > 0 && is_number(tmpMaxs))
					{
						_options->maxDisplayFiles = _tstoi(tmpMaxs.c_str());
					}
					else
					{
						tstring tmpMsg = _T("- Maximum files displayed is not a valid number");
						error.length() > 0
							? error.append(_T("\r\n")).append(tmpMsg)
							: error.append(tmpMsg);
						isNumber = false;
					}
					if(isNumber && _options->maxTraverseFiles < _options->maxDisplayFiles)
					{
						tstring tmpMsg = _T("- Max traverse files must be more than max display files.");
						error.length() > 0
							? error.append(_T("\r\n")).append(tmpMsg)
							: error.append(tmpMsg);
					}

					TCHAR tmpPath[MAX_PATH];
					result = ::GetDlgItemText(_hSelf, IDC_SEARCHCONTEXTPATH, tmpPath, MAX_PATH);
					tstring tstrPath = tmpPath;
					if(_options->hasConfiguredContext
						&& (tstrPath.length() > 0))
						_options->configuredContextPath = (tstrPath.back() == _T('\\')) ? tstrPath : tstrPath.append(_T("\\"));

					if(_options->hasConfiguredContext
						&& !(_options->ConfiguredContextPathIsValid())
						){
						tstring tmpMsg = _T("- Context path is invalid.  Please provide a valid context path.");
						error.length() > 0
							? error.append(_T("\r\n")).append(tmpMsg)
							: error.append(tmpMsg);
					}

					if(error.length() > 0)
					{
						MessageBox(_hSelf, error.c_str(), _T("Error"), MB_OK);
						return TRUE;
					}

					g_filesNeedToBeReloaded(
						(_tcscmp(contextPathOnInit.c_str(), _options->configuredContextPath.c_str()) != 0)
						|| (!contextConfiguredOnInit && _options->hasConfiguredContext));
					redisplaySwitchDialog();
				}
			case IDCANCEL :
				{
					if (_isModal)
						EndDialog(_hSelf, 0);
					else
						display(FALSE);

					redisplaySwitchDialog();
					return TRUE;
				}
			case IDABORT :
			case IDCLOSE :
				{
					redisplaySwitchDialog();
				}
			default :
				break;
			}
		}
	}
	return FALSE;
}
Exemple #6
0
OptionS *
decodeCML(int argc, char *argv[]) {
  initializeOptions(argv[0]);
  processOptions(argc, argv);
  return (&OptS);
}