• xquit

    From Kenny McCormack@21:1/5 to All on Sat Oct 21 08:34:02 2017
    I have this program, called 'xquit', described below. This is very old
    code - it was last worked on in 1999; I had to make a few minor changes to
    both the source and the Makefile to get it to compile. It works, but there
    are two issues with it:

    1) Both the window and text text are very tiny. I would like them to be
    big and visibla. I don't see anywhere in the source code where this is
    set.

    2) In the penultimate line of the source, it originally contained the text "exit(0)". In order to get it to compile, I had to comment out "(0)".
    This changed an error into a warning, but at least it does compile and run.

    Here is the result of running the 'make':

    --- Cut Here ---
    $ make
    gcc -DNOSTDHDRS -fstrength-reduce -O -I/opt/X11/include -c xquit.c xquit.c:135:12: warning: incompatible pointer types passing 'void (int) __attribute__((noreturn))' to
    parameter of type 'XtTimerCallbackProc' (aka 'void (*)(XtPointer, XtIntervalId *)')
    [-Wincompatible-pointer-types]
    5, exit /* (0) */, NULL);
    ^~~~
    /opt/X11/include/X11/Intrinsic.h:981:35: note: passing argument to parameter here
    XtTimerCallbackProc /* proc */,
    ^
    1 warning generated.
    gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -s -o xquit xquit.o -O -lXaw -lXmu -lXt -L/opt/X11/lib -lX11
    $
    --- Cut Here ---

    Here is the Makefile:

    --- Cut Here ---
    XDIR = /opt/X11
    xquit: xquit.c
    gcc -DNOSTDHDRS -fstrength-reduce -O -I$(XDIR)/include -c xquit.c
    gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -s -o xquit xquit.o -O -lXaw -lXmu -lXt -L$(XDIR)/lib -lX11
    --- Cut Here ---

    And, finally, here is the source code:

    --- Cu
  • From Julian Bradfield@21:1/5 to Kenny McCormack on Sat Oct 21 14:27:55 2017
    On 2017-10-21, Kenny McCormack <gazelle@shell.xmission.com> wrote:
    1) Both the window and text text are very tiny. I would like them to be
    big and visibla. I don't see anywhere in the source code where this is
    set.

    See previous post.


    2) In the penultimate line of the source, it originally contained the text "exit(0)". In order to get it to compile, I had to comment out "(0)".
    This changed an error into a warning, but at least it does compile and run.

    To get a warning-free compile, modify the end of the program as
    follows:

    /* timer callback wrapper for exit */
    static void DoExit(XtPointer timeout,XtIntervalId *id /* unused */)
    {
    exit((long int)timeout);
    }

    /* Function Name: Destroyed
    * Description: This is a Destroy callback that when called sets a
    * timeout function that will exit the program in 5 seconds.
    * Arguments: widget - the widget that was just destroyed.
    * closure, callData - UNUSED.
    * Returns: none.
    */

    /* ARGSUSED */
    static void
    Destroyed(widget, closure, callData)
    Widget widget;
    XtPointer closure, callData;
    {
    XtAppAddTimeOut(XtWidgetToApplicationContext(widget),
    5, DoExit, (XtPointer) 0);
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to jcb@inf.ed.ac.uk on Sat Oct 21 15:25:47 2017
    In article <slrnoummbb.i4p.jcb@home.stevens-bradfield.com>,
    Julian Bradfield <jcb@inf.ed.ac.uk> wrote:
    On 2017-10-21, Kenny McCormack <gazelle@shell.xmission.com> wrote:
    1) Both the window and text text are very tiny. I would like them to be
    big and visibla. I don't see anywhere in the source code where this is
    set.

    See previous post.

    I don't understand. How does the discussion of xmessage (in the other
    thread) have anything to do with how to modify the C source code to produce
    a bigger window and/or bigger text?

    2) In the penultimate line of the source, it originally contained the text >> "exit(0)". In order to get it to compile, I had to comment out "(0)".
    This changed an error into a warning, but at least it does compile and run.

    To get a warning-free compile, modify the end of the program as
    follows:

    Yes; that works. Thanks.

    What's amazing is that this did work, back in 1999. How can passing
    "exit(0)" as a function parameter do anything useful?

    Maybe the original author didn't fully understand what he was doing.

    --
    Pensacola - the thinking man's drink.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Kenny McCormack on Sat Oct 21 12:03:01 2017
    Kenny McCormack wrote:

    In article <slrnoummbb.i4p.jcb@home.stevens-bradfield.com>,
    Julian Bradfield <jcb@inf.ed.ac.uk> wrote:
    On 2017-10-21, Kenny McCormack <gazelle@shell.xmission.com> wrote:
    1) Both the window and text text are very tiny. I would like them to be >>> big and visibla. I don't see anywhere in the source code where this is
    set.

    See previous post.

    I don't understand. How does the discussion of xmessage (in the other thread) have anything to do with how to modify the C source code to
    produce a bigger window and/or bigger text?

    Any X application built using the X toolkit will support the X toolkit commandline arguments, including the -fn and the -xrm arguments. Thus, your xquit program, having been built using the X toolkit, automatically has -fn, etc as commandline arguments that you can tweak as you see fit. For a list
    of X toolkit commandline options, see the "OPTIONS" section of X(7) ("man 7 X").

    2) In the penultimate line of the source, it originally contained the
    text
    "exit(0)". In order to get it to compile, I had to comment out "(0)".
    This changed an error into a warning, but at least it does compile and
    run.

    To get a warning-free compile, modify the end of the program as
    follows:

    Yes; that works. Thanks.

    What's amazing is that this did work, back in 1999. How can passing "exit(0)" as a function parameter do anything useful?

    Maybe the original author didn't fully understand what he was doing.

    Probably, the original author was taking advantage of the not-so-stringent argument type binding that K&R C offered.

    --
    Lew Pitcher
    "In Skills, We Trust"
    PGP public key available upon request

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to lew.pitcher@digitalfreehold.ca on Sat Oct 21 17:01:38 2017
    In article <osfr3m$j37$1@dont-email.me>,
    Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
    ...
    Any X application built using the X toolkit will support the X toolkit >commandline arguments, including the -fn and the -xrm arguments.
    Thus, your xquit program, having been built using the X toolkit, >automatically has -fn, etc as commandline arguments that you can tweak
    as you see fit. For a list of X toolkit commandline options, see the >"OPTIONS" section of X(7) ("man 7 X").

    Aha! I didn't quite get that - until now.

    Here's my final command line - which works well enough...

    $ ./xquit -fn '-*-*-*-*-*-*-34-*-*-*-*-*-*-*' -g 800x200 -label "Click this window to continue..."

    To get a warning-free compile, modify the end of the program as
    follows:

    Yes; that works. Thanks.

    What's amazing is that this did work, back in 1999. How can passing
    "exit(0)" as a function parameter do anything useful?

    Maybe the original author didn't fully understand what he was doing.

    Well, my point is that even if you can get it past the compiler, any
    function that gets called with "exit(0)" as a passed argument, will never
    be executed. I.e., the evaluation of the function args will cause the
    program to exit - the function itself will never be called.

    So, whatever functionality the XtAppAddTimeOut() function was supposed to
    be doing, was not happening (in the original code as written).

    Probably, the original author was taking advantage of the not-so-stringent >argument type binding that K&R C offered.

    Well, this was 1999 - not 1979.

    --
    Many North Koreans believe Kim-il-Sung is an "almighty god" who "created
    the world" in seven days as a divine spirit millions of years ago, and
    came to Earth as a human in 1912 as a messianic figure.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Kenny McCormack on Sat Oct 21 13:17:55 2017
    Kenny McCormack wrote:

    In article <osfr3m$j37$1@dont-email.me>,
    Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
    [snip]
    What's amazing is that this did work, back in 1999. How can passing
    "exit(0)" as a function parameter do anything useful?

    Maybe the original author didn't fully understand what he was doing.

    Well, my point is that even if you can get it past the compiler, any
    function that gets called with "exit(0)" as a passed argument, will never
    be executed. I.e., the evaluation of the function args will cause the program to exit - the function itself will never be called.

    So, whatever functionality the XtAppAddTimeOut() function was supposed to
    be doing, was not happening (in the original code as written).

    Probably, the original author was taking advantage of the not-so-stringent >>argument type binding that K&R C offered.

    Well, this was 1999 - not 1979.

    Maybe, but still....
    int main(argc, argv)
    int argc;
    char **argv;
    {
    it was written in K&R C
    --
    Lew Pitcher
    "In Skills, We Trust"
    PGP public key available upon request

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to Richard Tobin on Sat Oct 21 18:59:58 2017
    In article <osg4vd$2p2k$1@macpro.inf.ed.ac.uk>,
    Richard Tobin <richard@cogsci.ed.ac.uk> wrote:
    In article <osfotr$6ch$1@news.xmission.com>,
    Kenny McCormack <gazelle@shell.xmission.com> wrote:

    What's amazing is that this did work, back in 1999. How can passing >>"exit(0)" as a function parameter do anything useful?

    Perhaps it was written for a version of C with call-by-name.

    Heh heh. Good one!

    --
    The randomly chosen signature file that would have appeared here is more than 4 lines long. As such, it violates one or more Usenet RFCs. In order to remain in compliance with said RFCs, the actual sig can be found at the following URL:
    http://user.xmission.com/~gazelle/Sigs/Rorschach

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Tobin@21:1/5 to Kenny McCormack on Sat Oct 21 18:51:25 2017
    In article <osfotr$6ch$1@news.xmission.com>,
    Kenny McCormack <gazelle@shell.xmission.com> wrote:

    What's amazing is that this did work, back in 1999. How can passing >"exit(0)" as a function parameter do anything useful?

    Perhaps it was written for a version of C with call-by-name.

    -- Richard

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Noel Hunt@21:1/5 to All on Wed Oct 25 17:28:27 2017
    You merely have to cast 'exit' to the type expected by XtAppAddTimeOut for its third argument, namely 'XtTimerCallbackProc'.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)