Linked_List LISTcopy( Linked_List src ) { Linked_List dst = LISTcreate(); LISTdo( src, x, Generic ) LISTadd( dst, x ); LISTod return dst; }
/** return ref'd entities */ static void SCHEMA_get_entities_ref( Scope scope, Linked_List result ) { Rename * rename; DictionaryEntry de; if( scope->search_id == __SCOPE_search_id ) { return; } scope->search_id = __SCOPE_search_id; ENTITY_MARK++; /* fully REF'd schema */ LISTdo( scope->u.schema->ref_schemas, schema, Schema ) SCOPE_get_entities( schema, result ); /* don't go down remote schema's ref_schemas */ LISTod /* partially REF'd schema */ DICTdo_init( scope->u.schema->refdict, &de ); while( 0 != ( rename = ( Rename * )DICTdo( &de ) ) ) { if( DICT_type == OBJ_ENTITY ) { LISTadd( result, rename->object ); } } }
void SCHEMAadd_use( Schema cur_schema, Symbol * ref_schema, Symbol * old, Symbol * nnew ) { Rename * r = REN_new(); r->schema_sym = ref_schema; r->old = old; r->nnew = nnew; r->rename_type = use; if( !cur_schema->u.schema->uselist ) { cur_schema->u.schema->uselist = LISTcreate(); } LISTadd( cur_schema->u.schema->uselist, ( Generic )r ); }
static void SCHEMA_get_entities_use( Scope scope, Linked_List result ) { DictionaryEntry de; Rename * rename; if( scope->search_id == __SCOPE_search_id ) { return; } scope->search_id = __SCOPE_search_id; /* fully USE'd schema */ LISTdo( scope->u.schema->use_schemas, schema, Schema ) SCOPE_get_entities( schema, result ); SCHEMA_get_entities_use( schema, result ); LISTod /* partially USE'd schema */ if( scope->u.schema->usedict ) { DICTdo_init( scope->u.schema->usedict, &de ); while( 0 != ( rename = ( Rename * )DICTdo( &de ) ) ) { LISTadd( result, rename->object ); } } }
static void EXPRESS_PATHinit() { char * p; Dir * dir; int done = 0; EXPRESS_path = LISTcreate(); p = getenv( "EXPRESS_PATH" ); if( !p ) { /* if no EXPRESS_PATH, search current directory anyway */ dir = ( Dir * )scl_malloc( sizeof( Dir ) ); dir->leaf = dir->full; LISTadd( EXPRESS_path, ( Generic )dir ); } else { while( !done ) { char * start; /* start of current dir */ int length; /* length of dir */ char * slash; /* last slash in dir */ char save; /* place to character from where we */ /* temporarily null terminate */ /* get next directory */ while( isspace( *p ) ) { p++; } if( *p == '\0' ) { break; } start = p; /* find the end of the directory */ while( *p != '\0' && !isspace( *p ) ) { p++; } save = *p; if( *p == 0 ) { done = 1; } else { *p = '\0'; } p++; /* leave p after terminating null */ dir = ( Dir * )scl_malloc( sizeof( Dir ) ); /* if it's just ".", make it as if it was */ /* just "" to make error messages cleaner */ if( streq( ".", start ) ) { dir->leaf = dir->full; LISTadd( EXPRESS_path, ( Generic )dir ); *( p - 1 ) = save; /* put char back where */ /* temp null was */ continue; } //removed tilde logic; below line is all that's left length = ( p - 1 ) - start; /* if slash present at end, don't add another */ slash = strrchr( start, '/' ); if( slash && ( slash[1] == '\0' ) ) { strcpy( dir->full, start ); dir->leaf = dir->full + length; } else { sprintf( dir->full, "%s/", start ); dir->leaf = dir->full + length + 1; } LISTadd( EXPRESS_path, ( Generic )dir ); *( p - 1 ) = save; /* put char back where temp null was */ } } }