本文整理汇总了C++中pull函数的典型用法代码示例。如果您正苦于以下问题:C++ pull函数的具体用法?C++ pull怎么用?C++ pull使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pull函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: linkysize
/* extract a =HHHxWWW size from the input stream
*/
static int
linkysize(MMIOT *f, int *heightp, int *widthp)
{
int height=0, width=0;
int c;
*heightp = 0;
*widthp = 0;
if ( (c = eatspace(f)) != '=' )
return (c != EOF);
pull(f); /* eat '=' */
for ( c = pull(f); isdigit(c); c = pull(f))
width = (width * 10) + (c - '0');
if ( c == 'x' ) {
for ( c = pull(f); isdigit(c); c = pull(f))
height = (height*10) + (c - '0');
if ( c != EOF ) {
if ( !isspace(c) ) shift(f, -1);
*heightp = height;
*widthp = width;
return 1;
}
}
return 0;
}
开发者ID:fatinbrain,项目名称:notes2,代码行数:31,代码来源:generate.c
示例2: linkylinky
/*
* process embedded links and images
*/
static int
linkylinky(int image, MMIOT *f)
{
int start = mmiottell(f);
Cstring name;
Footnote key, *ref;
int status = 0;
CREATE(name);
memset(&key, 0, sizeof key);
if ( linkylabel(f, &name) ) {
if ( peek(f,1) == '(' ) {
pull(f);
if ( linkyurl(f, image, &key) )
status = linkyformat(f, name, image, &key);
}
else {
int goodlink, implicit_mark = mmiottell(f);
if ( isspace(peek(f,1)) )
pull(f);
if ( peek(f,1) == '[' ) {
pull(f); /* consume leading '[' */
goodlink = linkylabel(f, &key.tag);
}
else {
/* new markdown implicit name syntax doesn't
* require a second []
*/
mmiotseek(f, implicit_mark);
goodlink = !(f->flags & MKD_1_COMPAT);
}
if ( goodlink ) {
if ( !S(key.tag) ) {
DELETE(key.tag);
T(key.tag) = T(name);
S(key.tag) = S(name);
}
if ( ref = bsearch(&key, T(*f->footnotes), S(*f->footnotes),
sizeof key, (stfu)__mkd_footsort) )
status = linkyformat(f, name, image, ref);
else if ( f->flags & IS_LABEL )
status = linkyformat(f, name, image, &imaget);
}
}
}
DELETE(name);
___mkd_freefootnote(&key);
if ( status == 0 )
mmiotseek(f, start);
return status;
}
开发者ID:panicsteve,项目名称:trunkdesk,代码行数:63,代码来源:generate.c
示例3: linkysize
/* extract a =HHHxWWW size from the input stream
*/
static int
linkysize(MMIOT *f, Footnote *ref)
{
int height=0, width=0;
int whence = mmiottell(f);
int c;
if ( isspace(peek(f,0)) ) {
pull(f); /* eat '=' */
for ( c = pull(f); isdigit(c); c = pull(f))
width = (width * 10) + (c - '0');
if ( c == 'x' ) {
for ( c = pull(f); isdigit(c); c = pull(f))
height = (height*10) + (c - '0');
if ( isspace(c) )
c = eatspace(f);
if ( (c == ')') || ((c == '\'' || c == '"') && linkytitle(f, c, ref)) ) {
ref->height = height;
ref->width = width;
return 1;
}
}
}
mmiotseek(f, whence);
return 0;
}
开发者ID:flipstudio,项目名称:discount,代码行数:32,代码来源:generate.c
示例4: linkytitle
/* extract a )-terminated title from the input stream.
*/
static char*
linkytitle(MMIOT *f, int *sizep)
{
int countq=0, qc, c, size;
char *ret, *lastqc = 0;
eatspace(f);
if ( (qc=pull(f)) != '"' && qc != '\'' && qc != '(' )
return 0;
if ( qc == '(' ) qc = ')';
for ( ret = cursor(f); (c = pull(f)) != EOF; ) {
if ( (c == ')') && countq ) {
size = (lastqc ? lastqc : cursor(f)) - ret;
*sizep = size-1;
return ret;
}
else if ( c == qc ) {
lastqc = cursor(f);
countq++;
}
}
return 0;
}
开发者ID:fatinbrain,项目名称:notes2,代码行数:27,代码来源:generate.c
示例5: ExecIO_Write_From_Queue
static unsigned long ExecIO_Write_From_Queue (
PLL pll) /* Pointer to file linked list item */
{
/* Local function variables */
char * Item; /* Item pulled from the queue */
long items;
/* process request */
if (ExecIO_Options.lRcdCnt == 0) {
return 0;
}
/* start at the proper place in the queue */
while (ExecIO_Options.lStartRcd > 1 && queued() > 0) {
Item = pull();
if (Item != NULL) {
RexxFreeMemory(Item);
}
ExecIO_Options.lStartRcd--;
}
if (ExecIO_Options.lRcdCnt == -1) {
/* process an "*" record count */
items = queued();
while (items > 0) {
Item = pull();
if (Item != NULL) {
fputs(Item, pll -> pFile);
fputs("\n", pll -> pFile);
RexxFreeMemory(Item);
}
else {
goto return_point;
}
items--;
}
}
else {
/* process a specific record count */
while (ExecIO_Options.lRcdCnt > 0) {
if (queued() == 0)
break;
Item = pull();
if (Item != NULL) {
fputs(Item, pll -> pFile);
fputs("\n", pll -> pFile);
RexxFreeMemory(Item);
}
else {
goto return_point;
}
ExecIO_Options.lRcdCnt--;
}
}
return_point:
fflush (pll -> pFile);
/* return with successful return code */
return 0;
}
开发者ID:KlemensEngel,项目名称:oorexxforandroid,代码行数:60,代码来源:hostemu.cpp
示例6: test_add_message
static void
test_add_message (CamelFolder *folder,
gint j)
{
CamelMimeMessage *msg;
gchar *content;
gchar *subject;
GError *error = NULL;
push ("creating message %d\n", j);
msg = test_message_create_simple ();
content = g_strdup_printf ("Test message %08x contents\n\n", j);
test_message_set_content_simple (
(CamelMimePart *) msg, 0, "text/plain",
content, strlen (content));
test_free (content);
subject = g_strdup_printf ("Test message %08x subject", j);
camel_mime_message_set_subject (msg, subject);
pull ();
push ("appending simple message %d", j);
camel_folder_append_message_sync (
folder, msg, NULL, NULL, NULL, &error);
check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
pull ();
check_unref (msg, 1);
}
开发者ID:Pecisk,项目名称:eds-gtasks,代码行数:29,代码来源:test8.c
示例7: linkyurl
/* extract a (-prefixed url from the input stream.
* the label is either of the format `<link>`, where I
* extract until I find a >, or it is of the format
* `text`, where I extract until I reach a ')' or
* whitespace.
*/
static char*
linkyurl(MMIOT *f, int *sizep)
{
int size = 0;
char *ptr;
int c;
if ( (c = eatspace(f)) == EOF )
return 0;
ptr = cursor(f);
if ( c == '<' ) {
pull(f);
ptr++;
if ( (size = parenthetical('<', '>', f)) == EOF )
return 0;
}
else {
for ( ; ((c=pull(f)) != ')') && !isspace(c); size++)
if ( c == EOF ) return 0;
if ( c == ')' )
shift(f, -1);
}
*sizep = size;
return ptr;
}
开发者ID:fatinbrain,项目名称:notes2,代码行数:33,代码来源:generate.c
示例8: CreateASTMetadataHLSL
MetadataList CreateASTMetadataHLSL(TIntermNode *root, const CallDAG &callDag)
{
MetadataList metadataList(callDag.size());
// Compute all the information related to when gradient operations are used.
// We want to know for each function and control flow operation if they have
// a gradient operation in their call graph (shortened to "using a gradient"
// in the rest of the file).
//
// This computation is logically split in three steps:
// 1 - For each function compute if it uses a gradient in its body, ignoring
// calls to other user-defined functions.
// 2 - For each function determine if it uses a gradient in its call graph,
// using the result of step 1 and the CallDAG to know its callees.
// 3 - For each control flow statement of each function, check if it uses a
// gradient in the function's body, or if it calls a user-defined function that
// uses a gradient.
//
// We take advantage of the call graph being a DAG and instead compute 1, 2 and 3
// for leaves first, then going down the tree. This is correct because 1 doesn't
// depend on other functions, and 2 and 3 depend only on callees.
for (size_t i = 0; i < callDag.size(); i++)
{
PullGradient pull(&metadataList, i, callDag);
pull.traverse(callDag.getRecordFromIndex(i).node);
}
// Compute which loops are discontinuous and which function are called in
// these loops. The same way computing gradient usage is a "pull" process,
// computing "bing used in a discont. loop" is a push process. However we also
// need to know what ifs have a discontinuous loop inside so we do the same type
// of callgraph analysis as for the gradient.
// First compute which loops are discontinuous (no specific order) and pull
// the ifs and functions using a discontinuous loop.
for (size_t i = 0; i < callDag.size(); i++)
{
PullComputeDiscontinuousLoops pull(&metadataList, i, callDag);
pull.traverse(callDag.getRecordFromIndex(i).node);
}
// Then push the information to callees, either from the a local discontinuous
// loop or from the caller being called in a discontinuous loop already
for (size_t i = callDag.size(); i-- > 0;)
{
PushDiscontinuousLoops push(&metadataList, i, callDag);
push.traverse(callDag.getRecordFromIndex(i).node);
}
// We create "Lod0" version of functions with the gradient operations replaced
// by non-gradient operations so that the D3D compiler is happier with discont
// loops.
for (auto &metadata : metadataList)
{
metadata.mNeedsLod0 = metadata.mCalledInDiscontinuousLoop && metadata.mUsesGradient;
}
return metadataList;
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:59,代码来源:ASTMetadataHLSL.cpp
示例9: test_folder_not_message
/* check message not present */
void
test_folder_not_message (CamelFolder *folder,
const gchar *uid)
{
CamelMimeMessage *msg;
CamelMessageInfo *info;
GPtrArray *s;
gint i;
gint found;
GError *error = NULL;
push ("uid '%s' is not in folder", uid);
/* first try getting info */
push ("no message info");
info = camel_folder_get_message_info (folder, uid);
check (info == NULL);
pull ();
/* then, getting message */
push ("no message");
msg = camel_folder_get_message_sync (folder, uid, NULL, &error);
check (error != NULL);
check (msg == NULL);
g_clear_error (&error);
pull ();
/* see if it is not in the summary (only once) */
push ("not in summary list");
s = camel_folder_get_summary (folder);
check (s != NULL);
found = 0;
for (i = 0; i < s->len; i++) {
info = s->pdata[i];
if (strcmp (camel_message_info_get_uid (info), uid) == 0)
found++;
}
check (found == 0);
camel_folder_free_summary (folder, s);
pull ();
/* check it is not in the uid list */
push ("not in uid list");
s = camel_folder_get_uids (folder);
check (s != NULL);
found = 0;
for (i = 0; i < s->len; i++) {
if (strcmp (s->pdata[i], uid) == 0)
found++;
}
check (found == 0);
camel_folder_free_uids (folder, s);
pull ();
g_clear_error (&error);
pull ();
}
开发者ID:cwalkatron,项目名称:evolution-data-server,代码行数:59,代码来源:folders.c
示例10: macro9
void macro9(){
int n_toys=10000;
int n_tot_entries=100;
int n_bins=40;
cout << "Performing Pull Experiment with chi2 \n";
pull(n_toys,n_tot_entries,n_bins,true);
cout << "Performing Pull Experiment with Log Likelihood\n";
pull(n_toys,n_tot_entries,n_bins,false);
}
开发者ID:My-Source,项目名称:root,代码行数:9,代码来源:macro9.C
示例11: retr
static void retr(void)
{
UINT8 i=pull();
R.PC.w.l = ((i & 0x0f) << 8) | pull(); /*change_pc(R.PC.w.l);*/
R.irq_executing = I8039_IGNORE_INT;
// R.A11 = R.A11ff; /* NS990113 */
R.PSW = (R.PSW & 0x0f) | (i & 0xf0); /* Stack is already changed by pull */
regPTR = ((M_By) ? 24 : 0);
}
开发者ID:OS2World,项目名称:APP-EMULATION-MAME,代码行数:9,代码来源:i8039.c
示例12: do_command
/*
Виртуальная машина
*/
int do_command(unsigned char cop)
{
double op1, op2; //операнды
char name[SIZENAME];
switch(cop) {
case CNOP:
break;
case CPUSH:
push(get_value());
break;
case CIN:
fscanf(vmin, "%lf", &op1);
push(op1);
break;
case COUT:
fprintf(vmout, "%g", pull());
break;
case CNVAR:
get_name(name);
add_var(name);
break;
case CGVAR:
get_name(name);
push(get_var(name));
break;
case CSVAR:
get_name(name);
set_var(name, pull());
break;
case CADD:
push(pull()+pull());
break;
case CSUB:
op1 = pull();
op2 = pull();
push(op2-op1);
break;
case CMULT:
push(pull()*pull());
break;
case CDIV:
op1 = pull();
op2 = pull();
if (op1==0.0) cerror("divide by zero");
push(op2/op1);
break;
case CHALT:
return 0;
default:
cerror("undefined command");
}
return 1;
}
开发者ID:ivanprosh,项目名称:Lingvo,代码行数:57,代码来源:vm.c
示例13: DoRestoreFrame
inline void DoRestoreFrame(VM32Cpu * cpu) {
unsigned int returnVal;
cpu->pc++;
// Get the return value
returnVal = pull(cpu);
cpu->sp = cpu->fp; // Restore the sp
cpu->fp = pull(cpu); // Restore the fp from there
push(cpu, returnVal); // Now put the returnVal in preparation for a return
}
开发者ID:drudru,项目名称:cel,代码行数:12,代码来源:svm32.c
示例14: moveBackwards
bool SimpleDeadlockDetector::moveBackwards(BoardState& s, int index) {
bool moved = false;
if (pull(MOVE_LEFT, s, index))
moved = true;
if (pull(MOVE_RIGHT, s, index))
moved = true;
if (pull(MOVE_UP, s, index))
moved = true;
if (pull(MOVE_DOWN, s, index))
moved = true;
return moved;
}
开发者ID:LibreGames,项目名称:caveexpress,代码行数:12,代码来源:SimpleDeadlockDetector.cpp
示例15: pull
void PartShop::pull<ComponentDefinition>(std::string uri, Document& doc, bool recursive)
{
pull(uri, doc);
ComponentDefinition& cd = doc.get<ComponentDefinition>(uri);
if (recursive)
{
pull(cd.sequences.get(), doc);
for (auto & c : cd.components)
pull(c.definition.get(), doc);
}
};
开发者ID:kirichoi,项目名称:libSBOL,代码行数:12,代码来源:partshop.cpp
示例16: split
void split(Treap *t, int k, Treap *&a, Treap *&b) {
if(!t) a = b = NULL;
else if(t->val <= k){
a = t;
split(t->r, k, a->r, b);
pull(a);
} else{
b = t;
split(t->l, k, a, b->l);
pull(b);
}
}
开发者ID:alechuang98,项目名称:nWaCodebook,代码行数:12,代码来源:Treap.cpp
示例17: merge
Treap *merge(Treap *a, Treap *b) {
if(!a || !b) return a ? a : b;
if(a->pri > b->pri){
a->r = merge(a->r, b);
pull(a);
return a;
} else{
b->l = merge(a, b->l);
pull(b);
return b;
}
}
开发者ID:alechuang98,项目名称:nWaCodebook,代码行数:12,代码来源:Treap.cpp
示例18: split
void split( Treap *t , int k , Treap*&a , Treap*&b ){
if( !t ){ a = b = NULL; return; }
push( t );
if( Size( t->l ) + 1 <= k ){
a = t;
split( t->r , k - Size( t->l ) - 1 , a->r , b );
pull( a );
}else{
b = t;
split( t->l , k , a , b->l );
pull( b );
}
}
开发者ID:tzupengwang,项目名称:PECaveros,代码行数:13,代码来源:treap_test.cpp
示例19: printf
void FArc::writetojbmp(ImageType *j,int cx,int cy,float scale,ColourType c) {
#ifdef DEBUG
printf("arc rad %f scale %f\n",r,scale);
#endif
bool first=true;
V2d o,i;
if (ab<aa)
ab+=2*pi;
// for (float a=aa-0.001;a<=ab+0.001;a+=diff(ab,aa)/16.1) {
//int sps=32*moddiff(ab,aa,2*pi)/pi;
int sps=16.0*diff(ab,aa)/pi;
for (int k=0;k<=sps;k++) {
float a=pull(aa,(float)k/(float)sps,ab);
V2d no=V2d(cx,cy)+scale*V2d(x+(r+w/2.0)*sin(a),-y-(r+w/2.0)*cos(a));
V2d ni=V2d(cx,cy)+scale*V2d(x+(r-w/2.0)*sin(a),-y-(r-w/2.0)*cos(a));
if (first)
first=false;
else {
j->intertri(o,i,ni,c,c,c);
j->intertri(o,ni,no,c,c,c);
//j->fillquad(o,i,ni,no,c);
}
if (k==0 || k==sps)
j->filledcircle((no+ni)/2.0,w/2.0,c);
o=no;
i=ni;
}
}
开发者ID:10crimes,项目名称:code,代码行数:28,代码来源:jfont.c
示例20: handle
static int handle(struct device *dv)
{
signed short pcm[FRAME * DEVICE_CHANNELS];
int samples;
struct oss *oss = (struct oss*)dv->local;
/* Check input buffer for recording */
if (oss->pe->revents & POLLIN) {
samples = pull(oss->fd, pcm, FRAME);
if (samples == -1)
return -1;
device_submit(dv, pcm, samples);
}
/* Check the output buffer for playback */
if (oss->pe->revents & POLLOUT) {
device_collect(dv, pcm, FRAME);
samples = push(oss->fd, pcm, FRAME);
if (samples == -1)
return -1;
}
return 0;
}
开发者ID:cmeon,项目名称:xwax-1.5-osc,代码行数:26,代码来源:oss.c
注:本文中的pull函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论