* Creating Org Table using Calc on C-syntax hex integers
@ 2009-06-24 22:24 Joseph Oswald
2009-06-25 4:42 ` Carsten Dominik
0 siblings, 1 reply; 2+ messages in thread
From: Joseph Oswald @ 2009-06-24 22:24 UTC (permalink / raw)
To: emacs-orgmode
GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600) of 2008-03-26 on RELEASE
Running on Windows XP Pro
org-version 4.67c
I have composed a table in org including integers using C-syntax hexadecimal.
| Variable Name | Current | Target.exe locn | Address of | |
| | Source | | reference | Delta |
|---------------------------+---------+-----------------+------------+--------|
| read_thread_func | 0x11450 | 0x11450 | 0x113b8 | |
| MainWndProc | 0x18190 | 0x18190 | 0x11284 | |
| l_bData | 0x1d1b8 | 0x1d194 | 0x187d8 | 0x24 |
I would like to create a formula that causes the difference between
two columns in this format to be calculated and displayed (preferably,
but not necessarily) in the same C-syntax, in the Delta column. (The
0x24 was calculated by hand in the above excerpt)
The file itself is primarily an org file, not a C file, and I would
prefer to keep the choice of C-syntax for Calc localized to this
particular .org file, or even better, to this particular table.
I have tried persuading the embedded calc mode to use the C "language
mode" for the table, it seems like there should be a line like
% [calc-mode: language-mode: c]
or % [calc-mode: calc-language-option: c]
or some other thing that could be placed somewhere near the table or
in the file to affect how Calc treats the numbers in the table, but I
can't seem to figure how to make that happen. I find the Calc
documentation of this stuff to be a little confusing, as to which
names in the source and/or documentation apply to which context.
It appears from the .el source that the settings specific to org-calc
(i.e., following a semicolon after the formula are hard-coded to the
limited set described in "Formula Syntax for Calc"), not including
this setting.
1) Is it possible to do this?
2) If so, how?
Thanks for your help.
--Joe
P.S. The org-mode info file "Feedback node" suggests mailing Carsten
Dominik directly for "questions, remarks, or ideas" instead of this
mailing list. I assumed this list was a more appropriate target.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Creating Org Table using Calc on C-syntax hex integers
2009-06-24 22:24 Creating Org Table using Calc on C-syntax hex integers Joseph Oswald
@ 2009-06-25 4:42 ` Carsten Dominik
0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-06-25 4:42 UTC (permalink / raw)
To: Joseph Oswald; +Cc: emacs-orgmode
On Jun 25, 2009, at 12:24 AM, Joseph Oswald wrote:
> GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600) of 2008-03-26 on RELEASE
> Running on Windows XP Pro
> org-version 4.67c
>
> I have composed a table in org including integers using C-syntax
> hexadecimal.
>
> | Variable Name | Current | Target.exe locn | Address of
> | |
> | | Source | | reference
> | Delta |
> |---------------------------+---------+-----------------+------------
> +--------|
> | read_thread_func | 0x11450 | 0x11450 | 0x113b8
> | |
> | MainWndProc | 0x18190 | 0x18190 | 0x11284
> | |
> | l_bData | 0x1d1b8 | 0x1d194 | 0x187d8
> | 0x24 |
>
> I would like to create a formula that causes the difference between
> two columns in this format to be calculated and displayed (preferably,
> but not necessarily) in the same C-syntax, in the Delta column. (The
> 0x24 was calculated by hand in the above excerpt)
>
> The file itself is primarily an org file, not a C file, and I would
> prefer to keep the choice of C-syntax for Calc localized to this
> particular .org file, or even better, to this particular table.
>
> I have tried persuading the embedded calc mode to use the C "language
> mode" for the table, it seems like there should be a line like
>
> % [calc-mode: language-mode: c]
>
> or % [calc-mode: calc-language-option: c]
>
> or some other thing that could be placed somewhere near the table or
> in the file to affect how Calc treats the numbers in the table, but I
> can't seem to figure how to make that happen. I find the Calc
> documentation of this stuff to be a little confusing, as to which
> names in the source and/or documentation apply to which context.
>
> It appears from the .el source that the settings specific to org-calc
> (i.e., following a semicolon after the formula are hard-coded to the
> limited set described in "Formula Syntax for Calc"), not including
> this setting.
>
> 1) Is it possible to do this?
> 2) If so, how?
Since you like to have C syntax, I am not sure how to do this with calc.
But you can always hach your way using a lisp formula instead:
| Variable Name | Current | Target.exe locn | Address of | |
| | Source | | reference | Delta |
|------------------+---------+-----------------+------------+-------|
| read_thread_func | 0x11450 | 0x11450 | 0x113b8 | 0x0 |
| MainWndProc | 0x18190 | 0x18190 | 0x11284 | 0x0 |
| l_bData | 0x1d1b8 | 0x1d194 | 0x187d8 | 0x24 |
#+TBLFM: $5='(format "0x%x" (- (read (concat "#" (substring $2 1)))
(read (concat "#" (substring $3 1)))))
HTH
This formula looks more complicated than it really is, because
it has to convert the number into Lisp syntax #x11450 before reading it.
- Carsten
>
> Thanks for your help.
>
> --Joe
>
> P.S. The org-mode info file "Feedback node" suggests mailing Carsten
> Dominik directly for "questions, remarks, or ideas" instead of this
> mailing list. I assumed this list was a more appropriate target.
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-25 4:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-24 22:24 Creating Org Table using Calc on C-syntax hex integers Joseph Oswald
2009-06-25 4:42 ` Carsten Dominik
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).