On May 10, 2006, at 9:40, [EMAIL PROTECTED] wrote:

Look at the following example:

|---+-------------------+---------+----------|
|   | scan              | scan_in | scan_out |
|   |                   |   witdh |    width |
|---+-------------------+---------+----------|
| ! |                   |       0 |        0 |
| # | "SCAN_IN0[12:0]"  |      13 |        0 |
| # | "SCAN_IN1[3:0]"   |      17 |        0 |
| # | "SCAN_OUT0[15:0]" |      17 |       16 |
| # | "SCAN_IN2[22:0]"  |      40 |       16 |
| # | "SCAN_OUT1[44:0]" |      40 |       61 |
| # | "SCAN_IN3[5:0]"   |      46 |       61 |
|---+-------------------+---------+----------|
#+TBLFM: $3='(number-to-string (if (string-match "SCAN_IN.*\\[\\([0-9]+\\):\\([0-9]+\\)\\]" $2) (+ (string-to-number (match-string 1 $2)) 1 &1) &1))::$4='(number-to-string (if (string-match "SCAN_OUT.*\\[\\([0-9]+\\):\\([0-9]+\\)\\]" $2) (+ (string-to-number (match-string 1 $2)) 1 &1) &1))


OK, I have also taken this part, this is a great new feature for the tables. A few remarks:

- Note that you don't have to use "SCAN_IN3[5:0]" with quotes in the table field - you can leave off the quotes here and put them into the lisp form, like "$2". - I am also allowing a lisp form to return a number - number-to-string will then be automatically applied. - Finally, I am also allowing a format after a semicolon, just like in calc formulas. So you can write '(+ $1 15.3);%10.3f

Thanks again.

- Carsten



_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to