home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / vmsnet / sources / 302 < prev    next >
Encoding:
Internet Message Format  |  1992-08-21  |  10.2 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ucselx!network.ucsd.edu!mvb.saic.com!vmsnet-sources
  2. From: munroe@dmc.com (Dick Munroe)
  3. Newsgroups: vmsnet.sources
  4. Subject: Miscellaneous SDLGCC patches, part 01/01
  5. Message-ID: <7867711@MVB.SAIC.COM>
  6. Date: Fri, 21 Aug 1992 19:37:17 GMT
  7. Organization: Doyle, Munroe Consultants, Inc., Hudson, MA
  8. Lines: 312
  9. Approved: Mark.Berryman@Mvb.Saic.Com
  10.  
  11. Submitted-by: munroe@dmc.com (Dick Munroe)
  12. Posting-number: Volume 3, Issue 108
  13. Archive-name: sdlgcc/patch1_01
  14. Patch-to: sdlgcc: Volume 1, Issue 102-103
  15.  
  16.          [ This submission contains three patches to SDLGCC.  These
  17.            patches must be applied using the unix-like patch utility
  18.            available from the vmsnet.sources archives, not the VMS
  19.            PATCH utility.
  20.  
  21.            Patch1a - is a patch to SDLGCC that fixes a minor bug in
  22.            the IFDEF generation for multiple includes.
  23.  
  24.            Patch1b - is a patch to fix a bug in the generation of
  25.            arrays of structures within structures.
  26.  
  27.            Patch1c - allows SDLGCC to correctly generate string
  28.            constants as #define statements.
  29.  
  30.            These patches must be applied in order. ]
  31.  
  32. Dick Munroe
  33. Doyle, Munroe Consultants, Inc.
  34. 267 Cox St.
  35. Hudson, Ma. 01749
  36. (508) 568-1618
  37. (FAX) (508) 562-1133
  38. munroe@dmc.com
  39. $! ------------------ CUT HERE -----------------------
  40. $ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
  41. $!
  42. $! This archive created by VMS_SHARE Version 7.2-010  25-Jun-1992
  43. $!   On 21-AUG-1992 12:27:54.11   By user BERRYMAN 
  44. $!
  45. $! This VMS_SHARE Written by:
  46. $!    Andy Harper, Kings College London UK
  47. $!
  48. $! Acknowledgements to:
  49. $!    James Gray       - Original VMS_SHARE
  50. $!    Michael Bednarek - Original Concept and implementation
  51. $!
  52. $! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
  53. $! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
  54. $!
  55. $! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
  56. $!       1. PATCH1A.DIFF;1
  57. $!       2. PATCH1B.DIFF;1
  58. $!       3. PATCH1C.DIFF;1
  59. $!
  60. $set="set"
  61. $set symbol/scope=(nolocal,noglobal)
  62. $f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
  63. $e="write sys$error  ""%UNPACK"", "
  64. $w="write sys$output ""%UNPACK"", "
  65. $ if f$trnlnm("SHARE_LOG") then $ w = "!"
  66. $ ve=f$getsyi("version")
  67. $ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
  68. $ e "-E-OLDVER, Must run at least VMS 4.4"
  69. $ v=f$verify(v)
  70. $ exit 44
  71. $UNPACK: SUBROUTINE ! P1=filename, P2=checksum
  72. $ x = P1 - f$parse(P1,,,"version")
  73. $ y = f$search(x)
  74. $ if y .eqs. "" then $ goto file_absent
  75. $ x = f$integer(f$parse(P1,,,"version")-";")
  76. $ y = f$integer(f$parse(y,,,"version")-";")
  77. $ if x .gt. y then $ goto file_absent
  78. $ if f$mode() .eqs. "INTERACTIVE" then $ goto file_interactive
  79. $ if x .eq. y then e "-W-EXISTS, File ''P1' exists. Skipped."
  80. $ if x .ne. y then e "-W-NEWERVERSION, of File ''P1' exists. Skipped."
  81. $file_delete:
  82. $ delete 'f'*
  83. $ exit
  84. $file_interactive:
  85. $ if x .eq. y then e "-W-EXISTS, File ''P1' exists."
  86. $ if x .ne. y then e "-W-NEWERVERSION, of File ''P1' exists."
  87. $ read/error=file_delete/end=file_delete-
  88.   /prompt="Create new version [y/n]: " -
  89.   sys$command x
  90. $ if .not. x then $ e "-W-SKIPPED, File ''P1' skipped."
  91. $ if .not. x then $ goto file_delete
  92. $ P1 = P1 - f$parse(P1,,,"version")
  93. $file_absent:
  94. $ if f$parse(P1) .nes. "" then $ goto dirok
  95. $ dn=f$parse(P1,,,"DIRECTORY")
  96. $ w "-I-CREDIR, Creating directory ''dn'."
  97. $ create/dir 'dn'
  98. $ if $status then $ goto dirok
  99. $ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
  100. $ delete 'f'*
  101. $ exit
  102. $dirok:
  103. $ w "-I-PROCESS, Processing file ''P1'."
  104. $ if .not. f$verify() then $ define/user sys$output nl:
  105. $ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
  106. PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
  107. SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
  108. CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
  109. LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
  110. BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
  111. IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
  112. MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
  113. ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
  114. 1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
  115. POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
  116. ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
  117. COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
  118. "output_file"));ENDPROCEDURE;Unpacker;QUIT;
  119. $ delete/nolog 'f'*
  120. $ CHECKSUM 'P1'
  121. $ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
  122. $ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
  123. $ ENDSUBROUTINE
  124. $START:
  125. $ create 'f'
  126. X*** `5B-.ref-lib`5Dsdlgcc.c
  127. X--- sdlgcc.c
  128. X**************
  129. X*** 11,16
  130. X  ** and unions but are parsable by GCC.
  131. X  **
  132. X  **
  133. X  ** 20-Jul-92 Dick Munroe
  134. X  **`09     Doyle, Munroe Consultants, Inc.
  135. X  **`09     267 Cox St.
  136. X--- 11,19 -----
  137. X  ** and unions but are parsable by GCC.
  138. X  **
  139. X  **
  140. X+ ** 06-Aug-92 Dick Munroe
  141. X+ **`09  Fix a bug in the IFDEF generation.
  142. X+ **`09 `20
  143. X  ** 20-Jul-92 Dick Munroe
  144. X  **`09     Doyle, Munroe Consultants, Inc.
  145. X  **`09     267 Cox St.
  146. X**************
  147. X*** 346,352
  148. X      strcpy (ifdef, out) ;
  149. X      fileNamePC = &ifdef ;
  150. X      for (xxxPC = strtok (ifdef, ":`5B`5D");
  151. X!          xxxPC == NULL;
  152. X  `09 xxxPC = strtok (NULL, ":`5B`5D"))
  153. X      `7B
  154. X        fileNamePC = xxxPC ;
  155. X--- 349,355 -----
  156. X      strcpy (ifdef, out) ;
  157. X      fileNamePC = &ifdef ;
  158. X      for (xxxPC = strtok (ifdef, ":`5B`5D");
  159. X!          xxxPC != NULL;
  160. X  `09 xxxPC = strtok (NULL, ":`5B`5D"))
  161. X      `7B
  162. X        fileNamePC = xxxPC ;
  163. X**************
  164. X*** 357,362
  165. X           *xxxPC != 0;
  166. X  `09 xxxPC++)
  167. X      `7B
  168. X        if (islower(*xxxPC))
  169. X        `7B
  170. X  `09*xxxPC = toupper(*xxxPC);
  171. X--- 360,369 -----
  172. X           *xxxPC != 0;
  173. X  `09 xxxPC++)
  174. X      `7B
  175. X+       if (*xxxPC == '-')
  176. X+       `7B
  177. X+ `09*xxxPC = '_' ;`09`09`09`09`09/* Replace "-" with "_" to make valid symb
  178. Vols.`09`09`09`09*/
  179. X+       `7D ;`09`09`09`09`09`09/* End if (*xxxPC == '-')`09`09`09`09`09`09*/
  180. X        if (islower(*xxxPC))
  181. X        `7B
  182. X  `09*xxxPC = toupper(*xxxPC);
  183. $ CALL UNPACK PATCH1A.DIFF;1 455568184
  184. $ create 'f'
  185. X*** `5B-.ref-lib`5Dsdlgcc.c
  186. X--- sdlgcc.c
  187. X**************
  188. X*** 13,18
  189. X  **
  190. X  ** 06-Aug-92 Dick Munroe
  191. X  **`09  Fix a bug in the IFDEF generation.
  192. X  **`09 `20
  193. X  ** 20-Jul-92 Dick Munroe
  194. X  **`09     Doyle, Munroe Consultants, Inc.
  195. X--- 13,19 -----
  196. X  **
  197. X  ** 06-Aug-92 Dick Munroe
  198. X  **`09  Fix a bug in the IFDEF generation.
  199. X+ **`09  Found a bug in the generation of arrays of structures.
  200. X  **`09 `20
  201. X  ** 20-Jul-92 Dick Munroe
  202. X  **`09     Doyle, Munroe Consultants, Inc.
  203. X**************
  204. X*** 645,650
  205. X        if (level > 0) `7B
  206. X          column += fprintf(outfile,"%.*s`7D ",(level+1)*options.indent,spac
  207. Ves);
  208. X          print_name(node,0);
  209. X          column += fprintf(outfile,";");
  210. X          newline();
  211. X        `7D
  212. X--- 646,653 -----
  213. X        if (level > 0) `7B
  214. X          column += fprintf(outfile,"%.*s`7D ",(level+1)*options.indent,spac
  215. Ves);
  216. X          print_name(node,0);
  217. X+ `09if (node->sdl_flag_bits.flag.m_dimen)
  218. X+ `09  column += fprintf(outfile," `5B%d`5D",node->hidim - node->lodim + 1);
  219. X          column += fprintf(outfile,";");
  220. X          newline();
  221. X        `7D
  222. X**************
  223. X*** 863,870
  224. X        column += fprintf(outfile,")()");
  225. X        break;
  226. X    `7D;
  227. X!   if (node->sdl_flag_bits.flag.m_dimen)
  228. X!     column += fprintf(outfile," `5B%d`5D",node->hidim - node->lodim + 1);
  229. X `20
  230. X    if (node->datatype == SDL$C_TYPE_CHARACTER) `7B
  231. X      if (node->typeinfo == 0)
  232. X--- 866,885 -----
  233. X        column += fprintf(outfile,")()");
  234. X        break;
  235. X    `7D;
  236. X!`20
  237. X!   /*
  238. X!   ** Dimensions for structures need to get printed AFTER the closing brack
  239. Vets of
  240. X!   ** the structure, instead of BEFORE the name.
  241. X!   */
  242. X!  `20
  243. X!   switch(node->datatype) `7B
  244. X!     case SDL$C_TYPE_STRUCTURE:
  245. X!     case SDL$C_TYPE_UNION:
  246. X! `09break ;
  247. X!     default :
  248. X!       if (node->sdl_flag_bits.flag.m_dimen)
  249. X! `09column += fprintf(outfile," `5B%d`5D",node->hidim - node->lodim + 1);
  250. X!   `7D;
  251. X `20
  252. X    if (node->datatype == SDL$C_TYPE_CHARACTER) `7B
  253. X      if (node->typeinfo == 0)
  254. $ CALL UNPACK PATCH1B.DIFF;1 103942272
  255. $ create 'f'
  256. X*** `5B-.ref-lib`5Dsdlgcc.c
  257. X--- sdlgcc.c
  258. X**************
  259. X*** 14,19
  260. X  ** 06-Aug-92 Dick Munroe
  261. X  **`09  Fix a bug in the IFDEF generation.
  262. X  **`09  Found a bug in the generation of arrays of structures.
  263. X  **`09 `20
  264. X  ** 20-Jul-92 Dick Munroe
  265. X  **`09     Doyle, Munroe Consultants, Inc.
  266. X--- 14,20 -----
  267. X  ** 06-Aug-92 Dick Munroe
  268. X  **`09  Fix a bug in the IFDEF generation.
  269. X  **`09  Found a bug in the generation of arrays of structures.
  270. X+ **`09  SDLGCC doesn't know about generating string constants.
  271. X  **`09 `20
  272. X  ** 20-Jul-92 Dick Munroe
  273. X  **`09     Doyle, Munroe Consultants, Inc.
  274. X**************
  275. X*** 545,554
  276. X        column += fprintf(outfile,"#define ");
  277. X        print_name(node,level);
  278. X        column += fprintf(outfile," ");
  279. X!       if (node->sdl_flag_bits.flag.m_mask && options.mask)
  280. X!         column += fprintf(outfile,"0x%08X",node->typeinfo);
  281. X!       else
  282. X!         column += fprintf(outfile,"%d",node->typeinfo);
  283. X        print_comment(node);
  284. X        newline();
  285. X        break;
  286. X--- 546,575 -----
  287. X        column += fprintf(outfile,"#define ");
  288. X        print_name(node,level);
  289. X        column += fprintf(outfile," ");
  290. X!`20
  291. X!       /*
  292. X!       ** Generate string constants as well as integer constants.  This is
  293. V done
  294. X!       ** by checking the datatype of the node.
  295. X!       */
  296. X!      `20
  297. X!       switch (node->datatype)
  298. X!       `7B
  299. X! `09case SDL$C_TYPE_CHARACTER:
  300. X! `09  if (node->sdl_flag_bits.flag.m_varying)
  301. X! `09  `7B
  302. X! `09    column += fprintf(outfile,"\"%.*s\"", * (short*) node->typeinfo2, n
  303. Vode->typeinfo2+sizeof(short)) ;
  304. X! `09  `7D
  305. X! `09  else
  306. X! `09  `7B
  307. X! `09    column += fprintf(outfile,"\"%.*s\"", node->typeinfo, node->typeinf
  308. Vo2) ;
  309. X! `09  `7D ;
  310. X! `09  break ;
  311. X! `09default:
  312. X! `09  if (node->sdl_flag_bits.flag.m_mask && options.mask)
  313. X! `09    column += fprintf(outfile,"0x%08X",node->typeinfo);
  314. X! `09  else
  315. X! `09    column += fprintf(outfile,"%d",node->typeinfo);
  316. X!       `7D ;
  317. X        print_comment(node);
  318. X        newline();
  319. X        break;
  320. $ CALL UNPACK PATCH1C.DIFF;1 438307816
  321. $ v=f$verify(v)
  322. $ EXIT
  323.