|
3 | 3 |
|
4 | 4 | = Coding Style |
5 | 5 |
|
6 | | -LinuxCNC is developed in C/C++, Python, BASH and Tcl/TK. |
7 | | -Documentation is written in asciidoc, which includes parts of the |
8 | | -UNIX man pages. |
| 6 | +LinuxCNC is developed in C/C++, Python, BASH and Tcl/Tk. |
| 7 | +Documentation is written in asciidoc, which includes the |
| 8 | +UNIX man pages written in Groff. |
9 | 9 |
|
10 | | -These computer languages are not completely independent from each other. |
11 | | -So is C/C++ used to extend the functionality of the other scripting |
12 | | -languages. And executables implemented in any of these languages |
13 | | -may be called from anywhere, mostly from the scripting languages. |
| 10 | +These programming languages are not completely independent from each other. |
| 11 | +So do the scripting languages extend the LinuxCNC core written in C/C++ for easier adaption of user interfaces. |
14 | 12 |
|
15 | | -Every computer language is its very own syntax and customs to be structured, |
| 13 | +Every programming language has its very own syntax and customs to be structured, |
16 | 14 | and many flavours with every developer being very opinionated about |
17 | 15 | their very own being the best. And while the exact style does not matter |
18 | 16 | too much, it is important for the eye to see the source code formatted |
19 | 17 | consistently. |
20 | 18 |
|
21 | 19 | This chapter hence describes the source code style preferred by the |
22 | | -LinuxCNC team. This shall improve our overall efficiency and avoid |
| 20 | +LinuxCNC team. This shall improve the readability of source code and documentation and shall avoid |
23 | 21 | intensive discussions (aka bike-shedding) about how to style it best. |
24 | 22 |
|
25 | 23 | == General comments |
@@ -351,70 +349,72 @@ of .c and .h are reserved for plain C. Headers are for class, method, |
351 | 349 | and structure declarations, not code (unless the functions are declared |
352 | 350 | inline). |
353 | 351 |
|
354 | | -=== Python coding standards |
| 352 | + |
| 353 | +== Python coding standards |
355 | 354 |
|
356 | 355 | Use the http://www.python.org/dev/peps/pep-0008/[PEP 8] style for |
357 | 356 | Python code. |
358 | 357 |
|
359 | | -=== Comp coding standards |
| 358 | +== Comp coding standards |
360 | 359 |
|
361 | 360 | In the declaration portion of a .comp file, begin each declaration at |
362 | 361 | the first column. Insert extra blank lines when they help group related |
363 | 362 | items. |
364 | 363 |
|
365 | 364 | In the code portion of a .comp file, follow normal C coding style. |
366 | 365 |
|
367 | | -== Code describing the functionality for the human |
| 366 | +== Style for the Documentation |
368 | 367 |
|
369 | 368 | This is a very recent (1/2022) part of this document. Please help shaping it if you are familiar with asciidoc. |
370 | 369 |
|
371 | | -After the website, and maybe the one or other YouTube Video, the |
372 | | -LinuxCNC documentation is likely the first point of contact for any new |
373 | | -user. The talent to get the documentation right is mostly disjunct from |
374 | | -computationally orchestrating all the moving parts of a mill or lathe, |
375 | | -though. Still, we need this to shine if we want LinuxCNC to shine and |
376 | | -for a transfer of our knowledge for the next generation - this seems |
377 | | -fair to say for a project that was started in the last millenium and few |
378 | | -individuals buying their own mills/lathes before their hair turns gray. |
| 370 | +// After looking at the website, and maybe watching the one or other YouTube Video, the |
| 371 | +// LinuxCNC documentation is likely the first point of contact for any new |
| 372 | +// user. The talent to get the documentation right is mostly disjunct from |
| 373 | +// computationally orchestrating all the moving parts of a mill or lathe, |
| 374 | +// though. Still, we need this to shine if we want LinuxCNC to shine and |
| 375 | +// for a transfer of our knowledge for the next generation - this seems |
| 376 | +// fair to say for a project that was started in the last millenium and few |
| 377 | +// individuals buying their own mills/lathes before their hair turns gray. |
379 | 378 |
|
380 | | -=== Overall structure of documentation |
| 379 | +// not really related to the style guide IMHO |
| 380 | +// == Overall structure of documentation |
381 | 381 |
|
382 | | -There are two basic documents, i.e. the |
383 | | - * Users' Guide and the |
384 | | - * Developers' Guide |
| 382 | +// There are two basic documents, i.e. the |
| 383 | +// * Users' Guide and the |
| 384 | +// * Developers' Guide |
385 | 385 |
|
386 | | -All documents created belong to either of these "parental documents" |
387 | | -and are included from the respective document, either directly or that |
388 | | -included file includes it. |
| 386 | +// All documents created belong to either of these "parental documents" |
| 387 | +// and are included from the respective document, either directly or that |
| 388 | +// included file includes it. |
389 | 389 |
|
390 | | -=== Common challenges |
391 | 390 |
|
392 | 391 | * header tags block like toc etc |
393 | | - |
394 | | - Every file should start with a header. This is typically |
395 | | - ---- |
396 | | - :lang: en |
397 | | - ---- |
398 | | - and longer documents may also chose to set |
399 | | - ---- |
400 | | - :toc: |
401 | | - ---- |
402 | | - This should be followed by an anchor for that section or chapter that is |
403 | | - represented in that file, like |
404 | | - ---- |
405 | | - [[cha:filename]] |
406 | | - ---- |
407 | | - If the file has a language-extension like _fr then this extension shall not become part of the anchor. |
408 | | - For a better consistency, and maintainability, the anchors need to be the same for all langages. |
409 | | - If the page needs extras, e.g. for the syntax-highlighting, then such lines may then follow. |
410 | | - |
| 392 | ++ |
| 393 | +-- |
| 394 | +Every file should start with a header. This is typically |
| 395 | +---- |
| 396 | +:lang: en |
| 397 | +---- |
| 398 | +and longer documents may also chose to set |
| 399 | +---- |
| 400 | +:toc: |
| 401 | +---- |
| 402 | +This should be followed by an anchor for that section or chapter that is |
| 403 | +represented in that file, like |
| 404 | +---- |
| 405 | +[[cha:filename]] |
| 406 | +---- |
| 407 | +If the file has a language-extension like _fr then this extension shall not become part of the anchor. |
| 408 | +For a better consistency, and maintainability, the anchors need to be the same for all langages. |
| 409 | +If the page needs extras, e.g. for the syntax-highlighting, then such lines may then follow. |
| 410 | +-- |
411 | 411 | * anchors for titles and other blocks |
412 | | - |
413 | | - If a chapter/section header shall be granted the option to be |
414 | | - referenced from another part of the documentation then it needs an achor. |
415 | | - The anchor shall be a combination of an indicator of the kind |
416 | | - of block that is referenced (cha,sec,fig,tab,...) together with a |
417 | | - short name identifying the object. |
| 412 | ++ |
| 413 | +If a chapter/section header shall be granted the option to be |
| 414 | +referenced from another part of the documentation then it needs an achor. |
| 415 | +The anchor shall be a combination of an indicator of the kind |
| 416 | +of block that is referenced (cha,sec,fig,tab,...) together with a |
| 417 | +short name identifying the object. |
418 | 418 |
|
419 | 419 | * index entries for titles and other blocks |
420 | 420 |
|
|
0 commit comments