From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 23-JUN-1993 11:13:51.47
To:	EVERHART
CC:	
Subj:	Summary: Callable F$EDIT

X-Newsgroups: comp.os.vms
Subject: Summary: Callable F$EDIT
Message-Id: <1993Jun22.084752.890@iwsd01.itwol.bhp.com.au>
From: webosk@itwol.bhp.com.au (Ken Bosward)
Date: 22 Jun 93 08:47:52 +1000
Organization: BHP Information Technology
Lines: 76
To: Info-VAX@kl.sri.com
X-Gateway-Source-Info: USENET

Thanks to all those who responded re a "callable F$EDIT" routine. Most
people drew my attention to the BASIC built-in EDIT. Thanks to:

  frisch@zams.kapsch.co.at (Martin Frischherz)
  BRENNAN@CCHS.SU.EDU.AU (Luke Brennan)
  "B. Z. Lederman" <LEDERMAN@Eisner.DECUS.Org>
  GVROD@ISUVAX.IASTATE.EDU (rod eldridge)
  simons/G=Colin/S=Sewell/O=H.A.Simons.Ltd/OU=PACIFIC@mhs.attmail.com

I have enclosed mail from Bart Lederman for your information.

--------------------------------------------------------------------------
    I have only read-only access to NEWS, so you may want to post
 this as a followup for everyone.

    While there is no STR$ routine to do what you want, there is,
 fortunately, such a routine built in to the BASIC Run Time
 Library.  Since this is part of the VMS operating system,
 everyone has it.  It does everything that F$EDIT does, plus more. 
 I've published instructions on how to use it in the (now defunct)
 DECUS Newsletter, and it's also on various DECUS Library tapes.

    But it's fairly easy to use.  The following is the header file
 I wrote to define the function for C programs, which I call
 BAS$EDIT.H

#ifndef __BAS$EDIT_LOADED
#define __BAS$EDIT_LOADED	1
#endif

/*
   Define a prototype and values for the VAX/BASIC EDIT$ function.

   The EDIT$ function performs one or more string editing functions,
   depending on the value of its integer argument.

   Example (in BASIC)

   New_string$ = EDIT$(Old_string$, 48%)

   Example (in C)

   (void) BAS$EDIT (&New_String, &Old_String, Edit-Exp);

   New_String and Old_String are string descriptors passed by address
   (reference).

   Edit-Exp is an integer value specifying one or more edit actions
   from the set listed below, which can be ANDed together.

   There does not appear to be a return status to check.

   All of the definitions here are my own and NOT Digital's.

   Bart Z. Lederman	15-Jun-1992
*/

void BAS$EDIT ();

/*			Values		Effect				*/

#define BAS$M_NOPARITY	1	/* Trim parity bits			*/
#define BAS$M_COLLAPSE	2	/* Discard all spaces and tabs		*/
#define BAS$M_DISFORM	4	/* Discard characters: CR, LF, FF, ESC,	*/
				/* RUBOUT, and NULL			*/
#define BAS$M_DISLEAD	8	/* Discard leading spaces and tabs	*/
#define BAS$M_COMPRESS	16	/* Reduce spaces and tabs to one space	*/
#define BAS$M_UPCASE	32	/* Convert lowercase to uppercase	*/
#define BAS$M_BRACKET	64	/* Convert [ to ( and ] to )		*/
#define BAS$M_DISTRAIL	128	/* Discard trailing spaces and tabs	*/
#define BAS$M_KEEPQUOTE	256	/* Do not alter characters inside	*/
				/* quotes				*/
--------------------------------------------------------------------------

Ken Bosward, BHP Information Technology, Wollongong. Australia.
E-mail: webosk@itwol.bhp.com.au

