Forum

QC support for Notepad++

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

QC support for Notepad++

Postby mankrip » Thu May 05, 2016 6:31 am

This tutorial will allow Notepad++ to populate the Function List with QC functions.

The functions needs to be in one of the following formats; semicolons are optional:
Code: Select all
void example () { };

void example () = { };

void example () = [$framemacro, thinkfunction] {};

It won't work for functions in the formats void () example = {}; and void () example {}; yet.



Go to the folder where Notepad++ is installed, and open the file functionList.xml .

Insert this line before the line </associationMap>:
Code: Select all
         <association userDefinedLangName="QuakeC" id="qc_function"/>

      </associationMap>


Now, insert this section before the line </parsers>:
Code: Select all
         <parser id="qc_function" displayName="QuakeC" commentExpr="((/\*.*?\*)/|(//.*?$))">
            <function
                mainExpr="^[\t ]*((static|const|virtual)[\s]+)?[\w:]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+)([\w_]+[\s]*::)?(?!(if|while|for))[\w_]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*[=\[\{]"
               displayMode="$functionName">
               <functionName>
                  <nameExpr expr="(?!(if|while|for))[\w_~]+[\s]*\("/>
                  <nameExpr expr="(?!(if|while|for))[\w_~]+"/>
               </functionName>
            </function>
         </parser>
         
      </parsers>



And here's a file for syntax highlighting. Right-click on this link and choose the "Save link as..." context menu item: NotepadPlusPlus_QC_highlighting.

Some notes on this syntax highlighting file:

- It includes a hack to highlight preprocessor directives. FrikQcc 2.6 supports these: #include #includelist #define #undef #ifdef #ifndef #else #endif #pragma #warning #error.
- Since builtins can be freely named, standard builtin functions' names are in regular color, but in bold format.
- Constants are in green; this includes variables usually treated as constants, like MOVETYPE_WALK.
- Constant strings have a background color to help tracking them across whitespaces, and vectors are underlined for the same reason.
- Flow control commands (switch case default if else break return do while) use a specific color to make it easier to track instruction flow.
- System globals are in bold dark blue, and system fields are in regular dark blue.
- System global functions and system field functions (.void) are in regular blue.
- Data types are in light blue, to help them stand out.
- Operators and separators are in red. The contrast between red, blue and black makes the separators easier to notice, while being easy on the eyes.
- Line comments have a yellow background, but multi-line comments doesn't, because colored backgrounds on multiline comments is distracting when in header-style text. To compensate for this, multi-line comments are in bold gray.
- Macro sections are in bold with a slightly dark blue color, to differentiate their operators from regular ones.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
User avatar
mankrip
 
Posts: 908
Joined: Fri Jul 04, 2008 3:02 am

Re: QC support for Notepad++

Postby ceriux » Thu May 05, 2016 1:28 pm

nice, i always just used it with the C based settings or just used qcide -.-
User avatar
ceriux
 
Posts: 2220
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: QC support for Notepad++

Postby toneddu2000 » Fri May 06, 2016 1:26 am

I think I love you :biggrin: I was waiting this for a looong time since Notepad++ is my only tool to write qc code. As soon I can get my pc back I'll post my impressions

Thanks for sharing mankrip
toneddu2000
 
Posts: 1280
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: QC support for Notepad++

Postby c0burn » Mon May 23, 2016 11:06 pm

Very nice, thank you
c0burn
 
Posts: 206
Joined: Fri Nov 05, 2004 12:48 pm
Location: Liverpool, England

Re: QC support for Notepad++

Postby toneddu2000 » Tue May 24, 2016 8:13 am

Tried it. Very cool the fact notepad++ recognize now .qc files and use directly highlight syntax.
Not so sure I like builtins only in bold black, probably I'd have preferred a blue-ish color but I cannot thank you enough for the great work!
toneddu2000
 
Posts: 1280
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: QC support for Notepad++

Postby frag.machine » Thu May 26, 2016 4:37 am

Image

This is my Notepad++ custom config for QuakeC.
Besides the different color setup, I added support to dpextensions.qc builtins (with a different color from standard QuakeC builtins) plus some constants.
It's not hard to do actually, just a tedious work in progress. :)
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2052
Joined: Sat Nov 25, 2006 1:49 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest