|
|
|||||||||||||||||||||||||||
|
Programming |
DWK's codeformA code formatter and colourer [intended] for C and C++. Here is the latest version of codeform, version 1.2.0. Other versions are: HistorySpending as much time as I do on message boards etc I eventually grew tired of reading code that wasn't colour-coded. I decided to write a program to colour code myself. (Not that there weren't programs to do this already, but I wanted to try it.) The result was codeform. The first version of codeform I wrote (version 1.00) had all the keywords hard-coded into the program. It highlighted C keywords (all the same colour), strings, character quotes, and numbers. From there, I gradually added external data files, dynamic memory allocation, etc. Since 1.00 there have been many versions of codeform. See the file HISTORY for a complete list. (Versions after 1.10 have two periods, such as 1.2.0, in case of over 10 subversions, such as 1.2.12.) The file HISTORY also contains a partial list of features for codeform 1.2.0. DownloadSource is included in all distributions, along with executables for Windows (and usually Linux).
The current official page for codeform is at http://dwks.theprogrammingsite.com/myprogs/codeform.htm. UsageTo run codeform under Windows, type "codeform" from the command line. For Linux, type "./codeform" or the appropriate directory (or, if it's in your path, just "codeform"). To get help on codeform's usage directly from the command line, use the --usage argument. (Versions 1.00 - 1.10 used different arguments.) $ ./codeform --usage
codeform version 1.2.0 by DWK
Executable path: ./codeform
usage: codeform [-f rule-file] [-e inline-rule] [-o output]
[--help] [-h] [--usage] [--version] [-v]
[--] [rule-file-if-no-other-rules] [files...]
The arguments are very similar to sed's (and -o is from GCC).
Output can go to multiple files -- just specify more than one -o argument. With
no -o arguments (or if none of the output files could be opened), stdout is
used instead.
If no rules are specified, the first argument that isn't preceded by an option
is taken as a rules file instead of an input file. With no input files, stdin
is used.
A simple usage of codeform might look like the following:
$ ./codeform -o codeform.htm rules/c_1_html codeform.c
This formats codeform.c according to the rules in rules/c_1_html, storing the
output in codeform.htm.
$
If you want to colour Dev-C++ style C into inline CSS, use this: $ ./codeform -o codeform.htm -f rules/_ilcss -f rules/c_devcpp codeform.c If you want to emulate cat for some reason, use this: $ ./codeform FilesHere is a description of all of the files in the root of codeform's install directory. (The files in subdirectories are too numerous to cover here.) Files or folders marked with an asterisk (*) are covered in the next section.
Technical documentationDocumentation for codeform's source (generated by Doxygen) is available in the source itself and in the doc/ subdirectory. A how-to for writing and interpreting rules file is located in rules/HOWTO.txt. Codeform is written in ANSI C89-compatible C. A makefile is included, Makefile, to compile codeform for Linux with gcc. make.bat uses Makewin to compile for Windows using gcc as well (rm is assumed to exist for the clean target). Since codeform is an ANSI compatible program, however, you should have no problems compiling it on any platform with or without the makefiles. There is an incomplete todo list in the file TODO. There is much more that I would like to do with codeform than the list would indicate. ContactIf you have any questions or comments, you can email me at dwks #a=t# theprogrammingsite #d-o-t# %c\\o/m%. You can visit my website at http://dwks.theprogrammingsite.com/. Alternatively, you could post a question or PM me on one of the forums I frequent (such as http://board.theprogrammingsite.com/ or http://cboard.cprogramming.com/). CreditsThanks to all the people who helped me with this project, directly or indirectly; in particular, Richard Stallman and all advocates of free software, for making free software such as codeform possible. LicenseThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The GNU General Public License version 2 is included in the file COPYING. ExampleClick here to see codeform formatted by itself with the following command line: $ ./codeform -o codeform_self.htm rules\c_1_css codeform.c |
||||||||||||||||||||||||||
| Top | |||||||||||||||||||||||||||