From 63094771a3c40f1f291edb2272d917c1f8ab81e8 Mon Sep 17 00:00:00 2001 From: slade_rich Date: Mon, 20 Jun 2005 01:42:03 +0000 Subject: [PATCH] Fixed problem when a string constant contains a "\\r\\n" and the output asm file line is printed on two lines. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3783 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/pic/pcode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pic/pcode.c b/src/pic/pcode.c index bded0a75..fcc80b32 100644 --- a/src/pic/pcode.c +++ b/src/pic/pcode.c @@ -2439,6 +2439,7 @@ pCodeOp *newpCodeOp(char *name, PIC_OPTYPE type) void pCodeConstString(char *name, char *value) { pBlock *pb; + unsigned i; // fprintf(stderr, " %s %s %s\n",__FUNCTION__,name,value); @@ -2450,6 +2451,15 @@ void pCodeConstString(char *name, char *value) addpBlock(pb); sprintf(buffer,"; %s = %s",name,value); + for (i=strlen(buffer); i--; ) { + unsigned char c = buffer[i]; + if (c=='\r' || c=='\n') { + memmove(buffer+i+1,buffer+i,strlen(buffer)-i+1); + buffer[i] = '\\'; + if (c=='\r') buffer[i+1] = 'r'; + else if (c=='\n') buffer[i+1] = 'n'; + } + } addpCode2pBlock(pb,newpCodeCharP(buffer)); addpCode2pBlock(pb,newpCodeLabel(name,-1)); -- 2.30.2