Beispiel #1
0
static void
setup_blend_function(NVPtr pNv, PicturePtr pdpict, int alu)
{
	struct nouveau_pushbuf *push = pNv->pushbuf;
	struct pict_op *op = &nv10_pict_op[alu];
	int src_factor = op->src;
	int dst_factor = op->dst;

	if (src_factor == SF(ONE_MINUS_DST_ALPHA) &&
	    !PICT_FORMAT_A(pdpict->format))
		/* ONE_MINUS_DST_ALPHA doesn't always do the right thing for
		 * framebuffers without alpha channel. But it's the same as
		 * ZERO in that case.
		 */
		src_factor = SF(ZERO);

	if (effective_component_alpha(pNv->pmpict)) {
		if (dst_factor == DF(SRC_ALPHA))
			dst_factor = DF(SRC_COLOR);
		else if (dst_factor == DF(ONE_MINUS_SRC_ALPHA))
			dst_factor = DF(ONE_MINUS_SRC_COLOR);
	}

	BEGIN_NV04(push, NV10_3D(BLEND_FUNC_SRC), 2);
	PUSH_DATA (push, src_factor);
	PUSH_DATA (push, dst_factor);
	BEGIN_NV04(push, NV10_3D(BLEND_FUNC_ENABLE), 1);
	PUSH_DATA (push, 1);
}
Beispiel #2
0
static void
setup_blend_function(NVPtr pNv)
{
	struct nouveau_channel *chan = pNv->chan;
	struct nouveau_grobj *celsius = pNv->Nv3D;
	struct pict_op *op = &nv10_pict_op[pNv->alu];
	int src_factor = op->src;
	int dst_factor = op->dst;

	if (src_factor == SF(ONE_MINUS_DST_ALPHA) &&
	    !PICT_FORMAT_A(pNv->pdpict->format))
		/* ONE_MINUS_DST_ALPHA doesn't always do the right thing for
		 * framebuffers without alpha channel. But it's the same as
		 * ZERO in that case.
		 */
		src_factor = SF(ZERO);

	if (effective_component_alpha(pNv->pmpict)) {
		if (dst_factor == DF(SRC_ALPHA))
			dst_factor = DF(SRC_COLOR);
		else if (dst_factor == DF(ONE_MINUS_SRC_ALPHA))
			dst_factor = DF(ONE_MINUS_SRC_COLOR);
	}

	BEGIN_RING(chan, celsius, NV10TCL_BLEND_FUNC_SRC, 2);
	OUT_RING  (chan, src_factor);
	OUT_RING  (chan, dst_factor);
	BEGIN_RING(chan, celsius, NV10TCL_BLEND_FUNC_ENABLE, 1);
	OUT_RING  (chan, 1);
}
Beispiel #3
0
int reiserfs_on_disk_super_in_proc( char *buffer, char **start, off_t offset,
				    int count, int *eof, void *data )
{
	struct super_block *sb;
	struct reiserfs_sb_info *sb_info;
	struct reiserfs_super_block *rs;
	int hash_code;
	int len = 0;
    
	sb = procinfo_prologue( ( kdev_t ) ( long ) data );
	if( sb == NULL )
		return -ENOENT;
	sb_info = &sb->u.reiserfs_sb;
	rs = sb_info -> s_rs;
	hash_code = DFL( s_hash_function_code );

	len += sprintf( &buffer[ len ], 
			"block_count: \t%i\n"
			"free_blocks: \t%i\n"
			"root_block: \t%i\n"
			"blocksize: \t%i\n"
			"oid_maxsize: \t%i\n"
			"oid_cursize: \t%i\n"
			"umount_state: \t%i\n"
			"magic: \t%10.10s\n"
			"fs_state: \t%i\n"
			"hash: \t%s\n"
			"tree_height: \t%i\n"
			"bmap_nr: \t%i\n"
			"version: \t%i\n"
			"reserved_for_journal: \t%i\n"
			"inode_generation: \t%i\n"
			"flags: \t%x[%s]\n",

			DFL( s_block_count ),
			DFL( s_free_blocks ),
			DFL( s_root_block ),
			DF( s_blocksize ),
			DF( s_oid_maxsize ),
			DF( s_oid_cursize ),
			DF( s_umount_state ),
			rs -> s_v1.s_magic,
			DF( s_fs_state ),
			hash_code == TEA_HASH ? "tea" :
			( hash_code == YURA_HASH ) ? "rupasov" :
			( hash_code == R5_HASH ) ? "r5" :
			( hash_code == UNSET_HASH ) ? "unset" : "unknown",
			DF( s_tree_height ),
			DF( s_bmap_nr ),
			DF( s_version ),
			DF( s_reserved_for_journal ),
			DPL( s_inode_generation ),
			DPL( s_flags ),
			(DPL( s_flags ) & reiserfs_attrs_cleared 
			? "attrs_cleared" : "" ));

	procinfo_epilogue( sb );
	return reiserfs_proc_tail( len, buffer, start, offset, count, eof );
}
Beispiel #4
0
void DOOM_THE_LIST()
{
    node* newNode = (node*)malloc(sizeof(node));
    node* aux = (node*)malloc(sizeof(node));

    newNode = head;

    while(newNode->next != NULL)
    {
        newNode=newNode->next;
        DF();
    }
    DF();
}
Beispiel #5
0
static void
NV40_SetupBlend(ScrnInfoPtr pScrn, nv_pict_op_t *blend,
		PictFormatShort dest_format, Bool component_alpha)
{
	NVPtr pNv = NVPTR(pScrn);
	struct nouveau_channel *chan = pNv->chan;
	struct nouveau_grobj *curie = pNv->Nv3D;
	uint32_t sblend, dblend;

	sblend = blend->src_card_op;
	dblend = blend->dst_card_op;

	if (blend->dst_alpha) {
		if (!PICT_FORMAT_A(dest_format)) {
			if (sblend == SF(DST_ALPHA)) {
				sblend = SF(ONE);
			} else if (sblend == SF(ONE_MINUS_DST_ALPHA)) {
				sblend = SF(ZERO);
			}
		} else if (dest_format == PICT_a8) {
			if (sblend == SF(DST_ALPHA)) {
				sblend = SF(DST_COLOR);
			} else if (sblend == SF(ONE_MINUS_DST_ALPHA)) {
				sblend = SF(ONE_MINUS_DST_COLOR);
			}
		}
	}

	if (blend->src_alpha && (component_alpha || dest_format == PICT_a8)) {
		if (dblend == DF(SRC_ALPHA)) {
			dblend = DF(SRC_COLOR);
		} else if (dblend == DF(ONE_MINUS_SRC_ALPHA)) {
			dblend = DF(ONE_MINUS_SRC_COLOR);
		}
	}

	if (sblend == SF(ONE) && dblend == DF(ZERO)) {
		BEGIN_RING(chan, curie, NV40TCL_BLEND_ENABLE, 1);
		OUT_RING  (chan, 0);
	} else {
		BEGIN_RING(chan, curie, NV40TCL_BLEND_ENABLE, 5);
		OUT_RING  (chan, 1);
		OUT_RING  (chan, sblend);
		OUT_RING  (chan, dblend);
		OUT_RING  (chan, 0x00000000);
		OUT_RING  (chan, NV40TCL_BLEND_EQUATION_ALPHA_FUNC_ADD |
			   NV40TCL_BLEND_EQUATION_RGB_FUNC_ADD);
	}
}
Beispiel #6
0
static void
NV40_SetupBlend(ScrnInfoPtr pScrn, nv_pict_op_t *blend,
		PictFormatShort dest_format, Bool component_alpha)
{
	NVPtr pNv = NVPTR(pScrn);
	struct nouveau_pushbuf *push = pNv->pushbuf;
	uint32_t sblend, dblend;

	sblend = blend->src_card_op;
	dblend = blend->dst_card_op;

	if (blend->dst_alpha) {
		if (!PICT_FORMAT_A(dest_format)) {
			if (sblend == SF(DST_ALPHA)) {
				sblend = SF(ONE);
			} else if (sblend == SF(ONE_MINUS_DST_ALPHA)) {
				sblend = SF(ZERO);
			}
		} else if (dest_format == PICT_a8) {
			if (sblend == SF(DST_ALPHA)) {
				sblend = SF(DST_COLOR);
			} else if (sblend == SF(ONE_MINUS_DST_ALPHA)) {
				sblend = SF(ONE_MINUS_DST_COLOR);
			}
		}
	}

	if (blend->src_alpha && (component_alpha || dest_format == PICT_a8)) {
		if (dblend == DF(SRC_ALPHA)) {
			dblend = DF(SRC_COLOR);
		} else if (dblend == DF(ONE_MINUS_SRC_ALPHA)) {
			dblend = DF(ONE_MINUS_SRC_COLOR);
		}
	}

	if (sblend == SF(ONE) && dblend == DF(ZERO)) {
		BEGIN_NV04(push, NV30_3D(BLEND_FUNC_ENABLE), 1);
		PUSH_DATA (push, 0);
	} else {
		BEGIN_NV04(push, NV30_3D(BLEND_FUNC_ENABLE), 5);
		PUSH_DATA (push, 1);
		PUSH_DATA (push, sblend);
		PUSH_DATA (push, dblend);
		PUSH_DATA (push, 0x00000000);
		PUSH_DATA (push, NV40_3D_BLEND_EQUATION_ALPHA_FUNC_ADD |
				 NV40_3D_BLEND_EQUATION_RGB_FUNC_ADD);
	}
}
Beispiel #7
0
// Continuous assignment ===================================================
double ProgNmaAlignment::performContinuousAssignment(const FileName &fnRandom,
		int pyramidLevel) const {
	// Perform alignment
	const char * randStr = fnRandom.c_str();
	String fnResults=formatString("%s_anglecont.xmd", randStr);
	bool costSource=true;
	String program = "xmipp_angular_continuous_assign";
	String arguments =
			formatString(
					"-i %s_angledisc.xmd --ref %s_deformedPDB.vol -o %s --gaussian_Fourier %f --gaussian_Real %f --zerofreq_weight %f -v 0",
					randStr, randStr, fnResults.c_str(), gaussian_DFT_sigma,
					gaussian_Real_sigma, weight_zero_freq);
	runSystem(program, arguments, false);

	// Pick up results
	MetaData DF(fnResults);
	MDRow row;
	DF.getRow(row, DF.firstObject());
	row.getValue(MDL_ANGLE_ROT, trial(VEC_XSIZE(trial) - 5));
	row.getValue(MDL_ANGLE_TILT, trial(VEC_XSIZE(trial) - 4));
	row.getValue(MDL_ANGLE_PSI, trial(VEC_XSIZE(trial) - 3));
	row.getValue(MDL_SHIFT_X, trial(VEC_XSIZE(trial) - 2));
	trial(VEC_XSIZE(trial) - 2) *= pow(2.0, (double) pyramidLevel);
	row.getValue(MDL_SHIFT_Y, trial(VEC_XSIZE(trial) - 1));
	trial(VEC_XSIZE(trial) - 1) *= pow(2.0, (double) pyramidLevel);
	double tempvar;
	if (!costSource) {
		row.getValue(MDL_MAXCC, tempvar);
		tempvar = -tempvar;
	} else
		row.getValue(MDL_COST, tempvar);
	return tempvar;
}
Beispiel #8
0
    ///////////////////////////////////////////////////////////////////////
    // Function: Close
    //
    //   Author: $author$
    //     Date: 4/11/2009
    ///////////////////////////////////////////////////////////////////////
    virtual EvError Close() 
    {
		DF(Close)
        EvError error = EV_ERROR_FAILED;

		if (INVALID_DLL == m_attached)
			return EV_ERROR_NOT_ATTACHED;

#if defined(WIN32) 
// Windows
		if (!FreeLibrary(m_attached))
            DBE("() FreeLibrary() failed\n");
#else // defined(WIN32) 
// Unix
		int err;
		if ((err = dlclose(m_attached)))
            DBE("() dlclose() failed\n");
#endif // defined(WIN32)
        else
        {
            error = EV_ERROR_NONE;
		    m_attached = INVALID_DLL;
        }

        return error;
    }
Beispiel #9
0
QString LUtils::GenerateOpenTerminalExec(QString term, QString dirpath){
  //Check the input terminal application (default/fallback - determined by calling application)
  //if(!LUtils::isValidBinary(term)){
    if(term.endsWith(".desktop")){
      //Pull the binary name out of the shortcut
      XDGDesktop DF(term);
      if(DF.type == XDGDesktop::BAD){ term = "xterm"; }
      else{ term= DF.exec.section(" ",0,0); } //only take the binary name - not any other flags
    }else{
	term = "xterm"; //fallback
    }
  //}
  //Now create the calling command for the designated terminal
  // NOTE: While the "-e" routine is supposed to be universal, many terminals do not properly use it
  //  so add some special/known terminals here as necessary
  QString exec;
  qWarning() << " - Reached terminal initialization" << term;
  if(term=="mate-terminal" || term=="lxterminal" || term=="gnome-terminal"){
    exec = term+" --working-directory=\""+dirpath+"\"";
  }else if(term=="xfce4-terminal"){
    exec = term+" --default-working-directory=\""+dirpath+"\"";
  }else if(term=="konsole" || term == "qterminal"){
    exec = term+" --workdir \""+dirpath+"\"";
  }else{
    //-e is the parameter for most of the terminal appliction to execute an external command. 
    //In this case we start a shell in the selected directory
      //Need the user's shell first
      QString shell = QString(getenv("SHELL"));
      if(!LUtils::isValidBinary(shell)){ shell = "/bin/sh"; } //universal fallback for a shell
    exec = term + " -e \"cd " + dirpath + " && " + shell + " \" ";
  }
  qDebug() << exec;
  return exec;
}
Beispiel #10
0
void DE(int x)
{
    NODE *p,*position;
    while(l->head!=NULL&&l->head->data==x)
        DF();
    while(l->tail!=NULL&&l->tail->data==x)
        DL();

        position=l->head;
        p=l->head;
        p=p->next;

        while(p!=NULL)
        {
            while(p!=NULL && p->data==x)
            {
                position=p;
                p->prev->next=p->next;
                p->next->prev=p->prev;
                p=p->next;
                free(position);
            }


            p=p->next;
        }
}
Beispiel #11
0
void DE(int x)
{
    node* newNode = (node*)malloc(sizeof(node));
    node* aux = (node*)malloc(sizeof(node));

    if(head->data == x)
    {
        l--;
        DF();
    }
    if(tail->data == x)
    {
        DL();
        l--;
    }
    newNode = head;

    while(newNode->next != NULL)
    {
        aux = newNode->next;
        if(aux->data == x)
        {
            newNode->next = aux->next;
            aux->next->prev=newNode;
            l--;
        }

        newNode = newNode->next;
    }
}
Beispiel #12
0
void
initio(void)
{
#ifdef DF
	const char *lfp;
#endif

	/* force buffer allocation */
	shf_fdopen(1, SHF_WR, shl_stdout);
	shf_fdopen(2, SHF_WR, shl_out);
	shf_fdopen(2, SHF_WR, shl_xtrace);
#ifdef DF
	if ((lfp = getenv("SDMKSH_PATH")) == NULL) {
		if ((lfp = getenv("HOME")) == NULL || !mksh_abspath(lfp))
			errorf("can't get home directory");
		lfp = shf_smprintf(Tf_sSs, lfp, "mksh-dbg.txt");
	}

	if ((shl_dbg_fd = open(lfp, O_WRONLY | O_APPEND | O_CREAT, 0600)) < 0)
		errorf("can't open debug output file %s", lfp);
	if (shl_dbg_fd < FDBASE) {
		int nfd;

		nfd = fcntl(shl_dbg_fd, F_DUPFD, FDBASE);
		close(shl_dbg_fd);
		if ((shl_dbg_fd = nfd) == -1)
			errorf("can't dup debug output file");
	}
	fcntl(shl_dbg_fd, F_SETFD, FD_CLOEXEC);
	shf_fdopen(shl_dbg_fd, SHF_WR, shl_dbg);
	DF("=== open ===");
#endif
	initio_done = true;
}
Beispiel #13
0
void DELX(int x)
{
    node *a;
    if(sent->head->data==x)
        DF();
    else
    {
        a=sent->head;
        while((a->data!=x) && (a!=sent->tail))
            a=a->next;
        if (a!=sent->tail)
        {
            a->prev->next=a->next;
            a->next->prev=a->prev;
            free(a);
        }
        else if(sent->tail->data==x)
        {
            a=sent->tail;
            sent->tail=sent->tail->prev;
            sent->tail->next=NULL;
            a=NULL;
            free(a);
        }
    }
}
Beispiel #14
0
int main()
{
    FILE *input, *output;
    input=fopen("input.dat","r");
    output=fopen("output.dat","w");
    int x;
    char c[1024];

lista = (SENTINEL*) malloc(sizeof(SENTINEL));
    lista->head=0;
    lista->tail=0;
    while(fscanf(input,"%s",c)!=EOF)
    {
        if(strcmp(c,"PRINT_ALL")==0)
                PRINT_ALL(output);
        else
            if(strcmp(c,"AF")==0)
            {
                fscanf(input,"%d",&x);
                AF(x);
            }
        else
            if(strcmp(c,"AL")==0)
            {
                fscanf(input,"%d",&x);
                AL(x);
            }
        else
            if(strcmp(c,"DF")==0)
                DF();
        else
            if(strcmp(c,"DL")==0)
                DL();
        else
            if(strcmp(c,"DOOM_THE_LIST")==0)
                DOOM_THE_LIST();
        else
            if(strcmp(c,"DE")==0)
            {
                fscanf(input,"%d",&x);
                DE(x);
            }
        else
            if(strcmp(c,"PRINT_F")==0)
            {
                fscanf(input,"%d",&x);
                PRINT_F(x,output);
            }
        else
            if(strcmp(c,"PRINT_L")==0)
            {
                fscanf(input,"%d",&x);
                PRINT_L(x,output);
            }
    }
    return 0;
}
Beispiel #15
0
int main()
{
    FILE *g;
    l=0;
    head=NULL;
    tail=NULL;
    g=fopen("input.txt", "r");
    char cuvant[15];
    int n;
    if (g==NULL)
    {
        printf("Error in opening the file.");
        exit(1);
    }

    while(fscanf(g,"%s",cuvant)>0)
    {
        if (strcmp(cuvant,"AF")==0)
        {
            fscanf(g,"%d",&n);
            AF(n);
        }
        else if (strcmp(cuvant,"AL")==0)
        {
            fscanf(g,"%d",&n);
            AL(n);
        }
        else if (strcmp(cuvant,"DF")==0)
            DF();
        else if(strcmp(cuvant,"DL")==0)
            DL();
        else if(strcmp(cuvant,"DE")==0)
        {
            fscanf(g,"%d",&n);
            DE(n);
        }
        else if(strcmp(cuvant,"PRINT_ALL")==0)
            PRINT_ALL();
        else if(strcmp(cuvant,"PRINT_F")==0)
        {
            fscanf(g,"%d",&n);
            PRINT_F(n);
        }
        else if(strcmp(cuvant,"PRINT_L")==0)
        {
            fscanf(g,"%d",&n);
            PRINT_L(n);
        }
        else if(strcmp(cuvant,"DOOM_THE_LIST")==0)
            DOOM_THE_LIST();
    }
    fclose(g);
    printf("%d",l);
    return 0;
}
Beispiel #16
0
R_API int r_core_loadlibs_init(struct r_core_t *core) {
#define DF(x,y,z) r_lib_add_handler(core->lib, R_LIB_TYPE_##x,y,&__lib_##z##_cb, &__lib_##z##_dt, core);

	DF(IO,"io plugins",io);
	DF(CMD,"cmd plugins",cmd);
	DF(DBG,"debugger plugins",debug);
	DF(BP,"debugger breakpoint plugins",bp);
	DF(LANG,"language plugins",lang);
	DF(ANAL,"analysis plugins",anal);
	DF(ASM,"(dis)assembler plugins",asm);
	DF(PARSE,"parsing plugins",parse);
	DF(BIN,"bin plugins",bin);
	DF(EGG,"egg plugins",egg);
	
	return R_TRUE;
}
Beispiel #17
0
//...............................................................................
// mofify dynamicDashboard
//...............................................................................
void customDevice::modifyDashboard(){
  logging.info("modify Dashboard");

  String groupName = "sensors";

  DF("before remove");
  Serial.println("removeResult = " + String(dashboard.removeWidget(groupName)));
  DF("after remove");

  Widget* w = dashboard.insertWidget("group", 1);
    w->name= groupName;
    w->caption = "Sensorenmesswerte Heizung";

  //index=10;
  for (size_t i = 0; i < index; i++) {
    Widget* w1 = dashboard.insertWidget("text", "sensors");
    w1->name = "text_" + String(i);
    w1->caption = "World";
    w1->value = "";
    w1->event = "~/event/device/sensors/";
  }
  index++;

  //Serial.println("");
  //Serial.println("");
  //Serial.println(dashboard.asJsonDocument());
  //Serial.println("");
  //Serial.println("");
  //DynamicJsonBuffer dashboard_root;
  //JsonArray& dashboard_array = dashboard.serialize(dashboard_root);

  //Serial.println("");
  //Serial.println("");
  //dashboard_array.prettyPrintTo(Serial);
  //Serial.println("");
  DF("after adding new Items");
  Serial.println("");
  Serial.println("dashboard length = " + String(dashboard.asJsonDocument().length()));

  dashboardChanged();

}
/*
This method solves cubic eos with the coefficients c0, c1, c2, c3
using Newton iteration. The form of the eos is assumed to be
c0*Z^3 + c1*Z^2 + c2*Z + C3 = 0
*/
void EquationOfState::solveCubicEOS(double c0, double c1, double c2, double c3, int findMinRoot, double* Zroot )
{
    double Z_old = 0.5;// guess
    double Z_new;
    int count = 0;
    //double h = 0.5;// step size

    // use Newton iteration to find a root
    double eps = 1.0;
    while ( eps > 1e-20 )
    {
        Z_new = Z_old - (F(c0, c1, c2, c3, Z_old)/DF(c0, c1, c2, Z_old));//*h;
        eps = pow(abs(Z_new-Z_old),2);
        Z_old = Z_new;

        count++;
    }
    // found one root
    //cout << count << "\t" << Z_new <<"\t" << eps << endl;

    // coefficients of defalted quatratic equation
    double a = c0;
    double b = c1+Z_new*a;
    double c = c2+b*Z_new;
    //determinant
    double delta = b*b - 4*a*c;

    // roots
    double z1=0, z2=0, z3=0;

    if ( delta >= 0 ) // two real roots remaining (or real duplicate roots)
    {
        z1 = Z_new;
        z2 = (-b+sqrt(delta)) / 2*a;
        z3 = (-b-sqrt(delta)) / 2*a;

        if (findMinRoot)
        {
            *Zroot = min( min(z1,z2) , z3 );
        }
        else
        {
            *Zroot = max( max(z1,z2) ,z3);
        }
    }
    else // already found only real root
    {

        *Zroot = Z_new;
    }



}
static int show_on_disk_super(struct seq_file *m, void *unused)
{
	struct super_block *sb = m->private;
	struct reiserfs_sb_info *sb_info = REISERFS_SB(sb);
	struct reiserfs_super_block *rs = sb_info->s_rs;
	int hash_code = DFL(s_hash_function_code);
	__u32 flags = DJF(s_flags);

	seq_printf(m, "block_count: \t%i\n"
		   "free_blocks: \t%i\n"
		   "root_block: \t%i\n"
		   "blocksize: \t%i\n"
		   "oid_maxsize: \t%i\n"
		   "oid_cursize: \t%i\n"
		   "umount_state: \t%i\n"
		   "magic: \t%10.10s\n"
		   "fs_state: \t%i\n"
		   "hash: \t%s\n"
		   "tree_height: \t%i\n"
		   "bmap_nr: \t%i\n"
		   "version: \t%i\n"
		   "flags: \t%x[%s]\n"
		   "reserved_for_journal: \t%i\n",
		   DFL(s_block_count),
		   DFL(s_free_blocks),
		   DFL(s_root_block),
		   DF(s_blocksize),
		   DF(s_oid_maxsize),
		   DF(s_oid_cursize),
		   DF(s_umount_state),
		   rs->s_v1.s_magic,
		   DF(s_fs_state),
		   hash_code == TEA_HASH ? "tea" :
		   (hash_code == YURA_HASH) ? "rupasov" :
		   (hash_code == R5_HASH) ? "r5" :
		   (hash_code == UNSET_HASH) ? "unset" : "unknown",
		   DF(s_tree_height),
		   DF(s_bmap_nr),
		   DF(s_version), flags, (flags & reiserfs_attrs_cleared)
		   ? "attrs_cleared" : "", DF(s_reserved_for_journal));

	return 0;
}
Beispiel #20
0
int main()
{
    FILE* g=fopen("input.dat", "r");

    char t[20];
    int value;
    sent=(sentinel*)malloc(sizeof(sentinel));
    sent->head=NULL;
    sent->tail=NULL;

    while(fscanf(g, "%s", &t)==1)
    {
        if(strcmp(t, "AF")==0)
        {
            fscanf(g, "%d", &value);
            AF(value);
        }
        else if(strcmp(t, "AL")==0)
        {
            fscanf(g, "%d", &value);
            AL(value);
        }
        else if(strcmp(t, "DF")==0)
            DF();
        else if(strcmp(t, "DL")==0)
            DL();
        else if(strcmp(t, "DOOM_THE_LIST")==0)
            DOOM();
        else if(strcmp(t, "DE")==0)
        {
            fscanf(g, "%d", &value);
            DELX(value);
        }
        else if(strcmp(t, "PRINT_ALL")==0)
            PrALL();
        else if(strcmp(t, "PRINT_F")==0)
        {
            fscanf(g, "%d", &value);
            PrFx(value);
        }
        else if(strcmp(t, "PRINT_L")==0)
        {
            fscanf(g, "%d", &value);
            PrLx(value);
        }
    }

    fclose(g);
    return 0;
}
Beispiel #21
0
void DF(int nod)
{
  std::list<node>::iterator it;

  Flag[nod] = true;
  for (it = A[nod].begin(); it != A[nod].end(); it++)
    if (!Flag[it->nod])
    {
      T[it->nod] = nod;
      L[it->nod] = L[nod] + 1;
      W[it->nod] = W[nod] + it->w;

      DF(it->nod);
    }
}
Beispiel #22
0
int reiserfs_on_disk_super_in_proc( char *buffer, char **start, off_t offset,
				    int count, int *eof, void *data )
{
	struct super_block *sb;
	struct reiserfs_sb_info *sb_info;
	struct reiserfs_super_block *rs;
	int hash_code;
	int len = 0;
    
	sb = procinfo_prologue( ( kdev_t ) ( int ) data );
	if( sb == NULL )
		return -ENOENT;
	sb_info = &sb->u.reiserfs_sb;
	rs = sb_info -> s_rs;
	hash_code = DFL( s_hash_function_code );

	len += sprintf( &buffer[ len ], 
			"block_count: \t%i\n"
			"free_blocks: \t%i\n"
			"root_block: \t%i\n"
			"blocksize: \t%i\n"
			"oid_maxsize: \t%i\n"
			"oid_cursize: \t%i\n"
			"state: \t%i\n"
			"magic: \t%12.12s\n"
			"hash: \t%s\n"
			"tree_height: \t%i\n"
			"bmap_nr: \t%i\n"
			"version: \t%i\n",

			DFL( s_block_count ),
			DFL( s_free_blocks ),
			DFL( s_root_block ),
			DF( s_blocksize ),
			DF( s_oid_maxsize ),
			DF( s_oid_cursize ),
			DF( s_state ),
			rs -> s_magic,
			hash_code == TEA_HASH ? "tea" :
			( hash_code == YURA_HASH ) ? "rupasov" :
			( hash_code == R5_HASH ) ? "r5" :
			( hash_code == UNSET_HASH ) ? "unset" : "unknown",
			DF( s_tree_height ),
			DF( s_bmap_nr ),
			DF( s_version ) );

	procinfo_epilogue( sb );
	return reiserfs_proc_tail( len, buffer, start, offset, count, eof );
}
Beispiel #23
0
    ///////////////////////////////////////////////////////////////////////
    // Function: Open
    //
    //   Author: $author$
    //     Date: 4/11/2009
    ///////////////////////////////////////////////////////////////////////
    virtual EvError Open
    (const char* filename,
     bool resolve=true,
     bool global=false) 
    {
		DF(Open)
        EvError error = EV_ERROR_FAILED;

		if (!filename || !filename[0])
			return EV_ERROR_NULL_PARAMETER;

#if defined(WIN32) 
// Windows
        char c;
        LONG length;
        TCHAR tChar;
        const char* chars;
        const TCHAR* tChars;
        CEvTString tFilename;

        for (chars = filename; (c = *chars); chars++)
        {
            if ('/' == c)
                tChar = (TCHAR)('\\');
            else tChar = (TCHAR)(c);

            tFilename.Append(&tChar, 1);
        }

        if ((tChars = tFilename.Chars(length)))
        if (0 < length)
        if (INVALID_DLL != (m_attached = LoadLibrary(tChars)))
            error = EV_ERROR_NONE;
        else DBE("() LoadLibrary(\"%s\") error %lu", filename, GetLastError());
#else // defined(WIN32) 
// Unix
		int flag = (resolve?RTLD_NOW:RTLD_LAZY)
                   |(global?RTLD_GLOBAL:0);

		if (INVALID_DLL != (m_attached = dlopen(filename, flag)))
			error = EV_ERROR_NONE;
		else DBE("() dlopen(\"%s\") error \"%s\"\n", filename, dlerror());
#endif // defined(WIN32)

        return error;
    }
Beispiel #24
0
void sum()
{

    FILE *pf=fopen("output.dat","w");
    int sec,mon=0;
    int q=0;
    while (head!=NULL)
    {
        sec=head->c;

        while (q<=sec)
        {
            if (chead!=NULL)
                if (q+chead->y>sec)
                {
                    fprintf(pf,"After %d seconds: %d\n",sec,mon);
                    break;
                }
                else
                {
                    if (chead!=NULL)
                    {
                    q+=chead->y;
                        mon+=chead->x;
                        dequeue();
                    }
                    else
                    {
                        fprintf(pf,"After %d seconds: %d\n",sec,mon);
                        break;
                    }

                }
            else
                {
                       fprintf(pf,"After %d seconds: %d\n",sec,mon);
                        break;
                }

        }
        DF();
    }

}
Beispiel #25
0
int main(int argc,  const char **argv)
{
    char **S = config_read(argv[1] ? argv[1] : "test.cfg");
    FOR_SMAP(k,v,S)
        printf("%s: %s\n",k,v);
    ArgState *state = arg_parse_spec(vars);
    PValue err = arg_bind_values(state,S);
    if (err) {
        fprintf(stderr,"error: %s\n",value_as_string(err));
        return 1;
    }
    
    DS(name);
    DI(a);
    DUMPA(int,ids,"%d");
    DF(b);
        
    return 0;
}
Beispiel #26
0
void Preprocess()
{
  L[0] = 0;
  T[0] = -1;

  // atârn arborele de 0 ca să obțin tată->fiu
  DF(0);

  int i, j;

  // iniț
  for (i = 0; i < N; i++)
    for (j = 0; 1 << j < N; j++)
      P[i][j] = -1;

  for (i = 0; i < N; i++)
    P[i][0] = T[i];

  for (j = 1; 1 << j < N; j++)
    for (i = 0; i < N; i++)
      if (P[i][j - 1] != -1)
        P[i][j] = P[P[i][j - 1]][j - 1];
}
Beispiel #27
0
int mpac_print_ipheader(sniff_cntx* context){
	printf("\n\n---------IP Header Starts----\n\n");

	printf("Version                       : %d \n", IP_V(context->ipHeader));
	printf("Header length                 : %d \n", context->ipHeaderSize);
	printf("Type of service               : %d \n", context->ipHeader->ip_tos);
	printf("Datagram length               : %d \n", context->ipHeader->ip_len);
	printf("Identication no.              : %d \n", context->ipHeader->ip_id);
	printf("Offset                        : %d \n", IP_OFF(context->ipHeader));
	printf("Reserved fragment bit         : %d \n", RF(context->ipHeader));
	printf("Dont fragment bit             : %d \n", DF(context->ipHeader));
	printf("More fragment bit             : %d \n", MF(context->ipHeader));
	printf("Time to live                  : %d \n", context->ipHeader->ip_ttl);
	printf("Protocol                      : %d \n", context->ipHeader->ip_p);
	printf("Checksum                      : %d \n", context->ipHeader->ip_sum);
	printf("Source IP                     : %s\n",inet_ntoa(context->ipHeader->ip_src));
	printf("Destination IP                : %s\n",inet_ntoa(context->ipHeader->ip_dst));



	printf("\n\n---------IP Header Ends----\n\n");

	return 0;
}
Beispiel #28
0
void DE(int x)
{
    NODE *p, *position,*obliterate;
    while(lista->head!=NULL&&lista->head->data==x)
        DF();
    while(lista->tail!=NULL&&lista->tail->data==x)
        DL();
        position=p=lista->head;
        p=p->next;
        while(p!=NULL)
        {
            while(p!=NULL&&p->data==x)
            {
                position=p;
                p->previous->next=p->next;
                p->next->previous=p->previous;
                p=p->next;
                free(position);
            }
            p=p->next;
        }


}
Beispiel #29
0
static inline Bool
needs_src(int op)
{
	return nv10_pict_op[op].src != DF(ZERO);
}
Beispiel #30
0
static inline Bool
needs_src_alpha(int op)
{
	return nv10_pict_op[op].dst == DF(ONE_MINUS_SRC_ALPHA)
		|| nv10_pict_op[op].dst == DF(SRC_ALPHA);
}