mirror of
https://github.com/lua/lua.git
synced 2024-11-23 02:03:55 +08:00
Several details about 5.4.0 rc1
Corrected several small details: added 'const', adjusts in tabs x spaces, removed unused #includes and #defines, misspellings, etc.
This commit is contained in:
parent
cac075a122
commit
0ddc0f47bd
@ -16,7 +16,7 @@
|
||||
#define vmbreak vmfetch(); vmdispatch(GET_OPCODE(i));
|
||||
|
||||
|
||||
static void *disptab[NUM_OPCODES] = {
|
||||
static const void *const disptab[NUM_OPCODES] = {
|
||||
|
||||
#if 0
|
||||
** you can update the following list with this command:
|
||||
|
@ -328,7 +328,7 @@ static Rand64 nextrand (Rand64 *state) {
|
||||
*/
|
||||
|
||||
/* must throw out the extra (64 - FIGS) bits */
|
||||
#define shift64_FIG (64 - FIGS)
|
||||
#define shift64_FIG (64 - FIGS)
|
||||
|
||||
/* to scale to [0, 1), multiply by scaleFIG = 2^(-FIGS) */
|
||||
#define scaleFIG (l_mathop(0.5) / ((Rand64)1 << (FIGS - 1)))
|
||||
|
@ -269,8 +269,6 @@ static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) {
|
||||
#endif
|
||||
|
||||
|
||||
#define AUXMARK "\1" /* auxiliary mark */
|
||||
|
||||
|
||||
/*
|
||||
** return registry.LUA_NOENV as a boolean
|
||||
|
@ -356,8 +356,7 @@ typedef struct GCObject {
|
||||
|
||||
|
||||
/*
|
||||
** Header for string value; string bytes follow the end of this structure
|
||||
** (aligned according to 'UTString'; see next).
|
||||
** Header for string value; string bytes follow the end of this structure.
|
||||
*/
|
||||
typedef struct TString {
|
||||
CommonHeader;
|
||||
|
@ -10,8 +10,6 @@
|
||||
#include "lprefix.h"
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "lopcodes.h"
|
||||
|
||||
|
||||
|
20
lopcodes.h
20
lopcodes.h
@ -201,9 +201,9 @@ OP_MOVE,/* A B R[A] := R[B] */
|
||||
OP_LOADI,/* A sBx R[A] := sBx */
|
||||
OP_LOADF,/* A sBx R[A] := (lua_Number)sBx */
|
||||
OP_LOADK,/* A Bx R[A] := K[Bx] */
|
||||
OP_LOADKX,/* A R[A] := K[extra arg] */
|
||||
OP_LOADFALSE,/* A R[A] := false */
|
||||
OP_LFALSESKIP,/*A R[A] := false; pc++ */
|
||||
OP_LOADKX,/* A R[A] := K[extra arg] */
|
||||
OP_LOADFALSE,/* A R[A] := false */
|
||||
OP_LFALSESKIP,/*A R[A] := false; pc++ */
|
||||
OP_LOADTRUE,/* A R[A] := true */
|
||||
OP_LOADNIL,/* A B R[A], R[A+1], ..., R[A+B] := nil */
|
||||
OP_GETUPVAL,/* A B R[A] := UpValue[B] */
|
||||
@ -263,11 +263,11 @@ OP_BNOT,/* A B R[A] := ~R[B] */
|
||||
OP_NOT,/* A B R[A] := not R[B] */
|
||||
OP_LEN,/* A B R[A] := length of R[B] */
|
||||
|
||||
OP_CONCAT,/* A B R[A] := R[A].. ... ..R[A + B - 1] */
|
||||
OP_CONCAT,/* A B R[A] := R[A].. ... ..R[A + B - 1] */
|
||||
|
||||
OP_CLOSE,/* A close all upvalues >= R[A] */
|
||||
OP_TBC,/* A mark variable A "to be closed" */
|
||||
OP_JMP,/* sJ pc += sJ */
|
||||
OP_JMP,/* sJ pc += sJ */
|
||||
OP_EQ,/* A B k if ((R[A] == R[B]) ~= k) then pc++ */
|
||||
OP_LT,/* A B k if ((R[A] < R[B]) ~= k) then pc++ */
|
||||
OP_LE,/* A B k if ((R[A] <= R[B]) ~= k) then pc++ */
|
||||
@ -279,15 +279,15 @@ OP_LEI,/* A sB k if ((R[A] <= sB) ~= k) then pc++ */
|
||||
OP_GTI,/* A sB k if ((R[A] > sB) ~= k) then pc++ */
|
||||
OP_GEI,/* A sB k if ((R[A] >= sB) ~= k) then pc++ */
|
||||
|
||||
OP_TEST,/* A k if (not R[A] == k) then pc++ */
|
||||
OP_TEST,/* A k if (not R[A] == k) then pc++ */
|
||||
OP_TESTSET,/* A B k if (not R[B] == k) then pc++ else R[A] := R[B] */
|
||||
|
||||
OP_CALL,/* A B C R[A], ... ,R[A+C-2] := R[A](R[A+1], ... ,R[A+B-1]) */
|
||||
OP_TAILCALL,/* A B C k return R[A](R[A+1], ... ,R[A+B-1]) */
|
||||
|
||||
OP_RETURN,/* A B C k return R[A], ... ,R[A+B-2] (see note) */
|
||||
OP_RETURN0,/* return */
|
||||
OP_RETURN1,/* A return R[A] */
|
||||
OP_RETURN0,/* return */
|
||||
OP_RETURN1,/* A return R[A] */
|
||||
|
||||
OP_FORLOOP,/* A Bx update counters; if loop continues then pc-=Bx; */
|
||||
OP_FORPREP,/* A Bx <check values and prepare counters>;
|
||||
@ -301,9 +301,9 @@ OP_SETLIST,/* A B C k R[A][(C-1)*FPF+i] := R[A+i], 1 <= i <= B */
|
||||
|
||||
OP_CLOSURE,/* A Bx R[A] := closure(KPROTO[Bx]) */
|
||||
|
||||
OP_VARARG,/* A C R[A], R[A+1], ..., R[A+C-2] = vararg */
|
||||
OP_VARARG,/* A C R[A], R[A+1], ..., R[A+C-2] = vararg */
|
||||
|
||||
OP_VARARGPREP,/*A (adjust vararg parameters) */
|
||||
OP_VARARGPREP,/*A (adjust vararg parameters) */
|
||||
|
||||
OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
|
||||
} OpCode;
|
||||
|
@ -7,6 +7,9 @@
|
||||
#if !defined(lopnames_h)
|
||||
#define lopnames_h
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
/* ORDER OP */
|
||||
|
||||
static const char *const opnames[] = {
|
||||
|
2
loslib.c
2
loslib.c
@ -91,7 +91,7 @@
|
||||
|
||||
/* ISO C definitions */
|
||||
#define l_gmtime(t,r) ((void)(r)->tm_sec, gmtime(t))
|
||||
#define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t))
|
||||
#define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t))
|
||||
|
||||
#endif /* } */
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
/*
|
||||
** Windows stuff
|
||||
*/
|
||||
#if defined(_WIN32) /* { */
|
||||
#if defined(_WIN32) /* { */
|
||||
|
||||
#if !defined(_CRT_SECURE_NO_WARNINGS)
|
||||
#define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */
|
||||
|
2
ltable.h
2
ltable.h
@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
/* returns the Node, given the value of a table entry */
|
||||
#define nodefromval(v) cast(Node *, (v))
|
||||
#define nodefromval(v) cast(Node *, (v))
|
||||
|
||||
|
||||
LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key);
|
||||
|
4
lvm.h
4
lvm.h
@ -41,9 +41,9 @@
|
||||
** Rounding modes for float->integer coercion
|
||||
*/
|
||||
typedef enum {
|
||||
F2Ieq, /* no rounding; accepts only integral values */
|
||||
F2Ieq, /* no rounding; accepts only integral values */
|
||||
F2Ifloor, /* takes the floor of the number */
|
||||
F2Iceil, /* takes the ceil of the number */
|
||||
F2Iceil /* takes the ceil of the number */
|
||||
} F2Imod;
|
||||
|
||||
|
||||
|
@ -9013,7 +9013,7 @@ not a float.
|
||||
Literal decimal integer constants that overflow are read as floats,
|
||||
instead of wrapping around.
|
||||
You can use hexadecimal notation for such constants if you
|
||||
want the old bevhavior
|
||||
want the old behavior
|
||||
(reading them as integers with wrap around).
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user