🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: vmsnet.sources
Article #37

Miscellaneous SDLGCC patches, part 01/01

#37
From: Dick Munroe
Date: Fri, 21 Aug 1992 19:37
312 lines
10758 bytes
Submitted-by: munroe@dmc.com (Dick Munroe)
Posting-number: Volume 3, Issue 108
Archive-name: sdlgcc/patch1_01
Patch-to: sdlgcc: Volume 1, Issue 102-103

         [ This submission contains three patches to SDLGCC.  These
           patches must be applied using the unix-like patch utility
           available from the vmsnet.sources archives, not the VMS
           PATCH utility.

           Patch1a - is a patch to SDLGCC that fixes a minor bug in
           the IFDEF generation for multiple includes.

           Patch1b - is a patch to fix a bug in the generation of
           arrays of structures within structures.

           Patch1c - allows SDLGCC to correctly generate string
           constants as #define statements.

           These patches must be applied in order. ]

Dick Munroe
Doyle, Munroe Consultants, Inc.
267 Cox St.
Hudson, Ma. 01749
(508) 568-1618
(FAX) (508) 562-1133
munroe@dmc.com
$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.2-010  25-Jun-1992
$!   On 21-AUG-1992 12:27:54.11   By user BERRYMAN 
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. PATCH1A.DIFF;1
$!       2. PATCH1B.DIFF;1
$!       3. PATCH1C.DIFF;1
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ ve=f$getsyi("version")
$ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ x = P1 - f$parse(P1,,,"version")
$ y = f$search(x)
$ if y .eqs. "" then $ goto file_absent
$ x = f$integer(f$parse(P1,,,"version")-";")
$ y = f$integer(f$parse(y,,,"version")-";")
$ if x .gt. y then $ goto file_absent
$ if f$mode() .eqs. "INTERACTIVE" then $ goto file_interactive
$ if x .eq. y then e "-W-EXISTS, File ''P1' exists. Skipped."
$ if x .ne. y then e "-W-NEWERVERSION, of File ''P1' exists. Skipped."
$file_delete:
$ delete 'f'*
$ exit
$file_interactive:
$ if x .eq. y then e "-W-EXISTS, File ''P1' exists."
$ if x .ne. y then e "-W-NEWERVERSION, of File ''P1' exists."
$ read/error=file_delete/end=file_delete-
  /prompt="Create new version [y/n]: " -
  sys$command x
$ if .not. x then $ e "-W-SKIPPED, File ''P1' skipped."
$ if .not. x then $ goto file_delete
$ P1 = P1 - f$parse(P1,,,"version")
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ if .not. f$verify() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
"output_file"));ENDPROCEDURE;Unpacker;QUIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create 'f'
X*** `5B-.ref-lib`5Dsdlgcc.c
X--- sdlgcc.c
X**************
X*** 11,16
X  ** and unions but are parsable by GCC.
X  **
X  **
X  ** 20-Jul-92 Dick Munroe
X  **`09     Doyle, Munroe Consultants, Inc.
X  **`09     267 Cox St.
X--- 11,19 -----
X  ** and unions but are parsable by GCC.
X  **
X  **
X+ ** 06-Aug-92 Dick Munroe
X+ **`09  Fix a bug in the IFDEF generation.
X+ **`09 `20
X  ** 20-Jul-92 Dick Munroe
X  **`09     Doyle, Munroe Consultants, Inc.
X  **`09     267 Cox St.
X**************
X*** 346,352
X      strcpy (ifdef, out) ;
X      fileNamePC = &ifdef ;
X      for (xxxPC = strtok (ifdef, ":`5B`5D");
X!          xxxPC == NULL;
X  `09 xxxPC = strtok (NULL, ":`5B`5D"))
X      `7B
X        fileNamePC = xxxPC ;
X--- 349,355 -----
X      strcpy (ifdef, out) ;
X      fileNamePC = &ifdef ;
X      for (xxxPC = strtok (ifdef, ":`5B`5D");
X!          xxxPC != NULL;
X  `09 xxxPC = strtok (NULL, ":`5B`5D"))
X      `7B
X        fileNamePC = xxxPC ;
X**************
X*** 357,362
X           *xxxPC != 0;
X  `09 xxxPC++)
X      `7B
X        if (islower(*xxxPC))
X        `7B
X  `09*xxxPC = toupper(*xxxPC);
X--- 360,369 -----
X           *xxxPC != 0;
X  `09 xxxPC++)
X      `7B
X+       if (*xxxPC == '-')
X+       `7B
X+ `09*xxxPC = '_' ;`09`09`09`09`09/* Replace "-" with "_" to make valid symb
Vols.`09`09`09`09*/
X+       `7D ;`09`09`09`09`09`09/* End if (*xxxPC == '-')`09`09`09`09`09`09*/
X        if (islower(*xxxPC))
X        `7B
X  `09*xxxPC = toupper(*xxxPC);
$ CALL UNPACK PATCH1A.DIFF;1 455568184
$ create 'f'
X*** `5B-.ref-lib`5Dsdlgcc.c
X--- sdlgcc.c
X**************
X*** 13,18
X  **
X  ** 06-Aug-92 Dick Munroe
X  **`09  Fix a bug in the IFDEF generation.
X  **`09 `20
X  ** 20-Jul-92 Dick Munroe
X  **`09     Doyle, Munroe Consultants, Inc.
X--- 13,19 -----
X  **
X  ** 06-Aug-92 Dick Munroe
X  **`09  Fix a bug in the IFDEF generation.
X+ **`09  Found a bug in the generation of arrays of structures.
X  **`09 `20
X  ** 20-Jul-92 Dick Munroe
X  **`09     Doyle, Munroe Consultants, Inc.
X**************
X*** 645,650
X        if (level > 0) `7B
X          column += fprintf(outfile,"%.*s`7D ",(level+1)*options.indent,spac
Ves);
X          print_name(node,0);
X          column += fprintf(outfile,";");
X          newline();
X        `7D
X--- 646,653 -----
X        if (level > 0) `7B
X          column += fprintf(outfile,"%.*s`7D ",(level+1)*options.indent,spac
Ves);
X          print_name(node,0);
X+ `09if (node->sdl_flag_bits.flag.m_dimen)
X+ `09  column += fprintf(outfile," `5B%d`5D",node->hidim - node->lodim + 1);
X          column += fprintf(outfile,";");
X          newline();
X        `7D
X**************
X*** 863,870
X        column += fprintf(outfile,")()");
X        break;
X    `7D;
X!   if (node->sdl_flag_bits.flag.m_dimen)
X!     column += fprintf(outfile," `5B%d`5D",node->hidim - node->lodim + 1);
X `20
X    if (node->datatype == SDL$C_TYPE_CHARACTER) `7B
X      if (node->typeinfo == 0)
X--- 866,885 -----
X        column += fprintf(outfile,")()");
X        break;
X    `7D;
X!`20
X!   /*
X!   ** Dimensions for structures need to get printed AFTER the closing brack
Vets of
X!   ** the structure, instead of BEFORE the name.
X!   */
X!  `20
X!   switch(node->datatype) `7B
X!     case SDL$C_TYPE_STRUCTURE:
X!     case SDL$C_TYPE_UNION:
X! `09break ;
X!     default :
X!       if (node->sdl_flag_bits.flag.m_dimen)
X! `09column += fprintf(outfile," `5B%d`5D",node->hidim - node->lodim + 1);
X!   `7D;
X `20
X    if (node->datatype == SDL$C_TYPE_CHARACTER) `7B
X      if (node->typeinfo == 0)
$ CALL UNPACK PATCH1B.DIFF;1 103942272
$ create 'f'
X*** `5B-.ref-lib`5Dsdlgcc.c
X--- sdlgcc.c
X**************
X*** 14,19
X  ** 06-Aug-92 Dick Munroe
X  **`09  Fix a bug in the IFDEF generation.
X  **`09  Found a bug in the generation of arrays of structures.
X  **`09 `20
X  ** 20-Jul-92 Dick Munroe
X  **`09     Doyle, Munroe Consultants, Inc.
X--- 14,20 -----
X  ** 06-Aug-92 Dick Munroe
X  **`09  Fix a bug in the IFDEF generation.
X  **`09  Found a bug in the generation of arrays of structures.
X+ **`09  SDLGCC doesn't know about generating string constants.
X  **`09 `20
X  ** 20-Jul-92 Dick Munroe
X  **`09     Doyle, Munroe Consultants, Inc.
X**************
X*** 545,554
X        column += fprintf(outfile,"#define ");
X        print_name(node,level);
X        column += fprintf(outfile," ");
X!       if (node->sdl_flag_bits.flag.m_mask && options.mask)
X!         column += fprintf(outfile,"0x%08X",node->typeinfo);
X!       else
X!         column += fprintf(outfile,"%d",node->typeinfo);
X        print_comment(node);
X        newline();
X        break;
X--- 546,575 -----
X        column += fprintf(outfile,"#define ");
X        print_name(node,level);
X        column += fprintf(outfile," ");
X!`20
X!       /*
X!       ** Generate string constants as well as integer constants.  This is
V done
X!       ** by checking the datatype of the node.
X!       */
X!      `20
X!       switch (node->datatype)
X!       `7B
X! `09case SDL$C_TYPE_CHARACTER:
X! `09  if (node->sdl_flag_bits.flag.m_varying)
X! `09  `7B
X! `09    column += fprintf(outfile,"\"%.*s\"", * (short*) node->typeinfo2, n
Vode->typeinfo2+sizeof(short)) ;
X! `09  `7D
X! `09  else
X! `09  `7B
X! `09    column += fprintf(outfile,"\"%.*s\"", node->typeinfo, node->typeinf
Vo2) ;
X! `09  `7D ;
X! `09  break ;
X! `09default:
X! `09  if (node->sdl_flag_bits.flag.m_mask && options.mask)
X! `09    column += fprintf(outfile,"0x%08X",node->typeinfo);
X! `09  else
X! `09    column += fprintf(outfile,"%d",node->typeinfo);
X!       `7D ;
X        print_comment(node);
X        newline();
X        break;
$ CALL UNPACK PATCH1C.DIFF;1 438307816
$ v=f$verify(v)
$ EXIT
Technical Details
Message-ID: <7867711@MVB.SAIC.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ucselx!network.ucsd.edu!mvb.saic.com!vmsnet-sources

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ucselx!network.ucsd.edu!mvb.saic.com!vmsnet-sources
From: munroe@dmc.com (Dick Munroe)
Newsgroups: vmsnet.sources
Subject: Miscellaneous SDLGCC patches, part 01/01
Message-ID: <7867711@MVB.SAIC.COM>
Date: Fri, 21 Aug 1992 19:37:17 GMT
Organization: Doyle, Munroe Consultants, Inc., Hudson, MA
Lines: 312
Approved: Mark.Berryman@Mvb.Saic.Com