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


C++ CREATE函数代码示例

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


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

示例1: load_bounties

void load_bounties(  )
{
   FILE *fpList;
   char *target;
   char bountylist[256];
   BOUNTY_DATA *bounty;
   long int amount;

   first_disintegration = NULL;
   last_disintegration = NULL;

   log_string( "Loading disintegrations..." );

   sprintf( bountylist, "%s%s", SYSTEM_DIR, disintegration_LIST );
   if( ( fpList = fopen( bountylist, "r" ) ) == NULL )
   {
      perror( bountylist );
      exit( 1 );
   }

   for( ;; )
   {
      target = feof( fpList ) ? "$" : fread_word( fpList );
      if( target[0] == '$' )
         break;
      CREATE( bounty, BOUNTY_DATA, 1 );
      LINK( bounty, first_disintegration, last_disintegration, next, prev );
      bounty->target = STRALLOC( target );
      amount = fread_number( fpList );
      bounty->amount = amount;
   }
   fclose( fpList );
   log_string( " Done bounties " );

   return;
}
开发者ID:ccubed,项目名称:SWFoteCustom,代码行数:36,代码来源:bounty.c

示例2: db_mysql_save_pc_attribs

void db_mysql_save_pc_attribs( int pc_id, char *json )
{
    MYSQL_BIND         *data;
    pthread_mutex_t    *mutex;
    JSONSource_t       *js;
    JSONSource_t       *jsItem;

    if( !pc_id || !json ) {
        return;
    }

    js = SplitJSON( json );
    if( !js ) {
        return;
    }

    mutex = CREATE(pthread_mutex_t);
    thread_mutex_init( mutex );

    for( jsItem = js; jsItem->source; jsItem++ ) {
        data = CREATEN(MYSQL_BIND, 3);

        bind_numeric( &data[0], pc_id, MYSQL_TYPE_LONG );
        bind_string( &data[1], jsItem->source, MYSQL_TYPE_VAR_STRING );
        bind_string( &data[2], jsItem->json, MYSQL_TYPE_VAR_STRING );

        db_queue_query( 14, QueryTable, data, 3, NULL, NULL, mutex );

        pthread_mutex_unlock( mutex );
    }

    pthread_mutex_destroy( mutex );
    memfree( mutex );

    DestroyJSONSource( js );
}
开发者ID:welterde,项目名称:havokmud,代码行数:36,代码来源:mysql_database.c

示例3: main

void
main (int argc, char *argv[])
{
   int i;
   int c;
   extern char *optarg;
  
   CLOCK(starttime);

   while ((c = getopt(argc, argv, "osh")) != -1) {
     switch(c) {
       case 'o': do_output = 1; break;
       case 's': do_stats = 1; break;
       case 'h': Help(); break;
     }
   }

   MAIN_INITENV(,40000000);

   GetArguments();
   InitGlobalMemory();    
   InitExpTables();
   CreateDistribution(Cluster, Model);

   //for (i = 1; i < Number_Of_Processors; i++) {
      CREATE(ParallelExecute, Number_Of_Processors);
   //}
   //ParallelExecute();
   WAIT_FOR_END(Number_Of_Processors);
   printf("Finished FMM\n");
   PrintTimes();
   if (do_output) {
     PrintAllParticles();
   }
   MAIN_END;
}
开发者ID:MubashirHusain,项目名称:parsec-benchmark,代码行数:36,代码来源:fmm.C

示例4: CREATE

RESET_DATA *new_reset_data( void )
{
    RESET_DATA *pReset;

    if ( !reset_free )
    {
        CREATE( pReset, RESET_DATA, 1 );
        top_reset++;
    }
    else
    {
        pReset          =   reset_free;
        reset_free      =   reset_free->next;
    }

    pReset->next        =   NULL;
    pReset->command     =   'X';
    pReset->arg1        =   0;
    pReset->arg2        =   0;
    pReset->arg3        =   0;
    pReset->arg4	=   0;

    return pReset;
}
开发者ID:Tener,项目名称:KillerMUD,代码行数:24,代码来源:mem.c

示例5: temple_calla

/******************************************************************************
 Function: void temple_calla(void)

 By: David Schwartz

 Date: Feb 1995

 Parameters: None

 Returns: None

 Description:	setup the bridge background
******************************************************************************/
void temple_calla(void)
{
	OBJECT *obj;

	alloc_vram_perm_bg_list((ADDRESS *)temple_perm_list,&temple_anims);

	current_proc->a10=10;
	(long)current_proc->a11=-1;

	do
	{
		/* candd */
		gso_dmawnz(obj,(ADDRESS)KANDLE1,temple_anims,0);
		obj->oxpos.u.intpos=(short)current_proc->a11+8+2;
		obj->oypos.u.intpos=0xb2+6;	//+36;
		alloc_cache(KANDLE1,temple_anims,obj);
		insert_object(obj,&baklst6);

		/* flame */
		(OBJECT *)current_proc->pa9=obj;
		gso_dmawnz(obj,(ADDRESS)wik1,temple_anims,0);
		alloc_cache(wik1,temple_anims,current_proc->pa8);
		insert_object(current_proc->pa8,&baklst6);

		obj->oxpos.u.intpos=((OBJECT *)current_proc->pa9)->oxpos.u.intpos+SCX(7);
		obj->oypos.u.intpos=((OBJECT *)current_proc->pa9)->oypos.u.intpos-SCY(12);

		CREATE(PID_BANI,candle_flame);
		(long)current_proc->a11+=SCX(0x96);
	}
	while(--current_proc->a10>0);

	create_dumb_animators(tony_candle_table,&temple_anims);

	return;
}
开发者ID:Ced2911,项目名称:umk3,代码行数:49,代码来源:BKGDTEMP.C

示例6: CREATE

NEWS_DATA              *fread_news( FILE * fpin )
{
    const char             *word;
    bool                    fMatch;
    NEWS_DATA              *news = NULL;

    CREATE( news, NEWS_DATA, 1 );

    for ( ;; ) {
        word = feof( fpin ) ? "End" : fread_word( fpin );
        fMatch = FALSE;

        switch ( UPPER( word[0] ) ) {
            case '*':
                fMatch = TRUE;
                fread_to_eol( fpin );
                break;

            case 'D':
                if ( !str_cmp( word, "Day" ) ) {
                    news->day = fread_number( fpin );
                    fMatch = TRUE;
                    break;
                }

            case 'E':
                if ( !str_cmp( word, "End" ) )
                    return news;

            case 'M':
                if ( !str_cmp( word, "Month" ) ) {
                    news->month = fread_number( fpin );
                    fMatch = TRUE;
                    break;
                }

            case 'N':
                if ( !str_cmp( word, "NewsData" ) ) {
                    news->data = fread_string( fpin );
                    fMatch = TRUE;
                    break;
                }

            case 'T':
                if ( !str_cmp( word, "TimeStamp" ) ) {
                    news->time_stamp = fread_number( fpin );
                    if ( news->time_stamp > 0 ) {
                        format_posttime( news );
                    }
                    fMatch = TRUE;
                    break;
                }

            case 'Y':
                if ( !str_cmp( word, "Year" ) ) {
                    news->year = fread_number( fpin );
                    fMatch = TRUE;
                    break;
                }
        }

        if ( !fMatch ) {
            bug( "Load_news: no match: %s", word );
            bug( word, 0 );
        }
    }
    return NULL;
}
开发者ID:jpavonabian,项目名称:6Dragones,代码行数:68,代码来源:news.c

示例7: feof

CHAR_DATA *load_mobile( FILE * fp )
{
   CHAR_DATA *mob = NULL;
   const char *word;
   bool fMatch;
   int inroom = 0;
   ROOM_INDEX_DATA *pRoomIndex = NULL;

   word = feof( fp ) ? "EndMobile" : fread_word( fp );
   if( !str_cmp( word, "Vnum" ) )
   {
      int vnum;

      vnum = fread_number( fp );
      if( get_mob_index( vnum ) == NULL )
      {
         bug( "%s: No index data for vnum %d", __FUNCTION__, vnum );
         return NULL;
      }
      mob = create_mobile( get_mob_index( vnum ) );
      if( !mob )
      {
         for( ;; )
         {
            word = feof( fp ) ? "EndMobile" : fread_word( fp );
            /*
             * So we don't get so many bug messages when something messes up
             * * --Shaddai 
             */
            if( !str_cmp( word, "EndMobile" ) )
               break;
         }
         bug( "%s: Unable to create mobile for vnum %d", __FUNCTION__, vnum );
         return NULL;
      }
   }
   else
   {
      for( ;; )
      {
         word = feof( fp ) ? "EndMobile" : fread_word( fp );
         /*
          * So we don't get so many bug messages when something messes up
          * * --Shaddai 
          */
         if( !str_cmp( word, "EndMobile" ) )
            break;
      }
      extract_char( mob, TRUE );
      bug( "%s: Vnum not found", __FUNCTION__ );
      return NULL;
   }

   for( ;; )
   {
      word = feof( fp ) ? "EndMobile" : fread_word( fp );
      fMatch = FALSE;
      switch ( UPPER( word[0] ) )
      {
         case '*':
            fMatch = TRUE;
            fread_to_eol( fp );
            break;

         case '#':
            if( !str_cmp( word, "#OBJECT" ) )
            {
               mob->tempnum = -9999;   /* Hackish, yes. Works though doesn't it? */
               fread_obj( mob, fp, OS_CARRY );
            }
            break;

         case 'A':
            if( !str_cmp( word, "Affect" ) || !str_cmp( word, "AffectData" ) )
            {
               AFFECT_DATA *paf;

               CREATE( paf, AFFECT_DATA, 1 );
               if( !str_cmp( word, "Affect" ) )
               {
                  paf->type = fread_number( fp );
               }
               else
               {
                  int sn;
                  const char *sname = fread_word( fp );

                  if( ( sn = skill_lookup( sname ) ) < 0 )
                  {
                     if( ( sn = herb_lookup( sname ) ) < 0 )
                        bug( "%s", "load_mobile: unknown skill." );
                     else
                        sn += TYPE_HERB;
                  }
                  paf->type = sn;
               }

               paf->duration = fread_number( fp );
               paf->modifier = fread_number( fp );
               paf->location = fread_number( fp );
//.........这里部分代码省略.........
开发者ID:m241dan,项目名称:swrproject,代码行数:101,代码来源:hotboot.c

示例8: _nd_help

/*
 * _nd_help() displays helpfiles
 */
void
_nd_help(char *document)
{
    STRING(Page) pages;
    Page *cur, *up = 0;
    int rc;
    void *help, *chain;
    char *topic;		/* help topic title, for putting on the
				 * help box titlebar*/

    if (document == 0)
	return;

    CREATE(pages);

    cur = &EXPAND(pages);
    
    cur->cursor = 0;
    cur->file = helpfile(document, root);

    do {
	help = newHelp(0, 0, (COLS*3)/4, LINES-10,
		       cur->file, (pfo)ndhcallback, 0);

	/*setObjTitle(help, cur->file);*/

	if (cur->cursor)
	    setHelpCursor(help, cur->cursor);

	chain = ObjChain(help, newCancelButton(0,"Done", 0, 0));

	rc = MENU(chain, -1, -1, getHelpTopic(help), 0, 0);

	if (rc == MENU_OK) {
	    if (( topic = currentHtmlTag(help) )) {
		cur->cursor = getHelpCursor(help);

		up = cur;
		cur = &EXPAND(pages);
		cur->cursor = 0;
		cur->file = helpfile(topic, up ? up->file : root);
	    }
	}
	else if (rc == MENU_ESCAPE) {
	    free(cur->file);
	    S(pages)--;
	    up = (S(pages) > 1) ? &T(pages)[S(pages)-2]:0;
	    cur = &T(pages)[S(pages)-1];
	}
	else if (rc == MENU_CANCEL) {
	    int i;
	    for (i = 0; i < S(pages); i++)
		free(T(pages)[i].file);
	}
	deleteObjChain(chain);
    } while ( S(pages) > 0 );
    DELETE(pages);
#if HAVE_DOUPDATE
    doupdate();
#else
    refresh();
#endif
} /* _nd_help */
开发者ID:Orc,项目名称:ndialog,代码行数:66,代码来源:ndhelp.c

示例9: CREATE

SRDAGEdge* SRDAGGraph::addEdge() {
	SRDAGEdge* edge = CREATE(stack_, SRDAGEdge)(this);
	edges_.add(edge);
	return edge;
}
开发者ID:hewumars,项目名称:Spider,代码行数:5,代码来源:SRDAGGraph.cpp

示例10: do_add_imm_host


//.........这里部分代码省略.........
         return;
      }
      send_to_char( "Immortal   Host\r\n", ch );
      set_char_color( AT_PLAIN, ch );
      for( temp = immortal_host_start; temp; temp = temp->next )
         ch_printf( ch, "%-8s  %c%s%c\r\n",
                    temp->name, ( temp->prefix ? '*' : ' ' ), temp->host, ( temp->suffix ? '*' : ' ' ) );
      return;
   }

   /*
    * Ok we have a new entry make sure it doesn't contain a ~ 
    */
   if( !str_cmp( type, "save" ) )
   {
      do_write_imm_host(  );
      send_to_char( "Done.\r\n", ch );
      return;
   }

   if( arg2[0] == '\0' || arg1[0] == '\0' )
   {
      send_to_char( "Syntax: immhost add    <name> <host>\r\n", ch );
      send_to_char( "Syntax: immhost delete <name> <host>\r\n", ch );
      send_to_char( "Syntax: immhost save\r\n", ch );
      return;
   }

   if( !str_cmp( type, "delete" ) )
   {
      IMMORTAL_HOST *it = NULL;

      for( temp = immortal_host_start; temp; temp = temp->next )
      {
         if( !str_cmp( arg1, temp->name ) && !str_cmp( arg2, temp->host ) )
         {
            it = temp;
            break;
         }
      }
      if( it == NULL )
      {
         send_to_char( "Didn't find that entry.\r\n", ch );
         return;
      }
      DISPOSE( temp->name );
      DISPOSE( temp->host );
      UNLINK( it, immortal_host_start, immortal_host_end, next, prev );
      DISPOSE( it );
   }
   else if( !str_cmp( type, "add" ) )
   {
      bool prefix = FALSE, suffix = FALSE;
      int i;

      smash_tilde( arg1 );
      smash_tilde( arg2 );
      name = arg2;


      if( arg2[0] == '*' )
      {
         prefix = TRUE;
         name++;
      }

      if( name[strlen( name ) - 1] == '*' )
      {
         suffix = TRUE;
         name[strlen( name ) - 1] = '\0';
      }

      arg1[0] = toupper( arg1[0] );
      for( i = 0; i < ( int )strlen( name ); i++ )
         name[i] = LOWER( name[i] );
      for( temp = immortal_host_start; temp; temp = temp->next )
      {
         if( !str_cmp( temp->name, arg1 ) && !str_cmp( temp->host, name ) )
         {
            send_to_char( "Entry already exists.\r\n", ch );
            return;
         }
      }
      CREATE( host, IMMORTAL_HOST, 1 );
      host->name = str_dup( arg1 );
      host->host = str_dup( name );
      host->prefix = prefix;
      host->suffix = suffix;
      LINK( host, immortal_host_start, immortal_host_end, next, prev );
   }
   else
   {
      send_to_char( "Syntax: immhost add    <name> <host>\r\n", ch );
      send_to_char( "Syntax: immhost delete <name> <host>\r\n", ch );
      send_to_char( "Syntax: immhost save\r\n", ch );
      return;
   }
   send_to_char( "Done.\r\n", ch );
   return;
}
开发者ID:jmdjr,项目名称:sdf-mud,代码行数:101,代码来源:imm_host.c

示例11: define_Computed_field_type_connected_threshold_image_filter

int define_Computed_field_type_connected_threshold_image_filter(struct Parse_state *state,
	void *field_modify_void, void *computed_field_simple_package_void)
/*******************************************************************************
LAST MODIFIED : 30 August 2006

DESCRIPTION :
Converts <field> into type COMPUTED_FIELD_CONNECTED_THRESHOLD_IMAGE_FILTER (if it is not
already) and allows its contents to be modified.
==============================================================================*/
{
	double lower_threshold, upper_threshold, replace_value;
	int num_seed_points;
	int seed_dimension;
  double *seed_points;
	int return_code;
	int seed_points_length;
	int previous_state_index, expected_parameters;

	struct Computed_field *source_field;
	Computed_field_modify_data *field_modify;
	struct Option_table *option_table;
	struct Set_Computed_field_conditional_data set_source_field_data;

	ENTER(define_Computed_field_type_connected_threshold_image_filter);
	USE_PARAMETER(computed_field_simple_package_void);
	if (state && (field_modify=(Computed_field_modify_data *)field_modify_void))
	{
		return_code = 1;

		source_field = (struct Computed_field *)NULL;
		lower_threshold = 0.0;
		upper_threshold = 1.0;
		replace_value = 1;
		num_seed_points = 0;
		seed_dimension  = 2;
		seed_points = (double *)NULL;

		// should probably default to having 1 seed point
		//		seed_points[0] = 0.5;  // pjb: is this ok?
		//		seed_points[1] = 0.5;
		seed_points_length = 0;

		/* get valid parameters for projection field */
		if ((NULL != field_modify->get_field()) &&
			(computed_field_connected_threshold_image_filter_type_string ==
				Computed_field_get_type_string(field_modify->get_field())))
		{
			return_code =
				Cmiss_field_get_type_connected_threshold_image_filter(field_modify->get_field(), &source_field,
				&lower_threshold, &upper_threshold, &replace_value,
		  &num_seed_points, &seed_dimension, &seed_points);
		}
		if (return_code)
		{

			if (source_field)
			{
				ACCESS(Computed_field)(source_field);
			}

			if (state->current_token &&
				(!(strcmp(PARSER_HELP_STRING, state->current_token)&&
					strcmp(PARSER_RECURSIVE_HELP_STRING, state->current_token))))
			{
				/* Handle help separately */
				option_table = CREATE(Option_table)();
			Option_table_add_help(option_table,
				"The connected_threshold_filter field uses the itk::ConnectedThresholdImageFilter code to segment a field. The <field> it operates on is usually a sample_texture field, based on a texture that has been created from image file(s).  The segmentation is based on a region growing algorithm which requires at least one seed point.  To specify the seed points first set the <num_seed_points> and the <dimension> of the image.  The <seed_points> are a list of the coordinates for the first and any subsequent seed points.  Starting from the seed points any neighbouring pixels with an intensity between <lower_threshold> and the <upper_threshold> are added to the region.  Pixels within the region have their pixel intensity set to <replace_value> while the remaining pixels are set to 0. See a/testing/image_processing_2D for an example of using this field.  For more information see the itk software guide.");

				/* field */
				set_source_field_data.computed_field_manager =
					field_modify->get_field_manager();
				set_source_field_data.conditional_function = Computed_field_is_scalar;
				set_source_field_data.conditional_function_user_data = (void *)NULL;
				Option_table_add_entry(option_table, "field", &source_field,
															 &set_source_field_data, set_Computed_field_conditional);
				/* lower_threshold */
				Option_table_add_double_entry(option_table, "lower_threshold",
																			&lower_threshold);
				/* upper_threshold */
				Option_table_add_double_entry(option_table, "upper_threshold",
																			&upper_threshold);
				/* replace_value */
				Option_table_add_double_entry(option_table, "replace_value",
																			&replace_value);
				/* num_seed_points */
				Option_table_add_int_positive_entry(option_table, "num_seed_points",
																						&num_seed_points);
				Option_table_add_int_positive_entry(option_table, "dimension",
																						&seed_dimension);
				Option_table_add_double_vector_entry(option_table, "seed_points",
																						 seed_points, &seed_points_length);
				return_code = Option_table_multi_parse(option_table, state);
				DESTROY(Option_table)(&option_table);
			}

			if (return_code)
			{

				// store previous state so that we can return to it
//.........这里部分代码省略.........
开发者ID:A1kmm,项目名称:libzinc,代码行数:101,代码来源:computed_field_connected_threshold_image_filter_app.cpp

示例12: start_radiosity

void start_radiosity(long val)
#endif
{
    static long state = 0 ;
    long i;
    long total_rad_time, max_rad_time, min_rad_time;
    long total_refine_time, max_refine_time, min_refine_time;
    long total_wait_time, max_wait_time, min_wait_time;
    long total_vertex_time, max_vertex_time, min_vertex_time;

#if defined(SGI_GL) && defined(GL_NASA)
    long val ;

    val = g_get_choice_val( ap, &choices[0] ) ;
#endif

    if( val == CHOICE_RAD_RUN )
        {
            if( state == -1 )
                {
                    printf( "Please reset first\007\n" ) ;
                    return ;
                }

            /* Time stamp */
            CLOCK( time_rad_start ) ;


            global->index = 0;

            /* Create slave processes */
            for (i = 0 ; i < n_processors ; i++ )
                {
                    taskqueue_id[i] = assign_taskq(0) ;
                }

            /* And start processing */
            CREATE(radiosity, n_processors);
            WAIT_FOR_END(n_processors);
            /* Time stamp */
            CLOCK( time_rad_end );

            /* Print out running time */
            /* Print out running time */
            printf("TIMING STATISTICS MEASURED BY MAIN PROCESS:\n");

            print_running_time(0);

            if (dostats) {
                printf("\n\n\nPER-PROCESS STATISTICS:\n");

                printf("%8s%20s%20s%12s%12s\n","Proc","Total","Refine","Wait","Smooth");
                printf("%8s%20s%20s%12s%12s\n\n","","Time","Time","Time","Time")
                    ;
                for (i = 0; i < n_processors; i++)
                    printf("%8ld%20lu%20lu%12lu%12lu\n",i,timing[i]->rad_time, timing[i]->refine_time, timing[i]->wait_time, timing[i]->vertex_time);

                total_rad_time = timing[0]->rad_time;
                max_rad_time = timing[0]->rad_time;
                min_rad_time = timing[0]->rad_time;

                total_refine_time = timing[0]->refine_time;
                max_refine_time = timing[0]->refine_time;
                min_refine_time = timing[0]->refine_time;

                total_wait_time = timing[0]->wait_time;
                max_wait_time = timing[0]->wait_time;
                min_wait_time = timing[0]->wait_time;

                total_vertex_time = timing[0]->vertex_time;
                max_vertex_time = timing[0]->vertex_time;
                min_vertex_time = timing[0]->vertex_time;

                for (i = 1; i < n_processors; i++) {
                    total_rad_time += timing[i]->rad_time;
                    if (timing[i]->rad_time > max_rad_time)
                        max_rad_time = timing[i]->rad_time;
                    if (timing[i]->rad_time < min_rad_time)
                        min_rad_time = timing[i]->rad_time;

                    total_refine_time += timing[i]->refine_time;
                    if (timing[i]->refine_time > max_refine_time)
                        max_refine_time = timing[i]->refine_time;
                    if (timing[i]->refine_time < min_refine_time)
                        min_refine_time = timing[i]->refine_time;

                    total_wait_time += timing[i]->wait_time;
                    if (timing[i]->wait_time > max_wait_time)
                        max_wait_time = timing[i]->wait_time;
                    if (timing[i]->wait_time < min_wait_time)
                        min_wait_time = timing[i]->wait_time;

                    total_vertex_time += timing[i]->vertex_time;
                    if (timing[i]->vertex_time > max_vertex_time)
                        max_vertex_time = timing[i]->vertex_time;
                    if (timing[i]->vertex_time < min_vertex_time)
                        min_vertex_time = timing[i]->vertex_time;
                }


//.........这里部分代码省略.........
开发者ID:imaxxs,项目名称:Graphite,代码行数:101,代码来源:rad_main.C

示例13: main

int main(int argc, char *argv[])
{
    long i;
    long total_rad_time, max_rad_time, min_rad_time;
    long total_refine_time, max_refine_time, min_refine_time;
    long total_wait_time, max_wait_time, min_wait_time;
    long total_vertex_time, max_vertex_time, min_vertex_time;

    /* Parse arguments */
    parse_args(argc, argv) ;
    choices[2].init_value = model_selector ;

    /* Initialize graphic device */
    if( batch_mode == 0 )
        {
            g_init(argc, argv) ;
            setup_view( DFLT_VIEW_ROT_X, DFLT_VIEW_ROT_Y,
                       DFLT_VIEW_DIST, DFLT_VIEW_ZOOM,0 ) ;
        }

    /* Initialize ANL macro */
    MAIN_INITENV(,60000000) ;

    THREAD_INIT_FREE();

    /* Allocate global shared memory and initialize */
    global = (Global *) G_MALLOC(sizeof(Global)) ;
    if( global == 0 )
        {
            printf( "Can't allocate memory\n" ) ;
            exit(1) ;
        }
    init_global(0) ;

    timing = (Timing **) G_MALLOC(n_processors * sizeof(Timing *));
    for (i = 0; i < n_processors; i++)
        timing[i] = (Timing *) G_MALLOC(sizeof(Timing));

    /* Initialize shared lock */
    init_sharedlock(0) ;

    /* Initial random testing rays array for visibility test. */
    init_visibility_module(0) ;

/* POSSIBLE ENHANCEMENT:  Here is where one might distribute the
   sobj_struct, task_struct, and vis_struct data structures across
   physically distributed memories as desired.

   One way to place data is as follows:

   long i;

   for (i=0;i<n_processors;i++) {
     Place all addresses x such that
       &(sobj_struct[i]) <= x < &(sobj_struct[i+1]) on node i
     Place all addresses x such that
       &(task_struct[i]) <= x < &(task_struct[i+1]) on node i
     Place all addresses x such that
       &(vis_struct[i]) <= x < &(vis_struct[i+1]) on node i
   }

*/

    if( batch_mode )
        {
            /* In batch mode, create child processes and start immediately */

            /* Time stamp */
            CLOCK( time_rad_start );

            global->index = 0;
            for( i = 0 ; i < n_processors ; i++ )
                {
                    taskqueue_id[i] = assign_taskq(0) ;
                }

            /* And start processing */
            CREATE(radiosity, n_processors);
            WAIT_FOR_END(n_processors);

            /* Time stamp */
            CLOCK( time_rad_end );

            /* Print out running time */
            printf("TIMING STATISTICS MEASURED BY MAIN PROCESS:\n");

            print_running_time(0);

            if (dostats) {
                printf("\n\n\nPER-PROCESS STATISTICS:\n");

                printf("%8s%20s%20s%12s%12s\n","Proc","Total","Refine","Wait","Smooth");
                printf("%8s%20s%20s%12s%12s\n\n","","Time","Time","Time","Time");
                for (i = 0; i < n_processors; i++)
                    printf("%8ld%20lu%20lu%12lu%12lu\n",i,timing[i]->rad_time, timing[i]->refine_time, timing[i]->wait_time, timing[i]->vertex_time);

                total_rad_time = timing[0]->rad_time;
                max_rad_time = timing[0]->rad_time;
                min_rad_time = timing[0]->rad_time;

//.........这里部分代码省略.........
开发者ID:imaxxs,项目名称:Graphite,代码行数:101,代码来源:rad_main.C

示例14: getc

HINT_DATA *read_hint( char *filename, FILE * fp )
{
   HINT_DATA *hintData;
   const char *word;
   bool fMatch;
   char letter;

   do
   {
      letter = getc( fp );
      if( feof( fp ) )
      {
         fclose( fp );
         fp = NULL;
         return NULL;
      }
   }
   while( isspace( letter ) );
   ungetc( letter, fp );

   CREATE( hintData, HINT_DATA, 1 );
   hintData->next = NULL;
   hintData->prev = NULL;
   hintData->text = STRALLOC( "" );
   hintData->low = 0;
   hintData->high = 0;

   for( ;; )
   {
      word = feof( fp ) ? "End" : fread_word( fp );
      fMatch = FALSE;

      switch ( UPPER( word[0] ) )
      {
         case 'T':
            if( !str_cmp( word, "Text" ) )
               STRFREE( hintData->text );
            KEY( "Text", hintData->text, fread_string( fp ) );
            break;

         case 'E':
            if( !str_cmp( word, "End" ) )
            {
               if( !hintData->text )
                  hintData->text = STRALLOC( "" );
               return hintData;
            }
            break;

         case 'H':
            KEY( "High", hintData->high, fread_number( fp ) );
            break;

         case 'L':
            KEY( "Low", hintData->low, fread_number( fp ) );
            break;
      }

      if( !fMatch )
         bug( "%s: no match: %s", __func__, word );
   }
   STRFREE( hintData->text );
   DISPOSE( hintData );
   return NULL;
}
开发者ID:InfiniteAxis,项目名称:SmaugFUSS,代码行数:65,代码来源:hint.c

示例15: addfootnote

/*
 * add a new (image or link) footnote to the footnote table
 */
static Line*
addfootnote(Line *p, MMIOT* f)
{
    int j, i;
    int c;
    Line *np = p->next;

    Footnote *foot = &EXPAND(f->footnotes->note);
    
    CREATE(foot->tag);
    CREATE(foot->link);
    CREATE(foot->title);
    foot->flags = foot->height = foot->width = 0;

    for (j=i=p->dle+1; T(p->text)[j] != ']'; j++)
	EXPAND(foot->tag) = T(p->text)[j];

    EXPAND(foot->tag) = 0;
    S(foot->tag)--;
    j = nextnonblank(p, j+2);

    if ( (f->flags & MKD_EXTRA_FOOTNOTE) && (T(foot->tag)[0] == '^') ) {
	/* need to consume all lines until non-indented block? */
	while ( j < S(p->text) )
	    EXPAND(foot->title) = T(p->text)[j++];
	goto skip_to_end;
    }

    while ( (j < S(p->text)) && !isspace(T(p->text)[j]) )
	EXPAND(foot->link) = T(p->text)[j++];
    EXPAND(foot->link) = 0;
    S(foot->link)--;
    j = nextnonblank(p,j);

    if ( T(p->text)[j] == '=' ) {
	sscanf(T(p->text)+j, "=%dx%d", &foot->width, &foot->height);
	while ( (j < S(p->text)) && !isspace(T(p->text)[j]) )
	    ++j;
	j = nextnonblank(p,j);
    }


    if ( (j >= S(p->text)) && np && np->dle && tgood(T(np->text)[np->dle]) ) {
	___mkd_freeLine(p);
	p = np;
	np = p->next;
	j = p->dle;
    }

    if ( (c = tgood(T(p->text)[j])) ) {
	/* Try to take the rest of the line as a comment; read to
	 * EOL, then shrink the string back to before the final
	 * quote.
	 */
	++j;	/* skip leading quote */

	while ( j < S(p->text) )
	    EXPAND(foot->title) = T(p->text)[j++];

	while ( S(foot->title) && T(foot->title)[S(foot->title)-1] != c )
	    --S(foot->title);
	if ( S(foot->title) )	/* skip trailing quote */
	    --S(foot->title);
	EXPAND(foot->title) = 0;
	--S(foot->title);
    }

skip_to_end:
    ___mkd_freeLine(p);
    return np;
}
开发者ID:Aprilkun,项目名称:markdownlive,代码行数:74,代码来源:markdown.c


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