{
  "synLogic": "int $ret \u003d $api($1, $2, $3, $4, $5);",
  "help": "",
  "notes": "Arguments details: \n1. input_type can be one of following,\n\tNS_ARG_IS_BUF   (0) : For buffer input \n\tNS_ARG_IS_PARAM  (1): For parameterized input\n\tNS_ARG_IS_FILE (2) : For file input\n2. input contains name of variable, param, file based on input type\n3. output_type can be one of following,\n\tNS_ARG_IS_BUF (0): For buffer output \n\tNS_ARG_IS_PARAM (1): For parameterized output\n\tNS_ARG_IS_FILE (2): For file output \n4. output contains name of variable, param, file based on output type\n5. size contain output buffer size if user want output in buffer (in bytes).  ",
  "returns": "int",
  "arguments": "\u003ctable class\u003d\"newGuiTable\" style\u003d\"width:100%\" \u003e \u003ctr\u003e	\u003cth\u003e Argument \u003c/th\u003e    \u003cth\u003e Description \u003c/th\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Input Type  \u003c/td\u003e \u003ctd\u003e An integer that specifies the type of input. It can be one of the following values:<br />NS_ARG_IS_BUF (0): Indicates that the input is a buffer.<br />NS_ARG_IS_PARAM (1): Indicates that the input is a parameter.<br />NS_ARG_IS_FILE (2): Indicates that the input is a file. \u003c/td\u003e \u003c/tr\u003e  \u003ctr\u003e \u003ctd\u003e Input  \u003c/td\u003e 		\u003ctd\u003e A character pointer that contains the name of the variable, parameter, or file based on the input type.\u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Output Type  \u003c/td\u003e \u003ctd\u003e An integer that specifies the type of output. It can be one of the following values:<br />NS_ARG_IS_BUF (0): Indicates that the output should be a buffer.<br />NS_ARG_IS_PARAM (1): Indicates that the output should be a parameter.<br />NS_ARG_IS_FILE (2): Indicates that the output should be written to a file. \u003c/td\u003e \u003c/tr\u003e	\u003ctr\u003e  \u003ctd\u003e Output  \u003c/td\u003e \u003ctd\u003e A character pointer that contains the name of the variable, parameter, or file based on the output type. \u003c/td\u003e	\u003c/tr\u003e	\u003ctr\u003e \u003ctd\u003e Size  \u003c/td\u003e \u003ctd\u003e An integer that specifies the size of the output buffer (in bytes), if the user wants the output in a buffer. \u003c/td\u003e \u003c/tr\u003e \u003c/table\u003e",
  "parameterization": "",
  "name": "ns_exec_js",
  "syntax": "int ns_exec_js(int inp_type, char *inp, int out_type, char *out, int size)",
  "javaSyntax": "",
  "cEx": "\n1.  Input type is buffer,\na.  Input type is buffer and output type is also buffer.\n\nchar* err;\nchar buff [1024] = “function myFunction() { return \"cavisson \"; } 	myFunction();”;\nchar out_buff[1024];\nint ret = ns_exec_js(0, buff, 0, out_buff, 1024);\nif (ret == -1)\n{\n  err = ns_js_error();\n  printf(“Error in API = %s”, err);\n} else {\n  printf(“output= %s”, out_buff);\n}\n\nIt should print cavission.\n\nb.  Input type is buffer and output type is parameter.\n\nchar* err ;\nchar buff[1024] = “function myFunction() { return \"cavisson \"; } myFunction();”;\nint ret = ns_exec_js(0, buff, 1, \"out_param\", 0);\nif (ret == -1)\n{\n  err = ns_js_error();\n  printf(“Error in API = %s”, err);\n} else {\n  printf(“output = %s ”, ns_eval_string(“{out_param}”));\n}\n\nIt should print output as cavisson.\n\nc.  Input type is buffer and output type is file.\n\nchar* err ;\nchar* buff[1024] = “function myFunction() { return \"cavisson \"; } myFunction();”;\nint ret = ns_exec_js(0, buff, 2, \"/home/cavisson/js_out.txt\", 0);\nif (ret == -1)\n{\n  err = ns_js_error();\n  printf(“Error in API = %s”, err);\n}\nFile /home/cavisson/js_out.txt file should have output data as Cavisson.\n\n2.  Input type is parameter,\nNote: Input parameter must be declared else API will return error.\na.  Input Type is Parameter and output type is buffer.\n\nchar out_buff[1024];\nchar buff[1024] = “function myFunction() { return \"cavisson \"; } myFunction();”;\nns_save_string(buff, “{inp_param}”);\nif (ns_exec_js(1, \"inp_param\", 1, \"out_param\", 0) < 0)\n  printf(“Error in API = %s”, ns_js_error());\nelse\n  printf(“output is = %s”, out_buff);\n\nIt should print output as cavisson.\n\nb.  Input Type is Parameter and output type is parameter\nNote: output parameter must be declared else API will return error.\n\nchar* buff = “function myFunction() { return \"cavisson \"; } myFunction();”;\nns_save_string(buff, “{inp_param}”);\nif (ns_exec_js(1, \"inp_param\", 1, \"out_param\", 0) < 0)\n  printf(“Error in API = %s”, ns_js_error());\nelse\n  printf(“output = %s ”, ns_eval_string(“{out_param}”));\n\nIt should print output as cavisson.\n\nc.  Input Type is Parameter and output type is file\n\nchar* buff = “function myFunction() { return \"cavisson \"; } myFunction();”;\nns_save_string(buff, “{inp_param}”);\nif (ns_exec_js(1, \"inp_param\", 1, \"out_param\", 0) < 0)\n   printf(“Error in API = %s”, ns_js_error());\n\nFile /home/cavisson/js_out.txt file should have output data as cavisson.\n\n3.  Input type is file,\nNote: File “/home/cavisson/js.txt” contains js example code\na.	Input Type is file and output type is buffer\n\nchar out_buff [1024];\nif (ns_exec_js(1, \"inp_param\", 1, \"out_param\", 0) < 0)\n  printf(“Error in API = %s”, ns_js_error());\nelse\n  printf(“output= %s”, out_buff);\n\nIt should print cavission.\n\nb.  Input type is file and output type is parameter\n\nNote: parameter must be declared in test else API will return error.\n\nif (ns_exec_js(1, \"inp_param\", 1, \"out_param\", 0) < 0)\n  printf(“Error in API = %s”, ns_js_error());\nelse\n  printf(“output = %s ”, ns_eval_string(“{out_param}”));\n\nIt will print output as cavisson.\n\nc.  Input type is file and output type is also file.\n\nFile \"/home/cavisson/js.txt\" contain JS example code. \n\nif (ns_exec_js(1, \"inp_param\", 1, \"out_param\", 0) < 0)\n  printf(“Error in API = %s”, ns_js_error());\n\noutput should be saved in \"/home/cavisson/js_out.txt\" as cavisson.\n",
  "javaEx": "",
  "insertStrC": "ns_exec_js(int inp_type, char *inp, int out_type, char *out, int size);",
  "insertStrJava": "",
  "description": "The ns_exec_js API will execute the java script provided as input and save the result in specified output.",
  "component": [
        {
      "id": "$2",
      "type": "ADVN_OPT",
      "label": "Input Type",
      "labelVarCheckbox": "",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter Input Type",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "quotes": false,
      "validate": {
        "inputType": "Text",
        "required": true
      }
    },
        {
      "id": "$4",
      "type": "ADVN_OPT",
      "label": "Output Type",
      "labelVarCheckbox": "",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter Output Type",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "quotes": false,
      "validate": {
        "inputType": "Text",
        "required": true
      }
    },
    {
      "id": "$5",
      "type": "TextField",
      "label": "Size",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter Size",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Number",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 2147483647
      }
    },
        {
      "id": "$ret",
      "type": "TextField",
      "label": "Return Value",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter Return Value",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": false,
        "min": 0,
        "max": 0
      }
    }

  ]
}