Mercurial > hg > octave-nkf
comparison src/debug.cc @ 6317:8c67f8be341d
[project @ 2007-02-16 08:10:53 by jwe]
author | jwe |
---|---|
date | Fri, 16 Feb 2007 08:10:54 +0000 |
parents | 1c36a2e82266 |
children | bd0a70c3f2db |
comparison
equal
deleted
inserted
replaced
6316:a3a2580435c2 | 6317:8c67f8be341d |
---|---|
346 } | 346 } |
347 else | 347 else |
348 os << "dbtype: unable to open `" << ff << "' for reading!\n"; | 348 os << "dbtype: unable to open `" << ff << "' for reading!\n"; |
349 } | 349 } |
350 else | 350 else |
351 os << "dbtype: unkown function"; | 351 os << "dbtype: unknown function " << name << "\n"; |
352 | 352 |
353 os.flush(); | |
353 } | 354 } |
354 | 355 |
355 DEFCMD (dbtype, args, , | 356 DEFCMD (dbtype, args, , |
356 "-*- texinfo -*-\n\ | 357 "-*- texinfo -*-\n\ |
357 @deftypefn {Loadable Function} {} dbtype ()\n\ | 358 @deftypefn {Loadable Function} {} dbtype ()\n\ |
399 std::string end_str = arg.substr (ind + 1); | 400 std::string end_str = arg.substr (ind + 1); |
400 | 401 |
401 int start = atoi (start_str.c_str ()); | 402 int start = atoi (start_str.c_str ()); |
402 int end = atoi (end_str.c_str ()); | 403 int end = atoi (end_str.c_str ()); |
403 | 404 |
404 if (start < end) | 405 if (std::min (start, end) <= 0) |
405 do_dbtype (octave_stdout, | 406 error ("dbtype: start and end lines must be >= 1\n"); |
406 dbg_fcn->name (), start, end); | 407 |
408 if (start <= end) | |
409 do_dbtype (octave_stdout, dbg_fcn->name (), start, end); | |
407 else | 410 else |
408 error ("dbtype: the start line must be less than the end line\n"); | 411 error ("dbtype: start line must be less than end line\n"); |
409 } | 412 } |
410 else | 413 else |
411 error ("dbtype: if you specify lines it must be like `start:end`"); | 414 error ("dbtype: line specification must be `start:end'"); |
412 } | 415 } |
413 } | 416 } |
414 break; | 417 break; |
415 | 418 |
416 case 2: // (dbtype func start:end) | 419 case 2: // (dbtype func start:end) , (dbtype func start) |
417 dbg_fcn = get_user_function (argv[1]); | 420 dbg_fcn = get_user_function (argv[1]); |
418 | 421 |
419 if (dbg_fcn) | 422 if (dbg_fcn) |
420 { | 423 { |
421 std::string arg = argv[2]; | 424 std::string arg = argv[2]; |
422 | 425 int start = 0; |
426 int end = 0; | |
423 size_t ind = arg.find (':'); | 427 size_t ind = arg.find (':'); |
424 | 428 |
425 if (ind != NPOS) | 429 if (ind != NPOS) |
426 { | 430 { |
427 std::string start_str = arg.substr (0, ind); | 431 std::string start_str = arg.substr (0, ind); |
428 std::string end_str = arg.substr (ind + 1); | 432 std::string end_str = arg.substr (ind + 1); |
429 | 433 |
430 int start = atoi (start_str.c_str ()); | 434 start = atoi (start_str.c_str ()); |
431 int end = atoi (end_str.c_str ()); | 435 end = atoi (end_str.c_str ()); |
432 | 436 |
433 if (start < end) | |
434 do_dbtype (octave_stdout, | |
435 dbg_fcn->name (), start, end); | |
436 else | |
437 error ("dbtype: the start line must be less than the end line\n"); | |
438 } | 437 } |
439 else | 438 else |
440 error ("dbtype: if you specify lines it must be like `start:end`"); | 439 { |
440 start = atoi (arg.c_str ()); | |
441 end = start; | |
442 } | |
443 | |
444 if (std::min (start, end) <= 0) | |
445 error ("dbtype: start and end lines must be >= 1\n"); | |
446 | |
447 if (start <= end) | |
448 do_dbtype (octave_stdout, dbg_fcn->name (), start, end); | |
449 else | |
450 error ("dbtype: start line must be less than end line\n"); | |
441 } | 451 } |
442 break; | 452 break; |
443 | 453 |
444 default: | 454 default: |
445 error ("dbtype: expecting zero, one, or two arguments\n"); | 455 error ("dbtype: expecting zero, one, or two arguments\n"); |