From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Adrian Robert Newsgroups: gmane.emacs.devel Subject: Re: a review of the merge (Re: Emacs.app merged) Date: Mon, 28 Jul 2008 09:25:34 -0400 Message-ID: <925D787C-541B-49DC-B44C-EDA950E0F738@gmail.com> References: <1C66F1FC-BF82-4365-944D-ADCC4D1F435C@gmail.com> <200807160925.m6G9PuVj012462@sallyv1.ics.uci.edu> <200807162123.m6GLNmIw021022@sallyv1.ics.uci.edu> <200807201156.m6KBus7O008807@sallyv1.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v926) Content-Type: multipart/mixed; boundary=Apple-Mail-9-573649838 X-Trace: ger.gmane.org 1217252025 7753 80.91.229.12 (28 Jul 2008 13:33:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 28 Jul 2008 13:33:45 +0000 (UTC) Cc: Stefan Monnier , emacs- devel To: Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 28 15:34:35 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KNSrl-0003Zq-TH for ged-emacs-devel@m.gmane.org; Mon, 28 Jul 2008 15:34:34 +0200 Original-Received: from localhost ([127.0.0.1]:41089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KNSqq-0000bI-DV for ged-emacs-devel@m.gmane.org; Mon, 28 Jul 2008 09:33:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KNSjn-0007EG-EZ for emacs-devel@gnu.org; Mon, 28 Jul 2008 09:26:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KNSji-0007DM-0j for emacs-devel@gnu.org; Mon, 28 Jul 2008 09:26:06 -0400 Original-Received: from [199.232.76.173] (port=47200 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KNSjh-0007DJ-Pw for emacs-devel@gnu.org; Mon, 28 Jul 2008 09:26:01 -0400 Original-Received: from wr-out-0506.google.com ([64.233.184.239]:38826) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KNSjg-0001du-4D for emacs-devel@gnu.org; Mon, 28 Jul 2008 09:26:01 -0400 Original-Received: by wr-out-0506.google.com with SMTP id c30so4046535wra.14 for ; Mon, 28 Jul 2008 06:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to :in-reply-to:content-type:mime-version:subject:date:references :x-mailer; bh=2WADNMnFfYIK2ao3z3v5B6s3J9ccbexqZVGkmLe3QXc=; b=g8cABzZ9ySA9/fi73rUGle364BwDWUB5tkElW58znXB44FgBYT0hzW73oeW1+jCshg Vtrjn7JiflWrnRXy8L60oUnVEymkCUpFrH9gnCfJY0O/bzxzxO73KezhUtEzZ1OW/X/e KF+A9pBW7FGJX24yQTgXlBqs15CPpCMnDPWow= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type:mime-version:subject :date:references:x-mailer; b=q2V6DdH8VvQn5UgYW1Obf9twz4v9eyoZ6Vg2APOICAEy8nXj6JPGDuQgBU0pd6JkVq FmbfYkRXFMk1p9iMEzWy1qBcgjrOer1FTS+zgT/MGTnjGnbEiZYFdOmaOMszxazIkZqg PsSXyjomKi6UWfhrNYILIFq7G0O0jVHymkUOw= Original-Received: by 10.90.114.19 with SMTP id m19mr7583729agc.71.1217251556103; Mon, 28 Jul 2008 06:25:56 -0700 (PDT) Original-Received: from ?10.0.1.200? ( [97.73.30.9]) by mx.google.com with ESMTPS id 36sm15456169agc.9.2008.07.28.06.25.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 28 Jul 2008 06:25:54 -0700 (PDT) In-Reply-To: <200807201156.m6KBus7O008807@sallyv1.ics.uci.edu> X-Mailer: Apple Mail (2.926) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:101632 Archived-At: --Apple-Mail-9-573649838 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Jul 20, 2008, at 7:56 AM, Dan Nicolaescu wrote: > Adrian Robert writes: > >> On Jul 16, 2008, at 5:23 PM, Dan Nicolaescu wrote: >> >>> Stefan Monnier writes: >>> >>> We probably need some common file for these functions (and the >>> humongous >>> x-colors list) to avoid all the duplication that is happening now. >> >> If the x-colors list were put in a common file, with RGB specs, then >> each non-X GUI could share it at the cost of a few lines to iterate >> through the list --e.g.: >> >> lisp var has a list of char *name, unsigned char r,g,b >> >> macfns.c: >> colormap_t *mac_color_map = malloc(length-of-list); >> foreach-list-element mac_color_map[i] = { RGB_TO_ULONG(r,g,b), name >> }; >> >> w32fns.c: >> colormap_t *w32_color_map = malloc(length-of-list); >> foreach-list-element w32_color_map[i] = { name, PALETTERGB(r,g,b) }; >> >> nsterm.m: >> NSColorList *cl = [[NSColorList alloc] init]; >> foreach-list-element [cl setColor: >> [NSColor colorWithCalibratedRed:r green: g blue:b alpha: 1.0] >> forKey: [NSString stringWithUTF8String: name]]; > > Let's go one step at a time: please make the nsterm.m code use > something > like this. After having some working code it would be easy to move > the > big color array definition into some sort of a common file. OK. Here is a patch that moves w32_load_color_file from w32fns.c to x_load_color_file in xfaces.c, and uses it in nsterm.m. xfaces made the most sense because there are already cross-platform color handling functions in there. --Apple-Mail-9-573649838 Content-Disposition: attachment; filename=rgbTxt.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="rgbTxt.patch" Content-Transfer-Encoding: quoted-printable Index:=20w32fns.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/src/w32fns.c,v=0Aretrieving=20revision=201.343=0A= diff=20-u=20-r1.343=20w32fns.c=0A---=20w32fns.c=0915=20Jul=202008=20= 15:45:05=20-0000=091.343=0A+++=20w32fns.c=0928=20Jul=202008=2013:20:30=20= -0000=0A@@=20-502,53=20+502,6=20@@=0A=20=20=20return=20(oldrgb);=0A=20}=0A= =20=0A-DEFUN=20("w32-load-color-file",=20Fw32_load_color_file,=0A-=20=20=20= =20=20=20=20Sw32_load_color_file,=201,=201,=200,=0A-=20=20=20=20=20=20=20= doc:=20/*=20Create=20an=20alist=20of=20color=20entries=20from=20an=20= external=20file.=0A-Assign=20this=20value=20to=20`w32-color-map'=20to=20= replace=20the=20existing=20color=20map.=0A-=0A-The=20file=20should=20= define=20one=20named=20RGB=20color=20per=20line=20like=20so:=0A-=20=20R=20= G=20B=20=20=20name=0A-where=20R,G,B=20are=20numbers=20between=200=20and=20= 255=20and=20name=20is=20an=20arbitrary=20string.=20=20*/)=0A-=20=20=20=20= (filename)=0A-=20=20=20=20Lisp_Object=20filename;=0A-{=0A-=20=20FILE=20= *fp;=0A-=20=20Lisp_Object=20cmap=20=3D=20Qnil;=0A-=20=20Lisp_Object=20= abspath;=0A-=0A-=20=20CHECK_STRING=20(filename);=0A-=20=20abspath=20=3D=20= Fexpand_file_name=20(filename,=20Qnil);=0A-=0A-=20=20fp=20=3D=20fopen=20= (SDATA=20(filename),=20"rt");=0A-=20=20if=20(fp)=0A-=20=20=20=20{=0A-=20=20= =20=20=20=20char=20buf[512];=0A-=20=20=20=20=20=20int=20red,=20green,=20= blue;=0A-=20=20=20=20=20=20int=20num;=0A-=0A-=20=20=20=20=20=20= BLOCK_INPUT;=0A-=0A-=20=20=20=20=20=20while=20(fgets=20(buf,=20sizeof=20= (buf),=20fp)=20!=3D=20NULL)=20{=0A-=09if=20(sscanf=20(buf,=20"%u=20%u=20= %u=20%n",=20&red,=20&green,=20&blue,=20&num)=20=3D=3D=203)=0A-=09=20=20{=0A= -=09=20=20=20=20char=20*name=20=3D=20buf=20+=20num;=0A-=09=20=20=20=20= num=20=3D=20strlen=20(name)=20-=201;=0A-=09=20=20=20=20if=20(name[num]=20= =3D=3D=20'\n')=0A-=09=20=20=20=20=20=20name[num]=20=3D=200;=0A-=09=20=20=20= =20cmap=20=3D=20Fcons=20(Fcons=20(build_string=20(name),=0A-=09=09=09=09=20= make_number=20(RGB=20(red,=20green,=20blue))),=0A-=09=09=09=20=20cmap);=0A= -=09=20=20}=0A-=20=20=20=20=20=20}=0A-=20=20=20=20=20=20fclose=20(fp);=0A= -=0A-=20=20=20=20=20=20UNBLOCK_INPUT;=0A-=20=20=20=20}=0A-=0A-=20=20= return=20cmap;=0A-}=0A-=0A=20/*=20The=20default=20colors=20for=20the=20= w32=20color=20map=20*/=0A=20typedef=20struct=20colormap_t=0A=20{=0A@@=20= -7236,7=20+7189,6=20@@=0A=20=0A=20=20=20defsubr=20= (&Sw32_define_rgb_color);=0A=20=20=20defsubr=20= (&Sw32_default_color_map);=0A-=20=20defsubr=20(&Sw32_load_color_file);=0A= =20=20=20defsubr=20(&Sw32_send_sys_command);=0A=20=20=20defsubr=20= (&Sw32_shell_execute);=0A=20=20=20defsubr=20(&Sw32_register_hot_key);=0A= Index:=20xfaces.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/src/xfaces.c,v=0Aretrieving=20revision=201.407=0A= diff=20-u=20-r1.407=20xfaces.c=0A---=20xfaces.c=0927=20Jul=202008=20= 18:24:48=20-0000=091.407=0A+++=20xfaces.c=0928=20Jul=202008=2013:20:42=20= -0000=0A@@=20-6574,6=20+6574,54=20@@=0A=20}=0A=20=0A=20=0C=0A+=0A+DEFUN=20= ("x-load-color-file",=20Fx_load_color_file,=0A+=20=20=20=20=20=20=20= Sx_load_color_file,=201,=201,=200,=0A+=20=20=20=20=20=20=20doc:=20/*=20= Create=20an=20alist=20of=20color=20entries=20from=20an=20external=20= file.=0A+=0A+The=20file=20should=20define=20one=20named=20RGB=20color=20= per=20line=20like=20so:=0A+=20=20R=20G=20B=20=20=20name=0A+where=20R,G,B=20= are=20numbers=20between=200=20and=20255=20and=20name=20is=20an=20= arbitrary=20string.=20=20*/)=0A+=20=20=20=20(filename)=0A+=20=20=20=20= Lisp_Object=20filename;=0A+{=0A+=20=20FILE=20*fp;=0A+=20=20Lisp_Object=20= cmap=20=3D=20Qnil;=0A+=20=20Lisp_Object=20abspath;=0A+=0A+=20=20= CHECK_STRING=20(filename);=0A+=20=20abspath=20=3D=20Fexpand_file_name=20= (filename,=20Qnil);=0A+=0A+=20=20fp=20=3D=20fopen=20(SDATA=20(filename),=20= "rt");=0A+=20=20if=20(fp)=0A+=20=20=20=20{=0A+=20=20=20=20=20=20char=20= buf[512];=0A+=20=20=20=20=20=20int=20red,=20green,=20blue;=0A+=20=20=20=20= =20=20int=20num;=0A+=0A+=20=20=20=20=20=20BLOCK_INPUT;=0A+=0A+=20=20=20=20= =20=20while=20(fgets=20(buf,=20sizeof=20(buf),=20fp)=20!=3D=20NULL)=20{=0A= +=09if=20(sscanf=20(buf,=20"%u=20%u=20%u=20%n",=20&red,=20&green,=20= &blue,=20&num)=20=3D=3D=203)=0A+=09=20=20{=0A+=09=20=20=20=20char=20= *name=20=3D=20buf=20+=20num;=0A+=09=20=20=20=20num=20=3D=20strlen=20= (name)=20-=201;=0A+=09=20=20=20=20if=20(name[num]=20=3D=3D=20'\n')=0A+=09= =20=20=20=20=20=20name[num]=20=3D=200;=0A+=09=20=20=20=20cmap=20=3D=20= Fcons=20(Fcons=20(build_string=20(name),=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= make_number=20((red=20<<=2016)=20|=20(green=20<<=208)=20|=20blue)),=0A+=09= =09=09=20=20cmap);=0A+=09=20=20}=0A+=20=20=20=20=20=20}=0A+=20=20=20=20=20= =20fclose=20(fp);=0A+=0A+=20=20=20=20=20=20UNBLOCK_INPUT;=0A+=20=20=20=20= }=0A+=0A+=20=20return=20cmap;=0A+}=0A+=0A+=0C=0A=20= /***********************************************************************=0A= =20=09=09=09=09Tests=0A=20=20= ***********************************************************************/=0A= @@=20-6829,6=20+6877,7=20@@=0A=20#endif=0A=20=20=20defsubr=20= (&Scolor_gray_p);=0A=20=20=20defsubr=20(&Scolor_supported_p);=0A+=20=20= defsubr=20(&Sx_load_color_file);=0A=20=20=20defsubr=20= (&Sface_attribute_relative_p);=0A=20=20=20defsubr=20= (&Smerge_face_attribute);=0A=20=20=20defsubr=20= (&Sinternal_get_lisp_face_attribute);=0AIndex:=20nsterm.m=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/src/nsterm.m,v=0Aretrieving=20revision=201.17=0A= diff=20-u=20-r1.17=20nsterm.m=0A@@=20-3822,37=20+3822,37=20@@=0A=20=20=20= =20=20ns_selection_color=20=3D=20NS_SELECTION_COLOR_DEFAULT;=0A=20=0A=20=20= =20{=0A-=20=20=20=20id=20cl;=0A-=20=20=20=20Lisp_Object=20tem,=20tem1;=0A= -=20=20=20=20extern=20Lisp_Object=20Vsource_directory;=0A-=0A-=20=20=20=20= cl=20=3D=20[NSColorList=20colorListNamed:=20@"Emacs"];=0A+=20=20=20=20= NSColorList=20*cl=20=3D=20[NSColorList=20colorListNamed:=20@"Emacs"];=0A=20= =0A=20=20=20=20=20if=20(=20cl=20=3D=3D=20nil=20)=0A=20=20=20=20=20=20=20= {=0A-=20=20=20=20=20=20=20=20/*=20first=20try=20data_dir,=20then=20= invocation-dir=0A-=20=20=20=20=20=20=20=20=20=20=20and=20finally=20= source-directory/etc=20*/=0A-=20=20=20=20=20=20=20=20tem1=20=3D=20tem=0A= -=09=20=20=3D=20Fexpand_file_name=20(build_string=20("Emacs.clr"),=20= Vdata_directory);=0A-=20=20=20=20=20=20=20=20if=20(NILP=20= (Ffile_exists_p=20(tem)))=0A+=20=20=20=20=20=20=20=20Lisp_Object=20= color_file,=20color_map,=20color;=0A+=20=20=20=20=20=20=20=20int=20= r,g,b;=0A+=20=20=20=20=20=20=20=20unsigned=20long=20c;=0A+=20=20=20=20=20= =20=20=20char=20*name;=0A+=0A+=20=20=20=20=20=20=20=20color_file=20=3D=20= Fexpand_file_name=20(build_string=20("rgb.txt"),=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20Fsymbol_value=20= (intern=20("data-directory")));=0A+=20=20=20=20=20=20=20=20if=20(NILP=20= (Ffile_readable_p=20(color_file)))=0A+=20=20=20=20=20=20=20=20=20=20= fatal=20("Could=20not=20find=20%s.\n",=20SDATA=20(color_file));=0A+=0A+=20= =20=20=20=20=20=20=20color_map=20=3D=20Fx_load_color_file=20= (color_file);=0A+=20=20=20=20=20=20=20=20if=20(NILP=20(color_map))=0A+=20= =20=20=20=20=20=20=20=20=20fatal=20("Could=20not=20read=20%s.\n",=20= SDATA=20(color_file));=0A+=0A+=20=20=20=20=20=20=20=20cl=20=3D=20= [[NSColorList=20alloc]=20initWithName:=20@"Emacs"];=0A+=20=20=20=20=20=20= =20=20for=20(=20;=20CONSP=20(color_map);=20color_map=20=3D=20XCDR=20= (color_map))=0A=20=20=20=20=20=20=20=20=20=20=20{=0A-=20=20=20=20=20=20=20= =20=20=20=20=20tem=20=3D=20Fexpand_file_name=20(build_string=20= ("Emacs.clr"),=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= Vinvocation_directory);=0A-=20=20=20=20=20=20=20=20=20=20=20=20if=20= (NILP=20(Ffile_exists_p=20(tem)))=0A-=20=20=20=20=20=20=20=20=20=20=20=20= =20=20{=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20Lisp_Object=20= newdir=0A-=09=09=20=20=3D=20Fexpand_file_name=20(build_string=20= ("etc/"),=0A-=09=09=09=09=20=20=20=20=20=20=20Vsource_directory);=0A-=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20tem=20=3D=20Fexpand_file_name=20= (build_string=20("Emacs.clr"),=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20newdir);=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20}=0A+=20=20= =20=20=20=20=20=20=20=20=20=20color=20=3D=20XCAR=20(color_map);=0A+=20=20= =20=20=20=20=20=20=20=20=20=20name=20=3D=20SDATA=20(XCAR=20(color));=0A+=20= =20=20=20=20=20=20=20=20=20=20=20c=20=3D=20XINT=20(XCDR=20(color));=0A+=20= =20=20=20=20=20=20=20=20=20=20=20[cl=20setColor:=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20[NSColor=20colorWithCalibratedRed:=20= RED_FROM_ULONG=20(c)=20/=20255.0=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20green:=20GREEN_FROM_ULONG=20(c)=20/=20255.0=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20blue:=20= BLUE_FROM_ULONG=20(c)=20/=20255.0=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20alpha:=201.0]=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20forKey:=20[NSString=20stringWithUTF8String:=20name]];=0A= =20=20=20=20=20=20=20=20=20=20=20}=0A-=0A-=20=20=20=20=20=20=20=20cl=20=3D= =20[[NSColorList=20alloc]=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= initWithName:=20@"Emacs"=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20fromFile:=20[NSString=20stringWithCString:=20SDATA=20= (tem)]];=0A-=20=20=20=20=20=20=20=20if=20(cl=20=3D=3Dnil)=0A-=20=20=20=20= =20=20=20=20=20=20fatal=20("Could=20not=20find=20%s.\n",=20SDATA=20= (tem1));=0A=20=20=20=20=20=20=20=20=20[cl=20writeToFile:=20nil];=0A=20=20= =20=20=20=20=20}=0A=20=20=20}=0A= --Apple-Mail-9-573649838 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-9-573649838--