Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #95582 > unrolled thread
| Started by | luser droog <luser.droog@gmail.com> |
|---|---|
| First post | 2016-11-02 06:53 -0700 |
| Last post | 2016-11-03 15:07 -0700 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.c
designing a filter interface for FILE* luser droog <luser.droog@gmail.com> - 2016-11-02 06:53 -0700
Re: designing a filter interface for FILE* Keith Thompson <kst-u@mib.org> - 2016-11-02 09:38 -0700
Re: designing a filter interface for FILE* luser droog <luser.droog@gmail.com> - 2016-11-03 15:07 -0700
| From | luser droog <luser.droog@gmail.com> |
|---|---|
| Date | 2016-11-02 06:53 -0700 |
| Subject | designing a filter interface for FILE* |
| Message-ID | <6314f428-19b2-4ac4-9a39-7e5c2c98203e@googlegroups.com> |
Two distinct feature-requests have conspired to produce
a requirement for my application (postscript interpreter
library) to support /interfaced/ FILE objects. So I'm
following my usual course: a public brainstorm.
So I need to make in internal `struct file` type with
variant subtypes, and `my_read()` and `my_write()` functions
which use `getchar()` and `putchar()` only on real FILE*
variants.
I also need a "mock file" which is backed by a counted
string. Currently, to accept a postscript program as
a `char *` argument, the library writes the string to
a temp file and then reads from the file. It does this
to avoid allocating the string contents in the PostScript
Virtual Memory, which was overburdened at the time these
decisions were made.
And suddenly, for the `eexec` operator, I need to make
a "filtered" file which performs Encryption on writes
and Decryption on reads.
BTW, check out the bizarre style of the functions from
the Adobe Type 1 Font spec:
unsigned short int r;
unsigned short int c1 = 52845;
unsigned short int c2 = 22719;
unsigned char Encrypt(plain) unsigned char plain;
{unsigned char cipher;
cipher = (plain ^ (r>>8));
r = (cipher + r) * c1 + c2;
return cipher;
}
thassright. zero indentation.
And here I fizzle out..
--
I know what to do but am afraid to do it.
[toc] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2016-11-02 09:38 -0700 |
| Message-ID | <lnshr925x8.fsf@kst-u.example.com> |
| In reply to | #95582 |
luser droog <luser.droog@gmail.com> writes:
> Two distinct feature-requests have conspired to produce
> a requirement for my application (postscript interpreter
> library) to support /interfaced/ FILE objects. So I'm
> following my usual course: a public brainstorm.
>
> So I need to make in internal `struct file` type with
> variant subtypes, and `my_read()` and `my_write()` functions
> which use `getchar()` and `putchar()` only on real FILE*
> variants.
>
> I also need a "mock file" which is backed by a counted
> string.
[snip]
If you're able to assume POSIX support, take a look at fmemopen().
If you have further questions about fmemopen(), I suggest
comp.unix.programmer.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | luser droog <luser.droog@gmail.com> |
|---|---|
| Date | 2016-11-03 15:07 -0700 |
| Message-ID | <017497d1-57db-47d5-bcb7-d3c194ae8a0f@googlegroups.com> |
| In reply to | #95599 |
On Wednesday, November 2, 2016 at 11:38:11 AM UTC-5, Keith Thompson wrote: > luser droog <luser.droog@gmail.com> writes: > > Two distinct feature-requests have conspired to produce > > a requirement for my application (postscript interpreter > > library) to support /interfaced/ FILE objects. So I'm > > following my usual course: a public brainstorm. > > > > So I need to make in internal `struct file` type with > > variant subtypes, and `my_read()` and `my_write()` functions > > which use `getchar()` and `putchar()` only on real FILE* > > variants. > > > > I also need a "mock file" which is backed by a counted > > string. > [snip] > > If you're able to assume POSIX support, take a look at fmemopen(). > If you have further questions about fmemopen(), I suggest > comp.unix.programmer. > Much obliged. My friend Vincent was able to emulate it for windows, so fmemopen presents a nice interface for this. Since you mention other groups, probably the ideal place is https://groups.google.com/forum/#!forum/xpost-discuss So, see yall there, maybe. Sorry for the noise.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c
csiph-web