Compare commits
No commits in common. "a4654b0720f03347708ebf02de22dc135c13d186" and "56feebfab645737033ead9af1d34d8bc009eddba" have entirely different histories.
a4654b0720
...
56feebfab6
|
@ -1,2 +1,2 @@
|
|||
*.html
|
||||
index.html
|
||||
root/
|
||||
|
|
7
Makefile
7
Makefile
|
@ -1,16 +1,13 @@
|
|||
WEBROOT ?= root
|
||||
|
||||
GEN = index.html cstyle.html
|
||||
GEN = index.html
|
||||
FILES = ${GEN} style.css pubkey.asc
|
||||
|
||||
all: ${GEN}
|
||||
|
||||
index.html: index.7
|
||||
index.html:
|
||||
mandoc -Thtml index.7 -Ostyle=style.css > index.html
|
||||
|
||||
cstyle.html: cstyle.7
|
||||
mandoc -Thtml cstyle.7 -Ostyle=style.css > cstyle.html
|
||||
|
||||
clean:
|
||||
rm -f ${GEN}
|
||||
|
||||
|
|
275
cstyle.7
275
cstyle.7
|
@ -1,275 +0,0 @@
|
|||
.Dd August 27, 2024
|
||||
.Dt CSTYLE 7
|
||||
.Os Nakidai
|
||||
.
|
||||
.Sh NAME
|
||||
.Nm C style
|
||||
.Nd style that I use in my programs
|
||||
.
|
||||
.Sh DESCRIPTION
|
||||
Recently I realized that
|
||||
I can't decide
|
||||
which code style to use,
|
||||
and I change it
|
||||
from project to project.
|
||||
So I decided to
|
||||
make a document that
|
||||
will describe
|
||||
my code style
|
||||
so it will look similar
|
||||
anywhere.
|
||||
.
|
||||
.Pp
|
||||
However,
|
||||
even while I want to use one style everywhere,
|
||||
these rules can be omitted in favor of readabilty.
|
||||
.
|
||||
.Ss Indetation
|
||||
I indent my code by 4 spaces.
|
||||
I try to keep my lines shorter than
|
||||
120 columns,
|
||||
but I will not split long strings
|
||||
when printing something.
|
||||
.
|
||||
.Ss Comments
|
||||
I never use
|
||||
.Ql // ,
|
||||
instead,
|
||||
I use
|
||||
.Ql /* ... */
|
||||
or
|
||||
.Bd -literal -offset indent
|
||||
/*
|
||||
* ...
|
||||
*/
|
||||
.Ed
|
||||
for commenting,
|
||||
because it's more widely supported.
|
||||
.
|
||||
.Pp
|
||||
I document code in headers
|
||||
like
|
||||
.Lk https://www.doxygen.nl/manual/docblocks.html Doxygen
|
||||
says
|
||||
(note extra asterisk
|
||||
on the first line):
|
||||
.Bd -literal -offset indent
|
||||
/**
|
||||
* Some descrpition
|
||||
* Maybe more descrpition
|
||||
* @param parameter Descrption
|
||||
* @return return value descrpition
|
||||
*/
|
||||
.Ed
|
||||
.
|
||||
.Ss Brackets
|
||||
I place braces
|
||||
on the next line:
|
||||
.Bd -literal -offset indent
|
||||
if (/* condition */)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
.Ed
|
||||
.
|
||||
.Pp
|
||||
In if-else chain
|
||||
I will place else
|
||||
on the same line
|
||||
as the closing brace:
|
||||
.Bd -literal -offset indent
|
||||
if (/* condition */)
|
||||
{
|
||||
/* ... */
|
||||
} else
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
.Ed
|
||||
It's same for do-while loops.
|
||||
.
|
||||
.Pp
|
||||
I can omit braces
|
||||
if they're not necessary.
|
||||
For consistence,
|
||||
I will place them
|
||||
if at least one
|
||||
.Ql if
|
||||
in the chain
|
||||
will require them.
|
||||
.
|
||||
.Pp
|
||||
I don't place spaces
|
||||
between function name
|
||||
and parenthesis,
|
||||
but place one
|
||||
after
|
||||
.Ql if ,
|
||||
.Ql for ,
|
||||
before and after
|
||||
.Ql while
|
||||
(in case it's
|
||||
do-while or while).
|
||||
Also
|
||||
I place parenthesis
|
||||
after
|
||||
.Ql sizeof .
|
||||
.
|
||||
.Pp
|
||||
I don't place extra spaces
|
||||
inside of parenthesis,
|
||||
but place
|
||||
inside of braces.
|
||||
Also I always place one space
|
||||
after commas.
|
||||
.
|
||||
.Ss Typing
|
||||
I can typedef some
|
||||
standard type
|
||||
for adding abstractness.
|
||||
I prefer
|
||||
not adding pointerness
|
||||
in the typedef,
|
||||
instead,
|
||||
I place asterisks
|
||||
on lines
|
||||
with variable declaring.
|
||||
I place asterisks
|
||||
near the variable,
|
||||
not near the type,
|
||||
because the last way
|
||||
may confuse coder.
|
||||
.
|
||||
.Pp
|
||||
I will not typedef
|
||||
any enums or structs.
|
||||
I use types
|
||||
from
|
||||
.Ql stdint.h
|
||||
instead of
|
||||
typedefing my own.
|
||||
.
|
||||
.Ss Naming
|
||||
In simple projects
|
||||
with several functions
|
||||
I don't care about it
|
||||
so much
|
||||
(and maybe some other
|
||||
sections).
|
||||
.
|
||||
.Pp
|
||||
Firstly, names
|
||||
have a prefix with
|
||||
its namespace
|
||||
or class
|
||||
or whatever.
|
||||
They can be chained
|
||||
using underscore.
|
||||
Also there's underscore
|
||||
after the chain
|
||||
(splitting it with
|
||||
next name).
|
||||
Namespaces and classes
|
||||
are named in PascalCase.
|
||||
For example:
|
||||
.Dl Namespace_Class_init
|
||||
I may name
|
||||
Functions related to main
|
||||
(needed for starting the main program)
|
||||
without any prefix.
|
||||
.
|
||||
.Pp
|
||||
Functions,
|
||||
methods,
|
||||
or variables
|
||||
are named in pascalCase:
|
||||
.Dl Namespace_Class_someMethod
|
||||
.
|
||||
.Pp
|
||||
Types,
|
||||
structs,
|
||||
enums,
|
||||
unions
|
||||
are named PascalCase
|
||||
just like prefixes:
|
||||
.Dl Namespace_Class_SomeType
|
||||
.
|
||||
.Pp
|
||||
Constants
|
||||
are named in MACRO_CASE:
|
||||
.Dl Namespace_Class_SOME_CONST
|
||||
.
|
||||
.Pp
|
||||
Local variables
|
||||
and functions
|
||||
(declared
|
||||
inside of functions
|
||||
or with
|
||||
.Ql static )
|
||||
are named in snake_case.
|
||||
.
|
||||
.Ss Other's code
|
||||
If I need something,
|
||||
firstly I try to find it
|
||||
in the C standard,
|
||||
older is preferred,
|
||||
but C11 is OK too.
|
||||
Next,
|
||||
if I don't care about windows
|
||||
in my project,
|
||||
I try to find it
|
||||
in POSIX
|
||||
(with the same situation
|
||||
when searching in C standards).
|
||||
Next I try to find
|
||||
some
|
||||
(preferable multiplatform)
|
||||
library that
|
||||
covers my needs.
|
||||
.
|
||||
.Ss Organization
|
||||
Depending on complexity
|
||||
of the project,
|
||||
I either
|
||||
.Bl -bullet
|
||||
.It
|
||||
create complex structure
|
||||
with
|
||||
.Pa src
|
||||
and
|
||||
.Pa include
|
||||
directories that
|
||||
store the code and headers.
|
||||
Main file is stored at
|
||||
.Pa src/main.c .
|
||||
Platform-specific things
|
||||
are moved into
|
||||
.Pa {src,include}/platform
|
||||
folders.
|
||||
If there're many
|
||||
.Dq *.in
|
||||
files, I may create
|
||||
.Pa templates
|
||||
folder.
|
||||
.It
|
||||
place all the file(s
|
||||
if project is complex
|
||||
bot not too)
|
||||
in one directory,
|
||||
naming main file as
|
||||
project name.
|
||||
.El
|
||||
.
|
||||
.Pp
|
||||
In the root I place
|
||||
configure script
|
||||
(if proejct is complex)
|
||||
and Makefile.
|
||||
I write configure scripts
|
||||
by hand,
|
||||
so no autotools
|
||||
or other scary things
|
||||
are needed.
|
||||
.
|
||||
.Sh AUTHORS
|
||||
.An Nakidai Perumenei Aq Mt plaza521@inbox.ru
|
2
index.7
2
index.7
|
@ -92,6 +92,4 @@ SwA=
|
|||
.Lk https://stp.nakidai.ru stp
|
||||
.It
|
||||
.Lk https://latexds.nakidai.ru latexds
|
||||
.It
|
||||
.Lk https://nakidai.ru/cstyle.html cstyle(1)
|
||||
.El
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<style>
|
||||
table.head, table.foot { width: 100%; }
|
||||
td.head-rtitle, td.foot-os { text-align: right; }
|
||||
td.head-vol { text-align: center; }
|
||||
div.Pp { margin: 1ex 0ex; }
|
||||
div.Nd, div.Bf, div.Op { display: inline; }
|
||||
span.Pa, span.Ad { font-style: italic; }
|
||||
span.Ms { font-weight: bold; }
|
||||
dl.Bl-diag > dt { font-weight: bold; }
|
||||
code.Nm, code.Fl, code.Cm, code.Ic, code.In, code.Fd, code.Fn,
|
||||
code.Cd { font-weight: bold; font-family: inherit; }
|
||||
|
||||
html { font-family: monospace; line-height: 1.25em; }
|
||||
body { max-width: 80ch; margin: 1em auto; padding: 0 1ch; }
|
||||
table { border-collapse: collapse; }
|
||||
table.Nm code.Nm { padding-right: 1ch; }
|
||||
|
||||
body { background:#000; color:#AAA; }
|
||||
</style>
|
||||
<title>NAKIDAI.RU(7)</title>
|
||||
</head>
|
||||
<body>
|
||||
<table class="head">
|
||||
<tr>
|
||||
<td class="head-ltitle">NAKIDAI.RU(7)</td>
|
||||
<td class="head-vol">Miscellaneous Information Manual</td>
|
||||
<td class="head-rtitle">NAKIDAI.RU(7)</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="manual-text">
|
||||
<section class="Sh">
|
||||
<h1 class="Sh" id="SYNOPSYS"><a class="permalink" href="#SYNOPSYS">SYNOPSYS</a></h1>
|
||||
<p class="Pp"><code class="Nm">mail</code>
|
||||
<a class="Mt" href="mailto:plaza521@inbox.ru">plaza521@inbox.ru</a></p>
|
||||
</section>
|
||||
<section class="Sh">
|
||||
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
|
||||
<p class="Pp"><code class="Nm">nakidai</code> — <span class="Nd">C &
|
||||
Python developer</span></p>
|
||||
</section>
|
||||
<section class="Sh">
|
||||
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
|
||||
<p class="Pp">I'm coder from Russia. I used to like playing games, but now I'm
|
||||
tired of it a little I think.</p>
|
||||
<p class="Pp">I'm writing my projects mostly in Python, but sometime on dark
|
||||
nights I want to relax and write something in C, usually after several hours
|
||||
since I started coding I will go cry because of my stupidness, and then
|
||||
close to morning I will go sleep).</p>
|
||||
<p class="Pp">This is links to places where you can find me:</p>
|
||||
<ul class="Bl-bullet">
|
||||
<li><a class="Lk" href="https://discord.com/users/596659213124763649">discord</a></li>
|
||||
<li><a class="Lk" href="https://git.nakidai.ru/nakidai">gitea</a></li>
|
||||
<li><a class="Lk" href="https://github.com/nakidai">github</a></li>
|
||||
</ul>
|
||||
<p class="Pp">Also since I'm coder, I write some projects. There you can find
|
||||
some:</p>
|
||||
<dl class="Bl-tag">
|
||||
<dt><a class="Lk" href="https://github.com/latexds">LaTeXDS</a></dt>
|
||||
<dd>LaTeX renderer in Discord</dd>
|
||||
<dt><a class="Lk" href="https://github.com/nakidai/stp">stp</a></dt>
|
||||
<dd>SVG renderer in web</dd>
|
||||
<dt><a class="Lk" href="https://github.com/nakidai/NotABot">NotABot</a></dt>
|
||||
<dd>QoL bot for Vectozavr's Discord server</dd>
|
||||
<dt><a class="Lk" href="https://github.com/nakidai/MQEC">MQEC</a></dt>
|
||||
<dd><a class="Lk" href="https://github.com/UltraQbik/SMC-MQ-CPU">MQ</a>
|
||||
emulator</dd>
|
||||
<dt><a class="Lk" href="https://git.nakidai.ru/nakidai/mycfetch">mycfetch</a></dt>
|
||||
<dd>Simple system fetch tool</dd>
|
||||
</dl>
|
||||
<p class="Pp">Also there you can see my key which I use for signing commits:</p>
|
||||
<ul class="Bl-bullet">
|
||||
<li><a class="Lk" href="https://nakidai.ru/pubkey.asc">link</a></li>
|
||||
</ul>
|
||||
<div class="Bd Pp Li">
|
||||
<pre>-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Comment: Nakidai <plaza521@inbox.ru>
|
||||
Comment: C & Python developer
|
||||
Comment: Fingerprint: A0294D0C6040EFAA74F538C718AD605FDA13FE5A
|
||||
|
||||
|
||||
mDMEZeYYIhYJKwYBBAHaRw8BAQdAW2JvE2Q+Bv2vJ3r9ZXqeFXS4HllW6A79G6Wr
|
||||
ay3Gr260Mk5ha2lkYWkgKEMgJiBQeXRob24gZGV2ZWxvcGVyKSA8cGxhemE1MjFA
|
||||
aW5ib3gucnU+iJMEExYKADsWIQSgKU0MYEDvqnT1OMcYrWBf2hP+WgUCZeYYIgIb
|
||||
AwULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgAAKCRAYrWBf2hP+WgctAP9U/M/S
|
||||
3F4Cls4CQgmsErAYmfRQ2UKYC1fQVeg16yZT/AEAjZRoAFnf3J/fb7rByPsW454v
|
||||
hVmB+tNyVDeqqQ0xage4OARl5hgiEgorBgEEAZdVAQUBAQdATk8I26tjHH2+PtpA
|
||||
kG/I+GmxWJqqjWcsm0WL68MJa3cDAQgHiHgEGBYKACAWIQSgKU0MYEDvqnT1OMcY
|
||||
rWBf2hP+WgUCZeYYIgIbDAAKCRAYrWBf2hP+WqZWAP46h/hgCJZF+XKs8/djVs7b
|
||||
RrWbuSGUxxPc7SVzL+yrEAD8C1SSfs+uWTgUTEIeIZ/QHtkUTEH8wcgmfHIGRUYE
|
||||
SwA=
|
||||
=Limc
|
||||
-----END PGP PUBLIC KEY BLOCK-----</pre>
|
||||
</div>
|
||||
</section>
|
||||
<section class="Sh">
|
||||
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
|
||||
ALSO</a></h1>
|
||||
<ul class="Bl-bullet">
|
||||
<li><a class="Lk" href="https://causal.agency">Site that made me love
|
||||
manuals</a></li>
|
||||
<li><a class="Lk" href="https://stp.nakidai.ru">stp</a></li>
|
||||
<li><a class="Lk" href="https://latexds.nakidai.ru">latexds</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
<table class="foot">
|
||||
<tr>
|
||||
<td class="foot-date">August 24, 2024</td>
|
||||
<td class="foot-os">Nakidai</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,17 @@
|
|||
table.head, table.foot { width: 100%; }
|
||||
td.head-rtitle, td.foot-os { text-align: right; }
|
||||
td.head-vol { text-align: center; }
|
||||
div.Pp { margin: 1ex 0ex; }
|
||||
div.Nd, div.Bf, div.Op { display: inline; }
|
||||
span.Pa, span.Ad { font-style: italic; }
|
||||
span.Ms { font-weight: bold; }
|
||||
dl.Bl-diag > dt { font-weight: bold; }
|
||||
code.Nm, code.Fl, code.Cm, code.Ic, code.In, code.Fd, code.Fn,
|
||||
code.Cd { font-weight: bold; font-family: inherit; }
|
||||
|
||||
html { font-family: monospace; line-height: 1.25em; }
|
||||
body { max-width: 80ch; margin: 1em auto; padding: 0 1ch; }
|
||||
table { border-collapse: collapse; }
|
||||
table.Nm code.Nm { padding-right: 1ch; }
|
||||
|
||||
body { background:#000; color:#AAA; }
|
Loading…
Reference in New Issue