Beispiel #1
0
void MainWindow::openImage(const QString& imageFilename) {
    if (imageFilename.length() > 0) {
        YaffsReadInfo readInfo = mYaffsModel->openImage(imageFilename);
        if (readInfo.result) {
            QModelIndex rootIndex = mYaffsModel->index(0, 0);
            mUi->treeView->expand(rootIndex);
            mUi->statusBar->showMessage("Opened image: " + imageFilename);

            updateWindowTitle();
            QString summary("<table>" \
                            "<tr><td width=120>Files:</td><td>" + QString::number(readInfo.numFiles) + "</td></tr>" +
                            "<tr><td width=120>Directories:</td><td>" + QString::number(readInfo.numDirs) + "</td></tr>" +
                            "<tr><td width=120>SymLinks:</td><td>" + QString::number(readInfo.numSymLinks) + "</td></tr>" +
                            "<tr><td colspan=2><hr/></td></tr>" +
                            "<tr><td width=120>HardLinks:</td><td>" + QString::number(readInfo.numHardLinks) + "</td></tr>" +
                            "<tr><td width=120>Specials:</td><td>" + QString::number(readInfo.numSpecials) + "</td></tr>" +
                            "<tr><td width=120>Unknowns:</td><td>" + QString::number(readInfo.numUnknowns) + "</td></tr>" +
                            "<tr><td colspan=2><hr/></td></tr>" +
                            "<tr><td width=120>Errors:</td><td>" + QString::number(readInfo.numErrorousObjects) + "</td></tr></table>");

            if (readInfo.eofHasIncompletePage) {
                summary += "<br/><br/>Warning:<br/>Incomplete page found at end of file";
            }
            QMessageBox::information(this, "Summary", summary);
        } else {
            QString msg = "Error opening image: " + imageFilename;
            mUi->statusBar->showMessage(msg);
            QMessageBox::critical(this, "Error", msg);
        }
        setupActions();
    }
}
Beispiel #2
0
/* ARGSUSED */
void
terminate(int sig)
{

	summary();
	_exit(sig == 0 ? 0 : 1);
}
Beispiel #3
0
inline void loadDeck( const char * deck_file) {
    Opm::ParseContext parseContext;
    Opm::Parser parser;

    auto deck = parser.parseFile(deck_file, parseContext);
    Opm::EclipseState state( deck, parseContext );
    Opm::Schedule schedule( deck, state.getInputGrid(), state.get3DProperties(), state.runspec().phases(), parseContext);
    Opm::SummaryConfig summary( deck, schedule, state.getTableManager( ), parseContext );
    {
        std::stringstream ss;

        ss << deck;
        auto deck2 = parser.parseString(ss.str(), parseContext);
        if (deck.size() != deck2.size()) {
            std::cerr << "Deck size mismatch original:" << deck.size() << " new: " << deck2.size( ) << std::endl;
            std::exit( 1 );
        }

        for (size_t index=0; index < deck.size(); index++) {
            const auto& kw1 = deck.getKeyword( index );
            const auto& kw2 = deck2.getKeyword( index );

            if (!kw1.equal( kw2 , true , true)) {
                std::cerr << "Keyword " << index << " different " << kw1.name() << " " << kw2.name() << std::endl;
                std::cerr << kw1 << std::endl;
                std::cerr << std::endl << "-----------------------------------------------------------------" << std::endl;
                std::cerr << kw2 << std::endl;
                std::exit( 1 );
            }
        }
    }
}
Beispiel #4
0
/* ARGSUSED */
void
terminate(int signo)
{
	summary();
	/* (void)raise_default_signal(signo); */
	/* _ */exit(127);
}
Beispiel #5
0
void
IntervalSummaryWindow::intervalHover(IntervalItem* x)
{
    // if we're not visible don't bother
    if (!isVisible()) return;

    // we already have summaries!
    if (x && x->rideItem()->intervalsSelected().count()) return;

    // its to clear, but if the current ride has selected intervals then we will ignore it
    RideItem *rideItem = const_cast<RideItem*>(context->currentRideItem());
    if (!x && rideItem && rideItem->intervalsSelected().count()) return;

    QString html = GCColor::css();
    html += "<body>";

    if (x == NULL) {
    	html += "<i>" + tr("select an interval for summary info") + "</i>";
    } else {
        html += summary(x);
    }
    html += "</body>";
    setHtml(html);
    return;
}
Beispiel #6
0
int main(){
	test_t *test = tests;
	for(; *test; test++)
		(*test)();
	summary();
	return 0;
}
Beispiel #7
0
Datei: y1.c Projekt: pkgw/iraf
int
main (int argc, char *argv[])
{
    (void) setlocale (LC_ALL, "");
#if !defined(TEXT_DOMAIN)	/* Should be defined by cc -D */
#define	TEXT_DOMAIN "SYS_TEST"	/* Use this only if it weren't */
#endif
    /*
       (void) textdomain (TEXT_DOMAIN);
     */

    setup (argc, argv);		/* initialize and read productions */
    TBITSET = NWORDS (ntoksz * LKFACTOR);
    tbitset = NWORDS (ntokens * LKFACTOR);
    mktbls ();
    cpres ();			/* make table of which productions yield a */
    /* given nonterminal */
    cempty ();			/* make a table of which nonterminals can match */
    /* the empty string */
    cpfir ();			/* make a table of firsts of nonterminals */
    stagen ();			/* generate the states  */
    output ();			/* write the states and the tables */
    go2out ();
    hideprod ();
    summary ();
    callopt ();
    others ();
    return (0);
}
Beispiel #8
0
void MainWindow::on_actionSaveAs_triggered() {
    if (mYaffsModel->isImageOpen()) {
        QString imgName = mYaffsModel->getImageFilename();
        QString saveAsFilename = QFileDialog::getSaveFileName(this, "Save Image As", "./" + imgName);
        if (saveAsFilename.length() > 0) {
            YaffsSaveInfo saveInfo = mYaffsModel->saveAs(saveAsFilename);
            updateWindowTitle();
            if (saveInfo.result) {
                mUi->statusBar->showMessage("Image saved: " + saveAsFilename);
                QString summary("<table>" \
                                "<tr><td width=120>Files:</td><td>" + QString::number(saveInfo.numFilesSaved) + "</td></tr>" +
                                "<tr><td width=120>Directories:</td><td>" + QString::number(saveInfo.numDirsSaved) + "</td></tr>" +
                                "<tr><td width=120>SymLinks:</td><td>" + QString::number(saveInfo.numSymLinksSaved) + "</td></tr>" +
                                "<tr><td colspan=2><hr/></td></tr>" +
                                "<tr><td width=120>Files Failed:</td><td>" + QString::number(saveInfo.numFilesFailed) + "</td></tr>" +
                                "<tr><td width=120>Directories Failed:</td><td>" + QString::number(saveInfo.numDirsFailed) + "</td></tr>" +
                                "<tr><td width=120>SymLinks Failed:</td><td>" + QString::number(saveInfo.numSymLinksFailed) + "</td></tr></td></tr></table>");
                QMessageBox::information(this, "Save summary", summary);
            } else {
                QString msg = "Error saving image: " + saveAsFilename;
                QMessageBox::critical(this, "Error", msg);
                mUi->statusBar->showMessage(msg);
            }
        }
    }
}
Beispiel #9
0
/* ARGSUSED */
void
terminate(int notused)
{

	summary();
	_exit(0);
}
EquatorialCoordinateGrid::EquatorialCoordinateGrid( SkyComposite *parent )
        : CoordinateGrid( parent, i18n("Equatorial Coordinate Grid" ) )
{
    KStarsData *data = KStarsData::Instance();

    intro();

    double eps    =   0.1;
    double minRa  =   0.0;
    double maxRa  =  23.0;
    double dRa    =   2.0;
    double minDec = -80.0;
    double maxDec =  90.0;
    double dDec   =  20.0;
    double dDec2  =   4.0;
    double dRa2   =   0.2;

    double max, dec, dec2, ra, ra2;

    LineList* lineList;

    for ( ra = minRa; ra < maxRa; ra += dRa ) {
        for ( dec = -90.0; dec < maxDec - eps; dec += dDec ) {
            lineList = new LineList();
            max = dec + dDec;
            if ( max > 90.0 ) max = 90.0;
            for ( dec2 = dec; dec2 <= max + eps; dec2 += dDec2 ) {
                SkyPoint* p = new SkyPoint( ra, dec2 );
                p->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
                lineList->append( p );
            }
            appendLine( lineList );
        }
    }

    for ( dec = minDec; dec < maxDec + eps; dec += dDec ) {
        // Do not paint the line on the equator
        if ( dec < 0.1 && dec > -0.1 )
            continue;
        
        // Adjust point density
        int nPoints = int(round( fabs(cos(dec* dms::PI / 180.0)) * dRa / dRa2 ));
        if ( nPoints < 5 )
            nPoints = 5;
        double dRa3 = dRa / nPoints;

        for ( ra = minRa; ra < maxRa + eps; ra += dRa ) {
            lineList = new LineList();
            for ( ra2 = ra; ra2 <= ra + dRa + eps; ra2 += dRa3 ) {
                SkyPoint* p = new SkyPoint( ra2, dec );
                p->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
                lineList->append( p );
            }
            appendLine( lineList );
        }
    }
    
    summary();
}
Beispiel #11
0
/* ARGSUSED */
void
summaryx(int notused)
{
	int save_errno = errno;

	summary();
	errno = save_errno;
}
Beispiel #12
0
int main(int argc, char const *argv[])
{
   test(petri_module);
   test(dfile_module);
   test(gstor_module);
   test(trax_module);
   return summary();
}
void catch_signal(int sig)
{
    signal(sig, SIG_IGN);
    fprintf(stderr,"%s caught... jumping to summary.\n", util_sigtoa(sig));
    summary(USER_ABORT, Global->count, Global->first, Global->last, 
        Global->print, Global->check
    );
}
Beispiel #14
0
/** \brief Display the inlined help
 */
void	lib_apps_t::display_help(const clineopt_arr_t &clineopt_arr)	throw()
{
    // display a inlined help
    KLOG_STDERR(human_name() << " - " << summary() << "\n");
    KLOG_STDERR(canon_name() << " version " << version() << " - list of possible options:\n" );
    KLOG_STDERR(clineopt_helper_t::help_string(clineopt_arr) );
    KLOG_STDERR(longdesc() << "\n");
}
bool MNotification::publish()
{
    mNotificationEventTypes.append(eventType());
    mNotificationSummaries.append(summary());
    mNotificationBodies.append(body());
    mNotificationImages.append(image());
    return false;
}
Beispiel #16
0
/*
 * Position input/output data streams before starting the copy.  Device type
 * dependent.  Seekable devices use lseek, and the rest position by reading.
 * Seeking past the end of file can cause null blocks to be written to the
 * output.
 */
void
pos_in(void)
{
	size_t bcnt;
	ssize_t nr;
	off_t cnt;
	int warned;

	/* If not a pipe, tape or tty device, try to seek on it. */
	if (!(in.flags & (ISPIPE|ISTAPE)) && !isatty(in.fd)) {
		if (lseek(in.fd, in.offset * in.dbsz, SEEK_CUR) == -1)
			err(1, "%s", in.name);
		return;
	}

	/*
	 * Read the data.  If a pipe, read until satisfy the number of bytes
	 * being skipped.  No differentiation for reading complete and partial
	 * blocks for other devices.
	 */
	for (bcnt = in.dbsz, cnt = in.offset, warned = 0; cnt;) {
		if ((nr = read(in.fd, in.db, bcnt)) > 0) {
			if (in.flags & ISPIPE) {
				if (!(bcnt -= nr)) {
					bcnt = in.dbsz;
					--cnt;
				}
			} else
				--cnt;
			continue;
		}

		if (nr == 0) {
			if (files_cnt > 1) {
				--files_cnt;
				continue;
			}
			errx(1, "skip reached end of input");
		}

		/*
		 * Input error -- either EOF with no more files, or I/O error.
		 * If noerror not set die.  POSIX requires that the warning
		 * message be followed by an I/O display.
		 */
		if (ddflags & C_NOERROR) {
			if (!warned) {
				warn("%s", in.name);
				warned = 1;
				summary();
			}
			continue;
		}
		err(1, "%s", in.name);
	}
}
Beispiel #17
0
/// The thread main function.
void InputChannelSender::operator()()
{
    try {

        connect();
        while (connected_ != compute_hostnames_.size()) {
            poll_cm_events();
        }

        data_source_.proceed();
        time_begin_ = std::chrono::high_resolution_clock::now();

        uint64_t timeslice = 0;
        sync_buffer_positions();
        sync_data_source(true);
        report_status();
        while (timeslice < max_timeslice_number_ && !abort_) {
            if (try_send_timeslice(timeslice)) {
                timeslice++;
            }
            poll_completion();
            data_source_.proceed();
            scheduler_.timer();
        }

        // wait for pending send completions
        while (acked_desc_ < timeslice_size_ * timeslice + start_index_desc_) {
            poll_completion();
            scheduler_.timer();
        }
        sync_data_source(false);

        for (auto& c : conn_) {
            c->finalize(abort_);
        }

        L_(debug) << "[i" << input_index_ << "] "
                  << "SENDER loop done";

        while (!all_done_) {
            poll_completion();
            scheduler_.timer();
        }

        time_end_ = std::chrono::high_resolution_clock::now();

        disconnect();
        while (connected_ != 0) {
            poll_cm_events();
        }

        summary();
    } catch (std::exception& e) {
        L_(error) << "exception in InputChannelSender: " << e.what();
    }
}
Beispiel #18
0
int main() {
    char* c = (char*) 0x003f;
	test_plan(2);

	ok(1);
	ok(c);
	ok(1);

    summary();
}
Beispiel #19
0
int main() {
	struct student* stud = NULL;

	stud = allocate();
	generate(stud);
	output(stud);
	summary(stud);
	deallocate(stud);

	return 0;
}
Beispiel #20
0
void main()
{
	int arr[60] = { 5, 6, 7, 2, 5, 3, 9, 4, 6, 4, 4, 8, 0, 6, 3, 7, 0, 2, 0, 8, 7, 8, 0, 5, 8, 7, 3, 9, 7, 8, 3, 5, 2, 9, 7, 5, 3, 8, 7, 2
		, 7, 4, 7, 2, 5, 3, 8, 7, 5, 6, 4, 7, 6, 1, 6, 5, 7, 7, 7, 6 };

	printf("다음과 같은 0에서 9까지의 정수에서.\n\n");
	printArray(arr);
	printf("********\n  평균\n********\n");
	printf("배열 원소의 수 = %d \n", sizeof(arr) / sizeof(arr[0]));
	printf("배열 원소의 전체 합 = %d \n", summary(arr));
	printf("평균 = %d \n", mean(arr));
	mode(arr);
}
Beispiel #21
0
inline void loadDeck( const char * deck_file) {
    Opm::ParseContext parseContext;
    Opm::ErrorGuard errors;
    Opm::Parser parser;

    std::cout << "Loading deck: " << deck_file << " ..... "; std::cout.flush();
    auto deck = parser.parseFile(deck_file, parseContext, errors);
    std::cout << "parse complete - creating EclipseState .... ";  std::cout.flush();
    Opm::EclipseState state( deck, parseContext, errors );
    Opm::Schedule schedule( deck, state.getInputGrid(), state.get3DProperties(), state.runspec(), parseContext, errors);
    Opm::SummaryConfig summary( deck, schedule, state.getTableManager( ), parseContext, errors );
    std::cout << "complete." << std::endl;
}
Beispiel #22
0
Huffman::Huffman(std::string textIn)
	: inputText(textIn)
{
	createCharFreqMap();
	populateQueue();
	buildTree();
	createCharToBitMap(root, "");
	encodeHuffmanToFile();
	decodeHuffmanFromFile();
	compressHuffmanToFile();
	decompressHuffmanFromFile();
	summary();
}
void KolabObjectTest::preserveUnicode()
{
    KCalCore::Event::Ptr event(new KCalCore::Event());
    QString summary(QString::fromUtf8("€Š�ـأبـ☺"));
    event->setSummary(summary);
    QCOMPARE(event->summary(), summary);
//     std::cout << event->summary().toStdString() << std::endl;
    KMime::Message::Ptr msg = Kolab::KolabObjectWriter::writeEvent(event);
//     kDebug() << msg->encodedContent();
    KCalCore::Event::Ptr readEvent = Kolab::KolabObjectReader(msg).getEvent();
    QVERIFY(readEvent);
//     std::cout << readEvent->summary().toStdString() << std::endl;
    QCOMPARE(readEvent->summary(), summary);
}
Beispiel #24
0
rc_t CC Usage (const Args * args)
{
    const char * progname = def_name;
    const char * fullpath = def_name;
    rc_t rc = 0;

    rc = ArgsProgram (args, &fullpath, &progname);
    if (rc == 0)
    {
        assert (args);
        summary (def_name);
        HelpOptionsStandard ();
    }
    return rc;
}
Beispiel #25
0
int main(){
    struct student* stud = NULL;

    /*call allocate*/
    stud = allocate();
    /*call generate*/
    generate(stud);
    /*call output*/
    output(stud);
    /*call summary*/
    summary(stud);
    /*call deallocate*/
    deallocate(stud);
    return 0;
}
Beispiel #26
0
void error(char *s, ...)
{
   va_list arg_ptr;
   va_start(arg_ptr, s);
   /* write out error comment */

   ++nerrors;
   fprintf( stderr, "\n fatal error: ");
   vfprintf( stderr, s, arg_ptr);
   fprintf( stderr, ", line %d\n", lineno );
   va_end(arg_ptr);
   if( !fatfl ) return;
   summary();
   exit(EX_ERR);
}
/** Comparing the datas with the set values from the ini file.
@param	aCalEntry Pointer to CCalEntry.
@param	aEntryProperties Structure containing the entry properties
*/
void CTestCalInterimApiFetchEntryAndCheckData::CheckDataL(CCalEntry* aCalEntry, const TEntryProperties& aEntryProperties)
	{
	if ( aEntryProperties.iSummary != KNullDesC16() )
		{
		TPtrC	summary(aCalEntry->SummaryL());
		INFO_PRINTF3(KExpectedAndFoundSummary, &aEntryProperties.iSummary, &summary);
		TEST1( summary == aEntryProperties.iSummary, ETrue);
		}
	if ( aEntryProperties.iDescription != KNullDesC16() )
		{
		TPtrC	description(aCalEntry->DescriptionL());
		INFO_PRINTF3(KExpectedAndFoundDescription, &aEntryProperties.iDescription, &description);
		TEST1( description == aEntryProperties.iDescription, ETrue);
		}
	if ( aEntryProperties.iLocation != KNullDesC16() )
		{
		TPtrC	location(aCalEntry->LocationL());
		INFO_PRINTF3(KExpectedAndFoundLocation, &aEntryProperties.iLocation, &location);
		TEST1( location == aEntryProperties.iLocation, ETrue);	
		}
	if(aEntryProperties.iCategories != KNullDesC16() )
		{
		CheckCategoriesL(aCalEntry, aEntryProperties.iCategories);
		}
	if(aEntryProperties.iHasLocalId )
		{
		TCalLocalUid	localId(aCalEntry->LocalUidL());
		INFO_PRINTF3(KExpectedAndFoundLocalId, aEntryProperties.iLocalId, localId);
		TEST1( localId == aEntryProperties.iLocalId, ETrue );
		}
	if(aEntryProperties.iHasPriority )
		{
		TUint	priority(aCalEntry->PriorityL());
		INFO_PRINTF3(KExpectedAndFoundPriority, aEntryProperties.iPriority, priority);
		TEST1( priority == aEntryProperties.iPriority, ETrue );
		}
	if (aEntryProperties.iGeoLat != KNullDesC16() && aEntryProperties.iGeoLong != KNullDesC16())
		{
		CheckGEOPropertyL(aCalEntry, aEntryProperties.iGeoLat, aEntryProperties.iGeoLong);
		}
	if (aEntryProperties.iTrans != KValueIntNotIni)
		{
		TInt trans(aCalEntry->TimeTransparencyL());
		INFO_PRINTF3(KExpectedAndFoundStatus, aEntryProperties.iTrans, trans);
		TEST1( trans == aEntryProperties.iTrans, ETrue);
		}
		
	}
Beispiel #28
0
Datei: sum.c Projekt: clsera/CLab
/**
 * f(n) = 1 + 1/2 + 1/3 + ... + 1/(n - 1) + 1/n
 * f(n) = 1 + 1/2 - 1/3 + ... - 1/(n - 1) + 1/n
 */
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	double sum = 0.0;
	double sign = 1.0;
	for (i = 1; i < n; i++)
	{
		sum += sign / i;	
		sign = -sign;
	}
	printf("f(%d)=%f\n", n, sum);
	summary(1, n);
    return 0;
}
Beispiel #29
0
int main(){
      /* Seed rand() */
    srand( time(NULL) );
    struct student* stud = NULL;

    /*call allocate*/
    stud = allocate();
    /*call generate*/
    generate(stud);
    /*call output*/
    output(stud);
    /*call summary*/
    summary(stud);
    /*call deallocate*/
    deallocate(stud);
    return 0;
}
Beispiel #30
0
void FBReaderNode::drawSummary(ZLPaintContext &context, int vOffset) {
	const std::string text = summary();
	if (text.empty()) {
		return;
	}

	const FBTextStyle &style = FBTextStyle::Instance();
	const int unit = unitSize(context, style);
	const int hOffset = level() * unit * 3 + unit * 2;

	context.setColor(highlighted() ?
		FBOptions::Instance().colorOption(ZLTextStyle::HIGHLIGHTED_TEXT).value() :
		FBOptions::Instance().RegularTextColorOption.value());
	context.setFont(style.fontFamily(), style.fontSize() * 2 / 3, style.bold(), style.italic());

	context.drawString(hOffset, vOffset + 13 * unit / 4, text.data(), text.size(), false);
}