summaryrefslogtreecommitdiff
path: root/FAQ-cd.txt
diff options
context:
space:
mode:
Diffstat (limited to 'FAQ-cd.txt')
-rw-r--r--FAQ-cd.txt194
1 files changed, 97 insertions, 97 deletions
diff --git a/FAQ-cd.txt b/FAQ-cd.txt
index 1583b85..afd5fae 100644
--- a/FAQ-cd.txt
+++ b/FAQ-cd.txt
@@ -701,9 +701,9 @@ A: First of all, my LUA distribution is the 5.0, slightly modified. The basic
This will copy the directory entry into the called DirTree, except the
sector and size attributes.
- :setbasicxa()
+ :setbasicsxa()
- Will set the basic XA attribute. dir:setbasicxa() is equivalent to the
+ Will set the basic XA attribute. dir:setbasicsxa() is equivalent to the
following piece of code:
dir.have_xa = true
@@ -849,13 +849,13 @@ A: First of all, my LUA distribution is the 5.0, slightly modified. The basic
Okay, I presented everything. Now for a quick and simple example of use.
This LUA script, when used with the cd-tool's luapatch command, will act
exactly like the cd-tool's copy command:
-
- dir = cdutil:findpath "/"
- rsize = dir.Size
-
- iso:foreword(cdutil)
- pvd = createpvd(cdutil)
- root = iso:setbasics(pvd, rsize / 2048)
+
+ dir = cdutil:findpath "/"
+ rsize = dir.Size
+
+ iso:foreword(cdutil)
+ pvd = createpvd(cdutil)
+ root = iso:setbasics(pvd, rsize / 2048)
iso:copydir(root, cdutil, cdutil:findpath "/")
buf = Buffer()
@@ -869,91 +869,91 @@ A: First of all, my LUA distribution is the 5.0, slightly modified. The basic
Q: What patch did you applied to the LUA compiler?
A: Only one of my own, to add support for hex and octal numbers. Here it is:
-diff -u -r1.1 llex.c
---- src/llex.c 6 Nov 2003 11:56:07 -0000
-+++ src/llex.c 19 Nov 2003 23:03:35 -0000
-@@ -172,15 +172,34 @@
-
- /* LUA_NUMBER */
- static void read_numeral (LexState *LS, int comma, SemInfo *seminfo) {
-+ int oct = 0, hex = 0;
- size_t l = 0;
- checkbuffer(LS, l);
- if (comma) save(LS, '.', l);
-- while (isdigit(LS->current)) {
-+ else if (LS->current == '0') {
-+ oct = 1;
-+ checkbuffer(LS, 1);
-+ save_and_next(LS, l);
-+ if (LS->current == 'x') {
-+ oct = 0;
-+ hex = 1;
-+ checkbuffer(LS, 1);
-+ save_and_next(LS, l);
-+ }
-+ }
-+ while (isdigit(LS->current) || (hex && isxdigit(LS->current))) {
- checkbuffer(LS, l);
- save_and_next(LS, l);
- }
-+ checkbuffer(LS, 1);
- if (LS->current == '.') {
- save_and_next(LS, l);
-+ if (hex || oct) {
-+ save(LS, '\0', l);
-+ luaX_lexerror(LS,
-+ "error in number, mixing decimal point with octal or hexadecimal",
-+ TK_NUMBER);
-+ }
- if (LS->current == '.') {
- save_and_next(LS, l);
- save(LS, '\0', l);
-@@ -195,6 +214,12 @@
- }
- if (LS->current == 'e' || LS->current == 'E') {
- save_and_next(LS, l); /* read `E' */
-+ if (hex || oct) {
-+ save(LS, '\0', l);
-+ luaX_lexerror(LS,
-+ "error in number, mixing exponential with octal or hexadecimal",
-+ TK_NUMBER);
-+ }
- if (LS->current == '+' || LS->current == '-')
- save_and_next(LS, l); /* optional exponent sign */
- while (isdigit(LS->current)) {
-diff -u -r1.1 lobject.c
---- src/lobject.c 6 Nov 2003 11:56:07 -0000
-+++ src/lobject.c 19 Nov 2003 23:03:35 -0000
-@@ -20,13 +20,6 @@
- #include "lstring.h"
- #include "lvm.h"
-
--
--/* function to convert a string to a lua_Number */
--#ifndef lua_str2number
--#define lua_str2number(s,p) strtod((s), (p))
--#endif
--
--
- const TObject luaO_nilobject = {LUA_TNIL, {NULL}};
-
-
-@@ -91,7 +84,17 @@
-
- int luaO_str2d (const char *s, lua_Number *result) {
- char *endptr;
-- lua_Number res = lua_str2number(s, &endptr);
-+ size_t l = strlen(s);
-+ lua_Number res;
-+ if ((l > 0) && (s[0] == '0')) {
-+ if ((l > 2) && (s[1] == 'x')) {
-+ res = strtol(s + 2, &endptr, 16);
-+ } else {
-+ res = strtol(s + 1, &endptr, 8);
-+ }
-+ } else {
-+ res = strtod(s, &endptr);
-+ }
- if (endptr == s) return 0; /* no conversion */
- while (isspace((unsigned char)(*endptr))) endptr++;
- if (*endptr != '\0') return 0; /* invalid trailing characters? */
+diff -u -r1.1 llex.c
+--- src/llex.c 6 Nov 2003 11:56:07 -0000
++++ src/llex.c 19 Nov 2003 23:03:35 -0000
+@@ -172,15 +172,34 @@
+
+ /* LUA_NUMBER */
+ static void read_numeral (LexState *LS, int comma, SemInfo *seminfo) {
++ int oct = 0, hex = 0;
+ size_t l = 0;
+ checkbuffer(LS, l);
+ if (comma) save(LS, '.', l);
+- while (isdigit(LS->current)) {
++ else if (LS->current == '0') {
++ oct = 1;
++ checkbuffer(LS, 1);
++ save_and_next(LS, l);
++ if (LS->current == 'x') {
++ oct = 0;
++ hex = 1;
++ checkbuffer(LS, 1);
++ save_and_next(LS, l);
++ }
++ }
++ while (isdigit(LS->current) || (hex && isxdigit(LS->current))) {
+ checkbuffer(LS, l);
+ save_and_next(LS, l);
+ }
++ checkbuffer(LS, 1);
+ if (LS->current == '.') {
+ save_and_next(LS, l);
++ if (hex || oct) {
++ save(LS, '\0', l);
++ luaX_lexerror(LS,
++ "error in number, mixing decimal point with octal or hexadecimal",
++ TK_NUMBER);
++ }
+ if (LS->current == '.') {
+ save_and_next(LS, l);
+ save(LS, '\0', l);
+@@ -195,6 +214,12 @@
+ }
+ if (LS->current == 'e' || LS->current == 'E') {
+ save_and_next(LS, l); /* read `E' */
++ if (hex || oct) {
++ save(LS, '\0', l);
++ luaX_lexerror(LS,
++ "error in number, mixing exponential with octal or hexadecimal",
++ TK_NUMBER);
++ }
+ if (LS->current == '+' || LS->current == '-')
+ save_and_next(LS, l); /* optional exponent sign */
+ while (isdigit(LS->current)) {
+diff -u -r1.1 lobject.c
+--- src/lobject.c 6 Nov 2003 11:56:07 -0000
++++ src/lobject.c 19 Nov 2003 23:03:35 -0000
+@@ -20,13 +20,6 @@
+ #include "lstring.h"
+ #include "lvm.h"
+
+-
+-/* function to convert a string to a lua_Number */
+-#ifndef lua_str2number
+-#define lua_str2number(s,p) strtod((s), (p))
+-#endif
+-
+-
+ const TObject luaO_nilobject = {LUA_TNIL, {NULL}};
+
+
+@@ -91,7 +84,17 @@
+
+ int luaO_str2d (const char *s, lua_Number *result) {
+ char *endptr;
+- lua_Number res = lua_str2number(s, &endptr);
++ size_t l = strlen(s);
++ lua_Number res;
++ if ((l > 0) && (s[0] == '0')) {
++ if ((l > 2) && (s[1] == 'x')) {
++ res = strtol(s + 2, &endptr, 16);
++ } else {
++ res = strtol(s + 1, &endptr, 8);
++ }
++ } else {
++ res = strtod(s, &endptr);
++ }
+ if (endptr == s) return 0; /* no conversion */
+ while (isspace((unsigned char)(*endptr))) endptr++;
+ if (*endptr != '\0') return 0; /* invalid trailing characters? */