[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [UNIKRAFT/APPHELLOWORLD PATCH 3/6] Monkey animation



Hi Simon,

This patch looks good.

Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>

On Mon, Sep 14, 2020 at 3:49 PM Simon Kuenzer <simon.kuenzer@xxxxxxxxx> wrote:
>
> Replaces the fish animation with an animated 3-liner ASCII
> monkey.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
> ---
>  main.c   |  30 +++-------
>  monkey.h | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 189 insertions(+), 21 deletions(-)
>  create mode 100644 monkey.h
>
> diff --git a/main.c b/main.c
> index 4d4210e..5b07817 100644
> --- a/main.c
> +++ b/main.c
> @@ -1,5 +1,4 @@
>  #include <stdio.h>
> -#include <uk/essentials.h>
>
>  /* Import user configuration: */
>  #include <uk/config.h>
> @@ -7,21 +6,7 @@
>  #if CONFIG_APPHELLOWORLD_SPINNER
>  #include <time.h>
>  #include <errno.h>
> -
> -static const char *spinner[] = {
> -       ">))'>        ",
> -       " >))'>       ",
> -       "  >))'>      ",
> -       "   >))'>     ",
> -       "    >))'o    ",
> -       "     >))'>°  ",
> -       "     <'((< ° ",
> -       "    <'((<   '",
> -       "   <'((<     ",
> -       "  <'((<      ",
> -       " <'((<       ",
> -       "<'((<        ",
> -};
> +#include "monkey.h"
>
>  static void millisleep(unsigned int millisec)
>  {
> @@ -53,11 +38,14 @@ int main(int argc, char *argv[])
>
>  #if CONFIG_APPHELLOWORLD_SPINNER
>         i = 0;
> -       printf("\n");
> -       while (1) {
> -               i %= ARRAY_SIZE(spinner);
> -               printf("\r%s", spinner[i++]);
> -               millisleep(1000);
> +       printf("\n\n\n");
> +       for (;;) {
> +               i %= (monkey3_frame_count * 3);
> +               printf("\r\033[2A %s \n", monkey3[i++]);
> +               printf(" %s \n",          monkey3[i++]);
> +               printf(" %s ",            monkey3[i++]);
> +               fflush(stdout);
> +               millisleep(250);
>         }
>  #endif /* CONFIG_APPHELLOWORLD_SPINNER */
>  }
> diff --git a/monkey.h b/monkey.h
> new file mode 100644
> index 0000000..36c65b0
> --- /dev/null
> +++ b/monkey.h
> @@ -0,0 +1,180 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Unikraft Monkey Animation
> + *
> + * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
> + *
> + *
> + * Copyright (c) 2020, NEC Laboratories Europe GmbH, NEC Corporation.
> + *                     All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
> IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#ifndef MONKEY_H
> +#define MONKEY_H
> +
> +#ifndef ARRAY_SIZE
> +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> +#endif /* ARRAY_SIZE */
> +
> +static const char *monkey3[] = {
> +       "     _               ",
> +       "   c'_'o  .--'       ",
> +       "   (| |)_/           ",
> +
> +       "     _               ",
> +       "   c'o'o  .--.       ",
> +       "   (| |)_/           ",
> +
> +       "     _               ",
> +       "   c'_'o  .-.        ",
> +       "   (| |)_/   `       ",
> +
> +       "     _               ",
> +       "   c'o'o  .--.       ",
> +       "   (| |)_/           ",
> +
> +       "     _               ",
> +       "   c'_'o  .--'       ",
> +       "   (| |)_/           ",
> +
> +       "     _               ",
> +       "   c'_'o  .--.       ",
> +       "   (| |)_/           ",
> +
> +       "     _               ",
> +       "   c'_'o  .-.        ",
> +       "   (| |)_/   `       ",
> +
> +       "     _               ",
> +       "   c'_'o  .--.       ",
> +       "   (| |)_/           ",
> +
> +       "     _               ",
> +       "   c-_-o  .--'       ",
> +       "   (| |)_/           ",
> +
> +       "     _               ",
> +       "   c'_'o  .--.       ",
> +       "   (| |)_/           ",
> +
> +       "     _               ",
> +       "   c'_'o  .-.        ",
> +       "   (| |)_/   `       ",
> +
> +       "     _               ",
> +       "   c'_'o  .--.       ",
> +       "   (| |)_/           ",
> +
> +       ".---    _            ",
> +       "`--,___c \".          ",
> +       "   (,--( \\           ",
> +
> +       ".--      _           ",
> +       "`---,___c \".         ",
> +       "    ( \\-(,           ",
> +
> +       ".-        _          ",
> +       "`---'\\___c \".        ",
> +       "     (,--( \\         ",
> +
> +       ".    _     _         ",
> +       "`---' \\___c \".       ",
> +       "      ( \\-(,         ",
> +
> +       "     _      _        ",
> +       "`---' `,___c \".      ",
> +       "       (,--( \\       ",
> +
> +       "     _       _       ",
> +       " ---' `-,___c \".     ",
> +       "        ( \\-(,       ",
> +
> +       "     _        _      ",
> +       "  --' `--,___c \".    ",
> +       "         (,--( \\     ",
> +
> +       "     _         _     ",
> +       "   -' `---,___c \".   ",
> +       "          ( \\-(,     ",
> +
> +       "     _          _    ",
> +       "    ' `---'\\___c \".  ",
> +       "           (,--( \\   ",
> +
> +       "     _     _     _   ",
> +       "      `---' \\___c \". ",
> +       "            ( \\-(,   ",
> +
> +       "           _    _    ",
> +       "      `---' | c   o  ",
> +       "            \\_(|,|)  ",
> +
> +       "             _  .---.",
> +       "           .\" o___,-'",
> +       "            / )--,)  ",
> +
> +       "            _    ---.",
> +       "          .\" o___,--'",
> +       "            ,)-/ )   ",
> +
> +       "           _      --.",
> +       "         .\" o___,---'",
> +       "          / )--,)    ",
> +
> +       "          _        -.",
> +       "        .\" o___/`---'",
> +       "          ,)-/ )     ",
> +
> +       "         _     _    .",
> +       "       .\" o___/ `---'",
> +       "        / )--,)      ",
> +
> +       "        _      _     ",
> +       "      .\" o___,' `---'",
> +       "        ,)-/ )       ",
> +
> +       "       _       _     ",
> +       "     .\" o___,-' `--- ",
> +       "      / )--,)        ",
> +
> +       "      _        _     ",
> +       "    .\" o___,--' `--  ",
> +       "      ,)-/ )         ",
> +
> +       "     _         _     ",
> +       "   .\" o___,---' `-   ",
> +       "     / )-,)          ",
> +
> +       "    _          _     ",
> +       "  .\" o___,----' `    ",
> +       "    ,)-/ )           ",
> +};
> +
> +#define monkey3_frame_count (ARRAY_SIZE(monkey3) / 3)
> +
> +#endif /* MONKEY_H */
> --
> 2.20.1
>
>



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.