Beispiel #1
0
int main()
{
	//#  Variable Decleration for Additions  #
	int a = 0, b = 0, r = 0;
	
	/*#  Variable Declerations for Pointers  #
	unsigned int addr = (unsigned int) &r; //The unary operator '&' brings up address
	int *paddr = &r; //Make a pointer, shown by the '*', that contains the address to r
	#  Removed as no longer needed  #*/
	
	//#  Additional tfunc Declerations  #
	
	
	//#  Standard output via pass/cast  #
	cout << "Enter two integers seperated by a space." << endl;
	cin >> a >> b;
	r = sfunc(a,b); //Casting
	cout << "\nThe result via passing it into a function is " << r << endl;
	
	//#  Removed - was there as test  #
	//cout << "\nThe address of this is 0x" << hex << addr << endl;
	//cout << "\nShowing the contents via a pointer " << *paddr << endl;
	
	//#  Output via pointer method  #
	cout << "Enter two integers seperated by a space." << endl;
	cin >> a >> b;	
	tfunc(&a,&b,&r); //pass the address of a, b and r into tfunc - r so it knows where to put the result.
	cout << "\nThe result via pointing function is " << r << endl; //No need to cast as the result from tfunc is already in r
	
	
	return 0;
}
Beispiel #2
0
/*ARGSUSED1*/
void
key(unsigned char key, int x, int y)
{
    switch (key) {
    case 'a':
	afunc();
	break;
    case 'b':
	bfunc();
	break;
    case 'h':
	help();
	break;
    case 't':
	tfunc();
	break;
    case 'e':
	explode();
	break;
    case '\033':
	exit(EXIT_SUCCESS);
	break;
    default:
	break;
    }
    glutPostRedisplay();
}
Beispiel #3
0
/*ARGSUSED1*/
void
key(unsigned char key, int x, int y) {
    switch(key) {
    case '\033':	exit(0); break;
    case 'h':		help(); break;
    case 't':		tfunc(); break;
    case 'w':		wire(); break;
    }
}
Beispiel #4
0
/*ARGSUSED1*/
static void
key(unsigned char key, int x, int y) {
    switch(key) {
    case 'h': help(); break;
    case 'g': gfunc(); break;
    case 't': tfunc(); break;
    case 'z': zfunc(); break;
    case 'x': xfunc(); break;
    case 'p': pfunc(); break;
    case '\033': exit(EXIT_SUCCESS); break;
    default: break;
    }
    glutPostRedisplay();
}
Beispiel #5
0
int
main(int argc, char *argv[]) {
	int fa,nfa;				/* argument we're looking at */
	int np = 0;			/* Current number of input parameters */
	double params[MAX_PARM] =  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	int i;
	double x;
	double xx[XRES];
	double y1[XRES];

	error_program = "cv";

	/* Process the arguments */
	for(fa = 1;fa < argc;fa++) {
		nfa = fa;					/* skip to nfa if next argument is used */
		if (np >= MAX_PARM)
			break;

		params[np++] = atof(argv[fa]);
	}

	if (np == 0)
		np = 1;

	printf("There are %d parameters:\n",np); fflush(stdout);
	for (i = 0; i < np; i++) {
		printf("Paramter %d = %f\n",i, params[i]); fflush(stdout);
	}

	/* Display the result */
	for (i = 0; i < XRES; i++) {
		x = i/(double)(XRES-1);

		xx[i] = x;
		y1[i] = tfunc(params, np, x);

		if (y1[i] < -0.2)
			y1[i] = -0.2;
		else if (y1[i] > 1.2)
			y1[i] = 1.2;
	}
	do_plot(xx,y1,NULL,NULL,XRES);

	return 0;
}
Beispiel #6
0
/*===========================================================================*/
const kvs::TransferFunction Argument::transferFunction( const kvs::VolumeObjectBase* volume )
{
    if ( this->hasOption("t") )
    {
        const std::string filename = this->optionValue<std::string>("t");
        return( kvs::TransferFunction( filename ) );
    }
    else if ( this->hasOption("T") )
    {
        const std::string filename = this->optionValue<std::string>("T");
        kvs::TransferFunction tfunc( filename );
        tfunc.adjustRange( volume );
        return( tfunc );
    }
    else
    {
        const size_t resolution = 256;
        return( kvs::TransferFunction( resolution ) );
    }
}
Beispiel #7
0
/*ARGSUSED1*/
void key (unsigned char key, int x, int y) {
    switch (key) {
    case 'b': bfunc(); break;
    case 'c': cfunc(); break;
    case 'l': lfunc(); break;
    case 't': tfunc(); break;
    case 'f': ffunc(); break;
    case 'n': nfunc(); break;
    case 'u': ufunc(); break;
    case 'U': Ufunc(); break;
    case 'p': pfunc(); break;
    case 'P': Pfunc(); break;
    case 'w': wfunc(); break;
    case 'x': xfunc(); break;
    case 'X': Xfunc(); break;
    case 'y': yfunc(); break;
    case '\033': exit(EXIT_SUCCESS); break;
    default: break;
    }
}
 static void * cThreadFunc(void * user) {
     ThreadFunction& tfunc = *((ThreadFunction*)user);
     tfunc();
     return NULL;
 }
 static unsigned _stdcall cThreadFunc(void * user) {
     ThreadFunction& tfunc = *((ThreadFunction*)user);
     tfunc();
     return 0;
 }
Beispiel #10
0
static uint8_t _trim(graph_t *gin, graph_t *gout, args_t *a) {

  uint64_t  i;
  uint32_t  val;
  uint32_t  flags;
  uint32_t  oldcmp;
  void     *opt;
  mod_opt_t modopt;
  uint8_t (*tfunc)(
    graph_t  *gin, graph_t *gout, uint32_t cmplimit, 
    uint32_t igndis, void *opt,
    uint8_t (*init)(graph_t *g),
    uint8_t (*remove)(
      graph_t *g, double *space, array_t *edges, graph_edge_t *edge),
    uint8_t (*recalc)(graph_t *g, graph_edge_t *edge));

  flags = 0;

  if (a->modularity) {
    tfunc = &graph_threshold_modularity;
    val   = a->nedges;
    opt   = &modopt;
    if (val == 0) 
      val = graph_num_edges(gin);
  }
  else if (a->chira) {
    tfunc = &graph_threshold_chira;
    val   = a->nedges;
    if (val == 0) 
      val = graph_num_edges(gin);
  } 
  else if (a->nedges   != 0) {
    tfunc = &graph_threshold_edges;
    val   = a->nedges;
    if (val == 0) 
      val = graph_num_edges(gin);
  }
  else if (a->cmplimit != 0) {
    tfunc = &graph_threshold_components;
    val   = a->cmplimit;
    flags = a->igndis;
  }
  else goto fail;

  switch (a->criteria) {

    case C_PATHSHARING:
      if (tfunc(gin,
                gout,
                val,
                flags,
                opt,
                &graph_init_pathsharing,
                &graph_remove_pathsharing,
                &graph_recalculate_pathsharing))
        goto fail;
      break;

    case C_EDGEBETWEENNESS:
      if (tfunc(gin,
                gout,
                val,
                flags,
                opt,
                &graph_init_edge_betweenness,
                &graph_remove_edge_betweenness,
                &graph_recalculate_edge_betweenness))
        goto fail;
      break;
  }

  if (a->modularity && a->printmod) {

    oldcmp = 0xFFFFFFFF;

    for (i = 0; i < modopt.nvals; i++) {

      if (modopt.ncmps[i] != oldcmp) {

        printf("%05" PRIu64 ", %04u, %0.6f\n", 
               i, modopt.ncmps[i], modopt.modularity[i]);
        oldcmp = modopt.ncmps[i];
      }
    }
  }

  return 0;
  
fail:
  return 1;
}