Exemplo n.º 1
0
Arquivo: tkOption.c Projeto: das/tcltk
static void
OptionInit(
    register TkMainInfo *mainPtr)
				/* Top-level information about window that
				 * isn't initialized yet. */
{
    int i;
    Tcl_Interp *interp;
    ThreadSpecificData *tsdPtr =
	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
    Element *defaultMatchPtr = &tsdPtr->defaultMatch;

    /*
     * First, once-only initialization.
     */

    if (tsdPtr->initialized == 0) {
	tsdPtr->initialized = 1;
	tsdPtr->cachedWindow = NULL;
	tsdPtr->numLevels = 5;
	tsdPtr->curLevel = -1;
	tsdPtr->serial = 0;

	tsdPtr->levels = (StackLevel *)
		ckalloc((unsigned) (5*sizeof(StackLevel)));
	for (i = 0; i < NUM_STACKS; i++) {
	    tsdPtr->stacks[i] = NewArray(10);
	    tsdPtr->levels[0].bases[i] = 0;
	}

	defaultMatchPtr->nameUid = NULL;
	defaultMatchPtr->child.valueUid = NULL;
	defaultMatchPtr->priority = -1;
	defaultMatchPtr->flags = 0;
	Tcl_CreateThreadExitHandler(OptionThreadExitProc, NULL);
    }

    /*
     * Then, per-main-window initialization. Create and delete dummy
     * interpreter for message logging.
     */

    mainPtr->optionRootPtr = NewArray(20);
    interp = Tcl_CreateInterp();
    GetDefaultOptions(interp, mainPtr->winPtr);
    Tcl_DeleteInterp(interp);
}
Exemplo n.º 2
0
 std::string OBFunction::GetOptions() const
 {
   if (m_options.empty())
     return GetDefaultOptions();
   return m_options;  
 }
Exemplo n.º 3
0
//Returns false if program should be aborted, true otherwise.
bool SetCommandLineOptions(int argc, char *argv[])
{
	RaspiVoiceOptions opt = GetDefaultOptions();

	//Retrieve command line options:
	int option_index = 0;
	int cmdline_opt;
	while ((cmdline_opt = getopt_long_only(argc, argv, "hdr:c:s:i:o:a:V:pI:vnf:R:e:B:C:b:z:mE:G:L:H:t:x:y:d:F:D:N:Z:T:O:g:AS", long_getopt_options, &option_index)) != -1)
	{
		switch (cmdline_opt)
		{
			case 0:
				break;
			case 'h':
				ShowHelp();
				return false;
			case 'd':
				opt.daemon = true;
				break;
			case 'r':
				opt.rows = atoi(optarg);
				break;
			case 'c':
				opt.columns = atoi(optarg);
				break;
			case 's':
				opt.image_source = atoi(optarg);
				break;
			case 'i':
				opt.input_filename = optarg;
				break;
			case 'o':
				opt.output_filename = optarg;
				break;
			case 'a':
				opt.audio_card = atoi(optarg);
				break;
			case 'V':
				opt.volume = atoi(optarg);
				break;
			case 'p':
				opt.preview = true;
				break;
			case 'I':
				opt.use_bw_test_image = (atoi(optarg) != 0);
				break;
			case 'v':
				opt.verbose = true;
				break;
			case 'f':
				opt.flip = atoi(optarg);
				break;
			case 'n':
				opt.negative_image = true;
				break;
			case 'E':
				opt.edge_detection_opacity = atof(optarg);
				break;
			case 'G':
				opt.edge_detection_threshold = atoi(optarg);
				break;
			case 'L':
				opt.freq_lowest = atof(optarg);
				break;
			case 'H':
				opt.freq_highest = atof(optarg);
				break;
			case 't':
				opt.total_time_s = atof(optarg);
				break;
			case 'x':
				opt.use_exponential = (atoi(optarg) != 0);
				break;
			case 'y':
				opt.use_delay = (atoi(optarg) != 0);
				break;
			case 'F':
				opt.use_fade = (atoi(optarg) != 0);
				break;
			case 'R':
				opt.read_frames = atoi(optarg);
				break;
			case 'e':
				opt.exposure = atoi(optarg);
				break;
			case 'B':
				opt.brightness = atoi(optarg);
				break;
			case 'C':
				opt.contrast = atof(optarg);
				break;
			case 'b':
				opt.blinders = atoi(optarg);
				break;
			case 'z':
				opt.zoom = atof(optarg);
				break;
			case 'm':
				opt.foveal_mapping = true;
				break;
			case 'D':
				opt.use_diffraction = (atoi(optarg) != 0);
				break;
			case 'N':
				opt.use_bspline = (atoi(optarg) != 0);
				break;
			case 'Z':
				opt.sample_freq_Hz = atof(optarg);
				break;
			case 'T':
				opt.threshold = atoi(optarg);
				break;
			case 'O':
				opt.use_stereo = (atoi(optarg) != 0);
				break;
			case 'g':
				opt.grab_keyboard = optarg;
				break;
			case 'A':
				opt.use_rotary_encoder = true;
				break;
			case 'S':
				opt.speak = true;
				break;
			default:
				std::cout << "Type raspivoice --help for available options." << std::endl;
				return false;
		}
	}

	if (optind < argc)
	{
		std::cerr << "Invalid argument: " << argv[optind] << std::endl;
		std::cerr << "Type raspivoice --help for available options." << std::endl;
		return false;
	}

	cmdLineOptions = opt;

	return true;
}