Lines 1-5
Link Here
|
1 |
--- vfile-module.c.orig Tue Aug 24 00:08:56 1999 |
1 |
--- ./vfile-module.c.orig 2008-08-11 21:49:04.000000000 +0000 |
2 |
+++ vfile-module.c Sat Jan 6 20:25:43 2001 |
2 |
+++ ./vfile-module.c 2008-08-11 22:25:20.246320000 +0000 |
3 |
@@ -2067 +2067 @@ |
3 |
@@ -97,13 +97,13 @@ |
4 |
- MAKE_ICONSTANT("O_SYNC", O_SYNC), |
4 |
int ct; |
5 |
+ MAKE_ICONSTANT("O_FSYNC", O_FSYNC), |
5 |
|
|
|
6 |
if (at->data_type != SLANG_CHAR_TYPE) { |
7 |
- SLang_doerror("Operation requires character array"); |
8 |
+ SLang_verror(SL_INTRINSIC_ERROR, "Operation requires character array"); |
9 |
return -1; |
10 |
} |
11 |
|
12 |
if (len<0) ct = at->num_elements; |
13 |
else if (len > at->num_elements) { |
14 |
- SLang_doerror("Too much data for array size"); |
15 |
+ SLang_verror(SL_INTRINSIC_ERROR, "Too much data for array size"); |
16 |
return -1; |
17 |
}else ct = len; |
18 |
*data = at->data; |
19 |
@@ -446,11 +446,11 @@ |
20 |
|
21 |
VFerrno = 0; |
22 |
if (t->fd < 0) { |
23 |
- /* SLang_doerror("file already closed"); */ |
24 |
+ /* SLang_verror(SL_INTRINSIC_ERROR,"file already closed"); */ |
25 |
r = 0; goto return_r; |
26 |
} |
27 |
if (t->rdvf || t->wrvf) { |
28 |
- SLang_doerror("You must set_wrdep(*,*,0) before close"); |
29 |
+ SLang_verror(SL_INTRINSIC_ERROR, "You must set_wrdep(*,*,0) before close"); |
30 |
goto return_r; |
31 |
} |
32 |
r = close(t->fd); |
33 |
@@ -1171,7 +1171,7 @@ |
34 |
|
35 |
l = t->rbuft - t->rbufr; |
36 |
if (l <= 0) { /* shouldn't happen */ |
37 |
- SLang_doerror("read_into_buf() called with window=0"); |
38 |
+ SLang_verror(SL_INTRINSIC_ERROR,"read_into_buf() called with window=0"); |
39 |
return -1; |
40 |
} |
41 |
if (t->fd < 0 || t->flags & SJ_EOF) return 0; /* also shouldn't happen */ |
42 |
@@ -1209,7 +1209,7 @@ |
43 |
|
44 |
if (!l || t->rtermn < 0 || !(m = t->rbufr - t->rbufq)) goto dflt_ret; |
45 |
if (t->rbufq < t->rbufp) { |
46 |
- SLang_doerror("q<p"); |
47 |
+ SLang_verror(SL_INTRINSIC_ERROR, "q<p"); |
48 |
t->rbufq = t->rbufp; |
49 |
} |
50 |
if ( (cp = (char*)memchr(t->rbufq,t->rtermn,m)) |
51 |
@@ -1259,7 +1259,7 @@ |
52 |
|
53 |
/*fprintf(stderr,"fd=%d, rthrsh=%d, bytes=%d\n",t->fd,t->rthrsh,t->rbufr-t->rbufp); */ |
54 |
if (t->fd < 0) { |
55 |
- SLang_doerror("Read on closed VFile"); |
56 |
+ SLang_verror(SL_INTRINSIC_ERROR, "Read on closed VFile"); |
57 |
goto return_r; |
58 |
} |
59 |
|
60 |
@@ -1364,7 +1364,7 @@ |
61 |
|
62 |
if (!(mmt = pop_vfd(SJ_WRITE, &t))) goto free_fail; /* ct = -1 */ |
63 |
if (t->fd < 0) { |
64 |
- SLang_doerror("Write on closed VFile"); |
65 |
+ SLang_verror(SL_INTRINSIC_ERROR, "Write on closed VFile"); |
66 |
goto free_fail; |
67 |
} |
68 |
|
69 |
@@ -1420,7 +1420,7 @@ |
70 |
if (!(wr_mmt = pop_vfd(SJ_WRITE, &wt))) goto free1; |
71 |
|
72 |
if (wt != rt->wrvf || rt != wt->rdvf) { |
73 |
- SLang_doerror("copybytes filepair not linked by set_wrdep()"); |
74 |
+ SLang_verror(SL_INTRINSIC_ERROR, "copybytes filepair not linked by set_wrdep()"); |
75 |
goto free2; |
76 |
} |
77 |
|
78 |
@@ -1469,7 +1469,7 @@ |
79 |
if (!(mmt = pop_vfd(SJ_READ, &t))) return -1; /* ct = -1 */ |
80 |
|
81 |
if (t->fd < 0) { |
82 |
- SLang_doerror("Read on closed VFile"); |
83 |
+ SLang_verror(SL_INTRINSIC_ERROR,"Read on closed VFile"); |
84 |
r = -1; goto return_r; |
85 |
} |
86 |
r = check_buf_data(t); |
87 |
@@ -1672,7 +1672,7 @@ |
88 |
fnt = SLang_get_function(func_name); |
89 |
if (!fnt) {r = -2; goto return_r;} |
90 |
if (t->fd < 0) { |
91 |
- SLang_doerror("Can't set_action() on closed VFile"); |
92 |
+ SLang_verror(SL_INTRINSIC_ERROR,"Can't set_action() on closed VFile"); |
93 |
r = -3; goto return_r; |
94 |
} |
95 |
} |
96 |
@@ -1720,7 +1720,7 @@ |
97 |
) return -1; |
98 |
|
99 |
if (t->flags & SJ_UDP) { |
100 |
- SLang_doerror("only default (unbuffered) rmode makes sense for UDP"); |
101 |
+ SLang_verror(SL_INTRINSIC_ERROR,"only default (unbuffered) rmode makes sense for UDP"); |
102 |
r = -1; goto return_r; |
103 |
} |
104 |
|
105 |
@@ -1729,7 +1729,7 @@ |
106 |
if (!ct) { |
107 |
if (t->rthrsh) { /* changing from buffered to unbuffered */ |
108 |
if (t->rbufr > t->rbufp) { |
109 |
- SLang_doerror("must read data before switching to unbuffered mode"); |
110 |
+ SLang_verror(SL_INTRINSIC_ERROR,"must read data before switching to unbuffered mode"); |
111 |
r = -1; goto return_r; |
112 |
} |
113 |
SLfree(t->rbuf0); |
114 |
@@ -1737,7 +1737,7 @@ |
115 |
vfile_list_dirty = 1; /* just t */ |
116 |
} |
117 |
if (ch>=0) { |
118 |
- SLang_doerror("termination char ignored in unbuffered mode"); |
119 |
+ SLang_verror(SL_INTRINSIC_ERROR,"termination char ignored in unbuffered mode"); |
120 |
ch = -1; |
121 |
} |
122 |
} |
123 |
@@ -1802,12 +1802,12 @@ |
124 |
stkdep = _SLstack_depth() - stkdep; /* % items left on stack. */ |
125 |
/* for some reason, this next seems to cause segfault when */ |
126 |
/* used from ./vf and do_actions() is called in SLang ?! */ |
127 |
- if (stkdep && SLang_Error != USER_BREAK) { |
128 |
+ if (stkdep && USER_BREAK != SLang_get_error()) { |
129 |
SLang_verror(SL_APPLICATION_ERROR, |
130 |
"Eeek... %s() left %d units on stack",t->fns[i]->name,stkdep); |
131 |
if (stkdep>0) { |
132 |
SLdo_pop_n(stkdep); |
133 |
- SLang_Error = 0; /* probably safe to keep going */ |
134 |
+ SLang_set_error(0); /* probably safe to keep going */ |
135 |
} |
136 |
} |
137 |
|
138 |
@@ -1840,7 +1840,7 @@ |
139 |
ct++; |
140 |
do_action_i(t,0); |
141 |
if (t->fd >= 0 && t->fns[0] && rbufp == t->rbufp && check_buf_data(t) >= 0) { |
142 |
- SLang_doerror("read-action did not handle data"); |
143 |
+ SLang_verror(SL_INTRINSIC_ERROR,"read-action did not handle data"); |
144 |
t->fns[0] = NULL; /* this to radically kill it */ |
145 |
} |
146 |
}while (!vfile_list_dirty && t != tn); |
147 |
@@ -1868,7 +1868,7 @@ |
148 |
static fd_set fds[3]; /* a big one, we could malloc */ |
149 |
|
150 |
if (do_actions_dep++) { /* we are NOT recursive! */ |
151 |
- SLang_doerror("Can't call do_actions() recursively"); |
152 |
+ SLang_verror(SL_INTRINSIC_ERROR,"Can't call do_actions() recursively"); |
153 |
goto return_ct; |
154 |
} |
155 |
/*tim = (int)time(NULL); */ |
156 |
@@ -2133,8 +2133,8 @@ |
157 |
{ |
158 |
SLang_Class_Type *cl; |
159 |
|
160 |
- if (SLclass_add_typecast(SLANG_CHAR_TYPE, SLANG_INT_TYPE, char_to_int, 1) |
161 |
- || SLclass_add_typecast(SLANG_INT_TYPE, SLANG_CHAR_TYPE, int_to_char, 1)) |
162 |
+ if (SLclass_add_typecast(SLANG_CHAR_TYPE, SLANG_INT_TYPE, char_to_int, 1) |
163 |
+ || SLclass_add_typecast(SLANG_INT_TYPE, SLANG_CHAR_TYPE, int_to_char, 1)) |
164 |
{ |
165 |
fprintf(stderr,"VFile: fail add_typecast(CHAR<->INT)\n"); |
166 |
return -1; |
167 |
@@ -2151,8 +2151,9 @@ |
168 |
|
169 |
if (NULL == (cl = SLclass_allocate_class("VFile_Type"))) |
170 |
return -1; |
171 |
- cl->cl_destroy = destroy_vfile_type; |
172 |
- cl->cl_string = vfile_string; |
173 |
+ SLclass_set_destroy_function(cl, destroy_vfile_type); |
174 |
+ SLclass_set_string_function(cl, vfile_string); |
175 |
+ |
176 |
if (-1 == SLclass_register_class(cl, SJ_VFILE_TYPE, sizeof(VFILE), SLANG_CLASS_TYPE_MMT)) |
177 |
return -1; |
178 |
|