Hi

On Tue, 3 Jul 2001, mulix wrote:

> On Tue, 3 Jul 2001, guy keren wrote:
> 
> i can do this easily. check out file_ops.[hc] in my r2l package.
> here's my interface, anything else we need?
> 
> /* gets one char* parameter, the name of the file to check */
> /* returns 1 if it exists, 0 if not, -1 on errors */
> int file_exists(const char* file_name);
> 
> /* return 1 if the file was deleted, -1 on errors */
> int delete_file(const char* file_name);
> 
> /* return the file descriptor ( value >= 0 ) on success and -1 on errors */
> int create_file(const char* file_name);
> 
> >>>3. modify biditext itself to contain the auto-refresh enhancements,
>  instead of keeping two seperate libraries.
> 
> emil, can we see your "top secret" code? doesnt matter if it still has
> bugs, we know bugs and bugs know us.
> 
> >>>>4. decide how the GUI should look and behave, and make it the same
>      on all desktop environments.
> 
> i'll leave this one to the gui experts... just make sure it's small,
> simple and consistent.
> 
> >>>i think the file manipulating library (or rather, biditext communications
> library, since in the future we might replace the usage of files with
> another mechanism)
> 
> this library is to be used for biditet and the various r2l apps to talk
> to each other, right? so it should support the following (minimal)
> interface:
> 
> typedef enum{
>       R2L_ENABLED,
>       R2L_DISABLED,
>       R2L_ERROR
> } R2L_STATE;

As I've said before, I believe that biditext should have a couple of more
sstates. Spesifically, the base bidi direction.

Perhaps it should be a seperate type, and not part of R2L_STATE.

Possible values:

Neutral: should be the default (I believe)
LTR: Right-to-Left (is currently the default)
RTL: Left-to-Right

Explanation: the bidi algorithm (the function that converts from logical
to visual) leavs one decision to the caller, because it depends on the
context: what is the direction of the environment in which this text
resides.

For instance, in Windows' text entry widget (and in notepad, that uses
this widget) you can choose between either LTR and RTL by pressing
Ctrl-Left_shift or Ctrl-right_shift (accordingly).

If the base direction is neutral, then the string's direction will be
determained by the first "strong-directionality" character, which is a
relatively good heuristic (but fails if a line of hebrew text happens to
begin with an english word or a number. (Nadav or anybody: would you mind
giving a clearer explanation?)

Currently biditext calls fribidi_log2vis with a base direction of LTR .
This means that if a hebrew sentence containing a latin character it will
be rendered incorrectly.

If any of you remebers/uses btkbidi: it has a neutral direction by
default, but the direction can be set by the user explicitly to RTL or
LTR.

I did a simple implementation of such a change. I didn't want to make any
other system call, so I decided that for a quick-and-dirty implementation
I better abusse the st_size field of the stat() result (Muli: to answer
your question: the code checks: if stat()!= -1).

if size is 0: direction is neutral (touch .rev, echo -n >~/.rev)
if size is otherwise even: direction is RTL (echo "a" >~/.rev)
if size is odd: direction is LTR (echo >~/.rev)

The required changes were fairly trivial. But anyway, I have put:

http://www.technion.ac.il/~tzafrir/biditext-0.9.1-size-dir.tar.gz
http://www.technion.ac.il/~tzafrir/biditext-0.9.1.tar.gz

(I also updated 0.9.1 today. It now really includes an rpm spec file, but 
it doesn't include the original r2l. No need to boter...)

I'm not sure that this feature is required, but I believe that it needs
testing. Even if it does stay, the abuse of the file size property should
go away ASAP.

-- 
Tzafrir Cohen
mailto:[EMAIL PROTECTED]
http://www.technion.ac.il/~tzafrir

Reply via email to