Hex Editor - Binary File Editing Software for Windows
Download Hex Editor Neo Hide this button

Attaching Scripts

External functions referenced in your structure definition files must be defined in separate files. Hex Editor Neo supports functions written in JavaScript.

Use the following syntax to attach a script file to the structure definition file:

#pragma script(path-to-script-file)        

Path-to-script-file is a string containing the absolute or relative (to the structure definition file) path to a script file. Only JavaScript external files (with any extension) are supported.

As with included files, Hex Editor Neo automatically rescans a file if it is modified outside the editor.

Examples

functions.js
function f()
{
    return 10;
}
structure.h:
#pragma script("functions.js")

public struct A
{
    char array[f()];
};

javascript Keyword

In addition, JavaScript code may be specified in the structure definition file using the javascript keyword:

javascript
{
  function f()
  {
    return 10;
  }
};

public struct A
{
  char array[f()];
};

The number of javascript blocks is not limited. All blocks are processed before any structure is bound, so all functions declared in these blocks are always visible to any structure, regardless of the place where you define them.