Re: enums for BiDi direction


Subject: Re: enums for BiDi direction
From: Jesper Skov (jskov@redhat.com)
Date: Mon Jan 01 2001 - 06:18:51 CST


>>>>> "Tomas" == Tomas Frydrych <tomas@frydrych.uklinux.net> writes:

Tomas> Dear Jesper,

Tomas> I was just wondering whether instead of using enums for the
Tomas> direction and dominant direction members and member function,
Tomas> it might not be better just to #define XAP_DIRECTION_LTR,
Tomas> etc. and use these in place of the naked numbers -1,0,1; this
Tomas> would improve the readability of the code just as much as using
Tomas> enums, and it would save casting when doing arithmetic with
Tomas> these or assigning to integers. If you do insist on the enums,
Tomas> I will do it, but would prefer not to ...

Ah, no, IMHO :) We want to use enums for type safety as much as for
self documentation. I know macros has been used in other places, but
_I_ find that to be a bad habit. Having something like:

 void foobar (..., xap_direction_t dir)

is way nicer than

 void foobar (..., int dir)

As the former limits the range of valid input from 2^32 unnamed values
to (in this case) 3 names associated with values.

But it's not something covered in the styleguide, so I can't really
force you :) I'm sure someone on the list would argue for the use of
macros.

Tomas> Also, I have tried the emacs bit you send to the list for use
Tomas> with Abi files, but you use there a function (show-paren-mode
Tomas> 1), which I gather is custom made and not included ... it does
Tomas> not work with it. Incidentaly, I was wandering whether you
Tomas> might not have some decent C++ syntax highlighting for emac,
Tomas> the one that came with my emacs is rather poor (if this is a
Tomas> sily question, then I have tried emacs for the first time
Tomas> today).

I think show-paren-mode should be part of the default emacs
distrib. You may want to add:

 (require 'paren)

In your .emacs file.

As for highlighting, I use the default rules, but have added new
coloring:

      (set-background-color "MidnightBlue")
      (set-foreground-color "Yellow")
      (set-cursor-color "GreenYellow")

And (don't know how many of them relate to C++ highlighting:

(custom-set-faces
 '(font-lock-comment-face ((((class color) (background dark)) (:foreground "white"))))
 '(font-lock-keyword-face ((((class color) (background dark)) (:foreground "Gold"))))
 '(gnus-group-news-2-face ((((class color) (background dark)) (:foreground "turquoise"))))
 '(font-lock-warning-face ((((class color) (background dark)) (:foreground "Pink"))))
 '(lightblue ((t (:foreground "white"))) t)
 '(vhdl-font-lock-data-signal-face ((((class color) (background dark)) (:foreground "lightblue"))))
 '(RoyalBlue ((t (:foreground "white"))) t)
 '(info-node ((t (:foreground "gold"))))
 '(message-header-cc-face ((((class color) (background dark)) (:foreground "green"))))
 '(italic ((t (:underline nil))))
 '(custom-variable-button-face ((t (:underline t))))
 '(widget-button-face ((t (:foreground "gold"))))
 '(message-header-newsgroups-face ((((class color) (background dark)) (:inverse-video nil :foreground "yellow"))))
 '(bold-italic ((t (:foreground "black" :background "gold"))))
 '(message-separator-face ((((class color) (background dark)) (:foreground "lightblue"))))
 '(gnus-group-news-low-face ((((class color) (background dark)) (:foreground "DarkTurquoise"))))
 '(bold ((t (:foreground "gold"))))
 '(message-header-other-face ((((class color) (background dark)) (:foreground "lightblue"))))
 '(message-cited-text-face ((((class color) (background dark)) (:foreground "gold")))

Jesper



This archive was generated by hypermail 2b25 : Mon Jan 01 2001 - 06:18:54 CST