Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #156943 > unrolled thread

Programming exercise/challenge

Started byTim Rentsch <tr.17687@z991.linuxsc.com>
First post2020-12-05 08:25 -0800
Last post2021-01-06 23:07 -0800
Articles 20 on this page of 399 — 24 participants

Back to article view | Back to comp.lang.c


Contents

  Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-05 08:25 -0800
    Re: Programming exercise/challenge Sjouke Burry <burrynulnulfour@ppllaanneett.nnll> - 2020-12-05 17:33 +0100
      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-06 11:58 -0800
      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-30 09:40 -0800
        Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-30 18:20 +0000
          Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-31 01:04 -0800
          Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2021-01-02 22:05 +0300
            Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2021-01-02 14:48 -0500
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-02 19:17 -0800
            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-02 19:04 -0800
        Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-30 21:44 +0000
          Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-31 02:54 +0000
          Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-03 09:49 -0800
            Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2021-01-04 00:15 +0300
              Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-03 21:57 +0000
                Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-03 23:00 +0000
                  Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-04 00:00 +0000
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-04 20:04 -0800
                Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-05 07:15 +0000
                  Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-07 22:30 -0800
            Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-04 18:42 +0000
              Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-04 21:23 +0000
                Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-04 23:41 +0000
    Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-05 16:39 +0000
      Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-05 16:58 +0000
        Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-05 17:08 +0000
        Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-05 17:11 +0000
          Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-05 17:24 +0000
            Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-05 17:52 +0000
              Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-05 18:30 +0000
              Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-05 19:56 +0000
                Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-06 14:51 +0000
        Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-05 17:49 +0000
          Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-05 18:34 +0000
        Re: Programming exercise/challenge Bonita Montero <Bonita.Montero@gmail.com> - 2020-12-05 19:40 +0100
          Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-05 18:47 +0000
            Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-05 23:19 +0000
              Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-05 23:56 +0000
              Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-08 02:26 +0000
                Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-08 16:04 +0300
                  Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-08 23:39 -0800
                    Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-12 23:34 +0300
                      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-12 19:28 -0800
                      Re: Programming exercise/challenge kegs@provalid.com (Kent Dickey) - 2020-12-29 10:34 -0600
                        Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-29 20:05 -0800
      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-06 06:03 -0800
    Re: Programming exercise/challenge dfs <nospam@dfs.com> - 2020-12-05 13:58 -0500
      Re: Programming exercise/challenge Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-12-05 21:37 +0000
        Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-06 06:13 -0800
          Re: Programming exercise/challenge jacobnavia <jacob@jacob.remcomp.fr> - 2020-12-06 18:00 +0100
            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-06 12:31 -0800
      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-06 06:26 -0800
    Re: Programming exercise/challenge jacobnavia <jacob@jacob.remcomp.fr> - 2020-12-05 23:32 +0100
      Re: Programming exercise/challenge jacobnavia <jacob@jacob.remcomp.fr> - 2020-12-06 17:18 +0100
        Re: Programming exercise/challenge jacobnavia <jacob@jacob.remcomp.fr> - 2020-12-06 17:51 +0100
        Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-06 22:27 +0000
          Re: Programming exercise/challenge jacobnavia <jacob@jacob.remcomp.fr> - 2020-12-07 09:37 +0100
            Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-07 07:36 -0500
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-08 22:49 -0800
    Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-06 17:51 +0000
      Re: Programming exercise/challenge dfs <nospam@dfs.com> - 2020-12-06 13:03 -0500
        Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-06 23:53 +0000
      Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-06 19:53 +0000
        Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-06 23:38 +0000
          Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-07 00:17 +0000
            Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-07 02:09 +0000
      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-07 01:03 -0800
        Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-07 12:05 +0000
          Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-07 12:25 +0000
            Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-07 13:33 +0000
              Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-07 14:18 +0000
                Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-07 14:31 +0000
                  Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-07 12:58 -0500
                    Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-08 23:03 -0800
                Re: Programming exercise/challenge Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-12-07 07:12 -0800
                Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-07 21:55 +0000
                Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-08 22:59 -0800
            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-08 22:55 -0800
              Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-09 07:45 -0500
                Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-24 11:26 -0800
                  Re: Programming exercise/challenge Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-24 12:24 -0800
                    Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-24 17:19 -0500
                      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-27 05:16 -0800
                    Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-27 04:17 -0800
                      Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-27 08:27 -0500
                        Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-29 19:18 -0800
          Re: Programming exercise/challenge Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-12-07 05:15 -0800
            Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-07 13:42 +0000
          Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-08 22:53 -0800
          Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-10 01:49 -0800
            Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-10 22:35 +0000
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-10 21:17 -0800
                Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-12 21:44 +0000
                  Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-12 19:46 -0800
                    Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-13 12:21 +0000
                      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-24 11:35 -0800
                        Re: Programming exercise/challenge Rosario19 <Ros@invalid.invalid> - 2020-12-31 00:46 +0100
                          Re: Programming exercise/challenge Rosario19 <Ros@invalid.invalid> - 2020-12-31 00:52 +0100
                            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-31 00:34 -0800
                              Re: Programming exercise/challenge Rosario19 <Ros@invalid.invalid> - 2021-01-01 08:23 +0100
                                Re: Programming exercise/challenge Rosario19 <Ros@invalid.invalid> - 2021-01-01 10:09 +0100
                                  Re: Programming exercise/challenge Rosario19 <Ros@invalid.invalid> - 2021-01-01 11:38 +0100
                                    Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-01 08:24 -0800
        Re: Programming exercise/challenge "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2020-12-07 07:03 -0800
          Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-08 02:16 +0300
            Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-09 02:39 +0300
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-08 23:18 -0800
            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-08 23:17 -0800
    Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-08 00:27 +0300
      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-08 23:20 -0800
    Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-07 13:44 -0800
      Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-07 14:01 -0800
      Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-07 22:16 +0000
        Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-07 15:10 -0800
          Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-08 01:07 +0000
        Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-08 00:34 +0000
      Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-08 18:17 -0800
        Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-09 00:56 -0800
          Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-09 02:30 -0800
            Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-09 15:14 -0800
              Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-09 15:44 -0800
              Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-12 23:56 +0300
                Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-12 13:29 -0800
                  Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-13 00:46 +0300
                    Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-12 13:59 -0800
                  Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-13 14:17 +0300
                    Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-13 12:58 -0800
                      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-13 20:57 -0800
                        Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-14 20:44 -0800
                          Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-23 11:15 -0800
                            Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-23 23:45 +0300
                              Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-23 21:36 -0800
                                Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-24 09:11 -0800
                                  Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-24 15:30 -0800
                                    Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-24 23:18 -0800
                                      Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-24 23:56 -0800
                                        Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2020-12-28 12:01 -0800
                                          Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-29 19:31 -0800
                              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-24 14:47 -0800
    Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-08 01:59 +0300
      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-08 23:26 -0800
    Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-07 19:02 -0500
      Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-08 01:15 +0000
        Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-07 20:38 -0500
          Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-08 02:19 +0000
      Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-08 11:44 +0000
        Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-08 07:32 -0500
          Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-08 14:40 +0000
            Re: Programming exercise/challenge "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2020-12-08 06:52 -0800
              Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-08 17:31 +0000
                Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-08 20:16 +0000
                  Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-08 20:48 +0000
                    Re: Programming exercise/challenge Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-12-08 15:34 -0800
                      Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-09 02:54 +0300
                        Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-09 12:33 +0300
                          Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-09 12:43 +0300
                            Re: Programming exercise/challenge Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-12-09 01:52 -0800
                              Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-13 00:28 +0300
                                Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-12 21:40 +0000
                                  Re: Programming exercise/challenge Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-12-12 13:48 -0800
                          Re: Programming exercise/challenge Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-12-09 01:46 -0800
                      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-08 23:29 -0800
            Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-08 10:45 -0500
            Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-08 17:16 +0000
        Re: Programming exercise/challenge "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2020-12-08 06:39 -0800
    Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-07 17:48 -0800
      Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-07 21:03 -0500
        Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-09 03:02 -0800
          Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-09 08:02 -0500
            Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-09 16:49 +0000
              Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-09 13:33 -0500
                Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-09 19:57 +0000
                Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-10 01:45 +0000
                  Re: Programming exercise/challenge Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2020-12-10 02:15 +0000
                    Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-24 11:24 -0800
                  Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-09 21:57 -0500
                    Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-10 03:32 +0000
                      Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-10 08:19 -0500
            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-24 11:04 -0800
              Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-24 19:34 +0000
      Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-08 02:22 +0000
        Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-09 03:04 -0800
          Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-09 11:59 +0000
            Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-09 08:11 -0500
            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-10 00:02 -0800
              Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-10 15:12 +0000
                Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-10 10:36 -0800
                  Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-10 22:11 +0000
                    Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-10 23:34 +0000
                    Re: Programming exercise/challenge "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2020-12-10 20:11 -0800
                    Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-10 21:06 -0800
      Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-09 03:03 +0300
        Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-08 21:21 -0500
          Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-09 12:50 +0300
            Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2020-12-09 08:16 -0500
        Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-08 23:32 -0800
        Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-09 12:21 +0000
          Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-02 19:15 +0000
            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-07 01:54 -0800
              Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-22 22:36 +0000
                Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-22 23:07 +0000
                  Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-22 20:27 -0800
                    Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-23 13:05 +0000
                      Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-23 07:45 -0800
                        Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-23 16:49 +0000
                      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-23 11:22 -0800
                    Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-23 16:53 +0000
                      Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-23 09:55 -0800
                  Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-23 21:35 -0800
                    Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-24 18:17 +0000
                      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-27 07:57 -0800
                Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-23 11:28 -0800
    Re: Programming exercise/challenge "jfbod...@gmail.com" <jfbode1029@gmail.com> - 2020-12-08 11:30 -0800
      Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-08 20:31 +0000
        Re: Programming exercise/challenge jacobnavia <jacob@jacob.remcomp.fr> - 2020-12-08 22:17 +0100
      Re: Programming exercise/challenge jacobnavia <jacob@jacob.remcomp.fr> - 2020-12-08 22:15 +0100
        Re: Programming exercise/challenge "jfbod...@gmail.com" <jfbode1029@gmail.com> - 2020-12-08 13:28 -0800
          Re: Programming exercise/challenge "jfbod...@gmail.com" <jfbode1029@gmail.com> - 2020-12-09 12:05 -0800
            Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-13 00:04 +0300
        Re: Programming exercise/challenge Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2020-12-08 21:38 +0000
      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-09 03:25 -0800
    Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-09 01:00 +0000
      Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-09 03:09 +0000
        Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-13 00:35 +0300
          Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-12 22:57 +0000
            Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-12 23:43 +0000
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-12 19:47 -0800
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-12 23:27 -0800
                Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-13 14:44 +0000
                  Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-24 11:47 -0800
    Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-09 03:36 -0800
      Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-09 14:51 +0300
        Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-09 11:35 -0800
          Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-10 02:33 +0300
            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-10 00:05 -0800
              Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-10 14:59 +0300
                Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-10 20:32 -0800
            Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-12 23:45 +0300
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-12 19:24 -0800
          Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-13 00:17 +0300
            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-12 19:23 -0800
      Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2020-12-09 19:31 +0000
      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-09 12:01 -0800
        Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-09 12:25 -0800
    Re: Programming exercise/challenge kegs@provalid.com (Kent Dickey) - 2020-12-23 01:00 -0600
      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-24 14:34 -0800
        Re: Programming exercise/challenge kegs@provalid.com (Kent Dickey) - 2020-12-26 23:03 -0600
          Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-27 06:29 -0800
            Re: Programming exercise/challenge kegs@provalid.com (Kent Dickey) - 2020-12-28 11:52 -0600
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-29 00:38 -0800
          Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-28 15:29 +0300
            Re: Programming exercise/challenge kegs@provalid.com (Kent Dickey) - 2020-12-28 17:12 -0600
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-28 23:54 -0800
          Re: Programming exercise/challenge kegs@provalid.com (Kent Dickey) - 2020-12-29 10:26 -0600
            Re: Programming exercise/challenge kegs@provalid.com (Kent Dickey) - 2020-12-29 10:37 -0600
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-29 19:59 -0800
    Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-12-30 09:17 -0800
      Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2020-12-31 16:54 +0300
        Re: Programming exercise/challenge kegs@provalid.com (Kent Dickey) - 2020-12-31 09:16 -0600
          Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2020-12-31 15:56 +0000
            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-07 02:41 -0800
          Re: Programming exercise/challenge Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-12-31 13:01 -0800
          Re: Programming exercise/challenge Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-31 14:15 -0800
          Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-01 08:03 -0800
        Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-01 07:42 -0800
          Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2021-01-02 21:59 +0300
            Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2021-01-02 14:52 -0500
              Re: Programming exercise/challenge Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2021-01-02 12:30 -0800
              Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-02 18:17 -0500
                Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2021-01-02 19:22 -0500
                Re: Programming exercise/challenge Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-01-02 17:48 -0800
                  Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-02 22:35 -0500
            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-02 18:02 -0800
              Re: Programming exercise/challenge Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-01-03 00:42 -0800
                Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-04 20:12 -0800
    Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-04 07:04 -0800
      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-04 20:22 -0800
        Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-05 04:24 -0800
          Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-05 06:22 -0800
            Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-05 08:55 -0800
              Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2021-01-05 20:22 +0300
                Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2021-01-05 20:27 +0300
                Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-05 14:20 -0800
              Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-05 17:23 +0000
                Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-05 10:18 -0800
                  Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-05 18:57 +0000
                Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-05 12:58 -0800
                  Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2021-01-05 17:31 -0500
                  Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-05 17:50 -0500
                    Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-05 19:33 -0800
                      Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2021-01-05 23:02 -0500
                        Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-05 21:00 -0800
                          Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2021-01-06 07:42 -0500
                            Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-06 08:55 -0800
                              Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2021-01-06 13:29 -0500
                                Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-06 14:09 -0800
                                  Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-06 22:11 -0500
                                  Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-07 03:10 -0800
                                    Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2021-01-07 06:40 -0500
                                    Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-09 06:27 -0800
                                      Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-10 04:32 -0800
                                        Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-11 06:58 -0800
                                          Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-11 14:40 -0800
                                            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-15 09:46 -0800
                                              Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-17 04:13 -0800
                                                Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-17 14:18 +0000
                                                  Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-17 18:02 +0000
                                                    Re: Programming exercise/challenge Richard Damon <Richard@Damon-Family.org> - 2021-01-17 15:12 -0500
                                                    Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-17 21:39 +0000
                                                Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-20 10:57 -0800
                                                  Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-21 11:37 -0800
                                                    Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-22 00:30 -0500
                                                      Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-22 09:09 -0800
                                                        Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-22 13:47 -0500
                                                        Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-22 19:00 +0000
                                                          Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-22 19:42 +0000
                                                            Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-22 21:16 +0000
                                                              Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-22 16:41 -0500
                                                                Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-23 17:46 -0800
                                                              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-23 09:51 -0800
                                                                Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-23 18:38 +0000
                                                          Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-23 04:52 -0800
                                                            Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-01-23 15:45 +0000
                                                              Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-23 09:04 -0800
                                                                Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-01-23 23:10 +0000
                                                                  Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-23 15:39 -0800
                                                            Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-23 15:59 +0000
                                                            Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-25 11:40 -0500
                                                      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-23 09:47 -0800
                                                        Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-23 18:32 +0000
                                                    Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-23 17:26 -0800
                                                      Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-24 01:55 +0000
                                                        Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-27 08:40 -0800
                                                      Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-23 20:51 -0800
                                                        Re: Programming exercise/challenge Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-01-24 02:28 -0800
                                                          Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-24 03:49 -0800
                                                            Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2021-01-24 15:38 +0300
                                                            Re: Programming exercise/challenge Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-01-24 14:04 -0800
                                                              Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-25 07:26 -0800
                                                                Re: Programming exercise/challenge David Brown <david.brown@hesbynett.no> - 2021-01-25 16:58 +0100
                                                                Re: Programming exercise/challenge luser droog <luser.droog@gmail.com> - 2021-01-25 09:14 -0800
                                                                  Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-27 07:32 -0800
                                                                    Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-01-27 16:24 +0000
                                                                      Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-28 00:11 -0800
                                                                      Re: Programming exercise/challenge Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-01-28 12:25 +0300
                                                                        Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-28 06:18 -0500
                                                                          Re: Programming exercise/challenge Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-01-28 16:54 +0300
                                                                            Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-28 09:15 -0500
                                                                              Re: Programming exercise/challenge Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-01-28 20:07 +0300
                                                                                Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-28 15:58 -0500
                                                                                  Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2021-01-29 00:07 +0300
                                                                                    Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-28 16:17 -0500
                                                                          Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2021-01-29 00:03 +0300
                                                                        Re: Programming exercise/challenge Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2021-01-28 03:37 -0800
                                                                        Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-01-28 22:50 +0000
                                                                          Re: Programming exercise/challenge Anton Shepelev <anton.txt@gmail.com> - 2021-01-30 23:14 +0300
                                                                            Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-01-30 20:49 +0000
                                                                    Re: Programming exercise/challenge M Joshua Ryan <luser.droog@gmail.com> - 2021-01-28 00:05 -0600
                                                                  Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-27 11:51 -0800
                                                                Re: Programming exercise/challenge Bart <bc@freeuk.com> - 2021-01-25 17:22 +0000
                                                                Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-25 12:21 -0800
                                                                  Re: Programming exercise/challenge Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-01-25 14:27 -0800
                                                                    Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-25 19:41 -0800
                                                                      Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-26 04:46 +0000
                                                                        Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-26 06:30 -0800
                                                                      Re: Programming exercise/challenge David Brown <david.brown@hesbynett.no> - 2021-01-26 15:46 +0100
                                                                        Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-27 03:43 -0800
                                                                          Re: Programming exercise/challenge David Brown <david.brown@hesbynett.no> - 2021-01-27 13:43 +0100
                                                                            Re: Programming exercise/challenge Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-01-27 17:51 +0300
                                                                              Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-27 11:02 -0500
                                                                              Re: Programming exercise/challenge David Brown <david.brown@hesbynett.no> - 2021-01-27 17:03 +0100
                                                                            Re: Programming exercise/challenge Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2021-01-27 07:21 -0800
                                                                              Re: Programming exercise/challenge David Brown <david.brown@hesbynett.no> - 2021-01-27 17:09 +0100
                                                                            Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-27 17:04 +0000
                                                                              Re: Programming exercise/challenge David Brown <david.brown@hesbynett.no> - 2021-01-28 10:41 +0100
                                                                                Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-28 18:25 +0000
                                                                              Re: Programming exercise/challenge David Brown <david.brown@hesbynett.no> - 2021-01-28 10:44 +0100
                                                                                Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-28 21:33 +0000
                                                                                  Re: Programming exercise/challenge David Brown <david.brown@hesbynett.no> - 2021-01-29 10:39 +0100
                                                                  Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-25 23:52 -0500
                                                                  Re: Programming exercise/challenge Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-01-26 11:37 +0000
                                                                Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-27 08:04 -0800
                                                                  Re: Programming exercise/challenge Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-01-27 19:16 +0300
                                                                    Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-27 23:38 -0800
                                                        Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-27 13:43 -0800
                                                          Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-28 03:16 -0800
                                                            Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-28 06:42 -0500
                                                            Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-28 13:01 -0800
                              Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-06 13:35 -0500
                              Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-06 19:27 +0000
                              Re: Programming exercise/challenge Kaz Kylheku <563-365-8930@kylheku.com> - 2021-01-06 21:25 +0000
                      Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-06 00:37 -0500
                        Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-06 04:34 -0800
                          Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-06 11:54 -0500
                  Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-05 15:28 -0800
              Re: Programming exercise/challenge James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-01-05 13:27 -0500
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-05 15:43 -0800
            Re: Programming exercise/challenge Dave Dunfield <dave.dunfield@gmail.com> - 2021-01-05 20:10 -0800
              Re: Programming exercise/challenge Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-06 23:07 -0800

Page 13 of 20 — ← Prev page 1 … 11 12 [13] 14 15 … 20  Next page →


#157243

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2020-12-12 19:23 -0800
Message-ID<86pn3e1j9v.fsf@linuxsc.com>
In reply to#157232
Anton Shepelev <anton.txt@gmail.com> writes:

> Tim Rentsch:
>
>> It was taken from this page
>>
>>    https://clc-wiki.net/wiki/K%26R2_solutions:Chapter_1:Exercise_23
>>
>> and you may want to try looking there for other ideas.
>
> The program on that page annotead as:
>
>    This program breaks most of the above submissions:
>
> does not compile even in the original form!

In some sense deliberately so.  It was written at a time before
C99 had achieved widespread adoption, so most C code and most C
programmers were not using the // style comments.  The program
you mention exploits the lack of // comments so that it compiles
under C90 rules (at least I'm pretty sure it does) but not under
C99 rules.  At the point in the program where //* occurs, putting
a space between the two /'s should make it compile also under C99
rules.  (The foregoing based on my best understanding, I'm not
sure if I've tested it.)

[toc] | [prev] | [next] | [standalone]


#157157

FromKaz Kylheku <563-365-8930@kylheku.com>
Date2020-12-09 19:31 +0000
Message-ID<20201209105702.889@kylheku.com>
In reply to#157143
On 2020-12-09, Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
> Hello everyone,
>
> It's nice to see so many people joining in and putting up their
> programs.  I am trying to work through the backlog of recent
> traffic, which looks like it will take at least another day.
> Would this weekend be a good time for me to post my code?
> Sooner?  Later?  Did the sample test input file help anyone
> with their own program?

I have fixed my "goto heavy" submission to reproduce line continuations
that occur outside of comments.

I changed if/goto ladders to use switch (which I consider a form of
goto: namely computed goto). This makes the code clearer. I avoided it
in cases when the switch would have only two cases, including default.

In main() I put a default: case with a goto into every swich, even if
falling through would be sufficient. E.g. in the "start:" state/block,
there is a "default: goto outstart", even though that is the next block.
This means that the labeled blocks of main could be rearranged into any
order, as long as a "goto again" is added as the first statement, or
that block is first. The reader of the code doesn't have to worry about
invisible fall through dependencies between blocks.

Did I use a formal test suite with files? No, just interactive input,
using "cat" to buffer the input, so it's not mixed with the output.

Here is a transcript from two important cases:

$ ./comments | cat
a/\
\
\
\
\
\
\
\
\
\
b

[Ctrl-D][Enter]
a/\
\
\
\
\
\
\
\
\
\
b

$ ./comments | cat
a/\
\
\
\
\
\
\
\
*comment*/b

[Ctrl-D][Enter]
a b

$


Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

/* "get char from translation stage 2",
 * which recognizes physical lines and folds them into
 * logical lines
 */
int s2getc(int preserve, int *pcount)
{
  int ch;
  int count = 0;

again:
  ch = getchar();
  if (ch != '\\')
    goto end;

  ch = getchar();
  if (ch == '\n')
    goto checkpreserve;

  if (ch == EOF) {
    ch = '\\';
    goto end;
  }

  ungetc(ch, stdin);
  ch = '\\';

end:
  *pcount = count;
  return ch;

checkpreserve:
  if (count == INT_MAX)
    abort();
  count++;
  if (!preserve)
    goto again;
  putchar('\\');
  putchar('\n');
  goto again;
}

int main(void)
{
  int ch;
  int qc;
  int count;

start:
  switch (ch = s2getc(1, &count)) {
  case EOF: goto end;
  case '/': goto slash;
  case '"':
  case '\'': qc = ch;
             goto quote;
  default: goto outstart;
  }

outstart:
  putchar(ch);
  goto start;

slash:
  switch (ch = s2getc(0, &count)) {
  case EOF: goto endcont;
  case '*': goto slashstar;
  case '/': goto slashslash;
  default: putchar('/');
           goto outcont;
  }

outcont:
  if (count == 0)
    goto outstart;
  putchar('\\');
  putchar('\n');
  count--;
  goto outcont;

slashstar:
  switch (ch = s2getc(0, &count)) {
  case EOF: goto badend;
  case '*': goto maybeend;
  default: goto slashstar;
  }

maybeend:
  switch (ch = s2getc(0, &count)) {
  case EOF: goto badend;
  case '/': putchar(' ');
            goto start;
  default: goto slashstar;
  }

slashslash:
  switch (ch = s2getc(0, &count)) {
  case EOF: goto badend;
  case '\n': goto outstart;
  default: goto slashslash;
  }

quote:
  putchar(ch);
  switch (ch = s2getc(1, &count)) {
  case EOF: goto badend;
  case '\\': goto bsinquote;
  default: if (ch == qc)
             goto outstart;
           goto quote;
  }

bsinquote:
  putchar(ch);
  ch = s2getc(1, &count);
  if (ch == EOF)
    goto badend;
  goto quote;

endcont:
  if (count == 0)
    goto end;
  putchar('\\');
  putchar('\n');
  count--;
  goto endcont;

end:
  return EXIT_SUCCESS;

badend:
  return EXIT_FAILURE;
}

[toc] | [prev] | [next] | [standalone]


#157160

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2020-12-09 12:01 -0800
Message-ID<86h7ou4ul3.fsf@linuxsc.com>
In reply to#157143
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

[...]

Status - list of posted programs I have seen and collected:

    Anton Shepelev          2 versions

    Bart                    3 versions

    Ben Bacarisse           2 versions

    luser droog             3 versions

    jacobnavia              3 versions

    jfbode1029@gmail.com    1 version

    Kaz Kylheku             3 versions

    Malcolm McLean          2 versions


Collected programs were compiled and run as they were submitted,
except 

 *  accidental line wrapping in several programs was undone

 *  void main( void )  =>  int main( void )

 *  a #include <stdio.h> was added in one case

 *  a #include <stddef.h> was added in one case

 *  a few programs wanted to read a file name from argv[1]
    and wouldn't run without out one (the problem statement
    said to read from stdin);  those were modified to just
    use stdin and not do the argc/argv test.

[toc] | [prev] | [next] | [standalone]


#157163

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2020-12-09 12:25 -0800
Message-ID<86czzi4tgq.fsf@linuxsc.com>
In reply to#157160
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
> [...]
>
> Status - list of posted programs I have seen and collected:
{...]
>     Kaz Kylheku             3 versions

Correction:  I had only two distinct versions by Kaz Kylheku;
one was a duplicate.  After posting the above I see that
he has posted a new version, which I have now collected.
(I am still calling the latest posting version four, even
though what I have is only three distinct versions.)

[toc] | [prev] | [next] | [standalone]


#157634

Fromkegs@provalid.com (Kent Dickey)
Date2020-12-23 01:00 -0600
Message-ID<C7mdnQmy4fi1dn_CnZ2dnUU7-cPNnZ2d@giganews.com>
In reply to#156943
In article <86wnxwkyol.fsf@linuxsc.com>,
Tim Rentsch  <tr.17687@z991.linuxsc.com> wrote:
>Prompted by some recent discussion regarding 'goto' statements and
>state machines, I would like to propose a programming exercise.
>(It is perhaps a bit too large to be called an exercise, but not so
>difficult that it deserves the label of challenge.  On the other
>hand there are some constraints so maybe challenge is apropos.  In
>any case somewhere in between those two bounds.)
>
>Short problem statement:  a C program to remove comments from C
>source input.
>
>Specifics:  Remove both /*...*/ and //... style comments.  Don't
>worry about trigraphs.  Read from stdin, write to stdout, and
>diagnostics (if any) go to stderr.  If EOF is seen inside a
>comment, do something sensible but it doesn't matter what as long
>as it's sensible.  Use no 'goto' statements.  Limit function
>bodies to no more than 25 lines.
>
>Other:  feel free to handle corner cases as you see fit, as long
>as there is some description of what choice was made.
>
>Hopefully it will be a fun exercise.  It isn't trivial but it
>shouldn't take too long either.

Here's my solution.  It works on my simple test cases.  It should be
tested more.

I don't really like the way this works, and it appears to use
recursion (but it really should just jump to the top of the function).

I follow the CPP style of maintaining line counts--so if a multiline
comment is seen, the right number of newlines is output.  And \ followed
by newline has both characters removed completely--but extra newlines
accounting for the newlines removed will be output after the next newline.

All quoted strings are treated as ending when a non-escaped newline is found.
It uses no global variables, all state is in a structure.  The variable
lines_skipped should be unsigned long.


#include <stdio.h>
#include <stdlib.h>

typedef struct {
        int     lines_skipped;
        int     in_comment;
        int     in_string;
        int     pushback;
} Tokstate;

int
get_tok(Tokstate *tokptr)
{
        int     tok, tok2;

        tok = tokptr->pushback;
        tokptr->pushback = -1;
        if(tok < 0) {
                tok = getchar();
        }
        if(tok == '\\') {
                tok2 = getchar();
                if(tok2 == '\n') {
                        tokptr->lines_skipped++;
                        return get_tok(tokptr);
                }
                tokptr->pushback = tok2;
        }
        return tok;
}

int
next_tok(Tokstate *tokptr)
{
        int     tok, tok2;

        tok = get_tok(tokptr);
        if(tokptr->in_comment == 1) {           // Handle // comment
                if(tok == '\n') {
                        tokptr->in_comment = 0;
                        return tok;
                }
                return next_tok(tokptr);
        } else if(tokptr->in_comment == 2) {    // Handle /* comment */
                if(tok == '\n') {
                        tokptr->lines_skipped++;
                }
                if(tok == '*') {
                        tok2 = get_tok(tokptr);
                        if(tok2 == '/') {       // end comment
                                tokptr->in_comment = 0;
                        } else {
                                tokptr->pushback = tok2;
                        }
                }
                return next_tok(tokptr);
        }
        if(tokptr->in_string) {
                if(tok == tokptr->in_string) {
                        tokptr->in_string = 0;
                }
                if(tok == '\n') {
                        tokptr->in_string = 0;
                }
                return tok;
        }
        if(tok == 0x27) {               // '
                tokptr->in_string = tok;
        }
        if(tok == '"') {                // "
                tokptr->in_string = tok;
        }
        if(tok == '/') {
                tok2 = get_tok(tokptr);
                if(tok2 == '/') {
                        tokptr->in_comment = 1;
                        return ' ';
                } else if(tok2 == '*') {
                        tokptr->in_comment = 2;
                        return ' ';
                } else {
                        tokptr->pushback = tok2;
                }
        }
        return tok;
}

int
main(int argc, char **argv)
{
        Tokstate tokstate;
        int     c;
        int     i;

        tokstate.lines_skipped = 0;
        tokstate.in_comment = 0;
        tokstate.in_string = 0;
        tokstate.pushback = -1;
        while(1) {
                c = next_tok(&tokstate);
                if((c == '\n') || (c == -1)) {
                        for(i = 0; i < tokstate.lines_skipped; i++) {
                                putchar('\n');
                        }
                        tokstate.lines_skipped = 0;
                        if(c < 0) {
                                break;
                        }
                }
                putchar(c);
        }
        exit(0);
}

[toc] | [prev] | [next] | [standalone]


#157711

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2020-12-24 14:34 -0800
Message-ID<86sg7uygsg.fsf@linuxsc.com>
In reply to#157634
kegs@provalid.com (Kent Dickey) writes:

> In article <86wnxwkyol.fsf@linuxsc.com>,
> Tim Rentsch  <tr.17687@z991.linuxsc.com> wrote:
>
>> Prompted by some recent discussion regarding 'goto' statements and
>> state machines, I would like to propose a programming exercise.
>> (It is perhaps a bit too large to be called an exercise, but not so
>> difficult that it deserves the label of challenge.  On the other
>> hand there are some constraints so maybe challenge is apropos.  In
>> any case somewhere in between those two bounds.)
>>
>> Short problem statement:  a C program to remove comments from C
>> source input.
>>
>> Specifics:  Remove both /*...*/ and //... style comments.  Don't
>> worry about trigraphs.  Read from stdin, write to stdout, and
>> diagnostics (if any) go to stderr.  If EOF is seen inside a
>> comment, do something sensible but it doesn't matter what as long
>> as it's sensible.  Use no 'goto' statements.  Limit function
>> bodies to no more than 25 lines.
>>
>> Other:  feel free to handle corner cases as you see fit, as long
>> as there is some description of what choice was made.
>>
>> Hopefully it will be a fun exercise.  It isn't trivial but it
>> shouldn't take too long either.
>
> Here's my solution.  It works on my simple test cases.  It should be
> tested more.  [...]

I did see your posting, and added the code to my set of posted
programs.

I'm sorry to say the original problem statement was not as
explicit as it might have been about what is being sought.  I did
post a clarification but maybe you didn't see that.  To give a
concrete example, for this input (the stuff between the two lines
of equal signs, but without the indenting four spaces):

================
    #define PLUS(a,b) ( \
      (a) + (b)         \
    )

        int x = 123\
    \
    45;

        int y = 10/\
    \
                   2;

    #define LAST_LINE
================

your program gives this

================
    #define PLUS(a,b) (   (a) + (b)         )



        int x = 12345;



        int y = 10/               2;



    #define LAST_LINE
================

but what is being looked for is this 

================
    #define PLUS(a,b) ( \
      (a) + (b)         \
    )

        int x = 123\
    \
    45;

        int y = 10/\
    \
                   2;

    #define LAST_LINE
================

that is, the output should be identical to the input.  The source
has no comments, so nothing should change.

If you have trouble finding my posting clarifying the problem
statement, let me know and I can repost it.

I should also say your program is an interesting take on how to
address the problem, which is nice to see.  After seeing your
code here, I'm curious to see how you might solve the problem as
first intended.

[toc] | [prev] | [next] | [standalone]


#157806

Fromkegs@provalid.com (Kent Dickey)
Date2020-12-26 23:03 -0600
Message-ID<lIadneM_lbYiiHXCnZ2dnUU7-YnNnZ2d@giganews.com>
In reply to#157711
In article <86sg7uygsg.fsf@linuxsc.com>,
Tim Rentsch  <tr.17687@z991.linuxsc.com> wrote:
>kegs@provalid.com (Kent Dickey) writes:
>> Here's my solution.  It works on my simple test cases.  It should be
>> tested more.  [...]
>that is, the output should be identical to the input.  The source
>has no comments, so nothing should change.
>
>If you have trouble finding my posting clarifying the problem
>statement, let me know and I can repost it.
>
>I should also say your program is an interesting take on how to
>address the problem, which is nice to see.  After seeing your
>code here, I'm curious to see how you might solve the problem as
>first intended.

First, the description gave no limit on input size.  In order to allow a
32-bit system to handle files over 4GB requires character-at-a-time-handling.
The statemachine required is tricky, and there are still cases where it's
unclear what the right output should be.

Keeping escaped newlines around is a pain.  The case I found hardest to handle
is:

/\
\
[Repeat escaped newlines for as long as you want]...
\
/ This is a comment 
Last line

And then replacing the final line with something NOT starting with a '/'.
It's also unclear what removing the comment should be in this case.  THe
way I wrote it, the above would become as output:
 \
\
[ repeat....[
\

Last line

Basically, I treat the escaped newlines between '/' and '/' as being
BEFORE the comment, and so they make the output.  Removing them takes
one line of code to reset tokptr->escaped_newlines=0 when a comment starts.
I don't know what the right answer here should be.

To parse this a character-at-a-time seems to require counting the escaped
newlines, and then when we determine what the next valid character is,
outputting that count.  So that's what I did.  This is now a "tricky"
algorithm.

I also added simple error checking for: quotes lines that seem to be
open when a newline is seen; comments still open when the file ends.

As for handling strings, I tried to do what "cc -E" does: quoted strings
can START with an escaped quote character, but can only end with a non-
escpaed quote character.  So:

\' /* This is not a comment */ '

Is a valid line where there is no comment to be removed since it's inside
a string.  Handling escaped quotes is handled by adding 0x100 to the
character value, so "\\'" is not "'" and won't end a quoted string.

It's gotten quite long.


#include <stdio.h>
#include <stdlib.h>

typedef struct {
        unsigned long long lines_skipped;
        unsigned long long escaped_newlines;
        int     in_comment;
        int     in_string;
        int     pushback;
        int     error;
} Tokstate;

int
get_tok(Tokstate *tokptr)
{
        int     tok, tok2;

        while(1) {
                tok = tokptr->pushback;
                tokptr->pushback = -1;
                if(tok < 0) {
                        tok = getchar();
                }
                if(tok == '\\') {
                        tok2 = getchar();
                        if(tok2 == -1) {
                                return tok;
                        }
                        if(tok2 == '\n') {
                                if(tokptr->in_comment) {
                                        tokptr->lines_skipped++;
                                } else {
                                        tokptr->escaped_newlines++;
                                }
                                continue;
                        }
                        tok = tok2 | 0x100;
                }
                return tok;
        }
}

int
remove_comments(Tokstate *tokptr)
{
        int     tok, tok2;

        while(1) {
                tok = get_tok(tokptr);
                if(tok < 0) {
                        return tok;
                }
                if(tokptr->in_comment) {
                        if(tokptr->in_comment == 1) {   // Handle // comment
                                if(tok == '\n') {
                                        tokptr->in_comment = 0;
                                        return tok;
                                }
                        } else if(tokptr->in_comment == 2) {    // /* comment */
                                if(tok == '\n') {
                                        tokptr->lines_skipped++;
                                }
                                if(tok == '*') {
                                        tok2 = get_tok(tokptr);
                                        if(tok2 == '/') {       // end comment
                                                tokptr->in_comment = 0;
                                        } else {
                                                tokptr->pushback = tok2;
                                        }
                                }
                        }
                        continue;
                }
                return tok;
        }
}

int
next_tok(Tokstate *tokptr)
{
        int     tok, tok2;

        tok = remove_comments(tokptr);
        if(tokptr->in_string) {
                if(tok == tokptr->in_string) {
                        tokptr->in_string = 0;
                }
                if(tok == '\n') {
                        tokptr->in_string = 0;
                        fprintf(stderr, "Bad string\n");
                        tokptr->error = 1;
                }
                return tok;
        }
        if(tok == '/') {                        // Starting a comment?
                tok2 = get_tok(tokptr);
                if(tok2 == '/') {
                        tokptr->in_comment = 1;
                        tok = ' ';
                } else if(tok2 == '*') {
                        tokptr->in_comment = 2;
                        tok = ' ';
                } else {
                        tokptr->pushback = tok2;
                }
        }
        tok2 = tok & 0xff;
        if(tok2 == '\'') {              // '
                tokptr->in_string = tok2;
        }
        if(tok2 == '"') {               // "
                tokptr->in_string = tok2;
        }
        return tok;
}

int
main(int argc, char **argv)
{
        Tokstate tokstate;
        int     c;
        unsigned long long ucnt;

        tokstate.lines_skipped = 0;
        tokstate.escaped_newlines = 0;
        tokstate.in_comment = 0;
        tokstate.in_string = 0;
        tokstate.pushback = -1;
        tokstate.error = -1;
        while(1) {
                c = next_tok(&tokstate);
                if((c == '\n') || (c == -1)) {
                        for(ucnt = 0; ucnt < tokstate.lines_skipped; ucnt++) {
                                putchar('\n');
                        }
                        tokstate.lines_skipped = 0;
                        if(c < 0) {
                                break;
                        }
                }
                if(c & 0x100) {
                        putchar('\\');
                }
                putchar(c & 0xff);
                for(ucnt = 0; ucnt < tokstate.escaped_newlines; ucnt++) {
                        puts("\\");
                }
                tokstate.escaped_newlines = 0;
        }
        for(ucnt = 0; ucnt < tokstate.escaped_newlines; ucnt++) {
                puts("\\");
        }
        if(tokstate.in_comment) {
                fprintf(stderr, "Dangling comment\n");
                tokstate.error = 1;
        }
        if(tokstate.in_string) {
                fprintf(stderr, "Dangling string\n");
                tokstate.error = 1;
        }
        exit(tokstate.error);
}

[toc] | [prev] | [next] | [standalone]


#157818

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2020-12-27 06:29 -0800
Message-ID<86h7o7wce3.fsf@linuxsc.com>
In reply to#157806
kegs@provalid.com (Kent Dickey) writes:

> In article <86sg7uygsg.fsf@linuxsc.com>,
> Tim Rentsch  <tr.17687@z991.linuxsc.com> wrote:
>
>> kegs@provalid.com (Kent Dickey) writes:
>>
>>> Here's my solution.  It works on my simple test cases.  It should be
>>> tested more.  [...]
>>
>> that is, the output should be identical to the input.  The source
>> has no comments, so nothing should change.
>>
>> If you have trouble finding my posting clarifying the problem
>> statement, let me know and I can repost it.
>>
>> I should also say your program is an interesting take on how to
>> address the problem, which is nice to see.  After seeing your
>> code here, I'm curious to see how you might solve the problem as
>> first intended.
>
> First, the description gave no limit on input size.  In order
> to allow a 32-bit system to handle files over 4GB requires
> character-at-a-time-handling.

Yes, AFAICS, it does.

> The statemachine required is tricky,

It is.

> and there are still cases where it's unclear what the right
> output should be.

Here is I think an unambiguous specification:

    Any characters outside of comments should be kept exactly
    as they appear in the source.

    Any characters part of a // comment should be removed,
    remembering that the final newline is not part of the
    comment and so should be left in the output[*].  The
    characters removed should include any "\\\n" pairs that
    occur after the first / and before the final newline.

    Any characters part of a /*.*/ comment should be removed
    and replaced by a single space.  The characters removed
    should include any "\\\n" pairs that occur between the
    initial / and the final /.

    Things like unterminated strings or character literals
    can be treated as ending at the newline or EOF.

[*] Under the suggested rule, a line like this

    #define BACK_SLANT \// yes, a backslant!

would result as a line with a <backslant><newline>.  Unfortunately
this might subsequently be treated as a line continuation, which
obviously is not what is intended.  Even so, to keep things simple,
simply take out // comments and replace them with nothing.

> Keeping escaped newlines around is a pain.

It looks like you are trying to keep line counts the same, which
is a nice property.  Unfortunately it complicates the problem,
so you should feel free to follow the simpler rules given above.

> The case I found hardest to handle is:
>
> /\
> \
> [Repeat escaped newlines for as long as you want]...
> \
> / This is a comment
> Last line
>
> And then replacing the final line with something NOT starting
> with a '/'.  It's also unclear what removing the comment should
> be in this case.  THe way I wrote it, the above would become as
> output:
>  \
> \
> [ repeat....[
> \
>
> Last line
>
> Basically, I treat the escaped newlines between '/' and '/' as being
> BEFORE the comment, and so they make the output.  Removing them
> takes one line of code to reset tokptr->escaped_newlines=0 when a
> comment starts.

Okay, I may try making that change in your new source and see
what results.

> I don't know what the right answer here should be.

What you're doing is fine.  What I consider my current reference
implementation simply removes // comment altogether, including
any embedded line continuations.  Either one is okay.

> To parse this a character-at-a-time seems to require counting the
> escaped newlines, and then when we determine what the next valid
> character is, outputting that count.  So that's what I did.  This
> is now a "tricky" algorithm.

Certainly the problem is not trivial.

> I also added simple error checking for:  quotes lines that seem to
> be open when a newline is seen;  comments still open when the file
> ends.

Some test cases you might want to try (remember to take out
leading indentation):

    "\\
    t"

    '\\
    t'

Both of these are valid input to the C pre-processor.  The first
is a string with one character (plus a final null character), and
the second is a one-character character literal.  The character
is \t, or TAB, in each of the two cases.

> As for handling strings, I tried to do what "cc -E" does:  quoted
> strings can START with an escaped quote character, but can only
> end with a non- escpaed quote character.  So:
>
> \' /* This is not a comment */ '
>
> Is a valid line where there is no comment to be removed since it's
> inside a string.

In the C pre-processor, a \ by itself is a valid pre-processor
token.  So what I think is happening here is that the pre-processor
sees a one-character token (\), followed by an ordinary character
literal (with too many characters, but still a valid token in the
C pre-processor).

> Handling escaped quotes is handled by adding 0x100 to the
> character value, so "\\'" is not "'" and won't end a quoted
> string.

Did you mean "\"" or '\''?  If not then I am confused.

> It's gotten quite long.  [...]

I am adding it to the set of submissions.

[toc] | [prev] | [next] | [standalone]


#157848

Fromkegs@provalid.com (Kent Dickey)
Date2020-12-28 11:52 -0600
Message-ID<NeydnaRRftzThnfCnZ2dnUU7-evNnZ2d@giganews.com>
In reply to#157818
In article <86h7o7wce3.fsf@linuxsc.com>,
Tim Rentsch  <tr.17687@z991.linuxsc.com> wrote:
>Here is I think an unambiguous specification:
>
>    Any characters outside of comments should be kept exactly
>    as they appear in the source.
>
>    Any characters part of a // comment should be removed,
>    remembering that the final newline is not part of the
>    comment and so should be left in the output[*].  The
>    characters removed should include any "\\\n" pairs that
>    occur after the first / and before the final newline.
>
>    Any characters part of a /*.*/ comment should be removed
>    and replaced by a single space.  The characters removed
>    should include any "\\\n" pairs that occur between the
>    initial / and the final /.
>
>    Things like unterminated strings or character literals
>    can be treated as ending at the newline or EOF.
>
>[*] Under the suggested rule, a line like this
>
>    #define BACK_SLANT \// yes, a backslant!
>
>would result as a line with a <backslant><newline>.  Unfortunately
>this might subsequently be treated as a line continuation, which
>obviously is not what is intended.  Even so, to keep things simple,
>simply take out // comments and replace them with nothing.

This is still not a complete specification.  Let me try:

1) Copy input to output, removing comments.  If there are no comments, output
	should exactly match the input.
2) \,newline (the characters 0x5c, then 0x0a) can occur at any time between any
	two symbols and the two symbols it occurs between should be
	considered to be adjacent for all purposes (but not recursively).
4) Single line comments start with //.  There may be \,newline between
	these chars.  Comments cannot start inside a string.  Once in a //
	comment, all characters are ignored until a newline is seen (which is
	not a \,newline).  The "// .... newline" should be replaced with a
	single newline.
5) Multi-line comments start with /*.  There may be \,newline between these
	two characters.  The comment ends when */ is seen (with \,newline
	allowed between them).  Comments removed should be replaced with a
	single space.
6) " strings.  If not in a comment, a " starts a quoted string.  Once in a
	string, comments are not valid.  A string ends when " is seen again.
	However, \ can escape the " character in a string, and \ can escape \
	in a quoted string.  Simply output the characters seen until
	the quote ends.  Ignore ' inside the string.
7) ' string.  Same as ", but using the ' character.  Ignore " and \,'
	inside the string.
8) Strings of either type also end when a newline (not counting \,newline) is
	seen.  It's an error you can flag if a string is open when a newline
	is seen.
9) The file may end at anytime.  If the file ends during a comment or a string,
	this can be flagged as an error.
10) Special case made explicit: the 6 characters /,\,newline,\,newline,/
	starts a comment (or ending with * to start a multi-line comment), and
	the \,newlines should be removed from the output.
	Note that: /,\,newline,\,newline,a is nothing special and needs to
	be copied to the output.

And then the bonus clarifications:
c1) In general, \ has no special properties. \\ is just two backslashes.
	So \ is not an 'escape' to take away meaning of the next character.
	There are exceptions inside strings.
c2) /,\,newline,/ is the start of a single line comment.  The \,newline
	can be repeated.  If in a multi-line comment, *,\,newline,/ will end
	the comment.
c3) Since \ cannot be escaped, \,\,newline,A (0x5c,0x5c,0x0a,0x41) is really
	\,a (0x5c,0x41).
	The \,newline rule is not recursive: /,\,\,newline,newline,/ is not the
	start of a comment.  (If it was recursive, this would be first
	interpreted as /,\,newline,/, and then as /,/ and would be the start
	of a comment.  Again, it's not recursive, so this isn't true).
c4) \// is the start of a comment, the backslash means nothing.
	/\/ is not the start of a comment, the backslash breaks up the /,/
c5) Backslashes in string examples:
		"/* comment */"		-> "/* comment */"
		"\\\\" /* comment" */	-> "\\\\" [space]
		"\\\\\" /* comment" */	-> "\\\\\" /* comment" */
c6) Ignore strings inside comments
	/* "comment */ is a fine comment and is replaced by a single space.

If the above seems right, I can try to implement that.  My first try
didn't handle \" inside strings properly, and my next try let \ escape
characters in general processing.

Kent

[toc] | [prev] | [next] | [standalone]


#157864

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2020-12-29 00:38 -0800
Message-ID<86zh1xuhv3.fsf@linuxsc.com>
In reply to#157848
kegs@provalid.com (Kent Dickey) writes:

> In article <86h7o7wce3.fsf@linuxsc.com>,
> Tim Rentsch  <tr.17687@z991.linuxsc.com> wrote:
>
>> Here is I think an unambiguous specification:
>>
>>    Any characters outside of comments should be kept exactly
>>    as they appear in the source.
>>
>>    Any characters part of a // comment should be removed,
>>    remembering that the final newline is not part of the
>>    comment and so should be left in the output[*].  The
>>    characters removed should include any "\\\n" pairs that
>>    occur after the first / and before the final newline.
>>
>>    Any characters part of a /*.*/ comment should be removed
>>    and replaced by a single space.  The characters removed
>>    should include any "\\\n" pairs that occur between the
>>    initial / and the final /.
>>
>>    Things like unterminated strings or character literals
>>    can be treated as ending at the newline or EOF.
>>
>> [*] Under the suggested rule, a line like this
>>
>>    #define BACK_SLANT \// yes, a backslant!
>>
>> would result as a line with a <backslant><newline>.  Unfortunately
>> this might subsequently be treated as a line continuation, which
>> obviously is not what is intended.  Even so, to keep things simple,
>> simply take out // comments and replace them with nothing.
>
> This is still not a complete specification.  Let me try:
>
> 1) Copy input to output, removing comments.  If there are no
>    comments, output should exactly match the input.

Yes.

> 2) \,newline (the characters 0x5c, then 0x0a) can occur at any
>    time between any two symbols and the two symbols it occurs between
>    should be considered to be adjacent for all purposes (but not
>    recursively).

Yes.  (Sorry, I assumed this rule was known to all and didn't
have to be stated.)  Also, I would say any number of \,newline
pairs, from zero on up.

> 4) Single line comments start with //.  There may be \,newline
>    between these chars.  Comments cannot start inside a string.
>    Once in a // comment, all characters are ignored until a newline
>    is seen (which is not a \,newline).  The "// .... newline" should
>    be replaced with a single newline.

Yes.

> 5) Multi-line comments start with /*.  There may be \,newline
>    between these two characters.  The comment ends when */ is seen
>    (with \,newline allowed between them).  Comments removed should
>    be replaced with a single space.

Yes, except that I would add that /*...*/ comments might (and
often do) occur on a single line.  But yes in the sense that they
will include any embedded newlines.

> 6) " strings.  If not in a comment, a " starts a quoted string.
>    Once in a string, comments are not valid.  A string ends when "
>    is seen again.  However, \ can escape the " character in a
>    string, and \ can escape \ in a quoted string.  Simply output the
>    characters seen until the quote ends.  Ignore ' inside the
>    string.

Yes.

> 7) ' string.  Same as ", but using the ' character.  Ignore " and
>    \,' inside the string.

Yes.  (Usually these are called character constants rather than
strings.)

> 8) Strings of either type also end when a newline (not counting
>    \,newline) is seen.  It's an error you can flag if a string is
>    open when a newline is seen.

Yes.  Technically if a string or character constant isn't closed
before the next (unescaped) newline then that is undefined
behavior.  In other words the input is not lexically well-formed,
and so may be handled as you see fit (expecting that the handling
is sensible rather than something nutty).

> 9) The file may end at anytime.  If the file ends during a
>    comment or a string, this can be flagged as an error.

Yes.  I should add, the C standard wants source files to end only
after a final (unescaped) newline, so EOF anywhere other than at
the beginning of a line might be flagged as an error.  But doing
nothing or adding a final newline if one is missing is okay too.

> 10) Special case made explicit:  the 6 characters
>
>          /,\,newline,\,newline,/
>
>     starts a comment (or ending with * to start a multi-line
>     comment), and the \,newlines should be removed from the
>     output.  Note that: /,\,newline,\,newline,a is nothing
>     special and needs to be copied to the output.

Yes.

> And then the bonus clarifications:

> c1) In general, \ has no special properties. \\ is just two backslashes.
>     So \ is not an 'escape' to take away meaning of the next character.
>     There are exceptions inside strings.

Yes.

> c2) /,\,newline,/ is the start of a single line comment.  The \,newline
>     can be repeated.  If in a multi-line comment, *,\,newline,/ will end
>     the comment.

Yes.  (And similarly for more than one \,newline pair between the
two initial / characters.)

> c3) Since \ cannot be escaped, \,\,newline,A (0x5c,0x5c,0x0a,0x41)
      is really \,a (0x5c,0x41).

Yes (presuming you meant 'A' and not 'a' at the end there).  Also
note that context matters:  inside a comment, \,\,newline,A is
just gobbled up;  outside a comment, \,\,newline,A should result
in \,\,newline,A in the output, i.e., the \,newline pair should
be preserved in the output.

>     The \,newline rule is not recursive: /,\,\,newline,newline,/
>     is not the start of a comment.  (If it was recursive, this
>     would be first interpreted as /,\,newline,/, and then as /,/
>     and would be the start of a comment.  Again, it's not
>     recursive, so this isn't true).

Yes.

> c4) \// is the start of a comment, the backslash means nothing.
>     /\/ is not the start of a comment, the backslash breaks up the /,/

Yes.

> c5) Backslashes in string examples:
>         "/* comment */"		-> "/* comment */"
>         "\\\\" /* comment" */	-> "\\\\" [space]
>         "\\\\\" /* comment" */	-> "\\\\\" /* comment" */

Yes.  (I take the output on the second line as having a space in
between the second " and the [space].)

> c6) Ignore strings inside comments
>     /* "comment */ is a fine comment and is replaced by a single space.

Yes.

> If the above seems right, I can try to implement that.  My first try
> didn't handle \" inside strings properly, and my next try let \ escape
> characters in general processing.

I am looking forward to seeing your next version.

[toc] | [prev] | [next] | [standalone]


#157840

FromAnton Shepelev <anton.txt@gmail.com>
Date2020-12-28 15:29 +0300
Message-ID<20201228152943.8e3f434287040b8e9e28afdf@gmail.com>
In reply to#157806
Kent Dickey:

> The statemachine required is tricky

Upon completion of your own solution, I recommend you to
look at mine, which I hope demonstrates how a complicated
state machine can be decomposed into two simple ones.

-- 
()  ascii ribbon campaign -- against html e-mail
/\  http://preview.tinyurl.com/qcy6mjc [archived]

[toc] | [prev] | [next] | [standalone]


#157856

Fromkegs@provalid.com (Kent Dickey)
Date2020-12-28 17:12 -0600
Message-ID<PsydnXmamaT7-3fCnZ2dnUU7-S3NnZ2d@giganews.com>
In reply to#157840
In article <20201228152943.8e3f434287040b8e9e28afdf@gmail.com>,
Anton Shepelev  <anton.txt@gmail.com> wrote:
>Kent Dickey:
>
>> The statemachine required is tricky
>
>Upon completion of your own solution, I recommend you to
>look at mine, which I hope demonstrates how a complicated
>state machine can be decomposed into two simple ones.
>
>-- 
>()  ascii ribbon campaign -- against html e-mail
>/\  http://preview.tinyurl.com/qcy6mjc [archived]

Are you referring to <20201208015930.831f44395024675505845f37@gmail.com>?

If so, it fails several of my small tests.  One example:

"abc\\
"/* in str */" /* out of str */

This is effectively: "abc\"/* in str */"

That code transforms it to:
"abc"/* in str */"

This lost the \,newline (minor nit, but required in the current description)
and the \" (breaks the C code).

State machines are a way to encode in a relatively small "space" a
surprisingly complex amount of information.  This sadly is almost the
definition of "hard to review".

This problem requires some backtracking, and two separate counters.
A statemachine can be made to work, but there are a lot of special cases to
get right.

Kent

[toc] | [prev] | [next] | [standalone]


#157862

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2020-12-28 23:54 -0800
Message-ID<864kk5vyhg.fsf@linuxsc.com>
In reply to#157856
kegs@provalid.com (Kent Dickey) writes:

> In article <20201228152943.8e3f434287040b8e9e28afdf@gmail.com>,
> Anton Shepelev  <anton.txt@gmail.com> wrote:
>
>> Kent Dickey:
>>
>>> The statemachine required is tricky
>>
>> Upon completion of your own solution, I recommend you to
>> look at mine, which I hope demonstrates how a complicated
>> state machine can be decomposed into two simple ones.
>
> Are you referring to <20201208015930.831f44395024675505845f37@gmail.com>?
>
> If so, it fails several of my small tests.  One example:
>
> "abc\\
> "/* in str */" /* out of str */
>
> This is effectively:  "abc\"/* in str */"
>
> That code transforms it to:
> "abc"/* in str */"

The latest version Anton posted handles this case correctly.


> State machines are a way to encode in a relatively small "space" a
> surprisingly complex amount of information.  This sadly is almost
> the definition of "hard to review".

Doesn't that depend on how the state machine information is
presented?


> This problem requires some backtracking,

I'm not sure why you think the problem requires backtracking.  To
me it seems clear that backtracking is not needed (although some
approaches might find using backtracking to be a convenient way
to write the program).

> and two separate counters.

Really??  What two counters are those?


> A statemachine can be made to work, but there are a lot of
> special cases to get right.

I think there are a lot of cases to get right whether a state
machine is used or not.  For some problems state machines are
poor choices but I don't that is the case for the this problem.
That is not say other approaches might not also be good, only
that using a state machine seems like a plausible and viable
alternative here.

[toc] | [prev] | [next] | [standalone]


#157865

Fromkegs@provalid.com (Kent Dickey)
Date2020-12-29 10:26 -0600
Message-ID<kYOdnVyE781WxXbCnZ2dnUU7-cfNnZ2d@giganews.com>
In reply to#157806
Here's my (hopefully last) attempt.

Now, I've optimized the main loop so it should be about as fast as possible
until a /, ", or ' is seen, then it does the slow processing to get things
right until the quote or comment ends.  In the main loop, it's basically
if(array[c = getchar()]) putchar(c).  If that's not fast enough, you'd have
to roll your own putchar()/getchar().

It's a different approach--now multiple subroutines call getchar()/putchar().
I like it better in some ways, but I don't love it.

It passes my simple tests, but there are probably still bugs.  This is
tricky enough that a good test suite is needed.

------

#include <stdio.h>
#include <stdlib.h>

int     g_ret = 0;

void
eat_quote(int type)
{
        unsigned long long backsl_dcnt;
        int     c;

        backsl_dcnt = 0;
        putchar(type);
        while(1) {
                c = getchar();
                if(c < 0) {
                        g_ret = 1;
                        fprintf(stderr, "File ended during string\n");
                        return;
                }
                putchar(c);
                if(c == '\\') {                 // backslash
                        backsl_dcnt++;
                        continue;
                } else if(c == '\n') {          // newline
                        if(backsl_dcnt) {
                                // \,newline
                                backsl_dcnt--;
                                continue;
                        }
                        g_ret = 1;
                        fprintf(stderr, "String spans multiple lines\n");
                        return;                 // End of line
                } else if(c == type) {
                        if(backsl_dcnt & 1) {
                                // It's escaped, not the end
                                backsl_dcnt = 0;
                                continue;
                        }
                        return;
                }
        }
}

int
eat_comment(int type)
{
        int     c, prev_c, got_backslash;

        got_backslash = 0;
        prev_c = 0;
        while(1) {
                c = getchar();
                if(c < 0) {
                        if(type == '*') {
                                g_ret = 1;
                                fprintf(stderr, "Comment unterminated\n");
                                return ' ';
                        }
                        return c;
                }
                if(c == '\\') {
                        // Might be start of \,newline
                        got_backslash = 1;
                        continue;
                }
                if((c == '\n') && got_backslash) {
                        got_backslash = 0;
                        continue;
                }
                if(type == '/') {               // Single-line comment //
                        if(c == '\n') {
                                return c;
                        }
                } else {                        // Multi-line comment /* */
                        if((c == '/') && (prev_c == '*') && !got_backslash) {
                                return ' ';     // End of comment
                        }
                }
                got_backslash = 0;
                prev_c = c;
        }
}

void
output_backsl_newline(unsigned long long dmax)
{
        unsigned long long dcnt;

        putchar('/');
        for(dcnt = 0; dcnt < dmax; dcnt++) {
                putchar('\\');          // \ char
                putchar('\n');          // newline
        }
}

int
maybe_comment()
{
        unsigned long long dcnt;
        int     c, c2;

        // We got a /.  See if next effective char is * or /
        dcnt = 0;
        while(1) {
                c = getchar();
                if(c == '\\') {                 // \
                        // See if it's \,newline
                        c2 = getchar();
                        if(c2 == '\n') {
                                dcnt++;
                                continue;
                        } else {	// We got /, \, and something else.
                                output_backsl_newline(dcnt);
                                putchar(c);
                                return c2;
                        }
                } else if((c == '/') || (c == '*')) {
                        return eat_comment(c);
                } else {
                        output_backsl_newline(dcnt);
                        return c;
                }
        }
}

void
start_special(int c)
{
        while(c >= 0) {
                if(c == '"' || c == '\'') {
                        eat_quote(c);
                        return;
                }
                if(c != '/') {          // Nothing special, go back to main
                        putchar(c);
                        return;
                }

                c = maybe_comment();
        }
        // c < 0
        exit(g_ret);
}

int
main(int argc, char **argv)
{
        unsigned char is_special[257];
        int     c;
        int     i;

        for(i = 0; i < 257; i++) {
                is_special[i] = 0;
        }
        is_special['\'' + 1] = 1;       // '
        is_special['"' + 1] = 1;        // "
        is_special['/' + 1] = 1;        // /
        is_special[0] = 1;              // c == -1
        while(1) {
                c = getchar();
                if(is_special[c + 1]) {
                        start_special(c);
                } else {
                        putchar(c);
                }
        }
}

[toc] | [prev] | [next] | [standalone]


#157868

Fromkegs@provalid.com (Kent Dickey)
Date2020-12-29 10:37 -0600
Message-ID<taadnZ16Q5bOxnbCnZ2dnUU7-fWdnZ2d@giganews.com>
In reply to#157865
In article <kYOdnVyE781WxXbCnZ2dnUU7-cfNnZ2d@giganews.com>,
Kent Dickey <kegs@provalid.com> wrote:
>Here's my (hopefully last) attempt.
>
>Now, I've optimized the main loop so it should be about as fast as possible
>until a /, ", or ' is seen, then it does the slow processing to get things
>right until the quote or comment ends.  In the main loop, it's basically
>if(array[c = getchar()]) putchar(c).  If that's not fast enough, you'd have
>to roll your own putchar()/getchar().
>
>It's a different approach--now multiple subroutines call getchar()/putchar().
>I like it better in some ways, but I don't love it.
>
>It passes my simple tests, but there are probably still bugs.  This is
>tricky enough that a good test suite is needed.
>

Well, this is embarrassing.  It fails on ITSELF.  I forgot to reset the
backslash count inside strings when a non-backslash is seen, so for this line:

putchar('\n'); // comment

it didn't remove the comment.

Sigh.

---------------

#include <stdio.h>
#include <stdlib.h>

int     g_ret = 0;

void
eat_quote(int type)
{
        unsigned long long backsl_dcnt;
        int     c;

        backsl_dcnt = 0;
        putchar(type);
        while(1) {
                c = getchar();
                if(c < 0) {
                        g_ret = 1;
                        fprintf(stderr, "File ended during string\n");
                        return;
                }
                putchar(c);
                if(c == '\\') {                 // backslash
                        backsl_dcnt++;
                        continue;
                } else if(c == '\n') {          // newline
                        if(backsl_dcnt) {
                                // \,newline
                                backsl_dcnt--;
                                continue;
                        }
                        g_ret = 1;
                        fprintf(stderr, "String spans multiple lines\n");
                        return;                 // End of line
                } else if(c == type) {
                        if(backsl_dcnt & 1) {
                                // It's escaped, not the end
                                backsl_dcnt = 0;
                                continue;
                        }
                        return;
                }
                backsl_dcnt = 0;
        }
}

int
eat_comment(int type)
{
        int     c, prev_c, got_backslash;

        got_backslash = 0;
        prev_c = 0;
        while(1) {
                c = getchar();
                if(c < 0) {
                        if(type == '*') {
                                g_ret = 1;
                                fprintf(stderr, "Comment unterminated\n");
                                return ' ';
                        }
                        return c;
                }
                if(c == '\\') {
                        // Might be start of \,newline
                        got_backslash = 1;
                        continue;
                }
                if((c == '\n') && got_backslash) {
                        got_backslash = 0;
                        continue;
                }
                if(type == '/') {               // Single-line comment //
                        if(c == '\n') {
                                return c;
                        }
                } else {                        // Multi-line comment /* */
                        if((c == '/') && (prev_c == '*') && !got_backslash) {
                                return ' ';     // End of comment
                        }
                }
                got_backslash = 0;
                prev_c = c;
        }
}

void
output_backsl_newline(unsigned long long dmax)
{
        unsigned long long dcnt;

        putchar('/');
        for(dcnt = 0; dcnt < dmax; dcnt++) {
                putchar('\\');          // \ char
                putchar('\n');          // newline
        }
}

int
maybe_comment()
{
        unsigned long long dcnt;
        int     c, c2;

        // We got a /.  See if next effective char is * or /
        dcnt = 0;
        while(1) {
                c = getchar();
                if(c == '\\') {                 // \
                        // See if it's \,newline
                        c2 = getchar();
                        if(c2 == '\n') {
                                dcnt++;
                                continue;
                        } else {
                                // We got /, \, and something else.
                                output_backsl_newline(dcnt);
                                putchar(c);
                                return c2;
                        }
                } else if((c == '/') || (c == '*')) {
                        return eat_comment(c);
                } else {
                        output_backsl_newline(dcnt);
                        return c;
                }
        }
}

void
start_special(int c)
{
        while(c >= 0) {
                if(c == '"' || c == '\'') {
                        eat_quote(c);
                        return;
                }
                if(c != '/') {          // Nothing special, go back to main
                        putchar(c);
                        return;
                }

                c = maybe_comment();
        }
        // c < 0
        exit(g_ret);
}

int
main(int argc, char **argv)
{
        unsigned char is_special[257];
        int     c;
        int     i;

        for(i = 0; i < 257; i++) {
                is_special[i] = 0;
        }
        is_special['\'' + 1] = 1;       // '
        is_special['"' + 1] = 1;        // "
        is_special['/' + 1] = 1;        // /
        is_special[0] = 1;              // c == -1
        while(1) {
                c = getchar();
                if(is_special[c + 1]) {
                        start_special(c);
                } else {
                        putchar(c);
                }
        }
}

[toc] | [prev] | [next] | [standalone]


#157880

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2020-12-29 19:59 -0800
Message-ID<86mtxwueou.fsf@linuxsc.com>
In reply to#157868
kegs@provalid.com (Kent Dickey) writes:

> In article <kYOdnVyE781WxXbCnZ2dnUU7-cfNnZ2d@giganews.com>,
> Kent Dickey <kegs@provalid.com> wrote:
>
>> Here's my (hopefully last) attempt.
>>
>> Now, I've optimized the main loop so it should be about as fast as
>> possible until a /, ", or ' is seen, then it does the slow
>> processing to get things right until the quote or comment ends.  In
>> the main loop, it's basically if(array[c = getchar()]) putchar(c).
>> If that's not fast enough, you'd have to roll your own
>> putchar()/getchar().
>>
>> It's a different approach--now multiple subroutines call
>> getchar()/putchar().  I like it better in some ways, but I don't
>> love it.
>>
>> It passes my simple tests, but there are probably still bugs.  This
>> is tricky enough that a good test suite is needed.
>
> Well, this is embarrassing.  It fails on ITSELF.  I forgot to reset
> the backslash count inside strings when a non-backslash is seen, so
> for this line:
>
> putchar('\n'); // comment
>
> it didn't remove the comment.
>
> [...]

This latest version matches my reference implementation on
the standard test input I've been using.  Just FYI.

[toc] | [prev] | [next] | [standalone]


#157907

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2020-12-30 09:17 -0800
Message-ID<86eej7usal.fsf@linuxsc.com>
In reply to#156943
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

> Prompted by some recent discussion regarding 'goto' statements and
> state machines, I would like to propose a programming exercise.
> (It is perhaps a bit too large to be called an exercise, but not so
> difficult that it deserves the label of challenge.  On the other
> hand there are some constraints so maybe challenge is apropos.  In
> any case somewhere in between those two bounds.)
>
> Short problem statement:  a C program to remove comments from C
> source input.  [...]

It looks like we are wrapping up.  Thank you to everyone who
participated.

There were 34 posted solutions, from 10 participants.  Those
numbers include one "solution" I posted in one sub-thread,
even though it isn't really in the spirit of the problem since
it folds multiple physical lines into logical lines, and also
reads the entire input into a single character array before
any processing.  But since it was posted I included it.

Counting just the most recent version from each participant, here
are some aggregate statistics:

  81  12.42 11.47 0.95  7.65%  1006 929  77  63.0 58.1  4.8  1598
  ^   ----------------  ^      ------------  --------------  ^
  |   functn averages   |      functn total  body percents   |
  |                     |                                    |
  |                     +-- avg % blank lines/function       |
  |                                                          |
  +-- number of functions     total number of source lines --+

For each of function averages, function total, and body percents,
the three numbers shown measure lines, non-blank lines, and blank
lines, respectively.  The function averages are the average
number of lines in function bodies (of each type) per function.
The function totals are the total number of lines in function
bodies (of each type), of all functions.  The body percents are
the number of lines (of each type) inside function bodies, given
as a percentage of the total number of source lines.

Here are the corresponding statistics for (the most recent version
of) each participant, sorted by total number of source lines:

   5  10.40 10.40 0.00  0.00%    52  52   0  64.2 64.2  0.0    81
   1  88.00 88.00 0.00  0.00%    88  88   0  88.9 88.9  0.0    99
   2  40.00 36.00 4.00 10.00%    80  72   8  73.4 66.1  7.3   109
   2  60.00 51.00 9.00 15.00%   120 102  18  88.2 75.0 13.2   136
   6  18.33 17.17 1.17  6.36%   110 103   7  78.0 73.0  5.0   141
   9  11.33  9.67 1.67 14.71%   102  87  15  72.3 61.7 10.6   141
   4  19.00 16.00 3.00 15.79%    76  64  12  50.0 42.1  7.9   152
   6  22.67 21.67 1.00  4.41%   136 130   6  82.9 79.3  3.7   164
  18   4.44  4.17 0.28  6.25%    80  75   5  35.4 33.2  2.2   226
  28   5.79  5.57 0.21  3.70%   162 156   6  46.4 44.7  1.7   349

(Full disclosure:  the counts may not match exactly the code that
was posted.  The code was uniformly formatted to allow more
meaningful comparisons between the different source files.)

Number of functions ranged from 1 to 28.

Average function length ranged from 4.44 lines to 88 lines.

Percentage of blank lines per function body ranged from 0% to
almost 16%.

Total number of function body lines ranged from 52 to 162.
(The 52 number is from a remarkably compact program.)

Function body lines as a percentage of source lines ranged from
35.4% to 88.9%.

The smallest variation was on function body lines as a percentage
of total source lines (average of 67.97%, std dev 18.51).

The largest variation was on number of functions (average of 8.1,
std dev of 8.53), and average function body lengths (columns two to
four;  using number of average non-blank lines as representative,
average of 25.96 lines, std dev of 26.18 lines).

One further comment:  I did run all of these most recent versions on
a standard test input, but I don't have any kind of statistics on
the results.  In some cases I replied to individual entries with
suggestions for test cases to try, but there was no particular rhyme
or reason to which ones that happened with.  I should be posting
what I consider a reference implementation soon, so if someone is
interested that could be used as a basis for comparison.

I guess that's all.  Thank you all again, it has been very
interesting.

[toc] | [prev] | [next] | [standalone]


#157940

FromAnton Shepelev <anton.txt@gmail.com>
Date2020-12-31 16:54 +0300
Message-ID<20201231165401.0079f4d95a8c7c746de42e91@gmail.com>
In reply to#157907
Tim Rentsch:

> It looks like we are wrapping up.

I am still going to post a version that handles unterminated
literals and block comments.  I don't think I want to check
the correctness of char literals, i.e. that they contain
exactly one character, as that does not seem to be
absolutely required and would mean a mechanical extension of
my state machine.

-- 
()  ascii ribbon campaign -- against html e-mail
/\  http://preview.tinyurl.com/qcy6mjc [archived]

[toc] | [prev] | [next] | [standalone]


#157947

Fromkegs@provalid.com (Kent Dickey)
Date2020-12-31 09:16 -0600
Message-ID<e7Wdnfb3RqikdnDCnZ2dnUU7-XnNnZ2d@giganews.com>
In reply to#157940
In article <20201231165401.0079f4d95a8c7c746de42e91@gmail.com>,
Anton Shepelev  <anton.txt@gmail.com> wrote:
>Tim Rentsch:
>
>> It looks like we are wrapping up.
>
>I am still going to post a version that handles unterminated
>literals and block comments.  I don't think I want to check
>the correctness of char literals, i.e. that they contain
>exactly one character, as that does not seem to be
>absolutely required and would mean a mechanical extension of
>my state machine.
>
>-- 
>()  ascii ribbon campaign -- against html e-mail
>/\  http://preview.tinyurl.com/qcy6mjc [archived]

I think it makes sense to handle malformed input, since "cc -E" does.  No
matter how badly formed the input is, it does not stop on error and produces
something.  I think my rephrased rules capture the rough "cc -E" error
handling (where unterminated strings get terminated at non-escaped newline).

However, "cc -E" does not enforce other C rules.  In fact, it's best if it
doesn't.  Mac C-like languages have multi-character constant support, so
int c = 'abcd'; is defined and supported (they use this as parameters for
some system library calls, where it's the value 0x61626364).

More languages than just C use the cpp.

Kent

[toc] | [prev] | [next] | [standalone]


#157949

FromBart <bc@freeuk.com>
Date2020-12-31 15:56 +0000
Message-ID<OwmHH.1074463$LMma.849831@fx47.ams4>
In reply to#157947
On 31/12/2020 15:16, Kent Dickey wrote:
> In article <20201231165401.0079f4d95a8c7c746de42e91@gmail.com>,
> Anton Shepelev  <anton.txt@gmail.com> wrote:
>> Tim Rentsch:
>>
>>> It looks like we are wrapping up.
>>
>> I am still going to post a version that handles unterminated
>> literals and block comments.  I don't think I want to check
>> the correctness of char literals, i.e. that they contain
>> exactly one character, as that does not seem to be
>> absolutely required and would mean a mechanical extension of
>> my state machine.
>>
>> -- 
>> ()  ascii ribbon campaign -- against html e-mail
>> /\  http://preview.tinyurl.com/qcy6mjc [archived]
> 
> I think it makes sense to handle malformed input, since "cc -E" does.  No
> matter how badly formed the input is, it does not stop on error and produces
> something.  I think my rephrased rules capture the rough "cc -E" error
> handling (where unterminated strings get terminated at non-escaped newline).

This is my view. We're not writing a full C compiler or even a C 
tokeniser. Only a program to remove comments.

If the program is malformed, or not C, or is just text from Shakespeare, 
should not be the concern of this translator.

Brief instructions that input should be well-formed C (pass it through a 
compiler first if necessary) should suffice, if this is to be a real tool.

But the challenge is apparently not about writing a practical tool 
anyway, since the 'model' implementation relies on a compiler 
eliminating recursion in order to produce a version that will not crash 
after 1000 or 2000 lines.

[toc] | [prev] | [next] | [standalone]


Page 13 of 20 — ← Prev page 1 … 11 12 [13] 14 15 … 20  Next page →

Back to top | Article view | comp.lang.c


csiph-web