Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
c158fe8f
Commit
c158fe8f
authored
27 years ago
by
Henrik (Grubba) Grubbström
Browse files
Options
Downloads
Patches
Plain Diff
Stdio.File now allows for overloading of set_{read,write,close}_callback().
Rev: lib/modules/Stdio.pmod:1.20
parent
ae7ee584
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Stdio.pmod
+65
-42
65 additions, 42 deletions
lib/modules/Stdio.pmod
with
65 additions
and
42 deletions
lib/modules/Stdio.pmod
+
65
−
42
View file @
c158fe8f
...
...
@@ -15,13 +15,20 @@ class File
#endif
mixed ___id;
int open(string file, string mode,void|int bits)
// This function is needed so that create() doesn't call an overloaded
// variant by mistake.
static private nomask int __open(string file, string mode,void|int bits)
{
_fd=Fd();
if(query_num_arg()<3) bits=0666;
return ::open(file,mode,bits);
}
int open(string file, string mode, void|int bits)
{
return __open(file, mode, bits);
}
int open_socket(int|void port, string|void address)
{
_fd=Fd();
...
...
@@ -75,12 +82,13 @@ class File
break;
default:
open(@args);
__
open(@args);
}
}
}
static int do_assign(object to, object from)
// Don't allow overloading of this function.
static private nomask int do_assign(object to, object from)
{
if((program)Fd == (program)object_program(from))
{
...
...
@@ -159,12 +167,17 @@ class File
#endif
#define CBFUNC(X) \
void set_##X (mixed l##X)
\
static private nomask
void
__
set_##X (mixed l##X) \
{ \
___##X=l##X; \
::set_##X(l##X && my_##X); \
} \
\
void set_##X (mixed l##X) \
{ \
__set_##X(l##X); \
} \
\
mixed query_##X () \
{ \
return ___##X; \
...
...
@@ -178,7 +191,11 @@ class File
#endif
mixed query_close_callback() { return ___close_callback; }
mixed set_close_callback(mixed c) { ___close_callback=c; }
static private nomask void __set_close_callback(mixed c)
{
___close_callback=c;
}
mixed set_close_callback(mixed c) { __set_close_callback(c); }
void set_id(mixed i) { ___id=i; }
mixed query_id() { return ___id; }
...
...
@@ -191,24 +208,30 @@ class File
#endif
)
{
set_read_callback(rcb);
set_write_callback(wcb);
set_close_callback(ccb);
// Use the __set_xxxx_callback() functions here, so that we
// don't call overloaded versions by mistake.
// /grubba 1998-04-10
__set_read_callback(rcb);
__set_write_callback(wcb);
__set_close_callback(ccb);
#if constant(__HAVE_OOB__)_
set_read_oob_callback(roobcb);
set_write_oob_callback(woobcb);
__
set_read_oob_callback(roobcb);
__
set_write_oob_callback(woobcb);
#endif
::set_nonblocking();
}
void set_blocking()
{
set_read_callback(0);
set_write_callback(0);
set_close_callback(0);
// Use the __set_xxxx_callback() functions here, so that we
// don't call overloaded versions by mistake.
// /grubba 1998-04-10
__set_read_callback(0);
__set_write_callback(0);
__set_close_callback(0);
#if constant(__HAVE_OOB__)_
set_read_oob_callback(0);
set_write_oob_callback(0);
__
set_read_oob_callback(0);
__
set_write_oob_callback(0);
#endif
::set_blocking();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment