Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Craig A. Berry" Newsgroups: comp.os.vms Subject: Re: Can C #includes like this be made to work onVMS? Date: Wed, 16 Oct 2024 20:34:49 -0500 Organization: A noiseless patient Spider Lines: 78 Message-ID: References: <670eff59$0$705$14726298@news.sunsite.dk> <671041dd$0$716$14726298@news.sunsite.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 17 Oct 2024 03:34:50 +0200 (CEST) Injection-Info: dont-email.me; posting-host="88b386ec3d4e39e7c995b3a476aad48a"; logging-data="2592511"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192krdFllx4ccqL4fnVjogwH8dUJglMjPA=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:yCYel38Ymd0aW8sNOVKVFZNanvI= Content-Language: en-US In-Reply-To: <671041dd$0$716$14726298@news.sunsite.dk> Bytes: 3556 On 10/16/24 5:44 PM, Arne Vajhøj wrote: > On 10/15/2024 7:48 PM, Arne Vajhøj wrote: >> $ type bc.eve >> all replace "#include ""b/" "#include ""c/" >> exit > >> $ type cd.tpu >> eve_all_replace("#include ""c/", "#include ""d/"); >> eve_exit(); > > Just realized that one is custom not standard. > > ! > !  Replace all occurences of string with another string (without > !  confirm). > ! > !  High-level. > ! > procedure eve_all_replace(fndstr,rplstr) > local fnd_string, >       rpl_string, >       pos_mark, >       count_integer; > if not (eve$prompt_string(fndstr,fnd_string,"Old string: ", >                           "No old string given")) then >     return; > endif; > if not (eve$prompt_string(rplstr,rpl_string,"New string ", >                           "No new string given")) then >     return; > endif; > pos_mark:=mark(none); > set (screen_update, off); > eve$all_replace(fnd_string,rpl_string,count_integer); > position (pos_mark); > set (screen_update, on); > delete (pos_mark); > message("Total of "+str(count_integer)+" replaces"); > endprocedure; > ! > !  Replace all occurences of string with another string (without > !  confirm). > ! > !  Low-level. > ! > procedure eve$all_replace(fndstr,rplstr,count) > local find_mark; > position (beginning_of(current_buffer)); > count:=0; > loop >     find_mark:=search_quietly(fndstr, forward); >     exitif find_mark = 0; >     count:=count+1; >     position (find_mark); >     copy_text (rplstr); >     erase_character (length(fndstr)); > endloop; > endprocedure; eve_all_replace may be custom, but as far as I know eve_global_replace is standard. Here's an example of using TPU as a poor man's Perl: $ edit/tpu/nodisplay/noinitialization - /section=sys$library:eve$section.tpu$section - /command=sys$input/output=myfile.txt myfile.txt input_file := GET_INFO (COMMAND_LINE, "file_name"); main_buffer:= CREATE_BUFFER ("main", input_file); POSITION (BEGINNING_OF (main_buffer)); eve_global_replace("foo","bar"); out_file := GET_INFO (COMMAND_LINE, "output_file"); WRITE_FILE (main_buffer, out_file); quit; ^Z But yeah, Perl is way easier: $ perl -pi -e "s/foo/bar/g;" myfile.txt