Compare commits
3807 Commits
tags/Test
...
LIBREG9902
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd7437a096 | ||
|
|
a6041e3d9e | ||
|
|
467456baed | ||
|
|
07adb3fa4c | ||
|
|
9f7a44c3e2 | ||
|
|
99153e23c5 | ||
|
|
509501efbf | ||
|
|
249c9a91cc | ||
|
|
6100d0195f | ||
|
|
2b0897f6b5 | ||
|
|
9b7b41f2e2 | ||
|
|
acaf468169 | ||
|
|
37c847e5d4 | ||
|
|
4397f139f4 | ||
|
|
07af9a116d | ||
|
|
601c209b84 | ||
|
|
70f44c60cd | ||
|
|
8d0d948e0a | ||
|
|
bdc8aa3c5c | ||
|
|
ffccab09a0 | ||
|
|
fc3851269e | ||
|
|
66a57a8d4a | ||
|
|
faddf412e6 | ||
|
|
d95ce0280d | ||
|
|
222d35ba2a | ||
|
|
4deef56157 | ||
|
|
0b87bbb08b | ||
|
|
081ff74fbc | ||
|
|
d5d6d3b84d | ||
|
|
21f221f840 | ||
|
|
9d11223055 | ||
|
|
0bf563a085 | ||
|
|
43c6c57418 | ||
|
|
d6921ac2f2 | ||
|
|
1e47576a02 | ||
|
|
268f937a1f | ||
|
|
edb5d64de3 | ||
|
|
4728578919 | ||
|
|
56889e9bc1 | ||
|
|
64a273f287 | ||
|
|
a89c076bfc | ||
|
|
d4d1fa58e8 | ||
|
|
3db467e6f6 | ||
|
|
bb2e253937 | ||
|
|
f047e295b9 | ||
|
|
bd7d899204 | ||
|
|
ed1eaba00f | ||
|
|
376b050ee9 | ||
|
|
33b9e85352 | ||
|
|
eeaa4aa122 | ||
|
|
c2c82c36e6 | ||
|
|
99ffcc7501 | ||
|
|
ed1a2a6f11 | ||
|
|
b99446c33e | ||
|
|
9859213e7d | ||
|
|
008255eed9 | ||
|
|
11a0501087 | ||
|
|
076ccff595 | ||
|
|
30af4ede8c | ||
|
|
24f5a3d9ca | ||
|
|
8b848ea6ad | ||
|
|
61a13359fc | ||
|
|
b973f5ac69 | ||
|
|
a262748d1c | ||
|
|
47c513fc7a | ||
|
|
176116b148 | ||
|
|
fe6eb6d858 | ||
|
|
e63575051f | ||
|
|
2e10d1c4d8 | ||
|
|
7ce1632cc7 | ||
|
|
ea0d14982e | ||
|
|
1cb01c351a | ||
|
|
dfeb9b176c | ||
|
|
477db97893 | ||
|
|
0f0937d520 | ||
|
|
9e0a5b8dda | ||
|
|
04d445235f | ||
|
|
a8d532bb79 | ||
|
|
34595f93fb | ||
|
|
8d6a3ab755 | ||
|
|
9b917419dc | ||
|
|
f15564054f | ||
|
|
9970519fc4 | ||
|
|
432a586840 | ||
|
|
4a976707f8 | ||
|
|
3d922201ed | ||
|
|
c9ddf3d724 | ||
|
|
d9511b5a50 | ||
|
|
6d04acb923 | ||
|
|
34ccb6c231 | ||
|
|
b00e86e289 | ||
|
|
d7a75e4fba | ||
|
|
c931d836eb | ||
|
|
307fbf07da | ||
|
|
c2906b67bb | ||
|
|
a49bf084ba | ||
|
|
55638075e8 | ||
|
|
4a805d6b49 | ||
|
|
da69d50760 | ||
|
|
8c0b3b8851 | ||
|
|
667b1de51f | ||
|
|
6da5abec3e | ||
|
|
34af7a4608 | ||
|
|
9edc411146 | ||
|
|
e3cecd642e | ||
|
|
30fa15edad | ||
|
|
3640b78b2d | ||
|
|
32d9feec85 | ||
|
|
38427deaa9 | ||
|
|
32592fa6e1 | ||
|
|
7881284620 | ||
|
|
f8c7ce833e | ||
|
|
501710cba1 | ||
|
|
0cc94dceb2 | ||
|
|
3e6fcb9dca | ||
|
|
c1996b47bc | ||
|
|
ec6abf170e | ||
|
|
946499d8d7 | ||
|
|
176b389e10 | ||
|
|
1c7064c0af | ||
|
|
061b634e4a | ||
|
|
31383c4410 | ||
|
|
ba034ddb21 | ||
|
|
c7844ac086 | ||
|
|
598d78aca8 | ||
|
|
5dbaac9c50 | ||
|
|
859ff0ab5d | ||
|
|
e0f9f5f8e2 | ||
|
|
1b6258684f | ||
|
|
979a08812c | ||
|
|
e38564c283 | ||
|
|
e87813e07f | ||
|
|
191b4e299a | ||
|
|
e17e8659cb | ||
|
|
d1686af672 | ||
|
|
05bd425eba | ||
|
|
8c2a0f6b41 | ||
|
|
2e448ce46e | ||
|
|
983b5ddcd9 | ||
|
|
dcd6eb01ea | ||
|
|
abf14ae01a | ||
|
|
4e78b8f143 | ||
|
|
2b152865b3 | ||
|
|
0527883d33 | ||
|
|
3c4807983d | ||
|
|
ef0f4a25f7 | ||
|
|
d8cf6d28ef | ||
|
|
9dd5f88a76 | ||
|
|
e584b6a5a1 | ||
|
|
3f40b55e0c | ||
|
|
dcd5aa9928 | ||
|
|
cc020a6b86 | ||
|
|
9325b614fe | ||
|
|
f52cc1e74c | ||
|
|
b66f5435a9 | ||
|
|
754e790b4e | ||
|
|
d5ba4ac966 | ||
|
|
51076e2e13 | ||
|
|
3dcba141ec | ||
|
|
63f06d275e | ||
|
|
fb75799b42 | ||
|
|
8218669c3d | ||
|
|
f2378893c8 | ||
|
|
3f2dbb314c | ||
|
|
b493ea8e99 | ||
|
|
f1cab8f326 | ||
|
|
b1bfc6b9cf | ||
|
|
c2c951e7f8 | ||
|
|
9b636c9328 | ||
|
|
ced8ef4d71 | ||
|
|
b4a259e54f | ||
|
|
5087b40527 | ||
|
|
c3570833a5 | ||
|
|
7b5c0a5490 | ||
|
|
0e66d5506a | ||
|
|
dd28e872ad | ||
|
|
1d05d66559 | ||
|
|
cadc7286e4 | ||
|
|
175269d933 | ||
|
|
1186101405 | ||
|
|
9845bce011 | ||
|
|
bc1f73cd9e | ||
|
|
0a55bab557 | ||
|
|
8b520832b9 | ||
|
|
cdd9b46762 | ||
|
|
5087b9b097 | ||
|
|
37112bc046 | ||
|
|
d694ab972f | ||
|
|
dcb6bd5973 | ||
|
|
0ebe0a4652 | ||
|
|
a18676255d | ||
|
|
1c79aff237 | ||
|
|
f48015fd94 | ||
|
|
2490c245af | ||
|
|
2172a75d87 | ||
|
|
2ffd018374 | ||
|
|
244cccb5d1 | ||
|
|
dd0604d5eb | ||
|
|
16ef48adcd | ||
|
|
5467c1838d | ||
|
|
225f0584da | ||
|
|
f8c051689b | ||
|
|
2ade6c86f9 | ||
|
|
ddaccc1f26 | ||
|
|
fbee0b5524 | ||
|
|
2a24ef0296 | ||
|
|
a1c6abd840 | ||
|
|
4232c39a18 | ||
|
|
7b4aad86e1 | ||
|
|
6fb34e8453 | ||
|
|
cbf3244393 | ||
|
|
9e9dae4511 | ||
|
|
616d38e01a | ||
|
|
4aa9574ffe | ||
|
|
b049d85cf0 | ||
|
|
3d953cbb83 | ||
|
|
c50f8d3acf | ||
|
|
6e1121c2d9 | ||
|
|
ab05faab56 | ||
|
|
ad3e9eec3f | ||
|
|
b2ff2f5475 | ||
|
|
b1f31a9e30 | ||
|
|
3148db617e | ||
|
|
466262b0fd | ||
|
|
ba7bcd62b9 | ||
|
|
bd05ec34b5 | ||
|
|
489dcad781 | ||
|
|
75e870bf80 | ||
|
|
f3715745e2 | ||
|
|
bdf9731aad | ||
|
|
fcbf19b87f | ||
|
|
46adb79a84 | ||
|
|
982bcc6574 | ||
|
|
fd9c02553e | ||
|
|
8f0051e5da | ||
|
|
90bade3f9e | ||
|
|
879bcd3dbe | ||
|
|
1570ae2e1e | ||
|
|
7dd61549ae | ||
|
|
183367f869 | ||
|
|
2a6670788d | ||
|
|
9e740fac46 | ||
|
|
375c80910b | ||
|
|
64a99cbcc4 | ||
|
|
a2778fad2f | ||
|
|
7d3efd1ae3 | ||
|
|
1ef2b77848 | ||
|
|
bcc7ef2082 | ||
|
|
a704f3bb96 | ||
|
|
63236dfa91 | ||
|
|
468ac41b66 | ||
|
|
b1d4970f0e | ||
|
|
c24d3c37c3 | ||
|
|
0081d86569 | ||
|
|
065bc208b3 | ||
|
|
742ab46863 | ||
|
|
d001b2a986 | ||
|
|
d024afd811 | ||
|
|
484307c6dc | ||
|
|
e64bbf889e | ||
|
|
b5c996e95b | ||
|
|
e6e9460541 | ||
|
|
79e1e729a1 | ||
|
|
d77f11eff2 | ||
|
|
4be3a056c9 | ||
|
|
6c61a1d979 | ||
|
|
1b36cf1517 | ||
|
|
a7eb073f7f | ||
|
|
681521266d | ||
|
|
2bae921097 | ||
|
|
10824c470f | ||
|
|
6ccd350a1d | ||
|
|
9e2845f5e9 | ||
|
|
37a0fec61a | ||
|
|
457f7b1e94 | ||
|
|
feafd5eb60 | ||
|
|
5339627bca | ||
|
|
f754194d31 | ||
|
|
dbc2872088 | ||
|
|
73c7b11b00 | ||
|
|
4d3a7a38f1 | ||
|
|
96756c14d9 | ||
|
|
36a6b55866 | ||
|
|
3ab78a2fec | ||
|
|
d1f266d3fa | ||
|
|
7a5bd2f430 | ||
|
|
100fa1c227 | ||
|
|
dbf2a0eef6 | ||
|
|
83aaaa04ba | ||
|
|
3e4860116c | ||
|
|
a0c49af128 | ||
|
|
091da21cf4 | ||
|
|
ef5749914b | ||
|
|
a0a263475e | ||
|
|
d3952da2d6 | ||
|
|
7eca6494db | ||
|
|
bcfa0713ea | ||
|
|
88333318d6 | ||
|
|
36c56bfc85 | ||
|
|
45da5a7fd0 | ||
|
|
c0eabe2017 | ||
|
|
6db1abe692 | ||
|
|
d27bb31aa9 | ||
|
|
297f9e16ec | ||
|
|
0ed3738afe | ||
|
|
fe7377435f | ||
|
|
63b56c396b | ||
|
|
fd120dee00 | ||
|
|
9da531cd6b | ||
|
|
aabfe0f826 | ||
|
|
390cefda5f | ||
|
|
218ef805b6 | ||
|
|
608179b291 | ||
|
|
3dbeb7eb3f | ||
|
|
4f668b7081 | ||
|
|
0b91100f7c | ||
|
|
6ed5f63bed | ||
|
|
81ed947e44 | ||
|
|
666a630c33 | ||
|
|
850497c0cd | ||
|
|
51c9f366be | ||
|
|
673b825eb8 | ||
|
|
7c0e3e8a42 | ||
|
|
3fed540617 | ||
|
|
b092c9244f | ||
|
|
4eb16d16d7 | ||
|
|
5e7cf504fd | ||
|
|
ebc409c1ab | ||
|
|
ad102c9784 | ||
|
|
23ab9042c7 | ||
|
|
1e93bb44a7 | ||
|
|
05e69a161e | ||
|
|
31c3b38273 | ||
|
|
d385a92372 | ||
|
|
f303703535 | ||
|
|
e590ed528d | ||
|
|
87455362bb | ||
|
|
51d0ad7397 | ||
|
|
7193d515a9 | ||
|
|
d0af8926a5 | ||
|
|
833b4d4d0d | ||
|
|
fce42ff00f | ||
|
|
df3d6278c2 | ||
|
|
a041ac5c7a | ||
|
|
a26fdf4b82 | ||
|
|
946c2cc718 | ||
|
|
fcdda5c5c1 | ||
|
|
abda00a8fc | ||
|
|
8f2154011e | ||
|
|
211d1478d5 | ||
|
|
a1e4c2a923 | ||
|
|
08c475b210 | ||
|
|
cb298f94b8 | ||
|
|
db2d99b076 | ||
|
|
f91535f863 | ||
|
|
8676f937c5 | ||
|
|
fa92838811 | ||
|
|
0889233a65 | ||
|
|
fc005bd21c | ||
|
|
9c7104846c | ||
|
|
0c1bfe75d8 | ||
|
|
07be1b0f72 | ||
|
|
2a9e445535 | ||
|
|
3d14e0916d | ||
|
|
5ceb3206bb | ||
|
|
c825e4b301 | ||
|
|
77eb4f3439 | ||
|
|
c6590e6940 | ||
|
|
a63203122e | ||
|
|
cb04e26922 | ||
|
|
66875f5837 | ||
|
|
e925328b5c | ||
|
|
789a083e10 | ||
|
|
fd8d8e3fd8 | ||
|
|
deac8ecb86 | ||
|
|
7485ef4bb4 | ||
|
|
3ab3644d20 | ||
|
|
8a5d0ddf5f | ||
|
|
baf0aa3a0a | ||
|
|
960299f551 | ||
|
|
ded383e7e5 | ||
|
|
829f95d1e4 | ||
|
|
8ba2c2c961 | ||
|
|
d52a9494a8 | ||
|
|
3ff0cf564d | ||
|
|
5e50cc117b | ||
|
|
2992df5b5a | ||
|
|
b37c86dc20 | ||
|
|
d408a4413d | ||
|
|
f6d39212e9 | ||
|
|
e1240ab078 | ||
|
|
ee4b78af1f | ||
|
|
0c343f8c51 | ||
|
|
8ae908a372 | ||
|
|
364fdd5a9a | ||
|
|
ddcdca1972 | ||
|
|
702ce6032c | ||
|
|
e57c5fedba | ||
|
|
091d8a00a7 | ||
|
|
a1f45d1784 | ||
|
|
27c01fccd5 | ||
|
|
97898ac00a | ||
|
|
10b169bbbd | ||
|
|
33444d5bfd | ||
|
|
4bc1a77489 | ||
|
|
3eaef57ed6 | ||
|
|
c833d569c4 | ||
|
|
8966bc4b40 | ||
|
|
384b9f6b4e | ||
|
|
f33d1fd371 | ||
|
|
d524d1607b | ||
|
|
b03844fe0f | ||
|
|
a3902839d9 | ||
|
|
bd78450e96 | ||
|
|
339afcce8a | ||
|
|
d76d572b5a | ||
|
|
37070ed319 | ||
|
|
c5ae175c14 | ||
|
|
6812881a0e | ||
|
|
b17310ba03 | ||
|
|
03568c1065 | ||
|
|
dbedf1803d | ||
|
|
2be995a545 | ||
|
|
379e584b92 | ||
|
|
3635a7c72c | ||
|
|
9699371b8c | ||
|
|
dd19db0171 | ||
|
|
b2795bfed8 | ||
|
|
fbd9ebf114 | ||
|
|
fa04adcb99 | ||
|
|
0e9be6ddc6 | ||
|
|
2af2ec249b | ||
|
|
72c48ee8e7 | ||
|
|
235cb9eb66 | ||
|
|
095504a872 | ||
|
|
0cc6721116 | ||
|
|
2fa35a3162 | ||
|
|
8934624982 | ||
|
|
4ed9a862df | ||
|
|
a2bd5d7922 | ||
|
|
f21bf31eb0 | ||
|
|
96a55c36a5 | ||
|
|
ba3e4b0f20 | ||
|
|
0ae6479a1e | ||
|
|
625d626ffc | ||
|
|
fcd65c543a | ||
|
|
9a1606dbb2 | ||
|
|
2996818b97 | ||
|
|
fa441ace42 | ||
|
|
4736a601af | ||
|
|
f8413c4ccd | ||
|
|
8b5c24895c | ||
|
|
7088cd1bf8 | ||
|
|
f2e4f73f72 | ||
|
|
9aa3de4341 | ||
|
|
f449c5a84e | ||
|
|
96d268d75c | ||
|
|
d4c5628835 | ||
|
|
2860db776d | ||
|
|
faf9dec2f3 | ||
|
|
27d0742fde | ||
|
|
7edacf7a1d | ||
|
|
9cf2df2097 | ||
|
|
96174e85fa | ||
|
|
7fd758d256 | ||
|
|
79ea35270e | ||
|
|
355b4331a7 | ||
|
|
a6fedb424b | ||
|
|
d1401ae1e7 | ||
|
|
95a77014e6 | ||
|
|
2dec274052 | ||
|
|
c5216bcf50 | ||
|
|
b2fdbf4cb4 | ||
|
|
e205358e25 | ||
|
|
676b7edbaf | ||
|
|
9c60acb6ce | ||
|
|
dc7eed33bc | ||
|
|
36886026e8 | ||
|
|
096e767f95 | ||
|
|
b2af9e1427 | ||
|
|
027b873ef5 | ||
|
|
2bd34cf543 | ||
|
|
4d2b17f530 | ||
|
|
65c348f115 | ||
|
|
acbb7712ae | ||
|
|
d2ec18b325 | ||
|
|
e9f9c520c6 | ||
|
|
670fa86718 | ||
|
|
35f21942b9 | ||
|
|
15bf313676 | ||
|
|
c5a5921a54 | ||
|
|
60ee060f62 | ||
|
|
c89e5197d3 | ||
|
|
7f58c1cf8f | ||
|
|
ab01d56e79 | ||
|
|
61f92897ed | ||
|
|
6b79d15f4c | ||
|
|
8e43f2a2e9 | ||
|
|
624b1625b9 | ||
|
|
46b275078b | ||
|
|
371cb2fc61 | ||
|
|
f9888f9161 | ||
|
|
5495555f65 | ||
|
|
09874be8dc | ||
|
|
18470b68ba | ||
|
|
7b59ba0a02 | ||
|
|
68ad4de532 | ||
|
|
3e88623c12 | ||
|
|
d914fa40b4 | ||
|
|
c193c19371 | ||
|
|
85a4bf1d8e | ||
|
|
0c9b70f32b | ||
|
|
e174d58ed7 | ||
|
|
1e9c0a90e0 | ||
|
|
b2169c29b8 | ||
|
|
cb5423e712 | ||
|
|
3baae40304 | ||
|
|
c7dda3e1f6 | ||
|
|
1ba5cdbaf6 | ||
|
|
1a22639c79 | ||
|
|
534006a292 | ||
|
|
310da7ba2f | ||
|
|
043794682b | ||
|
|
90c9d94a64 | ||
|
|
5b4c0b3c70 | ||
|
|
37753945fc | ||
|
|
375440882d | ||
|
|
80a11a7ad3 | ||
|
|
292b375a2f | ||
|
|
0df21a1729 | ||
|
|
a1e72bba1e | ||
|
|
d280b1d9d7 | ||
|
|
45bbaba878 | ||
|
|
c9a7e63cc4 | ||
|
|
3da87a4b64 | ||
|
|
1ccbf85b35 | ||
|
|
3c55c995a0 | ||
|
|
4f7018f975 | ||
|
|
d53851dcae | ||
|
|
64bf413f6a | ||
|
|
32270a048a | ||
|
|
75366daa97 | ||
|
|
6534d0c80b | ||
|
|
f231a9a4cb | ||
|
|
58d8ef8d01 | ||
|
|
86885e81e1 | ||
|
|
3174ee1055 | ||
|
|
e0a0cd6cc0 | ||
|
|
e2b9415d7c | ||
|
|
269ea070e6 | ||
|
|
b8067fe39e | ||
|
|
7d91171fa6 | ||
|
|
4ef71a6086 | ||
|
|
7cc4e877a6 | ||
|
|
eeb0448b81 | ||
|
|
0893400c85 | ||
|
|
991f41cbc8 | ||
|
|
0c1cbba8b5 | ||
|
|
9d63499817 | ||
|
|
4c46192950 | ||
|
|
ed6c90e4cf | ||
|
|
ea5a4dd249 | ||
|
|
787fd14b47 | ||
|
|
3dcdee1044 | ||
|
|
4b6563df51 | ||
|
|
5b6c9575f2 | ||
|
|
4f9ef9b8bd | ||
|
|
1116648212 | ||
|
|
a0557c372e | ||
|
|
19710e6cb7 | ||
|
|
410a4fb3b2 | ||
|
|
7371a0b20f | ||
|
|
cc0c80339a | ||
|
|
c042191a3f | ||
|
|
fa79039824 | ||
|
|
0b0f1e128c | ||
|
|
4c886d1021 | ||
|
|
5c43b2b2c8 | ||
|
|
d4827fc15b | ||
|
|
74d0854e19 | ||
|
|
0924db5b2c | ||
|
|
00f20e06da | ||
|
|
c997567b07 | ||
|
|
32a58be443 | ||
|
|
d48f035ca7 | ||
|
|
4f0ec63e11 | ||
|
|
6303e2d00a | ||
|
|
f1102dda23 | ||
|
|
b49ac588de | ||
|
|
54e5dd6ebc | ||
|
|
5de0a0b637 | ||
|
|
ce29c66aab | ||
|
|
170fe0fc97 | ||
|
|
29ef8e898c | ||
|
|
ebc5ecdc49 | ||
|
|
305a9167c5 | ||
|
|
a2f7523c10 | ||
|
|
24697ab983 | ||
|
|
fac186c4ad | ||
|
|
af87a2f248 | ||
|
|
e1f581ea95 | ||
|
|
4fbdc2fc0f | ||
|
|
6368fd01a7 | ||
|
|
66e8dc8d8a | ||
|
|
5342674ca9 | ||
|
|
26cc387729 | ||
|
|
165ac99ba0 | ||
|
|
59b7239e67 | ||
|
|
48d61a4757 | ||
|
|
5aab0b92f0 | ||
|
|
670211edd8 | ||
|
|
801a4fe99f | ||
|
|
9c8f73a8f0 | ||
|
|
874949f141 | ||
|
|
cd319ad609 | ||
|
|
e5625c0d3e | ||
|
|
eec0c667b8 | ||
|
|
ea9460a146 | ||
|
|
b8038d013a | ||
|
|
ede9d759c2 | ||
|
|
576d6d7c77 | ||
|
|
c58a8bcaff | ||
|
|
da4ee1e1f6 | ||
|
|
1053817440 | ||
|
|
df1d7e2808 | ||
|
|
028413a836 | ||
|
|
f349160857 | ||
|
|
13c504c824 | ||
|
|
08e08e24bc | ||
|
|
a583239a27 | ||
|
|
22f1e69f02 | ||
|
|
8dfb112feb | ||
|
|
71351e6450 | ||
|
|
03650d4867 | ||
|
|
69521dd5d3 | ||
|
|
d5775fb626 | ||
|
|
2d14ac1d51 | ||
|
|
8663961bdf | ||
|
|
2bf496221b | ||
|
|
03a4185f8a | ||
|
|
80cab90674 | ||
|
|
703dbaf64b | ||
|
|
3b7c0794b8 | ||
|
|
75b139baef | ||
|
|
1e27a68010 | ||
|
|
977cf5f42a | ||
|
|
9302e4296a | ||
|
|
5f1a886f61 | ||
|
|
9cd5ff0a00 | ||
|
|
97c2dbe99d | ||
|
|
98f5c9dd3d | ||
|
|
a36609968c | ||
|
|
de72e24a74 | ||
|
|
0e3b3bacd2 | ||
|
|
0dfafd06f9 | ||
|
|
7837f6d907 | ||
|
|
b9f4f0dd71 | ||
|
|
c38de251b2 | ||
|
|
fd744051d3 | ||
|
|
548958d0f3 | ||
|
|
e50f5c55aa | ||
|
|
93491aafd4 | ||
|
|
14d845a06b | ||
|
|
2cece923b1 | ||
|
|
9f4aa852a8 | ||
|
|
5e4c2de737 | ||
|
|
e59ca19d8c | ||
|
|
2731cf4703 | ||
|
|
f00a108a93 | ||
|
|
083a1cde2e | ||
|
|
0469b21d36 | ||
|
|
4be77da55a | ||
|
|
2800b91dc1 | ||
|
|
5f581cabad | ||
|
|
33c5a1f11e | ||
|
|
f10ef42ade | ||
|
|
acee8de036 | ||
|
|
ee6caf9c4b | ||
|
|
be7d2cb72a | ||
|
|
d9884cfb5d | ||
|
|
f05142f51e | ||
|
|
c8ec2db41a | ||
|
|
461f88eff7 | ||
|
|
65123fba41 | ||
|
|
fd364b15d8 | ||
|
|
b27aa3660d | ||
|
|
ae5ca54d8e | ||
|
|
e32442b816 | ||
|
|
0f4ca4981d | ||
|
|
098fef3119 | ||
|
|
af90d9f892 | ||
|
|
9bda7493f4 | ||
|
|
794ecdd8fe | ||
|
|
c8fd58e07d | ||
|
|
decc73730c | ||
|
|
fae2e7b855 | ||
|
|
eccd9eace8 | ||
|
|
6f5c751027 | ||
|
|
adda7082d8 | ||
|
|
2e186fb37f | ||
|
|
07105200e3 | ||
|
|
3e41dda406 | ||
|
|
fd25983668 | ||
|
|
2090593d55 | ||
|
|
9890008f83 | ||
|
|
432b43d3c3 | ||
|
|
be8fdbef0a | ||
|
|
d37dfeba8b | ||
|
|
960b794184 | ||
|
|
4a04416d1c | ||
|
|
ff73238817 | ||
|
|
3575e43cac | ||
|
|
96524babfc | ||
|
|
f5436a0d35 | ||
|
|
7e4a822ff3 | ||
|
|
30665c837b | ||
|
|
a6e63c58b6 | ||
|
|
c8ab09f607 | ||
|
|
ca69d7706b | ||
|
|
707faa1da0 | ||
|
|
27adb1a3dd | ||
|
|
5146b63c51 | ||
|
|
99ec85dde6 | ||
|
|
3ef9d11dac | ||
|
|
1a79a31591 | ||
|
|
6444d665e0 | ||
|
|
d93105b689 | ||
|
|
619c557bb8 | ||
|
|
5384d38dfb | ||
|
|
0a23f60a70 | ||
|
|
1acdae2e33 | ||
|
|
2e6b068ca6 | ||
|
|
1035a9e102 | ||
|
|
2fce3738a3 | ||
|
|
78ef4bb1e9 | ||
|
|
790d1b5169 | ||
|
|
357c97f16c | ||
|
|
dabf25f006 | ||
|
|
f83ebd9b11 | ||
|
|
cb1e2e6d1b | ||
|
|
f33772358f | ||
|
|
703c2a790c | ||
|
|
e3095ab052 | ||
|
|
235d8d73b9 | ||
|
|
b1d1113f0c | ||
|
|
5dd3e36558 | ||
|
|
5bbb86970a | ||
|
|
e8c30ece41 | ||
|
|
6c9f7e2e5a | ||
|
|
61b2630cc5 | ||
|
|
f9ff75cbe9 | ||
|
|
37fc0ea58e | ||
|
|
0a666c164e | ||
|
|
6a11fc957f | ||
|
|
1ae4f4ea6d | ||
|
|
9b655989a1 | ||
|
|
673efb8f58 | ||
|
|
207d783b47 | ||
|
|
6641553dc3 | ||
|
|
155dd50f2c | ||
|
|
c54078e092 | ||
|
|
4a13e77213 | ||
|
|
e0764fbe5f | ||
|
|
f3262603cb | ||
|
|
3329ac2c69 | ||
|
|
37debbfead | ||
|
|
0ef5cf2e12 | ||
|
|
600a352270 | ||
|
|
be13e2553b | ||
|
|
0b1b289d13 | ||
|
|
4db6bc8ecf | ||
|
|
43cbebaa93 | ||
|
|
f94727893d | ||
|
|
97decb4428 | ||
|
|
d5f5758b23 | ||
|
|
d18af846d8 | ||
|
|
08cd384dd1 | ||
|
|
d4910aea39 | ||
|
|
4d14b4476f | ||
|
|
8e9391d518 | ||
|
|
940daaaf96 | ||
|
|
926a21f7f7 | ||
|
|
f68df94d2d | ||
|
|
effd6d2e42 | ||
|
|
bc7c2b9b7f | ||
|
|
47264dd52f | ||
|
|
a63820f27d | ||
|
|
05bc18c52a | ||
|
|
c00e82384c | ||
|
|
b0360066ce | ||
|
|
fd9de297e7 | ||
|
|
eb5213b27e | ||
|
|
a2c3ea44b6 | ||
|
|
6a4a932864 | ||
|
|
f12ac43387 | ||
|
|
a59b46020d | ||
|
|
524c734e45 | ||
|
|
749e23241c | ||
|
|
7ab45e8daf | ||
|
|
e83ea7fda9 | ||
|
|
d16efc8370 | ||
|
|
0e7d8e3aa7 | ||
|
|
b85c0d84be | ||
|
|
79c749bdc4 | ||
|
|
7a173709f0 | ||
|
|
9839e83089 | ||
|
|
f64a7d8528 | ||
|
|
ce44fc9536 | ||
|
|
316974af35 | ||
|
|
0a2523b2dd | ||
|
|
e3787c4fad | ||
|
|
95ede7bfcf | ||
|
|
df991e65d8 | ||
|
|
ab0e727795 | ||
|
|
f51ad105fd | ||
|
|
84d3ab5fed | ||
|
|
b8ea1126db | ||
|
|
e3f81512df | ||
|
|
487a77d691 | ||
|
|
acd55b7659 | ||
|
|
899eba5aeb | ||
|
|
d0ba8eb254 | ||
|
|
3bd3d1f844 | ||
|
|
be65de08fd | ||
|
|
7b70d92069 | ||
|
|
7f477fb28c | ||
|
|
09741f04db | ||
|
|
1879dde6a2 | ||
|
|
d122428a22 | ||
|
|
dc7ba35e40 | ||
|
|
3978244fb9 | ||
|
|
2b8a08c9b5 | ||
|
|
b3e0416c95 | ||
|
|
56d2ac6876 | ||
|
|
f58ecefe9c | ||
|
|
083638a290 | ||
|
|
945421d42b | ||
|
|
e6ec89614f | ||
|
|
9aa1113404 | ||
|
|
dcf2c6f2e5 | ||
|
|
60b3be1f25 | ||
|
|
00718839e9 | ||
|
|
56c4488d91 | ||
|
|
01482d75cd | ||
|
|
12f4dc268d | ||
|
|
4976522161 | ||
|
|
597f34602d | ||
|
|
b51b0d7c27 | ||
|
|
9f17430e7d | ||
|
|
880faef485 | ||
|
|
1951c45fdc | ||
|
|
4da4d679ba | ||
|
|
d24bd9dd79 | ||
|
|
1f71ff8d50 | ||
|
|
ab292e4f1f | ||
|
|
412eeea36e | ||
|
|
88bfa91fc7 | ||
|
|
ee73733d3d | ||
|
|
b14fdd35be | ||
|
|
8d39c56892 | ||
|
|
f6e2a8018e | ||
|
|
b4619d97c0 | ||
|
|
5e9608e856 | ||
|
|
805c0c11fe | ||
|
|
4e8378e763 | ||
|
|
30c6b13d46 | ||
|
|
bf5c14847f | ||
|
|
c94584a65c | ||
|
|
d255662ca7 | ||
|
|
085c38b8da | ||
|
|
62f6105055 | ||
|
|
48bf15ab91 | ||
|
|
f7228ec994 | ||
|
|
0313ed9738 | ||
|
|
e9e59c0d21 | ||
|
|
b009dc03b9 | ||
|
|
721630353d | ||
|
|
82e2a967df | ||
|
|
478c828145 | ||
|
|
017f957fd9 | ||
|
|
47f15d590e | ||
|
|
e91f284c07 | ||
|
|
1e09258230 | ||
|
|
13ab6269f3 | ||
|
|
9ccfea39c4 | ||
|
|
ec57ec873f | ||
|
|
84520b1e14 | ||
|
|
3dfae5bbcc | ||
|
|
66bab5f6e3 | ||
|
|
74ee817188 | ||
|
|
4a957a219e | ||
|
|
5972d1e077 | ||
|
|
398c6180db | ||
|
|
6ccfd64676 | ||
|
|
36f7e20539 | ||
|
|
1da5e3d647 | ||
|
|
80eeefb723 | ||
|
|
0d1e317729 | ||
|
|
893cbad07f | ||
|
|
643dadcdd9 | ||
|
|
5d5cae5864 | ||
|
|
1b75d96c5b | ||
|
|
abe537bdde | ||
|
|
e6d847b909 | ||
|
|
945bcf681b | ||
|
|
b2fd1329a0 | ||
|
|
d2915d16d3 | ||
|
|
74d39bb1c3 | ||
|
|
2b5363b7aa | ||
|
|
11e411188f | ||
|
|
ca24c529bd | ||
|
|
ad82769079 | ||
|
|
806d734feb | ||
|
|
d395298e0c | ||
|
|
f46a950880 | ||
|
|
1fa43367bb | ||
|
|
f75d1182a7 | ||
|
|
5f78913337 | ||
|
|
7a9d406987 | ||
|
|
e60a1e46d7 | ||
|
|
3036e8de9b | ||
|
|
e499b1961f | ||
|
|
01519f58e2 | ||
|
|
5bebf0d77c | ||
|
|
35bd6ce005 | ||
|
|
379ca7eb4c | ||
|
|
1d6003277f | ||
|
|
f754335315 | ||
|
|
eac34daff7 | ||
|
|
364c12bc93 | ||
|
|
67291a1077 | ||
|
|
c205e2c04f | ||
|
|
9a6a29a0d6 | ||
|
|
ab4eb80a11 | ||
|
|
573ba69ecb | ||
|
|
3988762858 | ||
|
|
bfed4e7c20 | ||
|
|
bd4ca2a390 | ||
|
|
4142754bd1 | ||
|
|
a07fcab347 | ||
|
|
6b92d49bdd | ||
|
|
9a912de0e1 | ||
|
|
7cfbf3a67b | ||
|
|
b2cf1d8151 | ||
|
|
80267e4ba2 | ||
|
|
cb161038ce | ||
|
|
b391703d98 | ||
|
|
5d3d453ac9 | ||
|
|
8692499e59 | ||
|
|
710fcc50d3 | ||
|
|
df6c9ce263 | ||
|
|
0d4e9108ca | ||
|
|
d31e7abbb9 | ||
|
|
70532e1168 | ||
|
|
8b7bd111f2 | ||
|
|
cd164e97a2 | ||
|
|
c535541682 | ||
|
|
dd4e2d038c | ||
|
|
3b2bec70bf | ||
|
|
6162d39233 | ||
|
|
45da16b306 | ||
|
|
4e4edd0356 | ||
|
|
5cbea0f1ec | ||
|
|
00ff5052ca | ||
|
|
e2f5596ea3 | ||
|
|
9e24003c5f | ||
|
|
6f65f2d4a4 | ||
|
|
ce012b2b13 | ||
|
|
1233cd2b49 | ||
|
|
1f7957bbc7 | ||
|
|
b90594694b | ||
|
|
f612d438db | ||
|
|
8ff2b3b1c1 | ||
|
|
6699b1d614 | ||
|
|
fc04cf4c17 | ||
|
|
60324c45d1 | ||
|
|
18455df1c3 | ||
|
|
6fdc3ffa9b | ||
|
|
ba3bb11729 | ||
|
|
e30a6edff3 | ||
|
|
1526cec953 | ||
|
|
b2c830690b | ||
|
|
68aa1c80e5 | ||
|
|
ca60bedc58 | ||
|
|
b0dcd370b5 | ||
|
|
76dd281f0d | ||
|
|
3c1a4df051 | ||
|
|
f7a4362c56 | ||
|
|
22b9fa451c | ||
|
|
33b3b49288 | ||
|
|
98bb5b3314 | ||
|
|
e59d48cff3 | ||
|
|
9891fe14e6 | ||
|
|
2c76c26721 | ||
|
|
29ca4c23bc | ||
|
|
5df9635701 | ||
|
|
75a123b2ee | ||
|
|
079c005617 | ||
|
|
c5c06de4da | ||
|
|
b7ecf11083 | ||
|
|
19cc41ca68 | ||
|
|
79ee413eec | ||
|
|
56cf68426e | ||
|
|
4787cd5e13 | ||
|
|
f43ae4b0c5 | ||
|
|
5ab6658ab9 | ||
|
|
c4aee0da62 | ||
|
|
d85b082391 | ||
|
|
c160aeabf3 | ||
|
|
6eda94e535 | ||
|
|
7e4963637d | ||
|
|
f34c34a981 | ||
|
|
007b84bbfd | ||
|
|
20f0db9efd | ||
|
|
f728c86270 | ||
|
|
63994c899a | ||
|
|
ae979782da | ||
|
|
90bdf55344 | ||
|
|
2fbb1fb4e3 | ||
|
|
c5978ee653 | ||
|
|
c38f24f3ea | ||
|
|
179ced1243 | ||
|
|
871c405242 | ||
|
|
f22ae68dd3 | ||
|
|
b83bfcbe59 | ||
|
|
84e66af259 | ||
|
|
e6668b4d31 | ||
|
|
1f196c9975 | ||
|
|
48eb596de2 | ||
|
|
1251e59880 | ||
|
|
5f6247537d | ||
|
|
21ab169b68 | ||
|
|
3bc78537e4 | ||
|
|
9134079406 | ||
|
|
c05663e5e2 | ||
|
|
f5ead3cd95 | ||
|
|
24c5daca8b | ||
|
|
6f6b9113b2 | ||
|
|
c96dd9f540 | ||
|
|
52bbc59b7a | ||
|
|
04d75799be | ||
|
|
66937619db | ||
|
|
3508578f08 | ||
|
|
a5014bac8a | ||
|
|
300670690c | ||
|
|
51d1cbe590 | ||
|
|
9aefa78dcf | ||
|
|
23d0d3db3e | ||
|
|
d7bec35ca1 | ||
|
|
507d2da35b | ||
|
|
0d9cf334b3 | ||
|
|
13fddb6878 | ||
|
|
bcaa3d5f38 | ||
|
|
98ade06c5b | ||
|
|
d50a34f2fd | ||
|
|
d8bb0d8931 | ||
|
|
dddd29e31e | ||
|
|
8e4dd72da3 | ||
|
|
eb1e6bf0e7 | ||
|
|
42499e9b83 | ||
|
|
6a035fcddd | ||
|
|
690b22651d | ||
|
|
80407d0f85 | ||
|
|
20c3192308 | ||
|
|
7596fd3263 | ||
|
|
472fb332e1 | ||
|
|
5c218817b7 | ||
|
|
1c552d6363 | ||
|
|
cb866264fe | ||
|
|
ec7f04f5af | ||
|
|
f32aa4dbc4 | ||
|
|
0a8c73f0d4 | ||
|
|
0b2e2bfba2 | ||
|
|
c94ad1b7db | ||
|
|
267eedb001 | ||
|
|
97776ae093 | ||
|
|
956c5cc6d3 | ||
|
|
112e8ce552 | ||
|
|
d4278a7540 | ||
|
|
60d83beb96 | ||
|
|
acd10c909d | ||
|
|
1349b5dad4 | ||
|
|
19818eaa54 | ||
|
|
258ebe22f8 | ||
|
|
d772b13a57 | ||
|
|
46890c5cbc | ||
|
|
9411c96bdb | ||
|
|
be7acaf4cc | ||
|
|
ddacee16d3 | ||
|
|
dca0459b34 | ||
|
|
d7fc61cd9f | ||
|
|
2f31f19df9 | ||
|
|
2f00dc90ae | ||
|
|
3a37b73eab | ||
|
|
cf3bd77d9a | ||
|
|
a601a24765 | ||
|
|
3ac487b083 | ||
|
|
158674028d | ||
|
|
9b03fc96d8 | ||
|
|
15091c910a | ||
|
|
94c1fefbf7 | ||
|
|
8f39f603ba | ||
|
|
ee22698539 | ||
|
|
4b61fe58b7 | ||
|
|
dbfc00c76b | ||
|
|
89939dd7cf | ||
|
|
00b7524089 | ||
|
|
1a83a8188e | ||
|
|
278d9ea66b | ||
|
|
3871597854 | ||
|
|
5563943e5f | ||
|
|
e6a648cfbb | ||
|
|
8d39996f66 | ||
|
|
258092bcc8 | ||
|
|
a51dd18872 | ||
|
|
c1fb9ff172 | ||
|
|
e26583188c | ||
|
|
24be925378 | ||
|
|
5e8db0c547 | ||
|
|
2f78fa6120 | ||
|
|
07f0f22025 | ||
|
|
6664310c68 | ||
|
|
1c6fa36f87 | ||
|
|
cb6bce4173 | ||
|
|
6889802b50 | ||
|
|
cdf3de1d74 | ||
|
|
d70c988f51 | ||
|
|
0253b1eaae | ||
|
|
e8cfa7c5f6 | ||
|
|
d9299c4bc3 | ||
|
|
0633ab1c2c | ||
|
|
fcf0688ef4 | ||
|
|
b210c96897 | ||
|
|
67b0db3421 | ||
|
|
470dc11aeb | ||
|
|
6a859655b7 | ||
|
|
1e8dc1e3ef | ||
|
|
7f2b8d7b47 | ||
|
|
385307e652 | ||
|
|
988b3249e7 | ||
|
|
11e28ad143 | ||
|
|
99bd896fa0 | ||
|
|
c628c8cd1b | ||
|
|
8ed02f441f | ||
|
|
d3645a1bfe | ||
|
|
3a36261f69 | ||
|
|
ebe82f4efa | ||
|
|
948bd64f89 | ||
|
|
1f1446c5c0 | ||
|
|
50f9a9a376 | ||
|
|
f2d7b0374e | ||
|
|
83a10ea91b | ||
|
|
8614dc57ef | ||
|
|
7c65187c2c | ||
|
|
8d123f458f | ||
|
|
9960aaa2c8 | ||
|
|
99a0e147a7 | ||
|
|
57a8f70d4a | ||
|
|
9d48623d92 | ||
|
|
92718fbc7a | ||
|
|
1b883a7490 | ||
|
|
9e1cfc5c91 | ||
|
|
f4e5ac31fd | ||
|
|
889cd2c4ee | ||
|
|
fa993668ad | ||
|
|
89ebff9f1d | ||
|
|
454c2668e4 | ||
|
|
9efc8f2d20 | ||
|
|
ccd26fd185 | ||
|
|
08232e396c | ||
|
|
01c436eec4 | ||
|
|
5ff860d1ed | ||
|
|
027be789af | ||
|
|
2f19536421 | ||
|
|
98a28c9e2a | ||
|
|
a205f6095c | ||
|
|
8617faa87d | ||
|
|
7a086b6be2 | ||
|
|
50eff29c49 | ||
|
|
f8676b45aa | ||
|
|
38dc406a7a | ||
|
|
5ae447c613 | ||
|
|
0cd8e589cd | ||
|
|
46181410db | ||
|
|
69f1a7cd81 | ||
|
|
d5470d4135 | ||
|
|
6c2994b241 | ||
|
|
f20f741178 | ||
|
|
c748d4c465 | ||
|
|
25cc8d7a58 | ||
|
|
c223c01e28 | ||
|
|
353a25c88b | ||
|
|
6682fb1f77 | ||
|
|
2da2a6b0be | ||
|
|
dff8540b44 | ||
|
|
3ced68e7e0 | ||
|
|
3a77323683 | ||
|
|
85b58cc95c | ||
|
|
f9e9448302 | ||
|
|
19f31fcbcc | ||
|
|
79891cd010 | ||
|
|
fe2a1595ea | ||
|
|
8b20cf85fe | ||
|
|
832f79717f | ||
|
|
0274bad32b | ||
|
|
7ff0256293 | ||
|
|
9548d7fa85 | ||
|
|
49dab3ddd5 | ||
|
|
b2c0217a0d | ||
|
|
9cce639e0f | ||
|
|
6bb837e2c4 | ||
|
|
815fec0d73 | ||
|
|
caaefbe34c | ||
|
|
8958bcd8cf | ||
|
|
2ffd2f09f2 | ||
|
|
b46cc4ba4e | ||
|
|
d6a5085f59 | ||
|
|
0361354890 | ||
|
|
1a87d7d7dd | ||
|
|
8c6bdeb1ec | ||
|
|
7713fd6b6f | ||
|
|
d76f273118 | ||
|
|
c65c79999a | ||
|
|
4b0b77a0c9 | ||
|
|
c9a9695069 | ||
|
|
b08e800049 | ||
|
|
321e169adc | ||
|
|
3dcda91510 | ||
|
|
ee38fcff5b | ||
|
|
16cfb5cf86 | ||
|
|
6194e95652 | ||
|
|
6db73b0c2f | ||
|
|
cb24b1f1fe | ||
|
|
e20e8e5984 | ||
|
|
12ec3a1363 | ||
|
|
01c604354d | ||
|
|
3684b77c63 | ||
|
|
1b02f0725a | ||
|
|
79356ae82f | ||
|
|
6d1d7ec1c1 | ||
|
|
06e22f12e4 | ||
|
|
4d5db2152f | ||
|
|
f89af1a7e9 | ||
|
|
4e7fb0aec6 | ||
|
|
3fc6324194 | ||
|
|
7fc8c43a91 | ||
|
|
9afca0ed2a | ||
|
|
fb53d28fc5 | ||
|
|
26ba65da07 | ||
|
|
af4c5fbd21 | ||
|
|
1c1dcf2f12 | ||
|
|
c573d2cb71 | ||
|
|
1802c20620 | ||
|
|
4937d5428b | ||
|
|
9550ddb630 | ||
|
|
beddf1b292 | ||
|
|
58cccc3007 | ||
|
|
4b03faa1f0 | ||
|
|
6dec70fa04 | ||
|
|
3c1f2845cf | ||
|
|
a4dfd75157 | ||
|
|
7b8f33117c | ||
|
|
916537dfc0 | ||
|
|
4d86812d65 | ||
|
|
b12e89b24d | ||
|
|
b640a2b8c0 | ||
|
|
885e33e28f | ||
|
|
277242d161 | ||
|
|
9107865e01 | ||
|
|
f1f818e7b2 | ||
|
|
0b66f57ffd | ||
|
|
547ec63ddd | ||
|
|
149c69bfab | ||
|
|
c7cea5143a | ||
|
|
ca135be1b8 | ||
|
|
237db9ae1f | ||
|
|
4f6f070c86 | ||
|
|
f246e3117a | ||
|
|
7fcad9f549 | ||
|
|
6641976fe2 | ||
|
|
85096b6ed2 | ||
|
|
193de92ed8 | ||
|
|
95d4a15403 | ||
|
|
24479f8d35 | ||
|
|
a668e85215 | ||
|
|
6cbdf7e1f3 | ||
|
|
76b836910f | ||
|
|
b615a240fb | ||
|
|
ffe5330693 | ||
|
|
91f5fd0864 | ||
|
|
3f8f8174e9 | ||
|
|
5d76377adf | ||
|
|
e012c791a4 | ||
|
|
a0c9344277 | ||
|
|
4b222256c0 | ||
|
|
7ee6a57d1a | ||
|
|
7440ed82c0 | ||
|
|
cb97dd5de6 | ||
|
|
dd964b43c8 | ||
|
|
77936fd6a9 | ||
|
|
0712c2788d | ||
|
|
c8c059d33e | ||
|
|
3b381afeb1 | ||
|
|
1623d393fc | ||
|
|
0023fc15ec | ||
|
|
fb32eba0f8 | ||
|
|
b1a0eb3163 | ||
|
|
b19eee5b4b | ||
|
|
b055d2520d | ||
|
|
d5a8d19eb1 | ||
|
|
dc7a687c9d | ||
|
|
647eb1d958 | ||
|
|
d2b59b1bfa | ||
|
|
401de7180c | ||
|
|
41ecacbee9 | ||
|
|
df698d7c1c | ||
|
|
3e18f440b4 | ||
|
|
605e70727b | ||
|
|
3e325f9930 | ||
|
|
cfc04998c0 | ||
|
|
2ffa9f9553 | ||
|
|
3ef07d3bdc | ||
|
|
0c07a9e0b5 | ||
|
|
e056d8845f | ||
|
|
a2cae97390 | ||
|
|
ee072a8d45 | ||
|
|
7df195b4a9 | ||
|
|
f7bd2c0d45 | ||
|
|
dda3c38f63 | ||
|
|
8593007767 | ||
|
|
c62da8b2cb | ||
|
|
8e813bd41d | ||
|
|
a59efb63f6 | ||
|
|
135dbd204b | ||
|
|
aaea1a6f10 | ||
|
|
01b182a941 | ||
|
|
d33a6174ce | ||
|
|
900fbb5b81 | ||
|
|
66ff7d6ede | ||
|
|
c26752a8aa | ||
|
|
09c884c8aa | ||
|
|
2a038800f6 | ||
|
|
04932fcd30 | ||
|
|
419fe98bf5 | ||
|
|
366dbd219b | ||
|
|
982b3ff51a | ||
|
|
cf0eb7b62e | ||
|
|
fd697cbe2a | ||
|
|
974dbf9b53 | ||
|
|
9a46a4c943 | ||
|
|
aa9093858b | ||
|
|
1e15924c47 | ||
|
|
811c8829eb | ||
|
|
19d72edc18 | ||
|
|
50650d1c8c | ||
|
|
06bff9b9a8 | ||
|
|
ae52a34706 | ||
|
|
80a9fb0776 | ||
|
|
f5878ed8e4 | ||
|
|
b746e6d1ee | ||
|
|
8634509e0c | ||
|
|
1b0340eba8 | ||
|
|
650287af74 | ||
|
|
d5819916cd | ||
|
|
e4c4c9d8ea | ||
|
|
cbaa5243df | ||
|
|
3e6b9cfd1e | ||
|
|
939ab6d0cd | ||
|
|
936d8ad703 | ||
|
|
b69286f58e | ||
|
|
18342c47bf | ||
|
|
f1674f9cf6 | ||
|
|
9999c1cab2 | ||
|
|
ca814679f8 | ||
|
|
c7a22ef7de | ||
|
|
d0bdba0970 | ||
|
|
f9d634c294 | ||
|
|
b06d843c95 | ||
|
|
b0a2e83b0f | ||
|
|
9625211c9b | ||
|
|
1d86b393e9 | ||
|
|
35b37a84cb | ||
|
|
70f16066f3 | ||
|
|
b45ff08c16 | ||
|
|
f85ee98763 | ||
|
|
31a11f15b7 | ||
|
|
81140e2096 | ||
|
|
ce83955a74 | ||
|
|
e17a2e3b4f | ||
|
|
be5365a85d | ||
|
|
ec955224ea | ||
|
|
ca27edb003 | ||
|
|
3737c2cea4 | ||
|
|
a897eb02c6 | ||
|
|
dd71b22d20 | ||
|
|
ed1703e7ca | ||
|
|
b51c2b461b | ||
|
|
db78d2ea89 | ||
|
|
98f422ca3b | ||
|
|
87c3c0147a | ||
|
|
d64a49c1df | ||
|
|
64d873eedf | ||
|
|
22930c0928 | ||
|
|
a425bde170 | ||
|
|
d381cc106d | ||
|
|
92220dd477 | ||
|
|
b9c5d267b1 | ||
|
|
3baa7920d4 | ||
|
|
ee128013bb | ||
|
|
4e2026137a | ||
|
|
1b772da460 | ||
|
|
98f969bf7a | ||
|
|
4d3133bdbb | ||
|
|
1e0b972df8 | ||
|
|
e24ccd1b45 | ||
|
|
65ea939186 | ||
|
|
402b6ec1bc | ||
|
|
d107e8051d | ||
|
|
13492021b8 | ||
|
|
9419e22aa4 | ||
|
|
9a7378369c | ||
|
|
a0b7918004 | ||
|
|
0a6cd2c879 | ||
|
|
8f2fcbc3a4 | ||
|
|
26fdda6dbd | ||
|
|
cf5063c014 | ||
|
|
84f3dca4a1 | ||
|
|
00ad4c7a11 | ||
|
|
1802215d17 | ||
|
|
0fdc9e7968 | ||
|
|
18145e4022 | ||
|
|
21d86e6a91 | ||
|
|
9448a26899 | ||
|
|
f80cb9fa1c | ||
|
|
97891adcdc | ||
|
|
2ec8c99af4 | ||
|
|
97751ac24a | ||
|
|
944561658d | ||
|
|
becdf77adc | ||
|
|
8a4d2c923f | ||
|
|
9618cf9f73 | ||
|
|
56c03db38d | ||
|
|
d2ab8961fb | ||
|
|
b6adda0c36 | ||
|
|
426d480a11 | ||
|
|
f253a6fb30 | ||
|
|
b04efd48dc | ||
|
|
64d0c89c72 | ||
|
|
77e79d58e6 | ||
|
|
42ec731119 | ||
|
|
50ba5df259 | ||
|
|
181faf3bd7 | ||
|
|
acdf911ecc | ||
|
|
b381e908c8 | ||
|
|
925034f981 | ||
|
|
c8ae23014e | ||
|
|
4b6b00ac86 | ||
|
|
3a39ddc0f6 | ||
|
|
2bc8f51851 | ||
|
|
3af53581db | ||
|
|
d015b67976 | ||
|
|
ea0acaeb35 | ||
|
|
04c3551b99 | ||
|
|
df811fb275 | ||
|
|
d7f29bdcb2 | ||
|
|
216603b4f9 | ||
|
|
2ff2fbf5d7 | ||
|
|
f180303d1c | ||
|
|
51ebcfae81 | ||
|
|
781dc0721c | ||
|
|
211b9e9e06 | ||
|
|
a02386ecfe | ||
|
|
932ac26445 | ||
|
|
5a1c144232 | ||
|
|
249dbc3f77 | ||
|
|
81f5bef64b | ||
|
|
69a43fa2f3 | ||
|
|
a789f70484 | ||
|
|
57b368b683 | ||
|
|
4fb36ff503 | ||
|
|
0c2d63e0ac | ||
|
|
28aa049ef4 | ||
|
|
fba15c8b5c | ||
|
|
347d62dac2 | ||
|
|
11f34a8a99 | ||
|
|
8b491be57d | ||
|
|
7fd861cb1e | ||
|
|
9b9a44bb59 | ||
|
|
859118e1e7 | ||
|
|
1bbcfffa12 | ||
|
|
834b70d5a4 | ||
|
|
c57d3140d2 | ||
|
|
11f0eed269 | ||
|
|
9599105569 | ||
|
|
e569f50828 | ||
|
|
e999a4d03d | ||
|
|
3fa6083a4b | ||
|
|
4b5eccd041 | ||
|
|
47ea1b3168 | ||
|
|
7ba49b2604 | ||
|
|
7bd437338f | ||
|
|
bdbcec5a14 | ||
|
|
249a6de092 | ||
|
|
c977b554c1 | ||
|
|
408d68e175 | ||
|
|
c2c56781d3 | ||
|
|
8014626c2a | ||
|
|
def03bf7d8 | ||
|
|
27d304bd81 | ||
|
|
e66c5bc47e | ||
|
|
d218178e48 | ||
|
|
44b879f5f9 | ||
|
|
39294e692f | ||
|
|
6ff27d1704 | ||
|
|
4e782b81d6 | ||
|
|
5519426ab4 | ||
|
|
07059872ed | ||
|
|
ee35562351 | ||
|
|
8ac1169f7d | ||
|
|
c14e26a9fe | ||
|
|
da632d4a64 | ||
|
|
521fe96ab9 | ||
|
|
1c93f033dd | ||
|
|
66bb35d84e | ||
|
|
6e4af8f9ef | ||
|
|
98b2973669 | ||
|
|
16f36b3214 | ||
|
|
c59da5af63 | ||
|
|
b589837c36 | ||
|
|
59abb71e8d | ||
|
|
ade8d4eb9b | ||
|
|
fa6a076134 | ||
|
|
f4497fe28c | ||
|
|
5fd97d3fa6 | ||
|
|
8438f797d6 | ||
|
|
fdb78f4840 | ||
|
|
b4d51fcaf1 | ||
|
|
99b03d485a | ||
|
|
53e4f83029 | ||
|
|
262cc9fee9 | ||
|
|
2235f77acb | ||
|
|
7caf3a0d8d | ||
|
|
56363996dc | ||
|
|
53474f0052 | ||
|
|
3a74534d1e | ||
|
|
fcde2067d7 | ||
|
|
6fe92d260e | ||
|
|
ae831eebbd | ||
|
|
9eaca4775c | ||
|
|
db82d4760a | ||
|
|
8cc4137107 | ||
|
|
70678e51c5 | ||
|
|
4beb425ccc | ||
|
|
a0a9b67f0b | ||
|
|
a71f1d8139 | ||
|
|
5a6a640ccf | ||
|
|
e21ae440a2 | ||
|
|
d2451ab377 | ||
|
|
04b9e26796 | ||
|
|
30174b3861 | ||
|
|
842c76a7d8 | ||
|
|
71d7ab5672 | ||
|
|
c6098dc024 | ||
|
|
52b18e6064 | ||
|
|
d954257870 | ||
|
|
76ddf94cce | ||
|
|
03f9f9fb23 | ||
|
|
291017d32e | ||
|
|
2432b6feec | ||
|
|
57dd64effc | ||
|
|
6b057a5a6f | ||
|
|
7b7a4a7272 | ||
|
|
339d983050 | ||
|
|
dc85c6215a | ||
|
|
23010dac73 | ||
|
|
cd9ff1227d | ||
|
|
24382e5d23 | ||
|
|
5d0515728a | ||
|
|
305bc175bb | ||
|
|
f96eb40bf7 | ||
|
|
0bf18bbb3f | ||
|
|
83553be199 | ||
|
|
309940c73a | ||
|
|
60234ccd69 | ||
|
|
cdc04e7950 | ||
|
|
8387c638d1 | ||
|
|
c2d6d384ac | ||
|
|
fa0681c866 | ||
|
|
c7ebcef4d4 | ||
|
|
ef9d8902e3 | ||
|
|
18a51edf87 | ||
|
|
3a76a700a6 | ||
|
|
ea8ad29eb1 | ||
|
|
38a75aef05 | ||
|
|
988e7f0910 | ||
|
|
22ed156185 | ||
|
|
1e954a0eb9 | ||
|
|
2737ca110b | ||
|
|
af38e451ca | ||
|
|
ed972f200e | ||
|
|
472f8e89e0 | ||
|
|
34f869e5a6 | ||
|
|
7e9317d62f | ||
|
|
41e60bda96 | ||
|
|
5496f01530 | ||
|
|
180ab14492 | ||
|
|
f65c64acc8 | ||
|
|
c5aae001d3 | ||
|
|
40540c9906 | ||
|
|
9db8626bec | ||
|
|
0b5c1fde5d | ||
|
|
49cf8002b0 | ||
|
|
2ba26ff77e | ||
|
|
4ae550620f | ||
|
|
eea05f7032 | ||
|
|
427aeef7f4 | ||
|
|
b8528da324 | ||
|
|
6f46994948 | ||
|
|
239252e24c | ||
|
|
f3a612144b | ||
|
|
446bf56c98 | ||
|
|
7dbeeb5ef9 | ||
|
|
b59f150b13 | ||
|
|
e3a59ff1a2 | ||
|
|
79ad23cedf | ||
|
|
373d464054 | ||
|
|
9170fd690c | ||
|
|
18d9ecdf4d | ||
|
|
a4f6a739c5 | ||
|
|
726f3f8782 | ||
|
|
5d1ef109ba | ||
|
|
42ac3bd5b6 | ||
|
|
e580c2846e | ||
|
|
dffd10acd1 | ||
|
|
eb70f6669f | ||
|
|
36e4ee9653 | ||
|
|
243f50cdbe | ||
|
|
cd5bf676bb | ||
|
|
ef7d2685b5 | ||
|
|
fbd30c39f0 | ||
|
|
6f35ba2164 | ||
|
|
a43ebb6483 | ||
|
|
7d6bfdff63 | ||
|
|
733b961ac8 | ||
|
|
66724a85ba | ||
|
|
7ddaabe3a7 | ||
|
|
2312878c11 | ||
|
|
ef7ce67487 | ||
|
|
9832004ca6 | ||
|
|
e80f9ad023 | ||
|
|
814597b3de | ||
|
|
be22922918 | ||
|
|
4ba8e33bb7 | ||
|
|
9bef1f22ae | ||
|
|
1b6dcf5018 | ||
|
|
1f0f18e8c2 | ||
|
|
890af5afbd | ||
|
|
9d27388bf5 | ||
|
|
10133bbe45 | ||
|
|
f1fc4db8d7 | ||
|
|
956232ee80 | ||
|
|
94fed2f8e2 | ||
|
|
900fabe064 | ||
|
|
3dad9bdc84 | ||
|
|
3110f31278 | ||
|
|
b4b9fafa12 | ||
|
|
f2aea9aa2d | ||
|
|
b34a14698c | ||
|
|
05ab551aaa | ||
|
|
0986087710 | ||
|
|
a8162e1fc7 | ||
|
|
84902e3275 | ||
|
|
a06fe2c0dd | ||
|
|
61a3b41d8e | ||
|
|
082458bdf4 | ||
|
|
d33e9bb674 | ||
|
|
ea9a76f945 | ||
|
|
7e335082e8 | ||
|
|
49a193f463 | ||
|
|
1d91508c07 | ||
|
|
6aec39bd43 | ||
|
|
8d014ff76f | ||
|
|
24361e37cd | ||
|
|
296b63f0bb | ||
|
|
c07154c16f | ||
|
|
af3e54fb9b | ||
|
|
492510dc1d | ||
|
|
8b6acf11bf | ||
|
|
2b18562cef | ||
|
|
8767c19e77 | ||
|
|
c84a6e8537 | ||
|
|
ef89ea408e | ||
|
|
69eb9f161b | ||
|
|
9c1144dc6e | ||
|
|
950647ee49 | ||
|
|
fc6b608300 | ||
|
|
d031c90460 | ||
|
|
395cdccbc3 | ||
|
|
d3d84733cc | ||
|
|
803e0c410c | ||
|
|
5fe263329f | ||
|
|
739ca68f58 | ||
|
|
64766df633 | ||
|
|
1d259e42d0 | ||
|
|
9f35477262 | ||
|
|
4a15ef3410 | ||
|
|
89ffbef934 | ||
|
|
f92f31446c | ||
|
|
9f84532f3d | ||
|
|
cfa3919dd6 | ||
|
|
95ce9ec627 | ||
|
|
468ba6a0cf | ||
|
|
35b1cacfc2 | ||
|
|
25fb517e11 | ||
|
|
daf3b10e15 | ||
|
|
292c4c2b71 | ||
|
|
994e74cae7 | ||
|
|
ad0b74d152 | ||
|
|
05ab3bc006 | ||
|
|
e86bfb00bf | ||
|
|
dd74f3be20 | ||
|
|
6508012101 | ||
|
|
e1011d65aa | ||
|
|
7b005bc2cf | ||
|
|
a571f02ae9 | ||
|
|
323df73f79 | ||
|
|
9b3f9f9d23 | ||
|
|
33ef11a21c | ||
|
|
fc8d25213f | ||
|
|
ca6d8ba520 | ||
|
|
368b06d0cc | ||
|
|
b8e55de858 | ||
|
|
6ba9a4981b | ||
|
|
2aeb98c903 | ||
|
|
3d715677e9 | ||
|
|
133311baf8 | ||
|
|
bf6927a2a4 | ||
|
|
abd33d952d | ||
|
|
8eb9c566cd | ||
|
|
f84e544410 | ||
|
|
83e78717d9 | ||
|
|
7d19d006e0 | ||
|
|
5f305456c1 | ||
|
|
9174999138 | ||
|
|
64256b2b61 | ||
|
|
b4aa285938 | ||
|
|
13cf4874d5 | ||
|
|
67dce0cfb1 | ||
|
|
2649b2980f | ||
|
|
6ba2c43dce | ||
|
|
2e0179c943 | ||
|
|
1aefdcf63f | ||
|
|
a3df910d26 | ||
|
|
174d1b2ffd | ||
|
|
f69fdb1aec | ||
|
|
4859c3f41a | ||
|
|
345b57f041 | ||
|
|
c724a8ef4b | ||
|
|
fa6900cdad | ||
|
|
2e89af4b08 | ||
|
|
f43350eb49 | ||
|
|
9f11bbe8cc | ||
|
|
4174f88609 | ||
|
|
c543c71121 | ||
|
|
53318941d5 | ||
|
|
bea7127b57 | ||
|
|
b84c7b45fa | ||
|
|
ba14699cdd | ||
|
|
77a57f11b6 | ||
|
|
1d1db39246 | ||
|
|
f5e4efb177 | ||
|
|
a27c99e830 | ||
|
|
773f5dbf54 | ||
|
|
a7cd6099cd | ||
|
|
f0c4854988 | ||
|
|
42981e777b | ||
|
|
133ae04eae | ||
|
|
3e044b9cd2 | ||
|
|
6ae4bf74e6 | ||
|
|
7f37e1cc1b | ||
|
|
da0e16aeae | ||
|
|
4e86fbc278 | ||
|
|
30f6f5db1a | ||
|
|
ca6d66dfbe | ||
|
|
1d7cc71d41 | ||
|
|
82ce19e7f7 | ||
|
|
baa996e88c | ||
|
|
144c1ce875 | ||
|
|
fcbd98b397 | ||
|
|
62ec62189f | ||
|
|
b85bbf44ef | ||
|
|
dc32ee6b17 | ||
|
|
cf5bd0e193 | ||
|
|
bec0cde3ee | ||
|
|
b42e6a8457 | ||
|
|
2bacaceb15 | ||
|
|
a6a37b1d25 | ||
|
|
951d8949f7 | ||
|
|
6c31961b64 | ||
|
|
5076ef03f5 | ||
|
|
01cdf927e8 | ||
|
|
c415de0dcb | ||
|
|
1a3881cf7d | ||
|
|
4981161e36 | ||
|
|
465d554d62 | ||
|
|
cb3aa7d868 | ||
|
|
34cb44acbc | ||
|
|
91f739386d | ||
|
|
b5d0671483 | ||
|
|
c4c3da74b7 | ||
|
|
aa2dacad70 | ||
|
|
b82abe0bdc | ||
|
|
ddb6f2dc54 | ||
|
|
271bdffbb9 | ||
|
|
abd0d10a02 | ||
|
|
5d60d05625 | ||
|
|
4b53bc9711 | ||
|
|
4aab5ce7f9 | ||
|
|
bdfeda7589 | ||
|
|
2c9d2f2f26 | ||
|
|
951f351f66 | ||
|
|
7be892c832 | ||
|
|
72e9f65dec | ||
|
|
44aab19939 | ||
|
|
eb40ba55b1 | ||
|
|
0a820d90f0 | ||
|
|
05ddd629aa | ||
|
|
97b9d670fb | ||
|
|
6fa63c6ee6 | ||
|
|
2ae301f308 | ||
|
|
bfe575e019 | ||
|
|
eeb09800bb | ||
|
|
2f2f97c6a2 | ||
|
|
d9f7d78652 | ||
|
|
d91301c106 | ||
|
|
dac2b29609 | ||
|
|
3e91c0d918 | ||
|
|
8ef7c25bf9 | ||
|
|
df2016e126 | ||
|
|
3381a561f5 | ||
|
|
d4ac017acd | ||
|
|
f777c9980b | ||
|
|
fbb47872c1 | ||
|
|
40a9063f33 | ||
|
|
6d18ce16f8 | ||
|
|
e6691ac53f | ||
|
|
d6917d7a28 | ||
|
|
449732ccac | ||
|
|
bf03978d35 | ||
|
|
dacac830ff | ||
|
|
b02a88cfcd | ||
|
|
fec89f754b | ||
|
|
fe96f1475e | ||
|
|
e852893424 | ||
|
|
d46dbf1fea | ||
|
|
b45b87c481 | ||
|
|
061191ff9e | ||
|
|
bf214b42ce | ||
|
|
40a68b95fc | ||
|
|
b9ba3e6a61 | ||
|
|
3b80fdaa48 | ||
|
|
b44e44cb62 | ||
|
|
6d6fb26dd3 | ||
|
|
0aa401a0e6 | ||
|
|
dd210ba364 | ||
|
|
72385b26ac | ||
|
|
406bb8f692 | ||
|
|
9cc237bfee | ||
|
|
8b3ad3c365 | ||
|
|
9f44caa1f6 | ||
|
|
090afdeb87 | ||
|
|
0290bab375 | ||
|
|
00c1f554bc | ||
|
|
020bec1e30 | ||
|
|
87e829537e | ||
|
|
fe96feb62a | ||
|
|
233bdcb5ad | ||
|
|
3a0c7221e0 | ||
|
|
c49c5990c0 | ||
|
|
2a2c6ceac1 | ||
|
|
004e28586a | ||
|
|
2fe75675e5 | ||
|
|
68757819d4 | ||
|
|
252ad58710 | ||
|
|
f6bf2a81b4 | ||
|
|
dc15ecd43c | ||
|
|
6ef898005f | ||
|
|
71a84022b9 | ||
|
|
63cfa56abe | ||
|
|
39fe474e3b | ||
|
|
9d1b6ffc74 | ||
|
|
a9911ab9bf | ||
|
|
72e99c7c16 | ||
|
|
879bf81b4e | ||
|
|
d530ae462b | ||
|
|
b6116d5d47 | ||
|
|
eef8571946 | ||
|
|
78f31b3921 | ||
|
|
8c22f7a0dc | ||
|
|
cb72ae28f2 | ||
|
|
64903cc309 | ||
|
|
fa263f5e52 | ||
|
|
4fb93e8735 | ||
|
|
7b287efdfc | ||
|
|
668a8e2aad | ||
|
|
bb135eae27 | ||
|
|
b815400fc6 | ||
|
|
76f95a8712 | ||
|
|
516f7fd8d2 | ||
|
|
7e3a4dd843 | ||
|
|
2ffac12ecc | ||
|
|
686d146dff | ||
|
|
2870f82941 | ||
|
|
8432c564f8 | ||
|
|
2e9ab16293 | ||
|
|
82bcd53640 | ||
|
|
4ae5d93417 | ||
|
|
eb2fed3e15 | ||
|
|
bd2f738058 | ||
|
|
13acab0d03 | ||
|
|
b6c9941c80 | ||
|
|
1383058e53 | ||
|
|
0c870ba5af | ||
|
|
a517c981d1 | ||
|
|
2461c1d3c3 | ||
|
|
52f5c6a55c | ||
|
|
714a8f406b | ||
|
|
894a7ba3bd | ||
|
|
a7283ed820 | ||
|
|
cc32d390c7 | ||
|
|
961ef36d39 | ||
|
|
98eefe872a | ||
|
|
c3e5920240 | ||
|
|
ce3006450c | ||
|
|
21ae15f95f | ||
|
|
6550e9da04 | ||
|
|
5f81a8c8dd | ||
|
|
1e53362e49 | ||
|
|
e64187e51f | ||
|
|
2ab9aad2f4 | ||
|
|
9d2f7df13e | ||
|
|
25db1aed1f | ||
|
|
bf42a83e5d | ||
|
|
3b7baf5487 | ||
|
|
38330b38e1 | ||
|
|
839f5f7862 | ||
|
|
f583b70913 | ||
|
|
37be85660a | ||
|
|
3122ee1ba4 | ||
|
|
1de29ceae9 | ||
|
|
1334d0d0b6 | ||
|
|
50af4f507e | ||
|
|
5a8321381d | ||
|
|
b448a5f840 | ||
|
|
d1f8c96d05 | ||
|
|
f5bacba5d7 | ||
|
|
bb880b4b55 | ||
|
|
7902fb13e2 | ||
|
|
0f5dd89cc5 | ||
|
|
692077b956 | ||
|
|
85d13bd02e | ||
|
|
e0818cc28e | ||
|
|
76a4ad4447 | ||
|
|
ca0330b3fe | ||
|
|
88177ce149 | ||
|
|
86547bd566 | ||
|
|
3bc4bf2b13 | ||
|
|
8d18051670 | ||
|
|
3e82cea749 | ||
|
|
8b344cdfea | ||
|
|
976a2fafb8 | ||
|
|
dbb8132f71 | ||
|
|
7a5f2025aa | ||
|
|
0444d79703 | ||
|
|
c966f58d0d | ||
|
|
d600d7cae9 | ||
|
|
d3e9bd91a1 | ||
|
|
3a56986bde | ||
|
|
90dae20de7 | ||
|
|
3ba6e59952 | ||
|
|
89b776545b | ||
|
|
406f101f88 | ||
|
|
e313740053 | ||
|
|
23f7b9f073 | ||
|
|
543b008d43 | ||
|
|
126778f89f | ||
|
|
2e4daba1da | ||
|
|
8f0d397a2d | ||
|
|
92f7c1bbaa | ||
|
|
3ef498ecfb | ||
|
|
ede3b2feb0 | ||
|
|
21951bcff7 | ||
|
|
6239093dc6 | ||
|
|
aad69207fd | ||
|
|
ab193e013b | ||
|
|
00c1047430 | ||
|
|
e23285c5da | ||
|
|
99f8cc5c71 | ||
|
|
35841c5590 | ||
|
|
f2c3098f2c | ||
|
|
2370b023c9 | ||
|
|
44300b03b8 | ||
|
|
62ed743f3e | ||
|
|
8f2990b857 | ||
|
|
eabd0bfa79 | ||
|
|
50abd3de2a | ||
|
|
ee8f616d02 | ||
|
|
38f75cbfce | ||
|
|
cec8a9a572 | ||
|
|
82c431066f | ||
|
|
98cfa2b5da | ||
|
|
2f6556e311 | ||
|
|
d5d68ac980 | ||
|
|
7b84baad9b | ||
|
|
70609b39ee | ||
|
|
c9f16df0cd | ||
|
|
8cd44bae4a | ||
|
|
a4d377fd96 | ||
|
|
7a384da5bf | ||
|
|
7761ce2d75 | ||
|
|
ca757713fa | ||
|
|
0ee8c3c05f | ||
|
|
bf04f97fec | ||
|
|
6ecb547128 | ||
|
|
4764e3bd54 | ||
|
|
ff454b59ec | ||
|
|
5a9f7dd463 | ||
|
|
20a3af2667 | ||
|
|
fb766d5316 | ||
|
|
aca4488af6 | ||
|
|
14cf8d9163 | ||
|
|
29fafe3a49 | ||
|
|
33451dc445 | ||
|
|
dd6cebf197 | ||
|
|
83b6123fe6 | ||
|
|
c6a1e8d864 | ||
|
|
0303ea33b9 | ||
|
|
8df9a54c9b | ||
|
|
fd10199de6 | ||
|
|
2db1bb7d5d | ||
|
|
8856b10b58 | ||
|
|
c4f9290ed2 | ||
|
|
817b2a47d9 | ||
|
|
d0406126ba | ||
|
|
7d54925600 | ||
|
|
1658de670e | ||
|
|
cee15cff25 | ||
|
|
45bd69beef | ||
|
|
568e392af7 | ||
|
|
5e0ff19bc7 | ||
|
|
20cff3e357 | ||
|
|
4128e5d1a8 | ||
|
|
3d609968e8 | ||
|
|
18ddca2674 | ||
|
|
db1f2bd88d | ||
|
|
e11912d34b | ||
|
|
9438e2b421 | ||
|
|
7073ad3df7 | ||
|
|
4bcd16ae84 | ||
|
|
44f08a72d5 | ||
|
|
6e5e8910da | ||
|
|
97740bb7bb | ||
|
|
886616001a | ||
|
|
8a77d70353 | ||
|
|
9952f7bf55 | ||
|
|
34a5cfcdd8 | ||
|
|
8f2fccaa79 | ||
|
|
69bca89f3e | ||
|
|
2252d04796 | ||
|
|
e21485acfe | ||
|
|
3a8fb707b7 | ||
|
|
d804a8f7f9 | ||
|
|
25094ac7f0 | ||
|
|
509a2f333f | ||
|
|
5031243e51 | ||
|
|
006f55116c | ||
|
|
b932a218b9 | ||
|
|
d08f3acd1b | ||
|
|
658c86f7a4 | ||
|
|
73cbb5ae24 | ||
|
|
62b2548020 | ||
|
|
f4c3d83059 | ||
|
|
a961931540 | ||
|
|
3ceba2a26e | ||
|
|
2ceefe58b9 | ||
|
|
77868dc446 | ||
|
|
aa60cc320b | ||
|
|
8cad597409 | ||
|
|
148b605fbb | ||
|
|
48e0a7b1ab | ||
|
|
321a2a9f44 | ||
|
|
7e2cd3bad4 | ||
|
|
d9c3a6a581 | ||
|
|
1e570382d7 | ||
|
|
b0e0b9e79d | ||
|
|
706dcd2d19 | ||
|
|
13e555c340 | ||
|
|
629296566d | ||
|
|
8f044d3596 | ||
|
|
1a6a7a52aa | ||
|
|
46e3e5e60a | ||
|
|
5868424a36 | ||
|
|
5d0d9931c7 | ||
|
|
a7951cb1e3 | ||
|
|
2e6673e09c | ||
|
|
31299a6bfd | ||
|
|
5259c020ba | ||
|
|
3386ab9d93 | ||
|
|
135544df29 | ||
|
|
259184bc0e | ||
|
|
e02d0064a8 | ||
|
|
f516f061bf | ||
|
|
0f4d19b4b7 | ||
|
|
e74bb46494 | ||
|
|
b700b8dbb9 | ||
|
|
d3239a027a | ||
|
|
1174d93a4d | ||
|
|
c01fb9bfc1 | ||
|
|
58d3c27e3c | ||
|
|
2cf43972e0 | ||
|
|
3cfade4c64 | ||
|
|
6d5093b405 | ||
|
|
2cfa0d9b30 | ||
|
|
217629589e | ||
|
|
b276e5bb3a | ||
|
|
7b69d0f19b | ||
|
|
56e346a7d5 | ||
|
|
bf1e7cbfda | ||
|
|
fbe22a1bf9 | ||
|
|
d07fc84c6f | ||
|
|
301348a97e | ||
|
|
e5e6535f63 | ||
|
|
633da8094f | ||
|
|
88a347ab56 | ||
|
|
d87afbf15b | ||
|
|
30c7cb2930 | ||
|
|
b732addd9c | ||
|
|
642a555baf | ||
|
|
9e1b689b9f | ||
|
|
60c3665391 | ||
|
|
3bd409654c | ||
|
|
0ef9e9e297 | ||
|
|
b68f174e2d | ||
|
|
c602963710 | ||
|
|
a28d35c3d8 | ||
|
|
2f236a6ccc | ||
|
|
05710ba81b | ||
|
|
4671b6225b | ||
|
|
2d1ae38e3d | ||
|
|
8d45726e09 | ||
|
|
41850df73f | ||
|
|
77f64014a3 | ||
|
|
b02405c8c0 | ||
|
|
e67550003e | ||
|
|
dd89cd1401 | ||
|
|
64dba30423 | ||
|
|
3ed30608b4 | ||
|
|
9a51691424 | ||
|
|
d1a8b01386 | ||
|
|
9713cc8a09 | ||
|
|
c2d5d9cb79 | ||
|
|
edced705c2 | ||
|
|
d86add4d82 | ||
|
|
b30e13c978 | ||
|
|
4c6a934d77 | ||
|
|
e65729cc50 | ||
|
|
953e1a3dbc | ||
|
|
94c5f449dd | ||
|
|
e2ce091433 | ||
|
|
11541f543f | ||
|
|
01fc8b39f2 | ||
|
|
ce2f1c7917 | ||
|
|
0830d10110 | ||
|
|
1dcbc8af25 | ||
|
|
2424f94ec5 | ||
|
|
e61703b9b8 | ||
|
|
1e04b4539c | ||
|
|
6d49cd9f6d | ||
|
|
9cb38d2bda | ||
|
|
691d1ed037 | ||
|
|
b23674c817 | ||
|
|
1128cee41a | ||
|
|
d9d77970dc | ||
|
|
418e67a4a4 | ||
|
|
3682a5c58a | ||
|
|
f1d4e0ab8a | ||
|
|
c75d529454 | ||
|
|
4ac8d4dbbd | ||
|
|
3155d91aa3 | ||
|
|
d5dfa107f3 | ||
|
|
e116442fb0 | ||
|
|
8aa668599e | ||
|
|
2bc4d3b1d0 | ||
|
|
99ae4cff00 | ||
|
|
edbcac6ce6 | ||
|
|
f3974cee75 | ||
|
|
225f6f51be | ||
|
|
7efebe117e | ||
|
|
155a723fc9 | ||
|
|
4a0954c052 | ||
|
|
3ba704ef6d | ||
|
|
1606aa27bf | ||
|
|
456f4bc464 | ||
|
|
af97890612 | ||
|
|
c4a45795d5 | ||
|
|
b21219c408 | ||
|
|
a33b370cfb | ||
|
|
579c399f12 | ||
|
|
1010f84a9c | ||
|
|
03a60460f8 | ||
|
|
cb9c9fb271 | ||
|
|
f30eb3c31d | ||
|
|
e67ca2314a | ||
|
|
f8cb83a03e | ||
|
|
19c55aa5c3 | ||
|
|
1e43a7153b | ||
|
|
f311f2476e | ||
|
|
cd2edf3e7c | ||
|
|
ea2adbea24 | ||
|
|
bb9e8f162b | ||
|
|
d04bba5e7b | ||
|
|
81ef9c4292 | ||
|
|
8f1b6c4b34 | ||
|
|
3dea579ecf | ||
|
|
72a54d60f4 | ||
|
|
1aafb50b75 | ||
|
|
3c5ba1d382 | ||
|
|
e0f64c68e8 | ||
|
|
ac07320328 | ||
|
|
f95d3a13e2 | ||
|
|
2727b67152 | ||
|
|
023152a6fa | ||
|
|
a926066dba | ||
|
|
40df649a4e | ||
|
|
e2f35e4d1b | ||
|
|
96e6d94e56 | ||
|
|
4946dc1658 | ||
|
|
708b23bb32 | ||
|
|
4c1c0791f1 | ||
|
|
b79029fdb8 | ||
|
|
b70ff8ac48 | ||
|
|
a3204bdd9b | ||
|
|
801eeca0a3 | ||
|
|
549eaa4d7f | ||
|
|
7eb41b0061 | ||
|
|
a945a4c56e | ||
|
|
b39970f6d5 | ||
|
|
0360db506c | ||
|
|
989547753d | ||
|
|
5355ea66f7 | ||
|
|
4aba402296 | ||
|
|
652e32c887 | ||
|
|
128da5b0f8 | ||
|
|
2dfc331847 | ||
|
|
2c02dfaabf | ||
|
|
53a4f6ba7d | ||
|
|
048be49b69 | ||
|
|
21276a494f | ||
|
|
06c5902e82 | ||
|
|
064afea0b7 | ||
|
|
5429720a08 | ||
|
|
aec40f3832 | ||
|
|
bd9bdef601 | ||
|
|
2d41ee208d | ||
|
|
6e40fc8cb5 | ||
|
|
62018679d8 | ||
|
|
e8cb1bcbfa | ||
|
|
66a6d1fe9b | ||
|
|
b7650b7bc0 | ||
|
|
639fb0996b | ||
|
|
8f5b9c1901 | ||
|
|
13cedd6699 | ||
|
|
2a580719d4 | ||
|
|
749a5217b7 | ||
|
|
ce9720c590 | ||
|
|
3702364a44 | ||
|
|
f1bacd2e07 | ||
|
|
25196ce4f2 | ||
|
|
9b13d22d70 | ||
|
|
9d5248a35c | ||
|
|
5d9d7b1a75 | ||
|
|
c4d19ab423 | ||
|
|
b4a0472893 | ||
|
|
6717d57280 | ||
|
|
ebf361fe42 | ||
|
|
48bcd628fe | ||
|
|
bec9fa4dee | ||
|
|
2e6a02ca58 | ||
|
|
f6ea73216d | ||
|
|
3f6a97da54 | ||
|
|
0a090ef99c | ||
|
|
8d7747b12f | ||
|
|
871ba5cc04 | ||
|
|
22bd814852 | ||
|
|
23f177d2c6 | ||
|
|
57d4e8b0c9 | ||
|
|
dd2975fe39 | ||
|
|
a8a8007a50 | ||
|
|
5e0f4f6e7d | ||
|
|
8ce2376142 | ||
|
|
dd4c94c66e | ||
|
|
85eccd7f77 | ||
|
|
0fe5e0486e | ||
|
|
2f66be3784 | ||
|
|
8f3f641ccb | ||
|
|
ca8e5f4cdd | ||
|
|
3920604b69 | ||
|
|
3f2b918ccc | ||
|
|
4322f254c1 | ||
|
|
3329dafec7 | ||
|
|
00c92ab262 | ||
|
|
6c2d59ff3e | ||
|
|
4871e4700f | ||
|
|
41c102bca1 | ||
|
|
069accd798 | ||
|
|
c86c1c1ca7 | ||
|
|
0cd1281d38 | ||
|
|
d964c42276 | ||
|
|
70c4e1b464 | ||
|
|
73ed3a22a1 | ||
|
|
3c160c6d18 | ||
|
|
bbddba9557 | ||
|
|
9aea9834cb | ||
|
|
182b211c16 | ||
|
|
4335e45643 | ||
|
|
17a01c504e | ||
|
|
5826d3fb46 | ||
|
|
da1cc58b72 | ||
|
|
7a09e861da | ||
|
|
71d3b9f726 | ||
|
|
4cb696a903 | ||
|
|
d9166e1649 | ||
|
|
8ef5c8c436 | ||
|
|
b14b6cf164 | ||
|
|
dcdbe4cbec | ||
|
|
e33cc2e2db | ||
|
|
2263bd1e29 | ||
|
|
870c082b0a | ||
|
|
d9bb8b494e | ||
|
|
6a47bca0aa | ||
|
|
f5e5ee4980 | ||
|
|
f2ea90ba00 | ||
|
|
93b60e3ef6 | ||
|
|
c1270ca38b | ||
|
|
e1b0c0ce54 | ||
|
|
f2a42cc021 | ||
|
|
ccac147d8b | ||
|
|
fa6326f96b | ||
|
|
c45a0f4395 | ||
|
|
edef2644e5 | ||
|
|
6b621fbc7f | ||
|
|
e336506959 | ||
|
|
65f954e71e | ||
|
|
ab55f7150c | ||
|
|
4960f36497 | ||
|
|
d3e70b8d69 | ||
|
|
f68075a555 | ||
|
|
06d474a186 | ||
|
|
fe81c0710b | ||
|
|
d70fa8a71d | ||
|
|
2534046117 | ||
|
|
ad8275889f | ||
|
|
cfae70862f | ||
|
|
cdf6f26113 | ||
|
|
c9edc53ca0 | ||
|
|
fa0a416208 | ||
|
|
cd408aa4cf | ||
|
|
14c155e457 | ||
|
|
e2e5fa8fb9 | ||
|
|
9c8d20e4ac | ||
|
|
718181609f | ||
|
|
039b980f72 | ||
|
|
1cc8a06ad0 | ||
|
|
b7d8a404ea | ||
|
|
dc8dabe88e | ||
|
|
fcb10dcf9b | ||
|
|
c2d6eda11b | ||
|
|
aacb407d9b | ||
|
|
22f14ea4e2 | ||
|
|
75d16ce80a | ||
|
|
826d1b136d | ||
|
|
07a4b636fb | ||
|
|
7d1aefc5e1 | ||
|
|
902ec60ee1 | ||
|
|
7908dffae7 | ||
|
|
9f4dfbc49b | ||
|
|
dc84cfe6ba | ||
|
|
5d43857d3d | ||
|
|
5230673778 | ||
|
|
bbe9ff8df9 | ||
|
|
299037dd3a | ||
|
|
30bf014603 | ||
|
|
0b102f784e | ||
|
|
1b89be8db8 | ||
|
|
3877c94e12 | ||
|
|
4a59b0b852 | ||
|
|
6cb074b798 | ||
|
|
ec12610954 | ||
|
|
fe46e5b54f | ||
|
|
fc4915922f | ||
|
|
f1c348081a | ||
|
|
22322765b4 | ||
|
|
a3439dbf47 | ||
|
|
dee020a45b | ||
|
|
ba1dd649af | ||
|
|
bfde531d65 | ||
|
|
e3fb7eb1aa | ||
|
|
39f9762907 | ||
|
|
f70ca77f96 | ||
|
|
daefb175d4 | ||
|
|
f149440910 | ||
|
|
0f8bb10baa | ||
|
|
57173e943c | ||
|
|
cf211c6530 | ||
|
|
6ffbd3ae72 | ||
|
|
ee08981436 | ||
|
|
568c9da34d | ||
|
|
ec10bbffde | ||
|
|
c65113fc4a | ||
|
|
58b52f6a99 | ||
|
|
8ab33955da | ||
|
|
1b4095133b | ||
|
|
94bce04a89 | ||
|
|
6af6ca022b | ||
|
|
c360e48ecf | ||
|
|
cda381cbdc | ||
|
|
2d570b4ffc | ||
|
|
697a5dceba | ||
|
|
df9dc847f5 | ||
|
|
f32e0cbabf | ||
|
|
8be182c8d8 | ||
|
|
5d9b93e9f8 | ||
|
|
7825607ddf | ||
|
|
0325b85810 | ||
|
|
aebef542bf | ||
|
|
422b53a5da | ||
|
|
111eb2015c | ||
|
|
c0d8e5b3ef | ||
|
|
98d9fcade3 | ||
|
|
97da2ade09 | ||
|
|
38abe0e2d4 | ||
|
|
d040388bff | ||
|
|
04e9301e4d | ||
|
|
713bd78058 | ||
|
|
efa4d4f460 | ||
|
|
4f178959a5 | ||
|
|
85c77005a0 | ||
|
|
4490a6149a | ||
|
|
a8097b0db4 | ||
|
|
64c1df8ee4 | ||
|
|
801958a339 | ||
|
|
b48e2caf7c | ||
|
|
4891b6afd8 | ||
|
|
562508f0d5 | ||
|
|
b6493e8cbf | ||
|
|
2a8db68537 | ||
|
|
0a1d12585c | ||
|
|
8431595ebe | ||
|
|
28f5092aca | ||
|
|
af293b2d97 | ||
|
|
0b26371b83 | ||
|
|
2f72e68727 | ||
|
|
3664b28e00 | ||
|
|
e681cad92e | ||
|
|
68e0a17491 | ||
|
|
f56f2d4e52 | ||
|
|
1e63a95689 | ||
|
|
a3af3d319a | ||
|
|
fb2904dbb0 | ||
|
|
b223edc9b8 | ||
|
|
c8fb4d3ae8 | ||
|
|
72b5c556c0 | ||
|
|
e41832992f | ||
|
|
28e0286a67 | ||
|
|
2f763cedea | ||
|
|
3729c4258b | ||
|
|
eb71ff785b | ||
|
|
4744e211dd | ||
|
|
d0b03dc69c | ||
|
|
f1d1b986ee | ||
|
|
5707f6d56d | ||
|
|
321b0f22b1 | ||
|
|
be726c08ac | ||
|
|
51711ffde5 | ||
|
|
48e612895f | ||
|
|
4bdd8e7d22 | ||
|
|
b7788d4156 | ||
|
|
1629d20dfd | ||
|
|
bb380e6470 | ||
|
|
9507265d17 | ||
|
|
2bb4427ae0 | ||
|
|
6a7a0d086a | ||
|
|
c405cd59c1 | ||
|
|
e4af99d487 | ||
|
|
3f8992a334 | ||
|
|
31b1c02876 | ||
|
|
fb8116a5d3 | ||
|
|
46278f0bfa | ||
|
|
9c0fa91c65 | ||
|
|
f46b63bfa0 | ||
|
|
824374961b | ||
|
|
04a228881d | ||
|
|
48d3b28c3a | ||
|
|
1559395b74 | ||
|
|
6b9ae6865a | ||
|
|
2e04bf6189 | ||
|
|
add2c72fa0 | ||
|
|
5ca7f5e8c6 | ||
|
|
6f3675f1ff | ||
|
|
2749296524 | ||
|
|
780a797180 | ||
|
|
1c7f6dde92 | ||
|
|
9b88cc5f1d | ||
|
|
d152766772 | ||
|
|
d0a1720f4d | ||
|
|
f136a67812 | ||
|
|
26a8236401 | ||
|
|
de5055d62a | ||
|
|
262843afe6 | ||
|
|
eaf487828a | ||
|
|
dee0b35090 | ||
|
|
e822ec666d | ||
|
|
f081594357 | ||
|
|
258b0d3c24 | ||
|
|
74ec22f88f | ||
|
|
6b366ba64c | ||
|
|
2904958913 | ||
|
|
2467da69e4 | ||
|
|
f0aca82372 | ||
|
|
f81b0c50fe | ||
|
|
7aa910f11c | ||
|
|
6daa819b73 | ||
|
|
7383c42ad7 | ||
|
|
661e55b97f | ||
|
|
7d9e3b3d43 | ||
|
|
54b82849bb | ||
|
|
3aff90e222 | ||
|
|
2242310cce | ||
|
|
506ead5fcd | ||
|
|
fdfa2b0b22 | ||
|
|
a3efbe88da | ||
|
|
ae42b2d56a | ||
|
|
a9183717cf | ||
|
|
f55ce79305 | ||
|
|
8159390ee2 | ||
|
|
e034b82d75 | ||
|
|
529b6e8f8f | ||
|
|
3b1d92015b | ||
|
|
c0703d6b97 | ||
|
|
aaabaf86c1 | ||
|
|
c9d48f9027 | ||
|
|
34312b1f2f | ||
|
|
582f32db7a | ||
|
|
b3afe20c10 | ||
|
|
41ca50f15b | ||
|
|
b3fd92890d | ||
|
|
449bfd60e6 | ||
|
|
b4ea06ef45 | ||
|
|
6d58fb6b7c | ||
|
|
505e3d5466 | ||
|
|
13aa059a73 | ||
|
|
934589348e | ||
|
|
2434c90ca2 | ||
|
|
7936b86b4a | ||
|
|
c68ea5ab6f | ||
|
|
d21c2c56d3 | ||
|
|
fb1c8ede06 | ||
|
|
47bd3bb6e7 | ||
|
|
d39be21072 | ||
|
|
caa9033cb0 | ||
|
|
319109dbd6 | ||
|
|
18451d26e9 | ||
|
|
6b18066ef9 | ||
|
|
5b2738d43e | ||
|
|
cb60c36d89 | ||
|
|
10747a8399 | ||
|
|
372fb40b32 | ||
|
|
39596a0bb8 | ||
|
|
815cd2038f | ||
|
|
63d65c3623 | ||
|
|
34e121bd88 | ||
|
|
140e93b105 | ||
|
|
39b1681518 | ||
|
|
6df7749aba | ||
|
|
5ff85d5f7b | ||
|
|
0d84dd5f3e | ||
|
|
56ad6341a4 | ||
|
|
d0d14bad7f | ||
|
|
9251454eba | ||
|
|
df3dbc9122 | ||
|
|
f52d81f64d | ||
|
|
802c8b4d2d | ||
|
|
4b67c3a3c3 | ||
|
|
df9664e830 | ||
|
|
7112370451 | ||
|
|
c47ab182ae | ||
|
|
5d136cd0e4 | ||
|
|
0df6a2d9ae | ||
|
|
0d36c93ec3 | ||
|
|
a47b5a1409 | ||
|
|
f3af37b200 | ||
|
|
e2bcd3d211 | ||
|
|
10074f0384 | ||
|
|
8c0e3973f3 | ||
|
|
1a3b09ee9b | ||
|
|
64fcc4cfa2 | ||
|
|
46eb195775 | ||
|
|
4082964458 | ||
|
|
ef01cf77ca | ||
|
|
f07dcd7083 | ||
|
|
1692a63ff2 | ||
|
|
22c3cb9f47 | ||
|
|
1897c0ba41 | ||
|
|
a8feca1043 | ||
|
|
17ecd2e936 | ||
|
|
525b1062ea | ||
|
|
46dc14a9bb | ||
|
|
f875678a9c | ||
|
|
3f34c23843 | ||
|
|
1485e914c7 | ||
|
|
c14457833d | ||
|
|
684383509d | ||
|
|
64515206b5 | ||
|
|
dc9ee3099d | ||
|
|
e0f2b783e6 | ||
|
|
b4df8837c5 | ||
|
|
0323370c96 | ||
|
|
7ad97a3888 | ||
|
|
397d825a68 | ||
|
|
be590a7f1b | ||
|
|
a8f6c4be42 | ||
|
|
09fde7e34c | ||
|
|
e776b17de6 | ||
|
|
46bf27e1f8 | ||
|
|
0e1ebde9db | ||
|
|
9a8dd89fb4 | ||
|
|
c6499366d9 | ||
|
|
eaf777dadd | ||
|
|
1bda28a96d | ||
|
|
5fbd559ca3 | ||
|
|
10ce1a2ee5 | ||
|
|
84a333ae28 | ||
|
|
95ddbb5ffd | ||
|
|
4089317770 | ||
|
|
1de8de8681 | ||
|
|
c6325f6625 | ||
|
|
12f6e2266d | ||
|
|
614150d9c9 | ||
|
|
941d7a5f92 | ||
|
|
e1b3d3bd12 | ||
|
|
37e14404f9 | ||
|
|
1d7ca056f7 | ||
|
|
86e06cbf5a | ||
|
|
17170dd5f8 | ||
|
|
2046d592c4 | ||
|
|
bb73563bf0 | ||
|
|
6d11d388ca | ||
|
|
f8c10c6657 | ||
|
|
3c2e84fe27 | ||
|
|
fd7f93dbd7 | ||
|
|
4e355995e6 | ||
|
|
5f839220a3 | ||
|
|
8286fbb064 | ||
|
|
4995984517 | ||
|
|
15773fd920 | ||
|
|
4570d5baf2 | ||
|
|
95618732f8 | ||
|
|
1c030bfa0b | ||
|
|
d1c3b53530 | ||
|
|
0471bcb97b | ||
|
|
bcd0726142 | ||
|
|
1f0fa192a0 | ||
|
|
c3040176bf | ||
|
|
478aeecf15 | ||
|
|
2a1651c3e4 | ||
|
|
cf1d92e1f0 | ||
|
|
450d620463 | ||
|
|
151f94686f | ||
|
|
258d93b5db | ||
|
|
b10f143b39 | ||
|
|
221a2bc36c | ||
|
|
06d70c449d | ||
|
|
3b9905b53c | ||
|
|
efcfe62f11 | ||
|
|
a1dbc02252 | ||
|
|
b21480c640 | ||
|
|
c8ffafa0d6 | ||
|
|
99aa534807 | ||
|
|
0d6c623096 | ||
|
|
7053e3f078 | ||
|
|
31cbcecdc1 | ||
|
|
797e5add3c | ||
|
|
a86baa60f0 | ||
|
|
6aa855c91d | ||
|
|
2884211b1d | ||
|
|
bcae14f76c | ||
|
|
aaaf38083e | ||
|
|
c2d4d4ab29 | ||
|
|
546bdab866 | ||
|
|
e1e2b2708a | ||
|
|
9625b32c35 | ||
|
|
8a00831853 | ||
|
|
47646ffd92 | ||
|
|
8665f1db57 | ||
|
|
209d13cfe2 | ||
|
|
7554cf628e | ||
|
|
19c301f5fd | ||
|
|
3f413cb923 | ||
|
|
437fa7cdb5 | ||
|
|
401a0c93d9 | ||
|
|
0297504a3b | ||
|
|
a662b272cd | ||
|
|
cc277fb0fc | ||
|
|
a17a5c72c4 | ||
|
|
7a1879608d | ||
|
|
4eab0af794 | ||
|
|
fb7e0083d9 | ||
|
|
6d6a2a47aa | ||
|
|
1b86ec0556 | ||
|
|
952312d17b | ||
|
|
4903734012 | ||
|
|
8d0407462f | ||
|
|
128bbd56f0 | ||
|
|
03c3316c37 | ||
|
|
6a133b5aec | ||
|
|
5418d308a2 | ||
|
|
6f8531ba11 | ||
|
|
3ea8de5a73 | ||
|
|
3d6d5eed05 | ||
|
|
ca0b670784 | ||
|
|
745ebf782f | ||
|
|
707412ef5e | ||
|
|
7f81a64fe4 | ||
|
|
404b08681a | ||
|
|
7a0ed38a4e | ||
|
|
3c961a8c32 | ||
|
|
80f5bcaac3 | ||
|
|
fa221950f2 | ||
|
|
7b54523bc5 | ||
|
|
f40f1b9daa | ||
|
|
faf263ca85 | ||
|
|
f547bf04d4 | ||
|
|
a8300fda29 | ||
|
|
ff4f7a9fe8 | ||
|
|
098c401a87 | ||
|
|
ef96cd4a72 | ||
|
|
f465191dd8 | ||
|
|
b2faafdce6 | ||
|
|
9905bf6e1a | ||
|
|
a47c7d6527 | ||
|
|
f0f22a9148 | ||
|
|
1b2a75f8e6 | ||
|
|
7888f0ca7a | ||
|
|
0319af5eec | ||
|
|
9d9781932c | ||
|
|
73d5178d78 | ||
|
|
0a0005d6bc | ||
|
|
31c86c4cb7 | ||
|
|
f10c484578 | ||
|
|
42d6e74fbe | ||
|
|
3a4c7fbd89 | ||
|
|
582edeead6 | ||
|
|
5833f62773 | ||
|
|
86dfe9cb2d | ||
|
|
05dde72e8f | ||
|
|
6821d981a7 | ||
|
|
8a5d4c16b8 | ||
|
|
f55d23d9be | ||
|
|
2fdb6d754e | ||
|
|
08e3cd334b | ||
|
|
4bb3f24b2b | ||
|
|
89203899af | ||
|
|
89a909043d | ||
|
|
9b9be1867f | ||
|
|
e4802c01ae | ||
|
|
0ece72f323 | ||
|
|
043757e9fc | ||
|
|
46a406db90 | ||
|
|
ccf32dc186 | ||
|
|
66bdba18ff | ||
|
|
d81e61b1ff | ||
|
|
9b8f7545fe | ||
|
|
1ff29abbe0 | ||
|
|
5d490128a8 | ||
|
|
f48c09fa09 | ||
|
|
92b1cc77bb | ||
|
|
52326281de | ||
|
|
7ad183bf13 | ||
|
|
82360354b0 | ||
|
|
cec25e81be | ||
|
|
045c82cdbf | ||
|
|
552637d5ff | ||
|
|
5922ad8b08 | ||
|
|
162941cddc | ||
|
|
875d966f65 | ||
|
|
b3353eb548 | ||
|
|
baa0573468 | ||
|
|
4cd5464496 | ||
|
|
5d422e8d5b | ||
|
|
9c2f480a0e | ||
|
|
d6dd039681 | ||
|
|
dceac9452d | ||
|
|
f062e83a76 | ||
|
|
a3ac02c342 | ||
|
|
deecde44a4 | ||
|
|
ee542163d0 | ||
|
|
2d37ef1259 | ||
|
|
4d05a35652 | ||
|
|
08a09d5e00 | ||
|
|
91bf06000f | ||
|
|
0fa4a59674 | ||
|
|
a5b1311644 | ||
|
|
cc87efd697 | ||
|
|
a1c5cf9b9d | ||
|
|
7e6e42282a | ||
|
|
d0824bc3f6 | ||
|
|
5ab09dfebf | ||
|
|
9251d0c8b0 | ||
|
|
73e2ec4c7e | ||
|
|
f98ba48091 | ||
|
|
943b5057e7 | ||
|
|
2c59a6eb70 | ||
|
|
db5ebeda1e | ||
|
|
26ba0ffeae | ||
|
|
707af630d5 | ||
|
|
057f004909 | ||
|
|
e1318ff7cd | ||
|
|
19b8fd4bae | ||
|
|
d96a496896 | ||
|
|
ecc9f6f19d | ||
|
|
5caea33110 | ||
|
|
1667c46952 | ||
|
|
1d6131a23a | ||
|
|
b38a1bbdc3 | ||
|
|
fb0c34af4a | ||
|
|
fad62ea3b8 | ||
|
|
fda6b1aa8a | ||
|
|
adbc6f06d0 | ||
|
|
a305cc3f93 | ||
|
|
6e4020a144 | ||
|
|
5add71ad41 | ||
|
|
d34fd206f5 | ||
|
|
1f3ae5b4a0 | ||
|
|
301616f606 | ||
|
|
dbba5b8db2 | ||
|
|
f2d2484bc9 | ||
|
|
94275ccb6c | ||
|
|
2187a56ca7 | ||
|
|
8f4dfd10d3 | ||
|
|
bd27d339e7 | ||
|
|
aaf9843c9f | ||
|
|
2ec12ddca8 | ||
|
|
9da4ecb3d3 | ||
|
|
fbfe87c995 | ||
|
|
1c39ca1162 | ||
|
|
c7fcd604c6 | ||
|
|
a58c0398d8 | ||
|
|
3d8261ebe9 | ||
|
|
e69d38cccb | ||
|
|
c372c414ad | ||
|
|
c051bc3777 | ||
|
|
629f7e6755 | ||
|
|
80f6c6fa18 | ||
|
|
418e0c2c79 | ||
|
|
2b4f3e72b9 | ||
|
|
33caa0addc | ||
|
|
db6199f447 | ||
|
|
1340dbe0ef | ||
|
|
bbcce4c71a | ||
|
|
bb626b6036 | ||
|
|
b860710c8e | ||
|
|
4cd5350a12 | ||
|
|
496db1c678 | ||
|
|
cd62100e23 | ||
|
|
672d296303 | ||
|
|
2f690d5017 | ||
|
|
ae0b14d006 | ||
|
|
9654e78020 | ||
|
|
b2b5d3f972 | ||
|
|
73e3b8a43c | ||
|
|
bd7aae37af | ||
|
|
13346a8dec | ||
|
|
87b98ccf20 | ||
|
|
6be3aae4eb | ||
|
|
06fa45f3b8 | ||
|
|
704571812b | ||
|
|
90489758d1 | ||
|
|
7b94973506 | ||
|
|
3ec094cb24 | ||
|
|
662ba5f4fc | ||
|
|
705558e337 | ||
|
|
d83e0f433d | ||
|
|
bb238f863d | ||
|
|
0ae88c5c48 | ||
|
|
9f2af5acbd | ||
|
|
25444d1c4c | ||
|
|
250cc6f3dc | ||
|
|
1b72eebb15 | ||
|
|
9464edcc8f | ||
|
|
dac03c0d9a | ||
|
|
d2fd5b8e78 | ||
|
|
f4e23d1ec9 | ||
|
|
c637ea386a | ||
|
|
e922cb1761 | ||
|
|
590180f6f7 | ||
|
|
420e0f51a8 | ||
|
|
efa104cbfb | ||
|
|
46e5bfae41 | ||
|
|
f161b6e232 | ||
|
|
7cee1d1143 | ||
|
|
c5c21eff17 | ||
|
|
4bf9a053b1 | ||
|
|
78eec9966b | ||
|
|
5435e41ebe | ||
|
|
c5e776a818 | ||
|
|
4a1535fb62 | ||
|
|
6179f08691 | ||
|
|
e6c9ca3a33 | ||
|
|
8a6027fba4 | ||
|
|
3a68d19d55 | ||
|
|
40144bd963 | ||
|
|
84652f9f5e | ||
|
|
5f280e103c | ||
|
|
2f3f7cea38 | ||
|
|
86ed346089 | ||
|
|
acb177fff4 | ||
|
|
304f152661 | ||
|
|
17741ff819 | ||
|
|
7cd134bac0 | ||
|
|
df0c9d4a08 | ||
|
|
936b4bb074 | ||
|
|
6b72f77ef5 | ||
|
|
3ab32dadcd | ||
|
|
e7b7c5345f | ||
|
|
87fb4e371e | ||
|
|
eac2a23d6b | ||
|
|
772621999e | ||
|
|
6e248cd38a | ||
|
|
7c484d3803 | ||
|
|
c52f8ecd3d | ||
|
|
633383ee9e | ||
|
|
6b917f4b51 | ||
|
|
6b0124e885 | ||
|
|
67eef9e8c0 | ||
|
|
eb32e6bf84 | ||
|
|
0419a70e8a | ||
|
|
8c763dbcd0 | ||
|
|
cb2742db98 | ||
|
|
9b37e362b4 | ||
|
|
8fe2086b64 | ||
|
|
81694f575c | ||
|
|
b53694a93e | ||
|
|
3e7e911cdd | ||
|
|
8a19fb26be | ||
|
|
19f97e42a1 | ||
|
|
9f6e0a85d8 | ||
|
|
e804357187 | ||
|
|
b1b3f5f24e | ||
|
|
3e9bd176d9 | ||
|
|
aa16127a53 | ||
|
|
2d1e32ed00 | ||
|
|
3198e5cd24 | ||
|
|
03bcd515aa | ||
|
|
926558813f | ||
|
|
23f1bb6ead | ||
|
|
ed9e1fe3f0 | ||
|
|
4c4c2ea13a | ||
|
|
d4019b7169 | ||
|
|
a508a227d6 | ||
|
|
45107eea52 | ||
|
|
8535ef0c3b | ||
|
|
910429eee7 | ||
|
|
7b40f21a57 | ||
|
|
97e2d5d092 | ||
|
|
02460caff3 | ||
|
|
4e0af9a7d4 | ||
|
|
e0ba8b09c6 | ||
|
|
63a3cae583 | ||
|
|
160a996665 | ||
|
|
0e0363a6bd | ||
|
|
9cd45bdc69 | ||
|
|
3f045241f5 | ||
|
|
ea54ed3088 | ||
|
|
1adf3ddb71 | ||
|
|
b9f8f12bdb | ||
|
|
b01056fa69 | ||
|
|
daf4c21cb2 | ||
|
|
3888da36ad | ||
|
|
5f0317d1c2 | ||
|
|
7fac94d0f4 | ||
|
|
271084ac71 | ||
|
|
788095d952 | ||
|
|
94b8ac7cfa | ||
|
|
db479a82dc | ||
|
|
0001b16786 | ||
|
|
c272181df5 | ||
|
|
11e25ec707 | ||
|
|
8057b8be8a | ||
|
|
43027a66aa | ||
|
|
15bf4f2fdf | ||
|
|
905c70b0f1 | ||
|
|
649a36d0af | ||
|
|
f82b442b3c | ||
|
|
f8fb00ca59 | ||
|
|
f7f7d95b74 | ||
|
|
c1bb351fdc | ||
|
|
890b0592ba | ||
|
|
9d1ff5c821 | ||
|
|
fc2138096e | ||
|
|
cf3a317e91 | ||
|
|
a4be1febce | ||
|
|
4aa2c5eea8 | ||
|
|
8f8fa72183 | ||
|
|
1fecabe576 | ||
|
|
70ee43eed4 | ||
|
|
1b18ab6a23 | ||
|
|
6d919cbaef | ||
|
|
ab86759584 | ||
|
|
f1bf3a2dfd | ||
|
|
cb748a31e9 | ||
|
|
73dcbfbee5 | ||
|
|
59023ea173 | ||
|
|
b24197fa96 | ||
|
|
da1a7d5331 | ||
|
|
dfaa6e9b09 | ||
|
|
36cc1ed161 | ||
|
|
192c334fda | ||
|
|
31fe96b5ba | ||
|
|
9dd8a3d1db | ||
|
|
bda28e3c9e | ||
|
|
4aebf56bff | ||
|
|
f0390cbaba | ||
|
|
53ea652e5f | ||
|
|
977421c9eb | ||
|
|
a8382eb7c5 | ||
|
|
c8fc6237d4 | ||
|
|
d67d163fe3 | ||
|
|
5e7d188dcb | ||
|
|
4ba5317bfb | ||
|
|
d273e05710 | ||
|
|
be4b7d375b | ||
|
|
ab9a64b454 | ||
|
|
907e445ae7 | ||
|
|
71b47e4756 | ||
|
|
4d41c9404b | ||
|
|
148c970cbb | ||
|
|
375d1ffa3e | ||
|
|
b793ab7603 | ||
|
|
96ea6b03e7 | ||
|
|
5fe4fe9386 | ||
|
|
e14f3074db | ||
|
|
eaf4ef5a49 | ||
|
|
1e8f20f877 | ||
|
|
263cc7d9ae | ||
|
|
4c2b7a7459 | ||
|
|
43e27c5332 | ||
|
|
c616a840d6 | ||
|
|
180c1911ec | ||
|
|
fe3c0c5b0f | ||
|
|
163cc2e69b | ||
|
|
60c4b45a54 | ||
|
|
933341da74 | ||
|
|
cc5514275a | ||
|
|
9510d27748 | ||
|
|
2348d08595 | ||
|
|
ac31f2aef1 | ||
|
|
f918a4d82b | ||
|
|
fc5c6f3e0e | ||
|
|
24921b08d0 | ||
|
|
3a69773553 | ||
|
|
cff2c2c582 | ||
|
|
588d9f328d | ||
|
|
6980f434b4 | ||
|
|
97fdad841c | ||
|
|
ba184c3b57 | ||
|
|
c8cd5bfcd5 | ||
|
|
a845fe996f | ||
|
|
62f2a08600 | ||
|
|
189d1720ed | ||
|
|
2041e6a41f | ||
|
|
c1c7c84e7d | ||
|
|
b39d75f877 | ||
|
|
6324764a40 | ||
|
|
1eb75f8c27 | ||
|
|
b67bcf4843 | ||
|
|
a69758c914 | ||
|
|
35bfe95ab7 | ||
|
|
16dbd9c4a8 | ||
|
|
89572dc342 | ||
|
|
c58abca41f | ||
|
|
a328928280 | ||
|
|
962ae76bc0 | ||
|
|
c8813f8fc8 | ||
|
|
990a41d5fe | ||
|
|
ca37b268f7 | ||
|
|
9c3d464503 | ||
|
|
4ccdea739f | ||
|
|
6a8ebab58d | ||
|
|
092a294bbc | ||
|
|
5d6d168bed | ||
|
|
fbe2455d8d | ||
|
|
67f1bd08f8 | ||
|
|
6c72708d72 | ||
|
|
39eb289850 | ||
|
|
20a2c4f432 | ||
|
|
d1c8376449 | ||
|
|
f81fc2c840 | ||
|
|
b7f7196be3 | ||
|
|
19ed51c4e1 | ||
|
|
06af02477c | ||
|
|
c60139781d | ||
|
|
beb1e2a4bd | ||
|
|
939e901bce | ||
|
|
edf72c7977 | ||
|
|
29389f0fcd | ||
|
|
136be95fe1 | ||
|
|
d701b6973a | ||
|
|
cf5cfbf04e | ||
|
|
18a677af22 | ||
|
|
ca13a5ef65 | ||
|
|
19dedb1939 | ||
|
|
72350d066b | ||
|
|
87e2a4b54b | ||
|
|
0f2cf4f48b | ||
|
|
a0b5009a3a | ||
|
|
838649dfee | ||
|
|
a706077c61 | ||
|
|
1b15d81f48 | ||
|
|
79a67545f4 | ||
|
|
21aa4a2f9a | ||
|
|
8b9aea19d5 | ||
|
|
d7c9639cc1 | ||
|
|
bcf50862d1 | ||
|
|
bd43b6a25d | ||
|
|
fa8e52aa86 | ||
|
|
7f62da4f83 | ||
|
|
21da573629 | ||
|
|
32c39f7e29 | ||
|
|
01e98927ec | ||
|
|
05147c382f | ||
|
|
b29533962b | ||
|
|
005795626a | ||
|
|
bca7c818e7 | ||
|
|
cc8882b870 | ||
|
|
b27f2edc57 | ||
|
|
5c782392db | ||
|
|
a42211ad52 | ||
|
|
d4089c1822 | ||
|
|
c3621304cb | ||
|
|
9e46d5912f | ||
|
|
e8296305ec | ||
|
|
ba58676aea | ||
|
|
9a53de3e33 | ||
|
|
2659c27999 | ||
|
|
5bab9ec73f | ||
|
|
7a9a74ed4f | ||
|
|
90d8b8bcc8 | ||
|
|
4a5911d416 | ||
|
|
90711db7da | ||
|
|
ae0b875228 | ||
|
|
d1d8c0129f | ||
|
|
e08cbc29b4 | ||
|
|
50fff54810 | ||
|
|
f1e9e67f66 | ||
|
|
0e2a9c299a | ||
|
|
44f1a3899a | ||
|
|
0e5fc4af58 | ||
|
|
401c294965 | ||
|
|
10ba72ee76 | ||
|
|
b7692cd816 | ||
|
|
cd16235799 | ||
|
|
6a67e54d34 | ||
|
|
d86ab8df3a | ||
|
|
8fed1cb898 | ||
|
|
f860441730 | ||
|
|
061ed664e2 | ||
|
|
4272dc5b57 | ||
|
|
64065d7a6d | ||
|
|
3457e843ef | ||
|
|
7d15051ae1 | ||
|
|
67411e2c56 | ||
|
|
f5e08862ab | ||
|
|
d371d9c561 | ||
|
|
f2486eab07 | ||
|
|
72f4b595ff | ||
|
|
436fa33c47 | ||
|
|
9ead1505eb | ||
|
|
e617861340 | ||
|
|
a7ffffa54d | ||
|
|
4f09c07271 | ||
|
|
a95c4613a5 | ||
|
|
52428363a1 | ||
|
|
67a2f24b86 | ||
|
|
507c25df08 | ||
|
|
b9cd95595d | ||
|
|
abf7eb5b73 | ||
|
|
416493c71f | ||
|
|
120d150a31 | ||
|
|
ac699b3ffc | ||
|
|
58ee54a3dc | ||
|
|
0b95515322 | ||
|
|
2a0dbb2a26 | ||
|
|
a846609e45 | ||
|
|
dff2d0d4ba | ||
|
|
e0e4d6b1c0 | ||
|
|
63306ff75b | ||
|
|
153c332fcd | ||
|
|
97484d58c5 | ||
|
|
11d99751e8 | ||
|
|
eaa343fa75 | ||
|
|
88f1265869 | ||
|
|
79143d22b7 | ||
|
|
418dc949ad | ||
|
|
c87bdac8bb | ||
|
|
5ca13143ec | ||
|
|
d77aae8c04 | ||
|
|
5ff262029e | ||
|
|
a360db05aa | ||
|
|
0b8f2a8127 | ||
|
|
64fff4508d | ||
|
|
1e8cf12dc5 | ||
|
|
e48babd69b | ||
|
|
c4842cd1a6 | ||
|
|
2ee0c72d8a | ||
|
|
428d7418f0 | ||
|
|
a4b6caedf2 | ||
|
|
e1d099f21d | ||
|
|
5aed3ae866 | ||
|
|
2ff2921c1f | ||
|
|
bde250680b | ||
|
|
e4f050d6fc | ||
|
|
c89f14f6ea | ||
|
|
ddb1eb942d | ||
|
|
beecca57f1 | ||
|
|
4158028b3d | ||
|
|
2c8b3e5c73 | ||
|
|
a058dad22b | ||
|
|
58557ba9cd | ||
|
|
58fad32972 | ||
|
|
c305f0f5f8 | ||
|
|
c1acead14f | ||
|
|
e63ac30622 | ||
|
|
cf9125f987 | ||
|
|
d513985ecf | ||
|
|
14d3e56b03 | ||
|
|
0497c7b872 | ||
|
|
68093fb37c | ||
|
|
2b6ecb6aa8 | ||
|
|
9a8deed063 | ||
|
|
3b85fc3f20 | ||
|
|
e445b044dd | ||
|
|
dddd2fbded | ||
|
|
4ebd31d6c5 | ||
|
|
8d0ffda037 | ||
|
|
8bfeeda06f | ||
|
|
6f4a4cca87 | ||
|
|
b07273385d | ||
|
|
994fabcba7 | ||
|
|
0908ebd261 | ||
|
|
d8242b7b6e | ||
|
|
ee030ba487 | ||
|
|
c6ffa614fd | ||
|
|
7d4466c45a | ||
|
|
2a00ad3de1 | ||
|
|
641be3028f | ||
|
|
c236b76b0c | ||
|
|
a6f5e31e7d | ||
|
|
31c482e2a8 | ||
|
|
39aadedaf7 | ||
|
|
e0acc8d3d0 | ||
|
|
08658b989d | ||
|
|
8f7c09c770 | ||
|
|
93d3cb3b42 | ||
|
|
7c3eea677e | ||
|
|
f17ee19665 | ||
|
|
01a0925622 | ||
|
|
41f0e26051 | ||
|
|
99edef5c4c | ||
|
|
1950374fbe | ||
|
|
4995a4ea84 | ||
|
|
82b1df53d0 | ||
|
|
74c694c200 | ||
|
|
70b72261c8 | ||
|
|
ead2550eb0 | ||
|
|
844c8f946f | ||
|
|
30209acd75 | ||
|
|
a0df425ac3 | ||
|
|
1e44ca3c18 | ||
|
|
a7ee3cc2f2 | ||
|
|
264a75c13f | ||
|
|
8bbd874ef4 | ||
|
|
afa12446af | ||
|
|
5ebbaccf7b | ||
|
|
e320144878 | ||
|
|
8756b851e1 | ||
|
|
0eadeaf837 | ||
|
|
7404fe4fa5 | ||
|
|
d71f0e04b2 | ||
|
|
f0d7f6fddb | ||
|
|
d4874da99e | ||
|
|
c774854dcf | ||
|
|
b715d40019 | ||
|
|
6e42329df5 | ||
|
|
3477339d79 | ||
|
|
7b200af9a2 | ||
|
|
2f83b9cfdb | ||
|
|
ec65ee7ade | ||
|
|
9493f3c102 | ||
|
|
dd7cc8fddc | ||
|
|
bfb6a305f7 | ||
|
|
750b88f0de | ||
|
|
aa2086117c | ||
|
|
a7958b582d | ||
|
|
b5170621b9 | ||
|
|
801ab5428d | ||
|
|
e8f8188954 | ||
|
|
2266917d12 | ||
|
|
24e8e9d5cd | ||
|
|
d0aecad9d4 | ||
|
|
50a1d9d4a7 | ||
|
|
41ea29ef02 | ||
|
|
595b3fc337 | ||
|
|
4e4c0aad37 | ||
|
|
6e7d188d7b | ||
|
|
2fb0355c6b | ||
|
|
c1c89e5fd3 | ||
|
|
c94b267b34 | ||
|
|
745be1fd7d | ||
|
|
ce0f3f26ce | ||
|
|
7e33a97efc | ||
|
|
2d510a5603 | ||
|
|
a03bd0610f | ||
|
|
4dab9f4776 | ||
|
|
12bb169ebb | ||
|
|
52b207f812 | ||
|
|
a8e20395d0 | ||
|
|
e0ccf1f37e | ||
|
|
4a14e99dd5 | ||
|
|
b14dce6190 | ||
|
|
2b02b5ea74 | ||
|
|
d98b24c0f3 | ||
|
|
e2914acc38 | ||
|
|
4cb9ee6bab | ||
|
|
f611f3c664 | ||
|
|
e9f86cd8cf | ||
|
|
92a7c129df | ||
|
|
b8eeb8454d | ||
|
|
6bce9e5b21 | ||
|
|
a0f65d0e99 | ||
|
|
3f8ad7598f | ||
|
|
4d65b22403 | ||
|
|
c759ddad43 | ||
|
|
d95c559650 | ||
|
|
8897045308 | ||
|
|
56a7cf3ab3 | ||
|
|
535e4c1b38 | ||
|
|
8d76cca127 | ||
|
|
f409ad31b4 | ||
|
|
82750b9744 | ||
|
|
d1bebf1bc5 | ||
|
|
1c810256bf | ||
|
|
99d2f51f2c | ||
|
|
f16883b846 | ||
|
|
748bda0c54 | ||
|
|
b5bffb2735 | ||
|
|
0676951248 | ||
|
|
b924e4baa8 | ||
|
|
ca81e6912a | ||
|
|
58dd6fa960 | ||
|
|
29a57fc9cb | ||
|
|
2bb3760815 | ||
|
|
a41ba28081 | ||
|
|
243249521d | ||
|
|
d9019b2386 | ||
|
|
05bf72d1e9 | ||
|
|
4404aa487d | ||
|
|
5ec9a17505 | ||
|
|
0cec25a85d | ||
|
|
3a16ac0a92 | ||
|
|
2f67b6c5a1 | ||
|
|
88546760e9 | ||
|
|
527c480a9e | ||
|
|
3bf81d55cf | ||
|
|
bdbe9a1b5b | ||
|
|
4aa2b0ed83 | ||
|
|
592e6c3aa3 | ||
|
|
4f3a18180e | ||
|
|
b4ca26d112 | ||
|
|
5384748984 | ||
|
|
9f7db4a504 | ||
|
|
87316fb0e5 | ||
|
|
008a69b28f | ||
|
|
f5031101fd | ||
|
|
f84c6c743c | ||
|
|
7beee88783 | ||
|
|
d823abaaa3 | ||
|
|
6df6114357 | ||
|
|
4cd964039a | ||
|
|
2c3827d8ca | ||
|
|
e387be988a | ||
|
|
026f6d379d | ||
|
|
9864b12d26 | ||
|
|
92257be8b3 | ||
|
|
c94d23dc13 | ||
|
|
19d9cc2d75 | ||
|
|
aee1370842 | ||
|
|
f4d52efe5b | ||
|
|
4965267284 | ||
|
|
6adda3e963 | ||
|
|
aea5c2aaca | ||
|
|
1f784a84d0 | ||
|
|
60826ccda8 | ||
|
|
7cf55635ec | ||
|
|
c22f41cbf9 | ||
|
|
4659feb84c | ||
|
|
0b4a44f926 | ||
|
|
5df088c603 | ||
|
|
de46138715 | ||
|
|
363efbac97 | ||
|
|
c6a16212fc | ||
|
|
06b8ec5269 | ||
|
|
9a6867b7e9 | ||
|
|
05fedad27b | ||
|
|
cca2fe54e4 | ||
|
|
40cc77a614 | ||
|
|
526d71ae38 | ||
|
|
d8ba29c639 | ||
|
|
e6905cd686 | ||
|
|
4d29b4ba1b | ||
|
|
050ebec5db | ||
|
|
88a1b143d1 | ||
|
|
281d6445b1 | ||
|
|
1d011cec19 | ||
|
|
396e5e417f | ||
|
|
2968376436 | ||
|
|
b81dca611d | ||
|
|
ab6c2fa557 | ||
|
|
c01cd564e1 | ||
|
|
00bb487c0e | ||
|
|
26f914fde9 | ||
|
|
9a987c1346 | ||
|
|
b664c8d070 | ||
|
|
e4aeef3417 | ||
|
|
4ea7326030 | ||
|
|
435e568120 | ||
|
|
79f4ee31da | ||
|
|
9e4c52a9f9 | ||
|
|
a7dc225454 | ||
|
|
80dfd8f7b5 | ||
|
|
39c0e61381 | ||
|
|
0ee5686b8c | ||
|
|
3826ef37b1 | ||
|
|
2927e0972f | ||
|
|
e56c93f6f8 | ||
|
|
d12c228d7d | ||
|
|
1113a62e37 | ||
|
|
798ca8add0 | ||
|
|
38a8b5ecdb | ||
|
|
43b0f05bb3 | ||
|
|
6a46e826d5 | ||
|
|
9313e8f0c4 | ||
|
|
9a7f94d20b | ||
|
|
eb80b6fbaa | ||
|
|
62065135d1 | ||
|
|
b77dcba831 | ||
|
|
cdbdb080a4 | ||
|
|
4bbbe1f26f | ||
|
|
f8bbc3023a | ||
|
|
dbbb4b4485 | ||
|
|
610c12c402 | ||
|
|
259c5306a9 | ||
|
|
ba7c870812 | ||
|
|
97dde67cba | ||
|
|
02896f6428 | ||
|
|
63b7e2f477 | ||
|
|
2693122d24 | ||
|
|
9b4f53f45c | ||
|
|
768bc13f55 | ||
|
|
841874f176 | ||
|
|
b07aeb07ee | ||
|
|
fd610fd1a6 | ||
|
|
0ec87b1f76 | ||
|
|
5ab3cf2e4d | ||
|
|
c993029597 | ||
|
|
352c247c47 | ||
|
|
02f470b3f3 | ||
|
|
a13f1f35ed | ||
|
|
bfc4e23f90 | ||
|
|
d6f004b496 | ||
|
|
5e1d692eb5 | ||
|
|
4b67d52cbd | ||
|
|
7619dd2856 | ||
|
|
3a99cc7efe | ||
|
|
35517fc61d | ||
|
|
130cdcb69d | ||
|
|
90d3e47bd9 | ||
|
|
a6c2c792e7 | ||
|
|
56df9f36cf | ||
|
|
73017c20d2 | ||
|
|
955afb839b | ||
|
|
a3a4d647c6 | ||
|
|
ce8208c68b | ||
|
|
c9671e9bba | ||
|
|
d42567e422 | ||
|
|
769cf19111 | ||
|
|
854344e782 | ||
|
|
1becd370fb | ||
|
|
ce4b84fbcc | ||
|
|
74e221710e | ||
|
|
0fcb272584 | ||
|
|
21d167e225 | ||
|
|
114c1127fd | ||
|
|
b7cd0f30a4 | ||
|
|
1ad5e7564c | ||
|
|
00c4f31a6b | ||
|
|
5f528c9225 | ||
|
|
d3a641e794 | ||
|
|
d2ec0bdc12 | ||
|
|
8ba2307295 | ||
|
|
a9cb9f0b22 | ||
|
|
e36cad9a5c | ||
|
|
7f437ecbfe | ||
|
|
99d79a713c | ||
|
|
ca361d5346 | ||
|
|
d3c0cc39b7 | ||
|
|
2e24b50dbc | ||
|
|
347d867084 | ||
|
|
cf06946888 | ||
|
|
db39d66d1f | ||
|
|
d9d5b90bed | ||
|
|
217aa922ce | ||
|
|
0b215739a8 | ||
|
|
1d4512da96 | ||
|
|
78a76913b4 | ||
|
|
fb9c62c186 | ||
|
|
3e7c8545c0 | ||
|
|
5328d4b161 | ||
|
|
f3ed098831 | ||
|
|
9f90b6f237 | ||
|
|
80fd5be2e5 | ||
|
|
3b905ac208 | ||
|
|
23c492b7b6 | ||
|
|
4a5704d1c0 | ||
|
|
57f09eedf2 | ||
|
|
3e235bca21 | ||
|
|
76ecad404b | ||
|
|
e650117c4c | ||
|
|
27cc3295b1 | ||
|
|
aa06f7666a | ||
|
|
8f48bade9b | ||
|
|
30f91343e8 | ||
|
|
02b9d03af9 | ||
|
|
67bd8fc314 | ||
|
|
f96cfdb03e | ||
|
|
94d75018a0 | ||
|
|
4ef7dcc47f | ||
|
|
16ba8ffa10 | ||
|
|
0a3fd98778 | ||
|
|
7c37687daa | ||
|
|
de264087db | ||
|
|
d7dd1472e3 | ||
|
|
e53697af51 | ||
|
|
cf13a281b8 | ||
|
|
63312a2e66 | ||
|
|
8d6a89039a | ||
|
|
c01e30e606 | ||
|
|
48f492804b | ||
|
|
07b775d330 | ||
|
|
3fe72dbff2 | ||
|
|
5cb83ab7ee | ||
|
|
4944d0ea91 | ||
|
|
2f9eda3303 | ||
|
|
6d4cb77b68 | ||
|
|
bf0de58b71 | ||
|
|
dd443cbb06 | ||
|
|
10eb6321ce | ||
|
|
e62164115b | ||
|
|
c820a1c9c7 | ||
|
|
d76ca7e7fd | ||
|
|
204327240f | ||
|
|
1c136e6574 | ||
|
|
bc73cb575d | ||
|
|
c9dd100667 | ||
|
|
fe9d54682f | ||
|
|
df16f1e7d5 | ||
|
|
b650c4c03e | ||
|
|
89b8ac957e | ||
|
|
9335c0e1c3 | ||
|
|
2510e8fc62 | ||
|
|
ae45b63453 | ||
|
|
ccd004b025 | ||
|
|
682406d7b4 | ||
|
|
d45d06ee56 | ||
|
|
ec8c30d2c3 | ||
|
|
93ad905243 | ||
|
|
e9d8de921a | ||
|
|
2c81f40268 | ||
|
|
7325e15f1a | ||
|
|
a6d3000998 | ||
|
|
a3e035ac09 | ||
|
|
4089c941fd | ||
|
|
827bb7fd06 | ||
|
|
5566c7e8db | ||
|
|
face2561d4 | ||
|
|
0988604c10 | ||
|
|
f7a51c375f | ||
|
|
fe4f265208 | ||
|
|
89350411d8 | ||
|
|
75ca5cb9f4 | ||
|
|
794cd7a4b6 | ||
|
|
2758f89379 | ||
|
|
5ecc02dcbc | ||
|
|
8adeb7c77a | ||
|
|
324a98029b | ||
|
|
0aa0c6bd79 | ||
|
|
9a780dd772 | ||
|
|
d076c965b5 | ||
|
|
8e05bf08c4 | ||
|
|
e14ddad715 | ||
|
|
f2861e4e64 | ||
|
|
aa4a05c843 | ||
|
|
73a072a8c0 | ||
|
|
7acb8d2cbf | ||
|
|
2fb4a870a1 | ||
|
|
604c5ec81e | ||
|
|
08b60c2fa0 | ||
|
|
30676ade73 | ||
|
|
a6eccb520c | ||
|
|
1d1b53c90d | ||
|
|
ae1573ae1b | ||
|
|
f7d614172a | ||
|
|
eea6e4ca83 | ||
|
|
3d2ee270ed | ||
|
|
406de8984a | ||
|
|
f0d639e1bc | ||
|
|
49403601af | ||
|
|
2b86e9ad34 | ||
|
|
7397117a9f | ||
|
|
3fa2aa8cd6 | ||
|
|
7caa8001b4 | ||
|
|
e734385812 | ||
|
|
b20028be50 | ||
|
|
53950b34bb | ||
|
|
09258f3d67 | ||
|
|
e7b77e958f | ||
|
|
16d2b789af | ||
|
|
c64aa75ac1 | ||
|
|
1a1dd95f2b | ||
|
|
9fe6003b44 | ||
|
|
716994af04 | ||
|
|
a677499a6f | ||
|
|
456e939d21 | ||
|
|
d3408b8d1d | ||
|
|
52a0043631 | ||
|
|
739473adbe | ||
|
|
9fc5474ec3 | ||
|
|
383389930f | ||
|
|
60f703edc5 | ||
|
|
6afb1d76a9 | ||
|
|
6a9c1924cc | ||
|
|
b3da4ac017 | ||
|
|
b9266d33d7 | ||
|
|
6c56fda631 | ||
|
|
018edaedaa | ||
|
|
8b1319e1ac | ||
|
|
380bc170be | ||
|
|
c5e9de682e | ||
|
|
8b89e99baf | ||
|
|
96867d96c4 | ||
|
|
2920c69b1b | ||
|
|
6964b62775 | ||
|
|
061f365e37 | ||
|
|
9708832dd7 | ||
|
|
c164c7f97a | ||
|
|
21d61ca5f1 | ||
|
|
8f5fd569ee | ||
|
|
970293ac91 | ||
|
|
82ccb59aef | ||
|
|
9bbcaed4ae | ||
|
|
892eb98fdb | ||
|
|
c72b56daa3 | ||
|
|
39846f5631 | ||
|
|
0ca9be168d | ||
|
|
33b627e518 | ||
|
|
527d116f03 | ||
|
|
ef0129559b | ||
|
|
4ee0d91310 | ||
|
|
00d20bc63a | ||
|
|
a4ac66b40a | ||
|
|
fe18aadf26 | ||
|
|
4f05dc99af | ||
|
|
3f9c05e76a | ||
|
|
1ef11a145a | ||
|
|
e5e296e58c | ||
|
|
275833b30d | ||
|
|
8d025021af | ||
|
|
9cf5b1d99d | ||
|
|
4b24d97a17 | ||
|
|
648ad628b7 | ||
|
|
b22c5ee5b9 | ||
|
|
440e801148 | ||
|
|
90fa7951a8 | ||
|
|
b47c186427 | ||
|
|
d3035fbd10 | ||
|
|
f02e1a1119 | ||
|
|
ce7e27ef33 | ||
|
|
eca2711718 | ||
|
|
a752804b3a | ||
|
|
cec5e973ac | ||
|
|
504aaf12bd | ||
|
|
eaee82d4b3 | ||
|
|
8f45a6eabc | ||
|
|
332b42bb81 | ||
|
|
8f2719f5aa | ||
|
|
d644ebc792 | ||
|
|
406ce1034d | ||
|
|
c29cc486d3 | ||
|
|
fc485403b5 | ||
|
|
fe1969d001 | ||
|
|
ec9059a86a | ||
|
|
1084cdf38d | ||
|
|
9c2ff0a7c5 | ||
|
|
c20c8a8180 | ||
|
|
0985cec450 | ||
|
|
dac9ae77a4 | ||
|
|
f51e5e8b7e | ||
|
|
abce0b152c | ||
|
|
cb9f7f7608 | ||
|
|
2bada305e0 | ||
|
|
c1c9a2b786 | ||
|
|
f5bb9f4438 | ||
|
|
2d0eafe945 | ||
|
|
a54fa61041 | ||
|
|
e744a5d305 | ||
|
|
a5e6d7e9b5 | ||
|
|
46ba36922f | ||
|
|
d20b401d1b | ||
|
|
8c848640b3 | ||
|
|
831aebce72 | ||
|
|
c30a7ff7e5 | ||
|
|
655a1097a6 | ||
|
|
300be32995 | ||
|
|
d062db000f | ||
|
|
41a04a213e | ||
|
|
806d3c5bf2 | ||
|
|
9b098a8dba | ||
|
|
119c41470d | ||
|
|
a6e303e89e | ||
|
|
275f8a3a95 | ||
|
|
b6db010663 | ||
|
|
bb9c01d77b | ||
|
|
32c13321e7 | ||
|
|
4f61c6e05f | ||
|
|
906a026df1 | ||
|
|
9cd50c590e | ||
|
|
d9196c8135 | ||
|
|
cee6075cda | ||
|
|
9debb42671 | ||
|
|
26e8b90813 | ||
|
|
887cbb215b | ||
|
|
eeeb204407 | ||
|
|
d43795a7a8 | ||
|
|
8da08e85fc | ||
|
|
fdae4db922 | ||
|
|
839dd30dcf | ||
|
|
3a0aa5a0b5 | ||
|
|
34407e985d | ||
|
|
16badfe907 | ||
|
|
e534e78497 | ||
|
|
261d8c4bf9 | ||
|
|
b2644a7deb | ||
|
|
3d5e302f6d | ||
|
|
bc7994a1ef | ||
|
|
a09cdf1a14 | ||
|
|
28a5884fce | ||
|
|
e0271df732 | ||
|
|
82b43093b4 | ||
|
|
cfc5177808 | ||
|
|
113beb03ea | ||
|
|
1601fdb733 | ||
|
|
396fe5cf50 | ||
|
|
c84da05ca6 | ||
|
|
59fd0fcd5b | ||
|
|
5a88b6edb8 | ||
|
|
fbc5369c73 | ||
|
|
7f10d74dd3 | ||
|
|
025e0d4ba8 | ||
|
|
c5f1d3ba49 | ||
|
|
0dcc919b64 | ||
|
|
48aa04cc90 | ||
|
|
5b9e4e49dd | ||
|
|
abf0e29960 | ||
|
|
ae484588d7 | ||
|
|
36d1bb04a4 | ||
|
|
148860a0e0 | ||
|
|
1919fa1881 | ||
|
|
92cead7b60 | ||
|
|
90d3cc2f62 | ||
|
|
bebabe6f2e | ||
|
|
182bc0bdba | ||
|
|
f76447a07f | ||
|
|
6a3999f05a | ||
|
|
53c8b2569f | ||
|
|
1de3312ae2 | ||
|
|
7dbb291b72 | ||
|
|
214410065f | ||
|
|
acd2f83b0d |
28
mozilla/modules/libreg/Makefile.in
Normal file
28
mozilla/modules/libreg/Makefile.in
Normal file
@@ -0,0 +1,28 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = include src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
6
mozilla/modules/libreg/include/MANIFEST
Normal file
6
mozilla/modules/libreg/include/MANIFEST
Normal file
@@ -0,0 +1,6 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
VerReg.h
|
||||
NSReg.h
|
||||
30
mozilla/modules/libreg/include/Makefile.in
Normal file
30
mozilla/modules/libreg/include/Makefile.in
Normal file
@@ -0,0 +1,30 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = libreg
|
||||
|
||||
EXPORTS = VerReg.h NSReg.h
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
249
mozilla/modules/libreg/include/NSReg.h
Normal file
249
mozilla/modules/libreg/include/NSReg.h
Normal file
@@ -0,0 +1,249 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/* NSReg.h
|
||||
*/
|
||||
#ifndef _NSREG_H_
|
||||
#define _NSREG_H_
|
||||
|
||||
#include "xp_core.h"
|
||||
|
||||
typedef void (*nr_RegPackCallbackFunc) (void *userData, int32 bytes, int32 totalBytes);
|
||||
|
||||
typedef int32 REGERR;
|
||||
typedef int32 RKEY;
|
||||
typedef uint32 REGENUM;
|
||||
typedef void * HREG;
|
||||
|
||||
typedef struct _reginfo
|
||||
{
|
||||
uint16 size; /* must be initialized to sizeof(REGINFO) */
|
||||
uint16 entryType;
|
||||
uint32 entryLength;
|
||||
} REGINFO;
|
||||
|
||||
#define REGERR_OK (0)
|
||||
#define REGERR_FAIL (1)
|
||||
#define REGERR_NOMORE (2)
|
||||
#define REGERR_NOFIND (3)
|
||||
#define REGERR_BADREAD (4)
|
||||
#define REGERR_BADLOCN (5)
|
||||
#define REGERR_PARAM (6)
|
||||
#define REGERR_BADMAGIC (7)
|
||||
#define REGERR_BADCHECK (8)
|
||||
#define REGERR_NOFILE (9)
|
||||
#define REGERR_MEMORY (10)
|
||||
#define REGERR_BUFTOOSMALL (11)
|
||||
#define REGERR_NAMETOOLONG (12)
|
||||
#define REGERR_REGVERSION (13)
|
||||
#define REGERR_DELETED (14)
|
||||
#define REGERR_BADTYPE (15)
|
||||
#define REGERR_NOPATH (16)
|
||||
#define REGERR_BADNAME (17)
|
||||
#define REGERR_READONLY (18)
|
||||
#define REGERR_BADUTF8 (19)
|
||||
|
||||
|
||||
/* Total path length */
|
||||
#define MAXREGPATHLEN (2048)
|
||||
/* Name on the path (including null terminator) */
|
||||
#define MAXREGNAMELEN (512)
|
||||
/* Value of an entry */
|
||||
#define MAXREGVALUELEN (0x7FFF)
|
||||
|
||||
/* Standard keys */
|
||||
#define ROOTKEY_USERS (0x01)
|
||||
#define ROOTKEY_COMMON (0x02)
|
||||
#define ROOTKEY_CURRENT_USER (0x03)
|
||||
#define ROOTKEY_PRIVATE (0x04)
|
||||
|
||||
/* enumeration styles */
|
||||
#define REGENUM_NORMAL (0x00)
|
||||
#define REGENUM_CHILDREN REGENUM_NORMAL
|
||||
#define REGENUM_DESCEND (0x01)
|
||||
#define REGENUM_DEPTH_FIRST (0x02)
|
||||
|
||||
/* entry data types */
|
||||
#define REGTYPE_ENTRY (0x0010)
|
||||
#define REGTYPE_ENTRY_STRING_UTF (REGTYPE_ENTRY + 1)
|
||||
#define REGTYPE_ENTRY_INT32_ARRAY (REGTYPE_ENTRY + 2)
|
||||
#define REGTYPE_ENTRY_BYTES (REGTYPE_ENTRY + 3)
|
||||
#define REGTYPE_ENTRY_FILE (REGTYPE_ENTRY + 4)
|
||||
|
||||
#define REG_DELETE_LIST_KEY "Netscape/Communicator/SoftwareUpdate/Delete List"
|
||||
#define REG_REPLACE_LIST_KEY "Netscape/Communicator/SoftwareUpdate/Replace List"
|
||||
#define REG_UNINSTALL_DIR "Netscape/Communicator/SoftwareUpdate/Uninstall/"
|
||||
|
||||
#define UNINSTALL_NAV_STR "_"
|
||||
|
||||
|
||||
#define UNIX_GLOBAL_FLAG "MOZILLA_SHARED_REGISTRY"
|
||||
|
||||
/* Platform-dependent declspec for library interface */
|
||||
#if defined(XP_PC)
|
||||
#if defined(WIN32)
|
||||
|
||||
#if defined (STANDALONE_REGISTRY)
|
||||
#define VR_INTERFACE(type) __declspec(dllexport) type __cdecl
|
||||
#else
|
||||
#define VR_INTERFACE(type) __declspec(dllexport) type __stdcall
|
||||
#endif
|
||||
|
||||
#elif defined(XP_OS2)
|
||||
#define VR_INTERFACE(type) type _Optlink
|
||||
#else
|
||||
#define VR_INTERFACE(type) type _far _pascal _export
|
||||
#endif
|
||||
#elif defined XP_MAC
|
||||
#define VR_INTERFACE(__x) __declspec(export) __x
|
||||
#else
|
||||
#define VR_INTERFACE(type) type
|
||||
#endif
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
/* ---------------------------------------------------------------------
|
||||
* Registry API -- General
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegOpen(
|
||||
char *filename, /* reg. file to open (NULL == standard registry) */
|
||||
HREG *hReg /* OUT: handle to opened registry */
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegClose(
|
||||
HREG hReg /* handle of open registry to close */
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegPack(
|
||||
HREG hReg, /* handle of open registry to pack */
|
||||
void *userData,
|
||||
nr_RegPackCallbackFunc fn
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegGetUsername(
|
||||
char **name /* on return, an alloc'ed copy of the current user name */
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegSetUsername(
|
||||
const char *name /* name of current user */
|
||||
);
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Registry API -- Key Management functions
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegAddKey(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* root key */
|
||||
char *path, /* relative path of subkey to add */
|
||||
RKEY *newKey /* if not null returns newly created key */
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegDeleteKey(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* root key */
|
||||
char *path /* relative path of subkey to delete */
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegGetKey(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* root key */
|
||||
char *path, /* relative path of subkey to find */
|
||||
RKEY *result /* returns RKEY of specified sub-key */
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegEnumSubkeys(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
REGENUM *state, /* enum state, must be NULL to start */
|
||||
char *buffer, /* buffer for entry names */
|
||||
uint32 bufsize, /* size of buffer */
|
||||
uint32 style /* 0: children only; REGENUM_DESCEND: sub-tree */
|
||||
);
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Registry API -- Entry Management functions
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegGetEntryInfo(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
char *name, /* entry name */
|
||||
REGINFO *info /* returned entry info */
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegGetEntryString(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
char *name, /* entry name */
|
||||
char *buffer, /* buffer to hold value (UTF String) */
|
||||
uint32 bufsize /* length of buffer */
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegGetEntry(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
char *name, /* entry name */
|
||||
void *buffer, /* buffer to hold value */
|
||||
uint32 *size /* in:length of buffer */
|
||||
); /* out: data length, >>includes<< null terminator*/
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegSetEntryString(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
char *name, /* entry name */
|
||||
char *buffer /* UTF String value */
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegSetEntry(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
char *name, /* entry name */
|
||||
uint16 type, /* type of value data */
|
||||
void *buffer, /* data buffer */
|
||||
uint32 size /* data length in bytes; incl. null term for strings */
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegDeleteEntry(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
char *name /* value name */
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegEnumEntries(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
REGENUM *state, /* enum state, must be NULL to start */
|
||||
char *buffer, /* buffer for entry names */
|
||||
uint32 bufsize, /* size of buffer */
|
||||
REGINFO *info /* optional; returns info about entry */
|
||||
);
|
||||
|
||||
|
||||
VR_INTERFACE(void) NR_ShutdownRegistry(void);
|
||||
VR_INTERFACE(void) NR_StartupRegistry(void);
|
||||
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* _NSREG_H_ */
|
||||
|
||||
/* EOF: NSReg.h */
|
||||
|
||||
82
mozilla/modules/libreg/include/VerReg.h
Normal file
82
mozilla/modules/libreg/include/VerReg.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/* VerReg.h
|
||||
* XP Version Registry functions
|
||||
*/
|
||||
#ifndef _VERREG_H_
|
||||
#define _VERREG_H_
|
||||
|
||||
#include "NSReg.h"
|
||||
|
||||
typedef struct _version
|
||||
{
|
||||
int32 major;
|
||||
int32 minor;
|
||||
int32 release;
|
||||
int32 build;
|
||||
int32 check;
|
||||
} VERSION;
|
||||
|
||||
|
||||
/* CreateRegistry flags */
|
||||
#define CR_NEWREGISTRY 1
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
/* ---------------------------------------------------------------------
|
||||
* Version Registry Operations
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
/* global registry operations */
|
||||
VR_INTERFACE(REGERR) VR_SetRegDirectory(const char *path);
|
||||
VR_INTERFACE(REGERR) VR_CreateRegistry(char *installation, char *programPath, char *versionStr);
|
||||
VR_INTERFACE(REGERR) VR_PackRegistry(void *userData, nr_RegPackCallbackFunc pdCallbackFunction);
|
||||
VR_INTERFACE(REGERR) VR_Close(void);
|
||||
|
||||
/* component-level functions */
|
||||
VR_INTERFACE(REGERR) VR_Install(char *component_path, char *filepath, char *version, int bDirectory);
|
||||
VR_INTERFACE(REGERR) VR_Remove(char *component_path);
|
||||
VR_INTERFACE(REGERR) VR_InRegistry(char *path);
|
||||
VR_INTERFACE(REGERR) VR_ValidateComponent(char *path);
|
||||
VR_INTERFACE(REGERR) VR_Enum(char *component_path, REGENUM *state, char *buffer, uint32 buflen);
|
||||
|
||||
/* dealing with parts of individual components */
|
||||
VR_INTERFACE(REGERR) VR_GetVersion(char *component_path, VERSION *result);
|
||||
VR_INTERFACE(REGERR) VR_GetPath(char *component_path, uint32 sizebuf, char *buf);
|
||||
VR_INTERFACE(REGERR) VR_SetRefCount(char *component_path, int refcount);
|
||||
VR_INTERFACE(REGERR) VR_GetRefCount(char *component_path, int *result);
|
||||
VR_INTERFACE(REGERR) VR_GetDefaultDirectory(char *component_path, uint32 sizebuf, char *buf);
|
||||
VR_INTERFACE(REGERR) VR_SetDefaultDirectory(char *component_path, char *directory);
|
||||
|
||||
/* uninstall functions */
|
||||
VR_INTERFACE(REGERR) VR_UninstallCreateNode(char *regPackageName, char *userPackageName);
|
||||
VR_INTERFACE(REGERR) VR_UninstallAddFileToList(char *regPackageName, char *vrName);
|
||||
VR_INTERFACE(REGERR) VR_UninstallFileExistsInList(char *regPackageName, char *vrName);
|
||||
VR_INTERFACE(REGERR) VR_UninstallEnumSharedFiles(char *component_path, REGENUM *state, char *buffer, uint32 buflen);
|
||||
VR_INTERFACE(REGERR) VR_UninstallDeleteFileFromList(char *component_path, char *vrName);
|
||||
VR_INTERFACE(REGERR) VR_UninstallDeleteSharedFilesKey(char *regPackageName);
|
||||
VR_INTERFACE(REGERR) VR_UninstallDestroy(char *regPackageName);
|
||||
VR_INTERFACE(REGERR) VR_EnumUninstall(REGENUM *state, char* userPackageName,
|
||||
int32 len1, char*regPackageName, int32 len2, Bool bSharedList);
|
||||
VR_INTERFACE(REGERR) VR_GetUninstallUserName(char *regPackageName, char *outbuf, uint32 buflen);
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* _VERREG_H_ */
|
||||
|
||||
/* EOF: VerReg.h */
|
||||
|
||||
34
mozilla/modules/libreg/include/makefile.win
Normal file
34
mozilla/modules/libreg/include/makefile.win
Normal file
@@ -0,0 +1,34 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
#
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to install MODULES/LIBREG/INCLUDE header files into the distribution
|
||||
#// directory.
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
MODULE=libreg
|
||||
DEPTH=..\..\..
|
||||
EXPORTS=VerReg.h NSReg.h
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
||||
3
mozilla/modules/libreg/macbuild/StandalonePrefix.h
Normal file
3
mozilla/modules/libreg/macbuild/StandalonePrefix.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "MacPrefix.h"
|
||||
|
||||
#define STANDALONE_REGISTRY 1
|
||||
BIN
mozilla/modules/libreg/macbuild/libreg.mcp
Normal file
BIN
mozilla/modules/libreg/macbuild/libreg.mcp
Normal file
Binary file not shown.
26
mozilla/modules/libreg/macbuild/libreg.mcp.exp
Normal file
26
mozilla/modules/libreg/macbuild/libreg.mcp.exp
Normal file
@@ -0,0 +1,26 @@
|
||||
globalRegName
|
||||
NR_ShutdownRegistry
|
||||
NR_StartupRegistry
|
||||
NR_RegEnumEntries
|
||||
NR_RegEnumSubkeys
|
||||
NR_RegDeleteEntry
|
||||
NR_RegSetEntry
|
||||
NR_RegSetEntryString
|
||||
NR_RegGetEntry
|
||||
NR_RegGetEntryString
|
||||
NR_RegGetEntryInfo
|
||||
NR_RegGetKey
|
||||
NR_RegDeleteKey
|
||||
NR_RegAddKey
|
||||
NR_RegPack
|
||||
NR_RegClose
|
||||
NR_RegOpen
|
||||
NR_RegSetUsername
|
||||
NR_RegGetUsername
|
||||
nr_PathFromMacAlias
|
||||
nr_MacAliasFromPath
|
||||
vr_findGlobalRegName
|
||||
#__ptmf_null
|
||||
#longjmp
|
||||
#__terminate
|
||||
#__initialize
|
||||
48
mozilla/modules/libreg/makefile.win
Normal file
48
mozilla/modules/libreg/makefile.win
Normal file
@@ -0,0 +1,48 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build the MODULES\LIBREG tree
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the depth of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH=..\..
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
|
||||
#// (these must come before the common makefiles are included)
|
||||
#//
|
||||
#// DIRS - There are subdirectories to process
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
DIRS=include src standalone
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
82
mozilla/modules/libreg/src/Makefile.in
Normal file
82
mozilla/modules/libreg/src/Makefile.in
Normal file
@@ -0,0 +1,82 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = libreg
|
||||
LIBRARY_NAME = reg
|
||||
|
||||
REQUIRES = libreg pref js
|
||||
|
||||
CSRCS = reg.c VerReg.c vr_stubs.c
|
||||
|
||||
BIN_SRCS = VerReg.c reg.c vr_stubs.c
|
||||
BIN_OBJS = $(addprefix $(OBJDIR)/R_,$(BIN_SRCS:.c=.o))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# Override gtscc when building vreg on IRIX 5.3.
|
||||
ifeq ($(OS_ARCH)$(OS_RELEASE),IRIX5)
|
||||
CC = cc
|
||||
endif
|
||||
|
||||
INCLUDES += -I$(topsrcdir)/include
|
||||
GARBAGE += $(PROGRAM)
|
||||
|
||||
PROGRAM = $(OBJDIR)/vreg$(BIN_SUFFIX)
|
||||
|
||||
$(PROGRAM): $(BIN_OBJS)
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq ($(OS_ARCH), OS2)
|
||||
$(LINK_EXE) -OUT:$@ $(BIN_OBJS) $(LDFLAGS) $(OS_LIBS)
|
||||
else
|
||||
$(CCF) -o $@ $(BIN_OBJS) $(LDFLAGS)
|
||||
endif
|
||||
|
||||
$(OBJDIR)/R_VerReg.o: VerReg.c
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq ($(OS_ARCH), OS2)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) -DSTANDALONE_REGISTRY $<
|
||||
else
|
||||
$(CC) -o $@ -c $(CFLAGS) -DSTANDALONE_REGISTRY $<
|
||||
endif
|
||||
|
||||
$(OBJDIR)/R_reg.o: reg.c
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq ($(OS_ARCH), OS2)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) -DSTANDALONE_REGISTRY $<
|
||||
else
|
||||
$(CC) -o $@ -c $(CFLAGS) -DSTANDALONE_REGISTRY $<
|
||||
endif
|
||||
|
||||
$(OBJDIR)/R_vr_stubs.o: vr_stubs.c
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq ($(OS_ARCH), OS2)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) -DSTANDALONE_REGISTRY $<
|
||||
else
|
||||
$(CC) -o $@ -c $(CFLAGS) -DSTANDALONE_REGISTRY $<
|
||||
endif
|
||||
|
||||
$(BIN_OBJS): $(BIN_SRCS)
|
||||
|
||||
install:: $(PROGRAM)
|
||||
$(INSTALL) -m 444 $(PROGRAM) $(DIST)/bin
|
||||
1871
mozilla/modules/libreg/src/VerReg.c
Normal file
1871
mozilla/modules/libreg/src/VerReg.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,23 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
IGNORE_MANIFEST=1
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build the machine independent java runtime library
|
||||
#// Makefile to build
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
@@ -11,7 +28,11 @@
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH= ..\..
|
||||
DEPTH= ..\..\..
|
||||
|
||||
!ifndef MAKE_OBJ_TYPE
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
!endif
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
@@ -19,20 +40,18 @@ DEPTH= ..\..
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
DLLNAME = sm$(MOZ_BITS)$(VERSION_NUMBER)
|
||||
PDBFILE = $(DLLNAME).pdb
|
||||
MAPFILE = $(DLLNAME).map
|
||||
DLL =.\$(OBJDIR)\$(DLLNAME).dll
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define the files necessary to build the target (ie. OBJS)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
OBJS= \
|
||||
.\$(OBJDIR)\reg.obj \
|
||||
.\$(OBJDIR)\VerReg.obj \
|
||||
.\$(OBJDIR)\vr_stubs.obj \
|
||||
$(NULL)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
|
||||
@@ -40,6 +59,11 @@ include <$(DEPTH)\config\config.mak>
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
LIBNAME=libreg$(MOZ_BITS)
|
||||
|
||||
DLL=$(OBJDIR)\$(LIBNAME).dll
|
||||
LIBRARY= .\$(OBJDIR)\$(LIBNAME).lib
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any local options for the make tools
|
||||
@@ -47,24 +71,32 @@ include <$(DEPTH)\config\config.mak>
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#LCFLAGS = -DSM_NO_TABLE_DIVISION -DSM_DUMP -DSM_VERIFY=2
|
||||
LCFLAGS = -DSM_NO_TABLE_DIVISION -DSM_DUMP
|
||||
!ifndef MOZ_PROF # assume we use a write barrier when profiling
|
||||
LCFLAGS = $(LCFLAGS) -DSM_NO_WRITE_BARRIER -DSM_CHECK_PTRS -DSM_DEBUG_HEADER
|
||||
LCFLAGS = $(LCFLAGS)
|
||||
LLIBS = $(LLIBS) $(LIBNSPR) $(DIST)\lib\libplc21.lib
|
||||
|
||||
!if "$(MOZ_BITS)"=="32" && defined(MOZ_DEBUG) && defined(GLOWCODE)
|
||||
LLIBS=$(LLIBS) $(GLOWDIR)\glowcode.lib
|
||||
!endif
|
||||
|
||||
LLIBS= $(LLIBS) \
|
||||
$(DEPTH)\dist\WIN32_D.OBJ\lib\libnspr21.lib \
|
||||
$(DEPTH)\dist\WIN32_D.OBJ\lib\libplds21.lib \
|
||||
#//
|
||||
#// Win16 places ALL public header files in $(PUBLIC)/win16
|
||||
#//
|
||||
!if "$(MOZ_BITS)" != "16"
|
||||
LINCS= $(LINCS) -I$(PUBLIC)/libreg \
|
||||
$(NULL)
|
||||
!endif
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
export:: $(DLL)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
$(MAKE_INSTALL) $(DLL) $(DIST)\bin
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||
clobber::
|
||||
$(RM) $(DIST)\bin\$(DLL)
|
||||
$(RM) $(DIST)\lib\$(LIBRARY)
|
||||
3631
mozilla/modules/libreg/src/reg.c
Normal file
3631
mozilla/modules/libreg/src/reg.c
Normal file
File diff suppressed because it is too large
Load Diff
175
mozilla/modules/libreg/src/reg.h
Normal file
175
mozilla/modules/libreg/src/reg.h
Normal file
@@ -0,0 +1,175 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/* reg.h
|
||||
* XP Registry functions (prototype)
|
||||
*/
|
||||
|
||||
#ifndef _REG_H_
|
||||
#define _REG_H_
|
||||
|
||||
#include "vr_stubs.h"
|
||||
|
||||
#ifndef STANDALONE_REGISTRY
|
||||
#include "prmon.h"
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* Miscellaneous Definitions
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
#define MAGIC_NUMBER 0x76644441L
|
||||
#define MAJOR_VERSION 1 /* major version for incompatible changes */
|
||||
#define MINOR_VERSION 2 /* minor ver for new (compatible) features */
|
||||
#define PATHDEL '/'
|
||||
#define EQU '='
|
||||
#define QUOTE '"'
|
||||
#define HDRRESERVE 128 /* number of bytes reserved for hdr */
|
||||
#define INTSIZE 4
|
||||
#define DOUBLESIZE 8
|
||||
|
||||
#define PACKBUFFERSIZE 2048
|
||||
|
||||
|
||||
/* Node types */
|
||||
#define REGTYPE_KEY (1)
|
||||
#define REGTYPE_DELETED (0x0080)
|
||||
|
||||
/* Private standard keys */
|
||||
#define ROOTKEY (0x20)
|
||||
#define ROOTKEY_VERSIONS (0x21)
|
||||
|
||||
/* strings for standard keys */
|
||||
#define ROOTKEY_STR "/"
|
||||
#define ROOTKEY_VERSIONS_STR "Version Registry"
|
||||
#define ROOTKEY_USERS_STR "Users"
|
||||
#define ROOTKEY_COMMON_STR "Common"
|
||||
#define ROOTKEY_PRIVATE_STR "Private Arenas"
|
||||
|
||||
#define OLD_VERSIONS_STR "ROOTKEY_VERSIONS"
|
||||
#define OLD_USERS_STR "ROOTKEY_USERS"
|
||||
#define OLD_COMMON_STR "ROOTKEY_COMMON"
|
||||
|
||||
/* needs to be kept in sync with PE. see ns/cmd/winfe/profile.h */
|
||||
/* and ns/cmd/macfe/central/profile.cp */
|
||||
#define ASW_MAGIC_PROFILE_NAME "User1"
|
||||
|
||||
/* macros */
|
||||
#define COPYDESC(dest,src) memcpy((dest),(src),sizeof(REGDESC))
|
||||
|
||||
#define VALID_FILEHANDLE(fh) ((fh) != NULL)
|
||||
|
||||
#define INVALID_NAME_CHAR(p) ( ((unsigned char)(p) < 0x20) || ((p) == '=') )
|
||||
|
||||
#define TYPE_IS_ENTRY(type) ( (type) & REGTYPE_ENTRY )
|
||||
#define TYPE_IS_KEY(type) ( !((type) & REGTYPE_ENTRY) )
|
||||
|
||||
#define VERIFY_HREG(h)\
|
||||
( ((h) == NULL) ? REGERR_PARAM : \
|
||||
( (((REGHANDLE*)(h))->magic == MAGIC_NUMBER) ? REGERR_OK : REGERR_BADMAGIC ) )
|
||||
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* Types and Objects
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
#undef REGOFF
|
||||
typedef int32 REGOFF; /* offset into registry file */
|
||||
|
||||
typedef struct _desc
|
||||
{
|
||||
REGOFF location; /* this object's offset (for verification) */
|
||||
REGOFF name; /* name string */
|
||||
uint16 namelen; /* length of name string (including terminator) */
|
||||
uint16 type; /* node type (key, or entry style) */
|
||||
REGOFF left; /* next object at this level (0 if none) */
|
||||
REGOFF down; /* KEY: first subkey VALUE: 0 */
|
||||
REGOFF value; /* KEY: first entry object VALUE: value string */
|
||||
uint32 valuelen; /* KEY: 0 VALUE: length of value data */
|
||||
uint32 valuebuf; /* KEY: 0 VALUE: length available */
|
||||
REGOFF parent; /* the node on the immediate level above */
|
||||
} REGDESC;
|
||||
|
||||
/* offsets into structure on disk */
|
||||
#define DESC_LOCATION 0
|
||||
#define DESC_NAME 4
|
||||
#define DESC_NAMELEN 8
|
||||
#define DESC_TYPE 10
|
||||
#define DESC_LEFT 12
|
||||
#define DESC_DOWN 16
|
||||
#define DESC_VALUE 20
|
||||
#define DESC_VALUELEN 24
|
||||
#define DESC_VALUEBUF 16 /* stored in place of "down" for entries */
|
||||
#define DESC_PARENT 28
|
||||
|
||||
#define DESC_SIZE 32 /* size of desc on disk */
|
||||
|
||||
typedef struct _hdr
|
||||
{
|
||||
uint32 magic; /* must equal MAGIC_NUMBER */
|
||||
uint16 verMajor; /* major version number */
|
||||
uint16 verMinor; /* minor version number */
|
||||
REGOFF avail; /* next available offset */
|
||||
REGOFF root; /* root object */
|
||||
} REGHDR;
|
||||
|
||||
/* offsets into structure on disk*/
|
||||
#define HDR_MAGIC 0
|
||||
#define HDR_VERMAJOR 4
|
||||
#define HDR_VERMINOR 6
|
||||
#define HDR_AVAIL 8
|
||||
#define HDR_ROOT 12
|
||||
|
||||
typedef XP_File FILEHANDLE; /* platform-specific file reference */
|
||||
|
||||
typedef struct _stdnodes {
|
||||
REGOFF versions;
|
||||
REGOFF users;
|
||||
REGOFF common;
|
||||
REGOFF current_user;
|
||||
REGOFF privarea;
|
||||
} STDNODES;
|
||||
|
||||
typedef struct _regfile
|
||||
{
|
||||
FILEHANDLE fh;
|
||||
REGHDR hdr;
|
||||
int refCount;
|
||||
int hdrDirty;
|
||||
int inInit;
|
||||
int readOnly;
|
||||
char * filename;
|
||||
STDNODES rkeys;
|
||||
struct _regfile *next;
|
||||
struct _regfile *prev;
|
||||
#ifndef STANDALONE_REGISTRY
|
||||
PRMonitor *monitor;
|
||||
#endif
|
||||
} REGFILE;
|
||||
|
||||
typedef struct _reghandle
|
||||
{
|
||||
uint32 magic; /* for validating reg handles */
|
||||
REGFILE *pReg; /* the real registry file object */
|
||||
} REGHANDLE;
|
||||
|
||||
|
||||
#endif /* _REG_H_ */
|
||||
|
||||
/* EOF: reg.h */
|
||||
|
||||
554
mozilla/modules/libreg/src/vr_stubs.c
Normal file
554
mozilla/modules/libreg/src/vr_stubs.c
Normal file
@@ -0,0 +1,554 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* this file contains stubs needed to build the registry routines
|
||||
* into a stand-alone library for use with our installers
|
||||
*/
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#else
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "plstr.h"
|
||||
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
#include "vr_stubs.h"
|
||||
|
||||
#ifdef XP_MAC
|
||||
#include <Folders.h>
|
||||
#include <Script.h>
|
||||
#include <stdlib.h>
|
||||
#include <Errors.h>
|
||||
#include "MoreFiles.h"
|
||||
#include "FullPath.h" /* For FSpLocationFromFullPath() */
|
||||
#endif
|
||||
|
||||
extern char* globalRegName;
|
||||
/* ------------------------------------------------------------------
|
||||
* OS/2 STUBS
|
||||
* ------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef XP_OS2
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
extern XP_File vr_fileOpen (const char *name, const char * mode)
|
||||
{
|
||||
XP_File fh = NULL;
|
||||
struct stat st;
|
||||
|
||||
if ( name != NULL ) {
|
||||
if ( stat( name, &st ) == 0 )
|
||||
fh = fopen( name, XP_FILE_UPDATE_BIN );
|
||||
else
|
||||
fh = fopen( name, XP_FILE_WRITE_BIN );
|
||||
}
|
||||
|
||||
return fh;
|
||||
}
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
extern void vr_findGlobalRegName ()
|
||||
{
|
||||
char path[ CCHMAXPATH ];
|
||||
int pathlen;
|
||||
XP_File fh = NULL;
|
||||
struct stat st;
|
||||
|
||||
#ifdef XP_OS2_HACK
|
||||
/*DSR050197 - at this point, I need some front-end call to get the install directory of*/
|
||||
/*communicator... for now I will let it default to the current directory...*/
|
||||
#endif
|
||||
XP_STRCPY(path, ".");
|
||||
pathlen = strlen(path);
|
||||
|
||||
if ( pathlen > 0 ) {
|
||||
XP_STRCPY( path+pathlen, "\\nsreg.dat" );
|
||||
globalRegName = XP_STRDUP(path);
|
||||
}
|
||||
}
|
||||
#endif /* XP_OS2 */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* WINDOWS STUBS
|
||||
* ------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef XP_PC
|
||||
#include "windows.h"
|
||||
#define PATHLEN 260
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
extern XP_File vr_fileOpen (const char *name, const char * mode)
|
||||
{
|
||||
XP_File fh = NULL;
|
||||
struct stat st;
|
||||
|
||||
if ( name != NULL ) {
|
||||
if ( stat( name, &st ) == 0 )
|
||||
fh = fopen( name, XP_FILE_UPDATE_BIN );
|
||||
else
|
||||
fh = fopen( name, XP_FILE_WRITE_BIN );
|
||||
}
|
||||
|
||||
return fh;
|
||||
}
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
extern void vr_findGlobalRegName ()
|
||||
{
|
||||
char path[ PATHLEN ];
|
||||
int pathlen;
|
||||
|
||||
pathlen = GetWindowsDirectory(path, PATHLEN);
|
||||
if ( pathlen > 0 ) {
|
||||
XP_STRCPY( path+pathlen, "\\nsreg.dat" );
|
||||
globalRegName = XP_STRDUP(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if !defined(WIN32) && !defined(__BORLANDC__)
|
||||
int FAR PASCAL _export WEP(int);
|
||||
|
||||
int FAR PASCAL LibMain(HANDLE hInst, WORD wDataSeg, WORD wHeapSize, LPSTR lpszCmdLine)
|
||||
{
|
||||
if ( wHeapSize > 0 )
|
||||
UnlockData(0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int FAR PASCAL _export WEP(int nParam)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif /* not WIN32 */
|
||||
|
||||
#endif /* XP_PC */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* MACINTOSH STUBS
|
||||
* ------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef XP_MAC
|
||||
#include <Files.h>
|
||||
#include "FullPath.h"
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
extern XP_File vr_fileOpen(const char *name, const char * mode)
|
||||
{
|
||||
XP_File fh = NULL;
|
||||
struct stat st;
|
||||
OSErr anErr;
|
||||
FSSpec newFSSpec;
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
errno = 0; // reset errno (only if we're using stdio)
|
||||
#endif
|
||||
|
||||
anErr = FSpLocationFromFullPath(strlen(name), name, &newFSSpec);
|
||||
|
||||
if (anErr == -43)
|
||||
{
|
||||
/* if file doesn't exist */
|
||||
anErr = FSpCreate(&newFSSpec, 'MOSS', 'REGS', smSystemScript);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* there is not much to do here. if we got noErr, the file exists. If we did not get
|
||||
noErr or -43, we are pretty hosed.
|
||||
*/
|
||||
}
|
||||
|
||||
if ( name != NULL ) {
|
||||
if ( stat( name, &st ) == 0 )
|
||||
fh = fopen( name, XP_FILE_UPDATE_BIN ); /* If/when we switch to MSL C Lib (gromit uses this), we might have to take out the Macro per bug #62382 */
|
||||
else
|
||||
{
|
||||
/* should never get here! */
|
||||
fh = fopen( name, XP_FILE_WRITE_BIN );
|
||||
}
|
||||
}
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
if (anErr != noErr)
|
||||
errno = anErr;
|
||||
#endif
|
||||
return fh;
|
||||
}
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
extern void vr_findGlobalRegName()
|
||||
{
|
||||
FSSpec regSpec;
|
||||
OSErr err;
|
||||
short foundVRefNum;
|
||||
long foundDirID;
|
||||
int bCreate = 0;
|
||||
|
||||
err = FindFolder(kOnSystemDisk,'pref', false, &foundVRefNum, &foundDirID);
|
||||
|
||||
if (!err)
|
||||
{
|
||||
err = FSMakeFSSpec(foundVRefNum, foundDirID, "\pNetscape Registry", ®Spec);
|
||||
|
||||
if (err == -43) /* if file doesn't exist */
|
||||
{
|
||||
err = FSpCreate(®Spec, 'MOSS', 'REGS', smSystemScript);
|
||||
bCreate = 1;
|
||||
}
|
||||
|
||||
if (err == noErr)
|
||||
{
|
||||
Handle thePath;
|
||||
short pathLen;
|
||||
err = FSpGetFullPath(®Spec, &pathLen, &thePath);
|
||||
if (err == noErr && thePath)
|
||||
{
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
globalRegName = XP_STRDUP(*(char**)thePath);
|
||||
#else
|
||||
/* Since we're now using NSPR, this HAS to be a unix path! */
|
||||
const char* src;
|
||||
char* dst;
|
||||
globalRegName = (char*)XP_ALLOC(pathLen + 2);
|
||||
src = *(char**)thePath;
|
||||
dst = globalRegName;
|
||||
*dst++ = '/';
|
||||
while (pathLen--)
|
||||
{
|
||||
char c = *src++;
|
||||
*dst++ = (c == ':') ? '/' : c;
|
||||
}
|
||||
*dst = '\0';
|
||||
#endif
|
||||
}
|
||||
DisposeHandle(thePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Moves and renames a file or directory.
|
||||
Returns 0 on success, -1 on failure (errno contains mac error code).
|
||||
*/
|
||||
extern int nr_RenameFile(char *from, char *to)
|
||||
{
|
||||
OSErr err = -1;
|
||||
FSSpec fromSpec;
|
||||
FSSpec toSpec;
|
||||
FSSpec destDirSpec;
|
||||
FSSpec beforeRenameSpec;
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
errno = 0; // reset errno (only if we're using stdio)
|
||||
#endif
|
||||
|
||||
if (from && to) {
|
||||
err = FSpLocationFromFullPath(XP_STRLEN(from), from, &fromSpec);
|
||||
if (err != noErr) goto exit;
|
||||
|
||||
err = FSpLocationFromFullPath(XP_STRLEN(to), to, &toSpec);
|
||||
if (err != noErr && err != fnfErr) goto exit;
|
||||
|
||||
// make an FSSpec for the destination directory
|
||||
err = FSMakeFSSpec(toSpec.vRefNum, toSpec.parID, nil, &destDirSpec);
|
||||
if (err != noErr) goto exit; // parent directory must exist
|
||||
|
||||
// move it to the directory specified
|
||||
err = FSpCatMove(&fromSpec, &destDirSpec);
|
||||
if (err != noErr) goto exit;
|
||||
|
||||
// make a new FSSpec for the file or directory in its new location
|
||||
err = FSMakeFSSpec(toSpec.vRefNum, toSpec.parID, fromSpec.name, &beforeRenameSpec);
|
||||
if (err != noErr) goto exit;
|
||||
|
||||
// rename the file or directory
|
||||
err = FSpRename(&beforeRenameSpec, toSpec.name);
|
||||
}
|
||||
|
||||
exit:
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
if (err != noErr)
|
||||
errno = err;
|
||||
#endif
|
||||
return (err == noErr ? 0 : -1);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/* Uncomment the following for older Mac build environments
|
||||
* that don't support these functions
|
||||
*/
|
||||
char *strdup(const char *source)
|
||||
{
|
||||
char *newAllocation;
|
||||
size_t stringLength;
|
||||
|
||||
stringLength = strlen(source) + 1;
|
||||
|
||||
newAllocation = (char *)XP_ALLOC(stringLength);
|
||||
if (newAllocation == NULL)
|
||||
return NULL;
|
||||
BlockMoveData(source, newAllocation, stringLength);
|
||||
return newAllocation;
|
||||
}
|
||||
|
||||
int strcasecmp(const char *str1, const char *str2)
|
||||
{
|
||||
char currentChar1, currentChar2;
|
||||
|
||||
while (1) {
|
||||
|
||||
currentChar1 = *str1;
|
||||
currentChar2 = *str2;
|
||||
|
||||
if ((currentChar1 >= 'a') && (currentChar1 <= 'z'))
|
||||
currentChar1 += ('A' - 'a');
|
||||
|
||||
if ((currentChar2 >= 'a') && (currentChar2 <= 'z'))
|
||||
currentChar2 += ('A' - 'a');
|
||||
|
||||
if (currentChar1 == '\0')
|
||||
break;
|
||||
|
||||
if (currentChar1 != currentChar2)
|
||||
return currentChar1 - currentChar2;
|
||||
|
||||
str1++;
|
||||
str2++;
|
||||
|
||||
}
|
||||
|
||||
return currentChar1 - currentChar2;
|
||||
}
|
||||
|
||||
int strncasecmp(const char *str1, const char *str2, int length)
|
||||
{
|
||||
char currentChar1, currentChar2;
|
||||
|
||||
while (length > 0) {
|
||||
|
||||
currentChar1 = *str1;
|
||||
currentChar2 = *str2;
|
||||
|
||||
if ((currentChar1 >= 'a') && (currentChar1 <= 'z'))
|
||||
currentChar1 += ('A' - 'a');
|
||||
|
||||
if ((currentChar2 >= 'a') && (currentChar2 <= 'z'))
|
||||
currentChar2 += ('A' - 'a');
|
||||
|
||||
if (currentChar1 == '\0')
|
||||
break;
|
||||
|
||||
if (currentChar1 != currentChar2)
|
||||
return currentChar1 - currentChar2;
|
||||
|
||||
str1++;
|
||||
str2++;
|
||||
|
||||
length--;
|
||||
}
|
||||
|
||||
return currentChar1 - currentChar2;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
#endif /* XP_MAC */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* UNIX STUBS
|
||||
* ------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*allow OS/2 and Macintosh to use this main to test...*/
|
||||
#if (defined(STANDALONE_REGISTRY) && defined(XP_MAC)) || defined(XP_UNIX) || defined(XP_OS2)
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef XP_OS2
|
||||
#include <io.h>
|
||||
#define W_OK 0x02 /*evil hack from the docs...*/
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "NSReg.h"
|
||||
#include "VerReg.h"
|
||||
|
||||
char *TheRegistry = "registry";
|
||||
char *Flist;
|
||||
|
||||
/* WARNING: build hackery */
|
||||
#if defined(STANDALONE_REGISTRY) && !defined(XP_MAC)
|
||||
long BUILDNUM =
|
||||
#include "../../../build/build_number"
|
||||
;
|
||||
#endif
|
||||
|
||||
|
||||
REGERR vr_ParseVersion(char *verstr, VERSION *result);
|
||||
int main(int argc, char *argv[]);
|
||||
|
||||
#ifdef XP_UNIX
|
||||
|
||||
#define DEF_REG "/.netscape/registry"
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
extern XP_File vr_fileOpen (const char *name, const char * mode)
|
||||
{
|
||||
XP_File fh = NULL;
|
||||
struct stat st;
|
||||
|
||||
if ( name != NULL ) {
|
||||
if ( stat( name, &st ) == 0 )
|
||||
fh = fopen( name, XP_FILE_UPDATE_BIN );
|
||||
else
|
||||
fh = fopen( name, XP_FILE_WRITE_BIN );
|
||||
}
|
||||
|
||||
return fh;
|
||||
}
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
extern void vr_findGlobalRegName ()
|
||||
{
|
||||
#ifndef STANDALONE_REGISTRY
|
||||
char *def = NULL;
|
||||
char *home = getenv("HOME");
|
||||
if (home != NULL) {
|
||||
def = (char *) XP_ALLOC(XP_STRLEN(home) + XP_STRLEN(DEF_REG)+1);
|
||||
if (def != NULL) {
|
||||
XP_STRCPY(def, home);
|
||||
XP_STRCAT(def, DEF_REG);
|
||||
}
|
||||
}
|
||||
if (def != NULL) {
|
||||
globalRegName = XP_STRDUP(def);
|
||||
} else {
|
||||
globalRegName = TheRegistry;
|
||||
}
|
||||
XP_FREEIF(def);
|
||||
#else
|
||||
globalRegName = TheRegistry;
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
}
|
||||
|
||||
#endif /*XP_UNIX*/
|
||||
|
||||
#if defined(STANDALONE_REGISTRY) && (defined(XP_UNIX) || defined(XP_OS2) || defined(XP_MAC))
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
XP_File fh;
|
||||
char *entry;
|
||||
char *p;
|
||||
char *v;
|
||||
char buff[1024];
|
||||
char name[MAXREGPATHLEN+1];
|
||||
char path[MAXREGPATHLEN+1];
|
||||
char ver[MAXREGPATHLEN+1];
|
||||
|
||||
if ( argc >= 3 )
|
||||
{
|
||||
TheRegistry = argv[1];
|
||||
Flist = argv[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Usage: %s RegistryName FileList\n", argv[0]);
|
||||
fprintf(stderr, " The FileList file contains lines with comma-separated fields:\n");
|
||||
fprintf(stderr, " <regItemName>,<version>,<full filepath>\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* tmp use of buff to get the registry directory, which must be
|
||||
* the navigator home directory. Preserve the slash to match
|
||||
* FE_GetDirectoryPath() called during navigator set-up
|
||||
*/
|
||||
|
||||
|
||||
strcpy(buff, TheRegistry);
|
||||
p = strrchr( buff, '/' );
|
||||
if ( p )
|
||||
{
|
||||
char pwd[1024];
|
||||
|
||||
*(p+1) = '\0';
|
||||
getcwd(pwd, sizeof(pwd));
|
||||
chdir(buff); getcwd(buff, sizeof(buff));
|
||||
chdir(pwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
getcwd(buff, sizeof(buff));
|
||||
}
|
||||
strcat(buff, "/");
|
||||
|
||||
|
||||
NR_StartupRegistry();
|
||||
VR_SetRegDirectory(buff);
|
||||
|
||||
|
||||
#ifndef XP_MAC
|
||||
if ( -1 == (access( TheRegistry, W_OK )) ) {
|
||||
sprintf(ver,"4.50.0.%ld",BUILDNUM);
|
||||
VR_CreateRegistry("Communicator", buff, ver);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !(fh = fopen( Flist, "r" )) )
|
||||
{
|
||||
fprintf(stderr, "%s: Cannot open \"%s\"\n", argv[0], Flist);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
while ( fgets ( buff, 1024, fh ) )
|
||||
{
|
||||
if ( *(entry = &buff[strlen(buff)-1]) == '\n' )
|
||||
*entry = '\0';
|
||||
|
||||
entry = strchr(buff, ',');
|
||||
strcpy(name, strtok(buff, ","));
|
||||
strcpy(ver, strtok( NULL, ","));
|
||||
strcpy(path, strtok( NULL, ","));
|
||||
|
||||
v = ver;
|
||||
while (*v && *v == ' ')
|
||||
v++;
|
||||
|
||||
p = path;
|
||||
while (*p && *p == ' ')
|
||||
p++;
|
||||
|
||||
VR_Install ( name, p, v, FALSE );
|
||||
}
|
||||
fclose( fh );
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* STANDALONE_REGISTRY && (XP_UNIX || XP_OS2 || XP_MAC) */
|
||||
|
||||
#endif /* XP_UNIX || XP_OS2 */
|
||||
253
mozilla/modules/libreg/src/vr_stubs.h
Normal file
253
mozilla/modules/libreg/src/vr_stubs.h
Normal file
@@ -0,0 +1,253 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/* vr_stubs.h
|
||||
*
|
||||
* XP code stubs for stand-alone registry library
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _VR_STUBS_H_
|
||||
#define _VR_STUBS_H_
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#ifdef XP_MAC
|
||||
#include "macstdlibextras.h" /* For strcasecmp and strncasecmp */
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#include "prio.h"
|
||||
#include "prmem.h"
|
||||
#include "plstr.h"
|
||||
|
||||
#endif /* STANDALONE_REGISTRY*/
|
||||
|
||||
#ifdef XP_MAC
|
||||
#include <stat.h>
|
||||
#else
|
||||
#if defined(BSDI) && !defined(BSDI_2)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
# define XP_CPLUSPLUS
|
||||
# define XP_IS_CPLUSPLUS 1
|
||||
#else
|
||||
# define XP_IS_CPLUSPLUS 0
|
||||
#endif
|
||||
|
||||
#if defined(XP_CPLUSPLUS)
|
||||
# define XP_BEGIN_PROTOS extern "C" {
|
||||
# define XP_END_PROTOS }
|
||||
#else
|
||||
# define XP_BEGIN_PROTOS
|
||||
# define XP_END_PROTOS
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
|
||||
#define XP_FILE_READ "r"
|
||||
#define XP_FILE_READ_BIN "rb"
|
||||
#define XP_FILE_WRITE "w"
|
||||
#define XP_FILE_WRITE_BIN "wb"
|
||||
#define XP_FILE_UPDATE "r+"
|
||||
#define XP_FILE_TRUNCATE "w+"
|
||||
#ifdef SUNOS4
|
||||
/* XXX SunOS4 hack -- make this universal by using r+b and w+b */
|
||||
#define XP_FILE_UPDATE_BIN "r+"
|
||||
#define XP_FILE_TRUNCATE_BIN "w+"
|
||||
#else
|
||||
#define XP_FILE_UPDATE_BIN "rb+"
|
||||
#define XP_FILE_TRUNCATE_BIN "wb+"
|
||||
#endif
|
||||
|
||||
#define XP_FileSeek(file,offset,whence) fseek((file), (offset), (whence))
|
||||
#define XP_FileRead(dest,count,file) fread((dest), 1, (count), (file))
|
||||
#define XP_FileWrite(src,count,file) fwrite((src), 1, (count), (file))
|
||||
#define XP_FileTell(file) ftell(file)
|
||||
#define XP_FileFlush(file) fflush(file)
|
||||
#define XP_FileClose(file) fclose(file)
|
||||
|
||||
#define XP_ASSERT(x) ((void)0)
|
||||
|
||||
#define XP_STRCAT(a,b) strcat((a),(b))
|
||||
#define XP_ATOI atoi
|
||||
#define XP_STRCPY(a,b) strcpy((a),(b))
|
||||
#define XP_STRLEN(x) strlen(x)
|
||||
#define XP_SPRINTF sprintf
|
||||
#define XP_FREE(x) free((x))
|
||||
#define XP_ALLOC(x) malloc((x))
|
||||
#define XP_FREEIF(x) if ((x)) free((x))
|
||||
#define XP_STRCMP(x,y) strcmp((x),(y))
|
||||
#define XP_STRNCMP(x,y,n) strncmp((x),(y),(n))
|
||||
#define XP_STRDUP(s) strdup((s))
|
||||
#define XP_MEMCPY(d, s, l) memcpy((d), (s), (l))
|
||||
#define XP_MEMSET(d, c, l) memset((d), (c), (l))
|
||||
|
||||
#ifdef XP_PC
|
||||
#define XP_STRCASECMP(x,y) stricmp((x),(y))
|
||||
#define XP_STRNCASECMP(x,y,n) strnicmp((x),(y),(n))
|
||||
#else
|
||||
#define XP_STRCASECMP(x,y) strcasecmp((x),(y))
|
||||
#define XP_STRNCASECMP(x,y,n) strncasecmp((x),(y),(n))
|
||||
#endif /*XP_PC*/
|
||||
|
||||
typedef FILE * XP_File;
|
||||
|
||||
#else /* if not standalone, use NSPR */
|
||||
|
||||
#define XP_FILE_READ PR_RDONLY, 0700
|
||||
#define XP_FILE_READ_BIN PR_RDONLY, 0700
|
||||
#define XP_FILE_WRITE PR_WRONLY, 0700
|
||||
#define XP_FILE_WRITE_BIN PR_WRONLY, 0700
|
||||
#define XP_FILE_UPDATE PR_RDWR
|
||||
#define XP_FILE_TRUNCATE (PR_WRONLY | PR_TRUNCATE), 0700
|
||||
|
||||
#define XP_FILE_UPDATE_BIN PR_RDWR, 0700
|
||||
#define XP_FILE_TRUNCATE_BIN (PR_RDWR | PR_TRUNCATE), 0700
|
||||
|
||||
#ifdef SEEK_SET
|
||||
#undef SEEK_SET
|
||||
#undef SEEK_CUR
|
||||
#undef SEEK_END
|
||||
#define SEEK_SET PR_SEEK_SET
|
||||
#define SEEK_CUR PR_SEEK_CUR
|
||||
#define SEEK_END PR_SEEK_END
|
||||
#endif
|
||||
/*
|
||||
** Note that PR_Seek returns the offset (if successful) and -1 otherwise. So
|
||||
** to make this code work
|
||||
** if (XP_FileSeek(fh, offset, SEEK_SET) != 0) { error handling }
|
||||
** we return 1 if PR_Seek() returns a negative value, and 0 otherwise
|
||||
*/
|
||||
#define XP_FileSeek(file,offset,whence) (PR_Seek((file), (offset), (whence)) < 0)
|
||||
#define XP_FileRead(dest,count,file) PR_Read((file), (dest), (count))
|
||||
#define XP_FileWrite(src,count,file) PR_Write((file), (src), (count))
|
||||
#define XP_FileTell(file) PR_Seek(file, 0, PR_SEEK_CUR)
|
||||
#define XP_FileFlush(file) PR_Sync(file)
|
||||
#define XP_FileClose(file) PR_Close(file)
|
||||
|
||||
#define XP_ASSERT(x) PR_ASSERT((x))
|
||||
|
||||
#define XP_STRCAT(a,b) PL_strcat((a),(b))
|
||||
#define XP_ATOI PL_atoi
|
||||
#define XP_STRCPY(a,b) PL_strcpy((a),(b))
|
||||
#define XP_STRLEN(x) PL_strlen(x)
|
||||
#define XP_SPRINTF sprintf
|
||||
#define XP_FREE(x) PR_Free((x))
|
||||
#define XP_ALLOC(x) PR_Malloc((x))
|
||||
#define XP_FREEIF(x) PR_FREEIF(x)
|
||||
#define XP_STRCMP(x,y) PL_strcmp((x),(y))
|
||||
#define XP_STRNCMP(x,y,n) PL_strncmp((x),(y),(n))
|
||||
#define XP_STRDUP(s) PL_strdup((s))
|
||||
#define XP_MEMCPY(d, s, l) memcpy((d), (s), (l))
|
||||
#define XP_MEMSET(d, c, l) memset((d), (c), (l))
|
||||
|
||||
#define XP_STRCASECMP(x,y) PL_strcasecmp((x),(y))
|
||||
#define XP_STRNCASECMP(x,y,n) PL_strncasecmp((x),(y),(n))
|
||||
|
||||
typedef PRFileDesc* XP_File;
|
||||
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
#ifdef STANDALONE_REGISTRY /* included from prmon.h otherwise */
|
||||
#include "prtypes.h"
|
||||
|
||||
#if 0
|
||||
typedef long int32;
|
||||
typedef unsigned long uint32;
|
||||
typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned char uint8;
|
||||
|
||||
#ifdef XP_MAC
|
||||
#include <Types.h>
|
||||
typedef char BOOL;
|
||||
typedef char Bool;
|
||||
typedef char XP_Bool;
|
||||
#elif defined(XP_PC)
|
||||
typedef int Bool;
|
||||
typedef int XP_Bool;
|
||||
#else
|
||||
/* XP_UNIX: X11/Xlib.h "define"s Bool to be int. This is really lame
|
||||
* (that's what typedef is for losers). So.. in lieu of a #undef Bool
|
||||
* here (Xlib still needs ints for Bool-typed parameters) people have
|
||||
* been #undef-ing Bool before including this file.
|
||||
* Can we just #undef Bool here? <mailto:mcafee> (help from djw, converse)
|
||||
*/
|
||||
|
||||
typedef char Bool;
|
||||
typedef char XP_Bool;
|
||||
#endif /* XP_MAC */
|
||||
#endif /* 0 */
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
#ifdef XP_PC
|
||||
typedef struct _stat XP_StatStruct;
|
||||
#define XP_Stat(file,data,type) _stat((file),(data))
|
||||
#else
|
||||
typedef struct stat XP_StatStruct;
|
||||
#define XP_Stat(file,data,type) stat((file),(data))
|
||||
#endif /*XP_PC*/
|
||||
|
||||
#ifdef XP_MAC
|
||||
extern int nr_RenameFile(char *from, char *to);
|
||||
#else
|
||||
XP_BEGIN_PROTOS
|
||||
#define nr_RenameFile(from, to) rename((from), (to))
|
||||
XP_END_PROTOS
|
||||
#endif
|
||||
|
||||
#ifdef STANDALONE_REGISTRY /* included from prmon.h otherwise */
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
extern XP_File vr_fileOpen(const char *name, const char * mode);
|
||||
extern void vr_findGlobalRegName();
|
||||
|
||||
#if !defined(XP_PC) && !(defined(__GLIBC__) && __GLIBC__ >= 2)
|
||||
extern char * strdup(const char * s);
|
||||
#endif
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#else
|
||||
|
||||
#define vr_fileOpen PR_Open
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
extern void vr_findGlobalRegName();
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* STANDALONE_REGISTRY */
|
||||
|
||||
|
||||
#endif /* _VR_STUBS_H_ */
|
||||
115
mozilla/modules/libreg/standalone/makefile.win
Normal file
115
mozilla/modules/libreg/standalone/makefile.win
Normal file
@@ -0,0 +1,115 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
IGNORE_MANIFEST=1
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the depth of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH= ..\..\..
|
||||
|
||||
!ifndef MAKE_OBJ_TYPE
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
!endif
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define the files necessary to build the target (ie. OBJS)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
OBJS= \
|
||||
.\$(OBJDIR)\reg.obj \
|
||||
.\$(OBJDIR)\VerReg.obj \
|
||||
.\$(OBJDIR)\vr_stubs.obj \
|
||||
$(NULL)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
|
||||
#// (these must be defined before the common makefiles are included)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
|
||||
LIBNAME=nsreg
|
||||
DLL=$(OBJDIR)\$(LIBNAME).dll
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any local options for the make tools
|
||||
#// (ie. LCFLAGS, LLFLAGS, LLIBS, LINCS)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
LCFLAGS = -DSTANDALONE_REGISTRY
|
||||
|
||||
LINCS= $(LINCS) -I$(PUBLIC)/libreg \
|
||||
$(NULL)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
||||
reg.c::
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\reg.h
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\reg.c
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\vr_stubs.h
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\vr_stubs.c
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\VerReg.c
|
||||
|
||||
copy $(DEPTH)\modules\libreg\src\reg.h $(DEPTH)\modules\libreg\standalone\reg.h
|
||||
copy $(DEPTH)\modules\libreg\src\reg.c $(DEPTH)\modules\libreg\standalone\reg.c
|
||||
copy $(DEPTH)\modules\libreg\src\vr_stubs.h $(DEPTH)\modules\libreg\standalone\vr_stubs.h
|
||||
copy $(DEPTH)\modules\libreg\src\vr_stubs.c $(DEPTH)\modules\libreg\standalone\vr_stubs.c
|
||||
copy $(DEPTH)\modules\libreg\src\VerReg.c $(DEPTH)\modules\libreg\standalone\VerReg.c
|
||||
|
||||
export:: $(DLL)
|
||||
|
||||
$(MAKE_INSTALL) $(DLL) $(DIST)\bin
|
||||
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\reg.h
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\reg.c
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\vr_stubs.h
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\vr_stubs.c
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\VerReg.c
|
||||
|
||||
clobber::
|
||||
|
||||
$(RM) $(DIST)\bin\$(DLL)
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\reg.h
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\reg.c
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\vr_stubs.h
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\vr_stubs.c
|
||||
$(RM) $(DEPTH)\modules\libreg\standalone\VerReg.c
|
||||
430
mozilla/modules/libreg/tests/interp.c
Normal file
430
mozilla/modules/libreg/tests/interp.c
Normal file
@@ -0,0 +1,430 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
// Registry interpreter
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "VerReg.h"
|
||||
#include "NSReg.h"
|
||||
|
||||
extern char *errstr(REGERR err);
|
||||
extern int DumpTree(void);
|
||||
|
||||
int gVerbose = 1;
|
||||
int gPretend = 0;
|
||||
|
||||
int error(char *func, int err)
|
||||
{
|
||||
if (err == REGERR_OK)
|
||||
{
|
||||
if (gVerbose)
|
||||
printf("%s Ok\n", func);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%s returns %s\n", func, errstr(err));
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
} // error
|
||||
|
||||
static char *GetNextWord(char *cmd, char *buf)
|
||||
{
|
||||
// copies until ',' or eos, then skips spaces
|
||||
if (!cmd || !buf)
|
||||
return 0;
|
||||
while (*cmd && *cmd != ',')
|
||||
*buf++ = *cmd++;
|
||||
*buf = '\0';
|
||||
if (*cmd == ',')
|
||||
{
|
||||
cmd++;
|
||||
while(*cmd && *cmd == ' ')
|
||||
cmd++;
|
||||
}
|
||||
return cmd;
|
||||
|
||||
} // GetNextWord
|
||||
|
||||
static int vr_ParseVersion(char *verstr, VERSION *result)
|
||||
{
|
||||
|
||||
result->major = result->minor = result->release = result->build = 0;
|
||||
result->major = atoi(verstr);
|
||||
while (*verstr && *verstr != '.')
|
||||
verstr++;
|
||||
if (*verstr)
|
||||
{
|
||||
verstr++;
|
||||
result->minor = atoi(verstr);
|
||||
while (*verstr && *verstr != '.')
|
||||
verstr++;
|
||||
if (*verstr)
|
||||
{
|
||||
verstr++;
|
||||
result->release = atoi(verstr);
|
||||
while (*verstr && *verstr != '.')
|
||||
verstr++;
|
||||
if (*verstr)
|
||||
{
|
||||
verstr++;
|
||||
result->build = atoi(verstr);
|
||||
while (*verstr && *verstr != '.')
|
||||
verstr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return REGERR_OK;
|
||||
|
||||
} // ParseVersion
|
||||
|
||||
void parse(char *cmd, char *name, VERSION *ver, char *path)
|
||||
{
|
||||
// expects 'cmd' points to: "<name>, <ver>, <path>"
|
||||
char buf[256];
|
||||
char *p;
|
||||
|
||||
cmd = GetNextWord(cmd, buf);
|
||||
strcpy(name, buf);
|
||||
|
||||
p = cmd; // 'cmd' points to version
|
||||
vr_ParseVersion(cmd, ver);
|
||||
ver->check = gPretend ? 0xad : 0;
|
||||
while (*p && *p != ',') // skip to next ','
|
||||
p++;
|
||||
if (*p == ',') // skip comma
|
||||
p++;
|
||||
while (*p && *p == ' ') // skip white space
|
||||
p++;
|
||||
|
||||
strcpy(path, p);
|
||||
|
||||
} // parse
|
||||
|
||||
void vVerbose(char *cmd)
|
||||
{
|
||||
|
||||
if (stricmp(cmd, "ON") == 0)
|
||||
{
|
||||
gVerbose = 1;
|
||||
printf("Verbose mode is now ON.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
gVerbose = 0;
|
||||
}
|
||||
|
||||
} // vVerbose
|
||||
|
||||
void vCreate(char *cmd)
|
||||
{
|
||||
|
||||
// Syntax: Create [new,] 5.0b1
|
||||
char buf[64];
|
||||
|
||||
int flag = 0;
|
||||
cmd = GetNextWord(cmd, buf);
|
||||
if (stricmp(buf, "NEW,") == 0)
|
||||
{
|
||||
flag = CR_NEWREGISTRY;
|
||||
}
|
||||
error("VR_CreateRegistry", VR_CreateRegistry(flag, cmd));
|
||||
|
||||
} // vCreate
|
||||
|
||||
void vDisplay(char *cmd)
|
||||
{
|
||||
|
||||
DumpTree();
|
||||
|
||||
} // vDisplay
|
||||
|
||||
|
||||
void vFind(char *cmd)
|
||||
{
|
||||
|
||||
VERSION ver;
|
||||
char path[MAXREGPATHLEN];
|
||||
|
||||
if (error("VR_GetVersion", VR_GetVersion(cmd, &ver)) == REGERR_OK)
|
||||
{
|
||||
if (error("VR_GetPath", VR_GetPath(cmd, sizeof(path), path)) == REGERR_OK)
|
||||
{
|
||||
printf("%s found: ver=%d.%d.%d.%d, check=0x%04x, path=%s\n",
|
||||
cmd, ver.major, ver.minor, ver.release, ver.build, ver.check,
|
||||
path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
printf("%s not found.\n", cmd);
|
||||
return;
|
||||
|
||||
} // vFind
|
||||
|
||||
|
||||
void vHelp(char *cmd)
|
||||
{
|
||||
|
||||
puts("Enter a command:");
|
||||
puts("\tD)isplay - display the current contents of the Registry");
|
||||
puts("\tI)nstall <name>, <version>, <path> - install a new component");
|
||||
puts("\tU)pdate <name>, <version>, <path> - update a component");
|
||||
puts("\tF)ind <name> - returns version and path");
|
||||
puts("\tV)erify <name> - verify component exists and checks out");
|
||||
puts("\tC)reate <name> - create a new instance of Navigator (e.g., \"4.0\")");
|
||||
puts("\tR)emove <name> - deletes a component from the Registry");
|
||||
puts("\tT)est - perform a simple test on the Registry");
|
||||
puts("\tver(B)ose ON|off - turn verbose mode on or off");
|
||||
puts("\tP)retend on|OFF - pretend that test files exist");
|
||||
puts("\tS)ave - save the Registry to disk");
|
||||
puts("\tpac(K) registry - squeeze out unused space from the Registry");
|
||||
puts("\tQ)uit - end the program");
|
||||
|
||||
} // vHelp
|
||||
|
||||
|
||||
void vInstall(char *cmd)
|
||||
{
|
||||
|
||||
char name[MAXREGPATHLEN+1];
|
||||
char path[MAXREGPATHLEN+1];
|
||||
VERSION ver;
|
||||
|
||||
parse(cmd, name, &ver, path);
|
||||
error("VR_Install", VR_Install(name, path, &ver));
|
||||
|
||||
} // vInstall
|
||||
|
||||
void vPack(char *cmd)
|
||||
{
|
||||
error("VR_PackRegistry", VR_PackRegistry(0));
|
||||
|
||||
} // vPack
|
||||
|
||||
void vPretend(char *cmd)
|
||||
{
|
||||
|
||||
if (!cmd)
|
||||
{
|
||||
gPretend = !!gPretend;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stricmp(cmd, "ON") == 0)
|
||||
gPretend = 1;
|
||||
else
|
||||
gPretend = 0;
|
||||
}
|
||||
|
||||
if (gVerbose)
|
||||
printf("Pretend mode is %s\n", gPretend ? "ON" : "OFF");
|
||||
|
||||
} // vPretend
|
||||
|
||||
void vRemove(char *cmd)
|
||||
{
|
||||
|
||||
error("VR_Remove", VR_Remove(cmd));
|
||||
|
||||
} // vRemove
|
||||
|
||||
|
||||
void vSave(char *cmd)
|
||||
{
|
||||
|
||||
error("VR_Checkpoint", VR_Checkpoint());
|
||||
|
||||
} // vSave
|
||||
|
||||
|
||||
void vTest(char *cmd)
|
||||
{
|
||||
|
||||
VERSION ver;
|
||||
ver.major = 4;
|
||||
ver.minor = 0;
|
||||
ver.release = 0;
|
||||
ver.build = 237;
|
||||
ver.check = gPretend ? 0xad : 0;
|
||||
|
||||
if (error("VR_Install", VR_Install("Navigator/NS.exe",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\NETSCAPE.EXE", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Navigator/Help",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\NETSCAPE.HLP", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Navigator/NSPR",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\NSPR32.DLL", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Navigator/Player",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\NSPLAYER.EXE", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Navigator/NSJava",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\NSJAVA32.DLL", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Web/Certificate.DB",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\CERT.DB", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Web/CertificateNI.DB",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\CERTNI.DB", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Web/Keys",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\KEY.DB", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("MailNews/Postal",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\System\\POSTAL32.DLL", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("MailNews/Folders/Inbox",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Mail\\INBOX.SNM", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("MailNews/Folders/Sent",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Mail\\SENT.SNM", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("MailNews/Folders/Trash",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Mail\\TRASH.SNM", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Components/NUL",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\Plugins\\NPNUL32.DLL", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Components/PointCast",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\Plugins\\NPPCN32.DLL", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Components/AWT",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\Java\\bin\\AWT3220.DLL", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Components/MM",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\Java\\bin\\MM3220.DLL", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Java/Classes.Zip",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\Java\\classes\\MOZ2_0.ZIP", &ver)))
|
||||
return;
|
||||
if (error("VR_Install", VR_Install("Java/Classes Directory",
|
||||
"c:\\Program Files\\Netscape\\Navigator\\Program\\Java\\classes\\MOZ2_0", &ver)))
|
||||
return;
|
||||
|
||||
|
||||
} // vTest
|
||||
|
||||
|
||||
void vUpdate(char *cmd)
|
||||
{
|
||||
|
||||
char name[MAXREGPATHLEN+1];
|
||||
char path[MAXREGPATHLEN+1];
|
||||
VERSION ver;
|
||||
|
||||
parse(cmd, name, &ver, path);
|
||||
error("VR_Update", VR_Update(name, path, &ver));
|
||||
|
||||
} // vUpdate
|
||||
|
||||
|
||||
void vVerify(char *cmd)
|
||||
{
|
||||
|
||||
error("VR_CheckEntry", VR_CheckEntry(0, cmd));
|
||||
|
||||
} // vVerify
|
||||
|
||||
|
||||
void interp(void)
|
||||
{
|
||||
|
||||
char line[256];
|
||||
char *p;
|
||||
|
||||
while(1)
|
||||
{
|
||||
putchar('>');
|
||||
putchar(' ');
|
||||
flushall();
|
||||
gets(line);
|
||||
|
||||
// p points to next word after verb on command line
|
||||
p = line;
|
||||
while (*p && *p!=' ')
|
||||
p++;
|
||||
if (!*p)
|
||||
p = 0;
|
||||
else
|
||||
{
|
||||
while(*p && *p==' ')
|
||||
p++;
|
||||
}
|
||||
|
||||
switch(toupper(line[0]))
|
||||
{
|
||||
case 'B':
|
||||
vVerbose(p);
|
||||
break;
|
||||
case 'C':
|
||||
vCreate(p);
|
||||
break;
|
||||
case 'D':
|
||||
vDisplay(p);
|
||||
break;
|
||||
case 'F':
|
||||
vFind(p);
|
||||
break;
|
||||
case 'H':
|
||||
default:
|
||||
vHelp(line);
|
||||
break;
|
||||
case 'I':
|
||||
vInstall(p);
|
||||
break;
|
||||
case 'K':
|
||||
vPack(p);
|
||||
break;
|
||||
case 'P':
|
||||
vPretend(p);
|
||||
break;
|
||||
case 'R':
|
||||
vRemove(p);
|
||||
break;
|
||||
case 'S':
|
||||
vSave(p);
|
||||
break;
|
||||
case 'T':
|
||||
vTest(p);
|
||||
break;
|
||||
case 'U':
|
||||
vUpdate(p);
|
||||
break;
|
||||
case 'V':
|
||||
vVerify(p);
|
||||
break;
|
||||
case 'Q':
|
||||
case 'X':
|
||||
vSave(0);
|
||||
return;
|
||||
} // switch
|
||||
} // while
|
||||
|
||||
assert(0);
|
||||
return; // shouldn't get here
|
||||
|
||||
} // interp
|
||||
|
||||
// EOF: interp.c
|
||||
438
mozilla/modules/libreg/tests/regtest.c
Normal file
438
mozilla/modules/libreg/tests/regtest.c
Normal file
@@ -0,0 +1,438 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "NSReg.h"
|
||||
#include "VerReg.h"
|
||||
|
||||
extern void interp(void);
|
||||
|
||||
#define REGFILE "c:\\temp\\reg.dat"
|
||||
|
||||
char *gRegistry;
|
||||
|
||||
int main(int argc, char *argv[]);
|
||||
|
||||
char *errstr(REGERR err)
|
||||
{
|
||||
|
||||
switch( err )
|
||||
{
|
||||
case REGERR_OK:
|
||||
return "REGERR_OK";
|
||||
case REGERR_FAIL:
|
||||
return "REGERR_FAIL";
|
||||
case REGERR_NOMORE:
|
||||
return "REGERR_MORE";
|
||||
case REGERR_NOFIND:
|
||||
return "REGERR_NOFIND";
|
||||
case REGERR_BADREAD:
|
||||
return "REGERR_BADREAD";
|
||||
case REGERR_BADLOCN:
|
||||
return "REGERR_BADLOCN";
|
||||
case REGERR_PARAM:
|
||||
return "REGERR_PARAM";
|
||||
case REGERR_BADMAGIC:
|
||||
return "REGERR_BADMAGIC";
|
||||
default:
|
||||
return "<Unknown>";
|
||||
}
|
||||
|
||||
} // errstr
|
||||
|
||||
|
||||
int CreateEmptyRegistry(void)
|
||||
{
|
||||
|
||||
#if 0
|
||||
int fh;
|
||||
remove(REGFILE); // ignore errors like file not found
|
||||
|
||||
fh = _open(REGFILE, _O_CREAT, _S_IREAD|_S_IWRITE);
|
||||
if (fh < 0)
|
||||
return -1;
|
||||
close(fh);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
return VR_CreateRegistry(CR_NEWREGISTRY, "4.0");
|
||||
|
||||
} // CreateEmptyRegistry
|
||||
|
||||
|
||||
|
||||
int BuildTree(void)
|
||||
{
|
||||
|
||||
REGERR err;
|
||||
|
||||
err = NR_RegAdd(0,"/Machine/Old");
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
printf("NR_RegAdd() returned %s.\n", errstr(err));
|
||||
return err;
|
||||
}
|
||||
err = NR_RegAdd(0,"/User");
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
printf("NR_RegAdd() returned %s.\n", errstr(err));
|
||||
return err;
|
||||
}
|
||||
err = NR_RegAdd(0,"/Machine/4.0/Name1=Val1");
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
printf("NR_RegAdd() returned %s.\n", errstr(err));
|
||||
return err;
|
||||
}
|
||||
err = NR_RegAdd(0,"/Machine/4.0/Name2=Val2");
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
printf("NR_RegAdd() returned %s.\n", errstr(err));
|
||||
return err;
|
||||
}
|
||||
err = NR_RegAdd(0,"/Machine/4.0/Name2=Val3");
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
printf("NR_RegAdd() returned %s.\n", errstr(err));
|
||||
return err;
|
||||
}
|
||||
err = NR_RegAdd(0,"/Machine/4.0/Name3=Val4");
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
printf("NR_RegAdd() returned %s.\n", errstr(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
return VR_Checkpoint();
|
||||
|
||||
} // BuildTree
|
||||
|
||||
|
||||
int FindKeys(void)
|
||||
{
|
||||
|
||||
RKEY key;
|
||||
REGERR err;
|
||||
char buf[80];
|
||||
|
||||
if (NR_RegGetKey(0, "", &key) == REGERR_OK)
|
||||
{
|
||||
printf("NR_RegGetKey returns ok for an empty path.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (NR_RegGetKey(0, "/", &key) != REGERR_OK)
|
||||
{
|
||||
printf("NR_RegGetKey couldn't find root.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (NR_RegGetKey(0, "/Machine/Old", &key) != REGERR_OK)
|
||||
{
|
||||
printf("NR_RegGetKey couldn't find Old\n");
|
||||
return 1;
|
||||
}
|
||||
printf("NR_RegGetKey returns key for Old as: 0x%lx\n", (long) key);
|
||||
|
||||
if (NR_RegGetKey(0, "/Machine/4.0", &key) != REGERR_OK)
|
||||
{
|
||||
printf("NR_RegGetKey couldn't find 4.0\n");
|
||||
return 1;
|
||||
}
|
||||
printf("NR_RegGetKey returns key for 4.0 as: 0x%lx\n", (long) key);
|
||||
|
||||
// ----------------------------------------
|
||||
if ((err = NR_RegFindValue(0, "/Machine/4.0/Name3", 64, buf)) != REGERR_OK)
|
||||
{
|
||||
printf("NR_RegFindValue (no key) returns %s\n", errstr(err));
|
||||
return 1;
|
||||
}
|
||||
printf("NR_RegFindValue (no key) of Name3 = %s\n", buf);
|
||||
|
||||
if (NR_RegFindValue(key, "Aliens", 64, buf) == REGERR_OK)
|
||||
{
|
||||
printf("NR_RegFindValue finds Aliens.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((err = NR_RegFindValue(key, "Name3", 64, buf)) != REGERR_OK)
|
||||
{
|
||||
printf("NR_RegFindValue (w/key) returns %s\n", errstr(err));
|
||||
return 1;
|
||||
}
|
||||
printf("NR_RegFindValue (w/key) of Name3 = %s\n", buf);
|
||||
|
||||
return 0;
|
||||
|
||||
} // FindTree
|
||||
|
||||
int DumpTree(void)
|
||||
{
|
||||
|
||||
char *path;
|
||||
char *line = "------------------------------------------------------------";
|
||||
|
||||
path = malloc(2048);
|
||||
if (!path)
|
||||
return REGERR_FAIL;
|
||||
|
||||
strcpy(path, "/");
|
||||
puts(line);
|
||||
puts(path);
|
||||
|
||||
while (NR_RegNext( 0, 512, path ) == REGERR_OK)
|
||||
{
|
||||
puts(path);
|
||||
}
|
||||
|
||||
puts(line);
|
||||
|
||||
return 0;
|
||||
|
||||
} // DumpTree
|
||||
|
||||
|
||||
int ChangeKeys(void)
|
||||
{
|
||||
|
||||
REGERR err;
|
||||
|
||||
err = NR_RegUpdate(0,"/Machine/4.0/name3", "Infospect Software, Inc.");
|
||||
if (err)
|
||||
{
|
||||
printf("Couldn't update name3's value to ISI.\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
err = NR_RegUpdate(0,"/Machine/4.0/name3=Infospect Software, Inc.", "\"Jonathan=Kid1\"");
|
||||
if (err)
|
||||
{
|
||||
printf("Couldn't update name3's value to Jon.\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
err = NR_RegRename(0,"/Machine/4.0/name3=\"Jonathan=Kid1\"", "First born");
|
||||
if (err)
|
||||
{
|
||||
printf("Couldn't update name3's name to First born.\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
err = NR_RegUpdate(0,"/Machine/4.0/name2=Val2", "Kelley Ann");
|
||||
if (err)
|
||||
{
|
||||
printf("Couldn't update name2's value to Kelley.\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
return VR_Checkpoint();
|
||||
|
||||
} // ChangeKeys
|
||||
|
||||
|
||||
int DeleteKeys(void)
|
||||
{
|
||||
|
||||
REGERR err;
|
||||
|
||||
err = NR_RegDelete(0, "/User");
|
||||
if (err)
|
||||
{
|
||||
printf("NR_RegDelete returned %s.\n", errstr(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
return VR_Checkpoint();
|
||||
|
||||
} // DeleteKeys
|
||||
|
||||
|
||||
int StressTest(void)
|
||||
{
|
||||
|
||||
REGERR err;
|
||||
RKEY key;
|
||||
|
||||
printf("Starting stress...\n");
|
||||
|
||||
err = NR_RegGetKey(0, "/Machine/4.0", &key);
|
||||
if (err)
|
||||
{
|
||||
printf("Error getting key for 4.0 = %s\n", errstr(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
err = NR_RegAdd(key, "A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/"
|
||||
"A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/"
|
||||
"A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/" );
|
||||
|
||||
if (err)
|
||||
{
|
||||
printf("Adding humungous string returned %s\n", errstr(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
// TODO: Add a value to one of the middle keys, get it back.
|
||||
|
||||
printf("Stress done.\n");
|
||||
return 0;
|
||||
|
||||
} // StressTest
|
||||
|
||||
|
||||
int Install(void)
|
||||
{
|
||||
|
||||
int err;
|
||||
VERSION ver;
|
||||
|
||||
ver.major = 4;
|
||||
ver.minor = 2;
|
||||
ver.release = 10;
|
||||
ver.build = 937;
|
||||
ver.check = 0;
|
||||
|
||||
err = VR_Install("Web/Navigator/netscape.exe",
|
||||
"c:\\Netscape\\NETSCAPE.EXE", &ver);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ver.release = 19;
|
||||
ver.build = 722;
|
||||
ver.check = 0;
|
||||
err = VR_Install("Web/Navigator/nspr.dll",
|
||||
"c:\\Netscape\\System\\Vtcprac.386", &ver);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return VR_Checkpoint();
|
||||
|
||||
}
|
||||
|
||||
int GetInfo(void)
|
||||
{
|
||||
|
||||
int err;
|
||||
char buf[256];
|
||||
VERSION ver;
|
||||
|
||||
err = VR_GetPath("Web/Navigator/nspr.dll", 256, buf);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
printf("GetPath(nspr.dll) returns %s\n", buf);
|
||||
|
||||
err = VR_GetVersion("Web/Navigator/netscape.exe", &ver);
|
||||
if (err)
|
||||
return err;
|
||||
printf("GetVersion(netscape.exe) returns %d.%d.%d.%d and check=%d\n",
|
||||
ver.major, ver.minor, ver.release, ver.build, ver.check);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
printf("Registry Test 10/01/96.\n");
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
gRegistry = argv[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
gRegistry = REGFILE;
|
||||
}
|
||||
VR_RegistryName(gRegistry);
|
||||
|
||||
#if 1
|
||||
if (NR_RegOpen(gRegistry) != REGERR_OK)
|
||||
VR_CreateRegistry(CR_NEWREGISTRY, "4.0");
|
||||
interp();
|
||||
#else
|
||||
if (CreateEmptyRegistry())
|
||||
goto abort;
|
||||
|
||||
if (Install())
|
||||
goto done;
|
||||
|
||||
if (DumpTree())
|
||||
goto done;
|
||||
|
||||
if (GetInfo())
|
||||
goto done;
|
||||
|
||||
|
||||
#if defined(TEST_NR)
|
||||
if ((err = NR_RegOpen(REGFILE)) != REGERR_OK)
|
||||
{
|
||||
printf("NR_RegOpen(%s) returned %s...Test aborted.\n", REGFILE, errstr(err));
|
||||
goto abort;
|
||||
}
|
||||
|
||||
if (BuildTree())
|
||||
goto done;
|
||||
|
||||
if (FindKeys())
|
||||
goto done;
|
||||
|
||||
if (DumpTree())
|
||||
goto done;
|
||||
|
||||
if (ChangeKeys())
|
||||
goto done;
|
||||
|
||||
if (DeleteKeys())
|
||||
goto done;
|
||||
|
||||
if (DumpTree())
|
||||
goto done;
|
||||
|
||||
if (StressTest())
|
||||
goto done;
|
||||
|
||||
if (DumpTree())
|
||||
goto done;
|
||||
|
||||
done:
|
||||
NR_RegClose();
|
||||
#else
|
||||
done:
|
||||
#endif
|
||||
|
||||
abort:
|
||||
puts("Press Enter to continue...");
|
||||
getchar();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
1204
mozilla/modules/libreg/xpcom/nsRegistry.cpp
Normal file
1204
mozilla/modules/libreg/xpcom/nsRegistry.cpp
Normal file
File diff suppressed because it is too large
Load Diff
30
mozilla/xpcom/Makefile.in
Normal file
30
mozilla/xpcom/Makefile.in
Normal file
@@ -0,0 +1,30 @@
|
||||
#!gmake
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += tests
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
6027
mozilla/xpcom/base/IIDS.h
Normal file
6027
mozilla/xpcom/base/IIDS.h
Normal file
File diff suppressed because it is too large
Load Diff
170
mozilla/xpcom/base/nsAgg.h
Normal file
170
mozilla/xpcom/base/nsAgg.h
Normal file
@@ -0,0 +1,170 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsAgg_h___
|
||||
#define nsAgg_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
/**
|
||||
* Outer objects can implement nsIOuter if they choose, allowing them to
|
||||
* get notification if their inner objects (children) are effectively freed.
|
||||
* This allows them to reset any state associated with the inner object and
|
||||
* potentially unload it.
|
||||
*/
|
||||
class nsIOuter : public nsISupports {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This method is called whenever an inner object's refcount is about to
|
||||
* become zero and the inner object should be released by the outer. This
|
||||
* allows the outer to clean up any state associated with the inner and
|
||||
* potentially unload the inner object. This method should call
|
||||
* inner->Release().
|
||||
*/
|
||||
NS_IMETHOD
|
||||
ReleaseInner(nsISupports* inner) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IOUTER_IID \
|
||||
{ /* ea0bf9f0-3d67-11d2-8163-006008119d7a */ \
|
||||
0xea0bf9f0, \
|
||||
0x3d67, \
|
||||
0x11d2, \
|
||||
{0x81, 0x63, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Put this in your class's declaration:
|
||||
#define NS_DECL_AGGREGATED \
|
||||
NS_DECL_ISUPPORTS \
|
||||
\
|
||||
protected: \
|
||||
\
|
||||
/* You must implement this operation instead of the nsISupports */ \
|
||||
/* methods if you inherit from nsAggregated. */ \
|
||||
NS_IMETHOD \
|
||||
AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr); \
|
||||
\
|
||||
class Internal : public nsISupports { \
|
||||
public: \
|
||||
\
|
||||
Internal() {} \
|
||||
\
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, \
|
||||
void** aInstancePtr); \
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void); \
|
||||
NS_IMETHOD_(nsrefcnt) Release(void); \
|
||||
\
|
||||
}; \
|
||||
\
|
||||
friend class Internal; \
|
||||
\
|
||||
nsISupports* fOuter; \
|
||||
Internal fAggregated; \
|
||||
\
|
||||
nsISupports* GetInner(void) { return &fAggregated; } \
|
||||
\
|
||||
public: \
|
||||
|
||||
|
||||
// Put this in your class's constructor:
|
||||
#define NS_INIT_AGGREGATED(outer) \
|
||||
PR_BEGIN_MACRO \
|
||||
NS_INIT_REFCNT(); \
|
||||
fOuter = outer; \
|
||||
PR_END_MACRO
|
||||
|
||||
|
||||
// Put this in your class's implementation file:
|
||||
#define NS_IMPL_AGGREGATED(_class) \
|
||||
NS_IMETHODIMP \
|
||||
_class::QueryInterface(const nsIID& aIID, void** aInstancePtr) \
|
||||
{ \
|
||||
/* try our own interfaces first before delegating to outer */ \
|
||||
nsresult rslt = AggregatedQueryInterface(aIID, aInstancePtr); \
|
||||
if (rslt != NS_OK && fOuter) \
|
||||
return fOuter->QueryInterface(aIID, aInstancePtr); \
|
||||
else \
|
||||
return rslt; \
|
||||
} \
|
||||
\
|
||||
NS_IMETHODIMP_(nsrefcnt) \
|
||||
_class::AddRef(void) \
|
||||
{ \
|
||||
++mRefCnt; /* keep track of our refcount as well as outer's */ \
|
||||
if (fOuter) \
|
||||
return NS_ADDREF(fOuter); \
|
||||
else \
|
||||
return mRefCnt; \
|
||||
} \
|
||||
\
|
||||
NS_IMETHODIMP_(nsrefcnt) \
|
||||
_class::Release(void) \
|
||||
{ \
|
||||
if (fOuter) { \
|
||||
nsISupports* outer = fOuter; /* in case we release ourself */ \
|
||||
nsIOuter* outerIntf; \
|
||||
static NS_DEFINE_IID(kIOuterIID, NS_IOUTER_IID); \
|
||||
if (mRefCnt == 1 && \
|
||||
outer->QueryInterface(kIOuterIID, \
|
||||
(void**)&outerIntf) == NS_OK) { \
|
||||
outerIntf->ReleaseInner(GetInner()); \
|
||||
outerIntf->Release(); \
|
||||
} \
|
||||
else \
|
||||
--mRefCnt; /* keep track of our refcount as well as outer's */ \
|
||||
return outer->Release(); \
|
||||
} \
|
||||
else { \
|
||||
if (--mRefCnt == 0) { \
|
||||
delete this; \
|
||||
return 0; \
|
||||
} \
|
||||
return mRefCnt; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
NS_IMETHODIMP \
|
||||
_class::Internal::QueryInterface(const nsIID& aIID, void** aInstancePtr) \
|
||||
{ \
|
||||
_class* agg = (_class*)((char*)(this) - offsetof(_class, fAggregated)); \
|
||||
return agg->AggregatedQueryInterface(aIID, aInstancePtr); \
|
||||
} \
|
||||
\
|
||||
NS_IMETHODIMP_(nsrefcnt) \
|
||||
_class::Internal::AddRef(void) \
|
||||
{ \
|
||||
_class* agg = (_class*)((char*)(this) - offsetof(_class, fAggregated)); \
|
||||
return ++agg->mRefCnt; \
|
||||
} \
|
||||
\
|
||||
NS_IMETHODIMP_(nsrefcnt) \
|
||||
_class::Internal::Release(void) \
|
||||
{ \
|
||||
_class* agg = (_class*)((char*)(this) - offsetof(_class, fAggregated)); \
|
||||
if (--agg->mRefCnt == 0) { \
|
||||
delete agg; \
|
||||
return 0; \
|
||||
} \
|
||||
return agg->mRefCnt; \
|
||||
} \
|
||||
|
||||
#endif /* nsAgg_h___ */
|
||||
129
mozilla/xpcom/base/nsAllocator.cpp
Normal file
129
mozilla/xpcom/base/nsAllocator.cpp
Normal file
@@ -0,0 +1,129 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of nsIAllocator using NSPR
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "nsAllocator.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIAllocatorIID, NS_IALLOCATOR_IID);
|
||||
|
||||
nsAllocator::nsAllocator(nsISupports* outer)
|
||||
{
|
||||
NS_INIT_AGGREGATED(outer);
|
||||
}
|
||||
|
||||
nsAllocator::~nsAllocator(void)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_AGGREGATED(nsAllocator);
|
||||
|
||||
NS_METHOD
|
||||
nsAllocator::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIAllocatorIID) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsAllocator::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
|
||||
{
|
||||
if (outer && !aIID.Equals(kISupportsIID))
|
||||
return NS_NOINTERFACE; // XXX right error?
|
||||
nsAllocator* mm = new nsAllocator(outer);
|
||||
if (mm == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mm->AddRef();
|
||||
if (aIID.Equals(kISupportsIID))
|
||||
*aInstancePtr = mm->GetInner();
|
||||
else
|
||||
*aInstancePtr = mm;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_METHOD_(void*)
|
||||
nsAllocator::Alloc(PRUint32 size)
|
||||
{
|
||||
return PR_Malloc(size);
|
||||
}
|
||||
|
||||
NS_METHOD_(void*)
|
||||
nsAllocator::Realloc(void* ptr, PRUint32 size)
|
||||
{
|
||||
return PR_Realloc(ptr, size);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsAllocator::Free(void* ptr)
|
||||
{
|
||||
PR_Free(ptr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsAllocator::HeapMinimize(void)
|
||||
{
|
||||
#ifdef XP_MAC
|
||||
// This used to live in the memory allocators no Mac, but does no more
|
||||
// Needs to be hooked up in the new world.
|
||||
// CallCacheFlushers(0x7fffffff);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsAllocatorFactory::nsAllocatorFactory(void)
|
||||
{
|
||||
}
|
||||
|
||||
nsAllocatorFactory::~nsAllocatorFactory(void)
|
||||
{
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
NS_IMPL_ISUPPORTS(nsAllocatorFactory, kIFactoryIID);
|
||||
|
||||
NS_METHOD
|
||||
nsAllocatorFactory::CreateInstance(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
return nsAllocator::Create(aOuter, aIID, aResult);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsAllocatorFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
return NS_OK; // XXX what?
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
93
mozilla/xpcom/base/nsAllocator.h
Normal file
93
mozilla/xpcom/base/nsAllocator.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of nsIAllocator using NSPR
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsAllocator_h__
|
||||
#define nsAllocator_h__
|
||||
|
||||
#include "nsIAllocator.h"
|
||||
#include "prmem.h"
|
||||
#include "nsAgg.h"
|
||||
|
||||
class nsAllocator : public nsIAllocator {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Allocates a block of memory of a particular size.
|
||||
*
|
||||
* @param size - the size of the block to allocate
|
||||
* @result the block of memory
|
||||
*/
|
||||
NS_IMETHOD_(void*) Alloc(PRUint32 size);
|
||||
|
||||
/**
|
||||
* Reallocates a block of memory to a new size.
|
||||
*
|
||||
* @param ptr - the block of memory to reallocate
|
||||
* @param size - the new size
|
||||
* @result the rellocated block of memory
|
||||
*/
|
||||
NS_IMETHOD_(void*) Realloc(void* ptr, PRUint32 size);
|
||||
|
||||
/**
|
||||
* Frees a block of memory.
|
||||
*
|
||||
* @param ptr - the block of memory to free
|
||||
*/
|
||||
NS_IMETHOD Free(void* ptr);
|
||||
|
||||
/**
|
||||
* Attempts to shrink the heap.
|
||||
*/
|
||||
NS_IMETHOD HeapMinimize(void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsAllocator(nsISupports* outer);
|
||||
virtual ~nsAllocator(void);
|
||||
|
||||
NS_DECL_AGGREGATED
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "nsIFactory.h"
|
||||
|
||||
class nsAllocatorFactory : nsIFactory {
|
||||
public:
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
nsAllocatorFactory(void);
|
||||
~nsAllocatorFactory(void);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#endif // nsAllocator_h__
|
||||
54
mozilla/xpcom/base/nsCOMPtr.cpp
Normal file
54
mozilla/xpcom/base/nsCOMPtr.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
void
|
||||
nsCOMPtr_base::assign_with_AddRef( nsISupports* rawPtr )
|
||||
{
|
||||
if ( rawPtr )
|
||||
NSCAP_ADDREF(rawPtr);
|
||||
if ( mRawPtr )
|
||||
NSCAP_RELEASE(mRawPtr);
|
||||
mRawPtr = rawPtr;
|
||||
}
|
||||
|
||||
void
|
||||
nsCOMPtr_base::assign_with_QueryInterface( nsISupports* rawPtr, const nsIID& iid, nsresult* result )
|
||||
{
|
||||
nsresult status = NS_OK;
|
||||
if ( !rawPtr || !NS_SUCCEEDED( status = rawPtr->QueryInterface(iid, NSCAP_REINTERPRET_CAST(void**, &rawPtr)) ) )
|
||||
rawPtr = 0;
|
||||
|
||||
if ( mRawPtr )
|
||||
NSCAP_RELEASE(mRawPtr);
|
||||
|
||||
mRawPtr = rawPtr;
|
||||
|
||||
if ( result )
|
||||
*result = status;
|
||||
}
|
||||
|
||||
void**
|
||||
nsCOMPtr_base::begin_assignment()
|
||||
{
|
||||
if ( mRawPtr )
|
||||
NSCAP_RELEASE(mRawPtr);
|
||||
mRawPtr = 0;
|
||||
return NSCAP_REINTERPRET_CAST(void**, &mRawPtr);
|
||||
}
|
||||
668
mozilla/xpcom/base/nsCOMPtr.h
Normal file
668
mozilla/xpcom/base/nsCOMPtr.h
Normal file
@@ -0,0 +1,668 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsCOMPtr_h___
|
||||
#define nsCOMPtr_h___
|
||||
|
||||
|
||||
|
||||
// Wrapping includes can speed up compiles (see "Large Scale C++ Software Design")
|
||||
#ifndef nsDebug_h___
|
||||
#include "nsDebug.h"
|
||||
// for |NS_PRECONDITION|
|
||||
#endif
|
||||
|
||||
#ifndef nsISupports_h___
|
||||
#include "nsISupports.h"
|
||||
// for |nsresult|, |NS_ADDREF|, et al
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
TO DO...
|
||||
|
||||
+ make alternative function for |getter_AddRefs| (or something)
|
||||
+ make constructor for |nsQueryInterface| explicit (suddenly construct/assign from raw pointer becomes illegal)
|
||||
+ Improve internal documentation
|
||||
+ mention *&
|
||||
+ alternatives for comparison
|
||||
+ do_QueryInterface
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* USER MANUAL
|
||||
|
||||
See also:
|
||||
<http://www.meer.net/ScottCollins/doc/nsCOMPtr.html>, or
|
||||
<http://www.mozilla.org/projects/xpcom/nsCOMPtr.html>
|
||||
|
||||
What is |nsCOMPtr|?
|
||||
|
||||
|nsCOMPtr| is a `smart-pointer'. It is a template class that acts, syntactically,
|
||||
just like an ordinary pointer in C or C++, i.e., you can apply |*| or |->| to it to
|
||||
`get to' what it points at. |nsCOMPtr| is smart in that, unlike a raw COM
|
||||
interface pointer, |nsCOMPtr| manages |AddRef|, |Release|, and |QueryInterface|
|
||||
_for_ you.
|
||||
|
||||
For instance, here is a typical snippet of code (at its most compact) where you assign
|
||||
a COM interface pointer into a member variable:
|
||||
|
||||
NS_IF_RELEASE(mFoop); // If I have one already, I must release it before over-writing it.
|
||||
if ( mFooP = aPtr ) // Now it's safe to assign it in, and, if it's not NULL
|
||||
mFooP->AddRef(); // I must |AddRef| it, since I'll be holding on to it.
|
||||
|
||||
If our member variable |mFooP| were a |nsCOMPtr|, however, the snippet above
|
||||
would look like this:
|
||||
|
||||
mFoop = aPtr; // Note: automatically |Release|s the old and |AddRef|s the new
|
||||
|
||||
|nsCOMPtr| helps you write code that is leak-proof, exception safe, and significantly
|
||||
less verbose than you would with raw COM interface pointers. With |nsCOMPtr|, you
|
||||
may never have to call |AddRef|, |Release|, or |QueryInterface| by hand.
|
||||
|
||||
|
||||
You still have to understand COM. You still have to know which functions return
|
||||
interface pointers that have already been |AddRef|ed and which don't. You still
|
||||
have to ensure your program logic doesn't produce circularly referencing garbage.
|
||||
|nsCOMPtr| is not a panacea. It is, however, helpful, easy to use, well-tested,
|
||||
and polite. It doesn't require that a function author cooperate with you, nor does
|
||||
your use force others to use it.
|
||||
|
||||
|
||||
Where should I use |nsCOMPtr|?
|
||||
|
||||
...
|
||||
|
||||
|
||||
Where _shouldn't_ I use |nsCOMPtr|?
|
||||
|
||||
In public interfaces... [[others]]
|
||||
|
||||
|
||||
How does a |nsCOMPtr| differ from a raw pointer?
|
||||
|
||||
A |nsCOMPtr| differs, syntactically, from a raw COM interface pointer in three
|
||||
ways:
|
||||
|
||||
+ It's declared differently, e.g.,
|
||||
|
||||
// instead of saying // you say
|
||||
IFoo* fooP; nsCOMPtr<IFoo> fooP;
|
||||
|
||||
|
||||
+ You can't call |AddRef| or |Release| through it,
|
||||
|
||||
fooP->AddRef(); // OK fooP->AddRef(); // Error: no permission
|
||||
fooP->Release(); // OK fooP->Release(); // Error: no permission
|
||||
|
||||
|
||||
+ You can't just apply an |&| to it to pass it to the typical `getter' function
|
||||
|
||||
AcquireFoo(&fooP); AcquireFoo( getter_AddRefs(fooP) );
|
||||
GetFoo(&fooP); GetFoo( getter_doesnt_AddRef(fooP) );
|
||||
|
||||
|
||||
How do I use |nsCOMPtr|?
|
||||
|
||||
Typically, you can use a |nsCOMPtr| exactly as you would a standard COM
|
||||
interface pointer:
|
||||
|
||||
IFoo* fooP; nsCOMPtr<IFoo> fooP;
|
||||
// ... // ...
|
||||
fooP->SomeFunction(x, y, z); fooP->SomeFunction(x, y, z);
|
||||
AnotherFunction(fooP); AnotherFunction(fooP);
|
||||
|
||||
if ( fooP ) if ( fooP )
|
||||
// ... // ...
|
||||
|
||||
if ( fooP == barP ) if ( fooP == barP )
|
||||
// ... // ...
|
||||
|
||||
There are some differences, though. In particular, you can't call |AddRef| or |Release|
|
||||
through a |nsCOMPtr| directly, nor would you need to. |AddRef| is called for you
|
||||
whenever you assign a COM interface pointer _into_ a |nsCOMPtr|. |Release| is
|
||||
called on the old value, and also when the |nsCOMPtr| goes out of scope. Trying
|
||||
to call |AddRef| or |Release| yourself will generate a compile-time error.
|
||||
|
||||
fooP->AddRef(); // fooP->AddRef(); // ERROR: no permission
|
||||
fooP->Release(); // fooP->Release(); // ERROR: no permission
|
||||
|
||||
The final difference is that a bare |nsCOMPtr| (or rather a pointer to it) can't
|
||||
be supplied as an argument to a function that `fills in' a COM interface pointer.
|
||||
Rather it must be wrapped with a utility call that says whether the function calls
|
||||
|AddRef| before returning, e.g.,
|
||||
|
||||
...->QueryInterface(riid, &fooP) ...->QueryInterface(riid, getter_AddRefs(fooP))
|
||||
|
||||
LookupFoo(&fooP); LookupFoo( getter_doesnt_AddRef(fooP) );
|
||||
|
||||
Don't worry. It's a compile-time error if you forget to wrap it.
|
||||
|
||||
Compare the raw-pointer way...
|
||||
|
||||
IFoo* foo = 0;
|
||||
nsresult status = CreateIFoo(&foo);
|
||||
if ( NS_SUCCEEDED(status) )
|
||||
{
|
||||
IBar* bar = 0;
|
||||
if ( NS_SUCCEEDED(status = foo->QueryInterface(riid, &bar)) )
|
||||
{
|
||||
IFooBar* foobar = 0;
|
||||
if ( NS_SUCCEEDED(status = CreateIFooBar(foo, bar, &foobar)) )
|
||||
{
|
||||
foobar->DoTheReallyHardThing();
|
||||
foobar->Release();
|
||||
}
|
||||
bar->Release();
|
||||
}
|
||||
foo->Release();
|
||||
}
|
||||
|
||||
|
||||
|
||||
To the smart-pointer way...
|
||||
|
||||
nsCOMPtr<IFoo> fooP;
|
||||
nsresult status = CreateIFoo( getter_AddRefs(fooP) );
|
||||
if ( NS_SUCCEEDED(status) )
|
||||
if ( nsCOMPtr<IBar> barP( fooP ) )
|
||||
{
|
||||
nsCOMPtr<IFooBar> fooBarP;
|
||||
if ( NS_SUCCEEDED(status = CreateIFooBar(fooP, barP, getter_AddRefs(fooBarP))) )
|
||||
fooBarP->DoTheReallyHardThing();
|
||||
}
|
||||
|
||||
|
||||
Is there an easy way to convert my current code?
|
||||
|
||||
...
|
||||
|
||||
|
||||
What do I have to beware of?
|
||||
|
||||
VC++ < 6.0 _can't_ handle the following situation
|
||||
|
||||
class nsIFoo; // forward declare some class
|
||||
// ...
|
||||
nsCOMPtr<nsIFoo> bar; // ERROR: incomplete type nsIFoo, etc.
|
||||
|
||||
Instead, you must make sure that you actually defined the underlying interface class, e.g.,
|
||||
|
||||
#include "nsIFoo.h" // fully defines |class nsIFoo|
|
||||
// ...
|
||||
nsCOMPtr<nsIFoo> bar; // no problem
|
||||
|
||||
Why is this? It's because VC++ tries to instantiate every member of the template
|
||||
as soon as it sees the template declarations. Bad compiler. No cookie!
|
||||
[[Thanks to mjudge, waterson, and pinkerton on this one.]]
|
||||
|
||||
|
||||
Why does |getter_AddRefs| have such a funny name? I.e., why doesn't it follow our
|
||||
naming conventions?
|
||||
|
||||
|getter_AddRefs| and |getter_doesnt_AddRef| use underscores for the same
|
||||
reason our special macros do, quoting from our coding conventions "...to make them
|
||||
stick out like a sore thumb". Note also that since |AddRef| is one word,
|
||||
|getter_AddRefs| and |getter_doesnt_AddRef| couldn't have the right spacing if only inter-
|
||||
caps were used.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
WARNING:
|
||||
This file defines several macros for internal use only. These macros begin with the
|
||||
prefix |NSCAP_|. Do not use these macros in your own code. They are for internal use
|
||||
only for cross-platform compatibility, and are subject to change without notice.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Set up some |#define|s to turn off a couple of troublesome C++ features.
|
||||
Interestingly, none of the compilers barf on template stuff.
|
||||
|
||||
Ideally, we would want declarations like these in a configuration file
|
||||
that everybody would get. Deciding exactly how to do that should
|
||||
be part of the process of moving from experimental to production.
|
||||
|
||||
Update: ramiro is working on getting these into the configuration system.
|
||||
*/
|
||||
|
||||
#if defined(__GNUG__) && (__GNUC_MINOR__ <= 90) && !defined(SOLARIS)
|
||||
#define NSCAP_NO_MEMBER_USING_DECLARATIONS
|
||||
|
||||
#if (defined(LINUX) || defined(__bsdi__)) && (__GNUC_MINOR__ <= 7)
|
||||
#define NSCAP_NEED_UNUSED_VIRTUAL_IMPLEMENTATIONS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SOLARIS) && !defined(__GNUG__)
|
||||
#define NSCAP_NO_BOOL
|
||||
#define NSCAP_NO_EXPLICIT
|
||||
#define NSCAP_NO_NEW_CASTS
|
||||
#define NSCAP_NO_MEMBER_USING_DECLARATIONS
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1100)
|
||||
#define NSCAP_NO_EXPLICIT
|
||||
#define NSCAP_NO_BOOL
|
||||
#endif
|
||||
|
||||
#if defined(IRIX)
|
||||
#define NSCAP_NO_MEMBER_USING_DECLARATIONS
|
||||
#define NSCAP_NO_EXPLICIT
|
||||
#define NSCAP_NO_NEW_CASTS
|
||||
#define NSCAP_NO_BOOL
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef NSCAP_NO_EXPLICIT
|
||||
#define explicit
|
||||
#endif
|
||||
|
||||
#ifndef NSCAP_NO_NEW_CASTS
|
||||
#define NSCAP_REINTERPRET_CAST(T,x) reinterpret_cast<T>(x)
|
||||
#else
|
||||
#define NSCAP_REINTERPRET_CAST(T,x) ((T)(x))
|
||||
#endif
|
||||
|
||||
#ifndef NSCAP_NO_BOOL
|
||||
typedef bool NSCAP_BOOL;
|
||||
#else
|
||||
typedef PRBool NSCAP_BOOL;
|
||||
#endif
|
||||
|
||||
#ifdef NSCAP_FEATURE_DEBUG_MACROS
|
||||
#define NSCAP_ADDREF(ptr) NS_ADDREF(ptr)
|
||||
#define NSCAP_RELEASE(ptr) NS_RELEASE(ptr)
|
||||
#else
|
||||
#define NSCAP_ADDREF(ptr) (ptr)->AddRef()
|
||||
#define NSCAP_RELEASE(ptr) (ptr)->Release()
|
||||
#endif
|
||||
|
||||
/*
|
||||
WARNING:
|
||||
VC++4.2 is very picky. To compile under VC++4.2, the classes must be defined
|
||||
in an order that satisfies:
|
||||
|
||||
nsDerivedSafe < nsCOMPtr
|
||||
nsDontAddRef < nsCOMPtr
|
||||
nsCOMPtr < nsGetterAddRefs
|
||||
|
||||
The other compilers probably won't complain, so please don't reorder these
|
||||
classes, on pain of breaking 4.2 compatibility.
|
||||
*/
|
||||
|
||||
|
||||
template <class T>
|
||||
class nsDerivedSafe : public T
|
||||
/*
|
||||
No client should ever see or have to type the name of this class. It is the
|
||||
artifact that makes it a compile-time error to call |AddRef| and |Release|
|
||||
on a |nsCOMPtr|.
|
||||
|
||||
See |nsCOMPtr::operator->|, |nsCOMPtr::operator*|, et al.
|
||||
*/
|
||||
{
|
||||
private:
|
||||
#ifndef NSCAP_NO_MEMBER_USING_DECLARATIONS
|
||||
using T::AddRef;
|
||||
using T::Release;
|
||||
#else
|
||||
nsrefcnt AddRef();
|
||||
nsrefcnt Release();
|
||||
#endif
|
||||
|
||||
void operator delete( void* ); // NOT TO BE IMPLEMENTED
|
||||
// declaring |operator delete| private makes calling delete on an interface pointer a compile error
|
||||
|
||||
nsDerivedSafe& operator=( const nsDerivedSafe& ); // NOT TO BE IMPLEMENTED
|
||||
// you may not call |operator=()| through a dereferenced |nsCOMPtr|, because you'd get the wrong one
|
||||
};
|
||||
|
||||
#if defined(NSCAP_NO_MEMBER_USING_DECLARATIONS) && defined(NSCAP_NEED_UNUSED_VIRTUAL_IMPLEMENTATIONS)
|
||||
template <class T>
|
||||
nsrefcnt
|
||||
nsDerivedSafe<T>::AddRef()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
nsrefcnt
|
||||
nsDerivedSafe<T>::Release()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
struct nsDontQueryInterface
|
||||
/*
|
||||
...
|
||||
*/
|
||||
{
|
||||
explicit
|
||||
nsDontQueryInterface( T* aRawPtr )
|
||||
: mRawPtr(aRawPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
T* mRawPtr;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
nsDontQueryInterface<T>
|
||||
dont_QueryInterface( T* aRawPtr )
|
||||
{
|
||||
return nsDontQueryInterface<T>(aRawPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
struct nsQueryInterface
|
||||
{
|
||||
// explicit
|
||||
nsQueryInterface( nsISupports* aRawPtr, nsresult* error = 0 )
|
||||
: mRawPtr(aRawPtr),
|
||||
mErrorPtr(error)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
nsISupports* mRawPtr;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
inline
|
||||
nsQueryInterface
|
||||
do_QueryInterface( nsISupports* aRawPtr, nsresult* error = 0 )
|
||||
{
|
||||
return nsQueryInterface(aRawPtr, error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
struct nsDontAddRef
|
||||
/*
|
||||
...cooperates with |nsCOMPtr| to allow you to assign in a pointer _without_
|
||||
|AddRef|ing it. You would rarely use this directly, but rather through the
|
||||
machinery of |getter_AddRefs| in the argument list to functions that |AddRef|
|
||||
their results before returning them to the caller.
|
||||
|
||||
See also |getter_AddRefs()| and |class nsGetterAddRefs|.
|
||||
*/
|
||||
{
|
||||
explicit
|
||||
nsDontAddRef( T* aRawPtr )
|
||||
: mRawPtr(aRawPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
T* mRawPtr;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
nsDontAddRef<T>
|
||||
dont_AddRef( T* aRawPtr )
|
||||
/*
|
||||
...makes typing easier, because it deduces the template type, e.g.,
|
||||
you write |dont_AddRef(fooP)| instead of |nsDontAddRef<IFoo>(fooP)|.
|
||||
|
||||
Like the class it is shorthand for, you would rarely use this directly,
|
||||
but rather through |getter_AddRefs|.
|
||||
*/
|
||||
{
|
||||
return nsDontAddRef<T>(aRawPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
class nsCOMPtr_base
|
||||
{
|
||||
public:
|
||||
|
||||
nsCOMPtr_base( nsISupports* rawPtr = 0 )
|
||||
: mRawPtr(rawPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
~nsCOMPtr_base()
|
||||
{
|
||||
if ( mRawPtr )
|
||||
NSCAP_RELEASE(mRawPtr);
|
||||
}
|
||||
|
||||
NS_EXPORT void assign_with_AddRef( nsISupports* );
|
||||
NS_EXPORT void assign_with_QueryInterface( nsISupports*, const nsIID&, nsresult* );
|
||||
NS_EXPORT void** begin_assignment();
|
||||
|
||||
protected:
|
||||
nsISupports* mRawPtr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
class nsCOMPtr : private nsCOMPtr_base
|
||||
/*
|
||||
...
|
||||
*/
|
||||
{
|
||||
public:
|
||||
typedef T element_type;
|
||||
|
||||
nsCOMPtr()
|
||||
// : nsCOMPtr_base(0)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsQueryInterface& aSmartPtr )
|
||||
// : nsCOMPtr_base(0)
|
||||
{
|
||||
assign_with_QueryInterface(aSmartPtr.mRawPtr, T::IID(), aSmartPtr.mErrorPtr);
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsDontAddRef<T>& aSmartPtr )
|
||||
: nsCOMPtr_base(aSmartPtr.mRawPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsDontQueryInterface<T>& aSmartPtr )
|
||||
: nsCOMPtr_base(aSmartPtr.mRawPtr)
|
||||
{
|
||||
if ( mRawPtr )
|
||||
NSCAP_ADDREF(mRawPtr);
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsCOMPtr<T>& aSmartPtr )
|
||||
: nsCOMPtr_base(aSmartPtr.mRawPtr)
|
||||
{
|
||||
if ( mRawPtr )
|
||||
NSCAP_ADDREF(mRawPtr);
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsQueryInterface& rhs )
|
||||
{
|
||||
assign_with_QueryInterface(rhs.mRawPtr, T::IID(), rhs.mErrorPtr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsDontAddRef<T>& rhs )
|
||||
{
|
||||
if ( mRawPtr )
|
||||
NSCAP_RELEASE(mRawPtr);
|
||||
mRawPtr = rhs.mRawPtr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsDontQueryInterface<T>& rhs )
|
||||
{
|
||||
assign_with_AddRef(rhs.mRawPtr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsCOMPtr& rhs )
|
||||
{
|
||||
assign_with_AddRef(rhs.mRawPtr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsDerivedSafe<T>*
|
||||
get() const
|
||||
// returns a |nsDerivedSafe<T>*| to deny clients the use of |AddRef| and |Release|
|
||||
{
|
||||
return NSCAP_REINTERPRET_CAST(nsDerivedSafe<T>*, mRawPtr);
|
||||
}
|
||||
|
||||
nsDerivedSafe<T>*
|
||||
operator->() const
|
||||
// returns a |nsDerivedSafe<T>*| to deny clients the use of |AddRef| and |Release|
|
||||
{
|
||||
NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator->().");
|
||||
return get();
|
||||
}
|
||||
|
||||
nsDerivedSafe<T>&
|
||||
operator*() const
|
||||
// returns a |nsDerivedSafe<T>*| to deny clients the use of |AddRef| and |Release|
|
||||
{
|
||||
NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator*().");
|
||||
return *get();
|
||||
}
|
||||
|
||||
operator nsDerivedSafe<T>*() const
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
#if 0
|
||||
private:
|
||||
friend class nsGetterAddRefs<T>;
|
||||
|
||||
/*
|
||||
In a perfect world, the following member function, |StartAssignment|, would be private.
|
||||
It is and should be only accessed by the closely related class |nsGetterAddRefs<T>|.
|
||||
|
||||
Unfortunately, some compilers---most notably VC++5.0---fail to grok the
|
||||
friend declaration above or in any alternate acceptable form. So, physically
|
||||
it will be public (until our compilers get smarter); but it is not to be
|
||||
considered part of the logical public interface.
|
||||
*/
|
||||
#endif
|
||||
|
||||
T**
|
||||
StartAssignment()
|
||||
{
|
||||
return NSCAP_REINTERPRET_CAST(T**, begin_assignment());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class nsGetterAddRefs
|
||||
/*
|
||||
...
|
||||
|
||||
This class is designed to be used for anonymous temporary objects in the
|
||||
argument list of calls that return COM interface pointers, e.g.,
|
||||
|
||||
nsCOMPtr<IFoo> fooP;
|
||||
...->QueryInterface(iid, nsGetterAddRefs<IFoo>(fooP))
|
||||
...->QueryInterface(iid, getter_AddRefs(fooP))
|
||||
|
||||
When initialized with a |nsCOMPtr|, as in the example above, it returns
|
||||
a |void**| (or |T**| if needed) that the outer call (|QueryInterface| in this
|
||||
case) can fill in. When this temporary object goes out of scope, just after
|
||||
the call returns, its destructor assigned the resulting interface pointer, i.e.,
|
||||
|QueryInterface|s result, into the |nsCOMPtr| it was initialized with.
|
||||
|
||||
See also |nsGetterDoesntAddRef|.
|
||||
*/
|
||||
{
|
||||
public:
|
||||
explicit
|
||||
nsGetterAddRefs( nsCOMPtr<T>& aSmartPtr )
|
||||
: mTargetSmartPtr(aSmartPtr)
|
||||
{
|
||||
// nothing else to do
|
||||
}
|
||||
|
||||
operator void**()
|
||||
{
|
||||
// NS_PRECONDITION(mTargetSmartPtr != 0, "getter_AddRefs into no destination");
|
||||
return NSCAP_REINTERPRET_CAST(void**, mTargetSmartPtr.StartAssignment());
|
||||
}
|
||||
|
||||
T*&
|
||||
operator*()
|
||||
{
|
||||
// NS_PRECONDITION(mTargetSmartPtr != 0, "getter_AddRefs into no destination");
|
||||
return *(mTargetSmartPtr.StartAssignment());
|
||||
}
|
||||
|
||||
operator T**()
|
||||
{
|
||||
// NS_PRECONDITION(mTargetSmartPtr != 0, "getter_AddRefs into no destination");
|
||||
return mTargetSmartPtr.StartAssignment();
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<T>& mTargetSmartPtr;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
nsGetterAddRefs<T>
|
||||
getter_AddRefs( nsCOMPtr<T>& aSmartPtr )
|
||||
/*
|
||||
Used around a |nsCOMPtr| when
|
||||
...makes the class |nsGetterAddRefs<T>| invisible.
|
||||
*/
|
||||
{
|
||||
return nsGetterAddRefs<T>(aSmartPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // !defined(nsCOMPtr_h___)
|
||||
218
mozilla/xpcom/base/nsCom.h
Normal file
218
mozilla/xpcom/base/nsCom.h
Normal file
@@ -0,0 +1,218 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsCom_h__
|
||||
#define nsCom_h__
|
||||
|
||||
/*
|
||||
* API Import/Export macros
|
||||
*/
|
||||
|
||||
#ifdef _IMPL_NS_COM
|
||||
#ifdef XP_PC
|
||||
#define NS_COM _declspec(dllexport)
|
||||
#else /* !XP_PC */
|
||||
#define NS_COM
|
||||
#endif /* !XP_PC */
|
||||
#else /* !_IMPL_NS_COM */
|
||||
#ifdef XP_PC
|
||||
#define NS_COM _declspec(dllimport)
|
||||
#else /* !XP_PC */
|
||||
#define NS_COM
|
||||
#endif /* !XP_PC */
|
||||
#endif /* !_IMPL_NS_COM */
|
||||
|
||||
/*
|
||||
* DLL Export macro
|
||||
*/
|
||||
|
||||
#if defined(XP_PC)
|
||||
|
||||
#define NS_EXPORT _declspec(dllexport)
|
||||
#define NS_EXPORT_(type) _declspec(dllexport) type __stdcall
|
||||
|
||||
#define NS_IMETHOD_(type) virtual type __stdcall
|
||||
#define NS_IMETHOD virtual nsresult __stdcall
|
||||
#define NS_IMETHODIMP_(type) type __stdcall
|
||||
#define NS_IMETHODIMP nsresult __stdcall
|
||||
|
||||
#define NS_METHOD_(type) type __stdcall
|
||||
#define NS_METHOD nsresult __stdcall
|
||||
|
||||
#elif defined(XP_MAC)
|
||||
|
||||
#define NS_EXPORT __declspec(export)
|
||||
#define NS_EXPORT_(type) __declspec(export) type
|
||||
|
||||
#define NS_IMETHOD_(type) virtual type
|
||||
#define NS_IMETHOD virtual nsresult
|
||||
#define NS_IMETHODIMP_(type) type
|
||||
#define NS_IMETHODIMP nsresult
|
||||
|
||||
#define NS_METHOD_(type) type
|
||||
#define NS_METHOD nsresult
|
||||
|
||||
#else /* !XP_PC && !XP_MAC */
|
||||
|
||||
#define NS_EXPORT
|
||||
#define NS_EXPORT_(type) type
|
||||
|
||||
#define NS_IMETHOD_(type) virtual type
|
||||
#define NS_IMETHOD virtual nsresult
|
||||
#define NS_IMETHODIMP_(type) type
|
||||
#define NS_IMETHODIMP nsresult
|
||||
|
||||
#define NS_METHOD_(type) type
|
||||
#define NS_METHOD nsresult
|
||||
|
||||
#endif /* !XP_PC */
|
||||
|
||||
/* use these functions to associate get/set methods with a
|
||||
C++ member variable
|
||||
*/
|
||||
|
||||
#define NS_METHOD_GETTER(_method, _type, _member) \
|
||||
_method(_type* aResult) \
|
||||
{\
|
||||
if (!aResult) return NS_ERROR_NULL_POINTER; \
|
||||
*aResult = _member; \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
#define NS_METHOD_SETTER(_method, _type, _member) \
|
||||
_method(_type aResult) \
|
||||
{ \
|
||||
_member = aResult; \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
/*
|
||||
* special for strings to get/set char* strings
|
||||
* using PL_strdup and PR_FREEIF
|
||||
*/
|
||||
#define NS_METHOD_GETTER_STR(_method,_member) \
|
||||
_method(char* *aString)\
|
||||
{\
|
||||
if (!aString) return NS_ERROR_NULL_POINTER; \
|
||||
*aString = PL_strdup(_member); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
#define NS_METHOD_SETTER_STR(_method, _member) \
|
||||
_method(char *aString)\
|
||||
{\
|
||||
PR_FREEIF(_member);\
|
||||
if (aString) _member = PL_strdup(aString); \
|
||||
else _member = nsnull;\
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
/* Getter/Setter macros.
|
||||
Usage:
|
||||
NS_IMPL_[CLASS_]GETTER[_<type>](method, [type,] member);
|
||||
NS_IMPL_[CLASS_]SETTER[_<type>](method, [type,] member);
|
||||
NS_IMPL_[CLASS_]GETSET[_<type>]([class, ]postfix, [type,] member);
|
||||
|
||||
where:
|
||||
CLASS_ - implementation is inside a class definition
|
||||
(otherwise the class name is needed)
|
||||
Do NOT use in publicly exported header files, because
|
||||
the implementation may be included many times over.
|
||||
Instead, use the non-CLASS_ version.
|
||||
_<type> - For more complex (STR, IFACE) data types
|
||||
(otherwise the simple data type is needed)
|
||||
method - name of the method, such as GetWidth or SetColor
|
||||
type - simple data type if required
|
||||
member - class member variable such as m_width or mColor
|
||||
class - the class name, such as Window or MyObject
|
||||
postfix - Method part after Get/Set such as "Width" for "GetWidth"
|
||||
|
||||
Example:
|
||||
class Window {
|
||||
public:
|
||||
NS_IMPL_CLASS_GETSET(Width, int, m_width);
|
||||
NS_IMPL_CLASS_GETTER_STR(GetColor, m_color);
|
||||
NS_IMETHOD SetColor(char *color);
|
||||
|
||||
private:
|
||||
int m_width; // read/write
|
||||
char *m_color; // readonly
|
||||
};
|
||||
|
||||
// defined outside of class
|
||||
NS_IMPL_SETTER_STR(Window::GetColor, m_color);
|
||||
|
||||
Questions/Comments to alecf@netscape.com
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Getter/Setter implementation within a class definition
|
||||
*/
|
||||
|
||||
/* simple data types */
|
||||
#define NS_IMPL_CLASS_GETTER(_method, _type, _member) \
|
||||
NS_IMETHOD NS_METHOD_GETTER(_method, _type, _member)
|
||||
|
||||
#define NS_IMPL_CLASS_SETTER(_method, _type, _member) \
|
||||
NS_IMETHOD NS_METHOD_SETTER(_method, _type, _member)
|
||||
|
||||
#define NS_IMPL_CLASS_GETSET(_postfix, _type, _member) \
|
||||
NS_IMPL_CLASS_GETTER(Get##_postfix, _type, _member) \
|
||||
NS_IMPL_CLASS_SETTER(Set##_postfix, _type, _member)
|
||||
|
||||
/* strings */
|
||||
#define NS_IMPL_CLASS_GETTER_STR(_method, _member) \
|
||||
NS_IMETHOD NS_METHOD_GETTER_STR(_method, _member)
|
||||
|
||||
#define NS_IMPL_CLASS_SETTER_STR(_method, _member) \
|
||||
NS_IMETHOD NS_METHOD_SETTER_STR(_method, _member)
|
||||
|
||||
#define NS_IMPL_CLASS_GETSET_STR(_postfix, _member) \
|
||||
NS_IMPL_CLASS_GETTER_STR(Get##_postfix, _member) \
|
||||
NS_IMPL_CLASS_SETTER_STR(Set##_postfix, _member)
|
||||
|
||||
/* Getter/Setter implementation outside of a class definition */
|
||||
|
||||
/* simple data types */
|
||||
#define NS_IMPL_GETTER(_method, _type, _member) \
|
||||
NS_IMETHODIMP NS_METHOD_GETTER(_method, _type, _member)
|
||||
|
||||
#define NS_IMPL_SETTER(_method, _type, _member) \
|
||||
NS_IMETHODIMP NS_METHOD_SETTER(_method, _type, _member)
|
||||
|
||||
#define NS_IMPL_GETSET(_class, _postfix, _type, _member) \
|
||||
NS_IMPL_GETTER(_class::Get##_postfix, _type, _member) \
|
||||
NS_IMPL_SETTER(_class::Set##_postfix, _type, _member)
|
||||
|
||||
/* strings */
|
||||
#define NS_IMPL_GETTER_STR(_method, _member) \
|
||||
NS_IMETHODIMP NS_METHOD_GETTER_STR(_method, _member)
|
||||
|
||||
#define NS_IMPL_SETTER_STR(_method, _member) \
|
||||
NS_IMETHODIMP NS_METHOD_SETTER_STR(_method, _member)
|
||||
|
||||
#define NS_IMPL_GETSET_STR(_class, _postfix, _member) \
|
||||
NS_IMPL_GETTER_STR(_class::Get##_postfix, _member) \
|
||||
NS_IMPL_SETTER_STR(_class::Set##_postfix, _member)
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
169
mozilla/xpcom/base/nsDebug.cpp
Normal file
169
mozilla/xpcom/base/nsDebug.cpp
Normal file
@@ -0,0 +1,169 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "prlog.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined(XP_MAC)
|
||||
#define TEMP_MAC_HACK
|
||||
|
||||
//------------------------
|
||||
#ifdef TEMP_MAC_HACK
|
||||
#include <MacTypes.h>
|
||||
#include <Processes.h>
|
||||
|
||||
// TEMPORARY UNTIL WE HAVE MACINTOSH ENVIRONMENT VARIABLES THAT CAN TURN ON
|
||||
// LOGGING ON MACINTOSH
|
||||
// At this moment, NSPR's logging is a no-op on Macintosh.
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#undef PR_LOG
|
||||
#define PR_LOG(module,level,args) dprintf args
|
||||
static void dprintf(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
Str255 buffer;
|
||||
|
||||
va_start(ap, format);
|
||||
buffer[0] = vsnprintf((char *)buffer + 1, sizeof(buffer) - 1, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
DebugStr(buffer);
|
||||
}
|
||||
#endif // TEMP_MAC_HACK
|
||||
//------------------------
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of the nsDebug methods. Note that this code is
|
||||
* always compiled in, in case some other module that uses it is
|
||||
* compiled with debugging even if this library is not.
|
||||
*/
|
||||
|
||||
static PRLogModuleInfo* gDebugLog;
|
||||
|
||||
static void InitLog(void)
|
||||
{
|
||||
if (0 == gDebugLog) {
|
||||
gDebugLog = PR_NewLogModule("nsDebug");
|
||||
gDebugLog->level = PR_LOG_DEBUG;
|
||||
}
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("Abort: at file %s, line %d", aFile, aLine));
|
||||
PR_LogFlush();
|
||||
#if defined(_WIN32)
|
||||
long* __p = (long*) 0x7;
|
||||
*__p = 0x7;
|
||||
#elif defined(XP_MAC)
|
||||
ExitToShell();
|
||||
#elif defined(XP_UNIX)
|
||||
::abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::Break(const char* aFile, PRIntn aLine)
|
||||
{
|
||||
#ifndef TEMP_MAC_HACK
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("Break: at file %s, line %d", aFile, aLine));
|
||||
PR_LogFlush();
|
||||
//XXX this works on win32 only for now. For all the other platforms call Abort
|
||||
#if defined(_WIN32)
|
||||
::DebugBreak();
|
||||
#else
|
||||
Abort(aFile, aLine);
|
||||
#endif
|
||||
#endif // TEMP_MAC_HACK
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::PreCondition(const char* aStr, const char* aExpr,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("PreCondition: \"%s\" (%s) at file %s, line %d", aStr, aExpr,
|
||||
aFile, aLine));
|
||||
Break(aFile, aLine);
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::PostCondition(const char* aStr, const char* aExpr,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("PostCondition: \"%s\" (%s) at file %s, line %d", aStr, aExpr,
|
||||
aFile, aLine));
|
||||
Break(aFile, aLine);
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::Assertion(const char* aStr, const char* aExpr,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("Assertion: \"%s\" (%s) at file %s, line %d", aStr, aExpr,
|
||||
aFile, aLine));
|
||||
Break(aFile, aLine);
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::NotYetImplemented(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("NotYetImplemented: \"%s\" at file %s, line %d", aMessage,
|
||||
aFile, aLine));
|
||||
Break(aFile, aLine);
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::NotReached(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("NotReached: \"%s\" at file %s, line %d", aMessage, aFile, aLine));
|
||||
Break(aFile, aLine);
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::Error(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("Error: \"%s\" at file %s, line %d", aMessage, aFile, aLine));
|
||||
Break(aFile, aLine);
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::Warning(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("Warning: \"%s\" at file %s, line %d", aMessage, aFile, aLine));
|
||||
}
|
||||
179
mozilla/xpcom/base/nsDebug.h
Normal file
179
mozilla/xpcom/base/nsDebug.h
Normal file
@@ -0,0 +1,179 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsDebug_h___
|
||||
#define nsDebug_h___
|
||||
|
||||
#include "nsCom.h"
|
||||
#include "prtypes.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define NS_DEBUG
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Namespace for debugging methods. Note that your code must use the
|
||||
* macros defined later in this file so that the debug code can be
|
||||
* conditionally compiled out.
|
||||
*/
|
||||
class nsDebug {
|
||||
public:
|
||||
// XXX add in log controls here
|
||||
// XXX probably want printf type arguments
|
||||
|
||||
/**
|
||||
* Abort the executing program. This works on all architectures.
|
||||
*/
|
||||
static NS_COM void Abort(const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Break the executing program into the debugger.
|
||||
*/
|
||||
static NS_COM void Break(const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log a pre-condition message to the debug log
|
||||
*/
|
||||
static NS_COM void PreCondition(const char* aStr, const char* aExpr,
|
||||
const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log a post-condition message to the debug log
|
||||
*/
|
||||
static NS_COM void PostCondition(const char* aStr, const char* aExpr,
|
||||
const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log an assertion message to the debug log
|
||||
*/
|
||||
static NS_COM void Assertion(const char* aStr, const char* aExpr,
|
||||
const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log a not-yet-implemented message to the debug log
|
||||
*/
|
||||
static NS_COM void NotYetImplemented(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log a not-reached message to the debug log
|
||||
*/
|
||||
static NS_COM void NotReached(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log an error message to the debug log. This call returns.
|
||||
*/
|
||||
static NS_COM void Error(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log a warning message to the debug log.
|
||||
*/
|
||||
static NS_COM void Warning(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine);
|
||||
};
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
/**
|
||||
* Test a precondition for truth. If the expression is not true then
|
||||
* trigger a program failure.
|
||||
*/
|
||||
#define NS_PRECONDITION(expr,str) \
|
||||
if (!(expr)) \
|
||||
nsDebug::PreCondition(str, #expr, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Test an assertion for truth. If the expression is not true then
|
||||
* trigger a program failure.
|
||||
*/
|
||||
#define NS_ASSERTION(expr,str) \
|
||||
if (!(expr)) \
|
||||
nsDebug::Assertion(str, #expr, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Test an assertion for truth. If the expression is not true then
|
||||
* trigger a program failure. The expression will still be
|
||||
* executed in release mode.
|
||||
*/
|
||||
#define NS_VERIFY(expr,str) \
|
||||
if (!(expr)) \
|
||||
nsDebug::Assertion(str, #expr, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Test a post-condition for truth. If the expression is not true then
|
||||
* trigger a program failure.
|
||||
*/
|
||||
#define NS_POSTCONDITION(expr,str) \
|
||||
if (!(expr)) \
|
||||
nsDebug::PostCondition(str, #expr, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* This macros triggers a program failure if executed. It indicates that
|
||||
* an attempt was made to execute some unimplimented functionality.
|
||||
*/
|
||||
#define NS_NOTYETIMPLEMENTED(str) \
|
||||
nsDebug::NotYetImplemented(str, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* This macros triggers a program failure if executed. It indicates that
|
||||
* an attempt was made to execute some unimplimented functionality.
|
||||
*/
|
||||
#define NS_NOTREACHED(str) \
|
||||
nsDebug::NotReached(str, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Log an error message.
|
||||
*/
|
||||
#define NS_ERROR(str) \
|
||||
nsDebug::Error(str, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Log a warning message.
|
||||
*/
|
||||
#define NS_WARNING(str) \
|
||||
nsDebug::Warning(str, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Trigger an abort
|
||||
*/
|
||||
#define NS_ABORT() \
|
||||
nsDebug::Abort(__FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Cause a break
|
||||
*/
|
||||
#define NS_BREAK() \
|
||||
nsDebug::Break(__FILE__, __LINE__)
|
||||
|
||||
#else /* NS_DEBUG */
|
||||
|
||||
#define NS_PRECONDITION(expr,str) {}
|
||||
#define NS_ASSERTION(expr,str) {}
|
||||
#define NS_VERIFY(expr,str) expr
|
||||
#define NS_POSTCONDITION(expr,str) {}
|
||||
#define NS_NOTYETIMPLEMENTED(str) {}
|
||||
#define NS_NOTREACHED(str) {}
|
||||
#define NS_ERROR(str) {}
|
||||
#define NS_WARNING(str) {}
|
||||
#define NS_ABORT() {}
|
||||
#define NS_BREAK() {}
|
||||
|
||||
#endif /* ! NS_DEBUG */
|
||||
|
||||
#endif /* nsDebug_h___ */
|
||||
186
mozilla/xpcom/base/nsError.h
Normal file
186
mozilla/xpcom/base/nsError.h
Normal file
@@ -0,0 +1,186 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsError_h
|
||||
#define nsError_h
|
||||
|
||||
#ifndef prtypes_h___
|
||||
#include "prtypes.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Generic result data type
|
||||
*/
|
||||
|
||||
typedef PRUint32 nsresult;
|
||||
|
||||
/*
|
||||
* To add error code to your module, you need to do the following:
|
||||
*
|
||||
* 1) Add a module offset code. Add yours to the bottom of the list
|
||||
* right below this comment, adding 1.
|
||||
*
|
||||
* 2) In your module, define a header file which uses one of the
|
||||
* NE_ERROR_GENERATExxxxxx macros. Some examples below:
|
||||
*
|
||||
* #define NS_ERROR_MYMODULE_MYERROR1 NS_ERROR_GENERATE(NS_ERROR_SEVERITY_ERROR,NS_ERROR_MODULE_MYMODULE,1)
|
||||
* #define NS_ERROR_MYMODULE_MYERROR2 NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_MYMODULE,2)
|
||||
* #define NS_ERROR_MYMODULE_MYERROR3 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MYMODULE,3)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Standard Module Offset Code. Each Module should identify a unique number
|
||||
* and then all errors associated with that module become offsets from the
|
||||
* base associated with that module id. There are 16 bits of code bits for
|
||||
* each module.
|
||||
*/
|
||||
|
||||
#define NS_ERROR_MODULE_XPCOM 1
|
||||
#define NS_ERROR_MODULE_BASE 2
|
||||
#define NS_ERROR_MODULE_GFX 3
|
||||
#define NS_ERROR_MODULE_WIDGET 4
|
||||
#define NS_ERROR_MODULE_CALENDAR 5
|
||||
#define NS_ERROR_MODULE_NETWORK 6
|
||||
#define NS_ERROR_MODULE_PLUGINS 7
|
||||
#define NS_ERROR_MODULE_LAYOUT 8
|
||||
#define NS_ERROR_MODULE_HTMLPARSER 9
|
||||
#define NS_ERROR_MODULE_RDF 10
|
||||
#define NS_ERROR_MODULE_UCONV 11
|
||||
#define NS_ERROR_MODULE_REG 12
|
||||
#define NS_ERROR_MODULE_FILES 13
|
||||
|
||||
#define NS_ERROR_MODULE_MAILNEWS 16
|
||||
|
||||
/**
|
||||
* @name Standard Error Handling Macros
|
||||
*/
|
||||
|
||||
#define NS_FAILED(_nsresult) ((_nsresult) & 0x80000000)
|
||||
#define NS_SUCCEEDED(_nsresult) (!((_nsresult) & 0x80000000))
|
||||
|
||||
/**
|
||||
* @name Severity Code. This flag identifies the level of warning
|
||||
*/
|
||||
|
||||
#define NS_ERROR_SEVERITY_SUCCESS 0
|
||||
#define NS_ERROR_SEVERITY_ERROR 1
|
||||
|
||||
/**
|
||||
* @name Mozilla Code. This flag separates consumers of mozilla code
|
||||
* from the native platform
|
||||
*/
|
||||
|
||||
#define NS_ERROR_MODULE_BASE_OFFSET 0x45
|
||||
|
||||
/**
|
||||
* @name Standard Error Generating Macros
|
||||
*/
|
||||
|
||||
#define NS_ERROR_GENERATE(sev,module,code) \
|
||||
((nsresult) (((PRUint32)(sev)<<31) | ((PRUint32)(module+NS_ERROR_MODULE_BASE_OFFSET)<<16) | ((PRUint32)(code))) )
|
||||
|
||||
#define NS_ERROR_GENERATE_SUCCESS(module,code) \
|
||||
((nsresult) (((PRUint32)(NS_ERROR_SEVERITY_SUCCESS)<<31) | ((PRUint32)(module+NS_ERROR_MODULE_BASE_OFFSET)<<16) | ((PRUint32)(code))) )
|
||||
|
||||
#define NS_ERROR_GENERATE_FAILURE(module,code) \
|
||||
((nsresult) (((PRUint32)(NS_ERROR_SEVERITY_ERROR)<<31) | ((PRUint32)(module+NS_ERROR_MODULE_BASE_OFFSET)<<16) | ((PRUint32)(code))) )
|
||||
|
||||
/**
|
||||
* @name Standard Macros for retrieving error bits
|
||||
*/
|
||||
|
||||
#if PR_BYTES_PER_INT == 4
|
||||
#define NS_IS_ERROR(err) (((nsresult)(err))<0)
|
||||
#else
|
||||
#define NS_IS_ERROR(err) (((((PRUint32)(err)) >> 31) & 0x1) == NS_ERROR_SEVERITY_ERROR)
|
||||
#endif
|
||||
|
||||
#define NS_ERROR_GET_CODE(err) ((err) & 0xffff)
|
||||
#define NS_ERROR_GET_MODULE(err) (((((err) >> 16) - NS_ERROR_MODULE_BASE_OFFSET) & 0x1fff))
|
||||
#define NS_ERROR_GET_SEVERITY(err) (((err) >> 31) & 0x1)
|
||||
|
||||
/**
|
||||
* @name Standard return values
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
|
||||
/* Standard "it worked" return value */
|
||||
#define NS_OK 0
|
||||
|
||||
/* The backwards COM false */
|
||||
#define NS_COMFALSE 1
|
||||
|
||||
#define NS_ERROR_BASE ((nsresult) 0xC1F30000)
|
||||
|
||||
/* Returned when an instance is not initialized */
|
||||
#define NS_ERROR_NOT_INITIALIZED (NS_ERROR_BASE + 1)
|
||||
|
||||
/* Returned when an instance is already initialized */
|
||||
#define NS_ERROR_ALREADY_INITIALIZED (NS_ERROR_BASE + 2)
|
||||
|
||||
/* Returned by a not implemented function */
|
||||
#define NS_ERROR_NOT_IMPLEMENTED ((nsresult) 0x80004001L)
|
||||
|
||||
/* Returned when a given interface is not supported. */
|
||||
#define NS_NOINTERFACE ((nsresult) 0x80004002L)
|
||||
#define NS_ERROR_NO_INTERFACE NS_NOINTERFACE
|
||||
|
||||
#define NS_ERROR_INVALID_POINTER ((nsresult) 0x80004003L)
|
||||
#define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
|
||||
|
||||
/* Returned when a function aborts */
|
||||
#define NS_ERROR_ABORT ((nsresult) 0x80004004L)
|
||||
|
||||
/* Returned when a function fails */
|
||||
#define NS_ERROR_FAILURE ((nsresult) 0x80004005L)
|
||||
|
||||
/* Returned when an unexpected error occurs */
|
||||
#define NS_ERROR_UNEXPECTED ((nsresult) 0x8000ffffL)
|
||||
|
||||
/* Returned when a memory allocation failes */
|
||||
#define NS_ERROR_OUT_OF_MEMORY ((nsresult) 0x8007000eL)
|
||||
|
||||
/* Returned when an illegal value is passed */
|
||||
#define NS_ERROR_ILLEGAL_VALUE ((nsresult) 0x80070057L)
|
||||
#define NS_ERROR_INVALID_ARG NS_ERROR_ILLEGAL_VALUE
|
||||
|
||||
/* Returned when a class doesn't allow aggregation */
|
||||
#define NS_ERROR_NO_AGGREGATION ((nsresult) 0x80040110L)
|
||||
|
||||
/* Returned when a class doesn't allow aggregation */
|
||||
#define NS_ERROR_NOT_AVAILABLE ((nsresult) 0x80040111L)
|
||||
|
||||
/* Returned when a class is not registered */
|
||||
#define NS_ERROR_FACTORY_NOT_REGISTERED ((nsresult) 0x80040154L)
|
||||
|
||||
/* Returned when a dynamically loaded factory couldn't be found */
|
||||
#define NS_ERROR_FACTORY_NOT_LOADED ((nsresult) 0x800401f8L)
|
||||
|
||||
/* Returned when a factory doesn't support signatures */
|
||||
#define NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT \
|
||||
(NS_ERROR_BASE + 0x101)
|
||||
|
||||
/* Returned when a factory already is registered */
|
||||
#define NS_ERROR_FACTORY_EXISTS (NS_ERROR_BASE + 0x100)
|
||||
|
||||
/*@}*/
|
||||
#endif
|
||||
|
||||
82
mozilla/xpcom/base/nsIAllocator.h
Normal file
82
mozilla/xpcom/base/nsIAllocator.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIAllocator_h___
|
||||
#define nsIAllocator_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
/**
|
||||
* Unlike IMalloc, this interface returns nsresults and doesn't
|
||||
* implement the problematic GetSize and DidAlloc routines.
|
||||
*/
|
||||
|
||||
class nsIAllocator : public nsISupports {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Allocates a block of memory of a particular size.
|
||||
*
|
||||
* @param size - the size of the block to allocate
|
||||
* @result the block of memory
|
||||
*/
|
||||
NS_IMETHOD_(void*) Alloc(PRUint32 size) = 0;
|
||||
|
||||
/**
|
||||
* Reallocates a block of memory to a new size.
|
||||
*
|
||||
* @param ptr - the block of memory to reallocate
|
||||
* @param size - the new size
|
||||
* @result the rellocated block of memory
|
||||
*/
|
||||
NS_IMETHOD_(void*) Realloc(void* ptr, PRUint32 size) = 0;
|
||||
|
||||
/**
|
||||
* Frees a block of memory.
|
||||
*
|
||||
* @param ptr - the block of memory to free
|
||||
*/
|
||||
NS_IMETHOD Free(void* ptr) = 0;
|
||||
|
||||
/**
|
||||
* Attempts to shrink the heap.
|
||||
*/
|
||||
NS_IMETHOD HeapMinimize(void) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IALLOCATOR_IID \
|
||||
{ /* 56def700-b1b9-11d2-8177-006008119d7a */ \
|
||||
0x56def700, \
|
||||
0xb1b9, \
|
||||
0x11d2, \
|
||||
{0x81, 0x77, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
// To get the global memory manager service:
|
||||
#define NS_ALLOCATOR_CID \
|
||||
{ /* aafe6770-b1bb-11d2-8177-006008119d7a */ \
|
||||
0xaafe6770, \
|
||||
0xb1bb, \
|
||||
0x11d2, \
|
||||
{0x81, 0x77, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIAllocator_h___ */
|
||||
73
mozilla/xpcom/base/nsID.cpp
Normal file
73
mozilla/xpcom/base/nsID.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#include "nsID.h"
|
||||
#include "prprf.h"
|
||||
|
||||
static const char gIDFormat[] =
|
||||
"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}";
|
||||
|
||||
static const char gIDFormat2[] =
|
||||
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
|
||||
|
||||
/*
|
||||
* Turns a {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} string into
|
||||
* an nsID
|
||||
*/
|
||||
|
||||
NS_COM PRBool nsID::Parse(char *aIDStr)
|
||||
{
|
||||
PRInt32 count = 0;
|
||||
PRInt32 n1, n2, n3[8];
|
||||
PRInt32 n0;
|
||||
|
||||
if (NULL != aIDStr) {
|
||||
count = PR_sscanf(aIDStr,
|
||||
(aIDStr[0] == '{') ? gIDFormat : gIDFormat2,
|
||||
&n0, &n1, &n2,
|
||||
&n3[0],&n3[1],&n3[2],&n3[3],
|
||||
&n3[4],&n3[5],&n3[6],&n3[7]);
|
||||
|
||||
m0 = (PRInt32) n0;
|
||||
m1 = (PRInt16) n1;
|
||||
m2 = (PRInt16) n2;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
m3[i] = (PRInt8) n3[i];
|
||||
}
|
||||
}
|
||||
return (PRBool) (count == 11);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns an allocated string in {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
|
||||
* format. Caller should delete [] the string.
|
||||
*/
|
||||
|
||||
NS_COM char *nsID::ToString() const
|
||||
{
|
||||
char *res = new char[39];
|
||||
|
||||
if (res != NULL) {
|
||||
PR_snprintf(res, 39, gIDFormat,
|
||||
m0, (PRUint32) m1, (PRUint32) m2,
|
||||
(PRUint32) m3[0], (PRUint32) m3[1], (PRUint32) m3[2],
|
||||
(PRUint32) m3[3], (PRUint32) m3[4], (PRUint32) m3[5],
|
||||
(PRUint32) m3[6], (PRUint32) m3[7]);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
89
mozilla/xpcom/base/nsID.h
Normal file
89
mozilla/xpcom/base/nsID.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsID_h__
|
||||
#define nsID_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "string.h"
|
||||
#include "nsCom.h"
|
||||
|
||||
/**
|
||||
* A "unique identifier". This is modeled after OSF DCE UUIDs.
|
||||
*/
|
||||
|
||||
struct nsID {
|
||||
/**
|
||||
* @name Indentifier values
|
||||
*/
|
||||
|
||||
//@{
|
||||
PRUint32 m0;
|
||||
PRUint16 m1;
|
||||
PRUint16 m2;
|
||||
PRUint8 m3[8];
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Methods
|
||||
*/
|
||||
|
||||
//@{
|
||||
/**
|
||||
* Equivalency method. Compares this nsID with another.
|
||||
* @return <b>PR_TRUE</b> if they are the same, <b>PR_FALSE</b> if not.
|
||||
*/
|
||||
|
||||
inline PRBool Equals(const nsID& other) const {
|
||||
return (PRBool)
|
||||
((((PRUint32*) &m0)[0] == ((PRUint32*) &other.m0)[0]) &&
|
||||
(((PRUint32*) &m0)[1] == ((PRUint32*) &other.m0)[1]) &&
|
||||
(((PRUint32*) &m0)[2] == ((PRUint32*) &other.m0)[2]) &&
|
||||
(((PRUint32*) &m0)[3] == ((PRUint32*) &other.m0)[3]));
|
||||
}
|
||||
|
||||
/**
|
||||
* nsID Parsing method. Turns a {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
|
||||
* string into an nsID
|
||||
*/
|
||||
NS_COM PRBool Parse(char *aIDStr);
|
||||
|
||||
/**
|
||||
* nsID string encoder. Returns an allocated string in
|
||||
* {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} format. Caller should free string.
|
||||
*/
|
||||
NS_COM char* ToString() const;
|
||||
//@}
|
||||
};
|
||||
|
||||
/**
|
||||
* Declare an ID. If NS_IMPL_IDS is set, a variable <i>_name</i> is declared
|
||||
* with the given values, otherwise <i>_name</i> is declared as an
|
||||
* <tt>extern</tt> variable.
|
||||
*/
|
||||
|
||||
#ifdef NS_IMPL_IDS
|
||||
#define NS_DECLARE_ID(_name,m0,m1,m2,m30,m31,m32,m33,m34,m35,m36,m37) \
|
||||
extern "C" const nsID _name = {m0,m1,m2,{m30,m31,m32,m33,m34,m35,m36,m37}}
|
||||
#else
|
||||
#define NS_DECLARE_ID(_name,m0,m1,m2,m30,m31,m32,m33,m34,m35,m36,m37) \
|
||||
extern "C" const nsID _name
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
142
mozilla/xpcom/base/nsIPtr.h
Normal file
142
mozilla/xpcom/base/nsIPtr.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIPtr_h___
|
||||
#define nsIPtr_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
/*
|
||||
* nsIPtr is an "auto-release pointer" class for nsISupports based interfaces
|
||||
*
|
||||
* It's intent is to be a "set and forget" pointer to help with managing
|
||||
* active references to nsISupports bases objects.
|
||||
*
|
||||
* The pointer object ensures that the underlying pointer is always
|
||||
* released whenever the value is changed or when the object leaves scope.
|
||||
*
|
||||
* Proper care needs to be taken when assigning pointers to a nsIPtr.
|
||||
* When asigning from a C pointer (nsISupports*), the pointer presumes
|
||||
* an active reference and subsumes it. When assigning from another nsIPtr,
|
||||
* a new reference is established.
|
||||
*
|
||||
* There are 3 ways to assign a value to a nsIPtr.
|
||||
* 1) Direct construction or assignment from a C pointer.
|
||||
* 2) Direct construction or assignment form another nsIPtr.
|
||||
* 3) Usage of an "out parameter" method.
|
||||
* a) AssignRef() releases the underlying pointer and returns a reference to it.
|
||||
* Useful for pointer reference out paramaters.
|
||||
* b) AssignPtr() releases the underlying pointer and returns a pointer to it.
|
||||
* c) Query() releases the underlying pointer and returns a (void**) pointer to it.
|
||||
* Useful for calls to QueryInterface()
|
||||
* 4) The SetAddRef() method. This is equivalent to an assignment followed by an AddRef().
|
||||
*
|
||||
* examples:
|
||||
*
|
||||
* class It {
|
||||
* void NS_NewFoo(nsIFoo** aFoo);
|
||||
* nsIFoo* GetFoo(void);
|
||||
* void GetBar(nsIBar*& aBar);
|
||||
* };
|
||||
*
|
||||
* nsIFooPtr foo = it->GetFoo();
|
||||
* nsIBarPtr bar;
|
||||
*
|
||||
* it->NS_NewFoo(foo.AssignPtr());
|
||||
* it->GetBar(bar.AssignRef());
|
||||
* it->QueryInterface(kIFooIID, foo.Query());
|
||||
* bar.SetAddRef(new Bar());
|
||||
*
|
||||
* Advantages:
|
||||
* Set and forget. Once a pointer is assigned to a nsIPtr, it is impossible
|
||||
* to forget to release it.
|
||||
* Always pre-initialized. You can't forget to initialize the pointer.
|
||||
*
|
||||
* Disadvantages:
|
||||
* Usage of this class doesn't eliminate the need to think about ref counts
|
||||
* and assign values properly, AddRef'ing as needed.
|
||||
* The nsIPtr doesn't typecast exactly like a C pointer. In order to achieve
|
||||
* typecasting, it may be necessary to first cast to a C pointer of the
|
||||
* underlying type.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NS_DEF_PTR(cls) \
|
||||
class cls##Ptr { \
|
||||
public: \
|
||||
cls##Ptr(void) : mPtr(0) {} \
|
||||
cls##Ptr(const cls##Ptr& aCopy) : mPtr(aCopy.mPtr) \
|
||||
{ NS_IF_ADDREF(mPtr); } \
|
||||
cls##Ptr(cls* aInterface) : mPtr(aInterface) {} \
|
||||
~cls##Ptr(void) { NS_IF_RELEASE(mPtr); } \
|
||||
cls##Ptr& operator=(const cls##Ptr& aCopy) \
|
||||
{ if(mPtr == aCopy.mPtr) return *this; \
|
||||
NS_IF_ADDREF(aCopy.mPtr); \
|
||||
NS_IF_RELEASE(mPtr); \
|
||||
mPtr = aCopy.mPtr; return *this; } \
|
||||
cls##Ptr& operator=(cls* aInterface) \
|
||||
{ if(mPtr == aInterface) return *this; \
|
||||
NS_IF_RELEASE(mPtr); mPtr = aInterface; \
|
||||
return *this; } \
|
||||
cls##Ptr& operator=(PRInt32 aInt) \
|
||||
{ NS_IF_RELEASE(mPtr); \
|
||||
return *this; } \
|
||||
void SetAddRef(cls* aInterface) \
|
||||
{ if(aInterface == mPtr) return; \
|
||||
NS_IF_ADDREF(aInterface); \
|
||||
NS_IF_RELEASE(mPtr); mPtr = aInterface; } \
|
||||
cls* AddRef(void) { NS_ADDREF(mPtr); return mPtr; } \
|
||||
cls* IfAddRef(void) \
|
||||
{ NS_IF_ADDREF(mPtr); return mPtr; } \
|
||||
cls*& AssignRef(void) \
|
||||
{ NS_IF_RELEASE(mPtr); return mPtr; } \
|
||||
cls** AssignPtr(void) \
|
||||
{ NS_IF_RELEASE(mPtr); return &mPtr; } \
|
||||
void** Query(void) \
|
||||
{ NS_IF_RELEASE(mPtr); return (void**)&mPtr; } \
|
||||
PRBool IsNull() const \
|
||||
{ return PRBool(0 == mPtr); } \
|
||||
PRBool IsNotNull() const \
|
||||
{ return PRBool(0 != mPtr); } \
|
||||
PRBool operator==(const cls##Ptr& aCopy) const \
|
||||
{ return PRBool(mPtr == aCopy.mPtr); } \
|
||||
PRBool operator==(cls* aInterface) const \
|
||||
{ return PRBool(mPtr == aInterface); } \
|
||||
PRBool operator!=(const cls##Ptr& aCopy) const \
|
||||
{ return PRBool(mPtr != aCopy.mPtr); } \
|
||||
PRBool operator!=(cls* aInterface) const \
|
||||
{ return PRBool(mPtr != aInterface); } \
|
||||
cls* operator->(void) { return mPtr; } \
|
||||
cls& operator*(void) { return *mPtr; } \
|
||||
operator cls*(void) { return mPtr; } \
|
||||
const cls* operator->(void) const { return mPtr; } \
|
||||
const cls& operator*(void) const { return *mPtr; } \
|
||||
operator const cls* (void) const { return mPtr; } \
|
||||
private: \
|
||||
void* operator new(size_t size) { return 0; } \
|
||||
void operator delete(void* aPtr) {} \
|
||||
cls* mPtr; \
|
||||
public: \
|
||||
friend inline PRBool operator==(const cls* aInterface, const cls##Ptr& aPtr) \
|
||||
{ return PRBool(aInterface == aPtr.mPtr); } \
|
||||
friend inline PRBool operator!=(const cls* aInterface, const cls##Ptr& aPtr) \
|
||||
{ return PRBool(aInterface != aPtr.mPtr); } \
|
||||
}
|
||||
|
||||
#endif // nsIPtr_h___
|
||||
|
||||
314
mozilla/xpcom/base/nsTraceRefcnt.cpp
Normal file
314
mozilla/xpcom/base/nsTraceRefcnt.cpp
Normal file
@@ -0,0 +1,314 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsISupports.h"
|
||||
#include "prprf.h"
|
||||
#include "prlog.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static PRLogModuleInfo* gTraceRefcntLog;
|
||||
|
||||
#if defined(NS_MT_SUPPORTED)
|
||||
#include "prlock.h"
|
||||
|
||||
static PRLock* gTraceLock;
|
||||
|
||||
#define LOCK_TRACELOG() PR_Lock(gTraceLock)
|
||||
#define UNLOCK_TRACELOG() PR_Unlock(gTraceLock)
|
||||
#else /* ! NT_MT_SUPPORTED */
|
||||
#define LOCK_TRACELOG()
|
||||
#define UNLOCK_TRACELOG()
|
||||
#endif /* ! NS_MT_SUPPORTED */
|
||||
|
||||
static void InitTraceLog(void)
|
||||
{
|
||||
if (0 == gTraceRefcntLog) {
|
||||
gTraceRefcntLog = PR_NewLogModule("xpcomrefcnt");
|
||||
|
||||
#if defined(NS_MT_SUPPORTED)
|
||||
gTraceLock = PR_NewLock();
|
||||
#endif /* NS_MT_SUPPORTED */
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include "imagehlp.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#if 0
|
||||
static BOOL __stdcall
|
||||
EnumSymbolsCB(LPSTR aSymbolName,
|
||||
ULONG aSymbolAddress,
|
||||
ULONG aSymbolSize,
|
||||
PVOID aUserContext)
|
||||
{
|
||||
int* countp = (int*) aUserContext;
|
||||
int count = *countp;
|
||||
if (count < 3) {
|
||||
printf(" %p[%4d]: %s\n", aSymbolAddress, aSymbolSize, aSymbolName);
|
||||
count++;
|
||||
*countp = count++;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL __stdcall
|
||||
EnumModulesCB(LPSTR aModuleName,
|
||||
ULONG aBaseOfDll,
|
||||
PVOID aUserContext)
|
||||
{
|
||||
HANDLE myProcess = ::GetCurrentProcess();
|
||||
|
||||
printf("module=%s dll=%x\n", aModuleName, aBaseOfDll);
|
||||
// int count = 0;
|
||||
// SymEnumerateSymbols(myProcess, aBaseOfDll, EnumSymbolsCB, (void*) &count);
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Walk the stack, translating PC's found into strings and recording the
|
||||
* chain in aBuffer. For this to work properly, the dll's must be rebased
|
||||
* so that the address in the file agrees with the address in memory.
|
||||
* Otherwise StackWalk will return FALSE when it hits a frame in a dll's
|
||||
* whose in memory address doesn't match it's in-file address.
|
||||
*
|
||||
* Fortunately, there is a handy dandy routine in IMAGEHLP.DLL that does
|
||||
* the rebasing and accordingly I've made a tool to use it to rebase the
|
||||
* DLL's in one fell swoop (see xpcom/tools/windows/rebasedlls.cpp).
|
||||
*/
|
||||
void
|
||||
nsTraceRefcnt::WalkTheStack(char* aBuffer, int aBufLen)
|
||||
{
|
||||
CONTEXT context;
|
||||
STACKFRAME frame;
|
||||
char* cp = aBuffer;
|
||||
|
||||
aBuffer[0] = '\0';
|
||||
aBufLen--; // leave room for nul
|
||||
|
||||
HANDLE myProcess = ::GetCurrentProcess();
|
||||
HANDLE myThread = ::GetCurrentThread();
|
||||
|
||||
// Get the context information for this thread. That way we will
|
||||
// know where our sp, fp, pc, etc. are and can fill in the
|
||||
// STACKFRAME with the initial values.
|
||||
context.ContextFlags = CONTEXT_FULL;
|
||||
GetThreadContext(myThread, &context);
|
||||
|
||||
if (!SymInitialize(myProcess, ".;..\\lib", TRUE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
SymEnumerateModules(myProcess, EnumModulesCB, NULL);
|
||||
#endif
|
||||
|
||||
// Setup initial stack frame to walk from
|
||||
memset(&frame, 0, sizeof(frame));
|
||||
frame.AddrPC.Mode = AddrModeFlat;
|
||||
frame.AddrPC.Offset = context.Eip;
|
||||
frame.AddrReturn.Mode = AddrModeFlat;
|
||||
frame.AddrReturn.Offset = context.Ebp;
|
||||
frame.AddrFrame.Mode = AddrModeFlat;
|
||||
frame.AddrFrame.Offset = context.Ebp;
|
||||
frame.AddrStack.Mode = AddrModeFlat;
|
||||
frame.AddrStack.Offset = context.Esp;
|
||||
frame.Params[0] = context.Eax;
|
||||
frame.Params[1] = context.Ecx;
|
||||
frame.Params[2] = context.Edx;
|
||||
frame.Params[3] = context.Ebx;
|
||||
|
||||
// Now walk the stack and map the pc's to symbol names that we stuff
|
||||
// append to *cp.
|
||||
|
||||
int skip = 2;
|
||||
int syms = 0;
|
||||
while (aBufLen > 0) {
|
||||
char symbolBuffer[sizeof(IMAGEHLP_SYMBOL) + 512];
|
||||
PIMAGEHLP_SYMBOL pSymbol = (PIMAGEHLP_SYMBOL) symbolBuffer;
|
||||
pSymbol->SizeOfStruct = sizeof(symbolBuffer);
|
||||
pSymbol->MaxNameLength = 512;
|
||||
|
||||
DWORD oldAddress = frame.AddrPC.Offset;
|
||||
BOOL b = ::StackWalk(IMAGE_FILE_MACHINE_I386, myProcess, myThread,
|
||||
&frame, &context, NULL,
|
||||
SymFunctionTableAccess,
|
||||
SymGetModuleBase,
|
||||
NULL);
|
||||
if (!b || (0 == frame.AddrPC.Offset)) {
|
||||
if (syms <= 1) {
|
||||
skip = 7;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (--skip >= 0) {
|
||||
continue;
|
||||
}
|
||||
DWORD disp;
|
||||
if (SymGetSymFromAddr(myProcess, frame.AddrPC.Offset, &disp, pSymbol)) {
|
||||
int nameLen = strlen(pSymbol->Name);
|
||||
if (nameLen + 2 > aBufLen) {
|
||||
break;
|
||||
}
|
||||
memcpy(cp, pSymbol->Name, nameLen);
|
||||
cp += nameLen;
|
||||
*cp++ = ' ';
|
||||
aBufLen -= nameLen + 1;
|
||||
syms++;
|
||||
}
|
||||
else {
|
||||
if (11 > aBufLen) {
|
||||
break;
|
||||
}
|
||||
char tmp[30];
|
||||
PR_snprintf(tmp, sizeof(tmp), "0x%08x ", frame.AddrPC.Offset);
|
||||
memcpy(cp, tmp, 11);
|
||||
cp += 11;
|
||||
aBufLen -= 11;
|
||||
syms++;
|
||||
}
|
||||
}
|
||||
*cp = 0;
|
||||
}
|
||||
|
||||
#else /* _WIN32 */
|
||||
void
|
||||
nsTraceRefcnt::WalkTheStack(char* aBuffer, int aBufLen)
|
||||
{
|
||||
aBuffer[0] = '\0';
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
|
||||
NS_COM void
|
||||
nsTraceRefcnt::LoadLibrarySymbols(const char* aLibraryName,
|
||||
void* aLibrayHandle)
|
||||
{
|
||||
#ifdef MOZ_TRACE_XPCOM_REFCNT
|
||||
#if defined(_WIN32)
|
||||
InitTraceLog();
|
||||
if (PR_LOG_TEST(gTraceRefcntLog,PR_LOG_DEBUG)) {
|
||||
HANDLE myProcess = ::GetCurrentProcess();
|
||||
|
||||
if (!SymInitialize(myProcess, ".;..\\lib", TRUE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL b = ::SymLoadModule(myProcess,
|
||||
NULL,
|
||||
(char*)aLibraryName,
|
||||
(char*)aLibraryName,
|
||||
0,
|
||||
0);
|
||||
// DWORD lastError = 0;
|
||||
// if (!b) lastError = ::GetLastError();
|
||||
// printf("loading symbols for library %s => %s [%d]\n", aLibraryName,
|
||||
// b ? "true" : "false", lastError);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_COM unsigned long
|
||||
nsTraceRefcnt::AddRef(void* aPtr,
|
||||
unsigned long aNewRefcnt,
|
||||
const char* aFile,
|
||||
PRIntn aLine)
|
||||
{
|
||||
#ifdef MOZ_TRACE_XPCOM_REFCNT
|
||||
InitTraceLog();
|
||||
|
||||
LOCK_TRACELOG();
|
||||
if (PR_LOG_TEST(gTraceRefcntLog,PR_LOG_DEBUG)) {
|
||||
char sb[1000];
|
||||
WalkTheStack(sb, sizeof(sb));
|
||||
PR_LOG(gTraceRefcntLog, PR_LOG_DEBUG,
|
||||
("AddRef: %p: %d=>%d [%s] in %s (line %d)",
|
||||
aPtr, aNewRefcnt-1, aNewRefcnt, sb, aFile, aLine));
|
||||
}
|
||||
UNLOCK_TRACELOG();
|
||||
#endif
|
||||
return aNewRefcnt;
|
||||
|
||||
}
|
||||
|
||||
NS_COM unsigned long
|
||||
nsTraceRefcnt::Release(void* aPtr,
|
||||
unsigned long aNewRefcnt,
|
||||
const char* aFile,
|
||||
PRIntn aLine)
|
||||
{
|
||||
#ifdef MOZ_TRACE_XPCOM_REFCNT
|
||||
InitTraceLog();
|
||||
|
||||
LOCK_TRACELOG();
|
||||
if (PR_LOG_TEST(gTraceRefcntLog,PR_LOG_DEBUG)) {
|
||||
char sb[1000];
|
||||
WalkTheStack(sb, sizeof(sb));
|
||||
PR_LOG(gTraceRefcntLog, PR_LOG_DEBUG,
|
||||
("Release: %p: %d=>%d [%s] in %s (line %d)",
|
||||
aPtr, aNewRefcnt+1, aNewRefcnt, sb, aFile, aLine));
|
||||
}
|
||||
UNLOCK_TRACELOG();
|
||||
#endif
|
||||
return aNewRefcnt;
|
||||
}
|
||||
|
||||
NS_COM void
|
||||
nsTraceRefcnt::Create(void* aPtr,
|
||||
const char* aType,
|
||||
const char* aFile,
|
||||
PRIntn aLine)
|
||||
{
|
||||
#ifdef MOZ_TRACE_XPCOM_REFCNT
|
||||
InitTraceLog();
|
||||
|
||||
LOCK_TRACELOG();
|
||||
if (PR_LOG_TEST(gTraceRefcntLog,PR_LOG_DEBUG)) {
|
||||
char sb[1000];
|
||||
WalkTheStack(sb, sizeof(sb));
|
||||
PR_LOG(gTraceRefcntLog, PR_LOG_DEBUG,
|
||||
("Create: %p[%s]: [%s] in %s (line %d)",
|
||||
aPtr, aType, sb, aFile, aLine));
|
||||
}
|
||||
UNLOCK_TRACELOG();
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_COM void
|
||||
nsTraceRefcnt::Destroy(void* aPtr,
|
||||
const char* aFile,
|
||||
PRIntn aLine)
|
||||
{
|
||||
#ifdef MOZ_TRACE_XPCOM_REFCNT
|
||||
InitTraceLog();
|
||||
|
||||
LOCK_TRACELOG();
|
||||
if (PR_LOG_TEST(gTraceRefcntLog,PR_LOG_DEBUG)) {
|
||||
char sb[1000];
|
||||
WalkTheStack(sb, sizeof(sb));
|
||||
PR_LOG(gTraceRefcntLog, PR_LOG_DEBUG,
|
||||
("Destroy: %p: [%s] in %s (line %d)",
|
||||
aPtr, sb, aFile, aLine));
|
||||
}
|
||||
UNLOCK_TRACELOG();
|
||||
#endif
|
||||
}
|
||||
61
mozilla/xpcom/base/nsTraceRefcnt.h
Normal file
61
mozilla/xpcom/base/nsTraceRefcnt.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#ifndef nsTraceRefcnt_h___
|
||||
#define nsTraceRefcnt_h___
|
||||
|
||||
#include "nsCom.h"
|
||||
|
||||
/**
|
||||
* This class is used to support tracing (and logging using nspr) of
|
||||
* addref and release calls. Note that only calls that use the
|
||||
* NS_ADDREF and related macros in nsISupports can be traced.
|
||||
*
|
||||
* The name of the nspr log module is "xpcomrefcnt" (case matters).
|
||||
*
|
||||
* This code only performs tracing built with debugging AND when
|
||||
* built with -DMOZ_TRACE_XPCOM_REFCNT (because it's expensive!).
|
||||
*/
|
||||
class nsTraceRefcnt {
|
||||
public:
|
||||
static NS_COM unsigned long AddRef(void* aPtr,
|
||||
unsigned long aNewRefcnt,
|
||||
const char* aFile,
|
||||
int aLine);
|
||||
|
||||
static NS_COM unsigned long Release(void* aPtr,
|
||||
unsigned long aNewRefcnt,
|
||||
const char* aFile,
|
||||
int aLine);
|
||||
|
||||
static NS_COM void Create(void* aPtr,
|
||||
const char* aType,
|
||||
const char* aFile,
|
||||
int aLine);
|
||||
|
||||
static NS_COM void Destroy(void* aPtr,
|
||||
const char* aFile,
|
||||
int aLine);
|
||||
|
||||
static NS_COM void LoadLibrarySymbols(const char* aLibraryName,
|
||||
void* aLibrayHandle);
|
||||
|
||||
static NS_COM void WalkTheStack(char* aBuffer, int aBufLen);
|
||||
};
|
||||
|
||||
#endif /* nsTraceRefcnt_h___ */
|
||||
314
mozilla/xpcom/base/nsTraceRefcntImpl.cpp
Normal file
314
mozilla/xpcom/base/nsTraceRefcntImpl.cpp
Normal file
@@ -0,0 +1,314 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsISupports.h"
|
||||
#include "prprf.h"
|
||||
#include "prlog.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static PRLogModuleInfo* gTraceRefcntLog;
|
||||
|
||||
#if defined(NS_MT_SUPPORTED)
|
||||
#include "prlock.h"
|
||||
|
||||
static PRLock* gTraceLock;
|
||||
|
||||
#define LOCK_TRACELOG() PR_Lock(gTraceLock)
|
||||
#define UNLOCK_TRACELOG() PR_Unlock(gTraceLock)
|
||||
#else /* ! NT_MT_SUPPORTED */
|
||||
#define LOCK_TRACELOG()
|
||||
#define UNLOCK_TRACELOG()
|
||||
#endif /* ! NS_MT_SUPPORTED */
|
||||
|
||||
static void InitTraceLog(void)
|
||||
{
|
||||
if (0 == gTraceRefcntLog) {
|
||||
gTraceRefcntLog = PR_NewLogModule("xpcomrefcnt");
|
||||
|
||||
#if defined(NS_MT_SUPPORTED)
|
||||
gTraceLock = PR_NewLock();
|
||||
#endif /* NS_MT_SUPPORTED */
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include "imagehlp.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#if 0
|
||||
static BOOL __stdcall
|
||||
EnumSymbolsCB(LPSTR aSymbolName,
|
||||
ULONG aSymbolAddress,
|
||||
ULONG aSymbolSize,
|
||||
PVOID aUserContext)
|
||||
{
|
||||
int* countp = (int*) aUserContext;
|
||||
int count = *countp;
|
||||
if (count < 3) {
|
||||
printf(" %p[%4d]: %s\n", aSymbolAddress, aSymbolSize, aSymbolName);
|
||||
count++;
|
||||
*countp = count++;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL __stdcall
|
||||
EnumModulesCB(LPSTR aModuleName,
|
||||
ULONG aBaseOfDll,
|
||||
PVOID aUserContext)
|
||||
{
|
||||
HANDLE myProcess = ::GetCurrentProcess();
|
||||
|
||||
printf("module=%s dll=%x\n", aModuleName, aBaseOfDll);
|
||||
// int count = 0;
|
||||
// SymEnumerateSymbols(myProcess, aBaseOfDll, EnumSymbolsCB, (void*) &count);
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Walk the stack, translating PC's found into strings and recording the
|
||||
* chain in aBuffer. For this to work properly, the dll's must be rebased
|
||||
* so that the address in the file agrees with the address in memory.
|
||||
* Otherwise StackWalk will return FALSE when it hits a frame in a dll's
|
||||
* whose in memory address doesn't match it's in-file address.
|
||||
*
|
||||
* Fortunately, there is a handy dandy routine in IMAGEHLP.DLL that does
|
||||
* the rebasing and accordingly I've made a tool to use it to rebase the
|
||||
* DLL's in one fell swoop (see xpcom/tools/windows/rebasedlls.cpp).
|
||||
*/
|
||||
void
|
||||
nsTraceRefcnt::WalkTheStack(char* aBuffer, int aBufLen)
|
||||
{
|
||||
CONTEXT context;
|
||||
STACKFRAME frame;
|
||||
char* cp = aBuffer;
|
||||
|
||||
aBuffer[0] = '\0';
|
||||
aBufLen--; // leave room for nul
|
||||
|
||||
HANDLE myProcess = ::GetCurrentProcess();
|
||||
HANDLE myThread = ::GetCurrentThread();
|
||||
|
||||
// Get the context information for this thread. That way we will
|
||||
// know where our sp, fp, pc, etc. are and can fill in the
|
||||
// STACKFRAME with the initial values.
|
||||
context.ContextFlags = CONTEXT_FULL;
|
||||
GetThreadContext(myThread, &context);
|
||||
|
||||
if (!SymInitialize(myProcess, ".;..\\lib", TRUE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
SymEnumerateModules(myProcess, EnumModulesCB, NULL);
|
||||
#endif
|
||||
|
||||
// Setup initial stack frame to walk from
|
||||
memset(&frame, 0, sizeof(frame));
|
||||
frame.AddrPC.Mode = AddrModeFlat;
|
||||
frame.AddrPC.Offset = context.Eip;
|
||||
frame.AddrReturn.Mode = AddrModeFlat;
|
||||
frame.AddrReturn.Offset = context.Ebp;
|
||||
frame.AddrFrame.Mode = AddrModeFlat;
|
||||
frame.AddrFrame.Offset = context.Ebp;
|
||||
frame.AddrStack.Mode = AddrModeFlat;
|
||||
frame.AddrStack.Offset = context.Esp;
|
||||
frame.Params[0] = context.Eax;
|
||||
frame.Params[1] = context.Ecx;
|
||||
frame.Params[2] = context.Edx;
|
||||
frame.Params[3] = context.Ebx;
|
||||
|
||||
// Now walk the stack and map the pc's to symbol names that we stuff
|
||||
// append to *cp.
|
||||
|
||||
int skip = 2;
|
||||
int syms = 0;
|
||||
while (aBufLen > 0) {
|
||||
char symbolBuffer[sizeof(IMAGEHLP_SYMBOL) + 512];
|
||||
PIMAGEHLP_SYMBOL pSymbol = (PIMAGEHLP_SYMBOL) symbolBuffer;
|
||||
pSymbol->SizeOfStruct = sizeof(symbolBuffer);
|
||||
pSymbol->MaxNameLength = 512;
|
||||
|
||||
DWORD oldAddress = frame.AddrPC.Offset;
|
||||
BOOL b = ::StackWalk(IMAGE_FILE_MACHINE_I386, myProcess, myThread,
|
||||
&frame, &context, NULL,
|
||||
SymFunctionTableAccess,
|
||||
SymGetModuleBase,
|
||||
NULL);
|
||||
if (!b || (0 == frame.AddrPC.Offset)) {
|
||||
if (syms <= 1) {
|
||||
skip = 7;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (--skip >= 0) {
|
||||
continue;
|
||||
}
|
||||
DWORD disp;
|
||||
if (SymGetSymFromAddr(myProcess, frame.AddrPC.Offset, &disp, pSymbol)) {
|
||||
int nameLen = strlen(pSymbol->Name);
|
||||
if (nameLen + 2 > aBufLen) {
|
||||
break;
|
||||
}
|
||||
memcpy(cp, pSymbol->Name, nameLen);
|
||||
cp += nameLen;
|
||||
*cp++ = ' ';
|
||||
aBufLen -= nameLen + 1;
|
||||
syms++;
|
||||
}
|
||||
else {
|
||||
if (11 > aBufLen) {
|
||||
break;
|
||||
}
|
||||
char tmp[30];
|
||||
PR_snprintf(tmp, sizeof(tmp), "0x%08x ", frame.AddrPC.Offset);
|
||||
memcpy(cp, tmp, 11);
|
||||
cp += 11;
|
||||
aBufLen -= 11;
|
||||
syms++;
|
||||
}
|
||||
}
|
||||
*cp = 0;
|
||||
}
|
||||
|
||||
#else /* _WIN32 */
|
||||
void
|
||||
nsTraceRefcnt::WalkTheStack(char* aBuffer, int aBufLen)
|
||||
{
|
||||
aBuffer[0] = '\0';
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
|
||||
NS_COM void
|
||||
nsTraceRefcnt::LoadLibrarySymbols(const char* aLibraryName,
|
||||
void* aLibrayHandle)
|
||||
{
|
||||
#ifdef MOZ_TRACE_XPCOM_REFCNT
|
||||
#if defined(_WIN32)
|
||||
InitTraceLog();
|
||||
if (PR_LOG_TEST(gTraceRefcntLog,PR_LOG_DEBUG)) {
|
||||
HANDLE myProcess = ::GetCurrentProcess();
|
||||
|
||||
if (!SymInitialize(myProcess, ".;..\\lib", TRUE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL b = ::SymLoadModule(myProcess,
|
||||
NULL,
|
||||
(char*)aLibraryName,
|
||||
(char*)aLibraryName,
|
||||
0,
|
||||
0);
|
||||
// DWORD lastError = 0;
|
||||
// if (!b) lastError = ::GetLastError();
|
||||
// printf("loading symbols for library %s => %s [%d]\n", aLibraryName,
|
||||
// b ? "true" : "false", lastError);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_COM unsigned long
|
||||
nsTraceRefcnt::AddRef(void* aPtr,
|
||||
unsigned long aNewRefcnt,
|
||||
const char* aFile,
|
||||
PRIntn aLine)
|
||||
{
|
||||
#ifdef MOZ_TRACE_XPCOM_REFCNT
|
||||
InitTraceLog();
|
||||
|
||||
LOCK_TRACELOG();
|
||||
if (PR_LOG_TEST(gTraceRefcntLog,PR_LOG_DEBUG)) {
|
||||
char sb[1000];
|
||||
WalkTheStack(sb, sizeof(sb));
|
||||
PR_LOG(gTraceRefcntLog, PR_LOG_DEBUG,
|
||||
("AddRef: %p: %d=>%d [%s] in %s (line %d)",
|
||||
aPtr, aNewRefcnt-1, aNewRefcnt, sb, aFile, aLine));
|
||||
}
|
||||
UNLOCK_TRACELOG();
|
||||
#endif
|
||||
return aNewRefcnt;
|
||||
|
||||
}
|
||||
|
||||
NS_COM unsigned long
|
||||
nsTraceRefcnt::Release(void* aPtr,
|
||||
unsigned long aNewRefcnt,
|
||||
const char* aFile,
|
||||
PRIntn aLine)
|
||||
{
|
||||
#ifdef MOZ_TRACE_XPCOM_REFCNT
|
||||
InitTraceLog();
|
||||
|
||||
LOCK_TRACELOG();
|
||||
if (PR_LOG_TEST(gTraceRefcntLog,PR_LOG_DEBUG)) {
|
||||
char sb[1000];
|
||||
WalkTheStack(sb, sizeof(sb));
|
||||
PR_LOG(gTraceRefcntLog, PR_LOG_DEBUG,
|
||||
("Release: %p: %d=>%d [%s] in %s (line %d)",
|
||||
aPtr, aNewRefcnt+1, aNewRefcnt, sb, aFile, aLine));
|
||||
}
|
||||
UNLOCK_TRACELOG();
|
||||
#endif
|
||||
return aNewRefcnt;
|
||||
}
|
||||
|
||||
NS_COM void
|
||||
nsTraceRefcnt::Create(void* aPtr,
|
||||
const char* aType,
|
||||
const char* aFile,
|
||||
PRIntn aLine)
|
||||
{
|
||||
#ifdef MOZ_TRACE_XPCOM_REFCNT
|
||||
InitTraceLog();
|
||||
|
||||
LOCK_TRACELOG();
|
||||
if (PR_LOG_TEST(gTraceRefcntLog,PR_LOG_DEBUG)) {
|
||||
char sb[1000];
|
||||
WalkTheStack(sb, sizeof(sb));
|
||||
PR_LOG(gTraceRefcntLog, PR_LOG_DEBUG,
|
||||
("Create: %p[%s]: [%s] in %s (line %d)",
|
||||
aPtr, aType, sb, aFile, aLine));
|
||||
}
|
||||
UNLOCK_TRACELOG();
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_COM void
|
||||
nsTraceRefcnt::Destroy(void* aPtr,
|
||||
const char* aFile,
|
||||
PRIntn aLine)
|
||||
{
|
||||
#ifdef MOZ_TRACE_XPCOM_REFCNT
|
||||
InitTraceLog();
|
||||
|
||||
LOCK_TRACELOG();
|
||||
if (PR_LOG_TEST(gTraceRefcntLog,PR_LOG_DEBUG)) {
|
||||
char sb[1000];
|
||||
WalkTheStack(sb, sizeof(sb));
|
||||
PR_LOG(gTraceRefcntLog, PR_LOG_DEBUG,
|
||||
("Destroy: %p: [%s] in %s (line %d)",
|
||||
aPtr, sb, aFile, aLine));
|
||||
}
|
||||
UNLOCK_TRACELOG();
|
||||
#endif
|
||||
}
|
||||
61
mozilla/xpcom/base/nsTraceRefcntImpl.h
Normal file
61
mozilla/xpcom/base/nsTraceRefcntImpl.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#ifndef nsTraceRefcnt_h___
|
||||
#define nsTraceRefcnt_h___
|
||||
|
||||
#include "nsCom.h"
|
||||
|
||||
/**
|
||||
* This class is used to support tracing (and logging using nspr) of
|
||||
* addref and release calls. Note that only calls that use the
|
||||
* NS_ADDREF and related macros in nsISupports can be traced.
|
||||
*
|
||||
* The name of the nspr log module is "xpcomrefcnt" (case matters).
|
||||
*
|
||||
* This code only performs tracing built with debugging AND when
|
||||
* built with -DMOZ_TRACE_XPCOM_REFCNT (because it's expensive!).
|
||||
*/
|
||||
class nsTraceRefcnt {
|
||||
public:
|
||||
static NS_COM unsigned long AddRef(void* aPtr,
|
||||
unsigned long aNewRefcnt,
|
||||
const char* aFile,
|
||||
int aLine);
|
||||
|
||||
static NS_COM unsigned long Release(void* aPtr,
|
||||
unsigned long aNewRefcnt,
|
||||
const char* aFile,
|
||||
int aLine);
|
||||
|
||||
static NS_COM void Create(void* aPtr,
|
||||
const char* aType,
|
||||
const char* aFile,
|
||||
int aLine);
|
||||
|
||||
static NS_COM void Destroy(void* aPtr,
|
||||
const char* aFile,
|
||||
int aLine);
|
||||
|
||||
static NS_COM void LoadLibrarySymbols(const char* aLibraryName,
|
||||
void* aLibrayHandle);
|
||||
|
||||
static NS_COM void WalkTheStack(char* aBuffer, int aBufLen);
|
||||
};
|
||||
|
||||
#endif /* nsTraceRefcnt_h___ */
|
||||
168
mozilla/xpcom/components/mozIClassRegistry.h
Normal file
168
mozilla/xpcom/components/mozIClassRegistry.h
Normal file
@@ -0,0 +1,168 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef __mozIClassRegistry_h
|
||||
#define __mozIClassRegistry_h
|
||||
|
||||
#include "nsRepository.h"
|
||||
|
||||
/*---------------------------- mozIClassRegistry -------------------------------
|
||||
| This interface provides access to a mapping from mnemonic interface names |
|
||||
| to shared libraries where implementations of those interfaces can be located.|
|
||||
| |
|
||||
| This interface is designed to provide two things: |
|
||||
| 1. A means of less static binding between clients and the code that |
|
||||
| implements the XPCOM interfaces those clients use. This accomplished |
|
||||
| by the mapping from interface names to nsCID (and the shared libraries |
|
||||
| that implement those classes). |
|
||||
| 2. A means of dynamically changing the mapping from interface name to |
|
||||
| implementation. The canonical example of this is to switch to a |
|
||||
| "native" widget set versus an "XP" (implemented using gfx) set. |
|
||||
| |
|
||||
| The first goal is achieved by storing (in a "Netscape Registry" file, see |
|
||||
| nsReg.h) information that maps interface/class "names" to information about |
|
||||
| where to load implementations of those interfaces. That information |
|
||||
| includes the interface ID, class ID (of the implementation class), and the |
|
||||
| name of the shared library that contains the implementation. |
|
||||
| |
|
||||
| The class registry object will register those classes with the "repository" |
|
||||
| (see nsRepository.h) the first time a request is made to create an |
|
||||
| instance. Subsequent requests will simply be forwarded to the repository |
|
||||
| after the appropriate interface and class IDs are determined. |
|
||||
| |
|
||||
| The second goal is accomplished by permitting the mnemonic interface |
|
||||
| "names" to be "overloaded", that is, mapped to distinct implementations |
|
||||
| by separate class registry objects. Further, class registries can be |
|
||||
| cascaded: they can be chained together so that when a name is not |
|
||||
| recognized by one registry, it can pass the request to the next registry in |
|
||||
| the chain. Users can control resolution by making the request of a |
|
||||
| registry further up/down the chain. |
|
||||
| |
|
||||
| For example, consider the case of "native" vs. "gfx" widgets. This might |
|
||||
| be structured by a class registry arrangment like this: |
|
||||
| |
|
||||
| nativeWidgetRegistry baseWidgetRegistry |
|
||||
| +----------+ +----------+ |
|
||||
| | ----+---------------->| | |
|
||||
| +----------+ +----------+ |
|
||||
| |toolbar| -+-----+ |toolbar| -+-----+ |
|
||||
| +----------+ | +----------+ | |
|
||||
| |button | -+-----+ |button | -+-----+ |
|
||||
| +----------+ | +----------+ | |
|
||||
| V V |
|
||||
| +-----------------+ +-----------------+ |
|
||||
| | native.dll | | base.dll | |
|
||||
| +-----------------+ +-----------------+ |
|
||||
| |
|
||||
| If a specialized implementation of widgets is present (e.g., native.dll) |
|
||||
| then a corresponding class registry object is created and added to the |
|
||||
| head of the registry chain. Object creation requests (normal ones) are |
|
||||
| resolved to the native implementation. If such a library is not present, |
|
||||
| then the resolution is to the base implementation. If objects of the |
|
||||
| base implementation are required, then creation requests can be directed |
|
||||
| directly to the baseWidgetRegistry object, rather than the head of the |
|
||||
| registry chain. |
|
||||
| |
|
||||
| It is intended that there be a single instance of this interface, accessed |
|
||||
| via the Service Manager (see nsServiceManager.h). |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct mozIClassRegistry : public ISupports {
|
||||
|
||||
/*------------------------------ CreateInstance ----------------------------
|
||||
| Create an instance of the requested class/interface. The interface |
|
||||
| ID is required to specify how the result will be treated. The class |
|
||||
| named by aName must support this interface. The result is placed in |
|
||||
| ncomment aResult (NULL if the request fails). "start" specifies the |
|
||||
| registry at which the search for an implementation of the named |
|
||||
| interface should start. It defaults to 0 (indicating to start at the |
|
||||
| head of the registry chain). |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD CreateInstance( const char *anInterfaceName,
|
||||
const nsIID &aIID,
|
||||
void* *aResult,
|
||||
const char *start = 0 ) = 0;
|
||||
|
||||
/*--------------------------- CreateEnumerator -----------------------------
|
||||
| Creates an nsIEnumerator interface object that can be used to examine |
|
||||
| the contents of the registry. "pattern" specifies either "*" or the |
|
||||
| name of a specific interface that you want to query. "result" will |
|
||||
| be set to point to a new object (which will be freed on the last call |
|
||||
| to its Release() member). See nsIEnumerator.h for details on how to |
|
||||
| use the returned interface pointer. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD CreateEnumerator( const char *pattern,
|
||||
nsIEnumerator* *result ) = 0;
|
||||
}; // mozIClassRegistry
|
||||
|
||||
|
||||
/*-------------------------- mozIClassRegistryEntry ----------------------------
|
||||
| Objects of this class represent the individual elements that comprise a |
|
||||
| mozIClassRegistry interface. You obtain such objects by applying the |
|
||||
| CreateEnumerator member function to the class registry and then applying |
|
||||
| the CurrentItem member function to the resulting nsIEnumerator interface. |
|
||||
| |
|
||||
| Each entry can be queried for the following information: |
|
||||
| o sub-registry name |
|
||||
| o interface name |
|
||||
| o Class ID |
|
||||
| o IIDs implemented |
|
||||
| |
|
||||
| The information obtained from the entry (specifically, the const char* |
|
||||
| strings) remains valid for the life of the entry (i.e., until you |
|
||||
| Release() it). |
|
||||
| |
|
||||
| Here is an example of code that uses this interface to dump the contents |
|
||||
| of a mozIClassRegistry: |
|
||||
| |
|
||||
| mozIClassRegistry *reg = nsServiceManager::GetService( kIDRegistry ); |
|
||||
| nsIEnumerator *enum; |
|
||||
| reg->CreateEnumerator( "*", &enum ); |
|
||||
| for ( enum->First(); !enum->IsDone(); enum->Next(); ) { |
|
||||
| mozIClassRegistryEntry *entry; |
|
||||
| enum->CurrentItem( &entry ); |
|
||||
| const char *subreg; |
|
||||
| const char *name; |
|
||||
| nsCID cid; |
|
||||
| int numIIDs; |
|
||||
| entry->GetSubRegistryName( &subreg ); |
|
||||
| entry->GetInterfaceName( &name ); |
|
||||
| entry->GetClassID( &cid ); |
|
||||
| entry->GetNumIIDs( &numIIDs ); |
|
||||
| cout << subreg << "/" << name << " = " << cid.ToString() << endl; |
|
||||
| for ( int i = 0; i < numIIDs; i++ ) { |
|
||||
| nsIID iid; |
|
||||
| entry->GetInterfaceID( i, &iid ); |
|
||||
| cout << "/tIID[" << i << "] = " << iid.ToString() << endl; |
|
||||
| } |
|
||||
| entry->Release(); |
|
||||
| } |
|
||||
| enum->Release(); |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct mozIClassRegistryEntry : public nsISupports {
|
||||
NS_IMETHOD GetSubRegistryName( const char **result ) = 0;
|
||||
NS_IMETHOD GetInterfaceName( const char **result ) = 0;
|
||||
NS_IMETHOD GetClassID( nsCID *result ) = 0;
|
||||
NS_IMETHOD GetNumIIDs( int *result ) = 0;
|
||||
NS_IMETHOD GetInterfaceID( int n, nsIID *result ) = 0;
|
||||
}; // mozIClassRegistryEntry
|
||||
|
||||
// {5D41A440-8E37-11d2-8059-00600811A9C3}
|
||||
#define MOZ_ICLASSREGISTRY_IID { 0x5d41a440, 0x8e37, 0x11d2, { 0x80, 0x59, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } }
|
||||
// {D1B54831-AC07-11d2-805E-00600811A9C3}
|
||||
#define MOZ_ICLASSREGISTRYENTRY_IID { 0xd1b54831, 0xac07, 0x11d2, { 0x80, 0x5e, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } }
|
||||
|
||||
#endif
|
||||
326
mozilla/xpcom/components/mozIRegistry.h
Normal file
326
mozilla/xpcom/components/mozIRegistry.h
Normal file
@@ -0,0 +1,326 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef __mozIRegistry_h
|
||||
#define __mozIRegistry_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIEnumerator;
|
||||
|
||||
/*------------------------------- mozIRegistry ---------------------------------
|
||||
| This interface provides access to a tree of arbitrary values. |
|
||||
| |
|
||||
| Each node of the tree contains either a value or a subtree or both. |
|
||||
| |
|
||||
| The value at any of these leaf nodes can be any of these "primitive" types: |
|
||||
| o string (null terminated UTF string) |
|
||||
| o array of 32-bit integers |
|
||||
| o arbitrary array of bytes |
|
||||
| o file identifier |
|
||||
| Of course, since you can store an arbitrary array of bytes, you can put |
|
||||
| any data you like into a registry (although you have the burden of |
|
||||
| encoding/decoding your data in that case). |
|
||||
| |
|
||||
| Each branch of the tree is labelled with a string "key." The entire path |
|
||||
| from a given point of the tree to another point further down can be |
|
||||
| presented as a single string composed of each branch's label, concatenated |
|
||||
| to the next, with an intervening forward slash ('/'). The term "key" |
|
||||
| refers to both specific tree branch labels and to such concatenated paths. |
|
||||
| |
|
||||
| The branches from a given node must have unique labels. Distinct nodes can |
|
||||
| have branches with the same label. |
|
||||
| |
|
||||
| For example, here's a small registry tree: |
|
||||
| | |
|
||||
| /\ |
|
||||
| / \ |
|
||||
| / \ |
|
||||
| / \ |
|
||||
| "Classes" "Users" |
|
||||
| / \ |
|
||||
| / \ |
|
||||
| / ["joe"] |
|
||||
| / / \ |
|
||||
| | / \ |
|
||||
| /\ / \ |
|
||||
| / \ "joe" "bob" |
|
||||
| / \ / \ |
|
||||
| / \ |
|
||||
| "{xxxx-xx-1}" "{xxxx-xx-2}" ["c:/joe"] ["d:/Robert"] |
|
||||
| | | |
|
||||
| /\ /\ |
|
||||
| / \ / \ |
|
||||
| / \ / \ |
|
||||
| "Library" "Version" "Library" "Version" |
|
||||
| / \ / \ |
|
||||
| ["foo.dll"] 2 ["bar.dll"] 1 |
|
||||
| |
|
||||
| In this example, there are 2 keys under the root: "Classes" and "Users". |
|
||||
| The first denotes a subtree only (which has two subtrees, ...). The second |
|
||||
| denotes both a value ["joe"] and two subtrees labelled "joe" and "bob". |
|
||||
| The value at the node "/Users" is ["joe"], at "/Users/bob" is ["d:/Robert"]. |
|
||||
| The value at "/Classes/{xxxx-xx-1}/Version" is 2. |
|
||||
| |
|
||||
| The registry interface provides functions that let you navigate the tree |
|
||||
| and manipulate it's contents. |
|
||||
| |
|
||||
| Please note that the registry itself does not impose any structure or |
|
||||
| meaning on the contents of the tree. For example, the registry doesn't |
|
||||
| control whether the value at the key "/Users" is the label for the subtree |
|
||||
| with information about the last active user. That meaning is applied by |
|
||||
| the code that stores these values and uses them for that purpose. |
|
||||
| |
|
||||
| [Any resemblence between this example and actual contents of any actual |
|
||||
| registry is purely coincidental.] |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct mozIRegistry : public nsISupports {
|
||||
/*------------------------------ Constants ---------------------------------
|
||||
| The following enumerated types and values are used by the registry |
|
||||
| interface. |
|
||||
--------------------------------------------------------------------------*/
|
||||
typedef enum {
|
||||
String = 1,
|
||||
Int32,
|
||||
Bytes,
|
||||
File
|
||||
} DataType;
|
||||
|
||||
/*-------------------------------- Types -----------------------------------
|
||||
| The following data types are used by this interface. All are basically |
|
||||
| opaque types. You obtain objects of these types via certain member |
|
||||
| function calls and re-use them later (without having to know what they |
|
||||
| contain). |
|
||||
| |
|
||||
| Key - Placeholder to represent a particular node in a registry |
|
||||
| tree. There are 3 enumerated values that correspond to |
|
||||
| specific nodes: |
|
||||
| Common - Where most stuff goes. |
|
||||
| Users - Special subtree to hold info about |
|
||||
| "users"; if you don't know what goes |
|
||||
| here, don't mess with it. |
|
||||
| CurrentUser - Subtree under Users corresponding to |
|
||||
| whatever user is designed the "current" |
|
||||
| one; see note above. |
|
||||
| You can specify any of these enumerated values as "keys" |
|
||||
| on any member function that takes a mozRegistry::Key. |
|
||||
| ValueInfo - Structure describing a registry value. |
|
||||
--------------------------------------------------------------------------*/
|
||||
typedef uint32 Key;
|
||||
|
||||
enum { Users = 1, Common = 2, CurrentUser = 3 };
|
||||
|
||||
struct ValueInfo {
|
||||
DataType type;
|
||||
uint32 length;
|
||||
};
|
||||
|
||||
/*--------------------------- Opening/Closing ------------------------------
|
||||
| These functions open the specified registry file (Open() with a non-null |
|
||||
| argument) or the default "standard" registry file (Open() with a null |
|
||||
| argument or OpenDefault()). |
|
||||
| |
|
||||
| Once opened, you can access the registry contents via the read/write |
|
||||
| or query functions. |
|
||||
| |
|
||||
| The registry file will be closed automatically when the registry object |
|
||||
| is destroyed. You can close the file prior to that by using the |
|
||||
| Close() function. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD Open( const char *regFile = 0 ) = 0;
|
||||
NS_IMETHOD OpenDefault() = 0;
|
||||
NS_IMETHOD Close() = 0;
|
||||
|
||||
/*----------------------- Reading/Writing Values ---------------------------
|
||||
| These functions read/write the registry values at a given node. |
|
||||
| |
|
||||
| All functions require you to specify where in the registry key to |
|
||||
| get/set the value. The location is specified using two components: |
|
||||
| o A "base key" indicating where to start from; this is a value of type |
|
||||
| mozIRegistry::Key. You use either one of the special "root" key |
|
||||
| values or a subkey obtained via some other member function call. |
|
||||
| o A "relative path," expressed as a sequence of subtree names |
|
||||
| separated by forward slashes. This path describes how to get from |
|
||||
| the base key to the node at which you want to store the data. This |
|
||||
| component can be a null pointer which means the value goes directly |
|
||||
| at the node denoted by the base key. |
|
||||
| |
|
||||
| When you request a value of a given type, the data stored at the |
|
||||
| specified node must be of the type requested. If not, an error results. |
|
||||
| |
|
||||
| GetString - Obtains a newly allocated copy of a string type value. The |
|
||||
| caller is obligated to free the returned string using |
|
||||
| PR_Free. |
|
||||
| SetString - Stores the argument string at the specified node. |
|
||||
| GetInt - Obtains an int32 value at the specified node. The result |
|
||||
| is returned into an int32 location you specify. |
|
||||
| SetInt - Stores a given int32 value at a node. |
|
||||
| GetBytes - Obtains a byte array value; this returns both an allocated |
|
||||
| array of bytes and a length (necessary because there may be |
|
||||
| embedded null bytes in the array). You must free the |
|
||||
| resulting array using PR_Free. |
|
||||
| SetBytes - Stores a given array of bytes; you specify the bytes via a |
|
||||
| pointer and a length. |
|
||||
| GetIntArray - Obtains the array of int32 values stored at a given node. |
|
||||
| The result is composed of two values: a pointer to an |
|
||||
| array of integer values (which must be freed using |
|
||||
| PR_Free) and the number of elements in that array. |
|
||||
| SetIntArray - Stores a set of int32 values at a given node. You must |
|
||||
| provide a pointer to the array and the number of entries. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD GetString( Key baseKey, const char *path, char **result ) = 0;
|
||||
NS_IMETHOD SetString( Key baseKey, const char *path, const char *value ) = 0;
|
||||
NS_IMETHOD GetInt( Key baseKey, const char *path, int32 *result ) = 0;
|
||||
NS_IMETHOD SetInt( Key baseKey, const char *path, int32 value ) = 0;
|
||||
NS_IMETHOD GetBytes( Key baseKey, const char *path, void **result, uint32 *len ) = 0;
|
||||
NS_IMETHOD SetBytes( Key baseKey, const char *path, void *value, uint32 len ) = 0;
|
||||
NS_IMETHOD GetIntArray( Key baseKey, const char *path, int32 **result, uint32 *len ) = 0;
|
||||
NS_IMETHOD SetIntArray( Key baseKey, const char *path, const int32 *value, uint32 len ) = 0;
|
||||
|
||||
/*------------------------------ Navigation --------------------------------
|
||||
| These functions let you navigate through the registry tree, querying |
|
||||
| its contents. |
|
||||
| |
|
||||
| As above, all these functions requires a starting tree location ("base |
|
||||
| key") specified as a mozIRegistry::Key. Some also require a path |
|
||||
| name to locate the registry node location relative to this base key. |
|
||||
| |
|
||||
| AddSubtree - Adds a new registry subtree at the specified |
|
||||
| location. Returns the resulting key in |
|
||||
| the location specified by the third argument |
|
||||
| (unless that pointer is 0). |
|
||||
| RemoveNode - Removes the specified registry subtree or |
|
||||
| value at the specified location. |
|
||||
| GetSubtree - Returns a mozIRegistry::Key that can be used |
|
||||
| to refer to the specified registry location. |
|
||||
| EnumerateSubtrees - Returns a nsIEnumerator object that you can |
|
||||
| use to enumerate all the subtrees descending |
|
||||
| from a specified location. You must free the |
|
||||
| enumerator via Release() when you're done with |
|
||||
| it. |
|
||||
| EnumerateAllSubtrees - Like EnumerateSubtrees, but will recursively |
|
||||
| enumerate lower-level subtrees, too. |
|
||||
| GetValueInfo - Returns a uint32 value that designates the type |
|
||||
| of data stored at this location in the registry; |
|
||||
| the possible values are defined by the enumerated |
|
||||
| type mozIRegistry::DataType. |
|
||||
| GetValueLength - Returns a uint32 value that indicates the length |
|
||||
| of this registry value; the length is the number |
|
||||
| of characters (for Strings), the number of bytes |
|
||||
| (for Bytes), or the number of int32 values (for |
|
||||
| Int32). |
|
||||
| EnumerateValues - Returns a nsIEnumerator that you can use to |
|
||||
| enumerate all the value nodes descending from |
|
||||
| a specified location. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD AddSubtree( Key baseKey, const char *path, Key *result ) = 0;
|
||||
NS_IMETHOD RemoveSubtree( Key baseKey, const char *path ) = 0;
|
||||
NS_IMETHOD GetSubtree( Key baseKey, const char *path, Key *result ) = 0;
|
||||
|
||||
NS_IMETHOD EnumerateSubtrees( Key baseKey, nsIEnumerator **result ) = 0;
|
||||
NS_IMETHOD EnumerateAllSubtrees( Key baseKey, nsIEnumerator **result ) = 0;
|
||||
|
||||
NS_IMETHOD GetValueType( Key baseKey, const char *path, uint32 *result ) = 0;
|
||||
NS_IMETHOD GetValueLength( Key baseKey, const char *path, uint32 *result ) = 0;
|
||||
|
||||
NS_IMETHOD EnumerateValues( Key baseKey, nsIEnumerator **result ) = 0;
|
||||
|
||||
/*------------------------------ User Name ---------------------------------
|
||||
| These functions manipulate the current "user name." This value controls |
|
||||
| the behavior of certain registry functions (namely, ?). |
|
||||
| |
|
||||
| GetCurrentUserName allocates a copy of the current user name (which the |
|
||||
| caller should free using PR_Free). |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD GetCurrentUserName( char **result ) = 0;
|
||||
NS_IMETHOD SetCurrentUserName( const char *name ) = 0;
|
||||
|
||||
/*------------------------------ Utilities ---------------------------------
|
||||
| Various utility functions: |
|
||||
| |
|
||||
| Pack() is used to compress the contents of an open registry file. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD Pack() = 0;
|
||||
|
||||
}; // mozIRegistry
|
||||
|
||||
/*----------------------------- mozIRegistryNode -------------------------------
|
||||
| This interface is implemented by all the objects obtained from the |
|
||||
| nsIEnumerators that mozIRegistry provides when you call either of the |
|
||||
| subtree enumeration functions EnumerateSubtrees or EnumerateAllSubtrees. |
|
||||
| |
|
||||
| You can call this function to get the name of this subtree. This is the |
|
||||
| relative path from the base key from which you got this interface. |
|
||||
| |
|
||||
| GetName - Returns the path name of this node; this is the relative path |
|
||||
| from the base key from which this subtree was obtained. The |
|
||||
| function allocates a copy of the name; the caller must free it |
|
||||
| using PR_Free. |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct mozIRegistryNode : public nsISupports {
|
||||
NS_IMETHOD GetName( char **result ) = 0;
|
||||
}; // mozIRegistryNode
|
||||
|
||||
/*----------------------------- mozIRegistryValue ------------------------------
|
||||
| This interface is implemented by the objects obtained from the |
|
||||
| nsIEnumerators that mozIRegistry provides when you call the |
|
||||
| EnumerateValues function. An object supporting this interface is |
|
||||
| returned when you call the CurrentItem() function on that enumerator. |
|
||||
| |
|
||||
| You use the member functions of this interface to obtain information |
|
||||
| about each registry value. |
|
||||
| |
|
||||
| GetName - Returns the path name of this node; this is the relative |
|
||||
| path\ from the base key from which this value was obtained. |
|
||||
| The function allocates a copy of the name; the caller must |
|
||||
| subsequently free it via PR_Free. |
|
||||
| GetValueType - Returns (into a location provided by the caller) the type |
|
||||
| of the value; the types are defined by the enumerated |
|
||||
| type mozIRegistry::DataType. |
|
||||
| GetValueLength - Returns a uint32 value that indicates the length |
|
||||
| of this registry value; the length is the number |
|
||||
| of characters (for Strings), the number of bytes |
|
||||
| (for Bytes), or the number of int32 values (for |
|
||||
| Int32). |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct mozIRegistryValue : public nsISupports {
|
||||
NS_IMETHOD GetName( char **result ) = 0;
|
||||
NS_IMETHOD GetValueType( uint32 *result ) = 0;
|
||||
NS_IMETHOD GetValueLength( uint32 *result ) = 0;
|
||||
}; // mozIRegistryEntry
|
||||
|
||||
|
||||
/*------------------------------- Error Codes ----------------------------------
|
||||
------------------------------------------------------------------------------*/
|
||||
#define NS_ERROR_REG_BADTYPE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 1 )
|
||||
#define NS_ERROR_REG_NO_MORE NS_ERROR_GENERATE_SUCCESS( NS_ERROR_MODULE_REG, 2 )
|
||||
#define NS_ERROR_REG_NOT_FOUND NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 3 )
|
||||
#define NS_ERROR_REG_NOFILE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 4 )
|
||||
#define NS_ERROR_REG_BUFFER_TOO_SMALL NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 5 )
|
||||
#define NS_ERROR_REG_NAME_TOO_LONG NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 6 )
|
||||
#define NS_ERROR_REG_NO_PATH NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 7 )
|
||||
#define NS_ERROR_REG_READ_ONLY NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 8 )
|
||||
#define NS_ERROR_REG_BAD_UTF8 NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 9 )
|
||||
|
||||
// {5D41A440-8E37-11d2-8059-00600811A9C3}
|
||||
#define MOZ_IREGISTRY_IID { 0x5d41a440, 0x8e37, 0x11d2, { 0x80, 0x59, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } }
|
||||
// {D1B54831-AC07-11d2-805E-00600811A9C3}
|
||||
#define MOZ_IREGISTRYNODE_IID { 0xd1b54831, 0xac07, 0x11d2, { 0x80, 0x5e, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } }
|
||||
// {5316C380-B2F8-11d2-A374-0080C6F80E4B}
|
||||
#define MOZ_IREGISTRYVALUE_IID { 0x5316c380, 0xb2f8, 0x11d2, { 0xa3, 0x74, 0x0, 0x80, 0xc6, 0xf8, 0xe, 0x4b } }
|
||||
|
||||
#endif
|
||||
1204
mozilla/xpcom/components/mozRegistry.cpp
Normal file
1204
mozilla/xpcom/components/mozRegistry.cpp
Normal file
File diff suppressed because it is too large
Load Diff
80
mozilla/xpcom/components/nsIFactory.h
Normal file
80
mozilla/xpcom/components/nsIFactory.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __nsIFactory_h
|
||||
#define __nsIFactory_h
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
/*
|
||||
* Datatypes and helper macros
|
||||
*/
|
||||
|
||||
typedef nsID nsCID;
|
||||
|
||||
// Define an CID
|
||||
#define NS_DEFINE_CID(_name, _cidspec) \
|
||||
const nsCID _name = _cidspec
|
||||
|
||||
#define REFNSCID const nsCID&
|
||||
|
||||
/*
|
||||
* nsIFactory interface
|
||||
*/
|
||||
|
||||
// {00000001-0000-0000-c000-000000000046}
|
||||
#define NS_IFACTORY_IID \
|
||||
{ 0x00000001, 0x0000, 0x0000, \
|
||||
{ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }
|
||||
|
||||
class nsIFactory: public nsISupports {
|
||||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IFACTORY_IID; return iid; }
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult) = 0;
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock) = 0;
|
||||
};
|
||||
|
||||
#if 0
|
||||
/* Excluding IFactory2 until there is proof of its use - dp */
|
||||
/**
|
||||
* nsIFactory2 allows passing in a signature token when creating an
|
||||
* instance. This allows instance recycling.
|
||||
*/
|
||||
|
||||
// {19997C41-A343-11d1-B665-00805F8A2676}
|
||||
#define NS_IFACTORY2_IID \
|
||||
{ 0x19997c41, 0xa343, 0x11d1, \
|
||||
{ 0xb6, 0x65, 0x0, 0x80, 0x5f, 0x8a, 0x26, 0x76 } }
|
||||
|
||||
class nsIFactory2: public nsIFactory {
|
||||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IFACTORY2_IID; return iid; }
|
||||
|
||||
NS_IMETHOD CreateInstance2(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void *aSignature,
|
||||
void **aResult) = 0;
|
||||
};
|
||||
#endif /* 0 */
|
||||
|
||||
#endif
|
||||
326
mozilla/xpcom/components/nsIRegistry.h
Normal file
326
mozilla/xpcom/components/nsIRegistry.h
Normal file
@@ -0,0 +1,326 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef __nsIRegistry_h
|
||||
#define __nsIRegistry_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIEnumerator;
|
||||
|
||||
/*-------------------------------- nsIRegistry ---------------------------------
|
||||
| This interface provides access to a tree of arbitrary values. |
|
||||
| |
|
||||
| Each node of the tree contains either a value or a subtree or both. |
|
||||
| |
|
||||
| The value at any of these leaf nodes can be any of these "primitive" types: |
|
||||
| o string (null terminated UTF string) |
|
||||
| o array of 32-bit integers |
|
||||
| o arbitrary array of bytes |
|
||||
| o file identifier |
|
||||
| Of course, since you can store an arbitrary array of bytes, you can put |
|
||||
| any data you like into a registry (although you have the burden of |
|
||||
| encoding/decoding your data in that case). |
|
||||
| |
|
||||
| Each branch of the tree is labelled with a string "key." The entire path |
|
||||
| from a given point of the tree to another point further down can be |
|
||||
| presented as a single string composed of each branch's label, concatenated |
|
||||
| to the next, with an intervening forward slash ('/'). The term "key" |
|
||||
| refers to both specific tree branch labels and to such concatenated paths. |
|
||||
| |
|
||||
| The branches from a given node must have unique labels. Distinct nodes can |
|
||||
| have branches with the same label. |
|
||||
| |
|
||||
| For example, here's a small registry tree: |
|
||||
| | |
|
||||
| /\ |
|
||||
| / \ |
|
||||
| / \ |
|
||||
| / \ |
|
||||
| "Classes" "Users" |
|
||||
| / \ |
|
||||
| / \ |
|
||||
| / ["joe"] |
|
||||
| / / \ |
|
||||
| | / \ |
|
||||
| /\ / \ |
|
||||
| / \ "joe" "bob" |
|
||||
| / \ / \ |
|
||||
| / \ |
|
||||
| "{xxxx-xx-1}" "{xxxx-xx-2}" ["c:/joe"] ["d:/Robert"] |
|
||||
| | | |
|
||||
| /\ /\ |
|
||||
| / \ / \ |
|
||||
| / \ / \ |
|
||||
| "Library" "Version" "Library" "Version" |
|
||||
| / \ / \ |
|
||||
| ["foo.dll"] 2 ["bar.dll"] 1 |
|
||||
| |
|
||||
| In this example, there are 2 keys under the root: "Classes" and "Users". |
|
||||
| The first denotes a subtree only (which has two subtrees, ...). The second |
|
||||
| denotes both a value ["joe"] and two subtrees labelled "joe" and "bob". |
|
||||
| The value at the node "/Users" is ["joe"], at "/Users/bob" is ["d:/Robert"]. |
|
||||
| The value at "/Classes/{xxxx-xx-1}/Version" is 2. |
|
||||
| |
|
||||
| The registry interface provides functions that let you navigate the tree |
|
||||
| and manipulate it's contents. |
|
||||
| |
|
||||
| Please note that the registry itself does not impose any structure or |
|
||||
| meaning on the contents of the tree. For example, the registry doesn't |
|
||||
| control whether the value at the key "/Users" is the label for the subtree |
|
||||
| with information about the last active user. That meaning is applied by |
|
||||
| the code that stores these values and uses them for that purpose. |
|
||||
| |
|
||||
| [Any resemblence between this example and actual contents of any actual |
|
||||
| registry is purely coincidental.] |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct nsIRegistry : public nsISupports {
|
||||
/*------------------------------ Constants ---------------------------------
|
||||
| The following enumerated types and values are used by the registry |
|
||||
| interface. |
|
||||
--------------------------------------------------------------------------*/
|
||||
typedef enum {
|
||||
String = 1,
|
||||
Int32,
|
||||
Bytes,
|
||||
File
|
||||
} DataType;
|
||||
|
||||
/*-------------------------------- Types -----------------------------------
|
||||
| The following data types are used by this interface. All are basically |
|
||||
| opaque types. You obtain objects of these types via certain member |
|
||||
| function calls and re-use them later (without having to know what they |
|
||||
| contain). |
|
||||
| |
|
||||
| Key - Placeholder to represent a particular node in a registry |
|
||||
| tree. There are 3 enumerated values that correspond to |
|
||||
| specific nodes: |
|
||||
| Common - Where most stuff goes. |
|
||||
| Users - Special subtree to hold info about |
|
||||
| "users"; if you don't know what goes |
|
||||
| here, don't mess with it. |
|
||||
| CurrentUser - Subtree under Users corresponding to |
|
||||
| whatever user is designed the "current" |
|
||||
| one; see note above. |
|
||||
| You can specify any of these enumerated values as "keys" |
|
||||
| on any member function that takes a nsRegistry::Key. |
|
||||
| ValueInfo - Structure describing a registry value. |
|
||||
--------------------------------------------------------------------------*/
|
||||
typedef uint32 Key;
|
||||
|
||||
enum { Users = 1, Common = 2, CurrentUser = 3 };
|
||||
|
||||
struct ValueInfo {
|
||||
DataType type;
|
||||
uint32 length;
|
||||
};
|
||||
|
||||
/*--------------------------- Opening/Closing ------------------------------
|
||||
| These functions open the specified registry file (Open() with a non-null |
|
||||
| argument) or the default "standard" registry file (Open() with a null |
|
||||
| argument or OpenDefault()). |
|
||||
| |
|
||||
| Once opened, you can access the registry contents via the read/write |
|
||||
| or query functions. |
|
||||
| |
|
||||
| The registry file will be closed automatically when the registry object |
|
||||
| is destroyed. You can close the file prior to that by using the |
|
||||
| Close() function. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD Open( const char *regFile = 0 ) = 0;
|
||||
NS_IMETHOD OpenDefault() = 0;
|
||||
NS_IMETHOD Close() = 0;
|
||||
|
||||
/*----------------------- Reading/Writing Values ---------------------------
|
||||
| These functions read/write the registry values at a given node. |
|
||||
| |
|
||||
| All functions require you to specify where in the registry key to |
|
||||
| get/set the value. The location is specified using two components: |
|
||||
| o A "base key" indicating where to start from; this is a value of type |
|
||||
| nsIRegistry::Key. You use either one of the special "root" key |
|
||||
| values or a subkey obtained via some other member function call. |
|
||||
| o A "relative path," expressed as a sequence of subtree names |
|
||||
| separated by forward slashes. This path describes how to get from |
|
||||
| the base key to the node at which you want to store the data. This |
|
||||
| component can be a null pointer which means the value goes directly |
|
||||
| at the node denoted by the base key. |
|
||||
| |
|
||||
| When you request a value of a given type, the data stored at the |
|
||||
| specified node must be of the type requested. If not, an error results. |
|
||||
| |
|
||||
| GetString - Obtains a newly allocated copy of a string type value. The |
|
||||
| caller is obligated to free the returned string using |
|
||||
| PR_Free. |
|
||||
| SetString - Stores the argument string at the specified node. |
|
||||
| GetInt - Obtains an int32 value at the specified node. The result |
|
||||
| is returned into an int32 location you specify. |
|
||||
| SetInt - Stores a given int32 value at a node. |
|
||||
| GetBytes - Obtains a byte array value; this returns both an allocated |
|
||||
| array of bytes and a length (necessary because there may be |
|
||||
| embedded null bytes in the array). You must free the |
|
||||
| resulting array using PR_Free. |
|
||||
| SetBytes - Stores a given array of bytes; you specify the bytes via a |
|
||||
| pointer and a length. |
|
||||
| GetIntArray - Obtains the array of int32 values stored at a given node. |
|
||||
| The result is composed of two values: a pointer to an |
|
||||
| array of integer values (which must be freed using |
|
||||
| PR_Free) and the number of elements in that array. |
|
||||
| SetIntArray - Stores a set of int32 values at a given node. You must |
|
||||
| provide a pointer to the array and the number of entries. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD GetString( Key baseKey, const char *path, char **result ) = 0;
|
||||
NS_IMETHOD SetString( Key baseKey, const char *path, const char *value ) = 0;
|
||||
NS_IMETHOD GetInt( Key baseKey, const char *path, int32 *result ) = 0;
|
||||
NS_IMETHOD SetInt( Key baseKey, const char *path, int32 value ) = 0;
|
||||
NS_IMETHOD GetBytes( Key baseKey, const char *path, void **result, uint32 *len ) = 0;
|
||||
NS_IMETHOD SetBytes( Key baseKey, const char *path, void *value, uint32 len ) = 0;
|
||||
NS_IMETHOD GetIntArray( Key baseKey, const char *path, int32 **result, uint32 *len ) = 0;
|
||||
NS_IMETHOD SetIntArray( Key baseKey, const char *path, const int32 *value, uint32 len ) = 0;
|
||||
|
||||
/*------------------------------ Navigation --------------------------------
|
||||
| These functions let you navigate through the registry tree, querying |
|
||||
| its contents. |
|
||||
| |
|
||||
| As above, all these functions requires a starting tree location ("base |
|
||||
| key") specified as a nsIRegistry::Key. Some also require a path |
|
||||
| name to locate the registry node location relative to this base key. |
|
||||
| |
|
||||
| AddSubtree - Adds a new registry subtree at the specified |
|
||||
| location. Returns the resulting key in |
|
||||
| the location specified by the third argument |
|
||||
| (unless that pointer is 0). |
|
||||
| RemoveNode - Removes the specified registry subtree or |
|
||||
| value at the specified location. |
|
||||
| GetSubtree - Returns a nsIRegistry::Key that can be used |
|
||||
| to refer to the specified registry location. |
|
||||
| EnumerateSubtrees - Returns a nsIEnumerator object that you can |
|
||||
| use to enumerate all the subtrees descending |
|
||||
| from a specified location. You must free the |
|
||||
| enumerator via Release() when you're done with |
|
||||
| it. |
|
||||
| EnumerateAllSubtrees - Like EnumerateSubtrees, but will recursively |
|
||||
| enumerate lower-level subtrees, too. |
|
||||
| GetValueInfo - Returns a uint32 value that designates the type |
|
||||
| of data stored at this location in the registry; |
|
||||
| the possible values are defined by the enumerated |
|
||||
| type nsIRegistry::DataType. |
|
||||
| GetValueLength - Returns a uint32 value that indicates the length |
|
||||
| of this registry value; the length is the number |
|
||||
| of characters (for Strings), the number of bytes |
|
||||
| (for Bytes), or the number of int32 values (for |
|
||||
| Int32). |
|
||||
| EnumerateValues - Returns a nsIEnumerator that you can use to |
|
||||
| enumerate all the value nodes descending from |
|
||||
| a specified location. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD AddSubtree( Key baseKey, const char *path, Key *result ) = 0;
|
||||
NS_IMETHOD RemoveSubtree( Key baseKey, const char *path ) = 0;
|
||||
NS_IMETHOD GetSubtree( Key baseKey, const char *path, Key *result ) = 0;
|
||||
|
||||
NS_IMETHOD EnumerateSubtrees( Key baseKey, nsIEnumerator **result ) = 0;
|
||||
NS_IMETHOD EnumerateAllSubtrees( Key baseKey, nsIEnumerator **result ) = 0;
|
||||
|
||||
NS_IMETHOD GetValueType( Key baseKey, const char *path, uint32 *result ) = 0;
|
||||
NS_IMETHOD GetValueLength( Key baseKey, const char *path, uint32 *result ) = 0;
|
||||
|
||||
NS_IMETHOD EnumerateValues( Key baseKey, nsIEnumerator **result ) = 0;
|
||||
|
||||
/*------------------------------ User Name ---------------------------------
|
||||
| These functions manipulate the current "user name." This value controls |
|
||||
| the behavior of certain registry functions (namely, ?). |
|
||||
| |
|
||||
| GetCurrentUserName allocates a copy of the current user name (which the |
|
||||
| caller should free using PR_Free). |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD GetCurrentUserName( char **result ) = 0;
|
||||
NS_IMETHOD SetCurrentUserName( const char *name ) = 0;
|
||||
|
||||
/*------------------------------ Utilities ---------------------------------
|
||||
| Various utility functions: |
|
||||
| |
|
||||
| Pack() is used to compress the contents of an open registry file. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD Pack() = 0;
|
||||
|
||||
}; // nsIRegistry
|
||||
|
||||
/*------------------------------ nsIRegistryNode -------------------------------
|
||||
| This interface is implemented by all the objects obtained from the |
|
||||
| nsIEnumerators that nsIRegistry provides when you call either of the |
|
||||
| subtree enumeration functions EnumerateSubtrees or EnumerateAllSubtrees. |
|
||||
| |
|
||||
| You can call this function to get the name of this subtree. This is the |
|
||||
| relative path from the base key from which you got this interface. |
|
||||
| |
|
||||
| GetName - Returns the path name of this node; this is the relative path |
|
||||
| from the base key from which this subtree was obtained. The |
|
||||
| function allocates a copy of the name; the caller must free it |
|
||||
| using PR_Free. |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct nsIRegistryNode : public nsISupports {
|
||||
NS_IMETHOD GetName( char **result ) = 0;
|
||||
}; // nsIRegistryNode
|
||||
|
||||
/*------------------------------ nsIRegistryValue ------------------------------
|
||||
| This interface is implemented by the objects obtained from the |
|
||||
| nsIEnumerators that nsIRegistry provides when you call the |
|
||||
| EnumerateValues function. An object supporting this interface is |
|
||||
| returned when you call the CurrentItem() function on that enumerator. |
|
||||
| |
|
||||
| You use the member functions of this interface to obtain information |
|
||||
| about each registry value. |
|
||||
| |
|
||||
| GetName - Returns the path name of this node; this is the relative |
|
||||
| path\ from the base key from which this value was obtained. |
|
||||
| The function allocates a copy of the name; the caller must |
|
||||
| subsequently free it via PR_Free. |
|
||||
| GetValueType - Returns (into a location provided by the caller) the type |
|
||||
| of the value; the types are defined by the enumerated |
|
||||
| type nsIRegistry::DataType. |
|
||||
| GetValueLength - Returns a uint32 value that indicates the length |
|
||||
| of this registry value; the length is the number |
|
||||
| of characters (for Strings), the number of bytes |
|
||||
| (for Bytes), or the number of int32 values (for |
|
||||
| Int32). |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct nsIRegistryValue : public nsISupports {
|
||||
NS_IMETHOD GetName( char **result ) = 0;
|
||||
NS_IMETHOD GetValueType( uint32 *result ) = 0;
|
||||
NS_IMETHOD GetValueLength( uint32 *result ) = 0;
|
||||
}; // nsIRegistryEntry
|
||||
|
||||
|
||||
/*------------------------------- Error Codes ----------------------------------
|
||||
------------------------------------------------------------------------------*/
|
||||
#define NS_ERROR_REG_BADTYPE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 1 )
|
||||
#define NS_ERROR_REG_NO_MORE NS_ERROR_GENERATE_SUCCESS( NS_ERROR_MODULE_REG, 2 )
|
||||
#define NS_ERROR_REG_NOT_FOUND NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 3 )
|
||||
#define NS_ERROR_REG_NOFILE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 4 )
|
||||
#define NS_ERROR_REG_BUFFER_TOO_SMALL NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 5 )
|
||||
#define NS_ERROR_REG_NAME_TOO_LONG NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 6 )
|
||||
#define NS_ERROR_REG_NO_PATH NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 7 )
|
||||
#define NS_ERROR_REG_READ_ONLY NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 8 )
|
||||
#define NS_ERROR_REG_BAD_UTF8 NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 9 )
|
||||
|
||||
// {5D41A440-8E37-11d2-8059-00600811A9C3}
|
||||
#define NS_IREGISTRY_IID { 0x5d41a440, 0x8e37, 0x11d2, { 0x80, 0x59, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } }
|
||||
// {D1B54831-AC07-11d2-805E-00600811A9C3}
|
||||
#define NS_IREGISTRYNODE_IID { 0xd1b54831, 0xac07, 0x11d2, { 0x80, 0x5e, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } }
|
||||
// {5316C380-B2F8-11d2-A374-0080C6F80E4B}
|
||||
#define NS_IREGISTRYVALUE_IID { 0x5316c380, 0xb2f8, 0x11d2, { 0xa3, 0x74, 0x0, 0x80, 0xc6, 0xf8, 0xe, 0x4b } }
|
||||
|
||||
#endif
|
||||
148
mozilla/xpcom/components/nsIServiceManager.h
Normal file
148
mozilla/xpcom/components/nsIServiceManager.h
Normal file
@@ -0,0 +1,148 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIServiceManager_h___
|
||||
#define nsIServiceManager_h___
|
||||
|
||||
#include "nsRepository.h"
|
||||
|
||||
class nsIShutdownListener;
|
||||
|
||||
/**
|
||||
* The nsIServiceManager manager interface provides a means to obtain
|
||||
* global services in an application. The service manager depends on the
|
||||
* repository to find and instantiate factories to obtain services.
|
||||
*
|
||||
* Users of the service manager must first obtain a pointer to the global
|
||||
* service manager by calling NS_GetGlobalServiceManager. After that,
|
||||
* they can request specific services by calling GetService. When they are
|
||||
* finished with a service the release it by calling ReleaseService (instead
|
||||
* of releasing the service object directly):
|
||||
*
|
||||
* nsICacheManager* cm;
|
||||
* nsServiceManager::GetService(kCacheManagerCID, kICacheManagerIID, (nsISupports**)&cm);
|
||||
*
|
||||
* ... use cm, and then sometime later ...
|
||||
*
|
||||
* nsServiceManager::ReleaseService(kCacheManagerCID, cm);
|
||||
*
|
||||
* A user of a service may keep references to particular services indefinitely
|
||||
* and only must call ReleaseService when it shuts down. However if the user
|
||||
* wishes to voluntarily cooperate with the shutdown of the service it is
|
||||
* using, it may supply an nsIShutdownListener to provide for asynchronous
|
||||
* release of the services it is using. The shutdown listener's OnShutdown
|
||||
* method will be called for a service that is being shut down, and it is
|
||||
* its responsiblity to release references obtained from that service if at
|
||||
* all possible.
|
||||
*
|
||||
* The process of shutting down a particular service is initiated by calling
|
||||
* the service manager's ShutdownService method. This will iterate through
|
||||
* all the registered shutdown listeners for the service being shut down, and
|
||||
* then will attempt to unload the library associated with the service if
|
||||
* possible. The status result of ShutdownService indicates whether the
|
||||
* service was successfully shut down, failed, or was not in service.
|
||||
*
|
||||
* XXX QUESTIONS:
|
||||
* - Should a "service" be more than nsISupports? Should it be a factory
|
||||
* and/or have Startup(), Shutdown(), etc.
|
||||
* - If the asynchronous OnShutdown operation gets called, does the user
|
||||
* of a service still need to call ReleaseService? (Or should they _not_
|
||||
* call it?)
|
||||
*/
|
||||
class nsIServiceManager : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_IMETHOD
|
||||
GetService(const nsCID& aClass, const nsIID& aIID,
|
||||
nsISupports* *result,
|
||||
nsIShutdownListener* shutdownListener = NULL) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
ReleaseService(const nsCID& aClass, nsISupports* service,
|
||||
nsIShutdownListener* shutdownListener = NULL) = 0;
|
||||
|
||||
/**
|
||||
* Requests a service to be shut down, possibly unloading its DLL.
|
||||
*
|
||||
* @returns NS_OK - if shutdown was successful and service was unloaded,
|
||||
* @returns NS_ERROR_SERVICE_NOT_FOUND - if shutdown failed because
|
||||
* the service was not currently loaded
|
||||
* @returns NS_ERROR_SERVICE_IN_USE - if shutdown failed because some
|
||||
* user of the service wouldn't voluntarily release it by using
|
||||
* a shutdown listener.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
ShutdownService(const nsCID& aClass) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_ISERVICEMANAGER_IID \
|
||||
{ /* cf0df3b0-3401-11d2-8163-006008119d7a */ \
|
||||
0xcf0df3b0, \
|
||||
0x3401, \
|
||||
0x11d2, \
|
||||
{0x81, 0x63, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
#define NS_ERROR_SERVICE_NOT_FOUND NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCOM, 22)
|
||||
#define NS_ERROR_SERVICE_IN_USE NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCOM, 23)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsIShutdownListener : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_IMETHOD
|
||||
OnShutdown(const nsCID& aClass, nsISupports* service) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_ISHUTDOWNLISTENER_IID \
|
||||
{ /* 56decae0-3406-11d2-8163-006008119d7a */ \
|
||||
0x56decae0, \
|
||||
0x3406, \
|
||||
0x11d2, \
|
||||
{0x81, 0x63, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface to Global Services
|
||||
|
||||
class NS_COM nsServiceManager {
|
||||
public:
|
||||
static nsresult GetService(const nsCID& aClass, const nsIID& aIID,
|
||||
nsISupports* *result,
|
||||
nsIShutdownListener* shutdownListener = NULL);
|
||||
|
||||
static nsresult ReleaseService(const nsCID& aClass, nsISupports* service,
|
||||
nsIShutdownListener* shutdownListener = NULL);
|
||||
|
||||
static nsresult ShutdownService(const nsCID& aClass);
|
||||
|
||||
// Since the global Service Manager is truly global, there's no need to
|
||||
// release it.
|
||||
static nsresult GetGlobalServiceManager(nsIServiceManager* *result);
|
||||
|
||||
protected:
|
||||
static nsIServiceManager* globalServiceManager;
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIServiceManager_h___ */
|
||||
31
mozilla/xpcom/components/nsIServiceProvider.h
Normal file
31
mozilla/xpcom/components/nsIServiceProvider.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __nsIServerProvider_h
|
||||
#define __nsIServerProvider_h
|
||||
#include "nsISupports.h"
|
||||
|
||||
typedef nsID nsSID;
|
||||
#define NSSIDREF const nsSID&
|
||||
|
||||
class nsIServiceProvider: public nsISupports {
|
||||
public:
|
||||
NS_IMETHOD QueryService(NSSIDREF aSID, NSIIDREF sIID, (void **) pService);
|
||||
};
|
||||
|
||||
#endif /* __nsIServerProvider_h */
|
||||
118
mozilla/xpcom/components/nsMacRepository.h
Normal file
118
mozilla/xpcom/components/nsMacRepository.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifdef XP_MAC
|
||||
#ifdef MOZ_NGLAYOUT
|
||||
|
||||
#error "nsMacRepository.h became obsolete when the shared lib conversion was completed."
|
||||
|
||||
// The Mac NGLayout is not based on shared libraries yet.
|
||||
// All the DLLs are built as static libraries and we present them as
|
||||
// shared libraries by redefining PR_LoadLibrary(), PR_UnloadLibrary()
|
||||
// and PR_FindSymbol() below.
|
||||
//
|
||||
// If you add or remove shared libraries on other platforms, you must
|
||||
// - Add the library name to the defines below.
|
||||
// - Rename the "NSGetFactory" and "NSCanUnload" procs for the Mac:
|
||||
// just append the library name to the function name.
|
||||
// - Add the library and its procs to the static list below.
|
||||
|
||||
|
||||
typedef struct MacLibrary
|
||||
{
|
||||
char * name;
|
||||
nsFactoryProc factoryProc;
|
||||
nsCanUnloadProc unloadProc;
|
||||
} MacLibrary;
|
||||
|
||||
// library names
|
||||
#define WIDGET_DLL "WIDGET_DLL"
|
||||
#define GFXWIN_DLL "GFXWIN_DLL"
|
||||
#define VIEW_DLL "VIEW_DLL"
|
||||
#define WEB_DLL "WEB_DLL"
|
||||
#define PLUGIN_DLL "PLUGIN_DLL"
|
||||
#define PREF_DLL "PREF_DLL"
|
||||
#define PARSER_DLL "PARSER_DLL"
|
||||
#define DOM_DLL "DOM_DLL"
|
||||
#define LAYOUT_DLL "LAYOUT_DLL"
|
||||
#define NETLIB_DLL "NETLIB_DLL"
|
||||
#define EDITOR_DLL "EDITOR_DLL"
|
||||
|
||||
#ifdef IMPL_MAC_REPOSITORY
|
||||
|
||||
extern "C" nsresult NSGetFactory_WIDGET_DLL(const nsCID &, nsISupports* , nsIFactory ** );
|
||||
extern "C" nsresult NSGetFactory_GFXWIN_DLL(const nsCID &, nsISupports*, nsIFactory ** );
|
||||
extern "C" nsresult NSGetFactory_VIEW_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_WEB_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
//extern "C" nsresult NSGetFactory_PLUGIN_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_PREF_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_PARSER_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_DOM_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_LAYOUT_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_NETLIB_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_EDITOR_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
|
||||
extern "C" PRBool NSCanUnload_PREF_DLL(void);
|
||||
|
||||
// library list
|
||||
static MacLibrary libraries[] = {
|
||||
#if 0
|
||||
WIDGET_DLL, NSGetFactory_WIDGET_DLL, NULL,
|
||||
GFXWIN_DLL, NSGetFactory_GFXWIN_DLL, NULL,
|
||||
VIEW_DLL, NSGetFactory_VIEW_DLL, NULL,
|
||||
WEB_DLL, NSGetFactory_WEB_DLL, NULL,
|
||||
//PLUGIN_DLL, NSGetFactory_PLUGIN_DLL, NULL,
|
||||
PREF_DLL, NSGetFactory_PREF_DLL, NSCanUnload_PREF_DLL,
|
||||
PARSER_DLL, NSGetFactory_PARSER_DLL, NULL,
|
||||
DOM_DLL, NSGetFactory_DOM_DLL, NULL,
|
||||
LAYOUT_DLL, NSGetFactory_LAYOUT_DLL, NULL,
|
||||
NETLIB_DLL, NSGetFactory_NETLIB_DLL, NULL,
|
||||
//EDITOR_DLL, NSGetFactory_EDITOR_DLL, NULL, // FIX ME
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
static void* FindMacSymbol(char* libName, const char *symbolName)
|
||||
{
|
||||
MacLibrary * macLib;
|
||||
|
||||
for (macLib = libraries; ; macLib ++)
|
||||
{
|
||||
if (macLib->name == NULL)
|
||||
return NULL;
|
||||
|
||||
if (PL_strcmp(macLib->name, libName) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (PL_strcmp(symbolName, "NSGetFactory") == 0) {
|
||||
return macLib->factoryProc;
|
||||
}
|
||||
else if (PL_strcmp(symbolName, "NSCanUnload") == 0) {
|
||||
return macLib->unloadProc;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define PR_LoadLibrary(libName) (PRLibrary *)libName
|
||||
#define PR_UnloadLibrary(lib) lib = NULL
|
||||
#define PR_FindSymbol(lib, symbolName) FindMacSymbol((char*)lib, symbolName)
|
||||
|
||||
#endif // IMPL_MAC_REPOSITORY
|
||||
|
||||
#endif // MOZ_NGLAYOUT
|
||||
#endif // XP_MAC
|
||||
1204
mozilla/xpcom/components/nsRegistry.cpp
Normal file
1204
mozilla/xpcom/components/nsRegistry.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1592
mozilla/xpcom/components/nsRepository.cpp
Normal file
1592
mozilla/xpcom/components/nsRepository.cpp
Normal file
File diff suppressed because it is too large
Load Diff
213
mozilla/xpcom/components/nsRepository.h
Normal file
213
mozilla/xpcom/components/nsRepository.h
Normal file
@@ -0,0 +1,213 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __nsRespository_h
|
||||
#define __nsRespository_h
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "prlog.h"
|
||||
#include "prmon.h"
|
||||
#include "nsCom.h"
|
||||
#include "nsID.h"
|
||||
#include "nsError.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsHashtable.h"
|
||||
|
||||
/*
|
||||
* Prototypes for dynamic library export functions
|
||||
*/
|
||||
|
||||
class nsIServiceManager;
|
||||
|
||||
|
||||
//***********************************************************
|
||||
//
|
||||
// NSGetFactory should take nsISupports instead of nsIServiceManager
|
||||
// as the second param. This is done on purpose!! Please don't change
|
||||
// it.
|
||||
// sudu / stanley
|
||||
//
|
||||
//***********************************************************
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass,
|
||||
nsISupports* serviceMgr,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload();
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char *fullpath);
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char *fullpath);
|
||||
|
||||
/* Quick Registration
|
||||
*
|
||||
* For quick registration, dlls can define
|
||||
* NSQuickRegisterClassData g_NSQuickRegisterData[];
|
||||
* and export the symbol "g_NSQuickRegisterData"
|
||||
*
|
||||
* Quick registration is tried only if the symbol "NSRegisterSelf"
|
||||
* is not found. If it is found but fails registration, quick registration
|
||||
* will not kick in.
|
||||
*
|
||||
* The array is terminated by having a NULL last element. Specifically, the
|
||||
* array will be assumed to end when
|
||||
* (g_NSQuickRegisterData[i].classIdStr == NULL)
|
||||
*
|
||||
*/
|
||||
#define NS_QUICKREGISTER_DATA_SYMBOL "g_NSQuickRegisterData"
|
||||
|
||||
typedef struct NSQuickRegisterClassData {
|
||||
const char *CIDString; // {98765-8776-8958758759-958785}
|
||||
const char *className; // "Layout Engine"
|
||||
const char *progID; // "Gecko.LayoutEngine.1"
|
||||
} NSQuickRegisterClassData;
|
||||
|
||||
typedef NSQuickRegisterClassData* NSQuickRegisterData;
|
||||
|
||||
/* Autoregistration will try only files with these extensions.
|
||||
* All extensions are case insensitive.
|
||||
".dll", // Windows
|
||||
".dso", // Unix
|
||||
".so", // Unix
|
||||
".sl", // Unix: HP
|
||||
"_dll", // Mac
|
||||
".dlm", // new for all platforms
|
||||
*/
|
||||
|
||||
/*
|
||||
* Dynamic library export function types
|
||||
*/
|
||||
|
||||
typedef nsresult (*nsFactoryProc)(const nsCID &aCLass,
|
||||
nsISupports* serviceMgr,
|
||||
nsIFactory **aFactory);
|
||||
typedef PRBool (*nsCanUnloadProc)(void);
|
||||
typedef nsresult (*nsRegisterProc)(const char *path);
|
||||
typedef nsresult (*nsUnregisterProc)(const char *path);
|
||||
|
||||
/*
|
||||
* Support types
|
||||
*/
|
||||
|
||||
class FactoryEntry;
|
||||
class nsDllStore;
|
||||
class nsDll;
|
||||
|
||||
enum NSRegistrationInstant
|
||||
{
|
||||
NS_Startup = 0,
|
||||
NS_Script = 1,
|
||||
NS_Timer = 2
|
||||
};
|
||||
|
||||
/* Error codes generated by the repository methods */
|
||||
|
||||
#define NS_XPCOM_ERRORCODE_IS_DIR 1
|
||||
|
||||
/* The separator for each path part in the pathlist for autoregistration */
|
||||
|
||||
#define NS_PATH_SEPARATOR ';'
|
||||
|
||||
|
||||
/*
|
||||
* nsRepository class
|
||||
*/
|
||||
|
||||
class NS_COM nsRepository {
|
||||
private:
|
||||
|
||||
#define NS_MAX_FILENAME_LEN 1024
|
||||
|
||||
static nsHashtable *factories;
|
||||
static PRMonitor *monitor;
|
||||
|
||||
static nsresult checkInitialized(void);
|
||||
static nsresult loadFactory(FactoryEntry *aEntry, nsIFactory **aFactory);
|
||||
static nsresult SelfRegisterDll(nsDll *dll);
|
||||
static nsresult SelfUnregisterDll(nsDll *dll);
|
||||
|
||||
public:
|
||||
static nsDllStore *dllStore;
|
||||
|
||||
static nsresult Initialize(void);
|
||||
// Finds a factory for a specific class ID
|
||||
static nsresult FindFactory(const nsCID &aClass,
|
||||
nsIFactory **aFactory);
|
||||
|
||||
// Finds a class ID for a specific Program ID
|
||||
static nsresult ProgIDToCLSID(const char *aProgID,
|
||||
nsCID *aClass);
|
||||
|
||||
// Creates a class instance for a specific class ID
|
||||
static nsresult CreateInstance(const nsCID &aClass,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Creates a class instance for a specific class ID
|
||||
/*
|
||||
static nsresult CreateInstance2(const nsCID &aClass,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void *aSignature,
|
||||
void **aResult);
|
||||
*/
|
||||
|
||||
// Manually registry a factory for a class
|
||||
static nsresult RegisterFactory(const nsCID &aClass,
|
||||
nsIFactory *aFactory,
|
||||
PRBool aReplace);
|
||||
|
||||
// Manually registry a dynamically loaded factory for a class
|
||||
static nsresult RegisterFactory(const nsCID &aClass,
|
||||
const char *aLibrary,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist);
|
||||
|
||||
// Manually register a dynamically loaded component.
|
||||
static nsresult RegisterComponent(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
const char *aLibrary,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist);
|
||||
|
||||
// Manually unregister a factory for a class
|
||||
static nsresult UnregisterFactory(const nsCID &aClass,
|
||||
nsIFactory *aFactory);
|
||||
|
||||
// Manually unregister a dynamically loaded factory for a class
|
||||
static nsresult UnregisterFactory(const nsCID &aClass,
|
||||
const char *aLibrary);
|
||||
|
||||
// Manually unregister a dynamically loaded component
|
||||
static nsresult UnregisterComponent(const nsCID &aClass,
|
||||
const char *aLibrary);
|
||||
|
||||
// Unload dynamically loaded factories that are not in use
|
||||
static nsresult FreeLibraries(void);
|
||||
|
||||
// DLL registration support
|
||||
static nsresult AutoRegister(NSRegistrationInstant when,
|
||||
const char* pathlist);
|
||||
// Pathlist is a semicolon separated list of pathnames
|
||||
static nsresult AddToDefaultPathList(const char *pathlist);
|
||||
static nsresult SyncComponentsInPathList(const char *pathlist);
|
||||
static nsresult SyncComponentsInDir(const char *path);
|
||||
static nsresult SyncComponentsInFile(const char *fullname);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
350
mozilla/xpcom/components/nsServiceManager.cpp
Normal file
350
mozilla/xpcom/components/nsServiceManager.cpp
Normal file
@@ -0,0 +1,350 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsVector.h"
|
||||
#include "prcmon.h"
|
||||
#include "prthread.h" /* XXX: only used for the NSPR initialization hack (rick) */
|
||||
|
||||
class nsServiceEntry {
|
||||
public:
|
||||
|
||||
nsServiceEntry(const nsCID& cid, nsISupports* service);
|
||||
~nsServiceEntry();
|
||||
|
||||
nsresult AddListener(nsIShutdownListener* listener);
|
||||
nsresult RemoveListener(nsIShutdownListener* listener);
|
||||
nsresult NotifyListeners(void);
|
||||
|
||||
const nsCID& mClassID;
|
||||
nsISupports* mService;
|
||||
nsVector* mListeners; // nsVector<nsIShutdownListener>
|
||||
PRBool mShuttingDown;
|
||||
|
||||
};
|
||||
|
||||
nsServiceEntry::nsServiceEntry(const nsCID& cid, nsISupports* service)
|
||||
: mClassID(cid), mService(service), mListeners(NULL), mShuttingDown(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
nsServiceEntry::~nsServiceEntry()
|
||||
{
|
||||
if (mListeners) {
|
||||
NS_ASSERTION(mListeners->GetSize() == 0, "listeners not removed or notified");
|
||||
#if 0
|
||||
PRUint32 size = mListeners->GetSize();
|
||||
for (PRUint32 i = 0; i < size; i++) {
|
||||
nsIShutdownListener* listener = (nsIShutdownListener*)(*mListeners)[i];
|
||||
listener->Release();
|
||||
}
|
||||
#endif
|
||||
delete mListeners;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsServiceEntry::AddListener(nsIShutdownListener* listener)
|
||||
{
|
||||
if (listener == NULL)
|
||||
return NS_OK;
|
||||
if (mListeners == NULL) {
|
||||
mListeners = new nsVector();
|
||||
if (mListeners == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
PRInt32 err = mListeners->Add(listener);
|
||||
listener->AddRef();
|
||||
return err == -1 ? NS_ERROR_FAILURE : NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsServiceEntry::RemoveListener(nsIShutdownListener* listener)
|
||||
{
|
||||
if (listener == NULL)
|
||||
return NS_OK;
|
||||
NS_ASSERTION(mListeners, "no listeners added yet");
|
||||
PRUint32 size = mListeners->GetSize();
|
||||
for (PRUint32 i = 0; i < size; i++) {
|
||||
if ((*mListeners)[i] == listener) {
|
||||
mListeners->Remove(i);
|
||||
listener->Release();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(0, "unregistered shutdown listener");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsServiceEntry::NotifyListeners(void)
|
||||
{
|
||||
if (mListeners) {
|
||||
PRUint32 size = mListeners->GetSize();
|
||||
for (PRUint32 i = 0; i < size; i++) {
|
||||
nsIShutdownListener* listener = (nsIShutdownListener*)(*mListeners)[0];
|
||||
nsresult err = listener->OnShutdown(mClassID, mService);
|
||||
if (err) return err;
|
||||
listener->Release();
|
||||
mListeners->Remove(0);
|
||||
}
|
||||
NS_ASSERTION(mListeners->GetSize() == 0, "failed to notify all listeners");
|
||||
delete mListeners;
|
||||
mListeners = NULL;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsServiceManagerImpl : public nsIServiceManager {
|
||||
public:
|
||||
|
||||
NS_IMETHOD
|
||||
GetService(const nsCID& aClass, const nsIID& aIID,
|
||||
nsISupports* *result,
|
||||
nsIShutdownListener* shutdownListener = NULL);
|
||||
|
||||
NS_IMETHOD
|
||||
ReleaseService(const nsCID& aClass, nsISupports* service,
|
||||
nsIShutdownListener* shutdownListener = NULL);
|
||||
|
||||
NS_IMETHOD
|
||||
ShutdownService(const nsCID& aClass);
|
||||
|
||||
nsServiceManagerImpl(void);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~nsServiceManagerImpl(void);
|
||||
|
||||
nsHashtable* mServices; // nsHashtable<nsServiceEntry>
|
||||
};
|
||||
|
||||
nsServiceManagerImpl::nsServiceManagerImpl(void)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mServices = new nsHashtable();
|
||||
NS_ASSERTION(mServices, "out of memory already?");
|
||||
}
|
||||
|
||||
static PRBool
|
||||
DeleteEntry(nsHashKey *aKey, void *aData, void* closure)
|
||||
{
|
||||
nsServiceEntry* entry = (nsServiceEntry*)aData;
|
||||
entry->mService->Release();
|
||||
delete entry;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsServiceManagerImpl::~nsServiceManagerImpl(void)
|
||||
{
|
||||
mServices->Enumerate(DeleteEntry);
|
||||
delete mServices;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIServiceManagerIID, NS_ISERVICEMANAGER_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
NS_IMPL_ADDREF(nsServiceManagerImpl);
|
||||
NS_IMPL_RELEASE(nsServiceManagerImpl);
|
||||
|
||||
nsresult
|
||||
nsServiceManagerImpl::QueryInterface(const nsIID& aIID, void* *aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aInstancePtr = NULL;
|
||||
if (aIID.Equals(kIServiceManagerIID) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsServiceManagerImpl::GetService(const nsCID& aClass, const nsIID& aIID,
|
||||
nsISupports* *result,
|
||||
nsIShutdownListener* shutdownListener)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
/* XXX: This is a hack to force NSPR initialization.. This should be
|
||||
* removed once PR_CEnterMonitor(...) initializes NSPR... (rick)
|
||||
*/
|
||||
(void)PR_GetCurrentThread();
|
||||
PR_CEnterMonitor(this);
|
||||
|
||||
nsIDKey key(aClass);
|
||||
nsServiceEntry* entry = (nsServiceEntry*)mServices->Get(&key);
|
||||
|
||||
if (entry) {
|
||||
nsISupports* service;
|
||||
err = entry->mService->QueryInterface(aIID, (void**)&service);
|
||||
if (err == NS_OK) {
|
||||
err = entry->AddListener(shutdownListener);
|
||||
if (err == NS_OK) {
|
||||
*result = service;
|
||||
|
||||
// If someone else requested the service to be shut down,
|
||||
// and we just asked to get it again before it could be
|
||||
// released, then cancel their shutdown request:
|
||||
if (entry->mShuttingDown) {
|
||||
entry->mShuttingDown = PR_FALSE;
|
||||
service->AddRef(); // Released in ShutdownService
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsISupports* service;
|
||||
err = nsRepository::CreateInstance(aClass, NULL, aIID, (void**)&service);
|
||||
if (err == NS_OK) {
|
||||
entry = new nsServiceEntry(aClass, service);
|
||||
if (entry == NULL) {
|
||||
service->Release();
|
||||
err = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
else {
|
||||
err = entry->AddListener(shutdownListener);
|
||||
if (err == NS_OK) {
|
||||
mServices->Put(&key, entry);
|
||||
*result = service;
|
||||
service->AddRef(); // Released in ShutdownService
|
||||
}
|
||||
else {
|
||||
service->Release();
|
||||
delete entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PR_CExitMonitor(this);
|
||||
return err;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsServiceManagerImpl::ReleaseService(const nsCID& aClass, nsISupports* service,
|
||||
nsIShutdownListener* shutdownListener)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
PR_CEnterMonitor(this);
|
||||
|
||||
nsIDKey key(aClass);
|
||||
nsServiceEntry* entry = (nsServiceEntry*)mServices->Get(&key);
|
||||
|
||||
NS_ASSERTION(entry, "service not found");
|
||||
NS_ASSERTION(entry->mService == service, "service looked failed");
|
||||
|
||||
if (entry) {
|
||||
err = entry->RemoveListener(shutdownListener);
|
||||
nsrefcnt cnt = service->Release();
|
||||
if (err == NS_OK && cnt == 0) {
|
||||
mServices->Remove(&key);
|
||||
delete entry;
|
||||
err = nsRepository::FreeLibraries();
|
||||
}
|
||||
}
|
||||
|
||||
PR_CExitMonitor(this);
|
||||
return err;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsServiceManagerImpl::ShutdownService(const nsCID& aClass)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
PR_CEnterMonitor(this);
|
||||
|
||||
nsIDKey key(aClass);
|
||||
nsServiceEntry* entry = (nsServiceEntry*)mServices->Get(&key);
|
||||
|
||||
if (entry == NULL) {
|
||||
err = NS_ERROR_SERVICE_NOT_FOUND;
|
||||
}
|
||||
else {
|
||||
err = entry->NotifyListeners(); // break the cycles
|
||||
entry->mShuttingDown = PR_TRUE;
|
||||
nsrefcnt cnt = entry->mService->Release(); // AddRef in GetService
|
||||
if (err == NS_OK && cnt == 0) {
|
||||
mServices->Remove(&key);
|
||||
delete entry;
|
||||
err = nsRepository::FreeLibraries();
|
||||
}
|
||||
else
|
||||
err = NS_ERROR_SERVICE_IN_USE;
|
||||
}
|
||||
|
||||
PR_CExitMonitor(this);
|
||||
return err;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Global service manager interface (see nsIServiceManager.h)
|
||||
|
||||
nsIServiceManager* nsServiceManager::globalServiceManager = NULL;
|
||||
|
||||
nsresult
|
||||
nsServiceManager::GetGlobalServiceManager(nsIServiceManager* *result)
|
||||
{
|
||||
if (globalServiceManager == NULL) {
|
||||
globalServiceManager = new nsServiceManagerImpl();
|
||||
if (globalServiceManager == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
globalServiceManager->AddRef();
|
||||
}
|
||||
*result = globalServiceManager;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsServiceManager::GetService(const nsCID& aClass, const nsIID& aIID,
|
||||
nsISupports* *result,
|
||||
nsIShutdownListener* shutdownListener)
|
||||
{
|
||||
nsIServiceManager* mgr;
|
||||
nsresult rslt = GetGlobalServiceManager(&mgr);
|
||||
if (rslt != NS_OK) return rslt;
|
||||
return mgr->GetService(aClass, aIID, result, shutdownListener);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsServiceManager::ReleaseService(const nsCID& aClass, nsISupports* service,
|
||||
nsIShutdownListener* shutdownListener)
|
||||
{
|
||||
nsIServiceManager* mgr;
|
||||
nsresult rslt = GetGlobalServiceManager(&mgr);
|
||||
if (rslt != NS_OK) return rslt;
|
||||
return mgr->ReleaseService(aClass, service, shutdownListener);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsServiceManager::ShutdownService(const nsCID& aClass)
|
||||
{
|
||||
nsIServiceManager* mgr;
|
||||
nsresult rslt = GetGlobalServiceManager(&mgr);
|
||||
if (rslt != NS_OK) return rslt;
|
||||
return mgr->ShutdownService(aClass);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
153
mozilla/xpcom/components/nsXPComFactory.h
Normal file
153
mozilla/xpcom/components/nsXPComFactory.h
Normal file
@@ -0,0 +1,153 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsXPComFactory_h__
|
||||
#define nsXPComFactory_h__
|
||||
|
||||
#include "nsIFactory.h"
|
||||
|
||||
/*
|
||||
* This file contains a templatized implementation of a simple XPCOM factory.
|
||||
*
|
||||
* To implement a factory for a given component, just provide a function
|
||||
* like the one below which can be called by your DLL's NSGetFactory(...)
|
||||
* entry point...
|
||||
*
|
||||
* nsresult NS_New_SomeComponent_Factory(nsIFactory** aResult)
|
||||
* {
|
||||
* nsresult rv = NS_OK;
|
||||
* nsIFactory* inst = new nsFactory<SomeComponent>();
|
||||
* if (NULL == inst) {
|
||||
* rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
* } else {
|
||||
* NS_ADDREF(inst);
|
||||
* }
|
||||
* *aResult = inst;
|
||||
* return rv;
|
||||
* }
|
||||
*
|
||||
* NOTE:
|
||||
* ----
|
||||
* The factories created by this template are not thread-safe and do not
|
||||
* support aggregation.
|
||||
*
|
||||
*/
|
||||
template <class T> class nsFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
nsFactory() { NS_INIT_REFCNT(); }
|
||||
|
||||
//
|
||||
// nsISupports interface...
|
||||
//
|
||||
// These implementations were copied from the NS_IMPL_ISUPPORTS macro
|
||||
// in nsISupports.h
|
||||
//
|
||||
NS_IMETHOD_(nsrefcnt) AddRef (void)
|
||||
{
|
||||
return ++mRefCnt;
|
||||
}
|
||||
|
||||
NS_IMETHOD_(nsrefcnt) Release(void)
|
||||
{
|
||||
NS_PRECONDITION(0 != mRefCnt, "dup release");
|
||||
if (--mRefCnt == 0) {
|
||||
NS_DELETEXPCOM(this);
|
||||
return 0;
|
||||
}
|
||||
return mRefCnt;
|
||||
}
|
||||
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
if (aIID.Equals(kIFactoryIID)) {
|
||||
*aInstancePtr = (void*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
//
|
||||
// nsIFactory interface...
|
||||
//
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
T* inst;
|
||||
// Parameter validation...
|
||||
if (NULL == aResult) {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
goto done;
|
||||
}
|
||||
// Do not support aggregatable components...
|
||||
*aResult = NULL;
|
||||
if (NULL != aOuter) {
|
||||
rv = NS_ERROR_NO_AGGREGATION;
|
||||
goto done;
|
||||
}
|
||||
// Create a new instance of the component...
|
||||
NS_NEWXPCOM(inst, T);
|
||||
if (NULL == inst) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
// If the QI fails, the component will be destroyed...
|
||||
NS_ADDREF(inst);
|
||||
rv = inst->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(inst);
|
||||
|
||||
done:
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual ~nsFactory()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
}
|
||||
|
||||
// Reference count variable used by nsISupports...
|
||||
nsrefcnt mRefCnt;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsXPComFactory_h__ */
|
||||
184
mozilla/xpcom/components/xcDll.cpp
Normal file
184
mozilla/xpcom/components/xcDll.cpp
Normal file
@@ -0,0 +1,184 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* nsDll
|
||||
*
|
||||
* Abstraction of a Dll. Stores modifiedTime and size for easy detection of
|
||||
* change in dll.
|
||||
*
|
||||
* dp Suresh <dp@netscape.com>
|
||||
*/
|
||||
|
||||
#include "xcDll.h"
|
||||
#include "plstr.h" // strdup and strfree
|
||||
|
||||
nsDll::nsDll(const char *libFullPath) : m_fullpath(NULL), m_instance(NULL),
|
||||
m_status(DLL_OK)
|
||||
{
|
||||
m_lastModTime = LL_ZERO;
|
||||
m_size = 0;
|
||||
|
||||
if (libFullPath == NULL)
|
||||
{
|
||||
m_status = DLL_INVALID_PARAM;
|
||||
return;
|
||||
}
|
||||
m_fullpath = PL_strdup(libFullPath);
|
||||
if (m_fullpath == NULL)
|
||||
{
|
||||
// No more memory
|
||||
m_status = DLL_NO_MEM;
|
||||
return;
|
||||
}
|
||||
|
||||
PRFileInfo statinfo;
|
||||
if (PR_GetFileInfo(m_fullpath, &statinfo) != PR_SUCCESS)
|
||||
{
|
||||
// The stat things works only if people pass in the full pathname.
|
||||
// Even if our stat fails, we could be able to load it because of
|
||||
// LD_LIBRARY_PATH and other such paths where dlls are searched for
|
||||
|
||||
// XXX we need a way of marking this occurance.
|
||||
// XXX m_status = DLL_STAT_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_size = statinfo.size;
|
||||
m_lastModTime = statinfo.modifyTime;
|
||||
if (statinfo.type != PR_FILE_FILE)
|
||||
{
|
||||
// Not a file. Cant work with it.
|
||||
m_status = DLL_NOT_FILE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_status = DLL_OK;
|
||||
}
|
||||
|
||||
|
||||
nsDll::nsDll(const char *libFullPath, PRTime lastModTime, PRUint32 fileSize)
|
||||
: m_fullpath(NULL), m_instance(NULL), m_status(DLL_OK)
|
||||
{
|
||||
m_lastModTime = lastModTime;
|
||||
m_size = fileSize;
|
||||
|
||||
if (libFullPath == NULL)
|
||||
{
|
||||
m_status = DLL_INVALID_PARAM;
|
||||
return;
|
||||
}
|
||||
m_fullpath = PL_strdup(libFullPath);
|
||||
if (m_fullpath == NULL)
|
||||
{
|
||||
// No more memory
|
||||
m_status = DLL_NO_MEM;
|
||||
return;
|
||||
}
|
||||
|
||||
m_status = DLL_OK;
|
||||
}
|
||||
|
||||
nsDll::~nsDll(void)
|
||||
{
|
||||
if (m_instance != NULL)
|
||||
Unload();
|
||||
if (m_fullpath != NULL) PL_strfree(m_fullpath);
|
||||
m_fullpath = NULL;
|
||||
}
|
||||
|
||||
|
||||
PRBool nsDll::Load(void)
|
||||
{
|
||||
// Of course, this is all buggy, because it uses paths instead of nsFileSpec.
|
||||
// Also, instead of writing yet another converter for path separators, for
|
||||
// pete's sake use the converters in nsFileSpec.h. Thank you.
|
||||
#ifdef XP_MAC
|
||||
char *macFileName = NULL;
|
||||
int loop;
|
||||
#endif
|
||||
|
||||
if (m_status != DLL_OK)
|
||||
{
|
||||
return (PR_FALSE);
|
||||
}
|
||||
if (m_instance != NULL)
|
||||
{
|
||||
// Already loaded
|
||||
return (PR_TRUE);
|
||||
}
|
||||
#ifdef XP_MAC
|
||||
// err = ConvertUnixPathToMacPath(m_fullpath, &macFileName);
|
||||
if ((macFileName = PL_strdup(m_fullpath)) != NULL)
|
||||
{
|
||||
if (macFileName[0] == '/')
|
||||
{
|
||||
for (loop=0; loop<PL_strlen(macFileName); loop++)
|
||||
{
|
||||
if (macFileName[loop] == '/') macFileName[loop] = ':';
|
||||
}
|
||||
m_instance = PR_LoadLibrary(&macFileName[1]); // skip over initial slash
|
||||
}
|
||||
else
|
||||
{
|
||||
m_instance = PR_LoadLibrary(macFileName);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef XP_UNIX
|
||||
// On linux we seem to load multiple copies of the same dll but with different path
|
||||
// like libraptorhtml.so and ./libraptorhtml.so
|
||||
// Until this get fixed right, for now for ./libraptorhtml.so remove the "./"
|
||||
if (m_fullpath[0] == '.' && m_fullpath[1] == '/')
|
||||
m_instance = PR_LoadLibrary( &(m_fullpath[2]) );
|
||||
else
|
||||
#endif /* XP_UNIX */
|
||||
{
|
||||
// This is the only right way of doing this...
|
||||
m_instance = PR_LoadLibrary(m_fullpath);
|
||||
}
|
||||
#endif /* XP_MAC */
|
||||
return ((m_instance == NULL) ? PR_FALSE : PR_TRUE);
|
||||
|
||||
}
|
||||
|
||||
PRBool nsDll::Unload(void)
|
||||
{
|
||||
if (m_status != DLL_OK || m_instance == NULL)
|
||||
return (PR_FALSE);
|
||||
PRStatus ret = PR_UnloadLibrary(m_instance);
|
||||
if (ret == PR_SUCCESS)
|
||||
{
|
||||
m_instance = NULL;
|
||||
return (PR_TRUE);
|
||||
}
|
||||
else
|
||||
return (PR_FALSE);
|
||||
}
|
||||
|
||||
void * nsDll::FindSymbol(const char *symbol)
|
||||
{
|
||||
if (symbol == NULL)
|
||||
return (NULL);
|
||||
|
||||
// If not already loaded, load it now.
|
||||
if (Load() != PR_TRUE)
|
||||
return (NULL);
|
||||
|
||||
return (PR_FindSymbol(m_instance, symbol));
|
||||
}
|
||||
71
mozilla/xpcom/components/xcDll.h
Normal file
71
mozilla/xpcom/components/xcDll.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* Dll
|
||||
*
|
||||
* Programmatic representation of a dll. Stores modifiedTime and size for
|
||||
* easy detection of change in dll.
|
||||
*
|
||||
* dp Suresh <dp@netscape.com>
|
||||
*/
|
||||
|
||||
#include "prio.h"
|
||||
#include "prlink.h"
|
||||
|
||||
typedef enum nsDllStatus
|
||||
{
|
||||
DLL_OK = 0,
|
||||
DLL_NO_MEM = 1,
|
||||
DLL_STAT_ERROR = 2,
|
||||
DLL_NOT_FILE = 3,
|
||||
DLL_INVALID_PARAM = 4
|
||||
} nsDllStatus;
|
||||
|
||||
class nsDll
|
||||
{
|
||||
private:
|
||||
char *m_fullpath; // system format full filename of dll
|
||||
PRTime m_lastModTime; // last modified time
|
||||
PRUint32 m_size; // size of the dynamic library
|
||||
PRLibrary *m_instance; // Load instance
|
||||
nsDllStatus m_status; // holds current status
|
||||
|
||||
public:
|
||||
|
||||
nsDll(const char *libFullPath);
|
||||
nsDll(const char *libFullPath, PRTime lastModTime, PRUint32 fileSize);
|
||||
|
||||
~nsDll(void);
|
||||
|
||||
// Status checking on operations completed
|
||||
nsDllStatus GetStatus(void) { return (m_status); }
|
||||
|
||||
// Dll Loading
|
||||
PRBool Load(void);
|
||||
PRBool Unload(void);
|
||||
PRBool IsLoaded(void)
|
||||
{
|
||||
return ((m_instance != 0) ? PR_TRUE : PR_FALSE);
|
||||
}
|
||||
void *FindSymbol(const char *symbol);
|
||||
|
||||
const char *GetFullPath(void) { return (m_fullpath); }
|
||||
PRTime GetLastModifiedTime(void) { return(m_lastModTime); }
|
||||
PRUint32 GetSize(void) { return(m_size); }
|
||||
PRLibrary *GetInstance(void) { return (m_instance); }
|
||||
};
|
||||
87
mozilla/xpcom/components/xcDllStore.cpp
Normal file
87
mozilla/xpcom/components/xcDllStore.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
/* nsDllStore
|
||||
*
|
||||
* Stores dll and their accociated info in a hash keyed on the system format
|
||||
* full dll path name e.g C:\Program Files\Netscape\Program\raptor.dll
|
||||
*
|
||||
* NOTE: dll names are considered to be case sensitive.
|
||||
*/
|
||||
|
||||
#include "xcDllStore.h"
|
||||
|
||||
static PR_CALLBACK PRIntn _deleteDllInfo(PLHashEntry *he, PRIntn i, void *arg)
|
||||
{
|
||||
delete (nsDll *)he->value;
|
||||
return (HT_ENUMERATE_NEXT);
|
||||
}
|
||||
|
||||
nsDllStore::nsDllStore(void) : m_dllHashTable(NULL)
|
||||
{
|
||||
PRUint32 initSize = 128;
|
||||
|
||||
m_dllHashTable = PL_NewHashTable(initSize, PL_HashString,
|
||||
PL_CompareStrings, PL_CompareValues, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
nsDllStore::~nsDllStore(void)
|
||||
{
|
||||
if (m_dllHashTable)
|
||||
{
|
||||
// Delete each of the nsDll stored before deleting the Hash Table
|
||||
PL_HashTableEnumerateEntries(m_dllHashTable, _deleteDllInfo, NULL);
|
||||
PL_HashTableDestroy(m_dllHashTable);
|
||||
}
|
||||
m_dllHashTable = NULL;
|
||||
}
|
||||
|
||||
|
||||
nsDll* nsDllStore::Get(const char *dll)
|
||||
{
|
||||
nsDll *dllInfo = NULL;
|
||||
if (m_dllHashTable)
|
||||
{
|
||||
dllInfo = (nsDll *)PL_HashTableLookup(m_dllHashTable, dll);
|
||||
}
|
||||
return (dllInfo);
|
||||
}
|
||||
|
||||
|
||||
nsDll* nsDllStore::Remove(const char *dll)
|
||||
{
|
||||
if (m_dllHashTable == NULL)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
nsDll *dllInfo = Get(dll);
|
||||
PL_HashTableRemove(m_dllHashTable, dll);
|
||||
return (dllInfo);
|
||||
}
|
||||
|
||||
PRBool nsDllStore::Put(const char *dll, nsDll *dllInfo)
|
||||
{
|
||||
if (m_dllHashTable == NULL)
|
||||
return(PR_FALSE);
|
||||
|
||||
PLHashEntry *entry =
|
||||
PL_HashTableAdd(m_dllHashTable, (void *)dll, (void *)dllInfo);
|
||||
return ((entry != NULL) ? PR_TRUE : PR_FALSE);
|
||||
}
|
||||
49
mozilla/xpcom/components/xcDllStore.h
Normal file
49
mozilla/xpcom/components/xcDllStore.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
/* nsDllStore
|
||||
*
|
||||
* Stores dll and their accociated info in a hash keyed on the system format
|
||||
* full dll path name e.g C:\Program Files\Netscape\Program\raptor.dll
|
||||
*
|
||||
* NOTE: dll names are considered to be case sensitive.
|
||||
*/
|
||||
|
||||
#include "plhash.h"
|
||||
#include "xcDll.h"
|
||||
|
||||
class nsDllStore
|
||||
{
|
||||
private:
|
||||
PLHashTable *m_dllHashTable;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
nsDllStore(void);
|
||||
~nsDllStore(void);
|
||||
|
||||
// Caller is not expected to delete nsDll returned
|
||||
// The nsDll returned in NOT removed from the hash
|
||||
nsDll* Get(const char *filename);
|
||||
PRBool Put(const char *filename, nsDll *dllInfo);
|
||||
|
||||
// The nsDll returned is removed from the hash
|
||||
// Caller is expected to delete the returned nsDll
|
||||
nsDll* Remove(const char *filename);
|
||||
};
|
||||
117
mozilla/xpcom/doc/ObjectModel.html
Normal file
117
mozilla/xpcom/doc/ObjectModel.html
Normal file
@@ -0,0 +1,117 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<META NAME="Author" CONTENT="Kipp E.B. Hickman">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (WinNT; I) [Netscape]">
|
||||
<TITLE>Gemini Object Model</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<H1>
|
||||
Gemini Object Model</H1>
|
||||
The gemini object model is a cross platform component object model modelled
|
||||
after win32's IUnknown and COM. We do not support a C API to gemini at
|
||||
this time.
|
||||
<H2>
|
||||
nsID</H2>
|
||||
Like OSF's DCE, we use an "interface id" which is a unique identifer which
|
||||
names the interface. The nsID and be used as a key into a cross platform
|
||||
registry service to discover an implementation of an interface. Here is
|
||||
the declaration of nsID:
|
||||
<UL><TT>struct nsID {</TT>
|
||||
<BR><TT> PRUint32 m0;</TT>
|
||||
<BR><TT> PRUint16 m1, m2;</TT>
|
||||
<BR><TT> PRUint8 m3[8];</TT>
|
||||
|
||||
<P><TT> inline nsbool Equals(const nsID& other) const {</TT>
|
||||
<BR><TT> return</TT>
|
||||
<BR><TT> (((PRUint32*) &m0)[0] == ((PRUint32*)
|
||||
&other.m0)[0]) &&</TT>
|
||||
<BR><TT> (((PRUint32*) &m0)[1] == ((PRUint32*)
|
||||
&other.m0)[1]) &&</TT>
|
||||
<BR><TT> (((PRUint32*) &m0)[2] == ((PRUint32*)
|
||||
&other.m0)[2]) &&</TT>
|
||||
<BR><TT> (((PRUint32*) &m0)[3] == ((PRUint32*)
|
||||
&other.m0)[3]);</TT>
|
||||
<BR><TT> }</TT>
|
||||
<BR><TT>};</TT></UL>
|
||||
On windows, the "uuidgen" program (provided with Visual C++) can be used
|
||||
to generate these identifiers.
|
||||
<H2>
|
||||
nsISupports</H2>
|
||||
This is the base class for all component objects. Not all objects are component
|
||||
objects; these rules apply to objects which expose an interface which is
|
||||
shared across dll/exe boundaries. Here is nsISupports:
|
||||
<UL><TT>typedef nsID nsIID;</TT>
|
||||
<BR><TT>class nsISupports {</TT>
|
||||
<BR><TT>public:</TT>
|
||||
<BR><TT> virtual nsqresult QueryInterface(const nsIID& aIID,</TT>
|
||||
<BR><TT>
|
||||
void** aInstancePtr) = 0;</TT>
|
||||
<BR><TT> virtual nsrefcnt AddRef() = 0;</TT>
|
||||
<BR><TT> virtual nsrefcnt Release() = 0;</TT>
|
||||
<BR><TT>};</TT></UL>
|
||||
The semantics of this interface are identical to win32's "COM" IUnknown
|
||||
interface. In addition, the types are carefully mapped and the names are
|
||||
the same so that if necessary we can "flip a switch" and have the windows
|
||||
version (or any other platform that embraces COM) use the native COM IUnknown
|
||||
without source code modification.
|
||||
<H2>
|
||||
Factory Procedures</H2>
|
||||
Factory procedures use this design pattern
|
||||
<UL><TT>nsqresult NS_NewFoo(nsIFoo** aInstancePtr, nsISupports* aOuter,
|
||||
...);</TT></UL>
|
||||
The return value is a status value (see nsISupports.h for the legal return
|
||||
values); the first argument is a pointer to a cell which will hold the
|
||||
new instance pointer if the factory procedure succeeds. The second argument
|
||||
is a pointer to a containing component object that wishes to aggregate
|
||||
in the Foo object. This pointer will be null if no aggregation is requested.
|
||||
If the factory procedure cannot support aggregation of the Foo type then
|
||||
it fails and returns an error if aggregation is requested.
|
||||
|
||||
<P>The following symbols are defined for standard error return values from
|
||||
<TT>QueryInterface</TT> and from factory procedures:
|
||||
<UL><TT>#define NS_FAILED(_nsresult) ((_nsresult) < 0)</TT>
|
||||
<BR><TT>#define NS_SUCCEEDED(_nsresult) ((_nsresult) >= 0)</TT>
|
||||
|
||||
<P><TT>// Standard "it worked" return value</TT>
|
||||
<BR><TT>#define NS_OK 0</TT>
|
||||
|
||||
<P><TT>// Some standard error codes we use</TT>
|
||||
<BR><TT>#define NS_ERROR_BASE ((nsresult) 0xC1F30000)</TT>
|
||||
<BR><TT>#define NS_ERROR_OUT_OF_MEMORY (NS_ERROR_BASE + 0)</TT>
|
||||
<BR><TT>#define NS_ERROR_NO_AGGREGATION (NS_ERROR_BASE + 1)</TT>
|
||||
<BR><TT>#define NS_NOINTERFACE ((nqresult) 0x80004002L)</TT></UL>
|
||||
|
||||
<H2>
|
||||
nsIFactory</H2>
|
||||
Factory classes should eventually replace factory procedures for major
|
||||
classes. They provide an easy mechanism for placing code in DLLs. The nsIFactory
|
||||
class is as follows:
|
||||
<BR>
|
||||
<UL><TT>class nsIFactory: public nsISupports {</TT>
|
||||
<BR><TT>public:</TT>
|
||||
<UL><TT>virtual nsresult CreateInstance(const nsIID &aIID,</TT>
|
||||
<BR><TT>
|
||||
nsISupports *aOuter,</TT>
|
||||
<BR><TT>
|
||||
void **aResult) = 0;</TT>
|
||||
<BR><TT>virtual void LockFactory(PRBool aLock) = 0;</TT></UL>
|
||||
<TT>};</TT></UL>
|
||||
This interface is again identical to the COM version. More on registering
|
||||
factories shortly.
|
||||
<H2>
|
||||
Error Handling</H2>
|
||||
Because no exceptions are returned, error handling is done in the traditional
|
||||
"error status value" method.
|
||||
<H2>
|
||||
Cross Platform Registry</H2>
|
||||
A cross platform registry was written for the SmartUpdate feature of Communicator.
|
||||
We will investigate it's usefulness for our purposes.
|
||||
<H2>
|
||||
Library Management</H2>
|
||||
NSPR 2.x provides the cross platform mechanism for loading and unloading
|
||||
libraries, and run time linking.
|
||||
<BR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
93
mozilla/xpcom/doc/c++tips.html
Normal file
93
mozilla/xpcom/doc/c++tips.html
Normal file
@@ -0,0 +1,93 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<META NAME="Author" CONTENT="Kipp E.B. Hickman">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (WinNT; U) [Netscape]">
|
||||
<TITLE>C++ Tips</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<H1>
|
||||
C++ Tips</H1>
|
||||
This is a compilation of tips on how to write cross-platform C++ code that
|
||||
compiles everywhere.
|
||||
<H2>
|
||||
General</H2>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
Always use the nspr types for intrinsic integer types. The only exception
|
||||
to this rule is when writing machine dependent code that is called from
|
||||
xp code. In this case you will probably need to bridge the type systems
|
||||
and cast from an nspr type to a native type. The other exception is floating
|
||||
point; nspr defines PRFloat as a double (!).</LI>
|
||||
|
||||
<LI>
|
||||
Exceptions do not work everywhere so don't use them anywhere except in
|
||||
machine specific code, and then if you do use them in machine specific
|
||||
code you must catch all exceptions there because you can't throw the exception
|
||||
across xp code.</LI>
|
||||
|
||||
<LI>
|
||||
Templates do not work everywhere so don't use them anywhere.</LI>
|
||||
|
||||
<LI>
|
||||
Do not wrap include statements with an #ifdef. The reason is that when
|
||||
the symbol is not defined, other compiler symbols will not be defined and
|
||||
it will be hard to test the code on all platforms. An example of what <B>not</B>
|
||||
to do:</LI>
|
||||
|
||||
<BR>
|
||||
<UL><TT>#ifdef X</TT>
|
||||
<BR><TT>#include "foo.h"</TT>
|
||||
<BR><TT>#endif</TT>
|
||||
<BR><TT></TT> </UL>
|
||||
|
||||
<LI>
|
||||
For types that do not need operator= or a copy constructor, declare them
|
||||
yourselves and make them private. Example:</LI>
|
||||
|
||||
<BR>
|
||||
<UL><TT>class foo {</TT>
|
||||
<BR><TT>...</TT>
|
||||
<BR><TT>private:</TT>
|
||||
<BR><TT> // These are not supported and are not implemented!</TT>
|
||||
<BR><TT> foo(const foo& x);</TT>
|
||||
<BR><TT> foo& operator=(const foo& x);</TT>
|
||||
<BR><TT>};</TT></UL>
|
||||
|
||||
<LI>
|
||||
</LI>
|
||||
</UL>
|
||||
|
||||
<H2>
|
||||
Windows Compatability</H2>
|
||||
|
||||
<H2>
|
||||
Metroworks Compatability</H2>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
MAC compilers do not handle #include path names in the same manner as other
|
||||
systems. Consequently #include statements should not contain path names,
|
||||
just simple file names. An example of what <B>not</B> to do:</LI>
|
||||
|
||||
<BR>
|
||||
<UL>#include "gemini/nsICSSParser.h"
|
||||
<BR> </UL>
|
||||
|
||||
<LI>
|
||||
</LI>
|
||||
</UL>
|
||||
|
||||
<H2>
|
||||
G++ Compatability</H2>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
Use void in argument lists for functions that have no arguments (this works
|
||||
around a bug in g++ 2.6.3)</LI>
|
||||
</UL>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
175
mozilla/xpcom/ds/nsHashtable.cpp
Normal file
175
mozilla/xpcom/ds/nsHashtable.cpp
Normal file
@@ -0,0 +1,175 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "prmem.h"
|
||||
#include "nsHashtable.h"
|
||||
|
||||
//
|
||||
// Key operations
|
||||
//
|
||||
|
||||
static PR_CALLBACK PLHashNumber _hashValue(const void *key)
|
||||
{
|
||||
return ((const nsHashKey *) key)->HashValue();
|
||||
}
|
||||
|
||||
static PR_CALLBACK PRIntn _hashKeyCompare(const void *key1, const void *key2) {
|
||||
return ((const nsHashKey *) key1)->Equals((const nsHashKey *) key2);
|
||||
}
|
||||
|
||||
static PR_CALLBACK PRIntn _hashValueCompare(const void *value1,
|
||||
const void *value2) {
|
||||
// We're not going to make any assumptions about value equality
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Memory callbacks
|
||||
//
|
||||
|
||||
static PR_CALLBACK void *_hashAllocTable(void *pool, PRSize size) {
|
||||
return PR_MALLOC(size);
|
||||
}
|
||||
|
||||
static PR_CALLBACK void _hashFreeTable(void *pool, void *item) {
|
||||
PR_DELETE(item);
|
||||
}
|
||||
|
||||
static PR_CALLBACK PLHashEntry *_hashAllocEntry(void *pool, const void *key) {
|
||||
return PR_NEW(PLHashEntry);
|
||||
}
|
||||
|
||||
static PR_CALLBACK void _hashFreeEntry(void *pool, PLHashEntry *entry,
|
||||
PRUintn flag) {
|
||||
if (flag == HT_FREE_ENTRY) {
|
||||
delete (nsHashKey *) (entry->key);
|
||||
PR_DELETE(entry);
|
||||
}
|
||||
}
|
||||
|
||||
static PLHashAllocOps _hashAllocOps = {
|
||||
_hashAllocTable, _hashFreeTable,
|
||||
_hashAllocEntry, _hashFreeEntry
|
||||
};
|
||||
|
||||
//
|
||||
// Enumerator callback
|
||||
//
|
||||
|
||||
struct _HashEnumerateArgs {
|
||||
nsHashtableEnumFunc fn;
|
||||
void* arg;
|
||||
};
|
||||
|
||||
static PR_CALLBACK PRIntn _hashEnumerate(PLHashEntry *he, PRIntn i, void *arg)
|
||||
{
|
||||
_HashEnumerateArgs* thunk = (_HashEnumerateArgs*)arg;
|
||||
return thunk->fn((nsHashKey *) he->key, he->value, thunk->arg)
|
||||
? HT_ENUMERATE_NEXT
|
||||
: HT_ENUMERATE_STOP;
|
||||
}
|
||||
|
||||
//
|
||||
// HashKey
|
||||
//
|
||||
nsHashKey::nsHashKey(void)
|
||||
{
|
||||
}
|
||||
|
||||
nsHashKey::~nsHashKey(void)
|
||||
{
|
||||
}
|
||||
|
||||
nsHashtable::nsHashtable(PRUint32 aInitSize) {
|
||||
hashtable = PL_NewHashTable(aInitSize,
|
||||
_hashValue,
|
||||
_hashKeyCompare,
|
||||
_hashValueCompare,
|
||||
&_hashAllocOps,
|
||||
NULL);
|
||||
}
|
||||
|
||||
nsHashtable::~nsHashtable() {
|
||||
PL_HashTableDestroy(hashtable);
|
||||
}
|
||||
|
||||
void *nsHashtable::Put(nsHashKey *aKey, void *aData) {
|
||||
void *res = NULL;
|
||||
PLHashNumber hash = aKey->HashValue();
|
||||
PLHashEntry *he;
|
||||
PLHashEntry **hep = PL_HashTableRawLookup(hashtable, hash, (void *) aKey);
|
||||
|
||||
if ((he = *hep) != NULL) {
|
||||
res = he->value;
|
||||
he->value = aData;
|
||||
} else {
|
||||
PL_HashTableRawAdd(hashtable, hep, hash,
|
||||
(void *) aKey->Clone(), aData);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void *nsHashtable::Get(nsHashKey *aKey) {
|
||||
return PL_HashTableLookup(hashtable, (void *) aKey);
|
||||
}
|
||||
|
||||
void *nsHashtable::Remove(nsHashKey *aKey) {
|
||||
PLHashNumber hash = aKey->HashValue();
|
||||
PLHashEntry *he;
|
||||
PLHashEntry **hep = PL_HashTableRawLookup(hashtable, hash, (void *) aKey);
|
||||
void *res = NULL;
|
||||
|
||||
if ((he = *hep) != NULL) {
|
||||
res = he->value;
|
||||
PL_HashTableRawRemove(hashtable, hep, he);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static PR_CALLBACK PRIntn _hashEnumerateCopy(PLHashEntry *he, PRIntn i, void *arg)
|
||||
{
|
||||
nsHashtable *newHashtable = (nsHashtable *)arg;
|
||||
newHashtable->Put((nsHashKey *) he->key, he->value);
|
||||
return HT_ENUMERATE_NEXT;
|
||||
}
|
||||
|
||||
nsHashtable * nsHashtable::Clone() {
|
||||
nsHashtable *newHashTable = new nsHashtable(hashtable->nentries);
|
||||
|
||||
PL_HashTableEnumerateEntries(hashtable, _hashEnumerateCopy, newHashTable);
|
||||
return newHashTable;
|
||||
}
|
||||
|
||||
void nsHashtable::Enumerate(nsHashtableEnumFunc aEnumFunc, void* closure) {
|
||||
_HashEnumerateArgs thunk;
|
||||
thunk.fn = aEnumFunc;
|
||||
thunk.arg = closure;
|
||||
PL_HashTableEnumerateEntries(hashtable, _hashEnumerate, &thunk);
|
||||
}
|
||||
|
||||
static PR_CALLBACK PRIntn _hashEnumerateRemove(PLHashEntry *he, PRIntn i, void *arg)
|
||||
{
|
||||
return HT_ENUMERATE_REMOVE;
|
||||
}
|
||||
|
||||
void nsHashtable::Reset() {
|
||||
PL_HashTableEnumerateEntries(hashtable, _hashEnumerateRemove, NULL);
|
||||
}
|
||||
|
||||
141
mozilla/xpcom/ds/nsHashtable.h
Normal file
141
mozilla/xpcom/ds/nsHashtable.h
Normal file
@@ -0,0 +1,141 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsHashtable_h__
|
||||
#define nsHashtable_h__
|
||||
|
||||
#include "plhash.h"
|
||||
#include "nsCom.h"
|
||||
|
||||
class NS_COM nsHashKey {
|
||||
protected:
|
||||
nsHashKey(void);
|
||||
public:
|
||||
virtual ~nsHashKey(void);
|
||||
virtual PRUint32 HashValue(void) const = 0;
|
||||
virtual PRBool Equals(const nsHashKey *aKey) const = 0;
|
||||
virtual nsHashKey *Clone(void) const = 0;
|
||||
};
|
||||
|
||||
// Enumerator callback function. Use
|
||||
|
||||
typedef PRBool (*nsHashtableEnumFunc)(nsHashKey *aKey, void *aData, void* closure);
|
||||
|
||||
class NS_COM nsHashtable {
|
||||
private:
|
||||
// members
|
||||
PLHashTable *hashtable;
|
||||
|
||||
public:
|
||||
nsHashtable(PRUint32 aSize = 256);
|
||||
~nsHashtable();
|
||||
|
||||
PRInt32 Count(void) { return hashtable->nentries; }
|
||||
void *Put(nsHashKey *aKey, void *aData);
|
||||
void *Get(nsHashKey *aKey);
|
||||
void *Remove(nsHashKey *aKey);
|
||||
nsHashtable *Clone();
|
||||
void Enumerate(nsHashtableEnumFunc aEnumFunc, void* closure = NULL);
|
||||
void Reset();
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupportsKey: Where keys are nsISupports objects that get refcounted.
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsISupportsKey : public nsHashKey {
|
||||
private:
|
||||
nsISupports* mKey;
|
||||
|
||||
public:
|
||||
nsISupportsKey(nsISupports* key) {
|
||||
mKey = key;
|
||||
NS_IF_ADDREF(mKey);
|
||||
}
|
||||
|
||||
~nsISupportsKey(void) {
|
||||
NS_IF_RELEASE(mKey);
|
||||
}
|
||||
|
||||
PRUint32 HashValue(void) const {
|
||||
return (PRUint32)mKey;
|
||||
}
|
||||
|
||||
PRBool Equals(const nsHashKey *aKey) const {
|
||||
return (mKey == ((nsISupportsKey *) aKey)->mKey);
|
||||
}
|
||||
|
||||
nsHashKey *Clone(void) const {
|
||||
return new nsISupportsKey(mKey);
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsVoidKey: Where keys are void* objects that don't get refcounted.
|
||||
|
||||
class nsVoidKey : public nsHashKey {
|
||||
private:
|
||||
const void* mKey;
|
||||
|
||||
public:
|
||||
nsVoidKey(const void* key) {
|
||||
mKey = key;
|
||||
}
|
||||
|
||||
PRUint32 HashValue(void) const {
|
||||
return (PRUint32)mKey;
|
||||
}
|
||||
|
||||
PRBool Equals(const nsHashKey *aKey) const {
|
||||
return (mKey == ((const nsVoidKey *) aKey)->mKey);
|
||||
}
|
||||
|
||||
nsHashKey *Clone(void) const {
|
||||
return new nsVoidKey(mKey);
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIDKey: Where keys are nsIDs (e.g. nsIID, nsCID).
|
||||
|
||||
#include "nsID.h"
|
||||
|
||||
class nsIDKey : public nsHashKey {
|
||||
private:
|
||||
nsID mID;
|
||||
|
||||
public:
|
||||
nsIDKey(const nsID &aID) {
|
||||
mID = aID;
|
||||
}
|
||||
|
||||
PRUint32 HashValue(void) const {
|
||||
return mID.m0;
|
||||
}
|
||||
|
||||
PRBool Equals(const nsHashKey *aKey) const {
|
||||
return (mID.Equals(((const nsIDKey *) aKey)->mID));
|
||||
}
|
||||
|
||||
nsHashKey *Clone(void) const {
|
||||
return new nsIDKey(mID);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
61
mozilla/xpcom/ds/nsICollection.h
Normal file
61
mozilla/xpcom/ds/nsICollection.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specifzic language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef nsICollection_h___
|
||||
#define nsICollection_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// IID for the nsICollection interface
|
||||
#define NS_ICOLLECTION_IID \
|
||||
{ 0xaeca730, 0x835b, 0x11d2, \
|
||||
{ 0x8f, 0x30, 0x0, 0x60, 0x8, 0x31, 0x1, 0x94 } }
|
||||
|
||||
|
||||
// IID for the nsICollection Factort interface
|
||||
#define NS_ICOLLECTIONFACTORY_IID \
|
||||
{ 0xf8052641, 0x8768, 0x11d2, \
|
||||
{ 0x8f, 0x39, 0x0, 0x60, 0x8, 0x31, 0x1, 0x94 } }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/** nsICollection Interface
|
||||
* this may be ordered or not. a list or array, the implementation is opaque
|
||||
*/
|
||||
class nsICollection : public nsISupports {
|
||||
public:
|
||||
|
||||
static const nsIID& IID() { static nsIID iid = NS_ICOLLECTION_IID; return iid; }
|
||||
|
||||
/** AddItem will take an ISupports and keep track of it
|
||||
* @param aItem is the Item to be added WILL BE ADDREFFED
|
||||
*/
|
||||
virtual nsresult AddItem(nsISupports *aItem)=0;
|
||||
|
||||
/** RemoveItem will take an nsISupports and remove it from the collection
|
||||
* @param aItem is the item to be removed WILL BE RELEASED
|
||||
*/
|
||||
virtual nsresult RemoveItem(nsISupports *aItem)=0;
|
||||
|
||||
/** Clear will clear all items from list
|
||||
*/
|
||||
virtual nsresult Clear()=0;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsICollection_h___ */
|
||||
|
||||
65
mozilla/xpcom/ds/nsIEnumerator.h
Normal file
65
mozilla/xpcom/ds/nsIEnumerator.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIEnumerator_h___
|
||||
#define nsIEnumerator_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// {646F4FB0-B1F2-11d1-AA29-000000000000}
|
||||
#define NS_IENUMERATOR_IID \
|
||||
{0x646f4fb0, 0xb1f2, 0x11d1, \
|
||||
{ 0xaa, 0x29, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
|
||||
class nsIEnumerator : public nsISupports {
|
||||
public:
|
||||
|
||||
static const nsIID& IID() { static nsIID iid = NS_IENUMERATOR_IID; return iid; }
|
||||
|
||||
/** First will reset the list. will return NS_FAILED if no items
|
||||
*/
|
||||
NS_IMETHOD First()=0;
|
||||
|
||||
/** Last will reset the list to the end. will return NS_FAILED if no items
|
||||
*/
|
||||
NS_IMETHOD Last()=0;
|
||||
|
||||
/** Next will advance the list. will return failed if allready at end
|
||||
*/
|
||||
NS_IMETHOD Next()=0;
|
||||
|
||||
/** Prev will decrement the list. will return failed if allready at beginning
|
||||
*/
|
||||
NS_IMETHOD Prev()=0;
|
||||
|
||||
/** CurrentItem will return the CurrentItem item it will fail if the list is empty
|
||||
* @param aItem return value
|
||||
*/
|
||||
NS_IMETHOD CurrentItem(nsISupports **aItem)=0;
|
||||
|
||||
/** return if the collection is at the end. that is the beginning following a call to Prev
|
||||
* and it is the end of the list following a call to next
|
||||
* @param aItem return value
|
||||
*/
|
||||
NS_IMETHOD IsDone()=0;
|
||||
|
||||
};
|
||||
|
||||
#endif // __nsIEnumerator_h
|
||||
|
||||
77
mozilla/xpcom/ds/nsISupportsArray.h
Normal file
77
mozilla/xpcom/ds/nsISupportsArray.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsISupportsArray_h___
|
||||
#define nsISupportsArray_h___
|
||||
|
||||
#include "nsCom.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// {791eafa0-b9e6-11d1-8031-006008159b5a}
|
||||
#define NS_ISUPPORTSARRAY_IID \
|
||||
{0x791eafa0, 0xb9e6, 0x11d1, \
|
||||
{0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
// Enumerator callback function. Return PR_FALSE to stop
|
||||
typedef PRBool (*nsISupportsArrayEnumFunc)(nsISupports* aElement, void *aData);
|
||||
|
||||
class nsISupportsArray : public nsISupports {
|
||||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_ISUPPORTSARRAY_IID; return iid; }
|
||||
|
||||
NS_IMETHOD_(nsISupportsArray&) operator=(const nsISupportsArray& other) = 0;
|
||||
NS_IMETHOD_(PRBool) operator==(const nsISupportsArray& other) const = 0;
|
||||
NS_IMETHOD_(PRBool) Equals(const nsISupportsArray* other) const = 0;
|
||||
|
||||
NS_IMETHOD_(PRInt32) Count(void) const = 0;
|
||||
|
||||
NS_IMETHOD_(nsISupports*) ElementAt(PRInt32 aIndex) const = 0;
|
||||
NS_IMETHOD_(nsISupports*) operator[](PRInt32 aIndex) const = 0;
|
||||
|
||||
NS_IMETHOD_(PRInt32) IndexOf(const nsISupports* aPossibleElement, PRInt32 aStartIndex = 0) const = 0;
|
||||
NS_IMETHOD_(PRInt32) LastIndexOf(const nsISupports* aPossibleElement) const = 0;
|
||||
|
||||
NS_IMETHOD_(PRBool) InsertElementAt(nsISupports* aElement, PRInt32 aIndex) = 0;
|
||||
|
||||
NS_IMETHOD_(PRBool) ReplaceElementAt(nsISupports* aElement, PRInt32 aIndex) = 0;
|
||||
|
||||
NS_IMETHOD_(PRBool) AppendElement(nsISupports* aElement) = 0;
|
||||
|
||||
NS_IMETHOD_(PRBool) RemoveElementAt(PRInt32 aIndex) = 0;
|
||||
NS_IMETHOD_(PRBool) RemoveElement(const nsISupports* aElement, PRInt32 aStartIndex = 0) = 0;
|
||||
NS_IMETHOD_(PRBool) RemoveLastElement(const nsISupports* aElement) = 0;
|
||||
|
||||
NS_IMETHOD_(PRBool) AppendElements(nsISupportsArray* aElements) = 0;
|
||||
|
||||
NS_IMETHOD_(void) Clear(void) = 0;
|
||||
|
||||
NS_IMETHOD_(void) Compact(void) = 0;
|
||||
|
||||
NS_IMETHOD_(PRBool) EnumerateForwards(nsISupportsArrayEnumFunc aFunc, void* aData) const = 0;
|
||||
NS_IMETHOD_(PRBool) EnumerateBackwards(nsISupportsArrayEnumFunc aFunc, void* aData) const = 0;
|
||||
|
||||
private:
|
||||
// Copy constructors are not allowed
|
||||
// XXX test wether this has to be here nsISupportsArray(const nsISupportsArray& other);
|
||||
};
|
||||
|
||||
extern NS_COM nsresult
|
||||
NS_NewISupportsArray(nsISupportsArray** aInstancePtrResult);
|
||||
|
||||
|
||||
#endif // nsISupportsArray_h___
|
||||
382
mozilla/xpcom/ds/nsSupportsArray.cpp
Normal file
382
mozilla/xpcom/ds/nsSupportsArray.cpp
Normal file
@@ -0,0 +1,382 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsArrayIID, NS_ISUPPORTSARRAY_IID);
|
||||
|
||||
static const PRInt32 kGrowArrayBy = 8;
|
||||
static const PRInt32 kAutoArraySize = 4;
|
||||
|
||||
class SupportsArrayImpl : public nsISupportsArray {
|
||||
public:
|
||||
SupportsArrayImpl(void);
|
||||
~SupportsArrayImpl(void);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD_(nsISupportsArray&) operator=(const nsISupportsArray& aOther);
|
||||
NS_IMETHOD_(PRBool) operator==(const nsISupportsArray& aOther) const { return Equals(&aOther); }
|
||||
NS_IMETHOD_(PRBool) Equals(const nsISupportsArray* aOther) const;
|
||||
|
||||
NS_IMETHOD_(PRInt32) Count(void) const { return mCount; }
|
||||
|
||||
NS_IMETHOD_(nsISupports*) ElementAt(PRInt32 aIndex) const;
|
||||
NS_IMETHOD_(nsISupports*) operator[](PRInt32 aIndex) const { return ElementAt(aIndex); }
|
||||
|
||||
NS_IMETHOD_(PRInt32) IndexOf(const nsISupports* aPossibleElement, PRInt32 aStartIndex = 0) const;
|
||||
NS_IMETHOD_(PRInt32) LastIndexOf(const nsISupports* aPossibleElement) const;
|
||||
|
||||
NS_IMETHOD_(PRBool) InsertElementAt(nsISupports* aElement, PRInt32 aIndex);
|
||||
|
||||
NS_IMETHOD_(PRBool) ReplaceElementAt(nsISupports* aElement, PRInt32 aIndex);
|
||||
|
||||
NS_IMETHOD_(PRBool) AppendElement(nsISupports* aElement) {
|
||||
return InsertElementAt(aElement, mCount);
|
||||
}
|
||||
|
||||
NS_IMETHOD_(PRBool) RemoveElementAt(PRInt32 aIndex);
|
||||
NS_IMETHOD_(PRBool) RemoveElement(const nsISupports* aElement, PRInt32 aStartIndex = 0);
|
||||
NS_IMETHOD_(PRBool) RemoveLastElement(const nsISupports* aElement);
|
||||
|
||||
NS_IMETHOD_(PRBool) AppendElements(nsISupportsArray* aElements);
|
||||
|
||||
NS_IMETHOD_(void) Clear(void);
|
||||
|
||||
NS_IMETHOD_(void) Compact(void);
|
||||
|
||||
NS_IMETHOD_(PRBool) EnumerateForwards(nsISupportsArrayEnumFunc aFunc, void* aData) const;
|
||||
NS_IMETHOD_(PRBool) EnumerateBackwards(nsISupportsArrayEnumFunc aFunc, void* aData) const;
|
||||
|
||||
protected:
|
||||
void DeleteArray(void);
|
||||
|
||||
nsISupports** mArray;
|
||||
PRInt32 mArraySize;
|
||||
PRInt32 mCount;
|
||||
nsISupports* mAutoArray[kAutoArraySize];
|
||||
|
||||
private:
|
||||
// Copy constructors are not allowed
|
||||
SupportsArrayImpl(const nsISupportsArray& other);
|
||||
};
|
||||
|
||||
|
||||
SupportsArrayImpl::SupportsArrayImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mArray = &(mAutoArray[0]);
|
||||
mArraySize = kAutoArraySize;
|
||||
mCount = 0;
|
||||
}
|
||||
|
||||
SupportsArrayImpl::~SupportsArrayImpl()
|
||||
{
|
||||
DeleteArray();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(SupportsArrayImpl, kISupportsArrayIID);
|
||||
|
||||
void SupportsArrayImpl::DeleteArray(void)
|
||||
{
|
||||
Clear();
|
||||
if (mArray != &(mAutoArray[0])) {
|
||||
delete[] mArray;
|
||||
mArray = &(mAutoArray[0]);
|
||||
mArraySize = kAutoArraySize;
|
||||
}
|
||||
}
|
||||
|
||||
nsISupportsArray& SupportsArrayImpl::operator=(const nsISupportsArray& aOther)
|
||||
{
|
||||
PRInt32 otherCount = aOther.Count();
|
||||
|
||||
if (otherCount > mArraySize) {
|
||||
DeleteArray();
|
||||
mArraySize = otherCount;
|
||||
mArray = new nsISupports*[mArraySize];
|
||||
}
|
||||
else {
|
||||
Clear();
|
||||
}
|
||||
mCount = otherCount;
|
||||
while (0 <= --otherCount) {
|
||||
mArray[otherCount] = aOther.ElementAt(otherCount);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
PRBool SupportsArrayImpl::Equals(const nsISupportsArray* aOther) const
|
||||
{
|
||||
if (0 != aOther) {
|
||||
const SupportsArrayImpl* other = (const SupportsArrayImpl*)aOther;
|
||||
if (mCount == other->mCount) {
|
||||
PRInt32 index = mCount;
|
||||
while (0 <= --index) {
|
||||
if (mArray[index] != other->mArray[index]) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsISupports* SupportsArrayImpl::ElementAt(PRInt32 aIndex) const
|
||||
{
|
||||
if ((0 <= aIndex) && (aIndex < mCount)) {
|
||||
nsISupports* element = mArray[aIndex];
|
||||
NS_ADDREF(element);
|
||||
return element;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRInt32 SupportsArrayImpl::IndexOf(const nsISupports* aPossibleElement, PRInt32 aStartIndex) const
|
||||
{
|
||||
if ((0 <= aStartIndex) && (aStartIndex < mCount)) {
|
||||
const nsISupports** start = (const nsISupports**)mArray; // work around goofy compiler behavior
|
||||
const nsISupports** ep = (start + aStartIndex);
|
||||
const nsISupports** end = (start + mCount);
|
||||
while (ep < end) {
|
||||
if (aPossibleElement == *ep) {
|
||||
return (ep - start);
|
||||
}
|
||||
ep++;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRInt32 SupportsArrayImpl::LastIndexOf(const nsISupports* aPossibleElement) const
|
||||
{
|
||||
if (0 < mCount) {
|
||||
const nsISupports** start = (const nsISupports**)mArray; // work around goofy compiler behavior
|
||||
const nsISupports** ep = (start + mCount);
|
||||
while (start <= --ep) {
|
||||
if (aPossibleElement == *ep) {
|
||||
return (ep - start);
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRBool SupportsArrayImpl::InsertElementAt(nsISupports* aElement, PRInt32 aIndex)
|
||||
{
|
||||
if ((0 <= aIndex) && (aIndex <= mCount)) {
|
||||
if (mArraySize < (mCount + 1)) { // need to grow the array
|
||||
mArraySize += kGrowArrayBy;
|
||||
nsISupports** oldArray = mArray;
|
||||
mArray = new nsISupports*[mArraySize];
|
||||
if (0 == mArray) { // ran out of memory
|
||||
mArray = oldArray;
|
||||
mArraySize -= kGrowArrayBy;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (0 != oldArray) { // need to move old data
|
||||
if (0 < aIndex) {
|
||||
::memcpy(mArray, oldArray, aIndex * sizeof(nsISupports*));
|
||||
}
|
||||
PRInt32 slide = (mCount - aIndex);
|
||||
if (0 < slide) {
|
||||
::memcpy(mArray + aIndex + 1, oldArray + aIndex, slide * sizeof(nsISupports*));
|
||||
}
|
||||
if (oldArray != &(mAutoArray[0])) {
|
||||
delete[] oldArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
PRInt32 slide = (mCount - aIndex);
|
||||
if (0 < slide) {
|
||||
::memmove(mArray + aIndex + 1, mArray + aIndex, slide * sizeof(nsISupports*));
|
||||
}
|
||||
}
|
||||
|
||||
mArray[aIndex] = aElement;
|
||||
NS_ADDREF(aElement);
|
||||
mCount++;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool SupportsArrayImpl::ReplaceElementAt(nsISupports* aElement, PRInt32 aIndex)
|
||||
{
|
||||
if ((0 <= aIndex) && (aIndex < mCount)) {
|
||||
NS_ADDREF(aElement); // addref first in case it's the same object!
|
||||
NS_RELEASE(mArray[aIndex]);
|
||||
mArray[aIndex] = aElement;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool SupportsArrayImpl::RemoveElementAt(PRInt32 aIndex)
|
||||
{
|
||||
if ((0 <= aIndex) && (aIndex < mCount)) {
|
||||
NS_RELEASE(mArray[aIndex]);
|
||||
mCount--;
|
||||
PRInt32 slide = (mCount - aIndex);
|
||||
if (0 < slide) {
|
||||
::memmove(mArray + aIndex, mArray + aIndex + 1,
|
||||
slide * sizeof(nsISupports*));
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool SupportsArrayImpl::RemoveElement(const nsISupports* aElement, PRInt32 aStartIndex)
|
||||
{
|
||||
if ((0 <= aStartIndex) && (aStartIndex < mCount)) {
|
||||
nsISupports** ep = mArray;
|
||||
nsISupports** end = ep + mCount;
|
||||
while (ep < end) {
|
||||
if (*ep == aElement) {
|
||||
return RemoveElementAt(PRInt32(ep - mArray));
|
||||
}
|
||||
ep++;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool SupportsArrayImpl::RemoveLastElement(const nsISupports* aElement)
|
||||
{
|
||||
if (0 < mCount) {
|
||||
nsISupports** ep = (mArray + mCount);
|
||||
while (mArray <= --ep) {
|
||||
if (*ep == aElement) {
|
||||
return RemoveElementAt(PRInt32(ep - mArray));
|
||||
}
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool SupportsArrayImpl::AppendElements(nsISupportsArray* aElements)
|
||||
{
|
||||
SupportsArrayImpl* elements = (SupportsArrayImpl*)aElements;
|
||||
|
||||
if (elements && (0 < elements->mCount)) {
|
||||
if (mArraySize < (mCount + elements->mCount)) { // need to grow the array
|
||||
PRInt32 count = mCount + elements->mCount;
|
||||
PRInt32 oldSize = mArraySize;
|
||||
while (mArraySize < count) { // ick
|
||||
mArraySize += kGrowArrayBy;
|
||||
}
|
||||
nsISupports** oldArray = mArray;
|
||||
mArray = new nsISupports*[mArraySize];
|
||||
if (0 == mArray) { // ran out of memory
|
||||
mArray = oldArray;
|
||||
mArraySize = oldSize;
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (0 != oldArray) { // need to move old data
|
||||
if (0 < mCount) {
|
||||
::memcpy(mArray, oldArray, mCount);
|
||||
}
|
||||
if (oldArray != &(mAutoArray[0])) {
|
||||
delete[] oldArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32 index = 0;
|
||||
while (index < elements->mCount) {
|
||||
NS_ADDREF(elements->mArray[index]);
|
||||
mArray[mCount++] = elements->mArray[index++];
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void SupportsArrayImpl::Clear(void)
|
||||
{
|
||||
while (0 <= --mCount) {
|
||||
NS_RELEASE(mArray[mCount]);
|
||||
}
|
||||
mCount = 0;
|
||||
}
|
||||
|
||||
void SupportsArrayImpl::Compact(void)
|
||||
{
|
||||
if ((mArraySize != mCount) && (kAutoArraySize < mArraySize)) {
|
||||
nsISupports** oldArray = mArray;
|
||||
PRInt32 oldArraySize = mArraySize;
|
||||
if (mCount <= kAutoArraySize) {
|
||||
mArray = &(mAutoArray[0]);
|
||||
mArraySize = kAutoArraySize;
|
||||
}
|
||||
else {
|
||||
mArray = new nsISupports*[mCount];
|
||||
mArraySize = mCount;
|
||||
}
|
||||
if (0 == mArray) {
|
||||
mArray = oldArray;
|
||||
mArraySize = oldArraySize;
|
||||
return;
|
||||
}
|
||||
::memcpy(mArray, oldArray, mCount * sizeof(nsISupports*));
|
||||
delete[] oldArray;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool SupportsArrayImpl::EnumerateForwards(nsISupportsArrayEnumFunc aFunc, void* aData) const
|
||||
{
|
||||
PRInt32 index = -1;
|
||||
PRBool running = PR_TRUE;
|
||||
|
||||
while (running && (++index < mCount)) {
|
||||
running = (*aFunc)(mArray[index], aData);
|
||||
}
|
||||
return running;
|
||||
}
|
||||
|
||||
PRBool SupportsArrayImpl::EnumerateBackwards(nsISupportsArrayEnumFunc aFunc, void* aData) const
|
||||
{
|
||||
PRInt32 index = mCount;
|
||||
PRBool running = PR_TRUE;
|
||||
|
||||
while (running && (0 <= --index)) {
|
||||
running = (*aFunc)(mArray[index], aData);
|
||||
}
|
||||
return running;
|
||||
}
|
||||
|
||||
|
||||
NS_COM nsresult
|
||||
NS_NewISupportsArray(nsISupportsArray** aInstancePtrResult)
|
||||
{
|
||||
if (aInstancePtrResult == 0) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
SupportsArrayImpl *it = new SupportsArrayImpl();
|
||||
|
||||
if (0 == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return it->QueryInterface(kISupportsArrayIID, (void **) aInstancePtrResult);
|
||||
}
|
||||
|
||||
74
mozilla/xpcom/ds/nsVector.h
Normal file
74
mozilla/xpcom/ds/nsVector.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsVector_h__
|
||||
#define nsVector_h__
|
||||
|
||||
#include "plvector.h"
|
||||
#include "nsCom.h"
|
||||
|
||||
class nsVector : public PLVector {
|
||||
public:
|
||||
// Construction
|
||||
nsVector(PRUint32 initialSize = 0, PRInt32 initialGrowBy = 0) {
|
||||
PL_VectorInitialize(this, initialSize, initialGrowBy);
|
||||
}
|
||||
~nsVector(void) { PL_VectorFinalize(this); }
|
||||
|
||||
// Attributes
|
||||
PRUint32 GetSize(void) const { return PL_VectorGetSize(this); }
|
||||
PRUint32 GetUpperBound(void) const { return GetSize() - 1; }
|
||||
PRBool SetSize(PRUint32 nNewSize, PRInt32 nGrowBy = PL_VECTOR_GROW_DEFAULT) {
|
||||
return PL_VectorSetSize(this, nNewSize, nGrowBy);
|
||||
}
|
||||
PRBool IsValidIndex(PRUint32 index) { return PL_VectorIsValidIndex(this, index); }
|
||||
|
||||
// Operations
|
||||
// Clean up
|
||||
void Compact(void) { PL_VectorCompact(this); }
|
||||
void RemoveAll(void) { SetSize(0); }
|
||||
void Copy(nsVector* src, PRUint32 len, PRUint32 dstPos = 0, PRUint32 srcPos = 0) {
|
||||
PL_VectorCopy(this, dstPos, src, srcPos, len);
|
||||
}
|
||||
|
||||
// Accessing elements
|
||||
void* Get(PRUint32 index) const { return PL_VectorGet(this, index); }
|
||||
void Set(PRUint32 index, void* newElement) { PL_VectorSet(this, index, newElement); }
|
||||
void*& ElementAt(PRUint32 index) { return *PL_VectorGetAddr(this, index); }
|
||||
|
||||
// Potentially growing the array
|
||||
PRInt32 Add(void* newElement) { return PL_VectorAdd(this, newElement); }
|
||||
|
||||
// overloaded operator helpers
|
||||
void* operator[](PRUint32 index) const { return Get(index); }
|
||||
void*& operator[](PRUint32 index) { return ElementAt(index); }
|
||||
|
||||
// Operations that move elements around
|
||||
void Insert(PRUint32 index, void* newElement, PRInt32 count = 1) {
|
||||
PL_VectorInsert(this, index, newElement, count);
|
||||
}
|
||||
void Remove(PRUint32 index, PRInt32 count = 1) {
|
||||
PL_VectorRemove(this, index, count);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void AssertValid(void) const { PL_VectorAssertValid((PLVector*)this); }
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
318
mozilla/xpcom/ds/plvector.c
Normal file
318
mozilla/xpcom/ds/plvector.c
Normal file
@@ -0,0 +1,318 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "plvector.h"
|
||||
#include "prmem.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef XP_WIN16
|
||||
#define SIZE_T_MAX 0xFF80 /* a little less than 64K, the max alloc size on win16. */
|
||||
#define MAX_ARR_ELEMS SIZE_T_MAX/sizeof(void*)
|
||||
#endif
|
||||
|
||||
PR_IMPLEMENT(PLVector*)
|
||||
PL_NewVector(PRUint32 initialSize, PRInt32 initialGrowBy)
|
||||
{
|
||||
PLVector* v = (PLVector*)PR_Malloc(sizeof(PLVector*));
|
||||
if (v == NULL)
|
||||
return NULL;
|
||||
PL_VectorInitialize(v, initialSize, initialGrowBy);
|
||||
return v;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PL_VectorDestroy(PLVector* v)
|
||||
{
|
||||
PL_VectorFinalize(v);
|
||||
PR_Free(v);
|
||||
}
|
||||
|
||||
/* Initializes an existing vector */
|
||||
PR_IMPLEMENT(void)
|
||||
PL_VectorInitialize(PLVector* v, PRUint32 initialSize, PRInt32 initialGrowBy)
|
||||
{
|
||||
v->data = NULL;
|
||||
v->size = v->maxSize = v->growBy = 0;
|
||||
if (initialSize > 0 || initialGrowBy > 0)
|
||||
PL_VectorSetSize(v, initialSize, initialGrowBy);
|
||||
}
|
||||
|
||||
/* Destroys the elements, but doesn't free the vector */
|
||||
PR_IMPLEMENT(void)
|
||||
PL_VectorFinalize(PLVector* v)
|
||||
{
|
||||
/* This implementation doesn't do anything to delete the elements
|
||||
in the vector -- that's up to the caller. (Don't shoot me,
|
||||
I just copied the code from libmsg.) */
|
||||
PR_Free(v->data);
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRBool)
|
||||
PL_VectorSetSize(PLVector* v, PRUint32 newSize, PRInt32 growBy)
|
||||
{
|
||||
if (growBy != -1)
|
||||
v->growBy = growBy; /* set new size */
|
||||
|
||||
if (newSize == 0) {
|
||||
/* shrink to nothing */
|
||||
PR_Free(v->data);
|
||||
v->data = NULL;
|
||||
v->size = v->maxSize = 0;
|
||||
}
|
||||
else if (v->data == NULL) {
|
||||
/* create one with exact size */
|
||||
#ifdef SIZE_T_MAX
|
||||
PR_ASSERT(newSize <= SIZE_T_MAX/sizeof(void*)); /* no overflow */
|
||||
#endif
|
||||
v->data = (void**)PR_Malloc(newSize * sizeof(void *));
|
||||
if (v->data == NULL) {
|
||||
v->size = 0;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
memset(v->data, 0, newSize * sizeof(void *)); /* zero fill */
|
||||
|
||||
v->size = v->maxSize = newSize;
|
||||
}
|
||||
else if (newSize <= v->maxSize) {
|
||||
/* it fits */
|
||||
if (newSize > v->size) {
|
||||
/* initialize the new elements */
|
||||
|
||||
memset(&v->data[v->size], 0, (newSize-v->size) * sizeof(void *));
|
||||
}
|
||||
v->size = newSize;
|
||||
}
|
||||
else {
|
||||
/* otherwise, grow array */
|
||||
PRUint32 newMax;
|
||||
void** newData;
|
||||
PRInt32 growBy = v->growBy;
|
||||
if (growBy == 0) {
|
||||
/* heuristically determine growth when growBy == 0
|
||||
(this avoids heap fragmentation in many situations) */
|
||||
growBy = PR_MIN(1024, PR_MAX(4, v->size / 8));
|
||||
}
|
||||
#ifdef MAX_ARR_ELEMS
|
||||
if (v->size + growBy > MAX_ARR_ELEMS)
|
||||
growBy = MAX_ARR_ELEMS - v->size;
|
||||
#endif
|
||||
if (newSize < v->maxSize + growBy)
|
||||
newMax = v->maxSize + growBy; /* granularity */
|
||||
else
|
||||
newMax = newSize; /* no slush */
|
||||
|
||||
#ifdef SIZE_T_MAX
|
||||
if (newMax >= SIZE_T_MAX/sizeof(void*))
|
||||
return PR_FALSE;
|
||||
PR_ASSERT(newMax <= SIZE_T_MAX/sizeof(void*)); /* no overflow */
|
||||
#endif
|
||||
PR_ASSERT(newMax >= v->maxSize); /* no wrap around */
|
||||
newData = (void**)PR_Malloc(newMax * sizeof(void*));
|
||||
|
||||
if (newData != NULL) {
|
||||
/* copy new data from old */
|
||||
memcpy(newData, v->data, v->size * sizeof(void*));
|
||||
|
||||
/* construct remaining elements */
|
||||
PR_ASSERT(newSize > v->size);
|
||||
|
||||
memset(&newData[v->size], 0, (newSize-v->size) * sizeof(void*));
|
||||
|
||||
/* get rid of old stuff (note: no destructors called) */
|
||||
PR_Free(v->data);
|
||||
v->data = newData;
|
||||
v->size = newSize;
|
||||
v->maxSize = newMax;
|
||||
}
|
||||
else {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRBool)
|
||||
PL_VectorIsValidIndex(PLVector* v, PRUint32 index)
|
||||
{
|
||||
return (index < v->size) ? PR_TRUE : PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PL_VectorCompact(PLVector* v)
|
||||
{
|
||||
if (v->size != v->maxSize) {
|
||||
/* shrink to desired size */
|
||||
#ifdef SIZE_T_MAX
|
||||
PR_ASSERT(v->size <= SIZE_T_MAX/sizeof(void *)); /* no overflow */
|
||||
#endif
|
||||
void ** newData = NULL;
|
||||
if (v->size != 0) {
|
||||
newData = (void **)PR_Malloc(v->size * sizeof(void *));
|
||||
/* copy new data from old */
|
||||
memcpy(newData, v->data, v->size * sizeof(void *));
|
||||
}
|
||||
|
||||
/* get rid of old stuff (note: no destructors called) */
|
||||
PR_Free(v->data);
|
||||
v->data = newData;
|
||||
v->maxSize = v->size;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 /* becomes Copy */
|
||||
PR_IMPLEMENT(void)
|
||||
PL_VectorSplice(PLVector* v, PRUint32 startIndex, PLVector* newVector)
|
||||
{
|
||||
PRUint32 i;
|
||||
PR_ASSERT(newVector != NULL);
|
||||
|
||||
if (PL_VectorGetSize(newVector) > 0) {
|
||||
PL_VectorInsert(v, startIndex, PL_VectorGet(newVector, 0),
|
||||
PL_VectorGetSize(newVector));
|
||||
for (i = 0; i < PL_VectorGetSize(newVector); i++)
|
||||
PL_VectorSet(v, startIndex + i, PL_VectorGet(newVector, i));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PL_VectorCopy(PLVector* dstVector, PRUint32 dstPosition,
|
||||
PLVector* srcVector, PRUint32 srcPosition, PRUint32 length)
|
||||
{
|
||||
PR_ASSERT(0); /* XXX not implemented yet */
|
||||
#if 0
|
||||
PL_VectorSetSize(dstVector, PR_MAX(PL_VectorGetSize(dstVector),
|
||||
PL_VectorGetSize(srcVector)),
|
||||
PL_VECTOR_GROW_DEFAULT);
|
||||
|
||||
if (v->data)
|
||||
PR_Free(v->data);
|
||||
v->size = oldA->v->size;
|
||||
v->maxSize = oldA->v->maxSize;
|
||||
v->growBy = oldA->v->growBy;
|
||||
v->data = (void**)PR_Malloc(v->size * sizeof(void *));
|
||||
if (v->data == NULL) {
|
||||
v->size = 0;
|
||||
}
|
||||
else {
|
||||
memcpy(v->data, oldA->v->data, v->size * sizeof(void *));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PLVector*)
|
||||
PL_VectorClone(PLVector* v)
|
||||
{
|
||||
PLVector* newVec = PL_NewVector(v->size, v->growBy);
|
||||
PL_VectorCopy(newVec, 0, v, 0, v->size);
|
||||
return newVec;
|
||||
}
|
||||
|
||||
/* Accessing elements */
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PL_VectorSet(PLVector* v, PRUint32 index, void* newElement)
|
||||
{
|
||||
if (index >= v->size) {
|
||||
if (!PL_VectorSetSize(v, index+1, PL_VECTOR_GROW_DEFAULT))
|
||||
return;
|
||||
}
|
||||
v->data[index] = newElement;
|
||||
}
|
||||
|
||||
/* Adds at the end */
|
||||
PR_IMPLEMENT(PRUint32)
|
||||
PL_VectorAdd(PLVector* v, void* newElement)
|
||||
{
|
||||
PRUint32 index = v->size;
|
||||
#ifdef XP_WIN16
|
||||
if (index >= SIZE_T_MAX / 4L) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
PL_VectorSet(v, index, newElement);
|
||||
return index;
|
||||
}
|
||||
|
||||
/* Inserts new element count times at index */
|
||||
PR_IMPLEMENT(void)
|
||||
PL_VectorInsert(PLVector* v, PRUint32 index, void* newElement, PRUint32 count)
|
||||
{
|
||||
PR_ASSERT(count > 0); /* zero or negative size not allowed */
|
||||
|
||||
if (index >= v->size) {
|
||||
/* adding after the end of the array */
|
||||
if (!PL_VectorSetSize(v, index + count, PL_VECTOR_GROW_DEFAULT))
|
||||
return; /* grow so index is valid */
|
||||
}
|
||||
else {
|
||||
/* inserting in the middle of the array */
|
||||
PRUint32 nOldSize = v->size;
|
||||
if (!PL_VectorSetSize(v, v->size + count, PL_VECTOR_GROW_DEFAULT))
|
||||
return; /* grow it to new size */
|
||||
/* shift old data up to fill gap */
|
||||
memmove(&v->data[index+count], &v->data[index],
|
||||
(nOldSize-index) * sizeof(void *));
|
||||
|
||||
/* re-init slots we copied from */
|
||||
memset(&v->data[index], 0, count * sizeof(void *));
|
||||
}
|
||||
|
||||
/* insert new value in the gap */
|
||||
PR_ASSERT(index + count <= v->size);
|
||||
while (count--)
|
||||
v->data[index++] = newElement;
|
||||
}
|
||||
|
||||
/* Removes count elements at index */
|
||||
PR_IMPLEMENT(void)
|
||||
PL_VectorRemove(PLVector* v, PRUint32 index, PRUint32 count)
|
||||
{
|
||||
PRUint32 moveCount;
|
||||
PR_ASSERT(count >= 0);
|
||||
PR_ASSERT(index + count <= v->size);
|
||||
|
||||
/* just remove a range */
|
||||
moveCount = v->size - (index + count);
|
||||
|
||||
if (moveCount)
|
||||
memmove(&v->data[index], &v->data[index + count],
|
||||
moveCount * sizeof(void *));
|
||||
v->size -= count;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PL_VectorAssertValid(PLVector* v)
|
||||
{
|
||||
if (v->data == NULL) {
|
||||
PR_ASSERT(v->size == 0);
|
||||
PR_ASSERT(v->maxSize == 0);
|
||||
}
|
||||
else {
|
||||
PR_ASSERT(v->size >= 0);
|
||||
PR_ASSERT(v->maxSize >= 0);
|
||||
PR_ASSERT(v->size <= v->maxSize);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
100
mozilla/xpcom/ds/plvector.h
Normal file
100
mozilla/xpcom/ds/plvector.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef plvector_h__
|
||||
#define plvector_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "prlog.h"
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
/* Vectors are extensible arrays */
|
||||
|
||||
typedef struct PLVector {
|
||||
void** data; /* the actual array of data */
|
||||
PRUint32 size; /* # of elements (upperBound - 1) */
|
||||
PRUint32 maxSize; /* max allocated */
|
||||
PRInt32 growBy; /* grow amount */
|
||||
} PLVector;
|
||||
|
||||
PR_EXTERN(PLVector*)
|
||||
PL_NewVector(PRUint32 initialSize, PRInt32 initialGrowBy);
|
||||
|
||||
PR_EXTERN(void)
|
||||
PL_VectorDestroy(PLVector* v);
|
||||
|
||||
/* Initializes an existing vector */
|
||||
PR_EXTERN(void)
|
||||
PL_VectorInitialize(PLVector* v, PRUint32 initialSize, PRInt32 initialGrowBy);
|
||||
|
||||
/* Destroys the elements, but doesn't free the vector */
|
||||
PR_EXTERN(void)
|
||||
PL_VectorFinalize(PLVector* v);
|
||||
|
||||
#define PL_VectorGetSize(v) ((v)->size)
|
||||
|
||||
#define PL_VECTOR_GROW_DEFAULT (-1)
|
||||
|
||||
PR_EXTERN(PRBool)
|
||||
PL_VectorSetSize(PLVector* v, PRUint32 newSize, PRInt32 growBy);
|
||||
|
||||
PR_EXTERN(PRBool)
|
||||
PL_VectorIsValidIndex(PLVector* v, PRUint32 index);
|
||||
|
||||
PR_EXTERN(void)
|
||||
PL_VectorCompact(PLVector* v);
|
||||
|
||||
PR_EXTERN(void)
|
||||
PL_VectorCopy(PLVector* dstVector, PRUint32 dstPosition,
|
||||
PLVector* srcVector, PRUint32 srcPosition, PRUint32 length);
|
||||
|
||||
PR_EXTERN(PLVector*)
|
||||
PL_VectorClone(PLVector* v);
|
||||
|
||||
/* Accessing elements */
|
||||
|
||||
#define PL_VectorGetAddr(v, index) (PR_ASSERT((index) < (v)->size), &(v)->data[index])
|
||||
|
||||
#define PL_VectorGet(v, index) (*PL_VectorGetAddr(v, index))
|
||||
|
||||
PR_EXTERN(void)
|
||||
PL_VectorSet(PLVector* v, PRUint32 index, void* newElement);
|
||||
|
||||
/* Adds at the end */
|
||||
PR_EXTERN(PRUint32)
|
||||
PL_VectorAdd(PLVector* v, void* newElement);
|
||||
|
||||
/* Inserts new element count times at index */
|
||||
PR_EXTERN(void)
|
||||
PL_VectorInsert(PLVector* v, PRUint32 index, void* newElement, PRUint32 count);
|
||||
|
||||
/* Removes count elements at index */
|
||||
PR_EXTERN(void)
|
||||
PL_VectorRemove(PLVector* v, PRUint32 index, PRUint32 count);
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
PR_EXTERN(void)
|
||||
PL_VectorAssertValid(PLVector* v);
|
||||
|
||||
#endif
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* plvector_h__ */
|
||||
54
mozilla/xpcom/glue/nsCOMPtr.cpp
Normal file
54
mozilla/xpcom/glue/nsCOMPtr.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
void
|
||||
nsCOMPtr_base::assign_with_AddRef( nsISupports* rawPtr )
|
||||
{
|
||||
if ( rawPtr )
|
||||
NSCAP_ADDREF(rawPtr);
|
||||
if ( mRawPtr )
|
||||
NSCAP_RELEASE(mRawPtr);
|
||||
mRawPtr = rawPtr;
|
||||
}
|
||||
|
||||
void
|
||||
nsCOMPtr_base::assign_with_QueryInterface( nsISupports* rawPtr, const nsIID& iid, nsresult* result )
|
||||
{
|
||||
nsresult status = NS_OK;
|
||||
if ( !rawPtr || !NS_SUCCEEDED( status = rawPtr->QueryInterface(iid, NSCAP_REINTERPRET_CAST(void**, &rawPtr)) ) )
|
||||
rawPtr = 0;
|
||||
|
||||
if ( mRawPtr )
|
||||
NSCAP_RELEASE(mRawPtr);
|
||||
|
||||
mRawPtr = rawPtr;
|
||||
|
||||
if ( result )
|
||||
*result = status;
|
||||
}
|
||||
|
||||
void**
|
||||
nsCOMPtr_base::begin_assignment()
|
||||
{
|
||||
if ( mRawPtr )
|
||||
NSCAP_RELEASE(mRawPtr);
|
||||
mRawPtr = 0;
|
||||
return NSCAP_REINTERPRET_CAST(void**, &mRawPtr);
|
||||
}
|
||||
668
mozilla/xpcom/glue/nsCOMPtr.h
Normal file
668
mozilla/xpcom/glue/nsCOMPtr.h
Normal file
@@ -0,0 +1,668 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsCOMPtr_h___
|
||||
#define nsCOMPtr_h___
|
||||
|
||||
|
||||
|
||||
// Wrapping includes can speed up compiles (see "Large Scale C++ Software Design")
|
||||
#ifndef nsDebug_h___
|
||||
#include "nsDebug.h"
|
||||
// for |NS_PRECONDITION|
|
||||
#endif
|
||||
|
||||
#ifndef nsISupports_h___
|
||||
#include "nsISupports.h"
|
||||
// for |nsresult|, |NS_ADDREF|, et al
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
TO DO...
|
||||
|
||||
+ make alternative function for |getter_AddRefs| (or something)
|
||||
+ make constructor for |nsQueryInterface| explicit (suddenly construct/assign from raw pointer becomes illegal)
|
||||
+ Improve internal documentation
|
||||
+ mention *&
|
||||
+ alternatives for comparison
|
||||
+ do_QueryInterface
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* USER MANUAL
|
||||
|
||||
See also:
|
||||
<http://www.meer.net/ScottCollins/doc/nsCOMPtr.html>, or
|
||||
<http://www.mozilla.org/projects/xpcom/nsCOMPtr.html>
|
||||
|
||||
What is |nsCOMPtr|?
|
||||
|
||||
|nsCOMPtr| is a `smart-pointer'. It is a template class that acts, syntactically,
|
||||
just like an ordinary pointer in C or C++, i.e., you can apply |*| or |->| to it to
|
||||
`get to' what it points at. |nsCOMPtr| is smart in that, unlike a raw COM
|
||||
interface pointer, |nsCOMPtr| manages |AddRef|, |Release|, and |QueryInterface|
|
||||
_for_ you.
|
||||
|
||||
For instance, here is a typical snippet of code (at its most compact) where you assign
|
||||
a COM interface pointer into a member variable:
|
||||
|
||||
NS_IF_RELEASE(mFoop); // If I have one already, I must release it before over-writing it.
|
||||
if ( mFooP = aPtr ) // Now it's safe to assign it in, and, if it's not NULL
|
||||
mFooP->AddRef(); // I must |AddRef| it, since I'll be holding on to it.
|
||||
|
||||
If our member variable |mFooP| were a |nsCOMPtr|, however, the snippet above
|
||||
would look like this:
|
||||
|
||||
mFoop = aPtr; // Note: automatically |Release|s the old and |AddRef|s the new
|
||||
|
||||
|nsCOMPtr| helps you write code that is leak-proof, exception safe, and significantly
|
||||
less verbose than you would with raw COM interface pointers. With |nsCOMPtr|, you
|
||||
may never have to call |AddRef|, |Release|, or |QueryInterface| by hand.
|
||||
|
||||
|
||||
You still have to understand COM. You still have to know which functions return
|
||||
interface pointers that have already been |AddRef|ed and which don't. You still
|
||||
have to ensure your program logic doesn't produce circularly referencing garbage.
|
||||
|nsCOMPtr| is not a panacea. It is, however, helpful, easy to use, well-tested,
|
||||
and polite. It doesn't require that a function author cooperate with you, nor does
|
||||
your use force others to use it.
|
||||
|
||||
|
||||
Where should I use |nsCOMPtr|?
|
||||
|
||||
...
|
||||
|
||||
|
||||
Where _shouldn't_ I use |nsCOMPtr|?
|
||||
|
||||
In public interfaces... [[others]]
|
||||
|
||||
|
||||
How does a |nsCOMPtr| differ from a raw pointer?
|
||||
|
||||
A |nsCOMPtr| differs, syntactically, from a raw COM interface pointer in three
|
||||
ways:
|
||||
|
||||
+ It's declared differently, e.g.,
|
||||
|
||||
// instead of saying // you say
|
||||
IFoo* fooP; nsCOMPtr<IFoo> fooP;
|
||||
|
||||
|
||||
+ You can't call |AddRef| or |Release| through it,
|
||||
|
||||
fooP->AddRef(); // OK fooP->AddRef(); // Error: no permission
|
||||
fooP->Release(); // OK fooP->Release(); // Error: no permission
|
||||
|
||||
|
||||
+ You can't just apply an |&| to it to pass it to the typical `getter' function
|
||||
|
||||
AcquireFoo(&fooP); AcquireFoo( getter_AddRefs(fooP) );
|
||||
GetFoo(&fooP); GetFoo( getter_doesnt_AddRef(fooP) );
|
||||
|
||||
|
||||
How do I use |nsCOMPtr|?
|
||||
|
||||
Typically, you can use a |nsCOMPtr| exactly as you would a standard COM
|
||||
interface pointer:
|
||||
|
||||
IFoo* fooP; nsCOMPtr<IFoo> fooP;
|
||||
// ... // ...
|
||||
fooP->SomeFunction(x, y, z); fooP->SomeFunction(x, y, z);
|
||||
AnotherFunction(fooP); AnotherFunction(fooP);
|
||||
|
||||
if ( fooP ) if ( fooP )
|
||||
// ... // ...
|
||||
|
||||
if ( fooP == barP ) if ( fooP == barP )
|
||||
// ... // ...
|
||||
|
||||
There are some differences, though. In particular, you can't call |AddRef| or |Release|
|
||||
through a |nsCOMPtr| directly, nor would you need to. |AddRef| is called for you
|
||||
whenever you assign a COM interface pointer _into_ a |nsCOMPtr|. |Release| is
|
||||
called on the old value, and also when the |nsCOMPtr| goes out of scope. Trying
|
||||
to call |AddRef| or |Release| yourself will generate a compile-time error.
|
||||
|
||||
fooP->AddRef(); // fooP->AddRef(); // ERROR: no permission
|
||||
fooP->Release(); // fooP->Release(); // ERROR: no permission
|
||||
|
||||
The final difference is that a bare |nsCOMPtr| (or rather a pointer to it) can't
|
||||
be supplied as an argument to a function that `fills in' a COM interface pointer.
|
||||
Rather it must be wrapped with a utility call that says whether the function calls
|
||||
|AddRef| before returning, e.g.,
|
||||
|
||||
...->QueryInterface(riid, &fooP) ...->QueryInterface(riid, getter_AddRefs(fooP))
|
||||
|
||||
LookupFoo(&fooP); LookupFoo( getter_doesnt_AddRef(fooP) );
|
||||
|
||||
Don't worry. It's a compile-time error if you forget to wrap it.
|
||||
|
||||
Compare the raw-pointer way...
|
||||
|
||||
IFoo* foo = 0;
|
||||
nsresult status = CreateIFoo(&foo);
|
||||
if ( NS_SUCCEEDED(status) )
|
||||
{
|
||||
IBar* bar = 0;
|
||||
if ( NS_SUCCEEDED(status = foo->QueryInterface(riid, &bar)) )
|
||||
{
|
||||
IFooBar* foobar = 0;
|
||||
if ( NS_SUCCEEDED(status = CreateIFooBar(foo, bar, &foobar)) )
|
||||
{
|
||||
foobar->DoTheReallyHardThing();
|
||||
foobar->Release();
|
||||
}
|
||||
bar->Release();
|
||||
}
|
||||
foo->Release();
|
||||
}
|
||||
|
||||
|
||||
|
||||
To the smart-pointer way...
|
||||
|
||||
nsCOMPtr<IFoo> fooP;
|
||||
nsresult status = CreateIFoo( getter_AddRefs(fooP) );
|
||||
if ( NS_SUCCEEDED(status) )
|
||||
if ( nsCOMPtr<IBar> barP( fooP ) )
|
||||
{
|
||||
nsCOMPtr<IFooBar> fooBarP;
|
||||
if ( NS_SUCCEEDED(status = CreateIFooBar(fooP, barP, getter_AddRefs(fooBarP))) )
|
||||
fooBarP->DoTheReallyHardThing();
|
||||
}
|
||||
|
||||
|
||||
Is there an easy way to convert my current code?
|
||||
|
||||
...
|
||||
|
||||
|
||||
What do I have to beware of?
|
||||
|
||||
VC++ < 6.0 _can't_ handle the following situation
|
||||
|
||||
class nsIFoo; // forward declare some class
|
||||
// ...
|
||||
nsCOMPtr<nsIFoo> bar; // ERROR: incomplete type nsIFoo, etc.
|
||||
|
||||
Instead, you must make sure that you actually defined the underlying interface class, e.g.,
|
||||
|
||||
#include "nsIFoo.h" // fully defines |class nsIFoo|
|
||||
// ...
|
||||
nsCOMPtr<nsIFoo> bar; // no problem
|
||||
|
||||
Why is this? It's because VC++ tries to instantiate every member of the template
|
||||
as soon as it sees the template declarations. Bad compiler. No cookie!
|
||||
[[Thanks to mjudge, waterson, and pinkerton on this one.]]
|
||||
|
||||
|
||||
Why does |getter_AddRefs| have such a funny name? I.e., why doesn't it follow our
|
||||
naming conventions?
|
||||
|
||||
|getter_AddRefs| and |getter_doesnt_AddRef| use underscores for the same
|
||||
reason our special macros do, quoting from our coding conventions "...to make them
|
||||
stick out like a sore thumb". Note also that since |AddRef| is one word,
|
||||
|getter_AddRefs| and |getter_doesnt_AddRef| couldn't have the right spacing if only inter-
|
||||
caps were used.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
WARNING:
|
||||
This file defines several macros for internal use only. These macros begin with the
|
||||
prefix |NSCAP_|. Do not use these macros in your own code. They are for internal use
|
||||
only for cross-platform compatibility, and are subject to change without notice.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Set up some |#define|s to turn off a couple of troublesome C++ features.
|
||||
Interestingly, none of the compilers barf on template stuff.
|
||||
|
||||
Ideally, we would want declarations like these in a configuration file
|
||||
that everybody would get. Deciding exactly how to do that should
|
||||
be part of the process of moving from experimental to production.
|
||||
|
||||
Update: ramiro is working on getting these into the configuration system.
|
||||
*/
|
||||
|
||||
#if defined(__GNUG__) && (__GNUC_MINOR__ <= 90) && !defined(SOLARIS)
|
||||
#define NSCAP_NO_MEMBER_USING_DECLARATIONS
|
||||
|
||||
#if (defined(LINUX) || defined(__bsdi__)) && (__GNUC_MINOR__ <= 7)
|
||||
#define NSCAP_NEED_UNUSED_VIRTUAL_IMPLEMENTATIONS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SOLARIS) && !defined(__GNUG__)
|
||||
#define NSCAP_NO_BOOL
|
||||
#define NSCAP_NO_EXPLICIT
|
||||
#define NSCAP_NO_NEW_CASTS
|
||||
#define NSCAP_NO_MEMBER_USING_DECLARATIONS
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1100)
|
||||
#define NSCAP_NO_EXPLICIT
|
||||
#define NSCAP_NO_BOOL
|
||||
#endif
|
||||
|
||||
#if defined(IRIX)
|
||||
#define NSCAP_NO_MEMBER_USING_DECLARATIONS
|
||||
#define NSCAP_NO_EXPLICIT
|
||||
#define NSCAP_NO_NEW_CASTS
|
||||
#define NSCAP_NO_BOOL
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef NSCAP_NO_EXPLICIT
|
||||
#define explicit
|
||||
#endif
|
||||
|
||||
#ifndef NSCAP_NO_NEW_CASTS
|
||||
#define NSCAP_REINTERPRET_CAST(T,x) reinterpret_cast<T>(x)
|
||||
#else
|
||||
#define NSCAP_REINTERPRET_CAST(T,x) ((T)(x))
|
||||
#endif
|
||||
|
||||
#ifndef NSCAP_NO_BOOL
|
||||
typedef bool NSCAP_BOOL;
|
||||
#else
|
||||
typedef PRBool NSCAP_BOOL;
|
||||
#endif
|
||||
|
||||
#ifdef NSCAP_FEATURE_DEBUG_MACROS
|
||||
#define NSCAP_ADDREF(ptr) NS_ADDREF(ptr)
|
||||
#define NSCAP_RELEASE(ptr) NS_RELEASE(ptr)
|
||||
#else
|
||||
#define NSCAP_ADDREF(ptr) (ptr)->AddRef()
|
||||
#define NSCAP_RELEASE(ptr) (ptr)->Release()
|
||||
#endif
|
||||
|
||||
/*
|
||||
WARNING:
|
||||
VC++4.2 is very picky. To compile under VC++4.2, the classes must be defined
|
||||
in an order that satisfies:
|
||||
|
||||
nsDerivedSafe < nsCOMPtr
|
||||
nsDontAddRef < nsCOMPtr
|
||||
nsCOMPtr < nsGetterAddRefs
|
||||
|
||||
The other compilers probably won't complain, so please don't reorder these
|
||||
classes, on pain of breaking 4.2 compatibility.
|
||||
*/
|
||||
|
||||
|
||||
template <class T>
|
||||
class nsDerivedSafe : public T
|
||||
/*
|
||||
No client should ever see or have to type the name of this class. It is the
|
||||
artifact that makes it a compile-time error to call |AddRef| and |Release|
|
||||
on a |nsCOMPtr|.
|
||||
|
||||
See |nsCOMPtr::operator->|, |nsCOMPtr::operator*|, et al.
|
||||
*/
|
||||
{
|
||||
private:
|
||||
#ifndef NSCAP_NO_MEMBER_USING_DECLARATIONS
|
||||
using T::AddRef;
|
||||
using T::Release;
|
||||
#else
|
||||
nsrefcnt AddRef();
|
||||
nsrefcnt Release();
|
||||
#endif
|
||||
|
||||
void operator delete( void* ); // NOT TO BE IMPLEMENTED
|
||||
// declaring |operator delete| private makes calling delete on an interface pointer a compile error
|
||||
|
||||
nsDerivedSafe& operator=( const nsDerivedSafe& ); // NOT TO BE IMPLEMENTED
|
||||
// you may not call |operator=()| through a dereferenced |nsCOMPtr|, because you'd get the wrong one
|
||||
};
|
||||
|
||||
#if defined(NSCAP_NO_MEMBER_USING_DECLARATIONS) && defined(NSCAP_NEED_UNUSED_VIRTUAL_IMPLEMENTATIONS)
|
||||
template <class T>
|
||||
nsrefcnt
|
||||
nsDerivedSafe<T>::AddRef()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
nsrefcnt
|
||||
nsDerivedSafe<T>::Release()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
struct nsDontQueryInterface
|
||||
/*
|
||||
...
|
||||
*/
|
||||
{
|
||||
explicit
|
||||
nsDontQueryInterface( T* aRawPtr )
|
||||
: mRawPtr(aRawPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
T* mRawPtr;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
nsDontQueryInterface<T>
|
||||
dont_QueryInterface( T* aRawPtr )
|
||||
{
|
||||
return nsDontQueryInterface<T>(aRawPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
struct nsQueryInterface
|
||||
{
|
||||
// explicit
|
||||
nsQueryInterface( nsISupports* aRawPtr, nsresult* error = 0 )
|
||||
: mRawPtr(aRawPtr),
|
||||
mErrorPtr(error)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
nsISupports* mRawPtr;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
inline
|
||||
nsQueryInterface
|
||||
do_QueryInterface( nsISupports* aRawPtr, nsresult* error = 0 )
|
||||
{
|
||||
return nsQueryInterface(aRawPtr, error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
struct nsDontAddRef
|
||||
/*
|
||||
...cooperates with |nsCOMPtr| to allow you to assign in a pointer _without_
|
||||
|AddRef|ing it. You would rarely use this directly, but rather through the
|
||||
machinery of |getter_AddRefs| in the argument list to functions that |AddRef|
|
||||
their results before returning them to the caller.
|
||||
|
||||
See also |getter_AddRefs()| and |class nsGetterAddRefs|.
|
||||
*/
|
||||
{
|
||||
explicit
|
||||
nsDontAddRef( T* aRawPtr )
|
||||
: mRawPtr(aRawPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
T* mRawPtr;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
nsDontAddRef<T>
|
||||
dont_AddRef( T* aRawPtr )
|
||||
/*
|
||||
...makes typing easier, because it deduces the template type, e.g.,
|
||||
you write |dont_AddRef(fooP)| instead of |nsDontAddRef<IFoo>(fooP)|.
|
||||
|
||||
Like the class it is shorthand for, you would rarely use this directly,
|
||||
but rather through |getter_AddRefs|.
|
||||
*/
|
||||
{
|
||||
return nsDontAddRef<T>(aRawPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
class nsCOMPtr_base
|
||||
{
|
||||
public:
|
||||
|
||||
nsCOMPtr_base( nsISupports* rawPtr = 0 )
|
||||
: mRawPtr(rawPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
~nsCOMPtr_base()
|
||||
{
|
||||
if ( mRawPtr )
|
||||
NSCAP_RELEASE(mRawPtr);
|
||||
}
|
||||
|
||||
NS_EXPORT void assign_with_AddRef( nsISupports* );
|
||||
NS_EXPORT void assign_with_QueryInterface( nsISupports*, const nsIID&, nsresult* );
|
||||
NS_EXPORT void** begin_assignment();
|
||||
|
||||
protected:
|
||||
nsISupports* mRawPtr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
class nsCOMPtr : private nsCOMPtr_base
|
||||
/*
|
||||
...
|
||||
*/
|
||||
{
|
||||
public:
|
||||
typedef T element_type;
|
||||
|
||||
nsCOMPtr()
|
||||
// : nsCOMPtr_base(0)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsQueryInterface& aSmartPtr )
|
||||
// : nsCOMPtr_base(0)
|
||||
{
|
||||
assign_with_QueryInterface(aSmartPtr.mRawPtr, T::IID(), aSmartPtr.mErrorPtr);
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsDontAddRef<T>& aSmartPtr )
|
||||
: nsCOMPtr_base(aSmartPtr.mRawPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsDontQueryInterface<T>& aSmartPtr )
|
||||
: nsCOMPtr_base(aSmartPtr.mRawPtr)
|
||||
{
|
||||
if ( mRawPtr )
|
||||
NSCAP_ADDREF(mRawPtr);
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsCOMPtr<T>& aSmartPtr )
|
||||
: nsCOMPtr_base(aSmartPtr.mRawPtr)
|
||||
{
|
||||
if ( mRawPtr )
|
||||
NSCAP_ADDREF(mRawPtr);
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsQueryInterface& rhs )
|
||||
{
|
||||
assign_with_QueryInterface(rhs.mRawPtr, T::IID(), rhs.mErrorPtr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsDontAddRef<T>& rhs )
|
||||
{
|
||||
if ( mRawPtr )
|
||||
NSCAP_RELEASE(mRawPtr);
|
||||
mRawPtr = rhs.mRawPtr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsDontQueryInterface<T>& rhs )
|
||||
{
|
||||
assign_with_AddRef(rhs.mRawPtr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsCOMPtr& rhs )
|
||||
{
|
||||
assign_with_AddRef(rhs.mRawPtr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsDerivedSafe<T>*
|
||||
get() const
|
||||
// returns a |nsDerivedSafe<T>*| to deny clients the use of |AddRef| and |Release|
|
||||
{
|
||||
return NSCAP_REINTERPRET_CAST(nsDerivedSafe<T>*, mRawPtr);
|
||||
}
|
||||
|
||||
nsDerivedSafe<T>*
|
||||
operator->() const
|
||||
// returns a |nsDerivedSafe<T>*| to deny clients the use of |AddRef| and |Release|
|
||||
{
|
||||
NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator->().");
|
||||
return get();
|
||||
}
|
||||
|
||||
nsDerivedSafe<T>&
|
||||
operator*() const
|
||||
// returns a |nsDerivedSafe<T>*| to deny clients the use of |AddRef| and |Release|
|
||||
{
|
||||
NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator*().");
|
||||
return *get();
|
||||
}
|
||||
|
||||
operator nsDerivedSafe<T>*() const
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
#if 0
|
||||
private:
|
||||
friend class nsGetterAddRefs<T>;
|
||||
|
||||
/*
|
||||
In a perfect world, the following member function, |StartAssignment|, would be private.
|
||||
It is and should be only accessed by the closely related class |nsGetterAddRefs<T>|.
|
||||
|
||||
Unfortunately, some compilers---most notably VC++5.0---fail to grok the
|
||||
friend declaration above or in any alternate acceptable form. So, physically
|
||||
it will be public (until our compilers get smarter); but it is not to be
|
||||
considered part of the logical public interface.
|
||||
*/
|
||||
#endif
|
||||
|
||||
T**
|
||||
StartAssignment()
|
||||
{
|
||||
return NSCAP_REINTERPRET_CAST(T**, begin_assignment());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class nsGetterAddRefs
|
||||
/*
|
||||
...
|
||||
|
||||
This class is designed to be used for anonymous temporary objects in the
|
||||
argument list of calls that return COM interface pointers, e.g.,
|
||||
|
||||
nsCOMPtr<IFoo> fooP;
|
||||
...->QueryInterface(iid, nsGetterAddRefs<IFoo>(fooP))
|
||||
...->QueryInterface(iid, getter_AddRefs(fooP))
|
||||
|
||||
When initialized with a |nsCOMPtr|, as in the example above, it returns
|
||||
a |void**| (or |T**| if needed) that the outer call (|QueryInterface| in this
|
||||
case) can fill in. When this temporary object goes out of scope, just after
|
||||
the call returns, its destructor assigned the resulting interface pointer, i.e.,
|
||||
|QueryInterface|s result, into the |nsCOMPtr| it was initialized with.
|
||||
|
||||
See also |nsGetterDoesntAddRef|.
|
||||
*/
|
||||
{
|
||||
public:
|
||||
explicit
|
||||
nsGetterAddRefs( nsCOMPtr<T>& aSmartPtr )
|
||||
: mTargetSmartPtr(aSmartPtr)
|
||||
{
|
||||
// nothing else to do
|
||||
}
|
||||
|
||||
operator void**()
|
||||
{
|
||||
// NS_PRECONDITION(mTargetSmartPtr != 0, "getter_AddRefs into no destination");
|
||||
return NSCAP_REINTERPRET_CAST(void**, mTargetSmartPtr.StartAssignment());
|
||||
}
|
||||
|
||||
T*&
|
||||
operator*()
|
||||
{
|
||||
// NS_PRECONDITION(mTargetSmartPtr != 0, "getter_AddRefs into no destination");
|
||||
return *(mTargetSmartPtr.StartAssignment());
|
||||
}
|
||||
|
||||
operator T**()
|
||||
{
|
||||
// NS_PRECONDITION(mTargetSmartPtr != 0, "getter_AddRefs into no destination");
|
||||
return mTargetSmartPtr.StartAssignment();
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<T>& mTargetSmartPtr;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
nsGetterAddRefs<T>
|
||||
getter_AddRefs( nsCOMPtr<T>& aSmartPtr )
|
||||
/*
|
||||
Used around a |nsCOMPtr| when
|
||||
...makes the class |nsGetterAddRefs<T>| invisible.
|
||||
*/
|
||||
{
|
||||
return nsGetterAddRefs<T>(aSmartPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // !defined(nsCOMPtr_h___)
|
||||
169
mozilla/xpcom/glue/nsDebug.cpp
Normal file
169
mozilla/xpcom/glue/nsDebug.cpp
Normal file
@@ -0,0 +1,169 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "prlog.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined(XP_MAC)
|
||||
#define TEMP_MAC_HACK
|
||||
|
||||
//------------------------
|
||||
#ifdef TEMP_MAC_HACK
|
||||
#include <MacTypes.h>
|
||||
#include <Processes.h>
|
||||
|
||||
// TEMPORARY UNTIL WE HAVE MACINTOSH ENVIRONMENT VARIABLES THAT CAN TURN ON
|
||||
// LOGGING ON MACINTOSH
|
||||
// At this moment, NSPR's logging is a no-op on Macintosh.
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#undef PR_LOG
|
||||
#define PR_LOG(module,level,args) dprintf args
|
||||
static void dprintf(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
Str255 buffer;
|
||||
|
||||
va_start(ap, format);
|
||||
buffer[0] = vsnprintf((char *)buffer + 1, sizeof(buffer) - 1, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
DebugStr(buffer);
|
||||
}
|
||||
#endif // TEMP_MAC_HACK
|
||||
//------------------------
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of the nsDebug methods. Note that this code is
|
||||
* always compiled in, in case some other module that uses it is
|
||||
* compiled with debugging even if this library is not.
|
||||
*/
|
||||
|
||||
static PRLogModuleInfo* gDebugLog;
|
||||
|
||||
static void InitLog(void)
|
||||
{
|
||||
if (0 == gDebugLog) {
|
||||
gDebugLog = PR_NewLogModule("nsDebug");
|
||||
gDebugLog->level = PR_LOG_DEBUG;
|
||||
}
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("Abort: at file %s, line %d", aFile, aLine));
|
||||
PR_LogFlush();
|
||||
#if defined(_WIN32)
|
||||
long* __p = (long*) 0x7;
|
||||
*__p = 0x7;
|
||||
#elif defined(XP_MAC)
|
||||
ExitToShell();
|
||||
#elif defined(XP_UNIX)
|
||||
::abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::Break(const char* aFile, PRIntn aLine)
|
||||
{
|
||||
#ifndef TEMP_MAC_HACK
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("Break: at file %s, line %d", aFile, aLine));
|
||||
PR_LogFlush();
|
||||
//XXX this works on win32 only for now. For all the other platforms call Abort
|
||||
#if defined(_WIN32)
|
||||
::DebugBreak();
|
||||
#else
|
||||
Abort(aFile, aLine);
|
||||
#endif
|
||||
#endif // TEMP_MAC_HACK
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::PreCondition(const char* aStr, const char* aExpr,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("PreCondition: \"%s\" (%s) at file %s, line %d", aStr, aExpr,
|
||||
aFile, aLine));
|
||||
Break(aFile, aLine);
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::PostCondition(const char* aStr, const char* aExpr,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("PostCondition: \"%s\" (%s) at file %s, line %d", aStr, aExpr,
|
||||
aFile, aLine));
|
||||
Break(aFile, aLine);
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::Assertion(const char* aStr, const char* aExpr,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("Assertion: \"%s\" (%s) at file %s, line %d", aStr, aExpr,
|
||||
aFile, aLine));
|
||||
Break(aFile, aLine);
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::NotYetImplemented(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("NotYetImplemented: \"%s\" at file %s, line %d", aMessage,
|
||||
aFile, aLine));
|
||||
Break(aFile, aLine);
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::NotReached(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("NotReached: \"%s\" at file %s, line %d", aMessage, aFile, aLine));
|
||||
Break(aFile, aLine);
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::Error(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("Error: \"%s\" at file %s, line %d", aMessage, aFile, aLine));
|
||||
Break(aFile, aLine);
|
||||
}
|
||||
|
||||
NS_COM void nsDebug::Warning(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine)
|
||||
{
|
||||
InitLog();
|
||||
PR_LOG(gDebugLog, PR_LOG_ERROR,
|
||||
("Warning: \"%s\" at file %s, line %d", aMessage, aFile, aLine));
|
||||
}
|
||||
179
mozilla/xpcom/glue/nsDebug.h
Normal file
179
mozilla/xpcom/glue/nsDebug.h
Normal file
@@ -0,0 +1,179 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsDebug_h___
|
||||
#define nsDebug_h___
|
||||
|
||||
#include "nsCom.h"
|
||||
#include "prtypes.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define NS_DEBUG
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Namespace for debugging methods. Note that your code must use the
|
||||
* macros defined later in this file so that the debug code can be
|
||||
* conditionally compiled out.
|
||||
*/
|
||||
class nsDebug {
|
||||
public:
|
||||
// XXX add in log controls here
|
||||
// XXX probably want printf type arguments
|
||||
|
||||
/**
|
||||
* Abort the executing program. This works on all architectures.
|
||||
*/
|
||||
static NS_COM void Abort(const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Break the executing program into the debugger.
|
||||
*/
|
||||
static NS_COM void Break(const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log a pre-condition message to the debug log
|
||||
*/
|
||||
static NS_COM void PreCondition(const char* aStr, const char* aExpr,
|
||||
const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log a post-condition message to the debug log
|
||||
*/
|
||||
static NS_COM void PostCondition(const char* aStr, const char* aExpr,
|
||||
const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log an assertion message to the debug log
|
||||
*/
|
||||
static NS_COM void Assertion(const char* aStr, const char* aExpr,
|
||||
const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log a not-yet-implemented message to the debug log
|
||||
*/
|
||||
static NS_COM void NotYetImplemented(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log a not-reached message to the debug log
|
||||
*/
|
||||
static NS_COM void NotReached(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log an error message to the debug log. This call returns.
|
||||
*/
|
||||
static NS_COM void Error(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine);
|
||||
|
||||
/**
|
||||
* Log a warning message to the debug log.
|
||||
*/
|
||||
static NS_COM void Warning(const char* aMessage,
|
||||
const char* aFile, PRIntn aLine);
|
||||
};
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
/**
|
||||
* Test a precondition for truth. If the expression is not true then
|
||||
* trigger a program failure.
|
||||
*/
|
||||
#define NS_PRECONDITION(expr,str) \
|
||||
if (!(expr)) \
|
||||
nsDebug::PreCondition(str, #expr, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Test an assertion for truth. If the expression is not true then
|
||||
* trigger a program failure.
|
||||
*/
|
||||
#define NS_ASSERTION(expr,str) \
|
||||
if (!(expr)) \
|
||||
nsDebug::Assertion(str, #expr, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Test an assertion for truth. If the expression is not true then
|
||||
* trigger a program failure. The expression will still be
|
||||
* executed in release mode.
|
||||
*/
|
||||
#define NS_VERIFY(expr,str) \
|
||||
if (!(expr)) \
|
||||
nsDebug::Assertion(str, #expr, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Test a post-condition for truth. If the expression is not true then
|
||||
* trigger a program failure.
|
||||
*/
|
||||
#define NS_POSTCONDITION(expr,str) \
|
||||
if (!(expr)) \
|
||||
nsDebug::PostCondition(str, #expr, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* This macros triggers a program failure if executed. It indicates that
|
||||
* an attempt was made to execute some unimplimented functionality.
|
||||
*/
|
||||
#define NS_NOTYETIMPLEMENTED(str) \
|
||||
nsDebug::NotYetImplemented(str, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* This macros triggers a program failure if executed. It indicates that
|
||||
* an attempt was made to execute some unimplimented functionality.
|
||||
*/
|
||||
#define NS_NOTREACHED(str) \
|
||||
nsDebug::NotReached(str, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Log an error message.
|
||||
*/
|
||||
#define NS_ERROR(str) \
|
||||
nsDebug::Error(str, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Log a warning message.
|
||||
*/
|
||||
#define NS_WARNING(str) \
|
||||
nsDebug::Warning(str, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Trigger an abort
|
||||
*/
|
||||
#define NS_ABORT() \
|
||||
nsDebug::Abort(__FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Cause a break
|
||||
*/
|
||||
#define NS_BREAK() \
|
||||
nsDebug::Break(__FILE__, __LINE__)
|
||||
|
||||
#else /* NS_DEBUG */
|
||||
|
||||
#define NS_PRECONDITION(expr,str) {}
|
||||
#define NS_ASSERTION(expr,str) {}
|
||||
#define NS_VERIFY(expr,str) expr
|
||||
#define NS_POSTCONDITION(expr,str) {}
|
||||
#define NS_NOTYETIMPLEMENTED(str) {}
|
||||
#define NS_NOTREACHED(str) {}
|
||||
#define NS_ERROR(str) {}
|
||||
#define NS_WARNING(str) {}
|
||||
#define NS_ABORT() {}
|
||||
#define NS_BREAK() {}
|
||||
|
||||
#endif /* ! NS_DEBUG */
|
||||
|
||||
#endif /* nsDebug_h___ */
|
||||
30
mozilla/xpcom/libxpt/Makefile.in
Normal file
30
mozilla/xpcom/libxpt/Makefile.in
Normal file
@@ -0,0 +1,30 @@
|
||||
#!gmake
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
DIRS += tests
|
||||
|
||||
DIRS += tools
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
21
mozilla/xpcom/libxpt/makefile.win
Normal file
21
mozilla/xpcom/libxpt/makefile.win
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=..\..
|
||||
IGNORE_MANIFEST=1
|
||||
DIRS=public src # tests tools
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
32
mozilla/xpcom/libxpt/public/Makefile.in
Normal file
32
mozilla/xpcom/libxpt/public/Makefile.in
Normal file
@@ -0,0 +1,32 @@
|
||||
#!gmake
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = libxpt
|
||||
|
||||
EXPORTS = xpt_struct.h \
|
||||
xpt_xdr.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
28
mozilla/xpcom/libxpt/public/makefile.win
Normal file
28
mozilla/xpcom/libxpt/public/makefile.win
Normal file
@@ -0,0 +1,28 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
DEPTH=..\..\..
|
||||
|
||||
EXPORTS = xpt_struct.h \
|
||||
xpt_xdr.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE = libxpt
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
405
mozilla/xpcom/libxpt/public/xpt_struct.h
Normal file
405
mozilla/xpcom/libxpt/public/xpt_struct.h
Normal file
@@ -0,0 +1,405 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structures matching the in-memory representation of typelib structures.
|
||||
* http://www.mozilla.org/scriptable/typelib_file.html
|
||||
*/
|
||||
|
||||
#ifndef __xpt_struct_h__
|
||||
#define __xpt_struct_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
/*
|
||||
* The linkage of XPT API functions differs depending on whether the file is
|
||||
* used within the XPT library or not. Any source file within the XPT
|
||||
* library should define EXPORT_XPT_API whereas any client of the library
|
||||
* should not.
|
||||
*/
|
||||
#ifdef EXPORT_XPT_API
|
||||
#define XPT_PUBLIC_API(t) PR_IMPLEMENT(t)
|
||||
#define XPT_PUBLIC_DATA(t) PR_IMPLEMENT_DATA(t)
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
# define XPT_PUBLIC_API(t) _declspec(dllimport) t
|
||||
# define XPT_PUBLIC_DATA(t) _declspec(dllimport) t
|
||||
#else
|
||||
# define XPT_PUBLIC_API(t) PR_IMPLEMENT(t)
|
||||
# define XPT_PUBLIC_DATA(t) t
|
||||
#endif
|
||||
#endif
|
||||
#define XPT_FRIEND_API(t) XPT_PUBLIC_API(t)
|
||||
#define XPT_FRIEND_DATA(t) XPT_PUBLIC_DATA(t)
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
/*
|
||||
* Originally, I was going to have structures that exactly matched the on-disk
|
||||
* representation, but that proved difficult: different compilers can pack
|
||||
* their structs differently, and that makes overlaying them atop a
|
||||
* read-from-disk byte buffer troublesome. So now I just have some structures
|
||||
* that are used in memory, and we're going to write a nice XDR library to
|
||||
* write them to disk and stuff. It is pure joy. -- shaver
|
||||
*/
|
||||
|
||||
/* Structures for the typelib components */
|
||||
|
||||
typedef struct XPTHeader XPTHeader;
|
||||
typedef struct XPTInterfaceDirectoryEntry XPTInterfaceDirectoryEntry;
|
||||
typedef struct XPTInterfaceDescriptor XPTInterfaceDescriptor;
|
||||
typedef struct XPTConstDescriptor XPTConstDescriptor;
|
||||
typedef struct XPTMethodDescriptor XPTMethodDescriptor;
|
||||
typedef struct XPTParamDescriptor XPTParamDescriptor;
|
||||
typedef struct XPTTypeDescriptor XPTTypeDescriptor;
|
||||
typedef struct XPTTypeDescriptorPrefix XPTTypeDescriptorPrefix;
|
||||
typedef struct XPTString XPTString;
|
||||
typedef struct XPTAnnotation XPTAnnotation;
|
||||
#ifndef nsID_h__
|
||||
/*
|
||||
* We can't include nsID.h, because it's full of C++ goop and we're not doing
|
||||
* C++ here, so we define our own minimal struct. We protect against multiple
|
||||
* definitions of this struct, though, and use the same field naming.
|
||||
*/
|
||||
struct nsID {
|
||||
PRUint32 m0;
|
||||
PRUint16 m1;
|
||||
PRUint16 m2;
|
||||
PRUint8 m3[8];
|
||||
};
|
||||
|
||||
typedef struct nsID nsID;
|
||||
#endif
|
||||
|
||||
#define XPT_COPY_IID(to, from) \
|
||||
(to).m0 = (from).m0; \
|
||||
(to).m1 = (from).m1; \
|
||||
(to).m2 = (from).m2; \
|
||||
(to).m3[0] = (from).m3[0]; \
|
||||
(to).m3[1] = (from).m3[1]; \
|
||||
(to).m3[2] = (from).m3[2]; \
|
||||
(to).m3[3] = (from).m3[3]; \
|
||||
(to).m3[4] = (from).m3[4]; \
|
||||
(to).m3[5] = (from).m3[5]; \
|
||||
(to).m3[6] = (from).m3[6]; \
|
||||
(to).m3[7] = (from).m3[7];
|
||||
|
||||
|
||||
/*
|
||||
* Every XPCOM typelib file begins with a header.
|
||||
*/
|
||||
struct XPTHeader {
|
||||
char magic[16];
|
||||
uint8 major_version;
|
||||
uint8 minor_version;
|
||||
uint16 num_interfaces;
|
||||
uint32 file_length;
|
||||
XPTInterfaceDirectoryEntry *interface_directory;
|
||||
uint32 data_pool;
|
||||
XPTAnnotation *annotations;
|
||||
};
|
||||
|
||||
#define XPT_MAGIC "XPCOM\nTypeLib\r\n\032"
|
||||
#define XPT_MAJOR_VERSION 0x01
|
||||
#define XPT_MINOR_VERSION 0x00
|
||||
|
||||
extern XPT_PUBLIC_API(XPTHeader *)
|
||||
XPT_NewHeader(uint32 num_interfaces);
|
||||
|
||||
/* size of header and annotations */
|
||||
extern XPT_PUBLIC_API(uint32)
|
||||
XPT_SizeOfHeader(XPTHeader *header);
|
||||
|
||||
/* size of header and annotations and InterfaceDirectoryEntries */
|
||||
extern XPT_PUBLIC_API(uint32)
|
||||
XPT_SizeOfHeaderBlock(XPTHeader *header);
|
||||
|
||||
/*
|
||||
* A contiguous array of fixed-size InterfaceDirectoryEntry records begins at
|
||||
* the byte offset identified by the interface_directory field in the file
|
||||
* header. The array is used to quickly locate an interface description
|
||||
* using its IID. No interface should appear more than once in the array.
|
||||
*/
|
||||
struct XPTInterfaceDirectoryEntry {
|
||||
nsID iid;
|
||||
char *name;
|
||||
char *name_space;
|
||||
XPTInterfaceDescriptor *interface_descriptor;
|
||||
#if 0 /* not yet */
|
||||
/* not stored on disk */
|
||||
uint32 offset; /* the offset for an ID still to be read */
|
||||
#endif
|
||||
};
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_FillInterfaceDirectoryEntry(XPTInterfaceDirectoryEntry *ide,
|
||||
nsID *iid, char *name, char *name_space,
|
||||
XPTInterfaceDescriptor *descriptor);
|
||||
|
||||
/*
|
||||
* An InterfaceDescriptor is a variable-size record used to describe a
|
||||
* single XPCOM interface, including all of its methods.
|
||||
*/
|
||||
struct XPTInterfaceDescriptor {
|
||||
XPTInterfaceDirectoryEntry *parent_interface;
|
||||
uint16 num_methods;
|
||||
XPTMethodDescriptor *method_descriptors;
|
||||
uint16 num_constants;
|
||||
XPTConstDescriptor *const_descriptors;
|
||||
};
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_GetInterfaceIndexByName(XPTInterfaceDirectoryEntry *ide_block,
|
||||
uint32 num_interfaces, char *name,
|
||||
uint16 *indexp);
|
||||
|
||||
extern XPT_PUBLIC_API(XPTInterfaceDescriptor *)
|
||||
XPT_NewInterfaceDescriptor(uint32 parent_interface, uint32 num_methods,
|
||||
uint32 num_constants);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_InterfaceDescriptorAddMethods(XPTInterfaceDescriptor *id, uint16 num);
|
||||
|
||||
/*
|
||||
* This is our special string struct with a length value associated with it,
|
||||
* which means that it can contains embedded NULs.
|
||||
*/
|
||||
struct XPTString {
|
||||
uint16 length;
|
||||
char *bytes;
|
||||
};
|
||||
|
||||
extern XPT_PUBLIC_API(XPTString *)
|
||||
XPT_NewString(uint16 length, char *bytes);
|
||||
|
||||
extern XPT_PUBLIC_API(XPTString *)
|
||||
XPT_NewStringZ(char *bytes);
|
||||
|
||||
/*
|
||||
* A TypeDescriptor is a variable-size record used to identify the type of a
|
||||
* method argument or return value.
|
||||
*
|
||||
* There are three types of TypeDescriptors:
|
||||
*
|
||||
* SimpleTypeDescriptor
|
||||
* InterfaceTypeDescriptor
|
||||
* InterfaceIsTypeDescriptor
|
||||
*
|
||||
* The tag field in the prefix indicates which of the variant TypeDescriptor
|
||||
* records is being used, and hence the way any remaining fields should be
|
||||
* parsed. Values from 0 to 17 refer to SimpleTypeDescriptors. The value 18
|
||||
* designates an InterfaceTypeDescriptor, while 19 represents an
|
||||
* InterfaceIsTypeDescriptor.
|
||||
*/
|
||||
|
||||
/* XXX why bother with a struct? */
|
||||
struct XPTTypeDescriptorPrefix {
|
||||
uint8 flags;
|
||||
};
|
||||
|
||||
/* flag bits -- fur and jband were right, I was miserably wrong */
|
||||
#define XPT_TDP_POINTER 0x80
|
||||
#define XPT_TDP_UNIQUE_POINTER 0x40
|
||||
#define XPT_TDP_REFERENCE 0x20
|
||||
#define XPT_TDP_FLAGMASK 0xe0
|
||||
#define XPT_TDP_TAGMASK (~XPT_TDP_FLAGMASK)
|
||||
#define XPT_TDP_TAG(tdp) ((tdp).flags & XPT_TDP_TAGMASK)
|
||||
|
||||
#define XPT_TDP_IS_POINTER(flags) (flags & XPT_TDP_POINTER)
|
||||
#define XPT_TDP_IS_UNIQUE_POINTER(flags) (flags & XPT_TDP_UNIQUE_POINTER)
|
||||
#define XPT_TDP_IS_REFERENCE(flags) (flags & XPT_TDP_REFERENCE)
|
||||
|
||||
/* XXX TD #defines should include required flag bits! */
|
||||
|
||||
/*
|
||||
* The following enum maps mnemonic names to the different numeric values
|
||||
* of XPTTypeDescriptor->tag.
|
||||
*/
|
||||
enum XPTTypeDescriptorTags {
|
||||
TD_INT8 = 0,
|
||||
TD_INT16 = 1,
|
||||
TD_INT32 = 2,
|
||||
TD_INT64 = 3,
|
||||
TD_UINT8 = 4,
|
||||
TD_UINT16 = 5,
|
||||
TD_UINT32 = 6,
|
||||
TD_UINT64 = 7,
|
||||
TD_FLOAT = 8,
|
||||
TD_DOUBLE = 9,
|
||||
TD_BOOL = 10,
|
||||
TD_CHAR = 11,
|
||||
TD_WCHAR = 12,
|
||||
TD_VOID = 13,
|
||||
TD_PNSIID = 14,
|
||||
TD_PBSTR = 15,
|
||||
TD_PSTRING = 16,
|
||||
TD_PWSTRING = 17,
|
||||
TD_INTERFACE_TYPE = 18,
|
||||
TD_INTERFACE_IS_TYPE = 19
|
||||
};
|
||||
|
||||
struct XPTTypeDescriptor {
|
||||
XPTTypeDescriptorPrefix prefix;
|
||||
union {
|
||||
uint32 interface;
|
||||
uint8 argnum;
|
||||
} type;
|
||||
};
|
||||
|
||||
#define XPT_TYPEDESCRIPTOR_SIZE (1 + 4)
|
||||
|
||||
#define XPT_COPY_TYPE(to, from) \
|
||||
(to).prefix.flags = (from).prefix.flags; \
|
||||
(to).type.interface = (from).type.interface;
|
||||
|
||||
/*
|
||||
* A ConstDescriptor is a variable-size record that records the name and
|
||||
* value of a scoped interface constant.
|
||||
*
|
||||
* The types of the method parameter are restricted to the following subset
|
||||
* of TypeDescriptors:
|
||||
*
|
||||
* int8, uint8, int16, uint16, int32, uint32,
|
||||
* int64, uint64, wchar_t, char, string
|
||||
*
|
||||
* The type (and thus the size) of the value record is determined by the
|
||||
* contents of the associated TypeDescriptor record. For instance, if type
|
||||
* corresponds to int16, then value is a two-byte record consisting of a
|
||||
* 16-bit signed integer. For a ConstDescriptor type of string, the value
|
||||
* record is of type String*, i.e. an offset within the data pool to a
|
||||
* String record containing the constant string.
|
||||
*/
|
||||
union XPTConstValue {
|
||||
int8 i8;
|
||||
uint8 ui8;
|
||||
int16 i16;
|
||||
uint16 ui16;
|
||||
int32 i32;
|
||||
uint32 ui32;
|
||||
int64 i64;
|
||||
uint64 ui64;
|
||||
float flt;
|
||||
double dbl;
|
||||
PRBool bul;
|
||||
char ch;
|
||||
uint16 wch;
|
||||
nsID *iid;
|
||||
XPTString *string;
|
||||
char *str;
|
||||
uint16 *wstr;
|
||||
}; /* varies according to type */
|
||||
|
||||
struct XPTConstDescriptor {
|
||||
char *name;
|
||||
XPTTypeDescriptor type;
|
||||
union XPTConstValue value;
|
||||
};
|
||||
|
||||
/*
|
||||
* A ParamDescriptor is a variable-size record used to describe either a
|
||||
* single argument to a method or a method's result.
|
||||
*/
|
||||
struct XPTParamDescriptor {
|
||||
uint8 flags;
|
||||
XPTTypeDescriptor type;
|
||||
};
|
||||
|
||||
/* flag bits -- jband and fur were right, and I was miserably wrong */
|
||||
#define XPT_PD_IN 0x80
|
||||
#define XPT_PD_OUT 0x40
|
||||
#define XPT_PD_RETVAL 0x20
|
||||
#define XPT_PD_FLAGMASK 0x70
|
||||
|
||||
#define XPT_PD_IS_IN(flags) (flags & XPT_PD_IN)
|
||||
#define XPT_PD_IS_OUT(flags) (flags & XPT_PD_OUT)
|
||||
#define XPT_PD_IS_RETVAL(flags) (flags & XPT_PD_RETVAL)
|
||||
|
||||
#define XPT_PARAMDESCRIPTOR_SIZE (XPT_TYPEDESCRIPTOR_SIZE + 1)
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_FillParamDescriptor(XPTParamDescriptor *pd, uint8 flags,
|
||||
XPTTypeDescriptor *type);
|
||||
|
||||
/*
|
||||
* A MethodDescriptor is a variable-size record used to describe a single
|
||||
* interface method.
|
||||
*/
|
||||
struct XPTMethodDescriptor {
|
||||
uint8 flags;
|
||||
char *name;
|
||||
uint8 num_args;
|
||||
XPTParamDescriptor *params;
|
||||
XPTParamDescriptor *result;
|
||||
};
|
||||
|
||||
/* flag bits -- jband and fur were right, and I was miserably wrong */
|
||||
#define XPT_MD_GETTER 0x80
|
||||
#define XPT_MD_SETTER 0x40
|
||||
#define XPT_MD_VARARGS 0x20
|
||||
#define XPT_MD_CTOR 0x10
|
||||
#define XPT_MD_HIDDEN 0x08
|
||||
#define XPT_MD_FLAGMASK 0xf8
|
||||
|
||||
#define XPT_MD_IS_GETTER(flags) (flags & XPT_MD_GETTER)
|
||||
#define XPT_MD_IS_SETTER(flags) (flags & XPT_MD_SETTER)
|
||||
#define XPT_MD_IS_VARARGS(flags) (flags & XPT_MD_VARARGS)
|
||||
#define XPT_MD_IS_CTOR(flags) (flags & XPT_MD_CTOR)
|
||||
#define XPT_MD_IS_HIDDEN(flags) (flags & XPT_MD_HIDDEN)
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_FillMethodDescriptor(XPTMethodDescriptor *meth, uint8 flags, char *name,
|
||||
uint8 num_args);
|
||||
|
||||
/*
|
||||
* Annotation records are variable-size records used to store secondary
|
||||
* information about the typelib, e.g. such as the name of the tool that
|
||||
* generated the typelib file, the date it was generated, etc. The
|
||||
* information is stored with very loose format requirements so as to
|
||||
* allow virtually any private data to be stored in the typelib.
|
||||
*
|
||||
* There are two types of Annotations:
|
||||
*
|
||||
* EmptyAnnotation
|
||||
* PrivateAnnotation
|
||||
*
|
||||
* The tag field of the prefix discriminates among the variant record
|
||||
* types for Annotation's. If the tag is 0, this record is an
|
||||
* EmptyAnnotation. EmptyAnnotation's are ignored - they're only used to
|
||||
* indicate an array of Annotation's that's completely empty. If the tag
|
||||
* is 1, the record is a PrivateAnnotation.
|
||||
*/
|
||||
|
||||
struct XPTAnnotation {
|
||||
XPTAnnotation *next;
|
||||
uint8 flags;
|
||||
/* remaining fields are present in typelib iff XPT_ANN_IS_PRIVATE */
|
||||
XPTString *creator;
|
||||
XPTString *private_data;
|
||||
};
|
||||
|
||||
#define XPT_ANN_LAST 0x80
|
||||
#define XPT_ANN_IS_LAST(flags) (flags & XPT_ANN_LAST)
|
||||
#define XPT_ANN_PRIVATE 0x40
|
||||
#define XPT_ANN_IS_PRIVATE(flags) (flags & XPT_ANN_PRIVATE)
|
||||
|
||||
extern XPT_PUBLIC_API(XPTAnnotation *)
|
||||
XPT_NewAnnotation(uint8 flags, XPTString *creator, XPTString *private_data);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* __xpt_struct_h__ */
|
||||
214
mozilla/xpcom/libxpt/public/xpt_xdr.h
Normal file
214
mozilla/xpcom/libxpt/public/xpt_xdr.h
Normal file
@@ -0,0 +1,214 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Basic APIs for streaming typelib structures to/from disk.
|
||||
*/
|
||||
|
||||
#ifndef __xpt_xdr_h__
|
||||
#define __xpt_xdr_h__
|
||||
|
||||
#include <nspr.h>
|
||||
#include <plhash.h>
|
||||
#include <prmem.h>
|
||||
#include "xpt_struct.h"
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
typedef struct XPTState XPTState;
|
||||
typedef struct XPTDatapool XPTDatapool;
|
||||
typedef struct XPTCursor XPTCursor;
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoString(XPTCursor *cursor, XPTString **strp);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoStringInline(XPTCursor *cursor, XPTString **strp);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoCString(XPTCursor *cursor, char **strp);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoIdentifier(XPTCursor *cursor, char **identp);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoIID(XPTCursor *cursor, nsID *iidp);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_Do64(XPTCursor *cursor, PRInt64 *u64p);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_Do32(XPTCursor *cursor, uint32 *u32p);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_Do16(XPTCursor *cursor, uint16 *u16p);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_Do8(XPTCursor *cursor, uint8 *u8p);
|
||||
|
||||
/*
|
||||
* When working with bitfields, use the DoBits call with a uint8.
|
||||
* Only the appropriate number of bits are manipulated, so when
|
||||
* you're decoding you probably want to ensure that the uint8 is pre-zeroed.
|
||||
* When you're done sending bits along, use
|
||||
* XPT_FlushBits to make sure that you don't eat a leading bit from the
|
||||
* next structure. (You should probably be writing full bytes' worth of bits
|
||||
* anyway, and zeroing out the bits you don't use, but just to be sure...)
|
||||
*/
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoBits(XPTCursor *cursor, uint8 *u8p, int nbits);
|
||||
|
||||
#define XPT_DO_BITS(curs, field, width, scr) (PR_TRUE)
|
||||
|
||||
/* returns the number of bits skipped, which should be 0-7 */
|
||||
extern XPT_PUBLIC_API(int)
|
||||
XPT_FlushBits(XPTCursor *cursor);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoHeader(XPTCursor *cursor, XPTHeader **headerp);
|
||||
|
||||
typedef enum {
|
||||
XPT_ENCODE,
|
||||
XPT_DECODE
|
||||
} XPTMode;
|
||||
|
||||
typedef enum {
|
||||
XPT_HEADER = 0,
|
||||
XPT_DATA = 1
|
||||
} XPTPool;
|
||||
|
||||
struct XPTState {
|
||||
XPTMode mode;
|
||||
uint32 data_offset;
|
||||
uint32 next_cursor[2];
|
||||
XPTDatapool *pool;
|
||||
};
|
||||
|
||||
struct XPTDatapool {
|
||||
PLHashTable *offset_map;
|
||||
char *data;
|
||||
uint32 count;
|
||||
uint32 allocated;
|
||||
};
|
||||
|
||||
struct XPTCursor {
|
||||
XPTState *state;
|
||||
XPTPool pool;
|
||||
uint32 offset;
|
||||
uint8 bits;
|
||||
};
|
||||
|
||||
extern XPT_PUBLIC_API(XPTState *)
|
||||
XPT_NewXDRState(XPTMode mode, char *data, uint32 len);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_MakeCursor(XPTState *state, XPTPool pool, uint32 len, XPTCursor *cursor);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_SeekTo(XPTCursor *cursor, uint32 offset);
|
||||
|
||||
extern XPT_PUBLIC_API(void)
|
||||
XPT_DestroyXDRState(XPTState *state);
|
||||
|
||||
/* Set file_length based on the data used in the state. (Only ENCODE.) */
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_UpdateFileLength(XPTState *state);
|
||||
|
||||
extern XPT_PUBLIC_API(void)
|
||||
XPT_GetXDRData(XPTState *state, XPTPool pool, char **data, uint32 *len);
|
||||
|
||||
/* set or get the data offset for the state, depending on mode */
|
||||
extern XPT_PUBLIC_API(void)
|
||||
XPT_DataOffset(XPTState *state, uint32 *data_offsetp);
|
||||
|
||||
extern XPT_PUBLIC_API(void)
|
||||
XPT_SetDataOffset(XPTState *state, uint32 data_offset);
|
||||
|
||||
extern XPT_PUBLIC_API(uint32)
|
||||
XPT_GetOffsetForAddr(XPTCursor *cursor, void *addr);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_SetOffsetForAddr(XPTCursor *cursor, void *addr, uint32 offset);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_SetAddrForOffset(XPTCursor *cursor, uint32 offset, void *addr);
|
||||
|
||||
extern XPT_PUBLIC_API(void *)
|
||||
XPT_GetAddrForOffset(XPTCursor *cursor, uint32 offset);
|
||||
|
||||
/* all data structures are big-endian */
|
||||
|
||||
#if defined IS_BIG_ENDIAN
|
||||
# define XPT_SWAB32(x) x
|
||||
# define XPT_SWAB16(x) x
|
||||
#elif defined IS_LITTLE_ENDIAN
|
||||
# define XPT_SWAB32(x) (((x) >> 24) | \
|
||||
(((x) >> 8) & 0xff00) | \
|
||||
(((x) << 8) & 0xff0000) | \
|
||||
((x) << 24))
|
||||
# define XPT_SWAB16(x) (((x) >> 8) | ((x) << 8))
|
||||
#else
|
||||
# error "unknown byte order"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If we're decoding, we want to read the offset before we check
|
||||
* for already-decoded values.
|
||||
*
|
||||
* Then we check for repetition: CheckForRepeat will see if we've already
|
||||
* encoded/decoded this value, and if so will set offset/addr correctly
|
||||
* and make already be true. If not, it will set up the cursor for
|
||||
* encoding (reserve space) or decoding (seek to correct location) as
|
||||
* appropriate. In the encode case, it will also set the addr->offset
|
||||
* mapping.
|
||||
*/
|
||||
|
||||
#define XPT_PREAMBLE_(cursor, addrp, pool, size, new_curs, already) \
|
||||
XPTMode mode = cursor->state->mode; \
|
||||
if (!(mode == XPT_ENCODE || XPT_Do32(cursor, &new_curs.offset)) || \
|
||||
!CheckForRepeat(cursor, (void **)addrp, pool, \
|
||||
mode == XPT_ENCODE ? size : 0, &new_curs, \
|
||||
&already) || \
|
||||
!(mode == XPT_DECODE || XPT_Do32(cursor, &new_curs.offset))) \
|
||||
return PR_FALSE; \
|
||||
if (already) \
|
||||
return PR_TRUE; \
|
||||
|
||||
#define XPT_PREAMBLE(cursor, addrp, pool, size, new_curs, already, \
|
||||
XPTType, localp) \
|
||||
{ \
|
||||
XPT_PREAMBLE_(cursor, addrp, pool, size, new_curs, already); \
|
||||
XPT_ALLOC(addrp, new_curs, XPTType, localp) \
|
||||
}
|
||||
|
||||
#define XPT_PREAMBLE_NO_ALLOC(cursor, addrp, pool, size, new_curs, already) \
|
||||
{ \
|
||||
XPT_PREAMBLE_(cursor, addrp, pool, size, new_curs, already) \
|
||||
}
|
||||
|
||||
#define XPT_ERROR_HANDLE(free_it) \
|
||||
error: \
|
||||
if (cursor->state->mode == XPT_DECODE) \
|
||||
PR_FREEIF(free_it); \
|
||||
return PR_FALSE;
|
||||
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* __xpt_xdr_h__ */
|
||||
33
mozilla/xpcom/libxpt/src/Makefile.in
Normal file
33
mozilla/xpcom/libxpt/src/Makefile.in
Normal file
@@ -0,0 +1,33 @@
|
||||
#!gmake
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = libxpt
|
||||
LIBRARY_NAME = xpt
|
||||
|
||||
CSRCS = xpt_struct.c \
|
||||
xpt_xdr.c \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = $(MODULE)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
52
mozilla/xpcom/libxpt/src/makefile.win
Normal file
52
mozilla/xpcom/libxpt/src/makefile.win
Normal file
@@ -0,0 +1,52 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
|
||||
DEPTH=..\..\..
|
||||
|
||||
LIBNAME = .\$(OBJDIR)\libxpt$(MOZ_BITS)
|
||||
DLL = $(LIBNAME).dll
|
||||
|
||||
LCFLAGS = -DEXPORT_XPT_API -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
LINCS = \
|
||||
-I$(PUBLIC)\libxpt \
|
||||
$(NULL)
|
||||
|
||||
LLIBS = $(LIBNSPR) \
|
||||
$(NULL)
|
||||
|
||||
CSRCS = \
|
||||
xpt_struct.c \
|
||||
xpt_xdr.c \
|
||||
$(NULL)
|
||||
|
||||
C_OBJS = \
|
||||
.\$(OBJDIR)\xpt_struct.obj \
|
||||
.\$(OBJDIR)\xpt_xdr.obj \
|
||||
$(NULL)
|
||||
|
||||
MODULE = libxpt
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(DLL)
|
||||
$(MAKE_INSTALL) $(LIBNAME).$(DLL_SUFFIX) $(DIST)\bin
|
||||
$(MAKE_INSTALL) $(LIBNAME).$(LIB_SUFFIX) $(DIST)\lib
|
||||
727
mozilla/xpcom/libxpt/src/xpt_struct.c
Normal file
727
mozilla/xpcom/libxpt/src/xpt_struct.c
Normal file
@@ -0,0 +1,727 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* Implementation of XDR routines for typelib structures. */
|
||||
|
||||
#include "xpt_xdr.h"
|
||||
#include "xpt_struct.h"
|
||||
#include <string.h>
|
||||
|
||||
static PRBool
|
||||
DoInterfaceDirectoryEntry(XPTCursor *cursor,
|
||||
XPTInterfaceDirectoryEntry *ide, uint16 index);
|
||||
static PRBool
|
||||
DoInterfaceDirectoryEntryIndex(XPTCursor *cursor,
|
||||
XPTInterfaceDirectoryEntry **idep);
|
||||
static PRBool
|
||||
DoConstDescriptor(XPTCursor *cursor, XPTConstDescriptor *cd);
|
||||
|
||||
static PRBool
|
||||
DoMethodDescriptor(XPTCursor *cursor, XPTMethodDescriptor *md);
|
||||
|
||||
static PRBool
|
||||
DoAnnotation(XPTCursor *cursor, XPTAnnotation **annp);
|
||||
|
||||
static PRBool
|
||||
DoInterfaceDescriptor(XPTCursor *outer, XPTInterfaceDescriptor **idp);
|
||||
|
||||
static PRBool
|
||||
DoTypeDescriptor(XPTCursor *cursor, XPTTypeDescriptor *td);
|
||||
|
||||
static PRBool
|
||||
DoParamDescriptor(XPTCursor *cursor, XPTParamDescriptor *pd);
|
||||
|
||||
|
||||
#define CURS_POOL_OFFSET_RAW(cursor) \
|
||||
((cursor)->pool == XPT_HEADER \
|
||||
? (cursor)->offset \
|
||||
: (PR_ASSERT((cursor)->state->data_offset), \
|
||||
(cursor)->offset + (cursor)->state->data_offset))
|
||||
|
||||
#define CURS_POOL_OFFSET(cursor) \
|
||||
(CURS_POOL_OFFSET_RAW(cursor) - 1)
|
||||
|
||||
XPT_PUBLIC_API(uint32)
|
||||
XPT_SizeOfHeader(XPTHeader *header)
|
||||
{
|
||||
XPTAnnotation *ann, *last;
|
||||
uint32 size = 16 /* magic */ +
|
||||
1 /* major */ + 1 /* minor */ +
|
||||
2 /* num_interfaces */ + 4 /* file_length */ +
|
||||
4 /* interface_directory */ + 4 /* data_pool */;
|
||||
|
||||
ann = header->annotations;
|
||||
do {
|
||||
size += 1; /* Annotation prefix */
|
||||
if (XPT_ANN_IS_PRIVATE(ann->flags))
|
||||
size += 2 + ann->creator->length + 2 + ann->private_data->length;
|
||||
last = ann;
|
||||
ann = ann->next;
|
||||
} while (!XPT_ANN_IS_LAST(last->flags));
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(uint32)
|
||||
XPT_SizeOfHeaderBlock(XPTHeader *header)
|
||||
{
|
||||
uint32 size = XPT_SizeOfHeader(header);
|
||||
|
||||
size += header->num_interfaces * sizeof (XPTInterfaceDirectoryEntry);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(XPTHeader *)
|
||||
XPT_NewHeader(uint32 num_interfaces)
|
||||
{
|
||||
XPTHeader *header = PR_NEWZAP(XPTHeader);
|
||||
if (!header)
|
||||
return NULL;
|
||||
memcpy(header->magic, XPT_MAGIC, 16);
|
||||
header->major_version = XPT_MAJOR_VERSION;
|
||||
header->minor_version = XPT_MINOR_VERSION;
|
||||
header->num_interfaces = num_interfaces;
|
||||
header->interface_directory = PR_CALLOC(num_interfaces *
|
||||
sizeof(XPTInterfaceDirectoryEntry));
|
||||
if (!header->interface_directory) {
|
||||
PR_DELETE(header);
|
||||
return NULL;
|
||||
}
|
||||
header->data_pool = 0; /* XXX do we even need this struct any more? */
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoHeader(XPTCursor *cursor, XPTHeader **headerp)
|
||||
{
|
||||
XPTMode mode = cursor->state->mode;
|
||||
XPTHeader *header;
|
||||
uint32 ide_offset;
|
||||
int i;
|
||||
|
||||
if (mode == XPT_DECODE) {
|
||||
header = PR_NEWZAP(XPTHeader);
|
||||
if (!header)
|
||||
return PR_FALSE;
|
||||
*headerp = header;
|
||||
} else {
|
||||
header = *headerp;
|
||||
}
|
||||
|
||||
if (mode == XPT_ENCODE) {
|
||||
/* IDEs appear after header, including annotations */
|
||||
ide_offset = XPT_SizeOfHeader(*headerp) + 1; /* one-based offset */
|
||||
header->data_pool = XPT_SizeOfHeaderBlock(*headerp);
|
||||
XPT_SetDataOffset(cursor->state, header->data_pool);
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (!XPT_Do8(cursor, &header->magic[i]))
|
||||
goto error;
|
||||
}
|
||||
|
||||
if(!XPT_Do8(cursor, &header->major_version) ||
|
||||
!XPT_Do8(cursor, &header->minor_version) ||
|
||||
/* XXX check major for compat! */
|
||||
!XPT_Do16(cursor, &header->num_interfaces) ||
|
||||
!XPT_Do32(cursor, &header->file_length) ||
|
||||
!XPT_Do32(cursor, &ide_offset)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (mode == XPT_ENCODE)
|
||||
XPT_DataOffset(cursor->state, &header->data_pool);
|
||||
if (!XPT_Do32(cursor, &header->data_pool))
|
||||
goto error;
|
||||
if (mode == XPT_DECODE)
|
||||
XPT_DataOffset(cursor->state, &header->data_pool);
|
||||
|
||||
if (mode == XPT_DECODE) {
|
||||
header->interface_directory =
|
||||
PR_CALLOC(header->num_interfaces *
|
||||
sizeof(XPTInterfaceDirectoryEntry));
|
||||
if (!header->interface_directory)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!DoAnnotation(cursor, &header->annotations))
|
||||
goto error;
|
||||
|
||||
/* shouldn't be necessary now, but maybe later */
|
||||
XPT_SeekTo(cursor, ide_offset);
|
||||
|
||||
for (i = 0; i < header->num_interfaces; i++) {
|
||||
if (!DoInterfaceDirectoryEntry(cursor,
|
||||
&header->interface_directory[i],
|
||||
i + 1))
|
||||
goto error;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
|
||||
/* XXX need to free child data sometimes! */
|
||||
XPT_ERROR_HANDLE(header);
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_FillInterfaceDirectoryEntry(XPTInterfaceDirectoryEntry *ide,
|
||||
nsID *iid, char *name, char *name_space,
|
||||
XPTInterfaceDescriptor *descriptor)
|
||||
{
|
||||
XPT_COPY_IID(ide->iid, *iid);
|
||||
ide->name = name ? strdup(name) : NULL; /* what good is it w/o a name? */
|
||||
ide->name_space = name_space ? strdup(name_space) : NULL;
|
||||
ide->interface_descriptor = descriptor;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/* InterfaceDirectoryEntry records go in the header */
|
||||
PRBool
|
||||
DoInterfaceDirectoryEntry(XPTCursor *cursor,
|
||||
XPTInterfaceDirectoryEntry *ide, uint16 index)
|
||||
{
|
||||
XPTMode mode = cursor->state->mode;
|
||||
|
||||
/* write the IID in our cursor space */
|
||||
if (!XPT_DoIID(cursor, &(ide->iid)) ||
|
||||
|
||||
/* write the name string in the data pool, and the offset in our
|
||||
cursor space */
|
||||
!XPT_DoCString(cursor, &(ide->name)) ||
|
||||
|
||||
/* write the name_space string in the data pool, and the offset in our
|
||||
cursor space */
|
||||
!XPT_DoCString(cursor, &(ide->name_space)) ||
|
||||
|
||||
/* do InterfaceDescriptors -- later, only on encode (see below) */
|
||||
!DoInterfaceDescriptor(cursor, &ide->interface_descriptor)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (mode == XPT_DECODE)
|
||||
XPT_SetOffsetForAddr(cursor, ide, index);
|
||||
|
||||
#if 0 /* not yet -- we eagerly load for now */
|
||||
/* write the InterfaceDescriptor in the data pool, and the offset
|
||||
in our cursor space, but only if we're encoding. */
|
||||
if (mode == XPT_ENCODE) {
|
||||
if (!DoInterfaceDescriptor(cursor,
|
||||
&ide->interface_descriptor)) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return PR_TRUE;
|
||||
|
||||
XPT_ERROR_HANDLE(ide);
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode: Get the interface directory entry for the on-disk index.
|
||||
* Encode: Write the index.
|
||||
*/
|
||||
PRBool
|
||||
DoInterfaceDirectoryEntryIndex(XPTCursor *cursor,
|
||||
XPTInterfaceDirectoryEntry **idep)
|
||||
{
|
||||
XPTMode mode = cursor->state->mode;
|
||||
uint16 index;
|
||||
|
||||
if (mode == XPT_ENCODE) {
|
||||
/* XXX index zero is legal, so how do I detect an error? */
|
||||
if (*idep) {
|
||||
index = XPT_GetOffsetForAddr(cursor, *idep);
|
||||
if (!index)
|
||||
return PR_FALSE;
|
||||
} else {
|
||||
index = 0; /* no interface */
|
||||
}
|
||||
}
|
||||
|
||||
if (!XPT_Do16(cursor, &index))
|
||||
return PR_FALSE;
|
||||
|
||||
if (mode == XPT_DECODE) {
|
||||
if (index) {
|
||||
*idep = XPT_GetAddrForOffset(cursor, index);
|
||||
if (!*idep)
|
||||
return PR_FALSE;
|
||||
} else {
|
||||
*idep = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(XPTInterfaceDescriptor *)
|
||||
XPT_NewInterfaceDescriptor(uint32 parent_interface, uint32 num_methods,
|
||||
uint32 num_constants)
|
||||
{
|
||||
XPTInterfaceDescriptor *id = PR_NEWZAP(XPTInterfaceDescriptor);
|
||||
if (!id)
|
||||
return NULL;
|
||||
|
||||
if (num_methods) {
|
||||
id->method_descriptors = PR_CALLOC(num_methods *
|
||||
sizeof(XPTMethodDescriptor));
|
||||
if (!id->method_descriptors)
|
||||
goto free_id;
|
||||
id->num_methods = num_methods;
|
||||
}
|
||||
|
||||
if (num_constants) {
|
||||
id->const_descriptors = PR_CALLOC(num_constants *
|
||||
sizeof(XPTConstDescriptor));
|
||||
if (!id->const_descriptors)
|
||||
goto free_meth;
|
||||
id->num_constants = num_constants;
|
||||
}
|
||||
|
||||
return id;
|
||||
|
||||
free_meth:
|
||||
PR_FREEIF(id->method_descriptors);
|
||||
free_id:
|
||||
PR_DELETE(id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_InterfaceDescriptorAddMethods(XPTInterfaceDescriptor *id, uint16 num)
|
||||
{
|
||||
XPTMethodDescriptor *old = id->method_descriptors, *new;
|
||||
|
||||
/* XXX should grow in chunks to minimize realloc overhead */
|
||||
new = PR_REALLOC(old,
|
||||
(id->num_methods + num) * sizeof(XPTMethodDescriptor));
|
||||
if (!new)
|
||||
return PR_FALSE;
|
||||
|
||||
memset(id->method_descriptors + id->num_methods, 0,
|
||||
sizeof(XPTMethodDescriptor) * num);
|
||||
id->method_descriptors = new;
|
||||
id->num_methods += num;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(uint32)
|
||||
XPT_SizeOfTypeDescriptor(XPTTypeDescriptor *td)
|
||||
{
|
||||
uint32 size = 1; /* prefix */
|
||||
if (XPT_TDP_TAG(td->prefix) == TD_INTERFACE_TYPE)
|
||||
size += 2; /* interface_index */
|
||||
else if (XPT_TDP_TAG(td->prefix) == TD_INTERFACE_IS_TYPE)
|
||||
size += 1; /* arg_num */
|
||||
return size;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(uint32)
|
||||
XPT_SizeOfMethodDescriptor(XPTMethodDescriptor *md)
|
||||
{
|
||||
uint32 i, size = 1 /* flags */ + 4 /* name */ + 1 /* num_args */;
|
||||
|
||||
for (i = 0; i < md->num_args; i++)
|
||||
size += 1 + XPT_SizeOfTypeDescriptor(&md->params[i].type);
|
||||
|
||||
size += 1 + XPT_SizeOfTypeDescriptor(&md->result->type);
|
||||
return size;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(uint32)
|
||||
XPT_SizeOfConstDescriptor(XPTConstDescriptor *cd)
|
||||
{
|
||||
uint32 size = 4 /* name */ + XPT_SizeOfTypeDescriptor(&cd->type);
|
||||
|
||||
switch (XPT_TDP_TAG(cd->type.prefix)) {
|
||||
case TD_INT8:
|
||||
case TD_UINT8:
|
||||
case TD_CHAR:
|
||||
size ++;
|
||||
break;
|
||||
case TD_INT16:
|
||||
case TD_UINT16:
|
||||
case TD_WCHAR:
|
||||
size += 2;
|
||||
break;
|
||||
case TD_INT32:
|
||||
case TD_UINT32:
|
||||
case TD_PBSTR: /* XXX check for pointer! */
|
||||
size += 4;
|
||||
break;
|
||||
case TD_INT64:
|
||||
case TD_UINT64:
|
||||
size += 8;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "libxpt: illegal type in ConstDescriptor: 0x%02x\n",
|
||||
XPT_TDP_TAG(cd->type.prefix));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(uint32)
|
||||
XPT_SizeOfInterfaceDescriptor(XPTInterfaceDescriptor *id)
|
||||
{
|
||||
uint32 size = 2 /* parent interface */ + 2 /* num_methods */
|
||||
+ 2 /* num_constants */, i;
|
||||
for (i = 0; i < id->num_methods; i++)
|
||||
size += XPT_SizeOfMethodDescriptor(&id->method_descriptors[i]);
|
||||
for (i = 0; i < id->num_constants; i++)
|
||||
size += XPT_SizeOfConstDescriptor(&id->const_descriptors[i]);
|
||||
return size;
|
||||
}
|
||||
|
||||
PRBool
|
||||
DoInterfaceDescriptor(XPTCursor *outer, XPTInterfaceDescriptor **idp)
|
||||
{
|
||||
XPTMode mode = outer->state->mode;
|
||||
XPTInterfaceDescriptor *id;
|
||||
XPTCursor curs, *cursor = &curs;
|
||||
uint32 i, id_sz = 0;
|
||||
|
||||
if (mode == XPT_DECODE) {
|
||||
id = PR_NEWZAP(XPTInterfaceDescriptor);
|
||||
if (!id)
|
||||
return PR_FALSE;
|
||||
*idp = id;
|
||||
} else {
|
||||
id = *idp;
|
||||
if (!id) {
|
||||
id_sz = 0;
|
||||
return XPT_Do32(outer, &id_sz);
|
||||
}
|
||||
id_sz = XPT_SizeOfInterfaceDescriptor(id);
|
||||
}
|
||||
|
||||
if (!XPT_MakeCursor(outer->state, XPT_DATA, id_sz, cursor))
|
||||
goto error;
|
||||
|
||||
if (!XPT_Do32(outer, &cursor->offset))
|
||||
goto error;
|
||||
if (mode == XPT_DECODE && !cursor->offset) {
|
||||
*idp = NULL;
|
||||
return PR_TRUE;
|
||||
}
|
||||
if(!DoInterfaceDirectoryEntryIndex(cursor, &id->parent_interface) ||
|
||||
!XPT_Do16(cursor, &id->num_methods)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (mode == XPT_DECODE && id->num_methods) {
|
||||
id->method_descriptors = PR_CALLOC(id->num_methods *
|
||||
sizeof(XPTMethodDescriptor));
|
||||
if (!id->method_descriptors)
|
||||
goto error;
|
||||
}
|
||||
|
||||
for (i = 0; i < id->num_methods; i++) {
|
||||
if (!DoMethodDescriptor(cursor, &id->method_descriptors[i]))
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!XPT_Do16(cursor, &id->num_constants)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (mode == XPT_DECODE)
|
||||
id->const_descriptors = PR_CALLOC(id->num_constants *
|
||||
sizeof(XPTConstDescriptor));
|
||||
|
||||
for (i = 0; i < id->num_constants; i++) {
|
||||
if (!DoConstDescriptor(cursor, &id->const_descriptors[i])) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
|
||||
XPT_ERROR_HANDLE(id);
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_FillConstDescriptor(XPTConstDescriptor *cd, char *name,
|
||||
XPTTypeDescriptor type, union XPTConstValue value)
|
||||
{
|
||||
cd->name = strdup(name);
|
||||
if (!cd->name)
|
||||
return PR_FALSE;
|
||||
XPT_COPY_TYPE(cd->type, type);
|
||||
/* XXX copy value */
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
DoConstDescriptor(XPTCursor *cursor, XPTConstDescriptor *cd)
|
||||
{
|
||||
PRBool ok = PR_FALSE;
|
||||
|
||||
if (!XPT_DoCString(cursor, &cd->name) ||
|
||||
!DoTypeDescriptor(cursor, &cd->type)) {
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
switch(XPT_TDP_TAG(cd->type.prefix)) {
|
||||
case TD_INT8:
|
||||
ok = XPT_Do8(cursor, &cd->value.i8);
|
||||
break;
|
||||
case TD_INT16:
|
||||
ok = XPT_Do16(cursor, &cd->value.i16);
|
||||
break;
|
||||
case TD_INT32:
|
||||
ok = XPT_Do32(cursor, &cd->value.i32);
|
||||
break;
|
||||
case TD_INT64:
|
||||
ok = XPT_Do64(cursor, &cd->value.i64);
|
||||
break;
|
||||
case TD_UINT8:
|
||||
ok = XPT_Do8(cursor, &cd->value.ui8);
|
||||
break;
|
||||
case TD_UINT16:
|
||||
ok = XPT_Do16(cursor, &cd->value.ui16);
|
||||
break;
|
||||
case TD_UINT32:
|
||||
ok = XPT_Do32(cursor, &cd->value.ui32);
|
||||
break;
|
||||
case TD_UINT64:
|
||||
ok = XPT_Do64(cursor, &cd->value.ui64);
|
||||
break;
|
||||
case TD_CHAR:
|
||||
ok = XPT_Do8(cursor, &cd->value.ch);
|
||||
break;
|
||||
case TD_WCHAR:
|
||||
ok = XPT_Do16(cursor, &cd->value.wch);
|
||||
break;
|
||||
case TD_PBSTR:
|
||||
if (cd->type.prefix.flags & XPT_TDP_POINTER) {
|
||||
ok = XPT_DoString(cursor, &cd->value.string);
|
||||
break;
|
||||
}
|
||||
/* fall-through */
|
||||
default:
|
||||
fprintf(stderr, "illegal type!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
return ok;
|
||||
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_FillMethodDescriptor(XPTMethodDescriptor *meth, uint8 flags, char *name,
|
||||
uint8 num_args)
|
||||
{
|
||||
meth->flags = flags & XPT_MD_FLAGMASK;
|
||||
meth->name = strdup(name);
|
||||
if (!name)
|
||||
return PR_FALSE;
|
||||
meth->num_args = num_args;
|
||||
if (meth->num_args) {
|
||||
meth->params = PR_CALLOC(num_args * sizeof(XPTParamDescriptor));
|
||||
if (!meth->params)
|
||||
goto free_name;
|
||||
} else {
|
||||
meth->params = NULL;
|
||||
}
|
||||
meth->result = PR_NEWZAP(XPTParamDescriptor);
|
||||
if (!meth->result)
|
||||
goto free_params;
|
||||
return PR_TRUE;
|
||||
|
||||
free_params:
|
||||
PR_DELETE(meth->params);
|
||||
free_name:
|
||||
PR_DELETE(meth->name);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
DoMethodDescriptor(XPTCursor *cursor, XPTMethodDescriptor *md)
|
||||
{
|
||||
XPTMode mode = cursor->state->mode;
|
||||
int i;
|
||||
|
||||
if (!XPT_Do8(cursor, &md->flags) ||
|
||||
!XPT_DoCString(cursor, &md->name) ||
|
||||
!XPT_Do8(cursor, &md->num_args))
|
||||
return PR_FALSE;
|
||||
|
||||
if (mode == XPT_DECODE && md->num_args) {
|
||||
md->params = PR_CALLOC(md->num_args * sizeof(XPTParamDescriptor));
|
||||
if (!md->params)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
for(i = 0; i < md->num_args; i++) {
|
||||
if (!DoParamDescriptor(cursor, &md->params[i]))
|
||||
goto error;
|
||||
}
|
||||
|
||||
md->result = PR_NEWZAP(XPTParamDescriptor);
|
||||
if (!md->result ||
|
||||
!DoParamDescriptor(cursor, md->result))
|
||||
goto error;
|
||||
|
||||
return PR_TRUE;
|
||||
|
||||
XPT_ERROR_HANDLE(md->params);
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_FillParamDescriptor(XPTParamDescriptor *pd, uint8 flags,
|
||||
XPTTypeDescriptor *type)
|
||||
{
|
||||
pd->flags = flags & XPT_PD_FLAGMASK;
|
||||
XPT_COPY_TYPE(pd->type, *type);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
DoParamDescriptor(XPTCursor *cursor, XPTParamDescriptor *pd)
|
||||
{
|
||||
if (!XPT_Do8(cursor, &pd->flags) ||
|
||||
!DoTypeDescriptor(cursor, &pd->type))
|
||||
return PR_FALSE;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/* XXX when we lose the useless TDP wrapper struct, #define this to Do8 */
|
||||
PRBool
|
||||
DoTypeDescriptorPrefix(XPTCursor *cursor, XPTTypeDescriptorPrefix *tdp)
|
||||
{
|
||||
return XPT_Do8(cursor, &tdp->flags);
|
||||
}
|
||||
|
||||
PRBool
|
||||
DoTypeDescriptor(XPTCursor *cursor, XPTTypeDescriptor *td)
|
||||
{
|
||||
if (!DoTypeDescriptorPrefix(cursor, &td->prefix)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (XPT_TDP_TAG(td->prefix) == TD_INTERFACE_TYPE) {
|
||||
if (!XPT_Do32(cursor, &td->type.interface))
|
||||
goto error;
|
||||
} else {
|
||||
if (XPT_TDP_TAG(td->prefix) == TD_INTERFACE_IS_TYPE) {
|
||||
if (!XPT_Do8(cursor, &td->type.argnum))
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
|
||||
XPT_ERROR_HANDLE(td);
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(XPTAnnotation *)
|
||||
XPT_NewAnnotation(uint8 flags, XPTString *creator, XPTString *private_data)
|
||||
{
|
||||
XPTAnnotation *ann = PR_NEWZAP(XPTAnnotation);
|
||||
if (!ann)
|
||||
return NULL;
|
||||
ann->flags = flags;
|
||||
if (XPT_ANN_IS_PRIVATE(flags)) {
|
||||
ann->creator = creator;
|
||||
ann->private_data = private_data;
|
||||
}
|
||||
return ann;
|
||||
}
|
||||
|
||||
PRBool
|
||||
DoAnnotation(XPTCursor *cursor, XPTAnnotation **annp)
|
||||
{
|
||||
XPTMode mode = cursor->state->mode;
|
||||
XPTAnnotation *ann;
|
||||
|
||||
if (mode == XPT_DECODE) {
|
||||
ann = PR_NEWZAP(XPTAnnotation);
|
||||
if (!ann)
|
||||
return PR_FALSE;
|
||||
*annp = ann;
|
||||
} else {
|
||||
ann = *annp;
|
||||
}
|
||||
|
||||
if (!XPT_Do8(cursor, &ann->flags))
|
||||
goto error;
|
||||
|
||||
if (XPT_ANN_IS_PRIVATE(ann->flags)) {
|
||||
if (!XPT_DoStringInline(cursor, &ann->creator) ||
|
||||
!XPT_DoStringInline(cursor, &ann->private_data))
|
||||
goto error_2;
|
||||
}
|
||||
|
||||
/*
|
||||
* If a subsequent Annotation fails, what to do?
|
||||
* - free all annotations, return PR_FALSE? (current behaviout)
|
||||
* - free failed annotation only, return PR_FALSE (caller can check for
|
||||
* non-NULL *annp on PR_FALSE return to detect partial annotation
|
||||
* decoding)?
|
||||
*/
|
||||
if (!XPT_ANN_IS_LAST(ann->flags) &&
|
||||
!DoAnnotation(cursor, &ann->next))
|
||||
goto error_2;
|
||||
|
||||
return PR_TRUE;
|
||||
|
||||
error_2:
|
||||
if (ann && XPT_ANN_IS_PRIVATE(ann->flags)) {
|
||||
PR_FREEIF(ann->creator);
|
||||
PR_FREEIF(ann->private_data);
|
||||
}
|
||||
XPT_ERROR_HANDLE(ann);
|
||||
}
|
||||
|
||||
PRBool
|
||||
XPT_GetInterfaceIndexByName(XPTInterfaceDirectoryEntry *ide_block,
|
||||
uint32 num_interfaces, char *name,
|
||||
uint16 *indexp)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=1; i<=num_interfaces; i++) {
|
||||
fprintf(stderr, "%s == %s ?\n", ide_block[i].name, name);
|
||||
if (strcmp(ide_block[i].name, name) == 0) {
|
||||
*indexp = i;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
indexp = 0;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
#if 0 /* need hashtables and stuff */
|
||||
XPT_PUBLIC_API(XPTInterfaceDescriptor *)
|
||||
XPT_GetDescriptorByIndex(XPTCursor *cursor, XPTHeader *header, uint16 index)
|
||||
{
|
||||
XPTInterfaceDescriptor *id = header->interface_directory + index;
|
||||
if (id)
|
||||
return id; /* XXX refcnt? */
|
||||
/* XXX lazily load and allocate later, for now we always read them all
|
||||
in */
|
||||
return id;
|
||||
}
|
||||
#endif
|
||||
600
mozilla/xpcom/libxpt/src/xpt_xdr.c
Normal file
600
mozilla/xpcom/libxpt/src/xpt_xdr.c
Normal file
@@ -0,0 +1,600 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* Implementation of XDR primitives. */
|
||||
|
||||
#include "xpt_xdr.h"
|
||||
#include <nspr.h>
|
||||
#include <string.h> /* strchr */
|
||||
|
||||
static PRBool
|
||||
CheckForRepeat(XPTCursor *cursor, void **addrp, XPTPool pool, int len,
|
||||
XPTCursor *new_cursor, PRBool *already);
|
||||
|
||||
|
||||
#define ENCODING(cursor) \
|
||||
((cursor)->state->mode == XPT_ENCODE)
|
||||
|
||||
#define CURS_POOL_OFFSET_RAW(cursor) \
|
||||
((cursor)->pool == XPT_HEADER \
|
||||
? (cursor)->offset \
|
||||
: (PR_ASSERT((cursor)->state->data_offset), \
|
||||
(cursor)->offset + (cursor)->state->data_offset))
|
||||
|
||||
#define CURS_POOL_OFFSET(cursor) \
|
||||
(CURS_POOL_OFFSET_RAW(cursor) - 1)
|
||||
|
||||
/* can be used as lvalue */
|
||||
#define CURS_POINT(cursor) \
|
||||
((cursor)->state->pool->data[CURS_POOL_OFFSET(cursor)])
|
||||
|
||||
#ifdef DEBUG_shaver
|
||||
#define DBG(x) printf##x
|
||||
#else
|
||||
#define DBG(x) (0)
|
||||
#endif
|
||||
|
||||
/* XXX fail if XPT_DATA and !state->data_offset */
|
||||
#define CHECK_COUNT_(cursor, space) \
|
||||
/* if we're in the header, then exceeding the data_offset is illegal */ \
|
||||
((cursor)->pool == XPT_HEADER ? \
|
||||
(ENCODING(cursor) && \
|
||||
((cursor)->state->data_offset && \
|
||||
((cursor)->offset - 1 + (space) > (cursor)->state->data_offset)) \
|
||||
? (DBG(("no space left in HEADER %d + %d > %d\n", (cursor)->offset, \
|
||||
(space), (cursor)->state->data_offset)), PR_FALSE) \
|
||||
: PR_TRUE) : \
|
||||
/* if we're in the data area and we're about to exceed the allocation */ \
|
||||
(CURS_POOL_OFFSET(cursor) + (space) > (cursor)->state->pool->allocated ? \
|
||||
/* then grow if we're in ENCODE mode */ \
|
||||
(ENCODING(cursor) ? GrowPool((cursor)->state->pool) \
|
||||
/* and fail if we're in DECODE mode */ \
|
||||
: (DBG(("can't extend in DECODE")), PR_FALSE)) \
|
||||
/* otherwise we're OK */ \
|
||||
: PR_TRUE))
|
||||
|
||||
#define CHECK_COUNT(cursor, space) \
|
||||
(CHECK_COUNT_(cursor, space) \
|
||||
? PR_TRUE \
|
||||
: (PR_ASSERT(0), \
|
||||
fprintf(stderr, "FATAL: can't no room for %d in cursor\n", space), \
|
||||
PR_FALSE))
|
||||
|
||||
/* increase the data allocation for the pool by XPT_GROW_CHUNK */
|
||||
#define XPT_GROW_CHUNK 8192
|
||||
|
||||
static PLHashNumber
|
||||
null_hash(const void *key)
|
||||
{
|
||||
return (PLHashNumber)key;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(XPTState *)
|
||||
XPT_NewXDRState(XPTMode mode, char *data, uint32 len)
|
||||
{
|
||||
XPTState *state;
|
||||
|
||||
state = PR_NEW(XPTState);
|
||||
|
||||
if (!state)
|
||||
return NULL;
|
||||
|
||||
state->mode = mode;
|
||||
state->pool = PR_NEW(XPTDatapool);
|
||||
state->next_cursor[0] = state->next_cursor[1] = 1;
|
||||
if (!state->pool)
|
||||
goto err_free_state;
|
||||
|
||||
state->pool->count = 0;
|
||||
state->pool->offset_map = PL_NewHashTable(32, null_hash, PL_CompareValues,
|
||||
PL_CompareValues, NULL, NULL);
|
||||
|
||||
if (!state->pool->offset_map)
|
||||
goto err_free_pool;
|
||||
if (mode == XPT_DECODE) {
|
||||
state->pool->data = data;
|
||||
state->pool->allocated = len;
|
||||
} else {
|
||||
state->pool->data = PR_MALLOC(XPT_GROW_CHUNK);
|
||||
if (!state->pool->data)
|
||||
goto err_free_hash;
|
||||
state->pool->allocated = XPT_GROW_CHUNK;
|
||||
}
|
||||
|
||||
return state;
|
||||
|
||||
err_free_hash:
|
||||
PL_HashTableDestroy(state->pool->offset_map);
|
||||
err_free_pool:
|
||||
PR_DELETE(state->pool);
|
||||
err_free_state:
|
||||
PR_DELETE(state);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(void)
|
||||
XPT_DestroyXDRState(XPTState *state)
|
||||
{
|
||||
if (state->mode == XPT_ENCODE)
|
||||
PR_DELETE(state->pool->data);
|
||||
PR_DELETE(state->pool);
|
||||
PR_DELETE(state);
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(void)
|
||||
XPT_GetXDRData(XPTState *state, XPTPool pool, char **data, uint32 *len)
|
||||
{
|
||||
if (pool == XPT_HEADER) {
|
||||
*data = state->pool->data;
|
||||
} else {
|
||||
*data = state->pool->data + state->data_offset;
|
||||
}
|
||||
*len = state->next_cursor[pool] - 1;
|
||||
}
|
||||
|
||||
/* All offsets are 1-based */
|
||||
XPT_PUBLIC_API(void)
|
||||
XPT_DataOffset(XPTState *state, uint32 *data_offsetp)
|
||||
{
|
||||
if (state->mode == XPT_DECODE)
|
||||
XPT_SetDataOffset(state, *data_offsetp);
|
||||
else
|
||||
*data_offsetp = state->data_offset;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(void)
|
||||
XPT_SetDataOffset(XPTState *state, uint32 data_offset)
|
||||
{
|
||||
state->data_offset = data_offset;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
GrowPool(XPTDatapool *pool)
|
||||
{
|
||||
char *newdata = realloc(pool->data, pool->allocated + XPT_GROW_CHUNK);
|
||||
if (!newdata)
|
||||
return PR_FALSE;
|
||||
pool->data = newdata;
|
||||
pool->allocated += XPT_GROW_CHUNK;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_MakeCursor(XPTState *state, XPTPool pool, uint32 len, XPTCursor *cursor)
|
||||
{
|
||||
cursor->state = state;
|
||||
cursor->pool = pool;
|
||||
cursor->bits = 0;
|
||||
cursor->offset = state->next_cursor[pool];
|
||||
|
||||
if (!CHECK_COUNT(cursor, len))
|
||||
return PR_FALSE;
|
||||
|
||||
/* this check should be in CHECK_CURSOR */
|
||||
if (pool == XPT_DATA && !state->data_offset) {
|
||||
fprintf(stderr, "no data offset for XPT_DATA cursor!\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
state->next_cursor[pool] += len;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_SeekTo(XPTCursor *cursor, uint32 offset)
|
||||
{
|
||||
/* XXX do some real checking and update len and stuff */
|
||||
cursor->offset = offset;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(XPTString *)
|
||||
XPT_NewString(uint16 length, char *bytes)
|
||||
{
|
||||
XPTString *str = PR_NEW(XPTString);
|
||||
if (!str)
|
||||
return NULL;
|
||||
str->length = length;
|
||||
str->bytes = malloc(length);
|
||||
if (!str->bytes) {
|
||||
PR_DELETE(str);
|
||||
return NULL;
|
||||
}
|
||||
memcpy(str->bytes, bytes, length);
|
||||
return str;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(XPTString *)
|
||||
XPT_NewStringZ(char *bytes)
|
||||
{
|
||||
uint32 length = strlen(bytes);
|
||||
if (length > 0xffff)
|
||||
return NULL; /* too long */
|
||||
return XPT_NewString((uint16)length, bytes);
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoStringInline(XPTCursor *cursor, XPTString **strp)
|
||||
{
|
||||
XPTString *str = *strp;
|
||||
XPTMode mode = cursor->state->mode;
|
||||
int i;
|
||||
|
||||
if (mode == XPT_DECODE) {
|
||||
str = PR_NEWZAP(XPTString);
|
||||
if (!str)
|
||||
return PR_FALSE;
|
||||
*strp = str;
|
||||
}
|
||||
|
||||
if (!XPT_Do16(cursor, &str->length))
|
||||
goto error;
|
||||
|
||||
if (mode == XPT_DECODE)
|
||||
if (!(str->bytes = malloc(str->length + 1)))
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < str->length; i++)
|
||||
if (!XPT_Do8(cursor, &str->bytes[i]))
|
||||
goto error_2;
|
||||
|
||||
if (mode == XPT_DECODE)
|
||||
str->bytes[str->length] = 0;
|
||||
|
||||
return PR_TRUE;
|
||||
error_2:
|
||||
PR_DELETE(str->bytes);
|
||||
error:
|
||||
PR_DELETE(str);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoString(XPTCursor *cursor, XPTString **strp)
|
||||
{
|
||||
XPTCursor my_cursor;
|
||||
XPTString *str = *strp;
|
||||
PRBool already;
|
||||
|
||||
XPT_PREAMBLE_NO_ALLOC(cursor, strp, XPT_DATA, str->length + 2, my_cursor,
|
||||
already);
|
||||
|
||||
return XPT_DoStringInline(&my_cursor, strp);
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoCString(XPTCursor *cursor, char **identp)
|
||||
{
|
||||
XPTCursor my_cursor;
|
||||
char *ident = *identp;
|
||||
uint32 offset = 0;
|
||||
|
||||
XPTMode mode = cursor->state->mode;
|
||||
|
||||
if (mode == XPT_DECODE) {
|
||||
char *start, *end;
|
||||
int len;
|
||||
|
||||
if (!XPT_Do32(cursor, &offset))
|
||||
return PR_FALSE;
|
||||
|
||||
if (!offset) {
|
||||
*identp = NULL;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
my_cursor.pool = XPT_DATA;
|
||||
my_cursor.offset = offset;
|
||||
my_cursor.state = cursor->state;
|
||||
start = &CURS_POINT(&my_cursor);
|
||||
|
||||
end = strchr(start, 0); /* find the end of the string */
|
||||
if (!end) {
|
||||
fprintf(stderr, "didn't find end of string on decode!\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
len = end - start;
|
||||
|
||||
ident = PR_MALLOC(len + 1);
|
||||
if (!ident)
|
||||
return PR_FALSE;
|
||||
|
||||
memcpy(ident, start, len);
|
||||
ident[len] = 0;
|
||||
*identp = ident;
|
||||
|
||||
} else {
|
||||
|
||||
if (!ident) {
|
||||
offset = 0;
|
||||
if (!XPT_Do32(cursor, &offset))
|
||||
return PR_FALSE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
if (!XPT_MakeCursor(cursor->state, XPT_DATA, strlen(ident) + 1,
|
||||
&my_cursor) ||
|
||||
!XPT_Do32(cursor, &my_cursor.offset))
|
||||
return PR_FALSE;
|
||||
|
||||
while(*ident)
|
||||
if (!XPT_Do8(&my_cursor, ident++))
|
||||
return PR_FALSE;
|
||||
if (!XPT_Do8(&my_cursor, ident)) /* write trailing zero */
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(uint32)
|
||||
XPT_GetOffsetForAddr(XPTCursor *cursor, void *addr)
|
||||
{
|
||||
return (uint32)PL_HashTableLookup(cursor->state->pool->offset_map, addr);
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_SetOffsetForAddr(XPTCursor *cursor, void *addr, uint32 offset)
|
||||
{
|
||||
return PL_HashTableAdd(cursor->state->pool->offset_map,
|
||||
addr, (void *)offset) != NULL;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_SetAddrForOffset(XPTCursor *cursor, uint32 offset, void *addr)
|
||||
{
|
||||
return PL_HashTableAdd(cursor->state->pool->offset_map,
|
||||
(void *)offset, addr) != NULL;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(void *)
|
||||
XPT_GetAddrForOffset(XPTCursor *cursor, uint32 offset)
|
||||
{
|
||||
return PL_HashTableLookup(cursor->state->pool->offset_map, (void *)offset);
|
||||
}
|
||||
|
||||
static PRBool
|
||||
CheckForRepeat(XPTCursor *cursor, void **addrp, XPTPool pool, int len,
|
||||
XPTCursor *new_cursor, PRBool *already)
|
||||
{
|
||||
void *last = *addrp;
|
||||
|
||||
*already = PR_FALSE;
|
||||
new_cursor->state = cursor->state;
|
||||
new_cursor->pool = pool;
|
||||
new_cursor->bits = 0;
|
||||
|
||||
if (cursor->state->mode == XPT_DECODE) {
|
||||
|
||||
last = XPT_GetAddrForOffset(new_cursor, new_cursor->offset);
|
||||
|
||||
if (last) {
|
||||
*already = PR_TRUE;
|
||||
*addrp = last;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
new_cursor->offset = XPT_GetOffsetForAddr(new_cursor, last);
|
||||
if (new_cursor->offset) {
|
||||
*already = PR_TRUE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/* haven't already found it, so allocate room for it. */
|
||||
if (!XPT_MakeCursor(cursor->state, pool, len, new_cursor) ||
|
||||
!XPT_SetOffsetForAddr(new_cursor, *addrp, new_cursor->offset))
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* IIDs are written in struct order, in the usual big-endian way. From the
|
||||
* typelib file spec:
|
||||
*
|
||||
* "For example, this IID:
|
||||
* {00112233-4455-6677-8899-aabbccddeeff}
|
||||
* is converted to the 128-bit value
|
||||
* 0x00112233445566778899aabbccddeeff
|
||||
* Note that the byte storage order corresponds to the layout of the nsIID
|
||||
* C-struct on a big-endian architecture."
|
||||
*
|
||||
* (http://www.mozilla.org/scriptable/typelib_file.html#iid)
|
||||
*/
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoIID(XPTCursor *cursor, nsID *iidp)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!XPT_Do32(cursor, &iidp->m0) ||
|
||||
!XPT_Do16(cursor, &iidp->m1) ||
|
||||
!XPT_Do16(cursor, &iidp->m2))
|
||||
return PR_FALSE;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
if (!XPT_Do8(cursor, &iidp->m3[i]))
|
||||
return PR_FALSE;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_Do64(XPTCursor *cursor, PRInt64 *u64p)
|
||||
{
|
||||
return XPT_Do32(cursor, (uint32 *)u64p) &&
|
||||
XPT_Do32(cursor, ((uint32 *)u64p) + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* When we're writing 32- or 16-bit quantities, we write a byte at a time to
|
||||
* avoid alignment issues. Someone could come and optimize this to detect
|
||||
* well-aligned cases and do a single store, if they cared. I might care
|
||||
* later.
|
||||
*/
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_Do32(XPTCursor *cursor, uint32 *u32p)
|
||||
{
|
||||
union {
|
||||
uint8 b8[4];
|
||||
uint32 b32;
|
||||
} u;
|
||||
|
||||
if (!CHECK_COUNT(cursor, 4))
|
||||
return PR_FALSE;
|
||||
|
||||
if (ENCODING(cursor)) {
|
||||
u.b32 = XPT_SWAB32(*u32p);
|
||||
CURS_POINT(cursor) = u.b8[0];
|
||||
cursor->offset++;
|
||||
CURS_POINT(cursor) = u.b8[1];
|
||||
cursor->offset++;
|
||||
CURS_POINT(cursor) = u.b8[2];
|
||||
cursor->offset++;
|
||||
CURS_POINT(cursor) = u.b8[3];
|
||||
} else {
|
||||
u.b8[0] = CURS_POINT(cursor);
|
||||
cursor->offset++;
|
||||
u.b8[1] = CURS_POINT(cursor);
|
||||
cursor->offset++;
|
||||
u.b8[2] = CURS_POINT(cursor);
|
||||
cursor->offset++;
|
||||
u.b8[3] = CURS_POINT(cursor);
|
||||
*u32p = XPT_SWAB32(u.b32);
|
||||
}
|
||||
cursor->offset++;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_Do16(XPTCursor *cursor, uint16 *u16p)
|
||||
{
|
||||
union {
|
||||
uint8 b8[2];
|
||||
uint16 b16;
|
||||
} u;
|
||||
|
||||
if (!CHECK_COUNT(cursor, 2))
|
||||
return PR_FALSE;
|
||||
|
||||
if (ENCODING(cursor)) {
|
||||
u.b16 = XPT_SWAB16(*u16p);
|
||||
CURS_POINT(cursor) = u.b8[0];
|
||||
cursor->offset++;
|
||||
CURS_POINT(cursor) = u.b8[1];
|
||||
} else {
|
||||
u.b8[0] = CURS_POINT(cursor);
|
||||
cursor->offset++;
|
||||
u.b8[1] = CURS_POINT(cursor);
|
||||
*u16p = XPT_SWAB16(u.b16);
|
||||
}
|
||||
cursor->offset++;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_Do8(XPTCursor *cursor, uint8 *u8p)
|
||||
{
|
||||
if (!CHECK_COUNT(cursor, 1))
|
||||
return PR_FALSE;
|
||||
if (cursor->state->mode == XPT_ENCODE)
|
||||
CURS_POINT(cursor) = *u8p;
|
||||
else
|
||||
*u8p = CURS_POINT(cursor);
|
||||
|
||||
cursor->offset++;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
do_bit(XPTCursor *cursor, uint8 *u8p, int bitno)
|
||||
{
|
||||
return PR_FALSE;
|
||||
#if 0
|
||||
int bit_value, delta, new_value;
|
||||
XPTDatapool *pool = cursor->pool;
|
||||
|
||||
if (cursor->state->mode == XPT_ENCODE) {
|
||||
bit_value = (*u8p & 1) << (bitno); /* 7 = 0100 0000, 6 = 0010 0000 */
|
||||
if (bit_value) {
|
||||
delta = pool->bit + (bitno) - 7;
|
||||
new_value = delta >= 0 ? bit_value >> delta : bit_value << -delta;
|
||||
pool->data[pool->count] |= new_value;
|
||||
}
|
||||
} else {
|
||||
bit_value = pool->data[pool->count] & (1 << (7 - pool->bit));
|
||||
*u8p = bit_value >> (7 - pool->bit);
|
||||
}
|
||||
if (++pool->bit == 8) {
|
||||
pool->count++;
|
||||
pool->bit = 0;
|
||||
}
|
||||
|
||||
return CHECK_COUNT(cursor);
|
||||
#endif
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_DoBits(XPTCursor *cursor, uint8 *u8p, int nbits)
|
||||
{
|
||||
|
||||
#define DO_BIT(cursor, u8p, nbits) \
|
||||
if (!do_bit(cursor, u8p, nbits)) \
|
||||
return PR_FALSE;
|
||||
|
||||
switch(nbits) {
|
||||
case 7:
|
||||
DO_BIT(cursor, u8p, 7);
|
||||
case 6:
|
||||
DO_BIT(cursor, u8p, 6);
|
||||
case 5:
|
||||
DO_BIT(cursor, u8p, 5);
|
||||
case 4:
|
||||
DO_BIT(cursor, u8p, 4);
|
||||
case 3:
|
||||
DO_BIT(cursor, u8p, 3);
|
||||
case 2:
|
||||
DO_BIT(cursor, u8p, 2);
|
||||
case 1:
|
||||
DO_BIT(cursor, u8p, 1);
|
||||
default:;
|
||||
};
|
||||
|
||||
#undef DO_BIT
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(int)
|
||||
XPT_FlushBits(XPTCursor *cursor)
|
||||
{
|
||||
return 0;
|
||||
#if 0
|
||||
cursor->bits = 0;
|
||||
cursor->offset++;
|
||||
|
||||
if (!CHECK_COUNT(cursor))
|
||||
return -1;
|
||||
|
||||
return skipped == 8 ? 0 : skipped;
|
||||
#endif
|
||||
}
|
||||
37
mozilla/xpcom/libxpt/tests/Makefile.in
Normal file
37
mozilla/xpcom/libxpt/tests/Makefile.in
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = libxpt
|
||||
|
||||
SIMPLE_PROGRAMS = PrimitiveTest SimpleTypeLib
|
||||
|
||||
CSRCS = PrimitiveTest.c SimpleTypeLib.c
|
||||
|
||||
LDFLAGS = \
|
||||
-L$(DIST)/bin \
|
||||
-lxpt \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
133
mozilla/xpcom/libxpt/tests/PrimitiveTest.c
Normal file
133
mozilla/xpcom/libxpt/tests/PrimitiveTest.c
Normal file
@@ -0,0 +1,133 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* Test the xdr primitives from xpt_xdr.c */
|
||||
|
||||
#include "xpt_xdr.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define PASS(msg) \
|
||||
fprintf(stderr, "PASSED : %s\n", msg);
|
||||
|
||||
#define FAIL(msg) \
|
||||
fprintf(stderr, "FAILURE: %s\n", msg);
|
||||
|
||||
#define TRY_(msg, cond, silent) \
|
||||
if ((cond) && !silent) { \
|
||||
PASS(msg); \
|
||||
} else { \
|
||||
FAIL(msg); \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
#define TRY(msg, cond) TRY_(msg, cond, 0)
|
||||
#define TRY_Q(msg, cond) TRY_(msg, cond, 1);
|
||||
|
||||
XPTString in_str = { 4, "bazz" };
|
||||
|
||||
struct TestData {
|
||||
uint32 bit32;
|
||||
uint16 bit16;
|
||||
uint8 bit8[2];
|
||||
char *cstr;
|
||||
XPTString *str;
|
||||
} input = { 0xdeadbeef, 0xcafe, {0xba, 0xbe}, "foobar", &in_str},
|
||||
output = {0, 0, {0, 0}, NULL, NULL };
|
||||
|
||||
void
|
||||
dump_struct(char *label, struct TestData *str)
|
||||
{
|
||||
fprintf(stderr, "%s: {%#08x, %#04x, {%#02x, %#02x}, %s, %d/%s}\n",
|
||||
label, str->bit32, str->bit16, str->bit8[0], str->bit8[1],
|
||||
str->cstr, str->str->length, str->str->bytes);
|
||||
}
|
||||
|
||||
PRBool
|
||||
XDR(XPTCursor *cursor, struct TestData *str)
|
||||
{
|
||||
TRY("Do32", XPT_Do32(cursor, &str->bit32));
|
||||
TRY("Do16", XPT_Do16(cursor, &str->bit16));
|
||||
TRY("Do8", XPT_Do8 (cursor, &str->bit8[0]));
|
||||
TRY("Do8", XPT_Do8 (cursor, &str->bit8[1]));
|
||||
TRY("DoCString", XPT_DoCString(cursor, &str->cstr));
|
||||
TRY("DoString", XPT_DoString(cursor, &str->str));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
XPTState *state;
|
||||
XPTCursor curs, *cursor = &curs;
|
||||
char *header, *data, *whole;
|
||||
uint32 hlen, dlen, i;
|
||||
|
||||
TRY("NewState (ENCODE)", (state = XPT_NewXDRState(XPT_ENCODE, NULL, 0)));
|
||||
|
||||
XPT_SetDataOffset(state, sizeof input);
|
||||
|
||||
TRY("MakeCursor", XPT_MakeCursor(state, XPT_HEADER, sizeof input, cursor));
|
||||
|
||||
dump_struct("before", &input);
|
||||
|
||||
if (XDR(cursor, &input))
|
||||
return 1;
|
||||
|
||||
fprintf(stderr, "ENCODE successful\n");
|
||||
XPT_GetXDRData(state, XPT_HEADER, &header, &hlen);
|
||||
fprintf(stderr, "XDR header %d bytes at %p:",
|
||||
hlen, header);
|
||||
for (i = 0; i < hlen; i++)
|
||||
fprintf(stderr, "%c%02x", i ? ',' : ' ', (uint8)header[i]);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
XPT_GetXDRData(state, XPT_DATA, &data, &dlen);
|
||||
|
||||
fprintf(stderr, "XDR data %d bytes at %p:",
|
||||
dlen, data);
|
||||
for (i = 0; i < dlen; i++)
|
||||
fprintf(stderr, "%c%02x/%c", i ? ',' : ' ', (uint8)data[i],
|
||||
(uint8)data[i]);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
whole = malloc(dlen + hlen);
|
||||
if (!whole) {
|
||||
fprintf(stderr, "malloc %d failed!\n", dlen + hlen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* TRY_Q("malloc", (data2 = malloc(len))); */
|
||||
memcpy(whole, header, hlen);
|
||||
memcpy(whole + hlen, data, dlen);
|
||||
XPT_DestroyXDRState(state);
|
||||
|
||||
TRY("NewState (DECODE)", (state = XPT_NewXDRState(XPT_DECODE, whole,
|
||||
hlen + dlen)));
|
||||
|
||||
TRY("MakeCursor", XPT_MakeCursor(state, XPT_HEADER, sizeof input, cursor));
|
||||
XPT_SetDataOffset(state, sizeof input);
|
||||
|
||||
if (XDR(cursor, &output))
|
||||
return 1;
|
||||
|
||||
dump_struct("after", &output);
|
||||
XPT_DestroyXDRState(state);
|
||||
free(whole);
|
||||
|
||||
return 0;
|
||||
}
|
||||
149
mozilla/xpcom/libxpt/tests/SimpleTypeLib.c
Normal file
149
mozilla/xpcom/libxpt/tests/SimpleTypeLib.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* Test the structure creation and serialization APIs from xpt_struct.c */
|
||||
|
||||
#include "xpt_xdr.h"
|
||||
#include "xpt_struct.h"
|
||||
|
||||
#define PASS(msg) \
|
||||
fprintf(stderr, "PASSED : %s\n", msg);
|
||||
|
||||
#define FAIL(msg) \
|
||||
fprintf(stderr, "FAILURE: %s\n", msg);
|
||||
|
||||
#define TRY_(msg, cond, silent) \
|
||||
if ((cond) && !silent) { \
|
||||
PASS(msg); \
|
||||
} else { \
|
||||
FAIL(msg); \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
#define TRY(msg, cond) TRY_(msg, cond, 0)
|
||||
#define TRY_Q(msg, cond) TRY_(msg, cond, 1);
|
||||
|
||||
struct nsID iid = {
|
||||
0x00112233,
|
||||
0x4455,
|
||||
0x6677,
|
||||
{0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}
|
||||
};
|
||||
|
||||
XPTTypeDescriptor td_void = { TD_VOID };
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
XPTHeader *header;
|
||||
XPTAnnotation *ann;
|
||||
XPTInterfaceDescriptor *id;
|
||||
XPTMethodDescriptor *meth;
|
||||
|
||||
XPTState *state;
|
||||
XPTCursor curs, *cursor = &curs;
|
||||
char *data, *head;
|
||||
FILE *out;
|
||||
uint32 len, header_sz;
|
||||
|
||||
PRBool ok;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <filename.xpt>\n"
|
||||
" Creates a simple typelib file.\n", argv[0]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* construct a header */
|
||||
header = XPT_NewHeader(1);
|
||||
TRY("NewHeader", header);
|
||||
|
||||
|
||||
ann = XPT_NewAnnotation(XPT_ANN_LAST | XPT_ANN_PRIVATE,
|
||||
XPT_NewStringZ("SimpleTypeLib 1.0"),
|
||||
XPT_NewStringZ("See You In Rome"));
|
||||
TRY("NewAnnotation", ann);
|
||||
header->annotations = ann;
|
||||
|
||||
header_sz = XPT_SizeOfHeaderBlock(header);
|
||||
|
||||
id = XPT_NewInterfaceDescriptor(0xdead, 2, 2);
|
||||
TRY("NewInterfaceDescriptor", id);
|
||||
|
||||
ok = XPT_FillInterfaceDirectoryEntry(header->interface_directory, &iid,
|
||||
"Interface", "NS", id);
|
||||
TRY("FillInterfaceDirectoryEntry", ok);
|
||||
|
||||
/* void method1(void) */
|
||||
meth = &id->method_descriptors[0];
|
||||
ok = XPT_FillMethodDescriptor(meth, 0, "method1", 0);
|
||||
TRY("FillMethodDescriptor", ok);
|
||||
meth->result->flags = 0;
|
||||
meth->result->type.prefix.flags = TD_VOID;
|
||||
|
||||
/* wstring method2(in uint32, in bool) */
|
||||
meth = &id->method_descriptors[1];
|
||||
ok = XPT_FillMethodDescriptor(meth, 0, "method2", 2);
|
||||
TRY("FillMethodDescriptor", ok);
|
||||
|
||||
meth->result->flags = 0;
|
||||
meth->result->type.prefix.flags = TD_PBSTR | XPT_TDP_POINTER;
|
||||
meth->params[0].type.prefix.flags = TD_UINT32;
|
||||
meth->params[0].flags = XPT_PD_IN;
|
||||
meth->params[1].type.prefix.flags = TD_BOOL;
|
||||
meth->params[1].flags = XPT_PD_IN;
|
||||
|
||||
/* const one = 1; */
|
||||
id->const_descriptors[0].name = "one";
|
||||
id->const_descriptors[0].type.prefix.flags = TD_UINT16;
|
||||
id->const_descriptors[0].value.ui16 = 1;
|
||||
|
||||
/* const squeamish = "ossifrage"; */
|
||||
id->const_descriptors[1].name = "squeamish";
|
||||
id->const_descriptors[1].type.prefix.flags = TD_PBSTR | XPT_TDP_POINTER;
|
||||
id->const_descriptors[1].value.string = XPT_NewStringZ("ossifrage");
|
||||
|
||||
/* serialize it */
|
||||
state = XPT_NewXDRState(XPT_ENCODE, NULL, 0);
|
||||
TRY("NewState (ENCODE)", state);
|
||||
|
||||
ok = XPT_MakeCursor(state, XPT_HEADER, header_sz, cursor);
|
||||
TRY("MakeCursor", ok);
|
||||
|
||||
ok = XPT_DoHeader(cursor, &header);
|
||||
TRY("DoHeader", ok);
|
||||
|
||||
out = fopen(argv[1], "w");
|
||||
if (!out) {
|
||||
perror("FAILED: fopen");
|
||||
return 1;
|
||||
}
|
||||
|
||||
XPT_GetXDRData(state, XPT_HEADER, &head, &len);
|
||||
fwrite(head, len, 1, out);
|
||||
|
||||
XPT_GetXDRData(state, XPT_DATA, &data, &len);
|
||||
fwrite(data, len, 1, out);
|
||||
fclose(out);
|
||||
XPT_DestroyXDRState(state);
|
||||
|
||||
/* XXX DestroyHeader */
|
||||
return 0;
|
||||
}
|
||||
|
||||
37
mozilla/xpcom/libxpt/tools/Makefile.in
Normal file
37
mozilla/xpcom/libxpt/tools/Makefile.in
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = libxpt
|
||||
|
||||
SIMPLE_PROGRAMS = xpt_dump
|
||||
|
||||
CSRCS = xpt_dump.c
|
||||
|
||||
LDFLAGS = \
|
||||
-L$(DIST)/bin \
|
||||
-lxpt \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
673
mozilla/xpcom/libxpt/tools/xpt_dump.c
Normal file
673
mozilla/xpcom/libxpt/tools/xpt_dump.c
Normal file
@@ -0,0 +1,673 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A utility for dumping the contents of a typelib file (.xpt) to screen
|
||||
*/
|
||||
|
||||
#include "xpt_xdr.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "prprf.h"
|
||||
|
||||
#define BASE_INDENT 3
|
||||
|
||||
static char *type_array[20] = {"int8", "int16", "int32", "int64",
|
||||
"uint8", "uint16", "uint32", "uint64",
|
||||
"float", "double", "boolean", "char",
|
||||
"wchar_t", "void", "reserved", "reserved",
|
||||
"reserved", "reserved", "Interface *",
|
||||
"InterfaceIs *"};
|
||||
|
||||
static char *ptype_array[18] = {"int8 *", "int16 *", "int32 *", "int64 *",
|
||||
"uint8 *", "uint16 *", "uint32 *", "uint64 *",
|
||||
"float *", "double *", "boolean *", "char *",
|
||||
"wchar_t *", "void *", "nsIID **", "bstr",
|
||||
"string", "wstring"};
|
||||
|
||||
PRBool
|
||||
XPT_DumpHeader(XPTHeader *header, const int indent, PRBool verbose_mode);
|
||||
|
||||
PRBool
|
||||
XPT_DumpAnnotations(XPTAnnotation *ann, const int indent, PRBool verbose_mode);
|
||||
|
||||
PRBool
|
||||
XPT_DumpInterfaceDirectoryEntry(XPTInterfaceDirectoryEntry *ide,
|
||||
const int indent, PRBool verbose_mode);
|
||||
|
||||
PRBool
|
||||
XPT_DumpInterfaceDescriptor(XPTInterfaceDescriptor *id, const int indent,
|
||||
PRBool verbose_mode);
|
||||
|
||||
PRBool
|
||||
XPT_DumpMethodDescriptor(XPTMethodDescriptor *md, const int indent,
|
||||
PRBool verbose_mode);
|
||||
PRBool
|
||||
XPT_GetStringForType(XPTTypeDescriptor *td, char **type_string);
|
||||
|
||||
PRBool
|
||||
XPT_DumpXPTString(XPTString *str);
|
||||
|
||||
PRBool
|
||||
XPT_DumpParamDescriptor(XPTParamDescriptor *pd, const int indent,
|
||||
PRBool verbose_mode);
|
||||
|
||||
PRBool
|
||||
XPT_DumpTypeDescriptor(XPTTypeDescriptor *td, int indent,
|
||||
PRBool verbose_mode);
|
||||
|
||||
PRBool
|
||||
XPT_DumpConstDescriptor(XPTConstDescriptor *cd, const int indent,
|
||||
PRBool verbose_mode);
|
||||
|
||||
static void
|
||||
xpt_dump_usage(char *argv[]) {
|
||||
fprintf(stdout, "Usage: %s [-v] <filename.xpt>\n"
|
||||
" -v verbose mode\n", argv[0]);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
PRBool verbose_mode = PR_FALSE;
|
||||
XPTState *state;
|
||||
XPTCursor curs, *cursor = &curs;
|
||||
XPTHeader *header;
|
||||
struct stat file_stat;
|
||||
int flen;
|
||||
char *whole;
|
||||
FILE *in;
|
||||
|
||||
switch (argc) {
|
||||
case 2:
|
||||
if (argv[1][0] == '-') {
|
||||
xpt_dump_usage(argv);
|
||||
return 1;
|
||||
}
|
||||
if (stat(argv[1], &file_stat) != 0) {
|
||||
perror("FAILED: fstat");
|
||||
return 1;
|
||||
}
|
||||
flen = file_stat.st_size;
|
||||
in = fopen(argv[1], "r");
|
||||
break;
|
||||
case 3:
|
||||
verbose_mode = PR_TRUE;
|
||||
if (argv[1][0] != '-' || argv[1][1] != 'v') {
|
||||
xpt_dump_usage(argv);
|
||||
return 1;
|
||||
}
|
||||
if (stat(argv[2], &file_stat) != 0) {
|
||||
perror("FAILED: fstat");
|
||||
return 1;
|
||||
}
|
||||
flen = file_stat.st_size;
|
||||
in = fopen(argv[2], "r");
|
||||
break;
|
||||
default:
|
||||
xpt_dump_usage(argv);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!in) {
|
||||
perror("FAILED: fopen");
|
||||
return 1;
|
||||
}
|
||||
|
||||
whole = malloc(flen);
|
||||
if (!whole) {
|
||||
perror("FAILED: malloc for whole");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (flen > 0) {
|
||||
fread(whole, flen, 1, in);
|
||||
state = XPT_NewXDRState(XPT_DECODE, whole, flen);
|
||||
if (!XPT_MakeCursor(state, XPT_HEADER, 0, cursor)) {
|
||||
fprintf(stdout, "MakeCursor failed\n");
|
||||
return 1;
|
||||
}
|
||||
if (!XPT_DoHeader(cursor, &header)) {
|
||||
fprintf(stdout, "DoHeader failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!XPT_DumpHeader(header, BASE_INDENT, verbose_mode)) {
|
||||
perror("FAILED: XPT_DumpHeader");
|
||||
return 1;
|
||||
}
|
||||
|
||||
XPT_DestroyXDRState(state);
|
||||
free(whole);
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRBool
|
||||
XPT_DumpHeader(XPTHeader *header, const int indent, PRBool verbose_mode)
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf(stdout, "Header:\n");
|
||||
|
||||
if (verbose_mode) {
|
||||
fprintf(stdout, "%*sMagic beans: ", indent, " ");
|
||||
for (i=0; i<16; i++) {
|
||||
fprintf(stdout, "%02x", header->magic[i]);
|
||||
}
|
||||
fprintf(stdout, "\n");
|
||||
if (strncmp(header->magic, XPT_MAGIC, 16) == 0)
|
||||
fprintf(stdout, "%*s PASSED\n", indent, " ");
|
||||
else
|
||||
fprintf(stdout, "%*s FAILED\n", indent, " ");
|
||||
}
|
||||
fprintf(stdout, "%*sMajor version: %d\n", indent, " ",
|
||||
header->major_version);
|
||||
fprintf(stdout, "%*sMinor version: %d\n", indent, " ",
|
||||
header->minor_version);
|
||||
fprintf(stdout, "%*sNumber of interfaces: %d\n", indent, " ",
|
||||
header->num_interfaces);
|
||||
|
||||
if (verbose_mode) {
|
||||
fprintf(stdout, "%*sFile length: %d\n", indent, " ",
|
||||
header->file_length);
|
||||
fprintf(stdout, "%*sData pool offset: %d\n\n", indent, " ",
|
||||
header->data_pool);
|
||||
}
|
||||
|
||||
fprintf(stdout, "%*sAnnotations:\n", indent, " ");
|
||||
if (!XPT_DumpAnnotations(header->annotations, indent*2, verbose_mode))
|
||||
return PR_FALSE;
|
||||
|
||||
fprintf(stdout, "\nInterface Directory:\n");
|
||||
for (i=0; i<header->num_interfaces; i++) {
|
||||
if (verbose_mode) {
|
||||
fprintf(stdout, "%*sInterface #%d:\n", indent, " ", i);
|
||||
if (!XPT_DumpInterfaceDirectoryEntry(&header->interface_directory[i], indent*2, verbose_mode)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
} else {
|
||||
if (!XPT_DumpInterfaceDirectoryEntry(&header->interface_directory[i], indent, verbose_mode)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
XPT_DumpAnnotations(XPTAnnotation *ann, const int indent, PRBool verbose_mode)
|
||||
{
|
||||
int i = -1;
|
||||
XPTAnnotation *last;
|
||||
int new_indent = indent + BASE_INDENT;
|
||||
|
||||
do {
|
||||
i++;
|
||||
if (XPT_ANN_IS_PRIVATE(ann->flags)) {
|
||||
if (verbose_mode) {
|
||||
fprintf(stdout, "%*sAnnotation #%d is private.\n",
|
||||
indent, " ", i);
|
||||
} else {
|
||||
fprintf(stdout, "%*sAnnotation #%d:\n",
|
||||
indent, " ", i);
|
||||
}
|
||||
fprintf(stdout, "%*sCreator: ", new_indent, " ");
|
||||
if (!XPT_DumpXPTString(ann->creator))
|
||||
return PR_FALSE;
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "%*sPrivate Data: ", new_indent, " ");
|
||||
if (!XPT_DumpXPTString(ann->private_data))
|
||||
return PR_FALSE;
|
||||
fprintf(stdout, "\n");
|
||||
} else {
|
||||
fprintf(stdout, "%*sAnnotation #%d is empty.\n",
|
||||
indent, " ", i);
|
||||
}
|
||||
last = ann;
|
||||
ann = ann->next;
|
||||
} while (!XPT_ANN_IS_LAST(last->flags));
|
||||
|
||||
if (verbose_mode) {
|
||||
fprintf(stdout, "%*sAnnotation #%d is the last annotation.\n",
|
||||
indent, " ", i);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
print_IID(struct nsID *iid, FILE *file)
|
||||
{
|
||||
fprintf(file, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
(PRUint32) iid->m0, (PRUint32) iid->m1,(PRUint32) iid->m2,
|
||||
(PRUint32) iid->m3[0], (PRUint32) iid->m3[1],
|
||||
(PRUint32) iid->m3[2], (PRUint32) iid->m3[3],
|
||||
(PRUint32) iid->m3[4], (PRUint32) iid->m3[5],
|
||||
(PRUint32) iid->m3[6], (PRUint32) iid->m3[7]);
|
||||
|
||||
}
|
||||
|
||||
PRBool
|
||||
XPT_DumpInterfaceDirectoryEntry(XPTInterfaceDirectoryEntry *ide,
|
||||
const int indent, PRBool verbose_mode)
|
||||
{
|
||||
int new_indent = indent + BASE_INDENT;
|
||||
|
||||
if (verbose_mode) {
|
||||
fprintf(stdout, "%*sIID: ", indent, " ");
|
||||
print_IID(&ide->iid, stdout);
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
fprintf(stdout, "%*sName: %s\n",
|
||||
indent, " ", ide->name);
|
||||
fprintf(stdout, "%*sNamespace: %s\n",
|
||||
indent, " ", ide->name_space);
|
||||
fprintf(stdout, "%*sAddress of interface descriptor: %p\n",
|
||||
indent, " ", ide->interface_descriptor);
|
||||
|
||||
fprintf(stdout, "%*sDescriptor:\n", indent, " ");
|
||||
|
||||
if (!XPT_DumpInterfaceDescriptor(ide->interface_descriptor,
|
||||
new_indent, verbose_mode)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
} else {
|
||||
fprintf(stdout, "%*s- %s::%s (", indent, " ",
|
||||
ide->name_space ? ide->name_space : "", ide->name);
|
||||
print_IID(&ide->iid, stdout);
|
||||
fprintf(stdout, "):\n");
|
||||
if (!XPT_DumpInterfaceDescriptor(ide->interface_descriptor,
|
||||
new_indent, verbose_mode)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
XPT_DumpInterfaceDescriptor(XPTInterfaceDescriptor *id, const int indent,
|
||||
PRBool verbose_mode)
|
||||
{
|
||||
int i;
|
||||
int new_indent = indent + BASE_INDENT;
|
||||
int more_indent = new_indent + BASE_INDENT;
|
||||
|
||||
if (!id) {
|
||||
fprintf(stdout, "%*s[Unresolved]\n", indent, " ");
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
if (verbose_mode) {
|
||||
fprintf(stdout, "%*sOffset of parent interface (in data pool): %p\n",
|
||||
indent, " ", id->parent_interface);
|
||||
fprintf(stdout, "%*s# of Method Descriptors: %d\n",
|
||||
indent, " ", id->num_methods);
|
||||
} else {
|
||||
fprintf(stdout, "%*sMethods:\n", indent, " ");
|
||||
}
|
||||
|
||||
if (id->num_methods == 0) {
|
||||
fprintf(stdout, "%*sNo Methods\n", new_indent, " ");
|
||||
} else {
|
||||
for (i=0; i<id->num_methods; i++) {
|
||||
if (verbose_mode) {
|
||||
fprintf(stdout, "%*sMethod #%d:\n", new_indent, " ", i);
|
||||
if (!XPT_DumpMethodDescriptor(&id->method_descriptors[i],
|
||||
more_indent, verbose_mode))
|
||||
return PR_FALSE;
|
||||
} else {
|
||||
if (!XPT_DumpMethodDescriptor(&id->method_descriptors[i],
|
||||
new_indent, verbose_mode))
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose_mode) {
|
||||
fprintf(stdout, "%*s# of Constant Descriptors: %d\n",
|
||||
indent, " ", id->num_constants);
|
||||
for (i=0; i<id->num_constants; i++) {
|
||||
fprintf(stdout, "%*sConstant #%d:\n", new_indent, " ", i);
|
||||
if (!XPT_DumpConstDescriptor(&id->const_descriptors[i],
|
||||
more_indent, verbose_mode))
|
||||
return PR_FALSE;
|
||||
}
|
||||
} else {
|
||||
fprintf(stdout, "%*sConstants:\n", indent, " ");
|
||||
for (i=0; i<id->num_constants; i++) {
|
||||
if (!XPT_DumpConstDescriptor(&id->const_descriptors[i],
|
||||
new_indent, verbose_mode))
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
XPT_DumpMethodDescriptor(XPTMethodDescriptor *md, const int indent,
|
||||
PRBool verbose_mode)
|
||||
{
|
||||
int i;
|
||||
int new_indent = indent + BASE_INDENT;
|
||||
int more_indent = new_indent + BASE_INDENT;
|
||||
|
||||
if (verbose_mode) {
|
||||
fprintf(stdout, "%*sName: %s\n", indent, " ", md->name);
|
||||
fprintf(stdout, "%*sIs Getter? ", indent, " ");
|
||||
if (XPT_MD_IS_GETTER(md->flags))
|
||||
fprintf(stdout, "TRUE\n");
|
||||
else
|
||||
fprintf(stdout, "FALSE\n");
|
||||
|
||||
fprintf(stdout, "%*sIs Setter? ", indent, " ");
|
||||
if (XPT_MD_IS_SETTER(md->flags))
|
||||
fprintf(stdout, "TRUE\n");
|
||||
else
|
||||
fprintf(stdout, "FALSE\n");
|
||||
|
||||
fprintf(stdout, "%*sIs Varargs? ", indent, " ");
|
||||
if (XPT_MD_IS_VARARGS(md->flags))
|
||||
fprintf(stdout, "TRUE\n");
|
||||
else
|
||||
fprintf(stdout, "FALSE\n");
|
||||
|
||||
fprintf(stdout, "%*sIs Constructor? ", indent, " ");
|
||||
if (XPT_MD_IS_CTOR(md->flags))
|
||||
fprintf(stdout, "TRUE\n");
|
||||
else
|
||||
fprintf(stdout, "FALSE\n");
|
||||
|
||||
fprintf(stdout, "%*sIs Hidden? ", indent, " ");
|
||||
if (XPT_MD_IS_HIDDEN(md->flags))
|
||||
fprintf(stdout, "TRUE\n");
|
||||
else
|
||||
fprintf(stdout, "FALSE\n");
|
||||
|
||||
fprintf(stdout, "%*s# of arguments: %d\n", indent, " ", md->num_args);
|
||||
fprintf(stdout, "%*sParameter Descriptors:\n", indent, " ");
|
||||
|
||||
for (i=0; i<md->num_args; i++) {
|
||||
fprintf(stdout, "%*sParameter #%d:\n", new_indent, " ", i);
|
||||
|
||||
if (!XPT_DumpParamDescriptor(&md->params[i], more_indent,
|
||||
verbose_mode))
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
fprintf(stdout, "%*sResult:\n", indent, " ");
|
||||
if (!XPT_DumpParamDescriptor(md->result, new_indent, verbose_mode)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
} else {
|
||||
char *param_type;
|
||||
XPTParamDescriptor *pd;
|
||||
|
||||
if (!XPT_GetStringForType(&md->result->type, ¶m_type)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
fprintf(stdout, "%*s%s %s(", indent, " ", param_type, md->name);
|
||||
for (i=0; i<md->num_args; i++) {
|
||||
if (i!=0) {
|
||||
fprintf(stdout, ", ");
|
||||
}
|
||||
pd = &md->params[i];
|
||||
if (XPT_PD_IS_IN(pd->flags)) {
|
||||
fprintf(stdout, "in");
|
||||
if (XPT_PD_IS_OUT(pd->flags)) {
|
||||
fprintf(stdout, "/out ");
|
||||
if (XPT_PD_IS_RETVAL(pd->flags)) {
|
||||
fprintf(stdout, "retval ");
|
||||
}
|
||||
} else {
|
||||
fprintf(stdout, " ");
|
||||
}
|
||||
} else {
|
||||
if (XPT_PD_IS_OUT(pd->flags)) {
|
||||
fprintf(stdout, "out ");
|
||||
if (XPT_PD_IS_RETVAL(pd->flags)) {
|
||||
fprintf(stdout, "retval ");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!XPT_GetStringForType(&pd->type, ¶m_type)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
fprintf(stdout, "%s", param_type);
|
||||
}
|
||||
fprintf(stdout, ");\n");
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
XPT_GetStringForType(XPTTypeDescriptor *td, char **type_string)
|
||||
{
|
||||
int tag = XPT_TDP_TAG(td->prefix);
|
||||
|
||||
if (XPT_TDP_IS_POINTER(td->prefix.flags)) {
|
||||
*type_string = ptype_array[tag];
|
||||
} else {
|
||||
*type_string = type_array[tag];
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
XPT_DumpXPTString(XPTString *str)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<str->length; i++) {
|
||||
fprintf(stdout, "%c", str->bytes[i]);
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
XPT_DumpParamDescriptor(XPTParamDescriptor *pd, const int indent,
|
||||
PRBool verbose_mode)
|
||||
{
|
||||
int new_indent = indent + BASE_INDENT;
|
||||
|
||||
fprintf(stdout, "%*sIn Param? ", indent, " ");
|
||||
if (XPT_PD_IS_IN(pd->flags))
|
||||
fprintf(stdout, "TRUE\n");
|
||||
else
|
||||
fprintf(stdout, "FALSE\n");
|
||||
|
||||
fprintf(stdout, "%*sOut Param? ", indent, " ");
|
||||
if (XPT_PD_IS_OUT(pd->flags))
|
||||
fprintf(stdout, "TRUE\n");
|
||||
else
|
||||
fprintf(stdout, "FALSE\n");
|
||||
|
||||
fprintf(stdout, "%*sRetval? ", indent, " ");
|
||||
if (XPT_PD_IS_RETVAL(pd->flags))
|
||||
fprintf(stdout, "TRUE\n");
|
||||
else
|
||||
fprintf(stdout, "FALSE\n");
|
||||
|
||||
fprintf(stdout, "%*sType Descriptor:\n", indent, " ");
|
||||
if (!XPT_DumpTypeDescriptor(&pd->type, new_indent, verbose_mode))
|
||||
return PR_FALSE;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
XPT_DumpTypeDescriptor(XPTTypeDescriptor *td, int indent, PRBool verbose_mode)
|
||||
{
|
||||
int new_indent = indent + BASE_INDENT;
|
||||
|
||||
fprintf(stdout, "%*sIs Pointer? ", indent, " ");
|
||||
if (XPT_TDP_IS_POINTER(td->prefix.flags))
|
||||
fprintf(stdout, "TRUE\n");
|
||||
else
|
||||
fprintf(stdout, "FALSE\n");
|
||||
|
||||
fprintf(stdout, "%*sIs Unique Pointer? ", indent, " ");
|
||||
if (XPT_TDP_IS_UNIQUE_POINTER(td->prefix.flags))
|
||||
fprintf(stdout, "TRUE\n");
|
||||
else
|
||||
fprintf(stdout, "FALSE\n");
|
||||
|
||||
fprintf(stdout, "%*sIs Reference? ", indent, " ");
|
||||
if (XPT_TDP_IS_REFERENCE(td->prefix.flags))
|
||||
fprintf(stdout, "TRUE\n");
|
||||
else
|
||||
fprintf(stdout, "FALSE\n");
|
||||
|
||||
fprintf(stdout, "%*sTag: %d\n", indent, " ",
|
||||
XPT_TDP_TAG(td->prefix));
|
||||
|
||||
if (XPT_TDP_TAG(td->prefix) == TD_INTERFACE_TYPE) {
|
||||
fprintf(stdout, "%*sInterfaceTypeDescriptor:\n", indent, " ");
|
||||
fprintf(stdout, "%*sIndex of IDE: %d\n", new_indent, " ",
|
||||
td->type.interface);
|
||||
}
|
||||
|
||||
if (XPT_TDP_TAG(td->prefix) == TD_INTERFACE_IS_TYPE) {
|
||||
fprintf(stdout, "%*sInterfaceTypeDescriptor:\n", indent, " ");
|
||||
fprintf(stdout, "%*sIndex of Method Argument: %d\n", new_indent, " ",
|
||||
td->type.argnum);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
XPT_DumpConstDescriptor(XPTConstDescriptor *cd, const int indent, PRBool verbose_mode)
|
||||
{
|
||||
int new_indent = indent + BASE_INDENT;
|
||||
char *out, *const_type;
|
||||
|
||||
if (verbose_mode) {
|
||||
fprintf(stdout, "%*sName: %s\n", indent, " ", cd->name);
|
||||
fprintf(stdout, "%*sType Descriptor: \n", indent, " ");
|
||||
if (!XPT_DumpTypeDescriptor(&cd->type, new_indent, verbose_mode))
|
||||
return PR_FALSE;
|
||||
fprintf(stdout, "%*sValue: ", indent, " ");
|
||||
} else {
|
||||
if (!XPT_GetStringForType(&cd->type, &const_type)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
fprintf(stdout, "%*s%s %s = ", indent, " ", const_type, cd->name);
|
||||
}
|
||||
|
||||
switch(XPT_TDP_TAG(cd->type.prefix)) {
|
||||
case TD_INT8:
|
||||
fprintf(stdout, "%d", cd->value.i8);
|
||||
break;
|
||||
case TD_INT16:
|
||||
fprintf(stdout, "%d", cd->value.i16);
|
||||
break;
|
||||
case TD_INT32:
|
||||
fprintf(stdout, "%d", cd->value.i32);
|
||||
break;
|
||||
case TD_INT64:
|
||||
out = PR_smprintf("%lld", cd->value.i64);
|
||||
fputs(out, stdout);
|
||||
PR_smprintf_free(out);
|
||||
break;
|
||||
case TD_UINT8:
|
||||
fprintf(stdout, "%d", cd->value.ui8);
|
||||
break;
|
||||
case TD_UINT16:
|
||||
fprintf(stdout, "%d", cd->value.ui16);
|
||||
break;
|
||||
case TD_UINT32:
|
||||
fprintf(stdout, "%d", cd->value.ui32);
|
||||
break;
|
||||
case TD_UINT64:
|
||||
out = PR_smprintf("%lld", cd->value.ui64);
|
||||
fputs(out, stdout);
|
||||
PR_smprintf_free(out);
|
||||
break;
|
||||
case TD_FLOAT:
|
||||
fprintf(stdout, "%f", cd->value.flt);
|
||||
break;
|
||||
case TD_DOUBLE:
|
||||
fprintf(stdout, "%g", cd->value.dbl);
|
||||
break;
|
||||
case TD_BOOL:
|
||||
if (cd->value.bul)
|
||||
fprintf(stdout, "TRUE");
|
||||
else
|
||||
fprintf(stdout, "FALSE");
|
||||
break;
|
||||
case TD_CHAR:
|
||||
fprintf(stdout, "%c", cd->value.ch);
|
||||
break;
|
||||
case TD_WCHAR:
|
||||
fprintf(stdout, "%c", cd->value.wch & 0xff);
|
||||
break;
|
||||
case TD_VOID:
|
||||
fprintf(stdout, "VOID");
|
||||
break;
|
||||
case TD_PNSIID:
|
||||
if (XPT_TDP_IS_POINTER(cd->type.prefix.flags)) {
|
||||
print_IID(cd->value.iid, stdout);
|
||||
} else
|
||||
return PR_FALSE;
|
||||
break;
|
||||
case TD_PBSTR:
|
||||
if (XPT_TDP_IS_POINTER(cd->type.prefix.flags)) {
|
||||
if (!XPT_DumpXPTString(cd->value.string))
|
||||
return PR_FALSE;
|
||||
} else
|
||||
return PR_FALSE;
|
||||
break;
|
||||
case TD_PSTRING:
|
||||
if (XPT_TDP_IS_POINTER(cd->type.prefix.flags)) {
|
||||
fprintf(stdout, "%s", cd->value.str);
|
||||
} else
|
||||
return PR_FALSE;
|
||||
break;
|
||||
case TD_PWSTRING:
|
||||
if (XPT_TDP_IS_POINTER(cd->type.prefix.flags)) {
|
||||
PRUint16 *ch = cd->value.wstr;
|
||||
while (*ch) {
|
||||
fprintf(stdout, "%c", *ch & 0xff);
|
||||
ch++;
|
||||
}
|
||||
} else
|
||||
return PR_FALSE;
|
||||
break;
|
||||
default:
|
||||
perror("Unrecognized type");
|
||||
return PR_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (verbose_mode) {
|
||||
fprintf(stdout, "\n");
|
||||
} else {
|
||||
fprintf(stdout, ";\n");
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
27
mozilla/xpcom/macbuild/xpcom.Prefix
Normal file
27
mozilla/xpcom/macbuild/xpcom.Prefix
Normal file
@@ -0,0 +1,27 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
//
|
||||
// xpcom.Prefix
|
||||
//
|
||||
// Global prefix file for the xpcom project.
|
||||
//
|
||||
//
|
||||
|
||||
#include "MacPrefix.h"
|
||||
#include "xpcomConfig.h"
|
||||
102
mozilla/xpcom/macbuild/xpcom.exp
Normal file
102
mozilla/xpcom/macbuild/xpcom.exp
Normal file
@@ -0,0 +1,102 @@
|
||||
#ToString__4nsIDCFv # nsID::ToString() const
|
||||
Parse__4nsIDFPc # nsID::Parse(char*)
|
||||
#__vt__5IDKey # IDKey::__vt
|
||||
#monitor__12nsRepository # nsRepository::monitor
|
||||
#factories__12nsRepository # nsRepository::factories
|
||||
#HashValue__5IDKeyCFv # IDKey::HashValue() const
|
||||
#Equals__5IDKeyCFPC9nsHashKey # IDKey::Equals(const nsHashKey*) const
|
||||
#Clone__5IDKeyCFv # IDKey::Clone() const
|
||||
FreeLibraries__12nsRepositoryFv # nsRepository::FreeLibraries()
|
||||
UnregisterFactory__12nsRepositoryFRC4nsIDPCc # nsRepository::UnregisterFactory(const nsID&,const char*)
|
||||
UnregisterFactory__12nsRepositoryFRC4nsIDP10nsIFactory # nsRepository::UnregisterFactory(const nsID&,nsIFactory*)
|
||||
RegisterFactory__12nsRepositoryFRC4nsIDPCcii # nsRepository::RegisterFactory(const nsID&,const char*,int,int)
|
||||
RegisterFactory__12nsRepositoryFRC4nsIDP10nsIFactoryi # nsRepository::RegisterFactory(const nsID&,nsIFactory*,int)
|
||||
#CreateInstance2__12nsRepositoryFRC4nsIDP11nsISupportsRC4nsIDPvPPv # nsRepository::CreateInstance2(const nsID&,nsISupports*,const nsID&,void*,void**)
|
||||
CreateInstance__12nsRepositoryFRC4nsIDP11nsISupportsRC4nsIDPPv # nsRepository::CreateInstance(const nsID&,nsISupports*,const nsID&,void**)
|
||||
#Initialize__12nsRepositoryFv # nsRepository::Initialize()
|
||||
#checkInitialized__12nsRepositoryFv # nsRepository::checkInitialized()
|
||||
#__dt__5IDKeyFv # IDKey::~IDKey()
|
||||
FindFactory__12nsRepositoryFRC4nsIDPP10nsIFactory # nsRepository::FindFactory(const nsID&,nsIFactory**)
|
||||
#__vt__9nsHashKey # nsHashKey::__vt
|
||||
Enumerate__11nsHashtableFPFP9nsHashKeyPvPv_iPv # nsHashtable::Enumerate(int (*)(nsHashKey*, void*))
|
||||
Clone__11nsHashtableFv # nsHashtable::Clone()
|
||||
Reset__11nsHashtableFv # nsHashtable::Reset()
|
||||
Remove__11nsHashtableFP9nsHashKey # nsHashtable::Remove(nsHashKey*)
|
||||
Get__11nsHashtableFP9nsHashKey # nsHashtable::Get(nsHashKey*)
|
||||
Put__11nsHashtableFP9nsHashKeyPv # nsHashtable::Put(nsHashKey*,void*)
|
||||
__dt__11nsHashtableFv # nsHashtable::~nsHashtable()
|
||||
__ct__11nsHashtableFUi # nsHashtable::nsHashtable(unsigned int)
|
||||
__dt__9nsHashKeyFv # nsHashKey::~nsHashKey()
|
||||
__ct__9nsHashKeyFv # nsHashKey::nsHashKey()
|
||||
Warning__7nsDebugFPCcPCci # nsDebug::Warning(const char*,const char*,int)
|
||||
Error__7nsDebugFPCcPCci # nsDebug::Error(const char*,const char*,int)
|
||||
NotReached__7nsDebugFPCcPCci # nsDebug::NotReached(const char*,const char*,int)
|
||||
NotYetImplemented__7nsDebugFPCcPCci # nsDebug::NotYetImplemented(const char*,const char*,int)
|
||||
Assertion__7nsDebugFPCcPCcPCci # nsDebug::Assertion(const char*,const char*,const char*,int)
|
||||
PostCondition__7nsDebugFPCcPCcPCci # nsDebug::PostCondition(const char*,const char*,const char*,int)
|
||||
PreCondition__7nsDebugFPCcPCcPCci # nsDebug::PreCondition(const char*,const char*,const char*,int)
|
||||
Create__8nsMallocFP11nsISupportsRC4nsIDPPv # nsMalloc::Create(nsISupports*,const nsID&,void**)
|
||||
#Break__7nsDebugFPCci # nsDebug::Break(const char*,int)
|
||||
Abort__7nsDebugFPCci # nsDebug::Abort(const char*,int)
|
||||
#__vt__17SupportsArrayImpl # SupportsArrayImpl::__vt
|
||||
#__vt__16nsISupportsArray # nsISupportsArray::__vt
|
||||
#__vt__11nsISupports # nsISupports::__vt
|
||||
#__eq__17SupportsArrayImplCFRC16nsISupportsArray # SupportsArrayImpl::operator ==(const nsISupportsArray&) const
|
||||
#Count__17SupportsArrayImplCFv # SupportsArrayImpl::Count() const
|
||||
#__vc__17SupportsArrayImplCFi # SupportsArrayImpl::operator [](int) const
|
||||
#AppendElement__17SupportsArrayImplFP11nsISupports # SupportsArrayImpl::AppendElement(nsISupports*)
|
||||
NS_NewISupportsArray__FPP16nsISupportsArray # NS_NewISupportsArray(nsISupportsArray**)
|
||||
#EnumerateBackwards__17SupportsArrayImplFPFP11nsISupportsPv_iPv # SupportsArrayImpl::EnumerateBackwards(int (*)(nsISupports*, void*),void*)
|
||||
#EnumerateForwards__17SupportsArrayImplFPFP11nsISupportsPv_iPv # SupportsArrayImpl::EnumerateForwards(int (*)(nsISupports*, void*),void*)
|
||||
#Compact__17SupportsArrayImplFv # SupportsArrayImpl::Compact()
|
||||
#Clear__17SupportsArrayImplFv # SupportsArrayImpl::Clear()
|
||||
#RemoveLastElement__17SupportsArrayImplFPC11nsISupports # SupportsArrayImpl::RemoveLastElement(const nsISupports*)
|
||||
#RemoveElement__17SupportsArrayImplFPC11nsISupportsi # SupportsArrayImpl::RemoveElement(const nsISupports*,int)
|
||||
#RemoveElementAt__17SupportsArrayImplFi # SupportsArrayImpl::RemoveElementAt(int)
|
||||
#ReplaceElementAt__17SupportsArrayImplFP11nsISupportsi # SupportsArrayImpl::ReplaceElementAt(nsISupports*,int)
|
||||
#InsertElementAt__17SupportsArrayImplFP11nsISupportsi # SupportsArrayImpl::InsertElementAt(nsISupports*,int)
|
||||
#LastIndexOf__17SupportsArrayImplCFPC11nsISupports # SupportsArrayImpl::LastIndexOf(const nsISupports*) const
|
||||
#IndexOf__17SupportsArrayImplCFPC11nsISupportsi # SupportsArrayImpl::IndexOf(const nsISupports*,int) const
|
||||
#ElementAt__17SupportsArrayImplCFi # SupportsArrayImpl::ElementAt(int) const
|
||||
#Equals__17SupportsArrayImplCFPC16nsISupportsArray # SupportsArrayImpl::Equals(const nsISupportsArray*) const
|
||||
#__as__17SupportsArrayImplFRC16nsISupportsArray # SupportsArrayImpl::operator =(const nsISupportsArray&)
|
||||
#DeleteArray__17SupportsArrayImplFv # SupportsArrayImpl::DeleteArray()
|
||||
#QueryInterface__17SupportsArrayImplFRC4nsIDPPv # SupportsArrayImpl::QueryInterface(const nsID&,void**)
|
||||
#Release__17SupportsArrayImplFv # SupportsArrayImpl::Release()
|
||||
#AddRef__17SupportsArrayImplFv # SupportsArrayImpl::AddRef()
|
||||
#__dt__17SupportsArrayImplFv # SupportsArrayImpl::~SupportsArrayImpl()
|
||||
#__ct__17SupportsArrayImplFv # SupportsArrayImpl::SupportsArrayImpl()
|
||||
#PL_VectorAssertValid
|
||||
PL_VectorRemove
|
||||
PL_VectorInsert
|
||||
PL_VectorAdd
|
||||
PL_VectorSet
|
||||
PL_VectorClone
|
||||
PL_VectorCopy
|
||||
PL_VectorCompact
|
||||
PL_VectorIsValidIndex
|
||||
PL_VectorSetSize
|
||||
PL_VectorFinalize
|
||||
PL_VectorInitialize
|
||||
PL_VectorDestroy
|
||||
PL_NewVector
|
||||
|
||||
# GetFactory call
|
||||
NSGetFactory
|
||||
nsRegistry_GetFactory
|
||||
|
||||
# nsServiceManager static method exports.
|
||||
ReleaseService__16nsServiceManagerFRC4nsIDP11nsISupportsP19nsIShutdownListener
|
||||
GetService__16nsServiceManagerFRC4nsIDRC4nsIDPP11nsISupportsP19nsIShutdownListener
|
||||
|
||||
# nsTraceRefcnt
|
||||
Destroy__13nsTraceRefcntFPvPCci
|
||||
Create__13nsTraceRefcntFPvPCcPCci
|
||||
Release__13nsTraceRefcntFPvUlPCci
|
||||
AddRef__13nsTraceRefcntFPvUlPCci
|
||||
|
||||
# nsCOMPtr
|
||||
begin_assignment__13nsCOMPtr_baseFv
|
||||
assign_with_QueryInterface__13nsCOMPtr_baseFP11nsISupportsRC4nsIDPUi
|
||||
assign_with_AddRef__13nsCOMPtr_baseFP11nsISupports
|
||||
|
||||
14
mozilla/xpcom/macbuild/xpcom.toc
Normal file
14
mozilla/xpcom/macbuild/xpcom.toc
Normal file
@@ -0,0 +1,14 @@
|
||||
# target: xpcomDebug.shlb
|
||||
mozilla/modules/plugin/src/nsMalloc.cpp
|
||||
mozilla/xpcom/macbuild/xpcom.exp
|
||||
mozilla/xpcom/macbuild/xpcomDebug.exp
|
||||
mozilla/xpcom/src/nsDebug.cpp
|
||||
mozilla/xpcom/src/nsHashtable.cpp
|
||||
mozilla/xpcom/src/nsID.cpp
|
||||
mozilla/xpcom/src/nsRepository.cpp
|
||||
mozilla/xpcom/src/nsServiceManager.cpp
|
||||
mozilla/xpcom/src/nsSupportsArray.cpp
|
||||
mozilla/xpcom/src/nsTraceRefcnt.cpp
|
||||
mozilla/xpcom/src/plvector.c
|
||||
mozilla/xpcom/src/xcDll.cpp
|
||||
mozilla/xpcom/src/xcDllStore.cpp
|
||||
19
mozilla/xpcom/macbuild/xpcomConfig.h
Normal file
19
mozilla/xpcom/macbuild/xpcomConfig.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* Nothing to do here. Add xpcom-specific defines here if necessary */
|
||||
27
mozilla/xpcom/macbuild/xpcomDebug.Prefix
Normal file
27
mozilla/xpcom/macbuild/xpcomDebug.Prefix
Normal file
@@ -0,0 +1,27 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
//
|
||||
// xpcomDebug.Prefix
|
||||
//
|
||||
// Global prefix file for the xpcom project.
|
||||
//
|
||||
//
|
||||
|
||||
#include "MacPrefix_debug.h"
|
||||
#include "xpcomConfig.h"
|
||||
2
mozilla/xpcom/macbuild/xpcomDebug.exp
Normal file
2
mozilla/xpcom/macbuild/xpcomDebug.exp
Normal file
@@ -0,0 +1,2 @@
|
||||
# These are now just additions for the debug build.
|
||||
PL_VectorAssertValid
|
||||
BIN
mozilla/xpcom/macbuild/xpcomPPC.mcp
Normal file
BIN
mozilla/xpcom/macbuild/xpcomPPC.mcp
Normal file
Binary file not shown.
24
mozilla/xpcom/makefile.win
Normal file
24
mozilla/xpcom/makefile.win
Normal file
@@ -0,0 +1,24 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=..
|
||||
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
DIRS=public src tests tools
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
26
mozilla/xpcom/public/MANIFEST
Normal file
26
mozilla/xpcom/public/MANIFEST
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
nsCOMPtr.h
|
||||
nsCom.h
|
||||
nsAgg.h
|
||||
nsDebug.h
|
||||
nsError.h
|
||||
nsHashtable.h
|
||||
nsID.h
|
||||
nsIFactory.h
|
||||
nsISupports.h
|
||||
nsIPtr.h
|
||||
nsIServiceManager.h
|
||||
nsISupportsArray.h
|
||||
nsRepository.h
|
||||
nsIEnumerator.h
|
||||
nsVector.h
|
||||
nsMacRepository.h
|
||||
nsTraceRefcnt.h
|
||||
plvector.h
|
||||
nsXPComFactory.h
|
||||
nsXPComCIID.h
|
||||
nsIEventQueueService.h
|
||||
nsICollection.h
|
||||
54
mozilla/xpcom/public/Makefile.in
Normal file
54
mozilla/xpcom/public/Makefile.in
Normal file
@@ -0,0 +1,54 @@
|
||||
#!gmake
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = xpcom
|
||||
|
||||
EXPORTS = \
|
||||
nsCOMPtr.h \
|
||||
nsCom.h \
|
||||
nsAgg.h \
|
||||
nsDebug.h \
|
||||
nsError.h \
|
||||
nsHashtable.h \
|
||||
nsIAllocator.h \
|
||||
nsICollection.h \
|
||||
nsID.h \
|
||||
nsIFactory.h \
|
||||
nsISupports.h \
|
||||
nsIPtr.h \
|
||||
nsIServiceManager.h \
|
||||
nsISupportsArray.h \
|
||||
nsProxyEvent.h \
|
||||
nsRepository.h \
|
||||
nsIEnumerator.h \
|
||||
nsTraceRefcnt.h \
|
||||
nsVector.h \
|
||||
plvector.h \
|
||||
nsXPComFactory.h \
|
||||
nsXPComCIID.h \
|
||||
nsIEventQueueService.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
51
mozilla/xpcom/public/makefile.win
Normal file
51
mozilla/xpcom/public/makefile.win
Normal file
@@ -0,0 +1,51 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
DEPTH=..\..
|
||||
|
||||
EXPORTS = \
|
||||
nsCOMPtr.h \
|
||||
nsAgg.h \
|
||||
nsCom.h \
|
||||
nsDebug.h \
|
||||
nsError.h \
|
||||
nsHashtable.h \
|
||||
nsICollection.h \
|
||||
nsID.h \
|
||||
nsIFactory.h \
|
||||
nsISupports.h \
|
||||
nsIPtr.h \
|
||||
nsIServiceManager.h \
|
||||
nsISupportsArray.h \
|
||||
nsProxyEvent.h \
|
||||
nsRepository.h \
|
||||
nsIEnumerator.h \
|
||||
nsTraceRefcnt.h \
|
||||
nsVector.h \
|
||||
plvector.h \
|
||||
nsXPComFactory.h \
|
||||
nsXPComCIID.h \
|
||||
nsIEventQueueService.h \
|
||||
nsIAllocator.h \
|
||||
nsIRegistry.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpcom
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
168
mozilla/xpcom/public/mozIClassRegistry.h
Normal file
168
mozilla/xpcom/public/mozIClassRegistry.h
Normal file
@@ -0,0 +1,168 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef __mozIClassRegistry_h
|
||||
#define __mozIClassRegistry_h
|
||||
|
||||
#include "nsRepository.h"
|
||||
|
||||
/*---------------------------- mozIClassRegistry -------------------------------
|
||||
| This interface provides access to a mapping from mnemonic interface names |
|
||||
| to shared libraries where implementations of those interfaces can be located.|
|
||||
| |
|
||||
| This interface is designed to provide two things: |
|
||||
| 1. A means of less static binding between clients and the code that |
|
||||
| implements the XPCOM interfaces those clients use. This accomplished |
|
||||
| by the mapping from interface names to nsCID (and the shared libraries |
|
||||
| that implement those classes). |
|
||||
| 2. A means of dynamically changing the mapping from interface name to |
|
||||
| implementation. The canonical example of this is to switch to a |
|
||||
| "native" widget set versus an "XP" (implemented using gfx) set. |
|
||||
| |
|
||||
| The first goal is achieved by storing (in a "Netscape Registry" file, see |
|
||||
| nsReg.h) information that maps interface/class "names" to information about |
|
||||
| where to load implementations of those interfaces. That information |
|
||||
| includes the interface ID, class ID (of the implementation class), and the |
|
||||
| name of the shared library that contains the implementation. |
|
||||
| |
|
||||
| The class registry object will register those classes with the "repository" |
|
||||
| (see nsRepository.h) the first time a request is made to create an |
|
||||
| instance. Subsequent requests will simply be forwarded to the repository |
|
||||
| after the appropriate interface and class IDs are determined. |
|
||||
| |
|
||||
| The second goal is accomplished by permitting the mnemonic interface |
|
||||
| "names" to be "overloaded", that is, mapped to distinct implementations |
|
||||
| by separate class registry objects. Further, class registries can be |
|
||||
| cascaded: they can be chained together so that when a name is not |
|
||||
| recognized by one registry, it can pass the request to the next registry in |
|
||||
| the chain. Users can control resolution by making the request of a |
|
||||
| registry further up/down the chain. |
|
||||
| |
|
||||
| For example, consider the case of "native" vs. "gfx" widgets. This might |
|
||||
| be structured by a class registry arrangment like this: |
|
||||
| |
|
||||
| nativeWidgetRegistry baseWidgetRegistry |
|
||||
| +----------+ +----------+ |
|
||||
| | ----+---------------->| | |
|
||||
| +----------+ +----------+ |
|
||||
| |toolbar| -+-----+ |toolbar| -+-----+ |
|
||||
| +----------+ | +----------+ | |
|
||||
| |button | -+-----+ |button | -+-----+ |
|
||||
| +----------+ | +----------+ | |
|
||||
| V V |
|
||||
| +-----------------+ +-----------------+ |
|
||||
| | native.dll | | base.dll | |
|
||||
| +-----------------+ +-----------------+ |
|
||||
| |
|
||||
| If a specialized implementation of widgets is present (e.g., native.dll) |
|
||||
| then a corresponding class registry object is created and added to the |
|
||||
| head of the registry chain. Object creation requests (normal ones) are |
|
||||
| resolved to the native implementation. If such a library is not present, |
|
||||
| then the resolution is to the base implementation. If objects of the |
|
||||
| base implementation are required, then creation requests can be directed |
|
||||
| directly to the baseWidgetRegistry object, rather than the head of the |
|
||||
| registry chain. |
|
||||
| |
|
||||
| It is intended that there be a single instance of this interface, accessed |
|
||||
| via the Service Manager (see nsServiceManager.h). |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct mozIClassRegistry : public ISupports {
|
||||
|
||||
/*------------------------------ CreateInstance ----------------------------
|
||||
| Create an instance of the requested class/interface. The interface |
|
||||
| ID is required to specify how the result will be treated. The class |
|
||||
| named by aName must support this interface. The result is placed in |
|
||||
| ncomment aResult (NULL if the request fails). "start" specifies the |
|
||||
| registry at which the search for an implementation of the named |
|
||||
| interface should start. It defaults to 0 (indicating to start at the |
|
||||
| head of the registry chain). |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD CreateInstance( const char *anInterfaceName,
|
||||
const nsIID &aIID,
|
||||
void* *aResult,
|
||||
const char *start = 0 ) = 0;
|
||||
|
||||
/*--------------------------- CreateEnumerator -----------------------------
|
||||
| Creates an nsIEnumerator interface object that can be used to examine |
|
||||
| the contents of the registry. "pattern" specifies either "*" or the |
|
||||
| name of a specific interface that you want to query. "result" will |
|
||||
| be set to point to a new object (which will be freed on the last call |
|
||||
| to its Release() member). See nsIEnumerator.h for details on how to |
|
||||
| use the returned interface pointer. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD CreateEnumerator( const char *pattern,
|
||||
nsIEnumerator* *result ) = 0;
|
||||
}; // mozIClassRegistry
|
||||
|
||||
|
||||
/*-------------------------- mozIClassRegistryEntry ----------------------------
|
||||
| Objects of this class represent the individual elements that comprise a |
|
||||
| mozIClassRegistry interface. You obtain such objects by applying the |
|
||||
| CreateEnumerator member function to the class registry and then applying |
|
||||
| the CurrentItem member function to the resulting nsIEnumerator interface. |
|
||||
| |
|
||||
| Each entry can be queried for the following information: |
|
||||
| o sub-registry name |
|
||||
| o interface name |
|
||||
| o Class ID |
|
||||
| o IIDs implemented |
|
||||
| |
|
||||
| The information obtained from the entry (specifically, the const char* |
|
||||
| strings) remains valid for the life of the entry (i.e., until you |
|
||||
| Release() it). |
|
||||
| |
|
||||
| Here is an example of code that uses this interface to dump the contents |
|
||||
| of a mozIClassRegistry: |
|
||||
| |
|
||||
| mozIClassRegistry *reg = nsServiceManager::GetService( kIDRegistry ); |
|
||||
| nsIEnumerator *enum; |
|
||||
| reg->CreateEnumerator( "*", &enum ); |
|
||||
| for ( enum->First(); !enum->IsDone(); enum->Next(); ) { |
|
||||
| mozIClassRegistryEntry *entry; |
|
||||
| enum->CurrentItem( &entry ); |
|
||||
| const char *subreg; |
|
||||
| const char *name; |
|
||||
| nsCID cid; |
|
||||
| int numIIDs; |
|
||||
| entry->GetSubRegistryName( &subreg ); |
|
||||
| entry->GetInterfaceName( &name ); |
|
||||
| entry->GetClassID( &cid ); |
|
||||
| entry->GetNumIIDs( &numIIDs ); |
|
||||
| cout << subreg << "/" << name << " = " << cid.ToString() << endl; |
|
||||
| for ( int i = 0; i < numIIDs; i++ ) { |
|
||||
| nsIID iid; |
|
||||
| entry->GetInterfaceID( i, &iid ); |
|
||||
| cout << "/tIID[" << i << "] = " << iid.ToString() << endl; |
|
||||
| } |
|
||||
| entry->Release(); |
|
||||
| } |
|
||||
| enum->Release(); |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct mozIClassRegistryEntry : public nsISupports {
|
||||
NS_IMETHOD GetSubRegistryName( const char **result ) = 0;
|
||||
NS_IMETHOD GetInterfaceName( const char **result ) = 0;
|
||||
NS_IMETHOD GetClassID( nsCID *result ) = 0;
|
||||
NS_IMETHOD GetNumIIDs( int *result ) = 0;
|
||||
NS_IMETHOD GetInterfaceID( int n, nsIID *result ) = 0;
|
||||
}; // mozIClassRegistryEntry
|
||||
|
||||
// {5D41A440-8E37-11d2-8059-00600811A9C3}
|
||||
#define MOZ_ICLASSREGISTRY_IID { 0x5d41a440, 0x8e37, 0x11d2, { 0x80, 0x59, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } }
|
||||
// {D1B54831-AC07-11d2-805E-00600811A9C3}
|
||||
#define MOZ_ICLASSREGISTRYENTRY_IID { 0xd1b54831, 0xac07, 0x11d2, { 0x80, 0x5e, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } }
|
||||
|
||||
#endif
|
||||
326
mozilla/xpcom/public/mozIRegistry.h
Normal file
326
mozilla/xpcom/public/mozIRegistry.h
Normal file
@@ -0,0 +1,326 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef __mozIRegistry_h
|
||||
#define __mozIRegistry_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIEnumerator;
|
||||
|
||||
/*------------------------------- mozIRegistry ---------------------------------
|
||||
| This interface provides access to a tree of arbitrary values. |
|
||||
| |
|
||||
| Each node of the tree contains either a value or a subtree or both. |
|
||||
| |
|
||||
| The value at any of these leaf nodes can be any of these "primitive" types: |
|
||||
| o string (null terminated UTF string) |
|
||||
| o array of 32-bit integers |
|
||||
| o arbitrary array of bytes |
|
||||
| o file identifier |
|
||||
| Of course, since you can store an arbitrary array of bytes, you can put |
|
||||
| any data you like into a registry (although you have the burden of |
|
||||
| encoding/decoding your data in that case). |
|
||||
| |
|
||||
| Each branch of the tree is labelled with a string "key." The entire path |
|
||||
| from a given point of the tree to another point further down can be |
|
||||
| presented as a single string composed of each branch's label, concatenated |
|
||||
| to the next, with an intervening forward slash ('/'). The term "key" |
|
||||
| refers to both specific tree branch labels and to such concatenated paths. |
|
||||
| |
|
||||
| The branches from a given node must have unique labels. Distinct nodes can |
|
||||
| have branches with the same label. |
|
||||
| |
|
||||
| For example, here's a small registry tree: |
|
||||
| | |
|
||||
| /\ |
|
||||
| / \ |
|
||||
| / \ |
|
||||
| / \ |
|
||||
| "Classes" "Users" |
|
||||
| / \ |
|
||||
| / \ |
|
||||
| / ["joe"] |
|
||||
| / / \ |
|
||||
| | / \ |
|
||||
| /\ / \ |
|
||||
| / \ "joe" "bob" |
|
||||
| / \ / \ |
|
||||
| / \ |
|
||||
| "{xxxx-xx-1}" "{xxxx-xx-2}" ["c:/joe"] ["d:/Robert"] |
|
||||
| | | |
|
||||
| /\ /\ |
|
||||
| / \ / \ |
|
||||
| / \ / \ |
|
||||
| "Library" "Version" "Library" "Version" |
|
||||
| / \ / \ |
|
||||
| ["foo.dll"] 2 ["bar.dll"] 1 |
|
||||
| |
|
||||
| In this example, there are 2 keys under the root: "Classes" and "Users". |
|
||||
| The first denotes a subtree only (which has two subtrees, ...). The second |
|
||||
| denotes both a value ["joe"] and two subtrees labelled "joe" and "bob". |
|
||||
| The value at the node "/Users" is ["joe"], at "/Users/bob" is ["d:/Robert"]. |
|
||||
| The value at "/Classes/{xxxx-xx-1}/Version" is 2. |
|
||||
| |
|
||||
| The registry interface provides functions that let you navigate the tree |
|
||||
| and manipulate it's contents. |
|
||||
| |
|
||||
| Please note that the registry itself does not impose any structure or |
|
||||
| meaning on the contents of the tree. For example, the registry doesn't |
|
||||
| control whether the value at the key "/Users" is the label for the subtree |
|
||||
| with information about the last active user. That meaning is applied by |
|
||||
| the code that stores these values and uses them for that purpose. |
|
||||
| |
|
||||
| [Any resemblence between this example and actual contents of any actual |
|
||||
| registry is purely coincidental.] |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct mozIRegistry : public nsISupports {
|
||||
/*------------------------------ Constants ---------------------------------
|
||||
| The following enumerated types and values are used by the registry |
|
||||
| interface. |
|
||||
--------------------------------------------------------------------------*/
|
||||
typedef enum {
|
||||
String = 1,
|
||||
Int32,
|
||||
Bytes,
|
||||
File
|
||||
} DataType;
|
||||
|
||||
/*-------------------------------- Types -----------------------------------
|
||||
| The following data types are used by this interface. All are basically |
|
||||
| opaque types. You obtain objects of these types via certain member |
|
||||
| function calls and re-use them later (without having to know what they |
|
||||
| contain). |
|
||||
| |
|
||||
| Key - Placeholder to represent a particular node in a registry |
|
||||
| tree. There are 3 enumerated values that correspond to |
|
||||
| specific nodes: |
|
||||
| Common - Where most stuff goes. |
|
||||
| Users - Special subtree to hold info about |
|
||||
| "users"; if you don't know what goes |
|
||||
| here, don't mess with it. |
|
||||
| CurrentUser - Subtree under Users corresponding to |
|
||||
| whatever user is designed the "current" |
|
||||
| one; see note above. |
|
||||
| You can specify any of these enumerated values as "keys" |
|
||||
| on any member function that takes a mozRegistry::Key. |
|
||||
| ValueInfo - Structure describing a registry value. |
|
||||
--------------------------------------------------------------------------*/
|
||||
typedef uint32 Key;
|
||||
|
||||
enum { Users = 1, Common = 2, CurrentUser = 3 };
|
||||
|
||||
struct ValueInfo {
|
||||
DataType type;
|
||||
uint32 length;
|
||||
};
|
||||
|
||||
/*--------------------------- Opening/Closing ------------------------------
|
||||
| These functions open the specified registry file (Open() with a non-null |
|
||||
| argument) or the default "standard" registry file (Open() with a null |
|
||||
| argument or OpenDefault()). |
|
||||
| |
|
||||
| Once opened, you can access the registry contents via the read/write |
|
||||
| or query functions. |
|
||||
| |
|
||||
| The registry file will be closed automatically when the registry object |
|
||||
| is destroyed. You can close the file prior to that by using the |
|
||||
| Close() function. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD Open( const char *regFile = 0 ) = 0;
|
||||
NS_IMETHOD OpenDefault() = 0;
|
||||
NS_IMETHOD Close() = 0;
|
||||
|
||||
/*----------------------- Reading/Writing Values ---------------------------
|
||||
| These functions read/write the registry values at a given node. |
|
||||
| |
|
||||
| All functions require you to specify where in the registry key to |
|
||||
| get/set the value. The location is specified using two components: |
|
||||
| o A "base key" indicating where to start from; this is a value of type |
|
||||
| mozIRegistry::Key. You use either one of the special "root" key |
|
||||
| values or a subkey obtained via some other member function call. |
|
||||
| o A "relative path," expressed as a sequence of subtree names |
|
||||
| separated by forward slashes. This path describes how to get from |
|
||||
| the base key to the node at which you want to store the data. This |
|
||||
| component can be a null pointer which means the value goes directly |
|
||||
| at the node denoted by the base key. |
|
||||
| |
|
||||
| When you request a value of a given type, the data stored at the |
|
||||
| specified node must be of the type requested. If not, an error results. |
|
||||
| |
|
||||
| GetString - Obtains a newly allocated copy of a string type value. The |
|
||||
| caller is obligated to free the returned string using |
|
||||
| PR_Free. |
|
||||
| SetString - Stores the argument string at the specified node. |
|
||||
| GetInt - Obtains an int32 value at the specified node. The result |
|
||||
| is returned into an int32 location you specify. |
|
||||
| SetInt - Stores a given int32 value at a node. |
|
||||
| GetBytes - Obtains a byte array value; this returns both an allocated |
|
||||
| array of bytes and a length (necessary because there may be |
|
||||
| embedded null bytes in the array). You must free the |
|
||||
| resulting array using PR_Free. |
|
||||
| SetBytes - Stores a given array of bytes; you specify the bytes via a |
|
||||
| pointer and a length. |
|
||||
| GetIntArray - Obtains the array of int32 values stored at a given node. |
|
||||
| The result is composed of two values: a pointer to an |
|
||||
| array of integer values (which must be freed using |
|
||||
| PR_Free) and the number of elements in that array. |
|
||||
| SetIntArray - Stores a set of int32 values at a given node. You must |
|
||||
| provide a pointer to the array and the number of entries. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD GetString( Key baseKey, const char *path, char **result ) = 0;
|
||||
NS_IMETHOD SetString( Key baseKey, const char *path, const char *value ) = 0;
|
||||
NS_IMETHOD GetInt( Key baseKey, const char *path, int32 *result ) = 0;
|
||||
NS_IMETHOD SetInt( Key baseKey, const char *path, int32 value ) = 0;
|
||||
NS_IMETHOD GetBytes( Key baseKey, const char *path, void **result, uint32 *len ) = 0;
|
||||
NS_IMETHOD SetBytes( Key baseKey, const char *path, void *value, uint32 len ) = 0;
|
||||
NS_IMETHOD GetIntArray( Key baseKey, const char *path, int32 **result, uint32 *len ) = 0;
|
||||
NS_IMETHOD SetIntArray( Key baseKey, const char *path, const int32 *value, uint32 len ) = 0;
|
||||
|
||||
/*------------------------------ Navigation --------------------------------
|
||||
| These functions let you navigate through the registry tree, querying |
|
||||
| its contents. |
|
||||
| |
|
||||
| As above, all these functions requires a starting tree location ("base |
|
||||
| key") specified as a mozIRegistry::Key. Some also require a path |
|
||||
| name to locate the registry node location relative to this base key. |
|
||||
| |
|
||||
| AddSubtree - Adds a new registry subtree at the specified |
|
||||
| location. Returns the resulting key in |
|
||||
| the location specified by the third argument |
|
||||
| (unless that pointer is 0). |
|
||||
| RemoveNode - Removes the specified registry subtree or |
|
||||
| value at the specified location. |
|
||||
| GetSubtree - Returns a mozIRegistry::Key that can be used |
|
||||
| to refer to the specified registry location. |
|
||||
| EnumerateSubtrees - Returns a nsIEnumerator object that you can |
|
||||
| use to enumerate all the subtrees descending |
|
||||
| from a specified location. You must free the |
|
||||
| enumerator via Release() when you're done with |
|
||||
| it. |
|
||||
| EnumerateAllSubtrees - Like EnumerateSubtrees, but will recursively |
|
||||
| enumerate lower-level subtrees, too. |
|
||||
| GetValueInfo - Returns a uint32 value that designates the type |
|
||||
| of data stored at this location in the registry; |
|
||||
| the possible values are defined by the enumerated |
|
||||
| type mozIRegistry::DataType. |
|
||||
| GetValueLength - Returns a uint32 value that indicates the length |
|
||||
| of this registry value; the length is the number |
|
||||
| of characters (for Strings), the number of bytes |
|
||||
| (for Bytes), or the number of int32 values (for |
|
||||
| Int32). |
|
||||
| EnumerateValues - Returns a nsIEnumerator that you can use to |
|
||||
| enumerate all the value nodes descending from |
|
||||
| a specified location. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD AddSubtree( Key baseKey, const char *path, Key *result ) = 0;
|
||||
NS_IMETHOD RemoveSubtree( Key baseKey, const char *path ) = 0;
|
||||
NS_IMETHOD GetSubtree( Key baseKey, const char *path, Key *result ) = 0;
|
||||
|
||||
NS_IMETHOD EnumerateSubtrees( Key baseKey, nsIEnumerator **result ) = 0;
|
||||
NS_IMETHOD EnumerateAllSubtrees( Key baseKey, nsIEnumerator **result ) = 0;
|
||||
|
||||
NS_IMETHOD GetValueType( Key baseKey, const char *path, uint32 *result ) = 0;
|
||||
NS_IMETHOD GetValueLength( Key baseKey, const char *path, uint32 *result ) = 0;
|
||||
|
||||
NS_IMETHOD EnumerateValues( Key baseKey, nsIEnumerator **result ) = 0;
|
||||
|
||||
/*------------------------------ User Name ---------------------------------
|
||||
| These functions manipulate the current "user name." This value controls |
|
||||
| the behavior of certain registry functions (namely, ?). |
|
||||
| |
|
||||
| GetCurrentUserName allocates a copy of the current user name (which the |
|
||||
| caller should free using PR_Free). |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD GetCurrentUserName( char **result ) = 0;
|
||||
NS_IMETHOD SetCurrentUserName( const char *name ) = 0;
|
||||
|
||||
/*------------------------------ Utilities ---------------------------------
|
||||
| Various utility functions: |
|
||||
| |
|
||||
| Pack() is used to compress the contents of an open registry file. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD Pack() = 0;
|
||||
|
||||
}; // mozIRegistry
|
||||
|
||||
/*----------------------------- mozIRegistryNode -------------------------------
|
||||
| This interface is implemented by all the objects obtained from the |
|
||||
| nsIEnumerators that mozIRegistry provides when you call either of the |
|
||||
| subtree enumeration functions EnumerateSubtrees or EnumerateAllSubtrees. |
|
||||
| |
|
||||
| You can call this function to get the name of this subtree. This is the |
|
||||
| relative path from the base key from which you got this interface. |
|
||||
| |
|
||||
| GetName - Returns the path name of this node; this is the relative path |
|
||||
| from the base key from which this subtree was obtained. The |
|
||||
| function allocates a copy of the name; the caller must free it |
|
||||
| using PR_Free. |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct mozIRegistryNode : public nsISupports {
|
||||
NS_IMETHOD GetName( char **result ) = 0;
|
||||
}; // mozIRegistryNode
|
||||
|
||||
/*----------------------------- mozIRegistryValue ------------------------------
|
||||
| This interface is implemented by the objects obtained from the |
|
||||
| nsIEnumerators that mozIRegistry provides when you call the |
|
||||
| EnumerateValues function. An object supporting this interface is |
|
||||
| returned when you call the CurrentItem() function on that enumerator. |
|
||||
| |
|
||||
| You use the member functions of this interface to obtain information |
|
||||
| about each registry value. |
|
||||
| |
|
||||
| GetName - Returns the path name of this node; this is the relative |
|
||||
| path\ from the base key from which this value was obtained. |
|
||||
| The function allocates a copy of the name; the caller must |
|
||||
| subsequently free it via PR_Free. |
|
||||
| GetValueType - Returns (into a location provided by the caller) the type |
|
||||
| of the value; the types are defined by the enumerated |
|
||||
| type mozIRegistry::DataType. |
|
||||
| GetValueLength - Returns a uint32 value that indicates the length |
|
||||
| of this registry value; the length is the number |
|
||||
| of characters (for Strings), the number of bytes |
|
||||
| (for Bytes), or the number of int32 values (for |
|
||||
| Int32). |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct mozIRegistryValue : public nsISupports {
|
||||
NS_IMETHOD GetName( char **result ) = 0;
|
||||
NS_IMETHOD GetValueType( uint32 *result ) = 0;
|
||||
NS_IMETHOD GetValueLength( uint32 *result ) = 0;
|
||||
}; // mozIRegistryEntry
|
||||
|
||||
|
||||
/*------------------------------- Error Codes ----------------------------------
|
||||
------------------------------------------------------------------------------*/
|
||||
#define NS_ERROR_REG_BADTYPE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 1 )
|
||||
#define NS_ERROR_REG_NO_MORE NS_ERROR_GENERATE_SUCCESS( NS_ERROR_MODULE_REG, 2 )
|
||||
#define NS_ERROR_REG_NOT_FOUND NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 3 )
|
||||
#define NS_ERROR_REG_NOFILE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 4 )
|
||||
#define NS_ERROR_REG_BUFFER_TOO_SMALL NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 5 )
|
||||
#define NS_ERROR_REG_NAME_TOO_LONG NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 6 )
|
||||
#define NS_ERROR_REG_NO_PATH NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 7 )
|
||||
#define NS_ERROR_REG_READ_ONLY NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 8 )
|
||||
#define NS_ERROR_REG_BAD_UTF8 NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 9 )
|
||||
|
||||
// {5D41A440-8E37-11d2-8059-00600811A9C3}
|
||||
#define MOZ_IREGISTRY_IID { 0x5d41a440, 0x8e37, 0x11d2, { 0x80, 0x59, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } }
|
||||
// {D1B54831-AC07-11d2-805E-00600811A9C3}
|
||||
#define MOZ_IREGISTRYNODE_IID { 0xd1b54831, 0xac07, 0x11d2, { 0x80, 0x5e, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } }
|
||||
// {5316C380-B2F8-11d2-A374-0080C6F80E4B}
|
||||
#define MOZ_IREGISTRYVALUE_IID { 0x5316c380, 0xb2f8, 0x11d2, { 0xa3, 0x74, 0x0, 0x80, 0xc6, 0xf8, 0xe, 0x4b } }
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user