Changeset 1726
- Timestamp:
- 2005-04-25T09:27:18+02:00 (19 years ago)
- Location:
- trunk/modeq
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modeq/dae.rml
r1725 r1726 139 139 datatype Flow = FLOW | NON_FLOW 140 140 141 (* LS: Added for variables in functions *)142 141 datatype VarDirection = INPUT | OUTPUT | BIDIR 143 142 144 143 (* LS: Removed VARVAL completely, and added Exp.Exp as an option to VAR *) 145 datatype Element = VAR of Exp.ComponentRef * 146 VarKind * 147 VarDirection * 148 Type * 149 Exp.Exp option * 150 InstDims * 151 StartValue * 152 Flow * 153 154 Absyn.Path list * (* Theclass the variable is instantiated from *)155 VariableAttributes option * 156 Absyn.Comment option (* this contains the comment and annotation from Absyn*)144 datatype Element = VAR of Exp.ComponentRef * (* varible name *) 145 VarKind * (* variable, constant, parameter, etc. *) 146 VarDirection * (* input, output or bidir *) 147 Type * (* one of the builtin types *) 148 Exp.Exp option * (* Binding expression e.g. for parameters*) 149 InstDims * (* dimension of original component *) 150 StartValue * (* value of start attribute *) 151 Flow * (* Flow of connector variable. Needed for 152 unconnected flow variables *) 153 Absyn.Path list * (* class the variable is instantiated from *) 154 VariableAttributes option * (* attributes: min,max,quantity..*) 155 Absyn.Comment option (* comment and annotation from Absyn*) 157 156 158 157 -
trunk/modeq/simcodegen.rml
r1725 r1726 1040 1040 print_exp2_str (Exp.BINARY(e1, op as Exp.SUB(ty), e2 as Exp.BINARY(e21, Exp.SUB(ty2), e22)),pri1) => s''' 1041 1041 1042 rule 1043 Exp.binop_priority op => pri2 & 1042 rule (* x^2 => x*x *) 1043 Exp.binop_priority op => pri2 & 1044 Exp.print_leftpar_str (pri1,pri2) => (s1, pri3) & 1045 print_exp2_str (e1,pri3) => s2 & 1046 Exp.print_rightpar_str (pri1,pri2) => s4 & 1047 Util.string_append_list([s1,s2, "*",s2,s4]) => res 1048 ------------------------ 1049 print_exp2_str (Exp.BINARY(e1, (op as Exp.POW(_)), Exp.ICONST(2)),pri1) => res 1050 1051 rule (* x^2 => x*x *) 1052 int_real(2) => two' & 1053 real_eq(two,two) => true & 1054 Exp.binop_priority op => pri2 & 1055 Exp.print_leftpar_str (pri1,pri2) => (s1, pri3) & 1056 print_exp2_str (e1,pri3) => s2 & 1057 Exp.print_rightpar_str (pri1,pri2) => s4 & 1058 Util.string_append_list([s1,s2, "*",s2,s4]) => res 1059 ------------------------ 1060 print_exp2_str (Exp.BINARY(e1, (op as Exp.POW(_)), Exp.RCONST(two)),pri1) => res 1061 1062 rule Exp.binop_priority op => pri2 & 1044 1063 Exp.print_leftpar_str (pri1,pri2) => (s1, pri3) & 1045 1064 print_exp2_str (e1,pri3) => s2 & … … 1051 1070 string_append(s'',s3) => s''' & 1052 1071 string_append(s''',")") => res & 1053 1072 string_append (res, s4) => res' 1054 1073 ------------------------ 1055 1074 print_exp2_str (Exp.BINARY(e1, (op as Exp.POW(_)), e2),pri1) => res' -
trunk/modeq/util.rml
r1709 r1726 185 185 relation string_append_list : string list => string 186 186 relation string_delimit_list : (string list, string) => string 187 relation string_delimit_list_2sep : (string list, string,string,int) => string 187 188 relation string_delimit_list_no_empty : (string list, string) => string 188 189 relation string_replace_char : (string, char, char) => string … … 1080 1081 string_delimit_list(f::r,delim) => str 1081 1082 end 1083 1084 (** relation: string_delimit_list_2sep 1085 ** author: PA 1086 ** 1087 ** This relation is similar to string_delimit_list, i.e it inserts string delimiters between 1088 ** consecutive strings in a list. But it also count the lists and inserts a second string delimiter 1089 ** when the counter is reached. This can be used when for instance outputting large lists of values 1090 ** and a newline is needed after ten or so items. 1091 **) 1092 1093 relation string_delimit_list_2sep : (string list, string,string,int) => string = 1094 1095 rule string_delimit_list_2sep2(str,sep1,sep2,n,0) => res 1096 ---------------------------- 1097 string_delimit_list_2sep(str,sep1,sep2,n) => res 1098 end 1099 1100 1101 (** relation: string_delimit_list_2sep2 1102 ** author: PA 1103 ** 1104 ** Helper relation to string_delimit_list_2sep 1105 **) 1106 1107 relation string_delimit_list_2sep2: (string list, string, string, int,int (* iterator*)) 1108 => string = 1109 1110 axiom string_delimit_list_2sep2([],_,_,_,_) => "" 1111 axiom string_delimit_list_2sep2([s],_,_,_,_) => s 1112 1113 rule (* special case for first element*) 1114 string_delimit_list_2sep2(r,sep1,sep2,n,1) => str1 & 1115 string_append_list([f,sep1,str1]) => str 1116 --------------------------- 1117 string_delimit_list_2sep2(f::r,sep1,sep2,n,0) => str 1118 1119 rule (* insert second delimiter*) 1120 int_mod(iter,n) => 0 & 1121 iter + 1 => iter' & 1122 string_delimit_list_2sep2(r,sep1,sep2,n,iter') => str1 & 1123 string_append_list([f,sep1,sep2,str1]) => str 1124 --------------------------- 1125 string_delimit_list_2sep2(f::r,sep1,sep2,n,iter) => str 1126 1127 rule (* not inserting second delimiter*) 1128 iter + 1 => iter' & 1129 string_delimit_list_2sep2(r,sep1,sep2,n,iter') => str1 & 1130 string_append_list([f,sep1,str1]) => str 1131 --------------------------- 1132 string_delimit_list_2sep2(f::r,sep1,sep2,n,iter) => str 1133 1134 rule print "string_delimit_list_2sep2 failed\n" 1135 ------------------------- 1136 string_delimit_list_2sep2(_,_,_,_,_) => fail 1137 end 1138 1082 1139 1083 1140 (** relation string_delimit_list_no_empty
Note: See TracChangeset
for help on using the changeset viewer.