www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2009/11/11/19:05:12

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=domainkey-signature:mime-version:received:in-reply-to:references
:date:message-id:subject:from:to:content-type;
bh=Hq1yy0gLzqgh/29hbqjYlRqF7fYi9GJAXxrMg+jdVk4=;
b=edAW7RICiRTv4mhT/VNqCsUYf7aAeXAekQZxpX6exhd3HoPx4dDi3hIS796EBDspLT
B7wgc/4kQBD16WPBzj/Vq+gyo7n/SatGbCdMjc0sNbEMDxWV41aWCIXhNAJ+xaRdEom2
yqPuIJIMQgzT9gX6gvW+eq28gs1HldjbuTEc0=
DomainKey-Signature: a=rsa-sha1; c=nofws;
d=gmail.com; s=gamma;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
b=aknlQeJ5KYooNaLqSwLc8Q5wRfu1irpMuxVEt9W7OVE7PZC07ZSxIUJY/sLpVzR+As
DDDPWKsNGNaWxdGuvtD8WZLsGiRuqjBTAPA71Sb17J7/IEAj4Nkq/C5zwRDRsMa4+uPT
QC3ET8nsJVamtqpbh8hlZ4eOvcQHZ3ZhOtZ2I=
MIME-Version: 1.0
In-Reply-To: <b7e3b865-abbc-4ee7-a29a-88239153ad80@k17g2000yqh.googlegroups.com>
References: <0008cd2e-63c9-43cb-82d4-11aece7c209f AT c3g2000yqd DOT googlegroups DOT com>
<200911100429 DOT nAA4T6BM021619 AT envy DOT delorie DOT com>
<b74a4c40-3d78-4952-98b0-ff9777f0594d AT p35g2000yqh DOT googlegroups DOT com>
<200911102010 DOT nAAKAxKI006111 AT envy DOT delorie DOT com>
<ebf65bf7-5445-44cc-a73f-7dd40fbe49d3 AT v30g2000yqm DOT googlegroups DOT com>
<hddtej$g02$1 AT aioe DOT org>
<b7e3b865-abbc-4ee7-a29a-88239153ad80 AT k17g2000yqh DOT googlegroups DOT com>
Date: Wed, 11 Nov 2009 17:59:44 -0600
Message-ID: <93c172b50911111559t37cfbc6p5b9063354fa90dab@mail.gmail.com>
Subject: Re: GAS ".code16" and DJASM quirks ...
From: Rugxulo <rugxulo AT gmail DOT com>
To: djgpp-workers AT delorie DOT com
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

Okay, here's a small context diff against DJASM with Martin's
suggestions (and it works, too):


*** tony_y.bk2	Tue Nov 10 21:26:58 2009
--- martin.y	Wed Nov 11 17:51:16 2009
***************
*** 15,20 ****
--- 15,21 ----
  #include <time.h>
  #include <ctype.h>
  #include <unistd.h>
+ #include <limits.h> /* INT_MAX */
  #ifndef O_BINARY
  #define O_BINARY 0
  #endif
***************
*** 2335,2341 ****
  {
    int c, c2, i, oldc;
    struct opcode *opp, op;
!   char str[33], str2[33];

    do {
      c = fgetc(infile);
--- 2336,2349 ----
  {
    int c, c2, i, oldc;
    struct opcode *opp, op;
!
!
! #define STRMAX 32
! #define CHARS "0-9a-fA-FhHxX"
!   char str [STRMAX+1+1],  /* 1 for NUL, 1 for 'h' -> "0x" transformation */
!        str2[STRMAX+1+1];
!   char format[1 + sizeof(INT_MAX) + 1 + sizeof(CHARS) + 1 + 1];
!

    do {
      c = fgetc(infile);
***************
*** 2454,2471 ****
  	    }
          }
      #else
        ungetc(c, infile);

!       fscanf(infile, "%[0-9a-fA-FhHxX]",str);

        if (str[strlen(str)-1] == 'h' || str[strlen(str)-1] == 'H')
        {
!         str[strlen(str)-1]='\0';
!         strcpy(str2,"0x");
!         strcat(str2,str);
!         strcpy(str,str2);
        }
!       sscanf(str, "%i", &(yylval.i));


      #endif
--- 2462,2483 ----
  	    }
          }
      #else
+
        ungetc(c, infile);
+       /* fscanf(infile, "%i", &(yylval.i)); */
+

!       sprintf(format, "%%%d[%s]", STRMAX, CHARS);
!       fscanf(infile, format, str);
!       strcpy(str2,str);

        if (str[strlen(str)-1] == 'h' || str[strlen(str)-1] == 'H')
        {
!         sprintf(str2, "0x%s", str);
!         str2[strlen(str2)-1]='\0';
        }
!
!       sscanf(str2, "%i", &(yylval.i));


      #endif



On Wed, Nov 11, 2009 at 3:50 PM, Rugxulo <rugxulo AT gmail DOT com> wrote:
>
> Hey guys, is this a better place to discuss this (DJASM hacks/
> improvements)?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019