Article View: vmsnet.sources
Article #57SDLGCC patch 2: pointer to functions now generated properly, part 01/01
From: Dick Munroe
Date: Wed, 26 Aug 1992 02:20
Date: Wed, 26 Aug 1992 02:20
175 lines
6603 bytes
6603 bytes
Submitted-by: munroe@dmc.com (Dick Munroe)
Posting-number: Volume 3, Issue 122
Archive-name: sdlgcc/patch2_01
Patch-to: sdlgcc: Volume 3, Issue 102-103,108
This patch to SDLGCC corrects a bug which prevented pointers to functions in
structures from being properly generated. There remains a bug in handling
general address constructs, but I'll fix that one when I need it. Apply all
previous patches before applying this one.
Good Luck.
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 25-AUG-1992 19:14:08.93 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. PATCH2.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 ** 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--- 11,21 -----
X ** and unions but are parsable by GCC.
X **
X **
X+ ** 14-Aug-92 Dick Munroe
X+ **`09 Found a bug in the generation of items that are pointers to functio
Vns.
X+ **`09 The enclosing ()s are missing to override the default operator
X+ **`09 precedence.
X+ **`09 `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**************
X*** 682,688
X `7B
X `09addressPN = resolveAddress(node->typeinfo2) ;
X `09print_predatatype(addressPN,level);
X! `09column += fprintf(outfile, "*") ;
X `7D
X else
X `7B
X--- 687,700 -----
X `7B
X `09addressPN = resolveAddress(node->typeinfo2) ;
X `09print_predatatype(addressPN,level);
X! `09if (addressPN->type == SDL$C_NODE_ENTRY)
X! `09`7B
X! `09 column += fprintf(outfile,"(*") ;
X! `09`7D`09`09`09`09`09`09/* End if (addressPN->type == SDL$C_NODE_ENTRY)`09
V`09`09`09*/
X! `09else
X! `09`7B
X! `09 column += fprintf(outfile, "*") ;
X! `09`7D
X `7D
X else
X `7B
X**************
X*** 692,698
X print_postdatatype(node);
X if (addressPN->type == SDL$C_NODE_ENTRY)
X `7B
X! `09column += fprintf(outfile,"(...)") ;
X `7D ;`09`09`09`09`09`09/* End if (addressPN->type == SDL$C_NODE_ENTR
VY)`09`09`09`09*/
X column += fprintf(outfile,";");
X print_comment(node);
X--- 704,710 -----
X print_postdatatype(node);
X if (addressPN->type == SDL$C_NODE_ENTRY)
X `7B
X! `09column += fprintf(outfile,")(...)") ;
X `7D ;`09`09`09`09`09`09/* End if (addressPN->type == SDL$C_NODE_ENTR
VY)`09`09`09`09*/
X column += fprintf(outfile,";");
X print_comment(node);
$ CALL UNPACK PATCH2.DIFF;1 1898577155
$ v=f$verify(v)
$ EXIT
Technical Details
Message-ID:
<7917653@MVB.SAIC.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!network.ucsd.edu!mvb.saic.com!vmsnet-sourcesShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!network.ucsd.edu!mvb.saic.com!vmsnet-sources From: munroe@dmc.com (Dick Munroe) Newsgroups: vmsnet.sources Subject: SDLGCC patch 2: pointer to functions now generated properly, part 01/01 Message-ID: <7917653@MVB.SAIC.COM> Date: Wed, 26 Aug 1992 02:20:05 GMT Organization: Doyle, Munroe Consultants, Inc., Hudson, MA Lines: 175 Approved: Mark.Berryman@Mvb.Saic.Com