cpp2html

2009. 1. 29. 09:05 from 셈말짓기/터놓은글


아래와 같이 명령을 하면 도움말을 볼 수가 있습니다.

E:\>cpp2html.exe -h

  ***I tweeked the original source code to get it to compile  on
 Windows 2000.  The original source code requires Cygnus.dll. This
 version does not.  The original Credits and Authors are down below.
 You can get the source code from http://www.gnu.org

                                         - mdevi@liu.edu
       *************************************
 Usage
cpp2html only does a lexical analisys of the source code, so the
C++ program is assumed to be correct !
here's how to run it:

cpp2html --input <file (a C++ prog)> --output <file (an html)>
If you do not specify the name of the output file, the name will
be the one of the source file with a .html appended.
if you want a real html document, specify --doc option at the
end.Otherwise you just get some text to copy and paste in you
own html pages. If you choose -doc option the page will have a
white background and your source file name as title. --tab n option
apply a substitution of tab characters with n spaces. You also may
want to specify the title of the page with --title "my title"
option (this implies -doc). Now you can also generate an html with
CSS format, by using --css "url of .css" (try some .css files
included in the package). The order of the options is not relevant.
Here are some links to some of the sources of cpp2html colored with
cpp2html itself:

main.cc.html
generators.cc.html
tags.cc.html
messages.cc.html
These files have been generated with the following commands:
cpp2html --doc main.cc
cpp2html --doc generators.cc
cpp2html --doc tags.cc
cpp2html --doc messages.cc
Obviosly it works with C files as well:
cmdline.c.html
Created with the command:
cpp2html -i cmdline.c -o cmdline.c.html --css="cpp2html.css"
And obviously it works with header files as well (which we colored in
black and white :-)
main.h.html
decorators.h.html
generators.h.html
list.h.html
tags.h.html
cmdline.h.html
created with the command:
cpp2html *.h --css="mono.css"
And here's the output of `cpp2html -help`

Usage: cpp2html [OPTION]... [INPUT-FILE]...
       cpp2html < INPUT-FILE > OUTPUT-FILE [OPTION]...

given a source C/C++ file, produces an html source with syntax highlighting.

  -v, --verbose           verbose mode on
  -d, --doc               creates html with title, header...
  -c, --css=URL           use a css for formatting (implies --doc)
  -T, --title=TITLE       give title to the html (implies --doc)
  -i, --input=FILE        input file (default standard input)
  -o, --output=FILE       output file (default standard output)
  -t, --tab=TABLEN        specify tab length (default 8)
  -V, --version           print version
As it handles standard output and input you may also run it like
cat MyFile.cpp | cpp2html | lpr
You may want to specify your options for syntax highlighting in the file
tags.j2h. If this file is not present in the current directory, some
default colors will be used. Here's the tags.j2h file that comes with
this distribution:

keyword blue b ;
type green ;
string red ;
comment brown i ;
number purple ;
as you might see the syntax of this file is quite straightforward:
b = bold
i = italics
u = underline

You may also specify more than on of these options separated by commas
e.g.
keyword blue u, b ;
you may see all possible colors in the file colors.html

if something goes wrong with your options try to run cpp2html with --verbose opt
ion enabled.

Credits
These people helped me with java2html, and I used such features in cpp2html
as well, so:
Marcus G. Daniels <marcusd@gnu.org> who gave me some good advices about GNU stan
dards,
Osvaldo Pinali Doederlein <osvaldo@visionnaire.com.br> for tab option idea,
Richard Freedman <rich_freedman@chiinc.com> for feed back and bugs signalations

John Constantine <John.Constantine@mail.cc.trincoll.edu> for some great suggesti
ons I'll surely apply.
Raymond Lambe <rlambe@morgan.ucs.mun.ca>, for quotation bug signalation
Robert J. Clark <clark@klgroup.com> for adding -input, -output, -title options
Hans-Peter Bischof <hpb@cs.rit.edu> for suggestions (to apply).
Luc Maisonobe <Luc.Maisonobe@cnes.fr> for the patch for const char * in order to
 make it work under gcc 2.95
Jari Korva <jari.korva@iki.fi> for the bug of " inside a string and & treatme nt
, and especially for adding CSS options and handling
Kaloian Doganov <kaloian@stones.com> for .css suggestion and for providing some
nice .css files
Ziv Caspi <zivc@peach-networks.com> found the bug of \ in chars
Chris Mason <cjmaso@essex.ac.uk> found the darkgreen bug, and that --tab was not
 documented


                                  ****  Have Fun - mdevi@liu.edu

E:\>

Posted by 셈말짓기 :
색상에 이름을 표시 해주는 셈글

ColorTable.zip



색상의 이름 이나 색상의 RGB값을 Double-Click하면 해당 문자가 Clipboard로 복사됩니다.

첨부 File에는 WTL기반으로 된 Source Code와 Program이 있습니다.


Posted by 셈말짓기 :

#include <stdio.h>
#include <tchar.h>

///////////////////////////////////////////////////////////////////////////////
struct Operand1
{
    int GetOp1()
    {
        return 2;
    }

    int GetOp2()
    {
        return 3;
    }
};

struct Operand2
{
    int GetOp1()
    {
        return 3;
    }

    int GetOp2()
    {
        return 4;
    }
};

///////////////////////////////////////////////////////////////////////////////
template<class T> 
struct CalcEngine1
{
    int Calc(void)
    {
        T* pThis= (T*)this;
        return pThis->GetOp1() / pThis->GetOp2();
    }
};

template<class T> 
struct CalcEngine2
{
    double Calc(void)
    {
        T* pThis= (T*)this;
        return pThis->GetOp1() / (double) pThis->GetOp2();
    }
};

///////////////////////////////////////////////////////////////////////////////
template
<
    class                            OperandPolicy,
    template<class CalcEngine> class CalcEnginePolicy
>
class Calculator : 
    public OperandPolicy,
    public CalcEnginePolicy<OperandPolicy>
{
public:
    void Show (void)
    {
        printf ("Show()=%f\r\n", CalcEnginePolicy<OperandPolicy>::Calc() );
    }
};

///////////////////////////////////////////////////////////////////////////////
int _tmain(int argc, _TCHAR* argv[])
{
    Calculator <Operand1,CalcEngine1> a;
    Calculator <Operand1,CalcEngine2> b;
    Calculator <Operand2,CalcEngine1> c;
    Calculator <Operand2,CalcEngine2> d;

    a.Show();
    b.Show();
    c.Show();
    d.Show();

    return 0;
}

Posted by 셈말짓기 :

// MetaProgramming.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <tchar.h>

template <unsigned long N>
struct binary
{
    static unsigned const value =
        binary<N/10>::value*2 + N%10;
};

template <>
struct binary<0>
{
    static unsigned const value = 0;
};

int _tmain(int argc, _TCHAR* argv[])
{
    unsigned const one   = binary<   1>::value;
    unsigned const two   = binary<  10>::value;
    unsigned const three = binary<  11>::value;
    unsigned const four  = binary< 100>::value;
    unsigned const seven = binary< 111>::value;
    unsigned const nine  = binary<1001>::value;

    printf (" one   =%d\n", one  );
    printf (" two   =%d\n", two  );
    printf (" three =%d\n", three);
    printf (" four  =%d\n", four );
    printf (" seven =%d\n", seven);
    printf (" nine  =%d\n", nine );

    return 0;
}
Posted by 셈말짓기 :

죽는 날까지 소스코드를 우러러

한점 부끄럼 없기를,

겜하는 도중에도 나는 괴로워했다.

버그를 고치는 마음으로

모든 죽어가는 상대방을 우롱해야지.

그리고 나한테 주어진 경험치를 쌓아 가야겠다.


오늘 새벽에도 손가락이 키보드를 스치운다.


--------------------------------------------------------------
데브피아에서 내가 쓴글 검색하던 중... 2003년 8월 23일날에 이런게...
-_-;
Posted by 셈말짓기 :