Hi Rustom

Sorry for the delay - I only check the list sporadically…

On Sun, Aug 4, 2013 at 6:13 AM, Rustom Mody <rustompm...@gmail.com> wrote:

>
>
> On Sun, Aug 4, 2013 at 5:04 AM, William Henney <when...@gmail.com> wrote:
>
>>
>> On Fri, Aug 2, 2013 at 11:52 PM, Rustom Mody <rustompm...@gmail.com>wrote:
>>
>>>
>>>
[Snip]


> I dont think so.
>>> The context is writing C with C mode (or haskell with haskell-mode
>>> python with python-mode etc) ie the user is not using orgmode.  That is why
>>> I mentioned orgtbl, ie org table editing facilities are needed but the
>>> major mode is something else.
>>>
>>
>> What about a radio table using orgtbl-to-generic?
>>
>> See Appendix 6 of the Org manual
>>
>> Will
>>
>
> This looks like a useful approach
>
> The variable names dont seem to match:
> Appendix 6.2 talks of orgtbl-radio-tables
> However org (8.0.7) seems to have orgtbl-radio-table-templates
>
>

> Assuming they are the same, anywhere I can read about the documentation of
> the template format?
> Specifically I find that the name of the receiving function
> (orgtbl-to-latex) seems to have a significance.  The same in the template
> seems to have none
>
>
The template is not strictly necessary - you can just add the required
lines by hand to your C source file.
I think that orgtbl-to-generic should be able to do what you want out of
the box.  Maybe the attached example (orgtbl-test.c) might help you.  The
idea is that you edit the org table at the top, then "C-u C-u C-c C-c" will
update all the formulae in the table and install the results in your C
source code at the bottom.  This is not quite what you originally asked
for, since you have two copies of the data in the file and you have to
remember to only edit the version in the org table.  But it is pretty
close.

Cheers

Will




-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia
/* -*- eval: (orgtbl-mode); -*- */

/*
#+ORGTBL: SEND mytable orgtbl-to-generic :lstart "    const float " :sep " = " :skip 1 :lend ";" :skipcols (2 3)
| parameter | numerator | denominator |    value |
|-----------+-----------+-------------+----------|
| a         |       3.0 |         3.0 |  1.00000 |
| b         |      14.0 |         7.0 |  2.00000 |
| c         |      -2.0 |        15.0 | -0.13333 |
#+TBLFM: $4=$2/$3;f5

With point in above table, "C-u C-u C-c C-c" will update formulae and install into C source

*/
void main() {
// BEGIN RECEIVE ORGTBL mytable
    const float a = 1.00000;
    const float b = 2.00000;
    const float c = -0.13333;
// END RECEIVE ORGTBL mytable
}


Reply via email to