From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Adding battery support on Cygwin Date: Sat, 13 Jan 2018 10:11:22 +0200 Message-ID: <83tvvq18lx.fsf@gnu.org> References: <302136d9-0b2e-222e-502d-2db8f7de5992@cornell.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1515831046 1964 195.159.176.226 (13 Jan 2018 08:10:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 13 Jan 2018 08:10:46 +0000 (UTC) Cc: emacs-devel@gnu.org To: Ken Brown Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 13 09:10:41 2018 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 1eaGth-0008FD-8e for ged-emacs-devel@m.gmane.org; Sat, 13 Jan 2018 09:10:37 +0100 Original-Received: from localhost ([::1]:48598 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eaGvg-00087U-VC for ged-emacs-devel@m.gmane.org; Sat, 13 Jan 2018 03:12:41 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eaGup-00085d-Ls for emacs-devel@gnu.org; Sat, 13 Jan 2018 03:11:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eaGul-0004q6-Hr for emacs-devel@gnu.org; Sat, 13 Jan 2018 03:11:46 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42414) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eaGul-0004pu-Dq; Sat, 13 Jan 2018 03:11:43 -0500 Original-Received: from [176.228.60.248] (port=4780 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eaGuj-0004NN-DN; Sat, 13 Jan 2018 03:11:42 -0500 In-reply-to: <302136d9-0b2e-222e-502d-2db8f7de5992@cornell.edu> (message from Ken Brown on Fri, 12 Jan 2018 21:33:33 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:221913 Archived-At: > From: Ken Brown > Date: Fri, 12 Jan 2018 21:33:33 -0500 > > The Cygwin-w32 currently supports battery status via the function > w32fns.c:Fw32_battery_status. The X11 and nox builds don't have this > support, and Cygwin lacks the facilities used on unix-like systems to > provide it (/proc/apm, etc.). But it turns out to be easy to compile > and use Fw32_battery_status on all Cygwin builds, simply by pulling it > out of w32fns.c into a new file. > > The attached patch does this. OK to push? Yes, but see some comments below. > If so, to which branch? Master, of course. And please add a NEWS entry. > * src/w32fns.c (Fw32_battery_status): Move to a new file, > src/w32battery.c. Let's use a better name, because this feature is not the last one to be used both in the w32 and Cygwin/X builds. How about w32common.c? Or, if this is too similar to the (unrelated) w32common.h, how about w32cygwinx.c (since cygw32.c is already taken)? > * src/w32battery.h: New file, containing prototype of > syms_of_w32battery. We don't need a new header file just to have a single prototype in it. You can put this prototype in lisp.h (we already have quite a few of syms_of_* there). > +if test "${HAVE_W32}" = "no" && test "${opsys}" = "cygwin"; then > + W32_LIBS="$W32_LIBS -lkernel32" > + W32_OBJ="$W32_OBJ w32battery.o" > +fi This looks like W32_OBJ and W32_LIBS have some values in the Cygwin non-w32 build, but AFAIU those symbols are actually empty in that case, and the above is the only place where they get any content. So I'd say just W32_OBJ="w32battery.o" etc. > -#ifdef HAVE_NTGUI > +#if defined HAVE_NTGUI > syms_of_w32term (); > syms_of_w32fns (); > syms_of_w32menu (); > syms_of_fontset (); > #endif /* HAVE_NTGUI */ Why was this change necessary? Thanks.