1 | |
---|
2 | # This is a sed script to make most of the common syntactic |
---|
3 | # changes necessary to move from NTL 2.0 to 3.0. |
---|
4 | # If this file is in sedscript.txt (as it originally is) |
---|
5 | # the command |
---|
6 | # sed -f sedscript.txt < old.c > new.c |
---|
7 | # will convert old.c to new.c with the necesary changes. |
---|
8 | # |
---|
9 | # Please note that this script is niether "sound" or "complete", |
---|
10 | # but should still be useful. |
---|
11 | |
---|
12 | # rename some classes |
---|
13 | s/BB/GF2X/g |
---|
14 | s/BB_p/GF2E/g |
---|
15 | s/GF2Vector/vec_GF2/g |
---|
16 | s/GF2Matrix/mat_GF2/g |
---|
17 | |
---|
18 | # rename some functions |
---|
19 | s/ZZ_pInit(/ZZ_p::init(/g |
---|
20 | s/zz_pInit(/zz_p::init(/g |
---|
21 | s/zz_pFFTInit(/zz_p::FFTInit(/ |
---|
22 | s/GF2EInit(/GF2E::init(/g |
---|
23 | s/LowBits/trunc/g |
---|
24 | s/Long(/to_long(/g |
---|
25 | s/XDouble(/to_xdouble(/g |
---|
26 | s/Quad_float(/to_quad_float(/g |
---|
27 | s/trace(/TraceMod(/g |
---|
28 | s/norm(/NormMod(/g |
---|
29 | s/MinPoly(/MinPolyMod(/g |
---|
30 | s/IrredPoly(/IrredPolyMod(/g |
---|
31 | s/CharPoly(/CharPolyMod(/g |
---|
32 | |
---|
33 | # rename generic vector, pair, matrix macro instantations |
---|
34 | # these assume no embedded blanks |
---|
35 | s/vector_decl(\(.*\))/ntl_vector_decl(\1,vec_\1)/g |
---|
36 | s/vector_io_decl(\(.*\))/ntl_io_vector_decl(\1,vec_\1)/g |
---|
37 | s/vector_eq_decl(\(.*\))/ntl_eq_vector_decl(\1,vec_\1)/g |
---|
38 | # |
---|
39 | s/vector_impl(\(.*\))/ntl_vector_impl(\1,vec_\1)/g |
---|
40 | s/vector_impl_plain(\(.*\))/ntl_vector_impl_plain(\1,vec_\1)/g |
---|
41 | s/vector_io_impl(\(.*\))/ntl_io_vector_impl(\1,vec_\1)/g |
---|
42 | s/vector_eq_impl(\(.*\))/ntl_eq_vector_impl(\1,vec_\1)/g |
---|
43 | # |
---|
44 | s/matrix_decl(\(.*\))/ntl_matrix_decl(\1,vec_\1,vec_vec_\1,mat_\1)/g |
---|
45 | s/matrix_io_decl(\(.*\))/ntl_io_matrix_decl(\1,vec_\1,vec_vec_\1,mat_\1)/g |
---|
46 | s/matrix_eq_decl(\(.*\))/ntl_eq_matrix_decl(\1,vec_\1,vec_vec_\1,mat_\1)/g |
---|
47 | # |
---|
48 | s/matrix_impl(\(.*\))/ntl_matrix_impl(\1,vec_\1,vec_vec_\1,mat_\1)/g |
---|
49 | s/matrix_io_impl(\(.*\))/ntl_io_matrix_impl(\1,vec_\1,vec_vec_\1,mat_\1)/g |
---|
50 | s/matrix_eq_impl(\(.*\))/ntl_eq_matrix_impl(\1,vec_\1,vec_vec_\1,mat_\1)/g |
---|
51 | # |
---|
52 | s/pair_decl(\(.*\),\(.*\))/ntl_pair_decl(\1,\2,pair_\1_\2)/g |
---|
53 | s/pair_io_decl(\(.*\),\(.*\))/ntl_pair_io_decl(\1,\2,pair_\1_\2)/g |
---|
54 | s/pair_eq_decl(\(.*\),\(.*\))/ntl_pair_eq_decl(\1,\2,pair_\1_\2)/g |
---|
55 | # |
---|
56 | s/pair_impl(\(.*\),\(.*\))/ntl_pair_impl(\1,\2,pair_\1_\2)/g |
---|
57 | s/pair_io_impl(\(.*\),\(.*\))/ntl_pair_io_impl(\1,\2,pair_\1_\2)/g |
---|
58 | s/pair_eq_impl(\(.*\),\(.*\))/ntl_pair_eq_impl(\1,\2,pair_\1_\2)/g |
---|
59 | |
---|
60 | # rename type names for the generic types |
---|
61 | # these allow embedded blanks |
---|
62 | s/pair *( *\([^,() ]*\) *, *\([^() ]*\) *)/pair_\1_\2/g |
---|
63 | s/vector *( *\([^() ]*\) *)/vec_\1/g |
---|
64 | s/matrix *( *\([^() ]*\) *)/mat_\1/g |
---|
65 | # |
---|
66 | # repeat to handle one nesting level |
---|
67 | # |
---|
68 | s/pair *( *\([^,() ]*\) *, *\([^() ]*\) *)/pair_\1_\2/g |
---|
69 | s/vector *( *\([^() ]*\) *)/vec_\1/g |
---|
70 | s/matrix *( *\([^() ]*\) *)/mat_\1/g |
---|
71 | # |
---|
72 | # repeat to handle two nesting levels |
---|
73 | # |
---|
74 | s/pair *( *\([^,() ]*\) *, *\([^() ]*\) *)/pair_\1_\2/g |
---|
75 | s/vector *( *\([^() ]*\) *)/vec_\1/g |
---|
76 | s/matrix *( *\([^() ]*\) *)/mat_\1/g |
---|
77 | |
---|
78 | # rename header files for generic types |
---|
79 | s/vector\.h/ntl_vector\.h/ |
---|
80 | s/matrix\.h/ntl_matrix\.h/ |
---|
81 | s/pair\.h/ntl_pair\.h/ |
---|
82 | |
---|