Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

gas code with CWEB

3 views
Skip to first unread message

Allan Adler

unread,
Aug 31, 2006, 7:48:07 PM8/31/06
to

Suppose you want to produce a literate version of a program that uses
both C code and assembler code (i.e. .S files), to be compiled with GCC
under Linux. Can CWEB handle the .S files, both for cweave and ctangle?
For example, ctangle might not observe formatting conventions that the
assembler might insist on. Is that really a problem and, if so, how does
one get around it with CWEB?
--
Ignorantly,
Allan Adler <a...@zurich.csail.mit.edu>
* Disclaimer: I am a guest and *not* a member of the MIT CSAIL. My actions and
* comments do not reflect in any way on MIT. Also, I am nowhere near Boston.

Lee Wittenberg

unread,
Jan 11, 2007, 9:01:28 PM1/11/07
to
On Thu, 31 Aug 2006 19:48:07 -0400, Allan Adler wrote:

>
> Suppose you want to produce a literate version of a program that uses
> both C code and assembler code (i.e. .S files), to be compiled with GCC
> under Linux. Can CWEB handle the .S files, both for cweave and ctangle?
> For example, ctangle might not observe formatting conventions that the
> assembler might insist on. Is that really a problem and, if so, how does
> one get around it with CWEB?

You can probably use the @= control code (along with @( to extract to a
file named with a .S extension), but it won't be pretty. You'll have to
enclose each assembly language statement in @=...@> with an @/ at the end
of each line to ensure that cweave puts each statement on a separate line.
For example,

@(foo.S@>=
@= MOV x,y @>@/
@= ADD y,z @>@/
@= JMP there @>

You'll also have to filter out the /*...*/ section comments and #line
directives inserted by ctangle in the resulting .S file(s).

-- Lee

------------------------------------------------------------------------
Lee Wittenberg <le...@samson.kean.edu> Department of Mathematics & Computer
Science Kean University, Union, NJ 07083

My Father's house hath many central processors. It matters not what a
man does with his life if his software is mine, sayeth the Lord.
-- Richard Condon, "The Vertical Smile" (1971)
------------------------------------------------------------------------

0 new messages