├── 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 21 | 22 | #define SCI_NAMESPACE 23 | 24 | #include "OldPlatform.h" 25 | 26 | #include "OldPropSet.h" 27 | #include "OldPropSetSimple.h" 28 | 29 | #ifdef SCI_NAMESPACE 30 | using namespace Scintilla; 31 | #endif 32 | 33 | typedef std::map mapss; 34 | 35 | PropSetSimple::PropSetSimple() { 36 | mapss *props = new mapss; 37 | impl = static_cast(props); 38 | } 39 | 40 | PropSetSimple::~PropSetSimple() { 41 | mapss *props = static_cast(impl); 42 | delete props; 43 | impl = 0; 44 | } 45 | 46 | void PropSetSimple::Set(const char *key, const char *val, int lenKey, int lenVal) { 47 | mapss *props = static_cast(impl); 48 | if (!*key) // Empty keys are not supported 49 | return; 50 | if (lenKey == -1) 51 | lenKey = static_cast(strlen(key)); 52 | if (lenVal == -1) 53 | lenVal = static_cast(strlen(val)); 54 | (*props)[std::string(key, lenKey)] = std::string(val, lenVal); 55 | } 56 | 57 | static bool IsASpaceCharacter(unsigned int ch) { 58 | return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); 59 | } 60 | 61 | void PropSetSimple::Set(const char *keyVal) { 62 | while (IsASpaceCharacter(*keyVal)) 63 | keyVal++; 64 | const char *endVal = keyVal; 65 | while (*endVal && (*endVal != '\n')) 66 | endVal++; 67 | const char *eqAt = strchr(keyVal, '='); 68 | if (eqAt) { 69 | Set(keyVal, eqAt + 1, eqAt-keyVal, endVal - eqAt - 1); 70 | } else if (*keyVal) { // No '=' so assume '=1' 71 | Set(keyVal, "1", endVal-keyVal, 1); 72 | } 73 | } 74 | 75 | void PropSetSimple::SetMultiple(const char *s) { 76 | const char *eol = strchr(s, '\n'); 77 | while (eol) { 78 | Set(s); 79 | s = eol + 1; 80 | eol = strchr(s, '\n'); 81 | } 82 | Set(s); 83 | } 84 | 85 | const char *PropSetSimple::Get(const char *key) const { 86 | mapss *props = static_cast(impl); 87 | mapss::const_iterator keyPos = props->find(std::string(key)); 88 | if (keyPos != props->end()) { 89 | return keyPos->second.c_str(); 90 | } else { 91 | return ""; 92 | } 93 | } 94 | 95 | // There is some inconsistency between GetExpanded("foo") and Expand("$(foo)"). 96 | // A solution is to keep a stack of variables that have been expanded, so that 97 | // recursive expansions can be skipped. For now I'll just use the C++ stack 98 | // for that, through a recursive function and a simple chain of pointers. 99 | 100 | struct VarChain { 101 | VarChain(const char *var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {} 102 | 103 | bool contains(const char *testVar) const { 104 | return (var && (0 == strcmp(var, testVar))) 105 | || (link && link->contains(testVar)); 106 | } 107 | 108 | const char *var; 109 | const VarChain *link; 110 | }; 111 | 112 | static int ExpandAllInPlace(const PropSetSimple &props, std::string &withVars, int maxExpands, const VarChain &blankVars) { 113 | size_t varStart = withVars.find("$("); 114 | while ((varStart != std::string::npos) && (maxExpands > 0)) { 115 | size_t varEnd = withVars.find(")", varStart+2); 116 | if (varEnd == std::string::npos) { 117 | break; 118 | } 119 | 120 | // For consistency, when we see '$(ab$(cde))', expand the inner variable first, 121 | // regardless whether there is actually a degenerate variable named 'ab$(cde'. 122 | size_t innerVarStart = withVars.find("$(", varStart+2); 123 | while ((innerVarStart != std::string::npos) && (innerVarStart > varStart) && (innerVarStart < varEnd)) { 124 | varStart = innerVarStart; 125 | innerVarStart = withVars.find("$(", varStart+2); 126 | } 127 | 128 | std::string var(withVars.c_str(), varStart + 2, varEnd - varStart - 2); 129 | std::string val = props.Get(var.c_str()); 130 | 131 | if (blankVars.contains(var.c_str())) { 132 | val = ""; // treat blankVar as an empty string (e.g. to block self-reference) 133 | } 134 | 135 | if (--maxExpands >= 0) { 136 | maxExpands = ExpandAllInPlace(props, val, maxExpands, VarChain(var.c_str(), &blankVars)); 137 | } 138 | 139 | withVars.erase(varStart, varEnd-varStart+1); 140 | withVars.insert(varStart, val.c_str(), val.length()); 141 | 142 | varStart = withVars.find("$("); 143 | } 144 | 145 | return maxExpands; 146 | } 147 | 148 | char *PropSetSimple::Expanded(const char *key) const { 149 | std::string val = Get(key); 150 | ExpandAllInPlace(*this, val, 100, VarChain(key)); 151 | char *ret = new char [val.size() + 1]; 152 | strcpy(ret, val.c_str()); 153 | return ret; 154 | } 155 | 156 | char *PropSetSimple::ToString() const { 157 | mapss *props = static_cast(impl); 158 | std::string sval; 159 | for (mapss::const_iterator it=props->begin(); it != props->end(); it++) { 160 | sval += it->first; 161 | sval += "="; 162 | sval += it->second; 163 | sval += "\n"; 164 | } 165 | char *ret = new char [sval.size() + 1]; 166 | strcpy(ret, sval.c_str()); 167 | return ret; 168 | } 169 | 170 | int PropSetSimple::GetInt(const char *key, int defaultValue) const { 171 | char *val = Expanded(key); 172 | if (val) { 173 | int retVal = val[0] ? atoi(val) : defaultValue; 174 | delete []val; 175 | return retVal; 176 | } 177 | return defaultValue; 178 | } 179 | -------------------------------------------------------------------------------- /GmodLua/legacylib/OldPropSet.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file PropSet.h 3 | ** An interface to the methods needed for access to property sets inside lexers. 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 | #ifndef PROPSET_H 9 | #define PROPSET_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | class PropertyGet { 16 | public: 17 | virtual char *ToString() const=0; // Caller must delete[] the return value 18 | virtual int GetInt(const char *key, int defaultValue=0) const=0; 19 | virtual ~PropertyGet() {} 20 | }; 21 | 22 | #ifdef SCI_NAMESPACE 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /GmodLua/legacylib/OldPropSetSimple.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file PropSetSimple.h 3 | ** A basic string to string map. 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 | #ifndef PROPSETSIMPLE_H 9 | #define PROPSETSIMPLE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | class PropSetSimple : public PropertyGet { 16 | void *impl; 17 | void Set(const char *keyVal); 18 | public: 19 | PropSetSimple(); 20 | virtual ~PropSetSimple(); 21 | void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1); 22 | void SetMultiple(const char *); 23 | const char *Get(const char *key) const; 24 | char *Expanded(const char *key) const; 25 | char *ToString() const; 26 | int GetInt(const char *key, int defaultValue=0) const; 27 | }; 28 | 29 | #ifdef SCI_NAMESPACE 30 | } 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /GmodLua/legacylib/OldScintilla.h: -------------------------------------------------------------------------------- 1 | /* Scintilla source code edit control */ 2 | /** @file Scintilla.h 3 | ** Interface to the edit control. 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 | /* Most of this file is automatically generated from the Scintilla.iface interface definition 9 | * file which contains any comments about the definitions. HFacer.py does the generation. */ 10 | 11 | #ifndef SCINTILLA_H 12 | #define SCINTILLA_H 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #if defined(_WIN32) 19 | /* Return false on failure: */ 20 | int Scintilla_RegisterClasses(void *hInstance); 21 | int Scintilla_ReleaseResources(); 22 | #endif 23 | int Scintilla_LinkLexers(); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | /* Here should be placed typedefs for uptr_t, an unsigned integer type large enough to 30 | * hold a pointer and sptr_t, a signed integer large enough to hold a pointer. 31 | * May need to be changed for 64 bit platforms. */ 32 | #if defined(_WIN32) 33 | #include 34 | #endif 35 | #ifdef MAXULONG_PTR 36 | typedef ULONG_PTR uptr_t; 37 | typedef LONG_PTR sptr_t; 38 | #else 39 | typedef unsigned long uptr_t; 40 | typedef long sptr_t; 41 | #endif 42 | 43 | typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); 44 | 45 | /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ 46 | #define INVALID_POSITION -1 47 | #define SCI_START 2000 48 | #define SCI_OPTIONAL_START 3000 49 | #define SCI_LEXER_START 4000 50 | #define SCI_ADDTEXT 2001 51 | #define SCI_ADDSTYLEDTEXT 2002 52 | #define SCI_INSERTTEXT 2003 53 | #define SCI_CLEARALL 2004 54 | #define SCI_CLEARDOCUMENTSTYLE 2005 55 | #define SCI_GETLENGTH 2006 56 | #define SCI_GETCHARAT 2007 57 | #define SCI_GETCURRENTPOS 2008 58 | #define SCI_GETANCHOR 2009 59 | #define SCI_GETSTYLEAT 2010 60 | #define SCI_REDO 2011 61 | #define SCI_SETUNDOCOLLECTION 2012 62 | #define SCI_SELECTALL 2013 63 | #define SCI_SETSAVEPOINT 2014 64 | #define SCI_GETSTYLEDTEXT 2015 65 | #define SCI_CANREDO 2016 66 | #define SCI_MARKERLINEFROMHANDLE 2017 67 | #define SCI_MARKERDELETEHANDLE 2018 68 | #define SCI_GETUNDOCOLLECTION 2019 69 | #define SCWS_INVISIBLE 0 70 | #define SCWS_VISIBLEALWAYS 1 71 | #define SCWS_VISIBLEAFTERINDENT 2 72 | #define SCI_GETVIEWWS 2020 73 | #define SCI_SETVIEWWS 2021 74 | #define SCI_POSITIONFROMPOINT 2022 75 | #define SCI_POSITIONFROMPOINTCLOSE 2023 76 | #define SCI_GOTOLINE 2024 77 | #define SCI_GOTOPOS 2025 78 | #define SCI_SETANCHOR 2026 79 | #define SCI_GETCURLINE 2027 80 | #define SCI_GETENDSTYLED 2028 81 | #define SC_EOL_CRLF 0 82 | #define SC_EOL_CR 1 83 | #define SC_EOL_LF 2 84 | #define SCI_CONVERTEOLS 2029 85 | #define SCI_GETEOLMODE 2030 86 | #define SCI_SETEOLMODE 2031 87 | #define SCI_STARTSTYLING 2032 88 | #define SCI_SETSTYLING 2033 89 | #define SCI_GETBUFFEREDDRAW 2034 90 | #define SCI_SETBUFFEREDDRAW 2035 91 | #define SCI_SETTABWIDTH 2036 92 | #define SCI_GETTABWIDTH 2121 93 | #define SC_CP_UTF8 65001 94 | #define SC_CP_DBCS 1 95 | #define SCI_SETCODEPAGE 2037 96 | #define SCI_SETUSEPALETTE 2039 97 | #define MARKER_MAX 31 98 | #define SC_MARK_CIRCLE 0 99 | #define SC_MARK_ROUNDRECT 1 100 | #define SC_MARK_ARROW 2 101 | #define SC_MARK_SMALLRECT 3 102 | #define SC_MARK_SHORTARROW 4 103 | #define SC_MARK_EMPTY 5 104 | #define SC_MARK_ARROWDOWN 6 105 | #define SC_MARK_MINUS 7 106 | #define SC_MARK_PLUS 8 107 | #define SC_MARK_VLINE 9 108 | #define SC_MARK_LCORNER 10 109 | #define SC_MARK_TCORNER 11 110 | #define SC_MARK_BOXPLUS 12 111 | #define SC_MARK_BOXPLUSCONNECTED 13 112 | #define SC_MARK_BOXMINUS 14 113 | #define SC_MARK_BOXMINUSCONNECTED 15 114 | #define SC_MARK_LCORNERCURVE 16 115 | #define SC_MARK_TCORNERCURVE 17 116 | #define SC_MARK_CIRCLEPLUS 18 117 | #define SC_MARK_CIRCLEPLUSCONNECTED 19 118 | #define SC_MARK_CIRCLEMINUS 20 119 | #define SC_MARK_CIRCLEMINUSCONNECTED 21 120 | #define SC_MARK_BACKGROUND 22 121 | #define SC_MARK_DOTDOTDOT 23 122 | #define SC_MARK_ARROWS 24 123 | #define SC_MARK_PIXMAP 25 124 | #define SC_MARK_FULLRECT 26 125 | #define SC_MARK_LEFTRECT 27 126 | #define SC_MARK_AVAILABLE 28 127 | #define SC_MARK_UNDERLINE 29 128 | #define SC_MARK_CHARACTER 10000 129 | #define SC_MARKNUM_FOLDEREND 25 130 | #define SC_MARKNUM_FOLDEROPENMID 26 131 | #define SC_MARKNUM_FOLDERMIDTAIL 27 132 | #define SC_MARKNUM_FOLDERTAIL 28 133 | #define SC_MARKNUM_FOLDERSUB 29 134 | #define SC_MARKNUM_FOLDER 30 135 | #define SC_MARKNUM_FOLDEROPEN 31 136 | #define SC_MASK_FOLDERS 0xFE000000 137 | #define SCI_MARKERDEFINE 2040 138 | #define SCI_MARKERSETFORE 2041 139 | #define SCI_MARKERSETBACK 2042 140 | #define SCI_MARKERADD 2043 141 | #define SCI_MARKERDELETE 2044 142 | #define SCI_MARKERDELETEALL 2045 143 | #define SCI_MARKERGET 2046 144 | #define SCI_MARKERNEXT 2047 145 | #define SCI_MARKERPREVIOUS 2048 146 | #define SCI_MARKERDEFINEPIXMAP 2049 147 | #define SCI_MARKERADDSET 2466 148 | #define SCI_MARKERSETALPHA 2476 149 | #define SC_MARGIN_SYMBOL 0 150 | #define SC_MARGIN_NUMBER 1 151 | #define SC_MARGIN_BACK 2 152 | #define SC_MARGIN_FORE 3 153 | #define SC_MARGIN_TEXT 4 154 | #define SC_MARGIN_RTEXT 5 155 | #define SCI_SETMARGINTYPEN 2240 156 | #define SCI_GETMARGINTYPEN 2241 157 | #define SCI_SETMARGINWIDTHN 2242 158 | #define SCI_GETMARGINWIDTHN 2243 159 | #define SCI_SETMARGINMASKN 2244 160 | #define SCI_GETMARGINMASKN 2245 161 | #define SCI_SETMARGINSENSITIVEN 2246 162 | #define SCI_GETMARGINSENSITIVEN 2247 163 | #define STYLE_DEFAULT 32 164 | #define STYLE_LINENUMBER 33 165 | #define STYLE_BRACELIGHT 34 166 | #define STYLE_BRACEBAD 35 167 | #define STYLE_CONTROLCHAR 36 168 | #define STYLE_INDENTGUIDE 37 169 | #define STYLE_CALLTIP 38 170 | #define STYLE_LASTPREDEFINED 39 171 | #define STYLE_MAX 255 172 | #define SC_CHARSET_ANSI 0 173 | #define SC_CHARSET_DEFAULT 1 174 | #define SC_CHARSET_BALTIC 186 175 | #define SC_CHARSET_CHINESEBIG5 136 176 | #define SC_CHARSET_EASTEUROPE 238 177 | #define SC_CHARSET_GB2312 134 178 | #define SC_CHARSET_GREEK 161 179 | #define SC_CHARSET_HANGUL 129 180 | #define SC_CHARSET_MAC 77 181 | #define SC_CHARSET_OEM 255 182 | #define SC_CHARSET_RUSSIAN 204 183 | #define SC_CHARSET_CYRILLIC 1251 184 | #define SC_CHARSET_SHIFTJIS 128 185 | #define SC_CHARSET_SYMBOL 2 186 | #define SC_CHARSET_TURKISH 162 187 | #define SC_CHARSET_JOHAB 130 188 | #define SC_CHARSET_HEBREW 177 189 | #define SC_CHARSET_ARABIC 178 190 | #define SC_CHARSET_VIETNAMESE 163 191 | #define SC_CHARSET_THAI 222 192 | #define SC_CHARSET_8859_15 1000 193 | #define SCI_STYLECLEARALL 2050 194 | #define SCI_STYLESETFORE 2051 195 | #define SCI_STYLESETBACK 2052 196 | #define SCI_STYLESETBOLD 2053 197 | #define SCI_STYLESETITALIC 2054 198 | #define SCI_STYLESETSIZE 2055 199 | #define SCI_STYLESETFONT 2056 200 | #define SCI_STYLESETEOLFILLED 2057 201 | #define SCI_STYLERESETDEFAULT 2058 202 | #define SCI_STYLESETUNDERLINE 2059 203 | #define SC_CASE_MIXED 0 204 | #define SC_CASE_UPPER 1 205 | #define SC_CASE_LOWER 2 206 | #define SCI_STYLEGETFORE 2481 207 | #define SCI_STYLEGETBACK 2482 208 | #define SCI_STYLEGETBOLD 2483 209 | #define SCI_STYLEGETITALIC 2484 210 | #define SCI_STYLEGETSIZE 2485 211 | #define SCI_STYLEGETFONT 2486 212 | #define SCI_STYLEGETEOLFILLED 2487 213 | #define SCI_STYLEGETUNDERLINE 2488 214 | #define SCI_STYLEGETCASE 2489 215 | #define SCI_STYLEGETCHARACTERSET 2490 216 | #define SCI_STYLEGETVISIBLE 2491 217 | #define SCI_STYLEGETCHANGEABLE 2492 218 | #define SCI_STYLEGETHOTSPOT 2493 219 | #define SCI_STYLESETCASE 2060 220 | #define SCI_STYLESETCHARACTERSET 2066 221 | #define SCI_STYLESETHOTSPOT 2409 222 | #define SCI_SETSELFORE 2067 223 | #define SCI_SETSELBACK 2068 224 | #define SCI_GETSELALPHA 2477 225 | #define SCI_SETSELALPHA 2478 226 | #define SCI_GETSELEOLFILLED 2479 227 | #define SCI_SETSELEOLFILLED 2480 228 | #define SCI_SETCARETFORE 2069 229 | #define SCI_ASSIGNCMDKEY 2070 230 | #define SCI_CLEARCMDKEY 2071 231 | #define SCI_CLEARALLCMDKEYS 2072 232 | #define SCI_SETSTYLINGEX 2073 233 | #define SCI_STYLESETVISIBLE 2074 234 | #define SCI_GETCARETPERIOD 2075 235 | #define SCI_SETCARETPERIOD 2076 236 | #define SCI_SETWORDCHARS 2077 237 | #define SCI_BEGINUNDOACTION 2078 238 | #define SCI_ENDUNDOACTION 2079 239 | #define INDIC_PLAIN 0 240 | #define INDIC_SQUIGGLE 1 241 | #define INDIC_TT 2 242 | #define INDIC_DIAGONAL 3 243 | #define INDIC_STRIKE 4 244 | #define INDIC_HIDDEN 5 245 | #define INDIC_BOX 6 246 | #define INDIC_ROUNDBOX 7 247 | #define INDIC_MAX 31 248 | #define INDIC_CONTAINER 8 249 | #define INDIC0_MASK 0x20 250 | #define INDIC1_MASK 0x40 251 | #define INDIC2_MASK 0x80 252 | #define INDICS_MASK 0xE0 253 | #define SCI_INDICSETSTYLE 2080 254 | #define SCI_INDICGETSTYLE 2081 255 | #define SCI_INDICSETFORE 2082 256 | #define SCI_INDICGETFORE 2083 257 | #define SCI_INDICSETUNDER 2510 258 | #define SCI_INDICGETUNDER 2511 259 | #define SCI_SETWHITESPACEFORE 2084 260 | #define SCI_SETWHITESPACEBACK 2085 261 | #define SCI_SETWHITESPACESIZE 2086 262 | #define SCI_GETWHITESPACESIZE 2087 263 | #define SCI_SETSTYLEBITS 2090 264 | #define SCI_GETSTYLEBITS 2091 265 | #define SCI_SETLINESTATE 2092 266 | #define SCI_GETLINESTATE 2093 267 | #define SCI_GETMAXLINESTATE 2094 268 | #define SCI_GETCARETLINEVISIBLE 2095 269 | #define SCI_SETCARETLINEVISIBLE 2096 270 | #define SCI_GETCARETLINEBACK 2097 271 | #define SCI_SETCARETLINEBACK 2098 272 | #define SCI_STYLESETCHANGEABLE 2099 273 | #define SCI_AUTOCSHOW 2100 274 | #define SCI_AUTOCCANCEL 2101 275 | #define SCI_AUTOCACTIVE 2102 276 | #define SCI_AUTOCPOSSTART 2103 277 | #define SCI_AUTOCCOMPLETE 2104 278 | #define SCI_AUTOCSTOPS 2105 279 | #define SCI_AUTOCSETSEPARATOR 2106 280 | #define SCI_AUTOCGETSEPARATOR 2107 281 | #define SCI_AUTOCSELECT 2108 282 | #define SCI_AUTOCSETCANCELATSTART 2110 283 | #define SCI_AUTOCGETCANCELATSTART 2111 284 | #define SCI_AUTOCSETFILLUPS 2112 285 | #define SCI_AUTOCSETCHOOSESINGLE 2113 286 | #define SCI_AUTOCGETCHOOSESINGLE 2114 287 | #define SCI_AUTOCSETIGNORECASE 2115 288 | #define SCI_AUTOCGETIGNORECASE 2116 289 | #define SCI_USERLISTSHOW 2117 290 | #define SCI_AUTOCSETAUTOHIDE 2118 291 | #define SCI_AUTOCGETAUTOHIDE 2119 292 | #define SCI_AUTOCSETDROPRESTOFWORD 2270 293 | #define SCI_AUTOCGETDROPRESTOFWORD 2271 294 | #define SCI_REGISTERIMAGE 2405 295 | #define SCI_CLEARREGISTEREDIMAGES 2408 296 | #define SCI_AUTOCGETTYPESEPARATOR 2285 297 | #define SCI_AUTOCSETTYPESEPARATOR 2286 298 | #define SCI_AUTOCSETMAXWIDTH 2208 299 | #define SCI_AUTOCGETMAXWIDTH 2209 300 | #define SCI_AUTOCSETMAXHEIGHT 2210 301 | #define SCI_AUTOCGETMAXHEIGHT 2211 302 | #define SCI_SETINDENT 2122 303 | #define SCI_GETINDENT 2123 304 | #define SCI_SETUSETABS 2124 305 | #define SCI_GETUSETABS 2125 306 | #define SCI_SETLINEINDENTATION 2126 307 | #define SCI_GETLINEINDENTATION 2127 308 | #define SCI_GETLINEINDENTPOSITION 2128 309 | #define SCI_GETCOLUMN 2129 310 | #define SCI_SETHSCROLLBAR 2130 311 | #define SCI_GETHSCROLLBAR 2131 312 | #define SC_IV_NONE 0 313 | #define SC_IV_REAL 1 314 | #define SC_IV_LOOKFORWARD 2 315 | #define SC_IV_LOOKBOTH 3 316 | #define SCI_SETINDENTATIONGUIDES 2132 317 | #define SCI_GETINDENTATIONGUIDES 2133 318 | #define SCI_SETHIGHLIGHTGUIDE 2134 319 | #define SCI_GETHIGHLIGHTGUIDE 2135 320 | #define SCI_GETLINEENDPOSITION 2136 321 | #define SCI_GETCODEPAGE 2137 322 | #define SCI_GETCARETFORE 2138 323 | #define SCI_GETUSEPALETTE 2139 324 | #define SCI_GETREADONLY 2140 325 | #define SCI_SETCURRENTPOS 2141 326 | #define SCI_SETSELECTIONSTART 2142 327 | #define SCI_GETSELECTIONSTART 2143 328 | #define SCI_SETSELECTIONEND 2144 329 | #define SCI_GETSELECTIONEND 2145 330 | #define SCI_SETPRINTMAGNIFICATION 2146 331 | #define SCI_GETPRINTMAGNIFICATION 2147 332 | #define SC_PRINT_NORMAL 0 333 | #define SC_PRINT_INVERTLIGHT 1 334 | #define SC_PRINT_BLACKONWHITE 2 335 | #define SC_PRINT_COLOURONWHITE 3 336 | #define SC_PRINT_COLOURONWHITEDEFAULTBG 4 337 | #define SCI_SETPRINTCOLOURMODE 2148 338 | #define SCI_GETPRINTCOLOURMODE 2149 339 | #define SCFIND_WHOLEWORD 2 340 | #define SCFIND_MATCHCASE 4 341 | #define SCFIND_WORDSTART 0x00100000 342 | #define SCFIND_REGEXP 0x00200000 343 | #define SCFIND_POSIX 0x00400000 344 | #define SCI_FINDTEXT 2150 345 | #define SCI_FORMATRANGE 2151 346 | #define SCI_GETFIRSTVISIBLELINE 2152 347 | #define SCI_GETLINE 2153 348 | #define SCI_GETLINECOUNT 2154 349 | #define SCI_SETMARGINLEFT 2155 350 | #define SCI_GETMARGINLEFT 2156 351 | #define SCI_SETMARGINRIGHT 2157 352 | #define SCI_GETMARGINRIGHT 2158 353 | #define SCI_GETMODIFY 2159 354 | #define SCI_SETSEL 2160 355 | #define SCI_GETSELTEXT 2161 356 | #define SCI_GETTEXTRANGE 2162 357 | #define SCI_HIDESELECTION 2163 358 | #define SCI_POINTXFROMPOSITION 2164 359 | #define SCI_POINTYFROMPOSITION 2165 360 | #define SCI_LINEFROMPOSITION 2166 361 | #define SCI_POSITIONFROMLINE 2167 362 | #define SCI_LINESCROLL 2168 363 | #define SCI_SCROLLCARET 2169 364 | #define SCI_REPLACESEL 2170 365 | #define SCI_SETREADONLY 2171 366 | #define SCI_NULL 2172 367 | #define SCI_CANPASTE 2173 368 | #define SCI_CANUNDO 2174 369 | #define SCI_EMPTYUNDOBUFFER 2175 370 | #define SCI_UNDO 2176 371 | #define SCI_CUT 2177 372 | #define SCI_COPY 2178 373 | #define SCI_PASTE 2179 374 | #define SCI_CLEAR 2180 375 | #define SCI_SETTEXT 2181 376 | #define SCI_GETTEXT 2182 377 | #define SCI_GETTEXTLENGTH 2183 378 | #define SCI_GETDIRECTFUNCTION 2184 379 | #define SCI_GETDIRECTPOINTER 2185 380 | #define SCI_SETOVERTYPE 2186 381 | #define SCI_GETOVERTYPE 2187 382 | #define SCI_SETCARETWIDTH 2188 383 | #define SCI_GETCARETWIDTH 2189 384 | #define SCI_SETTARGETSTART 2190 385 | #define SCI_GETTARGETSTART 2191 386 | #define SCI_SETTARGETEND 2192 387 | #define SCI_GETTARGETEND 2193 388 | #define SCI_REPLACETARGET 2194 389 | #define SCI_REPLACETARGETRE 2195 390 | #define SCI_SEARCHINTARGET 2197 391 | #define SCI_SETSEARCHFLAGS 2198 392 | #define SCI_GETSEARCHFLAGS 2199 393 | #define SCI_CALLTIPSHOW 2200 394 | #define SCI_CALLTIPCANCEL 2201 395 | #define SCI_CALLTIPACTIVE 2202 396 | #define SCI_CALLTIPPOSSTART 2203 397 | #define SCI_CALLTIPSETHLT 2204 398 | #define SCI_CALLTIPSETBACK 2205 399 | #define SCI_CALLTIPSETFORE 2206 400 | #define SCI_CALLTIPSETFOREHLT 2207 401 | #define SCI_CALLTIPUSESTYLE 2212 402 | #define SCI_VISIBLEFROMDOCLINE 2220 403 | #define SCI_DOCLINEFROMVISIBLE 2221 404 | #define SCI_WRAPCOUNT 2235 405 | #define SC_FOLDLEVELBASE 0x400 406 | #define SC_FOLDLEVELWHITEFLAG 0x1000 407 | #define SC_FOLDLEVELHEADERFLAG 0x2000 408 | #define SC_FOLDLEVELNUMBERMASK 0x0FFF 409 | #define SCI_SETFOLDLEVEL 2222 410 | #define SCI_GETFOLDLEVEL 2223 411 | #define SCI_GETLASTCHILD 2224 412 | #define SCI_GETFOLDPARENT 2225 413 | #define SCI_SHOWLINES 2226 414 | #define SCI_HIDELINES 2227 415 | #define SCI_GETLINEVISIBLE 2228 416 | #define SCI_SETFOLDEXPANDED 2229 417 | #define SCI_GETFOLDEXPANDED 2230 418 | #define SCI_TOGGLEFOLD 2231 419 | #define SCI_ENSUREVISIBLE 2232 420 | #define SC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002 421 | #define SC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004 422 | #define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 423 | #define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 424 | #define SC_FOLDFLAG_LEVELNUMBERS 0x0040 425 | #define SCI_SETFOLDFLAGS 2233 426 | #define SCI_ENSUREVISIBLEENFORCEPOLICY 2234 427 | #define SCI_SETTABINDENTS 2260 428 | #define SCI_GETTABINDENTS 2261 429 | #define SCI_SETBACKSPACEUNINDENTS 2262 430 | #define SCI_GETBACKSPACEUNINDENTS 2263 431 | #define SC_TIME_FOREVER 10000000 432 | #define SCI_SETMOUSEDWELLTIME 2264 433 | #define SCI_GETMOUSEDWELLTIME 2265 434 | #define SCI_WORDSTARTPOSITION 2266 435 | #define SCI_WORDENDPOSITION 2267 436 | #define SC_WRAP_NONE 0 437 | #define SC_WRAP_WORD 1 438 | #define SC_WRAP_CHAR 2 439 | #define SCI_SETWRAPMODE 2268 440 | #define SCI_GETWRAPMODE 2269 441 | #define SC_WRAPVISUALFLAG_NONE 0x0000 442 | #define SC_WRAPVISUALFLAG_END 0x0001 443 | #define SC_WRAPVISUALFLAG_START 0x0002 444 | #define SCI_SETWRAPVISUALFLAGS 2460 445 | #define SCI_GETWRAPVISUALFLAGS 2461 446 | #define SC_WRAPVISUALFLAGLOC_DEFAULT 0x0000 447 | #define SC_WRAPVISUALFLAGLOC_END_BY_TEXT 0x0001 448 | #define SC_WRAPVISUALFLAGLOC_START_BY_TEXT 0x0002 449 | #define SCI_SETWRAPVISUALFLAGSLOCATION 2462 450 | #define SCI_GETWRAPVISUALFLAGSLOCATION 2463 451 | #define SCI_SETWRAPSTARTINDENT 2464 452 | #define SCI_GETWRAPSTARTINDENT 2465 453 | #define SC_WRAPINDENT_FIXED 0 454 | #define SC_WRAPINDENT_SAME 1 455 | #define SC_WRAPINDENT_INDENT 2 456 | #define SCI_SETWRAPINDENTMODE 2472 457 | #define SCI_GETWRAPINDENTMODE 2473 458 | #define SC_CACHE_NONE 0 459 | #define SC_CACHE_CARET 1 460 | #define SC_CACHE_PAGE 2 461 | #define SC_CACHE_DOCUMENT 3 462 | #define SCI_SETLAYOUTCACHE 2272 463 | #define SCI_GETLAYOUTCACHE 2273 464 | #define SCI_SETSCROLLWIDTH 2274 465 | #define SCI_GETSCROLLWIDTH 2275 466 | #define SCI_SETSCROLLWIDTHTRACKING 2516 467 | #define SCI_GETSCROLLWIDTHTRACKING 2517 468 | #define SCI_TEXTWIDTH 2276 469 | #define SCI_SETENDATLASTLINE 2277 470 | #define SCI_GETENDATLASTLINE 2278 471 | #define SCI_TEXTHEIGHT 2279 472 | #define SCI_SETVSCROLLBAR 2280 473 | #define SCI_GETVSCROLLBAR 2281 474 | #define SCI_APPENDTEXT 2282 475 | #define SCI_GETTWOPHASEDRAW 2283 476 | #define SCI_SETTWOPHASEDRAW 2284 477 | #define SC_EFF_QUALITY_MASK 0xF 478 | #define SC_EFF_QUALITY_DEFAULT 0 479 | #define SC_EFF_QUALITY_NON_ANTIALIASED 1 480 | #define SC_EFF_QUALITY_ANTIALIASED 2 481 | #define SC_EFF_QUALITY_LCD_OPTIMIZED 3 482 | #define SCI_SETFONTQUALITY 2611 483 | #define SCI_GETFONTQUALITY 2612 484 | #define SCI_SETFIRSTVISIBLELINE 2613 485 | #define SC_MULTIPASTE_ONCE 0 486 | #define SC_MULTIPASTE_EACH 1 487 | #define SCI_SETMULTIPASTE 2614 488 | #define SCI_GETMULTIPASTE 2615 489 | #define SCI_GETTAG 2616 490 | #define SCI_TARGETFROMSELECTION 2287 491 | #define SCI_LINESJOIN 2288 492 | #define SCI_LINESSPLIT 2289 493 | #define SCI_SETFOLDMARGINCOLOUR 2290 494 | #define SCI_SETFOLDMARGINHICOLOUR 2291 495 | #define SCI_LINEDOWN 2300 496 | #define SCI_LINEDOWNEXTEND 2301 497 | #define SCI_LINEUP 2302 498 | #define SCI_LINEUPEXTEND 2303 499 | #define SCI_CHARLEFT 2304 500 | #define SCI_CHARLEFTEXTEND 2305 501 | #define SCI_CHARRIGHT 2306 502 | #define SCI_CHARRIGHTEXTEND 2307 503 | #define SCI_WORDLEFT 2308 504 | #define SCI_WORDLEFTEXTEND 2309 505 | #define SCI_WORDRIGHT 2310 506 | #define SCI_WORDRIGHTEXTEND 2311 507 | #define SCI_HOME 2312 508 | #define SCI_HOMEEXTEND 2313 509 | #define SCI_LINEEND 2314 510 | #define SCI_LINEENDEXTEND 2315 511 | #define SCI_DOCUMENTSTART 2316 512 | #define SCI_DOCUMENTSTARTEXTEND 2317 513 | #define SCI_DOCUMENTEND 2318 514 | #define SCI_DOCUMENTENDEXTEND 2319 515 | #define SCI_PAGEUP 2320 516 | #define SCI_PAGEUPEXTEND 2321 517 | #define SCI_PAGEDOWN 2322 518 | #define SCI_PAGEDOWNEXTEND 2323 519 | #define SCI_EDITTOGGLEOVERTYPE 2324 520 | #define SCI_CANCEL 2325 521 | #define SCI_DELETEBACK 2326 522 | #define SCI_TAB 2327 523 | #define SCI_BACKTAB 2328 524 | #define SCI_NEWLINE 2329 525 | #define SCI_FORMFEED 2330 526 | #define SCI_VCHOME 2331 527 | #define SCI_VCHOMEEXTEND 2332 528 | #define SCI_ZOOMIN 2333 529 | #define SCI_ZOOMOUT 2334 530 | #define SCI_DELWORDLEFT 2335 531 | #define SCI_DELWORDRIGHT 2336 532 | #define SCI_DELWORDRIGHTEND 2518 533 | #define SCI_LINECUT 2337 534 | #define SCI_LINEDELETE 2338 535 | #define SCI_LINETRANSPOSE 2339 536 | #define SCI_LINEDUPLICATE 2404 537 | #define SCI_LOWERCASE 2340 538 | #define SCI_UPPERCASE 2341 539 | #define SCI_LINESCROLLDOWN 2342 540 | #define SCI_LINESCROLLUP 2343 541 | #define SCI_DELETEBACKNOTLINE 2344 542 | #define SCI_HOMEDISPLAY 2345 543 | #define SCI_HOMEDISPLAYEXTEND 2346 544 | #define SCI_LINEENDDISPLAY 2347 545 | #define SCI_LINEENDDISPLAYEXTEND 2348 546 | #define SCI_HOMEWRAP 2349 547 | #define SCI_HOMEWRAPEXTEND 2450 548 | #define SCI_LINEENDWRAP 2451 549 | #define SCI_LINEENDWRAPEXTEND 2452 550 | #define SCI_VCHOMEWRAP 2453 551 | #define SCI_VCHOMEWRAPEXTEND 2454 552 | #define SCI_LINECOPY 2455 553 | #define SCI_MOVECARETINSIDEVIEW 2401 554 | #define SCI_LINELENGTH 2350 555 | #define SCI_BRACEHIGHLIGHT 2351 556 | #define SCI_BRACEBADLIGHT 2352 557 | #define SCI_BRACEMATCH 2353 558 | #define SCI_GETVIEWEOL 2355 559 | #define SCI_SETVIEWEOL 2356 560 | #define SCI_GETDOCPOINTER 2357 561 | #define SCI_SETDOCPOINTER 2358 562 | #define SCI_SETMODEVENTMASK 2359 563 | #define EDGE_NONE 0 564 | #define EDGE_LINE 1 565 | #define EDGE_BACKGROUND 2 566 | #define SCI_GETEDGECOLUMN 2360 567 | #define SCI_SETEDGECOLUMN 2361 568 | #define SCI_GETEDGEMODE 2362 569 | #define SCI_SETEDGEMODE 2363 570 | #define SCI_GETEDGECOLOUR 2364 571 | #define SCI_SETEDGECOLOUR 2365 572 | #define SCI_SEARCHANCHOR 2366 573 | #define SCI_SEARCHNEXT 2367 574 | #define SCI_SEARCHPREV 2368 575 | #define SCI_LINESONSCREEN 2370 576 | #define SCI_USEPOPUP 2371 577 | #define SCI_SELECTIONISRECTANGLE 2372 578 | #define SCI_SETZOOM 2373 579 | #define SCI_GETZOOM 2374 580 | #define SCI_CREATEDOCUMENT 2375 581 | #define SCI_ADDREFDOCUMENT 2376 582 | #define SCI_RELEASEDOCUMENT 2377 583 | #define SCI_GETMODEVENTMASK 2378 584 | #define SCI_SETFOCUS 2380 585 | #define SCI_GETFOCUS 2381 586 | #define SC_STATUS_OK 0 587 | #define SC_STATUS_FAILURE 1 588 | #define SC_STATUS_BADALLOC 2 589 | #define SCI_SETSTATUS 2382 590 | #define SCI_GETSTATUS 2383 591 | #define SCI_SETMOUSEDOWNCAPTURES 2384 592 | #define SCI_GETMOUSEDOWNCAPTURES 2385 593 | #define SC_CURSORNORMAL -1 594 | #define SC_CURSORWAIT 4 595 | #define SCI_SETCURSOR 2386 596 | #define SCI_GETCURSOR 2387 597 | #define SCI_SETCONTROLCHARSYMBOL 2388 598 | #define SCI_GETCONTROLCHARSYMBOL 2389 599 | #define SCI_WORDPARTLEFT 2390 600 | #define SCI_WORDPARTLEFTEXTEND 2391 601 | #define SCI_WORDPARTRIGHT 2392 602 | #define SCI_WORDPARTRIGHTEXTEND 2393 603 | #define VISIBLE_SLOP 0x01 604 | #define VISIBLE_STRICT 0x04 605 | #define SCI_SETVISIBLEPOLICY 2394 606 | #define SCI_DELLINELEFT 2395 607 | #define SCI_DELLINERIGHT 2396 608 | #define SCI_SETXOFFSET 2397 609 | #define SCI_GETXOFFSET 2398 610 | #define SCI_CHOOSECARETX 2399 611 | #define SCI_GRABFOCUS 2400 612 | #define CARET_SLOP 0x01 613 | #define CARET_STRICT 0x04 614 | #define CARET_JUMPS 0x10 615 | #define CARET_EVEN 0x08 616 | #define SCI_SETXCARETPOLICY 2402 617 | #define SCI_SETYCARETPOLICY 2403 618 | #define SCI_SETPRINTWRAPMODE 2406 619 | #define SCI_GETPRINTWRAPMODE 2407 620 | #define SCI_SETHOTSPOTACTIVEFORE 2410 621 | #define SCI_GETHOTSPOTACTIVEFORE 2494 622 | #define SCI_SETHOTSPOTACTIVEBACK 2411 623 | #define SCI_GETHOTSPOTACTIVEBACK 2495 624 | #define SCI_SETHOTSPOTACTIVEUNDERLINE 2412 625 | #define SCI_GETHOTSPOTACTIVEUNDERLINE 2496 626 | #define SCI_SETHOTSPOTSINGLELINE 2421 627 | #define SCI_GETHOTSPOTSINGLELINE 2497 628 | #define SCI_PARADOWN 2413 629 | #define SCI_PARADOWNEXTEND 2414 630 | #define SCI_PARAUP 2415 631 | #define SCI_PARAUPEXTEND 2416 632 | #define SCI_POSITIONBEFORE 2417 633 | #define SCI_POSITIONAFTER 2418 634 | #define SCI_COPYRANGE 2419 635 | #define SCI_COPYTEXT 2420 636 | #define SC_SEL_STREAM 0 637 | #define SC_SEL_RECTANGLE 1 638 | #define SC_SEL_LINES 2 639 | #define SC_SEL_THIN 3 640 | #define SCI_SETSELECTIONMODE 2422 641 | #define SCI_GETSELECTIONMODE 2423 642 | #define SCI_GETLINESELSTARTPOSITION 2424 643 | #define SCI_GETLINESELENDPOSITION 2425 644 | #define SCI_LINEDOWNRECTEXTEND 2426 645 | #define SCI_LINEUPRECTEXTEND 2427 646 | #define SCI_CHARLEFTRECTEXTEND 2428 647 | #define SCI_CHARRIGHTRECTEXTEND 2429 648 | #define SCI_HOMERECTEXTEND 2430 649 | #define SCI_VCHOMERECTEXTEND 2431 650 | #define SCI_LINEENDRECTEXTEND 2432 651 | #define SCI_PAGEUPRECTEXTEND 2433 652 | #define SCI_PAGEDOWNRECTEXTEND 2434 653 | #define SCI_STUTTEREDPAGEUP 2435 654 | #define SCI_STUTTEREDPAGEUPEXTEND 2436 655 | #define SCI_STUTTEREDPAGEDOWN 2437 656 | #define SCI_STUTTEREDPAGEDOWNEXTEND 2438 657 | #define SCI_WORDLEFTEND 2439 658 | #define SCI_WORDLEFTENDEXTEND 2440 659 | #define SCI_WORDRIGHTEND 2441 660 | #define SCI_WORDRIGHTENDEXTEND 2442 661 | #define SCI_SETWHITESPACECHARS 2443 662 | #define SCI_SETCHARSDEFAULT 2444 663 | #define SCI_AUTOCGETCURRENT 2445 664 | #define SCI_AUTOCGETCURRENTTEXT 2610 665 | #define SCI_ALLOCATE 2446 666 | #define SCI_TARGETASUTF8 2447 667 | #define SCI_SETLENGTHFORENCODE 2448 668 | #define SCI_ENCODEDFROMUTF8 2449 669 | #define SCI_FINDCOLUMN 2456 670 | #define SCI_GETCARETSTICKY 2457 671 | #define SCI_SETCARETSTICKY 2458 672 | #define SCI_TOGGLECARETSTICKY 2459 673 | #define SCI_SETPASTECONVERTENDINGS 2467 674 | #define SCI_GETPASTECONVERTENDINGS 2468 675 | #define SCI_SELECTIONDUPLICATE 2469 676 | #define SC_ALPHA_TRANSPARENT 0 677 | #define SC_ALPHA_OPAQUE 255 678 | #define SC_ALPHA_NOALPHA 256 679 | #define SCI_SETCARETLINEBACKALPHA 2470 680 | #define SCI_GETCARETLINEBACKALPHA 2471 681 | #define CARETSTYLE_INVISIBLE 0 682 | #define CARETSTYLE_LINE 1 683 | #define CARETSTYLE_BLOCK 2 684 | #define SCI_SETCARETSTYLE 2512 685 | #define SCI_GETCARETSTYLE 2513 686 | #define SCI_SETINDICATORCURRENT 2500 687 | #define SCI_GETINDICATORCURRENT 2501 688 | #define SCI_SETINDICATORVALUE 2502 689 | #define SCI_GETINDICATORVALUE 2503 690 | #define SCI_INDICATORFILLRANGE 2504 691 | #define SCI_INDICATORCLEARRANGE 2505 692 | #define SCI_INDICATORALLONFOR 2506 693 | #define SCI_INDICATORVALUEAT 2507 694 | #define SCI_INDICATORSTART 2508 695 | #define SCI_INDICATOREND 2509 696 | #define SCI_SETPOSITIONCACHE 2514 697 | #define SCI_GETPOSITIONCACHE 2515 698 | #define SCI_COPYALLOWLINE 2519 699 | #define SCI_GETCHARACTERPOINTER 2520 700 | #define SCI_SETKEYSUNICODE 2521 701 | #define SCI_GETKEYSUNICODE 2522 702 | #define SCI_INDICSETALPHA 2523 703 | #define SCI_INDICGETALPHA 2524 704 | #define SCI_SETEXTRAASCENT 2525 705 | #define SCI_GETEXTRAASCENT 2526 706 | #define SCI_SETEXTRADESCENT 2527 707 | #define SCI_GETEXTRADESCENT 2528 708 | #define SCI_MARKERSYMBOLDEFINED 2529 709 | #define SCI_MARGINSETTEXT 2530 710 | #define SCI_MARGINGETTEXT 2531 711 | #define SCI_MARGINSETSTYLE 2532 712 | #define SCI_MARGINGETSTYLE 2533 713 | #define SCI_MARGINSETSTYLES 2534 714 | #define SCI_MARGINGETSTYLES 2535 715 | #define SCI_MARGINTEXTCLEARALL 2536 716 | #define SCI_MARGINSETSTYLEOFFSET 2537 717 | #define SCI_MARGINGETSTYLEOFFSET 2538 718 | #define SCI_ANNOTATIONSETTEXT 2540 719 | #define SCI_ANNOTATIONGETTEXT 2541 720 | #define SCI_ANNOTATIONSETSTYLE 2542 721 | #define SCI_ANNOTATIONGETSTYLE 2543 722 | #define SCI_ANNOTATIONSETSTYLES 2544 723 | #define SCI_ANNOTATIONGETSTYLES 2545 724 | #define SCI_ANNOTATIONGETLINES 2546 725 | #define SCI_ANNOTATIONCLEARALL 2547 726 | #define ANNOTATION_HIDDEN 0 727 | #define ANNOTATION_STANDARD 1 728 | #define ANNOTATION_BOXED 2 729 | #define SCI_ANNOTATIONSETVISIBLE 2548 730 | #define SCI_ANNOTATIONGETVISIBLE 2549 731 | #define SCI_ANNOTATIONSETSTYLEOFFSET 2550 732 | #define SCI_ANNOTATIONGETSTYLEOFFSET 2551 733 | #define UNDO_MAY_COALESCE 1 734 | #define SCI_ADDUNDOACTION 2560 735 | #define SCI_CHARPOSITIONFROMPOINT 2561 736 | #define SCI_CHARPOSITIONFROMPOINTCLOSE 2562 737 | #define SCI_SETMULTIPLESELECTION 2563 738 | #define SCI_GETMULTIPLESELECTION 2564 739 | #define SCI_SETADDITIONALSELECTIONTYPING 2565 740 | #define SCI_GETADDITIONALSELECTIONTYPING 2566 741 | #define SCI_SETADDITIONALCARETSBLINK 2567 742 | #define SCI_GETADDITIONALCARETSBLINK 2568 743 | #define SCI_SETADDITIONALCARETSVISIBLE 2608 744 | #define SCI_GETADDITIONALCARETSVISIBLE 2609 745 | #define SCI_GETSELECTIONS 2570 746 | #define SCI_CLEARSELECTIONS 2571 747 | #define SCI_SETSELECTION 2572 748 | #define SCI_ADDSELECTION 2573 749 | #define SCI_SETMAINSELECTION 2574 750 | #define SCI_GETMAINSELECTION 2575 751 | #define SCI_SETSELECTIONNCARET 2576 752 | #define SCI_GETSELECTIONNCARET 2577 753 | #define SCI_SETSELECTIONNANCHOR 2578 754 | #define SCI_GETSELECTIONNANCHOR 2579 755 | #define SCI_SETSELECTIONNCARETVIRTUALSPACE 2580 756 | #define SCI_GETSELECTIONNCARETVIRTUALSPACE 2581 757 | #define SCI_SETSELECTIONNANCHORVIRTUALSPACE 2582 758 | #define SCI_GETSELECTIONNANCHORVIRTUALSPACE 2583 759 | #define SCI_SETSELECTIONNSTART 2584 760 | #define SCI_GETSELECTIONNSTART 2585 761 | #define SCI_SETSELECTIONNEND 2586 762 | #define SCI_GETSELECTIONNEND 2587 763 | #define SCI_SETRECTANGULARSELECTIONCARET 2588 764 | #define SCI_GETRECTANGULARSELECTIONCARET 2589 765 | #define SCI_SETRECTANGULARSELECTIONANCHOR 2590 766 | #define SCI_GETRECTANGULARSELECTIONANCHOR 2591 767 | #define SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE 2592 768 | #define SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE 2593 769 | #define SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE 2594 770 | #define SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE 2595 771 | #define SCVS_NONE 0 772 | #define SCVS_RECTANGULARSELECTION 1 773 | #define SCVS_USERACCESSIBLE 2 774 | #define SCI_SETVIRTUALSPACEOPTIONS 2596 775 | #define SCI_GETVIRTUALSPACEOPTIONS 2597 776 | #define SCI_SETRECTANGULARSELECTIONMODIFIER 2598 777 | #define SCI_GETRECTANGULARSELECTIONMODIFIER 2599 778 | #define SCI_SETADDITIONALSELFORE 2600 779 | #define SCI_SETADDITIONALSELBACK 2601 780 | #define SCI_SETADDITIONALSELALPHA 2602 781 | #define SCI_GETADDITIONALSELALPHA 2603 782 | #define SCI_SETADDITIONALCARETFORE 2604 783 | #define SCI_GETADDITIONALCARETFORE 2605 784 | #define SCI_ROTATESELECTION 2606 785 | #define SCI_SWAPMAINANCHORCARET 2607 786 | #define SCI_STARTRECORD 3001 787 | #define SCI_STOPRECORD 3002 788 | #define SCI_SETLEXER 4001 789 | #define SCI_GETLEXER 4002 790 | #define SCI_COLOURISE 4003 791 | #define SCI_SETPROPERTY 4004 792 | #define KEYWORDSET_MAX 8 793 | #define SCI_SETKEYWORDS 4005 794 | #define SCI_SETLEXERLANGUAGE 4006 795 | #define SCI_LOADLEXERLIBRARY 4007 796 | #define SCI_GETPROPERTY 4008 797 | #define SCI_GETPROPERTYEXPANDED 4009 798 | #define SCI_GETPROPERTYINT 4010 799 | #define SCI_GETSTYLEBITSNEEDED 4011 800 | #define SCI_GETLEXERLANGUAGE 4012 801 | #define SC_MOD_INSERTTEXT 0x1 802 | #define SC_MOD_DELETETEXT 0x2 803 | #define SC_MOD_CHANGESTYLE 0x4 804 | #define SC_MOD_CHANGEFOLD 0x8 805 | #define SC_PERFORMED_USER 0x10 806 | #define SC_PERFORMED_UNDO 0x20 807 | #define SC_PERFORMED_REDO 0x40 808 | #define SC_MULTISTEPUNDOREDO 0x80 809 | #define SC_LASTSTEPINUNDOREDO 0x100 810 | #define SC_MOD_CHANGEMARKER 0x200 811 | #define SC_MOD_BEFOREINSERT 0x400 812 | #define SC_MOD_BEFOREDELETE 0x800 813 | #define SC_MULTILINEUNDOREDO 0x1000 814 | #define SC_STARTACTION 0x2000 815 | #define SC_MOD_CHANGEINDICATOR 0x4000 816 | #define SC_MOD_CHANGELINESTATE 0x8000 817 | #define SC_MOD_CHANGEMARGIN 0x10000 818 | #define SC_MOD_CHANGEANNOTATION 0x20000 819 | #define SC_MOD_CONTAINER 0x40000 820 | #define SC_MODEVENTMASKALL 0x7FFFF 821 | #define SCEN_CHANGE 768 822 | #define SCEN_SETFOCUS 512 823 | #define SCEN_KILLFOCUS 256 824 | #define SCK_DOWN 300 825 | #define SCK_UP 301 826 | #define SCK_LEFT 302 827 | #define SCK_RIGHT 303 828 | #define SCK_HOME 304 829 | #define SCK_END 305 830 | #define SCK_PRIOR 306 831 | #define SCK_NEXT 307 832 | #define SCK_DELETE 308 833 | #define SCK_INSERT 309 834 | #define SCK_ESCAPE 7 835 | #define SCK_BACK 8 836 | #define SCK_TAB 9 837 | #define SCK_RETURN 13 838 | #define SCK_ADD 310 839 | #define SCK_SUBTRACT 311 840 | #define SCK_DIVIDE 312 841 | #define SCK_WIN 313 842 | #define SCK_RWIN 314 843 | #define SCK_MENU 315 844 | #define SCMOD_NORM 0 845 | #define SCMOD_SHIFT 1 846 | #define SCMOD_CTRL 2 847 | #define SCMOD_ALT 4 848 | #define SCMOD_SUPER 8 849 | #define SCN_STYLENEEDED 2000 850 | #define SCN_CHARADDED 2001 851 | #define SCN_SAVEPOINTREACHED 2002 852 | #define SCN_SAVEPOINTLEFT 2003 853 | #define SCN_MODIFYATTEMPTRO 2004 854 | #define SCN_KEY 2005 855 | #define SCN_DOUBLECLICK 2006 856 | #define SCN_UPDATEUI 2007 857 | #define SCN_MODIFIED 2008 858 | #define SCN_MACRORECORD 2009 859 | #define SCN_MARGINCLICK 2010 860 | #define SCN_NEEDSHOWN 2011 861 | #define SCN_PAINTED 2013 862 | #define SCN_USERLISTSELECTION 2014 863 | #define SCN_URIDROPPED 2015 864 | #define SCN_DWELLSTART 2016 865 | #define SCN_DWELLEND 2017 866 | #define SCN_ZOOM 2018 867 | #define SCN_HOTSPOTCLICK 2019 868 | #define SCN_HOTSPOTDOUBLECLICK 2020 869 | #define SCN_CALLTIPCLICK 2021 870 | #define SCN_AUTOCSELECTION 2022 871 | #define SCN_INDICATORCLICK 2023 872 | #define SCN_INDICATORRELEASE 2024 873 | #define SCN_AUTOCCANCELLED 2025 874 | #define SCN_AUTOCCHARDELETED 2026 875 | /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ 876 | 877 | /* These structures are defined to be exactly the same shape as the Win32 878 | * CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. 879 | * So older code that treats Scintilla as a RichEdit will work. */ 880 | 881 | #ifdef SCI_NAMESPACE 882 | namespace Scintilla { 883 | #endif 884 | 885 | struct Sci_CharacterRange { 886 | long cpMin; 887 | long cpMax; 888 | }; 889 | 890 | struct Sci_TextRange { 891 | struct Sci_CharacterRange chrg; 892 | char *lpstrText; 893 | }; 894 | 895 | struct Sci_TextToFind { 896 | struct Sci_CharacterRange chrg; 897 | char *lpstrText; 898 | struct Sci_CharacterRange chrgText; 899 | }; 900 | 901 | #define CharacterRange Sci_CharacterRange 902 | #define TextRange Sci_TextRange 903 | #define TextToFind Sci_TextToFind 904 | 905 | typedef void *Sci_SurfaceID; 906 | 907 | struct Sci_Rectangle { 908 | int left; 909 | int top; 910 | int right; 911 | int bottom; 912 | }; 913 | 914 | /* This structure is used in printing and requires some of the graphics types 915 | * from Platform.h. Not needed by most client code. */ 916 | 917 | struct Sci_RangeToFormat { 918 | Sci_SurfaceID hdc; 919 | Sci_SurfaceID hdcTarget; 920 | struct Sci_Rectangle rc; 921 | struct Sci_Rectangle rcPage; 922 | struct Sci_CharacterRange chrg; 923 | }; 924 | 925 | #define RangeToFormat Sci_RangeToFormat 926 | 927 | struct Sci_NotifyHeader { 928 | /* Compatible with Windows NMHDR. 929 | * hwndFrom is really an environment specific window handle or pointer 930 | * but most clients of Scintilla.h do not have this type visible. */ 931 | void *hwndFrom; 932 | uptr_t idFrom; 933 | unsigned int code; 934 | }; 935 | 936 | #define NotifyHeader Sci_NotifyHeader 937 | 938 | struct SCNotification { 939 | struct Sci_NotifyHeader nmhdr; 940 | int position; /* SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND */ 941 | int ch; /* SCN_CHARADDED, SCN_KEY */ 942 | int modifiers; /* SCN_KEY */ 943 | int modificationType; /* SCN_MODIFIED */ 944 | const char *text; /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */ 945 | int length; /* SCN_MODIFIED */ 946 | int linesAdded; /* SCN_MODIFIED */ 947 | int message; /* SCN_MACRORECORD */ 948 | uptr_t wParam; /* SCN_MACRORECORD */ 949 | sptr_t lParam; /* SCN_MACRORECORD */ 950 | int line; /* SCN_MODIFIED */ 951 | int foldLevelNow; /* SCN_MODIFIED */ 952 | int foldLevelPrev; /* SCN_MODIFIED */ 953 | int margin; /* SCN_MARGINCLICK */ 954 | int listType; /* SCN_USERLISTSELECTION */ 955 | int x; /* SCN_DWELLSTART, SCN_DWELLEND */ 956 | int y; /* SCN_DWELLSTART, SCN_DWELLEND */ 957 | int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */ 958 | int annotationLinesAdded; /* SC_MOD_CHANGEANNOTATION */ 959 | }; 960 | 961 | #ifdef SCI_NAMESPACE 962 | } 963 | #endif 964 | 965 | #endif 966 | -------------------------------------------------------------------------------- /GmodLua/legacylib/OldStyleContext.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file StyleContext.cxx 3 | ** Lexer infrastructure. 4 | **/ 5 | // Copyright 1998-2004 by Neil Hodgson 6 | // This file is in the public domain. 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #define SCI_NAMESPACE 14 | 15 | #include "OldPlatform.h" 16 | 17 | #include "OldPropSet.h" 18 | #include "OldAccessor.h" 19 | #include "OldStyleContext.h" 20 | 21 | #ifdef SCI_NAMESPACE 22 | using namespace Scintilla; 23 | #endif 24 | 25 | static void getRange(unsigned int start, 26 | unsigned int end, 27 | Accessor &styler, 28 | char *s, 29 | unsigned int len) { 30 | unsigned int i = 0; 31 | while ((i < end - start + 1) && (i < len-1)) { 32 | s[i] = styler[start + i]; 33 | i++; 34 | } 35 | s[i] = '\0'; 36 | } 37 | 38 | void StyleContext::GetCurrent(char *s, unsigned int len) { 39 | getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len); 40 | } 41 | 42 | static void getRangeLowered(unsigned int start, 43 | unsigned int end, 44 | Accessor &styler, 45 | char *s, 46 | unsigned int len) { 47 | unsigned int i = 0; 48 | while ((i < end - start + 1) && (i < len-1)) { 49 | s[i] = static_cast(tolower(styler[start + i])); 50 | i++; 51 | } 52 | s[i] = '\0'; 53 | } 54 | 55 | void StyleContext::GetCurrentLowered(char *s, unsigned int len) { 56 | getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len); 57 | } 58 | -------------------------------------------------------------------------------- /GmodLua/legacylib/OldStyleContext.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file StyleContext.cxx 3 | ** Lexer infrastructure. 4 | **/ 5 | // Copyright 1998-2004 by Neil Hodgson 6 | // This file is in the public domain. 7 | 8 | #ifdef SCI_NAMESPACE 9 | namespace Scintilla { 10 | #endif 11 | 12 | // All languages handled so far can treat all characters >= 0x80 as one class 13 | // which just continues the current token or starts an identifier if in default. 14 | // DBCS treated specially as the second character can be < 0x80 and hence 15 | // syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80 16 | class StyleContext { 17 | Accessor &styler; 18 | unsigned int endPos; 19 | StyleContext &operator=(const StyleContext &); 20 | void GetNextChar(unsigned int pos) { 21 | chNext = static_cast(styler.SafeGetCharAt(pos+1)); 22 | if (styler.IsLeadByte(static_cast(chNext))) { 23 | chNext = chNext << 8; 24 | chNext |= static_cast(styler.SafeGetCharAt(pos+2)); 25 | } 26 | // End of line? 27 | // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) 28 | // or on LF alone (Unix). Avoid triggering two times on Dos/Win. 29 | atLineEnd = (ch == '\r' && chNext != '\n') || 30 | (ch == '\n') || 31 | (currentPos >= endPos); 32 | } 33 | 34 | public: 35 | unsigned int currentPos; 36 | bool atLineStart; 37 | bool atLineEnd; 38 | int state; 39 | int chPrev; 40 | int ch; 41 | int chNext; 42 | 43 | StyleContext(unsigned int startPos, unsigned int length, 44 | int initStyle, Accessor &styler_, char chMask=31) : 45 | styler(styler_), 46 | endPos(startPos + length), 47 | currentPos(startPos), 48 | atLineStart(true), 49 | atLineEnd(false), 50 | state(initStyle & chMask), // Mask off all bits which aren't in the chMask. 51 | chPrev(0), 52 | ch(0), 53 | chNext(0) { 54 | styler.StartAt(startPos, chMask); 55 | styler.StartSegment(startPos); 56 | unsigned int pos = currentPos; 57 | ch = static_cast(styler.SafeGetCharAt(pos)); 58 | if (styler.IsLeadByte(static_cast(ch))) { 59 | pos++; 60 | ch = ch << 8; 61 | ch |= static_cast(styler.SafeGetCharAt(pos)); 62 | } 63 | GetNextChar(pos); 64 | } 65 | void Complete() { 66 | styler.ColourTo(currentPos - 1, state); 67 | } 68 | bool More() const { 69 | return currentPos < endPos; 70 | } 71 | void Forward() { 72 | if (currentPos < endPos) { 73 | atLineStart = atLineEnd; 74 | chPrev = ch; 75 | currentPos++; 76 | if (ch >= 0x100) 77 | currentPos++; 78 | ch = chNext; 79 | GetNextChar(currentPos + ((ch >= 0x100) ? 1 : 0)); 80 | } else { 81 | atLineStart = false; 82 | chPrev = ' '; 83 | ch = ' '; 84 | chNext = ' '; 85 | atLineEnd = true; 86 | } 87 | } 88 | void Forward(int nb) { 89 | for (int i = 0; i < nb; i++) { 90 | Forward(); 91 | } 92 | } 93 | void ChangeState(int state_) { 94 | state = state_; 95 | } 96 | void SetState(int state_) { 97 | styler.ColourTo(currentPos - 1, state); 98 | state = state_; 99 | } 100 | void ForwardSetState(int state_) { 101 | Forward(); 102 | styler.ColourTo(currentPos - 1, state); 103 | state = state_; 104 | } 105 | int LengthCurrent() { 106 | return currentPos - styler.GetStartSegment(); 107 | } 108 | int GetRelative(int n) { 109 | return static_cast(styler.SafeGetCharAt(currentPos+n)); 110 | } 111 | bool Match(char ch0) const { 112 | return ch == static_cast(ch0); 113 | } 114 | bool Match(char ch0, char ch1) const { 115 | return (ch == static_cast(ch0)) && (chNext == static_cast(ch1)); 116 | } 117 | bool Match(const char *s) { 118 | if (ch != static_cast(*s)) 119 | return false; 120 | s++; 121 | if (!*s) 122 | return true; 123 | if (chNext != static_cast(*s)) 124 | return false; 125 | s++; 126 | for (int n=2; *s; n++) { 127 | if (*s != styler.SafeGetCharAt(currentPos+n)) 128 | return false; 129 | s++; 130 | } 131 | return true; 132 | } 133 | bool MatchIgnoreCase(const char *s) { 134 | if (tolower(ch) != static_cast(*s)) 135 | return false; 136 | s++; 137 | if (tolower(chNext) != static_cast(*s)) 138 | return false; 139 | s++; 140 | for (int n=2; *s; n++) { 141 | if (static_cast(*s) != 142 | tolower(static_cast(styler.SafeGetCharAt(currentPos+n)))) 143 | return false; 144 | s++; 145 | } 146 | return true; 147 | } 148 | // Non-inline 149 | void GetCurrent(char *s, unsigned int len); 150 | void GetCurrentLowered(char *s, unsigned int len); 151 | }; 152 | 153 | #ifdef SCI_NAMESPACE 154 | } 155 | #endif 156 | 157 | inline bool IsASpace(unsigned int ch) { 158 | return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); 159 | } 160 | 161 | inline bool IsASpaceOrTab(unsigned int ch) { 162 | return (ch == ' ') || (ch == '\t'); 163 | } 164 | 165 | inline bool IsADigit(unsigned int ch) { 166 | return (ch >= '0') && (ch <= '9'); 167 | } 168 | 169 | inline bool IsADigit(unsigned int ch, unsigned int base) { 170 | if (base <= 10) { 171 | return (ch >= '0') && (ch < '0' + base); 172 | } else { 173 | return ((ch >= '0') && (ch <= '9')) || 174 | ((ch >= 'A') && (ch < 'A' + base - 10)) || 175 | ((ch >= 'a') && (ch < 'a' + base - 10)); 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /GmodLua/legacylib/OldUniConversion.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file UniConversion.cxx 3 | ** Functions to handle UTF-8 and UTF-16 strings. 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 | #include 9 | 10 | #define SCI_NAMESPACE 11 | 12 | #include "OldUniConversion.h" 13 | 14 | enum { SURROGATE_LEAD_FIRST = 0xD800 }; 15 | enum { SURROGATE_TRAIL_FIRST = 0xDC00 }; 16 | enum { SURROGATE_TRAIL_LAST = 0xDFFF }; 17 | 18 | unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) { 19 | unsigned int len = 0; 20 | for (unsigned int i = 0; i < tlen && uptr[i];) { 21 | unsigned int uch = uptr[i]; 22 | if (uch < 0x80) { 23 | len++; 24 | } else if (uch < 0x800) { 25 | len += 2; 26 | } else if ((uch >= SURROGATE_LEAD_FIRST) && 27 | (uch <= SURROGATE_TRAIL_LAST)) { 28 | len += 4; 29 | i++; 30 | } else { 31 | len += 3; 32 | } 33 | i++; 34 | } 35 | return len; 36 | } 37 | 38 | void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len) { 39 | int k = 0; 40 | for (unsigned int i = 0; i < tlen && uptr[i];) { 41 | unsigned int uch = uptr[i]; 42 | if (uch < 0x80) { 43 | putf[k++] = static_cast(uch); 44 | } else if (uch < 0x800) { 45 | putf[k++] = static_cast(0xC0 | (uch >> 6)); 46 | putf[k++] = static_cast(0x80 | (uch & 0x3f)); 47 | } else if ((uch >= SURROGATE_LEAD_FIRST) && 48 | (uch <= SURROGATE_TRAIL_LAST)) { 49 | // Half a surrogate pair 50 | i++; 51 | unsigned int xch = 0x10000 + ((uch & 0x3ff) << 10) + (uptr[i] & 0x3ff); 52 | putf[k++] = static_cast(0xF0 | (xch >> 18)); 53 | putf[k++] = static_cast(0x80 | ((xch >> 12) & 0x3f)); 54 | putf[k++] = static_cast(0x80 | ((xch >> 6) & 0x3f)); 55 | putf[k++] = static_cast(0x80 | (xch & 0x3f)); 56 | } else { 57 | putf[k++] = static_cast(0xE0 | (uch >> 12)); 58 | putf[k++] = static_cast(0x80 | ((uch >> 6) & 0x3f)); 59 | putf[k++] = static_cast(0x80 | (uch & 0x3f)); 60 | } 61 | i++; 62 | } 63 | putf[len] = '\0'; 64 | } 65 | 66 | unsigned int UTF8CharLength(unsigned char ch) { 67 | if (ch < 0x80) { 68 | return 1; 69 | } else if (ch < 0x80 + 0x40 + 0x20) { 70 | return 2; 71 | } else if (ch < 0x80 + 0x40 + 0x20 + 0x10) { 72 | return 3; 73 | } else { 74 | return 4; 75 | } 76 | } 77 | 78 | unsigned int UTF16Length(const char *s, unsigned int len) { 79 | unsigned int ulen = 0; 80 | unsigned int charLen; 81 | for (unsigned int i=0; i(s[i]); 83 | if (ch < 0x80) { 84 | charLen = 1; 85 | } else if (ch < 0x80 + 0x40 + 0x20) { 86 | charLen = 2; 87 | } else if (ch < 0x80 + 0x40 + 0x20 + 0x10) { 88 | charLen = 3; 89 | } else { 90 | charLen = 4; 91 | ulen++; 92 | } 93 | i += charLen; 94 | ulen++; 95 | } 96 | return ulen; 97 | } 98 | 99 | unsigned int UTF16FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen) { 100 | unsigned int ui=0; 101 | const unsigned char *us = reinterpret_cast(s); 102 | unsigned int i=0; 103 | while ((i((ch & 0x1F) << 6); 109 | ch = us[i++]; 110 | tbuf[ui] = static_cast(tbuf[ui] + (ch & 0x7F)); 111 | } else if (ch < 0x80 + 0x40 + 0x20 + 0x10) { 112 | tbuf[ui] = static_cast((ch & 0xF) << 12); 113 | ch = us[i++]; 114 | tbuf[ui] = static_cast(tbuf[ui] + ((ch & 0x7F) << 6)); 115 | ch = us[i++]; 116 | tbuf[ui] = static_cast(tbuf[ui] + (ch & 0x7F)); 117 | } else { 118 | // Outside the BMP so need two surrogates 119 | int val = (ch & 0x7) << 18; 120 | ch = us[i++]; 121 | val += (ch & 0x3F) << 12; 122 | ch = us[i++]; 123 | val += (ch & 0x3F) << 6; 124 | ch = us[i++]; 125 | val += (ch & 0x3F); 126 | tbuf[ui] = static_cast(((val - 0x10000) >> 10) + SURROGATE_LEAD_FIRST); 127 | ui++; 128 | tbuf[ui] = static_cast((val & 0x3ff) + SURROGATE_TRAIL_FIRST); 129 | } 130 | ui++; 131 | } 132 | return ui; 133 | } 134 | -------------------------------------------------------------------------------- /GmodLua/legacylib/OldUniConversion.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file UniConversion.h 3 | ** Functions to handle UTF-8 and UTF-16 strings. 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 | unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen); 9 | void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len); 10 | unsigned int UTF8CharLength(unsigned char ch); 11 | unsigned int UTF16Length(const char *s, unsigned int len); 12 | unsigned int UTF16FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen); 13 | 14 | -------------------------------------------------------------------------------- /GmodLua/legacylib/OldWindowAccessor.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file WindowAccessor.cxx 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 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #define SCI_NAMESPACE 14 | 15 | #include "OldPlatform.h" 16 | 17 | #include "OldPropSet.h" 18 | #include "OldAccessor.h" 19 | #include "OldWindowAccessor.h" 20 | #include "OldScintilla.h" 21 | 22 | #ifdef SCI_NAMESPACE 23 | using namespace Scintilla; 24 | #endif 25 | 26 | WindowAccessor::~WindowAccessor() { 27 | } 28 | 29 | bool WindowAccessor::InternalIsLeadByte(char ch) { 30 | if (SC_CP_UTF8 == codePage) 31 | // For lexing, all characters >= 0x80 are treated the 32 | // same so none is considered a lead byte. 33 | return false; 34 | else 35 | return Platform::IsDBCSLeadByte(codePage, ch); 36 | } 37 | 38 | void WindowAccessor::Fill(int position) { 39 | if (lenDoc == -1) 40 | lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0); 41 | startPos = position - slopSize; 42 | if (startPos + bufferSize > lenDoc) 43 | startPos = lenDoc - bufferSize; 44 | if (startPos < 0) 45 | startPos = 0; 46 | endPos = startPos + bufferSize; 47 | if (endPos > lenDoc) 48 | endPos = lenDoc; 49 | 50 | Sci_TextRange tr = {{startPos, endPos}, buf}; 51 | Platform::SendScintillaPointer(id, SCI_GETTEXTRANGE, 0, &tr); 52 | } 53 | 54 | bool WindowAccessor::Match(int pos, const char *s) { 55 | for (int i=0; *s; i++) { 56 | if (*s != SafeGetCharAt(pos+i)) 57 | return false; 58 | s++; 59 | } 60 | return true; 61 | } 62 | 63 | char WindowAccessor::StyleAt(int position) { 64 | return static_cast(Platform::SendScintilla( 65 | id, SCI_GETSTYLEAT, position, 0)); 66 | } 67 | 68 | int WindowAccessor::GetLine(int position) { 69 | return Platform::SendScintilla(id, SCI_LINEFROMPOSITION, position, 0); 70 | } 71 | 72 | int WindowAccessor::LineStart(int line) { 73 | return Platform::SendScintilla(id, SCI_POSITIONFROMLINE, line, 0); 74 | } 75 | 76 | int WindowAccessor::LevelAt(int line) { 77 | return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0); 78 | } 79 | 80 | int WindowAccessor::Length() { 81 | if (lenDoc == -1) 82 | lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0); 83 | return lenDoc; 84 | } 85 | 86 | int WindowAccessor::GetLineState(int line) { 87 | return Platform::SendScintilla(id, SCI_GETLINESTATE, line); 88 | } 89 | 90 | int WindowAccessor::SetLineState(int line, int state) { 91 | return Platform::SendScintilla(id, SCI_SETLINESTATE, line, state); 92 | } 93 | 94 | void WindowAccessor::StartAt(unsigned int start, char chMask) { 95 | Platform::SendScintilla(id, SCI_STARTSTYLING, start, chMask); 96 | } 97 | 98 | void WindowAccessor::StartSegment(unsigned int pos) { 99 | startSeg = pos; 100 | } 101 | 102 | void WindowAccessor::ColourTo(unsigned int pos, int chAttr) { 103 | // Only perform styling if non empty range 104 | if (pos != startSeg - 1) { 105 | if (pos < startSeg) { 106 | Platform::DebugPrintf("Bad colour positions %d - %d\n", startSeg, pos); 107 | } 108 | 109 | if (validLen + (pos - startSeg + 1) >= bufferSize) 110 | Flush(); 111 | if (validLen + (pos - startSeg + 1) >= bufferSize) { 112 | // Too big for buffer so send directly 113 | Platform::SendScintilla(id, SCI_SETSTYLING, pos - startSeg + 1, chAttr); 114 | } else { 115 | if (chAttr != chWhile) 116 | chFlags = 0; 117 | chAttr |= chFlags; 118 | for (unsigned int i = startSeg; i <= pos; i++) { 119 | styleBuf[validLen++] = static_cast(chAttr); 120 | } 121 | } 122 | } 123 | startSeg = pos+1; 124 | } 125 | 126 | void WindowAccessor::SetLevel(int line, int level) { 127 | Platform::SendScintilla(id, SCI_SETFOLDLEVEL, line, level); 128 | } 129 | 130 | void WindowAccessor::Flush() { 131 | startPos = extremePosition; 132 | lenDoc = -1; 133 | if (validLen > 0) { 134 | Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen, 135 | styleBuf); 136 | validLen = 0; 137 | } 138 | } 139 | 140 | int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { 141 | int end = Length(); 142 | int spaceFlags = 0; 143 | 144 | // Determines the indentation level of the current line and also checks for consistent 145 | // indentation compared to the previous line. 146 | // Indentation is judged consistent when the indentation whitespace of each line lines 147 | // the same or the indentation of one line is a prefix of the other. 148 | 149 | int pos = LineStart(line); 150 | char ch = (*this)[pos]; 151 | int indent = 0; 152 | bool inPrevPrefix = line > 0; 153 | int posPrev = inPrevPrefix ? LineStart(line-1) : 0; 154 | while ((ch == ' ' || ch == '\t') && (pos < end)) { 155 | if (inPrevPrefix) { 156 | char chPrev = (*this)[posPrev++]; 157 | if (chPrev == ' ' || chPrev == '\t') { 158 | if (chPrev != ch) 159 | spaceFlags |= wsInconsistent; 160 | } else { 161 | inPrevPrefix = false; 162 | } 163 | } 164 | if (ch == ' ') { 165 | spaceFlags |= wsSpace; 166 | indent++; 167 | } else { // Tab 168 | spaceFlags |= wsTab; 169 | if (spaceFlags & wsSpace) 170 | spaceFlags |= wsSpaceTab; 171 | indent = (indent / 8 + 1) * 8; 172 | } 173 | ch = (*this)[++pos]; 174 | } 175 | 176 | *flags = spaceFlags; 177 | indent += SC_FOLDLEVELBASE; 178 | // if completely empty line or the start of a comment... 179 | if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos))) 180 | return indent | SC_FOLDLEVELWHITEFLAG; 181 | else 182 | return indent; 183 | } 184 | 185 | void WindowAccessor::IndicatorFill(int start, int end, int indicator, int value) { 186 | Platform::SendScintilla(id, SCI_SETINDICATORCURRENT, indicator); 187 | if (value) { 188 | Platform::SendScintilla(id, SCI_SETINDICATORVALUE, value); 189 | Platform::SendScintilla(id, SCI_INDICATORFILLRANGE, start, end - start); 190 | } else { 191 | Platform::SendScintilla(id, SCI_INDICATORCLEARRANGE, start, end - start); 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /GmodLua/legacylib/OldWindowAccessor.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file WindowAccessor.h 3 | ** Implementation of BufferAccess and StylingAccess on a Scintilla 4 | ** rapid easy access to contents of a Scintilla. 5 | **/ 6 | // Copyright 1998-2001 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifdef SCI_NAMESPACE 10 | namespace Scintilla { 11 | #endif 12 | 13 | /** 14 | */ 15 | 16 | class WindowAccessor : public Accessor { 17 | // Private so WindowAccessor objects can not be copied 18 | WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {} 19 | WindowAccessor &operator=(const WindowAccessor &) { return *this; } 20 | protected: 21 | WindowID id; 22 | PropertyGet &props; 23 | int lenDoc; 24 | 25 | char styleBuf[bufferSize]; 26 | int validLen; 27 | char chFlags; 28 | char chWhile; 29 | unsigned int startSeg; 30 | 31 | bool InternalIsLeadByte(char ch); 32 | void Fill(int position); 33 | public: 34 | WindowAccessor(WindowID id_, PropertyGet &props_) : 35 | Accessor(), id(id_), props(props_), 36 | lenDoc(-1), validLen(0), chFlags(0), chWhile(0) { 37 | } 38 | ~WindowAccessor(); 39 | bool Match(int pos, const char *s); 40 | char StyleAt(int position); 41 | int GetLine(int position); 42 | int LineStart(int line); 43 | int LevelAt(int line); 44 | int Length(); 45 | void Flush(); 46 | int GetLineState(int line); 47 | int SetLineState(int line, int state); 48 | int GetPropertyInt(const char *key, int defaultValue=0) { 49 | return props.GetInt(key, defaultValue); 50 | } 51 | char *GetProperties() { 52 | return props.ToString(); 53 | } 54 | 55 | void StartAt(unsigned int start, char chMask=31); 56 | void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; } 57 | unsigned int GetStartSegment() { return startSeg; } 58 | void StartSegment(unsigned int pos); 59 | void ColourTo(unsigned int pos, int chAttr); 60 | void SetLevel(int line, int level); 61 | int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); 62 | void IndicatorFill(int start, int end, int indicator, int value); 63 | }; 64 | 65 | #ifdef SCI_NAMESPACE 66 | } 67 | #endif 68 | -------------------------------------------------------------------------------- /GmodLua/legacylib/OldXPM.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file XPM.cxx 3 | ** Define a class that holds data in the X Pixmap (XPM) format. 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 | #include 9 | #include 10 | 11 | #define SCI_NAMESPACE 12 | 13 | #include "OldPlatform.h" 14 | 15 | #include "OldXPM.h" 16 | 17 | #ifdef SCI_NAMESPACE 18 | using namespace Scintilla; 19 | #endif 20 | 21 | static const char *NextField(const char *s) { 22 | // In case there are leading spaces in the string 23 | while (*s && *s == ' ') { 24 | s++; 25 | } 26 | while (*s && *s != ' ') { 27 | s++; 28 | } 29 | while (*s && *s == ' ') { 30 | s++; 31 | } 32 | return s; 33 | } 34 | 35 | // Data lines in XPM can be terminated either with NUL or " 36 | static size_t MeasureLength(const char *s) { 37 | size_t i = 0; 38 | while (s[i] && (s[i] != '\"')) 39 | i++; 40 | return i; 41 | } 42 | 43 | ColourAllocated XPM::ColourFromCode(int ch) const { 44 | return colourCodeTable[ch]->allocated; 45 | #ifdef SLOW 46 | for (int i=0; iFillRectangle(rc, ColourFromCode(code)); 59 | } 60 | } 61 | 62 | XPM::XPM(const char *textForm) : 63 | data(0), codes(0), colours(0), lines(0) { 64 | Init(textForm); 65 | } 66 | 67 | XPM::XPM(const char *const *linesForm) : 68 | data(0), codes(0), colours(0), lines(0) { 69 | Init(linesForm); 70 | } 71 | 72 | XPM::~XPM() { 73 | Clear(); 74 | } 75 | 76 | void XPM::Init(const char *textForm) { 77 | Clear(); 78 | // Test done is two parts to avoid possibility of overstepping the memory 79 | // if memcmp implemented strangely. Must be 4 bytes at least at destination. 80 | if ((0 == memcmp(textForm, "/* X", 4)) && (0 == memcmp(textForm, "/* XPM */", 9))) { 81 | // Build the lines form out of the text form 82 | const char **linesForm = LinesFormFromTextForm(textForm); 83 | if (linesForm != 0) { 84 | Init(linesForm); 85 | delete []linesForm; 86 | } 87 | } else { 88 | // It is really in line form 89 | Init(reinterpret_cast(textForm)); 90 | } 91 | } 92 | 93 | void XPM::Init(const char *const *linesForm) { 94 | Clear(); 95 | height = 1; 96 | width = 1; 97 | nColours = 1; 98 | data = NULL; 99 | codeTransparent = ' '; 100 | codes = NULL; 101 | colours = NULL; 102 | lines = NULL; 103 | if (!linesForm) 104 | return; 105 | 106 | const char *line0 = linesForm[0]; 107 | width = atoi(line0); 108 | line0 = NextField(line0); 109 | height = atoi(line0); 110 | line0 = NextField(line0); 111 | nColours = atoi(line0); 112 | line0 = NextField(line0); 113 | if (atoi(line0) != 1) { 114 | // Only one char per pixel is supported 115 | return; 116 | } 117 | codes = new char[nColours]; 118 | colours = new ColourPair[nColours]; 119 | 120 | int strings = 1+height+nColours; 121 | lines = new char *[strings]; 122 | size_t allocation = 0; 123 | for (int i=0; i(codes[c])] = &(colours[c]); 151 | } 152 | } 153 | 154 | void XPM::Clear() { 155 | delete []data; 156 | data = 0; 157 | delete []codes; 158 | codes = 0; 159 | delete []colours; 160 | colours = 0; 161 | delete []lines; 162 | lines = 0; 163 | } 164 | 165 | void XPM::RefreshColourPalette(Palette &pal, bool want) { 166 | if (!data || !codes || !colours || !lines) { 167 | return; 168 | } 169 | for (int i=0; i= strings) { 229 | break; // Bad height or number of colors! 230 | } 231 | if ((countQuotes & 1) == 0) { 232 | linesForm[countQuotes / 2] = textForm + j + 1; 233 | } 234 | countQuotes++; 235 | } 236 | } 237 | if (textForm[j] == '\0' || countQuotes / 2 > strings) { 238 | // Malformed XPM! Height + number of colors too high or too low 239 | delete []linesForm; 240 | linesForm = 0; 241 | } 242 | return linesForm; 243 | } 244 | 245 | // In future, may want to minimize search time by sorting and using a binary search. 246 | 247 | XPMSet::XPMSet() : set(0), len(0), maximum(0), height(-1), width(-1) { 248 | } 249 | 250 | XPMSet::~XPMSet() { 251 | Clear(); 252 | } 253 | 254 | void XPMSet::Clear() { 255 | for (int i = 0; i < len; i++) { 256 | delete set[i]; 257 | } 258 | delete []set; 259 | set = 0; 260 | len = 0; 261 | maximum = 0; 262 | height = -1; 263 | width = -1; 264 | } 265 | 266 | void XPMSet::Add(int id, const char *textForm) { 267 | // Invalidate cached dimensions 268 | height = -1; 269 | width = -1; 270 | 271 | // Replace if this id already present 272 | for (int i = 0; i < len; i++) { 273 | if (set[i]->GetId() == id) { 274 | set[i]->Init(textForm); 275 | set[i]->CopyDesiredColours(); 276 | return; 277 | } 278 | } 279 | 280 | // Not present, so add to end 281 | XPM *pxpm = new XPM(textForm); 282 | if (pxpm) { 283 | pxpm->SetId(id); 284 | pxpm->CopyDesiredColours(); 285 | if (len == maximum) { 286 | maximum += 64; 287 | XPM **setNew = new XPM *[maximum]; 288 | for (int i = 0; i < len; i++) { 289 | setNew[i] = set[i]; 290 | } 291 | delete []set; 292 | set = setNew; 293 | } 294 | set[len] = pxpm; 295 | len++; 296 | } 297 | } 298 | 299 | XPM *XPMSet::Get(int id) { 300 | for (int i = 0; i < len; i++) { 301 | if (set[i]->GetId() == id) { 302 | return set[i]; 303 | } 304 | } 305 | return 0; 306 | } 307 | 308 | int XPMSet::GetHeight() { 309 | if (height < 0) { 310 | for (int i = 0; i < len; i++) { 311 | if (height < set[i]->GetHeight()) { 312 | height = set[i]->GetHeight(); 313 | } 314 | } 315 | } 316 | return (height > 0) ? height : 0; 317 | } 318 | 319 | int XPMSet::GetWidth() { 320 | if (width < 0) { 321 | for (int i = 0; i < len; i++) { 322 | if (width < set[i]->GetWidth()) { 323 | width = set[i]->GetWidth(); 324 | } 325 | } 326 | } 327 | return (width > 0) ? width : 0; 328 | } 329 | -------------------------------------------------------------------------------- /GmodLua/legacylib/OldXPM.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file XPM.h 3 | ** Define a class that holds data in the X Pixmap (XPM) format. 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 | #ifndef XPM_H 9 | #define XPM_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | /** 16 | * Hold a pixmap in XPM format. 17 | */ 18 | class XPM { 19 | int pid; // Assigned by container 20 | int height; 21 | int width; 22 | int nColours; 23 | char *data; 24 | char codeTransparent; 25 | char *codes; 26 | ColourPair *colours; 27 | ColourAllocated ColourFromCode(int ch) const; 28 | void FillRun(Surface *surface, int code, int startX, int y, int x); 29 | char **lines; 30 | ColourPair *colourCodeTable[256]; 31 | public: 32 | XPM(const char *textForm); 33 | XPM(const char *const *linesForm); 34 | ~XPM(); 35 | void Init(const char *textForm); 36 | void Init(const char *const *linesForm); 37 | void Clear(); 38 | /// Similar to same named method in ViewStyle: 39 | void RefreshColourPalette(Palette &pal, bool want); 40 | /// No palette used, so just copy the desired colours to the allocated colours 41 | void CopyDesiredColours(); 42 | /// Decompose image into runs and use FillRectangle for each run 43 | void Draw(Surface *surface, PRectangle &rc); 44 | char **InLinesForm() { return lines; } 45 | void SetId(int pid_) { pid = pid_; } 46 | int GetId() const { return pid; } 47 | int GetHeight() const { return height; } 48 | int GetWidth() const { return width; } 49 | static const char **LinesFormFromTextForm(const char *textForm); 50 | }; 51 | 52 | /** 53 | * A collection of pixmaps indexed by integer id. 54 | */ 55 | class XPMSet { 56 | XPM **set; ///< The stored XPMs. 57 | int len; ///< Current number of XPMs. 58 | int maximum; ///< Current maximum number of XPMs, increased by steps if reached. 59 | int height; ///< Memorize largest height of the set. 60 | int width; ///< Memorize largest width of the set. 61 | public: 62 | XPMSet(); 63 | ~XPMSet(); 64 | /// Remove all XPMs. 65 | void Clear(); 66 | /// Add a XPM. 67 | void Add(int id, const char *textForm); 68 | /// Get XPM by id. 69 | XPM *Get(int id); 70 | /// Give the largest height of the set. 71 | int GetHeight(); 72 | /// Give the largest width of the set. 73 | int GetWidth(); 74 | }; 75 | 76 | #ifdef SCI_NAMESPACE 77 | } 78 | #endif 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /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/src/GmodLua.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of GmodLua. 2 | // A plugin written for Notepad++ 3 | 4 | // Copyright (C)2008-2010 Kyle Fleming ( garthex@gmail.com ) 5 | 6 | // GmodLua is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // GmodLua is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with GmodLua. If not, see . 18 | 19 | #include "GmodLua.h" 20 | 21 | #include "LexerBase.h" 22 | 23 | using namespace GmodLua; 24 | 25 | 26 | BOOL APIENTRY DllMain(HANDLE /*hModule*/, DWORD reasonForCall, LPVOID /*lpReserved*/) 27 | { 28 | switch (reasonForCall) 29 | { 30 | case DLL_PROCESS_ATTACH: 31 | 32 | /* Set function pointers */ 33 | pluginMenuItems[0]._pFunc = aboutDlg; 34 | 35 | /* Fill menu names */ 36 | generic_strncpy_s(pluginMenuItems[0]._itemName, nbChar, aboutMenuItem.c_str(), _TRUNCATE); 37 | 38 | /* Set shortcuts */ 39 | pluginMenuItems[0]._pShKey = NULL; 40 | 41 | pluginMenuItems[0]._cmdID = NULL; 42 | pluginMenuItems[0]._init2Check = false; 43 | 44 | break; 45 | case DLL_PROCESS_DETACH: 46 | break; 47 | } 48 | return TRUE; 49 | } 50 | 51 | #define EXT_LEXER_DECL __declspec( dllexport ) __stdcall 52 | 53 | extern "C" { 54 | 55 | #ifdef UNICODE 56 | __declspec(dllexport) BOOL isUnicode() { 57 | return TRUE; 58 | } 59 | #endif 60 | 61 | __declspec(dllexport) const TCHAR * getName() { return PLUGIN_NAME.c_str(); } 62 | __declspec(dllexport) void setInfo(NppData notpadPlusData){ nppData = notpadPlusData; } 63 | 64 | __declspec(dllexport) FuncItem * getFuncsArray(int *nbF) 65 | { 66 | *nbF = numPluginMenuItems; 67 | return pluginMenuItems; 68 | } 69 | 70 | __declspec(dllexport) void beNotified(SCNotification * /*notifyCode*/) {} 71 | __declspec(dllexport) LRESULT messageProc(UINT /*Message*/, WPARAM /*wParam*/, LPARAM /*lParam*/) { return TRUE; } 72 | 73 | 74 | } // End extern "C" 75 | 76 | int EXT_LEXER_DECL GetLexerCount() { return 1; } 77 | 78 | void EXT_LEXER_DECL GetLexerName(unsigned int /*index*/, char *name, int buflength) 79 | { 80 | *name = 0; 81 | if (buflength > 0) { 82 | strncpy_s(name, buflength, LEXER_NAME.c_str(), _TRUNCATE); 83 | } 84 | } 85 | 86 | void EXT_LEXER_DECL GetLexerStatusText(unsigned int /*Index*/, TCHAR *desc, int buflength) 87 | { 88 | if (buflength > 0) { 89 | generic_strncpy_s(desc, buflength, LEXER_STATUS_TEXT.c_str(), _TRUNCATE); 90 | } 91 | } 92 | 93 | LexerFactoryFunction EXT_LEXER_DECL GetLexerFactory(unsigned int index) { 94 | if (index == 0) 95 | return LexerGmodLua::LexerFactory; 96 | else 97 | return 0; 98 | } 99 | 100 | void GmodLua::aboutDlg() 101 | { 102 | ::MessageBox(nppData._nppHandle, 103 | TEXT("Garry's Mod 10 Lua Syntax Highlighter 1.5\n") 104 | TEXT("http://code.google.com/p/npp-gmod-lua/\n\n") 105 | TEXT(" Author: Kyle Fleming\n") 106 | TEXT(" (aka Garthex)"), 107 | TEXT("<- About ->"), 108 | MB_OK); 109 | 110 | } 111 | 112 | void SCI_METHOD LexerGmodLua::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { 113 | try { 114 | Accessor astyler(pAccess, &props); 115 | Colourise_Doc(startPos, length, initStyle, keyWordLists, astyler); 116 | astyler.Flush(); 117 | } catch (...) { 118 | // Should not throw into caller as may be compiled with different compiler or options 119 | pAccess->SetErrorStatus(SC_STATUS_FAILURE); 120 | } 121 | } 122 | void SCI_METHOD LexerGmodLua::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { 123 | try { 124 | Accessor astyler(pAccess, &props); 125 | Fold_Doc(startPos, length, initStyle, astyler); 126 | astyler.Flush(); 127 | } catch (...) { 128 | // Should not throw into caller as may be compiled with different compiler or options 129 | pAccess->SetErrorStatus(SC_STATUS_FAILURE); 130 | } 131 | } 132 | 133 | // Extended to accept accented characters 134 | static inline bool IsAWordChar(int ch) { 135 | return ch >= 0x80 || 136 | (isalnum(ch) || ch == '_'); 137 | } 138 | 139 | static inline bool IsLuaOperator(int ch) { 140 | if (ch >= 0x80 || isalnum(ch)) { 141 | return false; 142 | } 143 | 144 | if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || 145 | ch == '(' || ch == ')' || ch == '=' || 146 | ch == '{' || ch == '}' || ch == '~' || 147 | /*ch == '[' ||*/ ch == ']' || ch == ';' || 148 | ch == '<' || ch == '>' || ch == ',' || 149 | /*ch == '.' ||*/ ch == '^' || ch == '%' || //ch == ':' || 150 | ch == '#' || ch == '&' || ch == '|' || 151 | ch == '!') { 152 | return true; 153 | } 154 | return false; 155 | } 156 | 157 | // Test for [=[ ... ]=] delimiters, returns 0 if it's only a [ or ], 158 | // return 1 for [[ or ]], returns >=2 for [=[ or ]=] and so on. 159 | // The maximum number of '=' characters allowed is 254. 160 | static int LongDelimCheck(StyleContext &sc) { 161 | int sep = 1; 162 | while (sc.GetRelative(sep) == '=' && sep < 0xFF) 163 | sep++; 164 | if (sc.GetRelative(sep) == sc.ch) 165 | return sep; 166 | return 0; 167 | } 168 | 169 | 170 | // <--- Colourise ---> 171 | void GmodLua::Colourise_Doc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) 172 | { 173 | WordList &keywords0 = *keywordlists[0]; 174 | WordList &keywords1 = *keywordlists[1]; 175 | WordList &keywords2 = *keywordlists[2]; 176 | WordList &keywords3 = *keywordlists[3]; 177 | WordList &keywords4 = *keywordlists[4]; 178 | WordList &keywords5 = *keywordlists[5]; 179 | WordList &keywords6 = *keywordlists[6]; 180 | WordList &keywords7 = *keywordlists[7]; 181 | WordList &keywords8 = *keywordlists[8]; 182 | 183 | int currentLine = styler.GetLine(startPos); 184 | int sepCount = 0; 185 | if (initStyle == LITERALSTRING || initStyle == LUA_COMMENT) { 186 | sepCount = styler.GetLineState(currentLine - 1) & 0xFF; 187 | } 188 | 189 | // Do not leak onto next line 190 | if (initStyle == STRINGEOL || initStyle == LUA_COMMENTLINE || initStyle == CPP_COMMENTLINE) { 191 | initStyle = DEFAULT; 192 | } 193 | 194 | StyleContext sc(startPos, length, initStyle, styler); 195 | for (; sc.More(); sc.Forward()) { 196 | if (sc.atLineEnd) { 197 | // Update the line state, so it can be seen by next line 198 | currentLine = styler.GetLine(sc.currentPos); 199 | switch (sc.state) { 200 | case LITERALSTRING: 201 | case LUA_COMMENT: 202 | // Inside a literal string or block comment, we set the line state 203 | styler.SetLineState(currentLine, sepCount); 204 | break; 205 | default: 206 | // Reset the line state 207 | styler.SetLineState(currentLine, 0); 208 | break; 209 | } 210 | } 211 | 212 | // Handle string line continuation 213 | if ((sc.state == STRING || sc.state == CHARACTER) && 214 | sc.ch == '\\') { 215 | if (sc.chNext == '\n' || sc.chNext == '\r') { 216 | sc.Forward(); 217 | if (sc.ch == '\r' && sc.chNext == '\n') { 218 | sc.Forward(); 219 | } 220 | continue; 221 | } 222 | } 223 | 224 | // Determine if the current state should terminate. 225 | if (sc.state == OPERATOR || sc.state == NUMBER) { 226 | sc.SetState(DEFAULT); 227 | } else if (sc.state == IDENTIFIER) { 228 | if (!IsAWordChar(sc.ch) || (sc.currentPos+1 == startPos + length)) { 229 | if (IsAWordChar(sc.ch)) { 230 | sc.Forward(); // Checks words at the end of the document. 231 | } 232 | char s[100]; 233 | sc.GetCurrent(s, sizeof(s)); 234 | if (keywords0.InList(s)) { 235 | sc.ChangeState(WORD0); 236 | } else if (keywords1.InList(s)) { 237 | sc.ChangeState(WORD1); 238 | } else if (keywords2.InList(s)) { 239 | sc.ChangeState(WORD2); 240 | } else if (keywords5.InList(s)) { 241 | sc.ChangeState(WORD5); 242 | } else if (keywords8.InList(s)) { 243 | sc.ChangeState(WORD8); 244 | } 245 | sc.SetState(DEFAULT); 246 | } 247 | } else if (sc.state == LUA_COMMENTLINE || sc.state == CPP_COMMENTLINE) { 248 | if (sc.atLineEnd) { 249 | sc.ForwardSetState(DEFAULT); 250 | } 251 | } else if (sc.state == STRING) { 252 | if (sc.ch == '\\') { 253 | if (sc.chNext == '\"' || sc.chNext == '\\') { 254 | sc.Forward(); 255 | } 256 | } else if (sc.ch == '\"') { 257 | sc.ForwardSetState(DEFAULT); 258 | } else if (sc.atLineEnd) { 259 | sc.ChangeState(STRINGEOL); 260 | sc.ForwardSetState(DEFAULT); 261 | } 262 | } else if (sc.state == CHARACTER) { 263 | if (sc.ch == '\\') { 264 | if (sc.chNext == '\'' || sc.chNext == '\\') { 265 | sc.Forward(); 266 | } 267 | } else if (sc.ch == '\'') { 268 | sc.ForwardSetState(DEFAULT); 269 | } else if (sc.atLineEnd) { 270 | sc.ChangeState(STRINGEOL); 271 | sc.ForwardSetState(DEFAULT); 272 | } 273 | } else if (sc.state == LITERALSTRING || sc.state == LUA_COMMENT) { 274 | if (sc.ch == ']') { 275 | int sep = LongDelimCheck(sc); 276 | if (sep == sepCount) { 277 | sc.Forward(sep); 278 | sc.ForwardSetState(DEFAULT); 279 | } 280 | } 281 | } else if (sc.state == CPP_COMMENT) { 282 | if (sc.Match('*', '/')) { 283 | sc.Forward(); 284 | sc.ForwardSetState(DEFAULT); 285 | } 286 | } else { 287 | sc.SetState(DEFAULT); 288 | } 289 | 290 | // Determine if a new state should be entered. 291 | if (sc.state == DEFAULT) { 292 | if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { 293 | sc.SetState(NUMBER); 294 | if (sc.ch == '0' && (sc.chNext == 'x' || sc.chNext == 'X')) { 295 | int j = 1; 296 | while (IsADigit(sc.GetRelative(j+1), 16)) { 297 | j++; 298 | } 299 | sc.Forward(j); 300 | } else { 301 | int j = 0; 302 | bool hitDot(false); 303 | bool hitE(false); 304 | int ch = sc.ch; 305 | int chNext = sc.chNext; 306 | while (IsADigit(ch) || (ch == '.' && !hitDot && !hitE) || 307 | ((ch == 'e' || ch == 'E') && !hitE && (IsADigit(chNext) || 308 | ((chNext == '-' || chNext == '+') && IsADigit(sc.GetRelative(j+2)))))) { 309 | if (ch == '.') { 310 | hitDot = true; 311 | } else if (ch == 'e' || ch == 'E') { 312 | hitE = true; 313 | j++; 314 | if (chNext == '-' || chNext == '+') { 315 | j++; 316 | } 317 | chNext = sc.GetRelative(j+1); 318 | } 319 | j++; 320 | ch = chNext; 321 | chNext = sc.GetRelative(j+1); 322 | } 323 | sc.Forward(j-1); 324 | } 325 | } else if (sc.ch == ':' || sc.ch == '.') { 326 | sc.SetState(OPERATOR); 327 | if (IsAWordChar(sc.chNext) || isspace(sc.chNext)) { 328 | int j = 1; 329 | int ch = sc.chNext; 330 | while((sc.currentPos + j < startPos + length) && isspace(ch)) { 331 | ch = sc.GetRelative(++j); 332 | } 333 | if (IsAWordChar(ch)) { 334 | int i = 0; 335 | char s[101]; 336 | while (i < 100 && IsAWordChar(ch)) { 337 | s[i++] = ch; 338 | ch = sc.GetRelative(++j); 339 | } 340 | s[i++] = '\0'; 341 | if (keywords7.InList(s)) { 342 | sc.Forward(j-i+1); 343 | sc.SetState(WORD7); 344 | } 345 | if (sc.state != OPERATOR) { 346 | sc.Forward(i-2); 347 | } 348 | } 349 | } 350 | } else if (IsAWordChar(sc.ch)) { 351 | sc.SetState(IDENTIFIER); 352 | int j = 0; 353 | int i = 0; 354 | char s[101]; 355 | bool finished = false; 356 | int ch = sc.ch; 357 | 358 | while (i < 100 && (sc.currentPos + j < startPos + length) && !finished && 359 | (IsAWordChar(ch) || isspace(ch) || (ch == '.' || ch == ':'))) { 360 | if (!IsAWordChar(ch)) { 361 | while((sc.currentPos + j < startPos + length) && isspace(ch)) { 362 | ch = sc.GetRelative(++j); 363 | } 364 | if (i < 100 && (ch == '.' || ch == ':')) { 365 | s[i++] = ch; 366 | ch = sc.GetRelative(++j); 367 | while((sc.currentPos + j < startPos + length) && isspace(ch)) { 368 | ch = sc.GetRelative(++j); 369 | } 370 | while(i < 100 && IsAWordChar(ch)) { 371 | s[i++] = ch; 372 | ch = sc.GetRelative(++j); 373 | } 374 | s[i++] = '\0'; 375 | if (keywords3.InList(s)) { 376 | sc.ChangeState(WORD3); 377 | } else if (keywords4.InList(s)) { 378 | sc.ChangeState(WORD4); 379 | } else if (keywords6.InList(s)) { 380 | sc.ChangeState(WORD6); 381 | } 382 | if (sc.state != IDENTIFIER) { 383 | sc.Forward(j-1); 384 | } 385 | } 386 | 387 | finished = true; 388 | } else { 389 | s[i++] = ch; 390 | ch = sc.GetRelative(++j); 391 | } 392 | } 393 | } else if (sc.ch == '\"') { 394 | sc.SetState(STRING); 395 | } else if (sc.ch == '\'') { 396 | sc.SetState(CHARACTER); 397 | } else if (sc.ch == '[') { 398 | sepCount = LongDelimCheck(sc); 399 | if (sepCount == 0) { 400 | sc.SetState(OPERATOR); 401 | } else { 402 | sc.SetState(LITERALSTRING); 403 | sc.Forward(sepCount); 404 | } 405 | } else if (sc.Match('-', '-')) { 406 | sc.SetState(LUA_COMMENTLINE); 407 | if (sc.Match("--[")) { 408 | sc.Forward(2); 409 | sepCount = LongDelimCheck(sc); 410 | if (sepCount > 0) { 411 | sc.ChangeState(LUA_COMMENT); 412 | sc.Forward(sepCount); 413 | } 414 | } else { 415 | sc.Forward(); 416 | } 417 | } else if (sc.Match('/', '/')) { 418 | sc.SetState(CPP_COMMENTLINE); 419 | sc.Forward(); 420 | } else if (sc.Match('/', '*')) { 421 | sc.SetState(CPP_COMMENT); 422 | sc.Forward(); 423 | } else if (IsLuaOperator(sc.ch)) { 424 | sc.SetState(OPERATOR); 425 | } 426 | } 427 | } 428 | sc.Complete(); 429 | } 430 | 431 | // <--- Fold ---> 432 | void GmodLua::Fold_Doc(unsigned int startPos, int length, int initStyle, Accessor &styler) 433 | { 434 | unsigned int lengthDoc = startPos + length; 435 | int lineCurrent = styler.GetLine(startPos); 436 | int levelCurrent = SC_FOLDLEVELBASE; 437 | if (lineCurrent > 1) 438 | levelCurrent = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; 439 | else 440 | styler.SetLevel(lineCurrent, SC_FOLDLEVELBASE); 441 | int levelNext = levelCurrent; 442 | char chNext = styler[startPos]; 443 | int styleNext = styler.StyleAt(startPos); 444 | int style = initStyle; 445 | char s[10]; 446 | 447 | for (unsigned int i = startPos; i < lengthDoc; i++) { 448 | char ch = chNext; 449 | chNext = styler.SafeGetCharAt(i + 1); 450 | int stylePrev = style; 451 | style = styleNext; 452 | styleNext = styler.StyleAt(i + 1); 453 | bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); 454 | if (style == WORD0 && stylePrev != WORD0) { 455 | if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e' || ch == 'r' || ch == 'u') { 456 | unsigned int j; 457 | for (j = 0; j < 8 && iswordchar(styler.SafeGetCharAt(i + j)); j++) { 458 | s[j] = styler[i + j]; 459 | } 460 | s[j] = '\0'; 461 | 462 | if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0) || (strcmp(s, "repeat") == 0)) { 463 | levelNext++; 464 | } 465 | if ((strcmp(s, "end") == 0) || (strcmp(s, "until") == 0)) { 466 | levelNext--; 467 | } 468 | } 469 | } else if (style == OPERATOR) { 470 | if (ch == '{'){ 471 | levelNext++; 472 | } else if (ch == '}'){ 473 | levelNext--; 474 | } 475 | } else if ((style == LITERALSTRING || style == LUA_COMMENT || style == CPP_COMMENT) && 476 | !(stylePrev == LITERALSTRING || stylePrev == LUA_COMMENT || stylePrev == CPP_COMMENT) && 477 | (ch == '[' || ch == '/' || ch == '-')) { 478 | levelNext++; 479 | } else if ((style == LITERALSTRING || style == LUA_COMMENT || style == CPP_COMMENT) && 480 | !(styleNext == LITERALSTRING || styleNext == LUA_COMMENT || styleNext == CPP_COMMENT) && 481 | (ch == ']' || ch == '/')) { 482 | levelNext--; 483 | } else if (style == CPP_COMMENTLINE || style == LUA_COMMENTLINE) { 484 | if ((ch == '/' && chNext == '/') || (ch == '-' && chNext == '-')) { 485 | char chNext2 = styler.SafeGetCharAt(i + 2); 486 | if (chNext2 == '{') { 487 | levelNext++; 488 | } else if (chNext2 == '}') { 489 | levelNext--; 490 | } 491 | } 492 | } 493 | 494 | if (atEOL || (i == lengthDoc-1)) { 495 | int lev = levelNext; 496 | int levCur = levelCurrent; 497 | if (levelNext > levelCurrent) { 498 | levCur |= SC_FOLDLEVELHEADERFLAG; 499 | } 500 | styler.SetLevel(lineCurrent, levCur); 501 | styler.SetLevel(lineCurrent+1, lev); 502 | lineCurrent++; 503 | levelCurrent = levelNext; 504 | } 505 | } 506 | //char lastChar = styler.SafeGetCharAt(lengthDoc-1); 507 | //if ((unsigned)styler.Length() == lengthDoc && (lastChar == '\n' || lastChar == '\r')) { 508 | // styler.SetLevel(lineCurrent, levelCurrent); 509 | //} 510 | } 511 | -------------------------------------------------------------------------------- /GmodLua/src/GmodLua.h: -------------------------------------------------------------------------------- 1 | // This file is part of GmodLua. 2 | // A plugin written for Notepad++ 3 | 4 | // Copyright (C)2008-2010 Kyle Fleming ( garthex@gmail.com ) 5 | 6 | // GmodLua is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // GmodLua is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with GmodLua. If not, see . 18 | 19 | #ifndef GMOD_LUA_H 20 | #define GMOD_LUA_H 21 | 22 | // Notepad++ includes 23 | #include "precompiledHeaders.h" 24 | #include "PluginInterface.h" 25 | 26 | // Scintilla includes 27 | #include "ILexer.h" 28 | #include "PropSetSimple.h" 29 | #include "WordList.h" 30 | #include "LexerBase.h" 31 | 32 | #include "LexAccessor.h" 33 | #include "Accessor.h" 34 | #include "LexerModule.h" 35 | #include "StyleContext.h" 36 | #include "CharacterSet.h" 37 | 38 | #ifdef UNICODE 39 | #define generic_strncpy_s wcsncpy_s 40 | #else 41 | #define generic_strncpy_s strncpy_s 42 | #endif 43 | 44 | namespace GmodLua 45 | { 46 | static const generic_string PLUGIN_NAME = TEXT("&Gmod Lua Lexer"); 47 | static const std::string LEXER_NAME = "Gmod Lua"; 48 | static const generic_string LEXER_STATUS_TEXT = TEXT("Garry's Mod Lua source file"); 49 | 50 | static const int numPluginMenuItems = 1; 51 | FuncItem pluginMenuItems[numPluginMenuItems]; 52 | static const generic_string aboutMenuItem = TEXT("&About..."); 53 | void aboutDlg(); 54 | 55 | NppData nppData; 56 | 57 | const int DEFAULT = 0; 58 | 59 | const int LUA_COMMENT = 1; 60 | const int CPP_COMMENT = 2; 61 | const int LUA_COMMENTLINE = 3; 62 | const int CPP_COMMENTLINE = 4; 63 | 64 | const int NUMBER = 5; 65 | const int OPERATOR = 6; 66 | const int IDENTIFIER = 7; 67 | 68 | const int STRING = 8; 69 | const int CHARACTER = 9; 70 | const int STRINGEOL = 10; 71 | const int LITERALSTRING = 11; 72 | 73 | const int WORD0 = 20; 74 | const int WORD1 = 21; 75 | const int WORD2 = 22; 76 | const int WORD3 = 23; 77 | const int WORD4 = 24; 78 | const int WORD5 = 25; 79 | const int WORD6 = 26; 80 | const int WORD7 = 27; 81 | const int WORD8 = 28; 82 | 83 | class LexerGmodLua : public LexerBase { 84 | public: 85 | LexerGmodLua() {} 86 | 87 | void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); 88 | void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); 89 | 90 | static ILexer *LexerFactory() { 91 | try { 92 | return new LexerGmodLua(); 93 | } catch (...) { 94 | // Should not throw into caller as may be compiled with different compiler or options 95 | return 0; 96 | } 97 | } 98 | }; 99 | 100 | void Colourise_Doc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler); 101 | void Fold_Doc(unsigned int startPos, int length, int initStyle, Accessor &styler); 102 | }; 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /GmodLua/src/GmodLua.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE 31 | BEGIN 32 | "resource.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE 36 | BEGIN 37 | "#include ""afxres.h""\r\n" 38 | "\0" 39 | END 40 | 41 | 3 TEXTINCLUDE 42 | BEGIN 43 | "\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | 50 | ///////////////////////////////////////////////////////////////////////////// 51 | // 52 | // Version 53 | // 54 | 55 | VS_VERSION_INFO VERSIONINFO 56 | FILEVERSION 1,5,0,0 57 | PRODUCTVERSION 1,5,0,0 58 | FILEFLAGSMASK 0x17L 59 | #ifdef _DEBUG 60 | FILEFLAGS 0x1L 61 | #else 62 | FILEFLAGS 0x0L 63 | #endif 64 | FILEOS 0x4L 65 | FILETYPE 0x2L 66 | FILESUBTYPE 0x0L 67 | BEGIN 68 | BLOCK "StringFileInfo" 69 | BEGIN 70 | BLOCK "040904b0" 71 | BEGIN 72 | VALUE "CompanyName", "Kyle Fleming http://code.google.com/p/npp-gmod-lua/" 73 | VALUE "FileDescription", "GmodLua Dynamic Link Library" 74 | VALUE "FileVersion", "1.5" 75 | VALUE "InternalName", "GmodLua" 76 | VALUE "LegalCopyright", "Copyright (C) 2008-2010" 77 | VALUE "OriginalFilename", "GmodLua.dll" 78 | VALUE "ProductName", "Gmod Lua Syntax Plugin for Notepad++" 79 | VALUE "ProductVersion", "1.5" 80 | END 81 | END 82 | BLOCK "VarFileInfo" 83 | BEGIN 84 | VALUE "Translation", 0x409, 1200 85 | END 86 | END 87 | 88 | #endif // English (U.S.) resources 89 | ///////////////////////////////////////////////////////////////////////////// 90 | 91 | 92 | 93 | #ifndef APSTUDIO_INVOKED 94 | ///////////////////////////////////////////////////////////////////////////// 95 | // 96 | // Generated from the TEXTINCLUDE 3 resource. 97 | // 98 | 99 | 100 | ///////////////////////////////////////////////////////////////////////////// 101 | #endif // not APSTUDIO_INVOKED 102 | 103 | -------------------------------------------------------------------------------- /GmodLua/src/GmodLua_Plugin.def: -------------------------------------------------------------------------------- 1 | ; This file is part of GmodLua. 2 | ; A plugin written for Notepad++ 3 | 4 | ; Copyright (C)2008-2010 Kyle Fleming ( garthex@gmail.com ) 5 | 6 | ; GmodLua is free software: you can redistribute it and/or modify 7 | ; it under the terms of the GNU General Public License as published by 8 | ; the Free Software Foundation, either version 3 of the License, or 9 | ; (at your option) any later version. 10 | 11 | ; GmodLua is distributed in the hope that it will be useful, 12 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ; GNU General Public License for more details. 15 | 16 | ; You should have received a copy of the GNU General Public License 17 | ; along with GmodLua. If not, see . 18 | 19 | 20 | LIBRARY "GmodLua" 21 | 22 | EXPORTS 23 | GetLexerCount = GetLexerCount 24 | GetLexerName = GetLexerName 25 | GetLexerStatusText = GetLexerStatusText 26 | GetLexerFactory = GetLexerFactory 27 | ; Legacy 28 | Lex = NppLex 29 | Fold = NppFold -------------------------------------------------------------------------------- /GmodLua/src/Legacy.cpp: -------------------------------------------------------------------------------- 1 | #include "Legacy.h" 2 | 3 | void LexOrFold(bool foldOrLex, unsigned int startPos, unsigned int length, int initStyle, 4 | char *words[], WindowID window, char *props) 5 | { 6 | // Create and initialize the WindowAccessor (including contained PropSet) 7 | PropSetSimple ps; 8 | ps.SetMultiple(props); 9 | WindowAccessor wa(window, ps); 10 | 11 | // Create and initialize WordList(s). 12 | // If you have an extremely large word file, or lots of styling rules you may want to speed 13 | // up processing by storing the wordlists instead of reprocessing them on each call. 14 | int nWL = 0; 15 | for (; words[nWL]; nWL++) ; // count # of WordList PTRs needed 16 | WordList** wl = new WordList* [nWL + 1];// alloc WordList PTRs 17 | int i = 0; 18 | for (; i < nWL; i++) { 19 | wl[i] = new WordList(); // (works or THROWS bad_alloc EXCEPTION) 20 | wl[i]->Set(words[i]); 21 | } 22 | wl[i] = 0; 23 | 24 | // Call the internal folding and styling functions. 25 | // foldOrLex is false for lex and true for fold 26 | if (foldOrLex) { 27 | 28 | // This is a nice helpful routine to back up a line to fix broken folds. 29 | int lineCurrent = wa.GetLine(startPos); 30 | if (lineCurrent > 0) { 31 | lineCurrent--; 32 | int newStartPos = wa.LineStart(lineCurrent); 33 | length += startPos - newStartPos; 34 | startPos = newStartPos; 35 | initStyle = 0; 36 | if (startPos > 0) { 37 | initStyle = wa.StyleAt(startPos - 1); 38 | } 39 | } 40 | 41 | Fold_Doc(startPos, length, initStyle, wl, wa); 42 | 43 | } 44 | else { 45 | 46 | // You may want to put a routine here to backtrack past leaking styles, typically 47 | // multiline styles, or just put such logic in the Colour_Doc function itself. Just 48 | // be sure to do it prior to creating your Style Context. 49 | 50 | Colourise_Doc(startPos, length, initStyle, wl, wa); 51 | 52 | } 53 | 54 | // The flush function is what actually finalizes settings the styles you just coloured. 55 | wa.Flush(); 56 | 57 | // Clean up the wordlists before leaving. 58 | for (i = nWL - 1; i >= 0; i--) 59 | delete wl[i]; 60 | delete [] wl; 61 | } 62 | 63 | void __stdcall NppLex(unsigned int lexer, unsigned int startPos, int length, int initStyle, 64 | char *words[], WindowID window, char *props) 65 | { 66 | try 67 | { 68 | LexOrFold(0, startPos, length, initStyle, words, window, props); 69 | } catch (...) { 70 | } 71 | } 72 | void __stdcall NppFold(unsigned int lexer, unsigned int startPos, int length, int initStyle, 73 | char *words[], WindowID window, char *props) 74 | { 75 | try 76 | { 77 | LexOrFold(1, startPos, length, initStyle, words, window, props); 78 | } catch (...) { 79 | } 80 | } 81 | 82 | // Extended to accept accented characters 83 | static inline bool IsAWordChar(int ch) { 84 | return ch >= 0x80 || 85 | (isalnum(ch) || ch == '_'); 86 | } 87 | 88 | static inline bool IsLuaOperator(int ch) { 89 | if (ch >= 0x80 || isalnum(ch)) { 90 | return false; 91 | } 92 | 93 | if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || 94 | ch == '(' || ch == ')' || ch == '=' || 95 | ch == '{' || ch == '}' || ch == '~' || 96 | /*ch == '[' ||*/ ch == ']' || ch == ';' || 97 | ch == '<' || ch == '>' || ch == ',' || 98 | /*ch == '.' ||*/ ch == '^' || ch == '%' || //ch == ':' || 99 | ch == '#' || ch == '&' || ch == '|' || 100 | ch == '!') { 101 | return true; 102 | } 103 | return false; 104 | } 105 | 106 | // Test for [=[ ... ]=] delimiters, returns 0 if it's only a [ or ], 107 | // return 1 for [[ or ]], returns >=2 for [=[ or ]=] and so on. 108 | // The maximum number of '=' characters allowed is 254. 109 | static int LongDelimCheck(StyleContext &sc) { 110 | int sep = 1; 111 | while (sc.GetRelative(sep) == '=' && sep < 0xFF) 112 | sep++; 113 | if (sc.GetRelative(sep) == sc.ch) 114 | return sep; 115 | return 0; 116 | } 117 | 118 | 119 | // <--- Colourise ---> 120 | void Colourise_Doc(unsigned int startPos, unsigned int length, int initStyle, WordList *keywordlists[], Accessor &styler) 121 | { 122 | WordList &keywords0 = *keywordlists[0]; 123 | WordList &keywords1 = *keywordlists[1]; 124 | WordList &keywords2 = *keywordlists[2]; 125 | WordList &keywords3 = *keywordlists[3]; 126 | WordList &keywords4 = *keywordlists[4]; 127 | WordList &keywords5 = *keywordlists[5]; 128 | WordList &keywords6 = *keywordlists[6]; 129 | WordList &keywords7 = *keywordlists[7]; 130 | WordList &keywords8 = *keywordlists[8]; 131 | 132 | int currentLine = styler.GetLine(startPos); 133 | int sepCount = 0; 134 | if (initStyle == LITERALSTRING || initStyle == LUA_COMMENT) { 135 | sepCount = styler.GetLineState(currentLine - 1) & 0xFF; 136 | } 137 | 138 | // Do not leak onto next line 139 | if (initStyle == STRINGEOL || initStyle == LUA_COMMENTLINE || initStyle == CPP_COMMENTLINE) { 140 | initStyle = DEFAULT; 141 | } 142 | 143 | StyleContext sc(startPos, length, initStyle, styler); 144 | for (; sc.More(); sc.Forward()) { 145 | if (sc.atLineEnd) { 146 | // Update the line state, so it can be seen by next line 147 | currentLine = styler.GetLine(sc.currentPos); 148 | switch (sc.state) { 149 | case LITERALSTRING: 150 | case LUA_COMMENT: 151 | // Inside a literal string or block comment, we set the line state 152 | styler.SetLineState(currentLine, sepCount); 153 | break; 154 | default: 155 | // Reset the line state 156 | styler.SetLineState(currentLine, 0); 157 | break; 158 | } 159 | } 160 | 161 | // Handle string line continuation 162 | if ((sc.state == STRING || sc.state == CHARACTER) && 163 | sc.ch == '\\') { 164 | if (sc.chNext == '\n' || sc.chNext == '\r') { 165 | sc.Forward(); 166 | if (sc.ch == '\r' && sc.chNext == '\n') { 167 | sc.Forward(); 168 | } 169 | continue; 170 | } 171 | } 172 | 173 | // Determine if the current state should terminate. 174 | if (sc.state == OPERATOR || sc.state == NUMBER) { 175 | sc.SetState(DEFAULT); 176 | } else if (sc.state == IDENTIFIER) { 177 | if (!IsAWordChar(sc.ch) || (sc.currentPos+1 == startPos + length)) { 178 | if (IsAWordChar(sc.ch)) { 179 | sc.Forward(); // Checks words at the end of the document. 180 | } 181 | char s[100]; 182 | sc.GetCurrent(s, sizeof(s)); 183 | if (keywords0.InList(s)) { 184 | sc.ChangeState(WORD0); 185 | } else if (keywords1.InList(s)) { 186 | sc.ChangeState(WORD1); 187 | } else if (keywords2.InList(s)) { 188 | sc.ChangeState(WORD2); 189 | } else if (keywords5.InList(s)) { 190 | sc.ChangeState(WORD5); 191 | } else if (keywords8.InList(s)) { 192 | sc.ChangeState(WORD8); 193 | } 194 | sc.SetState(DEFAULT); 195 | } 196 | } else if (sc.state == LUA_COMMENTLINE || sc.state == CPP_COMMENTLINE) { 197 | if (sc.atLineEnd) { 198 | sc.ForwardSetState(DEFAULT); 199 | } 200 | } else if (sc.state == STRING) { 201 | if (sc.ch == '\\') { 202 | if (sc.chNext == '\"' || sc.chNext == '\\') { 203 | sc.Forward(); 204 | } 205 | } else if (sc.ch == '\"') { 206 | sc.ForwardSetState(DEFAULT); 207 | } else if (sc.atLineEnd) { 208 | sc.ChangeState(STRINGEOL); 209 | sc.ForwardSetState(DEFAULT); 210 | } 211 | } else if (sc.state == CHARACTER) { 212 | if (sc.ch == '\\') { 213 | if (sc.chNext == '\'' || sc.chNext == '\\') { 214 | sc.Forward(); 215 | } 216 | } else if (sc.ch == '\'') { 217 | sc.ForwardSetState(DEFAULT); 218 | } else if (sc.atLineEnd) { 219 | sc.ChangeState(STRINGEOL); 220 | sc.ForwardSetState(DEFAULT); 221 | } 222 | } else if (sc.state == LITERALSTRING || sc.state == LUA_COMMENT) { 223 | if (sc.ch == ']') { 224 | int sep = LongDelimCheck(sc); 225 | if (sep == sepCount) { 226 | sc.Forward(sep); 227 | sc.ForwardSetState(DEFAULT); 228 | } 229 | } 230 | } else if (sc.state == CPP_COMMENT) { 231 | if (sc.Match('*', '/')) { 232 | sc.Forward(); 233 | sc.ForwardSetState(DEFAULT); 234 | } 235 | } else { 236 | sc.SetState(DEFAULT); 237 | } 238 | 239 | // Determine if a new state should be entered. 240 | if (sc.state == DEFAULT) { 241 | if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { 242 | sc.SetState(NUMBER); 243 | if (sc.ch == '0' && (sc.chNext == 'x' || sc.chNext == 'X')) { 244 | int j = 1; 245 | while (IsADigit(sc.GetRelative(j+1), 16)) { 246 | j++; 247 | } 248 | sc.Forward(j); 249 | } else { 250 | int j = 0; 251 | bool hitDot(false); 252 | bool hitE(false); 253 | int ch = sc.ch; 254 | int chNext = sc.chNext; 255 | while (IsADigit(ch) || (ch == '.' && !hitDot && !hitE) || 256 | ((ch == 'e' || ch == 'E') && !hitE && (IsADigit(chNext) || 257 | ((chNext == '-' || chNext == '+') && IsADigit(sc.GetRelative(j+2)))))) { 258 | if (ch == '.') { 259 | hitDot = true; 260 | } else if (ch == 'e' || ch == 'E') { 261 | hitE = true; 262 | j++; 263 | if (chNext == '-' || chNext == '+') { 264 | j++; 265 | } 266 | chNext = sc.GetRelative(j+1); 267 | } 268 | j++; 269 | ch = chNext; 270 | chNext = sc.GetRelative(j+1); 271 | } 272 | sc.Forward(j-1); 273 | } 274 | } else if (sc.ch == ':' || sc.ch == '.') { 275 | sc.SetState(OPERATOR); 276 | if (IsAWordChar(sc.chNext) || isspace(sc.chNext)) { 277 | int j = 1; 278 | int ch = sc.chNext; 279 | while((sc.currentPos + j < startPos + length) && isspace(ch)) { 280 | ch = sc.GetRelative(++j); 281 | } 282 | if (IsAWordChar(ch)) { 283 | int i = 0; 284 | char s[101]; 285 | while (i < 100 && IsAWordChar(ch)) { 286 | s[i++] = ch; 287 | ch = sc.GetRelative(++j); 288 | } 289 | s[i++] = '\0'; 290 | if (keywords7.InList(s)) { 291 | sc.Forward(j-i+1); 292 | sc.SetState(WORD7); 293 | } 294 | if (sc.state != OPERATOR) { 295 | sc.Forward(i-2); 296 | } 297 | } 298 | } 299 | } else if (IsAWordChar(sc.ch)) { 300 | sc.SetState(IDENTIFIER); 301 | int j = 0; 302 | int i = 0; 303 | char s[101]; 304 | bool finished = false; 305 | int ch = sc.ch; 306 | 307 | while (i < 100 && (sc.currentPos + j < startPos + length) && !finished && 308 | (IsAWordChar(ch) || isspace(ch) || (ch == '.' || ch == ':'))) { 309 | if (!IsAWordChar(ch)) { 310 | while((sc.currentPos + j < startPos + length) && isspace(ch)) { 311 | ch = sc.GetRelative(++j); 312 | } 313 | if (i < 100 && (ch == '.' || ch == ':')) { 314 | s[i++] = ch; 315 | ch = sc.GetRelative(++j); 316 | while((sc.currentPos + j < startPos + length) && isspace(ch)) { 317 | ch = sc.GetRelative(++j); 318 | } 319 | while(i < 100 && IsAWordChar(ch)) { 320 | s[i++] = ch; 321 | ch = sc.GetRelative(++j); 322 | } 323 | s[i++] = '\0'; 324 | if (keywords3.InList(s)) { 325 | sc.ChangeState(WORD3); 326 | } else if (keywords4.InList(s)) { 327 | sc.ChangeState(WORD4); 328 | } else if (keywords6.InList(s)) { 329 | sc.ChangeState(WORD6); 330 | } 331 | if (sc.state != IDENTIFIER) { 332 | sc.Forward(j-1); 333 | } 334 | } 335 | 336 | finished = true; 337 | } else { 338 | s[i++] = ch; 339 | ch = sc.GetRelative(++j); 340 | } 341 | } 342 | } else if (sc.ch == '\"') { 343 | sc.SetState(STRING); 344 | } else if (sc.ch == '\'') { 345 | sc.SetState(CHARACTER); 346 | } else if (sc.ch == '[') { 347 | sepCount = LongDelimCheck(sc); 348 | if (sepCount == 0) { 349 | sc.SetState(OPERATOR); 350 | } else { 351 | sc.SetState(LITERALSTRING); 352 | sc.Forward(sepCount); 353 | } 354 | } else if (sc.Match('-', '-')) { 355 | sc.SetState(LUA_COMMENTLINE); 356 | if (sc.Match("--[")) { 357 | sc.Forward(2); 358 | sepCount = LongDelimCheck(sc); 359 | if (sepCount > 0) { 360 | sc.ChangeState(LUA_COMMENT); 361 | sc.Forward(sepCount); 362 | } 363 | } else { 364 | sc.Forward(); 365 | } 366 | } else if (sc.Match('/', '/')) { 367 | sc.SetState(CPP_COMMENTLINE); 368 | sc.Forward(); 369 | } else if (sc.Match('/', '*')) { 370 | sc.SetState(CPP_COMMENT); 371 | sc.Forward(); 372 | } else if (IsLuaOperator(sc.ch)) { 373 | sc.SetState(OPERATOR); 374 | } 375 | } 376 | } 377 | sc.Complete(); 378 | } 379 | 380 | // <--- Fold ---> 381 | void Fold_Doc(unsigned int startPos, unsigned int length, int initStyle, WordList *[], Accessor &styler) 382 | { 383 | unsigned int lengthDoc = startPos + length; 384 | int visibleChars = 0; 385 | int lineCurrent = styler.GetLine(startPos); 386 | int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; 387 | int levelCurrent = levelPrev; 388 | char chNext = styler[startPos]; 389 | bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; 390 | int styleNext = styler.StyleAt(startPos); 391 | int style = initStyle; 392 | char s[10]; 393 | 394 | for (unsigned int i = startPos; i < lengthDoc; i++) { 395 | char ch = chNext; 396 | chNext = styler.SafeGetCharAt(i + 1); 397 | int stylePrev = style; 398 | style = styleNext; 399 | styleNext = styler.StyleAt(i + 1); 400 | bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); 401 | if (style == WORD0 && stylePrev != WORD0) { 402 | if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e' || ch == 'r' || ch == 'u') { 403 | unsigned int j; 404 | for (j = 0; j < 8 && iswordchar(styler.SafeGetCharAt(i + j)); j++) { 405 | s[j] = styler[i + j]; 406 | } 407 | s[j] = '\0'; 408 | 409 | if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0) || (strcmp(s, "repeat") == 0)) { 410 | levelCurrent++; 411 | } 412 | if ((strcmp(s, "end") == 0) || (strcmp(s, "until") == 0)) { 413 | levelCurrent--; 414 | } 415 | } 416 | } else if (style == OPERATOR) { 417 | if (ch == '{'){ 418 | levelCurrent++; 419 | } else if (ch == '}'){ 420 | levelCurrent--; 421 | } 422 | } else if ((style == LITERALSTRING || style == LUA_COMMENT || style == CPP_COMMENT) && 423 | !(stylePrev == LITERALSTRING || stylePrev == LUA_COMMENT || stylePrev == CPP_COMMENT) && 424 | (ch == '[' || ch == '/' || ch == '-')) { 425 | levelCurrent++; 426 | } else if ((style == LITERALSTRING || style == LUA_COMMENT || style == CPP_COMMENT) && 427 | !(styleNext == LITERALSTRING || styleNext == LUA_COMMENT || styleNext == CPP_COMMENT) && 428 | (ch == ']' || ch == '/')) { 429 | levelCurrent--; 430 | } else if (style == CPP_COMMENTLINE || style == LUA_COMMENTLINE) { 431 | if ((ch == '/' && chNext == '/') || (ch == '-' && chNext == '-')) { 432 | char chNext2 = styler.SafeGetCharAt(i + 2); 433 | if (chNext2 == '{') { 434 | levelCurrent++; 435 | } else if (chNext2 == '}') { 436 | levelCurrent--; 437 | } 438 | } 439 | } 440 | 441 | if (!isspacechar(ch)) { 442 | visibleChars++; 443 | } 444 | if (atEOL || (i == lengthDoc-1)) { 445 | int lev = levelPrev; 446 | if (visibleChars == 0 && foldCompact) { 447 | lev |= SC_FOLDLEVELWHITEFLAG; 448 | } 449 | if (levelCurrent > levelPrev) { 450 | lev |= SC_FOLDLEVELHEADERFLAG; 451 | } 452 | if (lev != styler.LevelAt(lineCurrent)) { 453 | styler.SetLevel(lineCurrent, lev); 454 | } 455 | lineCurrent++; 456 | levelPrev = levelCurrent; 457 | visibleChars = 0; 458 | } 459 | } 460 | char lastChar = styler.SafeGetCharAt(lengthDoc-1); 461 | if ((unsigned)styler.Length() == lengthDoc && (lastChar == '\n' || lastChar == '\r')) { 462 | styler.SetLevel(lineCurrent, levelCurrent); 463 | } 464 | } -------------------------------------------------------------------------------- /GmodLua/src/Legacy.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define SCI_NAMESPACE 6 | 7 | #include "OldPlatform.h" 8 | 9 | #include "OldPropSet.h" 10 | #include "OldAccessor.h" 11 | #include "OldWindowAccessor.h" 12 | 13 | #include "OldPropSetSimple.h" 14 | #include "OldKeyWords.h" 15 | #include "OldStyleContext.h" 16 | #include "OldScintilla.h" 17 | 18 | using namespace Scintilla; 19 | 20 | const int DEFAULT = 0; 21 | 22 | const int LUA_COMMENT = 1; 23 | const int CPP_COMMENT = 2; 24 | const int LUA_COMMENTLINE = 3; 25 | const int CPP_COMMENTLINE = 4; 26 | 27 | const int NUMBER = 5; 28 | const int OPERATOR = 6; 29 | const int IDENTIFIER = 7; 30 | 31 | const int STRING = 8; 32 | const int CHARACTER = 9; 33 | const int STRINGEOL = 10; 34 | const int LITERALSTRING = 11; 35 | 36 | const int WORD0 = 20; 37 | const int WORD1 = 21; 38 | const int WORD2 = 22; 39 | const int WORD3 = 23; 40 | const int WORD4 = 24; 41 | const int WORD5 = 25; 42 | const int WORD6 = 26; 43 | const int WORD7 = 27; 44 | const int WORD8 = 28; 45 | 46 | void Colourise_Doc(unsigned int startPos, unsigned int length, int initStyle, WordList *keywordlists[], Accessor &styler); 47 | void Fold_Doc(unsigned int startPos, unsigned int length, int initStyle, WordList *[], Accessor &styler); 48 | -------------------------------------------------------------------------------- /GmodLua/src/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by GmodLua.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /GmodLua/vcbuild/GmodLuaPlugin.vs2008.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GmodLua", "vcbuild.vcproj", "{4570DA81-D482-4BDB-B4AC-3866D0D49B04}" 5 | ProjectSection(ProjectDependencies) = postProject 6 | {8F7E5B21-F6B7-41D6-86E9-B48CC02215F7} = {8F7E5B21-F6B7-41D6-86E9-B48CC02215F7} 7 | {FCF60E65-1B78-4D1D-AB59-4FC00AC8C248} = {FCF60E65-1B78-4D1D-AB59-4FC00AC8C248} 8 | EndProjectSection 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "notepadPlus", "..\..\PowerEditor\visual.net\notepadPlus.vcproj", "{FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}" 11 | ProjectSection(ProjectDependencies) = postProject 12 | {8F7E5B21-F6B7-41D6-86E9-B48CC02215F7} = {8F7E5B21-F6B7-41D6-86E9-B48CC02215F7} 13 | EndProjectSection 14 | EndProject 15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SciLexer", "..\..\scintilla\vcbuild\SciLexer.vcproj", "{8F7E5B21-F6B7-41D6-86E9-B48CC02215F7}" 16 | EndProject 17 | Global 18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 19 | ANSI Debug|Win32 = ANSI Debug|Win32 20 | ANSI Release|Win32 = ANSI Release|Win32 21 | Unicode Debug|Win32 = Unicode Debug|Win32 22 | Unicode Release|Win32 = Unicode Release|Win32 23 | EndGlobalSection 24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 | {4570DA81-D482-4BDB-B4AC-3866D0D49B04}.ANSI Debug|Win32.ActiveCfg = ANSI Debug|Win32 26 | {4570DA81-D482-4BDB-B4AC-3866D0D49B04}.ANSI Debug|Win32.Build.0 = ANSI Debug|Win32 27 | {4570DA81-D482-4BDB-B4AC-3866D0D49B04}.ANSI Release|Win32.ActiveCfg = ANSI Release|Win32 28 | {4570DA81-D482-4BDB-B4AC-3866D0D49B04}.ANSI Release|Win32.Build.0 = ANSI Release|Win32 29 | {4570DA81-D482-4BDB-B4AC-3866D0D49B04}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32 30 | {4570DA81-D482-4BDB-B4AC-3866D0D49B04}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32 31 | {4570DA81-D482-4BDB-B4AC-3866D0D49B04}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32 32 | {4570DA81-D482-4BDB-B4AC-3866D0D49B04}.Unicode Release|Win32.Build.0 = Unicode Release|Win32 33 | {FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}.ANSI Debug|Win32.ActiveCfg = ANSI Debug|Win32 34 | {FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}.ANSI Debug|Win32.Build.0 = ANSI Debug|Win32 35 | {FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}.ANSI Release|Win32.ActiveCfg = ANSI Release|Win32 36 | {FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}.ANSI Release|Win32.Build.0 = ANSI Release|Win32 37 | {FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32 38 | {FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32 39 | {FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32 40 | {FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}.Unicode Release|Win32.Build.0 = Unicode Release|Win32 41 | {8F7E5B21-F6B7-41D6-86E9-B48CC02215F7}.ANSI Debug|Win32.ActiveCfg = Debug|Win32 42 | {8F7E5B21-F6B7-41D6-86E9-B48CC02215F7}.ANSI Debug|Win32.Build.0 = Debug|Win32 43 | {8F7E5B21-F6B7-41D6-86E9-B48CC02215F7}.ANSI Release|Win32.ActiveCfg = Release|Win32 44 | {8F7E5B21-F6B7-41D6-86E9-B48CC02215F7}.ANSI Release|Win32.Build.0 = Release|Win32 45 | {8F7E5B21-F6B7-41D6-86E9-B48CC02215F7}.Unicode Debug|Win32.ActiveCfg = Debug|Win32 46 | {8F7E5B21-F6B7-41D6-86E9-B48CC02215F7}.Unicode Debug|Win32.Build.0 = Debug|Win32 47 | {8F7E5B21-F6B7-41D6-86E9-B48CC02215F7}.Unicode Release|Win32.ActiveCfg = Release|Win32 48 | {8F7E5B21-F6B7-41D6-86E9-B48CC02215F7}.Unicode Release|Win32.Build.0 = Release|Win32 49 | EndGlobalSection 50 | GlobalSection(SolutionProperties) = preSolution 51 | HideSolutionNode = FALSE 52 | EndGlobalSection 53 | EndGlobal 54 | -------------------------------------------------------------------------------- /GmodLua/vcbuild/vcbuild.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 26 | 29 | 32 | 35 | 38 | 41 | 53 | 56 | 59 | 62 | 75 | 78 | 81 | 84 | 87 | 90 | 93 | 96 | 97 | 105 | 108 | 111 | 114 | 117 | 120 | 132 | 135 | 138 | 141 | 155 | 158 | 161 | 164 | 167 | 170 | 173 | 176 | 177 | 185 | 188 | 191 | 194 | 197 | 200 | 212 | 215 | 218 | 221 | 235 | 238 | 241 | 244 | 247 | 250 | 253 | 256 | 257 | 264 | 267 | 270 | 273 | 276 | 279 | 291 | 294 | 297 | 300 | 313 | 316 | 319 | 322 | 325 | 328 | 331 | 334 | 335 | 336 | 337 | 338 | 339 | 344 | 347 | 348 | 351 | 352 | 353 | 358 | 361 | 362 | 365 | 366 | 369 | 370 | 373 | 374 | 375 | 380 | 383 | 384 | 385 | 388 | 391 | 392 | 395 | 396 | 399 | 400 | 403 | 404 | 407 | 408 | 411 | 412 | 415 | 416 | 419 | 420 | 423 | 424 | 427 | 428 | 431 | 432 | 435 | 436 | 439 | 440 | 443 | 444 | 447 | 448 | 451 | 452 | 455 | 456 | 459 | 460 | 463 | 464 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Syntax Highlighting in Notepad++ for Garry's Mod ## 2 | 3 | _Version 1.5, released September 16, 2010:_ 4 | * Revamped plugin for Scintilla's new external lexer interface 5 | * Did some hacky stuff to keep backwards compatibility 6 | * Updated keyword list 7 | * Brought back ANSI version 8 | 9 | ### Download Instructions for Easy Install ### 10 | * Use the Plugin Manager built into Notepad++ to install GmodLua. 11 | -------------------------------------------------------------------------------- /wiki/HowTos.wiki: -------------------------------------------------------------------------------- 1 | #summary Instructions on various tasks dealing with this plugin 2 | #labels Featured,Phase-Deploy 3 | 4 | = How to Install = 5 | === Using the Plugin Manager === 6 | * In Notepad++ go to Plugins > Plugin Manager > Show Plugin Manager 7 | * Check the Gmod Lua Syntax Highlighter checkbox 8 | * Click Install 9 | === Manually === 10 | * Download and install the latest version of Notepad++ at http://notepad-plus.sourceforge.net/uk/site.htm 11 | * Unzip the GmodLua plugin found on the Downloads page. 12 | * Copy GmodLua.dll and the Config folder into your Notepad++/plugins folder. 13 | 14 | = How to Change the Style and Color of Keywords = 15 | * In Notepad++, go to Settings > Style Configurator... 16 | * Under Language scroll down to "Gmod 10 Lua," usually at the bottom. 17 | * You are able to change the look and feel of each different style category here as well as define custom keywords and user extensions (.lua is default) 18 | * The "Global Styles" in the language box also allows for other types of style configurations. 19 | 20 | = How to Edit Keywords Manually = 21 | * Open GmodLua.xml which is located either in `"/plugins/Config"` or `"%APPDATA%/Notepad++/plugins/Config"` 22 | * For each "Keywords" line, you can put as many keywords as you want. 23 | * The name must be a number between 0 and 8. 24 | * The number must correspond to a "keywordClass" in a "WordsStyle" tag. 25 | * In the "WordStyle" you can set the names to anything you'd like, but the styleID needs to be 20 + the value of the keywordClass. 26 | * The plugin is optimized and has the following characteristics: 27 | * It checks group 7 after a colon (:) or a period. 28 | * It checks groups 0, 1, 2, 5, and 8 when it's a single word. (A word includes underscores) 29 | * It checks groups 3, 4, and 6 when it's a double word (with : or . and possibly whitespace) 30 | 31 | = How to Edit Keywords Automatically = 32 | * Move Npp_Keywords.lua from the GmodLua zip file into garrysmod/lua and once in game issue the following command. 33 | * `lua_openscript Npp_Keywords.lua; lua_openscript_cl Npp_Keywords.lua` 34 | * Open GmodLua.xml which is located either in `"/plugins/Config"` or `"%APPDATA%/Notepad++/plugins/Config"` 35 | * Copy and paste the contents of garrysmod/data/gmod_lua.txt into GmodLua.xml, between the `` tag. (Don't overwrite the comments, of course.) 36 | * Be aware that any global functions or variables declared by other mods you've installed in Gmod will be added to the keyword list. 37 | 38 | = How to Compile from Source Using Visual Studios = 39 | * Compile the latest version of Notepad++ with Visual Studios [http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Compiling_Notepad%2B%2B using this tutorial]. 40 | * Download a Subversion (SVN) program. I prefer [http://tortoisesvn.net/downloads TortoiseSVN] but there are [http://subversion.tigris.org/links.html#clients other good ones available]. 41 | * Checkout (aka download) the GmodLua module by issuing the checkout command on [http://npp-gmod-lua.googlecode.com/svn/GmodLua]. 42 | * Move the resulting local directory into the npp.``.src directory so that the GmodLua folder is sitting alongside the PowerEditor and scintilla folders. 43 | * Find the file `"scintilla/src/KeyWords.cxx"`, scroll to the bottom and delete everything between the two "Autogenerated" tags 44 | * Load up the Visual Studios solution file (GmodLua/vcbuild/GmodLuaPlugin.sln) and compile as `Unicode Release`. 45 | * Look in the GmodLua source's bin folder and take the dll and the Config folder and drop it in Notepad++'s plugins folder. -------------------------------------------------------------------------------- /wiki/IntroAndChangeLog.wiki: -------------------------------------------------------------------------------- 1 | #summary An introduction to and change log for the Gmod Lua plugin 2 | #labels Featured,Phase-Introduction,Phase-Change-Log 3 | 4 | = Introduction = 5 | 6 | With Gmod now using Lua 5.1.2, I decided to update the Notepad++ syntax highlighter I wrote awhile ago. This time I coordinated with Don HO, the admin of Notepad++, to release an update to N++ which I wrote that supports external lexers. This allows me to release this as a plugin instead of recompiling Scintilla each time. Now you can get updates for Notepad++ and still use the same plugin in the future. 7 | 8 | 9 | = Change Log = 10 | == Release 1.5: September 16, 2010 == 11 | * Revamped plugin for Scintilla's new external lexer interface 12 | * Did some hacky stuff to keep backwards compatibility 13 | * Updated keyword list 14 | * Brought back ANSI version 15 | 16 | == Release 1.4: February 17, 2010 == 17 | * Updated keyword list 18 | * Changed name from Gmod 10 Lua to Gmod Lua 19 | 20 | == Release 1.3: January 29, 2010 == 21 | * Updated dependencies to reflect recent changes to Notepad++ headers. 22 | * Updated GmodLua.xml keyword list. 23 | * Modified comment font to match changes in Notepad++'s vanilla lua styles. 24 | 25 | == Release 1.2: February 10, 2009 == 26 | * Fixed the issue created when N++ switched to Unicode from ANSI. 27 | * Converted the plugin to the system created by Thell Fowler. (http://poshcode.org/notepad++lexer/) 28 | * Updated GmodLua.xml to reflect the most recent lua function set. 29 | * Removed the unoptimized and lite versions. 30 | 31 | == Release 1.1: January 25, 2008 == 32 | * Fixed keyword generator and updated keyword list to be consistent with the 1-15-08 Gmod patch. 33 | * Fixed folding so it doesn't fold past the last character except when folding the last line of the document and the last line is blank. 34 | * Removed folding parenthesis. 35 | 36 | == Release 1.0: January 12, 2008 == 37 | * Support for [==[ ]==] style comments and quotes as specified by Lua 5.1 38 | * Improved code to determine numbers. 39 | * The ability to set C++ and Lua comments as different styles. 40 | * An XML that is fully customizable to allow you to add up to 9 keyword categories for syntax highlighting. 41 | * Default keyword groups for instruction words, global constants, global functions, scripted variables, scripted functions, libraries, library calls, object functions, and red flags. 42 | * Fixed problems with the last line of a document. 43 | * More intelligent word highlighter: 44 | * Spaces between words and period such as file . Write 45 | * First checks if word1.word2 is a word 46 | * If it isn't, then it checks for word1 and word2 separately. 47 | * Allows a colon ( : ) in a word in addition to a period. 48 | 49 | 50 | == Available from the Previous Implementation == 51 | * Folding! 52 | * A line with either --{, --}, //{ or //} will also fold. 53 | * Support for both C++ and Lua comments and strings. 54 | * Customizable styles within the preferences dialog. 55 | * Escape Character '\' So you can escape the end of a line properly and escape quotes properly 56 | * Single-line strings when unclosed at the end of a line don't try and parse the rest of the document as a string. --------------------------------------------------------------------------------