pike.git / src / cpp.cmod

version» Context lines:

pike.git/src/cpp.cmod:855:    *! have been installed globally, and might be used by    *! a Pike that has been started with the @tt{-V@} flag.    *!    *! @example    *! @code    *! // Pike modules that are bundled with Pike are    *! // typically written for the same version of Pike.    *! #pike __REAL_VERSION__    *! @endcode    */ +  PIKEFUN string(0..0) directive_pike(int flags, string line) +  { +  struct CPP_struct *this = THIS;    -  +  if (OUTP()) { +  int major, minor; +  ptrdiff_t tmp; +  PCHARP ptr; +  +  string_builder_strcat(&this->buf, "#pike "); +  +  ref_push_string(line); +  push_int(CPP_DO_IF); +  apply_current(f_CPP_cpp_fun_num, 2); +  +  if (TYPEOF(Pike_sp[-1]) == PIKE_T_STRING) { +  line = Pike_sp[-1].u.string; +  +  ptr = MKPCHARP_STR(line); +  +  major = STRTOL_PCHARP(ptr, &ptr, 10); +  if(INDEX_PCHARP(ptr,0) == '.') +  { +  INC_PCHARP(ptr, 1); +  minor=STRTOL_PCHARP(ptr, &ptr, 10); +  cpp_change_compat(this, major, minor); +  }else{ +  cpp_error(this, "Missing '.' in #pike."); +  this->compat_minor=0; +  } +  +  /* NB: The parsed line is already in place on the stack. */ +  return; +  } else { +  cpp_error(this, "Invalid #pike directive."); +  } +  } +  +  push_empty_string(); +  } +    /*! @directive #""    *! If a string literal is opened with @tt{#"@} newlines in the    *! string will end up in the string literal, instead of triggering a    *! @tt{"newline in string"@} error.    *!    *! @note    *! Newlines will be converted to @tt{\n@} characters in the string    *! even if the newlines in the file are something else.    *!    *! This preprocessor directive may appear anywhere a string may
pike.git/src/cpp.cmod:4144:    }    /* FIXME: Is this the correct thing to return? */    return len;    } else {    cpp_error(this, "What charset?");    }    break;    }    goto unknown_preprocessor_directive;    } -  case 'p': /* pragma */ -  { -  if(GOBBLE_WORD(pike_)) -  { -  if(OUTP()) -  { -  int major, minor; -  ptrdiff_t tmp; -  PCHARP ptr; -  -  string_builder_strcat(&this->buf, "#pike"); -  tmp= this->buf.s->len; -  pos += low_cpp(this, ADD_PCHARP(data,pos), len-pos, -  CPP_END_AT_NEWLINE | CPP_DO_IF, -  charset); -  -  ptr=MKPCHARP_STR(this->buf.s); -  INC_PCHARP(ptr, tmp); -  -  /* Zero terminate the buffer contents here to make sure -  * that STRTOL_PCHARP does not read beyond the end of the -  * buffer */ -  string_builder_putchar(&this->buf, 0); -  this->buf.s->len--; -  -  major=STRTOL_PCHARP(ptr, &ptr, 10); -  if(INDEX_PCHARP(ptr,0) == '.') -  { -  INC_PCHARP(ptr, 1); -  minor=STRTOL_PCHARP(ptr, &ptr, 10); -  cpp_change_compat(this, major, minor); -  }else{ -  cpp_error(this, "Missing '.' in #pike."); -  this->compat_minor=0; -  } -  } -  else -  FIND_EOL(); -  break; -  } -  goto unknown_preprocessor_directive; -  } +     default:    unknown_preprocessor_directive:    {    struct pike_string *directive = GOBBLE_IDENTIFIER();    if (directive) {    struct svalue *fun = NULL;    struct svalue sv;    struct pike_string *directive_string =    add_shared_strings(MK_STRING("directive_"), directive);    int id = find_shared_string_identifier(directive_string,