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