summary refs log tree commit diff stats
path: root/doc/uml/134530.diagram
blob: 8ddb4d3164e5892fd2735a9eeaa9245c327e85ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
format 70

classcanvas 128002 class_ref 148738 // Action
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 151 121 2000
end
classcanvas 128130 class_ref 148866 // Command
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 212 31 2000
end
classcanvas 128258 class_ref 148994 // CommandList
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 338 18 2000
end
classcanvas 128642 class_ref 149122 // Environment
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 99 305 2000
end
classcanvas 128770 class_ref 149250 // curses
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 118 611 2000
end
classcanvas 128898 class_ref 149378 // FM
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 143 185 2000
end
classcanvas 129154 class_ref 128002 // Displayable
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 325 408 2000
end
classcanvas 129666 class_ref 135426 // Console
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 627 149 2006
end
classcanvas 129922 class_ref 128130 // UI
  draw_all_relations default hide_attributes default hide_operations yes hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 366 235 2006
end
classcanvas 130178 class_ref 128386 // DisplayableContainer
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 299 311 2012
end
classcanvas 131458 class_ref 155906 // FileSystemObject
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 71 416 2000
end
classcanvas 131842 class_ref 128258 // DefaultUI
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 325 129 2012
end
classcanvas 132610 class_ref 156034 // Widget
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 509 237 2017
end
classcanvas 133250 class_ref 135170 // BrowserColumn
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 526 453 2023
end
classcanvas 133506 class_ref 135042 // TitleBar
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 646 391 2023
end
classcanvas 136322 class_ref 162690 // os
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 54 566 2000
end
packagecanvas 136578 
  package_ref 134530 // builtin
    xyzwh 29 522 2006 225 181
end
note 137346 "\"outer world\""
  xyzwh 123 566 2011 117 37
classcanvas 137602 class_ref 175746 // Pager
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 537 333 2028
end
relationcanvas 129026 relation_ref 156162 // <generalisation>
  decenter_begin 466
  from ref 128898 z 2001 to ref 128002
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 129538 relation_ref 162946 // <aggregation>
  from ref 128258 z 2001 to ref 128130
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 130306 relation_ref 128386 // <generalisation>
  decenter_begin 441
  decenter_end 407
  from ref 130178 z 2001 to ref 129154
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 130434 relation_ref 135938 // <aggregation>
  decenter_begin 603
  decenter_end 631
  from ref 130178 z 2001 to ref 129154
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 130562 relation_ref 128258 // <generalisation>
  from ref 129922 z 2007 to ref 130178
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 130946 relation_ref 169730 // <unidirectional association>
  from ref 128130 z 2001 to point 180 56
  line 137218 z 2001 to ref 128002
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 131202 relation_ref 169986 // <association>
  decenter_begin 514
  from ref 129154 z 2001 to ref 128770
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 131586 relation_ref 170242 // <aggregation>
  decenter_begin 351
  from ref 128642 z 2001 to ref 131458
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 131714 relation_ref 170370 // <association>
  from ref 128642 z 2001 to ref 129154
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 131970 relation_ref 128002 // <generalisation>
  from ref 131842 z 2007 to ref 129922
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 132354 relation_ref 170498 // <association>
  decenter_begin 435
  decenter_end 347
  from ref 131842 z 2013 to ref 128258
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 132738 relation_ref 170754 // <generalisation>
  decenter_end 126
  from ref 132610 z 2001 to point 493 430
  line 137474 z 2001 to ref 129154
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 132866 relation_ref 170882 // <generalisation>
  from ref 129666 z 2007 to ref 132610
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 133634 relation_ref 171010 // <generalisation>
  from ref 133506 z 2018 to ref 132610
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 133762 relation_ref 177922 // <unidirectional association>
  decenter_end 569
  from ref 128898 z 2001 to ref 128642
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 135170 relation_ref 178050 // <unidirectional association>
  from ref 128898 z 2013 to ref 131842
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 136450 relation_ref 184706 // <association>
  from ref 136322 z 2001 to ref 131458
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 136834 relation_ref 170626 // <association>
  from ref 129666 z 2007 to ref 128258
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 137730 relation_ref 191234 // <generalisation>
  from ref 137602 z 2029 to ref 132610
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 137858 relation_ref 191362 // <generalisation>
  from ref 133250 z 2029 to ref 137602
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
end
**Note**: Nimrod computes a CRC checksum and only recompiles the file if it has changed. You can use the ``-f`` command line option to force recompilation of the file. Link pragma ----------- The `link`:idx: pragma can be used to link an additional file with the project: .. code-block:: Nimrod {.link: "myfile.o".} Emit pragma ----------- The `emit`:idx: pragma can be used to directly affect the output of the compiler's code generator. So it makes your code unportable to other code generators/backends. Its usage is highly discouraged! However, it can be extremely useful for interfacing with `C++`:idx: or `Objective C`:idx: code. Example: .. code-block:: Nimrod {.emit: """ static int cvariable = 420; """.} proc embedsC() {.noStackFrame.} = var nimrodVar = 89 # use backticks to access Nimrod symbols within an emit section: {.emit: """fprintf(stdout, "%d\n", cvariable + (int)`nimrodVar`);""".} embedsC() ImportCpp pragma ---------------- The `importcpp`:idx: pragma can be used to import `C++`:idx: methods. The generated code then uses the C++ method calling syntax: ``obj->method(arg)``. In addition with the ``header`` and ``emit`` pragmas this allows *sloppy* interfacing with libraries written in C++: .. code-block:: Nimrod # Horrible example of how to interface with a C++ engine ... ;-) {.link: "/usr/lib/libIrrlicht.so".} {.emit: """ using namespace irr; using namespace core; using namespace scene; using namespace video; using namespace io; using namespace gui; """.} const irr = "<irrlicht/irrlicht.h>" type TIrrlichtDevice {.final, header: irr, importc: "IrrlichtDevice".} = object PIrrlichtDevice = ptr TIrrlichtDevice proc createDevice(): PIrrlichtDevice {. header: irr, importc: "createDevice".} proc run(device: PIrrlichtDevice): bool {. header: irr, importcpp: "run".} The compiler needs to be told to generate C++ (command ``cpp``) for this to work. The conditional symbol ``cpp`` is defined when the compiler emits C++ code. ImportObjC pragma ----------------- The `importobjc`:idx: pragma can be used to import `Objective C`:idx: methods. The generated code then uses the Objective C method calling syntax: ``[obj method param1: arg]``. In addition with the ``header`` and ``emit`` pragmas this allows *sloppy* interfacing with libraries written in Objective C: .. code-block:: Nimrod # horrible example of how to interface with GNUStep ... {.passL: "-lobjc".} {.emit: """ #include <objc/Object.h> @interface Greeter:Object { } - (void)greet:(long)x y:(long)dummy; @end #include <stdio.h> @implementation Greeter - (void)greet:(long)x y:(long)dummy { printf("Hello, World!\n"); } @end #include <stdlib.h> """.} type TId {.importc: "id", header: "<objc/Object.h>", final.} = distinct int proc newGreeter: TId {.importobjc: "Greeter new", nodecl.} proc greet(self: TId, x, y: int) {.importobjc: "greet", nodecl.} proc free(self: TId) {.importobjc: "free", nodecl.} var g = newGreeter() g.greet(12, 34) g.free() The compiler needs to be told to generate Objective C (command ``objc``) for this to work. The conditional symbol ``objc`` is defined when the compiler emits Objective C code. LineDir option -------------- The `lineDir`:idx: option can be turned on or off. If turned on the generated C code contains ``#line`` directives. This may be helpful for debugging with GDB. StackTrace option ----------------- If the `stackTrace`:idx: option is turned on, the generated C contains code to ensure that proper stack traces are given if the program crashes or an uncaught exception is raised. LineTrace option ---------------- The `lineTrace`:idx: option implies the ``stackTrace`` option. If turned on, the generated C contains code to ensure that proper stack traces with line number information are given if the program crashes or an uncaught exception is raised. Debugger option --------------- The `debugger`:idx: option enables or disables the *Embedded Nimrod Debugger*. See the documentation of endb_ for further information. Breakpoint pragma ----------------- The *breakpoint* pragma was specially added for the sake of debugging with ENDB. See the documentation of `endb <endb.html>`_ for further information. Volatile pragma --------------- The `volatile`:idx: pragma is for variables only. It declares the variable as ``volatile``, whatever that means in C/C++ (its semantics are not well defined in C/C++). **Note**: This pragma will not exist for the LLVM backend. Nimrod interactive mode ======================= The Nimrod compiler supports an `interactive mode`:idx:. This is also known as a `REPL`:idx: (*read eval print loop*). If Nimrod has been built with the ``-d:useGnuReadline`` switch, it uses the GNU readline library for terminal input management. To start Nimrod in interactive mode use the command ``nimrod i``. To quit use the ``quit()`` command. To determine whether an input line is an incomplete statement to be continued these rules are used: 1. The line ends with ``[-+*/\\<>!\?\|%&$@~,;:=#^]\s*$`` (operator symbol followed by optional whitespace). 2. The line starts with a space (indentation). 3. The line is within a triple quoted string literal. However, the detection does not work if the line contains more than one ``"""``. Debugging with Nimrod ===================== Nimrod comes with its own *Embedded Nimrod Debugger*. See the documentation of endb_ for further information. Optimizing for Nimrod ===================== Nimrod has no separate optimizer, but the C code that is produced is very efficient. Most C compilers have excellent optimizers, so usually it is not needed to optimize one's code. Nimrod has been designed to encourage efficient code: The most readable code in Nimrod is often the most efficient too. However, sometimes one has to optimize. Do it in the following order: 1. switch off the embedded debugger (it is **slow**!) 2. turn on the optimizer and turn off runtime checks 3. profile your code to find where the bottlenecks are 4. try to find a better algorithm 5. do low-level optimizations This section can only help you with the last item. Optimizing string handling -------------------------- String assignments are sometimes expensive in Nimrod: They are required to copy the whole string. However, the compiler is often smart enough to not copy strings. Due to the argument passing semantics, strings are never copied when passed to subroutines. The compiler does not copy strings that are a result from a procedure call, because the callee returns a new string anyway. Thus it is efficient to do: .. code-block:: Nimrod var s = procA() # assignment will not copy the string; procA allocates a new # string already However it is not efficient to do: .. code-block:: Nimrod var s = varA # assignment has to copy the whole string into a new buffer! For ``let`` symbols a copy is not always necessary: .. code-block:: Nimrod let s = varA # may only copy a pointer if it safe to do so If you know what you're doing, you can also mark single string (or sequence) objects as `shallow`:idx:\: .. code-block:: Nimrod var s = "abc" shallow(s) # mark 's' as shallow string var x = s # now might does not copy the string! Usage of ``shallow`` is always safe once you know the string won't be modified anymore, similar to Ruby's `freeze`:idx:. The compiler optimizes string case statements: A hashing scheme is used for them if several different string constants are used. So code like this is reasonably efficient: .. code-block:: Nimrod case normalize(k.key) of "name": c.name = v of "displayname": c.displayName = v of "version": c.version = v of "os": c.oses = split(v, {';'}) of "cpu": c.cpus = split(v, {';'}) of "authors": c.authors = split(v, {';'}) of "description": c.description = v of "app": case normalize(v) of "console": c.app = appConsole of "gui": c.app = appGUI else: quit(errorStr(p, "expected: console or gui")) of "license": c.license = UnixToNativePath(k.value) else: quit(errorStr(p, "unknown variable: " & k.key)) .. The ECMAScript code generator ============================= Note: As of version 0.7.0 the ECMAScript code generator is not maintained any longer. Help if you are interested. Note: I use the term `ECMAScript`:idx: here instead of `JavaScript`:idx:, since it is the proper term. The ECMAScript code generator is experimental! Nimrod targets ECMAScript 1.5 which is supported by any widely used browser. Since ECMAScript does not have a portable means to include another module, Nimrod just generates a long ``.js`` file. Features or modules that the ECMAScript platform does not support are not available. This includes: * manual memory management (``alloc``, etc.) * casting and other unsafe operations (``cast`` operator, ``zeroMem``, etc.) * file management * most modules of the Standard library * proper 64 bit integer arithmetic * proper unsigned integer arithmetic However, the modules `strutils`:idx:, `math`:idx:, and `times`:idx: are available! To access the DOM, use the `dom`:idx: module that is only available for the ECMAScript platform.