Пример #1
0
void Flag::print_as_flag(outputStream* st) {
  if (is_bool()) {
    st->print("-XX:%s%s", get_bool() ? "+" : "-", name);
  } else if (is_intx()) {
    st->print("-XX:%s=" INTX_FORMAT, name, get_intx());
  } else if (is_uintx()) {
    st->print("-XX:%s=" UINTX_FORMAT, name, get_uintx());
  } else if (is_uint64_t()) {
    st->print("-XX:%s=" UINT64_FORMAT, name, get_uint64_t());
  } else if (is_double()) {
    st->print("-XX:%s=%f", name, get_double());
  } else if (is_ccstr()) {
    st->print("-XX:%s=", name);
    const char* cp = get_ccstr();
    if (cp != NULL) {
      // Need to turn embedded '\n's back into separate arguments
      // Not so efficient to print one character at a time,
      // but the choice is to do the transformation to a buffer
      // and print that.  And this need not be efficient.
      for (; *cp != '\0'; cp += 1) {
        switch (*cp) {
          default:
            st->print("%c", *cp);
            break;
          case '\n':
            st->print(" -XX:%s=", name);
            break;
        }
      }
    }
  } else {
    ShouldNotReachHere();
  }
}
Пример #2
0
void Flag::print_on(outputStream* st, bool withComments) {
  st->print("%9s %-40s %c= ", type, name, (origin != DEFAULT ? ':' : ' '));
  if (is_bool())     st->print("%-16s", get_bool() ? "true" : "false");
  if (is_intx())     st->print("%-16ld", get_intx());
  if (is_uintx())    st->print("%-16lu", get_uintx());
  if (is_uint64_t()) st->print("%-16lu", get_uint64_t());
  if (is_double())   st->print("%-16f", get_double());

  if (is_ccstr()) {
     const char* cp = get_ccstr();
     if (cp != NULL) {
       const char* eol;
       while ((eol = strchr(cp, '\n')) != NULL) {
         char format_buffer[FORMAT_BUFFER_LEN];
         size_t llen = pointer_delta(eol, cp, sizeof(char));
         jio_snprintf(format_buffer, FORMAT_BUFFER_LEN,
                     "%%." SIZE_FORMAT "s", llen);
         st->print(format_buffer, cp);
         st->cr();
         cp = eol+1;
         st->print("%5s %-35s += ", "", name);
       }
       st->print("%-16s", cp);
     }
     else st->print("%-16s", "");
  }
  st->print("%-20s", kind);
  if (withComments) {
#ifndef PRODUCT
    st->print("%s", doc );
#endif
  }
  st->cr();
}
PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
void Flag::print_on(outputStream* st, bool withComments) {
  // Don't print notproduct and develop flags in a product build.
  if (is_constant_in_binary()) {
    return;
  }

  st->print("%9s %-40s %c= ", _type, _name, (!is_default() ? ':' : ' '));

  if (is_bool()) {
    st->print("%-16s", get_bool() ? "true" : "false");
  }
  if (is_intx()) {
    st->print("%-16ld", get_intx());
  }
  if (is_uintx()) {
    st->print("%-16lu", get_uintx());
  }
  if (is_uint64_t()) {
    st->print("%-16lu", get_uint64_t());
  }
  if (is_double()) {
    st->print("%-16f", get_double());
  }
  if (is_ccstr()) {
    const char* cp = get_ccstr();
    if (cp != NULL) {
      const char* eol;
      while ((eol = strchr(cp, '\n')) != NULL) {
        char format_buffer[FORMAT_BUFFER_LEN];
        size_t llen = pointer_delta(eol, cp, sizeof(char));
        jio_snprintf(format_buffer, FORMAT_BUFFER_LEN,
            "%%." SIZE_FORMAT "s", llen);
PRAGMA_DIAG_PUSH
PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
        st->print(format_buffer, cp);
PRAGMA_DIAG_POP
        st->cr();
        cp = eol+1;
        st->print("%5s %-35s += ", "", _name);
      }
      st->print("%-16s", cp);
    }
    else st->print("%-16s", "");
  }

  st->print("%-20s", " ");
  print_kind(st);

  if (withComments) {
#ifndef PRODUCT
    st->print("%s", _doc);
#endif
  }
  st->cr();
}
Пример #4
0
int main (int argc, char **argv) {
   (void) argc; // warning: unused parameter 'argc'
   execname = basename (argv[0]);

   // Declare the box and initialize it.
   intx *box = new_intx();
   printf ("box = %p\n", box);

   // Perform a couple of operations on it.
   put_intx (box, 1024);
   printf ("box value is %d\n", get_intx (box));

   // Free up the box and set the handle to NULL to avoid a dangle.
   free_intx (box);
   box = NULL;

   return EXIT_SUCCESS;
}
Пример #5
0
Файл: main.c Проект: estk/cs12b
int main (int argc, char **argv) {
   argc = argc; // Avoid:16: warning: unused parameter 'argc'
   execname = basename (argv[0]);
   say_when ("starting");

   /* Declare the box and initialize it.  */
   intx_ref box = new_intx();
   printf ("box = %p\n", box);

   /* Perform a couple of operations on it.  */
   put_intx (box, 1024);
   printf ("box value is %d\n", get_intx (box));

   /* Free up the box and set the handle to NULL to avoid a dangle. */
   free_intx (box);
   box = NULL;

   /* OK! */
   say_when ("finished");
   return EXIT_SUCCESS;
}
Пример #6
0
void Flag::print_on(outputStream* st, bool withComments, bool printRanges) {
  // Don't print notproduct and develop flags in a product build.
  if (is_constant_in_binary()) {
    return;
  }

  if (!printRanges) {

    st->print("%9s %-40s %c= ", _type, _name, (!is_default() ? ':' : ' '));

    if (is_bool()) {
      st->print("%-16s", get_bool() ? "true" : "false");
    } else if (is_int()) {
      st->print("%-16d", get_int());
    } else if (is_uint()) {
      st->print("%-16u", get_uint());
    } else if (is_intx()) {
      st->print(INTX_FORMAT_W(-16), get_intx());
    } else if (is_uintx()) {
      st->print(UINTX_FORMAT_W(-16), get_uintx());
    } else if (is_uint64_t()) {
      st->print(UINT64_FORMAT_W(-16), get_uint64_t());
    } else if (is_size_t()) {
      st->print(SIZE_FORMAT_W(-16), get_size_t());
    } else if (is_double()) {
      st->print("%-16f", get_double());
    } else if (is_ccstr()) {
      const char* cp = get_ccstr();
      if (cp != NULL) {
        const char* eol;
        while ((eol = strchr(cp, '\n')) != NULL) {
          size_t llen = pointer_delta(eol, cp, sizeof(char));
          st->print("%.*s", (int)llen, cp);
          st->cr();
          cp = eol+1;
          st->print("%5s %-35s += ", "", _name);
        }
        st->print("%-16s", cp);
      }
      else st->print("%-16s", "");
    }

    st->print("%-20s", " ");
    print_kind(st);

#ifndef PRODUCT
    if (withComments) {
      st->print("%s", _doc);
    }
#endif

    st->cr();

  } else if (!is_bool() && !is_ccstr()) {

    if (printRanges) {

      st->print("%9s %-50s ", _type, _name);

      CommandLineFlagRangeList::print(_name, st, true);

      st->print(" %-20s", " ");
      print_kind(st);

#ifndef PRODUCT
      if (withComments) {
        st->print("%s", _doc);
      }
#endif

      st->cr();

    }
  }
}