Restructure the project to match new modular layout.
@@ -0,0 +1,44 @@
|
||||
# Copyright Redshift Software, Inc. 2011
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
using quickbook ;
|
||||
import path ;
|
||||
|
||||
if ! $(BOOST_ROOT)
|
||||
{
|
||||
BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
|
||||
}
|
||||
|
||||
local BOOST_PREDEF_HEADERS = [ path.glob-tree $(BOOST_PREDEF_ROOT)/include/boost/predef : *.h ] ;
|
||||
|
||||
xml predef
|
||||
:
|
||||
predef.qbk
|
||||
:
|
||||
<dependency>$(BOOST_PREDEF_ROOT)/include/boost/predef.h
|
||||
<dependency>$(BOOST_PREDEF_HEADERS)
|
||||
;
|
||||
explicit predef ;
|
||||
|
||||
boostbook standalone
|
||||
:
|
||||
predef
|
||||
:
|
||||
<xsl:param>boost.root=../../..
|
||||
#<xsl:param>generate.section.toc.level=3
|
||||
<xsl:param>chunk.section.depth=1
|
||||
<xsl:param>chunk.first.sections=1
|
||||
|
||||
<dependency>images
|
||||
<dependency>callouts
|
||||
<dependency>css
|
||||
;
|
||||
|
||||
install images : [ glob $(BOOST_ROOT)/doc/src/images/*.png ] : <location>html/images ;
|
||||
explicit images ;
|
||||
install callouts : [ glob $(BOOST_ROOT)/doc/src/images/callouts/*.png ] : <location>html/images/callouts ;
|
||||
explicit callouts ;
|
||||
install css : [ glob $(BOOST_ROOT)/doc/src/*.css ] : <location>html ;
|
||||
explicit css ;
|
||||
@@ -0,0 +1,646 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2004 Joel de Guzman
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||
ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
|
||||
/*=============================================================================
|
||||
Body defaults
|
||||
=============================================================================*/
|
||||
|
||||
body
|
||||
{
|
||||
margin: 1em;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Paragraphs
|
||||
=============================================================================*/
|
||||
|
||||
p
|
||||
{
|
||||
text-align: left;
|
||||
font-size: 10pt;
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Program listings
|
||||
=============================================================================*/
|
||||
|
||||
/* Code on paragraphs */
|
||||
p tt.computeroutput
|
||||
{
|
||||
font-size: 9pt;
|
||||
}
|
||||
|
||||
pre.synopsis
|
||||
{
|
||||
font-size: 9pt;
|
||||
margin: 1pc 4% 0pc 4%;
|
||||
padding: 0.5pc 0.5pc 0.5pc 0.5pc;
|
||||
}
|
||||
|
||||
.programlisting,
|
||||
.screen
|
||||
{
|
||||
font-size: 9pt;
|
||||
display: block;
|
||||
margin: 1pc 4% 0pc 4%;
|
||||
padding: 0.5pc 0.5pc 0.5pc 0.5pc;
|
||||
}
|
||||
|
||||
/* Program listings in tables don't get borders */
|
||||
td .programlisting,
|
||||
td .screen
|
||||
{
|
||||
margin: 0pc 0pc 0pc 0pc;
|
||||
padding: 0pc 0pc 0pc 0pc;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Headings
|
||||
=============================================================================*/
|
||||
|
||||
h1, h2, h3, h4, h5, h6
|
||||
{
|
||||
text-align: left;
|
||||
margin: 1em 0em 0.5em 0em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h1 { font-size: 140%; }
|
||||
h2 { font-weight: bold; font-size: 140%; }
|
||||
h3 { font-weight: bold; font-size: 130%; }
|
||||
h4 { font-weight: bold; font-size: 120%; }
|
||||
h5 { font-weight: normal; font-style: italic; font-size: 110%; }
|
||||
h6 { font-weight: normal; font-style: italic; font-size: 100%; }
|
||||
|
||||
/* Top page titles */
|
||||
title,
|
||||
h1.title,
|
||||
h2.title
|
||||
h3.title,
|
||||
h4.title,
|
||||
h5.title,
|
||||
h6.title,
|
||||
.refentrytitle
|
||||
{
|
||||
font-weight: bold;
|
||||
margin-bottom: 1pc;
|
||||
}
|
||||
|
||||
h1.title { font-size: 140% }
|
||||
h2.title { font-size: 140% }
|
||||
h3.title { font-size: 130% }
|
||||
h4.title { font-size: 120% }
|
||||
h5.title { font-size: 110% }
|
||||
h6.title { font-size: 100% }
|
||||
|
||||
.section h1
|
||||
{
|
||||
margin: 0em 0em 0.5em 0em;
|
||||
font-size: 140%;
|
||||
}
|
||||
|
||||
.section h2 { font-size: 140% }
|
||||
.section h3 { font-size: 130% }
|
||||
.section h4 { font-size: 120% }
|
||||
.section h5 { font-size: 110% }
|
||||
.section h6 { font-size: 100% }
|
||||
|
||||
/* Code on titles */
|
||||
h1 tt.computeroutput { font-size: 140% }
|
||||
h2 tt.computeroutput { font-size: 140% }
|
||||
h3 tt.computeroutput { font-size: 130% }
|
||||
h4 tt.computeroutput { font-size: 130% }
|
||||
h5 tt.computeroutput { font-size: 130% }
|
||||
h6 tt.computeroutput { font-size: 130% }
|
||||
|
||||
|
||||
/*=============================================================================
|
||||
Author
|
||||
=============================================================================*/
|
||||
|
||||
h3.author
|
||||
{
|
||||
font-size: 100%
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Lists
|
||||
=============================================================================*/
|
||||
|
||||
li
|
||||
{
|
||||
font-size: 10pt;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
/* Unordered lists */
|
||||
ul
|
||||
{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* Ordered lists */
|
||||
ol
|
||||
{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Links
|
||||
=============================================================================*/
|
||||
|
||||
a
|
||||
{
|
||||
text-decoration: none; /* no underline */
|
||||
}
|
||||
|
||||
a:hover
|
||||
{
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Spirit style navigation
|
||||
=============================================================================*/
|
||||
|
||||
.spirit-nav
|
||||
{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.spirit-nav a
|
||||
{
|
||||
color: white;
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
|
||||
.spirit-nav img
|
||||
{
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Copyright footer
|
||||
=============================================================================*/
|
||||
.copyright-footer
|
||||
{
|
||||
text-align: right;
|
||||
font-size: 70%;
|
||||
}
|
||||
|
||||
.copyright-footer p
|
||||
{
|
||||
text-align: right;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Table of contents
|
||||
=============================================================================*/
|
||||
|
||||
.toc
|
||||
{
|
||||
margin: 1pc 4% 0pc 4%;
|
||||
padding: 0.1pc 1pc 0.1pc 1pc;
|
||||
font-size: 80%;
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
.boost-toc
|
||||
{
|
||||
float: right;
|
||||
padding: 0.5pc;
|
||||
}
|
||||
|
||||
/* Code on toc */
|
||||
.toc .computeroutput { font-size: 120% }
|
||||
|
||||
/* No margin on nested menus */
|
||||
|
||||
.toc dl dl { margin: 0; }
|
||||
|
||||
/*=============================================================================
|
||||
Tables
|
||||
=============================================================================*/
|
||||
|
||||
.table-title,
|
||||
div.table p.title
|
||||
{
|
||||
margin-left: 4%;
|
||||
padding-right: 0.5em;
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
|
||||
.informaltable table,
|
||||
.table table
|
||||
{
|
||||
width: 92%;
|
||||
margin-left: 4%;
|
||||
margin-right: 4%;
|
||||
}
|
||||
|
||||
div.informaltable table,
|
||||
div.table table
|
||||
{
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
/* Table Cells */
|
||||
div.informaltable table tr td,
|
||||
div.table table tr td
|
||||
{
|
||||
padding: 0.5em;
|
||||
text-align: left;
|
||||
font-size: 9pt;
|
||||
}
|
||||
|
||||
div.informaltable table tr th,
|
||||
div.table table tr th
|
||||
{
|
||||
padding: 0.5em 0.5em 0.5em 0.5em;
|
||||
border: 1pt solid white;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
table.simplelist
|
||||
{
|
||||
width: auto !important;
|
||||
margin: 0em !important;
|
||||
padding: 0em !important;
|
||||
border: none !important;
|
||||
}
|
||||
table.simplelist td
|
||||
{
|
||||
margin: 0em !important;
|
||||
padding: 0em !important;
|
||||
text-align: left !important;
|
||||
font-size: 9pt !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Blurbs
|
||||
=============================================================================*/
|
||||
|
||||
div.note,
|
||||
div.tip,
|
||||
div.important,
|
||||
div.caution,
|
||||
div.warning,
|
||||
p.blurb
|
||||
{
|
||||
font-size: 9pt; /* A little bit smaller than the main text */
|
||||
line-height: 1.2;
|
||||
display: block;
|
||||
margin: 1pc 4% 0pc 4%;
|
||||
padding: 0.5pc 0.5pc 0.5pc 0.5pc;
|
||||
}
|
||||
|
||||
p.blurb img
|
||||
{
|
||||
padding: 1pt;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Variable Lists
|
||||
=============================================================================*/
|
||||
|
||||
div.variablelist
|
||||
{
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
/* Make the terms in definition lists bold */
|
||||
div.variablelist dl dt,
|
||||
span.term
|
||||
{
|
||||
font-weight: bold;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
div.variablelist table tbody tr td
|
||||
{
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
padding: 0em 2em 0em 0em;
|
||||
font-size: 10pt;
|
||||
margin: 0em 0em 0.5em 0em;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
div.variablelist dl dt
|
||||
{
|
||||
margin-bottom: 0.2em;
|
||||
}
|
||||
|
||||
div.variablelist dl dd
|
||||
{
|
||||
margin: 0em 0em 0.5em 2em;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
div.variablelist table tbody tr td p,
|
||||
div.variablelist dl dd p
|
||||
{
|
||||
margin: 0em 0em 0.5em 0em;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Misc
|
||||
=============================================================================*/
|
||||
|
||||
/* Title of books and articles in bibliographies */
|
||||
span.title
|
||||
{
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
span.underline
|
||||
{
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
span.strikethrough
|
||||
{
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
/* Copyright, Legal Notice */
|
||||
div div.legalnotice p
|
||||
{
|
||||
text-align: left
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Colors
|
||||
=============================================================================*/
|
||||
|
||||
@media screen
|
||||
{
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* Syntax Highlighting */
|
||||
.keyword { color: #0000AA; }
|
||||
.identifier { color: #000000; }
|
||||
.special { color: #707070; }
|
||||
.preprocessor { color: #402080; }
|
||||
.char { color: teal; }
|
||||
.comment { color: #800000; }
|
||||
.string { color: teal; }
|
||||
.number { color: teal; }
|
||||
.white_bkd { background-color: #FFFFFF; }
|
||||
.dk_grey_bkd { background-color: #999999; }
|
||||
|
||||
/* Links */
|
||||
a, a .keyword, a .identifier, a .special, a .preprocessor
|
||||
a .char, a .comment, a .string, a .number
|
||||
{
|
||||
color: #005a9c;
|
||||
}
|
||||
|
||||
a:visited, a:visited .keyword, a:visited .identifier,
|
||||
a:visited .special, a:visited .preprocessor a:visited .char,
|
||||
a:visited .comment, a:visited .string, a:visited .number
|
||||
{
|
||||
color: #9c5a9c;
|
||||
}
|
||||
|
||||
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a,
|
||||
h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover,
|
||||
h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited
|
||||
{
|
||||
text-decoration: none; /* no underline */
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* Copyright, Legal Notice */
|
||||
.copyright
|
||||
{
|
||||
color: #666666;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
div div.legalnotice p
|
||||
{
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
/* Program listing */
|
||||
pre.synopsis
|
||||
{
|
||||
border: 1px solid #DCDCDC;
|
||||
}
|
||||
|
||||
.programlisting,
|
||||
.screen
|
||||
{
|
||||
border: 1px solid #DCDCDC;
|
||||
}
|
||||
|
||||
td .programlisting,
|
||||
td .screen
|
||||
{
|
||||
border: 0px solid #DCDCDC;
|
||||
}
|
||||
|
||||
/* Blurbs */
|
||||
div.note,
|
||||
div.tip,
|
||||
div.important,
|
||||
div.caution,
|
||||
div.warning,
|
||||
p.blurb
|
||||
{
|
||||
border: 1px solid #DCDCDC;
|
||||
}
|
||||
|
||||
/* Table of contents */
|
||||
.toc
|
||||
{
|
||||
border: 1px solid #DCDCDC;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
div.informaltable table tr td,
|
||||
div.table table tr td
|
||||
{
|
||||
border: 1px solid #DCDCDC;
|
||||
}
|
||||
|
||||
div.informaltable table tr th,
|
||||
div.table table tr th
|
||||
{
|
||||
background-color: #F0F0F0;
|
||||
border: 1px solid #DCDCDC;
|
||||
}
|
||||
|
||||
.copyright-footer
|
||||
{
|
||||
color: #8F8F8F;
|
||||
}
|
||||
|
||||
/* Misc */
|
||||
span.highlight
|
||||
{
|
||||
color: #00A000;
|
||||
}
|
||||
}
|
||||
|
||||
@media print
|
||||
{
|
||||
/* Links */
|
||||
a
|
||||
{
|
||||
color: black;
|
||||
}
|
||||
|
||||
a:visited
|
||||
{
|
||||
color: black;
|
||||
}
|
||||
|
||||
.spirit-nav
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Program listing */
|
||||
pre.synopsis
|
||||
{
|
||||
border: 1px solid gray;
|
||||
}
|
||||
|
||||
.programlisting,
|
||||
.screen
|
||||
{
|
||||
border: 1px solid gray;
|
||||
}
|
||||
|
||||
td .programlisting,
|
||||
td .screen
|
||||
{
|
||||
border: 0px solid #DCDCDC;
|
||||
}
|
||||
|
||||
/* Table of contents */
|
||||
.toc
|
||||
{
|
||||
border: 1px solid gray;
|
||||
}
|
||||
|
||||
.informaltable table,
|
||||
.table table
|
||||
{
|
||||
border: 1px solid gray;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
div.informaltable table tr td,
|
||||
div.table table tr td
|
||||
{
|
||||
border: 1px solid gray;
|
||||
}
|
||||
|
||||
div.informaltable table tr th,
|
||||
div.table table tr th
|
||||
{
|
||||
border: 1px solid gray;
|
||||
}
|
||||
|
||||
table.simplelist tr td
|
||||
{
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
/* Misc */
|
||||
span.highlight
|
||||
{
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Images
|
||||
=============================================================================*/
|
||||
|
||||
span.inlinemediaobject img
|
||||
{
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/*==============================================================================
|
||||
Super and Subscript: style so that line spacing isn't effected, see
|
||||
http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=1&postId=5341
|
||||
==============================================================================*/
|
||||
|
||||
sup,
|
||||
sub {
|
||||
height: 0;
|
||||
line-height: 1;
|
||||
vertical-align: baseline;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
/* For internet explorer: */
|
||||
|
||||
* html sup,
|
||||
* html sub {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
sup {
|
||||
bottom: 1ex;
|
||||
}
|
||||
|
||||
sub {
|
||||
top: .5ex;
|
||||
}
|
||||
|
||||
/*==============================================================================
|
||||
Indexes: pretty much the same as the TOC.
|
||||
==============================================================================*/
|
||||
|
||||
.index
|
||||
{
|
||||
font-size: 80%;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
.index ul
|
||||
{
|
||||
padding-left: 3em;
|
||||
}
|
||||
|
||||
.index p
|
||||
{
|
||||
padding: 2px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.index-entry-level-0
|
||||
{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.index em
|
||||
{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger@python.org
|
||||
:Date: $Date: 2007-04-16 23:44:59 -0500 (Mon, 16 Apr 2007) $
|
||||
:Revision: $Revision: 37457 $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th {
|
||||
border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first {
|
||||
/* Override more specific margin styles with "! important". */
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last, .with-subtitle {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dl.docutils dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||
dl.docutils dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
clear: both;
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin-left: 1em ;
|
||||
border: medium outset ;
|
||||
padding: 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr.docutils {
|
||||
width: 75% }
|
||||
|
||||
img.align-left {
|
||||
clear: left }
|
||||
|
||||
img.align-right {
|
||||
clear: right }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font-family: serif ;
|
||||
font-size: 100% }
|
||||
|
||||
pre.literal-block, pre.doctest-block {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option {
|
||||
white-space: nowrap }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.docutils {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid 1px black;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap ;
|
||||
padding-left: 0 }
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||
font-size: 100% }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
After Width: | Height: | Size: 603 B |
|
After Width: | Height: | Size: 374 B |
|
After Width: | Height: | Size: 391 B |
|
After Width: | Height: | Size: 485 B |
|
After Width: | Height: | Size: 410 B |
|
After Width: | Height: | Size: 488 B |
|
After Width: | Height: | Size: 509 B |
|
After Width: | Height: | Size: 499 B |
|
After Width: | Height: | Size: 507 B |
|
After Width: | Height: | Size: 446 B |
|
After Width: | Height: | Size: 431 B |
|
After Width: | Height: | Size: 441 B |
|
After Width: | Height: | Size: 423 B |
|
After Width: | Height: | Size: 431 B |
|
After Width: | Height: | Size: 397 B |
|
After Width: | Height: | Size: 434 B |
|
After Width: | Height: | Size: 420 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 358 B |
|
After Width: | Height: | Size: 722 B |
|
After Width: | Height: | Size: 336 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 490 B |
|
After Width: | Height: | Size: 334 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 867 B |
|
After Width: | Height: | Size: 449 B |
|
After Width: | Height: | Size: 318 B |
|
After Width: | Height: | Size: 259 B |
|
After Width: | Height: | Size: 264 B |
|
After Width: | Height: | Size: 370 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,67 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Predef 1.0</title>
|
||||
<link rel="stylesheet" href="boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<link rel="home" href="index.html" title="Predef 1.0">
|
||||
<link rel="next" href="predef/introduction.html" title="Introduction">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="spirit-nav"><a accesskey="n" href="predef/introduction.html"><img src="images/next.png" alt="Next"></a></div>
|
||||
<div class="article">
|
||||
<div class="titlepage">
|
||||
<div>
|
||||
<div><h2 class="title">
|
||||
<a name="predef"></a>Predef 1.0</h2></div>
|
||||
<div><div class="authorgroup"><div class="author"><h3 class="author">
|
||||
<span class="firstname">Rene</span> <span class="surname">Rivera</span>
|
||||
</h3></div></div></div>
|
||||
<div><p class="copyright">Copyright © 2005 Rene Rivera</p></div>
|
||||
<div><p class="copyright">Copyright © 2008-2011 Redshift
|
||||
Software Inc</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="predef.legal"></a><p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="toc">
|
||||
<p><b>Table of Contents</b></p>
|
||||
<dl>
|
||||
<dt><span class="section"><a href="predef/introduction.html">Introduction</a></span></dt>
|
||||
<dt><span class="section"><a href="predef/using_the_predefs.html">Using the predefs</a></span></dt>
|
||||
<dt><span class="section"><a href="predef/adding_new_predefs.html">Adding new predefs</a></span></dt>
|
||||
<dt><span class="section"><a href="predef/reference.html">Reference</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="predef/reference.html#predef.reference.boost_arch_architecture_macros"><code class="computeroutput"><span class="identifier">BOOST_ARCH</span></code> architecture macros</a></span></dt>
|
||||
<dt><span class="section"><a href="predef/reference.html#predef.reference.boost_comp_compiler_macros"><code class="computeroutput"><span class="identifier">BOOST_COMP</span></code> compiler macros</a></span></dt>
|
||||
<dt><span class="section"><a href="predef/reference.html#predef.reference.boost_lang_language_standards_ma"><code class="computeroutput"><span class="identifier">BOOST_LANG</span></code> language standards macros</a></span></dt>
|
||||
<dt><span class="section"><a href="predef/reference.html#predef.reference.boost_lib_library_macros"><code class="computeroutput"><span class="identifier">BOOST_LIB</span></code> library macros</a></span></dt>
|
||||
<dt><span class="section"><a href="predef/reference.html#predef.reference.boost_os_operating_system_macros"><code class="computeroutput"><span class="identifier">BOOST_OS_</span></code> operating system macros</a></span></dt>
|
||||
<dt><span class="section"><a href="predef/reference.html#predef.reference.version_definition_macros">Version definition
|
||||
macros</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="warning"><table border="0" summary="Warning">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td>
|
||||
<th align="left">Warning</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>
|
||||
This is a <span class="bold"><strong>proposed</strong></span> Boost Libnrary and <span class="bold"><strong>is not</strong></span> part of the Boost C++ Libraries.
|
||||
</p></td></tr>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: July 13, 2012 at 13:52:32 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav"><a accesskey="n" href="predef/introduction.html"><img src="images/next.png" alt="Next"></a></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
|
||||
© Copyright Beman Dawes, 2007
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
See www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
*/
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 1em;
|
||||
max-width : 8.5in;
|
||||
}
|
||||
|
||||
table { margin: 0.5em; }
|
||||
|
||||
pre { background-color:#D7EEFF }
|
||||
|
||||
ins { background-color:#A0FFA0 }
|
||||
del { background-color:#FFA0A0 }
|
||||
|
||||
/*** end ***/
|
||||
@@ -0,0 +1,190 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Adding new predefs</title>
|
||||
<link rel="stylesheet" href="../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<link rel="home" href="../index.html" title="Predef 1.0">
|
||||
<link rel="up" href="../index.html" title="Predef 1.0">
|
||||
<link rel="prev" href="using_the_predefs.html" title="Using the predefs">
|
||||
<link rel="next" href="reference.html" title="Reference">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="using_the_predefs.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section predef_adding_new_predefs">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="predef.adding_new_predefs"></a><a class="link" href="adding_new_predefs.html" title="Adding new predefs">Adding new predefs</a>
|
||||
</h2></div></div></div>
|
||||
<p>
|
||||
We know that a library like this one will be an eternal work-in-progress. And
|
||||
as such we expect, and look forward to, others contributing corrections and
|
||||
additions to the predefs. With that in mind we need to keep a consistent way
|
||||
of defining the new predefs. Hence all current, and future, predefs follow
|
||||
the same structure and requirements.
|
||||
</p>
|
||||
<h4>
|
||||
<a name="predef.adding_new_predefs.h0"></a>
|
||||
<span><a name="predef.adding_new_predefs.requirements_of_the_header"></a></span><a class="link" href="adding_new_predefs.html#predef.adding_new_predefs.requirements_of_the_header">Requirements
|
||||
of the header</a>
|
||||
</h4>
|
||||
<p>
|
||||
All predefs need to follow a set of requirements:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The headers must use the Boost Software License.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The predef must, by default, be defined as <code class="computeroutput"><span class="identifier">BOOST_VERSION_NUMBER</span><span class="special">(</span><span class="number">0</span><span class="special">,</span><span class="number">0</span><span class="special">,</span><span class="number">0</span><span class="special">)</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The predef must be redefined to a non-zero value once detected.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The predef must, by default, be defined to <code class="computeroutput"><span class="identifier">BOOST_VERSION_NUMBER</span><span class="special">(</span><span class="number">0</span><span class="special">,</span><span class="number">0</span><span class="special">,</span><span class="number">1</span><span class="special">)</span></code> when the predef is detected.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
If possible, the predef will be defined as the version number detected.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The predef must declare itself, after being defined, for the testing system.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
And there are some extra guidelines that predef headers should follow:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The detection should avoid including extra headers that might otherwise
|
||||
not be included by default.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
If the detection must include a header, prefer guarding it within the detection
|
||||
if possible.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
If the detection must include headers unconditionally, and has a choice
|
||||
of headers to include, prefer the ones with the least impact. I.e. include
|
||||
the one with the minimal set of definitions and other dependencies.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h4>
|
||||
<a name="predef.adding_new_predefs.h1"></a>
|
||||
<span><a name="predef.adding_new_predefs.structure_of_the_header"></a></span><a class="link" href="adding_new_predefs.html#predef.adding_new_predefs.structure_of_the_header">Structure
|
||||
of the header</a>
|
||||
</h4>
|
||||
<p>
|
||||
For general consistency it's suggested that new predef headers follow the structure
|
||||
below, as current predef headers do. First we have the copyright and license
|
||||
statement, followed by the include guard:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="comment">/*
|
||||
Copyright Jane Doe YYYY
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/</span>
|
||||
|
||||
<span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_PREDEF_category_tag_H</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">BOOST_PREDEF_category_tag_H</span>
|
||||
</pre>
|
||||
<p>
|
||||
Depending on how you are defining the predef you will at minimum have to include
|
||||
the <code class="computeroutput"><span class="identifier">version_number</span><span class="special">.</span><span class="identifier">h</span></code> header. But you might also want to include
|
||||
the <code class="computeroutput"><span class="identifier">make</span><span class="special">.</span><span class="identifier">h</span></code> header for the version number decomposing
|
||||
utility macros:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">predef</span><span class="special">/</span><span class="identifier">version_number</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">predef</span><span class="special">/</span><span class="identifier">make</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span>
|
||||
</pre>
|
||||
<p>
|
||||
The Predef library uses Quickbook for documentation and for the individual
|
||||
predefs to appear in the reference section we add in-code documentation followed
|
||||
by the zero-value default definition of the predef macro. We strongly recommend
|
||||
this particular placement of the documentation and default definition because
|
||||
some development environments automatically interpret this and provide in-line
|
||||
help for the macro. In particular this works for the popular Eclipse IDE:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="comment">/*`
|
||||
[heading `BOOST_category_tag`]
|
||||
|
||||
Documentation about what is detected.
|
||||
*/</span>
|
||||
|
||||
<span class="preprocessor">#define</span> <span class="identifier">BOOST_category_tag</span> <span class="identifier">BOOST_VERSION_NUMBER</span><span class="special">(</span><span class="number">0</span><span class="special">,</span><span class="number">0</span><span class="special">,</span><span class="number">0</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
Next is the detection and definition of the particular predef. The structure
|
||||
for this is to do a single overall check (<code class="computeroutput"><span class="identifier">condition_a</span></code>)
|
||||
and place further version detection inside this. The first action inside the
|
||||
overall check is to "<code class="computeroutput"><span class="preprocessor">#undef</span>
|
||||
<span class="identifier">BOOST_category_tag</span></code>" which undefines
|
||||
the zero-value default. The rest is up to the you how to do the checks for
|
||||
defining the version. But at minimum it must "<code class="computeroutput"><span class="preprocessor">#define</span>
|
||||
<span class="identifier">BOOST_category_tag</span> <span class="identifier">BOOST_VERSION_NUMBER</span><span class="special">(</span><span class="number">0</span><span class="special">,</span><span class="number">0</span><span class="special">,</span><span class="number">1</span><span class="special">)</span></code>" as the fallback to minimally indicate
|
||||
that the predef was detected:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#if</span> <span class="special">(</span><span class="identifier">condition_a</span><span class="special">)</span>
|
||||
<span class="preprocessor">#undef</span> <span class="identifier">BOOST_category_tag</span>
|
||||
<span class="preprocessor">#if</span> <span class="special">(</span><span class="identifier">condition_b</span><span class="special">)</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">BOOST_category_tag</span> <span class="identifier">BOOST_VERSION_NUMBER</span><span class="special">(</span><span class="identifier">major</span><span class="special">,</span><span class="identifier">minor</span><span class="special">,</span><span class="identifier">patch</span><span class="special">)</span>
|
||||
<span class="preprocessor">#else</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">BOOST_category_tag</span> <span class="identifier">BOOST_VERSION_NUMBER</span><span class="special">(</span><span class="number">0</span><span class="special">,</span><span class="number">0</span><span class="special">,</span><span class="number">1</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>
|
||||
The testing of the predef macros is automated to generate checks for all the
|
||||
defined predefs, whether detected or not. To do this we need to declare the
|
||||
predef to the test system. This declaration is empty for regular use. And during
|
||||
the test programs they expand out specially to create informational output:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">predef</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">test</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span>
|
||||
<span class="identifier">BOOST_PREDEF_DECLARE_TEST</span><span class="special">(</span><span class="identifier">BOOST_category_tag</span><span class="special">,</span><span class="string">"Name"</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
And, of course, we last need to close out the include guard:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<h4>
|
||||
<a name="predef.adding_new_predefs.h2"></a>
|
||||
<span><a name="predef.adding_new_predefs.using_utility_pattern_macros"></a></span><a class="link" href="adding_new_predefs.html#predef.adding_new_predefs.using_utility_pattern_macros">Using utility
|
||||
pattern macros</a>
|
||||
</h4>
|
||||
<p>
|
||||
By including:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">predef</span><span class="special">/</span><span class="identifier">make</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span>
|
||||
</pre>
|
||||
<p>
|
||||
One will get a set of utlity macros to decompose common version macros as defined
|
||||
by compilers. For example the EDG compiler uses a simple 3-digit version macro
|
||||
(M,N,P). It can be decomesed and defined as:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_CXX_EDG</span> <span class="identifier">BOOST_PREDEF_MAKE_N_N_N</span><span class="special">(</span><span class="identifier">__EDG_VERSION__</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
The decomposition macros are split into three types: decimal decomposition,
|
||||
hexadecimal decomposition, and date decomposition. They follow the format of
|
||||
using "N" for decimal, "F" for hexadecimal, and "Y",
|
||||
"M", "D" for dates.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2005 Rene Rivera<br>Copyright © 2008-2011 Redshift
|
||||
Software Inc<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="using_the_predefs.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,195 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Introduction</title>
|
||||
<link rel="stylesheet" href="../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<link rel="home" href="../index.html" title="Predef 1.0">
|
||||
<link rel="up" href="../index.html" title="Predef 1.0">
|
||||
<link rel="prev" href="../index.html" title="Predef 1.0">
|
||||
<link rel="next" href="using_the_predefs.html" title="Using the predefs">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../index.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="using_the_predefs.html"><img src="../images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section predef_introduction">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="predef.introduction"></a><a class="link" href="introduction.html" title="Introduction">Introduction</a>
|
||||
</h2></div></div></div>
|
||||
<p>
|
||||
This library defines a set of compiler, architecture, operating system, and
|
||||
library version numbers from the information it can gather of C++ predefined
|
||||
macros or those defined in generally available headers. The idea for this library
|
||||
grew out of a proposal to extend the Boost Config library to provide more,
|
||||
and consistent, information than the feature definitions it supports. What
|
||||
follows is an edited version of that brief proposal.
|
||||
</p>
|
||||
<h4>
|
||||
<a name="predef.introduction.h0"></a>
|
||||
<span><a name="predef.introduction.proposal"></a></span><a class="link" href="introduction.html#predef.introduction.proposal">Proposal</a>
|
||||
</h4>
|
||||
<p>
|
||||
The idea is to define a set of macros to identify compilers and consistently
|
||||
represent their version. This includes:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
A unique BOOST_VERSION_NUMBER(major,minor,patch) macro to specify version
|
||||
numbers (unfortunately, the name BOOST_VERSION is already taken to designate
|
||||
the version number of boost itself).
|
||||
</li>
|
||||
<li class="listitem">
|
||||
A compiler identification macro, suitable for use in <code class="computeroutput"><span class="preprocessor">#if</span></code>/<code class="computeroutput"><span class="preprocessor">#elif</span></code> directives, for each of the supported
|
||||
compilers. All macros would be defined, regardless of the compiler. The
|
||||
one macro corresponding to the compiler being used would be defined, in
|
||||
terms of BOOST_VERSION_NUMBER, to carry the exact compiler version. All
|
||||
other macros would expand to an expression evaluating to false (for instance,
|
||||
the token 0) to indicate that the corresponding compiler is not present.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
"Null values" could be set, for all macros, in boost/config/select_compiler.hpp;
|
||||
then, for each compiler the corresponding identification macro would be
|
||||
#undef and re-#defined in the corresponding boost/compiler/(cc).hpp; however
|
||||
in the context of the Boost.Config infrastructure using a "prefix"
|
||||
header (to be introduced) or boost/config/suffix.hpp is a better solution.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h4>
|
||||
<a name="predef.introduction.h1"></a>
|
||||
<span><a name="predef.introduction.current_library"></a></span><a class="link" href="introduction.html#predef.introduction.current_library">Current
|
||||
Library</a>
|
||||
</h4>
|
||||
<p>
|
||||
The current Predef library is now, both an independent library, and expanded
|
||||
in scope. It includes detection and definition of architectures, compilers,
|
||||
languages, libraries, and operating systems. The key benefits are:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Version numbers that are always defined so that one doesn't have to guard
|
||||
with <code class="computeroutput"><span class="preprocessor">#ifdef</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
All possible definitions are included with the single <code class="computeroutput"><span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">predef</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span></code>
|
||||
so that it's friendly to precompiled header usage.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Predefs can be directly used in both preprocessor and compiler expressions
|
||||
for comparison to other similarly defined values.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The headers are usable from multiple languages, that support the C preprocessor.
|
||||
In particular C++, C, Objective C, and Objective C++.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h4>
|
||||
<a name="predef.introduction.h2"></a>
|
||||
<span><a name="predef.introduction.design_choices"></a></span><a class="link" href="introduction.html#predef.introduction.design_choices">Design
|
||||
choices</a>
|
||||
</h4>
|
||||
<p>
|
||||
An important design choice concerns how to represent compiler versions by means
|
||||
of a single integer number suitable for use in preprocessing directives. Let's
|
||||
do some calculation. The "basic" signed type for preprocessing constant-expressions
|
||||
is long in C90 (and C++, as of 2006) and intmax_t in C99. The type long shall
|
||||
at least be able to represent the number <code class="literal">+2 147 483 647</code>.
|
||||
This means the most significant digit can only be 0, 1 or 2; and if we want
|
||||
all decimal digits to be able to vary between 0 and 9, the largest range we
|
||||
can consider is <code class="literal">[0, 999 999 999]</code>. Distributing evenly, this
|
||||
means 3 decimal digits for each version number part.
|
||||
</p>
|
||||
<p>
|
||||
So we can:
|
||||
</p>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
use an uneven distribution or
|
||||
</li>
|
||||
<li class="listitem">
|
||||
use more bits (a larger type) or
|
||||
</li>
|
||||
<li class="listitem">
|
||||
use 3/3/3 and have the particular compiler/platform/stdlib deal with setting
|
||||
the numbers within the 3-digit range.
|
||||
</li>
|
||||
</ol></div>
|
||||
<p>
|
||||
It appears relatively safe to go for the first option and set it at 2/2/5.
|
||||
That covers CodeWarrior and others, which are up to and past 10 for the major
|
||||
number. Some compilers use the build number in lieu of the patch one; five
|
||||
digits (which is already reached by VC++ 8) seems a reasonable limit even in
|
||||
this case.
|
||||
</p>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>
|
||||
A 2/2/6 scheme would allow for bigger patch/build numbers at the cost, for
|
||||
instance, of limiting the major version number to 20 (or, with further constraints,
|
||||
to 21).
|
||||
</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
It might reassure the reader that this decision is actually encoded in one
|
||||
place in the code; the definition of <code class="computeroutput"><span class="identifier">BOOST_VERSION_NUMBER</span></code>.
|
||||
</p>
|
||||
<h4>
|
||||
<a name="predef.introduction.h3"></a>
|
||||
<span><a name="predef.introduction.future_work"></a></span><a class="link" href="introduction.html#predef.introduction.future_work">Future
|
||||
work</a>
|
||||
</h4>
|
||||
<p>
|
||||
Even though the basics of this library are done, there is much work that can
|
||||
be done:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Right now we limit the detection of libraries to known built-in predefined
|
||||
macros, and to guaranteed to exist system and library headers. It might
|
||||
be interesting to add something like auto-configuration predefs. This way
|
||||
we can add definitions for user specific libraries and features.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Along with the above, it might be good to add some user control as to which
|
||||
headers are included with the top-level header.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Additionally, even if there is no auto-configure style option.. It would
|
||||
be good to add optionally included headers so that user can get consistent
|
||||
version number definitions for libraries they use.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Having a consistent set of version number definitions opens the door to
|
||||
improving the user level syntax of libraries that do checks against version
|
||||
numbers. Specifically Boost Config's <code class="computeroutput"><span class="identifier">BOOST_WORKAROUND</span></code>
|
||||
macro would benefit from a more readable syntax. As would the <code class="computeroutput"><span class="identifier">BOOST_TESTED_AT</span></code> detail macro.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
And obviously there's lots of work to do in reformulating the existing
|
||||
Boost libraries to use the Predef library once it's accepted.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
And there's the continuing work of adding definitions for present and future
|
||||
compilers, platforms, architectures, languages, and libraries.
|
||||
</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2005 Rene Rivera<br>Copyright © 2008-2011 Redshift
|
||||
Software Inc<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../index.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="using_the_predefs.html"><img src="../images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,188 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Using the predefs</title>
|
||||
<link rel="stylesheet" href="../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<link rel="home" href="../index.html" title="Predef 1.0">
|
||||
<link rel="up" href="../index.html" title="Predef 1.0">
|
||||
<link rel="prev" href="introduction.html" title="Introduction">
|
||||
<link rel="next" href="adding_new_predefs.html" title="Adding new predefs">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="introduction.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="adding_new_predefs.html"><img src="../images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section predef_using_the_predefs">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="predef.using_the_predefs"></a><a class="link" href="using_the_predefs.html" title="Using the predefs">Using the predefs</a>
|
||||
</h2></div></div></div>
|
||||
<p>
|
||||
To use the automatically defined predefs one needs to only include the single
|
||||
top-level header:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">predef</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span>
|
||||
</pre>
|
||||
<p>
|
||||
This defines <span class="bold"><strong>all</strong></span> the version macros known
|
||||
to the library. For each macro it will be defined to either a <span class="emphasis"><em>zero</em></span>
|
||||
valued expression for when the particular item is not detected, and to a <span class="emphasis"><em>positive</em></span>
|
||||
value if it is detected. The predef macros fall onto five categories each with
|
||||
macros of a particular prefix:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">BOOST_ARCHITECTURE_</span></code>for
|
||||
system/CPU architecture one is compiling for.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">BOOST_CXX_</span></code> for the compiler
|
||||
one is using.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">BOOST_LANGUAGE_</span></code> for language
|
||||
standards one is compiling against.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">BOOST_LIBC_</span></code> and <code class="computeroutput"><span class="identifier">BOOST_LIBSTD_</span></code> for the C and C++ standard
|
||||
library in use.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">BOOST_OS_</span></code> for the operating
|
||||
system we are compiling to.
|
||||
</li>
|
||||
</ul></div>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>
|
||||
The detected definitions are for the configuration one is targeting during
|
||||
the compile. In particular in a cross-compile this means the target system,
|
||||
and not the host system.
|
||||
</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
One uses the individual definitions to compare against specific versions by
|
||||
comparing against the <code class="computeroutput"><span class="identifier">BOOST_VERSION_NUMBER</span></code>
|
||||
macro. For example, to make a choice based on the version of the GCC C++ compiler
|
||||
one would:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">predef</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
|
||||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">BOOST_CXX_GNUC</span> <span class="special">>=</span> <span class="identifier">BOOST_VERSION_NUMBER</span><span class="special">(</span><span class="number">4</span><span class="special">,</span><span class="number">0</span><span class="special">,</span><span class="number">0</span><span class="special">))</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"GCC compiler is at least version 4.0.0"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"GCC compiler is at older than version 4.0.0, or not a GCC compiler"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
As you might notice above the <code class="computeroutput"><span class="keyword">else</span></code>
|
||||
clause also covers the case where the particular compiler is not detected.
|
||||
But one can make the test specifically test for the detection. All predef definitions
|
||||
are defined as a zero (0) expression when not detected. Hence one could use
|
||||
the detection with a natural single condition. For example:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">predef</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
|
||||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">BOOST_CXX_GNUC</span><span class="special">)</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"This is GNU GCC!"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Not GNU GCC."</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
And since the predef's are preprocessor definitions the same is possible from
|
||||
the preprocessor:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">predef</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
|
||||
<span class="preprocessor">#if</span> <span class="identifier">BOOST_CXX_GNUC</span>
|
||||
<span class="preprocessor">#if</span> <span class="identifier">BOOST_CXX_GNUC</span> <span class="special">>=</span> <span class="identifier">BOOST_VERSION_NUMBER</span><span class="special">(</span><span class="number">4</span><span class="special">,</span><span class="number">0</span><span class="special">,</span><span class="number">0</span><span class="special">)</span>
|
||||
<span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> <span class="identifier">the_compiler</span> <span class="special">=</span> <span class="string">"GNU GCC, of at least version 4."</span>
|
||||
<span class="preprocessor">#else</span>
|
||||
<span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> <span class="identifier">the_compiler</span> <span class="special">=</span> <span class="string">"GNU GCC, less than version 4."</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
<span class="preprocessor">#else</span>
|
||||
<span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> <span class="identifier">the_compiler</span> <span class="special">=</span> <span class="string">"Not GNU GCC."</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
|
||||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">the_compiler</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<h4>
|
||||
<a name="predef.using_the_predefs.h0"></a>
|
||||
<span><a name="predef.using_the_predefs.using_the_boost_version_number_m"></a></span><a class="link" href="using_the_predefs.html#predef.using_the_predefs.using_the_boost_version_number_m">Using the
|
||||
<code class="computeroutput"><span class="identifier">BOOST_VERSION_NUMBER</span></code> macro</a>
|
||||
</h4>
|
||||
<p>
|
||||
All the predefs are defined to be a use of the <code class="computeroutput"><span class="identifier">BOOST_VERSION_NUMBER</span></code>
|
||||
macro. The macro takes individual major, minor, and patch value expressions:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_VERSION_NUMBER</span><span class="special">(</span> <span class="identifier">major</span><span class="special">,</span> <span class="identifier">minor</span><span class="special">,</span> <span class="identifier">patch</span> <span class="special">)</span> <span class="special">...</span>
|
||||
</pre>
|
||||
<p>
|
||||
The arguments are:
|
||||
</p>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
Major version number, as a constant value expression in the range [0,99].
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Minor version number, as a constant value expression in the range [0,99].
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Patch-level version number, as a constant value expression in the range
|
||||
[0,99999].
|
||||
</li>
|
||||
</ol></div>
|
||||
<p>
|
||||
The ranges for each are "enforced" by the use of a modulo ("%"),
|
||||
i.e. truncation, as opposed to a clamp. And hence this means that the limits
|
||||
are enforced only enough to keep from having out-of-range problems. But not
|
||||
enough to prevent other kinds of problems. Like exceeding the range and getting
|
||||
false detections, or non-detections. It is up to the individual predefs to
|
||||
ensure correct usage beyond the range guarantee.
|
||||
</p>
|
||||
<p>
|
||||
The values for the arguments can be any preprocessor valid constant value expression.
|
||||
Only constant value arithmetic is used in the definition of the <code class="computeroutput"><span class="identifier">BOOST_VERSION_NUMBER</span></code> macro and in any of
|
||||
the other predef macros. This means that any allowed base is possible, i.e.
|
||||
binary, octal, decimal, and hexadecimal. For example:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">MY_APPLICATION_VERSION_NUMBER</span> <span class="identifier">BOOST_VERSION_NUMBER</span><span class="special">(</span><span class="number">2</span><span class="special">,</span><span class="number">0xA</span><span class="special">,</span><span class="number">015</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
Is equivalent to:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">MY_APPLICATION_VERSION_NUMBER</span> <span class="identifier">BOOST_VERSION_NUMBER</span><span class="special">(</span><span class="number">2</span><span class="special">,</span><span class="number">10</span><span class="special">,</span><span class="number">13</span><span class="special">)</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2005 Rene Rivera<br>Copyright © 2008-2011 Redshift
|
||||
Software Inc<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="introduction.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="adding_new_predefs.html"><img src="../images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
/*============================================================================
|
||||
Copyright 2003-2004 Douglas Gregor
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||
ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
============================================================================*/
|
||||
|
||||
PRE.synopsis {
|
||||
background-color: #e0ffff;
|
||||
border: thin solid blue;
|
||||
padding: 1em
|
||||
}
|
||||
@@ -0,0 +1,419 @@
|
||||
[article Predef
|
||||
[quickbook 1.7]
|
||||
[version 1.0]
|
||||
[authors [Rivera, Rene]]
|
||||
[copyright 2005 Rene Rivera, 2008-2011 Redshift Software Inc]
|
||||
[purpose Identification and specification of predefined macros.]
|
||||
[license
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
[@http://www.boost.org/LICENSE_1_0.txt])
|
||||
]
|
||||
[source-mode c++]
|
||||
]
|
||||
|
||||
[warning This is a *proposed* Boost Libnrary and *is not* part of the
|
||||
Boost C++ Libraries.]
|
||||
|
||||
[section Introduction]
|
||||
|
||||
This library defines a set of compiler, architecture, operating system,
|
||||
and library version numbers from the information it can gather of C++
|
||||
predefined macros or those defined in generally available headers. The
|
||||
idea for this library grew out of a proposal to extend the Boost Config
|
||||
library to provide more, and consistent, information than the feature
|
||||
definitions it supports. What follows is an edited version of that brief
|
||||
proposal.
|
||||
|
||||
[heading Proposal]
|
||||
|
||||
The idea is to define a set of macros to identify compilers and
|
||||
consistently represent their version. This includes:
|
||||
|
||||
* A unique BOOST_VERSION_NUMBER(major,minor,patch) macro to specify version
|
||||
numbers (unfortunately, the name BOOST_VERSION is already taken to designate
|
||||
the version number of boost itself).
|
||||
* A compiler identification macro, suitable for use in `#if`/`#elif` directives,
|
||||
for each of the supported compilers. All macros would be defined, regardless
|
||||
of the compiler. The one macro corresponding to the compiler being used would
|
||||
be defined, in terms of BOOST_VERSION_NUMBER, to carry the exact compiler
|
||||
version. All other macros would expand to an expression evaluating to false
|
||||
(for instance, the token 0) to indicate that the corresponding compiler is not
|
||||
present.
|
||||
* "Null values" could be set, for all macros, in
|
||||
boost/config/select_compiler.hpp; then, for each compiler the corresponding
|
||||
identification macro would be #undef and re-#defined in the corresponding
|
||||
boost/compiler/(cc).hpp; however in the context of the Boost.Config
|
||||
infrastructure using a "prefix" header (to be introduced) or
|
||||
boost/config/suffix.hpp is a better solution.
|
||||
|
||||
[heading Current Library]
|
||||
|
||||
The current Predef library is now, both an independent library, and expanded
|
||||
in scope. It includes detection and definition of architectures, compilers,
|
||||
languages, libraries, and operating systems. The key benefits are:
|
||||
|
||||
* Version numbers that are always defined so that one doesn't have to guard
|
||||
with `#ifdef`.
|
||||
* All possible definitions are included with the single `#include <boost/predef.h>`
|
||||
so that it's friendly to precompiled header usage.
|
||||
* Predefs can be directly used in both preprocessor and compiler expressions
|
||||
for comparison to other similarly defined values.
|
||||
* The headers are usable from multiple languages, that support the C preprocessor.
|
||||
In particular C++, C, Objective C, and Objective C++.
|
||||
|
||||
[heading Design choices]
|
||||
|
||||
An important design choice concerns how to represent compiler versions by means
|
||||
of a single integer number suitable for use in preprocessing directives. Let's
|
||||
do some calculation. The "basic" signed type for preprocessing
|
||||
constant-expressions is long in C90 (and C++, as of 2006) and intmax_t in C99.
|
||||
The type long shall at least be able to represent the number [^+2 147 483 647].
|
||||
This means the most significant digit can only be 0, 1 or 2; and if we want all
|
||||
decimal digits to be able to vary between 0 and 9, the largest range we can
|
||||
consider is [^\[0, 999 999 999\]]. Distributing evenly, this means 3 decimal
|
||||
digits for each version number part.
|
||||
|
||||
So we can:
|
||||
|
||||
# use an uneven distribution or
|
||||
# use more bits (a larger type) or
|
||||
# use 3/3/3 and have the particular compiler/platform/stdlib deal with setting
|
||||
the numbers within the 3-digit range.
|
||||
|
||||
It appears relatively safe to go for the first option and set it at 2/2/5. That
|
||||
covers CodeWarrior and others, which are up to and past 10 for the major number.
|
||||
Some compilers use the build number in lieu of the patch one; five digits
|
||||
(which is already reached by VC++ 8) seems a reasonable limit even in this case.
|
||||
|
||||
[note A 2/2/6 scheme would allow for bigger patch/build numbers at the cost,
|
||||
for instance, of limiting the major version number to 20 (or, with further
|
||||
constraints, to 21).]
|
||||
|
||||
It might reassure the reader that this decision is actually encoded in one place
|
||||
in the code; the definition of `BOOST_VERSION_NUMBER`.
|
||||
|
||||
[heading Future work]
|
||||
|
||||
Even though the basics of this library are done, there is much work that can be
|
||||
done:
|
||||
|
||||
* Right now we limit the detection of libraries to known built-in predefined
|
||||
macros, and to guaranteed to exist system and library headers. It might be
|
||||
interesting to add something like auto-configuration predefs. This way we can
|
||||
add definitions for user specific libraries and features.
|
||||
* Along with the above, it might be good to add some user control as to which
|
||||
headers are included with the top-level header.
|
||||
* Additionally, even if there is no auto-configure style option.. It would be
|
||||
good to add optionally included headers so that user can get consistent
|
||||
version number definitions for libraries they use.
|
||||
* Having a consistent set of version number definitions opens the door to
|
||||
improving the user level syntax of libraries that do checks against version
|
||||
numbers. Specifically Boost Config's `BOOST_WORKAROUND` macro would benefit
|
||||
from a more readable syntax. As would the `BOOST_TESTED_AT` detail macro.
|
||||
* And obviously there's lots of work to do in reformulating the existing
|
||||
Boost libraries to use the Predef library once it's accepted.
|
||||
* And there's the continuing work of adding definitions for present and
|
||||
future compilers, platforms, architectures, languages, and libraries.
|
||||
|
||||
[endsect] [/Introduction]
|
||||
|
||||
[section Using the predefs]
|
||||
|
||||
To use the automatically defined predefs one needs to only include the
|
||||
single top-level header:
|
||||
|
||||
``
|
||||
#include <boost/predef.h>
|
||||
``
|
||||
|
||||
This defines [*all] the version macros known to the library. For each
|
||||
macro it will be defined to either a /zero/ valued expression for when
|
||||
the particular item is not detected, and to a /positive/ value if it
|
||||
is detected. The predef macros fall onto five categories each with
|
||||
macros of a particular prefix:
|
||||
|
||||
* `BOOST_ARCHITECTURE_`for system/CPU architecture one is compiling for.
|
||||
* `BOOST_CXX_` for the compiler one is using.
|
||||
* `BOOST_LANGUAGE_` for language standards one is compiling against.
|
||||
* `BOOST_LIBC_` and `BOOST_LIBSTD_` for the C and C++ standard library
|
||||
in use.
|
||||
* `BOOST_OS_` for the operating system we are compiling to.
|
||||
|
||||
[note The detected definitions are for the configuration one is targeting
|
||||
during the compile. In particular in a cross-compile this means the target
|
||||
system, and not the host system.]
|
||||
|
||||
One uses the individual definitions to compare against specific versions
|
||||
by comparing against the `BOOST_VERSION_NUMBER` macro. For example, to make
|
||||
a choice based on the version of the GCC C++ compiler one would:
|
||||
|
||||
``
|
||||
#include <boost/predef.h>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
if (BOOST_CXX_GNUC >= BOOST_VERSION_NUMBER(4,0,0))
|
||||
std::cout << "GCC compiler is at least version 4.0.0" << std::endl;
|
||||
else
|
||||
std::cout << "GCC compiler is at older than version 4.0.0, or not a GCC compiler" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
As you might notice above the `else` clause also covers the case where
|
||||
the particular compiler is not detected. But one can make the test
|
||||
specifically test for the detection. All predef definitions are defined
|
||||
as a zero (0) expression when not detected. Hence one could use the
|
||||
detection with a natural single condition. For example:
|
||||
|
||||
``
|
||||
#include <boost/predef.h>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
if (BOOST_CXX_GNUC)
|
||||
std::cout << "This is GNU GCC!" << std::endl;
|
||||
else
|
||||
std::cout << "Not GNU GCC." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
And since the predef's are preprocessor definitions the same is possible
|
||||
from the preprocessor:
|
||||
|
||||
``
|
||||
#include <boost/predef.h>
|
||||
#include <iostream>
|
||||
|
||||
#if BOOST_CXX_GNUC
|
||||
#if BOOST_CXX_GNUC >= BOOST_VERSION_NUMBER(4,0,0)
|
||||
const char * the_compiler = "GNU GCC, of at least version 4."
|
||||
#else
|
||||
const char * the_compiler = "GNU GCC, less than version 4."
|
||||
#endif
|
||||
#else
|
||||
const char * the_compiler = "Not GNU GCC."
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << the_compiler << std::endl;
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
[heading Using the `BOOST_VERSION_NUMBER` macro]
|
||||
|
||||
All the predefs are defined to be a use of the `BOOST_VERSION_NUMBER` macro.
|
||||
The macro takes individual major, minor, and patch value expressions:
|
||||
|
||||
``
|
||||
#define BOOST_VERSION_NUMBER( major, minor, patch ) ...
|
||||
``
|
||||
|
||||
The arguments are:
|
||||
|
||||
# Major version number, as a constant value expression in the range [0,99].
|
||||
# Minor version number, as a constant value expression in the range [0,99].
|
||||
# Patch-level version number, as a constant value expression in the
|
||||
range [0,99999].
|
||||
|
||||
The ranges for each are "enforced" by the use of a modulo ("%"), i.e. truncation,
|
||||
as opposed to a clamp. And hence this means that the limits are enforced only
|
||||
enough to keep from having out-of-range problems. But not enough to prevent
|
||||
other kinds of problems. Like exceeding the range and getting false detections,
|
||||
or non-detections. It is up to the individual predefs to ensure correct
|
||||
usage beyond the range guarantee.
|
||||
|
||||
The values for the arguments can be any preprocessor valid constant value expression.
|
||||
Only constant value arithmetic is used in the definition of the `BOOST_VERSION_NUMBER`
|
||||
macro and in any of the other predef macros. This means that any allowed base is
|
||||
possible, i.e. binary, octal, decimal, and hexadecimal. For example:
|
||||
|
||||
``
|
||||
#define MY_APPLICATION_VERSION_NUMBER BOOST_VERSION_NUMBER(2,0xA,015)
|
||||
``
|
||||
|
||||
Is equivalent to:
|
||||
|
||||
``
|
||||
#define MY_APPLICATION_VERSION_NUMBER BOOST_VERSION_NUMBER(2,10,13)
|
||||
``
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Adding new predefs]
|
||||
|
||||
We know that a library like this one will be an eternal work-in-progress. And
|
||||
as such we expect, and look forward to, others contributing corrections and
|
||||
additions to the predefs. With that in mind we need to keep a consistent way
|
||||
of defining the new predefs. Hence all current, and future, predefs follow
|
||||
the same structure and requirements.
|
||||
|
||||
[heading Requirements of the header]
|
||||
|
||||
All predefs need to follow a set of requirements:
|
||||
|
||||
* The headers must use the Boost Software License.
|
||||
* The predef must, by default, be defined as `BOOST_VERSION_NUMBER(0,0,0)`.
|
||||
* The predef must be redefined to a non-zero value once detected.
|
||||
* The predef must, by default, be defined to `BOOST_VERSION_NUMBER(0,0,1)`
|
||||
when the predef is detected.
|
||||
* If possible, the predef will be defined as the version number detected.
|
||||
* The predef must declare itself, after being defined, for the testing
|
||||
system.
|
||||
|
||||
And there are some extra guidelines that predef headers should follow:
|
||||
|
||||
* The detection should avoid including extra headers that might otherwise
|
||||
not be included by default.
|
||||
* If the detection must include a header, prefer guarding it within the
|
||||
detection if possible.
|
||||
* If the detection must include headers unconditionally, and has a choice
|
||||
of headers to include, prefer the ones with the least impact. I.e.
|
||||
include the one with the minimal set of definitions and other
|
||||
dependencies.
|
||||
|
||||
[heading Structure of the header]
|
||||
|
||||
For general consistency it's suggested that new predef headers follow the
|
||||
structure below, as current predef headers do. First we have the copyright
|
||||
and license statement, followed by the include guard:
|
||||
|
||||
``
|
||||
/*
|
||||
Copyright Jane Doe YYYY
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_PREDEF_category_tag_H
|
||||
#define BOOST_PREDEF_category_tag_H
|
||||
``
|
||||
|
||||
Depending on how you are defining the predef you will at minimum have
|
||||
to include the `version_number.h` header. But you might also want to
|
||||
include the `make.h` header for the version number decomposing utility
|
||||
macros:
|
||||
|
||||
``
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
``
|
||||
|
||||
The Predef library uses Quickbook for documentation and for the
|
||||
individual predefs to appear in the reference section we add in-code
|
||||
documentation followed by the zero-value default definition of the
|
||||
predef macro. We strongly recommend this particular placement of the
|
||||
documentation and default definition because some development
|
||||
environments automatically interpret this and provide in-line help
|
||||
for the macro. In particular this works for the popular Eclipse IDE:
|
||||
|
||||
``
|
||||
/*`
|
||||
[heading `BOOST_category_tag`]
|
||||
|
||||
Documentation about what is detected.
|
||||
*/
|
||||
|
||||
#define BOOST_category_tag BOOST_VERSION_NUMBER(0,0,0)
|
||||
``
|
||||
|
||||
Next is the detection and definition of the particular predef. The
|
||||
structure for this is to do a single overall check (`condition_a`) and
|
||||
place further version detection inside this. The first action inside
|
||||
the overall check is to "`#undef BOOST_category_tag`" which undefines
|
||||
the zero-value default. The rest is up to the you how to do the checks
|
||||
for defining the version. But at minimum it must
|
||||
"`#define BOOST_category_tag BOOST_VERSION_NUMBER(0,0,1)`" as the fallback
|
||||
to minimally indicate that the predef was detected:
|
||||
|
||||
``
|
||||
#if (condition_a)
|
||||
#undef BOOST_category_tag
|
||||
#if (condition_b)
|
||||
#define BOOST_category_tag BOOST_VERSION_NUMBER(major,minor,patch)
|
||||
#else
|
||||
#define BOOST_category_tag BOOST_VERSION_NUMBER(0,0,1)
|
||||
#endif
|
||||
#endif
|
||||
``
|
||||
|
||||
The testing of the predef macros is automated to generate checks for all
|
||||
the defined predefs, whether detected or not. To do this we need to
|
||||
declare the predef to the test system. This declaration is empty for
|
||||
regular use. And during the test programs they expand out specially
|
||||
to create informational output:
|
||||
|
||||
``
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_category_tag,"Name")
|
||||
``
|
||||
|
||||
And, of course, we last need to close out the include guard:
|
||||
|
||||
``
|
||||
#endif
|
||||
``
|
||||
|
||||
[heading Using utility pattern macros]
|
||||
|
||||
By including:
|
||||
|
||||
``
|
||||
#include <boost/predef/make.h>
|
||||
``
|
||||
|
||||
One will get a set of utlity macros to decompose common version
|
||||
macros as defined by compilers. For example the EDG compiler
|
||||
uses a simple 3-digit version macro (M,N,P). It can be decomesed
|
||||
and defined as:
|
||||
|
||||
``
|
||||
#define BOOST_CXX_EDG BOOST_PREDEF_MAKE_N_N_N(__EDG_VERSION__)
|
||||
``
|
||||
|
||||
The decomposition macros are split into three types: decimal
|
||||
decomposition, hexadecimal decomposition, and date decomposition.
|
||||
They follow the format of using "N" for decimal, "F" for hexadecimal,
|
||||
and "Y", "M", "D" for dates.
|
||||
|
||||
[endsect]
|
||||
|
||||
[def __predef_symbol__ Symbol]
|
||||
[def __predef_version__ Version]
|
||||
[def __predef_detection__ *detection*]
|
||||
|
||||
[section Reference]
|
||||
|
||||
[section `BOOST_ARCH` architecture macros]
|
||||
[include ../../../boost/predef/architecture/*.h]
|
||||
[endsect]
|
||||
|
||||
[section `BOOST_COMP` compiler macros]
|
||||
[include ../../../boost/predef/compiler/*.h]
|
||||
[endsect]
|
||||
|
||||
[section `BOOST_LANG` language standards macros]
|
||||
[include ../../../boost/predef/language/*.h]
|
||||
[endsect]
|
||||
|
||||
[section `BOOST_LIB` library macros]
|
||||
[include ../../../boost/predef/library/*/*.h]
|
||||
[endsect]
|
||||
|
||||
[section `BOOST_OS_` operating system macros]
|
||||
[include ../../../boost/predef/os/*.h]
|
||||
[endsect]
|
||||
|
||||
[section Version definition macros]
|
||||
[include ../../../boost/predef/version_number.h]
|
||||
[include ../../../boost/predef/make.h]
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||