Commit a8096801 authored by Claes Sjofors's avatar Claes Sjofors

Show crossreferences, searches in all crossreference files, not just in the...

 Show crossreferences, searches in all crossreference files, not just in the file for the current volume
parent 8e3467fe
...@@ -183,7 +183,6 @@ int NavCrr::crr_signal( ...@@ -183,7 +183,6 @@ int NavCrr::crr_signal(
char *signalname) char *signalname)
{ {
pwr_tFileName default_filename; pwr_tFileName default_filename;
FILE *file;
char line[1000]; char line[1000];
int object_spaces; int object_spaces;
pwr_tAName object; pwr_tAName object;
...@@ -202,6 +201,14 @@ int NavCrr::crr_signal( ...@@ -202,6 +201,14 @@ int NavCrr::crr_signal(
pwr_tAName line_part[2]; pwr_tAName line_part[2];
int nr; int nr;
int write; int write;
int single_file = 0;
pwr_tFileName file_spec;
if ( filename && strcmp( filename, "*") == 0) {
strcpy( file_spec, "$pwrp_load/rtt_crr_*.dat");
sts = dcli_search_file( file_spec, filestr, DCLI_DIR_SEARCH_INIT);
if ( EVEN(sts)) return sts;
}
cdh_ToUpper( signalname, signalname); cdh_ToUpper( signalname, signalname);
...@@ -213,7 +220,14 @@ int NavCrr::crr_signal( ...@@ -213,7 +220,14 @@ int NavCrr::crr_signal(
wildcard = 1; wildcard = 1;
/* Open file */ /* Open file */
if ( filename == NULL) { while ( 1) {
FILE *file;
/* Open file */
if ( filename && strcmp( filename, "*") == 0) {
file = fopen( filestr, "r");
}
else if ( filename == NULL) {
/* Open file, first get the volume id */ /* Open file, first get the volume id */
if ( !wildcard) { if ( !wildcard) {
sts = (name_to_objid_cb)( parent_ctx, signalname, &objid); sts = (name_to_objid_cb)( parent_ctx, signalname, &objid);
...@@ -230,10 +244,12 @@ int NavCrr::crr_signal( ...@@ -230,10 +244,12 @@ int NavCrr::crr_signal(
dcli_pwr_dir("pwrp_load"), nav_VolumeIdToStr( volid)); dcli_pwr_dir("pwrp_load"), nav_VolumeIdToStr( volid));
dcli_get_defaultfilename( default_filename, filestr, NULL); dcli_get_defaultfilename( default_filename, filestr, NULL);
file = fopen( filestr, "r"); file = fopen( filestr, "r");
single_file = 1;
} }
else { else {
dcli_get_defaultfilename( filename, filestr, ".lis"); dcli_get_defaultfilename( filename, filestr, ".lis");
file = fopen( filestr, "r"); file = fopen( filestr, "r");
single_file = 1;
} }
if ( file == 0) if ( file == 0)
...@@ -300,9 +316,21 @@ int NavCrr::crr_signal( ...@@ -300,9 +316,21 @@ int NavCrr::crr_signal(
} }
} }
finish: finish:
fclose( file); fclose( file);
if ( single_file)
break;
if ( filename && strcmp( filename, "*") == 0) {
sts = dcli_search_file( file_spec, filestr, DCLI_DIR_SEARCH_NEXT);
if ( EVEN(sts)) break;
}
}
if ( filename && strcmp( filename, "*") == 0)
dcli_search_file( file_spec, filestr, DCLI_DIR_SEARCH_END);
if ( signalcount == 0) if ( signalcount == 0)
return NAV__OBJECTNOTFOUND; return NAV__OBJECTNOTFOUND;
...@@ -331,7 +359,6 @@ int NavCrr::crr_object( ...@@ -331,7 +359,6 @@ int NavCrr::crr_object(
char *objectname) char *objectname)
{ {
pwr_tFileName default_filename; pwr_tFileName default_filename;
FILE *file;
char line[1000]; char line[1000];
int object_spaces; int object_spaces;
pwr_tAName object; pwr_tAName object;
...@@ -341,7 +368,6 @@ int NavCrr::crr_object( ...@@ -341,7 +368,6 @@ int NavCrr::crr_object(
int sts; int sts;
char *s; char *s;
int wildcard; int wildcard;
int signalcount = 0;
pwr_tFileName filestr; pwr_tFileName filestr;
int lines; int lines;
pwr_tVolumeId volid; pwr_tVolumeId volid;
...@@ -350,6 +376,15 @@ int NavCrr::crr_object( ...@@ -350,6 +376,15 @@ int NavCrr::crr_object(
pwr_tAName line_part[2]; pwr_tAName line_part[2];
int nr; int nr;
int write; int write;
int single_file = 0;
pwr_tFileName file_spec;
int signalcount = 0;
if ( filename && strcmp( filename, "*") == 0) {
strcpy( file_spec, "$pwrp_load/rtt_crro_*.dat");
sts = dcli_search_file( file_spec, filestr, DCLI_DIR_SEARCH_INIT);
if ( EVEN(sts)) return sts;
}
cdh_ToUpper( objectname, objectname); cdh_ToUpper( objectname, objectname);
...@@ -360,8 +395,14 @@ int NavCrr::crr_object( ...@@ -360,8 +395,14 @@ int NavCrr::crr_object(
else else
wildcard = 1; wildcard = 1;
while ( 1) {
FILE *file;
/* Open file */ /* Open file */
if ( filename == NULL) { if ( filename && strcmp( filename, "*") == 0) {
file = fopen( filestr, "r");
}
else if ( filename == NULL) {
/* Open file, first get the volume id */ /* Open file, first get the volume id */
if ( !wildcard) { if ( !wildcard) {
sts = (name_to_objid_cb)( parent_ctx, objectname, &objid); sts = (name_to_objid_cb)( parent_ctx, objectname, &objid);
...@@ -378,10 +419,12 @@ int NavCrr::crr_object( ...@@ -378,10 +419,12 @@ int NavCrr::crr_object(
dcli_pwr_dir("pwrp_load"), nav_VolumeIdToStr( volid)); dcli_pwr_dir("pwrp_load"), nav_VolumeIdToStr( volid));
dcli_get_defaultfilename( default_filename, filestr, NULL); dcli_get_defaultfilename( default_filename, filestr, NULL);
file = fopen( filestr, "r"); file = fopen( filestr, "r");
single_file = 1;
} }
else { else {
dcli_get_defaultfilename( filename, filestr, ".lis"); dcli_get_defaultfilename( filename, filestr, ".lis");
file = fopen( filestr, "r"); file = fopen( filestr, "r");
single_file = 1;
} }
if ( file == 0) if ( file == 0)
...@@ -467,6 +510,18 @@ int NavCrr::crr_object( ...@@ -467,6 +510,18 @@ int NavCrr::crr_object(
finish: finish:
fclose( file); fclose( file);
if ( single_file)
break;
if ( filename && strcmp( filename, "*") == 0) {
sts = dcli_search_file( file_spec, filestr, DCLI_DIR_SEARCH_NEXT);
if ( EVEN(sts)) break;
}
}
if ( filename && strcmp( filename, "*") == 0)
dcli_search_file( file_spec, filestr, DCLI_DIR_SEARCH_END);
if ( signalcount == 0) if ( signalcount == 0)
return NAV__OBJECTNOTFOUND; return NAV__OBJECTNOTFOUND;
......
...@@ -481,6 +481,7 @@ int ItemBaseObject::open_crossref( XNavBrow *brow, double x, double y) ...@@ -481,6 +481,7 @@ int ItemBaseObject::open_crossref( XNavBrow *brow, double x, double y)
int sts; int sts;
pwr_tClassId classid; pwr_tClassId classid;
XNav *xnav; XNav *xnav;
char file[20] = "*";
if ( brow->usertype == brow_eUserType_XNav) if ( brow->usertype == brow_eUserType_XNav)
xnav = (XNav *) brow->userdata; xnav = (XNav *) brow->userdata;
...@@ -534,10 +535,10 @@ int ItemBaseObject::open_crossref( XNavBrow *brow, double x, double y) ...@@ -534,10 +535,10 @@ int ItemBaseObject::open_crossref( XNavBrow *brow, double x, double y)
case pwr_cClass_Ii: case pwr_cClass_Ii:
case pwr_cClass_Io: case pwr_cClass_Io:
case pwr_cClass_Co: case pwr_cClass_Co:
sts = xnav_crr_signal( brow, NULL, name, node); sts = xnav_crr_signal( brow, file, name, node);
break; break;
default: default:
sts = xnav_crr_object( brow, NULL, name, node); sts = xnav_crr_object( brow, file, name, node);
} }
if ( xnav && sts == NAV__OBJECTNOTFOUND) if ( xnav && sts == NAV__OBJECTNOTFOUND)
xnav->message('E', "Object not found in crossreferens file"); xnav->message('E', "Object not found in crossreferens file");
...@@ -1106,6 +1107,7 @@ int ItemAttrObject::open_crossref( XNavBrow *brow, double x, double y) ...@@ -1106,6 +1107,7 @@ int ItemAttrObject::open_crossref( XNavBrow *brow, double x, double y)
int sts; int sts;
XNav *xnav; XNav *xnav;
char aname[240]; char aname[240];
char file[20] = "*";
if ( brow->usertype == brow_eUserType_XNav) if ( brow->usertype == brow_eUserType_XNav)
xnav = (XNav *) brow->userdata; xnav = (XNav *) brow->userdata;
...@@ -1159,10 +1161,10 @@ int ItemAttrObject::open_crossref( XNavBrow *brow, double x, double y) ...@@ -1159,10 +1161,10 @@ int ItemAttrObject::open_crossref( XNavBrow *brow, double x, double y)
case pwr_cClass_Ii: case pwr_cClass_Ii:
case pwr_cClass_Io: case pwr_cClass_Io:
case pwr_cClass_Co: case pwr_cClass_Co:
sts = xnav_crr_signal( brow, NULL, aname, node); sts = xnav_crr_signal( brow, file, aname, node);
break; break;
default: default:
sts = xnav_crr_object( brow, NULL, aname, node); sts = xnav_crr_object( brow, file, aname, node);
} }
if ( xnav && sts == NAV__OBJECTNOTFOUND) if ( xnav && sts == NAV__OBJECTNOTFOUND)
xnav->message('E', "Object not found in crossreferens file"); xnav->message('E', "Object not found in crossreferens file");
...@@ -1883,6 +1885,7 @@ int ItemChannel::open_crossref( XNavBrow *brow, double x, double y) ...@@ -1883,6 +1885,7 @@ int ItemChannel::open_crossref( XNavBrow *brow, double x, double y)
int sts; int sts;
pwr_tOName signal_name; pwr_tOName signal_name;
XNav *xnav; XNav *xnav;
char file[20] = "*";
if ( brow->usertype == brow_eUserType_XNav) if ( brow->usertype == brow_eUserType_XNav)
xnav = (XNav *) brow->userdata; xnav = (XNav *) brow->userdata;
...@@ -1919,7 +1922,7 @@ int ItemChannel::open_crossref( XNavBrow *brow, double x, double y) ...@@ -1919,7 +1922,7 @@ int ItemChannel::open_crossref( XNavBrow *brow, double x, double y)
sts = gdh_AttrrefToName( &signal_aref, signal_name, sizeof(signal_name), sts = gdh_AttrrefToName( &signal_aref, signal_name, sizeof(signal_name),
cdh_mNName); cdh_mNName);
sts = xnav_crr_signal( brow, NULL, signal_name, node); sts = xnav_crr_signal( brow, file, signal_name, node);
if ( sts == NAV__OBJECTNOTFOUND && xnav) if ( sts == NAV__OBJECTNOTFOUND && xnav)
xnav->message('E', "Object not found in crossreferens file"); xnav->message('E', "Object not found in crossreferens file");
......
...@@ -637,6 +637,7 @@ int XAttNav::crossref() ...@@ -637,6 +637,7 @@ int XAttNav::crossref()
int sts; int sts;
pwr_tAName name; pwr_tAName name;
pwr_tClassId classid; pwr_tClassId classid;
char file[20] = "*";
sts = gdh_AttrrefToName ( &objar, name, sizeof(name), cdh_mNName); sts = gdh_AttrrefToName ( &objar, name, sizeof(name), cdh_mNName);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
...@@ -657,11 +658,11 @@ int XAttNav::crossref() ...@@ -657,11 +658,11 @@ int XAttNav::crossref()
case pwr_cClass_Ii: case pwr_cClass_Ii:
case pwr_cClass_Io: case pwr_cClass_Io:
case pwr_cClass_Co: case pwr_cClass_Co:
sts = xnav_crr_signal( brow, NULL, name, NULL); sts = xnav_crr_signal( brow, file, name, NULL);
break; break;
default: default:
/* Not a signal */ /* Not a signal */
sts = xnav_crr_object( brow, NULL, name, NULL); sts = xnav_crr_object( brow, file, name, NULL);
} }
// if ( EVEN(sts)) // if ( EVEN(sts))
// xnav->message(' ', XNav::get_message(sts)); // xnav->message(' ', XNav::get_message(sts));
......
...@@ -4533,10 +4533,18 @@ static int xnav_crossref_func( void *client_data, ...@@ -4533,10 +4533,18 @@ static int xnav_crossref_func( void *client_data,
case pwr_cClass_Ii: case pwr_cClass_Ii:
case pwr_cClass_Io: case pwr_cClass_Io:
case pwr_cClass_Co: case pwr_cClass_Co:
if ( !file_ptr) {
strcpy( file_str, "*");
file_ptr = file_str;
}
sts = xnav_crr_signal( xnav->brow, file_ptr, name_ptr, NULL); sts = xnav_crr_signal( xnav->brow, file_ptr, name_ptr, NULL);
break; break;
default: default:
/* Not a signal */ /* Not a signal */
if ( !file_ptr) {
strcpy( file_str, "*");
file_ptr = file_str;
}
sts = xnav_crr_object( xnav->brow, file_ptr, name_ptr, NULL); sts = xnav_crr_object( xnav->brow, file_ptr, name_ptr, NULL);
} }
if ( EVEN(sts)) if ( EVEN(sts))
......
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