~kameliya/rubyex

ac92d33f37176c780e2d289cd841fd2d0977a068 — Yuki Izumi 5 years ago 80e5286 master
Make it compile again.
6 files changed, 20 insertions(+), 38 deletions(-)

A Makefile
M parser/ast.h
M parser/emitter.cpp
M parser/emitter.h
D parser/os.h
M vm/rstring.cpp
A Makefile => Makefile +17 -0
@@ 0,0 1,17 @@
.PHONY: ruby
.PHONY: parser
.PHONY: vm

ruby: parser vm
	make -C ruby

parser:
	make -C parser

vm:
	make -C vm

clean:
	make -C ruby clean
	make -C parser clean
	make -C vm clean

M parser/ast.h => parser/ast.h +0 -1
@@ 7,7 7,6 @@
#include <map>
#include "pretty.h"
#include "emitter.h"
#include "os.h"

class Expr : public PrettyPrint, public Emitter
{

M parser/emitter.cpp => parser/emitter.cpp +2 -2
@@ 44,13 44,13 @@ void Emitter::emit_uint8(std::ostream &o, uint8 i)

void Emitter::emit_uint32(std::ostream &o, uint32 i)
{
  uint32 conv = HTONL(i);
  uint32 conv = htonl(i);
  o.write((char *)&conv, sizeof(uint32));
}

void Emitter::emit_int32(std::ostream &o, int32 i)
{
  uint32 conv = HTONL((uint32)i);
  uint32 conv = htonl((uint32)i);
  o.write((char *)&conv, sizeof(uint32));
}


M parser/emitter.h => parser/emitter.h +0 -17
@@ 4,24 4,7 @@
#include "bytecode.h"
#include <iostream>

// may be platform specific
#include <arpa/inet.h>
#ifndef HTONL
#define HTONL(i) htonl(i)
#endif

#ifndef NTOHL
#define NTOHL(i) ntohl(i)
#endif

#ifndef HTONS
#define HTONS(i) htons(i)
#endif

#ifndef NTOHS
#define NTOHS(i) ntohs(i)
#endif

typedef unsigned char uint8;
typedef unsigned long uint32;
typedef long int32;

D parser/os.h => parser/os.h +0 -17
@@ 1,17 0,0 @@
#ifndef OS_H
#define OS_H

#include <iterator>

#ifdef __MACH__
template <class A, class B> bool operator ==(const std::reverse_iterator<A> &x, const std::reverse_iterator<B> &y) {
	return x.base() == y.base();
}

template <class A, class B> bool operator !=(const std::reverse_iterator<A> &x, const std::reverse_iterator<B> &y) {
	return x.base() != y.base();
}
#endif

#endif


M vm/rstring.cpp => vm/rstring.cpp +1 -1
@@ 133,7 133,7 @@ RubyValue string_capitalize(linked_ptr<Binding> &_b, RubyValue _self)

RubyValue string_index(linked_ptr<Binding> &_b, RubyValue _self, const std::vector<RubyValue> &_args)
{
  unsigned int i = _self.get_string().find(_args[0].get_string());
  auto i = _self.get_string().find(_args[0].get_string());
  if (i == std::string::npos)
    return _b->environment.NIL;
  return F2V(i);