小编Mat*_*gan的帖子

实模式组装:在引导时不使用INT指令将字符打印到屏幕

以下站点"编写引导扇区代码"提供了一个代码示例,可在系统引导时将"A"打印到屏幕上.从我一直在阅读的不是你必须使用INT操作码让BIOS做某些事情?以下代码如何从上面引用的站点工作而不使用中断?代码的哪一部分实际告诉硬件将"A"打印到屏幕上?

有问题的代码:

.code16
.section .text
.globl _start
_start:
  mov $0xb800, %ax
  mov %ax, %ds
  movb $'A', 0
  movb $0x1e, 1
idle:
  jmp idle 
Run Code Online (Sandbox Code Playgroud)

附加原始问题

如果我使用以下代码,BIOS调用是否会为我写入文本缓冲区?缓冲区从地址0xb800开始?

   # Author: Matthew Hoggan
   # Date Created: Tuesday, Mar 6, 2012
   .code16                        # Tell assembler to work in 16 bit mode (directive)
   .section .text
   .globl _start                  # Help linker find start of program
   _start:
       movb $0x0e,     %ah        # Function to print a character to the screen                 
       movb $0x00,     %bh        # Indicate the page …
Run Code Online (Sandbox Code Playgroud)

assembly bios bootloader

5
推荐指数
1
解决办法
2805
查看次数

错误:'类中没有名为'value_type'的类型

我收到以下编译器错误:

(graph_algorithms.h:59:111: error: no type named ‘value_type’ in ‘class Graph::graph_algorithms<int>::vertex_comparer’)

这是什么意思?

以下行给出了一大堆编译器错误

std::priority_queue<typename Graph::graph<U>::vertex, typename Graph::graph_algorithms<U>::vertex_comparer> pri_que;
Run Code Online (Sandbox Code Playgroud)
#ifndef GRAPH_ALGORIUHMS_H_
#define GRAPH_ALGORIUHMS_H_

#include <queue>
#include "graph.h"

namespace Graph
{
  template <class U>
  class graph_algorithms
  {
  // Forward declarations of 
  // internal classes
  private :
    class vertex_comparer;

  public :
    graph_algorithms(graph<U> &graph) :
      m_Graph(graph)
    {}  
  // List of algorithms to perform on graph
  typename std::queue<U> &find_key_breadth_first(U key);

  // Definition of internal classes
  private :
    class vertex_comparer
    {   
    public:
      bool operator()(typename graph<U>::vertex …
Run Code Online (Sandbox Code Playgroud)

c++ templates

5
推荐指数
1
解决办法
1万
查看次数

等效的OpenGL ES 2.0 void glBindFragDataLocation的方法(GLuint程序,GLuint colorNumber,const char*name);

http://www.khronos.org/opengles/sdk/docs/man/上的在线文档未提供该glBindFragDataLocation(GLuint program, GLuint colorNumber, const char * name);方法的参考.在OpenGL es 2.0中,这相当于什么?

opengl-es-2.0

5
推荐指数
1
解决办法
1294
查看次数

分配器中的每对象数据?

什么是"分配器中的每个对象数据".我似乎无法找到这意味着什么.任何人都有一个很好的解释或链接,这意味着C++语言的意义?


澄清

第19.4.2节"C++编程语言(特别版)"第2页.573

"同样,如果允许分配器完全通用,那么允许分配器分配任意类型元素的重新绑定机制必须更加精细.因此,假定标准分配器不保存每个对象数据和实现标准集装箱可以利用这一点."

c++ stl

4
推荐指数
1
解决办法
244
查看次数

C函数调用:理解"隐式int"规则

如果"a function"是单独编译的,那么就不会检测到不匹配,"函数"会返回一个main,它将main视为一个int ...根据我们所说的声明如何必须匹配定义,这可能会似乎令人惊讶.可能发生不匹配的原因是,如果没有函数原型,则函数通过其在表达式中的第一次出现来隐式声明,例如

    sum += "the function"(line);
Run Code Online (Sandbox Code Playgroud)

如果先前未声明的名称出现在表达式中并且后跟左括号,则上下文将其声明为函数名称,假定该函数返回int,并且不假设其参数.

我事先为这个含糊不清的问题道歉,但这是什么意思?

顺便说一下,这是Brian W. Kernighan和Dennis M. Ritchie的C编程语言书第2版第73页第4.3章.

c function

4
推荐指数
2
解决办法
9392
查看次数

bash脚本中的sed工作不正常:但它可以在命令行上运行

我在命令行上尝试了以下操作,但是当我将它们放在bash脚本中时,我得到一个错误(见下文):

sed -e "s/INSERT_ME_HERE/"${ROOT_BUILD_HOME}"/g" ./Doxyfile > ./tmp && mv ./tmp ./Doxyfile
sed -e "s/INSERT_ME_HERE/'${ROOT_BUILD_HOME}'/g" ./Doxyfile > ./tmp && mv ./tmp ./Doxyfile
sed -e "s/INSERT_ME_HERE/`echo ${ROOT_BUILD_HOME}`/g" ./Doxyfile > ./tmp && mv ./tmp ./Doxyfile
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

sed: -e expression #1, char 19: unknown option to `s'
Run Code Online (Sandbox Code Playgroud)

但是,就像我说我从命令行使用它,它的工作原理:

[mehoggan@hogganz400 Doxygen]$ ROOT_BUILD_HOME=MONKEY; sed -e "s/INSERT_ME_HERE/`echo ${ROOT_BUILD_HOME}`/g" ./Doxyfile | grep MONKEY
INPUT                  = MONKEY
Run Code Online (Sandbox Code Playgroud)

为什么它在一个案例而不是另一个案件中有效?

也是ROOT_BUILD_HOME设置,我在shell脚本中的sed表达式之前回显它.

echo `date`: "Going to run doxygen on source and move to ${ROOT_BUILD_HOME}";
Run Code Online (Sandbox Code Playgroud)

bash scripting sed

4
推荐指数
1
解决办法
5181
查看次数

For GNU Makefile中的循环 - 将所有目标文件收集到一个Mutliple目录中的变量中

我希望通过这个小脚本总结出我想要实现的目标.

DIRS = dir1 dir2 dir3 dir4 ...
OBJS =

all: GENERATE_OBJECT_FILES

GENERATE_OBJECT_FILES: 
        for curr_dir in $(DIRS); \
        do \
                $(join $(OBJS), `ls $${curr_dir}/*.o`); \
        done

        echo $(OBJS);
Run Code Online (Sandbox Code Playgroud)

如何使用Makefile中的脚本完成此操作?

makefile gnu-make

4
推荐指数
2
解决办法
1万
查看次数

如何获得多纹理单元的最大数量

让我说我有一个功能,我希望用户能够以类型安全的方式选择适当的纹理.因此,我没有使用GL_TUMTUREX的GLenum,而是按如下方式定义方法.

void activate_enable_bind(uint32_t texture_num)  {
  const uint32_t max_textures = GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS - GL_TEXTURE0;
  const uint32_t actual_texture = (GL_TEXTURE0 + texture_num);

  if (texture_num > max_textures) {
    throw std::runtime_error("ERROR: texture::activate_enable_bind()");
  }

  glActiveTexture(actual_texture);
  glEnable(target_type);
  glBindTexture(target_type, texture_id_);
}
Run Code Online (Sandbox Code Playgroud)

这是否保证在基于opengl规范的所有实现下工作,或者是允许的实现者

`GL_TEXTURE0 - GL_TEXTURE(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS -1)` 
Run Code Online (Sandbox Code Playgroud)

以不连续的方式定义?

我正在修改我的代码以及我所拥有的代码:

void activate_enable_bind(uint32_t texture_num = 0)  {
  GLint max_textures = 0;
  glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &max_textures);
  if (static_cast<GLint>(texture_num) > max_textures - 1) {
    throw std::runtime_error("ERROR: texture::activate_enable_bind()");
  }

  const uint32_t actual_texture = (GL_TEXTURE0 + texture_num);

  glActiveTexture(actual_texture);
  glEnable(target_type);
  glBindTexture(target_type, texture_id_);
}
Run Code Online (Sandbox Code Playgroud)

c++ opengl

4
推荐指数
1
解决办法
1770
查看次数

Qt 4在Ubuntu 13.04上

我似乎无法找到ubuntu 13.04的"qt 4 sdk"安装程序.我需要一个可以安装并允许我通过软件中心获得的qt创建者能够检测基于qt 4和5的项目.有没有人找到任何开箱即用的解决方案.或者有没有关于如何让ubuntu 13.04版本的qtcreator识别qt 4项目的指示?

ubuntu qt4 qt5

4
推荐指数
1
解决办法
1万
查看次数

CMake在命令行上传递列表

我需要运行swig作为我的cmake构建系统的一部分.我希望用户能够指定要传递给swig的语言列表,并在命令行中指定它们.

$ cmake -DSWIG_LANGUAGES=java,scala <path to cmake_source_dir>
Run Code Online (Sandbox Code Playgroud)

是否有内置的方法让cmake来处理这个问题?

command-line list cmake

4
推荐指数
1
解决办法
2183
查看次数