X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com MIME-Version: 1.0 Date: Wed, 11 Nov 2009 13:50:55 -0800 (PST) In-Reply-To: X-IP: 65.13.115.246 References: <0008cd2e-63c9-43cb-82d4-11aece7c209f AT c3g2000yqd DOT googlegroups DOT com> <200911100429 DOT nAA4T6BM021619 AT envy DOT delorie DOT com> <200911102010 DOT nAAKAxKI006111 AT envy DOT delorie DOT com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe) Message-ID: Subject: Fwd: GAS ".code16" and DJASM quirks ... From: Rugxulo To: djgpp-workers AT delorie DOT com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Hey guys, is this a better place to discuss this (DJASM hacks/ improvements)? ---------- Forwarded message ---------- From: Martin Str|mberg Date: Nov 11, 2:42=A0am Subject: GAS ".code16" and DJASM quirks ... To: comp.os.msdos.djgpp Rugxulo wrote: > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > *** tony_y.bk1 =A0 =A0 Tue Nov 10 17:37:22 2009 > --- tony.y Tue Nov 10 21:26:58 2009 > *************** > *** 2335,2340 **** > --- 2335,2341 ---- > =A0 { > =A0 =A0 int c, c2, i, oldc; > =A0 =A0 struct opcode *opp, op; > + =A0 char str[33], str2[33]; No. #define MAX 32 #define CHARS "0-9a-fA-FhHxX" char str[MAX+1+1], ... /* One for nul and one for "h"->"0x" transformation. */ char format[1+ sizeof("2147483647") /* INT_MAX */ +1+ sizeof(CHARS) +1+1]; sprintf(format "%%%d[%s]", MAX, CHARS); /* Possibly error handling here too. */ > ! =A0 =A0 =A0 fscanf(infile, "%[0-9a-fA-FhHxX]",str); fscanf(infile, format, str); > ! > ! =A0 =A0 =A0 if (str[strlen(str)-1] =3D=3D 'h' || str[strlen(str)-1] =3D= =3D 'H') > ! =A0 =A0 =A0 { > ! =A0 =A0 =A0 =A0 str[strlen(str)-1]=3D'\0'; > ! =A0 =A0 =A0 =A0 strcpy(str2,"0x"); > ! =A0 =A0 =A0 =A0 strcat(str2,str); Why not sprintf(str2, "0x%s", str)? /* Again some proper size! */ > ! =A0 =A0 =A0 =A0 strcpy(str,str2); > ! =A0 =A0 =A0 } > ! =A0 =A0 =A0 sscanf(str, "%i", &(yylval.i)); > ! > ! > =A0 =A0 =A0 #endif > =A0 =A0 =A0 =A0 sprintf(last_token, "%d", yylval.i); > =A0 =A0 =A0 =A0 return NUMBER; > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Thanks! MartinS