Skip to content

Commit

Permalink
jfc : fix timers output and tag getValue() for arrays/udts
Browse files Browse the repository at this point in the history
  • Loading branch information
pquiring committed Jul 4, 2017
1 parent fe542fe commit 196974f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions projects/jfcontrols/src/jfcontrols/app/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public static void addMessage(String msg) {
msgs += "\r\n";
}

public static void trace() {
try { throw new Exception(); } catch (Exception e) { JFLog.log(e); }
}

public static void serviceStart(String args[]) {
main(args);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public String getDesc() {
}

public String getCode(int[] types, boolean[] array, boolean[] unsigned) {
return "enabled = timer_off_delay(enabled, tags);";
return "enabled = timer_off_delay(enabled, tags);\r\n";
}

public int getTagsCount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public String getDesc() {
}

public String getCode(int[] types, boolean[] array, boolean[] unsigned) {
return "enabled = timer_on_delay(enabled, tags);";
return "enabled = timer_on_delay(enabled, tags);\r\n";
}

public int getTagsCount() {
Expand Down
2 changes: 1 addition & 1 deletion projects/jfcontrols/src/jfcontrols/panels/NodeRoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public String saveLogic(SQL sql) {
sb.append('|');
break;
case '#':
sql.execute("insert into blocks (fid,rid,bid,name,tags) values (" + fid + "," + rid + "," + bid + ",'" + node.blk.getName() + "'," + SQL.quote(node.getTags()) + ")");
sql.execute("insert into jfc_blocks (fid,rid,bid,name,tags) values (" + fid + "," + rid + "," + bid + ",'" + node.blk.getName() + "'," + SQL.quote(node.getTags()) + ")");
sb.append(Integer.toString(bid));
bid++;
sb.append('|');
Expand Down
14 changes: 11 additions & 3 deletions projects/jfcontrols/src/jfcontrols/tags/LocalTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import javaforce.*;

import jfcontrols.app.*;

public class LocalTag extends MonitoredTag {
private int tid;
private Object arrayLock = new Object();
Expand All @@ -18,9 +20,12 @@ public class LocalTag extends MonitoredTag {
private HashMap<String, Integer> mids;
private String memberComments[];
private String comment;
private String name;
private String udtname;

public LocalTag(String name, int type, boolean unsigned, boolean array, SQL sql) {
super(type, unsigned, array);
this.name = name;
tid = Integer.valueOf(sql.select1value("select id from jfc_tags where cid=0 and name=" + SQL.quote(name)));
comment = sql.select1value("select comment from jfc_tags where cid=0 and id=" + tid);
if (udt) {
Expand All @@ -31,6 +36,7 @@ public LocalTag(String name, int type, boolean unsigned, boolean array, SQL sql)
mids.put(data[a][0], Integer.valueOf(data[a][1]));
memberComments[a] = data[a][2];
}
udtname = sql.select1value("select name from jfc_udts where uid=" + type);
}
if (array || udt) {
values = new HashMap<>();
Expand Down Expand Up @@ -78,9 +84,11 @@ private void readValue(TagValue tv) {
}

public String getValue() {
if (array || udt) {
JFLog.log("Error:LocalTag array:must call getIndex() or getMember()");
return null;
if (array) {
return name + "[]";
}
if (udt) {
return udtname;
}
return getValue(0, 0, 0);
}
Expand Down

0 comments on commit 196974f

Please sign in to comment.