Units API.

See the Weblate's Web API documentation for detailed description of the API.

GET /api/units/157126/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "translation": "https://translate-dev.freebsd.org/api/translations/freebsd-doc/articles_ipsec-must/fa/?format=api",
    "source": [
        "/*\n  ULISCAN.c   ---blocksize of 8\n\n  1 Oct 98\n  1 Dec 98\n  21 Dec 98       uliscan.c derived from ueli8.c\n\n  This version has // comments removed for Sun cc\n\n  This implements Ueli M Maurer's \"Universal Statistical Test for Random\n  Bit Generators\" using L=8\n\n  Accepts a filename on the command line; writes its results, with other\n  info, to stdout.\n\n  Handles input file exhaustion gracefully.\n\n  Ref: J. Cryptology v 5 no 2, 1992 pp 89-105\n  also on the web somewhere, which is where I found it.\n\n  -David Honig\n  honig@sprynet.com\n\n  Usage:\n  ULISCAN filename\n  outputs to stdout\n*/\n\n#define L 8\n#define V (1<<L)\n#define Q (10*V)\n#define K (100   *Q)\n#define MAXSAMP (Q + K)\n\n#include <stdio.h>\n#include <math.h>\n\nint main(argc, argv)\nint argc;\nchar **argv;\n{\n  FILE *fptr;\n  int i,j;\n  int b, c;\n  int table[V];\n  double sum = 0.0;\n  int iproduct = 1;\n  int run;\n\n  extern double   log(/* double x */);\n\n  printf(\"Uliscan 21 Dec 98 \\nL=%d %d %d \\n\", L, V, MAXSAMP);\n\n  if (argc < 2) {\n    printf(\"Usage: Uliscan filename\\n\");\n    exit(-1);\n  } else {\n    printf(\"Measuring file %s\\n\", argv[1]);\n  }\n\n  fptr = fopen(argv[1],\"rb\");\n\n  if (fptr == NULL) {\n    printf(\"Can't find %s\\n\", argv[1]);\n    exit(-1);\n  }\n\n  for (i = 0; i < V; i++) {\n    table[i] = 0;\n  }\n\n  for (i = 0; i < Q; i++) {\n    b = fgetc(fptr);\n    table[b] = i;\n  }\n\n  printf(\"Init done\\n\");\n\n  printf(\"Expected value for L=8 is 7.1836656\\n\");\n\n  run = 1;\n\n  while (run) {\n    sum = 0.0;\n    iproduct = 1;\n\n    if (run)\n      for (i = Q; run && i < Q + K; i++) {\n        j = i;\n        b = fgetc(fptr);\n\n        if (b < 0)\n          run = 0;\n\n        if (run) {\n          if (table[b] > j)\n            j += K;\n\n          sum += log((double)(j-table[b]));\n\n          table[b] = i;\n        }\n      }\n\n    if (!run)\n      printf(\"Premature end of file; read %d blocks.\\n\", i - Q);\n\n    sum = (sum/((double)(i - Q))) /  log(2.0);\n    printf(\"%4.4f \", sum);\n\n    for (i = 0; i < (int)(sum*8.0 + 0.50); i++)\n      printf(\"-\");\n\n    printf(\"\\n\");\n\n    /* refill initial table */\n    if (0) {\n      for (i = 0; i < Q; i++) {\n        b = fgetc(fptr);\n        if (b < 0) {\n          run = 0;\n        } else {\n          table[b] = i;\n        }\n      }\n    }\n  }\n}"
    ],
    "previous_source": "",
    "target": [
        "/*\n  ULISCAN.c   ---blocksize of 8\n\n  1 Oct 98\n  1 Dec 98\n  21 Dec 98       uliscan.c derived from ueli8.c\n\n  This version has // comments removed for Sun cc\n\n  This implements Ueli M Maurer's \"Universal Statistical Test for Random\n  Bit Generators\" using L=8\n\n  Accepts a filename on the command line; writes its results, with other\n  info, to stdout.\n\n  Handles input file exhaustion gracefully.\n\n  Ref: J. Cryptology v 5 no 2, 1992 pp 89-105\n  also on the web somewhere, which is where I found it.\n\n  -David Honig\n  honig@sprynet.com\n\n  Usage:\n  ULISCAN filename\n  outputs to stdout\n*/\n\n#define L 8\n#define V (1<<L)\n#define Q (10*V)\n#define K (100   *Q)\n#define MAXSAMP (Q + K)\n\n#include <stdio.h>\n#include <math.h>\n\nint main(argc, argv)\nint argc;\nchar **argv;\n{\n  FILE *fptr;\n  int i,j;\n  int b, c;\n  int table[V];\n  double sum = 0.0;\n  int iproduct = 1;\n  int run;\n\n  extern double   log(/* double x */);\n\n  printf(\"Uliscan 21 Dec 98 \\nL=%d %d %d \\n\", L, V, MAXSAMP);\n\n  if (argc < 2) {\n    printf(\"Usage: Uliscan filename\\n\");\n    exit(-1);\n  } else {\n    printf(\"Measuring file %s\\n\", argv[1]);\n  }\n\n  fptr = fopen(argv[1],\"rb\");\n\n  if (fptr == NULL) {\n    printf(\"Can't find %s\\n\", argv[1]);\n    exit(-1);\n  }\n\n  for (i = 0; i < V; i++) {\n    table[i] = 0;\n  }\n\n  for (i = 0; i < Q; i++) {\n    b = fgetc(fptr);\n    table[b] = i;\n  }\n\n  printf(\"Init done\\n\");\n\n  printf(\"Expected value for L=8 is 7.1836656\\n\");\n\n  run = 1;\n\n  while (run) {\n    sum = 0.0;\n    iproduct = 1;\n\n    if (run)\n      for (i = Q; run && i < Q + K; i++) {\n        j = i;\n        b = fgetc(fptr);\n\n        if (b < 0)\n          run = 0;\n\n        if (run) {\n          if (table[b] > j)\n            j += K;\n\n          sum += log((double)(j-table[b]));\n\n          table[b] = i;\n        }\n      }\n\n    if (!run)\n      printf(\"Premature end of file; read %d blocks.\\n\", i - Q);\n\n    sum = (sum/((double)(i - Q))) /  log(2.0);\n    printf(\"%4.4f \", sum);\n\n    for (i = 0; i < (int)(sum*8.0 + 0.50); i++)\n      printf(\"-\");\n\n    printf(\"\\n\");\n\n    /* refill initial table */\n    if (0) {\n      for (i = 0; i < Q; i++) {\n        b = fgetc(fptr);\n        if (b < 0) {\n          run = 0;\n        } else {\n          table[b] = i;\n        }\n      }\n    }\n  }\n}"
    ],
    "id_hash": 183556058522984777,
    "content_hash": 183556058522984777,
    "location": "article.translate.xml:213",
    "context": "",
    "note": "(itstool) path: sect1/programlisting",
    "flags": "no-wrap",
    "labels": [],
    "state": 20,
    "fuzzy": false,
    "translated": true,
    "approved": false,
    "position": 44,
    "has_suggestion": false,
    "has_comment": false,
    "has_failing_check": false,
    "num_words": 357,
    "source_unit": "https://translate-dev.freebsd.org/api/units/99208/?format=api",
    "priority": 100,
    "id": 157126,
    "web_url": "https://translate-dev.freebsd.org/translate/freebsd-doc/articles_ipsec-must/fa/?checksum=828c1f4340a22149",
    "url": "https://translate-dev.freebsd.org/api/units/157126/?format=api",
    "explanation": "",
    "extra_flags": "",
    "pending": false,
    "timestamp": "2020-04-01T09:30:31.702272Z"
}