Re: [9fans] Re: Building GCC



We could store the raw data in binary files and have C programs access the data with a standard interface.

/* in libc */
enum { Achar, Aimage };

typedef struct Atom {
int type;
union {
char c;
Image *i;
};
} Atom;

void amamkechar(Atom *a, char c)
{
a->type = Achar;
a->c = c;
}

void amakeimage(Atom *a, Image *i)
{
a->type = Aimage;
a->i = i;
}

/* in libdraw */
void drawatom(Image *d, Atom *a, Point loc, Image *textcolor, Point textcolorpt, char *font)
{
if (a->type == Atext) {
char c[2];

c[0] = a->c;
c[1] = '\0';
string(d, loc, textcolor, textcolorpt, font, c);
} else

}

However, this severely complicates the Unix/Plan 9 philosophy of pipes, and only allows for character-at-a-time reads. We could add an ability to read a string of characters up to EOF or an image to make it (a tiny bit) simpler.

On Jan 25, 2008, at 6:21 AM, lucio@xxxxxxxxxxxxxx wrote:

Treating image as character (with unusual width and height) means
indefinite number of potential characters and if a machine (not human)
does not able to differentiate between "text characters" and "image
characters" it renders character sets unusable.

Sure, but the idea is that the actual description of the image lies in
a different layer (no, I don't have any idea how these will be linked)
and only a descriptive placeholder will appear at the relevant
coordinates (recall that I'm advocating a two-dimensional
representation to replace the current linear simplification).

But your point is certainly relevant. And I'm only tossing ideas
around, no deep theories involved.

++L


.



Relevant Pages

  • Re: Hexadecimal values
    ... Because you're on a machine where characters are signed, ... If you wanna work with raw bit values, use unsigned char, don't ... Don't convert to and from hex when what you have is raw data. ...
    (comp.lang.c)
  • Re: heeeeeeeeeeeeeeeellllllllllllllppppppppppppppppppppp
    ... Why is using char* a bad thing and why using sprintf a bad thing to, ... can be up to MAX_PATH characters). ... LPSTR lpMsgBuf; ... MessageBox(NULL, lpMsgBuf, "GetLastError() for ...
    (microsoft.public.vc.mfc)
  • Re: heeeeeeeeeeeeeeeellllllllllllllppppppppppppppppppppp
    ... This means that if you develop the bad habit of using char * (left over ... It usually takes me five minutes to create a Unicode version of any of my apps, ... BOOL and bool are different data types. ... can be up to MAX_PATH characters). ...
    (microsoft.public.vc.mfc)
  • Re: Char and Varchar
    ... If the maximum length is short (<= 10 characters), ... maximum length, I also use CHAR. ... I use VARCHAR if long and short ...
    (microsoft.public.sqlserver.server)
  • Re: Char and Varchar
    ... If the maximum length is short (<= 10 characters), ... maximum length, I also use CHAR. ... I use VARCHAR if long and short ...
    (microsoft.public.sqlserver.programming)

Loading