[comp.windows.x] R5 wish: Enable nested strings in action parameters of translation table

vincent@lemur.inria.fr (Vincent Bouthors) (10/31/90)

Description:
-----------

In translation table, action parameters are strings.  It is possible to put
in them an expression to evaluate with the appropriate interpretor.  eg:
<Btn1Down>:      ExecuteC("MapWidget(shell3);")  \n\

The problem is that it is not possible, today, to use the quote character
to delimit a string litteral.  It seems rather raisonable to provide an
escape sequence to do that.  eg:
<Btn1Down>:	 ExecuteC("DisplayMessage(\"Hello world\");")  \n\

In fact, the resource manager treats '\'.  So it is necessary to 
protect '\' character inserting another '\'.  eg:
<Btn1Down>:	 ExecuteC("DisplayMessage(\\"Hello world\\");")  \n\


Proposal: Modification of format described in Appendix B
--------

Today it is writen:
  quoted_string =
      """ { <Latin 1 character> } """

But we should understand:
  quoted_string =
      """ { <Latin 1 character except """> } """

And here is my proposal:
  quoted_string = 
      """ { <Latin 1 character except """, "\"> | "\"" } """

  description: the two characters '\' '"' are placed unchanged in the
  quoted string.  


Code: This is a very simple modification.
----

File:  	  TMparse.c
Function: ParseString

***************
*** 1550,1556 ****
      if (*str == '"') {
        str++;
        start = str;
!       while (*str != '"' && *str != '\0' && *str != '\n') str++;
        *strP = strncpy(XtMalloc((unsigned)(str-start+1)), start, str-start);
        (*strP)[str-start] = '\0';
        if (*str == '"') str++; else
--- 1550,1562 ----
      if (*str == '"') {
        str++;
        start = str;
!       while (*str != '"' && *str != '\0' && *str != '\n') {
!           if (*str == '\\') {  
!               str++;
!               if (*str != '\0' && *str != '\n') str++;
!           }
!             str++;
!         }
        *strP = strncpy(XtMalloc((unsigned)(str-start+1)), start, str-start);
        (*strP)[str-start] = '\0';
        if (*str == '"') str++; else


-- 
Vincent BOUTHORS                     e-mail: Vincent.Bouthors@mirsa.inria.fr
BULL research center c/o INRIA        phone: 93.65.78.15
2004 route des lucioles               telex: 960050F
06565 VALBONNES cedex                   fax: 93.65.77.66
FRANCE
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - -