コード例 #1
0
ファイル: cache.c プロジェクト: centurysys/libarms
int
arms_restore_state(arms_context_t *res, const char *state, size_t size)
{
	const struct arms_dumped_state *newstate;
	const struct dumped_rsinfo *rsinfo;
	MD5_CTX md5ctx;
	unsigned char digest[16];
	int i;

	/* check size */
	if (size < arms_size_of_state()) {
		return ARMS_ESIZE;
	}

	/* restore res from state array */
	newstate = (const struct arms_dumped_state *)state;
	MD5_Init(&md5ctx);
	MD5_Update(&md5ctx, newstate,
		  sizeof(*newstate) - sizeof(newstate->digest));
	MD5_Final(digest, &md5ctx);
	if (memcmp(digest, newstate->digest, sizeof(digest)) != 0) {
		/* digest is not valid, invalid state */
		return ARMS_EINVAL;
	}
	if (newstate->state_version != ARMS_STATE_VERSION) {
		/* version mismatch, cannot use state data. */
		return ARMS_EINVAL;
	}

	RESTORE(rs_endpoint);
	RESTORE(rs_preshared_key);
	/* acmi (RS list) */
	acmi_reset_server(res->acmi, ACMI_CONFIG_CONFSOL);
	for (i = 0; i < 5; i++) {
		rsinfo = &newstate->rsinfo[i];
		if (rsinfo->url[0] != '\0') {
			acmi_set_url(res->acmi, ACMI_CONFIG_CONFSOL,
				     rsinfo->url, URL_MAX_LEN, i);
			if (rsinfo->cert[0] == '\0')
				continue;
			acmi_set_cert(res->acmi, ACMI_CONFIG_CONFSOL,
				rsinfo->cert, strlen(rsinfo->cert) + 1, i);
		}
	}
	acmi_set_current_server(res->acmi,
				ACMI_CONFIG_CONFSOL, newstate->current_server);
	acmi_set_rmax(res->acmi, ACMI_CONFIG_CONFSOL, newstate->retry_max);
	acmi_set_rint(res->acmi, ACMI_CONFIG_CONFSOL, newstate->retry_int);
	acmi_set_lltimeout(res->acmi, ACMI_CONFIG_CONFSOL, newstate->lltimeout);
	acmi_put_lines(res->acmi, ACMI_CONFIG_CONFSOL,
		       newstate->line_defs, newstate->num_line);
	res->last_line = newstate->last_line;
	res->result = newstate->result;

#if defined(ARMS_DEBUG) && defined (DEBUG_ENABLE)
        acmi_dump(res->acmi);
#endif
	return 0;
}
コード例 #2
0
ファイル: constraints.c プロジェクト: CIBC-Internal/teem
static int
constraintSatIso(pullTask *task, pullPoint *point,
                 double stepMax, unsigned int iterMax,
                 /* output */
                 int *constrFailP) {
  static const char me[]="constraintSatIso";
  double
    step,         /* current step size */
    val, aval,    /* last and current function values */
    hack,         /* how to control re-tries in the context of a single
                     for-loop, instead of a nested do-while loop */
    grad[4], dir[3], len, state[1 + 1 + 3 + 3];
  unsigned int iter = 0;  /* 0: initial probe, 1..iterMax: probes in loop */

  PROBE(val, aval, grad);
  SAVE(state, aval, val, grad, point->pos);
  hack = 1;
  for (iter=1; iter<=iterMax; iter++) {
    /* consider? http://en.wikipedia.org/wiki/Halley%27s_method */
    NORMALIZE(dir, grad, len);
    if (!len) {
      /* no gradient; back off */
      hack *= task->pctx->sysParm.backStepScale;
      RESTORE(aval, val, grad, point->pos, state);
      continue;
    }
    step = -val/len; /* the newton-raphson step */
    step = step > 0 ? AIR_MIN(stepMax, step) : AIR_MAX(-stepMax, step);
    ELL_3V_SCALE_INCR(point->pos, hack*step, dir);
    _pullPointHistAdd(point, pullCondConstraintSatA);
    PROBE(val, aval, grad);
    if (aval <= state[0]) {  /* we're no further from the root */
      if (AIR_ABS(step) < stepMax*task->pctx->sysParm.constraintStepMin) {
        /* we have converged! */
        break;
      }
      SAVE(state, aval, val, grad, point->pos);
      hack = 1;
    } else { /* oops, try again, don't update dir or len, reset val */
      hack *= task->pctx->sysParm.backStepScale;
      RESTORE(aval, val, grad, point->pos, state);
    }
  }
  if (iter > iterMax) {
    *constrFailP = pullConstraintFailIterMaxed;
  } else {
    *constrFailP = AIR_FALSE;
  }
  return 0;
}
コード例 #3
0
ファイル: reg.c プロジェクト: BobbWu/PRoot
/**
 * Copy the cached values of all @tracee's general purpose registers
 * back to the process, if necessary.  This function returns -errno if
 * an error occured, 0 otherwise.
 */
int push_regs(Tracee *tracee)
{
	int status;

	if (tracee->_regs_were_changed) {
		/* At the very end of a syscall, with regard to the
		 * entry, only the result register can be modified by
		 * PRoot.  */
		if (tracee->restore_original_regs) {
			/* Restore the sysarg register only if it is
			 * not the same as the result register.  Note:
			 * it's never the case on x86 architectures,
			 * so don't make this check, otherwise it
			 * would introduce useless complexity because
			 * of the multiple ABI support.  */
#if defined(ARCH_X86) || defined(ARCH_X86_64)
#    define		RESTORE(sysarg)	(REG(tracee, CURRENT, sysarg) = REG(tracee, ORIGINAL, sysarg))
#else
#    define	 	RESTORE(sysarg) (void) (reg_offset[SYSARG_RESULT] != reg_offset[sysarg] && \
				(REG(tracee, CURRENT, sysarg) = REG(tracee, ORIGINAL, sysarg)))
#endif

			RESTORE(SYSARG_NUM);
			RESTORE(SYSARG_1);
			RESTORE(SYSARG_2);
			RESTORE(SYSARG_3);
			RESTORE(SYSARG_4);
			RESTORE(SYSARG_5);
			RESTORE(SYSARG_6);
			RESTORE(STACK_POINTER);
		}

#if defined(ARCH_ARM64)
		struct iovec regs;

		regs.iov_base = &tracee->_regs[CURRENT];
		regs.iov_len  = sizeof(tracee->_regs[CURRENT]);

		status = ptrace(PTRACE_SETREGSET, tracee->pid, NT_PRSTATUS, &regs);
#else
#    if defined(ARCH_ARM_EABI)
		/* On ARM, a special ptrace request is required to
		 * change effectively the syscall number during a
		 * ptrace-stop.  */
		word_t current_sysnum = REG(tracee, CURRENT, SYSARG_NUM);
		if (current_sysnum != REG(tracee, ORIGINAL, SYSARG_NUM)) {
			status = ptrace(PTRACE_SET_SYSCALL, tracee->pid, 0, current_sysnum);
			if (status < 0)
				note(tracee, WARNING, SYSTEM, "can't set the syscall number");
		}
#    endif

		status = ptrace(PTRACE_SETREGS, tracee->pid, NULL, &tracee->_regs[CURRENT]);
#endif
		if (status < 0)
			return status;
	}

	return 0;
}
コード例 #4
0
ファイル: ge11.c プロジェクト: glammar/glammar
void Uequal ()
{                               /* equal */
  register AFFIX B = q->a;
  register AFFIX A = (q - 1)->a;
  affix x, y;
  char *csave = c;
  register char *xs = c, *ys;
  q -= 2;
  SAVE (x, A);
  SAVE (y, B);
  if (A == B)
  {
    CONTINUE;
  }
  else
  {
    if ((x.r == nil) && (x.l == nil))
      xs = x.t;
    else
    {
      sprinta (A);
      A->t = xs;
      A->l = nil;
      A->r = nil;
      *c++ = '\0';
    }
    ys = c;
    if ((y.r == nil) && (y.l == nil))
      ys = y.t;
    else
    {
      sprinta (B);
      B->t = ys;
      B->l = nil;
      B->r = nil;
      *c++ = '\0';
    }
    if (afxcmp (xs, ys) == 0)
    {
      CONTINUE;
    }
  }
  c = csave;
  RESTORE (A, x);
  RESTORE (B, y);
  (q + 1)->a = A;
  (q + 2)->a = B;
  (q + 3)->q = Uequal;
  q += 3;
}
コード例 #5
0
int main(int argc, char *argv[])
{

	KAboutData aboutData( "klatin", I18N_NOOP("KLatin"),
	"0.9", description, KAboutData::License_GPL,
	"(C) 2001-2004, George Wright", 0, "http://edu.kde.org/klatin", "*****@*****.**");

	aboutData.addAuthor("George Wright",I18N_NOOP("Author and Maintainer"), "*****@*****.**");
	aboutData.addCredit("Anne-Marie Mahfouf",I18N_NOOP("Bug fixes, documentation"), "*****@*****.**");
	aboutData.addCredit("Neil Stevens",I18N_NOOP("Vocabulary shuffling code"), "*****@*****.**");
	
	aboutData.addCredit("Danny Allen",I18N_NOOP("SVG icon"), "*****@*****.**");
	aboutData.addCredit("Pino Toscano",I18N_NOOP("Bug fixes and code improvement, Italian Vocabulary Data Translation"), "*****@*****.**");
	aboutData.addCredit("Mikolaj Machowski",I18N_NOOP("Polish Vocabulary Data Translation"), "*****@*****.**");

	KCmdLineArgs::init( argc, argv, &aboutData );
	KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

	KApplication a;
	
	KLatin *klatin = new KLatin();
	
	if (a.isRestored()) {
		RESTORE(KLatin);
	} else {
		a.setMainWidget(klatin);
		klatin->show();
	}
	
	return a.exec();
}
コード例 #6
0
int main(int argc, char *argv[])
{

	KAboutData aboutData( "kmouth", I18N_NOOP("KMouth"),
		KMOUTH_VERSION, description, KAboutData::License_GPL,
		"(c) 2002/2003, Gunnar Schmi Dt", 0, "http://www.schmi-dt.de/kmouth/index.en.html", "*****@*****.**");
	aboutData.addAuthor("Gunnar Schmi Dt",0, "*****@*****.**");
	KCmdLineArgs::init( argc, argv, &aboutData );
	KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

	aboutData.addCredit("Olaf Schmidt", I18N_NOOP("Tips, extended phrase books"), 0, 0);
  KApplication app;

  if (app.isRestored())
  {
    RESTORE(KMouthApp);
  }
  else
  {
    KMouthApp *kmouth = new KMouthApp();
    if (!kmouth->configured())
       return 0;

    kmouth->show();

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

		if (args->count())
		{
        kmouth->openDocumentFile(args->url(0));
		}
		args->clear();
  }
  return app.exec();
}
コード例 #7
0
int main(int argc, char **argv)
{
    KAboutData about("proptest", "KoProperty Test", version, description,
                     KAboutData::License_GPL, "(C) 2005 Cedric Pasteur", 0, 0, "*****@*****.**");
    about.addAuthor( "Cedric Pasteur", 0, "*****@*****.**" );
    KCmdLineArgs::init(argc, argv, &about);
    KCmdLineArgs::addCmdLineOptions( options );
    KApplication app;
    Test *mainWin = 0;

    if (app.isRestored())
    {
        RESTORE(Test);
    }
    else
    {
        // no session.. just start up normally
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

        /// @todo do something with the command line args here

        mainWin = new Test();
        app.setMainWidget( mainWin );
        mainWin->show();

        args->clear();
    }

    // mainWin has WDestructiveClose flag by default, so it will delete itself.
    return app.exec();
}
コード例 #8
0
ファイル: main.cpp プロジェクト: serghei/kde3-kdepim
int main(int argc, char **argv)
{
    Akregator::AboutData about;
    KCmdLineArgs::init(argc, argv, &about);
    KCmdLineArgs::addCmdLineOptions(Akregator::akregator_options);
    KUniqueApplication::addCmdLineOptions();

    Akregator::Application app;

    // start knotifyclient if not already started. makes it work for people who doesn't use full kde, according to kmail devels
    KNotifyClient::startDaemon();

    // see if we are starting with session management
    if(app.isRestored())
    {
#undef RESTORE
#define RESTORE(type) { int n = 1;\
    while (KMainWindow::canBeRestored(n)){\
        (new type)->restore(n, false);\
            n++;}}

        RESTORE(Akregator::MainWindow);
    }

    return app.exec();
}
コード例 #9
0
ファイル: main.cpp プロジェクト: KDE/khipu
int main(int argc, char **argv)
{
    KAboutData about("khipu", "gplacs", ki18n(I18N_NOOP("Khipu")), version, ki18n(description),
                     KAboutData::License_GPL, ki18n("(C) 2010-2012, Percy Camilo Triveño Aucahuasi"));

    about.addAuthor(ki18n("Percy Camilo Triveño Aucahuasi"), ki18n("Main developer"), "*****@*****.**");

    about.addCredit(ki18n("Punit Mehta"), ki18n("GSoC-2013 student - Persistance file support. Plot-dictionary support. Worked for application actions, command-line improvements and space filtering. Several bug fixings"), "*****@*****.**");
    about.addCredit(ki18n("Manuel Álvarez Blanco"), ki18n("Thesis mentor - Guide and supervision during project conception. Bibliographical support. Numeric Mathematics and Algorithms support"), "");
    about.addCredit(ki18n("José Ignacio Cuevas Gonzáles"), ki18n("Thesis mentor - Supervision, Product Guide, Product promotion and former Client"), "*****@*****.**");
    about.addCredit(ki18n("Eduardo Fernandini Capurro"), ki18n("Thesis mentor - Supervision, Bibliographical Support, Product Guide and former Client"), "*****@*****.**");
    about.addCredit(ki18n("Jaime Urbina Pereyra"), ki18n("Thesis mentor - Supervision and former Main Project Mentor"), "*****@*****.**");

    about.addCredit(ki18n("Aleix Pol Gonzalez"), ki18n("KAlgebra and Analitza parser author, both vitals for the project"));

    about.addCredit(ki18n("José Fernando Ramos Ramirez"), ki18n("First version of Famous Curves Database. Build former windows installer"), "*****@*****.**");
    about.addCredit(ki18n("Susan Pamela Rios Sarmiento"), ki18n("First version of Famous Curves Database"), "*****@*****.**");

    about.addCredit(ki18n("Edgar Velasquez"), ki18n("2D Improvements"));
    about.addCredit(ki18n("Jose Torres Cardenas"), ki18n("3D Improvements"));
    about.addCredit(ki18n("Elizabeth Portilla Flores"), ki18n("3D Improvements"));
    about.addCredit(ki18n("Paul Murat Landauro Minaya"), ki18n("3D Improvements"));

    KCmdLineArgs::init(argc, argv, &about);

    KCmdLineOptions options;
    options.add("+[URL]", ki18n( "A Khipu-file to open" ));
    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;

    MainWindow *mainWindow = new MainWindow;

    if (app.isSessionRestored()) {
        RESTORE(MainWindow)
    } else {
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        if (args->count() == 0) {
            mainWindow->checkforAutoSavedFile();
            mainWindow->show();
        } else {
            int i = 0;
            bool exit = false;
            for (; i < args->count(); i++) {
                if (i==0) {
                    if(args->arg(0)!="ignoreautosavedfile"){
                        if (!(mainWindow->openFile(args->url(0).path())))
                            exit = true;
                    }
                }
                mainWindow->show();
            }
            if (exit)
                mainWindow->deleteLater(); // can't open a khipu file, so just exit !
        }
        args->clear();
    }
    return app.exec();
}
コード例 #10
0
ファイル: material.c プロジェクト: Tomyao/vpic
material_t *
restore_material( void ) {
  material_t * m;
  RESTORE( m );
  RESTORE_STR( m->name );
  RESTORE_PTR( m->next );
  return m;
}
コード例 #11
0
ファイル: NativeSparc.cpp プロジェクト: Jeffxz/nodeas
 NIns *Assembler::genEpilogue()
 {
     underrunProtect(12);
     RESTORE(G0, G0, G0); //restore
     JMPLI(I7, 8, G0); //ret
     ORI(O0, 0, I0);
     return  _nIns;
 }
コード例 #12
0
static int sa11x0_pm_enter(suspend_state_t state)
{
	unsigned long gpio, sleep_save[SLEEP_SAVE_COUNT];

	gpio = GPLR;

	/* save vital registers */
	SAVE(GPDR);
	SAVE(GAFR);

	SAVE(PPDR);
	SAVE(PPSR);
	SAVE(PPAR);
	SAVE(PSDR);

	SAVE(Ser1SDCR0);

	/* Clear previous reset status */
	RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR;

	/* set resume return address */
	PSPR = virt_to_phys(cpu_resume);

	/* go zzz */
	cpu_suspend(0, sa1100_finish_suspend);

	/*
	 * Ensure not to come back here if it wasn't intended
	 */
	PSPR = 0;

	/*
	 * Ensure interrupt sources are disabled; we will re-init
	 * the interrupt subsystem via the device manager.
	 */
	ICLR = 0;
	ICCR = 1;
	ICMR = 0;

	/* restore registers */
	RESTORE(GPDR);
	RESTORE(GAFR);

	RESTORE(PPDR);
	RESTORE(PPSR);
	RESTORE(PPAR);
	RESTORE(PSDR);

	RESTORE(Ser1SDCR0);

	GPSR = gpio;
	GPCR = ~gpio;

	/*
	 * Clear the peripheral sleep-hold bit.
	 */
	PSSR = PSSR_PH;

	return 0;
}
コード例 #13
0
ファイル: grid_structors.c プロジェクト: Tomyao/vpic
grid_t *
restore_grid( void ) {
  grid_t * g;
  RESTORE( g );
  if( g->range    ) RESTORE_ALIGNED( g->range );
  if( g->neighbor ) RESTORE_ALIGNED( g->neighbor );
  RESTORE_PTR( g->mp );
  return g;
}
コード例 #14
0
ファイル: gfx.c プロジェクト: linehan/barnacle
/**
 * mvwcch -- move the cursor and write a complex character and rendition
 * @win : pointer to a WINDOW
 * @y   : y-coordinate to write at
 * @x   : x-coordinate to write at
 * @wch : pointer to the wchar_t to be written
 * @attr: the desired window attributes
 * @pair: the desired color pair
 */
void mvwcch(WINDOW *win, int y, int x, const wchar_t *wch, attr_t attr, short pair)
{
        SAVEWIN(win);
        wattr_set(win, attr, pair, NULL);
        if (wch && (*wch != L'\0')) {
                mvwaddnwstr(win, y, x, wch, 1);
        }
        RESTORE(win);
}
コード例 #15
0
ファイル: main.cpp プロジェクト: mikolajs/milionaire
int main ( int argc, char **argv ) {
  KAboutData about ( "kmilion", 0, ki18n ( "KMilion" ), version, ki18n ( description ),
                     KAboutData::License_GPL, ki18n ( "(C) 2010 Mikołaj Sochacki" ), KLocalizedString(), 0, "*****@*****.**" );
  about.addAuthor ( ki18n ( "Mikołaj Sochacki" ), KLocalizedString(), "*****@*****.**" );
  KCmdLineArgs::init ( argc, argv, &about );

  KCmdLineOptions options;
  options.add ( "+[URL]", ki18n ( "Document to open" ) );
  KCmdLineArgs::addCmdLineOptions ( options );
  KApplication app;
  
  KMilion *widget = new KMilion;
  const QRect r = app.desktop()->frameGeometry();
  widget->setScreenSize ( r.width(), r.height() );
  KCmdLineArgs *args;
  if ( app.isSessionRestored() ) {
      RESTORE ( KMilion );
    }
  else {
      args = KCmdLineArgs::parsedArgs();
      widget->show();
    }
  args->clear();

  // Tak jest w orginale nie mam pojęcia dlaczego? Szczególnie po co kilka razy show!
  //see if we are starting with session management
//     if (app.isSessionRestored())
//     {
//         RESTORE(KMilion);
//     }
//     else
//     {
//         // no session.. just start up normally
//         KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
//         if (args->count() == 0)
//         {
//             //kmilion *widget = new kmilion;
//             widget->show();
//         }
//         else
//         {
//             int i = 0;
//             for (; i < args->count(); i++)
//             {
//                 //kmilion *widget = new kmilion;
//                 widget->show();
//             }
//         }
//         args->clear();
//     }

  return app.exec();
}
コード例 #16
0
static int sa11x0_pm_enter(suspend_state_t state)
{
	unsigned long gpio, sleep_save[SLEEP_SAVE_COUNT];

	gpio = GPLR;

	
	SAVE(GPDR);
	SAVE(GAFR);

	SAVE(PPDR);
	SAVE(PPSR);
	SAVE(PPAR);
	SAVE(PSDR);

	SAVE(Ser1SDCR0);

	
	RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR;

	
	PSPR = virt_to_phys(sa1100_cpu_resume);

	
	sa1100_cpu_suspend();

	cpu_init();

	
	PSPR = 0;

	
	ICLR = 0;
	ICCR = 1;
	ICMR = 0;

	
	RESTORE(GPDR);
	RESTORE(GAFR);

	RESTORE(PPDR);
	RESTORE(PPSR);
	RESTORE(PPAR);
	RESTORE(PSDR);

	RESTORE(Ser1SDCR0);

	GPSR = gpio;
	GPCR = ~gpio;

	
	PSSR = PSSR_PH;

	return 0;
}
コード例 #17
0
ファイル: main.cpp プロジェクト: serghei/kde3-kdewebdev
int main(int argc, char *argv[])
{

    KAboutData aboutData( "kimagemapeditor", I18N_NOOP("KImageMapEditor"),
                          VERSION, description, KAboutData::License_GPL,
                          "(C) 2001-2008 Jan Schaefer", 0, "http://www.nongnu.org/kimagemap/", "*****@*****.**");
    aboutData.addAuthor("Jan Schaefer",0, "*****@*****.**");
    aboutData.addCredit("Joerg Jaspert",I18N_NOOP("For helping me with the Makefiles, and creating the Debian package"));
    aboutData.addCredit("Aaron Seigo and Michael",I18N_NOOP("For helping me fixing --enable-final mode"));
    aboutData.addCredit("Antonio Crevillen",I18N_NOOP("For the Spanish translation"));
    aboutData.addCredit("Fabrice Mous",I18N_NOOP("For the Dutch translation"));
    aboutData.addCredit("Germain Chazot",I18N_NOOP("For the French translation"));
    KCmdLineArgs::init( argc, argv, &aboutData );
    KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

    KApplication a;
    a.dcopClient()->registerAs(a.name());



    if (a.isRestored())
    {
        RESTORE(KimeShell);
    }
    else
    {
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        if ( args->count() == 0 )
        {
            KimeShell *kimeShell = new KimeShell();
            kimeShell->setStdout(args->isSet("stdout"));
            kimeShell->readConfig();
            kimeShell->show();
            kimeShell->openLastFile();
        }
        else
        {
            int i = 0;
            for (; i < args->count(); i++ )
            {
                KimeShell *kimeShell = new KimeShell();
                kimeShell->setStdout(args->isSet("stdout"));
                kimeShell->readConfig();
                kimeShell->show();
                kimeShell->openFile(args->url(i));
            }
        }
        args->clear();
    }

    return a.exec();
}
コード例 #18
0
ファイル: main.cpp プロジェクト: KDE/kmplayer
extern "C" KDE_EXPORT int kdemain (int argc, char *argv[]) {
    setsid ();

    KAboutData aboutData ("kmplayer", 0, ki18n("KMPlayer"),
            KMPLAYER_VERSION_STRING,
            ki18n ("Media player."),
            KAboutData::License_GPL,
            ki18n ("(c) 2002-2009, Koos Vriezen"),
            KLocalizedString(),
            I18N_NOOP ("http://kmplayer.kde.org"));
    aboutData.addAuthor(ki18n("Koos Vriezen"), ki18n("Maintainer"),"*****@*****.**");
    KCmdLineArgs::init (argc, argv, &aboutData);
    KCmdLineOptions options;
    options.add ("+[File]", ki18n ("file to open"));
    KCmdLineArgs::addCmdLineOptions (options);

    KMPlayer::Ids::init();

    KApplication app;
    QPointer <KMPlayerApp> kmplayer;

    if (app.isSessionRestored ()) {
        RESTORE (KMPlayerApp);
    } else {
        kmplayer = new KMPlayerApp ();
        kmplayer->show();

        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

        KUrl url;
        if (args->count () == 1)
            url = args->url (0);
        if (args->count () > 1)
            for (int i = 0; i < args->count (); i++) {
                KUrl url = args->url (i);
                if (url.url ().indexOf ("://") < 0)
                    url = KUrl (QFileInfo (url.url ()).absoluteFilePath ());
                if (url.isValid ())
                    kmplayer->addUrl (url);
            }
        kmplayer->openDocumentFile (url);
        args->clear ();
    }
    int retvalue = app.exec ();

    delete kmplayer;

    KMPlayer::Ids::reset();

    return retvalue;
}
コード例 #19
0
ファイル: brw_metaops.c プロジェクト: astrofimov/vgallium
static void meta_import_pixel_state(struct intel_context *intel)
{
   struct brw_context *brw = brw_context(&intel->ctx);
   
   RESTORE(brw, Color, _NEW_COLOR);
   RESTORE(brw, Depth, _NEW_DEPTH);
   RESTORE(brw, Fog, _NEW_FOG);
   RESTORE(brw, Scissor, _NEW_SCISSOR);
   RESTORE(brw, Stencil, _NEW_STENCIL);
   RESTORE(brw, Texture, _NEW_TEXTURE);
   RESTORE(brw, FragmentProgram, _NEW_PROGRAM);
}
コード例 #20
0
ファイル: main.cpp プロジェクト: svn2github/rkward-svn-mirror
int main(int argc, char *argv[]) {
	KAboutData aboutData( "rkward", I18N_NOOP ("RKWard"), version, description, KAboutData::License_GPL, "(c) 2002, 2004, 2005, 2006", 0, "http://rkward.sf.net", "*****@*****.**");
	aboutData.addAuthor ("Thomas Friedrichsmeier", I18N_NOOP ("Project leader / main developer"), 0);
	aboutData.addAuthor ("Pierre Ecochard",  I18N_NOOP ("C++ coder since 0.2.9"), 0);
	aboutData.addCredit ("Contributors in alphabetical order", 0, 0);
	aboutData.addCredit ("Philippe Grosjean", I18N_NOOP ("Several helpful comments and discussions"), 0);
	aboutData.addCredit ("Adrien d'Hardemare", I18N_NOOP ("Plugins and patches"), 0);
	aboutData.addCredit ("Yves Jacolin", I18N_NOOP ("New website"), 0);
	aboutData.addCredit ("Prasenjit Kapat", I18N_NOOP ("Several plugins"), 0);
	aboutData.addCredit ("Marco Martin", I18N_NOOP ("A cool icon"), 0);
	aboutData.addCredit ("Daniele Medri", I18N_NOOP ("RKWard logo, many suggestions, help on wording"), 0);
	aboutData.addCredit ("Stefan Roediger", I18N_NOOP ("Many plugins, suggestions, marketing, translations"), 0);
	aboutData.addCredit ("David Sibai", I18N_NOOP ("Several valuable comments, hints and patches"), 0);
	aboutData.addCredit ("Ilias Soumpasis", I18N_NOOP ("Translation, Suggestions, plugins"), 0);
	aboutData.addCredit ("Ralf Tautenhahn", I18N_NOOP ("Many comments, useful suggestions, and bug reports"), 0);
	aboutData.addCredit ("Roland Vollgraf", I18N_NOOP ("Some patches"), 0);
	aboutData.addCredit (I18N_NOOP ("Many more people on [email protected]"), I18N_NOOP ("Sorry, if we forgot to list you. Please contact us to get added"), 0);

	// before initializing the commandline args, remove the ".bin" from "rkward.bin".
	// This is so it prints "Usage rkward..." instead of "Usage rkward.bin...", etc.
	// it seems safest to keep a copy, since the shell still owns argv[0]
	char *argv_zero_copy = argv[0];
	argv[0] = qstrdup (QString (argv_zero_copy).remove (".bin").local8Bit ());
	KCmdLineArgs::init( argc, argv, &aboutData );
	KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
	
	RKWardApplication app;
	if (app.isRestored ()) {
		RESTORE(RKWardMainWindow);	// well, whatever this is supposed to do -> TODO
	} else {
		KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
		RK_Debug_Level = 5 - QString (args->getOption ("debug-level")).toInt ();
		RK_Debug_Flags = QString (args->getOption ("debug-flags")).toInt (0, 2);
		qDebug ("Debug-flags as decimal: %d", RK_Debug_Flags);
		
		KURL *open_url = 0;
		if (args->count ()) {
			open_url = new KURL (args->makeURL (args->arg (0)));
		}
		args->clear();
		
		new RKWardMainWindow(open_url);
	}

	// do it!
	int status = app.exec ();
	// restore old argv[0] so the shell is happy
	argv[0] = argv_zero_copy;
	return status;
}
コード例 #21
0
ファイル: main.cpp プロジェクト: sandeepraju/MovieManager
int main(int argc, char **argv)
{
    KAboutData about("moviemanager", 0, ki18n("MovieManager"), version, ki18n(description),
                     KAboutData::License_GPL, ki18n("(C) 2012 Sandeep Raju P & Sadan Sohan M"), KLocalizedString(), 0, "[email protected]\[email protected]");
    about.addAuthor( ki18n("Sandeep Raju P"), KLocalizedString(), "*****@*****.**" );
    about.addAuthor( ki18n("Sadan Sohan M"), KLocalizedString(), "*****@*****.**" );
    KCmdLineArgs::init(argc, argv, &about);

    KCmdLineOptions options;
    options.add("+[URL]", ki18n( "Document to open" ));
    KCmdLineArgs::addCmdLineOptions(options);
    KApplication app;

    MovieManager *widget = new MovieManager();

    // see if we are starting with session management
    if (app.isSessionRestored())
    {
        RESTORE(MovieManager);
    }
    else
    {
        // no session.. just start up normally
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        if (args->count() == 0)
        {
            //moviemanager *widget = new moviemanager;
            //widget->setMaximumSize(200,200);
            widget->show();
            //mainListScroll->show();
           // widget->mainListScroll->show();

        }
        else
        {
            int i = 0;
            for (; i < args->count(); i++)
            {
                //moviemanager *widget = new moviemanager;
                //widget->setMaximumSize(200,200);
                widget->show();
                //widget->mainListScroll->show();
            }
        }
        args->clear();
    }

    return app.exec();
}
コード例 #22
0
ファイル: main.cpp プロジェクト: BackupTheBerlios/kasablanca
int main(int argc, char **argv)
{
	 KLocale::setMainCatalogue("kasablanca");	

    KAboutData about("kasablanca", I18N_NOOP("kasablanca"), version, description,
                     KAboutData::License_GPL, "(C) 2004 Magnus Kulke", 0, 0,
							"*****@*****.**");
    about.addAuthor( "Magnus Kulke", 0, "*****@*****.**" );
    about.addAuthor( "Big Biff", 0, "*****@*****.**" );
	 about.addCredit( "Stefan Bogner", 0, "*****@*****.**" );
	 about.addCredit( "Christoph Thielecke", 0, "*****@*****.**" );
	about.addCredit( "Richard Stellingwerf", 0, "*****@*****.**" );
    KCmdLineArgs::init(argc, argv, &about);
    KCmdLineArgs::addCmdLineOptions(options);
    KApplication app;

    // register ourselves as a dcop client
    app.dcopClient()->registerAs(app.name(), false);

    // see if we are starting with session management
    if (app.isRestored())
    {
        RESTORE(Kasablanca);
    }
    else
    {
        // no session.. just start up normally
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        if (args->count() == 0)
        {
            Kasablanca *widget = new Kasablanca;
            widget->show();
        }
        else
        {
            int i = 0;
            for (; i < args->count(); i++)
            {
                Kasablanca *widget = new Kasablanca;
                widget->show();
// TODO: Load the ftp url passed on the command line.
//                widget->load(args->url(i));
            }
        }
        args->clear();
    }

    return app.exec();
}
コード例 #23
0
int main(int argc, char **argv)
{
    KAboutData about("ktouch",
                     I18N_NOOP("KTouch"),
                     version,
                     description,
                     KAboutData::License_GPL,
                     "Copyright (C) 2000-2006 by Håvard Frøiland and Andreas Nicolai",
                     0,
                     "http://edu.kde.org/ktouch",
                     "*****@*****.**");
    about.addAuthor( "Andreas Nicolai", I18N_NOOP("Current maintainer and programmer"), "*****@*****.**" );
    about.addAuthor( "Håvard Frøiland", I18N_NOOP("Original author, project admin"), "*****@*****.**" );
    about.addCredit( "David Vignoni", I18N_NOOP("Creator of the SVG icon"), "*****@*****.**");
    about.addCredit( "Anne-Marie Mahfouf", I18N_NOOP("Lots of patches, fixes, updates"), "*****@*****.**");
    about.addCredit( "All the creators of training and keyboard files", 0, 0);
    KCmdLineArgs::init(argc, argv, &about);
    KCmdLineArgs::addCmdLineOptions( options );
    KApplication app;
    KTouch *mainWin = 0;

    if (app.isRestored()) {
        RESTORE(KTouch);
    }
    else
    {
        // no session.. just start up normally
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        // TODO: check the command line for a training file and set this as the new to open training file

        /* TODO: turn splash screen on in release
        KTouchSplash splash;            // create the splash screen
        splash.setHideEnabled( true );  // allow user to click the splash screen away
        splash.show();                  // show it
        QTimer splashTimer;
        splashTimer.connect(&splashTimer, SIGNAL(timeout()), &splash, SLOT(hide()));
        splashTimer.start(2000, true);  // start singleshot timer to hide the splashscreen
        */

        mainWin = new KTouch();
        app.setMainWidget( mainWin );

        mainWin->show();
        args->clear();
    }

    return app.exec();
}
コード例 #24
0
int main(int argc, char **argv)
{
    KAboutData about("weather-desktop", 0,
                     ki18nc("@title", "Weather Desktop"), 			// Title
                     version,										// Version number
                     ki18nc("@title", description),					// Description
                     KAboutData::License_GPL_V3,						// License
                     ki18n("(C) 2013 Michael Spencer"),				// Copyright
                     ki18nc("@info", credits),						// Credits
                     "https://github.com/iBeliever/weather-desktop",	// Home page
                     "*****@*****.**"							// Bugs email address
                    );

    about.addAuthor(ki18nc("@info:credit", "Michael Spencer"),
                    ki18nc("@info:credit", "Maintainer, developer, and designer"),
                    "*****@*****.**", "http://ibeliever.github.io");
    about.addAuthor(ki18nc("@info:credit", "Christopher Spencer"),
                    ki18nc("@info:credit", "Designer"),
                    "*****@*****.**");


    KCmdLineArgs::init(argc, argv, &about);

    KCmdLineOptions options;
    KCmdLineArgs::addCmdLineOptions(options);
    Application app;
    App = &app;

    qDebug() << "Debugging is enabled.";

    // See if we are starting with session management
    if (app.isSessionRestored())
    {
        RESTORE(WeatherDesktop);
    }
    else
    {
        WeatherDesktop *mainWindow = new WeatherDesktop;
        mainWindow->show();

        // For debugging purposes
        //KMessageBox::informationList(mainWindow, "Command line arguments:", KCmdLineArgs::allArguments());
    }

    return app.exec();
}
コード例 #25
0
ファイル: main.cpp プロジェクト: KDE/kdiamond
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    Kdelibs4ConfigMigrator migrate(QStringLiteral("kdiamond"));
    migrate.setConfigFiles(QStringList() << QStringLiteral("kdiamondrc") << QStringLiteral("kdiamond.notifyrc"));
    migrate.setUiFiles(QStringList() << QStringLiteral("kdiamondui.rc"));
    migrate.migrate();

    qsrand(time(0));
    KLocalizedString::setApplicationDomain("kdiamond");
    KAboutData about(QStringLiteral("kdiamond"), i18nc("The application's name", "KDiamond"), QLatin1Literal(version), i18n(description),
                     KAboutLicense::GPL, i18n("(C) 2008-2010 Stefan Majewsky and others"), QStringLiteral("http://games.kde.org/kdiamond"));
    about.addAuthor(i18n("Stefan Majewsky"), i18n("Original author and current maintainer"), QStringLiteral("*****@*****.**"));
    about.addAuthor(i18n("Paul Bunbury"), i18n("Gameplay refinement"), QStringLiteral("*****@*****.**"));
    about.addCredit(i18n("Eugene Trounev"), i18n("Default theme"), QStringLiteral("*****@*****.**"));
    about.addCredit(i18n("Felix Lemke"), i18n("Classic theme"), QStringLiteral("*****@*****.**"));
    about.addCredit(i18n("Jeffrey Kelling"), i18n("Technical consultant"), QStringLiteral("*****@*****.**"));
    QCommandLineParser parser;
    KAboutData::setApplicationData(about);
    KCrash::initialize();
    parser.addVersionOption();
    parser.addHelpOption();
    about.setupCommandLine(&parser);
    parser.process(app);
    about.processCommandLine(&parser);

    app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kdiamond")));

    //resource directory for KNewStuff2 (this call causes the directory to be created; its existence is necessary for the downloader)
    QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1String("/themes/");

    Kg::difficulty()->addStandardLevelRange(
        KgDifficultyLevel::VeryEasy,
        KgDifficultyLevel::VeryHard
    );
    KDBusService service;
    // see if we are starting with session management
    if (app.isSessionRestored()) {
        RESTORE(MainWindow);
    } else {
        MainWindow *window = new MainWindow;
        window->show();
    }
    return app.exec();
}
コード例 #26
0
ファイル: main.cpp プロジェクト: michaelforney/trickle
int main(int argc, char *argv[])
{
    KAboutData about("trickle", 0, ki18n("Trickle"), version, ki18n(description), KAboutData::License_GPL, ki18n("(C) 2007-2009 Michael Forney"), KLocalizedString(), 0, "*****@*****.**");
    about.addAuthor( ki18n("Michael Forney"), KLocalizedString(), "*****@*****.**" );
    KCmdLineArgs::init(argc, argv, &about);
    KApplication app;
    Trickle * trickle = new Trickle();
    if (app.isSessionRestored())
    {
        RESTORE(Trickle);
    }
    else
    {
        trickle->show();
    }
    app.exec();
    return 0;
}
コード例 #27
0
ファイル: main.cpp プロジェクト: KDE/ksirk
int main(int argc, char *argv[])
{
    kDebug() << "Hello World!";
    KAboutData aboutData( "ksirk", 0, ki18n("KsirK"),
                          KDE_VERSION_STRING, ki18n(description), KAboutData::License_GPL,
                          ki18n("(c) 2002-2013, Gaël de Chalendar\n"),
                          ki18n("For help and user manual, please see\nthe KsirK web site."));
    aboutData.addAuthor(ki18n("Gael de Chalendar aka Kleag"),KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("Nemanja Hirsl"),ki18n("Current maintainer"), "*****@*****.**");
    aboutData.addAuthor(ki18n("Robin Doer"));
    aboutData.addAuthor(ki18n("Albert Astals Cid"));
    aboutData.addAuthor(ki18n("Michal Golunski (Polish translation)"),KLocalizedString(), "*****@*****.**");
    aboutData.addAuthor(ki18n("French students of the 'IUP ISI 2007-2008':"));
    aboutData.addAuthor(ki18n("&nbsp;&nbsp;Anthony Rey<br/>&nbsp;&nbsp;Benjamin Lucas<br/>&nbsp;&nbsp;Benjamin Moreau<br/>&nbsp;&nbsp;Gaël Clouet<br/>&nbsp;&nbsp;Guillaume Pelouas<br/>&nbsp;&nbsp;Joël Marco<br/>&nbsp;&nbsp;Laurent Dang<br/>&nbsp;&nbsp;Nicolas Linard<br/>&nbsp;&nbsp;Vincent Sac"));
    aboutData.setHomepage("http://games.kde.org/ksirk/");
    KCmdLineArgs::init( argc, argv, &aboutData );

    KCmdLineOptions options;
    options.add("+[File]", ki18n("file to open"));
    KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

    KApplication app;
    KGlobal::locale()->insertCatalog( QLatin1String( "libkdegames" ));

    if (app.isSessionRestored())
    {
        RESTORE(Ksirk::KGameWindow);
    }
    else
    {
        kDebug() << "Creating main window";
        Ksirk::KGameWindow *ksirk = new Ksirk::KGameWindow();
//       connect(app,SIGNAL(lastWindowClosed()),app,SLOT(quit()));
//         app.setMainWidget(ksirk);
        ksirk->show();
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        args->clear();
    }
    kDebug() << "Executing app";
    int res =  app.exec();
    KGlobal::locale()->removeCatalog( "libkdegames" );
    return res;
}
コード例 #28
0
ファイル: main.cpp プロジェクト: nijel/kalcatel
int main(int argc, char *argv[]) {
    KAboutData aboutData( "kalcatel", I18N_NOOP("KAlcatel"),
        VERSION, description, KAboutData::License_GPL,
        "(c) 2002, Michal Cihar",
        I18N_NOOP("This application allows you to manage messages, calls, contacts, todos\n"
        "and calendar in your Alcatel One Touch 50x and 70x mobile.\n\n"
        "Protocol used by this phone is binary and not documented, so this\n"
        "program could not guarantee any functionality in your case, but it works well for me."),
        "http://cihar.liten.cz", "*****@*****.**");
    aboutData.addAuthor("Michal Cihar",0, "*****@*****.**");
    aboutData.addCredit("Alcatel", I18N_NOOP("for NOT publishing specification of protocol\n"
        "Their only answer was:\n"
        "\"Your piece of advice will be helpful enough for us to deliberate\n"
        "and  get the best service for all our customers.\"\n\n"
        "However they probably like this program because they write about it\n"
        "in their news (HTTP Referer can contain many information) and they\n"
        "downloaded few copies of it (from alcatel.de and alcatel.be) ;-)."),
        "*****@*****.**", "http://www.alcatel.com");
    aboutData.addCredit("George Voina", I18N_NOOP("for initial KDE/Qt 3 porting"),
        "*****@*****.**", "http://www.esat.kuleuven.ac.be/~gvoina");
    KCmdLineArgs::init( argc, argv, &aboutData );
    KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

    KApplication app;
 
    if (app.isRestored()) {
        RESTORE(KAlcatelApp);
    } else {
        KAlcatelApp *kalcatel = new KAlcatelApp();
        kalcatel->show();

        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

        if (args->count()) {
            kalcatel->openDocumentFile(args->arg(0));
        } else {
//            kalcatel->openDocumentFile();
        }
        args->clear();
    }

    return app.exec();
}  
コード例 #29
0
ファイル: main.cpp プロジェクト: serghei/kde3-kdewebdev
int main(int argc, char *argv[])
{
    KAboutData about("kfilereplace", I18N_NOOP("KFileReplace"), version, description,
                     KAboutData::License_GPL_V2, "(C) 2004-2005 Andras Mantia\n(C) 2004-2005 Emiliano Gulmini\n(C) 1999-2002 Francois Dupoux", I18N_NOOP("Part of the KDEWebDev module."),
                     "http://www.kdewebdev.org");

    about.addAuthor("Andras Mantia", I18N_NOOP("Shell author, KPart creator, co-maintainer"), "*****@*****.**");
    about.addAuthor("Emiliano Gulmini", I18N_NOOP("Current maintainer, code cleaner and rewriter"),"*****@*****.**");
    about.addAuthor("Francois Dupou",
                          I18N_NOOP("Original author of the KFileReplace tool"),
                          "*****@*****.**");

    KCmdLineArgs::init(argc, argv, &about);
    KCmdLineArgs::addCmdLineOptions( options );

    KApplication app;

    // see if we are starting with session management
    if (app.isRestored())
    {
        RESTORE(KFileReplace);
    }
    else
    {
        // no session.. just start up normally
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

        KFileReplace *kfr = new KFileReplace;
        kfr->show();

        if (args->count() == 0)
        {
            kfr->openURL(KURL());
        }
        else
        {
            kfr->openURL(args->url(0));
        }
        args->clear();
    }

    return app.exec();
}
コード例 #30
0
ファイル: main.cpp プロジェクト: Flameeyes/atmosphere
int main(int argc, char **argv)
{
	// Initialize net-snmp library
	KSNMP::init("atmosphere");
		
	KAboutData about("atmosphere", I18N_NOOP("ATMOSphere"), version, description,
			KAboutData::License_GPL, "(C) 2004 Flameeyes", 0, 0, "*****@*****.**");
	about.addAuthor( "Flameeyes", 0, "*****@*****.**" );
	KCmdLineArgs::init(argc, argv, &about);
	KCmdLineArgs::addCmdLineOptions( options );
	KApplication app;
	ATMOSphere *mainWin = 0;
	
	try {
		if (app.isRestored())
		{
			RESTORE(ATMOSphere);
		}
		else
		{
			// no session.. just start up normally
			KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
		
			/// @todo do something with the command line args here
		
			mainWin = new ATMOSphere();
			app.setMainWidget( mainWin );
			mainWin->show();
		
			args->clear();
		}
	} catch( ATMOS::Exception &e ) {
		KMessageBox::error(0, e.message(), "Unhandled exception!", KMessageBox::Dangerous);
	}
	
	// mainWin has WDestructiveClose flag by default, so it will delete itself.
	int ret = app.exec();
	
	// Deinitialize net-snmp library
	KSNMP::shutdown();
	
	return ret;
}