(ByteFlow is actually a file descriptor, it is a base class of regular
file, fifo file, socket file character file...)
Perfect fit! Any idea that 'graphics' be a file descriptor?
In recent revision of libwy (a C++ library that wraps Clib functions), I feel the so called 'graphics' can be a file descriptor.
if((r=popen(GrSvr,cpid,frd,fwr))!=Ok) {
WY_THROW(r);
}
wij <wyniijj5@gmail.com> writes:I would like to have opinions about the idea "graphics being a file descriptor".
In recent revision of libwy (a C++ library that wraps Clib functions), I feel
the so called 'graphics' can be a file descriptor.
A file *descriptor* is a small integer referring to some file-like
entity, used with open/close/read/write. There's no such thing in
standard C; it's a POSIX concept.
I don't think you're actually working with file descriptors, though it's
hard to tell.
if((r=popen(GrSvr,cpid,frd,fwr))!=Ok) {
WY_THROW(r);
}
popen() is a POSIX function. It takes two arguments, not four.
The code you posted is C++. Why are you posting it to comp.lang.c?
[...]
On Wed, 2025-01-01 at 01:29 -0800, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
In recent revision of libwy (a C++ library that wraps Clib functions), I feel
the so called 'graphics' can be a file descriptor.
A file *descriptor* is a small integer referring to some file-like
entity, used with open/close/read/write. There's no such thing in
standard C; it's a POSIX concept.
I don't think you're actually working with file descriptors, though it's
hard to tell.
if((r=popen(GrSvr,cpid,frd,fwr))!=Ok) {
WY_THROW(r);
}
popen() is a POSIX function. It takes two arguments, not four.
The code you posted is C++. Why are you posting it to comp.lang.c?
[...]
I would like to have opinions about the idea "graphics being a file descriptor".
The implement is irrevent for the discussion. Some imagination is required.
On 01/01/2025 11:05, wij wrote:
On Wed, 2025-01-01 at 01:29 -0800, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
In recent revision of libwy (a C++ library that wraps Clib functions), I feel
the so called 'graphics' can be a file descriptor.
A file *descriptor* is a small integer referring to some file-like entity, used with open/close/read/write. There's no such thing in standard C; it's a POSIX concept.
I don't think you're actually working with file descriptors, though it's hard to tell.
if((r=popen(GrSvr,cpid,frd,fwr))!=Ok) {
WY_THROW(r);
}
popen() is a POSIX function. It takes two arguments, not four.
The code you posted is C++. Why are you posting it to comp.lang.c?
[...]
I would like to have opinions about the idea "graphics being a file descriptor".
The implement is irrevent for the discussion. Some imagination is required.
You'll need to explain what you mean by `graphics` or `'graphics`. WhatYes, in MS-Windonw, file descriptor is probably still 'file handle' (as in DOS).
is it now? What is it anyway?
Are you refering to the 'handles' that graphics libraries sometimes use
to refer to windows etc? If so what would be the advantages of having
them being file descriptors? Could those advantages be possible in any
other way?
How would it simplify your C++ code?
Some time ago, I had a scripting language where you could write:Yes, looked like what I expect. But file descriptor is a stronger request (or provision) than library codes. It will simply more and would standardize 'graphics' to some extent enough for 'normal programs' (commercial programs alway seek breakthrough, you cannot expect to fully standardize it).
print #x, "hello"
With x being either 'con' (the default if omitted), an open file handle,
a string destination, a printer or plotter handle, or the handle to an image, window or control (button etc).
So this allowed you write text into any of those, via the convenience of 'print' which stringified or serialised many kinds of data, and also
kept track of the current text position.
Is this one of the advantages?
Actually I'm surprised that in Linux, everything isn't already a file anyway.??? to my knowledge, in Linux 'everything' is file descriptor.
Actually I'm surprised that in Linux, everything isn't already a file
anyway.
On Wed, 2025-01-01 at 01:29 -0800, Keith Thompson wrote:[...]
[...]A file *descriptor* is a small integer referring to some file-like
entity, used with open/close/read/write. There's no such thing in
standard C; it's a POSIX concept.
I would like to have opinions about the idea "graphics being a file descriptor". The implement is irrevent for the discussion. Some
imagination is required.
Why do you insist on referring to "file descriptors"? That's a specific
term with a specific meaning: a small integer value used in POSIX I/O
(not in standard C).
3.141 File Descriptor
A per-process unique, non-negative integer used to identify an open
file for the purpose of file access. The values 0, 1, and 2 have
special meaning and conventional uses, and are referred to as standard
input, standard output, and standard error, respectively. Programs
usually take their input from standard input, and write output on
standard output. Diagnostic messages are usually written on standard
error. The value of a newly-created file descriptor is from zero to {OPEN_MAX}-1. A file descriptor can have a value greater than or equal
to {OPEN_MAX} if the value of {OPEN_MAX} has decreased (see sysconf)
since the file descriptor was opened. File descriptors may also be
used to implement message catalog descriptors and directory streams;
see also 3.241 Open File Description.
... a small integer value used in POSIX I/O ...
wij <wyniijj5@gmail.com> writes:I do not insist anything. I would just like to have an opinion on the idea "graphics being a file descriptor".
On Wed, 2025-01-01 at 01:29 -0800, Keith Thompson wrote:[...]
[...]A file *descriptor* is a small integer referring to some file-like entity, used with open/close/read/write. There's no such thing in standard C; it's a POSIX concept.
I would like to have opinions about the idea "graphics being a file descriptor". The implement is irrevent for the discussion. Some imagination is required.
Why do you insist on referring to "file descriptors"? That's a specific term with a specific meaning: a small integer value used in POSIX I/O
(not in standard C).
If you mean FILE* pointers, the discussion might have some relevance toIn one scenario, I can take that as 'the opinion'.
C. If you really mean POSIX file descriptors, comp.unix.programmer
might be a better place.
Sure, you could have a graphics system where a program interacts withFILE* is full of 'upgrade' enough not to consider (technically this is only my
the display by reading and writing to FILE* pointers. You'd have to
encode the operations and returned data as streams of bytes. I'm not convinced there would be much advantage.
On Wed, 2025-01-01 at 12:07 +0000, bart wrote:
On 01/01/2025 11:05, wij wrote:
On Wed, 2025-01-01 at 01:29 -0800, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
In recent revision of libwy (a C++ library that wraps Clib functions), I feel
the so called 'graphics' can be a file descriptor.
A file *descriptor* is a small integer referring to some file-like
entity, used with open/close/read/write. There's no such thing in
standard C; it's a POSIX concept.
I don't think you're actually working with file descriptors, though it's >>>> hard to tell.
if((r=popen(GrSvr,cpid,frd,fwr))!=Ok) {
WY_THROW(r);
}
popen() is a POSIX function. It takes two arguments, not four.
The code you posted is C++. Why are you posting it to comp.lang.c?
[...]
I would like to have opinions about the idea "graphics being a file descriptor".
The implement is irrevent for the discussion. Some imagination is required. >>>
You'll need to explain what you mean by `graphics` or `'graphics`. What
is it now? What is it anyway?
Are you refering to the 'handles' that graphics libraries sometimes use
to refer to windows etc? If so what would be the advantages of having
them being file descriptors? Could those advantages be possible in any
other way?
How would it simplify your C++ code?
Yes, in MS-Windonw, file descriptor is probably still 'file handle' (as in DOS).
I am mainly referring to Linux (or systems that relies on file descriptor). The usual graphics library, especially with GUI,... seriously interfere the the 'normal' program. E.g. you are not expected to have a clean source program
that simply edits a picture file.
Some time ago, I had a scripting language where you could write:
print #x, "hello"
With x being either 'con' (the default if omitted), an open file handle,
a string destination, a printer or plotter handle, or the handle to an
image, window or control (button etc).
So this allowed you write text into any of those, via the convenience of
'print' which stringified or serialised many kinds of data, and also
kept track of the current text position.
Is this one of the advantages?
Yes, looked like what I expect. But file descriptor is a stronger request (or provision) than library codes. It will simply more and would standardize 'graphics' to some extent enough for 'normal programs' (commercial programs alway seek breakthrough, you cannot expect to fully standardize it).
Are there any problem doing 'graphics' with your print script? I am mainly looking for 'clean'/reusabe source code.
??? to my knowledge, in Linux 'everything' is file descriptor.
On Wed, 2025-01-01 at 14:33 -0800, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
On Wed, 2025-01-01 at 01:29 -0800, Keith Thompson wrote:[...]
[...]A file *descriptor* is a small integer referring to some file-like
entity, used with open/close/read/write. There's no such thing in
standard C; it's a POSIX concept.
I would like to have opinions about the idea "graphics being a file
descriptor". The implement is irrevent for the discussion. Some
imagination is required.
Why do you insist on referring to "file descriptors"? That's a specific
term with a specific meaning: a small integer value used in POSIX I/O
(not in standard C).
I do not insist anything. I would just like to have an opinion on the idea "graphics being a file descriptor".
wij <wyniijj5@gmail.com> writes:
On Wed, 2025-01-01 at 14:33 -0800, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
On Wed, 2025-01-01 at 01:29 -0800, Keith Thompson wrote:[...]
[...]A file *descriptor* is a small integer referring to some file-like
entity, used with open/close/read/write. There's no such thing in
standard C; it's a POSIX concept.
I would like to have opinions about the idea "graphics being a file
descriptor". The implement is irrevent for the discussion. Some
imagination is required.
Why do you insist on referring to "file descriptors"? That's a specific >>> term with a specific meaning: a small integer value used in POSIX I/O
(not in standard C).
I do not insist anything. I would just like to have an opinion on the idea >> "graphics being a file descriptor".
So you insist on talking about "file descriptors".
Standard C doesn't have file descriptors. Consider discussing this in comp.unix.programmer.
On 1/2/2025 3:06 PM, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
On Wed, 2025-01-01 at 14:33 -0800, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
On Wed, 2025-01-01 at 01:29 -0800, Keith Thompson wrote:[...]
[...]A file *descriptor* is a small integer referring to some file-like >>>>>> entity, used with open/close/read/write. There's no such thing in >>>>>> standard C; it's a POSIX concept.
I would like to have opinions about the idea "graphics being a file
descriptor". The implement is irrevent for the discussion. Some
imagination is required.
Why do you insist on referring to "file descriptors"? That's a specific >>>> term with a specific meaning: a small integer value used in POSIX I/O
(not in standard C).
I do not insist anything. I would just like to have an opinion on the idea >>> "graphics being a file descriptor".
So you insist on talking about "file descriptors".
Standard C doesn't have file descriptors. Consider discussing this in
comp.unix.programmer.
It is also kinda moot...
If it were "integer handle" or even "integer value in the same numbering space as file handles", I would be like "yeah, sure, whatever".
POSIX sockets also share the same numbering space, and some of the same calls (Windows sockets do not, and many functions gain an WSA prefix and changes to capitalization and similar).
If one wants it so that read/write/lseek/etc do something useful with
them, this is a different matter.
What happens then, does one represent a window as a BMP file or
something, which one writes to to update the contents?... This is likely more overhead than is worthwhile.
Other methods, like sockets or local RPC, still likely make more sense.
POSIX sockets also share the same numbering space, and some of the same
calls (Windows sockets do not, and many functions gain an WSA prefix and changes to capitalization and similar).
What happens then, does one represent a window as a BMP file or
something, which one writes to to update the contents?...
On Thu, 02 Jan 2025 16:08:57 -0600, BGB wrote:
On 1/2/2025 3:06 PM, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
On Wed, 2025-01-01 at 14:33 -0800, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
On Wed, 2025-01-01 at 01:29 -0800, Keith Thompson wrote:[...]
[...]A file *descriptor* is a small integer referring to some file-like >>>>>>> entity, used with open/close/read/write. There's no such thing in >>>>>>> standard C; it's a POSIX concept.
I would like to have opinions about the idea "graphics being a file >>>>>> descriptor". The implement is irrevent for the discussion. Some
imagination is required.
Why do you insist on referring to "file descriptors"? That's a specific >>>>> term with a specific meaning: a small integer value used in POSIX I/O >>>>> (not in standard C).
I do not insist anything. I would just like to have an opinion on the idea >>>> "graphics being a file descriptor".
So you insist on talking about "file descriptors".
Standard C doesn't have file descriptors. Consider discussing this in
comp.unix.programmer.
It is also kinda moot...
If it were "integer handle" or even "integer value in the same numbering
space as file handles", I would be like "yeah, sure, whatever".
POSIX sockets also share the same numbering space, and some of the same
calls (Windows sockets do not, and many functions gain an WSA prefix and
changes to capitalization and similar).
If one wants it so that read/write/lseek/etc do something useful with
them, this is a different matter.
What happens then, does one represent a window as a BMP file or
something, which one writes to to update the contents?... This is likely
more overhead than is worthwhile.
I refer you to the X11 specifications and example implementation found at x.org
X is a networked protocol that performs graphics functions. The network communications used by X, on Unix and unix-like systems, accesses a socket (which others have pointed out is, on Unix a "file descriptor"-like object)
Granted, some dislike /how/ X uses network sockets for communication, and X implementations (for Unixish systems) often provide alternatives such as "unix domain sockets" and "shared memory" communications. Still, X has found it "useful" to use these "file descriptor"-like objects to implement "graphics" facilities.
[snip]
Other methods, like sockets or local RPC, still likely make more sense.
Oh, I'm glad that the techniques and technologies in use for over 30 years gain your (apparently grudging) approval.
:-)
On 1/2/2025 3:06 PM, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
On Wed, 2025-01-01 at 14:33 -0800, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
On Wed, 2025-01-01 at 01:29 -0800, Keith Thompson wrote:[...]
[...]A file *descriptor* is a small integer referring to some file-like >>>>>> entity, used with open/close/read/write. There's no such thing in >>>>>> standard C; it's a POSIX concept.
I would like to have opinions about the idea "graphics being a file
descriptor". The implement is irrevent for the discussion. Some
imagination is required.
Why do you insist on referring to "file descriptors"? That's a
specific
term with a specific meaning: a small integer value used in POSIX I/O
(not in standard C).
I do not insist anything. I would just like to have an opinion on the
idea
"graphics being a file descriptor".
So you insist on talking about "file descriptors".
Standard C doesn't have file descriptors. Consider discussing this in
comp.unix.programmer.
It is also kinda moot...
If it were "integer handle" or even "integer value in the same numbering space as file handles", I would be like "yeah, sure, whatever".
POSIX sockets also share the same numbering space, and some of the same calls (Windows sockets do not, and many functions gain an WSA prefix and changes to capitalization and similar).
If one wants it so that read/write/lseek/etc do something useful with
them, this is a different matter.
What happens then, does one represent a window as a BMP file or
something, which one writes to to update the contents?... This is likely more overhead than is worthwhile.
I guess it could have been a funky alternate reality, say:
/proc/wm/win_XXXX: Contains window and similar;
/proc/wm/winstack: Contains the current window stack order
Say, window numbers in back-to-front order.
If a window number is absent, corresponding window is minimized.
I guess, say, possible window device layout:
0000000: WINDOWHEADER (Location, Size, WM status, ...)
0000400: BITMAPINFOHEADER or similar
Space for optional/extended headers or palette.
0001000: Bitmap contents.
But, would it make sense?... Debatable.
Main probable benefit would be to make shared memory easier because
"just use mmap" becomes an option.
All this likely also assumes the existence of a mechanism for userland processes/services to map file-interfaces over to procfs or equivalent (well, or put them in "/var/wm" or similar, and assume that they are
just mmap'ed files).
Other methods, like sockets or local RPC, still likely make more sense.
...
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,007 |
Nodes: | 10 (0 / 10) |
Uptime: | 196:50:27 |
Calls: | 13,143 |
Files: | 186,574 |
D/L today: |
511 files (113M bytes) |
Messages: | 3,310,146 |