From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.devel Subject: How to use a float value with either GLYPH_DEBUG or NSTRACE Date: Mon, 21 Aug 2017 10:07:47 -0700 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: blaine.gmane.org 1503335300 31410 195.159.176.226 (21 Aug 2017 17:08:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 21 Aug 2017 17:08:20 +0000 (UTC) To: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 21 19:08:14 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djqBQ-0007m3-6Q for ged-emacs-devel@m.gmane.org; Mon, 21 Aug 2017 19:08:12 +0200 Original-Received: from localhost ([::1]:35089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djqBW-00084z-Ry for ged-emacs-devel@m.gmane.org; Mon, 21 Aug 2017 13:08:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djqBM-000845-Aa for emacs-devel@gnu.org; Mon, 21 Aug 2017 13:08:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1djqBI-0000zA-AO for emacs-devel@gnu.org; Mon, 21 Aug 2017 13:08:08 -0400 Original-Received: from gateway30.websitewelcome.com ([192.185.192.34]:39090) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1djqBI-0000t4-0E for emacs-devel@gnu.org; Mon, 21 Aug 2017 13:08:04 -0400 Original-Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 987F91438C for ; Mon, 21 Aug 2017 12:07:48 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id jqA7dco2R7GnJjqA7dIr3A; Mon, 21 Aug 2017 12:06:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:To:From:Message-ID:Date: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=8xvh4Z/2V4lQsVA+nNS/KcVj9A8ps5lgQfKNrwCzCvE=; b=jMadmvWDLGvjzw7qx0KAcx/dMU fLPMGY7g9EukHYte84sd8UKs5Z0PBbx7t2WrXta1l0hFWNPYMj9ITMB8Sj4g+G82shoSa6pPmaCzL DLdhJ9qH1A6Xhp1nLPYLLuW3HIb33K7bTrUrn8fN0/292PiWE0qsvCTOVOJIHRUCgawaATD2Ez0P+ VzJwwzV9yR64m4TXBVsiF5Q4ykEtbcfcJCzUgt7cCzz/QA39qJ6h0qHg0lJlz+ILqx2Ff0Nc9vxfJ 0m2Wu30EcyZLnfaG5WZoY0EginIAwbt2i7g8twS5kBTDGd2ZTdID1Zj9cwxE72WoBqAs29cqYRx/u HNydiXoQ==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:51119 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.87) (envelope-from ) id 1djqB1-003dra-QV for emacs-devel@gnu.org; Mon, 21 Aug 2017 12:07:47 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Exim-ID: 1djqB1-003dra-QV X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:51119 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.185.192.34 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:217661 Archived-At: The following snippet yields the correct the result. However, I would like to see the float values for RED, BLUE, and GREEN in the terminal when running NSTRACE and/or GLYPH_DEBUG. I believe that I am limited to things that FORMAT accepts, however, I cannot figure out how to incorporate a float value in a NSTRACE or/or GLYPH_DEBUG statement. It would be greatly appreciated if someone could please give me an example of how to use a float value as an argument for either GLYPH_DEBUG or NSTRACE. BACKGROUND: I am working on my own feature requests (Emacs Bug #17684 and #22873). struct frame *f = XFRAME (WINDOW_FRAME (w)); struct face *face; /* The default face, possibly remapped. */ face = FACE_FROM_ID (f, lookup_basic_face (f, DEFAULT_FACE_ID)); NSColor *background_color = ns_lookup_indexed_color (face->background, f); Lisp_Object color_vector; EmacsCGFloat red, green, blue, alpha, gray; char buf[1024]; const char *str; if ([[background_color colorSpaceName] isEqualToString: NSNamedColorSpace]) if ((str =[[background_color colorNameComponent] UTF8String])) { color_vector = build_string ((char *)str); goto done; } [[background_color colorUsingDefaultColorSpace] getRed: &red green: &green blue: &blue alpha: &alpha]; if (red == green && red == blue) { [[background_color colorUsingColorSpaceName: NSCalibratedWhiteColorSpace] getWhite: &gray alpha: &alpha]; snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", lrint (gray * 0xff), lrint (gray * 0xff), lrint (gray * 0xff)); color_vector = build_string (buf); goto done; } snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", lrint (red*0xff), lrint (green*0xff), lrint (blue*0xff)); color_vector = build_string (buf); done: NSTRACE_MSG ("BACKGROUND COLOR: %s", buf); Thanks, Keith