|
Home | Switchboard | Unix Administration | Red Hat | TCP/IP Networks | Neoliberalism | Toxic Managers |
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and bastardization of classic Unix |
This page introduced the notion of "fuzzy" prettyprinters -- prettyprinters that do not perform full lexical analysis of the source code
|
Beautifiers and pretty printers are essential language tools. They accepts a program source file, and generates a listing and/or another equivalent source file which is nicely formatted according to the source language syntax, including first of all indentation of control statements
Unfortunately very few programmers use them. If you do not use please start now... that's a real life saver tool for any professional programmer. Programmers spend around 50% of their time just looking at source code trying to understand it or find bugs. Formatting source code can make them considerably more productive in this task, saving a significant amount of an time and efforts.
What is a beautifier? It is a language-specific utility that reformats a program to conform to a standard of presentation. Optionally it also can replace the original file with the reformatted version (making a backup) but this is a more dangerous operation then just listing for comprehension and debugging purposes. It requires perfect replication of lexical analyzer for the language in question. That's why many prettyprinters from languages with complex lexical structure that are in use for a long time are sill considered by the original developers to be in beta (Perltidy is one example).
The most important task for any prettyprinter is the revealing nesting level of each statement via indentation. For languages with nested functions, the function nesting level is the second one that needs to be displayed. In addition it also can improve readability by inserting blank lines after each procedure and some statements. Excessively long lines might be split into shorter ones or even refactored in "folding constant" mode. Closing parenthesis of a block and opening keyword might be vertically aligned. The amount of cosmetic changes depends on the esthetic preferences of the author of prettyprinter. My are pretty Spartan and I do not see much value in readability improvement described above outside the depiction of nesting level via indentation.
Among the advantages of using a beautifier:
I use beautifiers with each language that I programmed until I get to Perl. When I first started learning Perl, I immediately began looking for a beautifier, and was surprised when I couldn't find one. From this point of view Perl definitely sucks... I became interested and wrote a couple of my own primitive beautifier Neatperl and Neatbash. They intentionally were designed to be short and simple (at the expense of functionality) and can be maintained independently by any qualified Perl programmer. They also proved to be adequte for my purposes, despite their extreme simplicity. Hoping that my efforts can benefit other people I put current versions it on GitHub in 2019.
Of course, there are several other tools for Perl that can beatify Perl programs: the most popular one is pertidy. Even for bash you can find something like language-bash Parsing and pretty-printing Bash shell scripts
But both of those are complex tool that attempt to do lexical analysis of the program and that's a very tricky task. Resulting level of complexity makes them unmaintanable for a regular programmer.
Moreover Perl is very complex (but pretty regular) lexical structure so there is no guarantee that such pretty printer will not introduce subtle errors into the script. The complexity of Perltidy reflect that fact. For more details see:
Then I realized that usage of beautifier is a part of defensive programming style and did some additional research (I am mot a newcomer to the field; I actually wrote my first beautifier with full lexical analysis of the language in late 70th (neatpl for PL/1) to help me to write a compiler form that relational algebra based language (pre SQL), for which implementation language was PL/1. But now we need to find a different approach even if it means less functionality. That's how this page was created. It reflects my findings and it is not updated often, it's primitive, but still it's better than nothing because it addresses a very important topic that few other pages address...
The traditional way to build a beautifier is to lexically parse the source language according to the source language lexical rules. See, for example, my old NEATPL pretty printer for PL/1 (http://www.softpanorama.org/Articles/Oldies/neatpl.pdf ) This ensures that the lexems (lexical tokens) found by formatter are those that corresponds to lexems/tokens of the language. But that requires presence of well defines and not too complex lexical level of the language. But there are language without lexical level (Unix shell is the primary example) or with a very complex (although well defined) lexical level (Perl). For those languages a different approach is needed.
The class of beautifiers that do not perform full lexical analysis of the source code can be called "fuzzy" prettyprinters." We will use this term as it reflects how both Neatperl and Neatbash. were programmed.
Pretty printers that do not perform full lexical analysis of the source code can be called "fuzzy" prettyprinter. Fuzzy prettyprinters limit themselves to changes of indentation only, so they usually do not introduce errors in the script, leaving statements structure intact |
For Bash which does not has lexical level at all full analysis involved writing a partial syntax analyzer. That further complicate the task in comparison with Perl and similar languages with complex lexical structure.
Fuzzy prettyprinters limit themselves to changes of indentation only, so they usually do not introduce errors in the script, leaving statements structure intact. Only HERE statements present problem and incorrect recognition of them still can change the script in undesirable way.
But using special pragma which are processed by prettyprinter you can exclude certain fragments of your script from pretty printing and that solve the problem in indirect, but a very efficient way. In any case you should get a prettyprinter for the language you use, or if this impossible switch to another scripting language ;-) .
In other words fuzzy prettyprinter represents "two way street" approach to Prettyprinting. It expect that the programmer to adhere to certain rules and convention, but in turn makes pretty printing compliant source more reliable and more immune form errors introduced by pretty printer as the result not completely understanding or misunderstanding certain lexical constructs in the language. .
Programming is hard. So any tool that makes introduction of certain errors into the source code more difficult, or detention of common errors much easier is a valuable tool in the programmer arcenal. That';s the key postulate of "defensive programming" methodology.
For C-style language with their chromic problem of unclosed or closed incorrectly "{" bracket no other tool can provide she same level of help as prettyprinter.
That's why any programmer writing programs in C-style languages greatly benefit from a good beautifier. It makes the indentation exactly corresponding to the nesting level of particular control statements. For other language like Ruby which used keywords for closing control structures (returning to the PL/1 style) this problem is less acute but still exists and prettyprinter remains a valuable tool.
The most important use case is when are modifying you own program which was written a long time ago. This is the situation when the most nasty errors are introduced because you do not remember all the context of particular programming decisions made and, as the result, along with fixing this particular problem intrudes a couple of other, probably more serious and nastry that the problem you fixed. In other words maintenance of old program typically lead to the loss of connection integrity due the lack of program understanding. Pretty printer helps a little bit with program understanding and thus is a simple and valuable tool to be used in this situation.
Deceptive, incorrect nesting levels can mask pretty subtle errors like incorrect end of a particular control structure block ( for example wrong "extension of the block"). In this case the syntax of the program remains correct and such errors are very difficult to trace as people instinctively trust indenting.
That's why beautifier is and in foreseeable future remains a useful debugging aid -- kind of lint for poor people.
Running away string constant is another use case. Actually good programming editors like Komodo Edit do a good job in the latter case by changing color of the subsequent text.
Beautifier is a very important debugging aid -- kind of lint for poor people. It makes finding missing '}' and, to a lesser extent, run-away constants in C-style languages much easier and far less time consuming. Actually good programming editors like Komodo Edit do a good job in the latter case by changing color of the subsequent text. |
Another benefit of beautification comes from its role as the enforcer of a standard format for programs in the particular language in the particular organization. This makes it much easier for a programmer to read the code of somebody else as well as his own programs in the future. In this sense, a beautifier is vital for program maintenance.
Another benefit of beautification comes from its role as the enforcer of a standard format for programs in the particular language in the particular organization. |
Beautifier with full lexical analyser can also work as obfuscators by eliminating all white space and comments.
A related topic is , which are "anti-beautifiers" and are designed to remove meaningful formatting and all comments in order to make code more difficult to read and comprehend, to discourage reverse engineering. Their success is another point about tremendous value of a good beautifier.
Beatifiers can also interfere with individual programming style. Beautifiers that perform full lexical analysis are more prone to enforce more that is reasonable or desirable.
Fuzzy beautifiers by definition do not interfere with programming style much changing only nesting level of statements.
Beautifier can work pretty well for many sample files. But it might fails for complex cases like commented out blocks of code; comments within statements (if the language allow such comments), obscure language features such as escapes in quoted strings, etc.
If you use it just to create a listing of the program this does not matter. But if you use it to reformat actual source code, then badly tested beautifier can introduce syntax errors, or worse, create program source that is still syntactically correct but semantically different then the original (for example, by mangling some string constants -- the most common problem with semi-debugged beautifiers).
That means that for a new beautifier need a lot of tests which needs to be performed before you can trust it for reformatting production scripts.
At least for the initial several weeks the results should be verified using diff (see How can I trust Beautifier programs??!! about this procedure). In case beautifier performs full lexical analysis you need to pay special attention for any lines that contain string constants.
This is the most fundamental reason why for languages with very complex lexical structure or without defined lexical level fuzzy beautifiers represent a better deal.
Dr. Nikolai Bezroukov
|
Switchboard | ||||
Latest | |||||
Past week | |||||
Past month |
Jan 01, 2019 | stackoverflow.com
A command-line HTML pretty-printer: Making messy HTML readable [closed] Ask Question Asked 10 years, 1 month ago Active 10 months ago Viewed 51k times
knorv ,
Closed. This question is off-topic . It is not currently accepting answers.jonjbar ,
Have a look at the HTML Tidy Project: http://www.html-tidy.org/The granddaddy of HTML tools, with support for modern standards.
There used to be a fork called tidy-html5 which since became the official thing. Here is its GitHub repository .
Tidy is a console application for Mac OS X, Linux, Windows, UNIX, and more. It corrects and cleans up HTML and XML documents by fixing markup errors and upgrading legacy code to modern standards.
For your needs, here is the command line to call Tidy:
tidy inputfile.htmlPaul Brit ,
Update 2018: Thehomebrew/dupes
is now deprecated, tidy-html5 may be directly installed.brew install tidy-html5
Original reply:
Tidy
from OS X doesn't supportHTML5
. But there is experimental branch onGithub
which does.To get it:
brew tap homebrew/dupes brew install tidy --HEAD brew untap homebrew/dupesThat's it! Have fun!
Boris , 2019-11-16 01:27:35
Error: No available formula with the name "tidy"
.brew install tidy-html5
works. – Pysis Apr 4 '17 at 13:34
Sep 16, 2019 | astyle.sourceforge.net
Artistic Style 3.1 A Free, Fast, and Small Automatic Formatter
for C, C++, C++/CLI, Objective‑C, C#, and Java Source Code
Project Page: http://astyle.sourceforge.net/ SourceForge: http://sourceforge.net/projects/astyle/ Artistic Style is a source code indenter, formatter, and beautifier for the C, C++, C++/CLI, Objective‑C, C# and Java programming languages.
When indenting source code, we as programmers have a tendency to use both spaces and tab characters to create the wanted indentation. Moreover, some editors by default insert spaces instead of tabs when pressing the tab key. Other editors (Emacs for example) have the ability to "pretty up" lines by automatically setting up the white space before the code on the line, possibly inserting spaces in code that up to now used only tabs for indentation.
The NUMBER of spaces for each tab character in the source code can change between editors (unless the user sets up the number to his liking...). One of the standard problems programmers face when moving from one editor to another is that code containing both spaces and tabs, which was perfectly indented, suddenly becomes a mess to look at. Even if you as a programmer take care to ONLY use spaces or tabs, looking at other people's source code can still be problematic.
To address this problem, Artistic Style was created – a filter written in C++ that automatically re-indents and re-formats C / C++ / Objective‑C / C++/CLI / C# / Java source files. It can be used from a command line, or it can be incorporated as a library in another program.
Sep 16, 2019 | prettyprinter.readthedocs.io
Usage
Install the package with
pip
:pip install prettyprinterThen, instead of
from pprint import pprintdo
from prettyprinter import cpprintfor colored output. For colorless output, remove the
c
prefix from the function name:from prettyprinter import pprint
Sep 16, 2019 | github.com
Announcement: Action required rawgit.com is going away .
An embeddable script that makes source-code snippets in HTML prettier.
- Works on HTML pages.
- Works even if code contains embedded links, line numbers, etc.
- Simple API: include some JS & CSS and add an onload handler.
- Lightweights: small download and does not block page from loading while running.
- Customizable styles via CSS. See the themes gallery .
- Supports all C-like, Bash-like, and XML-like languages. No need to specify the language.
- Extensible language handlers for other languages. You can specify the language.
- Widely used with good cross-browser support. Powers https://code.google.com/ and http://stackoverflow.com/
Sep 16, 2019 | stackoverflow.com
Benoit ,Oct 21, 2010 at 13:19
I'm looking for something similiar to indent but for (bash) scripts. Console only, no colorizing, etc.Do you know of one ?
Jamie ,Sep 11, 2012 at 3:00
Vim can indent bash scripts. But not reformat them before indenting.
Backup your bash script, open it with vim, typegg=GZZ
and indent will be corrected. (Note for the impatient: this overwrites the file, so be sure to do that backup!)Though, some bugs with
<<
(expecting EOF as first character on a line) e.g.EDIT: ZZ not ZQ
Daniel Martí ,Apr 8, 2018 at 13:52
A bit late to the party, but it looks like shfmt could do the trick for you.Brian Chrisman ,Sep 9 at 7:47
In bash I do this:reindent() { source <(echo "Zibri () {";cat "$1"; echo "}") declare -f Zibri|head --lines=-1|tail --lines=+3 | sed -e "s/^\s\s\s\s//" }this eliminates comments and reindents the script "bash way".
If you have HEREDOCS in your script, they got ruined by the sed in the previous function.
So use:
reindent() { source <(echo "Zibri () {";cat "$1"; echo "}") declare -f Zibri|head --lines=-1|tail --lines=+3" }But all your script will have a 4 spaces indentation.
Or you can do:
reindent () { rstr=$(mktemp -u "XXXXXXXXXX"); source <(echo "Zibri () {";cat "$1"|sed -e "s/^\s\s\s\s/$rstr/"; echo "}"); echo '#!/bin/bash'; declare -f Zibri | head --lines=-1 | tail --lines=+3 | sed -e "s/^\s\s\s\s//;s/$rstr/ /" }which takes care also of heredocs.
> ,
Found this http://www.linux-kheops.com/doc/perl/perl-aubert/fmt.script .Very nice, only one thing i took out is the [...]->test substitution.
Sep 16, 2019 | stackoverflow.com
nisetama ,Aug 12 at 10:33
I'm looking for recommendations for HTML pretty printers which fulfill the following requirements:
- Takes HTML as input, and then output a nicely formatted/correctly indented but "graphically equivalent" version of the given input HTML.
- Must support command-line operation.
- Must be open-source and run under Linux.
> ,
Have a look at the HTML Tidy Project: http://www.html-tidy.org/The granddaddy of HTML tools, with support for modern standards.
There used to be a fork called tidy-html5 which since became the official thing. Here is its GitHub repository .
Tidy is a console application for Mac OS X, Linux, Windows, UNIX, and more. It corrects and cleans up HTML and XML documents by fixing markup errors and upgrading legacy code to modern standards.
For your needs, here is the command line to call Tidy:
Sep 03, 2019 | perlmaven.com
The Code-TidyAll distribution provides a command line script called tidyall that will use Perl::Tidy to change the layout of the code.
This tandem needs 2 configuration file.
The .perltidyrc file contains the instructions to Perl::Tidy that describes the layout of a Perl-file. We used the following file copied from the source code of the Perl Maven project.
-pbp -nst -et=4 --maximum-line-length=120 # Break a line after opening/before closing token. -vt=0 -vtc=0The tidyall command uses a separate file called .tidyallrc that describes which files need to be beautified.
[PerlTidy] select = {lib,t}/**/*.{pl,pm,t} select = Makefile.PL select = {mod2html,podtree2html,pods2html,perl2html} argv = --profile=$ROOT/.perltidyrc [SortLines] select = .gitignoreOnce I installed Code::TidyAll and placed those files in the root directory of the project, I could run tidyall -a .That created a directory called .tidyall.d/ where it stores cached versions of the files, and changed all the files that were matches by the select statements in the .tidyallrc file.
Then, I added .tidyall.d/ to the .gitignore file to avoid adding that subdirectory to the repository and ran tidyall -a again to make sure the .gitignore file is sorted.
Oct 21, 2010 | stackoverflow.com
Pretty-print for shell script Ask Question Asked 8 years, 10 months ago Active 30 days ago Viewed 14k times
Benoit ,Oct 21, 2010 at 13:19
I'm looking for something similiar to indent but for (bash) scripts. Console only, no colorizing, etc.Do you know of one ?
Jamie ,Sep 11, 2012 at 3:00
Vim can indent bash scripts. But not reformat them before indenting.
Backup your bash script, open it with vim, typegg=GZZ
and indent will be corrected. (Note for the impatient: this overwrites the file, so be sure to do that backup!)Though, some bugs with
<<
(expecting EOF as first character on a line) e.g.EDIT: ZZ not ZQ
Daniel Martí ,Apr 8, 2018 at 13:52
A bit late to the party, but it looks like shfmt could do the trick for you.Brian Chrisman ,Aug 11 at 4:08
In bash I do this:reindent() { source <(echo "Zibri () {";cat "$1"; echo "}") declare -f Zibri|head --lines=-1|tail --lines=+3 | sed -e "s/^\s\s\s\s//" }this eliminates comments and reindents the script "bash way".
If you have HEREDOCS in your script, they got ruined by the sed in the previous function.
So use:
reindent() { source <(echo "Zibri () {";cat "$1"; echo "}") declare -f Zibri|head --lines=-1|tail --lines=+3" }But all your script will have a 4 spaces indentation.
Or you can do:
reindent () { rstr=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1); source <(echo "Zibri () {";cat "$1"|sed -e "s/^\s\s\s\s/$rstr/"; echo "}"); echo '#!/bin/bash'; declare -f Zibri | head --lines=-1 | tail --lines=+3 | sed -e "s/^\s\s\s\s//;s/$rstr/ /" }which takes care also of heredocs.
Pius Raeder ,Jan 10, 2017 at 8:35
Found this http://www.linux-kheops.com/doc/perl/perl-aubert/fmt.script .Very nice, only one thing i took out is the [...]->test substitution.
Sep 02, 2019 | github.com
go parser shell bash formatter posix mksh interpreter bash-parser beautifyGo
- Go 98.8%
- Other 1.2%
README.md
Type Name Latest commit message Commit time Failed to load latest commit information. _fuzz/ it _js cmd expand fileutil interp shell syntax .gitignore .travis.yml LICENSE README.md go.mod go.sum release-docker.sh sh
A shell parser, formatter and interpreter. Supports POSIX Shell , Bash and mksh . Requires Go 1.11 or later.
Quick start
To parse shell scripts, inspect them, and print them out, see the syntax examples .
For high-level operations like performing shell expansions on strings, see the shell examples .
shfmt
Go 1.11 and later can download the latest v2 stable release:
cd $(mktemp -d); go mod init tmp; go get mvdan.cc/sh/cmd/shfmtThe latest v3 pre-release can be downloaded in a similar manner, using the
/v3
module:cd $(mktemp -d); go mod init tmp; go get mvdan.cc/sh/v3/cmd/shfmtFinally, any older release can be built with their respective older Go versions by manually cloning, checking out a tag, and running
go build ./cmd/shfmt
.
shfmt
formats shell programs. It can use tabs or any number of spaces to indent. See canonical.sh for a quick look at its default style.You can feed it standard input, any number of files or any number of directories to recurse into. When recursing, it will operate on
.sh
and.bash
files and ignore files starting with a period. It will also operate on files with no extension and a shell shebang.shfmt -l -w script.shTypically, CI builds should use the command below, to error if any shell scripts in a project don't adhere to the format:
shfmt -d .Use
-i N
to indent with a number of spaces instead of tabs. There are other formatting options - seeshfmt -h
. For example, to get the formatting appropriate for Google's Style guide, useshfmt -i 2 -ci
.Packages are available on Arch , CRUX , Docker , FreeBSD , Homebrew , NixOS , Scoop , Snapcraft , and Void .
Replacing
bash -n
bash -n
can be useful to check for syntax errors in shell scripts. However,shfmt >/dev/null
can do a better job as it checks for invalid UTF-8 and does all parsing statically, including checking POSIX Shell validity:$ echo '${foo:1 2}' | bash -n $ echo '${foo:1 2}' | shfmt 1:9: not a valid arithmetic operator: 2 $ echo 'foo=(1 2)' | bash --posix -n $ echo 'foo=(1 2)' | shfmt -p 1:5: arrays are a bash featuregosh
cd $(mktemp -d); go mod init tmp; go get mvdan.cc/sh/v3/cmd/goshExperimental shell that uses
interp
. Work in progress, so don't expect stability just yet.Fuzzing
This project makes use of go-fuzz to find crashes and hangs in both the parser and the printer. To get started, run:
git checkout fuzz ./fuzzCaveats
- When indexing Bash associative arrays, always use quotes. The static parser will otherwise have to assume that the index is an arithmetic expression.
$ echo '${array[spaced string]}' | shfmt 1:16: not a valid arithmetic operator: string $ echo '${array[dash-string]}' | shfmt ${array[dash - string]}
$((
and((
ambiguity is not supported. Backtracking would complicate the parser and make streaming support viaio.Reader
impossible. The POSIX spec recommends to space the operands if$( (
is meant.$ echo '$((foo); (bar))' | shfmt 1:1: reached ) without matching $(( with ))
- Some builtins like
export
andlet
are parsed as keywords. This is to allow statically parsing them and building their syntax tree, as opposed to just keeping the arguments as a slice of arguments.JavaScript
A subset of the Go packages are available as an npm package called mvdan-sh . See the _js directory for more information.
Docker
To build a Docker image, checkout a specific version of the repository and run:
docker build -t my:tag -f cmd/shfmt/Dockerfile .Related projects
- Alternative docker images - by jamesmstone , PeterDaveHello
- format-shell - Atom plugin for
shfmt
- micro - Editor with a built-in plugin for
shfmt
- modd - A developer tool that responds to filesystem changes, using
sh
- shell-format - VS Code plugin for
shfmt
- vim-shfmt - Vim plugin for
shfmt
Uncrustify is a source code beautifier that allows you to banish crusty code. It works with C, C++, C#, D, Java, and Pawn and indents (with spaces only, tabs and spaces, and tabs only), adds and removes... newlines, has a high degree of control over operator spacing, aligns code, is extremely configurable, and is easy to modify (more)
This is a Web-based source code beautifier (source code formatter), similiar to indent. Please make a backup before you replace your code!
#!/usr/bin/perl # 'pb' Perl Beautifier # Written by P. Lutus Ashland, Oregon [email protected] 5/20/96 # This script processes Perl scripts, cleans up and indents, like cb does for C # Be careful with this script - it accepts wildcards and processes every text file # that meets the wildcard criteria. This could be a catastrophe in the hands of the unwary. $tabstring = " "; # You may place any tab-stop characters you want here if($ARGV[0] eq "") { print "usage: file1 file2 etc. or wildcards (replaces originals in place)\n"; } else { foreach $filename (@ARGV) { if(-T $filename) { &process($filename); } } } sub process { $fn = $_[0]; undef $/; # so we can grab the entire file at once undef @infa; # prevent left-overs print STDERR "$fn"; open (INFILE,$fn); @infa = split(/\n/,<INFILE>); close INFILE; $/ = "\n"; # restore default open (OUTFILE,">$fn"); $tabtotal = 0; for (@infa) { s/^\s*(.*?)\s*$/$1/; # strip leading and trailing spaces $a = $_; # copy original string $q = $a; # i plan to modify this copy for testing $q =~ s/\\\#//g; # remove escaped comment tokens $q =~ s/\#.*?$//g; # remove Perl-style comments $q =~ s{/\*.*?\*/} []gsx; # remove C-style comments $q =~ s/\\\{//g; # remove escaped left braces $q =~ s/\\\}//g; # remove escaped right braces $q =~ s/\\\(//g; # remove escaped left parentheses $q =~ s/\\\)//g; # remove escaped right parentheses $q =~ s/\'.*?\'//g; # remove single-quoted lines # now the remaining braces/parentheses should be structural $delta = -($q =~ s/\}/\}/g); # subtract closing braces $delta += ($q =~ s/\{/\{/g); # add opening braces $delta -= ($q =~ s/\)/\)/g); # subtract closing parens $delta += ($q =~ s/\(/\(/g); # add opening parens $tabtotal += ($delta < 0)?$delta:0; # subtract closing braces/parentheses $i = ($tabtotal > 0)?$tabtotal:0; # create tab index $tabtotal += ($delta>0)?$delta:0; # add opening braces/parentheses for next print if(substr($a,0,1) ne "#") { # don't tab comments print OUTFILE $tabstring x $i; # "tab" out to position } print OUTFILE "$a\n"; # print original line } # -- for (@infa) close OUTFILE; if($tabtotal != 0) { print STDERR " Indentation error: $tabtotal\n"; } else { print STDERR "\n"; } } # sub process
Beautifier (previously known as PSH, the PHP Syntax Highlighter) highlights and indents source code using highlight configuration files which are similar to Ultraedit highlighting files.
It supports C, C#, Java, Perl, PHP, Pascal, Lisp, Mumps, Eiffel, Euphoria, and x86 Assembler, amongst others.
It handles line/block comments, keyword highlighting, correct indentation, string highlighting, language contexts (allowing embedded languages), and selection highlighting. It is available in PHP and Perl versions.
Pretty Diff
- Diff code. The diff engine uses three separate functions: difflib, diffview, and charcomp. The first two components are originally by Snowtide Informatics Systems and the third component I wrote. difflib is altered in order to achieve more strict JSLint compliance, but is otherwise not significantly altered. diffview is almost entirely rewritten from scratch so that JavaScript arrays are used to store the dynamic output instead of DOM objects. This change has result in a 3.5x faster response rate. charcomp is the function used to highlight per character differences.
- Diff process. JavaScript code is first minified using JSMin and then beautified using js-beautify. This prevents differences from comments or whitespace interfering with the analysis of the code. It also allows beautified code to be flawlessly compared with minified code. CSS is first minified using JSmin for CSS and then beautified using cleanCSS for the same reasons mentioned for JavaScript. Markup is first minified using markupmin and then beautified using markup-beautify. Plain text is diffed without any minification or beautification. If code that needs to be compared that is not compatible with the other processes then use the plain text mode.
Only after the automated beautification does the diff process begin. The difflib finds differences per line and sends its results, as an array of numeric values where to look in the code, over the diffview. Diffview takes the opcodes supplied by difflib and then builds an array where the code is pumped into HTML table cell code. Once the view is completely built it is immediately inserted into the page using innerHTML. You cannot see the output at this point because it is set to display none until charcomp finishes.
charcomp finds the table cells with a class of "replace" and only works on those cells. Before performing any comparison it converts non-breaking space references into actual spaces to reduce processing requirements, and converts angle brackets into entity references, and converts entity references for quotes into actual quotes. In JavaScript a single quote compares to true against a double quote even if both are string literals, so I invented character references that I could convert back to quotes within the context of the comparison function so that they actually do become string literals that comparable. Once a difference is located it is wrapped in an em tag.
- Diff options. Print or Save Output option dumps the output into a separate window that contains only a title and the diff output. The code in this window is still dynamic, so it cannot be viewed unless saved to disk first. Since the code is all dynamic any browser plugins that are open, if they require access to the DOM, will exist in an open state in the saved output as well. Since this is a popup window any browser that does not tolerate popup windows with stability likely will not function correctly with this option. If the output is to be printed please use landscape instead of portrait orientation for the paper in order to achieve the best results. The output may look slightly different, because I am wrapping the table in an HTML <pre> tag in order to allow the visible presense of whitespace and yet still allow breaking for presentation where that breaking would not explicitly exist as a character definition. This presentation occurs so that more output could fit within the constraints of paper width. This is not a perfect solution as runs of whitespace will not break and will flow outside printable bounds.
Indentation Characters and Indentation Size are exactly the same as described in Beautification Options above. JavaScript Toleration is exactly the same as described in Minification Options above.
The Context Size option provides padding to the lines of code differences with lines of code that are not different. This option expects to receive a number or empty value only. If anything else is entered an empty value will be processed. An empty value negates this option by returning all supplied code with differences highlighted. If there is no differences are discovered this option is negated.
The Diff View Type option provides two choices. The first choice, Side by Side View, reports the output into two columns that display a side by side comparison of the differences. The second choice, Inline View, displays the output into a single column so that the differences can be seen in a vertical comparison.
About: NArrange is a tool for arranging .NET source code. This code beautifier automatically sorts and organizes class members into groups or regions. Currently, C# and VB code files are supported.
Changes: This release adds support for processing source files with conditional compilation preprocessor directives, and fixes a couple of C# and VB parsing/writing bugs.
About: Highlight is a universal converter from source code to HTML, XHTML, RTF, TeX, LaTeX, and XML. (X)HTML output is formatted by Cascading Style Sheets. It supports more than 100 programming languages, and includes 40 highlighting color themes. It's possible to easily enhance the parsing database. The converter includes some features to provide a consistent layout of the input code.
Changes: Embedded output instructions specific to the output document format were added. Support for Arc and Lilypond was added.
Perltidy is a Perl script indenter and beautifier. By default it approximately follows the suggestions in perlstyle(1), but the style can be adjusted with command line parameters. Perltidy can also write syntax-colored HTML output.Release focus: Minor feature enhancements
JavascriptDecoder is a tool to easily decode obfuscated Javascript code. Besides decoding, it can also serve as a Javascript code beautifier and colorizer.
About:
GNU Source-highlight produces a document with syntax highlighting when given a source file. It handles many languages, e.g., Java, C/C++, Prolog, Perl, PHP3, Python, Flex, HTML, and other formats, e.g., ChangeLog and log files, as source languages and HTML, XHTML, DocBook, ANSI color escapes, LaTeX, and Texinfo as output formats. Input and output formats can be specified with a regular expression-oriented syntax.Release focus: Major feature enhancements
Changes:
Language definitions for makefiles, CSS files, and m4 files were added. The --quiet option was added to show no progress information. Direct color specifications in double quotes in style files are allowed. In style files, one can specify formatting options for more than one element on the same line. CSS files can be specified as style files (with limited support). Background colors for single elements and the entire document are now handled.
Uncrustify is a source code beautifier that allows you to banish crusty code. It works with C, C++, C#, D, Java, and Pawn and indents (with spaces only, tabs and spaces, and tabs only), adds and removes newlines, has a high degree of control over operator spacing, aligns code, is extremely configurable, and is easy to modify.
GC! GreatCode 1.095 for Win9x/NT4/ME/Win2k (50 kb)
From NonagsPLUS (Members) (50 kb)
Updated: Sep 19, 2000
Homepage
Author: christophe beaudet
Description: Very powerful C/C++ source code beautifier.
freshmeat.net
Beautifier (previously known as PSH, the PHP Syntax Highlighter) highlights and indents source code using highlight configuration files which are similar to Ultraedit highlighting files. It supports C, C#, Java, Perl, PHP, Pascal, Lisp, Mumps, Eiffel, Euphoria, and x86 Assembler, amongst others. It handles line/block comments, keyword highlighting, correct indentation, string highlighting, language contexts (allowing embedded languages), and selection highlighting. It is available in PHP and Perl versions.
(The latest version of this document is at "http://www.milkywaygalaxy.freeservers.com" . You may want to check there for changes).
Coding standards for C/C++ or any language is required in order to make the programs more readable/understandable by programmers. There are C/C++ beautifiers (formating tools) to accomplish this goal. Formatted (beautified) code improves the productivity of programmers by 2 times !!
On Linux/Unixes there is a command called "indent" and "cb" . Refer to 'man indent' and 'man cb'. Note that indent and cb work for only "C" programs. For "C++" programs use "bcpp" .
Important NOTE: To compile bcpp under unix, unpack bcpp.tar.gz and you MUST change directory to "code" and give a make. Do not change to "unix" directory and give a make. That will give lots of errors.
Download the beautifier program from one of the following
- If you are having trouble downloading software from any of the sites below, then download for a small cost from my site at "http://www.milkywaygalaxy.freeservers.com" . The cost is very small to maintain this web site. Some of the free sites below are not maintained properly.
- C++ : BCPP site is at "http://dickey.his.com/bcpp/bcpp.html" or at "http://www.clark.net/pub/dickey" . BCPP ftp site is at "ftp://dickey.his.com/bcpp/bcpp.tar.gz"
- C++ : "http://www.consultix-inc.com/c++b.html"
- C : "http://www.chips.navy.mil/oasys/c/" and mirror at Oasys
- C++ : "http://www.semdesigns.com/Products/DMS/DMSToolkit.html"
- C++, C, Java and Oracle Pro-C Beautifier "http://www.geocities.com/~starkville/main.html"
- C++, C beautifier "http://users.erols.com/astronaut/vim/ccb-1.07.tar.gz" and site at "http://users.erols.com/astronaut/vim/#vimlinks_src"
- C++, C, Java, Perl beautifier CBP "http://www.prismtk.de/docs/cbp"
- GC! GreatCode! is a powerful C/C++ source code beautifier Windows 95/98/NT/2000 "http://perso.club-internet.fr/cbeaudet"
- CbVan for C, C++ and Java at "http://www.geocities.com/~starkville/main.html"
- Artistic Style beautifier for C, C++, Java at "http://sourceforge.net/projects/astyle" "http://astyle.sourceforge.net" .
I used BCPP to format the C++ programs and it worked fine for me. You may want to check other tools and use the one which you may like the most.
BCPP was written by Steven De Toni at [email protected]
Outputting Text with Language Highlighting
------------------------------------------The `enscript' tool currently recognizes the formatting of more than
forty languages and formats, from the Perl and C programming languages
to HTML, email, and Usenet news articles; `enscript' can highlight
portions of the text based on its syntax. In Unix-speak, this is called
"pretty-printing".The following table lists the names of some of the language filters
that are available at the time of this writing and describes the
languages or formats they're used for.FILTER LANGUAGE OR FORMAT
`ada' Ada95 programming language.
`asm' Assembler listings.
`awk' AWK programming language.
`bash' Bourne-Again shell programming language.
`c' C programming language.
`changelog' ChangeLog files.
`cpp' C++ programming language.
`csh' C-Shell script language.
`delphi' Delphi programming language.
`diff' Normal "difference reports" made from `diff'.
`diffu' Unified "difference reports" made from `diff'.
`elisp' Emacs Lisp programming language.
`fortran' Fortran77 programming language.
`haskell' Haskell programming language.
`html' HyperText Markup Language (HTML).
`idl' IDL (CORBA Interface Definition Language).
`java' Java programming language.
`javascript' JavaScript programming language.
`ksh' Korn shell programming language.
`m4' M4 macro processor programming language.
`mail' Electronic mail and Usenet news articles.
`makefile' Rule files for `make'.
`nroff' Manual pages formatted with `nroff'.
`objc' Objective-C programming language.
`pascal' Pascal programming language.
`perl' Perl programming language.
`postscript' PostScript programming language.
`python' Python programming language.
`scheme' Scheme programming language.
`sh' Bourne shell programming language.
`skill' Cadence Design Systems Lisp-like language.
`sql' Sybase 11 SQL.
`states' Definition files for `states'.
`synopsys' Synopsys `dc' shell scripting language.
`tcl' Tcl programming language.
`tcsh' TC-Shell script language.
`vba' Visual Basic (for Applications).
`verilog' Verilog hardware description language.
`vhdl' VHSIC Hardware Description Language (VHDL).
`vrml' Virtual Reality Modeling Language (VRML97).
`zsh' Z-shell programming language.To pretty-print a file, give the name of the filter to use as an
argument to the `-E' option, without any whitespace between the option
and argument.* To pretty-print the HTML file `index.html', type:
$ enscript -Ehtml index.html <RET>
* To pretty-print an email message saved to the file
`important-mail', and output it with no headers to a file named
`important-mail.ps', type:$ enscript -B -Email -p important-mail.ps important-mail <RET>
Use the special `--help-pretty-print' option to list the languages
supported by the copy of `enscript' you have.* To peruse a list of currently supported languages, type:
$ enscript --help-pretty-print | less <RET>
This program, given a source file, produces a document with syntax highlighting.
At the moment this package can handle
- Java
- C/C++
- Prolog
- Perl
- Php3
- Python
- Flex
- ChangeLog
as source languages, and
- HTML
- XHTML
as output format.
NOTICE: now the name of the program is source-highlight: there are no two separate programs, namely java2html and cpp2html, anymore. However there are two shell scripts with the same name in order to facilitate the migration (however their use is not advised).
GNU Source-highlight is free software. Please see the file COPYING for details. For documentation, please read this file.
GNU Source-highlight is a GNU program and its main home page is at GNU site:
http://www.gnu.org/software/src-highlite/source-highlight.htmlYou can download it from GNU's ftp site:
ftp://ftp.gnu.org/gnu/source-highlight/ or from one of its mirrors (see http://www.gnu.org/prep/ftp.html).I do not distribute Windows binaries anymore; since, they can be easily built by using Cygnus C/C++ compiler, available at http://www.cygwin.com/. However, if you don't feel like downloading such compiler, you can request such binaries directly to me, by e-mail ([email protected]) and I can send them to you.
An MS-Windows port of Source-highlight is available from http://gnuwin32.sourceforge.net/.You may also want to check the md5sum of the archives, which are also digitally signed by me (Lorenzo Bettini) with GNU gpg (http://www.gnupg.org). My GPG public key can be found at my home page (see at the end of this doc).
You can also get the patches, if they are available for a particular release (see below for patching from a previous version).
About: Mangle is a source de-formatter/de-commentor. It will remove all comments and/or formatting from C/C++ source code leaving only what is required.
Changes: Some bugfixes, cleanups, and new features.
designed for HTML, Java, and Perl programming. WinTidy is easily
customized, handles huge files, and includes powerful validation and
beautification tools. Integrated browser, Java support, DOS, Unix,
Mac file formats. Print options include 'two-up' printing, syntax
coloring, and line numbers. It's easy to take advantage of WinTidy's
many features. WinTidy's design is intuitive, allowing you to avoid
the pitfalls of learning a new program. Its slick, simple interface
includes customizable menus, toolbars, and keyboard settings. WinTidy
includes powerful editing features including column blocks, drag and
drop editing, bookmarks, split-file editing, and global search and
replace. WinTidy is built for programmers with features like brace
matching, configurable color-syntax highlighting, and custom tool
support. Compilers and other tools are launched on separate threads,
and can be controlled without leaving WinTidy, allowing complete
automation of the compile, build and debug sequence.Special requirements: 16MB RAM
Adware. Uploaded by the authorized Distributor.
Dave Collins, SharewarePromotions
[email protected]
WinEdit Software Co.
[email protected]
http://www.wintidy.com/
Category: WinME / Win98 / Win95 / Programming UtilitiesPublisher: Herman Oosthuysen
Website: http://www.AerospaceSoftware.com/
File Name: wdent121.zip
Also works from the command line and can be called from a batch file. Indent up to 256 files in one go. Freeware with C source code.
Special requirements: None
Freeware. Uploaded by the author.
Herman Oosthuysen, Aerospace Software Ltd.
[email protected]
http://www.AerospaceSoftware.com/
PPRINT generates source code listings in postscript. It italicizes comments, boldfaces typedefs, and bold-italicizes keywords. It generates line numbers and a cross reference of all typedefs, static and global functions, listing both definitions and references. Definitions are in bold.
PPRINT manages print-outs of multiple files by producing both global and local page numbers. At the end of the run, it prints out a table of contents, and index, and a reference of all globally accessible typedefs and classes.
PPRINT works with C files, C++ files, Verilog files, and text files. It figures out which language based on extension:
2.5 Pretty-PrintingIn building complicated data structures, it is always nice to have a pretty-printer handy for debugging. There are at least two options for pretty-printing data structures. The first is the Perl debugger itself. It uses a function called dumpValue in a file called dumpvar.pl, which can be found in the standard library directory. We can help ourselves to it, with the caveat that it is an unadvertised function and could change someday. To pretty-print this structure, for example:
@sample = (11.233,{3 => 4, "hello" => [6,7]});we write the following:
require 'dumpvar.pl'; dumpValue(\@sample); # always pass by referenceThis prints something like this:
0 11.233 1 HASH(0xb75dc0) 3 => 4 'hello' => ARRAY(0xc70858) 0 6 1 7We will cover the require statement in Chapter 6, Modules. Meanwhile, just think of it as a fancy #include (which doesn't load the file if it is already loaded).
The Data::Dumper module available from CPAN is another viable alternative for pretty-printing. Chapter 10, Persistence, covers this module in some detail, so we will not say any more about it here. Both modules detect circular references and handle subroutine and glob references.
It is fun and instructive to write a pretty-printer ourselves. Example 2.5 illustrates a simple effort, which accounts for circular references but doesn't follow typeglobs or subroutine references. This example is used as follows:
pretty_print(@sample); # Doesn'tneed
a referenceThis prints
11.233 { # HASH(0xb78b00) : 3 => 4 : hello => : : [ # ARRAY(0xc70858) : : : 6 : : : 7 : : ] }The following code contains specialized procedures (print_array, print_hash, or print_scalar) that know how to print specific data types. print_ref, charged with the task of pretty-printing a reference, simply dispatches control to one of the above procedures depending upon the type of argument given to it. In turn, these procedures may call
print_ref
recursively if the data types that they handle contain one or more references.Whenever a reference is encountered, it is also checked with a hash %already_seen to determine whether the reference has been printed before. This prevents the routine from going into an infinite loop in the presence of circular references. All functions manipulate the global variable $level and call print_indented, which appropriately indents and prints the string given to it.
Example 2.5: Pretty-Printing
$level = -1; # Level of indentation sub pretty_print { my $var; foreach $var (@_) { if (ref ($var)) { print_ref($var); } else { print_scalar($var); } } } sub print_scalar { ++$level; my $var = shift; print_indented ($var); --$level; } sub print_ref { my $r = shift; if (exists ($already_seen{$r})) { print_indented ("$r (Seen earlier)"); return; } else { $already_seen{$r}=1; } my $ref_type = ref($r); if ($ref_type eq "ARRAY") { print_array($r); } elsif ($ref_type eq "SCALAR") { print "Ref -> $r"; print_scalar($$r); } elsif ($ref_type eq "HASH") { print_hash($r); } elsif ($ref_type eq "REF") { ++$level; print_indented("Ref -> ($r)"); print_ref($$r); --$level; } else { print_indented ("$ref_type (not supported)"); } } sub print_array { my ($r_array) = @_; ++$level; print_indented ("[ # $r_array"); foreach $var (@$r_array) { if (ref ($var)) { print_ref($var); } else { print_scalar($var); } } print_indented ("]"); --$level; } sub print_hash { my($r_hash) = @_; my($key, $val); ++$level; print_indented ("{ # $r_hash"); while (($key, $val) = each %$r_hash) { $val = ($val ? $val : '""'); ++$level; if (ref ($val)) { print_indented ("$key => "); print_ref($val); } else { print_indented ("$key => $val"); } --$level; } print_indented ("}"); --$level; } sub print_indented { $spaces = ": " x $level; print "${spaces}$_[0]\n"; }print_ref simply prints its argument (a reference) and returns if it has already seen this reference. If you were to read the output produced by this code, you would find it hard to imagine which reference points to which structure. As an exercise, you might try producing a better pretty-printer, which identifies appropriate structures by easily identifiable numeric labels like this:
: hello => : : [ # 10 : : : 6 : : : 7 : : ] : foobar => array-ref # 10 }The number 10 is an automatically generated label, which is more easily identifiable than something like ARRAY(0xc70858).
Google matched content |
www.simtel.net - Search Results
CSCOP120.ZIP - c-scope 1.20 analyzes C source code and produces various reports (48,505 bytes, 06/30/95)
Beautifiers for other Languages
To create presentation of codes to display using HTML -
GNU Source-highlight - GNU Project - Free Software Foundation (FSF) v1.6 by Lorenzo Bettini
This program, given a source file, produces a document with syntax highlighting.
At the moment this package can handle
- Java
- C/C++
- Prolog
- Perl
- Php3
- Python
- Flex
- ChangeLog
as source languages, and
- HTML
- XHTML
as output format.
NOTICE: now the name of the program is source-highlight: there are no two separate programs, namely java2html and cpp2html, anymore. However there are two shell scripts with the same name in order to facilitate the migration (however their use is not advised).
GNU Source-highlight is free software. Please see the file COPYING for details. For documentation, please read this file.
GNU Source-highlight is a GNU program and its main home page is at GNU site:
http://www.gnu.org/software/src-highlite/source-highlight.htmlYou can download it from GNU's ftp site:
ftp://ftp.gnu.org/gnu/source-highlight/ or from one of its mirrors (see http://www.gnu.org/prep/ftp.html).I do not distribute Windows binaries anymore; since, they can be easily built by using Cygnus C/C++ compiler, available at http://www.cygwin.com/. However, if you don't feel like downloading such compiler, you can request such binaries directly to me, by e-mail ([email protected]) and I can send them to you.
An MS-Windows port of Source-highlight is available from http://gnuwin32.sourceforge.net/.You may also want to check the md5sum of the archives, which are also digitally signed by me (Lorenzo Bettini) with GNU gpg (http://www.gnupg.org). My GPG public key can be found at my home page (see at the end of this doc).
You can also get the patches, if they are available for a particular release (see below for patching from a previous version).
www.simtel.net wintid10.zip (Powerful validating HTML,Java,Perl ed. Adware)
ASBeautifier 0.8.0 |
ASBeautifier is a C++ port of JSBeautifier. It automatically reindents C++, C, and Java source files, i.e. beautifies them. ABeautifier is small, fast, and distributed as open-software (under the 'Artistic License'). ASBeautifier was created following interest from users of the jstyle family of source code filters. |
indent - GNU Project - Free Software Foundation (FSF)
Indent -- This is the home page for the GNU indent tool.
Artistic Style 1.2.0 | |
Artistic Style is a fast and small open-source(TM) indenter and reformatter
of C, C++ and Java source codes.
Version 1.2.0 contains numerous serious bug fixes, and a new formatting option for special treatment of mono-line blocks of code. |
|
Tal Davidson @ 12/19/98 - 15:49 EST |
ASBeautifier 0.8.0 |
ASBeautifier is a C++ port of JSBeautifier. It automatically reindents C++, C, and Java source files, i.e. beautifies them. ABeautifier is small, fast, and distributed as open-software (under the 'Artistic License'). ASBeautifier was created following interest from users of the jstyle family of source code filters. |
[36] Miscellaneous environmental issues, C++ FAQ Lite
In alphabetical order:
- A2PS is a Unix-based pretty-printer. It is available from www.infres.enst.fr/~demaille/a2ps/
- Artistic Style is a reindenter and reformatter of C++, C and Java source code. It is available from astyle.sourceforge.net/
- C++2LaTeX is a LaTeX pretty printer. It is available from mirriwinni.cse.rmit.edu.au/ftp/pub/languages/C++2LaTeX-4.0.tar.gz
- C-Clearly by V Communications, Inc. is a Windows program that comes with standard formatting templates and also allows you to customize your own. www.mixsoftware.com/product/ccl.htm
- GNU indent program may help. It's available at www.arceneaux.com/indent.html. You can also find an "official" GNU mirror site by looking at www.gnu.org/order/ftp.html or perhaps the original GNU site, ftp://prep.ai.mit.edu/pub/gnu/ (e.g., if the current version is 1.9.1 you could use ftp://prep.ai.mit.edu/pub/gnu/indent-1.9.1.tar.gz).
- "HPS Beauty" is reported to be a Windows 95/98/NT4/NT2000 utility that beautifies C/C++ source code based on rules. The interface is entirely GUI, but HPS Beauty may also be run from the command line. It supports style files, which allow you to save and restore groups of settings. HPS Beauty also offers an optional visual results window, that shows both the before and the after file. Optional HTML output allows you to view source code with syntax highlighting in your browser. www.highplains.net.
- "Source Styler for C++" has lots of bells and whistles. It is a commercial product with a free 15-day trial period. It seems to offer control over tons of different features. www.ochresoftware.com/.
- tgrind is a Unix based pretty printer. It usually comes with the public distribution of TeX and LaTeX in the directory "...tex82/contrib/van/tgrind". A more up-to-date version of tgrind by Jerry Leichter can be found on: ftp://venus.ycc.yale.edu/pub in [.TGRIND]. [Note: If anyone has an updated URL for tgrind, please let me know ([email protected]).]
Finally, you might consider lgrind which is another C++ to LaTeX translator (check for the closest mirror site of the ctan archive). The following is a grind definition for C++ (but this one doesn't recognize some new keywords such as bool or wchar_t, and it doesn't recognize a file ending with .cpp as C++):
C++|c++|CC:\
:pb=\p\d?\(:cf:np=\)\d?;:bb={:be=}:\
:cb=/*:ce=*/:ab=//:ae=$:sb=":se=\e":lb=':\
:zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\
:le=\e':tl:id=_~\::\
:kw=asm auto break case cdecl char continue default do double else\
enum extern far float for fortran goto huge if int interrupt long\
near pascal register return short signed sizeof static struct\
switch typedef union unsigned while void\
#define #else #endif #if #ifdef #ifndef #include #undef # define\
endif ifdef ifndef include undef defined #pragma\
class const delete friend inline new operator overload private\
protected public template this virtual:
Consists of a suite of program that generates "pretty" PostScript source code listings using TeX. For a given language, comments are rendered in Times Roman italics, keywords in bold, strings in Courier; line-numbers, every 10 lines in a tiny font, and function/subroutine/procedure definitions, in a larger font, are displayed along the right margin. HISTORY prettyp (a new addition to the tgrind package) uses tfontedpr, written by Van Jacobson, which was originally based on BSD 4.2 vfontedpr, written by Bill Joy & Dave Presotto, which used troff. All the contents of the original tgrind package are included for backwards compatibility. This release was ported to build under GNU/Linux (there was a variable called _start that was messing with the compiler's idea of reality), and Solaris with TeX (Web2C 7.2) 3.14159 by Luis Fernandes & Jason Naughton. The major feature of prettyp (w.r.t. tgrind) is its automatic language detection capabilities that enables one to grind source code without specifying the -l (language) option. prettyp uses a combination of filename extensions and interpreter (#! magic) to deduce the language. LANGUAGE SUPPORT Languages supported by this release are: C, C++ (new), FORTRAN77, ISP, Icon, Java (new), LDL, Emacs Mock Lisp, Model, Modula2, Pascal, Perl (new), Python (new), RATFOR, Russell, sh/csh, Tcl (new) and yacc grammer. Support for additional languages can be easily added, see EXTENDING LANGUAGE SUPPORT below. REQUIREMENTS You will need TeX to be installed on your system for this program to work. You will need perl to use the prettyp front-end (specifically, the script "lang", that performs automatic language detection). PLATFORMS tfontedpr, the program that does all the actual work, has been successfully built on i586 GNU/Linux 2.0.34, SPARC Solaris 2.5.1, and SunOS 4.1.4. It should compile without problem for most other platforms. EXAMPLE To grind a C source-code file and a shell script, type: prettyp vgrindefs.c prettyp to generate vgrindefs.c.ps and prettyp.ps which may be viewed with ghostview or printed on a PostScript printer. You can visit the prettyp home page at www.ee.ryerson.ca/~elf/prettyp/ and view the "pretty" PostScript output for a shell script, a perl script, C code and Tcl/Tk code. EXTENDING LANGUAGE SUPPORT To add pretty print capabilities for other languages, add the language definition to the vgrindefs database and modify the alist in the lang perl script adding a file-extension/interpreter to language mapping. - -- This article has been digitally signed by the moderator, using PGP. http://www.iki.fi/mjr/cola-public-key.asc has PGP key for validating signature. Send submissions for comp.os.linux.announce to: [email protected] PLEASE remember a short description of the software and the LOCATION. This group is archived at http://www.iki.fi/mjr/linux/cola.html
Society
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
Quotes
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Bulletin:
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
History:
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
Classic books:
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|
You can use PayPal to to buy a cup of coffee for authors of this site |
Disclaimer:
The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.
Last modified: March, 05, 2020