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

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

Loads genotypes properly using Framsticks SDK methods instead of ad-hoc js parsing

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