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

Last change on this file since 1324 was 1324, checked in by Maciej Komosinski, 5 weeks ago

Updated for current SDK sources and current Emscripten

File size: 16.1 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",
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 long shape;
114        static readonly attribute double BALL_AND_STICK_RADIUS;
115
116        void Part(optional Part_Shape s = "Part::SHAPE_BALL");
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_STICK",
129        "Joint::SHAPE_FIXED",
130        "Joint::SHAPE_HINGE_X",
131        "Joint::SHAPE_HINGE_XY"
132};
133
134interface Joint {
135        void Joint();
136        //paInt p1_refno,p2_refno;
137
138        attribute Part part1;
139        attribute Part part2;
140        [Value] attribute Pt3D d;
141        [Value] attribute Pt3D rot;
142
143        void attachToParts(Part p1, Part p2);
144        void resetDelta();
145        void useDelta(boolean use);
146        boolean isDelta();
147
148        attribute long refno;
149        attribute double stamina;
150        attribute double stif;
151        attribute double rotstif;
152        [Value] attribute Orient o;
153        attribute boolean usedelta;
154        [Value] attribute Pt3D vcolor;
155
156        attribute long shape;
157
158        MultiRange getMapping();
159};
160
161interface NeuroClass {
162        void NeuroClass();
163        [Const, Ref] SString getName();
164        long getVisualHints();
165};
166
167enum NeuroClass_Hint {
168        "NeuroClass::Invisible",
169        "NeuroClass::DontShowClass",
170        "NeuroClass::AtFirstPart",
171        "NeuroClass::AtSecondPart",
172        "NeuroClass::EffectorClass",
173        "NeuroClass::ReceptorClass",
174        "NeuroClass::IsV1BendMuscle",
175        "NeuroClass::IsV1RotMuscle",
176        "NeuroClass::IsLinearMuscle",
177        "NeuroClass::IsSolidMuscle"
178};
179
180interface Neuro {
181        void Neuro();
182        void Neuro(double _state, double _inertia, double _force, double _sigmo);
183
184        attribute long refno;
185        void setInputInfo(long i, [Const, Ref] SString name, [Const, Ref] SString value);
186        [Value] SString getInputInfo(long i);
187        [Value] SString getInputInfo(long i, [Const, Ref] SString name);
188        NeuroClass getClass();
189        void setClass(NeuroClass clazz);
190        [Value] SString getClassParams();
191        void setClassParams([Const, Ref] SString cp);
192        [Value] SString getClassName();
193        void setClassName([Const, Ref] SString clazz);
194        [Value] SString getDetails();
195        void setDetails([Const, Ref] SString details);
196
197        void attachToPart(Part p);
198        void attachToJoint(Joint j);
199        Part getPart();
200        Joint getJoint();
201
202        boolean isOldEffector();
203        boolean isOldReceptor();
204        boolean isOldNeuron();
205        boolean isNNConnection();
206
207        long getInputCount();
208        long getOutputsCount();
209
210        Neuro getInput(long i);
211        double getInputWeight(long i);
212        void setInputWeight(long i, double weight);
213        void setInput(long i, Neuro n);
214        void setInput(long i, Neuro n, double weight);
215        long addInput(Neuro child, double weight, [Const] SString info);
216        long findInput(Neuro child);
217        void removeInput(long refno);
218
219        long findInputs([Ref] SList result, [Const] DOMString classname, [Const] Part part, [Const] Joint joint);
220        long findOutputs([Ref] SList result, [Const] DOMString classname, [Const] Part part, [Const] Joint joint);
221
222        MultiRange getMapping();
223};
224
225interface GenoValidator {
226};
227
228interface ModelGenoValidator : GenoValidator {
229        void ModelGenoValidator();
230};
231
232interface GenoConvManager {
233};
234
235interface DefaultGenoConvManager : GenoConvManager {
236        void DefaultGenoConvManager();
237        void addDefaultConverters();
238};
239
240[Prefix = "Geno::"]
241interface Validators {
242        void Validators();
243        void append(GenoValidator data);
244};
245
246interface Geno {
247        void Geno();
248        void Geno([Const, Ref] SString fullString);
249        void Geno([Const] DOMString genstring, byte genformat, [Const] DOMString genname, [Const] DOMString comment);
250        boolean isValid();
251        [Value] SString getFormat();
252        [Value] SString getGenes();
253        [Value] SString getGenesAndFormat();
254        static Validators useValidators(Validators val);
255        static GenoConvManager useConverters(GenoConvManager gcm);
256};
257
258enum ModelBuildStatus {
259        "empty",
260        "building",
261        "invalid",
262        "valid"
263};
264
265enum Model_ShapeType {
266        "Model::SHAPETYPE_UNKNOWN",
267        "Model::SHAPETYPE_ILLEGAL",
268        "Model::SHAPETYPE_BALL_AND_STICK",
269        "Model::SHAPETYPE_SOLIDS"
270};
271
272interface Model {
273        [Value] attribute Pt3D size;
274        [Value] attribute SString vis_style;
275        attribute double startenergy;
276
277        void Model(optional Model_ShapeType sh = "Model::SHAPETYPE_UNKNOWN");
278
279        void Model([Ref, Const] Geno src, Model_ShapeType sh, optional boolean buildmaps = false, optional boolean _using_checkpoints = false, optional boolean _is_checkpoint = false);
280        // The following constructor exists in the SDK, however in idl functions need to differ in number of arguments so it can't exist with the previous constructor
281        //void Model([Ref, Const] Model model, optional boolean buildmaps = false, optional boolean _using_checkpoints = false, optional boolean _is_checkpoint = false);
282
283        [Value] MultiMap getMap();
284        [Const, Value] MultiMap getF0Map();
285        void getCurrentToF0Map([Ref] MultiMap m);
286
287        ModelBuildStatus getStatus();
288        boolean isValid();
289        long getErrorPosition(boolean includingwarnings);
290        Model_ShapeType getShapeType();
291        void declareShapeType(Model_ShapeType sh);
292        void updateRefno();
293        [Const, Value] Geno getF0Geno();
294        void makeGeno([Ref] Geno geno, optional MultiMap sh,optional boolean handle_defaults,optional boolean can_be_invalid);
295        void setGeno([Const, Ref] Geno newgeno);
296        void setValidationLevel(long level);
297        [Value] Pt3D whereDelta([Const, Ref] Part start, [Const, Ref] Pt3D rot, [Const, Ref] Pt3D delta);
298        void resetAllDelta();
299        void useAllDelta(boolean yesno);
300        boolean validate();
301
302        long getPartCount();
303        Part getPart(long i);
304
305        long getJointCount();
306        Joint getJoint(long i);
307
308        long getNeuroCount();
309        long getConnectionCount();
310        Neuro getNeuro(long i);
311
312        Part addPart(Part p);
313        Joint addJoint(Joint j);
314        Neuro addNeuro(Neuro n);
315
316        Part addNewPart(Part_Shape shape);
317        Joint addNewJoint(Part p1, Part p2, Joint_Shape shape);
318        Neuro addNewNeuro();
319
320        void removePart(long partindex, optional long removeattachedjoints = 1, optional long removeattachedneurons = 1);
321        void removeJoint(long  jointindex, optional long removeattachedneurons = 1);
322        void removeNeuro(long  neuroindex, optional boolean removereferences = true);
323        void removeNeuros([Ref] SList nlist);
324
325        long findPart(Part p);
326        long findJoint(Joint j);
327        long findNeuro(Neuro nu);
328        long findJoint(Part p1, Part p2);
329
330        long findNeuros([Ref] SList result, DOMString classname, [Const] Part part, [Const] Joint joint);
331        long findJoints([Ref] SList result, [Const] Part part);
332
333        void move([Const, Ref] Pt3D shift);
334        void rotate([Const, Ref] Orient rotation);
335        void buildUsingSolidShapeTypes([Const, Ref] Model src_old_shapes, optional Part_Shape default_shape = "Part::SHAPE_CYLINDER", optional float thickness = 0.2);
336
337        void open();
338        void close();
339        void rebuild(boolean buildmaps);
340        void rebuild([Const, Ref] Geno newgeno, boolean buildmaps);
341        void clear();
342        [Const, Value] Geno getGeno();
343};
344
345interface GenotypeMini {
346        void GenotypeMini();
347        [Value] attribute SString name;
348        [Value] attribute SString genotype;
349        [Value] attribute SString info;
350        void clear();
351};
352
353interface MultiParamLoader {
354};
355
356interface GenotypeMiniLoader : MultiParamLoader {
357        //this constructor has the same number of arguments as the next one which is not allowed in idl
358    //void GenotypeMiniLoader(VirtFILE f);
359        void GenotypeMiniLoader([Const] DOMString filename);
360        GenotypeMini loadNextGenotype();
361};
362
363[NoDelete]
364interface StdioFileSystem_autoselect {
365        void StdioFileSystem_autoselect();
366};
367
368
369interface LoggerBase {
370        void LoggerBase(optional long opts = 0);
371};
372
373enum LoggerBase_LoggerOptions {
374        "LoggerBase::DontBlock",
375        "LoggerBase::CannotBeBlocked",
376        "LoggerBase::Enable",
377        "LoggerBase::Paused"
378};
379
380interface LoggerToMemory
381{
382        void LoggerToMemory(long opts, optional long minimal_level_to_store = 2);
383
384        void reset();
385        long getErrorCount();
386        long getWarningCount();
387        long getInfoCount();
388        long getStoredCount();
389        long getErrorLevel();
390        [Value] string getMessages();
391        [Value] string getCountSummary();
392        void handle([Const] DOMString obj, [Const] DOMString method, long level, [Const] DOMString msg);
393};
394
395enum LoggerToMemory_Options2 {
396        "LoggerToMemory::StoreFirstMessage",
397        "LoggerToMemory::StoreAllMessages"
398};
399
400interface LoggerToStdout {
401        void LoggerToStdout(optional long opts = 0, optional VirtFILE ffile);
402};
403
404
405interface VirtFILE {
406};
407
408interface StringFILE2 : VirtFILE {
409    void StringFILE2([Const] DOMString s, optional long _pos = 0);
410};
411
412interface SaveFileHelper {
413        void SaveFileHelper();
414        VirtFILE Vfopen([Const] DOMString path, [Const] DOMString mode);
415        ParamEntry getMinigenotype_paramtab();
416};
417
418interface XY {
419        void XY(long x, long y);
420        attribute long x;
421        attribute long y;
422};
423
424interface XYWH : XY {
425        void XYWH(long x, long y, long w, long h);
426        attribute long x;
427        attribute long y;
428        attribute long w;
429        attribute long h;
430};
431
432interface NNLayoutState {
433};
434
435interface NNLayoutState_Model : NNLayoutState {
436};
437
438interface NNLayoutState_Model_Fred : NNLayoutState_Model {
439        void NNLayoutState_Model_Fred(Model m);
440        long GetElements();
441        [Value] XYWH GetValueXYWH(long el);
442        void SetXYWH(long el, long x, long y, long w, long h);
443        long GetInputs(long el);
444        long GetLink(long el, long i);
445        [Value] XY GetLinkValueXY(long el, long i);
446};
447
448interface NNLayoutFunctionHelper {
449        void NNLayoutFunctionHelper();
450        void doLayout(long layout_type, NNLayoutState nn_layout);
451};
452
453interface GenoConverter {
454        [Const] attribute DOMString name;
455        [Value] attribute SString in_format;
456        [Value] attribute SString out_format;
457};
458
459interface GenoConv_f40 : GenoConverter{
460        void GenoConv_f40();
461};
462
463interface GenoConv_f90 : GenoConverter{
464        void GenoConv_f90();
465};
466
467interface GenoConv_fL0 : GenoConverter{
468        void GenoConv_fL0();
469};
470
471interface GenoConv_fBH : GenoConverter{
472        void GenoConv_fBH();
473};
474
475
476interface GenoConv_fS0s : GenoConverter{
477        void GenoConv_fS0s();
478};
479
480interface GenoConv_fH0 : GenoConverter{
481        void GenoConv_fH0();
482};
483
484interface GenoConvHelper{
485        void GenoConvHelper(GenoConverter genoConv);
486        [Const] DOMString getName();
487};
488
489interface GenoOperators {
490        void GenoOperators();
491        // TODO: static long roulette(const double *probtab, long count);
492        long checkValidity([Const] DOMString geno, [Const] DOMString genoname);
493        long validate(DOMString geno, [Const] DOMString genoname);
494        [Const] DOMString getSimplest();
495};
496
497interface Geno_f4 : GenoOperators {
498        void Geno_f4();
499};
500
501interface Geno_fH : GenoOperators {
502        void Geno_fH();
503};
504
505interface Geno_fB : GenoOperators {
506        void Geno_fB();
507};
508
509interface Geno_fL : GenoOperators {
510        void Geno_fL();
511};
512
513interface GenoOper_f9 : GenoOperators {
514        void GenoOper_f9();
515};
516
517interface GenoOper_fF : GenoOperators {
518        void GenoOper_fF();
519};
520
521interface GenoOper_fS : GenoOperators {
522        void GenoOper_fS();
523};
524
525
526interface GenoOperatorsHelper {
527        void GenoOperatorsHelper(GenoOperators genoOper);
528        long mutate([Const] DOMString geno);
529        long crossOver([Const] DOMString geno1, [Const] DOMString geno2);
530        [Value] SString getLastMutateGeno();
531        [Value] SString getLastCrossGeno1();
532        [Value] SString getLastCrossGeno2();
533        [Const] DOMString getSimplest();
534};
535
536interface ParamEntry {
537};
538
539interface ParamInterface {
540        long getGroupCount();
541        long getPropCount();
542        [Const] DOMString getName();
543        [Const] DOMString getDescription();
544        long findId([Const] DOMString n);
545        long findIdn([Const] DOMString naz, long n);
546        [Const] DOMString type(long i);
547        [Const] DOMString help(long i);
548        long flags(long i);
549        long group(long i);
550        [Const] DOMString grname(long gi);
551        [Value] SString get(long i);
552        [Value] SString getString(long i);
553        long getInt(long i);
554        double getDouble(long i);
555
556        [Value] SString getStringById([Const] DOMString prop);
557        long getIntById([Const] DOMString prop);
558        double getDoubleById([Const] DOMString prop);
559
560        long setIntFromString(long i, [Const] DOMString str, boolean strict);
561        long setDoubleFromString(long i, [Const] DOMString str);
562
563        long setInt(long i, long val);
564        long setDouble(long i, double val);
565        long setString(long i, [Const, Ref] SString str);
566
567        long setFromString(long i, [Const] DOMString str, boolean strict);
568
569        long setIntById([Const] DOMString prop, long value);
570        long setDoubleById([Const] DOMString prop, double value);
571        long setStringById([Const] DOMString prop, [Const] DOMString value);
572
573        //long getMinMaxInt(long prop, [Ref] long minimum, [Ref] long maximum, [Ref] long def);
574        //long getMinMaxDouble(long prop, [Ref] double minimum, [Ref] double maximum, [Ref] double def);
575        //long getMinMaxString(long prop, [Ref] long minimum, [Ref] long maximum, [Ref] SString def);
576        //
577        //static long getMinMaxIntFromTypeDef([Const] DOMString type, [Ref] long minimum, [Ref] long maximum, [Ref] long def);
578        //static long getMinMaxDoubleFromTypeDef([Const] DOMString type, [Ref] double minimum, [Ref] double maximum, [Ref] double def);
579        //static long getMinMaxStringFromTypeDef([Const] DOMString type, [Ref] long minimum, [Ref] long maximum, [Ref] SString def);
580
581        void setDefault();
582        void setDefault(long i);
583
584        void setMin();
585        void setMax();
586        void setMin(long i);
587        void setMax(long i);
588
589        [Value] static SString friendlyTypeDescrFromTypeDef([Const] DOMString type);
590        [Value] SString friendlyTypeDescr(long i);
591
592        void copyFrom(ParamInterface src);
593        void quickCopyFrom(ParamInterface src);
594
595        //long saveMultiLine(VirtFILE file, [Const] DOMString altname, optional boolean force = false);
596
597        static boolean isValidTypeDescription([Const] DOMString t);
598};
599
600interface SimpleAbstractParam : ParamInterface {
601
602};
603
604interface Param : SimpleAbstractParam {
605        void Param(ParamEntry t, VoidPtr o);
606        long saveMultiLine(VirtFILE file, [Const] DOMString altname, optional boolean force = false);
607};
608
609[Prefix = "ParamTree::"]
610interface NodePtr {
611        ParamTreeNode get();
612};
613
614[Prefix = "ParamTree::"]
615interface ParamTreeNode {
616        attribute ParamTree tree;
617        attribute ParamTreeNode parent;
618        [Value] attribute string name;
619        [Value] attribute NodePtr first_child;
620        [Value] attribute NodePtr next_sibling;
621        attribute long group_index;
622};
623
624interface ParamTree {
625        [Value] attribute ParamTreeNode root;
626        ParamTreeNode addNode(ParamTreeNode parent, [Ref, Const] string name, long group);
627        ParamTreeNode findNode(ParamTreeNode parent, [Ref, Const] string name);
628        void ParamTree(ParamInterface _pi);
629};
630
631interface MutableParamList : ParamInterface {
632
633};
634
635interface ParamTreeConfigured {
636        void ParamTreeConfigured();
637        attribute ParamTree tree;
638        [Value] attribute MutableParamList paramiface;
639        ParamTree generateTree();
640};
Note: See TracBrowser for help on using the repository browser.