Hi,
Please tell me how could I have a #$B!J(Bsharp sign) expanded in the
macro such as
#define INCLUDE(filename) #include <filename>
which could do the expand below to include a file
INCLUDE(stdio.h) =#include <stdio.h>
Thank you in advance! 8 1857
[You've given us the solution that you're trying to implement,
but you haven't told what problem you're trying to solve.]
junj...@gmail.com wrote:
Hi,
Please tell me how could I have a #$B!J(Bsharp sign) expanded in the
macro such as
#define INCLUDE(filename) #include <filename>
which could do the expand below to include a file
INCLUDE(stdio.h) =#include <stdio.h>
You can't, but you can do things like...
#INCLUDE(X) <X>
#include INCLUDE(stdio.h)
--
Peter
Thansk for your advice.
I am just tyring to implement a API Framework Specification which
requires the INCLUDE macro to be defined.
On 4$B7n(B17$BF|(B, $B8a8e(B1:08, Peter Nilsson <a...@acay.com.auwrote:
[You've given us the solution that you're trying to implement,
but you haven't told what problem you're trying to solve.]
junj...@gmail.com wrote:
Hi,
Please tell me how could I have a #$B!J(Bsharp sign) expanded in the
macro such as
#define INCLUDE(filename) #include <filename>
which could do the expand below to include a file
INCLUDE(stdio.h) =#include <stdio.h>
You can't, but you can do things like...
#INCLUDE(X) <X>
#include INCLUDE(stdio.h)
--
Peter
On Apr 17, 9:28 am, junj...@gmail.com wrote:
Thansk for your advice.
I am just tyring to implement a API Framework Specification which
requires the INCLUDE macro to be defined.
On 4$B7n(B17$BF|(B, $B8a8e(B1:08, Peter Nilsson <a...@acay.com.auwrote:
[You've given us the solution that you're trying to implement,
but you haven't told what problem you're trying to solve.]
junj...@gmail.com wrote:
Hi,
Please tell me how could I have a #$B!J(Bsharp sign) expanded in the
macro such as
#define INCLUDE(filename) #include <filename>
As mentioned in K&R Reference Manual the definition of macro (Section
A12.3) is
# define identifier token-sequence
Definition of token (section A2.1) says tokens have six classes:
identifiers, keywords,constants,string literals,
operators and other separators
# wont be in any of these.
I tried using trigraphs but the same problem occurs.
which could do the expand below to include a file
INCLUDE(stdio.h) =#include <stdio.h>
You can't, but you can do things like...
#INCLUDE(X) <X>
#include INCLUDE(stdio.h)
--
Peter
ju*****@gmail.com wrote On 04/16/07 23:54,:
Hi,
Please tell me how could I have a #$B!J(Bsharp sign) expanded in the
macro such as
#define INCLUDE(filename) #include <filename>
which could do the expand below to include a file
INCLUDE(stdio.h) =#include <stdio.h>
C's preprocessor will not do this: macro expansion cannot
generate a preprocessor directive, even if the expansion happens
to resemble one.
If you really must have this effect, you'll need to run
your "C-ish" source through some other preprocessing program
before feeding it to a C compiler.
-- Er*********@sun.com
On Apr 16, 10:54 pm, junj...@gmail.com wrote:
Hi,
Please tell me how could I have a #$B!J(Bsharp sign) expanded in the
macro such as
#define INCLUDE(filename) #include <filename>
which could do the expand below to include a file
INCLUDE(stdio.h) =#include <stdio.h>
Thank you in advance!
You can't define a macro that expands into a preprocessor directive
and have it be recognized as such. All preprocessor directives are
processed before any macro expansion takes place.
If you want to parameterize include files, you'll have to use some
other method.
On Apr 16, 11:28 pm, junj...@gmail.com wrote:
Thansk for your advice.
I am just tyring to implement a API Framework Specification which
requires the INCLUDE macro to be defined.
[...]
Please tell me how could I have a #$B!J(Bsharp sign) expanded in the
macro such as
#define INCLUDE(filename) #include <filename>
which could do the expand below to include a file
INCLUDE(stdio.h) =#include <stdio.h>
As other have said, can't be done.
You _can_ do something like this:
#if SYSTEM_TYPE == 3
#define SYSTEM_HEADER "system_3.h"
#else
#define SYSTEM_HEADER "system_default.h"
#endif
...
#include SYSTEM_HEADER
But I'm not sure that helps.
Regards,
-=Dave
quarkLore <agarwal.prat...@gmail.comwrote:
junj...@gmail.com wrote:
junj...@gmail.com wrote:
Hi,
Please tell me how could I have a #$B!J(Bsharp sign) expanded in the
macro such as
#define INCLUDE(filename) #include <filename>
I am just tyring to implement a API Framework Specification which
requires the INCLUDE macro to be defined.
As mentioned in K&R Reference Manual the definition of macro (Section
A12.3) is
# define identifier token-sequence
Definition of token (section A2.1) says tokens have six classes:
identifiers, keywords,constants,string literals,
operators and other separators
# wont be in any of these.
Which suggests either the reference manual has an error, or you are
misreading it.
N1124 distinguishes between preprocessing tokens and tokens:
preprocessing-token:
header-name
identifier
pp-number
character-constant
string-literal
punctuator
each non-white-space character that cannot be one of the above
In particular, # and ## are punctuators.
I tried using trigraphs but the same problem occurs.
That's because they are removed in translation phase 1, whereas
preprocessing
directives aren't processed until translation phase 4.
--
Peter
[Please don't top-post.]
Peter Nilsson <a...@acay.com.auwrote:
[You've given us the solution that you're trying to
implement, but you haven't told what problem you're
trying to solve.]
<snip>
junj...@gmail.com wrote:
Thansk for your advice.
I am just tyring to implement a API Framework Specification which
requires the INCLUDE macro to be defined.
You have a problem, let's call it X.
You think the solution is Z, but you can't get Z to work.
Without telling us what X is, you ask us how to fix Z.
We tell you that you can't do Z and ask what X is.
You still don't tell us what X is, only that X requires Z.
In other words, you're still just telling me that you have a problem
without
telling me what the problem is.
Why does this so-called API Framework require you to define an INCLUDE
macro? What _problem_ is the INCLUDE macro supposed to solve?
What situation are you faced with that can't be solved using the
normal
conditional inclusion methods?
Samples would be nice. We don't need 10000 pages of specification,
just
the task at hand.
--
Peter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Andrew Dalke |
last post by:
Here's a proposed Q&A for the FAQ based on a couple recent
threads. Appropriate comments appreciated
X.Y: Why doesn't Python have macros like in Lisp or Scheme?
Before answering that, a...
|
by: mike420 |
last post by:
I think everyone who used Python will agree that its syntax is
the best thing going for it. It is very readable and easy
for everyone to learn. But, Python does not a have very good
macro...
|
by: Pete |
last post by:
In Access 95/97 I used to be able to create pull down menus (File,Edit
...) from a macro. It seems there used to be some wizard for that.
However in Access 2000 it seems you have to build your...
|
by: Newbie_sw2003 |
last post by:
Where should I use them?
I am giving you my understandings. Please correct me if I am wrong:
MACRO:
e.g.:#define ref-name 99
The code is substituted by the MACRO ref-name. So no overhead....
|
by: Alexander Ulyanov |
last post by:
Hi all.
Is it possible to pass the whole blocks of code (possibly including
" and ,) as macro parameters?
I want to do something like:
MACRO(FOO, "Foo",
"return "Foobar";",
"foo();...
|
by: lasek |
last post by:
Hi...in some posts i've read...something about using macro rather then
function...but difference ??.
Best regards....
|
by: Laurent Deniau |
last post by:
I was playing a bit with the preprocessor of gcc (4.1.1). The following
macros expand to:
#define A(...) __VA_ARGS__
#define B(x,...) __VA_ARGS__
A() -nothing, *no warning*
A(x) -x
...
|
by: Takeadoe |
last post by:
Dear NG,
Can someone assist me with writing the little code that is needed to
run an update table query each time the database is opened? From what
I've been able to glean from this group, the...
|
by: Bill |
last post by:
This database has no forms. I am viewing an Access table in datasheet
view. I'd like to execute a macro to execute a function (using
"runcode"). In the function, I'll reading data from the record...
|
by: =?Utf-8?B?TGV0emRvXzF0?= |
last post by:
I'd like to create a Macro that will sort some raw data, apprx 20k lines,
remove some lines based upon a condition in a certain column. Then copy this
data into a new spreadsheet and sort the ...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |