Upgrade Information

Summary

We make every effort to keep Gsharp backwards compatible, but sometimes new functionality or other improvements do introduce differences between releases.

Changes since Gsharp 3.2:

  • New enumerated values have been added: sundef represents an undefined string. stdin, stdout and stderr are preset values for use with fread and fwrite.
  • The third argument to GuiSetString and GuiSwitchSetState is now used to specify the actual callback reason, not just whether the callback should be called or not.
  • The default behaviour of the ScriptBuilder is now to reset the graphics, but not the data whenever a script is run. In previous releases they were both reset.

Changes since Gsharp 3.1 or earlier:

Details

  • New enumerated values have been created. If you have been creating your own variables with the same name as any of these enumerated values, then you must remove the declaration of those variable. You can of course use the enumerated value instead.

    sundef. In most places it is possible to use undef (an undefined float) to represent an undefined string. e.g.

    page_1.XuNtitleText = undef;
    However in a few places this is not possible e.g.
    page_1.XuNtitleText = if(domainIs2D, "My Title", undef);
    In these cases you must use sundef e.g.
    page_1.XuNtitleText = if(domainIs2D, "My Title", sundef);
    In Gsharp 3.2 and earlier the solution has been to declare a local string variable called sundef. e.g.
    function MyFunc()
      string sundef;
      page_1.XuNtitleText = if(domainIs2D, "My Title", sundef);
    endfunction
    stdin, stdout and stderr. These values can be used with the functions fread and fwrite e.g.
  • fwrite(stderr, "We have a problem");
  • The third argument to GuiSetString and GuiSwitchSetState is now used to specify the actual callback reason, not just whether the callback should be called or not. There is no need to modify any calls for which the callback has not been requested e.g. GuiSetString("gsharp_1.mydialog.field", "3.0", false), but it is recommended that you modify any that do to use the Gsharp 3.2 default XuCR_ACTIVATE e.g. GuiSetString("gsharp_1.mydialog.field", "3.0", XuCR_ACTIVATE). You may of course prefer to take advantage of this new functionality and rewrite your code. The callback reason can be any integer - it does not have to be one of the preset values.
  • Reset the graphics, but not the data. In previous releases Gsharp would reset both the data and the graphics whenever a script was run. Many people were surprised to find their data missing after running a script and so the reset option has been split into two parts and reset data is off by default.
  • Gsharp 3.2 and later uses doubles throughout for storing, processing and plotting numbers. Any users who have linked in their own code to Gsharp, will need to modify it to make sure that it uses doubles instead of floats. For example,
    VarSetRealData(dt, i, 1, 1, (float) i);

    should become:

    VarSetRealData(dt, i, 1, 1, (double) i);

    N.B. The typedef VarFloat is represented as a float in earlier releases and a double in later releases. Code like the following need not be modified:

    VarSetRealData(dt, i, 1, 1, (VarFloat) i);
  • Gsharp 3.2 and later uses doubles throughout for storing, processing and plotting numbers. This means that fread will write doubles and fwrite will expect doubles. fwrite_old and fread_old can be used to work with data written with Gsharp 3.1 or earlier. See the documentation of these functions for examples of how to use them and how to convert your old data files.
  • In Gsharp 3.2 and later, the input functions - input_file, input_float, input_string, input_dateset and input_selection all now return undef if the user presses Cancel and execution of the script continues. On UNIX, previous versions would stop with a warning and on Windows, input_float would continue, but return a value of zero.

    You should check all your uses of these functions to ensure that they handle the undef correctly. e.g.

    float newHeight;
    newHeight = input_float("EnterHeight);
    if (newHeight=undef)  return;
    WORK.Height = newHeight;