Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion deploy/packaging/debian/kernel.noarch
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@
./usr/local/mdsplus/tdi/treeshr/TreeOpenEdit.fun
./usr/local/mdsplus/tdi/treeshr/TreeOpenNew.fun
./usr/local/mdsplus/tdi/treeshr/TreePut.fun
./usr/local/mdsplus/tdi/treeshr/TreePutDeserialized.fun
./usr/local/mdsplus/tdi/treeshr/TreePutRecord.fun
./usr/local/mdsplus/tdi/treeshr/TreeQuit.fun
./usr/local/mdsplus/tdi/treeshr/TreeSetCurrentShot.fun
Expand Down
2 changes: 0 additions & 2 deletions deploy/packaging/debian/matlab.noarch
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
./usr/local/mdsplus/matlab/private/javaConnect.m
./usr/local/mdsplus/matlab/private/javaExecute.m
./usr/local/mdsplus/matlab/private/javaFromMatlab.m
./usr/local/mdsplus/matlab/private/javaFromMatlabCell.m
./usr/local/mdsplus/matlab/private/javaFromMatlabStruct.m
./usr/local/mdsplus/matlab/private/javaToMatlab.m
./usr/local/mdsplus/matlab/private/javaToMatlabCell.m
./usr/local/mdsplus/matlab/private/javaToMatlabStruct.m
./usr/local/mdsplus/matlab/private/pythonActivate.m
./usr/local/mdsplus/matlab/private/pythonConnect.m
Expand Down
1 change: 0 additions & 1 deletion deploy/packaging/redhat/kernel.noarch
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@
./usr/local/mdsplus/tdi/treeshr/TreeOpenEdit.fun
./usr/local/mdsplus/tdi/treeshr/TreeOpenNew.fun
./usr/local/mdsplus/tdi/treeshr/TreePut.fun
./usr/local/mdsplus/tdi/treeshr/TreePutDeserialized.fun
./usr/local/mdsplus/tdi/treeshr/TreePutRecord.fun
./usr/local/mdsplus/tdi/treeshr/TreeQuit.fun
./usr/local/mdsplus/tdi/treeshr/TreeSetCurrentShot.fun
Expand Down
2 changes: 0 additions & 2 deletions deploy/packaging/redhat/matlab.noarch
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
./usr/local/mdsplus/matlab/private/javaConnect.m
./usr/local/mdsplus/matlab/private/javaExecute.m
./usr/local/mdsplus/matlab/private/javaFromMatlab.m
./usr/local/mdsplus/matlab/private/javaFromMatlabCell.m
./usr/local/mdsplus/matlab/private/javaFromMatlabStruct.m
./usr/local/mdsplus/matlab/private/javaToMatlab.m
./usr/local/mdsplus/matlab/private/javaToMatlabCell.m
./usr/local/mdsplus/matlab/private/javaToMatlabStruct.m
./usr/local/mdsplus/matlab/private/pythonActivate.m
./usr/local/mdsplus/matlab/private/pythonConnect.m
Expand Down
1 change: 0 additions & 1 deletion include/mdsobjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -4507,7 +4507,6 @@ namespace MDSplus
Data *get(const char *expr, Data **args, int nArgs);
Data *get(const char *expr) { return get(expr, 0, 0); }
void put(const char *path, char *expr, Data **args, int nArgs);
void put(const char *path, Data *data);
PutMany *putMany() { return new PutMany(this); }
GetMany *getMany() { return new GetMany(this); }
// Get TreeNode instance for (a subset of) TreeNode functionality in thin
Expand Down
10 changes: 4 additions & 6 deletions java/mdsobjects/src/main/java/MDSplus/Apd.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@ public Data getDescAt(int idx)
{
return descs[idx];
}

public int[] getShape()
{
return new int[]{nDescs};
}

public int[] getShape()
{
return new int[]{descs.length};
}
protected void resizeDescs(int newDim)
{
if (descs == null)
Expand Down
43 changes: 5 additions & 38 deletions java/mdsobjects/src/main/java/MDSplus/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,36 +96,17 @@ public Data get(java.lang.String expr, Data args[]) throws MdsException
{
if (!checkArgs(args))
throw new MdsException(
"Invalid arguments: only scalars and arrays arguments can be passed to Connection.get()");
java.lang.String expandedExpr;
if(expr.equals("$"))
{
expandedExpr = "serializeout(`("+expr+"))";
}
else
{
expandedExpr = "serializeout(`(data(("+expr+"))))";
}
Data serData = get(sockId, expandedExpr, args);
return Data.deserialize(serData.getByteArray());

"Invalid arguments: only scalars and arrays arguments can be passed to COnnection.get()");
return get(sockId, expr, args);
}

public Data get(java.lang.String expr) throws MdsException
{
java.lang.String expandedExpr = "serializeout(`(data(("+expr+"))))";
Data serData = get(sockId, expandedExpr, new Data[0]);
if(serData instanceof Array)
return Data.deserialize(serData.getByteArray());
else //error code
return serData;
return get(expr, new Data[0]);
}

public void put(java.lang.String path, java.lang.String expr, Data inArgs[]) throws MdsException
public void put(java.lang.String path, java.lang.String expr, Data args[]) throws MdsException
{
Data args[] = new Data[inArgs.length];
for(int i = 0; i < inArgs.length; i++)
args[i] = new Uint8Array(inArgs[i].serialize());
if (!checkArgs(args))
throw new MdsException(
"Invalid arguments: only scalars and arrays arguments can be passed to COnnection.put()");
Expand Down Expand Up @@ -164,19 +145,7 @@ public PutMany putMany()
{
return new PutManyInConnection();
}
public static void main(java.lang.String args[])
{
try {

MDSplus.Connection c = new MDSplus.Connection("localhost:8001");
c.openTree("test", -1);
System.out.println(c.get("anyapd"));
}catch(Exception exc)
{
System.out.println(exc);
}
}


////////// GetMany
class GetManyInConnection extends List implements GetMany
{
Expand Down Expand Up @@ -319,7 +288,5 @@ public void checkStatus(java.lang.String path) throws MdsException
throw new MdsException(retMsg.getString());
}
}



}
8 changes: 3 additions & 5 deletions java/mdsobjects/src/main/java/MDSplus/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,10 @@ public java.lang.String[] getStringArray() throws MdsException
return data.getStringArray();
}

public int getSize() throws MdsException
public int getSize()
{
final Data data = executeWithContext("SIZE($1)", this);
if (!(data instanceof Int32))
throw new MdsException("Cannot get data size");
return data.getInt();
final Data data = data();
return data.getSize();
}

public int getSizeInBytes()
Expand Down
1 change: 0 additions & 1 deletion java/mdsobjects/src/main/java/MDSplus/List.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public List()
public List(Data[] descs)
{
super(descs, null, null, null, null);
dtype = DTYPE_LIST;
}

public List(Data[] descs, Data help, Data units, Data error, Data validation)
Expand Down
6 changes: 3 additions & 3 deletions javamds/mdsobjects.c
Original file line number Diff line number Diff line change
Expand Up @@ -3936,12 +3936,12 @@ JNIEXPORT void JNICALL Java_MDSplus_Connection_put(
else
strcpy(path, inPath);

putExpr = malloc(strlen("TreePutDeserialized(") + strlen(expr) + strlen(path) + 5 +
putExpr = malloc(strlen("TreePut(") + strlen(expr) + strlen(path) + 5 +
nArgs * 2 + 2);
if (nArgs > 0)
sprintf(putExpr, "TreePutDeserialized(\'%s\',\'%s\',", path, expr);
sprintf(putExpr, "TreePut(\'%s\',\'%s\',", path, expr);
else
sprintf(putExpr, "TreePutDeserialized(\'%s\',\'%s\'", path, expr);
sprintf(putExpr, "TreePut(\'%s\',\'%s\'", path, expr);
for (varIdx = 0; varIdx < nArgs; varIdx++)
{
if (varIdx < nArgs - 1)
Expand Down
50 changes: 2 additions & 48 deletions matlab/mdsput.m
Original file line number Diff line number Diff line change
@@ -1,51 +1,5 @@
function [ status ] = mdsput( node, expression, varargin)
% MDSPUT put data into MDSplus tree node
% This routine uses the java or python interface
info = mdsInfo();
n = nargin - 2;
if info.usePython
args = cell(n, 1);
else
if info.isConnected
extra = 0;
else
extra = 1;
end
args = javaArray('MDSplus.Data', max(1, n + extra));
end
for k = 1 : n
argin = varargin(k);
if iscell(argin{1})
argout = mdsFromMatlab(argin{1});
else
argout = mdsFromMatlab(cell2mat(argin));
end
if info.usePython
args{k} = argout;
else
args(k) = argout;
end
end
% This routine invokes treeput(node, expression, ...)
status = mdsvalue(sprintf('treeput($, $%s)', repmat(', $', 1, nargin - 2)), node, expression, varargin{:});

try
if info.isConnected
if n > 0
if info.usePython
info.connection.put(node, expression, args{:});
else
info.connection.put(node, expression, args);
end
else
info.connection.put(node, expression);
end
else
[mdsres, mdsok] = mdsvalue(sprintf('treeput($, $%s)', repmat(', $', 1, nargin - 2)), node, expression, varargin{:});
if mdsok==0 || ~isnumeric(mdsres) || rem(mdsres,2)==0
throw(MException('MDSplus:treeput', 'treeput error %d: %s', mdsok, string(mdsres)));
end
end
status = 1;
catch err
status = 0;
error(err.message);
end
8 changes: 4 additions & 4 deletions matlab/private/javaFromMatlab.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
case 'uint8'
javaclass = 'MDSplus.Uint8';
case 'cell'
result = javaFromMatlabCell(value);
return
javaclass = 'MDSplus.String';
case 'struct'
result = javaFromMatlabStruct(value);
return
Expand All @@ -32,10 +31,11 @@
result = javaObject('MDSplus.String', value);
return
otherwise
throw(MException('MDSplus:javaFromMatlab', 'Unsupported type'))
result = value;
return
end
sz = size(value);
if isscalar(value)
if isequal(sz, [1, 1])
result = javaObject(javaclass, value);
else
result = javaObject(strcat(javaclass, 'Array'), reshape(value, [], 1), sz);
Expand Down
33 changes: 0 additions & 33 deletions matlab/private/javaFromMatlabCell.m

This file was deleted.

32 changes: 6 additions & 26 deletions matlab/private/javaFromMatlabStruct.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function result = javaFromMatlabStruct(value)
if ~isstruct(value)
if ~strcmp(class(value), 'struct')
throw(MException('MDSplus:javaFromMatlabStruct', 'only struct allowed'));
end

Expand All @@ -9,36 +9,16 @@
for fieldIdx = 1:length(fields)
fieldName = fields{fieldIdx};
fieldValue = value.(fieldName);
javaFromMatlab(fieldValue);
result.setItem(MDSplus.String(fieldName), javaFromMatlab(fieldValue));
end
elseif isvector(value)
result = MDSplus.List();
else
result = MDSplus.Apd();
numItems = length(value);
for itemIdx = 1:numItems
if isrow(value)
result.append(javaFromMatlabStruct(value(itemIdx)));
else
temp = MDSplus.List();
temp.append(javaFromMatlabStruct(value(itemIdx)));
result.append(temp);
end
end
elseif ismatrix(value)
result = MDSplus.List();
elemSize = size(value);
for rowIdx = 1:elemSize(1)
result.append(javaFromMatlabStruct(value(rowIdx,:)));
end
else
result = MDSplus.List();
elemSize = size(value);
n = ndims(value);
idx = cell(1,n);
idx(:) = {':'};
for currDim = 1:elemSize(end)
idx{end} = currDim;
result.append(javaFromMatlab(value(idx{:})));
result.setDescAt(itemIdx - 1, javaFromMatlab(value(itemIdx)));
end

end

end
6 changes: 2 additions & 4 deletions matlab/private/javaToMatlab.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@
case 'MDSplus.Float32Array'
result = reshape(mdsthing.getFloatArray, shape);
case 'MDSplus.StringArray'
result = reshape(string(mdsthing.getStringArray), shape);
result = reshape(cellstr(string(mdsthing.getStringArray)), shape);
case 'MDSplus.Dictionary'
result = javaToMatlabStruct(mdsthing);
case 'MDSplus.List'
result = javaToMatlabStruct(mdsthing);
case 'MDSplus.Apd'
result = javaToMatlabCell(mdsthing);
result = javaToMatlabStruct(mdsthing);
otherwise
throw(MException('MDSplus:mdsToMatlab', 'class %s not supported by mdsToMatlab function\n', class(mdsthing)));
end
Expand Down
32 changes: 0 additions & 32 deletions matlab/private/javaToMatlabCell.m

This file was deleted.

Loading