P macro

The code below produces this for output:

This is some text . . .
This is some more text.

The "P Macro" seems to be an integral part of the Arduino "language".
Note that no libraries are included in this sketch.

I'm not exacly sure why this sketch works (i.e. the P part)

Where can I learn more about "P" ?
All I know came from studying the Webduino library.
A basic web seach has not produced any useful results for me.

As usual, sorry if this question is too basic.

Thanks,
Bob W

#define P(name)   static const prog_uchar name[] PROGMEM

P(signMessage) = "This is some text . . . ";


void setup() 
{
  Serial.begin(9600);
  printP(signMessage);
  printCRLF();
  P(signMessage) = "This is some more text.";
  printP(signMessage);
}


void loop() {
}



void printP(const prog_uchar *str)
{
  // copy data out of program memory into local storage, write out in
  // chunks of 32 bytes to avoid extra short TCP/IP packets
  uint8_t buffer[32];
  size_t bufferEnd = 0;

  while (buffer[bufferEnd++] = pgm_read_byte(str++))
  {
    if (bufferEnd == 32)
    {
      Serial.write(buffer, 32);
      bufferEnd = 0;
    }
  }

  // write out everything left but trailing NUL
  if (bufferEnd > 1)
    Serial.write(buffer, bufferEnd - 1);
}



void printCRLF()
{
  Serial.write((const uint8_t *)"\r\n", 2);
}

I do know the F macro e.g. - Arduino Forum -

P is a macro, defined at the top of your sketch

#define P(name)   static const prog_uchar name[] PROGMEM

P gets replaced by whatever it is defined as, so

P(signMessage) = "This is some text . . . ";

gets changed to

static const prog_uchar signMessage[] PROGMEM = "This is some text . . . ";

Please be ware that the IDE will automatically, depending upon the version, add an include of "WProgram.h" or "Arduino.h" if you don not.

I just inferred that the P was something special because the IDE makes the "P" in the define line of the sketch RED in color, as if it were a keyword.

I got suckered by this.

This does not happen if I change name of macro to "Q", or "R".
Why would this be ?

Bob

PS: What I am trying to accomplish is to send a big block of HTML to my Arduino Web Server, without using many individual client.print("html code") lines.

majenko:
P is a macro, defined at the top of your sketch

#define P(name)   static const prog_uchar name[] PROGMEM

P gets replaced by whatever it is defined as, so

P(signMessage) = "This is some text . . . ";

gets changed to

static const prog_uchar signMessage[] PROGMEM = "This is some text . . . ";

BobW:
I just inferred that the P was something special because the IDE makes the "P" in the define line of the sketch RED in color, as if it were a keyword.

I got suckered by this.

This does not happen if I change name of macro to "Q", or "R".
Why would this be ?

Because P will be defined in one of the many keywords.txt files?