Units API.

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

GET /api/units/92254/?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/boooks_developers-handbook/en/?format=api",
    "source": [
        ";;;;;;; pinhole.asm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n;\n; Find various parameters of a pinhole camera construction and use\n;\n; Started:\t 9-Jun-2001\n; Updated:\t10-Jun-2001\n;\n; Copyright (c) 2001 G. Adam Stanislav\n; All rights reserved.\n;\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n%include\t'system.inc'\n\n%define\tBUFSIZE\t2048\n\nsection\t.data\nalign 4\nten\tdd\t10\nthousand\tdd\t1000\ntthou\tdd\t10000\nfd.in\tdd\tstdin\nfd.out\tdd\tstdout\nenvar\tdb\t'PINHOLE='\t; Exactly 8 bytes, or 2 dwords long\npinhole\tdb\t'04,', \t\t; Bender's constant (0.04)\nconnors\tdb\t'037', 0Ah\t; Connors' constant\nusg\tdb\t'Usage: pinhole [-b] [-c] [-e] [-p <value>] [-o <outfile>] [-i <infile>]', 0Ah\nusglen\tequ\t$-usg\niemsg\tdb\t\"pinhole: Can't open input file\", 0Ah\niemlen\tequ\t$-iemsg\noemsg\tdb\t\"pinhole: Can't create output file\", 0Ah\noemlen\tequ\t$-oemsg\npinmsg\tdb\t\"pinhole: The PINHOLE constant must not be 0\", 0Ah\npinlen\tequ\t$-pinmsg\ntoobig\tdb\t\"pinhole: The PINHOLE constant may not exceed 18 decimal places\", 0Ah\nbiglen\tequ\t$-toobig\nhuhmsg\tdb\t9, '???'\nsepar\tdb\t9, '???'\nsep2\tdb\t9, '???'\nsep3\tdb\t9, '???'\nsep4\tdb\t9, '???', 0Ah\nhuhlen\tequ\t$-huhmsg\nheader\tdb\t'focal length in millimeters,pinhole diameter in microns,'\n\tdb\t'F-number,normalized F-number,F-5.6 multiplier,stops '\n\tdb\t'from F-5.6', 0Ah\nheadlen\tequ\t$-header\n\nsection .bss\nibuffer\tresb\tBUFSIZE\nobuffer\tresb\tBUFSIZE\ndbuffer\tresb\t20\t\t; decimal input buffer\nbbuffer\tresb\t10\t\t; BCD buffer\n\nsection\t.text\nalign 4\nhuh:\n\tcall\twrite\n\tpush\tdword huhlen\n\tpush\tdword huhmsg\n\tpush\tdword [fd.out]\n\tsys.write\n\tadd\tesp, byte 12\n\tret\n\nalign 4\nperr:\n\tpush\tdword pinlen\n\tpush\tdword pinmsg\n\tpush\tdword stderr\n\tsys.write\n\tpush\tdword 4\t\t; return failure\n\tsys.exit\n\nalign 4\nconsttoobig:\n\tpush\tdword biglen\n\tpush\tdword toobig\n\tpush\tdword stderr\n\tsys.write\n\tpush\tdword 5\t\t; return failure\n\tsys.exit\n\nalign 4\nierr:\n\tpush\tdword iemlen\n\tpush\tdword iemsg\n\tpush\tdword stderr\n\tsys.write\n\tpush\tdword 1\t\t; return failure\n\tsys.exit\n\nalign 4\noerr:\n\tpush\tdword oemlen\n\tpush\tdword oemsg\n\tpush\tdword stderr\n\tsys.write\n\tpush\tdword 2\n\tsys.exit\n\nalign 4\nusage:\n\tpush\tdword usglen\n\tpush\tdword usg\n\tpush\tdword stderr\n\tsys.write\n\tpush\tdword 3\n\tsys.exit\n\nalign 4\nglobal\t_start\n_start:\n\tadd\tesp, byte 8\t; discard argc and argv[0]\n\tsub\tesi, esi\n\n.arg:\n\tpop\tecx\n\tor\tecx, ecx\n\tje\tnear .getenv\t\t; no more arguments\n\n\t; ECX contains the pointer to an argument\n\tcmp\tbyte [ecx], '-'\n\tjne\tusage\n\n\tinc\tecx\n\tmov\tax, [ecx]\n\tinc\tecx\n\n.o:\n\tcmp\tal, 'o'\n\tjne\t.i\n\n\t; Make sure we are not asked for the output file twice\n\tcmp\tdword [fd.out], stdout\n\tjne\tusage\n\n\t; Find the path to output file - it is either at [ECX+1],\n\t; i.e., -ofile --\n\t; or in the next argument,\n\t; i.e., -o file\n\n\tor\tah, ah\n\tjne\t.openoutput\n\tpop\tecx\n\tjecxz\tusage\n\n.openoutput:\n\tpush\tdword 420\t; file mode (644 octal)\n\tpush\tdword 0200h | 0400h | 01h\n\t; O_CREAT | O_TRUNC | O_WRONLY\n\tpush\tecx\n\tsys.open\n\tjc\tnear oerr\n\n\tadd\tesp, byte 12\n\tmov\t[fd.out], eax\n\tjmp\tshort .arg\n\n.i:\n\tcmp\tal, 'i'\n\tjne\t.p\n\n\t; Make sure we are not asked twice\n\tcmp\tdword [fd.in], stdin\n\tjne\tnear usage\n\n\t; Find the path to the input file\n\tor\tah, ah\n\tjne\t.openinput\n\tpop\tecx\n\tor\tecx, ecx\n\tje near usage\n\n.openinput:\n\tpush\tdword 0\t\t; O_RDONLY\n\tpush\tecx\n\tsys.open\n\tjc\tnear ierr\t\t; open failed\n\n\tadd\tesp, byte 8\n\tmov\t[fd.in], eax\n\tjmp\t.arg\n\n.p:\n\tcmp\tal, 'p'\n\tjne\t.c\n\tor\tah, ah\n\tjne\t.pcheck\n\n\tpop\tecx\n\tor\tecx, ecx\n\tje\tnear usage\n\n\tmov\tah, [ecx]\n\n.pcheck:\n\tcmp\tah, '0'\n\tjl\tnear usage\n\tcmp\tah, '9'\n\tja\tnear usage\n\tmov\tesi, ecx\n\tjmp\t.arg\n\n.c:\n\tcmp\tal, 'c'\n\tjne\t.b\n\tor\tah, ah\n\tjne\tnear usage\n\tmov\tesi, connors\n\tjmp\t.arg\n\n.b:\n\tcmp\tal, 'b'\n\tjne\t.e\n\tor\tah, ah\n\tjne\tnear usage\n\tmov\tesi, pinhole\n\tjmp\t.arg\n\n.e:\n\tcmp\tal, 'e'\n\tjne\tnear usage\n\tor\tah, ah\n\tjne\tnear usage\n\tmov\tal, ','\n\tmov\t[huhmsg], al\n\tmov\t[separ], al\n\tmov\t[sep2], al\n\tmov\t[sep3], al\n\tmov\t[sep4], al\n\tjmp\t.arg\n\nalign 4\n.getenv:\n\t; If ESI = 0, we did not have a -p argument,\n\t; and need to check the environment for \"PINHOLE=\"\n\tor\tesi, esi\n\tjne\t.init\n\n\tsub\tecx, ecx\n\n.nextenv:\n\tpop\tesi\n\tor\tesi, esi\n\tje\t.default\t; no PINHOLE envar found\n\n\t; check if this envar starts with 'PINHOLE='\n\tmov\tedi, envar\n\tmov\tcl, 2\t\t; 'PINHOLE=' is 2 dwords long\nrep\tcmpsd\n\tjne\t.nextenv\n\n\t; Check if it is followed by a digit\n\tmov\tal, [esi]\n\tcmp\tal, '0'\n\tjl\t.default\n\tcmp\tal, '9'\n\tjbe\t.init\n\t; fall through\n\nalign 4\n.default:\n\t; We got here because we had no -p argument,\n\t; and did not find the PINHOLE envar.\n\tmov\tesi, pinhole\n\t; fall through\n\nalign 4\n.init:\n\tsub\teax, eax\n\tsub\tebx, ebx\n\tsub\tecx, ecx\n\tsub\tedx, edx\n\tmov\tedi, dbuffer+1\n\tmov\tbyte [dbuffer], '0'\n\n\t; Convert the pinhole constant to real\n.constloop:\n\tlodsb\n\tcmp\tal, '9'\n\tja\t.setconst\n\tcmp\tal, '0'\n\tje\t.processconst\n\tjb\t.setconst\n\n\tinc\tdl\n\n.processconst:\n\tinc\tcl\n\tcmp\tcl, 18\n\tja\tnear consttoobig\n\tstosb\n\tjmp\tshort .constloop\n\nalign 4\n.setconst:\n\tor\tdl, dl\n\tje\tnear perr\n\n\tfinit\n\tfild\tdword [tthou]\n\n\tfld1\n\tfild\tdword [ten]\n\tfdivp\tst1, st0\n\n\tfild\tdword [thousand]\n\tmov\tedi, obuffer\n\n\tmov\tebp, ecx\n\tcall\tbcdload\n\n.constdiv:\n\tfmul\tst0, st2\n\tloop\t.constdiv\n\n\tfld1\n\tfadd\tst0, st0\n\tfadd\tst0, st0\n\tfld1\n\tfaddp\tst1, st0\n\tfchs\n\n\t; If we are creating a CSV file,\n\t; print header\n\tcmp\tbyte [separ], ','\n\tjne\t.bigloop\n\n\tpush\tdword headlen\n\tpush\tdword header\n\tpush\tdword [fd.out]\n\tsys.write\n\n.bigloop:\n\tcall\tgetchar\n\tjc\tnear done\n\n\t; Skip to the end of the line if you got '#'\n\tcmp\tal, '#'\n\tjne\t.num\n\tcall\tskiptoeol\n\tjmp\tshort .bigloop\n\n.num:\n\t; See if you got a number\n\tcmp\tal, '0'\n\tjl\t.bigloop\n\tcmp\tal, '9'\n\tja\t.bigloop\n\n\t; Yes, we have a number\n\tsub\tebp, ebp\n\tsub\tedx, edx\n\n.number:\n\tcmp\tal, '0'\n\tje\t.number0\n\tmov\tdl, 1\n\n.number0:\n\tor\tdl, dl\t\t; Skip leading 0's\n\tje\t.nextnumber\n\tpush\teax\n\tcall\tputchar\n\tpop\teax\n\tinc\tebp\n\tcmp\tebp, 19\n\tjae\t.nextnumber\n\tmov\t[dbuffer+ebp], al\n\n.nextnumber:\n\tcall\tgetchar\n\tjc\t.work\n\tcmp\tal, '#'\n\tje\t.ungetc\n\tcmp\tal, '0'\n\tjl\t.work\n\tcmp\tal, '9'\n\tja\t.work\n\tjmp\tshort .number\n\n.ungetc:\n\tdec\tesi\n\tinc\tebx\n\n.work:\n\t; Now, do all the work\n\tor\tdl, dl\n\tje\tnear .work0\n\n\tcmp\tebp, 19\n\tjae\tnear .toobig\n\n\tcall\tbcdload\n\n\t; Calculate pinhole diameter\n\n\tfld\tst0\t; save it\n\tfsqrt\n\tfmul\tst0, st3\n\tfld\tst0\n\tfmul\tst5\n\tsub\tebp, ebp\n\n\t; Round off to 4 significant digits\n.diameter:\n\tfcom\tst0, st7\n\tfstsw\tax\n\tsahf\n\tjb\t.printdiameter\n\tfmul\tst0, st6\n\tinc\tebp\n\tjmp\tshort .diameter\n\n.printdiameter:\n\tcall\tprintnumber\t; pinhole diameter\n\n\t; Calculate F-number\n\n\tfdivp\tst1, st0\n\tfld\tst0\n\n\tsub\tebp, ebp\n\n.fnumber:\n\tfcom\tst0, st6\n\tfstsw\tax\n\tsahf\n\tjb\t.printfnumber\n\tfmul\tst0, st5\n\tinc\tebp\n\tjmp\tshort .fnumber\n\n.printfnumber:\n\tcall\tprintnumber\t; F number\n\n\t; Calculate normalized F-number\n\tfmul\tst0, st0\n\tfld1\n\tfld\tst1\n\tfyl2x\n\tfrndint\n\tfld1\n\tfscale\n\tfsqrt\n\tfstp\tst1\n\n\tsub\tebp, ebp\n\tcall\tprintnumber\n\n\t; Calculate time multiplier from F-5.6\n\n\tfscale\n\tfld\tst0\n\n\t; Round off to 4 significant digits\n.fmul:\n\tfcom\tst0, st6\n\tfstsw\tax\n\tsahf\n\n\tjb\t.printfmul\n\tinc\tebp\n\tfmul\tst0, st5\n\tjmp\tshort .fmul\n\n.printfmul:\n\tcall\tprintnumber\t; F multiplier\n\n\t; Calculate F-stops from 5.6\n\n\tfld1\n\tfxch\tst1\n\tfyl2x\n\n\tsub\tebp, ebp\n\tcall\tprintnumber\n\n\tmov\tal, 0Ah\n\tcall\tputchar\n\tjmp\t.bigloop\n\n.work0:\n\tmov\tal, '0'\n\tcall\tputchar\n\nalign 4\n.toobig:\n\tcall\thuh\n\tjmp\t.bigloop\n\nalign 4\ndone:\n\tcall\twrite\t\t; flush output buffer\n\n\t; close files\n\tpush\tdword [fd.in]\n\tsys.close\n\n\tpush\tdword [fd.out]\n\tsys.close\n\n\tfinit\n\n\t; return success\n\tpush\tdword 0\n\tsys.exit\n\nalign 4\nskiptoeol:\n\t; Keep reading until you come to cr, lf, or eof\n\tcall\tgetchar\n\tjc\tdone\n\tcmp\tal, 0Ah\n\tjne\t.cr\n\tret\n\n.cr:\n\tcmp\tal, 0Dh\n\tjne\tskiptoeol\n\tret\n\nalign 4\ngetchar:\n\tor\tebx, ebx\n\tjne\t.fetch\n\n\tcall\tread\n\n.fetch:\n\tlodsb\n\tdec\tebx\n\tclc\n\tret\n\nread:\n\tjecxz\t.read\n\tcall\twrite\n\n.read:\n\tpush\tdword BUFSIZE\n\tmov\tesi, ibuffer\n\tpush\tesi\n\tpush\tdword [fd.in]\n\tsys.read\n\tadd\tesp, byte 12\n\tmov\tebx, eax\n\tor\teax, eax\n\tje\t.empty\n\tsub\teax, eax\n\tret\n\nalign 4\n.empty:\n\tadd\tesp, byte 4\n\tstc\n\tret\n\nalign 4\nputchar:\n\tstosb\n\tinc\tecx\n\tcmp\tecx, BUFSIZE\n\tje\twrite\n\tret\n\nalign 4\nwrite:\n\tjecxz\t.ret\t; nothing to write\n\tsub\tedi, ecx\t; start of buffer\n\tpush\tecx\n\tpush\tedi\n\tpush\tdword [fd.out]\n\tsys.write\n\tadd\tesp, byte 12\n\tsub\teax, eax\n\tsub\tecx, ecx\t; buffer is empty now\n.ret:\n\tret\n\nalign 4\nbcdload:\n\t; EBP contains the number of chars in dbuffer\n\tpush\tecx\n\tpush\tesi\n\tpush\tedi\n\n\tlea\tecx, [ebp+1]\n\tlea\tesi, [dbuffer+ebp-1]\n\tshr\tecx, 1\n\n\tstd\n\n\tmov\tedi, bbuffer\n\tsub\teax, eax\n\tmov\t[edi], eax\n\tmov\t[edi+4], eax\n\tmov\t[edi+2], ax\n\n.loop:\n\tlodsw\n\tsub\tax, 3030h\n\tshl\tal, 4\n\tor\tal, ah\n\tmov\t[edi], al\n\tinc\tedi\n\tloop\t.loop\n\n\tfbld\t[bbuffer]\n\n\tcld\n\tpop\tedi\n\tpop\tesi\n\tpop\tecx\n\tsub\teax, eax\n\tret\n\nalign 4\nprintnumber:\n\tpush\tebp\n\tmov\tal, [separ]\n\tcall\tputchar\n\n\t; Print the integer at the TOS\n\tmov\tebp, bbuffer+9\n\tfbstp\t[bbuffer]\n\n\t; Check the sign\n\tmov\tal, [ebp]\n\tdec\tebp\n\tor\tal, al\n\tjns\t.leading\n\n\t; We got a negative number (should never happen)\n\tmov\tal, '-'\n\tcall\tputchar\n\n.leading:\n\t; Skip leading zeros\n\tmov\tal, [ebp]\n\tdec\tebp\n\tor\tal, al\n\tjne\t.first\n\tcmp\tebp, bbuffer\n\tjae\t.leading\n\n\t; We are here because the result was 0.\n\t; Print '0' and return\n\tmov\tal, '0'\n\tjmp\tputchar\n\n.first:\n\t; We have found the first non-zero.\n\t; But it is still packed\n\ttest\tal, 0F0h\n\tjz\t.second\n\tpush\teax\n\tshr\tal, 4\n\tadd\tal, '0'\n\tcall\tputchar\n\tpop\teax\n\tand\tal, 0Fh\n\n.second:\n\tadd\tal, '0'\n\tcall\tputchar\n\n.next:\n\tcmp\tebp, bbuffer\n\tjb\t.done\n\n\tmov\tal, [ebp]\n\tpush\teax\n\tshr\tal, 4\n\tadd\tal, '0'\n\tcall\tputchar\n\tpop\teax\n\tand\tal, 0Fh\n\tadd\tal, '0'\n\tcall\tputchar\n\n\tdec\tebp\n\tjmp\tshort .next\n\n.done:\n\tpop\tebp\n\tor\tebp, ebp\n\tje\t.ret\n\n.zeros:\n\tmov\tal, '0'\n\tcall\tputchar\n\tdec\tebp\n\tjne\t.zeros\n\n.ret:\n\tret"
    ],
    "previous_source": "",
    "target": [
        ";;;;;;; pinhole.asm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n;\n; Find various parameters of a pinhole camera construction and use\n;\n; Started:\t 9-Jun-2001\n; Updated:\t10-Jun-2001\n;\n; Copyright (c) 2001 G. Adam Stanislav\n; All rights reserved.\n;\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n%include\t'system.inc'\n\n%define\tBUFSIZE\t2048\n\nsection\t.data\nalign 4\nten\tdd\t10\nthousand\tdd\t1000\ntthou\tdd\t10000\nfd.in\tdd\tstdin\nfd.out\tdd\tstdout\nenvar\tdb\t'PINHOLE='\t; Exactly 8 bytes, or 2 dwords long\npinhole\tdb\t'04,', \t\t; Bender's constant (0.04)\nconnors\tdb\t'037', 0Ah\t; Connors' constant\nusg\tdb\t'Usage: pinhole [-b] [-c] [-e] [-p <value>] [-o <outfile>] [-i <infile>]', 0Ah\nusglen\tequ\t$-usg\niemsg\tdb\t\"pinhole: Can't open input file\", 0Ah\niemlen\tequ\t$-iemsg\noemsg\tdb\t\"pinhole: Can't create output file\", 0Ah\noemlen\tequ\t$-oemsg\npinmsg\tdb\t\"pinhole: The PINHOLE constant must not be 0\", 0Ah\npinlen\tequ\t$-pinmsg\ntoobig\tdb\t\"pinhole: The PINHOLE constant may not exceed 18 decimal places\", 0Ah\nbiglen\tequ\t$-toobig\nhuhmsg\tdb\t9, '???'\nsepar\tdb\t9, '???'\nsep2\tdb\t9, '???'\nsep3\tdb\t9, '???'\nsep4\tdb\t9, '???', 0Ah\nhuhlen\tequ\t$-huhmsg\nheader\tdb\t'focal length in millimeters,pinhole diameter in microns,'\n\tdb\t'F-number,normalized F-number,F-5.6 multiplier,stops '\n\tdb\t'from F-5.6', 0Ah\nheadlen\tequ\t$-header\n\nsection .bss\nibuffer\tresb\tBUFSIZE\nobuffer\tresb\tBUFSIZE\ndbuffer\tresb\t20\t\t; decimal input buffer\nbbuffer\tresb\t10\t\t; BCD buffer\n\nsection\t.text\nalign 4\nhuh:\n\tcall\twrite\n\tpush\tdword huhlen\n\tpush\tdword huhmsg\n\tpush\tdword [fd.out]\n\tsys.write\n\tadd\tesp, byte 12\n\tret\n\nalign 4\nperr:\n\tpush\tdword pinlen\n\tpush\tdword pinmsg\n\tpush\tdword stderr\n\tsys.write\n\tpush\tdword 4\t\t; return failure\n\tsys.exit\n\nalign 4\nconsttoobig:\n\tpush\tdword biglen\n\tpush\tdword toobig\n\tpush\tdword stderr\n\tsys.write\n\tpush\tdword 5\t\t; return failure\n\tsys.exit\n\nalign 4\nierr:\n\tpush\tdword iemlen\n\tpush\tdword iemsg\n\tpush\tdword stderr\n\tsys.write\n\tpush\tdword 1\t\t; return failure\n\tsys.exit\n\nalign 4\noerr:\n\tpush\tdword oemlen\n\tpush\tdword oemsg\n\tpush\tdword stderr\n\tsys.write\n\tpush\tdword 2\n\tsys.exit\n\nalign 4\nusage:\n\tpush\tdword usglen\n\tpush\tdword usg\n\tpush\tdword stderr\n\tsys.write\n\tpush\tdword 3\n\tsys.exit\n\nalign 4\nglobal\t_start\n_start:\n\tadd\tesp, byte 8\t; discard argc and argv[0]\n\tsub\tesi, esi\n\n.arg:\n\tpop\tecx\n\tor\tecx, ecx\n\tje\tnear .getenv\t\t; no more arguments\n\n\t; ECX contains the pointer to an argument\n\tcmp\tbyte [ecx], '-'\n\tjne\tusage\n\n\tinc\tecx\n\tmov\tax, [ecx]\n\tinc\tecx\n\n.o:\n\tcmp\tal, 'o'\n\tjne\t.i\n\n\t; Make sure we are not asked for the output file twice\n\tcmp\tdword [fd.out], stdout\n\tjne\tusage\n\n\t; Find the path to output file - it is either at [ECX+1],\n\t; i.e., -ofile --\n\t; or in the next argument,\n\t; i.e., -o file\n\n\tor\tah, ah\n\tjne\t.openoutput\n\tpop\tecx\n\tjecxz\tusage\n\n.openoutput:\n\tpush\tdword 420\t; file mode (644 octal)\n\tpush\tdword 0200h | 0400h | 01h\n\t; O_CREAT | O_TRUNC | O_WRONLY\n\tpush\tecx\n\tsys.open\n\tjc\tnear oerr\n\n\tadd\tesp, byte 12\n\tmov\t[fd.out], eax\n\tjmp\tshort .arg\n\n.i:\n\tcmp\tal, 'i'\n\tjne\t.p\n\n\t; Make sure we are not asked twice\n\tcmp\tdword [fd.in], stdin\n\tjne\tnear usage\n\n\t; Find the path to the input file\n\tor\tah, ah\n\tjne\t.openinput\n\tpop\tecx\n\tor\tecx, ecx\n\tje near usage\n\n.openinput:\n\tpush\tdword 0\t\t; O_RDONLY\n\tpush\tecx\n\tsys.open\n\tjc\tnear ierr\t\t; open failed\n\n\tadd\tesp, byte 8\n\tmov\t[fd.in], eax\n\tjmp\t.arg\n\n.p:\n\tcmp\tal, 'p'\n\tjne\t.c\n\tor\tah, ah\n\tjne\t.pcheck\n\n\tpop\tecx\n\tor\tecx, ecx\n\tje\tnear usage\n\n\tmov\tah, [ecx]\n\n.pcheck:\n\tcmp\tah, '0'\n\tjl\tnear usage\n\tcmp\tah, '9'\n\tja\tnear usage\n\tmov\tesi, ecx\n\tjmp\t.arg\n\n.c:\n\tcmp\tal, 'c'\n\tjne\t.b\n\tor\tah, ah\n\tjne\tnear usage\n\tmov\tesi, connors\n\tjmp\t.arg\n\n.b:\n\tcmp\tal, 'b'\n\tjne\t.e\n\tor\tah, ah\n\tjne\tnear usage\n\tmov\tesi, pinhole\n\tjmp\t.arg\n\n.e:\n\tcmp\tal, 'e'\n\tjne\tnear usage\n\tor\tah, ah\n\tjne\tnear usage\n\tmov\tal, ','\n\tmov\t[huhmsg], al\n\tmov\t[separ], al\n\tmov\t[sep2], al\n\tmov\t[sep3], al\n\tmov\t[sep4], al\n\tjmp\t.arg\n\nalign 4\n.getenv:\n\t; If ESI = 0, we did not have a -p argument,\n\t; and need to check the environment for \"PINHOLE=\"\n\tor\tesi, esi\n\tjne\t.init\n\n\tsub\tecx, ecx\n\n.nextenv:\n\tpop\tesi\n\tor\tesi, esi\n\tje\t.default\t; no PINHOLE envar found\n\n\t; check if this envar starts with 'PINHOLE='\n\tmov\tedi, envar\n\tmov\tcl, 2\t\t; 'PINHOLE=' is 2 dwords long\nrep\tcmpsd\n\tjne\t.nextenv\n\n\t; Check if it is followed by a digit\n\tmov\tal, [esi]\n\tcmp\tal, '0'\n\tjl\t.default\n\tcmp\tal, '9'\n\tjbe\t.init\n\t; fall through\n\nalign 4\n.default:\n\t; We got here because we had no -p argument,\n\t; and did not find the PINHOLE envar.\n\tmov\tesi, pinhole\n\t; fall through\n\nalign 4\n.init:\n\tsub\teax, eax\n\tsub\tebx, ebx\n\tsub\tecx, ecx\n\tsub\tedx, edx\n\tmov\tedi, dbuffer+1\n\tmov\tbyte [dbuffer], '0'\n\n\t; Convert the pinhole constant to real\n.constloop:\n\tlodsb\n\tcmp\tal, '9'\n\tja\t.setconst\n\tcmp\tal, '0'\n\tje\t.processconst\n\tjb\t.setconst\n\n\tinc\tdl\n\n.processconst:\n\tinc\tcl\n\tcmp\tcl, 18\n\tja\tnear consttoobig\n\tstosb\n\tjmp\tshort .constloop\n\nalign 4\n.setconst:\n\tor\tdl, dl\n\tje\tnear perr\n\n\tfinit\n\tfild\tdword [tthou]\n\n\tfld1\n\tfild\tdword [ten]\n\tfdivp\tst1, st0\n\n\tfild\tdword [thousand]\n\tmov\tedi, obuffer\n\n\tmov\tebp, ecx\n\tcall\tbcdload\n\n.constdiv:\n\tfmul\tst0, st2\n\tloop\t.constdiv\n\n\tfld1\n\tfadd\tst0, st0\n\tfadd\tst0, st0\n\tfld1\n\tfaddp\tst1, st0\n\tfchs\n\n\t; If we are creating a CSV file,\n\t; print header\n\tcmp\tbyte [separ], ','\n\tjne\t.bigloop\n\n\tpush\tdword headlen\n\tpush\tdword header\n\tpush\tdword [fd.out]\n\tsys.write\n\n.bigloop:\n\tcall\tgetchar\n\tjc\tnear done\n\n\t; Skip to the end of the line if you got '#'\n\tcmp\tal, '#'\n\tjne\t.num\n\tcall\tskiptoeol\n\tjmp\tshort .bigloop\n\n.num:\n\t; See if you got a number\n\tcmp\tal, '0'\n\tjl\t.bigloop\n\tcmp\tal, '9'\n\tja\t.bigloop\n\n\t; Yes, we have a number\n\tsub\tebp, ebp\n\tsub\tedx, edx\n\n.number:\n\tcmp\tal, '0'\n\tje\t.number0\n\tmov\tdl, 1\n\n.number0:\n\tor\tdl, dl\t\t; Skip leading 0's\n\tje\t.nextnumber\n\tpush\teax\n\tcall\tputchar\n\tpop\teax\n\tinc\tebp\n\tcmp\tebp, 19\n\tjae\t.nextnumber\n\tmov\t[dbuffer+ebp], al\n\n.nextnumber:\n\tcall\tgetchar\n\tjc\t.work\n\tcmp\tal, '#'\n\tje\t.ungetc\n\tcmp\tal, '0'\n\tjl\t.work\n\tcmp\tal, '9'\n\tja\t.work\n\tjmp\tshort .number\n\n.ungetc:\n\tdec\tesi\n\tinc\tebx\n\n.work:\n\t; Now, do all the work\n\tor\tdl, dl\n\tje\tnear .work0\n\n\tcmp\tebp, 19\n\tjae\tnear .toobig\n\n\tcall\tbcdload\n\n\t; Calculate pinhole diameter\n\n\tfld\tst0\t; save it\n\tfsqrt\n\tfmul\tst0, st3\n\tfld\tst0\n\tfmul\tst5\n\tsub\tebp, ebp\n\n\t; Round off to 4 significant digits\n.diameter:\n\tfcom\tst0, st7\n\tfstsw\tax\n\tsahf\n\tjb\t.printdiameter\n\tfmul\tst0, st6\n\tinc\tebp\n\tjmp\tshort .diameter\n\n.printdiameter:\n\tcall\tprintnumber\t; pinhole diameter\n\n\t; Calculate F-number\n\n\tfdivp\tst1, st0\n\tfld\tst0\n\n\tsub\tebp, ebp\n\n.fnumber:\n\tfcom\tst0, st6\n\tfstsw\tax\n\tsahf\n\tjb\t.printfnumber\n\tfmul\tst0, st5\n\tinc\tebp\n\tjmp\tshort .fnumber\n\n.printfnumber:\n\tcall\tprintnumber\t; F number\n\n\t; Calculate normalized F-number\n\tfmul\tst0, st0\n\tfld1\n\tfld\tst1\n\tfyl2x\n\tfrndint\n\tfld1\n\tfscale\n\tfsqrt\n\tfstp\tst1\n\n\tsub\tebp, ebp\n\tcall\tprintnumber\n\n\t; Calculate time multiplier from F-5.6\n\n\tfscale\n\tfld\tst0\n\n\t; Round off to 4 significant digits\n.fmul:\n\tfcom\tst0, st6\n\tfstsw\tax\n\tsahf\n\n\tjb\t.printfmul\n\tinc\tebp\n\tfmul\tst0, st5\n\tjmp\tshort .fmul\n\n.printfmul:\n\tcall\tprintnumber\t; F multiplier\n\n\t; Calculate F-stops from 5.6\n\n\tfld1\n\tfxch\tst1\n\tfyl2x\n\n\tsub\tebp, ebp\n\tcall\tprintnumber\n\n\tmov\tal, 0Ah\n\tcall\tputchar\n\tjmp\t.bigloop\n\n.work0:\n\tmov\tal, '0'\n\tcall\tputchar\n\nalign 4\n.toobig:\n\tcall\thuh\n\tjmp\t.bigloop\n\nalign 4\ndone:\n\tcall\twrite\t\t; flush output buffer\n\n\t; close files\n\tpush\tdword [fd.in]\n\tsys.close\n\n\tpush\tdword [fd.out]\n\tsys.close\n\n\tfinit\n\n\t; return success\n\tpush\tdword 0\n\tsys.exit\n\nalign 4\nskiptoeol:\n\t; Keep reading until you come to cr, lf, or eof\n\tcall\tgetchar\n\tjc\tdone\n\tcmp\tal, 0Ah\n\tjne\t.cr\n\tret\n\n.cr:\n\tcmp\tal, 0Dh\n\tjne\tskiptoeol\n\tret\n\nalign 4\ngetchar:\n\tor\tebx, ebx\n\tjne\t.fetch\n\n\tcall\tread\n\n.fetch:\n\tlodsb\n\tdec\tebx\n\tclc\n\tret\n\nread:\n\tjecxz\t.read\n\tcall\twrite\n\n.read:\n\tpush\tdword BUFSIZE\n\tmov\tesi, ibuffer\n\tpush\tesi\n\tpush\tdword [fd.in]\n\tsys.read\n\tadd\tesp, byte 12\n\tmov\tebx, eax\n\tor\teax, eax\n\tje\t.empty\n\tsub\teax, eax\n\tret\n\nalign 4\n.empty:\n\tadd\tesp, byte 4\n\tstc\n\tret\n\nalign 4\nputchar:\n\tstosb\n\tinc\tecx\n\tcmp\tecx, BUFSIZE\n\tje\twrite\n\tret\n\nalign 4\nwrite:\n\tjecxz\t.ret\t; nothing to write\n\tsub\tedi, ecx\t; start of buffer\n\tpush\tecx\n\tpush\tedi\n\tpush\tdword [fd.out]\n\tsys.write\n\tadd\tesp, byte 12\n\tsub\teax, eax\n\tsub\tecx, ecx\t; buffer is empty now\n.ret:\n\tret\n\nalign 4\nbcdload:\n\t; EBP contains the number of chars in dbuffer\n\tpush\tecx\n\tpush\tesi\n\tpush\tedi\n\n\tlea\tecx, [ebp+1]\n\tlea\tesi, [dbuffer+ebp-1]\n\tshr\tecx, 1\n\n\tstd\n\n\tmov\tedi, bbuffer\n\tsub\teax, eax\n\tmov\t[edi], eax\n\tmov\t[edi+4], eax\n\tmov\t[edi+2], ax\n\n.loop:\n\tlodsw\n\tsub\tax, 3030h\n\tshl\tal, 4\n\tor\tal, ah\n\tmov\t[edi], al\n\tinc\tedi\n\tloop\t.loop\n\n\tfbld\t[bbuffer]\n\n\tcld\n\tpop\tedi\n\tpop\tesi\n\tpop\tecx\n\tsub\teax, eax\n\tret\n\nalign 4\nprintnumber:\n\tpush\tebp\n\tmov\tal, [separ]\n\tcall\tputchar\n\n\t; Print the integer at the TOS\n\tmov\tebp, bbuffer+9\n\tfbstp\t[bbuffer]\n\n\t; Check the sign\n\tmov\tal, [ebp]\n\tdec\tebp\n\tor\tal, al\n\tjns\t.leading\n\n\t; We got a negative number (should never happen)\n\tmov\tal, '-'\n\tcall\tputchar\n\n.leading:\n\t; Skip leading zeros\n\tmov\tal, [ebp]\n\tdec\tebp\n\tor\tal, al\n\tjne\t.first\n\tcmp\tebp, bbuffer\n\tjae\t.leading\n\n\t; We are here because the result was 0.\n\t; Print '0' and return\n\tmov\tal, '0'\n\tjmp\tputchar\n\n.first:\n\t; We have found the first non-zero.\n\t; But it is still packed\n\ttest\tal, 0F0h\n\tjz\t.second\n\tpush\teax\n\tshr\tal, 4\n\tadd\tal, '0'\n\tcall\tputchar\n\tpop\teax\n\tand\tal, 0Fh\n\n.second:\n\tadd\tal, '0'\n\tcall\tputchar\n\n.next:\n\tcmp\tebp, bbuffer\n\tjb\t.done\n\n\tmov\tal, [ebp]\n\tpush\teax\n\tshr\tal, 4\n\tadd\tal, '0'\n\tcall\tputchar\n\tpop\teax\n\tand\tal, 0Fh\n\tadd\tal, '0'\n\tcall\tputchar\n\n\tdec\tebp\n\tjmp\tshort .next\n\n.done:\n\tpop\tebp\n\tor\tebp, ebp\n\tje\t.ret\n\n.zeros:\n\tmov\tal, '0'\n\tcall\tputchar\n\tdec\tebp\n\tjne\t.zeros\n\n.ret:\n\tret"
    ],
    "id_hash": -5460198032763687273,
    "content_hash": -5460198032763687273,
    "location": "book.translate.xml:13774",
    "context": "",
    "note": "(itstool) path: sect2/programlisting",
    "flags": "no-wrap",
    "labels": [],
    "state": 100,
    "fuzzy": false,
    "translated": true,
    "approved": false,
    "position": 2169,
    "has_suggestion": false,
    "has_comment": false,
    "has_failing_check": true,
    "num_words": 1662,
    "source_unit": "https://translate-dev.freebsd.org/api/units/92254/?format=api",
    "priority": 100,
    "id": 92254,
    "web_url": "https://translate-dev.freebsd.org/translate/freebsd-doc/boooks_developers-handbook/en/?checksum=34397ad18dd56e97",
    "url": "https://translate-dev.freebsd.org/api/units/92254/?format=api",
    "explanation": "",
    "extra_flags": "",
    "pending": false,
    "timestamp": "2019-11-02T20:37:25.361615Z"
}