Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!inria!mirsa!lemur.inria.fr!vincent From: vincent@lemur.inria.fr (Vincent Bouthors) Newsgroups: comp.windows.x Subject: R5 wish: Enable nested strings in action parameters of translation table Keywords: toolkit, string, translation table Message-ID: <8941@mirsa.inria.fr> Date: 31 Oct 90 13:07:41 GMT Sender: news@mirsa.inria.fr Reply-To: vincent@lemur.inria.fr (Vincent Bouthors) Organization: Koala Project, Bull Research France Lines: 74 Description: ----------- In translation table, action parameters are strings. It is possible to put in them an expression to evaluate with the appropriate interpretor. eg: : 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: : ExecuteC("DisplayMessage(\"Hello world\");") \n\ In fact, the resource manager treats '\'. So it is necessary to protect '\' character inserting another '\'. eg: : ExecuteC("DisplayMessage(\\"Hello world\\");") \n\ Proposal: Modification of format described in Appendix B -------- Today it is writen: quoted_string = """ { } """ But we should understand: quoted_string = """ { } """ And here is my proposal: quoted_string = """ { | "\"" } """ 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -