Mercurial > octave-nkf
comparison src/pt-pr-code.cc @ 5102:b04b30d30c66
[project @ 2004-12-28 01:59:05 by jwe]
author | jwe |
---|---|
date | Tue, 28 Dec 2004 01:59:05 +0000 |
parents | 003bbf6c13d8 |
children | e35b034d3523 |
comparison
equal
deleted
inserted
replaced
5101:9b1af8135ecd | 5102:b04b30d30c66 |
---|---|
711 } | 711 } |
712 } | 712 } |
713 } | 713 } |
714 | 714 |
715 void | 715 void |
716 tree_print_code::visit_plot_command (tree_plot_command& cmd) | |
717 { | |
718 indent (); | |
719 | |
720 int ndim = cmd.num_dimensions (); | |
721 | |
722 switch (ndim) | |
723 { | |
724 case 1: | |
725 os << "replot"; | |
726 break; | |
727 | |
728 case 2: | |
729 os << "gplot"; | |
730 break; | |
731 | |
732 case 3: | |
733 os << "gsplot"; | |
734 break; | |
735 | |
736 default: | |
737 os << "<unkown plot command>"; | |
738 break; | |
739 } | |
740 | |
741 plot_limits *range = cmd.limits (); | |
742 | |
743 if (range) | |
744 range->accept (*this); | |
745 | |
746 subplot_list *plot_list = cmd.subplots (); | |
747 | |
748 if (plot_list) | |
749 plot_list->accept (*this); | |
750 } | |
751 | |
752 void | |
753 tree_print_code::visit_plot_limits (plot_limits& cmd) | |
754 { | |
755 plot_range *x_range = cmd.x_limits (); | |
756 | |
757 if (x_range) | |
758 x_range->accept (*this); | |
759 | |
760 plot_range *y_range = cmd.y_limits (); | |
761 | |
762 if (y_range) | |
763 y_range->accept (*this); | |
764 | |
765 plot_range *z_range = cmd.z_limits (); | |
766 | |
767 if (z_range) | |
768 z_range->accept (*this); | |
769 } | |
770 | |
771 void | |
772 tree_print_code::visit_plot_range (plot_range& cmd) | |
773 { | |
774 os << " ["; | |
775 | |
776 tree_expression *lower = cmd.lower_bound (); | |
777 | |
778 if (lower) | |
779 lower->accept (*this); | |
780 | |
781 os << ":"; | |
782 | |
783 tree_expression *upper = cmd.upper_bound (); | |
784 | |
785 if (upper) | |
786 upper->accept (*this); | |
787 | |
788 os << "]"; | |
789 } | |
790 | |
791 void | |
792 tree_print_code::visit_postfix_expression (tree_postfix_expression& expr) | 716 tree_print_code::visit_postfix_expression (tree_postfix_expression& expr) |
793 { | 717 { |
794 indent (); | 718 indent (); |
795 | 719 |
796 print_parens (expr, "("); | 720 print_parens (expr, "("); |
920 elt->accept (*this); | 844 elt->accept (*this); |
921 } | 845 } |
922 } | 846 } |
923 | 847 |
924 void | 848 void |
925 tree_print_code::visit_subplot (subplot& cmd) | |
926 { | |
927 tree_expression *sp_plot_data = cmd.plot_data (); | |
928 | |
929 if (sp_plot_data) | |
930 { | |
931 os << " "; | |
932 | |
933 sp_plot_data->accept (*this); | |
934 } | |
935 | |
936 subplot_axes *sp_axes_clause = cmd.axes_clause (); | |
937 | |
938 if (sp_axes_clause) | |
939 sp_axes_clause->accept (*this); | |
940 | |
941 subplot_using *sp_using_clause = cmd.using_clause (); | |
942 | |
943 if (sp_using_clause) | |
944 sp_using_clause->accept (*this); | |
945 | |
946 tree_expression *sp_title_clause = cmd.title_clause (); | |
947 | |
948 if (sp_title_clause) | |
949 sp_title_clause->accept (*this); | |
950 | |
951 subplot_style *sp_style_clause = cmd.style_clause (); | |
952 | |
953 if (sp_style_clause) | |
954 sp_style_clause->accept (*this); | |
955 } | |
956 | |
957 void | |
958 tree_print_code::visit_subplot_axes (subplot_axes& cmd) | |
959 { | |
960 os << " axes " << cmd.axes (); | |
961 } | |
962 | |
963 void | |
964 tree_print_code::visit_subplot_list (subplot_list& lst) | |
965 { | |
966 subplot_list::iterator p = lst.begin (); | |
967 | |
968 while (p != lst.end ()) | |
969 { | |
970 subplot *elt = *p++; | |
971 | |
972 if (elt) | |
973 { | |
974 elt->accept (*this); | |
975 | |
976 if (p != lst.end ()) | |
977 os << ","; | |
978 } | |
979 } | |
980 } | |
981 | |
982 void | |
983 tree_print_code::visit_subplot_style (subplot_style& cmd) | |
984 { | |
985 os << " with " << cmd.style (); | |
986 | |
987 tree_expression *sp_linetype = cmd.linetype (); | |
988 | |
989 if (sp_linetype) | |
990 { | |
991 os << " "; | |
992 | |
993 sp_linetype->accept (*this); | |
994 } | |
995 | |
996 tree_expression *sp_pointtype = cmd.pointtype (); | |
997 | |
998 if (sp_pointtype) | |
999 { | |
1000 os << " "; | |
1001 | |
1002 sp_pointtype->accept (*this); | |
1003 } | |
1004 } | |
1005 | |
1006 void | |
1007 tree_print_code::visit_subplot_using (subplot_using& cmd) | |
1008 { | |
1009 os << " using "; | |
1010 | |
1011 int qual_count = cmd.qualifier_count (); | |
1012 | |
1013 if (qual_count > 0) | |
1014 { | |
1015 tree_expression **x = cmd.qualifiers (); | |
1016 | |
1017 for (int i = 0; i < qual_count; i++) | |
1018 { | |
1019 if (i > 0) | |
1020 os << ":"; | |
1021 | |
1022 if (x[i]) | |
1023 x[i]->accept (*this); | |
1024 } | |
1025 } | |
1026 else | |
1027 { | |
1028 tree_expression *scanf_fmt = cmd.scanf_format (); | |
1029 | |
1030 if (scanf_fmt) | |
1031 scanf_fmt->accept (*this); | |
1032 } | |
1033 } | |
1034 | |
1035 void | |
1036 tree_print_code::visit_switch_case (tree_switch_case& cs) | 849 tree_print_code::visit_switch_case (tree_switch_case& cs) |
1037 { | 850 { |
1038 print_comment_list (cs.leading_comment ()); | 851 print_comment_list (cs.leading_comment ()); |
1039 | 852 |
1040 indent (); | 853 indent (); |