Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "format_spec"

Title:Parse and check format/2 specifications
Rating:Not rated. Create the first rating!
Latest version:0.0.2
SHA1 sum:5bc0c72d72fd73b9c34e329e549a536a51bf9621
Author:Michael Hendricks <michael@ndrix.org>
Maintainer:Michael Hendricks <michael@ndrix.org>
Packager:Michael Hendricks <michael@ndrix.org>
Home page:http://packs.ndrix.com/format_spec/index.html
Download URL:http://packs.ndrix.com/format_spec/format_spec-0.0.2.tgz

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.0.10dbd10b366a0f5e42495eca7fe28c569337215221http://packs.ndrix.com/format_spec/format_spec-0.0.1.tgz
0.0.25bc0c72d72fd73b9c34e329e549a536a51bf962145http://packs.ndrix.com/format_spec/format_spec-0.0.2.tgz

Synopsis

?- use_module(library(format_spec)).
?- format_spec("Hello, ~s~n", Spec).
Spec = [ text("Hello, ")
       , escape(nothing, no_colon, s)
       , escape(nothing, no_colon, n)
       ].

?- spec_arity($Spec, Arity).
Arity = 1.

?- spec_types($Spec, Types).
Types = [text].

?- check.
Warning: foo.pl:6:4:
    In goal: format("~ oops",[_G3495])
    Invalid format string: "~ oops"
Warning: foo.pl:7:4:
    In goal: format("hi",[superfluous])
    Wrong argument count. Expected 0, got 1
Warning: foo.pl:9:4:
    In goal: debug(something,"Worth $~f",[nothing])
    Type error: `float' expected, found `nothing' (an atom)

Description

Parse, analyze and check your format/2 strings. In SWI Prolog 7.1.5 or later, load this module and run check/0 to check your code for common format string errors. If you only want the check/0 integration, load the module with

:- use_module(library(format_spec), [])).

See Synopsis above for examples.

Changes in this Version

  • Initial public release

Installation

Using SWI-Prolog 6.3 or later:

?- pack_install(format_spec).

This module uses semantic versioning.

Source code available and pull requests accepted at http://github.com/mndrix/format_spec

author
- Michael Hendricks <michael@ndrix.org>
license
- BSD

Contents of pack "format_spec"

Pack contains 5 files holding a total of 10.3K bytes.