void wxSheetArrayEdge::SetSize(size_t item, int size) { wxCHECK_RET(int(item) < GetCount(), wxT("Invalid edge index")); const int old_size = GetSize(item); if (size == old_size) return; // set to the min size if less than it const int min_size = GetMinSize(item); if (size < min_size) size = min_size; // need to really create the array if ( m_data.IsEmpty() ) InitArray(); const int diff = size - old_size; const int count = m_data.GetCount(); for ( int i = item; i < count; i++ ) m_data[i] += diff; if (size == m_default_size) CheckMinimize(); }
ScenarioDataMgr::ScenarioDataMgr() { InitArray(); m_rawDataSet.RemoveAll(); }
void InitSymData( TYPEPTR typ, TYPEPTR ctyp, int level ) { TOKEN token; unsigned long size; SKIP_TYPEDEFS( typ ); if( typ->decl_type == TYPE_ENUM ) typ = typ->object; /* 07-nov-90 */ token = CurToken; if( CurToken == T_LEFT_BRACE ) { NextToken(); if( CurToken == T_RIGHT_BRACE || CurToken == T_COMMA ) { CErr1( ERR_EMPTY_INITIALIZER_LIST ); } } size = SizeOfArg( typ ); switch( typ->decl_type ) { case TYPE_ARRAY: if( CharArray( typ->object ) ) { InitCharArray( typ ); } else if( WCharArray( typ->object ) ) { InitWCharArray( typ ); } else { if( token == T_LEFT_BRACE ) { ctyp = typ; } else if( level == 0 ) { CErr1( ERR_NEED_BRACES ); } if( typ == ctyp ) { /* initialize new current type */ /* first zero out the whole array; otherwise overlapping fields caused by designated initializers will make life very difficult */ ZeroBytes( size ); RelSeekBytes( -size ); } InitArray( typ, ctyp ); } break; case TYPE_FCOMPLEX: case TYPE_DCOMPLEX: case TYPE_LDCOMPLEX: case TYPE_STRUCT: if( token == T_LEFT_BRACE ) { ctyp = typ; } else if( level == 0 ) { CErr1( ERR_NEED_BRACES ); } if( typ == ctyp ) { /* initialize new current type */ /* zero out all fields; otherwise overlapping fields caused by designated initializers will make life very difficult */ ZeroBytes( size ); RelSeekBytes( -size ); } InitStruct( typ, ctyp ); break; case TYPE_UNION: if( token == T_LEFT_BRACE ) { ctyp = typ; } else if( level == 0 ) { CErr1( ERR_NEED_BRACES ); } InitUnion( typ, ctyp ); break; case TYPE_CHAR: case TYPE_UCHAR: case TYPE_BOOL: case TYPE_SHORT: case TYPE_USHORT: case TYPE_INT: case TYPE_UINT: case TYPE_LONG: case TYPE_ULONG: case TYPE_POINTER: StorePointer( typ, size ); break; case TYPE_LONG64: case TYPE_ULONG64: StoreInt64( typ ); break; case TYPE_FLOAT: case TYPE_DOUBLE: case TYPE_FIMAGINARY: case TYPE_DIMAGINARY: StoreFloat( typ->decl_type, size ); break; case TYPE_LONG_DOUBLE: case TYPE_LDIMAGINARY: //StoreFloat( typ->decl_type, size ); StoreFloat( TYPE_DOUBLE, size ); break; default: break; } if( token == T_LEFT_BRACE ) { if( CurToken == T_COMMA ) { NextToken(); } if( CurToken != T_RIGHT_BRACE ) { CErr1( ERR_TOO_MANY_INITS ); } while( CurToken != T_RIGHT_BRACE ) { if( CurToken == T_EOF ) break; if( CurToken == T_SEMI_COLON )break; if( CurToken == T_LEFT_BRACE )break; NextToken(); } MustRecog( T_RIGHT_BRACE ); } }
void TRI_InitArray2Json (TRI_memory_zone_t* zone, TRI_json_t* result, size_t initialSize) { InitArray(zone, result, initialSize); }
void TRI_InitArrayJson (TRI_memory_zone_t* zone, TRI_json_t* result) { InitArray(zone, result, 0); }
/****************************************************************************** Main - Setup the XConnection,request the window list and loop forever Based on main() from FvwmIdent: Copyright 1994, Robert Nation and Nobutaka Suzuki. ******************************************************************************/ int main(int argc, char **argv) { char *temp, *s; /* Save the program name for error messages and config parsing */ temp = argv[0]; s=strrchr(argv[0], '/'); if (s != NULL) temp = s + 1; /* Setup my name */ Module = safemalloc(strlen(temp)+2); strcpy(Module,"*"); strcat(Module, temp); Clength = strlen(Module); /* Open the console for messages */ OpenConsole(); if((argc != 6)&&(argc != 7)) { fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",Module, VERSION); ConsoleMessage("%s Version %s should only be executed by fvwm!\n",Module, VERSION); exit(1); } if ((argc==7)&&(!strcasecmp(argv[6],"Transient"))) Transient=1; Fvwm_fd[0] = atoi(argv[1]); Fvwm_fd[1] = atoi(argv[2]); signal (SIGPIPE, DeadPipe); /* Parse the config file */ ParseConfig(); /* Setup the XConnection */ StartMeUp(); XSetErrorHandler((XErrorHandler) ErrorHandler); InitPictureCMap(dpy, Root); InitArray(&buttons,0,0,win_width, fontheight+6); InitList(&windows); fd_width = GetFdWidth(); /* Request a list of all windows, * wait for ConfigureWindow packets */ SendFvwmPipe("Send_WindowList",0); /* SetMessageMask(Fvwm_fd,M_ADD_WINDOW|M_CONFIGURE_WINDOW| M_DESTROY_WINDOW| M_WINDOW_NAME|M_ICON_NAME|M_DEICONIFY|M_ICONIFY|M_END_WINDOWLIST| M_NEW_DESK| M_NEW_PAGE);*/ /* Recieve all messages from Fvwm */ EndLessLoop(); return 0; }
VersionInfo::VersionInfo() { InitArray(); }
AFTDriverMgr::AFTDriverMgr() { InitArray(); }
////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// PipeData::PipeData() { InitArray(); }
/****************************************************************************** Main - Setup the XConnection,request the window list and loop forever Based on main() from FvwmIdent: Copyright 1994, Robert Nation and Nobutaka Suzuki. ******************************************************************************/ int main(int argc, char **argv) { char *temp, *s; #ifdef HAVE_SIGACTION struct sigaction sigact; #endif /* Save the program name for error messages and config parsing */ temp = argv[0]; s=strrchr(argv[0], '/'); if (s != NULL) temp = s + 1; /* Setup my name */ Module = safemalloc(strlen(temp)+2); strcpy(Module,"*"); strcat(Module, temp); Clength = strlen(Module); /* Open the console for messages */ OpenConsole(); if((argc != 6)&&(argc != 7)) { fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",Module, VERSION); ConsoleMessage("%s Version %s should only be executed by fvwm!\n",Module, VERSION); exit(1); } if ((argc==7)&&(!strcasecmp(argv[6],"Transient"))) Transient=1; Fvwm_fd[0] = atoi(argv[1]); Fvwm_fd[1] = atoi(argv[2]); #ifdef HAVE_SIGACTION #ifdef SA_INTERRUPT sigact.sa_flags = SA_INTERRUPT; #else sigact.sa_flags = 0; #endif sigemptyset(&sigact.sa_mask); sigact.sa_handler = TerminateHandler; sigaction(SIGPIPE, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); #else signal(SIGPIPE, TerminateHandler); signal(SIGTERM, TerminateHandler); #ifdef HAVE_SIGINTERRUPT siginterrupt(SIGPIPE, True); siginterrupt(SIGTERM, True); #endif #endif /* Parse the config file */ ParseConfig(); /* Setup the XConnection */ StartMeUp(); XSetErrorHandler(ErrorHandler); InitPictureCMap(dpy, Root); InitArray(&buttons,0,0,win_width, fontheight+6); InitList(&windows); fd_width = GetFdWidth(); /* Request a list of all windows, * wait for ConfigureWindow packets */ SetMessageMask(Fvwm_fd,M_CONFIGURE_WINDOW | M_RES_CLASS | M_RES_NAME | M_ADD_WINDOW | M_DESTROY_WINDOW | M_ICON_NAME | M_DEICONIFY | M_ICONIFY | M_END_WINDOWLIST | M_NEW_DESK | M_NEW_PAGE | M_FOCUS_CHANGE | M_WINDOW_NAME | #ifdef MINI_ICONS M_MINI_ICON | #endif M_STRING); SendFvwmPipe("Send_WindowList",0); /* Recieve all messages from Fvwm */ atexit(ShutMeDown); MainEventLoop(); return 0; }
PrintFontRef::PrintFontRef() { InitArray(); }
int main(int argc, char **argv) { MPI_Init(&argc, &argv); double start_time, end_time; // Print some info omp_set_nested(1); int maxThreads = omp_get_max_threads(); printf("Available threads: %d\n", maxThreads); // Initialize the array. InitArray(); // Print data if in debug mode. if (DEBUG) { printf("===== BEFORE QUICK SORT (SEQ) =====\n\n"); PrintArray(); printf("===================================\n\n\n"); } // Start timer. start_time = MPI_Wtime(); // Split into 8 pieces and sort int subArraySize = ITEMS / maxThreads; int maxInd = ((maxThreads - 1) * subArraySize) - 1 + subArraySize; int i; #pragma omp parallel for for (i = 0; i < maxThreads; i++) { QuickSort(v, i * subArraySize, (i * subArraySize) - 1 + subArraySize); } // Sort the pieces int j; for (i = 0; i < ITEMS / maxThreads; i++) { for (j = 0; j < maxThreads; j++) { sorted[maxThreads * i + j] = v[subArraySize * j + i]; } } #pragma omp parallel for for (i = 0; i < subArraySize; i++) { QuickSort(sorted, i * maxThreads, i * maxThreads + maxThreads - 1); } // Stop timer. end_time = MPI_Wtime(); // Print data if in debug mode. if (DEBUG) { printf("===== AFTER QUICK SORT (SEQ) ======\n\n"); PrintArray(); printf("===================================\n\n"); } else { printf("Lowest: %d\n", sorted[0]); printf("Highest: %d\n", sorted[ITEMS - 1]); } double time_taken = (end_time - start_time); printf("Execution time: %fs\n", time_taken); CleanMemory(); }
void TRI_InitArrayJson (TRI_memory_zone_t* zone, TRI_json_t* result, size_t length) { InitArray(zone, result, length); }
TranContorlData::TranContorlData() { InitArray(); }
void Start() { InitArray(); InitArrayString(); PointerVsArray(); AccessElementIn2DArray(); }
WorkSpace::WorkSpace() { InitArray(); }
Annotations::Annotations() { InitArray(); }
Map::Map(int xsize, int ysize) { InitArray(xsize, ysize); }