h35759
s 00088/00000/00000
d D 1.1 83/03/23 16:15:15 bog 1 0
c date and time created 83/03/23 16:15:15 by bog
e
u
4
U
t
T
I 1
#############################################################################
#									    #
#	This material is confidential and is furnished under		    #
#	a written license agreement.  It may not be used,		    #
#	copied or disclosed to others except in accordance		    #
#	with the terms of that agreement.				    #
#									    #
#	Copyright (C) 1982 Graphic Software Systems, Inc.		    #
#	All rights reserved.						    #
#									    #
#############################################################################
#									    #
#	Function:  							    #
#		CHARACTER Funtion EmAPut(Ch)				    #
#			Input	Ch:	ADE integer Ascii code to be	    #
#					displayed			    #
#			Output	EmAPut:	CHARACTER number of characters	    #
#					actually displayed		    #
#		    Display a character or its name if BS, HT, LF, CR, ESC, #
#		    SP or DEL or ^<char> if other control character	    #
#		    or "n" if not in the range [NUL..DEL]		    #
#									    #
#	Called By:							    #
#									    #
#	Routines Called:						    #
#									    #
#############################################################################
 
CHARACTER Function EmAPut(Ch)
CHARACTER Ch
 
CHARACTER C
INTEGER I
 
CHARACTER CSw(34),Name(23)
 
INTEGER EmMStr			# Show string; return length
External EmMStr
 
CHARACTER EmNPut		# Show number; return length
External EmNPut
 
BEGINCOMMON
COMMON(SPECIALKEYS)
ENDCOMMON
 
Data	CSw/8*0,1,4,7,2*0,10,13*0,13,4*0,17,20/
Data	Name/	UPB,UPS,0,
		UPH,UPT,0,
		UPL,UPF,0,
		UPC,UPR,0,
		UPE,UPS,UPC,0,
		UPS,UPP,0,
		UPD,UPE,UPL,0/
 
C = Ch				# Local variable can get assigned
 
If ((C >= NUL) & (C <= DEL)) {	# Valid Ascii?
  If ((C <= SPACE) | (C == DEL)) {# Control character
    If (C == DEL) {		# If a Del
      C = eval(SPACE+1)		#  make it one bigger than space
      }
    If (CSw(C+1) == 0) {	# Normal control character
      If (Going) {		# Not at init
	Call EmAsci(UPARROW)	# Poop out "^<char>"
	Call EmAsci(C+AT)
	}
      EmAPut = 2		# Two characters
      }
     Else {
      C = CSw(C+1)		# Point to first character of name
      EmAPut = EmMStr(Name(C))	# Show name of character
      }
    }
   Else {			# Not a control character
    If (Going) Call EmAsci(C)	#  so poop it out
    EmAPut = 1			# Only put out 1 character
    }
  }
 Else {			# Not Ascii
  If (Going) Call EmAsci(DOUBLEQUOTE)	# Bracket with ""
  I = C
  EmAPut = EmNPut(I)+2		# Poop out a number; return length
  If (Going) Call EmAsci(DOUBLEQUOTE)	# Close brackets
  }
 
Return
End
E 1
