;
; vString.sh
;
; Parses validation strings for Sculptrix
;
;  1995-1998 Straylight
;

;----- Licensing note -------------------------------------------------------
;
; This file is part of Straylight's Sculptrix.
;
; Sculptrix is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2, or (at your option)
; any later version.
;
; Sculptrix 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 General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with Sculptrix.  If not, write to the Free Software Foundation,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

;----- Overview -------------------------------------------------------------
;
; Functions provided:
;
;  vString_read
;  vString_find

		[	:LNOT::DEF:vString__dfn
		GBLL	vString__dfn

; --- vString_read ---
;
; On entry:	R1 == pointer to an icon block
;
; On exit:	CS if there's a border, and
;		  R0 == border info word
;		  R2 == pointer to `inverted' flag byte
;		else CC and
;		  R0, R2 preserved
;
; Use:		Reads an icon's validation string, and extracts relevant
;		information.  The border info word contains what sort of
;		graphics we have to plot around the icon, and any special
;		options thrown in.  A string (for group borders etc.) is
;		copied into the misc buffer if one was found.
;
;		The syntax of a Sculptrix validation string is as follows:
;
;		  `xb'<type>[<flags>][`,'<text>]
;
;		The <type> is a letter which determines what sort of border
;		is to be drawn.  The <flags> modify the style of the border
;		slightly.  Note that if the <type> is uppercase, then the
;		border is inverted.  The <text> is only required for group
;		boxes (type `g').  An unknown <type> causes the icon to be
;		ignored.  Unknown <flags> are ignored.  If no text is
;		specified, a null string is assumed by default.  Spaces
;		are allowed in various sensible places.

		IMPORT	vString_read

; --- vString_find ---
;
; On entry:	R0 == character to find in block (not case-sensitive)
;		R1 == pointer to icon block
; 		R2 == old pointer to search from, or 0
;
; On exit:	R0 == character forced to lower case
;		CS if found, and
;		  R2 points to command string
;		else CC and
;		  R2 corrupted
;
; Use:		Tries to find a validation string command in the given
;		icon block.

		IMPORT	vString_find

;----- Border codes and flags -----------------------------------------------

		^	0
vsCode_simple	#	&0100			;A simple border
vsCode_group	#	&0100			;A group box border
vsCode_tns	#	&0100			;Text+sprite icon

		^	0
vsBrd_action	#	1			;Standard action button
vsBrd_default	#	1			;Default action button
vsBrd_ridge	#	1			;A ridge type border
vsBrd_write	#	1			;A writable border
vsBrd_offset	#	1			;Offset pressed-in border

vsFlag_invert	EQU	(1<<31)			;Icon border is inverted
vsFlag_fade	EQU	(1<<30)			;Icon border is faded
vsFlag_slab	EQU	(1<<29)			;Icon may be slabbed

		]

;----- That's all, folks ----------------------------------------------------

		END
