-Fixes to OpenSSL compilation (more)

-Fix bug in GDScript, now static functions can call static functions.
This commit is contained in:
Juan Linietsky 2014-05-01 11:34:10 -03:00
parent 4dc4e96c8a
commit 6572d51288
9 changed files with 55 additions and 16 deletions

View File

@ -204,7 +204,8 @@ for p in platform_list:
flag_list = platform_flags[p] flag_list = platform_flags[p]
for f in flag_list: for f in flag_list:
env[f[0]] = f[1] env[f[0]] = f[1]
print(f[0]+":"+f[1])
env.module_list=[] env.module_list=[]

View File

@ -442,6 +442,9 @@ static String _disassemble_addr(const Ref<GDScript>& p_script,const GDFunction&
case GDFunction::ADDR_TYPE_SELF: { case GDFunction::ADDR_TYPE_SELF: {
return "self"; return "self";
} break; } break;
case GDFunction::ADDR_TYPE_CLASS: {
return "class";
} break;
case GDFunction::ADDR_TYPE_MEMBER: { case GDFunction::ADDR_TYPE_MEMBER: {
return "member("+p_script->debug_get_member_by_index(addr)+")"; return "member("+p_script->debug_get_member_by_index(addr)+")";

View File

@ -15,8 +15,6 @@ stretch_aspect="keep"
[image_loader] [image_loader]
;filter=false
;gen_mipmaps=false
repeat=false repeat=false
[input] [input]
@ -31,6 +29,10 @@ spawn=[key(F1), jbutton(0, 11)]
default_gravity=700 default_gravity=700
[rasterizer]
use_pixel_snap=true
[render] [render]
mipmap_policy=1 mipmap_policy=1

View File

@ -1,6 +1,7 @@
#include "register_openssl.h" #include "register_openssl.h"
#include "stream_peer_openssl.h" #include "stream_peer_openssl.h"
#ifdef OPENSSL_ENABLED
void register_openssl() { void register_openssl() {
@ -14,3 +15,5 @@ void unregister_openssl() {
StreamPeerOpenSSL::finalize_ssl(); StreamPeerOpenSSL::finalize_ssl();
} }
#endif

View File

@ -553,6 +553,25 @@ void StreamPeerOpenSSL::initialize_ssl() {
} }
String config_path =GLOBAL_DEF("ssl/config",""); String config_path =GLOBAL_DEF("ssl/config","");
Globals::get_singleton()->set_custom_property_info("ssl/config",PropertyInfo(Variant::STRING,"ssl/config",PROPERTY_HINT_FILE,"*.cnf")); Globals::get_singleton()->set_custom_property_info("ssl/config",PropertyInfo(Variant::STRING,"ssl/config",PROPERTY_HINT_FILE,"*.cnf"));
if (config_path!="") {
Vector<uint8_t> data = FileAccess::get_file_as_array(config_path);
if (data.size()) {
data.push_back(0);
BIO* mem = BIO_new(BIO_s_mem());
BIO_puts(mem,(const char*) data.ptr());
while(true) {
X509*cert = PEM_read_bio_X509(mem, NULL, 0, NULL);
if (!cert)
break;
certs.push_back(cert);
}
BIO_free(mem);
}
print_line("Loaded certs from '"+certs_path+"': "+itos(certs.size()));
}
} }

View File

@ -452,6 +452,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
const GDParser::Node *instance = on->arguments[0]; const GDParser::Node *instance = on->arguments[0];
bool in_static=false;
if (instance->type==GDParser::Node::TYPE_SELF) { if (instance->type==GDParser::Node::TYPE_SELF) {
//room for optimization //room for optimization
@ -465,7 +466,10 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
int ret; int ret;
if (i==1) { if (i==0 && on->arguments[i]->type==GDParser::Node::TYPE_SELF && codegen.function_node && codegen.function_node->_static) {
//static call to self
ret=(GDFunction::ADDR_TYPE_CLASS<<GDFunction::ADDR_BITS);
} else if (i==1) {
if (on->arguments[i]->type!=GDParser::Node::TYPE_IDENTIFIER) { if (on->arguments[i]->type!=GDParser::Node::TYPE_IDENTIFIER) {
_set_error("Attempt to call a non-identifier.",on); _set_error("Attempt to call a non-identifier.",on);
@ -475,6 +479,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
ret=codegen.get_name_map_pos(id->name); ret=codegen.get_name_map_pos(id->name);
} else { } else {
ret = _parse_expression(codegen,on->arguments[i],slevel); ret = _parse_expression(codegen,on->arguments[i],slevel);
if (ret<0) if (ret<0)
return ret; return ret;

View File

@ -61,6 +61,10 @@ Variant *GDFunction::_get_variant(int p_address,GDInstance *p_instance,GDScript
} }
return &self; return &self;
} break; } break;
case ADDR_TYPE_CLASS: {
return &p_script->_static_ref;
} break;
case ADDR_TYPE_MEMBER: { case ADDR_TYPE_MEMBER: {
//member indexing is O(1) //member indexing is O(1)
if (!p_instance) { if (!p_instance) {
@ -1678,6 +1682,7 @@ Ref<GDScript> GDScript::get_base() const {
GDScript::GDScript() { GDScript::GDScript() {
_static_ref=this;
valid=false; valid=false;
subclass_count=0; subclass_count=0;
initializer=NULL; initializer=NULL;

View File

@ -75,13 +75,14 @@ public:
ADDR_MASK=((1<<ADDR_BITS)-1), ADDR_MASK=((1<<ADDR_BITS)-1),
ADDR_TYPE_MASK=~ADDR_MASK, ADDR_TYPE_MASK=~ADDR_MASK,
ADDR_TYPE_SELF=0, ADDR_TYPE_SELF=0,
ADDR_TYPE_MEMBER=1, ADDR_TYPE_CLASS=1,
ADDR_TYPE_CLASS_CONSTANT=2, ADDR_TYPE_MEMBER=2,
ADDR_TYPE_LOCAL_CONSTANT=3, ADDR_TYPE_CLASS_CONSTANT=3,
ADDR_TYPE_STACK=4, ADDR_TYPE_LOCAL_CONSTANT=4,
ADDR_TYPE_STACK_VARIABLE=5, ADDR_TYPE_STACK=5,
ADDR_TYPE_GLOBAL=6, ADDR_TYPE_STACK_VARIABLE=6,
ADDR_TYPE_NIL=7 ADDR_TYPE_GLOBAL=7,
ADDR_TYPE_NIL=8
}; };
struct StackDebug { struct StackDebug {
@ -139,9 +140,9 @@ public:
int get_max_stack_size() const; int get_max_stack_size() const;
int get_default_argument_count() const; int get_default_argument_count() const;
int get_default_argument_addr(int p_idx) const; int get_default_argument_addr(int p_idx) const;
GDScript *get_script() const { return _script; } GDScript *get_script() const { return _script; }
void debug_get_stack_member_state(int p_line,List<Pair<StringName,int> > *r_stackvars) const; void debug_get_stack_member_state(int p_line,List<Pair<StringName,int> > *r_stackvars) const;
_FORCE_INLINE_ bool is_empty() const { return _code_size==0; } _FORCE_INLINE_ bool is_empty() const { return _code_size==0; }
@ -183,6 +184,7 @@ friend class GDInstance;
friend class GDFunction; friend class GDFunction;
friend class GDCompiler; friend class GDCompiler;
friend class GDFunctions; friend class GDFunctions;
Variant _static_ref; //used for static call
Ref<GDNativeClass> native; Ref<GDNativeClass> native;
Ref<GDScript> base; Ref<GDScript> base;
GDScript *_base; //fast pointer access GDScript *_base; //fast pointer access

View File

@ -56,7 +56,7 @@ def get_flags():
('opengl', 'no'), ('opengl', 'no'),
('legacygl', 'yes'), ('legacygl', 'yes'),
('builtin_zlib', 'no'), ('builtin_zlib', 'no'),
('openssl', 'yes'), ("openssl", "yes"),
] ]
@ -121,8 +121,7 @@ def configure(env):
env.ParseConfig('pkg-config x11 --cflags --libs') env.ParseConfig('pkg-config x11 --cflags --libs')
env.ParseConfig('pkg-config xcursor --cflags --libs') env.ParseConfig('pkg-config xcursor --cflags --libs')
if (env["openssl"]=='yes'): env.ParseConfig('pkg-config openssl --cflags --libs')
env.ParseConfig('pkg-config openssl --cflags --libs')
env.ParseConfig('pkg-config freetype2 --cflags --libs') env.ParseConfig('pkg-config freetype2 --cflags --libs')