您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CREATE函数代码示例

51自学网 2021-06-01 20:05:23
  C++
这篇教程C++ CREATE函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例3: main

voidmain (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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例9: CREATE

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


示例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,


示例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 2006DESCRIPTION :Converts <field> into type COMPUTED_FIELD_CONNECTED_THRESHOLD_IMAGE_FILTER (if it is notalready) 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,


示例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,


示例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,


示例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,


示例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,


示例16: plugin_open

Plugin* plugin_open(const char* filename){	Plugin* plugin;	Plugin_Info* info;	Plugin_Event_Table* events;	void** procs;	int init_flag = 1;	//ShowDebug("plugin_open(%s)/n", filename);		// Check if the plugin has been loaded before	plugin = plugin_head;	while (plugin) {		// returns handle to the already loaded plugin		if( plugin->state && strcmpi(plugin->filename, filename) == 0 ){			ShowWarning("plugin_open: not loaded (duplicate) : '"CL_WHITE"%s"CL_RESET"'/n", filename);			return plugin;		}		plugin = plugin->next;	}	CREATE(plugin, Plugin, 1);	plugin->state = -1;	// not loaded	plugin->dll = DLL_OPEN(filename);	if( !plugin->dll ){		ShowWarning("plugin_open: not loaded (invalid file) : '"CL_WHITE"%s"CL_RESET"'/n", filename);		plugin_unload(plugin);		return NULL;	}	// Retrieve plugin information	plugin->state = 0;	// initialising	info = (Plugin_Info*)DLL_SYM(plugin->dll, "plugin_info");	// For high priority plugins (those that are explicitly loaded from the conf file)	// we'll ignore them even (could be a 3rd party dll file)	if( !info )	{// foreign plugin		//ShowDebug("plugin_open: plugin_info not found/n");		if( load_priority == 0 )		{// not requested			//ShowDebug("plugin_open: not loaded (not requested) : '"CL_WHITE"%s"CL_RESET"'/n", filename);			plugin_unload(plugin);			return NULL;		}	} else if( !plugin_iscompatible(info->req_version) )	{// incompatible version		ShowWarning("plugin_open: not loaded (incompatible version '%s' -> '%s') : '"CL_WHITE"%s"CL_RESET"'/n", info->req_version, PLUGIN_VERSION, filename);		plugin_unload(plugin);		return NULL;	} else if( (info->type != PLUGIN_ALL && info->type != PLUGIN_CORE && info->type != SERVER_TYPE) ||		(info->type == PLUGIN_CORE && SERVER_TYPE != PLUGIN_LOGIN && SERVER_TYPE != PLUGIN_CHAR && SERVER_TYPE != PLUGIN_MAP) )	{// not for this server		//ShowDebug("plugin_open: not loaded (incompatible) : '"CL_WHITE"%s"CL_RESET"'/n", filename);		plugin_unload(plugin);		return NULL;	}	plugin->info = ( info != NULL ? info : &default_info );	plugin->filename = aStrdup(filename);	// Initialise plugin call table (For exporting procedures)	procs = (void**)DLL_SYM(plugin->dll, "plugin_call_table");	if( procs )		*procs = plugin_call_table;	//else ShowDebug("plugin_open: plugin_call_table not found/n");	// Register plugin events	events = (Plugin_Event_Table*)DLL_SYM(plugin->dll, "plugin_event_table");	if( events ){		int i = 0;		//ShowDebug("plugin_open: parsing plugin_event_table/n");		while( events[i].func_name ){			if( strcmpi(events[i].event_name, EVENT_PLUGIN_TEST) == 0 ){				Plugin_Test_Func* test_func;				test_func = (Plugin_Test_Func*)DLL_SYM(plugin->dll, events[i].func_name);				//ShowDebug("plugin_open: invoking "EVENT_PLUGIN_TEST" with %s()/n", events[i].func_name);				if( test_func && test_func() == 0 ){					// plugin has failed test, disabling					//ShowDebug("plugin_open: disabled (failed test) : %s/n", filename);					init_flag = 0;				}			} else {				Plugin_Event_Func* func;				func = (Plugin_Event_Func*)DLL_SYM(plugin->dll, events[i].func_name);				if (func)					register_plugin_event(func, events[i].event_name);			}			i++;		}	}	//else ShowDebug("plugin_open: plugin_event_table not found/n");	plugin->next = plugin_head;	plugin_head = plugin;	plugin->state = init_flag;	// fully loaded	ShowStatus("Done loading plugin '"CL_WHITE"%s"CL_RESET"'/n", (info) ? plugin->info->name : filename);	return plugin;//.........这里部分代码省略.........
开发者ID:itaka,项目名称:hurricane,代码行数:101,


示例17: do_sharpen

//.........这里部分代码省略.........      send_to_char( "You can't sharpen something that's not a weapon./r/n", ch );      return;   }   /*    * Let's not allow people to sharpen bludgeons and the like ;)     */   /*    * small mods to make it more generic.. --Cronel     */   if( obj->value[3] != DAM_HIT       && obj->value[3] != DAM_SLICE       && obj->value[3] != DAM_STAB       && obj->value[3] != DAM_SLASH       && obj->value[3] != DAM_CLAW && obj->value[3] != DAM_BITE && obj->value[3] != DAM_PIERCE )   {      send_to_char( "You can't sharpen that type of weapon!/r/n", ch );      return;   }   if( obj->value[5] == 1 )   /* see reason below when setting */   {      send_to_char( "It is already as sharp as it's going to get./r/n", ch );      return;   }   for( pobj = ch->first_carrying; pobj; pobj = pobj->next_content )   {      if( pobj->pIndexData->vnum == OBJ_VNUM_SHARPEN )         break;   }   if( !pobj )   {      send_to_char( "You do not have a sharpening stone./r/n", ch );      return;   }   WAIT_STATE( ch, skill_table[gsn_sharpen]->beats );   /*    * Character must have the dexterity to sharpen the weapon nicely,     * * if not, damage weapon     */   if( !IS_NPC( ch ) && get_curr_dex( ch ) < 17 )   {      separate_obj( obj );      if( obj->value[0] <= 1 )      {         act( AT_OBJECT, "$p breaks apart and falls to the ground in pieces!.", ch, obj, NULL, TO_CHAR );         extract_obj( obj );         learn_from_failure( ch, gsn_sharpen );         return;      }      else      {         obj->value[0]--;         act( AT_GREEN, "You clumsily slip and damage $p!", ch, obj, NULL, TO_CHAR );         return;      }   }   percent = ( number_percent(  ) - get_curr_lck( ch ) - 15 ); /* too low a chance to damage? */   separate_obj( pobj );   if( !IS_NPC( ch ) && percent > ch->pcdata->learned[gsn_sharpen] )   {      act( AT_OBJECT, "You fail to sharpen $p correctly, damaging the stone.", ch, obj, NULL, TO_CHAR );      if( pobj->value[0] <= 1 )      {         act( AT_OBJECT, "The sharpening stone crumbles apart from misuse.", ch, pobj, NULL, TO_CHAR );         extract_obj( pobj );         learn_from_failure( ch, gsn_sharpen );         return;      }      pobj->value[0]--;      learn_from_failure( ch, gsn_sharpen );      return;   }   level = ch->level;   separate_obj( obj );   act( AT_SKILL, "With skill and precision, you sharpen $p to a fine edge.", ch, obj, NULL, TO_CHAR );   act( AT_SKILL, "With skill and precision, $n sharpens $p.", ch, obj, NULL, TO_ROOM );   CREATE( paf, AFFECT_DATA, 1 );   paf->type = -1;   paf->duration = -1;   paf->location = APPLY_DAMROLL;   paf->modifier = level / 10;   xCLEAR_BITS( paf->bitvector );   /* changed to ext BVs in upgrade --Cronel */   LINK( paf, obj->first_affect, obj->last_affect, next, prev );   obj->value[5] = 1;   /*    * originaly a sharpened object flag was used, but took up a BV,     * * so I switched to giving it a value5, which is not used in weapons     * * besides to check for this     */   learn_from_success( ch, gsn_sharpen );   return;}
开发者ID:jmdjr,项目名称:sdf-mud,代码行数:101,


示例18: vending_reopen

/*** Open vending for Autotrader* @param sd Player as autotrader*/void vending_reopen( struct map_session_data* sd ){	nullpo_retv(sd);	// Ready to open vending for this char	if ( autotrader_count > 0 && autotraders){		uint16 i;		uint8 *data, *p, fail = 0;		uint16 j, count;		ARR_FIND(0,autotrader_count,i,autotraders[i] && autotraders[i]->char_id == sd->status.char_id);		if (i >= autotrader_count) {			return;		}				// Init vending data for autotrader		CREATE(data, uint8, autotraders[i]->count * 8);		for (j = 0, p = data, count = autotraders[i]->count; j < autotraders[i]->count; j++) {			struct s_autotrade_entry *entry = autotraders[i]->entries[j];			uint16 *index = (uint16*)(p + 0);			uint16 *amount = (uint16*)(p + 2);			uint32 *value = (uint32*)(p + 4);			// Find item position in cart			ARR_FIND(0, MAX_CART, entry->index, sd->status.cart[entry->index].id == entry->cartinventory_id);			if (entry->index == MAX_CART) {				count--;				continue;			}			*index = entry->index + 2;			*amount = itemdb_isstackable(sd->status.cart[entry->index].nameid) ? entry->amount : 1;			*value = entry->price;			p += 8;		}		// Set him into a hacked prevend state		sd->state.prevend = 1;		// Make sure abort all NPCs		npc_event_dequeue(sd);		pc_cleareventtimer(sd);		// Open the vending again		if( (fail = vending_openvending(sd, autotraders[i]->title, data, count)) == 0 ){			// Set him to autotrade			if (Sql_Query( mmysql_handle, "UPDATE `%s` SET `autotrade` = 1, `body_direction` = '%d', `head_direction` = '%d', `sit` = '%d' "				"WHERE `id` = %d;",				vendings_db, autotraders[i]->dir, autotraders[i]->head_dir, autotraders[i]->sit, sd->vender_id ) != SQL_SUCCESS )			{				Sql_ShowDebug( mmysql_handle );			}			// Make vendor look perfect			pc_setdir(sd, autotraders[i]->dir, autotraders[i]->head_dir);			clif_changed_dir(&sd->bl, AREA_WOS);			if( autotraders[i]->sit ) {				pc_setsit(sd);				skill_sit(sd, 1);				clif_sitting(&sd->bl);			}			// Immediate save			chrif_save(sd, 3);			ShowInfo("Loaded vending for '"CL_WHITE"%s"CL_RESET"' with '"CL_WHITE"%d"CL_RESET"' items at "CL_WHITE"%s (%d,%d)"CL_RESET"/n",				sd->status.name, count, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);		}else{			// Failed to open the vending, set him offline			ShowError("Failed (%d) to load autotrade vending data for '"CL_WHITE"%s"CL_RESET"' with '"CL_WHITE"%d"CL_RESET"' items/n", fail, sd->status.name, count );			map_quit( sd );		}		aFree(data);		//If the last autotrade is loaded, clear autotraders [Cydh]		if (++autotrader_loaded_count >= autotrader_count)			do_final_vending_autotrade();	}}
开发者ID:Escada28,项目名称:rathena,代码行数:87,


示例19: make_water_proc

/****************************************************************************** Function: void make_water_proc(void) By: David Schwartz Date: Nov 1995 Parameters: None Returns: None Description:	setup the water background******************************************************************************/void make_water_proc(void){	alloc_vram_perm_bg_list((ADDRESS *)water_perm_list,&water_anims);	CREATE(PID_BANI,water_proc);}
开发者ID:Ced2911,项目名称:umk3,代码行数:18,


示例20: read_config

/** * Loads group configuration from config file into memory. * @private */static void read_config(void){	config_setting_t *groups = NULL;	const char *config_filename = "conf/groups.conf"; // FIXME hardcoded name	int group_count = 0;		if (conf_read_file(&pc_group_config, config_filename))		return;	groups = config_lookup(&pc_group_config, "groups");	if (groups != NULL) {		GroupSettings *group_settings = NULL;		DBIterator *iter = NULL;		int i, loop = 0;		group_count = config_setting_length(groups);		for (i = 0; i < group_count; ++i) {			int id = 0, level = 0;			const char *groupname = NULL;			int log_commands = 0;			config_setting_t *group = config_setting_get_elem(groups, i);			if (!config_setting_lookup_int(group, "id", &id)) {				ShowConfigWarning(group, "pc_groups:read_config: /"groups/" list member #%d has undefined id, removing...", i);				config_setting_remove_elem(groups, i);				--i;				--group_count;				continue;			}			if (id2group(id) != NULL) {				ShowConfigWarning(group, "pc_groups:read_config: duplicate group id %d, removing...", i);				config_setting_remove_elem(groups, i);				--i;				--group_count;				continue;			}			config_setting_lookup_int(group, "level", &level);			config_setting_lookup_bool(group, "log_commands", &log_commands);			if (!config_setting_lookup_string(group, "name", &groupname)) {				char temp[20];				config_setting_t *name = NULL;				snprintf(temp, sizeof(temp), "Group %d", id);				if ((name = config_setting_add(group, "name", CONFIG_TYPE_STRING)) == NULL ||				    !config_setting_set_string(name, temp)) {					ShowError("pc_groups:read_config: failed to set missing group name, id=%d, skipping... (%s:%d)/n",					          id, config_setting_source_file(group), config_setting_source_line(group));					continue;				}				config_setting_lookup_string(group, "name", &groupname); // Retrieve the pointer			}			if (name2group(groupname) != NULL) {				ShowConfigWarning(group, "pc_groups:read_config: duplicate group name %s, removing...", groupname);				config_setting_remove_elem(groups, i);				--i;				--group_count;				continue;			}			CREATE(group_settings, GroupSettings, 1);			group_settings->id = id;			group_settings->level = level;			group_settings->name = groupname;			group_settings->log_commands = (bool)log_commands;			group_settings->inherit = config_setting_get_member(group, "inherit");			group_settings->commands = config_setting_get_member(group, "commands");			group_settings->permissions = config_setting_get_member(group, "permissions");			group_settings->inheritance_done = false;			group_settings->root = group;			group_settings->group_pos = i;			strdb_put(pc_groupname_db, groupname, group_settings);			idb_put(pc_group_db, id, group_settings);					}		group_count = config_setting_length(groups); // Save number of groups				// Check if all commands and permissions exist		iter = db_iterator(pc_group_db);		for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {			config_setting_t *commands = group_settings->commands, *permissions = group_settings->permissions;			int count = 0, j;			// Make sure there is "commands" group			if (commands == NULL)				commands = group_settings->commands = config_setting_add(group_settings->root, "commands", CONFIG_TYPE_GROUP);			count = config_setting_length(commands);			for (j = 0; j < count; ++j) {				config_setting_t *command = config_setting_get_elem(commands, j);				const char *name = config_setting_name(command);				if (!atcommand_exists(name)) {//.........这里部分代码省略.........
开发者ID:AsaK,项目名称:rathena,代码行数:101,


示例21: buyingstore_reopen

/*** Open buyingstore for Autotrader* @param sd Player as autotrader*/void buyingstore_reopen( struct map_session_data* sd ){	nullpo_retv(sd);	// Ready to open buyingstore for this char	if ( autotrader_count > 0 && autotraders){		uint16 i;		uint8 *data, *p, fail = 0;		uint16 j, count;		ARR_FIND(0,autotrader_count,i,autotraders[i] && autotraders[i]->char_id == sd->status.char_id);		if (i >= autotrader_count) {			return;		}				// Init buyingstore data for autotrader		CREATE(data, uint8, autotraders[i]->count * 8);		for (j = 0, p = data, count = autotraders[i]->count; j < autotraders[i]->count; j++) {			struct s_autotrade_entry *entry = autotraders[i]->entries[j];			unsigned short *item_id = (uint16*)(p + 0);			uint16 *amount = (uint16*)(p + 2);			uint32 *price = (uint32*)(p + 4);			*item_id = entry->item_id;			*amount = entry->amount;			*price = entry->price;			p += 8;		}		// Make sure abort all NPCs		npc_event_dequeue(sd);		pc_cleareventtimer(sd);		// Open the buyingstore again		if( (fail = buyingstore_setup( sd, (unsigned char)autotraders[i]->count )) == 0 &&			(fail = buyingstore_create( sd, autotraders[i]->limit, 1, autotraders[i]->title, data, autotraders[i]->count )) == 0 )		{			ShowInfo("Loaded buyingstore for '"CL_WHITE"%s"CL_RESET"' with '"CL_WHITE"%d"CL_RESET"' items at "CL_WHITE"%s (%d,%d)"CL_RESET"/n",				sd->status.name, count, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);			// Set him to autotrade			if (Sql_Query( mmysql_handle, "UPDATE `%s` SET `autotrade` = 1, `body_direction` = '%d', `head_direction` = '%d', `sit` = '%d' "				"WHERE `id` = %d;",				buyingstores_db, autotraders[i]->dir, autotraders[i]->head_dir, autotraders[i]->sit, sd->buyer_id ) != SQL_SUCCESS )			{				Sql_ShowDebug( mmysql_handle );			}			// Make buyer look perfect			pc_setdir(sd, autotraders[i]->dir, autotraders[i]->head_dir);			clif_changed_dir(&sd->bl, AREA_WOS);			if( autotraders[i]->sit ) {				pc_setsit(sd);				skill_sit(sd, 1);				clif_sitting(&sd->bl);			}			// Immediate save			chrif_save(sd, 3);		}else{			// Failed to open the buyingstore, set him offline			ShowError("Failed (%d) to load autotrade buyingstore data for '"CL_WHITE"%s"CL_RESET"' with '"CL_WHITE"%d"CL_RESET"' items/n", fail, sd->status.name, count );			map_quit( sd );		}		aFree(data);		//If the last autotrade is loaded, clear autotraders [Cydh]		if (++autotrader_loaded_count >= autotrader_count)			do_final_buyingstore_autotrade();	}}
开发者ID:AsaK,项目名称:rathena,代码行数:78,


示例22: main

//.........这里部分代码省略.........       if (gp[my_num].rljen[i] == jmx[i]-2) {         gp[my_num].rljen[i] = gp[my_num].rljen[i] - 1;         if (gp[my_num].rljen[i] % 2 == 0) {           gp[my_num].oiest[i] = gp[my_num].oist[i];           gp[my_num].eiest[i] = gp[my_num].eist[i];         } else {           gp[my_num].oiest[i] = gp[my_num].eist[i];           gp[my_num].eiest[i] = gp[my_num].oist[i];         }       }     }   }/* initialize constants and variables   id is a global shared variable that has fetch-and-add operations   performed on it by processes to obtain their pids.   */   global->id = 0;   global->psibi = 0.0;   pi = atan(1.0);   pi = 4.*pi;   factjacob = -1./(12.*res*res);   factlap = 1./(res*res);   eig2 = -h*f0*f0/(h1*h3*gpr);   jmm1 = jm-1 ;   ysca = ((double) jmm1)*res ;   for (i=0;i<im;i++) {     for (j=0;j<jm;j++) {       guess->oldga[i][j] = 0.0;       guess->oldgb[i][j] = 0.0;     }   }   if (do_output) {     printf("                       MULTIGRID OUTPUTS/n");   }   CREATE(slave, nprocs);   WAIT_FOR_END(nprocs);   CLOCK(computeend)   printf("/n");   printf("                       PROCESS STATISTICS/n");   printf("                  Total          Multigrid         Multigrid/n");   printf(" Proc             Time             Time            Fraction/n");   printf("    0   %15.0f    %15.0f        %10.3f/n", gp[0].total_time,gp[0].multi_time, gp[0].multi_time/gp[0].total_time);   if (do_stats) {     min_total = max_total = avg_total = gp[0].total_time;     min_multi = max_multi = avg_multi = gp[0].multi_time;     min_frac = max_frac = avg_frac = gp[0].multi_time/gp[0].total_time;     for (i=1;i<nprocs;i++) {       if (gp[i].total_time > max_total) {         max_total = gp[i].total_time;       }       if (gp[i].total_time < min_total) {         min_total = gp[i].total_time;       }       if (gp[i].multi_time > max_multi) {         max_multi = gp[i].multi_time;       }       if (gp[i].multi_time < min_multi) {         min_multi = gp[i].multi_time;       }       if (gp[i].multi_time/gp[i].total_time > max_frac) {         max_frac = gp[i].multi_time/gp[i].total_time;       }       if (gp[i].multi_time/gp[i].total_time < min_frac) {         min_frac = gp[i].multi_time/gp[i].total_time;       }       avg_total += gp[i].total_time;       avg_multi += gp[i].multi_time;       avg_frac += gp[i].multi_time/gp[i].total_time;     }     avg_total = avg_total / nprocs;     avg_multi = avg_multi / nprocs;     avg_frac = avg_frac / nprocs;     for (i=1;i<nprocs;i++) {       printf("  %3ld   %15.0f    %15.0f        %10.3f/n", i, gp[i].total_time, gp[i].multi_time, gp[i].multi_time/gp[i].total_time);     }     printf("  Avg   %15.0f    %15.0f        %10.3f/n", avg_total,avg_multi,avg_frac);     printf("  Min   %15.0f    %15.0f        %10.3f/n", min_total,min_multi,min_frac);     printf("  Max   %15.0f    %15.0f        %10.3f/n", max_total,max_multi,max_frac);   }   printf("/n");   global->starttime = start;   printf("                       TIMING INFORMATION/n");   printf("Start time                        : %16lu/n", global->starttime);   printf("Initialization finish time        : %16lu/n", global->trackstart);   printf("Overall finish time               : %16lu/n", computeend);   printf("Total time with initialization    : %16lu/n", computeend-global->starttime);   printf("Total time without initialization : %16lu/n", computeend-global->trackstart);   printf("    (excludes first timestep)/n");   printf("/n");   MAIN_END}
开发者ID:fpetrot,项目名称:Splash-3,代码行数:101,


示例23: define_Computed_field_type_eigenvectors

int define_Computed_field_type_eigenvectors(struct Parse_state *state,	void *field_modify_void,void *computed_field_matrix_operators_package_void)/*******************************************************************************LAST MODIFIED : 25 August 2006DESCRIPTION :Converts <field> into type 'eigenvectors' (if it is not  already) and allowsits contents to be modified.==============================================================================*/{	int return_code;	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_eigenvectors);	USE_PARAMETER(computed_field_matrix_operators_package_void);	if (state&&(field_modify=(Computed_field_modify_data *)field_modify_void))	{		return_code=1;		/* get valid parameters for projection field */		source_field = (struct Computed_field *)NULL;		if ((NULL != field_modify->get_field()) &&			(computed_field_eigenvectors_type_string ==				Computed_field_get_type_string(field_modify->get_field())))		{			return_code=Computed_field_get_type_eigenvectors(field_modify->get_field(), &source_field);		}		if (return_code)		{			/* must access objects for set functions */			if (source_field)			{				ACCESS(Computed_field)(source_field);			}			option_table = CREATE(Option_table)();			Option_table_add_help(option_table,			  "An eigenvectors field returns vectors corresponding to each eigenvalue from a source eigenvalues field.  For example, if 3 eigenvectors have been computed for a (3 * 3) matrix = 9 component field, the eigenvectors will be a 9 component field with the eigenvector corresponding to the first eigenvalue in the first 3 components, the second eigenvector in the next 3 components, and so on.  See a/large_strain for an example of using the eigenvalues and eigenvectors fields.");			/* field */			set_source_field_data.computed_field_manager =				field_modify->get_field_manager();			set_source_field_data.conditional_function =				Computed_field_is_type_eigenvalues_conditional;			set_source_field_data.conditional_function_user_data = (void *)NULL;			Option_table_add_entry(option_table, "eigenvalues", &source_field,				&set_source_field_data, set_Computed_field_conditional);			return_code = Option_table_multi_parse(option_table, state);			if (return_code)			{				return_code = field_modify->update_field_and_deaccess(					cmzn_fieldmodule_create_field_eigenvectors(field_modify->get_field_module(),						source_field));			}			if (source_field)			{				DEACCESS(Computed_field)(&source_field);			}			DESTROY(Option_table)(&option_table);		}	}	else	{		display_message(ERROR_MESSAGE,			"define_Computed_field_type_eigenvectors.  Invalid argument(s)");		return_code=0;	}	LEAVE;	return (return_code);} /* define_Computed_field_type_eigenvectors */
开发者ID:alan-wu,项目名称:cmgui,代码行数:71,


示例24: hotboot_recover

/* Recover from a hotboot - load players */void hotboot_recover( void ){   DESCRIPTOR_DATA *d = NULL;   FILE *fp;   char name[100];   char host[MAX_STRING_LENGTH];   int desc, room, dport, idle, dcompress, maxp = 0;   bool fOld;   fp = fopen( HOTBOOT_FILE, "r" );   if( !fp )   /* there are some descriptors open which will hang forever then ? */   {      perror( "hotboot_recover: fopen" );      bug( "%s", "Hotboot file not found. Exitting." );      exit( 1 );   }   unlink( HOTBOOT_FILE ); /* In case something crashes - doesn't prevent reading */   for( ;; )   {      d = NULL;      fscanf( fp, "%d %d %d %d %d %s %s/n", &dcompress, &desc, &room, &dport, &idle, name, host );      if( desc == -1 || feof( fp ) )         break;      if( !str_cmp( name, "maxp" ) || !str_cmp( host, "maxp" ) )      {         maxp = idle;         continue;      }      /*       * Write something, and check if it goes error-free        */      if( !write_to_descriptor_old( desc, "/r/nThe Force swirls around you./r/n", 0 ) )      {         close( desc ); /* nope */         continue;      }      CREATE( d, DESCRIPTOR_DATA, 1 );      CREATE( d->mccp, MCCP, 1 );      d->next = NULL;      d->descriptor = desc;      d->connected = CON_GET_NAME;      d->outsize = 2000;      d->idle = 0;      d->lines = 0;      d->scrlen = 24;      d->newstate = 0;      d->prevcolor = 0x08;      d->ifd = -1;      d->ipid = -1;      CREATE( d->outbuf, char, d->outsize );      d->host = STRALLOC( host );      d->port = dport;      d->idle = idle;#ifdef MCCP      if( dcompress )         write_to_buffer( d, compress2_on_str_2, 0 );#endif      LINK( d, first_descriptor, last_descriptor, next, prev );      d->connected = CON_COPYOVER_RECOVER;   /* negative so close_socket will cut them off *///      d->can_compress = dcompress;//      if( d->can_compress )//         compressStart( d );      /*       * Now, find the pfile        */      fOld = load_char_obj( d, name, FALSE, TRUE );      if( !fOld ) /* Player file not found?! */      {         write_to_descriptor( d, "/r/nSomehow, your character was lost during hotboot. Contact the immortals ASAP./r/n", 0 );         close_socket( d, FALSE );      }      else  /* ok! */      {         write_to_descriptor( d, "Suddenly, you remember nothing as the Force continues into the Galaxy./r/n", 0 );         d->character->in_room = get_room_index( room );         if( !d->character->in_room )            d->character->in_room = get_room_index( ROOM_VNUM_TEMPLE );         /*          * Insert in the char_list           */         LINK( d->character, first_char, last_char, next, prev );         char_to_room( d->character, d->character->in_room );         act( AT_MAGIC, "You appear in a swirl of the Force!", d->character, NULL, NULL, TO_CHAR );         act( AT_MAGIC, "$n appears in a swrrl of the Force!", d->character, NULL, NULL, TO_ROOM );         d->connected = CON_PLAYING;         if( ++num_descriptors > sysdata.maxplayers )//.........这里部分代码省略.........
开发者ID:m241dan,项目名称:swrproject,代码行数:101,


示例25: define_Computed_field_type_matrix_invert

int define_Computed_field_type_matrix_invert(struct Parse_state *state,	void *field_modify_void, void *computed_field_matrix_operators_package_void)/*******************************************************************************LAST MODIFIED : 25 August 2006DESCRIPTION :Converts <field> into type 'matrix_invert' (if it is not already) and allows itscontents to be modified.==============================================================================*/{	int return_code;	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_matrix_invert);	USE_PARAMETER(computed_field_matrix_operators_package_void);	if (state&&(field_modify=(Computed_field_modify_data *)field_modify_void))	{		return_code = 1;		source_field = (struct Computed_field *)NULL;		if ((NULL != field_modify->get_field()) &&			(computed_field_matrix_invert_type_string ==				Computed_field_get_type_string(field_modify->get_field())))		{			return_code = Computed_field_get_type_matrix_invert(field_modify->get_field(), &source_field);		}		if (return_code)		{			if (source_field)			{				ACCESS(Computed_field)(source_field);			}			option_table = CREATE(Option_table)();			Option_table_add_help(option_table,			  "A matrix_invert field returns the inverse of a square matrix.  Here, a 9 component source field is interpreted as a (3 * 3) matrix with the first 3 components being the first row, the next 3 components being the middle row, and so on.  See a/current_density for an example of using the matrix_invert field.");			set_source_field_data.conditional_function =				Computed_field_is_square_matrix;			set_source_field_data.conditional_function_user_data = (void *)NULL;			set_source_field_data.computed_field_manager =				field_modify->get_field_manager();			Option_table_add_entry(option_table, "field", &source_field,				&set_source_field_data, set_Computed_field_conditional);			return_code = Option_table_multi_parse(option_table, state);			if (return_code)			{				return_code = field_modify->update_field_and_deaccess(					cmzn_fieldmodule_create_field_matrix_invert(field_modify->get_field_module(),						source_field));			}			DESTROY(Option_table)(&option_table);			if (source_field)			{				DEACCESS(Computed_field)(&source_field);			}		}	}	else	{		display_message(ERROR_MESSAGE,			"define_Computed_field_type_matrix_invert.  Invalid argument(s)");		return_code=0;	}	LEAVE;	return (return_code);} /* define_Computed_field_type_matrix_invert */
开发者ID:alan-wu,项目名称:cmgui,代码行数:68,


示例26: vm_create

intvm_create(const char *name){	return (CREATE((char *)name));}
开发者ID:amir-partovi,项目名称:Taha,代码行数:6,


示例27: define_Computed_field_type_matrix_multiply

int define_Computed_field_type_matrix_multiply(struct Parse_state *state,	void *field_modify_void,void *computed_field_matrix_operators_package_void)/*******************************************************************************LAST MODIFIED : 25 August 2006DESCRIPTION :Converts <field> into type COMPUTED_FIELD_MATRIX_MULTIPLY (if it is notalready) and allows its contents to be modified.==============================================================================*/{	const char *current_token;	int i, number_of_rows, return_code;	struct Computed_field **source_fields;	Computed_field_modify_data *field_modify;	struct Option_table *option_table;	struct Set_Computed_field_array_data set_field_array_data;	struct Set_Computed_field_conditional_data set_field_data;	ENTER(define_Computed_field_type_matrix_multiply);	USE_PARAMETER(computed_field_matrix_operators_package_void);	if (state&&(field_modify=(Computed_field_modify_data *)field_modify_void))	{		return_code=1;		if (ALLOCATE(source_fields,struct Computed_field *,2))		{			/* get valid parameters for matrix_multiply field */			number_of_rows = 1;			source_fields[0] = (struct Computed_field *)NULL;			source_fields[1] = (struct Computed_field *)NULL;			if ((NULL != field_modify->get_field()) &&				(computed_field_matrix_multiply_type_string ==					Computed_field_get_type_string(field_modify->get_field())))			{				return_code=Computed_field_get_type_matrix_multiply(field_modify->get_field(),					&number_of_rows,&(source_fields[0]),&(source_fields[1]));			}			if (return_code)			{				/* ACCESS the source fields for set_Computed_field_array */				for (i=0;i<2;i++)				{					if (source_fields[i])					{						ACCESS(Computed_field)(source_fields[i]);					}				}				/* try to handle help first */				current_token=state->current_token;				if (current_token != 0)				{					if (!(strcmp(PARSER_HELP_STRING,current_token)&&						strcmp(PARSER_RECURSIVE_HELP_STRING,current_token)))					{						option_table = CREATE(Option_table)();						Option_table_add_help(option_table,						  "A matrix_mutliply field calculates the product of two matrices, giving a new m by n matrix.  The product is represented as a field with a list of (m * n) components.   The components of the matrix are listed row by row.  The <number_of_rows> m is used to infer the dimensions of the source matrices.  The two source <fields> are multiplied, with the components of the first interpreted as a matrix with dimensions m by s and the second as a matrix with dimensions s by n.  If the matrix dimensions are not consistent then an error is returned.  See a/curvature for an example of using the matrix_multiply field.");						Option_table_add_entry(option_table,"number_of_rows",							&number_of_rows,NULL,set_int_positive);						set_field_data.conditional_function=							Computed_field_has_numerical_components;						set_field_data.conditional_function_user_data=(void *)NULL;						set_field_data.computed_field_manager=							field_modify->get_field_manager();						set_field_array_data.number_of_fields=2;						set_field_array_data.conditional_data= &set_field_data;						Option_table_add_entry(option_table,"fields",source_fields,							&set_field_array_data,set_Computed_field_array);						return_code=Option_table_multi_parse(option_table,state);						DESTROY(Option_table)(&option_table);					}					else					{						/* if the "number_of_rows" token is next, read it */						if (fuzzy_string_compare(current_token,"number_of_rows"))						{							option_table = CREATE(Option_table)();							/* number_of_rows */							Option_table_add_entry(option_table,"number_of_rows",								&number_of_rows,NULL,set_int_positive);							return_code = Option_table_parse(option_table,state);							DESTROY(Option_table)(&option_table);						}						if (return_code)						{							option_table = CREATE(Option_table)();							set_field_data.conditional_function=								Computed_field_has_numerical_components;							set_field_data.conditional_function_user_data=(void *)NULL;							set_field_data.computed_field_manager=								field_modify->get_field_manager();							set_field_array_data.number_of_fields=2;							set_field_array_data.conditional_data= &set_field_data;							Option_table_add_entry(option_table,"fields",source_fields,								&set_field_array_data,set_Computed_field_array);							return_code = Option_table_multi_parse(option_table, state);							if (return_code)							{								return_code = field_modify->update_field_and_deaccess(									cmzn_fieldmodule_create_field_matrix_multiply(field_modify->get_field_module(),										number_of_rows, source_fields[0], source_fields[1]));//.........这里部分代码省略.........
开发者ID:alan-wu,项目名称:cmgui,代码行数:101,


示例28: LearnFileAdd

#include "taname.h"#include "uaquest.h"#include "utilbb.h"#include "utildbg.h"#include "utillrn.h"FILE	*StreamSuggEnglishInfl, *StreamSuggFrenchInfl;/* LearnFile */LearnFile *LearnFiles;void LearnFileAdd(char *fn, Obj *class){  LearnFile	*lf;  lf = CREATE(LearnFile);  lf->class = class;  if (NULL == (lf->stream = StreamOpen(fn, "w+"))) {    lf->stream = stdout;  }  lf->last_parent = NULL;  lf->last_obj = NULL;  TsRangeSetNa(&lf->last_tsr);  lf->close_assertion = 0;  lf->last_input_text1[0] = TERM;  lf->last_input_text2[0] = TERM;  lf->next = LearnFiles;  LearnFiles = lf;}LearnFile *LearnFileFindCatchall()
开发者ID:plucena,项目名称:talkagent,代码行数:31,


示例29: main

//.........这里部分代码省略.........	if (!GlobalHeapInit(MaxGlobMem))		{		fprintf(stderr, "%s: Cannot initialize global heap./n", ProgName);		exit(1);		}	/*	 *	Initialize HUG parameters, read environment and geometry files.	 */	Huniform_defaults();	ReadEnvFile(/* *argv*/argv[i]);	ReadGeoFile(GeoFileName);	OpenFrameBuffer();	/*	 *	Compute view transform and its inverse.	 */	CreateViewMatrix();	MatrixCopy(vtrans, View.vtrans);	MatrixInverse(Vinv, vtrans);	MatrixCopy(View.vtransInv, Vinv);	/*	 *	Print out what we have so far.	 */	printf("Number of primitive objects: /t%ld/n", prim_obj_cnt);	printf("Number of primitive elements:/t%ld/n", prim_elem_cnt);	/*	 *	Preprocess database into hierarchical uniform grid.	 */	if (TraversalType == TT_HUG)		BuildHierarchy_Uniform();	/*	 *	Now create slave processes.	 */	CLOCK(begin)	CREATE(StartRayTrace, gm->nprocs);	WAIT_FOR_END(gm->nprocs);	CLOCK(end)	/*	 *	We are finished.  Clean up, print statistics and run time.	 */	CloseFrameBuffer(PicFileName);	PrintStatistics();	lapsed = (end - begin) & 0x7FFFFFFF;	printf("TIMING STATISTICS MEASURED BY MAIN PROCESS:/n");	printf("        Overall start time     %20lu/n", begin);	printf("        Overall end time   %20lu/n", end);	printf("        Total time with initialization  %20lu/n", lapsed);	printf("        Total time without initialization  %20lu/n", end - gm->par_start_time);    if (dostats) {        unsigned totalproctime, maxproctime, minproctime;        printf("/n/n/nPER-PROCESS STATISTICS:/n");        printf("%20s%20s/n","Proc","Time");        printf("%20s%20s/n/n","","Tracing Rays");        for (i = 0; i < gm->nprocs; i++)            printf("%20ld%20ld/n",i,gm->partime[i]);        totalproctime = gm->partime[0];        minproctime = gm->partime[0];        maxproctime = gm->partime[0];        for (i = 1; i < gm->nprocs; i++) {            totalproctime += gm->partime[i];            if (gm->partime[i] > maxproctime)                maxproctime = gm->partime[i];            if (gm->partime[i] < minproctime)                minproctime = gm->partime[i];        }        printf("/n/n%20s%20d/n","Max = ",maxproctime);        printf("%20s%20d/n","Min = ",minproctime);        printf("%20s%20d/n","Avg = ",(int) (((double) totalproctime) / ((double) (1.0 * gm->nprocs))));    }	MAIN_END	}
开发者ID:elau,项目名称:graphite_pep,代码行数:101,



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


C++ CREATE_ABC函数代码示例
C++ CRC函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。