[Fribidi-discuss] (Justified?) compilation warning (fwd)

Behdad Esfahbod behdad at bamdad.org
Mon Sep 23 21:41:03 EST 2002


Oops, I forgot to attach the file again. Sorry.
Please have a look again.

-- 
Behdad Esfahbod		2 Mehr 1381, 2002 Sep 24 
http://behdad.org/	[Finger for Geek Code]

#define is_persian_leap(y) ((((y)-474)%2820+2820)%2820*31%128<31)

---------- Forwarded message ----------
Date: Mon, 23 Sep 2002 16:09:44 +0330 (IRT)
From: Behdad Esfahbod <behdad at bamdad.org>
To: Shachar Shemesh <fribid-discuss at sun.consumer.org.il>
Cc: FriBidi discussions <fribidi-discuss at lists.sourceforge.net>
Subject: Re: [Fribidi-discuss] (Justified?) compilation warning

On Sat, 14 Sep 2002, Shachar Shemesh wrote:

> Behdad Esfahbod wrote:
> 
> >Well, I must confess that it was a real bug report.  Thank you 
> >Shachar.
> 
> As opposed to so far, where I have just been moving my lips and no 
> useful information came out ;-)?

You should mean moving fingers ;).

>        3. Support all encoding lengths using the same code - The 
> suggestion was already made. Use a preprocessor to mark the character 
> begining and end, and have the reordering code work on a byte by byte basis.

I don't like the idea of having different binaries for different 
encodings, niether I like the idea of having FriBidiChar type of 
different sizes on unices.  So I will stick to the third 
solution, which the same code & same binary will support all 
Unicode encodings (say UTF-8, UTF-16, and UTF-32).  About the 
interface, I've found some reasonable way to implement it.  We 
will have three different versions of each function, ending with 
1, 2, and 4.  And a macro definition which *selects* which one 
to call.  I've attached an example code, but it generates 
warnings that I can't get rid of.  Any alternative solutions is 
welcome (I'm wondering if I should use 1, 2, 4, or 8, 16, 32.)

Another question is about fribidi types.  IMHO FriBidiChar should 
remain 32bits.  I don't like different size of types on different 
machines.  Another solution is to have FriBidiChar1, 
FriBidiChar2, and FriBidiChar4, and define FriBidiChar to point 
to one of them based on defined symbols, but I don't like it.

Ok, That's enough for now.  Let me know what you think.

-- 
Behdad Esfahbod		1 Mehr 1381, 2002 Sep 23 
http://behdad.org/	[Finger for Geek Code]

#define is_persian_leap(y) ((((y)-474)%2820+2820)%2820*31%128<31)




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Fribidi-discuss mailing list
Fribidi-discuss at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fribidi-discuss
-------------- next part --------------
#include <stdio.h>
#include <stdlib.h>

typedef unsigned char uint1;
typedef unsigned short uint2;
typedef unsigned int uint4;

int fribidi_log2vis1 (uint1 *str, int nextpar) { return printf ("1 %d\n", nextpar); }
int fribidi_log2vis2 (uint2 *str, int nextpar) { return printf ("2 %d\n", nextpar); }
int fribidi_log2vis4 (uint4 *str, int nextpar) { return printf ("4 %d\n", nextpar); }
  
static void (*fribidi_log2vis_dispatch[])() = {
  fribidi_log2vis1,
  fribidi_log2vis2,
  fribidi_log2vis4
};

#define fribidi_log2vis(str, nextpar) (fribidi_log2vis_dispatch[sizeof *str >> 1](str, nextpar))

int
main()
{
  char a[5];
  short b[5];
  int c[5];

  fribidi_log2vis(a, 8);
  fribidi_log2vis(b, 16);
  fribidi_log2vis(c, 32);

  return 0;
}


More information about the FriBidi mailing list