goals_cpp2.h

Main goal definitions


MG_STORAGE_AND_DATASTRUCTURES
goals_cpp2.h(42)
MG_GENERATE_OUTPUT_FILES
goals_cpp2.h(142) goals_cpp2.h(39)
MG_PROCESS_INPUT_FILES
goals_cpp2.h(54) goals_cpp2.h(51) goals_cpp2.h(48)
MG_READ_COMMAND_LINE
goals_cpp2.h(45)

Refined goal definitions


RG_CPP_COMMON
goals_cpp2.h(199) goals_cpp2.h(196) goals_cpp2.h(193) goals_cpp2.h(190) goals_cpp2.h(187) goals_cpp2.h(184) goals_cpp2.h(181) goals_cpp2.h(178)
RG_BISON
goals_cpp2.h(175) goals_cpp2.h(172) goals_cpp2.h(169)
RG_FLEX
goals_cpp2.h(163) goals_cpp2.h(160) goals_cpp2.h(157) goals_cpp2.h(154) goals_cpp2.h(151) goals_cpp2.h(148) goals_cpp2.h(145) goals_cpp2.h(139)
RG_READ_COMMAND_LINE
goals_cpp2.h(136) goals_cpp2.h(133) goals_cpp2.h(130) goals_cpp2.h(127) goals_cpp2.h(124) goals_cpp2.h(121) goals_cpp2.h(118) goals_cpp2.h(115) goals_cpp2.h(112) goals_cpp2.h(109) goals_cpp2.h(106) goals_cpp2.h(103)
RG_STORAGE_AND_DATASTRUCTURES
goals_cpp2.h(226) goals_cpp2.h(223) goals_cpp2.h(220) goals_cpp2.h(217) goals_cpp2.h(214) goals_cpp2.h(211) goals_cpp2.h(208) goals_cpp2.h(205) goals_cpp2.h(202)
RG_GENERATE_OUTPUT_FILES

Design goal definitions


DG_AA
aa.c(531) aa.c(504) aa.c(493) aa.c(474) aa.c(457) aa.c(446) aa.c(418) aa.c(403) aa.c(395) aa.c(387) aa.c(379) aa.c(371) aa.c(363) aa.c(355) aa.c(347) aa.c(337) aa.c(327) aa.c(317) aa.c(289) aa.c(280) aa.c(271) aa.c(257) aa.c(248) aa.c(239) aa.c(225) aa.c(200) aa.c(184) aa.c(169) aa.c(147) aa.c(139) aa.c(128) aa.c(119) aa.c(111) aa.c(94) aa.c(82) aa.c(65) aa.c(51) aa.c(43) aa.c(34) aa.c(24) aa.h(40) aa.h(37) aa.h(30)
DG_MM2
mm2.c(263) mm2.c(246) mm2.c(211) mm2.c(190) mm2.c(163) mm2.c(154) mm2.c(137) mm2.c(125) mm2.c(101) mm2.c(86) mm2.c(63) mm2.c(60) mm2.c(57) mm2.c(54) mm2.c(51) mm2.c(46) mm2.c(43) mm2.c(39) mm2.c(29) mm2.h(45) mm2.h(42) mm2.h(38) mm2.h(34)
DG_MM
col.h(238) col.h(228) mm.c(35) mm.c(26)
DG_RBT
rbt.c(427) rbt.c(417) rbt.c(405) rbt.c(395) rbt.c(387) rbt.c(379) rbt.c(349) rbt.c(332) rbt.c(309) rbt.c(286) rbt.c(269) rbt.c(235) rbt.c(202) rbt.c(163) rbt.c(144) rbt.c(86) rbt.c(67) rbt.c(44) rbt.c(34) rbt.c(31) rbt.h(53) rbt.h(42) rbt.h(35) rbt.h(32) rbt.h(29) rbt.h(26) rbt_shortcuts.h(72) rbt_shortcuts.h(55) rbt_shortcuts.h(45) rbt_shortcuts.h(24) rbt_shortcuts.h(21)
DG_SET
col.c(343) col.c(115) col.c(107) col.c(99) col.c(90) col.c(81) col.c(71) col.c(61)
DG_CLIST
list.c(225) list.c(191) list.c(165) list.c(135) list.c(103) list.c(80) list.c(58) list.c(41) list.c(33) list.c(25) list.h(44) list.h(29)
DG_STACK
stack.c(127) stack.c(101) stack.c(70) stack.c(55) stack.c(45) stack.c(37) stack.c(24) stack.h(40) stack.h(31)
DG_XSTRING
col.c(677) col.c(635) col.c(601) col.c(463) col.c(448) col.c(437) col.c(420) col.c(408) col.c(372) col.c(208) col.c(200) col.c(166) col.c(131) col.c(123) col.h(301) col.h(296) col.h(269) col.h(266) col.h(260) col.h(257) col.h(254) col.h(251)
DG_COL
col.c(737) col.c(724) col.c(471) col.c(353) col.c(327) col.c(312) col.c(300) col.c(291) col.c(277) col.c(262) col.c(254) col.c(242) col.c(234) col.c(226) col.c(218) col.c(139) col.c(51) col.c(39) col.c(27) col.h(309) col.h(292) col.h(276) col.h(272) col.h(74) col.h(62) col.h(24)
DG_ERROR_HANDLING
cpp2.c(1626) cpp2.c(1614) misc.c(332) misc.c(314) misc.c(296) x_rm1.y(1410)
DG_EXPAND_TEXT
cpp2.c(4799) cpp2.c(4672) cpp2.c(4557) cpp2.c(4546) cpp2.c(4348) cpp2.c(4242) cpp2.c(3165) cpp2.c(3092) cpp2.c(2965) cpp2.c(1663) cpp2.c(1649) cpp2.c(1640) cpp2.c(1577) cpp2.c(1411) cpp2.c(1395) cpp2.c(1367) cpp2.c(1353) cpp2.c(1251) cpp2.c(1236) cpp2.c(564) cpp2.c(497) cpp2.c(471) cpp2.c(446) cpp2.c(416) cpp2.c(55) cpp2.c(46) cpp2.h(503) cpp2.h(499) cpp2.h(496) cpp2.h(493) cpp2.h(484) cpp2.h(213) cpp2.h(210) cpp2.h(207) cpp2.h(204) part.c(631) part.c(601) x_rm1.y(1676) x_rm1.y(1450)
DG_PARSE_NO_DIRECTIVES
cpp2.c(3204) cpp2.c(3186) x_rm1.y(1972)
DG_PARSE_OTHER_DIRECTIVES
cpp2.c(2078) cpp2.c(2001) cpp2.c(1832) cpp2.c(1816) cpp2.c(1799) cpp2.c(1715) cpp2.c(1699) x_rm1.y(1157) x_rm1.y(1151) x_rm1.y(1145) x_rm1.y(1139) x_rm1.y(852) x_rm1.y(826)
DG_PARSE_CONDITIONALS
cpp2.c(2818) cpp2.c(2801) cpp2.c(2786) cpp2.c(2775) cpp2.c(2757) cpp2.c(2440) cpp2.c(2417) cpp2.c(2333) cpp2.c(2311) cpp2.c(2295) cpp2.c(2281) cpp2.c(2261) cpp2.c(2241) cpp2.c(2201) cpp2.c(2180) cpp2.c(2159) cpp2.c(2147) cpp2.c(2115) cpp2.c(1546) cpp2.c(1518) cpp2.c(1341) cpp2.c(73) cpp2.h(424) cpp2.h(421) cpp2.h(418) cpp2.h(415) cpp2.h(412) cpp2.h(409) cpp2.h(392) cpp2.h(389) cpp2.h(386) cpp2.h(383) cpp2.h(380) cpp2.h(377) cpp2.h(374) cpp2.h(371) cpp2.h(368) cpp2.h(365) cpp2.h(362) part.c(484) part.c(437) part.c(408) part.c(342) x_rm1.y(2639) x_rm1.y(2171) x_rm1.y(2127) x_rm1.y(2121) x_rm1.y(2104) x_rm1.y(2093) x_rm1.y(2087) x_rm1.y(2043) x_rm1.y(2038) x_rm1.y(2022) x_rm1.y(2011) x_rm1.y(755) x_rm1.y(688) x_rm1.y(682) x_rm1.y(676) x_rm1.y(670) x_rm1.y(605) x_rm1.y(599) x_rm1.y(593) x_rm1.y(587) x_rm1.y(567) x_rm1.y(494) x_rm1.y(489) x_rm1.y(484) x_rm1.y(479)
DG_PARSE_INCLUDE
cpp2.c(1854) cpp2.c(1843) cpp2.c(1782) cpp2.h(445) cpp2.h(442) cpp2.h(439) cpp2.h(436) cpp2.h(433) cpp2.h(430) cpp2.h(427) part.c(550) part.c(536) part.c(533) x_rm1.y(1006)
DG_PARSE_DEFINE
cpp2.c(3927) cpp2.c(3775) cpp2.c(3751) cpp2.c(3244) cpp2.c(3227) cpp2.c(1604) cpp2.c(1471) cpp2.c(1453) cpp2.c(1440) cpp2.c(1424) cpp2.h(356) cpp2.h(351) cpp2.h(344) cpp2.h(339) cpp2.h(274) cpp2.h(271) cpp2.h(268) cpp2.h(265) cpp2.h(262) cpp2.h(259) cpp2.h(252) cpp2.h(248) cpp2.h(245) cpp2.h(242) cpp2.h(239) cpp2.h(236) cpp2.h(233) cpp2.h(230) cpp2.h(227) cpp2.h(224) cpp2.h(221) part.c(787) part.c(778) x_rm1.y(1224)
DG_PARSE_COMMON
cpp2.c(4910) cpp2.c(4886) cpp2.c(4322) cpp2.c(4309) cpp2.c(3714) cpp2.c(3339) cpp2.c(3328) cpp2.c(3308) cpp2.c(3287) cpp2.c(3257) cpp2.c(2903) cpp2.c(1757) cpp2.c(1500) cpp2.c(1485) cpp2.c(1332) cpp2.c(1323) cpp2.c(1274) cpp2.c(1225) cpp2.c(1154) cpp2.c(1142) cpp2.c(713) cpp2.c(701) cpp2.c(690) cpp2.c(656) cpp2.c(629) cpp2.c(608) cpp2.c(536) cpp2.c(70) cpp2.c(67) cpp2.c(64) cpp2.c(61) cpp2.c(52) cpp2.c(49) cpp2.c(31) cpp2.c(28) cpp2.h(647) cpp2.h(478) cpp2.h(475) cpp2.h(472) cpp2.h(469) cpp2.h(466) cpp2.h(463) cpp2.h(460) cpp2.h(457) cpp2.h(454) cpp2.h(451) cpp2.h(448) cpp2.h(404) cpp2.h(399) cpp2.h(286) cpp2.h(284) cpp2.h(164) cpp2.h(159) cpp2.h(148) cpp2.h(144) cpp2.h(93) cpp2.h(89) cpp2.h(83) cpp2.h(71) cpp2.h(56) part.c(808) part.c(582) part.c(562) part.c(209) part.c(174) part.c(158) part.c(147) part.c(128) part.c(98) part.c(73) part.c(39) part.c(35) part.c(32) part.c(29) part.c(26) part.c(23) part.c(20) part.c(17)
DG_BISON_LIST_FROM_BRANCH
col.h(187) misc.c(951) misc.c(574) misc.c(352) misc.c(173)
DG_BISON_PUSHSYMBOL
col.h(209) misc.c(440)
DG_BISON_SYMBOL_ATTRIBUTES
col.h(165) col.h(161) col.h(94) cpp2.c(725) cpp2.c(105) cpp2.c(80) part.c(271) misc.c(1172) misc.c(1163) misc.c(1146) misc.c(1137) misc.c(943) misc.c(935) misc.c(892) misc.c(872) misc.c(854) misc.c(840) misc.c(827) misc.c(814) misc.c(793) misc.c(780) misc.c(763) misc.c(742) misc.c(728) misc.c(706) misc.c(539) misc.c(521) misc.c(501)
DG_BISON_COMMON
col.h(224) col.h(221) col.h(218) col.h(215) col.h(212) col.h(202) col.h(199) col.h(190) col.h(175) col.h(172) cpp2.c(77) misc.c(1122) misc.c(672) misc.c(660) misc.c(633) misc.c(610) misc.c(430) misc.c(343) misc.c(256) misc.c(246) misc.c(233) misc.c(218) misc.c(138) misc.c(106) misc.c(74) misc.c(30) misc.c(21) misc.h(91) misc.h(87) misc.h(64) misc.h(36)
DG_FLEX_READCHAR
col.h(178) misc.c(1205) misc.c(18)
DG_FLEX_STATE_CONSTANTS

DG_FLEX_PUSHSTRING
misc.c(1311) misc.c(1297) misc.c(1279) misc.c(562)
DG_FLEX_REWIND_OR_CHANGE_STATE
col.h(184) col.h(181) misc.c(1108) misc.c(1089) misc.c(1070) misc.c(1059)
DG_FLEX_BUFFERS
col.h(196) col.h(193) col.h(129) cpp2.c(403) misc.c(1194) misc.c(1181) misc.c(451) misc.c(410) misc.c(383) misc.c(192) misc.c(182)
DG_FLEX_STATE_AND_POSITION
x_io1.h(32)
DG_FLEX_ENTRY_POINT
misc.c(83) misc.c(58) misc.c(51) misc.c(39)
DG_GENERATE_HTML_RESULT
cpp2.c(1215) cpp2.c(1198) cpp2.c(1181) cpp2.c(1170) cpp2.c(1094) cpp2.c(1011) cpp2.c(993) cpp2.c(963) cpp2.c(928) cpp2.c(887) cpp2.c(838) cpp2.c(794) cpp2.c(744) cpp2.c(641) cpp2.c(127) cpp2.c(43) cpp2.c(40) cpp2.c(37) cpp2.c(34) cpp2.h(197) cpp2.h(193) cpp2.h(190) cpp2.h(187) cpp2.h(184) cpp2.h(181) cpp2.h(178) cpp2.h(86) cpp2.h(42) cpp2.h(39) cpp2.h(36) cpp2.h(33)
DG_FLEX_COMMON
misc.h(78) misc.h(69) misc.h(60) misc.h(55) misc.h(50) misc.h(43)
DG_PROCESS_ONLY
cpp2.c(3612) cpp2.c(3602) cpp2.c(3523) cpp2.c(3516) cpp2.c(3418) cpp2.c(3417) cpp2.h(325) cpp2.h(322)
DG_REPLACE_SLASHES
cpp2.c(3699) cpp2.c(3401) cpp2.h(319)
DG_DO_NOT_REMOVE_SLASHES
cpp2.c(3692) cpp2.c(3399) cpp2.h(316)
DG_EXTENSION_HTML
cpp2.c(3682) cpp2.c(3530) cpp2.c(3420) cpp2.h(313)
DG_EXTENSION_TEXT
cpp2.c(3675) cpp2.c(3537) cpp2.c(3422) cpp2.h(310)
DG_TEXT_PARTIAL
cpp2.c(3666) cpp2.c(3405) cpp2.h(307)
DG_TEXT_RESULT
cpp2.c(3659) cpp2.c(3403) cpp2.h(304)
DG_HELP
cpp2.c(3637)
DG_VERSION
cpp2.c(3629) cpp2.h(52)
DG_HTML_RESULT
cpp2.c(3652) cpp2.c(3645) cpp2.c(3409) cpp2.c(3407) cpp2.h(301) cpp2.h(298)
DG_MAIN_FILE
cpp2.c(3620) cpp2.c(3415) cpp2.h(328)
DG_COMMAND_LINE_COMMON
cpp2.c(3596) cpp2.c(3558) cpp2.c(3551) cpp2.c(3544) cpp2.c(3458) cpp2.c(3413) cpp2.c(3411) cpp2.c(3389) cpp2.c(3376) cpp2.c(3292) cpp2.c(3276) cpp2.c(58) cpp2.h(331) cpp2.h(295) misc.c(277) x_rm1.y(2906) x_rm1.y(2898)

Known risks definitions


KR_HTML_NO_CONTROL_CHARS
cpp2.c(917) cpp2.c(876)
KR_DATE_AND_TIME
cpp2.c(596) cpp2.c(591)
KR_SPACE_AFTER_ELSE_OR_ENDIF
x_rm1.y(2127) x_rm1.y(2121) x_rm1.y(2043) x_rm1.y(2038)
KR_PUSHED_EOF
x_rm1.y(2272)
KR_SKIPPED_LINE
x_rm1.y(1473)
KR_NUMBER_UL
cpp2.c(2794)
KR_CHARCONST_L
cpp2.c(2809)
KR_SEQUENCE_MAY_BE_LONGER
cpp2.c(2826)
KR_UNKNOWN_ESCAPES
cpp2.c(2825)
KR_NULL_DIRECTIVE_EQUALS_TEXT

KR_DIRECTIVE_AS_PARAMETER

KR_FILEST_NOT_ALLOWED
x_rm1.y(1048)
KR_WITH_PARAMS_FIRST
x_rm1.y(1247)
KR_FILE_EXTENSIONS_OBSOLATE
cpp2.c(3422) cpp2.c(3420) x_rm1.y(2971)

Type definitions


Struct variables


Enumeration variables


Define definitions


Variable definitions


Function definitions


Rule result definitions Bison


Token definitions


Source


1 #/* cpp2html for viewing c preprocessing as hypertext*/ 2 #/**/ 3 #/* Copyright (C) 2003 K.Karamazen*/ 4 #/**/ 5 #/* This program is free software; you can redistribute it and/or modify*/ 6 #/* it under the terms of the GNU General Public License as published by*/ 7 #/* the Free Software Foundation; either version 2 of the License, or*/ 8 #/* (at your option) any later version.*/ 9 #/* */ 10 #/* This program is distributed in the hope that it will be useful,*/ 11 #/* but WITHOUT ANY WARRANTY; without even the implied warranty of*/ 12 #/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the*/ 13 #/* GNU General Public License for more details.*/ 14 #/* */ 15 #ifndef _GOALS_CPP2_H__ 16 #define _GOALS_CPP2_H__ 17 #ifndef _GOALS_CPP2_H 18 #define _GOALS_CPP2_H 19 // 20 /*this is the documentation root file*/ 21 // 22 // MAIN GOALS 23 // 24 /*read command line*/ 25 //DOC_GOAL_MAIN(MG_READ_COMMAND_LINE) 26 // 27 /*process input files*/ 28 //DOC_GOAL_MAIN(MG_PROCESS_INPUT_FILES) 29 // 30 /*generate output files*/ 31 //DOC_GOAL_MAIN(MG_GENERATE_OUTPUT_FILES) 32 // 33 /*tools*/ 34 //DOC_GOAL_MAIN(MG_STORAGE_AND_DATASTRUCTURES) 35 // 36 // REFINED GOALS 37 // 38 /*generate output files*/ 39 //DOC_GOAL_REFINED(RG_GENERATE_OUTPUT_FILES MG_GENERATE_OUTPUT_FILES) 40 // 41 /*tools*/ 42 //DOC_GOAL_REFINED(RG_STORAGE_AND_DATASTRUCTURES MG_STORAGE_AND_DATASTRUCTURES) 43 // 44 /*read command line*/ 45 //DOC_GOAL_REFINED(RG_READ_COMMAND_LINE MG_READ_COMMAND_LINE) 46 // 47 //scan files, remove slashes, create rewrite buffers 48 //DOC_GOAL_REFINED(RG_FLEX MG_PROCESS_INPUT_FILES) 49 // 50 //parse files and create symbol attributes 51 //DOC_GOAL_REFINED(RG_BISON MG_PROCESS_INPUT_FILES) 52 // 53 //parse preprocessor common 54 //DOC_GOAL_REFINED(RG_CPP_COMMON MG_PROCESS_INPUT_FILES) 55 // 56 //KNOWN RISKS 57 // 58 /* file extensions specified on command line are not used*/ 59 //DOC_KNOWN_RISK(KR_FILE_EXTENSIONS_OBSOLATE) 60 // 61 /* with_params rule should be first:reduce conflicts*/ 62 //DOC_KNOWN_RISK(KR_WITH_PARAMS_FIRST) 63 // 64 // file* not allowed to include 65 //DOC_KNOWN_RISK(KR_FILEST_NOT_ALLOWED) 66 // 67 // no warning is issued when directive (for instance #if) is used as macro parameter: macro_name(#if,...) 68 //DOC_KNOWN_RISK(KR_DIRECTIVE_AS_PARAMETER) 69 // 70 // null directive beginning with # is expanded as any text 71 //DOC_KNOWN_RISK(KR_NULL_DIRECTIVE_EQUALS_TEXT) 72 // 73 // escape sequences in character constant of the form '<$B0>' are unknown 74 //DOC_KNOWN_RISK(KR_UNKNOWN_ESCAPES) 75 // 76 // 1.only the first escape sequence of the character is interpreted:what to do with rest? 2.hex and octal overflow not anticipated. 77 //DOC_KNOWN_RISK(KR_SEQUENCE_MAY_BE_LONGER) 78 // 79 //how to interpret L modifier? 80 //DOC_KNOWN_RISK(KR_CHARCONST_L) 81 // 82 //l and u suffix is not anticipated in number constants 83 //DOC_KNOWN_RISK(KR_NUMBER_UL) 84 // 85 //EOF can not happen hier instead of EOLN because an #endif, #else, #elif must follow 86 //DOC_KNOWN_RISK(KR_SKIPPED_LINE) 87 // 88 // when file correctly doesn't end with EOLN, an extra EOF is pushed to parser 89 //DOC_KNOWN_RISK(KR_PUSHED_EOF) 90 // 91 // after #endif or #else comment is allowed 92 //DOC_KNOWN_RISK(KR_SPACE_AFTER_ELSE_OR_ENDIF) 93 // 94 // date and time __DATE__ and __TIME__ are not read 95 //DOC_KNOWN_RISK(KR_DATE_AND_TIME) 96 // 97 /*no control chars in html view*/ 98 //DOC_KNOWN_RISK(KR_HTML_NO_CONTROL_CHARS) 99 // 100 //DESIGN GOALS 101 // 102 /* read command line common part */ 103 //DOC_GOAL_DESIGN(DG_COMMAND_LINE_COMMON RG_READ_COMMAND_LINE) 104 // 105 /* --main-file switch */ 106 //DOC_GOAL_DESIGN(DG_MAIN_FILE RG_READ_COMMAND_LINE) 107 // 108 /* --html-result switch*/ 109 //DOC_GOAL_DESIGN(DG_HTML_RESULT RG_READ_COMMAND_LINE) 110 // 111 /* --version switch*/ 112 //DOC_GOAL_DESIGN(DG_VERSION RG_READ_COMMAND_LINE) 113 // 114 /* --help switch*/ 115 //DOC_GOAL_DESIGN(DG_HELP RG_READ_COMMAND_LINE) 116 // 117 //--text-result switch 118 //DOC_GOAL_DESIGN(DG_TEXT_RESULT RG_READ_COMMAND_LINE) 119 // 120 //--text-partial switch 121 //DOC_GOAL_DESIGN(DG_TEXT_PARTIAL RG_READ_COMMAND_LINE) 122 // 123 //--extension-text switch 124 //DOC_GOAL_DESIGN(DG_EXTENSION_TEXT RG_READ_COMMAND_LINE) 125 // 126 //--extension-html switch 127 //DOC_GOAL_DESIGN(DG_EXTENSION_HTML RG_READ_COMMAND_LINE) 128 // 129 //--do-not-remove-slashes 130 //DOC_GOAL_DESIGN(DG_DO_NOT_REMOVE_SLASHES RG_READ_COMMAND_LINE) 131 // 132 //--replace-slashes 133 //DOC_GOAL_DESIGN(DG_REPLACE_SLASHES RG_READ_COMMAND_LINE) 134 // 135 //--process-only 136 //DOC_GOAL_DESIGN(DG_PROCESS_ONLY RG_READ_COMMAND_LINE) 137 // 138 //flex common 139 //DOC_GOAL_DESIGN(DG_FLEX_COMMON RG_FLEX) 140 // 141 //generate html result output 142 //DOC_GOAL_DESIGN(DG_GENERATE_HTML_RESULT MG_GENERATE_OUTPUT_FILES) 143 // 144 //flex has entry point 145 //DOC_GOAL_DESIGN(DG_FLEX_ENTRY_POINT RG_FLEX) 146 // 147 //flex has position and current state variables 148 //DOC_GOAL_DESIGN(DG_FLEX_STATE_AND_POSITION RG_FLEX) 149 // 150 //flex has associated text buffers for saving streams 151 //DOC_GOAL_DESIGN(DG_FLEX_BUFFERS RG_FLEX) 152 // 153 //flex can rewind stream and change state 154 //DOC_GOAL_DESIGN(DG_FLEX_REWIND_OR_CHANGE_STATE RG_FLEX) 155 // 156 //flex allows pushing string to a stream 157 //DOC_GOAL_DESIGN(DG_FLEX_PUSHSTRING RG_FLEX) 158 // 159 //flex defines state constants 160 //DOC_GOAL_DESIGN(DG_FLEX_STATE_CONSTANTS RG_FLEX) 161 // 162 //flex reads a character 163 //DOC_GOAL_DESIGN(DG_FLEX_READCHAR RG_FLEX) 164 // 165 /*bison common*/ 166 //DOC_GOAL_DESIGN(DG_BISON_COMMON) 167 // 168 /*bison administrates symbol attributes*/ 169 //DOC_GOAL_DESIGN(DG_BISON_SYMBOL_ATTRIBUTES RG_BISON) 170 // 171 /*bison allows pushing symbols to parser input*/ 172 //DOC_GOAL_DESIGN(DG_BISON_PUSHSYMBOL RG_BISON) 173 // 174 /*bison allows making list of a tree branch*/ 175 //DOC_GOAL_DESIGN(DG_BISON_LIST_FROM_BRANCH RG_BISON) 176 // 177 /*parse preprocessor common */ 178 //DOC_GOAL_DESIGN(DG_PARSE_COMMON RG_CPP_COMMON) 179 // 180 /*parse #define directives */ 181 //DOC_GOAL_DESIGN(DG_PARSE_DEFINE RG_CPP_COMMON) 182 // 183 /*parse #include directives */ 184 //DOC_GOAL_DESIGN(DG_PARSE_INCLUDE RG_CPP_COMMON) 185 // 186 /*parse conditional directives */ 187 //DOC_GOAL_DESIGN(DG_PARSE_CONDITIONALS RG_CPP_COMMON) 188 // 189 /*parse other directives */ 190 //DOC_GOAL_DESIGN(DG_PARSE_OTHER_DIRECTIVES RG_CPP_COMMON) 191 // 192 /*parse no directives */ 193 //DOC_GOAL_DESIGN(DG_PARSE_NO_DIRECTIVES RG_CPP_COMMON) 194 // 195 /*expand text */ 196 //DOC_GOAL_DESIGN(DG_EXPAND_TEXT RG_CPP_COMMON) 197 // 198 /*error handling */ 199 //DOC_GOAL_DESIGN(DG_ERROR_HANDLING RG_CPP_COMMON) 200 // 201 /*collection type can contain any other type */ 202 //DOC_GOAL_DESIGN(DG_COL RG_STORAGE_AND_DATASTRUCTURES) 203 // 204 /*xstring containes character array. The functions may not consider null char as the end of array, but the last character is always invariantly followed by null */ 205 //DOC_GOAL_DESIGN(DG_XSTRING RG_STORAGE_AND_DATASTRUCTURES) 206 // 207 /*c stack */ 208 //DOC_GOAL_DESIGN(DG_STACK RG_STORAGE_AND_DATASTRUCTURES) 209 // 210 /*c double linked list */ 211 //DOC_GOAL_DESIGN(DG_CLIST RG_STORAGE_AND_DATASTRUCTURES) 212 // 213 /*sets from xstrings */ 214 //DOC_GOAL_DESIGN(DG_SET RG_STORAGE_AND_DATASTRUCTURES) 215 // 216 /*rbt handles heaps on basis of read-black trees */ 217 //DOC_GOAL_DESIGN(DG_RBT RG_STORAGE_AND_DATASTRUCTURES) 218 // 219 /*mm handles heaps of allocated memory */ 220 //DOC_GOAL_DESIGN(DG_MM RG_STORAGE_AND_DATASTRUCTURES) 221 // 222 /*mm2 handles allocated memory */ 223 //DOC_GOAL_DESIGN(DG_MM2 RG_STORAGE_AND_DATASTRUCTURES) 224 // 225 /*aa handles associative arrays */ 226 //DOC_GOAL_DESIGN(DG_AA RG_STORAGE_AND_DATASTRUCTURES) 227 #endif 228 #endif 229

Makefile.am

Main goal definitions


Refined goal definitions


Design goal definitions


Known risks definitions


Type definitions


Struct variables


Enumeration variables


Define definitions


Variable definitions


Function definitions


Rule result definitions Bison


Token definitions


Source


1 bin_PROGRAMS = cpp2html 2 lex.yy_.c: x_rm1.lex 3 flex -f -Pyy_ x_rm1.lex 4 x_rm1.tab.c x_rm1.tab.h: x_rm1.y 5 bison -d x_rm1.y 6 BUILT_SOURCES = lex.yy_.c x_rm1.tab.c x_rm1.tab.h 7 cpp2html_SOURCES = mm.c mm2.c aa.c rbt.c list.c stack.c col.c misc.c main.c inc.c 8 nodist_cpp2html_SOURCES = lex.yy_.c x_rm1.tab.c x_rm1.tab.h 9 cpp2html_CFLAGS = -O3 10 info_TEXINFOS = cpp2html.texi 11 cpp2html_TEXINFOS = version.texi 12 EXTRA_DIST = doc.html info.html hyp.js hyp4.htm goals_cpp2.h *.h *.lex *.y cpp2.c part.c makefile.wrong 13

configure.ac

Main goal definitions


Refined goal definitions


Design goal definitions


Known risks definitions


Type definitions


Struct variables


Enumeration variables


Define definitions


Variable definitions


Function definitions


Rule result definitions Bison


Token definitions


Source


1 # Process this file with autoconf to produce a configure script. 2 3 AC_INIT 4 AC_PREREQ(2.55) 5 AC_CONFIG_SRCDIR(col.c) 6 AM_INIT_AUTOMAKE(cpp2html, 1.0.5) 7 8 AC_PROG_CC(gcc) 9 CFLAGS="" 10 #AC_CHECK_LIB(fl, , , AC_MSG_WARN([fl library not found!])) 11 12 AC_PROG_YACC 13 AM_PROG_LEX 14 15 AC_CONFIG_FILES([Makefile]) 16 AC_CONFIG_COMMANDS([default]) 17 AC_OUTPUT 18

aa.c

Main goal definitions


Refined goal definitions


Design goal definitions


Known risks definitions


Type definitions


Struct variables


Enumeration variables


Define definitions


AA_MAKE_EL
aa.c(464) aa.c(452) aa.c(429) aa.c(428) aa.c(404)

Variable definitions


Function definitions


aa_unset_col_col
aa.c(532) aa.h(58) cpp2.h(119) cpp2.h(117) misc.c(1262) misc.c(272)
aa_unset_xstring_xstring
aa.c(505) aa.h(67) cpp2.c(526)
aa_unset
aa.c(494) aa.h(95)
aa_value
aa.c(475) aa.c(465) aa.h(96) cpp2.c(4683) cpp2.c(4565) cpp2.c(4533) cpp2.c(3909) cpp2.c(547) cpp2.h(115)
aa_value_raw
aa.c(458) aa.c(375) aa.c(367) aa.c(359) aa.h(93)
aa_push_raw
aa.c(447) aa.c(351) aa.h(91)
aa_assign_raw
aa.c(419) aa.c(342) aa.c(332) aa.c(322) aa.h(87)
xstring_aa_value_sstring2
aa.c(396) aa.h(86)
xstring_aa_value_xstring2
aa.c(388) aa.h(85)
xstring_aa_value_sint2
aa.c(380) aa.h(84)
xstring_aa_value_sstring
aa.c(399) aa.c(372) aa.h(83)
xstring_aa_value_xstring
aa.c(391) aa.c(364) aa.h(82) cpp2.c(1301)
xstring_aa_value_sint
aa.c(383) aa.c(356) aa.h(81) cpp2.c(4477) cpp2.c(4454) cpp2.c(4294) cpp2.c(4286) cpp2.c(4276) cpp2.c(1378) cpp2.c(350) cpp2.c(285) cpp2.c(212) cpp2.c(113) cpp2.c(89) misc.c(770) misc.c(391)
aa_push_xstring
aa.c(348) aa.h(80) cpp2.c(3612) cpp2.c(3596)
aa_assign_sstring_xstring
aa.c(338) aa.h(78)
aa_assign_xstring_xstring
aa.c(328) aa.h(76) cpp2.c(4359) cpp2.c(3602) cpp2.c(3573)
aa_assign_sint_xstring
aa.c(318) aa.h(74) cpp2.c(4481) cpp2.c(4474) cpp2.c(4459) cpp2.c(4228) cpp2.c(4215) cpp2.c(4204) cpp2.c(295) cpp2.c(224) cpp2.c(162) misc.c(594)
aa_push_array
aa.c(453) aa.c(290) aa.h(97) cpp2.c(4428)
aa_least_not_lt_data
aa.c(281) aa.h(73)
aa_least_not_lt_index
aa.c(272) aa.h(72)
aa_least_not_lt
aa.c(284) aa.c(275) aa.c(258) aa.h(71) part.c(286)
aa_greatest_not_gt_data
aa.c(249) aa.h(70) cpp2.c(409) misc.c(1187)
aa_greatest_not_gt_index
aa.c(240) aa.h(69) part.c(180)
aa_greatest_not_gt
aa.c(252) aa.c(243) aa.c(226) aa.h(68)
aa_assign
aa.c(430) aa.c(313) aa.c(201) aa.h(98) cpp2.c(3896) cpp2.c(551) cpp2.h(120) misc.c(1264) misc.c(692) misc.c(654)
aa_array
aa.c(185) aa.h(99) cpp2.c(4902) cpp2.c(4419) cpp2.c(3763) cpp2.c(3418) cpp2.c(3417) cpp2.c(3413) cpp2.c(3411) cpp2.c(3346) cpp2.c(1465) cpp2.c(1464) cpp2.c(1463) cpp2.c(1406) cpp2.c(1405) cpp2.c(1404) cpp2.c(160) misc.c(580) misc.c(459) misc.c(149)
aa_cmpEQ
aa.c(189) aa.c(170) aa.h(66)
aa_cmpLT
aa.c(189) aa.c(148) aa.h(65)
unbound_int_xstring_array
aa.c(140) aa.h(64) cpp2.c(3769) cpp2.c(1478) cpp2.c(1477) cpp2.c(1476) cpp2.c(1418) cpp2.c(1417) cpp2.c(1416)
unbound_int_xstring
aa.c(143) aa.c(129) aa.h(63)
aa_unbound
aa.c(143) aa.c(120) aa.h(62)
aa_foreach
aa.c(112) aa.h(61) cpp2.c(3292) misc.c(250)
aa_unbound_col
aa.c(95) aa.h(60) col.c(588)
aa_unbound_element
aa.c(103) aa.c(83) aa.h(59)
aa_unbound_pcol_col
aa.c(66) aa.h(57) misc.c(252)
aa_unbound_pcol_col_element
aa.c(74) aa.c(52) aa.h(56)
aa_length
aa.c(44) aa.h(55) cpp2.c(3437) cpp2.c(3436) cpp2.c(1891) cpp2.c(1877) cpp2.c(1872) cpp2.c(1871) cpp2.c(454)
aa_next
aa.c(35) aa.h(53) part.c(323)
aa_begin
aa.c(25) aa.h(54) part.c(290)

Rule result definitions Bison


Token definitions


Source


1 #/* cpp2html for viewing c preprocessing as hypertext*/ 2 #/**/ 3 #/* Copyright (C) 2003 K.Karamazen*/ 4 #/**/ 5 #/* This program is free software; you can redistribute it and/or modify*/ 6 #/* it under the terms of the GNU General Public License as published by*/ 7 #/* the Free Software Foundation; either version 2 of the License, or*/ 8 #/* (at your option) any later version.*/ 9 #/* */ 10 #/* This program is distributed in the hope that it will be useful,*/ 11 #/* but WITHOUT ANY WARRANTY; without even the implied warranty of*/ 12 #/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the*/ 13 #/* GNU General Public License for more details.*/ 14 #/* */ 15 #include "stdlib.h" 16 #include "col.h" 17 #include "rbt.h" 18 #include "mm.h" 19 #include "aa.h" 20 #include "limits.h" 21 #include "string.h" 22 23 /*give begin reference associated with data for use in next and prev array walk*/ 24 //DOC_FUNC_DEF(aa_begin DG_AA) 25 void * 26 aa_begin (col_t * arr, col_t * index) 27 { 28 aa_data_t i_data; 29 i_data.key = index; 30 return rbt_begin (arr->val, &i_data); 31 } 32 33 /*given current reference, find next in array, returns aa_data_t*, assignes new reference*/ 34 //DOC_FUNC_DEF(aa_next DG_AA) 35 aa_data_t * 36 aa_next (col_t * arr, void **ref) 37 { 38 *ref = rbt_next (arr->val, *ref); 39 return rbt_data (*ref); 40 } 41 42 /*length of array*/ 43 //DOC_FUNC_DEF(aa_length DG_AA) 44 int 45 aa_length (col_t * arr) 46 { 47 return ((aa_master_t *) arr)->length; 48 } 49 50 /*unbound data unit of array indexed by pointer to col_t hidden in INTP*/ 51 //DOC_FUNC_DEF(aa_unbound_pcol_col_element DG_AA) 52 void 53 aa_unbound_pcol_col_element (void *data) 54 { 55 aa_data_t *d = (aa_data_t *) data; 56 if (((col_t *) (d->key))->val) 57 col_unbound_col (((col_t *) (d->key))->val); 58 col_unbound_col (d->key); 59 if (d->value) 60 col_unbound_col (d->value); 61 mm2_unbound_mem (d->mm_handle); 62 } 63 64 /*unbound array of general col_t indexed by pointer to col_t hidden in INTP*/ 65 //DOC_FUNC_DEF(aa_unbound_pcol_col DG_AA) 66 int 67 aa_unbound_pcol_col (col_t * array) 68 { 69 int result; 70 if (!(result = mm2_unbound_mem (array->mm_handle))) 71 { 72 /*!!begin critical section: uses unbounded result!! */ 73 mm2_bound_new_forbidden = 1; 74 unbound_rbt (array->val, NULL, aa_unbound_pcol_col_element); 75 mm2_bound_new_forbidden = 0; 76 /*!!end critical section: uses unbounded result!! */ 77 } 78 return result; 79 } 80 81 /*unbound data unit of array*/ 82 //DOC_FUNC_DEF(aa_unbound_element DG_AA) 83 void 84 aa_unbound_element (void *data) 85 { 86 aa_data_t *d = (aa_data_t *) data; 87 col_unbound_col (d->key); 88 if (d->value) 89 col_unbound_col (d->value); 90 mm2_unbound_mem (d->mm_handle); 91 } 92 93 /*unbound array of general col_t*/ 94 //DOC_FUNC_DEF(aa_unbound_col DG_AA) 95 int 96 aa_unbound_col (col_t * array) 97 { 98 int result; 99 if (!(result = mm2_unbound_mem (array->mm_handle))) 100 { 101 /*!!begin critical section: uses unbounded result!! */ 102 mm2_bound_new_forbidden = 1; 103 unbound_rbt (array->val, NULL, aa_unbound_element); 104 mm2_bound_new_forbidden = 0; 105 /*!!end critical section: uses unbounded result!! */ 106 } 107 return result; 108 } 109 110 /*for each element of array*/ 111 //DOC_FUNC_DEF(aa_foreach DG_AA) 112 void 113 aa_foreach (col_t * array, void (*process_data) (void *)) 114 { 115 process_tree_in_order (array->val, NULL, process_data); 116 } 117 118 /*unbound array*/ 119 //DOC_FUNC_DEF(aa_unbound DG_AA) 120 void 121 aa_unbound (col_t * array, void (*unbound_data) (void *)) 122 { 123 unbound_rbt (array->val, NULL, unbound_data); 124 unbound_mem_from_handle (array->mm_handle); 125 } 126 127 /*unbound int xstring array element*/ 128 //DOC_FUNC_DEF(unbound_int_xstring DG_AA) 129 void 130 unbound_int_xstring (void *data) 131 { 132 aa_data_t *d = (aa_data_t *) data; 133 unbound_col (d->key); 134 unbound_col (d->value); 135 unbound_mem_from_handle (d->mm_handle); 136 } 137 138 /*unbound int xstring array*/ 139 //DOC_FUNC_DEF(unbound_int_xstring_array DG_AA) 140 void 141 unbound_int_xstring_array (col_t * array) 142 { 143 aa_unbound (array, unbound_int_xstring); 144 } 145 146 /*array comparation function LT*/ 147 //DOC_FUNC_DEF(aa_cmpLT DG_AA) 148 int 149 aa_cmpLT (void *a, void *b) 150 { 151 col_t *x = ((aa_data_t *) a)->key; 152 col_t *y = ((aa_data_t *) b)->key; 153 if ((x->type == INTP) && (y->type == INTP)) 154 return (int) (x->val) < (int) (y->val); 155 if ((x->type == STRINGP || x->type == XSTRINGP) 156 && (y->type == STRINGP || y->type == XSTRINGP || y->type == XSTRINGP)) 157 return strcmp (val_xstring_or_string (x), val_xstring_or_string (y)) < 0; 158 if (x->type == INTP) 159 { 160 return 1; 161 } 162 else 163 { 164 return 0; 165 } 166 } 167 168 /*array comparation function EQ*/ 169 //DOC_FUNC_DEF(aa_cmpEQ DG_AA) 170 int 171 aa_cmpEQ (void *a, void *b) 172 { 173 col_t *x = ((aa_data_t *) a)->key; 174 col_t *y = ((aa_data_t *) b)->key; 175 if ((x->type == INTP) && (y->type == INTP)) 176 return (int) (x->val) == (int) (y->val); 177 if ((x->type == STRINGP || x->type == XSTRINGP) 178 && (y->type == STRINGP || y->type == XSTRINGP)) 179 return strcmp (val_xstring_or_string (x), val_xstring_or_string (y)) == 0; 180 return 0; 181 } 182 183 /*create array*/ 184 //DOC_FUNC_DEF(aa_array DG_AA) 185 col_t * 186 aa_array () 187 { 188 col_t *result_var; 189 void *result = createTree (aa_cmpLT, aa_cmpEQ, NULL, NULL); 190 // bound_new_col_symbol(&result_var,AAP,result); 191 result_var = (col_t *) mm2_bound_new_mem (sizeof (aa_master_t)); 192 result_var->type = AAP; 193 result_var->mm_handle = mm2_handle; 194 result_var->val = result; 195 ((aa_master_t *) result_var)->length = 0; 196 return result_var; 197 } 198 199 /*assign element of array*/ 200 //DOC_FUNC_DEF(aa_assign DG_AA) 201 int 202 aa_assign (col_t * arr, col_t * i, col_t * val, rbt_flags_t flag) 203 { 204 int res; 205 aa_data_t *data; 206 data = (aa_data_t *) bound_new_mem (sizeof (aa_data_t)); 207 data->mm_handle = mm_handle; 208 data->key = i; 209 data->value = val; 210 if (!flag) 211 flag = RETURN_NULL_IF_EXISTS; 212 res = insertKey (arr->val, data, flag); 213 if (!res && flag == RETURN_NULL_IF_EXISTS) 214 { 215 mm2_unbound_mem (data->mm_handle); 216 } 217 else 218 { 219 ((aa_master_t *) arr)->length++; 220 } 221 return res; 222 } 223 224 /*return greatest not greater than in array*/ 225 //DOC_FUNC_DEF(aa_greatest_not_gt DG_AA) 226 aa_data_t * 227 aa_greatest_not_gt (col_t * arr, col_t * val) 228 { 229 aa_data_t *result; 230 aa_data_t aa_data; 231 aa_data.key = val; 232 result = 233 (aa_data_t *) rbt_find_largest_not_larger_than (arr->val, &aa_data, NULL, 234 NULL); 235 return result; 236 } 237 238 /*return greatest not greater than in array*/ 239 //DOC_FUNC_DEF(aa_greatest_not_gt_index DG_AA) 240 col_t * 241 aa_greatest_not_gt_index (col_t * arr, col_t * val) 242 { 243 aa_data_t *result = aa_greatest_not_gt (arr, val); 244 return (result ? result->key : NULL); 245 } 246 247 /*return greatest not greater than in array*/ 248 //DOC_FUNC_DEF(aa_greatest_not_gt_data DG_AA) 249 col_t * 250 aa_greatest_not_gt_data (col_t * arr, col_t * val) 251 { 252 aa_data_t *result = aa_greatest_not_gt (arr, val); 253 return (result ? result->value : NULL); 254 } 255 256 /*return least not less than in array*/ 257 //DOC_FUNC_DEF(aa_least_not_lt DG_AA) 258 aa_data_t * 259 aa_least_not_lt (col_t * arr, col_t * val) 260 { 261 aa_data_t *result; 262 aa_data_t aa_data; 263 aa_data.key = val; 264 result = 265 (aa_data_t *) rbt_find_least_not_less_than (arr->val, &aa_data, NULL, 266 NULL); 267 return result; 268 } 269 270 /*return least not less than in array*/ 271 //DOC_FUNC_DEF(aa_least_not_lt_index DG_AA) 272 col_t * 273 aa_least_not_lt_index (col_t * arr, col_t * val) 274 { 275 aa_data_t *result = aa_least_not_lt (arr, val); 276 return (result ? result->key : NULL); 277 } 278 279 /*return least not less than in array*/ 280 //DOC_FUNC_DEF(aa_least_not_lt_data DG_AA) 281 col_t * 282 aa_least_not_lt_data (col_t * arr, col_t * val) 283 { 284 aa_data_t *result = aa_least_not_lt (arr, val); 285 return (result ? result->value : NULL); 286 } 287 288 /*add element with the next integer index*/ 289 //DOC_FUNC_DEF(aa_push_array DG_AA) 290 void 291 aa_push_array (col_t * arr, col_t * val) 292 { 293 aa_data_t *result; 294 int res; 295 aa_data_t aa_data; 296 col_t *i; 297 col_t i_aa; 298 bound_new_col_symbol (&i, INTP, (void *) 0); 299 aa_data.key = &i_aa; 300 aa_data.key->type = INTP; 301 (int) (aa_data.key->val) = INT_MAX; 302 result = 303 (aa_data_t *) rbt_find_largest_not_larger_than (arr->val, &aa_data, NULL, 304 NULL); 305 if (!result || result->key->type == STRINGP 306 || result->key->type == XSTRINGP) 307 { 308 } 309 else 310 { 311 (int) (i->val) = (int) (result->key->val) + 1; 312 } 313 res = aa_assign (arr, i, val, RETURN_NULL_IF_EXISTS); 314 } 315 316 /*add xstring indexed by integer*/ 317 //DOC_FUNC_DEF(aa_assign_sint_xstring DG_AA) 318 int 319 aa_assign_sint_xstring (col_t * array, int index, col_t * data, 320 rbt_flags_t flag) 321 { 322 return aa_assign_raw (array, &index, SINTP, 0, NULL, data, XSTRINGP, 0, 323 NULL, flag); 324 } 325 326 /*add xstring indexed by xstring*/ 327 //DOC_FUNC_DEF(aa_assign_xstring_xstring DG_AA) 328 int 329 aa_assign_xstring_xstring (col_t * array, col_t * index, col_t * data, 330 rbt_flags_t flag) 331 { 332 return aa_assign_raw (array, index, XSTRINGP, 0, NULL, data, XSTRINGP, 0, 333 NULL, flag); 334 } 335 336 /*add xstring indexed by string*/ 337 //DOC_FUNC_DEF(aa_assign_sstring_xstring DG_AA) 338 int 339 aa_assign_sstring_xstring (col_t * array, char *index, col_t * data, 340 rbt_flags_t flag) 341 { 342 return aa_assign_raw (array, index, SSTRINGP, 0, NULL, data, XSTRINGP, 0, 343 NULL, flag); 344 } 345 346 /*add xstring indexed by the next integer index*/ 347 //DOC_FUNC_DEF(aa_push_xstring DG_AA) 348 void 349 aa_push_xstring (col_t * array, col_t * data) 350 { 351 return aa_push_raw (array, data, XSTRINGP, 0, NULL); 352 } 353 354 /* xstring value indexed by integer*/ 355 //DOC_FUNC_DEF(xstring_aa_value_sint DG_AA) 356 col_t * 357 xstring_aa_value_sint (col_t * array, int index) 358 { 359 return aa_value_raw (array, &index, SINTP, 0, NULL); 360 } 361 362 /* xstring value indexed by xstring*/ 363 //DOC_FUNC_DEF(xstring_aa_value_xstring DG_AA) 364 col_t * 365 xstring_aa_value_xstring (col_t * array, col_t * index) 366 { 367 return aa_value_raw (array, index, XSTRINGP, 0, NULL); 368 } 369 370 /* xstring value indexed by sstring*/ 371 //DOC_FUNC_DEF(xstring_aa_value_sstring DG_AA) 372 col_t * 373 xstring_aa_value_sstring (col_t * array, char *index) 374 { 375 return aa_value_raw (array, index, SSTRINGP, 0, NULL); 376 } 377 378 /* string from xstring value indexed by integer*/ 379 //DOC_FUNC_DEF(xstring_aa_value_sint2 DG_AA) 380 char * 381 xstring_aa_value_sint2 (col_t * array, int index) 382 { 383 return val_xstring (xstring_aa_value_sint (array, index)); 384 } 385 386 /* string from xstring value indexed by xstring*/ 387 //DOC_FUNC_DEF(xstring_aa_value_xstring2 DG_AA) 388 char * 389 xstring_aa_value_xstring2 (col_t * array, col_t * index) 390 { 391 return val_xstring (xstring_aa_value_xstring (array, index)); 392 } 393 394 /* string from xstring value indexed by string*/ 395 //DOC_FUNC_DEF(xstring_aa_value_sstring2 DG_AA) 396 char * 397 xstring_aa_value_sstring2 (col_t * array, char *index) 398 { 399 return val_xstring (xstring_aa_value_sstring (array, index)); 400 } 401 402 /*create new element*/ 403 //DOC_DEFINE(AA_MAKE_EL DG_AA) 404 #define AA_MAKE_EL(index_type,new_index,index)\ 405 if (index_type==SINTP)\ 406 {\ 407 new_index=new_int(*(int*)index);\ 408 }\ 409 else if(index_type==SSTRINGP)\ 410 {\ 411 new_index=new_xstring(strlen(index),index);\ 412 }\ 413 else if(index_type==INTP || index_type==STRINGP ||index_type==XSTRINGP)\ 414 {\ 415 new_index=(col_t*)index;\ 416 } 417 /* general assign function */ 418 //DOC_FUNC_DEF(aa_assign_raw DG_AA) 419 int 420 aa_assign_raw (col_t * array, void *index, lisp_type_t index_type, 421 int index_mm_sort, mm2_unit_t * index_mm_handle, void *data, 422 lisp_type_t data_type, int data_mm_sort, 423 mm2_unit_t * data_mm_handle, rbt_flags_t flag) 424 { 425 col_t *new_index = NULL; 426 col_t *new_data = NULL; 427 int res; 428 AA_MAKE_EL (index_type, new_index, index); 429 AA_MAKE_EL (data_type, new_data, data); 430 res = aa_assign (array, new_index, new_data, flag); 431 if (!res) 432 { 433 if (index_type == SINTP || index_type == SSTRINGP) 434 { 435 col_unbound_col (new_index); 436 } 437 if (data_type == SINTP || data_type == SSTRINGP) 438 { 439 col_unbound_col (new_data); 440 } 441 } 442 return res; 443 } 444 445 /* general add at next integer index function */ 446 //DOC_FUNC_DEF(aa_push_raw DG_AA) 447 void 448 aa_push_raw (col_t * array, void *data, lisp_type_t data_type, 449 int data_mm_sort, mm2_unit_t * data_mm_handle) 450 { 451 col_t *new_data = NULL; 452 AA_MAKE_EL (data_type, new_data, data); 453 aa_push_array (array, new_data); 454 } 455 456 /* general value at index function */ 457 //DOC_FUNC_DEF(aa_value_raw DG_AA) 458 col_t * 459 aa_value_raw (col_t * array, void *index, lisp_type_t index_type, 460 int index_mm_sort, mm2_unit_t * index_mm_handle) 461 { 462 col_t *result; 463 col_t *new_index = NULL; 464 AA_MAKE_EL (index_type, new_index, index); 465 result = aa_value (array, new_index); 466 if (index_type == SINTP) 467 unbound_mem_from_handle (new_index->mm_handle); 468 if (index_type == SSTRINGP) 469 unbound_xstring (new_index); 470 return result; 471 } 472 473 /* value at index */ 474 //DOC_FUNC_DEF(aa_value DG_AA) 475 col_t * 476 aa_value (col_t * arr, col_t * i) 477 { 478 aa_data_t *result; 479 aa_data_t i_data; 480 i_data.key = i; 481 result = (aa_data_t *) findKey (arr->val, &i_data); 482 if (result) 483 { 484 return result->value; 485 } 486 else 487 { 488 return NULL; 489 } 490 } 491 492 /*remove element from array*/ 493 //DOC_FUNC_DEF(aa_unset DG_AA) 494 void 495 aa_unset (col_t * arr, col_t * i) 496 { 497 aa_data_t i_data; 498 i_data.key = i; 499 if (deleteKey (arr->val, &i_data, 0)) 500 ((aa_master_t *) arr)->length--; 501 } 502 503 /*remove xstring indexed by xstring from array*/ 504 //DOC_FUNC_DEF(aa_unset_xstring_xstring DG_AA) 505 void 506 aa_unset_xstring_xstring (col_t * arr, col_t * i) 507 { 508 aa_data_t i_data; 509 aa_data_t *data; 510 col_t *value; 511 col_t *key; 512 i_data.key = i; 513 //data=findKey(arr->val,&i_data); 514 data = (aa_data_t *) deleteKey (arr->val, &i_data, 0); 515 if (data) 516 { 517 key = data->key; 518 value = data->value; 519 // deleteKey(arr->val,&i_data,0); 520 unbound_xstring (key); 521 if (value) 522 { 523 unbound_xstring (value); 524 } 525 mm2_unbound_mem (data->mm_handle); 526 ((aa_master_t *) arr)->length--; 527 } 528 } 529 530 /*remove col_t indexed by col_t from array, return 0 if not found*/ 531 //DOC_FUNC_DEF(aa_unset_col_col DG_AA) 532 int 533 aa_unset_col_col (col_t * arr, col_t * i) 534 { 535 int result = 0; 536 aa_data_t i_data; 537 aa_data_t *data; 538 col_t *value; 539 col_t *key; 540 i_data.key = i; 541 //data=findKey(arr->val,&i_data); 542 data = (aa_data_t *) deleteKey (arr->val, &i_data, 0); 543 if (data) 544 { 545 result = 1; 546 key = data->key; 547 value = data->value; 548 // deleteKey(arr->val,&i_data,0); 549 col_unbound_col (key); 550 if (value) 551 { 552 col_unbound_col (value); 553 } 554 mm2_unbound_mem (data->mm_handle); 555 ((aa_master_t *) arr)->length--; 556 } 557 return result; 558 } 559

aa.h

Main goal definitions


Refined goal definitions


Design goal definitions


Known risks definitions


Type definitions


aa_master_t
aa.c(555) aa.c(526) aa.c(500) aa.c(219) aa.c(195) aa.c(191) aa.c(47) aa.h(38)
aa_data_t
aa.c(542) aa.c(537) aa.c(536) aa.c(514) aa.c(509) aa.c(508) aa.c(497) aa.c(481) aa.c(479) aa.c(478) aa.c(303) aa.c(295) aa.c(293) aa.c(284) aa.c(275) aa.c(265) aa.c(262) aa.c(261) aa.c(257) aa.c(252) aa.c(243) aa.c(233) aa.c(230) aa.c(229) aa.c(225) aa.c(206) aa.c(206) aa.c(205) aa.c(174) aa.c(173) aa.c(152) aa.c(151) aa.c(132) aa.c(132) aa.c(86) aa.c(86) aa.c(55) aa.c(55) aa.c(34) aa.c(33) aa.c(28) aa.h(70) aa.h(67) aa.h(52) aa.h(44) aa.h(44) aa.h(39) aa.h(31) cpp2.c(3281) cpp2.c(3280) part.c(286) misc.c(235) misc.h(119)

Struct variables


Enumeration variables


Define definitions


AA_FOREACH_FUNCTIONS
aa.h(41) part.c(537)

Variable definitions


Function definitions


Rule result definitions Bison


Token definitions


Source


1 #/* cpp2html for viewing c preprocessing as hypertext*/ 2 #/**/ 3 #/* Copyright (C) 2003 K.Karamazen*/ 4 #/**/ 5 #/* This program is free software; you can redistribute it and/or modify*/ 6 #/* it under the terms of the GNU General Public License as published by*/ 7 #/* the Free Software Foundation; either version 2 of the License, or*/ 8 #/* (at your option) any later version.*/ 9 #/* */ 10 #/* This program is distributed in the hope that it will be useful,*/ 11 #/* but WITHOUT ANY WARRANTY; without even the implied warranty of*/ 12 #/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the*/ 13 #/* GNU General Public License for more details.*/ 14 #/* */ 15 #ifndef _AA_H__ 16 #define _AA_H__ 17 #ifndef _AA_H 18 #define _AA_H 19 #include "rbt.h" 20 #include "col.h" 21 #include "mm.h" 22 #include "mm2.h" 23 24 typedef struct 25 { 26 col_t *key; 27 col_t *value; 28 void *mm_handle; 29 /*one key and value element of the array */ 30 //DOC_TYPEDEF(aa_data_t DG_AA) 31 } aa_data_t; 32 typedef struct 33 { 34 col_t c; 35 int length; 36 /*main record of an array */ 37 //DOC_TYPEDEF(aa_master_t DG_AA) 38 } aa_master_t; 39 /*produces static functions to act on aa_data_t for each element of array*/ 40 //DOC_DEFINE(AA_FOREACH_FUNCTIONS DG_AA) 41 #define AA_FOREACH_FUNCTIONS(name,array,code)\ 42 static void name##_element(void*d)\ 43 {\ 44 aa_data_t*data=(aa_data_t*)d;\ 45 {\ 46 code\ 47 }\ 48 }\ 49 static void name##_all(void)\ 50 {\ 51 process_tree_in_order(array->val,NULL,name##_element);\ 52 } 53 aa_data_t *aa_next (col_t * arr, void **ref); 54 void *aa_begin (col_t * arr, col_t * index); 55 int aa_length (col_t * arr); 56 void aa_unbound_pcol_col_element (void *data); 57 int aa_unbound_pcol_col (col_t * array); 58 int aa_unset_col_col (col_t * arr, col_t * i); 59 void aa_unbound_element (void *data); 60 int aa_unbound_col (col_t * array); 61 void aa_foreach (col_t * array, void (*process_data) (void *)); 62 void aa_unbound (col_t * array, void (*unbound_data) (void *)); 63 void unbound_int_xstring (void *data); 64 void unbound_int_xstring_array (col_t * array); 65 int aa_cmpLT (void *a, void *b); 66 int aa_cmpEQ (void *a, void *b); 67 void aa_unset_xstring_xstring (col_t * arr, col_t * i); 68 aa_data_t *aa_greatest_not_gt (col_t * arr, col_t * val); 69 col_t *aa_greatest_not_gt_index (col_t * arr, col_t * val); 70 col_t *aa_greatest_not_gt_data (col_t * arr, col_t * val); 71 aa_data_t *aa_least_not_lt (col_t * arr, col_t * val); 72 col_t *aa_least_not_lt_index (col_t * arr, col_t * val); 73 col_t *aa_least_not_lt_data (col_t * arr, col_t * val); 74 int aa_assign_sint_xstring (col_t * array, int index, col_t * data, 75 rbt_flags_t flag); 76 int aa_assign_xstring_xstring (col_t * array, col_t * index, col_t * data, 77 rbt_flags_t flag); 78 int aa_assign_sstring_xstring (col_t * array, char *index, col_t * data, 79 rbt_flags_t flag); 80 void aa_push_xstring (col_t * array, col_t * data); 81 col_t *xstring_aa_value_sint (col_t * array, int index); 82 col_t *xstring_aa_value_xstring (col_t * array, col_t * index); 83 col_t *xstring_aa_value_sstring (col_t * array, char *index); 84 char *xstring_aa_value_sint2 (col_t * array, int index); 85 char *xstring_aa_value_xstring2 (col_t * array, col_t * index); 86 char *xstring_aa_value_sstring2 (col_t * array, char *index); 87 int aa_assign_raw (col_t * array, void *index, lisp_type_t index_type, 88 int index_mm_sort, mm2_unit_t * index_mm_handle, 89 void *data, lisp_type_t data_type, int data_mm_sort, 90 mm2_unit_t * data_mm_handle, rbt_flags_t flag); 91 void aa_push_raw (col_t * array, void *data, lisp_type_t data_type, 92 int data_mm_sort, mm2_unit_t * data_mm_handle); 93 col_t *aa_value_raw (col_t * array, void *index, lisp_type_t index_type, 94 int index_mm_sort, mm2_unit_t * index_mm_handle); 95 void aa_unset (col_t * arr, col_t * i); 96 col_t *aa_value (col_t * arr, col_t * i); 97 void aa_push_array (col_t * arr, col_t * val); 98 int aa_assign (col_t * arr, col_t * i, col_t * val, rbt_flags_t flag); 99 col_t *aa_array (void); 100 #endif 101 #endif 102

col.c

Main goal definitions


Refined goal definitions


Design goal definitions


Known risks definitions


Type definitions


Struct variables


Enumeration variables


Define definitions


Variable definitions


Function definitions


col_bound_new_extended
col.c(738) col.h(317)
col_new_col
col.c(725) col.h(323)
col_xstring_substring
col.c(678) col.c(442) col.c(441) col.c(431) col.c(429) col.c(214) col.h(324) cpp2.c(4102) cpp2.h(131) cpp2.h(130) part.c(308) part.c(91) part.c(85)
col_concat_xstring
col.c(636) col.c(443) col.c(432) col.c(432) col.c(204) col.h(326) cpp2.c(117) cpp2.c(93) cpp2.h(131) part.c(797) misc.c(529) misc.c(509) misc.c(187)
col_print_col_to_xstring
col.c(602) col.h(327)
col_unbound_col
aa.c(552) aa.c(549) aa.c(439) aa.c(435) aa.c(89) aa.c(87) aa.c(60) aa.c(58) aa.c(57) col.c(584) col.c(565) col.c(563) col.c(561) col.c(547) col.c(545) col.c(532) col.c(520) col.c(518) col.c(517) col.c(516) col.c(515) col.c(513) col.c(499) col.c(495) col.c(493) col.c(491) col.c(489) col.c(472) col.h(328) cpp2.c(4924) cpp2.c(4829) cpp2.c(4713) cpp2.c(4592) cpp2.c(4540) cpp2.c(4534) cpp2.c(4233) cpp2.c(4220) cpp2.c(4209) cpp2.c(4112) cpp2.c(3901) cpp2.c(3900) cpp2.c(3606) cpp2.c(3605) cpp2.c(3591) cpp2.c(3157) cpp2.c(2994) cpp2.c(2227) cpp2.c(2193) cpp2.c(2172) cpp2.c(2132) cpp2.c(1944) cpp2.c(1898) cpp2.c(1889) cpp2.c(1494) cpp2.c(1245) cpp2.c(1244) cpp2.c(1164) cpp2.c(679) cpp2.c(677) cpp2.c(675) cpp2.c(673) cpp2.c(671) cpp2.c(669) cpp2.c(667) cpp2.c(649) cpp2.c(557) cpp2.c(396) cpp2.c(369) cpp2.c(359) cpp2.c(180) cpp2.h(123) cpp2.h(118) part.c(660) part.c(299) part.c(183) misc.c(1270) misc.c(1269) misc.c(1239) misc.c(273) misc.c(227) misc.c(209) stack.c(141)
col_unbound_xstring
col.c(716) col.c(672) col.c(658) col.c(479) col.c(464) col.c(145) col.c(135) col.h(329)
col_space
col.c(449) col.h(315) cpp2.h(102) part.c(140) part.c(120)
col_cut_xstring
col.c(438) col.h(313) part.c(117)
col_insert
col.c(421) col.h(314) part.c(140) part.c(120)
col_new_xstring2
col.c(657) col.c(409) col.h(316) cpp2.c(4515) misc.c(205)
col_new_xstring
col.c(709) col.c(455) col.c(412) col.c(373) col.c(348) col.c(127) col.c(85) col.h(330) col.h(302)
col_new_file
col.c(354) col.h(322) misc.c(458)
col_duplicate_xstring
col.c(610) col.c(344) col.h(331) cpp2.c(3159)
col_new_pleaf
col.c(328) col.h(320) misc.c(678) misc.c(639)
col_new_cons
col.c(313) col.h(319) misc.c(986) misc.c(975)
col_new_col_symbol
col.c(301) col.h(332)
col_bound_col
col.c(292) col.h(321) misc.c(913) misc.c(909) misc.c(264)
col_nth2
col.c(278) col.h(333)
col_nth
col.c(263) col.h(334)
val_int
col.c(255) col.h(342) cpp2.c(4828) cpp2.c(4712) cpp2.c(4591) cpp2.c(2993) cpp2.c(556) cpp2.c(179) cpp2.h(116) part.c(659) part.c(332) part.c(329) part.c(297) part.c(294)
new_int
aa.c(407) col.c(243) col.h(346) cpp2.c(4845) cpp2.c(4729) cpp2.c(4609) cpp2.c(4532) cpp2.c(3008) cpp2.c(939) cpp2.c(551) cpp2.c(543) cpp2.c(408) cpp2.c(195) cpp2.h(120) cpp2.h(119) cpp2.h(115) part.c(674) part.c(285) part.c(179) misc.c(1265) misc.c(1263) misc.c(1186) misc.c(693) misc.c(693) misc.c(655) misc.c(654) misc.c(260)
val_lisp_int
col.c(235) col.h(356) cpp2.c(3910)
val_lisp_pleaf
col.c(227) col.h(355)
val_lisp_string
col.c(219) col.h(354)
xstring_substring
col.c(209) col.h(347) cpp2.c(4658) cpp2.c(2034) misc.c(587) misc.c(551)
concat_xstring
col.c(201) col.h(349) cpp2.c(4870) cpp2.c(4791) cpp2.c(4778) cpp2.c(4768) cpp2.c(4639) cpp2.c(4633) cpp2.c(4301) cpp2.c(4289) cpp2.c(4279) cpp2.c(4270) cpp2.c(4265) cpp2.c(4259) cpp2.c(4183) cpp2.c(4131) cpp2.c(3074) cpp2.c(3065) cpp2.c(3059) cpp2.c(2099) cpp2.c(1939) cpp2.c(1939) cpp2.c(941) cpp2.c(941) cpp2.c(576) cpp2.c(575) part.c(761) part.c(755) part.c(746) part.c(742) part.c(724) part.c(320) part.c(307) misc.c(1319) misc.c(1250) misc.c(1244) misc.c(418) misc.c(418)
print_col_to_xstring
col.c(167) col.h(343) cpp2.c(942)
unbound_col
aa.c(134) aa.c(133) col.c(140) col.h(337) cpp2.c(4764) cpp2.c(4662) cpp2.c(3911) cpp2.c(3578) cpp2.c(3577) cpp2.c(3383) cpp2.c(3146) cpp2.c(3142) cpp2.c(2224) cpp2.c(2129) cpp2.c(2101) cpp2.c(2094) cpp2.c(2091) cpp2.c(2035) cpp2.c(2026) cpp2.c(1978) cpp2.c(1943) cpp2.c(1914) cpp2.c(1903) cpp2.c(1748) cpp2.c(1745) cpp2.c(1692) cpp2.c(1447) cpp2.c(1264) cpp2.c(1205) cpp2.c(957) cpp2.c(954) cpp2.c(953) cpp2.c(411) part.c(802) part.c(422) part.c(397) part.c(376) part.c(364) misc.c(1189)
unbound_xstring
aa.c(523) aa.c(520) aa.c(469) col.c(132) col.h(350) cpp2.c(4512) cpp2.c(4503) cpp2.c(3682) cpp2.c(3675) cpp2.c(3333) cpp2.c(2813) cpp2.c(2796) cpp2.c(2770) cpp2.c(1315) cpp2.c(1304) cpp2.c(738) cpp2.c(530) misc.c(601) misc.c(489) misc.c(425)
new_xstring
aa.c(411) col.c(124) col.h(351) col.h(297) cpp2.c(3318)
del_elm_xstring
col.c(116) col.h(338) cpp2.c(3365) cpp2.c(3364) cpp2.c(3363) cpp2.c(3362) cpp2.c(3361) cpp2.c(3360) cpp2.c(3359) cpp2.c(3358) cpp2.c(2326) cpp2.c(2306) cpp2.c(2275) cpp2.c(2255) cpp2.c(1934) cpp2.c(1933) cpp2.c(1931) cpp2.c(1930) cpp2.c(1928) cpp2.c(1926) cpp2.c(1924) cpp2.c(1922) cpp2.c(1565) cpp2.c(1536) part.c(525) part.c(513) part.c(503) part.c(501) part.c(477) part.c(471) part.c(457) part.c(455) part.c(446) part.c(445) part.c(444) part.c(443) part.c(442) part.c(356)
add_elm_xstring
col.c(108) col.h(339) cpp2.c(2328) cpp2.c(1563) cpp2.c(1556) cpp2.c(1538) cpp2.c(1531) cpp2.c(1525) part.c(523) part.c(521) part.c(517) part.c(515) part.c(511) part.c(505) part.c(494) part.c(475) part.c(473) part.c(467) part.c(465) part.c(463) part.c(459) part.c(449)
is_elm_xstring
col.c(100) col.h(340) cpp2.c(3213) cpp2.c(3109) cpp2.c(3107) cpp2.c(2922) cpp2.c(2920) cpp2.c(2917) cpp2.c(2915) cpp2.c(2389) cpp2.c(2342) cpp2.c(2324) cpp2.c(2273) cpp2.c(2253) cpp2.c(2216) cpp2.c(2214) cpp2.c(2207) cpp2.c(2122) cpp2.c(1553) cpp2.c(1551) cpp2.c(1523) cpp2.c(1506) part.c(826) part.c(824) part.c(821) part.c(819) part.c(491) part.c(489) part.c(447) part.c(415) part.c(413) part.c(388) part.c(386) part.c(353) part.c(349) part.c(347)
set0_xstring
col.c(91) col.h(341) cpp2.c(3318)
duplicate_xstring
col.c(175) col.c(82) col.h(344) cpp2.c(4296) cpp2.c(4288) cpp2.c(4278) cpp2.c(4269) cpp2.c(4258) misc.c(394) misc.c(393)
length_xstring
col.c(690) col.c(348) col.c(94) col.c(85) col.c(72) col.h(352) cpp2.c(4760) cpp2.c(4651) cpp2.c(3322) cpp2.h(101) part.c(800) part.c(799) part.c(167) part.c(165) part.c(138) part.c(135) part.c(111) part.c(107) misc.c(1317) misc.c(584) misc.c(403) misc.c(207) misc.c(201) misc.c(199)
val_xstring
aa.c(399) aa.c(391) aa.c(383) col.c(711) col.c(688) col.c(457) col.c(456) col.c(414) col.c(413) col.c(348) col.c(119) col.c(111) col.c(103) col.c(94) col.c(85) col.c(62) col.c(56) col.h(353) cpp2.c(4763) cpp2.c(4654) cpp2.c(4652) cpp2.c(4511) cpp2.c(4499) cpp2.c(4497) cpp2.c(4099) cpp2.c(3588) cpp2.c(3382) cpp2.c(3321) cpp2.c(3321) cpp2.c(3295) cpp2.c(3283) cpp2.c(3282) cpp2.c(3144) cpp2.c(3141) cpp2.c(2808) cpp2.c(2793) cpp2.c(2764) cpp2.c(2226) cpp2.c(2223) cpp2.c(2131) cpp2.c(2128) cpp2.c(2100) cpp2.c(2093) cpp2.c(2090) cpp2.c(2033) cpp2.c(2022) cpp2.c(1980) cpp2.c(1976) cpp2.c(1942) cpp2.c(1910) cpp2.c(1893) cpp2.c(1881) cpp2.c(1747) cpp2.c(1744) cpp2.c(1689) cpp2.c(1683) cpp2.c(1263) cpp2.c(1083) cpp2.c(1051) cpp2.c(1023) cpp2.c(1001) cpp2.c(956) cpp2.c(944) cpp2.c(893) cpp2.c(844) cpp2.c(737) cpp2.c(601) cpp2.h(101) part.c(801) part.c(800) part.c(625) part.c(544) part.c(543) part.c(427) part.c(421) part.c(395) part.c(379) part.c(375) part.c(367) part.c(362) part.c(198) part.c(165) part.c(137) part.c(115) part.c(110) part.c(107) part.c(91) part.c(85) part.c(79) part.c(47) misc.c(1305) misc.c(1304) misc.c(1303) misc.c(1254) misc.c(1245) misc.c(1226) misc.c(1142) misc.c(591) misc.c(590) misc.c(589) misc.c(588) misc.c(479) misc.c(475) misc.c(422) misc.c(419) misc.c(402) misc.c(205)
val_xstring_or_string
aa.c(179) aa.c(179) aa.c(157) aa.c(157) col.c(614) col.c(179) col.c(52) col.h(345)
new_col_symbol
col.c(40) col.h(335) cpp2.h(166)
bound_new_col_symbol
aa.c(298) aa.c(190) col.c(28) col.h(336) cpp2.c(3893)

Rule result definitions Bison


Token definitions


Source


1 #/* cpp2html for viewing c preprocessing as hypertext*/ 2 #/**/ 3 #/* Copyright (C) 2003 K.Karamazen*/ 4 #/**/ 5 #/* This program is free software; you can redistribute it and/or modify*/ 6 #/* it under the terms of the GNU General Public License as published by*/ 7 #/* the Free Software Foundation; either version 2 of the License, or*/ 8 #/* (at your option) any later version.*/ 9 #/* */ 10 #/* This program is distributed in the hope that it will be useful,*/ 11 #/* but WITHOUT ANY WARRANTY; without even the implied warranty of*/ 12 #/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the*/ 13 #/* GNU General Public License for more details.*/ 14 #/* */ 15 #include "stdlib.h" 16 #include "string.h" 17 #include "mm.h" 18 #include "mm2.h" 19 #include "stdio.h" 20 #include "rbt.h" 21 #include "aa.h" 22 #include "col.h" 23 #include "stack.h" 24 #include "list.h" 25 26 /*bound storage*/ 27 //DOC_FUNC_DEF(bound_new_col_symbol DG_COL) 28 void 29 bound_new_col_symbol (col_t ** var, col_type_t col_type, void *val) 30 { 31 col_t *var_loc = (col_t *) bound_new_mem (sizeof (col_t)); 32 var_loc->type = col_type; 33 var_loc->mm_handle = mm_handle; 34 var_loc->val = val; 35 *var = var_loc; 36 } 37 38 /*bound storage*/ 39 //DOC_FUNC_DEF(new_col_symbol DG_COL) 40 col_t * 41 new_col_symbol (col_type_t col_type) 42 { 43 col_t *var_loc = (col_t *) bound_new_mem (sizeof (col_t)); 44 var_loc->type = col_type; 45 var_loc->mm_handle = mm_handle; 46 var_loc->val = NULL; 47 return var_loc; 48 } 49 50 /*string value*/ 51 //DOC_FUNC_DEF(val_xstring_or_string DG_COL) 52 char * 53 val_xstring_or_string (col_t * s) 54 { 55 char *str; 56 str = (s->type == STRINGP ? (char *) (s->val) : val_xstring (s)); 57 return str; 58 } 59 60 /*string value of xstring*/ 61 //DOC_FUNC_DEF(val_xstring DG_SET) 62 char * 63 val_xstring (col_t * s) 64 { 65 char *result; 66 result = (char *) s + COL_STRUCT_SIZEOF (col_t); 67 return result; 68 } 69 70 /*length of xstring*/ 71 //DOC_FUNC_DEF(length_xstring DG_SET) 72 int 73 length_xstring (col_t * s) 74 { 75 int result; 76 result = (int) (s->val); 77 return result; 78 } 79 80 /*make a physical copy of xstring*/ 81 //DOC_FUNC_DEF(duplicate_xstring DG_SET) 82 col_t * 83 duplicate_xstring (col_t * xs) 84 { 85 return col_new_xstring (length_xstring (xs), val_xstring (xs), 86 XSTRING_STRCPY); 87 } 88 89 /*empty set (all bits zero)*/ 90 //DOC_FUNC_DEF(set0_xstring DG_SET) 91 col_t * 92 set0_xstring (col_t * s) 93 { 94 memset (val_xstring (s), 0, length_xstring (s)); 95 return s; 96 } 97 98 /*check if element (if the corresponding bit is set)*/ 99 //DOC_FUNC_DEF(is_elm_xstring DG_SET) 100 int 101 is_elm_xstring (col_t * s, int elm) 102 { 103 return DER (val_xstring (s) + elm / 8) & (1 << (elm % 8)); 104 } 105 106 /*add an element (set the corresponding bit)*/ 107 //DOC_FUNC_DEF(add_elm_xstring DG_SET) 108 void 109 add_elm_xstring (col_t * s, int elm) 110 { 111 DER (val_xstring (s) + elm / 8) |= (1 << (elm % 8)); 112 } 113 114 /*remove an element (zero the corresponding bit)*/ 115 //DOC_FUNC_DEF(del_elm_xstring DG_SET) 116 void 117 del_elm_xstring (col_t * s, int elm) 118 { 119 DER (val_xstring (s) + elm / 8) &= ~(1 << (elm % 8)); 120 } 121 122 /*generate new xstring*/ 123 //DOC_FUNC_DEF(new_xstring DG_XSTRING) 124 col_t * 125 new_xstring (int length, char *init) 126 { 127 return col_new_xstring (length, init, XSTRING_STRCPY); 128 } 129 130 /*unbound xstring*/ 131 //DOC_FUNC_DEF(unbound_xstring DG_XSTRING) 132 void 133 unbound_xstring (col_t * str) 134 { 135 col_unbound_xstring (str); 136 } 137 138 /*unbound storage*/ 139 //DOC_FUNC_DEF(unbound_col DG_COL) 140 void 141 unbound_col (col_t * s) 142 { 143 if (XSTRINGP == s->type) 144 { 145 col_unbound_xstring (s); 146 } 147 else if (INTP == s->type) 148 { 149 unbound_mem_from_handle (s->mm_handle); 150 } 151 else if (STRINGP == s->type) 152 { 153 unbound_mem_from_handle (s->mm_handle); 154 } 155 } 156 157 #define EXCHANGE(a,b,temp)\ 158 temp=a;\ 159 a=b;\ 160 b=temp; 161 162 #define MAX(a,b)\ 163 (a<b?b:a) 164 165 /*convert to xstring*/ 166 //DOC_FUNC_DEF(print_col_to_xstring DG_XSTRING) 167 col_t * 168 print_col_to_xstring (col_t * c) 169 { 170 col_t *result; 171 if (c && (c->val || INTP == c->type)) 172 { 173 if (XSTRINGP == c->type) 174 { 175 result = duplicate_xstring (c); 176 } 177 else if (STRINGP == c->type) 178 { 179 result = NEW_XSTRING_CONST (val_xstring_or_string (c)); 180 } 181 else if (INTP == c->type) 182 { 183 char number[100]; 184 sprintf (number, "%d", (int) (c->val)); 185 result = NEW_XSTRING_CONST (number); 186 } 187 else 188 { 189 result = NEW_XSTRING_CONST ("#"); 190 } 191 } 192 else 193 { 194 result = NEW_XSTRING_CONST ("(NULL)"); 195 } 196 return result; 197 } 198 199 /*concatinate xstrings*/ 200 //DOC_FUNC_DEF(concat_xstring DG_XSTRING) 201 col_t * 202 concat_xstring (col_t * str1, col_t * str2) 203 { 204 return col_concat_xstring (str1, str2); 205 } 206 207 /*take substring of xstring*/ 208 //DOC_FUNC_DEF(xstring_substring DG_XSTRING) 209 col_t * 210 xstring_substring (col_t * str, int p1, int p2, 211 xstring_substring_flags_t flag) 212 { 213 /*sub("0123",0,0)=="0";sub("0123",0,-1)=="0123";sub("0123",0,3)=="0123";sub("0123",-1,-1)=="3"; */ 214 return col_xstring_substring (str, p1, (p2 == -1 ? 0 : 1), p2 + 1, flag); 215 } 216 217 /*string value*/ 218 //DOC_FUNC_DEF(val_lisp_string DG_COL) 219 char * 220 val_lisp_string (col_t * lisp_symbol) 221 { 222 return (char *) (lisp_symbol->val); 223 } 224 225 /*bison symbol value*/ 226 //DOC_FUNC_DEF(val_lisp_pleaf DG_COL) 227 pleaf_t * 228 val_lisp_pleaf (col_t * lisp_symbol) 229 { 230 return (pleaf_t *) & (lisp_symbol->val); 231 } 232 233 /*int value*/ 234 //DOC_FUNC_DEF(val_lisp_int DG_COL) 235 int * 236 val_lisp_int (col_t * lisp_symbol) 237 { 238 return (int *) &(lisp_symbol->val); 239 } 240 241 /*create new integer*/ 242 //DOC_FUNC_DEF(new_int DG_COL) 243 col_t * 244 new_int (int init) 245 { 246 col_t *var_loc = (col_t *) bound_new_mem (sizeof (col_t)); 247 var_loc->type = INTP; 248 var_loc->mm_handle = mm_handle; 249 var_loc->val = (void *) init; 250 return var_loc; 251 } 252 253 /*value of integer*/ 254 //DOC_FUNC_DEF(val_int DG_COL) 255 int * 256 val_int (col_t * s) 257 { 258 return (int *) &(s->val); 259 } 260 261 /*nth function for list*/ 262 //DOC_FUNC_DEF(col_nth DG_COL) 263 col_t * 264 col_nth (col_t * l, int n) 265 { 266 int i; 267 lisp_cons_cell_t *c; 268 c = (lisp_cons_cell_t *) (l->val); 269 for (i = 0; i < n; i++) 270 { 271 c = c->cdr; 272 } 273 return c->car; 274 } 275 276 /*nth function for list, version2*/ 277 //DOC_FUNC_DEF(col_nth2 DG_COL) 278 col_t * 279 col_nth2 (lisp_cons_cell_t * c, int n) 280 { 281 int i; 282 for (i = 0; i < n; i++) 283 { 284 c = c->cdr; 285 } 286 return c->car; 287 } 288 289 // functions that use mm2 290 /*bound storage*/ 291 //DOC_FUNC_DEF(col_bound_col DG_COL) 292 col_t * 293 col_bound_col (col_t * c) 294 { 295 mm2_bound_mem (c->mm_handle); 296 return c; 297 } 298 299 /*bound storage*/ 300 //DOC_FUNC_DEF(col_new_col_symbol DG_COL) 301 col_t * 302 col_new_col_symbol (col_type_t col_type) 303 { 304 col_t *var_loc = (col_t *) mm2_bound_new_mem (sizeof (col_t)); 305 var_loc->type = col_type; 306 var_loc->mm_handle = mm2_handle; 307 var_loc->val = NULL; 308 return var_loc; 309 } 310 311 /*create new cons cell*/ 312 //DOC_FUNC_DEF(col_new_cons DG_COL) 313 col_t * 314 col_new_cons (col_t * car, void *cdr) 315 { 316 lisp_cons_cell_t *var_cons = 317 (lisp_cons_cell_t *) mm2_bound_new_mem (sizeof (lisp_cons_cell_t)); 318 col_t *var_loc = (col_t *) var_cons; 319 var_loc->type = CONSP; 320 var_loc->mm_handle = mm2_handle; 321 var_loc->val = (void *) car; 322 var_cons->cdr = (lisp_cons_cell_t *) cdr; 323 return var_loc; 324 } 325 326 /*create new symbol*/ 327 //DOC_FUNC_DEF(col_new_pleaf DG_COL) 328 col_t * 329 col_new_pleaf (void) 330 { 331 col_t *var_loc = (col_t *) mm2_bound_new_mem (sizeof (leaf_t)); 332 memset (var_loc, 0, sizeof (leaf_t)); 333 var_loc->type = PLEAFP; 334 var_loc->mm_handle = mm2_handle; 335 var_loc->val = (void *) var_loc; 336 { 337 // leaf_t*var=(leaf_t*)var_loc; 338 } 339 return var_loc; 340 } 341 342 /*duplicate xstring*/ 343 //DOC_FUNC_DEF(col_duplicate_xstring DG_SET) 344 col_t * 345 col_duplicate_xstring (col_t * xs, col_duplicate_flags_t flag) 346 { 347 col_t *result; 348 result = col_new_xstring (length_xstring (xs), val_xstring (xs), flag); 349 return result; 350 } 351 352 /*create new file*/ 353 //DOC_FUNC_DEF(col_new_file DG_COL) 354 col_t * 355 col_new_file (void) 356 { 357 col_t *var_loc = (col_t *) mm2_bound_new_mem (sizeof (text_heap_heap_t)); 358 memset (var_loc, 0, sizeof (text_heap_heap_t)); 359 var_loc->type = FILEP; 360 var_loc->mm_handle = mm2_handle; 361 var_loc->val = NULL; 362 { 363 text_heap_heap_t *var = (text_heap_heap_t *) var_loc; 364 var->cnt_nl = NULL; 365 var->add_info = NULL; 366 var->ps01_parser = NULL; 367 } 368 return var_loc; 369 } 370 371 /*generate new xstring*/ 372 //DOC_FUNC_DEF(col_new_xstring DG_XSTRING) 373 col_t * 374 col_new_xstring (int length, char *init, col_duplicate_flags_t flag) 375 { 376 int xstroffset = COL_STRUCT_SIZEOF (col_t); 377 col_t *var_loc = (col_t *) mm2_bound_new_mem (xstroffset + length + 1); 378 char *value_val; 379 var_loc->type = XSTRINGP; 380 var_loc->mm_handle = mm2_handle; 381 var_loc->val = (void *) length; 382 value_val = (char *) var_loc + xstroffset; 383 *(value_val) = 0; 384 if (init) 385 { 386 if (XSTRING_STRCPY == flag) 387 { 388 int i = 0; 389 while (*(init + i)) 390 { 391 *(value_val + i) = *(init + i); 392 i++; 393 } 394 *(value_val + i) = 0; 395 var_loc->val = (void *) i; 396 // strcpy(value_val,init); 397 } 398 else 399 { 400 memcpy (value_val, init, (int) (var_loc->val)); 401 *(value_val + (int) (var_loc->val)) = 0; 402 } 403 } 404 return var_loc; 405 } 406 407 /*generate new xstring, with zero in init possible*/ 408 //DOC_FUNC_DEF(col_new_xstring2 DG_XSTRING) 409 col_t * 410 col_new_xstring2 (int length, char *init, int copy_length) 411 { 412 col_t *x = col_new_xstring (length, "", XSTRING_STRCPY); 413 memcpy (val_xstring (x), init, copy_length); 414 DER (val_xstring (x) + copy_length) = 0; 415 x->val = (void *) copy_length; 416 return x; 417 } 418 419 /*insert xstring*/ 420 //DOC_FUNC_DEF(col_insert DG_XSTRING) 421 col_t * 422 col_insert (col_t * x, col_t * to_insert, int pos) 423 { 424 col_t *part1; 425 col_t *part2; 426 col_t *part3; 427 if (pos < 0) 428 pos = 0; 429 part3 = col_xstring_substring (x, pos, 0, 0, XSTRING_BOUNDNEW); 430 part2 = to_insert; 431 part1 = col_xstring_substring (x, 0, 1, pos, XSTRING_REUSE); 432 x = col_concat_xstring (col_concat_xstring (part1, part2), part3); 433 return x; 434 } 435 436 /*cut xstring*/ 437 //DOC_FUNC_DEF(col_cut_xstring DG_XSTRING) 438 col_t * 439 col_cut_xstring (col_t * x, int pos1, int pos2) 440 { 441 col_t *part3 = col_xstring_substring (x, pos2, 0, 0, XSTRING_BOUNDNEW); 442 col_t *part1 = col_xstring_substring (x, 0, 1, pos1, XSTRING_REUSE); 443 x = col_concat_xstring (part1, part3); 444 return x; 445 } 446 447 /*generate new xstring*/ 448 //DOC_FUNC_DEF(col_space DG_XSTRING) 449 col_t * 450 col_space (int length) 451 { 452 col_t *x; 453 if (length < 0) 454 length = 0; 455 x = col_new_xstring (length, "", XSTRING_STRCPY); 456 memset (val_xstring (x), ' ', length); 457 DER (val_xstring (x) + length) = 0; 458 x->val = (void *) length; 459 return x; 460 } 461 462 /*unbound xstring*/ 463 //DOC_FUNC_DEF(col_unbound_xstring DG_XSTRING) 464 int 465 col_unbound_xstring (col_t * str) 466 { 467 return mm2_unbound_mem (str->mm_handle); 468 } 469 470 /*unbound storage*/ 471 //DOC_FUNC_DEF(col_unbound_col DG_COL) 472 int 473 col_unbound_col (void *t) 474 { 475 col_t *s = (col_t *) t; 476 int result = 0; 477 if (XSTRINGP == s->type) 478 { 479 result = col_unbound_xstring (s); 480 } 481 else if (FILEP == s->type) 482 { 483 text_heap_heap_t *t = (text_heap_heap_t *) s; 484 if (!(result = mm2_unbound_mem (s->mm_handle))) 485 { 486 /*!!begin critical section: uses unbounded result!! */ 487 mm2_bound_new_forbidden = 1; 488 if (t->xstring) 489 col_unbound_col (t->xstring); 490 if (t->misc_ahead_xstring) 491 col_unbound_col (t->misc_ahead_xstring); 492 if (t->file_name) 493 col_unbound_col (t->file_name); 494 if (t->cnt_nl) 495 col_unbound_col (t->cnt_nl); 496 if (t->file_ptr && t->file_ptr != stdin) 497 fclose (t->file_ptr); 498 if (t->add_info) 499 col_unbound_col (t->add_info); 500 mm2_bound_new_forbidden = 0; 501 /*!!end critical section: uses unbounded result!! */ 502 } 503 } 504 else if (PARSERP == s->type) 505 { 506 parser_master_t *t = (parser_master_t *) s; 507 t = t; 508 if (!(result = mm2_unbound_mem (s->mm_handle))) 509 { 510 /*!!begin critical section: uses unbounded result!! */ 511 mm2_bound_new_forbidden = 1; 512 if (t->connecting_nonterminal) 513 col_unbound_col (t->connecting_nonterminal); 514 515 /* if (t->xstring) col_unbound_col(t->xstring); */ 516 /* if (t->misc_ahead_xstring) col_unbound_col(t->misc_ahead_xstring); */ 517 /* if (t->file_name) col_unbound_col(t->file_name); */ 518 /* if (t->cnt_nl) col_unbound_col(t->cnt_nl); */ 519 /* if (t->file_ptr && t->file_ptr!=stdin) fclose(t->file_ptr); */ 520 /* if (t->add_info) col_unbound_col(t->add_info); */ 521 mm2_bound_new_forbidden = 0; 522 /*!!end critical section: uses unbounded result!! */ 523 } 524 } 525 else if (LISTP == s->type) 526 { 527 if (!(result = mm2_unbound_mem (s->mm_handle))) 528 { 529 /*!!begin critical section: uses unbounded result!! */ 530 mm2_bound_new_forbidden = 1; 531 if (s->val) 532 col_unbound_col (s->val); 533 mm2_bound_new_forbidden = 0; 534 /*!!end critical section: uses unbounded result!! */ 535 } 536 } 537 else if (CONSP == s->type) 538 { 539 lisp_cons_cell_t *t = (lisp_cons_cell_t *) s; 540 if (!(result = mm2_unbound_mem (s->mm_handle))) 541 { 542 /*!!begin critical section: uses unbounded result!! */ 543 mm2_bound_new_forbidden = 1; 544 if (t->car) 545 col_unbound_col (t->car); 546 if (t->cdr) 547 col_unbound_col (t->cdr); 548 mm2_bound_new_forbidden = 0; 549 /*!!end critical section: uses unbounded result!! */ 550 } 551 } 552 else if (PLEAFP == s->type) 553 { 554 pleaf_t t = (pleaf_t) s; 555 if (!(result = mm2_unbound_mem (s->mm_handle))) 556 { 557 /*!!begin critical section: uses unbounded result!! */ 558 mm2_bound_new_forbidden = 1; 559 if ((t->tag & COL_TEXT_HEAP_BOUNDED) && t->text_heap_heap) 560 { 561 int res = col_unbound_col (t->text_heap_heap); 562 if (res == 1) 563 col_unbound_col (t->text_heap_heap); 564 } 565 //if (t->att) col_unbound_col(t->att); 566 mm2_bound_new_forbidden = 0; 567 /*!!end critical section: uses unbounded result!! */ 568 } 569 } 570 else if (INTP == s->type) 571 { 572 result = mm2_unbound_mem (s->mm_handle); 573 } 574 else if (STRINGP == s->type) 575 { 576 result = mm2_unbound_mem (s->mm_handle); 577 } 578 else if (STACKP == s->type) 579 { 580 result = stack_unbound (s); 581 } 582 else if (CLISTP == s->type) 583 { 584 result = unbound_list2 (s, (col_data_function_t) col_unbound_col); 585 } 586 else if (AAP == s->type) 587 { 588 result = aa_unbound_col (s); 589 } 590 else if (COL_NEXT_FREE_TYPE_SLOT <= s->type) 591 { 592 result = col_extended_type_unbound (s); 593 } 594 else 595 { 596 } 597 return result; 598 } 599 600 /*convert to xstring*/ 601 //DOC_FUNC_DEF(col_print_col_to_xstring DG_XSTRING) 602 col_t * 603 col_print_col_to_xstring (col_t * c) 604 { 605 col_t *result; 606 if (c && (c->val || INTP == c->type || XSTRINGP == c->type)) 607 { 608 if (XSTRINGP == c->type) 609 { 610 result = col_duplicate_xstring (c, XSTRING_MEMCPY); 611 } 612 else if (STRINGP == c->type) 613 { 614 result = COL_NEW_XSTRING_CONST (val_xstring_or_string (c)); 615 } 616 else if (INTP == c->type) 617 { 618 char number[100]; 619 sprintf (number, "%d", (int) (c->val)); 620 result = COL_NEW_XSTRING_CONST (number); 621 } 622 else 623 { 624 result = COL_NEW_XSTRING_CONST ("#"); 625 } 626 } 627 else 628 { 629 result = COL_NEW_XSTRING_CONST ("(NULL)"); 630 } 631 return result; 632 } 633 634 /*concatinate xstrings, doesn't handle zero chars:uses prescribed lengths*/ 635 //DOC_FUNC_DEF(col_concat_xstring DG_XSTRING) 636 col_t * 637 col_concat_xstring (col_t * str1, col_t * str2) 638 { 639 char *s1_val; 640 char *s2_val; 641 col_t *str3; 642 int exchanged = 0; 643 int req_length = ((int) (str1->val)) + ((int) (str2->val)); 644 int avail_length = 645 (1 << MAX (MM2_LOG_SIZE (str1), MM2_LOG_SIZE (str2))) - 646 COL_STRUCT_SIZEOF (col_t); 647 if (avail_length > req_length 648 && (MM2_SIZE (str1) - COL_STRUCT_SIZEOF (col_t) < req_length + 1)) 649 { 650 EXCHANGE (str1, str2, str3); 651 exchanged++; 652 } 653 s1_val = (char *) str1 + COL_STRUCT_SIZEOF (col_t); 654 s2_val = (char *) str2 + COL_STRUCT_SIZEOF (col_t); 655 if (avail_length <= req_length) 656 { 657 str3 = col_new_xstring2 (req_length, s1_val, ((int) (str1->val))); 658 col_unbound_xstring (str1); 659 str1 = str3; 660 s1_val = (char *) str1 + COL_STRUCT_SIZEOF (col_t); 661 } 662 if (!exchanged) 663 { 664 memcpy (s1_val + ((int) (str1->val)), s2_val, ((int) (str2->val)) + 1); 665 } 666 else 667 { 668 memmove (s1_val + ((int) (str2->val)), s1_val, ((int) (str1->val)) + 1); 669 memcpy (s1_val, s2_val, ((int) (str2->val))); 670 } 671 ((int) (str1->val)) += ((int) (str2->val)); 672 col_unbound_xstring (str2); 673 return str1; 674 } 675 676 /*take substring of xstring*/ 677 //DOC_FUNC_DEF(col_xstring_substring DG_XSTRING) 678 col_t * 679 col_xstring_substring (col_t * str, int p1, int p2_used, int p2, 680 xstring_substring_flags_t flag) 681 { 682 /*as lisp substring */ 683 /*sub("0123",0,1,0)=="";sub("0123",0,1,-1)=="012";sub("0123",0,1,3)=="012";sub("0123",-1,1,-1)==""; */ 684 /*sub("0123",0,0,0)=="0123";sub("0123",0,0,-1)=="0123";sub("0123",0,0,3)=="0123";sub("0123",-1,0,-1)=="3"; */ 685 int q1, q2; 686 char *new_str = NULL; 687 col_t *new_xstr = NULL; 688 char *old_str = val_xstring (str); 689 int l, d; 690 l = length_xstring (str); 691 q1 = (p1 < 0 ? l + p1 : p1); 692 q1 = (q1 < 0 ? 0 : q1); 693 if (!p2_used) 694 { 695 q2 = l; 696 } 697 else 698 { 699 q2 = (p2 < 0 ? l + p2 : p2); 700 q2 = (q2 > l - 1 ? l : q2); 701 } 702 d = (q2 > q1 ? q2 - q1 : 0); 703 if (XSTRING_REUSE & flag) 704 { 705 new_xstr = str; 706 } 707 if (XSTRING_BOUNDNEW & flag) 708 { 709 new_xstr = col_new_xstring (d, NULL, 0); 710 } 711 new_str = val_xstring (new_xstr); 712 if (new_str != old_str + q1) 713 memmove (new_str, old_str + q1, d); 714 if (XSTRING_UNBOUNDOLD & flag) 715 { 716 col_unbound_xstring (str); 717 } 718 *(new_str + d) = 0; 719 new_xstr->val = (void *) d; 720 return new_xstr; 721 } 722 723 /*new col function*/ 724 //DOC_FUNC_DEF(col_new_col DG_COL) 725 col_t * 726 col_new_col (lisp_type_t t, void *init) 727 { 728 col_t *var_loc; 729 var_loc = (col_t *) mm2_bound_new_mem (sizeof (col_t)); 730 var_loc->type = INTP; 731 var_loc->mm_handle = mm2_handle; 732 var_loc->val = (void *) init; 733 return var_loc; 734 } 735 736 /*new col extended function*/ 737 //DOC_FUNC_DEF(col_bound_new_extended DG_COL) 738 col_t * 739 col_bound_new_extended (int size, int type, void *init) 740 { 741 col_t *var_loc; 742 var_loc = (col_t *) mm2_bound_new_mem (size); 743 var_loc->type = type; 744 var_loc->mm_handle = mm2_handle; 745 var_loc->val = (void *) init; 746 return var_loc; 747 } 748

col.h

Main goal definitions


Refined goal definitions


Design goal definitions


Known risks definitions


Type definitions


lisp_cons_cell_t
col.c(539) col.c(539) col.c(322) col.c(317) col.c(317) col.c(316) col.c(279) col.c(268) col.c(267) col.h(333) col.h(293) cpp2.c(4832) cpp2.c(4809) cpp2.c(4804) cpp2.c(4716) cpp2.c(4693) cpp2.c(4681) cpp2.c(4679) cpp2.c(4595) cpp2.c(4572) cpp2.c(4567) cpp2.c(4566) cpp2.c(4525) cpp2.c(4384) cpp2.c(4368) cpp2.c(4364) cpp2.c(4364) cpp2.c(3976) cpp2.c(3944) cpp2.c(3938) cpp2.c(3933) cpp2.c(3817) cpp2.c(3785) cpp2.c(3781) cpp2.c(3781) cpp2.c(3489) cpp2.c(3467) cpp2.c(3463) cpp2.c(2996) cpp2.c(2975) cpp2.c(2971) cpp2.c(257) cpp2.c(215) cpp2.c(183) cpp2.c(156) cpp2.c(149) cpp2.c(130) cpp2.h(509) part.c(662) part.c(641) part.c(637) misc.c(986) misc.c(975) misc.c(966) misc.c(965) misc.c(964) misc.c(963) misc.c(962) misc.c(961) misc.c(958) misc.c(957) misc.c(951) misc.c(362) misc.c(354) misc.c(178) misc.c(173) misc.h(139) misc.h(137) misc.h(110)
col_type_t
col.c(302) col.c(41) col.c(29) col.h(336) col.h(335) col.h(332) col.h(277)
col_duplicate_flags_t
col.c(374) col.c(345) col.h(331) col.h(330) col.h(273)
xstring_substring_flags_t
col.c(680) col.c(211) col.h(348) col.h(325) col.h(261)
parser_master_t
col.c(506) col.c(506) col.h(225) col.h(216) col.h(213) col.h(211) col.h(174) col.h(168) col.h(127) cpp2.c(4353) cpp2.c(3191) cpp2.c(3097) cpp2.c(2908) cpp2.c(2006) cpp2.c(1859) cpp2.c(1147) cpp2.c(476) cpp2.c(421) cpp2.c(77) cpp2.c(76) cpp2.h(596) cpp2.h(506) misc.c(1313) misc.c(1299) misc.c(1281) misc.c(1207) misc.c(1113) misc.c(1094) misc.c(1072) misc.c(1061) misc.c(769) misc.c(674) misc.c(662) misc.c(635) misc.c(612) misc.c(576) misc.c(564) misc.c(453) misc.c(442) misc.c(412) misc.c(385) misc.c(345) misc.c(334) misc.c(279) misc.c(261) misc.c(248) misc.c(166) misc.c(144) misc.c(144) misc.c(143) misc.c(140) misc.c(138) misc.c(112) misc.c(85) misc.c(60) misc.c(60) misc.c(45) misc.c(45) misc.h(198) misc.h(191) misc.h(190) misc.h(189) misc.h(183) misc.h(173) misc.h(167) misc.h(164) misc.h(162) misc.h(160) misc.h(154) misc.h(153) misc.h(149) misc.h(147) misc.h(135) misc.h(130) misc.h(127) misc.h(124) misc.h(123) misc.h(118) misc.h(108) misc.h(107) misc.h(98) misc.h(37) x_rm1.lex(44)
pleaf_t
col.c(554) col.c(554) col.c(230) col.c(226) col.h(354) col.h(207) col.h(205) col.h(203) col.h(200) col.h(191) col.h(166) cpp2.c(4852) cpp2.c(4852) cpp2.c(4801) cpp2.c(4736) cpp2.c(4736) cpp2.c(4688) cpp2.c(4616) cpp2.c(4616) cpp2.c(4468) cpp2.c(4399) cpp2.c(4399) cpp2.c(4355) cpp2.c(4350) cpp2.c(4324) cpp2.c(3991) cpp2.c(3991) cpp2.c(3935) cpp2.c(3929) cpp2.c(3832) cpp2.c(3832) cpp2.c(3777) cpp2.c(3753) cpp2.c(3561) cpp2.c(3504) cpp2.c(3504) cpp2.c(3460) cpp2.c(3391) cpp2.c(3378) cpp2.c(3246) cpp2.c(3229) cpp2.c(3206) cpp2.c(3192) cpp2.c(3188) cpp2.c(3167) cpp2.c(3094) cpp2.c(3015) cpp2.c(3015) cpp2.c(2967) cpp2.c(2905) cpp2.c(2803) cpp2.c(2788) cpp2.c(2777) cpp2.c(2759) cpp2.c(2442) cpp2.c(2419) cpp2.c(2335) cpp2.c(2313) cpp2.c(2297) cpp2.c(2283) cpp2.c(2263) cpp2.c(2243) cpp2.c(2203) cpp2.c(2182) cpp2.c(2161) cpp2.c(2149) cpp2.c(2117) cpp2.c(2080) cpp2.c(2007) cpp2.c(2003) cpp2.c(1860) cpp2.c(1856) cpp2.c(1845) cpp2.c(1834) cpp2.c(1818) cpp2.c(1801) cpp2.c(1784) cpp2.c(1768) cpp2.c(1765) cpp2.c(1759) cpp2.c(1717) cpp2.c(1701) cpp2.c(1674) cpp2.c(1665) cpp2.c(1651) cpp2.c(1642) cpp2.c(1616) cpp2.c(1606) cpp2.c(1579) cpp2.c(1487) cpp2.c(1369) cpp2.c(1355) cpp2.c(1343) cpp2.c(1253) cpp2.c(1144) cpp2.c(727) cpp2.c(503) cpp2.c(502) cpp2.c(473) cpp2.c(418) cpp2.c(217) cpp2.c(216) cpp2.c(202) cpp2.c(202) cpp2.c(139) cpp2.c(132) cpp2.c(132) cpp2.c(131) cpp2.c(129) cpp2.c(107) cpp2.c(107) cpp2.c(82) cpp2.c(82) cpp2.c(70) cpp2.h(638) cpp2.h(637) cpp2.h(634) cpp2.h(633) cpp2.h(632) cpp2.h(631) cpp2.h(630) cpp2.h(629) cpp2.h(628) cpp2.h(626) cpp2.h(625) cpp2.h(624) cpp2.h(623) cpp2.h(622) cpp2.h(621) cpp2.h(620) cpp2.h(619) cpp2.h(618) cpp2.h(617) cpp2.h(616) cpp2.h(615) cpp2.h(614) cpp2.h(613) cpp2.h(612) cpp2.h(611) cpp2.h(610) cpp2.h(609) cpp2.h(608) cpp2.h(607) cpp2.h(606) cpp2.h(605) cpp2.h(604) cpp2.h(603) cpp2.h(602) cpp2.h(599) cpp2.h(598) cpp2.h(597) cpp2.h(596) cpp2.h(595) cpp2.h(589) cpp2.h(588) cpp2.h(587) cpp2.h(573) cpp2.h(571) cpp2.h(570) cpp2.h(569) cpp2.h(568) cpp2.h(565) cpp2.h(563) cpp2.h(562) cpp2.h(559) cpp2.h(558) cpp2.h(557) cpp2.h(556) cpp2.h(555) cpp2.h(554) cpp2.h(552) cpp2.h(546) cpp2.h(522) cpp2.h(515) cpp2.h(513) cpp2.h(511) cpp2.h(511) cpp2.h(510) cpp2.h(508) cpp2.h(507) cpp2.h(495) cpp2.h(489) cpp2.h(487) cpp2.h(402) cpp2.h(87) cpp2.h(84) cpp2.h(69) cpp2.h(65) cpp2.h(64) cpp2.h(63) part.c(810) part.c(789) part.c(780) part.c(738) part.c(736) part.c(733) part.c(730) part.c(681) part.c(681) part.c(633) part.c(410) part.c(344) part.c(273) part.c(186) part.c(149) part.c(29) part.h(45) part.h(44) part.h(43) part.h(39) part.h(34) part.h(32) part.h(31) part.h(30) part.h(28) misc.c(1174) misc.c(1165) misc.c(1148) misc.c(1139) misc.c(1110) misc.c(1091) misc.c(953) misc.c(945) misc.c(937) misc.c(929) misc.c(922) misc.c(920) misc.c(920) misc.c(894) misc.c(894) misc.c(886) misc.c(886) misc.c(874) misc.c(874) misc.c(866) misc.c(866) misc.c(856) misc.c(842) misc.c(829) misc.c(816) misc.c(795) misc.c(782) misc.c(765) misc.c(747) misc.c(746) misc.c(744) misc.c(742) misc.c(730) misc.c(722) misc.c(715) misc.c(708) misc.c(700) misc.c(678) misc.c(672) misc.c(639) misc.c(633) misc.c(616) misc.c(610) misc.c(541) misc.c(523) misc.c(523) misc.c(503) misc.c(503) misc.c(445) misc.c(343) misc.c(316) misc.c(298) misc.c(258) misc.c(240) misc.c(238) misc.c(220) misc.c(117) misc.c(113) misc.c(108) misc.c(90) misc.c(88) misc.h(199) misc.h(197) misc.h(196) misc.h(196) misc.h(195) misc.h(195) misc.h(194) misc.h(194) misc.h(193) misc.h(191) misc.h(190) misc.h(188) misc.h(187) misc.h(186) misc.h(186) misc.h(185) misc.h(185) misc.h(184) misc.h(179) misc.h(178) misc.h(177) misc.h(176) misc.h(175) misc.h(174) misc.h(159) misc.h(158) misc.h(157) misc.h(155) misc.h(152) misc.h(151) misc.h(150) misc.h(145) misc.h(144) misc.h(143) misc.h(141) misc.h(140) misc.h(138) misc.h(137) misc.h(131) misc.h(129) misc.h(129) misc.h(126) misc.h(125) misc.h(122) misc.h(122) misc.h(120) misc.h(117) misc.h(113) misc.h(113) misc.h(112) misc.h(112) misc.h(107) rm1.h(26)
leaf_t
col.c(337) col.c(337) col.c(332) col.c(331) col.h(166) col.h(162) cpp2.c(1631) part.c(28) misc.c(615)
text_heap_heap_t
col.c(483) col.c(483) col.c(363) col.c(363) col.c(358) col.c(357) col.h(197) col.h(157) col.h(130) cpp2.c(4891) cpp2.c(4886) cpp2.c(405) cpp2.h(640) cpp2.h(527) cpp2.h(516) part.c(176) part.h(29) misc.c(1196) misc.c(1183) misc.c(908) misc.c(458) misc.c(457) misc.c(451) misc.c(194) misc.c(184) misc.h(170) misc.h(167) misc.h(146) misc.h(142) misc.h(134) misc.h(116) misc.h(115)
tags_t
col.h(151) col.h(95)
col_t
aa.c(539) aa.c(538) aa.c(533) aa.c(533) aa.c(530) aa.c(530) aa.c(511) aa.c(510) aa.c(506) aa.c(506) aa.c(495) aa.c(495) aa.c(476) aa.c(476) aa.c(474) aa.c(463) aa.c(462) aa.c(459) aa.c(457) aa.c(451) aa.c(448) aa.c(426) aa.c(425) aa.c(420) aa.c(415) aa.c(397) aa.c(389) aa.c(389) aa.c(381) aa.c(373) aa.c(371) aa.c(365) aa.c(365) aa.c(363) aa.c(357) aa.c(355) aa.c(349) aa.c(349) aa.c(339) aa.c(339) aa.c(329) aa.c(329) aa.c(329) aa.c(319) aa.c(319) aa.c(297) aa.c(296) aa.c(291) aa.c(291) aa.c(282) aa.c(282) aa.c(280) aa.c(273) aa.c(273) aa.c(271) aa.c(259) aa.c(259) aa.c(250) aa.c(250) aa.c(248) aa.c(241) aa.c(241) aa.c(239) aa.c(227) aa.c(227) aa.c(202) aa.c(202) aa.c(202) aa.c(191) aa.c(188) aa.c(184) aa.c(174) aa.c(173) aa.c(152) aa.c(151) aa.c(141) aa.c(121) aa.c(113) aa.c(96) aa.c(93) aa.c(67) aa.c(64) aa.c(64) aa.c(57) aa.c(56) aa.c(50) aa.c(45) aa.c(36) aa.c(26) aa.c(26) aa.h(98) aa.h(98) aa.h(98) aa.h(98) aa.h(97) aa.h(97) aa.h(96) aa.h(96) aa.h(95) aa.h(95) aa.h(95) aa.h(93) aa.h(92) aa.h(91) aa.h(87) aa.h(86) aa.h(85) aa.h(85) aa.h(84) aa.h(83) aa.h(82) aa.h(82) aa.h(82) aa.h(81) aa.h(81) aa.h(80) aa.h(80) aa.h(80) aa.h(78) aa.h(78) aa.h(76) aa.h(76) aa.h(76) aa.h(74) aa.h(74) aa.h(73) aa.h(73) aa.h(72) aa.h(72) aa.h(72) aa.h(71) aa.h(71) aa.h(71) aa.h(70) aa.h(70) aa.h(69) aa.h(69) aa.h(69) aa.h(68) aa.h(68) aa.h(68) aa.h(67) aa.h(67) aa.h(64) aa.h(62) aa.h(61) aa.h(60) aa.h(58) aa.h(58) aa.h(57) aa.h(55) aa.h(54) aa.h(54) aa.h(53) aa.h(34) aa.h(27) aa.h(26) col.c(742) col.c(741) col.c(737) col.c(729) col.c(729) col.c(728) col.c(724) col.c(687) col.c(679) col.c(677) col.c(660) col.c(654) col.c(653) col.c(648) col.c(646) col.c(641) col.c(637) col.c(637) col.c(635) col.c(605) col.c(603) col.c(601) col.c(475) col.c(475) col.c(465) col.c(452) col.c(448) col.c(442) col.c(441) col.c(439) col.c(437) col.c(426) col.c(425) col.c(424) col.c(422) col.c(422) col.c(420) col.c(412) col.c(408) col.c(377) col.c(377) col.c(376) col.c(372) col.c(357) col.c(357) col.c(353) col.c(347) col.c(345) col.c(343) col.c(331) col.c(331) col.c(327) col.c(318) col.c(318) col.c(314) col.c(312) col.c(305) col.c(304) col.c(304) col.c(304) col.c(302) col.c(300) col.c(293) col.c(291) col.c(277) col.c(264) col.c(262) col.c(256) col.c(246) col.c(246) col.c(246) col.c(242) col.c(236) col.c(228) col.c(220) col.c(210) col.c(208) col.c(202) col.c(202) col.c(200) col.c(170) col.c(168) col.c(166) col.c(141) col.c(133) col.c(123) col.c(117) col.c(109) col.c(101) col.c(92) col.c(90) col.c(83) col.c(81) col.c(73) col.c(66) col.c(63) col.c(53) col.c(44) col.c(43) col.c(43) col.c(43) col.c(41) col.c(39) col.c(32) col.c(31) col.c(31) col.c(31) col.c(29) col.c(29) col.h(356) col.h(355) col.h(354) col.h(353) col.h(352) col.h(350) col.h(350) col.h(349) col.h(349) col.h(348) col.h(347) col.h(346) col.h(345) col.h(345) col.h(344) col.h(343) col.h(343) col.h(342) col.h(342) col.h(341) col.h(340) col.h(340) col.h(339) col.h(338) col.h(337) col.h(336) col.h(336) col.h(335) col.h(334) col.h(334) col.h(333) col.h(332) col.h(332) col.h(331) col.h(331) col.h(330) col.h(329) col.h(329) col.h(327) col.h(326) col.h(326) col.h(326) col.h(325) col.h(324) col.h(323) col.h(322) col.h(321) col.h(321) col.h(320) col.h(319) col.h(319) col.h(318) col.h(318) col.h(316) col.h(315) col.h(314) col.h(314) col.h(314) col.h(313) col.h(313) col.h(312) col.h(286) col.h(210) col.h(188) col.h(176) col.h(173) col.h(170) col.h(159) col.h(125) col.h(121) col.h(117) col.h(111) col.h(102) col.h(75) cpp2.c(4912) cpp2.c(4894) cpp2.c(4894) cpp2.c(4888) cpp2.c(4868) cpp2.c(4845) cpp2.c(4827) cpp2.c(4811) cpp2.c(4810) cpp2.c(4805) cpp2.c(4799) cpp2.c(4790) cpp2.c(4776) cpp2.c(4767) cpp2.c(4759) cpp2.c(4729) cpp2.c(4711) cpp2.c(4695) cpp2.c(4694) cpp2.c(4689) cpp2.c(4678) cpp2.c(4674) cpp2.c(4672) cpp2.c(4637) cpp2.c(4609) cpp2.c(4590) cpp2.c(4574) cpp2.c(4573) cpp2.c(4568) cpp2.c(4563) cpp2.c(4559) cpp2.c(4557) cpp2.c(4533) cpp2.c(4532) cpp2.c(4515) cpp2.c(4509) cpp2.c(4479) cpp2.c(4463) cpp2.c(4457) cpp2.c(4441) cpp2.c(4369) cpp2.c(4356) cpp2.c(4296) cpp2.c(4293) cpp2.c(4288) cpp2.c(4285) cpp2.c(4278) cpp2.c(4275) cpp2.c(4269) cpp2.c(4258) cpp2.c(4248) cpp2.c(4242) cpp2.c(4226) cpp2.c(4213) cpp2.c(4202) cpp2.c(4151) cpp2.c(4130) cpp2.c(4124) cpp2.c(4098) cpp2.c(4004) cpp2.c(3945) cpp2.c(3908) cpp2.c(3907) cpp2.c(3892) cpp2.c(3891) cpp2.c(3786) cpp2.c(3742) cpp2.c(3601) cpp2.c(3587) cpp2.c(3560) cpp2.c(3559) cpp2.c(3468) cpp2.c(3381) cpp2.c(3345) cpp2.c(3344) cpp2.c(3281) cpp2.c(3280) cpp2.c(3138) cpp2.c(3098) cpp2.c(3008) cpp2.c(2992) cpp2.c(2977) cpp2.c(2976) cpp2.c(2970) cpp2.c(2965) cpp2.c(2807) cpp2.c(2792) cpp2.c(2763) cpp2.c(2219) cpp2.c(2191) cpp2.c(2170) cpp2.c(2124) cpp2.c(2086) cpp2.c(2083) cpp2.c(2031) cpp2.c(2021) cpp2.c(1973) cpp2.c(1861) cpp2.c(1740) cpp2.c(1668) cpp2.c(1426) cpp2.c(1372) cpp2.c(1281) cpp2.c(1261) cpp2.c(1217) cpp2.c(1175) cpp2.c(1170) cpp2.c(965) cpp2.c(935) cpp2.c(934) cpp2.c(889) cpp2.c(840) cpp2.c(796) cpp2.c(746) cpp2.c(736) cpp2.c(715) cpp2.c(569) cpp2.c(564) cpp2.c(547) cpp2.c(544) cpp2.c(543) cpp2.c(525) cpp2.c(481) cpp2.c(480) cpp2.c(426) cpp2.c(425) cpp2.c(409) cpp2.c(408) cpp2.c(195) cpp2.c(178) cpp2.c(160) cpp2.c(158) cpp2.c(157) cpp2.c(148) cpp2.c(129) cpp2.c(114) cpp2.c(110) cpp2.c(107) cpp2.c(106) cpp2.c(90) cpp2.c(82) cpp2.c(82) cpp2.c(81) cpp2.c(67) cpp2.c(64) cpp2.c(55) cpp2.c(40) cpp2.c(37) cpp2.h(603) cpp2.h(601) cpp2.h(586) cpp2.h(581) cpp2.h(575) cpp2.h(567) cpp2.h(566) cpp2.h(566) cpp2.h(565) cpp2.h(564) cpp2.h(542) cpp2.h(540) cpp2.h(538) cpp2.h(537) cpp2.h(533) cpp2.h(532) cpp2.h(530) cpp2.h(529) cpp2.h(528) cpp2.h(527) cpp2.h(518) cpp2.h(508) cpp2.h(497) cpp2.h(494) cpp2.h(400) cpp2.h(340) cpp2.h(337) cpp2.h(329) cpp2.h(326) cpp2.h(323) cpp2.h(314) cpp2.h(311) cpp2.h(296) cpp2.h(293) cpp2.h(269) cpp2.h(266) cpp2.h(263) cpp2.h(260) cpp2.h(246) cpp2.h(211) cpp2.h(208) cpp2.h(205) cpp2.h(194) cpp2.h(191) cpp2.h(188) cpp2.h(166) cpp2.h(165) cpp2.h(165) cpp2.h(130) cpp2.h(129) cpp2.h(129) cpp2.h(120) cpp2.h(119) cpp2.h(117) cpp2.h(115) cpp2.h(115) cpp2.h(114) cpp2.h(79) cpp2.h(77) cpp2.h(66) cpp2.h(63) part.c(793) part.c(792) part.c(674) part.c(658) part.c(643) part.c(642) part.c(636) part.c(631) part.c(606) part.c(601) part.c(552) part.c(537) part.c(418) part.c(410) part.c(391) part.c(352) part.c(344) part.c(291) part.c(287) part.c(285) part.c(283) part.c(276) part.c(271) part.c(180) part.c(179) part.c(160) part.c(133) part.c(130) part.c(128) part.c(103) part.c(100) part.c(98) part.c(78) part.c(75) part.c(73) part.c(44) part.c(41) part.c(39) part.c(32) part.h(44) part.h(42) part.h(40) part.h(38) part.h(35) part.h(33) part.h(30) part.h(27) part.h(26) part.h(26) part.h(25) part.h(25) part.h(24) part.h(24) part.h(18) part.h(17) list.c(227) list.c(193) list.c(167) list.c(137) list.c(105) list.c(82) list.c(60) list.c(45) list.c(45) list.c(41) list.c(35) list.c(27) list.h(67) list.h(65) list.h(65) list.h(64) list.h(63) list.h(62) list.h(61) list.h(60) list.h(59) list.h(58) misc.c(1313) misc.c(1302) misc.c(1286) misc.c(1264) misc.c(1262) misc.c(1260) misc.c(1222) misc.c(1218) misc.c(1215) misc.c(1187) misc.c(1186) misc.c(987) misc.c(976) misc.c(976) misc.c(960) misc.c(959) misc.c(913) misc.c(909) misc.c(583) misc.c(564) misc.c(544) misc.c(539) misc.c(526) misc.c(523) misc.c(521) misc.c(503) misc.c(503) misc.c(501) misc.c(485) misc.c(459) misc.c(453) misc.c(415) misc.c(412) misc.c(412) misc.c(394) misc.c(393) misc.c(388) misc.c(385) misc.c(385) misc.c(264) misc.c(260) misc.c(237) misc.c(198) misc.c(197) misc.c(192) misc.c(184) misc.c(175) misc.c(145) misc.c(145) misc.h(169) misc.h(163) misc.h(160) misc.h(156) misc.h(156) misc.h(153) misc.h(150) misc.h(149) misc.h(148) misc.h(147) misc.h(121) misc.h(115) misc.h(115) misc.h(113) misc.h(113) misc.h(112) misc.h(112) misc.h(111) misc.h(111) stack.c(138) stack.c(131) stack.c(129) stack.c(126) stack.c(103) stack.c(72) stack.c(57) stack.c(47) stack.c(39) stack.c(33) stack.c(24) stack.h(49) stack.h(48) stack.h(47) stack.h(46) stack.h(44) stack.h(44) stack.h(43)
lisp_type_t
aa.c(459) aa.c(448) aa.c(422) aa.c(420) aa.h(93) aa.h(91) aa.h(89) aa.h(87) col.c(726) col.h(323) col.h(284) col.h(277) col.h(135) col.h(100) col.h(68) col.h(63) list.h(34) stack.h(23)
col_data_function_t
col.c(584) col.h(25) cpp2.c(696) misc.c(251)

Struct variables


col01_flex_call
col.h(222) misc.c(166) misc.c(162) misc.c(93)
col01_yylex
col.h(219) misc.c(161) misc.c(46)
col01_flex_getchar
col.h(216) misc.c(160) misc.h(73)
misc_parser_for_flex
col.h(213) misc.c(167) misc.c(165) misc.c(159)
false_token_list
col.h(210) misc.c(446) misc.c(158) misc.c(90) misc.h(156)
current_nonterminal
col.h(203) misc.c(695) misc.c(693) misc.c(690) misc.c(689) misc.c(688) misc.c(687) misc.c(686) misc.c(685) misc.c(684) misc.c(683) misc.c(682) misc.c(681) misc.c(680) misc.c(679) misc.c(678) misc.c(156)
current_terminal
col.h(200) cpp2.h(151) misc.c(667) misc.c(666) misc.c(656) misc.c(654) misc.c(652) misc.c(651) misc.c(650) misc.c(649) misc.c(648) misc.c(647) misc.c(646) misc.c(645) misc.c(644) misc.c(643) misc.c(642) misc.c(641) misc.c(640) misc.c(639) misc.c(155) misc.h(141) misc.h(140)
current_text_heap
col.h(197) cpp2.c(4521) cpp2.c(4519) cpp2.c(3300) cpp2.c(3159) cpp2.c(2036) cpp2.c(2035) cpp2.c(2023) cpp2.c(1944) cpp2.c(1912) cpp2.c(1898) cpp2.c(1895) cpp2.c(1889) cpp2.c(1883) cpp2.c(545) cpp2.c(505) cpp2.h(129) cpp2.h(120) cpp2.h(119) cpp2.h(117) cpp2.h(115) cpp2.h(102) cpp2.h(101) cpp2.h(101) cpp2.h(99) part.c(190) misc.c(1319) misc.c(1318) misc.c(1317) misc.c(1272) misc.c(1265) misc.c(1264) misc.c(1262) misc.c(1258) misc.c(1228) misc.c(1227) misc.c(1224) misc.c(1218) misc.c(1217) misc.c(1216) misc.c(1116) misc.c(1097) misc.c(1083) misc.c(1079) misc.c(689) misc.c(651) misc.c(627) misc.c(462) misc.c(284) misc.c(154) misc.h(170) misc.h(73) x_rm1.lex(47) x_rm1.lex(47)
full_name_of_last_open_file
col.h(194) misc.c(488) misc.c(423) misc.c(422) misc.c(404) misc.c(402) misc.h(133)
recorded_last_symbol_from_an_input_file
col.h(191) misc.c(348) misc.c(270) misc.c(268) misc.c(153) misc.h(129)
connecting_nonterminal
col.c(513) col.c(512) col.h(188) misc.c(770) misc.c(594) misc.c(580) misc.c(152) misc.h(163)
change_state
col.h(185) misc.c(1114) misc.c(1095) misc.c(1075) misc.c(1064) misc.c(151) misc.h(182) misc.h(47) misc.h(47) misc.h(47) x_rm1.lex(45) x_rm1.lex(45)
change_pos
col.h(182) misc.c(1117) misc.c(1115) misc.c(1099) misc.c(1098) misc.c(1096) misc.c(1083) misc.c(1079) misc.c(1078) misc.c(1065) misc.c(150) misc.h(181) misc.h(47) misc.h(47) x_rm1.lex(46) x_rm1.lex(46)
misc_flex_try_again
col.h(179) cpp2.h(154) misc.c(65) misc.c(62) misc.h(114)
misc_stack
col.h(176)
misc_parse_error_list
col.h(173) misc.c(692) misc.c(654) misc.c(272) misc.c(252) misc.c(250) misc.c(245) misc.c(232) misc.c(149) misc.h(121)

Enumeration variables


XSTRING_MEMCPY
col.c(610) col.h(270) cpp2.c(3159)
XSTRING_STRCPY
col.c(455) col.c(412) col.c(386) col.c(127) col.c(86) col.h(303) col.h(267)
XSTRING_UNBOUNDOLD
col.c(714) col.h(258)
XSTRING_BOUNDNEW
col.c(707) col.c(441) col.c(429) col.h(255) cpp2.h(130) part.c(311) misc.c(552)
XSTRING_REUSE
col.c(703) col.c(442) col.c(431) col.h(252) cpp2.c(4658) cpp2.c(4103) cpp2.c(2034) cpp2.h(131) part.c(92) part.c(86) misc.c(587)

Define definitions


COPY_STRUCT
col.h(310) cpp2.c(3315)
COL_NEW_XSTRING_CONST
col.c(629) col.c(624) col.c(620) col.c(614) col.h(302) misc.c(494) misc.c(488) misc.c(473)
NEW_XSTRING_CONST
col.c(194) col.c(189) col.c(185) col.c(179) col.h(297) cpp2.c(4805) cpp2.c(4790) cpp2.c(4776) cpp2.c(4767) cpp2.c(4689) cpp2.c(4663) cpp2.c(4633) cpp2.c(4568) cpp2.c(4473) cpp2.c(4361) cpp2.c(4265) cpp2.c(4248) cpp2.c(4230) cpp2.c(4217) cpp2.c(4206) cpp2.c(4130) cpp2.c(3742) cpp2.c(3602) cpp2.c(3565) cpp2.c(3422) cpp2.c(3420) cpp2.c(3147) cpp2.c(3116) cpp2.c(3074) cpp2.c(3065) cpp2.c(2970) cpp2.c(2925) cpp2.c(2099) cpp2.c(1941) cpp2.c(1940) cpp2.c(1386) cpp2.c(943) cpp2.c(942) cpp2.c(595) cpp2.c(591) cpp2.c(587) cpp2.c(576) cpp2.c(575) cpp2.c(573) cpp2.c(330) cpp2.c(321) cpp2.c(297) cpp2.c(249) cpp2.c(227) cpp2.c(163) cpp2.c(110) part.c(829) part.c(761) part.c(746) part.c(636) part.c(621) part.c(617) part.c(613) part.c(609) part.c(320) part.c(300) misc.c(1302) misc.c(1286) misc.c(1250) misc.c(1244) misc.c(583) misc.c(556) misc.c(526) misc.c(485) misc.c(467) misc.c(466) misc.c(418) misc.c(210)
CSTORAGE
col.h(239) mm2.c(275) mm2.c(225)
STORAGE
col.h(229) mm2.c(79)

Variable definitions


Function definitions


Rule result definitions Bison


Token definitions


Source


1 #/* cpp2html for viewing c preprocessing as hypertext*/ 2 #/**/ 3 #/* Copyright (C) 2003 K.Karamazen*/ 4 #/**/ 5 #/* This program is free software; you can redistribute it and/or modify*/ 6 #/* it under the terms of the GNU General Public License as published by*/ 7 #/* the Free Software Foundation; either version 2 of the License, or*/ 8 #/* (at your option) any later version.*/ 9 #/* */ 10 #/* This program is distributed in the hope that it will be useful,*/ 11 #/* but WITHOUT ANY WARRANTY; without even the implied warranty of*/ 12 #/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the*/ 13 #/* GNU General Public License for more details.*/ 14 #/* */ 15 #ifndef _COL_H__ 16 #define _COL_H__ 17 #ifndef _COL_H 18 #define _COL_H 19 #include "stdlib.h" 20 #include "stdio.h" 21 #include "rm1.h" 22 23 /*function type */ 24 //DOC_TYPEDEF(col_data_function_t DG_COL) 25 typedef void (*col_data_function_t) (void *); 26 27 typedef enum 28 { 29 /*lisp list */ 30 LISTP = 1, 31 /*cons cell */ 32 CONSP, 33 /*bison symbol */ 34 PLEAFP, 35 /*lisp integer */ 36 INTP, 37 /*lisp string */ 38 STRINGP, 39 /*associative array */ 40 AAP, 41 /*c stack */ 42 STACKP, 43 /*c list */ 44 CLISTP, 45 /*general storage */ 46 VOIDP, 47 /*xstring storage */ 48 XSTRINGP, 49 /*c string */ 50 SSTRINGP, 51 /*c integer */ 52 SINTP, 53 /*set from xstring */ 54 SETP, 55 /*file */ 56 FILEP, 57 /*parser */ 58 PARSERP, 59 /*next free type slot */ 60 COL_NEXT_FREE_TYPE_SLOT, 61 /*collection type */ 62 //DOC_TYPEDEF(lisp_type_t DG_COL) 63 } lisp_type_t; 64 65 typedef struct 66 { 67 /*type of variable */ 68 lisp_type_t type; 69 /*value of variable */ 70 void *val; 71 /*mm handle of variable */ 72 void *mm_handle; 73 /*collection of types */ 74 //DOC_TYPEDEF(col_t DG_COL) 75 } col_t; 76 77 typedef enum 78 { 79 /*begin of list */ 80 LIST = 1, 81 /*terminal */ 82 TERM = 2, 83 /*nonterminal */ 84 NONTERM = 4, 85 /*hide symbol */ 86 HIDE = 8, 87 /*begin of list without subtree */ 88 LIST_NEXT = 16, 89 /*show symbol */ 90 SHOW = 32, 91 /*text heap is bounded */ 92 COL_TEXT_HEAP_BOUNDED = 64, 93 /*some semantic attributes of a symbol */ 94 //DOC_TYPEDEF(tags_t DG_BISON_SYMBOL_ATTRIBUTES) 95 } tags_t; 96 97 typedef struct 98 { 99 /*type of variable */ 100 lisp_type_t type; 101 /*XSTRING to read from */ 102 col_t *xstring; 103 /*mm handle of variable */ 104 void *mm_handle; 105 106 /*heap id */ 107 int id; 108 /*last character read by flex */ 109 int flex_num_chars; 110 /*AAP array of new line characters */ 111 col_t *cnt_nl; 112 /*number of new line characters encountered */ 113 int cnt_nl_length; 114 /*last read character */ 115 int array_pos; 116 /*file name XSTRING */ 117 col_t *file_name; 118 /*file pointer */ 119 FILE *file_ptr; 120 /*pushed chars to input */ 121 col_t *misc_ahead_xstring; 122 /*number of read chars from misc_ahead_xstring */ 123 int misc_ahead_read; 124 /*additional information */ 125 col_t *add_info; 126 /*parser for this buffer */ 127 struct parser_master_tag *ps01_parser; 128 /*text heap to represent buffer or file */ 129 //DOC_TYPEDEF(text_heap_heap_t DG_FLEX_BUFFERS) 130 } text_heap_heap_t; 131 132 typedef struct leaf 133 { 134 /*type of variable */ 135 lisp_type_t type; 136 /* first element */ 137 void *val; 138 /* mm handle of cell */ 139 void *mm_handle; 140 /*symbol id */ 141 int id; 142 /*next symbol in tree:may be changed */ 143 struct leaf *next; 144 /*sub symbol in tree:may be changed */ 145 struct leaf *sub; 146 /*next symbol in tree:internal */ 147 struct leaf *next_all; 148 /*sub symbol in tree:internal */ 149 struct leaf *sub_all; 150 /*tag of symbol */ 151 tags_t tag; 152 /*begin and end position of the first symbol in list */ 153 int pos[2]; 154 /*begin and end position of the last symbol in list */ 155 int pos_end[2]; 156 /*file of symbol */ 157 text_heap_heap_t *text_heap_heap; 158 /*attributes */ 159 col_t *att; 160 /*bison symbol */ 161 //DOC_TYPEDEF(leaf_t DG_BISON_SYMBOL_ATTRIBUTES) 162 } leaf_t; 163 164 /*pointer to bison symbol*/ 165 //DOC_TYPEDEF(pleaf_t DG_BISON_SYMBOL_ATTRIBUTES) 166 typedef leaf_t *pleaf_t; 167 168 typedef struct parser_master_tag 169 { 170 col_t dummy; 171 /*array of issued (non)terminals which have not been connected in tree yet */ 172 //DOC_STRUCTVAR(misc_parse_error_list DG_BISON_COMMON) 173 col_t *misc_parse_error_list; 174 /*stack of parser_master_t (future extension) */ 175 //DOC_STRUCTVAR(misc_stack DG_BISON_COMMON) 176 col_t *misc_stack; 177 /*indicator can only be set during yylex function: next symbol required! */ 178 //DOC_STRUCTVAR(misc_flex_try_again DG_FLEX_READCHAR) 179 int misc_flex_try_again; 180 /*new required buffer position on rewind request */ 181 //DOC_STRUCTVAR(change_pos DG_FLEX_REWIND_OR_CHANGE_STATE) 182 int change_pos; 183 /*new required flex state on rewind request */ 184 //DOC_STRUCTVAR(change_state DG_FLEX_REWIND_OR_CHANGE_STATE) 185 int change_state; 186 /*array of connecting nonterminals in grammar */ 187 //DOC_STRUCTVAR(connecting_nonterminal DG_BISON_LIST_FROM_BRANCH) 188 col_t *connecting_nonterminal; 189 /*last symbol from an input file, not a buffer */ 190 //DOC_STRUCTVAR(recorded_last_symbol_from_an_input_file DG_BISON_COMMON) 191 pleaf_t recorded_last_symbol_from_an_input_file; 192 /*full file name when found, short name when not found */ 193 //DOC_STRUCTVAR(full_name_of_last_open_file DG_FLEX_BUFFERS) 194 char full_name_of_last_open_file[512]; 195 /*current buffer */ 196 //DOC_STRUCTVAR(current_text_heap DG_FLEX_BUFFERS) 197 text_heap_heap_t *current_text_heap; 198 /*last assigned terminal */ 199 //DOC_STRUCTVAR(current_terminal DG_BISON_COMMON) 200 pleaf_t current_terminal; 201 /*last assigned nonterminal */ 202 //DOC_STRUCTVAR(current_nonterminal DG_BISON_COMMON) 203 pleaf_t current_nonterminal; 204 /*top of parse tree */ 205 pleaf_t top; 206 /*symbol worked on */ 207 pleaf_t yylval; 208 /*list of terminals to be pushed to parser input */ 209 //DOC_STRUCTVAR(false_token_list DG_BISON_PUSHSYMBOL) 210 col_t *false_token_list; 211 /*ponter to parser_master_t pointer in scanner */ 212 //DOC_STRUCTVAR(misc_parser_for_flex DG_BISON_COMMON) 213 struct parser_master_tag **misc_parser_for_flex; 214 /*function for flex to get char */ 215 //DOC_STRUCTVAR(col01_flex_getchar DG_BISON_COMMON) 216 int (*col01_flex_getchar) (struct parser_master_tag * p); 217 /*function for bison to get symbol */ 218 //DOC_STRUCTVAR(col01_yylex DG_BISON_COMMON) 219 int (*col01_yylex) (YYSTYPE * t, void *current_misc_master_record); 220 /*flex function pointer */ 221 //DOC_STRUCTVAR(col01_flex_call DG_BISON_COMMON) 222 int (*col01_flex_call) (void); 223 /*the parser type */ 224 //DOC_TYPEDEF(parser_master_t DG_BISON_COMMON) 225 } parser_master_t; 226 227 /*allocate storage*/ 228 //DOC_DEFINE(STORAGE DG_MM) 229 #define STORAGE(x,t,s)\ 230 do\ 231 {\ 232 if ((x = t malloc (s)) == 0) {\ 233 fprintf (stderr,"internal error: malloc failed: %s %s\n",#t,#x);\ 234 exit(1);\ 235 }\ 236 } while (0) 237 /*allocate storage*/ 238 //DOC_DEFINE(CSTORAGE DG_MM) 239 #define CSTORAGE(x,t,nelements,sizeofeach)\ 240 do\ 241 {\ 242 if ((x = t calloc (nelements,sizeofeach)) == 0) {\ 243 fprintf (stderr,"internal error: calloc failed: %s %s\n",#t,#x);\ 244 exit(1);\ 245 }\ 246 } while (0) 247 248 typedef enum 249 { 250 /*reuse argument storage for result */ 251 //DOC_ENUMCONST(XSTRING_REUSE DG_XSTRING) 252 XSTRING_REUSE = 1, 253 /*allocate new storage for result */ 254 //DOC_ENUMCONST(XSTRING_BOUNDNEW DG_XSTRING) 255 XSTRING_BOUNDNEW = 1 << 1, 256 /*unbound argument storage */ 257 //DOC_ENUMCONST(XSTRING_UNBOUNDOLD DG_XSTRING) 258 XSTRING_UNBOUNDOLD = 1 << 2, 259 /*storage indicators for substring */ 260 //DOC_TYPEDEF(xstring_substring_flags_t DG_XSTRING) 261 } xstring_substring_flags_t; 262 263 typedef enum 264 { 265 /*duplicate xstring by strcpy */ 266 //DOC_ENUMCONST(XSTRING_STRCPY DG_XSTRING) 267 XSTRING_STRCPY = 1, 268 /*duplicate xstring by memcpy */ 269 //DOC_ENUMCONST(XSTRING_MEMCPY DG_XSTRING) 270 XSTRING_MEMCPY = 1 << 1, 271 /*duplication indicators */ 272 //DOC_TYPEDEF(col_duplicate_flags_t DG_COL) 273 } col_duplicate_flags_t; 274 275 /*rename*/ 276 //DOC_TYPEDEF(col_type_t DG_COL) 277 typedef lisp_type_t col_type_t; 278 #define COL_STRUCT_SIZEOF(s)\ 279 ((((sizeof(s)-1)/sizeof(int))+1)*sizeof(int)) 280 281 typedef struct cons 282 { 283 /*type of variable */ 284 lisp_type_t type; 285 /* first element */ 286 col_t *car; 287 /* mm handle of cell */ 288 void *mm_handle; 289 /*rest list */ 290 struct cons *cdr; 291 /*lisp cons cell */ 292 //DOC_TYPEDEF(lisp_cons_cell_t DG_COL) 293 } lisp_cons_cell_t; 294 295 /*allocating function */ 296 //DOC_DEFINE(NEW_XSTRING_CONST DG_XSTRING) 297 #define NEW_XSTRING_CONST(text)\ 298 new_xstring(strlen(text),text) 299 300 /*allocating function */ 301 //DOC_DEFINE(COL_NEW_XSTRING_CONST DG_XSTRING) 302 #define COL_NEW_XSTRING_CONST(text)\ 303 col_new_xstring(strlen(text),text,XSTRING_STRCPY) 304 305 /*dereferencing function*/ 306 #define DER(x)\ 307 (*(x)) 308 /*copy function*/ 309 //DOC_DEFINE(COPY_STRUCT DG_COL) 310 #define COPY_STRUCT(a,b,type)\ 311 if(a&&b){memcpy(a,b,sizeof(type));} 312 313 col_t *col_cut_xstring (col_t * x, int pos1, int pos2); 314 col_t *col_insert (col_t * x, col_t * to_insert, int pos); 315 col_t *col_space (int length); 316 col_t *col_new_xstring2 (int length, char *init, int copy_length); 317 col_t *col_bound_new_extended (int size, int type, void *init); 318 int col_extended_type_unbound (col_t * s); 319 col_t *col_new_cons (col_t * car, void *cdr); 320 col_t *col_new_pleaf (void); 321 col_t *col_bound_col (col_t * c); 322 col_t *col_new_file (void); 323 col_t *col_new_col (lisp_type_t t, void *init); 324 col_t *col_xstring_substring (col_t * str, int p1, int p2_used, int p2, 325 xstring_substring_flags_t flag); 326 col_t *col_concat_xstring (col_t * str1, col_t * str2); 327 col_t *col_print_col_to_xstring (col_t * c); 328 int col_unbound_col (void *s); 329 int col_unbound_xstring (col_t * str); 330 col_t *col_new_xstring (int length, char *init, col_duplicate_flags_t flag); 331 col_t *col_duplicate_xstring (col_t * xs, col_duplicate_flags_t flag); 332 col_t *col_new_col_symbol (col_type_t col_type); 333 col_t *col_nth2 (lisp_cons_cell_t * c, int n); 334 col_t *col_nth (col_t * l, int n); 335 col_t *new_col_symbol (col_type_t col_type); 336 void bound_new_col_symbol (col_t ** var, col_type_t col_type, void *val); 337 void unbound_col (col_t * s); 338 void del_elm_xstring (col_t * s, int elm); 339 void add_elm_xstring (col_t * s, int elm); 340 int is_elm_xstring (col_t * s, int elm); 341 col_t *set0_xstring (col_t * s); 342 int *val_int (col_t * s); 343 col_t *print_col_to_xstring (col_t * c); 344 col_t *duplicate_xstring (col_t * xs); 345 char *val_xstring_or_string (col_t * s); 346 col_t *new_int (int init); 347 col_t *xstring_substring (col_t * str, int p1, int p2, 348 xstring_substring_flags_t flag); 349 col_t *concat_xstring (col_t * str1, col_t * str2); 350 void unbound_xstring (col_t * str); 351 col_t *new_xstring (int length, char *init); 352 int length_xstring (col_t * s); 353 char *val_xstring (col_t * s); 354 char *val_lisp_string (col_t * lisp_symbol); 355 pleaf_t *val_lisp_pleaf (col_t * lisp_symbol); 356 int *val_lisp_int (col_t * lisp_symbol); 357 #endif 358 #endif 359

cpp2.c

Main goal definitions


Refined goal definitions


Design goal definitions


Known risks definitions


Type definitions


Struct variables


Enumeration variables


Define definitions


Variable definitions


misc_parser
cpp2.c(4896) cpp2.c(4523) cpp2.c(3303) cpp2.c(3302) cpp2.c(3300) cpp2.c(3271) cpp2.c(3270) cpp2.c(3268) cpp2.c(3264) cpp2.c(3252) cpp2.c(3238) cpp2.c(3180) cpp2.c(3101) cpp2.c(2893) cpp2.c(2885) cpp2.c(2682) cpp2.c(2668) cpp2.c(2374) cpp2.c(2367) cpp2.c(2321) cpp2.c(2303) cpp2.c(2290) cpp2.c(2272) cpp2.c(2252) cpp2.c(2234) cpp2.c(2231) cpp2.c(2196) cpp2.c(2175) cpp2.c(2154) cpp2.c(2140) cpp2.c(2137) cpp2.c(2110) cpp2.c(2051) cpp2.c(2044) cpp2.c(2025) cpp2.c(1960) cpp2.c(1953) cpp2.c(1919) cpp2.c(1827) cpp2.c(1811) cpp2.c(1794) cpp2.c(1752) cpp2.c(1710) cpp2.c(1658) cpp2.c(1360) cpp2.c(1346) cpp2.c(1300) cpp2.c(1287) cpp2.c(720) cpp2.c(719) cpp2.c(602) cpp2.c(601) cpp2.c(600) cpp2.c(585) cpp2.c(583) cpp2.c(574) cpp2.c(545) cpp2.c(505) cpp2.c(485) cpp2.c(434) cpp2.c(78) cpp2.h(506) part.c(865) part.c(853) part.c(840) part.c(625) part.c(190) misc.h(95)
unknown_identifier_flag
cpp2.c(2781) cpp2.c(2769) cpp2.c(2431) cpp2.c(2425) cpp2.c(2209) cpp2.c(2185) cpp2.c(2164) cpp2.c(1723) cpp2.c(74) cpp2.h(590) part.c(748) part.c(739) part.c(499) part.c(453)
include_text_to_eol_sym
cpp2.c(2959) cpp2.c(2951) cpp2.c(2941) cpp2.c(2914) cpp2.c(2408) cpp2.c(2066) cpp2.c(2018) cpp2.c(1988) cpp2.c(71) part.c(869) part.c(860) part.c(848) part.c(818)
included_from_stack
cpp2.c(3348) cpp2.c(3154) cpp2.c(3136) cpp2.c(2401) cpp2.c(2392) cpp2.c(2384) cpp2.c(2354) cpp2.c(2345) cpp2.c(2211) cpp2.c(2189) cpp2.c(2168) cpp2.c(2120) cpp2.c(2084) cpp2.c(1971) cpp2.c(1918) cpp2.c(1773) cpp2.c(1772) cpp2.c(1768) cpp2.c(1738) cpp2.c(1727) cpp2.c(1685) cpp2.c(1631) cpp2.c(68) cpp2.h(601)
state_stack
cpp2.c(3347) cpp2.c(3251) cpp2.c(3235) cpp2.c(3210) cpp2.c(3198) cpp2.c(3170) cpp2.c(3100) cpp2.c(2317) cpp2.c(2268) cpp2.c(2248) cpp2.c(2136) cpp2.c(2109) cpp2.c(2065) cpp2.c(2017) cpp2.c(1987) cpp2.c(1823) cpp2.c(1806) cpp2.c(1788) cpp2.c(1770) cpp2.c(1751) cpp2.c(1706) cpp2.c(65)
parsing_state_data
cpp2.c(3365) cpp2.c(3364) cpp2.c(3363) cpp2.c(3362) cpp2.c(3361) cpp2.c(3360) cpp2.c(3359) cpp2.c(3358) cpp2.c(3356) cpp2.c(3355) cpp2.c(3353) cpp2.c(3351) cpp2.c(3350) cpp2.c(3349) cpp2.c(3252) cpp2.c(3251) cpp2.c(3250) cpp2.c(3239) cpp2.c(3237) cpp2.c(3236) cpp2.c(3236) cpp2.c(3235) cpp2.c(3220) cpp2.c(3215) cpp2.c(3213) cpp2.c(3212) cpp2.c(3211) cpp2.c(3211) cpp2.c(3210) cpp2.c(3199) cpp2.c(3198) cpp2.c(3197) cpp2.c(3192) cpp2.c(3179) cpp2.c(3174) cpp2.c(3172) cpp2.c(3171) cpp2.c(3171) cpp2.c(3170) cpp2.c(3151) cpp2.c(3132) cpp2.c(3129) cpp2.c(3123) cpp2.c(3120) cpp2.c(3109) cpp2.c(3108) cpp2.c(3104) cpp2.c(3101) cpp2.c(3100) cpp2.c(3099) cpp2.c(3071) cpp2.c(3043) cpp2.c(3033) cpp2.c(3018) cpp2.c(2952) cpp2.c(2950) cpp2.c(2948) cpp2.c(2942) cpp2.c(2939) cpp2.c(2937) cpp2.c(2933) cpp2.c(2922) cpp2.c(2921) cpp2.c(2917) cpp2.c(2916) cpp2.c(2912) cpp2.c(2910) cpp2.c(2433) cpp2.c(2432) cpp2.c(2426) cpp2.c(2411) cpp2.c(2409) cpp2.c(2407) cpp2.c(2389) cpp2.c(2388) cpp2.c(2383) cpp2.c(2380) cpp2.c(2378) cpp2.c(2371) cpp2.c(2364) cpp2.c(2361) cpp2.c(2360) cpp2.c(2342) cpp2.c(2339) cpp2.c(2328) cpp2.c(2326) cpp2.c(2324) cpp2.c(2322) cpp2.c(2319) cpp2.c(2318) cpp2.c(2318) cpp2.c(2317) cpp2.c(2306) cpp2.c(2304) cpp2.c(2301) cpp2.c(2289) cpp2.c(2288) cpp2.c(2275) cpp2.c(2273) cpp2.c(2271) cpp2.c(2270) cpp2.c(2269) cpp2.c(2269) cpp2.c(2268) cpp2.c(2255) cpp2.c(2253) cpp2.c(2251) cpp2.c(2250) cpp2.c(2249) cpp2.c(2249) cpp2.c(2248) cpp2.c(2231) cpp2.c(2230) cpp2.c(2216) cpp2.c(2214) cpp2.c(2208) cpp2.c(2207) cpp2.c(2196) cpp2.c(2195) cpp2.c(2186) cpp2.c(2175) cpp2.c(2174) cpp2.c(2165) cpp2.c(2137) cpp2.c(2136) cpp2.c(2135) cpp2.c(2122) cpp2.c(2110) cpp2.c(2109) cpp2.c(2108) cpp2.c(2105) cpp2.c(2100) cpp2.c(2067) cpp2.c(2064) cpp2.c(2063) cpp2.c(2061) cpp2.c(2060) cpp2.c(2057) cpp2.c(2055) cpp2.c(2048) cpp2.c(2041) cpp2.c(2019) cpp2.c(2017) cpp2.c(2016) cpp2.c(2014) cpp2.c(2009) cpp2.c(1989) cpp2.c(1986) cpp2.c(1985) cpp2.c(1983) cpp2.c(1969) cpp2.c(1966) cpp2.c(1964) cpp2.c(1957) cpp2.c(1950) cpp2.c(1942) cpp2.c(1934) cpp2.c(1933) cpp2.c(1931) cpp2.c(1930) cpp2.c(1928) cpp2.c(1926) cpp2.c(1924) cpp2.c(1922) cpp2.c(1919) cpp2.c(1917) cpp2.c(1915) cpp2.c(1863) cpp2.c(1848) cpp2.c(1837) cpp2.c(1827) cpp2.c(1826) cpp2.c(1825) cpp2.c(1824) cpp2.c(1824) cpp2.c(1823) cpp2.c(1811) cpp2.c(1810) cpp2.c(1809) cpp2.c(1808) cpp2.c(1807) cpp2.c(1807) cpp2.c(1806) cpp2.c(1794) cpp2.c(1793) cpp2.c(1792) cpp2.c(1790) cpp2.c(1789) cpp2.c(1789) cpp2.c(1788) cpp2.c(1770) cpp2.c(1769) cpp2.c(1767) cpp2.c(1763) cpp2.c(1752) cpp2.c(1751) cpp2.c(1750) cpp2.c(1709) cpp2.c(1708) cpp2.c(1707) cpp2.c(1707) cpp2.c(1706) cpp2.c(1694) cpp2.c(1670) cpp2.c(1669) cpp2.c(1591) cpp2.c(1587) cpp2.c(1585) cpp2.c(1565) cpp2.c(1563) cpp2.c(1561) cpp2.c(1556) cpp2.c(1554) cpp2.c(1551) cpp2.c(1538) cpp2.c(1536) cpp2.c(1531) cpp2.c(1529) cpp2.c(1525) cpp2.c(1523) cpp2.c(1506) cpp2.c(1293) cpp2.c(1292) cpp2.c(460) cpp2.c(327) cpp2.c(62) cpp2.h(643) part.c(861) part.c(859) part.c(856) part.c(849) part.c(846) part.c(843) part.c(839) part.c(826) part.c(825) part.c(821) part.c(820) part.c(816) part.c(814) part.c(709) part.c(699) part.c(684) part.c(525) part.c(523) part.c(521) part.c(517) part.c(515) part.c(513) part.c(511) part.c(509) part.c(505) part.c(503) part.c(501) part.c(494) part.c(492) part.c(489) part.c(477) part.c(475) part.c(473) part.c(471) part.c(467) part.c(465) part.c(463) part.c(461) part.c(459) part.c(457) part.c(455) part.c(449) part.c(447) part.c(446) part.c(445) part.c(444) part.c(443) part.c(442) part.c(416) part.c(413) part.c(389) part.c(386) part.c(356) part.c(354) part.c(350) part.c(347)
cmd_ln
cpp2.c(4492) cpp2.c(4297) cpp2.c(3699) cpp2.c(3692) cpp2.c(3683) cpp2.c(3682) cpp2.c(3676) cpp2.c(3675) cpp2.c(3666) cpp2.c(3659) cpp2.c(3652) cpp2.c(3645) cpp2.c(3619) cpp2.c(3617) cpp2.c(3612) cpp2.c(3602) cpp2.c(3596) cpp2.c(3573) cpp2.c(3450) cpp2.c(3449) cpp2.c(3449) cpp2.c(3447) cpp2.c(3445) cpp2.c(3439) cpp2.c(3438) cpp2.c(3438) cpp2.c(3437) cpp2.c(3436) cpp2.c(3434) cpp2.c(3432) cpp2.c(3431) cpp2.c(3431) cpp2.c(3431) cpp2.c(3425) cpp2.c(3424) cpp2.c(3424) cpp2.c(3424) cpp2.c(3422) cpp2.c(3420) cpp2.c(3418) cpp2.c(3417) cpp2.c(3415) cpp2.c(3413) cpp2.c(3411) cpp2.c(3409) cpp2.c(3407) cpp2.c(3405) cpp2.c(3403) cpp2.c(3401) cpp2.c(3399) cpp2.c(3397) cpp2.c(3394) cpp2.c(3295) cpp2.c(3293) cpp2.c(3292) cpp2.c(1910) cpp2.c(1894) cpp2.c(1891) cpp2.c(1882) cpp2.c(1877) cpp2.c(1872) cpp2.c(1871) cpp2.c(1672) cpp2.c(1672) cpp2.c(1099) cpp2.c(1016) cpp2.c(1001) cpp2.c(1001) cpp2.c(998) cpp2.c(998) cpp2.c(646) cpp2.c(646) cpp2.c(428) cpp2.c(135) cpp2.c(135) cpp2.c(59) cpp2.h(639) cpp2.h(97) cpp2.h(97) part.c(590) part.c(589) part.c(587) part.c(538) part.c(277) part.c(221) part.c(214)
expanded_macros_register
cpp2.c(4359) cpp2.c(3346) cpp2.c(1302) cpp2.c(526) cpp2.c(454) cpp2.c(56)
macro_name_recognition_on
cpp2.c(3249) cpp2.c(3232) cpp2.c(1656) cpp2.c(1361) cpp2.c(1283) cpp2.c(477) cpp2.c(53) cpp2.h(564) part.c(794)
symbol_table_prop
cpp2.c(4450) cpp2.c(4343) cpp2.c(4334) cpp2.c(4331) cpp2.c(4317) cpp2.c(3738) cpp2.c(3729) cpp2.c(3726) cpp2.c(3267) cpp2.c(3267) cpp2.c(2766) cpp2.c(1729) cpp2.c(1288) cpp2.c(695) cpp2.c(50) cpp2.h(549)
top_symbol_stack_1
cpp2.c(4469) cpp2.c(4465) cpp2.c(1657) cpp2.c(1389) cpp2.c(1388) cpp2.c(1380) cpp2.c(1376) cpp2.c(1374) cpp2.c(1359) cpp2.c(1358) cpp2.c(1231) cpp2.c(481) cpp2.c(478) cpp2.c(426) cpp2.c(423) cpp2.c(422) cpp2.c(47) cpp2.h(548) x_rm1.y(1688)
cpp_html_result_is_initialized
cpp2.c(140) cpp2.c(137) cpp2.c(44)
cpp_html_result_list
cpp2.c(1675) cpp2.c(1135) cpp2.c(1102) cpp2.c(1067) cpp2.c(1019) cpp2.c(650) cpp2.c(143) cpp2.c(142) cpp2.c(41)
cpp_html_js_name
cpp2.c(1083) cpp2.c(1051) cpp2.c(1023) cpp2.c(958) cpp2.c(649) cpp2.c(38)
cpp_html_js_file
cpp2.c(1134) cpp2.c(1103) cpp2.c(1068) cpp2.c(1059) cpp2.c(1039) cpp2.c(1020) cpp2.c(880) cpp2.c(872) cpp2.c(868) cpp2.c(864) cpp2.c(860) cpp2.c(856) cpp2.c(852) cpp2.c(848) cpp2.c(785) cpp2.c(777) cpp2.c(775) cpp2.c(768) cpp2.c(763) cpp2.c(761) cpp2.c(648) cpp2.c(35)
cpp2fncs
cpp2.c(4487) cpp2.c(3265) cpp2.c(3135) cpp2.c(3126) cpp2.c(3112) cpp2.c(2400) cpp2.c(2391) cpp2.c(2353) cpp2.c(2344) cpp2.c(2210) cpp2.c(2188) cpp2.c(2167) cpp2.c(1680) cpp2.c(1162) cpp2.c(624) cpp2.c(623) cpp2.c(621) cpp2.c(619) cpp2.c(617) cpp2.c(616) cpp2.c(615) cpp2.c(614) cpp2.c(613) cpp2.c(32) cpp2.h(521) part.c(577) part.c(576) part.c(574) part.c(572) part.c(570) part.c(569) part.c(568) part.c(567) x_rm1.y(1965) x_rm1.y(1224) x_rm1.y(803)
cpp_branch_sort
cpp2.c(3233) cpp2.c(3209) cpp2.c(2316) cpp2.c(2300) cpp2.c(2286) cpp2.c(2266) cpp2.c(2246) cpp2.c(2152) cpp2.c(1821) cpp2.c(1804) cpp2.c(1787) cpp2.c(1704) cpp2.c(452) cpp2.c(29)

Function definitions


col_extended_type_unbound
col.c(592) col.h(318) cpp2.c(4911)
cpp_open_text_file_for_read
cpp2.c(4887) cpp2.c(4510) cpp2.c(4448) cpp2.c(3299) cpp2.c(3295) cpp2.c(1910) cpp2.c(1893) cpp2.c(1881) cpp2.c(718) cpp2.c(482) cpp2.c(427) cpp2.h(528)
collect_expanded_arg
cpp2.c(4800) cpp2.c(4468) cpp2.h(565)
create_string_from_par3
cpp2.c(4673) cpp2.c(4457) cpp2.h(566)
create_text_from_par3
cpp2.c(4558) cpp2.c(4479) cpp2.h(567)
string_copy_two_escapes
cpp2.c(4763) cpp2.c(4547) cpp2.h(594)
expand_macro2
cpp2.c(4349) cpp2.c(1597) cpp2.c(1591) cpp2.h(568)
pp_push_symbol_table
cpp2.c(4323) cpp2.c(3758) cpp2.h(569)
pp_find_symbol_table
cpp2.c(4310) cpp2.c(1263) cpp2.h(561)
expand_macro_given_expanded_arguments
cpp2.c(4490) cpp2.c(4243) cpp2.h(576)
pp_save_substitution_list
cpp2.c(3928) cpp2.c(3766) cpp2.h(571)
pp_process_macro_definition_list2
cpp2.c(3776) cpp2.c(3765) cpp2.h(570)
pp_save_macro_def2
cpp2.c(3752) cpp2.c(615) cpp2.c(615) cpp2.h(573) cpp2.h(65) part.c(568) x_rm1.y(1224)
pp_save_macro_def2_for_predefined_macros
cpp2.c(3715) cpp2.c(3371) cpp2.c(3370) cpp2.c(3369) cpp2.c(3368) cpp2.c(3367) cpp2.c(3366) cpp2.c(3282) cpp2.h(560)
process_cmd_ln_args_further
cpp2.c(3459) cpp2.c(3423) cpp2.h(637)
process_cmd_ln_args
cpp2.c(3390) cpp2.h(638) x_rm1.y(2905) x_rm1.y(2897)
cmd_ln_args_error
cpp2.c(3377) cpp2.h(554) x_rm1.y(2912)
pp_init
cpp2.c(3340) cpp2.c(3269) cpp2.h(642)
unbound_parsing_state_data
cpp2.c(3329) cpp2.c(3250) cpp2.c(3197) cpp2.c(3099) cpp2.c(2135) cpp2.c(2108) cpp2.c(2063) cpp2.c(2016) cpp2.c(1985) cpp2.c(1769) cpp2.c(1750) cpp2.h(636)
new_parsing_state_data
cpp2.c(3349) cpp2.c(3309) cpp2.c(3236) cpp2.c(3211) cpp2.c(3171) cpp2.c(2318) cpp2.c(2269) cpp2.c(2249) cpp2.c(1824) cpp2.c(1807) cpp2.c(1789) cpp2.c(1707) cpp2.h(635)
pp_main_file_begin
cpp2.c(3288) cpp2.h(641) x_rm1.y(2906) x_rm1.y(2898)
pp_save_macro_def2_for_predefined_macros_from_array
cpp2.c(3292) cpp2.c(3277) cpp2.h(553)
pp_main_init
cpp2.c(3258) cpp2.h(648) cpp2.h(645)
finalize_define
cpp2.c(3245) cpp2.c(616) cpp2.c(616) cpp2.h(634) cpp2.h(64) part.c(803) part.c(569) x_rm1.y(803)
prepare_define
cpp2.c(3228) cpp2.h(633) x_rm1.y(2177)
prepare_no_directive
cpp2.c(3205) cpp2.h(632) x_rm1.y(1978)
finalize_no_directive
cpp2.c(3187) cpp2.h(631) x_rm1.y(1972)
prepare_pp_text_expansion_result
cpp2.c(3166) cpp2.h(630) x_rm1.y(1437) x_rm1.y(1432)
finalize_pp_text_expansion_result
cpp2.c(3093) cpp2.h(629) part.c(31) x_rm1.y(1450)
collect_expanded_text_result
cpp2.c(3135) cpp2.c(3126) cpp2.c(3112) cpp2.c(2966) cpp2.c(1680) cpp2.c(614) cpp2.c(614) cpp2.h(604) cpp2.h(63) part.c(567)
finalize_text_to_end_of_line
cpp2.c(2904) cpp2.c(623) cpp2.c(623) cpp2.h(628) cpp2.h(69) part.c(576) x_rm1.y(1965)
decrypt_character
cpp2.c(2819) cpp2.c(2812) cpp2.h(627)
parse_character
cpp2.c(2802) cpp2.c(2736) cpp2.h(626)
parse_number
cpp2.c(2787) cpp2.c(2732) cpp2.h(625)
parse_name
cpp2.c(2776) cpp2.c(2740) cpp2.h(624)
defined_name
cpp2.c(2758) cpp2.c(2750) cpp2.c(2746) cpp2.c(2187) cpp2.c(2166) cpp2.c(1724) cpp2.h(623) part.c(740)
evaluate_expression
cpp2.c(2727) cpp2.c(2723) cpp2.c(2718) cpp2.c(2714) cpp2.c(2710) cpp2.c(2706) cpp2.c(2700) cpp2.c(2696) cpp2.c(2692) cpp2.c(2677) cpp2.c(2674) cpp2.c(2663) cpp2.c(2660) cpp2.c(2656) cpp2.c(2655) cpp2.c(2648) cpp2.c(2639) cpp2.c(2638) cpp2.c(2633) cpp2.c(2632) cpp2.c(2625) cpp2.c(2614) cpp2.c(2614) cpp2.c(2606) cpp2.c(2606) cpp2.c(2599) cpp2.c(2591) cpp2.c(2590) cpp2.c(2585) cpp2.c(2584) cpp2.c(2579) cpp2.c(2578) cpp2.c(2573) cpp2.c(2572) cpp2.c(2565) cpp2.c(2557) cpp2.c(2556) cpp2.c(2551) cpp2.c(2550) cpp2.c(2543) cpp2.c(2535) cpp2.c(2535) cpp2.c(2530) cpp2.c(2522) cpp2.c(2522) cpp2.c(2517) cpp2.c(2509) cpp2.c(2509) cpp2.c(2504) cpp2.c(2497) cpp2.c(2496) cpp2.c(2492) cpp2.c(2485) cpp2.c(2484) cpp2.c(2480) cpp2.c(2473) cpp2.c(2470) cpp2.c(2470) cpp2.c(2465) cpp2.c(2458) cpp2.c(2454) cpp2.c(2448) cpp2.c(2441) cpp2.c(2427) cpp2.h(622)
finalize_constant_expression
cpp2.c(2418) cpp2.h(621) x_rm1.y(2645) x_rm1.y(2639)
finalize_if_directive
cpp2.c(2334) cpp2.h(620) x_rm1.y(567) x_rm1.y(561)
prepare_if_directive
cpp2.c(2312) cpp2.h(619) x_rm1.y(2011)
prepare_elif_directive
cpp2.c(2296) cpp2.h(610) x_rm1.y(2022)
prepare_else_directive
cpp2.c(2282) cpp2.h(612) x_rm1.y(2087)
prepare_if_def_directive
cpp2.c(2262) cpp2.h(618) x_rm1.y(2093)
prepare_if_ndef_directive
cpp2.c(2242) cpp2.h(613) x_rm1.y(2104)
finalize_else_directive
cpp2.c(2202) cpp2.h(611) x_rm1.y(2049) x_rm1.y(2043) x_rm1.y(2038)
finalize_if_def_directive
cpp2.c(2181) cpp2.h(614) x_rm1.y(605) x_rm1.y(599) x_rm1.y(593) x_rm1.y(587)
finalize_if_ndef_directive
cpp2.c(2160) cpp2.h(615) x_rm1.y(688) x_rm1.y(682) x_rm1.y(676) x_rm1.y(670)
prepare_endif
cpp2.c(2148) cpp2.h(616) x_rm1.y(2171)
finalize_endif
cpp2.c(2116) cpp2.h(617) x_rm1.y(2133) x_rm1.y(2126) x_rm1.y(2120)
finalize_error_directive
cpp2.c(2079) cpp2.h(559) x_rm1.y(832) x_rm1.y(826)
finalize_line_directive
cpp2.c(2002) cpp2.h(555) x_rm1.y(858) x_rm1.y(852)
finalize_include_directive
cpp2.c(1855) cpp2.h(607) x_rm1.y(1012) x_rm1.y(1006)
include_file_error
cpp2.c(1970) cpp2.c(1945) cpp2.c(1904) cpp2.c(1844) cpp2.h(595) x_rm1.y(1048)
line_form_error
cpp2.c(1833) cpp2.h(556) x_rm1.y(911)
prepare_error_directive
cpp2.c(1817) cpp2.h(558) x_rm1.y(2221)
prepare_line_directive
cpp2.c(1800) cpp2.h(557) x_rm1.y(2210)
prepare_include_directive
cpp2.c(1783) cpp2.h(608) x_rm1.y(2199)
finalize_file
cpp2.c(1758) cpp2.h(609) x_rm1.y(432)
finalize_undef_directive
cpp2.c(1716) cpp2.h(606) x_rm1.y(1163) x_rm1.y(1157) x_rm1.y(1151) x_rm1.y(1145) x_rm1.y(1139)
prepare_undef_directive
cpp2.c(1700) cpp2.h(605) x_rm1.y(2188)
process_result
cpp2.c(3194) cpp2.c(1664) cpp2.h(588)
finalize_macro_expansion
cpp2.c(1650) cpp2.h(603) x_rm1.y(1676)
finalize_text_expansion_after_macro_expansion
cpp2.c(1641) cpp2.h(602) x_rm1.y(1954) x_rm1.y(1850) x_rm1.y(1512)
included_from_text
cpp2.c(1627) cpp2.c(1619) cpp2.h(600)
cpp_error_text
cpp2.c(2893) cpp2.c(2885) cpp2.c(2681) cpp2.c(2667) cpp2.c(2388) cpp2.c(2374) cpp2.c(2367) cpp2.c(2234) cpp2.c(2140) cpp2.c(2105) cpp2.c(2100) cpp2.c(2060) cpp2.c(2051) cpp2.c(2044) cpp2.c(1969) cpp2.c(1960) cpp2.c(1953) cpp2.c(1942) cpp2.c(1736) cpp2.c(1615) cpp2.c(1609) cpp2.c(1346) cpp2.h(599)
define_error_process
cpp2.c(1605) cpp2.h(598) x_rm1.y(1230)
finalize_macro_invokation
cpp2.c(1578) cpp2.h(597) x_rm1.y(1682)
calculate_conditional_state_after_elif
cpp2.c(2400) cpp2.c(2353) cpp2.c(2210) cpp2.c(1547) cpp2.c(622) cpp2.c(621) cpp2.h(592) cpp2.h(67) part.c(572)
calculate_conditional_state_after_if
cpp2.c(2391) cpp2.c(2344) cpp2.c(2188) cpp2.c(2167) cpp2.c(1519) cpp2.c(620) cpp2.c(619) cpp2.h(593) cpp2.h(68) part.c(574)
calculate_preprocessor_state
cpp2.c(3350) cpp2.c(3302) cpp2.c(2407) cpp2.c(2360) cpp2.c(2230) cpp2.c(2195) cpp2.c(2174) cpp2.c(1501) cpp2.h(591)
unbound_rec
cpp2.c(1493) cpp2.c(1492) cpp2.c(1486) cpp2.h(589) x_rm1.y(472) x_rm1.y(466) x_rm1.y(445) x_rm1.y(439) x_rm1.y(433) x_rm1.y(408)
unbound_macro_definition
cpp2.c(1472) cpp2.c(707) cpp2.h(578)
new_macro_definition
cpp2.c(3932) cpp2.c(3740) cpp2.c(1454) cpp2.h(579)
unbound_macro_substitution_list_elmnt
cpp2.c(4190) cpp2.c(1462) cpp2.c(1441) cpp2.h(585)
new_macro_substitution_list_elmnt
cpp2.c(4155) cpp2.c(4139) cpp2.c(4116) cpp2.c(4106) cpp2.c(4084) cpp2.c(4009) cpp2.c(3745) cpp2.c(1425) cpp2.c(1423) cpp2.h(580)
unbound_macro_expansion_struct
cpp2.c(4504) cpp2.c(1412) cpp2.h(574)
new_macro_expansion_struct
cpp2.c(4444) cpp2.c(1396) cpp2.h(575)
finalize_macro_argument
cpp2.c(1368) cpp2.h(562) x_rm1.y(1798) x_rm1.y(1791)
finalize_name_of_macro_with_params_invokation
cpp2.c(1354) cpp2.h(563) x_rm1.y(1725)
if_group_error
cpp2.c(1342) cpp2.h(552) x_rm1.y(500)
symbol_table_prop_cmpEQ
cpp2.c(1333) cpp2.h(550)
symbol_table_prop_cmpLT
cpp2.c(1324) cpp2.h(551)
pp_check_if_macro_name
cpp2.c(1275) cpp2.h(644) cpp2.h(161)
push_symbol_stack
cpp2.c(1358) cpp2.c(1252) cpp2.h(545) x_rm1.y(1688)
pop_symbol_stack
cpp2.c(1657) cpp2.c(1237) cpp2.h(547)
is_macro_expansion
cpp2.c(1226) cpp2.c(462) cpp2.c(454) cpp2.h(544)
cpp_unbound_html_result_list
cpp2.c(1216) cpp2.c(1209) cpp2.c(1207) cpp2.c(650) cpp2.h(540)
cpp_unbound_html_result_elmnt
cpp2.c(1220) cpp2.c(1199) cpp2.h(541)
cpp_bound_html_result_element
cpp2.c(1182) cpp2.c(379) cpp2.c(293) cpp2.c(241) cpp2.c(220) cpp2.h(542)
cpp_create_html_result_list
cpp2.c(1171) cpp2.c(239) cpp2.c(237) cpp2.c(142) cpp2.h(543)
cpp_close
cpp2.c(1155) cpp2.h(539) x_rm1.y(409)
cpp_handle_top
cpp2.c(1143) cpp2.h(507) x_rm1.y(405)
cpp02_finish_html_result2
cpp2.c(1161) cpp2.c(1095) cpp2.h(536)
cpp_finish_html_result
cpp2.c(1160) cpp2.c(1012) cpp2.h(535)
cpp_prepare_html_result
cpp2.c(994) cpp2.c(141) cpp2.h(534)
cpp_nr_macros_in_html_result_list
cpp2.c(1102) cpp2.c(1019) cpp2.c(983) cpp2.c(980) cpp2.c(964) cpp2.h(533) cpp2.h(532)
cpp_html_open_js
cpp2.c(1103) cpp2.c(1020) cpp2.c(929) cpp2.h(531)
cpp02_write_html2_string
cpp2.c(888) cpp2.c(820) cpp2.c(811) cpp2.h(537)
cpp_write_html_string
cpp2.c(839) cpp2.c(774) cpp2.c(762) cpp2.h(530)
cpp02_write_html2_result_cases
cpp2.c(1135) cpp2.c(828) cpp2.c(822) cpp2.c(795) cpp2.h(538)
cpp_write_html_result_cases
cpp2.c(1067) cpp2.c(784) cpp2.c(776) cpp2.c(745) cpp2.h(529)
symbol_text4
cpp2.c(4449) cpp2.c(4330) cpp2.c(1287) cpp2.c(726) cpp2.h(522)
cpp_flex_create_new_read_xstring
cpp2.c(3149) cpp2.c(3127) cpp2.c(3118) cpp2.c(2953) cpp2.c(2943) cpp2.c(2930) cpp2.c(2925) cpp2.c(714) cpp2.h(527) part.c(862) part.c(850) part.c(835) part.c(829)
cpp_unbound_symbol_table_prop
cpp2.c(4335) cpp2.c(3730) cpp2.c(1730) cpp2.c(702) cpp2.c(696) cpp2.h(526)
cpp_unbound_symbol_table
cpp2.c(691) cpp2.h(525)
cpp_command_line_arguments_unbound
cpp2.c(657) cpp2.h(524)
cpp_html_result_close
cpp2.c(1162) cpp2.c(642) cpp2.c(613) cpp2.c(613) cpp2.h(523) cpp2.h(62)
cpp_new
cpp2.c(3265) cpp2.c(630) cpp2.h(520)
cpp_default
cpp2.c(3266) cpp2.c(1921) cpp2.c(609) cpp2.h(518)
cpp_handle_expansion_of_built_in_macros
cpp2.c(4487) cpp2.c(618) cpp2.c(617) cpp2.c(565) cpp2.h(519) cpp2.h(66) part.c(570)
cpp_save_line_continuation_position
cpp2.c(537) cpp2.h(517) cpp2.h(133)
cpp_finalize_macro_after_rescan
cpp2.c(498) cpp2.h(512) cpp2.h(153)
finalize_unexpanded_arguments
cpp2.c(472) cpp2.h(513) x_rm1.y(1740) x_rm1.y(1733)
cpp_what_is_expansion_state
cpp2.c(1658) cpp2.c(1360) cpp2.c(528) cpp2.c(485) cpp2.c(447) cpp2.c(434) cpp2.h(514)
finalize_arg_text_expansion
cpp2.c(417) cpp2.h(515) x_rm1.y(1746)
cpp_last_line
cpp2.c(404) cpp2.h(516)
cpp_collect_html_result2
cpp2.c(1675) cpp2.c(265) cpp2.c(253) cpp2.c(143) cpp2.c(128) cpp2.h(508)
symbol_text6_html
cpp2.c(302) cpp2.c(106)
symbol_text_rechtml
cpp2.c(121) cpp2.c(99) cpp2.c(97) cpp2.c(81)

Rule result definitions Bison


Token definitions


Source


1 #/* cpp2html for viewing c preprocessing as hypertext*/ 2 #/**/ 3 #/* Copyright (C) 2003 K.Karamazen*/ 4 #/**/ 5 #/* This program is free software; you can redistribute it and/or modify*/ 6 #/* it under the terms of the GNU General Public License as published by*/ 7 #/* the Free Software Foundation; either version 2 of the License, or*/ 8 #/* (at your option) any later version.*/ 9 #/* */ 10 #/* This program is distributed in the hope that it will be useful,*/ 11 #/* but WITHOUT ANY WARRANTY; without even the implied warranty of*/ 12 #/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the*/ 13 #/* GNU General Public License for more details.*/ 14 #/* */ 15 #include "col.h" 16 #include "stdio.h" 17 #include "rm1.h" 18 #include "x_io1.h" 19 #include "rbt.h" 20 #include "rbt_shortcuts.h" 21 #include "x_rm1.tab.h" 22 #include "aa.h" 23 #include "stack.h" 24 #include "misc.h" 25 #include "cpp2.h" 26 #include "limits.h" 27 /* symbol id of the first symbol in the chunk: a directive or PP_ANY_CHAR_NO_DIRECTIVE*/ 28 //DOC_VARIABLE(cpp_branch_sort DG_PARSE_COMMON) 29 int cpp_branch_sort = PP_ANY_CHAR_NO_DIRECTIVE; 30 /* cpp2 functions that can be redefined in other modes*/ 31 //DOC_VARIABLE(cpp2fncs DG_PARSE_COMMON) 32 cpp_class_t *cpp2fncs; 33 /* *.js file pointer*/ 34 //DOC_VARIABLE(cpp_html_js_file DG_GENERATE_HTML_RESULT) 35 FILE *cpp_html_js_file; 36 /*XSTRINGP the name of hypxxx.js file*/ 37 //DOC_VARIABLE(cpp_html_js_name DG_GENERATE_HTML_RESULT) 38 col_t *cpp_html_js_name; 39 /*CLISTP of cpp_html_result_elmnt_t of html result*/ 40 //DOC_VARIABLE(cpp_html_result_list DG_GENERATE_HTML_RESULT) 41 col_t *cpp_html_result_list; 42 /*indicates html result is initialized*/ 43 //DOC_VARIABLE(cpp_html_result_is_initialized DG_GENERATE_HTML_RESULT) 44 int cpp_html_result_is_initialized = 0; 45 /*stack of used macros during macro expansion*/ 46 //DOC_VARIABLE(top_symbol_stack_1 DG_EXPAND_TEXT) 47 symbol_stack_t *top_symbol_stack_1 = NULL; 48 /*macros storage of symbol_table_prop_t*/ 49 //DOC_VARIABLE(symbol_table_prop DG_PARSE_COMMON) 50 void *symbol_table_prop; 51 /*regulates if identifiers should be recognized as macro names*/ 52 //DOC_VARIABLE(macro_name_recognition_on DG_PARSE_COMMON) 53 int macro_name_recognition_on = 1; 54 /*storage of used macros during macro expansion*/ 55 //DOC_VARIABLE(expanded_macros_register DG_EXPAND_TEXT) 56 col_t *expanded_macros_register; 57 /*command line arguments storage*/ 58 //DOC_VARIABLE(cmd_ln DG_COMMAND_LINE_COMMON) 59 command_line_arguments_t *cmd_ln = NULL; 60 /*current parsing state*/ 61 //DOC_VARIABLE(parsing_state_data DG_PARSE_COMMON) 62 parsing_state_data_t *parsing_state_data; 63 /*stack of parsing_state_data_t*/ 64 //DOC_VARIABLE(state_stack DG_PARSE_COMMON) 65 col_t *state_stack; 66 /*cascade of included files*/ 67 //DOC_VARIABLE(included_from_stack DG_PARSE_COMMON) 68 col_t *included_from_stack; 69 /*last line read by text_to_end_of_line rule*/ 70 //DOC_VARIABLE(include_text_to_eol_sym DG_PARSE_COMMON) 71 pleaf_t include_text_to_eol_sym; 72 /*last evaluated expression contained unknown identifier*/ 73 //DOC_VARIABLE(unknown_identifier_flag DG_PARSE_CONDITIONALS) 74 int unknown_identifier_flag; 75 76 /*parser data parser_master_t*/ 77 //DOC_VARIABLE(misc_parser DG_BISON_COMMON) 78 parser_master_t *misc_parser = NULL; 79 /*fetch text value of symbol recursively */ 80 /* DOC_FUNC_DEF(symbol_text_rechtml DG_BISON_SYMBOL_ATTRIBUTES) */ 81 static col_t * 82 symbol_text_rechtml (pleaf_t b, col_t * r, col_t * (*st) (pleaf_t), 83 void *data) 84 { 85 if (b) 86 { 87 if (TERMINAL_MAX_MIN_NONTERMINAL > b->id) 88 { 89 if (!xstring_aa_value_sint 90 ((col_t *) data, 91 (int) (((cpp_file_att_t *) (b->text_heap_heap->add_info))-> 92 cpp_macro_inv_sym))) 93 r = col_concat_xstring (r, DER (st) (b)); 94 } 95 else 96 { 97 r = symbol_text_rechtml (b->sub, r, st, data); 98 } 99 r = symbol_text_rechtml (b->next, r, st, data); 100 } 101 return r; 102 } 103 104 /*fetch text value of symbol */ 105 /* DOC_FUNC_DEF(symbol_text6_html DG_BISON_SYMBOL_ATTRIBUTES) */ 106 static col_t * 107 symbol_text6_html (pleaf_t b, col_t * (*st) (pleaf_t), void *data) 108 { 109 int dummy_for_begin_function = (dummy_for_begin_function = 0); 110 col_t *result = NEW_XSTRING_CONST (""); 111 if (TERMINAL_MAX_MIN_NONTERMINAL > b->id) 112 { 113 if (!xstring_aa_value_sint 114 ((col_t *) data, 115 (int) (((cpp_file_att_t *) (b->text_heap_heap->add_info))-> 116 cpp_macro_inv_sym))) 117 result = col_concat_xstring (result, DER (st) (b)); 118 } 119 else 120 { 121 result = symbol_text_rechtml (b->sub, result, st, data); 122 } 123 return result;; 124 } 125 126 /*collect expanded result for html format*/ 127 //DOC_FUNC_DEF(cpp_collect_html_result2 DG_GENERATE_HTML_RESULT) 128 void 129 cpp_collect_html_result2 (pleaf_t bsym, col_t * result_list, 130 lisp_cons_cell_t * default_input, 131 cpp_html_result_sort_t r, pleaf_t begin_sym, 132 pleaf_t * new_begin_sym, pleaf_t mac_exp_sym) 133 { 134 int dummy_for_begin_function = (dummy_for_begin_function = 0); 135 if (cmd_ln->html_result || cmd_ln->html_result2) 136 { 137 if (!cpp_html_result_is_initialized) 138 { 139 pleaf_t nbs; 140 cpp_html_result_is_initialized = 1; 141 cpp_prepare_html_result (); 142 cpp_html_result_list = cpp_create_html_result_list (); 143 cpp_collect_html_result2 (bsym, cpp_html_result_list, NULL, 144 CPP_HTML_RESULT, NULL, &nbs, NULL); 145 } 146 else 147 { 148 col_t *t = NULL; 149 lisp_cons_cell_t *input = 150 (default_input ? default_input 151 : (show_rec (bsym), dt_mem2 (bsym))); 152 /*until the end of the list */ 153 int first_is_the_list = input && input->car 154 && input->car->type == LISTP; 155 int list_sort; 156 lisp_cons_cell_t *current = input; 157 col_t *stack = stack_create (); 158 col_t *list_sort_stack = stack_create (); 159 int list_sort_old; 160 col_t *mac_exp_arr = aa_array (); 161 if (mac_exp_sym) 162 aa_assign_sint_xstring (mac_exp_arr, (int) (mac_exp_sym->sub), 163 NEW_XSTRING_CONST (""), 164 RETURN_NULL_IF_EXISTS); 165 list_sort = 0; 166 list_sort_old = 0; 167 while (1) 168 { 169 if (!current) 170 { 171 int s_n = 0; 172 if (!(s_n = stack_size (stack))) 173 { 174 break; 175 } 176 list_sort_old = list_sort; 177 { 178 col_t *i = stack_pop (list_sort_stack); 179 list_sort = DER (val_int (i)); 180 col_unbound_col (i); 181 } 182 183 current = (lisp_cons_cell_t *) stack_pop (stack); 184 if (s_n == 1 && first_is_the_list) 185 { 186 break; 187 } 188 continue; 189 } 190 if (current->car && current->car->type == LISTP) 191 { 192 stack_push (stack, current->cdr); 193 current = current->car->val; 194 { 195 col_t *i = new_int (list_sort); 196 stack_push (list_sort_stack, i); 197 } 198 continue; 199 } 200 if (current->car && current->car->type == PLEAFP) 201 { 202 pleaf_t sym = (pleaf_t) (current->car->val); 203 if (begin_sym == NULL || begin_sym == sym) 204 { 205 begin_sym = 0; 206 if (sym->id == PP_MACRO_EXPANSION) 207 { 208 if (CPP_HTML_RESULT == r || 209 CPP_HTML_RESULT_EXPANDED == r) 210 { 211 if (CPP_HTML_RESULT == r 212 || xstring_aa_value_sint (mac_exp_arr, 213 (int) (((cpp_file_att_t *) (sym->text_heap_heap->add_info))->cpp_macro_inv_sym))) 214 { 215 lisp_cons_cell_t *c; 216 pleaf_t begin_sym_local2; 217 pleaf_t begin_sym_local; 218 cpp_html_result_elmnt_t *e0; 219 cpp_html_result_elmnt_t *e1 = 220 cpp_bound_html_result_element (); 221 if (CPP_HTML_RESULT_EXPANDED == r) 222 { 223 int res = 224 aa_assign_sint_xstring (mac_exp_arr, 225 (int) (sym-> 226 sub), 227 NEW_XSTRING_CONST 228 (""), 229 RETURN_NULL_IF_EXISTS); 230 res = res; 231 } 232 e1->cpp_html_result_kind = 233 CPP_HTML_RESULT_MACRO; 234 e1->cpp_html_result_xstr = 235 symbol_text3 (sym->sub->sub->sub); 236 e1->cpp_html_result_unexpanded = 237 cpp_create_html_result_list (); 238 e1->cpp_html_result_expanded = 239 cpp_create_html_result_list (); 240 list_push_last (result_list, e1); 241 e0 = cpp_bound_html_result_element (); 242 e0->cpp_html_result_kind = 243 CPP_HTML_RESULT_PLAIN_TEXT; 244 e0->cpp_html_result_xstr = 245 (sym->sub->sub->sub-> 246 next ? symbol_text6 (sym->sub->sub->sub-> 247 next, 248 symbol_text3) : 249 NEW_XSTRING_CONST ("")); 250 list_push_last (e1-> 251 cpp_html_result_unexpanded, 252 e0); 253 cpp_collect_html_result2 (NULL, 254 e1-> 255 cpp_html_result_unexpanded, 256 c = 257 (lisp_cons_cell_t 258 *) 259 stack_top_val 260 (stack), 261 CPP_HTML_RESULT_UNEXPANDED, 262 NULL, 263 &begin_sym_local, 264 sym); 265 cpp_collect_html_result2 (NULL, 266 e1-> 267 cpp_html_result_expanded, 268 c, 269 CPP_HTML_RESULT_EXPANDED, 270 NULL, 271 &begin_sym_local2, 272 sym); 273 begin_sym = begin_sym_local; 274 current = NULL; 275 continue; 276 } 277 else 278 { 279 *new_begin_sym = sym; 280 break; 281 } 282 } 283 else if (CPP_HTML_RESULT_UNEXPANDED == r) 284 { 285 if (xstring_aa_value_sint 286 (mac_exp_arr, 287 (int) (((cpp_file_att_t *) (sym-> 288 text_heap_heap-> 289 add_info))-> 290 cpp_macro_inv_sym))) 291 { 292 cpp_html_result_elmnt_t *e0 = 293 cpp_bound_html_result_element (); 294 int res = 295 aa_assign_sint_xstring (mac_exp_arr, 296 (int) (sym->sub), 297 NEW_XSTRING_CONST 298 (""), 299 RETURN_NULL_IF_EXISTS); 300 res = res; 301 t = 302 symbol_text6_html (sym->sub, symbol_text3, 303 mac_exp_arr); 304 e0->cpp_html_result_kind = 305 CPP_HTML_RESULT_PLAIN_TEXT; 306 e0->cpp_html_result_xstr = t; 307 list_push_last (result_list, e0); 308 t = NULL; 309 current = NULL; 310 continue; 311 } 312 else 313 { 314 *new_begin_sym = sym; 315 break; 316 } 317 } 318 } 319 if (PP_TOK_HORIZONTAL_WHITESPACE == sym->id) 320 { 321 t = NEW_XSTRING_CONST (" "); 322 // current = current->cdr; 323 //continue; 324 } 325 if (PP_TOK_ENDOFLINE == sym->id) 326 { 327 if (parsing_state_data->directive_collect_stage == 328 DIRECTIVE_COLLECT_STAGE_RESULT) 329 { 330 t = NEW_XSTRING_CONST ("\n"); 331 // current = current->cdr; 332 //continue; 333 } 334 } 335 336 if (PP_NAME == sym->id || PP_NON_ACTIVE == sym->id || 337 PP_DEFINE_DIRECTIVE_OPERATOR == sym->id || 338 PP_MACRO_EXPANSION_OPERATOR == sym->id || 339 PP_END_OF_LINE_VERSION == sym->id) 340 { 341 t = symbol_text3 (sym); 342 //current = current->cdr; 343 //continue; 344 } 345 if (t && CPP_HTML_RESULT == r) 346 { 347 } 348 else if (t) 349 { 350 if (xstring_aa_value_sint 351 (mac_exp_arr, 352 (int) (((cpp_file_att_t *) (sym-> 353 text_heap_heap-> 354 add_info))-> 355 cpp_macro_inv_sym))) 356 { 357 if (CPP_HTML_RESULT_UNEXPANDED == r) 358 { 359 col_unbound_col (t); 360 t = NULL; 361 } 362 else 363 { 364 //add to result 365 } 366 } 367 else 368 { 369 col_unbound_col (t); 370 t = NULL; 371 *new_begin_sym = sym; 372 break; 373 } 374 } 375 } 376 if (t) 377 { 378 cpp_html_result_elmnt_t *e0 = 379 cpp_bound_html_result_element (); 380 e0->cpp_html_result_kind = CPP_HTML_RESULT_PLAIN_TEXT; 381 e0->cpp_html_result_xstr = t; 382 list_push_last (result_list, e0); 383 t = NULL; 384 } 385 current = current->cdr; 386 continue; 387 } 388 } 389 if (!default_input) 390 dt_mem_unbound (input); 391 // ASSERT(stack_size(list_sort_stack)==0); 392 while (stack_size (stack)) 393 stack_pop (stack); 394 stack_unbound (list_sort_stack); 395 stack_unbound (stack); 396 col_unbound_col (mac_exp_arr); 397 } 398 } 399 return;; 400 } 401 402 /*give last line number*/ 403 //DOC_FUNC_DEF(cpp_last_line DG_FLEX_BUFFERS) 404 int 405 cpp_last_line (text_heap_heap_t * txt_heap) 406 { 407 int dummy_for_begin_function = (dummy_for_begin_function = 0); 408 col_t *pos = new_int (INT_MAX); 409 col_t *line = aa_greatest_not_gt_data (txt_heap->cnt_nl, pos); 410 int l = (int) (line ? line->val : (void *) 0); 411 unbound_col (pos); 412 return l + 1;; 413 } 414 415 /*prepare expansion of next macro argument, record the previous*/ 416 //DOC_FUNC_DEF(finalize_arg_text_expansion DG_EXPAND_TEXT) 417 void 418 finalize_arg_text_expansion (pleaf_t sym) 419 { 420 int dummy_for_begin_function = (dummy_for_begin_function = 0); 421 parser_master_t *p = sym->text_heap_heap->ps01_parser; 422 list_push_last (top_symbol_stack_1->cpp_expanded_arg_branch_list, sym->sub); 423 if (list_size (top_symbol_stack_1->cpp_unexpanded_arg_txt_list)) 424 { 425 col_t *t = 426 (col_t *) list_pop (top_symbol_stack_1->cpp_unexpanded_arg_txt_list); 427 cpp_open_text_file_for_read ("--", NULL); 428 if (cmd_ln->do_not_remove_slashes) 429 { 430 t = part_remove_first_nl (part_trim_left_all_lines (t)); 431 } 432 flex_pushstring2 (p, t); 433 flex_pushstring (p, ""); 434 rewind_scanner (misc_parser, cpp_what_is_expansion_state (), 0); 435 } 436 else 437 { 438 int pos = pleaf_pos_end (sym); 439 push_false_token_list (p, PP_TOK_END_OF_INV_MACRO_WITH_PARAMS, pos, 440 pos); 441 } 442 return;; 443 } 444 445 /*decide on text expansion state between the three*/ 446 //DOC_FUNC_DEF(cpp_what_is_expansion_state DG_EXPAND_TEXT) 447 int 448 cpp_what_is_expansion_state (void) 449 { 450 int dummy_for_begin_function = (dummy_for_begin_function = 0); 451 int result = defdirectivescanstate; 452 if (cpp_branch_sort == PP_ANY_CHAR_NO_DIRECTIVE) 453 { 454 if (is_macro_expansion () || aa_length (expanded_macros_register)) 455 { 456 result = macroexpansionstate; 457 } 458 } 459 else if (DIRECTIVE_EXPRESSION_STAGE_EXPAND == 460 parsing_state_data->directive_expression_stage) 461 { 462 if (!is_macro_expansion ()) 463 { 464 result = ifelifexpansionstate; 465 } 466 } 467 return result;; 468 } 469 470 /*after all macro arguments parsing, prepare expansion of args*/ 471 //DOC_FUNC_DEF(finalize_unexpanded_arguments DG_EXPAND_TEXT) 472 void 473 finalize_unexpanded_arguments (pleaf_t sym) 474 { 475 int dummy_for_begin_function = (dummy_for_begin_function = 0); 476 parser_master_t *p = sym->text_heap_heap->ps01_parser; 477 macro_name_recognition_on = 1; 478 if (list_size (top_symbol_stack_1->cpp_unexpanded_arg_txt_list)) 479 { 480 col_t *t = 481 (col_t *) list_pop (top_symbol_stack_1->cpp_unexpanded_arg_txt_list); 482 cpp_open_text_file_for_read ("--", NULL); 483 flex_pushstring2 (p, t); 484 flex_pushstring (p, ""); 485 rewind_scanner (misc_parser, cpp_what_is_expansion_state (), 0); 486 } 487 else 488 { 489 int pos = pleaf_pos_end (sym); 490 push_false_token_list (p, PP_TOK_END_OF_INV_MACRO_WITH_PARAMS, pos, 491 pos); 492 } 493 return;; 494 } 495 496 /*finalize reading from a buffer created by macro expansion*/ 497 //DOC_FUNC_DEF(cpp_finalize_macro_after_rescan DG_EXPAND_TEXT) 498 void 499 cpp_finalize_macro_after_rescan (void) 500 { 501 int dummy_for_begin_function = (dummy_for_begin_function = 0); 502 pleaf_t symsub; 503 pleaf_t last_sym; 504 symsub = 505 ((cpp_file_att_t *) (misc_parser->current_text_heap->add_info))-> 506 cpp_end_macro_invocation; 507 last_sym = 508 (symsub->sub->sub->id == 509 PP_NAME_OF_MACRO_WITHOUT_PARAMS ? symsub->sub->sub : (symsub->sub->sub-> 510 next->sub->id == 511 NT_ERROR ? symsub-> 512 sub->sub-> 513 sub : symsub->sub-> 514 sub->next->sub-> 515 next->next)); 516 last_sym = 517 (last_sym->id != 518 PP_MACRO_EXPANSION_BALANCED_PARENTHESIS ? last_sym : (last_sym->sub-> 519 next ? last_sym-> 520 sub-> 521 next : last_sym-> 522 sub)); 523 { 524 int new_state; 525 col_t *c; 526 aa_unset_xstring_xstring (expanded_macros_register, c = 527 symbol_text3 (symsub->sub->sub)); 528 new_state = cpp_what_is_expansion_state (); 529 rewind_after_symbol (last_sym, new_state); 530 unbound_xstring (c); 531 } 532 return;; 533 } 534 535 /*add the current position to array of all backslash line continuations*/ 536 //DOC_FUNC_DEF(cpp_save_line_continuation_position DG_PARSE_COMMON) 537 void 538 cpp_save_line_continuation_position (int pos) 539 { 540 int dummy_for_begin_function = (dummy_for_begin_function = 0); 541 if (part_text_partial_flag) 542 { 543 col_t *slash_index = new_int (pos); 544 col_t *a = 545 ((cpp_file_att_t *) (misc_parser->current_text_heap->add_info))-> 546 cnt_slash_nl; 547 col_t *result = aa_value (a, slash_index); 548 if (!result) 549 { 550 int res = 551 aa_assign (a, slash_index, new_int (1), RETURN_NULL_IF_EXISTS); 552 res = res; 553 } 554 else 555 { 556 DER (val_int (result))++; 557 col_unbound_col (slash_index); 558 } 559 } 560 return;; 561 } 562 563 /*expand predefined macros*/ 564 //DOC_FUNC_DEF(cpp_handle_expansion_of_built_in_macros DG_EXPAND_TEXT) 565 col_t * 566 cpp_handle_expansion_of_built_in_macros (char *c) 567 { 568 int dummy_for_begin_function = (dummy_for_begin_function = 0); 569 col_t *x = NULL; 570 if (!strcmp (c, "__FILE__")) 571 { 572 x = 573 NEW_XSTRING_CONST (symbol_file 574 (last_symbol_from_an_input_file (misc_parser))); 575 x = concat_xstring (NEW_XSTRING_CONST ("\""), x); 576 x = concat_xstring (x, NEW_XSTRING_CONST ("\"")); 577 } 578 else if (!strcmp (c, "__LINE__")) 579 { 580 char l[20]; 581 sprintf (l, "%d", 582 (int) (line_number_end 583 (last_symbol_from_an_input_file (misc_parser)) + 584 ((cpp_file_att_t 585 *) (last_symbol_from_an_input_file (misc_parser)-> 586 text_heap_heap->add_info))->line_offset)); 587 x = NEW_XSTRING_CONST (l); 588 } 589 else if (!strcmp (c, "__DATE__")) 590 { 591 x = NEW_XSTRING_CONST ("Mmm dd yyyy"); //KR_DATE_AND_TIME; 592 } 593 else if (!strcmp (c, "__TIME__")) 594 { 595 x = NEW_XSTRING_CONST ("hh:mm:ss"); 596 //KR_DATE_AND_TIME; 597 } 598 if (x) 599 { 600 flex_pushstring (misc_parser, " "); 601 flex_pushstring (misc_parser, val_xstring (x)); 602 flex_pushstring (misc_parser, " "); 603 } 604 return x;; 605 } 606 607 /*fill cpp instance with default modes functions*/ 608 //DOC_FUNC_DEF(cpp_default DG_PARSE_COMMON) 609 void 610 cpp_default (void) 611 { 612 int dummy_for_begin_function = (dummy_for_begin_function = 0); 613 cpp2fncs->cpp_html_result_close = cpp_html_result_close; 614 cpp2fncs->collect_expanded_text_result = collect_expanded_text_result; 615 cpp2fncs->pp_save_macro_def2 = pp_save_macro_def2; 616 cpp2fncs->finalize_define = finalize_define; 617 cpp2fncs->cpp_handle_expansion_of_built_in_macros = 618 cpp_handle_expansion_of_built_in_macros; 619 cpp2fncs->calculate_conditional_state_after_if = 620 calculate_conditional_state_after_if; 621 cpp2fncs->calculate_conditional_state_after_elif = 622 calculate_conditional_state_after_elif; 623 cpp2fncs->finalize_text_to_end_of_line = finalize_text_to_end_of_line; 624 //cpp2fncs->=; 625 return;; 626 } 627 628 /*new cpp instance*/ 629 //DOC_FUNC_DEF(cpp_new DG_PARSE_COMMON) 630 cpp_class_t * 631 cpp_new (void) 632 { 633 int dummy_for_begin_function = (dummy_for_begin_function = 0); 634 cpp_class_t *result; 635 result = (cpp_class_t *) mm2_bound_new_mem (sizeof (cpp_class_t)); 636 result->mm_handle = mm_handle; 637 return result;; 638 } 639 640 /*close parsing of html result*/ 641 //DOC_FUNC_DEF(cpp_html_result_close DG_GENERATE_HTML_RESULT) 642 void 643 cpp_html_result_close (void) 644 { 645 int dummy_for_begin_function = (dummy_for_begin_function = 0); 646 if (cmd_ln->html_result || cmd_ln->html_result2) 647 { 648 fclose (cpp_html_js_file); 649 col_unbound_col (cpp_html_js_name); 650 cpp_unbound_html_result_list (cpp_html_result_list); 651 } 652 return;; 653 } 654 655 /*unbound an command_line_arguments_t type*/ 656 //DOC_FUNC_DEF(cpp_command_line_arguments_unbound DG_PARSE_COMMON) 657 int 658 cpp_command_line_arguments_unbound (command_line_arguments_t * c) 659 { 660 int dummy_for_begin_function = (dummy_for_begin_function = 0); 661 int result; 662 if (!(result = mm2_unbound_mem (c->mm_handle))) 663 { 664 /*!!begin critical section: uses unbounded result!! */ 665 mm2_bound_new_forbidden = 1; 666 if (c->main_file) 667 col_unbound_col (c->main_file); 668 if (c->macros) 669 col_unbound_col (c->macros); 670 if (c->dirs) 671 col_unbound_col (c->dirs); 672 if (c->extension_txt) 673 col_unbound_col (c->extension_txt); 674 if (c->extension_html) 675 col_unbound_col (c->extension_html); 676 if (c->process_only) 677 col_unbound_col (c->process_only); 678 if (c->process_only_dir) 679 col_unbound_col (c->process_only_dir); 680 mm2_bound_new_forbidden = 0; 681 /*!!end critical section: uses unbounded result!! */ 682 } 683 else 684 { 685 } 686 return result;; 687 } 688 689 /*unbound symbol_table*/ 690 //DOC_FUNC_DEF(cpp_unbound_symbol_table DG_PARSE_COMMON) 691 void 692 cpp_unbound_symbol_table () 693 { 694 int dummy_for_begin_function = (dummy_for_begin_function = 0); 695 unbound_rbt (symbol_table_prop, NULL, 696 (col_data_function_t) cpp_unbound_symbol_table_prop); 697 return;; 698 } 699 700 /*unbound entry symbol_table_prop_t*/ 701 //DOC_FUNC_DEF(cpp_unbound_symbol_table_prop DG_PARSE_COMMON) 702 void 703 cpp_unbound_symbol_table_prop (symbol_table_prop_t * f) 704 { 705 int dummy_for_begin_function = (dummy_for_begin_function = 0); 706 mm2_unbound_mem (f->mm_handle_sym); 707 unbound_macro_definition (f->macro_definition_in_symbol_table); 708 mm2_unbound_mem (f->mm_handle); 709 return;; 710 } 711 712 /*open a buffer for storing read characters and push a string*/ 713 //DOC_FUNC_DEF(cpp_flex_create_new_read_xstring DG_PARSE_COMMON) 714 void 715 cpp_flex_create_new_read_xstring (col_t * xstr, int state) 716 { 717 int dummy_for_begin_function = (dummy_for_begin_function = 0); 718 cpp_open_text_file_for_read ("--", NULL); 719 flex_pushstring2 (misc_parser, xstr); 720 rewind_scanner (misc_parser, state, 0); 721 return;; 722 } 723 724 /*fetch text value of symbol*/ 725 //DOC_FUNC_DEF(symbol_text4 DG_BISON_SYMBOL_ATTRIBUTES) 726 char * 727 symbol_text4 (pleaf_t sym, void **mm_handle_local) 728 { 729 int dummy_for_begin_function = (dummy_for_begin_function = 0); 730 char *c; 731 int pos_beg = pleaf_pos (sym) - 1; 732 int pos_end = pleaf_pos_end (sym) - 1; 733 c = (char *) mm2_bound_new_mem (pos_end - pos_beg + 1); 734 DER (mm_handle_local) = mm2_handle; 735 { 736 col_t *xs = symbol_text3 (sym); 737 strcpy (c, val_xstring (xs)); 738 unbound_xstring (xs); 739 } 740 return c;; 741 } 742 743 /*write if/else cases to *.js file*/ 744 //DOC_FUNC_DEF(cpp_write_html_result_cases DG_GENERATE_HTML_RESULT) 745 void 746 cpp_write_html_result_cases (col_t * l, int begin) 747 { 748 int dummy_for_begin_function = (dummy_for_begin_function = 0); 749 static int nr = 0; 750 if (begin) 751 nr = 0; 752 if (l) 753 { 754 list_elm_t *el; 755 el = (*(val_col_list_elm (l)))->first; 756 while (el) 757 { 758 cpp_html_result_elmnt_t *e = (cpp_html_result_elmnt_t *) (el->data); 759 if (e->cpp_html_result_kind == CPP_HTML_RESULT_PLAIN_TEXT) 760 { 761 fprintf (cpp_html_js_file, "%s", "document.write(\""); 762 cpp_write_html_string (e->cpp_html_result_xstr); 763 fprintf (cpp_html_js_file, "%s", "\");\n"); 764 } 765 if (e->cpp_html_result_kind == CPP_HTML_RESULT_MACRO) 766 { 767 int this_nr = nr++; 768 fprintf (cpp_html_js_file, "%s%d%s%d%s%d%s", 769 "if(!macro_tag_local[", this_nr, 770 "])\n{\n" 771 " document.write(\"<a id=\\\"id", this_nr, 772 "\\\" href=\\\"javascript:js_action(", this_nr, 773 ");\\\">"); 774 cpp_write_html_string (e->cpp_html_result_xstr); 775 fprintf (cpp_html_js_file, "%s", "</a>\");\n"); 776 cpp_write_html_result_cases (e->cpp_html_result_unexpanded, 0); 777 fprintf (cpp_html_js_file, "%s%d%s%d%s", 778 " }\n" 779 " else\n" 780 " {\n" 781 " document.write(\"<a id=\\\"id", this_nr, 782 "\\\" href=\\\"javascript:js_action(", this_nr, 783 ");\\\">&gt;&gt;</a>\");\n"); 784 cpp_write_html_result_cases (e->cpp_html_result_expanded, 0); 785 fprintf (cpp_html_js_file, "%s", "}\n"); 786 } 787 el = el->next; 788 } 789 } 790 return;; 791 } 792 793 /*write if/else cases to *.js file (2)*/ 794 //DOC_FUNC_DEF(cpp02_write_html2_result_cases DG_GENERATE_HTML_RESULT) 795 void 796 cpp02_write_html2_result_cases (col_t * l, int begin) 797 { 798 int dummy_for_begin_function = (dummy_for_begin_function = 0); 799 static int nr = 0; 800 if (begin) 801 nr = 0; 802 if (l) 803 { 804 list_elm_t *el; 805 el = (*(val_col_list_elm (l)))->first; 806 while (el) 807 { 808 cpp_html_result_elmnt_t *e = (cpp_html_result_elmnt_t *) (el->data); 809 if (e->cpp_html_result_kind == CPP_HTML_RESULT_PLAIN_TEXT) 810 { 811 cpp02_write_html2_string (e->cpp_html_result_xstr); 812 } 813 if (e->cpp_html_result_kind == CPP_HTML_RESULT_MACRO) 814 { 815 int this_nr = nr++; 816 fprintf (stdout, "%s%d%s%d%s", 817 "<span class=\"cpp02_normal\" id=\"cpp01_id", this_nr, 818 "\"><a href=\"javascript:js_action(", this_nr, 819 ");\">"); 820 cpp02_write_html2_string (e->cpp_html_result_xstr); 821 fprintf (stdout, "%s", "</a>"); 822 cpp02_write_html2_result_cases (e->cpp_html_result_unexpanded, 823 0); 824 fprintf (stdout, "%s%d%s%d%s", 825 "</span><span class=\"cpp02_hide\" id=\"cpp02_id", 826 this_nr, "\"><a href=\"javascript:js_action(", this_nr, 827 ");\">" "&gt;&gt;</a>"); 828 cpp02_write_html2_result_cases (e->cpp_html_result_expanded, 0); 829 fprintf (stdout, "%s", "</span>"); 830 } 831 el = el->next; 832 } 833 } 834 return;; 835 } 836 837 /*write escaped string to *.js file*/ 838 //DOC_FUNC_DEF(cpp_write_html_string DG_GENERATE_HTML_RESULT) 839 void 840 cpp_write_html_string (col_t * x) 841 { 842 int dummy_for_begin_function = (dummy_for_begin_function = 0); 843 char *i; 844 for (i = val_xstring (x); *i; i++) 845 { 846 if (*i == '\"') 847 { 848 fprintf (cpp_html_js_file, "%s", "&quot;"); 849 } 850 else if (*i == '\\') 851 { 852 fprintf (cpp_html_js_file, "%s", "\\\\"); 853 } 854 else if (*i == '\n') 855 { 856 fprintf (cpp_html_js_file, "%s", "\\n"); 857 } 858 else if (*i == '\t') 859 { 860 fprintf (cpp_html_js_file, "%s", "\\t"); 861 } 862 else if (*i == '&') 863 { 864 fprintf (cpp_html_js_file, "%s", "&amp;"); 865 } 866 else if (*i == '<') 867 { 868 fprintf (cpp_html_js_file, "%s", "&lt;"); 869 } 870 else if (*i == '>') 871 { 872 fprintf (cpp_html_js_file, "%s", "&gt;"); 873 } 874 else if ((*i < ' ')) 875 { 876 //KR_HTML_NO_CONTROL_CHARS; 877 } 878 else 879 { 880 fputc (*i, cpp_html_js_file); 881 } 882 } 883 return;; 884 } 885 886 /*write escaped string to html file*/ 887 //DOC_FUNC_DEF(cpp02_write_html2_string DG_GENERATE_HTML_RESULT) 888 void 889 cpp02_write_html2_string (col_t * x) 890 { 891 int dummy_for_begin_function = (dummy_for_begin_function = 0); 892 char *i; 893 for (i = val_xstring (x); *i; i++) 894 { 895 if (*i == '\"') 896 { 897 fprintf (stdout, "%s", "&quot;"); 898 } 899 else if (*i == '\n') 900 { 901 fprintf (stdout, "%s", "\n"); 902 } 903 else if (*i == '&') 904 { 905 fprintf (stdout, "%s", "&amp;"); 906 } 907 else if (*i == '<') 908 { 909 fprintf (stdout, "%s", "&lt;"); 910 } 911 else if (*i == '>') 912 { 913 fprintf (stdout, "%s", "&gt;"); 914 } 915 else if ((*i < ' ')) 916 { 917 //KR_HTML_NO_CONTROL_CHARS; 918 } 919 else 920 { 921 fputc (*i, stdout); 922 } 923 } 924 return;; 925 } 926 927 /*open *.js file for writing*/ 928 //DOC_FUNC_DEF(cpp_html_open_js DG_GENERATE_HTML_RESULT) 929 FILE * 930 cpp_html_open_js () 931 { 932 int dummy_for_begin_function = (dummy_for_begin_function = 0); 933 FILE *f; 934 col_t *x; 935 col_t *i; 936 int suffix = 10000; 937 while (1) 938 { 939 i = new_int (suffix); 940 x = 941 concat_xstring (concat_xstring 942 (NEW_XSTRING_CONST ("hyp"), print_col_to_xstring (i)), 943 NEW_XSTRING_CONST (".js")); 944 if ((f = fopen (val_xstring (x), "r"))) 945 { 946 fclose (f); 947 suffix++; 948 } 949 else 950 { 951 break; 952 } 953 unbound_col (i); 954 unbound_col (x); 955 } 956 f = fopen (val_xstring (x), "w+"); 957 unbound_col (i); 958 cpp_html_js_name = x; 959 return f;; 960 } 961 962 /*calculate number of expanded macros*/ 963 //DOC_FUNC_DEF(cpp_nr_macros_in_html_result_list DG_GENERATE_HTML_RESULT) 964 int 965 cpp_nr_macros_in_html_result_list (col_t * l) 966 { 967 int dummy_for_begin_function = (dummy_for_begin_function = 0); 968 int nr = 0; 969 if (l) 970 { 971 list_elm_t *el; 972 el = (*(val_col_list_elm (l)))->first; 973 while (el) 974 { 975 cpp_html_result_elmnt_t *e = (cpp_html_result_elmnt_t *) (el->data); 976 if (e->cpp_html_result_kind == CPP_HTML_RESULT_MACRO) 977 { 978 nr++; 979 nr += 980 cpp_nr_macros_in_html_result_list (e-> 981 cpp_html_result_expanded); 982 nr += 983 cpp_nr_macros_in_html_result_list (e-> 984 cpp_html_result_unexpanded); 985 } 986 el = el->next; 987 } 988 } 989 return nr;; 990 } 991 992 /*prepare html result output*/ 993 //DOC_FUNC_DEF(cpp_prepare_html_result DG_GENERATE_HTML_RESULT) 994 void 995 cpp_prepare_html_result (void) 996 { 997 int dummy_for_begin_function = (dummy_for_begin_function = 0); 998 if (cmd_ln->html_result || cmd_ln->html_result2) 999 { 1000 char *f = 1001 (cmd_ln->main_file ? val_xstring (cmd_ln->main_file) : "stdin"); 1002 fprintf (stdout, "%s%s%s", 1003 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n\n<!--Created by " 1004 CPP2HTML_VERSION " by: K.Karamazen -->\n<HTML><HEAD><TITLE>", 1005 f, "</TITLE></HEAD><BODY><PRE>\n"); 1006 } 1007 return;; 1008 } 1009 1010 /*finish html result output*/ 1011 //DOC_FUNC_DEF(cpp_finish_html_result DG_GENERATE_HTML_RESULT) 1012 void 1013 cpp_finish_html_result (void) 1014 { 1015 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1016 if (cmd_ln->html_result) 1017 { 1018 int i; 1019 int nr = cpp_nr_macros_in_html_result_list (cpp_html_result_list); 1020 cpp_html_js_file = cpp_html_open_js (); 1021 fprintf (stdout, "%s%s%s", 1022 "<script type=\"text/javascript\" src=\"", 1023 val_xstring (cpp_html_js_name), 1024 "\"></script>\n" "<script type=\"text/javascript\">\n" "<!--\n" 1025 "macro_tag_initial = new Array("); 1026 for (i = 0; i < nr; i++) 1027 { 1028 fprintf (stdout, "%s", "false"); 1029 if (i != nr - 1) 1030 fprintf (stdout, "%s", ","); 1031 } 1032 fprintf (stdout, "%s", 1033 ");\n" 1034 "current_tag_initial = 0;\n" 1035 "js_write(macro_tag_initial,current_tag_initial);\n" 1036 "//-->\n" "</script>\n"); 1037 fprintf (stdout, "%s", "</PRE></BODY></HTML>"); 1038 1039 fprintf (cpp_html_js_file, "%s%d%s%d%s%s%s", 1040 "function js_propagate(macro_tag_prop)\n" 1041 "{\n" 1042 " document.write(\"<script type=\\\"text/javascript\\\">\\n<!--\\n macro_tag=new Array(\");\n" 1043 " for(var i = 0; i <= ", nr - 1, 1044 "; i++)\n" 1045 " {\n" 1046 " document.write(String(macro_tag_prop[i]));\n if(i!=", 1047 nr - 1, 1048 ")\n" " {\n" " document.write(\",\");\n" " }\n" " }\n" 1049 " document.write(\");\\n//-->\\n<\\/script>\\n\");\n" 1050 " document.write(\"<script type=\\\"text/javascript\\\" src=\\\"", 1051 val_xstring (cpp_html_js_name), 1052 "\\\"></script>\\n\");\n" "}\n" "\n" "function js_action(i)\n" 1053 "{\n" " macro_tag[i]=!macro_tag[i];\n" " current_tag=i;\n" 1054 " js_write(macro_tag,current_tag);\n" "}\n" "\n" 1055 "function js_write(macro_tag_local,current_tag_local)\n" "{\n" 1056 "document.open();\n" "\n" 1057 " document.write(\"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.01 Strict//EN\\\"\\n\");\n" 1058 ""); 1059 fprintf (cpp_html_js_file, "%s", 1060 "document.write(\" \\\"http://www.w3.org/TR/html4/strict.dtd\\\">\\n\");\n" 1061 " document.write(\"<html>\\n\");\n" 1062 " document.write(\"<head>\\n\");\n" 1063 " document.write(\"<title>cpp2html</title>\\n\");\n" 1064 " document.write(\"</head>\\n\");\n" 1065 " document.write(\"<body>\\n\");\n" 1066 " document.write(\"<pre>\\n\");\n"); 1067 cpp_write_html_result_cases (cpp_html_result_list, 1); 1068 fprintf (cpp_html_js_file, "%s%d%s%d%s%s%s", 1069 "document.write(\"</pre>\");\n" 1070 " document.write(\"<script type=\\\"text/javascript\\\">\\n<!--\\n macro_tag=new Array(\");\n" 1071 " for(var i = 0; i <= ", nr - 1, 1072 "; i++)\n" 1073 " {\n" 1074 " document.write(String(macro_tag_local[i]));\n" 1075 " if(i!=", nr - 1, 1076 ")\n" 1077 " {\n" 1078 " document.write(\",\");\n" 1079 " }\n" 1080 " }\n" 1081 " document.write(\");\\n//-->\\n<\\/script>\\n\");\n" 1082 " document.write(\"<script type=\\\"text/javascript\\\" src=\\\"", 1083 val_xstring (cpp_html_js_name), 1084 "\\\"></script>\\n\");\n" "// end function js_propagate\n" 1085 " document.write(\"</body>\\n\");\n" 1086 " document.write(\"</html>\\n\");\n" 1087 " document.getElementById(\"id\"+String(current_tag_local)).focus();\n" 1088 " window.scrollBy(0,75);\n" " document.close();\n" "}\n" "\n"); 1089 } 1090 return;; 1091 } 1092 1093 /*finish html result (2) output */ 1094 //DOC_FUNC_DEF(cpp02_finish_html_result2 DG_GENERATE_HTML_RESULT) 1095 void 1096 cpp02_finish_html_result2 (void) 1097 { 1098 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1099 if (cmd_ln->html_result2) 1100 { 1101 int i; 1102 int nr = cpp_nr_macros_in_html_result_list (cpp_html_result_list); 1103 cpp_html_js_file = cpp_html_open_js (); 1104 fprintf (stdout, "%s", 1105 "<style type=\"text/css\">\n" 1106 "<!--\n" 1107 " span.cpp02_normal { }\n" 1108 " span.cpp02_hide { font-size:0pt; }\n" 1109 "-->\n" "</style>\n"); 1110 fprintf (stdout, "%s", 1111 "<script type=\"text/javascript\">\n" 1112 "<!--\n" 1113 "function js_action(i)\n" 1114 "{\n" 1115 " macro_tag[i]=!macro_tag[i];\n" 1116 " if(macro_tag[i]==true)\n" 1117 " {\n" 1118 " document.getElementById(\"cpp01_id\"+String(i)).className = \"cpp02_hide\";\n" 1119 " document.getElementById(\"cpp02_id\"+String(i)).className = \"cpp02_normal\";\n" 1120 " }\n" 1121 " else\n" 1122 " {\n" 1123 " document.getElementById(\"cpp01_id\"+String(i)).className = \"cpp02_normal\";\n" 1124 " document.getElementById(\"cpp02_id\"+String(i)).className = \"cpp02_hide\";\n" 1125 " }\n" "}\n" "macro_tag = new Array("); 1126 for (i = 0; i < nr; i++) 1127 { 1128 fprintf (stdout, "%s", "false"); 1129 if (i != nr - 1) 1130 fprintf (stdout, "%s", ","); 1131 } 1132 fprintf (stdout, "%s", ");\n" "//-->\n" "</script>\n"); 1133 1134 fprintf (cpp_html_js_file, "%s", "//this file is not used\n"); 1135 cpp02_write_html2_result_cases (cpp_html_result_list, 1); 1136 fprintf (stdout, "%s", "</PRE></BODY></HTML>"); 1137 } 1138 return;; 1139 } 1140 1141 /*take care about special meaning of the top of parse tree*/ 1142 //DOC_FUNC_DEF(cpp_handle_top DG_PARSE_COMMON) 1143 void 1144 cpp_handle_top (pleaf_t t) 1145 { 1146 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1147 parser_master_t *p = t->text_heap_heap->ps01_parser; 1148 p->top = t; 1149 misc_adopt_symbol (p->top); 1150 return;; 1151 } 1152 1153 /*close parsing*/ 1154 //DOC_FUNC_DEF(cpp_close DG_PARSE_COMMON) 1155 void 1156 cpp_close (void) 1157 { 1158 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1159 int dummy = (dummy = 1); 1160 cpp_finish_html_result (); 1161 cpp02_finish_html_result2 (); 1162 DER (cpp2fncs->cpp_html_result_close) (); 1163 if (part_pushed_expanded_text) 1164 col_unbound_col (part_pushed_expanded_text); 1165 mm2_close (); 1166 return;; 1167 } 1168 1169 /*create new CLISTP of cpp_html_result_elmnt_t*/ 1170 //DOC_FUNC_DEF(cpp_create_html_result_list DG_GENERATE_HTML_RESULT) 1171 col_t * 1172 cpp_create_html_result_list () 1173 { 1174 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1175 col_t *l; 1176 l = list_create (NULL); 1177 return l;; 1178 } 1179 1180 /*create new cpp_html_result_elmnt_t*/ 1181 //DOC_FUNC_DEF(cpp_bound_html_result_element DG_GENERATE_HTML_RESULT) 1182 cpp_html_result_elmnt_t * 1183 cpp_bound_html_result_element () 1184 { 1185 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1186 cpp_html_result_elmnt_t *e = 1187 (cpp_html_result_elmnt_t *) 1188 bound_new_mem (sizeof (cpp_html_result_elmnt_t)); 1189 e->mm_handle = mm_handle; 1190 e->cpp_html_result_kind = CPP_HTML_RESULT_PLAIN_TEXT; 1191 e->cpp_html_result_xstr = NULL; 1192 e->cpp_html_result_unexpanded = NULL; 1193 e->cpp_html_result_expanded = NULL; 1194 return e;; 1195 } 1196 1197 /*unbound cpp_html_result_elmnt_t*/ 1198 //DOC_FUNC_DEF(cpp_unbound_html_result_elmnt DG_GENERATE_HTML_RESULT) 1199 void 1200 cpp_unbound_html_result_elmnt (void *e) 1201 { 1202 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1203 cpp_html_result_elmnt_t *el = (cpp_html_result_elmnt_t *) e; 1204 if (el->cpp_html_result_xstr) 1205 unbound_col (el->cpp_html_result_xstr); 1206 if (el->cpp_html_result_expanded) 1207 cpp_unbound_html_result_list (el->cpp_html_result_expanded); 1208 if (el->cpp_html_result_unexpanded) 1209 cpp_unbound_html_result_list (el->cpp_html_result_unexpanded); 1210 unbound_mem_from_handle (el->mm_handle); 1211 return;; 1212 } 1213 1214 /*unbound cpp html result list*/ 1215 //DOC_FUNC_DEF(cpp_unbound_html_result_list DG_GENERATE_HTML_RESULT) 1216 void 1217 cpp_unbound_html_result_list (col_t * l) 1218 { 1219 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1220 unbound_list2 (l, cpp_unbound_html_result_elmnt); 1221 return;; 1222 } 1223 1224 /*indicates if during macro expansion*/ 1225 //DOC_FUNC_DEF(is_macro_expansion DG_PARSE_COMMON) 1226 int 1227 is_macro_expansion (void) 1228 { 1229 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1230 int result; 1231 result = (top_symbol_stack_1 ? 1 : 0); 1232 return result;; 1233 } 1234 1235 /*pop macro of stack after it is expanded*/ 1236 //DOC_FUNC_DEF(pop_symbol_stack DG_EXPAND_TEXT) 1237 void 1238 pop_symbol_stack (symbol_stack_t ** top_symbol_stack) 1239 { 1240 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1241 symbol_stack_t *p = NULL; 1242 if (*top_symbol_stack) 1243 *top_symbol_stack = (p = *top_symbol_stack)->next; 1244 col_unbound_col (p->cpp_unexpanded_arg_txt_list); 1245 col_unbound_col (p->cpp_expanded_arg_branch_list); 1246 mm2_unbound_mem (p->mm_handle); 1247 return;; 1248 } 1249 1250 /*push macro to stack before it is expanded*/ 1251 //DOC_FUNC_DEF(push_symbol_stack DG_EXPAND_TEXT) 1252 void 1253 push_symbol_stack (symbol_stack_t ** top_symbol_stack, pleaf_t symbol) 1254 { 1255 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1256 symbol_stack_t *new_elmt; 1257 new_elmt = (symbol_stack_t *) mm2_bound_new_mem (sizeof (symbol_stack_t)); 1258 new_elmt->mm_handle = mm2_handle; 1259 new_elmt->symbol = symbol; 1260 { 1261 col_t *name = symbol_text3 (symbol); 1262 new_elmt->cpp_symbol_table_entry = 1263 pp_find_symbol_table (val_xstring (name)); 1264 unbound_col (name); 1265 } 1266 new_elmt->next = *top_symbol_stack; 1267 new_elmt->cpp_unexpanded_arg_txt_list = list_create (NULL); 1268 new_elmt->cpp_expanded_arg_branch_list = list_create (NULL); 1269 *top_symbol_stack = new_elmt; 1270 return;; 1271 } 1272 1273 /*when symbol is macro, return macro with or without params*/ 1274 //DOC_FUNC_DEF(pp_check_if_macro_name DG_PARSE_COMMON) 1275 int 1276 pp_check_if_macro_name (int token) 1277 { 1278 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1279 // char *token_str = search_table_token(token); 1280 char *token_txt; 1281 col_t *token_xstr; 1282 if (token == PP_TOK_PREPROCESSING_NAME_UNIQUE_IN_PP 1283 && macro_name_recognition_on) 1284 { 1285 symbol_table_prop_t *found; 1286 void *mm_handle_token_txt = NULL; 1287 token_txt = symbol_text4 (misc_parser->yylval, &mm_handle_token_txt); 1288 RBT_FIND_KEY_STR (symbol_table_prop, symbol_table_prop_t, sym, 1289 token_txt, found); 1290 mm2_unbound_mem (mm_handle_token_txt); 1291 if (!found || 1292 parsing_state_data->sym->id == PP_DEFINE_DIRECTIVE || 1293 parsing_state_data->directive_expression_stage == 1294 DIRECTIVE_EXPRESSION_STAGE_INTERPRET) 1295 { 1296 return token;; 1297 } 1298 else 1299 { 1300 token_xstr = symbol_text3 (misc_parser->yylval); 1301 if (!xstring_aa_value_xstring 1302 (expanded_macros_register, token_xstr)) 1303 { 1304 unbound_xstring (token_xstr); 1305 if (!found->macro_definition_in_symbol_table 1306 || found->macro_definition_in_symbol_table->nr_of_params == 1307 -1) 1308 { 1309 return TOK_MACRO_WITHOUT_PARAMS;; 1310 } 1311 return TOK_MACRO_WITH_PARAMS;; 1312 } 1313 else 1314 { 1315 unbound_xstring (token_xstr); 1316 } 1317 } 1318 } 1319 return token;; 1320 } 1321 1322 /*less than for symbol table heap*/ 1323 //DOC_FUNC_DEF(symbol_table_prop_cmpLT DG_PARSE_COMMON) 1324 int 1325 symbol_table_prop_cmpLT (void *a, void *b) 1326 { 1327 return (strcmp (((symbol_table_prop_t *) a)->sym, 1328 ((symbol_table_prop_t *) b)->sym) > 0); 1329 } 1330 1331 /*equal for symbol table heap*/ 1332 //DOC_FUNC_DEF(symbol_table_prop_cmpEQ DG_PARSE_COMMON) 1333 int 1334 symbol_table_prop_cmpEQ (void *a, void *b) 1335 { 1336 return (strcmp (((symbol_table_prop_t *) a)->sym, 1337 ((symbol_table_prop_t *) b)->sym) == 0); 1338 } 1339 1340 /*handle parse error in conditionals*/ 1341 //DOC_FUNC_DEF(if_group_error DG_PARSE_CONDITIONALS) 1342 void 1343 if_group_error (pleaf_t sym) 1344 { 1345 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1346 cpp_error_text (last_symbol_from_an_input_file (misc_parser), 1347 "parse error in conditionals:missing #endif?"); 1348 exit (1);; 1349 return;; 1350 } 1351 1352 /*after recognizing macro with parameters name, prepare arguments parsing*/ 1353 //DOC_FUNC_DEF(finalize_name_of_macro_with_params_invokation DG_EXPAND_TEXT) 1354 void 1355 finalize_name_of_macro_with_params_invokation (pleaf_t sym) 1356 { 1357 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1358 push_symbol_stack (&top_symbol_stack_1, sym); 1359 top_symbol_stack_1->current_argument_number = 0; 1360 change_flex_state (misc_parser, cpp_what_is_expansion_state ()); 1361 macro_name_recognition_on = 0; 1362 // switch_macro_name_recognition(); 1363 return;; 1364 } 1365 1366 /*after an macro argument parsing, prepare the next one*/ 1367 //DOC_FUNC_DEF(finalize_macro_argument DG_EXPAND_TEXT) 1368 void 1369 finalize_macro_argument (pleaf_t sym) 1370 { 1371 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1372 col_t *x; 1373 macro_definition_t *md = 1374 top_symbol_stack_1->cpp_symbol_table_entry-> 1375 macro_definition_in_symbol_table; 1376 if (md->nr_of_params > top_symbol_stack_1->current_argument_number) 1377 { 1378 if (xstring_aa_value_sint 1379 (md->parameter_used_in_expansion, 1380 top_symbol_stack_1->current_argument_number)) 1381 { 1382 x = symbol_text6 (sym, part_symbol_text3); 1383 } 1384 else 1385 { 1386 x = NEW_XSTRING_CONST (" "); 1387 } 1388 top_symbol_stack_1->current_argument_number++; 1389 list_push_last (top_symbol_stack_1->cpp_unexpanded_arg_txt_list, x); 1390 } 1391 return;; 1392 } 1393 1394 /*create new macro_expansion_struct_t*/ 1395 //DOC_FUNC_DEF(new_macro_expansion_struct DG_EXPAND_TEXT) 1396 macro_expansion_struct_t * 1397 new_macro_expansion_struct () 1398 { 1399 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1400 macro_expansion_struct_t *m = 1401 (macro_expansion_struct_t *) 1402 bound_new_mem (sizeof (macro_expansion_struct_t)); 1403 m->mm_handle = mm_handle; 1404 m->expanded_arg_arr = aa_array (); 1405 m->unexpanded_arg_arr = aa_array (); 1406 m->string_literel_arr = aa_array (); 1407 return m;; 1408 } 1409 1410 /*unbound a macro_expansion_struct_t*/ 1411 //DOC_FUNC_DEF(unbound_macro_expansion_struct DG_EXPAND_TEXT) 1412 void 1413 unbound_macro_expansion_struct (macro_expansion_struct_t * m) 1414 { 1415 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1416 unbound_int_xstring_array (m->expanded_arg_arr); 1417 unbound_int_xstring_array (m->unexpanded_arg_arr); 1418 unbound_int_xstring_array (m->string_literel_arr); 1419 unbound_mem_from_handle (m->mm_handle); 1420 return;; 1421 } 1422 1423 /*create new new_macro_substitution_list_elmnt*/ 1424 //DOC_FUNC_DEF(new_macro_substitution_list_elmnt DG_PARSE_DEFINE) 1425 macro_substitution_list_elmnt_t * 1426 new_macro_substitution_list_elmnt (int kind, col_t * xstr, int parameter_nr) 1427 { 1428 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1429 macro_substitution_list_elmnt_t *m = 1430 (macro_substitution_list_elmnt_t *) 1431 bound_new_mem (sizeof (macro_substitution_list_elmnt_t)); 1432 m->mm_handle = mm_handle; 1433 m->sl_xstr = xstr; 1434 m->sl_parameter_nr = parameter_nr; 1435 m->sl_kind = kind; 1436 return m;; 1437 } 1438 1439 /*unbound a macro_substitution_list_elmnt_t*/ 1440 //DOC_FUNC_DEF(unbound_macro_substitution_list_elmnt DG_PARSE_DEFINE) 1441 void 1442 unbound_macro_substitution_list_elmnt (void *mm) 1443 { 1444 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1445 macro_substitution_list_elmnt_t *m = (macro_substitution_list_elmnt_t *) mm; 1446 if (m->sl_xstr) 1447 unbound_col (m->sl_xstr); 1448 unbound_mem_from_handle (m->mm_handle); 1449 return;; 1450 } 1451 1452 /* create new macro_definition_t*/ 1453 //DOC_FUNC_DEF(new_macro_definition DG_PARSE_DEFINE) 1454 macro_definition_t * 1455 new_macro_definition () 1456 { 1457 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1458 macro_definition_t *m; 1459 m = (macro_definition_t *) bound_new_mem (sizeof (macro_definition_t)); 1460 m->mm_handle = mm_handle; 1461 m->macro_substitution_list = 1462 list_create (unbound_macro_substitution_list_elmnt); 1463 m->parameter_used_in_expansion = aa_array (); 1464 m->parameter_used_in_string_literal = aa_array (); 1465 m->parameter_used_in_concat = aa_array (); 1466 m->nr_of_params = -1; 1467 return m;; 1468 } 1469 1470 /*sets free macro_definition_t*/ 1471 //DOC_FUNC_DEF(unbound_macro_definition DG_PARSE_DEFINE) 1472 void 1473 unbound_macro_definition (macro_definition_t * m) 1474 { 1475 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1476 unbound_int_xstring_array (m->parameter_used_in_concat); 1477 unbound_int_xstring_array (m->parameter_used_in_string_literal); 1478 unbound_int_xstring_array (m->parameter_used_in_expansion); 1479 unbound_list (m->macro_substitution_list); 1480 unbound_mem_from_handle (m->mm_handle); 1481 return;; 1482 } 1483 1484 /*sets free a branch of the parse tree*/ 1485 //DOC_FUNC_DEF(unbound_rec DG_PARSE_COMMON) 1486 void 1487 unbound_rec (pleaf_t b) 1488 { 1489 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1490 if (b) 1491 { 1492 unbound_rec (b->sub_all); 1493 unbound_rec (b->next_all); 1494 col_unbound_col (b); 1495 } 1496 return;; 1497 } 1498 1499 /*calculates new state*/ 1500 //DOC_FUNC_DEF(calculate_preprocessor_state DG_PARSE_COMMON) 1501 int 1502 calculate_preprocessor_state () 1503 { 1504 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1505 int result; 1506 if (is_elm_xstring (parsing_state_data->state_set, SKIP_CONDITIONAL_TEXT)) 1507 { 1508 result = preprocessorskipstate; 1509 } 1510 else 1511 { 1512 result = preprocessorstate; 1513 } 1514 return result;; 1515 } 1516 1517 /*calculate state*/ 1518 //DOC_FUNC_DEF(calculate_conditional_state_after_if DG_PARSE_CONDITIONALS) 1519 void 1520 calculate_conditional_state_after_if () 1521 { 1522 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1523 if (is_elm_xstring (parsing_state_data->state_set, SKIP_CONDITIONAL_TEXT)) 1524 { 1525 add_elm_xstring (parsing_state_data->state_set, SKIP_CONDITIONAL_GROUP); 1526 } 1527 else 1528 { 1529 if (parsing_state_data->expression_value) 1530 { 1531 add_elm_xstring (parsing_state_data->state_set, 1532 COND_ALTERNATIVE_FOUND); 1533 } 1534 else 1535 { 1536 del_elm_xstring (parsing_state_data->state_set, 1537 COND_ALTERNATIVE_FOUND); 1538 add_elm_xstring (parsing_state_data->state_set, 1539 SKIP_CONDITIONAL_TEXT); 1540 } 1541 } 1542 return;; 1543 } 1544 1545 /*calculate state*/ 1546 //DOC_FUNC_DEF(calculate_conditional_state_after_elif DG_PARSE_CONDITIONALS) 1547 void 1548 calculate_conditional_state_after_elif () 1549 { 1550 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1551 if (!is_elm_xstring (parsing_state_data->state_set, SKIP_CONDITIONAL_GROUP)) 1552 { 1553 if (is_elm_xstring 1554 (parsing_state_data->state_set, COND_ALTERNATIVE_FOUND)) 1555 { 1556 add_elm_xstring (parsing_state_data->state_set, 1557 SKIP_CONDITIONAL_TEXT); 1558 } 1559 else 1560 { 1561 if (parsing_state_data->expression_value) 1562 { 1563 add_elm_xstring (parsing_state_data->state_set, 1564 COND_ALTERNATIVE_FOUND); 1565 del_elm_xstring (parsing_state_data->state_set, 1566 SKIP_CONDITIONAL_TEXT); 1567 } 1568 else 1569 { 1570 } 1571 } 1572 } 1573 return;; 1574 } 1575 1576 /*after macro invokation*/ 1577 //DOC_FUNC_DEF(finalize_macro_invokation DG_EXPAND_TEXT) 1578 void 1579 finalize_macro_invokation (pleaf_t sym) 1580 { 1581 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1582 /* if(sym->sub->id!=NT_ERROR) */ 1583 { 1584 if (DIRECTIVE_EXPRESSION_STAGE_EXPAND == 1585 parsing_state_data->directive_expression_stage 1586 || DIRECTIVE_INCLUDE_STAGE_EXPAND == 1587 parsing_state_data->directive_include_stage) 1588 { 1589 show (sym); 1590 list (sym); 1591 expand_macro2 (sym, parsing_state_data->scanner_state); 1592 } 1593 else 1594 { 1595 show (sym); 1596 list (sym); 1597 expand_macro2 (sym, macroexpansionstate); 1598 } 1599 } 1600 return;; 1601 } 1602 1603 /*report error in #define*/ 1604 //DOC_FUNC_DEF(define_error_process DG_PARSE_DEFINE) 1605 void 1606 define_error_process (pleaf_t p) 1607 { 1608 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1609 cpp_error_text (p, "parse error in #define"); 1610 return;; 1611 } 1612 1613 /*print error on begin of symbol*/ 1614 //DOC_FUNC_DEF(cpp_error_text DG_ERROR_HANDLING) 1615 void 1616 cpp_error_text (pleaf_t p, char *text) 1617 { 1618 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1619 included_from_text (); 1620 fprintf (stderr, "%s:%d: %s\n", symbol_file (p), line_number_middle (p), 1621 text); 1622 return;; 1623 } 1624 1625 /*print included from cascade*/ 1626 //DOC_FUNC_DEF(included_from_text DG_ERROR_HANDLING) 1627 void 1628 included_from_text () 1629 { 1630 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1631 STACK_WALK (included_from_stack, leaf_t, p, 1632 { 1633 fprintf (stderr, "included from '%s', line %d\n", 1634 symbol_file (p), line_number_middle (p)); 1635 }); 1636 return;; 1637 } 1638 1639 /*finalize macro expansion */ 1640 //DOC_FUNC_DEF(finalize_text_expansion_after_macro_expansion DG_EXPAND_TEXT) 1641 void 1642 finalize_text_expansion_after_macro_expansion (pleaf_t sym) 1643 { 1644 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1645 return;; 1646 } 1647 1648 /*after macro expansion*/ 1649 //DOC_FUNC_DEF(finalize_macro_expansion DG_EXPAND_TEXT) 1650 void 1651 finalize_macro_expansion (pleaf_t sym) 1652 { 1653 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1654 show (sym); 1655 list (sym); 1656 macro_name_recognition_on = 1; 1657 pop_symbol_stack (&top_symbol_stack_1); 1658 rewind_scanner (misc_parser, cpp_what_is_expansion_state (), 0); 1659 return;; 1660 } 1661 1662 /*print expanded text*/ 1663 //DOC_FUNC_DEF(process_result DG_EXPAND_TEXT) 1664 void 1665 process_result (pleaf_t sym) 1666 { 1667 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1668 col_t *result; 1669 int old_st = parsing_state_data->directive_collect_stage; 1670 parsing_state_data->directive_collect_stage = 1671 DIRECTIVE_COLLECT_STAGE_RESULT; 1672 if (cmd_ln->html_result || cmd_ln->html_result2) 1673 { 1674 pleaf_t nbs; 1675 cpp_collect_html_result2 (sym, cpp_html_result_list, NULL, 1676 CPP_HTML_RESULT, NULL, &nbs, NULL); 1677 } 1678 else 1679 { 1680 result = DER (cpp2fncs->collect_expanded_text_result) (sym); 1681 if (!part_text_partial_flag) 1682 { 1683 fprintf (stdout, "%s", val_xstring (result)); 1684 } 1685 else if (stack_size (included_from_stack) == 0) 1686 { 1687 part_no_directive_ind = 1; 1688 part_current_indent = 0; 1689 part_output_pipe (stdout, "%s", val_xstring (result)); 1690 part_no_directive_ind = 0; 1691 } 1692 unbound_col (result); 1693 } 1694 parsing_state_data->directive_collect_stage = old_st; 1695 return;; 1696 } 1697 1698 /*prepare undef*/ 1699 //DOC_FUNC_DEF(prepare_undef_directive DG_PARSE_OTHER_DIRECTIVES) 1700 void 1701 prepare_undef_directive (pleaf_t sym) 1702 { 1703 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1704 cpp_branch_sort = sym->id; 1705 part_last_directive_symbol = sym; 1706 stack_push (state_stack, parsing_state_data); 1707 parsing_state_data = new_parsing_state_data (parsing_state_data); 1708 parsing_state_data->sym = sym; 1709 parsing_state_data->scanner_state = defdirectivescanstate; 1710 change_flex_state (misc_parser, defdirectivescanstate); 1711 return;; 1712 } 1713 1714 /*after undef*/ 1715 //DOC_FUNC_DEF(finalize_undef_directive DG_PARSE_OTHER_DIRECTIVES) 1716 void 1717 finalize_undef_directive (pleaf_t sym) 1718 { 1719 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1720 if (!(sym->sub->id == NT_ERROR)) 1721 { 1722 symbol_table_prop_t *found; 1723 unknown_identifier_flag = 0; 1724 if ((found = defined_name (sym->sub->next))) 1725 { 1726 if (!part_text_partial_flag 1727 || !stack_size (included_from_stack) == 0) 1728 { 1729 deleteKey (symbol_table_prop, found, 0); 1730 cpp_unbound_symbol_table_prop (found); 1731 } 1732 } 1733 } 1734 else 1735 { 1736 cpp_error_text (sym->sub->next, "parse error in #undef"); 1737 } 1738 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 1739 { 1740 col_t *x; 1741 part_no_directive_ind = 0; 1742 part_current_indent = 0; 1743 x = part_symbol_text3 (part_last_directive_symbol); 1744 part_output_pipe (stdout, "%s", val_xstring (x)); 1745 unbound_col (x); 1746 x = part_symbol_text3 (sym); 1747 part_output_pipe (stdout, "%s", val_xstring (x)); 1748 unbound_col (x); 1749 } 1750 unbound_parsing_state_data (parsing_state_data); 1751 parsing_state_data = (parsing_state_data_t *) stack_pop (state_stack); 1752 change_flex_state (misc_parser, parsing_state_data->scanner_state); 1753 return;; 1754 } 1755 1756 /*at the end of a file*/ 1757 //DOC_FUNC_DEF(finalize_file DG_PARSE_COMMON) 1758 void 1759 finalize_file (pleaf_t sym) 1760 { 1761 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1762 if (DIRECTIVE_INCLUDE_STAGE_INCLUDE_FILE == 1763 parsing_state_data->directive_include_stage) 1764 { 1765 pleaf_t s; 1766 int st; 1767 st = parsing_state_data->scanner_state; 1768 s = ((pleaf_t) stack_top_val (included_from_stack))->sub; 1769 unbound_parsing_state_data (parsing_state_data); 1770 parsing_state_data = (parsing_state_data_t *) stack_pop (state_stack); 1771 rewind_after_symbol (s, st); 1772 stack_pop (included_from_stack); 1773 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 1774 { 1775 part_functions_for_partial_modes (); 1776 } 1777 } 1778 return;; 1779 } 1780 1781 /*before include*/ 1782 //DOC_FUNC_DEF(prepare_include_directive DG_PARSE_INCLUDE) 1783 void 1784 prepare_include_directive (pleaf_t sym) 1785 { 1786 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1787 cpp_branch_sort = sym->id; 1788 stack_push (state_stack, parsing_state_data); 1789 parsing_state_data = new_parsing_state_data (parsing_state_data); 1790 parsing_state_data->sym = sym; 1791 part_last_directive_symbol = sym; 1792 parsing_state_data->scanner_state = texttoendoflinestate; 1793 parsing_state_data->directive_include_stage = DIRECTIVE_INCLUDE_STAGE_READ; 1794 change_flex_state (misc_parser, parsing_state_data->scanner_state); 1795 return;; 1796 } 1797 1798 /*before #line*/ 1799 //DOC_FUNC_DEF(prepare_line_directive DG_PARSE_OTHER_DIRECTIVES) 1800 void 1801 prepare_line_directive (pleaf_t sym) 1802 { 1803 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1804 cpp_branch_sort = sym->id; 1805 part_last_directive_symbol = sym; 1806 stack_push (state_stack, parsing_state_data); 1807 parsing_state_data = new_parsing_state_data (parsing_state_data); 1808 parsing_state_data->sym = sym; 1809 parsing_state_data->scanner_state = texttoendoflinestate; 1810 parsing_state_data->directive_line_stage = DIRECTIVE_LINE_STAGE_READ; 1811 change_flex_state (misc_parser, parsing_state_data->scanner_state); 1812 return;; 1813 } 1814 1815 /*before #error*/ 1816 //DOC_FUNC_DEF(prepare_error_directive DG_PARSE_OTHER_DIRECTIVES) 1817 void 1818 prepare_error_directive (pleaf_t sym) 1819 { 1820 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1821 cpp_branch_sort = sym->id; 1822 part_last_directive_symbol = sym; 1823 stack_push (state_stack, parsing_state_data); 1824 parsing_state_data = new_parsing_state_data (parsing_state_data); 1825 parsing_state_data->sym = sym; 1826 parsing_state_data->scanner_state = texttoendoflinestate; 1827 change_flex_state (misc_parser, parsing_state_data->scanner_state); 1828 return;; 1829 } 1830 1831 /*error in #line syntax*/ 1832 //DOC_FUNC_DEF(line_form_error DG_PARSE_OTHER_DIRECTIVES) 1833 void 1834 line_form_error (pleaf_t sym) 1835 { 1836 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1837 parsing_state_data->directive_line_stage = 1838 DIRECTIVE_LINE_STAGE_INTERPRET_ERROR; 1839 return;; 1840 } 1841 1842 /*error in #include syntax*/ 1843 //DOC_FUNC_DEF(include_file_error DG_PARSE_INCLUDE) 1844 void 1845 include_file_error (pleaf_t sym) 1846 { 1847 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1848 parsing_state_data->directive_include_stage = 1849 DIRECTIVE_INCLUDE_STAGE_INTERPRET_ERROR; 1850 return;; 1851 } 1852 1853 /*after #include*/ 1854 //DOC_FUNC_DEF(finalize_include_directive DG_PARSE_INCLUDE) 1855 void 1856 finalize_include_directive (pleaf_t sym) 1857 { 1858 int dummy_for_begin_function = (dummy_for_begin_function = 0); 1859 parser_master_t *p = sym->text_heap_heap->ps01_parser; 1860 pleaf_t name_sym; 1861 col_t *name_xstr; 1862 if (!(sym->sub->id == NT_ERROR) && 1863 parsing_state_data->directive_include_stage != 1864 DIRECTIVE_INCLUDE_STAGE_INTERPRET_ERROR) 1865 { 1866 name_sym = find_pleaf_with_id (sym, STANDARD_HEADER_NAME); 1867 if (!name_sym) 1868 name_sym = find_pleaf_with_id (sym, NT_FILE_NAME); 1869 name_xstr = symbol_text3 (name_sym); 1870 if (part_text_partial_flag 1871 && (aa_length (cmd_ln->process_only) > 0 1872 || aa_length (cmd_ln->process_only_dir) > 0)) 1873 { 1874 int file_ptr_positive1 = 0; 1875 int file_ptr_positive2 = 0; 1876 int file_is_in_process_only = 0; 1877 file_is_in_process_only = aa_length (cmd_ln->process_only) > 0 1878 && part_is_to_include (name_xstr); 1879 if (file_is_in_process_only) 1880 { 1881 cpp_open_text_file_for_read (val_xstring (name_xstr), 1882 cmd_ln->dirs); 1883 file_ptr_positive1 = (int) (p->current_text_heap->file_ptr); 1884 } 1885 if (!file_ptr_positive1) 1886 { 1887 if (file_is_in_process_only) 1888 { 1889 col_unbound_col (p->current_text_heap); 1890 } 1891 if (aa_length (cmd_ln->process_only_dir) > 0) 1892 { 1893 cpp_open_text_file_for_read (val_xstring (name_xstr), 1894 cmd_ln->process_only_dir); 1895 file_ptr_positive2 = (int) (p->current_text_heap->file_ptr); 1896 if (!file_ptr_positive2) 1897 { 1898 col_unbound_col (p->current_text_heap); 1899 } 1900 } 1901 if (!file_ptr_positive2 && !file_ptr_positive1) 1902 { 1903 unbound_col (name_xstr); 1904 goto recoverable_include_file_error; 1905 } 1906 } 1907 } 1908 else 1909 { 1910 cpp_open_text_file_for_read (val_xstring (name_xstr), cmd_ln->dirs); 1911 } 1912 if (p->current_text_heap->file_ptr) 1913 { 1914 unbound_col (name_xstr); 1915 parsing_state_data->directive_include_stage = 1916 DIRECTIVE_INCLUDE_STAGE_INCLUDE_FILE; 1917 parsing_state_data->scanner_state = preprocessorstate; 1918 stack_push (included_from_stack, sym); 1919 rewind_scanner (misc_parser, parsing_state_data->scanner_state, 0); 1920 push_false_token_list (p, PP_TOK_MARKER_BEGIN_FILE, 0, 0); 1921 cpp_default (); 1922 del_elm_xstring (parsing_state_data->state_set, 1923 SKIP_CONDITIONAL_TEXT); 1924 del_elm_xstring (parsing_state_data->state_set, 1925 COND_ALTERNATIVE_FOUND); 1926 del_elm_xstring (parsing_state_data->state_set, 1927 SKIP_CONDITIONAL_GROUP); 1928 del_elm_xstring (parsing_state_data->state_set, 1929 PART_IF_IS_RESOLVED); 1930 del_elm_xstring (parsing_state_data->state_set, PART_IF_IS_1); 1931 del_elm_xstring (parsing_state_data->state_set, 1932 PART_ELIF_IS_RESOLVED); 1933 del_elm_xstring (parsing_state_data->state_set, PART_ELIF_IS_1); 1934 del_elm_xstring (parsing_state_data->state_set, PART_ENDIF_NEEDED); 1935 } 1936 else 1937 { 1938 name_xstr = 1939 concat_xstring (concat_xstring 1940 (NEW_XSTRING_CONST ("#include file '"), 1941 name_xstr), NEW_XSTRING_CONST ("' not found")); 1942 cpp_error_text (parsing_state_data->sym, val_xstring (name_xstr)); 1943 unbound_col (name_xstr); 1944 col_unbound_col (p->current_text_heap); 1945 goto recoverable_include_file_error; 1946 } 1947 } 1948 else 1949 { 1950 if (parsing_state_data->directive_include_stage == 1951 DIRECTIVE_INCLUDE_STAGE_READ) 1952 { 1953 cpp_error_text (last_symbol_from_an_input_file (misc_parser), 1954 "parse error in #include the: line ends with EOF?"); 1955 exit (1);; 1956 } 1957 else if (parsing_state_data->directive_include_stage == 1958 DIRECTIVE_INCLUDE_STAGE_EXPAND) 1959 { 1960 cpp_error_text (last_symbol_from_an_input_file (misc_parser), 1961 "parse error in #include expansion"); 1962 exit (1);; 1963 } 1964 else if (parsing_state_data->directive_include_stage == 1965 DIRECTIVE_INCLUDE_STAGE_INTERPRET 1966 || parsing_state_data->directive_include_stage == 1967 DIRECTIVE_INCLUDE_STAGE_INTERPRET_ERROR) 1968 { 1969 cpp_error_text (parsing_state_data->sym, "parse error in #include"); 1970 recoverable_include_file_error: 1971 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 1972 { 1973 col_t *x; 1974 part_no_directive_ind = 0; 1975 x = part_symbol_text3 (part_last_directive_symbol); 1976 part_output_pipe (stdout, "%s", val_xstring (x)); 1977 part_current_indent = part_indent; 1978 unbound_col (x); 1979 part_output_pipe (stdout, "%s", 1980 val_xstring (part_pushed_expanded_text)); 1981 part_current_indent = 0; 1982 } 1983 parsing_state_data->directive_include_stage = 1984 DIRECTIVE_INCLUDE_STAGE_UNDEFINED; 1985 unbound_parsing_state_data (parsing_state_data); 1986 parsing_state_data = 1987 (parsing_state_data_t *) stack_pop (state_stack); 1988 rewind_after_symbol (include_text_to_eol_sym, 1989 parsing_state_data->scanner_state); 1990 goto end; 1991 } 1992 else 1993 { 1994 } 1995 } 1996 /*goto */ end: 1997 return;; 1998 } 1999 2000 /*after #line*/ 2001 //DOC_FUNC_DEF(finalize_line_directive DG_PARSE_OTHER_DIRECTIVES) 2002 void 2003 finalize_line_directive (pleaf_t sym) 2004 { 2005 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2006 parser_master_t *p = sym->text_heap_heap->ps01_parser; 2007 pleaf_t name_sym; 2008 if (!(sym->sub->id == NT_ERROR) && 2009 parsing_state_data->directive_line_stage != 2010 DIRECTIVE_LINE_STAGE_INTERPRET_ERROR) 2011 { 2012 long int new_line_nr; 2013 name_sym = find_pleaf_with_id (sym, PP_TOK_LINENUMBER); 2014 parsing_state_data->directive_line_stage = 2015 DIRECTIVE_LINE_STAGE_UNDEFINED; 2016 unbound_parsing_state_data (parsing_state_data); 2017 parsing_state_data = (parsing_state_data_t *) stack_pop (state_stack); 2018 rewind_after_symbol (include_text_to_eol_sym, 2019 parsing_state_data->scanner_state); 2020 { 2021 col_t *c = symbol_text3 (name_sym); 2022 new_line_nr = strtol (val_xstring (c), NULL, 10); 2023 ((cpp_file_att_t *) (p->current_text_heap->add_info))->line_offset = 2024 new_line_nr - 2025 line_number_end (last_symbol_from_an_input_file (misc_parser)); 2026 unbound_col (c); 2027 } 2028 name_sym = find_pleaf_with_id (sym, PP_TOK_STRING_LITERAL); 2029 if (name_sym) 2030 { 2031 col_t *c = symbol_text3 (name_sym); 2032 int i = 0; 2033 for (; DER (i + val_xstring (c)) != '\"'; i++); 2034 c = xstring_substring (c, i + 1, -2, XSTRING_REUSE); 2035 unbound_col (p->current_text_heap->file_name); 2036 p->current_text_heap->file_name = c; 2037 } 2038 } 2039 else 2040 { 2041 if (parsing_state_data->directive_line_stage == 2042 DIRECTIVE_LINE_STAGE_READ) 2043 { 2044 cpp_error_text (last_symbol_from_an_input_file (misc_parser), 2045 "parse error in #line: line ends with EOF?"); 2046 exit (1);; 2047 } 2048 else if (parsing_state_data->directive_line_stage == 2049 DIRECTIVE_LINE_STAGE_EXPAND) 2050 { 2051 cpp_error_text (last_symbol_from_an_input_file (misc_parser), 2052 "parse error in #line expansion"); 2053 exit (1);; 2054 } 2055 else if (parsing_state_data->directive_line_stage == 2056 DIRECTIVE_LINE_STAGE_INTERPRET 2057 || parsing_state_data->directive_line_stage == 2058 DIRECTIVE_LINE_STAGE_INTERPRET_ERROR) 2059 { 2060 cpp_error_text (parsing_state_data->sym, "parse error in #line"); 2061 parsing_state_data->directive_line_stage = 2062 DIRECTIVE_LINE_STAGE_UNDEFINED; 2063 unbound_parsing_state_data (parsing_state_data); 2064 parsing_state_data = 2065 (parsing_state_data_t *) stack_pop (state_stack); 2066 rewind_after_symbol (include_text_to_eol_sym, 2067 parsing_state_data->scanner_state); 2068 2069 } 2070 else 2071 { 2072 } 2073 } 2074 return;; 2075 } 2076 2077 /*after #error*/ 2078 //DOC_FUNC_DEF(finalize_error_directive DG_PARSE_OTHER_DIRECTIVES) 2079 void 2080 finalize_error_directive (pleaf_t sym) 2081 { 2082 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2083 col_t *text_xstr; 2084 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 2085 { 2086 col_t *x; 2087 x = part_symbol_text3 (part_last_directive_symbol); 2088 part_no_directive_ind = 0; 2089 part_current_indent = 0; 2090 part_output_pipe (stdout, "%s", val_xstring (x)); 2091 unbound_col (x); 2092 x = part_symbol_text3 (sym); 2093 part_output_pipe (stdout, "%s", val_xstring (x)); 2094 unbound_col (x); 2095 } 2096 if (!(sym->sub->id == NT_ERROR)) 2097 { 2098 text_xstr = symbol_text3 (sym); 2099 text_xstr = concat_xstring (NEW_XSTRING_CONST ("#error "), text_xstr); 2100 cpp_error_text (parsing_state_data->sym, val_xstring (text_xstr)); 2101 unbound_col (text_xstr); 2102 } 2103 else 2104 { 2105 cpp_error_text (parsing_state_data->sym, 2106 "parse error in #error:no EOL?"); 2107 } 2108 unbound_parsing_state_data (parsing_state_data); 2109 parsing_state_data = (parsing_state_data_t *) stack_pop (state_stack); 2110 change_flex_state (misc_parser, parsing_state_data->scanner_state); 2111 return;; 2112 } 2113 2114 /*after #endif*/ 2115 //DOC_FUNC_DEF(finalize_endif DG_PARSE_CONDITIONALS) 2116 void 2117 finalize_endif (pleaf_t sym) 2118 { 2119 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2120 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 2121 { 2122 if (is_elm_xstring (parsing_state_data->state_set, PART_ENDIF_NEEDED)) 2123 { 2124 col_t *x; 2125 part_no_directive_ind = 0; 2126 part_current_indent = 0; 2127 x = part_symbol_text3 (part_last_directive_symbol); 2128 part_output_pipe (stdout, "%s", val_xstring (x)); 2129 unbound_col (x); 2130 x = part_symbol_text3 (sym); 2131 part_output_pipe (stdout, "%s", val_xstring (x)); 2132 col_unbound_col (x); 2133 } 2134 } 2135 unbound_parsing_state_data (parsing_state_data); 2136 parsing_state_data = (parsing_state_data_t *) stack_pop (state_stack); 2137 change_flex_state (misc_parser, parsing_state_data->scanner_state); 2138 if (sym->sub->id == NT_ERROR) 2139 { 2140 cpp_error_text (last_symbol_from_an_input_file (misc_parser), 2141 "warning:parse error in #endif"); 2142 } 2143 return;; 2144 } 2145 2146 /*before #endif*/ 2147 //DOC_FUNC_DEF(prepare_endif DG_PARSE_CONDITIONALS) 2148 void 2149 prepare_endif (pleaf_t sym) 2150 { 2151 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2152 cpp_branch_sort = sym->id; 2153 part_last_directive_symbol = sym; 2154 change_flex_state (misc_parser, defdirectivescanstate); 2155 return;; 2156 } 2157 2158 /*after #ifndef*/ 2159 //DOC_FUNC_DEF(finalize_if_ndef_directive DG_PARSE_CONDITIONALS) 2160 void 2161 finalize_if_ndef_directive (pleaf_t sym) 2162 { 2163 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2164 unknown_identifier_flag = 0; 2165 parsing_state_data->expression_value = 2166 (long int) !defined_name (sym->sub->next); 2167 DER (cpp2fncs->calculate_conditional_state_after_if) (); 2168 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 2169 { 2170 col_t *x = part_symbol_text3 (sym); 2171 part_print_after_if (part_last_directive_symbol, x); 2172 col_unbound_col (x); 2173 } 2174 parsing_state_data->scanner_state = calculate_preprocessor_state (); 2175 change_flex_state (misc_parser, parsing_state_data->scanner_state); 2176 return;; 2177 } 2178 2179 /*after #ifdef*/ 2180 //DOC_FUNC_DEF(finalize_if_def_directive DG_PARSE_CONDITIONALS) 2181 void 2182 finalize_if_def_directive (pleaf_t sym) 2183 { 2184 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2185 unknown_identifier_flag = 0; 2186 parsing_state_data->expression_value = 2187 (long int) defined_name (sym->sub->next); 2188 DER (cpp2fncs->calculate_conditional_state_after_if) (); 2189 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 2190 { 2191 col_t *x = part_symbol_text3 (sym); 2192 part_print_after_if (part_last_directive_symbol, x); 2193 col_unbound_col (x); 2194 } 2195 parsing_state_data->scanner_state = calculate_preprocessor_state (); 2196 change_flex_state (misc_parser, parsing_state_data->scanner_state); 2197 return;; 2198 } 2199 2200 /*after #else*/ 2201 //DOC_FUNC_DEF(finalize_else_directive DG_PARSE_CONDITIONALS) 2202 void 2203 finalize_else_directive (pleaf_t sym) 2204 { 2205 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2206 int s; 2207 s = is_elm_xstring (parsing_state_data->state_set, COND_ALTERNATIVE_FOUND); 2208 parsing_state_data->expression_value = 1; 2209 unknown_identifier_flag = 0; 2210 DER (cpp2fncs->calculate_conditional_state_after_elif) (); 2211 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 2212 { 2213 if (!s 2214 && !is_elm_xstring (parsing_state_data->state_set, 2215 SKIP_CONDITIONAL_TEXT) 2216 && is_elm_xstring (parsing_state_data->state_set, 2217 PART_ENDIF_NEEDED)) 2218 { 2219 col_t *x; 2220 part_no_directive_ind = 0; 2221 part_current_indent = 0; 2222 x = part_symbol_text3 (part_last_directive_symbol); 2223 part_output_pipe (stdout, "%s", val_xstring (x)); 2224 unbound_col (x); 2225 x = part_symbol_text3 (sym); 2226 part_output_pipe (stdout, "%s", val_xstring (x)); 2227 col_unbound_col (x); 2228 } 2229 } 2230 parsing_state_data->scanner_state = calculate_preprocessor_state (); 2231 change_flex_state (misc_parser, parsing_state_data->scanner_state); 2232 if (sym->sub->id == NT_ERROR) 2233 { 2234 cpp_error_text (last_symbol_from_an_input_file (misc_parser), 2235 "warning:parse error in #else"); 2236 } 2237 return;; 2238 } 2239 2240 /*before #ifndef*/ 2241 //DOC_FUNC_DEF(prepare_if_ndef_directive DG_PARSE_CONDITIONALS) 2242 void 2243 prepare_if_ndef_directive (pleaf_t sym) 2244 { 2245 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2246 cpp_branch_sort = sym->id; 2247 part_last_directive_symbol = sym; 2248 stack_push (state_stack, parsing_state_data); 2249 parsing_state_data = new_parsing_state_data (parsing_state_data); 2250 parsing_state_data->sym = sym; 2251 parsing_state_data->scanner_state = macroexpansionstate; 2252 change_flex_state (misc_parser, macroexpansionstate); 2253 if (!is_elm_xstring (parsing_state_data->state_set, SKIP_CONDITIONAL_TEXT)) 2254 { 2255 del_elm_xstring (parsing_state_data->state_set, COND_ALTERNATIVE_FOUND); 2256 } 2257 return;; 2258 } 2259 2260 /*before #ifdef*/ 2261 //DOC_FUNC_DEF(prepare_if_def_directive DG_PARSE_CONDITIONALS) 2262 void 2263 prepare_if_def_directive (pleaf_t sym) 2264 { 2265 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2266 cpp_branch_sort = sym->id; 2267 part_last_directive_symbol = sym; 2268 stack_push (state_stack, parsing_state_data); 2269 parsing_state_data = new_parsing_state_data (parsing_state_data); 2270 parsing_state_data->sym = sym; 2271 parsing_state_data->scanner_state = macroexpansionstate; 2272 change_flex_state (misc_parser, macroexpansionstate); 2273 if (!is_elm_xstring (parsing_state_data->state_set, SKIP_CONDITIONAL_TEXT)) 2274 { 2275 del_elm_xstring (parsing_state_data->state_set, COND_ALTERNATIVE_FOUND); 2276 } 2277 return;; 2278 } 2279 2280 /*before #else*/ 2281 //DOC_FUNC_DEF(prepare_else_directive DG_PARSE_CONDITIONALS) 2282 void 2283 prepare_else_directive (pleaf_t sym) 2284 { 2285 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2286 cpp_branch_sort = sym->id; 2287 part_last_directive_symbol = sym; 2288 parsing_state_data->sym = sym; 2289 parsing_state_data->scanner_state = macroexpansionstate; 2290 change_flex_state (misc_parser, macroexpansionstate); 2291 return;; 2292 } 2293 2294 /*before #elif*/ 2295 //DOC_FUNC_DEF(prepare_elif_directive DG_PARSE_CONDITIONALS) 2296 void 2297 prepare_elif_directive (pleaf_t sym) 2298 { 2299 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2300 cpp_branch_sort = sym->id; 2301 parsing_state_data->sym = sym; 2302 part_last_directive_symbol = sym; 2303 change_flex_state (misc_parser, texttoendoflinestate); 2304 parsing_state_data->directive_expression_stage = 2305 DIRECTIVE_EXPRESSION_STAGE_READ; 2306 del_elm_xstring (parsing_state_data->state_set, LAST_EXPRESSION_IF); 2307 return;; 2308 } 2309 2310 /*before #if*/ 2311 //DOC_FUNC_DEF(prepare_if_directive DG_PARSE_CONDITIONALS) 2312 void 2313 prepare_if_directive (pleaf_t sym) 2314 { 2315 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2316 cpp_branch_sort = sym->id; 2317 stack_push (state_stack, parsing_state_data); 2318 parsing_state_data = new_parsing_state_data (parsing_state_data); 2319 parsing_state_data->sym = sym; 2320 part_last_directive_symbol = sym; 2321 change_flex_state (misc_parser, texttoendoflinestate); 2322 parsing_state_data->directive_expression_stage = 2323 DIRECTIVE_EXPRESSION_STAGE_READ; 2324 if (!is_elm_xstring (parsing_state_data->state_set, SKIP_CONDITIONAL_TEXT)) 2325 { 2326 del_elm_xstring (parsing_state_data->state_set, COND_ALTERNATIVE_FOUND); 2327 } 2328 add_elm_xstring (parsing_state_data->state_set, LAST_EXPRESSION_IF); 2329 return;; 2330 } 2331 2332 /*after #if*/ 2333 //DOC_FUNC_DEF(finalize_if_directive DG_PARSE_CONDITIONALS) 2334 void 2335 finalize_if_directive (pleaf_t sym) 2336 { 2337 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2338 if (!(sym->sub->id == NT_ERROR) && 2339 parsing_state_data->directive_expression_stage != 2340 DIRECTIVE_EXPRESSION_STAGE_INTERPRET_ERROR) 2341 { 2342 if (is_elm_xstring (parsing_state_data->state_set, LAST_EXPRESSION_IF)) 2343 { 2344 DER (cpp2fncs->calculate_conditional_state_after_if) (); 2345 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 2346 { 2347 part_print_after_if (part_last_directive_symbol, 2348 part_pushed_expanded_text); 2349 } 2350 } 2351 else 2352 { 2353 DER (cpp2fncs->calculate_conditional_state_after_elif) (); 2354 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 2355 { 2356 part_print_after_elif (part_last_directive_symbol, 2357 part_pushed_expanded_text); 2358 } 2359 } 2360 parsing_state_data->scanner_state = calculate_preprocessor_state (); 2361 rewind_after_symbol (sym->sub, parsing_state_data->scanner_state); 2362 } 2363 else 2364 if (parsing_state_data->directive_expression_stage == 2365 DIRECTIVE_EXPRESSION_STAGE_READ) 2366 { 2367 cpp_error_text (last_symbol_from_an_input_file (misc_parser), 2368 "parse error in #if/elif: line ends with EOF?"); 2369 exit (1);; 2370 } 2371 else if (parsing_state_data->directive_expression_stage == 2372 DIRECTIVE_EXPRESSION_STAGE_EXPAND) 2373 { 2374 cpp_error_text (last_symbol_from_an_input_file (misc_parser), 2375 "parse error in #if/elif expansion"); 2376 exit (1);; 2377 } 2378 else if (parsing_state_data->directive_expression_stage == 2379 DIRECTIVE_EXPRESSION_STAGE_INTERPRET 2380 || parsing_state_data->directive_expression_stage == 2381 DIRECTIVE_EXPRESSION_STAGE_INTERPRET_ERROR) 2382 { 2383 parsing_state_data->expression_value = 0; 2384 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 2385 { 2386 } 2387 else 2388 cpp_error_text (parsing_state_data->sym, "parse error in #if/elif"); 2389 if (is_elm_xstring (parsing_state_data->state_set, LAST_EXPRESSION_IF)) 2390 { 2391 DER (cpp2fncs->calculate_conditional_state_after_if) (); 2392 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 2393 { 2394 part_print_after_if (part_last_directive_symbol, 2395 part_pushed_expanded_text); 2396 } 2397 } 2398 else 2399 { 2400 DER (cpp2fncs->calculate_conditional_state_after_elif) (); 2401 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 2402 { 2403 part_print_after_elif (part_last_directive_symbol, 2404 part_pushed_expanded_text); 2405 } 2406 } 2407 parsing_state_data->scanner_state = calculate_preprocessor_state (); 2408 rewind_after_symbol (include_text_to_eol_sym, 2409 parsing_state_data->scanner_state); 2410 } 2411 parsing_state_data->directive_expression_stage = 2412 DIRECTIVE_EXPRESSION_STAGE_UNDEFINED; 2413 return;; 2414 } 2415 2416 /*after #if expression*/ 2417 //DOC_FUNC_DEF(finalize_constant_expression DG_PARSE_CONDITIONALS) 2418 void 2419 finalize_constant_expression (pleaf_t sym) 2420 { 2421 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2422 long int expression_result; 2423 if (!(sym->sub->id == NT_ERROR)) 2424 { 2425 unknown_identifier_flag = 0; 2426 parsing_state_data->expression_value = expression_result = 2427 evaluate_expression (sym); 2428 } 2429 else 2430 { 2431 unknown_identifier_flag = 1; 2432 parsing_state_data->expression_value = 0; 2433 parsing_state_data->directive_expression_stage = 2434 DIRECTIVE_EXPRESSION_STAGE_INTERPRET_ERROR; 2435 } 2436 return;; 2437 } 2438 2439 /*evaluate conditional expression*/ 2440 //DOC_FUNC_DEF(evaluate_expression DG_PARSE_CONDITIONALS) 2441 long int 2442 evaluate_expression (pleaf_t sym) 2443 { 2444 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2445 long int result = 0; 2446 if (CONSTANT_EXPRESSION == sym->id) 2447 { 2448 result = evaluate_expression (sym->sub); 2449 } 2450 else if (CONSTANT_EXPRESSION_SEQUENCE == sym->id) 2451 { 2452 if (CONDITIONAL_EXPRESSION == sym->sub->id) 2453 { 2454 result = evaluate_expression (sym->sub); 2455 } 2456 else 2457 { 2458 result = evaluate_expression (sym->sub->next->next); 2459 } 2460 } 2461 else if (CONDITIONAL_EXPRESSION == sym->id) 2462 { 2463 if (NULL == sym->sub->next) 2464 { 2465 result = evaluate_expression (sym->sub); 2466 } 2467 else 2468 { 2469 result = 2470 evaluate_expression (sym->sub) ? evaluate_expression (sym->sub-> 2471 next-> 2472 next) : 2473 evaluate_expression (sym->sub->next->next->next->next); 2474 } 2475 } 2476 else if (LOGICAL_OR_EXPRESSION == sym->id) 2477 { 2478 if (LOGICAL_AND_EXPRESSION == sym->sub->id) 2479 { 2480 result = evaluate_expression (sym->sub); 2481 } 2482 else 2483 { 2484 result = evaluate_expression (sym->sub) 2485 || evaluate_expression (sym->sub->next->next); 2486 } 2487 } 2488 else if (LOGICAL_AND_EXPRESSION == sym->id) 2489 { 2490 if (INCLUSIVE_OR_EXPRESSION == sym->sub->id) 2491 { 2492 result = evaluate_expression (sym->sub); 2493 } 2494 else 2495 { 2496 result = evaluate_expression (sym->sub) 2497 && evaluate_expression (sym->sub->next->next); 2498 } 2499 } 2500 else if (INCLUSIVE_OR_EXPRESSION == sym->id) 2501 { 2502 if (EXCLUSIVE_OR_EXPRESSION == sym->sub->id) 2503 { 2504 result = evaluate_expression (sym->sub); 2505 } 2506 else 2507 { 2508 result = 2509 evaluate_expression (sym->sub) | evaluate_expression (sym->sub-> 2510 next->next); 2511 } 2512 } 2513 else if (EXCLUSIVE_OR_EXPRESSION == sym->id) 2514 { 2515 if (AND_EXPRESSION == sym->sub->id) 2516 { 2517 result = evaluate_expression (sym->sub); 2518 } 2519 else 2520 { 2521 result = 2522 evaluate_expression (sym->sub) ^ evaluate_expression (sym->sub-> 2523 next->next); 2524 } 2525 } 2526 else if (AND_EXPRESSION == sym->id) 2527 { 2528 if (EQUALITY_EXPRESSION == sym->sub->id) 2529 { 2530 result = evaluate_expression (sym->sub); 2531 } 2532 else 2533 { 2534 result = 2535 evaluate_expression (sym->sub) & evaluate_expression (sym->sub-> 2536 next->next); 2537 } 2538 } 2539 else if (EQUALITY_EXPRESSION == sym->id) 2540 { 2541 if (RELATIONAL_EXPRESSION == sym->sub->id) 2542 { 2543 result = evaluate_expression (sym->sub); 2544 } 2545 else 2546 { 2547 if (TOK_EQEQ == sym->sub->next->sub->id) 2548 { 2549 result = 2550 evaluate_expression (sym->sub) == 2551 evaluate_expression (sym->sub->next->next); 2552 } 2553 else 2554 { 2555 result = 2556 evaluate_expression (sym->sub) != 2557 evaluate_expression (sym->sub->next->next); 2558 } 2559 } 2560 } 2561 else if (RELATIONAL_EXPRESSION == sym->id) 2562 { 2563 if (SHIFT_EXPRESSION == sym->sub->id) 2564 { 2565 result = evaluate_expression (sym->sub); 2566 } 2567 else 2568 { 2569 if (TOK_LT == sym->sub->next->sub->id) 2570 { 2571 result = 2572 evaluate_expression (sym->sub) < 2573 evaluate_expression (sym->sub->next->next); 2574 } 2575 else if (TOK_GT == sym->sub->next->sub->id) 2576 { 2577 result = 2578 evaluate_expression (sym->sub) > 2579 evaluate_expression (sym->sub->next->next); 2580 } 2581 else if (TOK_LTEQ == sym->sub->next->sub->id) 2582 { 2583 result = 2584 evaluate_expression (sym->sub) <= 2585 evaluate_expression (sym->sub->next->next); 2586 } 2587 else 2588 { 2589 result = 2590 evaluate_expression (sym->sub) >= 2591 evaluate_expression (sym->sub->next->next); 2592 } 2593 } 2594 } 2595 else if (SHIFT_EXPRESSION == sym->id) 2596 { 2597 if (ADDITIVE_EXPRESSION == sym->sub->id) 2598 { 2599 result = evaluate_expression (sym->sub); 2600 } 2601 else 2602 { 2603 if (TOK_LTLT == sym->sub->next->sub->id) 2604 { 2605 result = 2606 evaluate_expression (sym->sub) << evaluate_expression (sym-> 2607 sub-> 2608 next-> 2609 next); 2610 } 2611 else 2612 { 2613 result = 2614 evaluate_expression (sym->sub) >> evaluate_expression (sym-> 2615 sub-> 2616 next-> 2617 next); 2618 } 2619 } 2620 } 2621 else if (ADDITIVE_EXPRESSION == sym->id) 2622 { 2623 if (MULTIPLICATIVE_EXPRESSION == sym->sub->id) 2624 { 2625 result = evaluate_expression (sym->sub); 2626 } 2627 else 2628 { 2629 if (TOK_PL == sym->sub->next->sub->id) 2630 { 2631 result = 2632 evaluate_expression (sym->sub) + 2633 evaluate_expression (sym->sub->next->next); 2634 } 2635 else 2636 { 2637 result = 2638 evaluate_expression (sym->sub) - 2639 evaluate_expression (sym->sub->next->next); 2640 } 2641 2642 } 2643 } 2644 else if (MULTIPLICATIVE_EXPRESSION == sym->id) 2645 { 2646 if (UNARY_EXPRESSION == sym->sub->id) 2647 { 2648 result = evaluate_expression (sym->sub); 2649 } 2650 else 2651 { 2652 if (TOK_ST == sym->sub->next->sub->id) 2653 { 2654 result = 2655 evaluate_expression (sym->sub) * 2656 evaluate_expression (sym->sub->next->next); 2657 } 2658 else if (TOK_DI == sym->sub->next->sub->id) 2659 { 2660 int divisor = evaluate_expression (sym->sub->next->next); 2661 if (divisor) 2662 { 2663 result = evaluate_expression (sym->sub) / divisor; 2664 } 2665 else 2666 { 2667 cpp_error_text (last_symbol_from_an_input_file 2668 (misc_parser), "devide by zero"); 2669 result = 0; 2670 } 2671 } 2672 else 2673 { 2674 int divisor = evaluate_expression (sym->sub->next->next); 2675 if (divisor) 2676 { 2677 result = evaluate_expression (sym->sub) % divisor; 2678 } 2679 else 2680 { 2681 cpp_error_text (last_symbol_from_an_input_file 2682 (misc_parser), "devide by zero"); 2683 result = 0; 2684 } 2685 } 2686 } 2687 } 2688 else if (UNARY_EXPRESSION == sym->id) 2689 { 2690 if (NUMERIC_CONSTANT_INTEGER == sym->sub->id) 2691 { 2692 result = evaluate_expression (sym->sub); 2693 } 2694 else if (PP_CHARACTER_CONSTANT == sym->sub->id) 2695 { 2696 result = evaluate_expression (sym->sub); 2697 } 2698 else if (PP_NAME == sym->sub->id) 2699 { 2700 result = evaluate_expression (sym->sub); 2701 } 2702 else if (UNARY_OPERATOR == sym->sub->id) 2703 { 2704 if (TOK_PL == sym->sub->sub->id) 2705 { 2706 result = evaluate_expression (sym->sub->next); 2707 } 2708 else if (TOK_MN == sym->sub->sub->id) 2709 { 2710 result = -evaluate_expression (sym->sub->next); 2711 } 2712 else if (TOK_TL == sym->sub->sub->id) 2713 { 2714 result = ~evaluate_expression (sym->sub->next); 2715 } 2716 else 2717 { 2718 result = !evaluate_expression (sym->sub->next); 2719 } 2720 } 2721 else if (DEFINED_EXPRESSION == sym->sub->id) 2722 { 2723 result = evaluate_expression (sym->sub); 2724 } 2725 else if (TOK_OP == sym->sub->id) 2726 { 2727 result = evaluate_expression (sym->sub->next); 2728 } 2729 } 2730 else if (NUMERIC_CONSTANT_INTEGER == sym->id) 2731 { 2732 result = parse_number (sym); 2733 } 2734 else if (PP_CHARACTER_CONSTANT == sym->id) 2735 { 2736 result = parse_character (sym); 2737 } 2738 else if (PP_NAME == sym->id) 2739 { 2740 result = parse_name (sym); 2741 } 2742 else if (DEFINED_EXPRESSION == sym->id) 2743 { 2744 if (TOK_OP == sym->sub->next->sub->id) 2745 { 2746 result = (long int) defined_name (sym->sub->next->sub->next); 2747 } 2748 else 2749 { 2750 result = (long int) defined_name (sym->sub->next->sub); 2751 } 2752 } 2753 return result;; 2754 } 2755 2756 /*check if symbol is defined as macro*/ 2757 //DOC_FUNC_DEF(defined_name DG_PARSE_CONDITIONALS) 2758 symbol_table_prop_t * 2759 defined_name (pleaf_t sym) 2760 { 2761 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2762 symbol_table_prop_t *result = NULL; 2763 col_t *c = symbol_text3 (sym); 2764 char *v = val_xstring (c); 2765 symbol_table_prop_t *found; 2766 RBT_FIND_KEY_STR (symbol_table_prop, symbol_table_prop_t, sym, v, found); 2767 result = found; 2768 if (!found) 2769 unknown_identifier_flag = 1; 2770 unbound_xstring (c); 2771 return result;; 2772 } 2773 2774 /*value of unknown identifier in an expression*/ 2775 //DOC_FUNC_DEF(parse_name DG_PARSE_CONDITIONALS) 2776 long int 2777 parse_name (pleaf_t sym) 2778 { 2779 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2780 long int result = 0; 2781 unknown_identifier_flag = 1; 2782 return result;; 2783 } 2784 2785 /*calculate value of number*/ 2786 //DOC_FUNC_DEF(parse_number DG_PARSE_CONDITIONALS) 2787 long int 2788 parse_number (pleaf_t sym) 2789 { 2790 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2791 long int result; 2792 col_t *c = symbol_text3 (sym); 2793 char *v = val_xstring (c); 2794 //KR_NUMBER_UL; 2795 result = strtol (v, NULL, 0); 2796 unbound_xstring (c); 2797 return result;; 2798 } 2799 2800 /*calculate value of a character*/ 2801 //DOC_FUNC_DEF(parse_character DG_PARSE_CONDITIONALS) 2802 long int 2803 parse_character (pleaf_t sym) 2804 { 2805 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2806 long int result; 2807 col_t *c = symbol_text3 (sym); 2808 char *v = val_xstring (c); 2809 //KR_CHARCONST_L; 2810 while (*v != '\'') 2811 v++; 2812 result = (long int) decrypt_character (++v); 2813 unbound_xstring (c); 2814 return result;; 2815 } 2816 2817 /*calculate value of escape character*/ 2818 //DOC_FUNC_DEF(decrypt_character DG_PARSE_CONDITIONALS) 2819 char 2820 decrypt_character (char *escaped) 2821 { 2822 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2823 char result = 0; 2824 char *end_number; 2825 //KR_UNKNOWN_ESCAPES; 2826 //KR_SEQUENCE_MAY_BE_LONGER; 2827 if (*escaped == '\\') 2828 { 2829 if (*(escaped + 1) == 'a') 2830 { 2831 result = '\a'; 2832 } 2833 else if (*(escaped + 1) == 'b') 2834 { 2835 result = '\b'; 2836 } 2837 else if (*(escaped + 1) == 'f') 2838 { 2839 result = '\f'; 2840 } 2841 else if (*(escaped + 1) == 'n') 2842 { 2843 result = '\n'; 2844 } 2845 else if (*(escaped + 1) == 'r') 2846 { 2847 result = '\r'; 2848 } 2849 else if (*(escaped + 1) == 't') 2850 { 2851 result = '\t'; 2852 } 2853 else if (*(escaped + 1) == 'v') 2854 { 2855 result = '\v'; 2856 } 2857 else if (*(escaped + 1) == '\\') 2858 { 2859 result = '\\'; 2860 } 2861 else if (*(escaped + 1) == '\?') 2862 { 2863 result = '\?'; 2864 } 2865 else if (*(escaped + 1) == '\'') 2866 { 2867 result = '\''; 2868 } 2869 else if (*(escaped + 1) == '\"') 2870 { 2871 result = '\"'; 2872 } 2873 else if (*(escaped + 1) <= '7' && *(escaped + 1) >= '0') 2874 { 2875 result = (char) strtol (escaped + 1, NULL, 8); 2876 } 2877 else if (*(escaped + 1) == 'x') 2878 { 2879 result = (char) strtol (escaped + 2, &end_number, 16); 2880 if (end_number == escaped + 2) 2881 { 2882 char err_text[255]; 2883 sprintf (err_text, "\'%s\' %s", escaped, 2884 "unknown escape sequence: not a hex number"); 2885 cpp_error_text (last_symbol_from_an_input_file (misc_parser), 2886 err_text); 2887 } 2888 } 2889 else 2890 { 2891 char err_text[255]; 2892 sprintf (err_text, "\'%s\' %s", escaped, "unknown escape sequence"); 2893 cpp_error_text (last_symbol_from_an_input_file (misc_parser), 2894 err_text); 2895 } 2896 } 2897 else 2898 result = *escaped; 2899 return result;; 2900 } 2901 2902 /*after reading a line*/ 2903 //DOC_FUNC_DEF(finalize_text_to_end_of_line DG_PARSE_COMMON) 2904 void 2905 finalize_text_to_end_of_line (pleaf_t sym) 2906 { 2907 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2908 parser_master_t *p = sym->text_heap_heap->ps01_parser; 2909 if (DIRECTIVE_EXPRESSION_STAGE_READ == 2910 parsing_state_data->directive_expression_stage) 2911 { 2912 parsing_state_data->directive_expression_stage = 2913 DIRECTIVE_EXPRESSION_STAGE_EXPAND; 2914 include_text_to_eol_sym = sym; 2915 if (is_elm_xstring 2916 (parsing_state_data->state_set, COND_ALTERNATIVE_FOUND) 2917 || is_elm_xstring (parsing_state_data->state_set, 2918 SKIP_CONDITIONAL_GROUP) 2919 || 2920 (is_elm_xstring 2921 (parsing_state_data->state_set, SKIP_CONDITIONAL_TEXT) 2922 && is_elm_xstring (parsing_state_data->state_set, 2923 LAST_EXPRESSION_IF))) 2924 { 2925 cpp_flex_create_new_read_xstring (NEW_XSTRING_CONST (" 0 "), 2926 ifelifexpansionstate); 2927 } 2928 else 2929 { 2930 cpp_flex_create_new_read_xstring (symbol_text3 (sym), 2931 ifelifexpansionstate); 2932 } 2933 parsing_state_data->scanner_state = ifelifexpansionstate; 2934 flex_pushstring2null (p); 2935 } 2936 else if (DIRECTIVE_INCLUDE_STAGE_READ == 2937 parsing_state_data->directive_include_stage) 2938 { 2939 parsing_state_data->directive_include_stage = 2940 DIRECTIVE_INCLUDE_STAGE_EXPAND; 2941 include_text_to_eol_sym = sym; 2942 parsing_state_data->scanner_state = defdirectivescanstate; 2943 cpp_flex_create_new_read_xstring (symbol_text3 (sym), 2944 defdirectivescanstate); 2945 flex_pushstring2null (p); 2946 } 2947 else if (DIRECTIVE_LINE_STAGE_READ == 2948 parsing_state_data->directive_line_stage) 2949 { 2950 parsing_state_data->directive_line_stage = DIRECTIVE_LINE_STAGE_EXPAND; 2951 include_text_to_eol_sym = sym; 2952 parsing_state_data->scanner_state = defdirectivescanstate; 2953 cpp_flex_create_new_read_xstring (symbol_text3 (sym), 2954 defdirectivescanstate); 2955 flex_pushstring2null (p); 2956 } 2957 else 2958 { 2959 include_text_to_eol_sym = sym; 2960 } 2961 return;; 2962 } 2963 2964 /*return resulting text as xstring*/ 2965 //DOC_FUNC_DEF(collect_expanded_text_result DG_EXPAND_TEXT) 2966 col_t * 2967 collect_expanded_text_result (pleaf_t sym) 2968 { 2969 int dummy_for_begin_function = (dummy_for_begin_function = 0); 2970 col_t *t = NEW_XSTRING_CONST (""); 2971 lisp_cons_cell_t *input = (show_rec (sym), dt_mem2 (sym)); 2972 /*until the end of the list */ 2973 int first_is_the_list = input && input->car && input->car->type == LISTP; 2974 int list_sort; 2975 lisp_cons_cell_t *current = input; 2976 col_t *stack = stack_create (); 2977 col_t *list_sort_stack = stack_create (); 2978 int list_sort_old; 2979 list_sort = 0; 2980 list_sort_old = 0; 2981 while (1) 2982 { 2983 if (!current) 2984 { 2985 int s_n = 0; 2986 if (!(s_n = stack_size (stack))) 2987 { 2988 break; 2989 } 2990 list_sort_old = list_sort; 2991 { 2992 col_t *i = stack_pop (list_sort_stack); 2993 list_sort = DER (val_int (i)); 2994 col_unbound_col (i); 2995 } 2996 current = (lisp_cons_cell_t *) stack_pop (stack); 2997 if (s_n == 1 && first_is_the_list) 2998 { 2999 break; 3000 } 3001 continue; 3002 } 3003 if (current->car && current->car->type == LISTP) 3004 { 3005 stack_push (stack, current->cdr); 3006 current = current->car->val; 3007 { 3008 col_t *i = new_int (list_sort); 3009 stack_push (list_sort_stack, i); 3010 } 3011 continue; 3012 } 3013 if (current->car && current->car->type == PLEAFP) 3014 { 3015 pleaf_t sym = (pleaf_t) (current->car->val); 3016 if (sym->id == PP_MACRO_EXPANSION) 3017 { 3018 if (parsing_state_data->directive_collect_stage == 3019 DIRECTIVE_COLLECT_STAGE_DURING_PARSE) 3020 { 3021 list_sort = PP_MACRO_EXPANSION; 3022 current = current->cdr; 3023 continue; 3024 } 3025 } 3026 if (sym->id == PP_MACRO_INVOKATION) 3027 { 3028 current = NULL; 3029 continue; 3030 } 3031 if (sym->id == PP_TEXT_EXPANSION) 3032 { 3033 if (parsing_state_data->directive_collect_stage == 3034 DIRECTIVE_COLLECT_STAGE_DURING_PARSE) 3035 { 3036 list_sort = PP_TEXT_EXPANSION; 3037 current = current->cdr; 3038 continue; 3039 } 3040 } 3041 if (sym->id == PP_NO_DIRECTIVE) 3042 { 3043 if (parsing_state_data->directive_collect_stage == 3044 DIRECTIVE_COLLECT_STAGE_RESULT) 3045 { 3046 list_sort = PP_NO_DIRECTIVE; 3047 current = current->cdr; 3048 continue; 3049 } 3050 } 3051 if (PP_TEXT_EXPANSION == list_sort || PP_NO_DIRECTIVE == list_sort) 3052 { 3053 if (PP_NAME == sym->id || PP_NON_ACTIVE == sym->id || 3054 PP_DEFINE_DIRECTIVE_OPERATOR == sym->id || 3055 PP_MACRO_EXPANSION_OPERATOR == sym->id || 3056 PP_END_OF_LINE_VERSION == sym->id || 3057 PP_DEFINED_EXPANSION == sym->id) 3058 { 3059 t = concat_xstring (t, symbol_text3 (sym)); 3060 current = current->cdr; 3061 continue; 3062 } 3063 if (PP_HORIZONTAL_WHITESPACE == sym->id) 3064 { 3065 t = concat_xstring (t, NEW_XSTRING_CONST (" ")); 3066 current = current->cdr; 3067 continue; 3068 } 3069 if (PP_END_OF_LINE == sym->id) 3070 { 3071 if (parsing_state_data->directive_collect_stage == 3072 DIRECTIVE_COLLECT_STAGE_RESULT) 3073 { 3074 t = concat_xstring (t, NEW_XSTRING_CONST ("\n")); 3075 current = current->cdr; 3076 continue; 3077 } 3078 } 3079 } 3080 /*otherwise */ 3081 current = current->cdr; 3082 continue; 3083 } 3084 } 3085 dt_mem_unbound (input); 3086 stack_unbound (list_sort_stack); 3087 stack_unbound (stack); 3088 return t;; 3089 } 3090 3091 /*after text expansion*/ 3092 //DOC_FUNC_DEF(finalize_pp_text_expansion_result DG_EXPAND_TEXT) 3093 void 3094 finalize_pp_text_expansion_result (pleaf_t sym) 3095 { 3096 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3097 parser_master_t *p = sym->text_heap_heap->ps01_parser; 3098 col_t *expanded_text; 3099 unbound_parsing_state_data (parsing_state_data); 3100 parsing_state_data = (parsing_state_data_t *) stack_pop (state_stack); 3101 change_flex_state (misc_parser, parsing_state_data->scanner_state); 3102 show (sym); 3103 list (sym); 3104 if (parsing_state_data->directive_expression_stage == 3105 DIRECTIVE_EXPRESSION_STAGE_EXPAND) 3106 { 3107 if (!is_elm_xstring 3108 (parsing_state_data->state_set, COND_ALTERNATIVE_FOUND) 3109 && !is_elm_xstring (parsing_state_data->state_set, 3110 SKIP_CONDITIONAL_GROUP)) 3111 { 3112 expanded_text = DER (cpp2fncs->collect_expanded_text_result) (sym); 3113 } 3114 else 3115 { 3116 expanded_text = NEW_XSTRING_CONST (" 0 "); 3117 } 3118 cpp_flex_create_new_read_xstring (expanded_text, expressionstate); 3119 flex_pushstring2null (p); 3120 parsing_state_data->directive_expression_stage = 3121 DIRECTIVE_EXPRESSION_STAGE_INTERPRET; 3122 } 3123 else if (parsing_state_data->directive_include_stage == 3124 DIRECTIVE_INCLUDE_STAGE_EXPAND) 3125 { 3126 expanded_text = DER (cpp2fncs->collect_expanded_text_result) (sym); 3127 cpp_flex_create_new_read_xstring (expanded_text, includefilestate); 3128 flex_pushstring2null (p); 3129 parsing_state_data->directive_include_stage = 3130 DIRECTIVE_INCLUDE_STAGE_INTERPRET; 3131 } 3132 else if (parsing_state_data->directive_line_stage == 3133 DIRECTIVE_LINE_STAGE_EXPAND) 3134 { 3135 expanded_text = DER (cpp2fncs->collect_expanded_text_result) (sym); 3136 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 3137 { 3138 col_t *x; 3139 part_no_directive_ind = 0; 3140 x = part_symbol_text3 (part_last_directive_symbol); 3141 part_output_pipe (stdout, "%s", val_xstring (x)); 3142 unbound_col (x); 3143 part_current_indent = part_indent; 3144 part_output_pipe (stdout, "%s", val_xstring (expanded_text)); 3145 part_current_indent = 0; 3146 unbound_col (expanded_text); 3147 expanded_text = NEW_XSTRING_CONST (" 50 "); 3148 } 3149 cpp_flex_create_new_read_xstring (expanded_text, linedirectivestate); 3150 flex_pushstring2null (p); 3151 parsing_state_data->directive_line_stage = 3152 DIRECTIVE_LINE_STAGE_INTERPRET; 3153 } 3154 if (part_text_partial_flag && stack_size (included_from_stack) == 0) 3155 { 3156 if (part_pushed_expanded_text) 3157 col_unbound_col (part_pushed_expanded_text); 3158 part_pushed_expanded_text = 3159 col_duplicate_xstring (p->current_text_heap->xstring, XSTRING_MEMCPY); 3160 } 3161 return;; 3162 } 3163 3164 /*before text expansion*/ 3165 //DOC_FUNC_DEF(prepare_pp_text_expansion_result DG_EXPAND_TEXT) 3166 void 3167 prepare_pp_text_expansion_result (pleaf_t sym) 3168 { 3169 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3170 stack_push (state_stack, parsing_state_data); 3171 parsing_state_data = new_parsing_state_data (parsing_state_data); 3172 parsing_state_data->sym = sym; 3173 if (DIRECTIVE_EXPRESSION_STAGE_EXPAND == 3174 parsing_state_data->directive_expression_stage) 3175 { 3176 } 3177 else 3178 { 3179 parsing_state_data->scanner_state = macroexpansionstate; 3180 change_flex_state (misc_parser, macroexpansionstate); 3181 } 3182 return;; 3183 } 3184 3185 /*after no directive line*/ 3186 //DOC_FUNC_DEF(finalize_no_directive DG_PARSE_NO_DIRECTIVES) 3187 void 3188 finalize_no_directive (pleaf_t sym) 3189 { 3190 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3191 parser_master_t *p = p = sym->text_heap_heap->ps01_parser; //prevent unused var 3192 pleaf_t beg_of_line_sym = parsing_state_data->sym; 3193 beg_of_line_sym = beg_of_line_sym; 3194 process_result (sym); 3195 show (sym); 3196 list (sym); 3197 unbound_parsing_state_data (parsing_state_data); 3198 parsing_state_data = (parsing_state_data_t *) stack_pop (state_stack); 3199 rewind_after_symbol (sym, parsing_state_data->scanner_state); 3200 return;; 3201 } 3202 3203 /*before no directive line*/ 3204 //DOC_FUNC_DEF(prepare_no_directive DG_PARSE_NO_DIRECTIVES) 3205 void 3206 prepare_no_directive (pleaf_t sym) 3207 { 3208 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3209 cpp_branch_sort = PP_ANY_CHAR_NO_DIRECTIVE; 3210 stack_push (state_stack, parsing_state_data); 3211 parsing_state_data = new_parsing_state_data (parsing_state_data); 3212 parsing_state_data->sym = sym; 3213 if (!is_elm_xstring (parsing_state_data->state_set, SKIP_CONDITIONAL_TEXT)) 3214 { 3215 parsing_state_data->scanner_state = defdirectivescanstate; 3216 rewind_before_symbol (sym, defdirectivescanstate); 3217 } 3218 else 3219 { 3220 parsing_state_data->scanner_state = texttoendoflinestate; 3221 rewind_before_symbol (sym, texttoendoflinestate); 3222 } 3223 return;; 3224 } 3225 3226 /*before #define*/ 3227 //DOC_FUNC_DEF(prepare_define DG_PARSE_DEFINE) 3228 void 3229 prepare_define (pleaf_t sym) 3230 { 3231 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3232 macro_name_recognition_on = 0; 3233 cpp_branch_sort = sym->id; 3234 show (sym->sub); 3235 stack_push (state_stack, parsing_state_data); 3236 parsing_state_data = new_parsing_state_data (parsing_state_data); 3237 parsing_state_data->scanner_state = defdirectivescanstate; 3238 change_flex_state (misc_parser, defdirectivescanstate); 3239 parsing_state_data->sym = sym; 3240 return;; 3241 } 3242 3243 /*after #define*/ 3244 //DOC_FUNC_DEF(finalize_define DG_PARSE_DEFINE) 3245 void 3246 finalize_define (pleaf_t sym) 3247 { 3248 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3249 macro_name_recognition_on = 1; 3250 unbound_parsing_state_data (parsing_state_data); 3251 parsing_state_data = (parsing_state_data_t *) stack_pop (state_stack); 3252 change_flex_state (misc_parser, parsing_state_data->scanner_state); 3253 return;; 3254 } 3255 3256 /*initialize general data*/ 3257 //DOC_FUNC_DEF(pp_main_init DG_PARSE_COMMON) 3258 void 3259 pp_main_init (int argc, char **argv) 3260 { 3261 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3262 mm2_create (); 3263 general_main_init (); 3264 misc_parser = misc_new_parser (flex_getchar, misc_yylex, yy_lex); 3265 cpp2fncs = cpp_new (); 3266 cpp_default (); 3267 symbol_table_prop = RBT_CREATE_TREE (symbol_table_prop); 3268 load_connecting_nonterminal (misc_parser); 3269 pp_init (); 3270 push_arguments_to_buffer_0 (misc_parser, argc, argv, commandlineargsstate); 3271 yyparse ((void *) misc_parser); 3272 return;; 3273 } 3274 3275 /*store macros from command line as predefined*/ 3276 //DOC_FUNC_DEF(pp_save_macro_def2_for_predefined_macros_from_array DG_COMMAND_LINE_COMMON) 3277 void 3278 pp_save_macro_def2_for_predefined_macros_from_array (void *data) 3279 { 3280 col_t *key = ((aa_data_t *) (data))->key; 3281 col_t *value = ((aa_data_t *) (data))->value; 3282 pp_save_macro_def2_for_predefined_macros (val_xstring (key), 3283 val_xstring (value)); 3284 } 3285 3286 /*initialization function*/ 3287 //DOC_FUNC_DEF(pp_main_file_begin DG_PARSE_COMMON) 3288 void 3289 pp_main_file_begin () 3290 { 3291 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3292 aa_foreach (cmd_ln->macros, pp_save_macro_def2_for_predefined_macros_from_array); //DG_COMMAND_LINE_COMMON; 3293 if (cmd_ln->main_file) 3294 { 3295 cpp_open_text_file_for_read (val_xstring (cmd_ln->main_file), NULL); 3296 } 3297 else 3298 { 3299 cpp_open_text_file_for_read ("--", NULL); 3300 misc_parser->current_text_heap->file_ptr = stdin; 3301 } 3302 rewind_scanner (misc_parser, calculate_preprocessor_state (), 0); 3303 push_false_token_list (misc_parser, PP_TOK_MARKER_BEGIN_FILE, 0, 0); 3304 return;; 3305 } 3306 3307 /* create new parsing_state_data_t*/ 3308 //DOC_FUNC_DEF(new_parsing_state_data DG_PARSE_COMMON) 3309 parsing_state_data_t * 3310 new_parsing_state_data (parsing_state_data_t * old) 3311 { 3312 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3313 parsing_state_data_t *result = 3314 (parsing_state_data_t *) bound_new_mem (sizeof (parsing_state_data_t)); 3315 COPY_STRUCT (result, old, parsing_state_data_t); 3316 result->mm_handle = mm_handle; 3317 result->state_set = 3318 set0_xstring (new_xstring (MAX_STATE_ELEMENT / 8 + 1, NULL)); 3319 if (old) 3320 { 3321 memcpy (val_xstring (result->state_set), val_xstring (old->state_set), 3322 length_xstring (result->state_set)); 3323 } 3324 return result;; 3325 } 3326 3327 /* unbound parsing_state_data_t*/ 3328 //DOC_FUNC_DEF(unbound_parsing_state_data DG_PARSE_COMMON) 3329 void 3330 unbound_parsing_state_data (parsing_state_data_t * p) 3331 { 3332 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3333 unbound_xstring (p->state_set); 3334 unbound_mem_from_handle (p->mm_handle); 3335 return;; 3336 } 3337 3338 /*initialize specific data*/ 3339 //DOC_FUNC_DEF(pp_init DG_PARSE_COMMON) 3340 void 3341 pp_init () 3342 { 3343 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3344 col_t *dummy1 = stack_create (); 3345 col_t *dummy2 = stack_create (); 3346 expanded_macros_register = aa_array (); 3347 state_stack = dummy1; 3348 included_from_stack = dummy2; 3349 parsing_state_data = new_parsing_state_data (NULL); 3350 parsing_state_data->scanner_state = calculate_preprocessor_state (); 3351 parsing_state_data->directive_expression_stage = 3352 DIRECTIVE_EXPRESSION_STAGE_UNDEFINED; 3353 parsing_state_data->directive_include_stage = 3354 DIRECTIVE_INCLUDE_STAGE_UNDEFINED; 3355 parsing_state_data->directive_line_stage = DIRECTIVE_LINE_STAGE_UNDEFINED; 3356 parsing_state_data->directive_collect_stage = 3357 DIRECTIVE_COLLECT_STAGE_DURING_PARSE; 3358 del_elm_xstring (parsing_state_data->state_set, SKIP_CONDITIONAL_TEXT); 3359 del_elm_xstring (parsing_state_data->state_set, COND_ALTERNATIVE_FOUND); 3360 del_elm_xstring (parsing_state_data->state_set, SKIP_CONDITIONAL_GROUP); 3361 del_elm_xstring (parsing_state_data->state_set, PART_IF_IS_RESOLVED); 3362 del_elm_xstring (parsing_state_data->state_set, PART_IF_IS_1); 3363 del_elm_xstring (parsing_state_data->state_set, PART_ELIF_IS_RESOLVED); 3364 del_elm_xstring (parsing_state_data->state_set, PART_ELIF_IS_1); 3365 del_elm_xstring (parsing_state_data->state_set, PART_ENDIF_NEEDED); 3366 pp_save_macro_def2_for_predefined_macros ("__STDC__", "1"); 3367 pp_save_macro_def2_for_predefined_macros ("__STDC_VERSION__", "199409L"); 3368 pp_save_macro_def2_for_predefined_macros ("__DATE__", "date"); 3369 pp_save_macro_def2_for_predefined_macros ("__TIME__", "time"); 3370 pp_save_macro_def2_for_predefined_macros ("__FILE__", "file"); 3371 pp_save_macro_def2_for_predefined_macros ("__LINE__", "line"); 3372 return;; 3373 } 3374 3375 /*process command line arguments error*/ 3376 //DOC_FUNC_DEF(cmd_ln_args_error DG_COMMAND_LINE_COMMON) 3377 void 3378 cmd_ln_args_error (pleaf_t sym) 3379 { 3380 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3381 col_t *x = symbol_text3 (sym->sub->next); 3382 fprintf (stderr, "error in command line:\n%s\n", val_xstring (x)); 3383 unbound_col (x); 3384 exit (1);; 3385 return;; 3386 } 3387 3388 /*process command line arguments*/ 3389 //DOC_FUNC_DEF(process_cmd_ln_args DG_COMMAND_LINE_COMMON) 3390 void 3391 process_cmd_ln_args (pleaf_t sym) 3392 { 3393 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3394 cmd_ln = 3395 (command_line_arguments_t *) 3396 bound_new_mem (sizeof (command_line_arguments_t)); 3397 cmd_ln->mm_handle = mm2_handle; 3398 /*initialization of do_not_remove_slashes */ 3399 cmd_ln->do_not_remove_slashes = 0; //DG_DO_NOT_REMOVE_SLASHES; 3400 /*initialization of replace_slashes */ 3401 cmd_ln->replace_slashes = 0; //DG_REPLACE_SLASHES; 3402 /*initialization of text_result */ 3403 cmd_ln->text_result = 0; //DG_TEXT_RESULT; 3404 /*initialization of text_partial */ 3405 cmd_ln->text_partial = 0; //DG_TEXT_PARTIAL; 3406 /*initialization of html_result2 */ 3407 cmd_ln->html_result2 = 0; //DG_HTML_RESULT; 3408 /*initialization of html_result */ 3409 cmd_ln->html_result = 0; //DG_HTML_RESULT; 3410 /*initialization of predefined macros array */ 3411 cmd_ln->macros = aa_array (); //DG_COMMAND_LINE_COMMON; 3412 /*initialization of include directories array */ 3413 cmd_ln->dirs = aa_array (); //DG_COMMAND_LINE_COMMON; 3414 /*initialization of main_file */ 3415 cmd_ln->main_file = NULL; //DG_MAIN_FILE; 3416 /*initialization of process_only */ 3417 cmd_ln->process_only = aa_array (); //DG_PROCESS_ONLY; 3418 cmd_ln->process_only_dir = aa_array (); //DG_PROCESS_ONLY; 3419 /*initialization of extension_html */ 3420 cmd_ln->extension_html = NEW_XSTRING_CONST ("htm"); //DG_EXTENSION_HTML;KR_FILE_EXTENSIONS_OBSOLATE; 3421 /*initialization of extension_txt */ 3422 cmd_ln->extension_txt = NEW_XSTRING_CONST ("txt"); //DG_EXTENSION_TEXT;KR_FILE_EXTENSIONS_OBSOLATE; 3423 process_cmd_ln_args_further (sym); 3424 if (cmd_ln->html_result2 + cmd_ln->html_result + cmd_ln->text_partial + 3425 cmd_ln->text_result > 1) 3426 { 3427 fprintf (stderr, 3428 "error in command line:to many output options: use --help"); 3429 exit (1);; 3430 } 3431 if (cmd_ln->html_result2 + cmd_ln->html_result + cmd_ln->text_partial + 3432 cmd_ln->text_result == 0) 3433 { 3434 cmd_ln->text_result = 1; 3435 } 3436 if ((aa_length (cmd_ln->process_only) > 0 3437 || aa_length (cmd_ln->process_only_dir) > 0 3438 || cmd_ln->replace_slashes + cmd_ln->do_not_remove_slashes > 0) 3439 && (cmd_ln->text_partial == 0)) 3440 { 3441 fprintf (stderr, 3442 "error: process-only, process-only-dir, do-not-remove-slashes, replace-slashes are allowed only in html-partial or text-partial modes\n"); 3443 exit (1);; 3444 } 3445 if (cmd_ln->replace_slashes) 3446 { 3447 cmd_ln->do_not_remove_slashes = 1; 3448 } 3449 if (cmd_ln->text_partial + cmd_ln->replace_slashes + 3450 cmd_ln->do_not_remove_slashes > 0) 3451 { 3452 part_switch_to_partial (); 3453 } 3454 return;; 3455 } 3456 3457 /*continue process command line arguments*/ 3458 //DOC_FUNC_DEF(process_cmd_ln_args_further DG_COMMAND_LINE_COMMON) 3459 void 3460 process_cmd_ln_args_further (pleaf_t sym) 3461 { 3462 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3463 lisp_cons_cell_t *input = dt_mem2 (sym); 3464 /*until the end of the list */ 3465 int first_is_the_list = input && input->car && input->car->type == LISTP; 3466 int list_sort; 3467 lisp_cons_cell_t *current = input; 3468 col_t *stack = stack_create (); 3469 list_sort = PP_COMMAND_LINE_ARGUMENTS; 3470 while (1) 3471 { 3472 if (!current) 3473 { 3474 int s_n = 0; 3475 if (!(s_n = stack_size (stack))) 3476 { 3477 break; 3478 } 3479 if (TOK_MND == list_sort || TOK_MNI == list_sort 3480 || TOK_MNMNEXTENSIONMNTEXT == list_sort 3481 || TOK_MNMNEXTENSIONMNHTML == list_sort 3482 || TOK_MNMNPROCESSMNONLY == list_sort 3483 || TOK_MNMNPROCESSMNONLYMNDIR == list_sort 3484 || TOK_MNMNTABMNWIDTH == list_sort) 3485 { 3486 list_sort = PP_COMMAND_LINE_ARGUMENTS; 3487 } 3488 3489 current = (lisp_cons_cell_t *) stack_pop (stack); 3490 if (s_n == 1 && first_is_the_list) 3491 { 3492 break; 3493 } 3494 continue; 3495 } 3496 if (current->car && current->car->type == LISTP) 3497 { 3498 stack_push (stack, current->cdr); 3499 current = current->car->val; 3500 continue; 3501 } 3502 if (current->car && current->car->type == PLEAFP) 3503 { 3504 pleaf_t sym = (pleaf_t) (current->car->val); 3505 3506 if (sym->id == TOK_MNMNTABMNWIDTH) 3507 { 3508 /*prepare for read tab size */ 3509 list_sort = TOK_MNMNTABMNWIDTH; 3510 current = current->cdr; 3511 continue; 3512 } 3513 if (sym->id == TOK_MNMNPROCESSMNONLY) 3514 { 3515 /*prepare for read process-only file names */ 3516 list_sort = TOK_MNMNPROCESSMNONLY; //DG_PROCESS_ONLY; 3517 current = current->cdr; 3518 continue; 3519 } 3520 if (sym->id == TOK_MNMNPROCESSMNONLYMNDIR) 3521 { 3522 /*prepare for read process-only-dir names */ 3523 list_sort = TOK_MNMNPROCESSMNONLYMNDIR; //DG_PROCESS_ONLY; 3524 current = current->cdr; 3525 continue; 3526 } 3527 if (sym->id == TOK_MNMNEXTENSIONMNHTML) 3528 { 3529 /*prepare for read html file extension */ 3530 list_sort = TOK_MNMNEXTENSIONMNHTML; //DG_EXTENSION_HTML; 3531 current = current->cdr; 3532 continue; 3533 } 3534 if (sym->id == TOK_MNMNEXTENSIONMNTEXT) 3535 { 3536 /*prepare for read text file extension */ 3537 list_sort = TOK_MNMNEXTENSIONMNTEXT; //DG_EXTENSION_TEXT 3538 current = current->cdr; 3539 continue; 3540 } 3541 if (sym->id == TOK_MNI) 3542 { 3543 /*prepare for read include directory */ 3544 list_sort = TOK_MNI; //DG_COMMAND_LINE_COMMON; 3545 current = current->cdr; 3546 continue; 3547 } 3548 if (sym->id == TOK_MND) 3549 { 3550 /*prepare for read macro name */ 3551 list_sort = TOK_MND; //DG_COMMAND_LINE_COMMON; 3552 current = current->cdr; 3553 continue; 3554 } 3555 if (sym->id == PP_COMMAND_LINE_MACRO_ID) 3556 { 3557 /*add predefined macro name to its array */ 3558 int result; //DG_COMMAND_LINE_COMMON 3559 col_t *x; 3560 col_t *x1; 3561 pleaf_t value_sym = 3562 find_pleaf_with_id (sym, PP_COMMAND_LINE_FILE_NAME); 3563 if (!value_sym) 3564 { 3565 x = NEW_XSTRING_CONST ("1"); 3566 } 3567 else 3568 { 3569 x = symbol_text3 (value_sym); 3570 } 3571 x1 = symbol_text3 (sym); 3572 result = 3573 aa_assign_xstring_xstring (cmd_ln->macros, x1, x, 3574 RETURN_NULL_IF_EXISTS); 3575 if (!result) 3576 { 3577 unbound_col (x); 3578 unbound_col (x1); 3579 } 3580 current = current->cdr; 3581 continue; 3582 } 3583 if (sym->id == PP_COMMAND_LINE_FILE_NAME) 3584 { 3585 if (TOK_MNMNTABMNWIDTH == list_sort) 3586 { 3587 col_t *x = symbol_text3 (sym); 3588 part_tab_size = strtol (val_xstring (x), NULL, 10); 3589 if (!part_tab_size) 3590 part_tab_size = 1; 3591 col_unbound_col (x); 3592 } 3593 else if (TOK_MNI == list_sort) 3594 { 3595 /*add include directory to directories */ 3596 aa_push_xstring (cmd_ln->dirs, symbol_text3 (sym)); //DG_COMMAND_LINE_COMMON; 3597 } 3598 else if (TOK_MNMNPROCESSMNONLY == list_sort) 3599 { 3600 /*add process only file name to array */ 3601 col_t *x, *y; 3602 int res = aa_assign_xstring_xstring (cmd_ln->process_only, x = symbol_text3 (sym), y = NEW_XSTRING_CONST (""), RETURN_NULL_IF_EXISTS); //DG_PROCESS_ONLY; 3603 if (!res) 3604 { 3605 col_unbound_col (x); 3606 col_unbound_col (y); 3607 } 3608 } 3609 else if (TOK_MNMNPROCESSMNONLYMNDIR == list_sort) 3610 { 3611 /*add process only dir name to array */ 3612 aa_push_xstring (cmd_ln->process_only_dir, symbol_text3 (sym)); //DG_PROCESS_ONLY; 3613 } 3614 else if (PP_COMMAND_LINE_ARGUMENTS == list_sort) 3615 { 3616 /*set main file name */ 3617 if (!cmd_ln->main_file) 3618 { 3619 cmd_ln->main_file = symbol_text3 (sym); 3620 /*DG_MAIN_FILE */ ; 3621 } 3622 } 3623 current = current->cdr; 3624 continue; 3625 } 3626 if (sym->id == TOK_MNMNVERSION) 3627 { 3628 /*show version */ 3629 fprintf (stderr, "%s", CPP2HTML_VERSION "\n"); //DG_VERSION; 3630 exit (0);; 3631 //current=current->cdr; 3632 //continue; 3633 } 3634 if (sym->id == TOK_MNMNHELP) 3635 { 3636 /*show help */ 3637 fprintf (stdout, "%s", "cpp2html --help --version -D macro-name[=value] -I directory --html-result --html-partial --text-result --text-partial --do-not-remove-slashes --replace-slashes --tab-width number --process-only file-names --process-only-dir directory-names [--main-file] file-name" "\n"); //DG_HELP; 3638 exit (0);; 3639 //current=current->cdr; 3640 //continue; 3641 } 3642 if (sym->id == TOK_MNMNHTMLMNRESULT) 3643 { 3644 /*activate html_result */ 3645 cmd_ln->html_result = 1; //DG_HTML_RESULT; 3646 current = current->cdr; 3647 continue; 3648 } 3649 if (sym->id == TOK_MNMNHTMLMNRESULT2) 3650 { 3651 /*activate html_result2 */ 3652 cmd_ln->html_result2 = 1; //DG_HTML_RESULT; 3653 current = current->cdr; 3654 continue; 3655 } 3656 if (sym->id == TOK_MNMNTEXTMNRESULT) 3657 { 3658 /*activate text_result */ 3659 cmd_ln->text_result = 1; //DG_TEXT_RESULT; 3660 current = current->cdr; 3661 continue; 3662 } 3663 if (sym->id == TOK_MNMNTEXTMNPARTIAL) 3664 { 3665 /*activate text_partial */ 3666 cmd_ln->text_partial = 1; //DG_TEXT_PARTIAL; 3667 current = current->cdr; 3668 continue; 3669 } 3670 if (sym->id == PP_COMMAND_LINE_FILE_EXTENSION) 3671 { 3672 if (TOK_MNMNEXTENSIONMNTEXT == list_sort) 3673 { 3674 /*set file extension for text */ 3675 unbound_xstring (cmd_ln->extension_txt); //DG_EXTENSION_TEXT; 3676 cmd_ln->extension_txt = symbol_text3 (sym); 3677 fprintf (stderr, "warning:file extensions are obsolete\n"); 3678 } 3679 else if (TOK_MNMNEXTENSIONMNHTML == list_sort) 3680 { 3681 /*set file extension for html */ 3682 unbound_xstring (cmd_ln->extension_html); //DG_EXTENSION_HTML; 3683 cmd_ln->extension_html = symbol_text3 (sym); 3684 fprintf (stderr, "warning:file extensions are obsolete\n"); 3685 } 3686 current = current->cdr; 3687 continue; 3688 } 3689 if (sym->id == TOK_MNMNDOMNNOTMNREMOVEMNSLASHES) 3690 { 3691 /*activate do_not_remove_slashes */ 3692 cmd_ln->do_not_remove_slashes = 1; //DG_DO_NOT_REMOVE_SLASHES; 3693 current = current->cdr; 3694 continue; 3695 } 3696 if (sym->id == TOK_MNMNREPLACEMNSLASHES) 3697 { 3698 /*activate replace_slashes */ 3699 cmd_ln->replace_slashes = 1; //DG_REPLACE_SLASHES; 3700 current = current->cdr; 3701 continue; 3702 } 3703 /*otherwise */ 3704 current = current->cdr; 3705 continue; 3706 } 3707 } 3708 stack_unbound (stack); 3709 dt_mem_unbound (input); 3710 return;; 3711 } 3712 3713 /*save macro attributes for predefined macros*/ 3714 //DOC_FUNC_DEF(pp_save_macro_def2_for_predefined_macros DG_PARSE_COMMON) 3715 void 3716 pp_save_macro_def2_for_predefined_macros (char *name, char *value) 3717 { 3718 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3719 3720 symbol_table_prop_t *found; 3721 symbol_table_prop_t new_sym; 3722 void *mm_handle_symbol; 3723 new_sym.sym = (char *) mm2_bound_new_mem (strlen (name) + 1); 3724 mm_handle_symbol = mm2_handle; 3725 strcpy (new_sym.sym, name); 3726 found = (symbol_table_prop_t *) findKey (symbol_table_prop, &new_sym); 3727 if (found) 3728 { 3729 deleteKey (symbol_table_prop, found, 0); 3730 cpp_unbound_symbol_table_prop (found); 3731 /*here warning redefined possible */ 3732 } 3733 found = 3734 (symbol_table_prop_t *) bound_new_mem (sizeof (symbol_table_prop_t)); 3735 found->sym = new_sym.sym; 3736 found->mm_handle_sym = mm_handle_symbol; 3737 found->mm_handle = mm2_handle; 3738 insertKey (symbol_table_prop, found, 0); 3739 3740 found->macro_definition_in_symbol_table = new_macro_definition (); 3741 { 3742 col_t *c = NEW_XSTRING_CONST (value); 3743 list_push_last (found->macro_definition_in_symbol_table-> 3744 macro_substitution_list, 3745 new_macro_substitution_list_elmnt (SL_STRING, c, -1)); 3746 } 3747 return;; 3748 } 3749 3750 /*save macro attributes after define*/ 3751 //DOC_FUNC_DEF(pp_save_macro_def2 DG_PARSE_DEFINE) 3752 void 3753 pp_save_macro_def2 (pleaf_t sym) 3754 { 3755 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3756 macro_definition_t *md; 3757 pp_pleaf_att_t *a; 3758 symbol_table_prop_t *s = pp_push_symbol_table (sym); 3759 a = (pp_pleaf_att_t *) bound_new_mem (sizeof (pp_pleaf_att_t)); 3760 a->mm_handle = mm_handle; 3761 a->macro_def.list.val = dt_mem2 (sym); 3762 a->macro_def.list.type = LISTP; 3763 a->macro_def.formal_param_array = aa_array (); 3764 a->macro_def.nr_formal_params = -1; 3765 pp_process_macro_definition_list2 (sym, a); 3766 md = pp_save_substitution_list (sym, a); 3767 s->macro_definition_in_symbol_table = md; 3768 dt_mem_unbound (a->macro_def.list.val); 3769 unbound_int_xstring_array (a->macro_def.formal_param_array); 3770 unbound_mem_from_handle (a->mm_handle); 3771 return;; 3772 } 3773 3774 /*save macro attributes after define:identify parameters and their usage in expression*/ 3775 //DOC_FUNC_DEF(pp_process_macro_definition_list2 DG_PARSE_DEFINE) 3776 void 3777 pp_process_macro_definition_list2 (pleaf_t sym, pp_pleaf_att_t * a) 3778 { 3779 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3780 macro_def_attr_t *att = &(a->macro_def); 3781 lisp_cons_cell_t *input = (lisp_cons_cell_t *) (att->list.val); 3782 /*until the end of the list */ 3783 int first_is_the_list = input && input->car && input->car->type == LISTP; 3784 int list_sort; 3785 lisp_cons_cell_t *current = input; 3786 col_t *stack = stack_create (); 3787 list_sort = 0; 3788 while (1) 3789 { 3790 if (!current) 3791 { 3792 int s_n = 0; 3793 if (!(s_n = stack_size (stack))) 3794 { 3795 break; 3796 } 3797 if (list_sort == PP_DEFINE_DIRECTIVE_SYNTAX_WITH_PARAMS) 3798 { 3799 list_sort = PP_NAME; 3800 } 3801 else if (list_sort == PP_DEFINE_DIRECTIVE_SYNTAX_WITHOUT_PARAMS) 3802 { 3803 list_sort = PP_NAME; 3804 } 3805 else if (list_sort == PP_DEFINE_DIRECTIVE_SYNTAX_PARAMS) 3806 { 3807 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_WITH_PARAMS; 3808 } 3809 else if (list_sort == PP_DEFINE_DIRECTIVE_SYNTAX_CONTENT) 3810 { 3811 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_WITH_PARAMS; 3812 } 3813 else if (list_sort == TOK_NT) 3814 { 3815 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_CONTENT; 3816 } 3817 current = (lisp_cons_cell_t *) stack_pop (stack); 3818 if (s_n == 1 && first_is_the_list) 3819 { 3820 break; 3821 } 3822 continue; 3823 } 3824 if (current->car && current->car->type == LISTP) 3825 { 3826 stack_push (stack, current->cdr); 3827 current = current->car->val; 3828 continue; 3829 } 3830 if (current->car && current->car->type == PLEAFP) 3831 { 3832 pleaf_t sym = (pleaf_t) (current->car->val); 3833 3834 if (sym->id == PP_DEFINE_DIRECTIVE_SYNTAX) 3835 { 3836 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX; 3837 current = current->cdr; 3838 continue; 3839 } 3840 if (sym->id == PP_DEFINE_DIRECTIVE_SYNTAX_WITH_PARAMS) 3841 { 3842 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_WITH_PARAMS; 3843 att->nr_formal_params = 0; 3844 current = current->cdr; 3845 continue; 3846 } 3847 if (sym->id == PP_DEFINE_DIRECTIVE_SYNTAX_WITHOUT_PARAMS) 3848 { 3849 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_WITHOUT_PARAMS; 3850 current = current->cdr; 3851 continue; 3852 } 3853 if (sym->id == PP_DEFINE_DIRECTIVE_SYNTAX_PARAMS) 3854 { 3855 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_PARAMS; 3856 current = current->cdr; 3857 continue; 3858 } 3859 if (sym->id == PP_DEFINE_DIRECTIVE_SYNTAX_CONTENT) 3860 { 3861 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_CONTENT; 3862 current = current->cdr; 3863 continue; 3864 } 3865 if (sym->id == TOK_NT) 3866 { 3867 list_sort = TOK_NT; 3868 current = current->cdr; 3869 continue; 3870 } 3871 if (sym->id == TOK_NTNT) 3872 { 3873 current = current->cdr; 3874 continue; 3875 } 3876 if (sym->id == PP_TOK_HORIZONTAL_WHITESPACE) 3877 { 3878 current = current->cdr; 3879 continue; 3880 } 3881 if (sym->id == PP_NAME) 3882 { 3883 if (!list_sort) 3884 { 3885 list_sort = PP_NAME; 3886 } 3887 else 3888 { 3889 if (list_sort == PP_DEFINE_DIRECTIVE_SYNTAX_PARAMS) 3890 { 3891 col_t *arr_string = symbol_text3 (sym); 3892 col_t *arr_int; 3893 bound_new_col_symbol (&arr_int, INTP, 3894 (void *) (att->nr_formal_params)); 3895 att->nr_formal_params++; 3896 if (!aa_assign 3897 (att->formal_param_array, arr_string, arr_int, 3898 RETURN_NULL_IF_EXISTS)) 3899 { 3900 col_unbound_col (arr_string); 3901 col_unbound_col (arr_int); 3902 /*duplicate parameter name */ 3903 } 3904 } 3905 else 3906 { 3907 col_t *nr; 3908 col_t *arr_string = symbol_text3 (sym); 3909 nr = aa_value (att->formal_param_array, arr_string); 3910 (int) (sym->att) = (nr ? (*(val_lisp_int (nr))) : -1); 3911 unbound_col (arr_string); 3912 } 3913 } 3914 current = current->cdr; 3915 continue; 3916 } 3917 /*otherwise */ 3918 current = current->cdr; 3919 continue; 3920 } 3921 } 3922 stack_unbound (stack); 3923 return;; 3924 } 3925 3926 /*save macro definition*/ 3927 //DOC_FUNC_DEF(pp_save_substitution_list DG_PARSE_DEFINE) 3928 macro_definition_t * 3929 pp_save_substitution_list (pleaf_t sym, pp_pleaf_att_t * a) 3930 { 3931 int dummy_for_begin_function = (dummy_for_begin_function = 0); 3932 macro_definition_t *m = new_macro_definition (); 3933 lisp_cons_cell_t *input; 3934 int string_litaral = 0; 3935 pleaf_t waiting_white_space = NULL; 3936 int concat_token_state = 0; 3937 macro_def_attr_t *att = &(a->macro_def); 3938 input = (lisp_cons_cell_t *) (a->macro_def.list.val); 3939 m->nr_of_params = att->nr_formal_params; 3940 /*until the end of the list */ 3941 { 3942 int first_is_the_list = input && input->car && input->car->type == LISTP; 3943 int list_sort; 3944 lisp_cons_cell_t *current = input; 3945 col_t *stack = stack_create (); 3946 list_sort = 0; 3947 while (1) 3948 { 3949 if (!current) 3950 { 3951 int s_n = 0; 3952 if (!(s_n = stack_size (stack))) 3953 { 3954 break; 3955 } 3956 if (list_sort == PP_DEFINE_DIRECTIVE_SYNTAX_WITH_PARAMS) 3957 { 3958 list_sort = PP_NAME; 3959 } 3960 else if (list_sort == PP_DEFINE_DIRECTIVE_SYNTAX_WITHOUT_PARAMS) 3961 { 3962 list_sort = PP_NAME; 3963 } 3964 else if (list_sort == PP_DEFINE_DIRECTIVE_SYNTAX_PARAMS) 3965 { 3966 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_WITH_PARAMS; 3967 } 3968 else if (list_sort == PP_DEFINE_DIRECTIVE_SYNTAX_CONTENT) 3969 { 3970 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_WITH_PARAMS; 3971 } 3972 else if (list_sort == TOK_NT) 3973 { 3974 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_CONTENT; 3975 } 3976 current = (lisp_cons_cell_t *) stack_pop (stack); 3977 if (s_n == 1 && first_is_the_list) 3978 { 3979 break; 3980 } 3981 continue; 3982 } 3983 if (current->car && current->car->type == LISTP) 3984 { 3985 stack_push (stack, current->cdr); 3986 current = current->car->val; 3987 continue; 3988 } 3989 if (current->car && current->car->type == PLEAFP) 3990 { 3991 pleaf_t sym = (pleaf_t) (current->car->val); 3992 3993 if (sym->id == TOK_NTNT) 3994 { 3995 concat_token_state = 1; 3996 waiting_white_space = 0; 3997 current = current->cdr; 3998 continue; 3999 } 4000 else 4001 { 4002 if (waiting_white_space) 4003 { 4004 col_t *c = 4005 (part_text_partial_flag ? 4006 part_symbol_text3 (waiting_white_space) : 4007 symbol_text3 (waiting_white_space)); 4008 list_push_last (m->macro_substitution_list, 4009 new_macro_substitution_list_elmnt 4010 (SL_STRING_WHITESPACE, c, -1)); 4011 waiting_white_space = NULL; 4012 } 4013 } 4014 if (sym->id == PP_DEFINE_DIRECTIVE_SYNTAX) 4015 { 4016 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX; 4017 current = current->cdr; 4018 continue; 4019 } 4020 if (sym->id == PP_DEFINE_DIRECTIVE_SYNTAX_WITH_PARAMS) 4021 { 4022 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_WITH_PARAMS; 4023 current = current->cdr; 4024 continue; 4025 } 4026 if (sym->id == PP_DEFINE_DIRECTIVE_SYNTAX_WITHOUT_PARAMS) 4027 { 4028 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_WITHOUT_PARAMS; 4029 current = current->cdr; 4030 continue; 4031 } 4032 if (sym->id == PP_DEFINE_DIRECTIVE_SYNTAX_PARAMS) 4033 { 4034 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_PARAMS; 4035 current = current->cdr; 4036 continue; 4037 } 4038 if (sym->id == PP_DEFINE_DIRECTIVE_SYNTAX_CONTENT) 4039 { 4040 list_sort = PP_DEFINE_DIRECTIVE_SYNTAX_CONTENT; 4041 current = current->cdr; 4042 continue; 4043 } 4044 if (sym->id == PP_TOK_ENDOFLINE) 4045 { 4046 current = current->cdr; 4047 continue; 4048 } 4049 if (sym->id == TOK_NT) 4050 { 4051 list_sort = TOK_NT; 4052 string_litaral = 1; 4053 current = current->cdr; 4054 continue; 4055 } 4056 if (sym->id == PP_TOK_HORIZONTAL_WHITESPACE) 4057 { 4058 if (!concat_token_state && !string_litaral) 4059 { 4060 waiting_white_space = sym; 4061 } 4062 current = current->cdr; 4063 continue; 4064 } 4065 if (sym->id == PP_NAME) 4066 { 4067 if (!list_sort) 4068 { 4069 list_sort = PP_NAME; 4070 } 4071 else 4072 { 4073 if (list_sort == PP_DEFINE_DIRECTIVE_SYNTAX_PARAMS) 4074 { 4075 } 4076 else 4077 { 4078 int fp = (int) (sym->att); 4079 if (fp > -1) 4080 { 4081 if (string_litaral) 4082 { 4083 list_push_last (m->macro_substitution_list, 4084 new_macro_substitution_list_elmnt 4085 (SL_STRING_LITERAL, NULL, 4086 fp)); 4087 } 4088 else 4089 { 4090 int s = SL_ARGUMENT_EXPANSION; 4091 if (concat_token_state) 4092 { 4093 s = SL_CONCAT_ARGUMENT; 4094 } 4095 if (part_text_partial_flag 4096 && s == SL_ARGUMENT_EXPANSION) 4097 { 4098 col_t *x = part_symbol_text3 (sym); 4099 if ('\n' == DER (val_xstring (x) + 1)) 4100 { 4101 x = 4102 col_xstring_substring (x, 0, 1, 2, 4103 XSTRING_REUSE); 4104 list_push_last (m-> 4105 macro_substitution_list, 4106 new_macro_substitution_list_elmnt 4107 (SL_STRING_WHITESPACE, 4108 x, -1)); 4109 } 4110 else 4111 { 4112 col_unbound_col (x); 4113 } 4114 } 4115 list_push_last (m->macro_substitution_list, 4116 new_macro_substitution_list_elmnt 4117 (s, NULL, fp)); 4118 } 4119 concat_token_state = 0; 4120 string_litaral = 0; 4121 } 4122 else 4123 { 4124 col_t *c = 4125 (part_text_partial_flag ? 4126 part_symbol_text3 (sym) : symbol_text3 (sym)); 4127 int s = SL_STRING; 4128 if (string_litaral) 4129 { 4130 col_t *nt = NEW_XSTRING_CONST ("#"); 4131 c = concat_xstring (nt, c); 4132 string_litaral = 0; 4133 } 4134 if (concat_token_state) 4135 { 4136 s = SL_CONCAT_STRING; 4137 } 4138 list_push_last (m->macro_substitution_list, 4139 new_macro_substitution_list_elmnt 4140 (s, c, -1)); 4141 concat_token_state = 0; 4142 } 4143 } 4144 } 4145 current = current->cdr; 4146 continue; 4147 } 4148 /*otherwise */ 4149 { 4150 int s = (concat_token_state ? SL_CONCAT_STRING : SL_STRING); 4151 col_t *c = 4152 (part_text_partial_flag ? part_symbol_text3 (sym) : 4153 symbol_text3 (sym)); 4154 list_push_last (m->macro_substitution_list, 4155 new_macro_substitution_list_elmnt (s, c, -1)); 4156 concat_token_state = 0; 4157 string_litaral = 0; 4158 } 4159 current = current->cdr; 4160 continue; 4161 } 4162 } 4163 stack_unbound (stack); 4164 } 4165 { 4166 list_elm_t *varlist; 4167 list_elm_t *prev; 4168 list_elm_t *next; 4169 varlist = (*(val_col_list_elm (m->macro_substitution_list)))->first; 4170 while (varlist) 4171 { 4172 macro_substitution_list_elmnt_t *n; 4173 macro_substitution_list_elmnt_t *p; 4174 macro_substitution_list_elmnt_t *var = 4175 (macro_substitution_list_elmnt_t *) (varlist->data); 4176 prev = varlist->prev; 4177 p = (prev ? (macro_substitution_list_elmnt_t *) (prev->data) : NULL); 4178 next = varlist->next; 4179 n = (next ? (macro_substitution_list_elmnt_t *) (next->data) : NULL); 4180 if (var && n && var->sl_kind == SL_STRING && n->sl_kind == SL_STRING) 4181 { 4182 macro_substitution_list_elmnt_t *res; 4183 var->sl_xstr = concat_xstring (var->sl_xstr, n->sl_xstr); 4184 n->sl_xstr = NULL; 4185 res = 4186 (macro_substitution_list_elmnt_t *) list_destroy (m-> 4187 macro_substitution_list, 4188 next); 4189 if (res) 4190 unbound_macro_substitution_list_elmnt (res); 4191 } 4192 next = varlist->next; 4193 n = (next ? (macro_substitution_list_elmnt_t *) (next->data) : NULL); 4194 if (var && n && var->sl_kind == SL_ARGUMENT_EXPANSION 4195 && (n->sl_kind == SL_CONCAT_STRING 4196 || n->sl_kind == SL_CONCAT_ARGUMENT)) 4197 { 4198 var->sl_kind = SL_CONCAT_ARGUMENT; 4199 } 4200 if (var && var->sl_kind == SL_ARGUMENT_EXPANSION) 4201 { 4202 col_t *x; 4203 int res = 4204 aa_assign_sint_xstring (m->parameter_used_in_expansion, 4205 var->sl_parameter_nr, x = 4206 NEW_XSTRING_CONST (""), 4207 RETURN_NULL_IF_EXISTS); 4208 if (!res) 4209 col_unbound_col (x); 4210 } 4211 else if (var && var->sl_kind == SL_STRING_LITERAL) 4212 { 4213 col_t *x; 4214 int res = 4215 aa_assign_sint_xstring (m->parameter_used_in_string_literal, 4216 var->sl_parameter_nr, x = 4217 NEW_XSTRING_CONST (""), 4218 RETURN_NULL_IF_EXISTS); 4219 if (!res) 4220 col_unbound_col (x); 4221 } 4222 else if (var 4223 && (var->sl_kind == SL_CONCAT_ARGUMENT 4224 || var->sl_kind == SL_ARGUMENT_CONCAT)) 4225 { 4226 col_t *x; 4227 int res = 4228 aa_assign_sint_xstring (m->parameter_used_in_concat, 4229 var->sl_parameter_nr, x = 4230 NEW_XSTRING_CONST (""), 4231 RETURN_NULL_IF_EXISTS); 4232 if (!res) 4233 col_unbound_col (x); 4234 } 4235 varlist = varlist->next; 4236 } 4237 } 4238 return m;; 4239 } 4240 4241 /*calculate macro expansion from expanded arguments*/ 4242 //DOC_FUNC_DEF(expand_macro_given_expanded_arguments DG_EXPAND_TEXT) 4243 col_t * 4244 expand_macro_given_expanded_arguments (macro_definition_t * m, 4245 macro_expansion_struct_t * me) 4246 { 4247 int dummy_for_begin_function = (dummy_for_begin_function = 0); 4248 col_t *x = NEW_XSTRING_CONST (""); 4249 list_elm_t *varlist; 4250 varlist = (*(val_col_list_elm (m->macro_substitution_list)))->first; 4251 while (varlist) 4252 { 4253 macro_substitution_list_elmnt_t *var = 4254 (macro_substitution_list_elmnt_t *) (varlist->data); 4255 if (var 4256 && (var->sl_kind == SL_STRING || var->sl_kind == SL_CONCAT_STRING)) 4257 { 4258 col_t *yc = duplicate_xstring (var->sl_xstr); 4259 x = concat_xstring (x, yc); 4260 } 4261 else if (var && var->sl_kind == SL_STRING_WHITESPACE) 4262 { 4263 if (!part_text_partial_flag) 4264 { 4265 x = concat_xstring (x, NEW_XSTRING_CONST (" ")); 4266 } 4267 else 4268 { 4269 col_t *yc = duplicate_xstring (var->sl_xstr); 4270 x = concat_xstring (x, yc); 4271 } 4272 } 4273 else if (var && var->sl_kind == SL_STRING_LITERAL) 4274 { 4275 col_t *y = 4276 xstring_aa_value_sint (me->string_literel_arr, 4277 var->sl_parameter_nr); 4278 col_t *yc = duplicate_xstring (y); 4279 x = concat_xstring (x, yc); 4280 } 4281 else if (var 4282 && (var->sl_kind == SL_ARGUMENT_CONCAT 4283 || var->sl_kind == SL_CONCAT_ARGUMENT)) 4284 { 4285 col_t *y = 4286 xstring_aa_value_sint (me->unexpanded_arg_arr, 4287 var->sl_parameter_nr); 4288 col_t *yc = duplicate_xstring (y); 4289 x = concat_xstring (x, yc); 4290 } 4291 else if (var && var->sl_kind == SL_ARGUMENT_EXPANSION) 4292 { 4293 col_t *y = 4294 xstring_aa_value_sint (me->expanded_arg_arr, 4295 var->sl_parameter_nr); 4296 col_t *yc = duplicate_xstring (y); 4297 if (cmd_ln->do_not_remove_slashes) 4298 { 4299 yc = part_prepend_indent (yc, part_last_newline_suffix (x)); 4300 } 4301 x = concat_xstring (x, yc); 4302 } 4303 varlist = varlist->next; 4304 } 4305 return x;; 4306 } 4307 4308 /*find macro in symbol table*/ 4309 //DOC_FUNC_DEF(pp_find_symbol_table DG_PARSE_COMMON) 4310 symbol_table_prop_t * 4311 pp_find_symbol_table (char *name) 4312 { 4313 int dummy_for_begin_function = (dummy_for_begin_function = 0); 4314 symbol_table_prop_t *found = NULL; 4315 symbol_table_prop_t new_sym; 4316 new_sym.sym = name; 4317 found = (symbol_table_prop_t *) findKey (symbol_table_prop, &new_sym); 4318 return found;; 4319 } 4320 4321 /*save macro in symbol table*/ 4322 //DOC_FUNC_DEF(pp_push_symbol_table DG_PARSE_COMMON) 4323 symbol_table_prop_t * 4324 pp_push_symbol_table (pleaf_t symbol) 4325 { 4326 int dummy_for_begin_function = (dummy_for_begin_function = 0); 4327 symbol_table_prop_t *found; 4328 symbol_table_prop_t new_sym; 4329 void *mm_handle_symbol = NULL; 4330 new_sym.sym = symbol_text4 (symbol, &mm_handle_symbol); 4331 found = (symbol_table_prop_t *) findKey (symbol_table_prop, &new_sym); 4332 if (found) 4333 { 4334 deleteKey (symbol_table_prop, found, 0); 4335 cpp_unbound_symbol_table_prop (found); 4336 /*here warning redefined possible */ 4337 } 4338 found = 4339 (symbol_table_prop_t *) bound_new_mem (sizeof (symbol_table_prop_t)); 4340 found->sym = new_sym.sym; 4341 found->mm_handle_sym = mm_handle_symbol; 4342 found->mm_handle = mm2_handle; 4343 insertKey (symbol_table_prop, found, 0); 4344 return found;; 4345 } 4346 4347 /*expand macro to text*/ 4348 //DOC_FUNC_DEF(expand_macro2 DG_EXPAND_TEXT) 4349 void 4350 expand_macro2 (pleaf_t sym, int state) 4351 { 4352 int dummy_for_begin_function = (dummy_for_begin_function = 0); 4353 parser_master_t *p = sym->text_heap_heap->ps01_parser; 4354 CPP_COL_VAR (macro_appl_list, LISTP); 4355 pleaf_t macro_name = NULL; 4356 col_t *real_param_array = NULL; 4357 int rs; 4358 rs = 4359 aa_assign_xstring_xstring (expanded_macros_register, 4360 symbol_text3 (sym->sub->sub), 4361 NEW_XSTRING_CONST (""), RETURN_NULL_IF_EXISTS); 4362 macro_appl_list->val = dt_mem2 (sym); 4363 { 4364 lisp_cons_cell_t *input = ((lisp_cons_cell_t *) (macro_appl_list->val)); 4365 /*until the end of the list */ 4366 int first_is_the_list = input && input->car && input->car->type == LISTP; 4367 int list_sort = 0; 4368 lisp_cons_cell_t *current = input; 4369 col_t *stack = stack_create (); 4370 while (1) 4371 { 4372 if (!current) 4373 { 4374 int s_n = 0; 4375 if (!(s_n = stack_size (stack))) 4376 { 4377 break; 4378 } 4379 if (list_sort == 4380 PP_MACRO_EXPANSION_BALANCED_PARENTHESIS_SEQ_1_ELM) 4381 { 4382 list_sort = PP_MACRO_INVOKATION; 4383 } 4384 current = (lisp_cons_cell_t *) stack_pop (stack); 4385 if (s_n == 1 && first_is_the_list) 4386 { 4387 break; 4388 } 4389 continue; 4390 } 4391 if (current->car && current->car->type == LISTP) 4392 { 4393 stack_push (stack, current->cdr); 4394 current = current->car->val; 4395 continue; 4396 } 4397 if (current->car && current->car->type == PLEAFP) 4398 { 4399 pleaf_t sym = (pleaf_t) (current->car->val); 4400 if (sym->id == PP_MACRO_INVOKATION) 4401 { 4402 list_sort = PP_MACRO_INVOKATION; 4403 current = current->cdr; 4404 continue; 4405 } 4406 if (sym->id == PP_NAME_OF_MACRO_WITH_PARAMS || 4407 sym->id == PP_NAME_OF_MACRO_WITHOUT_PARAMS) 4408 { 4409 if (list_sort == PP_MACRO_INVOKATION) 4410 { 4411 macro_name = sym; 4412 } 4413 current = current->cdr; 4414 continue; 4415 } 4416 if (sym->id == TOK_OP) 4417 { 4418 if (!real_param_array) 4419 real_param_array = aa_array (); 4420 current = current->cdr; 4421 continue; 4422 } 4423 if (sym->id == PP_MACRO_EXPANSION_BALANCED_PARENTHESIS_SEQ_1_ELM) 4424 { 4425 CPP_COL_VAR (current_list, LISTP); 4426 list_sort = PP_MACRO_EXPANSION_BALANCED_PARENTHESIS_SEQ_1_ELM; 4427 current_list->val = current; 4428 aa_push_array (real_param_array, current_list); 4429 current = NULL; 4430 continue; 4431 } 4432 //otherwise 4433 current = current->cdr; 4434 continue; 4435 } 4436 } 4437 stack_unbound (stack); 4438 } 4439 if (real_param_array || macro_name->id == PP_NAME_OF_MACRO_WITHOUT_PARAMS) 4440 { 4441 col_t *x; 4442 int fp; 4443 macro_definition_t *md; 4444 macro_expansion_struct_t *me = new_macro_expansion_struct (); 4445 symbol_table_prop_t *found; 4446 symbol_table_prop_t new_sym; 4447 void *mm_handle_symbol; 4448 cpp_open_text_file_for_read ("--", NULL); 4449 new_sym.sym = symbol_text4 (macro_name, &mm_handle_symbol); 4450 found = (symbol_table_prop_t *) findKey (symbol_table_prop, &new_sym); 4451 md = found->macro_definition_in_symbol_table; 4452 for (fp = 0; fp < md->nr_of_params; fp++) 4453 { 4454 if (xstring_aa_value_sint 4455 (md->parameter_used_in_string_literal, fp)) 4456 { 4457 col_t *c = create_string_from_par3 (real_param_array, fp); 4458 int res = 4459 aa_assign_sint_xstring (me->string_literel_arr, fp, c, 0); 4460 res = res; 4461 } 4462 { 4463 col_t *c; 4464 int res; 4465 if (list_size (top_symbol_stack_1->cpp_expanded_arg_branch_list)) 4466 { 4467 c = 4468 collect_expanded_arg ((pleaf_t) 4469 list_pop (top_symbol_stack_1-> 4470 cpp_expanded_arg_branch_list)); 4471 } 4472 else 4473 c = NEW_XSTRING_CONST (" "); 4474 res = aa_assign_sint_xstring (me->expanded_arg_arr, fp, c, 0); 4475 res = res; 4476 } 4477 if (xstring_aa_value_sint (md->parameter_used_in_concat, fp)) 4478 { 4479 col_t *c = create_text_from_par3 (real_param_array, fp); 4480 int res = 4481 aa_assign_sint_xstring (me->unexpanded_arg_arr, fp, c, 0); 4482 res = res; 4483 } 4484 } 4485 if (! 4486 (x = 4487 DER (cpp2fncs->cpp_handle_expansion_of_built_in_macros) (new_sym. 4488 sym))) 4489 { 4490 x = expand_macro_given_expanded_arguments (md, me); 4491 flex_pushstring (p, " "); 4492 if (cmd_ln->do_not_remove_slashes) 4493 x = 4494 part_prepend_indent (part_remove_indent (x, 0), 4495 part_symbol_distance_from_last_newline 4496 (macro_name) + 1); 4497 if (DER (val_xstring (x))) 4498 { 4499 flex_pushstring (p, val_xstring (x)); 4500 flex_pushstring (p, " "); 4501 } 4502 } 4503 unbound_xstring (x); 4504 unbound_macro_expansion_struct (me); 4505 mm2_unbound_mem (mm_handle_symbol); 4506 } 4507 else 4508 { 4509 col_t *c; 4510 cpp_open_text_file_for_read ("--", NULL); 4511 flex_pushstring (p, val_xstring (c = symbol_text3 (macro_name))); 4512 unbound_xstring (c); 4513 } 4514 { 4515 col_t *x1 = col_new_xstring2 (5, "\0\x01\x01", 3); 4516 flex_pushstring2 (p, x1); 4517 } 4518 flex_pushstring (p, ""); 4519 ((cpp_file_att_t *) (p->current_text_heap->add_info))-> 4520 cpp_end_macro_invocation = sym; 4521 ((cpp_file_att_t *) (p->current_text_heap->add_info))->cpp_macro_inv_sym = 4522 sym; 4523 // rewind_scanner(misc_parser,state,0); 4524 4525 dt_mem_unbound (((lisp_cons_cell_t *) (macro_appl_list->val))); 4526 unbound_mem_from_handle (macro_appl_list->mm_handle); 4527 if (real_param_array) 4528 { 4529 int i = 0; 4530 do 4531 { 4532 col_t *j = new_int (i++); 4533 col_t *l = aa_value (real_param_array, j); 4534 col_unbound_col (j); 4535 if (!l) 4536 break; 4537 l->type = INTP; 4538 } 4539 while (1); 4540 col_unbound_col (real_param_array); 4541 } 4542 return;; 4543 } 4544 4545 /*escape double quote and backslash*/ 4546 //DOC_FUNC_DEF(string_copy_two_escapes DG_EXPAND_TEXT) 4547 void 4548 string_copy_two_escapes (char *d, char *s) 4549 { 4550 int dummy_for_begin_function = (dummy_for_begin_function = 0); 4551 for (; *s; ('\\' == *s || '\"' == *s ? *d++ = '\\' : 0), *d++ = *s++); 4552 *d = 0; 4553 return;; 4554 } 4555 4556 /*calculate unexpanded argument*/ 4557 //DOC_FUNC_DEF(create_text_from_par3 DG_EXPAND_TEXT) 4558 col_t * 4559 create_text_from_par3 (col_t * fp_array, int index) 4560 { 4561 int dummy_for_begin_function = (dummy_for_begin_function = 0); 4562 CPP_COL_VAR (col_index, INTP); 4563 col_t *parameter = (col_index->val = 4564 (void *) index, 4565 (fp_array ? aa_value (fp_array, col_index) : NULL)); 4566 lisp_cons_cell_t *input = 4567 (lisp_cons_cell_t *) (parameter ? parameter->val : NULL); 4568 col_t *all_txt = NEW_XSTRING_CONST (""); 4569 /*until the end of the list */ 4570 int first_is_the_list = input && input->car && input->car->type == LISTP; 4571 int list_sort; 4572 lisp_cons_cell_t *current = input; 4573 col_t *stack = stack_create (); 4574 col_t *list_sort_stack = stack_create (); 4575 int list_sort_old; 4576 list_sort = 0; 4577 list_sort_old = 0; 4578 unbound_mem_from_handle (col_index->mm_handle); 4579 while (1) 4580 { 4581 if (!current) 4582 { 4583 int s_n = 0; 4584 if (!(s_n = stack_size (stack))) 4585 { 4586 break; 4587 } 4588 list_sort_old = list_sort; 4589 { 4590 col_t *i = stack_pop (list_sort_stack); 4591 list_sort = DER (val_int (i)); 4592 col_unbound_col (i); 4593 } 4594 4595 current = (lisp_cons_cell_t *) stack_pop (stack); 4596 if (s_n == 1 && first_is_the_list) 4597 { 4598 break; 4599 } 4600 continue; 4601 } 4602 if (current->car && current->car->type == LISTP) 4603 { 4604 4605 stack_push (stack, current->cdr); 4606 current = current->car->val; 4607 4608 { 4609 col_t *i = new_int (list_sort); 4610 stack_push (list_sort_stack, i); 4611 } 4612 continue; 4613 } 4614 if (current->car && current->car->type == PLEAFP) 4615 { 4616 pleaf_t sym = (pleaf_t) (current->car->val); 4617 if (sym->id == PP_TEXT_EXPANSION) 4618 { 4619 /*goto suplist */ 4620 current = NULL; 4621 continue; 4622 } 4623 if (sym->id == PP_MACRO_EXPANSION) 4624 { 4625 current = current->cdr; 4626 continue; 4627 } 4628 if (sym->id != PP_MACRO_EXPANSION_BALANCED_PARENTHESIS_SEQ_1_ELM && 4629 sym->id != PP_MACRO_INVOKATION) 4630 { 4631 if (sym->id == PP_OPTIONAL_WHITESPACE) 4632 { 4633 all_txt = concat_xstring (all_txt, NEW_XSTRING_CONST (" ")); 4634 } 4635 else 4636 { 4637 col_t *s; 4638 s = symbol_text6 (sym, symbol_text3); 4639 all_txt = concat_xstring (all_txt, s); 4640 } 4641 current = current->cdr; 4642 continue; 4643 } 4644 /*otherwise */ 4645 current = current->cdr; 4646 continue; 4647 } 4648 } 4649 { 4650 int b = 0; 4651 int e = length_xstring (all_txt); 4652 if (DER (val_xstring (all_txt)) == ' ') 4653 b = 1; 4654 if (e && DER (val_xstring (all_txt) + e - 1) == ' ') 4655 e--; 4656 if (e > b) 4657 { 4658 all_txt = xstring_substring (all_txt, b, e - 1, XSTRING_REUSE); 4659 } 4660 else 4661 { 4662 unbound_col (all_txt); 4663 all_txt = NEW_XSTRING_CONST (""); 4664 } 4665 } 4666 stack_unbound (list_sort_stack); 4667 stack_unbound (stack); 4668 return all_txt;; 4669 } 4670 4671 /*calculate string literal from argument*/ 4672 //DOC_FUNC_DEF(create_string_from_par3 DG_EXPAND_TEXT) 4673 col_t * 4674 create_string_from_par3 (col_t * fp_array, int index) 4675 { 4676 int dummy_for_begin_function = (dummy_for_begin_function = 0); 4677 CPP_COL_VAR (col_index, INTP); 4678 col_t *cvar; 4679 lisp_cons_cell_t *input = (col_index->val = 4680 (void *) index, 4681 (lisp_cons_cell_t *) (fp_array 4682 ? (cvar = 4683 (aa_value 4684 (fp_array, col_index)), 4685 (cvar ? cvar-> 4686 val : NULL)) : NULL)); 4687 int nothing_written_yet = 1; 4688 pleaf_t waiting_white_space = NULL; 4689 col_t *all_txt = NEW_XSTRING_CONST ("\""); 4690 /*until the end of the list */ 4691 int first_is_the_list = input && input->car && input->car->type == LISTP; 4692 int list_sort; 4693 lisp_cons_cell_t *current = input; 4694 col_t *stack = stack_create (); 4695 col_t *list_sort_stack = stack_create (); 4696 int list_sort_old; 4697 list_sort = 0; 4698 list_sort_old = 0; 4699 unbound_mem_from_handle (col_index->mm_handle); 4700 while (1) 4701 { 4702 if (!current) 4703 { 4704 int s_n = 0; 4705 if (!(s_n = stack_size (stack))) 4706 { 4707 break; 4708 } 4709 list_sort_old = list_sort; 4710 { 4711 col_t *i = stack_pop (list_sort_stack); 4712 list_sort = DER (val_int (i)); 4713 col_unbound_col (i); 4714 } 4715 4716 current = (lisp_cons_cell_t *) stack_pop (stack); 4717 if (s_n == 1 && first_is_the_list) 4718 { 4719 break; 4720 } 4721 continue; 4722 } 4723 if (current->car && current->car->type == LISTP) 4724 { 4725 stack_push (stack, current->cdr); 4726 current = current->car->val; 4727 4728 { 4729 col_t *i = new_int (list_sort); 4730 stack_push (list_sort_stack, i); 4731 } 4732 continue; 4733 } 4734 if (current->car && current->car->type == PLEAFP) 4735 { 4736 pleaf_t sym = (pleaf_t) (current->car->val); 4737 if (sym->id == PP_TEXT_EXPANSION) 4738 { 4739 /*goto suplist */ 4740 current = NULL; 4741 continue; 4742 } 4743 if (sym->id == PP_MACRO_EXPANSION) 4744 { 4745 current = current->cdr; 4746 continue; 4747 } 4748 if (sym->id != PP_MACRO_EXPANSION_BALANCED_PARENTHESIS_SEQ_1_ELM && 4749 sym->id != PP_MACRO_INVOKATION) 4750 { 4751 if (sym->id == PP_OPTIONAL_WHITESPACE) 4752 { 4753 waiting_white_space = sym; 4754 current = current->cdr; 4755 continue; 4756 } 4757 else 4758 { 4759 col_t *c = symbol_text6 (sym, symbol_text3); 4760 int l = length_xstring (c); 4761 CPP_COL_BOUND_MEM_NO_HANDLE_SIZE (sym_txt, char, 2 * l + 5) 4762 void *sym_txt_mm_handle = mm_handle; 4763 string_copy_two_escapes (sym_txt, val_xstring (c)); 4764 unbound_col (c); 4765 if (waiting_white_space && !nothing_written_yet) 4766 { 4767 col_t *one_space = NEW_XSTRING_CONST (" "); 4768 all_txt = concat_xstring (all_txt, one_space); 4769 waiting_white_space = NULL; 4770 } 4771 if (l) 4772 { 4773 nothing_written_yet = 0; 4774 } 4775 { 4776 col_t *s = NEW_XSTRING_CONST (sym_txt); 4777 unbound_mem_from_handle (sym_txt_mm_handle); 4778 all_txt = concat_xstring (all_txt, s); 4779 } 4780 } 4781 current = current->cdr; 4782 continue; 4783 } 4784 /*otherwise */ 4785 current = current->cdr; 4786 continue; 4787 } 4788 } 4789 { 4790 col_t *one_qt = NEW_XSTRING_CONST ("\""); 4791 all_txt = concat_xstring (all_txt, one_qt); 4792 } 4793 stack_unbound (list_sort_stack); 4794 stack_unbound (stack); 4795 return all_txt;; 4796 } 4797 4798 /*calculate expanded argument*/ 4799 //DOC_FUNC_DEF(collect_expanded_arg DG_EXPAND_TEXT) 4800 col_t * 4801 collect_expanded_arg (pleaf_t sym) 4802 { 4803 int dummy_for_begin_function = (dummy_for_begin_function = 0); 4804 lisp_cons_cell_t *input = dt_mem2 (sym); 4805 col_t *all_txt = NEW_XSTRING_CONST (""); 4806 /*until the end of the list */ 4807 int first_is_the_list = input && input->car && input->car->type == LISTP; 4808 int list_sort; 4809 lisp_cons_cell_t *current = input; 4810 col_t *stack = stack_create (); 4811 col_t *list_sort_stack = stack_create (); 4812 int list_sort_old; 4813 /* int first_real_symbol=1; */ 4814 list_sort = 0; 4815 list_sort_old = 0; 4816 while (1) 4817 { 4818 if (!current) 4819 { 4820 int s_n = 0; 4821 if (!(s_n = stack_size (stack))) 4822 { 4823 break; 4824 } 4825 list_sort_old = list_sort; 4826 { 4827 col_t *i = stack_pop (list_sort_stack); 4828 list_sort = DER (val_int (i)); 4829 col_unbound_col (i); 4830 } 4831 4832 current = (lisp_cons_cell_t *) stack_pop (stack); 4833 if (s_n == 1 && first_is_the_list) 4834 { 4835 break; 4836 } 4837 continue; 4838 } 4839 if (current->car && current->car->type == LISTP) 4840 { 4841 stack_push (stack, current->cdr); 4842 current = current->car->val; 4843 4844 { 4845 col_t *i = new_int (list_sort); 4846 stack_push (list_sort_stack, i); 4847 } 4848 continue; 4849 } 4850 if (current->car && current->car->type == PLEAFP) 4851 { 4852 pleaf_t sym = (pleaf_t) (current->car->val); 4853 4854 if (sym->id == PP_MACRO_INVOKATION) 4855 { 4856 /*goto suplist */ 4857 current = NULL; 4858 continue; 4859 } 4860 if (sym->id == PP_MACRO_EXPANSION) 4861 { 4862 current = current->cdr; 4863 continue; 4864 } 4865 if (sym->id != PP_MACRO_EXPANSION_BALANCED_PARENTHESIS_SEQ_1_ELM && 4866 sym->id != PP_TEXT_EXPANSION && sym->id != PP_TOK_NULL) 4867 { 4868 col_t *s; 4869 s = symbol_text6 (sym, part_symbol_text3); 4870 all_txt = concat_xstring (all_txt, s); 4871 current = current->cdr; 4872 continue; 4873 } 4874 /*otherwise */ 4875 current = current->cdr; 4876 continue; 4877 } 4878 } 4879 stack_unbound (list_sort_stack); 4880 stack_unbound (stack); 4881 dt_mem_unbound (input); 4882 return all_txt;; 4883 } 4884 4885 /*open new buffer*/ 4886 //DOC_FUNC_DEF(cpp_open_text_file_for_read DG_PARSE_COMMON) 4887 text_heap_heap_t * 4888 cpp_open_text_file_for_read (char *file, col_t * dir_array) 4889 { 4890 int dummy_for_begin_function = (dummy_for_begin_function = 0); 4891 text_heap_heap_t *b; 4892 cpp_file_att_t *a; 4893 void *lh; 4894 col_t *var_loc = (col_t *) mm2_bound_new_mem (sizeof (cpp_file_att_t)); 4895 lh = mm2_handle; 4896 b = open_text_file_for_read (misc_parser, file, dir_array); 4897 b->add_info = var_loc; 4898 a = (cpp_file_att_t *) (b->add_info); 4899 a->col.mm_handle = lh; 4900 a->col.val = NULL; 4901 a->col.type = CPP_FILE_ATTP; 4902 a->cnt_slash_nl = aa_array (); 4903 a->line_offset = 0; 4904 a->cpp_end_macro_invocation = NULL; 4905 a->cpp_macro_inv_sym = NULL; 4906 return b;; 4907 } 4908 4909 /*unbound an extended type*/ 4910 //DOC_FUNC_DEF(col_extended_type_unbound DG_PARSE_COMMON) 4911 int 4912 col_extended_type_unbound (col_t * s) 4913 { 4914 int dummy_for_begin_function = (dummy_for_begin_function = 0); 4915 int result = 0; 4916 if (CPP_FILE_ATTP == s->type) 4917 { 4918 cpp_file_att_t *c = (cpp_file_att_t *) s; 4919 if (!(result = mm2_unbound_mem (s->mm_handle))) 4920 { 4921 /*!!begin critical section: uses unbounded result!! */ 4922 mm2_bound_new_forbidden = 1; 4923 if (c->cnt_slash_nl) 4924 col_unbound_col (c->cnt_slash_nl); 4925 mm2_bound_new_forbidden = 0; 4926 /*!!end critical section: uses unbounded result!! */ 4927 } 4928 } 4929 else 4930 { 4931 exit (1);; 4932 } 4933 return result;; 4934 } 4935

cpp2.h

Main goal definitions


Refined goal definitions


Design goal definitions


Known risks definitions


Type definitions


symbol_stack_t
cpp2.c(1257) cpp2.c(1257) cpp2.c(1256) cpp2.c(1253) cpp2.c(1241) cpp2.c(1238) cpp2.c(46) cpp2.h(548) cpp2.h(547) cpp2.h(545) cpp2.h(504)
parsing_state_data_t
cpp2.c(3330) cpp2.c(3327) cpp2.c(3315) cpp2.c(3314) cpp2.c(3314) cpp2.c(3313) cpp2.c(3310) cpp2.c(3308) cpp2.c(3307) cpp2.c(3251) cpp2.c(3198) cpp2.c(3100) cpp2.c(2136) cpp2.c(2109) cpp2.c(2065) cpp2.c(2017) cpp2.c(1987) cpp2.c(1770) cpp2.c(1751) cpp2.c(63) cpp2.c(61) cpp2.h(643) cpp2.h(636) cpp2.h(635) cpp2.h(634) cpp2.h(479)
parsing_state_t
cpp2.h(398) cpp2.h(393)
pp_pleaf_att_t
cpp2.c(3929) cpp2.c(3777) cpp2.c(3759) cpp2.c(3759) cpp2.c(3757) cpp2.h(572) cpp2.h(570) cpp2.h(357) cpp2.h(347)
macro_def_attr_t
cpp2.c(3937) cpp2.c(3780) cpp2.h(352) cpp2.h(345)
command_line_arguments_t
cpp2.c(3396) cpp2.c(3395) cpp2.c(658) cpp2.c(655) cpp2.c(58) cpp2.h(639) cpp2.h(524) cpp2.h(332)
symbol_table_prop_t
cpp2.c(4450) cpp2.c(4446) cpp2.c(4445) cpp2.c(4339) cpp2.c(4339) cpp2.c(4331) cpp2.c(4328) cpp2.c(4327) cpp2.c(4322) cpp2.c(4317) cpp2.c(4315) cpp2.c(4314) cpp2.c(4309) cpp2.c(3758) cpp2.c(3734) cpp2.c(3734) cpp2.c(3726) cpp2.c(3721) cpp2.c(3720) cpp2.c(2766) cpp2.c(2765) cpp2.c(2762) cpp2.c(2757) cpp2.c(1722) cpp2.c(1337) cpp2.c(1336) cpp2.c(1328) cpp2.c(1327) cpp2.c(1288) cpp2.c(1285) cpp2.c(703) cpp2.c(700) cpp2.c(48) cpp2.h(622) cpp2.h(568) cpp2.h(560) cpp2.h(526) cpp2.h(500) cpp2.h(287)
macro_definition_t
cpp2.c(4443) cpp2.c(4244) cpp2.c(3932) cpp2.c(3927) cpp2.c(3756) cpp2.c(1473) cpp2.c(1470) cpp2.c(1459) cpp2.c(1459) cpp2.c(1458) cpp2.c(1453) cpp2.c(1452) cpp2.c(1373) cpp2.h(578) cpp2.h(578) cpp2.h(576) cpp2.h(570) cpp2.h(285) cpp2.h(275)
macro_substitution_list_elmnt_t
cpp2.c(4254) cpp2.c(4253) cpp2.c(4193) cpp2.c(4186) cpp2.c(4182) cpp2.c(4179) cpp2.c(4177) cpp2.c(4175) cpp2.c(4174) cpp2.c(4173) cpp2.c(4172) cpp2.c(1445) cpp2.c(1445) cpp2.c(1439) cpp2.c(1431) cpp2.c(1430) cpp2.c(1429) cpp2.c(1424) cpp2.h(579) cpp2.h(258) cpp2.h(253)
macro_expansion_struct_t
cpp2.c(4444) cpp2.c(4245) cpp2.c(1413) cpp2.c(1410) cpp2.c(1402) cpp2.c(1401) cpp2.c(1400) cpp2.c(1395) cpp2.c(1394) cpp2.h(577) cpp2.h(574) cpp2.h(574) cpp2.h(214)
cpp_html_result_elmnt_t
cpp2.c(1203) cpp2.c(1203) cpp2.c(1197) cpp2.c(1188) cpp2.c(1187) cpp2.c(1186) cpp2.c(1181) cpp2.c(1180) cpp2.c(1169) cpp2.c(975) cpp2.c(975) cpp2.c(808) cpp2.c(808) cpp2.c(758) cpp2.c(758) cpp2.c(378) cpp2.c(292) cpp2.c(219) cpp2.c(218) cpp2.c(39) cpp2.h(541) cpp2.h(198) cpp2.h(192) cpp2.h(189)
cpp_file_att_t
cpp2.c(4918) cpp2.c(4918) cpp2.c(4898) cpp2.c(4894) cpp2.c(4892) cpp2.c(4521) cpp2.c(4519) cpp2.c(2023) cpp2.c(584) cpp2.c(545) cpp2.c(505) cpp2.c(352) cpp2.c(287) cpp2.c(213) cpp2.c(115) cpp2.c(91) cpp2.h(90) part.c(284) part.c(190)
cpp_class_t
cpp2.c(635) cpp2.c(635) cpp2.c(634) cpp2.c(629) cpp2.c(31) cpp2.h(521) cpp2.h(519) cpp2.h(72)
cpp_html_result_sort_t
cpp2.c(131) cpp2.h(510) cpp2.h(43)

Struct variables


cpp_symbol_table_entry
cpp2.c(1374) cpp2.c(1262) cpp2.h(500)
cpp_expanded_arg_branch_list
cpp2.c(4470) cpp2.c(4465) cpp2.c(1268) cpp2.c(1245) cpp2.c(422) cpp2.h(497)
cpp_unexpanded_arg_txt_list
cpp2.c(1389) cpp2.c(1267) cpp2.c(1244) cpp2.c(481) cpp2.c(478) cpp2.c(426) cpp2.c(423) cpp2.h(494)
current_argument_number
cpp2.c(1388) cpp2.c(1380) cpp2.c(1376) cpp2.c(1359) cpp2.h(485)
expression_value
cpp2.c(2432) cpp2.c(2426) cpp2.c(2383) cpp2.c(2208) cpp2.c(2186) cpp2.c(2165) cpp2.c(1561) cpp2.c(1529) cpp2.h(476) part.c(509) part.c(461)
directive_collect_stage
cpp2.c(3356) cpp2.c(3071) cpp2.c(3043) cpp2.c(3033) cpp2.c(3018) cpp2.c(1694) cpp2.c(1670) cpp2.c(1669) cpp2.c(327) cpp2.h(467) part.c(709) part.c(699) part.c(684)
directive_line_stage
cpp2.c(3355) cpp2.c(3151) cpp2.c(3132) cpp2.c(2950) cpp2.c(2948) cpp2.c(2061) cpp2.c(2057) cpp2.c(2055) cpp2.c(2048) cpp2.c(2041) cpp2.c(2014) cpp2.c(2009) cpp2.c(1837) cpp2.c(1810) cpp2.h(449) part.c(859) part.c(856)
directive_include_stage
cpp2.c(3353) cpp2.c(3129) cpp2.c(3123) cpp2.c(2939) cpp2.c(2937) cpp2.c(1983) cpp2.c(1966) cpp2.c(1964) cpp2.c(1957) cpp2.c(1950) cpp2.c(1915) cpp2.c(1863) cpp2.c(1848) cpp2.c(1793) cpp2.c(1763) cpp2.c(1587) cpp2.h(428) part.c(846) part.c(843)
directive_expression_stage
cpp2.c(3351) cpp2.c(3174) cpp2.c(3120) cpp2.c(3104) cpp2.c(2912) cpp2.c(2910) cpp2.c(2433) cpp2.c(2411) cpp2.c(2380) cpp2.c(2378) cpp2.c(2371) cpp2.c(2364) cpp2.c(2339) cpp2.c(2322) cpp2.c(2304) cpp2.c(1585) cpp2.c(1293) cpp2.c(460) cpp2.h(425) part.c(816) part.c(814)
scanner_state
cpp2.c(3350) cpp2.c(3252) cpp2.c(3237) cpp2.c(3220) cpp2.c(3215) cpp2.c(3199) cpp2.c(3179) cpp2.c(3101) cpp2.c(2952) cpp2.c(2942) cpp2.c(2933) cpp2.c(2409) cpp2.c(2407) cpp2.c(2361) cpp2.c(2360) cpp2.c(2289) cpp2.c(2271) cpp2.c(2251) cpp2.c(2231) cpp2.c(2230) cpp2.c(2196) cpp2.c(2195) cpp2.c(2175) cpp2.c(2174) cpp2.c(2137) cpp2.c(2110) cpp2.c(2067) cpp2.c(2019) cpp2.c(1989) cpp2.c(1919) cpp2.c(1917) cpp2.c(1827) cpp2.c(1826) cpp2.c(1811) cpp2.c(1809) cpp2.c(1794) cpp2.c(1792) cpp2.c(1767) cpp2.c(1752) cpp2.c(1709) cpp2.c(1591) cpp2.h(405) part.c(861) part.c(849) part.c(839)
state_set
cpp2.c(3365) cpp2.c(3364) cpp2.c(3363) cpp2.c(3362) cpp2.c(3361) cpp2.c(3360) cpp2.c(3359) cpp2.c(3358) cpp2.c(3333) cpp2.c(3322) cpp2.c(3321) cpp2.c(3321) cpp2.c(3317) cpp2.c(3213) cpp2.c(3109) cpp2.c(3108) cpp2.c(2922) cpp2.c(2921) cpp2.c(2917) cpp2.c(2916) cpp2.c(2389) cpp2.c(2342) cpp2.c(2328) cpp2.c(2326) cpp2.c(2324) cpp2.c(2306) cpp2.c(2275) cpp2.c(2273) cpp2.c(2255) cpp2.c(2253) cpp2.c(2216) cpp2.c(2214) cpp2.c(2207) cpp2.c(2122) cpp2.c(1934) cpp2.c(1933) cpp2.c(1931) cpp2.c(1930) cpp2.c(1928) cpp2.c(1926) cpp2.c(1924) cpp2.c(1922) cpp2.c(1565) cpp2.c(1563) cpp2.c(1556) cpp2.c(1554) cpp2.c(1551) cpp2.c(1538) cpp2.c(1536) cpp2.c(1531) cpp2.c(1525) cpp2.c(1523) cpp2.c(1506) cpp2.h(400) part.c(826) part.c(825) part.c(821) part.c(820) part.c(525) part.c(523) part.c(521) part.c(517) part.c(515) part.c(513) part.c(511) part.c(505) part.c(503) part.c(501) part.c(494) part.c(492) part.c(489) part.c(477) part.c(475) part.c(473) part.c(471) part.c(467) part.c(465) part.c(463) part.c(459) part.c(457) part.c(455) part.c(449) part.c(447) part.c(446) part.c(445) part.c(444) part.c(443) part.c(442) part.c(416) part.c(413) part.c(389) part.c(386) part.c(356) part.c(354) part.c(350) part.c(347)
macro_def
cpp2.c(3938) cpp2.c(3937) cpp2.c(3780) cpp2.c(3769) cpp2.c(3768) cpp2.c(3764) cpp2.c(3763) cpp2.c(3762) cpp2.c(3761) cpp2.h(586) cpp2.h(352)
formal_param_array
cpp2.c(3909) cpp2.c(3897) cpp2.c(3769) cpp2.c(3763) cpp2.h(340)
main_file
cpp2.c(3619) cpp2.c(3617) cpp2.c(3415) cpp2.c(3414) cpp2.c(3295) cpp2.c(3293) cpp2.c(1001) cpp2.c(1001) cpp2.c(667) cpp2.c(666) cpp2.h(329)
process_only_dir
cpp2.c(3612) cpp2.c(3437) cpp2.c(3418) cpp2.c(1894) cpp2.c(1891) cpp2.c(1872) cpp2.c(679) cpp2.c(678) cpp2.h(326) cpp2.h(324)
process_only
cpp2.c(3602) cpp2.c(3436) cpp2.c(3417) cpp2.c(3416) cpp2.c(1887) cpp2.c(1879) cpp2.c(1877) cpp2.c(1877) cpp2.c(1876) cpp2.c(1871) cpp2.c(677) cpp2.c(676) cpp2.h(323) cpp2.h(321) part.c(549) part.c(538) part.c(535) part.c(532)
replace_slashes
cpp2.c(3699) cpp2.c(3698) cpp2.c(3449) cpp2.c(3445) cpp2.c(3438) cpp2.c(3401) cpp2.c(3400) cpp2.h(320) cpp2.h(318) part.c(221)
do_not_remove_slashes
cpp2.c(4492) cpp2.c(4297) cpp2.c(3692) cpp2.c(3691) cpp2.c(3450) cpp2.c(3447) cpp2.c(3438) cpp2.c(3399) cpp2.c(3398) cpp2.c(428) cpp2.h(317) cpp2.h(315) cpp2.h(97) part.c(277) part.c(214)
extension_html
cpp2.c(3683) cpp2.c(3682) cpp2.c(3420) cpp2.c(3419) cpp2.c(675) cpp2.c(674) cpp2.h(314)
extension_txt
cpp2.c(3676) cpp2.c(3675) cpp2.c(3422) cpp2.c(3421) cpp2.c(673) cpp2.c(672) cpp2.h(311)
text_partial
cpp2.c(3666) cpp2.c(3665) cpp2.c(3449) cpp2.c(3439) cpp2.c(3431) cpp2.c(3424) cpp2.c(3405) cpp2.c(3404) cpp2.h(308) cpp2.h(306) part.c(589) part.c(587)
text_result
cpp2.c(3659) cpp2.c(3658) cpp2.c(3434) cpp2.c(3432) cpp2.c(3425) cpp2.c(3403) cpp2.c(3402) cpp2.h(305) cpp2.h(303) part.c(590)
html_result2
cpp2.c(3652) cpp2.c(3651) cpp2.c(3431) cpp2.c(3424) cpp2.c(3407) cpp2.c(3406) cpp2.c(1672) cpp2.c(1099) cpp2.c(998) cpp2.c(646) cpp2.c(135) cpp2.h(302) cpp2.h(300)
html_result
cpp2.c(3645) cpp2.c(3644) cpp2.c(3431) cpp2.c(3424) cpp2.c(3409) cpp2.c(3408) cpp2.c(1672) cpp2.c(1016) cpp2.c(998) cpp2.c(646) cpp2.c(135) cpp2.h(299) cpp2.h(297)
dirs
cpp2.c(3596) cpp2.c(3413) cpp2.c(1910) cpp2.c(1882) cpp2.c(671) cpp2.c(670) cpp2.h(296) misc.c(391) misc.c(385) misc.h(149)
macro_definition_in_symbol_table
cpp2.c(4451) cpp2.c(3767) cpp2.c(3743) cpp2.c(3740) cpp2.c(1375) cpp2.c(1306) cpp2.c(1305) cpp2.c(707) cpp2.h(285)
nr_of_params
cpp2.c(4452) cpp2.c(3939) cpp2.c(1466) cpp2.c(1376) cpp2.c(1306) cpp2.h(272)
parameter_used_in_concat
cpp2.c(4477) cpp2.c(4228) cpp2.c(1476) cpp2.c(1465) cpp2.h(269)
parameter_used_in_string_literal
cpp2.c(4455) cpp2.c(4215) cpp2.c(1477) cpp2.c(1464) cpp2.h(266)
parameter_used_in_expansion
cpp2.c(4204) cpp2.c(1478) cpp2.c(1463) cpp2.c(1379) cpp2.h(263)
macro_substitution_list
cpp2.c(4250) cpp2.c(4187) cpp2.c(4169) cpp2.c(4154) cpp2.c(4138) cpp2.c(4115) cpp2.c(4105) cpp2.c(4083) cpp2.c(4008) cpp2.c(3744) cpp2.c(1479) cpp2.c(1461) cpp2.h(260)
sl_parameter_nr
cpp2.c(4295) cpp2.c(4287) cpp2.c(4277) cpp2.c(4229) cpp2.c(4216) cpp2.c(4205) cpp2.c(1434) cpp2.h(249)
sl_xstr
cpp2.c(4269) cpp2.c(4258) cpp2.c(4184) cpp2.c(4183) cpp2.c(4183) cpp2.c(4183) cpp2.c(1447) cpp2.c(1446) cpp2.c(1433) cpp2.h(246)
sl_kind
cpp2.c(4291) cpp2.c(4283) cpp2.c(4282) cpp2.c(4273) cpp2.c(4261) cpp2.c(4256) cpp2.c(4256) cpp2.c(4224) cpp2.c(4223) cpp2.c(4211) cpp2.c(4200) cpp2.c(4198) cpp2.c(4196) cpp2.c(4195) cpp2.c(4194) cpp2.c(4180) cpp2.c(4180) cpp2.c(1435) cpp2.h(243)
unexpanded_arg_arr
cpp2.c(4481) cpp2.c(4286) cpp2.c(1417) cpp2.c(1405) cpp2.h(211)
string_literel_arr
cpp2.c(4459) cpp2.c(4276) cpp2.c(1418) cpp2.c(1406) cpp2.h(208)
expanded_arg_arr
cpp2.c(4474) cpp2.c(4294) cpp2.c(1416) cpp2.c(1404) cpp2.h(205)
cpp_html_result_unexpanded
cpp2.c(1209) cpp2.c(1208) cpp2.c(1192) cpp2.c(984) cpp2.c(822) cpp2.c(776) cpp2.c(255) cpp2.c(251) cpp2.c(236) cpp2.h(194)
cpp_html_result_expanded
cpp2.c(1207) cpp2.c(1206) cpp2.c(1193) cpp2.c(981) cpp2.c(828) cpp2.c(784) cpp2.c(267) cpp2.c(238) cpp2.h(191)
cpp_html_result_xstr
cpp2.c(1205) cpp2.c(1204) cpp2.c(1191) cpp2.c(820) cpp2.c(811) cpp2.c(774) cpp2.c(762) cpp2.c(381) cpp2.c(306) cpp2.c(244) cpp2.c(234) cpp2.h(188)
cpp_html_result_kind
cpp2.c(1190) cpp2.c(976) cpp2.c(813) cpp2.c(809) cpp2.c(765) cpp2.c(759) cpp2.c(380) cpp2.c(304) cpp2.c(242) cpp2.c(232) cpp2.h(185)
cpp_macro_inv_sym
cpp2.c(4905) cpp2.c(4521) cpp2.c(355) cpp2.c(290) cpp2.c(213) cpp2.c(116) cpp2.c(92) cpp2.h(87) part.c(191)
cpp_end_macro_invocation
cpp2.c(4904) cpp2.c(4520) cpp2.c(506) cpp2.h(84)

Enumeration variables


DIRECTIVE_EXPRESSION_STAGE_INTERPRET_ERROR
cpp2.c(2434) cpp2.c(2381) cpp2.c(2340) cpp2.h(422)
DIRECTIVE_EXPRESSION_STAGE_UNDEFINED
cpp2.c(3352) cpp2.c(2412) cpp2.h(419)
DIRECTIVE_EXPRESSION_STAGE_INTERPRET
cpp2.c(3121) cpp2.c(2379) cpp2.c(1294) cpp2.h(416)
DIRECTIVE_EXPRESSION_STAGE_EXPAND
cpp2.c(3173) cpp2.c(3105) cpp2.c(2913) cpp2.c(2372) cpp2.c(1584) cpp2.c(459) cpp2.h(413) part.c(817)
DIRECTIVE_EXPRESSION_STAGE_READ
cpp2.c(2909) cpp2.c(2365) cpp2.c(2323) cpp2.c(2305) cpp2.h(410) part.c(813)
MAX_STATE_ELEMENT
cpp2.c(3318) cpp2.h(390)
PART_ENDIF_NEEDED
cpp2.c(3365) cpp2.c(2217) cpp2.c(2122) cpp2.c(1934) cpp2.h(387) part.c(506) part.c(459) part.c(446) part.c(389)
PART_ELIF_IS_1
cpp2.c(3364) cpp2.c(1933) cpp2.h(384) part.c(525) part.c(517) part.c(445) part.c(386)
PART_ELIF_IS_RESOLVED
cpp2.c(3363) cpp2.c(1932) cpp2.h(381) part.c(524) part.c(516) part.c(502) part.c(444) part.c(350)
PART_IF_IS_1
cpp2.c(3362) cpp2.c(1930) cpp2.h(378) part.c(477) part.c(467) part.c(443)
PART_IF_IS_RESOLVED
cpp2.c(3361) cpp2.c(1929) cpp2.h(375) part.c(476) part.c(466) part.c(458) part.c(442) part.c(416) part.c(357) part.c(354)
LAST_EXPRESSION_IF
cpp2.c(2923) cpp2.c(2389) cpp2.c(2342) cpp2.c(2328) cpp2.c(2306) cpp2.h(372) part.c(827)
COND_ALTERNATIVE_FOUND
cpp2.c(3359) cpp2.c(3108) cpp2.c(2916) cpp2.c(2326) cpp2.c(2275) cpp2.c(2255) cpp2.c(2207) cpp2.c(1925) cpp2.c(1564) cpp2.c(1554) cpp2.c(1537) cpp2.c(1532) cpp2.h(369) part.c(820) part.c(512) part.c(492) part.c(472) part.c(464) part.c(456)
SKIP_CONDITIONAL_GROUP
cpp2.c(3360) cpp2.c(3110) cpp2.c(2918) cpp2.c(1927) cpp2.c(1551) cpp2.c(1525) cpp2.h(366) part.c(822) part.c(489) part.c(449) part.c(413)
SKIP_CONDITIONAL_TEXT
cpp2.c(3358) cpp2.c(3213) cpp2.c(2921) cpp2.c(2324) cpp2.c(2273) cpp2.c(2253) cpp2.c(2215) cpp2.c(1923) cpp2.c(1566) cpp2.c(1557) cpp2.c(1539) cpp2.c(1523) cpp2.c(1506) cpp2.h(363) part.c(825) part.c(522) part.c(514) part.c(504) part.c(495) part.c(474) part.c(447) part.c(347)
SL_ARGUMENT_EXPANSION
cpp2.c(4291) cpp2.c(4200) cpp2.c(4194) cpp2.c(4096) cpp2.c(4090) cpp2.h(240)
SL_ARGUMENT_CONCAT
cpp2.c(4282) cpp2.c(4224) cpp2.h(237)
SL_CONCAT_ARGUMENT
cpp2.c(4283) cpp2.c(4223) cpp2.c(4198) cpp2.c(4196) cpp2.c(4093) cpp2.h(234)
SL_CONCAT_STRING
cpp2.c(4256) cpp2.c(4195) cpp2.c(4150) cpp2.c(4136) cpp2.h(231)
SL_STRING_LITERAL
cpp2.c(4273) cpp2.c(4211) cpp2.c(4085) cpp2.h(228)
SL_STRING_WHITESPACE
cpp2.c(4261) cpp2.c(4107) cpp2.c(4010) cpp2.h(225)
SL_STRING
cpp2.c(4256) cpp2.c(4180) cpp2.c(4180) cpp2.c(4150) cpp2.c(4127) cpp2.c(3745) cpp2.h(222)
CPP_HTML_RESULT_MACRO
cpp2.c(976) cpp2.c(813) cpp2.c(765) cpp2.c(233) cpp2.h(182)
CPP_HTML_RESULT_PLAIN_TEXT
cpp2.c(1190) cpp2.c(809) cpp2.c(759) cpp2.c(380) cpp2.c(305) cpp2.c(243) cpp2.h(179)
CPP_HTML_RESULT_EXPANDED
cpp2.c(269) cpp2.c(221) cpp2.c(209) cpp2.h(40)
CPP_HTML_RESULT_UNEXPANDED
cpp2.c(357) cpp2.c(283) cpp2.c(261) cpp2.h(37)
CPP_HTML_RESULT
cpp2.c(1676) cpp2.c(345) cpp2.c(211) cpp2.c(208) cpp2.c(144) cpp2.h(34)

Define definitions


MAIN_INIT
cpp2.h(648) main.c(32)
DIRECTIVE_COLLECT_STAGE_RESULT
cpp2.c(3072) cpp2.c(3044) cpp2.c(1671) cpp2.c(328) cpp2.h(473) part.c(710)
DIRECTIVE_COLLECT_STAGE_DURING_PARSE
cpp2.c(3357) cpp2.c(3034) cpp2.c(3019) cpp2.h(470) part.c(700) part.c(685)
DIRECTIVE_LINE_STAGE_INTERPRET_ERROR
cpp2.c(2058) cpp2.c(2010) cpp2.c(1838) cpp2.h(464)
DIRECTIVE_LINE_STAGE_UNDEFINED
cpp2.c(3355) cpp2.c(2062) cpp2.c(2015) cpp2.h(461)
DIRECTIVE_LINE_STAGE_INTERPRET
cpp2.c(3152) cpp2.c(2056) cpp2.h(458)
DIRECTIVE_LINE_STAGE_EXPAND
cpp2.c(3133) cpp2.c(2950) cpp2.c(2049) cpp2.h(455) part.c(859)
DIRECTIVE_LINE_STAGE_READ
cpp2.c(2947) cpp2.c(2042) cpp2.c(1810) cpp2.h(452) part.c(855)
DIRECTIVE_INCLUDE_STAGE_INTERPRET_ERROR
cpp2.c(1967) cpp2.c(1864) cpp2.c(1849) cpp2.h(446)
DIRECTIVE_INCLUDE_STAGE_UNDEFINED
cpp2.c(3354) cpp2.c(1984) cpp2.h(443)
DIRECTIVE_INCLUDE_STAGE_INCLUDE_FILE
cpp2.c(1916) cpp2.c(1762) cpp2.h(440)
DIRECTIVE_INCLUDE_STAGE_INTERPRET
cpp2.c(3130) cpp2.c(1965) cpp2.h(437)
DIRECTIVE_INCLUDE_STAGE_EXPAND
cpp2.c(3124) cpp2.c(2940) cpp2.c(1958) cpp2.c(1586) cpp2.h(434) part.c(847)
DIRECTIVE_INCLUDE_STAGE_READ
cpp2.c(2936) cpp2.c(1951) cpp2.c(1793) cpp2.h(431) part.c(842)
CPP_COL_BOUND_MEM_NO_HANDLE_SIZE
cpp2.c(4761) cpp2.h(170)
CPP_COL_VAR
cpp2.c(4677) cpp2.c(4562) cpp2.c(4425) cpp2.c(4354) cpp2.h(165)
MAIN_AFTER_SYMBOL_MACRO
cpp2.h(160) misc.c(94)
MISC_MACRO_AFTER_SYMBOL
cpp2.h(149) misc.c(64)
MISC_MACRO_AFTER_NEW_TERMINAL_DUMMY
cpp2.h(145) misc.c(628)
MISC_MACRO_AFTER_FLEX_GET_CHAR
cpp2.h(94) misc.c(1274)
CPP_FILE_ATTP
cpp2.c(4916) cpp2.c(4901) cpp2.h(57)
CPP2HTML_VERSION
cpp2.c(3629) cpp2.c(1004) cpp2.h(53)

Variable definitions


Function definitions


Rule result definitions Bison


Token definitions


Source


1 #/* cpp2html for viewing c preprocessing as hypertext*/ 2 #/**/ 3 #/* Copyright (C) 2003 K.Karamazen*/ 4 #/**/ 5 #/* This program is free software; you can redistribute it and/or modify*/ 6 #/* it under the terms of the GNU General Public License as published by*/ 7 #/* the Free Software Foundation; either version 2 of the License, or*/ 8 #/* (at your option) any later version.*/ 9 #/* */ 10 #/* This program is distributed in the hope that it will be useful,*/ 11 #/* but WITHOUT ANY WARRANTY; without even the implied warranty of*/ 12 #/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the*/ 13 #/* GNU General Public License for more details.*/ 14 #/* */ 15 #ifndef _CPP2_H__ 16 #define _CPP2_H__ 17 #ifndef _CPP2_H 18 #define _CPP2_H 19 #include "col.h" 20 #include "stdio.h" 21 #include "rm1.h" 22 #include "x_io1.h" 23 #include "rbt.h" 24 #include "rbt_shortcuts.h" 25 #include "x_rm1.tab.h" 26 #include "aa.h" 27 #include "misc.h" 28 #include "limits.h" 29 30 typedef enum 31 { 32 /*indicates that text expansion is required */ 33 //DOC_ENUMCONST(CPP_HTML_RESULT DG_GENERATE_HTML_RESULT) 34 CPP_HTML_RESULT, 35 /*indicates that unexpanded macro is required */ 36 //DOC_ENUMCONST(CPP_HTML_RESULT_UNEXPANDED DG_GENERATE_HTML_RESULT) 37 CPP_HTML_RESULT_UNEXPANDED, 38 /*indicates that expanded macro is required */ 39 //DOC_ENUMCONST(CPP_HTML_RESULT_EXPANDED DG_GENERATE_HTML_RESULT) 40 CPP_HTML_RESULT_EXPANDED, 41 /*indicators for collecting html result */ 42 //DOC_TYPEDEF(cpp_html_result_sort_t DG_GENERATE_HTML_RESULT) 43 } cpp_html_result_sort_t; 44 45 #if ! defined PACKAGE 46 #define PACKAGE "cpp2html" 47 #endif 48 #if ! defined VERSION 49 #define VERSION "1.0.* (unknown), compiled on " __DATE__ 50 #endif 51 /*version number*/ 52 //DOC_DEFINE(CPP2HTML_VERSION DG_VERSION) 53 #define CPP2HTML_VERSION PACKAGE " " VERSION 54 55 /*id of file attributes supplement */ 56 //DOC_DEFINE(CPP_FILE_ATTP DG_PARSE_COMMON) 57 #define CPP_FILE_ATTP (COL_NEXT_FREE_TYPE_SLOT+0) 58 59 typedef struct 60 { 61 void *mm_handle; 62 void (*cpp_html_result_close) (void); 63 col_t *(*collect_expanded_text_result) (pleaf_t sym); 64 void (*finalize_define) (pleaf_t sym); 65 void (*pp_save_macro_def2) (pleaf_t sym); 66 col_t *(*cpp_handle_expansion_of_built_in_macros) (char *c); 67 void (*calculate_conditional_state_after_elif) (void); 68 void (*calculate_conditional_state_after_if) (void); 69 void (*finalize_text_to_end_of_line) (pleaf_t sym); 70 /*some functions that can be redefined in other modes */ 71 //DOC_TYPEDEF(cpp_class_t DG_PARSE_COMMON) 72 } cpp_class_t; 73 74 typedef struct 75 { 76 /*collection header */ 77 col_t col; 78 /*AAP of new line characters preceeded by slash encountered */ 79 col_t *cnt_slash_nl; 80 /*add to current line to accommodate #line directive */ 81 long int line_offset; 82 /*symbol to jump after when PP_TOK_END encountered */ 83 //DOC_STRUCTVAR(cpp_end_macro_invocation DG_PARSE_COMMON) 84 pleaf_t cpp_end_macro_invocation; 85 /*macro_invokation symbol that caused the creation of buffer if any */ 86 //DOC_STRUCTVAR(cpp_macro_inv_sym DG_GENERATE_HTML_RESULT) 87 pleaf_t cpp_macro_inv_sym; 88 /*file attributes */ 89 //DOC_TYPEDEF(cpp_file_att_t DG_PARSE_COMMON) 90 } cpp_file_att_t; 91 92 /*to be done after get char*/ 93 //DOC_DEFINE(MISC_MACRO_AFTER_FLEX_GET_CHAR DG_PARSE_COMMON) 94 #define MISC_MACRO_AFTER_FLEX_GET_CHAR()\ 95 {\ 96 static int recursion_flag=0;\ 97 if(cmd_ln&&cmd_ln->do_not_remove_slashes&&return_char=='\t')\ 98 {\ 99 int distance=part_distance_from_last_newline(p->current_text_heap,*flex_num_chars_x-1);\ 100 return_char=' ';\ 101 DER(val_xstring(p->current_text_heap->xstring)+length_xstring(p->current_text_heap->xstring)-1)=' ';\ 1