Exemplo n.º 1
0
/*****************************************************************************
 * Initialization
 *****************************************************************************/
AssignHotKey::AssignHotKey(QWidget* parent, const QKeySequence& keySequence)
    : QDialog(parent)
{
    setupUi(this);

#if defined(__APPLE__) || defined(WIN32)
    QString shift(QKeySequence(Qt::Key_Shift).toString(QKeySequence::NativeText));
    QString alt(QKeySequence(Qt::Key_Alt).toString(QKeySequence::NativeText));
    QString meta(QKeySequence(Qt::Key_Meta).toString(QKeySequence::NativeText));
#else
    QString shift("Shift");
    QString alt("Alt");
    QString meta("Meta");
#endif

    QString str("<HTML><HEAD><TITLE></TITLE></HEAD><BODY><CENTER>");
    str += QString("<H1>") + tr("Assign Key") + QString("</H1>");
    str += tr("Hit the key combination that you wish to assign. "
              "You may hit either a single key or a combination "
              "using %1, %2, and %3.").arg(shift).arg(alt).arg(meta);
    str += QString("</CENTER></BODY></HTML>");

    m_infoText->setText(str);
    m_infoText->setFocusPolicy(Qt::NoFocus);
    m_buttonBox->setFocusPolicy(Qt::NoFocus);

    m_previewEdit->setReadOnly(true);
    m_previewEdit->setAlignment(Qt::AlignCenter);

    m_keySequence = QKeySequence(keySequence);
    m_previewEdit->setText(m_keySequence.toString(QKeySequence::NativeText));

    QSettings settings;
    m_autoCloseCheckBox->setChecked(settings.value(SETTINGS_AUTOCLOSE).toBool());
}
Exemplo n.º 2
0
TEST_F(BuildFromXmlUnionAlign, align1_basic) {
    parseMeta(
        "<metalib tagsetversion='1' name='net'  version='10'>"
        "    <union name='S1' version='1' id='33'>"
        "	     <entry name='b1' type='int8'/>"
        "	     <entry name='b2' type='int16'/>"
        "    </union>"
        "    <struct name='S2' version='1' id='34'>"
        "	     <entry name='a1' type='int8'/>"
        "	     <entry name='m_u' type='S1'/>"
        "    </struct>"
        "</metalib>"
        );

    ASSERT_TRUE(t_em_no_error());

    EXPECT_EQ(1, dr_meta_align(meta("S1")));
    EXPECT_EQ((size_t)2, dr_meta_size(meta("S1")));

    EXPECT_EQ(0, entry("S1", "b1")->m_data_start_pos);
    EXPECT_EQ(0, entry("S1", "b2")->m_data_start_pos);

    EXPECT_EQ(1, dr_meta_align(meta("S2")));
    EXPECT_EQ((size_t)3, dr_meta_size(meta("S2")));

    EXPECT_EQ(0, entry("S2", "a1")->m_data_start_pos);
    EXPECT_EQ(1, entry("S2", "m_u")->m_data_start_pos);
}
Exemplo n.º 3
0
// [[Rcpp::export]]
Rcpp::StringVector vcf_meta(std::string x, Rcpp::NumericVector stats) {
  // Read in the meta lines.
  // stats consists of elements ("meta", "header", "variants", "columns");
  
  Rcpp::StringVector meta(stats[0]);
  std::string line;  // String for reading file into
  
  std::ifstream myfile;
  myfile.open (x.c_str(), std::ios::in);

  if (!myfile.is_open()){
    Rcpp::Rcout << "Unable to open file";
  }
  
  // Loop over the file.
  int i = 0;
  while ( i < stats[0] ){
    Rcpp::checkUserInterrupt();
//    Rcout << i << "\n";
    getline (myfile,line);
    meta(i) = line;
    i++;
    
    if( i % nreport == 0){
      Rcpp::Rcout << "\rProcessed meta line: " << i;
    }

  }
  myfile.close();
  Rcpp::Rcout << "\rProcessed meta line: " << i;
  Rcpp::Rcout << "\nMeta lines processed.\n";

  return meta;
}
Exemplo n.º 4
0
Arquivo: menu.c Projeto: stqism/DEMOS
getmenu ()
{
	if (! menu[0].len)
		initmenu ();

	getboxes ();
	VMPutString (LINES-1, 0, "\0011\16      \17 2\16      \17 3\16      \17 4\16      \17 5\16      \17 6\16      \17 7\16      \17 8\16      \17 9\16      \01710\16Quit \17\2");
	for (;;) {
		drawhead (nmenu);
		for (;;) {
			drawmenu (&menu[nmenu]);
			hidecursor ();
			VSync ();
			switch (KeyGet ()) {
			default:
				VBeep ();
				continue;
			case cntrl (']'):          /* redraw screen */
				VRedraw ();
				continue;
			case cntrl ('M'):
				clrmenu (&menu[nmenu]);
				return (1);
			case cntrl ('J'):
				clrmenu (&menu[nmenu]);
				return (2);
			case cntrl ('C'):
			case cntrl ('['):
			case meta ('J'):        /* f0 */
				clrmenu (&menu[nmenu]);
				return (0);
			case meta ('r'):        /* right */
				clrmenu (&menu[nmenu]);
				if (! menu[++nmenu].mname)
					nmenu = 0;
				break;
			case meta ('l'):        /* left */
				clrmenu (&menu[nmenu]);
				if (--nmenu < 0) {
					for (nmenu=0; menu[nmenu].mname; ++nmenu);
					--nmenu;
				}
				break;
			case meta ('u'):        /* up */
				upmenu (&menu[nmenu]);
				continue;
			case meta ('d'):        /* down */
				downmenu (&menu[nmenu]);
				continue;
			}
			break;
		}
	}
}
Exemplo n.º 5
0
void queue::check_timeouts()
{
	struct timeval tv;
	gettimeofday(&tv, NULL);

	// check no more then once in 1 second
	//TODO: make timeout check interval configurable
	if ((tv.tv_sec - m_last_timeout_check_time) < 1) {
		return;
	}
	m_last_timeout_check_time = tv.tv_sec;

	LOG_INFO("checking timeouts: %ld waiting chunks", m_wait_ack.size());

	auto i = m_wait_ack.begin();
	while (i != m_wait_ack.end()) {
		int chunk_id = i->first;
		auto chunk = i->second;

		if (chunk->get_time() > tv.tv_sec) {
			++i;
			continue;
		}

		// Time passed but chunk still is not complete
		// so we must replay unacked items from it.
		LOG_ERROR("chunk %d timed out, returning back to the popping line, current time: %ld, chunk expiration time: %f",
				chunk_id, tv.tv_sec, chunk->get_time());

		// There are two cases when chunk can still be in m_chunks
		// while experiencing a timeout:
		// 1) if it's a single chunk in the queue (and serves both
		//    as a push and a pop/ack target)
		// 2) if iteration of this chunk was preempted by other timed out chunk
		//    and then later this chunk timed out in its turn
		// Timeout requires switch chunk's iteration into the replay mode.

		auto inserted = m_chunks.insert({chunk_id, chunk});
		if (!inserted.second) {
			LOG_INFO("chunk %d is already in popping line", chunk_id);
		} else {
			LOG_INFO("chunk %d inserted back to the popping line anew", chunk_id);
		}
		chunk->reset_iteration();

		auto hold = i;
		++i;
		m_wait_ack.erase(hold);

		// number of popped but still unacked entries
		m_statistics.timeout_count += (chunk->meta().low_mark() - chunk->meta().acked());
	}
}
Exemplo n.º 6
0
void Downloader::notify_local_meta(const Meta::PathRevision& revision, const bitfield_type& bitfield) {
	log_->trace() << log_tag() << BOOST_CURRENT_FUNCTION;
	auto smeta = exchange_group_.fs_dir()->get_meta(revision);
	for(size_t chunk_idx = 0; chunk_idx < smeta.meta().chunks().size(); chunk_idx++) {
		if(bitfield[chunk_idx]) {
			// We have have block, remove from needed
			notify_local_chunk(smeta.meta().chunks().at(chunk_idx).ct_hash);
		} else {
			// We haven't this block, we need to download it
			add_needed_chunk(smeta.meta().chunks().at(chunk_idx).ct_hash);
		}
	}
}
Exemplo n.º 7
0
void docmdreg (int c) {
	switch (c) {
	case meta ('h'):          /* home */
		cmd.homecmd();
		return;
	case meta ('e'):          /* end */
		cmd.endcmd();
		return;
	case meta ('l'):          /* left */
		cmd.leftcmd();
		return;
	case meta ('r'):          /* right */
		cmd.rightcmd();
		return;
	case meta ('u'):          /* up */
		cmd.upcmd();
		return;
	case meta ('d'):          /* down */
		cmd.downcmd();
		return;
	case meta ('n'):          /* next page */
		cmd.nextcmd();
		return;
	case meta ('p'):          /* prev page */
		cmd.prevcmd();
		return;
	}
}
Exemplo n.º 8
0
int
main()
{
    CELL file_cpy = {0};
    WINDOW *mainwin;

    mainwin = initscr();
    start_color();
    setup_colors();
    cbreak();
    noecho();
    keypad(mainwin, TRUE);
    meta(mainwin, TRUE);
    raw();

    leaveok(mainwin, TRUE);
    wbkgd(mainwin, COLOR_PAIR(COLOR_MAIN));
    wattron(mainwin, COLOR_PAIR(COLOR_MAIN));
    werase(mainwin);
    refresh();

    file_cpy.window = mainwin;

    main_dir(&file_cpy);

    wbkgd(mainwin, A_NORMAL);
    werase(mainwin);
    echo();
    nocbreak();
    noraw();
    refresh();
    endwin();
    return TRUE;
}
Exemplo n.º 9
0
 SearchXmlHandler(MusicBrainzDownloader& dlg) : SimpleSaxHandler<SearchXmlHandler>("metadata"), m_dlg(dlg)
 {
     Node& meta (getRoot()); meta.onStart = &SearchXmlHandler::onMetaStart;
         Node& relList (makeNode(meta, "release-list"));
             Node& rel (makeNode(relList, "release")); rel.onStart = &SearchXmlHandler::onRelStart;
                 Node& trackList (makeNode(rel, "track-list")); trackList.onStart = &SearchXmlHandler::onTrackListStart;
 }
Exemplo n.º 10
0
static el_status_t emacs(int c)
{
    el_status_t  s;
    el_keymap_t *kp;

    /* Save point before interpreting input character 'c'. */
    old_point = rl_point;

    if (rl_meta_chars && ISMETA(c)) {
	tty_push(UNMETA(c));
        return meta();
    }

    for (kp = Map; kp->Function; kp++) {
        if (kp->Key == c)
            break;
    }

    if (kp->Function) {
	s = kp->Function();
	if (s == CSdispatch)	/* If Function is inhibited. */
	    s = insert_char(c);
    } else {
	s = insert_char(c);
    }

    if (!el_pushed) {
        /* No pushback means no repeat count; hacky, but true. */
        Repeat = NO_ARG;
    }

    return s;
}
Exemplo n.º 11
0
 int con_init()
 {
   initscr();
   start_color();
   qiflush();
   cbreak();
   if ( !getenv("UNICON_NO_RAW") )
     {
     /* To allow curses app to handle properly ctrl+z, ctrl+c, etc.
        I should not call raw() here, anyway it is known that this
        will cause misinterpretation of some keys (arrows) after
        resuming (SUSP -- ctrl+z)...
        So, unless UNICON_NO_RAW exported and set to any value raw()
        is called as usual.
     */
     raw();
     }
   noecho();
   nonl(); // `return' translation off
   if (!has_colors())
      fprintf(stderr,"Attention: A color terminal may be required to run this application !\n");
   conio_scr=newwin(0,0,0,0);
   keypad(conio_scr,TRUE); // allow function keys (keypad)
   meta(conio_scr,TRUE); // switch to 8 bit terminal return values
   // intrflush(conio_scr,FALSE); //
   idlok(conio_scr,TRUE);      // hardware line ins/del (required?)
   idcok(conio_scr,TRUE);      // hardware char ins/del (required?)
   scrollok(conio_scr,TRUE);   // scroll screen if required (cursor at bottom)
   /* Color initialization */
   for ( __bg=0; __bg<8; __bg++ )
      for ( __fg=0; __fg<8; __fg++ )
         init_pair( CON_PAIR(__fg,__bg), colortab(__fg), colortab(__bg));
   con_ta(7);
   return 0;
 }
Exemplo n.º 12
0
        operator MusicSequence()
        {
            if( utils::LibWide().isLogOn() )
                clog << "=== Parsing SMDL ===\n";
            //Set our iterator
            m_itread = m_itbeg;//m_src.begin();

            //#FIXME: It might have been easier to just check for trk chunks and stop when none are left? We'd save a lot of iteration!!
            m_itEoC  = DSE::FindNextChunk( m_itbeg, m_itend, DSE::eDSEChunks::eoc ); //Our end is either the eoc chunk, or the vector's end

            //Get the headers
            ParseHeader();
            ParseSong();
            DSE::DSE_MetaDataSMDL meta( MakeMeta() );

            //Check version
            if( m_hdr.version == static_cast<uint16_t>(eDSEVersion::V415) )
            {
                //Parse tracks and return
                return std::move( MusicSequence( ParseAllTracks(), std::move(meta) ) );
            }
            else if( m_hdr.version == static_cast<uint16_t>(eDSEVersion::V402) )
            {
                //Parse tracks and return
                return std::move( MusicSequence( ParseAllTracks(), std::move(meta) ) );
            }
            else
            {
#ifdef _DEBUG
                cerr << "SMDL_Parser::operator MusicSequence() : Unsupported DSE version!!";
                assert(false);
#endif
                throw runtime_error( "SMDL_Parser::operator MusicSequence() : Unsupported DSE version!!" );
            }
        }
Exemplo n.º 13
0
void init_ncurses_ui(double graph_limit_in, double hz_in, char use_colors_in)
{
	graph_limit = graph_limit_in;
	hz = hz_in;
	use_colors = use_colors_in;

        initscr();
        start_color();
        keypad(stdscr, TRUE);
        intrflush(stdscr, FALSE);
        noecho();
        refresh();
        nodelay(stdscr, FALSE);
        meta(stdscr, TRUE);     /* enable 8-bit input */
        idlok(stdscr, TRUE);    /* may give a little clunky screenredraw */
        idcok(stdscr, TRUE);    /* may give a little clunky screenredraw */
        leaveok(stdscr, FALSE);

        init_pair(C_WHITE, COLOR_WHITE, COLOR_BLACK);
        init_pair(C_CYAN, COLOR_CYAN, COLOR_BLACK);
        init_pair(C_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
        init_pair(C_BLUE, COLOR_BLUE, COLOR_BLACK);
        init_pair(C_YELLOW, COLOR_YELLOW, COLOR_BLACK);
        init_pair(C_GREEN, COLOR_GREEN, COLOR_BLACK);
        init_pair(C_RED, COLOR_RED, COLOR_BLACK);

	kalman_init(0.0);

        recreate_terminal();
}
Exemplo n.º 14
0
void EMFRecordEditorFrame::OnPrint( wxCommandEvent& event )
{
    wxPrintDialogData printDialogData;
    wxPrinter printer(&printDialogData);

    wxDC *pDC = printer.PrintDialog(this);
    if (pDC && pDC->IsOk())
    {
        m_preview->ReleaseEMF();

        // update temp file
        if (Save(m_tempFile.GetFullPath()))
        {
            wxMetafile meta(m_tempFile.GetFullPath());
            if (meta.IsOk())
            {
                pDC->StartDoc(m_file.GetName());
                pDC->StartPage();
                meta.Play(pDC);
                pDC->EndPage();
                pDC->EndDoc();
            }
        }


        // make the preview get an handle to the temp EMF again
        UpdatePreview();
    }
}
extern "C" void chk_free(void* ptr) {
//  log_message("%s: %s\n", __FILE__, __FUNCTION__);

    if (!ptr) /* ignore free(NULL) */
        return;

    hdr_t* hdr = meta(ptr);

    if (del(hdr) < 0) {
        uintptr_t bt[MAX_BACKTRACE_DEPTH];
        int depth = get_backtrace(bt, MAX_BACKTRACE_DEPTH);
        if (hdr->tag == BACKLOG_TAG) {
            log_message("+++ ALLOCATION %p SIZE %d BYTES MULTIPLY FREED!\n",
                       user(hdr), hdr->size);
            log_message("+++ ALLOCATION %p SIZE %d ALLOCATED HERE:\n",
                       user(hdr), hdr->size);
            log_backtrace(hdr->bt, hdr->bt_depth);
            /* hdr->freed_bt_depth should be nonzero here */
            log_message("+++ ALLOCATION %p SIZE %d FIRST FREED HERE:\n",
                       user(hdr), hdr->size);
            log_backtrace(hdr->freed_bt, hdr->freed_bt_depth);
            log_message("+++ ALLOCATION %p SIZE %d NOW BEING FREED HERE:\n",
                       user(hdr), hdr->size);
            log_backtrace(bt, depth);
        } else {
            log_message("+++ ALLOCATION %p IS CORRUPTED OR NOT ALLOCATED VIA TRACKER!\n",
                       user(hdr));
            log_backtrace(bt, depth);
        }
    } else {
        hdr->freed_bt_depth = get_backtrace(hdr->freed_bt, MAX_BACKTRACE_DEPTH);
        add_to_backlog(hdr);
    }
}
Exemplo n.º 16
0
static void initconio(void)
{
	int x, y;
	initialized = 1;

	initscr();
	start_color();
	nonl();
	raw();
	noecho();
	win = newwin(0,0,0,0);
	keypad(win,TRUE);
	meta(win,TRUE);
	idlok(win,TRUE);
	scrollok(win,TRUE);

	getmaxyx(win, height, width);

	/* Color initialization */

	for (x = 0; x < 8; x++) {
		for (y = 0; y < 8; y++) {
			init_pair((y<<3)+x, x, y);
		}
	}
	settextcolor(WHITE, BLACK);
}
Exemplo n.º 17
0
// loc: path in which that port is, must not end on '/'
// port: only for printing issues
bool port_checker::port_is_enabled(const char* loc, const char* port,
                                   const char* metadata)
{
    Port::MetaContainer meta(metadata);
    const char* enable_port_rel = meta["enabled by"];
    bool rval = true;
    if(enable_port_rel)
    {
        std::string enable_port = "/";
        enable_port += loc;
        enable_port += enable_port_rel;

        const char* collapsed_loc = Ports::collapsePath(&enable_port[0]);
        send_msg(collapsed_loc, 0, nullptr);

        std::vector<rtosc_arg_val_t> args;
        std::vector<char> strbuf;
        if(sender.wait_for_reply(&strbuf, &args, collapsed_loc)) {
            if(args.size() == 1 &&
               (args[0].type == 'T' || args[0].type == 'F')) {
                rval = (args[0].type == 'T');
            }
            else
                m_issues.emplace(issue::enabled_port_bad_reply,
                               "/" + std::string(loc) + port);
        } else
            m_issues.emplace(issue::enabled_port_not_replied,
                           "/" + std::string(loc) + port);
    }
    return rval;
}
Exemplo n.º 18
0
static int curses_init( ) {
	if (videomode.curses) return 0;
	
	// isterm?
	initscr( );
	if (!has_colors( )) {
		endwin( );
		fprintf (stderr, "Your terminal has no color support.\n");
		return 1;
	}

	start_color( );
	clear( );
	curs_set( 0 );
	refresh( );
	leaveok(stdscr, TRUE);
	preparecolor( );
	cbreak( );
	noecho( );

	nodelay(stdscr, TRUE);
	meta(stdscr, TRUE);
	keypad(stdscr, TRUE);

	mousemask(BUTTON1_PRESSED | BUTTON1_RELEASED | REPORT_MOUSE_POSITION | BUTTON_SHIFT | BUTTON_CTRL, NULL);
	mouseinterval(0); //do no click processing, thank you
	
	videomode.curses = 1;

	getmaxyx(stdscr, Term.height, Term.width);

	return 1;
}
Exemplo n.º 19
0
void FilteredImage::setSource(const QString &source)
{
    if(m_source != source)
    {
        m_source = source;

        QImageReader ir(m_source);
        QByteArray format(ir.format());

        m_image = ir.read();

        NemoImageMetadata meta(m_source, format);

        if (meta.orientation() != NemoImageMetadata::TopLeft)
        {
            m_image = rotate(m_image, meta.orientation());
        }

        setImplicitWidth((qreal)m_image.width());
        setImplicitHeight((qreal)m_image.height());

        m_imageChanged = true;
        emit sourceChanged(m_source);
        emit imageChanged(m_image);
    }
}
Exemplo n.º 20
0
void
display_bits_box (void)
{
    Dlg_head *dbits_dlg;
    new_display_codepage = display_codepage;

    application_keypad_mode ();
    dbits_dlg = init_disp_bits_box ();

    run_dlg (dbits_dlg);

    if (dbits_dlg->ret_value == B_ENTER) {
	const char *errmsg;
	display_codepage = new_display_codepage;
	errmsg =
	    init_translation_table (source_codepage, display_codepage);
	if (errmsg)
	    message (1, MSG_ERROR, "%s", errmsg);
#ifndef HAVE_SLANG
	meta (stdscr, display_codepage != 0);
#else
	SLsmg_Display_Eight_Bit = (display_codepage != 0
				   && display_codepage != 1) ? 128 : 160;
#endif
	use_8th_bit_as_meta = !(inpcheck->state & C_BOOL);
    }
    destroy_dlg (dbits_dlg);
    repaint_screen ();
}
Exemplo n.º 21
0
void TLearnContext::OutputMeta() {
    if (Files.MetaFile.empty()) {
        return;
    }

    TOFStream meta(Files.MetaFile);
    meta << "name\t" << OutputOptions.GetName() << Endl;
    meta << "iterCount\t" << Params.BoostingOptions->IterationCount << Endl;

    //output log files path relative to trainDirectory
    meta << "learnErrorLog\t" << FilePathForMeta(OutputOptions.GetLearnErrorFilename(), Files.NamesPrefix) << Endl;
    if (!Files.TestErrorLogFile.empty()) {
        meta << "testErrorLog\t" << FilePathForMeta(OutputOptions.GetTestErrorFilename(), Files.NamesPrefix) << Endl;
    }
    meta << "timeLeft\t" << FilePathForMeta(OutputOptions.GetTimeLeftLogFilename(), Files.NamesPrefix) << Endl;
    auto losses = CreateMetrics(
        Params.LossFunctionDescription,
        Params.MetricOptions,
        EvalMetricDescriptor,
        LearnProgress.ApproxDimension
    );

    for (const auto& loss : losses) {
        EMetricBestValue bestValueType;
        float bestValue;
        loss->GetBestValue(&bestValueType, &bestValue);
        TString bestValueString;
        if (bestValueType == EMetricBestValue::Max) {
            bestValueString = "max";
        } else {
            bestValueString = "min";
        }
        meta << "loss\t" << loss->GetDescription() << "\t" << bestValueString << Endl;
    }
}
Exemplo n.º 22
0
int main(void)
{
	int m, i;

	scanf("%d", &m);
	while (m-- > 0) {
		scanf("%d", &n);

		printf(
			"program sort(input,output);\n"
			"var\n"
			"a"
		);
		for (i = 1; i < n; i++)
			printf(",%c", 'a'+i);
		printf(
			" : integer;\n"
			"begin\n"
			"  readln(a"
		);
		for (i = 1; i < n; i++)
			printf(",%c", 'a'+i);
		printf(");\n");

		meta();

		printf("end.\n");
		if (m != 0)
			printf("\n");
	}

	fflush(stdout);
	return 0;
}
Exemplo n.º 23
0
void TestTest::testScheme() {
    std::shared_ptr<schememetadata> meta( new schememetadata(QString("META_RENKOUGAIYAO")) );
    std::shared_ptr<schememetadata> meta1( new schememetadata(QString("META_FUFUZINV")));
    std::shared_ptr<SchemeBuffer> buffer(new SchemeBuffer);

    SchemePtr test(new Scheme(meta, buffer, "上海农业人口概要_回归分释_多龄_农d11p15_非d11p15_z"));
    SchemePtr test2(new Scheme(meta, buffer, "K:\\demography\\data\\sim\\0926\\上海农业人口概要_回归分释_多龄_农d11p15_非d11p15_z"));
    SchemePtr test3(new Scheme(meta, buffer, "上海农业人口概要_回归分释_多龄_农d11p15_非d11p15_z.txt"));
    SchemePtr test4(new Scheme(meta, buffer, "K:\\demography\\data\\sim\\0926\\上海农业人口概要_回归分释_多龄_农d11p15_非d11p15_z.txt"));

    try {
        qDebug() << "internal " << test->toInternalName();
        dbtest(test,  2014, 12);
        qDebug() << "internal " << test2->toInternalName();
        dbtest(test2,  2014, 12);
        dbtest(test3,  2014, 115);
        dbtest(test4,  2014, 115);
    } catch (const ValueNotExist&e) {
        qDebug() << e.value();
    } catch (const ColNotExist& e) {
        qDebug() << e.value() << e.index();
    } catch (const RecordNotExist& e) {
        qDebug() << "record not exist" << e.name();
    }
}
Exemplo n.º 24
0
void preview(struct playlist list) {
	struct tracknode * node;
	unsigned n = 0;

	if (list.track != NULL)
		node = list.track->next;
	else
	{
		puts("No tracks in queue.");
		return;
	}

	if(node == NULL) {
		puts("No tracks in queue.");
	}
	else {
		puts("Upcoming tracks:");
		while(node != NULL) {
			const char * format;

			format = haskey(& rc, "preview-format")
				? value(& rc, "preview-format")
				: "%a - %t";

			printf("%2d %s\n", n++, meta(format, M_COLORED, & node->track));

			node = node->next;
		}
	}
}
inline void fillBoundingVolumesUsingNodesFromFile(
        MPI_Comm comm, const std::string& sphereFilename, FlaotBoxVector &spheres)
{
    const int spatialDim = 3;
    stk::mesh::MetaData meta(spatialDim);
    stk::mesh::BulkData bulk(meta, comm);

    stk::io::fill_mesh(sphereFilename, bulk);

    stk::mesh::EntityVector nodes;
    stk::mesh::get_selected_entities(meta.locally_owned_part(), bulk.buckets(stk::topology::NODE_RANK), nodes);

    spheres.clear();
    spheres.resize(nodes.size());

    stk::mesh::FieldBase const * coords = meta.coordinate_field();

    for (size_t i=0;i<nodes.size();i++)
    {
        stk::mesh::Entity node = nodes[i];
        double *data = static_cast<double*>(stk::mesh::field_data(*coords, node));

        double x=data[0];
        double y=data[1];
        double z=data[2];

        double radius=1e-5;
        unsigned id = bulk.identifier(node);
        FloatBox box(x-radius, y-radius, z-radius, x+radius, y+radius, z+radius);
        spheres[i] = std::make_pair(box, Ident(id, bulk.parallel_rank()));
    }
}
Exemplo n.º 26
0
SCREEN *_terminfo_new_screen(const char *term_type, FILE *out, FILE *in)
{
	SCREEN *_newscr;
	ggLock(ncurses_lock);
        if ( term_type == NULL ) {
                term_type = getenv("TERM");
                if ( term_type == NULL ) {
                        term_type = "vt100";
                }
        }
	{ char *temp;
		temp = (char *)malloc(sizeof(char) * ( strlen(term_type) + 1 ));
		strcpy(temp, term_type);
		_newscr = newterm(temp, out, in);
		free(temp);
	}
	if ( _newscr == NULL ) {
		ggUnlock(ncurses_lock);
	} else {
		ncurses_screen = _newscr;
		set_term(_newscr);
		start_color();
		cbreak();
		noecho();
		nonl();
		timeout(0);
		meta(stdscr, TRUE);
		keypad(stdscr, TRUE);
	}
	return _newscr;
}
Exemplo n.º 27
0
void set_default_win_opts(WINDOW *win) {
	leaveok(win, FALSE);
	scrollok(win, FALSE);
	meta(win, TRUE);
	keypad(win, TRUE);
	idlok(win, TRUE);
}
Exemplo n.º 28
0
static void append_engine(gchar * dlname)
{
    gchar * can;
    gchar * err;
    (void) dlerror();
    void * hand = dlopen(dlname,RTLD_NOW);
    err = dlerror();
    if (!hand || err)
    {
        g_warning(err);
        if (hand)
            dlclose(hand);
        return;
    }
    can = canonize_name(dlname);
    if (engine_is_unique(can))
    {
        layout_settings_proc lay;
        lay = dlsym(hand,"layout_engine_settings");
        if ((err=dlerror()))
            g_warning(err);
        if (lay)
        {
            get_meta_info_proc meta;
            EngineData * d = malloc(sizeof(EngineData));
            GtkTreeIter i;
            const gchar * format =
                "<b>%s</b> (%s)\n"
                "<i><small>%s</small></i>";
            meta = dlsym(hand,"get_meta_info");
            if ((err=dlerror()))
                g_warning(err);
                d->meta.description=g_strdup("No Description");
                d->meta.version=g_strdup("0.0");
                d->meta.last_compat=g_strdup("0.0");
                d->meta.icon=gtk_widget_render_icon(EngineCombo,GTK_STOCK_MISSING_IMAGE,
                        GTK_ICON_SIZE_LARGE_TOOLBAR,"themeengine");
            if (meta)
                meta(&(d->meta));
            else
                g_warning("Engine %s has no meta info, please update it, using defaults.",dlname);

            d->dlname = dlname;
            d->canname = can;
            d->vbox = gtk_vbox_new(FALSE,2);
            g_object_ref(d->vbox);
            lay(d->vbox);
            EngineList = g_slist_append(EngineList,d);
            gtk_list_store_append(EngineModel,&i);

            gtk_list_store_set(EngineModel,&i,ENGINE_COL_DLNAME,d->dlname,ENGINE_COL_NAME,d->canname,
                    ENGINE_COL_VER,d->meta.version,ENGINE_COL_LAST_COMPAT,d->meta.last_compat,
                    ENGINE_COL_ICON,d->meta.icon,ENGINE_COL_MARKUP,
                    g_markup_printf_escaped(format,d->canname,d->meta.version,d->meta.description),
                    -1);
            //gtk_combo_box_prepend_text(GTK_COMBO_BOX(EngineCombo),d->canname);
        }
    }
    dlclose(hand);
}
Exemplo n.º 29
0
bool AssignTemplate::toolOperations()
{
    if (!loadToDImg())
    {
        return false;
    }

    QString title = settings()["TemplateTitle"].toString();

    DMetadata meta(image().getMetadata());

    if (title == Template::removeTemplateTitle())
    {
        meta.removeMetadataTemplate();
    }
    else if (title.isEmpty())
    {
        // Nothing to do.
    }
    else
    {
        Template t = TemplateManager::defaultManager()->findByTitle(title);
        meta.removeMetadataTemplate();
        meta.setMetadataTemplate(t);
    }

    image().setMetadata(meta.data());

    return (savefromDImg());
}
Exemplo n.º 30
0
	static void AppendAsChildren( const spINode & contextNode, const spINode & parsedNode ) {
		if ( !contextNode )
			NOTIFY_ERROR( IError::kEDParser, kPECInvalidContextNode, "Context Node is invalid", IError::kESOperationFatal, false, false );
		auto contextNodeType = contextNode->GetNodeType();
		if ( contextNodeType != INode::kNTStructure && contextNodeType != INode::kNTArray )
			NOTIFY_ERROR( IError::kEDParser, kPECContextNodeIsNonComposite, "Context Node is non composite", IError::kESOperationFatal,
				true, static_cast< sizet >( contextNodeType ) );
		pICompositeNode compositeContextNode = contextNode->GetInterfacePointer< ICompositeNode >();
		pIMetadata meta( NULL );
		try {
			meta = parsedNode->GetInterfacePointer< IMetadata >();
		} catch ( spcIError err ) {
			meta = NULL;
		}
		if ( meta ) {
			auto it = meta->Iterator();
			while ( it ) {
				auto childNode = it->GetNode();
				it = it->Next();
				childNode = meta->GetIMetadata_I()->RemoveNode( childNode->GetNameSpace(), childNode->GetName() );
				compositeContextNode->AppendNode( childNode );
			}
		} else {
			compositeContextNode->AppendNode( parsedNode );
		}
	}