Skip to content

Commit

Permalink
fix hw
Browse files Browse the repository at this point in the history
  • Loading branch information
9il committed Apr 20, 2015
1 parent b87ff5c commit bff7afc
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 22 deletions.
22 changes: 11 additions & 11 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,20 @@

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
'papersize': 'a4paper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
'pointsize': '12pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',

# Latex figure (float) alignment
#'figure_align': 'htbp',
'figure_align': 'H',

'papersize':'a4paper',
'pointsize':'12pt',
'classoptions': ',openany,oneside',
# 'babel': '\\usepackage[english,russian]{babel}'
'classoptions': ',openany,oneside',

# 'babel': '\\usepackage[english]{babel} \n\\usepackage[section]{placeins}',
}


Expand All @@ -246,24 +245,25 @@
#latex_use_parts = False

# If true, show page references after internal links.
#latex_show_pagerefs = False
# latex_show_pagerefs = True

# If true, show URL addresses after external links.
#latex_show_urls = False
latex_show_urls = 'footnote'

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_domain_indices = True

# latex_additional_files = ["style.sty"]

# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'quickstartwithd', 'Quick Start With D Documentation',
(master_doc, 'quickstartwithd', 'Quick Start With D',
[author], 1)
]

Expand All @@ -277,7 +277,7 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'QuickStartWithD', 'Quick Start With D Documentation',
(master_doc, 'QuickStartWithD', 'Quick Start With D',
author, 'QuickStartWithD', 'One line description of project.',
'Miscellaneous'),
]
Expand Down
27 changes: 18 additions & 9 deletions docs/source/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,48 @@ Examples

NOT READY!

D_ is complex multi-paradigm programming language.
D is complex multi-paradigm programming language.
В тоже время, если Вы знаете С, чтобы начать использовать D потребуется
всего навсего посмотреть несколько примеров.

Hellow Wolrd!
~~~~~~~~~~~~~~

The following well known С program prints "Hello, World!" to the standard output.
C programs can be easily translated to D.
The following program prints "Hello, World!" to the standard output.

.. literalinclude:: ../../examples/helloworld.c
:language: c
:tab-width: 4
:caption: Hello World program in C


It can be easily translated to D_.
D `doesn't have a preprocessor <http://dlang.org/pretod.html>`_.
Use ``import core.stdc.MODULE;`` construction to import ``MODULE`` from `C Standard library`_.
Module ``core.stdc.stdio`` contains the ``puts`` prototype:

.. code-block:: d
extern(C) @system nothrow @nogc int puts(in char* s);
.. literalinclude:: ../../examples/helloworld1.d
:language: d
:tab-width: 4
:caption: Hello World program in D (C style)

.. seealso:: `Programming in D for C Programmers`_.


Common D_ "Hello, World!" program based on Phobos_ looks simpler:
Common D "Hello, World!" program based on Phobos_ looks simpler:

.. literalinclude:: ../../examples/helloworld2.d
:language: d
:tab-width: 4
:tab-width: 4
:caption: Hello World program in D

Phobos is the standard runtime library that comes with the D language compiler.

Phobos_ is the standard runtime library that comes with the D language compiler.
.. seealso:: A collection of common C techniques, and how to do the corresponding task in D can be found `here <http://dlang.org/ctod.html>`_. However most of them can be implemented in C style.

.. _D: http://dlang.org
.. _Programming in D for C Programmers: http://dlang.org/ctod.html
.. _C Standard library: http://www.cplusplus.com/reference/clibrary/
.. _Phobos: http://dlang.org/phobos/
1 change: 1 addition & 0 deletions docs/source/style.sty
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\newfloat{literal-block}{H}{lop}
7 changes: 5 additions & 2 deletions examples/helloworld2.d
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//Deduces the type of a declared variable from its initialization expression
/++
Deduces the type of a declared variable from its initialization
expression.
+/
immutable str = "Hello, World!";

void main()
{
//Scoped and selective imports can be used.
// Scoped and selective imports can be used.
import std.stdio : writeln;
writeln(str);
}

0 comments on commit bff7afc

Please sign in to comment.