File:  [Coherent Logic Development] / freem / mlib / %TUIMENU.m
Revision 1.2: download - view: text, annotated - select for diffs
Mon Mar 10 00:38:15 2025 UTC (3 weeks, 1 day ago) by snw
Branches: MAIN
CVS tags: v0-62-3, v0-62-2, v0-62-1, v0-62-0, HEAD
Phase 3 of REUSE compliance and header reformatting

%TUIMENU ;VCL/SNW-FREEM MENU HANDLER; 03/09/2025 06:26 PM
    ;0.0;FreeM;****FREEM**;Serena Willis @2025
    ;
    ;   $Id: %TUIMENU.m,v 1.2 2025/03/10 00:38:15 snw Exp $
    ;    FreeM Menu Handler
    ;
    ;  
    ;   Author: Serena Willis <snw@coherent-logic.com>
    ;    Copyright (C) 1998 MUG Deutschland
    ;    Copyright (C) 2023, 2025 Coherent Logic Development LLC
    ;
    ;
    ;   This file is part of FreeM.
    ;
    ;   FreeM is free software: you can redistribute it and/or modify
    ;   it under the terms of the GNU Affero Public License as published by
    ;   the Free Software Foundation, either version 3 of the License, or
    ;   (at your option) any later version.
    ;
    ;   FreeM is distributed in the hope that it will be useful,
    ;   but WITHOUT ANY WARRANTY; without even the implied warranty of
    ;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ;   GNU Affero Public License for more details.
    ;
    ;   You should have received a copy of the GNU Affero Public License
    ;   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
    ;
    ;   $Log: %TUIMENU.m,v $
    ;   Revision 1.2  2025/03/10 00:38:15  snw
    ;   Phase 3 of REUSE compliance and header reformatting
    ;
    ;
    ; SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
    ; SPDX-License-Identifier: AGPL-3.0-or-later
    Q
GO(S,I) ;
    N %,C,DS,OPT S (%,OPT)=""
    D DISP(S,I)
NXT S DS=1 W "Select ",$$G^%DB(S,I,"NAME")," Option//",$$G^%DB(S,I,"DEFAULT")," "
    R %
    I (%="q")!(%="Q") W " Quit",! Q
    I %="?" D DISP(S,I) G NXT
    S:%="" %=$$G^%DB(S,I,"DEFAULT"),DS=0
    S %=$TR(%,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    S:'$D(@S@(I,"OPTS",%)) %=""
    I %="" W !,"Invalid selection. Press ? to view all options.",! G NXT
    W:DS " " W @S@(I,"OPTS",%)
    I ('$D(@S@(I,"ACT",%)))&('$D(@S@(I,"TAG",%))) W !,"No action or tag defined for ",%,".",! G NXT
    K %TAG I $D(@S@(I,"TAG",%)) S %TAG=@S@(I,"TAG",%)
    I $D(@S@(I,"ACT",%)) S C="D "_@S@(I,"ACT",%) X C K C G NXT
    Q
DISP(S,I) ;
    N % S %=""
    W !,$$G^%DB(S,I,"DESC")," - ",$$G^%DB(S,I,"NAME"),!,!
    F  S %=$O(@S@(I,"OPTS",%)) Q:%=""  D
    . W "  ",%,") ",@S@(I,"OPTS",%),!
    W !,"  Q) Quit",!,!
    Q
    

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>