Hi all, Yeah, I''m going OT here... I''m not entirely sure I understand how Ruby builds parse.y on Windows, but it works. However, when I changed all instances of "Ruby" to "Sapphire", and renamed all the source files, I suddenly started getting this error: byacc ./parse.y ''byacc'' is not recognized as an internal or external command, operable program or batch file. NMAKE : fatal error U1077: ''byacc'' : return code ''0x1'' Stop. Does anyone have any idea what would cause that? Here''s the code I used: # rename.rb require ''fileutils'' Dir[''sapphire/**/*''].each{ |file| # Skip directories next unless File.file?(file) # Rename ''ruby.h'' to ''sapphire.h'', for example if File.basename(file) =~ /ruby/ old_file = file.dup file = File.join(File.dirname(file), File.basename(file).gsub(''ruby'', ''sapphire'')) File.rename(old_file, file) end ruby_found = false # Do a pass over the file first, looking for ''ruby''. IO.foreach(file){ |line| if line =~ /ruby/i ruby_found = true break end } # Skip over files that don''t contain the word ''ruby'' next unless ruby_found # Create a temp file new_file = file + ''.temp'' FileUtils.cp(file, new_file) fh = File.open(new_file, ''wb'') # Replace all instances of ''Ruby'' with ''Sapphire'', preserving case IO.foreach(file){ |line| line.gsub!(''ruby'', ''sapphire'') line.gsub!(''Ruby'', ''Sapphire'') line.gsub!(''RUBY'', ''SAPPHIRE'') fh.print line } fh.close # Rename the temp file to the original file File.rename(new_file, file) } This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
Hi, 2008/6/26 Berger, Daniel <Daniel.Berger at qwest.com>:> Hi all, > > Yeah, I''m going OT here... > > I''m not entirely sure I understand how Ruby builds parse.y on Windows, > but it works. However, when I changed all instances of "Ruby" to > "Sapphire", and renamed all the source files, I suddenly started getting > this error: > > byacc ./parse.y > ''byacc'' is not recognized as an internal or external command, > operable program or batch file. > NMAKE : fatal error U1077: ''byacc'' : return code ''0x1'' > Stop. > > Does anyone have any idea what would cause that? > >It is due to the time discrepancy of parse.y and parse.c. As far as I know, the Ruby source distribution comes with parse.y and parse.c for the lacking of yacc of windows. You can find following lines in win32/Makefile.sub {$(srcdir)}.y.c: $(YACC) $(YFLAGS) $(<:\=/) sed -e "s!^ *extern char \*getenv();!/* & */!;s/^\(#.*\)y\.tab/\1parse/" y.tab.c > $@ @del y.tab.c I guess if you make both parse.y and parse.c same file time, it will skip byacc. If you would like to build with byacc, you can install byacc. Refer to http://gnuwin32.sourceforge.net/packages/byacc.htm Regards, Park Heesob
> -----Original Message----- > From: win32utils-devel-bounces at rubyforge.org > [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of > Heesob Park > Sent: Wednesday, June 25, 2008 7:07 PM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] [OT] Byacc error > > Hi, > > 2008/6/26 Berger, Daniel <Daniel.Berger at qwest.com>: > > Hi all, > > > > Yeah, I''m going OT here... > > > > I''m not entirely sure I understand how Ruby builds parse.y > on Windows, > > but it works. However, when I changed all instances of "Ruby" to > > "Sapphire", and renamed all the source files, I suddenly started > > getting this error: > > > > byacc ./parse.y > > ''byacc'' is not recognized as an internal or external > command, operable > > program or batch file. > > NMAKE : fatal error U1077: ''byacc'' : return code ''0x1'' > > Stop. > > > > Does anyone have any idea what would cause that? > > > > > It is due to the time discrepancy of parse.y and parse.c. > As far as I know, the Ruby source distribution comes with > parse.y and parse.c for the lacking of yacc of windows. > > You can find following lines in win32/Makefile.sub > > {$(srcdir)}.y.c: > $(YACC) $(YFLAGS) $(<:\=/) > sed -e "s!^ *extern char \*getenv();!/* & > */!;s/^\(#.*\)y\.tab/\1parse/" y.tab.c > $@ > @del y.tab.c > > I guess if you make both parse.y and parse.c same file time, > it will skip byacc.Yes, that worked, thanks!> If you would like to build with byacc, you can install byacc. > Refer to http://gnuwin32.sourceforge.net/packages/byacc.htmI''ve never tried it. Do you think there''s any advantage to doing so? Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
2008/6/26 Berger, Daniel <Daniel.Berger at qwest.com>:> > >> -----Original Message----- >> From: win32utils-devel-bounces at rubyforge.org >> [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of >> Heesob Park >> Sent: Wednesday, June 25, 2008 7:07 PM >> To: Development and ideas for win32utils projects >> Subject: Re: [Win32utils-devel] [OT] Byacc error >> >> Hi, >> >> 2008/6/26 Berger, Daniel <Daniel.Berger at qwest.com>: >> > Hi all, >> > >> > Yeah, I''m going OT here... >> > >> > I''m not entirely sure I understand how Ruby builds parse.y >> on Windows, >> > but it works. However, when I changed all instances of "Ruby" to >> > "Sapphire", and renamed all the source files, I suddenly started >> > getting this error: >> > >> > byacc ./parse.y >> > ''byacc'' is not recognized as an internal or external >> command, operable >> > program or batch file. >> > NMAKE : fatal error U1077: ''byacc'' : return code ''0x1'' >> > Stop. >> > >> > Does anyone have any idea what would cause that? >> > >> > >> It is due to the time discrepancy of parse.y and parse.c. >> As far as I know, the Ruby source distribution comes with >> parse.y and parse.c for the lacking of yacc of windows. >> >> You can find following lines in win32/Makefile.sub >> >> {$(srcdir)}.y.c: >> $(YACC) $(YFLAGS) $(<:\=/) >> sed -e "s!^ *extern char \*getenv();!/* & >> */!;s/^\(#.*\)y\.tab/\1parse/" y.tab.c > $@ >> @del y.tab.c >> >> I guess if you make both parse.y and parse.c same file time, >> it will skip byacc. > > Yes, that worked, thanks! > >> If you would like to build with byacc, you can install byacc. >> Refer to http://gnuwin32.sourceforge.net/packages/byacc.htm > > I''ve never tried it. Do you think there''s any advantage to doing so? >Except for the case of changing grammer or parsing rule, you have no advantage. Regards, Park Heesob