;;; -*- Mode:COMMON-LISP; Package:X11; Base:10.; Fonts:(MEDFNB hl12B hl12bi) -*-

;;;                           RESTRICTED RIGHTS LEGEND

;;;Use, duplication, or disclosure by the Government is subject to
;;;restrictions as set forth in subdivision (b)(3)(ii) of the Rights in
;;;Technical Data and Computer Software clause at 52.227-7013.
;;;
;;;                     TEXAS INSTRUMENTS INCORPORATED.
;;;                              P.O. BOX 2909
;;;                           AUSTIN, TEXAS 78769
;;;                                 MS 2151
;;;
;;; Copyright (C) 1987, Texas Instruments Incorporated. All rights reserved.

;;; Change history:
;;;
;;;  Date       Author	Description
;;; -------------------------------------------------------------------------------------
;;;  9/09/88	LGO	Keep List-Extensions out of the error handler
;;;  9/09/88	LGO	Eliminate duplicate function definitions for query-extension-request
;;;			and list-extensions-request
;;;  9/09/88	LGO	Call query-extension with the correct number of arguments
;;;  5/12/88	DAN	Added EXTENSION-EVENT-BASE, EXTENSION-BASE, NEXT-EXTENSION-EVENT.
;;;  4/15/88	KDB	Implemented QUERY-EXTENSION and LIST-EXTENSIONS requests.
;;; 12/15/87    TWE	Moved requests from the REQUESTS file.

        
(defreq Query-Extension ((nbytes CARD16)
			 (:byte nbytes))

 (QUERY-EXTENSION STATE NBYTES BYTES 0))

(DEFUN QUERY-EXTENSION (STATE NUM-BYTES BYTES BYTE-OFFSET)
  #|  
	name: STRING8
    =>
	present: BOOL
	major-opcode: CARD8
	first-event: CARD8
	first-error: CARD8

	Determines if the named extension is present.  If so, the major opcode
	for the extension is returned, if it has one, otherwise zero is
	returned.  Any minor opcode and the request formats are specific to the
	extension.  If the extension involves additional event types, the base
	event type code is returned, otherwise zero is returned.  The format of
	the events is specific to the extension.  If the extension involves
	additional error codes, the base error code is returned, otherwise
	zero is returned.  The format of additional data in the errors is
	specific to the extension.

	The extension name should use the ISO Latin-1 encoding, and upper/lower
	case matters.
  |#

  (LET ((NAME (BYTES-TO-STRING BYTES NUM-BYTES BYTE-OFFSET))
	(PRESENT 0)
	(MAJOR-OPCODE 0)
	(FIRST-EVENT 0)		       ; 
	(FIRST-ERROR  0))
    (declare (ignore name))
    
    (FORMAT-REPLY (STATE  0)
		  :BYTE  PRESENT
		  :BYTE MAJOR-OPCODE
		  :BYTE FIRST-EVENT       
		  :BYTE FIRST-ERROR)))


(defreq List-Extensions ()
  (LIST-EXTENSIONS STATE BYTE-OFFSET LENGTH))
  
(DEFUN LIST-EXTENSIONS (STATE BYTE-OFFSET LENGTH)
 "    =>
	names: LISTofSTRING8

	Returns a list of all extensions supported by the server."
  (DECLARE (IGNORE BYTE-OFFSET LENGTH))
    (FORMAT-REPLY (STATE )
		  :BYTE 0))
