├── GmodLua
├── COPYRIGHT
├── bin
│ ├── Config
│ │ └── GmodLua.xml
│ ├── Npp_Keywords.lua
│ ├── doc
│ │ └── GmodLua-readme.txt
│ └── install.txt
├── legacylib
│ ├── OldAccessor.h
│ ├── OldFontQuality.h
│ ├── OldKeyWords.cxx
│ ├── OldKeyWords.h
│ ├── OldPlatWin.cxx
│ ├── OldPlatform.h
│ ├── OldPlatformRes.h
│ ├── OldPropSet.cxx
│ ├── OldPropSet.h
│ ├── OldPropSetSimple.h
│ ├── OldSciLexer.h
│ ├── OldScintilla.h
│ ├── OldStyleContext.cxx
│ ├── OldStyleContext.h
│ ├── OldUniConversion.cxx
│ ├── OldUniConversion.h
│ ├── OldWindowAccessor.cxx
│ ├── OldWindowAccessor.h
│ ├── OldXPM.cxx
│ └── OldXPM.h
├── readme.txt
├── src
│ ├── GmodLua.cpp
│ ├── GmodLua.h
│ ├── GmodLua.rc
│ ├── GmodLua_Plugin.def
│ ├── Legacy.cpp
│ ├── Legacy.h
│ └── resource.h
└── vcbuild
│ ├── GmodLuaPlugin.vs2008.sln
│ └── vcbuild.vcproj
├── README.md
└── wiki
├── HowTos.wiki
└── IntroAndChangeLog.wiki
/GmodLua/COPYRIGHT:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/GmodLua/bin/Npp_Keywords.lua:
--------------------------------------------------------------------------------
1 | // outputs functions and keywords in Notepad++ xml format
2 |
3 | -- Do this to prevent "Infinite Loop Detected!"
4 | debug.sethook()
5 |
6 | require("glon")
7 | require("datastream")
8 |
9 | local output = {}
10 |
11 | output.libraries = {}
12 | output.libraryMethods = {}
13 |
14 | output.objectMethods = {}
15 |
16 | output.globalMethods = {}
17 |
18 | output.constants = {}
19 |
20 | output.flags = {}
21 |
22 | output.scriptedFunctions = {}
23 | output.scriptedVariables = {}
24 |
25 | local xside
26 |
27 | if ( SERVER ) then
28 | if file.Exists("client.txt") then
29 | xside = file.Read( "client.txt" )
30 | file.Delete("client.txt")
31 | end
32 | else
33 | if file.Exists("server.txt") then
34 | xside = file.Read( "server.txt" )
35 | file.Delete("server.txt")
36 | end
37 | end
38 |
39 | if xside then
40 | for _, v in pairs(string.Explode("`", xside)) do
41 | local all = string.Explode("~", v)
42 |
43 | for _,g in pairs(string.Explode("%", all[2])) do
44 | table.insert(output[all[1]], g)
45 | end
46 | end
47 | end
48 |
49 | local function GetFunctions( tab )
50 | local functions = {}
51 | local const = {}
52 |
53 | for k, v in pairs( tab ) do
54 | if ( type(v) == "function" ) then
55 | table.insert( functions, tostring(k) )
56 | elseif ( type(v) == "string" ) then
57 | table.insert( const, tostring(k) )
58 | end
59 | end
60 |
61 | --table.sort( functions )
62 | return functions, const
63 | end
64 |
65 | local Ignores = { "mathx", "stringx", "_G", "_R", "_E", "GAMEMODE", "g_SBoxObjects", "tablex", "color_black",
66 | "color_white", "color_transparent", "utilx", "_LOADLIB", "_LOADED", "func", "DOF_Ents",
67 | "Morph", "_ENT" }
68 |
69 | if CLIENT then
70 | local dermaControls = {}
71 |
72 | for _,v in pairs(derma.GetControlList()) do
73 | table.insert(dermaControls, v.ClassName)
74 | //table.insert(Ignores, v.ClassName)
75 | end
76 |
77 | for _,k in pairs(dermaControls) do
78 | for _,method in pairs(GetFunctions(_G[k])) do
79 | if !table.HasValue(output.objectMethods, method) then
80 | table.insert(output.objectMethods, method)
81 | end
82 | end
83 | end
84 | end
85 |
86 | // Retrieve Everything Global
87 | for k, v in pairs(_G) do
88 | if type(k) == "string" then
89 | if !table.HasValue( Ignores, k ) then
90 | if type(v) == "table" then
91 | --if type(v) == "table" then PrintTable(v) end
92 | --Msg("Library: "..tostring(v).."\n")
93 | if !table.HasValue(output.libraries, k) then
94 | table.insert(output.libraries, k)
95 | end
96 | for _,method in pairs(GetFunctions(v)) do
97 | if string.sub(method, 1, 2) == "__" then
98 | if !table.HasValue(output.flags, method) then
99 | table.insert(output.flags, method)
100 | end
101 | else
102 | if !table.HasValue(output.libraryMethods, k.."."..method) then
103 | table.insert(output.libraryMethods, k.."."..method)
104 | end
105 | end
106 | end
107 | elseif type(v) == "function" then
108 | if !table.HasValue(output.globalMethods, k) then
109 | table.insert(output.globalMethods, k)
110 | end
111 | else
112 | if !table.HasValue(output.constants, k) then
113 | table.insert(output.constants, k)
114 | end
115 | --if type(v) != "number" then print(k, type(v)) end
116 | end
117 | end
118 | end
119 | end
120 |
121 | // Retrieve Meta Objects
122 | for k, v in pairs(_R) do
123 | if type(k) == "string" then
124 | if !table.HasValue( Ignores, k ) then
125 | if type(v) == "table" then
126 | --Msg("MetaTable: "..tostring(v).."\n")
127 | for _,method in pairs(GetFunctions(v)) do
128 | if string.sub(method, 1, 2) == "__" then
129 | if !table.HasValue(output.flags, method) then
130 | table.insert(output.flags, method)
131 | end
132 | else
133 | if !table.HasValue(output.objectMethods, method) then
134 | table.insert(output.objectMethods, method)
135 | end
136 | end
137 | end
138 | end
139 | end
140 | end
141 | end
142 | for k,v in pairs(weapons.Get("weapon_base")) do
143 | if type(k) == "string" then
144 | if type(v) == "function" then
145 | if !table.HasValue(output.scriptedFunctions, "self."..k) then
146 | table.insert(output.scriptedFunctions, "self."..k)
147 | end
148 | if !table.HasValue(output.scriptedFunctions, "self:"..k) then
149 | table.insert(output.scriptedFunctions, "self:"..k)
150 | end
151 | if !table.HasValue(output.scriptedFunctions, "SWEP."..k) then
152 | table.insert(output.scriptedFunctions, "SWEP."..k)
153 | end
154 | if !table.HasValue(output.scriptedFunctions, "SWEP:"..k) then
155 | table.insert(output.scriptedFunctions, "SWEP:"..k)
156 | end
157 | elseif type(v) == "string" or type(v) == "number" or type(v) == "boolean" then
158 | if !table.HasValue(output.scriptedVariables, "self."..k) then
159 | table.insert(output.scriptedVariables, "self."..k)
160 | end
161 | if !table.HasValue(output.scriptedVariables, "SWEP."..k) then
162 | table.insert(output.scriptedVariables, "SWEP."..k)
163 | end
164 | end
165 | end
166 | end
167 | for _,kind in pairs({"base_anim", "base_point", "base_brush", "base_vehicle", "base_ai"}) do
168 | if SERVER or (kind != "base_point" and kind != "base_brush" and kind != "base_ai") then
169 | for k,v in pairs(scripted_ents.Get(kind)) do
170 | if type(k) == "string" then
171 | if type(v) == "function" then
172 | if !table.HasValue(output.scriptedFunctions, "self."..k) then
173 | table.insert(output.scriptedFunctions, "self."..k)
174 | end
175 | if !table.HasValue(output.scriptedFunctions, "self:"..k) then
176 | table.insert(output.scriptedFunctions, "self:"..k)
177 | end
178 | if !table.HasValue(output.scriptedFunctions, "ENT."..k) then
179 | table.insert(output.scriptedFunctions, "ENT."..k)
180 | end
181 | if !table.HasValue(output.scriptedFunctions, "ENT:"..k) then
182 | table.insert(output.scriptedFunctions, "ENT:"..k)
183 | end
184 | elseif type(v) == "string" or type(v) == "number" or type(v) == "boolean" then
185 | if !table.HasValue(output.scriptedVariables, "self."..k) then
186 | table.insert(output.scriptedVariables, "self."..k)
187 | end
188 | if !table.HasValue(output.scriptedVariables, "ENT."..k) then
189 | table.insert(output.scriptedVariables, "ENT."..k)
190 | end
191 | end
192 | end
193 | end
194 | end
195 | end
196 |
197 | // Code to determine TOOL functions and variables
198 | local tbl1 = {}
199 | local tbl2 = {}
200 | for k,v in pairs(weapons.Get('gmod_tool')) do
201 | //for k, v in pairs(t) do
202 | if type(v) == 'function' then
203 | if !table.HasValue(tbl1, k) then
204 | table.insert(tbl1,k)
205 | end
206 | else
207 | if !table.HasValue(tbl2, k) then
208 | table.insert(tbl2,k)
209 | end
210 | end
211 | //end
212 | end
213 | table.sort(tbl1)
214 | table.sort(tbl2)
215 | //print('\nFunctions:\n')
216 | //table.foreach(tbl1, function(_,v) print(v) end)
217 | //print('\nConstants:\n')
218 | //table.foreach(tbl2, function(_,v) print(v) end)
219 |
220 | local funct = {funct = "scriptedFunctions", const = "scriptedVariables"}
221 | local TOOL = {} -- built from the above code manually
222 | TOOL.funct = {"Deploy", "DrawHUD", "DrawToolScreen", "FreezeMovement", "Holster", "LeftClick", "Reload", "RightClick", "Think", "Deploy"}
223 | TOOL.const = {"BuildCPanel", "AddToMenu", "AllowedCVar", "Category", "ClientConVar", "ConfigName", "FaceTimer", "LastMessage", "LeftClickAutomatic", "Message", "Mode", "Model", "Name", "Objects", "RequiresTraceHit", "RightClickAutomatic", "ServerConVar", "Stage", "Stored"}
224 |
225 | for kind, tbl in pairs(TOOL) do
226 | for _,v in pairs(tbl) do
227 | if !table.HasValue(output[funct[kind]], "self."..v)then
228 | table.insert(output[funct[kind]], "self."..v)
229 | end
230 | if !table.HasValue(output[funct[kind]], "self:"..v) and (kind == "funct") then
231 | table.insert(output[funct[kind]], "self:"..v)
232 | end
233 | if !table.HasValue(output[funct[kind]], "TOOL."..v) then
234 | table.insert(output[funct[kind]], "TOOL."..v)
235 | end
236 | if !table.HasValue(output[funct[kind]], "TOOL:"..v) and (kind == "funct") then
237 | table.insert(output[funct[kind]], "TOOL:"..v)
238 | end
239 | end
240 | end
241 |
242 | for k,v in pairs(GAMEMODE.BaseClass) do
243 | if type(k) == "string" then
244 | if type(v) == "function" then
245 | if !table.HasValue(output.scriptedFunctions, "self."..k) then
246 | table.insert(output.scriptedFunctions, "self."..k)
247 | end
248 | if !table.HasValue(output.scriptedFunctions, "self:"..k) then
249 | table.insert(output.scriptedFunctions, "self:"..k)
250 | end
251 | if !table.HasValue(output.scriptedFunctions, "GM."..k) then
252 | table.insert(output.scriptedFunctions, "GM."..k)
253 | end
254 | if !table.HasValue(output.scriptedFunctions, "GM:"..k) then
255 | table.insert(output.scriptedFunctions, "GM:"..k)
256 | end
257 | if !table.HasValue(output.scriptedFunctions, "GAMEMODE."..k) then
258 | table.insert(output.scriptedFunctions, "GAMEMODE."..k)
259 | end
260 | if !table.HasValue(output.scriptedFunctions, "GAMEMODE:"..k) then
261 | table.insert(output.scriptedFunctions, "GAMEMODE:"..k)
262 | end
263 | else--if type(v) == "string" or type(v) == "number" or type(v) == "boolean" then
264 | if !table.HasValue(output.scriptedVariables, "self."..k) then
265 | table.insert(output.scriptedVariables, "self."..k)
266 | end
267 | if !table.HasValue(output.scriptedVariables, "GM."..k) then
268 | table.insert(output.scriptedVariables, "GM."..k)
269 | end
270 | if !table.HasValue(output.scriptedFunctions, "GAMEMODE."..k) then
271 | table.insert(output.scriptedFunctions, "GAMEMODE."..k)
272 | end
273 | end
274 | end
275 | end
276 | local effect_hooks = {"Init", "Think", "Render"}
277 | for _,hook in pairs(effect_hooks) do
278 | if !table.HasValue(output.scriptedFunctions, "self."..hook) then
279 | table.insert(output.scriptedFunctions, "self."..hook)
280 | end
281 | if !table.HasValue(output.scriptedFunctions, "self:"..hook) then
282 | table.insert(output.scriptedFunctions, "self:"..hook)
283 | end
284 |
285 | if !table.HasValue(output.scriptedFunctions, "EFFECT."..hook) then
286 | table.insert(output.scriptedFunctions, "EFFECT."..hook)
287 | end
288 | if !table.HasValue(output.scriptedFunctions, "EFFECT:"..hook) then
289 | table.insert(output.scriptedFunctions, "EFFECT:"..hook)
290 | end
291 | end
292 |
293 | local OUT = ""
294 | if xside then
295 | for _,v in pairs({"__add", "__sub", "__mul", "__div", "__pow", "__unm", "__concat", "__eq", "__lt", "__le", "__index", "__newindex", "__call", "__tostring", "__gc", "__mode", "__metatable"}) do
296 | if !table.HasValue(output.flags, v) then
297 | table.insert(output.flags, v)
298 | end
299 | end
300 | for _,v in pairs({"Entity", "Owner", "Weapon"}) do
301 | if !table.HasValue(output.scriptedVariables, "self."..v) then
302 | table.insert(output.scriptedVariables, "self."..v)
303 | end
304 | end
305 | for _,v in pairs({"_G", "_E", "_R", "_ENT"}) do
306 | table.insert(output.globalMethods, v)
307 | end
308 | for _,v in pairs({"color_black", "color_white", "color_transparent"}) do
309 | table.insert(output.constants, v)
310 | end
311 |
312 | // Add keywords found in the wiki but not grabbed by this script
313 | for _,v in pairs({"DTVar", "SetWeaponHoldType", "GetHeight", "GetWidth", "Size"}) do
314 | table.insert(output.objectMethods, v)
315 | end
316 | for _,v in pairs({"math.huge", "team.Random", "DTextEntry.SetMultiline",
317 | "DButton.OnCursorEntered", "DButton.OnCursorExited", "DListView.SetColumnText",
318 | "DTextEntry.SetMultiline"}) do
319 | table.insert(output.libraryMethods, v)
320 | end
321 | for _,v in pairs({"DAlphaBar", "DColorCircle", "DColorCube", "DColoredBox",
322 | "DColorMixer", "DNumPad", "DPanelSelect", "DRGBBar", "SpawnIcon"}) do
323 | table.insert(output.libraries, v)
324 | end
325 |
326 | local cat = {}
327 | cat[1] = {output.constants}
328 | cat[2] = {output.globalMethods}
329 | cat[3] = {output.scriptedVariables}
330 | cat[4] = {output.scriptedFunctions}
331 | cat[5] = {output.libraries}
332 | cat[6] = {output.libraryMethods}
333 | cat[7] = {output.objectMethods}
334 | cat[8] = {output.flags}
335 |
336 | OUT = [[ and break do else elseif end false for function if in local nil not or repeat return then true until while]]
337 | for k,tbls in pairs(cat) do
338 | OUT = OUT .. "\n ]]
339 | for _,tbl in pairs(tbls) do
340 | for _,v in pairs(tbl) do
341 | OUT = OUT..v.." "
342 | end
343 | end
344 | OUT = string.sub(OUT, 1, -2) -- chop off the extra space
345 | OUT = OUT .. ""
346 | end
347 |
348 | file.Write("npp_gmod_lua.txt", OUT.."\n")
349 | print("Finished generating keywords for Notepad++.");
350 | else
351 | local tab = {}
352 | for name, tbl in pairs(output) do
353 | local str = name .. "~"
354 | local t = {}
355 | for _,v in pairs(tbl) do
356 | table.insert(t, v)
357 | end
358 |
359 | table.insert(tab, str..string.Implode("%", t))
360 | end
361 |
362 | OUT = string.Implode("`", tab)
363 |
364 |
365 | if ( SERVER ) then
366 | file.Write( "server.txt", OUT )
367 | else
368 | file.Write( "client.txt", OUT )
369 | end
370 | end
371 |
--------------------------------------------------------------------------------
/GmodLua/bin/doc/GmodLua-readme.txt:
--------------------------------------------------------------------------------
1 | Garry's Mod 10 Lua Syntax Highlighter Plugin
2 | created by Kyle Fleming (aka Garthex)
3 | email: garthex AT gmail.com
4 |
5 | For more information, please visit:
6 |
7 | Official SVN/Wiki hosting-
8 | http://code.google.com/p/npp-gmod-lua/
9 |
10 |
11 | Facepunch forum release thread-
12 | http://forums.facepunchstudios.com/showthread.php?p=8625735
13 |
14 | SourceForge.net download page-
15 | https://sourceforge.net/project/showfiles.php?group_id=189927&package_id=265782
16 |
17 |
18 |
19 |
20 |
21 | Special Thanks for borrowed code:
22 |
23 | Thell Fowler
24 | Robert Roessler
25 | Paul Winwood
26 | Alexey Yutkin
27 | Marcos E. Wurzius
28 | Philippe Lhoste
--------------------------------------------------------------------------------
/GmodLua/bin/install.txt:
--------------------------------------------------------------------------------
1 | Place GmodLua.dll, the Config folder, and the doc folder inside "Notepad++/plugins"
--------------------------------------------------------------------------------
/GmodLua/legacylib/OldAccessor.h:
--------------------------------------------------------------------------------
1 | // Scintilla source code edit control
2 | /** @file Accessor.h
3 | ** Rapid easy access to contents of a Scintilla.
4 | **/
5 | // Copyright 1998-2001 by Neil Hodgson
6 | // The License.txt file describes the conditions under which this software may be distributed.
7 |
8 | enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8};
9 |
10 | class Accessor;
11 |
12 | typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len);
13 |
14 | /**
15 | * Interface to data in a Scintilla.
16 | */
17 | class Accessor {
18 | protected:
19 | enum {extremePosition=0x7FFFFFFF};
20 | /** @a bufferSize is a trade off between time taken to copy the characters
21 | * and retrieval overhead.
22 | * @a slopSize positions the buffer before the desired position
23 | * in case there is some backtracking. */
24 | enum {bufferSize=4000, slopSize=bufferSize/8};
25 | char buf[bufferSize+1];
26 | int startPos;
27 | int endPos;
28 | int codePage;
29 |
30 | virtual bool InternalIsLeadByte(char ch)=0;
31 | virtual void Fill(int position)=0;
32 |
33 | public:
34 | Accessor() : startPos(extremePosition), endPos(0), codePage(0) {}
35 | virtual ~Accessor() {}
36 | char operator[](int position) {
37 | if (position < startPos || position >= endPos) {
38 | Fill(position);
39 | }
40 | return buf[position - startPos];
41 | }
42 | /** Safe version of operator[], returning a defined value for invalid position. */
43 | char SafeGetCharAt(int position, char chDefault=' ') {
44 | if (position < startPos || position >= endPos) {
45 | Fill(position);
46 | if (position < startPos || position >= endPos) {
47 | // Position is outside range of document
48 | return chDefault;
49 | }
50 | }
51 | return buf[position - startPos];
52 | }
53 | bool IsLeadByte(char ch) {
54 | return codePage && InternalIsLeadByte(ch);
55 | }
56 | void SetCodePage(int codePage_) { codePage = codePage_; }
57 |
58 | virtual bool Match(int pos, const char *s)=0;
59 | virtual char StyleAt(int position)=0;
60 | virtual int GetLine(int position)=0;
61 | virtual int LineStart(int line)=0;
62 | virtual int LevelAt(int line)=0;
63 | virtual int Length()=0;
64 | virtual void Flush()=0;
65 | virtual int GetLineState(int line)=0;
66 | virtual int SetLineState(int line, int state)=0;
67 | virtual int GetPropertyInt(const char *key, int defaultValue=0)=0;
68 | virtual char *GetProperties()=0;
69 |
70 | // Style setting
71 | virtual void StartAt(unsigned int start, char chMask=31)=0;
72 | virtual void SetFlags(char chFlags_, char chWhile_)=0;
73 | virtual unsigned int GetStartSegment()=0;
74 | virtual void StartSegment(unsigned int pos)=0;
75 | virtual void ColourTo(unsigned int pos, int chAttr)=0;
76 | virtual void SetLevel(int line, int level)=0;
77 | virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0;
78 | virtual void IndicatorFill(int start, int end, int indicator, int value)=0;
79 | };
80 |
--------------------------------------------------------------------------------
/GmodLua/legacylib/OldFontQuality.h:
--------------------------------------------------------------------------------
1 | // Scintilla source code edit control
2 | /** @file FontQuality.h
3 | ** Definitions to control font anti-aliasing.
4 | **/
5 | // Copyright 1998-2009 by Neil Hodgson
6 | // The License.txt file describes the conditions under which this software may be distributed.
7 |
8 | #define SC_EFF_QUALITY_MASK 0xF
9 | #define SC_EFF_QUALITY_DEFAULT 0
10 | #define SC_EFF_QUALITY_NON_ANTIALIASED 1
11 | #define SC_EFF_QUALITY_ANTIALIASED 2
12 | #define SC_EFF_QUALITY_LCD_OPTIMIZED 3
13 |
--------------------------------------------------------------------------------
/GmodLua/legacylib/OldKeyWords.cxx:
--------------------------------------------------------------------------------
1 | // Scintilla source code edit control
2 | /** @file KeyWords.cxx
3 | ** Colourise for particular languages.
4 | **/
5 | // Copyright 1998-2002 by Neil Hodgson
6 | // The License.txt file describes the conditions under which this software may be distributed.
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | #define SCI_NAMESPACE
15 |
16 | #include "OldPlatform.h"
17 |
18 | #include "OldPropSet.h"
19 | #include "OldAccessor.h"
20 | #include "OldKeyWords.h"
21 | #include "OldScintilla.h"
22 | #include "OldSciLexer.h"
23 |
24 | #ifdef SCI_NAMESPACE
25 | using namespace Scintilla;
26 | #endif
27 |
28 | /**
29 | * Creates an array that points into each word in the string and puts \0 terminators
30 | * after each word.
31 | */
32 | static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) {
33 | int prev = '\n';
34 | int words = 0;
35 | // For rapid determination of whether a character is a separator, build
36 | // a look up table.
37 | bool wordSeparator[256];
38 | for (int i=0; i<256; i++) {
39 | wordSeparator[i] = false;
40 | }
41 | wordSeparator['\r'] = true;
42 | wordSeparator['\n'] = true;
43 | if (!onlyLineEnds) {
44 | wordSeparator[' '] = true;
45 | wordSeparator['\t'] = true;
46 | }
47 | for (int j = 0; wordlist[j]; j++) {
48 | int curr = static_cast(wordlist[j]);
49 | if (!wordSeparator[curr] && wordSeparator[prev])
50 | words++;
51 | prev = curr;
52 | }
53 | char **keywords = new char *[words + 1];
54 | if (keywords) {
55 | words = 0;
56 | prev = '\0';
57 | size_t slen = strlen(wordlist);
58 | for (size_t k = 0; k < slen; k++) {
59 | if (!wordSeparator[static_cast(wordlist[k])]) {
60 | if (!prev) {
61 | keywords[words] = &wordlist[k];
62 | words++;
63 | }
64 | } else {
65 | wordlist[k] = '\0';
66 | }
67 | prev = wordlist[k];
68 | }
69 | keywords[words] = &wordlist[slen];
70 | *len = words;
71 | } else {
72 | *len = 0;
73 | }
74 | return keywords;
75 | }
76 |
77 | void WordList::Clear() {
78 | if (words) {
79 | delete []list;
80 | delete []words;
81 | }
82 | words = 0;
83 | list = 0;
84 | len = 0;
85 | sorted = false;
86 | }
87 |
88 | void WordList::Set(const char *s) {
89 | list = new char[strlen(s) + 1];
90 | strcpy(list, s);
91 | sorted = false;
92 | words = ArrayFromWordList(list, &len, onlyLineEnds);
93 | }
94 |
95 | int cmpString(const void *a1, const void *a2) {
96 | // Can't work out the correct incantation to use modern casts here
97 | return strcmp(*(char **)(a1), *(char **)(a2));
98 | }
99 |
100 | static void SortWordList(char **words, unsigned int len) {
101 | qsort(reinterpret_cast(words), len, sizeof(*words),
102 | cmpString);
103 | }
104 |
105 | bool WordList::InList(const char *s) {
106 | if (0 == words)
107 | return false;
108 | if (!sorted) {
109 | sorted = true;
110 | SortWordList(words, len);
111 | for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
112 | starts[k] = -1;
113 | for (int l = len - 1; l >= 0; l--) {
114 | unsigned char indexChar = words[l][0];
115 | starts[indexChar] = l;
116 | }
117 | }
118 | unsigned char firstChar = s[0];
119 | int j = starts[firstChar];
120 | if (j >= 0) {
121 | while ((unsigned char)words[j][0] == firstChar) {
122 | if (s[1] == words[j][1]) {
123 | const char *a = words[j] + 1;
124 | const char *b = s + 1;
125 | while (*a && *a == *b) {
126 | a++;
127 | b++;
128 | }
129 | if (!*a && !*b)
130 | return true;
131 | }
132 | j++;
133 | }
134 | }
135 | j = starts['^'];
136 | if (j >= 0) {
137 | while (words[j][0] == '^') {
138 | const char *a = words[j] + 1;
139 | const char *b = s;
140 | while (*a && *a == *b) {
141 | a++;
142 | b++;
143 | }
144 | if (!*a)
145 | return true;
146 | j++;
147 | }
148 | }
149 | return false;
150 | }
151 |
152 | /** similar to InList, but word s can be a substring of keyword.
153 | * eg. the keyword define is defined as def~ine. This means the word must start
154 | * with def to be a keyword, but also defi, defin and define are valid.
155 | * The marker is ~ in this case.
156 | */
157 | bool WordList::InListAbbreviated(const char *s, const char marker) {
158 | if (0 == words)
159 | return false;
160 | if (!sorted) {
161 | sorted = true;
162 | SortWordList(words, len);
163 | for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
164 | starts[k] = -1;
165 | for (int l = len - 1; l >= 0; l--) {
166 | unsigned char indexChar = words[l][0];
167 | starts[indexChar] = l;
168 | }
169 | }
170 | unsigned char firstChar = s[0];
171 | int j = starts[firstChar];
172 | if (j >= 0) {
173 | while (words[j][0] == firstChar) {
174 | bool isSubword = false;
175 | int start = 1;
176 | if (words[j][1] == marker) {
177 | isSubword = true;
178 | start++;
179 | }
180 | if (s[1] == words[j][start]) {
181 | const char *a = words[j] + start;
182 | const char *b = s + 1;
183 | while (*a && *a == *b) {
184 | a++;
185 | if (*a == marker) {
186 | isSubword = true;
187 | a++;
188 | }
189 | b++;
190 | }
191 | if ((!*a || isSubword) && !*b)
192 | return true;
193 | }
194 | j++;
195 | }
196 | }
197 | j = starts['^'];
198 | if (j >= 0) {
199 | while (words[j][0] == '^') {
200 | const char *a = words[j] + 1;
201 | const char *b = s;
202 | while (*a && *a == *b) {
203 | a++;
204 | b++;
205 | }
206 | if (!*a)
207 | return true;
208 | j++;
209 | }
210 | }
211 | return false;
212 | }
213 |
214 | const LexerModule *LexerModule::base = 0;
215 | int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
216 |
217 | LexerModule::LexerModule(int language_,
218 | LexerFunction fnLexer_,
219 | const char *languageName_,
220 | LexerFunction fnFolder_,
221 | const char *const wordListDescriptions_[],
222 | int styleBits_) :
223 | language(language_),
224 | fnLexer(fnLexer_),
225 | fnFolder(fnFolder_),
226 | wordListDescriptions(wordListDescriptions_),
227 | styleBits(styleBits_),
228 | languageName(languageName_) {
229 | next = base;
230 | base = this;
231 | if (language == SCLEX_AUTOMATIC) {
232 | language = nextLanguage;
233 | nextLanguage++;
234 | }
235 | }
236 |
237 | int LexerModule::GetNumWordLists() const {
238 | if (wordListDescriptions == NULL) {
239 | return -1;
240 | } else {
241 | int numWordLists = 0;
242 |
243 | while (wordListDescriptions[numWordLists]) {
244 | ++numWordLists;
245 | }
246 |
247 | return numWordLists;
248 | }
249 | }
250 |
251 | const char *LexerModule::GetWordListDescription(int index) const {
252 | static const char *emptyStr = "";
253 |
254 | PLATFORM_ASSERT(index < GetNumWordLists());
255 | if (index >= GetNumWordLists()) {
256 | return emptyStr;
257 | } else {
258 | return wordListDescriptions[index];
259 | }
260 | }
261 |
262 | int LexerModule::GetStyleBitsNeeded() const {
263 | return styleBits;
264 | }
265 |
266 | const LexerModule *LexerModule::Find(int language) {
267 | const LexerModule *lm = base;
268 | while (lm) {
269 | if (lm->language == language) {
270 | return lm;
271 | }
272 | lm = lm->next;
273 | }
274 | return 0;
275 | }
276 |
277 | const LexerModule *LexerModule::Find(const char *languageName) {
278 | if (languageName) {
279 | const LexerModule *lm = base;
280 | while (lm) {
281 | if (lm->languageName && 0 == strcmp(lm->languageName, languageName)) {
282 | return lm;
283 | }
284 | lm = lm->next;
285 | }
286 | }
287 | return 0;
288 | }
289 |
290 | void LexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle,
291 | WordList *keywordlists[], Accessor &styler) const {
292 | if (fnLexer)
293 | fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler);
294 | }
295 |
296 | void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle,
297 | WordList *keywordlists[], Accessor &styler) const {
298 | if (fnFolder) {
299 | int lineCurrent = styler.GetLine(startPos);
300 | // Move back one line in case deletion wrecked current line fold state
301 | if (lineCurrent > 0) {
302 | lineCurrent--;
303 | int newStartPos = styler.LineStart(lineCurrent);
304 | lengthDoc += startPos - newStartPos;
305 | startPos = newStartPos;
306 | initStyle = 0;
307 | if (startPos > 0) {
308 | initStyle = styler.StyleAt(startPos - 1);
309 | }
310 | }
311 | fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler);
312 | }
313 | }
314 |
315 | // Alternative historical name for Scintilla_LinkLexers
316 | int wxForceScintillaLexers(void) {
317 | return Scintilla_LinkLexers();
318 | }
319 |
320 | // To add or remove a lexer, add or remove its file and run LexGen.py.
321 |
322 | // Force a reference to all of the Scintilla lexers so that the linker will
323 | // not remove the code of the lexers.
324 | int Scintilla_LinkLexers() {
325 | static int forcer = 0;
326 |
327 | // Shorten the code that declares a lexer and ensures it is linked in by calling a method.
328 | #define LINK_LEXER(lexer) extern LexerModule lexer; forcer += lexer.GetLanguage();
329 |
330 | //++Autogenerated -- run src/LexGen.py to regenerate
331 | //**\(\tLINK_LEXER(\*);\n\)
332 | //--Autogenerated -- end of automatically generated section
333 |
334 | return 1;
335 | }
336 |
--------------------------------------------------------------------------------
/GmodLua/legacylib/OldKeyWords.h:
--------------------------------------------------------------------------------
1 | // Scintilla source code edit control
2 | /** @file KeyWords.h
3 | ** Colourise for particular languages.
4 | **/
5 | // Copyright 1998-2001 by Neil Hodgson
6 | // The License.txt file describes the conditions under which this software may be distributed.
7 |
8 | #ifdef SCI_NAMESPACE
9 | namespace Scintilla {
10 | #endif
11 |
12 | /**
13 | */
14 | class WordList {
15 | public:
16 | // Each word contains at least one character - a empty word acts as sentinel at the end.
17 | char **words;
18 | char *list;
19 | int len;
20 | bool onlyLineEnds; ///< Delimited by any white space or only line ends
21 | bool sorted;
22 | int starts[256];
23 | WordList(bool onlyLineEnds_ = false) :
24 | words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_),
25 | sorted(false)
26 | {}
27 | ~WordList() { Clear(); }
28 | operator bool() { return len ? true : false; }
29 | void Clear();
30 | void Set(const char *s);
31 | bool InList(const char *s);
32 | bool InListAbbreviated(const char *s, const char marker);
33 | };
34 |
35 | typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
36 | WordList *keywordlists[], Accessor &styler);
37 |
38 | /**
39 | * A LexerModule is responsible for lexing and folding a particular language.
40 | * The class maintains a list of LexerModules which can be searched to find a
41 | * module appropriate to a particular language.
42 | */
43 | class LexerModule {
44 | protected:
45 | const LexerModule *next;
46 | int language;
47 | LexerFunction fnLexer;
48 | LexerFunction fnFolder;
49 | const char * const * wordListDescriptions;
50 | int styleBits;
51 |
52 | static const LexerModule *base;
53 | static int nextLanguage;
54 |
55 | public:
56 | const char *languageName;
57 | LexerModule(int language_,
58 | LexerFunction fnLexer_,
59 | const char *languageName_=0,
60 | LexerFunction fnFolder_=0,
61 | const char * const wordListDescriptions_[] = NULL,
62 | int styleBits_=5);
63 | virtual ~LexerModule() {
64 | }
65 | int GetLanguage() const { return language; }
66 |
67 | // -1 is returned if no WordList information is available
68 | int GetNumWordLists() const;
69 | const char *GetWordListDescription(int index) const;
70 |
71 | int GetStyleBitsNeeded() const;
72 |
73 | virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
74 | WordList *keywordlists[], Accessor &styler) const;
75 | virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
76 | WordList *keywordlists[], Accessor &styler) const;
77 | static const LexerModule *Find(int language);
78 | static const LexerModule *Find(const char *languageName);
79 | };
80 |
81 | #ifdef SCI_NAMESPACE
82 | }
83 | #endif
84 |
85 | /**
86 | * Check if a character is a space.
87 | * This is ASCII specific but is safe with chars >= 0x80.
88 | */
89 | inline bool isspacechar(unsigned char ch) {
90 | return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
91 | }
92 |
93 | inline bool iswordchar(char ch) {
94 | return isascii(ch) && (isalnum(ch) || ch == '.' || ch == '_');
95 | }
96 |
97 | inline bool iswordstart(char ch) {
98 | return isascii(ch) && (isalnum(ch) || ch == '_');
99 | }
100 |
101 | inline bool isoperator(char ch) {
102 | if (isascii(ch) && isalnum(ch))
103 | return false;
104 | // '.' left out as it is used to make up numbers
105 | if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
106 | ch == '(' || ch == ')' || ch == '-' || ch == '+' ||
107 | ch == '=' || ch == '|' || ch == '{' || ch == '}' ||
108 | ch == '[' || ch == ']' || ch == ':' || ch == ';' ||
109 | ch == '<' || ch == '>' || ch == ',' || ch == '/' ||
110 | ch == '?' || ch == '!' || ch == '.' || ch == '~')
111 | return true;
112 | return false;
113 | }
114 |
--------------------------------------------------------------------------------
/GmodLua/legacylib/OldPlatform.h:
--------------------------------------------------------------------------------
1 | // Scintilla source code edit control
2 | /** @file Platform.h
3 | ** Interface to platform facilities. Also includes some basic utilities.
4 | ** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows.
5 | **/
6 | // Copyright 1998-2009 by Neil Hodgson
7 | // The License.txt file describes the conditions under which this software may be distributed.
8 |
9 | #ifndef PLATFORM_H
10 | #define PLATFORM_H
11 |
12 | // PLAT_GTK = GTK+ on Linux or Win32
13 | // PLAT_GTK_WIN32 is defined additionally when running PLAT_GTK under Win32
14 | // PLAT_WIN = Win32 API on Win32 OS
15 | // PLAT_WX is wxWindows on any supported platform
16 |
17 | #define PLAT_GTK 0
18 | #define PLAT_GTK_WIN32 0
19 | #define PLAT_MACOSX 0
20 | #define PLAT_WIN 0
21 | #define PLAT_WX 0
22 | #define PLAT_FOX 0
23 |
24 | #if defined(FOX)
25 | #undef PLAT_FOX
26 | #define PLAT_FOX 1
27 |
28 | #elif defined(__WX__)
29 | #undef PLAT_WX
30 | #define PLAT_WX 1
31 |
32 | #elif defined(GTK)
33 | #undef PLAT_GTK
34 | #define PLAT_GTK 1
35 |
36 | #if defined(__WIN32__) || defined(_MSC_VER)
37 | #undef PLAT_GTK_WIN32
38 | #define PLAT_GTK_WIN32 1
39 | #endif
40 |
41 | #elif defined(__APPLE__)
42 |
43 | #undef PLAT_MACOSX
44 | #define PLAT_MACOSX 1
45 |
46 | #else
47 | #undef PLAT_WIN
48 | #define PLAT_WIN 1
49 |
50 | #endif
51 |
52 | #ifdef SCI_NAMESPACE
53 | namespace Scintilla {
54 | #endif
55 |
56 | // Underlying the implementation of the platform classes are platform specific types.
57 | // Sometimes these need to be passed around by client code so they are defined here
58 |
59 | typedef void *FontID;
60 | typedef void *SurfaceID;
61 | typedef void *WindowID;
62 | typedef void *MenuID;
63 | typedef void *TickerID;
64 | typedef void *Function;
65 | typedef void *IdlerID;
66 |
67 | /**
68 | * A geometric point class.
69 | * Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably.
70 | */
71 | class Point {
72 | public:
73 | int x;
74 | int y;
75 |
76 | explicit Point(int x_=0, int y_=0) : x(x_), y(y_) {
77 | }
78 |
79 | // Other automatically defined methods (assignment, copy constructor, destructor) are fine
80 |
81 | static Point FromLong(long lpoint);
82 | };
83 |
84 | /**
85 | * A geometric rectangle class.
86 | * PRectangle is exactly the same as the Win32 RECT so can be used interchangeably.
87 | * PRectangles contain their top and left sides, but not their right and bottom sides.
88 | */
89 | class PRectangle {
90 | public:
91 | int left;
92 | int top;
93 | int right;
94 | int bottom;
95 |
96 | PRectangle(int left_=0, int top_=0, int right_=0, int bottom_ = 0) :
97 | left(left_), top(top_), right(right_), bottom(bottom_) {
98 | }
99 |
100 | // Other automatically defined methods (assignment, copy constructor, destructor) are fine
101 |
102 | bool operator==(PRectangle &rc) {
103 | return (rc.left == left) && (rc.right == right) &&
104 | (rc.top == top) && (rc.bottom == bottom);
105 | }
106 | bool Contains(Point pt) {
107 | return (pt.x >= left) && (pt.x <= right) &&
108 | (pt.y >= top) && (pt.y <= bottom);
109 | }
110 | bool Contains(PRectangle rc) {
111 | return (rc.left >= left) && (rc.right <= right) &&
112 | (rc.top >= top) && (rc.bottom <= bottom);
113 | }
114 | bool Intersects(PRectangle other) {
115 | return (right > other.left) && (left < other.right) &&
116 | (bottom > other.top) && (top < other.bottom);
117 | }
118 | void Move(int xDelta, int yDelta) {
119 | left += xDelta;
120 | top += yDelta;
121 | right += xDelta;
122 | bottom += yDelta;
123 | }
124 | int Width() { return right - left; }
125 | int Height() { return bottom - top; }
126 | bool Empty() {
127 | return (Height() <= 0) || (Width() <= 0);
128 | }
129 | };
130 |
131 | /**
132 | * In some circumstances, including Win32 in paletted mode and GTK+, each colour
133 | * must be allocated before use. The desired colours are held in the ColourDesired class,
134 | * and after allocation the allocation entry is stored in the ColourAllocated class. In other
135 | * circumstances, such as Win32 in true colour mode, the allocation process just copies
136 | * the RGB values from the desired to the allocated class.
137 | * As each desired colour requires allocation before it can be used, the ColourPair class
138 | * holds both a ColourDesired and a ColourAllocated
139 | * The Palette class is responsible for managing the palette of colours which contains a
140 | * list of ColourPair objects and performs the allocation.
141 | */
142 |
143 | /**
144 | * Holds a desired RGB colour.
145 | */
146 | class ColourDesired {
147 | long co;
148 | public:
149 | ColourDesired(long lcol=0) {
150 | co = lcol;
151 | }
152 |
153 | ColourDesired(unsigned int red, unsigned int green, unsigned int blue) {
154 | Set(red, green, blue);
155 | }
156 |
157 | bool operator==(const ColourDesired &other) const {
158 | return co == other.co;
159 | }
160 |
161 | void Set(long lcol) {
162 | co = lcol;
163 | }
164 |
165 | void Set(unsigned int red, unsigned int green, unsigned int blue) {
166 | co = red | (green << 8) | (blue << 16);
167 | }
168 |
169 | static inline unsigned int ValueOfHex(const char ch) {
170 | if (ch >= '0' && ch <= '9')
171 | return ch - '0';
172 | else if (ch >= 'A' && ch <= 'F')
173 | return ch - 'A' + 10;
174 | else if (ch >= 'a' && ch <= 'f')
175 | return ch - 'a' + 10;
176 | else
177 | return 0;
178 | }
179 |
180 | void Set(const char *val) {
181 | if (*val == '#') {
182 | val++;
183 | }
184 | unsigned int r = ValueOfHex(val[0]) * 16 + ValueOfHex(val[1]);
185 | unsigned int g = ValueOfHex(val[2]) * 16 + ValueOfHex(val[3]);
186 | unsigned int b = ValueOfHex(val[4]) * 16 + ValueOfHex(val[5]);
187 | Set(r, g, b);
188 | }
189 |
190 | long AsLong() const {
191 | return co;
192 | }
193 |
194 | unsigned int GetRed() {
195 | return co & 0xff;
196 | }
197 |
198 | unsigned int GetGreen() {
199 | return (co >> 8) & 0xff;
200 | }
201 |
202 | unsigned int GetBlue() {
203 | return (co >> 16) & 0xff;
204 | }
205 | };
206 |
207 | /**
208 | * Holds an allocated RGB colour which may be an approximation to the desired colour.
209 | */
210 | class ColourAllocated {
211 | long coAllocated;
212 |
213 | public:
214 |
215 | ColourAllocated(long lcol=0) {
216 | coAllocated = lcol;
217 | }
218 |
219 | void Set(long lcol) {
220 | coAllocated = lcol;
221 | }
222 |
223 | long AsLong() const {
224 | return coAllocated;
225 | }
226 | };
227 |
228 | /**
229 | * Colour pairs hold a desired colour and an allocated colour.
230 | */
231 | struct ColourPair {
232 | ColourDesired desired;
233 | ColourAllocated allocated;
234 |
235 | ColourPair(ColourDesired desired_=ColourDesired(0,0,0)) {
236 | desired = desired_;
237 | allocated.Set(desired.AsLong());
238 | }
239 | void Copy() {
240 | allocated.Set(desired.AsLong());
241 | }
242 | };
243 |
244 | class Window; // Forward declaration for Palette
245 |
246 | /**
247 | * Colour palette management.
248 | */
249 | class Palette {
250 | int used;
251 | int size;
252 | ColourPair *entries;
253 | #if PLAT_GTK
254 | void *allocatedPalette; // GdkColor *
255 | int allocatedLen;
256 | #endif
257 | // Private so Palette objects can not be copied
258 | Palette(const Palette &) {}
259 | Palette &operator=(const Palette &) { return *this; }
260 | public:
261 | #if PLAT_WIN
262 | void *hpal;
263 | #endif
264 | bool allowRealization;
265 |
266 | Palette();
267 | ~Palette();
268 |
269 | void Release();
270 |
271 | /**
272 | * This method either adds a colour to the list of wanted colours (want==true)
273 | * or retrieves the allocated colour back to the ColourPair.
274 | * This is one method to make it easier to keep the code for wanting and retrieving in sync.
275 | */
276 | void WantFind(ColourPair &cp, bool want);
277 |
278 | void Allocate(Window &w);
279 | };
280 |
281 | /**
282 | * Font management.
283 | */
284 | class Font {
285 | protected:
286 | FontID fid;
287 | #if PLAT_WX
288 | int ascent;
289 | #endif
290 | // Private so Font objects can not be copied
291 | Font(const Font &) {}
292 | Font &operator=(const Font &) { fid=0; return *this; }
293 | public:
294 | Font();
295 | virtual ~Font();
296 |
297 | virtual void Create(const char *faceName, int characterSet, int size,
298 | bool bold, bool italic, int extraFontFlag=0);
299 | virtual void Release();
300 |
301 | FontID GetID() { return fid; }
302 | // Alias another font - caller guarantees not to Release
303 | void SetID(FontID fid_) { fid = fid_; }
304 | friend class Surface;
305 | friend class SurfaceImpl;
306 | };
307 |
308 | /**
309 | * A surface abstracts a place to draw.
310 | */
311 | class Surface {
312 | private:
313 | // Private so Surface objects can not be copied
314 | Surface(const Surface &) {}
315 | Surface &operator=(const Surface &) { return *this; }
316 | public:
317 | Surface() {}
318 | virtual ~Surface() {}
319 | static Surface *Allocate();
320 |
321 | virtual void Init(WindowID wid)=0;
322 | virtual void Init(SurfaceID sid, WindowID wid)=0;
323 | virtual void InitPixMap(int width, int height, Surface *surface_, WindowID wid)=0;
324 |
325 | virtual void Release()=0;
326 | virtual bool Initialised()=0;
327 | virtual void PenColour(ColourAllocated fore)=0;
328 | virtual int LogPixelsY()=0;
329 | virtual int DeviceHeightFont(int points)=0;
330 | virtual void MoveTo(int x_, int y_)=0;
331 | virtual void LineTo(int x_, int y_)=0;
332 | virtual void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back)=0;
333 | virtual void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
334 | virtual void FillRectangle(PRectangle rc, ColourAllocated back)=0;
335 | virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0;
336 | virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
337 | virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
338 | ColourAllocated outline, int alphaOutline, int flags)=0;
339 | virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
340 | virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0;
341 |
342 | virtual void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0;
343 | virtual void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0;
344 | virtual void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore)=0;
345 | virtual void MeasureWidths(Font &font_, const char *s, int len, int *positions)=0;
346 | virtual int WidthText(Font &font_, const char *s, int len)=0;
347 | virtual int WidthChar(Font &font_, char ch)=0;
348 | virtual int Ascent(Font &font_)=0;
349 | virtual int Descent(Font &font_)=0;
350 | virtual int InternalLeading(Font &font_)=0;
351 | virtual int ExternalLeading(Font &font_)=0;
352 | virtual int Height(Font &font_)=0;
353 | virtual int AverageCharWidth(Font &font_)=0;
354 |
355 | virtual int SetPalette(Palette *pal, bool inBackGround)=0;
356 | virtual void SetClip(PRectangle rc)=0;
357 | virtual void FlushCachedState()=0;
358 |
359 | virtual void SetUnicodeMode(bool unicodeMode_)=0;
360 | virtual void SetDBCSMode(int codePage)=0;
361 | };
362 |
363 | /**
364 | * A simple callback action passing one piece of untyped user data.
365 | */
366 | typedef void (*CallBackAction)(void*);
367 |
368 | /**
369 | * Class to hide the details of window manipulation.
370 | * Does not own the window which will normally have a longer life than this object.
371 | */
372 | class Window {
373 | protected:
374 | WindowID wid;
375 | #if PLAT_MACOSX
376 | void *windowRef;
377 | void *control;
378 | #endif
379 | public:
380 | Window() : wid(0), cursorLast(cursorInvalid) {
381 | #if PLAT_MACOSX
382 | windowRef = 0;
383 | control = 0;
384 | #endif
385 | }
386 | Window(const Window &source) : wid(source.wid), cursorLast(cursorInvalid) {
387 | #if PLAT_MACOSX
388 | windowRef = 0;
389 | control = 0;
390 | #endif
391 | }
392 | virtual ~Window();
393 | Window &operator=(WindowID wid_) {
394 | wid = wid_;
395 | return *this;
396 | }
397 | WindowID GetID() const { return wid; }
398 | bool Created() const { return wid != 0; }
399 | void Destroy();
400 | bool HasFocus();
401 | PRectangle GetPosition();
402 | void SetPosition(PRectangle rc);
403 | void SetPositionRelative(PRectangle rc, Window relativeTo);
404 | PRectangle GetClientPosition();
405 | void Show(bool show=true);
406 | void InvalidateAll();
407 | void InvalidateRectangle(PRectangle rc);
408 | virtual void SetFont(Font &font);
409 | enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand };
410 | void SetCursor(Cursor curs);
411 | void SetTitle(const char *s);
412 | PRectangle GetMonitorRect(Point pt);
413 | #if PLAT_MACOSX
414 | void SetWindow(void *ref) { windowRef = ref; };
415 | void SetControl(void *_control) { control = _control; };
416 | #endif
417 | private:
418 | Cursor cursorLast;
419 | };
420 |
421 | /**
422 | * Listbox management.
423 | */
424 |
425 | class ListBox : public Window {
426 | public:
427 | ListBox();
428 | virtual ~ListBox();
429 | static ListBox *Allocate();
430 |
431 | virtual void SetFont(Font &font)=0;
432 | virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_)=0;
433 | virtual void SetAverageCharWidth(int width)=0;
434 | virtual void SetVisibleRows(int rows)=0;
435 | virtual int GetVisibleRows() const=0;
436 | virtual PRectangle GetDesiredRect()=0;
437 | virtual int CaretFromEdge()=0;
438 | virtual void Clear()=0;
439 | virtual void Append(char *s, int type = -1)=0;
440 | virtual int Length()=0;
441 | virtual void Select(int n)=0;
442 | virtual int GetSelection()=0;
443 | virtual int Find(const char *prefix)=0;
444 | virtual void GetValue(int n, char *value, int len)=0;
445 | virtual void RegisterImage(int type, const char *xpm_data)=0;
446 | virtual void ClearRegisteredImages()=0;
447 | virtual void SetDoubleClickAction(CallBackAction, void *)=0;
448 | virtual void SetList(const char* list, char separator, char typesep)=0;
449 | };
450 |
451 | /**
452 | * Menu management.
453 | */
454 | class Menu {
455 | MenuID mid;
456 | public:
457 | Menu();
458 | MenuID GetID() { return mid; }
459 | void CreatePopUp();
460 | void Destroy();
461 | void Show(Point pt, Window &w);
462 | };
463 |
464 | class ElapsedTime {
465 | long bigBit;
466 | long littleBit;
467 | public:
468 | ElapsedTime();
469 | double Duration(bool reset=false);
470 | };
471 |
472 | /**
473 | * Dynamic Library (DLL/SO/...) loading
474 | */
475 | class DynamicLibrary {
476 | public:
477 | virtual ~DynamicLibrary() {}
478 |
479 | /// @return Pointer to function "name", or NULL on failure.
480 | virtual Function FindFunction(const char *name) = 0;
481 |
482 | /// @return true if the library was loaded successfully.
483 | virtual bool IsValid() = 0;
484 |
485 | /// @return An instance of a DynamicLibrary subclass with "modulePath" loaded.
486 | static DynamicLibrary *Load(const char *modulePath);
487 | };
488 |
489 | /**
490 | * Platform class used to retrieve system wide parameters such as double click speed
491 | * and chrome colour. Not a creatable object, more of a module with several functions.
492 | */
493 | class Platform {
494 | // Private so Platform objects can not be copied
495 | Platform(const Platform &) {}
496 | Platform &operator=(const Platform &) { return *this; }
497 | public:
498 | // Should be private because no new Platforms are ever created
499 | // but gcc warns about this
500 | Platform() {}
501 | ~Platform() {}
502 | static ColourDesired Chrome();
503 | static ColourDesired ChromeHighlight();
504 | static const char *DefaultFont();
505 | static int DefaultFontSize();
506 | static unsigned int DoubleClickTime();
507 | static bool MouseButtonBounce();
508 | static void DebugDisplay(const char *s);
509 | static bool IsKeyDown(int key);
510 | static long SendScintilla(
511 | WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0);
512 | static long SendScintillaPointer(
513 | WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0);
514 | static bool IsDBCSLeadByte(int codePage, char ch);
515 | static int DBCSCharLength(int codePage, const char *s);
516 | static int DBCSCharMaxLength();
517 |
518 | // These are utility functions not really tied to a platform
519 | static int Minimum(int a, int b);
520 | static int Maximum(int a, int b);
521 | // Next three assume 16 bit shorts and 32 bit longs
522 | static long LongFromTwoShorts(short a,short b) {
523 | return (a) | ((b) << 16);
524 | }
525 | static short HighShortFromLong(long x) {
526 | return static_cast(x >> 16);
527 | }
528 | static short LowShortFromLong(long x) {
529 | return static_cast(x & 0xffff);
530 | }
531 | static void DebugPrintf(const char *format, ...);
532 | static bool ShowAssertionPopUps(bool assertionPopUps_);
533 | static void Assert(const char *c, const char *file, int line);
534 | static int Clamp(int val, int minVal, int maxVal);
535 | };
536 |
537 | #ifdef NDEBUG
538 | #define PLATFORM_ASSERT(c) ((void)0)
539 | #else
540 | #ifdef SCI_NAMESPACE
541 | #define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Platform::Assert(#c, __FILE__, __LINE__))
542 | #else
543 | #define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__))
544 | #endif
545 | #endif
546 |
547 | #ifdef SCI_NAMESPACE
548 | }
549 | #endif
550 |
551 | // Shut up annoying Visual C++ warnings:
552 | #ifdef _MSC_VER
553 | #pragma warning(disable: 4244 4309 4514 4710)
554 | #endif
555 |
556 | #endif
557 |
--------------------------------------------------------------------------------
/GmodLua/legacylib/OldPlatformRes.h:
--------------------------------------------------------------------------------
1 | // Scintilla source code edit control
2 | /** @file PlatformRes.h
3 | ** Defines IDs of resources used by Scintilla on Windows platform.
4 | **/
5 | // Copyright 1998-2001 by Neil Hodgson
6 | // The License.txt file describes the conditions under which this software may be distributed.
7 |
8 | #define IDC_MARGIN 400
9 |
--------------------------------------------------------------------------------
/GmodLua/legacylib/OldPropSet.cxx:
--------------------------------------------------------------------------------
1 | // SciTE - Scintilla based Text Editor
2 | /** @file PropSet.cxx
3 | ** A Java style properties file module.
4 | **/
5 | // Copyright 1998-2003 by Neil Hodgson
6 | // The License.txt file describes the conditions under which this software may be distributed.
7 |
8 | // Maintain a dictionary of properties
9 |
10 | #include
11 | #include
12 | #include
13 |
14 | #ifdef _MSC_VER
15 | // Visual C++ doesn't like unreachable code or long decorated names in its own headers.
16 | #pragma warning(disable: 4018 4100 4245 4511 4512 4663 4702 4786)
17 | #endif
18 |
19 | #include
20 | #include