Commit 6348fe36 authored by claes's avatar claes

Files sorted

parent 9cd6ecef
...@@ -193,11 +193,18 @@ bool wb_vrepwbl::exportTree(wb_treeimport &i, pwr_tOid oid) ...@@ -193,11 +193,18 @@ bool wb_vrepwbl::exportTree(wb_treeimport &i, pwr_tOid oid)
return true; return true;
} }
static int wbl_sort_files( const void *file1, const void *file2)
{
return ( strcmp( (*(wb_wblfile **)file1)->file_name,
(*(wb_wblfile **)(file2))->file_name));
}
int wb_vrepwbl::load( const char *fname) int wb_vrepwbl::load( const char *fname)
{ {
int i; int i;
char file_spec[200]; char file_spec[200];
pwr_tStatus sts, rsts; pwr_tStatus sts, rsts;
int file_cnt_sort = 0;
rsts = LDH__SUCCESS; rsts = LDH__SUCCESS;
...@@ -218,6 +225,8 @@ int wb_vrepwbl::load( const char *fname) ...@@ -218,6 +225,8 @@ int wb_vrepwbl::load( const char *fname)
sts = load_files( file_spec); sts = load_files( file_spec);
if ( EVEN(sts)) rsts = sts; if ( EVEN(sts)) rsts = sts;
file_cnt_sort = file_cnt;
// Load types // Load types
sprintf( file_spec, "%s/*_t_*.wb_load", fname); sprintf( file_spec, "%s/*_t_*.wb_load", fname);
sts = load_files( file_spec); sts = load_files( file_spec);
...@@ -234,6 +243,11 @@ int wb_vrepwbl::load( const char *fname) ...@@ -234,6 +243,11 @@ int wb_vrepwbl::load( const char *fname)
if ( EVEN(sts)) rsts = sts; if ( EVEN(sts)) rsts = sts;
} }
if ( file_cnt > file_cnt_sort)
qsort( &file[file_cnt_sort], file_cnt - file_cnt_sort, sizeof(file[0]),
wbl_sort_files);
for ( i = 0; i < file_cnt; i++) { for ( i = 0; i < file_cnt; i++) {
for ( ref_wblnode n = file[i]->rootAST; n; n = n->getNextSibling()) for ( ref_wblnode n = file[i]->rootAST; n; n = n->getNextSibling())
n->registerNode( this); n->registerNode( this);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment