当前位置: 首页>>代码示例>>C++>>正文


C++ RESTORE函数代码示例

本文整理汇总了C++中RESTORE函数的典型用法代码示例。如果您正苦于以下问题:C++ RESTORE函数的具体用法?C++ RESTORE怎么用?C++ RESTORE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RESTORE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: arms_restore_state

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;
}
开发者ID:centurysys,项目名称:libarms,代码行数:59,代码来源:cache.c

示例2: constraintSatIso

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;
}
开发者ID:CIBC-Internal,项目名称:teem,代码行数:50,代码来源:constraints.c

示例3: push_regs

/**
 * 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;
}
开发者ID:BobbWu,项目名称:PRoot,代码行数:65,代码来源:reg.c

示例4: Uequal

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;
}
开发者ID:glammar,项目名称:glammar,代码行数:50,代码来源:ge11.c

示例5: main

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();
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:26,代码来源:main.cpp

示例6: main

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"), "[email protected]");

    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"), "[email protected]");
    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"), "[email protected]");
    about.addCredit(ki18n("Eduardo Fernandini Capurro"), ki18n("Thesis mentor - Supervision, Bibliographical Support, Product Guide and former Client"), "[email protected]");
    about.addCredit(ki18n("Jaime Urbina Pereyra"), ki18n("Thesis mentor - Supervision and former Main Project Mentor"), "[email protected]");

    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"), "[email protected]");
    about.addCredit(ki18n("Susan Pamela Rios Sarmiento"), ki18n("First version of Famous Curves Database"), "[email protected]");

    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();
}
开发者ID:KDE,项目名称:khipu,代码行数:59,代码来源:main.cpp

示例7: restore_material

material_t *
restore_material( void ) {
  material_t * m;
  RESTORE( m );
  RESTORE_STR( m->name );
  RESTORE_PTR( m->next );
  return m;
}
开发者ID:Tomyao,项目名称:vpic,代码行数:8,代码来源:material.c

示例8: underrunProtect

 NIns *Assembler::genEpilogue()
 {
     underrunProtect(12);
     RESTORE(G0, G0, G0); //restore
     JMPLI(I7, 8, G0); //ret
     ORI(O0, 0, I0);
     return  _nIns;
 }
开发者ID:Jeffxz,项目名称:nodeas,代码行数:8,代码来源:NativeSparc.cpp

示例9: sa11x0_pm_enter

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;
}
开发者ID:Jackeagle,项目名称:android_kernel_sony_c2305,代码行数:60,代码来源:pm.c

示例10: restore_grid

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;
}
开发者ID:Tomyao,项目名称:vpic,代码行数:9,代码来源:grid_structors.c

示例11: mvwcch

/**
 * 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);
}
开发者ID:linehan,项目名称:barnacle,代码行数:18,代码来源:gfx.c

示例12: main

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, "[email protected]" );
  about.addAuthor ( ki18n ( "Mikołaj Sochacki" ), KLocalizedString(), "[email protected]" );
  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();
}
开发者ID:mikolajs,项目名称:milionaire,代码行数:53,代码来源:main.cpp

示例13: main

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/", "[email protected]");
    aboutData.addAuthor("Jan Schaefer",0, "[email protected]");
    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();
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:52,代码来源:main.cpp

示例14: kdemain

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"),"[email protected]");
    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;
}
开发者ID:KDE,项目名称:kmplayer,代码行数:51,代码来源:main.cpp

示例15: meta_import_pixel_state

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);
}
开发者ID:astrofimov,项目名称:vgallium,代码行数:12,代码来源:brw_metaops.c


注:本文中的RESTORE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。