JSCOptions: JavaScriptCore GLib Reference Manual

## JSCOptions JSCOptions — JavaScript options |

## Functions

gboolean | jsc_options_set_boolean ()
gboolean | jsc_options_get_boolean ()
gboolean | jsc_options_set_int ()
gboolean | jsc_options_get_int ()
gboolean | jsc_options_set_uint ()
gboolean | jsc_options_get_uint ()
gboolean | jsc_options_set_size ()
gboolean | jsc_options_get_size ()
gboolean | jsc_options_set_double ()
gboolean | jsc_options_get_double ()
gboolean | jsc_options_set_string ()
gboolean | jsc_options_get_string ()
gboolean | jsc_options_set_range_string ()
gboolean | jsc_options_get_range_string ()
gboolean | (*JSCOptionsFunc) ()
void | jsc_options_foreach ()
GOptionGroup * | jsc_options_get_option_group ()

## Types and Values

enum | JSCOptionType
#define | JSC_OPTIONS_USE_JIT
#define | JSC_OPTIONS_USE_DFG
#define | JSC_OPTIONS_USE_FTL
#define | JSC_OPTIONS_USE_LLINT

## Description

JavaScript options allow changing the behavior of the JavaScript engine. They affect the way the engine works, so the options must be set at the very beginning of the program execution, before any other JavaScript API call. Most of the options are only useful for testing and debugging. Only a few of them are documented; you can use the undocumented options at your own risk. (You can find the list of options in the WebKit source code).

The API allows to set and get any option using the types defined in JSCOptionType. You can also iterate all the available options using `jsc_options_foreach()` and passing a JSCOptionsFunc callback. If your application uses GOptionContext to handle command line arguments, you can easily integrate the JSCOptions by adding the GOptionGroup returned by `jsc_options_get_option_group()`.

## Functions

### jsc_options_set_boolean ()

    gboolean
    jsc_options_set_boolean (const char *option,
                             gboolean value);

Set `option` as a gboolean value.

#### Parameters

option | the option identifier |
value | the value to set |

#### Returns

`TRUE` if option was correctly set or `FALSE` otherwise.

Since: 2.24

### jsc_options_get_boolean ()

    gboolean
    jsc_options_get_boolean (const char *option,
                             gboolean *value);

Get `option` as a gboolean value.

#### Parameters

option | the option identifier |
value | return location for the option value. | [out]

#### Returns

`TRUE` if `value` has been set or `FALSE` if the option doesn't exist

Since: 2.24

### jsc_options_set_int ()

    gboolean
    jsc_options_set_int (const char *option,
                         gint value);

Set `option` as a gint value.

#### Parameters

option | the option identifier |
value | the value to set |

#### Returns

`TRUE` if option was correctly set or `FALSE` otherwise.

Since: 2.24

### jsc_options_get_int ()

    gboolean
    jsc_options_get_int (const char *option,
                         gint *value);

Get `option` as a gint value.

#### Parameters

option | the option identifier |
value | return location for the option value. | [out]

#### Returns

`TRUE` if `value` has been set or `FALSE` if the option doesn't exist

Since: 2.24

### jsc_options_set_uint ()

    gboolean
    jsc_options_set_uint (const char *option,
                          guint value);

Set `option` as a guint value.

#### Parameters

option | the option identifier |
value | the value to set |

#### Returns

`TRUE` if option was correctly set or `FALSE` otherwise.

Since: 2.24

### jsc_options_get_uint ()

    gboolean
    jsc_options_get_uint (const char *option,
                          guint *value);

Get `option` as a guint value.

#### Parameters

option | the option identifier |
value | return location for the option value. | [out]

#### Returns

`TRUE` if `value` has been set or `FALSE` if the option doesn't exist

Since: 2.24

### jsc_options_set_size ()

    gboolean
    jsc_options_set_size (const char *option,
                          gsize value);

Set `option` as a gsize value.

#### Parameters

option | the option identifier |
value | the value to set |

#### Returns

`TRUE` if option was correctly set or `FALSE` otherwise.

Since: 2.24

### jsc_options_get_size ()

    gboolean
    jsc_options_get_size (const char *option,
                          gsize *value);

Get `option` as a gsize value.

#### Parameters

option | the option identifier |
value | return location for the option value. | [out]

#### Returns

`TRUE` if `value` has been set or `FALSE` if the option doesn't exist

Since: 2.24

### jsc_options_set_double ()

    gboolean
    jsc_options_set_double (const char *option,
                            gdouble value);

Set `option` as a gdouble value.

#### Parameters

option | the option identifier |
value | the value to set |

#### Returns

`TRUE` if option was correctly set or `FALSE` otherwise.

Since: 2.24

### jsc_options_get_double ()

    gboolean
    jsc_options_get_double (const char *option,
                            gdouble *value);

Get `option` as a gdouble value.

#### Parameters

option | the option identifier |
value | return location for the option value. | [out]

#### Returns

`TRUE` if `value` has been set or `FALSE` if the option doesn't exist

Since: 2.24

### jsc_options_set_string ()

    gboolean
    jsc_options_set_string (const char *option,
                            const char *value);

Set `option` as a string.

#### Parameters

option | the option identifier |
value | the value to set |

#### Returns

`TRUE` if option was correctly set or `FALSE` otherwise.

Since: 2.24

### jsc_options_get_string ()

    gboolean
    jsc_options_get_string (const char *option,
                            char **value);

Get `option` as a string.

#### Parameters

option | the option identifier |
value | return location for the option value. | [out]

#### Returns

`TRUE` if `value` has been set or `FALSE` if the option doesn't exist

Since: 2.24

### jsc_options_set_range_string ()

    gboolean
    jsc_options_set_range_string (const char *option,
                                  const char *value);

Set `option` as a range string. The string must be in the format [!]<low>[:<high>] where low and high are guint values. Values between low and high (both included) will be considered in the range, unless ! is used to invert the range.

#### Parameters

option | the option identifier |
value | the value to set |

#### Returns

`TRUE` if option was correctly set or `FALSE` otherwise.

Since: 2.24

### jsc_options_get_range_string ()

    gboolean
    jsc_options_get_range_string (const char *option,
                                  char **value);

Get `option` as a range string. The string must be in the format [!]<low>[:<high>] where low and high are guint values. Values between low and high (both included) will be considered in the range, unless ! is used to invert the range.

#### Parameters

option | the option identifier |
value | return location for the option value. | [out]

#### Returns

`TRUE` if `value` has been set or `FALSE` if the option doesn't exist

Since: 2.24

### JSCOptionsFunc ()

    gboolean
    (*JSCOptionsFunc) (const char *option,
                       JSCOptionType type,
                       const char *description,
                       gpointer user_data);

Function used to iterate options.

Not that `description` string is not localized.

#### Parameters

option | the option name |
type | the option JSCOptionType |
description | the option description, or `NULL`. | [nullable]
user_data | user data |

#### Returns

`TRUE` to stop the iteration, or `FALSE` otherwise

Since: 2.24

### jsc_options_foreach ()

    void
    jsc_options_foreach (JSCOptionsFunc function,
                         gpointer user_data);

Iterates all available options calling `function` for each one. Iteration can stop early if `function` returns `FALSE`.

#### Parameters

function | a JSCOptionsFunc callback. | [scope call]
user_data | callback user data |

Since: 2.24

### jsc_options_get_option_group ()

    GOptionGroup *
    jsc_options_get_option_group (void);

Create a GOptionGroup to handle JSCOptions as command line arguments. The options will be exposed as command line arguments with the form --jsc-<option>=<value>. Each entry in the returned GOptionGroup is configured to apply the corresponding option during command line parsing. Applications only need to pass the returned group to `g_option_context_add_group()`, and the rest will be taken care for automatically.

#### Returns

a GOptionGroup for the JSCOptions.

[transfer full]

Since: 2.24

## Types and Values

### enum JSCOptionType

Enum values for options types.

#### Members

JSC_OPTION_BOOLEAN | A gboolean option type. |
JSC_OPTION_INT | A gint option type. |
JSC_OPTION_UINT | A guint option type. |
JSC_OPTION_SIZE | A gsize options type. |
JSC_OPTION_DOUBLE | A gdouble options type. |
JSC_OPTION_STRING | A string option type. |
JSC_OPTION_RANGE_STRING | A range string option type. |

Since: 2.24

### JSC_OPTIONS_USE_JIT

    #define JSC_OPTIONS_USE_JIT   "useJIT"

Allows the executable pages to be allocated for JIT and thunks if `TRUE`. Option type: `JSC_OPTION_BOOLEAN` Default value: `TRUE`.

Since: 2.24

### JSC_OPTIONS_USE_DFG

    #define JSC_OPTIONS_USE_DFG   "useDFGJIT"

Allows the DFG JIT to be used if `TRUE`. Option type: `JSC_OPTION_BOOLEAN` Default value: `TRUE`.

Since: 2.24

### JSC_OPTIONS_USE_FTL

    #define JSC_OPTIONS_USE_FTL   "useFTLJIT"

Allows the FTL JIT to be used if `TRUE`. Option type: `JSC_OPTION_BOOLEAN` Default value: `TRUE`.

Since: 2.24

### JSC_OPTIONS_USE_LLINT

    #define JSC_OPTIONS_USE_LLINT "useLLInt"

Allows the LLINT to be used if `TRUE`. Option type: `JSC_OPTION_BOOLEAN` Default value: `TRUE`.

Since: 2.24