sleepyhead111 commited on
Commit
ac8aa50
·
verified ·
1 Parent(s): d0a4e82

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. mosesdecoder/contrib/promix/test_data/README +5 -0
  2. mosesdecoder/contrib/promix/test_data/phrases +8 -0
  3. mosesdecoder/contrib/promix/test_data/phrases.ep +5 -0
  4. mosesdecoder/contrib/promix/test_data/phrases.epnc-lin +4 -0
  5. mosesdecoder/contrib/promix/test_data/phrases.nc +4 -0
  6. mosesdecoder/contrib/promix/test_data/test.nbest.input +1 -0
  7. mosesdecoder/contrib/promix/test_data/test.nbest.nbest +100 -0
  8. mosesdecoder/contrib/promix/test_data/test.nbest.nbest.segments +100 -0
  9. mosesdecoder/contrib/promix/test_data/test.nbest.scores +102 -0
  10. mosesdecoder/contrib/promix/test_main.py +24 -0
  11. mosesdecoder/contrib/promix/test_nbest.py +124 -0
  12. mosesdecoder/contrib/server/Jamfile +62 -0
  13. mosesdecoder/contrib/server/SampleClient.java +46 -0
  14. mosesdecoder/contrib/server/Translation-web/web/index.html +47 -0
  15. mosesdecoder/contrib/server/client-stdin.perl +41 -0
  16. mosesdecoder/contrib/server/client.perl +43 -0
  17. mosesdecoder/contrib/server/client.py +26 -0
  18. mosesdecoder/contrib/server/client_multimodel.py +89 -0
  19. mosesdecoder/contrib/server/mosesserver.cpp +19 -0
  20. mosesdecoder/contrib/server/sgclient_weightUpdate.perl +74 -0
  21. mosesdecoder/contrib/server/update.py +23 -0
  22. mosesdecoder/jam-files/boost-build/kernel/boost-build.jam +5 -0
  23. mosesdecoder/jam-files/boost-build/kernel/bootstrap.jam +263 -0
  24. mosesdecoder/jam-files/boost-build/kernel/class.jam +420 -0
  25. mosesdecoder/jam-files/boost-build/kernel/errors.jam +274 -0
  26. mosesdecoder/jam-files/boost-build/kernel/modules.jam +354 -0
  27. mosesdecoder/jam-files/boost-build/options/help.jam +212 -0
  28. mosesdecoder/jam-files/boost-build/tools/dmc.jam +134 -0
  29. mosesdecoder/jam-files/boost-build/tools/doxygen.jam +776 -0
  30. mosesdecoder/jam-files/boost-build/tools/doxygen/windows-paths-check.doxyfile +3 -0
  31. mosesdecoder/jam-files/boost-build/tools/doxygen/windows-paths-check.hpp +0 -0
  32. mosesdecoder/jam-files/boost-build/tools/fop.jam +69 -0
  33. mosesdecoder/jam-files/boost-build/tools/generate.jam +108 -0
  34. mosesdecoder/jam-files/boost-build/tools/hp_cxx.jam +181 -0
  35. mosesdecoder/jam-files/boost-build/tools/make.jam +72 -0
  36. mosesdecoder/jam-files/boost-build/tools/mc.jam +44 -0
  37. mosesdecoder/jam-files/boost-build/tools/msvc-config.jam +12 -0
  38. mosesdecoder/jam-files/boost-build/tools/python.jam +1267 -0
  39. mosesdecoder/jam-files/boost-build/tools/qcc.jam +236 -0
  40. mosesdecoder/jam-files/boost-build/tools/rc.jam +156 -0
  41. mosesdecoder/jam-files/boost-build/tools/stlport.jam +303 -0
  42. mosesdecoder/jam-files/boost-build/tools/types/asm.jam +4 -0
  43. mosesdecoder/jam-files/boost-build/tools/types/cpp.jam +86 -0
  44. mosesdecoder/jam-files/boost-build/tools/types/exe.jam +9 -0
  45. mosesdecoder/jam-files/boost-build/tools/types/lib.jam +74 -0
  46. mosesdecoder/jam-files/boost-build/tools/types/rsp.jam +4 -0
  47. mosesdecoder/jam-files/boost-build/tools/whale.jam +116 -0
  48. mosesdecoder/jam-files/boost-build/tools/xlf.jam +39 -0
  49. mosesdecoder/jam-files/boost-build/tools/xsltproc/included.xsl +11 -0
  50. mosesdecoder/jam-files/boost-build/tools/xsltproc/test.xml +2 -0
mosesdecoder/contrib/promix/test_data/README ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ These nbest lists are created using the model in
2
+ data/esen.epnc-lin.model
3
+
4
+ Note that the nc-ep weights for this are:
5
+ [[0.54471993730312251, 0.45528006269687754], [0.56546688367708142, 0.43453311632291863], [0.55867730373453584, 0.44132269626546422], [0.46645964485220004, 0.53354035514779996]]
mosesdecoder/contrib/promix/test_data/phrases ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ domando a
2
+ los políticos
3
+ en ambos
4
+ lados del Atlántico
5
+ taming
6
+ politicians
7
+ on both
8
+ sides of the Atlantic
mosesdecoder/contrib/promix/test_data/phrases.ep ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+
2
+ los políticos ||| politicians ||| 0-0 1-0 ||| 0.33497 0.180441 0.638586 0.0962213 2.718
3
+ en ambos ||| on both ||| 0-0 1-1 ||| 0.0908379 0.0213197 0.187399 0.0498198 2.718
4
+ lados del Atlántico ||| sides of the Atlantic ||| 0-0 1-1 1-2 2-3 ||| 0.62585 0.00702384 0.836364 0.0687874 2.718
5
+
mosesdecoder/contrib/promix/test_data/phrases.epnc-lin ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ domando a ||| taming ||| 0.0403496 0.00427574 0.558677 0.233252 2.718
2
+ los políticos ||| politicians ||| 0.449849 0.210571 0.739008 0.138315 2.718
3
+ en ambos ||| on both ||| 0.198423 0.0402601 0.270259 0.0519369 2.718
4
+ lados del Atlántico ||| sides of the Atlantic ||| 0.708608 0.00997589 0.803633 0.0530904 2.718
mosesdecoder/contrib/promix/test_data/phrases.nc ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ domando a ||| taming ||| 0-0 1-0 ||| 0.0740741 0.00756144 1 0.500047 2.718
2
+ los políticos ||| politicians ||| 0-0 1-0 ||| 0.545866 0.233725 0.818336 0.186463 2.718
3
+ en ambos ||| on both ||| 0-0 1-1 ||| 0.288344 0.0548148 0.335714 0.0543585 2.718
4
+ dos del Atlántico ||| sides of the Atlantic ||| 0-0 1-1 1-2 2-3 ||| 0.777778 0.0122444 0.777778 0.0351361 2.718
mosesdecoder/contrib/promix/test_data/test.nbest.input ADDED
@@ -0,0 +1 @@
 
 
1
+ domando a los políticos en ambos lados del Atlántico
mosesdecoder/contrib/promix/test_data/test.nbest.nbest ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -1.51037 0 0 -2.60639 0 0 lm: -36.0562 w: -8 tm: -5.97082 -14.8327 -2.41162 -9.32734 3.99959 ||| -16.9717
2
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.07904 0 0 -2.22203 0 0 lm: -37.2846 w: -9 tm: -5.43337 -15.7907 -4.86623 -9.68878 3.99959 ||| -16.9885
3
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.24178 0 0 -2.59408 0 0 lm: -36.0562 w: -8 tm: -5.55036 -14.7311 -1.14332 -9.34122 2.99969 ||| -17.0321
4
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.81045 0 0 -2.20973 0 0 lm: -37.2846 w: -9 tm: -5.01291 -15.689 -3.59793 -9.70266 2.99969 ||| -17.0489
5
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -1.8566 0 0 -2.76972 0 0 lm: -36.0562 w: -8 tm: -6.33782 -14.6804 -1.8329 -9.34609 3.99959 ||| -17.0555
6
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.42527 0 0 -2.38536 0 0 lm: -37.2846 w: -9 tm: -5.80037 -15.6384 -4.28752 -9.70753 3.99959 ||| -17.0723
7
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -1.947 0 0 -2.66963 0 0 lm: -36.0562 w: -8 tm: -7.12207 -14.8138 -2.49723 -9.33158 4.99948 ||| -17.1661
8
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -1.36892 0 0 -2.85256 0 0 lm: -36.0562 w: -8 tm: -5.62394 -14.8136 -3.58667 -9.35962 3.99959 ||| -17.1714
9
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.51567 0 0 -2.28527 0 0 lm: -37.2846 w: -9 tm: -6.58462 -15.7718 -4.95184 -9.69302 4.99948 ||| -17.183
10
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -0.93759 0 0 -2.4682 0 0 lm: -37.2846 w: -9 tm: -5.08649 -15.7715 -6.04129 -9.72106 3.99959 ||| -17.1882
11
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.71301 0 0 -2.68303 0 0 lm: -36.0562 w: -8 tm: -6.41885 -14.6935 -1.25905 -9.34492 3.99959 ||| -17.1903
12
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -2.28167 0 0 -2.29867 0 0 lm: -37.2846 w: -9 tm: -5.8814 -15.6515 -3.71367 -9.70637 3.99959 ||| -17.2071
13
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -1.56496 0 0 -2.75335 0 0 lm: -36.0562 w: -8 tm: -7.49271 -14.8064 -2.97497 -9.34339 4.99948 ||| -17.2472
14
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.13363 0 0 -2.36899 0 0 lm: -37.2846 w: -9 tm: -6.95526 -15.7643 -5.42959 -9.70483 4.99948 ||| -17.264
15
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -1.78819 0 0 -2.89955 0 0 lm: -36.0562 w: -8 tm: -6.50046 -14.7823 -3.66165 -9.36203 4.99948 ||| -17.2958
16
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.35686 0 0 -2.51519 0 0 lm: -37.2846 w: -9 tm: -5.96301 -15.7403 -6.11627 -9.72347 4.99948 ||| -17.3126
17
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -1.4211 0 0 -2.96742 0 0 lm: -36.0562 w: -8 tm: -6.94636 -14.7711 -4.14828 -9.33786 4.99948 ||| -17.3855
18
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -0.989766 0 0 -2.58306 0 0 lm: -37.2846 w: -9 tm: -6.40891 -15.7291 -6.6029 -9.69931 4.99948 ||| -17.4023
19
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -1.5859 0 0 -3.00234 0 0 lm: -36.0562 w: -8 tm: -7.53826 -14.8794 -3.91516 -9.31284 4.99948 ||| -17.5338
20
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.15457 0 0 -2.61798 0 0 lm: -37.2846 w: -9 tm: -7.00081 -15.8374 -6.36978 -9.67428 4.99948 ||| -17.5506
21
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.52679 0 0 -2.89648 0 0 lm: -37.2846 w: -9 tm: -8.24923 -15.7898 -4.29661 -9.63452 4.99948 ||| -17.5634
22
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -2.2582 0 0 -2.88417 0 0 lm: -37.2846 w: -9 tm: -7.82876 -15.6881 -3.02831 -9.6484 3.99959 ||| -17.6238
23
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.87302 0 0 -3.05981 0 0 lm: -37.2846 w: -9 tm: -8.61622 -15.6375 -3.7179 -9.65327 4.99948 ||| -17.6472
24
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.40826 0 0 -3.29781 0 0 lm: -36.0562 w: -8 tm: -7.95188 -14.6816 -2.5975 -9.34956 4.99948 ||| -17.6561
25
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.97693 0 0 -2.91345 0 0 lm: -37.2846 w: -9 tm: -7.41443 -15.6395 -5.05211 -9.711 4.99948 ||| -17.6729
26
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.02253 0 0 -3.06558 0 0 lm: -36.0562 w: -8 tm: -8.6895 -14.8606 -4.00077 -9.31707 5.99938 ||| -17.7283
27
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.5912 0 0 -2.68122 0 0 lm: -37.2846 w: -9 tm: -8.15205 -15.8185 -6.45539 -9.67851 5.99938 ||| -17.7451
28
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.96342 0 0 -2.95972 0 0 lm: -37.2846 w: -9 tm: -9.40047 -15.7709 -4.38222 -9.63875 5.99938 ||| -17.7579
29
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.38534 0 0 -3.14265 0 0 lm: -37.2846 w: -9 tm: -7.90234 -15.7706 -5.47167 -9.66679 4.99948 ||| -17.7631
30
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -2.72942 0 0 -2.97312 0 0 lm: -37.2846 w: -9 tm: -8.69725 -15.6506 -3.14405 -9.6521 4.99948 ||| -17.782
31
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -1.64049 0 0 -3.1493 0 0 lm: -36.0562 w: -8 tm: -9.06014 -14.8531 -4.47852 -9.32889 5.99938 ||| -17.8093
32
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -1.95601 0 0 -3.55535 0 0 lm: -36.0562 w: -8 tm: -4.91151 -15.1311 -3.72129 -9.93616 2.99969 ||| -17.8216
33
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.20916 0 0 -2.76494 0 0 lm: -37.2846 w: -9 tm: -8.52269 -15.8111 -6.93313 -9.69033 5.99938 ||| -17.8261
34
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.58137 0 0 -3.04344 0 0 lm: -37.2846 w: -9 tm: -9.77111 -15.7635 -4.85997 -9.65057 5.99938 ||| -17.8389
35
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.11662 0 0 -3.28144 0 0 lm: -36.0562 w: -8 tm: -9.10677 -14.8075 -3.73957 -9.34686 5.99938 ||| -17.8478
36
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.68529 0 0 -2.89708 0 0 lm: -37.2846 w: -9 tm: -8.56932 -15.7655 -6.19418 -9.7083 5.99938 ||| -17.8646
37
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.80461 0 0 -3.18964 0 0 lm: -37.2846 w: -9 tm: -8.77886 -15.7394 -5.54665 -9.66921 5.99938 ||| -17.8875
38
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.37528 0 0 -3.60234 0 0 lm: -36.0562 w: -8 tm: -5.78803 -15.0999 -3.79627 -9.93857 3.99958 ||| -17.946
39
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.43751 0 0 -3.25751 0 0 lm: -37.2846 w: -9 tm: -9.22476 -15.7282 -6.03327 -9.64504 5.99938 ||| -17.9772
40
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -1.97276 0 0 -3.49551 0 0 lm: -36.0562 w: -8 tm: -8.56043 -14.7723 -4.91288 -9.34133 5.99938 ||| -17.9861
41
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.54143 0 0 -3.11115 0 0 lm: -37.2846 w: -9 tm: -8.02298 -15.7302 -7.36749 -9.70277 5.99938 ||| -18.0029
42
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.00819 0 0 -3.67021 0 0 lm: -36.0562 w: -8 tm: -6.23393 -15.0887 -4.2829 -9.91441 3.99958 ||| -18.0357
43
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -2.61446 0 0 -2.59408 0 0 lm: -37.5177 w: -9 tm: -6.22594 -14.8893 -3.54625 -12.0454 2.99969 ||| -18.0629
44
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -2.18313 0 0 -2.20973 0 0 lm: -38.7461 w: -10 tm: -5.68849 -15.8473 -6.00087 -12.4069 2.99969 ||| -18.0797
45
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -1.97768 0 0 -2.76972 0 0 lm: -37.5177 w: -9 tm: -7.93613 -14.6804 -4.69485 -11.2579 3.99959 ||| -18.097
46
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.54635 0 0 -2.38536 0 0 lm: -38.7461 w: -10 tm: -7.39868 -15.6384 -7.14947 -11.6193 3.99959 ||| -18.1138
47
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.60232 0 0 -3.29243 0 0 lm: -37.2846 w: -9 tm: -9.81666 -15.8365 -5.80015 -9.62002 5.99938 ||| -18.1255
48
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -1.8227 0 0 -2.66963 0 0 lm: -37.5177 w: -9 tm: -8.25244 -14.8138 -5.95756 -11.1747 4.99948 ||| -18.1464
49
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.39137 0 0 -2.28527 0 0 lm: -38.7461 w: -10 tm: -7.71499 -15.7718 -8.41217 -11.5362 4.99948 ||| -18.1632
50
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -2.58871 0 0 -2.68303 0 0 lm: -37.5177 w: -9 tm: -7.54922 -14.6935 -4.71938 -11.1881 3.99959 ||| -18.1705
51
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.17299 0 0 -3.70513 0 0 lm: -36.0562 w: -8 tm: -6.82583 -15.197 -4.04978 -9.88939 3.99958 ||| -18.184
52
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -2.15738 0 0 -2.29867 0 0 lm: -38.7461 w: -10 tm: -7.01177 -15.6515 -7.174 -11.5495 3.99959 ||| -18.1873
53
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -2.42468 0 0 -3.5879 0 0 lm: -37.2846 w: -9 tm: -10.2303 -15.6386 -4.48249 -9.65674 5.99938 ||| -18.2478
54
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -1.66389 0 0 -2.89955 0 0 lm: -37.5177 w: -9 tm: -7.63083 -14.7823 -7.12198 -11.2052 4.99948 ||| -18.2761
55
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -1.68604 0 0 -2.75335 0 0 lm: -37.5177 w: -9 tm: -9.09102 -14.8064 -5.83693 -11.2552 4.99948 ||| -18.2887
56
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.23256 0 0 -2.51519 0 0 lm: -38.7461 w: -10 tm: -7.09338 -15.7403 -9.5766 -11.5666 4.99948 ||| -18.2929
57
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.25471 0 0 -2.36899 0 0 lm: -38.7461 w: -10 tm: -8.55357 -15.7643 -8.29154 -11.6166 4.99948 ||| -18.3055
58
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -2.03895 0 0 -3.35567 0 0 lm: -37.2846 w: -9 tm: -10.9679 -15.8176 -5.88577 -9.62425 6.99927 ||| -18.32
59
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.60962 0 0 -3.76837 0 0 lm: -36.0562 w: -8 tm: -7.97707 -15.1781 -4.1354 -9.89362 4.99948 ||| -18.3785
60
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.65691 0 0 -3.43939 0 0 lm: -37.2846 w: -9 tm: -11.3385 -15.8102 -6.36351 -9.63607 6.99927 ||| -18.401
61
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.19215 0 0 -3.67739 0 0 lm: -36.0562 w: -8 tm: -10.6742 -14.8543 -5.24311 -9.33236 6.99927 ||| -18.4099
62
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.76082 0 0 -3.29303 0 0 lm: -37.2846 w: -9 tm: -10.1368 -15.8122 -7.69773 -9.6938 6.99927 ||| -18.4267
63
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -1.54218 0 0 -2.96742 0 0 lm: -37.5177 w: -9 tm: -8.54467 -14.7711 -7.01023 -11.2497 4.99948 ||| -18.427
64
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -2.13304 0 0 -3.57153 0 0 lm: -37.2846 w: -9 tm: -11.3852 -15.7646 -5.62456 -9.65404 6.99927 ||| -18.4395
65
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.11085 0 0 -2.58306 0 0 lm: -38.7461 w: -10 tm: -8.00723 -15.7291 -9.46485 -11.6111 4.99948 ||| -18.4438
66
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.22758 0 0 -3.85209 0 0 lm: -36.0562 w: -8 tm: -8.34771 -15.1707 -4.61314 -9.90544 4.99948 ||| -18.4595
67
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.98917 0 0 -3.7856 0 0 lm: -37.2846 w: -9 tm: -10.8388 -15.7293 -6.79787 -9.64851 6.99927 ||| -18.5778
68
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -2.0125 0 0 -2.60639 0 0 lm: -37.5177 w: -9 tm: -8.02561 -15.1979 -6.07103 -12.091 3.99959 ||| -18.6217
69
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.55985 0 0 -4.1983 0 0 lm: -36.0562 w: -8 tm: -7.848 -15.0898 -5.0475 -9.91788 4.99948 ||| -18.6363
70
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -2.28396 0 0 -3.29781 0 0 lm: -37.5177 w: -9 tm: -9.08225 -14.6816 -6.05783 -11.1927 4.99948 ||| -18.6364
71
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.58117 0 0 -2.22203 0 0 lm: -38.7461 w: -10 tm: -7.48816 -16.1559 -8.52564 -12.4524 3.99959 ||| -18.6385
72
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.85263 0 0 -2.91345 0 0 lm: -38.7461 w: -10 tm: -8.5448 -15.6395 -8.51244 -11.5541 4.99948 ||| -18.6532
73
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -2.63088 0 0 -2.88417 0 0 lm: -38.7461 w: -10 tm: -8.50434 -15.8464 -5.43125 -12.3526 3.99959 ||| -18.6546
74
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -1.86965 0 0 -2.85256 0 0 lm: -37.5177 w: -9 tm: -7.44015 -15.0375 -7.00556 -11.9328 3.99959 ||| -18.6588
75
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.43831 0 0 -2.4682 0 0 lm: -38.7461 w: -10 tm: -6.9027 -15.9955 -9.46017 -12.2942 3.99959 ||| -18.6756
76
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.9941 0 0 -3.05981 0 0 lm: -38.7461 w: -10 tm: -10.2145 -15.6375 -6.57985 -11.5651 4.99948 ||| -18.6887
77
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -1.89824 0 0 -3.06558 0 0 lm: -37.5177 w: -9 tm: -9.81987 -14.8606 -7.4611 -11.1602 5.99938 ||| -18.7085
78
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.4669 0 0 -2.68122 0 0 lm: -38.7461 w: -10 tm: -9.28242 -15.8185 -9.91572 -11.5217 5.99938 ||| -18.7253
79
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.83912 0 0 -2.95972 0 0 lm: -38.7461 w: -10 tm: -10.5308 -15.7709 -7.84255 -11.4819 5.99938 ||| -18.7381
80
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.07039 0 0 -3.90067 0 0 lm: -37.2846 w: -9 tm: -8.33352 -16.8256 -6.4114 -10.5648 3.99959 ||| -18.7608
81
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -2.60513 0 0 -2.97312 0 0 lm: -38.7461 w: -10 tm: -9.82762 -15.6506 -6.60437 -11.4952 4.99948 ||| -18.7622
82
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -1.99232 0 0 -3.28144 0 0 lm: -37.5177 w: -9 tm: -10.2371 -14.8075 -7.1999 -11.19 5.99938 ||| -18.828
83
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.56099 0 0 -2.89708 0 0 lm: -38.7461 w: -10 tm: -9.6997 -15.7655 -9.65451 -11.5514 5.99938 ||| -18.8448
84
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -1.76157 0 0 -3.1493 0 0 lm: -37.5177 w: -9 tm: -10.6585 -14.8531 -7.34047 -11.2407 5.99938 ||| -18.8508
85
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.33024 0 0 -2.76494 0 0 lm: -38.7461 w: -10 tm: -10.121 -15.8111 -9.79508 -11.6021 5.99938 ||| -18.8676
86
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.68031 0 0 -3.18964 0 0 lm: -38.7461 w: -10 tm: -9.90924 -15.7394 -9.00698 -11.5123 5.99938 ||| -18.8678
87
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.70246 0 0 -3.04344 0 0 lm: -38.7461 w: -10 tm: -11.3694 -15.7635 -7.72192 -11.5624 5.99938 ||| -18.8804
88
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.48965 0 0 -3.94766 0 0 lm: -37.2846 w: -9 tm: -9.21005 -16.7944 -6.48638 -10.5672 4.99948 ||| -18.8852
89
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -2.25098 0 0 -3.60234 0 0 lm: -37.5177 w: -9 tm: -6.91841 -15.0999 -7.2566 -11.7817 3.99958 ||| -18.9263
90
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -1.84846 0 0 -3.49551 0 0 lm: -37.5177 w: -9 tm: -9.6908 -14.7723 -8.37321 -11.1845 5.99938 ||| -18.9663
91
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.12256 0 0 -4.01553 0 0 lm: -37.2846 w: -9 tm: -9.65595 -16.7832 -6.97301 -10.543 4.99948 ||| -18.9749
92
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.41713 0 0 -3.11115 0 0 lm: -38.7461 w: -10 tm: -9.15335 -15.7302 -10.8278 -11.5459 5.99938 ||| -18.9831
93
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -2.20857 0 0 -3.96748 0 0 lm: -37.2846 w: -9 tm: -12.9526 -15.8114 -7.12811 -9.63954 7.99917 ||| -19.0016
94
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.5586 0 0 -3.25751 0 0 lm: -38.7461 w: -10 tm: -10.8231 -15.7282 -8.89523 -11.5568 5.99938 ||| -19.0187
95
+ 0 ||| taming politicians on both sides of the Atlantic ||| d: 0 -2.77924 0 0 -4.38018 0 0 lm: -36.0562 w: -8 tm: -9.96178 -15.1719 -5.37774 -9.90891 5.99938 ||| -19.0601
96
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -2.12927 0 0 -3.67021 0 0 lm: -37.5177 w: -9 tm: -7.83225 -15.0887 -7.14485 -11.8262 3.99958 ||| -19.0772
97
+ 0 ||| taming the politicians on both sides of the Atlantic ||| d: 0 -1.28737 0 0 -4.05045 0 0 lm: -37.2846 w: -9 tm: -10.2478 -16.8915 -6.73989 -10.518 4.99948 ||| -19.1232
98
+ 0 ||| taming politicians on both sides of the Atlantic , ||| d: 0 -2.08803 0 0 -3.00234 0 0 lm: -37.5177 w: -9 tm: -9.59305 -15.2447 -7.57457 -12.0765 4.99948 ||| -19.1838
99
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -1.6567 0 0 -2.61798 0 0 lm: -38.7461 w: -10 tm: -9.0556 -16.2026 -10.0292 -12.4379 4.99948 ||| -19.2006
100
+ 0 ||| taming the politicians on both sides of the Atlantic , ||| d: 0 -2.02892 0 0 -2.89648 0 0 lm: -38.7461 w: -10 tm: -10.304 -16.155 -7.95602 -12.3982 4.99948 ||| -19.2134
mosesdecoder/contrib/promix/test_data/test.nbest.nbest.segments ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0 ||| taming |0-1| politicians |2-3| on both |4-5| sides of the Atlantic |6-8| ||| d: 0 -1.51037 0 0 -2.60639 0 0 lm: -36.0562 w: -8 tm: -5.97082 -14.8327 -2.41162 -9.32734 3.99959 ||| -16.9717
2
+ 0 ||| taming |0-1| the politicians |2-3| on both |4-5| sides of the Atlantic |6-8| ||| d: 0 -1.07904 0 0 -2.22203 0 0 lm: -37.2846 w: -9 tm: -5.43337 -15.7907 -4.86623 -9.68878 3.99959 ||| -16.9885
3
+ 0 ||| taming |0-1| politicians |2-3| on both sides of the Atlantic |4-8| ||| d: 0 -2.24178 0 0 -2.59408 0 0 lm: -36.0562 w: -8 tm: -5.55036 -14.7311 -1.14332 -9.34122 2.99969 ||| -17.0321
4
+ 0 ||| taming |0-1| the politicians |2-3| on both sides of the Atlantic |4-8| ||| d: 0 -1.81045 0 0 -2.20973 0 0 lm: -37.2846 w: -9 tm: -5.01291 -15.689 -3.59793 -9.70266 2.99969 ||| -17.0489
5
+ 0 ||| taming |0-1| politicians |2-3| on both sides |4-6| of the Atlantic |7-8| ||| d: 0 -1.8566 0 0 -2.76972 0 0 lm: -36.0562 w: -8 tm: -6.33782 -14.6804 -1.8329 -9.34609 3.99959 ||| -17.0555
6
+ 0 ||| taming |0-1| the politicians |2-3| on both sides |4-6| of the Atlantic |7-8| ||| d: 0 -1.42527 0 0 -2.38536 0 0 lm: -37.2846 w: -9 tm: -5.80037 -15.6384 -4.28752 -9.70753 3.99959 ||| -17.0723
7
+ 0 ||| taming |0-1| politicians |2-3| on both |4-5| sides of the |6-7| Atlantic |8-8| ||| d: 0 -1.947 0 0 -2.66963 0 0 lm: -36.0562 w: -8 tm: -7.12207 -14.8138 -2.49723 -9.33158 4.99948 ||| -17.1661
8
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both sides of the Atlantic |5-8| ||| d: 0 -1.36892 0 0 -2.85256 0 0 lm: -36.0562 w: -8 tm: -5.62394 -14.8136 -3.58667 -9.35962 3.99959 ||| -17.1714
9
+ 0 ||| taming |0-1| the politicians |2-3| on both |4-5| sides of the |6-7| Atlantic |8-8| ||| d: 0 -1.51567 0 0 -2.28527 0 0 lm: -37.2846 w: -9 tm: -6.58462 -15.7718 -4.95184 -9.69302 4.99948 ||| -17.183
10
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both sides of the Atlantic |5-8| ||| d: 0 -0.93759 0 0 -2.4682 0 0 lm: -37.2846 w: -9 tm: -5.08649 -15.7715 -6.04129 -9.72106 3.99959 ||| -17.1882
11
+ 0 ||| taming |0-1| politicians |2-3| on both sides of the |4-7| Atlantic |8-8| ||| d: 0 -2.71301 0 0 -2.68303 0 0 lm: -36.0562 w: -8 tm: -6.41885 -14.6935 -1.25905 -9.34492 3.99959 ||| -17.1903
12
+ 0 ||| taming |0-1| the politicians |2-3| on both sides of the |4-7| Atlantic |8-8| ||| d: 0 -2.28167 0 0 -2.29867 0 0 lm: -37.2846 w: -9 tm: -5.8814 -15.6515 -3.71367 -9.70637 3.99959 ||| -17.2071
13
+ 0 ||| taming |0-1| politicians |2-3| on both |4-5| sides |6-6| of the Atlantic |7-8| ||| d: 0 -1.56496 0 0 -2.75335 0 0 lm: -36.0562 w: -8 tm: -7.49271 -14.8064 -2.97497 -9.34339 4.99948 ||| -17.2472
14
+ 0 ||| taming |0-1| the politicians |2-3| on both |4-5| sides |6-6| of the Atlantic |7-8| ||| d: 0 -1.13363 0 0 -2.36899 0 0 lm: -37.2846 w: -9 tm: -6.95526 -15.7643 -5.42959 -9.70483 4.99948 ||| -17.264
15
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both sides of the |5-7| Atlantic |8-8| ||| d: 0 -1.78819 0 0 -2.89955 0 0 lm: -36.0562 w: -8 tm: -6.50046 -14.7823 -3.66165 -9.36203 4.99948 ||| -17.2958
16
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both sides of the |5-7| Atlantic |8-8| ||| d: 0 -1.35686 0 0 -2.51519 0 0 lm: -37.2846 w: -9 tm: -5.96301 -15.7403 -6.11627 -9.72347 4.99948 ||| -17.3126
17
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both sides |5-6| of the Atlantic |7-8| ||| d: 0 -1.4211 0 0 -2.96742 0 0 lm: -36.0562 w: -8 tm: -6.94636 -14.7711 -4.14828 -9.33786 4.99948 ||| -17.3855
18
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both sides |5-6| of the Atlantic |7-8| ||| d: 0 -0.989766 0 0 -2.58306 0 0 lm: -37.2846 w: -9 tm: -6.40891 -15.7291 -6.6029 -9.69931 4.99948 ||| -17.4023
19
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both |5-5| sides of the Atlantic |6-8| ||| d: 0 -1.5859 0 0 -3.00234 0 0 lm: -36.0562 w: -8 tm: -7.53826 -14.8794 -3.91516 -9.31284 4.99948 ||| -17.5338
20
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both |5-5| sides of the Atlantic |6-8| ||| d: 0 -1.15457 0 0 -2.61798 0 0 lm: -37.2846 w: -9 tm: -7.00081 -15.8374 -6.36978 -9.67428 4.99948 ||| -17.5506
21
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both |4-5| sides of the Atlantic |6-8| ||| d: 0 -1.52679 0 0 -2.89648 0 0 lm: -37.2846 w: -9 tm: -8.24923 -15.7898 -4.29661 -9.63452 4.99948 ||| -17.5634
22
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both sides of the Atlantic |4-8| ||| d: 0 -2.2582 0 0 -2.88417 0 0 lm: -37.2846 w: -9 tm: -7.82876 -15.6881 -3.02831 -9.6484 3.99959 ||| -17.6238
23
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both sides |4-6| of the Atlantic |7-8| ||| d: 0 -1.87302 0 0 -3.05981 0 0 lm: -37.2846 w: -9 tm: -8.61622 -15.6375 -3.7179 -9.65327 4.99948 ||| -17.6472
24
+ 0 ||| taming |0-1| politicians |2-3| on both sides |4-6| of the |7-7| Atlantic |8-8| ||| d: 0 -2.40826 0 0 -3.29781 0 0 lm: -36.0562 w: -8 tm: -7.95188 -14.6816 -2.5975 -9.34956 4.99948 ||| -17.6561
25
+ 0 ||| taming |0-1| the politicians |2-3| on both sides |4-6| of the |7-7| Atlantic |8-8| ||| d: 0 -1.97693 0 0 -2.91345 0 0 lm: -37.2846 w: -9 tm: -7.41443 -15.6395 -5.05211 -9.711 4.99948 ||| -17.6729
26
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both |5-5| sides of the |6-7| Atlantic |8-8| ||| d: 0 -2.02253 0 0 -3.06558 0 0 lm: -36.0562 w: -8 tm: -8.6895 -14.8606 -4.00077 -9.31707 5.99938 ||| -17.7283
27
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both |5-5| sides of the |6-7| Atlantic |8-8| ||| d: 0 -1.5912 0 0 -2.68122 0 0 lm: -37.2846 w: -9 tm: -8.15205 -15.8185 -6.45539 -9.67851 5.99938 ||| -17.7451
28
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both |4-5| sides of the |6-7| Atlantic |8-8| ||| d: 0 -1.96342 0 0 -2.95972 0 0 lm: -37.2846 w: -9 tm: -9.40047 -15.7709 -4.38222 -9.63875 5.99938 ||| -17.7579
29
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on |4-4| both sides of the Atlantic |5-8| ||| d: 0 -1.38534 0 0 -3.14265 0 0 lm: -37.2846 w: -9 tm: -7.90234 -15.7706 -5.47167 -9.66679 4.99948 ||| -17.7631
30
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both sides of the |4-7| Atlantic |8-8| ||| d: 0 -2.72942 0 0 -2.97312 0 0 lm: -37.2846 w: -9 tm: -8.69725 -15.6506 -3.14405 -9.6521 4.99948 ||| -17.782
31
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both |5-5| sides |6-6| of the Atlantic |7-8| ||| d: 0 -1.64049 0 0 -3.1493 0 0 lm: -36.0562 w: -8 tm: -9.06014 -14.8531 -4.47852 -9.32889 5.99938 ||| -17.8093
32
+ 0 ||| taming |0-1| politicians on |2-4| both sides of the Atlantic |5-8| ||| d: 0 -1.95601 0 0 -3.55535 0 0 lm: -36.0562 w: -8 tm: -4.91151 -15.1311 -3.72129 -9.93616 2.99969 ||| -17.8216
33
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both |5-5| sides |6-6| of the Atlantic |7-8| ||| d: 0 -1.20916 0 0 -2.76494 0 0 lm: -37.2846 w: -9 tm: -8.52269 -15.8111 -6.93313 -9.69033 5.99938 ||| -17.8261
34
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both |4-5| sides |6-6| of the Atlantic |7-8| ||| d: 0 -1.58137 0 0 -3.04344 0 0 lm: -37.2846 w: -9 tm: -9.77111 -15.7635 -4.85997 -9.65057 5.99938 ||| -17.8389
35
+ 0 ||| taming |0-1| politicians |2-3| on both |4-5| sides |6-6| of the |7-7| Atlantic |8-8| ||| d: 0 -2.11662 0 0 -3.28144 0 0 lm: -36.0562 w: -8 tm: -9.10677 -14.8075 -3.73957 -9.34686 5.99938 ||| -17.8478
36
+ 0 ||| taming |0-1| the politicians |2-3| on both |4-5| sides |6-6| of the |7-7| Atlantic |8-8| ||| d: 0 -1.68529 0 0 -2.89708 0 0 lm: -37.2846 w: -9 tm: -8.56932 -15.7655 -6.19418 -9.7083 5.99938 ||| -17.8646
37
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on |4-4| both sides of the |5-7| Atlantic |8-8| ||| d: 0 -1.80461 0 0 -3.18964 0 0 lm: -37.2846 w: -9 tm: -8.77886 -15.7394 -5.54665 -9.66921 5.99938 ||| -17.8875
38
+ 0 ||| taming |0-1| politicians on |2-4| both sides of the |5-7| Atlantic |8-8| ||| d: 0 -2.37528 0 0 -3.60234 0 0 lm: -36.0562 w: -8 tm: -5.78803 -15.0999 -3.79627 -9.93857 3.99958 ||| -17.946
39
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on |4-4| both sides |5-6| of the Atlantic |7-8| ||| d: 0 -1.43751 0 0 -3.25751 0 0 lm: -37.2846 w: -9 tm: -9.22476 -15.7282 -6.03327 -9.64504 5.99938 ||| -17.9772
40
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both sides |5-6| of the |7-7| Atlantic |8-8| ||| d: 0 -1.97276 0 0 -3.49551 0 0 lm: -36.0562 w: -8 tm: -8.56043 -14.7723 -4.91288 -9.34133 5.99938 ||| -17.9861
41
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both sides |5-6| of the |7-7| Atlantic |8-8| ||| d: 0 -1.54143 0 0 -3.11115 0 0 lm: -37.2846 w: -9 tm: -8.02298 -15.7302 -7.36749 -9.70277 5.99938 ||| -18.0029
42
+ 0 ||| taming |0-1| politicians on |2-4| both sides |5-6| of the Atlantic |7-8| ||| d: 0 -2.00819 0 0 -3.67021 0 0 lm: -36.0562 w: -8 tm: -6.23393 -15.0887 -4.2829 -9.91441 3.99958 ||| -18.0357
43
+ 0 ||| taming |0-1| politicians |2-3| on both sides of the Atlantic , |4-8| ||| d: 0 -2.61446 0 0 -2.59408 0 0 lm: -37.5177 w: -9 tm: -6.22594 -14.8893 -3.54625 -12.0454 2.99969 ||| -18.0629
44
+ 0 ||| taming |0-1| the politicians |2-3| on both sides of the Atlantic , |4-8| ||| d: 0 -2.18313 0 0 -2.20973 0 0 lm: -38.7461 w: -10 tm: -5.68849 -15.8473 -6.00087 -12.4069 2.99969 ||| -18.0797
45
+ 0 ||| taming |0-1| politicians |2-3| on both sides |4-6| of the Atlantic , |7-8| ||| d: 0 -1.97768 0 0 -2.76972 0 0 lm: -37.5177 w: -9 tm: -7.93613 -14.6804 -4.69485 -11.2579 3.99959 ||| -18.097
46
+ 0 ||| taming |0-1| the politicians |2-3| on both sides |4-6| of the Atlantic , |7-8| ||| d: 0 -1.54635 0 0 -2.38536 0 0 lm: -38.7461 w: -10 tm: -7.39868 -15.6384 -7.14947 -11.6193 3.99959 ||| -18.1138
47
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on |4-4| both |5-5| sides of the Atlantic |6-8| ||| d: 0 -1.60232 0 0 -3.29243 0 0 lm: -37.2846 w: -9 tm: -9.81666 -15.8365 -5.80015 -9.62002 5.99938 ||| -18.1255
48
+ 0 ||| taming |0-1| politicians |2-3| on both |4-5| sides of the |6-7| Atlantic , |8-8| ||| d: 0 -1.8227 0 0 -2.66963 0 0 lm: -37.5177 w: -9 tm: -8.25244 -14.8138 -5.95756 -11.1747 4.99948 ||| -18.1464
49
+ 0 ||| taming |0-1| the politicians |2-3| on both |4-5| sides of the |6-7| Atlantic , |8-8| ||| d: 0 -1.39137 0 0 -2.28527 0 0 lm: -38.7461 w: -10 tm: -7.71499 -15.7718 -8.41217 -11.5362 4.99948 ||| -18.1632
50
+ 0 ||| taming |0-1| politicians |2-3| on both sides of the |4-7| Atlantic , |8-8| ||| d: 0 -2.58871 0 0 -2.68303 0 0 lm: -37.5177 w: -9 tm: -7.54922 -14.6935 -4.71938 -11.1881 3.99959 ||| -18.1705
51
+ 0 ||| taming |0-1| politicians on |2-4| both |5-5| sides of the Atlantic |6-8| ||| d: 0 -2.17299 0 0 -3.70513 0 0 lm: -36.0562 w: -8 tm: -6.82583 -15.197 -4.04978 -9.88939 3.99958 ||| -18.184
52
+ 0 ||| taming |0-1| the politicians |2-3| on both sides of the |4-7| Atlantic , |8-8| ||| d: 0 -2.15738 0 0 -2.29867 0 0 lm: -38.7461 w: -10 tm: -7.01177 -15.6515 -7.174 -11.5495 3.99959 ||| -18.1873
53
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both sides |4-6| of the |7-7| Atlantic |8-8| ||| d: 0 -2.42468 0 0 -3.5879 0 0 lm: -37.2846 w: -9 tm: -10.2303 -15.6386 -4.48249 -9.65674 5.99938 ||| -18.2478
54
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both sides of the |5-7| Atlantic , |8-8| ||| d: 0 -1.66389 0 0 -2.89955 0 0 lm: -37.5177 w: -9 tm: -7.63083 -14.7823 -7.12198 -11.2052 4.99948 ||| -18.2761
55
+ 0 ||| taming |0-1| politicians |2-3| on both |4-5| sides |6-6| of the Atlantic , |7-8| ||| d: 0 -1.68604 0 0 -2.75335 0 0 lm: -37.5177 w: -9 tm: -9.09102 -14.8064 -5.83693 -11.2552 4.99948 ||| -18.2887
56
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both sides of the |5-7| Atlantic , |8-8| ||| d: 0 -1.23256 0 0 -2.51519 0 0 lm: -38.7461 w: -10 tm: -7.09338 -15.7403 -9.5766 -11.5666 4.99948 ||| -18.2929
57
+ 0 ||| taming |0-1| the politicians |2-3| on both |4-5| sides |6-6| of the Atlantic , |7-8| ||| d: 0 -1.25471 0 0 -2.36899 0 0 lm: -38.7461 w: -10 tm: -8.55357 -15.7643 -8.29154 -11.6166 4.99948 ||| -18.3055
58
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on |4-4| both |5-5| sides of the |6-7| Atlantic |8-8| ||| d: 0 -2.03895 0 0 -3.35567 0 0 lm: -37.2846 w: -9 tm: -10.9679 -15.8176 -5.88577 -9.62425 6.99927 ||| -18.32
59
+ 0 ||| taming |0-1| politicians on |2-4| both |5-5| sides of the |6-7| Atlantic |8-8| ||| d: 0 -2.60962 0 0 -3.76837 0 0 lm: -36.0562 w: -8 tm: -7.97707 -15.1781 -4.1354 -9.89362 4.99948 ||| -18.3785
60
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on |4-4| both |5-5| sides |6-6| of the Atlantic |7-8| ||| d: 0 -1.65691 0 0 -3.43939 0 0 lm: -37.2846 w: -9 tm: -11.3385 -15.8102 -6.36351 -9.63607 6.99927 ||| -18.401
61
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both |5-5| sides |6-6| of the |7-7| Atlantic |8-8| ||| d: 0 -2.19215 0 0 -3.67739 0 0 lm: -36.0562 w: -8 tm: -10.6742 -14.8543 -5.24311 -9.33236 6.99927 ||| -18.4099
62
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both |5-5| sides |6-6| of the |7-7| Atlantic |8-8| ||| d: 0 -1.76082 0 0 -3.29303 0 0 lm: -37.2846 w: -9 tm: -10.1368 -15.8122 -7.69773 -9.6938 6.99927 ||| -18.4267
63
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both sides |5-6| of the Atlantic , |7-8| ||| d: 0 -1.54218 0 0 -2.96742 0 0 lm: -37.5177 w: -9 tm: -8.54467 -14.7711 -7.01023 -11.2497 4.99948 ||| -18.427
64
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both |4-5| sides |6-6| of the |7-7| Atlantic |8-8| ||| d: 0 -2.13304 0 0 -3.57153 0 0 lm: -37.2846 w: -9 tm: -11.3852 -15.7646 -5.62456 -9.65404 6.99927 ||| -18.4395
65
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both sides |5-6| of the Atlantic , |7-8| ||| d: 0 -1.11085 0 0 -2.58306 0 0 lm: -38.7461 w: -10 tm: -8.00723 -15.7291 -9.46485 -11.6111 4.99948 ||| -18.4438
66
+ 0 ||| taming |0-1| politicians on |2-4| both |5-5| sides |6-6| of the Atlantic |7-8| ||| d: 0 -2.22758 0 0 -3.85209 0 0 lm: -36.0562 w: -8 tm: -8.34771 -15.1707 -4.61314 -9.90544 4.99948 ||| -18.4595
67
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on |4-4| both sides |5-6| of the |7-7| Atlantic |8-8| ||| d: 0 -1.98917 0 0 -3.7856 0 0 lm: -37.2846 w: -9 tm: -10.8388 -15.7293 -6.79787 -9.64851 6.99927 ||| -18.5778
68
+ 0 ||| taming |0-1| politicians |2-3| on both |4-5| sides of the Atlantic , |6-8| ||| d: 0 -2.0125 0 0 -2.60639 0 0 lm: -37.5177 w: -9 tm: -8.02561 -15.1979 -6.07103 -12.091 3.99959 ||| -18.6217
69
+ 0 ||| taming |0-1| politicians on |2-4| both sides |5-6| of the |7-7| Atlantic |8-8| ||| d: 0 -2.55985 0 0 -4.1983 0 0 lm: -36.0562 w: -8 tm: -7.848 -15.0898 -5.0475 -9.91788 4.99948 ||| -18.6363
70
+ 0 ||| taming |0-1| politicians |2-3| on both sides |4-6| of the |7-7| Atlantic , |8-8| ||| d: 0 -2.28396 0 0 -3.29781 0 0 lm: -37.5177 w: -9 tm: -9.08225 -14.6816 -6.05783 -11.1927 4.99948 ||| -18.6364
71
+ 0 ||| taming |0-1| the politicians |2-3| on both |4-5| sides of the Atlantic , |6-8| ||| d: 0 -1.58117 0 0 -2.22203 0 0 lm: -38.7461 w: -10 tm: -7.48816 -16.1559 -8.52564 -12.4524 3.99959 ||| -18.6385
72
+ 0 ||| taming |0-1| the politicians |2-3| on both sides |4-6| of the |7-7| Atlantic , |8-8| ||| d: 0 -1.85263 0 0 -2.91345 0 0 lm: -38.7461 w: -10 tm: -8.5448 -15.6395 -8.51244 -11.5541 4.99948 ||| -18.6532
73
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both sides of the Atlantic , |4-8| ||| d: 0 -2.63088 0 0 -2.88417 0 0 lm: -38.7461 w: -10 tm: -8.50434 -15.8464 -5.43125 -12.3526 3.99959 ||| -18.6546
74
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both sides of the Atlantic , |5-8| ||| d: 0 -1.86965 0 0 -2.85256 0 0 lm: -37.5177 w: -9 tm: -7.44015 -15.0375 -7.00556 -11.9328 3.99959 ||| -18.6588
75
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both sides of the Atlantic , |5-8| ||| d: 0 -1.43831 0 0 -2.4682 0 0 lm: -38.7461 w: -10 tm: -6.9027 -15.9955 -9.46017 -12.2942 3.99959 ||| -18.6756
76
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both sides |4-6| of the Atlantic , |7-8| ||| d: 0 -1.9941 0 0 -3.05981 0 0 lm: -38.7461 w: -10 tm: -10.2145 -15.6375 -6.57985 -11.5651 4.99948 ||| -18.6887
77
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both |5-5| sides of the |6-7| Atlantic , |8-8| ||| d: 0 -1.89824 0 0 -3.06558 0 0 lm: -37.5177 w: -9 tm: -9.81987 -14.8606 -7.4611 -11.1602 5.99938 ||| -18.7085
78
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both |5-5| sides of the |6-7| Atlantic , |8-8| ||| d: 0 -1.4669 0 0 -2.68122 0 0 lm: -38.7461 w: -10 tm: -9.28242 -15.8185 -9.91572 -11.5217 5.99938 ||| -18.7253
79
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both |4-5| sides of the |6-7| Atlantic , |8-8| ||| d: 0 -1.83912 0 0 -2.95972 0 0 lm: -38.7461 w: -10 tm: -10.5308 -15.7709 -7.84255 -11.4819 5.99938 ||| -18.7381
80
+ 0 ||| taming |0-1| the |2-2| politicians on |3-4| both sides of the Atlantic |5-8| ||| d: 0 -1.07039 0 0 -3.90067 0 0 lm: -37.2846 w: -9 tm: -8.33352 -16.8256 -6.4114 -10.5648 3.99959 ||| -18.7608
81
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both sides of the |4-7| Atlantic , |8-8| ||| d: 0 -2.60513 0 0 -2.97312 0 0 lm: -38.7461 w: -10 tm: -9.82762 -15.6506 -6.60437 -11.4952 4.99948 ||| -18.7622
82
+ 0 ||| taming |0-1| politicians |2-3| on both |4-5| sides |6-6| of the |7-7| Atlantic , |8-8| ||| d: 0 -1.99232 0 0 -3.28144 0 0 lm: -37.5177 w: -9 tm: -10.2371 -14.8075 -7.1999 -11.19 5.99938 ||| -18.828
83
+ 0 ||| taming |0-1| the politicians |2-3| on both |4-5| sides |6-6| of the |7-7| Atlantic , |8-8| ||| d: 0 -1.56099 0 0 -2.89708 0 0 lm: -38.7461 w: -10 tm: -9.6997 -15.7655 -9.65451 -11.5514 5.99938 ||| -18.8448
84
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both |5-5| sides |6-6| of the Atlantic , |7-8| ||| d: 0 -1.76157 0 0 -3.1493 0 0 lm: -37.5177 w: -9 tm: -10.6585 -14.8531 -7.34047 -11.2407 5.99938 ||| -18.8508
85
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both |5-5| sides |6-6| of the Atlantic , |7-8| ||| d: 0 -1.33024 0 0 -2.76494 0 0 lm: -38.7461 w: -10 tm: -10.121 -15.8111 -9.79508 -11.6021 5.99938 ||| -18.8676
86
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on |4-4| both sides of the |5-7| Atlantic , |8-8| ||| d: 0 -1.68031 0 0 -3.18964 0 0 lm: -38.7461 w: -10 tm: -9.90924 -15.7394 -9.00698 -11.5123 5.99938 ||| -18.8678
87
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both |4-5| sides |6-6| of the Atlantic , |7-8| ||| d: 0 -1.70246 0 0 -3.04344 0 0 lm: -38.7461 w: -10 tm: -11.3694 -15.7635 -7.72192 -11.5624 5.99938 ||| -18.8804
88
+ 0 ||| taming |0-1| the |2-2| politicians on |3-4| both sides of the |5-7| Atlantic |8-8| ||| d: 0 -1.48965 0 0 -3.94766 0 0 lm: -37.2846 w: -9 tm: -9.21005 -16.7944 -6.48638 -10.5672 4.99948 ||| -18.8852
89
+ 0 ||| taming |0-1| politicians on |2-4| both sides of the |5-7| Atlantic , |8-8| ||| d: 0 -2.25098 0 0 -3.60234 0 0 lm: -37.5177 w: -9 tm: -6.91841 -15.0999 -7.2566 -11.7817 3.99958 ||| -18.9263
90
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both sides |5-6| of the |7-7| Atlantic , |8-8| ||| d: 0 -1.84846 0 0 -3.49551 0 0 lm: -37.5177 w: -9 tm: -9.6908 -14.7723 -8.37321 -11.1845 5.99938 ||| -18.9663
91
+ 0 ||| taming |0-1| the |2-2| politicians on |3-4| both sides |5-6| of the Atlantic |7-8| ||| d: 0 -1.12256 0 0 -4.01553 0 0 lm: -37.2846 w: -9 tm: -9.65595 -16.7832 -6.97301 -10.543 4.99948 ||| -18.9749
92
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both sides |5-6| of the |7-7| Atlantic , |8-8| ||| d: 0 -1.41713 0 0 -3.11115 0 0 lm: -38.7461 w: -10 tm: -9.15335 -15.7302 -10.8278 -11.5459 5.99938 ||| -18.9831
93
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on |4-4| both |5-5| sides |6-6| of the |7-7| Atlantic |8-8| ||| d: 0 -2.20857 0 0 -3.96748 0 0 lm: -37.2846 w: -9 tm: -12.9526 -15.8114 -7.12811 -9.63954 7.99917 ||| -19.0016
94
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on |4-4| both sides |5-6| of the Atlantic , |7-8| ||| d: 0 -1.5586 0 0 -3.25751 0 0 lm: -38.7461 w: -10 tm: -10.8231 -15.7282 -8.89523 -11.5568 5.99938 ||| -19.0187
95
+ 0 ||| taming |0-1| politicians on |2-4| both |5-5| sides |6-6| of the |7-7| Atlantic |8-8| ||| d: 0 -2.77924 0 0 -4.38018 0 0 lm: -36.0562 w: -8 tm: -9.96178 -15.1719 -5.37774 -9.90891 5.99938 ||| -19.0601
96
+ 0 ||| taming |0-1| politicians on |2-4| both sides |5-6| of the Atlantic , |7-8| ||| d: 0 -2.12927 0 0 -3.67021 0 0 lm: -37.5177 w: -9 tm: -7.83225 -15.0887 -7.14485 -11.8262 3.99958 ||| -19.0772
97
+ 0 ||| taming |0-1| the |2-2| politicians on |3-4| both |5-5| sides of the Atlantic |6-8| ||| d: 0 -1.28737 0 0 -4.05045 0 0 lm: -37.2846 w: -9 tm: -10.2478 -16.8915 -6.73989 -10.518 4.99948 ||| -19.1232
98
+ 0 ||| taming |0-1| politicians |2-3| on |4-4| both |5-5| sides of the Atlantic , |6-8| ||| d: 0 -2.08803 0 0 -3.00234 0 0 lm: -37.5177 w: -9 tm: -9.59305 -15.2447 -7.57457 -12.0765 4.99948 ||| -19.1838
99
+ 0 ||| taming |0-1| the politicians |2-3| on |4-4| both |5-5| sides of the Atlantic , |6-8| ||| d: 0 -1.6567 0 0 -2.61798 0 0 lm: -38.7461 w: -10 tm: -9.0556 -16.2026 -10.0292 -12.4379 4.99948 ||| -19.2006
100
+ 0 ||| taming |0-1| the |2-2| politicians |3-3| on both |4-5| sides of the Atlantic , |6-8| ||| d: 0 -2.02892 0 0 -2.89648 0 0 lm: -38.7461 w: -10 tm: -10.304 -16.155 -7.95602 -12.3982 4.99948 ||| -19.2134
mosesdecoder/contrib/promix/test_data/test.nbest.scores ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SCORES_TXT_BEGIN_0 0 100 9 BLEU
2
+ 5 12 2 11 1 10 0 9 8
3
+ 5 13 2 12 1 11 0 10 8
4
+ 5 11 2 10 1 9 0 8 8
5
+ 5 12 2 11 1 10 0 9 8
6
+ 5 12 2 11 1 10 0 9 8
7
+ 5 13 2 12 1 11 0 10 8
8
+ 5 13 1 12 0 11 0 10 8
9
+ 5 12 2 11 1 10 0 9 8
10
+ 5 14 1 13 0 12 0 11 8
11
+ 5 13 2 12 1 11 0 10 8
12
+ 5 12 1 11 0 10 0 9 8
13
+ 5 13 1 12 0 11 0 10 8
14
+ 5 13 2 12 1 11 0 10 8
15
+ 5 14 2 13 1 12 0 11 8
16
+ 5 13 1 12 0 11 0 10 8
17
+ 5 14 1 13 0 12 0 11 8
18
+ 5 13 2 12 1 11 0 10 8
19
+ 5 14 2 13 1 12 0 11 8
20
+ 5 13 2 12 1 11 0 10 8
21
+ 5 14 2 13 1 12 0 11 8
22
+ 5 14 2 13 1 12 0 11 8
23
+ 5 13 2 12 1 11 0 10 8
24
+ 5 14 2 13 1 12 0 11 8
25
+ 5 13 1 12 0 11 0 10 8
26
+ 5 14 1 13 0 12 0 11 8
27
+ 5 14 1 13 0 12 0 11 8
28
+ 5 15 1 14 0 13 0 12 8
29
+ 5 15 1 14 0 13 0 12 8
30
+ 5 14 2 13 1 12 0 11 8
31
+ 5 14 1 13 0 12 0 11 8
32
+ 5 14 2 13 1 12 0 11 8
33
+ 5 11 2 10 1 9 0 8 8
34
+ 5 15 2 14 1 13 0 12 8
35
+ 5 15 2 14 1 13 0 12 8
36
+ 5 14 1 13 0 12 0 11 8
37
+ 5 15 1 14 0 13 0 12 8
38
+ 5 15 1 14 0 13 0 12 8
39
+ 5 12 1 11 0 10 0 9 8
40
+ 5 15 2 14 1 13 0 12 8
41
+ 5 14 1 13 0 12 0 11 8
42
+ 5 15 1 14 0 13 0 12 8
43
+ 5 12 2 11 1 10 0 9 8
44
+ 5 12 2 11 1 10 0 9 8
45
+ 5 13 2 12 1 11 0 10 8
46
+ 5 13 2 12 1 11 0 10 8
47
+ 5 14 2 13 1 12 0 11 8
48
+ 5 15 2 14 1 13 0 12 8
49
+ 5 14 1 13 0 12 0 11 8
50
+ 5 15 1 14 0 13 0 12 8
51
+ 5 13 1 12 0 11 0 10 8
52
+ 5 12 2 11 1 10 0 9 8
53
+ 5 14 1 13 0 12 0 11 8
54
+ 5 15 1 14 0 13 0 12 8
55
+ 5 14 1 13 0 12 0 11 8
56
+ 5 14 2 13 1 12 0 11 8
57
+ 5 15 1 14 0 13 0 12 8
58
+ 5 15 2 14 1 13 0 12 8
59
+ 5 16 1 15 0 14 0 13 8
60
+ 5 13 1 12 0 11 0 10 8
61
+ 5 16 2 15 1 14 0 13 8
62
+ 5 15 1 14 0 13 0 12 8
63
+ 5 16 1 15 0 14 0 13 8
64
+ 5 14 2 13 1 12 0 11 8
65
+ 5 16 1 15 0 14 0 13 8
66
+ 5 15 2 14 1 13 0 12 8
67
+ 5 13 2 12 1 11 0 10 8
68
+ 5 16 1 15 0 14 0 13 8
69
+ 5 13 2 12 1 11 0 10 8
70
+ 5 13 1 12 0 11 0 10 8
71
+ 5 14 1 13 0 12 0 11 8
72
+ 5 14 2 13 1 12 0 11 8
73
+ 5 15 1 14 0 13 0 12 8
74
+ 5 14 2 13 1 12 0 11 8
75
+ 5 13 2 12 1 11 0 10 8
76
+ 5 14 2 13 1 12 0 11 8
77
+ 5 15 2 14 1 13 0 12 8
78
+ 5 15 1 14 0 13 0 12 8
79
+ 5 16 1 15 0 14 0 13 8
80
+ 5 16 1 15 0 14 0 13 8
81
+ 5 13 2 12 1 11 0 10 8
82
+ 5 15 1 14 0 13 0 12 8
83
+ 5 15 1 14 0 13 0 12 8
84
+ 5 16 1 15 0 14 0 13 8
85
+ 5 15 2 14 1 13 0 12 8
86
+ 5 16 2 15 1 14 0 13 8
87
+ 5 16 1 15 0 14 0 13 8
88
+ 5 16 2 15 1 14 0 13 8
89
+ 5 14 1 13 0 12 0 11 8
90
+ 5 13 1 12 0 11 0 10 8
91
+ 5 15 1 14 0 13 0 12 8
92
+ 5 14 2 13 1 12 0 11 8
93
+ 5 16 1 15 0 14 0 13 8
94
+ 5 17 1 16 0 15 0 14 8
95
+ 5 16 2 15 1 14 0 13 8
96
+ 5 14 1 13 0 12 0 11 8
97
+ 5 13 2 12 1 11 0 10 8
98
+ 5 14 2 13 1 12 0 11 8
99
+ 5 14 2 13 1 12 0 11 8
100
+ 5 15 2 14 1 13 0 12 8
101
+ 5 15 2 14 1 13 0 12 8
102
+ SCORES_TXT_END_0
mosesdecoder/contrib/promix/test_main.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ import unittest
4
+
5
+ from main import *
6
+
7
+ class TestConfig(unittest.TestCase):
8
+ def setUp(self):
9
+ self.config = Config()
10
+
11
+ def test_files_short(self):
12
+ nbests = ["nbest1", "nbest2", "nbest3"]
13
+ scores = ["score1", "score2", "score3"]
14
+ self.config.parse(["-n", nbests[0], "-n", nbests[1], "-n", nbests[2],\
15
+ "-S", scores[0], "-S", scores[1], "-S", scores[2]])
16
+ self.assertEqual(self.config.nbest_files, nbests)
17
+ self.assertEqual(self.config.score_files, scores)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ unittest.main()
22
+
23
+
24
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestConfig)
mosesdecoder/contrib/promix/test_nbest.py ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding=utf8
3
+
4
+ import numpy as np
5
+ import numpy.testing as nptest
6
+ import os.path
7
+ import unittest
8
+
9
+ from nbest import *
10
+
11
+ class TestReadNBest(unittest.TestCase):
12
+ def setUp(self):
13
+ self.nbest = "test_data/test.nbest.nbest"
14
+ self.nbest_segment = "test_data/test.nbest.nbest.segments"
15
+ self.scores = "test_data/test.nbest.scores"
16
+ self.input = "test_data/test.nbest.input"
17
+
18
+ def test_featureindex(self):
19
+ for nbest in get_scored_nbests(self.nbest,self.scores,self.input):
20
+ pass
21
+ self.assertEqual(get_feature_index("tm"), [9,14])
22
+ self.assertEqual(get_feature_index("lm"), [7,8])
23
+ self.assertEqual(get_feature_index("d"), [0,7])
24
+ self.assertEqual(get_feature_index("w"), [8,9])
25
+
26
+ def test_nosegment(self):
27
+ count = 0
28
+ for nbest in get_scored_nbests(self.nbest,self.scores,self.input):
29
+ count += 1
30
+ hyp0 = nbest.hyps[0]
31
+ expected_fv = np.array([0,-1.51037,0,0,-2.60639,0,0 ,-36.0562, -8,-5.97082,-14.8327,-2.41162,-9.32734,3.99959])
32
+ self.assertEqual(len(hyp0.fv), len(expected_fv))
33
+ for i in range(len(hyp0.fv)):
34
+ self.assertAlmostEqual(expected_fv[i],hyp0.fv[i])
35
+ self.assertEqual(hyp0.text,"taming politicians on both sides of the Atlantic")
36
+ self.assertEqual(count,1)
37
+
38
+ def test_segment(self):
39
+ count = 0
40
+ for nbest in get_scored_nbests(self.nbest_segment,self.scores,self.input, segments=True):
41
+ count += 1
42
+ hyp0 = nbest.hyps[0]
43
+ self.assertEqual(hyp0.text,"taming politicians on both sides of the Atlantic")
44
+ expected_align = [(0,2,1), (2,4,2), (4,6,4), (6,9,8)]
45
+ self.assertEqual(hyp0.alignment, expected_align)
46
+ self.assertEqual(count,1)
47
+
48
+ class TestMosesPhraseScorer(unittest.TestCase):
49
+
50
+ def setUp(self):
51
+ self.scorer = MosesPhraseScorer\
52
+ (("test_data/esen.nc.model.filtered/phrase-table.0-0.1.1", \
53
+ "test_data/esen.ep.model.filtered/phrase-table.0-0.1.1"))
54
+
55
+ def test_phrase_scores(self):
56
+ hyp0 = Hypothesis("taming |0-1| politicians |2-3| on both |4-5| sides of the Atlantic |6-8|", [0, -1.51037,0, 0, -2.60639, 0, 0, -36.0562,-8,-5.97082,-14.8327,-2.41162,\
57
+ -9.32734,3.99959], True)
58
+ hyp0.input_line = "domando a los políticos en ambos lados del Atlántico"
59
+ #hyp0.score = 0.2140
60
+ self.scorer.add_scores(hyp0)
61
+ self.assertEqual(len(hyp0.phrase_scores),2)
62
+ # Each ttable should provide 4 sets of 4 scores (ignore penalty)
63
+ # These are the probabilities
64
+ # nc first, then ep. Columns are different features
65
+ expected = np.array([\
66
+ [[0.0740741,0.00756144,1,0.500047],\
67
+ [0.545866,0.233725,0.818336,0.186463],\
68
+ [0.288344,0.0548148,0.335714,0.0543585],\
69
+ [0.777778,0.0122444,0.777778,0.0351361]],\
70
+ [[0,0,0,0],\
71
+ [0.33497, 0.180441, 0.638586, 0.0962213],\
72
+ [0.0908379,0.0213197,0.187399,0.0498198],
73
+ [0.62585,0.00702384,0.836364,0.0687874]]\
74
+ ])
75
+
76
+ nptest.assert_almost_equal(hyp0.phrase_scores, expected)
77
+
78
+ # These are the interpolation weights reported by tmcombine
79
+ weights = np.array([[0.54471993730312251, 0.45528006269687754],\
80
+ [0.56546688367708142, 0.43453311632291863],\
81
+ [0.55867730373453584, 0.44132269626546422],\
82
+ [0.46645964485220004, 0.53354035514779996]])
83
+
84
+ #check that the scores are interpolated as expected
85
+ interpolated_probs = expected[0]*weights[:,0] + expected[1]*weights[:,1]
86
+ interpolated_scores = np.log(interpolated_probs)
87
+ # each column corresponds to a feature
88
+ expected_fv = interpolated_scores.sum(axis=0)
89
+ for i in range(4):
90
+ self.assertAlmostEqual(hyp0.fv[9+i], expected_fv[i], places=4)
91
+
92
+ class TestPhraseCache (unittest.TestCase):
93
+ def test_add_get(self):
94
+ """Add something to cache and check we can get it back"""
95
+ cache = PhraseCache(10)
96
+ self.assertFalse(cache.get("aa", "bb"))
97
+ scores = [1,2,3,4,5]
98
+ cache.add("aa", "bb", scores)
99
+ self.assertEquals(cache.get("aa","bb"),scores)
100
+ self.assertFalse(cache.get("aa","cc"))
101
+ self.assertFalse(cache.get("cc","bb"))
102
+
103
+ def test_lru(self):
104
+ """Check that items are cleared from the cache"""
105
+ cache = PhraseCache(2)
106
+ s1 = [1,2,3,4,5]
107
+ s2 = [2,3,4,5,6]
108
+ s3 = [3,4,5,6,7]
109
+ cache.add("aa","bb",s1)
110
+ cache.add("bb","cc",s2)
111
+ cache.add("dd","ee",s3)
112
+ self.assertEquals(cache.get("dd","ee"), s3)
113
+ self.assertEquals(cache.get("bb","cc"), s2)
114
+ self.assertFalse(cache.get("aa","bb"))
115
+ cache.add("aa","bb",s1)
116
+ self.assertFalse(cache.get("dd","ee"))
117
+
118
+
119
+
120
+
121
+ if __name__ == "__main__":
122
+ unittest.main()
123
+
124
+ suite = unittest.TestSuite([unittest.TestLoader().loadTestsFromTestCase(TestReadNBest), unittest.TestLoader().loadTestsFromTestCase(TestMosesPhraseScorer)])
mosesdecoder/contrib/server/Jamfile ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # If you get compilation errors here, make sure you have xmlrpc-c
2
+ # installed properly, including the abyss server option.
3
+
4
+ import option ;
5
+ import path ;
6
+ if [ option.get "no-xmlrpc-c" : : "yes" ]
7
+ {
8
+ echo "Not building mosesserver." ;
9
+ }
10
+ else
11
+ {
12
+ with-xmlrpc-c = [ option.get "with-xmlrpc-c" ] ;
13
+ if $(with-xmlrpc-c) {
14
+ echo While building mosesserver ... ;
15
+ # echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
16
+ # echo "!!! You are linking the XMLRPC-C library; Must be v.1.32 (September 2012) or higher !!!" ;
17
+ # echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
18
+
19
+ build-moses-server = true ;
20
+ xmlrpc-command = $(with-xmlrpc-c)/bin/xmlrpc-c-config ;
21
+ if ! [ path.exists $(xmlrpc-command) ] {
22
+ exit Could not find $(xmlrpc-command) : 1 ;
23
+ }
24
+ } else {
25
+ xmlrpc-check = [ _shell "xmlrpc-c-config --features 2>/dev/null" : exit-status ] ;
26
+ if $(xmlrpc-check[2]) = 0 {
27
+ if [ MATCH "(abyss-server)" : $(xmlrpc-check[1]) ] {
28
+ build-moses-server = true ;
29
+ } else {
30
+ echo "Found xmlrpc-c but it does not have abyss-server. Skipping mosesserver." ;
31
+ }
32
+ }
33
+ xmlrpc-command = "xmlrpc-c-config" ;
34
+ }
35
+ }
36
+
37
+ rule shell_or_die ( cmd ) {
38
+ local ret = [ _shell $(cmd) : exit-status ] ;
39
+ if $(ret[2]) != 0 {
40
+ exit "Failed to run $(cmd)" : 1 ;
41
+ }
42
+ return $(ret[1]) ;
43
+ }
44
+
45
+
46
+ if $(build-moses-server) = true
47
+ {
48
+ xmlrpc-linkflags = [ shell_or_die "$(xmlrpc-command) c++2 abyss-server --libs" ] ;
49
+ xmlrpc-cxxflags = [ shell_or_die "$(xmlrpc-command) c++2 abyss-server --cflags" ] ;
50
+
51
+ exe mosesserver :
52
+ mosesserver.cpp
53
+ ../../moses//moses
54
+ ../../OnDiskPt//OnDiskPt
55
+ ../..//boost_filesystem
56
+ : <linkflags>$(xmlrpc-linkflags) <cxxflags>$(xmlrpc-cxxflags) ;
57
+
58
+ }
59
+ else
60
+ {
61
+ alias mosesserver ;
62
+ }
mosesdecoder/contrib/server/SampleClient.java ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //
2
+ // Java Sample client for mosesserver (Created by Marwen AZOUZI)
3
+ // The XML-RPC libraries are available at Apache (http://ws.apache.org/xmlrpc/)
4
+ //
5
+
6
+ import java.util.HashMap;
7
+ import java.net.URL;
8
+ import org.apache.xmlrpc.client.XmlRpcClient;
9
+ import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
10
+
11
+ public class SampleClient {
12
+ public static void main(String[] args) {
13
+ try {
14
+ // Create an instance of XmlRpcClient
15
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
16
+ config.setServerURL(new URL("http://localhost:8080/RPC2"));
17
+ XmlRpcClient client = new XmlRpcClient();
18
+ client.setConfig(config);
19
+ // The XML-RPC data type used by mosesserver is <struct>. In Java, this data type can be represented using HashMap.
20
+ HashMap<String,String> mosesParams = new HashMap<String,String>();
21
+ String textToTranslate = new String("some text to translate .");
22
+ mosesParams.put("text", textToTranslate);
23
+ mosesParams.put("align", "true");
24
+ mosesParams.put("report-all-factors", "true");
25
+ // The XmlRpcClient.execute method doesn't accept Hashmap (pParams). It's either Object[] or List.
26
+ Object[] params = new Object[] { null };
27
+ params[0] = mosesParams;
28
+ // Invoke the remote method "translate". The result is an Object, convert it to a HashMap.
29
+ HashMap result = (HashMap)client.execute("translate", params);
30
+ // Print the returned results
31
+ String textTranslation = (String)result.get("text");
32
+ System.out.println("Input : "+textToTranslate);
33
+ System.out.println("Translation : "+textTranslation);
34
+ if (result.get("align") != null){
35
+ Object[] aligns = (Object[])result.get("align");
36
+ System.out.println("Phrase alignments : [Source Start:Source End][Target Start]");
37
+ for ( Object element : aligns) {
38
+ HashMap align = (HashMap)element;
39
+ System.out.println("["+align.get("src-start")+":"+align.get("src-end")+"]["+align.get("tgt-start")+"]");
40
+ }
41
+ }
42
+ } catch (Exception e) {
43
+ e.printStackTrace();
44
+ }
45
+ }
46
+ }
mosesdecoder/contrib/server/Translation-web/web/index.html ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html lang="fr">
2
+ <head>
3
+ <style>
4
+ </style>
5
+ <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet"
6
+ type="text/css"/>
7
+ <script src="lib/jquery-1.6.4.js" type="text/javascript"></script>
8
+ <script src="lib/jquery-ui-1.8.16.custom.js" type="text/javascript"></script>
9
+
10
+ <link rel="stylesheet" href="css/common.css" type="text/css"/>
11
+ <script>
12
+ $(document).ready(function () {
13
+ $( "input:submit").button();
14
+ $( "input:submit").click(function(){
15
+ $.ajax({
16
+ url: "Translate",
17
+ type: "POST",
18
+ context: document.body,
19
+ data: {text: $("#input_text").val()}
20
+ }).done(function(data) {
21
+ $("#output_text").val(data);
22
+ });
23
+ })
24
+
25
+
26
+
27
+ });
28
+ </script>
29
+ <title>Translate FR-EN</title>
30
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
31
+ </head>
32
+ <body>
33
+ <div id="north_tab">
34
+ <h2>Translate FR-EN</h2>
35
+ </div>
36
+ <div id="south_tab">
37
+ <textarea id="input_text">
38
+ </textarea>
39
+
40
+ <input id="translate" type="submit" value="Translate">
41
+
42
+ <textarea id="output_text" readonly="readonly">
43
+ </textarea>
44
+ </div>
45
+
46
+ </body>
47
+ </html>
mosesdecoder/contrib/server/client-stdin.perl ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env perl
2
+
3
+ #
4
+ # Sample client for mosesserver, illustrating allignment info and
5
+ # report all factors
6
+ #
7
+ use strict;
8
+ use Encode;
9
+ use XMLRPC::Lite;
10
+ use utf8;
11
+
12
+ binmode(STDIN, ":utf8");
13
+
14
+
15
+ my $url = "http://localhost:8080/RPC2";
16
+ my $proxy = XMLRPC::Lite->proxy($url);
17
+
18
+ my $text;
19
+ while ($text = <STDIN>) {
20
+ #for (my $i = 0; $i < scalar(@doc); ++$i) {
21
+ # my $text = $doc[$i];
22
+
23
+ # Work-around for XMLRPC::Lite bug
24
+ #my $encoded = SOAP::Data->type(string => Encode::encode("utf8",$text));
25
+ my $encoded = SOAP::Data->type(string => $text);
26
+
27
+ my %param = ("text" => $encoded, "align" => "true", "report-all-factors" => "true");
28
+ my $result = $proxy->call("translate",\%param)->result;
29
+ print $result->{'text'} . "\n";
30
+ if ($result->{'align'}) {
31
+ print "Phrase alignments: \n";
32
+ my $aligns = $result->{'align'};
33
+ foreach my $align (@$aligns) {
34
+ print $align->{'tgt-start'} . "," . $align->{'src-start'} . ","
35
+ . $align->{'src-end'} . "\n";
36
+ }
37
+ }
38
+ }
39
+
40
+
41
+
mosesdecoder/contrib/server/client.perl ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env perl
2
+
3
+ #
4
+ # Sample client for mosesserver, illustrating allignment info and
5
+ # report all factors
6
+ #
7
+ use strict;
8
+ use Encode;
9
+ use XMLRPC::Lite;
10
+ use utf8;
11
+
12
+ my $url = "http://localhost:8080/RPC2";
13
+ my $proxy = XMLRPC::Lite->proxy($url);
14
+
15
+ my @doc = ("monsieur le président , ce que nous devrons toutefois également faire à biarritz , c' est regarder un peu plus loin .",
16
+ "les élus que nous sommes avons au moins autant le devoir de l' encourager à progresser , en dépit de l' adversité , que de relayer les messages que nous recevons de l' opinion publique dans chacun de nos pays .",
17
+ "au regard des événements de ces derniers temps , la question du prix de l' essence me semble elle aussi particulièrement remarquable .",
18
+ "à l' heure actuelle , le conseil est en train d' examiner l' inclusion de tels mécanismes dans l' article 7 .",
19
+ "deuxièmement , dans la transparence pour les citoyens , qui connaissent à présent les droits dont ils disposent vis-à-vis de ceux qui appliquent et élaborent le droit européen , et pour ceux qui , justement , appliquent et élaborent ce droit européen .");
20
+ #print STDERR scalar(@doc);
21
+
22
+ for (my $i = 0; $i < scalar(@doc); ++$i) {
23
+ my $text = $doc[$i];
24
+
25
+ # Work-around for XMLRPC::Lite bug
26
+ my $encoded = SOAP::Data->type(string => Encode::encode("utf8",$text));
27
+ #$encoded = SOAP::Data->type(string => $text);
28
+
29
+ my %param = ("text" => $encoded, "align" => "true", "report-all-factors" => "true");
30
+ my $result = $proxy->call("translate",\%param)->result;
31
+ print $result->{'text'} . "\n";
32
+ if ($result->{'align'}) {
33
+ print "Phrase alignments: \n";
34
+ my $aligns = $result->{'align'};
35
+ foreach my $align (@$aligns) {
36
+ print $align->{'tgt-start'} . "," . $align->{'src-start'} . ","
37
+ . $align->{'src-end'} . "\n";
38
+ }
39
+ }
40
+ }
41
+
42
+
43
+
mosesdecoder/contrib/server/client.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+
4
+ # python port of client.perl
5
+
6
+ import xmlrpclib
7
+ import datetime
8
+
9
+ url = "http://localhost:8080/RPC2"
10
+ proxy = xmlrpclib.ServerProxy(url)
11
+
12
+ text = u"il a souhaité que la présidence trace à nice le chemin pour l' avenir ."
13
+ params = {"text":text, "align":"true", "report-all-factors":"true"}
14
+
15
+ result = proxy.translate(params)
16
+
17
+ print result['text']
18
+
19
+ if 'id' in result:
20
+ print "Segment ID:%s" % (result['id'])
21
+
22
+ if 'align' in result:
23
+ print "Phrase alignments:"
24
+ aligns = result['align']
25
+ for align in aligns:
26
+ print "%s,%s,%s" %(align['tgt-start'], align['src-start'], align['src-end'])
mosesdecoder/contrib/server/client_multimodel.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+
3
+ #
4
+ # Sample python client. Additionally to basic functionality, shows how translation model weights can be provided to multimodel phrase table type,
5
+ # and how translation model weights can be optimized on tuning set of phrase pairs.
6
+ # translate_concurrent() shows how to use multiple moses server threads.
7
+ #
8
+
9
+ import sys
10
+ import gzip
11
+ from multiprocessing import Pool
12
+
13
+ if sys.version_info < (3, 0):
14
+ import xmlrpclib
15
+ else:
16
+ import xmlrpc.client as xmlrpclib
17
+
18
+
19
+ def translate(input_object, server, weights=None, model_name=None):
20
+ """translate each sentence in an input_object (list, file-like object or other object that iterates over sentences)
21
+ server is a xmlrpclib.ServerProxy
22
+ model_name is the name of the PhraseDictionaryMultiModel(Counts) feature function that the weights should be applied to. It is defined in the moses.ini
23
+ weights is a list of floats (one float per model, or one float per model per feature)
24
+ """
25
+
26
+ for line in input_object:
27
+ params = {}
28
+ params['text'] = line
29
+ if weights:
30
+ if not model_name:
31
+ sys.stderr.write("Error: if you define weights, you need to specify the feature to which the weights are to be applied (e.g. PhraseDictionaryMultiModel0)\n")
32
+ sys.exit(1)
33
+ params['model_name'] = model_name
34
+ params['lambda'] = weights
35
+
36
+ print server.translate(params)
37
+
38
+
39
+ def optimize(phrase_pairs, server, model_name):
40
+
41
+ params = {}
42
+ params['phrase_pairs'] = phrase_pairs
43
+ params['model_name'] = model_name
44
+ weights = server.optimize(params)
45
+ sys.stderr.write('weight vector (set lambda in moses.ini to this value to set as default): ')
46
+ sys.stderr.write(','.join(map(str,weights)) + '\n')
47
+ return weights
48
+
49
+
50
+ def read_phrase_pairs(input_object):
51
+
52
+ pairs = []
53
+ for line in input_object:
54
+ line = line.split(' ||| ')
55
+ pairs.append((line[0],line[1]))
56
+ return pairs
57
+
58
+
59
+ #same functionality as translate(), but using multiple concurrent connections to server
60
+ def translate_concurrent(input_object, url, weights=None, num_processes=8):
61
+
62
+ pool = Pool(processes=num_processes)
63
+ text_args = [(line, weights, url) for line in input_object]
64
+
65
+ for translated_line in pool.imap(translate_single_line, text_args):
66
+ print translated_line
67
+
68
+
69
+ def translate_single_line(args):
70
+
71
+ line, weights, url = args
72
+ server = xmlrpclib.ServerProxy(url)
73
+
74
+ params = {}
75
+ params['text'] = line
76
+ if weights:
77
+ params['lambda'] = weights
78
+
79
+ return server.translate(params)['text']
80
+
81
+
82
+ if __name__ == '__main__':
83
+ url = "http://localhost:8111/RPC2"
84
+ server = xmlrpclib.ServerProxy(url)
85
+
86
+ phrase_pairs = read_phrase_pairs(gzip.open('/path/to/moses-regression-tests/models/multimodel/extract.sorted.gz'))
87
+ weights = optimize(phrase_pairs, server, 'PhraseDictionaryMultiModelCounts0')
88
+
89
+ translate(sys.stdin, server, weights, 'PhraseDictionaryMultiModelCounts0')
mosesdecoder/contrib/server/mosesserver.cpp ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include "moses/ExportInterface.h"
2
+ // The separate moses server executable has been phased out.
3
+
4
+ /** main function of the command line version of the decoder **/
5
+ int main(int argc, char const** argv)
6
+ {
7
+ // Map double-dash long options back to single-dash long options
8
+ // as used in legacy moses.
9
+ for (int i = 1; i < argc; ++i)
10
+ {
11
+ if (argv[i][0] == '-' && argv[i][1] == '-')
12
+ ++argv[i];
13
+ }
14
+ char const* argv2[argc+1];
15
+ for (int i = 0; i < argc; ++i)
16
+ argv2[i] = argv[i];
17
+ argv2[argc] = "--server";
18
+ return decoder_main(argc+1, argv2);
19
+ }
mosesdecoder/contrib/server/sgclient_weightUpdate.perl ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl -w
2
+ use strict;
3
+ use Frontier::Client;
4
+
5
+ my $output_suffix = $ARGV[0];
6
+ $output_suffix = "" if (not $output_suffix);
7
+
8
+ my $port = "50015";
9
+ my $url = "http://localhost:".$port."/RPC2";
10
+ my $server = Frontier::Client->new('url' => $url, 'encoding' => 'UTF-8');
11
+ my $verbose=0;
12
+
13
+ my $translations="translations$output_suffix.out";
14
+ open TR, ">:utf8", $translations;
15
+ my $sg_out="searchGraph$output_suffix.out";
16
+ open SG, ">:utf8", $sg_out;
17
+
18
+ my $i=0;
19
+ while (my $text = <STDIN>)
20
+ {
21
+ my $date = `date`;
22
+ chop($date);
23
+ print "[$date] sentence $i: translate\n" if $verbose;
24
+
25
+ # update weights
26
+ my $core_weights = "0.0314787,-0.138354,1,0.0867223,0.0349965,0.104774,0.0607203,0.0516889,0.113694,0.0947218,0.0642702,0.0385324,0.0560749,0.0434684,0.0805031";
27
+ #my $core_weights = "0.0314787,-0.138354,1,0.0867223,0.0349965,0.104774,0.0607203,0.0516889,0.113694,0.0947218,0.0642702,0.0385324,0.0560749,0.0434684,0.0805031,0";
28
+ #my $sparse_weights = "pp_dummy~dummy=0.001";
29
+ my $sparse_weights = "";
30
+ my %param = ("core-weights" => $core_weights, "sparse-weights" => $sparse_weights);
31
+ $server->call("setWeights",(\%param));
32
+
33
+ #my $core_weight_update = "0.1,0.1,0,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1";
34
+ #my $sparse_weight_update = "pp_dummy~dummy=0.1";
35
+ #my %param_update = ("core-weights" => $core_weight_update, "sparse-weights" => $sparse_weight_update);
36
+ #$server->call("addWeights",(\%param_update));
37
+
38
+ # translate
39
+ #my %param = ("text" => $server->string($SENTENCE[$i]) , "sg" => "true");
40
+ %param = ("text" => $text, "id" => $i, "sg" => "true");
41
+ my $result = $server->call("translate",(\%param));
42
+
43
+ $date = `date`;
44
+ chop($date);
45
+ print "[$date] sentence $i: process translation\n" if $verbose;
46
+
47
+ # process translation
48
+ my $mt_output = $result->{'text'};
49
+ $mt_output =~ s/\|\S+//g; # no multiple factors, only first
50
+ print "sentence $i >> $translations \n";
51
+ print TR $mt_output."\n";
52
+
53
+ # print out search graph
54
+ print "sentence $i >> $sg_out \n";
55
+ my $sg_ref = $result->{'sg'};
56
+ foreach my $sgn (@$sg_ref) {
57
+ # print out in extended format
58
+ if ($sgn->{hyp} eq 0) {
59
+ print SG "$i hyp=$sgn->{'hyp'} stack=$sgn->{'stack'} forward=$sgn->{'forward'} fscore=$sgn->{'fscore'} \n";
60
+ }
61
+ else {
62
+ print SG "$i hyp=$sgn->{'hyp'} stack=$sgn->{'stack'} back=$sgn->{'back'} score=$sgn->{'score'} transition=$sgn->{'transition'} ";
63
+ if ($sgn->{"recombined"}) {
64
+ print SG "recombined=$sgn->{'recombined'} ";
65
+ }
66
+ print SG "forward=$sgn->{'forward'} fscore=$sgn->{'fscore'} covered=$sgn->{'cover-start'}-$sgn->{'cover-end'} ";
67
+ print SG "scores=\"$sgn->{'scores'}\" src-phrase=\"$sgn->{'src-phrase'}\" tgt-phrase=\"$sgn->{'tgt-phrase'}\" \n";
68
+ }
69
+ }
70
+
71
+ ++$i;
72
+ }
73
+
74
+ close(SG);
mosesdecoder/contrib/server/update.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+
4
+ # update the suffix-array phrasetable via XMLRPC
5
+
6
+ import xmlrpclib
7
+ import datetime
8
+
9
+ url = "http://localhost:8080/RPC2"
10
+ proxy = xmlrpclib.ServerProxy(url)
11
+
12
+ text = u"il a souhaité que la présidence trace à nice le chemin pour l' avenir ."
13
+
14
+ source = "Mein kleines Puppenhaus ."
15
+ target = "My small doll house ."
16
+ #align = "1-1 2-2 3-3 3-4 5-4"
17
+ align = "0-0 1-1 2-2 2-3 3-4"
18
+
19
+ params = {"source":source, "target":target, "alignment":align}
20
+ print "Updating with %s ..." %params
21
+
22
+ result = proxy.updater(params)
23
+ print result
mosesdecoder/jam-files/boost-build/kernel/boost-build.jam ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Copyright 2003 Dave Abrahams
2
+ # Distributed under the Boost Software License, Version 1.0.
3
+ # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
4
+
5
+ boost-build . ;
mosesdecoder/jam-files/boost-build/kernel/bootstrap.jam ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2003 Dave Abrahams
2
+ # Copyright 2003, 2005, 2006 Rene Rivera
3
+ # Copyright 2003, 2005, 2006 Vladimir Prus
4
+ # Distributed under the Boost Software License, Version 1.0.
5
+ # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
+
7
+ # First of all, check the jam version
8
+
9
+ if $(JAM_VERSION:J="") < 030112
10
+ {
11
+ ECHO "error: Boost.Jam version 3.1.12 or later required" ;
12
+ EXIT ;
13
+ }
14
+
15
+ local required-rules = GLOB-RECURSIVELY HAS_NATIVE_RULE ;
16
+
17
+ for local r in $(required-rules)
18
+ {
19
+ if ! $(r) in [ RULENAMES ]
20
+ {
21
+ ECHO "error: builtin rule '$(r)' is not present" ;
22
+ ECHO "error: your version of bjam is likely out of date" ;
23
+ ECHO "error: please get a fresh version from SVN." ;
24
+ EXIT ;
25
+ }
26
+ }
27
+
28
+ local native =
29
+ regex transform 2
30
+ ;
31
+ while $(native)
32
+ {
33
+ if ! [ HAS_NATIVE_RULE $(native[1]) :
34
+ $(native[2]) :
35
+ $(native[3]) ]
36
+ {
37
+ ECHO "error: missing native rule '$(native[1]).$(native[2])'" ;
38
+ ECHO "error: or interface version of that rule is too low" ;
39
+ ECHO "error: your version of bjam is likely out of date" ;
40
+ ECHO "error: please get a fresh version from SVN." ;
41
+ EXIT ;
42
+ }
43
+ native = $(native[4-]) ;
44
+ }
45
+
46
+ # Check that the builtin .ENVIRON module is present. We don't have a
47
+ # builtin to check that a module is present, so we assume that the PATH
48
+ # environment variable is always set and verify that the .ENVIRON module
49
+ # has non-empty value of that variable.
50
+ module .ENVIRON
51
+ {
52
+ local p = $(PATH) $(Path) $(path) ;
53
+ if ! $(p)
54
+ {
55
+ ECHO "error: no builtin module .ENVIRON is found" ;
56
+ ECHO "error: your version of bjam is likely out of date" ;
57
+ ECHO "error: please get a fresh version from SVN." ;
58
+ EXIT ;
59
+ }
60
+ }
61
+
62
+ # Check that @() functionality is present. Similarly to modules,
63
+ # we don't have a way to test that directly. Instead we check that
64
+ # $(TMPNAME) functionality is present which was added at roughly
65
+ # the same time (more precisely it was added just before).
66
+ {
67
+ if ! $(TMPNAME)
68
+ {
69
+ ECHO "error: no @() functionality found" ;
70
+ ECHO "error: your version of bjam is likely out of date" ;
71
+ ECHO "error: please get a fresh version from SVN." ;
72
+ EXIT ;
73
+ }
74
+ }
75
+
76
+ # Make sure that \n escape is avaiable.
77
+ if "\n" = "n"
78
+ {
79
+ if $(OS) = CYGWIN
80
+ {
81
+ ECHO "warning: escape sequences are not supported" ;
82
+ ECHO "warning: this will cause major misbehaviour on cygwin" ;
83
+ ECHO "warning: your version of bjam is likely out of date" ;
84
+ ECHO "warning: please get a fresh version from SVN." ;
85
+ }
86
+ }
87
+
88
+ # Bootstrap the module system. Then bring the import rule into the global module.
89
+ #
90
+ SEARCH on <module@>modules.jam = $(.bootstrap-file:D) ;
91
+ module modules { include <module@>modules.jam ; }
92
+ IMPORT modules : import : : import ;
93
+
94
+ {
95
+ # Add module subdirectories to the BOOST_BUILD_PATH, which allows
96
+ # us to make an incremental refactoring step by moving modules to
97
+ # the appropriate subdirectories, thereby achieving some physical
98
+ # separation of different layers without changing all of our code
99
+ # to specify subdirectories in import statements or use an extra
100
+ # level of qualification on imported names.
101
+
102
+ local subdirs =
103
+ kernel # only the most-intrinsic modules: modules, errors
104
+ util # low-level substrate: string/number handling, etc.
105
+ build # essential elements of the build system architecture
106
+ tools # toolsets for handling specific build jobs and targets.
107
+ contrib # user contributed (unreviewed) modules
108
+ . # build-system.jam lives here
109
+ ;
110
+ local whereami = [ NORMALIZE_PATH $(.bootstrap-file:DT) ] ;
111
+ BOOST_BUILD_PATH += $(whereami:D)/$(subdirs) ;
112
+
113
+ modules.poke .ENVIRON : BOOST_BUILD_PATH : $(BOOST_BUILD_PATH) ;
114
+
115
+ modules.poke : EXTRA_PYTHONPATH : $(whereami) ;
116
+ }
117
+
118
+ # Reload the modules, to clean up things. The modules module can tolerate
119
+ # being included twice.
120
+ #
121
+ import modules ;
122
+
123
+ # Process option plugins first to alow them to prevent loading
124
+ # the rest of the build system.
125
+ #
126
+ import option ;
127
+ local dont-build = [ option.process ] ;
128
+
129
+ # Should we skip building, i.e. loading the build system, according
130
+ # to the options processed?
131
+ #
132
+ if ! $(dont-build)
133
+ {
134
+ if ! --python in $(ARGV)
135
+ {
136
+ # Allow users to override the build system file from the
137
+ # command-line (mostly for testing)
138
+ local build-system = [ MATCH --build-system=(.*) : $(ARGV) ] ;
139
+ build-system ?= build-system ;
140
+
141
+ # Use last element in case of multiple command-line options
142
+ import $(build-system[-1]) ;
143
+ }
144
+ else
145
+ {
146
+ ECHO "Boost.Build V2 Python port (experimental)" ;
147
+
148
+ # Define additional interface that is exposed to Python code. Python code will
149
+ # also have access to select bjam builtins in the 'bjam' module, but some
150
+ # things are easier to define outside C.
151
+ module python_interface
152
+ {
153
+ rule load ( module-name : location )
154
+ {
155
+ USER_MODULE $(module-name) ;
156
+ # Make all rules in the loaded module available in
157
+ # the global namespace, so that we don't have
158
+ # to bother specifying "right" module when calling
159
+ # from Python.
160
+ module $(module-name)
161
+ {
162
+ __name__ = $(1) ;
163
+ include $(2) ;
164
+ local rules = [ RULENAMES $(1) ] ;
165
+ IMPORT $(1) : $(rules) : $(1) : $(1).$(rules) ;
166
+ }
167
+ }
168
+
169
+ rule peek ( module-name ? : variables + )
170
+ {
171
+ module $(<)
172
+ {
173
+ return $($(>)) ;
174
+ }
175
+ }
176
+
177
+ rule set-variable ( module-name : name : value * )
178
+ {
179
+ module $(<)
180
+ {
181
+ $(>) = $(3) ;
182
+ }
183
+ }
184
+
185
+ rule set-top-level-targets ( targets * )
186
+ {
187
+ DEPENDS all : $(targets) ;
188
+ }
189
+
190
+ rule call-in-module ( m : rulename : * )
191
+ {
192
+ module $(m)
193
+ {
194
+ return [ $(2) $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ] ;
195
+ }
196
+ }
197
+
198
+
199
+ rule set-update-action ( action : targets * : sources * : properties * )
200
+ {
201
+ $(action) $(targets) : $(sources) : $(properties) ;
202
+ }
203
+
204
+ rule set-update-action-in-module ( m : action : targets * : sources * : properties * )
205
+ {
206
+ module $(m)
207
+ {
208
+ $(2) $(3) : $(4) : $(5) ;
209
+ }
210
+ }
211
+
212
+ rule set-target-variable ( targets + : variable : value * : append ? )
213
+ {
214
+ if $(append)
215
+ {
216
+ $(variable) on $(targets) += $(value) ;
217
+ }
218
+ else
219
+ {
220
+ $(variable) on $(targets) = $(value) ;
221
+ }
222
+ }
223
+
224
+ rule get-target-variable ( targets + : variable )
225
+ {
226
+ return [ on $(targets) return $($(variable)) ] ;
227
+ }
228
+
229
+ rule import-rules-from-parent ( parent-module : this-module : user-rules * )
230
+ {
231
+ IMPORT $(parent-module) : $(user-rules) : $(this-module) : $(user-rules) ;
232
+ EXPORT $(this-module) : $(user-rules) ;
233
+ }
234
+
235
+ rule mark-included ( targets * : includes * ) {
236
+ NOCARE $(includes) ;
237
+ INCLUDES $(targets) : $(includes) ;
238
+ ISFILE $(includes) ;
239
+ }
240
+ }
241
+
242
+ PYTHON_IMPORT_RULE bootstrap : bootstrap : PyBB : bootstrap ;
243
+ modules.poke PyBB : root : [ NORMALIZE_PATH $(.bootstrap-file:DT)/.. ] ;
244
+
245
+ module PyBB
246
+ {
247
+ local ok = [ bootstrap $(root) ] ;
248
+ if ! $(ok)
249
+ {
250
+ EXIT ;
251
+ }
252
+ }
253
+
254
+
255
+ #PYTHON_IMPORT_RULE boost.build.build_system : main : PyBB : main ;
256
+
257
+ #module PyBB
258
+ #{
259
+ # main ;
260
+ #}
261
+
262
+ }
263
+ }
mosesdecoder/jam-files/boost-build/kernel/class.jam ADDED
@@ -0,0 +1,420 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2001, 2002, 2003 Dave Abrahams
2
+ # Copyright 2002, 2005 Rene Rivera
3
+ # Copyright 2002, 2003 Vladimir Prus
4
+ # Distributed under the Boost Software License, Version 1.0.
5
+ # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
+
7
+ # Polymorphic class system built on top of core Jam facilities.
8
+ #
9
+ # Classes are defined by 'class' keywords::
10
+ #
11
+ # class myclass
12
+ # {
13
+ # rule __init__ ( arg1 ) # constructor
14
+ # {
15
+ # self.attribute = $(arg1) ;
16
+ # }
17
+ #
18
+ # rule method1 ( ) # method
19
+ # {
20
+ # return [ method2 ] ;
21
+ # }
22
+ #
23
+ # rule method2 ( ) # method
24
+ # {
25
+ # return $(self.attribute) ;
26
+ # }
27
+ # }
28
+ #
29
+ # The __init__ rule is the constructor, and sets member variables.
30
+ #
31
+ # New instances are created by invoking [ new <class> <args...> ]:
32
+ #
33
+ # local x = [ new myclass foo ] ; # x is a new myclass object
34
+ # assert.result foo : [ $(x).method1 ] ; # $(x).method1 returns "foo"
35
+ #
36
+ # Derived class are created by mentioning base classes in the declaration::
37
+ #
38
+ # class derived : myclass
39
+ # {
40
+ # rule __init__ ( arg )
41
+ # {
42
+ # myclass.__init__ $(arg) ; # call base __init__
43
+ #
44
+ # }
45
+ #
46
+ # rule method2 ( ) # method override
47
+ # {
48
+ # return $(self.attribute)XXX ;
49
+ # }
50
+ # }
51
+ #
52
+ # All methods operate virtually, replacing behavior in the base classes. For
53
+ # example::
54
+ #
55
+ # local y = [ new derived foo ] ; # y is a new derived object
56
+ # assert.result fooXXX : [ $(y).method1 ] ; # $(y).method1 returns "foo"
57
+ #
58
+ # Each class instance is its own core Jam module. All instance attributes and
59
+ # methods are accessible without additional qualification from within the class
60
+ # instance. All rules imported in class declaration, or visible in base classses
61
+ # are also visible. Base methods are available in qualified form:
62
+ # base-name.method-name. By convention, attribute names are prefixed with
63
+ # "self.".
64
+
65
+ import modules ;
66
+ import numbers ;
67
+
68
+
69
+ rule xinit ( instance : class )
70
+ {
71
+ module $(instance)
72
+ {
73
+ __class__ = $(2) ;
74
+ __name__ = $(1) ;
75
+ }
76
+ }
77
+
78
+
79
+ rule new ( class args * : * )
80
+ {
81
+ .next-instance ?= 1 ;
82
+ local id = object($(class))@$(.next-instance) ;
83
+
84
+ xinit $(id) : $(class) ;
85
+
86
+ INSTANCE $(id) : class@$(class) ;
87
+ IMPORT_MODULE $(id) ;
88
+ $(id).__init__ $(args) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
89
+
90
+ # Bump the next unique object name.
91
+ .next-instance = [ numbers.increment $(.next-instance) ] ;
92
+
93
+ # Return the name of the new instance.
94
+ return $(id) ;
95
+ }
96
+
97
+
98
+ rule bases ( class )
99
+ {
100
+ module class@$(class)
101
+ {
102
+ return $(__bases__) ;
103
+ }
104
+ }
105
+
106
+
107
+ rule is-derived ( class : bases + )
108
+ {
109
+ local stack = $(class) ;
110
+ local visited found ;
111
+ while ! $(found) && $(stack)
112
+ {
113
+ local top = $(stack[1]) ;
114
+ stack = $(stack[2-]) ;
115
+ if ! ( $(top) in $(visited) )
116
+ {
117
+ visited += $(top) ;
118
+ stack += [ bases $(top) ] ;
119
+
120
+ if $(bases) in $(visited)
121
+ {
122
+ found = true ;
123
+ }
124
+ }
125
+ }
126
+ return $(found) ;
127
+ }
128
+
129
+
130
+ # Returns true if the 'value' is a class instance.
131
+ #
132
+ rule is-instance ( value )
133
+ {
134
+ return [ MATCH "^(object\\()[^@]+\\)@.*" : $(value) ] ;
135
+ }
136
+
137
+
138
+ # Check if the given value is of the given type.
139
+ #
140
+ rule is-a (
141
+ instance # The value to check.
142
+ : type # The type to test for.
143
+ )
144
+ {
145
+ if [ is-instance $(instance) ]
146
+ {
147
+ return [ class.is-derived [ modules.peek $(instance) : __class__ ] : $(type) ] ;
148
+ }
149
+ }
150
+
151
+
152
+ local rule typecheck ( x )
153
+ {
154
+ local class-name = [ MATCH "^\\[(.*)\\]$" : [ BACKTRACE 1 ] ] ;
155
+ if ! [ is-a $(x) : $(class-name) ]
156
+ {
157
+ return "Expected an instance of "$(class-name)" but got \""$(x)"\" for argument" ;
158
+ }
159
+ }
160
+
161
+
162
+ rule __test__ ( )
163
+ {
164
+ import assert ;
165
+ import "class" : new ;
166
+
167
+ # This will be the construction function for a class called 'myclass'.
168
+ #
169
+ class myclass
170
+ {
171
+ import assert ;
172
+
173
+ rule __init__ ( x_ * : y_ * )
174
+ {
175
+ # Set some instance variables.
176
+ x = $(x_) ;
177
+ y = $(y_) ;
178
+ foo += 10 ;
179
+ }
180
+
181
+ rule set-x ( newx * )
182
+ {
183
+ x = $(newx) ;
184
+ }
185
+
186
+ rule get-x ( )
187
+ {
188
+ return $(x) ;
189
+ }
190
+
191
+ rule set-y ( newy * )
192
+ {
193
+ y = $(newy) ;
194
+ }
195
+
196
+ rule get-y ( )
197
+ {
198
+ return $(y) ;
199
+ }
200
+
201
+ rule f ( )
202
+ {
203
+ return [ g $(x) ] ;
204
+ }
205
+
206
+ rule g ( args * )
207
+ {
208
+ if $(x) in $(y)
209
+ {
210
+ return $(x) ;
211
+ }
212
+ else if $(y) in $(x)
213
+ {
214
+ return $(y) ;
215
+ }
216
+ else
217
+ {
218
+ return ;
219
+ }
220
+ }
221
+
222
+ rule get-class ( )
223
+ {
224
+ return $(__class__) ;
225
+ }
226
+
227
+ rule get-instance ( )
228
+ {
229
+ return $(__name__) ;
230
+ }
231
+
232
+ rule invariant ( )
233
+ {
234
+ assert.equal 1 : 1 ;
235
+ }
236
+
237
+ rule get-foo ( )
238
+ {
239
+ return $(foo) ;
240
+ }
241
+ }
242
+ # class myclass ;
243
+
244
+ class derived1 : myclass
245
+ {
246
+ rule __init__ ( z_ )
247
+ {
248
+ myclass.__init__ $(z_) : X ;
249
+ z = $(z_) ;
250
+ }
251
+
252
+ # Override g.
253
+ #
254
+ rule g ( args * )
255
+ {
256
+ return derived1.g ;
257
+ }
258
+
259
+ rule h ( )
260
+ {
261
+ return derived1.h ;
262
+ }
263
+
264
+ rule get-z ( )
265
+ {
266
+ return $(z) ;
267
+ }
268
+
269
+ # Check that 'assert.equal' visible in base class is visible here.
270
+ #
271
+ rule invariant2 ( )
272
+ {
273
+ assert.equal 2 : 2 ;
274
+ }
275
+
276
+ # Check that 'assert.variable-not-empty' visible in base class is
277
+ # visible here.
278
+ #
279
+ rule invariant3 ( )
280
+ {
281
+ local v = 10 ;
282
+ assert.variable-not-empty v ;
283
+ }
284
+ }
285
+ # class derived1 : myclass ;
286
+
287
+ class derived2 : myclass
288
+ {
289
+ rule __init__ ( )
290
+ {
291
+ myclass.__init__ 1 : 2 ;
292
+ }
293
+
294
+ # Override g.
295
+ #
296
+ rule g ( args * )
297
+ {
298
+ return derived2.g ;
299
+ }
300
+
301
+ # Test the ability to call base class functions with qualification.
302
+ #
303
+ rule get-x ( )
304
+ {
305
+ return [ myclass.get-x ] ;
306
+ }
307
+ }
308
+ # class derived2 : myclass ;
309
+
310
+ class derived2a : derived2
311
+ {
312
+ rule __init__
313
+ {
314
+ derived2.__init__ ;
315
+ }
316
+ }
317
+ # class derived2a : derived2 ;
318
+
319
+ local rule expect_derived2 ( [derived2] x ) { }
320
+
321
+ local a = [ new myclass 3 4 5 : 4 5 ] ;
322
+ local b = [ new derived1 4 ] ;
323
+ local b2 = [ new derived1 4 ] ;
324
+ local c = [ new derived2 ] ;
325
+ local d = [ new derived2 ] ;
326
+ local e = [ new derived2a ] ;
327
+
328
+ expect_derived2 $(d) ;
329
+ expect_derived2 $(e) ;
330
+
331
+ # Argument checking is set up to call exit(1) directly on failure, and we
332
+ # can not hijack that with try, so we should better not do this test by
333
+ # default. We could fix this by having errors look up and invoke the EXIT
334
+ # rule instead; EXIT can be hijacked (;-)
335
+ if --fail-typecheck in [ modules.peek : ARGV ]
336
+ {
337
+ try ;
338
+ {
339
+ expect_derived2 $(a) ;
340
+ }
341
+ catch
342
+ "Expected an instance of derived2 but got" instead
343
+ ;
344
+ }
345
+
346
+ #try ;
347
+ #{
348
+ # new bad_subclass ;
349
+ #}
350
+ #catch
351
+ # bad_subclass.bad_subclass failed to call base class constructor myclass.__init__
352
+ # ;
353
+
354
+ #try ;
355
+ #{
356
+ # class bad_subclass ;
357
+ #}
358
+ #catch bad_subclass has already been declared ;
359
+
360
+ assert.result 3 4 5 : $(a).get-x ;
361
+ assert.result 4 5 : $(a).get-y ;
362
+ assert.result 4 : $(b).get-x ;
363
+ assert.result X : $(b).get-y ;
364
+ assert.result 4 : $(b).get-z ;
365
+ assert.result 1 : $(c).get-x ;
366
+ assert.result 2 : $(c).get-y ;
367
+ assert.result 4 5 : $(a).f ;
368
+ assert.result derived1.g : $(b).f ;
369
+ assert.result derived2.g : $(c).f ;
370
+ assert.result derived2.g : $(d).f ;
371
+
372
+ assert.result 10 : $(b).get-foo ;
373
+
374
+ $(a).invariant ;
375
+ $(b).invariant2 ;
376
+ $(b).invariant3 ;
377
+
378
+ # Check that the __class__ attribute is getting properly set.
379
+ assert.result myclass : $(a).get-class ;
380
+ assert.result derived1 : $(b).get-class ;
381
+ assert.result $(a) : $(a).get-instance ;
382
+
383
+ $(a).set-x a.x ;
384
+ $(b).set-x b.x ;
385
+ $(c).set-x c.x ;
386
+ $(d).set-x d.x ;
387
+ assert.result a.x : $(a).get-x ;
388
+ assert.result b.x : $(b).get-x ;
389
+ assert.result c.x : $(c).get-x ;
390
+ assert.result d.x : $(d).get-x ;
391
+
392
+ class derived3 : derived1 derived2
393
+ {
394
+ rule __init__ ( )
395
+ {
396
+ }
397
+ }
398
+
399
+ assert.result : bases myclass ;
400
+ assert.result myclass : bases derived1 ;
401
+ assert.result myclass : bases derived2 ;
402
+ assert.result derived1 derived2 : bases derived3 ;
403
+
404
+ assert.true is-derived derived1 : myclass ;
405
+ assert.true is-derived derived2 : myclass ;
406
+ assert.true is-derived derived3 : derived1 ;
407
+ assert.true is-derived derived3 : derived2 ;
408
+ assert.true is-derived derived3 : derived1 derived2 myclass ;
409
+ assert.true is-derived derived3 : myclass ;
410
+
411
+ assert.false is-derived myclass : derived1 ;
412
+
413
+ assert.true is-instance $(a) ;
414
+ assert.false is-instance bar ;
415
+
416
+ assert.true is-a $(a) : myclass ;
417
+ assert.true is-a $(c) : derived2 ;
418
+ assert.true is-a $(d) : myclass ;
419
+ assert.false is-a literal : myclass ;
420
+ }
mosesdecoder/jam-files/boost-build/kernel/errors.jam ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2003 Dave Abrahams
2
+ # Copyright 2004 Vladimir Prus
3
+ # Distributed under the Boost Software License, Version 1.0.
4
+ # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
5
+
6
+ # Print a stack backtrace leading to this rule's caller. Each argument
7
+ # represents a line of output to be printed after the first line of the
8
+ # backtrace.
9
+ #
10
+ rule backtrace ( skip-frames prefix messages * : * )
11
+ {
12
+ local frame-skips = 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 ;
13
+ local drop-elements = $(frame-skips[$(skip-frames)]) ;
14
+ if ! ( $(skip-frames) in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 )
15
+ {
16
+ ECHO "warning: backtrace doesn't support skipping $(skip-frames) frames;"
17
+ "using 1 instead." ;
18
+ drop-elements = 5 ;
19
+ }
20
+
21
+ local args = $(.args) ;
22
+ if $(.user-modules-only)
23
+ {
24
+ local bt = [ nearest-user-location ] ;
25
+ ECHO "$(prefix) at $(bt) " ;
26
+ for local n in $(args)
27
+ {
28
+ if $($(n))-is-not-empty
29
+ {
30
+ ECHO $(prefix) $($(n)) ;
31
+ }
32
+ }
33
+ }
34
+ else
35
+ {
36
+ # Get the whole backtrace, then drop the initial quadruples
37
+ # corresponding to the frames that must be skipped.
38
+ local bt = [ BACKTRACE ] ;
39
+ bt = $(bt[$(drop-elements)-]) ;
40
+
41
+ while $(bt)
42
+ {
43
+ local m = [ MATCH ^(.+)\\.$ : $(bt[3]) ] ;
44
+ ECHO $(bt[1]):$(bt[2]): "in" $(bt[4]) "from module" $(m) ;
45
+
46
+ # The first time through, print each argument on a separate line.
47
+ for local n in $(args)
48
+ {
49
+ if $($(n))-is-not-empty
50
+ {
51
+ ECHO $(prefix) $($(n)) ;
52
+ }
53
+ }
54
+ args = ; # Kill args so that this never happens again.
55
+
56
+ # Move on to the next quadruple.
57
+ bt = $(bt[5-]) ;
58
+ }
59
+ }
60
+ }
61
+
62
+ .args ?= messages 2 3 4 5 6 7 8 9 ;
63
+ .disabled ?= ;
64
+ .last-error-$(.args) ?= ;
65
+
66
+
67
+ # try-catch --
68
+ #
69
+ # This is not really an exception-handling mechanism, but it does allow us to
70
+ # perform some error-checking on our error-checking. Errors are suppressed after
71
+ # a try, and the first one is recorded. Use catch to check that the error
72
+ # message matched expectations.
73
+
74
+ # Begin looking for error messages.
75
+ #
76
+ rule try ( )
77
+ {
78
+ .disabled += true ;
79
+ .last-error-$(.args) = ;
80
+ }
81
+
82
+
83
+ # Stop looking for error messages; generate an error if an argument of messages
84
+ # is not found in the corresponding argument in the error call.
85
+ #
86
+ rule catch ( messages * : * )
87
+ {
88
+ .disabled = $(.disabled[2-]) ; # Pop the stack.
89
+
90
+ import sequence ;
91
+
92
+ if ! $(.last-error-$(.args))-is-not-empty
93
+ {
94
+ error-skip-frames 3 expected an error, but none occurred ;
95
+ }
96
+ else
97
+ {
98
+ for local n in $(.args)
99
+ {
100
+ if ! $($(n)) in $(.last-error-$(n))
101
+ {
102
+ local v = [ sequence.join $($(n)) : " " ] ;
103
+ v ?= "" ;
104
+ local joined = [ sequence.join $(.last-error-$(n)) : " " ] ;
105
+
106
+ .last-error-$(.args) = ;
107
+ error-skip-frames 3 expected \"$(v)\" in argument $(n) of error
108
+ : got \"$(joined)\" instead ;
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+
115
+ rule error-skip-frames ( skip-frames messages * : * )
116
+ {
117
+ if ! $(.disabled)
118
+ {
119
+ backtrace $(skip-frames) error: $(messages) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
120
+ EXIT ;
121
+ }
122
+ else if ! $(.last-error-$(.args))
123
+ {
124
+ for local n in $(.args)
125
+ {
126
+ # Add an extra empty string so that we always have
127
+ # something in the event of an error
128
+ .last-error-$(n) = $($(n)) "" ;
129
+ }
130
+ }
131
+ }
132
+
133
+ if --no-error-backtrace in [ modules.peek : ARGV ]
134
+ {
135
+ .no-error-backtrace = true ;
136
+ }
137
+
138
+
139
+ # Print an error message with a stack backtrace and exit.
140
+ #
141
+ rule error ( messages * : * )
142
+ {
143
+ if $(.no-error-backtrace)
144
+ {
145
+ # Print each argument on a separate line.
146
+ for local n in $(.args)
147
+ {
148
+ if $($(n))-is-not-empty
149
+ {
150
+ if ! $(first-printed)
151
+ {
152
+ ECHO error: $($(n)) ;
153
+ first-printed = true ;
154
+ }
155
+ else
156
+ {
157
+ ECHO $($(n)) ;
158
+ }
159
+ }
160
+ }
161
+ EXIT ;
162
+ }
163
+ else
164
+ {
165
+ error-skip-frames 3 $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
166
+ }
167
+ }
168
+
169
+
170
+ # Same as 'error', but the generated backtrace will include only user files.
171
+ #
172
+ rule user-error ( messages * : * )
173
+ {
174
+ .user-modules-only = 1 ;
175
+ error-skip-frames 3 $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
176
+ }
177
+
178
+
179
+ # Print a warning message with a stack backtrace and exit.
180
+ #
181
+ rule warning
182
+ {
183
+ backtrace 2 warning: $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
184
+ }
185
+
186
+
187
+ # Convert an arbitrary argument list into a list with ":" separators and quoted
188
+ # elements representing the same information. This is mostly useful for
189
+ # formatting descriptions of arguments with which a rule was called when
190
+ # reporting an error.
191
+ #
192
+ rule lol->list ( * )
193
+ {
194
+ local result ;
195
+ local remaining = 1 2 3 4 5 6 7 8 9 ;
196
+ while $($(remaining))
197
+ {
198
+ local n = $(remaining[1]) ;
199
+ remaining = $(remaining[2-]) ;
200
+
201
+ if $(n) != 1
202
+ {
203
+ result += ":" ;
204
+ }
205
+ result += \"$($(n))\" ;
206
+ }
207
+ return $(result) ;
208
+ }
209
+
210
+
211
+ # Return the file:line for the nearest entry in backtrace which correspond to a
212
+ # user module.
213
+ #
214
+ rule nearest-user-location ( )
215
+ {
216
+ local bt = [ BACKTRACE ] ;
217
+
218
+ local result ;
219
+ while $(bt) && ! $(result)
220
+ {
221
+ local m = [ MATCH ^(.+)\\.$ : $(bt[3]) ] ;
222
+ local user-modules = ([Jj]amroot(.jam|.v2|)|([Jj]amfile(.jam|.v2|)|user-config.jam|site-config.jam|project-root.jam) ;
223
+
224
+ if [ MATCH $(user-modules) : $(bt[1]:D=) ]
225
+ {
226
+ result = $(bt[1]):$(bt[2]) ;
227
+ }
228
+ bt = $(bt[5-]) ;
229
+ }
230
+ return $(result) ;
231
+ }
232
+
233
+
234
+ # If optimized rule is available in Jam, use it.
235
+ if NEAREST_USER_LOCATION in [ RULENAMES ]
236
+ {
237
+ rule nearest-user-location ( )
238
+ {
239
+ local r = [ NEAREST_USER_LOCATION ] ;
240
+ return $(r[1]):$(r[2]) ;
241
+ }
242
+ }
243
+
244
+
245
+ rule __test__ ( )
246
+ {
247
+ # Show that we can correctly catch an expected error.
248
+ try ;
249
+ {
250
+ error an error occurred : somewhere ;
251
+ }
252
+ catch an error occurred : somewhere ;
253
+
254
+ # Show that unexpected errors generate real errors.
255
+ try ;
256
+ {
257
+ try ;
258
+ {
259
+ error an error occurred : somewhere ;
260
+ }
261
+ catch an error occurred : nowhere ;
262
+ }
263
+ catch expected \"nowhere\" in argument 2 ;
264
+
265
+ # Show that not catching an error where one was expected is an error.
266
+ try ;
267
+ {
268
+ try ;
269
+ {
270
+ }
271
+ catch ;
272
+ }
273
+ catch expected an error, but none occurred ;
274
+ }
mosesdecoder/jam-files/boost-build/kernel/modules.jam ADDED
@@ -0,0 +1,354 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2003 Dave Abrahams
2
+ # Copyright 2003, 2005 Vladimir Prus
3
+ # Distributed under the Boost Software License, Version 1.0.
4
+ # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
5
+
6
+ # Essentially an include guard; ensures that no module is loaded multiple times.
7
+ .loaded ?= ;
8
+
9
+ # A list of modules currently being loaded for error reporting of circular
10
+ # dependencies.
11
+ .loading ?= ;
12
+
13
+ # A list of modules needing to be tested using their __test__ rule.
14
+ .untested ?= ;
15
+
16
+ # A list of modules which have been tested using their __test__ rule.
17
+ .tested ?= ;
18
+
19
+
20
+ # Runs internal Boost Build unit tests for the specified module. The module's
21
+ # __test__ rule is executed in its own module to eliminate any inadvertent
22
+ # effects of testing module dependencies (such as assert) on the module itself.
23
+ #
24
+ local rule run-module-test ( m )
25
+ {
26
+ local tested-modules = [ modules.peek modules : .tested ] ;
27
+
28
+ if ( ! $(m) in $(tested-modules) ) # Avoid recursive test invocations.
29
+ && ( ( --debug in $(argv) ) || ( --debug-module=$(m) in $(argv) ) )
30
+ {
31
+ modules.poke modules : .tested : $(tested-modules) $(m) ;
32
+
33
+ if ! ( __test__ in [ RULENAMES $(m) ] )
34
+ {
35
+ local argv = [ peek : ARGV ] ;
36
+ if ! ( --quiet in $(argv) ) && ( --debug-tests in $(argv) )
37
+ {
38
+ ECHO warning: no __test__ rule defined in module $(m) ;
39
+ }
40
+ }
41
+ else
42
+ {
43
+ if ! ( --quiet in $(argv) )
44
+ {
45
+ ECHO testing module $(m)... ;
46
+ }
47
+
48
+ local test-module = __test-$(m)__ ;
49
+ IMPORT $(m) : [ RULENAMES $(m) ] : $(test-module) : [ RULENAMES $(m) ] ;
50
+ IMPORT $(m) : __test__ : $(test-module) : __test__ : LOCALIZE ;
51
+ module $(test-module)
52
+ {
53
+ __test__ ;
54
+ }
55
+ }
56
+ }
57
+ }
58
+
59
+
60
+ # Return the binding of the given module.
61
+ #
62
+ rule binding ( module )
63
+ {
64
+ return $($(module).__binding__) ;
65
+ }
66
+
67
+
68
+ # Sets the module-local value of a variable. This is the most reliable way to
69
+ # set a module-local variable in a different module; it eliminates issues of
70
+ # name shadowing due to dynamic scoping.
71
+ #
72
+ rule poke ( module-name ? : variables + : value * )
73
+ {
74
+ module $(<)
75
+ {
76
+ $(>) = $(3) ;
77
+ }
78
+ }
79
+
80
+
81
+ # Returns the module-local value of a variable. This is the most reliable way to
82
+ # examine a module-local variable in a different module; it eliminates issues of
83
+ # name shadowing due to dynamic scoping.
84
+ #
85
+ rule peek ( module-name ? : variables + )
86
+ {
87
+ module $(<)
88
+ {
89
+ return $($(>)) ;
90
+ }
91
+ }
92
+
93
+
94
+ # Call the given rule locally in the given module. Use this for rules accepting
95
+ # rule names as arguments, so that the passed rule may be invoked in the context
96
+ # of the rule's caller (for example, if the rule accesses module globals or is a
97
+ # local rule). Note that rules called this way may accept at most 8 parameters.
98
+ #
99
+ rule call-in ( module-name ? : rule-name args * : * )
100
+ {
101
+ module $(module-name)
102
+ {
103
+ return [ $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ] ;
104
+ }
105
+ }
106
+
107
+
108
+ # Given a possibly qualified rule name and arguments, remove any initial module
109
+ # qualification from the rule and invoke it in that module. If there is no
110
+ # module qualification, the rule is invoked in the global module. Note that
111
+ # rules called this way may accept at most 8 parameters.
112
+ #
113
+ rule call-locally ( qualified-rule-name args * : * )
114
+ {
115
+ local module-rule = [ MATCH (.*)\\.(.*) : $(qualified-rule-name) ] ;
116
+ local rule-name = $(module-rule[2]) ;
117
+ rule-name ?= $(qualified-rule-name) ;
118
+ # We pass only 8 parameters here since Boost Jam allows at most 9 rule
119
+ # parameter positions and the call-in rule already uses up the initial
120
+ # position for the module name.
121
+ return [ call-in $(module-rule[1]) : $(rule-name) $(args) : $(2) : $(3) :
122
+ $(4) : $(5) : $(6) : $(7) : $(8) ] ;
123
+ }
124
+
125
+
126
+ # Load the indicated module if it is not already loaded.
127
+ #
128
+ rule load (
129
+ module-name # Name of module to load. Rules will be defined in this
130
+ # module.
131
+ : filename ? # (partial) path to file; Defaults to $(module-name).jam.
132
+ : search * # Directories in which to search for filename. Defaults to
133
+ # $(BOOST_BUILD_PATH).
134
+ )
135
+ {
136
+ # Avoid loading modules twice.
137
+ if ! ( $(module-name) in $(.loaded) )
138
+ {
139
+ filename ?= $(module-name).jam ;
140
+
141
+ # Mark the module loaded so we do not try to load it recursively.
142
+ .loaded += $(module-name) ;
143
+
144
+ # Suppress tests if any module loads are already in progress.
145
+ local suppress-test = $(.loading[1]) ;
146
+
147
+ # Push this module on the loading stack.
148
+ .loading += $(module-name) ;
149
+
150
+ # Remember that it is untested.
151
+ .untested += $(module-name) ;
152
+
153
+ # Insert the new module's __name__ and __file__ globals.
154
+ poke $(module-name) : __name__ : $(module-name) ;
155
+ poke $(module-name) : __file__ : $(filename) ;
156
+
157
+ module $(module-name)
158
+ {
159
+ # Add some grist so that the module will have a unique target name.
160
+ local module-target = $(__file__:G=module@) ;
161
+
162
+ local search = $(3) ;
163
+ search ?= [ modules.peek : BOOST_BUILD_PATH ] ;
164
+ SEARCH on $(module-target) = $(search) ;
165
+ BINDRULE on $(module-target) = modules.record-binding ;
166
+
167
+ include $(module-target) ;
168
+
169
+ # Allow the module to see its own names with full qualification.
170
+ local rules = [ RULENAMES $(__name__) ] ;
171
+ IMPORT $(__name__) : $(rules) : $(__name__) : $(__name__).$(rules) ;
172
+ }
173
+
174
+ if $(module-name) != modules && ! [ binding $(module-name) ]
175
+ {
176
+ import errors ;
177
+ errors.error "Could not find module" $(module-name) in $(search) ;
178
+ }
179
+
180
+ # Pop the loading stack. Must happen before testing or we will run into
181
+ # a circular loading dependency.
182
+ .loading = $(.loading[1--2]) ;
183
+
184
+ # Run any pending tests if this is an outer load.
185
+ if ! $(suppress-test)
186
+ {
187
+ local argv = [ peek : ARGV ] ;
188
+ for local m in $(.untested)
189
+ {
190
+ run-module-test $(m) ;
191
+ }
192
+ .untested = ;
193
+ }
194
+ }
195
+ else if $(module-name) in $(.loading)
196
+ {
197
+ import errors ;
198
+ errors.error loading \"$(module-name)\"
199
+ : circular module loading dependency:
200
+ : $(.loading)" ->" $(module-name) ;
201
+ }
202
+ }
203
+
204
+
205
+ # This helper is used by load (above) to record the binding (path) of each
206
+ # loaded module.
207
+ #
208
+ rule record-binding ( module-target : binding )
209
+ {
210
+ $(.loading[-1]).__binding__ = $(binding) ;
211
+ }
212
+
213
+
214
+ # Transform each path in the list, with all backslashes converted to forward
215
+ # slashes and all detectable redundancy removed. Something like this is probably
216
+ # needed in path.jam, but I am not sure of that, I do not understand it, and I
217
+ # am not ready to move all of path.jam into the kernel.
218
+ #
219
+ local rule normalize-raw-paths ( paths * )
220
+ {
221
+ local result ;
222
+ for p in $(paths:T)
223
+ {
224
+ result += [ NORMALIZE_PATH $(p) ] ;
225
+ }
226
+ return $(result) ;
227
+ }
228
+
229
+
230
+ .cwd = [ PWD ] ;
231
+
232
+
233
+ # Load the indicated module and import rule names into the current module. Any
234
+ # members of rules-opt will be available without qualification in the caller's
235
+ # module. Any members of rename-opt will be taken as the names of the rules in
236
+ # the caller's module, in place of the names they have in the imported module.
237
+ # If rules-opt = '*', all rules from the indicated module are imported into the
238
+ # caller's module. If rename-opt is supplied, it must have the same number of
239
+ # elements as rules-opt.
240
+ #
241
+ rule import ( module-names + : rules-opt * : rename-opt * )
242
+ {
243
+ if ( $(rules-opt) = * || ! $(rules-opt) ) && $(rename-opt)
244
+ {
245
+ import errors ;
246
+ errors.error "Rule aliasing is only available for explicit imports." ;
247
+ }
248
+
249
+ if $(module-names[2]) && ( $(rules-opt) || $(rename-opt) )
250
+ {
251
+ import errors ;
252
+ errors.error "When loading multiple modules, no specific rules or"
253
+ "renaming is allowed" ;
254
+ }
255
+
256
+ local caller = [ CALLER_MODULE ] ;
257
+
258
+ # Import each specified module
259
+ for local m in $(module-names)
260
+ {
261
+ if ! $(m) in $(.loaded)
262
+ {
263
+ # If the importing module isn't already in the BOOST_BUILD_PATH,
264
+ # prepend it to the path. We don't want to invert the search order
265
+ # of modules that are already there.
266
+
267
+ local caller-location ;
268
+ if $(caller)
269
+ {
270
+ caller-location = [ binding $(caller) ] ;
271
+ caller-location = $(caller-location:D) ;
272
+ caller-location = [ normalize-raw-paths $(caller-location:R=$(.cwd)) ] ;
273
+ }
274
+
275
+ local search = [ peek : BOOST_BUILD_PATH ] ;
276
+ search = [ normalize-raw-paths $(search:R=$(.cwd)) ] ;
277
+
278
+ if $(caller-location) && ! $(caller-location) in $(search)
279
+ {
280
+ search = $(caller-location) $(search) ;
281
+ }
282
+
283
+ load $(m) : : $(search) ;
284
+ }
285
+
286
+ IMPORT_MODULE $(m) : $(caller) ;
287
+
288
+ if $(rules-opt)
289
+ {
290
+ local source-names ;
291
+ if $(rules-opt) = *
292
+ {
293
+ local all-rules = [ RULENAMES $(m) ] ;
294
+ source-names = $(all-rules) ;
295
+ }
296
+ else
297
+ {
298
+ source-names = $(rules-opt) ;
299
+ }
300
+ local target-names = $(rename-opt) ;
301
+ target-names ?= $(source-names) ;
302
+ IMPORT $(m) : $(source-names) : $(caller) : $(target-names) ;
303
+ }
304
+ }
305
+ }
306
+
307
+
308
+ # Define exported copies in $(target-module) of all rules exported from
309
+ # $(source-module). Also make them available in the global module with
310
+ # qualification, so that it is just as though the rules were defined originally
311
+ # in $(target-module).
312
+ #
313
+ rule clone-rules ( source-module target-module )
314
+ {
315
+ local rules = [ RULENAMES $(source-module) ] ;
316
+
317
+ IMPORT $(source-module) : $(rules) : $(target-module) : $(rules) : LOCALIZE ;
318
+ EXPORT $(target-module) : $(rules) ;
319
+ IMPORT $(target-module) : $(rules) : : $(target-module).$(rules) ;
320
+ }
321
+
322
+
323
+ # These rules need to be available in all modules to implement module loading
324
+ # itself and other fundamental operations.
325
+ local globalize = peek poke record-binding ;
326
+ IMPORT modules : $(globalize) : : modules.$(globalize) ;
327
+
328
+
329
+ rule __test__ ( )
330
+ {
331
+ import assert ;
332
+ import modules : normalize-raw-paths ;
333
+
334
+ module modules.__test__
335
+ {
336
+ foo = bar ;
337
+ }
338
+
339
+ assert.result bar : peek modules.__test__ : foo ;
340
+
341
+ poke modules.__test__ : foo : bar baz ;
342
+ assert.result bar baz : peek modules.__test__ : foo ;
343
+
344
+ assert.result c:/foo/bar : normalize-raw-paths c:/x/../foo/./xx/yy/../../bar ;
345
+ assert.result . : normalize-raw-paths . ;
346
+ assert.result .. : normalize-raw-paths .. ;
347
+ assert.result ../.. : normalize-raw-paths ../.. ;
348
+ assert.result .. : normalize-raw-paths ./.. ;
349
+ assert.result / / : normalize-raw-paths / \\ ;
350
+ assert.result a : normalize-raw-paths a ;
351
+ assert.result a : normalize-raw-paths a/ ;
352
+ assert.result /a : normalize-raw-paths /a/ ;
353
+ assert.result / : normalize-raw-paths /a/.. ;
354
+ }
mosesdecoder/jam-files/boost-build/options/help.jam ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2003 Dave Abrahams
2
+ # Copyright 2003, 2006 Rene Rivera
3
+ # Copyright 2003, 2006 Vladimir Prus
4
+ # Distributed under the Boost Software License, Version 1.0.
5
+ # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
+
7
+ # This module is the plug-in handler for the --help and --help-.*
8
+ # command-line options
9
+ import modules ;
10
+ import assert ;
11
+ import doc : do-scan set-option set-output set-output-file print-help-usage print-help-top ;
12
+ import sequence ;
13
+ import set ;
14
+ import project ;
15
+ import print ;
16
+ import os ;
17
+ import version ;
18
+ import path ;
19
+
20
+ # List of possible modules, but which really aren't.
21
+ #
22
+ .not-modules =
23
+ boost-build bootstrap site-config test user-config
24
+ -tools allyourbase boost-base features python stlport testing unit-tests ;
25
+
26
+ # The help system options are parsed here and handed off to the doc
27
+ # module to translate into documentation requests and actions. The
28
+ # understood options are:
29
+ #
30
+ # --help-disable-<option>
31
+ # --help-doc-options
32
+ # --help-enable-<option>
33
+ # --help-internal
34
+ # --help-options
35
+ # --help-usage
36
+ # --help-output <type>
37
+ # --help-output-file <file>
38
+ # --help [<module-or-class>]
39
+ #
40
+ rule process (
41
+ command # The option.
42
+ : values * # The values, starting after the "=".
43
+ )
44
+ {
45
+ assert.result --help : MATCH ^(--help).* : $(command) ;
46
+ local did-help = ;
47
+ switch $(command)
48
+ {
49
+ case --help-internal :
50
+ local path-to-modules = [ modules.peek : BOOST_BUILD_PATH ] ;
51
+ path-to-modules ?= . ;
52
+ local possible-modules = [ GLOB $(path-to-modules) : *\\.jam ] ;
53
+ local not-modules = [ GLOB $(path-to-modules) : *$(.not-modules)\\.jam ] ;
54
+ local modules-to-list =
55
+ [ sequence.insertion-sort
56
+ [ set.difference $(possible-modules:D=:S=) : $(not-modules:D=:S=) ] ] ;
57
+ local modules-to-scan ;
58
+ for local m in $(modules-to-list)
59
+ {
60
+ local module-files = [ GLOB $(path-to-modules) : $(m)\\.jam ] ;
61
+ modules-to-scan += $(module-files[1]) ;
62
+ }
63
+ do-scan $(modules-to-scan) : print-help-all ;
64
+ did-help = true ;
65
+
66
+ case --help-enable-* :
67
+ local option = [ MATCH --help-enable-(.*) : $(command) ] ; option = $(option:L) ;
68
+ set-option $(option) : enabled ;
69
+ did-help = true ;
70
+
71
+ case --help-disable-* :
72
+ local option = [ MATCH --help-disable-(.*) : $(command) ] ; option = $(option:L) ;
73
+ set-option $(option) ;
74
+ did-help = true ;
75
+
76
+ case --help-output :
77
+ set-output $(values[1]) ;
78
+ did-help = true ;
79
+
80
+ case --help-output-file :
81
+ set-output-file $(values[1]) ;
82
+ did-help = true ;
83
+
84
+ case --help-doc-options :
85
+ local doc-module-spec = [ split-symbol doc ] ;
86
+ do-scan $(doc-module-spec[1]) : print-help-options ;
87
+ did-help = true ;
88
+
89
+ case --help-options :
90
+ print-help-usage ;
91
+ did-help = true ;
92
+
93
+ case --help :
94
+ local spec = $(values[1]) ;
95
+ if $(spec)
96
+ {
97
+ local spec-parts = [ split-symbol $(spec) ] ;
98
+ if $(spec-parts)
99
+ {
100
+ if $(spec-parts[2])
101
+ {
102
+ do-scan $(spec-parts[1]) : print-help-classes $(spec-parts[2]) ;
103
+ do-scan $(spec-parts[1]) : print-help-rules $(spec-parts[2]) ;
104
+ do-scan $(spec-parts[1]) : print-help-variables $(spec-parts[2]) ;
105
+ }
106
+ else
107
+ {
108
+ do-scan $(spec-parts[1]) : print-help-module ;
109
+ }
110
+ }
111
+ else
112
+ {
113
+ EXIT "Unrecognized help option '"$(command)" "$(spec)"'." ;
114
+ }
115
+ }
116
+ else
117
+ {
118
+ version.print ;
119
+ ECHO ;
120
+ # First print documentation from the current Jamfile, if any.
121
+ # FIXME: Generally, this duplication of project.jam logic is bad.
122
+ local names = [ modules.peek project : JAMROOT ]
123
+ [ modules.peek project : JAMFILE ] ;
124
+ local project-file = [ path.glob . : $(names) ] ;
125
+ if ! $(project-file)
126
+ {
127
+ project-file = [ path.glob-in-parents . : $(names) ] ;
128
+ }
129
+
130
+ for local p in $(project-file)
131
+ {
132
+ do-scan $(p) : print-help-project $(p) ;
133
+ }
134
+
135
+ # Next any user-config help.
136
+ local user-path = [ os.home-directories ] [ os.environ BOOST_BUILD_PATH ] ;
137
+ local user-config = [ GLOB $(user-path) : user-config.jam ] ;
138
+ if $(user-config)
139
+ {
140
+ do-scan $(user-config[1]) : print-help-config user $(user-config[1]) ;
141
+ }
142
+
143
+ # Next any site-config help.
144
+ local site-config = [ GLOB $(user-path) : site-config.jam ] ;
145
+ if $(site-config)
146
+ {
147
+ do-scan $(site-config[1]) : print-help-config site $(site-config[1]) ;
148
+ }
149
+
150
+ # Then the overall help.
151
+ print-help-top ;
152
+ }
153
+ did-help = true ;
154
+ }
155
+ if $(did-help)
156
+ {
157
+ UPDATE all ;
158
+ NOCARE all ;
159
+ }
160
+ return $(did-help) ;
161
+ }
162
+
163
+ # Split a reference to a symbol into module and symbol parts.
164
+ #
165
+ local rule split-symbol (
166
+ symbol # The symbol to split.
167
+ )
168
+ {
169
+ local path-to-modules = [ modules.peek : BOOST_BUILD_PATH ] ;
170
+ path-to-modules ?= . ;
171
+ local module-name = $(symbol) ;
172
+ local symbol-name = ;
173
+ local result = ;
174
+ while ! $(result)
175
+ {
176
+ local module-path = [ GLOB $(path-to-modules) : $(module-name)\\.jam ] ;
177
+ if $(module-path)
178
+ {
179
+ # The 'module-name' in fact refers to module. Return the full
180
+ # module path and a symbol within it. If 'symbol' passed to this
181
+ # rule is already module, 'symbol-name' will be empty. Otherwise,
182
+ # it's initialized on the previous loop iteration.
183
+ # In case there are several modules by this name,
184
+ # use the first one.
185
+ result = $(module-path[1]) $(symbol-name) ;
186
+ }
187
+ else
188
+ {
189
+ if ! $(module-name:S)
190
+ {
191
+ result = - ;
192
+ }
193
+ else
194
+ {
195
+ local next-symbol-part = [ MATCH ^.(.*) : $(module-name:S) ] ;
196
+ if $(symbol-name)
197
+ {
198
+ symbol-name = $(next-symbol-part).$(symbol-name) ;
199
+ }
200
+ else
201
+ {
202
+ symbol-name = $(next-symbol-part) ;
203
+ }
204
+ module-name = $(module-name:B) ;
205
+ }
206
+ }
207
+ }
208
+ if $(result) != -
209
+ {
210
+ return $(result) ;
211
+ }
212
+ }
mosesdecoder/jam-files/boost-build/tools/dmc.jam ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Digital Mars C++
2
+
3
+ # (C) Copyright Christof Meerwald 2003.
4
+ # (C) Copyright Aleksey Gurtovoy 2004.
5
+ # (C) Copyright Arjan Knepper 2006.
6
+ #
7
+ # Distributed under the Boost Software License, Version 1.0. (See
8
+ # accompanying file LICENSE_1_0.txt or copy at
9
+ # http://www.boost.org/LICENSE_1_0.txt)
10
+
11
+ # The following #// line will be used by the regression test table generation
12
+ # program as the column heading for HTML tables. Must not include version number.
13
+ #//<a href="http://www.digitalmars.com/">Digital<br>Mars C++</a>
14
+
15
+ import feature generators common ;
16
+ import toolset : flags ;
17
+ import sequence regex ;
18
+
19
+ feature.extend toolset : dmc ;
20
+
21
+ rule init ( version ? : command * : options * )
22
+ {
23
+ local condition = [ common.check-init-parameters dmc : version $(version) ] ;
24
+
25
+ local command = [ common.get-invocation-command dmc : dmc : $(command) ] ;
26
+ command ?= dmc ;
27
+
28
+ common.handle-options dmc : $(condition) : $(command) : $(options) ;
29
+
30
+ if $(command)
31
+ {
32
+ command = [ common.get-absolute-tool-path $(command[-1]) ] ;
33
+ }
34
+ root = $(command:D) ;
35
+
36
+ if $(root)
37
+ {
38
+ # DMC linker is sensitive the the direction of slashes, and
39
+ # won't link if forward slashes are used in command.
40
+ root = [ sequence.join [ regex.split $(root) "/" ] : "\\" ] ;
41
+ flags dmc .root $(condition) : $(root)\\bin\\ ;
42
+ }
43
+ else
44
+ {
45
+ flags dmc .root $(condition) : "" ;
46
+ }
47
+ }
48
+
49
+
50
+ # Declare generators
51
+ generators.register-linker dmc.link : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : EXE : <toolset>dmc ;
52
+ generators.register-linker dmc.link.dll : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB IMPORT_LIB : <toolset>dmc ;
53
+
54
+ generators.register-archiver dmc.archive : OBJ : STATIC_LIB : <toolset>dmc ;
55
+ generators.register-c-compiler dmc.compile.c++ : CPP : OBJ : <toolset>dmc ;
56
+ generators.register-c-compiler dmc.compile.c : C : OBJ : <toolset>dmc ;
57
+
58
+
59
+ # Declare flags
60
+ # dmc optlink has some limitation on the amount of debug-info included. Therefore only linenumbers are enabled in debug builds.
61
+ # flags dmc.compile OPTIONS <debug-symbols>on : -g ;
62
+ flags dmc.compile OPTIONS <debug-symbols>on : -gl ;
63
+ flags dmc.link OPTIONS <debug-symbols>on : /CO /NOPACKF /DEBUGLI ;
64
+ flags dmc.link OPTIONS <debug-symbols>off : /PACKF ;
65
+
66
+ flags dmc.compile OPTIONS <optimization>off : -S -o+none ;
67
+ flags dmc.compile OPTIONS <optimization>speed : -o+time ;
68
+ flags dmc.compile OPTIONS <optimization>space : -o+space ;
69
+ flags dmc.compile OPTIONS <exception-handling>on : -Ae ;
70
+ flags dmc.compile OPTIONS <rtti>on : -Ar ;
71
+ # FIXME:
72
+ # Compiling sources to be linked into a shared lib (dll) the -WD cflag should be used
73
+ # Compiling sources to be linked into a static lib (lib) or executable the -WA cflag should be used
74
+ # But for some reason the -WD cflag is always in use.
75
+ # flags dmc.compile OPTIONS <link>shared : -WD ;
76
+ # flags dmc.compile OPTIONS <link>static : -WA ;
77
+
78
+ # Note that these two options actually imply multithreading support on DMC
79
+ # because there is no single-threaded dynamic runtime library. Specifying
80
+ # <threading>multi would be a bad idea, though, because no option would be
81
+ # matched when the build uses the default settings of <runtime-link>dynamic
82
+ # and <threading>single.
83
+ flags dmc.compile OPTIONS <runtime-debugging>off/<runtime-link>shared : -ND ;
84
+ flags dmc.compile OPTIONS <runtime-debugging>on/<runtime-link>shared : -ND ;
85
+
86
+ flags dmc.compile OPTIONS <runtime-debugging>off/<runtime-link>static/<threading>single : ;
87
+ flags dmc.compile OPTIONS <runtime-debugging>on/<runtime-link>static/<threading>single : ;
88
+ flags dmc.compile OPTIONS <runtime-debugging>off/<runtime-link>static/<threading>multi : -D_MT ;
89
+ flags dmc.compile OPTIONS <runtime-debugging>on/<runtime-link>static/<threading>multi : -D_MT ;
90
+
91
+ flags dmc.compile OPTIONS : <cflags> ;
92
+ flags dmc.compile.c++ OPTIONS : <cxxflags> ;
93
+
94
+ flags dmc.compile DEFINES : <define> ;
95
+ flags dmc.compile INCLUDES : <include> ;
96
+
97
+ flags dmc.link <linkflags> ;
98
+ flags dmc.archive OPTIONS <arflags> ;
99
+
100
+ flags dmc LIBPATH <library-path> ;
101
+ flags dmc LIBRARIES <library-file> ;
102
+ flags dmc FINDLIBS <find-library-sa> ;
103
+ flags dmc FINDLIBS <find-library-st> ;
104
+
105
+ actions together link bind LIBRARIES
106
+ {
107
+ "$(.root)link" $(OPTIONS) /NOI /DE /XN "$(>)" , "$(<[1])" ,, $(LIBRARIES) user32.lib kernel32.lib "$(FINDLIBS:S=.lib)" , "$(<[2]:B).def"
108
+ }
109
+
110
+ actions together link.dll bind LIBRARIES
111
+ {
112
+ echo LIBRARY "$(<[1])" > $(<[2]:B).def
113
+ echo DESCRIPTION 'A Library' >> $(<[2]:B).def
114
+ echo EXETYPE NT >> $(<[2]:B).def
115
+ echo SUBSYSTEM WINDOWS >> $(<[2]:B).def
116
+ echo CODE EXECUTE READ >> $(<[2]:B).def
117
+ echo DATA READ WRITE >> $(<[2]:B).def
118
+ "$(.root)link" $(OPTIONS) /NOI /DE /XN /ENTRY:_DllMainCRTStartup /IMPLIB:"$(<[2])" "$(>)" $(LIBRARIES) , "$(<[1])" ,, user32.lib kernel32.lib "$(FINDLIBS:S=.lib)" , "$(<[2]:B).def"
119
+ }
120
+
121
+ actions compile.c
122
+ {
123
+ "$(.root)dmc" -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o"$(<)" "$(>)"
124
+ }
125
+
126
+ actions compile.c++
127
+ {
128
+ "$(.root)dmc" -cpp -c -Ab $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o"$(<)" "$(>)"
129
+ }
130
+
131
+ actions together piecemeal archive
132
+ {
133
+ "$(.root)lib" $(OPTIONS) -c -n -p256 "$(<)" "$(>)"
134
+ }
mosesdecoder/jam-files/boost-build/tools/doxygen.jam ADDED
@@ -0,0 +1,776 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2003, 2004 Douglas Gregor
2
+ # Copyright 2003, 2004, 2005 Vladimir Prus
3
+ # Copyright 2006 Rene Rivera
4
+ # Distributed under the Boost Software License, Version 1.0.
5
+ # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
+
7
+ # This module defines rules to handle generation of various outputs from source
8
+ # files documented with doxygen comments. The supported transformations are:
9
+ #
10
+ # * Source -> Doxygen XML -> BoostBook XML
11
+ # * Source -> Doxygen HTML
12
+ #
13
+ # The type of transformation is selected based on the target requested. For
14
+ # BoostBook XML, the default, specifying a target with an ".xml" suffix, or an
15
+ # empty suffix, will produce a <target>.xml and <target>.boostbook. For Doxygen
16
+ # HTML specifying a target with an ".html" suffix will produce a directory
17
+ # <target> with the Doxygen html files, and a <target>.html file redirecting to
18
+ # that directory.
19
+
20
+ import "class" : new ;
21
+ import targets ;
22
+ import feature ;
23
+ import property ;
24
+ import generators ;
25
+ import boostbook ;
26
+ import type ;
27
+ import path ;
28
+ import print ;
29
+ import regex ;
30
+ import stage ;
31
+ import project ;
32
+ import xsltproc ;
33
+ import make ;
34
+ import os ;
35
+ import toolset : flags ;
36
+ import alias ;
37
+ import common ;
38
+ import modules ;
39
+ import project ;
40
+ import utility ;
41
+ import errors ;
42
+
43
+
44
+ # Use to specify extra configuration paramters. These get translated
45
+ # into a doxyfile which configures the building of the docs.
46
+ feature.feature doxygen:param : : free ;
47
+
48
+ # Specify the "<xsl:param>boost.doxygen.header.prefix" XSLT option.
49
+ feature.feature prefix : : free ;
50
+
51
+ # Specify the "<xsl:param>boost.doxygen.reftitle" XSLT option.
52
+ feature.feature reftitle : : free ;
53
+
54
+ # Which processor to use for various translations from Doxygen.
55
+ feature.feature doxygen.processor : xsltproc doxproc : propagated implicit ;
56
+
57
+ # To generate, or not, index sections.
58
+ feature.feature doxygen.doxproc.index : no yes : propagated incidental ;
59
+
60
+ # The ID for the resulting BoostBook reference section.
61
+ feature.feature doxygen.doxproc.id : : free ;
62
+
63
+ # The title for the resulting BoostBook reference section.
64
+ feature.feature doxygen.doxproc.title : : free ;
65
+
66
+ # Location for images when generating XML
67
+ feature.feature doxygen:xml-imagedir : : free ;
68
+
69
+ # Indicates whether the entire directory should be deleted
70
+ feature.feature doxygen.rmdir : off on : optional incidental ;
71
+
72
+ # Doxygen configuration input file.
73
+ type.register DOXYFILE : doxyfile ;
74
+
75
+ # Doxygen XML multi-file output.
76
+ type.register DOXYGEN_XML_MULTIFILE : xml-dir : XML ;
77
+
78
+ # Doxygen XML coallesed output.
79
+ type.register DOXYGEN_XML : doxygen : XML ;
80
+
81
+ # Doxygen HTML multifile directory.
82
+ type.register DOXYGEN_HTML_MULTIFILE : html-dir : HTML ;
83
+
84
+ # Redirection HTML file to HTML multifile directory.
85
+ type.register DOXYGEN_HTML : : HTML ;
86
+
87
+ type.register DOXYGEN_XML_IMAGES : doxygen-xml-images ;
88
+
89
+ # Initialize the Doxygen module. Parameters are:
90
+ # name: the name of the 'doxygen' executable. If not specified, the name
91
+ # 'doxygen' will be used
92
+ #
93
+ rule init ( name ? )
94
+ {
95
+ if ! $(.initialized)
96
+ {
97
+ .initialized = true ;
98
+
99
+ .doxproc = [ modules.binding $(__name__) ] ;
100
+ .doxproc = $(.doxproc:D)/doxproc.py ;
101
+
102
+ generators.register-composing doxygen.headers-to-doxyfile
103
+ : H HPP CPP : DOXYFILE ;
104
+ generators.register-standard doxygen.run
105
+ : DOXYFILE : DOXYGEN_XML_MULTIFILE ;
106
+ generators.register-standard doxygen.xml-dir-to-boostbook
107
+ : DOXYGEN_XML_MULTIFILE : BOOSTBOOK : <doxygen.processor>doxproc ;
108
+ generators.register-standard doxygen.xml-to-boostbook
109
+ : DOXYGEN_XML : BOOSTBOOK : <doxygen.processor>xsltproc ;
110
+ generators.register-standard doxygen.collect
111
+ : DOXYGEN_XML_MULTIFILE : DOXYGEN_XML ;
112
+ generators.register-standard doxygen.run
113
+ : DOXYFILE : DOXYGEN_HTML_MULTIFILE ;
114
+ generators.register-standard doxygen.html-redirect
115
+ : DOXYGEN_HTML_MULTIFILE : DOXYGEN_HTML ;
116
+ generators.register-standard doxygen.copy-latex-pngs
117
+ : DOXYGEN_HTML : DOXYGEN_XML_IMAGES ;
118
+
119
+ IMPORT $(__name__) : doxygen : : doxygen ;
120
+ }
121
+
122
+ if $(name)
123
+ {
124
+ modify-config ;
125
+ .doxygen = $(name) ;
126
+ check-doxygen ;
127
+ }
128
+
129
+ if ! $(.doxygen)
130
+ {
131
+ check-doxygen ;
132
+ }
133
+ }
134
+
135
+ rule freeze-config ( )
136
+ {
137
+ if ! $(.initialized)
138
+ {
139
+ errors.user-error "doxygen must be initialized before it can be used." ;
140
+ }
141
+ if ! $(.config-frozen)
142
+ {
143
+ .config-frozen = true ;
144
+
145
+ if [ .is-cygwin ]
146
+ {
147
+ .is-cygwin = true ;
148
+ }
149
+ }
150
+ }
151
+
152
+ rule modify-config ( )
153
+ {
154
+ if $(.config-frozen)
155
+ {
156
+ errors.user-error "Cannot change doxygen after it has been used." ;
157
+ }
158
+ }
159
+
160
+ rule check-doxygen ( )
161
+ {
162
+ if --debug-configuration in [ modules.peek : ARGV ]
163
+ {
164
+ ECHO "notice:" using doxygen ":" $(.doxygen) ;
165
+ }
166
+ local extra-paths ;
167
+ if [ os.name ] = NT
168
+ {
169
+ local ProgramFiles = [ modules.peek : ProgramFiles ] ;
170
+ if $(ProgramFiles)
171
+ {
172
+ extra-paths = "$(ProgramFiles:J= )" ;
173
+ }
174
+ else
175
+ {
176
+ extra-paths = "C:\\Program Files" ;
177
+ }
178
+ }
179
+ .doxygen = [ common.get-invocation-command doxygen :
180
+ doxygen : $(.doxygen) : $(extra-paths) ] ;
181
+ }
182
+
183
+ rule name ( )
184
+ {
185
+ freeze-config ;
186
+ return $(.doxygen) ;
187
+ }
188
+
189
+ rule .is-cygwin ( )
190
+ {
191
+ if [ os.on-windows ]
192
+ {
193
+ local file = [ path.make [ modules.binding $(__name__) ] ] ;
194
+ local dir = [ path.native
195
+ [ path.join [ path.parent $(file) ] doxygen ] ] ;
196
+ local command =
197
+ "cd \"$(dir)\" && \"$(.doxygen)\" windows-paths-check.doxyfile 2>&1" ;
198
+ result = [ SHELL $(command) ] ;
199
+ if [ MATCH "(Parsing file /)" : $(result) ]
200
+ {
201
+ return true ;
202
+ }
203
+ }
204
+ }
205
+
206
+ # Runs Doxygen on the given Doxygen configuration file (the source) to generate
207
+ # the Doxygen files. The output is dumped according to the settings in the
208
+ # Doxygen configuration file, not according to the target! Because of this, we
209
+ # essentially "touch" the target file, in effect making it look like we have
210
+ # really written something useful to it. Anyone that uses this action must deal
211
+ # with this behavior.
212
+ #
213
+ actions doxygen-action
214
+ {
215
+ $(RM) "$(*.XML)" & "$(NAME:E=doxygen)" "$(>)" && echo "Stamped" > "$(<)"
216
+ }
217
+
218
+
219
+ # Runs the Python doxproc XML processor.
220
+ #
221
+ actions doxproc
222
+ {
223
+ python "$(DOXPROC)" "--xmldir=$(>)" "--output=$(<)" "$(OPTIONS)" "--id=$(ID)" "--title=$(TITLE)"
224
+ }
225
+
226
+
227
+ rule translate-path ( path )
228
+ {
229
+ freeze-config ;
230
+ if [ os.on-windows ]
231
+ {
232
+ if [ os.name ] = CYGWIN
233
+ {
234
+ if $(.is-cygwin)
235
+ {
236
+ return $(path) ;
237
+ }
238
+ else
239
+ {
240
+ return $(path:W) ;
241
+ }
242
+ }
243
+ else
244
+ {
245
+ if $(.is-cygwin)
246
+ {
247
+ match = [ MATCH ^(.):(.*) : $(path) ] ;
248
+ if $(match)
249
+ {
250
+ return /cygdrive/$(match[1])$(match[2]:T) ;
251
+ }
252
+ else
253
+ {
254
+ return $(path:T) ;
255
+ }
256
+ }
257
+ else
258
+ {
259
+ return $(path) ;
260
+ }
261
+ }
262
+ }
263
+ else
264
+ {
265
+ return $(path) ;
266
+ }
267
+ }
268
+
269
+
270
+ # Generates a doxygen configuration file (doxyfile) given a set of C++ sources
271
+ # and a property list that may contain <doxygen:param> features.
272
+ #
273
+ rule headers-to-doxyfile ( target : sources * : properties * )
274
+ {
275
+ local text "# Generated by Boost.Build version 2" ;
276
+
277
+ local output-dir ;
278
+
279
+ # Translate <doxygen:param> into command line flags.
280
+ for local param in [ feature.get-values <doxygen:param> : $(properties) ]
281
+ {
282
+ local namevalue = [ regex.match ([^=]*)=(.*) : $(param) ] ;
283
+ if $(namevalue[1]) = OUTPUT_DIRECTORY
284
+ {
285
+ output-dir = [ translate-path
286
+ [ utility.unquote $(namevalue[2]) ] ] ;
287
+ text += "OUTPUT_DIRECTORY = \"$(output-dir)\"" ;
288
+ }
289
+ else
290
+ {
291
+ text += "$(namevalue[1]) = $(namevalue[2])" ;
292
+ }
293
+ }
294
+
295
+ if ! $(output-dir)
296
+ {
297
+ output-dir = [ translate-path [ on $(target) return $(LOCATE) ] ] ;
298
+ text += "OUTPUT_DIRECTORY = \"$(output-dir)\"" ;
299
+ }
300
+
301
+ local headers = ;
302
+ for local header in $(sources:G=)
303
+ {
304
+ header = [ translate-path $(header) ] ;
305
+ headers += \"$(header)\" ;
306
+ }
307
+
308
+ # Doxygen generates LaTex by default. So disable it unconditionally, or at
309
+ # least until someone needs, and hence writes support for, LaTex output.
310
+ text += "GENERATE_LATEX = NO" ;
311
+ text += "INPUT = $(headers:J= )" ;
312
+ print.output $(target) plain ;
313
+ print.text $(text) : true ;
314
+ }
315
+
316
+
317
+ # Run Doxygen. See doxygen-action for a description of the strange properties of
318
+ # this rule.
319
+ #
320
+ rule run ( target : source : properties * )
321
+ {
322
+ freeze-config ;
323
+ if <doxygen.rmdir>on in $(properties)
324
+ {
325
+ local output-dir =
326
+ [ path.make
327
+ [ MATCH <doxygen:param>OUTPUT_DIRECTORY=\"?([^\"]*) :
328
+ $(properties) ] ] ;
329
+ local html-dir =
330
+ [ path.make
331
+ [ MATCH <doxygen:param>HTML_OUTPUT=(.*) :
332
+ $(properties) ] ] ;
333
+ if $(output-dir) && $(html-dir) &&
334
+ [ path.glob $(output-dir) : $(html-dir) ]
335
+ {
336
+ HTMLDIR on $(target) =
337
+ [ path.native [ path.join $(output-dir) $(html-dir) ] ] ;
338
+ rm-htmldir $(target) ;
339
+ }
340
+ }
341
+ doxygen-action $(target) : $(source) ;
342
+ NAME on $(target) = $(.doxygen) ;
343
+ RM on $(target) = [ modules.peek common : RM ] ;
344
+ *.XML on $(target) =
345
+ [ path.native
346
+ [ path.join
347
+ [ path.make [ on $(target) return $(LOCATE) ] ]
348
+ $(target:B:S=)
349
+ *.xml ] ] ;
350
+ }
351
+
352
+ if [ os.name ] = NT
353
+ {
354
+ RMDIR = rmdir /s /q ;
355
+ }
356
+ else
357
+ {
358
+ RMDIR = rm -rf ;
359
+ }
360
+
361
+ actions quietly rm-htmldir
362
+ {
363
+ $(RMDIR) $(HTMLDIR)
364
+ }
365
+
366
+ # The rules below require Boost.Book stylesheets, so we need some code to check
367
+ # that the boostbook module has actualy been initialized.
368
+ #
369
+ rule check-boostbook ( )
370
+ {
371
+ if ! [ modules.peek boostbook : .initialized ]
372
+ {
373
+ ECHO "error: the boostbook module is not initialized" ;
374
+ ECHO "error: you've attempted to use the 'doxygen' toolset, " ;
375
+ ECHO "error: which requires Boost.Book," ;
376
+ ECHO "error: but never initialized Boost.Book." ;
377
+ EXIT "error: Hint: add 'using boostbook ;' to your user-config.jam" ;
378
+ }
379
+ }
380
+
381
+
382
+ # Collect the set of Doxygen XML files into a single XML source file that can be
383
+ # handled by an XSLT processor. The source is completely ignored (see
384
+ # doxygen-action), because this action picks up the Doxygen XML index file
385
+ # xml/index.xml. This is because we can not teach Doxygen to act like a NORMAL
386
+ # program and take a "-o output.xml" argument (grrrr). The target of the
387
+ # collection will be a single Doxygen XML file.
388
+ #
389
+ rule collect ( target : source : properties * )
390
+ {
391
+ check-boostbook ;
392
+ local collect-xsl-dir
393
+ = [ path.native [ path.join [ boostbook.xsl-dir ] doxygen collect ] ] ;
394
+ local source-path
395
+ = [ path.make [ on $(source) return $(LOCATE) ] ] ;
396
+ local collect-path
397
+ = [ path.root [ path.join $(source-path) $(source:B) ] [ path.pwd ] ] ;
398
+ local native-path
399
+ = [ path.native $(collect-path) ] ;
400
+ local real-source
401
+ = [ path.native [ path.join $(collect-path) index.xml ] ] ;
402
+ xsltproc.xslt $(target) : $(real-source) $(collect-xsl-dir:S=.xsl)
403
+ : <xsl:param>doxygen.xml.path=$(native-path) ;
404
+ }
405
+
406
+
407
+ # Translate Doxygen XML into BoostBook.
408
+ #
409
+ rule xml-to-boostbook ( target : source : properties * )
410
+ {
411
+ check-boostbook ;
412
+ local xsl-dir = [ boostbook.xsl-dir ] ;
413
+ local d2b-xsl = [ path.native [ path.join [ boostbook.xsl-dir ] doxygen
414
+ doxygen2boostbook.xsl ] ] ;
415
+
416
+ local xslt-properties = $(properties) ;
417
+ for local prefix in [ feature.get-values <prefix> : $(properties) ]
418
+ {
419
+ xslt-properties += "<xsl:param>boost.doxygen.header.prefix=$(prefix)" ;
420
+ }
421
+ for local title in [ feature.get-values <reftitle> : $(properties) ]
422
+ {
423
+ xslt-properties += "<xsl:param>boost.doxygen.reftitle=$(title)" ;
424
+ }
425
+
426
+ xsltproc.xslt $(target) : $(source) $(d2b-xsl) : $(xslt-properties) ;
427
+ }
428
+
429
+
430
+ flags doxygen.xml-dir-to-boostbook OPTIONS <doxygen.doxproc.index>yes : --enable-index ;
431
+ flags doxygen.xml-dir-to-boostbook ID <doxygen.doxproc.id> ;
432
+ flags doxygen.xml-dir-to-boostbook TITLE <doxygen.doxproc.title> ;
433
+
434
+
435
+ rule xml-dir-to-boostbook ( target : source : properties * )
436
+ {
437
+ DOXPROC on $(target) = $(.doxproc) ;
438
+
439
+ LOCATE on $(source:S=) = [ on $(source) return $(LOCATE) ] ;
440
+
441
+ doxygen.doxproc $(target) : $(source:S=) ;
442
+ }
443
+
444
+
445
+ # Generate the HTML redirect to HTML dir index.html file.
446
+ #
447
+ rule html-redirect ( target : source : properties * )
448
+ {
449
+ local uri = "$(target:B)/index.html" ;
450
+ print.output $(target) plain ;
451
+ print.text
452
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
453
+ \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
454
+ <html xmlns=\"http://www.w3.org/1999/xhtml\">
455
+ <head>
456
+ <meta http-equiv=\"refresh\" content=\"0; URL=$(uri)\" />
457
+
458
+ <title></title>
459
+ </head>
460
+
461
+ <body>
462
+ Automatic redirection failed, please go to <a href=
463
+ \"$(uri)\">$(uri)</a>.
464
+ </body>
465
+ </html>
466
+ "
467
+ : true ;
468
+ }
469
+
470
+ rule copy-latex-pngs ( target : source : requirements * )
471
+ {
472
+ local directory = [ path.native
473
+ [ feature.get-values <doxygen:xml-imagedir> :
474
+ $(requirements) ] ] ;
475
+
476
+ local location = [ on $(target) return $(LOCATE) ] ;
477
+
478
+ local pdf-location =
479
+ [ path.native
480
+ [ path.join
481
+ [ path.make $(location) ]
482
+ [ path.make $(directory) ] ] ] ;
483
+ local html-location =
484
+ [ path.native
485
+ [ path.join
486
+ .
487
+ html
488
+ [ path.make $(directory) ] ] ] ;
489
+
490
+ common.MkDir $(pdf-location) ;
491
+ common.MkDir $(html-location) ;
492
+
493
+ DEPENDS $(target) : $(pdf-location) $(html-location) ;
494
+
495
+ if [ os.name ] = NT
496
+ {
497
+ CP on $(target) = copy /y ;
498
+ FROM on $(target) = \\*.png ;
499
+ TOHTML on $(target) = .\\html\\$(directory) ;
500
+ TOPDF on $(target) = \\$(directory) ;
501
+ }
502
+ else
503
+ {
504
+ CP on $(target) = cp ;
505
+ FROM on $(target) = /*.png ;
506
+ TOHTML on $(target) = ./html/$(directory) ;
507
+ TOPDF on $(target) = $(target:D)/$(directory) ;
508
+ }
509
+ }
510
+
511
+ actions copy-latex-pngs
512
+ {
513
+ $(CP) $(>:S=)$(FROM) $(TOHTML)
514
+ $(CP) $(>:S=)$(FROM) $(<:D)$(TOPDF)
515
+ echo "Stamped" > "$(<)"
516
+ }
517
+
518
+ # building latex images for doxygen XML depends
519
+ # on latex, dvips, and ps being in your PATH.
520
+ # This is true for most Unix installs, but
521
+ # not on Win32, where you will need to install
522
+ # MkTex and Ghostscript and add these tools
523
+ # to your path.
524
+
525
+ actions check-latex
526
+ {
527
+ latex -version >$(<)
528
+ }
529
+
530
+ actions check-dvips
531
+ {
532
+ dvips -version >$(<)
533
+ }
534
+
535
+ if [ os.name ] = "NT"
536
+ {
537
+ actions check-gs
538
+ {
539
+ gswin32c -version >$(<)
540
+ }
541
+ }
542
+ else
543
+ {
544
+ actions check-gs
545
+ {
546
+ gs -version >$(<)
547
+ }
548
+ }
549
+
550
+ rule check-tools ( )
551
+ {
552
+ if ! $(.check-tools-targets)
553
+ {
554
+ # Find the root project.
555
+ local root-project = [ project.current ] ;
556
+ root-project = [ $(root-project).project-module ] ;
557
+ while
558
+ [ project.attribute $(root-project) parent-module ] &&
559
+ [ project.attribute $(root-project) parent-module ] != user-config
560
+ {
561
+ root-project =
562
+ [ project.attribute $(root-project) parent-module ] ;
563
+ }
564
+
565
+ .latex.check = [ new file-target latex.check
566
+ :
567
+ : [ project.target $(root-project) ]
568
+ : [ new action : doxygen.check-latex ]
569
+ :
570
+ ] ;
571
+ .dvips.check = [ new file-target dvips.check
572
+ :
573
+ : [ project.target $(root-project) ]
574
+ : [ new action : doxygen.check-dvips ]
575
+ :
576
+ ] ;
577
+ .gs.check = [ new file-target gs.check
578
+ :
579
+ : [ project.target $(root-project) ]
580
+ : [ new action : doxygen.check-gs ]
581
+ :
582
+ ] ;
583
+ .check-tools-targets = $(.latex.check) $(.dvips.check) $(.gs.check) ;
584
+ }
585
+ return $(.check-tools-targets) ;
586
+ }
587
+
588
+ project.initialize $(__name__) ;
589
+ project doxygen ;
590
+
591
+ class doxygen-check-tools-target-class : basic-target
592
+ {
593
+ import doxygen ;
594
+ rule construct ( name : sources * : property-set )
595
+ {
596
+ return [ property-set.empty ] [ doxygen.check-tools ] ;
597
+ }
598
+ }
599
+
600
+ local project = [ project.current ] ;
601
+
602
+ targets.main-target-alternative
603
+ [ new doxygen-check-tools-target-class check-tools : $(project)
604
+ : [ targets.main-target-sources : check-tools : no-renaming ]
605
+ : [ targets.main-target-requirements : $(project) ]
606
+ : [ targets.main-target-default-build : $(project) ]
607
+ : [ targets.main-target-usage-requirements : $(project) ]
608
+ ] ;
609
+
610
+ # User-level rule to generate BoostBook XML from a set of headers via Doxygen.
611
+ #
612
+ rule doxygen ( target : sources * : requirements * : default-build * : usage-requirements * )
613
+ {
614
+ freeze-config ;
615
+ local project = [ project.current ] ;
616
+
617
+ if $(target:S) = .html
618
+ {
619
+ # Build an HTML directory from the sources.
620
+ local html-location = [ feature.get-values <location> : $(requirements) ] ;
621
+ local output-dir ;
622
+ if [ $(project).get build-dir ]
623
+ {
624
+ # Explicitly specified build dir. Add html at the end.
625
+ output-dir = [ path.join [ $(project).build-dir ] $(html-location:E=html) ] ;
626
+ }
627
+ else
628
+ {
629
+ # Trim 'bin' from implicit build dir, for no other reason that backward
630
+ # compatibility.
631
+ output-dir = [ path.join [ path.parent [ $(project).build-dir ] ]
632
+ $(html-location:E=html) ] ;
633
+ }
634
+ output-dir = [ path.root $(output-dir) [ path.pwd ] ] ;
635
+ local output-dir-native = [ path.native $(output-dir) ] ;
636
+ requirements = [ property.change $(requirements) : <location> ] ;
637
+
638
+ ## The doxygen configuration file.
639
+ targets.main-target-alternative
640
+ [ new typed-target $(target:S=.tag) : $(project) : DOXYFILE
641
+ : [ targets.main-target-sources $(sources) : $(target:S=.tag) ]
642
+ : [ targets.main-target-requirements $(requirements)
643
+ <doxygen:param>GENERATE_HTML=YES
644
+ <doxygen:param>GENERATE_XML=NO
645
+ <doxygen:param>"OUTPUT_DIRECTORY=\"$(output-dir-native)\""
646
+ <doxygen:param>HTML_OUTPUT=$(target:B)
647
+ : $(project) ]
648
+ : [ targets.main-target-default-build $(default-build) : $(project) ]
649
+ ] ;
650
+ $(project).mark-target-as-explicit $(target:S=.tag) ;
651
+
652
+ ## The html directory to generate by running doxygen.
653
+ targets.main-target-alternative
654
+ [ new typed-target $(target:S=.dir) : $(project) : DOXYGEN_HTML_MULTIFILE
655
+ : $(target:S=.tag)
656
+ : [ targets.main-target-requirements $(requirements)
657
+ <doxygen:param>"OUTPUT_DIRECTORY=\"$(output-dir-native)\""
658
+ <doxygen:param>HTML_OUTPUT=$(target:B)
659
+ : $(project) ]
660
+ : [ targets.main-target-default-build $(default-build) : $(project) ]
661
+ ] ;
662
+ $(project).mark-target-as-explicit $(target:S=.dir) ;
663
+
664
+ ## The redirect html file into the generated html.
665
+ targets.main-target-alternative
666
+ [ new typed-target $(target) : $(project) : DOXYGEN_HTML
667
+ : $(target:S=.dir)
668
+ : [ targets.main-target-requirements $(requirements)
669
+ <location>$(output-dir)
670
+ : $(project) ]
671
+ : [ targets.main-target-default-build $(default-build) : $(project) ]
672
+ ] ;
673
+ }
674
+ else
675
+ {
676
+ # Build a BoostBook XML file from the sources.
677
+ local location-xml = [ feature.get-values <location> : $(requirements) ] ;
678
+ requirements = [ property.change $(requirements) : <location> ] ;
679
+ local target-xml = $(target:B=$(target:B)-xml) ;
680
+
681
+ # Check whether we need to build images
682
+ local images-location =
683
+ [ feature.get-values <doxygen:xml-imagedir> : $(requirements) ] ;
684
+ if $(images-location)
685
+ {
686
+ doxygen $(target).doxygen-xml-images.html : $(sources)
687
+ : $(requirements)
688
+ <doxygen.rmdir>on
689
+ <doxygen:param>QUIET=YES
690
+ <doxygen:param>WARNINGS=NO
691
+ <doxygen:param>WARN_IF_UNDOCUMENTED=NO
692
+ <dependency>/doxygen//check-tools ;
693
+ $(project).mark-target-as-explicit
694
+ $(target).doxygen-xml-images.html ;
695
+
696
+ targets.main-target-alternative
697
+ [ new typed-target $(target).doxygen-xml-images
698
+ : $(project) : DOXYGEN_XML_IMAGES
699
+ : $(target).doxygen-xml-images.html
700
+ : [ targets.main-target-requirements $(requirements)
701
+ : $(project) ]
702
+ : [ targets.main-target-default-build $(default-build)
703
+ : $(project) ]
704
+ ] ;
705
+
706
+ $(project).mark-target-as-explicit
707
+ $(target).doxygen-xml-images ;
708
+
709
+ if ! [ regex.match "^(.*/)$" : $(images-location) ]
710
+ {
711
+ images-location = $(images-location)/ ;
712
+ }
713
+
714
+ requirements +=
715
+ <dependency>$(target).doxygen-xml-images
716
+ <xsl:param>boost.doxygen.formuladir=$(images-location) ;
717
+ }
718
+
719
+ ## The doxygen configuration file.
720
+ targets.main-target-alternative
721
+ [ new typed-target $(target-xml:S=.tag) : $(project) : DOXYFILE
722
+ : [ targets.main-target-sources $(sources) : $(target-xml:S=.tag) ]
723
+ : [ targets.main-target-requirements $(requirements)
724
+ <doxygen:param>GENERATE_HTML=NO
725
+ <doxygen:param>GENERATE_XML=YES
726
+ <doxygen:param>XML_OUTPUT=$(target-xml)
727
+ : $(project) ]
728
+ : [ targets.main-target-default-build $(default-build) : $(project) ]
729
+ ] ;
730
+ $(project).mark-target-as-explicit $(target-xml:S=.tag) ;
731
+
732
+ ## The Doxygen XML directory of the processed source files.
733
+ targets.main-target-alternative
734
+ [ new typed-target $(target-xml:S=.dir) : $(project) : DOXYGEN_XML_MULTIFILE
735
+ : $(target-xml:S=.tag)
736
+ : [ targets.main-target-requirements $(requirements)
737
+ : $(project) ]
738
+ : [ targets.main-target-default-build $(default-build) : $(project) ]
739
+ ] ;
740
+ $(project).mark-target-as-explicit $(target-xml:S=.dir) ;
741
+
742
+ ## The resulting BoostBook file is generated by the processor tool. The
743
+ ## tool can be either the xsltproc plus accompanying XSL scripts. Or it
744
+ ## can be the python doxproc.py script.
745
+ targets.main-target-alternative
746
+ [ new typed-target $(target-xml) : $(project) : BOOSTBOOK
747
+ : $(target-xml:S=.dir)
748
+ : [ targets.main-target-requirements $(requirements)
749
+ : $(project) ]
750
+ : [ targets.main-target-default-build $(default-build) : $(project) ]
751
+ ] ;
752
+ $(project).mark-target-as-explicit $(target-xml) ;
753
+
754
+ targets.main-target-alternative
755
+ [ new install-target-class $(target:S=.xml) : $(project)
756
+ : $(target-xml)
757
+ : [ targets.main-target-requirements $(requirements)
758
+ <location>$(location-xml:E=.)
759
+ <name>$(target:S=.xml)
760
+ : $(project) ]
761
+ : [ targets.main-target-default-build $(default-build) : $(project) ]
762
+ ] ;
763
+ $(project).mark-target-as-explicit $(target:S=.xml) ;
764
+
765
+ targets.main-target-alternative
766
+ [ new alias-target-class $(target) : $(project)
767
+ :
768
+ : [ targets.main-target-requirements $(requirements)
769
+ : $(project) ]
770
+ : [ targets.main-target-default-build $(default-build) : $(project) ]
771
+ : [ targets.main-target-usage-requirements $(usage-requirements)
772
+ <dependency>$(target:S=.xml)
773
+ : $(project) ]
774
+ ] ;
775
+ }
776
+ }
mosesdecoder/jam-files/boost-build/tools/doxygen/windows-paths-check.doxyfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ INPUT = windows-paths-check.hpp
2
+ GENERATE_HTML = NO
3
+ GENERATE_LATEX = NO
mosesdecoder/jam-files/boost-build/tools/doxygen/windows-paths-check.hpp ADDED
File without changes
mosesdecoder/jam-files/boost-build/tools/fop.jam ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2003-2004 Doug Gregor and Dave Abrahams. Distributed
2
+ # under the Boost Software License, Version 1.0. (See accompanying
3
+ # file LICENSE_1_0.txt or copy at
4
+ # http://www.boost.org/LICENSE_1_0.txt)
5
+ #
6
+ # This module defines rules to handle generation of PDF and
7
+ # PostScript files from XSL Formatting Objects via Apache FOP
8
+
9
+ import generators ;
10
+ import common ;
11
+ import boostbook ;
12
+
13
+ generators.register-standard fop.render.pdf : FO : PDF ;
14
+ generators.register-standard fop.render.ps : FO : PS ;
15
+
16
+ # Initializes the fop toolset.
17
+ #
18
+ rule init ( fop-command ? : java-home ? : java ? )
19
+ {
20
+ local has-command = $(.has-command) ;
21
+
22
+ if $(fop-command)
23
+ {
24
+ .has-command = true ;
25
+ }
26
+
27
+ if $(fop-command) || ! $(has-command)
28
+ {
29
+ fop-command = [ common.get-invocation-command fop : fop : $(fop-command)
30
+ : [ modules.peek : FOP_DIR ] ] ;
31
+ }
32
+
33
+ if $(fop-command)
34
+ {
35
+ .FOP_COMMAND = $(fop-command) ;
36
+ }
37
+
38
+ if $(java-home) || $(java)
39
+ {
40
+ .FOP_SETUP = ;
41
+
42
+
43
+ # JAVA_HOME is the location that java was installed to.
44
+
45
+ if $(java-home)
46
+ {
47
+ .FOP_SETUP += [ common.variable-setting-command JAVA_HOME : $(java-home) ] ;
48
+ }
49
+
50
+ # JAVACMD is the location that of the java executable, useful for a
51
+ # non-standard java installation, where the executable isn't at
52
+ # $JAVA_HOME/bin/java.
53
+
54
+ if $(java)
55
+ {
56
+ .FOP_SETUP += [ common.variable-setting-command JAVACMD : $(java) ] ;
57
+ }
58
+ }
59
+ }
60
+
61
+ actions render.pdf
62
+ {
63
+ $(.FOP_SETUP) $(.FOP_COMMAND:E=fop) $(>) $(<)
64
+ }
65
+
66
+ actions render.ps
67
+ {
68
+ $(.FOP_SETUP) $(.FOP_COMMAND:E=fop) $(>) -ps $(<)
69
+ }
mosesdecoder/jam-files/boost-build/tools/generate.jam ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2006 Vladimir Prus
2
+ # Distributed under the Boost Software License, Version 1.0.
3
+ # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
4
+
5
+ # Declares main target 'generate' used to produce targets by calling a
6
+ # user-provided rule that takes and produces virtual targets.
7
+
8
+ import "class" : new ;
9
+ import errors ;
10
+ import feature ;
11
+ import project ;
12
+ import property ;
13
+ import property-set ;
14
+ import targets ;
15
+ import regex ;
16
+
17
+
18
+ feature.feature generating-rule : : free ;
19
+
20
+
21
+ class generated-target-class : basic-target
22
+ {
23
+ import errors ;
24
+ import indirect ;
25
+ import virtual-target ;
26
+
27
+ rule __init__ ( name : project : sources * : requirements *
28
+ : default-build * : usage-requirements * )
29
+ {
30
+ basic-target.__init__ $(name) : $(project) : $(sources)
31
+ : $(requirements) : $(default-build) : $(usage-requirements) ;
32
+
33
+ if ! [ $(self.requirements).get <generating-rule> ]
34
+ {
35
+ errors.user-error "The generate rule requires the <generating-rule>"
36
+ "property to be set" ;
37
+ }
38
+ }
39
+
40
+ rule construct ( name : sources * : property-set )
41
+ {
42
+ local result ;
43
+ local gr = [ $(property-set).get <generating-rule> ] ;
44
+
45
+ # FIXME: this is a copy-paste from virtual-target.jam. We should add a
46
+ # utility rule to call a rule like this.
47
+ local rule-name = [ MATCH ^@(.*) : $(gr) ] ;
48
+ if $(rule-name)
49
+ {
50
+ if $(gr[2])
51
+ {
52
+ local target-name = [ full-name ] ;
53
+ errors.user-error "Multiple <generating-rule> properties"
54
+ "encountered for target $(target-name)." ;
55
+ }
56
+
57
+ result = [ indirect.call $(rule-name) $(self.project) $(name)
58
+ : $(property-set) : $(sources) ] ;
59
+
60
+ if ! $(result)
61
+ {
62
+ ECHO "warning: Unable to construct" [ full-name ] ;
63
+ }
64
+ }
65
+
66
+ local ur ;
67
+ local targets ;
68
+
69
+ if $(result)
70
+ {
71
+ if [ class.is-a $(result[1]) : property-set ]
72
+ {
73
+ ur = $(result[1]) ;
74
+ targets = $(result[2-]) ;
75
+ }
76
+ else
77
+ {
78
+ ur = [ property-set.empty ] ;
79
+ targets = $(result) ;
80
+ }
81
+ }
82
+ # FIXME: the following loop should be doable using sequence.transform or
83
+ # some similar utility rule.
84
+ local rt ;
85
+ for local t in $(targets)
86
+ {
87
+ rt += [ virtual-target.register $(t) ] ;
88
+ }
89
+ return $(ur) $(rt) ;
90
+ }
91
+ }
92
+
93
+
94
+ rule generate ( name : sources * : requirements * : default-build *
95
+ : usage-requirements * )
96
+ {
97
+ local project = [ project.current ] ;
98
+
99
+ targets.main-target-alternative
100
+ [ new generated-target-class $(name) : $(project)
101
+ : [ targets.main-target-sources $(sources) : $(name) ]
102
+ : [ targets.main-target-requirements $(requirements) : $(project) ]
103
+ : [ targets.main-target-default-build $(default-build) : $(project) ]
104
+ : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ]
105
+ ] ;
106
+ }
107
+
108
+ IMPORT $(__name__) : generate : : generate ;
mosesdecoder/jam-files/boost-build/tools/hp_cxx.jam ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2001 David Abrahams.
2
+ # Copyright 2004, 2005 Markus Schoepflin.
3
+ # Distributed under the Boost Software License, Version 1.0.
4
+ # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
5
+
6
+ #
7
+ # HP CXX compiler
8
+ # See http://h30097.www3.hp.com/cplus/?jumpid=reg_R1002_USEN
9
+ #
10
+ #
11
+ # Notes on this toolset:
12
+ #
13
+ # - Because of very subtle issues with the default ansi mode, strict_ansi mode
14
+ # is used for compilation. One example of things that don't work correctly in
15
+ # the default ansi mode is overload resolution of function templates when
16
+ # mixed with non-template functions.
17
+ #
18
+ # - For template instantiation "-timplicit_local" is used. Previously,
19
+ # "-tlocal" has been tried to avoid the need for a template repository
20
+ # but this doesn't work with manually instantiated templates. "-tweak"
21
+ # has not been used to avoid the stream of warning messages issued by
22
+ # ar or ld when creating a library or linking an application.
23
+ #
24
+ # - Debug symbols are generated with "-g3", as this works both in debug and
25
+ # release mode. When compiling C++ code without optimization, we additionally
26
+ # use "-gall", which generates full symbol table information for all classes,
27
+ # structs, and unions. As this turns off optimization, it can't be used when
28
+ # optimization is needed.
29
+ #
30
+
31
+ import feature generators common ;
32
+ import toolset : flags ;
33
+
34
+ feature.extend toolset : hp_cxx ;
35
+ feature.extend c++abi : cxxarm ;
36
+
37
+ # Inherit from Unix toolset to get library ordering magic.
38
+ toolset.inherit hp_cxx : unix ;
39
+
40
+ generators.override hp_cxx.prebuilt : builtin.lib-generator ;
41
+ generators.override hp_cxx.prebuilt : builtin.prebuilt ;
42
+ generators.override hp_cxx.searched-lib-generator : searched-lib-generator ;
43
+
44
+
45
+ rule init ( version ? : command * : options * )
46
+ {
47
+ local condition = [ common.check-init-parameters hp_cxx : version $(version) ] ;
48
+
49
+ local command = [ common.get-invocation-command hp_cxx : cxx : $(command) ] ;
50
+
51
+ if $(command)
52
+ {
53
+ local root = [ common.get-absolute-tool-path $(command[-1]) ] ;
54
+
55
+ if $(root)
56
+ {
57
+ flags hp_cxx .root $(condition) : "\"$(root)\"/" ;
58
+ }
59
+ }
60
+ # If we can't find 'cxx' anyway, at least show 'cxx' in the commands
61
+ command ?= cxx ;
62
+
63
+ common.handle-options hp_cxx : $(condition) : $(command) : $(options) ;
64
+ }
65
+
66
+ generators.register-c-compiler hp_cxx.compile.c++ : CPP : OBJ : <toolset>hp_cxx ;
67
+ generators.register-c-compiler hp_cxx.compile.c : C : OBJ : <toolset>hp_cxx ;
68
+
69
+
70
+
71
+ # No static linking as far as I can tell.
72
+ # flags cxx LINKFLAGS <runtime-link>static : -bstatic ;
73
+ flags hp_cxx.compile OPTIONS <debug-symbols>on : -g3 ;
74
+ flags hp_cxx.compile OPTIONS <optimization>off/<debug-symbols>on : -gall ;
75
+ flags hp_cxx.link OPTIONS <debug-symbols>on : -g ;
76
+ flags hp_cxx.link OPTIONS <debug-symbols>off : -s ;
77
+
78
+ flags hp_cxx.compile OPTIONS <optimization>off : -O0 ;
79
+ flags hp_cxx.compile OPTIONS <optimization>speed/<inlining>on : -O2 ;
80
+ flags hp_cxx.compile OPTIONS <optimization>speed : -O2 ;
81
+
82
+ # This (undocumented) macro needs to be defined to get all C function
83
+ # overloads required by the C++ standard.
84
+ flags hp_cxx.compile.c++ OPTIONS : -D__CNAME_OVERLOADS ;
85
+
86
+ # Added for threading support
87
+ flags hp_cxx.compile OPTIONS <threading>multi : -pthread ;
88
+ flags hp_cxx.link OPTIONS <threading>multi : -pthread ;
89
+
90
+ flags hp_cxx.compile OPTIONS <optimization>space/<inlining>on : <inlining>size ;
91
+ flags hp_cxx.compile OPTIONS <optimization>space : -O1 ;
92
+ flags hp_cxx.compile OPTIONS <inlining>off : -inline none ;
93
+
94
+ # The compiler versions tried (up to V6.5-040) hang when compiling Boost code
95
+ # with full inlining enabled. So leave it at the default level for now.
96
+ #
97
+ # flags hp_cxx.compile OPTIONS <inlining>full : -inline all ;
98
+
99
+ flags hp_cxx.compile OPTIONS <profiling>on : -pg ;
100
+ flags hp_cxx.link OPTIONS <profiling>on : -pg ;
101
+
102
+ # Selection of the object model. This flag is needed on both the C++ compiler
103
+ # and linker command line.
104
+
105
+ # Unspecified ABI translates to '-model ansi' as most
106
+ # standard-conforming.
107
+ flags hp_cxx.compile.c++ OPTIONS <c++abi> : -model ansi : : hack-hack ;
108
+ flags hp_cxx.compile.c++ OPTIONS <c++abi>cxxarm : -model arm ;
109
+ flags hp_cxx.link OPTIONS <c++abi> : -model ansi : : hack-hack ;
110
+ flags hp_cxx.link OPTIONS <c++abi>cxxarm : -model arm ;
111
+
112
+ # Display a descriptive tag together with each compiler message. This tag can
113
+ # be used by the user to explicitely suppress the compiler message.
114
+ flags hp_cxx.compile OPTIONS : -msg_display_tag ;
115
+
116
+ flags hp_cxx.compile OPTIONS <cflags> ;
117
+ flags hp_cxx.compile.c++ OPTIONS <cxxflags> ;
118
+ flags hp_cxx.compile DEFINES <define> ;
119
+ flags hp_cxx.compile INCLUDES <include> ;
120
+ flags hp_cxx.link OPTIONS <linkflags> ;
121
+
122
+ flags hp_cxx.link LIBPATH <library-path> ;
123
+ flags hp_cxx.link LIBRARIES <library-file> ;
124
+ flags hp_cxx.link FINDLIBS-ST <find-static-library> ;
125
+ flags hp_cxx.link FINDLIBS-SA <find-shared-library> ;
126
+
127
+ flags hp_cxx.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ;
128
+
129
+ actions link bind LIBRARIES
130
+ {
131
+ $(CONFIG_COMMAND) -noimplicit_include $(OPTIONS) -o "$(<)" -L$(LIBPATH) "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) -lrt -lm
132
+ }
133
+
134
+ # When creating dynamic libraries, we don't want to be warned about unresolved
135
+ # symbols, therefore all unresolved symbols are marked as expected by
136
+ # '-expect_unresolved *'. This also mirrors the behaviour of the GNU tool
137
+ # chain.
138
+
139
+ actions link.dll bind LIBRARIES
140
+ {
141
+ $(CONFIG_COMMAND) -shared -expect_unresolved \* -noimplicit_include $(OPTIONS) -o "$(<[1])" -L$(LIBPATH) "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) -lm
142
+ }
143
+
144
+
145
+ # Note: Relaxed ANSI mode (-std) is used for compilation because in strict ANSI
146
+ # C89 mode (-std1) the compiler doesn't accept C++ comments in C files. As -std
147
+ # is the default, no special flag is needed.
148
+ actions compile.c
149
+ {
150
+ $(.root:E=)cc -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
151
+ }
152
+
153
+ # Note: The compiler is forced to compile the files as C++ (-x cxx) because
154
+ # otherwise it will silently ignore files with no file extension.
155
+ #
156
+ # Note: We deliberately don't suppress any warnings on the compiler command
157
+ # line, the user can always do this in a customized toolset later on.
158
+
159
+ rule compile.c++
160
+ {
161
+ # We preprocess the TEMPLATE_DEPTH command line option here because we found
162
+ # no way to do it correctly in the actual action code. There we either get
163
+ # the -pending_instantiations parameter when no c++-template-depth property
164
+ # has been specified or we get additional quotes around
165
+ # "-pending_instantiations ".
166
+ local template-depth = [ on $(1) return $(TEMPLATE_DEPTH) ] ;
167
+ TEMPLATE_DEPTH on $(1) = "-pending_instantiations "$(template-depth) ;
168
+ }
169
+
170
+ actions compile.c++
171
+ {
172
+ $(CONFIG_COMMAND) -x cxx -c -std strict_ansi -nopure_cname -noimplicit_include -timplicit_local -ptr "$(<[1]:D)/cxx_repository" $(OPTIONS) $(TEMPLATE_DEPTH) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
173
+ }
174
+
175
+ # Always create archive from scratch. See the gcc toolet for rationale.
176
+ RM = [ common.rm-command ] ;
177
+ actions together piecemeal archive
178
+ {
179
+ $(RM) "$(<)"
180
+ ar rc $(<) $(>)
181
+ }
mosesdecoder/jam-files/boost-build/tools/make.jam ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2003 Dave Abrahams
2
+ # Copyright 2003 Douglas Gregor
3
+ # Copyright 2006 Rene Rivera
4
+ # Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus
5
+ # Distributed under the Boost Software License, Version 1.0.
6
+ # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
7
+
8
+ # This module defines the 'make' main target rule.
9
+
10
+ import "class" : new ;
11
+ import errors : error ;
12
+ import project ;
13
+ import property ;
14
+ import property-set ;
15
+ import regex ;
16
+ import targets ;
17
+
18
+
19
+ class make-target-class : basic-target
20
+ {
21
+ import type regex virtual-target ;
22
+ import "class" : new ;
23
+
24
+ rule __init__ ( name : project : sources * : requirements *
25
+ : default-build * : usage-requirements * )
26
+ {
27
+ basic-target.__init__ $(name) : $(project) : $(sources) :
28
+ $(requirements) : $(default-build) : $(usage-requirements) ;
29
+ }
30
+
31
+ rule construct ( name : source-targets * : property-set )
32
+ {
33
+ local action-name = [ $(property-set).get <action> ] ;
34
+ # 'm' will always be set -- we add '@' ourselves in the 'make' rule
35
+ # below.
36
+ local m = [ MATCH ^@(.*) : $(action-name) ] ;
37
+
38
+ local a = [ new action $(source-targets) : $(m[1]) : $(property-set) ] ;
39
+ local t = [ new file-target $(self.name) exact : [ type.type
40
+ $(self.name) ] : $(self.project) : $(a) ] ;
41
+ return [ property-set.empty ] [ virtual-target.register $(t) ] ;
42
+ }
43
+ }
44
+
45
+
46
+ # Declares the 'make' main target.
47
+ #
48
+ rule make ( target-name : sources * : generating-rule + : requirements * :
49
+ usage-requirements * )
50
+ {
51
+ local project = [ project.current ] ;
52
+
53
+ # The '@' sign causes the feature.jam module to qualify rule name with the
54
+ # module name of current project, if needed.
55
+ local m = [ MATCH ^(@).* : $(generating-rule) ] ;
56
+ if ! $(m)
57
+ {
58
+ generating-rule = @$(generating-rule) ;
59
+ }
60
+ requirements += <action>$(generating-rule) ;
61
+
62
+ targets.main-target-alternative
63
+ [ new make-target-class $(target-name) : $(project)
64
+ : [ targets.main-target-sources $(sources) : $(target-name) ]
65
+ : [ targets.main-target-requirements $(requirements) : $(project) ]
66
+ : [ targets.main-target-default-build : $(project) ]
67
+ : [ targets.main-target-usage-requirements $(usage-requirements) :
68
+ $(project) ] ] ;
69
+ }
70
+
71
+
72
+ IMPORT $(__name__) : make : : make ;
mosesdecoder/jam-files/boost-build/tools/mc.jam ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #~ Copyright 2005 Alexey Pakhunov.
2
+ #~ Distributed under the Boost Software License, Version 1.0.
3
+ #~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
4
+
5
+ # Support for Microsoft message compiler tool.
6
+ # Notes:
7
+ # - there's just message compiler tool, there's no tool for
8
+ # extracting message strings from sources
9
+ # - This file allows to use Microsoft message compiler
10
+ # with any toolset. In msvc.jam, there's more specific
11
+ # message compiling action.
12
+
13
+ import common ;
14
+ import generators ;
15
+ import feature : feature get-values ;
16
+ import toolset : flags ;
17
+ import type ;
18
+ import rc ;
19
+
20
+ rule init ( )
21
+ {
22
+ }
23
+
24
+ type.register MC : mc ;
25
+
26
+
27
+ # Command line options
28
+ feature mc-input-encoding : ansi unicode : free ;
29
+ feature mc-output-encoding : unicode ansi : free ;
30
+ feature mc-set-customer-bit : no yes : free ;
31
+
32
+ flags mc.compile MCFLAGS <mc-input-encoding>ansi : -a ;
33
+ flags mc.compile MCFLAGS <mc-input-encoding>unicode : -u ;
34
+ flags mc.compile MCFLAGS <mc-output-encoding>ansi : -A ;
35
+ flags mc.compile MCFLAGS <mc-output-encoding>unicode : -U ;
36
+ flags mc.compile MCFLAGS <mc-set-customer-bit>no : ;
37
+ flags mc.compile MCFLAGS <mc-set-customer-bit>yes : -c ;
38
+
39
+ generators.register-standard mc.compile : MC : H RC ;
40
+
41
+ actions compile
42
+ {
43
+ mc $(MCFLAGS) -h "$(<[1]:DW)" -r "$(<[2]:DW)" "$(>:W)"
44
+ }
mosesdecoder/jam-files/boost-build/tools/msvc-config.jam ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #~ Copyright 2005 Rene Rivera.
2
+ #~ Distributed under the Boost Software License, Version 1.0.
3
+ #~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
4
+
5
+ # Automatic configuration for VisualStudio toolset. To use, just import this module.
6
+
7
+ import toolset : using ;
8
+
9
+ ECHO "warning: msvc-config.jam is deprecated. Use 'using msvc : all ;' instead." ;
10
+
11
+ using msvc : all ;
12
+
mosesdecoder/jam-files/boost-build/tools/python.jam ADDED
@@ -0,0 +1,1267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2004 Vladimir Prus.
2
+ # Distributed under the Boost Software License, Version 1.0. (See
3
+ # accompanying file LICENSE_1_0.txt or copy at
4
+ # http://www.boost.org/LICENSE_1_0.txt)
5
+
6
+ # Support for Python and the the Boost.Python library.
7
+ #
8
+ # This module defines
9
+ #
10
+ # - a project 'python' with a target 'python' in it, that corresponds to the
11
+ # python library
12
+ #
13
+ # - a main target rule 'python-extension' which can be used to build a python
14
+ # extension.
15
+ #
16
+ # Extensions that use Boost.Python must explicitly link to it.
17
+
18
+ import type ;
19
+ import testing ;
20
+ import generators ;
21
+ import project ;
22
+ import errors ;
23
+ import targets ;
24
+ import "class" : new ;
25
+ import os ;
26
+ import common ;
27
+ import toolset ;
28
+ import regex ;
29
+ import numbers ;
30
+ import string ;
31
+ import property ;
32
+ import sequence ;
33
+ import path ;
34
+ import feature ;
35
+ import set ;
36
+ import builtin ;
37
+ import version ;
38
+
39
+
40
+ # Make this module a project.
41
+ project.initialize $(__name__) ;
42
+ project python ;
43
+
44
+ # Save the project so that if 'init' is called several times we define new
45
+ # targets in the python project, not in whatever project we were called by.
46
+ .project = [ project.current ] ;
47
+
48
+ # Dynamic linker lib. Necessary to specify it explicitly on some platforms.
49
+ lib dl ;
50
+ # This contains 'openpty' function need by python. Again, on some system need to
51
+ # pass this to linker explicitly.
52
+ lib util ;
53
+ # Python uses pthread symbols.
54
+ lib pthread ;
55
+ # Extra library needed by phtread on some platforms.
56
+ lib rt ;
57
+
58
+ # The pythonpath feature specifies additional elements for the PYTHONPATH
59
+ # environment variable, set by run-pyd. For example, pythonpath can be used to
60
+ # access Python modules that are part of the product being built, but are not
61
+ # installed in the development system's default paths.
62
+ feature.feature pythonpath : : free optional path ;
63
+
64
+ # Initializes the Python toolset. Note that all parameters are optional.
65
+ #
66
+ # - version -- the version of Python to use. Should be in Major.Minor format,
67
+ # for example 2.3. Do not include the subminor version.
68
+ #
69
+ # - cmd-or-prefix: Preferably, a command that invokes a Python interpreter.
70
+ # Alternatively, the installation prefix for Python libraries and includes. If
71
+ # empty, will be guessed from the version, the platform's installation
72
+ # patterns, and the python executables that can be found in PATH.
73
+ #
74
+ # - includes: the include path to Python headers. If empty, will be guessed.
75
+ #
76
+ # - libraries: the path to Python library binaries. If empty, will be guessed.
77
+ # On MacOS/Darwin, you can also pass the path of the Python framework.
78
+ #
79
+ # - condition: if specified, should be a set of properties that are matched
80
+ # against the build configuration when Boost.Build selects a Python
81
+ # configuration to use.
82
+ #
83
+ # - extension-suffix: A string to append to the name of extension modules before
84
+ # the true filename extension. Ordinarily we would just compute this based on
85
+ # the value of the <python-debugging> feature. However ubuntu's python-dbg
86
+ # package uses the windows convention of appending _d to debug-build extension
87
+ # modules. We have no way of detecting ubuntu, or of probing python for the
88
+ # "_d" requirement, and if you configure and build python using
89
+ # --with-pydebug, you'll be using the standard *nix convention. Defaults to ""
90
+ # (or "_d" when targeting windows and <python-debugging> is set).
91
+ #
92
+ # Example usage:
93
+ #
94
+ # using python : 2.3 ;
95
+ # using python : 2.3 : /usr/local/bin/python ;
96
+ #
97
+ rule init ( version ? : cmd-or-prefix ? : includes * : libraries ?
98
+ : condition * : extension-suffix ? )
99
+ {
100
+ project.push-current $(.project) ;
101
+
102
+ debug-message Configuring python... ;
103
+ for local v in version cmd-or-prefix includes libraries condition
104
+ {
105
+ if $($(v))
106
+ {
107
+ debug-message " user-specified "$(v): \"$($(v))\" ;
108
+ }
109
+ }
110
+
111
+ configure $(version) : $(cmd-or-prefix) : $(includes) : $(libraries) : $(condition) : $(extension-suffix) ;
112
+
113
+ project.pop-current ;
114
+ }
115
+
116
+ # A simpler version of SHELL that grabs stderr as well as stdout, but returns
117
+ # nothing if there was an error.
118
+ #
119
+ local rule shell-cmd ( cmd )
120
+ {
121
+ debug-message running command '$(cmd)" 2>&1"' ;
122
+ x = [ SHELL $(cmd)" 2>&1" : exit-status ] ;
123
+ if $(x[2]) = 0
124
+ {
125
+ return $(x[1]) ;
126
+ }
127
+ else
128
+ {
129
+ return ;
130
+ }
131
+ }
132
+
133
+
134
+ # Try to identify Cygwin symlinks. Invoking such a file directly as an NT
135
+ # executable from a native Windows build of bjam would be fatal to the bjam
136
+ # process. One /can/ invoke them through sh.exe or bash.exe, if you can prove
137
+ # that those are not also symlinks. ;-)
138
+ #
139
+ # If a symlink is found returns non-empty; we try to extract the target of the
140
+ # symlink from the file and return that.
141
+ #
142
+ # Note: 1. only works on NT 2. path is a native path.
143
+ local rule is-cygwin-symlink ( path )
144
+ {
145
+ local is-symlink = ;
146
+
147
+ # Look for a file with the given path having the S attribute set, as cygwin
148
+ # symlinks do. /-C means "do not use thousands separators in file sizes."
149
+ local dir-listing = [ shell-cmd "DIR /-C /A:S \""$(path)"\"" ] ;
150
+
151
+ if $(dir-listing)
152
+ {
153
+ # Escape any special regex characters in the base part of the path.
154
+ local base-pat = [ regex.escape $(path:D=) : ].[()*+?|\\$^ : \\ ] ;
155
+
156
+ # Extract the file's size from the directory listing.
157
+ local size-of-system-file = [ MATCH "([0-9]+) "$(base-pat) : $(dir-listing) : 1 ] ;
158
+
159
+ # If the file has a reasonably small size, look for the special symlink
160
+ # identification text.
161
+ if $(size-of-system-file) && [ numbers.less $(size-of-system-file) 1000 ]
162
+ {
163
+ local link = [ SHELL "FIND /OFF \"!<symlink>\" \""$(path)"\" 2>&1" ] ;
164
+ if $(link[2]) != 0
165
+ {
166
+ local nl = "
167
+
168
+ " ;
169
+ is-symlink = [ MATCH ".*!<symlink>([^"$(nl)"]*)" : $(link[1]) : 1 ] ;
170
+ if $(is-symlink)
171
+ {
172
+ is-symlink = [ *nix-path-to-native $(is-symlink) ] ;
173
+ is-symlink = $(is-symlink:R=$(path:D)) ;
174
+ }
175
+
176
+ }
177
+ }
178
+ }
179
+ return $(is-symlink) ;
180
+ }
181
+
182
+
183
+ # Append ext to each member of names that does not contain '.'.
184
+ #
185
+ local rule default-extension ( names * : ext * )
186
+ {
187
+ local result ;
188
+ for local n in $(names)
189
+ {
190
+ switch $(n)
191
+ {
192
+ case *.* : result += $(n) ;
193
+ case * : result += $(n)$(ext) ;
194
+ }
195
+ }
196
+ return $(result) ;
197
+ }
198
+
199
+
200
+ # Tries to determine whether invoking "cmd" would actually attempt to launch a
201
+ # cygwin symlink.
202
+ #
203
+ # Note: only works on NT.
204
+ #
205
+ local rule invokes-cygwin-symlink ( cmd )
206
+ {
207
+ local dirs = $(cmd:D) ;
208
+ if ! $(dirs)
209
+ {
210
+ dirs = . [ os.executable-path ] ;
211
+ }
212
+ local base = [ default-extension $(cmd:D=) : .exe .cmd .bat ] ;
213
+ local paths = [ GLOB $(dirs) : $(base) ] ;
214
+ if $(paths)
215
+ {
216
+ # Make sure we have not run into a Cygwin symlink. Invoking such a file
217
+ # as an NT executable would be fatal for the bjam process.
218
+ return [ is-cygwin-symlink $(paths[1]) ] ;
219
+ }
220
+ }
221
+
222
+
223
+ local rule debug-message ( message * )
224
+ {
225
+ if --debug-configuration in [ modules.peek : ARGV ]
226
+ {
227
+ ECHO notice: [python-cfg] $(message) ;
228
+ }
229
+ }
230
+
231
+
232
+ # Like W32_GETREG, except prepend HKEY_CURRENT_USER\SOFTWARE and
233
+ # HKEY_LOCAL_MACHINE\SOFTWARE to the first argument, returning the first result
234
+ # found. Also accounts for the fact that on 64-bit machines, 32-bit software has
235
+ # its own area, under SOFTWARE\Wow6432node.
236
+ #
237
+ local rule software-registry-value ( path : data ? )
238
+ {
239
+ local result ;
240
+ for local root in HKEY_CURRENT_USER HKEY_LOCAL_MACHINE
241
+ {
242
+ for local x64elt in "" Wow6432node\\ # Account for 64-bit windows
243
+ {
244
+ if ! $(result)
245
+ {
246
+ result = [ W32_GETREG $(root)\\SOFTWARE\\$(x64elt)$(path) : $(data) ] ;
247
+ }
248
+ }
249
+
250
+ }
251
+ return $(result) ;
252
+ }
253
+
254
+
255
+ .windows-drive-letter-re = ^([A-Za-z]):[\\/](.*) ;
256
+ .cygwin-drive-letter-re = ^/cygdrive/([a-z])/(.*) ;
257
+
258
+ .working-directory = [ PWD ] ;
259
+ .working-drive-letter = [ SUBST $(.working-directory) $(.windows-drive-letter-re) $1 ] ;
260
+ .working-drive-letter ?= [ SUBST $(.working-directory) $(.cygwin-drive-letter-re) $1 ] ;
261
+
262
+
263
+ local rule windows-to-cygwin-path ( path )
264
+ {
265
+ # If path is rooted with a drive letter, rewrite it using the /cygdrive
266
+ # mountpoint.
267
+ local p = [ SUBST $(path:T) $(.windows-drive-letter-re) /cygdrive/$1/$2 ] ;
268
+
269
+ # Else if path is rooted without a drive letter, use the working directory.
270
+ p ?= [ SUBST $(path:T) ^/(.*) /cygdrive/$(.working-drive-letter:L)/$2 ] ;
271
+
272
+ # Else return the path unchanged.
273
+ return $(p:E=$(path:T)) ;
274
+ }
275
+
276
+
277
+ # :W only works in Cygwin builds of bjam. This one works on NT builds as well.
278
+ #
279
+ local rule cygwin-to-windows-path ( path )
280
+ {
281
+ path = $(path:R="") ; # strip any trailing slash
282
+
283
+ local drive-letter = [ SUBST $(path) $(.cygwin-drive-letter-re) $1:/$2 ] ;
284
+ if $(drive-letter)
285
+ {
286
+ path = $(drive-letter) ;
287
+ }
288
+ else if $(path:R=/x) = $(path) # already rooted?
289
+ {
290
+ # Look for a cygwin mount that includes each head sequence in $(path).
291
+ local head = $(path) ;
292
+ local tail = "" ;
293
+
294
+ while $(head)
295
+ {
296
+ local root = [ software-registry-value
297
+ "Cygnus Solutions\\Cygwin\\mounts v2\\"$(head) : native ] ;
298
+
299
+ if $(root)
300
+ {
301
+ path = $(tail:R=$(root)) ;
302
+ head = ;
303
+ }
304
+ tail = $(tail:R=$(head:D=)) ;
305
+
306
+ if $(head) = /
307
+ {
308
+ head = ;
309
+ }
310
+ else
311
+ {
312
+ head = $(head:D) ;
313
+ }
314
+ }
315
+ }
316
+ return [ regex.replace $(path:R="") / \\ ] ;
317
+ }
318
+
319
+
320
+ # Convert a *nix path to native.
321
+ #
322
+ local rule *nix-path-to-native ( path )
323
+ {
324
+ if [ os.name ] = NT
325
+ {
326
+ path = [ cygwin-to-windows-path $(path) ] ;
327
+ }
328
+ return $(path) ;
329
+ }
330
+
331
+
332
+ # Convert an NT path to native.
333
+ #
334
+ local rule windows-path-to-native ( path )
335
+ {
336
+ if [ os.name ] = NT
337
+ {
338
+ return $(path) ;
339
+ }
340
+ else
341
+ {
342
+ return [ windows-to-cygwin-path $(path) ] ;
343
+ }
344
+ }
345
+
346
+
347
+ # Return nonempty if path looks like a windows path, i.e. it starts with a drive
348
+ # letter or contains backslashes.
349
+ #
350
+ local rule guess-windows-path ( path )
351
+ {
352
+ return [ SUBST $(path) ($(.windows-drive-letter-re)|.*([\\]).*) $1 ] ;
353
+ }
354
+
355
+
356
+ local rule path-to-native ( paths * )
357
+ {
358
+ local result ;
359
+
360
+ for local p in $(paths)
361
+ {
362
+ if [ guess-windows-path $(p) ]
363
+ {
364
+ result += [ windows-path-to-native $(p) ] ;
365
+ }
366
+ else
367
+ {
368
+ result += [ *nix-path-to-native $(p:T) ] ;
369
+ }
370
+ }
371
+ return $(result) ;
372
+ }
373
+
374
+
375
+ # Validate the version string and extract the major/minor part we care about.
376
+ #
377
+ local rule split-version ( version )
378
+ {
379
+ local major-minor = [ MATCH ^([0-9]+)\.([0-9]+)(.*)$ : $(version) : 1 2 3 ] ;
380
+ if ! $(major-minor[2]) || $(major-minor[3])
381
+ {
382
+ ECHO "Warning: \"using python\" expects a two part (major, minor) version number; got" $(version) instead ;
383
+
384
+ # Add a zero to account for the missing digit if necessary.
385
+ major-minor += 0 ;
386
+ }
387
+
388
+ return $(major-minor[1]) $(major-minor[2]) ;
389
+ }
390
+
391
+
392
+ # Build a list of versions from 3.0 down to 1.5. Because bjam can not enumerate
393
+ # registry sub-keys, we have no way of finding a version with a 2-digit minor
394
+ # version, e.g. 2.10 -- let us hope that never happens.
395
+ #
396
+ .version-countdown = ;
397
+ for local v in [ numbers.range 15 30 ]
398
+ {
399
+ .version-countdown = [ SUBST $(v) (.)(.*) $1.$2 ] $(.version-countdown) ;
400
+ }
401
+
402
+
403
+ local rule windows-installed-pythons ( version ? )
404
+ {
405
+ version ?= $(.version-countdown) ;
406
+ local interpreters ;
407
+
408
+ for local v in $(version)
409
+ {
410
+ local install-path = [
411
+ software-registry-value "Python\\PythonCore\\"$(v)"\\InstallPath" ] ;
412
+
413
+ if $(install-path)
414
+ {
415
+ install-path = [ windows-path-to-native $(install-path) ] ;
416
+ debug-message Registry indicates Python $(v) installed at \"$(install-path)\" ;
417
+ }
418
+
419
+ interpreters += $(:E=python:R=$(install-path)) ;
420
+ }
421
+ return $(interpreters) ;
422
+ }
423
+
424
+
425
+ local rule darwin-installed-pythons ( version ? )
426
+ {
427
+ version ?= $(.version-countdown) ;
428
+
429
+ local prefix
430
+ = [ GLOB /System/Library/Frameworks /Library/Frameworks
431
+ : Python.framework ] ;
432
+
433
+ return $(prefix)/Versions/$(version)/bin/python ;
434
+ }
435
+
436
+
437
+ # Assume "python-cmd" invokes a python interpreter and invoke it to extract all
438
+ # the information we care about from its "sys" module. Returns void if
439
+ # unsuccessful.
440
+ #
441
+ local rule probe ( python-cmd )
442
+ {
443
+ # Avoid invoking a Cygwin symlink on NT.
444
+ local skip-symlink ;
445
+ if [ os.name ] = NT
446
+ {
447
+ skip-symlink = [ invokes-cygwin-symlink $(python-cmd) ] ;
448
+ }
449
+
450
+ if $(skip-symlink)
451
+ {
452
+ debug-message -------------------------------------------------------------------- ;
453
+ debug-message \"$(python-cmd)\" would attempt to invoke a Cygwin symlink, ;
454
+ debug-message causing a bjam built for Windows to hang. ;
455
+ debug-message ;
456
+ debug-message If you intend to target a Cygwin build of Python, please ;
457
+ debug-message replace the path to the link with the path to a real executable ;
458
+ debug-message (guessing: \"$(skip-symlink)\") "in" your 'using python' line ;
459
+ debug-message "in" user-config.jam or site-config.jam. Do not forget to escape ;
460
+ debug-message backslashes ;
461
+ debug-message -------------------------------------------------------------------- ;
462
+ }
463
+ else
464
+ {
465
+ # Prepare a List of Python format strings and expressions that can be
466
+ # used to print the constants we want from the sys module.
467
+
468
+ # We do not really want sys.version since that is a complicated string,
469
+ # so get the information from sys.version_info instead.
470
+ local format = "version=%d.%d" ;
471
+ local exprs = "version_info[0]" "version_info[1]" ;
472
+
473
+ for local s in $(sys-elements[2-])
474
+ {
475
+ format += $(s)=%s ;
476
+ exprs += $(s) ;
477
+ }
478
+
479
+ # Invoke Python and ask it for all those values.
480
+ if [ version.check-jam-version 3 1 17 ] || ( [ os.name ] != NT )
481
+ {
482
+ # Prior to version 3.1.17 Boost Jam's SHELL command did not support
483
+ # quoted commands correctly on Windows. This means that on that
484
+ # platform we do not support using a Python command interpreter
485
+ # executable whose path contains a space character.
486
+ python-cmd = \"$(python-cmd)\" ;
487
+ }
488
+ local full-cmd =
489
+ $(python-cmd)" -c \"from sys import *; print('"$(format:J=\\n)"' % ("$(exprs:J=,)"))\"" ;
490
+
491
+ local output = [ shell-cmd $(full-cmd) ] ;
492
+ if $(output)
493
+ {
494
+ # Parse the output to get all the results.
495
+ local nl = "
496
+
497
+ " ;
498
+ for s in $(sys-elements)
499
+ {
500
+ # These variables are expected to be declared local in the
501
+ # caller, so Jam's dynamic scoping will set their values there.
502
+ sys.$(s) = [ SUBST $(output) \\<$(s)=([^$(nl)]+) $1 ] ;
503
+ }
504
+ }
505
+ return $(output) ;
506
+ }
507
+ }
508
+
509
+
510
+ # Make sure the "libraries" and "includes" variables (in an enclosing scope)
511
+ # have a value based on the information given.
512
+ #
513
+ local rule compute-default-paths ( target-os : version ? : prefix ? :
514
+ exec-prefix ? )
515
+ {
516
+ exec-prefix ?= $(prefix) ;
517
+
518
+ if $(target-os) = windows
519
+ {
520
+ # The exec_prefix is where you're supposed to look for machine-specific
521
+ # libraries.
522
+ local default-library-path = $(exec-prefix)\\libs ;
523
+ local default-include-path = $(:E=Include:R=$(prefix)) ;
524
+
525
+ # If the interpreter was found in a directory called "PCBuild" or
526
+ # "PCBuild8," assume we're looking at a Python built from the source
527
+ # distro, and go up one additional level to the default root. Otherwise,
528
+ # the default root is the directory where the interpreter was found.
529
+
530
+ # We ask Python itself what the executable path is in case of
531
+ # intermediate symlinks or shell scripts.
532
+ local executable-dir = $(sys.executable:D) ;
533
+
534
+ if [ MATCH ^(PCBuild) : $(executable-dir:D=) ]
535
+ {
536
+ debug-message "This Python appears to reside in a source distribution;" ;
537
+ debug-message "prepending \""$(executable-dir)"\" to default library search path" ;
538
+
539
+ default-library-path = $(executable-dir) $(default-library-path) ;
540
+
541
+ default-include-path = $(:E=PC:R=$(executable-dir:D)) $(default-include-path) ;
542
+
543
+ debug-message "and \""$(default-include-path[1])"\" to default #include path" ;
544
+ }
545
+
546
+ libraries ?= $(default-library-path) ;
547
+ includes ?= $(default-include-path) ;
548
+ }
549
+ else
550
+ {
551
+ includes ?= $(prefix)/include/python$(version) ;
552
+
553
+ local lib = $(exec-prefix)/lib ;
554
+ libraries ?= $(lib)/python$(version)/config $(lib) ;
555
+ }
556
+ }
557
+
558
+ # The version of the python interpreter to use.
559
+ feature.feature python : : propagated ;
560
+ feature.feature python.interpreter : : free ;
561
+
562
+ toolset.flags python.capture-output PYTHON : <python.interpreter> ;
563
+
564
+ #
565
+ # Support for Python configured --with-pydebug
566
+ #
567
+ feature.feature python-debugging : off on : propagated ;
568
+ builtin.variant debug-python : debug : <python-debugging>on ;
569
+
570
+
571
+ # Return a list of candidate commands to try when looking for a Python
572
+ # interpreter. prefix is expected to be a native path.
573
+ #
574
+ local rule candidate-interpreters ( version ? : prefix ? : target-os )
575
+ {
576
+ local bin-path = bin ;
577
+ if $(target-os) = windows
578
+ {
579
+ # On Windows, look in the root directory itself and, to work with the
580
+ # result of a build-from-source, the PCBuild directory.
581
+ bin-path = PCBuild8 PCBuild "" ;
582
+ }
583
+
584
+ bin-path = $(bin-path:R=$(prefix)) ;
585
+
586
+ if $(target-os) in windows darwin
587
+ {
588
+ return # Search:
589
+ $(:E=python:R=$(bin-path)) # Relative to the prefix, if any
590
+ python # In the PATH
591
+ [ $(target-os)-installed-pythons $(version) ] # Standard install locations
592
+ ;
593
+ }
594
+ else
595
+ {
596
+ # Search relative to the prefix, or if none supplied, in PATH.
597
+ local unversioned = $(:E=python:R=$(bin-path:E=)) ;
598
+
599
+ # If a version was specified, look for a python with that specific
600
+ # version appended before looking for one called, simply, "python"
601
+ return $(unversioned)$(version) $(unversioned) ;
602
+ }
603
+ }
604
+
605
+
606
+ # Compute system library dependencies for targets linking with static Python
607
+ # libraries.
608
+ #
609
+ # On many systems, Python uses libraries such as pthreads or libdl. Since static
610
+ # libraries carry no library dependency information of their own that the linker
611
+ # can extract, these extra dependencies have to be given explicitly on the link
612
+ # line of the client. The information about these dependencies is packaged into
613
+ # the "python" target below.
614
+ #
615
+ # Even where Python itself uses pthreads, it never allows extension modules to
616
+ # be entered concurrently (unless they explicitly give up the interpreter lock).
617
+ # Therefore, extension modules do not need the efficiency overhead of threadsafe
618
+ # code as produced by <threading>multi, and we handle libpthread along with
619
+ # other libraries here. Note: this optimization is based on an assumption that
620
+ # the compiler generates link-compatible code in both the single- and
621
+ # multi-threaded cases, and that system libraries do not change their ABIs
622
+ # either.
623
+ #
624
+ # Returns a list of usage-requirements that link to the necessary system
625
+ # libraries.
626
+ #
627
+ local rule system-library-dependencies ( target-os )
628
+ {
629
+ switch $(target-os)
630
+ {
631
+ case s[uo][nl]* : # solaris, sun, sunos
632
+ # Add a librt dependency for the gcc toolset on SunOS (the sun
633
+ # toolset adds -lrt unconditionally). While this appears to
634
+ # duplicate the logic already in gcc.jam, it does not as long as
635
+ # we are not forcing <threading>multi.
636
+
637
+ # On solaris 10, distutils.sysconfig.get_config_var('LIBS') yields
638
+ # '-lresolv -lsocket -lnsl -lrt -ldl'. However, that does not seem
639
+ # to be the right list for extension modules. For example, on my
640
+ # installation, adding -ldl causes at least one test to fail because
641
+ # the library can not be found and removing it causes no failures.
642
+
643
+ # Apparently, though, we need to add -lrt for gcc.
644
+ return <toolset>gcc:<library>rt ;
645
+
646
+ case osf : return <library>pthread <toolset>gcc:<library>rt ;
647
+
648
+ case qnx* : return ;
649
+ case darwin : return ;
650
+ case windows : return ;
651
+
652
+ case hpux : return <library>rt ;
653
+ case *bsd : return <library>pthread <toolset>gcc:<library>util ;
654
+
655
+ case aix : return <library>pthread <library>dl ;
656
+
657
+ case * : return <library>pthread <library>dl
658
+ <toolset>gcc:<library>util <toolset-intel:platform>linux:<library>util ;
659
+ }
660
+ }
661
+
662
+
663
+ # Declare a target to represent Python's library.
664
+ #
665
+ local rule declare-libpython-target ( version ? : requirements * )
666
+ {
667
+ # Compute the representation of Python version in the name of Python's
668
+ # library file.
669
+ local lib-version = $(version) ;
670
+ if <target-os>windows in $(requirements)
671
+ {
672
+ local major-minor = [ split-version $(version) ] ;
673
+ lib-version = $(major-minor:J="") ;
674
+ if <python-debugging>on in $(requirements)
675
+ {
676
+ lib-version = $(lib-version)_d ;
677
+ }
678
+ }
679
+
680
+ if ! $(lib-version)
681
+ {
682
+ ECHO *** warning: could not determine Python version, which will ;
683
+ ECHO *** warning: probably prevent us from linking with the python ;
684
+ ECHO *** warning: library. Consider explicitly passing the version ;
685
+ ECHO *** warning: to 'using python'. ;
686
+ }
687
+
688
+ # Declare it.
689
+ lib python.lib : : <name>python$(lib-version) $(requirements) ;
690
+ }
691
+
692
+
693
+ # Implementation of init.
694
+ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? :
695
+ condition * : extension-suffix ? )
696
+ {
697
+ local prefix ;
698
+ local exec-prefix ;
699
+ local cmds-to-try ;
700
+ local interpreter-cmd ;
701
+
702
+ local target-os = [ feature.get-values target-os : $(condition) ] ;
703
+ target-os ?= [ feature.defaults target-os ] ;
704
+ target-os = $(target-os:G=) ;
705
+
706
+ if $(target-os) = windows && <python-debugging>on in $(condition)
707
+ {
708
+ extension-suffix ?= _d ;
709
+ }
710
+ extension-suffix ?= "" ;
711
+
712
+ # Normalize and dissect any version number.
713
+ local major-minor ;
714
+ if $(version)
715
+ {
716
+ major-minor = [ split-version $(version) ] ;
717
+ version = $(major-minor:J=.) ;
718
+ }
719
+
720
+ local cmds-to-try ;
721
+
722
+ if ! $(cmd-or-prefix) || [ GLOB $(cmd-or-prefix) : * ]
723
+ {
724
+ # If the user did not pass a command, whatever we got was a prefix.
725
+ prefix = $(cmd-or-prefix) ;
726
+ cmds-to-try = [ candidate-interpreters $(version) : $(prefix) : $(target-os) ] ;
727
+ }
728
+ else
729
+ {
730
+ # Work with the command the user gave us.
731
+ cmds-to-try = $(cmd-or-prefix) ;
732
+
733
+ # On Windows, do not nail down the interpreter command just yet in case
734
+ # the user specified something that turns out to be a cygwin symlink,
735
+ # which could bring down bjam if we invoke it.
736
+ if $(target-os) != windows
737
+ {
738
+ interpreter-cmd = $(cmd-or-prefix) ;
739
+ }
740
+ }
741
+
742
+ # Values to use in case we can not really find anything in the system.
743
+ local fallback-cmd = $(cmds-to-try[1]) ;
744
+ local fallback-version ;
745
+
746
+ # Anything left to find or check?
747
+ if ! ( $(interpreter-cmd) && $(includes) && $(libraries) )
748
+ {
749
+ # Values to be extracted from python's sys module. These will be set by
750
+ # the probe rule, above, using Jam's dynamic scoping.
751
+ local sys-elements = version platform prefix exec_prefix executable ;
752
+ local sys.$(sys-elements) ;
753
+
754
+ # Compute the string Python's sys.platform needs to match. If not
755
+ # targeting Windows or cygwin we will assume only native builds can
756
+ # possibly run, so we will not require a match and we leave sys.platform
757
+ # blank.
758
+ local platform ;
759
+ switch $(target-os)
760
+ {
761
+ case windows : platform = win32 ;
762
+ case cygwin : platform = cygwin ;
763
+ }
764
+
765
+ while $(cmds-to-try)
766
+ {
767
+ # Pop top command.
768
+ local cmd = $(cmds-to-try[1]) ;
769
+ cmds-to-try = $(cmds-to-try[2-]) ;
770
+
771
+ debug-message Checking interpreter command \"$(cmd)\"... ;
772
+ if [ probe $(cmd) ]
773
+ {
774
+ fallback-version ?= $(sys.version) ;
775
+
776
+ # Check for version/platform validity.
777
+ for local x in version platform
778
+ {
779
+ if $($(x)) && $($(x)) != $(sys.$(x))
780
+ {
781
+ debug-message ...$(x) "mismatch (looking for"
782
+ $($(x)) but found $(sys.$(x))")" ;
783
+ cmd = ;
784
+ }
785
+ }
786
+
787
+ if $(cmd)
788
+ {
789
+ debug-message ...requested configuration matched! ;
790
+
791
+ exec-prefix = $(sys.exec_prefix) ;
792
+
793
+ compute-default-paths $(target-os) : $(sys.version) :
794
+ $(sys.prefix) : $(sys.exec_prefix) ;
795
+
796
+ version = $(sys.version) ;
797
+ interpreter-cmd ?= $(cmd) ;
798
+ cmds-to-try = ; # All done.
799
+ }
800
+ }
801
+ else
802
+ {
803
+ debug-message ...does not invoke a working interpreter ;
804
+ }
805
+ }
806
+ }
807
+
808
+ # Anything left to compute?
809
+ if $(includes) && $(libraries)
810
+ {
811
+ .configured = true ;
812
+ }
813
+ else
814
+ {
815
+ version ?= $(fallback-version) ;
816
+ version ?= 2.5 ;
817
+ exec-prefix ?= $(prefix) ;
818
+ compute-default-paths $(target-os) : $(version) : $(prefix:E=) ;
819
+ }
820
+
821
+ if ! $(interpreter-cmd)
822
+ {
823
+ fallback-cmd ?= python ;
824
+ debug-message No working Python interpreter found. ;
825
+ if [ os.name ] != NT || ! [ invokes-cygwin-symlink $(fallback-cmd) ]
826
+ {
827
+ interpreter-cmd = $(fallback-cmd) ;
828
+ debug-message falling back to \"$(interpreter-cmd)\" ;
829
+ }
830
+ }
831
+
832
+ includes = [ path-to-native $(includes) ] ;
833
+ libraries = [ path-to-native $(libraries) ] ;
834
+
835
+ debug-message "Details of this Python configuration:" ;
836
+ debug-message " interpreter command:" \"$(interpreter-cmd:E=<empty>)\" ;
837
+ debug-message " include path:" \"$(includes:E=<empty>)\" ;
838
+ debug-message " library path:" \"$(libraries:E=<empty>)\" ;
839
+ if $(target-os) = windows
840
+ {
841
+ debug-message " DLL search path:" \"$(exec-prefix:E=<empty>)\" ;
842
+ }
843
+
844
+ #
845
+ # End autoconfiguration sequence.
846
+ #
847
+ local target-requirements = $(condition) ;
848
+
849
+ # Add the version, if any, to the target requirements.
850
+ if $(version)
851
+ {
852
+ if ! $(version) in [ feature.values python ]
853
+ {
854
+ feature.extend python : $(version) ;
855
+ }
856
+ target-requirements += <python>$(version:E=default) ;
857
+ }
858
+
859
+ target-requirements += <target-os>$(target-os) ;
860
+
861
+ # See if we can find a framework directory on darwin.
862
+ local framework-directory ;
863
+ if $(target-os) = darwin
864
+ {
865
+ # Search upward for the framework directory.
866
+ local framework-directory = $(libraries[-1]) ;
867
+ while $(framework-directory:D=) && $(framework-directory:D=) != Python.framework
868
+ {
869
+ framework-directory = $(framework-directory:D) ;
870
+ }
871
+
872
+ if $(framework-directory:D=) = Python.framework
873
+ {
874
+ debug-message framework directory is \"$(framework-directory)\" ;
875
+ }
876
+ else
877
+ {
878
+ debug-message "no framework directory found; using library path" ;
879
+ framework-directory = ;
880
+ }
881
+ }
882
+
883
+ local dll-path = $(libraries) ;
884
+
885
+ # Make sure that we can find the Python DLL on Windows.
886
+ if ( $(target-os) = windows ) && $(exec-prefix)
887
+ {
888
+ dll-path += $(exec-prefix) ;
889
+ }
890
+
891
+ #
892
+ # Prepare usage requirements.
893
+ #
894
+ local usage-requirements = [ system-library-dependencies $(target-os) ] ;
895
+ usage-requirements += <include>$(includes) <python.interpreter>$(interpreter-cmd) ;
896
+ if <python-debugging>on in $(condition)
897
+ {
898
+ if $(target-os) = windows
899
+ {
900
+ # In pyconfig.h, Py_DEBUG is set if _DEBUG is set. If we define
901
+ # Py_DEBUG we will get multiple definition warnings.
902
+ usage-requirements += <define>_DEBUG ;
903
+ }
904
+ else
905
+ {
906
+ usage-requirements += <define>Py_DEBUG ;
907
+ }
908
+ }
909
+
910
+ # Global, but conditional, requirements to give access to the interpreter
911
+ # for general utilities, like other toolsets, that run Python scripts.
912
+ toolset.add-requirements
913
+ $(target-requirements:J=,):<python.interpreter>$(interpreter-cmd) ;
914
+
915
+ # Register the right suffix for extensions.
916
+ register-extension-suffix $(extension-suffix) : $(target-requirements) ;
917
+
918
+ #
919
+ # Declare the "python" target. This should really be called
920
+ # python_for_embedding.
921
+ #
922
+
923
+ if $(framework-directory)
924
+ {
925
+ alias python
926
+ :
927
+ : $(target-requirements)
928
+ :
929
+ : $(usage-requirements) <framework>$(framework-directory)
930
+ ;
931
+ }
932
+ else
933
+ {
934
+ declare-libpython-target $(version) : $(target-requirements) ;
935
+
936
+ # This is an evil hack. On, Windows, when Python is embedded, nothing
937
+ # seems to set up sys.path to include Python's standard library
938
+ # (http://article.gmane.org/gmane.comp.python.general/544986). The evil
939
+ # here, aside from the workaround necessitated by Python's bug, is that:
940
+ #
941
+ # a. we're guessing the location of the python standard library from the
942
+ # location of pythonXX.lib
943
+ #
944
+ # b. we're hijacking the <testing.launcher> property to get the
945
+ # environment variable set up, and the user may want to use it for
946
+ # something else (e.g. launch the debugger).
947
+ local set-PYTHONPATH ;
948
+ if $(target-os) = windows
949
+ {
950
+ set-PYTHONPATH = [ common.prepend-path-variable-command PYTHONPATH :
951
+ $(libraries:D)/Lib ] ;
952
+ }
953
+
954
+ alias python
955
+ :
956
+ : $(target-requirements)
957
+ :
958
+ # Why python.lib must be listed here instead of along with the
959
+ # system libs is a mystery, but if we do not do it, on cygwin,
960
+ # -lpythonX.Y never appears in the command line (although it does on
961
+ # linux).
962
+ : $(usage-requirements)
963
+ <testing.launcher>$(set-PYTHONPATH)
964
+ <library-path>$(libraries) <dll-path>$(dll-path) <library>python.lib
965
+ ;
966
+ }
967
+
968
+ # On *nix, we do not want to link either Boost.Python or Python extensions
969
+ # to libpython, because the Python interpreter itself provides all those
970
+ # symbols. If we linked to libpython, we would get duplicate symbols. So
971
+ # declare two targets -- one for building extensions and another for
972
+ # embedding.
973
+ #
974
+ # Unlike most *nix systems, Mac OS X's linker does not permit undefined
975
+ # symbols when linking a shared library. So, we still need to link against
976
+ # the Python framework, even when building extensions. Note that framework
977
+ # builds of Python always use shared libraries, so we do not need to worry
978
+ # about duplicate Python symbols.
979
+ if $(target-os) in windows cygwin darwin
980
+ {
981
+ alias python_for_extensions : python : $(target-requirements) ;
982
+ }
983
+ # On AIX we need Python extensions and Boost.Python to import symbols from
984
+ # the Python interpreter. Dynamic libraries opened with dlopen() do not
985
+ # inherit the symbols from the Python interpreter.
986
+ else if $(target-os) = aix
987
+ {
988
+ alias python_for_extensions
989
+ :
990
+ : $(target-requirements)
991
+ :
992
+ : $(usage-requirements) <linkflags>-Wl,-bI:$(libraries[1])/python.exp
993
+ ;
994
+ }
995
+ else
996
+ {
997
+ alias python_for_extensions
998
+ :
999
+ : $(target-requirements)
1000
+ :
1001
+ : $(usage-requirements)
1002
+ ;
1003
+ }
1004
+ }
1005
+
1006
+
1007
+ rule configured ( )
1008
+ {
1009
+ return $(.configured) ;
1010
+ }
1011
+
1012
+
1013
+ type.register PYTHON_EXTENSION : : SHARED_LIB ;
1014
+
1015
+
1016
+ local rule register-extension-suffix ( root : condition * )
1017
+ {
1018
+ local suffix ;
1019
+
1020
+ switch [ feature.get-values target-os : $(condition) ]
1021
+ {
1022
+ case windows : suffix = pyd ;
1023
+ case cygwin : suffix = dll ;
1024
+ case hpux :
1025
+ {
1026
+ if [ feature.get-values python : $(condition) ] in 1.5 1.6 2.0 2.1 2.2 2.3 2.4
1027
+ {
1028
+ suffix = sl ;
1029
+ }
1030
+ else
1031
+ {
1032
+ suffix = so ;
1033
+ }
1034
+ }
1035
+ case * : suffix = so ;
1036
+ }
1037
+
1038
+ type.set-generated-target-suffix PYTHON_EXTENSION : $(condition) : <$(root).$(suffix)> ;
1039
+ }
1040
+
1041
+
1042
+ # Unset 'lib' prefix for PYTHON_EXTENSION
1043
+ type.set-generated-target-prefix PYTHON_EXTENSION : : "" ;
1044
+
1045
+
1046
+ rule python-extension ( name : sources * : requirements * : default-build * :
1047
+ usage-requirements * )
1048
+ {
1049
+ if [ configured ]
1050
+ {
1051
+ requirements += <use>/python//python_for_extensions ;
1052
+ }
1053
+ requirements += <suppress-import-lib>true ;
1054
+
1055
+ local project = [ project.current ] ;
1056
+
1057
+ targets.main-target-alternative
1058
+ [ new typed-target $(name) : $(project) : PYTHON_EXTENSION
1059
+ : [ targets.main-target-sources $(sources) : $(name) ]
1060
+ : [ targets.main-target-requirements $(requirements) : $(project) ]
1061
+ : [ targets.main-target-default-build $(default-build) : $(project) ]
1062
+ ] ;
1063
+ }
1064
+
1065
+ IMPORT python : python-extension : : python-extension ;
1066
+
1067
+ rule py2to3
1068
+ {
1069
+ common.copy $(>) $(<) ;
1070
+ 2to3 $(<) ;
1071
+ }
1072
+
1073
+ actions 2to3
1074
+ {
1075
+ 2to3 -wn "$(<)"
1076
+ 2to3 -dwn "$(<)"
1077
+ }
1078
+
1079
+
1080
+ # Support for testing.
1081
+ type.register PY : py ;
1082
+ type.register RUN_PYD_OUTPUT ;
1083
+ type.register RUN_PYD : : TEST ;
1084
+
1085
+
1086
+ class python-test-generator : generator
1087
+ {
1088
+ import set ;
1089
+
1090
+ rule __init__ ( * : * )
1091
+ {
1092
+ generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
1093
+ self.composing = true ;
1094
+ }
1095
+
1096
+ rule run ( project name ? : property-set : sources * : multiple ? )
1097
+ {
1098
+ local pyversion = [ $(property-set).get <python> ] ;
1099
+ local python ;
1100
+ local other-pythons ;
1101
+
1102
+ # Make new target that converting Python source by 2to3 when running with Python 3.
1103
+ local rule make-2to3-source ( source )
1104
+ {
1105
+ if $(pyversion) >= 3.0
1106
+ {
1107
+ local a = [ new action $(source) : python.py2to3 : $(property-set) ] ;
1108
+ local t = [ utility.basename [ $(s).name ] ] ;
1109
+ local p = [ new file-target $(t) : PY : $(project) : $(a) ] ;
1110
+ return $(p) ;
1111
+ }
1112
+ else
1113
+ {
1114
+ return $(source) ;
1115
+ }
1116
+ }
1117
+
1118
+ for local s in $(sources)
1119
+ {
1120
+ if [ $(s).type ] = PY
1121
+ {
1122
+ if ! $(python)
1123
+ {
1124
+ # First Python source ends up on command line.
1125
+ python = [ make-2to3-source $(s) ] ;
1126
+
1127
+ }
1128
+ else
1129
+ {
1130
+ # Other Python sources become dependencies.
1131
+ other-pythons += [ make-2to3-source $(s) ] ;
1132
+ }
1133
+ }
1134
+ }
1135
+
1136
+ local extensions ;
1137
+ for local s in $(sources)
1138
+ {
1139
+ if [ $(s).type ] = PYTHON_EXTENSION
1140
+ {
1141
+ extensions += $(s) ;
1142
+ }
1143
+ }
1144
+
1145
+ local libs ;
1146
+ for local s in $(sources)
1147
+ {
1148
+ if [ type.is-derived [ $(s).type ] LIB ]
1149
+ && ! $(s) in $(extensions)
1150
+ {
1151
+ libs += $(s) ;
1152
+ }
1153
+ }
1154
+
1155
+ local new-sources ;
1156
+ for local s in $(sources)
1157
+ {
1158
+ if [ type.is-derived [ $(s).type ] CPP ]
1159
+ {
1160
+ local name = [ utility.basename [ $(s).name ] ] ;
1161
+ if $(name) = [ utility.basename [ $(python).name ] ]
1162
+ {
1163
+ name = $(name)_ext ;
1164
+ }
1165
+ local extension = [ generators.construct $(project) $(name) :
1166
+ PYTHON_EXTENSION : $(property-set) : $(s) $(libs) ] ;
1167
+
1168
+ # The important part of usage requirements returned from
1169
+ # PYTHON_EXTENSION generator are xdll-path properties that will
1170
+ # allow us to find the python extension at runtime.
1171
+ property-set = [ $(property-set).add $(extension[1]) ] ;
1172
+
1173
+ # Ignore usage requirements. We're a top-level generator and
1174
+ # nobody is going to use what we generate.
1175
+ new-sources += $(extension[2-]) ;
1176
+ }
1177
+ }
1178
+
1179
+ property-set = [ $(property-set).add-raw <dependency>$(other-pythons) ] ;
1180
+
1181
+ return [ construct-result $(python) $(extensions) $(new-sources) :
1182
+ $(project) $(name) : $(property-set) ] ;
1183
+ }
1184
+ }
1185
+
1186
+
1187
+ generators.register
1188
+ [ new python-test-generator python.capture-output : : RUN_PYD_OUTPUT ] ;
1189
+
1190
+ generators.register-standard testing.expect-success
1191
+ : RUN_PYD_OUTPUT : RUN_PYD ;
1192
+
1193
+
1194
+ # There are two different ways of spelling OS names. One is used for [ os.name ]
1195
+ # and the other is used for the <host-os> and <target-os> properties. Until that
1196
+ # is remedied, this sets up a crude mapping from the latter to the former, that
1197
+ # will work *for the purposes of cygwin/NT cross-builds only*. Could not think
1198
+ # of a better name than "translate".
1199
+ #
1200
+ .translate-os-windows = NT ;
1201
+ .translate-os-cygwin = CYGWIN ;
1202
+ local rule translate-os ( src-os )
1203
+ {
1204
+ local x = $(.translate-os-$(src-os)) [ os.name ] ;
1205
+ return $(x[1]) ;
1206
+ }
1207
+
1208
+
1209
+ # Extract the path to a single ".pyd" source. This is used to build the
1210
+ # PYTHONPATH for running bpl tests.
1211
+ #
1212
+ local rule pyd-pythonpath ( source )
1213
+ {
1214
+ return [ on $(source) return $(LOCATE) $(SEARCH) ] ;
1215
+ }
1216
+
1217
+
1218
+ # The flag settings on testing.capture-output do not apply to python.capture
1219
+ # output at the moment. Redo this explicitly.
1220
+ toolset.flags python.capture-output ARGS <testing.arg> ;
1221
+
1222
+
1223
+ rule capture-output ( target : sources * : properties * )
1224
+ {
1225
+ # Setup up a proper DLL search path. Here, $(sources[1]) is a python module
1226
+ # and $(sources[2]) is a DLL. Only $(sources[1]) is passed to
1227
+ # testing.capture-output, so RUN_PATH variable on $(sources[2]) is not
1228
+ # consulted. Move it over explicitly.
1229
+ RUN_PATH on $(sources[1]) = [ on $(sources[2-]) return $(RUN_PATH) ] ;
1230
+
1231
+ PYTHONPATH = [ sequence.transform pyd-pythonpath : $(sources[2-]) ] ;
1232
+ PYTHONPATH += [ feature.get-values pythonpath : $(properties) ] ;
1233
+
1234
+ # After test is run, we remove the Python module, but not the Python script.
1235
+ testing.capture-output $(target) : $(sources[1]) : $(properties) :
1236
+ $(sources[2-]) ;
1237
+
1238
+ # PYTHONPATH is different; it will be interpreted by whichever Python is
1239
+ # invoked and so must follow path rules for the target os. The only OSes
1240
+ # where we can run python for other OSes currently are NT and CYGWIN so we
1241
+ # only need to handle those cases.
1242
+ local target-os = [ feature.get-values target-os : $(properties) ] ;
1243
+ # Oddly, host-os is not in properties, so grab the default value.
1244
+ local host-os = [ feature.defaults host-os ] ;
1245
+ host-os = $(host-os:G=) ;
1246
+ if $(target-os) != $(host-os)
1247
+ {
1248
+ PYTHONPATH = [ sequence.transform $(host-os)-to-$(target-os)-path :
1249
+ $(PYTHONPATH) ] ;
1250
+ }
1251
+ local path-separator = [ os.path-separator [ translate-os $(target-os) ] ] ;
1252
+ local set-PYTHONPATH = [ common.variable-setting-command PYTHONPATH :
1253
+ $(PYTHONPATH:J=$(path-separator)) ] ;
1254
+ LAUNCHER on $(target) = $(set-PYTHONPATH) [ on $(target) return \"$(PYTHON)\" ] ;
1255
+ }
1256
+
1257
+
1258
+ rule bpl-test ( name : sources * : requirements * )
1259
+ {
1260
+ local s ;
1261
+ sources ?= $(name).py $(name).cpp ;
1262
+ return [ testing.make-test run-pyd : $(sources) /boost/python//boost_python
1263
+ : $(requirements) : $(name) ] ;
1264
+ }
1265
+
1266
+
1267
+ IMPORT $(__name__) : bpl-test : : bpl-test ;
mosesdecoder/jam-files/boost-build/tools/qcc.jam ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2001 David Abrahams.
2
+ # Copyright (c) 2002-2003 Rene Rivera.
3
+ # Copyright (c) 2002-2003 Vladimir Prus.
4
+ #
5
+ # Use, modification and distribution is subject to the Boost Software
6
+ # License Version 1.0. (See accompanying file LICENSE_1_0.txt or
7
+ # http://www.boost.org/LICENSE_1_0.txt)
8
+
9
+ import "class" : new ;
10
+ import common ;
11
+ import errors ;
12
+ import feature ;
13
+ import generators ;
14
+ import os ;
15
+ import property ;
16
+ import set ;
17
+ import toolset ;
18
+ import type ;
19
+ import unix ;
20
+
21
+ feature.extend toolset : qcc ;
22
+
23
+ toolset.inherit-generators qcc : unix : unix.link unix.link.dll ;
24
+ generators.override builtin.lib-generator : qcc.prebuilt ;
25
+ toolset.inherit-flags qcc : unix ;
26
+ toolset.inherit-rules qcc : unix ;
27
+
28
+ # Initializes the qcc toolset for the given version. If necessary, command may
29
+ # be used to specify where the compiler is located. The parameter 'options' is a
30
+ # space-delimited list of options, each one being specified as
31
+ # <option-name>option-value. Valid option names are: cxxflags, linkflags and
32
+ # linker-type. Accepted values for linker-type are gnu and sun, gnu being the
33
+ # default.
34
+ #
35
+ # Example:
36
+ # using qcc : 3.4 : : <cxxflags>foo <linkflags>bar <linker-type>sun ;
37
+ #
38
+ rule init ( version ? : command * : options * )
39
+ {
40
+ local condition = [ common.check-init-parameters qcc : version $(version) ] ;
41
+ local command = [ common.get-invocation-command qcc : QCC : $(command) ] ;
42
+ common.handle-options qcc : $(condition) : $(command) : $(options) ;
43
+ }
44
+
45
+
46
+ generators.register-c-compiler qcc.compile.c++ : CPP : OBJ : <toolset>qcc ;
47
+ generators.register-c-compiler qcc.compile.c : C : OBJ : <toolset>qcc ;
48
+ generators.register-c-compiler qcc.compile.asm : ASM : OBJ : <toolset>qcc ;
49
+
50
+
51
+ # Declare flags for compilation.
52
+ toolset.flags qcc.compile OPTIONS <debug-symbols>on : -gstabs+ ;
53
+
54
+ # Declare flags and action for compilation.
55
+ toolset.flags qcc.compile OPTIONS <optimization>off : -O0 ;
56
+ toolset.flags qcc.compile OPTIONS <optimization>speed : -O3 ;
57
+ toolset.flags qcc.compile OPTIONS <optimization>space : -Os ;
58
+
59
+ toolset.flags qcc.compile OPTIONS <inlining>off : -Wc,-fno-inline ;
60
+ toolset.flags qcc.compile OPTIONS <inlining>on : -Wc,-Wno-inline ;
61
+ toolset.flags qcc.compile OPTIONS <inlining>full : -Wc,-finline-functions -Wc,-Wno-inline ;
62
+
63
+ toolset.flags qcc.compile OPTIONS <warnings>off : -w ;
64
+ toolset.flags qcc.compile OPTIONS <warnings>all : -Wc,-Wall ;
65
+ toolset.flags qcc.compile OPTIONS <warnings-as-errors>on : -Wc,-Werror ;
66
+
67
+ toolset.flags qcc.compile OPTIONS <profiling>on : -p ;
68
+
69
+ toolset.flags qcc.compile OPTIONS <cflags> ;
70
+ toolset.flags qcc.compile.c++ OPTIONS <cxxflags> ;
71
+ toolset.flags qcc.compile DEFINES <define> ;
72
+ toolset.flags qcc.compile INCLUDES <include> ;
73
+
74
+ toolset.flags qcc.compile OPTIONS <link>shared : -shared ;
75
+
76
+ toolset.flags qcc.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ;
77
+
78
+
79
+ rule compile.c++
80
+ {
81
+ # Here we want to raise the template-depth parameter value to something
82
+ # higher than the default value of 17. Note that we could do this using the
83
+ # feature.set-default rule but we do not want to set the default value for
84
+ # all toolsets as well.
85
+ #
86
+ # TODO: This 'modified default' has been inherited from some 'older Boost
87
+ # Build implementation' and has most likely been added to make some Boost
88
+ # library parts compile correctly. We should see what exactly prompted this
89
+ # and whether we can get around the problem more locally.
90
+ local template-depth = [ on $(1) return $(TEMPLATE_DEPTH) ] ;
91
+ if ! $(template-depth)
92
+ {
93
+ TEMPLATE_DEPTH on $(1) = 128 ;
94
+ }
95
+ }
96
+
97
+ actions compile.c++
98
+ {
99
+ "$(CONFIG_COMMAND)" -Wc,-ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
100
+ }
101
+
102
+ actions compile.c
103
+ {
104
+ "$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
105
+ }
106
+
107
+ actions compile.asm
108
+ {
109
+ "$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
110
+ }
111
+
112
+
113
+ # The class checking that we do not try to use the <runtime-link>static property
114
+ # while creating or using a shared library, since it is not supported by qcc/
115
+ # /libc.
116
+ #
117
+ class qcc-linking-generator : unix-linking-generator
118
+ {
119
+ rule generated-targets ( sources + : property-set : project name ? )
120
+ {
121
+ if <runtime-link>static in [ $(property-set).raw ]
122
+ {
123
+ local m ;
124
+ if [ id ] = "qcc.link.dll"
125
+ {
126
+ m = "on qcc, DLL can't be build with <runtime-link>static" ;
127
+ }
128
+ if ! $(m)
129
+ {
130
+ for local s in $(sources)
131
+ {
132
+ local type = [ $(s).type ] ;
133
+ if $(type) && [ type.is-derived $(type) SHARED_LIB ]
134
+ {
135
+ m = "on qcc, using DLLS together with the <runtime-link>static options is not possible " ;
136
+ }
137
+ }
138
+ }
139
+ if $(m)
140
+ {
141
+ errors.user-error $(m) : "It is suggested to use"
142
+ "<runtime-link>static together with <link>static." ;
143
+ }
144
+ }
145
+
146
+ return [ unix-linking-generator.generated-targets
147
+ $(sources) : $(property-set) : $(project) $(name) ] ;
148
+ }
149
+ }
150
+
151
+ generators.register [ new qcc-linking-generator qcc.link : LIB OBJ : EXE
152
+ : <toolset>qcc ] ;
153
+
154
+ generators.register [ new qcc-linking-generator qcc.link.dll : LIB OBJ
155
+ : SHARED_LIB : <toolset>qcc ] ;
156
+
157
+ generators.override qcc.prebuilt : builtin.prebuilt ;
158
+ generators.override qcc.searched-lib-generator : searched-lib-generator ;
159
+
160
+
161
+ # Declare flags for linking.
162
+ # First, the common flags.
163
+ toolset.flags qcc.link OPTIONS <debug-symbols>on : -gstabs+ ;
164
+ toolset.flags qcc.link OPTIONS <profiling>on : -p ;
165
+ toolset.flags qcc.link OPTIONS <linkflags> ;
166
+ toolset.flags qcc.link LINKPATH <library-path> ;
167
+ toolset.flags qcc.link FINDLIBS-ST <find-static-library> ;
168
+ toolset.flags qcc.link FINDLIBS-SA <find-shared-library> ;
169
+ toolset.flags qcc.link LIBRARIES <library-file> ;
170
+
171
+ toolset.flags qcc.link FINDLIBS-SA : m ;
172
+
173
+ # For <runtime-link>static we made sure there are no dynamic libraries in the
174
+ # link.
175
+ toolset.flags qcc.link OPTIONS <runtime-link>static : -static ;
176
+
177
+ # Assuming this is just like with gcc.
178
+ toolset.flags qcc.link RPATH : <dll-path> : unchecked ;
179
+ toolset.flags qcc.link RPATH_LINK : <xdll-path> : unchecked ;
180
+
181
+
182
+ # Declare actions for linking.
183
+ #
184
+ rule link ( targets * : sources * : properties * )
185
+ {
186
+ SPACE on $(targets) = " " ;
187
+ # Serialize execution of the 'link' action, since running N links in
188
+ # parallel is just slower. For now, serialize only qcc links while it might
189
+ # be a good idea to serialize all links.
190
+ JAM_SEMAPHORE on $(targets) = <s>qcc-link-semaphore ;
191
+ }
192
+
193
+ actions link bind LIBRARIES
194
+ {
195
+ "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS)
196
+ }
197
+
198
+
199
+ # Always remove archive and start again. Here is the rationale from Andre Hentz:
200
+ # I had a file, say a1.c, that was included into liba.a. I moved a1.c to a2.c,
201
+ # updated my Jamfiles and rebuilt. My program was crashing with absurd errors.
202
+ # After some debugging I traced it back to the fact that a1.o was *still* in
203
+ # liba.a
204
+ RM = [ common.rm-command ] ;
205
+ if [ os.name ] = NT
206
+ {
207
+ RM = "if exist \"$(<[1])\" DEL \"$(<[1])\"" ;
208
+ }
209
+
210
+
211
+ # Declare action for creating static libraries. The 'r' letter means to add
212
+ # files to the archive with replacement. Since we remove the archive, we do not
213
+ # care about replacement, but there is no option to "add without replacement".
214
+ # The 'c' letter suppresses warnings in case the archive does not exists yet.
215
+ # That warning is produced only on some platforms, for whatever reasons.
216
+ #
217
+ actions piecemeal archive
218
+ {
219
+ $(RM) "$(<)"
220
+ ar rc "$(<)" "$(>)"
221
+ }
222
+
223
+
224
+ rule link.dll ( targets * : sources * : properties * )
225
+ {
226
+ SPACE on $(targets) = " " ;
227
+ JAM_SEMAPHORE on $(targets) = <s>qcc-link-semaphore ;
228
+ }
229
+
230
+
231
+ # Differ from 'link' above only by -shared.
232
+ #
233
+ actions link.dll bind LIBRARIES
234
+ {
235
+ "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" $(HAVE_SONAME)-Wl,-h$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS)
236
+ }
mosesdecoder/jam-files/boost-build/tools/rc.jam ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) Andre Hentz 2003. Permission to copy, use, modify, sell and
2
+ # distribute this software is granted provided this copyright notice appears in
3
+ # all copies. This software is provided "as is" without express or implied
4
+ # warranty, and with no claim as to its suitability for any purpose.
5
+ #
6
+ # Copyright (c) 2006 Rene Rivera.
7
+ #
8
+ # Use, modification and distribution is subject to the Boost Software
9
+ # License Version 1.0. (See accompanying file LICENSE_1_0.txt or
10
+ # http://www.boost.org/LICENSE_1_0.txt)
11
+
12
+ import type ;
13
+ import generators ;
14
+ import feature ;
15
+ import errors ;
16
+ import scanner ;
17
+ import toolset : flags ;
18
+
19
+ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
20
+ {
21
+ .debug-configuration = true ;
22
+ }
23
+
24
+ type.register RC : rc ;
25
+
26
+ rule init ( )
27
+ {
28
+ }
29
+
30
+ # Configures a new resource compilation command specific to a condition,
31
+ # usually a toolset selection condition. The possible options are:
32
+ #
33
+ # * <rc-type>(rc|windres) - Indicates the type of options the command
34
+ # accepts.
35
+ #
36
+ # Even though the arguments are all optional, only when a command, condition,
37
+ # and at minimum the rc-type option are given will the command be configured.
38
+ # This is so that callers don't have to check auto-configuration values
39
+ # before calling this. And still get the functionality of build failures when
40
+ # the resource compiler can't be found.
41
+ #
42
+ rule configure ( command ? : condition ? : options * )
43
+ {
44
+ local rc-type = [ feature.get-values <rc-type> : $(options) ] ;
45
+
46
+ if $(command) && $(condition) && $(rc-type)
47
+ {
48
+ flags rc.compile.resource .RC $(condition) : $(command) ;
49
+ flags rc.compile.resource .RC_TYPE $(condition) : $(rc-type:L) ;
50
+ flags rc.compile.resource DEFINES <define> ;
51
+ flags rc.compile.resource INCLUDES <include> ;
52
+ if $(.debug-configuration)
53
+ {
54
+ ECHO notice: using rc compiler :: $(condition) :: $(command) ;
55
+ }
56
+ }
57
+ }
58
+
59
+ rule compile.resource ( target : sources * : properties * )
60
+ {
61
+ local rc-type = [ on $(target) return $(.RC_TYPE) ] ;
62
+ rc-type ?= null ;
63
+ compile.resource.$(rc-type) $(target) : $(sources[1]) ;
64
+ }
65
+
66
+ actions compile.resource.rc
67
+ {
68
+ "$(.RC)" -l 0x409 "-U$(UNDEFS)" "-D$(DEFINES)" -I"$(>:D)" -I"$(<:D)" -I"$(INCLUDES)" -fo "$(<)" "$(>)"
69
+ }
70
+
71
+ actions compile.resource.windres
72
+ {
73
+ "$(.RC)" "-U$(UNDEFS)" "-D$(DEFINES)" -I"$(>:D)" -I"$(<:D)" -I"$(INCLUDES)" -o "$(<)" -i "$(>)"
74
+ }
75
+
76
+ actions quietly compile.resource.null
77
+ {
78
+ as /dev/null -o "$(<)"
79
+ }
80
+
81
+ # Since it's a common practice to write
82
+ # exe hello : hello.cpp hello.rc
83
+ # we change the name of object created from RC file, to
84
+ # avoid conflict with hello.cpp.
85
+ # The reason we generate OBJ and not RES, is that gcc does not
86
+ # seem to like RES files, but works OK with OBJ.
87
+ # See http://article.gmane.org/gmane.comp.lib.boost.build/5643/
88
+ #
89
+ # Using 'register-c-compiler' adds the build directory to INCLUDES
90
+ generators.register-c-compiler rc.compile.resource : RC : OBJ(%_res) ;
91
+
92
+ # Register scanner for resources
93
+ class res-scanner : scanner
94
+ {
95
+ import regex virtual-target path scanner ;
96
+
97
+ rule __init__ ( includes * )
98
+ {
99
+ scanner.__init__ ;
100
+
101
+ self.includes = $(includes) ;
102
+ }
103
+
104
+ rule pattern ( )
105
+ {
106
+ return "(([^ ]+[ ]+(BITMAP|CURSOR|FONT|ICON|MESSAGETABLE|RT_MANIFEST)[ ]+([^ \"]+|\"[^\"]+\"))|(#include[ ]*(<[^<]+>|\"[^\"]+\")))" ;
107
+ }
108
+
109
+ rule process ( target : matches * : binding )
110
+ {
111
+ local angle = [ regex.transform $(matches) : "#include[ ]*<([^<]+)>" ] ;
112
+ local quoted = [ regex.transform $(matches) : "#include[ ]*\"([^\"]+)\"" ] ;
113
+ local res = [ regex.transform $(matches) : "[^ ]+[ ]+(BITMAP|CURSOR|FONT|ICON|MESSAGETABLE|RT_MANIFEST)[ ]+(([^ \"]+)|\"([^\"]+)\")" : 3 4 ] ;
114
+
115
+ # Icons and other includes may referenced as
116
+ #
117
+ # IDR_MAINFRAME ICON "res\\icon.ico"
118
+ #
119
+ # so we have to replace double backslashes to single ones.
120
+ res = [ regex.replace-list $(res) : "\\\\\\\\" : "/" ] ;
121
+
122
+ # CONSIDER: the new scoping rule seem to defeat "on target" variables.
123
+ local g = [ on $(target) return $(HDRGRIST) ] ;
124
+ local b = [ NORMALIZE_PATH $(binding:D) ] ;
125
+
126
+ # Attach binding of including file to included targets.
127
+ # When target is directly created from virtual target
128
+ # this extra information is unnecessary. But in other
129
+ # cases, it allows to distinguish between two headers of the
130
+ # same name included from different places.
131
+ # We don't need this extra information for angle includes,
132
+ # since they should not depend on including file (we can't
133
+ # get literal "." in include path).
134
+ local g2 = $(g)"#"$(b) ;
135
+
136
+ angle = $(angle:G=$(g)) ;
137
+ quoted = $(quoted:G=$(g2)) ;
138
+ res = $(res:G=$(g2)) ;
139
+
140
+ local all = $(angle) $(quoted) ;
141
+
142
+ INCLUDES $(target) : $(all) ;
143
+ DEPENDS $(target) : $(res) ;
144
+ NOCARE $(all) $(res) ;
145
+ SEARCH on $(angle) = $(self.includes:G=) ;
146
+ SEARCH on $(quoted) = $(b) $(self.includes:G=) ;
147
+ SEARCH on $(res) = $(b) $(self.includes:G=) ;
148
+
149
+ # Just propagate current scanner to includes, in a hope
150
+ # that includes do not change scanners.
151
+ scanner.propagate $(__name__) : $(angle) $(quoted) : $(target) ;
152
+ }
153
+ }
154
+
155
+ scanner.register res-scanner : include ;
156
+ type.set-scanner RC : res-scanner ;
mosesdecoder/jam-files/boost-build/tools/stlport.jam ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright Gennadiy Rozental
2
+ # Copyright 2006 Rene Rivera
3
+ # Copyright 2003, 2004, 2006 Vladimir Prus
4
+ # Distributed under the Boost Software License, Version 1.0.
5
+ # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
+
7
+ # The STLPort is usable by means of 'stdlib' feature. When
8
+ # stdlib=stlport is specified, default version of STLPort will be used,
9
+ # while stdlib=stlport-4.5 will use specific version.
10
+ # The subfeature value 'hostios' means to use host compiler's iostreams.
11
+ #
12
+ # The specific version of stlport is selected by features:
13
+ # The <runtime-link> feature selects between static and shared library
14
+ # The <runtime-debugging>on selects STLPort with debug symbols
15
+ # and stl debugging.
16
+ # There's no way to use STLPort with debug symbols but without
17
+ # stl debugging.
18
+
19
+ # TODO: must implement selection of different STLPort installations based
20
+ # on used toolset.
21
+ # Also, finish various flags:
22
+ #
23
+ # This is copied from V1 toolset, "+" means "implemented"
24
+ #+flags $(CURR_TOOLSET) DEFINES <stlport-iostream>off : _STLP_NO_OWN_IOSTREAMS=1 _STLP_HAS_NO_NEW_IOSTREAMS=1 ;
25
+ #+flags $(CURR_TOOLSET) DEFINES <stlport-extensions>off : _STLP_NO_EXTENSIONS=1 ;
26
+ # flags $(CURR_TOOLSET) DEFINES <stlport-anachronisms>off : _STLP_NO_ANACHRONISMS=1 ;
27
+ # flags $(CURR_TOOLSET) DEFINES <stlport-cstd-namespace>global : _STLP_VENDOR_GLOBAL_CSTD=1 ;
28
+ # flags $(CURR_TOOLSET) DEFINES <exception-handling>off : _STLP_NO_EXCEPTIONS=1 ;
29
+ # flags $(CURR_TOOLSET) DEFINES <stlport-debug-alloc>on : _STLP_DEBUG_ALLOC=1 ;
30
+ #+flags $(CURR_TOOLSET) DEFINES <runtime-build>debug : _STLP_DEBUG=1 _STLP_DEBUG_UNINITIALIZED=1 ;
31
+ #+flags $(CURR_TOOLSET) DEFINES <runtime-link>dynamic : _STLP_USE_DYNAMIC_LIB=1 ;
32
+
33
+
34
+ import feature : feature subfeature ;
35
+ import project ;
36
+ import "class" : new ;
37
+ import targets ;
38
+ import property-set ;
39
+ import common ;
40
+ import type ;
41
+
42
+ # Make this module into a project.
43
+ project.initialize $(__name__) ;
44
+ project stlport ;
45
+
46
+ # The problem: how to request to use host compiler's iostreams?
47
+ #
48
+ # Solution 1: Global 'stlport-iostream' feature.
49
+ # That's ugly. Subfeature make more sense for stlport-specific thing.
50
+ # Solution 2: Use subfeature with two values, one of which ("use STLPort iostream")
51
+ # is default.
52
+ # The problem is that such subfeature will appear in target paths, and that's ugly
53
+ # Solution 3: Use optional subfeature with only one value.
54
+
55
+ feature.extend stdlib : stlport ;
56
+ feature.compose <stdlib>stlport : <library>/stlport//stlport ;
57
+
58
+ # STLport iostreams or native iostreams
59
+ subfeature stdlib stlport : iostream : hostios : optional propagated ;
60
+
61
+ # STLport extensions
62
+ subfeature stdlib stlport : extensions : noext : optional propagated ;
63
+
64
+ # STLport anachronisms -- NOT YET SUPPORTED
65
+ # subfeature stdlib stlport : anachronisms : on off ;
66
+
67
+ # STLport debug allocation -- NOT YET SUPPORTED
68
+ #subfeature stdlib stlport : debug-alloc : off on ;
69
+
70
+ # Declare a special target class to handle the creation of search-lib-target
71
+ # instances for STLport. We need a special class, because otherwise we'll have
72
+ # - declare prebuilt targets for all possible toolsets. And by the time 'init'
73
+ # is called we don't even know the list of toolsets that are registered
74
+ # - when host iostreams are used, we really should produce nothing. It would
75
+ # be hard/impossible to achieve this using prebuilt targets.
76
+
77
+ class stlport-target-class : basic-target
78
+ {
79
+ import feature project type errors generators ;
80
+ import set : difference ;
81
+
82
+ rule __init__ ( project : headers ? : libraries * : version ? )
83
+ {
84
+ basic-target.__init__ stlport : $(project) ;
85
+ self.headers = $(headers) ;
86
+ self.libraries = $(libraries) ;
87
+ self.version = $(version) ;
88
+ self.version.5 = [ MATCH "^(5[.][0123456789]+).*" : $(version) ] ;
89
+
90
+ local requirements ;
91
+ requirements += <stdlib-stlport:version>$(self.version) ;
92
+ self.requirements = [ property-set.create $(requirements) ] ;
93
+ }
94
+
95
+ rule generate ( property-set )
96
+ {
97
+ # Since this target is built with <stdlib>stlport, it will also
98
+ # have <library>/stlport//stlport in requirements, which will
99
+ # cause a loop in main target references. Remove that property
100
+ # manually.
101
+
102
+ property-set = [ property-set.create
103
+ [ difference
104
+ [ $(property-set).raw ] :
105
+ <library>/stlport//stlport
106
+ <stdlib>stlport
107
+ ]
108
+ ] ;
109
+ return [ basic-target.generate $(property-set) ] ;
110
+ }
111
+
112
+ rule construct ( name : source-targets * : property-set )
113
+ {
114
+ # Deduce the name of stlport library, based on toolset and
115
+ # debug setting.
116
+ local raw = [ $(property-set).raw ] ;
117
+ local hostios = [ feature.get-values <stdlib-stlport:iostream> : $(raw) ] ;
118
+ local toolset = [ feature.get-values <toolset> : $(raw) ] ;
119
+
120
+ if $(self.version.5)
121
+ {
122
+ # Version 5.x
123
+
124
+ # STLport host IO streams no longer supported. So we always
125
+ # need libraries.
126
+
127
+ # name: stlport(stl)?[dg]?(_static)?.M.R
128
+ local name = stlport ;
129
+ if [ feature.get-values <runtime-debugging> : $(raw) ] = "on"
130
+ {
131
+ name += stl ;
132
+ switch $(toolset)
133
+ {
134
+ case gcc* : name += g ;
135
+ case darwin* : name += g ;
136
+ case * : name += d ;
137
+ }
138
+ }
139
+
140
+ if [ feature.get-values <runtime-link> : $(raw) ] = "static"
141
+ {
142
+ name += _static ;
143
+ }
144
+
145
+ # Starting with version 5.2.0, the STLport static libraries no longer
146
+ # include a version number in their name
147
+ local version.pre.5.2 = [ MATCH "^(5[.][01]+).*" : $(version) ] ;
148
+ if $(version.pre.5.2) || [ feature.get-values <runtime-link> : $(raw) ] != "static"
149
+ {
150
+ name += .$(self.version.5) ;
151
+ }
152
+
153
+ name = $(name:J=) ;
154
+
155
+ if [ feature.get-values <install-dependencies> : $(raw) ] = "on"
156
+ {
157
+ #~ Allow explicitly asking to install the STLport lib by
158
+ #~ refering to it directly: /stlport//stlport/<install-dependencies>on
159
+ #~ This allows for install packaging of all libs one might need for
160
+ #~ a standalone distribution.
161
+ import path : make : path-make ;
162
+ local runtime-link
163
+ = [ feature.get-values <runtime-link> : $(raw) ] ;
164
+ local lib-file.props
165
+ = [ property-set.create $(raw) <link>$(runtime-link) ] ;
166
+ local lib-file.prefix
167
+ = [ type.generated-target-prefix $(runtime-link:U)_LIB : $(lib-file.props) ] ;
168
+ local lib-file.suffix
169
+ = [ type.generated-target-suffix $(runtime-link:U)_LIB : $(lib-file.props) ] ;
170
+ lib-file.prefix
171
+ ?= "" "lib" ;
172
+ lib-file.suffix
173
+ ?= "" ;
174
+ local lib-file
175
+ = [ GLOB $(self.libraries) [ modules.peek : PATH ] :
176
+ $(lib-file.prefix)$(name).$(lib-file.suffix) ] ;
177
+ lib-file
178
+ = [ new file-reference [ path-make $(lib-file[1]) ] : $(self.project) ] ;
179
+ lib-file
180
+ = [ $(lib-file).generate "" ] ;
181
+ local lib-file.requirements
182
+ = [ targets.main-target-requirements
183
+ [ $(lib-file.props).raw ] <file>$(lib-file[-1])
184
+ : $(self.project) ] ;
185
+ return [ generators.construct $(self.project) $(name) : LIB : $(lib-file.requirements) ] ;
186
+ }
187
+ else
188
+ {
189
+ #~ Otherwise, it's just a regular usage of the library.
190
+ return [ generators.construct
191
+ $(self.project) $(name) : SEARCHED_LIB : $(property-set) ] ;
192
+ }
193
+ }
194
+ else if ! $(hostios) && $(toolset) != msvc
195
+ {
196
+ # We don't need libraries if host istreams are used. For
197
+ # msvc, automatic library selection will be used.
198
+
199
+ # name: stlport_<toolset>(_stldebug)?
200
+ local name = stlport ;
201
+ name = $(name)_$(toolset) ;
202
+ if [ feature.get-values <runtime-debugging> : $(raw) ] = "on"
203
+ {
204
+ name = $(name)_stldebug ;
205
+ }
206
+
207
+ return [ generators.construct
208
+ $(self.project) $(name) : SEARCHED_LIB : $(property-set) ] ;
209
+ }
210
+ else
211
+ {
212
+ return [ property-set.empty ] ;
213
+ }
214
+ }
215
+
216
+ rule compute-usage-requirements ( subvariant )
217
+ {
218
+ local usage-requirements =
219
+ <include>$(self.headers)
220
+ <dll-path>$(self.libraries)
221
+ <library-path>$(self.libraries)
222
+ ;
223
+
224
+ local rproperties = [ $(subvariant).build-properties ] ;
225
+ # CONSIDER: should this "if" sequence be replaced with
226
+ # some use of 'property-map' class?
227
+ if [ $(rproperties).get <runtime-debugging> ] = "on"
228
+ {
229
+ usage-requirements +=
230
+ <define>_STLP_DEBUG=1
231
+ <define>_STLP_DEBUG_UNINITIALIZED=1 ;
232
+ }
233
+ if [ $(rproperties).get <runtime-link> ] = "shared"
234
+ {
235
+ usage-requirements +=
236
+ <define>_STLP_USE_DYNAMIC_LIB=1 ;
237
+ }
238
+ if [ $(rproperties).get <stdlib-stlport:extensions> ] = noext
239
+ {
240
+ usage-requirements +=
241
+ <define>_STLP_NO_EXTENSIONS=1 ;
242
+ }
243
+ if [ $(rproperties).get <stdlib-stlport:iostream> ] = hostios
244
+ {
245
+ usage-requirements +=
246
+ <define>_STLP_NO_OWN_IOSTREAMS=1
247
+ <define>_STLP_HAS_NO_NEW_IOSTREAMS=1 ;
248
+ }
249
+ if $(self.version.5)
250
+ {
251
+ # Version 5.x
252
+ if [ $(rproperties).get <threading> ] = "single"
253
+ {
254
+ # Since STLport5 doesn't normally support single-thread
255
+ # we force STLport5 into the multi-thread mode. Hence
256
+ # getting what other libs provide of single-thread code
257
+ # linking against a multi-thread lib.
258
+ usage-requirements +=
259
+ <define>_STLP_THREADS=1 ;
260
+ }
261
+ }
262
+
263
+ return [ property-set.create $(usage-requirements) ] ;
264
+ }
265
+ }
266
+
267
+ rule stlport-target ( headers ? : libraries * : version ? )
268
+ {
269
+ local project = [ project.current ] ;
270
+
271
+ targets.main-target-alternative
272
+ [ new stlport-target-class $(project) : $(headers) : $(libraries)
273
+ : $(version)
274
+ ] ;
275
+ }
276
+
277
+ local .version-subfeature-defined ;
278
+
279
+ # Initialize stlport support.
280
+ rule init (
281
+ version ? :
282
+ headers : # Location of header files
283
+ libraries * # Location of libraries, lib and bin subdirs of STLport.
284
+ )
285
+ {
286
+ # FIXME: need to use common.check-init-parameters here.
287
+ # At the moment, that rule always tries to define subfeature
288
+ # of the 'toolset' feature, while we need to define subfeature
289
+ # of <stdlib>stlport, so tweaks to check-init-parameters are needed.
290
+ if $(version)
291
+ {
292
+ if ! $(.version-subfeature-defined)
293
+ {
294
+ feature.subfeature stdlib stlport : version : : propagated ;
295
+ .version-subfeature-defined = true ;
296
+ }
297
+ feature.extend-subfeature stdlib stlport : version : $(version) ;
298
+ }
299
+
300
+ # Declare the main target for this STLPort version.
301
+ stlport-target $(headers) : $(libraries) : $(version) ;
302
+ }
303
+
mosesdecoder/jam-files/boost-build/tools/types/asm.jam ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # Copyright Craig Rodrigues 2005. Distributed under the Boost
2
+ # Software License, Version 1.0. (See accompanying
3
+ # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
+ type ASM : s S asm ;
mosesdecoder/jam-files/boost-build/tools/types/cpp.jam ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright David Abrahams 2004.
2
+ # Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus
3
+ # Copyright 2010 Rene Rivera
4
+ # Distributed under the Boost Software License, Version 1.0.
5
+ # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
+ import type ;
7
+ import scanner ;
8
+
9
+ class c-scanner : scanner
10
+ {
11
+ import path ;
12
+ import regex ;
13
+ import scanner ;
14
+ import sequence ;
15
+ import virtual-target ;
16
+
17
+ rule __init__ ( includes * )
18
+ {
19
+ scanner.__init__ ;
20
+
21
+ for local i in $(includes)
22
+ {
23
+ self.includes += [ sequence.transform path.native
24
+ : [ regex.split $(i:G=) "&&" ] ] ;
25
+ }
26
+ }
27
+
28
+ rule pattern ( )
29
+ {
30
+ return "#[ \t]*include[ ]*(<(.*)>|\"(.*)\")" ;
31
+ }
32
+
33
+ rule process ( target : matches * : binding )
34
+ {
35
+ local angle = [ regex.transform $(matches) : "<(.*)>" ] ;
36
+ angle = [ sequence.transform path.native : $(angle) ] ;
37
+ local quoted = [ regex.transform $(matches) : "\"(.*)\"" ] ;
38
+ quoted = [ sequence.transform path.native : $(quoted) ] ;
39
+
40
+ # CONSIDER: the new scoping rule seem to defeat "on target" variables.
41
+ local g = [ on $(target) return $(HDRGRIST) ] ;
42
+ local b = [ NORMALIZE_PATH $(binding:D) ] ;
43
+
44
+ # Attach binding of including file to included targets. When a target is
45
+ # directly created from virtual target this extra information is
46
+ # unnecessary. But in other cases, it allows us to distinguish between
47
+ # two headers of the same name included from different places. We do not
48
+ # need this extra information for angle includes, since they should not
49
+ # depend on including file (we can not get literal "." in include path).
50
+ local g2 = $(g)"#"$(b) ;
51
+
52
+ angle = $(angle:G=$(g)) ;
53
+ quoted = $(quoted:G=$(g2)) ;
54
+
55
+ local all = $(angle) $(quoted) ;
56
+
57
+ INCLUDES $(target) : $(all) ;
58
+ NOCARE $(all) ;
59
+ SEARCH on $(angle) = $(self.includes:G=) ;
60
+ SEARCH on $(quoted) = $(b) $(self.includes:G=) ;
61
+
62
+ # Just propagate the current scanner to includes in hope that includes
63
+ # do not change scanners.
64
+ scanner.propagate $(__name__) : $(angle) $(quoted) : $(target) ;
65
+
66
+ ISFILE $(angle) $(quoted) ;
67
+ }
68
+ }
69
+
70
+ scanner.register c-scanner : include ;
71
+
72
+ type.register CPP : cpp cxx cc ;
73
+ type.register H : h ;
74
+ type.register HPP : hpp : H ;
75
+ type.register C : c ;
76
+
77
+ # It most cases where a CPP file or a H file is a source of some action, we
78
+ # should rebuild the result if any of files included by CPP/H are changed. One
79
+ # case when this is not needed is installation, which is handled specifically.
80
+ type.set-scanner CPP : c-scanner ;
81
+ type.set-scanner C : c-scanner ;
82
+ # One case where scanning of H/HPP files is necessary is PCH generation -- if
83
+ # any header included by HPP being precompiled changes, we need to recompile the
84
+ # header.
85
+ type.set-scanner H : c-scanner ;
86
+ type.set-scanner HPP : c-scanner ;
mosesdecoder/jam-files/boost-build/tools/types/exe.jam ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright David Abrahams 2004. Distributed under the Boost
2
+ # Software License, Version 1.0. (See accompanying
3
+ # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
+
5
+ import type ;
6
+
7
+ type.register EXE ;
8
+ type.set-generated-target-suffix EXE : <target-os>windows : "exe" ;
9
+ type.set-generated-target-suffix EXE : <target-os>cygwin : "exe" ;
mosesdecoder/jam-files/boost-build/tools/types/lib.jam ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright David Abrahams 2004. Distributed under the Boost
2
+ # Software License, Version 1.0. (See accompanying
3
+ # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
+
5
+ import type ; # for set-generated-target-suffix
6
+ import os ;
7
+
8
+ # The following naming scheme is used for libraries.
9
+ #
10
+ # On *nix:
11
+ # libxxx.a static library
12
+ # libxxx.so shared library
13
+ #
14
+ # On windows (msvc)
15
+ # libxxx.lib static library
16
+ # xxx.dll DLL
17
+ # xxx.lib import library
18
+ #
19
+ # On windows (mingw):
20
+ # libxxx.a static library
21
+ # libxxx.dll DLL
22
+ # libxxx.dll.a import library
23
+ #
24
+ # On cygwin i.e. <target-os>cygwin
25
+ # libxxx.a static library
26
+ # cygxxx.dll DLL
27
+ # libxxx.dll.a import library
28
+ #
29
+
30
+ type.register LIB ;
31
+
32
+ # FIXME: should not register both extensions on both platforms.
33
+ type.register STATIC_LIB : a lib : LIB ;
34
+
35
+ # The 'lib' prefix is used everywhere
36
+ type.set-generated-target-prefix STATIC_LIB : : lib ;
37
+
38
+ # Use '.lib' suffix for windows
39
+ type.set-generated-target-suffix STATIC_LIB : <target-os>windows : lib ;
40
+
41
+ # Except with gcc.
42
+ type.set-generated-target-suffix STATIC_LIB : <toolset>gcc <target-os>windows : a ;
43
+
44
+ # Use xxx.lib for import libs
45
+ type IMPORT_LIB : : STATIC_LIB ;
46
+ type.set-generated-target-prefix IMPORT_LIB : : "" ;
47
+ type.set-generated-target-suffix IMPORT_LIB : : lib ;
48
+
49
+ # Except with gcc (mingw or cygwin), where use libxxx.dll.a
50
+ type.set-generated-target-prefix IMPORT_LIB : <toolset>gcc : lib ;
51
+ type.set-generated-target-suffix IMPORT_LIB : <toolset>gcc : dll.a ;
52
+
53
+ type.register SHARED_LIB : so dll dylib : LIB ;
54
+
55
+ # Both mingw and cygwin use libxxx.dll naming scheme.
56
+ # On Linux, use "lib" prefix
57
+ type.set-generated-target-prefix SHARED_LIB : : lib ;
58
+ # But don't use it on windows
59
+ type.set-generated-target-prefix SHARED_LIB : <target-os>windows : "" ;
60
+ # But use it again on mingw
61
+ type.set-generated-target-prefix SHARED_LIB : <toolset>gcc <target-os>windows : lib ;
62
+ # And use 'cyg' on cygwin
63
+ type.set-generated-target-prefix SHARED_LIB : <target-os>cygwin : cyg ;
64
+
65
+
66
+ type.set-generated-target-suffix SHARED_LIB : <target-os>windows : dll ;
67
+ type.set-generated-target-suffix SHARED_LIB : <target-os>cygwin : dll ;
68
+ type.set-generated-target-suffix SHARED_LIB : <target-os>darwin : dylib ;
69
+
70
+ type SEARCHED_LIB : : LIB ;
71
+ # This is needed so that when we create a target of SEARCHED_LIB
72
+ # type, there's no prefix or suffix automatically added.
73
+ type.set-generated-target-prefix SEARCHED_LIB : : "" ;
74
+ type.set-generated-target-suffix SEARCHED_LIB : : "" ;
mosesdecoder/jam-files/boost-build/tools/types/rsp.jam ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # Copyright David Abrahams 2004. Distributed under the Boost
2
+ # Software License, Version 1.0. (See accompanying
3
+ # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
+ type RSP : rsp ;
mosesdecoder/jam-files/boost-build/tools/whale.jam ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) Vladimir Prus 2002-2005.
2
+
3
+ # Use, modification and distribution is subject to the Boost Software
4
+ # License Version 1.0. (See accompanying file LICENSE_1_0.txt or
5
+ # http://www.boost.org/LICENSE_1_0.txt)
6
+
7
+ # This module implements support for Whale/Dolphin/WD parser/lexer tools.
8
+ # See http://www.cs.queensu.ca/home/okhotin/whale/ for details.
9
+ #
10
+ # There are three interesting target types:
11
+ # - WHL (the parser sources), that are converted to CPP and H
12
+ # - DLP (the lexer sources), that are converted to CPP and H
13
+ # - WD (combined parser/lexer sources), that are converted to WHL + DLP
14
+
15
+ import type ;
16
+ import generators ;
17
+ import path ;
18
+ import "class" : new ;
19
+ import errors ;
20
+
21
+ rule init ( path # path the Whale/Dolphin/WD binaries
22
+ )
23
+ {
24
+ if $(.configured) && $(.path) != $(path)
25
+ {
26
+ errors.user-error "Attempt to reconfigure Whale support" :
27
+ "Previously configured with path \"$(.path:E=<empty>)\"" :
28
+ "Now configuring with path \"$(path:E=<empty>)\"" ;
29
+
30
+ }
31
+ .configured = true ;
32
+ .path = $(path) ;
33
+
34
+ .whale = [ path.join $(path) whale ] ;
35
+ .dolphin = [ path.join $(path) dolphin ] ;
36
+ .wd = [ path.join $(path) wd ] ;
37
+ }
38
+
39
+
40
+ # Declare the types.
41
+ type.register WHL : whl ;
42
+ type.register DLP : dlp ;
43
+ type.register WHL_LR0 : lr0 ;
44
+ type.register WD : wd ;
45
+
46
+ # Declare standard generators.
47
+ generators.register-standard whale.whale : WHL : CPP H H(%_symbols) ;
48
+ generators.register-standard whale.dolphin : DLP : CPP H ;
49
+ generators.register-standard whale.wd : WD : WHL(%_parser) DLP(%_lexer) ;
50
+
51
+ # The conversions defines above a ambiguious when we generated CPP from WD.
52
+ # We can either go via WHL type, or via DLP type.
53
+ # The following custom generator handles this by running both conversions.
54
+
55
+ class wd-to-cpp : generator
56
+ {
57
+ rule __init__ ( * : * : * )
58
+ {
59
+ generator.__init__ $(1) : $(2) : $(3) ;
60
+ }
61
+
62
+ rule run ( project name ? : property-set : source * )
63
+ {
64
+ if ! $(source[2])
65
+ {
66
+ local new-sources ;
67
+ if ! [ $(source).type ] in WHL DLP
68
+ {
69
+ local r1 = [ generators.construct $(project) $(name)
70
+ : WHL : $(property-set) : $(source) ] ;
71
+ local r2 = [ generators.construct $(project) $(name)
72
+ : DLP : $(property-set) : $(source) ] ;
73
+
74
+ new-sources = [ sequence.unique $(r1[2-]) $(r2[2-]) ] ;
75
+ }
76
+ else
77
+ {
78
+ new-sources = $(source) ;
79
+ }
80
+
81
+ local result ;
82
+ for local i in $(new-sources)
83
+ {
84
+ local t = [ generators.construct $(project) $(name) : CPP
85
+ : $(property-set) : $(i) ] ;
86
+ result += $(t[2-]) ;
87
+ }
88
+ return $(result) ;
89
+ }
90
+ }
91
+
92
+ }
93
+
94
+
95
+ generators.override whale.wd-to-cpp : whale.whale ;
96
+ generators.override whale.wd-to-cpp : whale.dolphin ;
97
+
98
+
99
+ generators.register [ new wd-to-cpp whale.wd-to-cpp : : CPP ] ;
100
+
101
+
102
+ actions whale
103
+ {
104
+ $(.whale) -d $(<[1]:D) $(>)
105
+ }
106
+
107
+ actions dolphin
108
+ {
109
+ $(.dolphin) -d $(<[1]:D) $(>)
110
+ }
111
+
112
+ actions wd
113
+ {
114
+ $(.wd) -d $(<[1]:D) -g $(>)
115
+ }
116
+
mosesdecoder/jam-files/boost-build/tools/xlf.jam ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2004 Toon Knapen
2
+ #
3
+ # Use, modification and distribution is subject to the Boost Software
4
+ # License Version 1.0. (See accompanying file LICENSE_1_0.txt or
5
+ # http://www.boost.org/LICENSE_1_0.txt)
6
+
7
+ #
8
+ # toolset configuration for the IBM Fortran compiler (xlf)
9
+ #
10
+
11
+ import toolset : flags ;
12
+ import feature ;
13
+ import fortran ;
14
+
15
+ rule init ( version ? : command * : options * )
16
+ {
17
+ }
18
+
19
+ # Declare flags and action for compilation
20
+ flags xlf OPTIONS <optimization>off : -O0 ;
21
+ flags xlf OPTIONS <optimization>speed : -O3 ;
22
+ flags xlf OPTIONS <optimization>space : -Os ;
23
+
24
+ flags xlf OPTIONS <debug-symbols>on : -g ;
25
+ flags xlf OPTIONS <profiling>on : -pg ;
26
+
27
+ flags xlf DEFINES <define> ;
28
+ flags xlf INCLUDES <include> ;
29
+
30
+ rule compile-fortran
31
+ {
32
+ }
33
+
34
+ actions compile-fortran
35
+ {
36
+ xlf $(OPTIONS) -I$(INCLUDES) -c -o "$(<)" "$(>)"
37
+ }
38
+
39
+ generators.register-fortran-compiler xlf.compile-fortran : FORTRAN : OBJ ;
mosesdecoder/jam-files/boost-build/tools/xsltproc/included.xsl ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Copyright (c) 2010 Steven Watanabe
4
+
5
+ Distributed under the Boost Software License, Version 1.0.
6
+ (See accompanying file LICENSE_1_0.txt or copy at
7
+ http://www.boost.org/LICENSE_1_0.txt)
8
+ -->
9
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10
+ version="1.0">
11
+ </xsl:stylesheet>
mosesdecoder/jam-files/boost-build/tools/xsltproc/test.xml ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <root/>