Mercurial > hg > octave-nkf
comparison src/pr-output.cc @ 1572:0d9e10d10bd7
[project @ 1995-10-19 04:31:30 by jwe]
author | jwe |
---|---|
date | Thu, 19 Oct 1995 04:31:30 +0000 |
parents | 89c587478067 |
children | 27f5ac98fc4a |
comparison
equal
deleted
inserted
replaced
1571:6ddabf91bc4e | 1572:0d9e10d10bd7 |
---|---|
40 | 40 |
41 #include "defun.h" | 41 #include "defun.h" |
42 #include "error.h" | 42 #include "error.h" |
43 #include "help.h" | 43 #include "help.h" |
44 #include "mappers.h" | 44 #include "mappers.h" |
45 #include "oct-str.h" | |
46 #include "pager.h" | 45 #include "pager.h" |
47 #include "pr-output.h" | 46 #include "pr-output.h" |
48 #include "sysdep.h" | 47 #include "sysdep.h" |
49 #include "tree-const.h" | 48 #include "tree-const.h" |
50 #include "user-prefs.h" | 49 #include "user-prefs.h" |
1452 } | 1451 } |
1453 } | 1452 } |
1454 } | 1453 } |
1455 | 1454 |
1456 void | 1455 void |
1457 octave_print_internal (ostream& os, Octave_str_obj& s, | 1456 octave_print_internal (ostream& os, const charMatrix& chm, |
1458 int pr_as_read_syntax) | 1457 int pr_as_read_syntax, int pr_as_string) |
1459 { | 1458 { |
1460 int nstr = s.num_strings (); | 1459 if (pr_as_string) |
1461 | 1460 { |
1462 if (pr_as_read_syntax && nstr > 1) | 1461 int nstr = chm.rows (); |
1463 os << "[ "; | 1462 |
1464 | 1463 if (pr_as_read_syntax && nstr > 1) |
1465 for (int i = 0; i < nstr; i++) | 1464 os << "[ "; |
1466 { | 1465 |
1467 if (pr_as_read_syntax) | 1466 for (int i = 0; i < nstr; i++) |
1468 { | 1467 { |
1469 os << "\"" << s.elem (i) << "\""; | 1468 if (pr_as_read_syntax) |
1470 | 1469 { |
1471 if (i < nstr - 1) | 1470 os << "\"" << chm.row_as_string (i) << "\""; |
1472 os << "; "; | 1471 |
1473 } | 1472 if (i < nstr - 1) |
1474 else | 1473 os << "; "; |
1475 os << s.elem (i) << "\n"; | 1474 } |
1476 } | 1475 else |
1477 | 1476 os << chm.row_as_string (i) << "\n"; |
1478 if (pr_as_read_syntax && nstr > 1) | 1477 } |
1479 os << " ]"; | 1478 |
1479 if (pr_as_read_syntax && nstr > 1) | |
1480 os << " ]"; | |
1481 } | |
1482 else | |
1483 { | |
1484 os << "sorry, printing char matrices not implemented yet\n"; | |
1485 } | |
1480 } | 1486 } |
1481 | 1487 |
1482 DEFUN ("disp", Fdisp, Sdisp, 10, | 1488 DEFUN ("disp", Fdisp, Sdisp, 10, |
1483 "disp (X): display value without name tag") | 1489 "disp (X): display value without name tag") |
1484 { | 1490 { |