index 8b0fc0058d30c7ae1f699bcf69d5b42eba55dbbb..c7026a2b80c675e5f91bf7b457f1d94b1cad450d 100644 (file)
MODULE HostFiles;
- IMPORT S := SYSTEM, Kernel, HostLang, Files, Log, stdlib := C99stdlib,
- unistd := C99unistd, dirent := C99dirent, fcntl := C99fcntl,
- sysstat := C99sys_stat, stdio := C99stdio, errno := C99errno,
- macro := C99macro, libgen := C99libgen, time := C99time;
+ IMPORT S := SYSTEM, Kernel, HostLang, Files, Log, stdlib := PosixCstdlib,
+ unistd := PosixCunistd, dirent := PosixCdirent, fcntl := PosixCfcntl,
+ sysstat := PosixCsys_stat, stdio := PosixCstdio, errno := PosixCerrno,
+ macro := PosixCmacro, libgen := PosixClibgen, time := PosixCtime;
(* !!! add buffer cache *)
ASSERT(f.state = new, 20);
ASSERT(name # "", 21);
ASSERT(IsName(name), 22);
- HostLang.StringToHost(f.pathname, p0, FALSE, err);
+ HostLang.StringToHost(f.pathname, p0, HostLang.pep383, err);
IF err = 0 THEN
dir := f.pathname$;
DirName(dir);
- HostLang.StringToHost(dir + "/" + name, p1, FALSE, err);
+ HostLang.StringToHost(dir + "/" + name, p1, HostLang.pep383, err);
IF err = 0 THEN
x := stdio.rename(p0, p1);
IF x = 0 THEN res := 0 (* no error *)
IF f.state # closed THEN
f.Flush;
IF f.state = new THEN
- HostLang.StringToHost(f.pathname, path, FALSE, err);
+ HostLang.StringToHost(f.pathname, path, HostLang.pep383, err);
ASSERT(err = 0, 100);
res := unistd.unlink(path);
ASSERT(res = 0, 101);
BEGIN
ASSERT(loc # NIL, 20);
WITH loc: Locator DO
- HostLang.StringToHost(loc.path, pathname, FALSE, err);
+ HostLang.StringToHost(loc.path, pathname, HostLang.pep383, err);
IF err = 0 THEN
MakeDir(pathname, res);
IF res = 0 THEN
pathname := pathname + "/" + ".newXXXXXX";
fd := stdlib.mkstemp(pathname);
IF fd # -1 THEN
- NEW(f); HostLang.HostToString(pathname, f.pathname, FALSE, err);
+ NEW(f); HostLang.HostToString(pathname, f.pathname, HostLang.pep383, err);
IF err = 0 THEN
(* !!! get valid inode? *)
f.fd := fd; f.len := 0; f.state := new; f.ino := 0;
ASSERT(name # "", 21);
WITH loc: Locator DO
IF IsName(name) THEN
- HostLang.StringToHost(loc.path + "/" + name, pathname, FALSE, err);
+ HostLang.StringToHost(loc.path + "/" + name, pathname, HostLang.pep383, err);
IF err = 0 THEN
res := macro.stat(pathname, s);
IF res = 0 THEN
lock.l_pid := 0;
res := fcntl.fcntl(fd, fcntl.F_SETLK, S.ADR(lock));
IF res # -1 THEN
- NEW(f); HostLang.HostToString(pathname, f.pathname, FALSE, err);
+ NEW(f); HostLang.HostToString(pathname, f.pathname, HostLang.pep383, err);
IF err = 0 THEN
f.fd := fd; f.len := s.st_size; f.ino := s.st_ino;
IF isShared THEN f.state := shared
ASSERT(IsName(name), 21);
WITH loc: Locator DO
IF IsName(name) THEN
- HostLang.StringToHost(loc.path + "/" + name, pathname, FALSE, err);
+ HostLang.StringToHost(loc.path + "/" + name, pathname, HostLang.pep383, err);
IF err = 0 THEN
res := unistd.unlink(pathname);
IF res = 0 THEN loc.res := 0 (* no error *)
ASSERT(new # "", 22);
WITH loc: Locator DO
IF IsName(old) & IsName(new) THEN
- HostLang.StringToHost(loc.path + "/" + old, p0, FALSE, err);
+ HostLang.StringToHost(loc.path + "/" + old, p0, HostLang.pep383, err);
IF err = 0 THEN
- HostLang.StringToHost(loc.path + "/" + new, p1, FALSE, err);
+ HostLang.StringToHost(loc.path + "/" + new, p1, HostLang.pep383, err);
IF err = 0 THEN
res := stdio.rename(p0, p1);
IF res = 0 THEN loc.res := 0 (* no error *)
WITH loc0: Locator DO
WITH loc1: Locator DO
IF IsName(name0) & IsName(name1) THEN
- HostLang.StringToHost(loc0.path + "/" + name0, a0, FALSE, err);
+ HostLang.StringToHost(loc0.path + "/" + name0, a0, HostLang.pep383, err);
IF err = 0 THEN
err := macro.stat(a0, s0);
IF err = 0 THEN
- HostLang.StringToHost(loc1.path + "/" + name1, a1, FALSE, err);
+ HostLang.StringToHost(loc1.path + "/" + name1, a1, HostLang.pep383, err);
IF err = 0 THEN
err := macro.stat(a1, s1);
IF err = 0 THEN
BEGIN
ASSERT(loc # NIL, 20);
WITH loc: Locator DO
- HostLang.StringToHost(loc.path, pathname, FALSE, err);
+ HostLang.StringToHost(loc.path, pathname, HostLang.pep383, err);
IF err = 0 THEN
p := dirent.opendir(pathname);
IF p # NIL THEN
ent := dirent.readdir(p);
WHILE ent # NIL DO
- HostLang.HostToString(ent.d_name, name, FALSE, err);
+ HostLang.HostToString(ent.d_name, name, HostLang.pep383, err);
IF err = 0 THEN
- HostLang.StringToHost(loc.path + "/" + name, pathname, FALSE, err);
+ HostLang.StringToHost(loc.path + "/" + name, pathname, HostLang.pep383, err);
IF err = 0 THEN
res := macro.stat(pathname, s);
IF (res = 0) & ~IsDir(s) THEN
BEGIN
ASSERT(loc # NIL, 20);
WITH loc: Locator DO
- HostLang.StringToHost(loc.path, pathname, FALSE, err);
+ HostLang.StringToHost(loc.path, pathname, HostLang.pep383, err);
IF err = 0 THEN
p := dirent.opendir(pathname);
IF p # NIL THEN
ent := dirent.readdir(p);
WHILE ent # NIL DO
- HostLang.HostToString(ent.d_name, name, FALSE, err);
+ HostLang.HostToString(ent.d_name, name, HostLang.pep383, err);
IF err = 0 THEN
- HostLang.StringToHost(loc.path + "/" + name, pathname, FALSE, err);
+ HostLang.StringToHost(loc.path + "/" + name, pathname, HostLang.pep383, err);
IF err = 0 THEN
res := macro.stat(pathname, s);
IF (res = 0) & IsDir(s) & (name # ".") & (name # "..") THEN