Skip to content

Commit 8f397ee

Browse files
author
llgoer
committed
完善更多翻译内容
1 parent 62afe72 commit 8f397ee

File tree

1 file changed

+66
-66
lines changed

1 file changed

+66
-66
lines changed

README.md

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ QuickJS Javascript引擎
5050
* [4.3.4 Numbers](#434-numbers)
5151
* [4.3.5 垃圾回收](#435-垃圾回收)
5252
* [4.3.6 JSValue](#436-jsvalue)
53-
* [4.3.7 Function call](#437-function-call)
53+
* [4.3.7 函数调用](#437-函数调用)
5454
* [4.4 RegExp](#44-regexp)
5555
* [4.5 Unicode](#45-unicode)
5656
* [4.6 BigInt and BigFloat](#46-bigint-and-bigfloat)
@@ -358,130 +358,130 @@ ES6模块完全支持。默认名称解析规则如下:
358358

359359
`EPIPE`
360360

361-
Integer value of common errors (additional error codes may be defined).
361+
常见错误的整数值 (可以定义附加错误代码)。
362362

363363
`strerror(errno)`
364364

365-
Return a string that describes the error `errno`.
365+
返回描述错误的字符串`errno`.
366366

367367
`open(filename, flags)`
368368

369-
Open a file (wrapper to the libc `fopen()`). Throws `std.Error` in case of I/O error.
369+
打开一个文件(libc的包装器`fopen()`)。在I/O错误时抛出 `std.Error`
370370

371371
`tmpfile()`
372372

373-
Open a temporary file. Throws `std.Error` in case of I/O error.
373+
打开一个临时文件。在I/O错误时抛出`std.Error`
374374

375375
`puts(str)`
376376

377-
Equivalent to `std.out.puts(str)`.
377+
相当于`std.out.puts(str)`.
378378

379379
`printf(fmt, ...args)`
380380

381-
Equivalent to `std.out.printf(fmt, ...args)`
381+
相当于`std.out.printf(fmt, ...args)`
382382

383383
`sprintf(fmt, ...args)`
384384

385-
Equivalent to the libc sprintf().
385+
相当于libc的sprintf().
386386

387387
`in`
388388

389389
`out`
390390

391391
`err`
392392

393-
Wrappers to the libc file `stdin`, `stdout`, `stderr`.
393+
包装libc文件的`stdin`, `stdout`, `stderr`.
394394

395395
`SEEK_SET`
396396

397397
`SEEK_CUR`
398398

399399
`SEEK_END`
400400

401-
Constants for seek().
401+
seek()的常量
402402

403403
`global`
404404

405-
Reference to the global object.
405+
引用全局对象。
406406

407407
`gc()`
408408

409-
Manually invoke the cycle removal algorithm. The cycle removal algorithm is automatically started when needed, so this function is useful in case of specific memory constraints or for testing.
409+
手动调用循环删除算法。循环移除算法在需要时自动启动,因此该功能在特定内存限制或测试时非常有用。
410410

411411
`getenv(name)`
412412

413-
Return the value of the environment variable `name` or `undefined` if it is not defined.
413+
返回环境变量的值 `name` ,或未定义时返回 `undefined` .
414414

415-
FILE prototype:
415+
FILE 原型:
416416

417417
`close()`
418418

419-
Close the file.
419+
关闭文件。
420420

421421
`puts(str)`
422422

423-
Outputs the string with the UTF-8 encoding.
423+
使用UTF-8编码输出字符串。
424424

425425
`printf(fmt, ...args)`
426426

427-
Formatted printf, same formats as the libc printf.
427+
格式化printf,与libc printf格式相同。
428428

429429
`flush()`
430430

431-
Flush the buffered file.
431+
刷新缓冲的文件。
432432

433433
`seek(offset, whence)`
434434

435-
Seek to a give file position (whence is `std.SEEK_*`). Throws a `std.Error` in case of I/O error.
435+
寻找特定文件位置 (从哪里`std.SEEK_*`)。在I/O错误时抛出 `std.Error`
436436

437437
`tell()`
438438

439-
Return the current file position.
439+
返回当前文件位置。
440440

441441
`eof()`
442442

443-
Return true if end of file.
443+
如果文件结束,则返回true。
444444

445445
`fileno()`
446446

447-
Return the associated OS handle.
447+
返回关联的OS句柄。
448448

449449
`read(buffer, position, length)`
450450

451-
Read `length` bytes from the file to the ArrayBuffer `buffer` at byte position `position` (wrapper to the libc `fread`).
451+
Read `length` bytes from the file to the ArrayBuffer `buffer` at byte position `position` (libc的包装器`fread`)。
452452

453453
`write(buffer, position, length)`
454454

455455
Write `length` bytes to the file from the ArrayBuffer `buffer` at byte position `position` (wrapper to the libc `fread`).
456456

457457
`getline()`
458458

459-
Return the next line from the file, assuming UTF-8 encoding, excluding the trailing line feed.
459+
返回文件中的下一行,假设为UTF-8编码,不包括尾随换行符。
460460

461461
`getByte()`
462462

463-
Return the next byte from the file.
463+
返回文件中的下一个字节。
464464

465465
`putByte(c)`
466466

467-
Write one byte to the file.
467+
将一个字节写入文件。
468468

469469
#### 3.3.3 `os` 模块
470470

471-
The `os` module provides Operating System specific functions:
471+
`os` 模块提供操作系统特定功能:
472472

473-
* low level file access
474-
* signals
475-
* timers
476-
* asynchronous I/O
473+
* 底层文件访问
474+
* 信号
475+
* 计时器
476+
* 异步 I/O
477477

478-
The OS functions usually return 0 if OK or an OS specific negative error code.
478+
如果是OK,OS函数通常返回0,或者OS返回特定的错误代码。
479479

480-
Available exports:
480+
可用导出函数:
481481

482482
`open(filename, flags, mode = 0o666)`
483483

484-
Open a file. Return a handle or < 0 if error.
484+
打开一个文件。如果错误,返回句柄或<0。
485485

486486
`O_RDONLY`
487487

@@ -497,19 +497,19 @@ Open a file. Return a handle or < 0 if error.
497497

498498
`O_TRUNC`
499499

500-
POSIX open flags.
500+
POSIX打开标志。
501501

502502
`O_TEXT`
503503

504-
(Windows specific). Open the file in text mode. The default is binary mode.
504+
(Windows特定)。以文本模式打开文件。默认为二进制模式。
505505

506506
`close(fd)`
507507

508-
Close the file handle `fd`.
508+
关闭文件句柄`fd`.
509509

510510
`seek(fd, offset, whence)`
511511

512-
Seek in the file. Use `std.SEEK_*` for `whence`.
512+
寻找文件。使用 `std.SEEK_*` `whence`.
513513

514514
`read(fd, buffer, offset, length)`
515515

@@ -521,35 +521,35 @@ Write `length` bytes to the file handle `fd` from the ArrayBuffer `buffer` at by
521521

522522
`isatty(fd)`
523523

524-
Return `true` is `fd` is a TTY (terminal) handle.
524+
`fd` 是一个TTY (终端)句柄返回 `true`
525525

526526
`ttyGetWinSize(fd)`
527527

528-
Return the TTY size as `[width, height]` or `null` if not available.
528+
返回TTY大小 `[width, height]` 或者如果不可用返回 `null`
529529

530530
`ttySetRaw(fd)`
531531

532-
Set the TTY in raw mode.
532+
在原始模式下设置TTY。
533533

534534
`remove(filename)`
535535

536-
Remove a file. Return 0 if OK or < 0 if error.
536+
删除文件。如果正常则返回0,如果错误则返回<0
537537

538538
`rename(oldname, newname)`
539539

540-
Rename a file. Return 0 if OK or < 0 if error.
540+
重命名文件。如果正常则返回0,如果错误则返回<0
541541

542542
`setReadHandler(fd, func)`
543543

544-
Add a read handler to the file handle `fd`. `func` is called each time there is data pending for `fd`. A single read handler per file handle is supported. Use `func = null` to remove the hander.
544+
将读处理程序添加到文件句柄`fd``fd`每次有数据待增加处理时调用`func` 。支持每个文件句柄的单个读处理程序。使用 `func = null` 来删除句柄。
545545

546546
`setWriteHandler(fd, func)`
547547

548-
Add a write handler to the file handle `fd`. `func` is called each time data can be written to `fd`. A single write handler per file handle is supported. Use `func = null` to remove the hander.
548+
将写处理程序添加到文件句柄`fd``fd`每次有数据待写入处理时调用`func` . 支持每个文件句柄一个写处理程序。使用 `func = null来删除句柄。
549549

550550
`signal(signal, func)`
551551

552-
Call the function `func` when the signal `signal` happens. Only a single handler per signal number is supported. Use `null` to set the default handler or `undefined` to ignore the signal.
552+
当信号 `signal` 发生时调用 `func` 。 每个信号编号只支持一个处理程序。使用 `null` 设定的默认处理或 `undefined` 忽略的信号。
553553

554554
`SIGINT`
555555

@@ -563,23 +563,23 @@ Call the function `func` when the signal `signal` happens. Only a single handler
563563

564564
`SIGTERM`
565565

566-
POSIX signal numbers.
566+
POSIX 信号编号。
567567

568568
`setTimeout(func, delay)`
569569

570-
Call the function `func` after `delay` ms. Return a handle to the timer.
570+
`delay` 毫秒之后调用函数 `func` 。返回计时器的句柄。
571571

572572
`clearTimer(handle)`
573573

574-
Cancel a timer.
574+
取消计时器。
575575

576576
`platform`
577577

578-
Return a string representing the platform: `"linux"`, `"darwin"`, `"win32"` or `"js"`.
578+
返回表示该平台的字符串: `"linux"`, `"darwin"`, `"win32"` or `"js"`.
579579

580580
### 3.4 QuickJS C API
581581

582-
The C API was designed to be simple and efficient. The C API is defined in the header `quickjs.h`.
582+
C API的设计简单而有效。C API在`quickjs.h`标头中定义。
583583

584584
#### 3.4.1 运行时和上下文
585585

@@ -708,42 +708,42 @@ In 64-bit code, JSValue are 128-bit large and no NaN boxing is used. The rationa
708708

709709
In both cases (32 or 64 bits), JSValue exactly fits two CPU registers, so it can be efficiently returned by C functions.
710710

711-
#### 4.3.7 Function call
711+
#### 4.3.7 函数调用
712712

713-
The engine is optimized so that function calls are fast. The system stack holds the Javascript parameters and local variables.
713+
引擎已经过优化,因此函数调用很快。系统堆栈包含Javascript参数和局部变量。
714714

715715
### 4.4 RegExp
716716

717-
A specific regular expression engine was developped. It is both small and efficient and supports all the ES2019 features including the Unicode properties. As the Javascript compiler, it directly generates bytecode without a parse tree.
717+
开发了一个特定的正则表达式引擎。它既小又高效,并支持所有ES2020功能,包括Unicode属性。作为Javascript编译器,它直接生成没有解析树的字节码。
718718

719-
Backtracking with an explicit stack is used so that there is no recursion on the system stack. Simple quantizers are specifically optimized to avoid recursions.
719+
使用显式堆栈的回溯使得系统堆栈上没有递归。简单的量化器经过专门优化,以避免递归。
720720

721-
Infinite recursions coming from quantizers with empty terms are avoided.
721+
来自具有空项的量化器的无限递归被避免。
722722

723-
The full regexp library weights about 15 KiB (x86 code), excluding the Unicode library.
723+
完整的正则表达式文件库的权重约为15 KiB(x86代码),不包括Unicode库。
724724

725725
### 4.5 Unicode
726726

727-
A specific Unicode library was developped so that there is no dependency on an external large Unicode library such as ICU. All the Unicode tables are compressed while keeping a reasonnable access speed.
727+
开发了一个特定的Unicode库,因此不依赖于外部大型Unicode库,例如ICU。压缩所有Unicode表,同时保持合理的访问速度。
728728

729-
The library supports case conversion, Unicode normalization, Unicode script queries, Unicode general category queries and all Unicode binary properties.
729+
该库支持大小写转换,Unicode规范化,Unicode脚本查询,Unicode常规类别查询和所有Unicode二进制属性。
730730

731-
The full Unicode library weights about 45 KiB (x86 code).
731+
完整的Unicode库大约重量为45 KiB(x86代码)。
732732

733-
### 4.6 BigInt and BigFloat
733+
### 4.6 BigInt BigFloat
734734

735-
BigInt and BigFloat are implemented with the `libbf` library[4](#FOOT4). It weights about 60 KiB (x86 code) and provides arbitrary precision IEEE 754 floating point operations and transcendental functions with exact rounding.
735+
BigInt BigFloat 是用`libbf``libbf` 库实现的[4](#FOOT4)。 它大概有60 KiB (x86 代码) 并提供任意精度的IEEE 754 浮点运算和具有精确舍入的超越函数。
736736

737737
5 许可协议
738738
---------
739739

740-
QuickJS is released under the MIT license.
740+
QuickJS 在MIT协议下发布。
741741

742-
Unless otherwise specified, the QuickJS sources are copyright Fabrice Bellard and Charlie Gordon.
742+
除非另有说明,否则QuickJS来源的版权归Fabrice Bellard和Charlie Gordon所有。
743743

744744
* * *
745745

746-
#### Footnotes
746+
#### 脚注
747747

748748
### [(1)](#DOCF1)
749749

@@ -755,7 +755,7 @@ Unless otherwise specified, the QuickJS sources are copyright Fabrice Bellard an
755755

756756
### [(3)](#DOCF3)
757757

758-
We believe the current specification of tails calls is too complicated and presents limited practical interests.
758+
我们认为目前的尾部调用规范过于复杂,并且实际利益有限。
759759

760760
### [(4)](#DOCF4)
761761

0 commit comments

Comments
 (0)