Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   NRG Code Repository (http://www.chiefdelphi.com/forums/showthread.php?t=24360)

echos 26-01-2004 16:07

Re: NRG Code Repository
 
Thank you...

Dang your quick when it comes to changes.

Raven_Writer 26-01-2004 16:10

Re: NRG Code Repository
 
Could you possibly make it highlight C code also?

Guest 26-01-2004 16:10

Re: NRG Code Repository
 
How?

Raven_Writer 26-01-2004 16:14

Re: NRG Code Repository
 
Quote:

Originally Posted by SilverStar
How?

I'm not excellent in PHP, but I'm pretty sure there's a way to search for certain strings, and if it's found, just color-code it. Kinda like:

PHP Code:

$text strtext("$filename");
 
if(
$text){
  
explode("void""<font color='#0000FF'>void</a>");


(I highly doubt strtext(...) works, it's just something that came to me

Jeremy_Mc 26-01-2004 16:16

Re: NRG Code Repository
 
Quote:

Originally Posted by Raven_Writer
I'm not excellent in PHP, but I'm pretty sure there's a way to search for certain strings, and if it's found, just color-code it. Kinda like:

PHP Code:

$text strtext("$filename");
 
if(
$text){
  
explode("void""<font color='#0000FF'>void</a>");


(I highly doubt strtext(...) works, it's just something that came to me

Why are you using explode?

Check http://us3.php.net/manual/en/function.eregi-replace.php

You have to know regular expressions, but it's the quickest and most flexible way to do it.

Just search for the keywords and replace them when you read the file into a variable...it shouldn't be too tough.

Guest 26-01-2004 16:18

Re: NRG Code Repository
 
Someone give me a list of keywords, and I'll use PCRE's to do the highlighting.

Raven_Writer 26-01-2004 16:19

Re: NRG Code Repository
 
Quote:

Originally Posted by Jeremy_Mc
Why are you using explode?

Check http://us3.php.net/manual/en/function.eregi-replace.php

You have to know regular expressions, but it's the quickest and most flexible way to do it.

Just search for the keywords and replace them when you read the file into a variable...it shouldn't be too tough.

I was just using what I knew :\

I haven't done PHP lately (for about 6 months), so most is gone.

<Edit>:
SilverStar: int, unsigned, char, double, float, void, return

There's prob. others, but those are the ones I know MPLAB uses.

echos 26-01-2004 16:22

Re: NRG Code Repository
 
here is a pre made program that does syntax highlighting, its free...

http://www.hotscripts.com/Detailed/10998.html

Raven_Writer 26-01-2004 16:31

Re: NRG Code Repository
 
When I tried editing my boolean entry, it said "The page your are looking for cannot be found. Check the address or try again later." when I clicked on "Update"

Guest 26-01-2004 16:41

Re: NRG Code Repository
 
everything is done, except C code highlighting...

[edit]
I'm writing my own C/C++ code highlighter.
[/edit]

Raven_Writer 26-01-2004 17:03

Re: NRG Code Repository
 
Quote:

Originally Posted by SilverStar
everything is done, except C code highlighting...

[edit]
I'm writing my own C/C++ code highlighter.
[/edit]

Cool. I hope it all works well.

deltacoder1020 26-01-2004 17:14

Re: NRG Code Repository
 
the function in php that was mentioned for syntax highlighting is highlight_string() - this automatically adds syntax highlighting for a string of PHP code. (similar but not the same as C)

Raven_Writer 26-01-2004 17:17

Re: NRG Code Repository
 
One thing though. Please don't do the PHP-style orange commenting. It's very bad to have a light-on-light color scheme.

If you want, here's how VC++ does it:

keywords: blue (#0000FF)
- int, void, char, unsigned, return

processor directives: green (#00FF00)
- #define, #else, #ifndef

comments: green (#00FF00)
- /* */, //

deltacoder1020 26-01-2004 17:29

Re: NRG Code Repository
 
i'm guessing that the custom syntax highlighting is currently a work in progress, seeing as right now is coloring most of my code pink ;)

Astronouth7303 26-01-2004 18:06

Re: NRG Code Repository
 
Quote:

Originally Posted by Raven_Writer
If you want, here's how VC++ does it:

keywords: blue (#0000FF)
- int, void, char, unsigned, return

processor directives: green (#00FF00)
- #define, #else, #ifndef

comments: green (#00FF00)
- /* */, //

(Sorry, I'm looking at MPLAB, I don't have MSVC++ on this machine :( )

MPLAB does Proc. Directives blue, and I've seen them purple, too.
Keywords are bold.
Constants are a slightly lighter green then the comments.
Symbols are gray ({} > < = ; etc.)
Strings are blue BUT NOT BOLD!

The colors (and purposes) are below:
  • 000000 Default
    2121B5 Strings, Hex
    2121CE Keywards, Processor directives
    218C21 Numbers
    296B52 Comments
    848484 Symbols
    FF0000 Errors
    FFFFFF Background

I'd post the image, but I can't attach (or can't find the button) :(

Would it be possible (sometime in the future) to put the coloring specifics in the User CP?


All times are GMT -5. The time now is 19:53.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi