QC support for Notepad++

Discuss programming in the QuakeC language.
Post Reply
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

QC support for Notepad++

Post by mankrip »

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
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: QC support for Notepad++

Post by ceriux »

nice, i always just used it with the C based settings or just used qcide -.-
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: QC support for Notepad++

Post by toneddu2000 »

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
Meadow Fun!! - my first commercial game, made with FTEQW game engine
c0burn
Posts: 208
Joined: Fri Nov 05, 2004 12:48 pm
Location: Liverpool, England
Contact:

Re: QC support for Notepad++

Post by c0burn »

Very nice, thank you
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: QC support for Notepad++

Post by toneddu2000 »

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!
Meadow Fun!! - my first commercial game, made with FTEQW game engine
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: QC support for Notepad++

Post by frag.machine »

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)
Post Reply