tldm-universe/Ardent/UV/APP.PROGS/0358

141 lines
3.8 KiB
Plaintext
Raw Permalink Normal View History

2024-09-09 21:51:08 +00:00
subroutine U0358( Resultat, Status, Long )
*******************************************************************************
*
* Saisie de caracteres avec caractere de fin de saisie
*
* Module %M% Version %I% Date %H%
*
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
* This is unpublished proprietary source code of Ardent Software Inc.
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*
*******************************************************************************
*
* Maintenence log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description.........................................
* 10/14/98 23801 SAP Change copyrights.
* 18/18/96 18335 MAA Port release 9 to SNI
* 01/14/91 7930 JWT Added new Ucode for Siemens/Nixdorf
* 11/07/89 - BHX creation du source
* 26/09/89 - HBI Ajout test ECHO ON/OFF
* 10/09/90 - BHX Abandon de PTERM => TTYGET / TTYSET
*
*******************************************************************************
*
$INCLUDE UNIVERSE.INCLUDE TTY
$INCLUDE UNIVERSE.INCLUDE TERMINFO
$INCLUDE UNIVERSE.INCLUDE DEF.USERS
*** validiter de la demande
IF (NOT( NUM( Long )) OR Long < 1 OR Long > 500) THEN
Status = 1
*** demande valide
END
ELSE
UnCarAGauche = KEY.MOVE.CURSOR.LEFT
Status = 0
Resultat = ""
Nombre = 0
TTYGET tty$ ELSE Status = 1 ; RETURN
SAVEICRNL=CRMODE.ICRNL
CRMODE.ICRNL = 0
TTYSET tty$ ELSE Status = 1 ; RETURN
********
debut: *
********
*** saisie d'un caractere quelconque de CHAR(0) a CHAR(255)
Command = KEYIN()
IF CASE.INVERT THEN
*** Inversion upcase/downcase
IF Command >= 'a' AND Command <= 'z' THEN
Command = CHAR(SEQ(Command)-32)
END ELSE
IF Command >= 'A' AND Command <= 'Z' THEN
Command = CHAR(SEQ(Command)+32)
END
END
END
*** test du caractere recu
Flag = 0
BEGIN CASE
*** fleche a droite (^X)
CASE Command = KEY.MOVE.CURSOR.RIGHT
PRINT BELL:
GOTO debut
*** fleche a gauche (^Y, basckspace sans effacement?)
CASE Command = KEY.MOVE.CURSOR.LEFT
Flag = 4
*** backspace (^H)
CASE Command = KEY.BACKSPACE
Flag = 4
*** exec (^J)
CASE Command = Exec
Flag = 1
*** abandon (^N)
CASE Command = Abandon
Flag = 1
*** sortie (^W)
CASE Command = Sortie
Flag = 1
*** vider (^L)
CASE Command = Vider
Flag = 1
*** envoi (^M)
CASE Command = Envoi
Flag = 1
*** fleche en haut (^Z)
CASE Command = KEY.MOVE.CURSOR.UP
Flag = 1
*** fleche en bas (^K)
CASE Command = KEY.MOVE.CURSOR.DOWN
Flag = 1
END CASE
*** si caractere de controle autre que ceux prevu, l'absorber
IF (Command < CHAR(32) OR Command > CHAR(249)) THEN
IF Flag = 0 THEN
Command = ""
END
*** si exec, abandon, sortie, vider, envoi, fleches en haut/bas
IF Flag = 1 THEN
Command = @AM:Command
END
*** si backspace
IF Flag = 4 THEN
Command = ""
IF Nombre # 0 THEN
PRINT UnCarAGauche:" ":UnCarAGauche:
Resultat = Resultat[1,LEN(Resultat)-1]
Nombre = Nombre - 1
END ELSE
PRINT BELL:
END
END
END
*** cumuler le resultat saisi
IF Flag = 0 THEN
*** Test ECHO ON/OFF
ResulImp=""
IF(SYSTEM(24))THEN ResulImp=Command
PRINT ResulImp:
Nombre = Nombre + LEN(Command)
END
Resultat = Resultat:Command
IF Flag = 1 THEN GOTO fin
*** si longueur atteinte faire beep
IF Nombre > Long THEN
Nombre = Nombre - 1
PRINT BELL:
PRINT UnCarAGauche:" ":UnCarAGauche:
Resultat = Resultat[1,LEN(Resultat)-1]
END
GOTO debut
END
*******
fin : *
*******
CRMODE.ICRNL=SAVEICRNL
TTYSET tty$ ELSE Status = 1 ; RETURN
RETURN
END