dep.pl: strip comments
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
diff --git a/callgraph.txt b/callgraph.txt
index daea322..9d56e7c 100644
--- a/callgraph.txt
+++ b/callgraph.txt
@@ -3189,6 +3189,7 @@ BN_MP_IS_SQUARE_C
BN_MP_JACOBI_C
++--->BN_MP_CMP_D_C
+--->BN_MP_KRONECKER_C
| +--->BN_MP_INIT_COPY_C
| | +--->BN_MP_INIT_SIZE_C
@@ -3204,7 +3205,6 @@ BN_MP_JACOBI_C
| | | +--->BN_MP_CLAMP_C
| | +--->BN_MP_RSHD_C
| | +--->BN_MP_CLAMP_C
-| +--->BN_MP_CMP_D_C
| +--->BN_MP_COPY_C
| | +--->BN_MP_GROW_C
| +--->BN_MP_MOD_C
@@ -3258,7 +3258,6 @@ BN_MP_JACOBI_C
| | | | +--->BN_MP_GROW_C
| | | | +--->BN_MP_CLAMP_C
| +--->BN_MP_CLEAR_C
-+--->BN_MP_CMP_D_C
BN_MP_KRONECKER_C
@@ -7028,9 +7027,6 @@ BN_MP_PRIME_IS_PRIME_C
| +--->BN_MP_CLEAR_MULTI_C
| | +--->BN_MP_CLEAR_C
+--->BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
-| +--->BN_MP_MUL_D_C
-| | +--->BN_MP_GROW_C
-| | +--->BN_MP_CLAMP_C
| +--->BN_MP_INIT_C
| +--->BN_MP_SET_LONG_C
| +--->BN_MP_MUL_C
@@ -7088,6 +7084,9 @@ BN_MP_PRIME_IS_PRIME_C
| | | | +--->BN_MP_GROW_C
| | | | +--->BN_MP_LSHD_C
| | | | +--->BN_MP_CLAMP_C
+| | | +--->BN_MP_MUL_D_C
+| | | | +--->BN_MP_GROW_C
+| | | | +--->BN_MP_CLAMP_C
| | | +--->BN_MP_DIV_3_C
| | | | +--->BN_MP_INIT_SIZE_C
| | | | +--->BN_MP_CLAMP_C
@@ -7198,6 +7197,9 @@ BN_MP_PRIME_IS_PRIME_C
| | | | +--->BN_MP_LSHD_C
| | | | | +--->BN_MP_GROW_C
| | | | +--->BN_MP_RSHD_C
+| | | | +--->BN_MP_MUL_D_C
+| | | | | +--->BN_MP_GROW_C
+| | | | | +--->BN_MP_CLAMP_C
| | | | +--->BN_MP_CLAMP_C
| | | +--->BN_MP_EXCH_C
| | | +--->BN_MP_ADD_C
@@ -7259,6 +7261,9 @@ BN_MP_PRIME_IS_PRIME_C
| | | +--->BN_MP_LSHD_C
| | | | +--->BN_MP_GROW_C
| | | +--->BN_MP_RSHD_C
+| | | +--->BN_MP_MUL_D_C
+| | | | +--->BN_MP_GROW_C
+| | | | +--->BN_MP_CLAMP_C
| | | +--->BN_MP_CLAMP_C
| | +--->BN_MP_EXCH_C
| | +--->BN_MP_ADD_C
@@ -7303,6 +7308,9 @@ BN_MP_PRIME_IS_PRIME_C
| | | | +--->BN_MP_GROW_C
| | | | +--->BN_MP_LSHD_C
| | | | +--->BN_MP_CLAMP_C
+| | | +--->BN_MP_MUL_D_C
+| | | | +--->BN_MP_GROW_C
+| | | | +--->BN_MP_CLAMP_C
| | | +--->BN_MP_DIV_3_C
| | | | +--->BN_MP_INIT_SIZE_C
| | | | +--->BN_MP_CLAMP_C
@@ -9632,9 +9640,6 @@ BN_MP_PRIME_NEXT_PRIME_C
| | +--->BN_MP_CLEAR_MULTI_C
| | | +--->BN_MP_CLEAR_C
| +--->BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
-| | +--->BN_MP_MUL_D_C
-| | | +--->BN_MP_GROW_C
-| | | +--->BN_MP_CLAMP_C
| | +--->BN_MP_SET_LONG_C
| | +--->BN_MP_MUL_C
| | | +--->BN_S_MP_BALANCE_MUL_C
@@ -9691,6 +9696,9 @@ BN_MP_PRIME_NEXT_PRIME_C
| | | | | +--->BN_MP_GROW_C
| | | | | +--->BN_MP_LSHD_C
| | | | | +--->BN_MP_CLAMP_C
+| | | | +--->BN_MP_MUL_D_C
+| | | | | +--->BN_MP_GROW_C
+| | | | | +--->BN_MP_CLAMP_C
| | | | +--->BN_MP_DIV_3_C
| | | | | +--->BN_MP_INIT_SIZE_C
| | | | | +--->BN_MP_CLAMP_C
@@ -9800,6 +9808,9 @@ BN_MP_PRIME_NEXT_PRIME_C
| | | | | +--->BN_MP_LSHD_C
| | | | | | +--->BN_MP_GROW_C
| | | | | +--->BN_MP_RSHD_C
+| | | | | +--->BN_MP_MUL_D_C
+| | | | | | +--->BN_MP_GROW_C
+| | | | | | +--->BN_MP_CLAMP_C
| | | | | +--->BN_MP_CLAMP_C
| | | | +--->BN_MP_EXCH_C
| | | | +--->BN_MP_ADD_C
@@ -9854,6 +9865,9 @@ BN_MP_PRIME_NEXT_PRIME_C
| | | | +--->BN_MP_LSHD_C
| | | | | +--->BN_MP_GROW_C
| | | | +--->BN_MP_RSHD_C
+| | | | +--->BN_MP_MUL_D_C
+| | | | | +--->BN_MP_GROW_C
+| | | | | +--->BN_MP_CLAMP_C
| | | | +--->BN_MP_CLAMP_C
| | | +--->BN_MP_EXCH_C
| | | +--->BN_MP_ADD_C
@@ -9898,6 +9912,9 @@ BN_MP_PRIME_NEXT_PRIME_C
| | | | | +--->BN_MP_GROW_C
| | | | | +--->BN_MP_LSHD_C
| | | | | +--->BN_MP_CLAMP_C
+| | | | +--->BN_MP_MUL_D_C
+| | | | | +--->BN_MP_GROW_C
+| | | | | +--->BN_MP_CLAMP_C
| | | | +--->BN_MP_DIV_3_C
| | | | | +--->BN_MP_INIT_SIZE_C
| | | | | +--->BN_MP_CLAMP_C
@@ -11401,9 +11418,6 @@ BN_MP_PRIME_RANDOM_EX_C
| | +--->BN_MP_CLEAR_MULTI_C
| | | +--->BN_MP_CLEAR_C
| +--->BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
-| | +--->BN_MP_MUL_D_C
-| | | +--->BN_MP_GROW_C
-| | | +--->BN_MP_CLAMP_C
| | +--->BN_MP_INIT_C
| | +--->BN_MP_SET_LONG_C
| | +--->BN_MP_MUL_C
@@ -11461,6 +11475,9 @@ BN_MP_PRIME_RANDOM_EX_C
| | | | | +--->BN_MP_GROW_C
| | | | | +--->BN_MP_LSHD_C
| | | | | +--->BN_MP_CLAMP_C
+| | | | +--->BN_MP_MUL_D_C
+| | | | | +--->BN_MP_GROW_C
+| | | | | +--->BN_MP_CLAMP_C
| | | | +--->BN_MP_DIV_3_C
| | | | | +--->BN_MP_INIT_SIZE_C
| | | | | +--->BN_MP_CLAMP_C
@@ -11571,6 +11588,9 @@ BN_MP_PRIME_RANDOM_EX_C
| | | | | +--->BN_MP_LSHD_C
| | | | | | +--->BN_MP_GROW_C
| | | | | +--->BN_MP_RSHD_C
+| | | | | +--->BN_MP_MUL_D_C
+| | | | | | +--->BN_MP_GROW_C
+| | | | | | +--->BN_MP_CLAMP_C
| | | | | +--->BN_MP_CLAMP_C
| | | | +--->BN_MP_EXCH_C
| | | | +--->BN_MP_ADD_C
@@ -11632,6 +11652,9 @@ BN_MP_PRIME_RANDOM_EX_C
| | | | +--->BN_MP_LSHD_C
| | | | | +--->BN_MP_GROW_C
| | | | +--->BN_MP_RSHD_C
+| | | | +--->BN_MP_MUL_D_C
+| | | | | +--->BN_MP_GROW_C
+| | | | | +--->BN_MP_CLAMP_C
| | | | +--->BN_MP_CLAMP_C
| | | +--->BN_MP_EXCH_C
| | | +--->BN_MP_ADD_C
@@ -11676,6 +11699,9 @@ BN_MP_PRIME_RANDOM_EX_C
| | | | | +--->BN_MP_GROW_C
| | | | | +--->BN_MP_LSHD_C
| | | | | +--->BN_MP_CLAMP_C
+| | | | +--->BN_MP_MUL_D_C
+| | | | | +--->BN_MP_GROW_C
+| | | | | +--->BN_MP_CLAMP_C
| | | | +--->BN_MP_DIV_3_C
| | | | | +--->BN_MP_INIT_SIZE_C
| | | | | +--->BN_MP_CLAMP_C
@@ -11774,9 +11800,6 @@ BN_MP_PRIME_RANDOM_EX_C
BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
-+--->BN_MP_MUL_D_C
-| +--->BN_MP_GROW_C
-| +--->BN_MP_CLAMP_C
+--->BN_MP_INIT_C
+--->BN_MP_SET_LONG_C
+--->BN_MP_MUL_C
@@ -11834,6 +11857,9 @@ BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
| | | +--->BN_MP_GROW_C
| | | +--->BN_MP_LSHD_C
| | | +--->BN_MP_CLAMP_C
+| | +--->BN_MP_MUL_D_C
+| | | +--->BN_MP_GROW_C
+| | | +--->BN_MP_CLAMP_C
| | +--->BN_MP_DIV_3_C
| | | +--->BN_MP_INIT_SIZE_C
| | | +--->BN_MP_CLAMP_C
@@ -11945,6 +11971,9 @@ BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
| | | +--->BN_MP_LSHD_C
| | | | +--->BN_MP_GROW_C
| | | +--->BN_MP_RSHD_C
+| | | +--->BN_MP_MUL_D_C
+| | | | +--->BN_MP_GROW_C
+| | | | +--->BN_MP_CLAMP_C
| | | +--->BN_MP_CLAMP_C
| | +--->BN_MP_EXCH_C
| | +--->BN_MP_ADD_C
@@ -12006,6 +12035,9 @@ BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
| | +--->BN_MP_LSHD_C
| | | +--->BN_MP_GROW_C
| | +--->BN_MP_RSHD_C
+| | +--->BN_MP_MUL_D_C
+| | | +--->BN_MP_GROW_C
+| | | +--->BN_MP_CLAMP_C
| | +--->BN_MP_CLAMP_C
| +--->BN_MP_EXCH_C
| +--->BN_MP_ADD_C
@@ -12050,6 +12082,9 @@ BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
| | | +--->BN_MP_GROW_C
| | | +--->BN_MP_LSHD_C
| | | +--->BN_MP_CLAMP_C
+| | +--->BN_MP_MUL_D_C
+| | | +--->BN_MP_GROW_C
+| | | +--->BN_MP_CLAMP_C
| | +--->BN_MP_DIV_3_C
| | | +--->BN_MP_INIT_SIZE_C
| | | +--->BN_MP_CLAMP_C
diff --git a/dep.pl b/dep.pl
index 45a3c63..fb610c1 100755
--- a/dep.pl
+++ b/dep.pl
@@ -79,6 +79,8 @@ EOS
foreach my $filename (glob 'bn*.c') {
open(my $src, '<', $filename) or die "Can't open source file!\n";
+ read $src, my $content, -s $src;
+ close $src;
# convert filename to upper case so we can use it as a define
$filename =~ tr/[a-z]/[A-Z]/;
@@ -89,9 +91,11 @@ foreach my $filename (glob 'bn*.c') {
EOS
my $list = $filename;
+ # strip comments
+ $content =~ s{/\*.*?\*/}{}gs;
+
# scan for mp_* and make classes
- while (<$src>) {
- my $line = $_;
+ foreach my $line (split /\n/, $content) {
while ($line =~ /(fast_)?(s_)?mp\_[a-z_0-9]*(?=\()/g) {
my $a = $&;
$a =~ tr/[a-z]/[A-Z]/;
@@ -110,7 +114,6 @@ EOS
#endif
EOS
- close $src;
}
print {$class} << 'EOS';
diff --git a/tommath_class.h b/tommath_class.h
index 940d8b8..9ed6247 100644
--- a/tommath_class.h
+++ b/tommath_class.h
@@ -505,8 +505,8 @@
#endif
#if defined(BN_MP_JACOBI_C)
-# define BN_MP_KRONECKER_C
# define BN_MP_CMP_D_C
+# define BN_MP_KRONECKER_C
#endif
#if defined(BN_MP_KRONECKER_C)
@@ -722,7 +722,6 @@
#endif
#if defined(BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C)
-# define BN_MP_MUL_D_C
# define BN_S_MP_MUL_SI_C
# define BN_MP_INIT_C
# define BN_MP_SET_LONG_C