• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisiónffe72e64dc77f86acb6a1a9690b5fb2b154d60d9 (tree)
Tiempo2022-12-22 22:20:13
AutorAlbert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Log Message

refactored Components_and_Friends; now it's RST

Cambiar Resumen

Diferencia incremental

diff -r 1876e14fd0ac -r ffe72e64dc77 CCastle/3.Design/B.Workshop/C.py/Components_and_Friends.rst
--- a/CCastle/3.Design/B.Workshop/C.py/Components_and_Friends.rst Thu Dec 22 12:25:57 2022 +0100
+++ b/CCastle/3.Design/B.Workshop/C.py/Components_and_Friends.rst Thu Dec 22 14:20:13 2022 +0100
@@ -2,59 +2,73 @@
22 Modeling & Rendering Components & Friends
33 =========================================
44
5-.. hint:: Sources
5+.. post::
6+ :category: Castle, DesignStudy
7+ :tags: DRAFT
68
7- * ModelMore.ipynb, which is baed on
9+ Any compiler will read & parse the source, convert it into an abstract natation (like the AST) and write the result
10+ back in a lower-language, or “binary format”. We have spend several posts on the parsing phase. This one focus on
11+ the last part: *rendering* the model into “generated C code”.
12+
13+ The goal is not to design “all & everything”. We pick some details, do some experiment (typically in Jupyter/IPython
14+ Notebook), and the lessons-learned are documented here.
15+
16+
17+.. IPython Sources
18+
19+ * ModelMore.ipynb, which is based on
820 * Model-GCD.ipynb
921
10- Currently (Dec 12, 2022), this file (`CCastle2/IPython/Components.py` is most updated one
22+ They have become outdated by this (draft) post
1123
1224 .. todo::
13- Spilt the Modeling & Rendering parts; by using delegating to a ${Any}Rendering subclasses of ${Any}
1425
15-.. caution:: The text below needs to converted from MD to RST
16-
26+ * Spilt the Modeling & Rendering parts; by using delegating to a ${Any}Rendering subclasses of ${Any}
27+ * Add (pseudo) namespaces-support, global/extern/static keyword and such (during generation)
28+
29+
1730 Overview
1831 =========
1932
2033 Each component has 3 structures to fully describe the component; most are generated and/or filled by the compiler.
2134
2235 **CC_B_ComponentInterface**
23- Describes the interface (as by the Moat file)
36+ Describes the interface of a Component; more or less as by the Moat file
2437 **CC_B_ComponentClass**
25- Describe a component (as class) (as by the Castle-file)
38+ A *directory* of the component implementation: which callables etc -- including a “dispatch (v)table”
2639 *CC_C_${CompName}*
27- Characterises each instance for component *${CompName}*.
28-
29- This is handled by :class:`CC_Component`
30-
31-The first two are predefined (build-in) structures that are filled (and named) by the compiler.
32-The last one is defined (```#typedef```) by the compiler.
33-
34-For each component that is *coded* in a Castle file, the structures `CC_B_ComponentInterface` and a
35-`CC_B_ComponentClass` are filled (read: a variable of that type is instancianted); they get the name
36-cc_CI_\\${*CompName*}** resp **cc_C_${*CompName*}**.
37-<br/>
38-And, a new structure `CC_C_${CompName}` is defined (but not instanciated); the size of that struct depend on the component. As components do inherite, the structure-fiels of all super-components tripple down in the (top of) the new structure! This implies all `CC_C_${CompName}` structures start by ("inherite from") the baseComponent -- which struct is called CC_**B**_Component
39-
40-#### <span style="color:blue">Notes</span>
40+ Data-structure for each instance for component *${CompName}* -- the place to store component-local-data
4141
42-* The names of the structures & variables are based on the *"handCompiled"* version; they can/will change. But need to be alligned
43-* The variables ("instances") start with **cc_**; in small-case
44-* The structures ("classes") start in **CC_**; in captial
45-* Therefore, cc_C_\\${CompName} and CC_C_\\${CompName} are not the same. The first is a instance of a CC_B_ComponentClass, the second is a generated type (for the same component
46-* This can be a bit confusing. Probally I will change the name(s)
42+* The first two are predefined (build-in) structures, that are filled (and named) by the compiler. (so global variables)
43+* The last one is defined (``#typedef``) by the compiler.
44+ |BR|
45+ This is handled by :class:`CC_Component`
4746
48-#### Prefix/Infix/Suffix
49-* Components
50- - <span style="background: lightblue;">\_CI\_</span> (infix)
51- stands for **C**omponent-**I**nterface,
52- - <span style="background: lightblue;">\_C\_</span> (infix)
53- stands for **C**omponent (implementation).
54- - <span style="color: purple;">Probally beter abrivations will help</span>
55-* The infix <span style="background: lightblue;">\_B\_</span>
56- stands for **B**uildin
57-* The prefix <span style="background: lightblue;">CC\_</span>
58- is alike CCaste
47+For each component that is *coded* in a Castle file, the CCastleCompiler will fill the structures :c:struct:`CC_B_ComponentInterface` and a :c:struct:`CC_B_ComponentClass`. Or more exact, it generates C-code to create a “global, read-only” variable (that will end up in de data-segment). This is part of the runtime.
48+|BR|
49+Those variables get names as ``cc_CI_${CompName}`` resp ``cc_C_${CompName}`` (notice the lowercase prefix)
5950
60-Below we show the rendering of **CC_C_${CompName}** first. And them the other two; However, the need details al **`port`** & **`protocols`**; so the are defined too.
51+The CCastleCompiler will also define a *new* structure (as a typedef), called ``CC_C_${CompName}`` (notice the uppercase prefix). They are not instantiated by the compiler. During executing of the Castle program, such a structure will be allocated for each component-instance. The size of the structure depend on the component. And as component do inherit, the structure-fiels of all super-components tripple down in the (top of) the new structure! This implies all ``CC_C_${CompName}`` structures start by ("inherite from") the baseComponent -- which struct is called c:type:`CC_B_Component` -- Notice the **B** in the name.
52+
53+.. Note::
54+
55+ * The names of the structures & variables are based on the *"handCompiled"* version; they can/will change. But need to be aligned.
56+ * The variables ("instances") start with **cc_**; in small-case.
57+ * The structures ("classes") start in **CC_**; in capital.
58+ * Therefore, *cc_C_${CompName}* and *CC_C_${CompName}* are not the same.
59+ |BR|
60+ The first is a instance of a CC_B_ComponentClass, the second is a generated type (for the same component
61+ * This can be a bit confusing. Probably I will change the name(s) once ...
62+
63+.. hint:: Pre/In/Post-fixes
64+
65+ * Components
66+
67+ - **_CI_** (infix) stands for **C**\omponent-**I**\nterface,
68+ - **_C_** (infix) stands for **C**\omponent (implementation).
69+ - *Probably beter abrivations will help*
70+
71+ * **_B_** (infix) stands for **B**\uildin
72+ * **CC_** (prefix) is alike CCaste
73+
74+