Thread: Eternally Confuzzled

  1. #46
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Third paragraph of main page reads: "..I do this not because I want give them as much variety as possible.."; might read better as "...I do this not because I want to give them as much variety as possible"

    It's getting very difficult to spot your typos, you know.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  2. #47
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >"stealing" seems like such a harsh word..
    I'm not afraid to tell it like it is.

    >It's getting very difficult to spot your typos, you know.
    My BS is getting better then.
    My best code is written with the delete key.

  3. #48
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by Prelude
    >I still think that code could benefit from syntax colourring.
    That's my next change. I got about twenty lines into my own implementation of C++ to HTML, then changed my mind and modified Sunlight's code to suit my needs.

    Good programmers write good code. Great programmers steal good code.
    do you happen to have a list of colors/words used? I've been looking to code one in Perl/PHP to output in HTML and Vb so it can be used for these forums...

    I used to use the program from the CodeGuru forums, but that was built for windows, and I've been using linux for the past few months... and I'm too lazy to write it all out and choose colors...

    unless, of course, you already know of one :P

    edit: hmm... I'm finding out that PHP's built-in syntax highlighting works for C++ as well...
    Last edited by major_small; 07-07-2005 at 07:24 PM.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  4. #49
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >do you happen to have a list of colors/words used?
    The colors are grabbed from my global stylesheet. This is the keyword list though:

    #define
    #elif
    #else
    #endif
    #if
    #ifdef
    #ifndef
    #include
    #pragma
    auto
    bad_cast
    bad_typeid
    bool
    break
    case
    catch
    char
    class
    const
    const_cast
    continue
    default
    delete
    do
    double
    dynamic_cast
    else
    enum
    explicit
    extern
    false
    float
    for
    friend
    goto
    if
    inline
    int
    long
    mutable
    namespace
    new
    nothrow
    operator
    private
    protected
    public
    register
    reinterpret_cast
    return
    short
    signed
    sizeof
    static
    static_cast
    struct
    switch
    template
    this
    throw
    true
    try
    type_info
    typedef
    typeid
    typename
    union
    unsigned
    using
    virtual
    void
    volatile
    wchar_t
    while

    There are a few minor issues with Sunlight's code that need to be rectified for compilation on a modern C++ compiler (he clearly used VC++ 6). The Windows specific parts can be easily removed as well and the code should compile on Linux.
    My best code is written with the delete key.

  5. #50
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    Here is a list of keywords I have never used in my c++ career:

    #elif
    auto
    bad_cast
    bad_typeid
    const_cast
    dynamic_cast
    explicit
    extern
    goto
    inline
    mutable
    nothrow
    register
    reinterpret_cast
    type_info
    typeid
    union
    volatile
    wchar_t


    i'm sure many of ye' can beat this




    also: I would like to add bad_alloc to the list of c++ keywords
    Last edited by The Brain; 07-07-2005 at 11:24 PM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  6. #51
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    not that I think anybody's interested, and not to hijack this thread any further, but I just completed it in Java (I need to re-learn it for my CS courses):
    Code:
    #include<iostream>
    
    int main()
    {
    	int a,b,c;
    	float fa,fb,fc;
    	double da,db,dc;
    
    	std::cout<<"Hello World"<<std::endl; //end-of-line comment
    	//line comment
    	/*multi
    	line
    	comment*/
    	"multi
    	line
    	quote"
    
    	//comment with new keyword
    	/*comment witn new keyword*/
    	"quotes with new keyword"
    
    	return 0;
    }
    I attached the code (just change SyntaxHlt and Finder from .txt to .java and keywords to .dat) just in case anybody's bored enough to take a look at it... if you know more about java than I, pointers would be appreciated, and I know there are holes in the code (one big one: if you escape a quote in a literal string, you'll run into problems), and some keywords (like double) are colorized more than once (because of 'do' and 'double')... I'm sure there are plenty others, but I'm really only making this for personal use (and for anybody else if they want to use it)

    edit: you'll also notice that the keywords file isn't in alphabetical order - it has to do with what I mentioned before about the double-coloring... if it comes across 'do', it'll change it so double will come out to double
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Prelude's website
    By Mario F. in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 02-19-2008, 09:10 AM