Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.548.297 Times

cpphs 1.0

  Date Added: October 08, 2010  |  Visits: 698


Report Broken Link
Printer Friendly Version

Product Homepage
Download (70 downloads)

cpphs is a liberalised re-implementation of cpp, the C pre-processor, in Haskell. Why re-implement cpp? Rightly or wrongly, the C pre-processor is widely used in Haskell source code. It enables conditional compilation for different compilers, different versions of the same compiler, and different OS platforms. It is also occasionally used for its macro language, which can enable certain forms of platform-specific detail-filling, such as the tedious boilerplate generation of instance definitions and FFI declarations. However, there are two problems with cpp, aside from the obvious aesthetic ones: * For some Haskell systems, notably Hugs on Windows, a true cpp is not available by default. * Even for the other Haskell systems, the common cpp provided by the gcc 3.x series is changing subtly in ways that are incompatible with Haskells syntax. There have always been problems with, for instance, string gaps, and prime characters in identifiers. These problems are only going to get worse. So, it seemed right to provide an alternative to cpp, both more compatible with Haskell, and itself written in Haskell so that it can be distributed with compilers. This version of the C pre-processor is pretty-much feature-complete, and compatible with the -traditional style. It has two main modes: * conditional compilation only (--nomacro), * and full macro-expansion (default). In --nomacro mode, cpphs performs only conditional compilation actions, namely #includes, #ifs, and #ifdefs are processed according to text-replacement definitions (both command-line and internal), but no parameterised macro expansion is performed. In full compatibility mode (the default), textual replacements and macro expansions are also processed in the remaining body of non-cpp text. Working features: #ifdef simple conditional compilation #if the full boolean language of defined(), &&, ||, ==, etc. #elif chained conditionals #define in-line definitions (text replacements and macros) #undef in-line revocation of definitions #include file inclusion #line line number directives line continuations within all # directives /**/ token catenation within a macro definition ## ANSI-style token catenation # ANSI-style token stringisation __FILE__ special text replacement for DIY error messages __LINE__ special text replacement for DIY error messages __DATE__ special text replacement __TIME__ special text replacement Macro expansion is recursive. Redefinition of a macro name does not generate a warning. Macros can be defined on the command-line with -D just like textual replacements. Macro names are permitted to be Haskell identifiers e.g. with the prime and backtick ` characters, which is slightly looser than in C, but they still may not include operator symbols. Numbering of lines in the output is preserved so that any later processor can give meaningful error messages. When a file is #included, cpphs inserts #line directives for the same reason. Numbering should be correct even in the presence of line continuations. If you dont want #line directives in the final output, use the --noline option. Any syntax errors in cpp directives gives a message to stderr and halts the program. Failure to find a #included file produces a warning to stderr, but processing continues. Differences from cpp: In general, cpphs is based on the -traditional behaviour, not ANSI C, and has the following main differences from the standard cpp. General - The # that introduces any cpp directive must be in the first column of a line (whereas ANSI permits whitespace before the #). - Generates the #line n "filename" syntax, not the # n "filename" variant. - C comments are only removed from within cpp directives. They are not stripped from other text. Consider for instance that in Haskell, all of the following are valid operator symbols: /* */ */* However, you can turn on C-comment removal with the --strip option. - Macros are never expanded within Haskell comments, strings, or character constants, unless you give the --text option to disable lexing the input as Haskell. - Macros are always expanded recursively, unlike ANSI, which detects and prevents self-recursion. For instance, #define foo x:foo expands foo once only to x:foo in ANSI, but in cpphs it becomes an infinite list x:x:x:x:..., i.e. cpphs does not terminate. Macro definition language - Accepts /**/ for token-pasting in a macro definition. However, /* */ (with any text between the open/close comment) inserts whitespace. - The ANSI ## token-pasting operator is available with the --hashes flag. This is to avoid misinterpreting any valid Haskell operator of the same name. - Replaces a macro formal parameter with the actual, even inside a string (double or single quoted). This is -traditional behaviour, not supported in ANSI. - Recognises the # stringisation operator in a macro definition only if you use the --hashes option. (It is an ANSI addition, only needed because quoted stringisation (above) is prohibited by ANSI.) - Preserves whitespace within a textual replacement definition exactly (modulo newlines), but leading and trailing space is eliminated. - Preserves whitespace within a macro definition (and trailing it) exactly (modulo newlines), but leading space is eliminated. - Preserves whitespace within macro call arguments exactly (including newlines), but leading and trailing space is eliminated. - With the --layout option, line continuations in a textual replacement or macro definition are preserved as line-breaks in the macro call. (Useful for layout-sensitive code in Haskell.) Whats New in This Release: - This release now includes a compatibility script for command line arguments to match the original cpp. - There are several minor bugfixes, e.g. quotes around replacements for special macros like __FILE__, etc. - Interaction with preprocessors like hsc2hs is also improved: if they allow non-cpp directives like #def, these are now passed through to the output with a warning to stderr, rather than halting with an error. - Likewise, a #! line in a shell script is now ignored..

Requirements: No special requirements
Platforms: Linux
Keyword: Ansi Conditional Compilation Cpp Cpphs Haskell Line Macro Preprocessors Programming Special Text Text Replacement
Users rating: 0/10

License: Freeware Size: 39.94 KB
More Reviews or Write Review

Programming  -  QualityMgnt ToolBox 1.1b013
Provides tools, supporting quality management or quality assurance for software: Assessment execution (ISO 15504 (SPiCE), AutomotiveSPiCE, CMMi), diff tool calculating sizes (SLoC) of diffs, identification of conditional compilation, and more.
11.53 MB  
Shell & Desktop  -  Hashell 0.013a
Hashell project is a shell that is written in Haskell language and which it is intended to provide a set of abstractions that allows you to use Haskell as a shell programming language. So that way you can use haskell for your daily...
15.36 KB  
Modules  -  Widget Logic 0.43
WP's Conditional Tags or general PHP code can be used in this text field.InstallationUnpack and upload it to the /wp-content/plugins/ directory.Activate the plugin through the 'Plugins' menu in WordPress. Requirements: - WordPress 2.5 or higher
Input Device Utilities  -  Short Keys 98 Lite 1.5a
ShortKeys is a macro utility allowing you to setup replacement text or paragraphs for any given number of user defined keystrokes. ShortKeys monitors the keyboard activity on a global nature and anytime a user defined keystroke combination is...
344 KB  
Word Processing  -  Arcadia PhotoPerfect 2.90 build 117
AutoUnbreak removes line breaks from formatted (or plain) text input. This is useful if you want to reformat a text document where lines have been cut short, for example when copying text from an Adobe PDF file to a word processor. Thus, the...
270 KB  
Code Management Tools  -  Perltidy 20070801
Perltidy is a Perl script which indents and reformats Perl scripts to make them easier to read. If you write Perl scripts, or spend much time reading them, you will probably find it useful. Configuration Files While style preferences vary,...
317.44 KB  
Programming  -  XProjectJ 0.1.0
XMACROJ is an XML based macro language used to assemble text files from re-usable XML components...originally developed to generate JSP/XHTML files, by-passing the need for JSP include directives
286.91 KB  
Programming  -  Pycco 0.1
Pocco is a Python port of Docco: the original quick-and-dirty, hundred-line-long, literate-programming-style documentation generator. It produces HTML that displays your comments alongside your code. Comments are passed through Markdown, and code...
10.24 KB  
Printer Tools  -  2Printer 5.3
2Printer is a command line tool for printing PDF files, text documents, images, worksheets, presentations, drawings, XML, XPS and HTML files in batch mode. 2Printer is compatible with any local, network or virtual printers that are connected to...
59.45 MB  
Education  -  Hello Code
This application shows you the popular "Hello World" code line of 50 programming languages. Requirements: Windows Phone 8.1, Windows Phone 8, Windows Phone 7.5
1024 KB  
Linux Software  -  Polling Autodialer Software 3.4
ICTBroadcast Auto Dialer software has a survey campaign for telephone surveys and polls. This auto dialer software automatically dials a list of numbers and asks them a set of questions that they can respond to, by using their telephone keypad....
488 B  
Linux Software  -  Total Video Converter Mac Free 3.5.5
Total Video Converter Mac Free developed by EffectMatrix Ltd is the official legal version of Total Video Converter which was a globally recognized brand since 2006. Total Video Converter Mac Free is a free but powerful all-in-one video...
17.7 MB  
Linux Software  -  Skeith mod_log_sql Analyzer 2.10beta2
Skeith is a php based front end for analyzing logs for Apache using mod_log_sql.
47.5 KB  
Linux Software  -  SLAX 6.0+
Slax is a modern, portable, small and fast Linux operating system with a modular approach and outstanding design. Despite its small size, Slax provides a wide collection of pre-installed software for daily use, including a well organized graphical...
190 KB  
Linux Software  -  GTK+ 2.5
GTK+, which stands for the GIMP Toolkit, is a library for creating graphical user interfaces for the X Window System. It is designed to be small, efficient, and flexible. GTK+ is written in C with a very object-oriented approach. Language bindings...
60 MB  
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by, it is used to describe information about an application such as the name and...
327.68 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB