Changeset 754 for cpp/frams


Ignore:
Timestamp:
03/02/18 18:46:54 (7 years ago)
Author:
Maciej Komosinski
Message:

More strict rules for Param type descriptions and "unlimited range value" and "unlimited string length": "d 0 -1", "f 0 -1", "s 0 0", "s 1 0" (see formatspec.html)

Location:
cpp/frams
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/config/f0-SDK.def

    r732 r754  
    33GROUP(Visual)
    44PROP(se,0,1024,startenergy,f,,,,startenergy)
    5 PROP(Vstyle,1,0,vis_style,s,0,-1,,vis_style)
     5PROP(Vstyle,1,0,vis_style,s,0,0,,vis_style)
    66ENDCLASS
    77
     
    2727PROP(rz,0,1024,rot.z,f,,,,rot.z)
    2828PROP(i,1,0,`info',s,,,,info)
    29 PROP(Vstyle,2,0,vis_style,s,0,-1,part,vis_style)
     29PROP(Vstyle,2,0,vis_style,s,0,0,part,vis_style)
    3030XPROP(vs,2,0,visual thickness,f,0.05,0.7,0.2,vsize)
    3131XPROP(vr,2,0,red component,f,0.0,1.0,1.0,vcolor.x)
     
    5252PROP(stam,2,0,stamina,f,0.0,1.0,0.25,stamina)
    5353PROP(i,2,0,`info',s,,,,info)
    54 PROP(Vstyle,3,0,vis_style,s,0,-1,joint,vis_style)
     54PROP(Vstyle,3,0,vis_style,s,0,0,joint,vis_style)
    5555XPROP(vr,3,0,red component,f,0.0,1.0,1.0,vcolor.x)
    5656XPROP(vg,3,1024,green component,f,0.0,1.0,1.0,vcolor.y)
     
    7070PROP(stam,2,0,stamina,f,0.0,1.0,0.25,stamina)
    7171PROP(i,2,0,`info',s,,,,info)
    72 PROP(Vstyle,3,0,vis_style,s,0,-1,joint,vis_style)
     72PROP(Vstyle,3,0,vis_style,s,0,0,joint,vis_style)
    7373XPROP(vr,3,0,red component,f,0.0,1.0,1.0,vcolor.x)
    7474XPROP(vg,3,1024,green component,f,0.0,1.0,1.0,vcolor.y)
     
    8484PROP(d,1,0,details,s,,,N,details,GETSET)
    8585PROP(i,1,0,`info',s,,,,info)
    86 PROP(Vstyle,2,0,vis_style,s,0,-1,neuro,vis_style)
     86PROP(Vstyle,2,0,vis_style,s,0,0,neuro,vis_style)
    8787PROP(getInputCount,0,1+2,`input count',d,,,,inputCount,GETONLY)
    8888PROP(getInputNeuroDef,0,1+2,`get input neuron',p oNeuroDef(d),,,,p_getInputNeuroDef,PROCEDURE)
  • cpp/frams/config/f0.def

    r732 r754  
    33GROUP(Visual)
    44PROP(se,0,1024,startenergy,f,,,,startenergy)
    5 PROP(Vstyle,1,0,vis_style,s,0,-1,,vis_style)
     5PROP(Vstyle,1,0,vis_style,s,0,0,,vis_style)
    66ENDCLASS
    77
     
    2727PROP(rz,0,1024,rot.z,f,,,,rot.z)
    2828PROP(i,1,0,`info',s,,,,info)
    29 PROP(Vstyle,2,0,vis_style,s,0,-1,part,vis_style)
     29PROP(Vstyle,2,0,vis_style,s,0,0,part,vis_style)
    3030XPROP(vs,2,0,visual thickness,f,0.05,0.7,0.2,vsize)
    3131XPROP(vr,2,0,red component,f,0.0,1.0,1.0,vcolor.x)
     
    5252PROP(stam,2,0,stamina,f,0.0,1.0,0.25,stamina)
    5353PROP(i,2,0,`info',s,,,,info)
    54 PROP(Vstyle,3,0,vis_style,s,0,-1,joint,vis_style)
     54PROP(Vstyle,3,0,vis_style,s,0,0,joint,vis_style)
    5555XPROP(vr,3,0,red component,f,0.0,1.0,1.0,vcolor.x)
    5656XPROP(vg,3,1024,green component,f,0.0,1.0,1.0,vcolor.y)
     
    7070PROP(stam,2,0,stamina,f,0.0,1.0,0.25,stamina)
    7171PROP(i,2,0,`info',s,,,,info)
    72 PROP(Vstyle,3,0,vis_style,s,0,-1,joint,vis_style)
     72PROP(Vstyle,3,0,vis_style,s,0,0,joint,vis_style)
    7373XPROP(vr,3,0,red component,f,0.0,1.0,1.0,vcolor.x)
    7474XPROP(vg,3,1024,green component,f,0.0,1.0,1.0,vcolor.y)
     
    8484PROP(d,1,0,details,s,,,N,details,GETSET)
    8585PROP(i,1,0,`info',s,,,,info)
    86 PROP(Vstyle,2,0,vis_style,s,0,-1,neuro,vis_style)
     86PROP(Vstyle,2,0,vis_style,s,0,0,neuro,vis_style)
    8787PROP(getInputCount,0,1+2,`input count',d,,,,inputCount,GETONLY)
    8888PROP(getInputNeuroDef,0,0,`get input neuron',p oNeuroDef(d),,,,p_getInputNeuroDef,PROCEDURE)
  • cpp/frams/model/f0-SDK-classes.h

    r732 r754  
    1010 {"Visual",},
    1111 {"se",0,1024,"startenergy","f",FIELD(startenergy),},
    12  {"Vstyle",1,0,"vis_style","s 0 -1 ",FIELD(vis_style),},
     12 {"Vstyle",1,0,"vis_style","s 0 0 ",FIELD(vis_style),},
    1313 {0,0,0,}
    1414};
     
    4444 {"rz",0,1024,"rot.z","f",FIELD(rot.z),},
    4545 {"i",1,0,"info","s",FIELD(info),},
    46  {"Vstyle",2,0,"vis_style","s 0 -1 part",FIELD(vis_style),},
     46 {"Vstyle",2,0,"vis_style","s 0 0 part",FIELD(vis_style),},
    4747 {"vs",2,0,"visual thickness","f 0.05 0.7 0.2",FIELD(vsize),},
    4848 {"vr",2,0,"red component","f 0.0 1.0 1.0",FIELD(vcolor.x),},
     
    8888 {"stam",2,0,"stamina","f 0.0 1.0 0.25",FIELD(stamina),},
    8989 {"i",2,0,"info","s",FIELD(info),},
    90  {"Vstyle",3,0,"vis_style","s 0 -1 joint",FIELD(vis_style),},
     90 {"Vstyle",3,0,"vis_style","s 0 0 joint",FIELD(vis_style),},
    9191 {"vr",3,0,"red component","f 0.0 1.0 1.0",FIELD(vcolor.x),},
    9292 {"vg",3,1024,"green component","f 0.0 1.0 1.0",FIELD(vcolor.y),},
     
    121121 {"stam",2,0,"stamina","f 0.0 1.0 0.25",FIELD(stamina),},
    122122 {"i",2,0,"info","s",FIELD(info),},
    123  {"Vstyle",3,0,"vis_style","s 0 -1 joint",FIELD(vis_style),},
     123 {"Vstyle",3,0,"vis_style","s 0 0 joint",FIELD(vis_style),},
    124124 {"vr",3,0,"red component","f 0.0 1.0 1.0",FIELD(vcolor.x),},
    125125 {"vg",3,1024,"green component","f 0.0 1.0 1.0",FIELD(vcolor.y),},
     
    150150 {"d",1,0,"details","s",GETSET(details),},
    151151 {"i",1,0,"info","s",FIELD(info),},
    152  {"Vstyle",2,0,"vis_style","s 0 -1 neuro",FIELD(vis_style),},
     152 {"Vstyle",2,0,"vis_style","s 0 0 neuro",FIELD(vis_style),},
    153153 {"getInputCount",0,1+2,"input count","d",GETONLY(inputCount),},
    154154 {"getInputNeuroDef",0,1+2,"get input neuron","p oNeuroDef(d)",PROCEDURE(p_getInputNeuroDef),},
  • cpp/frams/param/param.cpp

    r745 r754  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2017  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    801801        {
    802802        case 'd':
    803         {paInt a, b, c; if (getMinMaxIntFromTypeDef(t, a, b, c) == 1) return false; }
     803        {
     804                paInt a, b, c;
     805                int have = getMinMaxIntFromTypeDef(t, a, b, c);
     806                if (have == 1) return false;
     807                if ((have >= 2) && (b < a) && (a != 0) && (b != -1)) return false; // max<min meaning 'undefined' is only allowed as "d 0 -1"
     808        }
    804809                break;
    805810        case 'f':
    806         {double a, b, c; if (getMinMaxDoubleFromTypeDef(t, a, b, c) == 1) return false; }
     811        {
     812                double a, b, c;
     813                int have = getMinMaxDoubleFromTypeDef(t, a, b, c);
     814                if (have == 1) return false;
     815                if ((have >= 2) && (b < a) && (a != 0) && (b != -1)) return false; // max<min meaning 'undefined' is only allowed as "f 0 -1"
     816        }
     817                break;
     818        case 's':
     819        {
     820                int a, b; SString c;
     821                int have = getMinMaxStringFromTypeDef(t, a, b, c);
     822                //if (have == 1) return false; //not sure?
     823                if ((have >= 1) && (!((a == 0) || (a == 1)))) return false; // 'min' for string (single/multi) can be only 0 or 1
     824                if ((have >= 2) && (b < 0)) return false; // max=0 means unlimited, max<0 is not allowed
     825        }
    807826                break;
    808827        }
Note: See TracChangeset for help on using the changeset viewer.