Esempio n. 1
0
static inline Object File_InternalReadString(Object _self, long maxLength, long stopSymbolsLength, long* stopSymbols)
{
	Object _toReturn = List_Create();
	Object_Autorelease(_toReturn);
	while(maxLength--) {
		Object _char = File_ReadChar(_self);
		if(_char == _nil)
		{
			if(List_Size(_toReturn) == 0)
			{
				return _nil;
			} else {
				return _toReturn;
			}
		} else {
			int i;
			long code = Number_GetLong(Char_GetMutableCode(_char));
			for(i = 0; i < stopSymbolsLength; i++)
			{
				if(code == stopSymbols[i])
					return _toReturn;
			}
			List_PushBack(_toReturn, _char);
		}
	}
	return _toReturn;
}
Esempio n. 2
0
int main( int argc, char* argv[] ) {
	MPI_Comm			CommWorld;
	int				rank;
	int				numProcessors;
	int				procToWatch;
	
	
	/* Initialise MPI, get world info */
	MPI_Init( &argc, &argv );
	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
	MPI_Comm_size( CommWorld, &numProcessors );
	MPI_Comm_rank( CommWorld, &rank );

	BaseFoundation_Init( &argc, &argv );
	BaseIO_Init( &argc, &argv );
	BaseContainer_Init( &argc, &argv );

	if( argc >= 2 ) {
		procToWatch = atoi( argv[1] );
	}
	else {
		procToWatch = 0;
	}
	
	if( rank == procToWatch ) {
		List*			list;
		Index			idx;
		Stream*			stream;
		
		stream = Journal_Register( Info_Type, "myStream" );
		
		list = List_New( sizeof(unsigned) );
		for( idx = 0; idx < 100; idx++ ) {
			List_Resize( list, List_Size( list ) + 1 );
			List_ElementAt( list, unsigned, idx ) = 100 - idx;
		}
		
		Print( list, stream );
		
		printf( "List Data:\n" );
		for( idx = 0; idx < 100; idx++ )
			printf( "\telements[%d]: %d\n", idx, List_ElementAt( list, unsigned, idx ) );
		
		Stg_Class_Delete( list );
	}