Exemple #1
0
void HeapRegionSetBase::print_on(outputStream* out, bool print_contents) {
  out->cr();
  out->print_cr("Set: %s (" PTR_FORMAT ")", name(), p2i(this));
  out->print_cr("  Region Assumptions");
  out->print_cr("    humongous         : %s", BOOL_TO_STR(regions_humongous()));
  out->print_cr("    free              : %s", BOOL_TO_STR(regions_free()));
  out->print_cr("  Attributes");
  out->print_cr("    length            : %14u", length());
}
void HeapRegionSetBase::print_on(outputStream* out, bool print_contents) {
  out->cr();
  out->print_cr("Set: %s ("PTR_FORMAT")", name(), this);
  out->print_cr("  Region Assumptions");
  out->print_cr("    humongous         : %s", BOOL_TO_STR(regions_humongous()));
  out->print_cr("    empty             : %s", BOOL_TO_STR(regions_empty()));
  out->print_cr("  Attributes");
  out->print_cr("    length            : %14u", length());
  out->print_cr("    total capacity    : "SIZE_FORMAT_W(14)" bytes",
                total_capacity_bytes());
}
Exemple #3
0
static void
s_check_cancelled(mccp_thread_t *thread, bool require) {
  bool canceled = !require;
  mccp_result_t ret = MCCP_RESULT_ANY_FAILURES;
  if ((ret = mccp_thread_is_canceled(thread, &canceled))
      != MCCP_RESULT_OK) {
    mccp_perror(ret, "mccp_thread_is_canceled()");
    mccp_msg_error("Can't check is_cancelled.\n");
  } else if (canceled != require) {
    mccp_msg_error(
      "is_cancelled() required %s, but %s.\n",
      BOOL_TO_STR(require), BOOL_TO_STR(canceled));
  }
}
Exemple #4
0
static void
s_check_cancelled(lagopus_thread_t *thread, bool require) {
  bool canceled = !require;
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  if ((ret = lagopus_thread_is_canceled(thread, &canceled))
      != LAGOPUS_RESULT_OK) {
    lagopus_perror(ret);
    lagopus_msg_error("Can't check is_cancelled.\n");
  } else if (canceled != require) {
    lagopus_msg_error(
      "is_cancelled() required %s, but %s.\n",
      BOOL_TO_STR(require), BOOL_TO_STR(canceled));
  }
}
Exemple #5
0
static void got_usr1(int z)
{
  debug_dv(("_____ RECEIVED SIGUSR1 _____ [signal_handler=%s]",
	   BOOL_TO_STR(signal_handler)));
  if (signal_handler)			/* default action */
    netcat_printstats(TRUE);
  else
    got_sigusr1 = TRUE;
}
Exemple #6
0
static void got_term(int z)
{
  if (!got_sigterm)
    ncprint(NCPRINT_VERB1, _("Terminated."));
  debug_v(("_____ RECEIVED SIGTERM _____ [signal_handler=%s]",
	  BOOL_TO_STR(signal_handler)));
  got_sigterm = TRUE;
  if (signal_handler)			/* default action */
    exit(EXIT_FAILURE);
}
Exemple #7
0
static void got_int(int z)
{
  if (!got_sigint)
    ncprint(NCPRINT_VERB1, _("Exiting."));
  debug_v(("_____ RECEIVED SIGINT _____ [signal_handler=%s]",
	  BOOL_TO_STR(signal_handler)));
  got_sigint = TRUE;
  if (signal_handler) {			/* default action */
    if (commandline_need_newline)	/* if we were waiting for input */
      printf("\n");
    netcat_printstats(FALSE);
    exit(EXIT_FAILURE);
  }
}
Exemple #8
0
size_t ContiguousSpace::block_size(const HeapWord* p) const {
  assert(MemRegion(bottom(), end()).contains(p),
         err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
                  p, bottom(), end()));
  HeapWord* current_top = top();
  assert(p <= current_top,
         err_msg("p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT,
                  p, current_top));
  assert(p == current_top || oop(p)->is_oop(),
         err_msg("p (" PTR_FORMAT ") is not a block start - "
                 "current_top: " PTR_FORMAT ", is_oop: %s",
                 p, current_top, BOOL_TO_STR(oop(p)->is_oop())));
  if (p < current_top) {
    return oop(p)->size();
  } else {
    assert(p == current_top, "just checking");
    return pointer_delta(end(), (HeapWord*) p);
  }
}
void G1AllocRegion::fill_in_ext_msg(ar_ext_msg* msg, const char* message) {
  msg->append("[%s] %s c: %u b: %s r: "PTR_FORMAT" u: "SIZE_FORMAT,
              _name, message, _count, BOOL_TO_STR(_bot_updates),
              p2i(_alloc_region), _used_bytes_before);
}
Exemple #10
0
static void
s_finalize_proc(mccp_thread_t *selfptr,
                bool is_canceled, void *arg) {
  mccp_msg("Called with (%p, %s, %p)\n",
           *selfptr, BOOL_TO_STR(is_canceled), arg);
}
Exemple #11
0
/*!
 * \qmlmethod string GLStateDumpExt::getGLStateDump(stateDumpEnums options)
 * \return OpenGL driver state with given options as a human readable string that can be printed.
 * Optional paremeter \a options may contain bitfields masked together from following options:
 * \list
 * \li \c{GLStateDumpExt.DUMP_BASIC_ONLY} Includes only very basic OpenGL state information.
 * \li \c{GLStateDumpExt.DUMP_VERTEX_ATTRIB_ARRAYS_BIT} Includes all vertex attribute array
 * information.
 * \li \c{GLStateDumpExt.DUMP_VERTEX_ATTRIB_ARRAYS_BUFFERS_BIT} Includes size and type
 * from all currently active vertex attribute arrays (including the currently bound element array)
 * to verify that there are actual values in the array.
 * \li \c{GLStateDumpExt.DUMP_FULL} Includes everything.
 * \endlist
 */
QString CanvasGLStateDump::getGLStateDump(CanvasGLStateDump::stateDumpEnums options)
{
#if !defined(QT_OPENGL_ES_2)
    GLint drawFramebuffer;
    GLint readFramebuffer;
    GLboolean polygonOffsetLineEnabled;
    GLboolean polygonOffsetPointEnabled;
    GLint boundVertexArray;
#endif

    QString stateDumpStr;
    GLint renderbuffer;
    GLfloat clearColor[4];
    GLfloat clearDepth;
    GLboolean isBlendingEnabled = glIsEnabled(GL_BLEND);
    GLboolean isDepthTestEnabled = glIsEnabled(GL_DEPTH_TEST);
    GLint depthFunc;
    GLboolean isDepthWriteEnabled;
    GLint currentProgram;
    GLint *vertexAttribArrayEnabledStates = new GLint[m_maxVertexAttribs];
    GLint *vertexAttribArrayBoundBuffers = new GLint[m_maxVertexAttribs];
    GLint *vertexAttribArraySizes = new GLint[m_maxVertexAttribs];
    GLint *vertexAttribArrayTypes = new GLint[m_maxVertexAttribs];
    GLint *vertexAttribArrayNormalized = new GLint[m_maxVertexAttribs];
    GLint *vertexAttribArrayStrides = new GLint[m_maxVertexAttribs];
    GLint activeTexture;
    GLint texBinding2D;
    GLint arrayBufferBinding;
    GLint frontFace;
    GLboolean isCullFaceEnabled = glIsEnabled(GL_CULL_FACE);
    GLint cullFaceMode;
    GLint blendEquationRGB;
    GLint blendEquationAlpha;

    GLint blendDestAlpha;
    GLint blendDestRGB;
    GLint blendSrcAlpha;
    GLint blendSrcRGB;
    GLint scissorBox[4];
    GLboolean isScissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST);
    GLint boundElementArrayBuffer;
    GLboolean polygonOffsetFillEnabled;
    GLfloat polygonOffsetFactor;
    GLfloat polygonOffsetUnits;

#if !defined(QT_OPENGL_ES_2)
    if (!m_isOpenGLES2) {
        glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &drawFramebuffer);
        glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &readFramebuffer);
        glGetBooleanv(GL_POLYGON_OFFSET_LINE, &polygonOffsetLineEnabled);
        glGetBooleanv(GL_POLYGON_OFFSET_POINT, &polygonOffsetPointEnabled);
        glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &boundVertexArray);
    }
#endif

    glGetBooleanv(GL_DEPTH_WRITEMASK, &isDepthWriteEnabled);
    glGetIntegerv(GL_RENDERBUFFER_BINDING, &renderbuffer);
    glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor);
    glGetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth);
    glGetIntegerv(GL_DEPTH_FUNC, &depthFunc);
    glGetBooleanv(GL_POLYGON_OFFSET_FILL, &polygonOffsetFillEnabled);
    glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &polygonOffsetFactor);
    glGetFloatv(GL_POLYGON_OFFSET_UNITS, &polygonOffsetUnits);

    glGetIntegerv(GL_CURRENT_PROGRAM, &currentProgram);
    glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTexture);
    glGetIntegerv(GL_TEXTURE_BINDING_2D, &texBinding2D );
    glGetIntegerv(GL_FRONT_FACE, &frontFace);
    glGetIntegerv(GL_CULL_FACE_MODE, &cullFaceMode);
    glGetIntegerv(GL_BLEND_EQUATION_RGB, &blendEquationRGB);
    glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &blendEquationAlpha);
    glGetIntegerv(GL_BLEND_DST_ALPHA, &blendDestAlpha);
    glGetIntegerv(GL_BLEND_DST_RGB, &blendDestRGB);
    glGetIntegerv(GL_BLEND_SRC_ALPHA, &blendSrcAlpha);
    glGetIntegerv(GL_BLEND_SRC_RGB, &blendSrcRGB);
    glGetIntegerv(GL_SCISSOR_BOX, scissorBox);
    glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &boundElementArrayBuffer);
    glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &arrayBufferBinding);

#if !defined(QT_OPENGL_ES_2)
    if (!m_isOpenGLES2) {
        stateDumpStr.append("GL_DRAW_FRAMEBUFFER_BINDING.....");
        stateDumpStr.append(QString::number(drawFramebuffer));
        stateDumpStr.append("\n");

        stateDumpStr.append("GL_READ_FRAMEBUFFER_BINDING.....");
        stateDumpStr.append(QString::number(readFramebuffer));
        stateDumpStr.append("\n");
    }
#endif

    stateDumpStr.append("GL_RENDERBUFFER_BINDING.........");
    stateDumpStr.append(QString::number(renderbuffer));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_SCISSOR_TEST.................");
    stateDumpStr.append(BOOL_TO_STR(isScissorTestEnabled));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_SCISSOR_BOX..................");
    stateDumpStr.append(QString::number(scissorBox[0]));
    stateDumpStr.append(", ");
    stateDumpStr.append(QString::number(scissorBox[1]));
    stateDumpStr.append(", ");
    stateDumpStr.append(QString::number(scissorBox[2]));
    stateDumpStr.append(", ");
    stateDumpStr.append(QString::number(scissorBox[3]));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_COLOR_CLEAR_VALUE............");
    stateDumpStr.append("r:");
    stateDumpStr.append(QString::number(clearColor[0]));
    stateDumpStr.append(" g:");
    stateDumpStr.append(QString::number(clearColor[1]));
    stateDumpStr.append(" b:");
    stateDumpStr.append(QString::number(clearColor[2]));
    stateDumpStr.append(" a:");
    stateDumpStr.append(QString::number(clearColor[3]));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_DEPTH_CLEAR_VALUE............");
    stateDumpStr.append(QString::number(clearDepth));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_BLEND........................");
    stateDumpStr.append(BOOL_TO_STR(isBlendingEnabled));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_BLEND_EQUATION_RGB...........");
    stateDumpStr.append(m_map->lookUp(blendEquationRGB));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_BLEND_EQUATION_ALPHA.........");
    stateDumpStr.append(m_map->lookUp(blendEquationAlpha));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_DEPTH_TEST...................");
    stateDumpStr.append(BOOL_TO_STR(isDepthTestEnabled));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_DEPTH_FUNC...................");
    stateDumpStr.append(m_map->lookUp(depthFunc));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_DEPTH_WRITEMASK..............");
    stateDumpStr.append(BOOL_TO_STR(isDepthWriteEnabled));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_POLYGON_OFFSET_FILL..........");
    stateDumpStr.append(BOOL_TO_STR(polygonOffsetFillEnabled));
    stateDumpStr.append("\n");

#if !defined(QT_OPENGL_ES_2)
    if (!m_isOpenGLES2) {
        stateDumpStr.append("GL_POLYGON_OFFSET_LINE..........");
        stateDumpStr.append(BOOL_TO_STR(polygonOffsetLineEnabled));
        stateDumpStr.append("\n");

        stateDumpStr.append("GL_POLYGON_OFFSET_POINT.........");
        stateDumpStr.append(BOOL_TO_STR(polygonOffsetPointEnabled));
        stateDumpStr.append("\n");
    }
#endif

    stateDumpStr.append("GL_POLYGON_OFFSET_FACTOR........");
    stateDumpStr.append(QString::number(polygonOffsetFactor));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_POLYGON_OFFSET_UNITS.........");
    stateDumpStr.append(QString::number(polygonOffsetUnits));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_CULL_FACE....................");
    stateDumpStr.append(BOOL_TO_STR(isCullFaceEnabled));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_CULL_FACE_MODE...............");
    stateDumpStr.append(m_map->lookUp(cullFaceMode));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_FRONT_FACE...................");
    stateDumpStr.append(m_map->lookUp(frontFace));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_CURRENT_PROGRAM..............");
    stateDumpStr.append(QString::number(currentProgram));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_ACTIVE_TEXTURE...............");
    stateDumpStr.append(m_map->lookUp(activeTexture));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_TEXTURE_BINDING_2D...........");
    stateDumpStr.append(QString::number(texBinding2D));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_ELEMENT_ARRAY_BUFFER_BINDING.");
    stateDumpStr.append(QString::number(boundElementArrayBuffer));
    stateDumpStr.append("\n");

    stateDumpStr.append("GL_ARRAY_BUFFER_BINDING.........");
    stateDumpStr.append(QString::number(arrayBufferBinding));
    stateDumpStr.append("\n");

#if !defined(QT_OPENGL_ES_2)
    if (!m_isOpenGLES2) {
        stateDumpStr.append("GL_VERTEX_ARRAY_BINDING.........");
        stateDumpStr.append(QString::number(boundVertexArray));
        stateDumpStr.append("\n");
    }
#endif

    if (options && DUMP_VERTEX_ATTRIB_ARRAYS_BIT) {
        for (int i = 0; i < m_maxVertexAttribs; i++) {
            glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &vertexAttribArrayEnabledStates[i]);
            glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, &vertexAttribArrayBoundBuffers[i]);
            glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_SIZE, &vertexAttribArraySizes[i]);
            glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_TYPE, &vertexAttribArrayTypes[i]);
            glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &vertexAttribArrayNormalized[i]);
            glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &vertexAttribArrayStrides[i]);
        }


        for (int i = 0; i < m_maxVertexAttribs; i++) {
            stateDumpStr.append("GL_VERTEX_ATTRIB_ARRAY_");
            stateDumpStr.append(QString::number(i));
            stateDumpStr.append("\n");

            stateDumpStr.append("GL_VERTEX_ATTRIB_ARRAY_ENABLED.........");
            stateDumpStr.append(BOOL_TO_STR(vertexAttribArrayEnabledStates[i]));
            stateDumpStr.append("\n");

            stateDumpStr.append("GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING..");
            stateDumpStr.append(QString::number(vertexAttribArrayBoundBuffers[i]));
            stateDumpStr.append("\n");

            stateDumpStr.append("GL_VERTEX_ATTRIB_ARRAY_SIZE............");
            stateDumpStr.append(QString::number(vertexAttribArraySizes[i]));
            stateDumpStr.append("\n");

            stateDumpStr.append("GL_VERTEX_ATTRIB_ARRAY_TYPE............");
            stateDumpStr.append(m_map->lookUp(vertexAttribArrayTypes[i]));
            stateDumpStr.append("\n");

            stateDumpStr.append("GL_VERTEX_ATTRIB_ARRAY_NORMALIZED......");
            stateDumpStr.append(QString::number(vertexAttribArrayNormalized[i]));
            stateDumpStr.append("\n");

            stateDumpStr.append("GL_VERTEX_ATTRIB_ARRAY_STRIDE..........");
            stateDumpStr.append(QString::number(vertexAttribArrayStrides[i]));
            stateDumpStr.append("\n");
        }
    }

    if (options && DUMP_VERTEX_ATTRIB_ARRAYS_BUFFERS_BIT) {
        if (boundElementArrayBuffer != 0) {
            stateDumpStr.append("GL_ELEMENT_ARRAY_BUFFER................");
            stateDumpStr.append(QString::number(boundElementArrayBuffer));
            stateDumpStr.append("\n");

            stateDumpStr.append(getGLArrayObjectDump(GL_ELEMENT_ARRAY_BUFFER,
                                boundElementArrayBuffer,
                                GL_UNSIGNED_SHORT));
        }

        for (int i = 0; i < m_maxVertexAttribs; i++) {
            if (vertexAttribArrayEnabledStates[i]) {
                stateDumpStr.append("GL_ARRAY_BUFFER........................");
                stateDumpStr.append(QString::number(vertexAttribArrayBoundBuffers[i]));
                stateDumpStr.append("\n");

                stateDumpStr.append(getGLArrayObjectDump(GL_ARRAY_BUFFER,
                                    vertexAttribArrayBoundBuffers[i],
                                    vertexAttribArrayTypes[i]));
            }
        }
    }


    delete[] vertexAttribArrayEnabledStates;
    delete[] vertexAttribArrayBoundBuffers;
    delete[] vertexAttribArraySizes;
    delete[] vertexAttribArrayTypes;
    delete[] vertexAttribArrayNormalized;
    delete[] vertexAttribArrayStrides;

    return stateDumpStr;
}
Exemple #12
0
static void write_config_value_bool(const char *filename, const char *section, const char *key, const bool value) {
    if (ini_puts(section, key, BOOL_TO_STR(value), filename) != 1) {
        LOG_ERR("Settings", "Unable to save config value: %s.", value);
    }
}
Exemple #13
0
 friend std::ostream& operator<<(std::ostream& os, const Tile& t) {
     os << "X: " << t.x << " Y: " << t.y << " FLOOR: " << t.floor_tile << "\n";
     os << "vis: " << BOOL_TO_STR(t.visible) << "occ " << BOOL_TO_STR(t.occupied) << " pas: " << BOOL_TO_STR(t.passable); 
     return os; 
 }
Exemple #14
0
//TODO this is horrible
void ps2_init() {
    if(acpi_tables_loaded()) {
        kprintf("checking acpi for ps2 controller\n");
        _ps2_available = acpi_fadt_has_8042();
    } else {
        kprintf("no acpi. assuming ps2 controller\n");
        _ps2_available = true;
    }

    if(ps2_probe()) {
        kprintf("ps2 controller responding\n");
        _ps2_available = true;
    }

    if(!_ps2_available) {
        kprintf("ps2 controller absent\n");
        return;
    }

    kprintf("ps2 controller present\n");

    ps2_write_command(disable_first_ps2_port);
    ps2_write_command(disable_second_ps2_port);

    ps2_flush_output_buffer();

    ps2_ctrl_cfg_t config = ps2_read_config();
    bool is_dual_channel = PS2_CTRL_CFG_GET_2ND_PS2_CLOCK_DISABLE(config) != 0 ?  true : false;
    kprintf("ps2 config: 0x%hhx dual_channel=%s\n", config, BOOL_TO_STR(is_dual_channel));
    config = PS2_CTRL_CFG_SET_1ST_PS2_INT_ENABLE(config, 0);
    config = PS2_CTRL_CFG_SET_2ND_PS2_INT_ENABLE(config, 0);
    config = PS2_CTRL_CFG_SET_1ST_PS2_TRANSLATION_ENABLE(config, 0);
    ps2_write_config(config);

    ps2_write_command(test_first_ps2_port);
    ps2_wait_output_buffer_sync();

    // should be 0
    uint8_t first_port_response;
    uint8_t second_port_response;

    first_port_response = ps2_read_data();
    kprintf("ps2 port 0 test result: 0x%hhx\n", first_port_response);

    if(is_dual_channel) {
        ps2_write_command(test_second_ps2_port);
        ps2_wait_output_buffer_sync();
        second_port_response = ps2_read_data();
        kprintf("ps2 port 1 test result: 0x%hhx\n", second_port_response);
    }

    if(first_port_response == 0) {
        ps2_write_command(enable_first_ps2_port);

        config = ps2_read_config();
        config = PS2_CTRL_CFG_SET_1ST_PS2_INT_ENABLE(config, 1);
        ps2_write_config(config);
    }

    if(is_dual_channel && second_port_response == 0) {
        ps2_write_command(enable_second_ps2_port);

        config = ps2_read_config();
        config = PS2_CTRL_CFG_SET_2ND_PS2_INT_ENABLE(config, 1);
        ps2_write_config(config);
    }

    kprintf("installing ps2 keyboard irq handler\n");
    hal_install_irq_handler(_kbd_irq, ps2_kbd_interrupt_handler, ps2_kbd_thread, "ps2_kbd", NULL);
}