Fossil SCM

Merge fork

andygoth 2016-11-05 05:46 trunk merge
Commit 3cb9ba4de68923d05c850c714c093c8406e1d10d
--- skins/black_and_white/css.txt
+++ skins/black_and_white/css.txt
@@ -106,16 +106,16 @@
106106
border-width:1px 0px;
107107
background-color: #eee;
108108
color: #333;
109109
}
110110
div.submenu a, div.submenu a:visited, div.sectionmenu>a.button:link,
111
-div.sectionmenu>a.button:visited {
111
+div.sectionmenu>a.button:visited, div.submenu label {
112112
padding: 3px 10px 3px 10px;
113113
color: #333;
114114
text-decoration: none;
115115
}
116
-div.submenu a:hover, div.sectionmenu>a.button:hover {
116
+div.submenu a:hover, div.sectionmenu>a.button:hover, div.submenu label:hover {
117117
color: #eee;
118118
background-color: #333;
119119
}
120120
121121
/* All page content from the bottom of the menu or submenu down to
122122
--- skins/black_and_white/css.txt
+++ skins/black_and_white/css.txt
@@ -106,16 +106,16 @@
106 border-width:1px 0px;
107 background-color: #eee;
108 color: #333;
109 }
110 div.submenu a, div.submenu a:visited, div.sectionmenu>a.button:link,
111 div.sectionmenu>a.button:visited {
112 padding: 3px 10px 3px 10px;
113 color: #333;
114 text-decoration: none;
115 }
116 div.submenu a:hover, div.sectionmenu>a.button:hover {
117 color: #eee;
118 background-color: #333;
119 }
120
121 /* All page content from the bottom of the menu or submenu down to
122
--- skins/black_and_white/css.txt
+++ skins/black_and_white/css.txt
@@ -106,16 +106,16 @@
106 border-width:1px 0px;
107 background-color: #eee;
108 color: #333;
109 }
110 div.submenu a, div.submenu a:visited, div.sectionmenu>a.button:link,
111 div.sectionmenu>a.button:visited, div.submenu label {
112 padding: 3px 10px 3px 10px;
113 color: #333;
114 text-decoration: none;
115 }
116 div.submenu a:hover, div.sectionmenu>a.button:hover, div.submenu label:hover {
117 color: #eee;
118 background-color: #333;
119 }
120
121 /* All page content from the bottom of the menu or submenu down to
122
--- skins/blitz/css.txt
+++ skins/blitz/css.txt
@@ -894,19 +894,19 @@
894894
895895
.submenu input, .submenu select {
896896
margin: 0 0 0 5px;
897897
}
898898
899
-.submenu a {
899
+.submenu a, .submenu label {
900900
color: #3b5c6b;
901901
padding: 5px 15px;
902902
text-decoration: none;
903903
border: 1px solid transparent;
904904
border-radius: 5px;
905905
}
906906
907
-.submenu a:hover {
907
+.submenu a:hover, .submenu label:hover {
908908
border: 1px solid #ccc;
909909
}
910910
911911
912912
/* Section
913913
--- skins/blitz/css.txt
+++ skins/blitz/css.txt
@@ -894,19 +894,19 @@
894
895 .submenu input, .submenu select {
896 margin: 0 0 0 5px;
897 }
898
899 .submenu a {
900 color: #3b5c6b;
901 padding: 5px 15px;
902 text-decoration: none;
903 border: 1px solid transparent;
904 border-radius: 5px;
905 }
906
907 .submenu a:hover {
908 border: 1px solid #ccc;
909 }
910
911
912 /* Section
913
--- skins/blitz/css.txt
+++ skins/blitz/css.txt
@@ -894,19 +894,19 @@
894
895 .submenu input, .submenu select {
896 margin: 0 0 0 5px;
897 }
898
899 .submenu a, .submenu label {
900 color: #3b5c6b;
901 padding: 5px 15px;
902 text-decoration: none;
903 border: 1px solid transparent;
904 border-radius: 5px;
905 }
906
907 .submenu a:hover, .submenu label:hover {
908 border: 1px solid #ccc;
909 }
910
911
912 /* Section
913
--- skins/blitz_no_logo/css.txt
+++ skins/blitz_no_logo/css.txt
@@ -894,19 +894,19 @@
894894
895895
.submenu input, .submenu select {
896896
margin: 0 0 0 5px;
897897
}
898898
899
-.submenu a {
899
+.submenu a, .submenu label {
900900
color: #3b5c6b;
901901
padding: 5px 15px;
902902
text-decoration: none;
903903
border: 1px solid transparent;
904904
border-radius: 5px;
905905
}
906906
907
-.submenu a:hover {
907
+.submenu a:hover, .submenu label:hover {
908908
border: 1px solid #ccc;
909909
}
910910
911911
912912
/* Section
913913
--- skins/blitz_no_logo/css.txt
+++ skins/blitz_no_logo/css.txt
@@ -894,19 +894,19 @@
894
895 .submenu input, .submenu select {
896 margin: 0 0 0 5px;
897 }
898
899 .submenu a {
900 color: #3b5c6b;
901 padding: 5px 15px;
902 text-decoration: none;
903 border: 1px solid transparent;
904 border-radius: 5px;
905 }
906
907 .submenu a:hover {
908 border: 1px solid #ccc;
909 }
910
911
912 /* Section
913
--- skins/blitz_no_logo/css.txt
+++ skins/blitz_no_logo/css.txt
@@ -894,19 +894,19 @@
894
895 .submenu input, .submenu select {
896 margin: 0 0 0 5px;
897 }
898
899 .submenu a, .submenu label {
900 color: #3b5c6b;
901 padding: 5px 15px;
902 text-decoration: none;
903 border: 1px solid transparent;
904 border-radius: 5px;
905 }
906
907 .submenu a:hover, .submenu label:hover {
908 border: 1px solid #ccc;
909 }
910
911
912 /* Section
913
--- skins/default/css.txt
+++ skins/default/css.txt
@@ -104,17 +104,17 @@
104104
margin-top: 10px;
105105
padding: 10px;
106106
border-bottom: 1px solid #ccc;
107107
}
108108
109
-.submenu a {
109
+.submenu a, .submenu label {
110110
padding: 10px 11px;
111111
text-decoration:none;
112112
color: #777;
113113
}
114114
115
-.submenu a:hover {
115
+.submenu a:hover, .submenu label:hover {
116116
padding: 6px 10px;
117117
border: 1px solid #ccc;
118118
border-radius: 5px;
119119
color: #000;
120120
}
121121
--- skins/default/css.txt
+++ skins/default/css.txt
@@ -104,17 +104,17 @@
104 margin-top: 10px;
105 padding: 10px;
106 border-bottom: 1px solid #ccc;
107 }
108
109 .submenu a {
110 padding: 10px 11px;
111 text-decoration:none;
112 color: #777;
113 }
114
115 .submenu a:hover {
116 padding: 6px 10px;
117 border: 1px solid #ccc;
118 border-radius: 5px;
119 color: #000;
120 }
121
--- skins/default/css.txt
+++ skins/default/css.txt
@@ -104,17 +104,17 @@
104 margin-top: 10px;
105 padding: 10px;
106 border-bottom: 1px solid #ccc;
107 }
108
109 .submenu a, .submenu label {
110 padding: 10px 11px;
111 text-decoration:none;
112 color: #777;
113 }
114
115 .submenu a:hover, .submenu label:hover {
116 padding: 6px 10px;
117 border: 1px solid #ccc;
118 border-radius: 5px;
119 color: #000;
120 }
121
--- skins/eagle/css.txt
+++ skins/eagle/css.txt
@@ -73,16 +73,18 @@
7373
text-align: center;
7474
background-color: #485D7B;
7575
color: white;
7676
}
7777
div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
78
-div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
78
+div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited,
79
+div.submenu label {
7980
padding: 3px 10px 3px 10px;
8081
color: white;
8182
text-decoration: none;
8283
}
83
-div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
84
+div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover,
85
+div.submenu label:hover {
8486
text-decoration: underline;
8587
}
8688
8789
/* All page content from the bottom of the menu or submenu down to
8890
** the footer */
8991
--- skins/eagle/css.txt
+++ skins/eagle/css.txt
@@ -73,16 +73,18 @@
73 text-align: center;
74 background-color: #485D7B;
75 color: white;
76 }
77 div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
78 div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
 
79 padding: 3px 10px 3px 10px;
80 color: white;
81 text-decoration: none;
82 }
83 div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
 
84 text-decoration: underline;
85 }
86
87 /* All page content from the bottom of the menu or submenu down to
88 ** the footer */
89
--- skins/eagle/css.txt
+++ skins/eagle/css.txt
@@ -73,16 +73,18 @@
73 text-align: center;
74 background-color: #485D7B;
75 color: white;
76 }
77 div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
78 div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited,
79 div.submenu label {
80 padding: 3px 10px 3px 10px;
81 color: white;
82 text-decoration: none;
83 }
84 div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover,
85 div.submenu label:hover {
86 text-decoration: underline;
87 }
88
89 /* All page content from the bottom of the menu or submenu down to
90 ** the footer */
91
--- skins/enhanced1/css.txt
+++ skins/enhanced1/css.txt
@@ -71,16 +71,18 @@
7171
text-align: center;
7272
background-color: #456878;
7373
color: white;
7474
}
7575
div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
76
-div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
76
+div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited,
77
+div.submenu label {
7778
padding: 3px 10px 3px 10px;
7879
color: white;
7980
text-decoration: none;
8081
}
81
-div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
82
+div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover,
83
+div.submenu label:hover {
8284
color: #558195;
8385
background-color: white;
8486
}
8587
8688
/* All page content from the bottom of the menu or submenu down to
8789
--- skins/enhanced1/css.txt
+++ skins/enhanced1/css.txt
@@ -71,16 +71,18 @@
71 text-align: center;
72 background-color: #456878;
73 color: white;
74 }
75 div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
76 div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
 
77 padding: 3px 10px 3px 10px;
78 color: white;
79 text-decoration: none;
80 }
81 div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
 
82 color: #558195;
83 background-color: white;
84 }
85
86 /* All page content from the bottom of the menu or submenu down to
87
--- skins/enhanced1/css.txt
+++ skins/enhanced1/css.txt
@@ -71,16 +71,18 @@
71 text-align: center;
72 background-color: #456878;
73 color: white;
74 }
75 div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
76 div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited,
77 div.submenu label {
78 padding: 3px 10px 3px 10px;
79 color: white;
80 text-decoration: none;
81 }
82 div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover,
83 div.submenu label:hover {
84 color: #558195;
85 background-color: white;
86 }
87
88 /* All page content from the bottom of the menu or submenu down to
89
--- skins/khaki/css.txt
+++ skins/khaki/css.txt
@@ -69,16 +69,18 @@
6969
text-align: center;
7070
background-color: #c0af58;
7171
color: white;
7272
}
7373
div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
74
-div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
74
+div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited,
75
+div.submenu label {
7576
padding: 3px 10px 3px 10px;
7677
color: white;
7778
text-decoration: none;
7879
}
79
-div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
80
+div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover
81
+div.submenu label:hover {
8082
color: #a09048;
8183
background-color: white;
8284
}
8385
8486
/* All page content from the bottom of the menu or submenu down to
8587
--- skins/khaki/css.txt
+++ skins/khaki/css.txt
@@ -69,16 +69,18 @@
69 text-align: center;
70 background-color: #c0af58;
71 color: white;
72 }
73 div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
74 div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
 
75 padding: 3px 10px 3px 10px;
76 color: white;
77 text-decoration: none;
78 }
79 div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
 
80 color: #a09048;
81 background-color: white;
82 }
83
84 /* All page content from the bottom of the menu or submenu down to
85
--- skins/khaki/css.txt
+++ skins/khaki/css.txt
@@ -69,16 +69,18 @@
69 text-align: center;
70 background-color: #c0af58;
71 color: white;
72 }
73 div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
74 div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited,
75 div.submenu label {
76 padding: 3px 10px 3px 10px;
77 color: white;
78 text-decoration: none;
79 }
80 div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover
81 div.submenu label:hover {
82 color: #a09048;
83 background-color: white;
84 }
85
86 /* All page content from the bottom of the menu or submenu down to
87
--- skins/original/css.txt
+++ skins/original/css.txt
@@ -71,16 +71,18 @@
7171
text-align: center;
7272
background-color: #456878;
7373
color: white;
7474
}
7575
div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
76
-div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
76
+div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited,
77
+div.submenu label {
7778
padding: 3px 10px 3px 10px;
7879
color: white;
7980
text-decoration: none;
8081
}
81
-div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
82
+div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover,
83
+div.submenu label:hover {
8284
color: #558195;
8385
background-color: white;
8486
}
8587
8688
/* All page content from the bottom of the menu or submenu down to
8789
--- skins/original/css.txt
+++ skins/original/css.txt
@@ -71,16 +71,18 @@
71 text-align: center;
72 background-color: #456878;
73 color: white;
74 }
75 div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
76 div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
 
77 padding: 3px 10px 3px 10px;
78 color: white;
79 text-decoration: none;
80 }
81 div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
 
82 color: #558195;
83 background-color: white;
84 }
85
86 /* All page content from the bottom of the menu or submenu down to
87
--- skins/original/css.txt
+++ skins/original/css.txt
@@ -71,16 +71,18 @@
71 text-align: center;
72 background-color: #456878;
73 color: white;
74 }
75 div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
76 div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited,
77 div.submenu label {
78 padding: 3px 10px 3px 10px;
79 color: white;
80 text-decoration: none;
81 }
82 div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover,
83 div.submenu label:hover {
84 color: #558195;
85 background-color: white;
86 }
87
88 /* All page content from the bottom of the menu or submenu down to
89
--- skins/plain_gray/css.txt
+++ skins/plain_gray/css.txt
@@ -71,16 +71,18 @@
7171
text-align: center;
7272
background-color: #606060;
7373
color: white;
7474
}
7575
div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
76
-div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
76
+div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited,
77
+div.submenu label {
7778
padding: 3px 10px 3px 10px;
7879
color: white;
7980
text-decoration: none;
8081
}
81
-div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
82
+div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover,
83
+div.submenu label:hover {
8284
color: #404040;
8385
background-color: white;
8486
}
8587
8688
/* All page content from the bottom of the menu or submenu down to
8789
--- skins/plain_gray/css.txt
+++ skins/plain_gray/css.txt
@@ -71,16 +71,18 @@
71 text-align: center;
72 background-color: #606060;
73 color: white;
74 }
75 div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
76 div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
 
77 padding: 3px 10px 3px 10px;
78 color: white;
79 text-decoration: none;
80 }
81 div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
 
82 color: #404040;
83 background-color: white;
84 }
85
86 /* All page content from the bottom of the menu or submenu down to
87
--- skins/plain_gray/css.txt
+++ skins/plain_gray/css.txt
@@ -71,16 +71,18 @@
71 text-align: center;
72 background-color: #606060;
73 color: white;
74 }
75 div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
76 div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited,
77 div.submenu label {
78 padding: 3px 10px 3px 10px;
79 color: white;
80 text-decoration: none;
81 }
82 div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover,
83 div.submenu label:hover {
84 color: #404040;
85 background-color: white;
86 }
87
88 /* All page content from the bottom of the menu or submenu down to
89
--- skins/rounded1/css.txt
+++ skins/rounded1/css.txt
@@ -84,11 +84,11 @@
8484
div.mainmenu a, div.mainmenu a:visited {
8585
padding: 3px 10px 3px 10px;
8686
color: white;
8787
text-decoration: none;
8888
}
89
-div.submenu a, div.submenu a:visited, a.button,
89
+div.submenu a, div.submenu a:visited, a.button, div.submenu label
9090
div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
9191
padding: 2px 8px;
9292
color: #000;
9393
font-family: Arial;
9494
text-decoration: none;
@@ -102,11 +102,11 @@
102102
div.mainmenu a:hover {
103103
color: #000;
104104
background-color: white;
105105
}
106106
107
-div.submenu a:hover, div.sectionmenu>a.button:hover {
107
+div.submenu a:hover, div.sectionmenu>a.button:hover, div.submenu label:hover {
108108
background-color: #c0c0c0;
109109
}
110110
111111
/* All page content from the bottom of the menu or submenu down to
112112
** the footer */
113113
--- skins/rounded1/css.txt
+++ skins/rounded1/css.txt
@@ -84,11 +84,11 @@
84 div.mainmenu a, div.mainmenu a:visited {
85 padding: 3px 10px 3px 10px;
86 color: white;
87 text-decoration: none;
88 }
89 div.submenu a, div.submenu a:visited, a.button,
90 div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
91 padding: 2px 8px;
92 color: #000;
93 font-family: Arial;
94 text-decoration: none;
@@ -102,11 +102,11 @@
102 div.mainmenu a:hover {
103 color: #000;
104 background-color: white;
105 }
106
107 div.submenu a:hover, div.sectionmenu>a.button:hover {
108 background-color: #c0c0c0;
109 }
110
111 /* All page content from the bottom of the menu or submenu down to
112 ** the footer */
113
--- skins/rounded1/css.txt
+++ skins/rounded1/css.txt
@@ -84,11 +84,11 @@
84 div.mainmenu a, div.mainmenu a:visited {
85 padding: 3px 10px 3px 10px;
86 color: white;
87 text-decoration: none;
88 }
89 div.submenu a, div.submenu a:visited, a.button, div.submenu label
90 div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
91 padding: 2px 8px;
92 color: #000;
93 font-family: Arial;
94 text-decoration: none;
@@ -102,11 +102,11 @@
102 div.mainmenu a:hover {
103 color: #000;
104 background-color: white;
105 }
106
107 div.submenu a:hover, div.sectionmenu>a.button:hover, div.submenu label:hover {
108 background-color: #c0c0c0;
109 }
110
111 /* All page content from the bottom of the menu or submenu down to
112 ** the footer */
113
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -158,17 +158,17 @@
158158
border-top: 1px solid #0a0;
159159
border-radius: 0;
160160
display: block;
161161
}
162162
163
-div.mainmenu a, div.submenu a {
163
+div.mainmenu a, div.submenu a, div.submenu label {
164164
color: #000;
165165
padding: 0 0.75rem;
166166
text-decoration: none;
167167
}
168168
169
-div.mainmenu a:hover, div.submenu a:hover {
169
+div.mainmenu a:hover, div.submenu a:hover, div.submenu label:hover {
170170
color: #fff;
171171
text-shadow: 0px 0px 6px #0f0;
172172
}
173173
174174
div.submenu * {
175175
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -158,17 +158,17 @@
158 border-top: 1px solid #0a0;
159 border-radius: 0;
160 display: block;
161 }
162
163 div.mainmenu a, div.submenu a {
164 color: #000;
165 padding: 0 0.75rem;
166 text-decoration: none;
167 }
168
169 div.mainmenu a:hover, div.submenu a:hover {
170 color: #fff;
171 text-shadow: 0px 0px 6px #0f0;
172 }
173
174 div.submenu * {
175
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -158,17 +158,17 @@
158 border-top: 1px solid #0a0;
159 border-radius: 0;
160 display: block;
161 }
162
163 div.mainmenu a, div.submenu a, div.submenu label {
164 color: #000;
165 padding: 0 0.75rem;
166 text-decoration: none;
167 }
168
169 div.mainmenu a:hover, div.submenu a:hover, div.submenu label:hover {
170 color: #fff;
171 text-shadow: 0px 0px 6px #0f0;
172 }
173
174 div.submenu * {
175
+4 -4
--- src/bisect.c
+++ src/bisect.c
@@ -75,11 +75,11 @@
7575
** Return the value of a boolean bisect option.
7676
*/
7777
int bisect_option(const char *zName){
7878
unsigned int i;
7979
int r = -1;
80
- for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){
80
+ for(i=0; i<count(aBisectOption); i++){
8181
if( fossil_strcmp(zName, aBisectOption[i].zName)==0 ){
8282
char *zLabel = mprintf("bisect-%s", zName);
8383
char *z = db_lget(zLabel, (char*)aBisectOption[i].zDefault);
8484
if( is_truth(z) ) r = 1;
8585
if( is_false(z) ) r = 0;
@@ -406,21 +406,21 @@
406406
}else if( strncmp(zCmd, "chart", n)==0 ){
407407
bisect_chart(1);
408408
}else if( strncmp(zCmd, "options", n)==0 ){
409409
if( g.argc==3 ){
410410
unsigned int i;
411
- for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){
411
+ for(i=0; i<count(aBisectOption); i++){
412412
char *z = mprintf("bisect-%s", aBisectOption[i].zName);
413413
fossil_print(" %-15s %-6s ", aBisectOption[i].zName,
414414
db_lget(z, (char*)aBisectOption[i].zDefault));
415415
fossil_free(z);
416416
comment_print(aBisectOption[i].zDesc, 0, 27, -1, g.comFmtFlags);
417417
}
418418
}else if( g.argc==4 || g.argc==5 ){
419419
unsigned int i;
420420
n = strlen(g.argv[3]);
421
- for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){
421
+ for(i=0; i<count(aBisectOption); i++){
422422
if( strncmp(g.argv[3], aBisectOption[i].zName, n)==0 ){
423423
char *z = mprintf("bisect-%s", aBisectOption[i].zName);
424424
if( g.argc==5 ){
425425
db_lset(z, g.argv[4]);
426426
}
@@ -427,11 +427,11 @@
427427
fossil_print("%s\n", db_lget(z, (char*)aBisectOption[i].zDefault));
428428
fossil_free(z);
429429
break;
430430
}
431431
}
432
- if( i>=sizeof(aBisectOption)/sizeof(aBisectOption[0]) ){
432
+ if( i>=count(aBisectOption) ){
433433
fossil_fatal("no such bisect option: %s", g.argv[3]);
434434
}
435435
}else{
436436
usage("options ?NAME? ?VALUE?");
437437
}
438438
--- src/bisect.c
+++ src/bisect.c
@@ -75,11 +75,11 @@
75 ** Return the value of a boolean bisect option.
76 */
77 int bisect_option(const char *zName){
78 unsigned int i;
79 int r = -1;
80 for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){
81 if( fossil_strcmp(zName, aBisectOption[i].zName)==0 ){
82 char *zLabel = mprintf("bisect-%s", zName);
83 char *z = db_lget(zLabel, (char*)aBisectOption[i].zDefault);
84 if( is_truth(z) ) r = 1;
85 if( is_false(z) ) r = 0;
@@ -406,21 +406,21 @@
406 }else if( strncmp(zCmd, "chart", n)==0 ){
407 bisect_chart(1);
408 }else if( strncmp(zCmd, "options", n)==0 ){
409 if( g.argc==3 ){
410 unsigned int i;
411 for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){
412 char *z = mprintf("bisect-%s", aBisectOption[i].zName);
413 fossil_print(" %-15s %-6s ", aBisectOption[i].zName,
414 db_lget(z, (char*)aBisectOption[i].zDefault));
415 fossil_free(z);
416 comment_print(aBisectOption[i].zDesc, 0, 27, -1, g.comFmtFlags);
417 }
418 }else if( g.argc==4 || g.argc==5 ){
419 unsigned int i;
420 n = strlen(g.argv[3]);
421 for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){
422 if( strncmp(g.argv[3], aBisectOption[i].zName, n)==0 ){
423 char *z = mprintf("bisect-%s", aBisectOption[i].zName);
424 if( g.argc==5 ){
425 db_lset(z, g.argv[4]);
426 }
@@ -427,11 +427,11 @@
427 fossil_print("%s\n", db_lget(z, (char*)aBisectOption[i].zDefault));
428 fossil_free(z);
429 break;
430 }
431 }
432 if( i>=sizeof(aBisectOption)/sizeof(aBisectOption[0]) ){
433 fossil_fatal("no such bisect option: %s", g.argv[3]);
434 }
435 }else{
436 usage("options ?NAME? ?VALUE?");
437 }
438
--- src/bisect.c
+++ src/bisect.c
@@ -75,11 +75,11 @@
75 ** Return the value of a boolean bisect option.
76 */
77 int bisect_option(const char *zName){
78 unsigned int i;
79 int r = -1;
80 for(i=0; i<count(aBisectOption); i++){
81 if( fossil_strcmp(zName, aBisectOption[i].zName)==0 ){
82 char *zLabel = mprintf("bisect-%s", zName);
83 char *z = db_lget(zLabel, (char*)aBisectOption[i].zDefault);
84 if( is_truth(z) ) r = 1;
85 if( is_false(z) ) r = 0;
@@ -406,21 +406,21 @@
406 }else if( strncmp(zCmd, "chart", n)==0 ){
407 bisect_chart(1);
408 }else if( strncmp(zCmd, "options", n)==0 ){
409 if( g.argc==3 ){
410 unsigned int i;
411 for(i=0; i<count(aBisectOption); i++){
412 char *z = mprintf("bisect-%s", aBisectOption[i].zName);
413 fossil_print(" %-15s %-6s ", aBisectOption[i].zName,
414 db_lget(z, (char*)aBisectOption[i].zDefault));
415 fossil_free(z);
416 comment_print(aBisectOption[i].zDesc, 0, 27, -1, g.comFmtFlags);
417 }
418 }else if( g.argc==4 || g.argc==5 ){
419 unsigned int i;
420 n = strlen(g.argv[3]);
421 for(i=0; i<count(aBisectOption); i++){
422 if( strncmp(g.argv[3], aBisectOption[i].zName, n)==0 ){
423 char *z = mprintf("bisect-%s", aBisectOption[i].zName);
424 if( g.argc==5 ){
425 db_lset(z, g.argv[4]);
426 }
@@ -427,11 +427,11 @@
427 fossil_print("%s\n", db_lget(z, (char*)aBisectOption[i].zDefault));
428 fossil_free(z);
429 break;
430 }
431 }
432 if( i>=count(aBisectOption) ){
433 fossil_fatal("no such bisect option: %s", g.argv[3]);
434 }
435 }else{
436 usage("options ?NAME? ?VALUE?");
437 }
438
+1 -1
--- src/branch.c
+++ src/branch.c
@@ -350,11 +350,11 @@
350350
int show_colors = PB("colors");
351351
login_check_credentials();
352352
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
353353
style_header("Branches");
354354
style_adunit_config(ADUNIT_RIGHT_OK);
355
- style_submenu_binary("colors", "Color", "B/W", 0);
355
+ style_submenu_checkbox("colors", "Use Branch Colors", 0);
356356
login_anonymous_available();
357357
358358
db_prepare(&q, brlistQuery/*works-like:""*/);
359359
rNow = db_double(0.0, "SELECT julianday('now')");
360360
@ <div class="brlist"><table id="branchlisttable">
361361
--- src/branch.c
+++ src/branch.c
@@ -350,11 +350,11 @@
350 int show_colors = PB("colors");
351 login_check_credentials();
352 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
353 style_header("Branches");
354 style_adunit_config(ADUNIT_RIGHT_OK);
355 style_submenu_binary("colors", "Color", "B/W", 0);
356 login_anonymous_available();
357
358 db_prepare(&q, brlistQuery/*works-like:""*/);
359 rNow = db_double(0.0, "SELECT julianday('now')");
360 @ <div class="brlist"><table id="branchlisttable">
361
--- src/branch.c
+++ src/branch.c
@@ -350,11 +350,11 @@
350 int show_colors = PB("colors");
351 login_check_credentials();
352 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
353 style_header("Branches");
354 style_adunit_config(ADUNIT_RIGHT_OK);
355 style_submenu_checkbox("colors", "Use Branch Colors", 0);
356 login_anonymous_available();
357
358 db_prepare(&q, brlistQuery/*works-like:""*/);
359 rNow = db_double(0.0, "SELECT julianday('now')");
360 @ <div class="brlist"><table id="branchlisttable">
361
+2 -2
--- src/builtin.c
+++ src/builtin.c
@@ -33,11 +33,11 @@
3333
** Return a pointer to built-in content
3434
*/
3535
const unsigned char *builtin_file(const char *zFilename, int *piSize){
3636
int lwr, upr, i, c;
3737
lwr = 0;
38
- upr = sizeof(aBuiltinFiles)/sizeof(aBuiltinFiles[0]) - 1;
38
+ upr = count(aBuiltinFiles) - 1;
3939
while( upr>=lwr ){
4040
i = (upr+lwr)/2;
4141
c = strcmp(aBuiltinFiles[i].zName,zFilename);
4242
if( c<0 ){
4343
lwr = i+1;
@@ -60,11 +60,11 @@
6060
**
6161
** List the names and sizes of all built-in resources.
6262
*/
6363
void test_builtin_list(void){
6464
int i;
65
- for(i=0; i<sizeof(aBuiltinFiles)/sizeof(aBuiltinFiles[0]); i++){
65
+ for(i=0; i<count(aBuiltinFiles); i++){
6666
fossil_print("%-30s %6d\n", aBuiltinFiles[i].zName,aBuiltinFiles[i].nByte);
6767
}
6868
}
6969
7070
/*
7171
--- src/builtin.c
+++ src/builtin.c
@@ -33,11 +33,11 @@
33 ** Return a pointer to built-in content
34 */
35 const unsigned char *builtin_file(const char *zFilename, int *piSize){
36 int lwr, upr, i, c;
37 lwr = 0;
38 upr = sizeof(aBuiltinFiles)/sizeof(aBuiltinFiles[0]) - 1;
39 while( upr>=lwr ){
40 i = (upr+lwr)/2;
41 c = strcmp(aBuiltinFiles[i].zName,zFilename);
42 if( c<0 ){
43 lwr = i+1;
@@ -60,11 +60,11 @@
60 **
61 ** List the names and sizes of all built-in resources.
62 */
63 void test_builtin_list(void){
64 int i;
65 for(i=0; i<sizeof(aBuiltinFiles)/sizeof(aBuiltinFiles[0]); i++){
66 fossil_print("%-30s %6d\n", aBuiltinFiles[i].zName,aBuiltinFiles[i].nByte);
67 }
68 }
69
70 /*
71
--- src/builtin.c
+++ src/builtin.c
@@ -33,11 +33,11 @@
33 ** Return a pointer to built-in content
34 */
35 const unsigned char *builtin_file(const char *zFilename, int *piSize){
36 int lwr, upr, i, c;
37 lwr = 0;
38 upr = count(aBuiltinFiles) - 1;
39 while( upr>=lwr ){
40 i = (upr+lwr)/2;
41 c = strcmp(aBuiltinFiles[i].zName,zFilename);
42 if( c<0 ){
43 lwr = i+1;
@@ -60,11 +60,11 @@
60 **
61 ** List the names and sizes of all built-in resources.
62 */
63 void test_builtin_list(void){
64 int i;
65 for(i=0; i<count(aBuiltinFiles); i++){
66 fossil_print("%-30s %6d\n", aBuiltinFiles[i].zName,aBuiltinFiles[i].nByte);
67 }
68 }
69
70 /*
71
+1 -1
--- src/cgi.c
+++ src/cgi.c
@@ -719,11 +719,11 @@
719719
}
720720
}
721721
zName = 0;
722722
showBytes = 0;
723723
}else{
724
- nArg = tokenize_line(zLine, sizeof(azArg)/sizeof(azArg[0]), azArg);
724
+ nArg = tokenize_line(zLine, count(azArg), azArg);
725725
for(i=0; i<nArg; i++){
726726
int c = fossil_tolower(azArg[i][0]);
727727
int n = strlen(azArg[i]);
728728
if( c=='c' && sqlite3_strnicmp(azArg[i],"content-disposition:",n)==0 ){
729729
i++;
730730
--- src/cgi.c
+++ src/cgi.c
@@ -719,11 +719,11 @@
719 }
720 }
721 zName = 0;
722 showBytes = 0;
723 }else{
724 nArg = tokenize_line(zLine, sizeof(azArg)/sizeof(azArg[0]), azArg);
725 for(i=0; i<nArg; i++){
726 int c = fossil_tolower(azArg[i][0]);
727 int n = strlen(azArg[i]);
728 if( c=='c' && sqlite3_strnicmp(azArg[i],"content-disposition:",n)==0 ){
729 i++;
730
--- src/cgi.c
+++ src/cgi.c
@@ -719,11 +719,11 @@
719 }
720 }
721 zName = 0;
722 showBytes = 0;
723 }else{
724 nArg = tokenize_line(zLine, count(azArg), azArg);
725 for(i=0; i<nArg; i++){
726 int c = fossil_tolower(azArg[i][0]);
727 int n = strlen(azArg[i]);
728 if( c=='c' && sqlite3_strnicmp(azArg[i],"content-disposition:",n)==0 ){
729 i++;
730
+1 -1
--- src/db.c
+++ src/db.c
@@ -2799,11 +2799,11 @@
27992799
*/
28002800
const Setting *db_find_setting(const char *zName, int allowPrefix){
28012801
int lwr, mid, upr, c;
28022802
int n = (int)strlen(zName) + !allowPrefix;
28032803
lwr = 0;
2804
- upr = ArraySize(aSetting)-2;
2804
+ upr = count(aSetting)-2;
28052805
while( upr>=lwr ){
28062806
mid = (upr+lwr)/2;
28072807
c = fossil_strncmp(zName, aSetting[mid].name, n);
28082808
if( c<0 ){
28092809
upr = mid - 1;
28102810
--- src/db.c
+++ src/db.c
@@ -2799,11 +2799,11 @@
2799 */
2800 const Setting *db_find_setting(const char *zName, int allowPrefix){
2801 int lwr, mid, upr, c;
2802 int n = (int)strlen(zName) + !allowPrefix;
2803 lwr = 0;
2804 upr = ArraySize(aSetting)-2;
2805 while( upr>=lwr ){
2806 mid = (upr+lwr)/2;
2807 c = fossil_strncmp(zName, aSetting[mid].name, n);
2808 if( c<0 ){
2809 upr = mid - 1;
2810
--- src/db.c
+++ src/db.c
@@ -2799,11 +2799,11 @@
2799 */
2800 const Setting *db_find_setting(const char *zName, int allowPrefix){
2801 int lwr, mid, upr, c;
2802 int n = (int)strlen(zName) + !allowPrefix;
2803 lwr = 0;
2804 upr = count(aSetting)-2;
2805 while( upr>=lwr ){
2806 mid = (upr+lwr)/2;
2807 c = fossil_strncmp(zName, aSetting[mid].name, n);
2808 if( c<0 ){
2809 upr = mid - 1;
2810
+1 -1
--- src/diff.c
+++ src/diff.c
@@ -1068,11 +1068,11 @@
10681068
if( nLeft>mnLen ) memset(aM+mnLen, 1, nLeft-mnLen);
10691069
if( nRight>mnLen ) memset(aM+mnLen, 2, nRight-mnLen);
10701070
return aM;
10711071
}
10721072
1073
- if( nRight < (sizeof(aBuf)/sizeof(aBuf[0]))-1 ){
1073
+ if( nRight < count(aBuf)-1 ){
10741074
pToFree = 0;
10751075
a = aBuf;
10761076
}else{
10771077
a = pToFree = fossil_malloc( sizeof(a[0])*(nRight+1) );
10781078
}
10791079
--- src/diff.c
+++ src/diff.c
@@ -1068,11 +1068,11 @@
1068 if( nLeft>mnLen ) memset(aM+mnLen, 1, nLeft-mnLen);
1069 if( nRight>mnLen ) memset(aM+mnLen, 2, nRight-mnLen);
1070 return aM;
1071 }
1072
1073 if( nRight < (sizeof(aBuf)/sizeof(aBuf[0]))-1 ){
1074 pToFree = 0;
1075 a = aBuf;
1076 }else{
1077 a = pToFree = fossil_malloc( sizeof(a[0])*(nRight+1) );
1078 }
1079
--- src/diff.c
+++ src/diff.c
@@ -1068,11 +1068,11 @@
1068 if( nLeft>mnLen ) memset(aM+mnLen, 1, nLeft-mnLen);
1069 if( nRight>mnLen ) memset(aM+mnLen, 2, nRight-mnLen);
1070 return aM;
1071 }
1072
1073 if( nRight < count(aBuf)-1 ){
1074 pToFree = 0;
1075 a = aBuf;
1076 }else{
1077 a = pToFree = fossil_malloc( sizeof(a[0])*(nRight+1) );
1078 }
1079
+1 -1
--- src/dispatch.c
+++ src/dispatch.c
@@ -69,11 +69,11 @@
6969
** The page_index.h file is generated by the mkindex program which scans all
7070
** source code files looking for header comments on the functions that
7171
** implement command and webpages.
7272
*/
7373
#include "page_index.h"
74
-#define MX_COMMAND (sizeof(aCommand)/sizeof(aCommand[0]))
74
+#define MX_COMMAND count(aCommand)
7575
7676
/*
7777
** Given a command or webpage name in zName, find the corresponding CmdOrPage
7878
** object and return a pointer to that object in *ppCmd.
7979
**
8080
--- src/dispatch.c
+++ src/dispatch.c
@@ -69,11 +69,11 @@
69 ** The page_index.h file is generated by the mkindex program which scans all
70 ** source code files looking for header comments on the functions that
71 ** implement command and webpages.
72 */
73 #include "page_index.h"
74 #define MX_COMMAND (sizeof(aCommand)/sizeof(aCommand[0]))
75
76 /*
77 ** Given a command or webpage name in zName, find the corresponding CmdOrPage
78 ** object and return a pointer to that object in *ppCmd.
79 **
80
--- src/dispatch.c
+++ src/dispatch.c
@@ -69,11 +69,11 @@
69 ** The page_index.h file is generated by the mkindex program which scans all
70 ** source code files looking for header comments on the functions that
71 ** implement command and webpages.
72 */
73 #include "page_index.h"
74 #define MX_COMMAND count(aCommand)
75
76 /*
77 ** Given a command or webpage name in zName, find the corresponding CmdOrPage
78 ** object and return a pointer to that object in *ppCmd.
79 **
80
+10 -10
--- src/doc.c
+++ src/doc.c
@@ -54,11 +54,11 @@
5454
if( !looks_like_binary(pBlob) ) {
5555
return 0; /* Plain text */
5656
}
5757
x = (const unsigned char*)blob_buffer(pBlob);
5858
n = blob_size(pBlob);
59
- for(i=0; i<ArraySize(aMime); i++){
59
+ for(i=0; i<count(aMime); i++){
6060
if( n>=aMime[i].size && memcmp(x, aMime[i].zPrefix, aMime[i].size)==0 ){
6161
return aMime[i].zMimetype;
6262
}
6363
}
6464
return "unknown/unknown";
@@ -293,11 +293,11 @@
293293
** Verify that all entries in the aMime[] table are in sorted order.
294294
** Abort with a fatal error if any is out-of-order.
295295
*/
296296
static void mimetype_verify(void){
297297
int i;
298
- for(i=1; i<ArraySize(aMime); i++){
298
+ for(i=1; i<count(aMime); i++){
299299
if( fossil_strcmp(aMime[i-1].zSuffix,aMime[i].zSuffix)>=0 ){
300300
fossil_fatal("mimetypes out of sequence: %s before %s",
301301
aMime[i-1].zSuffix, aMime[i].zSuffix);
302302
}
303303
}
@@ -331,11 +331,11 @@
331331
len = strlen(z);
332332
if( len<sizeof(zSuffix)-1 ){
333333
sqlite3_snprintf(sizeof(zSuffix), zSuffix, "%s", z);
334334
for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]);
335335
first = 0;
336
- last = ArraySize(aMime) - 1;
336
+ last = count(aMime) - 1;
337337
while( first<=last ){
338338
int c;
339339
i = (first+last)/2;
340340
c = fossil_strcmp(zSuffix, aMime[i].zSuffix);
341341
if( c==0 ) return aMime[i].zMimetype;
@@ -384,11 +384,11 @@
384384
@ <table id='mimeTable' border=1 cellpadding=0 class='mimetypetable'>
385385
@ <thead>
386386
@ <tr><th>Suffix<th>Mimetype
387387
@ </thead>
388388
@ <tbody>
389
- for(i=0; i<ArraySize(aMime); i++){
389
+ for(i=0; i<count(aMime); i++){
390390
@ <tr><td>%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
391391
}
392392
@ </tbody></table>
393393
output_table_sorting_javascript("mimeTable","tt",1);
394394
style_footer();
@@ -593,11 +593,11 @@
593593
login_check_credentials();
594594
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
595595
blob_init(&title, 0, 0);
596596
zDfltTitle = isUV ? "" : "Documentation";
597597
db_begin_transaction();
598
- while( rid==0 && (++nMiss)<=ArraySize(azSuffix) ){
598
+ while( rid==0 && (++nMiss)<=count(azSuffix) ){
599599
zName = P("name");
600600
if( isUV ){
601601
if( zName==0 ) zName = "index.wiki";
602602
i = 0;
603603
}else{
@@ -606,14 +606,14 @@
606606
zCheckin = mprintf("%.*s", i, zName);
607607
if( fossil_strcmp(zCheckin,"ckout")==0 && g.localOpen==0 ){
608608
zCheckin = "tip";
609609
}
610610
}
611
- if( nMiss==ArraySize(azSuffix) ){
611
+ if( nMiss==count(azSuffix) ){
612612
zName = "404.md";
613613
}else if( zName[i]==0 ){
614
- assert( nMiss>=0 && nMiss<ArraySize(azSuffix) );
614
+ assert( nMiss>=0 && nMiss<count(azSuffix) );
615615
zName = azSuffix[nMiss];
616616
}else if( !isUV ){
617617
zName += i;
618618
}
619619
while( zName[0]=='/' ){ zName++; }
@@ -623,11 +623,11 @@
623623
g.zPath = mprintf("%s/%s/%s", g.zPath, zCheckin, zName);
624624
}
625625
if( nMiss==0 ) zOrigName = zName;
626626
if( !file_is_simple_pathname(zName, 1) ){
627627
if( sqlite3_strglob("*/", zName)==0 ){
628
- assert( nMiss>=0 && nMiss<ArraySize(azSuffix) );
628
+ assert( nMiss>=0 && nMiss<count(azSuffix) );
629629
zName = mprintf("%s%s", zName, azSuffix[nMiss]);
630630
if( !file_is_simple_pathname(zName, 1) ){
631631
goto doc_not_found;
632632
}
633633
}else{
@@ -686,11 +686,11 @@
686686
Blob tail = BLOB_INITIALIZER;
687687
markdown_to_html(&filebody, &title, &tail);
688688
if( blob_size(&title)>0 ){
689689
style_header("%s", blob_str(&title));
690690
}else{
691
- style_header("%s", nMiss>=ArraySize(azSuffix)?
691
+ style_header("%s", nMiss>=count(azSuffix)?
692692
"Not Found" : zDfltTitle);
693693
}
694694
convert_href_and_output(&tail);
695695
style_footer();
696696
}else if( fossil_strcmp(zMime, "text/plain")==0 ){
@@ -719,11 +719,11 @@
719719
#endif
720720
}else{
721721
cgi_set_content_type(zMime);
722722
cgi_set_content(&filebody);
723723
}
724
- if( nMiss>=ArraySize(azSuffix) ) cgi_set_status(404, "Not Found");
724
+ if( nMiss>=count(azSuffix) ) cgi_set_status(404, "Not Found");
725725
db_end_transaction(0);
726726
return;
727727
728728
/* Jump here when unable to locate the document */
729729
doc_not_found:
730730
--- src/doc.c
+++ src/doc.c
@@ -54,11 +54,11 @@
54 if( !looks_like_binary(pBlob) ) {
55 return 0; /* Plain text */
56 }
57 x = (const unsigned char*)blob_buffer(pBlob);
58 n = blob_size(pBlob);
59 for(i=0; i<ArraySize(aMime); i++){
60 if( n>=aMime[i].size && memcmp(x, aMime[i].zPrefix, aMime[i].size)==0 ){
61 return aMime[i].zMimetype;
62 }
63 }
64 return "unknown/unknown";
@@ -293,11 +293,11 @@
293 ** Verify that all entries in the aMime[] table are in sorted order.
294 ** Abort with a fatal error if any is out-of-order.
295 */
296 static void mimetype_verify(void){
297 int i;
298 for(i=1; i<ArraySize(aMime); i++){
299 if( fossil_strcmp(aMime[i-1].zSuffix,aMime[i].zSuffix)>=0 ){
300 fossil_fatal("mimetypes out of sequence: %s before %s",
301 aMime[i-1].zSuffix, aMime[i].zSuffix);
302 }
303 }
@@ -331,11 +331,11 @@
331 len = strlen(z);
332 if( len<sizeof(zSuffix)-1 ){
333 sqlite3_snprintf(sizeof(zSuffix), zSuffix, "%s", z);
334 for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]);
335 first = 0;
336 last = ArraySize(aMime) - 1;
337 while( first<=last ){
338 int c;
339 i = (first+last)/2;
340 c = fossil_strcmp(zSuffix, aMime[i].zSuffix);
341 if( c==0 ) return aMime[i].zMimetype;
@@ -384,11 +384,11 @@
384 @ <table id='mimeTable' border=1 cellpadding=0 class='mimetypetable'>
385 @ <thead>
386 @ <tr><th>Suffix<th>Mimetype
387 @ </thead>
388 @ <tbody>
389 for(i=0; i<ArraySize(aMime); i++){
390 @ <tr><td>%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
391 }
392 @ </tbody></table>
393 output_table_sorting_javascript("mimeTable","tt",1);
394 style_footer();
@@ -593,11 +593,11 @@
593 login_check_credentials();
594 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
595 blob_init(&title, 0, 0);
596 zDfltTitle = isUV ? "" : "Documentation";
597 db_begin_transaction();
598 while( rid==0 && (++nMiss)<=ArraySize(azSuffix) ){
599 zName = P("name");
600 if( isUV ){
601 if( zName==0 ) zName = "index.wiki";
602 i = 0;
603 }else{
@@ -606,14 +606,14 @@
606 zCheckin = mprintf("%.*s", i, zName);
607 if( fossil_strcmp(zCheckin,"ckout")==0 && g.localOpen==0 ){
608 zCheckin = "tip";
609 }
610 }
611 if( nMiss==ArraySize(azSuffix) ){
612 zName = "404.md";
613 }else if( zName[i]==0 ){
614 assert( nMiss>=0 && nMiss<ArraySize(azSuffix) );
615 zName = azSuffix[nMiss];
616 }else if( !isUV ){
617 zName += i;
618 }
619 while( zName[0]=='/' ){ zName++; }
@@ -623,11 +623,11 @@
623 g.zPath = mprintf("%s/%s/%s", g.zPath, zCheckin, zName);
624 }
625 if( nMiss==0 ) zOrigName = zName;
626 if( !file_is_simple_pathname(zName, 1) ){
627 if( sqlite3_strglob("*/", zName)==0 ){
628 assert( nMiss>=0 && nMiss<ArraySize(azSuffix) );
629 zName = mprintf("%s%s", zName, azSuffix[nMiss]);
630 if( !file_is_simple_pathname(zName, 1) ){
631 goto doc_not_found;
632 }
633 }else{
@@ -686,11 +686,11 @@
686 Blob tail = BLOB_INITIALIZER;
687 markdown_to_html(&filebody, &title, &tail);
688 if( blob_size(&title)>0 ){
689 style_header("%s", blob_str(&title));
690 }else{
691 style_header("%s", nMiss>=ArraySize(azSuffix)?
692 "Not Found" : zDfltTitle);
693 }
694 convert_href_and_output(&tail);
695 style_footer();
696 }else if( fossil_strcmp(zMime, "text/plain")==0 ){
@@ -719,11 +719,11 @@
719 #endif
720 }else{
721 cgi_set_content_type(zMime);
722 cgi_set_content(&filebody);
723 }
724 if( nMiss>=ArraySize(azSuffix) ) cgi_set_status(404, "Not Found");
725 db_end_transaction(0);
726 return;
727
728 /* Jump here when unable to locate the document */
729 doc_not_found:
730
--- src/doc.c
+++ src/doc.c
@@ -54,11 +54,11 @@
54 if( !looks_like_binary(pBlob) ) {
55 return 0; /* Plain text */
56 }
57 x = (const unsigned char*)blob_buffer(pBlob);
58 n = blob_size(pBlob);
59 for(i=0; i<count(aMime); i++){
60 if( n>=aMime[i].size && memcmp(x, aMime[i].zPrefix, aMime[i].size)==0 ){
61 return aMime[i].zMimetype;
62 }
63 }
64 return "unknown/unknown";
@@ -293,11 +293,11 @@
293 ** Verify that all entries in the aMime[] table are in sorted order.
294 ** Abort with a fatal error if any is out-of-order.
295 */
296 static void mimetype_verify(void){
297 int i;
298 for(i=1; i<count(aMime); i++){
299 if( fossil_strcmp(aMime[i-1].zSuffix,aMime[i].zSuffix)>=0 ){
300 fossil_fatal("mimetypes out of sequence: %s before %s",
301 aMime[i-1].zSuffix, aMime[i].zSuffix);
302 }
303 }
@@ -331,11 +331,11 @@
331 len = strlen(z);
332 if( len<sizeof(zSuffix)-1 ){
333 sqlite3_snprintf(sizeof(zSuffix), zSuffix, "%s", z);
334 for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]);
335 first = 0;
336 last = count(aMime) - 1;
337 while( first<=last ){
338 int c;
339 i = (first+last)/2;
340 c = fossil_strcmp(zSuffix, aMime[i].zSuffix);
341 if( c==0 ) return aMime[i].zMimetype;
@@ -384,11 +384,11 @@
384 @ <table id='mimeTable' border=1 cellpadding=0 class='mimetypetable'>
385 @ <thead>
386 @ <tr><th>Suffix<th>Mimetype
387 @ </thead>
388 @ <tbody>
389 for(i=0; i<count(aMime); i++){
390 @ <tr><td>%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
391 }
392 @ </tbody></table>
393 output_table_sorting_javascript("mimeTable","tt",1);
394 style_footer();
@@ -593,11 +593,11 @@
593 login_check_credentials();
594 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
595 blob_init(&title, 0, 0);
596 zDfltTitle = isUV ? "" : "Documentation";
597 db_begin_transaction();
598 while( rid==0 && (++nMiss)<=count(azSuffix) ){
599 zName = P("name");
600 if( isUV ){
601 if( zName==0 ) zName = "index.wiki";
602 i = 0;
603 }else{
@@ -606,14 +606,14 @@
606 zCheckin = mprintf("%.*s", i, zName);
607 if( fossil_strcmp(zCheckin,"ckout")==0 && g.localOpen==0 ){
608 zCheckin = "tip";
609 }
610 }
611 if( nMiss==count(azSuffix) ){
612 zName = "404.md";
613 }else if( zName[i]==0 ){
614 assert( nMiss>=0 && nMiss<count(azSuffix) );
615 zName = azSuffix[nMiss];
616 }else if( !isUV ){
617 zName += i;
618 }
619 while( zName[0]=='/' ){ zName++; }
@@ -623,11 +623,11 @@
623 g.zPath = mprintf("%s/%s/%s", g.zPath, zCheckin, zName);
624 }
625 if( nMiss==0 ) zOrigName = zName;
626 if( !file_is_simple_pathname(zName, 1) ){
627 if( sqlite3_strglob("*/", zName)==0 ){
628 assert( nMiss>=0 && nMiss<count(azSuffix) );
629 zName = mprintf("%s%s", zName, azSuffix[nMiss]);
630 if( !file_is_simple_pathname(zName, 1) ){
631 goto doc_not_found;
632 }
633 }else{
@@ -686,11 +686,11 @@
686 Blob tail = BLOB_INITIALIZER;
687 markdown_to_html(&filebody, &title, &tail);
688 if( blob_size(&title)>0 ){
689 style_header("%s", blob_str(&title));
690 }else{
691 style_header("%s", nMiss>=count(azSuffix)?
692 "Not Found" : zDfltTitle);
693 }
694 convert_href_and_output(&tail);
695 style_footer();
696 }else if( fossil_strcmp(zMime, "text/plain")==0 ){
@@ -719,11 +719,11 @@
719 #endif
720 }else{
721 cgi_set_content_type(zMime);
722 cgi_set_content(&filebody);
723 }
724 if( nMiss>=count(azSuffix) ) cgi_set_status(404, "Not Found");
725 db_end_transaction(0);
726 return;
727
728 /* Jump here when unable to locate the document */
729 doc_not_found:
730
+2 -2
--- src/file.c
+++ src/file.c
@@ -1290,11 +1290,11 @@
12901290
azDirs[1] = fossil_getenv("TEMP");
12911291
azDirs[2] = fossil_getenv("TMP");
12921292
#endif
12931293
12941294
1295
- for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){
1295
+ for(i=0; i<count(azDirs); i++){
12961296
if( azDirs[i]==0 ) continue;
12971297
if( !file_isdir(azDirs[i]) ) continue;
12981298
zDir = azDirs[i];
12991299
break;
13001300
}
@@ -1407,11 +1407,11 @@
14071407
const char *file_is_win_reserved(const char *zPath){
14081408
static const char *azRes[] = { "CON", "PRN", "AUX", "NUL", "COM", "LPT" };
14091409
static char zReturn[5];
14101410
int i;
14111411
while( zPath[0] ){
1412
- for(i=0; i<ArraySize(azRes); i++){
1412
+ for(i=0; i<count(azRes); i++){
14131413
if( sqlite3_strnicmp(zPath, azRes[i], 3)==0
14141414
&& ((i>=4 && fossil_isdigit(zPath[3])
14151415
&& (zPath[4]=='/' || zPath[4]=='.' || zPath[4]==0))
14161416
|| (i<4 && (zPath[3]=='/' || zPath[3]=='.' || zPath[3]==0)))
14171417
){
14181418
--- src/file.c
+++ src/file.c
@@ -1290,11 +1290,11 @@
1290 azDirs[1] = fossil_getenv("TEMP");
1291 azDirs[2] = fossil_getenv("TMP");
1292 #endif
1293
1294
1295 for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){
1296 if( azDirs[i]==0 ) continue;
1297 if( !file_isdir(azDirs[i]) ) continue;
1298 zDir = azDirs[i];
1299 break;
1300 }
@@ -1407,11 +1407,11 @@
1407 const char *file_is_win_reserved(const char *zPath){
1408 static const char *azRes[] = { "CON", "PRN", "AUX", "NUL", "COM", "LPT" };
1409 static char zReturn[5];
1410 int i;
1411 while( zPath[0] ){
1412 for(i=0; i<ArraySize(azRes); i++){
1413 if( sqlite3_strnicmp(zPath, azRes[i], 3)==0
1414 && ((i>=4 && fossil_isdigit(zPath[3])
1415 && (zPath[4]=='/' || zPath[4]=='.' || zPath[4]==0))
1416 || (i<4 && (zPath[3]=='/' || zPath[3]=='.' || zPath[3]==0)))
1417 ){
1418
--- src/file.c
+++ src/file.c
@@ -1290,11 +1290,11 @@
1290 azDirs[1] = fossil_getenv("TEMP");
1291 azDirs[2] = fossil_getenv("TMP");
1292 #endif
1293
1294
1295 for(i=0; i<count(azDirs); i++){
1296 if( azDirs[i]==0 ) continue;
1297 if( !file_isdir(azDirs[i]) ) continue;
1298 zDir = azDirs[i];
1299 break;
1300 }
@@ -1407,11 +1407,11 @@
1407 const char *file_is_win_reserved(const char *zPath){
1408 static const char *azRes[] = { "CON", "PRN", "AUX", "NUL", "COM", "LPT" };
1409 static char zReturn[5];
1410 int i;
1411 while( zPath[0] ){
1412 for(i=0; i<count(azRes); i++){
1413 if( sqlite3_strnicmp(zPath, azRes[i], 3)==0
1414 && ((i>=4 && fossil_isdigit(zPath[3])
1415 && (zPath[4]=='/' || zPath[4]=='.' || zPath[4]==0))
1416 || (i<4 && (zPath[3]=='/' || zPath[3]=='.' || zPath[3]==0)))
1417 ){
1418
+1 -1
--- src/finfo.c
+++ src/finfo.c
@@ -454,11 +454,11 @@
454454
int aParent[GR_MAX_RAIL];
455455
456456
db_bind_int(&qparent, ":fid", frid);
457457
db_bind_int(&qparent, ":mid", fmid);
458458
db_bind_int(&qparent, ":fnid", fnid);
459
- while( db_step(&qparent)==SQLITE_ROW && nParent<ArraySize(aParent) ){
459
+ while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
460460
aParent[nParent] = db_column_int(&qparent, 0);
461461
nParent++;
462462
}
463463
db_reset(&qparent);
464464
if( zBr==0 ) zBr = "trunk";
465465
--- src/finfo.c
+++ src/finfo.c
@@ -454,11 +454,11 @@
454 int aParent[GR_MAX_RAIL];
455
456 db_bind_int(&qparent, ":fid", frid);
457 db_bind_int(&qparent, ":mid", fmid);
458 db_bind_int(&qparent, ":fnid", fnid);
459 while( db_step(&qparent)==SQLITE_ROW && nParent<ArraySize(aParent) ){
460 aParent[nParent] = db_column_int(&qparent, 0);
461 nParent++;
462 }
463 db_reset(&qparent);
464 if( zBr==0 ) zBr = "trunk";
465
--- src/finfo.c
+++ src/finfo.c
@@ -454,11 +454,11 @@
454 int aParent[GR_MAX_RAIL];
455
456 db_bind_int(&qparent, ":fid", frid);
457 db_bind_int(&qparent, ":mid", fmid);
458 db_bind_int(&qparent, ":fnid", fnid);
459 while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
460 aParent[nParent] = db_column_int(&qparent, 0);
461 nParent++;
462 }
463 db_reset(&qparent);
464 if( zBr==0 ) zBr = "trunk";
465
+6 -2
--- src/fshell.c
+++ src/fshell.c
@@ -25,10 +25,11 @@
2525
** It allows multiple commands to be issued without having to reenter the
2626
** crypto phasephrase for each command.
2727
*/
2828
#include "config.h"
2929
#include "fshell.h"
30
+#include "linenoise.h"
3031
#include <ctype.h>
3132
3233
#ifndef _WIN32
3334
#include <sys/types.h>
3435
#include <sys/wait.h>
@@ -55,16 +56,19 @@
5556
int mxArg = 0;
5657
int n, i;
5758
char **azArg = 0;
5859
int fDebug;
5960
pid_t childPid;
60
- char zLine[10000];
61
+ char *zLine = 0;
6162
fDebug = find_option("debug", 0, 0)!=0;
6263
db_find_and_open_repository(OPEN_ANY_SCHEMA|OPEN_OK_NOT_FOUND, 0);
6364
db_close(0);
6465
sqlite3_shutdown();
65
- while( printf("fossil> "),fflush(stdout),fgets(zLine, sizeof(zLine), stdin) ){
66
+ while( (free(zLine), zLine = linenoise("fossil> ")) ){
67
+ /* Remember shell history within the current session */
68
+ linenoiseHistoryAdd(zLine);
69
+
6670
/* Parse the line of input */
6771
n = (int)strlen(zLine);
6872
for(i=0, nArg=1; i<n; i++){
6973
while( fossil_isspace(zLine[i]) ){ i++; }
7074
if( i>=n ) break;
7175
--- src/fshell.c
+++ src/fshell.c
@@ -25,10 +25,11 @@
25 ** It allows multiple commands to be issued without having to reenter the
26 ** crypto phasephrase for each command.
27 */
28 #include "config.h"
29 #include "fshell.h"
 
30 #include <ctype.h>
31
32 #ifndef _WIN32
33 #include <sys/types.h>
34 #include <sys/wait.h>
@@ -55,16 +56,19 @@
55 int mxArg = 0;
56 int n, i;
57 char **azArg = 0;
58 int fDebug;
59 pid_t childPid;
60 char zLine[10000];
61 fDebug = find_option("debug", 0, 0)!=0;
62 db_find_and_open_repository(OPEN_ANY_SCHEMA|OPEN_OK_NOT_FOUND, 0);
63 db_close(0);
64 sqlite3_shutdown();
65 while( printf("fossil> "),fflush(stdout),fgets(zLine, sizeof(zLine), stdin) ){
 
 
 
66 /* Parse the line of input */
67 n = (int)strlen(zLine);
68 for(i=0, nArg=1; i<n; i++){
69 while( fossil_isspace(zLine[i]) ){ i++; }
70 if( i>=n ) break;
71
--- src/fshell.c
+++ src/fshell.c
@@ -25,10 +25,11 @@
25 ** It allows multiple commands to be issued without having to reenter the
26 ** crypto phasephrase for each command.
27 */
28 #include "config.h"
29 #include "fshell.h"
30 #include "linenoise.h"
31 #include <ctype.h>
32
33 #ifndef _WIN32
34 #include <sys/types.h>
35 #include <sys/wait.h>
@@ -55,16 +56,19 @@
56 int mxArg = 0;
57 int n, i;
58 char **azArg = 0;
59 int fDebug;
60 pid_t childPid;
61 char *zLine = 0;
62 fDebug = find_option("debug", 0, 0)!=0;
63 db_find_and_open_repository(OPEN_ANY_SCHEMA|OPEN_OK_NOT_FOUND, 0);
64 db_close(0);
65 sqlite3_shutdown();
66 while( (free(zLine), zLine = linenoise("fossil> ")) ){
67 /* Remember shell history within the current session */
68 linenoiseHistoryAdd(zLine);
69
70 /* Parse the line of input */
71 n = (int)strlen(zLine);
72 for(i=0, nArg=1; i<n; i++){
73 while( fossil_isspace(zLine[i]) ){ i++; }
74 if( i>=n ) break;
75
+1 -1
--- src/import.c
+++ src/import.c
@@ -1612,11 +1612,11 @@
16121612
{"rename-branch", &gimport.zBranchPre, "", &gimport.zBranchSuf, "", 3},
16131613
{"rename-tag" , &gimport.zTagPre , "", &gimport.zTagSuf , "", 3},
16141614
{"rename-rev" , &gsvn.zRevPre, "svn-rev-", &gsvn.zRevSuf , "", 2},
16151615
}, *renOpt = renOpts;
16161616
int i;
1617
- for( i = 0; i < sizeof(renOpts) / sizeof(*renOpts); ++i, ++renOpt ){
1617
+ for( i = 0; i < count(renOpts); ++i, ++renOpt ){
16181618
if( 1 << svnFlag & renOpt->format ){
16191619
const char *zArgument = find_option(renOpt->zOpt, 0, 1);
16201620
if( zArgument ){
16211621
const char *sep = strchr(zArgument, '%');
16221622
if( !sep ){
16231623
--- src/import.c
+++ src/import.c
@@ -1612,11 +1612,11 @@
1612 {"rename-branch", &gimport.zBranchPre, "", &gimport.zBranchSuf, "", 3},
1613 {"rename-tag" , &gimport.zTagPre , "", &gimport.zTagSuf , "", 3},
1614 {"rename-rev" , &gsvn.zRevPre, "svn-rev-", &gsvn.zRevSuf , "", 2},
1615 }, *renOpt = renOpts;
1616 int i;
1617 for( i = 0; i < sizeof(renOpts) / sizeof(*renOpts); ++i, ++renOpt ){
1618 if( 1 << svnFlag & renOpt->format ){
1619 const char *zArgument = find_option(renOpt->zOpt, 0, 1);
1620 if( zArgument ){
1621 const char *sep = strchr(zArgument, '%');
1622 if( !sep ){
1623
--- src/import.c
+++ src/import.c
@@ -1612,11 +1612,11 @@
1612 {"rename-branch", &gimport.zBranchPre, "", &gimport.zBranchSuf, "", 3},
1613 {"rename-tag" , &gimport.zTagPre , "", &gimport.zTagSuf , "", 3},
1614 {"rename-rev" , &gsvn.zRevPre, "svn-rev-", &gsvn.zRevSuf , "", 2},
1615 }, *renOpt = renOpts;
1616 int i;
1617 for( i = 0; i < count(renOpts); ++i, ++renOpt ){
1618 if( 1 << svnFlag & renOpt->format ){
1619 const char *zArgument = find_option(renOpt->zOpt, 0, 1);
1620 if( zArgument ){
1621 const char *sep = strchr(zArgument, '%');
1622 if( !sep ){
1623
+1 -1
--- src/info.c
+++ src/info.c
@@ -2248,11 +2248,11 @@
22482248
{ "#91d680", 0 },
22492249
22502250
22512251
{ "custom", "##" },
22522252
};
2253
- int nColor = sizeof(aColor)/sizeof(aColor[0])-1;
2253
+ int nColor = count(aColor)-1;
22542254
int stdClrFound = 0;
22552255
int i;
22562256
22572257
if( zIdPropagate ){
22582258
@ <div><label>
22592259
--- src/info.c
+++ src/info.c
@@ -2248,11 +2248,11 @@
2248 { "#91d680", 0 },
2249
2250
2251 { "custom", "##" },
2252 };
2253 int nColor = sizeof(aColor)/sizeof(aColor[0])-1;
2254 int stdClrFound = 0;
2255 int i;
2256
2257 if( zIdPropagate ){
2258 @ <div><label>
2259
--- src/info.c
+++ src/info.c
@@ -2248,11 +2248,11 @@
2248 { "#91d680", 0 },
2249
2250
2251 { "custom", "##" },
2252 };
2253 int nColor = count(aColor)-1;
2254 int stdClrFound = 0;
2255 int i;
2256
2257 if( zIdPropagate ){
2258 @ <div><label>
2259
+1 -1
--- src/main.c
+++ src/main.c
@@ -2350,11 +2350,11 @@
23502350
if( zBrowser==0 ){
23512351
static const char *const azBrowserProg[] =
23522352
{ "xdg-open", "gnome-open", "firefox", "google-chrome" };
23532353
int i;
23542354
zBrowser = "echo";
2355
- for(i=0; i<sizeof(azBrowserProg)/sizeof(azBrowserProg[0]); i++){
2355
+ for(i=0; i<count(azBrowserProg); i++){
23562356
if( binaryOnPath(azBrowserProg[i]) ){
23572357
zBrowser = azBrowserProg[i];
23582358
break;
23592359
}
23602360
}
23612361
--- src/main.c
+++ src/main.c
@@ -2350,11 +2350,11 @@
2350 if( zBrowser==0 ){
2351 static const char *const azBrowserProg[] =
2352 { "xdg-open", "gnome-open", "firefox", "google-chrome" };
2353 int i;
2354 zBrowser = "echo";
2355 for(i=0; i<sizeof(azBrowserProg)/sizeof(azBrowserProg[0]); i++){
2356 if( binaryOnPath(azBrowserProg[i]) ){
2357 zBrowser = azBrowserProg[i];
2358 break;
2359 }
2360 }
2361
--- src/main.c
+++ src/main.c
@@ -2350,11 +2350,11 @@
2350 if( zBrowser==0 ){
2351 static const char *const azBrowserProg[] =
2352 { "xdg-open", "gnome-open", "firefox", "google-chrome" };
2353 int i;
2354 zBrowser = "echo";
2355 for(i=0; i<count(azBrowserProg); i++){
2356 if( binaryOnPath(azBrowserProg[i]) ){
2357 zBrowser = azBrowserProg[i];
2358 break;
2359 }
2360 }
2361
--- src/makeheaders.html
+++ src/makeheaders.html
@@ -4,11 +4,11 @@
44
<h1 align=center>The Makeheaders Program</h1>
55
66
77
<p>
88
This document describes <em>makeheaders</em>,
9
-a tool that automatically generates ``<code>.h</code>''
9
+a tool that automatically generates &#8220;<code>.h</code>&#8221;
1010
files for a C or C++ programming project.
1111
</p>
1212
1313
1414
<h2>Table Of Contents</h2>
@@ -67,11 +67,11 @@
6767
<ul>
6868
<li> Typedefs.
6969
<li> Structure, union and enumeration declarations.
7070
<li> Function and procedure prototypes.
7171
<li> Preprocessor macros and #defines.
72
-<li> ``extern'' variable declarations.
72
+<li> &#8220;<code>extern</code>&#8221; variable declarations.
7373
</ul>
7474
</p>
7575
7676
<p>
7777
Definitions in C, on the other hand, include these kinds of things:
@@ -89,13 +89,13 @@
8989
is the <em>interface</em> and the definition is the <em>implementation</em>.
9090
</p>
9191
9292
<p>
9393
In C programs, it has always been the tradition that declarations are
94
-put in files with the ``<code>.h</code>'' suffix and definitions are
95
-placed in ``<code>.c</code>'' files.
96
-The .c files contain ``<code>#include</code>'' preprocessor statements
94
+put in files with the &#8220;<code>.h</code>&#8221; suffix and definitions are
95
+placed in &#8220;<code>.c</code>&#8221; files.
96
+The .c files contain &#8220;<code>#include</code>&#8221; preprocessor statements
9797
that cause the contents of .h files to be included as part of the
9898
source code when the .c file is compiled.
9999
In this way, the .h files define the interface to a subsystem and
100100
the .c files define how the subsystem is implemented.
101101
</p>
@@ -262,11 +262,11 @@
262262
263263
<p>
264264
A similar option is -H. Like the lower-case -h option, big -H
265265
generates a single include file on standard output. But unlike
266266
small -h, the big -H only emits prototypes and declarations that
267
-have been designated as ``exportable''.
267
+have been designated as &#8220;exportable&#8221;.
268268
The idea is that -H will generate an include file that defines
269269
the interface to a library.
270270
More will be said about this in section 3.4.
271271
</p>
272272
@@ -293,13 +293,13 @@
293293
then you can supply an empty header filename, like this:
294294
<pre>
295295
makeheaders alpha.c beta.c gamma.c:
296296
</pre>
297297
In this example, makeheaders will scan the three files named
298
-``alpha.c'',
299
-``beta.c'' and
300
-``gamma.c''
298
+&#8220;<code>alpha.c</code>&#8221;,
299
+&#8220;<code>beta.c</code>&#8221; and
300
+&#8220;<code>gamma.c</code>&#8221;
301301
but because of the colon on the end of third filename
302302
it will only generate headers for the first two files.
303303
Unfortunately,
304304
it is not possible to get makeheaders to process any file whose
305305
name contains a colon.
@@ -309,14 +309,14 @@
309309
In a large project, the length of the command line for makeheaders
310310
can become very long.
311311
If the operating system doesn't support long command lines
312312
(example: DOS and Win32) you may not be able to list all of the
313313
input files in the space available.
314
-In that case, you can use the ``-f'' option followed
314
+In that case, you can use the &#8220;<code>-f</code>&#8221; option followed
315315
by the name of a file to cause makeheaders to read command line
316316
options and filename from the file instead of from the command line.
317
-For example, you might prepare a file named ``mkhdr.dat''
317
+For example, you might prepare a file named &#8220;<code>mkhdr.dat</code>&#8221;
318318
that contains text like this:
319319
<pre>
320320
src/alpha.c:hdr/alpha.h
321321
src/beta.c:hdr/beta.h
322322
src/gamma.c:hdr/gamma.h
@@ -327,18 +327,18 @@
327327
makeheaders -f mkhdr.dat
328328
</pre>
329329
</p>
330330
331331
<p>
332
-The ``-local'' option causes makeheaders to
333
-generate of prototypes for ``static'' functions and
332
+The &#8220;<code>-local</code>&#8221; option causes makeheaders to
333
+generate of prototypes for &#8220;<code>static</code>&#8221; functions and
334334
procedures.
335335
Such prototypes are normally omitted.
336336
</p>
337337
338338
<p>
339
-Finally, makeheaders also includes a ``-doc'' option.
339
+Finally, makeheaders also includes a &#8220;<code>-doc</code>&#8221; option.
340340
This command line option prevents makeheaders from generating any
341341
headers at all.
342342
Instead, makeheaders will write to standard output
343343
information about every definition and declaration that it encounters
344344
in its scan of source files.
@@ -352,19 +352,21 @@
352352
</p>
353353
354354
<p>
355355
If you forget what command line options are available, or forget
356356
their exact name, you can invoke makeheaders using an unknown
357
-command line option (like ``--help'' or ``-?'')
357
+command line option (like &#8220;<code>--help</code>&#8221; or
358
+&#8220;<code>-?</code>&#8221;)
358359
and it will print a summary of the available options on standard
359360
error.
360
-If you need to process a file whose name begins with ``-'',
361
-you can prepend a ``./'' to its name in order to get it
361
+If you need to process a file whose name begins with
362
+&#8220;<code>-</code>&#8221;,
363
+you can prepend a &#8220;<code>./</code>&#8221; to its name in order to get it
362364
accepted by the command line parser.
363
-Or, you can insert the special option ``--'' on the command
364
-line to cause all subsequent command line arguments to be treated as
365
-filenames even if their names beginn with ``-''.
365
+Or, you can insert the special option &#8220;<code>--</code>&#8221; on the
366
+command line to cause all subsequent command line arguments to be treated as
367
+filenames even if their names begin with &#8220;<code>-</code>&#8221;.
366368
</p>
367369
368370
<a name="H0006"></a>
369371
<h2>3.0 Preparing Source Files For Use With Makeheaders</h2>
370372
@@ -379,30 +381,31 @@
379381
380382
<a name="H0007"></a>
381383
<h3>3.1 The Basic Setup</h3>
382384
383385
<p>
384
-The simpliest way to use makeheaders is to put all definitions in
386
+The simplest way to use makeheaders is to put all definitions in
385387
one or more .c files and all structure and type declarations in
386388
separate .h files.
387389
The only restriction is that you should take care to chose basenames
388
-for your .h files that are different from the basenames for you
390
+for your .h files that are different from the basenames for your
389391
.c files.
390
-Recall that if your .c file is named (for example) ``alpha.c''
392
+Recall that if your .c file is named (for example)
393
+&#8220;<code>alpha.c</code>&#8221;
391394
makeheaders will attempt to generate a corresponding header file
392
-named ``alpha.h''.
395
+named &#8220;<code>alpha.h</code>&#8221;.
393396
For that reason, you don't want to use that name for
394397
any of the .h files you write since that will prevent makeheaders
395398
from generating the .h file automatically.
396399
</p>
397400
398401
<p>
399402
The structure of a .c file intented for use with makeheaders is very
400403
simple.
401
-All you have to do is add a single ``#include'' to the top
402
-of the file that sources the header file that makeheaders will generate.
403
-Hence, the beginning of a source file named ``alpha.c''
404
+All you have to do is add a single &#8220;<code>#include</code>&#8221; to the
405
+top of the file that sources the header file that makeheaders will generate.
406
+Hence, the beginning of a source file named &#8220;<code>alpha.c</code>&#8221;
404407
might look something like this:
405408
</p>
406409
407410
<pre>
408411
/*
@@ -415,14 +418,14 @@
415418
416419
<p>
417420
Your manually generated header files require no special attention at all.
418421
Code them as you normally would.
419422
However, makeheaders will work better if you omit the
420
-``#if'' statements people often put around the outside of
423
+&#8220;<code>#if</code>&#8221; statements people often put around the outside of
421424
header files that prevent the files from being included more than once.
422
-For example, to create a header file named ``beta.h'', many
423
-people will habitually write the following:
425
+For example, to create a header file named &#8220;<code>beta.h</code>&#8221;,
426
+many people will habitually write the following:
424427
425428
<pre>
426429
#ifndef BETA_H
427430
#define BETA_H
428431
@@ -435,11 +438,11 @@
435438
Remember that the header files you write will never really be
436439
included by any C code.
437440
Instead, makeheaders will scan your header files to extract only
438441
those declarations that are needed by individual .c files and then
439442
copy those declarations to the .h files corresponding to the .c files.
440
-Hence, the ``#if'' wrapper serves no useful purpose.
443
+Hence, the &#8220;<code>#if</code>&#8221; wrapper serves no useful purpose.
441444
But it does make makeheaders work harder, forcing it to put
442445
the statements
443446
444447
<pre>
445448
#if !defined(BETA_H)
@@ -465,11 +468,11 @@
465468
</p>
466469
467470
<p>
468471
Note that
469472
the wildcard expression used in the above example,
470
-``<code>*.[ch]</code>'',
473
+&#8220;<code>*.[ch]</code>&#8221;,
471474
will expand to include all .h files in the current directory, both
472475
those entered manually be the programmer and others generated automatically
473476
by a prior run of makeheaders.
474477
But that is not a problem.
475478
The makeheaders program will recognize and ignore any files it
@@ -489,14 +492,14 @@
489492
<p><li>
490493
When a function is defined in any .c file, a prototype of that function
491494
is placed in the generated .h file of every .c file that
492495
calls the function.</p>
493496
494
-<P>If the ``static'' keyword of C appears at the beginning
495
-of the function definition, the prototype is suppressed.
496
-If you use the ``LOCAL'' keyword where you would normally
497
-say ``static'', then a prototype is generated, but it
497
+<P>If the &#8220;<code>static</code>&#8221; keyword of C appears at the
498
+beginning of the function definition, the prototype is suppressed.
499
+If you use the &#8220;<code>LOCAL</code>&#8221; keyword where you would normally
500
+say &#8220;<code>static</code>&#8221;, then a prototype is generated, but it
498501
will only appear in the single header file that corresponds to the
499502
source file containing the function. For example, if the file
500503
<code>alpha.c</code> contains the following:
501504
<pre>
502505
LOCAL int testFunc(void){
@@ -509,24 +512,26 @@
509512
LOCAL int testFunc(void);
510513
</pre>
511514
However, no other generated header files will contain a prototype for
512515
<code>testFunc()</code> since the function has only file scope.</p>
513516
514
-<p>When the ``LOCAL'' keyword is used, makeheaders will also
515
-generate a #define for LOCAL, like this:
517
+<p>When the &#8220;<code>LOCAL</code>&#8221; keyword is used, makeheaders will
518
+also generate a #define for LOCAL, like this:
516519
<pre>
517520
#define LOCAL static
518521
</pre>
519522
so that the C compiler will know what it means.</p>
520523
521
-<p>If you invoke makeheaders with a ``-local'' command-line
522
-option, then it treats the ``static'' keyword like
523
-``LOCAL'' and generates prototypes in the header file
524
-that corresponds to the source file containing the function defintiion.</p>
524
+<p>If you invoke makeheaders with a &#8220;<code>-local</code>&#8221;
525
+command-line option, then it treats the &#8220;<code>static</code>&#8221;
526
+keyword like &#8220;<code>LOCAL</code>&#8221; and generates prototypes in the
527
+header file that corresponds to the source file containing the function
528
+definition.</p>
525529
526530
<p><li>
527
-When a global variable is defined in a .c file, an ``extern''
531
+When a global variable is defined in a .c file, an
532
+&#8220;<code>extern</code>&#8221;
528533
declaration of that variable is placed in the header of every
529534
.c file that uses the variable.
530535
</p>
531536
532537
<p><li>
@@ -550,12 +555,12 @@
550555
551556
<p><li>
552557
When a structure, union or enumeration declaration appears in a .h
553558
file, makeheaders will automatically
554559
generate a typedef that allows the declaration to be referenced without
555
-the ``struct'', ``union'' or ``enum''
556
-qualifier.
560
+the &#8220;<code>struct</code>&#8221;, &#8220;<code>union</code>&#8221; or
561
+&#8220;<code>enum</code>&#8221; qualifier.
557562
In other words, if makeheaders sees the code:
558563
<pre>
559564
struct Examp { /* ... */ };
560565
</pre>
561566
it will automatically generate a corresponding typedef like this:
@@ -572,13 +577,13 @@
572577
</ul>
573578
574579
<p>
575580
As a final note, we observe that automatically generated declarations
576581
are ordered as required by the ANSI-C programming language.
577
-If the declaration of some structure ``X'' requires a prior
578
-declaration of another structure ``Y'', then Y will appear
579
-first in the generated headers.
582
+If the declaration of some structure &#8220;<code>X</code>&#8221; requires a
583
+prior declaration of another structure &#8220;<code>Y</code>&#8221;, then Y will
584
+appear first in the generated headers.
580585
</p>
581586
582587
<a name="H0009"></a>
583588
<h3>3.3 How To Avoid Having To Write Any Header Files</h3>
584589
@@ -611,18 +616,18 @@
611616
<pre>
612617
#if INTERFACE
613618
#endif
614619
</pre>
615620
Thus any structure definitions that appear after the
616
-``#if INTERFACE'' but before the corresponding
617
-``#endif'' are eligable to be copied into the
621
+&#8220;<code>#if INTERFACE</code>&#8221; but before the corresponding
622
+&#8220;<code>#endif</code>&#8221; are eligable to be copied into the
618623
automatically generated
619624
.h files of other .c files.
620625
</p>
621626
622627
<p>
623
-If you use the ``#if INTERFACE'' mechanism in a .c file,
628
+If you use the &#8220;<code>#if INTERFACE</code>&#8221; mechanism in a .c file,
624629
then the generated header for that .c file will contain a line
625630
like this:
626631
<pre>
627632
#define INTERFACE 0
628633
</pre>
@@ -637,15 +642,15 @@
637642
</p>
638643
639644
<p>
640645
Note that you don't have to use this approach exclusively.
641646
You can put some declarations in .h files and others within the
642
-``#if INTERFACE'' regions of .c files.
647
+&#8220;<code>#if INTERFACE</code>&#8221; regions of .c files.
643648
Makeheaders treats all declarations alike, no matter where they
644649
come from.
645650
You should also note that a single .c file can contain as many
646
-``#if INTERFACE'' regions as desired.
651
+&#8220;<code>#if INTERFACE</code>&#8221; regions as desired.
647652
</p>
648653
649654
<a name="H0010"></a>
650655
<h3>3.4 Designating Declarations For Export</h3>
651656
@@ -664,11 +669,11 @@
664669
like this, but makeheaders does.
665670
</p>
666671
667672
<p>
668673
Using makeheaders, it is possible to designate routines and data
669
-structures as being for ``export''.
674
+structures as being for &#8220;<code>export</code>&#8221;.
670675
Exported objects are visible not only to other files within the
671676
same library or subassembly but also to other
672677
libraries and subassemblies in the larger program.
673678
By default, makeheaders only makes objects visible to other members
674679
of the same library.
@@ -690,14 +695,14 @@
690695
691696
<p>
692697
But trouble quickly arises when we attempt to devise a mechanism for
693698
telling makeheaders which prototypes it should export and which it should
694699
keep local.
695
-The built-in ``static'' keyword of C works well for prohibiting
696
-prototypes from leaving a single source file, but because C doesn't
700
+The built-in &#8220;<code>static</code>&#8221; keyword of C works well for
701
+prohibiting prototypes from leaving a single source file, but because C doesn't
697702
support a linkage hierarchy, there is nothing in the C language to help us.
698
-We'll have to invite our own keyword: ``EXPORT''
703
+We'll have to invite our own keyword: &#8220;<code>EXPORT</code>&#8221;
699704
</p>
700705
701706
<p>
702707
Makeheaders allows the EXPORT keyword to precede any function or
703708
procedure definition.
@@ -726,15 +731,15 @@
726731
<pre>
727732
#if EXPORT_INTERFACE
728733
#endif
729734
</pre>
730735
will become part of the exported interface.
731
-The ``#if EXPORT_INTERFACE'' mechanism can be used in either
732
-.c or .h files.
733
-(The ``#if INTERFACE'' can also be used in both .h and .c files,
734
-but since it's use in a .h file would be redundant, we haven't mentioned
735
-it before.)
736
+The &#8220;<code>#if EXPORT_INTERFACE</code>&#8221; mechanism can be used in
737
+either .c or .h files.
738
+(The &#8220;<code>#if INTERFACE</code>&#8221; can also be used in both .h and
739
+.c files, but since it's use in a .h file would be redundant, we haven't
740
+mentioned it before.)
736741
</p>
737742
738743
<a name="H0011"></a>
739744
<h3>3.5 Local declarations processed by makeheaders</h3>
740745
@@ -742,11 +747,11 @@
742747
Structure declarations and typedefs that appear in .c files are normally
743748
ignored by makeheaders.
744749
Such declarations are only intended for use by the source file in which
745750
they appear and so makeheaders doesn't need to copy them into any
746751
generated header files.
747
-We call such declarations ``private''.
752
+We call such declarations &#8220;<code>private</code>&#8221;.
748753
</p>
749754
750755
<p>
751756
Sometimes it is convenient to have makeheaders sort a sequence
752757
of private declarations into the correct order for us automatically.
@@ -764,12 +769,13 @@
764769
within
765770
<pre>
766771
#if LOCAL_INTERFACE
767772
#endif
768773
</pre>
769
-A ``LOCAL_INTERFACE'' block works very much like the
770
-``INTERFACE'' and ``EXPORT_INTERFACE''
774
+A &#8220;<code>LOCAL_INTERFACE</code>&#8221; block works very much like the
775
+&#8220;<code>INTERFACE</code>&#8221; and
776
+&#8220;<code>EXPORT_INTERFACE</code>&#8221;
771777
blocks described above, except that makeheaders insures that the
772778
objects declared in a LOCAL_INTERFACE are only visible to the
773779
file containing the LOCAL_INTERFACE.
774780
</p>
775781
@@ -777,11 +783,12 @@
777783
<h3>3.6 Using Makeheaders With C++ Code</h3>
778784
779785
<p>
780786
You can use makeheaders to generate header files for C++ code, in
781787
addition to C.
782
-Makeheaders will recognize and copy both ``class'' declarations
788
+Makeheaders will recognize and copy both &#8220;<code>class</code>&#8221;
789
+declarations
783790
and inline function definitions, and it knows not to try to generate
784791
prototypes for methods.
785792
</p>
786793
787794
<p>
@@ -805,20 +812,20 @@
805812
C++ input. Makeheaders will recognize that its source code is C++
806813
by the suffix on the source code filename. Simple ".c" or ".h" suffixes
807814
are assumed to be ANSI-C. Anything else, including ".cc", ".C" and
808815
".cpp" is assumed to be C++.
809816
The name of the header file generated by makeheaders is derived from
810
-by the name of the source file by converting every "c" to "h" and
817
+the name of the source file by converting every "c" to "h" and
811818
every "C" to "H" in the suffix of the filename.
812819
Thus the C++ source
813
-file ``alpha.cpp'' will induce makeheaders to
814
-generate a header file named ``alpha.hpp''.
820
+file &#8220;<code>alpha.cpp</code>&#8221; will induce makeheaders to
821
+generate a header file named &#8220;<code>alpha.hpp</code>&#8221;.
815822
</p>
816823
817824
<p>
818825
Makeheaders augments class definitions by inserting prototypes to
819
-methods were appropriate. If a method definition begins with one
826
+methods where appropriate. If a method definition begins with one
820827
of the special keywords <b>PUBLIC</b>, <b>PROTECTED</b>, or
821828
<b>PRIVATE</b> (in upper-case to distinguish them from the regular
822829
C++ keywords with the same meaning) then a prototype for that
823830
method will be inserted into the class definition. If none of
824831
these keywords appear, then the prototype is not inserted. For
@@ -867,11 +874,11 @@
867874
<h4>3.6.1 C++ Limitations</h4>
868875
869876
<p>
870877
Makeheaders does not understand more recent
871878
C++ syntax such as templates and namespaces.
872
-Perhaps these issued will be addressed in future revisions.
879
+Perhaps these issues will be addressed in future revisions.
873880
</p>
874881
875882
<a name="H0013"></a>
876883
<h3>3.7 Conditional Compilation</h3>
877884
@@ -879,13 +886,13 @@
879886
The makeheaders program understands and tracks the conditional
880887
compilation constructs in the source code files it scans.
881888
Hence, if the following code appears in a source file
882889
<pre>
883890
#ifdef UNIX
884
- # define WORKS_WELL 1
891
+ # define WORKS_WELL 1
885892
#else
886
- # define WORKS_WELL 0
893
+ # define WORKS_WELL 0
887894
#endif
888895
</pre>
889896
then the next patch of code will appear in the generated header for
890897
every .c file that uses the WORKS_WELL constant:
891898
<pre>
@@ -918,12 +925,12 @@
918925
<p>
919926
Makeheaders does not understand the old K&amp;R style of function
920927
and procedure definitions.
921928
It only understands the modern ANSI-C style, and will probably
922929
become very confused if it encounters an old K&amp;R function.
923
-You should take care to avoid putting K&amp;R function defintions
924
-in your code, therefore.
930
+Therefore you should take care to avoid putting K&amp;R function definitions
931
+in your code.
925932
</p>
926933
927934
<p>
928935
Makeheaders does not understand when you define more than one
929936
global variable with the same type separated by a comma.
@@ -993,35 +1000,35 @@
9931000
in the code, it is not necessary to make a corresponding change
9941001
in a separate document. Just rerun the documentation generator.
9951002
</ul>
9961003
The makeheaders program does not generate program documentation itself.
9971004
But you can use makeheaders to parse the program source code, extract
998
-the information that is relavant to the documentation and to pass this
1005
+the information that is relevant to the documentation and to pass this
9991006
information to another tool to do the actual documentation preparation.
10001007
</p>
10011008
10021009
<p>
1003
-When makeheaders is run with the ``-doc'' option, it emits
1004
-no header files at all.
1010
+When makeheaders is run with the &#8220;<code>-doc</code>&#8221; option, it
1011
+emits no header files at all.
10051012
Instead, it does a complete dump of its internal tables to standard
1006
-outputs in a form that is easily parsed.
1013
+output in a form that is easily parsed.
10071014
This output can then be used by another program (the implementation
10081015
of which is left as an exercise to the reader) that will use the
10091016
information to prepare suitable documentation.
10101017
</p>
10111018
10121019
<p>
1013
-The ``-doc'' option causes makeheaders to print information
1014
-to standard output about all of the following objects:
1020
+The &#8220;<code>-doc</code>&#8221; option causes makeheaders to print
1021
+information to standard output about all of the following objects:
10151022
<ul>
1016
-<li> C++ Class declarations
1023
+<li> C++ class declarations
10171024
<li> Structure and union declarations
10181025
<li> Enumerations
10191026
<li> Typedefs
10201027
<li> Procedure and function definitions
10211028
<li> Global variables
1022
-<li> Preprocessor macros (ex: ``#define'')
1029
+<li> Preprocessor macros (ex: &#8220;<code>#define</code>&#8221;)
10231030
</ul>
10241031
For each of these objects, the following information is output:
10251032
<ul>
10261033
<li> The name of the object.
10271034
<li> The type of the object. (Structure, typedef, macro, etc.)
@@ -1029,11 +1036,12 @@
10291036
an EXPORT_INTERFACE block) or local (contained with LOCAL_INTERFACE).
10301037
<li> A flag to indicate if the object is declared in a C++ file.
10311038
<li> The name of the file in which the object was declared.
10321039
<li> The complete text of any block comment that preceeds the declarations.
10331040
<li> If the declaration occurred inside a preprocessor conditional
1034
- (``#if'') then the text of that conditional is provided.
1041
+ (&#8220;<code>#if</code>&#8221;) then the text of that conditional is
1042
+ provided.
10351043
<li> The complete text of a declaration for the object.
10361044
</ul>
10371045
The exact output format will not be described here.
10381046
It is simple to understand and parse and should be obvious to
10391047
anyone who inspects some sample output.
@@ -1042,11 +1050,11 @@
10421050
<a name="H0016"></a>
10431051
<h2>5.0 Compiling The Makeheaders Program</h2>
10441052
10451053
<p>
10461054
The source code for makeheaders is a single file of ANSI-C code,
1047
-less than 3000 lines in length.
1055
+approximately 3000 lines in length.
10481056
The program makes only modest demands of the system and C library
10491057
and should compile without alteration on most ANSI C compilers
10501058
and on most operating systems.
10511059
It is known to compile using several variations of GCC for Unix
10521060
as well as Cygwin32 and MSVC 5.0 for Win32.
10531061
--- src/makeheaders.html
+++ src/makeheaders.html
@@ -4,11 +4,11 @@
4 <h1 align=center>The Makeheaders Program</h1>
5
6
7 <p>
8 This document describes <em>makeheaders</em>,
9 a tool that automatically generates ``<code>.h</code>''
10 files for a C or C++ programming project.
11 </p>
12
13
14 <h2>Table Of Contents</h2>
@@ -67,11 +67,11 @@
67 <ul>
68 <li> Typedefs.
69 <li> Structure, union and enumeration declarations.
70 <li> Function and procedure prototypes.
71 <li> Preprocessor macros and #defines.
72 <li> ``extern'' variable declarations.
73 </ul>
74 </p>
75
76 <p>
77 Definitions in C, on the other hand, include these kinds of things:
@@ -89,13 +89,13 @@
89 is the <em>interface</em> and the definition is the <em>implementation</em>.
90 </p>
91
92 <p>
93 In C programs, it has always been the tradition that declarations are
94 put in files with the ``<code>.h</code>'' suffix and definitions are
95 placed in ``<code>.c</code>'' files.
96 The .c files contain ``<code>#include</code>'' preprocessor statements
97 that cause the contents of .h files to be included as part of the
98 source code when the .c file is compiled.
99 In this way, the .h files define the interface to a subsystem and
100 the .c files define how the subsystem is implemented.
101 </p>
@@ -262,11 +262,11 @@
262
263 <p>
264 A similar option is -H. Like the lower-case -h option, big -H
265 generates a single include file on standard output. But unlike
266 small -h, the big -H only emits prototypes and declarations that
267 have been designated as ``exportable''.
268 The idea is that -H will generate an include file that defines
269 the interface to a library.
270 More will be said about this in section 3.4.
271 </p>
272
@@ -293,13 +293,13 @@
293 then you can supply an empty header filename, like this:
294 <pre>
295 makeheaders alpha.c beta.c gamma.c:
296 </pre>
297 In this example, makeheaders will scan the three files named
298 ``alpha.c'',
299 ``beta.c'' and
300 ``gamma.c''
301 but because of the colon on the end of third filename
302 it will only generate headers for the first two files.
303 Unfortunately,
304 it is not possible to get makeheaders to process any file whose
305 name contains a colon.
@@ -309,14 +309,14 @@
309 In a large project, the length of the command line for makeheaders
310 can become very long.
311 If the operating system doesn't support long command lines
312 (example: DOS and Win32) you may not be able to list all of the
313 input files in the space available.
314 In that case, you can use the ``-f'' option followed
315 by the name of a file to cause makeheaders to read command line
316 options and filename from the file instead of from the command line.
317 For example, you might prepare a file named ``mkhdr.dat''
318 that contains text like this:
319 <pre>
320 src/alpha.c:hdr/alpha.h
321 src/beta.c:hdr/beta.h
322 src/gamma.c:hdr/gamma.h
@@ -327,18 +327,18 @@
327 makeheaders -f mkhdr.dat
328 </pre>
329 </p>
330
331 <p>
332 The ``-local'' option causes makeheaders to
333 generate of prototypes for ``static'' functions and
334 procedures.
335 Such prototypes are normally omitted.
336 </p>
337
338 <p>
339 Finally, makeheaders also includes a ``-doc'' option.
340 This command line option prevents makeheaders from generating any
341 headers at all.
342 Instead, makeheaders will write to standard output
343 information about every definition and declaration that it encounters
344 in its scan of source files.
@@ -352,19 +352,21 @@
352 </p>
353
354 <p>
355 If you forget what command line options are available, or forget
356 their exact name, you can invoke makeheaders using an unknown
357 command line option (like ``--help'' or ``-?'')
 
358 and it will print a summary of the available options on standard
359 error.
360 If you need to process a file whose name begins with ``-'',
361 you can prepend a ``./'' to its name in order to get it
 
362 accepted by the command line parser.
363 Or, you can insert the special option ``--'' on the command
364 line to cause all subsequent command line arguments to be treated as
365 filenames even if their names beginn with ``-''.
366 </p>
367
368 <a name="H0006"></a>
369 <h2>3.0 Preparing Source Files For Use With Makeheaders</h2>
370
@@ -379,30 +381,31 @@
379
380 <a name="H0007"></a>
381 <h3>3.1 The Basic Setup</h3>
382
383 <p>
384 The simpliest way to use makeheaders is to put all definitions in
385 one or more .c files and all structure and type declarations in
386 separate .h files.
387 The only restriction is that you should take care to chose basenames
388 for your .h files that are different from the basenames for you
389 .c files.
390 Recall that if your .c file is named (for example) ``alpha.c''
 
391 makeheaders will attempt to generate a corresponding header file
392 named ``alpha.h''.
393 For that reason, you don't want to use that name for
394 any of the .h files you write since that will prevent makeheaders
395 from generating the .h file automatically.
396 </p>
397
398 <p>
399 The structure of a .c file intented for use with makeheaders is very
400 simple.
401 All you have to do is add a single ``#include'' to the top
402 of the file that sources the header file that makeheaders will generate.
403 Hence, the beginning of a source file named ``alpha.c''
404 might look something like this:
405 </p>
406
407 <pre>
408 /*
@@ -415,14 +418,14 @@
415
416 <p>
417 Your manually generated header files require no special attention at all.
418 Code them as you normally would.
419 However, makeheaders will work better if you omit the
420 ``#if'' statements people often put around the outside of
421 header files that prevent the files from being included more than once.
422 For example, to create a header file named ``beta.h'', many
423 people will habitually write the following:
424
425 <pre>
426 #ifndef BETA_H
427 #define BETA_H
428
@@ -435,11 +438,11 @@
435 Remember that the header files you write will never really be
436 included by any C code.
437 Instead, makeheaders will scan your header files to extract only
438 those declarations that are needed by individual .c files and then
439 copy those declarations to the .h files corresponding to the .c files.
440 Hence, the ``#if'' wrapper serves no useful purpose.
441 But it does make makeheaders work harder, forcing it to put
442 the statements
443
444 <pre>
445 #if !defined(BETA_H)
@@ -465,11 +468,11 @@
465 </p>
466
467 <p>
468 Note that
469 the wildcard expression used in the above example,
470 ``<code>*.[ch]</code>'',
471 will expand to include all .h files in the current directory, both
472 those entered manually be the programmer and others generated automatically
473 by a prior run of makeheaders.
474 But that is not a problem.
475 The makeheaders program will recognize and ignore any files it
@@ -489,14 +492,14 @@
489 <p><li>
490 When a function is defined in any .c file, a prototype of that function
491 is placed in the generated .h file of every .c file that
492 calls the function.</p>
493
494 <P>If the ``static'' keyword of C appears at the beginning
495 of the function definition, the prototype is suppressed.
496 If you use the ``LOCAL'' keyword where you would normally
497 say ``static'', then a prototype is generated, but it
498 will only appear in the single header file that corresponds to the
499 source file containing the function. For example, if the file
500 <code>alpha.c</code> contains the following:
501 <pre>
502 LOCAL int testFunc(void){
@@ -509,24 +512,26 @@
509 LOCAL int testFunc(void);
510 </pre>
511 However, no other generated header files will contain a prototype for
512 <code>testFunc()</code> since the function has only file scope.</p>
513
514 <p>When the ``LOCAL'' keyword is used, makeheaders will also
515 generate a #define for LOCAL, like this:
516 <pre>
517 #define LOCAL static
518 </pre>
519 so that the C compiler will know what it means.</p>
520
521 <p>If you invoke makeheaders with a ``-local'' command-line
522 option, then it treats the ``static'' keyword like
523 ``LOCAL'' and generates prototypes in the header file
524 that corresponds to the source file containing the function defintiion.</p>
 
525
526 <p><li>
527 When a global variable is defined in a .c file, an ``extern''
 
528 declaration of that variable is placed in the header of every
529 .c file that uses the variable.
530 </p>
531
532 <p><li>
@@ -550,12 +555,12 @@
550
551 <p><li>
552 When a structure, union or enumeration declaration appears in a .h
553 file, makeheaders will automatically
554 generate a typedef that allows the declaration to be referenced without
555 the ``struct'', ``union'' or ``enum''
556 qualifier.
557 In other words, if makeheaders sees the code:
558 <pre>
559 struct Examp { /* ... */ };
560 </pre>
561 it will automatically generate a corresponding typedef like this:
@@ -572,13 +577,13 @@
572 </ul>
573
574 <p>
575 As a final note, we observe that automatically generated declarations
576 are ordered as required by the ANSI-C programming language.
577 If the declaration of some structure ``X'' requires a prior
578 declaration of another structure ``Y'', then Y will appear
579 first in the generated headers.
580 </p>
581
582 <a name="H0009"></a>
583 <h3>3.3 How To Avoid Having To Write Any Header Files</h3>
584
@@ -611,18 +616,18 @@
611 <pre>
612 #if INTERFACE
613 #endif
614 </pre>
615 Thus any structure definitions that appear after the
616 ``#if INTERFACE'' but before the corresponding
617 ``#endif'' are eligable to be copied into the
618 automatically generated
619 .h files of other .c files.
620 </p>
621
622 <p>
623 If you use the ``#if INTERFACE'' mechanism in a .c file,
624 then the generated header for that .c file will contain a line
625 like this:
626 <pre>
627 #define INTERFACE 0
628 </pre>
@@ -637,15 +642,15 @@
637 </p>
638
639 <p>
640 Note that you don't have to use this approach exclusively.
641 You can put some declarations in .h files and others within the
642 ``#if INTERFACE'' regions of .c files.
643 Makeheaders treats all declarations alike, no matter where they
644 come from.
645 You should also note that a single .c file can contain as many
646 ``#if INTERFACE'' regions as desired.
647 </p>
648
649 <a name="H0010"></a>
650 <h3>3.4 Designating Declarations For Export</h3>
651
@@ -664,11 +669,11 @@
664 like this, but makeheaders does.
665 </p>
666
667 <p>
668 Using makeheaders, it is possible to designate routines and data
669 structures as being for ``export''.
670 Exported objects are visible not only to other files within the
671 same library or subassembly but also to other
672 libraries and subassemblies in the larger program.
673 By default, makeheaders only makes objects visible to other members
674 of the same library.
@@ -690,14 +695,14 @@
690
691 <p>
692 But trouble quickly arises when we attempt to devise a mechanism for
693 telling makeheaders which prototypes it should export and which it should
694 keep local.
695 The built-in ``static'' keyword of C works well for prohibiting
696 prototypes from leaving a single source file, but because C doesn't
697 support a linkage hierarchy, there is nothing in the C language to help us.
698 We'll have to invite our own keyword: ``EXPORT''
699 </p>
700
701 <p>
702 Makeheaders allows the EXPORT keyword to precede any function or
703 procedure definition.
@@ -726,15 +731,15 @@
726 <pre>
727 #if EXPORT_INTERFACE
728 #endif
729 </pre>
730 will become part of the exported interface.
731 The ``#if EXPORT_INTERFACE'' mechanism can be used in either
732 .c or .h files.
733 (The ``#if INTERFACE'' can also be used in both .h and .c files,
734 but since it's use in a .h file would be redundant, we haven't mentioned
735 it before.)
736 </p>
737
738 <a name="H0011"></a>
739 <h3>3.5 Local declarations processed by makeheaders</h3>
740
@@ -742,11 +747,11 @@
742 Structure declarations and typedefs that appear in .c files are normally
743 ignored by makeheaders.
744 Such declarations are only intended for use by the source file in which
745 they appear and so makeheaders doesn't need to copy them into any
746 generated header files.
747 We call such declarations ``private''.
748 </p>
749
750 <p>
751 Sometimes it is convenient to have makeheaders sort a sequence
752 of private declarations into the correct order for us automatically.
@@ -764,12 +769,13 @@
764 within
765 <pre>
766 #if LOCAL_INTERFACE
767 #endif
768 </pre>
769 A ``LOCAL_INTERFACE'' block works very much like the
770 ``INTERFACE'' and ``EXPORT_INTERFACE''
 
771 blocks described above, except that makeheaders insures that the
772 objects declared in a LOCAL_INTERFACE are only visible to the
773 file containing the LOCAL_INTERFACE.
774 </p>
775
@@ -777,11 +783,12 @@
777 <h3>3.6 Using Makeheaders With C++ Code</h3>
778
779 <p>
780 You can use makeheaders to generate header files for C++ code, in
781 addition to C.
782 Makeheaders will recognize and copy both ``class'' declarations
 
783 and inline function definitions, and it knows not to try to generate
784 prototypes for methods.
785 </p>
786
787 <p>
@@ -805,20 +812,20 @@
805 C++ input. Makeheaders will recognize that its source code is C++
806 by the suffix on the source code filename. Simple ".c" or ".h" suffixes
807 are assumed to be ANSI-C. Anything else, including ".cc", ".C" and
808 ".cpp" is assumed to be C++.
809 The name of the header file generated by makeheaders is derived from
810 by the name of the source file by converting every "c" to "h" and
811 every "C" to "H" in the suffix of the filename.
812 Thus the C++ source
813 file ``alpha.cpp'' will induce makeheaders to
814 generate a header file named ``alpha.hpp''.
815 </p>
816
817 <p>
818 Makeheaders augments class definitions by inserting prototypes to
819 methods were appropriate. If a method definition begins with one
820 of the special keywords <b>PUBLIC</b>, <b>PROTECTED</b>, or
821 <b>PRIVATE</b> (in upper-case to distinguish them from the regular
822 C++ keywords with the same meaning) then a prototype for that
823 method will be inserted into the class definition. If none of
824 these keywords appear, then the prototype is not inserted. For
@@ -867,11 +874,11 @@
867 <h4>3.6.1 C++ Limitations</h4>
868
869 <p>
870 Makeheaders does not understand more recent
871 C++ syntax such as templates and namespaces.
872 Perhaps these issued will be addressed in future revisions.
873 </p>
874
875 <a name="H0013"></a>
876 <h3>3.7 Conditional Compilation</h3>
877
@@ -879,13 +886,13 @@
879 The makeheaders program understands and tracks the conditional
880 compilation constructs in the source code files it scans.
881 Hence, if the following code appears in a source file
882 <pre>
883 #ifdef UNIX
884 # define WORKS_WELL 1
885 #else
886 # define WORKS_WELL 0
887 #endif
888 </pre>
889 then the next patch of code will appear in the generated header for
890 every .c file that uses the WORKS_WELL constant:
891 <pre>
@@ -918,12 +925,12 @@
918 <p>
919 Makeheaders does not understand the old K&amp;R style of function
920 and procedure definitions.
921 It only understands the modern ANSI-C style, and will probably
922 become very confused if it encounters an old K&amp;R function.
923 You should take care to avoid putting K&amp;R function defintions
924 in your code, therefore.
925 </p>
926
927 <p>
928 Makeheaders does not understand when you define more than one
929 global variable with the same type separated by a comma.
@@ -993,35 +1000,35 @@
993 in the code, it is not necessary to make a corresponding change
994 in a separate document. Just rerun the documentation generator.
995 </ul>
996 The makeheaders program does not generate program documentation itself.
997 But you can use makeheaders to parse the program source code, extract
998 the information that is relavant to the documentation and to pass this
999 information to another tool to do the actual documentation preparation.
1000 </p>
1001
1002 <p>
1003 When makeheaders is run with the ``-doc'' option, it emits
1004 no header files at all.
1005 Instead, it does a complete dump of its internal tables to standard
1006 outputs in a form that is easily parsed.
1007 This output can then be used by another program (the implementation
1008 of which is left as an exercise to the reader) that will use the
1009 information to prepare suitable documentation.
1010 </p>
1011
1012 <p>
1013 The ``-doc'' option causes makeheaders to print information
1014 to standard output about all of the following objects:
1015 <ul>
1016 <li> C++ Class declarations
1017 <li> Structure and union declarations
1018 <li> Enumerations
1019 <li> Typedefs
1020 <li> Procedure and function definitions
1021 <li> Global variables
1022 <li> Preprocessor macros (ex: ``#define'')
1023 </ul>
1024 For each of these objects, the following information is output:
1025 <ul>
1026 <li> The name of the object.
1027 <li> The type of the object. (Structure, typedef, macro, etc.)
@@ -1029,11 +1036,12 @@
1029 an EXPORT_INTERFACE block) or local (contained with LOCAL_INTERFACE).
1030 <li> A flag to indicate if the object is declared in a C++ file.
1031 <li> The name of the file in which the object was declared.
1032 <li> The complete text of any block comment that preceeds the declarations.
1033 <li> If the declaration occurred inside a preprocessor conditional
1034 (``#if'') then the text of that conditional is provided.
 
1035 <li> The complete text of a declaration for the object.
1036 </ul>
1037 The exact output format will not be described here.
1038 It is simple to understand and parse and should be obvious to
1039 anyone who inspects some sample output.
@@ -1042,11 +1050,11 @@
1042 <a name="H0016"></a>
1043 <h2>5.0 Compiling The Makeheaders Program</h2>
1044
1045 <p>
1046 The source code for makeheaders is a single file of ANSI-C code,
1047 less than 3000 lines in length.
1048 The program makes only modest demands of the system and C library
1049 and should compile without alteration on most ANSI C compilers
1050 and on most operating systems.
1051 It is known to compile using several variations of GCC for Unix
1052 as well as Cygwin32 and MSVC 5.0 for Win32.
1053
--- src/makeheaders.html
+++ src/makeheaders.html
@@ -4,11 +4,11 @@
4 <h1 align=center>The Makeheaders Program</h1>
5
6
7 <p>
8 This document describes <em>makeheaders</em>,
9 a tool that automatically generates &#8220;<code>.h</code>&#8221;
10 files for a C or C++ programming project.
11 </p>
12
13
14 <h2>Table Of Contents</h2>
@@ -67,11 +67,11 @@
67 <ul>
68 <li> Typedefs.
69 <li> Structure, union and enumeration declarations.
70 <li> Function and procedure prototypes.
71 <li> Preprocessor macros and #defines.
72 <li> &#8220;<code>extern</code>&#8221; variable declarations.
73 </ul>
74 </p>
75
76 <p>
77 Definitions in C, on the other hand, include these kinds of things:
@@ -89,13 +89,13 @@
89 is the <em>interface</em> and the definition is the <em>implementation</em>.
90 </p>
91
92 <p>
93 In C programs, it has always been the tradition that declarations are
94 put in files with the &#8220;<code>.h</code>&#8221; suffix and definitions are
95 placed in &#8220;<code>.c</code>&#8221; files.
96 The .c files contain &#8220;<code>#include</code>&#8221; preprocessor statements
97 that cause the contents of .h files to be included as part of the
98 source code when the .c file is compiled.
99 In this way, the .h files define the interface to a subsystem and
100 the .c files define how the subsystem is implemented.
101 </p>
@@ -262,11 +262,11 @@
262
263 <p>
264 A similar option is -H. Like the lower-case -h option, big -H
265 generates a single include file on standard output. But unlike
266 small -h, the big -H only emits prototypes and declarations that
267 have been designated as &#8220;exportable&#8221;.
268 The idea is that -H will generate an include file that defines
269 the interface to a library.
270 More will be said about this in section 3.4.
271 </p>
272
@@ -293,13 +293,13 @@
293 then you can supply an empty header filename, like this:
294 <pre>
295 makeheaders alpha.c beta.c gamma.c:
296 </pre>
297 In this example, makeheaders will scan the three files named
298 &#8220;<code>alpha.c</code>&#8221;,
299 &#8220;<code>beta.c</code>&#8221; and
300 &#8220;<code>gamma.c</code>&#8221;
301 but because of the colon on the end of third filename
302 it will only generate headers for the first two files.
303 Unfortunately,
304 it is not possible to get makeheaders to process any file whose
305 name contains a colon.
@@ -309,14 +309,14 @@
309 In a large project, the length of the command line for makeheaders
310 can become very long.
311 If the operating system doesn't support long command lines
312 (example: DOS and Win32) you may not be able to list all of the
313 input files in the space available.
314 In that case, you can use the &#8220;<code>-f</code>&#8221; option followed
315 by the name of a file to cause makeheaders to read command line
316 options and filename from the file instead of from the command line.
317 For example, you might prepare a file named &#8220;<code>mkhdr.dat</code>&#8221;
318 that contains text like this:
319 <pre>
320 src/alpha.c:hdr/alpha.h
321 src/beta.c:hdr/beta.h
322 src/gamma.c:hdr/gamma.h
@@ -327,18 +327,18 @@
327 makeheaders -f mkhdr.dat
328 </pre>
329 </p>
330
331 <p>
332 The &#8220;<code>-local</code>&#8221; option causes makeheaders to
333 generate of prototypes for &#8220;<code>static</code>&#8221; functions and
334 procedures.
335 Such prototypes are normally omitted.
336 </p>
337
338 <p>
339 Finally, makeheaders also includes a &#8220;<code>-doc</code>&#8221; option.
340 This command line option prevents makeheaders from generating any
341 headers at all.
342 Instead, makeheaders will write to standard output
343 information about every definition and declaration that it encounters
344 in its scan of source files.
@@ -352,19 +352,21 @@
352 </p>
353
354 <p>
355 If you forget what command line options are available, or forget
356 their exact name, you can invoke makeheaders using an unknown
357 command line option (like &#8220;<code>--help</code>&#8221; or
358 &#8220;<code>-?</code>&#8221;)
359 and it will print a summary of the available options on standard
360 error.
361 If you need to process a file whose name begins with
362 &#8220;<code>-</code>&#8221;,
363 you can prepend a &#8220;<code>./</code>&#8221; to its name in order to get it
364 accepted by the command line parser.
365 Or, you can insert the special option &#8220;<code>--</code>&#8221; on the
366 command line to cause all subsequent command line arguments to be treated as
367 filenames even if their names begin with &#8220;<code>-</code>&#8221;.
368 </p>
369
370 <a name="H0006"></a>
371 <h2>3.0 Preparing Source Files For Use With Makeheaders</h2>
372
@@ -379,30 +381,31 @@
381
382 <a name="H0007"></a>
383 <h3>3.1 The Basic Setup</h3>
384
385 <p>
386 The simplest way to use makeheaders is to put all definitions in
387 one or more .c files and all structure and type declarations in
388 separate .h files.
389 The only restriction is that you should take care to chose basenames
390 for your .h files that are different from the basenames for your
391 .c files.
392 Recall that if your .c file is named (for example)
393 &#8220;<code>alpha.c</code>&#8221;
394 makeheaders will attempt to generate a corresponding header file
395 named &#8220;<code>alpha.h</code>&#8221;.
396 For that reason, you don't want to use that name for
397 any of the .h files you write since that will prevent makeheaders
398 from generating the .h file automatically.
399 </p>
400
401 <p>
402 The structure of a .c file intented for use with makeheaders is very
403 simple.
404 All you have to do is add a single &#8220;<code>#include</code>&#8221; to the
405 top of the file that sources the header file that makeheaders will generate.
406 Hence, the beginning of a source file named &#8220;<code>alpha.c</code>&#8221;
407 might look something like this:
408 </p>
409
410 <pre>
411 /*
@@ -415,14 +418,14 @@
418
419 <p>
420 Your manually generated header files require no special attention at all.
421 Code them as you normally would.
422 However, makeheaders will work better if you omit the
423 &#8220;<code>#if</code>&#8221; statements people often put around the outside of
424 header files that prevent the files from being included more than once.
425 For example, to create a header file named &#8220;<code>beta.h</code>&#8221;,
426 many people will habitually write the following:
427
428 <pre>
429 #ifndef BETA_H
430 #define BETA_H
431
@@ -435,11 +438,11 @@
438 Remember that the header files you write will never really be
439 included by any C code.
440 Instead, makeheaders will scan your header files to extract only
441 those declarations that are needed by individual .c files and then
442 copy those declarations to the .h files corresponding to the .c files.
443 Hence, the &#8220;<code>#if</code>&#8221; wrapper serves no useful purpose.
444 But it does make makeheaders work harder, forcing it to put
445 the statements
446
447 <pre>
448 #if !defined(BETA_H)
@@ -465,11 +468,11 @@
468 </p>
469
470 <p>
471 Note that
472 the wildcard expression used in the above example,
473 &#8220;<code>*.[ch]</code>&#8221;,
474 will expand to include all .h files in the current directory, both
475 those entered manually be the programmer and others generated automatically
476 by a prior run of makeheaders.
477 But that is not a problem.
478 The makeheaders program will recognize and ignore any files it
@@ -489,14 +492,14 @@
492 <p><li>
493 When a function is defined in any .c file, a prototype of that function
494 is placed in the generated .h file of every .c file that
495 calls the function.</p>
496
497 <P>If the &#8220;<code>static</code>&#8221; keyword of C appears at the
498 beginning of the function definition, the prototype is suppressed.
499 If you use the &#8220;<code>LOCAL</code>&#8221; keyword where you would normally
500 say &#8220;<code>static</code>&#8221;, then a prototype is generated, but it
501 will only appear in the single header file that corresponds to the
502 source file containing the function. For example, if the file
503 <code>alpha.c</code> contains the following:
504 <pre>
505 LOCAL int testFunc(void){
@@ -509,24 +512,26 @@
512 LOCAL int testFunc(void);
513 </pre>
514 However, no other generated header files will contain a prototype for
515 <code>testFunc()</code> since the function has only file scope.</p>
516
517 <p>When the &#8220;<code>LOCAL</code>&#8221; keyword is used, makeheaders will
518 also generate a #define for LOCAL, like this:
519 <pre>
520 #define LOCAL static
521 </pre>
522 so that the C compiler will know what it means.</p>
523
524 <p>If you invoke makeheaders with a &#8220;<code>-local</code>&#8221;
525 command-line option, then it treats the &#8220;<code>static</code>&#8221;
526 keyword like &#8220;<code>LOCAL</code>&#8221; and generates prototypes in the
527 header file that corresponds to the source file containing the function
528 definition.</p>
529
530 <p><li>
531 When a global variable is defined in a .c file, an
532 &#8220;<code>extern</code>&#8221;
533 declaration of that variable is placed in the header of every
534 .c file that uses the variable.
535 </p>
536
537 <p><li>
@@ -550,12 +555,12 @@
555
556 <p><li>
557 When a structure, union or enumeration declaration appears in a .h
558 file, makeheaders will automatically
559 generate a typedef that allows the declaration to be referenced without
560 the &#8220;<code>struct</code>&#8221;, &#8220;<code>union</code>&#8221; or
561 &#8220;<code>enum</code>&#8221; qualifier.
562 In other words, if makeheaders sees the code:
563 <pre>
564 struct Examp { /* ... */ };
565 </pre>
566 it will automatically generate a corresponding typedef like this:
@@ -572,13 +577,13 @@
577 </ul>
578
579 <p>
580 As a final note, we observe that automatically generated declarations
581 are ordered as required by the ANSI-C programming language.
582 If the declaration of some structure &#8220;<code>X</code>&#8221; requires a
583 prior declaration of another structure &#8220;<code>Y</code>&#8221;, then Y will
584 appear first in the generated headers.
585 </p>
586
587 <a name="H0009"></a>
588 <h3>3.3 How To Avoid Having To Write Any Header Files</h3>
589
@@ -611,18 +616,18 @@
616 <pre>
617 #if INTERFACE
618 #endif
619 </pre>
620 Thus any structure definitions that appear after the
621 &#8220;<code>#if INTERFACE</code>&#8221; but before the corresponding
622 &#8220;<code>#endif</code>&#8221; are eligable to be copied into the
623 automatically generated
624 .h files of other .c files.
625 </p>
626
627 <p>
628 If you use the &#8220;<code>#if INTERFACE</code>&#8221; mechanism in a .c file,
629 then the generated header for that .c file will contain a line
630 like this:
631 <pre>
632 #define INTERFACE 0
633 </pre>
@@ -637,15 +642,15 @@
642 </p>
643
644 <p>
645 Note that you don't have to use this approach exclusively.
646 You can put some declarations in .h files and others within the
647 &#8220;<code>#if INTERFACE</code>&#8221; regions of .c files.
648 Makeheaders treats all declarations alike, no matter where they
649 come from.
650 You should also note that a single .c file can contain as many
651 &#8220;<code>#if INTERFACE</code>&#8221; regions as desired.
652 </p>
653
654 <a name="H0010"></a>
655 <h3>3.4 Designating Declarations For Export</h3>
656
@@ -664,11 +669,11 @@
669 like this, but makeheaders does.
670 </p>
671
672 <p>
673 Using makeheaders, it is possible to designate routines and data
674 structures as being for &#8220;<code>export</code>&#8221;.
675 Exported objects are visible not only to other files within the
676 same library or subassembly but also to other
677 libraries and subassemblies in the larger program.
678 By default, makeheaders only makes objects visible to other members
679 of the same library.
@@ -690,14 +695,14 @@
695
696 <p>
697 But trouble quickly arises when we attempt to devise a mechanism for
698 telling makeheaders which prototypes it should export and which it should
699 keep local.
700 The built-in &#8220;<code>static</code>&#8221; keyword of C works well for
701 prohibiting prototypes from leaving a single source file, but because C doesn't
702 support a linkage hierarchy, there is nothing in the C language to help us.
703 We'll have to invite our own keyword: &#8220;<code>EXPORT</code>&#8221;
704 </p>
705
706 <p>
707 Makeheaders allows the EXPORT keyword to precede any function or
708 procedure definition.
@@ -726,15 +731,15 @@
731 <pre>
732 #if EXPORT_INTERFACE
733 #endif
734 </pre>
735 will become part of the exported interface.
736 The &#8220;<code>#if EXPORT_INTERFACE</code>&#8221; mechanism can be used in
737 either .c or .h files.
738 (The &#8220;<code>#if INTERFACE</code>&#8221; can also be used in both .h and
739 .c files, but since it's use in a .h file would be redundant, we haven't
740 mentioned it before.)
741 </p>
742
743 <a name="H0011"></a>
744 <h3>3.5 Local declarations processed by makeheaders</h3>
745
@@ -742,11 +747,11 @@
747 Structure declarations and typedefs that appear in .c files are normally
748 ignored by makeheaders.
749 Such declarations are only intended for use by the source file in which
750 they appear and so makeheaders doesn't need to copy them into any
751 generated header files.
752 We call such declarations &#8220;<code>private</code>&#8221;.
753 </p>
754
755 <p>
756 Sometimes it is convenient to have makeheaders sort a sequence
757 of private declarations into the correct order for us automatically.
@@ -764,12 +769,13 @@
769 within
770 <pre>
771 #if LOCAL_INTERFACE
772 #endif
773 </pre>
774 A &#8220;<code>LOCAL_INTERFACE</code>&#8221; block works very much like the
775 &#8220;<code>INTERFACE</code>&#8221; and
776 &#8220;<code>EXPORT_INTERFACE</code>&#8221;
777 blocks described above, except that makeheaders insures that the
778 objects declared in a LOCAL_INTERFACE are only visible to the
779 file containing the LOCAL_INTERFACE.
780 </p>
781
@@ -777,11 +783,12 @@
783 <h3>3.6 Using Makeheaders With C++ Code</h3>
784
785 <p>
786 You can use makeheaders to generate header files for C++ code, in
787 addition to C.
788 Makeheaders will recognize and copy both &#8220;<code>class</code>&#8221;
789 declarations
790 and inline function definitions, and it knows not to try to generate
791 prototypes for methods.
792 </p>
793
794 <p>
@@ -805,20 +812,20 @@
812 C++ input. Makeheaders will recognize that its source code is C++
813 by the suffix on the source code filename. Simple ".c" or ".h" suffixes
814 are assumed to be ANSI-C. Anything else, including ".cc", ".C" and
815 ".cpp" is assumed to be C++.
816 The name of the header file generated by makeheaders is derived from
817 the name of the source file by converting every "c" to "h" and
818 every "C" to "H" in the suffix of the filename.
819 Thus the C++ source
820 file &#8220;<code>alpha.cpp</code>&#8221; will induce makeheaders to
821 generate a header file named &#8220;<code>alpha.hpp</code>&#8221;.
822 </p>
823
824 <p>
825 Makeheaders augments class definitions by inserting prototypes to
826 methods where appropriate. If a method definition begins with one
827 of the special keywords <b>PUBLIC</b>, <b>PROTECTED</b>, or
828 <b>PRIVATE</b> (in upper-case to distinguish them from the regular
829 C++ keywords with the same meaning) then a prototype for that
830 method will be inserted into the class definition. If none of
831 these keywords appear, then the prototype is not inserted. For
@@ -867,11 +874,11 @@
874 <h4>3.6.1 C++ Limitations</h4>
875
876 <p>
877 Makeheaders does not understand more recent
878 C++ syntax such as templates and namespaces.
879 Perhaps these issues will be addressed in future revisions.
880 </p>
881
882 <a name="H0013"></a>
883 <h3>3.7 Conditional Compilation</h3>
884
@@ -879,13 +886,13 @@
886 The makeheaders program understands and tracks the conditional
887 compilation constructs in the source code files it scans.
888 Hence, if the following code appears in a source file
889 <pre>
890 #ifdef UNIX
891 # define WORKS_WELL 1
892 #else
893 # define WORKS_WELL 0
894 #endif
895 </pre>
896 then the next patch of code will appear in the generated header for
897 every .c file that uses the WORKS_WELL constant:
898 <pre>
@@ -918,12 +925,12 @@
925 <p>
926 Makeheaders does not understand the old K&amp;R style of function
927 and procedure definitions.
928 It only understands the modern ANSI-C style, and will probably
929 become very confused if it encounters an old K&amp;R function.
930 Therefore you should take care to avoid putting K&amp;R function definitions
931 in your code.
932 </p>
933
934 <p>
935 Makeheaders does not understand when you define more than one
936 global variable with the same type separated by a comma.
@@ -993,35 +1000,35 @@
1000 in the code, it is not necessary to make a corresponding change
1001 in a separate document. Just rerun the documentation generator.
1002 </ul>
1003 The makeheaders program does not generate program documentation itself.
1004 But you can use makeheaders to parse the program source code, extract
1005 the information that is relevant to the documentation and to pass this
1006 information to another tool to do the actual documentation preparation.
1007 </p>
1008
1009 <p>
1010 When makeheaders is run with the &#8220;<code>-doc</code>&#8221; option, it
1011 emits no header files at all.
1012 Instead, it does a complete dump of its internal tables to standard
1013 output in a form that is easily parsed.
1014 This output can then be used by another program (the implementation
1015 of which is left as an exercise to the reader) that will use the
1016 information to prepare suitable documentation.
1017 </p>
1018
1019 <p>
1020 The &#8220;<code>-doc</code>&#8221; option causes makeheaders to print
1021 information to standard output about all of the following objects:
1022 <ul>
1023 <li> C++ class declarations
1024 <li> Structure and union declarations
1025 <li> Enumerations
1026 <li> Typedefs
1027 <li> Procedure and function definitions
1028 <li> Global variables
1029 <li> Preprocessor macros (ex: &#8220;<code>#define</code>&#8221;)
1030 </ul>
1031 For each of these objects, the following information is output:
1032 <ul>
1033 <li> The name of the object.
1034 <li> The type of the object. (Structure, typedef, macro, etc.)
@@ -1029,11 +1036,12 @@
1036 an EXPORT_INTERFACE block) or local (contained with LOCAL_INTERFACE).
1037 <li> A flag to indicate if the object is declared in a C++ file.
1038 <li> The name of the file in which the object was declared.
1039 <li> The complete text of any block comment that preceeds the declarations.
1040 <li> If the declaration occurred inside a preprocessor conditional
1041 (&#8220;<code>#if</code>&#8221;) then the text of that conditional is
1042 provided.
1043 <li> The complete text of a declaration for the object.
1044 </ul>
1045 The exact output format will not be described here.
1046 It is simple to understand and parse and should be obvious to
1047 anyone who inspects some sample output.
@@ -1042,11 +1050,11 @@
1050 <a name="H0016"></a>
1051 <h2>5.0 Compiling The Makeheaders Program</h2>
1052
1053 <p>
1054 The source code for makeheaders is a single file of ANSI-C code,
1055 approximately 3000 lines in length.
1056 The program makes only modest demands of the system and C library
1057 and should compile without alteration on most ANSI C compilers
1058 and on most operating systems.
1059 It is known to compile using several variations of GCC for Unix
1060 as well as Cygwin32 and MSVC 5.0 for Win32.
1061
+1 -1
--- src/markdown.c
+++ src/markdown.c
@@ -295,11 +295,11 @@
295295
/* binary search of the tag */
296296
key.text = data;
297297
key.size = i;
298298
return bsearch(&key,
299299
block_tags,
300
- (sizeof block_tags)/(sizeof block_tags[0]),
300
+ count(block_tags),
301301
sizeof block_tags[0],
302302
cmp_html_tag);
303303
}
304304
305305
306306
--- src/markdown.c
+++ src/markdown.c
@@ -295,11 +295,11 @@
295 /* binary search of the tag */
296 key.text = data;
297 key.size = i;
298 return bsearch(&key,
299 block_tags,
300 (sizeof block_tags)/(sizeof block_tags[0]),
301 sizeof block_tags[0],
302 cmp_html_tag);
303 }
304
305
306
--- src/markdown.c
+++ src/markdown.c
@@ -295,11 +295,11 @@
295 /* binary search of the tag */
296 key.text = data;
297 key.size = i;
298 return bsearch(&key,
299 block_tags,
300 count(block_tags),
301 sizeof block_tags[0],
302 cmp_html_tag);
303 }
304
305
306
+1 -1
--- src/merge3.c
+++ src/merge3.c
@@ -316,11 +316,11 @@
316316
const char *z = blob_buffer(p);
317317
int n = blob_size(p) - len + 1;
318318
assert( len==(int)strlen(mergeMarker[1]) );
319319
assert( len==(int)strlen(mergeMarker[2]) );
320320
assert( len==(int)strlen(mergeMarker[3]) );
321
- assert( sizeof(mergeMarker)/sizeof(mergeMarker[0])==4 );
321
+ assert( count(mergeMarker)==4 );
322322
for(i=0; i<n; ){
323323
for(j=0; j<4; j++){
324324
if( memcmp(&z[i], mergeMarker[j], len)==0 ) return 1;
325325
}
326326
while( i<n && z[i]!='\n' ){ i++; }
327327
--- src/merge3.c
+++ src/merge3.c
@@ -316,11 +316,11 @@
316 const char *z = blob_buffer(p);
317 int n = blob_size(p) - len + 1;
318 assert( len==(int)strlen(mergeMarker[1]) );
319 assert( len==(int)strlen(mergeMarker[2]) );
320 assert( len==(int)strlen(mergeMarker[3]) );
321 assert( sizeof(mergeMarker)/sizeof(mergeMarker[0])==4 );
322 for(i=0; i<n; ){
323 for(j=0; j<4; j++){
324 if( memcmp(&z[i], mergeMarker[j], len)==0 ) return 1;
325 }
326 while( i<n && z[i]!='\n' ){ i++; }
327
--- src/merge3.c
+++ src/merge3.c
@@ -316,11 +316,11 @@
316 const char *z = blob_buffer(p);
317 int n = blob_size(p) - len + 1;
318 assert( len==(int)strlen(mergeMarker[1]) );
319 assert( len==(int)strlen(mergeMarker[2]) );
320 assert( len==(int)strlen(mergeMarker[3]) );
321 assert( count(mergeMarker)==4 );
322 for(i=0; i<n; ){
323 for(j=0; j<4; j++){
324 if( memcmp(&z[i], mergeMarker[j], len)==0 ) return 1;
325 }
326 while( i<n && z[i]!='\n' ){ i++; }
327
+1 -1
--- src/moderate.c
+++ src/moderate.c
@@ -67,11 +67,11 @@
6767
"mlink", "fid",
6868
"tagxref", "srcid",
6969
"tagxref", "rid",
7070
};
7171
int i;
72
- for(i=0; i<sizeof(aTabField)/sizeof(aTabField[0]); i+=2){
72
+ for(i=0; i<count(aTabField); i+=2){
7373
if( db_exists("SELECT 1 FROM \"%w\" WHERE \"%w\"=%d",
7474
aTabField[i], aTabField[i+1], rid) ) return 1;
7575
}
7676
return 0;
7777
}
7878
--- src/moderate.c
+++ src/moderate.c
@@ -67,11 +67,11 @@
67 "mlink", "fid",
68 "tagxref", "srcid",
69 "tagxref", "rid",
70 };
71 int i;
72 for(i=0; i<sizeof(aTabField)/sizeof(aTabField[0]); i+=2){
73 if( db_exists("SELECT 1 FROM \"%w\" WHERE \"%w\"=%d",
74 aTabField[i], aTabField[i+1], rid) ) return 1;
75 }
76 return 0;
77 }
78
--- src/moderate.c
+++ src/moderate.c
@@ -67,11 +67,11 @@
67 "mlink", "fid",
68 "tagxref", "srcid",
69 "tagxref", "rid",
70 };
71 int i;
72 for(i=0; i<count(aTabField); i+=2){
73 if( db_exists("SELECT 1 FROM \"%w\" WHERE \"%w\"=%d",
74 aTabField[i], aTabField[i+1], rid) ) return 1;
75 }
76 return 0;
77 }
78
+1 -1
--- src/name.c
+++ src/name.c
@@ -1204,11 +1204,11 @@
12041204
char *zId = aCollide[i].azHit[j];
12051205
if( zId==0 ) continue;
12061206
@ %z(href("%R/whatis/%s",zId))%h(zId)</a>
12071207
}
12081208
}
1209
- for(i=4; i<ArraySize(aCollide); i++){
1209
+ for(i=4; i<count(aCollide); i++){
12101210
for(j=0; j<aCollide[i].cnt && j<MAX_COLLIDE; j++){
12111211
fossil_free(aCollide[i].azHit[j]);
12121212
}
12131213
}
12141214
}
12151215
--- src/name.c
+++ src/name.c
@@ -1204,11 +1204,11 @@
1204 char *zId = aCollide[i].azHit[j];
1205 if( zId==0 ) continue;
1206 @ %z(href("%R/whatis/%s",zId))%h(zId)</a>
1207 }
1208 }
1209 for(i=4; i<ArraySize(aCollide); i++){
1210 for(j=0; j<aCollide[i].cnt && j<MAX_COLLIDE; j++){
1211 fossil_free(aCollide[i].azHit[j]);
1212 }
1213 }
1214 }
1215
--- src/name.c
+++ src/name.c
@@ -1204,11 +1204,11 @@
1204 char *zId = aCollide[i].azHit[j];
1205 if( zId==0 ) continue;
1206 @ %z(href("%R/whatis/%s",zId))%h(zId)</a>
1207 }
1208 }
1209 for(i=4; i<count(aCollide); i++){
1210 for(j=0; j<aCollide[i].cnt && j<MAX_COLLIDE; j++){
1211 fossil_free(aCollide[i].azHit[j]);
1212 }
1213 }
1214 }
1215
+2 -2
--- src/printf.c
+++ src/printf.c
@@ -158,11 +158,11 @@
158158
{ 'n', 0, 0, etSIZE, 0, 0 },
159159
{ '%', 0, 0, etPERCENT, 0, 0 },
160160
{ 'p', 16, 0, etPOINTER, 0, 1 },
161161
{ '/', 0, 0, etPATH, 0, 0 },
162162
};
163
-#define etNINFO (sizeof(fmtinfo)/sizeof(fmtinfo[0]))
163
+#define etNINFO count(fmtinfo)
164164
165165
/*
166166
** "*val" is a double such that 0.1 <= *val < 10.0
167167
** Return the ascii code for the leading digit of *val, then
168168
** multiply "*val" by 10.0 to renormalize.
@@ -979,11 +979,11 @@
979979
pNow->tm_hour, pNow->tm_min, pNow->tm_sec);
980980
va_start(ap, zFormat);
981981
vfprintf(out, zFormat, ap);
982982
fprintf(out, "\n");
983983
va_end(ap);
984
- for(i=0; i<sizeof(azEnv)/sizeof(azEnv[0]); i++){
984
+ for(i=0; i<count(azEnv); i++){
985985
char *p;
986986
if( (p = fossil_getenv(azEnv[i]))!=0 ){
987987
fprintf(out, "%s=%s\n", azEnv[i], p);
988988
fossil_path_free(p);
989989
}else if( (z = P(azEnv[i]))!=0 ){
990990
--- src/printf.c
+++ src/printf.c
@@ -158,11 +158,11 @@
158 { 'n', 0, 0, etSIZE, 0, 0 },
159 { '%', 0, 0, etPERCENT, 0, 0 },
160 { 'p', 16, 0, etPOINTER, 0, 1 },
161 { '/', 0, 0, etPATH, 0, 0 },
162 };
163 #define etNINFO (sizeof(fmtinfo)/sizeof(fmtinfo[0]))
164
165 /*
166 ** "*val" is a double such that 0.1 <= *val < 10.0
167 ** Return the ascii code for the leading digit of *val, then
168 ** multiply "*val" by 10.0 to renormalize.
@@ -979,11 +979,11 @@
979 pNow->tm_hour, pNow->tm_min, pNow->tm_sec);
980 va_start(ap, zFormat);
981 vfprintf(out, zFormat, ap);
982 fprintf(out, "\n");
983 va_end(ap);
984 for(i=0; i<sizeof(azEnv)/sizeof(azEnv[0]); i++){
985 char *p;
986 if( (p = fossil_getenv(azEnv[i]))!=0 ){
987 fprintf(out, "%s=%s\n", azEnv[i], p);
988 fossil_path_free(p);
989 }else if( (z = P(azEnv[i]))!=0 ){
990
--- src/printf.c
+++ src/printf.c
@@ -158,11 +158,11 @@
158 { 'n', 0, 0, etSIZE, 0, 0 },
159 { '%', 0, 0, etPERCENT, 0, 0 },
160 { 'p', 16, 0, etPOINTER, 0, 1 },
161 { '/', 0, 0, etPATH, 0, 0 },
162 };
163 #define etNINFO count(fmtinfo)
164
165 /*
166 ** "*val" is a double such that 0.1 <= *val < 10.0
167 ** Return the ascii code for the leading digit of *val, then
168 ** multiply "*val" by 10.0 to renormalize.
@@ -979,11 +979,11 @@
979 pNow->tm_hour, pNow->tm_min, pNow->tm_sec);
980 va_start(ap, zFormat);
981 vfprintf(out, zFormat, ap);
982 fprintf(out, "\n");
983 va_end(ap);
984 for(i=0; i<count(azEnv); i++){
985 char *p;
986 if( (p = fossil_getenv(azEnv[i]))!=0 ){
987 fprintf(out, "%s=%s\n", azEnv[i], p);
988 fossil_path_free(p);
989 }else if( (z = P(azEnv[i]))!=0 ){
990
+2 -2
--- src/printf.c
+++ src/printf.c
@@ -158,11 +158,11 @@
158158
{ 'n', 0, 0, etSIZE, 0, 0 },
159159
{ '%', 0, 0, etPERCENT, 0, 0 },
160160
{ 'p', 16, 0, etPOINTER, 0, 1 },
161161
{ '/', 0, 0, etPATH, 0, 0 },
162162
};
163
-#define etNINFO (sizeof(fmtinfo)/sizeof(fmtinfo[0]))
163
+#define etNINFO count(fmtinfo)
164164
165165
/*
166166
** "*val" is a double such that 0.1 <= *val < 10.0
167167
** Return the ascii code for the leading digit of *val, then
168168
** multiply "*val" by 10.0 to renormalize.
@@ -979,11 +979,11 @@
979979
pNow->tm_hour, pNow->tm_min, pNow->tm_sec);
980980
va_start(ap, zFormat);
981981
vfprintf(out, zFormat, ap);
982982
fprintf(out, "\n");
983983
va_end(ap);
984
- for(i=0; i<sizeof(azEnv)/sizeof(azEnv[0]); i++){
984
+ for(i=0; i<count(azEnv); i++){
985985
char *p;
986986
if( (p = fossil_getenv(azEnv[i]))!=0 ){
987987
fprintf(out, "%s=%s\n", azEnv[i], p);
988988
fossil_path_free(p);
989989
}else if( (z = P(azEnv[i]))!=0 ){
990990
--- src/printf.c
+++ src/printf.c
@@ -158,11 +158,11 @@
158 { 'n', 0, 0, etSIZE, 0, 0 },
159 { '%', 0, 0, etPERCENT, 0, 0 },
160 { 'p', 16, 0, etPOINTER, 0, 1 },
161 { '/', 0, 0, etPATH, 0, 0 },
162 };
163 #define etNINFO (sizeof(fmtinfo)/sizeof(fmtinfo[0]))
164
165 /*
166 ** "*val" is a double such that 0.1 <= *val < 10.0
167 ** Return the ascii code for the leading digit of *val, then
168 ** multiply "*val" by 10.0 to renormalize.
@@ -979,11 +979,11 @@
979 pNow->tm_hour, pNow->tm_min, pNow->tm_sec);
980 va_start(ap, zFormat);
981 vfprintf(out, zFormat, ap);
982 fprintf(out, "\n");
983 va_end(ap);
984 for(i=0; i<sizeof(azEnv)/sizeof(azEnv[0]); i++){
985 char *p;
986 if( (p = fossil_getenv(azEnv[i]))!=0 ){
987 fprintf(out, "%s=%s\n", azEnv[i], p);
988 fossil_path_free(p);
989 }else if( (z = P(azEnv[i]))!=0 ){
990
--- src/printf.c
+++ src/printf.c
@@ -158,11 +158,11 @@
158 { 'n', 0, 0, etSIZE, 0, 0 },
159 { '%', 0, 0, etPERCENT, 0, 0 },
160 { 'p', 16, 0, etPOINTER, 0, 1 },
161 { '/', 0, 0, etPATH, 0, 0 },
162 };
163 #define etNINFO count(fmtinfo)
164
165 /*
166 ** "*val" is a double such that 0.1 <= *val < 10.0
167 ** Return the ascii code for the leading digit of *val, then
168 ** multiply "*val" by 10.0 to renormalize.
@@ -979,11 +979,11 @@
979 pNow->tm_hour, pNow->tm_min, pNow->tm_sec);
980 va_start(ap, zFormat);
981 vfprintf(out, zFormat, ap);
982 fprintf(out, "\n");
983 va_end(ap);
984 for(i=0; i<count(azEnv); i++){
985 char *p;
986 if( (p = fossil_getenv(azEnv[i]))!=0 ){
987 fprintf(out, "%s=%s\n", azEnv[i], p);
988 fossil_path_free(p);
989 }else if( (z = P(azEnv[i]))!=0 ){
990
+1 -1
--- src/regexp.c
+++ src/regexp.c
@@ -205,11 +205,11 @@
205205
in.i++;
206206
}
207207
if( in.i+pRe->nInit>in.mx ) return 0;
208208
}
209209
210
- if( pRe->nState<=(sizeof(aSpace)/(sizeof(aSpace[0])*2)) ){
210
+ if( pRe->nState<=count(aSpace)*2 ){
211211
pToFree = 0;
212212
aStateSet[0].aState = aSpace;
213213
}else{
214214
pToFree = fossil_malloc( sizeof(ReStateNumber)*2*pRe->nState );
215215
if( pToFree==0 ) return -1;
216216
--- src/regexp.c
+++ src/regexp.c
@@ -205,11 +205,11 @@
205 in.i++;
206 }
207 if( in.i+pRe->nInit>in.mx ) return 0;
208 }
209
210 if( pRe->nState<=(sizeof(aSpace)/(sizeof(aSpace[0])*2)) ){
211 pToFree = 0;
212 aStateSet[0].aState = aSpace;
213 }else{
214 pToFree = fossil_malloc( sizeof(ReStateNumber)*2*pRe->nState );
215 if( pToFree==0 ) return -1;
216
--- src/regexp.c
+++ src/regexp.c
@@ -205,11 +205,11 @@
205 in.i++;
206 }
207 if( in.i+pRe->nInit>in.mx ) return 0;
208 }
209
210 if( pRe->nState<=count(aSpace)*2 ){
211 pToFree = 0;
212 aStateSet[0].aState = aSpace;
213 }else{
214 pToFree = fossil_malloc( sizeof(ReStateNumber)*2*pRe->nState );
215 if( pToFree==0 ) return -1;
216
+2 -2
--- src/report.c
+++ src/report.c
@@ -198,14 +198,14 @@
198198
};
199199
int i;
200200
if( fossil_strncmp(zArg1, "fx_", 3)==0 ){
201201
break;
202202
}
203
- for(i=0; i<sizeof(azAllowed)/sizeof(azAllowed[0]); i++){
203
+ for(i=0; i<count(azAllowed); i++){
204204
if( fossil_stricmp(zArg1, azAllowed[i])==0 ) break;
205205
}
206
- if( i>=sizeof(azAllowed)/sizeof(azAllowed[0]) ){
206
+ if( i>=count(azAllowed) ){
207207
*(char**)pError = mprintf("access to table \"%s\" is restricted",zArg1);
208208
rc = SQLITE_DENY;
209209
}else if( !g.perm.RdAddr && strncmp(zArg2, "private_", 8)==0 ){
210210
rc = SQLITE_IGNORE;
211211
}
212212
--- src/report.c
+++ src/report.c
@@ -198,14 +198,14 @@
198 };
199 int i;
200 if( fossil_strncmp(zArg1, "fx_", 3)==0 ){
201 break;
202 }
203 for(i=0; i<sizeof(azAllowed)/sizeof(azAllowed[0]); i++){
204 if( fossil_stricmp(zArg1, azAllowed[i])==0 ) break;
205 }
206 if( i>=sizeof(azAllowed)/sizeof(azAllowed[0]) ){
207 *(char**)pError = mprintf("access to table \"%s\" is restricted",zArg1);
208 rc = SQLITE_DENY;
209 }else if( !g.perm.RdAddr && strncmp(zArg2, "private_", 8)==0 ){
210 rc = SQLITE_IGNORE;
211 }
212
--- src/report.c
+++ src/report.c
@@ -198,14 +198,14 @@
198 };
199 int i;
200 if( fossil_strncmp(zArg1, "fx_", 3)==0 ){
201 break;
202 }
203 for(i=0; i<count(azAllowed); i++){
204 if( fossil_stricmp(zArg1, azAllowed[i])==0 ) break;
205 }
206 if( i>=count(azAllowed) ){
207 *(char**)pError = mprintf("access to table \"%s\" is restricted",zArg1);
208 rc = SQLITE_DENY;
209 }else if( !g.perm.RdAddr && strncmp(zArg2, "private_", 8)==0 ){
210 rc = SQLITE_IGNORE;
211 }
212
+9 -9
--- src/search.c
+++ src/search.c
@@ -418,11 +418,11 @@
418418
sqlite3_value **argv
419419
){
420420
const char *azDoc[5];
421421
int nDoc;
422422
int rc;
423
- for(nDoc=0; nDoc<ArraySize(azDoc) && nDoc<argc; nDoc++){
423
+ for(nDoc=0; nDoc<count(azDoc) && nDoc<argc; nDoc++){
424424
azDoc[nDoc] = (const char*)sqlite3_value_text(argv[nDoc]);
425425
if( azDoc[nDoc]==0 ) azDoc[nDoc] = "";
426426
}
427427
rc = search_match(&gSearch, nDoc, azDoc);
428428
sqlite3_result_int(context, rc);
@@ -657,11 +657,11 @@
657657
};
658658
int i;
659659
if( g.perm.Read==0 ) srchFlags &= ~(SRCH_CKIN|SRCH_DOC);
660660
if( g.perm.RdTkt==0 ) srchFlags &= ~(SRCH_TKT);
661661
if( g.perm.RdWiki==0 ) srchFlags &= ~(SRCH_WIKI);
662
- for(i=0; i<ArraySize(aSetng); i++){
662
+ for(i=0; i<count(aSetng); i++){
663663
unsigned int m = aSetng[i].m;
664664
if( (srchFlags & m)==0 ) continue;
665665
if( ((knownGood|knownBad) & m)!=0 ) continue;
666666
if( db_get_boolean(aSetng[i].zKey,0) ){
667667
knownGood |= m;
@@ -892,11 +892,11 @@
892892
{ SRCH_DOC, 'd' },
893893
{ SRCH_TKT, 't' },
894894
{ SRCH_WIKI, 'w' },
895895
};
896896
int i;
897
- for(i=0; i<ArraySize(aMask); i++){
897
+ for(i=0; i<count(aMask); i++){
898898
if( srchFlags & aMask[i].m ){
899899
blob_appendf(&sql, "%sftsdocs.type='%c'", zSep, aMask[i].c);
900900
zSep = " OR ";
901901
}
902902
}
@@ -1070,11 +1070,11 @@
10701070
};
10711071
const char *zY = PD("y","all");
10721072
unsigned newFlags = srchFlags;
10731073
int i;
10741074
@ <select size='1' name='y'>
1075
- for(i=0; i<ArraySize(aY); i++){
1075
+ for(i=0; i<count(aY); i++){
10761076
if( (aY[i].m & srchFlags)==0 ) continue;
10771077
cgi_printf("<option value='%s'", aY[i].z);
10781078
if( fossil_strcmp(zY,aY[i].z)==0 ){
10791079
newFlags &= aY[i].m;
10801080
cgi_printf(" selected");
@@ -1727,17 +1727,17 @@
17271727
int iAction = 0;
17281728
db_find_and_open_repository(0, 0);
17291729
if( g.argc>2 ){
17301730
zSubCmd = g.argv[2];
17311731
n = (int)strlen(zSubCmd);
1732
- for(i=0; i<ArraySize(aCmd); i++){
1732
+ for(i=0; i<count(aCmd); i++){
17331733
if( fossil_strncmp(aCmd[i].z, zSubCmd, n)==0 ) break;
17341734
}
1735
- if( i>=ArraySize(aCmd) ){
1735
+ if( i>=count(aCmd) ){
17361736
Blob all;
17371737
blob_init(&all,0,0);
1738
- for(i=0; i<ArraySize(aCmd); i++) blob_appendf(&all, " %s", aCmd[i].z);
1738
+ for(i=0; i<count(aCmd); i++) blob_appendf(&all, " %s", aCmd[i].z);
17391739
fossil_fatal("unknown \"%s\" - should be on of:%s",
17401740
zSubCmd, blob_str(&all));
17411741
return;
17421742
}
17431743
iCmd = aCmd[i].iCmd;
@@ -1757,11 +1757,11 @@
17571757
/* Adjust search settings */
17581758
if( iCmd==3 || iCmd==4 ){
17591759
const char *zCtrl;
17601760
if( g.argc<4 ) usage(mprintf("%s STRING",zSubCmd));
17611761
zCtrl = g.argv[3];
1762
- for(j=0; j<ArraySize(aSetng); j++){
1762
+ for(j=0; j<count(aSetng); j++){
17631763
if( strchr(zCtrl, aSetng[j].zSw[0])!=0 ){
17641764
db_set_int(aSetng[j].zSetting, iCmd-3, 0);
17651765
}
17661766
}
17671767
}
@@ -1778,11 +1778,11 @@
17781778
if( iAction>=2 ){
17791779
search_rebuild_index();
17801780
}
17811781
17821782
/* Always show the status before ending */
1783
- for(i=0; i<ArraySize(aSetng); i++){
1783
+ for(i=0; i<count(aSetng); i++){
17841784
fossil_print("%-16s %s\n", aSetng[i].zName,
17851785
db_get_boolean(aSetng[i].zSetting,0) ? "on" : "off");
17861786
}
17871787
fossil_print("%-16s %s\n", "Porter stemmer:",
17881788
db_get_boolean("search-stemmer",0) ? "on" : "off");
17891789
--- src/search.c
+++ src/search.c
@@ -418,11 +418,11 @@
418 sqlite3_value **argv
419 ){
420 const char *azDoc[5];
421 int nDoc;
422 int rc;
423 for(nDoc=0; nDoc<ArraySize(azDoc) && nDoc<argc; nDoc++){
424 azDoc[nDoc] = (const char*)sqlite3_value_text(argv[nDoc]);
425 if( azDoc[nDoc]==0 ) azDoc[nDoc] = "";
426 }
427 rc = search_match(&gSearch, nDoc, azDoc);
428 sqlite3_result_int(context, rc);
@@ -657,11 +657,11 @@
657 };
658 int i;
659 if( g.perm.Read==0 ) srchFlags &= ~(SRCH_CKIN|SRCH_DOC);
660 if( g.perm.RdTkt==0 ) srchFlags &= ~(SRCH_TKT);
661 if( g.perm.RdWiki==0 ) srchFlags &= ~(SRCH_WIKI);
662 for(i=0; i<ArraySize(aSetng); i++){
663 unsigned int m = aSetng[i].m;
664 if( (srchFlags & m)==0 ) continue;
665 if( ((knownGood|knownBad) & m)!=0 ) continue;
666 if( db_get_boolean(aSetng[i].zKey,0) ){
667 knownGood |= m;
@@ -892,11 +892,11 @@
892 { SRCH_DOC, 'd' },
893 { SRCH_TKT, 't' },
894 { SRCH_WIKI, 'w' },
895 };
896 int i;
897 for(i=0; i<ArraySize(aMask); i++){
898 if( srchFlags & aMask[i].m ){
899 blob_appendf(&sql, "%sftsdocs.type='%c'", zSep, aMask[i].c);
900 zSep = " OR ";
901 }
902 }
@@ -1070,11 +1070,11 @@
1070 };
1071 const char *zY = PD("y","all");
1072 unsigned newFlags = srchFlags;
1073 int i;
1074 @ <select size='1' name='y'>
1075 for(i=0; i<ArraySize(aY); i++){
1076 if( (aY[i].m & srchFlags)==0 ) continue;
1077 cgi_printf("<option value='%s'", aY[i].z);
1078 if( fossil_strcmp(zY,aY[i].z)==0 ){
1079 newFlags &= aY[i].m;
1080 cgi_printf(" selected");
@@ -1727,17 +1727,17 @@
1727 int iAction = 0;
1728 db_find_and_open_repository(0, 0);
1729 if( g.argc>2 ){
1730 zSubCmd = g.argv[2];
1731 n = (int)strlen(zSubCmd);
1732 for(i=0; i<ArraySize(aCmd); i++){
1733 if( fossil_strncmp(aCmd[i].z, zSubCmd, n)==0 ) break;
1734 }
1735 if( i>=ArraySize(aCmd) ){
1736 Blob all;
1737 blob_init(&all,0,0);
1738 for(i=0; i<ArraySize(aCmd); i++) blob_appendf(&all, " %s", aCmd[i].z);
1739 fossil_fatal("unknown \"%s\" - should be on of:%s",
1740 zSubCmd, blob_str(&all));
1741 return;
1742 }
1743 iCmd = aCmd[i].iCmd;
@@ -1757,11 +1757,11 @@
1757 /* Adjust search settings */
1758 if( iCmd==3 || iCmd==4 ){
1759 const char *zCtrl;
1760 if( g.argc<4 ) usage(mprintf("%s STRING",zSubCmd));
1761 zCtrl = g.argv[3];
1762 for(j=0; j<ArraySize(aSetng); j++){
1763 if( strchr(zCtrl, aSetng[j].zSw[0])!=0 ){
1764 db_set_int(aSetng[j].zSetting, iCmd-3, 0);
1765 }
1766 }
1767 }
@@ -1778,11 +1778,11 @@
1778 if( iAction>=2 ){
1779 search_rebuild_index();
1780 }
1781
1782 /* Always show the status before ending */
1783 for(i=0; i<ArraySize(aSetng); i++){
1784 fossil_print("%-16s %s\n", aSetng[i].zName,
1785 db_get_boolean(aSetng[i].zSetting,0) ? "on" : "off");
1786 }
1787 fossil_print("%-16s %s\n", "Porter stemmer:",
1788 db_get_boolean("search-stemmer",0) ? "on" : "off");
1789
--- src/search.c
+++ src/search.c
@@ -418,11 +418,11 @@
418 sqlite3_value **argv
419 ){
420 const char *azDoc[5];
421 int nDoc;
422 int rc;
423 for(nDoc=0; nDoc<count(azDoc) && nDoc<argc; nDoc++){
424 azDoc[nDoc] = (const char*)sqlite3_value_text(argv[nDoc]);
425 if( azDoc[nDoc]==0 ) azDoc[nDoc] = "";
426 }
427 rc = search_match(&gSearch, nDoc, azDoc);
428 sqlite3_result_int(context, rc);
@@ -657,11 +657,11 @@
657 };
658 int i;
659 if( g.perm.Read==0 ) srchFlags &= ~(SRCH_CKIN|SRCH_DOC);
660 if( g.perm.RdTkt==0 ) srchFlags &= ~(SRCH_TKT);
661 if( g.perm.RdWiki==0 ) srchFlags &= ~(SRCH_WIKI);
662 for(i=0; i<count(aSetng); i++){
663 unsigned int m = aSetng[i].m;
664 if( (srchFlags & m)==0 ) continue;
665 if( ((knownGood|knownBad) & m)!=0 ) continue;
666 if( db_get_boolean(aSetng[i].zKey,0) ){
667 knownGood |= m;
@@ -892,11 +892,11 @@
892 { SRCH_DOC, 'd' },
893 { SRCH_TKT, 't' },
894 { SRCH_WIKI, 'w' },
895 };
896 int i;
897 for(i=0; i<count(aMask); i++){
898 if( srchFlags & aMask[i].m ){
899 blob_appendf(&sql, "%sftsdocs.type='%c'", zSep, aMask[i].c);
900 zSep = " OR ";
901 }
902 }
@@ -1070,11 +1070,11 @@
1070 };
1071 const char *zY = PD("y","all");
1072 unsigned newFlags = srchFlags;
1073 int i;
1074 @ <select size='1' name='y'>
1075 for(i=0; i<count(aY); i++){
1076 if( (aY[i].m & srchFlags)==0 ) continue;
1077 cgi_printf("<option value='%s'", aY[i].z);
1078 if( fossil_strcmp(zY,aY[i].z)==0 ){
1079 newFlags &= aY[i].m;
1080 cgi_printf(" selected");
@@ -1727,17 +1727,17 @@
1727 int iAction = 0;
1728 db_find_and_open_repository(0, 0);
1729 if( g.argc>2 ){
1730 zSubCmd = g.argv[2];
1731 n = (int)strlen(zSubCmd);
1732 for(i=0; i<count(aCmd); i++){
1733 if( fossil_strncmp(aCmd[i].z, zSubCmd, n)==0 ) break;
1734 }
1735 if( i>=count(aCmd) ){
1736 Blob all;
1737 blob_init(&all,0,0);
1738 for(i=0; i<count(aCmd); i++) blob_appendf(&all, " %s", aCmd[i].z);
1739 fossil_fatal("unknown \"%s\" - should be on of:%s",
1740 zSubCmd, blob_str(&all));
1741 return;
1742 }
1743 iCmd = aCmd[i].iCmd;
@@ -1757,11 +1757,11 @@
1757 /* Adjust search settings */
1758 if( iCmd==3 || iCmd==4 ){
1759 const char *zCtrl;
1760 if( g.argc<4 ) usage(mprintf("%s STRING",zSubCmd));
1761 zCtrl = g.argv[3];
1762 for(j=0; j<count(aSetng); j++){
1763 if( strchr(zCtrl, aSetng[j].zSw[0])!=0 ){
1764 db_set_int(aSetng[j].zSetting, iCmd-3, 0);
1765 }
1766 }
1767 }
@@ -1778,11 +1778,11 @@
1778 if( iAction>=2 ){
1779 search_rebuild_index();
1780 }
1781
1782 /* Always show the status before ending */
1783 for(i=0; i<count(aSetng); i++){
1784 fossil_print("%-16s %s\n", aSetng[i].zName,
1785 db_get_boolean(aSetng[i].zSetting,0) ? "on" : "off");
1786 }
1787 fossil_print("%-16s %s\n", "Porter stemmer:",
1788 db_get_boolean("search-stemmer",0) ? "on" : "off");
1789
+3 -7
--- src/setup.c
+++ src/setup.c
@@ -19,14 +19,10 @@
1919
*/
2020
#include "config.h"
2121
#include <assert.h>
2222
#include "setup.h"
2323
24
-#if INTERFACE
25
-#define ArraySize(x) (sizeof(x)/sizeof(x[0]))
26
-#endif
27
-
2824
/*
2925
** Output a single entry for a menu generated using an HTML table.
3026
** If zLink is not NULL or an empty string, then it is the page that
3127
** the menu entry will hyperlink to. If zLink is NULL or "", then
3228
** the menu entry has no hyperlink - it is disabled.
@@ -944,18 +940,18 @@
944940
admin_log("Set option [%q] to [%q].",
945941
zVar, iQ ? "on" : "off");
946942
iVal = iQ;
947943
}
948944
}
949
- @ <input type="checkbox" name="%s(zQParm)"
945
+ @ <label><input type="checkbox" name="%s(zQParm)"
950946
if( iVal ){
951947
@ checked="checked"
952948
}
953949
if( disabled ){
954950
@ disabled="disabled"
955951
}
956
- @ /> <b>%s(zLabel)</b>
952
+ @ /> <b>%s(zLabel)</b></label>
957953
}
958954
959955
/*
960956
** Generate an entry box for an attribute.
961957
*/
@@ -1431,11 +1427,11 @@
14311427
@ %s(zTmDiff) hours ahead of UTC.</p>
14321428
}
14331429
14341430
@ <hr />
14351431
multiple_choice_attribute("Per-Item Time Format", "timeline-date-format",
1436
- "tdf", "0", ArraySize(azTimeFormats)/2, azTimeFormats);
1432
+ "tdf", "0", count(azTimeFormats)/2, azTimeFormats);
14371433
@ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown
14381434
@ in a separate box (using CSS class "timelineDate") whenever the date changes.
14391435
@ With the "YYYY-MM-DD&nbsp;HH:MM" and "YYMMDD ..." formats, the complete date
14401436
@ and time is shown on every timeline entry (using the CSS class "timelineTime").</p>
14411437
14421438
--- src/setup.c
+++ src/setup.c
@@ -19,14 +19,10 @@
19 */
20 #include "config.h"
21 #include <assert.h>
22 #include "setup.h"
23
24 #if INTERFACE
25 #define ArraySize(x) (sizeof(x)/sizeof(x[0]))
26 #endif
27
28 /*
29 ** Output a single entry for a menu generated using an HTML table.
30 ** If zLink is not NULL or an empty string, then it is the page that
31 ** the menu entry will hyperlink to. If zLink is NULL or "", then
32 ** the menu entry has no hyperlink - it is disabled.
@@ -944,18 +940,18 @@
944 admin_log("Set option [%q] to [%q].",
945 zVar, iQ ? "on" : "off");
946 iVal = iQ;
947 }
948 }
949 @ <input type="checkbox" name="%s(zQParm)"
950 if( iVal ){
951 @ checked="checked"
952 }
953 if( disabled ){
954 @ disabled="disabled"
955 }
956 @ /> <b>%s(zLabel)</b>
957 }
958
959 /*
960 ** Generate an entry box for an attribute.
961 */
@@ -1431,11 +1427,11 @@
1431 @ %s(zTmDiff) hours ahead of UTC.</p>
1432 }
1433
1434 @ <hr />
1435 multiple_choice_attribute("Per-Item Time Format", "timeline-date-format",
1436 "tdf", "0", ArraySize(azTimeFormats)/2, azTimeFormats);
1437 @ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown
1438 @ in a separate box (using CSS class "timelineDate") whenever the date changes.
1439 @ With the "YYYY-MM-DD&nbsp;HH:MM" and "YYMMDD ..." formats, the complete date
1440 @ and time is shown on every timeline entry (using the CSS class "timelineTime").</p>
1441
1442
--- src/setup.c
+++ src/setup.c
@@ -19,14 +19,10 @@
19 */
20 #include "config.h"
21 #include <assert.h>
22 #include "setup.h"
23
 
 
 
 
24 /*
25 ** Output a single entry for a menu generated using an HTML table.
26 ** If zLink is not NULL or an empty string, then it is the page that
27 ** the menu entry will hyperlink to. If zLink is NULL or "", then
28 ** the menu entry has no hyperlink - it is disabled.
@@ -944,18 +940,18 @@
940 admin_log("Set option [%q] to [%q].",
941 zVar, iQ ? "on" : "off");
942 iVal = iQ;
943 }
944 }
945 @ <label><input type="checkbox" name="%s(zQParm)"
946 if( iVal ){
947 @ checked="checked"
948 }
949 if( disabled ){
950 @ disabled="disabled"
951 }
952 @ /> <b>%s(zLabel)</b></label>
953 }
954
955 /*
956 ** Generate an entry box for an attribute.
957 */
@@ -1431,11 +1427,11 @@
1427 @ %s(zTmDiff) hours ahead of UTC.</p>
1428 }
1429
1430 @ <hr />
1431 multiple_choice_attribute("Per-Item Time Format", "timeline-date-format",
1432 "tdf", "0", count(azTimeFormats)/2, azTimeFormats);
1433 @ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown
1434 @ in a separate box (using CSS class "timelineDate") whenever the date changes.
1435 @ With the "YYYY-MM-DD&nbsp;HH:MM" and "YYMMDD ..." formats, the complete date
1436 @ and time is shown on every timeline entry (using the CSS class "timelineTime").</p>
1437
1438
+12 -12
--- src/skins.c
+++ src/skins.c
@@ -100,18 +100,18 @@
100100
Blob err = BLOB_INITIALIZER;
101101
if( strchr(zName, '/')!=0 ){
102102
zAltSkinDir = fossil_strdup(zName);
103103
return 0;
104104
}
105
- for(i=0; i<ArraySize(aBuiltinSkin); i++){
105
+ for(i=0; i<count(aBuiltinSkin); i++){
106106
if( fossil_strcmp(aBuiltinSkin[i].zLabel, zName)==0 ){
107107
pAltSkin = &aBuiltinSkin[i];
108108
return 0;
109109
}
110110
}
111111
blob_appendf(&err, "available skins: %s", aBuiltinSkin[0].zLabel);
112
- for(i=1; i<ArraySize(aBuiltinSkin); i++){
112
+ for(i=1; i<count(aBuiltinSkin); i++){
113113
blob_append(&err, " ", 1);
114114
blob_append(&err, aBuiltinSkin[i].zLabel, -1);
115115
}
116116
return blob_str(&err);
117117
}
@@ -163,11 +163,11 @@
163163
/*
164164
** Return a pointer to a SkinDetail element. Return 0 if not found.
165165
*/
166166
static struct SkinDetail *skin_detail_find(const char *zName){
167167
int lwr = 0;
168
- int upr = ArraySize(aSkinDetail);
168
+ int upr = count(aSkinDetail);
169169
while( upr>=lwr ){
170170
int mid = (upr+lwr)/2;
171171
int c = fossil_strcmp(aSkinDetail[mid].zName, zName);
172172
if( c==0 ) return &aSkinDetail[mid];
173173
if( c<0 ){
@@ -283,11 +283,11 @@
283283
** Return true if there exists a skin name "zSkinName".
284284
*/
285285
static int skinExists(const char *zSkinName){
286286
int i;
287287
if( zSkinName==0 ) return 0;
288
- for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
288
+ for(i=0; i<count(aBuiltinSkin); i++){
289289
if( fossil_strcmp(zSkinName, aBuiltinSkin[i].zDesc)==0 ) return 1;
290290
}
291291
return db_exists("SELECT 1 FROM config WHERE name='skin:%q'", zSkinName);
292292
}
293293
@@ -304,11 +304,11 @@
304304
char *zLabel;
305305
static const char *azType[] = { "css", "header", "footer", "details" };
306306
int i;
307307
Blob val;
308308
blob_zero(&val);
309
- for(i=0; i<sizeof(azType)/sizeof(azType[0]); i++){
309
+ for(i=0; i<count(azType); i++){
310310
if( zName ){
311311
zLabel = mprintf("skins/%s/%s.txt", zName, azType[i]);
312312
z = builtin_text(zLabel);
313313
fossil_free(zLabel);
314314
}else{
@@ -427,11 +427,11 @@
427427
login_needed(0);
428428
return;
429429
}
430430
db_begin_transaction();
431431
zCurrent = getSkin(0);
432
- for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
432
+ for(i=0; i<count(aBuiltinSkin); i++){
433433
aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel);
434434
}
435435
436436
/* Process requests to delete a user-defined skin */
437437
if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){
@@ -458,11 +458,11 @@
458458
int seen = 0;
459459
460460
/* Check to see if the current skin is already saved. If it is, there
461461
** is no need to create a backup */
462462
zCurrent = getSkin(0);
463
- for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
463
+ for(i=0; i<count(aBuiltinSkin); i++){
464464
if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){
465465
seen = 1;
466466
break;
467467
}
468468
}
@@ -476,11 +476,11 @@
476476
" %Q,now())", zCurrent
477477
);
478478
}
479479
}
480480
seen = 0;
481
- for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
481
+ for(i=0; i<count(aBuiltinSkin); i++){
482482
if( fossil_strcmp(aBuiltinSkin[i].zDesc, z)==0 ){
483483
seen = 1;
484484
zCurrent = aBuiltinSkin[i].zSQL;
485485
db_multi_exec("%s", zCurrent/*safe-for-%s*/);
486486
break;
@@ -513,11 +513,11 @@
513513
@ is restarted without the override.</p>
514514
@
515515
}
516516
@ <h2>Available Skins:</h2>
517517
@ <table border="0">
518
- for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
518
+ for(i=0; i<count(aBuiltinSkin); i++){
519519
z = aBuiltinSkin[i].zDesc;
520520
@ <tr><td>%d(i+1).<td>%h(z)<td>&nbsp;&nbsp;<td>
521521
if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){
522522
@ (Currently In Use)
523523
seenCurrent = 1;
@@ -597,20 +597,20 @@
597597
if( !g.perm.Setup ){
598598
login_needed(0);
599599
return;
600600
}
601601
ii = atoi(PD("w","0"));
602
- if( ii<0 || ii>ArraySize(aSkinAttr) ) ii = 0;
602
+ if( ii<0 || ii>count(aSkinAttr) ) ii = 0;
603603
zBasis = PD("basis","default");
604604
zDflt = mprintf("skins/%s/%s.txt", zBasis, aSkinAttr[ii].zFile);
605605
db_begin_transaction();
606606
if( P("revert")!=0 ){
607607
db_multi_exec("DELETE FROM config WHERE name=%Q", aSkinAttr[ii].zFile);
608608
cgi_replace_parameter(aSkinAttr[ii].zFile, builtin_text(zDflt));
609609
}
610610
style_header("%s", aSkinAttr[ii].zTitle);
611
- for(j=0; j<ArraySize(aSkinAttr); j++){
611
+ for(j=0; j<count(aSkinAttr); j++){
612612
if( j==ii ) continue;
613613
style_submenu_element(aSkinAttr[j].zSubmenu,
614614
"%R/setup_skinedit?w=%d&basis=%h",j,zBasis);
615615
}
616616
style_submenu_element("Skins", "%R/setup_skin");
@@ -622,11 +622,11 @@
622622
aSkinAttr[ii].zFile, builtin_text(zDflt), 0);
623623
@ <br />
624624
@ <input type="submit" name="submit" value="Apply Changes" />
625625
@ <hr />
626626
@ Baseline: <select size='1' name='basis'>
627
- for(j=0; j<ArraySize(aBuiltinSkin); j++){
627
+ for(j=0; j<count(aBuiltinSkin); j++){
628628
cgi_printf("<option value='%h'%s>%h</option>\n",
629629
aBuiltinSkin[j].zLabel,
630630
fossil_strcmp(zBasis,aBuiltinSkin[j].zLabel)==0 ? " selected" : "",
631631
aBuiltinSkin[j].zDesc
632632
);
633633
--- src/skins.c
+++ src/skins.c
@@ -100,18 +100,18 @@
100 Blob err = BLOB_INITIALIZER;
101 if( strchr(zName, '/')!=0 ){
102 zAltSkinDir = fossil_strdup(zName);
103 return 0;
104 }
105 for(i=0; i<ArraySize(aBuiltinSkin); i++){
106 if( fossil_strcmp(aBuiltinSkin[i].zLabel, zName)==0 ){
107 pAltSkin = &aBuiltinSkin[i];
108 return 0;
109 }
110 }
111 blob_appendf(&err, "available skins: %s", aBuiltinSkin[0].zLabel);
112 for(i=1; i<ArraySize(aBuiltinSkin); i++){
113 blob_append(&err, " ", 1);
114 blob_append(&err, aBuiltinSkin[i].zLabel, -1);
115 }
116 return blob_str(&err);
117 }
@@ -163,11 +163,11 @@
163 /*
164 ** Return a pointer to a SkinDetail element. Return 0 if not found.
165 */
166 static struct SkinDetail *skin_detail_find(const char *zName){
167 int lwr = 0;
168 int upr = ArraySize(aSkinDetail);
169 while( upr>=lwr ){
170 int mid = (upr+lwr)/2;
171 int c = fossil_strcmp(aSkinDetail[mid].zName, zName);
172 if( c==0 ) return &aSkinDetail[mid];
173 if( c<0 ){
@@ -283,11 +283,11 @@
283 ** Return true if there exists a skin name "zSkinName".
284 */
285 static int skinExists(const char *zSkinName){
286 int i;
287 if( zSkinName==0 ) return 0;
288 for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
289 if( fossil_strcmp(zSkinName, aBuiltinSkin[i].zDesc)==0 ) return 1;
290 }
291 return db_exists("SELECT 1 FROM config WHERE name='skin:%q'", zSkinName);
292 }
293
@@ -304,11 +304,11 @@
304 char *zLabel;
305 static const char *azType[] = { "css", "header", "footer", "details" };
306 int i;
307 Blob val;
308 blob_zero(&val);
309 for(i=0; i<sizeof(azType)/sizeof(azType[0]); i++){
310 if( zName ){
311 zLabel = mprintf("skins/%s/%s.txt", zName, azType[i]);
312 z = builtin_text(zLabel);
313 fossil_free(zLabel);
314 }else{
@@ -427,11 +427,11 @@
427 login_needed(0);
428 return;
429 }
430 db_begin_transaction();
431 zCurrent = getSkin(0);
432 for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
433 aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel);
434 }
435
436 /* Process requests to delete a user-defined skin */
437 if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){
@@ -458,11 +458,11 @@
458 int seen = 0;
459
460 /* Check to see if the current skin is already saved. If it is, there
461 ** is no need to create a backup */
462 zCurrent = getSkin(0);
463 for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
464 if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){
465 seen = 1;
466 break;
467 }
468 }
@@ -476,11 +476,11 @@
476 " %Q,now())", zCurrent
477 );
478 }
479 }
480 seen = 0;
481 for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
482 if( fossil_strcmp(aBuiltinSkin[i].zDesc, z)==0 ){
483 seen = 1;
484 zCurrent = aBuiltinSkin[i].zSQL;
485 db_multi_exec("%s", zCurrent/*safe-for-%s*/);
486 break;
@@ -513,11 +513,11 @@
513 @ is restarted without the override.</p>
514 @
515 }
516 @ <h2>Available Skins:</h2>
517 @ <table border="0">
518 for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
519 z = aBuiltinSkin[i].zDesc;
520 @ <tr><td>%d(i+1).<td>%h(z)<td>&nbsp;&nbsp;<td>
521 if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){
522 @ (Currently In Use)
523 seenCurrent = 1;
@@ -597,20 +597,20 @@
597 if( !g.perm.Setup ){
598 login_needed(0);
599 return;
600 }
601 ii = atoi(PD("w","0"));
602 if( ii<0 || ii>ArraySize(aSkinAttr) ) ii = 0;
603 zBasis = PD("basis","default");
604 zDflt = mprintf("skins/%s/%s.txt", zBasis, aSkinAttr[ii].zFile);
605 db_begin_transaction();
606 if( P("revert")!=0 ){
607 db_multi_exec("DELETE FROM config WHERE name=%Q", aSkinAttr[ii].zFile);
608 cgi_replace_parameter(aSkinAttr[ii].zFile, builtin_text(zDflt));
609 }
610 style_header("%s", aSkinAttr[ii].zTitle);
611 for(j=0; j<ArraySize(aSkinAttr); j++){
612 if( j==ii ) continue;
613 style_submenu_element(aSkinAttr[j].zSubmenu,
614 "%R/setup_skinedit?w=%d&basis=%h",j,zBasis);
615 }
616 style_submenu_element("Skins", "%R/setup_skin");
@@ -622,11 +622,11 @@
622 aSkinAttr[ii].zFile, builtin_text(zDflt), 0);
623 @ <br />
624 @ <input type="submit" name="submit" value="Apply Changes" />
625 @ <hr />
626 @ Baseline: <select size='1' name='basis'>
627 for(j=0; j<ArraySize(aBuiltinSkin); j++){
628 cgi_printf("<option value='%h'%s>%h</option>\n",
629 aBuiltinSkin[j].zLabel,
630 fossil_strcmp(zBasis,aBuiltinSkin[j].zLabel)==0 ? " selected" : "",
631 aBuiltinSkin[j].zDesc
632 );
633
--- src/skins.c
+++ src/skins.c
@@ -100,18 +100,18 @@
100 Blob err = BLOB_INITIALIZER;
101 if( strchr(zName, '/')!=0 ){
102 zAltSkinDir = fossil_strdup(zName);
103 return 0;
104 }
105 for(i=0; i<count(aBuiltinSkin); i++){
106 if( fossil_strcmp(aBuiltinSkin[i].zLabel, zName)==0 ){
107 pAltSkin = &aBuiltinSkin[i];
108 return 0;
109 }
110 }
111 blob_appendf(&err, "available skins: %s", aBuiltinSkin[0].zLabel);
112 for(i=1; i<count(aBuiltinSkin); i++){
113 blob_append(&err, " ", 1);
114 blob_append(&err, aBuiltinSkin[i].zLabel, -1);
115 }
116 return blob_str(&err);
117 }
@@ -163,11 +163,11 @@
163 /*
164 ** Return a pointer to a SkinDetail element. Return 0 if not found.
165 */
166 static struct SkinDetail *skin_detail_find(const char *zName){
167 int lwr = 0;
168 int upr = count(aSkinDetail);
169 while( upr>=lwr ){
170 int mid = (upr+lwr)/2;
171 int c = fossil_strcmp(aSkinDetail[mid].zName, zName);
172 if( c==0 ) return &aSkinDetail[mid];
173 if( c<0 ){
@@ -283,11 +283,11 @@
283 ** Return true if there exists a skin name "zSkinName".
284 */
285 static int skinExists(const char *zSkinName){
286 int i;
287 if( zSkinName==0 ) return 0;
288 for(i=0; i<count(aBuiltinSkin); i++){
289 if( fossil_strcmp(zSkinName, aBuiltinSkin[i].zDesc)==0 ) return 1;
290 }
291 return db_exists("SELECT 1 FROM config WHERE name='skin:%q'", zSkinName);
292 }
293
@@ -304,11 +304,11 @@
304 char *zLabel;
305 static const char *azType[] = { "css", "header", "footer", "details" };
306 int i;
307 Blob val;
308 blob_zero(&val);
309 for(i=0; i<count(azType); i++){
310 if( zName ){
311 zLabel = mprintf("skins/%s/%s.txt", zName, azType[i]);
312 z = builtin_text(zLabel);
313 fossil_free(zLabel);
314 }else{
@@ -427,11 +427,11 @@
427 login_needed(0);
428 return;
429 }
430 db_begin_transaction();
431 zCurrent = getSkin(0);
432 for(i=0; i<count(aBuiltinSkin); i++){
433 aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel);
434 }
435
436 /* Process requests to delete a user-defined skin */
437 if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){
@@ -458,11 +458,11 @@
458 int seen = 0;
459
460 /* Check to see if the current skin is already saved. If it is, there
461 ** is no need to create a backup */
462 zCurrent = getSkin(0);
463 for(i=0; i<count(aBuiltinSkin); i++){
464 if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){
465 seen = 1;
466 break;
467 }
468 }
@@ -476,11 +476,11 @@
476 " %Q,now())", zCurrent
477 );
478 }
479 }
480 seen = 0;
481 for(i=0; i<count(aBuiltinSkin); i++){
482 if( fossil_strcmp(aBuiltinSkin[i].zDesc, z)==0 ){
483 seen = 1;
484 zCurrent = aBuiltinSkin[i].zSQL;
485 db_multi_exec("%s", zCurrent/*safe-for-%s*/);
486 break;
@@ -513,11 +513,11 @@
513 @ is restarted without the override.</p>
514 @
515 }
516 @ <h2>Available Skins:</h2>
517 @ <table border="0">
518 for(i=0; i<count(aBuiltinSkin); i++){
519 z = aBuiltinSkin[i].zDesc;
520 @ <tr><td>%d(i+1).<td>%h(z)<td>&nbsp;&nbsp;<td>
521 if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){
522 @ (Currently In Use)
523 seenCurrent = 1;
@@ -597,20 +597,20 @@
597 if( !g.perm.Setup ){
598 login_needed(0);
599 return;
600 }
601 ii = atoi(PD("w","0"));
602 if( ii<0 || ii>count(aSkinAttr) ) ii = 0;
603 zBasis = PD("basis","default");
604 zDflt = mprintf("skins/%s/%s.txt", zBasis, aSkinAttr[ii].zFile);
605 db_begin_transaction();
606 if( P("revert")!=0 ){
607 db_multi_exec("DELETE FROM config WHERE name=%Q", aSkinAttr[ii].zFile);
608 cgi_replace_parameter(aSkinAttr[ii].zFile, builtin_text(zDflt));
609 }
610 style_header("%s", aSkinAttr[ii].zTitle);
611 for(j=0; j<count(aSkinAttr); j++){
612 if( j==ii ) continue;
613 style_submenu_element(aSkinAttr[j].zSubmenu,
614 "%R/setup_skinedit?w=%d&basis=%h",j,zBasis);
615 }
616 style_submenu_element("Skins", "%R/setup_skin");
@@ -622,11 +622,11 @@
622 aSkinAttr[ii].zFile, builtin_text(zDflt), 0);
623 @ <br />
624 @ <input type="submit" name="submit" value="Apply Changes" />
625 @ <hr />
626 @ Baseline: <select size='1' name='basis'>
627 for(j=0; j<count(aBuiltinSkin); j++){
628 cgi_printf("<option value='%h'%s>%h</option>\n",
629 aBuiltinSkin[j].zLabel,
630 fossil_strcmp(zBasis,aBuiltinSkin[j].zLabel)==0 ? " selected" : "",
631 aBuiltinSkin[j].zDesc
632 );
633
+3 -3
--- src/statrep.c
+++ src/statrep.c
@@ -706,24 +706,24 @@
706706
if( zUserName && zUserName[0]==0 ) zUserName = 0;
707707
if( zView==0 ){
708708
zView = "byuser";
709709
cgi_replace_query_parameter("view","byuser");
710710
}
711
- for(i=0; i<ArraySize(aViewType); i++){
711
+ for(i=0; i<count(aViewType); i++){
712712
if( fossil_strcmp(zView, aViewType[i].zVal)==0 ){
713713
eType = aViewType[i].eType;
714714
break;
715715
}
716716
}
717717
if( eType!=RPT_NONE ){
718718
int nView = 0; /* Slots used in azView[] */
719
- for(i=0; i<ArraySize(aViewType); i++){
719
+ for(i=0; i<count(aViewType); i++){
720720
azView[nView++] = aViewType[i].zVal;
721721
azView[nView++] = aViewType[i].zName;
722722
}
723723
if( eType!=RPT_BYFILE ){
724
- style_submenu_multichoice("type", ArraySize(azType)/2, azType, 0);
724
+ style_submenu_multichoice("type", count(azType)/2, azType, 0);
725725
}
726726
style_submenu_multichoice("view", nView/2, azView, 0);
727727
if( eType!=RPT_BYUSER ){
728728
style_submenu_sql("user","User:",
729729
"SELECT '', 'All Users' UNION ALL "
730730
--- src/statrep.c
+++ src/statrep.c
@@ -706,24 +706,24 @@
706 if( zUserName && zUserName[0]==0 ) zUserName = 0;
707 if( zView==0 ){
708 zView = "byuser";
709 cgi_replace_query_parameter("view","byuser");
710 }
711 for(i=0; i<ArraySize(aViewType); i++){
712 if( fossil_strcmp(zView, aViewType[i].zVal)==0 ){
713 eType = aViewType[i].eType;
714 break;
715 }
716 }
717 if( eType!=RPT_NONE ){
718 int nView = 0; /* Slots used in azView[] */
719 for(i=0; i<ArraySize(aViewType); i++){
720 azView[nView++] = aViewType[i].zVal;
721 azView[nView++] = aViewType[i].zName;
722 }
723 if( eType!=RPT_BYFILE ){
724 style_submenu_multichoice("type", ArraySize(azType)/2, azType, 0);
725 }
726 style_submenu_multichoice("view", nView/2, azView, 0);
727 if( eType!=RPT_BYUSER ){
728 style_submenu_sql("user","User:",
729 "SELECT '', 'All Users' UNION ALL "
730
--- src/statrep.c
+++ src/statrep.c
@@ -706,24 +706,24 @@
706 if( zUserName && zUserName[0]==0 ) zUserName = 0;
707 if( zView==0 ){
708 zView = "byuser";
709 cgi_replace_query_parameter("view","byuser");
710 }
711 for(i=0; i<count(aViewType); i++){
712 if( fossil_strcmp(zView, aViewType[i].zVal)==0 ){
713 eType = aViewType[i].eType;
714 break;
715 }
716 }
717 if( eType!=RPT_NONE ){
718 int nView = 0; /* Slots used in azView[] */
719 for(i=0; i<count(aViewType); i++){
720 azView[nView++] = aViewType[i].zVal;
721 azView[nView++] = aViewType[i].zName;
722 }
723 if( eType!=RPT_BYFILE ){
724 style_submenu_multichoice("type", count(azType)/2, azType, 0);
725 }
726 style_submenu_multichoice("view", nView/2, azView, 0);
727 if( eType!=RPT_BYUSER ){
728 style_submenu_sql("user","User:",
729 "SELECT '', 'All Users' UNION ALL "
730
+96 -72
--- src/style.c
+++ src/style.c
@@ -30,11 +30,13 @@
3030
** Populate these structure with calls to
3131
**
3232
** style_submenu_element()
3333
** style_submenu_entry()
3434
** style_submenu_checkbox()
35
+** style_submenu_binary()
3536
** style_submenu_multichoice()
37
+** style_submenu_sql()
3638
**
3739
** prior to calling style_footer(). The style_footer() routine
3840
** will generate the appropriate HTML text just below the main
3941
** menu.
4042
*/
@@ -51,13 +53,14 @@
5153
short int iSize; /* Width for FF_ENTRY. Count for FF_MULTI */
5254
const char *const *azChoice;/* value/display pairs for FF_MULTI */
5355
const char *zFalse; /* FF_BINARY label when false */
5456
} aSubmenuCtrl[20];
5557
static int nSubmenuCtrl = 0;
56
-#define FF_ENTRY 1
57
-#define FF_MULTI 2
58
-#define FF_BINARY 3
58
+#define FF_ENTRY 1
59
+#define FF_MULTI 2
60
+#define FF_BINARY 3
61
+#define FF_CHECKBOX 4
5962
6063
/*
6164
** Remember that the header has been generated. The footer is omitted
6265
** if an error occurs before the header.
6366
*/
@@ -233,11 +236,11 @@
233236
const char *zLabel,
234237
const char *zLink,
235238
...
236239
){
237240
va_list ap;
238
- assert( nSubmenu < sizeof(aSubmenu)/sizeof(aSubmenu[0]) );
241
+ assert( nSubmenu < count(aSubmenu) );
239242
aSubmenu[nSubmenu].zLabel = zLabel;
240243
va_start(ap, zLink);
241244
aSubmenu[nSubmenu].zLink = vmprintf(zLink, ap);
242245
va_end(ap);
243246
nSubmenu++;
@@ -246,25 +249,37 @@
246249
const char *zName, /* Query parameter name */
247250
const char *zLabel, /* Label before the entry box */
248251
int iSize, /* Size of the entry box */
249252
int isDisabled /* True if disabled */
250253
){
251
- assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
254
+ assert( nSubmenuCtrl < count(aSubmenuCtrl) );
252255
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
253256
aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
254257
aSubmenuCtrl[nSubmenuCtrl].iSize = iSize;
255258
aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
256259
aSubmenuCtrl[nSubmenuCtrl].eType = FF_ENTRY;
257260
nSubmenuCtrl++;
261
+}
262
+void style_submenu_checkbox(
263
+ const char *zName, /* Query parameter name */
264
+ const char *zLabel, /* Label to display after the checkbox */
265
+ int isDisabled /* True if disabled */
266
+){
267
+ assert( nSubmenuCtrl < count(aSubmenuCtrl) );
268
+ aSubmenuCtrl[nSubmenuCtrl].zName = zName;
269
+ aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
270
+ aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
271
+ aSubmenuCtrl[nSubmenuCtrl].eType = FF_CHECKBOX;
272
+ nSubmenuCtrl++;
258273
}
259274
void style_submenu_binary(
260275
const char *zName, /* Query parameter name */
261276
const char *zTrue, /* Label to show when parameter is true */
262277
const char *zFalse, /* Label to show when the parameter is false */
263278
int isDisabled /* True if this control is disabled */
264279
){
265
- assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
280
+ assert( nSubmenuCtrl < count(aSubmenuCtrl) );
266281
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
267282
aSubmenuCtrl[nSubmenuCtrl].zLabel = zTrue;
268283
aSubmenuCtrl[nSubmenuCtrl].zFalse = zFalse;
269284
aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
270285
aSubmenuCtrl[nSubmenuCtrl].eType = FF_BINARY;
@@ -274,11 +289,11 @@
274289
const char *zName, /* Query parameter name */
275290
int nChoice, /* Number of options */
276291
const char *const *azChoice,/* value/display pairs. 2*nChoice entries */
277292
int isDisabled /* True if this control is disabled */
278293
){
279
- assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
294
+ assert( nSubmenuCtrl < count(aSubmenuCtrl) );
280295
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
281296
aSubmenuCtrl[nSubmenuCtrl].iSize = nChoice;
282297
aSubmenuCtrl[nSubmenuCtrl].azChoice = azChoice;
283298
aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
284299
aSubmenuCtrl[nSubmenuCtrl].eType = FF_MULTI;
@@ -521,74 +536,82 @@
521536
}else{
522537
@ <a class="label" href="%h(p->zLink)">%h(p->zLabel)</a>
523538
}
524539
}
525540
}
526
- if( nSubmenuCtrl>0 ){
527
- for(i=0; i<nSubmenuCtrl; i++){
528
- const char *zQPN = aSubmenuCtrl[i].zName;
529
- const char *zDisabled = " disabled";
530
- if( !aSubmenuCtrl[i].isDisabled ){
531
- zDisabled = "";
532
- cgi_tag_query_parameter(zQPN);
533
- }
534
- switch( aSubmenuCtrl[i].eType ){
535
- case FF_ENTRY: {
536
- cgi_printf(
537
- "<span class='submenuctrl'>"
538
- "&nbsp;%h<input type='text' name='%s' size='%d' maxlength='%d'"
539
- " value='%h'%s></span>\n",
540
- aSubmenuCtrl[i].zLabel,
541
- zQPN,
542
- aSubmenuCtrl[i].iSize, aSubmenuCtrl[i].iSize,
543
- PD(zQPN,""),
544
- zDisabled
545
- );
546
- break;
547
- }
548
- case FF_MULTI: {
549
- int j;
550
- const char *zVal = P(zQPN);
551
- if( aSubmenuCtrl[i].zLabel ){
552
- cgi_printf("&nbsp;%h", aSubmenuCtrl[i].zLabel);
553
- }
554
- cgi_printf(
555
- "<select class='submenuctrl' size='1' name='%s'%s "
556
- "onchange='gebi(\"f01\").submit();'>\n",
557
- zQPN, zDisabled
558
- );
559
- for(j=0; j<aSubmenuCtrl[i].iSize*2; j+=2){
560
- const char *zQPV = aSubmenuCtrl[i].azChoice[j];
561
- cgi_printf(
562
- "<option value='%h'%s>%h</option>\n",
563
- zQPV,
564
- fossil_strcmp(zVal,zQPV)==0 ? " selected" : "",
565
- aSubmenuCtrl[i].azChoice[j+1]
566
- );
567
- }
568
- @ </select>
569
- break;
570
- }
571
- case FF_BINARY: {
572
- int isTrue = PB(zQPN);
573
- cgi_printf(
574
- "<select class='submenuctrl' size='1' name='%s'%s "
575
- "onchange='gebi(\"f01\").submit();'>\n",
576
- zQPN, zDisabled
577
- );
578
- cgi_printf(
579
- "<option value='1'%s>%h</option>\n",
580
- isTrue ? " selected":"", aSubmenuCtrl[i].zLabel
581
- );
582
- cgi_printf(
583
- "<option value='0'%s>%h</option>\n",
584
- (!isTrue) ? " selected":"", aSubmenuCtrl[i].zFalse
585
- );
586
- @ </select>
587
- break;
588
- }
589
- }
541
+ for(i=0; i<nSubmenuCtrl; i++){
542
+ const char *zQPN = aSubmenuCtrl[i].zName;
543
+ const char *zDisabled = " disabled";
544
+ if( !aSubmenuCtrl[i].isDisabled ){
545
+ zDisabled = "";
546
+ cgi_tag_query_parameter(zQPN);
547
+ }
548
+ switch( aSubmenuCtrl[i].eType ){
549
+ case FF_ENTRY:
550
+ cgi_printf(
551
+ "<span class='submenuctrl'>"
552
+ "&nbsp;%h<input type='text' name='%s' value='%h'%s",
553
+ aSubmenuCtrl[i].zLabel, zQPN, PD(zQPN, ""), zDisabled
554
+ );
555
+ if( aSubmenuCtrl[i].iSize<0 ){
556
+ cgi_printf(" size='%d'", -aSubmenuCtrl[i].iSize);
557
+ }else if( aSubmenuCtrl[i].iSize>0 ){
558
+ cgi_printf(
559
+ " size='%d' maxlength='%d'",
560
+ aSubmenuCtrl[i].iSize, aSubmenuCtrl[i].iSize
561
+ );
562
+ }
563
+ @ onchange='gebi("f01").submit();'></span>
564
+ break;
565
+ case FF_MULTI: {
566
+ int j;
567
+ const char *zVal = P(zQPN);
568
+ if( aSubmenuCtrl[i].zLabel ){
569
+ cgi_printf("&nbsp;%h", aSubmenuCtrl[i].zLabel);
570
+ }
571
+ cgi_printf(
572
+ "<select class='submenuctrl' size='1' name='%s'%s "
573
+ "onchange='gebi(\"f01\").submit();'>\n",
574
+ zQPN, zDisabled
575
+ );
576
+ for(j=0; j<aSubmenuCtrl[i].iSize*2; j+=2){
577
+ const char *zQPV = aSubmenuCtrl[i].azChoice[j];
578
+ cgi_printf(
579
+ "<option value='%h'%s>%h</option>\n",
580
+ zQPV,
581
+ fossil_strcmp(zVal,zQPV)==0 ? " selected" : "",
582
+ aSubmenuCtrl[i].azChoice[j+1]
583
+ );
584
+ }
585
+ @ </select>
586
+ break;
587
+ }
588
+ case FF_BINARY: {
589
+ int isTrue = PB(zQPN);
590
+ cgi_printf(
591
+ "<select class='submenuctrl' size='1' name='%s'%s "
592
+ "onchange='gebi(\"f01\").submit();'>\n",
593
+ zQPN, zDisabled
594
+ );
595
+ cgi_printf(
596
+ "<option value='1'%s>%h</option>\n",
597
+ isTrue ? " selected":"", aSubmenuCtrl[i].zLabel
598
+ );
599
+ cgi_printf(
600
+ "<option value='0'%s>%h</option>\n",
601
+ (!isTrue) ? " selected":"", aSubmenuCtrl[i].zFalse
602
+ );
603
+ @ </select>
604
+ break;
605
+ }
606
+ case FF_CHECKBOX:
607
+ cgi_printf(
608
+ "<label class='submenuctrl'><input type='checkbox' name='%s' "
609
+ "value='1'%s%s onchange='gebi(\"f01\").submit();'>%s</label>\n",
610
+ zQPN, PB(zQPN) ? " checked" : "", zDisabled, aSubmenuCtrl[i].zLabel
611
+ );
612
+ break;
590613
}
591614
}
592615
@ </div>
593616
if( nSubmenuCtrl ){
594617
cgi_query_parameters_to_hidden();
@@ -701,14 +724,15 @@
701724
{ "td.timelineTableCell",
702725
"the format for the timeline data cells",
703726
@ vertical-align: top;
704727
@ text-align: left;
705728
},
706
- { "tr.timelineCurrent td.timelineTableCell",
729
+ { "tr.timelineCurrent",
707730
"the format for the timeline data cell of the current checkout",
708731
@ padding: .1em .2em;
709732
@ border: 1px dashed #446979;
733
+ @ box-shadow: 1px 1px 4px #888;
710734
},
711735
{ "tr.timelineSelected",
712736
"The row in the timeline table that contains the entry of interest",
713737
@ padding: .1em .2em;
714738
@ border: 2px solid lightgray;
715739
--- src/style.c
+++ src/style.c
@@ -30,11 +30,13 @@
30 ** Populate these structure with calls to
31 **
32 ** style_submenu_element()
33 ** style_submenu_entry()
34 ** style_submenu_checkbox()
 
35 ** style_submenu_multichoice()
 
36 **
37 ** prior to calling style_footer(). The style_footer() routine
38 ** will generate the appropriate HTML text just below the main
39 ** menu.
40 */
@@ -51,13 +53,14 @@
51 short int iSize; /* Width for FF_ENTRY. Count for FF_MULTI */
52 const char *const *azChoice;/* value/display pairs for FF_MULTI */
53 const char *zFalse; /* FF_BINARY label when false */
54 } aSubmenuCtrl[20];
55 static int nSubmenuCtrl = 0;
56 #define FF_ENTRY 1
57 #define FF_MULTI 2
58 #define FF_BINARY 3
 
59
60 /*
61 ** Remember that the header has been generated. The footer is omitted
62 ** if an error occurs before the header.
63 */
@@ -233,11 +236,11 @@
233 const char *zLabel,
234 const char *zLink,
235 ...
236 ){
237 va_list ap;
238 assert( nSubmenu < sizeof(aSubmenu)/sizeof(aSubmenu[0]) );
239 aSubmenu[nSubmenu].zLabel = zLabel;
240 va_start(ap, zLink);
241 aSubmenu[nSubmenu].zLink = vmprintf(zLink, ap);
242 va_end(ap);
243 nSubmenu++;
@@ -246,25 +249,37 @@
246 const char *zName, /* Query parameter name */
247 const char *zLabel, /* Label before the entry box */
248 int iSize, /* Size of the entry box */
249 int isDisabled /* True if disabled */
250 ){
251 assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
252 aSubmenuCtrl[nSubmenuCtrl].zName = zName;
253 aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
254 aSubmenuCtrl[nSubmenuCtrl].iSize = iSize;
255 aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
256 aSubmenuCtrl[nSubmenuCtrl].eType = FF_ENTRY;
257 nSubmenuCtrl++;
 
 
 
 
 
 
 
 
 
 
 
 
258 }
259 void style_submenu_binary(
260 const char *zName, /* Query parameter name */
261 const char *zTrue, /* Label to show when parameter is true */
262 const char *zFalse, /* Label to show when the parameter is false */
263 int isDisabled /* True if this control is disabled */
264 ){
265 assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
266 aSubmenuCtrl[nSubmenuCtrl].zName = zName;
267 aSubmenuCtrl[nSubmenuCtrl].zLabel = zTrue;
268 aSubmenuCtrl[nSubmenuCtrl].zFalse = zFalse;
269 aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
270 aSubmenuCtrl[nSubmenuCtrl].eType = FF_BINARY;
@@ -274,11 +289,11 @@
274 const char *zName, /* Query parameter name */
275 int nChoice, /* Number of options */
276 const char *const *azChoice,/* value/display pairs. 2*nChoice entries */
277 int isDisabled /* True if this control is disabled */
278 ){
279 assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
280 aSubmenuCtrl[nSubmenuCtrl].zName = zName;
281 aSubmenuCtrl[nSubmenuCtrl].iSize = nChoice;
282 aSubmenuCtrl[nSubmenuCtrl].azChoice = azChoice;
283 aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
284 aSubmenuCtrl[nSubmenuCtrl].eType = FF_MULTI;
@@ -521,74 +536,82 @@
521 }else{
522 @ <a class="label" href="%h(p->zLink)">%h(p->zLabel)</a>
523 }
524 }
525 }
526 if( nSubmenuCtrl>0 ){
527 for(i=0; i<nSubmenuCtrl; i++){
528 const char *zQPN = aSubmenuCtrl[i].zName;
529 const char *zDisabled = " disabled";
530 if( !aSubmenuCtrl[i].isDisabled ){
531 zDisabled = "";
532 cgi_tag_query_parameter(zQPN);
533 }
534 switch( aSubmenuCtrl[i].eType ){
535 case FF_ENTRY: {
536 cgi_printf(
537 "<span class='submenuctrl'>"
538 "&nbsp;%h<input type='text' name='%s' size='%d' maxlength='%d'"
539 " value='%h'%s></span>\n",
540 aSubmenuCtrl[i].zLabel,
541 zQPN,
542 aSubmenuCtrl[i].iSize, aSubmenuCtrl[i].iSize,
543 PD(zQPN,""),
544 zDisabled
545 );
546 break;
547 }
548 case FF_MULTI: {
549 int j;
550 const char *zVal = P(zQPN);
551 if( aSubmenuCtrl[i].zLabel ){
552 cgi_printf("&nbsp;%h", aSubmenuCtrl[i].zLabel);
553 }
554 cgi_printf(
555 "<select class='submenuctrl' size='1' name='%s'%s "
556 "onchange='gebi(\"f01\").submit();'>\n",
557 zQPN, zDisabled
558 );
559 for(j=0; j<aSubmenuCtrl[i].iSize*2; j+=2){
560 const char *zQPV = aSubmenuCtrl[i].azChoice[j];
561 cgi_printf(
562 "<option value='%h'%s>%h</option>\n",
563 zQPV,
564 fossil_strcmp(zVal,zQPV)==0 ? " selected" : "",
565 aSubmenuCtrl[i].azChoice[j+1]
566 );
567 }
568 @ </select>
569 break;
570 }
571 case FF_BINARY: {
572 int isTrue = PB(zQPN);
573 cgi_printf(
574 "<select class='submenuctrl' size='1' name='%s'%s "
575 "onchange='gebi(\"f01\").submit();'>\n",
576 zQPN, zDisabled
577 );
578 cgi_printf(
579 "<option value='1'%s>%h</option>\n",
580 isTrue ? " selected":"", aSubmenuCtrl[i].zLabel
581 );
582 cgi_printf(
583 "<option value='0'%s>%h</option>\n",
584 (!isTrue) ? " selected":"", aSubmenuCtrl[i].zFalse
585 );
586 @ </select>
587 break;
588 }
589 }
 
 
 
 
 
 
 
 
590 }
591 }
592 @ </div>
593 if( nSubmenuCtrl ){
594 cgi_query_parameters_to_hidden();
@@ -701,14 +724,15 @@
701 { "td.timelineTableCell",
702 "the format for the timeline data cells",
703 @ vertical-align: top;
704 @ text-align: left;
705 },
706 { "tr.timelineCurrent td.timelineTableCell",
707 "the format for the timeline data cell of the current checkout",
708 @ padding: .1em .2em;
709 @ border: 1px dashed #446979;
 
710 },
711 { "tr.timelineSelected",
712 "The row in the timeline table that contains the entry of interest",
713 @ padding: .1em .2em;
714 @ border: 2px solid lightgray;
715
--- src/style.c
+++ src/style.c
@@ -30,11 +30,13 @@
30 ** Populate these structure with calls to
31 **
32 ** style_submenu_element()
33 ** style_submenu_entry()
34 ** style_submenu_checkbox()
35 ** style_submenu_binary()
36 ** style_submenu_multichoice()
37 ** style_submenu_sql()
38 **
39 ** prior to calling style_footer(). The style_footer() routine
40 ** will generate the appropriate HTML text just below the main
41 ** menu.
42 */
@@ -51,13 +53,14 @@
53 short int iSize; /* Width for FF_ENTRY. Count for FF_MULTI */
54 const char *const *azChoice;/* value/display pairs for FF_MULTI */
55 const char *zFalse; /* FF_BINARY label when false */
56 } aSubmenuCtrl[20];
57 static int nSubmenuCtrl = 0;
58 #define FF_ENTRY 1
59 #define FF_MULTI 2
60 #define FF_BINARY 3
61 #define FF_CHECKBOX 4
62
63 /*
64 ** Remember that the header has been generated. The footer is omitted
65 ** if an error occurs before the header.
66 */
@@ -233,11 +236,11 @@
236 const char *zLabel,
237 const char *zLink,
238 ...
239 ){
240 va_list ap;
241 assert( nSubmenu < count(aSubmenu) );
242 aSubmenu[nSubmenu].zLabel = zLabel;
243 va_start(ap, zLink);
244 aSubmenu[nSubmenu].zLink = vmprintf(zLink, ap);
245 va_end(ap);
246 nSubmenu++;
@@ -246,25 +249,37 @@
249 const char *zName, /* Query parameter name */
250 const char *zLabel, /* Label before the entry box */
251 int iSize, /* Size of the entry box */
252 int isDisabled /* True if disabled */
253 ){
254 assert( nSubmenuCtrl < count(aSubmenuCtrl) );
255 aSubmenuCtrl[nSubmenuCtrl].zName = zName;
256 aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
257 aSubmenuCtrl[nSubmenuCtrl].iSize = iSize;
258 aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
259 aSubmenuCtrl[nSubmenuCtrl].eType = FF_ENTRY;
260 nSubmenuCtrl++;
261 }
262 void style_submenu_checkbox(
263 const char *zName, /* Query parameter name */
264 const char *zLabel, /* Label to display after the checkbox */
265 int isDisabled /* True if disabled */
266 ){
267 assert( nSubmenuCtrl < count(aSubmenuCtrl) );
268 aSubmenuCtrl[nSubmenuCtrl].zName = zName;
269 aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
270 aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
271 aSubmenuCtrl[nSubmenuCtrl].eType = FF_CHECKBOX;
272 nSubmenuCtrl++;
273 }
274 void style_submenu_binary(
275 const char *zName, /* Query parameter name */
276 const char *zTrue, /* Label to show when parameter is true */
277 const char *zFalse, /* Label to show when the parameter is false */
278 int isDisabled /* True if this control is disabled */
279 ){
280 assert( nSubmenuCtrl < count(aSubmenuCtrl) );
281 aSubmenuCtrl[nSubmenuCtrl].zName = zName;
282 aSubmenuCtrl[nSubmenuCtrl].zLabel = zTrue;
283 aSubmenuCtrl[nSubmenuCtrl].zFalse = zFalse;
284 aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
285 aSubmenuCtrl[nSubmenuCtrl].eType = FF_BINARY;
@@ -274,11 +289,11 @@
289 const char *zName, /* Query parameter name */
290 int nChoice, /* Number of options */
291 const char *const *azChoice,/* value/display pairs. 2*nChoice entries */
292 int isDisabled /* True if this control is disabled */
293 ){
294 assert( nSubmenuCtrl < count(aSubmenuCtrl) );
295 aSubmenuCtrl[nSubmenuCtrl].zName = zName;
296 aSubmenuCtrl[nSubmenuCtrl].iSize = nChoice;
297 aSubmenuCtrl[nSubmenuCtrl].azChoice = azChoice;
298 aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
299 aSubmenuCtrl[nSubmenuCtrl].eType = FF_MULTI;
@@ -521,74 +536,82 @@
536 }else{
537 @ <a class="label" href="%h(p->zLink)">%h(p->zLabel)</a>
538 }
539 }
540 }
541 for(i=0; i<nSubmenuCtrl; i++){
542 const char *zQPN = aSubmenuCtrl[i].zName;
543 const char *zDisabled = " disabled";
544 if( !aSubmenuCtrl[i].isDisabled ){
545 zDisabled = "";
546 cgi_tag_query_parameter(zQPN);
547 }
548 switch( aSubmenuCtrl[i].eType ){
549 case FF_ENTRY:
550 cgi_printf(
551 "<span class='submenuctrl'>"
552 "&nbsp;%h<input type='text' name='%s' value='%h'%s",
553 aSubmenuCtrl[i].zLabel, zQPN, PD(zQPN, ""), zDisabled
554 );
555 if( aSubmenuCtrl[i].iSize<0 ){
556 cgi_printf(" size='%d'", -aSubmenuCtrl[i].iSize);
557 }else if( aSubmenuCtrl[i].iSize>0 ){
558 cgi_printf(
559 " size='%d' maxlength='%d'",
560 aSubmenuCtrl[i].iSize, aSubmenuCtrl[i].iSize
561 );
562 }
563 @ onchange='gebi("f01").submit();'></span>
564 break;
565 case FF_MULTI: {
566 int j;
567 const char *zVal = P(zQPN);
568 if( aSubmenuCtrl[i].zLabel ){
569 cgi_printf("&nbsp;%h", aSubmenuCtrl[i].zLabel);
570 }
571 cgi_printf(
572 "<select class='submenuctrl' size='1' name='%s'%s "
573 "onchange='gebi(\"f01\").submit();'>\n",
574 zQPN, zDisabled
575 );
576 for(j=0; j<aSubmenuCtrl[i].iSize*2; j+=2){
577 const char *zQPV = aSubmenuCtrl[i].azChoice[j];
578 cgi_printf(
579 "<option value='%h'%s>%h</option>\n",
580 zQPV,
581 fossil_strcmp(zVal,zQPV)==0 ? " selected" : "",
582 aSubmenuCtrl[i].azChoice[j+1]
583 );
584 }
585 @ </select>
586 break;
587 }
588 case FF_BINARY: {
589 int isTrue = PB(zQPN);
590 cgi_printf(
591 "<select class='submenuctrl' size='1' name='%s'%s "
592 "onchange='gebi(\"f01\").submit();'>\n",
593 zQPN, zDisabled
594 );
595 cgi_printf(
596 "<option value='1'%s>%h</option>\n",
597 isTrue ? " selected":"", aSubmenuCtrl[i].zLabel
598 );
599 cgi_printf(
600 "<option value='0'%s>%h</option>\n",
601 (!isTrue) ? " selected":"", aSubmenuCtrl[i].zFalse
602 );
603 @ </select>
604 break;
605 }
606 case FF_CHECKBOX:
607 cgi_printf(
608 "<label class='submenuctrl'><input type='checkbox' name='%s' "
609 "value='1'%s%s onchange='gebi(\"f01\").submit();'>%s</label>\n",
610 zQPN, PB(zQPN) ? " checked" : "", zDisabled, aSubmenuCtrl[i].zLabel
611 );
612 break;
613 }
614 }
615 @ </div>
616 if( nSubmenuCtrl ){
617 cgi_query_parameters_to_hidden();
@@ -701,14 +724,15 @@
724 { "td.timelineTableCell",
725 "the format for the timeline data cells",
726 @ vertical-align: top;
727 @ text-align: left;
728 },
729 { "tr.timelineCurrent",
730 "the format for the timeline data cell of the current checkout",
731 @ padding: .1em .2em;
732 @ border: 1px dashed #446979;
733 @ box-shadow: 1px 1px 4px #888;
734 },
735 { "tr.timelineSelected",
736 "The row in the timeline table that contains the entry of interest",
737 @ padding: .1em .2em;
738 @ border: 2px solid lightgray;
739
+1 -1
--- src/th_main.c
+++ src/th_main.c
@@ -2005,11 +2005,11 @@
20052005
g.tcl.setup = db_get("tcl-setup", 0); /* Grab Tcl setup script. */
20062006
}
20072007
th_register_tcl(g.interp, &g.tcl); /* Tcl integration commands. */
20082008
}
20092009
#endif
2010
- for(i=0; i<sizeof(aCommand)/sizeof(aCommand[0]); i++){
2010
+ for(i=0; i<count(aCommand); i++){
20112011
if ( !aCommand[i].zName || !aCommand[i].xProc ) continue;
20122012
Th_CreateCommand(g.interp, aCommand[i].zName, aCommand[i].xProc,
20132013
aCommand[i].pContext, 0);
20142014
}
20152015
}else{
20162016
--- src/th_main.c
+++ src/th_main.c
@@ -2005,11 +2005,11 @@
2005 g.tcl.setup = db_get("tcl-setup", 0); /* Grab Tcl setup script. */
2006 }
2007 th_register_tcl(g.interp, &g.tcl); /* Tcl integration commands. */
2008 }
2009 #endif
2010 for(i=0; i<sizeof(aCommand)/sizeof(aCommand[0]); i++){
2011 if ( !aCommand[i].zName || !aCommand[i].xProc ) continue;
2012 Th_CreateCommand(g.interp, aCommand[i].zName, aCommand[i].xProc,
2013 aCommand[i].pContext, 0);
2014 }
2015 }else{
2016
--- src/th_main.c
+++ src/th_main.c
@@ -2005,11 +2005,11 @@
2005 g.tcl.setup = db_get("tcl-setup", 0); /* Grab Tcl setup script. */
2006 }
2007 th_register_tcl(g.interp, &g.tcl); /* Tcl integration commands. */
2008 }
2009 #endif
2010 for(i=0; i<count(aCommand); i++){
2011 if ( !aCommand[i].zName || !aCommand[i].xProc ) continue;
2012 Th_CreateCommand(g.interp, aCommand[i].zName, aCommand[i].xProc,
2013 aCommand[i].pContext, 0);
2014 }
2015 }else{
2016
+2 -2
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -833,11 +833,11 @@
833833
int i;
834834
Th_Interp *th1Interp = (Th_Interp *)clientData;
835835
836836
if( !th1Interp ) return;
837837
/* Remove the Tcl integration commands. */
838
- for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
838
+ for(i=0; i<count(aCommand); i++){
839839
Th_RenameCommand(th1Interp, aCommand[i].zName, -1, NULL, 0);
840840
}
841841
}
842842
843843
/*
@@ -1261,11 +1261,11 @@
12611261
void *pContext
12621262
){
12631263
int i;
12641264
12651265
/* Add the Tcl integration commands to TH1. */
1266
- for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
1266
+ for(i=0; i<count(aCommand); i++){
12671267
void *ctx;
12681268
if( !aCommand[i].zName || !aCommand[i].xProc ) continue;
12691269
ctx = aCommand[i].pContext;
12701270
/* Use Tcl interpreter for context? */
12711271
if( !ctx ) ctx = pContext;
12721272
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -833,11 +833,11 @@
833 int i;
834 Th_Interp *th1Interp = (Th_Interp *)clientData;
835
836 if( !th1Interp ) return;
837 /* Remove the Tcl integration commands. */
838 for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
839 Th_RenameCommand(th1Interp, aCommand[i].zName, -1, NULL, 0);
840 }
841 }
842
843 /*
@@ -1261,11 +1261,11 @@
1261 void *pContext
1262 ){
1263 int i;
1264
1265 /* Add the Tcl integration commands to TH1. */
1266 for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
1267 void *ctx;
1268 if( !aCommand[i].zName || !aCommand[i].xProc ) continue;
1269 ctx = aCommand[i].pContext;
1270 /* Use Tcl interpreter for context? */
1271 if( !ctx ) ctx = pContext;
1272
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -833,11 +833,11 @@
833 int i;
834 Th_Interp *th1Interp = (Th_Interp *)clientData;
835
836 if( !th1Interp ) return;
837 /* Remove the Tcl integration commands. */
838 for(i=0; i<count(aCommand); i++){
839 Th_RenameCommand(th1Interp, aCommand[i].zName, -1, NULL, 0);
840 }
841 }
842
843 /*
@@ -1261,11 +1261,11 @@
1261 void *pContext
1262 ){
1263 int i;
1264
1265 /* Add the Tcl integration commands to TH1. */
1266 for(i=0; i<count(aCommand); i++){
1267 void *ctx;
1268 if( !aCommand[i].zName || !aCommand[i].xProc ) continue;
1269 ctx = aCommand[i].pContext;
1270 /* Use Tcl interpreter for context? */
1271 if( !ctx ) ctx = pContext;
1272
+8 -16
--- src/timeline.c
+++ src/timeline.c
@@ -390,11 +390,11 @@
390390
"SELECT pid FROM plink"
391391
" WHERE cid=:rid AND pid NOT IN phantom"
392392
" ORDER BY isprim DESC /*sort*/"
393393
);
394394
db_bind_int(&qparent, ":rid", rid);
395
- while( db_step(&qparent)==SQLITE_ROW && nParent<ArraySize(aParent) ){
395
+ while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
396396
aParent[nParent++] = db_column_int(&qparent, 0);
397397
}
398398
db_reset(&qparent);
399399
gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr,
400400
zUuid, isLeaf);
@@ -1186,11 +1186,11 @@
11861186
}
11871187
if( g.perm.RdWiki ){
11881188
az[i++] = "w";
11891189
az[i++] = "Wiki";
11901190
}
1191
- assert( i<=ArraySize(az) );
1191
+ assert( i<=count(az) );
11921192
}
11931193
if( i>2 ){
11941194
style_submenu_multichoice("y", i/2, az, isDisabled);
11951195
}
11961196
}
@@ -1476,12 +1476,11 @@
14761476
blob_append(&sql, ")", -1);
14771477
path_reset();
14781478
addFileGlobExclusion(zChng, &sql);
14791479
tmFlags |= TIMELINE_DISJOINT;
14801480
db_multi_exec("%s", blob_sql_text(&sql));
1481
- style_submenu_binary("v","With Files","Without Files",
1482
- zType[0]!='a' && zType[0]!='c');
1481
+ style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
14831482
blob_appendf(&desc, "%d check-ins going from ",
14841483
db_int(0, "SELECT count(*) FROM timeline"));
14851484
blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h", zFrom), zFrom);
14861485
blob_append(&desc, " to ", -1);
14871486
blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h",zTo), zTo);
@@ -1527,14 +1526,13 @@
15271526
if( p_rid ){
15281527
/* If both p= and d= are set, we don't have the uuid of d yet. */
15291528
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", d_rid);
15301529
}
15311530
}
1531
+ style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
15321532
style_submenu_entry("n","Max:",4,0);
15331533
timeline_y_submenu(1);
1534
- style_submenu_binary("v","With Files","Without Files",
1535
- zType[0]!='a' && zType[0]!='c');
15361534
}else if( f_rid && g.perm.Read ){
15371535
/* If f= is present, ignore all other parameters other than n= */
15381536
char *zUuid;
15391537
db_multi_exec(
15401538
"CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
@@ -1548,15 +1546,12 @@
15481546
if( useDividers ) selectedRid = f_rid;
15491547
blob_appendf(&desc, "Parents and children of check-in ");
15501548
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
15511549
blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%!S", zUuid), zUuid);
15521550
tmFlags |= TIMELINE_DISJOINT;
1553
- style_submenu_binary("v","With Files","Without Files",
1554
- zType[0]!='a' && zType[0]!='c');
1555
- if( (tmFlags & TIMELINE_UNHIDE)==0 ){
1556
- timeline_submenu(&url, "Unhide", "unhide", "", 0);
1557
- }
1551
+ style_submenu_checkbox("unhide", "Unhide", 0);
1552
+ style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
15581553
}else{
15591554
/* Otherwise, a timeline based on a span of time */
15601555
int n;
15611556
const char *zEType = "timeline item";
15621557
char *zDate;
@@ -1821,18 +1816,15 @@
18211816
timeline_submenu(&url, "Newer", "a", zDate, "b");
18221817
}
18231818
free(zDate);
18241819
}
18251820
if( zType[0]=='a' || zType[0]=='c' ){
1826
- if( (tmFlags & TIMELINE_UNHIDE)==0 ){
1827
- timeline_submenu(&url, "Unhide", "unhide", "", 0);
1828
- }
1821
+ style_submenu_checkbox("unhide", "Unhide", 0);
18291822
}
1823
+ style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
18301824
style_submenu_entry("n","Max:",4,0);
18311825
timeline_y_submenu(disableY);
1832
- style_submenu_binary("v","With Files","Without Files",
1833
- zType[0]!='a' && zType[0]!='c');
18341826
}
18351827
blob_zero(&cond);
18361828
}
18371829
if( PB("showsql") ){
18381830
@ <pre>%h(blob_sql_text(&sql))</pre>
18391831
--- src/timeline.c
+++ src/timeline.c
@@ -390,11 +390,11 @@
390 "SELECT pid FROM plink"
391 " WHERE cid=:rid AND pid NOT IN phantom"
392 " ORDER BY isprim DESC /*sort*/"
393 );
394 db_bind_int(&qparent, ":rid", rid);
395 while( db_step(&qparent)==SQLITE_ROW && nParent<ArraySize(aParent) ){
396 aParent[nParent++] = db_column_int(&qparent, 0);
397 }
398 db_reset(&qparent);
399 gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr,
400 zUuid, isLeaf);
@@ -1186,11 +1186,11 @@
1186 }
1187 if( g.perm.RdWiki ){
1188 az[i++] = "w";
1189 az[i++] = "Wiki";
1190 }
1191 assert( i<=ArraySize(az) );
1192 }
1193 if( i>2 ){
1194 style_submenu_multichoice("y", i/2, az, isDisabled);
1195 }
1196 }
@@ -1476,12 +1476,11 @@
1476 blob_append(&sql, ")", -1);
1477 path_reset();
1478 addFileGlobExclusion(zChng, &sql);
1479 tmFlags |= TIMELINE_DISJOINT;
1480 db_multi_exec("%s", blob_sql_text(&sql));
1481 style_submenu_binary("v","With Files","Without Files",
1482 zType[0]!='a' && zType[0]!='c');
1483 blob_appendf(&desc, "%d check-ins going from ",
1484 db_int(0, "SELECT count(*) FROM timeline"));
1485 blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h", zFrom), zFrom);
1486 blob_append(&desc, " to ", -1);
1487 blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h",zTo), zTo);
@@ -1527,14 +1526,13 @@
1527 if( p_rid ){
1528 /* If both p= and d= are set, we don't have the uuid of d yet. */
1529 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", d_rid);
1530 }
1531 }
 
1532 style_submenu_entry("n","Max:",4,0);
1533 timeline_y_submenu(1);
1534 style_submenu_binary("v","With Files","Without Files",
1535 zType[0]!='a' && zType[0]!='c');
1536 }else if( f_rid && g.perm.Read ){
1537 /* If f= is present, ignore all other parameters other than n= */
1538 char *zUuid;
1539 db_multi_exec(
1540 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
@@ -1548,15 +1546,12 @@
1548 if( useDividers ) selectedRid = f_rid;
1549 blob_appendf(&desc, "Parents and children of check-in ");
1550 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
1551 blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%!S", zUuid), zUuid);
1552 tmFlags |= TIMELINE_DISJOINT;
1553 style_submenu_binary("v","With Files","Without Files",
1554 zType[0]!='a' && zType[0]!='c');
1555 if( (tmFlags & TIMELINE_UNHIDE)==0 ){
1556 timeline_submenu(&url, "Unhide", "unhide", "", 0);
1557 }
1558 }else{
1559 /* Otherwise, a timeline based on a span of time */
1560 int n;
1561 const char *zEType = "timeline item";
1562 char *zDate;
@@ -1821,18 +1816,15 @@
1821 timeline_submenu(&url, "Newer", "a", zDate, "b");
1822 }
1823 free(zDate);
1824 }
1825 if( zType[0]=='a' || zType[0]=='c' ){
1826 if( (tmFlags & TIMELINE_UNHIDE)==0 ){
1827 timeline_submenu(&url, "Unhide", "unhide", "", 0);
1828 }
1829 }
 
1830 style_submenu_entry("n","Max:",4,0);
1831 timeline_y_submenu(disableY);
1832 style_submenu_binary("v","With Files","Without Files",
1833 zType[0]!='a' && zType[0]!='c');
1834 }
1835 blob_zero(&cond);
1836 }
1837 if( PB("showsql") ){
1838 @ <pre>%h(blob_sql_text(&sql))</pre>
1839
--- src/timeline.c
+++ src/timeline.c
@@ -390,11 +390,11 @@
390 "SELECT pid FROM plink"
391 " WHERE cid=:rid AND pid NOT IN phantom"
392 " ORDER BY isprim DESC /*sort*/"
393 );
394 db_bind_int(&qparent, ":rid", rid);
395 while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
396 aParent[nParent++] = db_column_int(&qparent, 0);
397 }
398 db_reset(&qparent);
399 gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr,
400 zUuid, isLeaf);
@@ -1186,11 +1186,11 @@
1186 }
1187 if( g.perm.RdWiki ){
1188 az[i++] = "w";
1189 az[i++] = "Wiki";
1190 }
1191 assert( i<=count(az) );
1192 }
1193 if( i>2 ){
1194 style_submenu_multichoice("y", i/2, az, isDisabled);
1195 }
1196 }
@@ -1476,12 +1476,11 @@
1476 blob_append(&sql, ")", -1);
1477 path_reset();
1478 addFileGlobExclusion(zChng, &sql);
1479 tmFlags |= TIMELINE_DISJOINT;
1480 db_multi_exec("%s", blob_sql_text(&sql));
1481 style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
 
1482 blob_appendf(&desc, "%d check-ins going from ",
1483 db_int(0, "SELECT count(*) FROM timeline"));
1484 blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h", zFrom), zFrom);
1485 blob_append(&desc, " to ", -1);
1486 blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h",zTo), zTo);
@@ -1527,14 +1526,13 @@
1526 if( p_rid ){
1527 /* If both p= and d= are set, we don't have the uuid of d yet. */
1528 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", d_rid);
1529 }
1530 }
1531 style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
1532 style_submenu_entry("n","Max:",4,0);
1533 timeline_y_submenu(1);
 
 
1534 }else if( f_rid && g.perm.Read ){
1535 /* If f= is present, ignore all other parameters other than n= */
1536 char *zUuid;
1537 db_multi_exec(
1538 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
@@ -1548,15 +1546,12 @@
1546 if( useDividers ) selectedRid = f_rid;
1547 blob_appendf(&desc, "Parents and children of check-in ");
1548 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
1549 blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%!S", zUuid), zUuid);
1550 tmFlags |= TIMELINE_DISJOINT;
1551 style_submenu_checkbox("unhide", "Unhide", 0);
1552 style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
 
 
 
1553 }else{
1554 /* Otherwise, a timeline based on a span of time */
1555 int n;
1556 const char *zEType = "timeline item";
1557 char *zDate;
@@ -1821,18 +1816,15 @@
1816 timeline_submenu(&url, "Newer", "a", zDate, "b");
1817 }
1818 free(zDate);
1819 }
1820 if( zType[0]=='a' || zType[0]=='c' ){
1821 style_submenu_checkbox("unhide", "Unhide", 0);
 
 
1822 }
1823 style_submenu_checkbox("v", "Files", zType[0]!='a' && zType[0]!='c');
1824 style_submenu_entry("n","Max:",4,0);
1825 timeline_y_submenu(disableY);
 
 
1826 }
1827 blob_zero(&cond);
1828 }
1829 if( PB("showsql") ){
1830 @ <pre>%h(blob_sql_text(&sql))</pre>
1831
+3 -3
--- src/unicode.c
+++ src/unicode.c
@@ -144,11 +144,11 @@
144144
if( (unsigned int)c<128 ){
145145
return ( (aAscii[c >> 5] & (1 << (c & 0x001F)))==0 );
146146
}else if( (unsigned int)c<(1<<22) ){
147147
unsigned int key = (((unsigned int)c)<<10) | 0x000003FF;
148148
int iRes = 0;
149
- int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1;
149
+ int iHi = count(aEntry) - 1;
150150
int iLo = 0;
151151
while( iHi>=iLo ){
152152
int iTest = (iHi + iLo) / 2;
153153
if( key >= aEntry[iTest] ){
154154
iRes = iTest;
@@ -201,11 +201,11 @@
201201
'e', 'i', 'o', 'u', 'y',
202202
};
203203
204204
unsigned int key = (((unsigned int)c)<<3) | 0x00000007;
205205
int iRes = 0;
206
- int iHi = sizeof(aDia)/sizeof(aDia[0]) - 1;
206
+ int iHi = count(aDia) - 1;
207207
int iLo = 0;
208208
while( iHi>=iLo ){
209209
int iTest = (iHi + iLo) / 2;
210210
if( key >= aDia[iTest] ){
211211
iRes = iTest;
@@ -348,11 +348,11 @@
348348
349349
if( c<128 ){
350350
if( c>='A' && c<='Z' ) ret = c + ('a' - 'A');
351351
}else if( c<65536 ){
352352
const struct TableEntry *p;
353
- int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1;
353
+ int iHi = count(aEntry) - 1;
354354
int iLo = 0;
355355
int iRes = -1;
356356
357357
assert( c>aEntry[0].iCode );
358358
while( iHi>=iLo ){
359359
--- src/unicode.c
+++ src/unicode.c
@@ -144,11 +144,11 @@
144 if( (unsigned int)c<128 ){
145 return ( (aAscii[c >> 5] & (1 << (c & 0x001F)))==0 );
146 }else if( (unsigned int)c<(1<<22) ){
147 unsigned int key = (((unsigned int)c)<<10) | 0x000003FF;
148 int iRes = 0;
149 int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1;
150 int iLo = 0;
151 while( iHi>=iLo ){
152 int iTest = (iHi + iLo) / 2;
153 if( key >= aEntry[iTest] ){
154 iRes = iTest;
@@ -201,11 +201,11 @@
201 'e', 'i', 'o', 'u', 'y',
202 };
203
204 unsigned int key = (((unsigned int)c)<<3) | 0x00000007;
205 int iRes = 0;
206 int iHi = sizeof(aDia)/sizeof(aDia[0]) - 1;
207 int iLo = 0;
208 while( iHi>=iLo ){
209 int iTest = (iHi + iLo) / 2;
210 if( key >= aDia[iTest] ){
211 iRes = iTest;
@@ -348,11 +348,11 @@
348
349 if( c<128 ){
350 if( c>='A' && c<='Z' ) ret = c + ('a' - 'A');
351 }else if( c<65536 ){
352 const struct TableEntry *p;
353 int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1;
354 int iLo = 0;
355 int iRes = -1;
356
357 assert( c>aEntry[0].iCode );
358 while( iHi>=iLo ){
359
--- src/unicode.c
+++ src/unicode.c
@@ -144,11 +144,11 @@
144 if( (unsigned int)c<128 ){
145 return ( (aAscii[c >> 5] & (1 << (c & 0x001F)))==0 );
146 }else if( (unsigned int)c<(1<<22) ){
147 unsigned int key = (((unsigned int)c)<<10) | 0x000003FF;
148 int iRes = 0;
149 int iHi = count(aEntry) - 1;
150 int iLo = 0;
151 while( iHi>=iLo ){
152 int iTest = (iHi + iLo) / 2;
153 if( key >= aEntry[iTest] ){
154 iRes = iTest;
@@ -201,11 +201,11 @@
201 'e', 'i', 'o', 'u', 'y',
202 };
203
204 unsigned int key = (((unsigned int)c)<<3) | 0x00000007;
205 int iRes = 0;
206 int iHi = count(aDia) - 1;
207 int iLo = 0;
208 while( iHi>=iLo ){
209 int iTest = (iHi + iLo) / 2;
210 if( key >= aDia[iTest] ){
211 iRes = iTest;
@@ -348,11 +348,11 @@
348
349 if( c<128 ){
350 if( c>='A' && c<='Z' ) ret = c + ('a' - 'A');
351 }else if( c<65536 ){
352 const struct TableEntry *p;
353 int iHi = count(aEntry) - 1;
354 int iLo = 0;
355 int iRes = -1;
356
357 assert( c>aEntry[0].iCode );
358 while( iHi>=iLo ){
359
+1 -1
--- src/vfile.c
+++ src/vfile.c
@@ -435,11 +435,11 @@
435435
for(; zName[0]!=0; zName++){
436436
if( zName[0]=='/' && sqlite3_strglob("/ci-comment-????????????.txt", zName)==0 ){
437437
return 1;
438438
}
439439
if( zName[0]!='-' ) continue;
440
- for(i=0; i<sizeof(azTemp)/sizeof(azTemp[0]); i++){
440
+ for(i=0; i<count(azTemp); i++){
441441
n = (int)strlen(azTemp[i]);
442442
if( memcmp(azTemp[i], zName+1, n) ) continue;
443443
if( zName[n+1]==0 ) return 1;
444444
if( zName[n+1]=='-' ){
445445
for(j=n+2; zName[j] && fossil_isdigit(zName[j]); j++){}
446446
--- src/vfile.c
+++ src/vfile.c
@@ -435,11 +435,11 @@
435 for(; zName[0]!=0; zName++){
436 if( zName[0]=='/' && sqlite3_strglob("/ci-comment-????????????.txt", zName)==0 ){
437 return 1;
438 }
439 if( zName[0]!='-' ) continue;
440 for(i=0; i<sizeof(azTemp)/sizeof(azTemp[0]); i++){
441 n = (int)strlen(azTemp[i]);
442 if( memcmp(azTemp[i], zName+1, n) ) continue;
443 if( zName[n+1]==0 ) return 1;
444 if( zName[n+1]=='-' ){
445 for(j=n+2; zName[j] && fossil_isdigit(zName[j]); j++){}
446
--- src/vfile.c
+++ src/vfile.c
@@ -435,11 +435,11 @@
435 for(; zName[0]!=0; zName++){
436 if( zName[0]=='/' && sqlite3_strglob("/ci-comment-????????????.txt", zName)==0 ){
437 return 1;
438 }
439 if( zName[0]!='-' ) continue;
440 for(i=0; i<count(azTemp); i++){
441 n = (int)strlen(azTemp[i]);
442 if( memcmp(azTemp[i], zName+1, n) ) continue;
443 if( zName[n+1]==0 ) return 1;
444 if( zName[n+1]=='-' ){
445 for(j=n+2; zName[j] && fossil_isdigit(zName[j]); j++){}
446
+2 -2
--- src/wiki.c
+++ src/wiki.c
@@ -138,11 +138,11 @@
138138
** All others become "text/x-fossil-wiki"
139139
*/
140140
const char *wiki_filter_mimetypes(const char *zMimetype){
141141
if( zMimetype!=0 ){
142142
int i;
143
- for(i=0; i<sizeof(azStyles)/sizeof(azStyles[0]); i+=3){
143
+ for(i=0; i<count(azStyles); i+=3){
144144
if( fossil_strcmp(zMimetype,azStyles[i+2])==0 ){
145145
return azStyles[i];
146146
}
147147
}
148148
if( fossil_strcmp(zMimetype, "text/x-markdown")==0
@@ -428,11 +428,11 @@
428428
** wiki mimetype.
429429
*/
430430
void mimetype_option_menu(const char *zMimetype){
431431
unsigned i;
432432
@ <select name="mimetype" size="1">
433
- for(i=0; i<sizeof(azStyles)/sizeof(azStyles[0]); i+=3){
433
+ for(i=0; i<count(azStyles); i+=3){
434434
if( fossil_strcmp(zMimetype,azStyles[i])==0 ){
435435
@ <option value="%s(azStyles[i])" selected>%s(azStyles[i+1])</option>
436436
}else{
437437
@ <option value="%s(azStyles[i])">%s(azStyles[i+1])</option>
438438
}
439439
--- src/wiki.c
+++ src/wiki.c
@@ -138,11 +138,11 @@
138 ** All others become "text/x-fossil-wiki"
139 */
140 const char *wiki_filter_mimetypes(const char *zMimetype){
141 if( zMimetype!=0 ){
142 int i;
143 for(i=0; i<sizeof(azStyles)/sizeof(azStyles[0]); i+=3){
144 if( fossil_strcmp(zMimetype,azStyles[i+2])==0 ){
145 return azStyles[i];
146 }
147 }
148 if( fossil_strcmp(zMimetype, "text/x-markdown")==0
@@ -428,11 +428,11 @@
428 ** wiki mimetype.
429 */
430 void mimetype_option_menu(const char *zMimetype){
431 unsigned i;
432 @ <select name="mimetype" size="1">
433 for(i=0; i<sizeof(azStyles)/sizeof(azStyles[0]); i+=3){
434 if( fossil_strcmp(zMimetype,azStyles[i])==0 ){
435 @ <option value="%s(azStyles[i])" selected>%s(azStyles[i+1])</option>
436 }else{
437 @ <option value="%s(azStyles[i])">%s(azStyles[i+1])</option>
438 }
439
--- src/wiki.c
+++ src/wiki.c
@@ -138,11 +138,11 @@
138 ** All others become "text/x-fossil-wiki"
139 */
140 const char *wiki_filter_mimetypes(const char *zMimetype){
141 if( zMimetype!=0 ){
142 int i;
143 for(i=0; i<count(azStyles); i+=3){
144 if( fossil_strcmp(zMimetype,azStyles[i+2])==0 ){
145 return azStyles[i];
146 }
147 }
148 if( fossil_strcmp(zMimetype, "text/x-markdown")==0
@@ -428,11 +428,11 @@
428 ** wiki mimetype.
429 */
430 void mimetype_option_menu(const char *zMimetype){
431 unsigned i;
432 @ <select name="mimetype" size="1">
433 for(i=0; i<count(azStyles); i+=3){
434 if( fossil_strcmp(zMimetype,azStyles[i])==0 ){
435 @ <option value="%s(azStyles[i])" selected>%s(azStyles[i+1])</option>
436 }else{
437 @ <option value="%s(azStyles[i])">%s(azStyles[i+1])</option>
438 }
439
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -145,11 +145,11 @@
145145
** Use binary search to locate a tag in the aAttribute[] table.
146146
*/
147147
static int findAttr(const char *z){
148148
int i, c, first, last;
149149
first = 1;
150
- last = sizeof(aAttribute)/sizeof(aAttribute[0]) - 1;
150
+ last = count(aAttribute) - 1;
151151
while( first<=last ){
152152
i = (first+last)/2;
153153
c = fossil_strcmp(aAttribute[i].zName, z);
154154
if( c==0 ){
155155
return i;
@@ -372,11 +372,11 @@
372372
AMSK_ID|AMSK_TYPE },
373373
};
374374
375375
void show_allowed_wiki_markup( void ){
376376
int i; /* loop over allowedAttr */
377
- for( i=1 ; i<=sizeof(aMarkup)/sizeof(aMarkup[0]) - 1 ; i++ ){
377
+ for( i=1 ; i<=count(aMarkup) - 1 ; i++ ){
378378
@ &lt;%s(aMarkup[i].zName)&gt;
379379
}
380380
}
381381
382382
/*
@@ -383,11 +383,11 @@
383383
** Use binary search to locate a tag in the aMarkup[] table.
384384
*/
385385
static int findTag(const char *z){
386386
int i, c, first, last;
387387
first = 1;
388
- last = sizeof(aMarkup)/sizeof(aMarkup[0]) - 1;
388
+ last = count(aMarkup) - 1;
389389
while( first<=last ){
390390
i = (first+last)/2;
391391
c = fossil_strcmp(aMarkup[i].zName, z);
392392
if( c==0 ){
393393
assert( aMarkup[i].iCode==i );
@@ -2187,11 +2187,11 @@
21872187
{ 4, '<', "&lt;" },
21882188
{ 4, '>', "&gt;" },
21892189
{ 6, ' ', "&nbsp;" },
21902190
};
21912191
int jj;
2192
- for(jj=0; jj<ArraySize(aEntity); jj++){
2192
+ for(jj=0; jj<count(aEntity); jj++){
21932193
if( aEntity[jj].n==n && strncmp(aEntity[jj].z,zIn,n)==0 ){
21942194
c = aEntity[jj].c;
21952195
break;
21962196
}
21972197
}
21982198
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -145,11 +145,11 @@
145 ** Use binary search to locate a tag in the aAttribute[] table.
146 */
147 static int findAttr(const char *z){
148 int i, c, first, last;
149 first = 1;
150 last = sizeof(aAttribute)/sizeof(aAttribute[0]) - 1;
151 while( first<=last ){
152 i = (first+last)/2;
153 c = fossil_strcmp(aAttribute[i].zName, z);
154 if( c==0 ){
155 return i;
@@ -372,11 +372,11 @@
372 AMSK_ID|AMSK_TYPE },
373 };
374
375 void show_allowed_wiki_markup( void ){
376 int i; /* loop over allowedAttr */
377 for( i=1 ; i<=sizeof(aMarkup)/sizeof(aMarkup[0]) - 1 ; i++ ){
378 @ &lt;%s(aMarkup[i].zName)&gt;
379 }
380 }
381
382 /*
@@ -383,11 +383,11 @@
383 ** Use binary search to locate a tag in the aMarkup[] table.
384 */
385 static int findTag(const char *z){
386 int i, c, first, last;
387 first = 1;
388 last = sizeof(aMarkup)/sizeof(aMarkup[0]) - 1;
389 while( first<=last ){
390 i = (first+last)/2;
391 c = fossil_strcmp(aMarkup[i].zName, z);
392 if( c==0 ){
393 assert( aMarkup[i].iCode==i );
@@ -2187,11 +2187,11 @@
2187 { 4, '<', "&lt;" },
2188 { 4, '>', "&gt;" },
2189 { 6, ' ', "&nbsp;" },
2190 };
2191 int jj;
2192 for(jj=0; jj<ArraySize(aEntity); jj++){
2193 if( aEntity[jj].n==n && strncmp(aEntity[jj].z,zIn,n)==0 ){
2194 c = aEntity[jj].c;
2195 break;
2196 }
2197 }
2198
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -145,11 +145,11 @@
145 ** Use binary search to locate a tag in the aAttribute[] table.
146 */
147 static int findAttr(const char *z){
148 int i, c, first, last;
149 first = 1;
150 last = count(aAttribute) - 1;
151 while( first<=last ){
152 i = (first+last)/2;
153 c = fossil_strcmp(aAttribute[i].zName, z);
154 if( c==0 ){
155 return i;
@@ -372,11 +372,11 @@
372 AMSK_ID|AMSK_TYPE },
373 };
374
375 void show_allowed_wiki_markup( void ){
376 int i; /* loop over allowedAttr */
377 for( i=1 ; i<=count(aMarkup) - 1 ; i++ ){
378 @ &lt;%s(aMarkup[i].zName)&gt;
379 }
380 }
381
382 /*
@@ -383,11 +383,11 @@
383 ** Use binary search to locate a tag in the aMarkup[] table.
384 */
385 static int findTag(const char *z){
386 int i, c, first, last;
387 first = 1;
388 last = count(aMarkup) - 1;
389 while( first<=last ){
390 i = (first+last)/2;
391 c = fossil_strcmp(aMarkup[i].zName, z);
392 if( c==0 ){
393 assert( aMarkup[i].iCode==i );
@@ -2187,11 +2187,11 @@
2187 { 4, '<', "&lt;" },
2188 { 4, '>', "&gt;" },
2189 { 6, ' ', "&nbsp;" },
2190 };
2191 int jj;
2192 for(jj=0; jj<count(aEntity); jj++){
2193 if( aEntity[jj].n==n && strncmp(aEntity[jj].z,zIn,n)==0 ){
2194 c = aEntity[jj].c;
2195 break;
2196 }
2197 }
2198

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button