source: js/sdk/js_interface/js_interface.idl @ 865

Last change on this file since 865 was 865, checked in by Maciej Komosinski, 5 years ago

Added files needed to compile Framsticks SDK to JavaScript? using Emscripten

File size: 14.2 KB
Line 
1interface IRange {
2        attribute long begin;
3        attribute long end;
4};
5
6interface MultiRange {
7        long rangeCount();
8        [Value] IRange getRange(long i);
9};
10
11interface SingleMapping {
12        attribute long begin;
13        [Value] attribute MultiRange to;
14};
15
16interface MultiMap {
17        void MultiMap();
18        SingleMapping getMapping(long i);
19        long rangeCount();
20        [Value] MultiRange map([Ref] MultiRange ranges);
21        void addCombined([Ref, Const] MultiMap m1, [Ref, Const] MultiMap m2);
22        void addReversed([Ref, Const] MultiMap m);
23};
24
25interface SString {
26        void SString();
27        [Operator = "="] void set([Const] DOMString ch);
28        [Const] DOMString c_str();
29};
30
31interface GenMan {
32        void GenMan();
33        void setDefaults();
34        [Value] string HTMLize([Const] DOMString g);
35        [Value] string HTMLizeShort([Const] DOMString g);
36};
37
38interface GlyphLoader {
39        void GlyphLoader();
40        [Const] DOMString getStringifiedGlyph(NeuroClass cl);
41};
42
43interface PreconfiguredGenetics {
44        void PreconfiguredGenetics();
45        [Value] attribute DefaultGenoConvManager gcm;
46        [Value] attribute GenMan genman;
47        [Value] attribute Validators validators;
48        [Value] attribute ModelGenoValidator model_validator;
49};
50
51interface string {
52        void string();
53        [Const] DOMString c_str();
54};
55
56interface SList {
57        void SList();
58        VoidPtr get(long i);
59        long size();
60};
61
62interface Pt3D {
63        attribute double x;
64        attribute double y;
65        attribute double z;
66        void Pt3D();
67};
68
69interface Orient
70{
71        [Value] attribute Pt3D x;
72        [Value] attribute Pt3D y;
73        [Value] attribute Pt3D z;
74
75        void Orient();
76        void Orient([Const, Ref] Pt3D a, [Const, Ref] Pt3D b, [Const, Ref] Pt3D c);
77
78        void rotate([Const, Ref] Pt3D rot);
79
80        [Value] Pt3D transform([Const, Ref] Pt3D src);
81        [Value] Pt3D revTransform([Const, Ref] Pt3D src);
82
83        void transformSelf([Const, Ref] Orient rot);
84        void revTransformSelf([Const, Ref] Orient rot);
85
86        [Value] Pt3D getAngles();
87        void lookAt([Const, Ref] Pt3D X, [Const, Ref] Pt3D dir);
88
89        boolean normalize();
90};
91
92enum Part_Shape {
93        "Part::SHAPE_BALL_AND_STICK",
94        "Part::SHAPE_ELLIPSOID",
95        "Part::SHAPE_CUBOID",
96        "Part::SHAPE_CYLINDER"
97};
98
99interface Part {
100        attribute long refno;
101        [Value] attribute Pt3D p;
102        [Value] attribute Orient o;
103        [Value] attribute Pt3D rot;
104        attribute double mass;
105        attribute double size;
106        attribute double density;
107        attribute double friction;
108        attribute double ingest;
109        attribute double assim;
110        attribute double hollow;
111        [Value] attribute Pt3D scale;
112        [Value] attribute Pt3D vcolor;
113        attribute double vsize;
114        attribute long shape;
115
116        void Part(optional Part_Shape s = "Part::SHAPE_BALL_AND_STICK");
117
118        void setPositionAndRotationFromAxis([Const, Ref] Pt3D p1, [Const, Ref] Pt3D p2);
119        void setOrient([Const, Ref] Orient o);
120        void setRot([Const, Ref] Pt3D r);
121
122        MultiRange getMapping();
123
124        //TODO: Extra properties
125};
126
127enum Joint_Shape {
128        "Joint::SHAPE_BALL_AND_STICK",
129        "Joint::SHAPE_FIXED"
130};
131
132interface Joint {
133        void Joint();
134        //paInt p1_refno,p2_refno;
135
136        attribute Part part1;
137        attribute Part part2;
138        [Value] attribute Pt3D d;
139        [Value] attribute Pt3D rot;
140
141        void attachToParts(Part p1, Part p2);
142        void resetDelta();
143        void useDelta(boolean use);
144        boolean isDelta();
145
146        attribute long refno;
147        attribute double stamina;
148        attribute double stif;
149        attribute double rotstif;
150        [Value] attribute Orient o;
151        attribute boolean usedelta;
152        [Value] attribute Pt3D vcolor;
153
154        attribute long shape;
155
156        MultiRange getMapping();
157};
158
159interface NeuroClass {
160        void NeuroClass();
161        [Const, Ref] SString getName();
162        long getVisualHints();
163};
164
165enum NeuroClass_Hint {
166        "NeuroClass::Invisible",
167        "NeuroClass::DontShowClass",
168        "NeuroClass::AtFirstPart",
169        "NeuroClass::AtSecondPart",
170        "NeuroClass::EffectorClass",
171        "NeuroClass::ReceptorClass",
172        "NeuroClass::V1BendMuscle",
173        "NeuroClass::V1RotMuscle",
174        "NeuroClass::LinearMuscle"
175};
176
177interface Neuro {
178        void Neuro();
179        void Neuro(double _state, double _inertia, double _force, double _sigmo);
180
181        attribute long refno;
182        void setInputInfo(long i, [Const, Ref] SString name, [Const, Ref] SString value);
183        [Value] SString getInputInfo(long i);
184        [Value] SString getInputInfo(long i, [Const, Ref] SString name);
185        NeuroClass getClass();
186        void setClass(NeuroClass class);
187        [Value] SString getClassParams();
188        void setClassParams([Const, Ref] SString cp);
189        [Value] SString getClassName();
190        void setClassName([Const, Ref] SString clazz);
191        [Value] SString getDetails();
192        void setDetails([Const, Ref] SString details);
193
194        void attachToPart(Part p);
195        void attachToJoint(Joint j);
196        Part getPart();
197        Joint getJoint();
198
199        boolean isOldEffector();
200        boolean isOldReceptor();
201        boolean isOldNeuron();
202        boolean isNNConnection();
203
204        long getInputCount();
205        long getOutputsCount();
206
207        Neuro getInput(long i);
208        double getInputWeight(long i);
209        void setInputWeight(long i, double weight);
210        void setInput(long i, Neuro n);
211        void setInput(long i, Neuro n, double weight);
212        long addInput(Neuro child, double weight, [Const] SString info);
213        long findInput(Neuro child);
214        void removeInput(long refno);
215
216        long findInputs([Ref] SList result, [Const] DOMString classname, [Const] Part part, [Const] Joint joint);
217        long findOutputs([Ref] SList result, [Const] DOMString classname, [Const] Part part, [Const] Joint joint);
218
219        MultiRange getMapping();
220};
221
222interface GenoValidator {
223};
224
225interface ModelGenoValidator : GenoValidator {
226        void ModelGenoValidator();
227};
228
229interface GenoConvManager {
230};
231
232interface DefaultGenoConvManager : GenoConvManager {
233        void DefaultGenoConvManager();
234        void addDefaultConverters();
235};
236
237[Prefix = "Geno::"]
238interface Validators {
239        void Validators();
240        void append(GenoValidator data);
241};
242
243interface Geno {
244        void Geno();
245        void Geno([Const, Ref] SString fullString);
246        void Geno([Const] DOMString genstring, byte genformat, [Const] DOMString genname, [Const] DOMString comment);
247        boolean isValid();
248        byte getFormat();
249        [Value] SString getGenes();
250        static Validators useValidators(Validators val);
251        static GenoConvManager useConverters(GenoConvManager gcm);
252};
253
254enum ModelBuildStatus {
255        "empty",
256        "building",
257        "invalid",
258        "valid"
259};
260
261enum Model_ShapeType {
262        "Model::SHAPE_UNKNOWN",
263        "Model::SHAPE_ILLEGAL",
264        "Model::SHAPE_BALL_AND_STICK",
265        "Model::SHAPE_SOLIDS"
266};
267
268interface Model {
269        [Value] attribute Pt3D size;
270        [Value] attribute SString vis_style;
271        attribute double startenergy;
272
273        void Model();
274        void Model([Ref, Const] Geno newgeno, optional boolean buildmaps = false);
275
276        [Value] MultiMap getMap();
277        [Const, Value] MultiMap getF0Map();
278        void getCurrentToF0Map([Ref] MultiMap m);
279
280        ModelBuildStatus getStatus();
281        boolean isValid();
282        long getErrorPosition(boolean includingwarnings);
283        Model_ShapeType getShapeType();
284        void updateRefno();
285        [Const, Value] Geno getF0Geno();
286        void makeGeno([Ref] Geno geno);
287        void setGeno([Const, Ref] Geno newgeno);
288        void setValidationLevel(long level);
289        [Value] Pt3D whereDelta([Const, Ref] Part start, [Const, Ref] Pt3D rot, [Const, Ref] Pt3D delta);
290        void resetAllDelta();
291        void useAllDelta(boolean yesno);
292        boolean validate();
293
294        long getPartCount();
295        Part getPart(long i);
296
297        long getJointCount();
298        Joint getJoint(long i);
299
300        long getNeuroCount();
301        long getConnectionCount();
302        Neuro getNeuro(long i);
303
304        Part addPart(Part p);
305        Joint addJoint(Joint j);
306        Neuro addNeuro(Neuro n);
307
308        Part addNewPart(Part_Shape shape);
309        Joint addNewJoint(Part p1, Part p2, Joint_Shape shape);
310        Neuro addNewNeuro();
311
312        void removePart(long partindex, optional long removeattachedjoints = 1, optional long removeattachedneurons = 1);
313        void removeJoint(long  jointindex, optional long removeattachedneurons = 1);
314        void removeNeuro(long  neuroindex, optional boolean removereferences = true);
315        void removeNeuros([Ref] SList nlist);
316
317        long findPart(Part p);
318        long findJoint(Joint j);
319        long findNeuro(Neuro nu);
320        long findJoint(Part p1, Part p2);
321
322        long findNeuros([Ref] SList result, DOMString classname, [Const] Part part, [Const] Joint joint);
323        long findJoints([Ref] SList result, [Const] Part part);
324
325        void move([Const, Ref] Pt3D shift);
326        void rotate([Const, Ref] Orient rotation);
327        void buildUsingSolidShapeTypes([Const, Ref] Model src_old_shapes, optional Part_Shape default_shape = "Part::SHAPE_CYLINDER", optional float thickness = 0.2);
328
329        void open();
330        void close();
331        void rebuild(boolean buildmaps);
332        void rebuild([Const, Ref] Geno newgeno, boolean buildmaps);
333        void clear();
334        [Const, Value] Geno getGeno();
335};
336
337interface GenotypeMini {
338        void GenotypeMini();
339        [Value] attribute SString name;
340        [Value] attribute SString genotype;
341        [Value] attribute SString info;
342        void clear();
343};
344
345interface GenotypeMiniLoader {
346        void GenotypeMiniLoader([Const] DOMString filename);
347        GenotypeMini loadNextGenotype();
348};
349
350[NoDelete]
351interface StdioFileSystem_autoselect {
352        void StdioFileSystem_autoselect();
353};
354
355interface LoggerBase {
356        void LoggerBase(optional long opts = 0);
357};
358
359enum LoggerBase_LoggerOptions {
360        "LoggerBase::DontBlock",
361        "LoggerBase::CannotBeBlocked",
362        "LoggerBase::Enable",
363        "LoggerBase::Paused"
364};
365
366interface LoggerToMemory
367{
368        void LoggerToMemory(long opts, optional long minimal_level_to_store = 2);
369
370        void reset();
371        long getErrorCount();
372        long getWarningCount();
373        long getInfoCount();
374        long getStoredCount();
375        long getErrorLevel();
376        [Value] string getMessages();
377        [Value] string getCountSummary();
378        void handle([Const] DOMString obj, [Const] DOMString method, long level, [Const] DOMString msg);
379};
380
381enum LoggerToMemory_Options2 {
382        "LoggerToMemory::StoreFirstMessage",
383        "LoggerToMemory::StoreAllMessages"
384};
385
386interface VirtFILE {
387};
388
389interface SaveFileHelper {
390        void SaveFileHelper();
391        VirtFILE Vfopen([Const] DOMString path, [Const] DOMString mode);
392        ParamEntry getMinigenotype_paramtab();
393};
394
395interface XY {
396        void XY(long x, long y);
397        attribute long x;
398        attribute long y;
399};
400
401interface XYWH : XY {
402        void XYWH(long x, long y, long w, long h);
403        attribute long x;
404        attribute long y;
405        attribute long w;
406        attribute long h;
407};
408
409interface NNLayoutState {
410};
411
412interface NNLayoutState_Model : NNLayoutState {
413};
414
415interface NNLayoutState_Model_Fred : NNLayoutState_Model {
416        void NNLayoutState_Model_Fred(Model m);
417        long GetElements();
418        [Value] XYWH GetValueXYWH(long el);
419        void SetXYWH(long el, long x, long y, long w, long h);
420        long GetInputs(long el);
421        long GetLink(long el, long i);
422        [Value] XY GetLinkValueXY(long el, long i);
423};
424
425interface NNLayoutFunctionHelper {
426        void NNLayoutFunctionHelper();
427        void doLayout(long layout_type, NNLayoutState nn_layout);
428};
429
430interface GenoOperators {
431        void GenoOperators();
432        // TODO: static long roulette(const double *probtab, long count);
433        long checkValidity([Const] DOMString geno, [Const] DOMString genoname);
434        long validate(DOMString geno, [Const] DOMString genoname);
435        [Value] SString getSimplest();
436};
437
438interface Geno_f4 : GenoOperators {
439        void Geno_f4();
440};
441
442interface Geno_fH : GenoOperators {
443        void Geno_fH();
444};
445
446interface Geno_fB : GenoOperators {
447        void Geno_fB();
448};
449
450interface Geno_fL : GenoOperators {
451        void Geno_fL();
452};
453
454interface GenoOper_f9 : GenoOperators {
455        void GenoOper_f9();
456};
457
458interface GenoOper_fF : GenoOperators {
459        void GenoOper_fF();
460};
461
462interface GenoOperatorsHelper {
463        void GenoOperatorsHelper(GenoOperators genoOper);
464        long mutate([Const] DOMString geno);
465        long crossOver([Const] DOMString geno1, [Const] DOMString geno2);
466        [Value] SString getLastMutateGeno();
467        [Value] SString getLastCrossGeno1();
468        [Value] SString getLastCrossGeno2();
469};
470
471interface ParamEntry {
472};
473
474interface ParamInterface {
475        long getGroupCount();
476        long getPropCount();
477        [Const] DOMString getName();
478        [Const] DOMString getDescription();
479        long findId([Const] DOMString n);
480        long findIdn([Const] DOMString naz, long n);
481        [Const] DOMString type(long i);
482        [Const] DOMString help(long i);
483        long flags(long i);
484        long group(long i);
485        [Const] DOMString grname(long gi);
486        [Value] SString get(long i);
487        [Value] SString getString(long i);
488        long getInt(long i);
489        double getDouble(long i);
490
491        [Value] SString getStringById([Const] DOMString prop);
492        long getIntById([Const] DOMString prop);
493        double getDoubleById([Const] DOMString prop);
494
495        long setIntFromString(long i, [Const] DOMString str, boolean strict);
496        long setDoubleFromString(long i, [Const] DOMString str);
497
498        long setInt(long i, long val);
499        long setDouble(long i, double val);
500        long setString(long i, [Const, Ref] SString str);
501
502        long setFromString(long i, [Const] DOMString str, boolean strict);
503
504        long setIntById([Const] DOMString prop, long value);
505        long setDoubleById([Const] DOMString prop, double value);
506        long setStringById([Const] DOMString prop, [Const] DOMString value);
507
508        //long getMinMaxInt(long prop, [Ref] long minimum, [Ref] long maximum, [Ref] long def);
509        //long getMinMaxDouble(long prop, [Ref] double minimum, [Ref] double maximum, [Ref] double def);
510        //long getMinMaxString(long prop, [Ref] long minimum, [Ref] long maximum, [Ref] SString def);
511        //
512        //static long getMinMaxIntFromTypeDef([Const] DOMString type, [Ref] long minimum, [Ref] long maximum, [Ref] long def);
513        //static long getMinMaxDoubleFromTypeDef([Const] DOMString type, [Ref] double minimum, [Ref] double maximum, [Ref] double def);
514        //static long getMinMaxStringFromTypeDef([Const] DOMString type, [Ref] long minimum, [Ref] long maximum, [Ref] SString def);
515
516        void setDefault();
517        void setDefault(long i);
518
519        void setMin();
520        void setMax();
521        void setMin(long i);
522        void setMax(long i);
523
524        [Value] static SString friendlyTypeDescrFromTypeDef([Const] DOMString type);
525        [Value] SString friendlyTypeDescr(long i);
526
527        void copyFrom(ParamInterface src);
528        void quickCopyFrom(ParamInterface src);
529
530        //long save(VirtFILE file, [Const] DOMString altname, optional boolean force = false);
531
532        static boolean isValidTypeDescription([Const] DOMString t);
533};
534
535interface SimpleAbstractParam : ParamInterface {
536
537};
538
539interface Param : SimpleAbstractParam {
540        void Param(ParamEntry t, VoidPtr o);
541        //long save(VirtFILE file, [Const] DOMString altname, optional boolean force = false);
542};
543
544[Prefix = "ParamTree::"]
545interface NodePtr {
546        ParamTreeNode get();
547};
548
549[Prefix = "ParamTree::"]
550interface ParamTreeNode {
551        attribute ParamTree tree;
552        attribute ParamTreeNode parent;
553        [Value] attribute string name;
554        [Value] attribute NodePtr first_child;
555        [Value] attribute NodePtr next_sibling;
556        attribute long group_index;
557};
558
559interface ParamTree {
560        [Value] attribute ParamTreeNode root;
561        ParamTreeNode addNode(ParamTreeNode parent, [Ref, Const] string name, long group);
562        ParamTreeNode findNode(ParamTreeNode parent, [Ref, Const] string name);
563        void ParamTree(ParamInterface _pi);
564};
565
566interface MutableParamList : ParamInterface {
567
568};
569
570interface ParamTreeConfigured {
571        void ParamTreeConfigured();
572        attribute ParamTree tree;
573        [Value] attribute MutableParamList paramiface;
574        ParamTree generateTree();
575};
Note: See TracBrowser for help on using the repository browser.