Specman print reference to struct - specman

I have a very big struct.
Is it possible to print to the console only the reference to this struct so that it will be possible afterwards to click on it and browse it through "data browser" window?

You can do this, for example, simply by using the out() routine. By default, it prints a struct exactly in the form that can later be clicked to open it in data browser. Or similarly with message() or any other similar routine.
In fact, this is what the default to_string() method returns for a struct. And out(), message(), etc. use to_string() to decide how to display each of their parameters.

Related

Show the value of the property and not just the type

In our dear VS Code when we hover in any variable the vscode by default shows the type of this variable, when it is an object, it shows the structure of the object.
e.g:
I would like to know if in addition to showing the type or structure it is possible to show the value of the properties.
If this is not possible in the vscode itself, is there any extension that does something like this?
The closest you can get to what you want (show variables value), is to add the variable in the debug window to the watch list. In debug mode, when you hit a breakpoint, your watch will evaluate the value at the current time (whether its been set, or not etc.) and will output what it is in that window for you.
See below:

MATLAB member function suggestion

If for example you have acquired a object of type handleplot with expression like below:
handle = plot(t,functoin1 , t , function2 ) ;
Now handle will be an array that contains two elements, handle(1) and handle(2). Now suppose you want to change some properties of one of these objects, like set a LineWidth, change the Color, or the like.
Is there any way in which you can activate auto-completion or suggestions when you type handle(1). (note the memebership operator .)? I am looking for the automatic suggestions that MATLAB provides for member functions in a combobox near the blinking cursor, similar to the way other IDEs provide this feature:
MATLAB's objects support tab completion. After typing handle(1). simply hit tab and you will receive a list of available methods and properties of the graphics object.
If you want more help on a method, you will also get a popup dialog of the method and the accepted input arguments.
If you want to programmatically get a list of properties of an object, you can use properties
properties(t)
If you want a listing of all properties and their values, just use get
get(t)
i use this method ...
for example i'm writing a program in matlab editor and when im want to know the properties of an object just stop coding and run the program , know it's have my object (for example handle) and know i can write the properties(handle) in command window to know the exact properties of handle . as Suever says .

Access to VISU elements on Codesys 3.5.8

I need to access to a "combo box array" object's properties from my Main (PRG) on Codesys 3.5.8.
How can I do this?
Unfortunately you can't access the combo box array properties directly. You are going to access them through the visualization. Since a visualization is like a FB (or class if you're from the object oriented world) you are going to have to create a visualization with input and output variables. Do this in the Interface Editor for the visualization. Use the input and output variables in the visualization for the properties you want to access (such as combo box arry properties). You then create another visualization and drag in the previous visualization (creating an instance of the visualization). You can then assign variables that are available to the Main program.
For example
//inputs
VAR_INPUT
number:INT;
InGear:BOOL;
InCam:BOOL;
END_VAR
//outputs
VAR_IN_OUT
axisIndex:INT;
END_VAR
This depends on the property. If it is something like position for example, you may create variable in your program and set that variable in the property directly, just like you bind other properties. Thus you can work with that variable directly in the programm.

Change local variable or function parameter in google chrome

I'm using chrome's devtools to debug/modify a non-local javascript file(so I can't edit it).
The code is rather complex and defines function inside of functions and uses these pointers throughout.
The point is that I do not know where I'm exactly at in the process but I can set a breakpoint to a variable I need to modify. BUT I can't figure out how to modify it. I can add a watch or modify it under the locals panel BUT it won't actually change (after stepping once the value reverts to original)
So how can I change the variable? I don't know why it is so difficult. In my traditional debugging you can simply edit the value in the watch or locals and it will modify it. I've tried modifying it at the console but I guess I don't know the complete path to the variable and I always get an undefined variable.
All I want to do is modify a local variable or argument in side some function I set a breakpoint at.
Try doing this in the console. E.g.: window.myVar = "newValue"
First watch the variable, second in Scope tab you can change the value of the var!

Get the value of a selected java field in a eclipse view

I making a eclipse view that is working with selected elements from other views.
Let say I have opened a java file in the editor that has the following fields in it:
private String world = " world!"
private String hello = "hello" + world;
When I select "hello" in the Outline view I'm able to get IFiled selection and I have access to it's properties, but what i need is the true value of the field ("hello world!").
Any idea how can I do that?
Thanks.
There is no value information available for variables before runtime (maybe except constant values), so such expressions cannot be evaluated (except using some serious inference about the variables). And I don't think these expressions could be evaluated even in theory, because the referenced variables might gain their values even from external input (that cannot be available during compiletime).
On the other hand, it is possible to evaluate such conditions using the JDT Debugger, there is a Display view for such reasons, and or the Inspect options. This way it is possible to get the selected values, as they can be read from the JVM. On the other hand, this information is not available in the Java AST but you have to use the debugger model.