From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQpnr-0007jr-Io for qemu-devel@nongnu.org; Sun, 29 May 2011 19:53:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQpnq-000798-KL for qemu-devel@nongnu.org; Sun, 29 May 2011 19:53:51 -0400 Received: from mail-pz0-f45.google.com ([209.85.210.45]:32882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQpnq-000793-Fi for qemu-devel@nongnu.org; Sun, 29 May 2011 19:53:50 -0400 Received: by pzk30 with SMTP id 30so1511603pzk.4 for ; Sun, 29 May 2011 16:53:49 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1306699131-59195-1-git-send-email-andreas.faerber@web.de> References: <1306699131-59195-1-git-send-email-andreas.faerber@web.de> From: Alexandre Raymond Date: Sun, 29 May 2011 19:53:29 -0400 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] cocoa: Provide central qemu_main() prototype List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Andreas_F=C3=A4rber?= Cc: qemu-devel@nongnu.org Hi Andreas, Just thinking out loud here : wouldn't it make more sense to put the main() of each gui framework directly in its corresponding file and select the right one in the makefile using the configure options? so you'd have -no gui -> ui/no_gui.c:main() -> qemu_main() =3D=3D=3D compile with no_g= ui.c + vl.c -sdl -> ui/sdl.c:main() -> qemu_main() =3D=3D=3D compile with sdl.c + vl.c -cocoa -> ui/cocoa.m:main() -> qemu_main() =3D=3D=3D compile with cocoa.m += vl.c with ui/no_gui.c, ui/sdl.c and ui/cocoa.m each having their own main(): ----8<---- ... int main(...) { return qemu_main(....); } ... ----8<---- and definitively rename main() to qemu_main() in vl.c ? Alexandre On Sun, May 29, 2011 at 3:58 PM, Andreas F=C3=A4rber wrote: > This fixes a missing prototype warning in vl.c and obsoletes > the prototype in cocoa.m. Adjust callers in cocoa.m to supply > third argument, which is currently only used on Linux/ppc. > > The prototype is designed so that it could be shared with SDL > and other frontends, if desired. > > Cc: Alexandre Raymond > Signed-off-by: Andreas F=C3=A4rber > --- > =C2=A0qemu-common.h | =C2=A0 =C2=A05 +++++ > =C2=A0ui/cocoa.m =C2=A0 =C2=A0| =C2=A0 =C2=A06 +++--- > =C2=A02 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/qemu-common.h b/qemu-common.h > index b851b20..218289c 100644 > --- a/qemu-common.h > +++ b/qemu-common.h > @@ -131,6 +131,11 @@ static inline char *realpath(const char *path, char = *resolved_path) > > =C2=A0#endif /* !defined(NEED_CPU_H) */ > > +/* main function, renamed */ > +#if defined(CONFIG_COCOA) > +int qemu_main(int argc, char **argv, char **envp); > +#endif > + > =C2=A0/* bottom halves */ > =C2=A0typedef void QEMUBHFunc(void *opaque); > > diff --git a/ui/cocoa.m b/ui/cocoa.m > index 1ff1ac6..6566e46 100644 > --- a/ui/cocoa.m > +++ b/ui/cocoa.m > @@ -23,6 +23,7 @@ > =C2=A0*/ > > =C2=A0#import > +#include > > =C2=A0#include "qemu-common.h" > =C2=A0#include "console.h" > @@ -61,7 +62,6 @@ typedef struct { > =C2=A0 =C2=A0 int bitsPerPixel; > =C2=A0} QEMUScreen; > > -int qemu_main(int argc, char **argv); // main defined in qemu/vl.c > =C2=A0NSWindow *normalWindow; > =C2=A0id cocoaView; > =C2=A0static DisplayChangeListener *dcl; > @@ -794,7 +794,7 @@ static int cocoa_keycode_to_qemu(int keycode) > =C2=A0 =C2=A0 COCOA_DEBUG("QemuCocoaAppController: startEmulationWithArgc= \n"); > > =C2=A0 =C2=A0 int status; > - =C2=A0 =C2=A0status =3D qemu_main(argc, argv); > + =C2=A0 =C2=A0status =3D qemu_main(argc, argv, *_NSGetEnviron()); > =C2=A0 =C2=A0 exit(status); > =C2=A0} > > @@ -876,7 +876,7 @@ int main (int argc, const char * argv[]) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 !strcmp(opt, "-no= graphic") || > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 !strcmp(opt, "-ve= rsion") || > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 !strcmp(opt, "-cu= rses")) { > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return qemu_main= (gArgc, gArgv); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return qemu_main= (gArgc, gArgv, *_NSGetEnviron()); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > =C2=A0 =C2=A0 } > -- > 1.7.5.3 > >