gitlab-pygments.rb 0.3.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +71 -0
  4. data/Gemfile +1 -1
  5. data/LICENSE +17 -0
  6. data/README.md +28 -1
  7. data/Rakefile +2 -5
  8. data/lexers +0 -0
  9. data/lib/pygments/mentos.py +19 -12
  10. data/lib/pygments/popen.rb +21 -4
  11. data/lib/pygments/version.rb +1 -1
  12. data/pygments.rb.gemspec +2 -0
  13. data/test/test_pygments.rb +13 -2
  14. data/vendor/custom_lexers/github.py +206 -3
  15. data/vendor/pygments-main/AUTHORS +41 -3
  16. data/vendor/pygments-main/CHANGES +132 -5
  17. data/vendor/pygments-main/LICENSE +1 -1
  18. data/vendor/pygments-main/Makefile +1 -1
  19. data/vendor/pygments-main/REVISION +1 -1
  20. data/vendor/pygments-main/docs/generate.py +1 -1
  21. data/vendor/pygments-main/docs/src/api.txt +1 -1
  22. data/vendor/pygments-main/docs/src/index.txt +1 -1
  23. data/vendor/pygments-main/docs/src/integrate.txt +5 -0
  24. data/vendor/pygments-main/docs/src/java.txt +70 -0
  25. data/vendor/pygments-main/docs/src/lexerdevelopment.txt +52 -0
  26. data/vendor/pygments-main/external/autopygmentize +64 -0
  27. data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +144 -0
  28. data/vendor/pygments-main/external/markdown-processor.py +2 -2
  29. data/vendor/pygments-main/external/moin-parser.py +1 -1
  30. data/vendor/pygments-main/external/rst-directive-old.py +1 -1
  31. data/vendor/pygments-main/external/rst-directive.py +1 -1
  32. data/vendor/pygments-main/pygmentize +1 -1
  33. data/vendor/pygments-main/pygments/__init__.py +2 -2
  34. data/vendor/pygments-main/pygments/cmdline.py +14 -6
  35. data/vendor/pygments-main/pygments/console.py +1 -1
  36. data/vendor/pygments-main/pygments/filter.py +1 -1
  37. data/vendor/pygments-main/pygments/filters/__init__.py +3 -4
  38. data/vendor/pygments-main/pygments/formatter.py +4 -1
  39. data/vendor/pygments-main/pygments/formatters/__init__.py +1 -1
  40. data/vendor/pygments-main/pygments/formatters/_mapping.py +3 -3
  41. data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
  42. data/vendor/pygments-main/pygments/formatters/html.py +73 -2
  43. data/vendor/pygments-main/pygments/formatters/img.py +2 -2
  44. data/vendor/pygments-main/pygments/formatters/latex.py +9 -9
  45. data/vendor/pygments-main/pygments/formatters/other.py +1 -3
  46. data/vendor/pygments-main/pygments/formatters/rtf.py +1 -1
  47. data/vendor/pygments-main/pygments/formatters/svg.py +1 -1
  48. data/vendor/pygments-main/pygments/formatters/terminal.py +1 -1
  49. data/vendor/pygments-main/pygments/formatters/terminal256.py +1 -1
  50. data/vendor/pygments-main/pygments/lexer.py +78 -10
  51. data/vendor/pygments-main/pygments/lexers/__init__.py +13 -2
  52. data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1 -1
  53. data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +1 -1
  54. data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +5172 -0
  55. data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +1 -1
  56. data/vendor/pygments-main/pygments/lexers/_mapping.py +92 -36
  57. data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +562 -0
  58. data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +2 -2
  59. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +4 -3
  60. data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +557 -0
  61. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +11 -0
  62. data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +1072 -0
  63. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +360 -0
  64. data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +13 -3
  65. data/vendor/pygments-main/pygments/lexers/agile.py +525 -38
  66. data/vendor/pygments-main/pygments/lexers/asm.py +45 -7
  67. data/vendor/pygments-main/pygments/lexers/compiled.py +1257 -425
  68. data/vendor/pygments-main/pygments/lexers/dalvik.py +104 -0
  69. data/vendor/pygments-main/pygments/lexers/dotnet.py +97 -62
  70. data/vendor/pygments-main/pygments/lexers/foxpro.py +428 -0
  71. data/vendor/pygments-main/pygments/lexers/functional.py +931 -32
  72. data/vendor/pygments-main/pygments/lexers/github.py +206 -3
  73. data/vendor/pygments-main/pygments/lexers/hdl.py +3 -3
  74. data/vendor/pygments-main/pygments/lexers/jvm.py +309 -44
  75. data/vendor/pygments-main/pygments/lexers/math.py +876 -30
  76. data/vendor/pygments-main/pygments/lexers/other.py +956 -517
  77. data/vendor/pygments-main/pygments/lexers/parsers.py +85 -2
  78. data/vendor/pygments-main/pygments/lexers/shell.py +81 -18
  79. data/vendor/pygments-main/pygments/lexers/special.py +1 -1
  80. data/vendor/pygments-main/pygments/lexers/sql.py +2 -2
  81. data/vendor/pygments-main/pygments/lexers/templates.py +119 -8
  82. data/vendor/pygments-main/pygments/lexers/text.py +155 -15
  83. data/vendor/pygments-main/pygments/lexers/web.py +1578 -397
  84. data/vendor/pygments-main/pygments/modeline.py +40 -0
  85. data/vendor/pygments-main/pygments/plugin.py +1 -1
  86. data/vendor/pygments-main/pygments/scanner.py +1 -1
  87. data/vendor/pygments-main/pygments/style.py +1 -1
  88. data/vendor/pygments-main/pygments/styles/__init__.py +1 -1
  89. data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
  90. data/vendor/pygments-main/pygments/styles/borland.py +1 -1
  91. data/vendor/pygments-main/pygments/styles/bw.py +1 -1
  92. data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
  93. data/vendor/pygments-main/pygments/styles/default.py +1 -1
  94. data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
  95. data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
  96. data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
  97. data/vendor/pygments-main/pygments/styles/manni.py +1 -1
  98. data/vendor/pygments-main/pygments/styles/monokai.py +1 -1
  99. data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
  100. data/vendor/pygments-main/pygments/styles/native.py +1 -1
  101. data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
  102. data/vendor/pygments-main/pygments/styles/perldoc.py +1 -1
  103. data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
  104. data/vendor/pygments-main/pygments/styles/tango.py +1 -1
  105. data/vendor/pygments-main/pygments/styles/trac.py +1 -1
  106. data/vendor/pygments-main/pygments/styles/vim.py +1 -1
  107. data/vendor/pygments-main/pygments/styles/vs.py +1 -1
  108. data/vendor/pygments-main/pygments/token.py +1 -1
  109. data/vendor/pygments-main/pygments/unistring.py +36 -26
  110. data/vendor/pygments-main/pygments/util.py +46 -1
  111. data/vendor/pygments-main/scripts/check_sources.py +2 -2
  112. data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +2 -0
  113. data/vendor/pygments-main/scripts/find_codetags.py +1 -1
  114. data/vendor/pygments-main/scripts/find_error.py +5 -6
  115. data/vendor/pygments-main/setup.cfg +1 -0
  116. data/vendor/pygments-main/setup.py +6 -4
  117. data/vendor/pygments-main/tests/examplefiles/BOM.js +1 -0
  118. data/vendor/pygments-main/tests/examplefiles/Config.in.cache +1973 -0
  119. data/vendor/pygments-main/tests/examplefiles/Deflate.fs +578 -0
  120. data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +66 -0
  121. data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +104 -0
  122. data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +671 -0
  123. data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +23 -0
  124. data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +25 -0
  125. data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +308 -0
  126. data/vendor/pygments-main/tests/examplefiles/ca65_example +284 -0
  127. data/vendor/pygments-main/tests/examplefiles/cbmbas_example +9 -0
  128. data/vendor/pygments-main/tests/examplefiles/classes.dylan +89 -4
  129. data/vendor/pygments-main/tests/examplefiles/example.Rd +78 -0
  130. data/vendor/pygments-main/tests/examplefiles/example.bug +54 -0
  131. data/vendor/pygments-main/tests/examplefiles/example.ceylon +52 -0
  132. data/vendor/pygments-main/tests/examplefiles/example.clay +33 -0
  133. data/vendor/pygments-main/tests/examplefiles/example.cob +3556 -0
  134. data/vendor/pygments-main/tests/examplefiles/example.hx +142 -0
  135. data/vendor/pygments-main/tests/examplefiles/example.jag +48 -0
  136. data/vendor/pygments-main/tests/examplefiles/example.lagda +19 -0
  137. data/vendor/pygments-main/tests/examplefiles/example.monkey +152 -0
  138. data/vendor/pygments-main/tests/examplefiles/example.msc +43 -0
  139. data/vendor/pygments-main/tests/examplefiles/example.prg +161 -0
  140. data/vendor/pygments-main/tests/examplefiles/example.reg +19 -0
  141. data/vendor/pygments-main/tests/examplefiles/example.rexx +50 -0
  142. data/vendor/pygments-main/tests/examplefiles/example.rkt +95 -0
  143. data/vendor/pygments-main/tests/examplefiles/example.rpf +4 -0
  144. data/vendor/pygments-main/tests/examplefiles/example.shell-session +45 -0
  145. data/vendor/pygments-main/tests/examplefiles/example.stan +108 -0
  146. data/vendor/pygments-main/tests/examplefiles/example.ts +28 -0
  147. data/vendor/pygments-main/tests/examplefiles/example.xtend +34 -0
  148. data/vendor/pygments-main/tests/examplefiles/example2.msc +79 -0
  149. data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +133 -0
  150. data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +22 -0
  151. data/vendor/pygments-main/tests/examplefiles/hello.smali +40 -0
  152. data/vendor/pygments-main/tests/examplefiles/hello.sp +9 -0
  153. data/vendor/pygments-main/tests/examplefiles/http_request_example +2 -1
  154. data/vendor/pygments-main/tests/examplefiles/http_response_example +4 -2
  155. data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +71 -0
  156. data/vendor/pygments-main/tests/examplefiles/json.lasso +301 -0
  157. data/vendor/pygments-main/tests/examplefiles/json.lasso9 +213 -0
  158. data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +41 -0
  159. data/vendor/pygments-main/tests/examplefiles/logos_example.xm +28 -0
  160. data/vendor/pygments-main/tests/examplefiles/matlab_sample +5 -2
  161. data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +455 -0
  162. data/vendor/pygments-main/tests/examplefiles/mg_sample.pro +73 -0
  163. data/vendor/pygments-main/tests/examplefiles/minehunt.qml +112 -0
  164. data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +95 -0
  165. data/vendor/pygments-main/tests/examplefiles/objc_example.m +7 -0
  166. data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +163 -0
  167. data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +4 -0
  168. data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +4 -0
  169. data/vendor/pygments-main/tests/examplefiles/robotframework.txt +39 -0
  170. data/vendor/pygments-main/tests/examplefiles/rust_example.rs +233 -0
  171. data/vendor/pygments-main/tests/examplefiles/session.dylan-console +9 -0
  172. data/vendor/pygments-main/tests/examplefiles/swig_java.swg +1329 -0
  173. data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +225 -0
  174. data/vendor/pygments-main/tests/examplefiles/test.R +149 -115
  175. data/vendor/pygments-main/tests/examplefiles/test.agda +102 -0
  176. data/vendor/pygments-main/tests/examplefiles/test.bb +95 -0
  177. data/vendor/pygments-main/tests/examplefiles/test.cu +36 -0
  178. data/vendor/pygments-main/tests/examplefiles/test.ebnf +31 -0
  179. data/vendor/pygments-main/tests/examplefiles/test.opa +10 -0
  180. data/vendor/pygments-main/tests/examplefiles/test.p6 +252 -0
  181. data/vendor/pygments-main/tests/examplefiles/test2.pypylog +120 -0
  182. data/vendor/pygments-main/tests/examplefiles/type.lisp +16 -0
  183. data/vendor/pygments-main/tests/examplefiles/unix-io.lid +37 -0
  184. data/vendor/pygments-main/tests/old_run.py +1 -1
  185. data/vendor/pygments-main/tests/run.py +3 -2
  186. data/vendor/pygments-main/tests/support/tags +36 -0
  187. data/vendor/pygments-main/tests/test_basic_api.py +4 -3
  188. data/vendor/pygments-main/tests/test_clexer.py +1 -1
  189. data/vendor/pygments-main/tests/test_cmdline.py +1 -1
  190. data/vendor/pygments-main/tests/test_examplefiles.py +3 -1
  191. data/vendor/pygments-main/tests/test_html_formatter.py +17 -1
  192. data/vendor/pygments-main/tests/test_latex_formatter.py +1 -1
  193. data/vendor/pygments-main/tests/test_lexers_other.py +68 -0
  194. data/vendor/pygments-main/tests/test_perllexer.py +1 -1
  195. data/vendor/pygments-main/tests/test_regexlexer.py +1 -1
  196. data/vendor/pygments-main/tests/test_token.py +1 -1
  197. data/vendor/pygments-main/tests/test_using_api.py +1 -1
  198. data/vendor/pygments-main/tests/test_util.py +22 -3
  199. metadata +84 -16
@@ -0,0 +1,23 @@
1
+ role q {
2
+ token stopper { \' }
3
+
4
+ token escape:sym<\\> { <sym> <item=.backslash> }
5
+
6
+ token backslash:sym<qq> { <?before 'q'> <quote=.LANG('MAIN','quote')> }
7
+ token backslash:sym<\\> { <text=.sym> }
8
+ token backslash:sym<stopper> { <text=.stopper> }
9
+
10
+ token backslash:sym<miscq> { {} . }
11
+
12
+ method tweak_q($v) { self.panic("Too late for :q") }
13
+ method tweak_qq($v) { self.panic("Too late for :qq") }
14
+ }
15
+
16
+ role qq does b1 does c1 does s1 does a1 does h1 does f1 {
17
+ token stopper { \" }
18
+ token backslash:sym<unrec> { {} (\w) { self.throw_unrecog_backslash_seq: $/[0].Str } }
19
+ token backslash:sym<misc> { \W }
20
+
21
+ method tweak_q($v) { self.panic("Too late for :q") }
22
+ method tweak_qq($v) { self.panic("Too late for :qq") }
23
+ }
@@ -0,0 +1,25 @@
1
+ #include <IE.au3>
2
+ ;http://msdn.microsoft.com/en-us/library/Aa752084.aspx
3
+ $ourl="http://localhost:5000/"
4
+
5
+ $oIE = _IEAttach ($ourl,"url")
6
+ If @error = $_IEStatus_NoMatch Then
7
+ $oIE = _IECreate ($ourl & "sample.html")
8
+ endIf
9
+
10
+ $oForm = _IEFormGetObjByName ($oIE, "form1")
11
+ ;username, call DOM directly
12
+ $oIE.document.getElementById("username").value="helloAutoIT"
13
+ ;state select
14
+ $oSelect = _IEFormElementGetObjByName ($oForm, "state")
15
+ _IEFormElementOptionSelect ($oSelect, "S2", 1, "byText")
16
+ ;options raido
17
+ _IEFormElementRadioSelect($oForm, "2nd", "type", 1, "byValue")
18
+
19
+ ConsoleWrite(@Error)
20
+ Sleep(10000)
21
+ _IEFormSubmit($oForm, 0)
22
+ _IELoadWait($oIE)
23
+ Sleep(60000)
24
+ _IEQuit($oIE)
25
+
@@ -0,0 +1,308 @@
1
+ ; bigtest.nsi
2
+ ;
3
+ ; This script attempts to test most of the functionality of the NSIS exehead.
4
+
5
+ ;--------------------------------
6
+
7
+ !ifdef HAVE_UPX
8
+ !packhdr tmp.dat "upx\upx -9 tmp.dat"
9
+ !endif
10
+
11
+ !ifdef NOCOMPRESS
12
+ SetCompress off
13
+ !endif
14
+
15
+ ;--------------------------------
16
+
17
+ Name "BigNSISTest"
18
+ Caption "NSIS Big Test"
19
+ Icon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-install.ico"
20
+ OutFile "bigtest.exe"
21
+
22
+ SetDateSave on
23
+ SetDatablockOptimize on
24
+ CRCCheck on
25
+ SilentInstall normal
26
+ BGGradient 000000 800000 FFFFFF
27
+ InstallColors FF8080 000030
28
+ XPStyle on
29
+
30
+ InstallDir "$PROGRAMFILES\NSISTest\BigNSISTest"
31
+ InstallDirRegKey HKLM "Software\NSISTest\BigNSISTest" "Install_Dir"
32
+
33
+ CheckBitmap "${NSISDIR}\Contrib\Graphics\Checks\classic-cross.bmp"
34
+
35
+ LicenseText "A test text, make sure it's all there"
36
+ LicenseData "bigtest.nsi"
37
+
38
+ RequestExecutionLevel admin
39
+
40
+ ;--------------------------------
41
+
42
+ Page license
43
+ Page components
44
+ Page directory
45
+ Page instfiles
46
+
47
+ UninstPage uninstConfirm
48
+ UninstPage instfiles
49
+
50
+ ;--------------------------------
51
+
52
+ !ifndef NOINSTTYPES ; only if not defined
53
+ InstType "Most"
54
+ InstType "Full"
55
+ InstType "More"
56
+ InstType "Base"
57
+ ;InstType /NOCUSTOM
58
+ ;InstType /COMPONENTSONLYONCUSTOM
59
+ !endif
60
+
61
+ AutoCloseWindow false
62
+ ShowInstDetails show
63
+
64
+ ;--------------------------------
65
+
66
+ Section "" ; empty string makes it hidden, so would starting with -
67
+
68
+ ; write reg info
69
+ StrCpy $1 "POOOOOOOOOOOP"
70
+ DetailPrint "I like to be able to see what is going on (debug) $1"
71
+ WriteRegStr HKLM SOFTWARE\NSISTest\BigNSISTest "Install_Dir" "$INSTDIR"
72
+
73
+ ; write uninstall strings
74
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest" "DisplayName" "BigNSISTest (remove only)"
75
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest" "UninstallString" '"$INSTDIR\bt-uninst.exe"'
76
+
77
+ SetOutPath $INSTDIR
78
+ File /a "silent.nsi"
79
+ CreateDirectory "$INSTDIR\MyProjectFamily\MyProject" ; 2 recursively create a directory for fun.
80
+ WriteUninstaller "bt-uninst.exe"
81
+
82
+ Nop ; for fun
83
+
84
+ SectionEnd
85
+
86
+ Section "TempTest"
87
+
88
+ SectionIn 1 2 3
89
+ Start: MessageBox MB_OK "Start:"
90
+
91
+ MessageBox MB_YESNO "Goto MyLabel" IDYES MyLabel
92
+
93
+ MessageBox MB_OK "Right before MyLabel:"
94
+
95
+ MyLabel: MessageBox MB_OK "MyLabel:"
96
+
97
+ MessageBox MB_OK "Right after MyLabel:"
98
+
99
+ MessageBox MB_YESNO "Goto Start:?" IDYES Start
100
+
101
+ SectionEnd
102
+
103
+ SectionGroup /e SectionGroup1
104
+
105
+ Section "Test Registry/INI functions"
106
+
107
+ SectionIn 1 4 3
108
+
109
+ WriteRegStr HKLM SOFTWARE\NSISTest\BigNSISTest "StrTest_INSTDIR" "$INSTDIR"
110
+ WriteRegDword HKLM SOFTWARE\NSISTest\BigNSISTest "DwordTest_0xDEADBEEF" 0xdeadbeef
111
+ WriteRegDword HKLM SOFTWARE\NSISTest\BigNSISTest "DwordTest_123456" 123456
112
+ WriteRegDword HKLM SOFTWARE\NSISTest\BigNSISTest "DwordTest_0123" 0123
113
+ WriteRegBin HKLM SOFTWARE\NSISTest\BigNSISTest "BinTest_deadbeef01f00dbeef" "DEADBEEF01F00DBEEF"
114
+ StrCpy $8 "$SYSDIR\IniTest"
115
+ WriteINIStr "$INSTDIR\test.ini" "MySection" "Value1" $8
116
+ WriteINIStr "$INSTDIR\test.ini" "MySectionIni" "Value1" $8
117
+ WriteINIStr "$INSTDIR\test.ini" "MySectionIni" "Value2" $8
118
+ WriteINIStr "$INSTDIR\test.ini" "IniOn" "Value1" $8
119
+
120
+ Call MyFunctionTest
121
+
122
+ DeleteINIStr "$INSTDIR\test.ini" "IniOn" "Value1"
123
+ DeleteINISec "$INSTDIR\test.ini" "MySectionIni"
124
+
125
+ ReadINIStr $1 "$INSTDIR\test.ini" "MySectionIni" "Value1"
126
+ StrCmp $1 "" INIDelSuccess
127
+ MessageBox MB_OK "DeleteINISec failed"
128
+ INIDelSuccess:
129
+
130
+ ClearErrors
131
+ ReadRegStr $1 HKCR "software\microsoft" xyz_cc_does_not_exist
132
+ IfErrors 0 NoError
133
+ MessageBox MB_OK "could not read from HKCR\software\microsoft\xyz_cc_does_not_exist"
134
+ Goto ErrorYay
135
+ NoError:
136
+ MessageBox MB_OK "read '$1' from HKCR\software\microsoft\xyz_cc_does_not_exist"
137
+ ErrorYay:
138
+
139
+ SectionEnd
140
+
141
+ Section "Test CreateShortCut"
142
+
143
+ SectionIn 1 2 3
144
+
145
+ Call CSCTest
146
+
147
+ SectionEnd
148
+
149
+ SectionGroup Group2
150
+
151
+ Section "Test Branching"
152
+
153
+ BeginTestSection:
154
+ SectionIn 1 2 3
155
+
156
+ SetOutPath $INSTDIR
157
+
158
+ IfFileExists "$INSTDIR\LogicLib.nsi" 0 BranchTest69
159
+
160
+ MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to overwrite $INSTDIR\LogicLib.nsi?" IDNO NoOverwrite ; skipped if file doesn't exist
161
+
162
+ BranchTest69:
163
+
164
+ SetOverwrite ifnewer ; NOT AN INSTRUCTION, NOT COUNTED IN SKIPPINGS
165
+
166
+ NoOverwrite:
167
+
168
+ File "LogicLib.nsi" ; skipped if answered no
169
+ SetOverwrite try ; NOT AN INSTRUCTION, NOT COUNTED IN SKIPPINGS
170
+
171
+ MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to skip the rest of this section?" IDYES EndTestBranch
172
+ MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to go back to the beginning of this section?" IDYES BeginTestSection
173
+ MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to hide the installer and wait five seconds?" IDNO NoHide
174
+
175
+ HideWindow
176
+ Sleep 5000
177
+ BringToFront
178
+
179
+ NoHide:
180
+
181
+ MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to call the function 5 times?" IDNO NoRecurse
182
+
183
+ StrCpy $1 "x"
184
+
185
+ LoopTest:
186
+
187
+ Call myfunc
188
+ StrCpy $1 "x$1"
189
+ StrCmp $1 "xxxxxx" 0 LoopTest
190
+
191
+ NoRecurse:
192
+
193
+ EndTestBranch:
194
+
195
+ SectionEnd
196
+
197
+ SectionGroupEnd
198
+
199
+ Section "Test CopyFiles"
200
+
201
+ SectionIn 1 2 3
202
+
203
+ SetOutPath $INSTDIR\cpdest
204
+ CopyFiles "$WINDIR\*.ini" "$INSTDIR\cpdest" 0
205
+
206
+ SectionEnd
207
+
208
+ SectionGroupEnd
209
+
210
+ Section "Test Exec functions" TESTIDX
211
+
212
+ SectionIn 1 2 3
213
+
214
+ SearchPath $1 notepad.exe
215
+
216
+ MessageBox MB_OK "notepad.exe=$1"
217
+ Exec '"$1"'
218
+ ExecShell "open" '"$INSTDIR"'
219
+ Sleep 500
220
+ BringToFront
221
+
222
+ SectionEnd
223
+
224
+ Section "Test ActiveX control registration"
225
+
226
+ SectionIn 2
227
+
228
+ UnRegDLL "$SYSDIR\spin32.ocx"
229
+ Sleep 1000
230
+ RegDLL "$SYSDIR\spin32.ocx"
231
+ Sleep 1000
232
+
233
+ SectionEnd
234
+
235
+ ;--------------------------------
236
+
237
+ Function "CSCTest"
238
+
239
+ CreateDirectory "$SMPROGRAMS\Big NSIS Test"
240
+ SetOutPath $INSTDIR ; for working directory
241
+ CreateShortCut "$SMPROGRAMS\Big NSIS Test\Uninstall BIG NSIS Test.lnk" "$INSTDIR\bt-uninst.exe" ; use defaults for parameters, icon, etc.
242
+ ; this one will use notepad's icon, start it minimized, and give it a hotkey (of Ctrl+Shift+Q)
243
+ CreateShortCut "$SMPROGRAMS\Big NSIS Test\silent.nsi.lnk" "$INSTDIR\silent.nsi" "" "$WINDIR\notepad.exe" 0 SW_SHOWMINIMIZED CONTROL|SHIFT|Q
244
+ CreateShortCut "$SMPROGRAMS\Big NSIS Test\TheDir.lnk" "$INSTDIR\" "" "" 0 SW_SHOWMAXIMIZED CONTROL|SHIFT|Z
245
+
246
+ FunctionEnd
247
+
248
+ Function myfunc
249
+
250
+ StrCpy $2 "MyTestVar=$1"
251
+ MessageBox MB_OK "myfunc: $2"
252
+
253
+ FunctionEnd
254
+
255
+ Function MyFunctionTest
256
+
257
+ ReadINIStr $1 "$INSTDIR\test.ini" "MySectionIni" "Value1"
258
+ StrCmp $1 $8 NoFailedMsg
259
+ MessageBox MB_OK "WriteINIStr failed"
260
+
261
+ NoFailedMsg:
262
+
263
+ FunctionEnd
264
+
265
+ Function .onSelChange
266
+
267
+ SectionGetText ${TESTIDX} $0
268
+ StrCmp $0 "" e
269
+ SectionSetText ${TESTIDX} ""
270
+ Goto e2
271
+ e:
272
+ SectionSetText ${TESTIDX} "TextInSection"
273
+ e2:
274
+
275
+ FunctionEnd
276
+
277
+ ;--------------------------------
278
+
279
+ ; Uninstaller
280
+
281
+ UninstallText "This will uninstall example2. Hit next to continue."
282
+ UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-uninstall.ico"
283
+
284
+ Section "Uninstall"
285
+
286
+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest"
287
+ DeleteRegKey HKLM "SOFTWARE\NSISTest\BigNSISTest"
288
+ Delete "$INSTDIR\silent.nsi"
289
+ Delete "$INSTDIR\LogicLib.nsi"
290
+ Delete "$INSTDIR\bt-uninst.exe"
291
+ Delete "$INSTDIR\test.ini"
292
+ Delete "$SMPROGRAMS\Big NSIS Test\*.*"
293
+ RMDir "$SMPROGRAMS\BiG NSIS Test"
294
+
295
+ MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to remove the directory $INSTDIR\cpdest?" IDNO NoDelete
296
+ Delete "$INSTDIR\cpdest\*.*"
297
+ RMDir "$INSTDIR\cpdest" ; skipped if no
298
+ NoDelete:
299
+
300
+ RMDir "$INSTDIR\MyProjectFamily\MyProject"
301
+ RMDir "$INSTDIR\MyProjectFamily"
302
+ RMDir "$INSTDIR"
303
+
304
+ IfFileExists "$INSTDIR" 0 NoErrorMsg
305
+ MessageBox MB_OK "Note: $INSTDIR could not be removed!" IDOK 0 ; skipped if file doesn't exist
306
+ NoErrorMsg:
307
+
308
+ SectionEnd
@@ -0,0 +1,284 @@
1
+ ;--------------------------------------
2
+ ; Lychrel numbers.
3
+ ;
4
+ ; :author: Marc 'BlackJack' Rintsch
5
+ ; :date: 2008-03-07
6
+ ; :version: 0.1
7
+ ;
8
+ ; Prints all `Lychrel numbers`_ between 1 and 100000.
9
+ ;
10
+ ; The numbers are stored as array of "digits" in little endian
11
+ ; order. Each digit is a byte with a value between 0 and 9.
12
+ ;
13
+ ; Runtime on C64: 00:21:01
14
+ ;
15
+ ; .. _Lychrel numbers: http://en.wikipedia.org/wiki/Lychrel_number
16
+ ;
17
+ ; .. cl65 -l -tnone -C simple.cfg lychrel.s -o lychrel.prg
18
+ ;--------------------------------------
19
+
20
+ ;--------------------------------------
21
+ ; External addresses.
22
+ ;--------------------------------------
23
+ chrout = $ffd2
24
+
25
+ ;--------------------------------------
26
+ ; Constants.
27
+ ;--------------------------------------
28
+ TO = 100000
29
+ TO_DIGITS = 10
30
+ ITERATIONS = 100
31
+ MAX_DIGITS = TO_DIGITS + ITERATIONS
32
+
33
+ ;--------------------------------------
34
+ ; Global variables.
35
+ ;--------------------------------------
36
+ .zeropage
37
+ ;
38
+ ; Length of the currently tested `n` in digits.
39
+ ;
40
+ n_length:
41
+ .res 1
42
+ ;
43
+ ; Length of the number(s) `xa` and `xb` while testing.
44
+ ;
45
+ length:
46
+ .res 1
47
+
48
+ .bss
49
+ ;
50
+ ; Number to be tested as digits i.e. bytes with values between
51
+ ; 0 and 9. The length is stored in `n_length`.
52
+ ;
53
+ n:
54
+ .res TO_DIGITS
55
+ ;
56
+ ; Space for calculating the reversed and added values.
57
+ ; In the `main` code the current number is copied into `xa`
58
+ ; and then repeatedly `reverse_add`\ed to itself with the
59
+ ; result of that adding stored in `xb`.
60
+ ;
61
+ xa:
62
+ .res MAX_DIGITS
63
+ xb:
64
+ .res MAX_DIGITS
65
+
66
+ ;--------------------------------------
67
+ ; BASIC header.
68
+ ;--------------------------------------
69
+ .code
70
+ .word 0800h ; Load address.
71
+ .byte 0
72
+ .word @line_end
73
+ .word 2008 ; Line number.
74
+ .byte $9e ; SYS token.
75
+ .byte "2080 " ; SYS argument.
76
+ .byte "LYCHREL NUMBERS/BJ"
77
+ @line_end:
78
+ .byte 0, 0, 0 ; Line and program end marker.
79
+
80
+ ;--------------------------------------
81
+ ; Main program.
82
+ ;--------------------------------------
83
+ .proc main
84
+
85
+ .zeropage
86
+ ;
87
+ ; Three byte counter for `TO` iterations (100000 = $0186a0).
88
+ ;
89
+ i:
90
+ .res 3
91
+
92
+ .code
93
+ ;
94
+ ; Clear and set `n` and `i` to 1.
95
+ ;
96
+ lda #0 ; n := 0; n := 1; i := 1
97
+ sta i+1
98
+ sta i+2
99
+ ldx #TO_DIGITS
100
+ clear_n:
101
+ sta n-1,x
102
+ dex
103
+ bne clear_n
104
+ inx
105
+ stx i
106
+ stx n
107
+ stx n_length
108
+
109
+ mainloop:
110
+ jsr is_lychrel
111
+ bcc no_lychrel
112
+ jsr print_n
113
+ no_lychrel:
114
+ jsr increase_n
115
+
116
+ inc i ; INC(i)
117
+ bne skip
118
+ inc i+1
119
+ bne skip
120
+ inc i+2
121
+ skip:
122
+ lda i
123
+ cmp #<TO
124
+ bne mainloop
125
+ lda i+1
126
+ cmp #>TO
127
+ bne mainloop
128
+ lda i+2
129
+ cmp #^TO
130
+ bne mainloop
131
+
132
+ rts
133
+ .endproc
134
+
135
+ ;--------------------------------------
136
+ ; Print `n` and a trailing newline.
137
+ ;
138
+ ; :in: `n_length`, `n`
139
+ ;--------------------------------------
140
+ .proc print_n
141
+ ldy n_length
142
+ L1:
143
+ lda n-1,y
144
+ ora #%110000 ; = '0'
145
+ jsr chrout
146
+ dey
147
+ bne L1
148
+
149
+ lda #13
150
+ jmp chrout
151
+ .endproc
152
+
153
+ ;--------------------------------------
154
+ ; Increase `n` by one.
155
+ ;
156
+ ; This procedure expects n[n_length] == 0 in case the number gets
157
+ ; one digit longer.
158
+ ;
159
+ ; :in: `n`, `n_length`
160
+ ; :out: `n`, `n_length`
161
+ ;--------------------------------------
162
+ .proc increase_n
163
+ ldx #0
164
+ L1:
165
+ inc n,x ; Increase digit.
166
+ lda n,x
167
+ cmp #10 ; If "carry", store 0 and go to next digit.
168
+ bne return
169
+ lda #0
170
+ sta n,x
171
+ inx
172
+ bne L1
173
+ return:
174
+ cpx n_length ; If "carry" after last digit, increase length.
175
+ bcc skip
176
+ inc n_length
177
+ skip:
178
+ rts
179
+ .endproc
180
+
181
+ ;--------------------------------------
182
+ ; Tests if `n` is a Lychrel number.
183
+ ;
184
+ ; :in: `n`, `n_length`
185
+ ; :out: C is set if yes, cleared otherwise.
186
+ ; :uses: `length`, `xa`, `xb`
187
+ ;--------------------------------------
188
+ .proc is_lychrel
189
+ .zeropage
190
+ i:
191
+ .res 1
192
+
193
+ .code
194
+ ldx n_length ; xa := n; length := n_length
195
+ stx length
196
+ L1:
197
+ lda n-1,x
198
+ sta xa-1,x
199
+ dex
200
+ bne L1
201
+
202
+ lda #ITERATIONS ; i := ITERATIONS
203
+ sta i
204
+ L2:
205
+ jsr reverse_add
206
+ jsr is_palindrome
207
+ bne no_palindrome
208
+ clc
209
+ rts
210
+ no_palindrome:
211
+ ldx length ; a := b
212
+ L3:
213
+ lda xb-1,x
214
+ sta xa-1,x
215
+ dex
216
+ bne L3
217
+
218
+ dec i ; Loop body end.
219
+ bne L2
220
+
221
+ sec
222
+ rts
223
+ .endproc
224
+
225
+ ;--------------------------------------
226
+ ; Add the reverse to `xa` to itself and store the result in `xb`.
227
+ ;
228
+ ; :in: `length`, `xa`
229
+ ; :out: `length`, `xb`
230
+ ;--------------------------------------
231
+ .proc reverse_add
232
+ .code
233
+ ldx #0
234
+ ldy length
235
+ clc
236
+ L1:
237
+ lda xa,x
238
+ adc xa-1,y
239
+
240
+ cmp #10
241
+ bcc no_adjust
242
+ sbc #10
243
+ no_adjust:
244
+ sta xb,x
245
+
246
+ dey
247
+ inx
248
+ txa ; ``eor`` instead of ``cpx`` to keep the carry flag
249
+ eor length ; of the addition above.
250
+ bne L1
251
+
252
+ bcc no_carry
253
+ lda #1
254
+ sta xb,x
255
+ inc length
256
+ no_carry:
257
+ rts
258
+ .endproc
259
+
260
+ ;--------------------------------------
261
+ ; Checks if `xb` is a palindrome.
262
+ ;
263
+ ; :in: `length`, `xb`
264
+ ; :out: Z flag set if `xb` is a palindrome, cleared otherwise.
265
+ ;--------------------------------------
266
+ .proc is_palindrome
267
+ .code
268
+ ldx #0
269
+ lda length
270
+ tay
271
+ lsr
272
+ sta L1+1 ; Self modifying code!
273
+ L1:
274
+ cpx #0 ; <<< 0 replaced by (`length` / 2).
275
+ beq return
276
+ lda xb,x
277
+ cmp xb-1,y
278
+ bne return
279
+ dey
280
+ inx
281
+ bne L1
282
+ return:
283
+ rts
284
+ .endproc