Tuesday, November 8, 2011

Re: what is vim's printf, as it is in c

Hi all 

@Marc Weber

I finally got it. I don't know your words at all yesterday. So I learn 'register' and 'buffer' the whole morning. And finally got it.
I now know how to redirect output in vim. 

the followings are just three parts of generators of those huge codes . And they are in everywhere of my code. 
And I just redirect stdout to one register, and then get it.

again, thanks for your help

242   :let cmdpacket=['burstcount', 'agent', 'tag', 'space', 'row', 'col', 'threadid', 'execute']
243   :for i in cmdpacket
244   :  let str=printf( "  assign %-21s = wq_unload[0] ? ( wq_valid[1] ? %-16s : %-16s ) :", 'wq_'.i.'_next[0]', 'wq_'.i.'[1]', 'inreq_'.i )
245   :  let len=strlen( str )
246   :  let pattern=printf( "%%32s ~wq_valid[0] ? %%-%ds :", len-32-18 )
247   :  echo printf( "  assign %-21s = wq_unload[0] ? ( wq_valid[1] ? %-16s : %-16s ) :", 'wq_'.i.'_next[0]', 'wq_'.i.'[1]', 'inreq_'.i )
248   :  echo printf( pattern, ' ', 'inreq_'.i )
249   :  echo printf( "%47s wq_%s[0];", ' ', i )
250   :endfor

285   :let cmdpacket=['burstcount', 'agent', 'tag', 'space', 'row', 'col', 'threadid', 'execute']
286   :for i in cmdpacket
287   :  let str=printf( "  assign %-21s = |wq_unload[i:0] ? ( wq_valid[i+1] ? %-16s : %-16s ) :", 'wq_'.i.'_next[i]', 'wq_'.i.'[i+1]', 'inreq_'.i )
288   :  let len=strlen( str )
289   :  let pattern=printf( "%%32s ~wq_valid[i]    ? %%-%ds :", len-32-19 )
290   :  echo printf( "  assign %-21s = |wq_unload[i:0] ? ( wq_valid[i+1] ? %-18s : %-16s ) :", 'wq_'.i.'_next[i]', 'wq_'.i.'[i+1]', 'inreq_'.i )
291   :  echo printf( pattern, ' ', 'inreq_'.i )
292   :  echo printf( "%50s wq_%s[i];", ' ', i )
293   :endfor

436   :let cmdpacket=['burstcount', 'agent', 'tag', 'space', 'row', 'col', 'threadid', 'execute']
437   :for i in cmdpacket
438   :  let str=printf( "  assign %-21s = |rq_unload[i:0] ? ( rq_valid[i+1] ? %-16s : %-16s ) :", 'rq_'.i.'_next[i]', 'rq_'.i.'[i+1]', 'inreq_'.i )
439   :  let len=strlen( str )
440   :  let pattern=printf( "%%32s ~rq_valid[i]    ? %%-%ds :", len-32-19 )
441   :  echo printf( "  assign %-21s = |rq_unload[i:0] ? ( rq_valid[i+1] ? %-18s : %-16s ) :", 'rq_'.i.'_next[i]', 'rq_'.i.'[i+1]', 'inreq_'.i )
442   :  echo printf( pattern, ' ', 'inreq_'.i )
443   :  echo printf( "%50s rq_%s[i];", ' ', i )
444   :endfor


ps: 
what I do now is using internal commands, from vim. 

a "!" would invoke a system call as command line in vim, so, I call it external command. 

am I wrong? or? 


On Tue, Nov 8, 2011 at 9:57 PM, Marc Weber <marco-oweber@gmx.de> wrote:
In fact you're doing well. You've found a help channel.

Excerpts from Steve liu's message of Tue Nov 08 14:39:36 +0100 2011:
> then I turned into external command in vim. but it's not gonna work.
> then I turned into vim internal command, and found that I don't know it
Here I'm not sure I understand what you mean by internal vs external
command.
External command could be command line commands executed by shell.
internal commands are usually the :XXXX lines inside vim or .vim files.

> forgive me if I ... I'm not a native speaker. you're better than me. [?]
There is nothing I have to forgive. You didn't do anything wrong.
I'm trying to make you understand why I can't help you faster.

After waking up don't spend too much time. If you still don't get this
job done reply again - eventually also describing the patterns you're
talking about.
Also consider joining #vim on irc.freenode.net (any irc client will do)

Marc Weber

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
steve
<sliu.119@gmail.com>

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: