comparison src/parse.y @ 7719:87eda1f8faaa

octave_user_code: new base class for octave_user_script and octave_user_function
author John W. Eaton <jwe@octave.org>
date Wed, 16 Apr 2008 22:08:15 -0400
parents 5b4d278ec828
children 4e2eafef689c
comparison
equal deleted inserted replaced
7718:62279ce5654c 7719:87eda1f8faaa
3345 { 3345 {
3346 std::string nm = argv[2]; 3346 std::string nm = argv[2];
3347 3347
3348 if (! octave_env::absolute_pathname (nm)) 3348 if (! octave_env::absolute_pathname (nm))
3349 { 3349 {
3350 octave_function *fcn = 3350 octave_user_code *fcn = octave_call_stack::caller_user_code ();
3351 octave_call_stack::caller_user_script_or_function (); 3351
3352 bool found = false; 3352 bool found = false;
3353
3353 if (fcn) 3354 if (fcn)
3354 { 3355 {
3355 std::string fname = fcn->fcn_file_name (); 3356 std::string fname = fcn->fcn_file_name ();
3357
3356 if (! fname.empty ()) 3358 if (! fname.empty ())
3357 { 3359 {
3358 fname = octave_env::make_absolute (fname, 3360 fname = octave_env::make_absolute (fname, octave_env::getcwd ());
3359 octave_env::getcwd ()); 3361 fname = fname.substr (0, fname.find_last_of (file_ops::dir_sep_str) + 1);
3360 fname = fname.substr (0, 3362
3361 fname.find_last_of (file_ops::dir_sep_str) + 1);
3362 file_stat fs (fname + nm); 3363 file_stat fs (fname + nm);
3364
3363 if (fs.exists ()) 3365 if (fs.exists ())
3364 { 3366 {
3365 nm = fname + nm; 3367 nm = fname + nm;
3366 found = true; 3368 found = true;
3367 } 3369 }
3477 } 3479 }
3478 } 3480 }
3479 3481
3480 std::string fname; 3482 std::string fname;
3481 3483
3482 octave_function *fcn = octave_call_stack::caller_user_script_or_function (); 3484 octave_user_code *fcn = octave_call_stack::caller_user_code ();
3483 3485
3484 if (fcn) 3486 if (fcn)
3485 { 3487 {
3486 fname = fcn->fcn_file_name (); 3488 fname = fcn->fcn_file_name ();
3487 3489