From efe2a98ef5be5d092ff5d72b15d77d4f6c145ba7 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Mon, 3 Oct 2016 23:26:17 +0000 Subject: [PATCH] Convert HTML comments to DDoc comments The target output is not always HTML. Fixes HTML comments visible in the PDF. --- cpptod.dd | 26 +++++++++--------- ctod.dd | 76 ++++++++++++++++++++++++++--------------------------- spec/lex.dd | 2 +- 3 files changed, 52 insertions(+), 52 deletions(-) diff --git a/cpptod.dd b/cpptod.dd index 526016b0be..83efe76167 100644 --- a/cpptod.dd +++ b/cpptod.dd @@ -2,7 +2,7 @@ Ddoc $(COMMUNITY Programming in D for C++ Programmers, - +$(COMMENT img src="images/cpp1.gif" border="0" align="right" alt="C++") $(P Every experienced C++ programmer accumulates a series of idioms and techniques which become second nature. Sometimes, when learning a new language, those @@ -28,7 +28,7 @@ $(UL ) -
+
$(COMMENT -------------------------------------------- ) $(H3 Defining constructors) @@ -56,7 +56,7 @@ class Foo which reflects how they are used in D. -
+
$(COMMENT -------------------------------------------- ) $(H3 Base class initialization) $(H4 The C++ Way) @@ -125,7 +125,7 @@ class A } ------ -
+
$(COMMENT -------------------------------------------- ) $(H3 Comparing structs) $(H4 The C++ Way) @@ -188,7 +188,7 @@ if (x == y) ... ------ -
+
$(COMMENT -------------------------------------------- ) $(H3 Creating a new typedef'd type) $(H4 The C++ Way) @@ -255,7 +255,7 @@ if (h != Handle.init) default initializer can be supplied to $(REF Typedef, std,typecons) as a value of the underlying type. -
+
$(COMMENT -------------------------------------------- ) $(H3 Friends) $(H4 The C++ Way) @@ -326,7 +326,7 @@ int abc(A p) { return p.a; } The $(D private) attribute prevents other modules from accessing the members. -
+
$(COMMENT -------------------------------------------- ) $(H3 Operator overloading) $(H4 The C++ Way) @@ -375,7 +375,7 @@ struct A error prone. Far less code needs to be written to accomplish the same effect.) -
+
$(COMMENT -------------------------------------------- ) $(H3 Namespace using declarations) $(H4 The C++ Way) @@ -410,7 +410,7 @@ alias x = foo.x; declaration. Alias can be used to rename symbols, refer to template members, refer to nested class types, etc. -
+
$(COMMENT -------------------------------------------- ) $(H3 RAII (Resource Acquisition Is Initialization)) $(H4 The C++ Way) @@ -475,7 +475,7 @@ mechanism that lets you run arbitrary statements whenever leaving the current scope.) -
+
$(COMMENT -------------------------------------------- ) $(H3 Properties) $(H4 The C++ Way) @@ -542,7 +542,7 @@ int x = a.property; It's also a way to have interface classes, which do not have data fields, behave syntactically as if they did. -
+
$(COMMENT -------------------------------------------- ) $(H3 Recursive Templates) $(H4 The C++ Way) @@ -593,7 +593,7 @@ void test() } ------ -
+
$(COMMENT -------------------------------------------- ) $(H3 Meta Templates) @@ -745,7 +745,7 @@ int main() } ------ -
+
$(COMMENT -------------------------------------------- ) $(H3 Type Traits) diff --git a/ctod.dd b/ctod.dd index b9969cb06c..20b38b2d89 100644 --- a/ctod.dd +++ b/ctod.dd @@ -6,7 +6,7 @@ $(COMMENT $(BLOCKQUOTE_BY William Nerdspeare, Et tu, D? Then fall, C! )) - +$(COMMENT img src="images/c1.gif" border="0" align="right" alt="ouch!") $(P Every experienced C programmer accumulates a series of idioms and techniques which become second nature. Sometimes, when learning a new language, those @@ -64,7 +64,7 @@ $(UL $(LI $(RELATIVE_LINK2 variadic, Variadic Function Parameters)) ) -
+
$(COMMENT -------------------------------------------- ) $(H3 Getting the Size of a Type) $(H4 The C Way) @@ -87,7 +87,7 @@ double.sizeof Foo.sizeof ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Get the max and min values of a type) $(H4 The C Way) @@ -111,7 +111,7 @@ ulong.max double.min ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Primitive Types) $(H4 C to D types) @@ -143,7 +143,7 @@ $(P ) $(P Ints and unsigneds in C are of varying size; not so in D.) -
+
$(COMMENT ============================================ ) $(H3 Special Floating Point Values) $(H4 The C Way) @@ -179,7 +179,7 @@ double.min_10_exp double.min_exp ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Remainder after division of floating point numbers) $(H4 The C Way) @@ -202,7 +202,7 @@ double d = x % y; real r = x % y; ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Dealing with NANs in floating point compares) $(H4 The C Way) @@ -229,7 +229,7 @@ $(H4 The D Way) result = (x < y); // false if x or y is nan ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Asserts are a necessary part of any good defensive coding strategy) $(H4 The C Way) @@ -251,7 +251,7 @@ D simply builds assert into the language: assert(e == 0); ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Initializing all elements of an array) $(H4 The C Way) @@ -270,7 +270,7 @@ int[17] array; array[] = value; ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Looping through an array) $(H4 The C Way) @@ -327,7 +327,7 @@ foreach (ref value; array) value += 42; ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Creating an array of variable size) $(H4 The C Way) @@ -363,7 +363,7 @@ array.length = array.length + 1; array[array.length - 1] = x; ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 String Concatenation) $(H4 The C Way) @@ -418,7 +418,7 @@ s = s1 ~ s2; s ~= "hello"; ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Formatted printing) $(H4 The C Way) @@ -447,7 +447,7 @@ import std.stdio; writefln("Calling all cars %s times!", ntimes); ----------------------- -
+
$(COMMENT ============================================ ) $(H3 Forward referencing functions) $(H4 The C Way) @@ -490,7 +490,7 @@ void forwardfunc() } ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Functions that have no arguments) $(H4 The C Way) @@ -512,7 +512,7 @@ void foo() } ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Labeled break and continue statements) $(H4 The C Way) @@ -559,7 +559,7 @@ Louter: // break Louter goes here ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Goto Statements) $(H4 The C Way) @@ -577,7 +577,7 @@ $(H4 The D Way) programmers who know when the rules need to be broken. So of course D supports goto statements. -
+
$(COMMENT ============================================ ) $(H3 Struct tag name space) $(H4 The C Way) @@ -598,7 +598,7 @@ $(H4 The D Way) struct ABC { ... } ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Looking up strings) $(H4 The C Way) @@ -665,7 +665,7 @@ void dostring(char[] s) to generate a fast lookup scheme for it, eliminating the bugs and time required in hand-coding one. -
+
$(COMMENT ============================================ ) $(H3 Setting struct member alignment) $(H4 The C Way) @@ -711,7 +711,7 @@ struct ABC } ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Anonymous Structs and Unions) Sometimes, it's nice to control the layout of a struct with nested structs and unions. @@ -771,7 +771,7 @@ f.y; f.p; ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Declaring struct types and variables) $(H4 The C Way) @@ -805,7 +805,7 @@ Foo foo; block {} in how semicolons are used. ) -
+
$(COMMENT ============================================ ) $(H3 Getting the offset of a struct member) $(H4 The C Way) @@ -829,7 +829,7 @@ struct Foo { int x; int y; } off = Foo.y.offsetof; ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Union Initializations) $(H4 The C Way) @@ -855,7 +855,7 @@ U x = { a:5 }; avoiding the confusion and maintenance problems. -
+
$(COMMENT ============================================ ) $(H3 Struct Initializations) $(H4 The C Way) @@ -884,7 +884,7 @@ S x = { b:3, a:5 }; The meaning is clear, and there no longer is a positional dependence. -
+
$(COMMENT ============================================ ) $(H3 Array Initializations) $(H4 The C Way) @@ -927,7 +927,7 @@ int[2][3] b = [ [2,3], [6,5], [3,4] ]; int[2][3] b = [[2,6,3],[3,5,4]]; // error ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 Escaped String Literals) $(H4 The C Way) @@ -962,7 +962,7 @@ string quotedString = `"[^\\]*(\\.[^\\]*)*"`; // "[^\\]*(\\.[^\\]*)*" string hello = "hello world\n"; ---------------------------- -
+
$(COMMENT ============================================ ) $(H3 ASCII versus Wide Characters) $(P Modern programming requires that wchar strings be supported in an easy way, for internationalization of the programs.) @@ -995,7 +995,7 @@ auto _utf16 = "hello"w; // UTF-16 string auto _utf32 = "hello"d; // UTF-32 string ----------------------------- -
+
$(COMMENT ============================================ ) $(H3 Arrays that parallel an enum) $(H4 The C Way) @@ -1021,7 +1021,7 @@ string[COLORS.max + 1] cstring = Not perfect, but better. -
+
$(COMMENT ============================================ ) $(H3 Creating a new type with typedef) $(H4 The C Way) @@ -1117,7 +1117,7 @@ if (h != Handle.init) There's only one name to remember: $(D Handle). -
+
$(COMMENT ============================================ ) $(H3 Comparing structs) $(H4 The C Way) @@ -1163,7 +1163,7 @@ if (x == y) ----------------------------- -
+
$(COMMENT ============================================ ) $(H3 Comparing strings) $(H4 The C Way) @@ -1206,7 +1206,7 @@ if (str < "betty") which is useful for sorting/searching. -
+
$(COMMENT ============================================ ) $(H3 Sorting arrays) $(H4 The C Way) @@ -1246,7 +1246,7 @@ type[] array; sort(array); // sort array in-place ----------------------------- -
+
$(COMMENT ============================================ ) $(H3 String literals) $(H4 The C Way) @@ -1276,7 +1276,7 @@ lines So blocks of text can just be cut and pasted into the D source. -
+
$(COMMENT ============================================ ) $(H3 Data Structure Traversal) $(H4 The C Way) @@ -1389,7 +1389,7 @@ Symbol symbol_membersearch(Symbol[] table, char[] id) } ----------------------------- -
+
$(COMMENT ============================================ ) $(H3 Unsigned Right Shift) $(H4 The C Way) @@ -1437,7 +1437,7 @@ j = i >>> 3; avoids the unsafe cast and will work as expected with any integral type. -
+
$(COMMENT ============================================ ) $(H3 Dynamic Closures) $(H4 The C Way) @@ -1531,7 +1531,7 @@ void func(Collection c) eliminating the need to create irrelevant function names. -
+
$(COMMENT ============================================ ) $(H3 Variadic Function Parameters) The task is to write a function that takes a varying diff --git a/spec/lex.dd b/spec/lex.dd index 1247727d28..212a2a6426 100644 --- a/spec/lex.dd +++ b/spec/lex.dd @@ -1083,7 +1083,7 @@ $(H3 $(LNAME2 global_symbols, Globally Defined Symbols)) $(GRAMMAR $(GNAME Symbols): $(MULTICOLS 4, - $(D $(LINK2 arrays.html#strings, string)) (alias to immutable(char)[]) + $(D $(LINK2 arrays.html#strings, string)) (alias to immutable(char)[]) $(COMMENT This is important; people want to know these things up front.) $(D $(LINK2 arrays.html#strings, wstring)) (alias to immutable(wchar)[]) $(D $(LINK2 arrays.html#strings, dstring)) (alias to immutable(dchar)[])