about summary refs log tree commit diff stats
path: root/dev
diff options
context:
space:
mode:
authorSilvino Silva <silvino@bk.ru>2018-03-07 15:37:11 +0000
committerSilvino Silva <silvino@bk.ru>2018-03-07 16:11:36 +0000
commit5d7a23e5d38048d72243a18b60b6f5f7f3d805d2 (patch)
treead275b646484c39fb0b6d764c2de9cc85eed77a0 /dev
parent4481788af3863fb5e2cda0a6890b4742e150c1c4 (diff)
downloaddoc-5d7a23e5d38048d72243a18b60b6f5f7f3d805d2.tar.gz
dev c revision
Diffstat (limited to 'dev')
-rw-r--r--dev/c/elements.html78
-rw-r--r--dev/c/index.html229
-rw-r--r--dev/index.html36
3 files changed, 274 insertions, 69 deletions
diff --git a/dev/c/elements.html b/dev/c/elements.html
new file mode 100644
index 0000000..d6950d2
--- /dev/null
+++ b/dev/c/elements.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<html dir="ltr" lang="en">
+    <head>
+        <meta charset='utf-8'>
+        <title>Types &amp; Elements</title>
+    </head>
+    <body>
+        <a href="../index.html">Development Index</a>
+
+        <h1>Types &amp; Elements</h1>
+
+        <h2 id="types">Types</h2>
+
+        <dl>
+            <dt>char</dt>
+            <dd>Integer, one byte.</dd>
+            <dt>int</dt>
+            <dd>Integer.</dd>
+            <dt>float</dt>
+            <dd>Single precision floating point.</dd>
+            <dt>double</dt>
+            <dd>Double precision floating point.</dd>
+            <dt>void</dt>
+            <dd>Absence of type.</dd>
+        </dl>
+
+        <h2 id="ident">Identifiers</h2>
+
+        <p>Variable names, functions, data types and preprocessor macros.
+        Are allowed letters, decimal digits and underscore.</p>
+
+        <h2 id="keywords">Keywords</h2>
+
+        <p>Reserved identifiers part of C language.;</p>
+
+        <p>auto break case char const continue default do double else enum
+        extern float for goto if int long register return short signed
+        sizeof static struct switch typedef union unsigned void volatile
+        while</p>
+
+        <p>restrict inline _Bool _Complex _Imaginary</p>
+
+        <p>__FUNCTION__ __PRETTY_FUNCTION__ __alignof __alignof__ __asm
+        __asm__ __attribute __attribute__ __builtin_offsetof __builtin_va_arg
+        __complex __complex__ __const __extension__ __func__ __imag __imag__
+        __inline __inline__ __label__ __null __real __real__
+        __restrict __restrict__ __signed __signed__ __thread __typeof
+        __volatile __volatile__</p>
+
+        <h2 id="const">Constants</h2>
+
+        <p>Constants are identifiers with fixed values that can't change
+        during execution. Data types of constants; integer, character,
+        double, strings.</p>
+
+        <h2 id="op">Operators</h2>
+
+        <p>Operators do operations such as; addition or subtraction.</p>
+
+        <h2 id="sep">Separators</h2>
+
+        <p>Language elements separators;<p>
+        <p>{} [] () ; , . :</p>
+
+        <h2 id="white">White Space</h2>
+
+        <p>White space is ignored except when separating elements.</p>
+
+        <a href="../index.html">Development Index</a>
+
+        <p>
+        This is part of the c9-doc Manual.
+        Copyright (C) 2018
+        c9 team.
+        See the file <a href="../../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
+        for copying conditions.</p>
+    </body>
+</html>
diff --git a/dev/c/index.html b/dev/c/index.html
index 1c3b478..3e8651f 100644
--- a/dev/c/index.html
+++ b/dev/c/index.html
@@ -1,102 +1,197 @@
 <!DOCTYPE html>
 <html dir="ltr" lang="en">
     <head>
-        <meta charset='utf-8'>
-        <title>C &amp; GDB</title>
+	<meta charset='utf-8'>
+	<title>C &amp; GDB</title>
     </head>
     <body>
-        <a href="../index.html">Development Index</a>
+	<a href="../index.html">Development Index</a>
 
-        <h1>C &amp; GDB</h1>
+	<h1>C &amp; GDB</h1>
 
-        <p><a href="http://blog.fourthbit.com/2013/06/18/creating-an-open-source-program-in-c-with-autotools-part-1-of-2/">C program with autotools</a>
-        </p>
+	<h2 id="hello">Hello World</h2>
 
-        <pre>
-        $ touch NEWS README AUTHORS ChangeLog
-        $ mkdir -p src/bin src/lib
-        </pre>
+	<p>Create file hello.c with;</p>
 
-        <p>
-        <a href="http://web.eecs.umich.edu/~sugih/pointers/gdbQS.html">GDB Quick Start</a>,
-        <a href="https://www.hackerschool.com/blog/5-learning-c-with-gdb">Learning C with GDB</a>
-        and <a href="http://www.dirac.org/linux/gdb/02a-Memory_Layout_And_The_Stack.php">Memory Layout and the Stack</a>
-        are great sources of introductory information.</a>
-        </p>
+	<pre>
+	#include &lt;stdio.h&gt;
 
-        <p>To use gdb you need to compile program with -g flag. To
-        debug a program;</p>
+	int main() {
+	    printf("Hello World!");
+	    return 0;
+	}
+	</pre>
 
-        <pre>
-        gdb program
-        </pre>
+	<p>Compile;</p>
 
-        <p>If the program needs arguments you can set it;</p>
+	<pre>
+	$ gcc -Wall hello.c -o hello
+	</pre>
 
-        <pre>
-        (gdb)set args -parameter1 -parameter2
-        </pre>
+	<p>Run;</p>
 
-        <p>To start the program you can type run, this way gdb
-        will try to run the program until the end. If program
-        crash, gdb will stop it for debuging.</p>
+	<pre>
+	$./hello
+	Hello World!
+	</pre>
 
-        <pre>
-        (gdb) run
-        </pre>
+	<h2 ="sources">Multiple Sources</h2>
 
-        <pre>
-        n - execute next line
-        s - step in next line
-        b - backtrace
-        info locals
-        print
-        x
-        </pre>
+	<p>To organize code in multiple files split above
+	example in main.c, hello.c and hello.h. Content of
+	main.c;<p>
 
-        <h2>SysCalls</h2>
+	<pre>
+	#include "hello.h"
 
-        <pre>catch syscall open</pre>
+	int main() {
+	    hello("world");
+	    return 0;
+	}
+	</pre>
 
-        <h2>Threads</h2>
+	<p>Header file contains declaration of the function hello,
+	content of hello.h;</p>
 
-        <p>When new thread is created you receive
-        a notification. To get information about
-        threads;</p>
+	<pre>
+	void hello(const char* name);
+	</pre>
 
-        <pre>
-        info threads
-        </pre>
+	<p>Implementation of hello function in hello.c;</p>
 
-        <p>To select thread;</p>
+	<pre>
+	#include &lt;stdio.h&gt;
+	#include "hello.h"
 
-        <pre>
-        thread 1
-        </pre>
+	void hello(const char* name) {
+	    printf("Hello, %s!\n", name);
+	}
+	</pre>
+
+	<p>Compile;</p>
+
+	<pre>
+	$ gcc -Wall main.c hello.c -o hello
+	</pre>
+
+	<h2 id="makefile">Makefile</h2>
+
+	<p>Make reads a Makefile by default on current directory,
+	Makefile defines targets, for example executables and their
+	dependencies, for example object files and source files.<p>
+
+	<p>Create Makefile;</p>
+
+	<pre>
+	CC=gcc
+	CFLAGS=-Wall
+
+	hello: main.o hello.o
 
-        <p><a href="http://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_39.html#SEC40">Stopping and Starting</a>
-        multi-thread programs</p>
+	clean:
+		rm -f hello main.o hello.o
+	</pre>
+
+	<pre>
+	$ touch NEWS README AUTHORS ChangeLog
+	</pre>
+
+	<h2 id="debug">Debug</h2>
+
+	<p>To use gdb you need to compile program with -g flag. Change
+	Makefile</p>
+
+	<pre>
+	CC=gcc
+	CFLAGS=-Wall -g
+
+	hello: main.o hello.o
+
+	clean:
+		rm -f hello main.o hello.o
+	</pre>
+
+	<pre>
+	$ gdb hello
+	</pre>
+
+	<p>Set break point;</p>
+
+	<pre>
+	(gdb) break main
+	</pre>
+
+	<p>To start the program you can type run, this way gdb
+	will try to run the program until the end. If program
+	crash, gdb will stop it for debuging. Start program;</p>
+
+	<pre>
+	(gdb) run
+	</pre>
+
+	<p>Step in next line;</p>
+
+	<pre>
+	(gdb) s
+	</pre>
+
+	<p>Execute next line;</p>
+
+	<pre>
+	(gdb) n
+	</pre>
+
+        <p>To start gdb in TUI mode press;</p>
+
+        <dl>
+            <dt>Ctrl-x A</dt>
+            <dd>Enter or leave TUI.</dd>
+            <dt>Ctrl-x 1</dt>
+            <dd>TUI with only one window.</dd>
+            <dt>Ctrl-x 2</dt>
+            <dd>TUI with more than two windows.</dd>
+            <dt>Ctrl-x o</dt>
+            <dd>Change active window.</dd>
+            <dt>Ctrl-x s</dt>
+            <dd>TUI single key mode.</dd>
+            <dt>Ctrl-L s</dt>
+            <dd>Refresh screen.</dd>
+            <dt>Up</dt>
+            <dd>Scroll</dd>
+            <dt>Down</dt>
+            <dd>Scroll</dd>
+            <dt>Left</dt>
+            <dd>Scroll</dd>
+            <dt>Right</dt>
+            <dd>Scroll</dd>
+        </dl>
+
+        <p>Run again and step in hello function, to print
+        variable "name" value and type;</p>
 
         <pre>
-        break linespec thread threadno
+        (gdb) print name
+        $1 = 0x4005b0 "world"
+        (gdb)
         </pre>
 
-        <h2>Strace</h2>
+        <p>Print variable name type;</p>
 
         <pre>
-        strace -c ./program
+        (gdb) ptype name
+        type = const char *
+        (gdb)
         </pre>
 
-        <a href="../index.html">Development Index</a>
-        <p>
-        This is part of the c9-doc Manual.
-        Copyright (C) 2016
-        c9 team.
-        See the file <a href="../../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
-        for copying conditions.</p>
-
+        <p>Variable is a <a href="elements.html#const">string constant</a>,
+        continue reading <a href="elements.html">Elements</a>.</p>
 
+	<a href="../index.html">Development Index</a>
+	<p>
+	This is part of the c9-doc Manual.
+	Copyright (C) 2016
+	c9 team.
+	See the file <a href="../../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
+	for copying conditions.</p>
     </body>
-
 </html>
-
diff --git a/dev/index.html b/dev/index.html
index e463f6f..2dcc209 100644
--- a/dev/index.html
+++ b/dev/index.html
@@ -39,8 +39,40 @@
         as primary language.</p>
 
         <ul>
-            <li><a href="c/index.html">Hello World</a></li>
-            <li><a href="">Types &amp; Variables</a></li>
+            <li><a href="c/index.html">Hello World</a>
+                <ul>
+                    <li><a href="c/index.html#sources">Multiple sources</a></li>
+                    <li><a href="c/index.html#makefile">Makefile</a></li>
+                    <li><a href="c/index.html#debug">Debug</a></li>
+                </ul>
+            </li>
+            <li><a href="c/elements.html">Types &amp; Elements</a>
+                 <ul>
+                    <li><a href="c/elements.html#types">Types</a></li>
+                    <li><a href="c/elements.html#ident">Identifiers</a></li>
+                    <li><a href="c/elements.html#keywords">Keywords</a></li>
+                    <li><a href="c/elements.html#const">Constants</a></li>
+                    <li><a href="c/elements.html#op">Operators</a></li>
+                    <li><a href="c/elements.html#sep">Separators</a></li>
+                    <li><a href="c/elements.html#white">White space</a></li>
+                </ul>
+            </li>
+            <li><a href="c/datatypes.html">Datatypes</a>
+                 <ul>
+                    <li><a href="c/datatypes.html#int">Integer</a></li>
+                    <li><a href="c/datatypes.html#double">Real number</a></li>
+                    <li><a href="c/datatypes.html#complex">Complex number</a></li>
+                    <li><a href="c/datatypes.html#const">Enumeration</a></li>
+                    <li><a href="c/datatypes.html#union">Unions</a></li>
+                    <li><a href="c/datatypes.html#struct">Structures</a></li>
+                    <li><a href="c/datatypes.html#array">Arrays</a></li>
+                    <li><a href="c/datatypes.html#pointer">Pointers</a></li>
+                    <li><a href="c/datatypes.html#it">Incomplete types</a></li>
+                    <li><a href="c/datatypes.html#tq">Type qualifiers</a></li>
+                    <li><a href="c/datatypes.html#st">Storage class</a></li>
+                </ul>
+            </li>
+
             <li><a href="">Operators &amp; Expressions</a></li>
             <li><a href="">Control Flow</a></li>
             <li><a href="">Functions</a></li>