repo_name
stringlengths
4
116
path
stringlengths
3
942
size
stringlengths
1
7
content
stringlengths
3
1.05M
license
stringclasses
15 values
1fechner/FeatureExtractor
sources/FeatureExtractor/lib/hibernate-release-5.1.0.Final/project/hibernate-core/src/test/java/org/hibernate/test/annotations/cascade/circle/identity/C.java
1549
/* * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ package org.hibernate.test.annotations.cascade.circle.identity; /** * No Documentation */ @javax.persistence.Entity public class C extends AbstractEntity { private static final long serialVersionUID = 1226955752L; /** * No documentation */ @javax.persistence.ManyToOne(cascade = { javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH} , optional = false) private A a; /** * No documentation */ @javax.persistence.ManyToOne(cascade = { javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH} ) private G g; /** * No documentation */ @javax.persistence.ManyToOne(cascade = { javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH} , optional = false) private B b; public A getA() { return a; } public void setA(A parameter) { this.a = parameter; } public G getG() { return g; } public void setG(G parameter) { this.g = parameter; } public B getB() { return b; } public void setB(B parameter) { this.b = parameter; } }
lgpl-2.1
concrete-cp/concrete
src/test/scala/concrete/constraint/semantic/AllDifferentBCTest.scala
872
package concrete.constraint.semantic import org.scalatest.FlatSpec import org.scalatest.Matchers import concrete.IntDomain import concrete.Variable import concrete.Problem import concrete.constraint.AdviseCount class AllDifferentBCTest extends FlatSpec with Matchers { "AllDifferentBC" should "detect contradiction" in { val v1 = new Variable("1", IntDomain.ofSeq(7)) val v2 = new Variable("2", IntDomain.ofSeq(6)) val v3 = new Variable("3", IntDomain.ofSeq(7, 9)) val v4 = new Variable("4", IntDomain.ofSeq(8)) val v5 = new Variable("5", IntDomain.ofSeq(8, 9)) val problem = Problem(v1, v2, v3, v4, v5) val c = new AllDifferentBC(v1, v2, v3, v4, v5) c.register(new AdviseCount) problem.addConstraint(c) val mod = problem.initState.andThen { ps => c.eventAll(ps) c.revise(ps) } assert(!mod.isState) } }
lgpl-2.1
mukatee/osmo
osmotester/src/osmo/tester/parser/ModelObject.java
742
package osmo.tester.parser; /** * A model-object that represents test model elements. * * @author Teemu Kanstren */ public class ModelObject { /** Prefix of the model object, added to names of all parsed test steps, guards, etc. */ private final String prefix; /** The model object, which implements a set of given test steps, guards, etc. to be invoked. */ private final Object object; public ModelObject(String prefix, Object object) { this.prefix = prefix; this.object = object; } public ModelObject(Object object) { this.prefix = ""; this.object = object; } public String getPrefix() { return prefix; } public Object getObject() { return object; } }
lgpl-2.1
HailStorm32/Q.bo_stacks
qbo_arduqbo/src/qbo_arduqbo/msg/_NoiseLevels.py
7510
"""autogenerated by genpy from qbo_arduqbo/NoiseLevels.msg. Do not edit.""" import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct import std_msgs.msg class NoiseLevels(genpy.Message): _md5sum = "e44910923ee5ef3281d32758158e1379" _type = "qbo_arduqbo/NoiseLevels" _has_header = True #flag to mark the presence of a Header object _full_text = """# Software License Agreement (LGPL v2.1 License) # # Copyright (c) 2012 Thecorpora, Inc. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation; either version 2.1 of the License, # or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA.# Software License Agreement (LGPL v2.1 License) # # Copyright (c) 2012 Thecorpora, Inc. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation; either version 2.1 of the License, # or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. Header header uint16 m0 uint16 m1 uint16 m2 ================================================================================ MSG: std_msgs/Header # Standard metadata for higher-level stamped data types. # This is generally used to communicate timestamped data # in a particular coordinate frame. # # sequence ID: consecutively increasing ID uint32 seq #Two-integer timestamp that is expressed as: # * stamp.secs: seconds (stamp_secs) since epoch # * stamp.nsecs: nanoseconds since stamp_secs # time-handling sugar is provided by the client library time stamp #Frame this data is associated with # 0: no frame # 1: global frame string frame_id """ __slots__ = ['header','m0','m1','m2'] _slot_types = ['std_msgs/Header','uint16','uint16','uint16'] def __init__(self, *args, **kwds): """ Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: header,m0,m1,m2 :param args: complete set of field values, in .msg order :param kwds: use keyword arguments corresponding to message field names to set specific fields. """ if args or kwds: super(NoiseLevels, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.header is None: self.header = std_msgs.msg.Header() if self.m0 is None: self.m0 = 0 if self.m1 is None: self.m1 = 0 if self.m2 is None: self.m2 = 0 else: self.header = std_msgs.msg.Header() self.m0 = 0 self.m1 = 0 self.m2 = 0 def _get_types(self): """ internal API method """ return self._slot_types def serialize(self, buff): """ serialize message into buffer :param buff: buffer, ``StringIO`` """ try: _x = self buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) _x = self.header.frame_id length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.pack('<I%ss'%length, length, _x)) _x = self buff.write(_struct_3H.pack(_x.m0, _x.m1, _x.m2)) except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x)))) except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x)))) def deserialize(self, str): """ unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str`` """ try: if self.header is None: self.header = std_msgs.msg.Header() end = 0 _x = self start = end end += 12 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.header.frame_id = str[start:end].decode('utf-8') else: self.header.frame_id = str[start:end] _x = self start = end end += 6 (_x.m0, _x.m1, _x.m2,) = _struct_3H.unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e) #most likely buffer underfill def serialize_numpy(self, buff, numpy): """ serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module """ try: _x = self buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) _x = self.header.frame_id length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.pack('<I%ss'%length, length, _x)) _x = self buff.write(_struct_3H.pack(_x.m0, _x.m1, _x.m2)) except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x)))) except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x)))) def deserialize_numpy(self, str, numpy): """ unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module """ try: if self.header is None: self.header = std_msgs.msg.Header() end = 0 _x = self start = end end += 12 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.header.frame_id = str[start:end].decode('utf-8') else: self.header.frame_id = str[start:end] _x = self start = end end += 6 (_x.m0, _x.m1, _x.m2,) = _struct_3H.unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e) #most likely buffer underfill _struct_I = genpy.struct_I _struct_3I = struct.Struct("<3I") _struct_3H = struct.Struct("<3H")
lgpl-2.1
jhollister/RIOT
tests/unittests/tests-netreg/tests-netreg.c
6355
/* * Copyright (C) 2014 Martine Lenders <mlenders@inf.fu-berlin.de> * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @{ * * @file */ #include <errno.h> #include "embUnit.h" #include "net/ng_netreg.h" #include "net/ng_nettype.h" #include "tests-netreg.h" static void set_up(void) { ng_netreg_init(); } static void test_netreg_register__inval_numof(void) { ng_netreg_entry_t entry = { NULL, TEST_UINT16, TEST_UINT8 }; TEST_ASSERT_EQUAL_INT(-EINVAL, ng_netreg_register(NG_NETTYPE_NUMOF, &entry)); } static void test_netreg_register__success(void) { ng_netreg_entry_t *res = ng_netreg_lookup(NG_NETTYPE_TEST, TEST_UINT16); ng_netreg_entry_t entry = { NULL, TEST_UINT16, TEST_UINT8 }; TEST_ASSERT_NULL(res); TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry)); TEST_ASSERT_NOT_NULL((res = ng_netreg_lookup(NG_NETTYPE_TEST, TEST_UINT16))); TEST_ASSERT_EQUAL_INT(TEST_UINT16, res->demux_ctx); TEST_ASSERT_EQUAL_INT(TEST_UINT8, res->pid); TEST_ASSERT_NULL((ng_netreg_getnext(res))); } void test_netreg_unregister__success(void) { ng_netreg_entry_t entry = { NULL, TEST_UINT16, TEST_UINT8 }; TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry)); TEST_ASSERT_NOT_NULL(ng_netreg_lookup(NG_NETTYPE_TEST, TEST_UINT16)); ng_netreg_unregister(NG_NETTYPE_TEST, &entry); TEST_ASSERT_NULL(ng_netreg_lookup(NG_NETTYPE_TEST, TEST_UINT16)); } void test_netreg_unregister__success2(void) { ng_netreg_entry_t *res = NULL; ng_netreg_entry_t entry1 = { NULL, TEST_UINT16, TEST_UINT8 }; ng_netreg_entry_t entry2 = { NULL, TEST_UINT16, TEST_UINT8 + 1 }; TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry1)); TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry2)); ng_netreg_unregister(NG_NETTYPE_TEST, &entry1); TEST_ASSERT_NOT_NULL((res = ng_netreg_lookup(NG_NETTYPE_TEST, TEST_UINT16))); TEST_ASSERT_EQUAL_INT(TEST_UINT16, res->demux_ctx); TEST_ASSERT_EQUAL_INT(TEST_UINT8 + 1, res->pid); ng_netreg_unregister(NG_NETTYPE_TEST, &entry2); TEST_ASSERT_NULL(ng_netreg_lookup(NG_NETTYPE_TEST, TEST_UINT16)); } void test_netreg_unregister__success3(void) { ng_netreg_entry_t *res = NULL; ng_netreg_entry_t entry1 = { NULL, TEST_UINT16, TEST_UINT8 }; ng_netreg_entry_t entry2 = { NULL, TEST_UINT16, TEST_UINT8 + 1 }; TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry1)); TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry2)); ng_netreg_unregister(NG_NETTYPE_TEST, &entry2); TEST_ASSERT_NOT_NULL((res = ng_netreg_lookup(NG_NETTYPE_TEST, TEST_UINT16))); TEST_ASSERT_EQUAL_INT(TEST_UINT16, res->demux_ctx); TEST_ASSERT_EQUAL_INT(TEST_UINT8, res->pid); ng_netreg_unregister(NG_NETTYPE_TEST, &entry1); TEST_ASSERT_NULL(ng_netreg_lookup(NG_NETTYPE_TEST, TEST_UINT16)); } void test_netreg_lookup__wrong_type_undef(void) { ng_netreg_entry_t entry = { NULL, TEST_UINT16, TEST_UINT8 }; TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry)); TEST_ASSERT_NULL(ng_netreg_lookup(NG_NETTYPE_UNDEF, TEST_UINT16)); } void test_netreg_lookup__wrong_type_numof(void) { ng_netreg_entry_t entry = { NULL, TEST_UINT16, TEST_UINT8 }; TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry)); TEST_ASSERT_NULL(ng_netreg_lookup(NG_NETTYPE_NUMOF, TEST_UINT16)); } void test_netreg_num__empty(void) { TEST_ASSERT_EQUAL_INT(0, ng_netreg_num(NG_NETTYPE_TEST, TEST_UINT16)); TEST_ASSERT_EQUAL_INT(0, ng_netreg_num(NG_NETTYPE_TEST, TEST_UINT16 + 1)); TEST_ASSERT_EQUAL_INT(0, ng_netreg_num(NG_NETTYPE_TEST, NG_NETREG_DEMUX_CTX_ALL)); } void test_netreg_num__wrong_type_undef(void) { ng_netreg_entry_t entry = { NULL, TEST_UINT16, TEST_UINT8 }; TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry)); TEST_ASSERT_EQUAL_INT(0, ng_netreg_num(NG_NETTYPE_UNDEF, TEST_UINT16)); } void test_netreg_num__wrong_type_numof(void) { ng_netreg_entry_t entry = { NULL, TEST_UINT16, TEST_UINT8 }; TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry)); TEST_ASSERT_EQUAL_INT(0, ng_netreg_num(NG_NETTYPE_NUMOF, TEST_UINT16)); } void test_netreg_num__2_entries(void) { ng_netreg_entry_t entry1 = { NULL, TEST_UINT16, TEST_UINT8 }; ng_netreg_entry_t entry2 = { NULL, TEST_UINT16, TEST_UINT8 + 1 }; TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry1)); TEST_ASSERT_EQUAL_INT(1, ng_netreg_num(NG_NETTYPE_TEST, TEST_UINT16)); TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry2)); TEST_ASSERT_EQUAL_INT(2, ng_netreg_num(NG_NETTYPE_TEST, TEST_UINT16)); } void test_netreg_getnext__NULL(void) { ng_netreg_entry_t entry = { NULL, TEST_UINT16, TEST_UINT8 }; TEST_ASSERT_EQUAL_INT(0, ng_netreg_register(NG_NETTYPE_TEST, &entry)); TEST_ASSERT_NULL(ng_netreg_getnext(NULL)); } void test_netreg_getnext__2_entries(void) { ng_netreg_entry_t *entry = NULL; test_netreg_num__2_entries(); TEST_ASSERT_NOT_NULL((entry = ng_netreg_lookup(NG_NETTYPE_TEST, TEST_UINT16))); TEST_ASSERT_NOT_NULL(ng_netreg_getnext(entry)); } Test *tests_netreg_tests(void) { EMB_UNIT_TESTFIXTURES(fixtures) { new_TestFixture(test_netreg_register__inval_numof), new_TestFixture(test_netreg_register__success), new_TestFixture(test_netreg_unregister__success), new_TestFixture(test_netreg_unregister__success2), new_TestFixture(test_netreg_unregister__success3), new_TestFixture(test_netreg_lookup__wrong_type_undef), new_TestFixture(test_netreg_lookup__wrong_type_numof), new_TestFixture(test_netreg_num__empty), new_TestFixture(test_netreg_num__wrong_type_undef), new_TestFixture(test_netreg_num__wrong_type_numof), new_TestFixture(test_netreg_num__2_entries), new_TestFixture(test_netreg_getnext__NULL), new_TestFixture(test_netreg_getnext__2_entries), }; EMB_UNIT_TESTCALLER(netreg_tests, set_up, NULL, fixtures); return (Test *)&netreg_tests; } void tests_netreg(void) { TESTS_RUN(tests_netreg_tests()); } /** @} */
lgpl-2.1
meesokim/p6001v
src/device.cpp
2818
// --------------------------------------------------------------------------- // DeviceŠÖ˜AƒNƒ‰ƒX // Original : cisc // Modification : Yumitaro // --------------------------------------------------------------------------- #include <string.h> #include <new> #include "device.h" //////////////////////////////////////////////////////////////// // DeviceList //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// // ƒRƒ“ƒXƒgƒ‰ƒNƒ^ //////////////////////////////////////////////////////////////// DeviceList::DeviceList( void ) : node(NULL) {} //////////////////////////////////////////////////////////////// // ƒfƒXƒgƒ‰ƒNƒ^ //////////////////////////////////////////////////////////////// DeviceList::~DeviceList( void ) { Cleanup(); } //////////////////////////////////////////////////////////////// // ƒm[ƒhŒŸõ //////////////////////////////////////////////////////////////// DeviceList::Node *DeviceList::FindNode( const ID id ) { for( Node *n = node; n; n = n->next ){ if( n->entry->GetID() == id ) return n; } return NULL; } //////////////////////////////////////////////////////////////// // ƒfƒoƒCƒXƒŠƒXƒg‘SÁ‹Ž //////////////////////////////////////////////////////////////// void DeviceList::Cleanup( void ) { Node *n = node; while( n ){ Node *nx = n->next; delete n; n = nx; } node = NULL; } //////////////////////////////////////////////////////////////// // ƒfƒoƒCƒX’ljÁ //////////////////////////////////////////////////////////////// bool DeviceList::Add( IDevice *t ) { ID id = t->GetID(); if( !id ) return false; Node *n = FindNode( id ); if( n ){ n->count++; return true; }else{ n = new Node; if( !n ) return false; n->entry = t; n->next = node; n->count = 1; node = n; return true; } } //////////////////////////////////////////////////////////////// // ƒfƒoƒCƒXíœ(ƒ|ƒCƒ“ƒ^) //////////////////////////////////////////////////////////////// bool DeviceList::Del( IDevice *t ) { return t->GetID() ? Del( t->GetID() ) : false; } //////////////////////////////////////////////////////////////// // ƒfƒoƒCƒXíœ(ID) //////////////////////////////////////////////////////////////// bool DeviceList::Del( const ID id ) { for( Node **r = &node; *r; r = &((*r)->next) ){ if( ((*r)->entry->GetID() == id) && ((*r)->count) ){ ((*r)->count)--; // if( (*r)->entry->GetID() == id ){ // Node* d = *r; // if( !--d->count ){ // *r = d->next; // delete d; // } return true; } } return false; } //////////////////////////////////////////////////////////////// // ƒfƒoƒCƒXŒŸõ //////////////////////////////////////////////////////////////// IDevice *DeviceList::Find( const ID id ) { Node *n = FindNode( id ); return n ? n->entry : NULL; }
lgpl-2.1
evhan/libgit2
src/config_file.c
34736
/* * Copyright (C) the libgit2 contributors. All rights reserved. * * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ #include "common.h" #include "config.h" #include "fileops.h" #include "filebuf.h" #include "buffer.h" #include "buf_text.h" #include "git2/config.h" #include "git2/sys/config.h" #include "git2/types.h" #include "strmap.h" #include <ctype.h> #include <sys/types.h> #include <regex.h> GIT__USE_STRMAP; typedef struct cvar_t { struct cvar_t *next; git_config_entry *entry; } cvar_t; #define CVAR_LIST_HEAD(list) ((list)->head) #define CVAR_LIST_TAIL(list) ((list)->tail) #define CVAR_LIST_NEXT(var) ((var)->next) #define CVAR_LIST_EMPTY(list) ((list)->head == NULL) #define CVAR_LIST_APPEND(list, var) do {\ if (CVAR_LIST_EMPTY(list)) {\ CVAR_LIST_HEAD(list) = CVAR_LIST_TAIL(list) = var;\ } else {\ CVAR_LIST_NEXT(CVAR_LIST_TAIL(list)) = var;\ CVAR_LIST_TAIL(list) = var;\ }\ } while(0) #define CVAR_LIST_REMOVE_HEAD(list) do {\ CVAR_LIST_HEAD(list) = CVAR_LIST_NEXT(CVAR_LIST_HEAD(list));\ } while(0) #define CVAR_LIST_REMOVE_AFTER(var) do {\ CVAR_LIST_NEXT(var) = CVAR_LIST_NEXT(CVAR_LIST_NEXT(var));\ } while(0) #define CVAR_LIST_FOREACH(list, iter)\ for ((iter) = CVAR_LIST_HEAD(list);\ (iter) != NULL;\ (iter) = CVAR_LIST_NEXT(iter)) /* * Inspired by the FreeBSD functions */ #define CVAR_LIST_FOREACH_SAFE(start, iter, tmp)\ for ((iter) = CVAR_LIST_HEAD(vars);\ (iter) && (((tmp) = CVAR_LIST_NEXT(iter) || 1));\ (iter) = (tmp)) typedef struct { git_config_backend parent; git_strmap *values; struct { git_buf buffer; char *read_ptr; int line_number; int eof; } reader; char *file_path; time_t file_mtime; size_t file_size; git_config_level_t level; } diskfile_backend; static int config_parse(diskfile_backend *cfg_file, git_config_level_t level); static int parse_variable(diskfile_backend *cfg, char **var_name, char **var_value); static int config_write(diskfile_backend *cfg, const char *key, const regex_t *preg, const char *value); static char *escape_value(const char *ptr); static void set_parse_error(diskfile_backend *backend, int col, const char *error_str) { giterr_set(GITERR_CONFIG, "Failed to parse config file: %s (in %s:%d, column %d)", error_str, backend->file_path, backend->reader.line_number, col); } static void cvar_free(cvar_t *var) { if (var == NULL) return; git__free((char*)var->entry->name); git__free((char *)var->entry->value); git__free(var->entry); git__free(var); } int git_config_file_normalize_section(char *start, char *end) { char *scan; if (start == end) return GIT_EINVALIDSPEC; /* Validate and downcase range */ for (scan = start; *scan; ++scan) { if (end && scan >= end) break; if (isalnum(*scan)) *scan = tolower(*scan); else if (*scan != '-' || scan == start) return GIT_EINVALIDSPEC; } if (scan == start) return GIT_EINVALIDSPEC; return 0; } /* Take something the user gave us and make it nice for our hash function */ static int normalize_name(const char *in, char **out) { char *name, *fdot, *ldot; assert(in && out); name = git__strdup(in); GITERR_CHECK_ALLOC(name); fdot = strchr(name, '.'); ldot = strrchr(name, '.'); if (fdot == NULL || fdot == name || ldot == NULL || !ldot[1]) goto invalid; /* Validate and downcase up to first dot and after last dot */ if (git_config_file_normalize_section(name, fdot) < 0 || git_config_file_normalize_section(ldot + 1, NULL) < 0) goto invalid; /* If there is a middle range, make sure it doesn't have newlines */ while (fdot < ldot) if (*fdot++ == '\n') goto invalid; *out = name; return 0; invalid: git__free(name); giterr_set(GITERR_CONFIG, "Invalid config item name '%s'", in); return GIT_EINVALIDSPEC; } static void free_vars(git_strmap *values) { cvar_t *var = NULL; if (values == NULL) return; git_strmap_foreach_value(values, var, while (var != NULL) { cvar_t *next = CVAR_LIST_NEXT(var); cvar_free(var); var = next; }); git_strmap_free(values); } static int config_open(git_config_backend *cfg, git_config_level_t level) { int res; diskfile_backend *b = (diskfile_backend *)cfg; b->level = level; b->values = git_strmap_alloc(); GITERR_CHECK_ALLOC(b->values); git_buf_init(&b->reader.buffer, 0); res = git_futils_readbuffer_updated( &b->reader.buffer, b->file_path, &b->file_mtime, &b->file_size, NULL); /* It's fine if the file doesn't exist */ if (res == GIT_ENOTFOUND) return 0; if (res < 0 || (res = config_parse(b, level)) < 0) { free_vars(b->values); b->values = NULL; } git_buf_free(&b->reader.buffer); return res; } static int config_refresh(git_config_backend *cfg) { int res, updated = 0; diskfile_backend *b = (diskfile_backend *)cfg; git_strmap *old_values; res = git_futils_readbuffer_updated( &b->reader.buffer, b->file_path, &b->file_mtime, &b->file_size, &updated); if (res < 0 || !updated) return (res == GIT_ENOTFOUND) ? 0 : res; /* need to reload - store old values and prep for reload */ old_values = b->values; b->values = git_strmap_alloc(); GITERR_CHECK_ALLOC(b->values); if ((res = config_parse(b, b->level)) < 0) { free_vars(b->values); b->values = old_values; } else { free_vars(old_values); } git_buf_free(&b->reader.buffer); return res; } static void backend_free(git_config_backend *_backend) { diskfile_backend *backend = (diskfile_backend *)_backend; if (backend == NULL) return; git__free(backend->file_path); free_vars(backend->values); git__free(backend); } static int file_foreach( git_config_backend *backend, const char *regexp, int (*fn)(const git_config_entry *, void *), void *data) { diskfile_backend *b = (diskfile_backend *)backend; cvar_t *var, *next_var; const char *key; regex_t regex; int result = 0; if (!b->values) return 0; if (regexp != NULL) { if ((result = regcomp(&regex, regexp, REG_EXTENDED)) < 0) { giterr_set_regex(&regex, result); regfree(&regex); return -1; } } git_strmap_foreach(b->values, key, var, for (; var != NULL; var = next_var) { next_var = CVAR_LIST_NEXT(var); /* skip non-matching keys if regexp was provided */ if (regexp && regexec(&regex, key, 0, NULL, 0) != 0) continue; /* abort iterator on non-zero return value */ if (fn(var->entry, data)) { giterr_clear(); result = GIT_EUSER; goto cleanup; } } ); cleanup: if (regexp != NULL) regfree(&regex); return result; } static int config_set(git_config_backend *cfg, const char *name, const char *value) { cvar_t *var = NULL, *old_var = NULL; diskfile_backend *b = (diskfile_backend *)cfg; char *key, *esc_value = NULL; khiter_t pos; int rval, ret; if ((rval = normalize_name(name, &key)) < 0) return rval; /* * Try to find it in the existing values and update it if it * only has one value. */ pos = git_strmap_lookup_index(b->values, key); if (git_strmap_valid_index(b->values, pos)) { cvar_t *existing = git_strmap_value_at(b->values, pos); char *tmp = NULL; git__free(key); if (existing->next != NULL) { giterr_set(GITERR_CONFIG, "Multivar incompatible with simple set"); return -1; } /* don't update if old and new values already match */ if ((!existing->entry->value && !value) || (existing->entry->value && value && !strcmp(existing->entry->value, value))) return 0; if (value) { tmp = git__strdup(value); GITERR_CHECK_ALLOC(tmp); esc_value = escape_value(value); GITERR_CHECK_ALLOC(esc_value); } git__free((void *)existing->entry->value); existing->entry->value = tmp; ret = config_write(b, existing->entry->name, NULL, esc_value); git__free(esc_value); return ret; } var = git__malloc(sizeof(cvar_t)); GITERR_CHECK_ALLOC(var); memset(var, 0x0, sizeof(cvar_t)); var->entry = git__malloc(sizeof(git_config_entry)); GITERR_CHECK_ALLOC(var->entry); memset(var->entry, 0x0, sizeof(git_config_entry)); var->entry->name = key; var->entry->value = NULL; if (value) { var->entry->value = git__strdup(value); GITERR_CHECK_ALLOC(var->entry->value); esc_value = escape_value(value); GITERR_CHECK_ALLOC(esc_value); } if (config_write(b, key, NULL, esc_value) < 0) { git__free(esc_value); cvar_free(var); return -1; } git__free(esc_value); git_strmap_insert2(b->values, key, var, old_var, rval); if (rval < 0) return -1; if (old_var != NULL) cvar_free(old_var); return 0; } /* * Internal function that actually gets the value in string form */ static int config_get(const git_config_backend *cfg, const char *name, const git_config_entry **out) { diskfile_backend *b = (diskfile_backend *)cfg; char *key; khiter_t pos; int error; if ((error = normalize_name(name, &key)) < 0) return error; pos = git_strmap_lookup_index(b->values, key); git__free(key); /* no error message; the config system will write one */ if (!git_strmap_valid_index(b->values, pos)) return GIT_ENOTFOUND; *out = ((cvar_t *)git_strmap_value_at(b->values, pos))->entry; return 0; } static int config_get_multivar( git_config_backend *cfg, const char *name, const char *regex_str, int (*fn)(const git_config_entry *, void *), void *data) { cvar_t *var; diskfile_backend *b = (diskfile_backend *)cfg; char *key; khiter_t pos; int error; if ((error = normalize_name(name, &key)) < 0) return error; pos = git_strmap_lookup_index(b->values, key); git__free(key); if (!git_strmap_valid_index(b->values, pos)) return GIT_ENOTFOUND; var = git_strmap_value_at(b->values, pos); if (regex_str != NULL) { regex_t regex; int result; /* regex matching; build the regex */ result = regcomp(&regex, regex_str, REG_EXTENDED); if (result < 0) { giterr_set_regex(&regex, result); regfree(&regex); return -1; } /* and throw the callback only on the variables that * match the regex */ do { if (regexec(&regex, var->entry->value, 0, NULL, 0) == 0) { /* early termination by the user is not an error; * just break and return successfully */ if (fn(var->entry, data) < 0) break; } var = var->next; } while (var != NULL); regfree(&regex); } else { /* no regex; go through all the variables */ do { /* early termination by the user is not an error; * just break and return successfully */ if (fn(var->entry, data) < 0) break; var = var->next; } while (var != NULL); } return 0; } static int config_set_multivar( git_config_backend *cfg, const char *name, const char *regexp, const char *value) { int replaced = 0; cvar_t *var, *newvar; diskfile_backend *b = (diskfile_backend *)cfg; char *key; regex_t preg; int result; khiter_t pos; assert(regexp); if ((result = normalize_name(name, &key)) < 0) return result; pos = git_strmap_lookup_index(b->values, key); if (!git_strmap_valid_index(b->values, pos)) { /* If we don't have it, behave like a normal set */ result = config_set(cfg, name, value); git__free(key); return result; } var = git_strmap_value_at(b->values, pos); result = regcomp(&preg, regexp, REG_EXTENDED); if (result < 0) { git__free(key); giterr_set_regex(&preg, result); regfree(&preg); return -1; } for (;;) { if (regexec(&preg, var->entry->value, 0, NULL, 0) == 0) { char *tmp = git__strdup(value); GITERR_CHECK_ALLOC(tmp); git__free((void *)var->entry->value); var->entry->value = tmp; replaced = 1; } if (var->next == NULL) break; var = var->next; } /* If we've reached the end of the variables and we haven't found it yet, we need to append it */ if (!replaced) { newvar = git__malloc(sizeof(cvar_t)); GITERR_CHECK_ALLOC(newvar); memset(newvar, 0x0, sizeof(cvar_t)); newvar->entry = git__malloc(sizeof(git_config_entry)); GITERR_CHECK_ALLOC(newvar->entry); memset(newvar->entry, 0x0, sizeof(git_config_entry)); newvar->entry->name = git__strdup(var->entry->name); GITERR_CHECK_ALLOC(newvar->entry->name); newvar->entry->value = git__strdup(value); GITERR_CHECK_ALLOC(newvar->entry->value); newvar->entry->level = var->entry->level; var->next = newvar; } result = config_write(b, key, &preg, value); git__free(key); regfree(&preg); return result; } static int config_delete(git_config_backend *cfg, const char *name) { cvar_t *var; diskfile_backend *b = (diskfile_backend *)cfg; char *key; int result; khiter_t pos; if ((result = normalize_name(name, &key)) < 0) return result; pos = git_strmap_lookup_index(b->values, key); git__free(key); if (!git_strmap_valid_index(b->values, pos)) { giterr_set(GITERR_CONFIG, "Could not find key '%s' to delete", name); return GIT_ENOTFOUND; } var = git_strmap_value_at(b->values, pos); if (var->next != NULL) { giterr_set(GITERR_CONFIG, "Cannot delete multivar with a single delete"); return -1; } git_strmap_delete_at(b->values, pos); result = config_write(b, var->entry->name, NULL, NULL); cvar_free(var); return result; } int git_config_file__ondisk(git_config_backend **out, const char *path) { diskfile_backend *backend; backend = git__calloc(1, sizeof(diskfile_backend)); GITERR_CHECK_ALLOC(backend); backend->parent.version = GIT_CONFIG_BACKEND_VERSION; backend->file_path = git__strdup(path); GITERR_CHECK_ALLOC(backend->file_path); backend->parent.open = config_open; backend->parent.get = config_get; backend->parent.get_multivar = config_get_multivar; backend->parent.set = config_set; backend->parent.set_multivar = config_set_multivar; backend->parent.del = config_delete; backend->parent.foreach = file_foreach; backend->parent.refresh = config_refresh; backend->parent.free = backend_free; *out = (git_config_backend *)backend; return 0; } static int cfg_getchar_raw(diskfile_backend *cfg) { int c; c = *cfg->reader.read_ptr++; /* Win 32 line breaks: if we find a \r\n sequence, return only the \n as a newline */ if (c == '\r' && *cfg->reader.read_ptr == '\n') { cfg->reader.read_ptr++; c = '\n'; } if (c == '\n') cfg->reader.line_number++; if (c == 0) { cfg->reader.eof = 1; c = '\n'; } return c; } #define SKIP_WHITESPACE (1 << 1) #define SKIP_COMMENTS (1 << 2) static int cfg_getchar(diskfile_backend *cfg_file, int flags) { const int skip_whitespace = (flags & SKIP_WHITESPACE); const int skip_comments = (flags & SKIP_COMMENTS); int c; assert(cfg_file->reader.read_ptr); do c = cfg_getchar_raw(cfg_file); while (skip_whitespace && git__isspace(c) && !cfg_file->reader.eof); if (skip_comments && (c == '#' || c == ';')) { do c = cfg_getchar_raw(cfg_file); while (c != '\n'); } return c; } /* * Read the next char, but don't move the reading pointer. */ static int cfg_peek(diskfile_backend *cfg, int flags) { void *old_read_ptr; int old_lineno, old_eof; int ret; assert(cfg->reader.read_ptr); old_read_ptr = cfg->reader.read_ptr; old_lineno = cfg->reader.line_number; old_eof = cfg->reader.eof; ret = cfg_getchar(cfg, flags); cfg->reader.read_ptr = old_read_ptr; cfg->reader.line_number = old_lineno; cfg->reader.eof = old_eof; return ret; } /* * Read and consume a line, returning it in newly-allocated memory. */ static char *cfg_readline(diskfile_backend *cfg, bool skip_whitespace) { char *line = NULL; char *line_src, *line_end; size_t line_len; line_src = cfg->reader.read_ptr; if (skip_whitespace) { /* Skip empty empty lines */ while (git__isspace(*line_src)) ++line_src; } line_end = strchr(line_src, '\n'); /* no newline at EOF */ if (line_end == NULL) line_end = strchr(line_src, 0); line_len = line_end - line_src; line = git__malloc(line_len + 1); if (line == NULL) return NULL; memcpy(line, line_src, line_len); do line[line_len] = '\0'; while (line_len-- > 0 && git__isspace(line[line_len])); if (*line_end == '\n') line_end++; if (*line_end == '\0') cfg->reader.eof = 1; cfg->reader.line_number++; cfg->reader.read_ptr = line_end; return line; } /* * Consume a line, without storing it anywhere */ static void cfg_consume_line(diskfile_backend *cfg) { char *line_start, *line_end; line_start = cfg->reader.read_ptr; line_end = strchr(line_start, '\n'); /* No newline at EOF */ if(line_end == NULL){ line_end = strchr(line_start, '\0'); } if (*line_end == '\n') line_end++; if (*line_end == '\0') cfg->reader.eof = 1; cfg->reader.line_number++; cfg->reader.read_ptr = line_end; } GIT_INLINE(int) config_keychar(int c) { return isalnum(c) || c == '-'; } static int parse_section_header_ext(diskfile_backend *cfg, const char *line, const char *base_name, char **section_name) { int c, rpos; char *first_quote, *last_quote; git_buf buf = GIT_BUF_INIT; int quote_marks; /* * base_name is what came before the space. We should be at the * first quotation mark, except for now, line isn't being kept in * sync so we only really use it to calculate the length. */ first_quote = strchr(line, '"'); last_quote = strrchr(line, '"'); if (last_quote - first_quote == 0) { set_parse_error(cfg, 0, "Missing closing quotation mark in section header"); return -1; } git_buf_grow(&buf, strlen(base_name) + last_quote - first_quote + 2); git_buf_printf(&buf, "%s.", base_name); rpos = 0; quote_marks = 0; line = first_quote; c = line[rpos++]; /* * At the end of each iteration, whatever is stored in c will be * added to the string. In case of error, jump to out */ do { if (quote_marks == 2) { set_parse_error(cfg, rpos, "Unexpected text after closing quotes"); git_buf_free(&buf); return -1; } switch (c) { case 0: set_parse_error(cfg, 0, "Unexpected end-of-line in section header"); git_buf_free(&buf); return -1; case '"': ++quote_marks; continue; case '\\': c = line[rpos++]; switch (c) { case '"': if (&line[rpos-1] == last_quote) { set_parse_error(cfg, 0, "Missing closing quotation mark in section header"); git_buf_free(&buf); return -1; } case '\\': break; default: set_parse_error(cfg, rpos, "Unsupported escape sequence"); git_buf_free(&buf); return -1; } default: break; } git_buf_putc(&buf, c); } while ((c = line[rpos++]) != ']'); *section_name = git_buf_detach(&buf); return 0; } static int parse_section_header(diskfile_backend *cfg, char **section_out) { char *name, *name_end; int name_length, c, pos; int result; char *line; line = cfg_readline(cfg, true); if (line == NULL) return -1; /* find the end of the variable's name */ name_end = strchr(line, ']'); if (name_end == NULL) { git__free(line); set_parse_error(cfg, 0, "Missing ']' in section header"); return -1; } name = (char *)git__malloc((size_t)(name_end - line) + 1); GITERR_CHECK_ALLOC(name); name_length = 0; pos = 0; /* Make sure we were given a section header */ c = line[pos++]; assert(c == '['); c = line[pos++]; do { if (git__isspace(c)){ name[name_length] = '\0'; result = parse_section_header_ext(cfg, line, name, section_out); git__free(line); git__free(name); return result; } if (!config_keychar(c) && c != '.') { set_parse_error(cfg, pos, "Unexpected character in header"); goto fail_parse; } name[name_length++] = (char) tolower(c); } while ((c = line[pos++]) != ']'); if (line[pos - 1] != ']') { set_parse_error(cfg, pos, "Unexpected end of file"); goto fail_parse; } git__free(line); name[name_length] = 0; *section_out = name; return 0; fail_parse: git__free(line); git__free(name); return -1; } static int skip_bom(diskfile_backend *cfg) { git_bom_t bom; int bom_offset = git_buf_text_detect_bom(&bom, &cfg->reader.buffer, cfg->reader.read_ptr - cfg->reader.buffer.ptr); if (bom == GIT_BOM_UTF8) cfg->reader.read_ptr += bom_offset; /* TODO: reference implementation is pretty stupid with BoM */ return 0; } /* (* basic types *) digit = "0".."9" integer = digit { digit } alphabet = "a".."z" + "A" .. "Z" section_char = alphabet | "." | "-" extension_char = (* any character except newline *) any_char = (* any character *) variable_char = "alphabet" | "-" (* actual grammar *) config = { section } section = header { definition } header = "[" section [subsection | subsection_ext] "]" subsection = "." section subsection_ext = "\"" extension "\"" section = section_char { section_char } extension = extension_char { extension_char } definition = variable_name ["=" variable_value] "\n" variable_name = variable_char { variable_char } variable_value = string | boolean | integer string = quoted_string | plain_string quoted_string = "\"" plain_string "\"" plain_string = { any_char } boolean = boolean_true | boolean_false boolean_true = "yes" | "1" | "true" | "on" boolean_false = "no" | "0" | "false" | "off" */ static int strip_comments(char *line, int in_quotes) { int quote_count = in_quotes; char *ptr; for (ptr = line; *ptr; ++ptr) { if (ptr[0] == '"' && ptr > line && ptr[-1] != '\\') quote_count++; if ((ptr[0] == ';' || ptr[0] == '#') && (quote_count % 2) == 0) { ptr[0] = '\0'; break; } } /* skip any space at the end */ if (ptr > line && git__isspace(ptr[-1])) { ptr--; } ptr[0] = '\0'; return quote_count; } static int config_parse(diskfile_backend *cfg_file, git_config_level_t level) { int c; char *current_section = NULL; char *var_name; char *var_value; cvar_t *var, *existing; git_buf buf = GIT_BUF_INIT; int result = 0; khiter_t pos; /* Initialize the reading position */ cfg_file->reader.read_ptr = cfg_file->reader.buffer.ptr; cfg_file->reader.eof = 0; /* If the file is empty, there's nothing for us to do */ if (*cfg_file->reader.read_ptr == '\0') return 0; skip_bom(cfg_file); while (result == 0 && !cfg_file->reader.eof) { c = cfg_peek(cfg_file, SKIP_WHITESPACE); switch (c) { case '\n': /* EOF when peeking, set EOF in the reader to exit the loop */ cfg_file->reader.eof = 1; break; case '[': /* section header, new section begins */ git__free(current_section); current_section = NULL; result = parse_section_header(cfg_file, &current_section); break; case ';': case '#': cfg_consume_line(cfg_file); break; default: /* assume variable declaration */ result = parse_variable(cfg_file, &var_name, &var_value); if (result < 0) break; var = git__malloc(sizeof(cvar_t)); GITERR_CHECK_ALLOC(var); memset(var, 0x0, sizeof(cvar_t)); var->entry = git__malloc(sizeof(git_config_entry)); GITERR_CHECK_ALLOC(var->entry); memset(var->entry, 0x0, sizeof(git_config_entry)); git__strtolower(var_name); git_buf_printf(&buf, "%s.%s", current_section, var_name); git__free(var_name); if (git_buf_oom(&buf)) return -1; var->entry->name = git_buf_detach(&buf); var->entry->value = var_value; var->entry->level = level; /* Add or append the new config option */ pos = git_strmap_lookup_index(cfg_file->values, var->entry->name); if (!git_strmap_valid_index(cfg_file->values, pos)) { git_strmap_insert(cfg_file->values, var->entry->name, var, result); if (result < 0) break; result = 0; } else { existing = git_strmap_value_at(cfg_file->values, pos); while (existing->next != NULL) { existing = existing->next; } existing->next = var; } break; } } git__free(current_section); return result; } static int write_section(git_filebuf *file, const char *key) { int result; const char *dot; git_buf buf = GIT_BUF_INIT; /* All of this just for [section "subsection"] */ dot = strchr(key, '.'); git_buf_putc(&buf, '['); if (dot == NULL) { git_buf_puts(&buf, key); } else { char *escaped; git_buf_put(&buf, key, dot - key); escaped = escape_value(dot + 1); GITERR_CHECK_ALLOC(escaped); git_buf_printf(&buf, " \"%s\"", escaped); git__free(escaped); } git_buf_puts(&buf, "]\n"); if (git_buf_oom(&buf)) return -1; result = git_filebuf_write(file, git_buf_cstr(&buf), buf.size); git_buf_free(&buf); return result; } /* * This is pretty much the parsing, except we write out anything we don't have */ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *preg, const char* value) { int result, c; int section_matches = 0, last_section_matched = 0, preg_replaced = 0, write_trailer = 0; const char *pre_end = NULL, *post_start = NULL, *data_start; char *current_section = NULL, *section, *name, *ldot; git_filebuf file = GIT_FILEBUF_INIT; /* We need to read in our own config file */ result = git_futils_readbuffer(&cfg->reader.buffer, cfg->file_path); /* Initialise the reading position */ if (result == GIT_ENOTFOUND) { cfg->reader.read_ptr = NULL; cfg->reader.eof = 1; data_start = NULL; git_buf_clear(&cfg->reader.buffer); } else if (result == 0) { cfg->reader.read_ptr = cfg->reader.buffer.ptr; cfg->reader.eof = 0; data_start = cfg->reader.read_ptr; } else { return -1; /* OS error when reading the file */ } /* Lock the file */ if (git_filebuf_open(&file, cfg->file_path, 0) < 0) return -1; skip_bom(cfg); ldot = strrchr(key, '.'); name = ldot + 1; section = git__strndup(key, ldot - key); while (!cfg->reader.eof) { c = cfg_peek(cfg, SKIP_WHITESPACE); if (c == '\0') { /* We've arrived at the end of the file */ break; } else if (c == '[') { /* section header, new section begins */ /* * We set both positions to the current one in case we * need to add a variable to the end of a section. In that * case, we want both variables to point just before the * new section. If we actually want to replace it, the * default case will take care of updating them. */ pre_end = post_start = cfg->reader.read_ptr; git__free(current_section); current_section = NULL; if (parse_section_header(cfg, &current_section) < 0) goto rewrite_fail; /* Keep track of when it stops matching */ last_section_matched = section_matches; section_matches = !strcmp(current_section, section); } else if (c == ';' || c == '#') { cfg_consume_line(cfg); } else { /* * If the section doesn't match, but the last section did, * it means we need to add a variable (so skip the line * otherwise). If both the section and name match, we need * to overwrite the variable (so skip the line * otherwise). pre_end needs to be updated each time so we * don't loose that information, but we only need to * update post_start if we're going to use it in this * iteration. */ if (!section_matches) { if (!last_section_matched) { cfg_consume_line(cfg); continue; } } else { int has_matched = 0; char *var_name, *var_value; pre_end = cfg->reader.read_ptr; if (parse_variable(cfg, &var_name, &var_value) < 0) goto rewrite_fail; /* First try to match the name of the variable */ if (strcasecmp(name, var_name) == 0) has_matched = 1; /* If the name matches, and we have a regex to match the * value, try to match it */ if (has_matched && preg != NULL) has_matched = (regexec(preg, var_value, 0, NULL, 0) == 0); git__free(var_name); git__free(var_value); /* if there is no match, keep going */ if (!has_matched) continue; post_start = cfg->reader.read_ptr; } /* We've found the variable we wanted to change, so * write anything up to it */ git_filebuf_write(&file, data_start, pre_end - data_start); preg_replaced = 1; /* Then replace the variable. If the value is NULL, it * means we want to delete it, so don't write anything. */ if (value != NULL) { git_filebuf_printf(&file, "\t%s = %s\n", name, value); } /* multiline variable? we need to keep reading lines to match */ if (preg != NULL) { data_start = post_start; continue; } write_trailer = 1; break; /* break from the loop */ } } /* * Being here can mean that * * 1) our section is the last one in the file and we're * adding a variable * * 2) we didn't find a section for us so we need to create it * ourselves. * * 3) we're setting a multivar with a regex, which means we * continue to search for matching values * * In the last case, if we've already replaced a value, we * want to write the rest of the file. Otherwise we need to write * out the whole file and then the new variable. */ if (write_trailer) { /* Write out rest of the file */ git_filebuf_write(&file, post_start, cfg->reader.buffer.size - (post_start - data_start)); } else { if (preg_replaced) { git_filebuf_printf(&file, "\n%s", data_start); } else { git_filebuf_write(&file, cfg->reader.buffer.ptr, cfg->reader.buffer.size); /* And now if we just need to add a variable */ if (!section_matches && write_section(&file, section) < 0) goto rewrite_fail; /* Sanity check: if we are here, and value is NULL, that means that somebody * touched the config file after our intial read. We should probably assert() * this, but instead we'll handle it gracefully with an error. */ if (value == NULL) { giterr_set(GITERR_CONFIG, "Race condition when writing a config file (a cvar has been removed)"); goto rewrite_fail; } /* If we are here, there is at least a section line */ if (cfg->reader.buffer.size > 0 && *(cfg->reader.buffer.ptr + cfg->reader.buffer.size - 1) != '\n') git_filebuf_write(&file, "\n", 1); git_filebuf_printf(&file, "\t%s = %s\n", name, value); } } git__free(section); git__free(current_section); /* refresh stats - if this errors, then commit will error too */ (void)git_filebuf_stats(&cfg->file_mtime, &cfg->file_size, &file); result = git_filebuf_commit(&file, GIT_CONFIG_FILE_MODE); git_buf_free(&cfg->reader.buffer); return result; rewrite_fail: git__free(section); git__free(current_section); git_filebuf_cleanup(&file); git_buf_free(&cfg->reader.buffer); return -1; } static const char *escapes = "ntb\"\\"; static const char *escaped = "\n\t\b\"\\"; /* Escape the values to write them to the file */ static char *escape_value(const char *ptr) { git_buf buf = GIT_BUF_INIT; size_t len; const char *esc; assert(ptr); len = strlen(ptr); if (!len) return git__calloc(1, sizeof(char)); git_buf_grow(&buf, len); while (*ptr != '\0') { if ((esc = strchr(escaped, *ptr)) != NULL) { git_buf_putc(&buf, '\\'); git_buf_putc(&buf, escapes[esc - escaped]); } else { git_buf_putc(&buf, *ptr); } ptr++; } if (git_buf_oom(&buf)) { git_buf_free(&buf); return NULL; } return git_buf_detach(&buf); } /* '\"' -> '"' etc */ static char *fixup_line(const char *ptr, int quote_count) { char *str = git__malloc(strlen(ptr) + 1); char *out = str, *esc; if (str == NULL) return NULL; while (*ptr != '\0') { if (*ptr == '"') { quote_count++; } else if (*ptr != '\\') { *out++ = *ptr; } else { /* backslash, check the next char */ ptr++; /* if we're at the end, it's a multiline, so keep the backslash */ if (*ptr == '\0') { *out++ = '\\'; goto out; } if ((esc = strchr(escapes, *ptr)) != NULL) { *out++ = escaped[esc - escapes]; } else { git__free(str); giterr_set(GITERR_CONFIG, "Invalid escape at %s", ptr); return NULL; } } ptr++; } out: *out = '\0'; return str; } static int is_multiline_var(const char *str) { int count = 0; const char *end = str + strlen(str); while (end > str && end[-1] == '\\') { count++; end--; } /* An odd number means last backslash wasn't escaped, so it's multiline */ return (end > str) && (count & 1); } static int parse_multiline_variable(diskfile_backend *cfg, git_buf *value, int in_quotes) { char *line = NULL, *proc_line = NULL; int quote_count; /* Check that the next line exists */ line = cfg_readline(cfg, false); if (line == NULL) return -1; /* We've reached the end of the file, there is input missing */ if (line[0] == '\0') { set_parse_error(cfg, 0, "Unexpected end of file while parsing multine var"); git__free(line); return -1; } quote_count = strip_comments(line, !!in_quotes); /* If it was just a comment, pretend it didn't exist */ if (line[0] == '\0') { git__free(line); return parse_multiline_variable(cfg, value, quote_count); /* TODO: unbounded recursion. This **could** be exploitable */ } /* Drop the continuation character '\': to closely follow the UNIX * standard, this character **has** to be last one in the buf, with * no whitespace after it */ assert(is_multiline_var(value->ptr)); git_buf_shorten(value, 1); proc_line = fixup_line(line, in_quotes); if (proc_line == NULL) { git__free(line); return -1; } /* add this line to the multiline var */ git_buf_puts(value, proc_line); git__free(line); git__free(proc_line); /* * If we need to continue reading the next line, let's just * keep putting stuff in the buffer */ if (is_multiline_var(value->ptr)) return parse_multiline_variable(cfg, value, quote_count); return 0; } static int parse_variable(diskfile_backend *cfg, char **var_name, char **var_value) { const char *var_end = NULL; const char *value_start = NULL; char *line; int quote_count; line = cfg_readline(cfg, true); if (line == NULL) return -1; quote_count = strip_comments(line, 0); var_end = strchr(line, '='); if (var_end == NULL) var_end = strchr(line, '\0'); else value_start = var_end + 1; do var_end--; while (var_end>line && git__isspace(*var_end)); *var_name = git__strndup(line, var_end - line + 1); GITERR_CHECK_ALLOC(*var_name); /* If there is no value, boolean true is assumed */ *var_value = NULL; /* * Now, let's try to parse the value */ if (value_start != NULL) { while (git__isspace(value_start[0])) value_start++; if (is_multiline_var(value_start)) { git_buf multi_value = GIT_BUF_INIT; char *proc_line = fixup_line(value_start, 0); GITERR_CHECK_ALLOC(proc_line); git_buf_puts(&multi_value, proc_line); git__free(proc_line); if (parse_multiline_variable(cfg, &multi_value, quote_count) < 0 || git_buf_oom(&multi_value)) { git__free(*var_name); git__free(line); git_buf_free(&multi_value); return -1; } *var_value = git_buf_detach(&multi_value); } else if (value_start[0] != '\0') { *var_value = fixup_line(value_start, 0); GITERR_CHECK_ALLOC(*var_value); } else { /* equals sign but missing rhs */ *var_value = git__strdup(""); GITERR_CHECK_ALLOC(*var_value); } } git__free(line); return 0; }
lgpl-2.1
viktorbahr/jaer
src/ch/unizh/ini/jaer/projects/eventbasedfeatures/PixelBuffer.java
27642
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ch.unizh.ini.jaer.projects.eventbasedfeatures; import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JFrame; import net.sf.jaer.Description; import net.sf.jaer.chip.AEChip; import net.sf.jaer.event.EventPacket; import net.sf.jaer.event.PolarityEvent; import net.sf.jaer.eventprocessing.EventFilter2D; import net.sf.jaer.graphics.ImageDisplay; /** This class develops an intensity map representation of the incoming AE events. A ring buffer * is maintained at each pixel to keep track of the history of the events at that position. * A score is calculated for each pixel position - +1 for every ON event that enters the ring buffer (hence, -1 * for every ON event that leaves) and -1 for every OFF event that enters the ring buffer (hence, -1 * for every OFF event that leaves) * * @author Varad */ @Description("Creates an intensity map representation of AE events") public class PixelBuffer extends EventFilter2D { public int RingBufferSize = getPrefs().getInt("PixelBuffer.RingBufferSize", 1); public boolean renderBufferMap = getPrefs().getBoolean("PixelBuffer.renderBufferMap", false); public boolean hasKernelImplementor = false; public boolean hasConvolutionFeatureScheme = false; public boolean hasBinaryFeatureDetector = false; KernelImplementor kernelimplement; ConvolutionFeatureScheme featurescheme; BinaryFeatureDetector bindetect; public float max ; public float min ; public float base; public int sizex; public int sizey; public int maplength; public float[] colorv; public int[] map; public RingBuffer[] rbarr; ImageDisplay disp; JFrame frame; public PixelBuffer (AEChip chip){ super(chip); this.chip = chip; final String sz = "Size"; setPropertyTooltip(sz, "RingBufferSize", "sets size of ring buffer"); sizex = chip.getSizeX(); sizey = chip.getSizeY(); disp = ImageDisplay.createOpenGLCanvas(); // makde a new ImageDisplay GLCanvas with default OpenGL capabilities frame = new JFrame("ImageFrame"); // make a JFrame to hold it frame.setPreferredSize(new Dimension(sizex, sizey)); // set the window size frame.getContentPane().add(disp, BorderLayout.CENTER); // add the GLCanvas to the center of the window frame.pack(); // otherwise it wont fill up the display initFilter(); resetFilter(); } synchronized public boolean isRenderBufferMapEnabled(){ return renderBufferMap; } synchronized public void setRenderBufferMapEnabled( boolean renderBufferMap ) { this.renderBufferMap = renderBufferMap; getPrefs().putBoolean("PixelBuffer.renderBufferMap", renderBufferMap); getSupport().firePropertyChange("renderBufferMap", this.renderBufferMap, renderBufferMap); resetFilter(); } synchronized public int getRingBufferSize (){ return RingBufferSize; } synchronized public void setRingBufferSize( int RingBufferSize){ this.RingBufferSize = RingBufferSize; getPrefs().putInt("PixelBuffer.RingBufferSize", RingBufferSize); getSupport().firePropertyChange("RingBufferSize", this.RingBufferSize, RingBufferSize); resetFilter(); } synchronized public void setKernelImplementor(KernelImplementor kernelimplement){ this.hasKernelImplementor = true; this.kernelimplement = kernelimplement; } synchronized public void setConvolutionFeatureScheme(ConvolutionFeatureScheme featurescheme){ this.hasConvolutionFeatureScheme = true; this.featurescheme = featurescheme; } synchronized public void setBinaryFeatureDetector(BinaryFeatureDetector bindetect){ this.hasBinaryFeatureDetector = true; this.bindetect = bindetect; } synchronized private void checkMaps (){ if ( rbarr == null || rbarr.length != (chip.getSizeX()*chip.getSizeY()) ) resetRingBuffers(); } synchronized private void resetRingBuffers(){ max = 1; min = 0; maplength = sizex*sizey; base = ((max+min)/2); int size = 128; disp.setImageSize(size, size); // set dimensions of image disp.resetFrame(base); frame.setVisible(true); // make the frame visible map = new int[maplength]; rbarr = new RingBuffer[maplength]; colorv = new float[maplength]; for (int a = 0; a < maplength; a++){ rbarr[a] = new RingBuffer( getRingBufferSize() ); } } public class RingBuffer{ public final int length; // buffer length public int[] buffer; // an array of fixed length public int leadPointer, trailPointer ; public boolean fullflag; public RingBuffer(int cap){ length = cap; resetBuffer(); } public void resetBuffer(){ buffer = new int[length]; this.leadPointer = 0; this.fullflag = false; } public int incrIndex(int i){ i++; if(i>=length)i=0; return i; } public void insert( PolarityEvent e){ buffer[leadPointer] = e.getType(); leadPointer = incrIndex(leadPointer); if(leadPointer == 0) this.fullflag = true; } public int getOldest(){ return buffer[leadPointer]; } } @Override synchronized public EventPacket filterPacket(EventPacket in) { sizex = chip.getSizeX(); sizey = chip.getSizeY(); if ( in == null ){ return null; } if ( enclosedFilter != null ){ in = enclosedFilter.filterPacket(in); } checkMaps(); if(hasKernelImplementor) kernelimplement.kernel.checkMaps(); if(hasConvolutionFeatureScheme) featurescheme.detector.checkMaps(); if(hasBinaryFeatureDetector){ bindetect.kernel.checkMaps(); bindetect.binaryMethod.checkMaps(); } for ( Object ein:in ){ PolarityEvent e = (PolarityEvent)ein; int type = e.getType(); int x = e.getX(); int y = e.getY(); int index = getIndex(x, y); if( !rbarr[index].fullflag){ //partially or unfilled buffer if( type == 1){ //ON event map[index] += 1; if(hasKernelImplementor && kernelimplement.kernel!= null) kernelimplement.kernel.updateMap(x, y, 1); if(hasConvolutionFeatureScheme && featurescheme.kernel!= null) featurescheme.detector.getFeatures(x, y, 1, featurescheme.RelativeThreshold, e); if(hasBinaryFeatureDetector && bindetect.kernel!=null){ bindetect.kernel.updateMap(x, y, 1); bindetect.binaryMethod.getFeatures(x, y); } } else{ //OFF event map[index] -= 1; if(hasKernelImplementor && kernelimplement.kernel!= null) kernelimplement.kernel.updateMap(x, y, -1); if(hasConvolutionFeatureScheme && featurescheme.kernel!= null) featurescheme.detector.getFeatures(x, y, -1, featurescheme.RelativeThreshold, e); if(hasBinaryFeatureDetector && bindetect.kernel!=null){ bindetect.kernel.updateMap(x, y, -1); bindetect.binaryMethod.getFeatures(x, y); } } checkMax(index); checkMin(index); } else{ //filled to the capacity at least once if ( type == rbarr[index].getOldest() ){ //if incoming event is same ; //as one being pushed out ; } else{ if( type == 1 ){ //ON event map[index] += 2; if(hasKernelImplementor && kernelimplement.kernel!= null) kernelimplement.kernel.updateMap(x, y, 2); if(hasConvolutionFeatureScheme && featurescheme.kernel!= null){ featurescheme.detector.getFeatures(x, y, 2, featurescheme.RelativeThreshold, e); } if(hasBinaryFeatureDetector && bindetect.kernel!=null){ bindetect.kernel.updateMap(x, y, 2); bindetect.binaryMethod.getFeatures(x, y); } } else{ //OFF event map[index] -= 2; if(hasKernelImplementor && kernelimplement.kernel!= null) kernelimplement.kernel.updateMap(x, y, -2); if(hasConvolutionFeatureScheme && featurescheme.kernel!= null) featurescheme.detector.getFeatures(x, y, -2, featurescheme.RelativeThreshold, e); if(hasBinaryFeatureDetector && bindetect.kernel!=null){ bindetect.kernel.updateMap(x, y, -2); bindetect.binaryMethod.getFeatures(x, y); } } checkMax(index); checkMin(index); } } if(isRenderBufferMapEnabled()){ colorv[index] = (float)((map[index] - min)/(max - min)); disp.checkPixmapAllocation(); // make sure we have a pixmaps (not resally necessary since setting size will allocate pixmap disp.setPixmapRGB(x, y, colorv[index], colorv[index], colorv[index]); } rbarr[index].insert(e); } if(hasKernelImplementor){ kernelimplement.kernel.display.setPixmapArray(kernelimplement.kernel.grayvalue); kernelimplement.kernel.display.repaint(); // kernelimplement.kernel.updateFeatures(kernelimplement.kernel.keypoints, kernelimplement.RelativeThreshold); } if(hasConvolutionFeatureScheme){ featurescheme.detector.display.setPixmapArray(featurescheme.detector.grayvalue); featurescheme.detector.display.repaint(); // featurescheme.kernel.updateFeatures(featurescheme.kernel.keypoints, featurescheme.RelativeThreshold); } // if(hasBinaryFeatureDetector){ // bindetect.kernel.display.setPixmapArray(bindetect.kernel.grayvalue); // bindetect.kernel.display.repaint(); //// bindetect.binaryMethod.updateFeatures(bindetect.binaryMethod.keypoints); // // } disp.repaint(); return in; } public void checkMax(int index){ if ( map[index] > max ){ max = map[index]; } } public void checkMin(int index){ if ( map[index] < min ){ min = map[index]; } } public int getIndex(int x, int y){ int index = (x + (y*sizex)); return index; } @Override public void resetFilter() { if(!isFilterEnabled()) return; resetRingBuffers(); } @Override public void initFilter() { resetFilter(); } } //public class RingBuffer extends AbstractList<PolarityEvent> implements RandomAccess { //or extends Object // // private final int n; // buffer length // private final List<PolarityEvent> buf; // a List implementing RandomAccess // private int leader = 0; // private int size = 0; // // // // // public RingBuffer(int capacity) { //constructor for the ring buffer with size as argument // n = capacity + 1; // buf = new ArrayList<PolarityEvent>(Collections.nCopies(n, (PolarityEvent) null)); // } // // private int wrapIndex(int i) { //implementing circularity // int m = i % n; // if (m < 0) { // m += n; // } // return m; // } // // @Override // public int size() { // return this.size; // } // // @Override // public PolarityEvent get(int i) { //PolarityEvent is a defined return type // //this code returns the buffer member at the requested index // if (i < 0 || i >= n-1) throw new IndexOutOfBoundsException(); // // if(i > size()) throw new NullPointerException("Index is greater than size."); // // return buf.get(wrapIndex(leader + i)); // } // // @Override // public PolarityEvent set(int i, PolarityEvent e) { //this code sets the buffer member at the requested index // if (i < 0 || i >= n-1) { // throw new IndexOutOfBoundsException(); // } // if(i == size()) // assume leader's position as invalid (should use insert(e)) // throw new IndexOutOfBoundsException("The size of the list is " + size() + " while the index was " + i // +""); // return buf.set(wrapIndex(leader - size + i), e); // } // // public void insert(PolarityEvent e) //adds a new element // { // int s = size(); // buf.set(wrapIndex(leader), e); // leader = wrapIndex(++leader); // buf.set(leader, null); // if(s == n-1){ // fullflag[e.x][e.y] = true; // return; // we have replaced the eldest element. // } // // this.size++; // // } // // public PolarityEvent getOldest(){ //returns oldest member i.e. index 99 of the buffer // int i = wrapIndex(leader+1); // PolarityEvent a = null; // // for(;;i = wrapIndex(++i)) { // if(buf.get(i) != null) break; // if(i == leader) //break; // throw new IllegalStateException("Cannot remove element." // + " CircularArrayList is empty."); // } //// if( i!= leader ) //// a = buf.get(i); // return buf.get(i); // } // } ///* // * To change this template, choose Tools | Templates // * and open the template in the editor. // */ //package ch.unizh.ini.jaer.projects.eventbasedfeatures; // // ///** // * // * @author Varad // */ //public class PixelTimeBuffer extends EventFilter2D{ // // public int RingBufferSize = getPrefs().getInt("PixelTimeBuffer.RingBufferSize", 1); // public int dt = getPrefs().getInt("PixelTimeBuffer.dt", 500); // // public int sizex; // public int sizey; // // public float max ; // public float min ; // // public float[][] map; // public RingBuffer[][] rbarr; // // public float[][] colorv; // // ImageDisplay disp; // JFrame frame; // // public PixelTimeBuffer (AEChip chip){ // // super(chip); // this.chip = chip; // // final String sz = "Size", tim = "Timing"; // // setPropertyTooltip(sz, "RingBufferSize", "sets size of ring buffer"); // setPropertyTooltip(tim, "dt", "Events with less than this delta time in us to neighbors pass through"); // // sizex = chip.getSizeX(); // sizey = chip.getSizeY(); // // disp = ImageDisplay.createOpenGLCanvas(); // makde a new ImageDisplay GLCanvas with default OpenGL capabilities // frame = new JFrame("ImageFrame"); // make a JFrame to hold it // frame.setPreferredSize(new Dimension(sizex, sizey)); // set the window size // frame.getContentPane().add(disp, BorderLayout.CENTER); // add the GLCanvas to the center of the window // frame.pack(); // otherwise it wont fill up the display // } // // synchronized public int getRingBufferSize (){ // return RingBufferSize; // } // // synchronized public void setRingBufferSize( int RingBufferSize){ // this.RingBufferSize = RingBufferSize; // getPrefs().putInt("PixelTimeBuffer.RingBufferSize", RingBufferSize); // getSupport().firePropertyChange("RingBufferSize", this.RingBufferSize, RingBufferSize); // resetFilter(); // } // // public int getDt() { // return this.dt; // } // // public void setDt(final int dt) { // this.dt = dt; // getPrefs().putInt("PixelTimeBuffer.dt", dt); // getSupport().firePropertyChange("dt", this.dt, dt); // resetFilter(); // } // // synchronized public void checkMaps (){ // if ( rbarr == null || rbarr.length != chip.getSizeX() || rbarr[0].length != chip.getSizeY() ) // resetRingBuffers(); // } // // public void resetRingBuffers(){ // // int size = 128; // disp.setImageSize(size, size); // set dimensions of image // frame.setVisible(true); // make the frame visible // // max = 1; // min = 0; // map = new float[sizex][sizey]; // rbarr = new RingBuffer[sizex][sizey]; // colorv = new float[sizex][sizey]; // // for (int a = 0; a < sizex; a++){ // for (int b = 0; b < sizey; b++){ // rbarr[a][b] = new RingBuffer( getRingBufferSize() ); // } // } // } // // public class RingBuffer{ // // public int length ; // public PolarityEvent[] buffer; // an array of fixed length // public int leadPointer, trailPointer ; // public boolean arrayEmpty; // public int typeOldest; // // public RingBuffer(int cap){ // length = cap; // resetBuffer(); // } // // public void resetBuffer(){ // buffer = new PolarityEvent[length]; // this.leadPointer = 0; // this.trailPointer = 0; // this.arrayEmpty = true; // this.typeOldest = 0; // } // // public int incrIndex(int i){ // // i++; // return(wrapIndex(i)); // } // // public int wrapIndex(int j){ // // if(j>=length)j=0; // return j; // } // // public void insert( PolarityEvent e){ // // buffer[leadPointer] = e; // leadPointer = incrIndex(leadPointer); // // if(this.arrayEmpty == true) // this.arrayEmpty = false; // // // // } // // public PolarityEvent getOldest(){ // // return buffer[this.trailPointer]; // } // // public void updateBuffer(PolarityEvent e){ // // int x = e.getX(); // int y = e.getY(); // //// if(buffer[this.trailPointer] != null){ // while( ((e.getTimestamp() - rbarr[x][y].getOldest().getTimestamp()) > dt) && (rbarr[x][y].leadPointer != rbarr[x][y].trailPointer)){ // // if( (rbarr[x][y].buffer[rbarr[x][y].trailPointer]).getType() == 1){ // map[x][y] -= 1; // } // else{ // map[x][y] += 1; // } // checkMax(e); // checkMin(e); // // removeEvent(); // } // // } // // public void removeEvent(){ // // buffer[this.trailPointer] = null; // this.trailPointer = incrIndex(this.trailPointer); // // if(this.leadPointer == this.trailPointer) // this.arrayEmpty = true; // } // // // } // @Override // public EventPacket<?> filterPacket(EventPacket<?> in) { // // sizex = chip.getSizeX(); // sizey = chip.getSizeY(); // // if ( in == null ){ // return null; // } // // if ( enclosedFilter != null ){ // in = enclosedFilter.filterPacket(in); // } // // checkMaps(); // // for ( Object ein:in ){ // // PolarityEvent e = (PolarityEvent)ein; // int type = e.getType(); // int x = e.getX(); // int y = e.getY(); // // if(rbarr[x][y].arrayEmpty == true){ // // if( type == 1 ){ //ON event // map[x][y] += 1; // } // else{ // map[x][y] -= 1; // } // checkMax(e); // checkMin(e); // // } // // else{ // //// if(rbarr[x][y].leadPointer == 0){ // // if((rbarr[x][y].leadPointer == rbarr[x][y].trailPointer) && rbarr[x][y].arrayEmpty == false){ // //// System.out.print(2+"\n"); // // rbarr[x][y].typeOldest = rbarr[x][y].getOldest().getType(); // rbarr[x][y].trailPointer = rbarr[x][y].incrIndex(rbarr[x][y].trailPointer); //// rbarr[x][y].removeEvent(); // // rbarr[x][y].updateBuffer(e); // // if(rbarr[x][y].arrayEmpty == true){ // // if( type == 1 ){ //ON event // map[x][y] += 1; // } // else{ // map[x][y] -= 1; // } // checkMax(e); // checkMin(e); // } // // else{ // // if(rbarr[x][y].trailPointer == rbarr[x][y].wrapIndex(rbarr[x][y].leadPointer + 1)){ // //// System.out.print(2+"\n"); // // if ( type == rbarr[x][y].typeOldest ) { //if incoming event is same // ; //// System.out.print(3+"\n"); // } // else{ // if( type == 1 ){ //ON event // map[x][y] += 2; // // } // else{ //OFF event // map[x][y] -= 2; // } // checkMax(e); // checkMin(e); // } // //// rbarr[x][y].removeEvent(); // // } // // else{ // if( type == 1 ){ //ON event // map[x][y] += 1; // } // else{ // map[x][y] -= 1; // } // // checkMax(e); // checkMin(e); // } // } // // } // // else{ // if( type == 1 ){ //ON event // map[x][y] += 1; // } // else{ // map[x][y] -= 1; // } // checkMax(e); // checkMin(e); // } // } // // colorv[x][y] = (float)((map[x][y] - min)/(max - min)); // disp.checkPixmapAllocation(); // make sure we have a pixmaps (not really necessary since setting size will allocate pixmap // disp.setPixmapRGB(x, y, colorv[x][y], colorv[x][y], colorv[x][y]); // rbarr[x][y].insert(e); // } // // disp.repaint(); // return in; // } // // // // synchronized public void checkMax(PolarityEvent e){ // // int x = e.getX(); // int y = e.getY(); // if ( map[x][y] > max ){ // max = map[x][y]; // // } // } // // synchronized public void checkMin(PolarityEvent e){ // // int x = e.getX(); // int y = e.getY(); // if ( map[x][y] < min ){ // min = map[x][y]; // // } // } // // // @Override // public void resetFilter() { // // if(!isFilterEnabled()) // return; // // disp.clearImage(); // resetRingBuffers(); // } // // @Override // public void initFilter() { // resetFilter(); // } // // //}
lgpl-2.1
jonmersha/njiax
src/iax/protocol/user/command/UserCommandFacade.java
2903
package iax.protocol.user.command; import iax.protocol.peer.Peer; /** * Facade to user commands. */ public class UserCommandFacade { /** * Method that indicates that user has answered an incoming call. * @param peer Current peer. * @param callingNumber the calling number of the call that is going to be accepted */ public static void answerCall(Peer peer, String callingNumber) { (new AnswerCall(peer, callingNumber)).execute(); } /** * Method to hang up a call. * @param peer Current peer. * @param calledNumber The number of the hung call. */ public static void hangupCall(Peer peer, String calledNumber) { (new HangupCall(peer, calledNumber)).execute(); } /** * Method to hold a call. * @param peer Current peer. * @param calledNumber The number of the muted call. */ public static void holdCall(Peer peer, String calledNumber) { (new HoldCall(peer, calledNumber)).execute(); } /** * Method to start a new call. * @param peer Current peer. * @param calledNumber Number to call to. */ public static void newCall(Peer peer, String calledNumber) { (new NewCall(peer, calledNumber)).execute(); } /** * Exit from the system * @param peer Current peer. */ public static void exit(Peer peer) { (new Exit(peer)).execute(); } /** * Method to mute a call. * @param peer Current peer. * @param calledNumber The number of the muted call. */ public static void muteCall(Peer peer, String calledNumber) { (new MuteCall(peer, calledNumber)).execute(); } /** * Method to unhold a call. * @param peer Current peer. * @param calledNumber The number of the muted call. */ public static void unHoldCall(Peer peer, String calledNumber) { (new UnHoldCall(peer, calledNumber)).execute(); } /** * Method to unmute a call. * @param peer Current peer. * @param calledNumber The number of the muted call. */ public static void unMuteCall(Peer peer, String calledNumber) { (new UnMuteCall(peer, calledNumber)).execute(); } /** * Method to send a DTMF tone. * @param peer Current peer. * @param calledNumber The number of the muted call. */ public static void sendDTMF(Peer peer, String calledNumber, char tone) { (new SendDTMF(peer, calledNumber, tone)).execute(); } /** * Method to transfer a call. * @param peer Current peer. * @param srcNumber the source number of the transfer * @param dstNumber the destination number of the transfer */ public static void transferCall(Peer peer, String srcNumber, String dstNumber) { (new TransferCall(peer, srcNumber, dstNumber)).execute(); } }
lgpl-2.1
mbert/mulberry-lib-jx
libjx/code/jXEventUtil.cpp
3644
/****************************************************************************** jXEventUtil.cpp Useful functions for dealing with X events. Copyright © 1996 John Lindal. All rights reserved. ******************************************************************************/ #include <JXStdInc.h> #include <jXEventUtil.h> #include <JXDisplay.h> #include <JString.h> #include <jAssert.h> /****************************************************************************** JXIsPrint Returns kJTrue if the keysym is between 1 and 255 and isprint() returns kJTrue. ******************************************************************************/ JBoolean JXIsPrint ( const int keysym ) { return JConvertToBoolean( 0 < keysym && keysym <= 255 && JIsPrint(keysym) ); } /****************************************************************************** JXGetEventTime Return the time stamp of the event. Returns kJFalse if the given event doesn't contain a time stamp. Selection events contain a time field, but this is a timestamp generated by clients, not the current server time. ******************************************************************************/ JBoolean JXGetEventTime ( const XEvent& xEvent, Time* time ) { *time = 0; if (xEvent.type == KeyPress || xEvent.type == KeyRelease) { *time = xEvent.xkey.time; return kJTrue; } else if (xEvent.type == ButtonPress || xEvent.type == ButtonRelease) { *time = xEvent.xbutton.time; return kJTrue; } else if (xEvent.type == MotionNotify) { *time = xEvent.xmotion.time; return kJTrue; } else if (xEvent.type == EnterNotify || xEvent.type == LeaveNotify) { *time = xEvent.xcrossing.time; return kJTrue; } else if (xEvent.type == PropertyNotify) { *time = xEvent.xproperty.time; return kJTrue; } else { return kJFalse; // event doesn't contain the information } } /****************************************************************************** JXGetButtonAndModifierStates Return the button and key modifiers states of the event. Returns kJFalse if the given event doesn't contain the information. ******************************************************************************/ JBoolean JXGetButtonAndModifierStates ( const XEvent& xEvent, JXDisplay* display, unsigned int* state ) { *state = 0; if (xEvent.type == KeyPress) { *state = xEvent.xkey.state; JIndex modifierIndex; if (display->KeycodeToModifier(xEvent.xkey.keycode, &modifierIndex)) { *state = JXKeyModifiers::SetState(display, *state, modifierIndex, kJTrue); } return kJTrue; } else if (xEvent.type == KeyRelease) { *state = xEvent.xkey.state; JIndex modifierIndex; if (display->KeycodeToModifier(xEvent.xkey.keycode, &modifierIndex)) { *state = JXKeyModifiers::SetState(display, *state, modifierIndex, kJFalse); } return kJTrue; } else if (xEvent.type == ButtonPress) { const JXMouseButton currButton = (JXMouseButton) xEvent.xbutton.button; *state = JXButtonStates::SetState(xEvent.xbutton.state, currButton, kJTrue); return kJTrue; } else if (xEvent.type == ButtonRelease) { const JXMouseButton currButton = (JXMouseButton) xEvent.xbutton.button; *state = JXButtonStates::SetState(xEvent.xbutton.state, currButton, kJFalse); return kJTrue; } else if (xEvent.type == MotionNotify) { *state = xEvent.xmotion.state; return kJTrue; } else if (xEvent.type == EnterNotify || xEvent.type == LeaveNotify) { *state = xEvent.xcrossing.state; return kJTrue; } else { return kJFalse; // event doesn't contain the information } }
lgpl-2.1
jfree/jfreechart
src/main/java/org/jfree/chart/labels/XYSeriesLabelGenerator.java
2286
/* =========================================================== * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * * (C) Copyright 2000-2022, by David Gilbert and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners.] * * --------------------------- * XYSeriesLabelGenerator.java * --------------------------- * (C) Copyright 2004-2022, by David Gilbert. * * Original Author: David Gilbert; * Contributor(s): -; * */ package org.jfree.chart.labels; import org.jfree.data.xy.XYDataset; /** * A generator that creates labels for the series in an {@link XYDataset}. * <P> * Classes that implement this interface should be either (a) immutable, or * (b) cloneable via the {@code PublicCloneable} interface (defined in * the JCommon class library). This provides a mechanism for the referring * renderer to clone the generator if necessary. */ public interface XYSeriesLabelGenerator { /** * Generates a label for the specified series. This label will be * used for the chart legend. * * @param dataset the dataset ({@code null} not permitted). * @param series the series. * * @return A series label. */ String generateLabel(XYDataset dataset, int series); }
lgpl-2.1
PhrozenByte/WCF2
wcfsetup/install/files/lib/system/template/plugin/PagesFunctionTemplatePlugin.class.php
7411
<?php namespace wcf\system\template\plugin; use wcf\system\exception\SystemException; use wcf\system\request\LinkHandler; use wcf\system\template\TemplateEngine; use wcf\system\WCF; use wcf\util\StringUtil; /** * Template function plugin which generates sliding pagers. * * Usage: * {pages pages=10 link='page-%d.html'} * {pages page=8 pages=10 link='page-%d.html'} * * assign to variable 'output'; do not print: * {pages page=8 pages=10 link='page-%d.html' assign='output'} * * assign to variable 'output' and do print also: * {pages page=8 pages=10 link='page-%d.html' assign='output' print=true} * * @author Marcel Werk * @copyright 2001-2014 WoltLab GmbH * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> * @package com.woltlab.wcf * @subpackage system.template.plugin * @category Community Framework */ class PagesFunctionTemplatePlugin implements IFunctionTemplatePlugin { const SHOW_LINKS = 11; /** * Inserts the page number into the link. * * @param string $link * @param integer $pageNo * @return string final link */ protected static function insertPageNumber($link, $pageNo) { $startPos = mb_strpos($link, '%d'); if ($startPos !== null) $link = mb_substr($link, 0, $startPos) . $pageNo . mb_substr($link, $startPos + 2); return $link; } /** * Generates HTML code for a link. * * @param string $link * @param integer $pageNo * @param integer $activePage * @param integer $pages * @return string */ protected function makeLink($link, $pageNo, $activePage, $pages) { // first page if ($activePage != $pageNo) { return '<li class="button"><a href="'.$this->insertPageNumber($link, $pageNo).'" title="'.WCF::getLanguage()->getDynamicVariable('wcf.page.pageNo', array('pageNo' => $pageNo)).'">'.StringUtil::formatInteger($pageNo).'</a></li>'."\n"; } else { return '<li class="button active"><span>'.StringUtil::formatInteger($pageNo).'</span><span class="invisible">'.WCF::getLanguage()->getDynamicVariable('wcf.page.pagePosition', array('pageNo' => $pageNo, 'pages' => $pages)).'</span></li>'."\n"; } } /** * Generates HTML code for 'previous' link. * * @param type $link * @param type $pageNo * @return string */ protected function makePreviousLink($link, $pageNo) { if ($pageNo > 1) { return '<li class="button skip"><a href="'.$this->insertPageNumber($link, $pageNo - 1).'" title="'.WCF::getLanguage()->getDynamicVariable('wcf.global.page.previous').'" class="jsTooltip"><span class="icon icon16 icon-double-angle-left"></span></a></li>'."\n"; } else { return '<li class="skip disabled"><span class="icon icon16 icon-double-angle-left disabled"></span></li>'."\n"; } } /** * Generates HTML code for 'next' link. * * @param type $link * @param type $pageNo * @return string */ protected function makeNextLink($link, $pageNo, $pages) { if ($pageNo && $pageNo < $pages) { return '<li class="button skip"><a href="'.$this->insertPageNumber($link, $pageNo + 1).'" title="'.WCF::getLanguage()->getDynamicVariable('wcf.global.page.next').'" class="jsTooltip"><span class="icon icon16 icon-double-angle-right"></span></a></li>'."\n"; } else { return '<li class="skip disabled"><span class="icon icon16 icon-double-angle-right disabled"></span></li>'."\n"; } } /** * @see \wcf\system\template\IFunctionTemplatePlugin::execute() */ public function execute($tagArgs, TemplateEngine $tplObj) { // needed params: controller, link, page, pages if (!isset($tagArgs['link'])) throw new SystemException("missing 'link' argument in pages tag"); if (!isset($tagArgs['controller'])) throw new SystemException("missing 'controller' argument in pages tag"); if (!isset($tagArgs['pages'])) { if (($tagArgs['pages'] = $tplObj->get('pages')) === null) { throw new SystemException("missing 'pages' argument in pages tag"); } } $html = ''; if ($tagArgs['pages'] > 1) { // create and encode route link $parameters = array(); if (isset($tagArgs['id'])) $parameters['id'] = $tagArgs['id']; if (isset($tagArgs['title'])) $parameters['title'] = $tagArgs['title']; if (isset($tagArgs['object'])) $parameters['object'] = $tagArgs['object']; if (isset($tagArgs['application'])) $parameters['application'] = $tagArgs['application']; $link = StringUtil::encodeHTML(LinkHandler::getInstance()->getLink($tagArgs['controller'], $parameters, $tagArgs['link'])); if (!isset($tagArgs['page'])) { if (($tagArgs['page'] = $tplObj->get('pageNo')) === null) { $tagArgs['page'] = 0; } } // open div and ul $html .= "<nav class=\"pageNavigation\" data-link=\"".$link."\" data-pages=\"".$tagArgs['pages']."\">\n<ul>\n"; // previous page $html .= $this->makePreviousLink($link, $tagArgs['page']); // first page $html .= $this->makeLink($link, 1, $tagArgs['page'], $tagArgs['pages']); // calculate page links $maxLinks = static::SHOW_LINKS - 4; $linksBeforePage = $tagArgs['page'] - 2; if ($linksBeforePage < 0) $linksBeforePage = 0; $linksAfterPage = $tagArgs['pages'] - ($tagArgs['page'] + 1); if ($linksAfterPage < 0) $linksAfterPage = 0; if ($tagArgs['page'] > 1 && $tagArgs['page'] < $tagArgs['pages']) { $maxLinks--; } $half = $maxLinks / 2; $left = $right = $tagArgs['page']; if ($left < 1) $left = 1; if ($right < 1) $right = 1; if ($right > $tagArgs['pages'] - 1) $right = $tagArgs['pages'] - 1; if ($linksBeforePage >= $half) { $left -= $half; } else { $left -= $linksBeforePage; $right += $half - $linksBeforePage; } if ($linksAfterPage >= $half) { $right += $half; } else { $right += $linksAfterPage; $left -= $half - $linksAfterPage; } $right = intval(ceil($right)); $left = intval(ceil($left)); if ($left < 1) $left = 1; if ($right > $tagArgs['pages']) $right = $tagArgs['pages']; // left ... links if ($left > 1) { if ($left - 1 < 2) { $html .= $this->makeLink($link, 2, $tagArgs['page'], $tagArgs['pages']); } else { $html .= '<li class="button jumpTo"><a title="'.WCF::getLanguage()->getDynamicVariable('wcf.global.page.jumpTo').'" class="jsTooltip">'.StringUtil::HELLIP.'</a></li>'."\n"; } } // visible links for ($i = $left + 1; $i < $right; $i++) { $html .= $this->makeLink($link, $i, $tagArgs['page'], $tagArgs['pages']); } // right ... links if ($right < $tagArgs['pages']) { if ($tagArgs['pages'] - $right < 2) { $html .= $this->makeLink($link, $tagArgs['pages'] - 1, $tagArgs['page'], $tagArgs['pages']); } else { $html .= '<li class="button jumpTo"><a title="'.WCF::getLanguage()->getDynamicVariable('wcf.global.page.jumpTo').'" class="jsTooltip">'.StringUtil::HELLIP.'</a></li>'."\n"; } } // last page $html .= $this->makeLink($link, $tagArgs['pages'], $tagArgs['page'], $tagArgs['pages']); // next page $html .= $this->makeNextLink($link, $tagArgs['page'], $tagArgs['pages']); // close div and ul $html .= "</ul></nav>\n"; } // assign html output to template var if (isset($tagArgs['assign'])) { $tplObj->assign($tagArgs['assign'], $html); if (!isset($tagArgs['print']) || !$tagArgs['print']) return ''; } return $html; } }
lgpl-2.1
concord-consortium/framework
src/org/concord/framework/otrunk/OTControllerService.java
8453
/* * Copyright (C) 2004 The Concord Consortium, Inc., * 10 Concord Crossing, Concord, MA 01742 * * Web Site: http://www.concord.org * Email: info@concord.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * END LICENSE */ package org.concord.framework.otrunk; import java.util.Vector; public interface OTControllerService { /** * This method is typically not used. Typically controller classes are * registered in a OTPackage implementation. * * If a controller class is only registered using this method then it will need to be * registered each time a new view wants to use it. If it is registered in the OTPackage * then new views don't need to worry about registering it. * * This method takes a controllerClass. * Controller classes take OTObjects and create * real objects from them. * */ public void registerControllerClass(Class<? extends OTController> viewClass); /** * This is a helper method. The real object class of a controller class should * be in a public final static Class [] realObjectClasses * field of the interface. This method just looks up that field and returns * the value. * * @param controllerClass * @return */ public Class<?> [] getRealObjectClasses(Class<? extends OTController> controllerClass); /** * This searches an internal table of realObjects to * see if an OTObject has been created for this object. * It returns it if it has. * * If the OTObject has not been created then the * registered OTController classes are searched to see if there * is one that can work with this realObject class. * The OTController class needs to define a * public final static Class [] realObjectClasses * field. If it matches, that controller is used to make the * OTObject. * * The {@link OTController} registerRealObject is called. * followed by saveRealObject. * * In the OTController object the saveRealObject method can and should * call getOTObject when it needs to save a reference to another * realObject. * * Note: getOTObject will only call saveRealObject if this is the first time the * realObject is seen by this service. * * Note to implementors: a weak map should be used so that if all the * references to the real object are gone then the real object * can be garbage collected. If the real object is needed again for * some reason then it will just be created again. * * @param realObject * @return */ public OTObject getOTObject(Object realObject); /** * Look to see if this realObject has been created already or added with * getOTObject. If so return that previous realObject. * * Otherwise, use the controller registered for the class of this otObject * to create the realObject, and load the * state from the otObject into the realObject. * * The implementation should use a weak map so that if all the * references to the real object are gone then the real object * can be garbage collected. If the real object is needed again for * some reason then it will just be created again. * * If the controller service is in the middle of disposing then this will * return null for real objects that haven't already been created. * * @param otObject * @return */ public Object getRealObject(OTObject otObject); /** * Take a real object which was created else * where and connect it to an otObject and * load the state of otObject into the realObject * * @param realObject * @param otObject */ public Object getRealObject(OTObject otObject, Object realObject); /** * A helper method to get a Vector of real objects from an * OTObjectList, so that we don't have to first get the OTObjectList * and then create all the RealObjects ourselves. * * @param otObjectList * @return */ public Vector<Object> getRealObjects(OTObjectList otObjectList); /** * This saves the state of realObject into this ot object. It needs * to lookup the controller for this realObject and otObject. * * This is very similar to getOTObject, which calls saveRealObject * at the end. Exposing it here allows others to use this * functionality without having to directly access the controller * or otObject directly * * TODO it is not clear how much state should be saved here and whether it should * be recursive. If listeners are being used on all the sub objects then when * this is called after the object has been registered it doesn't need to be * recursive. If this is called to store a realObject that wasn't created by * the controllerservice this will need to recursively save all the sub objects. * * It should not mess up anything if the method is recursive. It is just a waste of * time in some cases. However there is a danger of infinite loops with circular * references. * * @param otObject * @param realObject */ public void saveRealObject(Object realObject, OTObject otObject); /** * This loads the state of this ot object into the realObject. It needs * to lookup the controller for this realObject and otObject. * * This is very similar to getRealObject but getRealObject only calls * loadRealObject on the controller when it's called the first time * * TODO it is not clear how much state should be loaded here and whether it should * be recursive. If listeners are being used on all the sub objects then when * this is called after the object has been registered it doesn't need to be * recursive. If this is called to load a realObject that wasn't created by * the controllerservice this will need to recursively load all the sub objects. * * It should not mess up anything if the method is recursive. It is just a waste of * time in some cases. However there is a danger of infinite loops with circular * references. * * @param otObject * @param realObject */ public void loadRealObject(OTObject otObject, Object realObject); /** * This saves the state of realObject into this ot object. It needs * to lookup the controller for this realObject and otObject. * * This method is called both by getOTObject and getRealObject. You should * only need to call it explicitly if you don't want the other side effects * of those methods. For example if the realObject needs to be managed by * some parent object instead of the standard controller for the realObject * * A possible alternative solution to this is to make a custom controller. * but that alternative hasn't been tried yet, so it might need more * framework support to be possible. */ public void registerRealObject(Object realObject, OTObject otObject); /** * Return the controller instance that has been or would be be used to create a * real object. You should not call any of the public methods of OTController * these methods should only be called by the controller service. * * @param otObject * @return */ public OTController getController(OTObject otObject); /** * Calling this will call dispose on all of the controllers this controller * service knows about. That will give them a chance to clean up any * listeners they've added. */ public void dispose(); /** * provide a service which other controllers can use. * this allows views which use controllers to provide custom services to those * controllers. * * @param serviceClass * @param service */ public void addService(Class<?> serviceClass, Object service); /** * Lookup a service that was provided to this controllerService * * @param serviceClass * @return */ public <T> T getService(Class<T> serviceClass); }
lgpl-2.1
mrijk/gimp-sharp
plug-ins/UpdateCheck/Renderer.cs
5050
// The UpdateCheck plug-in // Copyright (C) 2004-2016 Maurits Rijk // // Renderer.cs // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // using System; using System.IO; using System.Net; using System.Reflection; using System.Text; using System.Threading; using System.Xml; namespace Gimp.UpdateCheck { public class Renderer : BaseRenderer { static ManualResetEvent allDone= new ManualResetEvent(false); const int BUFFER_SIZE = 1024; const int DefaultTimeout = 2 * 60 * 1000; // 2 minutes timeout public Renderer(VariableSet variables) : base(variables) { } public void Render() { bool enableProxy = GetValue<bool>("enable_proxy"); string httpProxy = GetValue<string>("http_proxy"); string port = GetValue<string>("port"); if (enableProxy) { Gimp.RcSet("update-enable-proxy", (enableProxy) ? "true" : "false"); Gimp.RcSet("update-http-proxy", httpProxy); Gimp.RcSet("update-port", port); } var assembly = Assembly.GetAssembly(typeof(Plugin)); Console.WriteLine(assembly.GetName().Version); var doc = new XmlDocument(); try { var myRequest = (HttpWebRequest) WebRequest.Create("http://gimp-sharp.sourceforge.net/version.xml"); // Create a proxy object, needed for mono behind a firewall?! if (enableProxy) { var myProxy = new WebProxy() {Address = new Uri(httpProxy + ":" + port)}; myRequest.Proxy = myProxy; } var requestState = new RequestState(myRequest); // Start the asynchronous request. IAsyncResult result= (IAsyncResult) myRequest.BeginGetResponse (new AsyncCallback(RespCallback), requestState); // this line implements the timeout, if there is a timeout, // the callback fires and the request becomes aborted ThreadPool.RegisterWaitForSingleObject (result.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), myRequest, DefaultTimeout, true); // The response came in the allowed time. The work processing will // happen in the callback function. allDone.WaitOne(); // Release the HttpWebResponse resource. requestState.Response.Close(); } catch (Exception e) { Console.WriteLine("Exception!"); Console.WriteLine(e.StackTrace); return; } } static void TimeoutCallback(object state, bool timedOut) { if (timedOut) { var request = state as HttpWebRequest; request?.Abort(); } } static void RespCallback(IAsyncResult asynchronousResult) { try { // State of request is asynchronous. var requestState = (RequestState) asynchronousResult.AsyncState; var myHttpWebRequest = requestState.Request; requestState.Response = (HttpWebResponse) myHttpWebRequest.EndGetResponse(asynchronousResult); // Read the response into a Stream object. var responseStream = requestState.Response.GetResponseStream(); requestState.StreamResponse = responseStream; var asynchronousInputRead = responseStream.BeginRead(requestState.BufferRead, 0, BUFFER_SIZE, new AsyncCallback(ReadCallBack), requestState); return; } catch(WebException e) { Console.WriteLine("\nRespCallback Exception raised!"); Console.WriteLine("\nMessage:{0}",e.Message); Console.WriteLine("\nStatus:{0}",e.Status); } allDone.Set(); } static void ReadCallBack(IAsyncResult asyncResult) { try { var requestState = (RequestState) asyncResult.AsyncState; var responseStream = requestState.StreamResponse; int read = responseStream.EndRead(asyncResult); if (read > 0) { requestState.RequestData.Append (Encoding.ASCII.GetString(requestState.BufferRead, 0, read)); IAsyncResult asynchronousResult = responseStream.BeginRead(requestState.BufferRead, 0, BUFFER_SIZE, new AsyncCallback(ReadCallBack), requestState); return; } else { if (requestState.RequestData.Length > 1) { string stringContent = requestState.RequestData.ToString(); Console.WriteLine(stringContent); } responseStream.Close(); } } catch (WebException e) { Console.WriteLine("\nReadCallBack Exception raised!"); Console.WriteLine("\nMessage:{0}",e.Message); Console.WriteLine("\nStatus:{0}",e.Status); } allDone.Set(); } } }
lgpl-2.1
radekp/qt
demos/embedded/fluidlauncher/fluidlauncher.cpp
8555
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the demonstration applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QXmlStreamReader> #include "fluidlauncher.h" #define DEFAULT_INPUT_TIMEOUT 10000 #define SIZING_FACTOR_HEIGHT 6/10 #define SIZING_FACTOR_WIDTH 6/10 FluidLauncher::FluidLauncher(QStringList* args) { pictureFlowWidget = new PictureFlow(); slideShowWidget = new SlideShow(); inputTimer = new QTimer(); addWidget(pictureFlowWidget); addWidget(slideShowWidget); setCurrentWidget(pictureFlowWidget); pictureFlowWidget->setFocus(); QRect screen_size = QApplication::desktop()->screenGeometry(); QObject::connect(pictureFlowWidget, SIGNAL(itemActivated(int)), this, SLOT(launchApplication(int))); QObject::connect(pictureFlowWidget, SIGNAL(inputReceived()), this, SLOT(resetInputTimeout())); QObject::connect(slideShowWidget, SIGNAL(inputReceived()), this, SLOT(switchToLauncher())); QObject::connect(inputTimer, SIGNAL(timeout()), this, SLOT(inputTimedout())); inputTimer->setSingleShot(true); inputTimer->setInterval(DEFAULT_INPUT_TIMEOUT); const int h = screen_size.height() * SIZING_FACTOR_HEIGHT; const int w = screen_size.width() * SIZING_FACTOR_WIDTH; const int hh = qMin(h, w); const int ww = hh / 3 * 2; pictureFlowWidget->setSlideSize(QSize(ww, hh)); bool success; int configIndex = args->indexOf("-config"); if ( (configIndex != -1) && (configIndex != args->count()-1) ) success = loadConfig(args->at(configIndex+1)); else success = loadConfig("config.xml"); if (success) { populatePictureFlow(); showFullScreen(); inputTimer->start(); } else { pictureFlowWidget->setAttribute(Qt::WA_DeleteOnClose, true); pictureFlowWidget->close(); } } FluidLauncher::~FluidLauncher() { delete pictureFlowWidget; delete slideShowWidget; } bool FluidLauncher::loadConfig(QString configPath) { QFile xmlFile(configPath); if (!xmlFile.exists() || (xmlFile.error() != QFile::NoError)) { qDebug() << "ERROR: Unable to open config file " << configPath; return false; } slideShowWidget->clearImages(); xmlFile.open(QIODevice::ReadOnly); QXmlStreamReader reader(&xmlFile); while (!reader.atEnd()) { reader.readNext(); if (reader.isStartElement()) { if (reader.name() == "demos") parseDemos(reader); else if(reader.name() == "slideshow") parseSlideshow(reader); } } if (reader.hasError()) { qDebug() << QString("Error parsing %1 on line %2 column %3: \n%4") .arg(configPath) .arg(reader.lineNumber()) .arg(reader.columnNumber()) .arg(reader.errorString()); } // Append an exit Item DemoApplication* exitItem = new DemoApplication(QString(), QLatin1String("Exit Embedded Demo"), QString(), QStringList()); demoList.append(exitItem); return true; } void FluidLauncher::parseDemos(QXmlStreamReader& reader) { while (!reader.atEnd()) { reader.readNext(); if (reader.isStartElement() && reader.name() == "example") { QXmlStreamAttributes attrs = reader.attributes(); QStringRef filename = attrs.value("filename"); if (!filename.isEmpty()) { QStringRef name = attrs.value("name"); QStringRef image = attrs.value("image"); QStringRef args = attrs.value("args"); DemoApplication* newDemo = new DemoApplication( filename.toString(), name.isEmpty() ? "Unamed Demo" : name.toString(), image.toString(), args.toString().split(" ")); demoList.append(newDemo); } } else if(reader.isEndElement() && reader.name() == "demos") { return; } } } void FluidLauncher::parseSlideshow(QXmlStreamReader& reader) { QXmlStreamAttributes attrs = reader.attributes(); QStringRef timeout = attrs.value("timeout"); bool valid; if (!timeout.isEmpty()) { int t = timeout.toString().toInt(&valid); if (valid) inputTimer->setInterval(t); } QStringRef interval = attrs.value("interval"); if (!interval.isEmpty()) { int i = interval.toString().toInt(&valid); if (valid) slideShowWidget->setSlideInterval(i); } while (!reader.atEnd()) { reader.readNext(); if (reader.isStartElement()) { QXmlStreamAttributes attrs = reader.attributes(); if (reader.name() == "imagedir") { QStringRef dir = attrs.value("dir"); slideShowWidget->addImageDir(dir.toString()); } else if(reader.name() == "image") { QStringRef image = attrs.value("image"); slideShowWidget->addImage(image.toString()); } } else if(reader.isEndElement() && reader.name() == "slideshow") { return; } } } void FluidLauncher::populatePictureFlow() { pictureFlowWidget->setSlideCount(demoList.count()); for (int i=demoList.count()-1; i>=0; --i) { pictureFlowWidget->setSlide(i, *(demoList[i]->getImage())); pictureFlowWidget->setSlideCaption(i, demoList[i]->getCaption()); } pictureFlowWidget->setCurrentSlide(demoList.count()/2); } void FluidLauncher::launchApplication(int index) { // NOTE: Clearing the caches will free up more memory for the demo but will cause // a delay upon returning, as items are reloaded. //pictureFlowWidget->clearCaches(); if (index == demoList.size() -1) { qApp->quit(); return; } inputTimer->stop(); QObject::connect(demoList[index], SIGNAL(demoFinished()), this, SLOT(demoFinished())); demoList[index]->launch(); } void FluidLauncher::switchToLauncher() { slideShowWidget->stopShow(); inputTimer->start(); setCurrentWidget(pictureFlowWidget); } void FluidLauncher::resetInputTimeout() { if (inputTimer->isActive()) inputTimer->start(); } void FluidLauncher::inputTimedout() { switchToSlideshow(); } void FluidLauncher::switchToSlideshow() { inputTimer->stop(); slideShowWidget->startShow(); setCurrentWidget(slideShowWidget); } void FluidLauncher::demoFinished() { setCurrentWidget(pictureFlowWidget); inputTimer->start(); // Bring the Fluidlauncher to the foreground to allow selecting another demo raise(); activateWindow(); } void FluidLauncher::changeEvent(QEvent* event) { if (event->type() == QEvent::ActivationChange) { if (isActiveWindow()) { if(currentWidget() == pictureFlowWidget) { resetInputTimeout(); } else { slideShowWidget->startShow(); } } else { inputTimer->stop(); slideShowWidget->stopShow(); } } QStackedWidget::changeEvent(event); }
lgpl-2.1
Rollins/Rolcore
src/Rolcore.Web/Protocols/Sitemap.cs
2518
using System.Collections.Generic; using System.IO; using System.Xml; using System.ComponentModel.Composition; using System; using System.Linq; namespace Rolcore.Web.Protocols { [Export(typeof(Sitemap))] public class Sitemap : List<SitemapUrl> { private string _Xmlns = "http://www.sitemaps.org/schemas/sitemap/0.9"; #region Constructors public Sitemap(){ } public Sitemap(int capacity) : base(capacity) { } public Sitemap(IEnumerable<SitemapUrl> collection): base(collection){ } #endregion Constructors public string Xmlns { get { return _Xmlns; } set { _Xmlns = value; } } public void Write(TextWriter output) { using (XmlTextWriter writer = new XmlTextWriter(output)) { //writer.WriteStartDocument(); writer.WriteStartElement("urlset"); writer.WriteAttributeString("xmlns", this.Xmlns); writer.WriteAttributeString("xmlns:geo", "http://www.google.com/geo/schemas/sitemap/1.0"); foreach (SitemapUrl url in this.OrderBy(item => item.Loc)) { writer.WriteStartElement("url"); writer.WriteElementString("loc", url.Loc); if (!string.IsNullOrEmpty(url.LastMod)) writer.WriteElementString("lastmod", url.LastMod); if (!string.IsNullOrEmpty(url.ChangeFreq)) writer.WriteElementString("changefreq", url.ChangeFreq); if (!string.IsNullOrEmpty(url.Priority)) writer.WriteElementString("priority", url.Priority); if (url.Loc.EndsWith(".kml")) // See http://code.google.com/apis/kml/documentation/kmlSearch.html { writer.WriteStartElement("geo:geo"); writer.WriteElementString("geo:format", "kml"); writer.WriteEndElement(); } writer.WriteEndElement(); } writer.WriteEndElement(); //writer.WriteEndDocument(); writer.Flush(); } } public override string ToString() { using (StringWriter result = new StringWriter()) { this.Write(result); return result.ToString(); } } } }
lgpl-2.1
pcarbonn/pyDatalog
pyDatalog/examples/python.py
3454
""" This file shows how to use pyDatalog using facts stored in python objects. It has 3 parts : 1. define python class and business rules 2. create python objects for 2 employees 3. Query the objects using the datalog engine """ from pyDatalog import pyDatalog """ 1. define python class and business rules """ class Employee(pyDatalog.Mixin): # --> Employee inherits the pyDatalog capability to use logic clauses def __init__(self, name, manager, salary): # method to initialize Employee instances super(Employee, self).__init__() # calls the initialization method of the Mixin class self.name = name self.manager = manager # direct manager of the employee, or None self.salary = salary # monthly salary of the employee def __repr__(self): # specifies how to display an Employee return self.name @pyDatalog.program() # indicates that the following method contains pyDatalog clauses def Employee(self): # the salary class N of employee X is computed as a function of his/her salary # this statement is a logic equality, not an assignment ! Employee.salary_class[X] = Employee.salary[X]//1000 # all the indirect managers Y of employee X are derived from his manager, recursively Employee.indirect_manager(X,Y) <= (Employee.manager[X]==Y) & (Y != None) Employee.indirect_manager(X,Y) <= (Employee.manager[X]==Z) & Employee.indirect_manager(Z,Y) & (Y != None) # count the number of reports of X (Employee.report_count[X] == len(Y)) <= Employee.indirect_manager(Y,X) """ 2. create python objects for 3 employees """ # John is the manager of Mary, who is the manager of Sam John = Employee('John', None, 6800) Mary = Employee('Mary', John, 6300) Sam = Employee('Sam', Mary, 5900) """ 3. Query the objects using the datalog engine """ # the following python statements implicitly use the datalog clauses in the class definition # What is the salary class of John ? print(John.salary_class) # prints 6 # who has a salary of 6300 ? pyDatalog.create_terms('X') Employee.salary[X] == 6300 # notice the similarity to a pyDatalog query print(X) # prints [Mary] print(X.v()) # prints Mary # who are the indirect managers of Mary ? Employee.indirect_manager(Mary, X) print(X) # prints [John] # Who are the employees of John with a salary below 6000 ? result = (Employee.salary[X] < 6000) & Employee.indirect_manager(X, John) print(result) # Sam is in the result print(X) # prints [Sam] print((Employee.salary_class[X] == 5) & Employee.indirect_manager(X, John) >= X) # Sam # verify that the manager of Mary is John assert Employee.manager[Mary]==John # who is his own indirect manager ? Employee.indirect_manager(X, X) print(X) # prints [] # who has 2 reports ? Employee.report_count[X] == 2 print(X) # prints [John] # what is the total salary of the employees of John ? # note : it is better to place aggregation clauses in the class definition pyDatalog.load("(Employee.budget[X] == sum(N, for_each=Y)) <= (Employee.indirect_manager(Y, X)) & (Employee.salary[Y]==N)") Employee.budget[John]==X print(X) # prints [12200] # who has the lowest salary ? pyDatalog.load("(lowest[1] == min(X, order_by=N)) <= (Employee.salary[X]==N)") # must use ask() because inline queries cannot use unprefixed literals print(pyDatalog.ask("lowest[1]==X")) # prints set([(1, 'Sam')])
lgpl-2.1
JackieXie168/pacc
doc/html/class_p_a_c_c_1_1_s_v_g_1_1_color.html
4519
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>PACC: PACC::SVG::Color Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.1 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main&nbsp;Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li> <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="namespace_p_a_c_c.html">PACC</a>::<a class="el" href="namespace_p_a_c_c_1_1_s_v_g.html">SVG</a>::<a class="el" href="class_p_a_c_c_1_1_s_v_g_1_1_color.html">Color</a> </div> </div> <div class="contents"> <h1>PACC::SVG::Color Class Reference<br/> <small> [<a class="el" href="group___s_v_gtype.html">Types</a>]</small> </h1><!-- doxytag: class="PACC::SVG::Color" --><!-- doxytag: inherits="std::string" --> <p>Basic SVG color string. <a href="#_details">More...</a></p> <p><code>#include &lt;<a class="el" href="_types_8hpp_source.html">Types.hpp</a>&gt;</code></p> <div class="dynheader"> Inheritance diagram for PACC::SVG::Color:</div> <div class="dynsection"> <div class="center"> <img src="class_p_a_c_c_1_1_s_v_g_1_1_color.gif" usemap="#PACC::SVG::Color_map" alt=""/> <map id="PACC::SVG::Color_map" name="PACC::SVG::Color_map"> <area href="class_p_a_c_c_1_1_s_v_g_1_1_r_g_b_color.html" alt="PACC::SVG::RGBColor" shape="rect" coords="0,56,141,80"/> <area href="class_p_a_c_c_1_1_s_v_g_1_1_gray.html" alt="PACC::SVG::Gray" shape="rect" coords="0,112,141,136"/> </map> </div> </div> <p><a href="class_p_a_c_c_1_1_s_v_g_1_1_color-members.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7336a9a48e2b3dc9cc0963a752806cd4"></a><!-- doxytag: member="PACC::SVG::Color::Color" ref="a7336a9a48e2b3dc9cc0963a752806cd4" args="(ColorName inName)" --> &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_p_a_c_c_1_1_s_v_g_1_1_color.html#a7336a9a48e2b3dc9cc0963a752806cd4">Color</a> (<a class="el" href="group___s_v_gtype.html#ga3554ba9d7cbd2004e640f1a5f11aad72">ColorName</a> inName)</td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Construct color using name <code>inName</code>. <br/></td></tr> <tr><td colspan="2"><h2>Protected Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a38f838165689de3f40238b7ab1a7c63e"></a><!-- doxytag: member="PACC::SVG::Color::Color" ref="a38f838165689de3f40238b7ab1a7c63e" args="(const string &amp;inColor)" --> &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_p_a_c_c_1_1_s_v_g_1_1_color.html#a38f838165689de3f40238b7ab1a7c63e">Color</a> (const string &amp;inColor)</td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Construct color using string <code>inColor</code>. <br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Basic SVG color string. </p> <p>Definition at line <a class="el" href="_types_8hpp_source.html#l00116">116</a> of file <a class="el" href="_types_8hpp_source.html">Types.hpp</a>.</p> <hr/>The documentation for this class was generated from the following files:<ul> <li>PACC/SVG/<a class="el" href="_types_8hpp_source.html">Types.hpp</a></li> <li>PACC/SVG/<a class="el" href="_types_8cpp_source.html">Types.cpp</a></li> </ul> </div> <hr size="1"/><address style="text-align: right;"><small>Generated on Sun Jan 31 15:10:21 2010 for PACC by&nbsp; <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> </body> </html>
lgpl-2.1
GNOME/beast
bse/bseitem.cc
44851
// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html #include "bseitem.hh" #include "bsesuper.hh" #include "bsesnet.hh" #include "bsestorage.hh" #include "bseprocedure.hh" #include "bsemain.hh" #include "bseproject.hh" #include "bsesong.hh" // for song->musical_tuning #include "bseundostack.hh" #include <gobject/gvaluecollector.h> #include <string.h> enum { PROP_0, PROP_SEQID, }; /* --- prototypes --- */ static void bse_item_class_init_base (BseItemClass *klass); static void bse_item_class_finalize_base (BseItemClass *klass); static void bse_item_class_init (BseItemClass *klass); static void bse_item_init (BseItem *item); static void bse_item_set_property_internal (GObject *object, uint param_id, const GValue *value, GParamSpec *pspec); static void bse_item_get_property_internal (GObject *object, uint param_id, GValue *value, GParamSpec *pspec); static void bse_item_update_state (BseItem *self); static gboolean bse_item_real_needs_storage (BseItem *self, BseStorage *storage); static void bse_item_do_dispose (GObject *object); static void bse_item_do_finalize (GObject *object); static void bse_item_do_set_uname (BseObject *object, const char *uname); static uint bse_item_do_get_seqid (BseItem *item); static void bse_item_do_set_parent (BseItem *item, BseItem *parent); static BseUndoStack* bse_item_default_get_undo (BseItem *self); /* --- variables --- */ static GTypeClass *parent_class = NULL; static GSList *item_seqid_changed_queue = NULL; /* --- functions --- */ BSE_BUILTIN_TYPE (BseItem) { static const GTypeInfo item_info = { sizeof (BseItemClass), (GBaseInitFunc) bse_item_class_init_base, (GBaseFinalizeFunc) bse_item_class_finalize_base, (GClassInitFunc) bse_item_class_init, (GClassFinalizeFunc) NULL, NULL /* class_data */, sizeof (BseItem), 0 /* n_preallocs */, (GInstanceInitFunc) bse_item_init, }; assert_return (BSE_ITEM_FLAGS_USHIFT < BSE_OBJECT_FLAGS_MAX_SHIFT, 0); return bse_type_register_abstract (BSE_TYPE_OBJECT, "BseItem", "Base type for objects managed by a container", __FILE__, __LINE__, &item_info); } static void bse_item_class_init_base (BseItemClass *klass) { klass->get_candidates = NULL; } static void bse_item_class_finalize_base (BseItemClass *klass) { } static void bse_item_class_init (BseItemClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); BseObjectClass *object_class = BSE_OBJECT_CLASS (klass); parent_class = (GTypeClass*) g_type_class_peek_parent (klass); gobject_class->get_property = bse_item_get_property_internal; gobject_class->set_property = bse_item_set_property_internal; gobject_class->dispose = bse_item_do_dispose; gobject_class->finalize = bse_item_do_finalize; object_class->set_uname = bse_item_do_set_uname; klass->set_parent = bse_item_do_set_parent; klass->get_seqid = bse_item_do_get_seqid; klass->get_undo = bse_item_default_get_undo; klass->needs_storage = bse_item_real_needs_storage; bse_object_class_add_param (object_class, NULL, PROP_SEQID, sfi_pspec_int ("seqid", "Sequential ID", NULL, 0, 0, SFI_MAXINT, 1, "r")); } static void bse_item_init (BseItem *item) { item->parent = NULL; } static void bse_item_set_property_internal (GObject *object, uint param_id, const GValue *value, GParamSpec *pspec) { // BseItem *self = BSE_ITEM (object); switch (param_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; } } static void bse_item_get_property_internal (GObject *object, uint param_id, GValue *value, GParamSpec *pspec) { BseItem *self = BSE_ITEM (object); switch (param_id) { case PROP_SEQID: sfi_value_set_int (value, bse_item_get_seqid (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; } } static void bse_item_do_dispose (GObject *gobject) { BseItem *item = BSE_ITEM (gobject); /* force removal from parent */ if (item->parent) bse_container_remove_item (BSE_CONTAINER (item->parent), item); /* chain parent class' handler */ G_OBJECT_CLASS (parent_class)->dispose (gobject); } static void bse_item_do_finalize (GObject *object) { BseItem *item = BSE_ITEM (object); item_seqid_changed_queue = g_slist_remove (item_seqid_changed_queue, item); /* chain parent class' handler */ G_OBJECT_CLASS (parent_class)->finalize (object); assert_return (item->use_count == 0); } static void bse_item_do_set_uname (BseObject *object, const char *uname) { BseItem *item = BSE_ITEM (object); /* ensure that item names within their container are unique, * and that we don't end up with a NULL uname */ if (!BSE_IS_CONTAINER (item->parent) || (uname && !bse_container_lookup_item (BSE_CONTAINER (item->parent), uname))) { /* chain parent class' set_uname handler */ BSE_OBJECT_CLASS (parent_class)->set_uname (object, uname); } } static void bse_item_do_set_parent (BseItem *self, BseItem *parent) { self->parent = parent; bse_item_update_state (self); } static gboolean recurse_update_state (BseItem *self, void *data) { bse_item_update_state (self); return TRUE; } static void bse_item_update_state (BseItem *self) { /* save original state */ gboolean old_internal = BSE_ITEM_INTERNAL (self); /* update state */ if ((BSE_OBJECT_FLAGS (self) & BSE_ITEM_FLAG_INTERN) || (self->parent && BSE_ITEM_INTERNAL (self->parent))) BSE_OBJECT_SET_FLAGS (self, BSE_ITEM_FLAG_INTERN_BRANCH); else BSE_OBJECT_UNSET_FLAGS (self, BSE_ITEM_FLAG_INTERN_BRANCH); /* compare state and recurse if necessary */ if (BSE_IS_CONTAINER (self) && (old_internal != BSE_ITEM_INTERNAL (self))) bse_container_forall_items ((BseContainer*) self, recurse_update_state, NULL); } /** * @param item valid BseItem * @param internal TRUE or FALSE * * Set whether an item should be considered internal to the BSE * implementation (or implementation of another BSE object). * Internal items are not stored with their parents and undo * is not recorded for internal items either. Marking containers * internal also affects any children they contain, in effect, * the whole posterity spawned by the container is considered * internal. */ void bse_item_set_internal (void *item, gboolean internal) { BseItem *self = BSE_ITEM (item); assert_return (BSE_IS_ITEM (self)); if (internal) BSE_OBJECT_SET_FLAGS (self, BSE_ITEM_FLAG_INTERN); else BSE_OBJECT_UNSET_FLAGS (self, BSE_ITEM_FLAG_INTERN); bse_item_update_state (self); } static gboolean bse_item_real_needs_storage (BseItem *self, BseStorage *storage) { return TRUE; } gboolean bse_item_needs_storage (BseItem *self, BseStorage *storage) { assert_return (BSE_IS_ITEM (self), FALSE); assert_return (BSE_IS_STORAGE (storage), FALSE); return BSE_ITEM_GET_CLASS (self)->needs_storage (self, storage); } void bse_item_compat_setup (BseItem *self, uint vmajor, uint vminor, uint vmicro) { assert_return (BSE_IS_ITEM (self)); if (BSE_ITEM_GET_CLASS (self)->compat_setup) BSE_ITEM_GET_CLASS (self)->compat_setup (self, vmajor, vminor, vmicro); } struct GatherData { BseItem *item; void *data; Bse::ItemSeq &iseq; GType base_type; BseItemCheckContainer ccheck; BseItemCheckProxy pcheck; GatherData (Bse::ItemSeq &is) : iseq (is) {} }; static gboolean gather_child (BseItem *child, void *data) { GatherData *gdata = (GatherData*) data; if (child != gdata->item && !BSE_ITEM_INTERNAL (child) && g_type_is_a (G_OBJECT_TYPE (child), gdata->base_type) && (!gdata->pcheck || gdata->pcheck (child, gdata->item, gdata->data))) gdata->iseq.push_back (child->as<Bse::ItemIfaceP>()); return TRUE; } /** * @param item valid BseItem from which to start gathering * @param items sequence of items to append to * @param base_type base type of the items to gather * @param ccheck container filter function * @param pcheck proxy filter function * @param data @a data pointer to @a ccheck and @a pcheck * * This function gathers items from an object hierachy, walking upwards, * starting out with @a item. For each container passing @a ccheck(), all * immediate children are tested for addition with @a pcheck. */ static void bse_item_gather_items (BseItem *item, Bse::ItemSeq &iseq, GType base_type, BseItemCheckContainer ccheck, BseItemCheckProxy pcheck, void *data) { GatherData gdata (iseq); assert_return (BSE_IS_ITEM (item)); assert_return (g_type_is_a (base_type, BSE_TYPE_ITEM)); gdata.item = item; gdata.data = data; gdata.base_type = base_type; gdata.ccheck = ccheck; gdata.pcheck = pcheck; item = BSE_IS_CONTAINER (item) ? item : item->parent; while (item) { BseContainer *container = BSE_CONTAINER (item); if (!gdata.ccheck || gdata.ccheck (container, gdata.item, gdata.data)) bse_container_forall_items (container, gather_child, &gdata); item = item->parent; } } static gboolean gather_typed_ccheck (BseContainer *container, BseItem *item, void *data) { GType type = (GType) data; return g_type_is_a (G_OBJECT_TYPE (container), type); } static gboolean gather_typed_acheck (BseItem *proxy, BseItem *item, void *data) { return proxy != item && !bse_item_has_ancestor (item, proxy); } /** * @param item valid BseItem from which to start gathering * @param items sequence of items to append to * @param proxy_type base type of the items to gather * @param container_type base type of the containers to check for items * @param allow_ancestor if FALSE, ancestors of @a item are omitted * * Variant of bse_item_gather_items(), the containers and items * are simply filtered by checking derivation from @a container_type * and @a proxy_type respectively. Gathered items may not be ancestors * of @a item if @a allow_ancestor is @a false. */ void bse_item_gather_items_typed (BseItem *item, Bse::ItemSeq &iseq, GType proxy_type, GType container_type, bool allow_ancestor) { if (allow_ancestor) bse_item_gather_items (item, iseq, proxy_type, gather_typed_ccheck, NULL, (void*) container_type); else bse_item_gather_items (item, iseq, proxy_type, gather_typed_ccheck, gather_typed_acheck, (void*) container_type); } gboolean bse_item_get_candidates (BseItem *item, const Bse::String &property, Bse::PropertyCandidates &pc) { BseItemClass *klass; GParamSpec *pspec; assert_return (BSE_IS_ITEM (item), FALSE); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (item), property.c_str()); if (!pspec) return FALSE; klass = (BseItemClass*) g_type_class_peek (pspec->owner_type); if (klass && klass->get_candidates) klass->get_candidates (item, pspec->param_id, pc, pspec); return TRUE; } BseItem* bse_item_use (BseItem *item) { assert_return (BSE_IS_ITEM (item), NULL); assert_return (G_OBJECT (item)->ref_count > 0, NULL); if (!item->use_count) g_object_ref (item); item->use_count++; return item; } void bse_item_unuse (BseItem *item) { assert_return (BSE_IS_ITEM (item)); assert_return (item->use_count > 0); item->use_count--; if (!item->use_count) { if (!item->parent) g_object_run_dispose (G_OBJECT (item)); g_object_unref (item); } } void bse_item_set_parent (BseItem *item, BseItem *parent) { assert_return (BSE_IS_ITEM (item)); if (parent) { assert_return (item->parent == NULL); assert_return (BSE_IS_CONTAINER (parent)); } else assert_return (item->parent != NULL); assert_return (BSE_ITEM_GET_CLASS (item)->set_parent != NULL); /* paranoid */ g_object_ref (item); if (parent) g_object_ref (parent); BSE_ITEM_GET_CLASS (item)->set_parent (item, parent); if (parent) g_object_unref (parent); else g_object_run_dispose (G_OBJECT (item)); g_object_unref (item); } static uint bse_item_do_get_seqid (BseItem *item) { if (item->parent) return bse_container_get_item_seqid (BSE_CONTAINER (item->parent), item); else return 0; } static gboolean idle_handler_seqid_changed (void *data) { BSE_THREADS_ENTER (); while (item_seqid_changed_queue) { BseItem *item = (BseItem*) g_slist_pop_head (&item_seqid_changed_queue); g_object_notify (G_OBJECT (item), "seqid"); } BSE_THREADS_LEAVE (); return FALSE; } void bse_item_queue_seqid_changed (BseItem *item) { assert_return (BSE_IS_ITEM (item)); assert_return (BSE_ITEM (item)->parent != NULL); if (!item_seqid_changed_queue) bse_idle_notify (idle_handler_seqid_changed, NULL); if (!g_slist_find (item_seqid_changed_queue, item)) item_seqid_changed_queue = g_slist_prepend (item_seqid_changed_queue, item); } uint bse_item_get_seqid (BseItem *item) { assert_return (BSE_IS_ITEM (item), 0); assert_return (BSE_ITEM_GET_CLASS (item)->get_seqid != NULL, 0); /* paranoid */ return BSE_ITEM_GET_CLASS (item)->get_seqid (item); } BseItem* bse_item_common_ancestor (BseItem *item1, BseItem *item2) { assert_return (BSE_IS_ITEM (item1), NULL); assert_return (BSE_IS_ITEM (item2), NULL); do { BseItem *item = item2; do { if (item == item1) return item; item = item->parent; } while (item); item1 = item1->parent; } while (item1); return NULL; } /** * @param owner reference owner * @param link item to be referenced by @a owner * @param uncross_func notifier to be executed on uncrossing * * Install a weak cross reference from @a owner to @a link. * The two items must have a common ancestor when the cross * link is installed. Once their ancestry changes so that * they don't have a common ancestor anymore, @a uncross_func() * is executed. */ void bse_item_cross_link (BseItem *owner, BseItem *link, BseItemUncross uncross_func) { BseItem *container; assert_return (BSE_IS_ITEM (owner)); assert_return (BSE_IS_ITEM (link)); assert_return (uncross_func != NULL); container = bse_item_common_ancestor (owner, link); if (container) _bse_container_cross_link (BSE_CONTAINER (container), owner, link, uncross_func); else Bse::warning ("%s: %s and %s have no common anchestor", G_STRLOC, bse_object_debug_name (owner), bse_object_debug_name (link)); } /** * @param owner reference owner * @param link item referenced by @a owner * @param uncross_func notifier queued to be executed on uncrossing * * Removes a cross link previously installed via * bse_item_cross_link() without executing @a uncross_func(). */ void bse_item_cross_unlink (BseItem *owner, BseItem *link, BseItemUncross uncross_func) { BseItem *container; assert_return (BSE_IS_ITEM (owner)); assert_return (BSE_IS_ITEM (link)); assert_return (uncross_func != NULL); container = bse_item_common_ancestor (owner, link); if (container) _bse_container_cross_unlink (BSE_CONTAINER (container), owner, link, uncross_func); else Bse::warning ("%s: `%s' and `%s' have no common anchestor", G_STRLOC, BSE_OBJECT_TYPE_NAME (owner), BSE_OBJECT_TYPE_NAME (link)); } /** * @param owner reference owner * @param link item referenced by @a owner * * Destroys all existing cross links from @a owner to * @a link by executing the associated notifiers. */ void bse_item_uncross_links (BseItem *owner, BseItem *link) { BseItem *container; assert_return (BSE_IS_ITEM (owner)); assert_return (BSE_IS_ITEM (link)); container = bse_item_common_ancestor (owner, link); if (container) _bse_container_uncross (BSE_CONTAINER (container), owner, link); } BseSuper* bse_item_get_super (BseItem *item) { assert_return (BSE_IS_ITEM (item), NULL); while (!BSE_IS_SUPER (item) && item) item = item->parent; return item ? BSE_SUPER (item) : NULL; } BseSNet* bse_item_get_snet (BseItem *item) { assert_return (BSE_IS_ITEM (item), NULL); while (!BSE_IS_SNET (item) && item) item = item->parent; return item ? BSE_SNET (item) : NULL; } BseItem* bse_item_get_toplevel (BseItem *item) { assert_return (BSE_IS_ITEM (item), NULL); while (item->parent) item = item->parent; return item; } BseProject* bse_item_get_project (BseItem *item) { assert_return (BSE_IS_ITEM (item), NULL); while (item->parent) item = item->parent; return BSE_IS_PROJECT (item) ? (BseProject*) item : NULL; } gboolean bse_item_has_ancestor (BseItem *item, BseItem *ancestor) { assert_return (BSE_IS_ITEM (item), FALSE); assert_return (BSE_IS_ITEM (ancestor), FALSE); while (item->parent) { item = item->parent; if (item == ancestor) return TRUE; } return FALSE; } /** * @param self a valid Item * @return the current BseMusicalTuningType, defaulting to BSE_MUSICAL_TUNING_12_TET * Find out about the musical tuning that is currently used for this item. * The musical tuning depends on project wide settings that may change after * this funciton has been called, so the result should be used with caution. */ Bse::MusicalTuning bse_item_current_musical_tuning (BseItem *self) { assert_return (BSE_IS_ITEM (self), Bse::MusicalTuning::OD_12_TET); /* finding the musical tuning *should* be possible by just visiting * an items parents. however, .bse objects are not currently (0.7.1) * structured that way, so we get the tuning from the first song in * a project, or simply provide a default. */ BseProject *project = bse_item_get_project (self); if (project) { GSList *slist; for (slist = project->supers; slist; slist = slist->next) if (BSE_IS_SONG (slist->data)) return BSE_SONG (slist->data)->musical_tuning; } return Bse::MusicalTuning::OD_12_TET; } static inline GType find_method_procedure (GType object_type, const char *method_name) { uint l2 = strlen (method_name); GType proc_type, type = object_type; /* assumed to be *derived* from BSE_TYPE_ITEM */ do { const char *type_name = g_type_name (type); uint l1 = strlen (type_name); char *name = g_new (char, l1 + 1 + l2 + 1); memcpy (name, type_name, l1); name[l1] = '+'; memcpy (name + l1 + 1, method_name, l2); name[l1 + 1 + l2] = 0; proc_type = bse_procedure_lookup (name); g_free (name); if (proc_type) break; type = g_type_parent (type); } while (type != BSE_TYPE_ITEM); /* type will become BSE_TYPE_ITEM eventually */ return proc_type; } static inline Bse::Error bse_item_execva_i (BseItem *item, const char *procedure, va_list var_args, gboolean skip_oparams) { Bse::Error error; GType proc_type = find_method_procedure (BSE_OBJECT_TYPE (item), procedure); GValue obj_value; if (!proc_type) { Bse::warning ("no such method \"%s\" of item %s", procedure, bse_object_debug_name (item)); return Bse::Error::INTERNAL; } /* setup first arg (the object) */ obj_value.g_type = 0; g_value_init (&obj_value, BSE_TYPE_ITEM); g_value_set_object (&obj_value, item); /* invoke procedure */ error = bse_procedure_marshal_valist (proc_type, &obj_value, NULL, NULL, skip_oparams, var_args); g_value_unset (&obj_value); return error; } Bse::Error bse_item_exec (void *_item, const char *procedure, ...) { BseItem *item = (BseItem*) _item; va_list var_args; Bse::Error error; assert_return (BSE_IS_ITEM (item), Bse::Error::INTERNAL); assert_return (procedure != NULL, Bse::Error::INTERNAL); va_start (var_args, procedure); error = bse_item_execva_i (item, procedure, var_args, FALSE); va_end (var_args); return error; } Bse::Error bse_item_exec_void (void *_item, const char *procedure, ...) { BseItem *item = (BseItem*) _item; va_list var_args; Bse::Error error; assert_return (BSE_IS_ITEM (item), Bse::Error::INTERNAL); assert_return (procedure != NULL, Bse::Error::INTERNAL); va_start (var_args, procedure); error = bse_item_execva_i (item, procedure, var_args, TRUE); va_end (var_args); return error; } static GValue* pack_value_for_undo (GValue *value, BseUndoStack *ustack) { GType type = G_VALUE_TYPE (value); if (G_TYPE_IS_OBJECT (type)) { char *p = bse_undo_pointer_pack (g_value_get_object (value), ustack); g_value_unset (value); g_value_init (value, BSE_TYPE_PACKED_POINTER); sfi_value_take_string (value, p); } return value; } static GValue* unpack_value_from_undo (GValue *value, BseUndoStack *ustack) { GType type = G_VALUE_TYPE (value); if (type == BSE_TYPE_PACKED_POINTER) { BseItem *item = (BseItem*) bse_undo_pointer_unpack (g_value_get_string (value), ustack); g_value_unset (value); g_value_init (value, G_TYPE_OBJECT); g_value_set_object (value, item); } return value; } static void unde_free_proc (BseUndoStep *ustep) { BseProcedureClass *proc = (BseProcedureClass*) ustep->data[0].v_pointer; GValue *ivalues = (GValue*) ustep->data[1].v_pointer; /* may or may not packed for undo */ if (ivalues && proc) { uint i; for (i = 0; i < proc->n_in_pspecs; i++) g_value_unset (ivalues + i); g_free (ivalues); g_type_class_unref (proc); } } static void undo_call_proc (BseUndoStep *ustep, BseUndoStack *ustack) { BseProcedureClass *proc = (BseProcedureClass*) ustep->data[0].v_pointer; GValue *ivalues = (GValue*) ustep->data[1].v_pointer; /* packed for undo */ gboolean commit_as_redo = ustep->data[2].v_long; if (commit_as_redo) { const char *packed_item_pointer = g_value_get_string (ivalues + 0); BseItem *item = (BseItem*) bse_undo_pointer_unpack (packed_item_pointer, ustack); BseUndoStack *redo_stack = bse_item_undo_open (item, "%s", BSE_PROCEDURE_NAME (proc)); BseUndoStep *redo_step; redo_step = bse_undo_step_new (undo_call_proc, unde_free_proc, 3); redo_step->data[0].v_pointer = proc; redo_step->data[1].v_pointer = ivalues; redo_step->data[2].v_long = FALSE; /* not commit_as_redo again */ bse_undo_stack_push (redo_stack, redo_step); bse_item_undo_close (redo_stack); /* prevent premature deletion */ ustep->data[0].v_pointer = NULL; ustep->data[1].v_pointer = NULL; } else /* invoke procedure */ { GValue ovalue = { 0, }; Bse::Error error; uint i; /* convert values from undo */ for (i = 0; i < proc->n_in_pspecs; i++) unpack_value_from_undo (ivalues + i, ustack); /* setup return value (maximum one) */ if (proc->n_out_pspecs) g_value_init (&ovalue, G_PARAM_SPEC_VALUE_TYPE (proc->out_pspecs[0])); /* invoke procedure */ error = bse_procedure_marshal (BSE_PROCEDURE_TYPE (proc), ivalues, &ovalue, NULL, NULL); /* clenup return value */ if (proc->n_out_pspecs) { /* check returned error if any */ if (G_PARAM_SPEC_VALUE_TYPE (proc->out_pspecs[0]) == BSE_TYPE_ERROR_TYPE && error == 0) error = Bse::Error (g_value_get_enum (&ovalue)); g_value_unset (&ovalue); } /* we're not tolerating any errors */ if (error != 0) Bse::warning ("while executing undo method \"%s\" of item %s: %s", BSE_PROCEDURE_NAME (proc), bse_object_debug_name (g_value_get_object (ivalues + 0)), bse_error_blurb (error)); } } static void bse_item_push_undo_proc_valist (void *item, const char *procedure, gboolean commit_as_redo, va_list var_args) { GType proc_type = find_method_procedure (BSE_OBJECT_TYPE (item), procedure); BseUndoStack *ustack = bse_item_undo_open (item, "%s: %s", commit_as_redo ? "redo-proc" : "undo-proc", procedure); BseProcedureClass *proc; GValue *ivalues; Bse::Error error; uint i; if (BSE_UNDO_STACK_VOID (ustack) || BSE_ITEM_INTERNAL (item)) { bse_item_undo_close (ustack); return; } if (!proc_type) { Bse::warning ("no such method \"%s\" of item %s", procedure, bse_object_debug_name (item)); bse_item_undo_close (ustack); return; } proc = (BseProcedureClass*) g_type_class_ref (proc_type); /* we allow one return value */ if (proc->n_out_pspecs > 1) { Bse::warning ("method \"%s\" of item %s called with more than one return value", procedure, bse_object_debug_name (item)); g_type_class_unref (proc); bse_item_undo_close (ustack); return; } ivalues = g_new (GValue, proc->n_in_pspecs); /* setup first arg (the object) */ ivalues[0].g_type = 0; g_value_init (ivalues + 0, BSE_TYPE_ITEM); g_value_set_object (ivalues + 0, item); /* collect procedure args */ error = bse_procedure_collect_input_args (proc, ivalues + 0, var_args, ivalues); if (error == 0) { BseUndoStep *ustep = bse_undo_step_new (undo_call_proc, unde_free_proc, 3); /* convert values for undo */ for (i = 0; i < proc->n_in_pspecs; i++) pack_value_for_undo (ivalues + i, ustack); ustep->data[0].v_pointer = proc; ustep->data[1].v_pointer = ivalues; ustep->data[2].v_long = commit_as_redo; bse_undo_stack_push (ustack, ustep); } else /* urg shouldn't happen */ { Bse::warning ("while collecting arguments for method \"%s\" of item %s: %s", procedure, bse_object_debug_name (item), bse_error_blurb (error)); for (i = 0; i < proc->n_in_pspecs; i++) g_value_unset (ivalues + i); g_free (ivalues); g_type_class_unref (proc); } bse_item_undo_close (ustack); } void bse_item_push_undo_proc (void *item, const char *procedure, ...) { va_list var_args; assert_return (BSE_IS_ITEM (item)); assert_return (procedure != NULL); va_start (var_args, procedure); bse_item_push_undo_proc_valist (item, procedure, FALSE, var_args); va_end (var_args); } void bse_item_push_redo_proc (void *item, const char *procedure, ...) { va_list var_args; assert_return (BSE_IS_ITEM (item)); assert_return (procedure != NULL); va_start (var_args, procedure); bse_item_push_undo_proc_valist (item, procedure, TRUE, var_args); va_end (var_args); } void bse_item_set_undoable (void *object, const char *first_property_name, ...) { va_list var_args; assert_return (BSE_IS_ITEM (object)); va_start (var_args, first_property_name); bse_item_set_valist_undoable (object, first_property_name, var_args); va_end (var_args); } void bse_item_set_valist_undoable (void *object, const char *first_property_name, va_list var_args) { BseItem *self = BSE_ITEM (object); const char *name; assert_return (BSE_IS_ITEM (self)); g_object_ref (object); g_object_freeze_notify (G_OBJECT (object)); name = first_property_name; while (name) { GValue value = { 0, }; GParamSpec *pspec; char *error = NULL; pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (self), name); if (!pspec) { Bse::warning ("item %s has no property named `%s'", bse_object_debug_name (self), name); break; } g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); G_VALUE_COLLECT (&value, var_args, 0, &error); if (error) { Bse::warning ("while setting property `%s' on %s: %s", name, bse_object_debug_name (self), error); g_free (error); g_value_unset (&value); break; } bse_item_set_property_undoable (self, pspec->name, &value); g_value_unset (&value); name = va_arg (var_args, char*); } g_object_thaw_notify (G_OBJECT (object)); g_object_unref (object); } static BseUndoStack* bse_item_default_get_undo (BseItem *self) { if (self->parent) return BSE_ITEM_GET_CLASS (self->parent)->get_undo (self->parent); else return NULL; } static gboolean values_equal_for_undo (const GValue *v1, const GValue *v2) { SfiSCategory sc1 = sfi_categorize_type (G_VALUE_TYPE (v1)); SfiSCategory sc2 = sfi_categorize_type (G_VALUE_TYPE (v2)); if (sc1 != sc2) return FALSE; switch (sc1) { case SFI_SCAT_BOOL: return sfi_value_get_bool (v1) == sfi_value_get_bool (v2); case SFI_SCAT_INT: return sfi_value_get_int (v1) == sfi_value_get_int (v2); case SFI_SCAT_NUM: return sfi_value_get_num (v1) == sfi_value_get_num (v2); case SFI_SCAT_REAL: return sfi_value_get_real (v1) == sfi_value_get_real (v2); /* *no* epsilon! */ case SFI_SCAT_CHOICE: case SFI_SCAT_STRING: return bse_string_equals (sfi_value_get_string (v1), sfi_value_get_string (v2)); default: if (G_TYPE_IS_OBJECT (G_VALUE_TYPE (v1)) && G_TYPE_IS_OBJECT (G_VALUE_TYPE (v2))) return g_value_get_object (v1) == g_value_get_object (v2); } return FALSE; } static void undo_set_property (BseUndoStep *ustep, BseUndoStack *ustack) { bse_item_set_property_undoable ((BseItem*) bse_undo_pointer_unpack ((const char*) ustep->data[0].v_pointer, ustack), (const char*) ustep->data[1].v_pointer, unpack_value_from_undo ((GValue*) ustep->data[2].v_pointer, ustack)); } static void unde_free_property (BseUndoStep *ustep) { g_free (ustep->data[0].v_pointer); g_free (ustep->data[1].v_pointer); g_value_unset ((GValue*) ustep->data[2].v_pointer); /* may or may not be unpacked */ g_free (ustep->data[2].v_pointer); } static inline gboolean item_property_check_skip_undo (BseItem *self, const char *name) { GParamSpec *pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (self), name); return pspec && sfi_pspec_check_option (pspec, "skip-undo"); } void bse_item_set_property_undoable (BseItem *self, const char *name, const GValue *value) { BseUndoStack *ustack = bse_item_undo_open (self, "set-property(%s,\"%s\")", bse_object_debug_name (self), name); BseUndoStep *ustep; GValue *tvalue = g_new0 (GValue, 1); g_value_init (tvalue, G_VALUE_TYPE (value)); g_object_get_property (G_OBJECT (self), name, tvalue); if (BSE_ITEM_INTERNAL (self) || item_property_check_skip_undo (self, name) || values_equal_for_undo (value, tvalue)) { /* we're about to set a value on an internal item or * to set the same value again => skip undo */ g_value_unset (tvalue); g_free (tvalue); bse_item_undo_close (ustack); g_object_set_property (G_OBJECT (self), name, value); return; } g_object_set_property (G_OBJECT (self), name, value); /* pointer-pack must be called *after* property update (could be "uname") */ ustep = bse_undo_step_new (undo_set_property, unde_free_property, 3); ustep->data[0].v_pointer = bse_undo_pointer_pack (self, ustack); ustep->data[1].v_pointer = g_strdup (name); ustep->data[2].v_pointer = pack_value_for_undo (tvalue, ustack); bse_undo_stack_push (ustack, ustep); bse_item_undo_close (ustack); } BseUndoStack* bse_item_undo_open_str (void *item, const std::string &string) { BseItem *self = BSE_ITEM (item); BseUndoStack *ustack = BSE_ITEM_GET_CLASS (self)->get_undo (self); if (ustack) bse_undo_group_open (ustack, string.c_str()); else { ustack = bse_undo_stack_dummy (); bse_undo_group_open (ustack, Bse::string_format ("DUMMY-GROUP(%s)", string).c_str()); } return ustack; } void bse_item_undo_close (BseUndoStack *ustack) { if (ustack) bse_undo_group_close (ustack); } static void undo_restore_item (BseUndoStep *ustep, BseUndoStack *ustack) { BseItem *item = (BseItem*) bse_undo_pointer_unpack ((const char*) ustep->data[0].v_pointer, ustack); BseStorage *storage = BSE_STORAGE (ustep->data[1].v_pointer); GTokenType expected_token = G_TOKEN_NONE; expected_token = bse_storage_restore_item (storage, item); if (expected_token != G_TOKEN_NONE) bse_storage_unexp_token (storage, expected_token); bse_storage_finish_parsing (storage); } static void unde_free_item (BseUndoStep *ustep) { BseStorage *storage = BSE_STORAGE (ustep->data[1].v_pointer); g_free (ustep->data[0].v_pointer); bse_storage_reset (storage); g_object_unref (storage); } void bse_item_push_undo_storage (BseItem *self, BseUndoStack *ustack, BseStorage *storage) { if (!BSE_ITEM_INTERNAL (self) && !BSE_UNDO_STACK_VOID (ustack)) { BseUndoStep *ustep = bse_undo_step_new (undo_restore_item, unde_free_item, 2); bse_storage_turn_readable (storage, "<undo-storage>"); ustep->data[0].v_pointer = bse_undo_pointer_pack (self, ustack); ustep->data[1].v_pointer = g_object_ref (storage); bse_undo_stack_push (ustack, ustep); } else bse_storage_reset (storage); } void bse_item_backup_to_undo (BseItem *self, BseUndoStack *ustack) { if (!BSE_UNDO_STACK_VOID (ustack)) { BseStorage *storage = (BseStorage*) bse_object_new (BSE_TYPE_STORAGE, NULL); bse_storage_prepare_write (storage, BseStorageMode (BSE_STORAGE_DBLOCK_CONTAINED | BSE_STORAGE_SELF_CONTAINED)); bse_storage_store_item (storage, self); bse_item_push_undo_storage (self, ustack, storage); g_object_unref (storage); } } namespace Bse { ItemImpl::ItemImpl (BseObject *bobj) : ObjectImpl (bobj) {} ItemImpl::~ItemImpl () {} ItemIfaceP ItemImpl::use () { BseItem *self = as<BseItem*>(); ItemIfaceP iface = self->as<ItemIfaceP>(); assert_return (self->parent || self->use_count, iface); bse_item_use (self); return iface; } void ItemImpl::unuse () { BseItem *self = as<BseItem*>(); assert_return (self->use_count >= 1); bse_item_unuse (self); } void ItemImpl::set_name (const std::string &name) { BseItem *self = as<BseItem*>(); if (name != BSE_OBJECT_UNAME (self)) bse_item_set (self, "uname", name.c_str(), NULL); } bool ItemImpl::editable_property (const std::string &property) { BseItem *self = as<BseItem*>(); return bse_object_editable_property (self, property.c_str()); } ContainerImpl* ItemImpl::parent () { BseItem *self = as<BseItem*>(); return self->parent ? self->parent->as<ContainerImpl*>() : NULL; } ItemImpl::UndoDescriptorData ItemImpl::make_undo_descriptor_data (ItemImpl &item) { // sync with bse_undo_pointer_pack UndoDescriptorData udd; BseItem *bitem = item.as<BseItem*>(); BseProject *bproject = bse_item_get_project (this->as<BseItem*>()); if (!bproject) // may happen during destruction return udd; // this UndoDescriptorData is constructed but will never be used assert_return (bproject == bse_item_get_project (bitem), udd); // undo descriptors work only for items within same project ProjectImpl *project = bproject->as<ProjectImpl*>(); udd.projectid = ptrdiff_t (project); if (&item == project) udd.upath = "\002project\003"; else { gchar *upath = bse_container_make_upath (bproject, bitem); udd.upath = upath; g_free (upath); } return udd; } ItemImpl& ItemImpl::resolve_undo_descriptor_data (const UndoDescriptorData &udd) { // sync with bse_undo_pointer_unpack ItemImpl &nullitem = *(ItemImpl*) NULL; assert_return (udd.projectid != 0, nullitem); BseProject *bproject = bse_item_get_project (this->as<BseItem*>()); ProjectImpl *project = bproject ? bproject->as<ProjectImpl*>() : NULL; assert_return (udd.projectid == ptrdiff_t (project), nullitem); // undo cannot work on orphans if (udd.upath == "\002project\003") return *project; BseItem *bitem = bse_container_resolve_upath (bproject, udd.upath.c_str()); assert_return (bitem != NULL, nullitem); // undo descriptor for NULL objects is not currently supported return *bitem->as<ItemImpl*>(); } static void undo_lambda_free (BseUndoStep *ustep) { delete (ItemImpl::UndoDescriptor<ItemImpl>*) ustep->data[0].v_pointer; delete (ItemImpl::UndoLambda*) ustep->data[1].v_pointer; delete (String*) ustep->data[2].v_pointer; } static void undo_lambda_call (BseUndoStep *ustep, BseUndoStack *ustack) { ProjectImpl &project = *ustack->project->as<ProjectImpl*>(); ItemImpl &self = project.undo_resolve (*(ItemImpl::UndoDescriptor<ItemImpl>*) ustep->data[0].v_pointer); auto *lambda = (ItemImpl::UndoLambda*) ustep->data[1].v_pointer; // invoke undo function const Bse::Error error = (*lambda) (self, ustack); if (error != 0) // undo errors shouldn't happen { String *blurb = (String*) ustep->data[2].v_pointer; Bse::warning ("error during undo '%s' of item %s: %s", blurb->c_str(), self.debug_name().c_str(), bse_error_blurb (error)); } } void ItemImpl::push_item_undo (const String &blurb, const UndoLambda &lambda) { BseItem *self = as<BseItem*>(); BseUndoStack *ustack = bse_item_undo_open (self, "undo: %s", blurb.c_str()); if (BSE_UNDO_STACK_VOID (ustack) || BSE_ITEM_INTERNAL (self)) { bse_item_undo_close (ustack); return; } BseUndoStep *ustep = bse_undo_step_new (undo_lambda_call, undo_lambda_free, 3); ustep->data[0].v_pointer = new UndoDescriptor<ItemImpl> (undo_descriptor (*this)); ustep->data[1].v_pointer = new UndoLambda (lambda); ustep->data[2].v_pointer = new String (blurb); bse_undo_stack_push (ustack, ustep); bse_item_undo_close (ustack); } void ItemImpl::push_property_undo (const String &property_name) { assert_return (property_name.empty() == false); Any saved_value = __aida_get__ (property_name); if (saved_value.empty()) Bse::warning ("%s: invalid property name: %s", __func__, property_name); else { auto lambda = [property_name, saved_value] (ItemImpl &self, BseUndoStack *ustack) -> Error { const bool success = self.__aida_set__ (property_name, saved_value); if (!success) Bse::warning ("%s: failed to undo property change for '%s': %s", __func__, property_name, saved_value.repr()); return Error::NONE; }; push_undo (__func__, *this, lambda); } } ProjectIfaceP ItemImpl::get_project () { BseItem *self = as<BseItem*>(); BseProject *project = bse_item_get_project (self); return project ? project->as<Bse::ProjectIfaceP>() : NULL; } ItemIfaceP ItemImpl::common_ancestor (ItemIface &other) { BseItem *self = as<BseItem*>(); BseItem *bo = other.as<BseItem*>(); BseItem *common = bse_item_common_ancestor (self, bo); return common->as<ItemIfaceP>(); } bool ItemImpl::check_is_a (const String &type_name) { BseItem *self = as<BseItem*>(); const GType type = g_type_from_name (type_name.c_str()); const bool is_a = g_type_is_a (G_OBJECT_TYPE (self), type); return is_a; } void ItemImpl::group_undo (const std::string &name) { BseItem *self = as<BseItem*>(); BseUndoStack *ustack = bse_item_undo_open (self, "item-group-undo"); bse_undo_stack_add_merger (ustack, name.c_str()); bse_item_undo_close (ustack); } void ItemImpl::ungroup_undo () { BseItem *self = as<BseItem*>(); BseUndoStack *ustack = bse_item_undo_open (self, "item-ungroup-undo"); bse_undo_stack_remove_merger (ustack); bse_item_undo_close (ustack); } class CustomIconKey : public DataKey<Icon*> { virtual void destroy (Icon *icon) override { delete icon; } }; static CustomIconKey custom_icon_key; Icon ItemImpl::icon () const { BseItem *self = const_cast<ItemImpl*> (this)->as<BseItem*>(); Icon *icon = get_data (&custom_icon_key); return icon ? *icon : bse_object_get_icon (self); } void ItemImpl::icon (const Icon &icon) { Icon *custom_icon = new Icon (icon); icon_sanitize (custom_icon); if (custom_icon->width != 0) set_data (&custom_icon_key, custom_icon); else { delete custom_icon; delete_data (&custom_icon_key); } } ItemIfaceP ItemImpl::get_parent () { return parent() ? parent()->as<ContainerIfaceP>() : NULL; } int ItemImpl::get_seqid () { BseItem *self = as<BseItem*>(); return bse_item_get_seqid (self); } String ItemImpl::get_type () { BseItem *self = as<BseItem*>(); return g_type_name (G_OBJECT_TYPE (self)); } String ItemImpl::get_type_authors () { BseItem *self = as<BseItem*>(); return bse_type_get_authors (G_OBJECT_TYPE (self)); } String ItemImpl::get_type_blurb () { BseItem *self = as<BseItem*>(); return bse_type_get_blurb (G_OBJECT_TYPE (self)); } String ItemImpl::get_type_license () { BseItem *self = as<BseItem*>(); return bse_type_get_license (G_OBJECT_TYPE (self)); } String ItemImpl::get_type_name () { BseItem *self = as<BseItem*>(); return g_type_name (G_OBJECT_TYPE (self)); } String ItemImpl::get_uname_path () { BseItem *self = as<BseItem*>(); BseProject *project = bse_item_get_project (self); gchar *upath = project ? bse_container_make_upath (BSE_CONTAINER (project), self) : NULL; const String result = upath ? upath : ""; g_free (upath); return result; } String ItemImpl::get_name () { BseItem *self = as<BseItem*>(); return BSE_OBJECT_UNAME (self); } String ItemImpl::get_name_or_type () { BseItem *self = as<BseItem*>(); const char *name = BSE_OBJECT_UNAME (self); const String result = name ? name : BSE_OBJECT_TYPE_NAME (self); return result; } bool ItemImpl::internal () { BseItem *self = as<BseItem*>(); return BSE_ITEM_INTERNAL (self); } PropertyCandidates ItemImpl::get_property_candidates (const String &property_name) { BseItem *self = as<BseItem*>(); PropertyCandidates pc; if (bse_item_get_candidates (self, property_name, pc)) return pc; return PropertyCandidates(); } } // Bse
lgpl-2.1
einon/affymetrix-power-tools
sdk/mas5-stat/example/mas5-stat-example.cpp
104
// dummy file needed by the build system because // main is in main.cpp rather than fil-sdk-example.cpp
lgpl-2.1
attunetc/ehr
src/org/hl7/fhir/ConstraintSeverityList.java
1835
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2014.06.12 at 12:19:07 PM EDT // package org.hl7.fhir; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ConstraintSeverity-list. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="ConstraintSeverity-list"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="error"/> * &lt;enumeration value="warning"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "ConstraintSeverity-list") @XmlEnum public enum ConstraintSeverityList { /** * If the constraint is violated, the resource is not conformant. * */ @XmlEnumValue("error") ERROR("error"), /** * If the constraint is violated, the resource is conformant, but it is not necessarily following best practice. * */ @XmlEnumValue("warning") WARNING("warning"); private final java.lang.String value; ConstraintSeverityList(java.lang.String v) { value = v; } public java.lang.String value() { return value; } public static ConstraintSeverityList fromValue(java.lang.String v) { for (ConstraintSeverityList c: ConstraintSeverityList.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
lgpl-2.1
Telekinesis/Telepathy-qt4-0.8.0
TelepathyQt4/channel.cpp
130256
/** * This file is part of TelepathyQt4 * * @copyright Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/> * @copyright Copyright (C) 2008 Nokia Corporation * @license LGPL 2.1 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <TelepathyQt4/Channel> #include "TelepathyQt4/channel-internal.h" #include "TelepathyQt4/_gen/cli-channel-body.hpp" #include "TelepathyQt4/_gen/cli-channel.moc.hpp" #include "TelepathyQt4/_gen/channel.moc.hpp" #include "TelepathyQt4/_gen/channel-internal.moc.hpp" #include "TelepathyQt4/debug-internal.h" #include "TelepathyQt4/future-internal.h" #include <TelepathyQt4/ChannelFactory> #include <TelepathyQt4/Connection> #include <TelepathyQt4/ConnectionCapabilities> #include <TelepathyQt4/ConnectionLowlevel> #include <TelepathyQt4/ContactManager> #include <TelepathyQt4/PendingContacts> #include <TelepathyQt4/PendingFailure> #include <TelepathyQt4/PendingOperation> #include <TelepathyQt4/PendingReady> #include <TelepathyQt4/PendingSuccess> #include <TelepathyQt4/StreamTubeChannel> #include <TelepathyQt4/ReferencedHandles> #include <TelepathyQt4/Constants> #include <QHash> #include <QQueue> #include <QSharedData> #include <QTimer> namespace Tp { using TpFuture::Client::ChannelInterfaceMergeableConferenceInterface; using TpFuture::Client::ChannelInterfaceSplittableInterface; struct TELEPATHY_QT4_NO_EXPORT Channel::Private { Private(Channel *parent, const ConnectionPtr &connection, const QVariantMap &immutableProperties); ~Private(); static void introspectMain(Private *self); void introspectMainProperties(); void introspectMainFallbackChannelType(); void introspectMainFallbackHandle(); void introspectMainFallbackInterfaces(); void introspectGroup(); void introspectGroupFallbackFlags(); void introspectGroupFallbackMembers(); void introspectGroupFallbackLocalPendingWithInfo(); void introspectGroupFallbackSelfHandle(); void introspectConference(); static void introspectConferenceInitialInviteeContacts(Private *self); void continueIntrospection(); void extractMainProps(const QVariantMap &props); void extract0176GroupProps(const QVariantMap &props); void nowHaveInterfaces(); void nowHaveInitialMembers(); bool setGroupFlags(uint groupFlags); void buildContacts(); void doMembersChangedDetailed(const UIntList &, const UIntList &, const UIntList &, const UIntList &, const QVariantMap &); void processMembersChanged(); void updateContacts(const QList<ContactPtr> &contacts = QList<ContactPtr>()); bool fakeGroupInterfaceIfNeeded(); void setReady(); QString groupMemberChangeDetailsTelepathyError( const GroupMemberChangeDetails &details); inline ChannelInterfaceMergeableConferenceInterface *mergeableConferenceInterface( InterfaceSupportedChecking check = CheckInterfaceSupported) const { return parent->optionalInterface<ChannelInterfaceMergeableConferenceInterface>(check); } inline ChannelInterfaceSplittableInterface *splittableInterface( InterfaceSupportedChecking check = CheckInterfaceSupported) const { return parent->optionalInterface<ChannelInterfaceSplittableInterface>(check); } void processConferenceChannelRemoved(); struct GroupMembersChangedInfo; struct ConferenceChannelRemovedInfo; // Public object Channel *parent; // Instance of generated interface class Client::ChannelInterface *baseInterface; // Mandatory properties interface proxy Client::DBus::PropertiesInterface *properties; // Owning connection - it can be a SharedPtr as Connection does not cache // channels ConnectionPtr connection; QVariantMap immutableProperties; // Optional interface proxies Client::ChannelInterfaceGroupInterface *group; Client::ChannelInterfaceConferenceInterface *conference; ReadinessHelper *readinessHelper; // Introspection QQueue<void (Private::*)()> introspectQueue; // Introspected properties // Main interface QString channelType; uint targetHandleType; uint targetHandle; QString targetId; ContactPtr targetContact; bool requested; uint initiatorHandle; ContactPtr initiatorContact; // Group flags uint groupFlags; bool usingMembersChangedDetailed; // Group member introspection bool groupHaveMembers; bool buildingContacts; // Queue of received MCD signals to process QQueue<GroupMembersChangedInfo *> groupMembersChangedQueue; GroupMembersChangedInfo *currentGroupMembersChangedInfo; // Pending from the MCD signal currently processed, but contacts not yet built QSet<uint> pendingGroupMembers; QSet<uint> pendingGroupLocalPendingMembers; QSet<uint> pendingGroupRemotePendingMembers; UIntList groupMembersToRemove; UIntList groupLocalPendingMembersToRemove; UIntList groupRemotePendingMembersToRemove; // Initial members UIntList groupInitialMembers; LocalPendingInfoList groupInitialLP; UIntList groupInitialRP; // Current members QHash<uint, ContactPtr> groupContacts; QHash<uint, ContactPtr> groupLocalPendingContacts; QHash<uint, ContactPtr> groupRemotePendingContacts; // Stored change info QHash<uint, GroupMemberChangeDetails> groupLocalPendingContactsChangeInfo; GroupMemberChangeDetails groupSelfContactRemoveInfo; // Group handle owners bool groupAreHandleOwnersAvailable; HandleOwnerMap groupHandleOwners; // Group self identity bool pendingRetrieveGroupSelfContact; bool groupIsSelfHandleTracked; uint groupSelfHandle; ContactPtr groupSelfContact; // Conference bool introspectingConference; QHash<QString, ChannelPtr> conferenceChannels; QHash<QString, ChannelPtr> conferenceInitialChannels; QString conferenceInvitationMessage; QHash<uint, ChannelPtr> conferenceOriginalChannels; UIntList conferenceInitialInviteeHandles; Contacts conferenceInitialInviteeContacts; QQueue<ConferenceChannelRemovedInfo *> conferenceChannelRemovedQueue; bool buildingConferenceChannelRemovedActorContact; static const QString keyActor; }; struct TELEPATHY_QT4_NO_EXPORT Channel::Private::GroupMembersChangedInfo { GroupMembersChangedInfo(const UIntList &added, const UIntList &removed, const UIntList &localPending, const UIntList &remotePending, const QVariantMap &details) : added(added), removed(removed), localPending(localPending), remotePending(remotePending), details(details), // TODO most of these probably should be removed once the rest of the code using them is sanitized actor(qdbus_cast<uint>(details.value(keyActor))), reason(qdbus_cast<uint>(details.value(keyChangeReason))), message(qdbus_cast<QString>(details.value(keyMessage))) { } UIntList added; UIntList removed; UIntList localPending; UIntList remotePending; QVariantMap details; uint actor; uint reason; QString message; static const QString keyChangeReason; static const QString keyMessage; static const QString keyContactIds; }; struct TELEPATHY_QT4_NO_EXPORT Channel::Private::ConferenceChannelRemovedInfo { ConferenceChannelRemovedInfo(const QDBusObjectPath &channelPath, const QVariantMap &details) : channelPath(channelPath), details(details) { } QDBusObjectPath channelPath; QVariantMap details; }; const QString Channel::Private::keyActor(QLatin1String("actor")); const QString Channel::Private::GroupMembersChangedInfo::keyChangeReason( QLatin1String("change-reason")); const QString Channel::Private::GroupMembersChangedInfo::keyMessage(QLatin1String("message")); const QString Channel::Private::GroupMembersChangedInfo::keyContactIds(QLatin1String("contact-ids")); Channel::Private::Private(Channel *parent, const ConnectionPtr &connection, const QVariantMap &immutableProperties) : parent(parent), baseInterface(new Client::ChannelInterface(parent)), properties(parent->interface<Client::DBus::PropertiesInterface>()), connection(connection), immutableProperties(immutableProperties), group(0), conference(0), readinessHelper(parent->readinessHelper()), targetHandleType(0), targetHandle(0), requested(false), initiatorHandle(0), groupFlags(0), usingMembersChangedDetailed(false), groupHaveMembers(false), buildingContacts(false), currentGroupMembersChangedInfo(0), groupAreHandleOwnersAvailable(false), pendingRetrieveGroupSelfContact(false), groupIsSelfHandleTracked(false), groupSelfHandle(0), introspectingConference(false), buildingConferenceChannelRemovedActorContact(false) { debug() << "Creating new Channel:" << parent->objectPath(); if (connection->isValid()) { debug() << " Connecting to Channel::Closed() signal"; parent->connect(baseInterface, SIGNAL(Closed()), SLOT(onClosed())); debug() << " Connection to owning connection's lifetime signals"; parent->connect(connection.data(), SIGNAL(invalidated(Tp::DBusProxy*,QString,QString)), SLOT(onConnectionInvalidated())); } else { warning() << "Connection given as the owner for a Channel was " "invalid! Channel will be stillborn."; parent->invalidate(QLatin1String(TELEPATHY_ERROR_INVALID_ARGUMENT), QLatin1String("Connection given as the owner of this channel was invalid")); } ReadinessHelper::Introspectables introspectables; // As Channel does not have predefined statuses let's simulate one (0) ReadinessHelper::Introspectable introspectableCore( QSet<uint>() << 0, // makesSenseForStatuses Features(), // dependsOnFeatures QStringList(), // dependsOnInterfaces (ReadinessHelper::IntrospectFunc) &Private::introspectMain, this); introspectables[FeatureCore] = introspectableCore; // As Channel does not have predefined statuses let's simulate one (0) ReadinessHelper::Introspectable introspectableConferenceInitialInviteeContacts( QSet<uint>() << 0, // makesSenseForStatuses Features() << FeatureCore, // dependsOnFeatures QStringList() << TP_QT4_IFACE_CHANNEL_INTERFACE_CONFERENCE, // dependsOnInterfaces (ReadinessHelper::IntrospectFunc) &Private::introspectConferenceInitialInviteeContacts, this); introspectables[FeatureConferenceInitialInviteeContacts] = introspectableConferenceInitialInviteeContacts; readinessHelper->addIntrospectables(introspectables); } Channel::Private::~Private() { delete currentGroupMembersChangedInfo; foreach (GroupMembersChangedInfo *info, groupMembersChangedQueue) { delete info; } foreach (ConferenceChannelRemovedInfo *info, conferenceChannelRemovedQueue) { delete info; } } void Channel::Private::introspectMain(Channel::Private *self) { // Make sure connection object is ready, as we need to use some methods that // are only available after connection object gets ready. debug() << "Calling Connection::becomeReady()"; self->parent->connect(self->connection->becomeReady(), SIGNAL(finished(Tp::PendingOperation*)), SLOT(onConnectionReady(Tp::PendingOperation*))); } void Channel::Private::introspectMainProperties() { QVariantMap props; QString key; bool needIntrospectMainProps = false; const unsigned numNames = 8; const static QString names[numNames] = { QLatin1String("ChannelType"), QLatin1String("Interfaces"), QLatin1String("TargetHandleType"), QLatin1String("TargetHandle"), QLatin1String("TargetID"), QLatin1String("Requested"), QLatin1String("InitiatorHandle"), QLatin1String("InitiatorID") }; const static QString qualifiedNames[numNames] = { QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".ChannelType"), QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".Interfaces"), QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType"), QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandle"), QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetID"), QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".Requested"), QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".InitiatorHandle"), QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".InitiatorID") }; for (unsigned i = 0; i < numNames; ++i) { const QString &qualified = qualifiedNames[i]; if (!immutableProperties.contains(qualified)) { needIntrospectMainProps = true; break; } props.insert(names[i], immutableProperties.value(qualified)); } // Save Requested and InitiatorHandle here, so even if the GetAll return doesn't have them but // the given immutable props do (eg. due to the PendingChannel fallback guesses) we use them requested = qdbus_cast<bool>(props[QLatin1String("Requested")]); initiatorHandle = qdbus_cast<uint>(props[QLatin1String("InitiatorHandle")]); if (props.contains(QLatin1String("InitiatorID"))) { QString initiatorId = qdbus_cast<QString>(props[QLatin1String("InitiatorID")]); connection->lowlevel()->injectContactId(initiatorHandle, initiatorId); } if (needIntrospectMainProps) { debug() << "Calling Properties::GetAll(Channel)"; QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher( properties->GetAll(QLatin1String(TELEPATHY_INTERFACE_CHANNEL)), parent); parent->connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(gotMainProperties(QDBusPendingCallWatcher*))); } else { extractMainProps(props); continueIntrospection(); } } void Channel::Private::introspectMainFallbackChannelType() { debug() << "Calling Channel::GetChannelType()"; QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(baseInterface->GetChannelType(), parent); parent->connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(gotChannelType(QDBusPendingCallWatcher*))); } void Channel::Private::introspectMainFallbackHandle() { debug() << "Calling Channel::GetHandle()"; QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(baseInterface->GetHandle(), parent); parent->connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(gotHandle(QDBusPendingCallWatcher*))); } void Channel::Private::introspectMainFallbackInterfaces() { debug() << "Calling Channel::GetInterfaces()"; QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(baseInterface->GetInterfaces(), parent); parent->connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(gotInterfaces(QDBusPendingCallWatcher*))); } void Channel::Private::introspectGroup() { Q_ASSERT(properties != 0); if (!group) { group = parent->interface<Client::ChannelInterfaceGroupInterface>(); Q_ASSERT(group != 0); } debug() << "Introspecting Channel.Interface.Group for" << parent->objectPath(); parent->connect(group, SIGNAL(GroupFlagsChanged(uint,uint)), SLOT(onGroupFlagsChanged(uint,uint))); parent->connect(group, SIGNAL(MembersChanged(QString,Tp::UIntList, Tp::UIntList,Tp::UIntList, Tp::UIntList,uint,uint)), SLOT(onMembersChanged(QString,Tp::UIntList, Tp::UIntList,Tp::UIntList, Tp::UIntList,uint,uint))); parent->connect(group, SIGNAL(MembersChangedDetailed(Tp::UIntList, Tp::UIntList,Tp::UIntList, Tp::UIntList,QVariantMap)), SLOT(onMembersChangedDetailed(Tp::UIntList, Tp::UIntList,Tp::UIntList, Tp::UIntList,QVariantMap))); parent->connect(group, SIGNAL(HandleOwnersChanged(Tp::HandleOwnerMap, Tp::UIntList)), SLOT(onHandleOwnersChanged(Tp::HandleOwnerMap, Tp::UIntList))); parent->connect(group, SIGNAL(SelfHandleChanged(uint)), SLOT(onSelfHandleChanged(uint))); debug() << "Calling Properties::GetAll(Channel.Interface.Group)"; QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher( properties->GetAll(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP)), parent); parent->connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(gotGroupProperties(QDBusPendingCallWatcher*))); } void Channel::Private::introspectGroupFallbackFlags() { Q_ASSERT(group != 0); debug() << "Calling Channel.Interface.Group::GetGroupFlags()"; QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(group->GetGroupFlags(), parent); parent->connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(gotGroupFlags(QDBusPendingCallWatcher*))); } void Channel::Private::introspectGroupFallbackMembers() { Q_ASSERT(group != 0); debug() << "Calling Channel.Interface.Group::GetAllMembers()"; QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(group->GetAllMembers(), parent); parent->connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(gotAllMembers(QDBusPendingCallWatcher*))); } void Channel::Private::introspectGroupFallbackLocalPendingWithInfo() { Q_ASSERT(group != 0); debug() << "Calling Channel.Interface.Group::GetLocalPendingMembersWithInfo()"; QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(group->GetLocalPendingMembersWithInfo(), parent); parent->connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(gotLocalPendingMembersWithInfo(QDBusPendingCallWatcher*))); } void Channel::Private::introspectGroupFallbackSelfHandle() { Q_ASSERT(group != 0); debug() << "Calling Channel.Interface.Group::GetSelfHandle()"; QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(group->GetSelfHandle(), parent); parent->connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(gotSelfHandle(QDBusPendingCallWatcher*))); } void Channel::Private::introspectConference() { Q_ASSERT(properties != 0); Q_ASSERT(conference == 0); debug() << "Introspecting Conference interface"; conference = parent->interface<Client::ChannelInterfaceConferenceInterface>(); Q_ASSERT(conference != 0); introspectingConference = true; debug() << "Connecting to Channel.Interface.Conference.ChannelMerged/Removed"; parent->connect(conference, SIGNAL(ChannelMerged(QDBusObjectPath,uint,QVariantMap)), SLOT(onConferenceChannelMerged(QDBusObjectPath,uint,QVariantMap))); parent->connect(conference, SIGNAL(ChannelRemoved(QDBusObjectPath,QVariantMap)), SLOT(onConferenceChannelRemoved(QDBusObjectPath,QVariantMap))); debug() << "Calling Properties::GetAll(Channel.Interface.Conference)"; QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher( properties->GetAll(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_CONFERENCE)), parent); parent->connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(gotConferenceProperties(QDBusPendingCallWatcher*))); } void Channel::Private::introspectConferenceInitialInviteeContacts(Private *self) { if (!self->conferenceInitialInviteeHandles.isEmpty()) { ContactManagerPtr manager = self->connection->contactManager(); PendingContacts *pendingContacts = manager->contactsForHandles( self->conferenceInitialInviteeHandles); self->parent->connect(pendingContacts, SIGNAL(finished(Tp::PendingOperation *)), SLOT(gotConferenceInitialInviteeContacts(Tp::PendingOperation *))); } else { self->readinessHelper->setIntrospectCompleted( FeatureConferenceInitialInviteeContacts, true); } } void Channel::Private::continueIntrospection() { if (introspectQueue.isEmpty()) { // this should always be true, but let's make sure if (!parent->isReady(Channel::FeatureCore)) { if (groupMembersChangedQueue.isEmpty() && !buildingContacts && !introspectingConference) { debug() << "Both the IS and the MCD queue empty for the first time. Ready."; setReady(); } else { debug() << "Introspection done before contacts done - contacts sets ready"; } } } else { (this->*(introspectQueue.dequeue()))(); } } void Channel::Private::extractMainProps(const QVariantMap &props) { const static QString keyChannelType(QLatin1String("ChannelType")); const static QString keyInterfaces(QLatin1String("Interfaces")); const static QString keyTargetHandle(QLatin1String("TargetHandle")); const static QString keyTargetHandleType(QLatin1String("TargetHandleType")); bool haveProps = props.size() >= 4 && props.contains(keyChannelType) && !qdbus_cast<QString>(props[keyChannelType]).isEmpty() && props.contains(keyInterfaces) && props.contains(keyTargetHandle) && props.contains(keyTargetHandleType); if (!haveProps) { warning() << "Channel properties specified in 0.17.7 not found"; introspectQueue.enqueue(&Private::introspectMainFallbackChannelType); introspectQueue.enqueue(&Private::introspectMainFallbackHandle); introspectQueue.enqueue(&Private::introspectMainFallbackInterfaces); } else { parent->setInterfaces(qdbus_cast<QStringList>(props[keyInterfaces])); readinessHelper->setInterfaces(parent->interfaces()); channelType = qdbus_cast<QString>(props[keyChannelType]); targetHandle = qdbus_cast<uint>(props[keyTargetHandle]); targetHandleType = qdbus_cast<uint>(props[keyTargetHandleType]); const static QString keyTargetId(QLatin1String("TargetID")); const static QString keyRequested(QLatin1String("Requested")); const static QString keyInitiatorHandle(QLatin1String("InitiatorHandle")); const static QString keyInitiatorId(QLatin1String("InitiatorID")); if (props.contains(keyTargetId)) { targetId = qdbus_cast<QString>(props[keyTargetId]); if (targetHandleType == HandleTypeContact) { connection->lowlevel()->injectContactId(targetHandle, targetId); } } if (props.contains(keyRequested)) { requested = qdbus_cast<uint>(props[keyRequested]); } if (props.contains(keyInitiatorHandle)) { initiatorHandle = qdbus_cast<uint>(props[keyInitiatorHandle]); } if (props.contains(keyInitiatorId)) { QString initiatorId = qdbus_cast<QString>(props[keyInitiatorId]); connection->lowlevel()->injectContactId(initiatorHandle, initiatorId); } if (!fakeGroupInterfaceIfNeeded() && !parent->interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP)) && initiatorHandle) { // No group interface, so nobody will build the poor fellow for us. Will do it ourselves // out of pity for him. // TODO: needs testing. I would imagine some of the elaborate updateContacts logic // tripping over with just this. buildContacts(); } nowHaveInterfaces(); } debug() << "Have initiator handle:" << (initiatorHandle ? "yes" : "no"); } void Channel::Private::extract0176GroupProps(const QVariantMap &props) { const static QString keyGroupFlags(QLatin1String("GroupFlags")); const static QString keyHandleOwners(QLatin1String("HandleOwners")); const static QString keyLPMembers(QLatin1String("LocalPendingMembers")); const static QString keyMembers(QLatin1String("Members")); const static QString keyRPMembers(QLatin1String("RemotePendingMembers")); const static QString keySelfHandle(QLatin1String("SelfHandle")); bool haveProps = props.size() >= 6 && (props.contains(keyGroupFlags) && (qdbus_cast<uint>(props[keyGroupFlags]) & ChannelGroupFlagProperties)) && props.contains(keyHandleOwners) && props.contains(keyLPMembers) && props.contains(keyMembers) && props.contains(keyRPMembers) && props.contains(keySelfHandle); if (!haveProps) { warning() << " Properties specified in 0.17.6 not found"; warning() << " Handle owners and self handle tracking disabled"; introspectQueue.enqueue(&Private::introspectGroupFallbackFlags); introspectQueue.enqueue(&Private::introspectGroupFallbackMembers); introspectQueue.enqueue(&Private::introspectGroupFallbackLocalPendingWithInfo); introspectQueue.enqueue(&Private::introspectGroupFallbackSelfHandle); } else { debug() << " Found properties specified in 0.17.6"; groupAreHandleOwnersAvailable = true; groupIsSelfHandleTracked = true; setGroupFlags(qdbus_cast<uint>(props[keyGroupFlags])); groupHandleOwners = qdbus_cast<HandleOwnerMap>(props[keyHandleOwners]); groupInitialMembers = qdbus_cast<UIntList>(props[keyMembers]); groupInitialLP = qdbus_cast<LocalPendingInfoList>(props[keyLPMembers]); groupInitialRP = qdbus_cast<UIntList>(props[keyRPMembers]); uint propSelfHandle = qdbus_cast<uint>(props[keySelfHandle]); // Don't overwrite the self handle we got from the Connection with 0 if (propSelfHandle) { groupSelfHandle = propSelfHandle; } nowHaveInitialMembers(); } } void Channel::Private::nowHaveInterfaces() { debug() << "Channel has" << parent->interfaces().size() << "optional interfaces:" << parent->interfaces(); QStringList interfaces = parent->interfaces(); if (interfaces.contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { introspectQueue.enqueue(&Private::introspectGroup); } if (interfaces.contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_CONFERENCE))) { introspectQueue.enqueue(&Private::introspectConference); } } void Channel::Private::nowHaveInitialMembers() { // Must be called with no contacts anywhere in the first place Q_ASSERT(!parent->isReady(Channel::FeatureCore)); Q_ASSERT(!buildingContacts); Q_ASSERT(pendingGroupMembers.isEmpty()); Q_ASSERT(pendingGroupLocalPendingMembers.isEmpty()); Q_ASSERT(pendingGroupRemotePendingMembers.isEmpty()); Q_ASSERT(groupContacts.isEmpty()); Q_ASSERT(groupLocalPendingContacts.isEmpty()); Q_ASSERT(groupRemotePendingContacts.isEmpty()); // Set groupHaveMembers so we start queueing fresh MCD signals Q_ASSERT(!groupHaveMembers); groupHaveMembers = true; // Synthesize MCD for current + RP groupMembersChangedQueue.enqueue(new GroupMembersChangedInfo( groupInitialMembers, // Members UIntList(), // Removed - obviously, none UIntList(), // LP - will be handled separately, see below groupInitialRP, // Remote pending QVariantMap())); // No details for members + RP // Synthesize one MCD for each initial LP member - they might have different details foreach (const LocalPendingInfo &info, groupInitialLP) { QVariantMap details; if (info.actor != 0) { details.insert(QLatin1String("actor"), info.actor); } if (info.reason != ChannelGroupChangeReasonNone) { details.insert(QLatin1String("change-reason"), info.reason); } if (!info.message.isEmpty()) { details.insert(QLatin1String("message"), info.message); } groupMembersChangedQueue.enqueue(new GroupMembersChangedInfo(UIntList(), UIntList(), UIntList() << info.toBeAdded, UIntList(), details)); } // At least our added MCD event to process processMembersChanged(); } bool Channel::Private::setGroupFlags(uint newGroupFlags) { if (groupFlags == newGroupFlags) { return false; } groupFlags = newGroupFlags; // this shouldn't happen but let's make sure if (!parent->interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { return false; } if ((groupFlags & ChannelGroupFlagMembersChangedDetailed) && !usingMembersChangedDetailed) { usingMembersChangedDetailed = true; debug() << "Starting to exclusively listen to MembersChangedDetailed for" << parent->objectPath(); parent->disconnect(group, SIGNAL(MembersChanged(QString,Tp::UIntList, Tp::UIntList,Tp::UIntList, Tp::UIntList,uint,uint)), parent, SLOT(onMembersChanged(QString,Tp::UIntList, Tp::UIntList,Tp::UIntList, Tp::UIntList,uint,uint))); } else if (!(groupFlags & ChannelGroupFlagMembersChangedDetailed) && usingMembersChangedDetailed) { warning() << " Channel service did spec-incompliant removal of MCD from GroupFlags"; usingMembersChangedDetailed = false; parent->connect(group, SIGNAL(MembersChanged(QString,Tp::UIntList, Tp::UIntList,Tp::UIntList, Tp::UIntList,uint,uint)), parent, SLOT(onMembersChanged(QString,Tp::UIntList, Tp::UIntList,Tp::UIntList, Tp::UIntList,uint,uint))); } return true; } void Channel::Private::buildContacts() { buildingContacts = true; ContactManagerPtr manager = connection->contactManager(); UIntList toBuild = QSet<uint>(pendingGroupMembers + pendingGroupLocalPendingMembers + pendingGroupRemotePendingMembers).toList(); if (currentGroupMembersChangedInfo && currentGroupMembersChangedInfo->actor != 0) { toBuild.append(currentGroupMembersChangedInfo->actor); } if (!initiatorContact && initiatorHandle) { // No initiator contact, but Yes initiator handle - might do something about it with just // that information toBuild.append(initiatorHandle); } if (!targetContact && targetHandleType == HandleTypeContact && targetHandle != 0) { toBuild.append(targetHandle); } // always try to retrieve selfContact and check if it changed on // updateContacts or on gotContacts, in case we were not able to retrieve it if (groupSelfHandle) { toBuild.append(groupSelfHandle); } // group self handle changed to 0 <- strange but it may happen, and contacts // were being built at the time, so check now if (toBuild.isEmpty()) { if (!groupSelfHandle && groupSelfContact) { groupSelfContact.reset(); if (parent->isReady(Channel::FeatureCore)) { emit parent->groupSelfContactChanged(); } } buildingContacts = false; return; } PendingContacts *pendingContacts = manager->contactsForHandles( toBuild); parent->connect(pendingContacts, SIGNAL(finished(Tp::PendingOperation*)), SLOT(gotContacts(Tp::PendingOperation*))); } void Channel::Private::processMembersChanged() { Q_ASSERT(!buildingContacts); if (groupMembersChangedQueue.isEmpty()) { if (pendingRetrieveGroupSelfContact) { pendingRetrieveGroupSelfContact = false; // nothing queued but selfContact changed buildContacts(); return; } if (!parent->isReady(Channel::FeatureCore)) { if (introspectQueue.isEmpty()) { debug() << "Both the MCD and the introspect queue empty for the first time. Ready!"; if (initiatorHandle && !initiatorContact) { warning() << " Unable to create contact object for initiator with handle" << initiatorHandle; } if (targetHandleType == HandleTypeContact && targetHandle != 0 && !targetContact) { warning() << " Unable to create contact object for target with handle" << targetHandle; } if (groupSelfHandle && !groupSelfContact) { warning() << " Unable to create contact object for self handle" << groupSelfHandle; } continueIntrospection(); } else { debug() << "Contact queue empty but introspect queue isn't. IS will set ready."; } } return; } Q_ASSERT(pendingGroupMembers.isEmpty()); Q_ASSERT(pendingGroupLocalPendingMembers.isEmpty()); Q_ASSERT(pendingGroupRemotePendingMembers.isEmpty()); // always set this to false here, as buildContacts will always try to // retrieve the selfContact and updateContacts will check if the built // contact is the same as the current contact. pendingRetrieveGroupSelfContact = false; currentGroupMembersChangedInfo = groupMembersChangedQueue.dequeue(); foreach (uint handle, currentGroupMembersChangedInfo->added) { if (!groupContacts.contains(handle)) { pendingGroupMembers.insert(handle); } // the member was added to current members, check if it was in the // local/pending lists and if true, schedule for removal from that list if (groupLocalPendingContacts.contains(handle)) { groupLocalPendingMembersToRemove.append(handle); } else if(groupRemotePendingContacts.contains(handle)) { groupRemotePendingMembersToRemove.append(handle); } } foreach (uint handle, currentGroupMembersChangedInfo->localPending) { if (!groupLocalPendingContacts.contains(handle)) { pendingGroupLocalPendingMembers.insert(handle); } } foreach (uint handle, currentGroupMembersChangedInfo->remotePending) { if (!groupRemotePendingContacts.contains(handle)) { pendingGroupRemotePendingMembers.insert(handle); } } foreach (uint handle, currentGroupMembersChangedInfo->removed) { groupMembersToRemove.append(handle); } // Always go through buildContacts - we might have a self/initiator/whatever handle to build buildContacts(); } void Channel::Private::updateContacts(const QList<ContactPtr> &contacts) { Contacts groupContactsAdded; Contacts groupLocalPendingContactsAdded; Contacts groupRemotePendingContactsAdded; ContactPtr actorContact; bool selfContactUpdated = false; debug() << "Entering Chan::Priv::updateContacts() with" << contacts.size() << "contacts"; // FIXME: simplify. Some duplication of logic present. foreach (ContactPtr contact, contacts) { uint handle = contact->handle()[0]; if (pendingGroupMembers.contains(handle)) { groupContactsAdded.insert(contact); groupContacts[handle] = contact; } else if (pendingGroupLocalPendingMembers.contains(handle)) { groupLocalPendingContactsAdded.insert(contact); groupLocalPendingContacts[handle] = contact; // FIXME: should set the details and actor here too groupLocalPendingContactsChangeInfo[handle] = GroupMemberChangeDetails(); } else if (pendingGroupRemotePendingMembers.contains(handle)) { groupRemotePendingContactsAdded.insert(contact); groupRemotePendingContacts[handle] = contact; } if (groupSelfHandle == handle && groupSelfContact != contact) { groupSelfContact = contact; selfContactUpdated = true; } if (!initiatorContact && initiatorHandle == handle) { // No initiator contact stored, but there's a contact for the initiator handle // We can use that! initiatorContact = contact; } if (!targetContact && targetHandleType == HandleTypeContact && targetHandle == handle) { targetContact = contact; if (targetId.isEmpty()) { // For some reason, TargetID was missing from the property map. We can initialize it // here in that case. targetId = targetContact->id(); } } if (currentGroupMembersChangedInfo && currentGroupMembersChangedInfo->actor == contact->handle()[0]) { actorContact = contact; } } if (!groupSelfHandle && groupSelfContact) { groupSelfContact.reset(); selfContactUpdated = true; } pendingGroupMembers.clear(); pendingGroupLocalPendingMembers.clear(); pendingGroupRemotePendingMembers.clear(); // FIXME: This shouldn't be needed. Clearer would be to first scan for the actor being present // in the contacts supplied. foreach (ContactPtr contact, contacts) { uint handle = contact->handle()[0]; if (groupLocalPendingContactsChangeInfo.contains(handle)) { groupLocalPendingContactsChangeInfo[handle] = GroupMemberChangeDetails(actorContact, currentGroupMembersChangedInfo ? currentGroupMembersChangedInfo->details : QVariantMap()); } } Contacts groupContactsRemoved; ContactPtr contactToRemove; foreach (uint handle, groupMembersToRemove) { if (groupContacts.contains(handle)) { contactToRemove = groupContacts[handle]; groupContacts.remove(handle); } else if (groupLocalPendingContacts.contains(handle)) { contactToRemove = groupLocalPendingContacts[handle]; groupLocalPendingContacts.remove(handle); } else if (groupRemotePendingContacts.contains(handle)) { contactToRemove = groupRemotePendingContacts[handle]; groupRemotePendingContacts.remove(handle); } if (groupLocalPendingContactsChangeInfo.contains(handle)) { groupLocalPendingContactsChangeInfo.remove(handle); } if (contactToRemove) { groupContactsRemoved.insert(contactToRemove); } } groupMembersToRemove.clear(); // FIXME: drop the LPToRemove and RPToRemove sets - they're redundant foreach (uint handle, groupLocalPendingMembersToRemove) { groupLocalPendingContacts.remove(handle); } groupLocalPendingMembersToRemove.clear(); foreach (uint handle, groupRemotePendingMembersToRemove) { groupRemotePendingContacts.remove(handle); } groupRemotePendingMembersToRemove.clear(); if (!groupContactsAdded.isEmpty() || !groupLocalPendingContactsAdded.isEmpty() || !groupRemotePendingContactsAdded.isEmpty() || !groupContactsRemoved.isEmpty()) { GroupMemberChangeDetails details( actorContact, currentGroupMembersChangedInfo ? currentGroupMembersChangedInfo->details : QVariantMap()); if (currentGroupMembersChangedInfo && currentGroupMembersChangedInfo->removed.contains(groupSelfHandle)) { // Update groupSelfContactRemoveInfo with the proper actor in case // the actor was not available by the time onMembersChangedDetailed // was called. groupSelfContactRemoveInfo = details; } if (parent->isReady(Channel::FeatureCore)) { // Channel is ready, we can signal membership changes to the outside world without // confusing anyone's fragile logic. emit parent->groupMembersChanged( groupContactsAdded, groupLocalPendingContactsAdded, groupRemotePendingContactsAdded, groupContactsRemoved, details); } } delete currentGroupMembersChangedInfo; currentGroupMembersChangedInfo = 0; if (selfContactUpdated && parent->isReady(Channel::FeatureCore)) { emit parent->groupSelfContactChanged(); } processMembersChanged(); } bool Channel::Private::fakeGroupInterfaceIfNeeded() { if (parent->interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { return false; } else if (targetHandleType != HandleTypeContact) { return false; } // fake group interface if (connection->selfHandle() && targetHandle) { // Fake groupSelfHandle and initial members, let the MCD handling take care of the rest // TODO connect to Connection::selfHandleChanged groupSelfHandle = connection->selfHandle(); groupInitialMembers = UIntList() << groupSelfHandle << targetHandle; debug().nospace() << "Faking a group on channel with self handle=" << groupSelfHandle << " and other handle=" << targetHandle; nowHaveInitialMembers(); } else { warning() << "Connection::selfHandle is 0 or targetHandle is 0, " "not faking a group on channel"; } return true; } void Channel::Private::setReady() { Q_ASSERT(!parent->isReady(Channel::FeatureCore)); debug() << "Channel fully ready"; debug() << " Channel type" << channelType; debug() << " Target handle" << targetHandle; debug() << " Target handle type" << targetHandleType; if (parent->interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { debug() << " Group: flags" << groupFlags; if (groupAreHandleOwnersAvailable) { debug() << " Group: Number of handle owner mappings" << groupHandleOwners.size(); } else { debug() << " Group: No handle owners property present"; } debug() << " Group: Number of current members" << groupContacts.size(); debug() << " Group: Number of local pending members" << groupLocalPendingContacts.size(); debug() << " Group: Number of remote pending members" << groupRemotePendingContacts.size(); debug() << " Group: Self handle" << groupSelfHandle << "tracked:" << (groupIsSelfHandleTracked ? "yes" : "no"); } readinessHelper->setIntrospectCompleted(FeatureCore, true); } QString Channel::Private::groupMemberChangeDetailsTelepathyError( const GroupMemberChangeDetails &details) { QString error; uint reason = details.reason(); switch (reason) { case ChannelGroupChangeReasonOffline: error = QLatin1String(TELEPATHY_ERROR_OFFLINE); break; case ChannelGroupChangeReasonKicked: error = QLatin1String(TELEPATHY_ERROR_CHANNEL_KICKED); break; case ChannelGroupChangeReasonBanned: error = QLatin1String(TELEPATHY_ERROR_CHANNEL_BANNED); break; case ChannelGroupChangeReasonBusy: error = QLatin1String(TELEPATHY_ERROR_BUSY); break; case ChannelGroupChangeReasonNoAnswer: error = QLatin1String(TELEPATHY_ERROR_NO_ANSWER); break; case ChannelGroupChangeReasonPermissionDenied: error = QLatin1String(TELEPATHY_ERROR_PERMISSION_DENIED); break; case ChannelGroupChangeReasonInvalidContact: error = QLatin1String(TELEPATHY_ERROR_DOES_NOT_EXIST); break; // The following change reason are being mapped to default // case ChannelGroupChangeReasonNone: // case ChannelGroupChangeReasonInvited: // shouldn't happen // case ChannelGroupChangeReasonError: // case ChannelGroupChangeReasonRenamed: // case ChannelGroupChangeReasonSeparated: // shouldn't happen default: // let's use the actor handle and selfHandle here instead of the // contacts, as the contacts may not be ready. error = ((qdbus_cast<uint>(details.allDetails().value(QLatin1String("actor"))) == groupSelfHandle) ? QLatin1String(TELEPATHY_ERROR_CANCELLED) : QLatin1String(TELEPATHY_ERROR_TERMINATED)); break; } return error; } void Channel::Private::processConferenceChannelRemoved() { if (buildingConferenceChannelRemovedActorContact || conferenceChannelRemovedQueue.isEmpty()) { return; } ConferenceChannelRemovedInfo *info = conferenceChannelRemovedQueue.first(); if (!conferenceChannels.contains(info->channelPath.path())) { info = conferenceChannelRemovedQueue.dequeue(); delete info; processConferenceChannelRemoved(); return; } buildingConferenceChannelRemovedActorContact = true; if (info->details.contains(keyActor)) { ContactManagerPtr manager = connection->contactManager(); PendingContacts *pendingContacts = manager->contactsForHandles( UIntList() << qdbus_cast<uint>(info->details.value(keyActor))); parent->connect(pendingContacts, SIGNAL(finished(Tp::PendingOperation*)), SLOT(gotConferenceChannelRemovedActorContact(Tp::PendingOperation*))); } else { parent->gotConferenceChannelRemovedActorContact(0); } } struct TELEPATHY_QT4_NO_EXPORT Channel::GroupMemberChangeDetails::Private : public QSharedData { Private(const ContactPtr &actor, const QVariantMap &details) : actor(actor), details(details) {} ContactPtr actor; QVariantMap details; }; /** * \class Channel::GroupMemberChangeDetails * \ingroup clientchannel * \headerfile TelepathyQt4/channel.h <TelepathyQt4/Channel> * * \brief The Channel::GroupMemberChangeDetails class represents the details of a group membership * change. * * Extended information is not always available; this will be reflected by * the return value of isValid(). */ /** * Constructs a new invalid GroupMemberChangeDetails instance. */ Channel::GroupMemberChangeDetails::GroupMemberChangeDetails() { } /** * Copy constructor. */ Channel::GroupMemberChangeDetails::GroupMemberChangeDetails(const GroupMemberChangeDetails &other) : mPriv(other.mPriv) { } /** * Class destructor. */ Channel::GroupMemberChangeDetails::~GroupMemberChangeDetails() { } /** * Assigns all information (validity, details) from other to this. */ Channel::GroupMemberChangeDetails &Channel::GroupMemberChangeDetails::operator=( const GroupMemberChangeDetails &other) { this->mPriv = other.mPriv; return *this; } /** * \fn bool Channel::GroupMemberChangeDetails::isValid() const * * Return whether the details are valid (have actually been received from the service). * * \return \c true if valid, \c false otherwise. */ /** * Return whether the details specify an actor. * * If present, actor() will return the contact object representing the person who made the change. * * \return \c true if the actor is known, \c false otherwise. * \sa actor() */ bool Channel::GroupMemberChangeDetails::hasActor() const { return isValid() && !mPriv->actor.isNull(); } /** * Return the contact object representing the person who made the change (actor), if known. * * \return A pointer to the Contact object, or a null ContactPtr if the actor is unknown. * \sa hasActor() */ ContactPtr Channel::GroupMemberChangeDetails::actor() const { return isValid() ? mPriv->actor : ContactPtr(); } /** * \fn bool Channel::GroupMemberChangeDetails::hasReason() const * * Return whether the details specify the reason for the change. * * \return \c true if the reason is known, \c false otherwise. * \sa reason() */ /** * \fn ChannelGroupChangeReason Channel::GroupMemberChangeDetails::reason() const * * Return the reason for the change, if known. * * \return The change reason as #ChannelGroupChangeReason, or #ChannelGroupChangeReasonNone * if the reason is unknown. * \sa hasReason() */ /** * \fn bool Channel::GroupMemberChangeDetails::hasMessage() const * * Return whether the details specify a human-readable message from the contact represented by * actor() pertaining to the change. * * \return \c true if the message is known, \c false otherwise. * \sa message() */ /** * \fn QString Channel::GroupMemberChangeDetails::message() const * * Return a human-readable message from the contact represented by actor() pertaining to the change, * if known. * * \return The message, or an empty string if the message is unknown. * \sa hasMessage() */ /** * \fn bool Channel::GroupMemberChangeDetails::hasError() const * * Return whether the details specify a D-Bus error describing the change. * * \return \c true if the error is known, \c false otherwise. * \sa error() */ /** * \fn QString Channel::GroupMemberChangeDetails::error() const * * Return the D-Bus error describing the change, if known. * * The D-Bus error provides more specific information than the reason() and should be used if * applicable. * * \return A D-Bus error describing the change, or an empty string if the error is unknown. * \sa hasError() */ /** * \fn bool Channel::GroupMemberChangeDetails::hasDebugMessage() const * * Return whether the details specify a debug message. * * \return \c true if debug message is present, \c false otherwise. * \sa debugMessage() */ /** * \fn QString Channel::GroupMemberChangeDetails::debugMessage() const * * Return the debug message specified by the details, if any. * * The debug message is purely informational, offered for display for bug reporting purposes, and * should not be attempted to be parsed. * * \return The debug message, or an empty string if there is none. * \sa hasDebugMessage() */ /** * Return a map containing all details of the group members change. * * This is useful for accessing domain-specific additional details. * * \return The details of the group members change as QVariantMap. */ QVariantMap Channel::GroupMemberChangeDetails::allDetails() const { return isValid() ? mPriv->details : QVariantMap(); } Channel::GroupMemberChangeDetails::GroupMemberChangeDetails(const ContactPtr &actor, const QVariantMap &details) : mPriv(new Private(actor, details)) { } /** * \class Channel * \ingroup clientchannel * \headerfile TelepathyQt4/channel.h <TelepathyQt4/Channel> * * \brief The Channel class represents a Telepathy channel. * * All communication in the Telepathy framework is carried out via channel * objects. Specialized classes for some specific channel types such as * StreamedMediaChannel, TextChannel, FileTransferChannel are provided. * * The remote object accessor functions on this object (channelType(), targetHandleType(), * and so on) don't make any D-Bus calls; instead, they return/use * values cached from a previous introspection run. The introspection process * populates their values in the most efficient way possible based on what the * service implements. * * To avoid unnecessary D-Bus traffic, some accessors only return valid * information after specific features have been enabled. * For instance, to retrieve the initial invitee contacts in a conference channel, * it is necessary to enable the feature Channel::FeatureConferenceInitialInviteeContacts. * See the individual methods descriptions for more details. * * Channel features can be enabled by constructing a ChannelFactory and enabling * the desired features, and passing it to AccountManager, Account or ClientRegistrar * when creating them as appropriate. However, if a particular * feature is only ever used in a specific circumstance, such as an user opening * some settings dialog separate from the general view of the application, * features can be later enabled as needed by calling becomeReady() with the additional * features, and waiting for the resulting PendingOperation to finish. * * Each channel is owned by a connection. If the Connection object becomes invalidated * the Channel object will also get invalidated. * * \section chan_usage_sec Usage * * \subsection chan_create_sec Creating a channel object * * Channel objects can be created in various ways, but the preferred way is * trough Account channel creation methods such as Account::ensureTextChat(), * Account::createFileTransfer(), which uses the channel dispatcher. * * If you already know the object path, you can just call create(). * For example: * * \code * * ChannelPtr chan = Channel::create(connection, objectPath, * immutableProperties); * * \endcode * * \subsection chan_ready_sec Making channel ready to use * * A Channel object needs to become ready before usage, meaning that the * introspection process finished and the object accessors can be used. * * To make the object ready, use becomeReady() and wait for the * PendingOperation::finished() signal to be emitted. * * \code * * class MyClass : public QObject * { * QOBJECT * * public: * MyClass(QObject *parent = 0); * ~MyClass() { } * * private Q_SLOTS: * void onChannelReady(Tp::PendingOperation*); * * private: * ChannelPtr chan; * }; * * MyClass::MyClass(const ConnectionPtr &connection, * const QString &objectPath, const QVariantMap &immutableProperties) * : QObject(parent) * chan(Channel::create(connection, objectPath, immutableProperties)) * { * connect(chan->becomeReady(), * SIGNAL(finished(Tp::PendingOperation*)), * SLOT(onChannelReady(Tp::PendingOperation*))); * } * * void MyClass::onChannelReady(Tp::PendingOperation *op) * { * if (op->isError()) { * qWarning() << "Channel cannot become ready:" << * op->errorName() << "-" << op->errorMessage(); * return; * } * * // Channel is now ready * } * * \endcode * * See \ref async_model, \ref shared_ptr */ /** * Feature representing the core that needs to become ready to make the Channel * object usable. * * Note that this feature must be enabled in order to use most Channel methods. * See specific methods documentation for more details. * * When calling isReady(), becomeReady(), this feature is implicitly added * to the requested features. */ const Feature Channel::FeatureCore = Feature(QLatin1String(Channel::staticMetaObject.className()), 0, true); /** * Feature used in order to access the conference initial invitee contacts info. * * \sa conferenceInitialInviteeContacts() */ const Feature Channel::FeatureConferenceInitialInviteeContacts = Feature(QLatin1String(Channel::staticMetaObject.className()), 1, true); /** * Create a new Channel object. * * \param connection Connection owning this channel, and specifying the * service. * \param objectPath The channel object path. * \param immutableProperties The channel immutable properties. * \return A ChannelPtr object pointing to the newly created Channel object. * * \todo \a immutableProperties should be used to populate the corresponding accessors (such as * channelType()) already on construction, not only when making FeatureCore ready (fd.o #41654) */ ChannelPtr Channel::create(const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties) { return ChannelPtr(new Channel(connection, objectPath, immutableProperties, Channel::FeatureCore)); } /** * Construct a new Channel object. * * \param connection Connection owning this channel, and specifying the * service. * \param objectPath The channel object path. * \param immutableProperties The channel immutable properties. * \param coreFeature The core feature of the channel type. The corresponding introspectable should * depend on Channel::FeatureCore. */ Channel::Channel(const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties, const Feature &coreFeature) : StatefulDBusProxy(connection->dbusConnection(), connection->busName(), objectPath, coreFeature), OptionalInterfaceFactory<Channel>(this), mPriv(new Private(this, connection, immutableProperties)) { } /** * Class destructor. */ Channel::~Channel() { delete mPriv; } /** * Return the connection owning this channel. * * \return A pointer to the Connection object. */ ConnectionPtr Channel::connection() const { return mPriv->connection; } /** * Return the immutable properties of the channel. * * If the channel is ready (isReady(Channel::FeatureCore) returns true), the following keys are * guaranteed to be present: * org.freedesktop.Telepathy.Channel.ChannelType, * org.freedesktop.Telepathy.Channel.TargetHandleType, * org.freedesktop.Telepathy.Channel.TargetHandle and * org.freedesktop.Telepathy.Channel.Requested. * * The keys and values in this map are defined by the \telepathy_spec, * or by third-party extensions to that specification. * These are the properties that cannot change over the lifetime of the * channel; they're announced in the result of the request, for efficiency. * * \return The immutable properties as QVariantMap. */ QVariantMap Channel::immutableProperties() const { if (isReady(Channel::FeatureCore)) { QString key; key = QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".ChannelType"); if (!mPriv->immutableProperties.contains(key)) { mPriv->immutableProperties.insert(key, mPriv->channelType); } key = QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".Interfaces"); if (!mPriv->immutableProperties.contains(key)) { mPriv->immutableProperties.insert(key, interfaces()); } key = QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType"); if (!mPriv->immutableProperties.contains(key)) { mPriv->immutableProperties.insert(key, mPriv->targetHandleType); } key = QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandle"); if (!mPriv->immutableProperties.contains(key)) { mPriv->immutableProperties.insert(key, mPriv->targetHandle); } key = QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetID"); if (!mPriv->immutableProperties.contains(key)) { mPriv->immutableProperties.insert(key, mPriv->targetId); } key = QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".Requested"); if (!mPriv->immutableProperties.contains(key)) { mPriv->immutableProperties.insert(key, mPriv->requested); } key = QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".InitiatorHandle"); if (!mPriv->immutableProperties.contains(key)) { mPriv->immutableProperties.insert(key, mPriv->initiatorHandle); } key = QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".InitiatorID"); if (!mPriv->immutableProperties.contains(key) && !mPriv->initiatorContact.isNull()) { mPriv->immutableProperties.insert(key, mPriv->initiatorContact->id()); } } return mPriv->immutableProperties; } /** * Return the D-Bus interface name for the type of this channel. * * This method requires Channel::FeatureCore to be ready. * * \return The D-Bus interface name for the type of the channel. */ QString Channel::channelType() const { // Similarly, we don't want warnings triggered when using the type interface // proxies internally. if (!isReady(Channel::FeatureCore) && mPriv->channelType.isEmpty()) { warning() << "Channel::channelType() before the channel type has " "been received"; } else if (!isValid()) { warning() << "Channel::channelType() used with channel closed"; } return mPriv->channelType; } /** * Return the type of the handle returned by targetHandle() as specified in * #HandleType. * * This method requires Channel::FeatureCore to be ready. * * \return The target handle type as #HandleType. * \sa targetHandle(), targetId() */ HandleType Channel::targetHandleType() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::targetHandleType() used channel not ready"; } return (HandleType) mPriv->targetHandleType; } /** * Return the handle of the remote party with which this channel * communicates. * * This method requires Channel::FeatureCore to be ready. * * \return An integer representing the target handle, which is of the type * targetHandleType() indicates. * \sa targetHandleType(), targetId() */ uint Channel::targetHandle() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::targetHandle() used channel not ready"; } return mPriv->targetHandle; } /** * Return the persistent unique ID of the remote party with which this channel communicates. * * If targetHandleType() is #HandleTypeContact, this will be the ID of the remote contact, and * similarly the unique ID of the room when targetHandleType() is #HandleTypeRoom. * * This is not necessarily the best identifier to display to the user, though. In particular, for * contacts, their alias should be displayed instead. It can be used for matching channels and UI * elements for them across reconnects, though, at which point the old channels and contacts are * invalidated. * * This method requires Channel::FeatureCore to be ready. * * \return The target identifier. * \sa targetHandle(), targetContact() */ QString Channel::targetId() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::targetId() used, but the channel is not ready"; } return mPriv->targetId; } /** * Return the contact with which this channel communicates for its lifetime, if applicable. * * This method requires Channel::FeatureCore to be ready. * * \return A pointer to the Contact object, or a null ContactPtr if targetHandleType() is not * #HandleTypeContact. * \sa targetHandle(), targetId() */ ContactPtr Channel::targetContact() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::targetContact() used, but the channel is not ready"; } else if (targetHandleType() != HandleTypeContact) { warning() << "Channel::targetContact() used with targetHandleType() != Contact"; } return mPriv->targetContact; } /** * Return whether this channel was created in response to a * local request. * * This method requires Channel::FeatureCore to be ready. * * \return \c true if the channel was created in response to a local request, * \c false otherwise. */ bool Channel::isRequested() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::isRequested() used channel not ready"; } return mPriv->requested; } /** * Return the contact who initiated this channel. * * This method requires Channel::FeatureCore to be ready. * * \return A pointer to the Contact object representing the contact who initiated the channel, * or a null ContactPtr if it can't be retrieved. */ ContactPtr Channel::initiatorContact() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::initiatorContact() used channel not ready"; } return mPriv->initiatorContact; } /** * Start an asynchronous request that this channel be closed. * * The returned PendingOperation object will signal the success or failure * of this request; under normal circumstances, it can be expected to * succeed. * * \return A PendingOperation which will emit PendingOperation::finished * when the call has finished. * \sa requestLeave() */ PendingOperation *Channel::requestClose() { // Closing a channel does not make sense if it is already closed, // just silently Return. if (!isValid()) { return new PendingSuccess(ChannelPtr(this)); } return new PendingVoid(mPriv->baseInterface->Close(), ChannelPtr(this)); } Channel::PendingLeave::PendingLeave(const ChannelPtr &chan, const QString &message, ChannelGroupChangeReason reason) : PendingOperation(chan) { Q_ASSERT(chan->mPriv->group != NULL); QDBusPendingCall call = chan->mPriv->group->RemoveMembersWithReason( UIntList() << chan->mPriv->groupSelfHandle, message, reason); connect(chan.data(), SIGNAL(invalidated(Tp::DBusProxy*,QString,QString)), this, SLOT(onChanInvalidated(Tp::DBusProxy*))); connect(new PendingVoid(call, chan), SIGNAL(finished(Tp::PendingOperation*)), this, SLOT(onRemoveFinished(Tp::PendingOperation*))); } void Channel::PendingLeave::onChanInvalidated(Tp::DBusProxy *proxy) { if (isFinished()) { return; } debug() << "Finishing PendingLeave successfully as the channel was invalidated"; setFinished(); } void Channel::PendingLeave::onRemoveFinished(Tp::PendingOperation *op) { if (isFinished()) { return; } ChannelPtr chan = ChannelPtr::staticCast(_object()); if (op->isValid()) { debug() << "We left the channel" << chan->objectPath(); ContactPtr c = chan->groupSelfContact(); if (chan->groupContacts().contains(c) || chan->groupLocalPendingContacts().contains(c) || chan->groupRemotePendingContacts().contains(c)) { debug() << "Waiting for self remove to be picked up"; connect(chan.data(), SIGNAL(groupMembersChanged(Tp::Contacts,Tp::Contacts,Tp::Contacts,Tp::Contacts, Tp::Channel::GroupMemberChangeDetails)), this, SLOT(onMembersChanged(Tp::Contacts,Tp::Contacts,Tp::Contacts,Tp::Contacts))); } else { setFinished(); } return; } debug() << "Leave RemoveMembersWithReason failed with " << op->errorName() << op->errorMessage() << "- falling back to Close"; // If the channel has been closed or otherwise invalidated already in this mainloop iteration, // the requestClose() operation will early-succeed connect(chan->requestClose(), SIGNAL(finished(Tp::PendingOperation*)), this, SLOT(onCloseFinished(Tp::PendingOperation*))); } void Channel::PendingLeave::onMembersChanged(const Tp::Contacts &, const Tp::Contacts &, const Tp::Contacts &, const Tp::Contacts &removed) { if (isFinished()) { return; } ChannelPtr chan = ChannelPtr::staticCast(_object()); ContactPtr c = chan->groupSelfContact(); if (removed.contains(c)) { debug() << "Leave event picked up for" << chan->objectPath(); setFinished(); } } void Channel::PendingLeave::onCloseFinished(Tp::PendingOperation *op) { if (isFinished()) { return; } ChannelPtr chan = ChannelPtr::staticCast(_object()); if (op->isError()) { warning() << "Closing the channel" << chan->objectPath() << "as a fallback for leaving it failed with" << op->errorName() << op->errorMessage() << "- so didn't leave"; setFinishedWithError(op->errorName(), op->errorMessage()); } else { debug() << "We left (by closing) the channel" << chan->objectPath(); setFinished(); } } /** * Start an asynchronous request to leave this channel as gracefully as possible. * * If leaving any more gracefully is not possible, this will revert to the same as requestClose(). * In particular, this will be the case for channels with no group interface * (#TP_QT4_IFACE_CHANNEL_INTERFACE_GROUP not in the list returned by interfaces()). * * The returned PendingOperation object will signal the success or failure * of this request; under normal circumstances, it can be expected to * succeed. * * A message and a reason may be provided along with the request, which will be sent to the server * if supported, which is indicated by #ChannelGroupFlagMessageDepart and/or * #ChannelGroupFlagMessageReject. * * Attempting to leave again when we have already left, either by our request or forcibly, will be a * no-op, with the returned PendingOperation immediately finishing successfully. * * \param message The message, which can be blank if desired. * \param reason A reason for leaving. * \return A PendingOperation which will emit PendingOperation::finished * when the call has finished. */ PendingOperation *Channel::requestLeave(const QString &message, ChannelGroupChangeReason reason) { // Leaving a channel does not make sense if it is already closed, // just silently Return. if (!isValid()) { return new PendingSuccess(ChannelPtr(this)); } if (!isReady(Channel::FeatureCore)) { return new PendingFailure(TP_QT4_ERROR_NOT_AVAILABLE, QLatin1String("Channel::FeatureCore must be ready to leave a channel"), ChannelPtr(this)); } if (!interfaces().contains(TP_QT4_IFACE_CHANNEL_INTERFACE_GROUP)) { return requestClose(); } ContactPtr self = groupSelfContact(); if (!groupContacts().contains(self) && !groupLocalPendingContacts().contains(self) && !groupRemotePendingContacts().contains(self)) { debug() << "Channel::requestLeave() called for " << objectPath() << "which we aren't a member of"; return new PendingSuccess(ChannelPtr(this)); } return new PendingLeave(ChannelPtr(this), message, reason); } /** * \name Group interface * * Cached access to state of the group interface on the associated remote * object, if the interface is present. * * Some methods can be used when targetHandleType() == #HandleTypeContact, such * as groupFlags(), groupCanAddContacts(), groupCanRemoveContacts(), * groupSelfContact() and groupContacts(). * * As the group interface state can change freely during the lifetime of the * channel due to events like new contacts joining the group, the cached state * is automatically kept in sync with the remote object's state by hooking * to the change notification signals present in the D-Bus interface. * * As the cached value changes, change notification signals are emitted. * * Signals such as groupMembersChanged(), groupSelfContactChanged(), etc., are emitted to * indicate that properties have changed. * * Check the individual signals' descriptions for details. */ //@{ /** * Return a set of flags indicating the capabilities and behaviour of the * group on this channel. * * Change notification is via the groupFlagsChanged() signal. * * This method requires Channel::FeatureCore to be ready. * * \return The bitfield combination of flags as #ChannelGroupFlags. * \sa groupFlagsChanged() */ ChannelGroupFlags Channel::groupFlags() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupFlags() used channel not ready"; } return (ChannelGroupFlags) mPriv->groupFlags; } /** * Return whether contacts can be added or invited to this channel. * * Change notification is via the groupCanAddContactsChanged() signal. * * This method requires Channel::FeatureCore to be ready. * * \return \c true if contacts can be added or invited to the channel, * \c false otherwise. * \sa groupFlags(), groupAddContacts() */ bool Channel::groupCanAddContacts() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupCanAddContacts() used channel not ready"; } return mPriv->groupFlags & ChannelGroupFlagCanAdd; } /** * Return whether a message is expected when adding/inviting contacts, who * are not already members, to this channel. * * This method requires Channel::FeatureCore to be ready. * * \return \c true if a message is expected, \c false otherwise. * \sa groupFlags(), groupAddContacts() */ bool Channel::groupCanAddContactsWithMessage() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupCanAddContactsWithMessage() used when channel not ready"; } return mPriv->groupFlags & ChannelGroupFlagMessageAdd; } /** * Return whether a message is expected when accepting contacts' requests to * join this channel. * * This method requires Channel::FeatureCore to be ready. * * \return \c true if a message is expected, \c false otherwise. * \sa groupFlags(), groupAddContacts() */ bool Channel::groupCanAcceptContactsWithMessage() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupCanAcceptContactsWithMessage() used when channel not ready"; } return mPriv->groupFlags & ChannelGroupFlagMessageAccept; } /** * Add contacts to this channel. * * Contacts on the local pending list (those waiting for permission to join * the channel) can always be added. If groupCanAcceptContactsWithMessage() * returns \c true, an optional message is expected when doing this; if not, * the message parameter is likely to be ignored (so the user should not be * asked for a message, and the message parameter should be left empty). * * Other contacts can only be added if groupCanAddContacts() returns \c true. * If groupCanAddContactsWithMessage() returns \c true, an optional message is * expected when doing this, and if not, the message parameter is likely to be * ignored. * * This method requires Channel::FeatureCore to be ready. * * \param contacts Contacts to be added. * \param message A string message, which can be blank if desired. * \return A PendingOperation which will emit PendingOperation::finished * when the call has finished. * \sa groupCanAddContacts(), groupCanAddContactsWithMessage(), groupCanAcceptContactsWithMessage() */ PendingOperation *Channel::groupAddContacts(const QList<ContactPtr> &contacts, const QString &message) { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupAddContacts() used channel not ready"; return new PendingFailure(QLatin1String(TELEPATHY_ERROR_NOT_AVAILABLE), QLatin1String("Channel not ready"), ChannelPtr(this)); } else if (contacts.isEmpty()) { warning() << "Channel::groupAddContacts() used with empty contacts param"; return new PendingFailure(QLatin1String(TELEPATHY_ERROR_INVALID_ARGUMENT), QLatin1String("contacts cannot be an empty list"), ChannelPtr(this)); } foreach (const ContactPtr &contact, contacts) { if (!contact) { warning() << "Channel::groupAddContacts() used but contacts param contains " "invalid contact"; return new PendingFailure(QLatin1String(TELEPATHY_ERROR_INVALID_ARGUMENT), QLatin1String("Unable to add invalid contacts"), ChannelPtr(this)); } } if (!interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { warning() << "Channel::groupAddContacts() used with no group interface"; return new PendingFailure(QLatin1String(TELEPATHY_ERROR_NOT_IMPLEMENTED), QLatin1String("Channel does not support group interface"), ChannelPtr(this)); } UIntList handles; foreach (const ContactPtr &contact, contacts) { handles << contact->handle()[0]; } return new PendingVoid(mPriv->group->AddMembers(handles, message), ChannelPtr(this)); } /** * Return whether contacts in groupRemotePendingContacts() can be removed from * this channel (i.e. whether an invitation can be rescinded). * * Change notification is via the groupCanRescindContactsChanged() signal. * * This method requires Channel::FeatureCore to be ready. * * \return \c true if contacts can be removed, \c false otherwise. * \sa groupFlags(), groupRemoveContacts() */ bool Channel::groupCanRescindContacts() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupCanRescindContacts() used channel not ready"; } return mPriv->groupFlags & ChannelGroupFlagCanRescind; } /** * Return whether a message is expected when removing contacts who are in * groupRemotePendingContacts() from this channel (i.e. rescinding an * invitation). * * This method requires Channel::FeatureCore to be ready. * * \return \c true if a message is expected, \c false otherwise. * \sa groupFlags(), groupRemoveContacts() */ bool Channel::groupCanRescindContactsWithMessage() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupCanRescindContactsWithMessage() used when channel not ready"; } return mPriv->groupFlags & ChannelGroupFlagMessageRescind; } /** * Return if contacts in groupContacts() can be removed from this channel. * * Note that contacts in local pending lists, and the groupSelfContact(), can * always be removed from the channel. * * Change notification is via the groupCanRemoveContactsChanged() signal. * * This method requires Channel::FeatureCore to be ready. * * \return \c true if contacts can be removed, \c false otherwise. * \sa groupFlags(), groupRemoveContacts() */ bool Channel::groupCanRemoveContacts() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupCanRemoveContacts() used channel not ready"; } return mPriv->groupFlags & ChannelGroupFlagCanRemove; } /** * Return whether a message is expected when removing contacts who are in * groupContacts() from this channel. * * This method requires Channel::FeatureCore to be ready. * * \return \c true if a message is expected, \c false otherwise. * \sa groupFlags(), groupRemoveContacts() */ bool Channel::groupCanRemoveContactsWithMessage() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupCanRemoveContactsWithMessage() used when channel not ready"; } return mPriv->groupFlags & ChannelGroupFlagMessageRemove; } /** * Return whether a message is expected when removing contacts who are in * groupLocalPendingContacts() from this channel (i.e. rejecting a request to * join). * * This method requires Channel::FeatureCore to be ready. * * \return \c true if a message is expected, \c false otherwise. * \sa groupFlags(), groupRemoveContacts() */ bool Channel::groupCanRejectContactsWithMessage() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupCanRejectContactsWithMessage() used when channel not ready"; } return mPriv->groupFlags & ChannelGroupFlagMessageReject; } /** * Return whether a message is expected when removing the groupSelfContact() * from this channel (i.e. departing from the channel). * * \return \c true if a message is expected, \c false otherwise. * \sa groupFlags(), groupRemoveContacts() */ bool Channel::groupCanDepartWithMessage() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupCanDepartWithMessage() used when channel not ready"; } return mPriv->groupFlags & ChannelGroupFlagMessageDepart; } /** * Remove contacts from this channel. * * Contacts on the local pending list (those waiting for permission to join * the channel) can always be removed. If groupCanRejectContactsWithMessage() * returns \c true, an optional message is expected when doing this; if not, * the message parameter is likely to be ignored (so the user should not be * asked for a message, and the message parameter should be left empty). * * The groupSelfContact() can also always be removed, as a way to leave the * group with an optional departure message and/or departure reason indication. * If groupCanDepartWithMessage() returns \c true, an optional message is * expected when doing this, and if not, the message parameter is likely to * be ignored. * * Contacts in the group can only be removed (e.g. kicked) if * groupCanRemoveContacts() returns \c true. If * groupCanRemoveContactsWithMessage() returns \c true, an optional message is * expected when doing this, and if not, the message parameter is likely to be * ignored. * * Contacts in the remote pending list (those who have been invited to the * channel) can only be removed (have their invitations rescinded) if * groupCanRescindContacts() returns \c true. If * groupCanRescindContactsWithMessage() returns \c true, an optional message is * expected when doing this, and if not, the message parameter is likely to be * ignored. * * This method requires Channel::FeatureCore to be ready. * * \param contacts Contacts to be removed. * \param message A string message, which can be blank if desired. * \param reason Reason of the change, as specified in * #ChannelGroupChangeReason * \return A PendingOperation which will emit PendingOperation::finished * when the call has finished. * \sa groupCanRemoveContacts(), groupCanRemoveContactsWithMessage(), * groupCanRejectContactsWithMessage(), groupCanRescindContacts(), * groupCanRescindContacts(), groupCanRescindContactsWithMessage(), * groupCanDepartWithMessage() */ PendingOperation *Channel::groupRemoveContacts(const QList<ContactPtr> &contacts, const QString &message, ChannelGroupChangeReason reason) { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupRemoveContacts() used channel not ready"; return new PendingFailure(QLatin1String(TELEPATHY_ERROR_NOT_AVAILABLE), QLatin1String("Channel not ready"), ChannelPtr(this)); } if (contacts.isEmpty()) { warning() << "Channel::groupRemoveContacts() used with empty contacts param"; return new PendingFailure(QLatin1String(TELEPATHY_ERROR_INVALID_ARGUMENT), QLatin1String("contacts param cannot be an empty list"), ChannelPtr(this)); } foreach (const ContactPtr &contact, contacts) { if (!contact) { warning() << "Channel::groupRemoveContacts() used but contacts param contains " "invalid contact:"; return new PendingFailure(QLatin1String(TELEPATHY_ERROR_INVALID_ARGUMENT), QLatin1String("Unable to remove invalid contacts"), ChannelPtr(this)); } } if (!interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { warning() << "Channel::groupRemoveContacts() used with no group interface"; return new PendingFailure(QLatin1String(TELEPATHY_ERROR_NOT_IMPLEMENTED), QLatin1String("Channel does not support group interface"), ChannelPtr(this)); } UIntList handles; foreach (const ContactPtr &contact, contacts) { handles << contact->handle()[0]; } return new PendingVoid( mPriv->group->RemoveMembersWithReason(handles, message, reason), ChannelPtr(this)); } /** * Return the current contacts of the group. * * Change notification is via the groupMembersChanged() signal. * * This method requires Channel::FeatureCore to be ready. * * \return A set of pointers to the Contact objects. * \sa groupLocalPendingContacts(), groupRemotePendingContacts() */ Contacts Channel::groupContacts() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupMembers() used channel not ready"; } return mPriv->groupContacts.values().toSet(); } /** * Return the contacts currently waiting for local approval to join the * group. * * Change notification is via the groupMembersChanged() signal. * * This method requires Channel::FeatureCore to be ready. * * \return A set of pointers to the Contact objects. * \sa groupContacts(), groupRemotePendingContacts() */ Contacts Channel::groupLocalPendingContacts() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupLocalPendingContacts() used channel not ready"; } else if (!interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { warning() << "Channel::groupLocalPendingContacts() used with no group interface"; } return mPriv->groupLocalPendingContacts.values().toSet(); } /** * Return the contacts currently waiting for remote approval to join the * group. * * Change notification is via the groupMembersChanged() signal. * * This method requires Channel::FeatureCore to be ready. * * \return A set of pointers to the Contact objects. * \sa groupContacts(), groupLocalPendingContacts() */ Contacts Channel::groupRemotePendingContacts() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupRemotePendingContacts() used channel not ready"; } else if (!interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { warning() << "Channel::groupRemotePendingContacts() used with no " "group interface"; } return mPriv->groupRemotePendingContacts.values().toSet(); } /** * Return information of a local pending contact change. If * no information is available, an object for which * GroupMemberChangeDetails::isValid() returns <code>false</code> is returned. * * This method requires Channel::FeatureCore to be ready. * * \param contact A Contact object that is on the local pending contacts list. * \return The change info as a GroupMemberChangeDetails object. */ Channel::GroupMemberChangeDetails Channel::groupLocalPendingContactChangeInfo( const ContactPtr &contact) const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupLocalPendingContactChangeInfo() used channel not ready"; } else if (!interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { warning() << "Channel::groupLocalPendingContactChangeInfo() used with no group interface"; } else if (!contact) { warning() << "Channel::groupLocalPendingContactChangeInfo() used with null contact param"; return GroupMemberChangeDetails(); } uint handle = contact->handle()[0]; return mPriv->groupLocalPendingContactsChangeInfo.value(handle); } /** * Return information on the removal of the local user from the group. If * the user hasn't been removed from the group, an object for which * GroupMemberChangeDetails::isValid() returns <code>false</code> is returned. * * This method should be called only after you've left the channel. * This is useful for getting the remove information after missing the * corresponding groupMembersChanged() signal, as the local user being * removed usually causes the channel to be closed. * * The returned information is not guaranteed to be correct if * groupIsSelfHandleTracked() returns false and a self handle change has * occurred on the remote object. * * This method requires Channel::FeatureCore to be ready. * * \return The remove info as a GroupMemberChangeDetails object. */ Channel::GroupMemberChangeDetails Channel::groupSelfContactRemoveInfo() const { // Oftentimes, the channel will be closed as a result from being left - so checking a channel's // self remove info when it has been closed and hence invalidated is valid if (isValid() && !isReady(Channel::FeatureCore)) { warning() << "Channel::groupSelfContactRemoveInfo() used before Channel::FeatureCore is ready"; } else if (!interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { warning() << "Channel::groupSelfContactRemoveInfo() used with " "no group interface"; } return mPriv->groupSelfContactRemoveInfo; } /** * Return whether globally valid handles can be looked up using the * channel-specific handle on this channel using this object. * * Handle owner lookup is only available if: * <ul> * <li>The object is ready * <li>The list returned by interfaces() contains #TP_QT4_IFACE_CHANNEL_INTERFACE_GROUP</li> * <li>The set of flags returned by groupFlags() contains * #GroupFlagProperties and #GroupFlagChannelSpecificHandles</li> * </ul> * * If this function returns \c false, the return value of * groupHandleOwners() is undefined and groupHandleOwnersChanged() will * never be emitted. * * The value returned by this function will stay fixed for the entire time * the object is ready, so no change notification is provided. * * This method requires Channel::FeatureCore to be ready. * * \return \c true if handle owner lookup functionality is available, \c false otherwise. */ bool Channel::groupAreHandleOwnersAvailable() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupAreHandleOwnersAvailable() used channel not ready"; } else if (!interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { warning() << "Channel::groupAreHandleOwnersAvailable() used with " "no group interface"; } return mPriv->groupAreHandleOwnersAvailable; } /** * Return a mapping of handles specific to this channel to globally valid * handles. * * The mapping includes at least all of the channel-specific handles in this * channel's members, local-pending and remote-pending sets as keys. Any * handle not in the keys of this mapping is not channel-specific in this * channel. Handles which are channel-specific, but for which the owner is * unknown, appear in this mapping with 0 as owner. * * Change notification is via the groupHandleOwnersChanged() signal. * * This method requires Channel::FeatureCore to be ready. * * \return A mapping from group-specific handles to globally valid handles. */ HandleOwnerMap Channel::groupHandleOwners() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupHandleOwners() used channel not ready"; } else if (!interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { warning() << "Channel::groupAreHandleOwnersAvailable() used with no " "group interface"; } else if (!groupAreHandleOwnersAvailable()) { warning() << "Channel::groupAreHandleOwnersAvailable() used, but handle " "owners not available"; } return mPriv->groupHandleOwners; } /** * Return whether the value returned by groupSelfContact() is guaranteed to * accurately represent the local user even after nickname changes, etc. * * This should always be \c true for new services implementing the group interface. * * Older services not providing group properties don't necessarily * emit the SelfHandleChanged signal either, so self contact changes can't be * reliably tracked. * * This method requires Channel::FeatureCore to be ready. * * \return \c true if changes to the self contact are tracked, \c false otherwise. */ bool Channel::groupIsSelfContactTracked() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupIsSelfHandleTracked() used channel not ready"; } else if (!interfaces().contains(QLatin1String(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP))) { warning() << "Channel::groupIsSelfHandleTracked() used with " "no group interface"; } return mPriv->groupIsSelfHandleTracked; } /** * Return a Contact object representing the user in the group if at all possible, otherwise a * Contact object representing the user globally. * * Change notification is via the groupSelfContactChanged() signal. * * This method requires Channel::FeatureCore to be ready. * * \return A pointer to the Contact object. */ ContactPtr Channel::groupSelfContact() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupSelfContact() used channel not ready"; } return mPriv->groupSelfContact; } /** * Return whether the local user is in the "local pending" state. This * indicates that the local user needs to take action to accept an invitation, * an incoming call, etc. * * This method requires Channel::FeatureCore to be ready. * * \return \c true if local user is in the channel's local-pending set, \c false otherwise. */ bool Channel::groupSelfHandleIsLocalPending() const { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupSelfHandleIsLocalPending() used when " "channel not ready"; return false; } return mPriv->groupLocalPendingContacts.contains(mPriv->groupSelfHandle); } /** * Attempt to add the local user to this channel. In some channel types, * such as Text and StreamedMedia, this is used to accept an invitation or an * incoming call. * * This method requires Channel::FeatureCore to be ready. * * \return A PendingOperation which will emit PendingOperation::finished * when the call has finished. */ PendingOperation *Channel::groupAddSelfHandle() { if (!isReady(Channel::FeatureCore)) { warning() << "Channel::groupAddSelfHandle() used when channel not " "ready"; return new PendingFailure(QLatin1String(TELEPATHY_ERROR_INVALID_ARGUMENT), QLatin1String("Channel object not ready"), ChannelPtr(this)); } UIntList handles; if (mPriv->groupSelfHandle == 0) { handles << mPriv->connection->selfHandle(); } else { handles << mPriv->groupSelfHandle; } return new PendingVoid( mPriv->group->AddMembers(handles, QLatin1String("")), ChannelPtr(this)); } //@} /** * Return whether this channel implements the conference interface * (#TP_QT4_IFACE_CHANNEL_INTERFACE_CONFERENCE is in the list returned by interfaces()). * * This method requires Channel::FeatureCore to be ready. * * \return \c true if the conference interface is supported, \c false otherwise. */ bool Channel::isConference() const { return hasInterface(TP_QT4_IFACE_CHANNEL_INTERFACE_CONFERENCE); } /** * Return a list of contacts invited to this conference when it was created. * * This method requires Channel::FeatureConferenceInitialInviteeContacts to be ready. * * \return A set of pointers to the Contact objects. */ Contacts Channel::conferenceInitialInviteeContacts() const { return mPriv->conferenceInitialInviteeContacts; } /** * Return the individual channels that are part of this conference. * * Change notification is via the conferenceChannelMerged() and * conferenceChannelRemoved() signals. * * Note that the returned channels are not guaranteed to be ready. Calling * Channel::becomeReady() may be needed. * * This method requires Channel::FeatureCore to be ready. * * \return A list of pointers to Channel objects containing all channels in the conference. * \sa conferenceInitialChannels(), conferenceOriginalChannels() */ QList<ChannelPtr> Channel::conferenceChannels() const { return mPriv->conferenceChannels.values(); } /** * Return the initial value of conferenceChannels(). * * Note that the returned channels are not guaranteed to be ready. Calling * Channel::becomeReady() may be needed. * * This method requires Channel::FeatureCore to be ready. * * \return A list of pointers to Channel objects containing all channels that were initially * part of the conference. * \sa conferenceChannels(), conferenceOriginalChannels() */ QList<ChannelPtr> Channel::conferenceInitialChannels() const { return mPriv->conferenceInitialChannels.values(); } /** * Return a map between channel specific handles and the corresponding channels of this conference. * * This method is only relevant on GSM conference calls where it is possible to have the same phone * number in a conference twice; for instance, it could be the number of a corporate switchboard. * This is represented using channel-specific handles; whether or not a channel uses * channel-specific handles is reported in groupFlags(). The groupHandleOwners() specifies the * mapping from opaque channel-specific handles to actual numbers; this property specifies the * original 1-1 channel corresponding to each channel-specific handle in the conference. * * In protocols where this situation cannot arise, such as XMPP, this method will return an empty * hash. * * Example, consider this situation: * 1. Place a call (with path /call/to/simon) to the contact +441234567890 (which is assigned the * handle h, say), and ask to be put through to Simon McVittie; * 2. Put that call on hold; * 3. Place another call (with path /call/to/jonny) to +441234567890, and ask to be put through to * Jonny Lamb; * 4. Request a new conference channel with initial channels: ['/call/to/simon', '/call/to/jonny']. * * The new channel will have the following properties, for some handles s and j: * * { * groupFlags(): ChannelGroupFlagChannelSpecificHandles | (other flags), * groupMembers(): [self handle, s, j], * groupHandleOwners(): { s: h, j: h }, * conferenceInitialChannels(): ['/call/to/simon', '/call/to/jonny'], * conferenceChannels(): ['/call/to/simon', '/call/to/jonny'], * conferenceOriginalChannels(): { s: '/call/to/simon', j: '/call/to/jonny' }, * # ... * } * * Note that the returned channels are not guaranteed to be ready. Calling * Channel::becomeReady() may be needed. * * This method requires Channel::FeatureCore to be ready. * * \return A map of channel specific handles to pointers to Channel objects. * \sa conferenceChannels(), conferenceInitialChannels() */ QHash<uint, ChannelPtr> Channel::conferenceOriginalChannels() const { return mPriv->conferenceOriginalChannels; } /** * Return whether this channel supports conference merging using conferenceMergeChannel(). * * This method requires Channel::FeatureCore to be ready. * * \return \c true if the interface is supported, \c false otherwise. * \sa conferenceMergeChannel() */ bool Channel::supportsConferenceMerging() const { return interfaces().contains(QLatin1String( TP_FUTURE_INTERFACE_CHANNEL_INTERFACE_MERGEABLE_CONFERENCE)); } /** * Request that the given channel be incorporated into this channel. * * This method requires Channel::FeatureCore to be ready. * * \return A PendingOperation which will emit PendingOperation::finished * when the call has finished. * \sa supportsConferenceMerging() */ PendingOperation *Channel::conferenceMergeChannel(const ChannelPtr &channel) { if (!supportsConferenceMerging()) { return new PendingFailure(QLatin1String(TELEPATHY_ERROR_NOT_IMPLEMENTED), QLatin1String("Channel does not support MergeableConference interface"), ChannelPtr(this)); } return new PendingVoid(mPriv->mergeableConferenceInterface()->Merge( QDBusObjectPath(channel->objectPath())), ChannelPtr(this)); } /** * Return whether this channel supports splitting using conferenceSplitChannel(). * * This method requires Channel::FeatureCore to be ready. * * \return \c true if the interface is supported, \c false otherwise. * \sa conferenceSplitChannel() */ bool Channel::supportsConferenceSplitting() const { return interfaces().contains(QLatin1String( TP_FUTURE_INTERFACE_CHANNEL_INTERFACE_SPLITTABLE)); } /** * Request that this channel is removed from any conference of which it is * a part. * * This method requires Channel::FeatureCore to be ready. * * \return A PendingOperation which will emit PendingOperation::finished * when the call has finished. * \sa supportsConferenceSplitting() */ PendingOperation *Channel::conferenceSplitChannel() { if (!supportsConferenceSplitting()) { return new PendingFailure(QLatin1String(TELEPATHY_ERROR_NOT_IMPLEMENTED), QLatin1String("Channel does not support Splittable interface"), ChannelPtr(this)); } return new PendingVoid(mPriv->splittableInterface()->Split(), ChannelPtr(this)); } /** * Return the Client::ChannelInterface interface proxy object for this channel. * This method is protected since the convenience methods provided by this * class should generally be used instead of calling D-Bus methods * directly. * * \return A pointer to the existing Client::ChannelInterface object for this * Channel object. */ Client::ChannelInterface *Channel::baseInterface() const { return mPriv->baseInterface; } void Channel::gotMainProperties(QDBusPendingCallWatcher *watcher) { QDBusPendingReply<QVariantMap> reply = *watcher; QVariantMap props; if (!reply.isError()) { debug() << "Got reply to Properties::GetAll(Channel)"; props = reply.value(); } else { warning().nospace() << "Properties::GetAll(Channel) failed with " << reply.error().name() << ": " << reply.error().message(); } mPriv->extractMainProps(props); mPriv->continueIntrospection(); } void Channel::gotChannelType(QDBusPendingCallWatcher *watcher) { QDBusPendingReply<QString> reply = *watcher; if (reply.isError()) { warning().nospace() << "Channel::GetChannelType() failed with " << reply.error().name() << ": " << reply.error().message() << ", Channel officially dead"; invalidate(reply.error()); return; } debug() << "Got reply to fallback Channel::GetChannelType()"; mPriv->channelType = reply.value(); mPriv->continueIntrospection(); } void Channel::gotHandle(QDBusPendingCallWatcher *watcher) { QDBusPendingReply<uint, uint> reply = *watcher; if (reply.isError()) { warning().nospace() << "Channel::GetHandle() failed with " << reply.error().name() << ": " << reply.error().message() << ", Channel officially dead"; invalidate(reply.error()); return; } debug() << "Got reply to fallback Channel::GetHandle()"; mPriv->targetHandleType = reply.argumentAt<0>(); mPriv->targetHandle = reply.argumentAt<1>(); mPriv->continueIntrospection(); } void Channel::gotInterfaces(QDBusPendingCallWatcher *watcher) { QDBusPendingReply<QStringList> reply = *watcher; if (reply.isError()) { warning().nospace() << "Channel::GetInterfaces() failed with " << reply.error().name() << ": " << reply.error().message() << ", Channel officially dead"; invalidate(reply.error()); return; } debug() << "Got reply to fallback Channel::GetInterfaces()"; setInterfaces(reply.value()); mPriv->readinessHelper->setInterfaces(interfaces()); mPriv->nowHaveInterfaces(); mPriv->fakeGroupInterfaceIfNeeded(); mPriv->continueIntrospection(); } void Channel::onClosed() { debug() << "Got Channel::Closed"; QString error; QString message; if (mPriv->groupSelfContactRemoveInfo.isValid() && mPriv->groupSelfContactRemoveInfo.hasReason()) { error = mPriv->groupMemberChangeDetailsTelepathyError( mPriv->groupSelfContactRemoveInfo); message = mPriv->groupSelfContactRemoveInfo.message(); } else { error = TP_QT4_ERROR_CANCELLED; message = QLatin1String("channel closed"); } invalidate(error, message); } void Channel::onConnectionReady(PendingOperation *op) { if (op->isError()) { invalidate(op->errorName(), op->errorMessage()); return; } // FIXME: should connect to selfHandleChanged and act accordingly, but that is a PITA for // keeping the Contacts built and even if we don't do it, the new code is better than the // old one anyway because earlier on we just wouldn't have had a self contact. // // besides, the only thing which breaks without connecting in the world likely is if you're // using idle and decide to change your nick, which I don't think we necessarily even have API // to do from tp-qt4 anyway (or did I make idle change the nick when setting your alias? can't // remember) // // Simply put, I just don't care ATM. // Will be overwritten by the group self handle, if we can discover any. Q_ASSERT(!mPriv->groupSelfHandle); mPriv->groupSelfHandle = mPriv->connection->selfHandle(); mPriv->introspectMainProperties(); } void Channel::onConnectionInvalidated() { debug() << "Owning connection died leaving an orphan Channel, " "changing to closed"; invalidate(QLatin1String(TP_QT4_ERROR_ORPHANED), QLatin1String("Connection given as the owner of this channel was invalidated")); } void Channel::gotGroupProperties(QDBusPendingCallWatcher *watcher) { QDBusPendingReply<QVariantMap> reply = *watcher; QVariantMap props; if (!reply.isError()) { debug() << "Got reply to Properties::GetAll(Channel.Interface.Group)"; props = reply.value(); } else { warning().nospace() << "Properties::GetAll(Channel.Interface.Group) " "failed with " << reply.error().name() << ": " << reply.error().message(); } mPriv->extract0176GroupProps(props); // Add extraction (and possible fallbacks) in similar functions, called from here mPriv->continueIntrospection(); } void Channel::gotGroupFlags(QDBusPendingCallWatcher *watcher) { QDBusPendingReply<uint> reply = *watcher; if (reply.isError()) { warning().nospace() << "Channel.Interface.Group::GetGroupFlags() failed with " << reply.error().name() << ": " << reply.error().message(); } else { debug() << "Got reply to fallback Channel.Interface.Group::GetGroupFlags()"; mPriv->setGroupFlags(reply.value()); if (mPriv->groupFlags & ChannelGroupFlagProperties) { warning() << " Reply included ChannelGroupFlagProperties, even " "though properties specified in 0.17.7 didn't work! - unsetting"; mPriv->groupFlags &= ~ChannelGroupFlagProperties; } } mPriv->continueIntrospection(); } void Channel::gotAllMembers(QDBusPendingCallWatcher *watcher) { QDBusPendingReply<UIntList, UIntList, UIntList> reply = *watcher; if (reply.isError()) { warning().nospace() << "Channel.Interface.Group::GetAllMembers() failed with " << reply.error().name() << ": " << reply.error().message(); } else { debug() << "Got reply to fallback Channel.Interface.Group::GetAllMembers()"; mPriv->groupInitialMembers = reply.argumentAt<0>(); mPriv->groupInitialRP = reply.argumentAt<2>(); foreach (uint handle, reply.argumentAt<1>()) { LocalPendingInfo info = {handle, 0, ChannelGroupChangeReasonNone, QLatin1String("")}; mPriv->groupInitialLP.push_back(info); } } mPriv->continueIntrospection(); } void Channel::gotLocalPendingMembersWithInfo(QDBusPendingCallWatcher *watcher) { QDBusPendingReply<LocalPendingInfoList> reply = *watcher; if (reply.isError()) { warning().nospace() << "Channel.Interface.Group::GetLocalPendingMembersWithInfo() " "failed with " << reply.error().name() << ": " << reply.error().message(); warning() << " Falling back to what GetAllMembers returned with no extended info"; } else { debug() << "Got reply to fallback " "Channel.Interface.Group::GetLocalPendingMembersWithInfo()"; // Overrides the previous vague list provided by gotAllMembers mPriv->groupInitialLP = reply.value(); } mPriv->continueIntrospection(); } void Channel::gotSelfHandle(QDBusPendingCallWatcher *watcher) { QDBusPendingReply<uint> reply = *watcher; if (reply.isError()) { warning().nospace() << "Channel.Interface.Group::GetSelfHandle() failed with " << reply.error().name() << ": " << reply.error().message(); } else { debug() << "Got reply to fallback Channel.Interface.Group::GetSelfHandle()"; // Don't overwrite the self handle we got from the connection with 0 if (reply.value()) { mPriv->groupSelfHandle = reply.value(); } } mPriv->nowHaveInitialMembers(); mPriv->continueIntrospection(); } void Channel::gotContacts(PendingOperation *op) { PendingContacts *pending = qobject_cast<PendingContacts *>(op); mPriv->buildingContacts = false; QList<ContactPtr> contacts; if (pending->isValid()) { contacts = pending->contacts(); if (!pending->invalidHandles().isEmpty()) { warning() << "Unable to construct Contact objects for handles:" << pending->invalidHandles(); if (mPriv->groupSelfHandle && pending->invalidHandles().contains(mPriv->groupSelfHandle)) { warning() << "Unable to retrieve self contact"; mPriv->groupSelfContact.reset(); emit groupSelfContactChanged(); } } } else { warning().nospace() << "Getting contacts failed with " << pending->errorName() << ":" << pending->errorMessage(); } mPriv->updateContacts(contacts); } void Channel::onGroupFlagsChanged(uint added, uint removed) { debug().nospace() << "Got Channel.Interface.Group::GroupFlagsChanged(" << hex << added << ", " << removed << ")"; added &= ~(mPriv->groupFlags); removed &= mPriv->groupFlags; debug().nospace() << "Arguments after filtering (" << hex << added << ", " << removed << ")"; uint groupFlags = mPriv->groupFlags; groupFlags |= added; groupFlags &= ~removed; // just emit groupFlagsChanged and related signals if the flags really // changed and we are ready if (mPriv->setGroupFlags(groupFlags) && isReady(Channel::FeatureCore)) { debug() << "Emitting groupFlagsChanged with" << mPriv->groupFlags << "value" << added << "added" << removed << "removed"; emit groupFlagsChanged((ChannelGroupFlags) mPriv->groupFlags, (ChannelGroupFlags) added, (ChannelGroupFlags) removed); if (added & ChannelGroupFlagCanAdd || removed & ChannelGroupFlagCanAdd) { debug() << "Emitting groupCanAddContactsChanged"; emit groupCanAddContactsChanged(groupCanAddContacts()); } if (added & ChannelGroupFlagCanRemove || removed & ChannelGroupFlagCanRemove) { debug() << "Emitting groupCanRemoveContactsChanged"; emit groupCanRemoveContactsChanged(groupCanRemoveContacts()); } if (added & ChannelGroupFlagCanRescind || removed & ChannelGroupFlagCanRescind) { debug() << "Emitting groupCanRescindContactsChanged"; emit groupCanRescindContactsChanged(groupCanRescindContacts()); } } } void Channel::onMembersChanged(const QString &message, const UIntList &added, const UIntList &removed, const UIntList &localPending, const UIntList &remotePending, uint actor, uint reason) { // Ignore the signal if we're using the MCD signal to not duplicate events if (mPriv->usingMembersChangedDetailed) { return; } debug() << "Got Channel.Interface.Group::MembersChanged with" << added.size() << "added," << removed.size() << "removed," << localPending.size() << "moved to LP," << remotePending.size() << "moved to RP," << actor << "being the actor," << reason << "the reason and" << message << "the message"; debug() << " synthesizing a corresponding MembersChangedDetailed signal"; QVariantMap details; if (!message.isEmpty()) { details.insert(QLatin1String("message"), message); } if (actor != 0) { details.insert(QLatin1String("actor"), actor); } details.insert(QLatin1String("change-reason"), reason); mPriv->doMembersChangedDetailed(added, removed, localPending, remotePending, details); } void Channel::onMembersChangedDetailed( const UIntList &added, const UIntList &removed, const UIntList &localPending, const UIntList &remotePending, const QVariantMap &details) { // Ignore the signal if we aren't (yet) using MCD to not duplicate events if (!mPriv->usingMembersChangedDetailed) { return; } debug() << "Got Channel.Interface.Group::MembersChangedDetailed with" << added.size() << "added," << removed.size() << "removed," << localPending.size() << "moved to LP," << remotePending.size() << "moved to RP and with" << details.size() << "details"; mPriv->doMembersChangedDetailed(added, removed, localPending, remotePending, details); } void Channel::Private::doMembersChangedDetailed( const UIntList &added, const UIntList &removed, const UIntList &localPending, const UIntList &remotePending, const QVariantMap &details) { if (!groupHaveMembers) { debug() << "Still waiting for initial group members, " "so ignoring delta signal..."; return; } if (added.isEmpty() && removed.isEmpty() && localPending.isEmpty() && remotePending.isEmpty()) { debug() << "Nothing really changed, so skipping membersChanged"; return; } // let's store groupSelfContactRemoveInfo here as we may not have time // to build the contacts in case self contact is removed, // as Closed will be emitted right after if (removed.contains(groupSelfHandle)) { if (qdbus_cast<uint>(details.value(QLatin1String("change-reason"))) == ChannelGroupChangeReasonRenamed) { if (removed.size() != 1 || (added.size() + localPending.size() + remotePending.size()) != 1) { // spec-incompliant CM, ignoring members changed warning() << "Received MembersChangedDetailed with reason " "Renamed and removed.size != 1 or added.size + " "localPending.size + remotePending.size != 1. Ignoring"; return; } uint newHandle = 0; if (!added.isEmpty()) { newHandle = added.first(); } else if (!localPending.isEmpty()) { newHandle = localPending.first(); } else if (!remotePending.isEmpty()) { newHandle = remotePending.first(); } parent->onSelfHandleChanged(newHandle); return; } // let's try to get the actor contact from contact manager if available groupSelfContactRemoveInfo = GroupMemberChangeDetails( connection->contactManager()->lookupContactByHandle( qdbus_cast<uint>(details.value(QLatin1String("actor")))), details); } HandleIdentifierMap contactIds = qdbus_cast<HandleIdentifierMap>( details.value(GroupMembersChangedInfo::keyContactIds)); connection->lowlevel()->injectContactIds(contactIds); groupMembersChangedQueue.enqueue( new Private::GroupMembersChangedInfo( added, removed, localPending, remotePending, details)); if (!buildingContacts) { // if we are building contacts, we should wait it to finish so we don't // present the user with wrong information processMembersChanged(); } } void Channel::onHandleOwnersChanged(const HandleOwnerMap &added, const UIntList &removed) { debug() << "Got Channel.Interface.Group::HandleOwnersChanged with" << added.size() << "added," << removed.size() << "removed"; if (!mPriv->groupAreHandleOwnersAvailable) { debug() << "Still waiting for initial handle owners, so ignoring " "delta signal..."; return; } UIntList emitAdded; UIntList emitRemoved; for (HandleOwnerMap::const_iterator i = added.begin(); i != added.end(); ++i) { uint handle = i.key(); uint global = i.value(); if (!mPriv->groupHandleOwners.contains(handle) || mPriv->groupHandleOwners[handle] != global) { debug() << " +++/changed" << handle << "->" << global; mPriv->groupHandleOwners[handle] = global; emitAdded.append(handle); } } foreach (uint handle, removed) { if (mPriv->groupHandleOwners.contains(handle)) { debug() << " ---" << handle; mPriv->groupHandleOwners.remove(handle); emitRemoved.append(handle); } } // just emit groupHandleOwnersChanged if it really changed and // we are ready if ((emitAdded.size() || emitRemoved.size()) && isReady(Channel::FeatureCore)) { debug() << "Emitting groupHandleOwnersChanged with" << emitAdded.size() << "added" << emitRemoved.size() << "removed"; emit groupHandleOwnersChanged(mPriv->groupHandleOwners, emitAdded, emitRemoved); } } void Channel::onSelfHandleChanged(uint selfHandle) { debug().nospace() << "Got Channel.Interface.Group::SelfHandleChanged"; if (selfHandle != mPriv->groupSelfHandle) { mPriv->groupSelfHandle = selfHandle; debug() << " Emitting groupSelfHandleChanged with new self handle" << selfHandle; // FIXME: fix self contact building with no group mPriv->pendingRetrieveGroupSelfContact = true; } } void Channel::gotConferenceProperties(QDBusPendingCallWatcher *watcher) { QDBusPendingReply<QVariantMap> reply = *watcher; QVariantMap props; mPriv->introspectingConference = false; if (!reply.isError()) { debug() << "Got reply to Properties::GetAll(Channel.Interface.Conference)"; props = reply.value(); ConnectionPtr conn = connection(); ChannelFactoryConstPtr chanFactory = conn->channelFactory(); ObjectPathList channels = qdbus_cast<ObjectPathList>(props[QLatin1String("Channels")]); foreach (const QDBusObjectPath &channelPath, channels) { if (mPriv->conferenceChannels.contains(channelPath.path())) { continue; } PendingReady *readyOp = chanFactory->proxy(conn, channelPath.path(), QVariantMap()); ChannelPtr channel(ChannelPtr::qObjectCast(readyOp->proxy())); Q_ASSERT(!channel.isNull()); mPriv->conferenceChannels.insert(channelPath.path(), channel); } ObjectPathList initialChannels = qdbus_cast<ObjectPathList>(props[QLatin1String("InitialChannels")]); foreach (const QDBusObjectPath &channelPath, initialChannels) { if (mPriv->conferenceInitialChannels.contains(channelPath.path())) { continue; } PendingReady *readyOp = chanFactory->proxy(conn, channelPath.path(), QVariantMap()); ChannelPtr channel(ChannelPtr::qObjectCast(readyOp->proxy())); Q_ASSERT(!channel.isNull()); mPriv->conferenceInitialChannels.insert(channelPath.path(), channel); } mPriv->conferenceInitialInviteeHandles = qdbus_cast<UIntList>(props[QLatin1String("InitialInviteeHandles")]); QStringList conferenceInitialInviteeIds = qdbus_cast<QStringList>(props[QLatin1String("InitialInviteeIDs")]); if (mPriv->conferenceInitialInviteeHandles.size() == conferenceInitialInviteeIds.size()) { HandleIdentifierMap contactIds; int i = 0; foreach (uint handle, mPriv->conferenceInitialInviteeHandles) { contactIds.insert(handle, conferenceInitialInviteeIds.at(i++)); } mPriv->connection->lowlevel()->injectContactIds(contactIds); } mPriv->conferenceInvitationMessage = qdbus_cast<QString>(props[QLatin1String("InvitationMessage")]); ChannelOriginatorMap originalChannels = qdbus_cast<ChannelOriginatorMap>( props[QLatin1String("OriginalChannels")]); for (ChannelOriginatorMap::const_iterator i = originalChannels.constBegin(); i != originalChannels.constEnd(); ++i) { PendingReady *readyOp = chanFactory->proxy(conn, i.value().path(), QVariantMap()); ChannelPtr channel(ChannelPtr::qObjectCast(readyOp->proxy())); Q_ASSERT(!channel.isNull()); mPriv->conferenceOriginalChannels.insert(i.key(), channel); } } else { warning().nospace() << "Properties::GetAll(Channel.Interface.Conference) " "failed with " << reply.error().name() << ": " << reply.error().message(); } mPriv->continueIntrospection(); } void Channel::gotConferenceInitialInviteeContacts(PendingOperation *op) { PendingContacts *pending = qobject_cast<PendingContacts *>(op); if (pending->isValid()) { mPriv->conferenceInitialInviteeContacts = pending->contacts().toSet(); } else { warning().nospace() << "Getting conference initial invitee contacts " "failed with " << pending->errorName() << ":" << pending->errorMessage(); } mPriv->readinessHelper->setIntrospectCompleted( FeatureConferenceInitialInviteeContacts, true); } void Channel::onConferenceChannelMerged(const QDBusObjectPath &channelPath, uint channelSpecificHandle, const QVariantMap &properties) { if (mPriv->conferenceChannels.contains(channelPath.path())) { return; } ConnectionPtr conn = connection(); ChannelFactoryConstPtr chanFactory = conn->channelFactory(); PendingReady *readyOp = chanFactory->proxy(conn, channelPath.path(), properties); ChannelPtr channel(ChannelPtr::qObjectCast(readyOp->proxy())); Q_ASSERT(!channel.isNull()); mPriv->conferenceChannels.insert(channelPath.path(), channel); emit conferenceChannelMerged(channel); if (channelSpecificHandle != 0) { mPriv->conferenceOriginalChannels.insert(channelSpecificHandle, channel); } } void Channel::onConferenceChannelMerged(const QDBusObjectPath &channelPath) { onConferenceChannelMerged(channelPath, 0, QVariantMap()); } void Channel::onConferenceChannelRemoved(const QDBusObjectPath &channelPath, const QVariantMap &details) { if (!mPriv->conferenceChannels.contains(channelPath.path())) { return; } HandleIdentifierMap contactIds = qdbus_cast<HandleIdentifierMap>( details.value(Private::GroupMembersChangedInfo::keyContactIds)); mPriv->connection->lowlevel()->injectContactIds(contactIds); mPriv->conferenceChannelRemovedQueue.enqueue( new Private::ConferenceChannelRemovedInfo(channelPath, details)); mPriv->processConferenceChannelRemoved(); } void Channel::onConferenceChannelRemoved(const QDBusObjectPath &channelPath) { onConferenceChannelRemoved(channelPath, QVariantMap()); } void Channel::gotConferenceChannelRemovedActorContact(PendingOperation *op) { ContactPtr actorContact; if (op) { PendingContacts *pc = qobject_cast<PendingContacts *>(op); if (pc->isValid()) { Q_ASSERT(pc->contacts().size() == 1); actorContact = pc->contacts().first(); } else { warning().nospace() << "Getting conference channel removed actor " "failed with " << pc->errorName() << ":" << pc->errorMessage(); } } Private::ConferenceChannelRemovedInfo *info = mPriv->conferenceChannelRemovedQueue.dequeue(); ChannelPtr channel = mPriv->conferenceChannels[info->channelPath.path()]; mPriv->conferenceChannels.remove(info->channelPath.path()); emit conferenceChannelRemoved(channel, GroupMemberChangeDetails(actorContact, info->details)); for (QHash<uint, ChannelPtr>::iterator i = mPriv->conferenceOriginalChannels.begin(); i != mPriv->conferenceOriginalChannels.end();) { if (i.value() == channel) { i = mPriv->conferenceOriginalChannels.erase(i); } else { ++i; } } delete info; mPriv->buildingConferenceChannelRemovedActorContact = false; mPriv->processConferenceChannelRemoved(); } /** * \fn void Channel::groupFlagsChanged(uint flags, uint added, uint removed) * * Emitted when the value of groupFlags() changes. * * \param flags The value which would now be returned by groupFlags(). * \param added Flags added compared to the previous value. * \param removed Flags removed compared to the previous value. */ /** * \fn void Channel::groupCanAddContactsChanged(bool canAddContacts) * * Emitted when the value of groupCanAddContacts() changes. * * \param canAddContacts Whether a contact can be added to this channel. * \sa groupCanAddContacts() */ /** * \fn void Channel::groupCanRemoveContactsChanged(bool canRemoveContacts) * * Emitted when the value of groupCanRemoveContacts() changes. * * \param canRemoveContacts Whether a contact can be removed from this channel. * \sa groupCanRemoveContacts() */ /** * \fn void Channel::groupCanRescindContactsChanged(bool canRescindContacts) * * Emitted when the value of groupCanRescindContacts() changes. * * \param canRescindContacts Whether contact invitations can be rescinded. * \sa groupCanRescindContacts() */ /** * \fn void Channel::groupMembersChanged( * const Tp::Contacts &groupMembersAdded, * const Tp::Contacts &groupLocalPendingMembersAdded, * const Tp::Contacts &groupRemotePendingMembersAdded, * const Tp::Contacts &groupMembersRemoved, * const Channel::GroupMemberChangeDetails &details) * * Emitted when the value returned by groupContacts(), groupLocalPendingContacts() or * groupRemotePendingContacts() changes. * * \param groupMembersAdded The contacts that were added to this channel. * \param groupLocalPendingMembersAdded The local pending contacts that were * added to this channel. * \param groupRemotePendingMembersAdded The remote pending contacts that were * added to this channel. * \param groupMembersRemoved The contacts removed from this channel. * \param details Additional details such as the contact requesting or causing * the change. */ /** * \fn void Channel::groupHandleOwnersChanged(const HandleOwnerMap &owners, * const Tp::UIntList &added, const Tp::UIntList &removed) * * Emitted when the value returned by groupHandleOwners() changes. * * \param owners The value which would now be returned by * groupHandleOwners(). * \param added Handles which have been added to the mapping as keys, or * existing handle keys for which the mapped-to value has changed. * \param removed Handles which have been removed from the mapping. */ /** * \fn void Channel::groupSelfContactChanged() * * Emitted when the value returned by groupSelfContact() changes. */ /** * \fn void Channel::conferenceChannelMerged(const Tp::ChannelPtr &channel) * * Emitted when a new channel is added to the value of conferenceChannels(). * * \param channel The channel that was added to conferenceChannels(). */ /** * \fn void Channel::conferenceChannelRemoved(const Tp::ChannelPtr &channel, * const Tp::Channel::GroupMemberChangeDetails &details) * * Emitted when a new channel is removed from the value of conferenceChannels(). * * \param channel The channel that was removed from conferenceChannels(). * \param details The change details. */ } // Tp
lgpl-2.1
joshua-cogliati-inl/moose
docs/content/framework/systems/UserObjects/SolutionUserObject.md
280
<!-- MOOSE Object Documentation Stub: Remove this when content is added. --> #SolutionUserObject !description /UserObjects/SolutionUserObject !parameters /UserObjects/SolutionUserObject !inputfiles /UserObjects/SolutionUserObject !childobjects /UserObjects/SolutionUserObject
lgpl-2.1
rhajamor/xbig
tests/Ogre3D/include/OGRE/OgreMeshSerializerImpl.h
11258
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2006 Torus Knot Software Ltd Also see acknowledgements in Readme.html This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt. You may alternatively use this source under the terms of a specific version of the OGRE Unrestricted License provided you have obtained such a license from Torus Knot Software Ltd. ----------------------------------------------------------------------------- */ #ifndef __MeshSerializerImpl_H__ #define __MeshSerializerImpl_H__ #include "OgrePrerequisites.h" #include "OgreString.h" #include "OgreSerializer.h" #include "OgreMaterial.h" #include "OgreMesh.h" #include "OgreEdgeListBuilder.h" namespace Ogre { /** Internal implementation of Mesh reading / writing for the latest version of the .mesh format. @remarks In order to maintain compatibility with older versions of the .mesh format, there will be alternative subclasses of this class to load older versions, whilst this class will remain to load the latest version. */ class _OgrePrivate MeshSerializerImpl : public Serializer { public: MeshSerializerImpl(); virtual ~MeshSerializerImpl(); /** Exports a mesh to the file specified. @remarks This method takes an externally created Mesh object, and exports both it and optionally the Materials it uses to a .mesh file. @param pMesh Pointer to the Mesh to export @param filename The destination filename @param endianMode The endian mode for the written file */ void exportMesh(const Mesh* pMesh, const String& filename, Endian endianMode = ENDIAN_NATIVE); /** Imports Mesh and (optionally) Material data from a .mesh file DataStream. @remarks This method imports data from a DataStream opened from a .mesh file and places it's contents into the Mesh object which is passed in. @param stream The DataStream holding the .mesh data. Must be initialised (pos at the start of the buffer). @param pDest Pointer to the Mesh object which will receive the data. Should be blank already. */ void importMesh(DataStreamPtr& stream, Mesh* pDest); protected: // Internal methods virtual void writeSubMeshNameTable(const Mesh* pMesh); virtual void writeMesh(const Mesh* pMesh); virtual void writeSubMesh(const SubMesh* s); virtual void writeSubMeshOperation(const SubMesh* s); virtual void writeSubMeshTextureAliases(const SubMesh* s); virtual void writeGeometry(const VertexData* pGeom); virtual void writeSkeletonLink(const String& skelName); virtual void writeMeshBoneAssignment(const VertexBoneAssignment& assign); virtual void writeSubMeshBoneAssignment(const VertexBoneAssignment& assign); virtual void writeLodInfo(const Mesh* pMesh); virtual void writeLodSummary(unsigned short numLevels, bool manual); virtual void writeLodUsageManual(const MeshLodUsage& usage); virtual void writeLodUsageGenerated(const Mesh* pMesh, const MeshLodUsage& usage, unsigned short lodNum); virtual void writeBoundsInfo(const Mesh* pMesh); virtual void writeEdgeList(const Mesh* pMesh); virtual void writeAnimations(const Mesh* pMesh); virtual void writeAnimation(const Animation* anim); virtual void writePoses(const Mesh* pMesh); virtual void writePose(const Pose* pose); virtual void writeAnimationTrack(const VertexAnimationTrack* track); virtual void writeMorphKeyframe(const VertexMorphKeyFrame* kf, size_t vertexCount); virtual void writePoseKeyframe(const VertexPoseKeyFrame* kf); virtual void writePoseKeyframePoseRef(const VertexPoseKeyFrame::PoseRef& poseRef); virtual void writeExtremes(const Mesh *pMesh); virtual void writeSubMeshExtremes(unsigned short idx, const SubMesh* s); virtual size_t calcMeshSize(const Mesh* pMesh); virtual size_t calcSubMeshSize(const SubMesh* pSub); virtual size_t calcGeometrySize(const VertexData* pGeom); virtual size_t calcSkeletonLinkSize(const String& skelName); virtual size_t calcBoneAssignmentSize(void); virtual size_t calcSubMeshOperationSize(const SubMesh* pSub); virtual size_t calcSubMeshNameTableSize(const Mesh* pMesh); virtual size_t calcEdgeListSize(const Mesh* pMesh); virtual size_t calcEdgeListLodSize(const EdgeData* data, bool isManual); virtual size_t calcEdgeGroupSize(const EdgeData::EdgeGroup& group); virtual size_t calcPosesSize(const Mesh* pMesh); virtual size_t calcPoseSize(const Pose* pose); virtual size_t calcAnimationsSize(const Mesh* pMesh); virtual size_t calcAnimationSize(const Animation* anim); virtual size_t calcAnimationTrackSize(const VertexAnimationTrack* track); virtual size_t calcMorphKeyframeSize(const VertexMorphKeyFrame* kf, size_t vertexCount); virtual size_t calcPoseKeyframeSize(const VertexPoseKeyFrame* kf); virtual size_t calcPoseKeyframePoseRefSize(void); virtual size_t calcPoseVertexSize(void); virtual size_t calcSubMeshTextureAliasesSize(const SubMesh* pSub); virtual void readTextureLayer(DataStreamPtr& stream, Mesh* pMesh, MaterialPtr& pMat); virtual void readSubMeshNameTable(DataStreamPtr& stream, Mesh* pMesh); virtual void readMesh(DataStreamPtr& stream, Mesh* pMesh); virtual void readSubMesh(DataStreamPtr& stream, Mesh* pMesh); virtual void readSubMeshOperation(DataStreamPtr& stream, Mesh* pMesh, SubMesh* sub); virtual void readSubMeshTextureAlias(DataStreamPtr& stream, Mesh* pMesh, SubMesh* sub); virtual void readGeometry(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest); virtual void readGeometryVertexDeclaration(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest); virtual void readGeometryVertexElement(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest); virtual void readGeometryVertexBuffer(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest); virtual void readSkeletonLink(DataStreamPtr& stream, Mesh* pMesh); virtual void readMeshBoneAssignment(DataStreamPtr& stream, Mesh* pMesh); virtual void readSubMeshBoneAssignment(DataStreamPtr& stream, Mesh* pMesh, SubMesh* sub); virtual void readMeshLodInfo(DataStreamPtr& stream, Mesh* pMesh); virtual void readMeshLodUsageManual(DataStreamPtr& stream, Mesh* pMesh, unsigned short lodNum, MeshLodUsage& usage); virtual void readMeshLodUsageGenerated(DataStreamPtr& stream, Mesh* pMesh, unsigned short lodNum, MeshLodUsage& usage); virtual void readBoundsInfo(DataStreamPtr& stream, Mesh* pMesh); virtual void readEdgeList(DataStreamPtr& stream, Mesh* pMesh); virtual void readEdgeListLodInfo(DataStreamPtr& stream, EdgeData* edgeData); virtual void readPoses(DataStreamPtr& stream, Mesh* pMesh); virtual void readPose(DataStreamPtr& stream, Mesh* pMesh); virtual void readAnimations(DataStreamPtr& stream, Mesh* pMesh); virtual void readAnimation(DataStreamPtr& stream, Mesh* pMesh); virtual void readAnimationTrack(DataStreamPtr& stream, Animation* anim, Mesh* pMesh); virtual void readMorphKeyFrame(DataStreamPtr& stream, VertexAnimationTrack* track); virtual void readPoseKeyFrame(DataStreamPtr& stream, VertexAnimationTrack* track); virtual void readExtremes(DataStreamPtr& stream, Mesh *pMesh); /// Flip an entire vertex buffer from little endian virtual void flipFromLittleEndian(void* pData, size_t vertexCount, size_t vertexSize, const VertexDeclaration::VertexElementList& elems); /// Flip an entire vertex buffer to little endian virtual void flipToLittleEndian(void* pData, size_t vertexCount, size_t vertexSize, const VertexDeclaration::VertexElementList& elems); /// Flip the endianness of an entire vertex buffer, passed in as a /// pointer to locked or temporary memory virtual void flipEndian(void* pData, size_t vertexCount, size_t vertexSize, const VertexDeclaration::VertexElementList& elems); }; /** Class for providing backwards-compatibility for loading version 1.3 of the .mesh format. */ class _OgrePrivate MeshSerializerImpl_v1_3 : public MeshSerializerImpl { public: MeshSerializerImpl_v1_3(); ~MeshSerializerImpl_v1_3(); protected: virtual void readEdgeListLodInfo(DataStreamPtr& stream, EdgeData* edgeData); /// Reorganise triangles of the edge list to group by vertex set virtual void reorganiseTriangles(EdgeData* edgeData); }; /** Class for providing backwards-compatibility for loading version 1.2 of the .mesh format. */ class _OgrePrivate MeshSerializerImpl_v1_2 : public MeshSerializerImpl_v1_3 { public: MeshSerializerImpl_v1_2(); ~MeshSerializerImpl_v1_2(); protected: virtual void readMesh(DataStreamPtr& stream, Mesh* pMesh); virtual void readGeometry(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest); virtual void readGeometryPositions(unsigned short bindIdx, DataStreamPtr& stream, Mesh* pMesh, VertexData* dest); virtual void readGeometryNormals(unsigned short bindIdx, DataStreamPtr& stream, Mesh* pMesh, VertexData* dest); virtual void readGeometryColours(unsigned short bindIdx, DataStreamPtr& stream, Mesh* pMesh, VertexData* dest); virtual void readGeometryTexCoords(unsigned short bindIdx, DataStreamPtr& stream, Mesh* pMesh, VertexData* dest, unsigned short set); }; /** Class for providing backwards-compatibility for loading version 1.1 of the .mesh format. */ class _OgrePrivate MeshSerializerImpl_v1_1 : public MeshSerializerImpl_v1_2 { public: MeshSerializerImpl_v1_1(); ~MeshSerializerImpl_v1_1(); protected: void readGeometryTexCoords(unsigned short bindIdx, DataStreamPtr& stream, Mesh* pMesh, VertexData* dest, unsigned short set); }; } #endif
lgpl-2.1
gguuss/Arduino
cores/esp8266/uart.c
13384
/* uart.cpp - esp8266 UART HAL Copyright (c) 2014 Ivan Grokhotkov. All rights reserved. This file is part of the esp8266 core for Arduino environment. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** * UART GPIOs * * UART0 TX: 1 or 2 * UART0 RX: 3 * * UART0 SWAP TX: 15 * UART0 SWAP RX: 13 * * * UART1 TX: 7 (NC) or 2 * UART1 RX: 8 (NC) * * UART1 SWAP TX: 11 (NC) * UART1 SWAP RX: 6 (NC) * * NC = Not Connected to Module Pads --> No Access * */ #include "Arduino.h" #include "uart.h" #include "esp8266_peri.h" #include "user_interface.h" static int s_uart_debug_nr = UART0; struct uart_rx_buffer_ { size_t size; size_t rpos; size_t wpos; uint8_t * buffer; }; struct uart_ { int uart_nr; int baud_rate; bool rx_enabled; bool tx_enabled; uint8_t rx_pin; uint8_t tx_pin; struct uart_rx_buffer_ * rx_buffer; }; size_t uart_resize_rx_buffer(uart_t* uart, size_t new_size) { if(uart == NULL || !uart->rx_enabled) { return 0; } if(uart->rx_buffer->size == new_size) { return uart->rx_buffer->size; } uint8_t * new_buf = (uint8_t*)malloc(new_size); if(!new_buf) { return uart->rx_buffer->size; } size_t new_wpos = 0; ETS_UART_INTR_DISABLE(); while(uart_rx_available(uart) && new_wpos < new_size) { new_buf[new_wpos++] = uart_read_char(uart); } uint8_t * old_buf = uart->rx_buffer->buffer; uart->rx_buffer->rpos = 0; uart->rx_buffer->wpos = new_wpos; uart->rx_buffer->size = new_size; uart->rx_buffer->buffer = new_buf; free(old_buf); ETS_UART_INTR_ENABLE(); return uart->rx_buffer->size; } int uart_peek_char(uart_t* uart) { if(uart == NULL || !uart->rx_enabled) { return -1; } if (!uart_rx_available(uart)) { return -1; } return uart->rx_buffer->buffer[uart->rx_buffer->rpos]; } int uart_read_char(uart_t* uart) { int data = uart_peek_char(uart); if(data != -1) { uart->rx_buffer->rpos = (uart->rx_buffer->rpos + 1) % uart->rx_buffer->size; } return data; } size_t uart_rx_available(uart_t* uart) { if(uart == NULL || !uart->rx_enabled) { return 0; } if(uart->rx_buffer->wpos < uart->rx_buffer->rpos) { return (uart->rx_buffer->wpos + uart->rx_buffer->size) - uart->rx_buffer->rpos; } return uart->rx_buffer->wpos - uart->rx_buffer->rpos; } void ICACHE_RAM_ATTR uart_isr(void * arg) { uart_t* uart = (uart_t*)arg; if(uart == NULL || !uart->rx_enabled) { USIC(uart->uart_nr) = 0xffff; ETS_UART_INTR_DISABLE(); return; } uint32_t int_status = USIS(uart->uart_nr); if(int_status & (1 << UIFR)) { USIC(uart->uart_nr) = (1 << UIFR);//clear any frame error } if(int_status & (1 << UIFF) || int_status & (1 << UITO)){ ETS_UART_INTR_DISABLE(); while(((USS(uart->uart_nr) >> USRXC) & 0x7F) != 0){ uint8_t data = USF(uart->uart_nr); size_t nextPos = (uart->rx_buffer->wpos + 1) % uart->rx_buffer->size; if(nextPos != uart->rx_buffer->rpos) { uart->rx_buffer->buffer[uart->rx_buffer->wpos] = data; uart->rx_buffer->wpos = nextPos; } else { //rx buffer OverFlow //maybe stop the loop and try later? } } int_status = USIS(uart->uart_nr); if(int_status & (1 << UIFF)) { USIC(uart->uart_nr) = (1 << UIFF);//clear any FIFO FULL error } if(int_status & (1 << UITO)) { USIC(uart->uart_nr) = (1 << UITO);//clear any TimeOut error } ETS_UART_INTR_ENABLE(); } } void uart_start_isr(uart_t* uart) { if(uart == NULL || !uart->rx_enabled) { return; } USC1(uart->uart_nr) = (127 << UCFFT) | (0x02 << UCTOT) | (1 <<UCTOE ); USIC(uart->uart_nr) = 0xffff; USIE(uart->uart_nr) = (1 << UIFF) | (1 << UIFR) | (1 << UITO); ETS_UART_INTR_ATTACH(uart_isr, (void *)uart); ETS_UART_INTR_ENABLE(); } void uart_stop_isr(uart_t* uart) { if(uart == NULL || !uart->rx_enabled) { return; } ETS_UART_INTR_DISABLE(); USC1(uart->uart_nr) = 0; USIC(uart->uart_nr) = 0xffff; USIE(uart->uart_nr) = 0; ETS_UART_INTR_ATTACH(NULL, NULL); } void uart_write_char(uart_t* uart, char c) { if(uart == NULL || !uart->tx_enabled) { return; } while((USS(uart->uart_nr) >> USTXC) >= 0x7f); USF(uart->uart_nr) = c; } void uart_write(uart_t* uart, const char* buf, size_t size) { if(uart == NULL || !uart->tx_enabled) { return; } while(size--) { uart_write_char(uart, *buf++); } } size_t uart_tx_free(uart_t* uart) { if(uart == NULL || !uart->tx_enabled) { return 0; } return UART_TX_FIFO_SIZE - ((USS(uart->uart_nr) >> USTXC) & 0xff); } void uart_wait_tx_empty(uart_t* uart) { if(uart == NULL || !uart->tx_enabled) { return; } while(((USS(uart->uart_nr) >> USTXC) & 0xff) > 0) { delay(0); } } void uart_flush(uart_t* uart) { if(uart == NULL) { return; } uint32_t tmp = 0x00000000; if(uart->rx_enabled) { tmp |= (1 << UCRXRST); ETS_UART_INTR_DISABLE(); uart->rx_buffer->rpos = 0; uart->rx_buffer->wpos = 0; ETS_UART_INTR_ENABLE(); } if(uart->tx_enabled) { tmp |= (1 << UCTXRST); } USC0(uart->uart_nr) |= (tmp); USC0(uart->uart_nr) &= ~(tmp); } void uart_set_baudrate(uart_t* uart, int baud_rate) { if(uart == NULL) { return; } uart->baud_rate = baud_rate; USD(uart->uart_nr) = (ESP8266_CLOCK / uart->baud_rate); } int uart_get_baudrate(uart_t* uart) { if(uart == NULL) { return 0; } return uart->baud_rate; } uart_t* uart_init(int uart_nr, int baudrate, int config, int mode, int tx_pin, size_t rx_size) { uart_t* uart = (uart_t*) malloc(sizeof(uart_t)); if(uart == NULL) { return NULL; } uart->uart_nr = uart_nr; switch(uart->uart_nr) { case UART0: ETS_UART_INTR_DISABLE(); ETS_UART_INTR_ATTACH(NULL, NULL); uart->rx_enabled = (mode != UART_TX_ONLY); uart->tx_enabled = (mode != UART_RX_ONLY); uart->rx_pin = (uart->rx_enabled)?3:255; if(uart->rx_enabled) { struct uart_rx_buffer_ * rx_buffer = (struct uart_rx_buffer_ *)malloc(sizeof(struct uart_rx_buffer_)); if(rx_buffer == NULL) { free(uart); return NULL; } rx_buffer->size = rx_size;//var this rx_buffer->rpos = 0; rx_buffer->wpos = 0; rx_buffer->buffer = (uint8_t *)malloc(rx_buffer->size); if(rx_buffer->buffer == NULL) { free(rx_buffer); free(uart); return NULL; } uart->rx_buffer = rx_buffer; pinMode(uart->rx_pin, SPECIAL); } if(uart->tx_enabled) { if (tx_pin == 2) { uart->tx_pin = 2; pinMode(uart->tx_pin, FUNCTION_4); } else { uart->tx_pin = 1; pinMode(uart->tx_pin, FUNCTION_0); } } else { uart->tx_pin = 255; } IOSWAP &= ~(1 << IOSWAPU0); break; case UART1: // Note: uart_interrupt_handler does not support RX on UART 1. uart->rx_enabled = false; uart->tx_enabled = (mode != UART_RX_ONLY); uart->rx_pin = 255; uart->tx_pin = (uart->tx_enabled)?2:255; // GPIO7 as TX not possible! See GPIO pins used by UART if(uart->tx_enabled) { pinMode(uart->tx_pin, SPECIAL); } break; case UART_NO: default: // big fail! free(uart); return NULL; } uart_set_baudrate(uart, baudrate); USC0(uart->uart_nr) = config; uart_flush(uart); USC1(uart->uart_nr) = 0; USIC(uart->uart_nr) = 0xffff; USIE(uart->uart_nr) = 0; if(uart->uart_nr == UART0 && uart->rx_enabled) { uart_start_isr(uart); } return uart; } void uart_uninit(uart_t* uart) { if(uart == NULL) { return; } switch(uart->rx_pin) { case 3: pinMode(3, INPUT); break; case 13: pinMode(13, INPUT); break; } switch(uart->tx_pin) { case 1: pinMode(1, INPUT); break; case 2: pinMode(2, INPUT); break; case 15: pinMode(15, INPUT); break; } if(uart->rx_enabled){ free(uart->rx_buffer->buffer); free(uart->rx_buffer); uart_stop_isr(uart); } free(uart); } void uart_swap(uart_t* uart, int tx_pin) { if(uart == NULL) { return; } switch(uart->uart_nr) { case UART0: if(((uart->tx_pin == 1 || uart->tx_pin == 2) && uart->tx_enabled) || (uart->rx_pin == 3 && uart->rx_enabled)) { if(uart->tx_enabled) { //TX pinMode(uart->tx_pin, INPUT); uart->tx_pin = 15; } if(uart->rx_enabled) { //RX pinMode(uart->rx_pin, INPUT); uart->rx_pin = 13; } if(uart->tx_enabled) { pinMode(uart->tx_pin, FUNCTION_4); //TX } if(uart->rx_enabled) { pinMode(uart->rx_pin, FUNCTION_4); //RX } IOSWAP |= (1 << IOSWAPU0); } else { if(uart->tx_enabled) { //TX pinMode(uart->tx_pin, INPUT); uart->tx_pin = (tx_pin == 2)?2:1; } if(uart->rx_enabled) { //RX pinMode(uart->rx_pin, INPUT); uart->rx_pin = 3; } if(uart->tx_enabled) { pinMode(uart->tx_pin, (tx_pin == 2)?FUNCTION_4:SPECIAL); //TX } if(uart->rx_enabled) { pinMode(3, SPECIAL); //RX } IOSWAP &= ~(1 << IOSWAPU0); } break; case UART1: // Currently no swap possible! See GPIO pins used by UART break; default: break; } } void uart_set_tx(uart_t* uart, int tx_pin) { if(uart == NULL) { return; } switch(uart->uart_nr) { case UART0: if(uart->tx_enabled) { if (uart->tx_pin == 1 && tx_pin == 2) { pinMode(uart->tx_pin, INPUT); uart->tx_pin = 2; pinMode(uart->tx_pin, FUNCTION_4); } else if (uart->tx_pin == 2 && tx_pin != 2) { pinMode(uart->tx_pin, INPUT); uart->tx_pin = 1; pinMode(uart->tx_pin, SPECIAL); } } break; case UART1: // GPIO7 as TX not possible! See GPIO pins used by UART break; default: break; } } void uart_set_pins(uart_t* uart, int tx, int rx) { if(uart == NULL) { return; } if(uart->uart_nr == UART0) { // Only UART0 allows pin changes if(uart->tx_enabled && uart->tx_pin != tx) { if( rx == 13 && tx == 15) { uart_swap(uart, 15); } else if (rx == 3 && (tx == 1 || tx == 2)) { if (uart->rx_pin != rx) { uart_swap(uart, tx); } else { uart_set_tx(uart, tx); } } } if(uart->rx_enabled && uart->rx_pin != rx && rx == 13 && tx == 15) { uart_swap(uart, 15); } } } bool uart_tx_enabled(uart_t* uart) { if(uart == NULL) { return false; } return uart->tx_enabled; } bool uart_rx_enabled(uart_t* uart) { if(uart == NULL) { return false; } return uart->rx_enabled; } static void uart_ignore_char(char c) { } static void uart0_write_char(char c) { while(((USS(0) >> USTXC) & 0xff) >= 0x7F) { delay(0); } USF(0) = c; } static void uart1_write_char(char c) { while(((USS(1) >> USTXC) & 0xff) >= 0x7F) { delay(0); } USF(1) = c; } void uart_set_debug(int uart_nr) { s_uart_debug_nr = uart_nr; switch(s_uart_debug_nr) { case UART0: system_set_os_print(1); ets_install_putc1((void *) &uart0_write_char); break; case UART1: system_set_os_print(1); ets_install_putc1((void *) &uart1_write_char); break; case UART_NO: default: system_set_os_print(0); ets_install_putc1((void *) &uart_ignore_char); break; } } int uart_get_debug() { return s_uart_debug_nr; }
lgpl-2.1
keredson/DKO
doc/dkos-the-book/x283.html
1956
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Aggregation Function</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="DKOs - The Book" HREF="index.html"><LINK REL="UP" TITLE="Queries" HREF="c210.html"><LINK REL="PREVIOUS" TITLE="The With Method" HREF="x275.html"><LINK REL="NEXT" TITLE="Terminal vs. Non-terminal Methods" HREF="x287.html"></HEAD ><BODY CLASS="section" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >DKOs - The Book</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="x275.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 4. Queries</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="x287.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="AEN283" >4.5. Aggregation Function</A ></H1 ><P >TODO: STUB</P ><P ></P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="x275.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="x287.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >The With Method</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="c210.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Terminal vs. Non-terminal Methods</TD ></TR ></TABLE ></DIV ></BODY ></HTML >
lgpl-2.1
ScarlettGatelyClark/kde-ci-prototype
docker/ubuntu-wily-slave/Dockerfile
6358
FROM ubuntu:wily MAINTAINER Scarlett Clark <sgclark@kde.org> #Strange changes and deb-src is no longer in base.. RUN echo "deb http://ca.archive.ubuntu.com/ubuntu/ wily main restricted universe multiverse" >> /etc/apt/sources.list RUN echo "deb-src http://ca.archive.ubuntu.com/ubuntu/ wily main restricted universe multiverse" >> /etc/apt/sources.list RUN echo "deb http://ca.archive.ubuntu.com/ubuntu/ wily-updates main restricted universe multiverse" >> /etc/apt/sources.list RUN echo "deb-src http://ca.archive.ubuntu.com/ubuntu/ wily-updates main restricted universe multiverse" >> /etc/apt/sources.list RUN echo "deb http://ca.archive.ubuntu.com/ubuntu/ wily-backports main restricted universe multiverse" >> /etc/apt/sources.list RUN echo "deb-src http://ca.archive.ubuntu.com/ubuntu/ wily-backports main restricted universe multiverse" >> /etc/apt/sources.list # Needed for add-apt-repository. RUN apt-get update && apt-get -y install software-properties-common \ && add-apt-repository -y ppa:ximion/packagekit \ && add-apt-repository -y ppa:mutlaqja/ppa # Needed for building qt5 RUN apt-get update && apt-get upgrade -y && apt-get -y build-dep qtbase5-dev # Dependencies for ALL KDE applications. RUN DEBIAN_FRONTEND=noninteractive apt-get -y --force-yes install \ openssh-server \ ssh \ wget \ openjdk-8-jdk \ git \ openbox \ dbus-x11 \ gnupg2 \ gnupg-agent \ psmisc \ doxygen \ bzr \ cppcheck \ gperf \ bison \ ruby \ flex \ libpolkit-agent-1-dev \ libpolkit-backend-1-dev \ libpolkit-gobject-1-dev \ libxslt1-dev \ docbook-xml \ docbook-xsl \ libgcrypt-dev \ gcovr \ libopenal-dev \ libsndfile1-dev \ libexiv2-dev \ libattr1-dev \ libxapian-dev \ xsltproc \ libgpgme11-dev \ libsasl2-dev \ libdmtx-dev \ libqrencode-dev \ libldap2-dev \ libfakekey-dev \ python3-dev \ libclang-3.5-dev \ libcdparanoia-dev \ clang \ libical-dev \ libxcb-composite0-dev \ libxcb-damage0-dev \ libxcb-dpms0-dev \ libraw-dev \ libxkbfile-dev \ libtag1-dev \ libsamplerate0-dev \ frei0r-plugins-dev \ libeigen3-dev \ libgettextpo-dev \ libaccounts-glib-dev \ libboost1.58-all-dev \ libglew-dev \ libavutil-ffmpeg-dev \ libavcodec-ffmpeg-dev \ libavdevice-ffmpeg-dev \ libavformat-ffmpeg-dev \ libavfilter-ffmpeg-dev \ libpostproc-ffmpeg-dev \ libswscale-ffmpeg-dev \ libswresample-ffmpeg-dev \ libavresample-ffmpeg-dev \ libclucene-dev \ libsane-dev \ libhunspell-dev \ xserver-xorg-input-wacom \ libtelepathy-glib-dev \ libgstreamer1.0-dev \ libfarstream-0.2-5 \ libsvn-dev \ libpci-dev \ cmake \ libacl1-dev \ libgstreamer-plugins-base1.0-dev \ libtelepathy-farstream-dev \ libtelepathy-glib-dev \ intltool \ libeigen2-dev \ libasound2-dev \ build-essential \ frei0r-plugins-dev \ libexif-dev \ libmovit-dev \ libsdl1.2-dev \ libsox-dev \ libxml2-dev \ ladspa-sdk \ virtuoso-opensource \ librdf-storage-virtuoso \ librdf0-dev \ libiodbc2-dev \ libxss-dev \ packagekit \ python-numpy \ libxcb-xtest0-dev \ libspeechd-dev \ libbz2-dev \ libcap-dev \ ruby-dev \ libnss3-dev \ xserver-xorg-input-wacom \ libepoxy-dev \ libarchive-dev \ libcfitsio3-dev \ libindi-dev \ wcslib-dev \ xplanet \ astrometry.net \ mercurial \ libwlocate-dev \ libshp-dev \ libgps-dev \ protobuf-compiler \ libgif-dev \ libgtk-3-dev \ libclang-3.5-dev \ libgsl0-dev \ fontforge \ libblkid-dev \ libatasmart-dev \ libparted-dev \ sip-dev \ libtelepathy-logger-dev \ modemmanager-dev \ libpgf-dev \ libvcdinfo-dev \ libgstreamer0.10-dev \ libxerces-c-dev \ xsdcxx swig3.0 \ mono-gmcs \ libshp-dev \ libevent-pthreads-2.0-5 \ libtool \ gtk-doc-tools \ libgstreamer-plugins-base0.10-dev \ libtelepathy-glib-dev \ libclang-3.6-dev \ llvm \ libgraphviz-dev \ libmtp-dev \ libmusicbrainz3-dev \ libvncserver-dev \ libgpgme++2v5 \ subversion \ libotr5-dev \ python3-numpy \ xserver-xephyr \ xwayland \ weston \ libxcb-cursor-dev \ libspnav-dev \ libxbase64-dev \ libxt-dev \ libgv-python \ libofx-dev \ liblmdb-dev \ sqlite3 \ cucumber \ liblensfun-dev \ libjasper-dev \ mysql-server \ xinput \ texlive-latex-recommended \ libepub-dev \ libxcb-util0-dev \ libpam0g-dev \ appstream \ python-lxml \ liblzma-dev \ libfam-dev \ media-player-info \ swig \ liblmdb-dev \ mercurial \ libgit2-dev \ bzr \ samba-common \ libssh2-1-dev \ libhttp-parser-dev \ postgresql \ libqalculate-dev \ libsystemd-dev \ libopenexr-dev \ libslp-dev \ libtidy-dev \ libncurses5-dev \ libmagick++-dev \ libnm-dev \ libnm-glib-dev \ libnm-gtk-dev \ libnm-glib-vpn-dev \ libnm-util-dev \ network-manager-dev \ libpocketsphinx-dev \ libopencv-core-dev \ libgraphicsmagick++1-dev \ libmagick++-dev \ mobile-broadband-provider-info \ libapt-pkg-dev \ libgphoto2-dev \ unzip \ ragel \ dmz-cursor-theme \ python3.5-dev \ libapt-pkg-dev \ libisocodes-dev \ libsqlcipher-dev \ sqlcipher \ sphinxsearch \ libgraphviz-dev \ libyaml-dev \ xmlto \ gobject-introspection \ mesa-utils \ libgirepository1.0-dev \ libprotobuf-dev \ protobuf-compiler \ libelektra-dev \ libxmu-dev \ dmz-cursor-theme \ libsmbclient-dev \ p7zip RUN mkdir -p /var/run/sshd RUN groupadd -g 1000 jenkins RUN useradd -m -u 1000 -g 1000 -d /home/jenkins jenkins RUN echo 'jenkins:1234' | chpasswd #changeme USER jenkins RUN echo "eval \`dbus-launch --auto-syntax 2>&1\`" > ~/.bashrc RUN mkdir /tmp/xdg-runtime-dir RUN chown jenkins.jenkins /tmp/xdg-runtime-dir USER root RUN sed s,exit\ 101,exit\ 0, /usr/sbin/policy-rc.d -i RUN dpkg-reconfigure openssh-server EXPOSE 22 CMD ["/usr/sbin/sshd", "-D"]
lgpl-2.1
mhl787156/MinecraftAI
libraries/neat-preview/neuroph-core-2.3/javadoc/overview-summary.html
7687
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_02-ea) on Thu Dec 24 00:39:33 CET 2009 --> <TITLE> Overview </TITLE> <META NAME="date" CONTENT="2009-12-24"> <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Overview"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Overview</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="index.html?overview-summary.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="overview-summary.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Packages</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="20%"><B><A HREF="org/neuroph/contrib/package-summary.html">org.neuroph.contrib</A></B></TD> <TD>Provides various contributions from the Neuroph community.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="20%"><B><A HREF="org/neuroph/contrib/imgrec/package-summary.html">org.neuroph.contrib.imgrec</A></B></TD> <TD>Provides classes for image recognition with neural networks.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="20%"><B><A HREF="org/neuroph/core/package-summary.html">org.neuroph.core</A></B></TD> <TD>Provides base classes and basic building components for neural networks.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="20%"><B><A HREF="org/neuroph/core/input/package-summary.html">org.neuroph.core.input</A></B></TD> <TD>Provides common neuron input functions</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="20%"><B><A HREF="org/neuroph/core/learning/package-summary.html">org.neuroph.core.learning</A></B></TD> <TD>Provides base classes for neural network learning algorithms.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="20%"><B><A HREF="org/neuroph/core/transfer/package-summary.html">org.neuroph.core.transfer</A></B></TD> <TD>Provides common neuron transfer functions</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="20%"><B><A HREF="org/neuroph/nnet/package-summary.html">org.neuroph.nnet</A></B></TD> <TD>Provides out-of-the-box neural networks</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="20%"><B><A HREF="org/neuroph/nnet/comp/package-summary.html">org.neuroph.nnet.comp</A></B></TD> <TD>Provides components for the specific neural network models.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="20%"><B><A HREF="org/neuroph/nnet/learning/package-summary.html">org.neuroph.nnet.learning</A></B></TD> <TD>Provides implementations of specific neural network learning algorithms.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="20%"><B><A HREF="org/neuroph/samples/package-summary.html">org.neuroph.samples</A></B></TD> <TD>Provides some basic examples of how to use Neuroph.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="20%"><B><A HREF="org/neuroph/util/package-summary.html">org.neuroph.util</A></B></TD> <TD>Provides various utility classes for creating neural networks, type codes, parsing vectors, etc.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="20%"><B><A HREF="org/neuroph/util/plugins/package-summary.html">org.neuroph.util.plugins</A></B></TD> <TD>Provides various plugins for neural networks.</TD> </TR> </TABLE> <P> &nbsp;<HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Overview</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="index.html?overview-summary.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="overview-summary.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
lgpl-2.1
Nutzchannel/granola
src/main/java/com/nutz/granola/Reference.java
385
package com.nutz.granola; public class Reference { public static final String MOD_ID = "granola"; public static final String MOD_NAME = "The Granola Mod"; public static final String VERSION = "alpha 0.3"; public static final String CLIENT_PROXY_CLASS = "com.nutz.granola.proxy.ClientProxy"; public static final String SERVER_PROXY_CLASS = "com.nutz.granola.proxy.CommonProxy"; }
lgpl-2.1
linbox-team/linbox
examples/sparsesolverat.C
6601
/* * examples/sparsesolverat.C * * Copyright (C) The LinBox Group * ========LICENCE======== * This file is part of the library LinBox. * * LinBox is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ========LICENCE======== */ /**\file examples/sparsesolverat.C @example examples/sparsesolverat.C @author Jean-Guillaume.Dumas@univ-grenoble-alpes.fr * \brief Direct sparse solver over the rationals * \ingroup examples */ #include <iostream> #include "givaro/modular.h" #include "linbox/matrix/sparse-matrix.h" #include "linbox/solutions/solve.h" #include "linbox/util/matrix-stream.h" #include "linbox/solutions/methods.h" using namespace LinBox; template<typename DVector, typename EDom> int rhs(DVector& B, const EDom& DD, bool createB, std::ifstream& invect) { if (createB) { std::cerr << "Creating a random {-1,1} vector " << std::endl; for(auto it=B.begin(); it != B.end(); ++it) if (drand48() <0.5) *it = -1; else *it = 1; } else { for(auto&& it:B) invect >> it; invect.close(); } std::clog << "B is ["; for(auto it:B) DD.write(std::clog, it) << ' '; std::clog << ']' << std::endl; return 0; } int main (int argc, char **argv) { // set 2 to see Q L U P factorization; // see fill-in with 2 and __LINBOX_ALL__ or __LINBOX_FILLIN__ defined commentator().setMaxDetailLevel (1); commentator().setMaxDepth (-1); commentator().setReportStream (std::clog); // commentator().setDefaultReportFile("/dev/stdout"); // to see activities if (argc < 2 || argc > 4) { std::cerr << "Usage: solve <matrix-file-in-supported-format> [<dense-vector-file>] [0/1 <integer solve>]" << std::endl; return 0; } std::ifstream input (argv[1]); if (!input) { std::cerr << "Error opening matrix file " << argv[1] << std::endl; return -1; } std::ifstream invect; bool createB = false; if (argc == 2) { createB = true; } bool integralsolve=false; if (argc >= 3) { invect.open (argv[2], std::ifstream::in); if (!invect) { createB = true; integralsolve = atoi(argv[2]); } else { createB = false; } } if (argc >= 4) integralsolve = atoi(argv[3]); typedef Givaro::QField<Givaro::Rational> Rats; Rats QQ; typedef DenseVector<Rats> RVector; if (integralsolve) { std::clog << "Integral solving" << std::endl; typedef Givaro::ZRing<Givaro::Integer> Ints; Ints ZZ; typedef DenseVector<Ints> ZVector; MatrixStream<Rats> ms( QQ, input ); size_t nrow, ncol; ms.getDimensions(nrow,ncol); SparseMatrix<Ints> A(ZZ,nrow,ncol); ZVector X(ZZ, A.coldim()),B(ZZ, A.rowdim()); // Read rational matrix and rhs, then compute denominator LCM { SparseMatrix<Rats> RA ( ms ); std::clog << "A is " << RA.rowdim() << " by " << RA.coldim() << std::endl; Givaro::Integer ABlcm(1); for(auto iterow = RA.rowBegin() ; iterow != RA.rowEnd(); ++iterow) { for(auto iter = iterow->begin(); iter != iterow->end(); ++iter) { lcm(ABlcm, ABlcm, iter->second.deno()); } } std::clog << "A denominator lcm: " << ABlcm << std::endl; RVector RB(QQ, RA.rowdim()); rhs(RB, QQ, createB, invect); for(auto iter = RB.begin(); iter != RB.end(); ++iter) { lcm(ABlcm, ABlcm, iter->deno()); } std::clog << "A & B denominator lcm: " << ABlcm << std::endl; // A x = b is equivalent to (l.A) x = (l.b) auto iterow = RA.rowBegin(); auto iterit = A.rowBegin(); for(; iterow != RA.rowEnd(); ++iterow, ++iterit) { for(auto iter = iterow->begin(); iter != iterow->end(); ++iter) { iterit->emplace_back( iter->first, (iter->second.nume() * ABlcm) / iter->second.deno() ); } } auto iter = RB.begin(); auto itez = B.begin(); for( ; iter != RB.end(); ++iter, ++itez) { *itez = (iter->nume() * ABlcm) / iter->deno(); } } Givaro::ZRing<Integer>::Element d; Timer chrono; std::clog << "Integral Sparse Elimination" << std::endl; chrono.start(); solveInPlace (X, d, A, B, Method::SparseElimination()); chrono.stop(); std::cout << "(SparseElimination) Solution is ["; for(auto it:X) ZZ.write(std::cout, it) << ' '; std::cout << "] / "; ZZ.write(std::cout, d)<< std::endl; std::clog << "CPU time (seconds): " << chrono.usertime() << std::endl; } else { MatrixStream<Rats> ms( QQ, input ); SparseMatrix<Rats> A ( ms ); std::clog << "A is " << A.rowdim() << " by " << A.coldim() << std::endl; RVector X(QQ, A.coldim()),B(QQ, A.rowdim()); // Sparse Elimination rhs(B, QQ, createB, invect); Timer chrono; std::clog << "Direct Rational Sparse Elimination" << std::endl; chrono.start(); // @fixme Can't pass a Randiter anymore, we need an API through Method to set seed or such // typename Rats::RandIter generator(QQ,0,BaseTimer::seed() ); // solveInPlace (X, A, B, Method::SparseElimination(), generator); solveInPlace (X, A, B, Method::SparseElimination()); chrono.stop(); std::clog << "(SparseElimination) Solution is ["; for(auto it:X) QQ.write(std::cout, it) << ' '; std::clog << ']' << std::endl; std::clog << "CPU time (seconds): " << chrono.usertime() << std::endl; } return 0; } // Local Variables: // mode: C++ // tab-width: 4 // indent-tabs-mode: nil // c-basic-offset: 4 // End: // vim:sts=4:sw=4:ts=4:et:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
lgpl-2.1
gimco/meteor-accounts-ui-latch
accounts_ui_latch.js
2278
/* * Latch integration for Meteor framework * Copyright (C) 2015 Bruno Orcha García <gimcoo@gmail.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ Session.setDefault('Meteor._latch.pairing', false); Template._latchAccountLinks.helpers({ isPairing: function() { return Session.get('Meteor._latch.pairing'); }, isPaired: Latch.isPaired }); Template._latchAccountLinks.events({ "click #latch-pair-link" : function (evt, tmpl) { Accounts._loginButtonsSession.resetMessages(); Tracker.flush(); var token = prompt("Open your Latch app and select 'Add a new service'.\nWrite down the token code shown."); if (!token) return; Session.set('Meteor._latch.pairing', true); Latch.pair(token, function(err, res) { Session.set('Meteor._latch.pairing', false); if (err) { Accounts._loginButtonsSession.errorMessage(err.reason); } else { Accounts._loginButtonsSession.infoMessage("Account protected with Latch!"); } }); }, "click #latch-unpair-link" : function (evt, tmpl) { Accounts._loginButtonsSession.resetMessages(); Tracker.flush(); if (!confirm("You're going to disable Latch protection for your account. Are your sure?")) return; Latch.unpair(function(err, res) { if (err) { Accounts._loginButtonsSession.errorMessage(err.reason); } else { Accounts._loginButtonsSession.infoMessage("Account protection disabled."); } }); } }); injectTemplate("_latchAccountLinks", "_loginButtonsLoggedInDropdownActions")
lgpl-2.1
sawenzel/root
interpreter/llvm/src/lib/Transforms/Scalar/LoopUnrollPass.cpp
43203
//===-- LoopUnroll.cpp - Loop unroller pass -------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This pass implements a simple loop unroller. It works best when loops have // been canonicalized by the -indvars pass, allowing it to determine the trip // counts of loops easily. //===----------------------------------------------------------------------===// #include "llvm/ADT/SetVector.h" #include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/CodeMetrics.h" #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/LoopUnrollAnalyzer.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/InstVisitor.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Metadata.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/LoopUtils.h" #include "llvm/Transforms/Utils/UnrollLoop.h" #include <climits> #include <utility> using namespace llvm; #define DEBUG_TYPE "loop-unroll" static cl::opt<unsigned> UnrollThreshold("unroll-threshold", cl::Hidden, cl::desc("The baseline cost threshold for loop unrolling")); static cl::opt<unsigned> UnrollPercentDynamicCostSavedThreshold( "unroll-percent-dynamic-cost-saved-threshold", cl::init(50), cl::Hidden, cl::desc("The percentage of estimated dynamic cost which must be saved by " "unrolling to allow unrolling up to the max threshold.")); static cl::opt<unsigned> UnrollDynamicCostSavingsDiscount( "unroll-dynamic-cost-savings-discount", cl::init(100), cl::Hidden, cl::desc("This is the amount discounted from the total unroll cost when " "the unrolled form has a high dynamic cost savings (triggered by " "the '-unroll-perecent-dynamic-cost-saved-threshold' flag).")); static cl::opt<unsigned> UnrollMaxIterationsCountToAnalyze( "unroll-max-iteration-count-to-analyze", cl::init(10), cl::Hidden, cl::desc("Don't allow loop unrolling to simulate more than this number of" "iterations when checking full unroll profitability")); static cl::opt<unsigned> UnrollCount( "unroll-count", cl::Hidden, cl::desc("Use this unroll count for all loops including those with " "unroll_count pragma values, for testing purposes")); static cl::opt<unsigned> UnrollMaxCount( "unroll-max-count", cl::Hidden, cl::desc("Set the max unroll count for partial and runtime unrolling, for" "testing purposes")); static cl::opt<unsigned> UnrollFullMaxCount( "unroll-full-max-count", cl::Hidden, cl::desc( "Set the max unroll count for full unrolling, for testing purposes")); static cl::opt<bool> UnrollAllowPartial("unroll-allow-partial", cl::Hidden, cl::desc("Allows loops to be partially unrolled until " "-unroll-threshold loop size is reached.")); static cl::opt<bool> UnrollAllowRemainder( "unroll-allow-remainder", cl::Hidden, cl::desc("Allow generation of a loop remainder (extra iterations) " "when unrolling a loop.")); static cl::opt<bool> UnrollRuntime("unroll-runtime", cl::ZeroOrMore, cl::Hidden, cl::desc("Unroll loops with run-time trip counts")); static cl::opt<unsigned> PragmaUnrollThreshold( "pragma-unroll-threshold", cl::init(16 * 1024), cl::Hidden, cl::desc("Unrolled size limit for loops with an unroll(full) or " "unroll_count pragma.")); /// A magic value for use with the Threshold parameter to indicate /// that the loop unroll should be performed regardless of how much /// code expansion would result. static const unsigned NoThreshold = UINT_MAX; /// Default unroll count for loops with run-time trip count if /// -unroll-count is not set static const unsigned DefaultUnrollRuntimeCount = 8; /// Gather the various unrolling parameters based on the defaults, compiler /// flags, TTI overrides and user specified parameters. static TargetTransformInfo::UnrollingPreferences gatherUnrollingPreferences( Loop *L, const TargetTransformInfo &TTI, Optional<unsigned> UserThreshold, Optional<unsigned> UserCount, Optional<bool> UserAllowPartial, Optional<bool> UserRuntime) { TargetTransformInfo::UnrollingPreferences UP; // Set up the defaults UP.Threshold = 150; UP.PercentDynamicCostSavedThreshold = 50; UP.DynamicCostSavingsDiscount = 100; UP.OptSizeThreshold = 0; UP.PartialThreshold = UP.Threshold; UP.PartialOptSizeThreshold = 0; UP.Count = 0; UP.MaxCount = UINT_MAX; UP.FullUnrollMaxCount = UINT_MAX; UP.Partial = false; UP.Runtime = false; UP.AllowRemainder = true; UP.AllowExpensiveTripCount = false; UP.Force = false; // Override with any target specific settings TTI.getUnrollingPreferences(L, UP); // Apply size attributes if (L->getHeader()->getParent()->optForSize()) { UP.Threshold = UP.OptSizeThreshold; UP.PartialThreshold = UP.PartialOptSizeThreshold; } // Apply any user values specified by cl::opt if (UnrollThreshold.getNumOccurrences() > 0) { UP.Threshold = UnrollThreshold; UP.PartialThreshold = UnrollThreshold; } if (UnrollPercentDynamicCostSavedThreshold.getNumOccurrences() > 0) UP.PercentDynamicCostSavedThreshold = UnrollPercentDynamicCostSavedThreshold; if (UnrollDynamicCostSavingsDiscount.getNumOccurrences() > 0) UP.DynamicCostSavingsDiscount = UnrollDynamicCostSavingsDiscount; if (UnrollMaxCount.getNumOccurrences() > 0) UP.MaxCount = UnrollMaxCount; if (UnrollFullMaxCount.getNumOccurrences() > 0) UP.FullUnrollMaxCount = UnrollFullMaxCount; if (UnrollAllowPartial.getNumOccurrences() > 0) UP.Partial = UnrollAllowPartial; if (UnrollAllowRemainder.getNumOccurrences() > 0) UP.AllowRemainder = UnrollAllowRemainder; if (UnrollRuntime.getNumOccurrences() > 0) UP.Runtime = UnrollRuntime; // Apply user values provided by argument if (UserThreshold.hasValue()) { UP.Threshold = *UserThreshold; UP.PartialThreshold = *UserThreshold; } if (UserCount.hasValue()) UP.Count = *UserCount; if (UserAllowPartial.hasValue()) UP.Partial = *UserAllowPartial; if (UserRuntime.hasValue()) UP.Runtime = *UserRuntime; return UP; } namespace { /// A struct to densely store the state of an instruction after unrolling at /// each iteration. /// /// This is designed to work like a tuple of <Instruction *, int> for the /// purposes of hashing and lookup, but to be able to associate two boolean /// states with each key. struct UnrolledInstState { Instruction *I; int Iteration : 30; unsigned IsFree : 1; unsigned IsCounted : 1; }; /// Hashing and equality testing for a set of the instruction states. struct UnrolledInstStateKeyInfo { typedef DenseMapInfo<Instruction *> PtrInfo; typedef DenseMapInfo<std::pair<Instruction *, int>> PairInfo; static inline UnrolledInstState getEmptyKey() { return {PtrInfo::getEmptyKey(), 0, 0, 0}; } static inline UnrolledInstState getTombstoneKey() { return {PtrInfo::getTombstoneKey(), 0, 0, 0}; } static inline unsigned getHashValue(const UnrolledInstState &S) { return PairInfo::getHashValue({S.I, S.Iteration}); } static inline bool isEqual(const UnrolledInstState &LHS, const UnrolledInstState &RHS) { return PairInfo::isEqual({LHS.I, LHS.Iteration}, {RHS.I, RHS.Iteration}); } }; } namespace { struct EstimatedUnrollCost { /// \brief The estimated cost after unrolling. int UnrolledCost; /// \brief The estimated dynamic cost of executing the instructions in the /// rolled form. int RolledDynamicCost; }; } /// \brief Figure out if the loop is worth full unrolling. /// /// Complete loop unrolling can make some loads constant, and we need to know /// if that would expose any further optimization opportunities. This routine /// estimates this optimization. It computes cost of unrolled loop /// (UnrolledCost) and dynamic cost of the original loop (RolledDynamicCost). By /// dynamic cost we mean that we won't count costs of blocks that are known not /// to be executed (i.e. if we have a branch in the loop and we know that at the /// given iteration its condition would be resolved to true, we won't add up the /// cost of the 'false'-block). /// \returns Optional value, holding the RolledDynamicCost and UnrolledCost. If /// the analysis failed (no benefits expected from the unrolling, or the loop is /// too big to analyze), the returned value is None. static Optional<EstimatedUnrollCost> analyzeLoopUnrollCost(const Loop *L, unsigned TripCount, DominatorTree &DT, ScalarEvolution &SE, const TargetTransformInfo &TTI, int MaxUnrolledLoopSize) { // We want to be able to scale offsets by the trip count and add more offsets // to them without checking for overflows, and we already don't want to // analyze *massive* trip counts, so we force the max to be reasonably small. assert(UnrollMaxIterationsCountToAnalyze < (INT_MAX / 2) && "The unroll iterations max is too large!"); // Only analyze inner loops. We can't properly estimate cost of nested loops // and we won't visit inner loops again anyway. if (!L->empty()) return None; // Don't simulate loops with a big or unknown tripcount if (!UnrollMaxIterationsCountToAnalyze || !TripCount || TripCount > UnrollMaxIterationsCountToAnalyze) return None; SmallSetVector<BasicBlock *, 16> BBWorklist; SmallSetVector<std::pair<BasicBlock *, BasicBlock *>, 4> ExitWorklist; DenseMap<Value *, Constant *> SimplifiedValues; SmallVector<std::pair<Value *, Constant *>, 4> SimplifiedInputValues; // The estimated cost of the unrolled form of the loop. We try to estimate // this by simplifying as much as we can while computing the estimate. int UnrolledCost = 0; // We also track the estimated dynamic (that is, actually executed) cost in // the rolled form. This helps identify cases when the savings from unrolling // aren't just exposing dead control flows, but actual reduced dynamic // instructions due to the simplifications which we expect to occur after // unrolling. int RolledDynamicCost = 0; // We track the simplification of each instruction in each iteration. We use // this to recursively merge costs into the unrolled cost on-demand so that // we don't count the cost of any dead code. This is essentially a map from // <instruction, int> to <bool, bool>, but stored as a densely packed struct. DenseSet<UnrolledInstState, UnrolledInstStateKeyInfo> InstCostMap; // A small worklist used to accumulate cost of instructions from each // observable and reached root in the loop. SmallVector<Instruction *, 16> CostWorklist; // PHI-used worklist used between iterations while accumulating cost. SmallVector<Instruction *, 4> PHIUsedList; // Helper function to accumulate cost for instructions in the loop. auto AddCostRecursively = [&](Instruction &RootI, int Iteration) { assert(Iteration >= 0 && "Cannot have a negative iteration!"); assert(CostWorklist.empty() && "Must start with an empty cost list"); assert(PHIUsedList.empty() && "Must start with an empty phi used list"); CostWorklist.push_back(&RootI); for (;; --Iteration) { do { Instruction *I = CostWorklist.pop_back_val(); // InstCostMap only uses I and Iteration as a key, the other two values // don't matter here. auto CostIter = InstCostMap.find({I, Iteration, 0, 0}); if (CostIter == InstCostMap.end()) // If an input to a PHI node comes from a dead path through the loop // we may have no cost data for it here. What that actually means is // that it is free. continue; auto &Cost = *CostIter; if (Cost.IsCounted) // Already counted this instruction. continue; // Mark that we are counting the cost of this instruction now. Cost.IsCounted = true; // If this is a PHI node in the loop header, just add it to the PHI set. if (auto *PhiI = dyn_cast<PHINode>(I)) if (PhiI->getParent() == L->getHeader()) { assert(Cost.IsFree && "Loop PHIs shouldn't be evaluated as they " "inherently simplify during unrolling."); if (Iteration == 0) continue; // Push the incoming value from the backedge into the PHI used list // if it is an in-loop instruction. We'll use this to populate the // cost worklist for the next iteration (as we count backwards). if (auto *OpI = dyn_cast<Instruction>( PhiI->getIncomingValueForBlock(L->getLoopLatch()))) if (L->contains(OpI)) PHIUsedList.push_back(OpI); continue; } // First accumulate the cost of this instruction. if (!Cost.IsFree) { UnrolledCost += TTI.getUserCost(I); DEBUG(dbgs() << "Adding cost of instruction (iteration " << Iteration << "): "); DEBUG(I->dump()); } // We must count the cost of every operand which is not free, // recursively. If we reach a loop PHI node, simply add it to the set // to be considered on the next iteration (backwards!). for (Value *Op : I->operands()) { // Check whether this operand is free due to being a constant or // outside the loop. auto *OpI = dyn_cast<Instruction>(Op); if (!OpI || !L->contains(OpI)) continue; // Otherwise accumulate its cost. CostWorklist.push_back(OpI); } } while (!CostWorklist.empty()); if (PHIUsedList.empty()) // We've exhausted the search. break; assert(Iteration > 0 && "Cannot track PHI-used values past the first iteration!"); CostWorklist.append(PHIUsedList.begin(), PHIUsedList.end()); PHIUsedList.clear(); } }; // Ensure that we don't violate the loop structure invariants relied on by // this analysis. assert(L->isLoopSimplifyForm() && "Must put loop into normal form first."); assert(L->isLCSSAForm(DT) && "Must have loops in LCSSA form to track live-out values."); DEBUG(dbgs() << "Starting LoopUnroll profitability analysis...\n"); // Simulate execution of each iteration of the loop counting instructions, // which would be simplified. // Since the same load will take different values on different iterations, // we literally have to go through all loop's iterations. for (unsigned Iteration = 0; Iteration < TripCount; ++Iteration) { DEBUG(dbgs() << " Analyzing iteration " << Iteration << "\n"); // Prepare for the iteration by collecting any simplified entry or backedge // inputs. for (Instruction &I : *L->getHeader()) { auto *PHI = dyn_cast<PHINode>(&I); if (!PHI) break; // The loop header PHI nodes must have exactly two input: one from the // loop preheader and one from the loop latch. assert( PHI->getNumIncomingValues() == 2 && "Must have an incoming value only for the preheader and the latch."); Value *V = PHI->getIncomingValueForBlock( Iteration == 0 ? L->getLoopPreheader() : L->getLoopLatch()); Constant *C = dyn_cast<Constant>(V); if (Iteration != 0 && !C) C = SimplifiedValues.lookup(V); if (C) SimplifiedInputValues.push_back({PHI, C}); } // Now clear and re-populate the map for the next iteration. SimplifiedValues.clear(); while (!SimplifiedInputValues.empty()) SimplifiedValues.insert(SimplifiedInputValues.pop_back_val()); UnrolledInstAnalyzer Analyzer(Iteration, SimplifiedValues, SE, L); BBWorklist.clear(); BBWorklist.insert(L->getHeader()); // Note that we *must not* cache the size, this loop grows the worklist. for (unsigned Idx = 0; Idx != BBWorklist.size(); ++Idx) { BasicBlock *BB = BBWorklist[Idx]; // Visit all instructions in the given basic block and try to simplify // it. We don't change the actual IR, just count optimization // opportunities. for (Instruction &I : *BB) { // Track this instruction's expected baseline cost when executing the // rolled loop form. RolledDynamicCost += TTI.getUserCost(&I); // Visit the instruction to analyze its loop cost after unrolling, // and if the visitor returns true, mark the instruction as free after // unrolling and continue. bool IsFree = Analyzer.visit(I); bool Inserted = InstCostMap.insert({&I, (int)Iteration, (unsigned)IsFree, /*IsCounted*/ false}).second; (void)Inserted; assert(Inserted && "Cannot have a state for an unvisited instruction!"); if (IsFree) continue; // If the instruction might have a side-effect recursively account for // the cost of it and all the instructions leading up to it. if (I.mayHaveSideEffects()) AddCostRecursively(I, Iteration); // Can't properly model a cost of a call. // FIXME: With a proper cost model we should be able to do it. if(isa<CallInst>(&I)) return None; // If unrolled body turns out to be too big, bail out. if (UnrolledCost > MaxUnrolledLoopSize) { DEBUG(dbgs() << " Exceeded threshold.. exiting.\n" << " UnrolledCost: " << UnrolledCost << ", MaxUnrolledLoopSize: " << MaxUnrolledLoopSize << "\n"); return None; } } TerminatorInst *TI = BB->getTerminator(); // Add in the live successors by first checking whether we have terminator // that may be simplified based on the values simplified by this call. BasicBlock *KnownSucc = nullptr; if (BranchInst *BI = dyn_cast<BranchInst>(TI)) { if (BI->isConditional()) { if (Constant *SimpleCond = SimplifiedValues.lookup(BI->getCondition())) { // Just take the first successor if condition is undef if (isa<UndefValue>(SimpleCond)) KnownSucc = BI->getSuccessor(0); else if (ConstantInt *SimpleCondVal = dyn_cast<ConstantInt>(SimpleCond)) KnownSucc = BI->getSuccessor(SimpleCondVal->isZero() ? 1 : 0); } } } else if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) { if (Constant *SimpleCond = SimplifiedValues.lookup(SI->getCondition())) { // Just take the first successor if condition is undef if (isa<UndefValue>(SimpleCond)) KnownSucc = SI->getSuccessor(0); else if (ConstantInt *SimpleCondVal = dyn_cast<ConstantInt>(SimpleCond)) KnownSucc = SI->findCaseValue(SimpleCondVal).getCaseSuccessor(); } } if (KnownSucc) { if (L->contains(KnownSucc)) BBWorklist.insert(KnownSucc); else ExitWorklist.insert({BB, KnownSucc}); continue; } // Add BB's successors to the worklist. for (BasicBlock *Succ : successors(BB)) if (L->contains(Succ)) BBWorklist.insert(Succ); else ExitWorklist.insert({BB, Succ}); AddCostRecursively(*TI, Iteration); } // If we found no optimization opportunities on the first iteration, we // won't find them on later ones too. if (UnrolledCost == RolledDynamicCost) { DEBUG(dbgs() << " No opportunities found.. exiting.\n" << " UnrolledCost: " << UnrolledCost << "\n"); return None; } } while (!ExitWorklist.empty()) { BasicBlock *ExitingBB, *ExitBB; std::tie(ExitingBB, ExitBB) = ExitWorklist.pop_back_val(); for (Instruction &I : *ExitBB) { auto *PN = dyn_cast<PHINode>(&I); if (!PN) break; Value *Op = PN->getIncomingValueForBlock(ExitingBB); if (auto *OpI = dyn_cast<Instruction>(Op)) if (L->contains(OpI)) AddCostRecursively(*OpI, TripCount - 1); } } DEBUG(dbgs() << "Analysis finished:\n" << "UnrolledCost: " << UnrolledCost << ", " << "RolledDynamicCost: " << RolledDynamicCost << "\n"); return {{UnrolledCost, RolledDynamicCost}}; } /// ApproximateLoopSize - Approximate the size of the loop. static unsigned ApproximateLoopSize(const Loop *L, unsigned &NumCalls, bool &NotDuplicatable, bool &Convergent, const TargetTransformInfo &TTI, AssumptionCache *AC) { SmallPtrSet<const Value *, 32> EphValues; CodeMetrics::collectEphemeralValues(L, AC, EphValues); CodeMetrics Metrics; for (BasicBlock *BB : L->blocks()) Metrics.analyzeBasicBlock(BB, TTI, EphValues); NumCalls = Metrics.NumInlineCandidates; NotDuplicatable = Metrics.notDuplicatable; Convergent = Metrics.convergent; unsigned LoopSize = Metrics.NumInsts; // Don't allow an estimate of size zero. This would allows unrolling of loops // with huge iteration counts, which is a compile time problem even if it's // not a problem for code quality. Also, the code using this size may assume // that each loop has at least three instructions (likely a conditional // branch, a comparison feeding that branch, and some kind of loop increment // feeding that comparison instruction). LoopSize = std::max(LoopSize, 3u); return LoopSize; } // Returns the loop hint metadata node with the given name (for example, // "llvm.loop.unroll.count"). If no such metadata node exists, then nullptr is // returned. static MDNode *GetUnrollMetadataForLoop(const Loop *L, StringRef Name) { if (MDNode *LoopID = L->getLoopID()) return GetUnrollMetadata(LoopID, Name); return nullptr; } // Returns true if the loop has an unroll(full) pragma. static bool HasUnrollFullPragma(const Loop *L) { return GetUnrollMetadataForLoop(L, "llvm.loop.unroll.full"); } // Returns true if the loop has an unroll(enable) pragma. This metadata is used // for both "#pragma unroll" and "#pragma clang loop unroll(enable)" directives. static bool HasUnrollEnablePragma(const Loop *L) { return GetUnrollMetadataForLoop(L, "llvm.loop.unroll.enable"); } // Returns true if the loop has an unroll(disable) pragma. static bool HasUnrollDisablePragma(const Loop *L) { return GetUnrollMetadataForLoop(L, "llvm.loop.unroll.disable"); } // Returns true if the loop has an runtime unroll(disable) pragma. static bool HasRuntimeUnrollDisablePragma(const Loop *L) { return GetUnrollMetadataForLoop(L, "llvm.loop.unroll.runtime.disable"); } // If loop has an unroll_count pragma return the (necessarily // positive) value from the pragma. Otherwise return 0. static unsigned UnrollCountPragmaValue(const Loop *L) { MDNode *MD = GetUnrollMetadataForLoop(L, "llvm.loop.unroll.count"); if (MD) { assert(MD->getNumOperands() == 2 && "Unroll count hint metadata should have two operands."); unsigned Count = mdconst::extract<ConstantInt>(MD->getOperand(1))->getZExtValue(); assert(Count >= 1 && "Unroll count must be positive."); return Count; } return 0; } // Remove existing unroll metadata and add unroll disable metadata to // indicate the loop has already been unrolled. This prevents a loop // from being unrolled more than is directed by a pragma if the loop // unrolling pass is run more than once (which it generally is). static void SetLoopAlreadyUnrolled(Loop *L) { MDNode *LoopID = L->getLoopID(); // First remove any existing loop unrolling metadata. SmallVector<Metadata *, 4> MDs; // Reserve first location for self reference to the LoopID metadata node. MDs.push_back(nullptr); if (LoopID) { for (unsigned i = 1, ie = LoopID->getNumOperands(); i < ie; ++i) { bool IsUnrollMetadata = false; MDNode *MD = dyn_cast<MDNode>(LoopID->getOperand(i)); if (MD) { const MDString *S = dyn_cast<MDString>(MD->getOperand(0)); IsUnrollMetadata = S && S->getString().startswith("llvm.loop.unroll."); } if (!IsUnrollMetadata) MDs.push_back(LoopID->getOperand(i)); } } // Add unroll(disable) metadata to disable future unrolling. LLVMContext &Context = L->getHeader()->getContext(); SmallVector<Metadata *, 1> DisableOperands; DisableOperands.push_back(MDString::get(Context, "llvm.loop.unroll.disable")); MDNode *DisableNode = MDNode::get(Context, DisableOperands); MDs.push_back(DisableNode); MDNode *NewLoopID = MDNode::get(Context, MDs); // Set operand 0 to refer to the loop id itself. NewLoopID->replaceOperandWith(0, NewLoopID); L->setLoopID(NewLoopID); } static bool canUnrollCompletely(Loop *L, unsigned Threshold, unsigned PercentDynamicCostSavedThreshold, unsigned DynamicCostSavingsDiscount, uint64_t UnrolledCost, uint64_t RolledDynamicCost) { if (Threshold == NoThreshold) { DEBUG(dbgs() << " Can fully unroll, because no threshold is set.\n"); return true; } if (UnrolledCost <= Threshold) { DEBUG(dbgs() << " Can fully unroll, because unrolled cost: " << UnrolledCost << "<" << Threshold << "\n"); return true; } assert(UnrolledCost && "UnrolledCost can't be 0 at this point."); assert(RolledDynamicCost >= UnrolledCost && "Cannot have a higher unrolled cost than a rolled cost!"); // Compute the percentage of the dynamic cost in the rolled form that is // saved when unrolled. If unrolling dramatically reduces the estimated // dynamic cost of the loop, we use a higher threshold to allow more // unrolling. unsigned PercentDynamicCostSaved = (uint64_t)(RolledDynamicCost - UnrolledCost) * 100ull / RolledDynamicCost; if (PercentDynamicCostSaved >= PercentDynamicCostSavedThreshold && (int64_t)UnrolledCost - (int64_t)DynamicCostSavingsDiscount <= (int64_t)Threshold) { DEBUG(dbgs() << " Can fully unroll, because unrolling will reduce the " "expected dynamic cost by " << PercentDynamicCostSaved << "% (threshold: " << PercentDynamicCostSavedThreshold << "%)\n" << " and the unrolled cost (" << UnrolledCost << ") is less than the max threshold (" << DynamicCostSavingsDiscount << ").\n"); return true; } DEBUG(dbgs() << " Too large to fully unroll:\n"); DEBUG(dbgs() << " Threshold: " << Threshold << "\n"); DEBUG(dbgs() << " Max threshold: " << DynamicCostSavingsDiscount << "\n"); DEBUG(dbgs() << " Percent cost saved threshold: " << PercentDynamicCostSavedThreshold << "%\n"); DEBUG(dbgs() << " Unrolled cost: " << UnrolledCost << "\n"); DEBUG(dbgs() << " Rolled dynamic cost: " << RolledDynamicCost << "\n"); DEBUG(dbgs() << " Percent cost saved: " << PercentDynamicCostSaved << "\n"); return false; } // Returns true if unroll count was set explicitly. // Calculates unroll count and writes it to UP.Count. static bool computeUnrollCount(Loop *L, const TargetTransformInfo &TTI, DominatorTree &DT, LoopInfo *LI, ScalarEvolution *SE, unsigned TripCount, unsigned TripMultiple, unsigned LoopSize, TargetTransformInfo::UnrollingPreferences &UP) { // BEInsns represents number of instructions optimized when "back edge" // becomes "fall through" in unrolled loop. // For now we count a conditional branch on a backedge and a comparison // feeding it. unsigned BEInsns = 2; // Check for explicit Count. // 1st priority is unroll count set by "unroll-count" option. bool UserUnrollCount = UnrollCount.getNumOccurrences() > 0; if (UserUnrollCount) { UP.Count = UnrollCount; UP.AllowExpensiveTripCount = true; UP.Force = true; if (UP.AllowRemainder && (LoopSize - BEInsns) * UP.Count + BEInsns < UP.Threshold) return true; } // 2nd priority is unroll count set by pragma. unsigned PragmaCount = UnrollCountPragmaValue(L); if (PragmaCount > 0) { UP.Count = PragmaCount; UP.Runtime = true; UP.AllowExpensiveTripCount = true; UP.Force = true; if (UP.AllowRemainder && (LoopSize - BEInsns) * UP.Count + BEInsns < PragmaUnrollThreshold) return true; } bool PragmaFullUnroll = HasUnrollFullPragma(L); if (PragmaFullUnroll && TripCount != 0) { UP.Count = TripCount; if ((LoopSize - BEInsns) * UP.Count + BEInsns < PragmaUnrollThreshold) return false; } bool PragmaEnableUnroll = HasUnrollEnablePragma(L); bool ExplicitUnroll = PragmaCount > 0 || PragmaFullUnroll || PragmaEnableUnroll || UserUnrollCount; uint64_t UnrolledSize; DebugLoc LoopLoc = L->getStartLoc(); Function *F = L->getHeader()->getParent(); LLVMContext &Ctx = F->getContext(); if (ExplicitUnroll && TripCount != 0) { // If the loop has an unrolling pragma, we want to be more aggressive with // unrolling limits. Set thresholds to at least the PragmaThreshold value // which is larger than the default limits. UP.Threshold = std::max<unsigned>(UP.Threshold, PragmaUnrollThreshold); UP.PartialThreshold = std::max<unsigned>(UP.PartialThreshold, PragmaUnrollThreshold); } // 3rd priority is full unroll count. // Full unroll make sense only when TripCount could be staticaly calculated. // Also we need to check if we exceed FullUnrollMaxCount. if (TripCount && TripCount <= UP.FullUnrollMaxCount) { // When computing the unrolled size, note that BEInsns are not replicated // like the rest of the loop body. UnrolledSize = (uint64_t)(LoopSize - BEInsns) * TripCount + BEInsns; if (canUnrollCompletely(L, UP.Threshold, 100, UP.DynamicCostSavingsDiscount, UnrolledSize, UnrolledSize)) { UP.Count = TripCount; return ExplicitUnroll; } else { // The loop isn't that small, but we still can fully unroll it if that // helps to remove a significant number of instructions. // To check that, run additional analysis on the loop. if (Optional<EstimatedUnrollCost> Cost = analyzeLoopUnrollCost( L, TripCount, DT, *SE, TTI, UP.Threshold + UP.DynamicCostSavingsDiscount)) if (canUnrollCompletely(L, UP.Threshold, UP.PercentDynamicCostSavedThreshold, UP.DynamicCostSavingsDiscount, Cost->UnrolledCost, Cost->RolledDynamicCost)) { UP.Count = TripCount; return ExplicitUnroll; } } } // 4rd priority is partial unrolling. // Try partial unroll only when TripCount could be staticaly calculated. if (TripCount) { if (UP.Count == 0) UP.Count = TripCount; UP.Partial |= ExplicitUnroll; if (!UP.Partial) { DEBUG(dbgs() << " will not try to unroll partially because " << "-unroll-allow-partial not given\n"); UP.Count = 0; return false; } if (UP.PartialThreshold != NoThreshold) { // Reduce unroll count to be modulo of TripCount for partial unrolling. UnrolledSize = (uint64_t)(LoopSize - BEInsns) * UP.Count + BEInsns; if (UnrolledSize > UP.PartialThreshold) UP.Count = (std::max(UP.PartialThreshold, 3u) - BEInsns) / (LoopSize - BEInsns); if (UP.Count > UP.MaxCount) UP.Count = UP.MaxCount; while (UP.Count != 0 && TripCount % UP.Count != 0) UP.Count--; if (UP.AllowRemainder && UP.Count <= 1) { // If there is no Count that is modulo of TripCount, set Count to // largest power-of-two factor that satisfies the threshold limit. // As we'll create fixup loop, do the type of unrolling only if // remainder loop is allowed. UP.Count = DefaultUnrollRuntimeCount; UnrolledSize = (LoopSize - BEInsns) * UP.Count + BEInsns; while (UP.Count != 0 && UnrolledSize > UP.PartialThreshold) { UP.Count >>= 1; UnrolledSize = (LoopSize - BEInsns) * UP.Count + BEInsns; } } if (UP.Count < 2) { if (PragmaEnableUnroll) emitOptimizationRemarkMissed( Ctx, DEBUG_TYPE, *F, LoopLoc, "Unable to unroll loop as directed by unroll(enable) pragma " "because unrolled size is too large."); UP.Count = 0; } } else { UP.Count = TripCount; } if ((PragmaFullUnroll || PragmaEnableUnroll) && TripCount && UP.Count != TripCount) emitOptimizationRemarkMissed( Ctx, DEBUG_TYPE, *F, LoopLoc, "Unable to fully unroll loop as directed by unroll pragma because " "unrolled size is too large."); return ExplicitUnroll; } assert(TripCount == 0 && "All cases when TripCount is constant should be covered here."); if (PragmaFullUnroll) emitOptimizationRemarkMissed( Ctx, DEBUG_TYPE, *F, LoopLoc, "Unable to fully unroll loop as directed by unroll(full) pragma " "because loop has a runtime trip count."); // 5th priority is runtime unrolling. // Don't unroll a runtime trip count loop when it is disabled. if (HasRuntimeUnrollDisablePragma(L)) { UP.Count = 0; return false; } // Reduce count based on the type of unrolling and the threshold values. UP.Runtime |= PragmaEnableUnroll || PragmaCount > 0 || UserUnrollCount; if (!UP.Runtime) { DEBUG(dbgs() << " will not try to unroll loop with runtime trip count " << "-unroll-runtime not given\n"); UP.Count = 0; return false; } if (UP.Count == 0) UP.Count = DefaultUnrollRuntimeCount; UnrolledSize = (LoopSize - BEInsns) * UP.Count + BEInsns; // Reduce unroll count to be the largest power-of-two factor of // the original count which satisfies the threshold limit. while (UP.Count != 0 && UnrolledSize > UP.PartialThreshold) { UP.Count >>= 1; UnrolledSize = (LoopSize - BEInsns) * UP.Count + BEInsns; } #ifndef NDEBUG unsigned OrigCount = UP.Count; #endif if (!UP.AllowRemainder && UP.Count != 0 && (TripMultiple % UP.Count) != 0) { while (UP.Count != 0 && TripMultiple % UP.Count != 0) UP.Count >>= 1; DEBUG(dbgs() << "Remainder loop is restricted (that could architecture " "specific or because the loop contains a convergent " "instruction), so unroll count must divide the trip " "multiple, " << TripMultiple << ". Reducing unroll count from " << OrigCount << " to " << UP.Count << ".\n"); if (PragmaCount > 0 && !UP.AllowRemainder) emitOptimizationRemarkMissed( Ctx, DEBUG_TYPE, *F, LoopLoc, Twine("Unable to unroll loop the number of times directed by " "unroll_count pragma because remainder loop is restricted " "(that could architecture specific or because the loop " "contains a convergent instruction) and so must have an unroll " "count that divides the loop trip multiple of ") + Twine(TripMultiple) + ". Unrolling instead " + Twine(UP.Count) + " time(s)."); } if (UP.Count > UP.MaxCount) UP.Count = UP.MaxCount; DEBUG(dbgs() << " partially unrolling with count: " << UP.Count << "\n"); if (UP.Count < 2) UP.Count = 0; return ExplicitUnroll; } static bool tryToUnrollLoop(Loop *L, DominatorTree &DT, LoopInfo *LI, ScalarEvolution *SE, const TargetTransformInfo &TTI, AssumptionCache &AC, bool PreserveLCSSA, Optional<unsigned> ProvidedCount, Optional<unsigned> ProvidedThreshold, Optional<bool> ProvidedAllowPartial, Optional<bool> ProvidedRuntime) { DEBUG(dbgs() << "Loop Unroll: F[" << L->getHeader()->getParent()->getName() << "] Loop %" << L->getHeader()->getName() << "\n"); if (HasUnrollDisablePragma(L)) { return false; } unsigned NumInlineCandidates; bool NotDuplicatable; bool Convergent; unsigned LoopSize = ApproximateLoopSize( L, NumInlineCandidates, NotDuplicatable, Convergent, TTI, &AC); DEBUG(dbgs() << " Loop Size = " << LoopSize << "\n"); if (NotDuplicatable) { DEBUG(dbgs() << " Not unrolling loop which contains non-duplicatable" << " instructions.\n"); return false; } if (NumInlineCandidates != 0) { DEBUG(dbgs() << " Not unrolling loop with inlinable calls.\n"); return false; } // Find trip count and trip multiple if count is not available unsigned TripCount = 0; unsigned TripMultiple = 1; // If there are multiple exiting blocks but one of them is the latch, use the // latch for the trip count estimation. Otherwise insist on a single exiting // block for the trip count estimation. BasicBlock *ExitingBlock = L->getLoopLatch(); if (!ExitingBlock || !L->isLoopExiting(ExitingBlock)) ExitingBlock = L->getExitingBlock(); if (ExitingBlock) { TripCount = SE->getSmallConstantTripCount(L, ExitingBlock); TripMultiple = SE->getSmallConstantTripMultiple(L, ExitingBlock); } TargetTransformInfo::UnrollingPreferences UP = gatherUnrollingPreferences( L, TTI, ProvidedThreshold, ProvidedCount, ProvidedAllowPartial, ProvidedRuntime); // If the loop contains a convergent operation, the prelude we'd add // to do the first few instructions before we hit the unrolled loop // is unsafe -- it adds a control-flow dependency to the convergent // operation. Therefore restrict remainder loop (try unrollig without). // // TODO: This is quite conservative. In practice, convergent_op() // is likely to be called unconditionally in the loop. In this // case, the program would be ill-formed (on most architectures) // unless n were the same on all threads in a thread group. // Assuming n is the same on all threads, any kind of unrolling is // safe. But currently llvm's notion of convergence isn't powerful // enough to express this. if (Convergent) UP.AllowRemainder = false; bool IsCountSetExplicitly = computeUnrollCount(L, TTI, DT, LI, SE, TripCount, TripMultiple, LoopSize, UP); if (!UP.Count) return false; // Unroll factor (Count) must be less or equal to TripCount. if (TripCount && UP.Count > TripCount) UP.Count = TripCount; // Unroll the loop. if (!UnrollLoop(L, UP.Count, TripCount, UP.Force, UP.Runtime, UP.AllowExpensiveTripCount, TripMultiple, LI, SE, &DT, &AC, PreserveLCSSA)) return false; // If loop has an unroll count pragma or unrolled by explicitly set count // mark loop as unrolled to prevent unrolling beyond that requested. if (IsCountSetExplicitly) SetLoopAlreadyUnrolled(L); return true; } namespace { class LoopUnroll : public LoopPass { public: static char ID; // Pass ID, replacement for typeid LoopUnroll(Optional<unsigned> Threshold = None, Optional<unsigned> Count = None, Optional<bool> AllowPartial = None, Optional<bool> Runtime = None) : LoopPass(ID), ProvidedCount(std::move(Count)), ProvidedThreshold(Threshold), ProvidedAllowPartial(AllowPartial), ProvidedRuntime(Runtime) { initializeLoopUnrollPass(*PassRegistry::getPassRegistry()); } Optional<unsigned> ProvidedCount; Optional<unsigned> ProvidedThreshold; Optional<bool> ProvidedAllowPartial; Optional<bool> ProvidedRuntime; bool runOnLoop(Loop *L, LPPassManager &) override { if (skipLoop(L)) return false; Function &F = *L->getHeader()->getParent(); auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); LoopInfo *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); ScalarEvolution *SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE(); const TargetTransformInfo &TTI = getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F); auto &AC = getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); bool PreserveLCSSA = mustPreserveAnalysisID(LCSSAID); return tryToUnrollLoop(L, DT, LI, SE, TTI, AC, PreserveLCSSA, ProvidedCount, ProvidedThreshold, ProvidedAllowPartial, ProvidedRuntime); } /// This transformation requires natural loop information & requires that /// loop preheaders be inserted into the CFG... /// void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequired<AssumptionCacheTracker>(); AU.addRequired<TargetTransformInfoWrapperPass>(); // FIXME: Loop passes are required to preserve domtree, and for now we just // recreate dom info if anything gets unrolled. getLoopAnalysisUsage(AU); } }; } char LoopUnroll::ID = 0; INITIALIZE_PASS_BEGIN(LoopUnroll, "loop-unroll", "Unroll loops", false, false) INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) INITIALIZE_PASS_DEPENDENCY(LoopPass) INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass) INITIALIZE_PASS_END(LoopUnroll, "loop-unroll", "Unroll loops", false, false) Pass *llvm::createLoopUnrollPass(int Threshold, int Count, int AllowPartial, int Runtime) { // TODO: It would make more sense for this function to take the optionals // directly, but that's dangerous since it would silently break out of tree // callers. return new LoopUnroll(Threshold == -1 ? None : Optional<unsigned>(Threshold), Count == -1 ? None : Optional<unsigned>(Count), AllowPartial == -1 ? None : Optional<bool>(AllowPartial), Runtime == -1 ? None : Optional<bool>(Runtime)); } Pass *llvm::createSimpleLoopUnrollPass() { return llvm::createLoopUnrollPass(-1, -1, 0, 0); }
lgpl-2.1
qtproject/pyside-pyside
doc/codesnippets/examples/widgets/icons/iconsizespinbox.cpp
2818
############################################################################ ## ## Copyright (C) 2016 The Qt Company Ltd. ## Contact: https://www.qt.io/licensing/ ## ## This file is part of the examples of PySide2. ## ## $QT_BEGIN_LICENSE:BSD$ ## Commercial License Usage ## Licensees holding valid commercial Qt licenses may use this file in ## accordance with the commercial license agreement provided with the ## Software or, alternatively, in accordance with the terms contained in ## a written agreement between you and The Qt Company. For licensing terms ## and conditions see https://www.qt.io/terms-conditions. For further ## information use the contact form at https://www.qt.io/contact-us. ## ## BSD License Usage ## Alternatively, you may use this file under the terms of the BSD license ## as follows: ## ## "Redistribution and use in source and binary forms, with or without ## modification, are permitted provided that the following conditions are ## met: ## * Redistributions of source code must retain the above copyright ## notice, this list of conditions and the following disclaimer. ## * Redistributions in binary form must reproduce the above copyright ## notice, this list of conditions and the following disclaimer in ## the documentation and/or other materials provided with the ## distribution. ## * Neither the name of The Qt Company Ltd nor the names of its ## contributors may be used to endorse or promote products derived ## from this software without specific prior written permission. ## ## ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ## ## $QT_END_LICENSE$ ## ############################################################################ //! [0] def __init__(self, parent): QSpinBox.__init__(self, parent) //! [0] //! [1] def valueFromText(self, text): regExp = QRegExp(tr("(\\d+)(\\s*[xx]\\s*\\d+)?")) if regExp.exactMatch(text): return regExp.cap(1).toInt() else: return 0 //! [1] //! [2] def textFromValue(self, value): return self.tr("%1 x %1").arg(value) //! [2]
lgpl-2.1
ozbek/al-muazzin
app/src/main/java/islam/adhanalarm/widget/NextNotificationWidgetProvider.java
2682
package islam.adhanalarm.widget; import islam.adhanalarm.Schedule; import islam.adhanalarm.util.LocaleManager; import uz.efir.muazzin.Muazzin; import uz.efir.muazzin.R; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.text.format.DateFormat; import android.widget.RemoteViews; import java.text.SimpleDateFormat; import java.util.GregorianCalendar; public class NextNotificationWidgetProvider extends AppWidgetProvider { private static final int[] times = new int[] { R.string.fajr, R.string.sunrise, R.string.dhuhr, R.string.asr, R.string.maghrib, R.string.ishaa, R.string.next_fajr }; @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { setNextTime(context, appWidgetManager, appWidgetIds); super.onUpdate(context, appWidgetManager, appWidgetIds); } public static void setNextTime(Context context) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, NextNotificationWidgetProvider.class)); setNextTime(context, appWidgetManager, appWidgetIds); } private static void setNextTime(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { LocaleManager lm = LocaleManager.getInstance(context, false); SimpleDateFormat timeFormat = new SimpleDateFormat("h:mm a", lm.getLocale(context)); if (DateFormat.is24HourFormat(context)) { timeFormat = new SimpleDateFormat("k:mm", lm.getLocale(context)); } final int nextTimeIndex = Schedule.today(context).nextTimeIndex(); final GregorianCalendar nextTime = Schedule.today(context).getTimes()[nextTimeIndex]; for (int i = 0; i < appWidgetIds.length; i++) { RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_next_notification); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, new Intent(context, Muazzin.class), 0); views.setOnClickPendingIntent(R.id.widget_next_notification, pendingIntent); views.setTextViewText(R.id.time_name, context.getString(times[nextTimeIndex])); views.setTextViewText(R.id.next_notification, timeFormat.format(nextTime.getTime())); appWidgetManager.updateAppWidget(appWidgetIds[i], views); } } }
lgpl-2.1
Fosstrak/fosstrak.github.io
reader/apidocs/org/fosstrak/reader/rprm/core/msg/command/class-use/TimeStampReturnType.html
9129
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_07) on Tue Jul 29 17:22:18 CEST 2008 --> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <TITLE> Uses of Class org.fosstrak.reader.rprm.core.msg.command.TimeStampReturnType (reader 0.5.1-SNAPSHOT API) </TITLE> <META NAME="date" CONTENT="2008-07-29"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.fosstrak.reader.rprm.core.msg.command.TimeStampReturnType (reader 0.5.1-SNAPSHOT API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../org/fosstrak/reader/rprm/core/msg/command/TimeStampReturnType.html" title="class in org.fosstrak.reader.rprm.core.msg.command"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../../index.html?org/fosstrak/reader/rprm/core/msg/command/\class-useTimeStampReturnType.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="TimeStampReturnType.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>org.fosstrak.reader.rprm.core.msg.command.TimeStampReturnType</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../../../../../../org/fosstrak/reader/rprm/core/msg/command/TimeStampReturnType.html" title="class in org.fosstrak.reader.rprm.core.msg.command">TimeStampReturnType</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.fosstrak.reader.rprm.core.msg.command"><B>org.fosstrak.reader.rprm.core.msg.command</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.fosstrak.reader.rprm.core.msg.command"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../../../../../org/fosstrak/reader/rprm/core/msg/command/TimeStampReturnType.html" title="class in org.fosstrak.reader.rprm.core.msg.command">TimeStampReturnType</A> in <A HREF="../../../../../../../../org/fosstrak/reader/rprm/core/msg/command/package-summary.html">org.fosstrak.reader.rprm.core.msg.command</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../../../../org/fosstrak/reader/rprm/core/msg/command/package-summary.html">org.fosstrak.reader.rprm.core.msg.command</A> that return <A HREF="../../../../../../../../org/fosstrak/reader/rprm/core/msg/command/TimeStampReturnType.html" title="class in org.fosstrak.reader.rprm.core.msg.command">TimeStampReturnType</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../../../org/fosstrak/reader/rprm/core/msg/command/TimeStampReturnType.html" title="class in org.fosstrak.reader.rprm.core.msg.command">TimeStampReturnType</A></CODE></FONT></TD> <TD><CODE><B>ObjectFactory.</B><B><A HREF="../../../../../../../../org/fosstrak/reader/rprm/core/msg/command/ObjectFactory.html#createTimeStampReturnType()">createTimeStampReturnType</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create an instance of <A HREF="../../../../../../../../org/fosstrak/reader/rprm/core/msg/command/TimeStampReturnType.html" title="class in org.fosstrak.reader.rprm.core.msg.command"><CODE>TimeStampReturnType</CODE></A></TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../org/fosstrak/reader/rprm/core/msg/command/TimeStampReturnType.html" title="class in org.fosstrak.reader.rprm.core.msg.command"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../../index.html?org/fosstrak/reader/rprm/core/msg/command/\class-useTimeStampReturnType.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="TimeStampReturnType.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> Copyright &#169; 2008. All Rights Reserved. </BODY> </HTML>
lgpl-2.1
cpritam/moose
framework/src/materials/Material.C
6500
/****************************************************************/ /* DO NOT MODIFY THIS HEADER */ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* (c) 2010 Battelle Energy Alliance, LLC */ /* ALL RIGHTS RESERVED */ /* */ /* Prepared by Battelle Energy Alliance, LLC */ /* Under Contract No. DE-AC07-05ID14517 */ /* With the U. S. Department of Energy */ /* */ /* See COPYRIGHT for full restrictions */ /****************************************************************/ #include "Material.h" #include "SubProblem.h" #include "MaterialData.h" // system includes #include <iostream> template<> InputParameters validParams<Material>() { InputParameters params = validParams<MooseObject>(); params += validParams<BlockRestrictable>(); params += validParams<BoundaryRestrictable>(); params.addParam<bool>("use_displaced_mesh", false, "Whether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used."); // Outputs params += validParams<OutputInterface>(); params.set<std::vector<OutputName> >("outputs") = std::vector<OutputName>(1, "none"); params.addParam<std::vector<std::string> >("output_properties", "List of material properties, from this material, to output (outputs must also be defined to an output type)"); params.addParamNamesToGroup("outputs output_properties", "Outputs"); params.addParamNamesToGroup("use_displaced_mesh", "Advanced"); params.registerBase("Material"); return params; } Material::Material(const std::string & name, InputParameters parameters) : MooseObject(name, parameters), BlockRestrictable(name, parameters), BoundaryRestrictable(name, parameters), SetupInterface(parameters), Coupleable(parameters, false), MooseVariableDependencyInterface(), ScalarCoupleable(parameters), FunctionInterface(parameters), UserObjectInterface(parameters), TransientInterface(parameters, name, "materials"), MaterialPropertyInterface(name, parameters), PostprocessorInterface(parameters), DependencyResolverInterface(), Restartable(name, parameters, "Materials"), ZeroInterface(parameters), MeshChangedInterface(parameters), // The false flag disables the automatic call buildOutputVariableHideList; // for Material objects the hide lists are handled by MaterialOutputAction OutputInterface(name, parameters, false), _subproblem(*parameters.get<SubProblem *>("_subproblem")), _fe_problem(*parameters.get<FEProblem *>("_fe_problem")), _tid(parameters.get<THREAD_ID>("_tid")), _assembly(_subproblem.assembly(_tid)), _bnd(parameters.get<bool>("_bnd")), _neighbor(getParam<bool>("_neighbor")), _material_data(*parameters.get<MaterialData *>("_material_data")), _qp(std::numeric_limits<unsigned int>::max()), _qrule(_bnd ? _assembly.qRuleFace() : _assembly.qRule()), _JxW(_bnd ? _assembly.JxWFace() : _assembly.JxW()), _coord(_assembly.coordTransformation()), _q_point(_bnd ? _assembly.qPointsFace() : _assembly.qPoints()), _normals(_assembly.normals()), _current_elem(_neighbor ? _assembly.neighbor() : _assembly.elem()), _current_side(_neighbor ? _assembly.neighborSide() : _assembly.side()), _mesh(_subproblem.mesh()), _coord_sys(_assembly.coordSystem()), _has_stateful_property(false) { // Fill in the MooseVariable dependencies const std::vector<MooseVariable *> & coupled_vars = getCoupledMooseVars(); for (unsigned int i=0; i<coupled_vars.size(); i++) addMooseVariableDependency(coupled_vars[i]); } Material::~Material() { } void Material::computeProperties() { for (_qp = 0; _qp < _qrule->n_points(); ++_qp) computeQpProperties(); } void Material::initStatefulProperties(unsigned int n_points) { if (_has_stateful_property) for (_qp = 0; _qp < n_points; ++_qp) initQpStatefulProperties(); } void Material::initQpStatefulProperties() { mooseDoOnce(mooseWarning(std::string("Material \"") + _name + "\" declares one or more stateful properties but initQpStatefulProperties() was not overridden in the derived class.")); } void Material::computeQpProperties() { } void Material::timeStepSetup() {} QpData * Material::createData() { return NULL; } void Material::checkStatefulSanity() const { for (std::map<std::string, int>::const_iterator it = _props_to_flags.begin(); it != _props_to_flags.end(); ++it) { if (static_cast<int>(it->second) % 2 == 0) // Only Stateful properties declared! mooseError("Material '" << _name << "' has stateful properties declared but not associated \"current\" properties." << it->second); } } void Material::registerPropName(std::string prop_name, bool is_get, Material::Prop_State state) { if (!is_get) { _props_to_flags[prop_name] |= static_cast<int>(state); if (static_cast<int>(state) % 2 == 0) _has_stateful_property = true; } // Store material properties for block ids for (std::set<SubdomainID>::const_iterator it = blockIDs().begin(); it != blockIDs().end(); ++it) { // Only save this prop as a "supplied" prop is it was registered as a result of a call to declareProperty not getMaterialProperty if (!is_get) _supplied_props.insert(prop_name); _fe_problem.storeMatPropName(*it, prop_name); _subproblem.storeMatPropName(*it, prop_name); } // Store material properties for the boundary ids for (std::set<BoundaryID>::const_iterator it = boundaryIDs().begin(); it != boundaryIDs().end(); ++it) { /// \todo{see ticket #2192} // Only save this prop as a "supplied" prop is it was registered as a result of a call to declareProperty not getMaterialProperty if (!is_get) _supplied_props.insert(prop_name); _fe_problem.storeMatPropName(*it, prop_name); _subproblem.storeMatPropName(*it, prop_name); } } std::set<OutputName> Material::getOutputs() { return std::set<OutputName>(getParam<std::vector<OutputName> >("outputs").begin(), getParam<std::vector<OutputName> >("outputs").end()); }
lgpl-2.1
loovjo/Bloovtech
src/main/java/com/loovjo/bloovtech/tileentity/TileEntityInfuser.java
142
package com.loovjo.bloovtech.tileentity; import net.minecraft.tileentity.TileEntity; public class TileEntityInfuser extends TileEntity { }
lgpl-2.1
NAM-IL/VLC-2_2_0
src/misc/messages.c
9762
/***************************************************************************** * messages.c: messages interface * This library provides an interface to the message queue to be used by other * modules, especially intf modules. See vlc_config.h for output configuration. ***************************************************************************** * Copyright (C) 1998-2005 VLC authors and VideoLAN * $Id: f75fd67e7a401daf41e5d0947b4228f51806c485 $ * * Authors: Vincent Seguin <seguin@via.ecp.fr> * Samuel Hocevar <sam@zoy.org> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <stdlib.h> #include <stdarg.h> /* va_list for BSD */ #include <unistd.h> #include <vlc_common.h> #include <vlc_interface.h> #include <vlc_charset.h> #include "../libvlc.h" #ifdef __ANDROID__ #include <android/log.h> #endif /** * Emit a log message. * \param obj VLC object emitting the message or NULL * \param type VLC_MSG_* message type (info, error, warning or debug) * \param module name of module from which the message come * (normally MODULE_STRING) * \param format printf-like message format */ void vlc_Log (vlc_object_t *obj, int type, const char *module, const char *format, ... ) { va_list args; va_start (args, format); vlc_vaLog (obj, type, module, format, args); va_end (args); } #ifdef _WIN32 static void Win32DebugOutputMsg (void *, int , const vlc_log_t *, const char *, va_list); #endif /** * Emit a log message. This function is the variable argument list equivalent * to vlc_Log(). */ void vlc_vaLog (vlc_object_t *obj, int type, const char *module, const char *format, va_list args) { if (obj != NULL && obj->i_flags & OBJECT_FLAGS_QUIET) return; /* Get basename from the module filename */ char *p = strrchr(module, '/'); if (p != NULL) module = p; p = strchr(module, '.'); size_t modlen = (p != NULL) ? (p - module) : 1; char modulebuf[modlen + 1]; if (p != NULL) { memcpy(modulebuf, module, modlen); modulebuf[modlen] = '\0'; module = modulebuf; } /* Fill message information fields */ vlc_log_t msg; msg.i_object_id = (uintptr_t)obj; msg.psz_object_type = (obj != NULL) ? obj->psz_object_type : "generic"; msg.psz_module = module; msg.psz_header = NULL; for (vlc_object_t *o = obj; o != NULL; o = o->p_parent) if (o->psz_header != NULL) { msg.psz_header = o->psz_header; break; } /* Pass message to the callback */ libvlc_priv_t *priv = obj ? libvlc_priv (obj->p_libvlc) : NULL; #ifdef _WIN32 va_list ap; va_copy (ap, args); Win32DebugOutputMsg (priv ? &priv->log.verbose : NULL, type, &msg, format, ap); va_end (ap); #endif if (priv) { vlc_rwlock_rdlock (&priv->log.lock); priv->log.cb (priv->log.opaque, type, &msg, format, args); vlc_rwlock_unlock (&priv->log.lock); } } static const char msg_type[4][9] = { "", " error", " warning", " debug" }; #define COL(x,y) "\033[" #x ";" #y "m" #define RED COL(31,1) #define GREEN COL(32,1) #define YELLOW COL(0,33) #define WHITE COL(0,1) #define GRAY "\033[0m" static const char msg_color[4][8] = { WHITE, RED, YELLOW, GRAY }; /* Display size of a pointer */ static const int ptr_width = 2 * /* hex digits */ sizeof(uintptr_t); static void PrintColorMsg (void *d, int type, const vlc_log_t *p_item, const char *format, va_list ap) { FILE *stream = stderr; int verbose = (intptr_t)d; if (verbose < 0 || verbose < (type - VLC_MSG_ERR)) return; int canc = vlc_savecancel (); flockfile (stream); utf8_fprintf (stream, "["GREEN"%0*"PRIxPTR""GRAY"] ", ptr_width, p_item->i_object_id); if (p_item->psz_header != NULL) utf8_fprintf (stream, "[%s] ", p_item->psz_header); utf8_fprintf (stream, "%s %s%s: %s", p_item->psz_module, p_item->psz_object_type, msg_type[type], msg_color[type]); utf8_vfprintf (stream, format, ap); fputs (GRAY"\n", stream); #if defined (_WIN32) || defined (__OS2__) fflush (stream); #endif funlockfile (stream); vlc_restorecancel (canc); } static void PrintMsg (void *d, int type, const vlc_log_t *p_item, const char *format, va_list ap) { FILE *stream = stderr; int verbose = (intptr_t)d; if (verbose < 0 || verbose < (type - VLC_MSG_ERR)) return; int canc = vlc_savecancel (); flockfile (stream); utf8_fprintf (stream, "[%0*"PRIxPTR"] ", ptr_width, p_item->i_object_id); if (p_item->psz_header != NULL) utf8_fprintf (stream, "[%s] ", p_item->psz_header); utf8_fprintf (stream, "%s %s%s: ", p_item->psz_module, p_item->psz_object_type, msg_type[type]); utf8_vfprintf (stream, format, ap); putc_unlocked ('\n', stream); #if defined (_WIN32) || defined (__OS2__) fflush (stream); #endif funlockfile (stream); vlc_restorecancel (canc); } #ifdef _WIN32 static void Win32DebugOutputMsg (void* d, int type, const vlc_log_t *p_item, const char *format, va_list dol) { VLC_UNUSED(p_item); const signed char *pverbose = d; if (pverbose && (*pverbose < 0 || *pverbose < (type - VLC_MSG_ERR))) return; va_list dol2; va_copy (dol2, dol); int msg_len = vsnprintf(NULL, 0, format, dol2); va_end (dol2); if(msg_len <= 0) return; char *msg = malloc(msg_len + 1 + 1); if (!msg) return; msg_len = vsnprintf(msg, msg_len+1, format, dol); if (msg_len > 0){ if(msg[msg_len-1] != '\n'){ msg[msg_len] = '\n'; msg[msg_len + 1] = '\0'; } char* psz_msg = NULL; if(asprintf(&psz_msg, "%s %s%s: %s", p_item->psz_module, p_item->psz_object_type, msg_type[type], msg) > 0) { wchar_t* wmsg = ToWide(psz_msg); OutputDebugStringW(wmsg); free(wmsg); free(psz_msg); } } free(msg); } #endif #ifdef __ANDROID__ static void AndroidPrintMsg (void *d, int type, const vlc_log_t *p_item, const char *format, va_list ap) { int verbose = (intptr_t)d; int prio; if (verbose < 0 || verbose < (type - VLC_MSG_ERR)) return; int canc = vlc_savecancel (); char *format2; if (asprintf (&format2, "[%0*"PRIxPTR"] %s %s: %s", ptr_width, p_item->i_object_id, p_item->psz_module, p_item->psz_object_type, format) < 0) return; switch (type) { case VLC_MSG_INFO: prio = ANDROID_LOG_INFO; break; case VLC_MSG_ERR: prio = ANDROID_LOG_ERROR; break; case VLC_MSG_WARN: prio = ANDROID_LOG_WARN; break; default: case VLC_MSG_DBG: prio = ANDROID_LOG_DEBUG; } __android_log_vprint (prio, "VLC", format2, ap); free (format2); vlc_restorecancel (canc); } #endif /** * Sets the message logging callback. * \param cb message callback, or NULL to reset * \param data data pointer for the message callback */ void vlc_LogSet (libvlc_int_t *vlc, vlc_log_cb cb, void *opaque) { libvlc_priv_t *priv = libvlc_priv (vlc); if (cb == NULL) { #ifdef __ANDROID__ cb = AndroidPrintMsg; #else #if defined (HAVE_ISATTY) && !defined (_WIN32) if (isatty (STDERR_FILENO) && var_InheritBool (vlc, "color")) cb = PrintColorMsg; else #endif cb = PrintMsg; #endif // __ANDROID__ opaque = (void *)(intptr_t)priv->log.verbose; } vlc_rwlock_wrlock (&priv->log.lock); priv->log.cb = cb; priv->log.opaque = opaque; vlc_rwlock_unlock (&priv->log.lock); /* Announce who we are */ msg_Dbg (vlc, "VLC media player - %s", VERSION_MESSAGE); msg_Dbg (vlc, "%s", COPYRIGHT_MESSAGE); msg_Dbg (vlc, "revision %s", psz_vlc_changeset); msg_Dbg (vlc, "configured with %s", CONFIGURE_LINE); } void vlc_LogInit (libvlc_int_t *vlc) { libvlc_priv_t *priv = libvlc_priv (vlc); const char *str; if (var_InheritBool (vlc, "quiet")) priv->log.verbose = -1; else if ((str = getenv ("VLC_VERBOSE")) != NULL) priv->log.verbose = atoi (str); else priv->log.verbose = var_InheritInteger (vlc, "verbose"); vlc_rwlock_init (&priv->log.lock); vlc_LogSet (vlc, NULL, NULL); } void vlc_LogDeinit (libvlc_int_t *vlc) { libvlc_priv_t *priv = libvlc_priv (vlc); vlc_rwlock_destroy (&priv->log.lock); }
lgpl-2.1
orbeon/orbeon-forms
core-cross-platform/shared/src/main/scala/org/orbeon/oxf/xml/saxrewrite/DocumentRootState.scala
1150
package org.orbeon.oxf.xml.saxrewrite import org.orbeon.oxf.xml.XMLReceiver import org.xml.sax.Attributes /** * Ignores everything before start element except for processing instructions. On startElement switches to nextState. * * So if this is used as the initial state then the result is that the prologue and epilogue are ignored (except * processing instructions) while the root element is passed to the next state. nextState is initialized to this, * consequently nothing interesting will happen unless setNext is called. */ class DocumentRootState(previousState: State, xmlReceiver: XMLReceiver) extends State(previousState, xmlReceiver) { protected var nextState: State = this protected def startElementStart(ns: String, lnam: String, qnam: String, atts: Attributes): State = if (nextState eq this) this else nextState.startElement(ns, lnam, qnam, atts) def setNextState(nextState: State): Unit = this.nextState = nextState override def characters (ch: Array[Char], strt: Int, len: Int): State = this override def ignorableWhitespace(ch: Array[Char], strt: Int, len: Int): State = this }
lgpl-2.1
bb-generation/infinote
libinfinity/server/infd-directory.c
136118
/* libinfinity - a GObject-based infinote implementation * Copyright (C) 2007-2011 Armin Burgmeier <armin@arbur.net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301, USA. */ /** * SECTION:infd-directory * @short_description: Directory of published documents * @see_also: #InfcBrowser, #InfdStorage * @include: libinfinity/server/infd-directory.h * @stability: Unstable * * The #InfdDirectory manages a directory of documents. An item in the * directory is also called &quot;node&quot;. A node may either be a * subdirectory or a document (also called "note"). Notes may be of * different type - there may be plain text notes, rich text notes, * graphics notes, etc. * * #InfdStorage defines where the directory structure and the notes are read * from and how there are permanently stored. **/ #include <libinfinity/server/infd-directory.h> #include <libinfinity/common/inf-session.h> #include <libinfinity/common/inf-chat-session.h> #include <libinfinity/common/inf-error.h> #include <libinfinity/common/inf-protocol.h> #include <libinfinity/common/inf-xml-util.h> #include <libinfinity/communication/inf-communication-object.h> #include <libinfinity/inf-marshal.h> #include <libinfinity/inf-i18n.h> #include <libinfinity/inf-signals.h> #include <string.h> typedef struct _InfdDirectoryNode InfdDirectoryNode; struct _InfdDirectoryNode { InfdDirectoryNode* parent; InfdDirectoryNode* prev; InfdDirectoryNode* next; InfdStorageNodeType type; guint id; gchar* name; union { struct { /* Running session, or NULL */ InfdSessionProxy* session; /* Session type */ const InfdNotePlugin* plugin; /* Timeout to save the session when inactive for some time */ InfIoTimeout* save_timeout; } note; struct { /* List of connections that have this folder open and have to be * notified if something happens with it. */ GSList* connections; /* First child node */ InfdDirectoryNode* child; /* Whether we requested the node already from the background storage. * This is required because the nodes field may be NULL due to an empty * subdirectory or due to an unexplored subdirectory. */ gboolean explored; } subdir; } shared; }; typedef struct _InfdDirectorySessionSaveTimeoutData InfdDirectorySessionSaveTimeoutData; struct _InfdDirectorySessionSaveTimeoutData { InfdDirectory* directory; InfdDirectoryNode* node; }; typedef struct _InfdDirectorySyncIn InfdDirectorySyncIn; struct _InfdDirectorySyncIn { InfdDirectory* directory; InfdDirectoryNode* parent; guint node_id; gchar* name; const InfdNotePlugin* plugin; InfdSessionProxy* proxy; }; typedef enum _InfdDirectorySubreqType { INFD_DIRECTORY_SUBREQ_CHAT, INFD_DIRECTORY_SUBREQ_SESSION, INFD_DIRECTORY_SUBREQ_ADD_NODE, INFD_DIRECTORY_SUBREQ_SYNC_IN, INFD_DIRECTORY_SUBREQ_SYNC_IN_SUBSCRIBE } InfdDirectorySubreqType; /* Subscription request */ typedef struct _InfdDirectorySubreq InfdDirectorySubreq; struct _InfdDirectorySubreq { InfdDirectorySubreqType type; InfXmlConnection* connection; /* TODO: Should maybe go to shared as CHAT is not using this: */ guint node_id; union { struct { InfdSessionProxy* session; } session; struct { InfdDirectoryNode* parent; InfCommunicationHostedGroup* group; const InfdNotePlugin* plugin; gchar* name; /* TODO: Isn't group already present in proxy? */ InfdSessionProxy* proxy; } add_node; struct { InfdDirectoryNode* parent; InfCommunicationHostedGroup* synchronization_group; InfCommunicationHostedGroup* subscription_group; const InfdNotePlugin* plugin; gchar* name; /* TODO: Aren't the groups already present in proxy? */ InfdSessionProxy* proxy; } sync_in; } shared; }; typedef struct _InfdDirectoryConnectionInfo InfdDirectoryConnectionInfo; struct _InfdDirectoryConnectionInfo { guint seq_id; }; typedef struct _InfdDirectoryPrivate InfdDirectoryPrivate; struct _InfdDirectoryPrivate { InfIo* io; InfdStorage* storage; InfCommunicationManager* communication_manager; InfCommunicationHostedGroup* group; GHashTable* plugins; /* Registered plugins */ GHashTable* connections; /* Connection infos */ guint node_counter; GHashTable* nodes; /* Mapping from id to node */ InfdDirectoryNode* root; GSList* sync_ins; GSList* subscription_requests; InfdSessionProxy* chat_session; }; enum { PROP_0, PROP_IO, PROP_STORAGE, PROP_COMMUNICATION_MANAGER, /* read only */ PROP_CHAT_SESSION }; enum { NODE_ADDED, NODE_REMOVED, ADD_SESSION, REMOVE_SESSION, LAST_SIGNAL }; #define INFD_DIRECTORY_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), INFD_TYPE_DIRECTORY, InfdDirectoryPrivate)) /* These make sure that the node iter points to is contained in directory */ #define infd_directory_return_if_iter_fail(directory, iter) \ g_return_if_fail( \ g_hash_table_lookup( \ INFD_DIRECTORY_PRIVATE(INFD_DIRECTORY(directory))->nodes, \ GUINT_TO_POINTER((iter)->node_id) \ ) == (iter)->node \ ) #define infd_directory_return_val_if_iter_fail(directory, iter, val) \ g_return_val_if_fail( \ g_hash_table_lookup( \ INFD_DIRECTORY_PRIVATE(INFD_DIRECTORY(directory))->nodes, \ GUINT_TO_POINTER((iter)->node_id) \ ) == (iter)->node, \ val \ ) /* These make sure that node is a subdirectory node */ #define infd_directory_return_if_subdir_fail(node) \ g_return_if_fail( \ ((InfdDirectoryNode*)node)->type == INFD_STORAGE_NODE_SUBDIRECTORY \ ) #define infd_directory_return_val_if_subdir_fail(node, val) \ g_return_val_if_fail( \ ((InfdDirectoryNode*)node)->type == INFD_STORAGE_NODE_SUBDIRECTORY, \ val \ ) static GObjectClass* parent_class; static guint directory_signals[LAST_SIGNAL]; static GQuark infd_directory_node_id_quark; /* Time a session needs to be idle before it is unloaded from RAM */ /* TODO: This should be a property: */ static const guint INFD_DIRECTORY_SAVE_TIMEOUT = 60000; /* * Path handling. */ /* Returns the complete path to this node in the given GString */ static void infd_directory_node_get_path_string(InfdDirectoryNode* node, GString* string) { g_return_if_fail(node != NULL); g_return_if_fail(string != NULL); if(node->parent != NULL) { /* Each node except the root node has a name */ g_assert(node->name != NULL); /* Make sure to not recurse if our parent is the root node because * this would add an additional slash */ if(node->parent->parent != NULL) infd_directory_node_get_path_string(node->parent, string); g_string_append_c(string, '/'); g_string_append(string, node->name); } else { /* This node has no parent, so it is the root node */ g_assert(node->name == NULL); g_string_append_c(string, '/'); } } static void infd_directory_node_get_path(InfdDirectoryNode* node, gchar** path, gsize* len) { GString* str; g_return_if_fail(node != NULL); g_return_if_fail(path != NULL); str = g_string_sized_new(128); infd_directory_node_get_path_string(node, str); *path = str->str; if(len != NULL) *len = str->len; g_string_free(str, FALSE); } static void infd_directory_node_make_path(InfdDirectoryNode* node, const gchar* name, gchar** path, gsize* len) { GString* str; g_return_if_fail(node != NULL); g_return_if_fail(name != NULL); g_return_if_fail(path != NULL); str = g_string_sized_new(128); infd_directory_node_get_path_string(node, str); if(node->parent != NULL) g_string_append_c(str, '/'); g_string_append(str, name); *path = str->str; if(len != NULL) *len = str->len; g_string_free(str, FALSE); } /* * Save timeout */ /* Required by infd_directory_session_save_timeout_func() */ static void infd_directory_node_unlink_session(InfdDirectory* directory, InfdDirectoryNode* node); static void infd_directory_session_save_timeout_data_free(gpointer data) { g_slice_free(InfdDirectorySessionSaveTimeoutData, data); } static void infd_directory_session_save_timeout_func(gpointer user_data) { InfdDirectorySessionSaveTimeoutData* timeout_data; InfdDirectoryPrivate* priv; GError* error; gchar* path; gboolean result; timeout_data = (InfdDirectorySessionSaveTimeoutData*)user_data; g_assert(timeout_data->node->type == INFD_STORAGE_NODE_NOTE); g_assert(timeout_data->node->shared.note.save_timeout != NULL); priv = INFD_DIRECTORY_PRIVATE(timeout_data->directory); error = NULL; infd_directory_node_get_path(timeout_data->node, &path, NULL); result = timeout_data->node->shared.note.plugin->session_write( priv->storage, infd_session_proxy_get_session(timeout_data->node->shared.note.session), path, timeout_data->node->shared.note.plugin->user_data, &error ); /* TODO: Unset modified flag of buffer if result == TRUE */ /* The timeout is removed automatically after it has elapsed */ timeout_data->node->shared.note.save_timeout = NULL; if(result == FALSE) { g_warning( _("Failed to save note \"%s\": %s\n\nKeeping it in memory. Another " "save attempt will be made when the server is shut down."), path, error->message ); g_error_free(error); } else { infd_directory_node_unlink_session( timeout_data->directory, timeout_data->node ); } g_free(path); } static void infd_directory_start_session_save_timeout(InfdDirectory* directory, InfdDirectoryNode* node) { InfdDirectoryPrivate* priv; InfdDirectorySessionSaveTimeoutData* timeout_data; priv = INFD_DIRECTORY_PRIVATE(directory); timeout_data = g_slice_new(InfdDirectorySessionSaveTimeoutData); timeout_data->directory = directory; timeout_data->node = node; if(priv->storage != NULL) { node->shared.note.save_timeout = inf_io_add_timeout( priv->io, INFD_DIRECTORY_SAVE_TIMEOUT, infd_directory_session_save_timeout_func, timeout_data, infd_directory_session_save_timeout_data_free ); } } static void infd_directory_session_idle_notify_cb(GObject* object, GParamSpec* pspec, gpointer user_data) { InfdDirectory* directory; InfdDirectoryPrivate* priv; gpointer node_id; InfdDirectoryNode* node; directory = INFD_DIRECTORY(user_data); priv = INFD_DIRECTORY_PRIVATE(directory); node_id = g_object_get_qdata(object, infd_directory_node_id_quark); node = g_hash_table_lookup(priv->nodes, node_id); g_assert(node != NULL); /* Drop session from memory if it remains idle */ if(infd_session_proxy_is_idle(INFD_SESSION_PROXY(object))) { if(node->shared.note.save_timeout == NULL) { infd_directory_start_session_save_timeout(directory, node); } } else { if(node->shared.note.save_timeout != NULL) { inf_io_remove_timeout(priv->io, node->shared.note.save_timeout); node->shared.note.save_timeout = NULL; } } } /* * Node construction and removal */ /* Creates the subscription group for a node, named "InfSession_%u", %u being * the node id (which should be unique). */ static InfCommunicationHostedGroup* infd_directory_create_subscription_group(InfdDirectory* directory, guint node_id) { InfdDirectoryPrivate* priv; InfCommunicationHostedGroup* group; gchar* group_name; /* TODO: For the moment, there only exist central methods anyway. In the * long term, this should probably be a property, though. */ static const gchar* const methods[] = { "central", NULL }; priv = INFD_DIRECTORY_PRIVATE(directory); group_name = g_strdup_printf("InfSession_%u", node_id); group = inf_communication_manager_open_group( priv->communication_manager, group_name, methods ); g_free(group_name); return group; } static InfdSessionProxy* infd_directory_create_session_proxy_with_group(InfdDirectory* directory, InfSession* session, InfCommunicationHostedGroup* g) { InfdSessionProxy* proxy; g_assert( inf_communication_group_get_target(INF_COMMUNICATION_GROUP(g)) == NULL ); proxy = INFD_SESSION_PROXY( g_object_new( INFD_TYPE_SESSION_PROXY, "session", session, "subscription-group", g, NULL ) ); inf_communication_group_set_target( INF_COMMUNICATION_GROUP(g), INF_COMMUNICATION_OBJECT(proxy) ); return proxy; } static InfdSessionProxy* infd_directory_create_session_proxy_for_node(InfdDirectory* directory, guint node_id, InfSession* session) { InfdDirectoryPrivate* priv; InfCommunicationHostedGroup* group; InfdSessionProxy* proxy; priv = INFD_DIRECTORY_PRIVATE(directory); group = infd_directory_create_subscription_group(directory, node_id); proxy = infd_directory_create_session_proxy_with_group( directory, session, group ); g_object_unref(group); return proxy; } static InfdSessionProxy* infd_directory_create_session_proxy(InfdDirectory* directory, const InfdNotePlugin* plugin, InfSessionStatus status, InfCommunicationHostedGroup* sync_g, InfXmlConnection* sync_conn, InfCommunicationHostedGroup* sub_g) { InfdDirectoryPrivate* priv; InfSession* session; InfdSessionProxy* proxy; g_assert(sub_g != NULL); priv = INFD_DIRECTORY_PRIVATE(directory); session = plugin->session_new( priv->io, priv->communication_manager, status, sync_g, sync_conn, plugin->user_data ); proxy = infd_directory_create_session_proxy_with_group( directory, session, sub_g ); g_object_unref(session); if(sync_g != NULL && sync_g != sub_g) { inf_communication_group_set_target( INF_COMMUNICATION_GROUP(sync_g), INF_COMMUNICATION_OBJECT(proxy) ); } return proxy; } static InfdSessionProxy* infd_directory_create_session_proxy_for_storage( InfdDirectory* directory, InfdDirectoryNode* parent, InfCommunicationHostedGroup* sub_group, const gchar* name, const InfdNotePlugin* plugin, InfSessionStatus status, InfCommunicationHostedGroup* sync_group, InfXmlConnection* sync_conn, GError** error) { InfdDirectoryPrivate* priv; gchar* path; gboolean ret; InfSession* session; InfdSessionProxy* proxy; priv = INFD_DIRECTORY_PRIVATE(directory); proxy = infd_directory_create_session_proxy( directory, plugin, status, sync_group, sync_conn, sub_group); session = infd_session_proxy_get_session(proxy); /* Save session initially */ infd_directory_node_make_path(parent, name, &path, NULL); if(priv->storage != NULL) { ret = plugin->session_write( priv->storage, session, path, plugin->user_data, error ); } else { ret = TRUE; } g_free(path); if(ret == FALSE) { /* Reset communication groups for the proxy, to avoid a warning at * final unref. Due do this failing the groups are very likely going to be * unrefed as well any time soon. */ inf_communication_group_set_target( INF_COMMUNICATION_GROUP(sub_group), NULL ); if(sync_group != NULL && sync_group != sub_group) { inf_communication_group_set_target( INF_COMMUNICATION_GROUP(sync_group), NULL ); } g_object_unref(proxy); return NULL; } return proxy; } /* Links a InfdSessionProxy with a InfdDirectoryNode */ static void infd_directory_node_link_session(InfdDirectory* directory, InfdDirectoryNode* node, InfdSessionProxy* proxy) { InfdDirectoryPrivate* priv; InfdDirectoryIter iter; priv = INFD_DIRECTORY_PRIVATE(directory); g_assert(node->type == INFD_STORAGE_NODE_NOTE); g_assert(node->shared.note.session == NULL); iter.node = node; iter.node_id = node->id; g_signal_emit( G_OBJECT(directory), directory_signals[ADD_SESSION], 0, &iter, proxy ); } static void infd_directory_node_unlink_session(InfdDirectory* directory, InfdDirectoryNode* node) { InfdDirectoryPrivate* priv; InfdDirectoryIter iter; priv = INFD_DIRECTORY_PRIVATE(directory); g_assert(node->type == INFD_STORAGE_NODE_NOTE); g_assert(node->shared.note.session != NULL); iter.node = node; iter.node_id = node->id; /* TODO: We could still weakref the session, to continue using it if * others need it anyway. We just need to strongref it again if it becomes * non-idle. */ g_signal_emit( G_OBJECT(directory), directory_signals[REMOVE_SESSION], 0, &iter, node->shared.note.session ); } static void infd_directory_node_unlink_child_sessions(InfdDirectory* directory, InfdDirectoryNode* node, gboolean save_notes) { InfdDirectoryPrivate* priv; InfdDirectoryNode* child; gchar* path; GError* error; priv = INFD_DIRECTORY_PRIVATE(directory); switch(node->type) { case INFD_STORAGE_NODE_SUBDIRECTORY: if(node->shared.subdir.explored == TRUE) { for(child = node->shared.subdir.child; child != NULL; child = child->next) { infd_directory_node_unlink_child_sessions( directory, child, save_notes ); } } break; case INFD_STORAGE_NODE_NOTE: if(node->shared.note.session != NULL) { if(save_notes) { infd_directory_node_get_path(node, &path, NULL); error = NULL; if(priv->storage != NULL) { node->shared.note.plugin->session_write( priv->storage, infd_session_proxy_get_session(node->shared.note.session), path, node->shared.note.plugin->user_data, &error ); } /* TODO: Unset modified flag of buffer if result == TRUE */ if(error != NULL) { /* There is not really anything we could do about it here. Of * course, any application should save the sessions explicitely * before shutting the directory down, so that it has the chance to * cancel the shutdown if the session could not be saved. */ /* TODO: We could try saving the session somewhere in /tmp, for * example via to_xml_sync. */ g_warning( _("Could not write session \"%s\" to storage: %s\n\nAll changes " "since the document das been saved are lost."), path, error->message ); g_error_free(error); } g_free(path); } infd_directory_node_unlink_session(directory, node); } break; default: g_assert_not_reached(); break; } } static void infd_directory_node_link(InfdDirectoryNode* node, InfdDirectoryNode* parent) { g_return_if_fail(node != NULL); g_return_if_fail(parent != NULL); infd_directory_return_if_subdir_fail(parent); node->prev = NULL; if(parent->shared.subdir.child != NULL) { parent->shared.subdir.child->prev = node; node->next = parent->shared.subdir.child; } else { node->next = NULL; } parent->shared.subdir.child = node; } static void infd_directory_node_unlink(InfdDirectoryNode* node) { g_return_if_fail(node != NULL); g_return_if_fail(node->parent != NULL); if(node->prev != NULL) { node->prev->next = node->next; } else { g_assert(node->parent->type == INFD_STORAGE_NODE_SUBDIRECTORY); node->parent->shared.subdir.child = node->next; } if(node->next != NULL) node->next->prev = node->prev; } /* This function takes ownership of name */ static InfdDirectoryNode* infd_directory_node_new_common(InfdDirectory* directory, InfdDirectoryNode* parent, InfdStorageNodeType type, guint node_id, gchar* name) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; priv = INFD_DIRECTORY_PRIVATE(directory); g_assert( g_hash_table_lookup(priv->nodes, GUINT_TO_POINTER(node_id)) == NULL ); node = g_slice_new(InfdDirectoryNode); node->parent = parent; node->type = type; node->id = node_id; node->name = name; if(parent != NULL) { infd_directory_node_link(node, parent); } else { node->prev = NULL; node->next = NULL; } g_hash_table_insert(priv->nodes, GUINT_TO_POINTER(node->id), node); return node; } static InfdDirectoryNode* infd_directory_node_new_subdirectory(InfdDirectory* directory, InfdDirectoryNode* parent, guint node_id, gchar* name) { InfdDirectoryNode* node; node = infd_directory_node_new_common( directory, parent, INFD_STORAGE_NODE_SUBDIRECTORY, node_id, name ); node->shared.subdir.connections = NULL; node->shared.subdir.child = NULL; node->shared.subdir.explored = FALSE; return node; } static InfdDirectoryNode* infd_directory_node_new_note(InfdDirectory* directory, InfdDirectoryNode* parent, guint node_id, gchar* name, const InfdNotePlugin* plugin) { InfdDirectoryNode* node; node = infd_directory_node_new_common( directory, parent, INFD_STORAGE_NODE_NOTE, node_id, name ); node->shared.note.session = NULL; node->shared.note.plugin = plugin; node->shared.note.save_timeout = NULL; return node; } /* Required by infd_directory_node_free() */ static void infd_directory_remove_sync_in(InfdDirectory* directory, InfdDirectorySyncIn* sync_in); static void infd_directory_remove_subreq(InfdDirectory* directory, InfdDirectorySubreq* request); /* Notes are saved into the storage when save_notes is TRUE. */ static void infd_directory_node_free(InfdDirectory* directory, InfdDirectoryNode* node) { InfdDirectoryPrivate* priv; gboolean removed; GSList* item; GSList* next; InfdDirectorySyncIn* sync_in; InfdDirectorySubreq* request; g_return_if_fail(INFD_IS_DIRECTORY(directory)); g_return_if_fail(node != NULL); priv = INFD_DIRECTORY_PRIVATE(directory); switch(node->type) { case INFD_STORAGE_NODE_SUBDIRECTORY: g_slist_free(node->shared.subdir.connections); /* Free child nodes */ if(node->shared.subdir.explored == TRUE) { while(node->shared.subdir.child != NULL) { infd_directory_node_free(directory, node->shared.subdir.child); } } break; case INFD_STORAGE_NODE_NOTE: /* Sessions must have been explicitely unlinked before, so that the * remove-session signal was emitted before any children already have been * removed. */ g_assert(node->shared.note.session == NULL); break; default: g_assert_not_reached(); break; } if(node->parent != NULL) infd_directory_node_unlink(node); /* Remove sync-ins whose parent is gone */ for(item = priv->sync_ins; item != NULL; item = next) { next = item->next; sync_in = (InfdDirectorySyncIn*)item->data; if(sync_in->parent == node) infd_directory_remove_sync_in(directory, sync_in); } for(item = priv->subscription_requests; item != NULL; item = next) { next = item->next; request = (InfdDirectorySubreq*)item->data; switch(request->type) { case INFD_DIRECTORY_SUBREQ_CHAT: break; case INFD_DIRECTORY_SUBREQ_SESSION: /* Keep subscription requests whose parent is gone. They will be * released upon client reply. */ /*if(request->node_id == node->id) infd_directory_remove_subreq(directory, request);*/ break; case INFD_DIRECTORY_SUBREQ_ADD_NODE: if(request->shared.add_node.parent->id == node->id) request->shared.add_node.parent = NULL; break; case INFD_DIRECTORY_SUBREQ_SYNC_IN: case INFD_DIRECTORY_SUBREQ_SYNC_IN_SUBSCRIBE: if(request->shared.sync_in.parent->id == node->id) request->shared.sync_in.parent = NULL; break; default: g_assert_not_reached(); break; } } removed = g_hash_table_remove(priv->nodes, GUINT_TO_POINTER(node->id)); g_assert(removed == TRUE); g_free(node->name); g_slice_free(InfdDirectoryNode, node); } static void infd_directory_node_remove_connection(InfdDirectoryNode* node, InfXmlConnection* connection) { InfdDirectoryNode* child; GSList* item; g_assert(node->type == INFD_STORAGE_NODE_SUBDIRECTORY); g_assert(node->shared.subdir.explored == TRUE); item = g_slist_find(node->shared.subdir.connections, connection); /* Note that if the connection is not in this node's connection list, * then it cannot be in a child's list either. */ if(item != NULL) { node->shared.subdir.connections = g_slist_delete_link( node->shared.subdir.connections, item ); if(node->shared.subdir.explored == TRUE) { for(child = node->shared.subdir.child; child != NULL; child = child->next) { if(child->type == INFD_STORAGE_NODE_SUBDIRECTORY && child->shared.subdir.explored == TRUE) { infd_directory_node_remove_connection(child, connection); } } } else { g_assert(node->shared.subdir.connections == NULL); } } } /* * Node synchronization. */ static xmlNodePtr infd_directory_node_desc_register_to_xml(guint node_id, InfdDirectoryNode* parent, const InfdNotePlugin* plugin, const gchar* name) { xmlNodePtr xml; xml = xmlNewNode(NULL, (const xmlChar*)"add-node"); inf_xml_util_set_attribute_uint(xml, "id", node_id); inf_xml_util_set_attribute_uint(xml, "parent", parent->id); inf_xml_util_set_attribute(xml, "name", name); if(plugin != NULL) inf_xml_util_set_attribute(xml, "type", plugin->note_type); else inf_xml_util_set_attribute(xml, "type", "InfSubdirectory"); return xml; } /* Creates XML request to tell someone about a new node */ static xmlNodePtr infd_directory_node_register_to_xml(InfdDirectoryNode* node) { const InfdNotePlugin* plugin; g_assert(node->parent != NULL); switch(node->type) { case INFD_STORAGE_NODE_SUBDIRECTORY: plugin = NULL; break; case INFD_STORAGE_NODE_NOTE: plugin = node->shared.note.plugin; break; default: g_assert_not_reached(); break; } return infd_directory_node_desc_register_to_xml( node->id, node->parent, plugin, node->name ); } /* Creates XML request to tell someone about a removed node */ static xmlNodePtr infd_directory_node_unregister_to_xml(InfdDirectoryNode* node) { xmlNodePtr xml; gchar id_buf[16]; sprintf(id_buf, "%u", node->id); xml = xmlNewNode(NULL, (const xmlChar*)"remove-node"); xmlNewProp(xml, (const xmlChar*)"id", (const xmlChar*)id_buf); return xml; } static gboolean infd_directory_make_seq(InfdDirectory* directory, InfXmlConnection* connection, xmlNodePtr xml, gchar** seq, GError** error) { InfdDirectoryPrivate* priv; InfdDirectoryConnectionInfo* info; GError* local_error; guint seq_num; priv = INFD_DIRECTORY_PRIVATE(directory); local_error = NULL; if(!inf_xml_util_get_attribute_uint(xml, "seq", &seq_num, &local_error)) { if(local_error) { g_propagate_error(error, local_error); return FALSE; } *seq = NULL; return TRUE; } info = g_hash_table_lookup(priv->connections, connection); g_assert(info != NULL); *seq = g_strdup_printf("%u/%u", info->seq_id, seq_num); return TRUE; } /* Sends a message to the given connections. We cannot always send to all * group members because some messages are only supposed to be sent to * clients that explored a certain subdirectory. */ static void infd_directory_send(InfdDirectory* directory, GSList* connections, InfXmlConnection* exclude, xmlNodePtr xml) { InfdDirectoryPrivate* priv; GSList* item; priv = INFD_DIRECTORY_PRIVATE(directory); if(connections == NULL || (connections->data == exclude && connections->next == NULL)) { xmlFreeNode(xml); } else { for(item = connections; item != NULL; item = g_slist_next(item)) { if(item->data == exclude) continue; /* Do not copy this item if it is the last item to be sent because the * connection manager takes ownership */ if(item->next != NULL && (item->next->data != exclude || item->next->next != NULL)) { inf_communication_group_send_message( INF_COMMUNICATION_GROUP(priv->group), INF_XML_CONNECTION(item->data), xmlCopyNode(xml, 1) ); } else { inf_communication_group_send_message( INF_COMMUNICATION_GROUP(priv->group), INF_XML_CONNECTION(item->data), xml ); } } } } /* Announces the presence of a new node. This is not done in * infd_directory_node_new because we do not want to do this for all * nodes we create (namely not for the root node). */ static void infd_directory_node_register(InfdDirectory* directory, InfdDirectoryNode* node, InfXmlConnection* except, const gchar* seq) { InfdDirectoryPrivate* priv; InfdDirectoryIter iter; xmlNodePtr xml; priv = INFD_DIRECTORY_PRIVATE(directory); iter.node_id = node->id; iter.node = node; g_signal_emit( G_OBJECT(directory), directory_signals[NODE_ADDED], 0, &iter ); if(node->parent->shared.subdir.connections != NULL) { xml = infd_directory_node_register_to_xml(node); if(seq != NULL) inf_xml_util_set_attribute(xml, "seq", seq); infd_directory_send( directory, node->parent->shared.subdir.connections, except, xml ); } } /* Announces that a node is removed. Again, this is not done in * infd_directory_node_free because we do not want to do this for * every subnode if a subdirectory is freed. */ static void infd_directory_node_unregister(InfdDirectory* directory, InfdDirectoryNode* node, const gchar* seq) { InfdDirectoryPrivate* priv; InfdDirectoryIter iter; xmlNodePtr xml; priv = INFD_DIRECTORY_PRIVATE(directory); iter.node_id = node->id; iter.node = node; g_signal_emit( G_OBJECT(directory), directory_signals[NODE_REMOVED], 0, &iter ); xml = infd_directory_node_unregister_to_xml(node); if(seq != NULL) inf_xml_util_set_attribute(xml, "seq", seq); infd_directory_send( directory, node->parent->shared.subdir.connections, NULL, xml ); } static gboolean infd_directory_node_name_equal(const gchar* name1, const gchar* name2) { gchar* f1 = g_utf8_casefold(name1, -1); gchar* f2 = g_utf8_casefold(name2, -1); gboolean result = (g_utf8_collate(f1, f2) == 0); g_free(f2); g_free(f1); return result; } /* * Sync-In */ static void infd_directory_sync_in_synchronization_failed_cb(InfSession* session, InfXmlConnection* connection, const GError* error, gpointer user_data) { /* Synchronization failed. We simple remove the sync-in. There is no further * notification required since the synchronization failed on the remote site * as well. */ InfdDirectorySyncIn* sync_in; sync_in = (InfdDirectorySyncIn*)user_data; infd_directory_remove_sync_in(sync_in->directory, sync_in); } static void infd_directory_sync_in_synchronization_complete_cb(InfSession* session, InfXmlConnection* conn, gpointer user_data) { /* Synchronization done. We can now safely create the node in the directory * tree. */ InfdDirectorySyncIn* sync_in; InfdDirectory* directory; InfdDirectoryPrivate* priv; InfdDirectoryNode* node; gchar* path; gboolean ret; GError* error; sync_in = (InfdDirectorySyncIn*)user_data; directory = sync_in->directory; priv = INFD_DIRECTORY_PRIVATE(directory); node = infd_directory_node_new_note( directory, sync_in->parent, sync_in->node_id, sync_in->name, sync_in->plugin ); infd_directory_node_link_session(directory, node, sync_in->proxy); /* Save session initially */ infd_directory_node_get_path(node, &path, NULL); error = NULL; if(priv->storage != NULL) { ret = sync_in->plugin->session_write( priv->storage, session, path, sync_in->plugin->user_data, &error ); } else { ret = TRUE; } if(ret == FALSE) { /* Note that while indeed this may fail in theory we have already * (successfully) written the session before we started the sync-in, so * the name of the node is accepted by the storage backend. */ g_warning( _("Session \"%s\" could not be saved: %s\nAnother attempt will " "be made when the session is unused for a while or the server is " "shut down."), path, error->message ); g_error_free(error); } g_free(path); sync_in->name = NULL; /* Don't free, we passed ownership */ infd_directory_remove_sync_in(directory, sync_in); /* Don't send to conn since the completed synchronization already lets the * remote site know that the node was inserted. */ infd_directory_node_register(directory, node, conn, NULL); } static InfdDirectorySyncIn* infd_directory_add_sync_in(InfdDirectory* directory, InfdDirectoryNode* parent, guint node_id, const gchar* name, const InfdNotePlugin* plugin, InfdSessionProxy* proxy) { InfdDirectoryPrivate* priv; InfdDirectorySyncIn* sync_in; priv = INFD_DIRECTORY_PRIVATE(directory); sync_in = g_slice_new(InfdDirectorySyncIn); sync_in->directory = directory; sync_in->parent = parent; sync_in->node_id = node_id; sync_in->name = g_strdup(name); sync_in->plugin = plugin; sync_in->proxy = proxy; g_object_ref(sync_in->proxy); g_signal_connect( G_OBJECT(infd_session_proxy_get_session(sync_in->proxy)), "synchronization-failed", G_CALLBACK(infd_directory_sync_in_synchronization_failed_cb), sync_in ); g_signal_connect( G_OBJECT(infd_session_proxy_get_session(sync_in->proxy)), "synchronization-complete", G_CALLBACK(infd_directory_sync_in_synchronization_complete_cb), sync_in ); priv->sync_ins = g_slist_prepend(priv->sync_ins, sync_in); return sync_in; } static void infd_directory_remove_sync_in(InfdDirectory* directory, InfdDirectorySyncIn* sync_in) { InfdDirectoryPrivate* priv; priv = INFD_DIRECTORY_PRIVATE(directory); inf_signal_handlers_disconnect_by_func( G_OBJECT(infd_session_proxy_get_session(sync_in->proxy)), G_CALLBACK(infd_directory_sync_in_synchronization_failed_cb), sync_in ); inf_signal_handlers_disconnect_by_func( G_OBJECT(infd_session_proxy_get_session(sync_in->proxy)), G_CALLBACK(infd_directory_sync_in_synchronization_complete_cb), sync_in ); /* This cancels the synchronization: */ g_object_unref(sync_in->proxy); g_free(sync_in->name); g_slice_free(InfdDirectorySyncIn, sync_in); priv->sync_ins = g_slist_remove(priv->sync_ins, sync_in); } static InfdDirectorySyncIn* infd_directory_find_sync_in_by_name(InfdDirectory* directory, InfdDirectoryNode* parent, const gchar* name) { InfdDirectoryPrivate* priv; GSList* item; InfdDirectorySyncIn* sync_in; priv = INFD_DIRECTORY_PRIVATE(directory); for(item = priv->sync_ins; item != NULL; item = item->next) { sync_in = (InfdDirectorySyncIn*)item->data; if(sync_in->parent == parent && infd_directory_node_name_equal(sync_in->name, name) == TRUE) { return sync_in; } } return NULL; } /* * Subscription requests. */ static InfdDirectorySubreq* infd_directory_add_subreq_common(InfdDirectory* directory, InfdDirectorySubreqType type, InfXmlConnection* connection, guint node_id) { InfdDirectoryPrivate* priv; InfdDirectorySubreq* request; priv = INFD_DIRECTORY_PRIVATE(directory); request = g_slice_new(InfdDirectorySubreq); request->type = type; request->connection = connection; request->node_id = node_id; priv->subscription_requests = g_slist_prepend(priv->subscription_requests, request); return request; } static InfdDirectorySubreq* infd_directory_add_subreq_chat(InfdDirectory* directory, InfXmlConnection* connection) { InfdDirectorySubreq* request; request = infd_directory_add_subreq_common( directory, INFD_DIRECTORY_SUBREQ_CHAT, connection, 0 ); return request; } static InfdDirectorySubreq* infd_directory_add_subreq_session(InfdDirectory* directory, InfXmlConnection* connection, guint node_id, InfdSessionProxy* proxy) { InfdDirectorySubreq* request; request = infd_directory_add_subreq_common( directory, INFD_DIRECTORY_SUBREQ_SESSION, connection, node_id ); request->shared.session.session = proxy; /* take ownership */ return request; } static InfdDirectorySubreq* infd_directory_add_subreq_add_node(InfdDirectory* directory, InfXmlConnection* connection, guint node_id, InfdDirectoryNode* parent, InfCommunicationHostedGroup* group, const InfdNotePlugin* plugin, const gchar* name, GError** error) { InfdDirectorySubreq* request; InfdSessionProxy* proxy; proxy = infd_directory_create_session_proxy_for_storage( directory, parent, group, name, plugin, INF_SESSION_RUNNING, NULL, NULL, error ); if(proxy == NULL) return NULL; request = infd_directory_add_subreq_common( directory, INFD_DIRECTORY_SUBREQ_ADD_NODE, connection, node_id ); request->shared.add_node.parent = parent; request->shared.add_node.group = group; request->shared.add_node.plugin = plugin; request->shared.add_node.name = g_strdup(name); request->shared.add_node.proxy = proxy; g_object_ref(group); return request; } static InfdDirectorySubreq* infd_directory_add_subreq_sync_in(InfdDirectory* directory, InfXmlConnection* connection, guint node_id, InfdDirectoryNode* parent, InfCommunicationHostedGroup* sync_group, InfCommunicationHostedGroup* sub_group, const InfdNotePlugin* plugin, const gchar* name, GError** error) { InfdDirectorySubreq* request; InfdSessionProxy* proxy; /* Keep proxy in PRESYNC state, until we have the confirmation from the * remote site that the chosen method is OK and we can go on. */ proxy = infd_directory_create_session_proxy_for_storage( directory, parent, sub_group, name, plugin, INF_SESSION_PRESYNC, sync_group, connection, error ); if(proxy == NULL) return NULL; request = infd_directory_add_subreq_common( directory, sync_group == sub_group ? INFD_DIRECTORY_SUBREQ_SYNC_IN_SUBSCRIBE : INFD_DIRECTORY_SUBREQ_SYNC_IN, connection, node_id ); request->shared.sync_in.parent = parent; request->shared.sync_in.synchronization_group = sync_group; request->shared.sync_in.subscription_group = sub_group; request->shared.sync_in.plugin = plugin; request->shared.sync_in.name = g_strdup(name); request->shared.sync_in.proxy = proxy; g_object_ref(sync_group); g_object_ref(sub_group); return request; } static void infd_directory_free_subreq(InfdDirectorySubreq* request) { switch(request->type) { case INFD_DIRECTORY_SUBREQ_CHAT: break; case INFD_DIRECTORY_SUBREQ_SESSION: g_object_unref(request->shared.session.session); break; case INFD_DIRECTORY_SUBREQ_ADD_NODE: g_free(request->shared.add_node.name); g_object_unref(request->shared.add_node.group); g_object_unref(request->shared.add_node.proxy); break; case INFD_DIRECTORY_SUBREQ_SYNC_IN: case INFD_DIRECTORY_SUBREQ_SYNC_IN_SUBSCRIBE: g_free(request->shared.sync_in.name); g_object_unref(request->shared.sync_in.synchronization_group); g_object_unref(request->shared.sync_in.subscription_group); g_object_unref(request->shared.sync_in.proxy); break; default: g_assert_not_reached(); break; } g_slice_free(InfdDirectorySubreq, request); } static void infd_directory_unlink_subreq(InfdDirectory* directory, InfdDirectorySubreq* request) { InfdDirectoryPrivate* priv; priv = INFD_DIRECTORY_PRIVATE(directory); priv->subscription_requests = g_slist_remove(priv->subscription_requests, request); } static void infd_directory_remove_subreq(InfdDirectory* directory, InfdDirectorySubreq* request) { infd_directory_unlink_subreq(directory, request); infd_directory_free_subreq(request); } static InfdDirectorySubreq* infd_directory_find_subreq_by_name(InfdDirectory* directory, InfdDirectoryNode* parent, const gchar* name) { InfdDirectoryPrivate* priv; GSList* item; InfdDirectorySubreq* request; priv = INFD_DIRECTORY_PRIVATE(directory); for(item = priv->subscription_requests; item != NULL; item = item->next) { request = (InfdDirectorySubreq*)item->data; switch(request->type) { case INFD_DIRECTORY_SUBREQ_CHAT: case INFD_DIRECTORY_SUBREQ_SESSION: /* These don't occupy names */ break; case INFD_DIRECTORY_SUBREQ_ADD_NODE: if(request->shared.add_node.parent == parent && infd_directory_node_name_equal(request->shared.add_node.name, name)) { return request; } break; case INFD_DIRECTORY_SUBREQ_SYNC_IN: case INFD_DIRECTORY_SUBREQ_SYNC_IN_SUBSCRIBE: if(request->shared.sync_in.parent == parent && infd_directory_node_name_equal(request->shared.sync_in.name, name)) { return request; } break; default: g_assert_not_reached(); break; } } return NULL; } /* * Directory tree operations. */ static InfdDirectoryNode* infd_directory_node_find_child_by_name(InfdDirectoryNode* parent, const gchar* name) { InfdDirectoryNode* node; infd_directory_return_val_if_subdir_fail(parent, NULL); for(node = parent->shared.subdir.child; node != NULL; node = node->next) if(infd_directory_node_name_equal(node->name, name)) return node; return NULL; } /* Checks whether a node with the given name can be created in the given * parent directory. */ static gboolean infd_directory_node_is_name_available(InfdDirectory* directory, InfdDirectoryNode* parent, const gchar* name, GError** error) { if(strchr(name, '/') != NULL) { g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_INVALID_NAME, "Name \"%s\" is an invalid name: contains \"/\"", name ); return FALSE; } if(infd_directory_node_find_child_by_name(parent, name) != NULL || infd_directory_find_sync_in_by_name(directory, parent, name) != NULL || infd_directory_find_subreq_by_name(directory, parent, name) != NULL) { g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_NODE_EXISTS, "A node with name \"%s\" exists already", name ); return FALSE; } return TRUE; } static gboolean infd_directory_node_explore(InfdDirectory* directory, InfdDirectoryNode* node, GError** error) { InfdDirectoryPrivate* priv; InfdStorageNode* storage_node; InfdDirectoryNode* new_node; InfdNotePlugin* plugin; GError* local_error; GSList* list; GSList* item; gchar* path; gsize len; priv = INFD_DIRECTORY_PRIVATE(directory); g_assert(priv->storage != NULL); g_assert(node->type == INFD_STORAGE_NODE_SUBDIRECTORY); g_assert(node->shared.subdir.explored == FALSE); local_error = NULL; infd_directory_node_get_path(node, &path, &len); list = infd_storage_read_subdirectory(priv->storage, path, &local_error); g_free(path); if(local_error != NULL) { g_propagate_error(error, local_error); return FALSE; } for(item = list; item != NULL; item = g_slist_next(item)) { storage_node = (InfdStorageNode*)item->data; new_node = NULL; /* TODO: Transfer ownership of storade_node->name to * infd_directory_new_*? */ switch(storage_node->type) { case INFD_STORAGE_NODE_SUBDIRECTORY: new_node = infd_directory_node_new_subdirectory( directory, node, priv->node_counter ++, g_strdup(storage_node->name) ); break; case INFD_STORAGE_NODE_NOTE: /* TODO: Currently we ignore notes of unknown type. Perhaps we should * report some error. */ plugin = g_hash_table_lookup(priv->plugins, storage_node->identifier); if(plugin != NULL) { new_node = infd_directory_node_new_note( directory, node, priv->node_counter ++, g_strdup(storage_node->name), plugin ); } break; default: g_assert_not_reached(); break; } if(new_node != NULL) { /* Announce the new node. In most cases, this does nothing on the * network because there are no connections that have this node open * (otherwise, we would already have explored the node earlier). * However, if the background storage is replaced by a new one, the root * folder of the new storage will be explored immediately (see below in * infd_directory_set_storage()) and there might still be connections * interesting in root folder changes (because they opened the root * folder from the old storage). Also, local users might be interested * in the new node. */ infd_directory_node_register(directory, new_node, NULL, NULL); } } infd_storage_node_list_free(list); node->shared.subdir.explored = TRUE; return TRUE; } static InfdDirectoryNode* infd_directory_node_add_subdirectory(InfdDirectory* directory, InfdDirectoryNode* parent, const gchar* name, InfXmlConnection* connection, const gchar* seq, GError** error) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; gboolean result; gchar* path; infd_directory_return_val_if_subdir_fail(parent, NULL); g_return_val_if_fail(parent->shared.subdir.explored == TRUE, NULL); priv = INFD_DIRECTORY_PRIVATE(directory); if(!infd_directory_node_is_name_available(directory, parent, name, error)) { return NULL; } else { infd_directory_node_make_path(parent, name, &path, NULL); if(priv->storage != NULL) result = infd_storage_create_subdirectory(priv->storage, path, error); else result = TRUE; g_free(path); if(result == FALSE) return NULL; node = infd_directory_node_new_subdirectory( directory, parent, priv->node_counter ++, g_strdup(name) ); node->shared.subdir.explored = TRUE; infd_directory_node_register(directory, node, NULL, seq); return node; } } static InfdDirectoryNode* infd_directory_node_create_new_note(InfdDirectory* directory, InfdDirectoryNode* parent, InfCommunicationHostedGroup* group, guint node_id, const gchar* name, const InfdNotePlugin* plugin, GError** error) { InfdSessionProxy* proxy; InfdDirectoryNode* node; proxy = infd_directory_create_session_proxy_for_storage( directory, parent, group, name, plugin, INF_SESSION_RUNNING, NULL, NULL, error ); if(proxy == NULL) return NULL; node = infd_directory_node_new_note( directory, parent, node_id, g_strdup(name), plugin ); infd_directory_node_link_session(directory, node, proxy); g_object_unref(proxy); return node; } static gboolean infd_directory_node_add_note(InfdDirectory* directory, InfdDirectoryNode* parent, const gchar* name, const InfdNotePlugin* plugin, InfXmlConnection* connection, gboolean subscribe_connection, const char* seq, GError** error) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; guint node_id; InfCommunicationHostedGroup* group; xmlNodePtr xml; xmlNodePtr child; const gchar* method; InfdDirectorySubreq* subreq; gboolean result; priv = INFD_DIRECTORY_PRIVATE(directory); infd_directory_return_val_if_subdir_fail(parent, FALSE); g_return_val_if_fail(parent->shared.subdir.explored == TRUE, FALSE); if(!infd_directory_node_is_name_available(directory, parent, name, error)) { return FALSE; } else { node_id = priv->node_counter++; group = infd_directory_create_subscription_group(directory, node_id); if(subscribe_connection == TRUE) { subreq = infd_directory_add_subreq_add_node( directory, connection, node_id, parent, group, plugin, name, error ); if(subreq != NULL) { xml = infd_directory_node_desc_register_to_xml( node_id, parent, plugin, name ); inf_xml_util_set_attribute(xml, "seq", seq); child = xmlNewChild(xml, NULL, (const xmlChar*)"subscribe", NULL); inf_xml_util_set_attribute( child, "group", inf_communication_group_get_name(INF_COMMUNICATION_GROUP(group)) ); method = inf_communication_group_get_method_for_connection( INF_COMMUNICATION_GROUP(group), connection ); /* "central" method should always be available */ g_assert(method != NULL); inf_xml_util_set_attribute(child, "method", method); inf_communication_group_send_message( INF_COMMUNICATION_GROUP(priv->group), connection, xml ); result = TRUE; } } else { node = infd_directory_node_create_new_note( directory, parent, group, node_id, name, plugin, error ); if(node != NULL) { infd_directory_node_register(directory, node, NULL, seq); result = TRUE; } else { result = FALSE; } } g_object_unref(group); return result; } } static gboolean infd_directory_node_add_sync_in(InfdDirectory* directory, InfdDirectoryNode* parent, const gchar* name, const InfdNotePlugin* plugin, InfXmlConnection* sync_conn, gboolean subscribe_sync_conn, const gchar *seq, GError** error) { InfdDirectoryPrivate* priv; InfCommunicationHostedGroup* subscription_group; InfCommunicationHostedGroup* synchronization_group; guint node_id; gchar* sync_group_name; const gchar* method; InfdDirectorySubreq* subreq; xmlNodePtr xml; xmlNodePtr child; /* Synchronization is always between only two peers, so central method * is enough. */ static const gchar* const sync_methods[] = { "central", NULL }; priv = INFD_DIRECTORY_PRIVATE(directory); if(!infd_directory_node_is_name_available(directory, parent, name, error)) return FALSE; node_id = priv->node_counter++; subscription_group = infd_directory_create_subscription_group(directory, node_id); if(subscribe_sync_conn == TRUE) { synchronization_group = subscription_group; g_object_ref(synchronization_group); } else { sync_group_name = g_strdup_printf("InfSession_SyncIn_%u", node_id); synchronization_group = inf_communication_manager_open_group( priv->communication_manager, sync_group_name, sync_methods ); g_free(sync_group_name); } method = inf_communication_group_get_method_for_connection( INF_COMMUNICATION_GROUP(synchronization_group), sync_conn ); /* "central" should always be available */ g_assert(method != NULL); subreq = infd_directory_add_subreq_sync_in( directory, sync_conn, node_id, parent, synchronization_group, subscription_group, plugin, name, error ); if(subreq == NULL) { g_object_unref(synchronization_group); g_object_unref(subscription_group); return FALSE; } xml = xmlNewNode(NULL, (const xmlChar*)"sync-in"); inf_xml_util_set_attribute_uint(xml, "id", node_id); inf_xml_util_set_attribute_uint(xml, "parent", parent->id); inf_xml_util_set_attribute( xml, "group", inf_communication_group_get_name( INF_COMMUNICATION_GROUP(synchronization_group) ) ); inf_xml_util_set_attribute(xml, "method", method); if(seq != NULL) inf_xml_util_set_attribute(xml, "seq", seq); inf_xml_util_set_attribute(xml, "name", name); inf_xml_util_set_attribute(xml, "type", plugin->note_type); if(subscribe_sync_conn == TRUE) { /* Note that if subscribe_sync_conn is set, then sync_group is the same * as the subscription group, so we don't need to query the subscription * group here. */ child = xmlNewChild(xml, NULL, (const xmlChar*)"subscribe", NULL); inf_xml_util_set_attribute(child, "method", method); inf_xml_util_set_attribute( child, "group", inf_communication_group_get_name( INF_COMMUNICATION_GROUP(subscription_group) ) ); } g_object_unref(synchronization_group); g_object_unref(subscription_group); inf_communication_group_send_message( INF_COMMUNICATION_GROUP(priv->group), sync_conn, xml ); return TRUE; } static gboolean infd_directory_node_remove(InfdDirectory* directory, InfdDirectoryNode* node, const gchar* seq, GError** error) { InfdDirectoryPrivate* priv; gboolean result; gchar* path; priv = INFD_DIRECTORY_PRIVATE(directory); /* Cannot remove the root node */ g_assert(node->parent != NULL); infd_directory_node_get_path(node, &path, NULL); if(priv->storage != NULL) { result = infd_storage_remove_node( priv->storage, node->type == INFD_STORAGE_NODE_NOTE ? node->shared.note.plugin->note_type : NULL, path, error ); } else { result = TRUE; } g_free(path); if(result == FALSE) return FALSE; /* Need to unlink child sessions explicitely before unregistering, so * remove-session is emitted before node-removed. Don't save changes since * we just removed the note anyway. */ infd_directory_node_unlink_child_sessions(directory, node, FALSE); infd_directory_node_unregister(directory, node, seq); infd_directory_node_free(directory, node); return TRUE; } /* Returns the session for the given node. This does not link the session * (if it isn't already). This means that the next time this function is * called, the session will be created again if you don't link it yourself, * or if you don't create a subscription request for it. Unref the result. * See infd_directory_node_get_and_link_session() to get a linked session. */ static InfdSessionProxy* infd_directory_node_get_session(InfdDirectory* directory, InfdDirectoryNode* node, GError** error) { InfdDirectoryPrivate* priv; InfSession* session; GSList* item; InfdDirectorySubreq* request; InfdSessionProxy* proxy; gchar* path; g_assert(node->type == INFD_STORAGE_NODE_NOTE); priv = INFD_DIRECTORY_PRIVATE(directory); if(node->shared.note.session != NULL) { proxy = node->shared.note.session; g_object_ref(proxy); return proxy; } /* If we don't have a background storage then all nodes are in memory */ g_assert(priv->storage != NULL); /* The session could already exist in a subscribe-session subreq */ proxy = NULL; for(item = priv->subscription_requests; item != NULL; item = item->next) { request = (InfdDirectorySubreq*)item->data; if(request->type == INFD_DIRECTORY_SUBREQ_SESSION) { if(request->node_id == node->id) { proxy = request->shared.session.session; break; } } } if(proxy != NULL) { g_object_ref(proxy); return proxy; } infd_directory_node_get_path(node, &path, NULL); session = node->shared.note.plugin->session_read( priv->storage, priv->io, priv->communication_manager, path, node->shared.note.plugin->user_data, error ); g_free(path); if(session == NULL) return NULL; /* Buffer might have been marked as modified while reading the session, but * as we just read it from the storage, we don't consider it modified. */ inf_buffer_set_modified(inf_session_get_buffer(session), FALSE); proxy = infd_directory_create_session_proxy_for_node( directory, node->id, session ); g_object_unref(session); return proxy; } static InfdSessionProxy* infd_directory_node_get_and_link_session(InfdDirectory* directory, InfdDirectoryNode* node, GError** error) { InfdSessionProxy* proxy; g_assert(node->type == INFD_STORAGE_NODE_NOTE); proxy = infd_directory_node_get_session(directory, node, error); if(!proxy) return NULL; infd_directory_node_link_session(directory, node, proxy); g_object_unref(proxy); return node->shared.note.session; } /* * Network command handling. */ static void infd_directory_send_welcome_message(InfdDirectory* directory, InfXmlConnection* connection) { InfdDirectoryPrivate* priv; xmlNodePtr xml; xmlNodePtr plugins; xmlNodePtr child; GHashTableIter iter; gpointer value; const InfdNotePlugin* plugin; InfdDirectoryConnectionInfo* info; priv = INFD_DIRECTORY_PRIVATE(directory); xml = xmlNewNode(NULL, (const xmlChar*) "welcome"); inf_xml_util_set_attribute( xml, "protocol-version", inf_protocol_get_version()); info = g_hash_table_lookup(priv->connections, connection); g_assert(info != NULL); inf_xml_util_set_attribute_uint(xml, "sequence-id", info->seq_id); plugins = xmlNewChild(xml, NULL, (const xmlChar*) "note-plugins", NULL); g_hash_table_iter_init(&iter, priv->plugins); while(g_hash_table_iter_next(&iter, NULL, &value)) { plugin = (const InfdNotePlugin*)value; child = xmlNewChild(plugins, NULL, (const xmlChar*) "note-plugin", NULL); inf_xml_util_set_attribute(child, "type", plugin->note_type); } inf_communication_group_send_message( INF_COMMUNICATION_GROUP(priv->group), connection, xml); } static InfdDirectorySubreq* infd_directory_get_subreq_from_xml(InfdDirectory* directory, InfXmlConnection* connection, xmlNodePtr xml, GError** error) { InfdDirectoryPrivate* priv; guint node_id; gboolean has_node; GSList* item; InfdDirectorySubreq* request; priv = INFD_DIRECTORY_PRIVATE(directory); has_node = inf_xml_util_get_attribute_uint( xml, "id", &node_id, error ); if(has_node == FALSE) { /* subscription requests without node ID are for server chat */ for(item = priv->subscription_requests; item != NULL; item = item->next) { request = (InfdDirectorySubreq*)item->data; if(request->type == INFD_DIRECTORY_SUBREQ_CHAT) return request; } g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_NO_SUCH_SUBSCRIPTION_REQUEST, "%s", _("No subscription request for the server chat") ); } else { for(item = priv->subscription_requests; item != NULL; item = item->next) { request = (InfdDirectorySubreq*)item->data; if(request->type != INFD_DIRECTORY_SUBREQ_CHAT && request->connection == connection && request->node_id == node_id) { return request; } } g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_NO_SUCH_SUBSCRIPTION_REQUEST, _("No subscription request with ID %u"), node_id ); } return NULL; } static InfdDirectoryNode* infd_directory_get_node_from_xml(InfdDirectory* directory, xmlNodePtr xml, const gchar* attrib, GError** error) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; guint node_id; gboolean has_node; priv = INFD_DIRECTORY_PRIVATE(directory); has_node = inf_xml_util_get_attribute_uint_required( xml, attrib, &node_id, error ); if(has_node == FALSE) return NULL; node = g_hash_table_lookup(priv->nodes, GUINT_TO_POINTER(node_id)); if(node == NULL) { g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_NO_SUCH_NODE, "%s", inf_directory_strerror(INF_DIRECTORY_ERROR_NO_SUCH_NODE) ); return NULL; } return node; } static InfdDirectoryNode* infd_directory_get_node_from_xml_typed(InfdDirectory* directory, xmlNodePtr xml, const gchar* attrib, InfdStorageNodeType type, GError** error) { InfdDirectoryNode* node; node = infd_directory_get_node_from_xml(directory, xml, attrib, error); if(node != NULL && node->type != type) { switch(type) { case INFD_STORAGE_NODE_SUBDIRECTORY: g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_NOT_A_SUBDIRECTORY, "%s", inf_directory_strerror(INF_DIRECTORY_ERROR_NOT_A_SUBDIRECTORY) ); return NULL; case INFD_STORAGE_NODE_NOTE: g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_NOT_A_NOTE, "%s", inf_directory_strerror(INF_DIRECTORY_ERROR_NOT_A_NOTE) ); return NULL; default: g_assert_not_reached(); return NULL; } } return node; } static gboolean infd_directory_handle_explore_node(InfdDirectory* directory, InfXmlConnection* connection, const xmlNodePtr xml, GError** error) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; InfdDirectoryNode* child; xmlNodePtr reply_xml; gchar* seq; guint total; priv = INFD_DIRECTORY_PRIVATE(directory); node = infd_directory_get_node_from_xml_typed( directory, xml, "id", INFD_STORAGE_NODE_SUBDIRECTORY, error ); if(node->shared.subdir.explored == FALSE) if(infd_directory_node_explore(directory, node, error) == FALSE) return FALSE; if(g_slist_find(node->shared.subdir.connections, connection) != NULL) { g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_ALREADY_EXPLORED, "%s", inf_directory_strerror(INF_DIRECTORY_ERROR_ALREADY_EXPLORED) ); return FALSE; } if(!infd_directory_make_seq(directory, connection, xml, &seq, error)) return FALSE; total = 0; for(child = node->shared.subdir.child; child != NULL; child = child->next) ++ total; reply_xml = xmlNewNode(NULL, (const xmlChar*)"explore-begin"); inf_xml_util_set_attribute_uint(reply_xml, "total", total); if(seq != NULL) inf_xml_util_set_attribute(reply_xml, "seq", seq); inf_communication_group_send_message( INF_COMMUNICATION_GROUP(priv->group), connection, reply_xml ); for(child = node->shared.subdir.child; child != NULL; child = child->next) { reply_xml = infd_directory_node_register_to_xml(child); if(seq != NULL) inf_xml_util_set_attribute(reply_xml, "seq", seq); inf_communication_group_send_message( INF_COMMUNICATION_GROUP(priv->group), connection, reply_xml ); } reply_xml = xmlNewNode(NULL, (const xmlChar*)"explore-end"); if(seq != NULL) inf_xml_util_set_attribute(reply_xml, "seq", seq); inf_communication_group_send_message( INF_COMMUNICATION_GROUP(priv->group), connection, reply_xml ); /* Remember that this connection explored that node so that it gets * notified when changes occur. */ node->shared.subdir.connections = g_slist_prepend( node->shared.subdir.connections, connection ); g_free(seq); return TRUE; } static gboolean infd_directory_handle_add_node(InfdDirectory* directory, InfXmlConnection* connection, const xmlNodePtr xml, GError** error) { InfdDirectoryPrivate* priv; InfdDirectoryNode* parent; InfdDirectoryNode* node; InfdNotePlugin* plugin; xmlChar* name; xmlChar* type; gchar* seq; xmlNodePtr child; gboolean perform_sync_in; gboolean subscribe_sync_conn; gboolean node_added; priv = INFD_DIRECTORY_PRIVATE(directory); parent = infd_directory_get_node_from_xml_typed( directory, xml, "parent", INFD_STORAGE_NODE_SUBDIRECTORY, error ); if(parent == NULL) return FALSE; type = inf_xml_util_get_attribute_required(xml, "type", error); if(type == NULL) return FALSE; if(strcmp((const gchar*)type, "InfSubdirectory") == 0) { /* No plugin because we want to create a directory */ plugin = NULL; xmlFree(type); } else { plugin = g_hash_table_lookup(priv->plugins, (const gchar*)type); xmlFree(type); if(plugin == NULL) { g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_TYPE_UNKNOWN, "%s", inf_directory_strerror(INF_DIRECTORY_ERROR_TYPE_UNKNOWN) ); return FALSE; } } if(!infd_directory_make_seq(directory, connection, xml, &seq, error)) return FALSE; name = inf_xml_util_get_attribute_required(xml, "name", error); if(name == NULL) { g_free(seq); return FALSE; } if(plugin == NULL) { node = infd_directory_node_add_subdirectory( directory, parent, (const gchar*)name, connection, seq, error ); if(node == NULL) node_added = FALSE; else node_added = TRUE; } else { /* Check for sync-in/subscribe flags */ perform_sync_in = subscribe_sync_conn = FALSE; for(child = xml->children; child != NULL; child = child->next) { if(strcmp((const char*)child->name, "sync-in") == 0) perform_sync_in = TRUE; else if(strcmp((const char*)child->name, "subscribe") == 0) subscribe_sync_conn = TRUE; } if(perform_sync_in == FALSE) { node_added = infd_directory_node_add_note( directory, parent, (const gchar*)name, plugin, connection, subscribe_sync_conn, seq, error ); } else { node_added = infd_directory_node_add_sync_in( directory, parent, (const char*)name, plugin, connection, subscribe_sync_conn, seq, error ); /* Note: The sync-in can still fail for various reasons. Maybe the * client doesn't support the communication method, the synchronization * fails or the parent folder is removed. */ } } xmlFree(name); g_free(seq); return node_added; } static gboolean infd_directory_handle_remove_node(InfdDirectory* directory, InfXmlConnection* connection, const xmlNodePtr xml, GError** error) { InfdDirectoryNode* node; gchar* seq; gboolean result; node = infd_directory_get_node_from_xml(directory, xml, "id", error); if(node == NULL) return FALSE; if(node->parent == NULL) { g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_ROOT_NODE_REMOVE_ATTEMPT, "%s", _("The root node cannot be removed") ); return FALSE; } else { if(!infd_directory_make_seq(directory, connection, xml, &seq, error)) return FALSE; result = infd_directory_node_remove(directory, node, seq, error); return result; } } static gboolean infd_directory_handle_subscribe_session(InfdDirectory* directory, InfXmlConnection* connection, xmlNodePtr xml, GError** error) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; InfdSessionProxy* proxy; InfCommunicationGroup* group; const gchar* method; gchar* seq; xmlNodePtr reply_xml; priv = INFD_DIRECTORY_PRIVATE(directory); node = infd_directory_get_node_from_xml_typed( directory, xml, "id", INFD_STORAGE_NODE_NOTE, error ); if(node == NULL) return FALSE; /* TODO: Bail if this connection is either currently being synchronized to * or is already subscribed */ /* TODO: Bail if a subscription request for this connection is pending. */ proxy = infd_directory_node_get_session(directory, node, error); if(proxy == NULL) return FALSE; if(!infd_directory_make_seq(directory, connection, xml, &seq, error)) return FALSE; g_object_get(G_OBJECT(proxy), "subscription-group", &group, NULL); method = inf_communication_group_get_method_for_connection( group, connection ); /* We should always be able to fallback to "central" */ g_assert(method != NULL); /* Reply that subscription was successful (so far, synchronization may * still fail) and tell identifier. */ reply_xml = xmlNewNode(NULL, (const xmlChar*)"subscribe-session"); xmlNewProp( reply_xml, (const xmlChar*)"group", (const xmlChar*)inf_communication_group_get_name(group) ); xmlNewProp( reply_xml, (const xmlChar*)"method", (const xmlChar*)method ); g_object_unref(group); inf_xml_util_set_attribute_uint(reply_xml, "id", node->id); if(seq != NULL) inf_xml_util_set_attribute(reply_xml, "seq", seq); /* This gives ownership of proxy to the subscription request */ infd_directory_add_subreq_session(directory, connection, node->id, proxy); inf_communication_group_send_message( INF_COMMUNICATION_GROUP(priv->group), connection, reply_xml ); g_free(seq); return TRUE; } static gboolean infd_directory_handle_save_session(InfdDirectory* directory, InfXmlConnection* connection, const xmlNodePtr xml, GError** error) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; xmlNodePtr reply_xml; gchar* path; gchar* seq; gboolean result; priv = INFD_DIRECTORY_PRIVATE(directory); if(priv->storage == NULL) { g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_NO_STORAGE, "%s", _("No background storage available") ); return FALSE; } /* TODO: Don't do anything if buffer is not modified */ /* TODO: Authentication, we could also allow specific connections to save * without being subscribed. */ node = infd_directory_get_node_from_xml_typed( directory, xml, "id", INFD_STORAGE_NODE_NOTE, error ); if(node->shared.note.session == NULL || !infd_session_proxy_is_subscribed(node->shared.note.session, connection)) { g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_UNSUBSCRIBED, "%s", _("The requesting connection is not subscribed to the session") ); return FALSE; } /* We only need this if we are saving asynchronously: */ /* TODO: Which we should do, of course. */ #if 0 reply_xml = xmlNewNode(NULL, (const xmlChar*)"session-save-in-progress"); seq_attr = xmlGetProp(xml, (const xmlChar*)"seq"); if(seq_attr != NULL) { xmlNewProp(reply_xml, (const xmlChar*)"seq", seq_attr); xmlFree(seq_attr); } inf_connection_manager_group_send_to_connection( priv->group, connection, reply_xml ); #endif infd_directory_node_get_path(node, &path, NULL); result = node->shared.note.plugin->session_write( priv->storage, infd_session_proxy_get_session(node->shared.note.session), path, node->shared.note.plugin->user_data, error ); /* TODO: unset modified flag of buffer if result == TRUE */ /* The timeout should only be set when there aren't any connections * subscribed, however we just made sure that the connection the request * comes from is subscribed. */ g_assert(node->shared.note.save_timeout == NULL); g_free(path); if(result == FALSE) return FALSE; if(!infd_directory_make_seq(directory, connection, xml, &seq, error)) return FALSE; reply_xml = xmlNewNode(NULL, (const xmlChar*)"session-saved"); if(seq != NULL) inf_xml_util_set_attribute(reply_xml, "seq", seq); inf_communication_group_send_message( INF_COMMUNICATION_GROUP(priv->group), connection, reply_xml ); g_free(seq); return TRUE; } static gboolean infd_directory_handle_subscribe_chat(InfdDirectory* directory, InfXmlConnection* connection, xmlNodePtr xml, GError** error) { InfdDirectoryPrivate* priv; InfCommunicationGroup* group; const gchar* method; gchar* seq; xmlNodePtr reply_xml; priv = INFD_DIRECTORY_PRIVATE(directory); /* TODO: Bail if this connection is either currently being synchronized to * or is already subscribed */ /* TODO: Bail if a subscription request for this connection is pending. */ if(priv->chat_session == NULL) { g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_CHAT_DISABLED, "%s", _("The chat is disabled") ); return FALSE; } if(!infd_directory_make_seq(directory, connection, xml, &seq, error)) return FALSE; g_object_get( G_OBJECT(priv->chat_session), "subscription-group", &group, NULL ); method = inf_communication_group_get_method_for_connection( group, connection ); /* We should always be able to fallback to "central" */ g_assert(method != NULL); /* Reply that subscription was successful (so far, synchronization may * still fail) and tell identifier. */ reply_xml = xmlNewNode(NULL, (const xmlChar*)"subscribe-chat"); xmlNewProp( reply_xml, (const xmlChar*)"group", (const xmlChar*)inf_communication_group_get_name(group) ); xmlNewProp( reply_xml, (const xmlChar*)"method", (const xmlChar*)method ); g_object_unref(group); if(seq) inf_xml_util_set_attribute(reply_xml, "seq", seq); infd_directory_add_subreq_chat(directory, connection); inf_communication_group_send_message( INF_COMMUNICATION_GROUP(priv->group), connection, reply_xml ); g_free(seq); return TRUE; } static gboolean infd_directory_handle_subscribe_ack(InfdDirectory* directory, InfXmlConnection* connection, const xmlNodePtr xml, GError** error) { InfdDirectoryPrivate* priv; InfdDirectorySubreq* request; InfdDirectoryNode* node; InfdDirectorySyncIn* sync_in; InfdSessionProxy* proxy; InfdDirectoryConnectionInfo* info; priv = INFD_DIRECTORY_PRIVATE(directory); request = infd_directory_get_subreq_from_xml( directory, connection, xml, error ); if(request == NULL) return FALSE; /* Unlink, so that the subreq itself does not cause the is_name_available * assertions below to fail. */ infd_directory_unlink_subreq(directory, request); info = g_hash_table_lookup(priv->connections, connection); g_assert(info != NULL); switch(request->type) { case INFD_DIRECTORY_SUBREQ_CHAT: /* Note that it doesn't matter whether the chat was disabled+enabled * between subreq generation and <subscribe-ack/> handling - the group * is always called InfChat so the client joins the correct group in * all cases. */ if(priv->chat_session != NULL) { infd_session_proxy_subscribe_to( priv->chat_session, connection, info->seq_id, TRUE ); } else { /* The chat does not exist anymore - just create a temporary chat, * subscribe the client and then close the chat right aftewards, to * notify the client about the chat not existing anymore. */ /* TODO: Make a helper function creating the chat proxy but not * setting the member var / doing the property notify */ g_object_freeze_notify(G_OBJECT(directory)); infd_directory_enable_chat(directory, TRUE); infd_session_proxy_subscribe_to( priv->chat_session, connection, info->seq_id, TRUE ); infd_directory_enable_chat(directory, FALSE); g_object_thaw_notify(G_OBJECT(directory)); } break; case INFD_DIRECTORY_SUBREQ_SESSION: node = g_hash_table_lookup( priv->nodes, GUINT_TO_POINTER(request->node_id) ); /* The node this client wants to subscribe might have been removed in the * meanwhile. */ if(node != NULL) { g_assert(node->type == INFD_STORAGE_NODE_NOTE); g_assert(node->shared.note.session == NULL || node->shared.note.session == request->shared.session.session); if(node->shared.note.session == NULL) { infd_directory_node_link_session( directory, node, request->shared.session.session ); } } infd_session_proxy_subscribe_to( request->shared.session.session, connection, info->seq_id, TRUE ); break; case INFD_DIRECTORY_SUBREQ_ADD_NODE: if(request->shared.add_node.parent != NULL) { g_assert( infd_directory_node_is_name_available( directory, request->shared.add_node.parent, request->shared.add_node.name, NULL ) == TRUE ); proxy = request->shared.add_node.proxy; g_object_ref(proxy); node = infd_directory_node_new_note( directory, request->shared.add_node.parent, request->node_id, g_strdup(request->shared.add_node.name), request->shared.add_node.plugin ); infd_directory_node_link_session(directory, node, proxy); /* register to all but conn. conn already added the node after * having sent subscribe-ack. */ infd_directory_node_register(directory, node, connection, NULL); } else { /* The add-node request can't be performed properly because the parent * node has been removed. Still create a session proxy and subscribe to * connection before unrefing it again, so that the remote host gets * notified that this session is no longer active. */ proxy = request->shared.add_node.proxy; g_object_ref(proxy); } /* Don't sync session to client if the client added this node, since the * node is empty anyway. */ infd_session_proxy_subscribe_to(proxy, connection, info->seq_id, FALSE); g_object_unref(proxy); break; case INFD_DIRECTORY_SUBREQ_SYNC_IN: case INFD_DIRECTORY_SUBREQ_SYNC_IN_SUBSCRIBE: /* Group and method are OK for the client, so start synchronization */ inf_session_synchronize_from( infd_session_proxy_get_session(request->shared.sync_in.proxy) ); if(request->shared.sync_in.parent != NULL) { g_assert( infd_directory_node_is_name_available( directory, request->shared.sync_in.parent, request->shared.sync_in.name, NULL ) == TRUE ); proxy = request->shared.sync_in.proxy; g_object_ref(proxy); sync_in = infd_directory_add_sync_in( directory, request->shared.sync_in.parent, request->node_id, request->shared.sync_in.name, request->shared.sync_in.plugin, proxy ); } else { /* The sync-in can't be performed properly because the parent node of * the node to sync-in has been removed. Still create the corresponding * session and close it immediately (cancelling the synchronization, to * tell the client). */ proxy = request->shared.sync_in.proxy; g_object_ref(proxy); } if(request->type == INFD_DIRECTORY_SUBREQ_SYNC_IN) { /* No subscription, so add connection to synchronization group * explicitely. */ inf_communication_hosted_group_add_member( request->shared.sync_in.synchronization_group, connection ); } else { /* subscribe_to adds connection to subscription group which is the * same as the synchronization group. */ infd_session_proxy_subscribe_to(proxy, connection, info->seq_id, FALSE); } g_object_unref(proxy); break; default: g_assert_not_reached(); break; } infd_directory_free_subreq(request); return TRUE; } static gboolean infd_directory_handle_subscribe_nack(InfdDirectory* directory, InfXmlConnection* connection, const xmlNodePtr xml, GError** error) { InfdDirectoryPrivate* priv; InfdDirectorySubreq* request; gchar* path; gboolean result; priv = INFD_DIRECTORY_PRIVATE(directory); request = infd_directory_get_subreq_from_xml( directory, connection, xml, error ); if(request == NULL) return FALSE; result = TRUE; if(priv->storage != NULL && request->type == INFD_DIRECTORY_SUBREQ_ADD_NODE) { infd_directory_node_make_path( request->shared.add_node.parent, request->shared.add_node.name, &path, NULL); result = infd_storage_remove_node( priv->storage, request->shared.add_node.plugin->note_type, path, error ); g_free(path); } infd_directory_remove_subreq(directory, request); return result; } /* * Signal handlers. */ static void infd_directory_connection_notify_status_cb(GObject* object, GParamSpec* pspec, gpointer user_data) { InfXmlConnectionStatus status; g_object_get(object, "status", &status, NULL); if(status == INF_XML_CONNECTION_OPEN) { infd_directory_send_welcome_message( INFD_DIRECTORY(user_data), INF_XML_CONNECTION(object) ); } } static void infd_directory_member_removed_cb(InfCommunicationGroup* group, InfXmlConnection* connection, gpointer user_data) { InfdDirectory* directory; InfdDirectoryPrivate* priv; GSList* item; InfdDirectorySubreq* request; InfdDirectoryConnectionInfo* info; directory = INFD_DIRECTORY(user_data); priv = INFD_DIRECTORY_PRIVATE(directory); if(priv->root != NULL && priv->root->shared.subdir.explored) { infd_directory_node_remove_connection(priv->root, connection); } /* Remove all subscription requests for this connection */ item = priv->subscription_requests; while(item != NULL) { request = (InfdDirectorySubreq*)item->data; item = item->next; if(request->connection == connection) infd_directory_remove_subreq(directory, request); } info = g_hash_table_lookup(priv->connections, connection); g_slice_free(InfdDirectoryConnectionInfo, info); inf_signal_handlers_disconnect_by_func(G_OBJECT(connection), G_CALLBACK(infd_directory_connection_notify_status_cb), directory); g_hash_table_remove(priv->connections, connection); g_object_unref(G_OBJECT(connection)); } /* * Property modification. */ static void infd_directory_set_storage(InfdDirectory* directory, InfdStorage* storage) { InfdDirectoryPrivate* priv; InfdDirectoryNode* child; priv = INFD_DIRECTORY_PRIVATE(directory); if(priv->storage != NULL) { /* priv->root may be NULL if this is called from dispose. */ if(priv->root != NULL && priv->root->shared.subdir.explored == TRUE) { /* Clear directory tree. This will cause all sessions to be saved in * storage. Note that sessions are not closed, but further * modifications to the sessions will not be stored in storage. */ while((child = priv->root->shared.subdir.child) != NULL) { infd_directory_node_unlink_child_sessions(directory, child, TRUE); infd_directory_node_unregister(directory, child, NULL); infd_directory_node_free(directory, child); } } g_object_unref(G_OBJECT(priv->storage)); } priv->storage = storage; if(storage != NULL) { /* root folder was explored before storage change, so keep it * explored. */ if(priv->root->shared.subdir.explored == TRUE) { /* Need to set explored flag to FALSE to meet preconditions of * infd_directory_node_explore(). */ priv->root->shared.subdir.explored = FALSE; /* TODO: Error handling? */ infd_directory_node_explore(directory, priv->root, NULL); } g_object_ref(G_OBJECT(storage)); } } static void infd_directory_set_communication_manager(InfdDirectory* directory, InfCommunicationManager* manager) { InfdDirectoryPrivate* priv; priv = INFD_DIRECTORY_PRIVATE(directory); /* construct/only */ g_assert(priv->communication_manager == NULL); priv->communication_manager = manager; g_object_ref(manager); } /* * GObject overrides. */ static void infd_directory_init(GTypeInstance* instance, gpointer g_class) { InfdDirectory* directory; InfdDirectoryPrivate* priv; directory = INFD_DIRECTORY(instance); priv = INFD_DIRECTORY_PRIVATE(directory); priv->io = NULL; priv->storage = NULL; priv->communication_manager = NULL; priv->plugins = g_hash_table_new(g_str_hash, g_str_equal); priv->connections = g_hash_table_new(NULL, NULL); priv->node_counter = 1; priv->nodes = g_hash_table_new(NULL, NULL); /* The root node has no name. */ priv->root = infd_directory_node_new_subdirectory(directory, NULL, 0, NULL); priv->sync_ins = NULL; priv->subscription_requests = NULL; priv->chat_session = NULL; } static GObject* infd_directory_constructor(GType type, guint n_construct_properties, GObjectConstructParam* construct_properties) { GObject* object; InfdDirectory* directory; InfdDirectoryPrivate* priv; /* We only use central method for directory handling */ static const gchar* const methods[] = { "centrol", NULL }; object = G_OBJECT_CLASS(parent_class)->constructor( type, n_construct_properties, construct_properties ); directory = INFD_DIRECTORY(object); priv = INFD_DIRECTORY_PRIVATE(directory); /* TODO: Use default communication manager in case none is set */ g_assert(priv->communication_manager != NULL); priv->group = inf_communication_manager_open_group( priv->communication_manager, "InfDirectory", methods ); g_signal_connect( G_OBJECT(priv->group), "member-removed", G_CALLBACK(infd_directory_member_removed_cb), directory ); inf_communication_group_set_target( INF_COMMUNICATION_GROUP(priv->group), INF_COMMUNICATION_OBJECT(directory) ); /* If we don't have a background storage then the root node has been * explored (there is simply no content yet, it has to be added via * infd_directory_add_note). */ if(priv->storage == NULL) priv->root->shared.subdir.explored = TRUE; g_assert(g_hash_table_size(priv->connections) == 0); return object; } static void infd_directory_dispose(GObject* object) { InfdDirectory* directory; InfdDirectoryPrivate* priv; GHashTableIter iter; gpointer key; directory = INFD_DIRECTORY(object); priv = INFD_DIRECTORY_PRIVATE(directory); /* Disable chat if any */ if(priv->chat_session != NULL) infd_directory_enable_chat(directory, FALSE); /* Cancel sync-ins */ while(priv->sync_ins != NULL) infd_directory_remove_sync_in(directory, priv->sync_ins->data); /* This frees the complete directory tree and saves sessions into the * storage. */ infd_directory_node_unlink_child_sessions(directory, priv->root, TRUE); infd_directory_node_free(directory, priv->root); priv->root = NULL; g_hash_table_destroy(priv->nodes); priv->nodes = NULL; for(g_hash_table_iter_init(&iter, priv->connections); g_hash_table_iter_next(&iter, &key, NULL); g_hash_table_iter_init(&iter, priv->connections)) { inf_communication_hosted_group_remove_member( priv->group, INF_XML_CONNECTION(key) ); } g_assert(g_hash_table_size(priv->connections) == 0); /* Should have been cleared by removing all connections */ g_assert(priv->subscription_requests == NULL); /* We have dropped all references to connections now, so these do not try * to tell anyone that the directory tree has gone or whatever. */ inf_signal_handlers_disconnect_by_func( G_OBJECT(priv->group), G_CALLBACK(infd_directory_member_removed_cb), directory ); g_object_unref(priv->group); g_object_unref(priv->communication_manager); infd_directory_set_storage(directory, NULL); g_hash_table_destroy(priv->connections); priv->connections = NULL; g_hash_table_destroy(priv->plugins); priv->plugins = NULL; if(priv->io != NULL) { g_object_unref(G_OBJECT(priv->io)); priv->io = NULL; } G_OBJECT_CLASS(parent_class)->dispose(object); } static void infd_directory_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) { InfdDirectory* directory; InfdDirectoryPrivate* priv; directory = INFD_DIRECTORY(object); priv = INFD_DIRECTORY_PRIVATE(directory); switch(prop_id) { case PROP_IO: g_assert(priv->io == NULL); /* construct only */ priv->io = INF_IO(g_value_dup_object(value)); break; case PROP_STORAGE: infd_directory_set_storage( directory, INFD_STORAGE(g_value_get_object(value)) ); break; case PROP_COMMUNICATION_MANAGER: infd_directory_set_communication_manager( directory, INF_COMMUNICATION_MANAGER(g_value_get_object(value)) ); break; case PROP_CHAT_SESSION: /* read only */ default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } } static void infd_directory_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { InfdDirectory* directory; InfdDirectoryPrivate* priv; directory = INFD_DIRECTORY(object); priv = INFD_DIRECTORY_PRIVATE(directory); switch(prop_id) { case PROP_IO: g_value_set_object(value, G_OBJECT(priv->io)); break; case PROP_STORAGE: g_value_set_object(value, G_OBJECT(priv->storage)); break; case PROP_COMMUNICATION_MANAGER: g_value_set_object(value, G_OBJECT(priv->communication_manager)); break; case PROP_CHAT_SESSION: g_value_set_object(value, G_OBJECT(priv->chat_session)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } } /* * Default signal handler implementation. */ static void infd_directory_add_session(InfdDirectory* directory, InfdDirectoryIter* iter, InfdSessionProxy* session) { InfdDirectoryNode* node; infd_directory_return_if_iter_fail(directory, iter); node = (InfdDirectoryNode*)iter->node; g_assert(node->type == INFD_STORAGE_NODE_NOTE); g_assert(node->shared.note.session == NULL); node->shared.note.session = session; g_object_ref(session); g_object_set_qdata( G_OBJECT(session), infd_directory_node_id_quark, GUINT_TO_POINTER(node->id) ); g_signal_connect( G_OBJECT(session), "notify::idle", G_CALLBACK(infd_directory_session_idle_notify_cb), directory ); if(infd_session_proxy_is_idle(node->shared.note.session)) { infd_directory_start_session_save_timeout(directory, node); } } static void infd_directory_remove_session(InfdDirectory* directory, InfdDirectoryIter* iter, InfdSessionProxy* session) { InfdDirectoryNode* node; InfdDirectoryPrivate* priv; priv = INFD_DIRECTORY_PRIVATE(directory); infd_directory_return_if_iter_fail(directory, iter); node = (InfdDirectoryNode*)iter->node; g_assert(node->type == INFD_STORAGE_NODE_NOTE); g_assert(node->shared.note.session == session); if(node->shared.note.save_timeout != NULL) { inf_io_remove_timeout(priv->io, node->shared.note.save_timeout); node->shared.note.save_timeout = NULL; } inf_signal_handlers_disconnect_by_func( G_OBJECT(session), G_CALLBACK(infd_directory_session_idle_notify_cb), directory ); g_object_set_qdata( G_OBJECT(session), infd_directory_node_id_quark, NULL ); g_object_unref(session); node->shared.note.session = NULL; } /* * InfCommunicationObject implementation. */ static InfCommunicationScope infd_directory_communication_object_received(InfCommunicationObject* object, InfXmlConnection* connection, const xmlNodePtr node, GError** error) { InfdDirectory* directory; InfdDirectoryPrivate* priv; GError* local_error; xmlNodePtr reply_xml; gchar* seq; directory = INFD_DIRECTORY(object); priv = INFD_DIRECTORY_PRIVATE(directory); local_error = NULL; if(strcmp((const char*)node->name, "explore-node") == 0) { infd_directory_handle_explore_node( directory, connection, node, &local_error ); } else if(strcmp((const char*)node->name, "add-node") == 0) { infd_directory_handle_add_node( directory, connection, node, &local_error ); } else if(strcmp((const char*)node->name, "remove-node") == 0) { infd_directory_handle_remove_node( directory, connection, node, &local_error ); } else if(strcmp((const char*)node->name, "subscribe-session") == 0) { infd_directory_handle_subscribe_session( directory, connection, node, &local_error ); } else if(strcmp((const char*)node->name, "save-session") == 0) { infd_directory_handle_save_session( directory, connection, node, &local_error ); } else if(strcmp((const char*)node->name, "subscribe-chat") == 0) { infd_directory_handle_subscribe_chat( directory, connection, node, &local_error ); } else if(strcmp((const char*)node->name, "subscribe-ack") == 0) { /* Don't reply to subscribe-ack. */ infd_directory_handle_subscribe_ack( directory, connection, node, &local_error ); } else if(strcmp((const char*)node->name, "subscribe-nack") == 0) { /* Don't reply to subscribe-nack. */ infd_directory_handle_subscribe_nack( directory, connection, node, &local_error ); } else { g_set_error( &local_error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_UNEXPECTED_MESSAGE, "%s", inf_directory_strerror(INF_DIRECTORY_ERROR_UNEXPECTED_MESSAGE) ); } if(local_error != NULL) { /* TODO: If error is not from the InfDirectoryError error domain, the * client cannot reconstruct the error because he possibly does not know * the error domain (it might even come from a storage plugin). */ if(!infd_directory_make_seq(directory, connection, node, &seq, error)) seq = NULL; /* An error happened, so tell the client that the request failed and * what has gone wrong. */ reply_xml = inf_xml_util_new_node_from_error(local_error, NULL, "request-failed"); if(seq != NULL) inf_xml_util_set_attribute(reply_xml, "seq", seq); g_free(seq); inf_communication_group_send_message( INF_COMMUNICATION_GROUP(priv->group), connection, reply_xml ); g_error_free(local_error); } /* Never forward directory messages */ return INF_COMMUNICATION_SCOPE_PTP; } /* * GType registration. */ static void infd_directory_class_init(gpointer g_class, gpointer class_data) { GObjectClass* object_class; InfdDirectoryClass* directory_class; object_class = G_OBJECT_CLASS(g_class); directory_class = INFD_DIRECTORY_CLASS(g_class); parent_class = G_OBJECT_CLASS(g_type_class_peek_parent(g_class)); g_type_class_add_private(g_class, sizeof(InfdDirectoryPrivate)); object_class->constructor = infd_directory_constructor; object_class->dispose = infd_directory_dispose; object_class->set_property = infd_directory_set_property; object_class->get_property = infd_directory_get_property; directory_class->node_added = NULL; directory_class->node_removed = NULL; directory_class->add_session = infd_directory_add_session; directory_class->remove_session = infd_directory_remove_session; infd_directory_node_id_quark = g_quark_from_static_string("INFD_DIRECTORY_NODE_ID"); g_object_class_install_property( object_class, PROP_IO, g_param_spec_object( "io", "IO", "IO object to watch sockets and schedule timeouts", INF_TYPE_IO, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY ) ); g_object_class_install_property( object_class, PROP_STORAGE, g_param_spec_object( "storage", "Storage backend", "The storage backend to use", INFD_TYPE_STORAGE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT ) ); g_object_class_install_property( object_class, PROP_COMMUNICATION_MANAGER, g_param_spec_object( "communication-manager", "Communication manager", "The communication manager for the directory", INF_COMMUNICATION_TYPE_MANAGER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY ) ); g_object_class_install_property( object_class, PROP_CHAT_SESSION, g_param_spec_object( "chat-session", "Chat session", "The server's chat session", INFD_TYPE_SESSION_PROXY, G_PARAM_READABLE ) ); /** * InfdDirectory::node-added: * @directory: The #InfdDirectory emitting the signal. * @iter: A #InfdDirectoryIter pointing to the added node. * * This signal is emitted when a new node has been created. It can either * be created by API calls such as infd_directory_add_note() and * infd_directory_add_subdirectory() or by a client making a corresponding * request. **/ directory_signals[NODE_ADDED] = g_signal_new( "node-added", G_OBJECT_CLASS_TYPE(object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(InfdDirectoryClass, node_added), NULL, NULL, inf_marshal_VOID__BOXED, G_TYPE_NONE, 1, INFD_TYPE_DIRECTORY_ITER | G_SIGNAL_TYPE_STATIC_SCOPE ); /** * InfdDirectory::node-removed: * @directory: The #InfdDirectory emitting the signal. * @iter: A #InfdDirectoryIter pointing to the removed node. * * This signal is emitted when a node has been removed. If a subdirectory * node is removed, all contained nodes are removed as well. Node removal * can either happen through a call to infd_directory_remove_node(), or by * a client making a corresponding request. **/ directory_signals[NODE_REMOVED] = g_signal_new( "node-removed", G_OBJECT_CLASS_TYPE(object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(InfdDirectoryClass, node_removed), NULL, NULL, inf_marshal_VOID__BOXED, G_TYPE_NONE, 1, INFD_TYPE_DIRECTORY_ITER | G_SIGNAL_TYPE_STATIC_SCOPE ); /** * InfdDirectory::add-session: * @directory: The #InfdDirectory emitting the signal. * @iter: A #InfdDirectoryIter pointing to the affected node. * @session: The #InfdSessionProxy proxying the added session. * * This signal is emitted, when a session has been associated with a node. * This happens when infd_directory_iter_get_session() is called on a node, * when a remote client subscribes to a session or a new node was created. * * When a session has been created for a node, the session is kept until it * is idle for some time. Then, it is removed again after having been stored * into the background storage. */ directory_signals[ADD_SESSION] = g_signal_new( "add-session", G_OBJECT_CLASS_TYPE(object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(InfdDirectoryClass, add_session), NULL, NULL, inf_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 2, INFD_TYPE_DIRECTORY_ITER | G_SIGNAL_TYPE_STATIC_SCOPE, INFD_TYPE_SESSION_PROXY ); /** * InfdDirectory::remove-session: * @directory: The #InfdDirectory emitting the signal. * @iter: A #InfdDirectoryIter pointing to the affected node. * @session: The #InfdSessionProxy proxying the removed session. * * This signal is emitted when a previously added session was removed. This * happens when a session is idle for some time, or when the corresponding * node has been removed. */ directory_signals[REMOVE_SESSION] = g_signal_new( "remove-session", G_OBJECT_CLASS_TYPE(object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(InfdDirectoryClass, remove_session), NULL, NULL, inf_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 2, INFD_TYPE_DIRECTORY_ITER | G_SIGNAL_TYPE_STATIC_SCOPE, INFD_TYPE_SESSION_PROXY ); } static void infd_directory_communication_object_init(gpointer g_iface, gpointer iface_data) { InfCommunicationObjectIface* iface; iface = (InfCommunicationObjectIface*)g_iface; iface->received = infd_directory_communication_object_received; } GType infd_directory_iter_get_type(void) { static GType directory_iter_type = 0; if(!directory_iter_type) { directory_iter_type = g_boxed_type_register_static( "InfdDirectoryIter", (GBoxedCopyFunc)infd_directory_iter_copy, (GBoxedFreeFunc)infd_directory_iter_free ); } return directory_iter_type; } GType infd_directory_get_type(void) { static GType directory_type = 0; if(!directory_type) { static const GTypeInfo directory_type_info = { sizeof(InfdDirectoryClass), /* class_size */ NULL, /* base_init */ NULL, /* base_finalize */ infd_directory_class_init, /* class_init */ NULL, /* class_finalize */ NULL, /* class_data */ sizeof(InfdDirectory), /* instance_size */ 0, /* n_preallocs */ infd_directory_init, /* instance_init */ NULL /* value_table */ }; static const GInterfaceInfo communication_object_info = { infd_directory_communication_object_init, NULL, NULL }; directory_type = g_type_register_static( G_TYPE_OBJECT, "InfdDirectory", &directory_type_info, 0 ); g_type_add_interface_static( directory_type, INF_COMMUNICATION_TYPE_OBJECT, &communication_object_info ); } return directory_type; } /* * Public API. */ /** * infd_directory_iter_copy: * @iter: A #InfdDirectoryIter. * * Makes a dynamically-allocated copy of @iter. This should not be used by * applications because you can copy the structs by value. * * Return Value: A newly-allocated copy of @iter. **/ InfdDirectoryIter* infd_directory_iter_copy(InfdDirectoryIter* iter) { InfdDirectoryIter* new_iter; g_return_val_if_fail(iter != NULL, NULL); new_iter = g_slice_new(InfdDirectoryIter); *new_iter = *iter; return new_iter; } /** * infd_directory_iter_free: * @iter: A #InfdDirectoryIter. * * Frees a #InfdDirectoryIter allocated with infd_directory_iter_copy(). **/ void infd_directory_iter_free(InfdDirectoryIter* iter) { g_return_if_fail(iter != NULL); g_slice_free(InfdDirectoryIter, iter); } /** * infd_directory_new: * @io: IO object to watch connections and schedule timeouts. * @storage: Storage backend that is used to read/write notes from * permanent memory into #InfBuffer objects, or %NULL. * @comm_manager: A #InfCommunicationManager to register added * connections to and which forwards incoming data to the directory * or running sessions. * * Creates a new #InfdDirectory. If @storage is %NULL then the directory * keeps all content in memory. This can make sense for ad-hoc sessions where * no central document storage is required. * * Return Value: A new #InfdDirectory. **/ InfdDirectory* infd_directory_new(InfIo* io, InfdStorage* storage, InfCommunicationManager* comm_manager) { GObject* object; g_return_val_if_fail(INF_IS_IO(io), NULL); g_return_val_if_fail(storage == NULL || INFD_IS_STORAGE(storage), NULL); g_return_val_if_fail(INF_COMMUNICATION_IS_MANAGER(comm_manager), NULL); object = g_object_new( INFD_TYPE_DIRECTORY, "io", io, "storage", storage, "communication-manager", comm_manager, NULL ); return INFD_DIRECTORY(object); } /** * infd_directory_get_io: * @directory: A #InfdDirectory. * * Returns the IO object in use by the directory. * * Return Value: A #InfIo. **/ InfIo* infd_directory_get_io(InfdDirectory* directory) { g_return_val_if_fail(INFD_IS_DIRECTORY(directory), NULL); return INFD_DIRECTORY_PRIVATE(directory)->io; } /** * infd_directory_get_storage: * @directory: A #InfdDirectory: * * Returns the storage backend in use by the directory. * * Return Value: An #InfdStorage. **/ InfdStorage* infd_directory_get_storage(InfdDirectory* directory) { g_return_val_if_fail(INFD_IS_DIRECTORY(directory), NULL); return INFD_DIRECTORY_PRIVATE(directory)->storage; } /** * infd_directory_get_communication_manager: * @directory: A #InfdDirectory. * * Returns the connection manager of the directory. * * Return Value: An #InfCommunicationManager. **/ InfCommunicationManager* infd_directory_get_communication_manager(InfdDirectory* directory) { g_return_val_if_fail(INFD_IS_DIRECTORY(directory), NULL); return INFD_DIRECTORY_PRIVATE(directory)->communication_manager; } /** * infd_directory_add_plugin: * @directory: A #InfdDirectory. * @plugin: A #InfdNotePlugin. * * Adds @plugin to @directory. This allows the directory to create sessions * of the plugin's type. Only one plugin of each type can be added to the * directory. The plugin's storage_type must match the storage of @directory. * If the directory's storage is %NULL, then the plugin's storage type does * not matter, and the plugin's @session_read and @session_write functions * will not be used (and can therefore be %NULL). * * Return Value: Whether the plugin was added successfully. **/ gboolean infd_directory_add_plugin(InfdDirectory* directory, const InfdNotePlugin* plugin) { InfdDirectoryPrivate* priv; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), FALSE); g_return_val_if_fail(plugin != NULL, FALSE); priv = INFD_DIRECTORY_PRIVATE(directory); g_return_val_if_fail( priv->storage == NULL || strcmp( plugin->storage_type, g_type_name(G_TYPE_FROM_INSTANCE(priv->storage)) ) == 0, FALSE ); if(g_hash_table_lookup(priv->plugins, plugin->note_type) != NULL) return FALSE; g_hash_table_insert( priv->plugins, /* cast const away without warning */ /* take addr -> char const * const * * cast -> void const * * cast -> void * const * * deref -> void * const */ *(const gpointer*)(gconstpointer)&plugin->note_type, *(gpointer*)(gpointer)&plugin ); return TRUE; } /** * infd_directory_lookup_plugin: * @directory: A #InfdDirectory. * @note_type: A note type for which to lookup the plugin. * * Returns the #InfdNotePlugin that handles the given note type, or %NULL * in case no corresponding plugin was added. * * Return Value: A #InfdNotePlugin, or %NULL. **/ const InfdNotePlugin* infd_directory_lookup_plugin(InfdDirectory* directory, const gchar* note_type) { InfdDirectoryPrivate* priv; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), NULL); g_return_val_if_fail(note_type != NULL, NULL); priv = INFD_DIRECTORY_PRIVATE(directory); return (const InfdNotePlugin*)g_hash_table_lookup(priv->plugins, note_type); } /** * infd_directory_add_connection: * @directory: A #InfdDirectory. * @connection: A #InfConnection. * * Adds @connection to the connections of @directory. The directory will then * receive requests from @connection. If the directory's method manager does * not contain a "central" method for connection's network, then the * connection will not be added and the function returns %FALSE. * * The connection is removed again automatically if it is closed. * * Returns: Whether the connection was added to the directory. **/ gboolean infd_directory_add_connection(InfdDirectory* directory, InfXmlConnection* connection) { InfdDirectoryPrivate* priv; InfdDirectoryConnectionInfo* info; InfXmlConnectionStatus status; GHashTableIter iter; gpointer value; guint seq_id; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), FALSE); g_return_val_if_fail(INF_IS_XML_CONNECTION(connection), FALSE); priv = INFD_DIRECTORY_PRIVATE(directory); g_return_val_if_fail(priv->communication_manager != NULL, FALSE); g_return_val_if_fail( g_hash_table_lookup(priv->connections, connection) == NULL, FALSE ); inf_communication_hosted_group_add_member(priv->group, connection); /* Find a free seq id */ seq_id = 1; g_hash_table_iter_init(&iter, priv->connections); while(g_hash_table_iter_next(&iter, NULL, &value)) { info = (InfdDirectoryConnectionInfo*)value; if(info->seq_id >= seq_id) seq_id = info->seq_id + 1; g_assert(seq_id > info->seq_id); /* check for overflow */ } info = g_slice_new(InfdDirectoryConnectionInfo); info->seq_id = seq_id; g_hash_table_insert(priv->connections, connection, info); g_object_ref(connection); g_signal_connect( G_OBJECT(connection), "notify::status", G_CALLBACK(infd_directory_connection_notify_status_cb), directory ); g_object_get(G_OBJECT(connection), "status", &status, NULL); if(status == INF_XML_CONNECTION_OPEN) infd_directory_send_welcome_message(directory, connection); return TRUE; } /** * infd_directory_foreach_connection: * @directory: A #InfdDirectory. * @func: The function to call for each connection in @directory. * @user_data: Additional data to pass to the callback function. * * Calls @func for each connection in @directory that has previously been * added to the directory. */ void infd_directory_foreach_connection(InfdDirectory* directory, InfdDirectoryForeachConnectionFunc func, gpointer userdata) { InfdDirectoryPrivate* priv; GHashTableIter iter; gpointer key; g_return_if_fail(INFD_IS_DIRECTORY(directory)); g_return_if_fail(func != NULL); priv = INFD_DIRECTORY_PRIVATE(directory); g_hash_table_iter_init(&iter, priv->connections); while (g_hash_table_iter_next(&iter, &key, NULL)) { func(INF_XML_CONNECTION(key), userdata); } } /** * infd_directory_iter_get_name: * @directory: A #InfdDirectory. * @iter: A #InfdDirectoryIter pointing to a node in @directory. * * Returns the name of the node @iter points to. * * Returns: The node's name. The returned string must not be freed. */ const gchar* infd_directory_iter_get_name(InfdDirectory* directory, InfdDirectoryIter* iter) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), NULL); g_return_val_if_fail(iter != NULL, NULL); infd_directory_return_val_if_iter_fail(directory, iter, NULL); priv = INFD_DIRECTORY_PRIVATE(directory); node = (InfdDirectoryNode*)iter->node; return node->name; } /** * infd_directory_iter_get_path: * @directory: A #InfdDirectory. * @iter: A #InfdDirectoryIter pointing to a node in @directory. * * Returns the complete path to the node @iter points to. The path to a node * is the name of the node and the name of all parent nodes separated by '/', * as a filesystem path on Unix. * * Returns: The node's path. Free with g_free() when no longer in use. */ gchar* infd_directory_iter_get_path(InfdDirectory* directory, InfdDirectoryIter* iter) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; gchar* path; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), NULL); g_return_val_if_fail(iter != NULL, NULL); infd_directory_return_val_if_iter_fail(directory, iter, NULL); priv = INFD_DIRECTORY_PRIVATE(directory); node = (InfdDirectoryNode*)iter->node; infd_directory_node_get_path(node, &path, NULL); return path; } /** * infd_directory_iter_get_root: * @directory: A #InfdDirectory * @iter: An uninitalized #InfdDirectoryIter. * * Sets @iter to point to the root node of the directory. **/ void infd_directory_iter_get_root(InfdDirectory* directory, InfdDirectoryIter* iter) { InfdDirectoryPrivate* priv; g_return_if_fail(INFD_IS_DIRECTORY(directory)); g_return_if_fail(iter != NULL); priv = INFD_DIRECTORY_PRIVATE(directory); g_assert(priv->root != NULL); iter->node_id = priv->root->id; iter->node = priv->root; } /** * infd_directory_iter_get_next: * @directory: A #InfdDirectory. * @iter: A #InfdDirectoryIter pointing to some node in @directory. * * Sets @iter to point to the next node within the same subdirectory. If there * is no next node, @iter is left untouched and the function returns %FALSE. * * Return Value: %TRUE, if @iter was set. **/ gboolean infd_directory_iter_get_next(InfdDirectory* directory, InfdDirectoryIter* iter) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), FALSE); g_return_val_if_fail(iter != NULL, FALSE); infd_directory_return_val_if_iter_fail(directory, iter, FALSE); priv = INFD_DIRECTORY_PRIVATE(directory); node = (InfdDirectoryNode*)iter->node; if(node->next != NULL) { iter->node_id = node->next->id; iter->node = node->next; return TRUE; } else { return FALSE; } } /** * infd_directory_iter_get_prev: * @directory: A #InfdDirectory. * @iter: A #InfdDirectoryIter pointing to some node in @directory. * * Sets @iter to point to the previous node within the same subdirectory. If * there is no such node, @iter is left untouched and the function returns * %FALSE. * * Return Value: %TRUE, if @iter was set. **/ gboolean infd_directory_iter_get_prev(InfdDirectory* directory, InfdDirectoryIter* iter) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), FALSE); g_return_val_if_fail(iter != NULL, FALSE); infd_directory_return_val_if_iter_fail(directory, iter, FALSE); priv = INFD_DIRECTORY_PRIVATE(directory); node = (InfdDirectoryNode*)iter->node; if(node->prev != NULL) { iter->node_id = node->prev->id; iter->node = node->prev; return TRUE; } else { return FALSE; } } /** * infd_directory_iter_get_parent: * @directory: A #InfdDirectory. * @iter: A #InfdDirectoryIter pointing to some node in @directory. * * Sets @iter to point to the parent node of @iter. This node is guaranteed * to be a subdirectory node. If there is no such node (i.e. @iter points * to the root node), @iter is left untouched and the function returns %FALSE. * * Return Value: %TRUE, if @iter was set. **/ gboolean infd_directory_iter_get_parent(InfdDirectory* directory, InfdDirectoryIter* iter) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), FALSE); g_return_val_if_fail(iter != NULL, FALSE); infd_directory_return_val_if_iter_fail(directory, iter, FALSE); priv = INFD_DIRECTORY_PRIVATE(directory); node = (InfdDirectoryNode*)iter->node; if(node->parent != NULL) { iter->node_id = node->parent->id; iter->node = node->parent; return TRUE; } else { return FALSE; } } /** * infd_directory_iter_get_child: * @directory: A #InfdDirectory. * @iter: A #InfdDirectoryIter pointing to a subdirectory node in @directory. * @error: Location to store error information. * * Sets @iter to point to first child node of @iter. This requires that @iter * points to a subdirectory node. If the subdirectory @iter points to has * no children, the function returns %FALSE and @iter is left untouched. * * The function might fail if this node's children have not yet been read * from the background storage and an error occurs while reading them. In * this case, %FALSE is returned and @error is set. * * The function guarantees not to set @error if the node is already explored, * i.e. infd_directory_iter_get_explored() returns %TRUE for @directory and * @iter. * * Return Value: %TRUE, if @iter was set. **/ gboolean infd_directory_iter_get_child(InfdDirectory* directory, InfdDirectoryIter* iter, GError** error) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), FALSE); g_return_val_if_fail(iter != NULL, FALSE); infd_directory_return_val_if_iter_fail(directory, iter, FALSE); infd_directory_return_val_if_subdir_fail(iter->node, FALSE); priv = INFD_DIRECTORY_PRIVATE(directory); node = (InfdDirectoryNode*)iter->node; if(node->shared.subdir.explored == FALSE) { if(infd_directory_node_explore(directory, node, error) == FALSE) return FALSE; g_assert(node->shared.subdir.explored == TRUE); } if(node->shared.subdir.child != NULL) { iter->node_id = node->shared.subdir.child->id; iter->node = node->shared.subdir.child; return TRUE; } else { return FALSE; } } /** * infd_directory_iter_get_explored: * @directory: A #InfdDirectory. * @iter: A #InfdDirectoryIter pointing to a subdirectory node in @directory. * * Returns whether the subdirectory node pointed to by @iter has already * been read from the background storage. If not, then no connections can * be subscribed to any child nodes. * * Returns: Whether the node @iter points to has been explored. */ gboolean infd_directory_iter_get_explored(InfdDirectory* directory, InfdDirectoryIter* iter) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), FALSE); g_return_val_if_fail(iter != NULL, FALSE); infd_directory_return_val_if_iter_fail(directory, iter, FALSE); infd_directory_return_val_if_subdir_fail(iter->node, FALSE); priv = INFD_DIRECTORY_PRIVATE(directory); node = (InfdDirectoryNode*)iter->node; return node->shared.subdir.explored; } /** * infd_directory_add_subdirectory: * @directory: A #InfdDirectory. * @parent: A #InfdDirectoryIter pointing to a subdirectory node * in @directory. * @name: The name of the new node. * @iter: An uninitalized #InfdDirectoryIter. * @error: Location to store error information. * * Adds a subdirectory to the directory tree. The new subdirectory will be * a child the subdirectory @parent points to. @iter is modified to point to * the new subdirectory. If creation fails, the function returns FALSE and * @error is set. * * Return Value: %TRUE if the subdirectory was created successfully. **/ gboolean infd_directory_add_subdirectory(InfdDirectory* directory, InfdDirectoryIter* parent, const gchar* name, InfdDirectoryIter* iter, GError** error) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), FALSE); g_return_val_if_fail(parent != NULL, FALSE); g_return_val_if_fail(name != NULL, FALSE); infd_directory_return_val_if_iter_fail(directory, parent, FALSE); infd_directory_return_val_if_subdir_fail(parent->node, FALSE); priv = INFD_DIRECTORY_PRIVATE(directory); if( ((InfdDirectoryNode*)parent->node)->shared.subdir.explored == FALSE) if(infd_directory_node_explore(directory, parent->node, error) == FALSE) return FALSE; node = infd_directory_node_add_subdirectory( directory, parent->node, name, NULL, NULL, error ); if(node == NULL) return FALSE; if(iter != NULL) { iter->node_id = node->id; iter->node = node; } return TRUE; } /** * infd_directory_add_note: * @directory: A #InfdDirectory. * @parent: A #InfdDirectoryIter pointing to a subdirectory node * in @directory. * @name: The name of the new node. * @plugin: The plugin to use for the node. Must have been added with * infd_directory_add_plugin(). * @iter: An uninitialized #InfdDirectoryIter. * @error: Location to store error information. * * Creates a new note in @directory. It will be child of the subdirectory * node @parent points to. @iter is set to point to the new node. If an * error occurs, the function returns %FALSE and @error is set. * * Return Value: %TRUE on success. **/ gboolean infd_directory_add_note(InfdDirectory* directory, InfdDirectoryIter* parent, const gchar* name, const InfdNotePlugin* plugin, InfdDirectoryIter* iter, GError** error) { InfdDirectoryPrivate* priv; guint node_id; InfCommunicationHostedGroup* group; InfdDirectoryNode* node; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), FALSE); g_return_val_if_fail(parent != NULL, FALSE); g_return_val_if_fail(name != NULL, FALSE); g_return_val_if_fail(plugin != NULL, FALSE); infd_directory_return_val_if_iter_fail(directory, parent, FALSE); infd_directory_return_val_if_subdir_fail(parent->node, FALSE); priv = INFD_DIRECTORY_PRIVATE(directory); if( ((InfdDirectoryNode*)parent->node)->shared.subdir.explored == FALSE) if(infd_directory_node_explore(directory, parent->node, error) == FALSE) return FALSE; node_id = priv->node_counter++; group = infd_directory_create_subscription_group(directory, node_id); node = infd_directory_node_create_new_note( directory, parent->node, group, node_id, name, plugin, error ); if(node == NULL) return FALSE; infd_directory_node_register(directory, node, NULL, NULL); if(iter != NULL) { iter->node = node; iter->node_id = node->id; } return TRUE; } /** * infd_directory_remove_node: * @directory: A #InfdDirectory * @iter: A #InfdDirectoryIter pointing to some node in @directory. * @error: Location to store error information. * * Removes the node @iter points to. If it is a subdirectory node, every * node it contains will also be removed. If the function fails, %FALSE is * returned and @error is set. * * Return Value: %TRUE on success. **/ gboolean infd_directory_remove_node(InfdDirectory* directory, InfdDirectoryIter* iter, GError** error) { InfdDirectoryNode* node; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), FALSE); g_return_val_if_fail(iter != NULL, FALSE); infd_directory_return_val_if_iter_fail(directory, iter, FALSE); node = iter->node; g_return_val_if_fail(node->parent != NULL, FALSE); return infd_directory_node_remove(directory, node, NULL, error); } /** * infd_directory_iter_get_node_type: * @directory: A #InfdDirectory. * @iter: A #InfdDirectoryIter pointing to some node in @directory. * * Returns the type of the node @iter points to. * * Returns: A #InfdStorageNodeType. **/ InfdStorageNodeType infd_directory_iter_get_node_type(InfdDirectory* directory, InfdDirectoryIter* iter) { g_return_val_if_fail(INFD_IS_DIRECTORY(directory), INFD_STORAGE_NODE_NOTE); infd_directory_return_val_if_iter_fail( directory, iter, INFD_STORAGE_NODE_NOTE ); return ((InfdDirectoryNode*)iter->node)->type; } /** * infd_directory_iter_get_plugin: * @directory: A #InfdDirectory. * @iter: a #InfdDirectoryIter pointing to a note in @directory. * * Returns the plugin that is used to create a session for the note @iter * points to. * * Return Value: The plugin for the note @iter points to. **/ const InfdNotePlugin* infd_directory_iter_get_plugin(InfdDirectory* directory, InfdDirectoryIter* iter) { InfdDirectoryNode* node; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), NULL); infd_directory_return_val_if_iter_fail(directory, iter, NULL); node = (InfdDirectoryNode*)iter->node; g_return_val_if_fail(node->type != INFD_STORAGE_NODE_NOTE, NULL); return node->shared.note.plugin; } /** * infd_directory_iter_get_session: * @directory: A #InfdDirectory. * @iter: A #InfdDirectoryIter pointing to a note in @directory. * @error: Location to store error information. * * Returns the running session in which the note @iter points to is currently * edited. If the session does not exist, it is created. However, this might * fail if the loading from the background storage fails. In this case, %NULL * is returned and @error is set. * * Return Value: A #InfdSessionProxy for the note @iter points to. **/ InfdSessionProxy* infd_directory_iter_get_session(InfdDirectory* directory, InfdDirectoryIter* iter, GError** error) { InfdDirectoryNode* node; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), NULL); infd_directory_return_val_if_iter_fail(directory, iter, NULL); node = (InfdDirectoryNode*)iter->node; g_return_val_if_fail(node->type == INFD_STORAGE_NODE_NOTE, NULL); return infd_directory_node_get_and_link_session(directory, node, error); } /** * infd_directory_iter_peek_session: * @directory: A #InfdDirectory. * @iter: A #InfdDirectoryIter pointing to a note in @directory. * * Returns the running session in which the note @iter points to is currently * edited. If the session does not exist because nobody is editing it at the * moment, the function returns %NULL. * * Return Value: A #InfdSessionProxy for the note @iter points to, or %NULL. */ InfdSessionProxy* infd_directory_iter_peek_session(InfdDirectory* directory, InfdDirectoryIter* iter) { InfdDirectoryNode* node; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), NULL); infd_directory_return_val_if_iter_fail(directory, iter, NULL); node = (InfdDirectoryNode*)iter->node; g_return_val_if_fail(node->type == INFD_STORAGE_NODE_NOTE, NULL); return node->shared.note.session; } /** * infd_directory_iter_save_session: * @directory: A #InfdDirectory. * @iter: A #InfdDirectoryIter pointing to a note in @directory. * @error: Location to store error information. * * Attempts to store the session the node @iter points to represents into the * background storage. * * Return Value: %TRUE if the operation succeeded, %FALSE otherwise. */ gboolean infd_directory_iter_save_session(InfdDirectory* directory, InfdDirectoryIter* iter, GError** error) { InfdDirectoryPrivate* priv; InfdDirectoryNode* node; gchar* path; gboolean result; g_return_val_if_fail(INFD_IS_DIRECTORY(directory), FALSE); infd_directory_return_val_if_iter_fail(directory, iter, FALSE); priv = INFD_DIRECTORY_PRIVATE(directory); node = (InfdDirectoryNode*)iter->node; g_return_val_if_fail(node->type == INFD_STORAGE_NODE_NOTE, FALSE); if(priv->storage == NULL) { g_set_error( error, inf_directory_error_quark(), INF_DIRECTORY_ERROR_NO_STORAGE, "%s", _("No background storage available") ); return FALSE; } infd_directory_node_get_path(node, &path, NULL); result = node->shared.note.plugin->session_write( priv->storage, infd_session_proxy_get_session(node->shared.note.session), path, node->shared.note.plugin->user_data, error ); /* TODO: Unset modified flag of buffer if result == TRUE */ g_free(path); return result; } /** * infd_directory_enable_chat: * @directory: A #InfdDirectory. * @enable: Whether to enable or disable the chat. * * If @enable is %TRUE, this enables the chat on the server. This allows * clients subscribing to the chat via infc_browser_subscribe_chat(). If * @enable is %FALSE the chat is disabled which means closing an existing * chat session if any and no longer allowing subscription to the chat. * The chat is initially disabled. */ void infd_directory_enable_chat(InfdDirectory* directory, gboolean enable) { InfdDirectoryPrivate* priv; InfCommunicationHostedGroup* group; InfChatSession* session; /* TODO: For the moment, there only exist central methods anyway. In the * long term, this should probably be a property, though. */ static const gchar* const methods[] = { "central", NULL }; g_return_if_fail(INFD_IS_DIRECTORY(directory)); priv = INFD_DIRECTORY_PRIVATE(directory); if(enable) { if(priv->chat_session == NULL) { group = inf_communication_manager_open_group( priv->communication_manager, "InfChat", methods ); session = inf_chat_session_new( priv->communication_manager, 256, INF_SESSION_RUNNING, NULL, NULL ); priv->chat_session = INFD_SESSION_PROXY( g_object_new( INFD_TYPE_SESSION_PROXY, "session", session, "subscription-group", group, NULL ) ); inf_communication_group_set_target( INF_COMMUNICATION_GROUP(group), INF_COMMUNICATION_OBJECT(priv->chat_session) ); g_object_unref(session); g_object_unref(group); g_object_notify(G_OBJECT(directory), "chat-session"); } } else { if(priv->chat_session != NULL) { inf_session_close(infd_session_proxy_get_session(priv->chat_session)); g_object_unref(priv->chat_session); priv->chat_session = NULL; g_object_notify(G_OBJECT(directory), "chat-session"); } } } /** * infd_directory_get_chat_session: * @directory: A #InfdDirectory. * * Returns a #InfdSessionProxy for the chat session, if any. If the chat is * enabled (see infd_directory_enable_chat()) this returns a #InfdSessionProxy * that can be used to join local users to the chat, or to get chat contents * (by getting the #InfChatBuffer from the proxy's #InfChatSession). If the * chat is disabled the function returns %NULL. * * Returns: A #InfdSessionProxy, or %NULL if the chat is disabled. */ InfdSessionProxy* infd_directory_get_chat_session(InfdDirectory* directory) { g_return_val_if_fail(INFD_IS_DIRECTORY(directory), NULL); return INFD_DIRECTORY_PRIVATE(directory)->chat_session; } /* vim:set et sw=2 ts=2: */
lgpl-2.1
seiya64/dafcollage
ejercicios/ejercicios_modificar_asociacion_simple.php
11528
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* Daf-collage is made up of two Moodle modules which help in the process of German language learning. It facilitates the content organization like vocabulary or the main grammar features and gives the chance to create exercises in order to consolidate knowledge. Copyright (C) 2011 Coordination: Ruth Burbat Source code: Francisco Javier Rodríguez López (seiyadesagitario@gmail.com) Simeón Ruiz Romero (simeonruiz@gmail.com) Serafina Molina Soto(finamolinasoto@gmail.com) Original idea: Ruth Burbat Content design: Ruth Burbat AInmaculada Almahano Güeto Andrea Bies Julia Möller Runge Blanca Rodríguez Gómez Antonio Salmerón Matilla María José Varela Salinas Karin Vilar Sánchez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ require_once("../../config.php"); require_once("lib.php"); require_once("ejercicios_clase_general.php"); require_once("ejercicios_form_creacion.php"); require_once("YoutubeVideoHelper.php"); $id_curso = optional_param('id_curso', 0, PARAM_INT); $id_ejercicio = optional_param('id_ejercicio', 0, PARAM_INT); $tipo_origen = optional_param('tipo_origen', 0, PARAM_INT); $tipo_respuesta = optional_param('tr', 0, PARAM_INT); $tipo_creacion = optional_param('tipocreacion', 0, PARAM_INT); ECHO "MODIFICANDO"; $mform = new mod_ejercicios_mostrar_ejercicio_asociacion_simple($id_curso, $id_ejercicio, $tipo_origen, $tipo_respuesta, $tipocreacion); $mform->mostrar_ejercicio_asociacion_simple($id_curso, $id_ejercicio, 0, $tipo_origen, $tipo_respuesta, $tipocreacion); $numeropreguntas = optional_param('num_preg', 0, PARAM_INT); echo "El numero de pregunas es" . $numeropreguntas; $ejercicio_general = new Ejercicios_general(); $miejercicio=$ejercicio_general->obtener_uno($id_ejercicio); $miejercicio->set_numpregunta($numeropreguntas); $fuentes = optional_param('fuentes',PARAM_TEXT); $miejercicio->set_fuentes($fuentes); $miejercicio->alterar(); begin_sql(); if ($tipo_origen == 1) { //la pregunta es un texto if ($tipo_respuesta == 1) {//Es un texto //obtengo los id de las preguntas del ejercicio $id_preguntas = array(); $mis_preguntas = new Ejercicios_texto_texto_preg(); $id_preguntas = $mis_preguntas->obtener_todas_preguntas_ejercicicio($id_ejercicio); //borro las respuestas for ($s = 0; $s < sizeof($id_preguntas); $s++) { delete_records('ejercicios_texto_texto_resp', 'id_pregunta', $id_preguntas[$s]->get('id')); } } else { if ($tipo_respuesta == 2) { //la respuesta es un audio echo "actualizando audio"; //obtengo los id de las preguntas del ejercicio $id_preguntas = array(); $mis_preguntas = new Ejercicios_texto_texto_preg(); $id_preguntas = $mis_preguntas->obtener_todas_preguntas_ejercicicio($id_ejercicio); //borro las respuestas for ($s = 0; $s < sizeof($id_preguntas); $s++) { delete_records('ejercicios_audios_asociados', 'id_ejercicio', $id_ejercicio); } } else { if ($tipo_respuesta == 3) {//video echo "actualizando video"; //obtengo los id de las preguntas del ejercicio $id_preguntas = array(); $mis_preguntas = new Ejercicios_texto_texto_preg(); $id_preguntas = $mis_preguntas->obtener_todas_preguntas_ejercicicio($id_ejercicio); //borro las respuestas for ($s = 0; $s < sizeof($id_preguntas); $s++) { delete_records('ejercicios_videos_asociados', 'id_ejercicio', $id_ejercicio); } } else { if ($tipo_respuesta == 4) { echo "actualizando imagen"; //obtengo los id de las preguntas del ejercicio $id_preguntas = array(); $mis_preguntas = new Ejercicios_texto_texto_preg(); $id_preguntas = $mis_preguntas->obtener_todas_preguntas_ejercicicio($id_ejercicio); //borro las respuestas for ($s = 0; $s < sizeof($id_preguntas); $s++) { delete_records('ejercicios_imagenes_asociadas', 'id_ejercicio', $id_ejercicio); } } } } } //borro las preguntas delete_records('ejercicios_texto_texto_preg', 'id_ejercicio', $id_ejercicio); } else { if ($tipo_origen == 2) { //Pregunta es un Audio //borro las preguntas $id_preguntas = array(); $mis_preguntas = new Ejercicios_texto_texto_preg(); $id_preguntas = $mis_preguntas->obtener_todas_preguntas_ejercicicio($id_ejercicio); //borro las respuestas for ($s = 0; $s < sizeof($id_preguntas); $s++) { delete_records('ejercicios_audios_asociados', 'id_ejercicio', $id_ejercicio); } if ($tipo_respuesta == 1) { //La respuesta es un texto //borro las respuestas delete_records('ejercicios_texto_texto_preg', 'id_ejercicio', $id_ejercicio); } } else { if ($tipo_origen == 3) {//video echo "actualizando video"; //obtengo los id de las preguntas del ejercicio $id_preguntas = array(); $mis_preguntas = new Ejercicios_texto_texto_preg(); $id_preguntas = $mis_preguntas->obtener_todas_preguntas_ejercicicio($id_ejercicio); //borro las respuestas for ($s = 0; $s < sizeof($id_preguntas); $s++) { delete_records('ejercicios_videos_asociados', 'id_ejercicio', $id_ejercicio); } if ($tipo_respuesta == 1) { //La respuesta es un texto //borro las respuestas delete_records('ejercicios_texto_texto_preg', 'id_ejercicio', $id_ejercicio); } } else if ($tipo_origen==4) //La pregunta es una imagen { if ($tipo_respuesta == 1) { //La respuesta es un texto echo "actualizando imagen"; //obtengo los id de las preguntas del ejercicio $id_preguntas = array(); $mis_preguntas = new Ejercicios_texto_texto_preg(); $id_preguntas = $mis_preguntas->obtener_todas_preguntas_ejercicicio($id_ejercicio); //borro las respuestas for ($s = 0; $s < sizeof($id_preguntas); $s++) { delete_records('ejercicios_imagenes_asociadas', 'id_ejercicio', $id_ejercicio); } delete_records('ejercicios_texto_texto_preg', 'id_ejercicio', $id_ejercicio); echo 'Borradas imagenes'; } } } } //Guardo las nuevas for ($i = 0; $i < $numeropreguntas; $i++) { //Obtengo el numero de respuestas a cada pregunta $j = $i + 1; if ($tipo_origen == 1) { //Si la pregunta es un texto $preg = required_param('pregunta' . $j, PARAM_TEXT); $ejercicio_texto_preg = new Ejercicios_texto_texto_preg(NULL, $id_ejercicio, $preg); $id_pregunta = $ejercicio_texto_preg->insertar(); if ($tipo_respuesta == 1) { //Si la respuesta es un texto $resp = required_param('respuesta' . $j, PARAM_TEXT); $correcta = 0; $ejercicio_texto_resp = new Ejercicios_texto_texto_resp(NULL, $id_pregunta, $resp, $correcta); $ejercicio_texto_resp->insertar(); } else { if ($tipo_respuesta == 2) { //es un audio $ejercicio_texto_audio = new Ejercicios_audios_asociados($NULL, $id_ejercicio, $id_pregunta, 'audio_' . $id_ejercicio . "_" . $j . ".mp3"); $ejercicio_texto_audio->insertar(); } else { if ($tipo_respuesta == 3) { //ES UN VIDEO $resp = YoutubeVideoHelper::getVideoId(required_param('archivovideo' . $j, PARAM_TEXT)); echo "archivo video" . $resp; $ejercicio_texto_video = new Ejercicios_videos_asociados(NULL, $id_ejercicio, $id_pregunta, $resp); $ejercicio_texto_video->insertar(); } else { if ($tipo_respuesta == 4) { //eS UNA IMAGEN $ejercicio_texto_img = new Ejercicios_imagenes_asociadas($NULL, $id_ejercicio, $id_pregunta, 'foto_' . $id_ejercicio . "_" . $j . ".jpg"); $ejercicio_texto_img->insertar(); } } } } } else { if ($tipo_origen == 2) { //la pregunta es un audio // echo "entra"; $preg = required_param('pregunta' . $j, PARAM_TEXT); $ejercicio_texto_preg = new Ejercicios_texto_texto_preg(NULL, $id_ejercicio, $preg); $id_pregunta = $ejercicio_texto_preg->insertar(); if ($tipo_respuesta == 1) { //la respuesta es un texto // echo "entra 2"; $ejercicio_texto_audio = new Ejercicios_audios_asociados($NULL, $id_ejercicio, $id_pregunta, 'audio_' . $id_ejercicio . "_" . $j . ".mp3"); $ejercicio_texto_audio->insertar(); } } else { if ($tipo_origen == 3) { //ES UN VIDEO if (YoutubeVideoHelper::getVideoId(required_param('archivovideo' . $j, PARAM_TEXT)) != null){ $preg = required_param('pregunta' . $j, PARAM_TEXT); $ejercicio_texto_preg = new Ejercicios_texto_texto_preg(NULL, $id_ejercicio, $preg); $id_pregunta = $ejercicio_texto_preg->insertar(); $resp = YoutubeVideoHelper::getVideoId(required_param('archivovideo' . $j, PARAM_TEXT)); echo "archivo video" . $resp; $ejercicio_texto_video = new Ejercicios_videos_asociados(NULL, $id_ejercicio, $id_pregunta, $resp); $ejercicio_texto_video->insertar(); echo "insertado"; } } else if ($tipo_origen == 4) { // ES UNA IMAGEN if ($tipo_respuesta == 1) { //La respuesta es un texto $preg = required_param('pregunta' . $j, PARAM_TEXT); $ejercicio_texto_preg = new Ejercicios_texto_texto_preg(NULL, $id_ejercicio, $preg); $id_pregunta = $ejercicio_texto_preg->insertar(); $ejercicio_texto_img = new Ejercicios_imagenes_asociadas($NULL, $id_ejercicio, $id_pregunta, 'foto_' . $id_ejercicio . "_" . $j . ".jpg"); $ejercicio_texto_img->insertar(); } } } } } commit_sql(); redirect('./view.php?id=' . $id_curso . '&opcion=9'); ?>
lgpl-2.1
knevcher/limb
web_app/src/controller/lmbWactTemplateSourceController.class.php
2939
<?php /** * Limb Web Application Framework * * @link http://limb-project.com * * @copyright Copyright &copy; 2004-2009 BIT * @license LGPL http://www.gnu.org/copyleft/lesser.html * @version $Id$ * @package web_app */ lmb_require('limb/web_app/src/controller/lmbController.class.php'); lmb_require('limb/view/src/wact/lmbWactHighlightHandler.class.php'); require_once('limb/view/lib/XML/HTMLSax3.php'); abstract class lmbWactTemplateSourceController extends lmbController { protected $template_for_hackers = 'template_source/error.html'; protected $history = array(); protected $highlight_page_url = 'wact_template_source'; function doDisplay() { require_once('limb/wact/src/compiler/templatecompiler.inc.php'); require_once('limb/view/src/lmbWactView.class.php'); $this->setTemplate('template_source/display.html'); if(($t = $this->request->get('t')) && is_array($t) && sizeof($t) > 0) { $this->history = $t; $template_path = end($this->history); } else { $this->setTemplate($this->template_for_hackers); return; } if(substr($template_path, -5, 5) != '.html') $template_path = $this->template_for_hackers; $wact_locator = $this->toolkit->getWactLocator(); if(!$source_file_path = $wact_locator->locateSourceTemplate($template_path)) { $this->setTemplate($this->template_for_hackers); return; } $template_contents = file_get_contents($source_file_path); if(sizeof($this->history) > 1) { $tmp_history = $this->history; $from_template_path = $tmp_history[sizeof($tmp_history) - 2]; $tmp_history = array_splice($tmp_history, 0, sizeof($tmp_history) - 1); $history_query = 't[]=' . implode('&t[]=', $tmp_history); $this->view->set('history_query', $this->highlight_page_url . '?' .$history_query); $this->view->set('from_template_path', $from_template_path); } $this->view->set('template_path', $template_path); $this->view->set('this_template_path', $this->view->getTemplate()); $this->view->set('template_content', $this->_processTemplateContent($template_contents)); } function _processTemplateContent($template_contents) { $compiler = $this->view->getWactTemplate()->createCompiler(); $tag_dictionary = $compiler->getTagDictionary(); $parser = new XML_HTMLSax3(); $handler = new lmbWactHighlightHandler($tag_dictionary, $this->highlight_page_url); $handler->setTemplatePathHistory($this->history); $parser->set_object($handler); $parser->set_element_handler('openHandler','closeHandler'); $parser->set_data_handler('dataHandler'); $parser->set_escape_handler('escapeHandler'); $parser->parse($template_contents); $html = $handler->getHtml(); return $html; } }
lgpl-2.1
lodyagin/uranium
U-238/u/html/v/standard/html_tag_form_v.pl
6066
% This file is a part of Uranium, a general-purpose % functional test platform. % % Copyright (C) 2011, Sergei Lodyagin % Copyright (C) 2012, Kogorta OOO Ltd % % This library is free software; you can redistribute it % and/or modify it under the terms of the GNU Lesser % General Public License as published by the Free % Software Foundation; either version 2.1 of the License, % or (at your option) any later version. % % This library is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the % implied warranty of MERCHANTABILITY or FITNESS FOR A % PARTICULAR PURPOSE. See the GNU Lesser General Public % License for more details. % % You should have received a copy of the GNU Lesser % General Public License along with this library; if not, % write to the Free Software Foundation, Inc., 51 % Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA % % e-mail: lodyagin@gmail.com % post: 49017 Ukraine, Dnepropetrovsk per. Kamenski, 6 :- module(html_tag_form_v, [form_nv_list/2 ]). /** <module> Html form tag. == <!ELEMENT FORM - - (%block;|SCRIPT)+ -(FORM) -- interactive form --> <!ATTLIST FORM %attrs; -- %coreattrs, %i18n, %events -- action %URI; #REQUIRED -- server-side form handler -- method (GET|POST) GET -- HTTP method used to submit the form-- enctype %ContentType; "application/x-www-form-urlencoded" accept %ContentTypes; #IMPLIED -- list of MIME types for file upload -- name CDATA #IMPLIED -- name of form for scripting -- onsubmit %Script; #IMPLIED -- the form was submitted -- onreset %Script; #IMPLIED -- the form was reset -- accept-charset %Charsets; #IMPLIED -- list of supported charsets -- > == */ :- use_module(u(v)). :- use_module(u(ixpath)). :- use_module(html_tag_v). new_class(html_tag_form_v, html_tag_v, [ '.action', '.method', '.enctype', '.accept', '.name', '.onsubmit', '.onreset', '.accept-charset' ]). % html_tag_form_v will be downcast to form_<name>_v which % is descendant of it. new_class(form_v, html_tag_form_v, []). % Represent all input fields as an object fields 'html_tag_form_v?'(Object, class, Class) :- Ctx = context('html_tag_form_v?'/3, _), obj_unify(Object, ['.id', '.class'], [Tag_Id, Tag_Class]), ( nonvar(Tag_Id) -> Name = Tag_Id ; nonvar(Tag_Class) -> Name = Tag_Class ; functor(Object, Class, _) ), ( nonvar(Class) -> true % FIXME ; concat_atom([form, Name, v], '_', Class), form_class_fields(Object, Fields), ( class_name(Class) -> class_fields(Class, All_Fields), ( ord_subset(Fields, All_Fields) -> true ; throw(error(class_exists(Class), Ctx)) ) ; assert_downcast( downcast(html_tag_form_v, Class, From, To) :- downcast_impl(html_tag_form_v, Class, From, To)), class_create(Class, form_v, Fields) ) ). downcast(html_tag_v, html_tag_form_v, From, To) :- gen_html_tag_downcast(From, To). downcast_impl(html_tag_form_v, Class_To, From, To) :- atom_concat(form_, _, Class_To), gen_html_tag_downcast(From, To), fill_default_values(From, To). form_class_fields(Obj, Fields) :- findall(Field_Name, ixpath(//input(@name=Field_Name), Obj, _), Fields1), findall(Field_Name, ixpath(//select(@name=Field_Name), Obj, _), Fields2), findall(Field_Name, ixpath(//textarea(@name=Field_Name), Obj, _), Fields3), append([Fields1, Fields2, Fields3], All_Fields1), sort(All_Fields1, All_Fields2), maplist(atom_concat('..'), All_Fields2, Fields). fill_default_values(From, To) :- findall(v(Field, Default_Value), ( ixpath(//input(@value=Default_Value, @name=Name), From, _), atom_concat('..', Name, Field) ), Fields), foreach( member(v(Field, Value), Fields), ignore(obj_field(To, Field, Value)) ), % radio buttons findall(v(Name1, Default_Value), ( bagof(radio(Value, Checked), Radio^(ixpath(//input(@type=radio, @value=Value, @name=Name), [v], From, Radio), obj_field(Radio, '.checked', Checked) ), Radios ), ( member(radio(Value, Checked), Radios), nonvar(Checked), ( downcase_atom(Checked, checked) -> true ; print_message(warning, html_invalid_attribute_value(checked, Checked)), fail ) -> Default_Value = Value ; Radios = [radio(Default_Value, _) | _] ), atom_concat('..', Name, Name1) ), Radio_Fields ), foreach( member(v(Field, Value), Radio_Fields), ignore(obj_field(To, Field, Value)) ). % TODO checkboxes %% form_nv_list(+Form, -NV_List) is det. % % Convert form_v descendant to a list of Field_Name = Value. All % field names (of the object) started with '..' are returned % with '..' stripped. form_nv_list(Form, NV_List) :- functor(Form, Class, _), class_fields(Class, Fields), findall(Name=Value, ( member(Field, Fields), atom_concat('..', Name, Field), obj_field(Form, Field, Value0), ( nonvar(Value0) -> Value = Value0 ; Value = '' ) ), NV_List).
lgpl-2.1
raiarun/HomeGuard
publisher.py
4016
""" ECE 4564 Final Project Team: Immortal Title: HomeGuard - Home Visitors Detection and Alert System Filename: publisher.py Members: Arun Rai, Mohammad Islam, and Yihan Pang Date: 11/26/2014 --------------------------------------------------------------------- Description: 1. Receive host user information, and send it to the subscriber. 2. Receive visitors' message and send it to the subscriber. 3. Receive sensor reading, and send trigger signal to camera to the subscriber. Network protocols: TCP/IP and AMQP --------------------------------------------------------------------- """ #!/usr/bin/python import sys import threading from infoSetup import infoSetup from getSensorData import getSensorData from setVisitorMessage import setVisitorMessage import time import signal import socket import json """ Default host IP address and port number """ HOST = "127.0.0.1" PORT = 9000 class HostInformation: def __init__(self): self.senderNumber = ''; self.receiverNumber = '' self.receiverEmail = 'sangpang20@gmail.com'; self.loop = True; self.s = ''; self.emailOnly = True; self.smsOnly = False; self.both = False; self.Message = {}; self.msgSignal = False; """ Set receiver's phone number """ def setPhoneNumber(self, number): self.receiverNumber = number; self.smsOnly = True; self.emailOnly = False; self.both = False; """ Set receiver's email id """ def setEmail(self, email): self.receiverEmail = email; self.emailOnly = True; self.smsOnly = False; self.both = False; """ Set both email and phone nubmer """ def setBoth(self, email, phone): self.receiverEmail = email; self.receiverNumber = phone; self.both = True; self.emailOnly = False; self.smsOnly = False; def getReceiverNumber(self): return self.receiverNumber; def getReceiverEmail(self): return self.receiverEmail; def getSenderEmail(self): return self.senderEmail; def getSenderEmailPass(self): return self.senderPassword; def messageInEmail(self): return self.emailOnly; def messageInSms(self): return self.smsOnly; def messageInBoth(self): return self.both; def setLoopState(self, signal=None, frame=None): print 'Gracefully closing the socket .................' self.loop = False; self.s.close(); """ Here, the message is of type dictionary """ def setMessage(self, message): self.Message = message; def getMessage(self): return self.Message; def setMessageSignal(self, sig): self.msgSignal = sig; def getMessageSignal(self): return self.msgSignal; def getLoopState(self): return self.loop; """ The function is called before the program exits for gracefully closing the socket when user enters Ctrl + c. """ def closeSocket(self, s): self.s = s; def main(): setHostInfo = HostInformation() """ Sensor thread: sensor reading is performed""" sensorThread = threading.Thread(target = getSensorData, args = [setHostInfo,]); """ start the thread """ sensorThread.start() """ Setup signal handlers to shutdown this app when SIGINT or SIGTERM is sent to this app """ signal_num = signal.SIGINT try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(1) """ main thread """ while setHostInfo.getLoopState(): try: setHostInfo.closeSocket(s); signal.signal(signal_num, setHostInfo.setLoopState) signal_num = signal.SIGTERM signal.signal(signal_num, setHostInfo.setLoopState) except ValueError as error1: print "Warning: Greceful shutdown may not be possible: Unsupported" print "Signal: " + signal_num conn, addr = s.accept() message = conn.recv(1024) if len(message) > 3: if message[0] == '$' and message[1] == '$' and message[2] == '$': setVisitorMessage(setHostInfo, message) else: infoSetup(setHostInfo, message) except socket.error, se: print 'connection failed/socket closed. \n', se if s: s.close(); sensorThread.join() if __name__ == '__main__': main();
lgpl-2.1
argriffing/arb
acb_poly/test/t-lgamma_series.c
3790
/* Copyright (C) 2012, 2013 Fredrik Johansson This file is part of Arb. Arb is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <http://www.gnu.org/licenses/>. */ #include "acb_poly.h" int main() { slong iter; flint_rand_t state; flint_printf("lgamma_series...."); fflush(stdout); flint_randinit(state); /* special accuracy test case */ { acb_poly_t a; acb_t c; acb_init(c); acb_poly_init(a); arb_set_str(acb_realref(c), "-20.25", 53); arb_set_str(acb_imagref(c), "1e1000", 53); acb_poly_set_coeff_acb(a, 0, c); acb_poly_set_coeff_si(a, 1, 1); acb_poly_lgamma_series(a, a, 3, 53); if (acb_rel_accuracy_bits(a->coeffs) < 40 || acb_rel_accuracy_bits(a->coeffs + 1) < 40 || acb_rel_accuracy_bits(a->coeffs + 2) < 40) { flint_printf("FAIL: accuracy (reflection formula)\n\n"); acb_poly_printd(a, 15); flint_printf("\n\n"); abort(); } acb_poly_clear(a); acb_clear(c); } for (iter = 0; iter < 500 * arb_test_multiplier(); iter++) { slong m, n1, n2, rbits1, rbits2, rbits3; acb_poly_t a, b, c, d; rbits1 = 2 + n_randint(state, 200); rbits2 = 2 + n_randint(state, 200); rbits3 = 2 + n_randint(state, 200); m = 1 + n_randint(state, 30); n1 = 1 + n_randint(state, 30); n2 = 1 + n_randint(state, 30); acb_poly_init(a); acb_poly_init(b); acb_poly_init(c); acb_poly_init(d); acb_poly_randtest(a, state, m, rbits1, 10); acb_poly_randtest(b, state, m, rbits1, 10); acb_poly_randtest(c, state, m, rbits1, 10); acb_poly_lgamma_series(b, a, n1, rbits2); acb_poly_lgamma_series(c, a, n2, rbits3); acb_poly_set(d, b); acb_poly_truncate(d, FLINT_MIN(n1, n2)); acb_poly_truncate(c, FLINT_MIN(n1, n2)); if (!acb_poly_overlaps(c, d)) { flint_printf("FAIL\n\n"); flint_printf("n1 = %wd, n2 = %wd, bits2 = %wd, bits3 = %wd\n", n1, n2, rbits2, rbits3); flint_printf("a = "); acb_poly_printd(a, 15); flint_printf("\n\n"); flint_printf("b = "); acb_poly_printd(b, 15); flint_printf("\n\n"); flint_printf("c = "); acb_poly_printd(c, 15); flint_printf("\n\n"); abort(); } /* check loggamma(a) + log(a) = loggamma(a+1) */ acb_poly_log_series(c, a, n1, rbits2); acb_poly_add(c, b, c, rbits2); acb_poly_set(d, a); acb_add_ui(d->coeffs, d->coeffs, 1, rbits2); acb_poly_lgamma_series(d, d, n1, rbits2); if (!acb_poly_overlaps(c, d)) { flint_printf("FAIL (functional equation)\n\n"); flint_printf("a = "); acb_poly_printd(a, 15); flint_printf("\n\n"); flint_printf("b = "); acb_poly_printd(b, 15); flint_printf("\n\n"); flint_printf("c = "); acb_poly_printd(c, 15); flint_printf("\n\n"); flint_printf("d = "); acb_poly_printd(d, 15); flint_printf("\n\n"); abort(); } acb_poly_lgamma_series(a, a, n1, rbits2); if (!acb_poly_overlaps(a, b)) { flint_printf("FAIL (aliasing)\n\n"); abort(); } acb_poly_clear(a); acb_poly_clear(b); acb_poly_clear(c); acb_poly_clear(d); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
lgpl-2.1
genesi/gtk2
gtk/gtktooltip.c
44741
/* gtktooltip.c * * Copyright (C) 2006-2007 Imendio AB * Contact: Kristian Rietveld <kris@imendio.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "config.h" #include <math.h> #include <string.h> #include "gtktooltip.h" #include "gtkintl.h" #include "gtkwindow.h" #include "gtkmain.h" #include "gtklabel.h" #include "gtkimage.h" #include "gtkhbox.h" #include "gtkalignment.h" #ifdef GDK_WINDOWING_X11 #include "gdk/x11/gdkx.h" #endif #include "gtkalias.h" #undef DEBUG_TOOLTIP #define GTK_TOOLTIP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOOLTIP, GtkTooltipClass)) #define GTK_IS_TOOLTIP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOOLTIP)) #define GTK_TOOLTIP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TOOLTIP, GtkTooltipClass)) typedef struct _GtkTooltipClass GtkTooltipClass; struct _GtkTooltip { GObject parent_instance; GtkWidget *window; GtkWidget *alignment; GtkWidget *box; GtkWidget *image; GtkWidget *label; GtkWidget *custom_widget; GtkWindow *current_window; GtkWidget *keyboard_widget; GtkWidget *tooltip_widget; GdkWindow *toplevel_window; gdouble last_x; gdouble last_y; GdkWindow *last_window; guint timeout_id; guint browse_mode_timeout_id; GdkRectangle tip_area; guint browse_mode_enabled : 1; guint keyboard_mode_enabled : 1; guint tip_area_set : 1; guint custom_was_reset : 1; }; struct _GtkTooltipClass { GObjectClass parent_class; }; #define GTK_TOOLTIP_VISIBLE(tooltip) ((tooltip)->current_window && gtk_widget_get_visible (GTK_WIDGET((tooltip)->current_window))) static void gtk_tooltip_class_init (GtkTooltipClass *klass); static void gtk_tooltip_init (GtkTooltip *tooltip); static void gtk_tooltip_dispose (GObject *object); static void gtk_tooltip_window_style_set (GtkTooltip *tooltip); static gboolean gtk_tooltip_paint_window (GtkTooltip *tooltip); static void gtk_tooltip_window_hide (GtkWidget *widget, gpointer user_data); static void gtk_tooltip_display_closed (GdkDisplay *display, gboolean was_error, GtkTooltip *tooltip); static void gtk_tooltip_set_last_window (GtkTooltip *tooltip, GdkWindow *window); static void update_shape (GtkTooltip *tooltip); G_DEFINE_TYPE (GtkTooltip, gtk_tooltip, G_TYPE_OBJECT); static void gtk_tooltip_class_init (GtkTooltipClass *klass) { GObjectClass *object_class; object_class = G_OBJECT_CLASS (klass); object_class->dispose = gtk_tooltip_dispose; } static void on_composited_changed (GtkWidget *window, GtkTooltip *tooltip) { update_shape (tooltip); } static void on_screen_changed (GtkWidget *window, GdkScreen *previous, GtkTooltip *tooltip) { GdkScreen *screen; GdkColormap *cmap; screen = gtk_widget_get_screen (window); cmap = NULL; if (gdk_screen_is_composited (screen)) cmap = gdk_screen_get_rgba_colormap (screen); if (cmap == NULL) cmap = gdk_screen_get_rgb_colormap (screen); gtk_widget_set_colormap (window, cmap); } static void on_realized (GtkWidget *window, GtkTooltip *tooltip) { update_shape (tooltip); } static void gtk_tooltip_init (GtkTooltip *tooltip) { GdkScreen *screen; tooltip->timeout_id = 0; tooltip->browse_mode_timeout_id = 0; tooltip->browse_mode_enabled = FALSE; tooltip->keyboard_mode_enabled = FALSE; tooltip->current_window = NULL; tooltip->keyboard_widget = NULL; tooltip->tooltip_widget = NULL; tooltip->toplevel_window = NULL; tooltip->last_window = NULL; tooltip->window = g_object_ref (gtk_window_new (GTK_WINDOW_POPUP)); on_screen_changed (tooltip->window, NULL, tooltip); gtk_window_set_type_hint (GTK_WINDOW (tooltip->window), GDK_WINDOW_TYPE_HINT_TOOLTIP); gtk_widget_set_app_paintable (tooltip->window, TRUE); gtk_window_set_resizable (GTK_WINDOW (tooltip->window), FALSE); gtk_widget_set_name (tooltip->window, "gtk-tooltip"); g_signal_connect (tooltip->window, "hide", G_CALLBACK (gtk_tooltip_window_hide), tooltip); tooltip->alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0); gtk_alignment_set_padding (GTK_ALIGNMENT (tooltip->alignment), tooltip->window->style->ythickness, tooltip->window->style->ythickness, tooltip->window->style->xthickness, tooltip->window->style->xthickness); gtk_container_add (GTK_CONTAINER (tooltip->window), tooltip->alignment); gtk_widget_show (tooltip->alignment); g_signal_connect_swapped (tooltip->window, "style-set", G_CALLBACK (gtk_tooltip_window_style_set), tooltip); g_signal_connect_swapped (tooltip->window, "expose-event", G_CALLBACK (gtk_tooltip_paint_window), tooltip); tooltip->box = gtk_hbox_new (FALSE, tooltip->window->style->xthickness); gtk_container_add (GTK_CONTAINER (tooltip->alignment), tooltip->box); gtk_widget_show (tooltip->box); tooltip->image = gtk_image_new (); gtk_box_pack_start (GTK_BOX (tooltip->box), tooltip->image, FALSE, FALSE, 0); tooltip->label = gtk_label_new (""); gtk_label_set_line_wrap (GTK_LABEL (tooltip->label), TRUE); gtk_box_pack_start (GTK_BOX (tooltip->box), tooltip->label, FALSE, FALSE, 0); g_signal_connect (tooltip->window, "composited-changed", G_CALLBACK (on_composited_changed), tooltip); g_signal_connect (tooltip->window, "screen-changed", G_CALLBACK (on_screen_changed), tooltip); g_signal_connect (tooltip->window, "realize", G_CALLBACK (on_realized), tooltip); tooltip->custom_widget = NULL; } static void gtk_tooltip_dispose (GObject *object) { GtkTooltip *tooltip = GTK_TOOLTIP (object); if (tooltip->timeout_id) { g_source_remove (tooltip->timeout_id); tooltip->timeout_id = 0; } if (tooltip->browse_mode_timeout_id) { g_source_remove (tooltip->browse_mode_timeout_id); tooltip->browse_mode_timeout_id = 0; } gtk_tooltip_set_custom (tooltip, NULL); gtk_tooltip_set_last_window (tooltip, NULL); if (tooltip->window) { GdkDisplay *display; display = gtk_widget_get_display (tooltip->window); g_signal_handlers_disconnect_by_func (display, gtk_tooltip_display_closed, tooltip); gtk_widget_destroy (tooltip->window); tooltip->window = NULL; } G_OBJECT_CLASS (gtk_tooltip_parent_class)->dispose (object); } /* public API */ /** * gtk_tooltip_set_markup: * @tooltip: a #GtkTooltip * @markup: (allow-none): a markup string (see <link linkend="PangoMarkupFormat">Pango markup format</link>) or %NULL * * Sets the text of the tooltip to be @markup, which is marked up * with the <link * linkend="PangoMarkupFormat">Pango text markup language</link>. * If @markup is %NULL, the label will be hidden. * * Since: 2.12 */ void gtk_tooltip_set_markup (GtkTooltip *tooltip, const gchar *markup) { g_return_if_fail (GTK_IS_TOOLTIP (tooltip)); gtk_label_set_markup (GTK_LABEL (tooltip->label), markup); if (markup) gtk_widget_show (tooltip->label); else gtk_widget_hide (tooltip->label); } /** * gtk_tooltip_set_text: * @tooltip: a #GtkTooltip * @text: (allow-none): a text string or %NULL * * Sets the text of the tooltip to be @text. If @text is %NULL, the label * will be hidden. See also gtk_tooltip_set_markup(). * * Since: 2.12 */ void gtk_tooltip_set_text (GtkTooltip *tooltip, const gchar *text) { g_return_if_fail (GTK_IS_TOOLTIP (tooltip)); gtk_label_set_text (GTK_LABEL (tooltip->label), text); if (text) gtk_widget_show (tooltip->label); else gtk_widget_hide (tooltip->label); } /** * gtk_tooltip_set_icon: * @tooltip: a #GtkTooltip * @pixbuf: (allow-none): a #GdkPixbuf, or %NULL * * Sets the icon of the tooltip (which is in front of the text) to be * @pixbuf. If @pixbuf is %NULL, the image will be hidden. * * Since: 2.12 */ void gtk_tooltip_set_icon (GtkTooltip *tooltip, GdkPixbuf *pixbuf) { g_return_if_fail (GTK_IS_TOOLTIP (tooltip)); if (pixbuf) g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); gtk_image_set_from_pixbuf (GTK_IMAGE (tooltip->image), pixbuf); if (pixbuf) gtk_widget_show (tooltip->image); else gtk_widget_hide (tooltip->image); } /** * gtk_tooltip_set_icon_from_stock: * @tooltip: a #GtkTooltip * @stock_id: (allow-none): a stock id, or %NULL * @size: (type int): a stock icon size * * Sets the icon of the tooltip (which is in front of the text) to be * the stock item indicated by @stock_id with the size indicated * by @size. If @stock_id is %NULL, the image will be hidden. * * Since: 2.12 */ void gtk_tooltip_set_icon_from_stock (GtkTooltip *tooltip, const gchar *stock_id, GtkIconSize size) { g_return_if_fail (GTK_IS_TOOLTIP (tooltip)); gtk_image_set_from_stock (GTK_IMAGE (tooltip->image), stock_id, size); if (stock_id) gtk_widget_show (tooltip->image); else gtk_widget_hide (tooltip->image); } /** * gtk_tooltip_set_icon_from_icon_name: * @tooltip: a #GtkTooltip * @icon_name: (allow-none): an icon name, or %NULL * @size: (type int): a stock icon size * * Sets the icon of the tooltip (which is in front of the text) to be * the icon indicated by @icon_name with the size indicated * by @size. If @icon_name is %NULL, the image will be hidden. * * Since: 2.14 */ void gtk_tooltip_set_icon_from_icon_name (GtkTooltip *tooltip, const gchar *icon_name, GtkIconSize size) { g_return_if_fail (GTK_IS_TOOLTIP (tooltip)); gtk_image_set_from_icon_name (GTK_IMAGE (tooltip->image), icon_name, size); if (icon_name) gtk_widget_show (tooltip->image); else gtk_widget_hide (tooltip->image); } /** * gtk_tooltip_set_icon_from_gicon: * @tooltip: a #GtkTooltip * @gicon: (allow-none): a #GIcon representing the icon, or %NULL * @size: (type int): a stock icon size * * Sets the icon of the tooltip (which is in front of the text) * to be the icon indicated by @gicon with the size indicated * by @size. If @gicon is %NULL, the image will be hidden. * * Since: 2.20 */ void gtk_tooltip_set_icon_from_gicon (GtkTooltip *tooltip, GIcon *gicon, GtkIconSize size) { g_return_if_fail (GTK_IS_TOOLTIP (tooltip)); gtk_image_set_from_gicon (GTK_IMAGE (tooltip->image), gicon, size); if (gicon) gtk_widget_show (tooltip->image); else gtk_widget_hide (tooltip->image); } /** * gtk_tooltip_set_custom: * @tooltip: a #GtkTooltip * @custom_widget: (allow-none): a #GtkWidget, or %NULL to unset the old custom widget. * * Replaces the widget packed into the tooltip with * @custom_widget. @custom_widget does not get destroyed when the tooltip goes * away. * By default a box with a #GtkImage and #GtkLabel is embedded in * the tooltip, which can be configured using gtk_tooltip_set_markup() * and gtk_tooltip_set_icon(). * * Since: 2.12 */ void gtk_tooltip_set_custom (GtkTooltip *tooltip, GtkWidget *custom_widget) { g_return_if_fail (GTK_IS_TOOLTIP (tooltip)); if (custom_widget) g_return_if_fail (GTK_IS_WIDGET (custom_widget)); /* The custom widget has been updated from the query-tooltip * callback, so we do not want to reset the custom widget later on. */ tooltip->custom_was_reset = TRUE; /* No need to do anything if the custom widget stays the same */ if (tooltip->custom_widget == custom_widget) return; if (tooltip->custom_widget) { GtkWidget *custom = tooltip->custom_widget; /* Note: We must reset tooltip->custom_widget first, * since gtk_container_remove() will recurse into * gtk_tooltip_set_custom() */ tooltip->custom_widget = NULL; gtk_container_remove (GTK_CONTAINER (tooltip->box), custom); g_object_unref (custom); } if (custom_widget) { tooltip->custom_widget = g_object_ref (custom_widget); gtk_container_add (GTK_CONTAINER (tooltip->box), custom_widget); gtk_widget_show (custom_widget); } } /** * gtk_tooltip_set_tip_area: * @tooltip: a #GtkTooltip * @rect: a #GdkRectangle * * Sets the area of the widget, where the contents of this tooltip apply, * to be @rect (in widget coordinates). This is especially useful for * properly setting tooltips on #GtkTreeView rows and cells, #GtkIconViews, * etc. * * For setting tooltips on #GtkTreeView, please refer to the convenience * functions for this: gtk_tree_view_set_tooltip_row() and * gtk_tree_view_set_tooltip_cell(). * * Since: 2.12 */ void gtk_tooltip_set_tip_area (GtkTooltip *tooltip, const GdkRectangle *rect) { g_return_if_fail (GTK_IS_TOOLTIP (tooltip)); if (!rect) tooltip->tip_area_set = FALSE; else { tooltip->tip_area_set = TRUE; tooltip->tip_area = *rect; } } /** * gtk_tooltip_trigger_tooltip_query: * @display: a #GdkDisplay * * Triggers a new tooltip query on @display, in order to update the current * visible tooltip, or to show/hide the current tooltip. This function is * useful to call when, for example, the state of the widget changed by a * key press. * * Since: 2.12 */ void gtk_tooltip_trigger_tooltip_query (GdkDisplay *display) { gint x, y; GdkWindow *window; GdkEvent event; /* Trigger logic as if the mouse moved */ window = gdk_display_get_window_at_pointer (display, &x, &y); if (!window) return; event.type = GDK_MOTION_NOTIFY; event.motion.window = window; event.motion.x = x; event.motion.y = y; event.motion.is_hint = FALSE; gdk_window_get_root_coords (window, x, y, &x, &y); event.motion.x_root = x; event.motion.y_root = y; _gtk_tooltip_handle_event (&event); } /* private functions */ static void gtk_tooltip_reset (GtkTooltip *tooltip) { gtk_tooltip_set_markup (tooltip, NULL); gtk_tooltip_set_icon (tooltip, NULL); gtk_tooltip_set_tip_area (tooltip, NULL); /* See if the custom widget is again set from the query-tooltip * callback. */ tooltip->custom_was_reset = FALSE; } static void gtk_tooltip_window_style_set (GtkTooltip *tooltip) { gtk_alignment_set_padding (GTK_ALIGNMENT (tooltip->alignment), tooltip->window->style->ythickness, tooltip->window->style->ythickness, tooltip->window->style->xthickness, tooltip->window->style->xthickness); gtk_box_set_spacing (GTK_BOX (tooltip->box), tooltip->window->style->xthickness); gtk_widget_queue_draw (tooltip->window); } static void draw_round_rect (cairo_t *cr, gdouble aspect, gdouble x, gdouble y, gdouble corner_radius, gdouble width, gdouble height) { gdouble radius = corner_radius / aspect; cairo_move_to (cr, x + radius, y); /* top-right, left of the corner */ cairo_line_to (cr, x + width - radius, y); /* top-right, below the corner */ cairo_arc (cr, x + width - radius, y + radius, radius, -90.0f * G_PI / 180.0f, 0.0f * G_PI / 180.0f); /* bottom-right, above the corner */ cairo_line_to (cr, x + width, y + height - radius); /* bottom-right, left of the corner */ cairo_arc (cr, x + width - radius, y + height - radius, radius, 0.0f * G_PI / 180.0f, 90.0f * G_PI / 180.0f); /* bottom-left, right of the corner */ cairo_line_to (cr, x + radius, y + height); /* bottom-left, above the corner */ cairo_arc (cr, x + radius, y + height - radius, radius, 90.0f * G_PI / 180.0f, 180.0f * G_PI / 180.0f); /* top-left, below the corner */ cairo_line_to (cr, x, y + radius); /* top-left, right of the corner */ cairo_arc (cr, x + radius, y + radius, radius, 180.0f * G_PI / 180.0f, 270.0f * G_PI / 180.0f); cairo_close_path (cr); } static void fill_background (GtkWidget *widget, cairo_t *cr) { GdkColor color; gdouble r, g, b; gint radius; gdouble background_alpha; if (gdk_screen_is_composited (gtk_widget_get_screen (widget))) background_alpha = 0.85; else background_alpha = 1.0; radius = MIN (widget->style->xthickness, widget->style->ythickness); radius = MAX (radius, 1); cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); cairo_paint (cr); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); draw_round_rect (cr, 1.0, 0.5, 0.5, radius, widget->allocation.width - 1, widget->allocation.height - 1); color = widget->style->bg [GTK_STATE_NORMAL]; r = (float)color.red / 65535.0; g = (float)color.green / 65535.0; b = (float)color.blue / 65535.0; cairo_set_source_rgba (cr, r, g, b, background_alpha); cairo_fill_preserve (cr); color = widget->style->bg [GTK_STATE_SELECTED]; r = (float) color.red / 65535.0; g = (float) color.green / 65535.0; b = (float) color.blue / 65535.0; cairo_set_source_rgba (cr, r, g, b, background_alpha); cairo_set_line_width (cr, 1.0); cairo_stroke (cr); } static void update_shape (GtkTooltip *tooltip) { GdkScreen *screen; GdkBitmap *mask; cairo_t *cr; gint width, height; gboolean new_style; gint radius; gtk_widget_style_get (tooltip->window, "new-tooltip-style", &new_style, NULL); if (!new_style) { gtk_widget_shape_combine_mask (tooltip->window, NULL, 0, 0); return; } screen = gtk_widget_get_screen (tooltip->window); gtk_window_get_size (GTK_WINDOW (tooltip->window), &width, &height); if (gdk_screen_is_composited (screen)) { GdkRectangle rect; GdkRegion *region; const char *wm; gtk_widget_shape_combine_mask (tooltip->window, NULL, 0, 0); #ifdef GDK_WINDOWING_X11 /* This is a hack to keep the Metacity compositor from slapping a * non-shaped shadow around the shaped tooltip */ if (!gtk_widget_get_mapped (tooltip->window)) { wm = gdk_x11_screen_get_window_manager_name (screen); if (g_strcmp0 (wm, "Metacity") == 0) gtk_window_set_type_hint (GTK_WINDOW (tooltip->window), GDK_WINDOW_TYPE_HINT_DND); } #endif return; } radius = MIN (tooltip->window->style->xthickness, tooltip->window->style->ythickness); radius = MAX (radius, 1); mask = (GdkBitmap *) gdk_pixmap_new (NULL, width, height, 1); cr = gdk_cairo_create (mask); if (cairo_status (cr) == CAIRO_STATUS_SUCCESS) { cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); cairo_paint (cr); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); draw_round_rect (cr, 1.0, 0, 0, radius + 1, width, height); cairo_fill (cr); gtk_widget_shape_combine_mask (tooltip->window, mask, 0, 0); } cairo_destroy (cr); g_object_unref (mask); } static gboolean gtk_tooltip_paint_window (GtkTooltip *tooltip) { gboolean new_style; gtk_widget_style_get (tooltip->window, "new-tooltip-style", &new_style, NULL); if (new_style) { cairo_t *context; cairo_surface_t *surface; cairo_t *cr; context = gdk_cairo_create (tooltip->window->window); cairo_set_operator (context, CAIRO_OPERATOR_SOURCE); surface = cairo_surface_create_similar (cairo_get_target (context), CAIRO_CONTENT_COLOR_ALPHA, tooltip->window->allocation.width, tooltip->window->allocation.height); cr = cairo_create (surface); fill_background (tooltip->window, cr); cairo_destroy (cr); cairo_set_source_surface (context, surface, 0, 0); cairo_paint (context); cairo_surface_destroy (surface); cairo_destroy (context); update_shape (tooltip); } else { gtk_paint_flat_box (tooltip->window->style, tooltip->window->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, tooltip->window, "tooltip", 0, 0, tooltip->window->allocation.width, tooltip->window->allocation.height); } return FALSE; } static void gtk_tooltip_window_hide (GtkWidget *widget, gpointer user_data) { GtkTooltip *tooltip = GTK_TOOLTIP (user_data); gtk_tooltip_set_custom (tooltip, NULL); } /* event handling, etc */ struct ChildLocation { GtkWidget *child; GtkWidget *container; gint x; gint y; }; static void child_location_foreach (GtkWidget *child, gpointer data) { gint x, y; struct ChildLocation *child_loc = data; /* Ignore invisible widgets */ if (!gtk_widget_is_drawable (child)) return; x = 0; y = 0; /* (child_loc->x, child_loc->y) are relative to * child_loc->container's allocation. */ if (!child_loc->child && gtk_widget_translate_coordinates (child_loc->container, child, child_loc->x, child_loc->y, &x, &y)) { #ifdef DEBUG_TOOLTIP g_print ("candidate: %s alloc=[(%d,%d) %dx%d] (%d, %d)->(%d, %d)\n", gtk_widget_get_name (child), child->allocation.x, child->allocation.y, child->allocation.width, child->allocation.height, child_loc->x, child_loc->y, x, y); #endif /* DEBUG_TOOLTIP */ /* (x, y) relative to child's allocation. */ if (x >= 0 && x < child->allocation.width && y >= 0 && y < child->allocation.height) { if (GTK_IS_CONTAINER (child)) { struct ChildLocation tmp = { NULL, NULL, 0, 0 }; /* Take (x, y) relative the child's allocation and * recurse. */ tmp.x = x; tmp.y = y; tmp.container = child; gtk_container_forall (GTK_CONTAINER (child), child_location_foreach, &tmp); if (tmp.child) child_loc->child = tmp.child; else child_loc->child = child; } else child_loc->child = child; } } } /* Translates coordinates from dest_widget->window relative (src_x, src_y), * to allocation relative (dest_x, dest_y) of dest_widget. */ static void window_to_alloc (GtkWidget *dest_widget, gint src_x, gint src_y, gint *dest_x, gint *dest_y) { /* Translate from window relative to allocation relative */ if (gtk_widget_get_has_window (dest_widget) && dest_widget->parent) { gint wx, wy; gdk_window_get_position (dest_widget->window, &wx, &wy); /* Offset coordinates if widget->window is smaller than * widget->allocation. */ src_x += wx - dest_widget->allocation.x; src_y += wy - dest_widget->allocation.y; } else { src_x -= dest_widget->allocation.x; src_y -= dest_widget->allocation.y; } if (dest_x) *dest_x = src_x; if (dest_y) *dest_y = src_y; } /* Translates coordinates from window relative (x, y) to * allocation relative (x, y) of the returned widget. */ GtkWidget * _gtk_widget_find_at_coords (GdkWindow *window, gint window_x, gint window_y, gint *widget_x, gint *widget_y) { GtkWidget *event_widget; struct ChildLocation child_loc = { NULL, NULL, 0, 0 }; g_return_val_if_fail (GDK_IS_WINDOW (window), NULL); gdk_window_get_user_data (window, (void **)&event_widget); if (!event_widget) return NULL; #ifdef DEBUG_TOOLTIP g_print ("event window %p (belonging to %p (%s)) (%d, %d)\n", window, event_widget, gtk_widget_get_name (event_widget), window_x, window_y); #endif /* Coordinates are relative to event window */ child_loc.x = window_x; child_loc.y = window_y; /* We go down the window hierarchy to the widget->window, * coordinates stay relative to the current window. * We end up with window == widget->window, coordinates relative to that. */ while (window && window != event_widget->window) { gdouble px, py; gdk_window_coords_to_parent (window, child_loc.x, child_loc.y, &px, &py); child_loc.x = px; child_loc.y = py; window = gdk_window_get_effective_parent (window); } /* Failing to find widget->window can happen for e.g. a detached handle box; * chaining ::query-tooltip up to its parent probably makes little sense, * and users better implement tooltips on handle_box->child. * so we simply ignore the event for tooltips here. */ if (!window) return NULL; /* Convert the window relative coordinates to allocation * relative coordinates. */ window_to_alloc (event_widget, child_loc.x, child_loc.y, &child_loc.x, &child_loc.y); if (GTK_IS_CONTAINER (event_widget)) { GtkWidget *container = event_widget; child_loc.container = event_widget; child_loc.child = NULL; gtk_container_forall (GTK_CONTAINER (event_widget), child_location_foreach, &child_loc); /* Here we have a widget, with coordinates relative to * child_loc.container's allocation. */ if (child_loc.child) event_widget = child_loc.child; else if (child_loc.container) event_widget = child_loc.container; /* Translate to event_widget's allocation */ gtk_widget_translate_coordinates (container, event_widget, child_loc.x, child_loc.y, &child_loc.x, &child_loc.y); } /* We return (x, y) relative to the allocation of event_widget. */ if (widget_x) *widget_x = child_loc.x; if (widget_y) *widget_y = child_loc.y; return event_widget; } /* Ignores (x, y) on input, translates event coordinates to * allocation relative (x, y) of the returned widget. */ static GtkWidget * find_topmost_widget_coords_from_event (GdkEvent *event, gint *x, gint *y) { gint tx, ty; gdouble dx, dy; GtkWidget *tmp; gdk_event_get_coords (event, &dx, &dy); /* Returns coordinates relative to tmp's allocation. */ tmp = _gtk_widget_find_at_coords (event->any.window, dx, dy, &tx, &ty); if (!tmp) return NULL; /* Make sure the pointer can actually be on the widget returned. */ if (tx < 0 || tx >= tmp->allocation.width || ty < 0 || ty >= tmp->allocation.height) return NULL; if (x) *x = tx; if (y) *y = ty; return tmp; } static gint tooltip_browse_mode_expired (gpointer data) { GtkTooltip *tooltip; tooltip = GTK_TOOLTIP (data); tooltip->browse_mode_enabled = FALSE; tooltip->browse_mode_timeout_id = 0; /* destroy tooltip */ g_object_set_data (G_OBJECT (gtk_widget_get_display (tooltip->window)), "gdk-display-current-tooltip", NULL); return FALSE; } static void gtk_tooltip_display_closed (GdkDisplay *display, gboolean was_error, GtkTooltip *tooltip) { g_object_set_data (G_OBJECT (display), "gdk-display-current-tooltip", NULL); } static void gtk_tooltip_set_last_window (GtkTooltip *tooltip, GdkWindow *window) { if (tooltip->last_window == window) return; if (tooltip->last_window) g_object_remove_weak_pointer (G_OBJECT (tooltip->last_window), (gpointer *) &tooltip->last_window); tooltip->last_window = window; if (window) g_object_add_weak_pointer (G_OBJECT (tooltip->last_window), (gpointer *) &tooltip->last_window); } static gboolean gtk_tooltip_run_requery (GtkWidget **widget, GtkTooltip *tooltip, gint *x, gint *y) { gboolean has_tooltip = FALSE; gboolean return_value = FALSE; gtk_tooltip_reset (tooltip); do { g_object_get (*widget, "has-tooltip", &has_tooltip, NULL); if (has_tooltip) g_signal_emit_by_name (*widget, "query-tooltip", *x, *y, tooltip->keyboard_mode_enabled, tooltip, &return_value); if (!return_value) { GtkWidget *parent = (*widget)->parent; if (parent) gtk_widget_translate_coordinates (*widget, parent, *x, *y, x, y); *widget = parent; } else break; } while (*widget); /* If the custom widget was not reset in the query-tooltip * callback, we clear it here. */ if (!tooltip->custom_was_reset) gtk_tooltip_set_custom (tooltip, NULL); return return_value; } static void get_bounding_box (GtkWidget *widget, GdkRectangle *bounds) { GdkWindow *window; gint x, y; gint w, h; gint x1, y1; gint x2, y2; gint x3, y3; gint x4, y4; window = gtk_widget_get_parent_window (widget); x = widget->allocation.x; y = widget->allocation.y; w = widget->allocation.width; h = widget->allocation.height; gdk_window_get_root_coords (window, x, y, &x1, &y1); gdk_window_get_root_coords (window, x + w, y, &x2, &y2); gdk_window_get_root_coords (window, x, y + h, &x3, &y3); gdk_window_get_root_coords (window, x + w, y + h, &x4, &y4); #define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d)) #define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d)) bounds->x = floor (MIN4 (x1, x2, x3, x4)); bounds->y = floor (MIN4 (y1, y2, y3, y4)); bounds->width = ceil (MAX4 (x1, x2, x3, x4)) - bounds->x; bounds->height = ceil (MAX4 (y1, y2, y3, y4)) - bounds->y; } static void gtk_tooltip_position (GtkTooltip *tooltip, GdkDisplay *display, GtkWidget *new_tooltip_widget) { gint x, y; GdkScreen *screen; tooltip->tooltip_widget = new_tooltip_widget; /* Position the tooltip */ /* FIXME: should we swap this when RTL is enabled? */ if (tooltip->keyboard_mode_enabled) { GdkRectangle bounds; get_bounding_box (new_tooltip_widget, &bounds); /* For keyboard mode we position the tooltip below the widget, * right of the center of the widget. */ x = bounds.x + bounds.width / 2; y = bounds.y + bounds.height + 4; } else { guint cursor_size; x = tooltip->last_x; y = tooltip->last_y; /* For mouse mode, we position the tooltip right of the cursor, * a little below the cursor's center. */ cursor_size = gdk_display_get_default_cursor_size (display); x += cursor_size / 2; y += cursor_size / 2; } screen = gtk_widget_get_screen (new_tooltip_widget); /* Show it */ if (tooltip->current_window) { gint monitor_num; GdkRectangle monitor; GtkRequisition requisition; gtk_widget_size_request (GTK_WIDGET (tooltip->current_window), &requisition); monitor_num = gdk_screen_get_monitor_at_point (screen, x, y); gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); if (x + requisition.width > monitor.x + monitor.width) x -= x - (monitor.x + monitor.width) + requisition.width; else if (x < monitor.x) x = monitor.x; if (y + requisition.height > monitor.y + monitor.height) y -= y - (monitor.y + monitor.height) + requisition.height; if (!tooltip->keyboard_mode_enabled) { /* don't pop up under the pointer */ if (x <= tooltip->last_x && tooltip->last_x < x + requisition.width && y <= tooltip->last_y && tooltip->last_y < y + requisition.height) y = tooltip->last_y - requisition.height - 2; } gtk_window_move (GTK_WINDOW (tooltip->current_window), x, y); gtk_widget_show (GTK_WIDGET (tooltip->current_window)); } } static void gtk_tooltip_show_tooltip (GdkDisplay *display) { gint x, y; GdkScreen *screen; GdkWindow *window; GtkWidget *tooltip_widget; GtkWidget *pointer_widget; GtkTooltip *tooltip; gboolean has_tooltip; gboolean return_value = FALSE; tooltip = g_object_get_data (G_OBJECT (display), "gdk-display-current-tooltip"); if (tooltip->keyboard_mode_enabled) { x = y = -1; pointer_widget = tooltip_widget = tooltip->keyboard_widget; } else { gint tx, ty; window = tooltip->last_window; if (!GDK_IS_WINDOW (window)) return; gdk_window_get_pointer (window, &x, &y, NULL); gdk_window_get_root_coords (window, x, y, &tx, &ty); tooltip->last_x = tx; tooltip->last_y = ty; pointer_widget = tooltip_widget = _gtk_widget_find_at_coords (window, x, y, &x, &y); } if (!tooltip_widget) return; g_object_get (tooltip_widget, "has-tooltip", &has_tooltip, NULL); return_value = gtk_tooltip_run_requery (&tooltip_widget, tooltip, &x, &y); if (!return_value) return; if (!tooltip->current_window) { if (gtk_widget_get_tooltip_window (tooltip_widget)) tooltip->current_window = gtk_widget_get_tooltip_window (tooltip_widget); else tooltip->current_window = GTK_WINDOW (GTK_TOOLTIP (tooltip)->window); } screen = gtk_widget_get_screen (tooltip_widget); /* FIXME: should use tooltip->current_window iso tooltip->window */ if (screen != gtk_widget_get_screen (tooltip->window)) { g_signal_handlers_disconnect_by_func (display, gtk_tooltip_display_closed, tooltip); gtk_window_set_screen (GTK_WINDOW (tooltip->window), screen); g_signal_connect (display, "closed", G_CALLBACK (gtk_tooltip_display_closed), tooltip); } gtk_tooltip_position (tooltip, display, tooltip_widget); /* Now a tooltip is visible again on the display, make sure browse * mode is enabled. */ tooltip->browse_mode_enabled = TRUE; if (tooltip->browse_mode_timeout_id) { g_source_remove (tooltip->browse_mode_timeout_id); tooltip->browse_mode_timeout_id = 0; } } static void gtk_tooltip_hide_tooltip (GtkTooltip *tooltip) { if (!tooltip) return; if (tooltip->timeout_id) { g_source_remove (tooltip->timeout_id); tooltip->timeout_id = 0; } if (!GTK_TOOLTIP_VISIBLE (tooltip)) return; tooltip->tooltip_widget = NULL; if (!tooltip->keyboard_mode_enabled) { guint timeout; GtkSettings *settings; settings = gtk_widget_get_settings (GTK_WIDGET (tooltip->window)); g_object_get (settings, "gtk-tooltip-browse-mode-timeout", &timeout, NULL); /* The tooltip is gone, after (by default, should be configurable) 500ms * we want to turn off browse mode */ if (!tooltip->browse_mode_timeout_id) tooltip->browse_mode_timeout_id = gdk_threads_add_timeout_full (0, timeout, tooltip_browse_mode_expired, g_object_ref (tooltip), g_object_unref); } else { if (tooltip->browse_mode_timeout_id) { g_source_remove (tooltip->browse_mode_timeout_id); tooltip->browse_mode_timeout_id = 0; } } if (tooltip->current_window) { gtk_widget_hide (GTK_WIDGET (tooltip->current_window)); tooltip->current_window = NULL; } } static gint tooltip_popup_timeout (gpointer data) { GdkDisplay *display; GtkTooltip *tooltip; display = GDK_DISPLAY_OBJECT (data); tooltip = g_object_get_data (G_OBJECT (display), "gdk-display-current-tooltip"); /* This usually does not happen. However, it does occur in language * bindings were reference counting of objects behaves differently. */ if (!tooltip) return FALSE; gtk_tooltip_show_tooltip (display); tooltip->timeout_id = 0; return FALSE; } static void gtk_tooltip_start_delay (GdkDisplay *display) { guint timeout; GtkTooltip *tooltip; GtkSettings *settings; tooltip = g_object_get_data (G_OBJECT (display), "gdk-display-current-tooltip"); if (!tooltip || GTK_TOOLTIP_VISIBLE (tooltip)) return; if (tooltip->timeout_id) g_source_remove (tooltip->timeout_id); settings = gtk_widget_get_settings (GTK_WIDGET (tooltip->window)); if (tooltip->browse_mode_enabled) g_object_get (settings, "gtk-tooltip-browse-timeout", &timeout, NULL); else g_object_get (settings, "gtk-tooltip-timeout", &timeout, NULL); tooltip->timeout_id = gdk_threads_add_timeout_full (0, timeout, tooltip_popup_timeout, g_object_ref (display), g_object_unref); } void _gtk_tooltip_focus_in (GtkWidget *widget) { gint x, y; gboolean return_value = FALSE; GdkDisplay *display; GtkTooltip *tooltip; /* Get current tooltip for this display */ display = gtk_widget_get_display (widget); tooltip = g_object_get_data (G_OBJECT (display), "gdk-display-current-tooltip"); /* Check if keyboard mode is enabled at this moment */ if (!tooltip || !tooltip->keyboard_mode_enabled) return; if (tooltip->keyboard_widget) g_object_unref (tooltip->keyboard_widget); tooltip->keyboard_widget = g_object_ref (widget); gdk_window_get_pointer (widget->window, &x, &y, NULL); return_value = gtk_tooltip_run_requery (&widget, tooltip, &x, &y); if (!return_value) { gtk_tooltip_hide_tooltip (tooltip); return; } if (!tooltip->current_window) { if (gtk_widget_get_tooltip_window (widget)) tooltip->current_window = gtk_widget_get_tooltip_window (widget); else tooltip->current_window = GTK_WINDOW (GTK_TOOLTIP (tooltip)->window); } gtk_tooltip_show_tooltip (display); } void _gtk_tooltip_focus_out (GtkWidget *widget) { GdkDisplay *display; GtkTooltip *tooltip; /* Get current tooltip for this display */ display = gtk_widget_get_display (widget); tooltip = g_object_get_data (G_OBJECT (display), "gdk-display-current-tooltip"); if (!tooltip || !tooltip->keyboard_mode_enabled) return; if (tooltip->keyboard_widget) { g_object_unref (tooltip->keyboard_widget); tooltip->keyboard_widget = NULL; } gtk_tooltip_hide_tooltip (tooltip); } void _gtk_tooltip_toggle_keyboard_mode (GtkWidget *widget) { GdkDisplay *display; GtkTooltip *tooltip; display = gtk_widget_get_display (widget); tooltip = g_object_get_data (G_OBJECT (display), "gdk-display-current-tooltip"); if (!tooltip) { tooltip = g_object_new (GTK_TYPE_TOOLTIP, NULL); g_object_set_data_full (G_OBJECT (display), "gdk-display-current-tooltip", tooltip, g_object_unref); g_signal_connect (display, "closed", G_CALLBACK (gtk_tooltip_display_closed), tooltip); } tooltip->keyboard_mode_enabled ^= 1; if (tooltip->keyboard_mode_enabled) { tooltip->keyboard_widget = g_object_ref (widget); _gtk_tooltip_focus_in (widget); } else { if (tooltip->keyboard_widget) { g_object_unref (tooltip->keyboard_widget); tooltip->keyboard_widget = NULL; } gtk_tooltip_hide_tooltip (tooltip); } } void _gtk_tooltip_hide (GtkWidget *widget) { GtkWidget *toplevel; GdkDisplay *display; GtkTooltip *tooltip; display = gtk_widget_get_display (widget); tooltip = g_object_get_data (G_OBJECT (display), "gdk-display-current-tooltip"); if (!tooltip || !GTK_TOOLTIP_VISIBLE (tooltip) || !tooltip->tooltip_widget) return; toplevel = gtk_widget_get_toplevel (widget); if (widget == tooltip->tooltip_widget || toplevel->window == tooltip->toplevel_window) gtk_tooltip_hide_tooltip (tooltip); } static gboolean tooltips_enabled (GdkWindow *window) { gboolean enabled; gboolean touchscreen; GdkScreen *screen; GtkSettings *settings; screen = gdk_drawable_get_screen (window); settings = gtk_settings_get_for_screen (screen); g_object_get (settings, "gtk-touchscreen-mode", &touchscreen, "gtk-enable-tooltips", &enabled, NULL); return (!touchscreen && enabled); } void _gtk_tooltip_handle_event (GdkEvent *event) { gint x, y; gboolean return_value = FALSE; GtkWidget *has_tooltip_widget = NULL; GdkDisplay *display; GtkTooltip *current_tooltip; if (!tooltips_enabled (event->any.window)) return; /* Returns coordinates relative to has_tooltip_widget's allocation. */ has_tooltip_widget = find_topmost_widget_coords_from_event (event, &x, &y); display = gdk_drawable_get_display (event->any.window); current_tooltip = g_object_get_data (G_OBJECT (display), "gdk-display-current-tooltip"); if (current_tooltip) { gtk_tooltip_set_last_window (current_tooltip, event->any.window); } if (current_tooltip && current_tooltip->keyboard_mode_enabled) { has_tooltip_widget = current_tooltip->keyboard_widget; if (!has_tooltip_widget) return; return_value = gtk_tooltip_run_requery (&has_tooltip_widget, current_tooltip, &x, &y); if (!return_value) gtk_tooltip_hide_tooltip (current_tooltip); else gtk_tooltip_start_delay (display); return; } #ifdef DEBUG_TOOLTIP if (has_tooltip_widget) g_print ("%p (%s) at (%d, %d) %dx%d pointer: (%d, %d)\n", has_tooltip_widget, gtk_widget_get_name (has_tooltip_widget), has_tooltip_widget->allocation.x, has_tooltip_widget->allocation.y, has_tooltip_widget->allocation.width, has_tooltip_widget->allocation.height, x, y); #endif /* DEBUG_TOOLTIP */ /* Always poll for a next motion event */ gdk_event_request_motions (&event->motion); /* Hide the tooltip when there's no new tooltip widget */ if (!has_tooltip_widget) { if (current_tooltip) gtk_tooltip_hide_tooltip (current_tooltip); return; } switch (event->type) { case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: case GDK_3BUTTON_PRESS: case GDK_KEY_PRESS: case GDK_DRAG_ENTER: case GDK_GRAB_BROKEN: gtk_tooltip_hide_tooltip (current_tooltip); break; case GDK_MOTION_NOTIFY: case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: case GDK_SCROLL: if (current_tooltip) { gboolean tip_area_set; GdkRectangle tip_area; gboolean hide_tooltip; tip_area_set = current_tooltip->tip_area_set; tip_area = current_tooltip->tip_area; return_value = gtk_tooltip_run_requery (&has_tooltip_widget, current_tooltip, &x, &y); /* Requested to be hidden? */ hide_tooltip = !return_value; /* Leave notify should override the query function */ hide_tooltip = (event->type == GDK_LEAVE_NOTIFY); /* Is the pointer above another widget now? */ if (GTK_TOOLTIP_VISIBLE (current_tooltip)) hide_tooltip |= has_tooltip_widget != current_tooltip->tooltip_widget; /* Did the pointer move out of the previous "context area"? */ if (tip_area_set) hide_tooltip |= (x <= tip_area.x || x >= tip_area.x + tip_area.width || y <= tip_area.y || y >= tip_area.y + tip_area.height); if (hide_tooltip) gtk_tooltip_hide_tooltip (current_tooltip); else gtk_tooltip_start_delay (display); } else { /* Need a new tooltip for this display */ current_tooltip = g_object_new (GTK_TYPE_TOOLTIP, NULL); g_object_set_data_full (G_OBJECT (display), "gdk-display-current-tooltip", current_tooltip, g_object_unref); g_signal_connect (display, "closed", G_CALLBACK (gtk_tooltip_display_closed), current_tooltip); gtk_tooltip_set_last_window (current_tooltip, event->any.window); gtk_tooltip_start_delay (display); } break; default: break; } } #define __GTK_TOOLTIP_C__ #include "gtkaliasdef.c"
lgpl-2.1
agx/libvirt-debian
src/remote/remote_driver.c
304785
/* * remote_driver.c: driver to provide access to libvirtd running * on a remote machine * * Copyright (C) 2007-2015 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. */ #include <config.h> #include <unistd.h> #include "virnetclient.h" #include "virnetclientprogram.h" #include "virnetclientstream.h" #include "virerror.h" #include "virlog.h" #include "datatypes.h" #include "domain_event.h" #include "network_event.h" #include "storage_event.h" #include "node_device_event.h" #include "secret_event.h" #include "driver.h" #include "virbuffer.h" #include "remote_driver.h" #include "remote_protocol.h" #include "lxc_protocol.h" #include "qemu_protocol.h" #include "viralloc.h" #include "virfile.h" #include "vircommand.h" #include "intprops.h" #include "virtypedparam.h" #include "viruri.h" #include "virauth.h" #include "virauthconfig.h" #include "virstring.h" #define VIR_FROM_THIS VIR_FROM_REMOTE VIR_LOG_INIT("remote.remote_driver"); typedef enum { REMOTE_DRIVER_TRANSPORT_TLS, REMOTE_DRIVER_TRANSPORT_UNIX, REMOTE_DRIVER_TRANSPORT_SSH, REMOTE_DRIVER_TRANSPORT_LIBSSH2, REMOTE_DRIVER_TRANSPORT_EXT, REMOTE_DRIVER_TRANSPORT_TCP, REMOTE_DRIVER_TRANSPORT_LIBSSH, REMOTE_DRIVER_TRANSPORT_LAST, } remoteDriverTransport; VIR_ENUM_DECL(remoteDriverTransport); VIR_ENUM_IMPL(remoteDriverTransport, REMOTE_DRIVER_TRANSPORT_LAST, "tls", "unix", "ssh", "libssh2", "ext", "tcp", "libssh"); typedef enum { /* Try to figure out the "best" choice magically */ REMOTE_DRIVER_MODE_AUTO, /* Always use the legacy libvirtd */ REMOTE_DRIVER_MODE_LEGACY, /* Always use the per-driver virt*d daemons */ REMOTE_DRIVER_MODE_DIRECT, REMOTE_DRIVER_MODE_LAST } remoteDriverMode; VIR_ENUM_DECL(remoteDriverMode); VIR_ENUM_IMPL(remoteDriverMode, REMOTE_DRIVER_MODE_LAST, "auto", "legacy", "direct"); #if SIZEOF_LONG < 8 # define HYPER_TO_TYPE(_type, _to, _from) \ do { \ if ((_from) != (_type)(_from)) { \ virReportError(VIR_ERR_INTERNAL_ERROR, \ _("conversion from hyper to %s overflowed"), #_type); \ goto done; \ } \ (_to) = (_from); \ } while (0) # define HYPER_TO_LONG(_to, _from) HYPER_TO_TYPE(long, _to, _from) # define HYPER_TO_ULONG(_to, _from) HYPER_TO_TYPE(unsigned long, _to, _from) #else # define HYPER_TO_LONG(_to, _from) (_to) = (_from) # define HYPER_TO_ULONG(_to, _from) (_to) = (_from) #endif static bool inside_daemon; struct private_data { virMutex lock; virNetClientPtr client; virNetClientProgramPtr remoteProgram; virNetClientProgramPtr qemuProgram; virNetClientProgramPtr lxcProgram; int counter; /* Serial number for RPC */ #ifdef WITH_GNUTLS virNetTLSContextPtr tls; #endif int is_secure; /* Secure if TLS or SASL or UNIX sockets */ char *type; /* Cached return from remoteType. */ int localUses; /* Ref count for private data */ char *hostname; /* Original hostname */ bool serverKeepAlive; /* Does server support keepalive protocol? */ bool serverEventFilter; /* Does server support modern event filtering */ bool serverCloseCallback; /* Does server support driver close callback */ virObjectEventStatePtr eventState; virConnectCloseCallbackDataPtr closeCallback; }; enum { REMOTE_CALL_QEMU = (1 << 0), REMOTE_CALL_LXC = (1 << 1), }; static void remoteDriverLock(struct private_data *driver) { virMutexLock(&driver->lock); } static void remoteDriverUnlock(struct private_data *driver) { virMutexUnlock(&driver->lock); } static int call(virConnectPtr conn, struct private_data *priv, unsigned int flags, int proc_nr, xdrproc_t args_filter, char *args, xdrproc_t ret_filter, char *ret); static int callFull(virConnectPtr conn, struct private_data *priv, unsigned int flags, int *fdin, size_t fdinlen, int **fdout, size_t *fdoutlen, int proc_nr, xdrproc_t args_filter, char *args, xdrproc_t ret_filter, char *ret); static int remoteAuthenticate(virConnectPtr conn, struct private_data *priv, virConnectAuthPtr auth, const char *authtype); #if WITH_SASL static int remoteAuthSASL(virConnectPtr conn, struct private_data *priv, virConnectAuthPtr auth, const char *mech); #endif /* WITH_SASL */ static int remoteAuthPolkit(virConnectPtr conn, struct private_data *priv, virConnectAuthPtr auth); static virDomainPtr get_nonnull_domain(virConnectPtr conn, remote_nonnull_domain domain); static virNetworkPtr get_nonnull_network(virConnectPtr conn, remote_nonnull_network network); static virNetworkPortPtr get_nonnull_network_port(virConnectPtr conn, remote_nonnull_network_port port); static virNWFilterPtr get_nonnull_nwfilter(virConnectPtr conn, remote_nonnull_nwfilter nwfilter); static virNWFilterBindingPtr get_nonnull_nwfilter_binding(virConnectPtr conn, remote_nonnull_nwfilter_binding binding); static virInterfacePtr get_nonnull_interface(virConnectPtr conn, remote_nonnull_interface iface); static virStoragePoolPtr get_nonnull_storage_pool(virConnectPtr conn, remote_nonnull_storage_pool pool); static virStorageVolPtr get_nonnull_storage_vol(virConnectPtr conn, remote_nonnull_storage_vol vol); static virNodeDevicePtr get_nonnull_node_device(virConnectPtr conn, remote_nonnull_node_device dev); static virSecretPtr get_nonnull_secret(virConnectPtr conn, remote_nonnull_secret secret); static virDomainCheckpointPtr get_nonnull_domain_checkpoint(virDomainPtr domain, remote_nonnull_domain_checkpoint checkpoint); static virDomainSnapshotPtr get_nonnull_domain_snapshot(virDomainPtr domain, remote_nonnull_domain_snapshot snapshot); static void make_nonnull_domain(remote_nonnull_domain *dom_dst, virDomainPtr dom_src); static void make_nonnull_network(remote_nonnull_network *net_dst, virNetworkPtr net_src); static void make_nonnull_network_port(remote_nonnull_network_port *port_dst, virNetworkPortPtr port_src); static void make_nonnull_interface(remote_nonnull_interface *interface_dst, virInterfacePtr interface_src); static void make_nonnull_storage_pool(remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr vol_src); static void make_nonnull_storage_vol(remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src); static void make_nonnull_node_device(remote_nonnull_node_device *dev_dst, virNodeDevicePtr dev_src); static void make_nonnull_secret(remote_nonnull_secret *secret_dst, virSecretPtr secret_src); static void make_nonnull_nwfilter(remote_nonnull_nwfilter *nwfilter_dst, virNWFilterPtr nwfilter_src); static void make_nonnull_nwfilter_binding(remote_nonnull_nwfilter_binding *binding_dst, virNWFilterBindingPtr binding_src); static void make_nonnull_domain_checkpoint(remote_nonnull_domain_checkpoint *checkpoint_dst, virDomainCheckpointPtr checkpoint_src); static void make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapshot_dst, virDomainSnapshotPtr snapshot_src); /*----------------------------------------------------------------------*/ /* Helper functions for remoteOpen. */ static int remoteSplitURIScheme(virURIPtr uri, char **driver, char **transport) { char *p = strchr(uri->scheme, '+'); *driver = *transport = NULL; if (p) *driver = g_strndup(uri->scheme, p - uri->scheme); else *driver = g_strdup(uri->scheme); if (p) { *transport = g_strdup(p + 1); p = *transport; while (*p) { *p = g_ascii_tolower(*p); p++; } } return 0; } static int remoteStateInitialize(bool privileged G_GNUC_UNUSED, virStateInhibitCallback callback G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED) { /* Mark that we're inside the daemon so we can avoid * re-entering ourselves */ inside_daemon = true; return VIR_DRV_STATE_INIT_COMPLETE; } static void remoteDomainBuildEventLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static void remoteDomainBuildEventReboot(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackReboot(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static void remoteDomainBuildEventRTCChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackRTCChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventWatchdog(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackWatchdog(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventIOError(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackIOError(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventIOErrorReason(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackIOErrorReason(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventGraphics(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackGraphics(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventControlError(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackControlError(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventBlockJob(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackBlockJob(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventDiskChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackDiskChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventTrayChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackTrayChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventPMWakeup(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackPMWakeup(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventPMSuspend(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackPMSuspend(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventBalloonChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackBalloonChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventPMSuspendDisk(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackPMSuspendDisk(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventDeviceRemoved(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackDeviceRemoved(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackDeviceAdded(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackDeviceRemovalFailed(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventBlockJob2(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackTunable(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackAgentLifecycle(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackMigrationIteration(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackJobCompleted(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteDomainBuildEventCallbackMetadataChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteNetworkBuildEventLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static void remoteStoragePoolBuildEventLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static void remoteStoragePoolBuildEventRefresh(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static void remoteNodeDeviceBuildEventLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static void remoteNodeDeviceBuildEventUpdate(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static void remoteSecretBuildEventLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static void remoteSecretBuildEventValueChanged(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static void remoteDomainBuildEventBlockThreshold(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void remoteConnectNotifyEventConnectionClosed(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static virNetClientProgramEvent remoteEvents[] = { { REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE, remoteDomainBuildEventLifecycle, sizeof(remote_domain_event_lifecycle_msg), (xdrproc_t)xdr_remote_domain_event_lifecycle_msg }, { REMOTE_PROC_DOMAIN_EVENT_REBOOT, remoteDomainBuildEventReboot, sizeof(remote_domain_event_reboot_msg), (xdrproc_t)xdr_remote_domain_event_reboot_msg }, { REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE, remoteDomainBuildEventRTCChange, sizeof(remote_domain_event_rtc_change_msg), (xdrproc_t)xdr_remote_domain_event_rtc_change_msg }, { REMOTE_PROC_DOMAIN_EVENT_WATCHDOG, remoteDomainBuildEventWatchdog, sizeof(remote_domain_event_watchdog_msg), (xdrproc_t)xdr_remote_domain_event_watchdog_msg}, { REMOTE_PROC_DOMAIN_EVENT_IO_ERROR, remoteDomainBuildEventIOError, sizeof(remote_domain_event_io_error_msg), (xdrproc_t)xdr_remote_domain_event_io_error_msg }, { REMOTE_PROC_DOMAIN_EVENT_GRAPHICS, remoteDomainBuildEventGraphics, sizeof(remote_domain_event_graphics_msg), (xdrproc_t)xdr_remote_domain_event_graphics_msg }, { REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON, remoteDomainBuildEventIOErrorReason, sizeof(remote_domain_event_io_error_reason_msg), (xdrproc_t)xdr_remote_domain_event_io_error_reason_msg }, { REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR, remoteDomainBuildEventControlError, sizeof(remote_domain_event_control_error_msg), (xdrproc_t)xdr_remote_domain_event_control_error_msg }, { REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB, remoteDomainBuildEventBlockJob, sizeof(remote_domain_event_block_job_msg), (xdrproc_t)xdr_remote_domain_event_block_job_msg }, { REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE, remoteDomainBuildEventDiskChange, sizeof(remote_domain_event_disk_change_msg), (xdrproc_t)xdr_remote_domain_event_disk_change_msg }, { REMOTE_PROC_DOMAIN_EVENT_TRAY_CHANGE, remoteDomainBuildEventTrayChange, sizeof(remote_domain_event_tray_change_msg), (xdrproc_t)xdr_remote_domain_event_tray_change_msg }, { REMOTE_PROC_DOMAIN_EVENT_PMWAKEUP, remoteDomainBuildEventPMWakeup, sizeof(remote_domain_event_pmwakeup_msg), (xdrproc_t)xdr_remote_domain_event_pmwakeup_msg }, { REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND, remoteDomainBuildEventPMSuspend, sizeof(remote_domain_event_pmsuspend_msg), (xdrproc_t)xdr_remote_domain_event_pmsuspend_msg }, { REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHANGE, remoteDomainBuildEventBalloonChange, sizeof(remote_domain_event_balloon_change_msg), (xdrproc_t)xdr_remote_domain_event_balloon_change_msg }, { REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND_DISK, remoteDomainBuildEventPMSuspendDisk, sizeof(remote_domain_event_pmsuspend_disk_msg), (xdrproc_t)xdr_remote_domain_event_pmsuspend_disk_msg }, { REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMOVED, remoteDomainBuildEventDeviceRemoved, sizeof(remote_domain_event_device_removed_msg), (xdrproc_t)xdr_remote_domain_event_device_removed_msg }, /* All events above here are legacy events, missing the callback * ID, which means the server has a single global registration and * we do full filtering in the client. If the server lacks * VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK, those are the only * events we should ever receive. Conversely, all events below * here should only be triggered by modern servers, and all * contain a callbackID. Although we have to duplicate the first * 16 domain events in both styles for back-compat, any future * domain event additions should only use the modern style. */ { REMOTE_PROC_NETWORK_EVENT_LIFECYCLE, remoteNetworkBuildEventLifecycle, sizeof(remote_network_event_lifecycle_msg), (xdrproc_t)xdr_remote_network_event_lifecycle_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE, remoteDomainBuildEventCallbackLifecycle, sizeof(remote_domain_event_callback_lifecycle_msg), (xdrproc_t)xdr_remote_domain_event_callback_lifecycle_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_REBOOT, remoteDomainBuildEventCallbackReboot, sizeof(remote_domain_event_callback_reboot_msg), (xdrproc_t)xdr_remote_domain_event_callback_reboot_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RTC_CHANGE, remoteDomainBuildEventCallbackRTCChange, sizeof(remote_domain_event_callback_rtc_change_msg), (xdrproc_t)xdr_remote_domain_event_callback_rtc_change_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WATCHDOG, remoteDomainBuildEventCallbackWatchdog, sizeof(remote_domain_event_callback_watchdog_msg), (xdrproc_t)xdr_remote_domain_event_callback_watchdog_msg}, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR, remoteDomainBuildEventCallbackIOError, sizeof(remote_domain_event_callback_io_error_msg), (xdrproc_t)xdr_remote_domain_event_callback_io_error_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_GRAPHICS, remoteDomainBuildEventCallbackGraphics, sizeof(remote_domain_event_callback_graphics_msg), (xdrproc_t)xdr_remote_domain_event_callback_graphics_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR_REASON, remoteDomainBuildEventCallbackIOErrorReason, sizeof(remote_domain_event_callback_io_error_reason_msg), (xdrproc_t)xdr_remote_domain_event_callback_io_error_reason_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CONTROL_ERROR, remoteDomainBuildEventCallbackControlError, sizeof(remote_domain_event_callback_control_error_msg), (xdrproc_t)xdr_remote_domain_event_callback_control_error_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BLOCK_JOB, remoteDomainBuildEventCallbackBlockJob, sizeof(remote_domain_event_callback_block_job_msg), (xdrproc_t)xdr_remote_domain_event_callback_block_job_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DISK_CHANGE, remoteDomainBuildEventCallbackDiskChange, sizeof(remote_domain_event_callback_disk_change_msg), (xdrproc_t)xdr_remote_domain_event_callback_disk_change_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TRAY_CHANGE, remoteDomainBuildEventCallbackTrayChange, sizeof(remote_domain_event_callback_tray_change_msg), (xdrproc_t)xdr_remote_domain_event_callback_tray_change_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMWAKEUP, remoteDomainBuildEventCallbackPMWakeup, sizeof(remote_domain_event_callback_pmwakeup_msg), (xdrproc_t)xdr_remote_domain_event_callback_pmwakeup_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND, remoteDomainBuildEventCallbackPMSuspend, sizeof(remote_domain_event_callback_pmsuspend_msg), (xdrproc_t)xdr_remote_domain_event_callback_pmsuspend_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BALLOON_CHANGE, remoteDomainBuildEventCallbackBalloonChange, sizeof(remote_domain_event_callback_balloon_change_msg), (xdrproc_t)xdr_remote_domain_event_callback_balloon_change_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK, remoteDomainBuildEventCallbackPMSuspendDisk, sizeof(remote_domain_event_callback_pmsuspend_disk_msg), (xdrproc_t)xdr_remote_domain_event_callback_pmsuspend_disk_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED, remoteDomainBuildEventCallbackDeviceRemoved, sizeof(remote_domain_event_callback_device_removed_msg), (xdrproc_t)xdr_remote_domain_event_callback_device_removed_msg }, { REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2, remoteDomainBuildEventBlockJob2, sizeof(remote_domain_event_block_job_2_msg), (xdrproc_t)xdr_remote_domain_event_block_job_2_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TUNABLE, remoteDomainBuildEventCallbackTunable, sizeof(remote_domain_event_callback_tunable_msg), (xdrproc_t)xdr_remote_domain_event_callback_tunable_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_AGENT_LIFECYCLE, remoteDomainBuildEventCallbackAgentLifecycle, sizeof(remote_domain_event_callback_agent_lifecycle_msg), (xdrproc_t)xdr_remote_domain_event_callback_agent_lifecycle_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_ADDED, remoteDomainBuildEventCallbackDeviceAdded, sizeof(remote_domain_event_callback_device_added_msg), (xdrproc_t)xdr_remote_domain_event_callback_device_added_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_MIGRATION_ITERATION, remoteDomainBuildEventCallbackMigrationIteration, sizeof(remote_domain_event_callback_migration_iteration_msg), (xdrproc_t)xdr_remote_domain_event_callback_migration_iteration_msg }, { REMOTE_PROC_CONNECT_EVENT_CONNECTION_CLOSED, remoteConnectNotifyEventConnectionClosed, sizeof(remote_connect_event_connection_closed_msg), (xdrproc_t)xdr_remote_connect_event_connection_closed_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_JOB_COMPLETED, remoteDomainBuildEventCallbackJobCompleted, sizeof(remote_domain_event_callback_job_completed_msg), (xdrproc_t)xdr_remote_domain_event_callback_job_completed_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVAL_FAILED, remoteDomainBuildEventCallbackDeviceRemovalFailed, sizeof(remote_domain_event_callback_device_removal_failed_msg), (xdrproc_t)xdr_remote_domain_event_callback_device_removal_failed_msg }, { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_METADATA_CHANGE, remoteDomainBuildEventCallbackMetadataChange, sizeof(remote_domain_event_callback_metadata_change_msg), (xdrproc_t)xdr_remote_domain_event_callback_metadata_change_msg }, { REMOTE_PROC_STORAGE_POOL_EVENT_LIFECYCLE, remoteStoragePoolBuildEventLifecycle, sizeof(remote_storage_pool_event_lifecycle_msg), (xdrproc_t)xdr_remote_storage_pool_event_lifecycle_msg }, { REMOTE_PROC_STORAGE_POOL_EVENT_REFRESH, remoteStoragePoolBuildEventRefresh, sizeof(remote_storage_pool_event_refresh_msg), (xdrproc_t)xdr_remote_storage_pool_event_refresh_msg }, { REMOTE_PROC_NODE_DEVICE_EVENT_LIFECYCLE, remoteNodeDeviceBuildEventLifecycle, sizeof(remote_node_device_event_lifecycle_msg), (xdrproc_t)xdr_remote_node_device_event_lifecycle_msg }, { REMOTE_PROC_NODE_DEVICE_EVENT_UPDATE, remoteNodeDeviceBuildEventUpdate, sizeof(remote_node_device_event_update_msg), (xdrproc_t)xdr_remote_node_device_event_update_msg }, { REMOTE_PROC_SECRET_EVENT_LIFECYCLE, remoteSecretBuildEventLifecycle, sizeof(remote_secret_event_lifecycle_msg), (xdrproc_t)xdr_remote_secret_event_lifecycle_msg }, { REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED, remoteSecretBuildEventValueChanged, sizeof(remote_secret_event_value_changed_msg), (xdrproc_t)xdr_remote_secret_event_value_changed_msg }, { REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD, remoteDomainBuildEventBlockThreshold, sizeof(remote_domain_event_block_threshold_msg), (xdrproc_t)xdr_remote_domain_event_block_threshold_msg }, }; static void remoteConnectNotifyEventConnectionClosed(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; struct private_data *priv = conn->privateData; remote_connect_event_connection_closed_msg *msg = evdata; virConnectCloseCallbackDataCall(priv->closeCallback, msg->reason); } static void remoteDomainBuildQemuMonitorEvent(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque); static virNetClientProgramEvent qemuEvents[] = { { QEMU_PROC_DOMAIN_MONITOR_EVENT, remoteDomainBuildQemuMonitorEvent, sizeof(qemu_domain_monitor_event_msg), (xdrproc_t)xdr_qemu_domain_monitor_event_msg }, }; enum virDrvOpenRemoteFlags { VIR_DRV_OPEN_REMOTE_RO = (1 << 0), VIR_DRV_OPEN_REMOTE_USER = (1 << 1), /* Use the per-user socket path */ VIR_DRV_OPEN_REMOTE_AUTOSTART = (1 << 2), /* Autostart a per-user daemon */ }; static void remoteClientCloseFunc(virNetClientPtr client G_GNUC_UNUSED, int reason, void *opaque) { virConnectCloseCallbackDataCall((virConnectCloseCallbackDataPtr)opaque, reason); } static bool remoteConnectSupportsFeatureUnlocked(virConnectPtr conn, struct private_data *priv, int feature) { remote_connect_supports_feature_args args = { feature }; remote_connect_supports_feature_ret ret = { 0 }; int rc; rc = call(conn, priv, 0, REMOTE_PROC_CONNECT_SUPPORTS_FEATURE, (xdrproc_t)xdr_remote_connect_supports_feature_args, (char *) &args, (xdrproc_t)xdr_remote_connect_supports_feature_ret, (char *) &ret); return rc != -1 && ret.supported; } /* helper macro to ease extraction of arguments from the URI */ #define EXTRACT_URI_ARG_STR(ARG_NAME, ARG_VAR) \ if (STRCASEEQ(var->name, ARG_NAME)) { \ VIR_FREE(ARG_VAR); \ ARG_VAR = g_strdup(var->value); \ var->ignore = 1; \ continue; \ } #define EXTRACT_URI_ARG_BOOL(ARG_NAME, ARG_VAR) \ if (STRCASEEQ(var->name, ARG_NAME)) { \ int tmp; \ if (virStrToLong_i(var->value, NULL, 10, &tmp) < 0) { \ virReportError(VIR_ERR_INVALID_ARG, \ _("Failed to parse value of URI component %s"), \ var->name); \ goto failed; \ } \ ARG_VAR = tmp == 0; \ var->ignore = 1; \ continue; \ } static char * remoteGetUNIXSocketHelper(remoteDriverTransport transport, const char *sock_prefix, unsigned int flags) { char *sockname = NULL; g_autofree char *userdir = NULL; if (flags & VIR_DRV_OPEN_REMOTE_USER) { if (transport != REMOTE_DRIVER_TRANSPORT_UNIX) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("Connecting to session instance without " "socket path is not supported by the %s " "transport"), remoteDriverTransportTypeToString(transport)); return NULL; } userdir = virGetUserRuntimeDirectory(); sockname = g_strdup_printf("%s/%s-sock", userdir, sock_prefix); } else { /* Intentionally do *NOT* use RUNSTATEDIR here. We might * be connecting to a remote machine, and cannot assume * the remote host has /run. The converse is ok though, * any machine with /run will have a /var/run symlink. * The portable option is to thus use $LOCALSTATEDIR/run */ sockname = g_strdup_printf("%s/run/libvirt/%s-%s", LOCALSTATEDIR, sock_prefix, flags & VIR_DRV_OPEN_REMOTE_RO ? "sock-ro" : "sock"); } VIR_DEBUG("Built UNIX sockname %s for transport %s prefix %s flags=0x%x", sockname, remoteDriverTransportTypeToString(transport), sock_prefix, flags); return sockname; } static char * remoteGetUNIXSocket(remoteDriverTransport transport, remoteDriverMode mode, const char *driver, char **daemon, unsigned int flags) { char *sock_name = NULL; g_autofree char *direct_daemon = NULL; g_autofree char *legacy_daemon = NULL; g_autofree char *direct_sock_name = NULL; g_autofree char *legacy_sock_name = NULL; if (driver) direct_daemon = g_strdup_printf("virt%sd", driver); legacy_daemon = g_strdup("libvirtd"); if (driver && !(direct_sock_name = remoteGetUNIXSocketHelper(transport, direct_daemon, flags))) return NULL; if (!(legacy_sock_name = remoteGetUNIXSocketHelper(transport, "libvirt", flags))) return NULL; if (mode == REMOTE_DRIVER_MODE_AUTO) { if (transport == REMOTE_DRIVER_TRANSPORT_UNIX) { if (direct_sock_name && virFileExists(direct_sock_name)) { mode = REMOTE_DRIVER_MODE_DIRECT; } else if (virFileExists(legacy_sock_name)) { mode = REMOTE_DRIVER_MODE_LEGACY; } else if (driver) { /* * This constant comes from the configure script and * maps to either the direct or legacy mode constant */ mode = REMOTE_DRIVER_MODE_DEFAULT; } else { mode = REMOTE_DRIVER_MODE_LEGACY; } } else { mode = REMOTE_DRIVER_MODE_LEGACY; } } switch ((remoteDriverMode)mode) { case REMOTE_DRIVER_MODE_LEGACY: sock_name = g_steal_pointer(&legacy_sock_name); *daemon = g_steal_pointer(&legacy_daemon); break; case REMOTE_DRIVER_MODE_DIRECT: if (transport != REMOTE_DRIVER_TRANSPORT_UNIX) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("Cannot use direct socket mode for %s transport"), remoteDriverTransportTypeToString(transport)); return NULL; } if (!direct_sock_name) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("Cannot use direct socket mode if no URI is set")); return NULL; } sock_name = g_steal_pointer(&direct_sock_name); *daemon = g_steal_pointer(&direct_daemon); break; case REMOTE_DRIVER_MODE_AUTO: case REMOTE_DRIVER_MODE_LAST: default: virReportEnumRangeError(remoteDriverMode, mode); return NULL; } VIR_DEBUG("Chosen UNIX sockname %s daemon %s " "for mode %s transport %s flags=0x%x", sock_name, NULLSTR(*daemon), remoteDriverModeTypeToString(mode), remoteDriverTransportTypeToString(transport), flags); return sock_name; } #ifndef WIN32 static const char * remoteGetDaemonPathEnv(void) { /* We prefer a VIRTD_PATH env var to use for all daemons, * but if it is not set we will fallback to LIBVIRTD_PATH * for previous behaviour */ if (getenv("VIRTD_PATH") != NULL) { return "VIRTD_PATH"; } else { return "LIBVIRTD_PATH"; } } #endif /* WIN32 */ /* * URIs that this driver needs to handle: * * The easy answer: * - Everything that no one else has yet claimed, but nothing if * we're inside the libvirtd daemon * * The hard answer: * - Plain paths (///var/lib/xen/xend-socket) -> UNIX domain socket * - xxx://servername/ -> TLS connection * - xxx+tls://servername/ -> TLS connection * - xxx+tls:/// -> TLS connection to localhost * - xxx+tcp://servername/ -> TCP connection * - xxx+tcp:/// -> TCP connection to localhost * - xxx+unix:/// -> UNIX domain socket * - xxx:/// -> UNIX domain socket * - xxx+ssh:/// -> SSH connection (legacy) * - xxx+libssh2:/// -> SSH connection (using libssh2) * - xxx+libssh:/// -> SSH connection (using libssh) */ static int doRemoteOpen(virConnectPtr conn, struct private_data *priv, const char *driver_str, const char *transport_str, virConnectAuthPtr auth G_GNUC_UNUSED, virConfPtr conf, unsigned int flags) { int transport; #ifndef WIN32 g_autofree char *daemonPath = NULL; #endif g_autofree char *tls_priority = NULL; g_autofree char *name = NULL; g_autofree char *command = NULL; g_autofree char *sockname = NULL; g_autofree char *netcat = NULL; g_autofree char *port = NULL; g_autofree char *authtype = NULL; g_autofree char *username = NULL; g_autofree char *pkipath = NULL; g_autofree char *keyfile = NULL; g_autofree char *sshauth = NULL; g_autofree char *knownHostsVerify = NULL; g_autofree char *knownHosts = NULL; g_autofree char *mode_str = NULL; g_autofree char *daemon_name = NULL; bool sanity = true; bool verify = true; #ifndef WIN32 bool tty = true; #endif int mode; if (inside_daemon && !conn->uri->server) { mode = REMOTE_DRIVER_MODE_DIRECT; } else { mode = REMOTE_DRIVER_MODE_AUTO; } /* We handle *ALL* URIs here. The caller has rejected any * URIs we don't care about */ if (conn->uri) { if (!transport_str) { if (conn->uri->server) transport = REMOTE_DRIVER_TRANSPORT_TLS; else transport = REMOTE_DRIVER_TRANSPORT_UNIX; } else { if ((transport = remoteDriverTransportTypeFromString(transport_str)) < 0) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("remote_open: transport in URL not recognised " "(should be tls|unix|ssh|ext|tcp|libssh2|libssh)")); return VIR_DRV_OPEN_ERROR; } if (transport == REMOTE_DRIVER_TRANSPORT_UNIX && conn->uri->server) { virReportError(VIR_ERR_INVALID_ARG, _("using unix socket and remote " "server '%s' is not supported."), conn->uri->server); return VIR_DRV_OPEN_ERROR; } } } else { /* No URI, then must be probing so use UNIX socket */ transport = REMOTE_DRIVER_TRANSPORT_UNIX; } /* Remote server defaults to "localhost" if not specified. */ if (conn->uri && conn->uri->port != 0) { port = g_strdup_printf("%d", conn->uri->port); } else if (transport == REMOTE_DRIVER_TRANSPORT_TLS) { port = g_strdup(LIBVIRTD_TLS_PORT); } else if (transport == REMOTE_DRIVER_TRANSPORT_TCP) { port = g_strdup(LIBVIRTD_TCP_PORT); } /* Port not used for unix, ext., default for ssh */ priv->hostname = g_strdup(conn->uri && conn->uri->server ? conn->uri->server : "localhost"); if (conn->uri) username = g_strdup(conn->uri->user); /* Get the variables from the query string. * Then we need to reconstruct the query string (because * feasibly it might contain variables needed by the real driver, * although that won't be the case for now). */ size_t i; if (conn->uri) { for (i = 0; i < conn->uri->paramsCount; i++) { virURIParamPtr var = &conn->uri->params[i]; EXTRACT_URI_ARG_STR("name", name); EXTRACT_URI_ARG_STR("command", command); EXTRACT_URI_ARG_STR("socket", sockname); EXTRACT_URI_ARG_STR("auth", authtype); EXTRACT_URI_ARG_STR("sshauth", sshauth); EXTRACT_URI_ARG_STR("netcat", netcat); EXTRACT_URI_ARG_STR("keyfile", keyfile); EXTRACT_URI_ARG_STR("pkipath", pkipath); EXTRACT_URI_ARG_STR("known_hosts", knownHosts); EXTRACT_URI_ARG_STR("known_hosts_verify", knownHostsVerify); EXTRACT_URI_ARG_STR("tls_priority", tls_priority); EXTRACT_URI_ARG_STR("mode", mode_str); EXTRACT_URI_ARG_BOOL("no_sanity", sanity); EXTRACT_URI_ARG_BOOL("no_verify", verify); #ifndef WIN32 EXTRACT_URI_ARG_BOOL("no_tty", tty); #endif if (STRCASEEQ(var->name, "authfile")) { /* Strip this param, used by virauth.c */ var->ignore = 1; continue; } VIR_DEBUG("passing through variable '%s' ('%s') to remote end", var->name, var->value); } /* Construct the original name. */ if (!name) { if (conn->uri->scheme && (STREQ(conn->uri->scheme, "remote") || STRPREFIX(conn->uri->scheme, "remote+"))) { /* Allow remote serve to probe */ name = g_strdup(""); } else { virURI tmpuri = { .scheme = (char *)driver_str, .query = virURIFormatParams(conn->uri), .path = conn->uri->path, .fragment = conn->uri->fragment, }; name = virURIFormat(&tmpuri); VIR_FREE(tmpuri.query); if (!name) goto failed; } } } else { /* Probe URI server side */ name = g_strdup(""); } if (conf && !mode_str && virConfGetValueString(conf, "remote_mode", &mode_str) < 0) goto failed; if (mode_str && (mode = remoteDriverModeTypeFromString(mode_str)) < 0) goto failed; /* Sanity check that nothing requested !direct mode by mistake */ if (inside_daemon && !conn->uri->server && mode != REMOTE_DRIVER_MODE_DIRECT) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Connections from inside daemon must be direct")); return VIR_DRV_OPEN_ERROR; } VIR_DEBUG("proceeding with name = %s", name); /* For ext transport, command is required. */ if (transport == REMOTE_DRIVER_TRANSPORT_EXT && !command) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("remote_open: for 'ext' transport, command is required")); goto failed; } VIR_DEBUG("Connecting with transport %d", transport); switch ((remoteDriverTransport)transport) { case REMOTE_DRIVER_TRANSPORT_UNIX: case REMOTE_DRIVER_TRANSPORT_SSH: case REMOTE_DRIVER_TRANSPORT_LIBSSH: case REMOTE_DRIVER_TRANSPORT_LIBSSH2: if (!sockname && !(sockname = remoteGetUNIXSocket(transport, mode, driver_str, &daemon_name, flags))) goto failed; break; case REMOTE_DRIVER_TRANSPORT_TCP: case REMOTE_DRIVER_TRANSPORT_TLS: case REMOTE_DRIVER_TRANSPORT_EXT: break; case REMOTE_DRIVER_TRANSPORT_LAST: default: virReportEnumRangeError(remoteDriverTransport, transport); goto failed; } VIR_DEBUG("Chosen UNIX socket %s", NULLSTR(sockname)); /* Connect to the remote service. */ switch ((remoteDriverTransport)transport) { case REMOTE_DRIVER_TRANSPORT_TLS: if (conf && !tls_priority && virConfGetValueString(conf, "tls_priority", &tls_priority) < 0) goto failed; #ifdef WITH_GNUTLS priv->tls = virNetTLSContextNewClientPath(pkipath, geteuid() != 0 ? true : false, tls_priority, sanity, verify); if (!priv->tls) goto failed; priv->is_secure = 1; G_GNUC_FALLTHROUGH; #else (void)tls_priority; (void)sanity; (void)verify; virReportError(VIR_ERR_INVALID_ARG, "%s", _("GNUTLS support not available in this build")); goto failed; #endif case REMOTE_DRIVER_TRANSPORT_TCP: priv->client = virNetClientNewTCP(priv->hostname, port, AF_UNSPEC); if (!priv->client) goto failed; #ifdef WITH_GNUTLS if (priv->tls) { VIR_DEBUG("Starting TLS session"); if (virNetClientSetTLSSession(priv->client, priv->tls) < 0) goto failed; } #endif break; case REMOTE_DRIVER_TRANSPORT_LIBSSH2: VIR_DEBUG("Starting LibSSH2 session"); priv->client = virNetClientNewLibSSH2(priv->hostname, port, AF_UNSPEC, username, keyfile, knownHosts, knownHostsVerify, sshauth, netcat, sockname, auth, conn->uri); if (!priv->client) goto failed; priv->is_secure = 1; break; case REMOTE_DRIVER_TRANSPORT_LIBSSH: VIR_DEBUG("Starting libssh session"); priv->client = virNetClientNewLibssh(priv->hostname, port, AF_UNSPEC, username, keyfile, knownHosts, knownHostsVerify, sshauth, netcat, sockname, auth, conn->uri); if (!priv->client) goto failed; priv->is_secure = 1; break; #ifndef WIN32 case REMOTE_DRIVER_TRANSPORT_UNIX: if (flags & VIR_DRV_OPEN_REMOTE_AUTOSTART) { const char *env_name = remoteGetDaemonPathEnv(); if (!(daemonPath = virFileFindResourceFull(daemon_name, NULL, NULL, abs_top_builddir "/src", SBINDIR, env_name))) goto failed; } if (!(priv->client = virNetClientNewUNIX(sockname, flags & VIR_DRV_OPEN_REMOTE_AUTOSTART, daemonPath))) goto failed; priv->is_secure = 1; break; case REMOTE_DRIVER_TRANSPORT_SSH: if (!command) command = g_strdup("ssh"); if (!(priv->client = virNetClientNewSSH(priv->hostname, port, command, username, !tty, !verify, netcat ? netcat : "nc", keyfile, sockname))) goto failed; priv->is_secure = 1; break; case REMOTE_DRIVER_TRANSPORT_EXT: { char const *cmd_argv[] = { command, NULL }; if (!(priv->client = virNetClientNewExternal(cmd_argv))) goto failed; /* Do not set 'is_secure' flag since we can't guarantee * an external program is secure, and this flag must be * pessimistic */ } break; #else /* WIN32 */ case REMOTE_DRIVER_TRANSPORT_UNIX: case REMOTE_DRIVER_TRANSPORT_SSH: case REMOTE_DRIVER_TRANSPORT_EXT: virReportError(VIR_ERR_INVALID_ARG, "%s", _("transport methods unix, ssh and ext are not supported " "under Windows")); goto failed; #endif /* WIN32 */ case REMOTE_DRIVER_TRANSPORT_LAST: default: virReportEnumRangeError(remoteDriverTransport, transport); goto failed; } /* switch (transport) */ if (virNetClientRegisterAsyncIO(priv->client) < 0) { VIR_DEBUG("Failed to add event watch, disabling events and support for" " keepalive messages"); virResetLastError(); } else { if (virNetClientRegisterKeepAlive(priv->client) < 0) goto failed; } if (!(priv->closeCallback = virNewConnectCloseCallbackData())) goto failed; /* ref on behalf of netclient */ virObjectRef(priv->closeCallback); virNetClientSetCloseCallback(priv->client, remoteClientCloseFunc, priv->closeCallback, virObjectFreeCallback); if (!(priv->remoteProgram = virNetClientProgramNew(REMOTE_PROGRAM, REMOTE_PROTOCOL_VERSION, remoteEvents, G_N_ELEMENTS(remoteEvents), conn))) goto failed; if (!(priv->lxcProgram = virNetClientProgramNew(LXC_PROGRAM, LXC_PROTOCOL_VERSION, NULL, 0, NULL))) goto failed; if (!(priv->qemuProgram = virNetClientProgramNew(QEMU_PROGRAM, QEMU_PROTOCOL_VERSION, qemuEvents, G_N_ELEMENTS(qemuEvents), conn))) goto failed; if (virNetClientAddProgram(priv->client, priv->remoteProgram) < 0 || virNetClientAddProgram(priv->client, priv->lxcProgram) < 0 || virNetClientAddProgram(priv->client, priv->qemuProgram) < 0) goto failed; /* Try and authenticate with server */ VIR_DEBUG("Trying authentication"); if (remoteAuthenticate(conn, priv, auth, authtype) == -1) goto failed; if (virNetClientKeepAliveIsSupported(priv->client)) { priv->serverKeepAlive = remoteConnectSupportsFeatureUnlocked(conn, priv, VIR_DRV_FEATURE_PROGRAM_KEEPALIVE); if (!priv->serverKeepAlive) { VIR_INFO("Disabling keepalive protocol since it is not supported" " by the server"); } } /* Finally we can call the remote side's open function. */ { remote_connect_open_args args = { &name, flags }; VIR_DEBUG("Trying to open URI '%s'", name); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_OPEN, (xdrproc_t) xdr_remote_connect_open_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto failed; } /* Now try and find out what URI the daemon used */ if (conn->uri == NULL) { remote_connect_get_uri_ret uriret; VIR_DEBUG("Trying to query remote URI"); memset(&uriret, 0, sizeof(uriret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_GET_URI, (xdrproc_t) xdr_void, (char *) NULL, (xdrproc_t) xdr_remote_connect_get_uri_ret, (char *) &uriret) < 0) goto failed; VIR_DEBUG("Auto-probed URI is %s", uriret.uri); conn->uri = virURIParse(uriret.uri); VIR_FREE(uriret.uri); if (!conn->uri) goto failed; } /* Set up events */ if (!(priv->eventState = virObjectEventStateNew())) goto failed; priv->serverEventFilter = remoteConnectSupportsFeatureUnlocked(conn, priv, VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK); if (!priv->serverEventFilter) { VIR_INFO("Avoiding server event filtering since it is not " "supported by the server"); } priv->serverCloseCallback = remoteConnectSupportsFeatureUnlocked(conn, priv, VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK); if (!priv->serverCloseCallback) { VIR_INFO("Close callback registering isn't supported " "by the remote side."); } return VIR_DRV_OPEN_SUCCESS; failed: virObjectUnref(priv->remoteProgram); virObjectUnref(priv->lxcProgram); virObjectUnref(priv->qemuProgram); virNetClientClose(priv->client); virObjectUnref(priv->client); priv->client = NULL; virObjectUnref(priv->closeCallback); priv->closeCallback = NULL; #ifdef WITH_GNUTLS virObjectUnref(priv->tls); priv->tls = NULL; #endif VIR_FREE(priv->hostname); return VIR_DRV_OPEN_ERROR; } #undef EXTRACT_URI_ARG_STR #undef EXTRACT_URI_ARG_BOOL static struct private_data * remoteAllocPrivateData(void) { struct private_data *priv; if (VIR_ALLOC(priv) < 0) return NULL; if (virMutexInit(&priv->lock) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot initialize mutex")); VIR_FREE(priv); return NULL; } remoteDriverLock(priv); priv->localUses = 1; return priv; } static virDrvOpenStatus remoteConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, virConfPtr conf, unsigned int flags) { struct private_data *priv; int ret = VIR_DRV_OPEN_ERROR; int rflags = 0; const char *autostart = getenv("LIBVIRT_AUTOSTART"); char *driver = NULL; char *transport = NULL; if (conn->uri && remoteSplitURIScheme(conn->uri, &driver, &transport) < 0) goto cleanup; if (inside_daemon) { if (!conn->uri) { ret = VIR_DRV_OPEN_DECLINED; goto cleanup; } /* If there's a driver registered we must defer to that. * If there isn't a driver, we must connect in "direct" * mode - see doRemoteOpen */ if (!conn->uri->server && virHasDriverForURIScheme(driver)) { ret = VIR_DRV_OPEN_DECLINED; goto cleanup; } } if (!(priv = remoteAllocPrivateData())) goto cleanup; if (flags & VIR_CONNECT_RO) rflags |= VIR_DRV_OPEN_REMOTE_RO; /* * User session daemon is used for * * - Any URI with /session suffix * - Test driver, if a protocol is given * * provided we are running non-root */ if (conn->uri && conn->uri->path && conn->uri->scheme && (STREQ(conn->uri->path, "/session") || STRPREFIX(conn->uri->scheme, "test+")) && geteuid() > 0) { VIR_DEBUG("User session daemon required"); rflags |= VIR_DRV_OPEN_REMOTE_USER; /* * Furthermore if no servername is given, and no +XXX * transport is listed, or transport is unix, * and uid is unprivileged then auto-spawn a daemon. */ if (!conn->uri->server && (transport == NULL || STREQ(transport, "unix")) && (!autostart || STRNEQ(autostart, "0"))) { VIR_DEBUG("Try daemon autostart"); rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART; } } /* * If URI is NULL, then do a UNIX connection possibly auto-spawning * unprivileged server and probe remote server for URI. */ if (!conn->uri) { VIR_DEBUG("Auto-probe remote URI"); if (geteuid() > 0) { VIR_DEBUG("Auto-spawn user daemon instance"); rflags |= VIR_DRV_OPEN_REMOTE_USER; if (!autostart || STRNEQ(autostart, "0")) rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART; } } ret = doRemoteOpen(conn, priv, driver, transport, auth, conf, rflags); if (ret != VIR_DRV_OPEN_SUCCESS) { conn->privateData = NULL; remoteDriverUnlock(priv); VIR_FREE(priv); } else { conn->privateData = priv; remoteDriverUnlock(priv); } cleanup: VIR_FREE(driver); VIR_FREE(transport); return ret; } /*----------------------------------------------------------------------*/ static int doRemoteClose(virConnectPtr conn, struct private_data *priv) { int ret = 0; if (call(conn, priv, 0, REMOTE_PROC_CONNECT_CLOSE, (xdrproc_t) xdr_void, (char *) NULL, (xdrproc_t) xdr_void, (char *) NULL) == -1) ret = -1; #ifdef WITH_GNUTLS virObjectUnref(priv->tls); priv->tls = NULL; #endif virNetClientSetCloseCallback(priv->client, NULL, priv->closeCallback, virObjectFreeCallback); virNetClientClose(priv->client); virObjectUnref(priv->client); priv->client = NULL; virObjectUnref(priv->closeCallback); priv->closeCallback = NULL; virObjectUnref(priv->remoteProgram); virObjectUnref(priv->lxcProgram); virObjectUnref(priv->qemuProgram); priv->remoteProgram = priv->qemuProgram = priv->lxcProgram = NULL; /* Free hostname copy */ VIR_FREE(priv->hostname); /* See comment for remoteType. */ VIR_FREE(priv->type); virObjectUnref(priv->eventState); priv->eventState = NULL; return ret; } static int remoteConnectClose(virConnectPtr conn) { int ret = 0; struct private_data *priv = conn->privateData; remoteDriverLock(priv); priv->localUses--; if (!priv->localUses) { ret = doRemoteClose(conn, priv); conn->privateData = NULL; remoteDriverUnlock(priv); virMutexDestroy(&priv->lock); VIR_FREE(priv); } if (priv) remoteDriverUnlock(priv); return ret; } /* Unfortunately this function is defined to return a static string. * Since the remote end always answers with the same type (for a * single connection anyway) we cache the type in the connection's * private data, and free it when we close the connection. * * See also: * http://www.redhat.com/archives/libvir-list/2007-February/msg00096.html */ static const char * remoteConnectGetType(virConnectPtr conn) { char *rv = NULL; remote_connect_get_type_ret ret; struct private_data *priv = conn->privateData; remoteDriverLock(priv); /* Cached? */ if (priv->type) { rv = priv->type; goto done; } memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_GET_TYPE, (xdrproc_t) xdr_void, (char *) NULL, (xdrproc_t) xdr_remote_connect_get_type_ret, (char *) &ret) == -1) goto done; /* Stash. */ rv = priv->type = ret.type; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectIsSecure(virConnectPtr conn) { int rv = -1; struct private_data *priv = conn->privateData; remote_connect_is_secure_ret ret; remoteDriverLock(priv); memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_IS_SECURE, (xdrproc_t) xdr_void, (char *) NULL, (xdrproc_t) xdr_remote_connect_is_secure_ret, (char *) &ret) == -1) goto done; /* We claim to be secure, if the remote driver * transport itself is secure, and the remote * HV connection is secure * * ie, we don't want to claim to be secure if the * remote driver is used to connect to a XenD * driver using unencrypted HTTP:/// access */ rv = priv->is_secure && ret.secure ? 1 : 0; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectIsEncrypted(virConnectPtr conn) { int rv = -1; bool encrypted; struct private_data *priv = conn->privateData; remote_connect_is_secure_ret ret; remoteDriverLock(priv); memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_IS_SECURE, (xdrproc_t) xdr_void, (char *) NULL, (xdrproc_t) xdr_remote_connect_is_secure_ret, (char *) &ret) == -1) goto done; encrypted = virNetClientIsEncrypted(priv->client); /* We claim to be encrypted, if the remote driver * transport itself is encrypted, and the remote * HV connection is secure. * * Yes, we really don't check the remote 'encrypted' * option, since it will almost always be false, * even if secure (eg UNIX sockets). */ rv = encrypted && ret.secure ? 1 : 0; done: remoteDriverUnlock(priv); return rv; } static int remoteNodeGetCPUStats(virConnectPtr conn, int cpuNum, virNodeCPUStatsPtr params, int *nparams, unsigned int flags) { int rv = -1; remote_node_get_cpu_stats_args args; remote_node_get_cpu_stats_ret ret; size_t i; struct private_data *priv = conn->privateData; remoteDriverLock(priv); args.nparams = *nparams; args.cpuNum = cpuNum; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_CPU_STATS, (xdrproc_t) xdr_remote_node_get_cpu_stats_args, (char *) &args, (xdrproc_t) xdr_remote_node_get_cpu_stats_ret, (char *) &ret) == -1) goto done; /* Check the length of the returned list carefully. */ if (ret.params.params_len > REMOTE_NODE_CPU_STATS_MAX || ret.params.params_len > *nparams) { virReportError(VIR_ERR_RPC, "%s", _("remoteNodeGetCPUStats: " "returned number of stats exceeds limit")); goto cleanup; } /* Handle the case when the caller does not know the number of stats * and is asking for the number of stats supported */ if (*nparams == 0) { *nparams = ret.nparams; rv = 0; goto cleanup; } *nparams = ret.params.params_len; /* Deserialise the result. */ for (i = 0; i < *nparams; ++i) { if (virStrcpyStatic(params[i].field, ret.params.params_val[i].field) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Stats %s too big for destination"), ret.params.params_val[i].field); goto cleanup; } params[i].value = ret.params.params_val[i].value; } rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_node_get_cpu_stats_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteNodeGetMemoryStats(virConnectPtr conn, int cellNum, virNodeMemoryStatsPtr params, int *nparams, unsigned int flags) { int rv = -1; remote_node_get_memory_stats_args args; remote_node_get_memory_stats_ret ret; size_t i; struct private_data *priv = conn->privateData; remoteDriverLock(priv); args.nparams = *nparams; args.cellNum = cellNum; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_MEMORY_STATS, (xdrproc_t) xdr_remote_node_get_memory_stats_args, (char *) &args, (xdrproc_t) xdr_remote_node_get_memory_stats_ret, (char *) &ret) == -1) goto done; /* Check the length of the returned list carefully. */ if (ret.params.params_len > REMOTE_NODE_MEMORY_STATS_MAX || ret.params.params_len > *nparams) { virReportError(VIR_ERR_RPC, "%s", _("remoteNodeGetMemoryStats: " "returned number of stats exceeds limit")); goto cleanup; } /* Handle the case when the caller does not know the number of stats * and is asking for the number of stats supported */ if (*nparams == 0) { *nparams = ret.nparams; rv = 0; goto cleanup; } *nparams = ret.params.params_len; /* Deserialise the result. */ for (i = 0; i < *nparams; ++i) { if (virStrcpyStatic(params[i].field, ret.params.params_val[i].field) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Stats %s too big for destination"), ret.params.params_val[i].field); goto cleanup; } params[i].value = ret.params.params_val[i].value; } rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_node_get_memory_stats_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freeMems, int startCell, int maxCells) { int rv = -1; remote_node_get_cells_free_memory_args args; remote_node_get_cells_free_memory_ret ret; size_t i; struct private_data *priv = conn->privateData; remoteDriverLock(priv); if (maxCells > REMOTE_NODE_MAX_CELLS) { virReportError(VIR_ERR_RPC, _("too many NUMA cells: %d > %d"), maxCells, REMOTE_NODE_MAX_CELLS); goto done; } args.startCell = startCell; args.maxcells = maxCells; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY, (xdrproc_t) xdr_remote_node_get_cells_free_memory_args, (char *)&args, (xdrproc_t) xdr_remote_node_get_cells_free_memory_ret, (char *)&ret) == -1) goto done; for (i = 0; i < ret.cells.cells_len; i++) freeMems[i] = ret.cells.cells_val[i]; xdr_free((xdrproc_t) xdr_remote_node_get_cells_free_memory_ret, (char *) &ret); rv = ret.cells.cells_len; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectListDomains(virConnectPtr conn, int *ids, int maxids) { int rv = -1; size_t i; remote_connect_list_domains_args args; remote_connect_list_domains_ret ret; struct private_data *priv = conn->privateData; remoteDriverLock(priv); if (maxids > REMOTE_DOMAIN_LIST_MAX) { virReportError(VIR_ERR_RPC, _("Too many domains '%d' for limit '%d'"), maxids, REMOTE_DOMAIN_LIST_MAX); goto done; } args.maxids = maxids; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_LIST_DOMAINS, (xdrproc_t) xdr_remote_connect_list_domains_args, (char *) &args, (xdrproc_t) xdr_remote_connect_list_domains_ret, (char *) &ret) == -1) goto done; if (ret.ids.ids_len > maxids) { virReportError(VIR_ERR_RPC, _("Too many domains '%d' for limit '%d'"), ret.ids.ids_len, maxids); goto cleanup; } for (i = 0; i < ret.ids.ids_len; ++i) ids[i] = ret.ids.ids_val[i]; rv = ret.ids.ids_len; cleanup: xdr_free((xdrproc_t) xdr_remote_connect_list_domains_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDeserializeDomainDiskErrors(remote_domain_disk_error *ret_errors_val, u_int ret_errors_len, int limit, virDomainDiskErrorPtr errors, int maxerrors) { size_t i = 0; size_t j; if (ret_errors_len > limit || ret_errors_len > maxerrors) { virReportError(VIR_ERR_RPC, "%s", _("returned number of disk errors exceeds limit")); goto error; } for (i = 0; i < ret_errors_len; i++) { errors[i].disk = g_strdup(ret_errors_val[i].disk); errors[i].error = ret_errors_val[i].error; } return 0; error: for (j = 0; j < i; j++) VIR_FREE(errors[j].disk); return -1; } static int remoteDomainBlockStatsFlags(virDomainPtr domain, const char *path, virTypedParameterPtr params, int *nparams, unsigned int flags) { int rv = -1; remote_domain_block_stats_flags_args args; remote_domain_block_stats_flags_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.nparams = *nparams; args.path = (char *) path; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS, (xdrproc_t) xdr_remote_domain_block_stats_flags_args, (char *) &args, (xdrproc_t) xdr_remote_domain_block_stats_flags_ret, (char *) &ret) == -1) goto done; /* Check the length of the returned list carefully. */ if (ret.params.params_len > REMOTE_DOMAIN_BLOCK_STATS_PARAMETERS_MAX || ret.params.params_len > *nparams) { virReportError(VIR_ERR_RPC, "%s", _("remoteDomainBlockStatsFlags: " "returned number of stats exceeds limit")); goto cleanup; } /* Handle the case when the caller does not know the number of stats * and is asking for the number of stats supported */ if (*nparams == 0) { *nparams = ret.nparams; rv = 0; goto cleanup; } *nparams = ret.params.params_len; /* Deserialize the result. */ if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_DOMAIN_BLOCK_STATS_PARAMETERS_MAX, &params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_block_stats_flags_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetMemoryParameters(virDomainPtr domain, virTypedParameterPtr params, int *nparams, unsigned int flags) { int rv = -1; remote_domain_get_memory_parameters_args args; remote_domain_get_memory_parameters_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.nparams = *nparams; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS, (xdrproc_t) xdr_remote_domain_get_memory_parameters_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_memory_parameters_ret, (char *) &ret) == -1) goto done; /* Handle the case when the caller does not know the number of parameters * and is asking for the number of parameters supported */ if (*nparams == 0) { *nparams = ret.nparams; rv = 0; goto cleanup; } if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX, &params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_memory_parameters_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetNumaParameters(virDomainPtr domain, virTypedParameterPtr params, int *nparams, unsigned int flags) { int rv = -1; remote_domain_get_numa_parameters_args args; remote_domain_get_numa_parameters_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.nparams = *nparams; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_NUMA_PARAMETERS, (xdrproc_t) xdr_remote_domain_get_numa_parameters_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_numa_parameters_ret, (char *) &ret) == -1) goto done; /* Handle the case when the caller does not know the number of parameters * and is asking for the number of parameters supported */ if (*nparams == 0) { *nparams = ret.nparams; rv = 0; goto cleanup; } if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_DOMAIN_NUMA_PARAMETERS_MAX, &params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_numa_parameters_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetLaunchSecurityInfo(virDomainPtr domain, virTypedParameterPtr *params, int *nparams, unsigned int flags) { int rv = -1; remote_domain_get_launch_security_info_args args; remote_domain_get_launch_security_info_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_LAUNCH_SECURITY_INFO, (xdrproc_t) xdr_remote_domain_get_launch_security_info_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_launch_security_info_ret, (char *) &ret) == -1) goto done; if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_DOMAIN_LAUNCH_SECURITY_INFO_PARAMS_MAX, params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_launch_security_info_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetPerfEvents(virDomainPtr domain, virTypedParameterPtr *params, int *nparams, unsigned int flags) { int rv = -1; remote_domain_get_perf_events_args args; remote_domain_get_perf_events_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_PERF_EVENTS, (xdrproc_t) xdr_remote_domain_get_perf_events_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_perf_events_ret, (char *) &ret) == -1) goto done; if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_DOMAIN_PERF_EVENTS_MAX, params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_perf_events_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetBlkioParameters(virDomainPtr domain, virTypedParameterPtr params, int *nparams, unsigned int flags) { int rv = -1; remote_domain_get_blkio_parameters_args args; remote_domain_get_blkio_parameters_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.nparams = *nparams; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS, (xdrproc_t) xdr_remote_domain_get_blkio_parameters_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret, (char *) &ret) == -1) goto done; /* Handle the case when the caller does not know the number of parameters * and is asking for the number of parameters supported */ if (*nparams == 0) { *nparams = ret.nparams; rv = 0; goto cleanup; } if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX, &params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetVcpuPinInfo(virDomainPtr domain, int ncpumaps, unsigned char *cpumaps, int maplen, unsigned int flags) { int rv = -1; size_t i; remote_domain_get_vcpu_pin_info_args args; remote_domain_get_vcpu_pin_info_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); if (ncpumaps > REMOTE_VCPUINFO_MAX) { virReportError(VIR_ERR_RPC, _("vCPU count exceeds maximum: %d > %d"), ncpumaps, REMOTE_VCPUINFO_MAX); goto done; } if (INT_MULTIPLY_OVERFLOW(ncpumaps, maplen) || ncpumaps * maplen > REMOTE_CPUMAPS_MAX) { virReportError(VIR_ERR_RPC, _("vCPU map buffer length exceeds maximum: %d > %d"), ncpumaps * maplen, REMOTE_CPUMAPS_MAX); goto done; } make_nonnull_domain(&args.dom, domain); args.ncpumaps = ncpumaps; args.maplen = maplen; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO, (xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_ret, (char *) &ret) == -1) goto done; if (ret.num > ncpumaps) { virReportError(VIR_ERR_RPC, _("host reports too many vCPUs: %d > %d"), ret.num, ncpumaps); goto cleanup; } if (ret.cpumaps.cpumaps_len > ncpumaps * maplen) { virReportError(VIR_ERR_RPC, _("host reports map buffer length exceeds maximum: %d > %d"), ret.cpumaps.cpumaps_len, ncpumaps * maplen); goto cleanup; } memset(cpumaps, 0, ncpumaps * maplen); for (i = 0; i < ret.cpumaps.cpumaps_len; ++i) cpumaps[i] = ret.cpumaps.cpumaps_val[i]; rv = ret.num; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainPinEmulator(virDomainPtr dom, unsigned char *cpumap, int cpumaplen, unsigned int flags) { int rv = -1; struct private_data *priv = dom->conn->privateData; remote_domain_pin_emulator_args args; remoteDriverLock(priv); if (cpumaplen > REMOTE_CPUMAP_MAX) { virReportError(VIR_ERR_RPC, _("%s length greater than maximum: %d > %d"), "cpumap", cpumaplen, REMOTE_CPUMAP_MAX); goto done; } make_nonnull_domain(&args.dom, dom); args.cpumap.cpumap_val = (char *)cpumap; args.cpumap.cpumap_len = cpumaplen; args.flags = flags; if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_PIN_EMULATOR, (xdrproc_t) xdr_remote_domain_pin_emulator_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) { goto done; } rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetEmulatorPinInfo(virDomainPtr domain, unsigned char *cpumaps, int maplen, unsigned int flags) { int rv = -1; size_t i; remote_domain_get_emulator_pin_info_args args; remote_domain_get_emulator_pin_info_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); /* There is only one cpumap for all emulator threads */ if (maplen > REMOTE_CPUMAPS_MAX) { virReportError(VIR_ERR_RPC, _("vCPU map buffer length exceeds maximum: %d > %d"), maplen, REMOTE_CPUMAPS_MAX); goto done; } make_nonnull_domain(&args.dom, domain); args.maplen = maplen; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_EMULATOR_PIN_INFO, (xdrproc_t) xdr_remote_domain_get_emulator_pin_info_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_emulator_pin_info_ret, (char *) &ret) == -1) goto done; if (ret.cpumaps.cpumaps_len > maplen) { virReportError(VIR_ERR_RPC, _("host reports map buffer length exceeds maximum: %d > %d"), ret.cpumaps.cpumaps_len, maplen); goto cleanup; } memset(cpumaps, 0, maplen); for (i = 0; i < ret.cpumaps.cpumaps_len; ++i) cpumaps[i] = ret.cpumaps.cpumaps_val[i]; rv = ret.ret; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_emulator_pin_info_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, unsigned char *cpumaps, int maplen) { int rv = -1; size_t i; remote_domain_get_vcpus_args args; remote_domain_get_vcpus_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); if (maxinfo > REMOTE_VCPUINFO_MAX) { virReportError(VIR_ERR_RPC, _("vCPU count exceeds maximum: %d > %d"), maxinfo, REMOTE_VCPUINFO_MAX); goto done; } if (INT_MULTIPLY_OVERFLOW(maxinfo, maplen) || maxinfo * maplen > REMOTE_CPUMAPS_MAX) { virReportError(VIR_ERR_RPC, _("vCPU map buffer length exceeds maximum: %d > %d"), maxinfo * maplen, REMOTE_CPUMAPS_MAX); goto done; } make_nonnull_domain(&args.dom, domain); args.maxinfo = maxinfo; args.maplen = maplen; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPUS, (xdrproc_t) xdr_remote_domain_get_vcpus_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret) == -1) goto done; if (ret.info.info_len > maxinfo) { virReportError(VIR_ERR_RPC, _("host reports too many vCPUs: %d > %d"), ret.info.info_len, maxinfo); goto cleanup; } if (ret.cpumaps.cpumaps_len > maxinfo * maplen) { virReportError(VIR_ERR_RPC, _("host reports map buffer length exceeds maximum: %d > %d"), ret.cpumaps.cpumaps_len, maxinfo * maplen); goto cleanup; } memset(info, 0, sizeof(virVcpuInfo) * maxinfo); memset(cpumaps, 0, maxinfo * maplen); for (i = 0; i < ret.info.info_len; ++i) { info[i].number = ret.info.info_val[i].number; info[i].state = ret.info.info_val[i].state; info[i].cpuTime = ret.info.info_val[i].cpu_time; info[i].cpu = ret.info.info_val[i].cpu; } for (i = 0; i < ret.cpumaps.cpumaps_len; ++i) cpumaps[i] = ret.cpumaps.cpumaps_val[i]; rv = ret.info.info_len; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetIOThreadInfo(virDomainPtr dom, virDomainIOThreadInfoPtr **info, unsigned int flags) { int rv = -1; size_t i; struct private_data *priv = dom->conn->privateData; remote_domain_get_iothread_info_args args; remote_domain_get_iothread_info_ret ret; remote_domain_iothread_info *src; virDomainIOThreadInfoPtr *info_ret = NULL; remoteDriverLock(priv); make_nonnull_domain(&args.dom, dom); args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_IOTHREAD_INFO, (xdrproc_t)xdr_remote_domain_get_iothread_info_args, (char *)&args, (xdrproc_t)xdr_remote_domain_get_iothread_info_ret, (char *)&ret) == -1) goto done; if (ret.info.info_len > REMOTE_IOTHREAD_INFO_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Too many IOThreads in info: %d for limit %d"), ret.info.info_len, REMOTE_IOTHREAD_INFO_MAX); goto cleanup; } if (info) { if (!ret.info.info_len) { *info = NULL; rv = ret.ret; goto cleanup; } if (VIR_ALLOC_N(info_ret, ret.info.info_len) < 0) goto cleanup; for (i = 0; i < ret.info.info_len; i++) { src = &ret.info.info_val[i]; if (VIR_ALLOC(info_ret[i]) < 0) goto cleanup; info_ret[i]->iothread_id = src->iothread_id; if (VIR_ALLOC_N(info_ret[i]->cpumap, src->cpumap.cpumap_len) < 0) goto cleanup; memcpy(info_ret[i]->cpumap, src->cpumap.cpumap_val, src->cpumap.cpumap_len); info_ret[i]->cpumaplen = src->cpumap.cpumap_len; } *info = info_ret; info_ret = NULL; } rv = ret.ret; cleanup: if (info_ret) { for (i = 0; i < ret.info.info_len; i++) virDomainIOThreadInfoFree(info_ret[i]); VIR_FREE(info_ret); } xdr_free((xdrproc_t)xdr_remote_domain_get_iothread_info_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetSecurityLabel(virDomainPtr domain, virSecurityLabelPtr seclabel) { remote_domain_get_security_label_args args; remote_domain_get_security_label_ret ret; struct private_data *priv = domain->conn->privateData; int rv = -1; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); memset(&ret, 0, sizeof(ret)); memset(seclabel, 0, sizeof(*seclabel)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL, (xdrproc_t) xdr_remote_domain_get_security_label_args, (char *)&args, (xdrproc_t) xdr_remote_domain_get_security_label_ret, (char *)&ret) == -1) { goto done; } if (ret.label.label_val != NULL) { if (strlen(ret.label.label_val) >= sizeof(seclabel->label)) { virReportError(VIR_ERR_RPC, _("security label exceeds maximum: %zu"), sizeof(seclabel->label) - 1); goto cleanup; } strcpy(seclabel->label, ret.label.label_val); seclabel->enforcing = ret.enforcing; } rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_security_label_ret, (char *)&ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetSecurityLabelList(virDomainPtr domain, virSecurityLabelPtr* seclabels) { remote_domain_get_security_label_list_args args; remote_domain_get_security_label_list_ret ret; struct private_data *priv = domain->conn->privateData; size_t i; int rv = -1; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST, (xdrproc_t) xdr_remote_domain_get_security_label_list_args, (char *)&args, (xdrproc_t) xdr_remote_domain_get_security_label_list_ret, (char *)&ret) == -1) { goto done; } if (VIR_ALLOC_N(*seclabels, ret.labels.labels_len) < 0) goto cleanup; for (i = 0; i < ret.labels.labels_len; i++) { remote_domain_get_security_label_ret *cur = &ret.labels.labels_val[i]; if (cur->label.label_val != NULL) { if (strlen(cur->label.label_val) >= sizeof((*seclabels)->label)) { virReportError(VIR_ERR_RPC, _("security label exceeds maximum: %zd"), sizeof((*seclabels)->label) - 1); VIR_FREE(*seclabels); goto cleanup; } strcpy((*seclabels)[i].label, cur->label.label_val); (*seclabels)[i].enforcing = cur->enforcing; } } rv = ret.ret; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_security_label_list_ret, (char *)&ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetState(virDomainPtr domain, int *state, int *reason, unsigned int flags) { int rv = -1; remote_domain_get_state_args args; remote_domain_get_state_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_STATE, (xdrproc_t) xdr_remote_domain_get_state_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_state_ret, (char *) &ret) == -1) goto done; *state = ret.state; if (reason) *reason = ret.reason; rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel) { remote_node_get_security_model_ret ret; struct private_data *priv = conn->privateData; int rv = -1; remoteDriverLock(priv); memset(&ret, 0, sizeof(ret)); memset(secmodel, 0, sizeof(*secmodel)); if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_SECURITY_MODEL, (xdrproc_t) xdr_void, NULL, (xdrproc_t) xdr_remote_node_get_security_model_ret, (char *)&ret) == -1) { goto done; } if (ret.model.model_val != NULL) { if (strlen(ret.model.model_val) >= sizeof(secmodel->model)) { virReportError(VIR_ERR_RPC, _("security model exceeds maximum: %zu"), sizeof(secmodel->model) - 1); goto cleanup; } strcpy(secmodel->model, ret.model.model_val); } if (ret.doi.doi_val != NULL) { if (strlen(ret.doi.doi_val) >= sizeof(secmodel->doi)) { virReportError(VIR_ERR_RPC, _("security doi exceeds maximum: %zu"), sizeof(secmodel->doi) - 1); goto cleanup; } strcpy(secmodel->doi, ret.doi.doi_val); } rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_node_get_security_model_ret, (char *)&ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainMigratePrepare(virConnectPtr dconn, char **cookie, int *cookielen, const char *uri_in, char **uri_out, unsigned long flags, const char *dname, unsigned long resource) { int rv = -1; remote_domain_migrate_prepare_args args; remote_domain_migrate_prepare_ret ret; struct private_data *priv = dconn->privateData; remoteDriverLock(priv); args.uri_in = uri_in == NULL ? NULL : (char **) &uri_in; args.flags = flags; args.dname = dname == NULL ? NULL : (char **) &dname; args.resource = resource; memset(&ret, 0, sizeof(ret)); if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE, (xdrproc_t) xdr_remote_domain_migrate_prepare_args, (char *) &args, (xdrproc_t) xdr_remote_domain_migrate_prepare_ret, (char *) &ret) == -1) goto done; if (ret.cookie.cookie_len > 0) { *cookie = ret.cookie.cookie_val; /* Caller frees. */ *cookielen = ret.cookie.cookie_len; } if (ret.uri_out) *uri_out = *ret.uri_out; /* Caller frees. */ VIR_FREE(ret.uri_out); rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteDomainMigratePrepare2(virConnectPtr dconn, char **cookie, int *cookielen, const char *uri_in, char **uri_out, unsigned long flags, const char *dname, unsigned long resource, const char *dom_xml) { int rv = -1; remote_domain_migrate_prepare2_args args; remote_domain_migrate_prepare2_ret ret; struct private_data *priv = dconn->privateData; remoteDriverLock(priv); args.uri_in = uri_in == NULL ? NULL : (char **) &uri_in; args.flags = flags; args.dname = dname == NULL ? NULL : (char **) &dname; args.resource = resource; args.dom_xml = (char *) dom_xml; memset(&ret, 0, sizeof(ret)); if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2, (xdrproc_t) xdr_remote_domain_migrate_prepare2_args, (char *) &args, (xdrproc_t) xdr_remote_domain_migrate_prepare2_ret, (char *) &ret) == -1) goto done; if (ret.cookie.cookie_len > 0) { if (!cookie || !cookielen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores cookie or cookielen")); goto error; } *cookie = ret.cookie.cookie_val; /* Caller frees. */ *cookielen = ret.cookie.cookie_len; } if (ret.uri_out) { if (!uri_out) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores uri_out")); goto error; } *uri_out = *ret.uri_out; /* Caller frees. */ } rv = 0; done: VIR_FREE(ret.uri_out); remoteDriverUnlock(priv); return rv; error: if (ret.cookie.cookie_len) VIR_FREE(ret.cookie.cookie_val); if (ret.uri_out) VIR_FREE(*ret.uri_out); goto done; } static int remoteDomainCreate(virDomainPtr domain) { int rv = -1; remote_domain_create_args args; remote_domain_lookup_by_uuid_args args2; remote_domain_lookup_by_uuid_ret ret2; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_CREATE, (xdrproc_t) xdr_remote_domain_create_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; /* Need to do a lookup figure out ID of newly started guest, because * bug in design of REMOTE_PROC_DOMAIN_CREATE means we aren't getting * it returned. */ memcpy(args2.uuid, domain->uuid, VIR_UUID_BUFLEN); memset(&ret2, 0, sizeof(ret2)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID, (xdrproc_t) xdr_remote_domain_lookup_by_uuid_args, (char *) &args2, (xdrproc_t) xdr_remote_domain_lookup_by_uuid_ret, (char *) &ret2) == -1) goto done; domain->id = ret2.dom.id; xdr_free((xdrproc_t) &xdr_remote_domain_lookup_by_uuid_ret, (char *) &ret2); rv = 0; done: remoteDriverUnlock(priv); return rv; } static char * remoteDomainGetSchedulerType(virDomainPtr domain, int *nparams) { char *rv = NULL; remote_domain_get_scheduler_type_args args; remote_domain_get_scheduler_type_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE, (xdrproc_t) xdr_remote_domain_get_scheduler_type_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_scheduler_type_ret, (char *) &ret) == -1) goto done; if (nparams) *nparams = ret.nparams; /* Caller frees this. */ rv = ret.type; done: remoteDriverUnlock(priv); return rv; } static int remoteDomainMemoryStats(virDomainPtr domain, virDomainMemoryStatPtr stats, unsigned int nr_stats, unsigned int flags) { int rv = -1; remote_domain_memory_stats_args args; remote_domain_memory_stats_ret ret; struct private_data *priv = domain->conn->privateData; size_t i; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); if (nr_stats > REMOTE_DOMAIN_MEMORY_STATS_MAX) { virReportError(VIR_ERR_RPC, _("too many memory stats requested: %d > %d"), nr_stats, REMOTE_DOMAIN_MEMORY_STATS_MAX); goto done; } args.maxStats = nr_stats; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MEMORY_STATS, (xdrproc_t) xdr_remote_domain_memory_stats_args, (char *) &args, (xdrproc_t) xdr_remote_domain_memory_stats_ret, (char *) &ret) == -1) goto done; for (i = 0; i < ret.stats.stats_len; i++) { stats[i].tag = ret.stats.stats_val[i].tag; stats[i].val = ret.stats.stats_val[i].val; } rv = ret.stats.stats_len; xdr_free((xdrproc_t) xdr_remote_domain_memory_stats_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainBlockPeek(virDomainPtr domain, const char *path, unsigned long long offset, size_t size, void *buffer, unsigned int flags) { int rv = -1; remote_domain_block_peek_args args; remote_domain_block_peek_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); if (size > REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX) { virReportError(VIR_ERR_RPC, _("block peek request too large for remote protocol, %zi > %d"), size, REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX); goto done; } make_nonnull_domain(&args.dom, domain); args.path = (char *) path; args.offset = offset; args.size = size; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_PEEK, (xdrproc_t) xdr_remote_domain_block_peek_args, (char *) &args, (xdrproc_t) xdr_remote_domain_block_peek_ret, (char *) &ret) == -1) goto done; if (ret.buffer.buffer_len != size) { virReportError(VIR_ERR_RPC, "%s", _("returned buffer is not same size as requested")); goto cleanup; } memcpy(buffer, ret.buffer.buffer_val, size); rv = 0; cleanup: VIR_FREE(ret.buffer.buffer_val); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainMemoryPeek(virDomainPtr domain, unsigned long long offset, size_t size, void *buffer, unsigned int flags) { int rv = -1; remote_domain_memory_peek_args args; remote_domain_memory_peek_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); if (size > REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX) { virReportError(VIR_ERR_RPC, _("memory peek request too large for remote protocol, %zi > %d"), size, REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX); goto done; } make_nonnull_domain(&args.dom, domain); args.offset = offset; args.size = size; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MEMORY_PEEK, (xdrproc_t) xdr_remote_domain_memory_peek_args, (char *) &args, (xdrproc_t) xdr_remote_domain_memory_peek_ret, (char *) &ret) == -1) goto done; if (ret.buffer.buffer_len != size) { virReportError(VIR_ERR_RPC, "%s", _("returned buffer is not same size as requested")); goto cleanup; } memcpy(buffer, ret.buffer.buffer_val, size); rv = 0; cleanup: VIR_FREE(ret.buffer.buffer_val); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetBlockJobInfo(virDomainPtr domain, const char *path, virDomainBlockJobInfoPtr info, unsigned int flags) { int rv = -1; remote_domain_get_block_job_info_args args; remote_domain_get_block_job_info_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.path = (char *)path; args.flags = flags; if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLOCK_JOB_INFO, (xdrproc_t)xdr_remote_domain_get_block_job_info_args, (char *)&args, (xdrproc_t)xdr_remote_domain_get_block_job_info_ret, (char *)&ret) == -1) goto done; if (ret.found) { info->type = ret.type; info->bandwidth = ret.bandwidth; info->cur = ret.cur; info->end = ret.end; rv = 1; } else { rv = 0; } done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetBlockIoTune(virDomainPtr domain, const char *disk, virTypedParameterPtr params, int *nparams, unsigned int flags) { int rv = -1; remote_domain_get_block_io_tune_args args; remote_domain_get_block_io_tune_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.disk = disk ? (char **)&disk : NULL; args.nparams = *nparams; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLOCK_IO_TUNE, (xdrproc_t) xdr_remote_domain_get_block_io_tune_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_block_io_tune_ret, (char *) &ret) == -1) { goto done; } /* Handle the case when the caller does not know the number of parameters * and is asking for the number of parameters supported */ if (*nparams == 0) { *nparams = ret.nparams; rv = 0; goto cleanup; } if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_DOMAIN_BLOCK_IO_TUNE_PARAMETERS_MAX, &params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_block_io_tune_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetCPUStats(virDomainPtr domain, virTypedParameterPtr params, unsigned int nparams, int start_cpu, unsigned int ncpus, unsigned int flags) { struct private_data *priv = domain->conn->privateData; remote_domain_get_cpu_stats_args args; remote_domain_get_cpu_stats_ret ret; int rv = -1; int cpu; remoteDriverLock(priv); if (nparams > REMOTE_NODE_CPU_STATS_MAX) { virReportError(VIR_ERR_RPC, _("nparams count exceeds maximum: %u > %u"), nparams, REMOTE_NODE_CPU_STATS_MAX); goto done; } if (ncpus > REMOTE_DOMAIN_GET_CPU_STATS_NCPUS_MAX) { virReportError(VIR_ERR_RPC, _("ncpus count exceeds maximum: %u > %u"), ncpus, REMOTE_DOMAIN_GET_CPU_STATS_NCPUS_MAX); goto done; } make_nonnull_domain(&args.dom, domain); args.nparams = nparams; args.start_cpu = start_cpu; args.ncpus = ncpus; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_CPU_STATS, (xdrproc_t) xdr_remote_domain_get_cpu_stats_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_cpu_stats_ret, (char *) &ret) == -1) goto done; /* Check the length of the returned list carefully. */ if (ret.params.params_len > nparams * ncpus || (ret.params.params_len && ((ret.params.params_len % ret.nparams) || ret.nparams > nparams))) { virReportError(VIR_ERR_RPC, "%s", _("remoteDomainGetCPUStats: " "returned number of stats exceeds limit")); memset(params, 0, sizeof(*params) * nparams * ncpus); goto cleanup; } /* Handle the case when the caller does not know the number of stats * and is asking for the number of stats supported */ if (nparams == 0) { rv = ret.nparams; goto cleanup; } /* The remote side did not send back any zero entries, so we have * to expand things back into a possibly sparse array, where the * tail of the array may be omitted. */ memset(params, 0, sizeof(*params) * nparams * ncpus); ncpus = ret.params.params_len / ret.nparams; for (cpu = 0; cpu < ncpus; cpu++) { int tmp = nparams; virTypedParameterPtr cpu_params = &params[cpu * nparams]; remote_typed_param *stride = &ret.params.params_val[cpu * ret.nparams]; if (virTypedParamsDeserialize((virTypedParameterRemotePtr) stride, ret.nparams, REMOTE_NODE_CPU_STATS_MAX, &cpu_params, &tmp) < 0) goto cleanup; } rv = ret.nparams; cleanup: if (rv < 0) virTypedParamsClear(params, nparams * ncpus); xdr_free((xdrproc_t) xdr_remote_domain_get_cpu_stats_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteConnectNetworkEventRegisterAny(virConnectPtr conn, virNetworkPtr net, int eventID, virConnectNetworkEventGenericCallback callback, void *opaque, virFreeCallback freecb) { int rv = -1; struct private_data *priv = conn->privateData; remote_connect_network_event_register_any_args args; remote_connect_network_event_register_any_ret ret; int callbackID; int count; remote_nonnull_network network; remoteDriverLock(priv); if ((count = virNetworkEventStateRegisterClient(conn, priv->eventState, net, eventID, callback, opaque, freecb, &callbackID)) < 0) goto done; /* If this is the first callback for this eventID, we need to enable * events on the server */ if (count == 1) { args.eventID = eventID; if (net) { make_nonnull_network(&network, net); args.net = &network; } else { args.net = NULL; } memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_NETWORK_EVENT_REGISTER_ANY, (xdrproc_t) xdr_remote_connect_network_event_register_any_args, (char *) &args, (xdrproc_t) xdr_remote_connect_network_event_register_any_ret, (char *) &ret) == -1) { virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, false); goto done; } virObjectEventStateSetRemote(conn, priv->eventState, callbackID, ret.callbackID); } rv = callbackID; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectNetworkEventDeregisterAny(virConnectPtr conn, int callbackID) { struct private_data *priv = conn->privateData; int rv = -1; remote_connect_network_event_deregister_any_args args; int eventID; int remoteID; int count; remoteDriverLock(priv); if ((eventID = virObjectEventStateEventID(conn, priv->eventState, callbackID, &remoteID)) < 0) goto done; if ((count = virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, true)) < 0) goto done; /* If that was the last callback for this eventID, we need to disable * events on the server */ if (count == 0) { args.callbackID = remoteID; if (call(conn, priv, 0, REMOTE_PROC_CONNECT_NETWORK_EVENT_DEREGISTER_ANY, (xdrproc_t) xdr_remote_connect_network_event_deregister_any_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; } rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectStoragePoolEventRegisterAny(virConnectPtr conn, virStoragePoolPtr pool, int eventID, virConnectStoragePoolEventGenericCallback callback, void *opaque, virFreeCallback freecb) { int rv = -1; struct private_data *priv = conn->privateData; remote_connect_storage_pool_event_register_any_args args; remote_connect_storage_pool_event_register_any_ret ret; int callbackID; int count; remote_nonnull_storage_pool storage_pool; remoteDriverLock(priv); if ((count = virStoragePoolEventStateRegisterClient(conn, priv->eventState, pool, eventID, callback, opaque, freecb, &callbackID)) < 0) goto done; /* If this is the first callback for this eventID, we need to enable * events on the server */ if (count == 1) { args.eventID = eventID; if (pool) { make_nonnull_storage_pool(&storage_pool, pool); args.pool = &storage_pool; } else { args.pool = NULL; } memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_REGISTER_ANY, (xdrproc_t) xdr_remote_connect_storage_pool_event_register_any_args, (char *) &args, (xdrproc_t) xdr_remote_connect_storage_pool_event_register_any_ret, (char *) &ret) == -1) { virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, false); goto done; } virObjectEventStateSetRemote(conn, priv->eventState, callbackID, ret.callbackID); } rv = callbackID; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectStoragePoolEventDeregisterAny(virConnectPtr conn, int callbackID) { struct private_data *priv = conn->privateData; int rv = -1; remote_connect_storage_pool_event_deregister_any_args args; int eventID; int remoteID; int count; remoteDriverLock(priv); if ((eventID = virObjectEventStateEventID(conn, priv->eventState, callbackID, &remoteID)) < 0) goto done; if ((count = virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, true)) < 0) goto done; /* If that was the last callback for this eventID, we need to disable * events on the server */ if (count == 0) { args.callbackID = remoteID; if (call(conn, priv, 0, REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_DEREGISTER_ANY, (xdrproc_t) xdr_remote_connect_storage_pool_event_deregister_any_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; } rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectNodeDeviceEventRegisterAny(virConnectPtr conn, virNodeDevicePtr dev, int eventID, virConnectNodeDeviceEventGenericCallback callback, void *opaque, virFreeCallback freecb) { int rv = -1; struct private_data *priv = conn->privateData; remote_connect_node_device_event_register_any_args args; remote_connect_node_device_event_register_any_ret ret; int callbackID; int count; remote_nonnull_node_device node_device; remoteDriverLock(priv); if ((count = virNodeDeviceEventStateRegisterClient(conn, priv->eventState, dev, eventID, callback, opaque, freecb, &callbackID)) < 0) goto done; /* If this is the first callback for this eventID, we need to enable * events on the server */ if (count == 1) { args.eventID = eventID; if (dev) { make_nonnull_node_device(&node_device, dev); args.dev = &node_device; } else { args.dev = NULL; } memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_NODE_DEVICE_EVENT_REGISTER_ANY, (xdrproc_t) xdr_remote_connect_node_device_event_register_any_args, (char *) &args, (xdrproc_t) xdr_remote_connect_node_device_event_register_any_ret, (char *) &ret) == -1) { virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, false); goto done; } virObjectEventStateSetRemote(conn, priv->eventState, callbackID, ret.callbackID); } rv = callbackID; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectNodeDeviceEventDeregisterAny(virConnectPtr conn, int callbackID) { struct private_data *priv = conn->privateData; int rv = -1; remote_connect_node_device_event_deregister_any_args args; int eventID; int remoteID; int count; remoteDriverLock(priv); if ((eventID = virObjectEventStateEventID(conn, priv->eventState, callbackID, &remoteID)) < 0) goto done; if ((count = virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, true)) < 0) goto done; /* If that was the last callback for this eventID, we need to disable * events on the server */ if (count == 0) { args.callbackID = remoteID; if (call(conn, priv, 0, REMOTE_PROC_CONNECT_NODE_DEVICE_EVENT_DEREGISTER_ANY, (xdrproc_t) xdr_remote_connect_node_device_event_deregister_any_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; } rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectSecretEventRegisterAny(virConnectPtr conn, virSecretPtr secret, int eventID, virConnectSecretEventGenericCallback callback, void *opaque, virFreeCallback freecb) { int rv = -1; struct private_data *priv = conn->privateData; remote_connect_secret_event_register_any_args args; remote_connect_secret_event_register_any_ret ret; int callbackID; int count; remote_nonnull_secret sec; remoteDriverLock(priv); if ((count = virSecretEventStateRegisterClient(conn, priv->eventState, secret, eventID, callback, opaque, freecb, &callbackID)) < 0) goto done; /* If this is the first callback for this eventID, we need to enable * events on the server */ if (count == 1) { args.eventID = eventID; if (secret) { make_nonnull_secret(&sec, secret); args.secret = &sec; } else { args.secret = NULL; } memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_SECRET_EVENT_REGISTER_ANY, (xdrproc_t) xdr_remote_connect_secret_event_register_any_args, (char *) &args, (xdrproc_t) xdr_remote_connect_secret_event_register_any_ret, (char *) &ret) == -1) { virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, false); goto done; } virObjectEventStateSetRemote(conn, priv->eventState, callbackID, ret.callbackID); } rv = callbackID; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectSecretEventDeregisterAny(virConnectPtr conn, int callbackID) { struct private_data *priv = conn->privateData; int rv = -1; remote_connect_secret_event_deregister_any_args args; int eventID; int remoteID; int count; remoteDriverLock(priv); if ((eventID = virObjectEventStateEventID(conn, priv->eventState, callbackID, &remoteID)) < 0) goto done; if ((count = virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, true)) < 0) goto done; /* If that was the last callback for this eventID, we need to disable * events on the server */ if (count == 0) { args.callbackID = remoteID; if (call(conn, priv, 0, REMOTE_PROC_CONNECT_SECRET_EVENT_DEREGISTER_ANY, (xdrproc_t) xdr_remote_connect_secret_event_deregister_any_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; } rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectDomainQemuMonitorEventRegister(virConnectPtr conn, virDomainPtr dom, const char *event, virConnectDomainQemuMonitorEventCallback callback, void *opaque, virFreeCallback freecb, unsigned int flags) { int rv = -1; struct private_data *priv = conn->privateData; qemu_connect_domain_monitor_event_register_args args; qemu_connect_domain_monitor_event_register_ret ret; int callbackID; int count; remote_nonnull_domain domain; remoteDriverLock(priv); if ((count = virDomainQemuMonitorEventStateRegisterID(conn, priv->eventState, dom, event, callback, opaque, freecb, -1, &callbackID)) < 0) goto done; /* If this is the first callback for this event, we need to enable * events on the server */ if (count == 1) { if (dom) { make_nonnull_domain(&domain, dom); args.dom = &domain; } else { args.dom = NULL; } args.event = event ? (char **) &event : NULL; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, REMOTE_CALL_QEMU, QEMU_PROC_CONNECT_DOMAIN_MONITOR_EVENT_REGISTER, (xdrproc_t) xdr_qemu_connect_domain_monitor_event_register_args, (char *) &args, (xdrproc_t) xdr_qemu_connect_domain_monitor_event_register_ret, (char *) &ret) == -1) { virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, false); goto done; } virObjectEventStateSetRemote(conn, priv->eventState, callbackID, ret.callbackID); } rv = callbackID; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectDomainQemuMonitorEventDeregister(virConnectPtr conn, int callbackID) { struct private_data *priv = conn->privateData; int rv = -1; qemu_connect_domain_monitor_event_deregister_args args; int remoteID; int count; remoteDriverLock(priv); if (virObjectEventStateEventID(conn, priv->eventState, callbackID, &remoteID) < 0) goto done; if ((count = virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, true)) < 0) goto done; /* If that was the last callback for this event, we need to disable * events on the server */ if (count == 0) { args.callbackID = remoteID; if (call(conn, priv, REMOTE_CALL_QEMU, QEMU_PROC_CONNECT_DOMAIN_MONITOR_EVENT_DEREGISTER, (xdrproc_t) xdr_qemu_connect_domain_monitor_event_deregister_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; } rv = 0; done: remoteDriverUnlock(priv); return rv; } /*----------------------------------------------------------------------*/ static char * remoteConnectFindStoragePoolSources(virConnectPtr conn, const char *type, const char *srcSpec, unsigned int flags) { char *rv = NULL; remote_connect_find_storage_pool_sources_args args; remote_connect_find_storage_pool_sources_ret ret; struct private_data *priv = conn->privateData; remoteDriverLock(priv); args.type = (char*)type; args.srcSpec = srcSpec ? (char **)&srcSpec : NULL; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_FIND_STORAGE_POOL_SOURCES, (xdrproc_t) xdr_remote_connect_find_storage_pool_sources_args, (char *) &args, (xdrproc_t) xdr_remote_connect_find_storage_pool_sources_ret, (char *) &ret) == -1) goto done; rv = ret.xml; ret.xml = NULL; /* To stop xdr_free free'ing it */ xdr_free((xdrproc_t) xdr_remote_connect_find_storage_pool_sources_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } /*----------------------------------------------------------------------*/ static int remoteNodeDeviceDettach(virNodeDevicePtr dev) { int rv = -1; remote_node_device_dettach_args args; struct private_data *priv = dev->conn->privateData; remoteDriverLock(priv); args.name = dev->name; if (call(dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_DETTACH, (xdrproc_t) xdr_remote_node_device_dettach_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteNodeDeviceDetachFlags(virNodeDevicePtr dev, const char *driverName, unsigned int flags) { int rv = -1; remote_node_device_detach_flags_args args; struct private_data *priv = dev->conn->privateData; remoteDriverLock(priv); args.name = dev->name; args.driverName = driverName ? (char**)&driverName : NULL; args.flags = flags; if (call(dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS, (xdrproc_t) xdr_remote_node_device_detach_flags_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteNodeDeviceReAttach(virNodeDevicePtr dev) { int rv = -1; remote_node_device_re_attach_args args; struct private_data *priv = dev->conn->privateData; remoteDriverLock(priv); args.name = dev->name; if (call(dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_RE_ATTACH, (xdrproc_t) xdr_remote_node_device_re_attach_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteNodeDeviceReset(virNodeDevicePtr dev) { int rv = -1; remote_node_device_reset_args args; /* This method is unusual in that it uses the HV driver, not the devMon driver * hence its use of privateData, instead of nodeDevicePrivateData */ struct private_data *priv = dev->conn->privateData; remoteDriverLock(priv); args.name = dev->name; if (call(dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_RESET, (xdrproc_t) xdr_remote_node_device_reset_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; rv = 0; done: remoteDriverUnlock(priv); return rv; } /*----------------------------------------------------------------------*/ static int remoteAuthenticate(virConnectPtr conn, struct private_data *priv, virConnectAuthPtr auth G_GNUC_UNUSED, const char *authtype) { struct remote_auth_list_ret ret; int err, type = REMOTE_AUTH_NONE; memset(&ret, 0, sizeof(ret)); err = call(conn, priv, 0, REMOTE_PROC_AUTH_LIST, (xdrproc_t) xdr_void, (char *) NULL, (xdrproc_t) xdr_remote_auth_list_ret, (char *) &ret); if (err < 0) { if (virGetLastErrorCode() == VIR_ERR_NO_SUPPORT) { /* Missing RPC - old server - ignore */ virResetLastError(); return 0; } return -1; } if (ret.types.types_len == 0) return 0; if (authtype) { int want; size_t i; if (STRCASEEQ(authtype, "sasl") || STRCASEEQLEN(authtype, "sasl.", 5)) { want = REMOTE_AUTH_SASL; } else if (STRCASEEQ(authtype, "polkit")) { want = REMOTE_AUTH_POLKIT; } else { virReportError(VIR_ERR_AUTH_FAILED, _("unknown authentication type %s"), authtype); return -1; } for (i = 0; i < ret.types.types_len; i++) { if (ret.types.types_val[i] == want) type = want; } if (type == REMOTE_AUTH_NONE) { virReportError(VIR_ERR_AUTH_FAILED, _("requested authentication type %s rejected"), authtype); return -1; } } else { type = ret.types.types_val[0]; } switch (type) { #if WITH_SASL case REMOTE_AUTH_SASL: { const char *mech = NULL; if (authtype && STRCASEEQLEN(authtype, "sasl.", 5)) mech = authtype + 5; if (remoteAuthSASL(conn, priv, auth, mech) < 0) { VIR_FREE(ret.types.types_val); return -1; } break; } #endif case REMOTE_AUTH_POLKIT: if (remoteAuthPolkit(conn, priv, auth) < 0) { VIR_FREE(ret.types.types_val); return -1; } break; case REMOTE_AUTH_NONE: /* Nothing todo, hurrah ! */ break; default: virReportError(VIR_ERR_AUTH_FAILED, _("unsupported authentication type %d"), ret.types.types_val[0]); VIR_FREE(ret.types.types_val); return -1; } VIR_FREE(ret.types.types_val); return 0; } #if WITH_SASL static int remoteAuthCredVir2SASL(int vircred) { switch (vircred) { case VIR_CRED_USERNAME: return SASL_CB_USER; case VIR_CRED_AUTHNAME: return SASL_CB_AUTHNAME; case VIR_CRED_LANGUAGE: return SASL_CB_LANGUAGE; case VIR_CRED_CNONCE: return SASL_CB_CNONCE; case VIR_CRED_PASSPHRASE: return SASL_CB_PASS; case VIR_CRED_ECHOPROMPT: return SASL_CB_ECHOPROMPT; case VIR_CRED_NOECHOPROMPT: return SASL_CB_NOECHOPROMPT; case VIR_CRED_REALM: return SASL_CB_GETREALM; } return 0; } static int remoteAuthCredSASL2Vir(int vircred) { switch (vircred) { case SASL_CB_USER: return VIR_CRED_USERNAME; case SASL_CB_AUTHNAME: return VIR_CRED_AUTHNAME; case SASL_CB_LANGUAGE: return VIR_CRED_LANGUAGE; case SASL_CB_CNONCE: return VIR_CRED_CNONCE; case SASL_CB_PASS: return VIR_CRED_PASSPHRASE; case SASL_CB_ECHOPROMPT: return VIR_CRED_ECHOPROMPT; case SASL_CB_NOECHOPROMPT: return VIR_CRED_NOECHOPROMPT; case SASL_CB_GETREALM: return VIR_CRED_REALM; } return 0; } /* * @param credtype array of credential types client supports * @param ncredtype size of credtype array * @return the SASL callback structure, or NULL on error * * Build up the SASL callback structure. We register one callback for * each credential type that the libvirt client indicated they support. * We explicitly leave the callback function pointer at NULL though, * because we don't actually want to get SASL callbacks triggered. * Instead, we want the start/step functions to return SASL_INTERACT. * This lets us give the libvirt client a list of all required * credentials in one go, rather than triggering the callback one * credential at a time, */ static sasl_callback_t *remoteAuthMakeCallbacks(int *credtype, int ncredtype) { sasl_callback_t *cbs; size_t i; int n; if (VIR_ALLOC_N(cbs, ncredtype+1) < 0) return NULL; for (i = 0, n = 0; i < ncredtype; i++) { int id = remoteAuthCredVir2SASL(credtype[i]); if (id != 0) cbs[n++].id = id; /* Don't fill proc or context fields of sasl_callback_t * because we want to use interactions instead */ } cbs[n].id = 0; return cbs; } /* * @param interact SASL interactions required * @param cred populated with libvirt credential metadata * @return the size of the cred array returned * * Builds up an array of libvirt credential structs, populating * with data from the SASL interaction struct. These two structs * are basically a 1-to-1 copy of each other. */ static int remoteAuthMakeCredentials(sasl_interact_t *interact, virConnectCredentialPtr *cred, size_t *ncred) { int ninteract; if (!cred) return -1; for (ninteract = 0, *ncred = 0; interact[ninteract].id != 0; ninteract++) { if (interact[ninteract].result) continue; (*ncred)++; } if (VIR_ALLOC_N(*cred, *ncred) < 0) return -1; for (ninteract = 0, *ncred = 0; interact[ninteract].id != 0; ninteract++) { if (interact[ninteract].result) continue; (*cred)[*ncred].type = remoteAuthCredSASL2Vir(interact[ninteract].id); if (!(*cred)[*ncred].type) { *ncred = 0; VIR_FREE(*cred); return -1; } if (interact[*ncred].challenge) (*cred)[*ncred].challenge = interact[ninteract].challenge; (*cred)[*ncred].prompt = interact[ninteract].prompt; if (interact[*ncred].defresult) (*cred)[*ncred].defresult = interact[ninteract].defresult; (*cred)[*ncred].result = NULL; (*ncred)++; } return 0; } /* * @param cred the populated libvirt credentials * @param interact the SASL interactions to fill in results for * * Fills the SASL interactions with the result from the libvirt * callbacks */ static void remoteAuthFillInteract(virConnectCredentialPtr cred, sasl_interact_t *interact) { int ninteract, ncred; for (ninteract = 0, ncred = 0; interact[ninteract].id != 0; ninteract++) { if (interact[ninteract].result) continue; interact[ninteract].result = cred[ncred].result; interact[ninteract].len = cred[ncred].resultlen; ncred++; } } struct remoteAuthInteractState { sasl_interact_t *interact; virConnectCredentialPtr cred; size_t ncred; virAuthConfigPtr config; }; static int remoteAuthFillFromConfig(virConnectPtr conn, struct remoteAuthInteractState *state) { int ret = -1; int ninteract; const char *credname; char *path = NULL; VIR_DEBUG("Trying to fill auth parameters from config file"); if (!state->config) { if (virAuthGetConfigFilePath(conn, &path) < 0) goto cleanup; if (path == NULL) { ret = 0; goto cleanup; } if (!(state->config = virAuthConfigNew(path))) goto cleanup; } for (ninteract = 0; state->interact[ninteract].id != 0; ninteract++) { const char *value = NULL; switch (state->interact[ninteract].id) { case SASL_CB_USER: credname = "username"; break; case SASL_CB_AUTHNAME: credname = "authname"; break; case SASL_CB_PASS: credname = "password"; break; case SASL_CB_GETREALM: credname = "realm"; break; default: credname = NULL; break; } if (credname && virAuthConfigLookup(state->config, "libvirt", VIR_URI_SERVER(conn->uri), credname, &value) < 0) goto cleanup; if (value) { state->interact[ninteract].result = value; state->interact[ninteract].len = strlen(value); } } ret = 0; cleanup: VIR_FREE(path); return ret; } static void remoteAuthInteractStateClear(struct remoteAuthInteractState *state, bool final) { size_t i; if (!state) return; for (i = 0; i < state->ncred; i++) VIR_FREE(state->cred[i].result); VIR_FREE(state->cred); state->ncred = 0; if (final) virAuthConfigFree(state->config); } static int remoteAuthInteract(virConnectPtr conn, struct remoteAuthInteractState *state, virConnectAuthPtr auth) { VIR_DEBUG("Starting SASL interaction"); remoteAuthInteractStateClear(state, false); /* Fills state->interact with any values from the auth config file */ if (remoteAuthFillFromConfig(conn, state) < 0) return -1; /* Populates state->cred for anything not found in the auth config */ if (remoteAuthMakeCredentials(state->interact, &state->cred, &state->ncred) < 0) { virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Failed to make auth credentials")); return -1; } /* If there was anything not in the auth config, we need to * run the interactive callback */ if (state->ncred) { /* Run the authentication callback */ if (!auth || !auth->cb) { virReportError(VIR_ERR_AUTH_FAILED, "%s", _("No authentication callback available")); return -1; } if ((*(auth->cb))(state->cred, state->ncred, auth->cbdata) < 0) { virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Failed to collect auth credentials")); return -1; } /* Copy user's responses from cred into interact */ remoteAuthFillInteract(state->cred, state->interact); } /* * 'interact' now has pointers to strings in 'state->cred' * so we must not free state->cred until the *next* * sasl_start/step function is complete. Hence we * call remoteAuthInteractStateClear() at the *start* * of this method, rather than the end. */ return 0; } /* Perform the SASL authentication process */ static int remoteAuthSASL(virConnectPtr conn, struct private_data *priv, virConnectAuthPtr auth, const char *wantmech) { remote_auth_sasl_init_ret iret; remote_auth_sasl_start_args sargs; remote_auth_sasl_start_ret sret; remote_auth_sasl_step_args pargs; remote_auth_sasl_step_ret pret; const char *clientout; char *serverin = NULL; size_t clientoutlen, serverinlen; const char *mech; int err, complete; int ssf; sasl_callback_t *saslcb = NULL; int ret = -1; const char *mechlist; virNetSASLContextPtr saslCtxt; virNetSASLSessionPtr sasl = NULL; struct remoteAuthInteractState state; memset(&state, 0, sizeof(state)); VIR_DEBUG("Client initialize SASL authentication"); if (!(saslCtxt = virNetSASLContextNewClient())) goto cleanup; if (auth) { if ((saslcb = remoteAuthMakeCallbacks(auth->credtype, auth->ncredtype)) == NULL) goto cleanup; } else { saslcb = NULL; } /* Setup a handle for being a client */ if (!(sasl = virNetSASLSessionNewClient(saslCtxt, "libvirt", priv->hostname, virNetClientLocalAddrStringSASL(priv->client), virNetClientRemoteAddrStringSASL(priv->client), saslcb))) goto cleanup; /* saslcb is now owned by sasl */ saslcb = NULL; # ifdef WITH_GNUTLS /* Initialize some connection props we care about */ if (priv->tls) { if ((ssf = virNetClientGetTLSKeySize(priv->client)) < 0) goto cleanup; ssf *= 8; /* key size is bytes, sasl wants bits */ VIR_DEBUG("Setting external SSF %d", ssf); if (virNetSASLSessionExtKeySize(sasl, ssf) < 0) goto cleanup; } # endif /* If we've got a secure channel (TLS or UNIX sock), we don't care about SSF */ /* If we're not secure, then forbid any anonymous or trivially crackable auth */ if (virNetSASLSessionSecProps(sasl, priv->is_secure ? 0 : 56, /* Equiv to DES supported by all Kerberos */ priv->is_secure ? 0 : 100000, /* Very strong ! AES == 256 */ priv->is_secure ? true : false) < 0) goto cleanup; /* First call is to inquire about supported mechanisms in the server */ memset(&iret, 0, sizeof(iret)); if (call(conn, priv, 0, REMOTE_PROC_AUTH_SASL_INIT, (xdrproc_t) xdr_void, (char *)NULL, (xdrproc_t) xdr_remote_auth_sasl_init_ret, (char *) &iret) != 0) goto cleanup; mechlist = iret.mechlist; if (wantmech) { if (strstr(mechlist, wantmech) == NULL) { virReportError(VIR_ERR_AUTH_FAILED, _("SASL mechanism %s not supported by server"), wantmech); VIR_FREE(iret.mechlist); goto cleanup; } mechlist = wantmech; } restart: /* Start the auth negotiation on the client end first */ VIR_DEBUG("Client start negotiation mechlist '%s'", mechlist); if ((err = virNetSASLSessionClientStart(sasl, mechlist, &state.interact, &clientout, &clientoutlen, &mech)) < 0) goto cleanup; /* Need to gather some credentials from the client */ if (err == VIR_NET_SASL_INTERACT) { if (remoteAuthInteract(conn, &state, auth) < 0) { VIR_FREE(iret.mechlist); goto cleanup; } goto restart; } VIR_FREE(iret.mechlist); if (clientoutlen > REMOTE_AUTH_SASL_DATA_MAX) { virReportError(VIR_ERR_AUTH_FAILED, _("SASL negotiation data too long: %zu bytes"), clientoutlen); goto cleanup; } /* NB, distinction of NULL vs "" is *critical* in SASL */ memset(&sargs, 0, sizeof(sargs)); sargs.nil = clientout ? 0 : 1; sargs.data.data_val = (char*)clientout; sargs.data.data_len = clientoutlen; sargs.mech = (char*)mech; VIR_DEBUG("Server start negotiation with mech %s. Data %zu bytes %p", mech, clientoutlen, clientout); /* Now send the initial auth data to the server */ memset(&sret, 0, sizeof(sret)); if (call(conn, priv, 0, REMOTE_PROC_AUTH_SASL_START, (xdrproc_t) xdr_remote_auth_sasl_start_args, (char *) &sargs, (xdrproc_t) xdr_remote_auth_sasl_start_ret, (char *) &sret) != 0) goto cleanup; complete = sret.complete; /* NB, distinction of NULL vs "" is *critical* in SASL */ serverin = sret.nil ? NULL : sret.data.data_val; serverinlen = sret.data.data_len; VIR_DEBUG("Client step result complete: %d. Data %zu bytes %p", complete, serverinlen, serverin); /* Previous server call showed completion & sasl_client_start() told us * we are locally complete too */ if (complete && err == VIR_NET_SASL_COMPLETE) goto done; /* Loop-the-loop... * Even if the server has completed, the client must *always* do at least one step * in this loop to verify the server isn't lying about something. Mutual auth */ for (;;) { if ((err = virNetSASLSessionClientStep(sasl, serverin, serverinlen, &state.interact, &clientout, &clientoutlen)) < 0) goto cleanup; /* Need to gather some credentials from the client */ if (err == VIR_NET_SASL_INTERACT) { if (remoteAuthInteract(conn, &state, auth) < 0) { VIR_FREE(iret.mechlist); goto cleanup; } continue; } VIR_FREE(serverin); VIR_DEBUG("Client step result %d. Data %zu bytes %p", err, clientoutlen, clientout); /* Previous server call showed completion & we're now locally complete too */ if (complete && err == VIR_NET_SASL_COMPLETE) break; /* Not done, prepare to talk with the server for another iteration */ /* NB, distinction of NULL vs "" is *critical* in SASL */ memset(&pargs, 0, sizeof(pargs)); pargs.nil = clientout ? 0 : 1; pargs.data.data_val = (char*)clientout; pargs.data.data_len = clientoutlen; VIR_DEBUG("Server step with %zu bytes %p", clientoutlen, clientout); memset(&pret, 0, sizeof(pret)); if (call(conn, priv, 0, REMOTE_PROC_AUTH_SASL_STEP, (xdrproc_t) xdr_remote_auth_sasl_step_args, (char *) &pargs, (xdrproc_t) xdr_remote_auth_sasl_step_ret, (char *) &pret) != 0) goto cleanup; complete = pret.complete; /* NB, distinction of NULL vs "" is *critical* in SASL */ serverin = pret.nil ? NULL : pret.data.data_val; serverinlen = pret.data.data_len; VIR_DEBUG("Client step result complete: %d. Data %zu bytes %p", complete, serverinlen, serverin); /* This server call shows complete, and earlier client step was OK */ if (complete && err == VIR_NET_SASL_COMPLETE) { VIR_FREE(serverin); break; } } /* Check for suitable SSF if not already secure (TLS or UNIX sock) */ if (!priv->is_secure) { if ((ssf = virNetSASLSessionGetKeySize(sasl)) < 0) goto cleanup; VIR_DEBUG("SASL SSF value %d", ssf); if (ssf < 56) { /* 56 == DES level, good for Kerberos */ virReportError(VIR_ERR_AUTH_FAILED, _("negotiation SSF %d was not strong enough"), ssf); goto cleanup; } priv->is_secure = 1; } done: VIR_DEBUG("SASL authentication complete"); virNetClientSetSASLSession(priv->client, sasl); ret = 0; cleanup: VIR_FREE(serverin); remoteAuthInteractStateClear(&state, true); VIR_FREE(saslcb); virObjectUnref(sasl); virObjectUnref(saslCtxt); return ret; } #endif /* WITH_SASL */ static int remoteAuthPolkit(virConnectPtr conn, struct private_data *priv, virConnectAuthPtr auth G_GNUC_UNUSED) { remote_auth_polkit_ret ret; VIR_DEBUG("Client initialize PolicyKit authentication"); memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_AUTH_POLKIT, (xdrproc_t) xdr_void, (char *)NULL, (xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0) { return -1; /* virError already set by call */ } VIR_DEBUG("PolicyKit authentication complete"); return 0; } /*----------------------------------------------------------------------*/ static int remoteConnectDomainEventRegister(virConnectPtr conn, virConnectDomainEventCallback callback, void *opaque, virFreeCallback freecb) { int callbackID; int rv = -1; struct private_data *priv = conn->privateData; int count; remoteDriverLock(priv); if ((count = virDomainEventStateRegisterClient(conn, priv->eventState, NULL, VIR_DOMAIN_EVENT_ID_LIFECYCLE, VIR_DOMAIN_EVENT_CALLBACK(callback), opaque, freecb, true, &callbackID, priv->serverEventFilter)) < 0) goto done; if (count == 1) { /* Tell the server when we are the first callback registering */ if (priv->serverEventFilter) { remote_connect_domain_event_callback_register_any_args args; remote_connect_domain_event_callback_register_any_ret ret; args.eventID = VIR_DOMAIN_EVENT_ID_LIFECYCLE; args.dom = NULL; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_REGISTER_ANY, (xdrproc_t) xdr_remote_connect_domain_event_callback_register_any_args, (char *) &args, (xdrproc_t) xdr_remote_connect_domain_event_callback_register_any_ret, (char *) &ret) == -1) { virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, false); goto done; } virObjectEventStateSetRemote(conn, priv->eventState, callbackID, ret.callbackID); } else { if (call(conn, priv, 0, REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER, (xdrproc_t) xdr_void, (char *) NULL, (xdrproc_t) xdr_void, (char *) NULL) == -1) { virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, false); goto done; } } } rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectDomainEventDeregister(virConnectPtr conn, virConnectDomainEventCallback callback) { struct private_data *priv = conn->privateData; int rv = -1; remote_connect_domain_event_callback_deregister_any_args args; int callbackID; int remoteID; int count; remoteDriverLock(priv); if ((callbackID = virDomainEventStateCallbackID(conn, priv->eventState, callback, &remoteID)) < 0) goto done; if ((count = virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, true)) < 0) goto done; if (count == 0) { /* Tell the server when we are the last callback deregistering */ if (priv->serverEventFilter) { args.callbackID = remoteID; if (call(conn, priv, 0, REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_DEREGISTER_ANY, (xdrproc_t) xdr_remote_connect_domain_event_callback_deregister_any_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; } else { if (call(conn, priv, 0, REMOTE_PROC_CONNECT_DOMAIN_EVENT_DEREGISTER, (xdrproc_t) xdr_void, (char *) NULL, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; } } rv = 0; done: remoteDriverUnlock(priv); return rv; } static void remoteDomainBuildEventLifecycleHelper(virConnectPtr conn, remote_domain_event_lifecycle_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventLifecycleNewFromDom(dom, msg->event, msg->detail); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_lifecycle_msg *msg = evdata; remoteDomainBuildEventLifecycleHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_lifecycle_msg *msg = evdata; remoteDomainBuildEventLifecycleHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventRebootHelper(virConnectPtr conn, remote_domain_event_reboot_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventRebootNewFromDom(dom); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventReboot(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_reboot_msg *msg = evdata; remoteDomainBuildEventRebootHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackReboot(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_reboot_msg *msg = evdata; remoteDomainBuildEventRebootHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventRTCChangeHelper(virConnectPtr conn, remote_domain_event_rtc_change_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventRTCChangeNewFromDom(dom, msg->offset); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventRTCChange(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_rtc_change_msg *msg = evdata; remoteDomainBuildEventRTCChangeHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackRTCChange(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_rtc_change_msg *msg = evdata; remoteDomainBuildEventRTCChangeHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventWatchdogHelper(virConnectPtr conn, remote_domain_event_watchdog_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventWatchdogNewFromDom(dom, msg->action); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventWatchdog(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_watchdog_msg *msg = evdata; remoteDomainBuildEventWatchdogHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackWatchdog(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_watchdog_msg *msg = evdata; remoteDomainBuildEventWatchdogHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventIOErrorHelper(virConnectPtr conn, remote_domain_event_io_error_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventIOErrorNewFromDom(dom, msg->srcPath, msg->devAlias, msg->action); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventIOError(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_io_error_msg *msg = evdata; remoteDomainBuildEventIOErrorHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackIOError(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_io_error_msg *msg = evdata; remoteDomainBuildEventIOErrorHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventIOErrorReasonHelper(virConnectPtr conn, remote_domain_event_io_error_reason_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventIOErrorReasonNewFromDom(dom, msg->srcPath, msg->devAlias, msg->action, msg->reason); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventIOErrorReason(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_io_error_reason_msg *msg = evdata; remoteDomainBuildEventIOErrorReasonHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackIOErrorReason(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_io_error_reason_msg *msg = evdata; remoteDomainBuildEventIOErrorReasonHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventBlockJobHelper(virConnectPtr conn, remote_domain_event_block_job_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventBlockJobNewFromDom(dom, msg->path, msg->type, msg->status); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventBlockJob(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_block_job_msg *msg = evdata; remoteDomainBuildEventBlockJobHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackBlockJob(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_block_job_msg *msg = evdata; remoteDomainBuildEventBlockJobHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventBlockJob2(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_block_job_2_msg *msg = evdata; struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventBlockJob2NewFromDom(dom, msg->dst, msg->type, msg->status); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteDomainBuildEventGraphicsHelper(virConnectPtr conn, remote_domain_event_graphics_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; virDomainEventGraphicsAddressPtr localAddr = NULL; virDomainEventGraphicsAddressPtr remoteAddr = NULL; virDomainEventGraphicsSubjectPtr subject = NULL; size_t i; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; if (VIR_ALLOC(localAddr) < 0) goto error; localAddr->family = msg->local.family; localAddr->service = g_strdup(msg->local.service); localAddr->node = g_strdup(msg->local.node); if (VIR_ALLOC(remoteAddr) < 0) goto error; remoteAddr->family = msg->remote.family; remoteAddr->service = g_strdup(msg->remote.service); remoteAddr->node = g_strdup(msg->remote.node); if (VIR_ALLOC(subject) < 0) goto error; if (VIR_ALLOC_N(subject->identities, msg->subject.subject_len) < 0) goto error; subject->nidentity = msg->subject.subject_len; for (i = 0; i < subject->nidentity; i++) { subject->identities[i].type = g_strdup(msg->subject.subject_val[i].type); subject->identities[i].name = g_strdup(msg->subject.subject_val[i].name); } event = virDomainEventGraphicsNewFromDom(dom, msg->phase, localAddr, remoteAddr, msg->authScheme, subject); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); return; error: if (localAddr) { VIR_FREE(localAddr->service); VIR_FREE(localAddr->node); VIR_FREE(localAddr); } if (remoteAddr) { VIR_FREE(remoteAddr->service); VIR_FREE(remoteAddr->node); VIR_FREE(remoteAddr); } if (subject) { for (i = 0; i < subject->nidentity; i++) { VIR_FREE(subject->identities[i].type); VIR_FREE(subject->identities[i].name); } VIR_FREE(subject->identities); VIR_FREE(subject); } virObjectUnref(dom); return; } static void remoteDomainBuildEventGraphics(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_graphics_msg *msg = evdata; remoteDomainBuildEventGraphicsHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackGraphics(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_graphics_msg *msg = evdata; remoteDomainBuildEventGraphicsHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventControlErrorHelper(virConnectPtr conn, remote_domain_event_control_error_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventControlErrorNewFromDom(dom); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventControlError(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_control_error_msg *msg = evdata; remoteDomainBuildEventControlErrorHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackControlError(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_control_error_msg *msg = evdata; remoteDomainBuildEventControlErrorHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventDiskChangeHelper(virConnectPtr conn, remote_domain_event_disk_change_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventDiskChangeNewFromDom(dom, msg->oldSrcPath ? *msg->oldSrcPath : NULL, msg->newSrcPath ? *msg->newSrcPath : NULL, msg->devAlias, msg->reason); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventDiskChange(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_disk_change_msg *msg = evdata; remoteDomainBuildEventDiskChangeHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackDiskChange(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_disk_change_msg *msg = evdata; remoteDomainBuildEventDiskChangeHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventTrayChangeHelper(virConnectPtr conn, remote_domain_event_tray_change_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventTrayChangeNewFromDom(dom, msg->devAlias, msg->reason); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventTrayChange(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_tray_change_msg *msg = evdata; remoteDomainBuildEventTrayChangeHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackTrayChange(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_tray_change_msg *msg = evdata; remoteDomainBuildEventTrayChangeHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventPMWakeupHelper(virConnectPtr conn, remote_domain_event_pmwakeup_msg *msg, int callbackID, int reason) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventPMWakeupNewFromDom(dom, reason); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventPMWakeup(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_pmwakeup_msg *msg = evdata; remoteDomainBuildEventPMWakeupHelper(conn, msg, -1, 0); } static void remoteDomainBuildEventCallbackPMWakeup(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_pmwakeup_msg *msg = evdata; remoteDomainBuildEventPMWakeupHelper(conn, &msg->msg, msg->callbackID, msg->reason); } static void remoteDomainBuildEventPMSuspendHelper(virConnectPtr conn, remote_domain_event_pmsuspend_msg *msg, int callbackID, int reason) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventPMSuspendNewFromDom(dom, reason); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventPMSuspend(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_pmsuspend_msg *msg = evdata; remoteDomainBuildEventPMSuspendHelper(conn, msg, -1, 0); } static void remoteDomainBuildEventCallbackPMSuspend(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_pmsuspend_msg *msg = evdata; remoteDomainBuildEventPMSuspendHelper(conn, &msg->msg, msg->callbackID, msg->reason); } static void remoteDomainBuildEventBalloonChangeHelper(virConnectPtr conn, remote_domain_event_balloon_change_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventBalloonChangeNewFromDom(dom, msg->actual); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventBalloonChange(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_balloon_change_msg *msg = evdata; remoteDomainBuildEventBalloonChangeHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackBalloonChange(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_balloon_change_msg *msg = evdata; remoteDomainBuildEventBalloonChangeHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventPMSuspendDiskHelper(virConnectPtr conn, remote_domain_event_pmsuspend_disk_msg *msg, int callbackID, int reason) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventPMSuspendDiskNewFromDom(dom, reason); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventPMSuspendDisk(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_pmsuspend_disk_msg *msg = evdata; remoteDomainBuildEventPMSuspendDiskHelper(conn, msg, -1, 0); } static void remoteDomainBuildEventCallbackPMSuspendDisk(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_pmsuspend_disk_msg *msg = evdata; remoteDomainBuildEventPMSuspendDiskHelper(conn, &msg->msg, msg->callbackID, msg->reason); } static void remoteDomainBuildEventDeviceRemovedHelper(virConnectPtr conn, remote_domain_event_device_removed_msg *msg, int callbackID) { struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventDeviceRemovedNewFromDom(dom, msg->devAlias); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, callbackID); } static void remoteDomainBuildEventDeviceRemoved(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_device_removed_msg *msg = evdata; remoteDomainBuildEventDeviceRemovedHelper(conn, msg, -1); } static void remoteDomainBuildEventCallbackDeviceRemoved(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_device_removed_msg *msg = evdata; remoteDomainBuildEventDeviceRemovedHelper(conn, &msg->msg, msg->callbackID); } static void remoteDomainBuildEventCallbackDeviceAdded(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_device_added_msg *msg = evdata; struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainEventDeviceAddedNewFromDom(dom, msg->devAlias); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteDomainBuildEventCallbackDeviceRemovalFailed(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_device_removal_failed_msg *msg = evdata; struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; if (!(dom = get_nonnull_domain(conn, msg->dom))) return; event = virDomainEventDeviceRemovalFailedNewFromDom(dom, msg->devAlias); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteDomainBuildEventCallbackTunable(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_tunable_msg *msg = evdata; struct private_data *priv = conn->privateData; virDomainPtr dom; virTypedParameterPtr params = NULL; int nparams = 0; virObjectEventPtr event = NULL; if (virTypedParamsDeserialize((virTypedParameterRemotePtr) msg->params.params_val, msg->params.params_len, REMOTE_DOMAIN_EVENT_TUNABLE_MAX, &params, &nparams) < 0) return; dom = get_nonnull_domain(conn, msg->dom); if (!dom) { virTypedParamsFree(params, nparams); return; } event = virDomainEventTunableNewFromDom(dom, params, nparams); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteDomainBuildEventCallbackAgentLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_agent_lifecycle_msg *msg = evdata; struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; if (!(dom = get_nonnull_domain(conn, msg->dom))) return; event = virDomainEventAgentLifecycleNewFromDom(dom, msg->state, msg->reason); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteDomainBuildEventCallbackMigrationIteration(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_migration_iteration_msg *msg = evdata; struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; if (!(dom = get_nonnull_domain(conn, msg->dom))) return; event = virDomainEventMigrationIterationNewFromDom(dom, msg->iteration); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteDomainBuildEventCallbackJobCompleted(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_job_completed_msg *msg = evdata; struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; virTypedParameterPtr params = NULL; int nparams = 0; if (virTypedParamsDeserialize((virTypedParameterRemotePtr) msg->params.params_val, msg->params.params_len, REMOTE_DOMAIN_JOB_STATS_MAX, &params, &nparams) < 0) return; if (!(dom = get_nonnull_domain(conn, msg->dom))) { virTypedParamsFree(params, nparams); return; } event = virDomainEventJobCompletedNewFromDom(dom, params, nparams); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteDomainBuildEventCallbackMetadataChange(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_callback_metadata_change_msg *msg = evdata; struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; if (!(dom = get_nonnull_domain(conn, msg->dom))) return; event = virDomainEventMetadataChangeNewFromDom(dom, msg->type, msg->nsuri ? *msg->nsuri : NULL); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteNetworkBuildEventLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; struct private_data *priv = conn->privateData; remote_network_event_lifecycle_msg *msg = evdata; virNetworkPtr net; virObjectEventPtr event = NULL; net = get_nonnull_network(conn, msg->net); if (!net) return; event = virNetworkEventLifecycleNew(net->name, net->uuid, msg->event, msg->detail); virObjectUnref(net); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteStoragePoolBuildEventLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; struct private_data *priv = conn->privateData; remote_storage_pool_event_lifecycle_msg *msg = evdata; virStoragePoolPtr pool; virObjectEventPtr event = NULL; pool = get_nonnull_storage_pool(conn, msg->pool); if (!pool) return; event = virStoragePoolEventLifecycleNew(pool->name, pool->uuid, msg->event, msg->detail); virObjectUnref(pool); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteStoragePoolBuildEventRefresh(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; struct private_data *priv = conn->privateData; remote_storage_pool_event_refresh_msg *msg = evdata; virStoragePoolPtr pool; virObjectEventPtr event = NULL; pool = get_nonnull_storage_pool(conn, msg->pool); if (!pool) return; event = virStoragePoolEventRefreshNew(pool->name, pool->uuid); virObjectUnref(pool); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteNodeDeviceBuildEventLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; struct private_data *priv = conn->privateData; remote_node_device_event_lifecycle_msg *msg = evdata; virNodeDevicePtr dev; virObjectEventPtr event = NULL; dev = get_nonnull_node_device(conn, msg->dev); if (!dev) return; event = virNodeDeviceEventLifecycleNew(dev->name, msg->event, msg->detail); virObjectUnref(dev); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteNodeDeviceBuildEventUpdate(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; struct private_data *priv = conn->privateData; remote_node_device_event_update_msg *msg = evdata; virNodeDevicePtr dev; virObjectEventPtr event = NULL; dev = get_nonnull_node_device(conn, msg->dev); if (!dev) return; event = virNodeDeviceEventUpdateNew(dev->name); virObjectUnref(dev); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteSecretBuildEventLifecycle(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; struct private_data *priv = conn->privateData; remote_secret_event_lifecycle_msg *msg = evdata; virSecretPtr secret; virObjectEventPtr event = NULL; secret = get_nonnull_secret(conn, msg->secret); if (!secret) return; event = virSecretEventLifecycleNew(secret->uuid, secret->usageType, secret->usageID, msg->event, msg->detail); virObjectUnref(secret); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteSecretBuildEventValueChanged(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; struct private_data *priv = conn->privateData; remote_secret_event_value_changed_msg *msg = evdata; virSecretPtr secret; virObjectEventPtr event = NULL; secret = get_nonnull_secret(conn, msg->secret); if (!secret) return; event = virSecretEventValueChangedNew(secret->uuid, secret->usageType, secret->usageID); virObjectUnref(secret); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static void remoteDomainBuildQemuMonitorEvent(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; struct private_data *priv = conn->privateData; qemu_domain_monitor_event_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; event = virDomainQemuMonitorEventNew(dom->id, dom->name, dom->uuid, msg->event, msg->seconds, msg->micros, msg->details ? *msg->details : NULL); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static unsigned char * remoteSecretGetValue(virSecretPtr secret, size_t *value_size, unsigned int flags, unsigned int internalFlags) { unsigned char *rv = NULL; remote_secret_get_value_args args; remote_secret_get_value_ret ret; struct private_data *priv = secret->conn->privateData; remoteDriverLock(priv); /* internalFlags intentionally do not go over the wire */ if (internalFlags) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no internalFlags support")); goto done; } make_nonnull_secret(&args.secret, secret); args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(secret->conn, priv, 0, REMOTE_PROC_SECRET_GET_VALUE, (xdrproc_t) xdr_remote_secret_get_value_args, (char *) &args, (xdrproc_t) xdr_remote_secret_get_value_ret, (char *) &ret) == -1) goto done; *value_size = ret.value.value_len; rv = (unsigned char *) ret.value.value_val; /* Caller frees. */ done: remoteDriverUnlock(priv); return rv; } static void remoteDomainBuildEventBlockThreshold(virNetClientProgramPtr prog G_GNUC_UNUSED, virNetClientPtr client G_GNUC_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; remote_domain_event_block_threshold_msg *msg = evdata; struct private_data *priv = conn->privateData; virDomainPtr dom; virObjectEventPtr event = NULL; if (!(dom = get_nonnull_domain(conn, msg->dom))) return; event = virDomainEventBlockThresholdNewFromDom(dom, msg->dev, msg->path ? *msg->path : NULL, msg->threshold, msg->excess); virObjectUnref(dom); virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID); } static int remoteStreamSend(virStreamPtr st, const char *data, size_t nbytes) { VIR_DEBUG("st=%p data=%p nbytes=%zu", st, data, nbytes); struct private_data *priv = st->conn->privateData; virNetClientStreamPtr privst = st->privateData; int rv; remoteDriverLock(priv); priv->localUses++; remoteDriverUnlock(priv); rv = virNetClientStreamSendPacket(privst, priv->client, VIR_NET_CONTINUE, data, nbytes); remoteDriverLock(priv); priv->localUses--; remoteDriverUnlock(priv); return rv; } static int remoteStreamRecvFlags(virStreamPtr st, char *data, size_t nbytes, unsigned int flags) { VIR_DEBUG("st=%p data=%p nbytes=%zu flags=0x%x", st, data, nbytes, flags); struct private_data *priv = st->conn->privateData; virNetClientStreamPtr privst = st->privateData; int rv; virCheckFlags(VIR_STREAM_RECV_STOP_AT_HOLE, -1); remoteDriverLock(priv); priv->localUses++; remoteDriverUnlock(priv); rv = virNetClientStreamRecvPacket(privst, priv->client, data, nbytes, (st->flags & VIR_STREAM_NONBLOCK), flags); VIR_DEBUG("Done %d", rv); remoteDriverLock(priv); priv->localUses--; remoteDriverUnlock(priv); return rv; } static int remoteStreamRecv(virStreamPtr st, char *data, size_t nbytes) { return remoteStreamRecvFlags(st, data, nbytes, 0); } static int remoteStreamSendHole(virStreamPtr st, long long length, unsigned int flags) { VIR_DEBUG("st=%p length=%lld flags=0x%x", st, length, flags); struct private_data *priv = st->conn->privateData; virNetClientStreamPtr privst = st->privateData; int rv; remoteDriverLock(priv); priv->localUses++; remoteDriverUnlock(priv); rv = virNetClientStreamSendHole(privst, priv->client, length, flags); remoteDriverLock(priv); priv->localUses--; remoteDriverUnlock(priv); return rv; } static int remoteStreamRecvHole(virStreamPtr st, long long *length, unsigned int flags) { struct private_data *priv = st->conn->privateData; virNetClientStreamPtr privst = st->privateData; int rv; VIR_DEBUG("st=%p length=%p flags=0x%x", st, length, flags); virCheckFlags(0, -1); remoteDriverLock(priv); priv->localUses++; remoteDriverUnlock(priv); rv = virNetClientStreamRecvHole(priv->client, privst, length); remoteDriverLock(priv); priv->localUses--; remoteDriverUnlock(priv); return rv; } struct remoteStreamCallbackData { virStreamPtr st; virStreamEventCallback cb; void *opaque; virFreeCallback ff; }; static void remoteStreamEventCallback(virNetClientStreamPtr stream G_GNUC_UNUSED, int events, void *opaque) { struct remoteStreamCallbackData *cbdata = opaque; (cbdata->cb)(cbdata->st, events, cbdata->opaque); } static void remoteStreamCallbackFree(void *opaque) { struct remoteStreamCallbackData *cbdata = opaque; if (!cbdata->cb && cbdata->ff) (cbdata->ff)(cbdata->opaque); virObjectUnref(cbdata->st); VIR_FREE(opaque); } static int remoteStreamEventAddCallback(virStreamPtr st, int events, virStreamEventCallback cb, void *opaque, virFreeCallback ff) { struct private_data *priv = st->conn->privateData; virNetClientStreamPtr privst = st->privateData; int ret = -1; struct remoteStreamCallbackData *cbdata; if (VIR_ALLOC(cbdata) < 0) return -1; cbdata->cb = cb; cbdata->opaque = opaque; cbdata->ff = ff; cbdata->st = st; virStreamRef(st); remoteDriverLock(priv); if ((ret = virNetClientStreamEventAddCallback(privst, events, remoteStreamEventCallback, cbdata, remoteStreamCallbackFree)) < 0) { VIR_FREE(cbdata); goto cleanup; } cleanup: remoteDriverUnlock(priv); /* coverity[leaked_storage] - cbdata is not leaked */ return ret; } static int remoteStreamEventUpdateCallback(virStreamPtr st, int events) { struct private_data *priv = st->conn->privateData; virNetClientStreamPtr privst = st->privateData; int ret = -1; remoteDriverLock(priv); ret = virNetClientStreamEventUpdateCallback(privst, events); remoteDriverUnlock(priv); return ret; } static int remoteStreamEventRemoveCallback(virStreamPtr st) { struct private_data *priv = st->conn->privateData; virNetClientStreamPtr privst = st->privateData; int ret = -1; remoteDriverLock(priv); ret = virNetClientStreamEventRemoveCallback(privst); remoteDriverUnlock(priv); return ret; } static int remoteStreamCloseInt(virStreamPtr st, bool streamAbort) { struct private_data *priv = st->conn->privateData; virNetClientStreamPtr privst = st->privateData; int ret = -1; remoteDriverLock(priv); priv->localUses++; remoteDriverUnlock(priv); ret = virNetClientStreamSendPacket(privst, priv->client, streamAbort ? VIR_NET_ERROR : VIR_NET_OK, NULL, 0); remoteDriverLock(priv); priv->localUses--; virNetClientRemoveStream(priv->client, privst); remoteDriverUnlock(priv); return ret; } static int remoteStreamFinish(virStreamPtr st) { return remoteStreamCloseInt(st, false); } static int remoteStreamAbort(virStreamPtr st) { return remoteStreamCloseInt(st, true); } static virStreamDriver remoteStreamDrv = { .streamRecv = remoteStreamRecv, .streamRecvFlags = remoteStreamRecvFlags, .streamSend = remoteStreamSend, .streamSendHole = remoteStreamSendHole, .streamRecvHole = remoteStreamRecvHole, .streamFinish = remoteStreamFinish, .streamAbort = remoteStreamAbort, .streamEventAddCallback = remoteStreamEventAddCallback, .streamEventUpdateCallback = remoteStreamEventUpdateCallback, .streamEventRemoveCallback = remoteStreamEventRemoveCallback, }; static int remoteConnectDomainEventRegisterAny(virConnectPtr conn, virDomainPtr dom, int eventID, virConnectDomainEventGenericCallback callback, void *opaque, virFreeCallback freecb) { int rv = -1; struct private_data *priv = conn->privateData; int callbackID; int count; remote_nonnull_domain domain; remoteDriverLock(priv); if ((count = virDomainEventStateRegisterClient(conn, priv->eventState, dom, eventID, callback, opaque, freecb, false, &callbackID, priv->serverEventFilter)) < 0) goto done; /* If this is the first callback for this eventID, we need to enable * events on the server */ if (count == 1) { if (priv->serverEventFilter) { remote_connect_domain_event_callback_register_any_args args; remote_connect_domain_event_callback_register_any_ret ret; args.eventID = eventID; if (dom) { make_nonnull_domain(&domain, dom); args.dom = &domain; } else { args.dom = NULL; } memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_REGISTER_ANY, (xdrproc_t) xdr_remote_connect_domain_event_callback_register_any_args, (char *) &args, (xdrproc_t) xdr_remote_connect_domain_event_callback_register_any_ret, (char *) &ret) == -1) { virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, false); goto done; } virObjectEventStateSetRemote(conn, priv->eventState, callbackID, ret.callbackID); } else { remote_connect_domain_event_register_any_args args; args.eventID = eventID; if (call(conn, priv, 0, REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER_ANY, (xdrproc_t) xdr_remote_connect_domain_event_register_any_args, (char *) &args, (xdrproc_t) xdr_void, (char *)NULL) == -1) { virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, false); goto done; } } } rv = callbackID; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectDomainEventDeregisterAny(virConnectPtr conn, int callbackID) { struct private_data *priv = conn->privateData; int rv = -1; int eventID; int remoteID; int count; remoteDriverLock(priv); if ((eventID = virObjectEventStateEventID(conn, priv->eventState, callbackID, &remoteID)) < 0) goto done; if ((count = virObjectEventStateDeregisterID(conn, priv->eventState, callbackID, true)) < 0) goto done; /* If that was the last callback for this eventID, we need to disable * events on the server */ if (count == 0) { if (priv->serverEventFilter) { remote_connect_domain_event_callback_deregister_any_args args; args.callbackID = remoteID; if (call(conn, priv, 0, REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_DEREGISTER_ANY, (xdrproc_t) xdr_remote_connect_domain_event_callback_deregister_any_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; } else { remote_connect_domain_event_deregister_any_args args; args.eventID = eventID; if (call(conn, priv, 0, REMOTE_PROC_CONNECT_DOMAIN_EVENT_DEREGISTER_ANY, (xdrproc_t) xdr_remote_connect_domain_event_deregister_any_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; } } rv = 0; done: remoteDriverUnlock(priv); return rv; } /*----------------------------------------------------------------------*/ static int remoteDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd, char **result, unsigned int flags) { int rv = -1; qemu_domain_monitor_command_args args; qemu_domain_monitor_command_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.cmd = (char *)cmd; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, REMOTE_CALL_QEMU, QEMU_PROC_DOMAIN_MONITOR_COMMAND, (xdrproc_t) xdr_qemu_domain_monitor_command_args, (char *) &args, (xdrproc_t) xdr_qemu_domain_monitor_command_ret, (char *) &ret) == -1) goto done; *result = g_strdup(ret.result); rv = 0; xdr_free((xdrproc_t) xdr_qemu_domain_monitor_command_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static char * remoteDomainMigrateBegin3(virDomainPtr domain, const char *xmlin, char **cookieout, int *cookieoutlen, unsigned long flags, const char *dname, unsigned long resource) { char *rv = NULL; remote_domain_migrate_begin3_args args; remote_domain_migrate_begin3_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); memset(&args, 0, sizeof(args)); memset(&ret, 0, sizeof(ret)); make_nonnull_domain(&args.dom, domain); args.xmlin = xmlin == NULL ? NULL : (char **) &xmlin; args.flags = flags; args.dname = dname == NULL ? NULL : (char **) &dname; args.resource = resource; if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3, (xdrproc_t) xdr_remote_domain_migrate_begin3_args, (char *) &args, (xdrproc_t) xdr_remote_domain_migrate_begin3_ret, (char *) &ret) == -1) goto done; if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ *cookieoutlen = ret.cookie_out.cookie_out_len; } rv = ret.xml; /* caller frees */ done: remoteDriverUnlock(priv); return rv; error: VIR_FREE(ret.cookie_out.cookie_out_val); goto done; } static int remoteDomainMigratePrepare3(virConnectPtr dconn, const char *cookiein, int cookieinlen, char **cookieout, int *cookieoutlen, const char *uri_in, char **uri_out, unsigned long flags, const char *dname, unsigned long resource, const char *dom_xml) { int rv = -1; remote_domain_migrate_prepare3_args args; remote_domain_migrate_prepare3_ret ret; struct private_data *priv = dconn->privateData; remoteDriverLock(priv); memset(&args, 0, sizeof(args)); memset(&ret, 0, sizeof(ret)); args.cookie_in.cookie_in_val = (char *)cookiein; args.cookie_in.cookie_in_len = cookieinlen; args.uri_in = uri_in == NULL ? NULL : (char **) &uri_in; args.flags = flags; args.dname = dname == NULL ? NULL : (char **) &dname; args.resource = resource; args.dom_xml = (char *) dom_xml; memset(&ret, 0, sizeof(ret)); if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3, (xdrproc_t) xdr_remote_domain_migrate_prepare3_args, (char *) &args, (xdrproc_t) xdr_remote_domain_migrate_prepare3_ret, (char *) &ret) == -1) goto done; if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ *cookieoutlen = ret.cookie_out.cookie_out_len; } if (ret.uri_out) { if (!uri_out) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores uri_out")); goto error; } *uri_out = *ret.uri_out; /* Caller frees. */ } rv = 0; done: VIR_FREE(ret.uri_out); remoteDriverUnlock(priv); return rv; error: VIR_FREE(ret.cookie_out.cookie_out_val); if (ret.uri_out) VIR_FREE(*ret.uri_out); goto done; } static int remoteDomainMigratePrepareTunnel3(virConnectPtr dconn, virStreamPtr st, const char *cookiein, int cookieinlen, char **cookieout, int *cookieoutlen, unsigned long flags, const char *dname, unsigned long resource, const char *dom_xml) { struct private_data *priv = dconn->privateData; int rv = -1; remote_domain_migrate_prepare_tunnel3_args args; remote_domain_migrate_prepare_tunnel3_ret ret; virNetClientStreamPtr netst; remoteDriverLock(priv); memset(&args, 0, sizeof(args)); memset(&ret, 0, sizeof(ret)); if (!(netst = virNetClientStreamNew(priv->remoteProgram, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3, priv->counter, false))) goto done; if (virNetClientAddStream(priv->client, netst) < 0) { virObjectUnref(netst); goto done; } st->driver = &remoteStreamDrv; st->privateData = netst; st->ff = virObjectFreeCallback; args.cookie_in.cookie_in_val = (char *)cookiein; args.cookie_in.cookie_in_len = cookieinlen; args.flags = flags; args.dname = dname == NULL ? NULL : (char **) &dname; args.resource = resource; args.dom_xml = (char *) dom_xml; if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3, (xdrproc_t) xdr_remote_domain_migrate_prepare_tunnel3_args, (char *) &args, (xdrproc_t) xdr_remote_domain_migrate_prepare_tunnel3_ret, (char *) &ret) == -1) { virNetClientRemoveStream(priv->client, netst); virObjectUnref(netst); goto done; } if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ *cookieoutlen = ret.cookie_out.cookie_out_len; } rv = 0; done: remoteDriverUnlock(priv); return rv; error: VIR_FREE(ret.cookie_out.cookie_out_val); goto done; } static int remoteDomainMigratePerform3(virDomainPtr dom, const char *xmlin, const char *cookiein, int cookieinlen, char **cookieout, int *cookieoutlen, const char *dconnuri, const char *uri, unsigned long flags, const char *dname, unsigned long resource) { int rv = -1; remote_domain_migrate_perform3_args args; remote_domain_migrate_perform3_ret ret; struct private_data *priv = dom->conn->privateData; remoteDriverLock(priv); memset(&args, 0, sizeof(args)); memset(&ret, 0, sizeof(ret)); make_nonnull_domain(&args.dom, dom); args.xmlin = xmlin == NULL ? NULL : (char **) &xmlin; args.cookie_in.cookie_in_val = (char *)cookiein; args.cookie_in.cookie_in_len = cookieinlen; args.flags = flags; args.dname = dname == NULL ? NULL : (char **) &dname; args.uri = uri == NULL ? NULL : (char **) &uri; args.dconnuri = dconnuri == NULL ? NULL : (char **) &dconnuri; args.resource = resource; if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3, (xdrproc_t) xdr_remote_domain_migrate_perform3_args, (char *) &args, (xdrproc_t) xdr_remote_domain_migrate_perform3_ret, (char *) &ret) == -1) goto done; if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ *cookieoutlen = ret.cookie_out.cookie_out_len; } rv = 0; done: remoteDriverUnlock(priv); return rv; error: VIR_FREE(ret.cookie_out.cookie_out_val); goto done; } static virDomainPtr remoteDomainMigrateFinish3(virConnectPtr dconn, const char *dname, const char *cookiein, int cookieinlen, char **cookieout, int *cookieoutlen, const char *dconnuri, const char *uri, unsigned long flags, int cancelled) { remote_domain_migrate_finish3_args args; remote_domain_migrate_finish3_ret ret; struct private_data *priv = dconn->privateData; virDomainPtr rv = NULL; remoteDriverLock(priv); memset(&args, 0, sizeof(args)); memset(&ret, 0, sizeof(ret)); args.cookie_in.cookie_in_val = (char *)cookiein; args.cookie_in.cookie_in_len = cookieinlen; args.dname = (char *) dname; args.uri = uri == NULL ? NULL : (char **) &uri; args.dconnuri = dconnuri == NULL ? NULL : (char **) &dconnuri; args.flags = flags; args.cancelled = cancelled; if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_FINISH3, (xdrproc_t) xdr_remote_domain_migrate_finish3_args, (char *) &args, (xdrproc_t) xdr_remote_domain_migrate_finish3_ret, (char *) &ret) == -1) goto done; rv = get_nonnull_domain(dconn, ret.dom); if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ *cookieoutlen = ret.cookie_out.cookie_out_len; ret.cookie_out.cookie_out_val = NULL; ret.cookie_out.cookie_out_len = 0; } xdr_free((xdrproc_t) &xdr_remote_domain_migrate_finish3_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; error: VIR_FREE(ret.cookie_out.cookie_out_val); goto done; } static int remoteDomainMigrateConfirm3(virDomainPtr domain, const char *cookiein, int cookieinlen, unsigned long flags, int cancelled) { int rv = -1; remote_domain_migrate_confirm3_args args; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); memset(&args, 0, sizeof(args)); make_nonnull_domain(&args.dom, domain); args.cookie_in.cookie_in_len = cookieinlen; args.cookie_in.cookie_in_val = (char *) cookiein; args.flags = flags; args.cancelled = cancelled; if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3, (xdrproc_t) xdr_remote_domain_migrate_confirm3_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteConnectGetCPUModelNames(virConnectPtr conn, const char *arch, char ***models, unsigned int flags) { int rv = -1; size_t i; char **retmodels = NULL; remote_connect_get_cpu_model_names_args args; remote_connect_get_cpu_model_names_ret ret; struct private_data *priv = conn->privateData; remoteDriverLock(priv); args.arch = (char *) arch; args.need_results = !!models; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_GET_CPU_MODEL_NAMES, (xdrproc_t) xdr_remote_connect_get_cpu_model_names_args, (char *) &args, (xdrproc_t) xdr_remote_connect_get_cpu_model_names_ret, (char *) &ret) < 0) goto done; /* Check the length of the returned list carefully. */ if (ret.models.models_len > REMOTE_CONNECT_CPU_MODELS_MAX) { virReportError(VIR_ERR_RPC, _("Too many model names '%d' for limit '%d'"), ret.models.models_len, REMOTE_CONNECT_CPU_MODELS_MAX); goto cleanup; } if (models) { if (VIR_ALLOC_N(retmodels, ret.models.models_len + 1) < 0) goto cleanup; for (i = 0; i < ret.models.models_len; i++) { retmodels[i] = ret.models.models_val[i]; ret.models.models_val[i] = NULL; } *models = retmodels; retmodels = NULL; } rv = ret.ret; cleanup: virStringListFree(retmodels); xdr_free((xdrproc_t) xdr_remote_connect_get_cpu_model_names_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainOpenGraphics(virDomainPtr dom, unsigned int idx, int fd, unsigned int flags) { int rv = -1; remote_domain_open_graphics_args args; struct private_data *priv = dom->conn->privateData; int fdin[] = { fd }; size_t fdinlen = G_N_ELEMENTS(fdin); remoteDriverLock(priv); make_nonnull_domain(&args.dom, dom); args.idx = idx; args.flags = flags; if (callFull(dom->conn, priv, 0, fdin, fdinlen, NULL, NULL, REMOTE_PROC_DOMAIN_OPEN_GRAPHICS, (xdrproc_t) xdr_remote_domain_open_graphics_args, (char *) &args, (xdrproc_t) xdr_void, NULL) == -1) goto done; rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteDomainOpenGraphicsFD(virDomainPtr dom, unsigned int idx, unsigned int flags) { int rv = -1; remote_domain_open_graphics_fd_args args; struct private_data *priv = dom->conn->privateData; int *fdout = NULL; size_t fdoutlen = 0; remoteDriverLock(priv); make_nonnull_domain(&args.dom, dom); args.idx = idx; args.flags = flags; if (callFull(dom->conn, priv, 0, NULL, 0, &fdout, &fdoutlen, REMOTE_PROC_DOMAIN_OPEN_GRAPHICS_FD, (xdrproc_t) xdr_remote_domain_open_graphics_fd_args, (char *) &args, (xdrproc_t) xdr_void, NULL) == -1) goto done; if (fdoutlen != 1) { if (fdoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("too many file descriptors received")); while (fdoutlen) VIR_FORCE_CLOSE(fdout[--fdoutlen]); } else { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no file descriptor received")); } goto done; } rv = fdout[0]; done: VIR_FREE(fdout); remoteDriverUnlock(priv); return rv; } static int remoteConnectSetKeepAlive(virConnectPtr conn, int interval, unsigned int count) { struct private_data *priv = conn->privateData; int ret = -1; remoteDriverLock(priv); if (!virNetClientKeepAliveIsSupported(priv->client)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("the caller doesn't support keepalive protocol;" " perhaps it's missing event loop implementation")); goto cleanup; } if (!priv->serverKeepAlive) { ret = 1; goto cleanup; } if (interval > 0) { ret = virNetClientKeepAliveStart(priv->client, interval, count); } else { virNetClientKeepAliveStop(priv->client); ret = 0; } cleanup: remoteDriverUnlock(priv); return ret; } static int remoteConnectIsAlive(virConnectPtr conn) { struct private_data *priv = conn->privateData; bool ret; remoteDriverLock(priv); ret = virNetClientIsOpen(priv->client); remoteDriverUnlock(priv); if (ret) return 1; else return 0; } static int remoteDomainGetDiskErrors(virDomainPtr dom, virDomainDiskErrorPtr errors, unsigned int maxerrors, unsigned int flags) { int rv = -1; struct private_data *priv = dom->conn->privateData; remote_domain_get_disk_errors_args args; remote_domain_get_disk_errors_ret ret; remoteDriverLock(priv); make_nonnull_domain(&args.dom, dom); args.maxerrors = maxerrors; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_DISK_ERRORS, (xdrproc_t) xdr_remote_domain_get_disk_errors_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_disk_errors_ret, (char *) &ret) == -1) goto done; if (remoteDeserializeDomainDiskErrors(ret.errors.errors_val, ret.errors.errors_len, REMOTE_DOMAIN_DISK_ERRORS_MAX, errors, maxerrors) < 0) goto cleanup; rv = ret.nerrors; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_disk_errors_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } #include "remote_client_bodies.h" #include "lxc_client_bodies.h" #include "qemu_client_bodies.h" /* * Serial a set of arguments into a method call message, * send that to the server and wait for reply */ static int callFull(virConnectPtr conn G_GNUC_UNUSED, struct private_data *priv, unsigned int flags, int *fdin, size_t fdinlen, int **fdout, size_t *fdoutlen, int proc_nr, xdrproc_t args_filter, char *args, xdrproc_t ret_filter, char *ret) { int rv; virNetClientProgramPtr prog; int counter = priv->counter++; virNetClientPtr client = priv->client; priv->localUses++; if (flags & REMOTE_CALL_QEMU) prog = priv->qemuProgram; else if (flags & REMOTE_CALL_LXC) prog = priv->lxcProgram; else prog = priv->remoteProgram; /* Unlock, so that if we get any async events/stream data * while processing the RPC, we don't deadlock when our * callbacks for those are invoked */ remoteDriverUnlock(priv); rv = virNetClientProgramCall(prog, client, counter, proc_nr, fdinlen, fdin, fdoutlen, fdout, args_filter, args, ret_filter, ret); remoteDriverLock(priv); priv->localUses--; return rv; } static int call(virConnectPtr conn, struct private_data *priv, unsigned int flags, int proc_nr, xdrproc_t args_filter, char *args, xdrproc_t ret_filter, char *ret) { return callFull(conn, priv, flags, NULL, 0, NULL, NULL, proc_nr, args_filter, args, ret_filter, ret); } static int remoteDomainGetInterfaceParameters(virDomainPtr domain, const char *device, virTypedParameterPtr params, int *nparams, unsigned int flags) { int rv = -1; remote_domain_get_interface_parameters_args args; remote_domain_get_interface_parameters_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.device = (char *)device; args.nparams = *nparams; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS, (xdrproc_t) xdr_remote_domain_get_interface_parameters_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_interface_parameters_ret, (char *) &ret) == -1) goto done; /* Handle the case when the caller does not know the number of parameters * and is asking for the number of parameters supported */ if (*nparams == 0) { *nparams = ret.nparams; rv = 0; goto cleanup; } if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_DOMAIN_INTERFACE_PARAMETERS_MAX, &params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_interface_parameters_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteNodeGetMemoryParameters(virConnectPtr conn, virTypedParameterPtr params, int *nparams, unsigned int flags) { int rv = -1; remote_node_get_memory_parameters_args args; remote_node_get_memory_parameters_ret ret; struct private_data *priv = conn->privateData; remoteDriverLock(priv); args.nparams = *nparams; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_MEMORY_PARAMETERS, (xdrproc_t) xdr_remote_node_get_memory_parameters_args, (char *) &args, (xdrproc_t) xdr_remote_node_get_memory_parameters_ret, (char *) &ret) == -1) goto done; /* Handle the case when the caller does not know the number of parameters * and is asking for the number of parameters supported */ if (*nparams == 0) { *nparams = ret.nparams; rv = 0; goto cleanup; } if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_NODE_MEMORY_PARAMETERS_MAX, &params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_node_get_memory_parameters_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteNodeGetSEVInfo(virConnectPtr conn, virTypedParameterPtr *params, int *nparams, unsigned int flags) { int rv = -1; remote_node_get_sev_info_args args; remote_node_get_sev_info_ret ret; struct private_data *priv = conn->privateData; remoteDriverLock(priv); args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_SEV_INFO, (xdrproc_t) xdr_remote_node_get_sev_info_args, (char *) &args, (xdrproc_t) xdr_remote_node_get_sev_info_ret, (char *) &ret) == -1) goto done; if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_NODE_SEV_INFO_MAX, params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_node_get_sev_info_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteNodeGetCPUMap(virConnectPtr conn, unsigned char **cpumap, unsigned int *online, unsigned int flags) { int rv = -1; remote_node_get_cpu_map_args args; remote_node_get_cpu_map_ret ret; struct private_data *priv = conn->privateData; remoteDriverLock(priv); args.need_map = !!cpumap; args.need_online = !!online; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_CPU_MAP, (xdrproc_t) xdr_remote_node_get_cpu_map_args, (char *) &args, (xdrproc_t) xdr_remote_node_get_cpu_map_ret, (char *) &ret) == -1) goto done; if (ret.ret < 0) goto cleanup; if (cpumap) { if (VIR_ALLOC_N(*cpumap, ret.cpumap.cpumap_len) < 0) goto cleanup; memcpy(*cpumap, ret.cpumap.cpumap_val, ret.cpumap.cpumap_len); } if (online) *online = ret.online; rv = ret.ret; cleanup: xdr_free((xdrproc_t) xdr_remote_node_get_cpu_map_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainLxcOpenNamespace(virDomainPtr domain, int **fdlist, unsigned int flags) { int rv = -1; lxc_domain_open_namespace_args args; struct private_data *priv = domain->conn->privateData; size_t nfds = 0; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.flags = flags; *fdlist = NULL; if (callFull(domain->conn, priv, REMOTE_CALL_LXC, NULL, 0, fdlist, &nfds, LXC_PROC_DOMAIN_OPEN_NAMESPACE, (xdrproc_t) xdr_lxc_domain_open_namespace_args, (char *) &args, (xdrproc_t) xdr_void, NULL) == -1) goto done; rv = nfds; done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetJobStats(virDomainPtr domain, int *type, virTypedParameterPtr *params, int *nparams, unsigned int flags) { int rv = -1; remote_domain_get_job_stats_args args; remote_domain_get_job_stats_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); make_nonnull_domain(&args.dom, domain); args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_JOB_STATS, (xdrproc_t) xdr_remote_domain_get_job_stats_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_job_stats_ret, (char *) &ret) == -1) goto done; *type = ret.type; if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_DOMAIN_JOB_STATS_MAX, params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_job_stats_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static char * remoteDomainMigrateBegin3Params(virDomainPtr domain, virTypedParameterPtr params, int nparams, char **cookieout, int *cookieoutlen, unsigned int flags) { char *rv = NULL; remote_domain_migrate_begin3_params_args args; remote_domain_migrate_begin3_params_ret ret; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); memset(&args, 0, sizeof(args)); memset(&ret, 0, sizeof(ret)); make_nonnull_domain(&args.dom, domain); args.flags = flags; if (virTypedParamsSerialize(params, nparams, REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX, (virTypedParameterRemotePtr *) &args.params.params_val, &args.params.params_len, VIR_TYPED_PARAM_STRING_OKAY) < 0) { xdr_free((xdrproc_t) xdr_remote_domain_migrate_begin3_params_args, (char *) &args); goto cleanup; } if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3_PARAMS, (xdrproc_t) xdr_remote_domain_migrate_begin3_params_args, (char *) &args, (xdrproc_t) xdr_remote_domain_migrate_begin3_params_ret, (char *) &ret) == -1) goto cleanup; if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ *cookieoutlen = ret.cookie_out.cookie_out_len; } rv = ret.xml; /* caller frees */ cleanup: virTypedParamsRemoteFree((virTypedParameterRemotePtr) args.params.params_val, args.params.params_len); remoteDriverUnlock(priv); return rv; error: VIR_FREE(ret.cookie_out.cookie_out_val); goto cleanup; } static int remoteDomainMigratePrepare3Params(virConnectPtr dconn, virTypedParameterPtr params, int nparams, const char *cookiein, int cookieinlen, char **cookieout, int *cookieoutlen, char **uri_out, unsigned int flags) { int rv = -1; remote_domain_migrate_prepare3_params_args args; remote_domain_migrate_prepare3_params_ret ret; struct private_data *priv = dconn->privateData; remoteDriverLock(priv); memset(&args, 0, sizeof(args)); memset(&ret, 0, sizeof(ret)); if (virTypedParamsSerialize(params, nparams, REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX, (virTypedParameterRemotePtr *) &args.params.params_val, &args.params.params_len, VIR_TYPED_PARAM_STRING_OKAY) < 0) { xdr_free((xdrproc_t) xdr_remote_domain_migrate_prepare3_params_args, (char *) &args); goto cleanup; } args.cookie_in.cookie_in_val = (char *)cookiein; args.cookie_in.cookie_in_len = cookieinlen; args.flags = flags; if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3_PARAMS, (xdrproc_t) xdr_remote_domain_migrate_prepare3_params_args, (char *) &args, (xdrproc_t) xdr_remote_domain_migrate_prepare3_params_ret, (char *) &ret) == -1) goto cleanup; if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ *cookieoutlen = ret.cookie_out.cookie_out_len; } if (ret.uri_out) { if (!uri_out) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores uri_out")); goto error; } *uri_out = *ret.uri_out; /* Caller frees. */ } rv = 0; cleanup: virTypedParamsRemoteFree((virTypedParameterRemotePtr) args.params.params_val, args.params.params_len); VIR_FREE(ret.uri_out); remoteDriverUnlock(priv); return rv; error: VIR_FREE(ret.cookie_out.cookie_out_val); if (ret.uri_out) VIR_FREE(*ret.uri_out); goto cleanup; } static int remoteDomainMigratePrepareTunnel3Params(virConnectPtr dconn, virStreamPtr st, virTypedParameterPtr params, int nparams, const char *cookiein, int cookieinlen, char **cookieout, int *cookieoutlen, unsigned int flags) { struct private_data *priv = dconn->privateData; int rv = -1; remote_domain_migrate_prepare_tunnel3_params_args args; remote_domain_migrate_prepare_tunnel3_params_ret ret; virNetClientStreamPtr netst; remoteDriverLock(priv); memset(&args, 0, sizeof(args)); memset(&ret, 0, sizeof(ret)); args.cookie_in.cookie_in_val = (char *)cookiein; args.cookie_in.cookie_in_len = cookieinlen; args.flags = flags; if (virTypedParamsSerialize(params, nparams, REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX, (virTypedParameterRemotePtr *) &args.params.params_val, &args.params.params_len, VIR_TYPED_PARAM_STRING_OKAY) < 0) { xdr_free((xdrproc_t) xdr_remote_domain_migrate_prepare_tunnel3_params_args, (char *) &args); goto cleanup; } if (!(netst = virNetClientStreamNew(priv->remoteProgram, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS, priv->counter, false))) goto cleanup; if (virNetClientAddStream(priv->client, netst) < 0) { virObjectUnref(netst); goto cleanup; } st->driver = &remoteStreamDrv; st->privateData = netst; st->ff = virObjectFreeCallback; if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS, (xdrproc_t) xdr_remote_domain_migrate_prepare_tunnel3_params_args, (char *) &args, (xdrproc_t) xdr_remote_domain_migrate_prepare_tunnel3_params_ret, (char *) &ret) == -1) { virNetClientRemoveStream(priv->client, netst); virObjectUnref(netst); goto cleanup; } if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ *cookieoutlen = ret.cookie_out.cookie_out_len; } rv = 0; cleanup: virTypedParamsRemoteFree((virTypedParameterRemotePtr) args.params.params_val, args.params.params_len); remoteDriverUnlock(priv); return rv; error: VIR_FREE(ret.cookie_out.cookie_out_val); goto cleanup; } static int remoteDomainMigratePerform3Params(virDomainPtr dom, const char *dconnuri, virTypedParameterPtr params, int nparams, const char *cookiein, int cookieinlen, char **cookieout, int *cookieoutlen, unsigned int flags) { int rv = -1; remote_domain_migrate_perform3_params_args args; remote_domain_migrate_perform3_params_ret ret; struct private_data *priv = dom->conn->privateData; remoteDriverLock(priv); memset(&args, 0, sizeof(args)); memset(&ret, 0, sizeof(ret)); make_nonnull_domain(&args.dom, dom); args.dconnuri = dconnuri == NULL ? NULL : (char **) &dconnuri; args.cookie_in.cookie_in_val = (char *)cookiein; args.cookie_in.cookie_in_len = cookieinlen; args.flags = flags; if (virTypedParamsSerialize(params, nparams, REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX, (virTypedParameterRemotePtr *) &args.params.params_val, &args.params.params_len, VIR_TYPED_PARAM_STRING_OKAY) < 0) { xdr_free((xdrproc_t) xdr_remote_domain_migrate_perform3_params_args, (char *) &args); goto cleanup; } if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3_PARAMS, (xdrproc_t) xdr_remote_domain_migrate_perform3_params_args, (char *) &args, (xdrproc_t) xdr_remote_domain_migrate_perform3_params_ret, (char *) &ret) == -1) goto cleanup; if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ *cookieoutlen = ret.cookie_out.cookie_out_len; } rv = 0; cleanup: virTypedParamsRemoteFree((virTypedParameterRemotePtr) args.params.params_val, args.params.params_len); remoteDriverUnlock(priv); return rv; error: VIR_FREE(ret.cookie_out.cookie_out_val); goto cleanup; } static virDomainPtr remoteDomainMigrateFinish3Params(virConnectPtr dconn, virTypedParameterPtr params, int nparams, const char *cookiein, int cookieinlen, char **cookieout, int *cookieoutlen, unsigned int flags, int cancelled) { remote_domain_migrate_finish3_params_args args; remote_domain_migrate_finish3_params_ret ret; struct private_data *priv = dconn->privateData; virDomainPtr rv = NULL; remoteDriverLock(priv); memset(&args, 0, sizeof(args)); memset(&ret, 0, sizeof(ret)); args.cookie_in.cookie_in_val = (char *)cookiein; args.cookie_in.cookie_in_len = cookieinlen; args.flags = flags; args.cancelled = cancelled; if (virTypedParamsSerialize(params, nparams, REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX, (virTypedParameterRemotePtr *) &args.params.params_val, &args.params.params_len, VIR_TYPED_PARAM_STRING_OKAY) < 0) { xdr_free((xdrproc_t) xdr_remote_domain_migrate_finish3_params_args, (char *) &args); goto cleanup; } if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_FINISH3_PARAMS, (xdrproc_t) xdr_remote_domain_migrate_finish3_params_args, (char *) &args, (xdrproc_t) xdr_remote_domain_migrate_finish3_params_ret, (char *) &ret) == -1) goto cleanup; rv = get_nonnull_domain(dconn, ret.dom); if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ *cookieoutlen = ret.cookie_out.cookie_out_len; ret.cookie_out.cookie_out_val = NULL; ret.cookie_out.cookie_out_len = 0; } xdr_free((xdrproc_t) &xdr_remote_domain_migrate_finish3_params_ret, (char *) &ret); cleanup: virTypedParamsRemoteFree((virTypedParameterRemotePtr) args.params.params_val, args.params.params_len); remoteDriverUnlock(priv); return rv; error: VIR_FREE(ret.cookie_out.cookie_out_val); goto cleanup; } static int remoteDomainMigrateConfirm3Params(virDomainPtr domain, virTypedParameterPtr params, int nparams, const char *cookiein, int cookieinlen, unsigned int flags, int cancelled) { int rv = -1; remote_domain_migrate_confirm3_params_args args; struct private_data *priv = domain->conn->privateData; remoteDriverLock(priv); memset(&args, 0, sizeof(args)); make_nonnull_domain(&args.dom, domain); args.cookie_in.cookie_in_len = cookieinlen; args.cookie_in.cookie_in_val = (char *) cookiein; args.flags = flags; args.cancelled = cancelled; if (virTypedParamsSerialize(params, nparams, REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX, (virTypedParameterRemotePtr *) &args.params.params_val, &args.params.params_len, VIR_TYPED_PARAM_STRING_OKAY) < 0) { xdr_free((xdrproc_t) xdr_remote_domain_migrate_confirm3_params_args, (char *) &args); goto cleanup; } if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3_PARAMS, (xdrproc_t) xdr_remote_domain_migrate_confirm3_params_args, (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto cleanup; rv = 0; cleanup: virTypedParamsRemoteFree((virTypedParameterRemotePtr) args.params.params_val, args.params.params_len); remoteDriverUnlock(priv); return rv; } static virDomainPtr remoteDomainCreateXMLWithFiles(virConnectPtr conn, const char *xml_desc, unsigned int nfiles, int *files, unsigned int flags) { virDomainPtr rv = NULL; struct private_data *priv = conn->privateData; remote_domain_create_xml_with_files_args args; remote_domain_create_xml_with_files_ret ret; remoteDriverLock(priv); args.xml_desc = (char *)xml_desc; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (callFull(conn, priv, 0, files, nfiles, NULL, NULL, REMOTE_PROC_DOMAIN_CREATE_XML_WITH_FILES, (xdrproc_t)xdr_remote_domain_create_xml_with_files_args, (char *)&args, (xdrproc_t)xdr_remote_domain_create_xml_with_files_ret, (char *)&ret) == -1) { goto done; } rv = get_nonnull_domain(conn, ret.dom); xdr_free((xdrproc_t)xdr_remote_domain_create_xml_with_files_ret, (char *)&ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainCreateWithFiles(virDomainPtr dom, unsigned int nfiles, int *files, unsigned int flags) { int rv = -1; struct private_data *priv = dom->conn->privateData; remote_domain_create_with_files_args args; remote_domain_create_with_files_ret ret; remoteDriverLock(priv); make_nonnull_domain(&args.dom, dom); args.flags = flags; memset(&ret, 0, sizeof(ret)); if (callFull(dom->conn, priv, 0, files, nfiles, NULL, NULL, REMOTE_PROC_DOMAIN_CREATE_WITH_FILES, (xdrproc_t)xdr_remote_domain_create_with_files_args, (char *)&args, (xdrproc_t)xdr_remote_domain_create_with_files_ret, (char *)&ret) == -1) { goto done; } dom->id = ret.dom.id; xdr_free((xdrproc_t) &xdr_remote_domain_create_with_files_ret, (char *) &ret); rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetTime(virDomainPtr dom, long long *seconds, unsigned int *nseconds, unsigned int flags) { int rv = -1; struct private_data *priv = dom->conn->privateData; remote_domain_get_time_args args; remote_domain_get_time_ret ret; remoteDriverLock(priv); make_nonnull_domain(&args.dom, dom); args.flags = flags; *seconds = *nseconds = 0; if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_TIME, (xdrproc_t) xdr_remote_domain_get_time_args, (char *) &args, (xdrproc_t) xdr_remote_domain_get_time_ret, (char *) &ret) == -1) goto cleanup; *seconds = ret.seconds; *nseconds = ret.nseconds; xdr_free((xdrproc_t) &xdr_remote_domain_get_time_ret, (char *) &ret); rv = 0; cleanup: remoteDriverUnlock(priv); return rv; } static int remoteNodeGetFreePages(virConnectPtr conn, unsigned int npages, unsigned int *pages, int startCell, unsigned int cellCount, unsigned long long *counts, unsigned int flags) { int rv = -1; remote_node_get_free_pages_args args; remote_node_get_free_pages_ret ret; struct private_data *priv = conn->privateData; remoteDriverLock(priv); if (npages * cellCount > REMOTE_NODE_MAX_CELLS) { virReportError(VIR_ERR_RPC, _("too many NUMA cells: %d > %d"), npages * cellCount, REMOTE_NODE_MAX_CELLS); goto done; } args.pages.pages_val = (u_int *) pages; args.pages.pages_len = npages; args.startCell = startCell; args.cellCount = cellCount; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_FREE_PAGES, (xdrproc_t) xdr_remote_node_get_free_pages_args, (char *)&args, (xdrproc_t) xdr_remote_node_get_free_pages_ret, (char *)&ret) == -1) goto done; memcpy(counts, ret.counts.counts_val, ret.counts.counts_len * sizeof(*counts)); xdr_free((xdrproc_t) xdr_remote_node_get_free_pages_ret, (char *) &ret); rv = ret.counts.counts_len; done: remoteDriverUnlock(priv); return rv; } /* Copy contents of remote_network_dhcp_lease to virNetworkDHCPLeasePtr */ static int remoteSerializeDHCPLease(virNetworkDHCPLeasePtr lease_dst, remote_network_dhcp_lease *lease_src) { lease_dst->expirytime = lease_src->expirytime; lease_dst->type = lease_src->type; lease_dst->prefix = lease_src->prefix; lease_dst->iface = g_strdup(lease_src->iface); lease_dst->ipaddr = g_strdup(lease_src->ipaddr); if (lease_src->mac) { lease_dst->mac = g_strdup(*lease_src->mac); } else { lease_src->mac = NULL; } if (lease_src->iaid) { lease_dst->iaid = g_strdup(*lease_src->iaid); } else { lease_src->iaid = NULL; } if (lease_src->hostname) { lease_dst->hostname = g_strdup(*lease_src->hostname); } else { lease_src->hostname = NULL; } if (lease_src->clientid) { lease_dst->clientid = g_strdup(*lease_src->clientid); } else { lease_src->clientid = NULL; } return 0; } static int remoteNetworkGetDHCPLeases(virNetworkPtr net, const char *mac, virNetworkDHCPLeasePtr **leases, unsigned int flags) { int rv = -1; size_t i; struct private_data *priv = net->conn->privateData; remote_network_get_dhcp_leases_args args; remote_network_get_dhcp_leases_ret ret; virNetworkDHCPLeasePtr *leases_ret = NULL; remoteDriverLock(priv); make_nonnull_network(&args.net, net); args.mac = mac ? (char **) &mac : NULL; args.flags = flags; args.need_results = !!leases; memset(&ret, 0, sizeof(ret)); if (call(net->conn, priv, 0, REMOTE_PROC_NETWORK_GET_DHCP_LEASES, (xdrproc_t)xdr_remote_network_get_dhcp_leases_args, (char *)&args, (xdrproc_t)xdr_remote_network_get_dhcp_leases_ret, (char *)&ret) == -1) goto done; if (ret.leases.leases_len > REMOTE_NETWORK_DHCP_LEASES_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Number of leases is %d, which exceeds max limit: %d"), ret.leases.leases_len, REMOTE_NETWORK_DHCP_LEASES_MAX); goto cleanup; } if (leases) { if (ret.leases.leases_len && VIR_ALLOC_N(leases_ret, ret.leases.leases_len + 1) < 0) goto cleanup; for (i = 0; i < ret.leases.leases_len; i++) { if (VIR_ALLOC(leases_ret[i]) < 0) goto cleanup; if (remoteSerializeDHCPLease(leases_ret[i], &ret.leases.leases_val[i]) < 0) goto cleanup; } *leases = leases_ret; leases_ret = NULL; } rv = ret.ret; cleanup: if (leases_ret) { for (i = 0; i < ret.leases.leases_len; i++) virNetworkDHCPLeaseFree(leases_ret[i]); VIR_FREE(leases_ret); } xdr_free((xdrproc_t)xdr_remote_network_get_dhcp_leases_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteConnectGetAllDomainStats(virConnectPtr conn, virDomainPtr *doms, unsigned int ndoms, unsigned int stats, virDomainStatsRecordPtr **retStats, unsigned int flags) { struct private_data *priv = conn->privateData; int rv = -1; size_t i; remote_connect_get_all_domain_stats_args args; remote_connect_get_all_domain_stats_ret ret; virDomainStatsRecordPtr elem = NULL; virDomainStatsRecordPtr *tmpret = NULL; memset(&args, 0, sizeof(args)); if (ndoms) { if (VIR_ALLOC_N(args.doms.doms_val, ndoms) < 0) goto cleanup; for (i = 0; i < ndoms; i++) make_nonnull_domain(args.doms.doms_val + i, doms[i]); } args.doms.doms_len = ndoms; args.stats = stats; args.flags = flags; memset(&ret, 0, sizeof(ret)); remoteDriverLock(priv); if (call(conn, priv, 0, REMOTE_PROC_CONNECT_GET_ALL_DOMAIN_STATS, (xdrproc_t)xdr_remote_connect_get_all_domain_stats_args, (char *)&args, (xdrproc_t)xdr_remote_connect_get_all_domain_stats_ret, (char *)&ret) == -1) { remoteDriverUnlock(priv); goto cleanup; } remoteDriverUnlock(priv); if (ret.retStats.retStats_len > REMOTE_DOMAIN_LIST_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Number of stats entries is %d, which exceeds max limit: %d"), ret.retStats.retStats_len, REMOTE_DOMAIN_LIST_MAX); goto cleanup; } *retStats = NULL; if (VIR_ALLOC_N(tmpret, ret.retStats.retStats_len + 1) < 0) goto cleanup; for (i = 0; i < ret.retStats.retStats_len; i++) { remote_domain_stats_record *rec = ret.retStats.retStats_val + i; if (VIR_ALLOC(elem) < 0) goto cleanup; if (!(elem->dom = get_nonnull_domain(conn, rec->dom))) goto cleanup; if (virTypedParamsDeserialize((virTypedParameterRemotePtr) rec->params.params_val, rec->params.params_len, REMOTE_CONNECT_GET_ALL_DOMAIN_STATS_MAX, &elem->params, &elem->nparams)) goto cleanup; tmpret[i] = elem; elem = NULL; } *retStats = tmpret; tmpret = NULL; rv = ret.retStats.retStats_len; cleanup: if (elem) { virObjectUnref(elem->dom); VIR_FREE(elem); } virDomainStatsRecordListFree(tmpret); VIR_FREE(args.doms.doms_val); xdr_free((xdrproc_t)xdr_remote_connect_get_all_domain_stats_ret, (char *) &ret); return rv; } static int remoteNodeAllocPages(virConnectPtr conn, unsigned int npages, unsigned int *pageSizes, unsigned long long *pageCounts, int startCell, unsigned int cellCount, unsigned int flags) { int rv = -1; remote_node_alloc_pages_args args; remote_node_alloc_pages_ret ret; struct private_data *priv = conn->privateData; remoteDriverLock(priv); if (npages > REMOTE_NODE_MAX_CELLS) { virReportError(VIR_ERR_RPC, _("too many NUMA cells: %d > %d"), npages, REMOTE_NODE_MAX_CELLS); goto done; } args.pageSizes.pageSizes_val = (u_int *) pageSizes; args.pageSizes.pageSizes_len = npages; args.pageCounts.pageCounts_val = (uint64_t *) pageCounts; args.pageCounts.pageCounts_len = npages; args.startCell = startCell; args.cellCount = cellCount; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_NODE_ALLOC_PAGES, (xdrproc_t) xdr_remote_node_alloc_pages_args, (char *) &args, (xdrproc_t) xdr_remote_node_alloc_pages_ret, (char *) &ret) == -1) goto done; rv = ret.ret; done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetFSInfo(virDomainPtr dom, virDomainFSInfoPtr **info, unsigned int flags) { int rv = -1; size_t i, j, len; struct private_data *priv = dom->conn->privateData; remote_domain_get_fsinfo_args args; remote_domain_get_fsinfo_ret ret; remote_domain_fsinfo *src; virDomainFSInfoPtr *info_ret = NULL; remoteDriverLock(priv); make_nonnull_domain(&args.dom, dom); args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_FSINFO, (xdrproc_t)xdr_remote_domain_get_fsinfo_args, (char *)&args, (xdrproc_t)xdr_remote_domain_get_fsinfo_ret, (char *)&ret) == -1) goto done; if (ret.info.info_len > REMOTE_DOMAIN_FSINFO_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Too many mountpoints in fsinfo: %d for limit %d"), ret.info.info_len, REMOTE_DOMAIN_FSINFO_MAX); goto cleanup; } if (info) { if (!ret.info.info_len) { *info = NULL; rv = ret.ret; goto cleanup; } if (VIR_ALLOC_N(info_ret, ret.info.info_len) < 0) goto cleanup; for (i = 0; i < ret.info.info_len; i++) { src = &ret.info.info_val[i]; if (VIR_ALLOC(info_ret[i]) < 0) goto cleanup; info_ret[i]->mountpoint = g_strdup(src->mountpoint); info_ret[i]->name = g_strdup(src->name); info_ret[i]->fstype = g_strdup(src->fstype); len = src->dev_aliases.dev_aliases_len; info_ret[i]->ndevAlias = len; if (len && VIR_ALLOC_N(info_ret[i]->devAlias, len) < 0) goto cleanup; for (j = 0; j < len; j++) info_ret[i]->devAlias[j] = g_strdup(src->dev_aliases.dev_aliases_val[j]); } *info = info_ret; info_ret = NULL; } rv = ret.ret; cleanup: if (info_ret) { for (i = 0; i < ret.info.info_len; i++) virDomainFSInfoFree(info_ret[i]); VIR_FREE(info_ret); } xdr_free((xdrproc_t)xdr_remote_domain_get_fsinfo_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainInterfaceAddresses(virDomainPtr dom, virDomainInterfacePtr **ifaces, unsigned int source, unsigned int flags) { int rv = -1; size_t i, j; virDomainInterfacePtr *ifaces_ret = NULL; remote_domain_interface_addresses_args args; remote_domain_interface_addresses_ret ret; struct private_data *priv = dom->conn->privateData; args.source = source; args.flags = flags; make_nonnull_domain(&args.dom, dom); remoteDriverLock(priv); memset(&ret, 0, sizeof(ret)); if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_INTERFACE_ADDRESSES, (xdrproc_t)xdr_remote_domain_interface_addresses_args, (char *)&args, (xdrproc_t)xdr_remote_domain_interface_addresses_ret, (char *)&ret) == -1) { goto done; } if (ret.ifaces.ifaces_len > REMOTE_DOMAIN_INTERFACE_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Number of interfaces, %d exceeds the max limit: %d"), ret.ifaces.ifaces_len, REMOTE_DOMAIN_INTERFACE_MAX); goto cleanup; } if (ret.ifaces.ifaces_len && VIR_ALLOC_N(ifaces_ret, ret.ifaces.ifaces_len) < 0) goto cleanup; for (i = 0; i < ret.ifaces.ifaces_len; i++) { virDomainInterfacePtr iface; remote_domain_interface *iface_ret = &(ret.ifaces.ifaces_val[i]); if (VIR_ALLOC(ifaces_ret[i]) < 0) goto cleanup; iface = ifaces_ret[i]; iface->name = g_strdup(iface_ret->name); if (iface_ret->hwaddr) iface->hwaddr = g_strdup(*iface_ret->hwaddr); if (iface_ret->addrs.addrs_len > REMOTE_DOMAIN_IP_ADDR_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Number of interfaces, %d exceeds the max limit: %d"), iface_ret->addrs.addrs_len, REMOTE_DOMAIN_IP_ADDR_MAX); goto cleanup; } iface->naddrs = iface_ret->addrs.addrs_len; if (iface->naddrs) { if (VIR_ALLOC_N(iface->addrs, iface->naddrs) < 0) goto cleanup; for (j = 0; j < iface->naddrs; j++) { virDomainIPAddressPtr ip_addr = &(iface->addrs[j]); remote_domain_ip_addr *ip_addr_ret = &(iface_ret->addrs.addrs_val[j]); ip_addr->addr = g_strdup(ip_addr_ret->addr); ip_addr->prefix = ip_addr_ret->prefix; ip_addr->type = ip_addr_ret->type; } } } *ifaces = ifaces_ret; ifaces_ret = NULL; rv = ret.ifaces.ifaces_len; cleanup: if (ifaces_ret) { for (i = 0; i < ret.ifaces.ifaces_len; i++) virDomainInterfaceFree(ifaces_ret[i]); VIR_FREE(ifaces_ret); } xdr_free((xdrproc_t)xdr_remote_domain_interface_addresses_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteConnectRegisterCloseCallback(virConnectPtr conn, virConnectCloseFunc cb, void *opaque, virFreeCallback freecb) { struct private_data *priv = conn->privateData; int ret = -1; remoteDriverLock(priv); if (virConnectCloseCallbackDataGetCallback(priv->closeCallback) != NULL) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("A close callback is already registered")); goto cleanup; } if (priv->serverCloseCallback && call(conn, priv, 0, REMOTE_PROC_CONNECT_REGISTER_CLOSE_CALLBACK, (xdrproc_t) xdr_void, (char *) NULL, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto cleanup; virConnectCloseCallbackDataRegister(priv->closeCallback, conn, cb, opaque, freecb); ret = 0; cleanup: remoteDriverUnlock(priv); return ret; } static int remoteConnectUnregisterCloseCallback(virConnectPtr conn, virConnectCloseFunc cb) { struct private_data *priv = conn->privateData; int ret = -1; remoteDriverLock(priv); if (virConnectCloseCallbackDataGetCallback(priv->closeCallback) != cb) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("A different callback was requested")); goto cleanup; } if (priv->serverCloseCallback && call(conn, priv, 0, REMOTE_PROC_CONNECT_UNREGISTER_CLOSE_CALLBACK, (xdrproc_t) xdr_void, (char *) NULL, (xdrproc_t) xdr_void, (char *) NULL) == -1) goto cleanup; virConnectCloseCallbackDataUnregister(priv->closeCallback, cb); ret = 0; cleanup: remoteDriverUnlock(priv); return ret; } static int remoteDomainRename(virDomainPtr dom, const char *new_name, unsigned int flags) { int rv = -1; struct private_data *priv = dom->conn->privateData; remote_domain_rename_args args; remote_domain_rename_ret ret; char *tmp = NULL; tmp = g_strdup(new_name); remoteDriverLock(priv); make_nonnull_domain(&args.dom, dom); args.new_name = new_name ? (char **)&new_name : NULL; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_RENAME, (xdrproc_t)xdr_remote_domain_rename_args, (char *)&args, (xdrproc_t)xdr_remote_domain_rename_ret, (char *)&ret) == -1) { goto done; } rv = ret.retcode; if (rv == 0) { VIR_FREE(dom->name); dom->name = tmp; tmp = NULL; } done: remoteDriverUnlock(priv); VIR_FREE(tmp); return rv; } static int remoteStorageVolGetInfoFlags(virStorageVolPtr vol, virStorageVolInfoPtr result, unsigned int flags) { int rv = -1; struct private_data *priv = vol->conn->privateData; remote_storage_vol_get_info_flags_args args; remote_storage_vol_get_info_flags_ret ret; remoteDriverLock(priv); make_nonnull_storage_vol(&args.vol, vol); args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(vol->conn, priv, 0, REMOTE_PROC_STORAGE_VOL_GET_INFO_FLAGS, (xdrproc_t)xdr_remote_storage_vol_get_info_flags_args, (char *)&args, (xdrproc_t)xdr_remote_storage_vol_get_info_flags_ret, (char *)&ret) == -1) { goto done; } result->type = ret.type; result->capacity = ret.capacity; result->allocation = ret.allocation; rv = 0; done: remoteDriverUnlock(priv); return rv; } static int remoteNetworkPortGetParameters(virNetworkPortPtr port, virTypedParameterPtr *params, int *nparams, unsigned int flags) { int rv = -1; struct private_data *priv = port->net->conn->privateData; remote_network_port_get_parameters_args args; remote_network_port_get_parameters_ret ret; remoteDriverLock(priv); make_nonnull_network_port(&args.port, port); args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(port->net->conn, priv, 0, REMOTE_PROC_NETWORK_PORT_GET_PARAMETERS, (xdrproc_t) xdr_remote_network_port_get_parameters_args, (char *) &args, (xdrproc_t) xdr_remote_network_port_get_parameters_ret, (char *) &ret) == -1) goto done; if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_NETWORK_PORT_PARAMETERS_MAX, params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t) xdr_remote_network_port_get_parameters_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int remoteDomainGetGuestInfo(virDomainPtr dom, unsigned int types, virTypedParameterPtr *params, int *nparams, unsigned int flags) { int rv = -1; struct private_data *priv = dom->conn->privateData; remote_domain_get_guest_info_args args; remote_domain_get_guest_info_ret ret; remoteDriverLock(priv); make_nonnull_domain(&args.dom, dom); args.types = types; args.flags = flags; memset(&ret, 0, sizeof(ret)); if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_GUEST_INFO, (xdrproc_t)xdr_remote_domain_get_guest_info_args, (char *)&args, (xdrproc_t)xdr_remote_domain_get_guest_info_ret, (char *)&ret) == -1) goto done; if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, ret.params.params_len, REMOTE_DOMAIN_GUEST_INFO_PARAMS_MAX, params, nparams) < 0) goto cleanup; rv = 0; cleanup: xdr_free((xdrproc_t)xdr_remote_domain_get_guest_info_ret, (char *) &ret); done: remoteDriverUnlock(priv); return rv; } /* get_nonnull_domain and get_nonnull_network turn an on-wire * (name, uuid) pair into virDomainPtr or virNetworkPtr object. * These can return NULL if underlying memory allocations fail, * but if they do then virterror_internal.has been set. */ static virDomainPtr get_nonnull_domain(virConnectPtr conn, remote_nonnull_domain domain) { return virGetDomain(conn, domain.name, BAD_CAST domain.uuid, domain.id); } static virNetworkPtr get_nonnull_network(virConnectPtr conn, remote_nonnull_network network) { return virGetNetwork(conn, network.name, BAD_CAST network.uuid); } static virNetworkPortPtr get_nonnull_network_port(virConnectPtr conn, remote_nonnull_network_port port) { virNetworkPortPtr ret; virNetworkPtr net; net = virGetNetwork(conn, port.net.name, BAD_CAST port.net.uuid); if (!net) return NULL; ret = virGetNetworkPort(net, BAD_CAST port.uuid); virObjectUnref(net); return ret; } static virInterfacePtr get_nonnull_interface(virConnectPtr conn, remote_nonnull_interface iface) { return virGetInterface(conn, iface.name, iface.mac); } static virStoragePoolPtr get_nonnull_storage_pool(virConnectPtr conn, remote_nonnull_storage_pool pool) { return virGetStoragePool(conn, pool.name, BAD_CAST pool.uuid, NULL, NULL); } static virStorageVolPtr get_nonnull_storage_vol(virConnectPtr conn, remote_nonnull_storage_vol vol) { return virGetStorageVol(conn, vol.pool, vol.name, vol.key, NULL, NULL); } static virNodeDevicePtr get_nonnull_node_device(virConnectPtr conn, remote_nonnull_node_device dev) { return virGetNodeDevice(conn, dev.name); } static virSecretPtr get_nonnull_secret(virConnectPtr conn, remote_nonnull_secret secret) { return virGetSecret(conn, BAD_CAST secret.uuid, secret.usageType, secret.usageID); } static virNWFilterPtr get_nonnull_nwfilter(virConnectPtr conn, remote_nonnull_nwfilter nwfilter) { return virGetNWFilter(conn, nwfilter.name, BAD_CAST nwfilter.uuid); } static virNWFilterBindingPtr get_nonnull_nwfilter_binding(virConnectPtr conn, remote_nonnull_nwfilter_binding binding) { return virGetNWFilterBinding(conn, binding.portdev, binding.filtername); } static virDomainCheckpointPtr get_nonnull_domain_checkpoint(virDomainPtr domain, remote_nonnull_domain_checkpoint checkpoint) { return virGetDomainCheckpoint(domain, checkpoint.name); } static virDomainSnapshotPtr get_nonnull_domain_snapshot(virDomainPtr domain, remote_nonnull_domain_snapshot snapshot) { return virGetDomainSnapshot(domain, snapshot.name); } /* Make remote_nonnull_domain and remote_nonnull_network. */ static void make_nonnull_domain(remote_nonnull_domain *dom_dst, virDomainPtr dom_src) { dom_dst->id = dom_src->id; dom_dst->name = dom_src->name; memcpy(dom_dst->uuid, dom_src->uuid, VIR_UUID_BUFLEN); } static void make_nonnull_network(remote_nonnull_network *net_dst, virNetworkPtr net_src) { net_dst->name = net_src->name; memcpy(net_dst->uuid, net_src->uuid, VIR_UUID_BUFLEN); } static void make_nonnull_network_port(remote_nonnull_network_port *port_dst, virNetworkPortPtr port_src) { port_dst->net.name = port_src->net->name; memcpy(port_dst->net.uuid, port_src->net->uuid, VIR_UUID_BUFLEN); memcpy(port_dst->uuid, port_src->uuid, VIR_UUID_BUFLEN); } static void make_nonnull_interface(remote_nonnull_interface *interface_dst, virInterfacePtr interface_src) { interface_dst->name = interface_src->name; interface_dst->mac = interface_src->mac; } static void make_nonnull_storage_pool(remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr pool_src) { pool_dst->name = pool_src->name; memcpy(pool_dst->uuid, pool_src->uuid, VIR_UUID_BUFLEN); } static void make_nonnull_storage_vol(remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src) { vol_dst->pool = vol_src->pool; vol_dst->name = vol_src->name; vol_dst->key = vol_src->key; } static void make_nonnull_secret(remote_nonnull_secret *secret_dst, virSecretPtr secret_src) { memcpy(secret_dst->uuid, secret_src->uuid, VIR_UUID_BUFLEN); secret_dst->usageType = secret_src->usageType; secret_dst->usageID = secret_src->usageID; } static void make_nonnull_node_device(remote_nonnull_node_device *dev_dst, virNodeDevicePtr dev_src) { dev_dst->name = dev_src->name; } static void make_nonnull_nwfilter(remote_nonnull_nwfilter *nwfilter_dst, virNWFilterPtr nwfilter_src) { nwfilter_dst->name = nwfilter_src->name; memcpy(nwfilter_dst->uuid, nwfilter_src->uuid, VIR_UUID_BUFLEN); } static void make_nonnull_nwfilter_binding(remote_nonnull_nwfilter_binding *binding_dst, virNWFilterBindingPtr binding_src) { binding_dst->portdev = binding_src->portdev; binding_dst->filtername = binding_src->filtername; } static void make_nonnull_domain_checkpoint(remote_nonnull_domain_checkpoint *checkpoint_dst, virDomainCheckpointPtr checkpoint_src) { checkpoint_dst->name = checkpoint_src->name; make_nonnull_domain(&checkpoint_dst->dom, checkpoint_src->domain); } static void make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapshot_dst, virDomainSnapshotPtr snapshot_src) { snapshot_dst->name = snapshot_src->name; make_nonnull_domain(&snapshot_dst->dom, snapshot_src->domain); } /*----------------------------------------------------------------------*/ unsigned long remoteVersion(void) { return REMOTE_PROTOCOL_VERSION; } static virHypervisorDriver hypervisor_driver = { .name = "remote", .connectOpen = remoteConnectOpen, /* 0.3.0 */ .connectClose = remoteConnectClose, /* 0.3.0 */ .connectSetIdentity = remoteConnectSetIdentity, /* 5.8.0 */ .connectSupportsFeature = remoteConnectSupportsFeature, /* 0.3.0 */ .connectGetType = remoteConnectGetType, /* 0.3.0 */ .connectGetVersion = remoteConnectGetVersion, /* 0.3.0 */ .connectGetLibVersion = remoteConnectGetLibVersion, /* 0.7.3 */ .connectGetHostname = remoteConnectGetHostname, /* 0.3.0 */ .connectGetSysinfo = remoteConnectGetSysinfo, /* 0.8.8 */ .connectGetMaxVcpus = remoteConnectGetMaxVcpus, /* 0.3.0 */ .nodeGetInfo = remoteNodeGetInfo, /* 0.3.0 */ .connectGetCapabilities = remoteConnectGetCapabilities, /* 0.3.0 */ .connectListDomains = remoteConnectListDomains, /* 0.3.0 */ .connectNumOfDomains = remoteConnectNumOfDomains, /* 0.3.0 */ .connectListAllDomains = remoteConnectListAllDomains, /* 0.9.13 */ .domainCreateXML = remoteDomainCreateXML, /* 0.3.0 */ .domainCreateXMLWithFiles = remoteDomainCreateXMLWithFiles, /* 1.1.1 */ .domainLookupByID = remoteDomainLookupByID, /* 0.3.0 */ .domainLookupByUUID = remoteDomainLookupByUUID, /* 0.3.0 */ .domainLookupByName = remoteDomainLookupByName, /* 0.3.0 */ .domainSuspend = remoteDomainSuspend, /* 0.3.0 */ .domainResume = remoteDomainResume, /* 0.3.0 */ .domainPMSuspendForDuration = remoteDomainPMSuspendForDuration, /* 0.9.10 */ .domainPMWakeup = remoteDomainPMWakeup, /* 0.9.11 */ .domainShutdown = remoteDomainShutdown, /* 0.3.0 */ .domainShutdownFlags = remoteDomainShutdownFlags, /* 0.9.10 */ .domainReboot = remoteDomainReboot, /* 0.3.0 */ .domainReset = remoteDomainReset, /* 0.9.7 */ .domainDestroy = remoteDomainDestroy, /* 0.3.0 */ .domainDestroyFlags = remoteDomainDestroyFlags, /* 0.9.4 */ .domainGetOSType = remoteDomainGetOSType, /* 0.3.0 */ .domainGetMaxMemory = remoteDomainGetMaxMemory, /* 0.3.0 */ .domainSetMaxMemory = remoteDomainSetMaxMemory, /* 0.3.0 */ .domainSetMemory = remoteDomainSetMemory, /* 0.3.0 */ .domainSetMemoryFlags = remoteDomainSetMemoryFlags, /* 0.9.0 */ .domainSetMemoryStatsPeriod = remoteDomainSetMemoryStatsPeriod, /* 1.1.1 */ .domainSetMemoryParameters = remoteDomainSetMemoryParameters, /* 0.8.5 */ .domainGetMemoryParameters = remoteDomainGetMemoryParameters, /* 0.8.5 */ .domainSetBlkioParameters = remoteDomainSetBlkioParameters, /* 0.9.0 */ .domainGetBlkioParameters = remoteDomainGetBlkioParameters, /* 0.9.0 */ .domainGetPerfEvents = remoteDomainGetPerfEvents, /* 1.3.3 */ .domainSetPerfEvents = remoteDomainSetPerfEvents, /* 1.3.3 */ .domainGetInfo = remoteDomainGetInfo, /* 0.3.0 */ .domainGetState = remoteDomainGetState, /* 0.9.2 */ .domainGetControlInfo = remoteDomainGetControlInfo, /* 0.9.3 */ .domainSave = remoteDomainSave, /* 0.3.0 */ .domainSaveFlags = remoteDomainSaveFlags, /* 0.9.4 */ .domainRestore = remoteDomainRestore, /* 0.3.0 */ .domainRestoreFlags = remoteDomainRestoreFlags, /* 0.9.4 */ .domainSaveImageGetXMLDesc = remoteDomainSaveImageGetXMLDesc, /* 0.9.4 */ .domainSaveImageDefineXML = remoteDomainSaveImageDefineXML, /* 0.9.4 */ .domainCoreDump = remoteDomainCoreDump, /* 0.3.0 */ .domainCoreDumpWithFormat = remoteDomainCoreDumpWithFormat, /* 1.2.3 */ .domainScreenshot = remoteDomainScreenshot, /* 0.9.2 */ .domainSetVcpus = remoteDomainSetVcpus, /* 0.3.0 */ .domainSetVcpusFlags = remoteDomainSetVcpusFlags, /* 0.8.5 */ .domainGetVcpusFlags = remoteDomainGetVcpusFlags, /* 0.8.5 */ .domainPinVcpu = remoteDomainPinVcpu, /* 0.3.0 */ .domainPinVcpuFlags = remoteDomainPinVcpuFlags, /* 0.9.3 */ .domainGetVcpuPinInfo = remoteDomainGetVcpuPinInfo, /* 0.9.3 */ .domainPinEmulator = remoteDomainPinEmulator, /* 0.10.0 */ .domainGetEmulatorPinInfo = remoteDomainGetEmulatorPinInfo, /* 0.10.0 */ .domainGetVcpus = remoteDomainGetVcpus, /* 0.3.0 */ .domainGetMaxVcpus = remoteDomainGetMaxVcpus, /* 0.3.0 */ .domainGetIOThreadInfo = remoteDomainGetIOThreadInfo, /* 1.2.14 */ .domainPinIOThread = remoteDomainPinIOThread, /* 1.2.14 */ .domainAddIOThread = remoteDomainAddIOThread, /* 1.2.15 */ .domainDelIOThread = remoteDomainDelIOThread, /* 1.2.15 */ .domainSetIOThreadParams = remoteDomainSetIOThreadParams, /* 4.10.0 */ .domainGetSecurityLabel = remoteDomainGetSecurityLabel, /* 0.6.1 */ .domainGetSecurityLabelList = remoteDomainGetSecurityLabelList, /* 0.10.0 */ .nodeGetSecurityModel = remoteNodeGetSecurityModel, /* 0.6.1 */ .domainGetXMLDesc = remoteDomainGetXMLDesc, /* 0.3.0 */ .connectDomainXMLFromNative = remoteConnectDomainXMLFromNative, /* 0.6.4 */ .connectDomainXMLToNative = remoteConnectDomainXMLToNative, /* 0.6.4 */ .connectListDefinedDomains = remoteConnectListDefinedDomains, /* 0.3.0 */ .connectNumOfDefinedDomains = remoteConnectNumOfDefinedDomains, /* 0.3.0 */ .domainCreate = remoteDomainCreate, /* 0.3.0 */ .domainCreateWithFlags = remoteDomainCreateWithFlags, /* 0.8.2 */ .domainCreateWithFiles = remoteDomainCreateWithFiles, /* 1.1.1 */ .domainDefineXML = remoteDomainDefineXML, /* 0.3.0 */ .domainDefineXMLFlags = remoteDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = remoteDomainUndefine, /* 0.3.0 */ .domainUndefineFlags = remoteDomainUndefineFlags, /* 0.9.4 */ .domainAttachDevice = remoteDomainAttachDevice, /* 0.3.0 */ .domainAttachDeviceFlags = remoteDomainAttachDeviceFlags, /* 0.7.7 */ .domainDetachDevice = remoteDomainDetachDevice, /* 0.3.0 */ .domainDetachDeviceFlags = remoteDomainDetachDeviceFlags, /* 0.7.7 */ .domainUpdateDeviceFlags = remoteDomainUpdateDeviceFlags, /* 0.8.0 */ .domainDetachDeviceAlias = remoteDomainDetachDeviceAlias, /* 4.4.0 */ .domainGetAutostart = remoteDomainGetAutostart, /* 0.3.0 */ .domainSetAutostart = remoteDomainSetAutostart, /* 0.3.0 */ .domainGetSchedulerType = remoteDomainGetSchedulerType, /* 0.3.0 */ .domainGetSchedulerParameters = remoteDomainGetSchedulerParameters, /* 0.3.0 */ .domainGetSchedulerParametersFlags = remoteDomainGetSchedulerParametersFlags, /* 0.9.2 */ .domainSetSchedulerParameters = remoteDomainSetSchedulerParameters, /* 0.3.0 */ .domainSetSchedulerParametersFlags = remoteDomainSetSchedulerParametersFlags, /* 0.9.2 */ .domainMigratePrepare = remoteDomainMigratePrepare, /* 0.3.2 */ .domainMigratePerform = remoteDomainMigratePerform, /* 0.3.2 */ .domainMigrateFinish = remoteDomainMigrateFinish, /* 0.3.2 */ .domainBlockResize = remoteDomainBlockResize, /* 0.9.8 */ .domainBlockStats = remoteDomainBlockStats, /* 0.3.2 */ .domainBlockStatsFlags = remoteDomainBlockStatsFlags, /* 0.9.5 */ .domainInterfaceStats = remoteDomainInterfaceStats, /* 0.3.2 */ .domainSetInterfaceParameters = remoteDomainSetInterfaceParameters, /* 0.9.9 */ .domainGetInterfaceParameters = remoteDomainGetInterfaceParameters, /* 0.9.9 */ .domainMemoryStats = remoteDomainMemoryStats, /* 0.7.5 */ .domainBlockPeek = remoteDomainBlockPeek, /* 0.4.2 */ .domainMemoryPeek = remoteDomainMemoryPeek, /* 0.4.2 */ .domainGetBlockInfo = remoteDomainGetBlockInfo, /* 0.8.1 */ .nodeGetCPUStats = remoteNodeGetCPUStats, /* 0.9.3 */ .nodeGetMemoryStats = remoteNodeGetMemoryStats, /* 0.9.3 */ .nodeGetCellsFreeMemory = remoteNodeGetCellsFreeMemory, /* 0.3.3 */ .nodeGetFreeMemory = remoteNodeGetFreeMemory, /* 0.3.3 */ .connectDomainEventRegister = remoteConnectDomainEventRegister, /* 0.5.0 */ .connectDomainEventDeregister = remoteConnectDomainEventDeregister, /* 0.5.0 */ .domainMigratePrepare2 = remoteDomainMigratePrepare2, /* 0.5.0 */ .domainMigrateFinish2 = remoteDomainMigrateFinish2, /* 0.5.0 */ .nodeDeviceDettach = remoteNodeDeviceDettach, /* 0.6.1 */ .nodeDeviceDetachFlags = remoteNodeDeviceDetachFlags, /* 1.0.5 */ .nodeDeviceReAttach = remoteNodeDeviceReAttach, /* 0.6.1 */ .nodeDeviceReset = remoteNodeDeviceReset, /* 0.6.1 */ .domainMigratePrepareTunnel = remoteDomainMigratePrepareTunnel, /* 0.7.2 */ .connectIsEncrypted = remoteConnectIsEncrypted, /* 0.7.3 */ .connectIsSecure = remoteConnectIsSecure, /* 0.7.3 */ .domainIsActive = remoteDomainIsActive, /* 0.7.3 */ .domainIsPersistent = remoteDomainIsPersistent, /* 0.7.3 */ .domainIsUpdated = remoteDomainIsUpdated, /* 0.8.6 */ .connectCompareCPU = remoteConnectCompareCPU, /* 0.7.5 */ .connectBaselineCPU = remoteConnectBaselineCPU, /* 0.7.7 */ .domainGetJobInfo = remoteDomainGetJobInfo, /* 0.7.7 */ .domainGetJobStats = remoteDomainGetJobStats, /* 1.0.3 */ .domainAbortJob = remoteDomainAbortJob, /* 0.7.7 */ .domainMigrateGetMaxDowntime = remoteDomainMigrateGetMaxDowntime, /* 3.7.0 */ .domainMigrateSetMaxDowntime = remoteDomainMigrateSetMaxDowntime, /* 0.8.0 */ .domainMigrateGetCompressionCache = remoteDomainMigrateGetCompressionCache, /* 1.0.3 */ .domainMigrateSetCompressionCache = remoteDomainMigrateSetCompressionCache, /* 1.0.3 */ .domainMigrateSetMaxSpeed = remoteDomainMigrateSetMaxSpeed, /* 0.9.0 */ .domainMigrateGetMaxSpeed = remoteDomainMigrateGetMaxSpeed, /* 0.9.5 */ .connectDomainEventRegisterAny = remoteConnectDomainEventRegisterAny, /* 0.8.0 */ .connectDomainEventDeregisterAny = remoteConnectDomainEventDeregisterAny, /* 0.8.0 */ .domainManagedSave = remoteDomainManagedSave, /* 0.8.0 */ .domainHasManagedSaveImage = remoteDomainHasManagedSaveImage, /* 0.8.0 */ .domainManagedSaveRemove = remoteDomainManagedSaveRemove, /* 0.8.0 */ .domainManagedSaveGetXMLDesc = remoteDomainManagedSaveGetXMLDesc, /* 3.7.0 */ .domainManagedSaveDefineXML = remoteDomainManagedSaveDefineXML, /* 3.7.0 */ .domainSnapshotCreateXML = remoteDomainSnapshotCreateXML, /* 0.8.0 */ .domainSnapshotGetXMLDesc = remoteDomainSnapshotGetXMLDesc, /* 0.8.0 */ .domainSnapshotNum = remoteDomainSnapshotNum, /* 0.8.0 */ .domainSnapshotListNames = remoteDomainSnapshotListNames, /* 0.8.0 */ .domainListAllSnapshots = remoteDomainListAllSnapshots, /* 0.9.13 */ .domainSnapshotNumChildren = remoteDomainSnapshotNumChildren, /* 0.9.7 */ .domainSnapshotListAllChildren = remoteDomainSnapshotListAllChildren, /* 0.9.13 */ .domainSnapshotListChildrenNames = remoteDomainSnapshotListChildrenNames, /* 0.9.7 */ .domainSnapshotLookupByName = remoteDomainSnapshotLookupByName, /* 0.8.0 */ .domainHasCurrentSnapshot = remoteDomainHasCurrentSnapshot, /* 0.8.0 */ .domainSnapshotGetParent = remoteDomainSnapshotGetParent, /* 0.9.7 */ .domainSnapshotCurrent = remoteDomainSnapshotCurrent, /* 0.8.0 */ .domainRevertToSnapshot = remoteDomainRevertToSnapshot, /* 0.8.0 */ .domainSnapshotIsCurrent = remoteDomainSnapshotIsCurrent, /* 0.9.13 */ .domainSnapshotHasMetadata = remoteDomainSnapshotHasMetadata, /* 0.9.13 */ .domainSnapshotDelete = remoteDomainSnapshotDelete, /* 0.8.0 */ .domainQemuMonitorCommand = remoteDomainQemuMonitorCommand, /* 0.8.3 */ .domainQemuAttach = remoteDomainQemuAttach, /* 0.9.4 */ .domainQemuAgentCommand = remoteDomainQemuAgentCommand, /* 0.10.0 */ .connectDomainQemuMonitorEventRegister = remoteConnectDomainQemuMonitorEventRegister, /* 1.2.3 */ .connectDomainQemuMonitorEventDeregister = remoteConnectDomainQemuMonitorEventDeregister, /* 1.2.3 */ .domainOpenConsole = remoteDomainOpenConsole, /* 0.8.6 */ .domainOpenChannel = remoteDomainOpenChannel, /* 1.0.2 */ .domainOpenGraphics = remoteDomainOpenGraphics, /* 0.9.7 */ .domainOpenGraphicsFD = remoteDomainOpenGraphicsFD, /* 1.2.8 */ .domainInjectNMI = remoteDomainInjectNMI, /* 0.9.2 */ .domainMigrateBegin3 = remoteDomainMigrateBegin3, /* 0.9.2 */ .domainMigratePrepare3 = remoteDomainMigratePrepare3, /* 0.9.2 */ .domainMigratePrepareTunnel3 = remoteDomainMigratePrepareTunnel3, /* 0.9.2 */ .domainMigratePerform3 = remoteDomainMigratePerform3, /* 0.9.2 */ .domainMigrateFinish3 = remoteDomainMigrateFinish3, /* 0.9.2 */ .domainMigrateConfirm3 = remoteDomainMigrateConfirm3, /* 0.9.2 */ .domainSendKey = remoteDomainSendKey, /* 0.9.3 */ .domainSendProcessSignal = remoteDomainSendProcessSignal, /* 1.0.1 */ .domainBlockJobAbort = remoteDomainBlockJobAbort, /* 0.9.4 */ .domainGetBlockJobInfo = remoteDomainGetBlockJobInfo, /* 0.9.4 */ .domainBlockJobSetSpeed = remoteDomainBlockJobSetSpeed, /* 0.9.4 */ .domainBlockPull = remoteDomainBlockPull, /* 0.9.4 */ .domainBlockRebase = remoteDomainBlockRebase, /* 0.9.10 */ .domainBlockCopy = remoteDomainBlockCopy, /* 1.2.9 */ .domainBlockCommit = remoteDomainBlockCommit, /* 0.10.2 */ .connectSetKeepAlive = remoteConnectSetKeepAlive, /* 0.9.8 */ .connectIsAlive = remoteConnectIsAlive, /* 0.9.8 */ .nodeSuspendForDuration = remoteNodeSuspendForDuration, /* 0.9.8 */ .domainSetBlockIoTune = remoteDomainSetBlockIoTune, /* 0.9.8 */ .domainGetBlockIoTune = remoteDomainGetBlockIoTune, /* 0.9.8 */ .domainSetNumaParameters = remoteDomainSetNumaParameters, /* 0.9.9 */ .domainGetNumaParameters = remoteDomainGetNumaParameters, /* 0.9.9 */ .domainGetCPUStats = remoteDomainGetCPUStats, /* 0.9.10 */ .domainGetDiskErrors = remoteDomainGetDiskErrors, /* 0.9.10 */ .domainSetMetadata = remoteDomainSetMetadata, /* 0.9.10 */ .domainGetMetadata = remoteDomainGetMetadata, /* 0.9.10 */ .domainGetHostname = remoteDomainGetHostname, /* 0.10.0 */ .nodeSetMemoryParameters = remoteNodeSetMemoryParameters, /* 0.10.2 */ .nodeGetMemoryParameters = remoteNodeGetMemoryParameters, /* 0.10.2 */ .nodeGetCPUMap = remoteNodeGetCPUMap, /* 1.0.0 */ .domainFSTrim = remoteDomainFSTrim, /* 1.0.1 */ .domainLxcOpenNamespace = remoteDomainLxcOpenNamespace, /* 1.0.2 */ .domainMigrateBegin3Params = remoteDomainMigrateBegin3Params, /* 1.1.0 */ .domainMigratePrepare3Params = remoteDomainMigratePrepare3Params, /* 1.1.0 */ .domainMigratePrepareTunnel3Params = remoteDomainMigratePrepareTunnel3Params, /* 1.1.0 */ .domainMigratePerform3Params = remoteDomainMigratePerform3Params, /* 1.1.0 */ .domainMigrateFinish3Params = remoteDomainMigrateFinish3Params, /* 1.1.0 */ .domainMigrateConfirm3Params = remoteDomainMigrateConfirm3Params, /* 1.1.0 */ .connectGetCPUModelNames = remoteConnectGetCPUModelNames, /* 1.1.3 */ .domainFSFreeze = remoteDomainFSFreeze, /* 1.2.5 */ .domainFSThaw = remoteDomainFSThaw, /* 1.2.5 */ .domainGetTime = remoteDomainGetTime, /* 1.2.5 */ .domainSetTime = remoteDomainSetTime, /* 1.2.5 */ .nodeGetFreePages = remoteNodeGetFreePages, /* 1.2.6 */ .connectGetDomainCapabilities = remoteConnectGetDomainCapabilities, /* 1.2.7 */ .connectGetAllDomainStats = remoteConnectGetAllDomainStats, /* 1.2.8 */ .nodeAllocPages = remoteNodeAllocPages, /* 1.2.9 */ .domainGetFSInfo = remoteDomainGetFSInfo, /* 1.2.11 */ .domainInterfaceAddresses = remoteDomainInterfaceAddresses, /* 1.2.14 */ .domainSetUserPassword = remoteDomainSetUserPassword, /* 1.2.16 */ .domainRename = remoteDomainRename, /* 1.2.19 */ .connectRegisterCloseCallback = remoteConnectRegisterCloseCallback, /* 1.3.2 */ .connectUnregisterCloseCallback = remoteConnectUnregisterCloseCallback, /* 1.3.2 */ .domainMigrateStartPostCopy = remoteDomainMigrateStartPostCopy, /* 1.3.3 */ .domainGetGuestVcpus = remoteDomainGetGuestVcpus, /* 2.0.0 */ .domainSetGuestVcpus = remoteDomainSetGuestVcpus, /* 2.0.0 */ .domainSetVcpu = remoteDomainSetVcpu, /* 3.1.0 */ .domainSetBlockThreshold = remoteDomainSetBlockThreshold, /* 3.2.0 */ .domainSetLifecycleAction = remoteDomainSetLifecycleAction, /* 3.9.0 */ .connectCompareHypervisorCPU = remoteConnectCompareHypervisorCPU, /* 4.4.0 */ .connectBaselineHypervisorCPU = remoteConnectBaselineHypervisorCPU, /* 4.4.0 */ .nodeGetSEVInfo = remoteNodeGetSEVInfo, /* 4.5.0 */ .domainGetLaunchSecurityInfo = remoteDomainGetLaunchSecurityInfo, /* 4.5.0 */ .domainCheckpointCreateXML = remoteDomainCheckpointCreateXML, /* 5.6.0 */ .domainCheckpointGetXMLDesc = remoteDomainCheckpointGetXMLDesc, /* 5.6.0 */ .domainListAllCheckpoints = remoteDomainListAllCheckpoints, /* 5.6.0 */ .domainCheckpointListAllChildren = remoteDomainCheckpointListAllChildren, /* 5.6.0 */ .domainCheckpointLookupByName = remoteDomainCheckpointLookupByName, /* 5.6.0 */ .domainCheckpointGetParent = remoteDomainCheckpointGetParent, /* 5.6.0 */ .domainCheckpointDelete = remoteDomainCheckpointDelete, /* 5.6.0 */ .domainGetGuestInfo = remoteDomainGetGuestInfo, /* 5.7.0 */ .domainAgentSetResponseTimeout = remoteDomainAgentSetResponseTimeout, /* 5.10.0 */ .domainBackupBegin = remoteDomainBackupBegin, /* 6.0.0 */ .domainBackupGetXMLDesc = remoteDomainBackupGetXMLDesc, /* 6.0.0 */ }; static virNetworkDriver network_driver = { .connectNumOfNetworks = remoteConnectNumOfNetworks, /* 0.3.0 */ .connectListNetworks = remoteConnectListNetworks, /* 0.3.0 */ .connectNumOfDefinedNetworks = remoteConnectNumOfDefinedNetworks, /* 0.3.0 */ .connectListDefinedNetworks = remoteConnectListDefinedNetworks, /* 0.3.0 */ .connectListAllNetworks = remoteConnectListAllNetworks, /* 0.10.2 */ .connectNetworkEventDeregisterAny = remoteConnectNetworkEventDeregisterAny, /* 1.2.1 */ .connectNetworkEventRegisterAny = remoteConnectNetworkEventRegisterAny, /* 1.2.1 */ .networkLookupByUUID = remoteNetworkLookupByUUID, /* 0.3.0 */ .networkLookupByName = remoteNetworkLookupByName, /* 0.3.0 */ .networkCreateXML = remoteNetworkCreateXML, /* 0.3.0 */ .networkDefineXML = remoteNetworkDefineXML, /* 0.3.0 */ .networkUndefine = remoteNetworkUndefine, /* 0.3.0 */ .networkUpdate = remoteNetworkUpdate, /* 0.10.2 */ .networkCreate = remoteNetworkCreate, /* 0.3.0 */ .networkDestroy = remoteNetworkDestroy, /* 0.3.0 */ .networkGetXMLDesc = remoteNetworkGetXMLDesc, /* 0.3.0 */ .networkGetBridgeName = remoteNetworkGetBridgeName, /* 0.3.0 */ .networkGetAutostart = remoteNetworkGetAutostart, /* 0.3.0 */ .networkSetAutostart = remoteNetworkSetAutostart, /* 0.3.0 */ .networkIsActive = remoteNetworkIsActive, /* 0.7.3 */ .networkIsPersistent = remoteNetworkIsPersistent, /* 0.7.3 */ .networkGetDHCPLeases = remoteNetworkGetDHCPLeases, /* 1.2.6 */ .networkListAllPorts = remoteNetworkListAllPorts, /* 5.5.0 */ .networkPortLookupByUUID = remoteNetworkPortLookupByUUID, /* 5.5.0 */ .networkPortCreateXML = remoteNetworkPortCreateXML, /* 5.5.0 */ .networkPortGetXMLDesc = remoteNetworkPortGetXMLDesc, /* 5.5.0 */ .networkPortSetParameters = remoteNetworkPortSetParameters, /* 5.5.0 */ .networkPortGetParameters = remoteNetworkPortGetParameters, /* 5.5.0 */ .networkPortDelete = remoteNetworkPortDelete, /* 5.5.0 */ }; static virInterfaceDriver interface_driver = { .connectNumOfInterfaces = remoteConnectNumOfInterfaces, /* 0.7.2 */ .connectListInterfaces = remoteConnectListInterfaces, /* 0.7.2 */ .connectNumOfDefinedInterfaces = remoteConnectNumOfDefinedInterfaces, /* 0.7.2 */ .connectListDefinedInterfaces = remoteConnectListDefinedInterfaces, /* 0.7.2 */ .connectListAllInterfaces = remoteConnectListAllInterfaces, /* 0.10.2 */ .interfaceLookupByName = remoteInterfaceLookupByName, /* 0.7.2 */ .interfaceLookupByMACString = remoteInterfaceLookupByMACString, /* 0.7.2 */ .interfaceGetXMLDesc = remoteInterfaceGetXMLDesc, /* 0.7.2 */ .interfaceDefineXML = remoteInterfaceDefineXML, /* 0.7.2 */ .interfaceUndefine = remoteInterfaceUndefine, /* 0.7.2 */ .interfaceCreate = remoteInterfaceCreate, /* 0.7.2 */ .interfaceDestroy = remoteInterfaceDestroy, /* 0.7.2 */ .interfaceIsActive = remoteInterfaceIsActive, /* 0.7.3 */ .interfaceChangeBegin = remoteInterfaceChangeBegin, /* 0.9.2 */ .interfaceChangeCommit = remoteInterfaceChangeCommit, /* 0.9.2 */ .interfaceChangeRollback = remoteInterfaceChangeRollback, /* 0.9.2 */ }; static virStorageDriver storage_driver = { .connectNumOfStoragePools = remoteConnectNumOfStoragePools, /* 0.4.1 */ .connectListStoragePools = remoteConnectListStoragePools, /* 0.4.1 */ .connectNumOfDefinedStoragePools = remoteConnectNumOfDefinedStoragePools, /* 0.4.1 */ .connectListDefinedStoragePools = remoteConnectListDefinedStoragePools, /* 0.4.1 */ .connectListAllStoragePools = remoteConnectListAllStoragePools, /* 0.10.2 */ .connectFindStoragePoolSources = remoteConnectFindStoragePoolSources, /* 0.4.5 */ .connectStoragePoolEventDeregisterAny = remoteConnectStoragePoolEventDeregisterAny, /* 2.0.0 */ .connectStoragePoolEventRegisterAny = remoteConnectStoragePoolEventRegisterAny, /* 2.0.0 */ .connectGetStoragePoolCapabilities = remoteConnectGetStoragePoolCapabilities, /* 5.2.0 */ .storagePoolLookupByName = remoteStoragePoolLookupByName, /* 0.4.1 */ .storagePoolLookupByUUID = remoteStoragePoolLookupByUUID, /* 0.4.1 */ .storagePoolLookupByVolume = remoteStoragePoolLookupByVolume, /* 0.4.1 */ .storagePoolLookupByTargetPath = remoteStoragePoolLookupByTargetPath, /* 4.1.0 */ .storagePoolCreateXML = remoteStoragePoolCreateXML, /* 0.4.1 */ .storagePoolDefineXML = remoteStoragePoolDefineXML, /* 0.4.1 */ .storagePoolBuild = remoteStoragePoolBuild, /* 0.4.1 */ .storagePoolUndefine = remoteStoragePoolUndefine, /* 0.4.1 */ .storagePoolCreate = remoteStoragePoolCreate, /* 0.4.1 */ .storagePoolDestroy = remoteStoragePoolDestroy, /* 0.4.1 */ .storagePoolDelete = remoteStoragePoolDelete, /* 0.4.1 */ .storagePoolRefresh = remoteStoragePoolRefresh, /* 0.4.1 */ .storagePoolGetInfo = remoteStoragePoolGetInfo, /* 0.4.1 */ .storagePoolGetXMLDesc = remoteStoragePoolGetXMLDesc, /* 0.4.1 */ .storagePoolGetAutostart = remoteStoragePoolGetAutostart, /* 0.4.1 */ .storagePoolSetAutostart = remoteStoragePoolSetAutostart, /* 0.4.1 */ .storagePoolNumOfVolumes = remoteStoragePoolNumOfVolumes, /* 0.4.1 */ .storagePoolListVolumes = remoteStoragePoolListVolumes, /* 0.4.1 */ .storagePoolListAllVolumes = remoteStoragePoolListAllVolumes, /* 0.10.0 */ .storageVolLookupByName = remoteStorageVolLookupByName, /* 0.4.1 */ .storageVolLookupByKey = remoteStorageVolLookupByKey, /* 0.4.1 */ .storageVolLookupByPath = remoteStorageVolLookupByPath, /* 0.4.1 */ .storageVolCreateXML = remoteStorageVolCreateXML, /* 0.4.1 */ .storageVolCreateXMLFrom = remoteStorageVolCreateXMLFrom, /* 0.6.4 */ .storageVolDownload = remoteStorageVolDownload, /* 0.9.0 */ .storageVolUpload = remoteStorageVolUpload, /* 0.9.0 */ .storageVolDelete = remoteStorageVolDelete, /* 0.4.1 */ .storageVolWipe = remoteStorageVolWipe, /* 0.8.0 */ .storageVolWipePattern = remoteStorageVolWipePattern, /* 0.9.10 */ .storageVolGetInfo = remoteStorageVolGetInfo, /* 0.4.1 */ .storageVolGetInfoFlags = remoteStorageVolGetInfoFlags, /* 3.0.0 */ .storageVolGetXMLDesc = remoteStorageVolGetXMLDesc, /* 0.4.1 */ .storageVolGetPath = remoteStorageVolGetPath, /* 0.4.1 */ .storageVolResize = remoteStorageVolResize, /* 0.9.10 */ .storagePoolIsActive = remoteStoragePoolIsActive, /* 0.7.3 */ .storagePoolIsPersistent = remoteStoragePoolIsPersistent, /* 0.7.3 */ }; static virSecretDriver secret_driver = { .connectNumOfSecrets = remoteConnectNumOfSecrets, /* 0.7.1 */ .connectListSecrets = remoteConnectListSecrets, /* 0.7.1 */ .connectListAllSecrets = remoteConnectListAllSecrets, /* 0.10.2 */ .secretLookupByUUID = remoteSecretLookupByUUID, /* 0.7.1 */ .secretLookupByUsage = remoteSecretLookupByUsage, /* 0.7.1 */ .secretDefineXML = remoteSecretDefineXML, /* 0.7.1 */ .secretGetXMLDesc = remoteSecretGetXMLDesc, /* 0.7.1 */ .secretSetValue = remoteSecretSetValue, /* 0.7.1 */ .secretGetValue = remoteSecretGetValue, /* 0.7.1 */ .secretUndefine = remoteSecretUndefine, /* 0.7.1 */ .connectSecretEventDeregisterAny = remoteConnectSecretEventDeregisterAny, /* 3.0.0 */ .connectSecretEventRegisterAny = remoteConnectSecretEventRegisterAny, /* 3.0.0 */ }; static virNodeDeviceDriver node_device_driver = { .connectNodeDeviceEventDeregisterAny = remoteConnectNodeDeviceEventDeregisterAny, /* 2.2.0 */ .connectNodeDeviceEventRegisterAny = remoteConnectNodeDeviceEventRegisterAny, /* 2.2.0 */ .nodeNumOfDevices = remoteNodeNumOfDevices, /* 0.5.0 */ .nodeListDevices = remoteNodeListDevices, /* 0.5.0 */ .connectListAllNodeDevices = remoteConnectListAllNodeDevices, /* 0.10.2 */ .nodeDeviceLookupByName = remoteNodeDeviceLookupByName, /* 0.5.0 */ .nodeDeviceLookupSCSIHostByWWN = remoteNodeDeviceLookupSCSIHostByWWN, /* 1.0.2 */ .nodeDeviceGetXMLDesc = remoteNodeDeviceGetXMLDesc, /* 0.5.0 */ .nodeDeviceGetParent = remoteNodeDeviceGetParent, /* 0.5.0 */ .nodeDeviceNumOfCaps = remoteNodeDeviceNumOfCaps, /* 0.5.0 */ .nodeDeviceListCaps = remoteNodeDeviceListCaps, /* 0.5.0 */ .nodeDeviceCreateXML = remoteNodeDeviceCreateXML, /* 0.6.3 */ .nodeDeviceDestroy = remoteNodeDeviceDestroy /* 0.6.3 */ }; static virNWFilterDriver nwfilter_driver = { .nwfilterLookupByUUID = remoteNWFilterLookupByUUID, /* 0.8.0 */ .nwfilterLookupByName = remoteNWFilterLookupByName, /* 0.8.0 */ .nwfilterGetXMLDesc = remoteNWFilterGetXMLDesc, /* 0.8.0 */ .nwfilterDefineXML = remoteNWFilterDefineXML, /* 0.8.0 */ .nwfilterUndefine = remoteNWFilterUndefine, /* 0.8.0 */ .connectNumOfNWFilters = remoteConnectNumOfNWFilters, /* 0.8.0 */ .connectListNWFilters = remoteConnectListNWFilters, /* 0.8.0 */ .connectListAllNWFilters = remoteConnectListAllNWFilters, /* 0.10.2 */ .connectListAllNWFilterBindings = remoteConnectListAllNWFilterBindings, /* 4.5.0 */ .nwfilterBindingLookupByPortDev = remoteNWFilterBindingLookupByPortDev, /* 4.5.0 */ .nwfilterBindingCreateXML = remoteNWFilterBindingCreateXML, /* 4.5.0 */ .nwfilterBindingDelete = remoteNWFilterBindingDelete, /* 4.5.0 */ .nwfilterBindingGetXMLDesc = remoteNWFilterBindingGetXMLDesc, /* 4.5.0 */ }; static virConnectDriver connect_driver = { .hypervisorDriver = &hypervisor_driver, .interfaceDriver = &interface_driver, .networkDriver = &network_driver, .nodeDeviceDriver = &node_device_driver, .nwfilterDriver = &nwfilter_driver, .secretDriver = &secret_driver, .storageDriver = &storage_driver, }; static virStateDriver state_driver = { .name = "Remote", .stateInitialize = remoteStateInitialize, }; /** remoteRegister: * * Register driver with libvirt driver system. * * Returns -1 on error. */ int remoteRegister(void) { if (virRegisterConnectDriver(&connect_driver, false) < 0) return -1; if (virRegisterStateDriver(&state_driver) < 0) return -1; return 0; }
lgpl-2.1
kajona/kajonacms
module_pdf/legacy/class_pdf_tcpdf.php
516
<?php /*"****************************************************************************************************** * (c) 2016 by Kajona, www.kajona.de * * Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt * ********************************************************************************************************/ /** * @deprecated */ class class_pdf_tcpdf extends Kajona\Pdf\System\PdfTcpdf { }
lgpl-2.1
wood-galaxy/FreeCAD
src/Tools/generateBase/generateModel_Module.py
101247
#!/usr/bin/env python # # Generated Thu Jul 22 14:11:34 2010 by generateDS.py. # import sys import getopt from xml.dom import minidom from xml.dom import Node # # If you have installed IPython you can uncomment and use the following. # IPython is available from http://ipython.scipy.org/. # ## from IPython.Shell import IPShellEmbed ## args = '' ## ipshell = IPShellEmbed(args, ## banner = 'Dropping into IPython', ## exit_msg = 'Leaving Interpreter, back to program.') # Then use the following line where and when you want to drop into the # IPython shell: # ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit') # # Support/utility functions. # def showIndent(outfile, level): for idx in range(level): outfile.write(' ') def quote_xml(inStr): s1 = inStr s1 = s1.replace('&', '&amp;') s1 = s1.replace('<', '&lt;') s1 = s1.replace('"', '&quot;') return s1 def quote_python(inStr): s1 = inStr if s1.find("'") == -1: if s1.find('\n') == -1: return "'%s'" % s1 else: return "'''%s'''" % s1 else: if s1.find('"') != -1: s1 = s1.replace('"', '\\"') if s1.find('\n') == -1: return '"%s"' % s1 else: return '"""%s"""' % s1 class MixedContainer: # Constants for category: CategoryNone = 0 CategoryText = 1 CategorySimple = 2 CategoryComplex = 3 # Constants for content_type: TypeNone = 0 TypeText = 1 TypeString = 2 TypeInteger = 3 TypeFloat = 4 TypeDecimal = 5 TypeDouble = 6 TypeBoolean = 7 def __init__(self, category, content_type, name, value): self.category = category self.content_type = content_type self.name = name self.value = value def getCategory(self): return self.category def getContenttype(self, content_type): return self.content_type def getValue(self): return self.value def getName(self): return self.name def export(self, outfile, level, name): if self.category == MixedContainer.CategoryText: outfile.write(self.value) elif self.category == MixedContainer.CategorySimple: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export(outfile, level, name) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeInteger or \ self.content_type == MixedContainer.TypeBoolean: outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeFloat or \ self.content_type == MixedContainer.TypeDecimal: outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeDouble: outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name)) def exportLiteral(self, outfile, level, name): if self.category == MixedContainer.CategoryText: showIndent(outfile, level) outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \ (self.category, self.content_type, self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \ (self.category, self.content_type, self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write('MixedContainer(%d, %d, "%s",\n' % \ (self.category, self.content_type, self.name,)) self.value.exportLiteral(outfile, level + 1) showIndent(outfile, level) outfile.write(')\n') # # Data representation classes. # class GenerateModel: subclass = None def __init__(self, Module=None, PythonExport=None): if Module is None: self.Module = [] else: self.Module = Module if PythonExport is None: self.PythonExport = [] else: self.PythonExport = PythonExport def factory(*args_, **kwargs_): if GenerateModel.subclass: return GenerateModel.subclass(*args_, **kwargs_) else: return GenerateModel(*args_, **kwargs_) factory = staticmethod(factory) def getModule(self): return self.Module def setModule(self, Module): self.Module = Module def addModule(self, value): self.Module.append(value) def insertModule(self, index, value): self.Module[index] = value def getPythonexport(self): return self.PythonExport def setPythonexport(self, PythonExport): self.PythonExport = PythonExport def addPythonexport(self, value): self.PythonExport.append(value) def insertPythonexport(self, index, value): self.PythonExport[index] = value def export(self, outfile, level, name_='GenerateModel'): showIndent(outfile, level) outfile.write('<%s>\n' % name_) self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='GenerateModel'): pass def exportChildren(self, outfile, level, name_='GenerateModel'): for Module_ in self.getModule(): Module_.export(outfile, level) for PythonExport_ in self.getPythonexport(): PythonExport_.export(outfile, level) def exportLiteral(self, outfile, level, name_='GenerateModel'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('Module=[\n') level += 1 for Module in self.Module: showIndent(outfile, level) outfile.write('Module(\n') Module.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('PythonExport=[\n') level += 1 for PythonExport in self.PythonExport: showIndent(outfile, level) outfile.write('PythonExport(\n') PythonExport.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Module': obj_ = Module.factory() obj_.build(child_) self.Module.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'PythonExport': obj_ = PythonExport.factory() obj_.build(child_) self.PythonExport.append(obj_) # end class GenerateModel class PythonExport: subclass = None def __init__(self, FatherNamespace='', RichCompare=0, Name='', Reference=0, FatherInclude='', Father='', Namespace='', Twin='', Constructor=0, TwinPointer='', Include='', NumberProtocol=0, Delete=0, Documentation=None, Methode=None, Attribute=None, Sequence=None, CustomAttributes='', ClassDeclarations='', Initialization=0): self.FatherNamespace = FatherNamespace self.RichCompare = RichCompare self.Name = Name self.Reference = Reference self.FatherInclude = FatherInclude self.Father = Father self.Namespace = Namespace self.Twin = Twin self.Constructor = Constructor self.TwinPointer = TwinPointer self.Include = Include self.NumberProtocol = NumberProtocol self.Delete = Delete self.Documentation = Documentation self.Initialization = Initialization if Methode is None: self.Methode = [] else: self.Methode = Methode if Attribute is None: self.Attribute = [] else: self.Attribute = Attribute self.Sequence = Sequence self.CustomAttributes = CustomAttributes self.ClassDeclarations = ClassDeclarations def factory(*args_, **kwargs_): if PythonExport.subclass: return PythonExport.subclass(*args_, **kwargs_) else: return PythonExport(*args_, **kwargs_) factory = staticmethod(factory) def getInitialization(self): return self.Initialization def setInitialization(self, Initialization): self.Initialization = Initialization def getDocumentation(self): return self.Documentation def setDocumentation(self, Documentation): self.Documentation = Documentation def getMethode(self): return self.Methode def setMethode(self, Methode): self.Methode = Methode def addMethode(self, value): self.Methode.append(value) def insertMethode(self, index, value): self.Methode[index] = value def getAttribute(self): return self.Attribute def setAttribute(self, Attribute): self.Attribute = Attribute def addAttribute(self, value): self.Attribute.append(value) def insertAttribute(self, index, value): self.Attribute[index] = value def getSequence(self): return self.Sequence def setSequence(self, Sequence): self.Sequence = Sequence def getCustomattributes(self): return self.CustomAttributes def setCustomattributes(self, CustomAttributes): self.CustomAttributes = CustomAttributes def getClassdeclarations(self): return self.ClassDeclarations def setClassdeclarations(self, ClassDeclarations): self.ClassDeclarations = ClassDeclarations def getFathernamespace(self): return self.FatherNamespace def setFathernamespace(self, FatherNamespace): self.FatherNamespace = FatherNamespace def getRichcompare(self): return self.RichCompare def setRichcompare(self, RichCompare): self.RichCompare = RichCompare def getName(self): return self.Name def setName(self, Name): self.Name = Name def getReference(self): return self.Reference def setReference(self, Reference): self.Reference = Reference def getFatherinclude(self): return self.FatherInclude def setFatherinclude(self, FatherInclude): self.FatherInclude = FatherInclude def getFather(self): return self.Father def setFather(self, Father): self.Father = Father def getNamespace(self): return self.Namespace def setNamespace(self, Namespace): self.Namespace = Namespace def getTwin(self): return self.Twin def setTwin(self, Twin): self.Twin = Twin def getConstructor(self): return self.Constructor def setConstructor(self, Constructor): self.Constructor = Constructor def getTwinpointer(self): return self.TwinPointer def setTwinpointer(self, TwinPointer): self.TwinPointer = TwinPointer def getInclude(self): return self.Include def setInclude(self, Include): self.Include = Include def getNumberprotocol(self): return self.NumberProtocol def setNumberprotocol(self, NumberProtocol): self.NumberProtocol = NumberProtocol def getDelete(self): return self.Delete def setDelete(self, Delete): self.Delete = Delete def export(self, outfile, level, name_='PythonExport'): showIndent(outfile, level) outfile.write('<%s' % (name_, )) self.exportAttributes(outfile, level, name_='PythonExport') outfile.write('>\n') self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='PythonExport'): outfile.write(' FatherNamespace="%s"' % (self.getFathernamespace(), )) if self.getRichcompare() is not None: outfile.write(' RichCompare="%s"' % (self.getRichcompare(), )) outfile.write(' Name="%s"' % (self.getName(), )) if self.getReference() is not None: outfile.write(' Reference="%s"' % (self.getReference(), )) outfile.write(' FatherInclude="%s"' % (self.getFatherinclude(), )) outfile.write(' Father="%s"' % (self.getFather(), )) outfile.write(' Namespace="%s"' % (self.getNamespace(), )) outfile.write(' Twin="%s"' % (self.getTwin(), )) if self.getConstructor() is not None: outfile.write(' Constructor="%s"' % (self.getConstructor(), )) if self.getInitialization() is not None: outfile.write(' Initialization="%s"' % (self.getInitialization(), )) outfile.write(' TwinPointer="%s"' % (self.getTwinpointer(), )) outfile.write(' Include="%s"' % (self.getInclude(), )) if self.getNumberprotocol() is not None: outfile.write(' NumberProtocol="%s"' % (self.getNumberprotocol(), )) if self.getDelete() is not None: outfile.write(' Delete="%s"' % (self.getDelete(), )) def exportChildren(self, outfile, level, name_='PythonExport'): if self.Documentation: self.Documentation.export(outfile, level) for Methode_ in self.getMethode(): Methode_.export(outfile, level) for Attribute_ in self.getAttribute(): Attribute_.export(outfile, level) if self.Sequence: self.Sequence.export(outfile, level) showIndent(outfile, level) outfile.write('<CustomAttributes>%s</CustomAttributes>\n' % quote_xml(self.getCustomattributes())) showIndent(outfile, level) outfile.write('<ClassDeclarations>%s</ClassDeclarations>\n' % quote_xml(self.getClassdeclarations())) def exportLiteral(self, outfile, level, name_='PythonExport'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): showIndent(outfile, level) outfile.write('FatherNamespace = "%s",\n' % (self.getFathernamespace(),)) showIndent(outfile, level) outfile.write('RichCompare = "%s",\n' % (self.getRichcompare(),)) showIndent(outfile, level) outfile.write('Name = "%s",\n' % (self.getName(),)) showIndent(outfile, level) outfile.write('Reference = "%s",\n' % (self.getReference(),)) showIndent(outfile, level) outfile.write('FatherInclude = "%s",\n' % (self.getFatherinclude(),)) showIndent(outfile, level) outfile.write('Father = "%s",\n' % (self.getFather(),)) showIndent(outfile, level) outfile.write('Namespace = "%s",\n' % (self.getNamespace(),)) showIndent(outfile, level) outfile.write('Twin = "%s",\n' % (self.getTwin(),)) showIndent(outfile, level) outfile.write('Constructor = "%s",\n' % (self.getConstructor(),)) showIndent(outfile, level) outfile.write('Initialization = "%s",\n' % (self.getInitialization(),)) outfile.write('TwinPointer = "%s",\n' % (self.getTwinpointer(),)) showIndent(outfile, level) outfile.write('Include = "%s",\n' % (self.getInclude(),)) showIndent(outfile, level) outfile.write('NumberProtocol = "%s",\n' % (self.getNumberprotocol(),)) showIndent(outfile, level) outfile.write('Delete = "%s",\n' % (self.getDelete(),)) def exportLiteralChildren(self, outfile, level, name_): if self.Documentation: showIndent(outfile, level) outfile.write('Documentation=Documentation(\n') self.Documentation.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('Methode=[\n') level += 1 for Methode in self.Methode: showIndent(outfile, level) outfile.write('Methode(\n') Methode.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('Attribute=[\n') level += 1 for Attribute in self.Attribute: showIndent(outfile, level) outfile.write('Attribute(\n') Attribute.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') if self.Sequence: showIndent(outfile, level) outfile.write('Sequence=Sequence(\n') self.Sequence.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('CustomAttributes=%s,\n' % quote_python(self.getCustomattributes())) showIndent(outfile, level) outfile.write('ClassDeclarations=%s,\n' % quote_python(self.getClassdeclarations())) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('FatherNamespace'): self.FatherNamespace = attrs.get('FatherNamespace').value if attrs.get('RichCompare'): if attrs.get('RichCompare').value in ('true', '1'): self.RichCompare = 1 elif attrs.get('RichCompare').value in ('false', '0'): self.RichCompare = 0 else: raise ValueError('Bad boolean attribute (RichCompare)') if attrs.get('Name'): self.Name = attrs.get('Name').value if attrs.get('Reference'): if attrs.get('Reference').value in ('true', '1'): self.Reference = 1 elif attrs.get('Reference').value in ('false', '0'): self.Reference = 0 else: raise ValueError('Bad boolean attribute (Reference)') if attrs.get('FatherInclude'): self.FatherInclude = attrs.get('FatherInclude').value if attrs.get('Father'): self.Father = attrs.get('Father').value if attrs.get('Namespace'): self.Namespace = attrs.get('Namespace').value if attrs.get('Twin'): self.Twin = attrs.get('Twin').value if attrs.get('Constructor'): if attrs.get('Constructor').value in ('true', '1'): self.Constructor = 1 elif attrs.get('Constructor').value in ('false', '0'): self.Constructor = 0 else: raise ValueError('Bad boolean attribute (Constructor)') if attrs.get('Initialization'): if attrs.get('Initialization').value in ('true', '1'): self.Initialization = 1 elif attrs.get('Initialization').value in ('false', '0'): self.Initialization = 0 else: raise ValueError('Bad boolean attribute (Initialization)') if attrs.get('TwinPointer'): self.TwinPointer = attrs.get('TwinPointer').value if attrs.get('Include'): self.Include = attrs.get('Include').value if attrs.get('NumberProtocol'): if attrs.get('NumberProtocol').value in ('true', '1'): self.NumberProtocol = 1 elif attrs.get('NumberProtocol').value in ('false', '0'): self.NumberProtocol = 0 else: raise ValueError('Bad boolean attribute (NumberProtocol)') if attrs.get('Delete'): if attrs.get('Delete').value in ('true', '1'): self.Delete = 1 elif attrs.get('Delete').value in ('false', '0'): self.Delete = 0 else: raise ValueError('Bad boolean attribute (Delete)') def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Documentation': obj_ = Documentation.factory() obj_.build(child_) self.setDocumentation(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Methode': obj_ = Methode.factory() obj_.build(child_) self.Methode.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Attribute': obj_ = Attribute.factory() obj_.build(child_) self.Attribute.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Sequence': obj_ = Sequence.factory() obj_.build(child_) self.setSequence(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'CustomAttributes': CustomAttributes_ = '' for text__content_ in child_.childNodes: CustomAttributes_ += text__content_.nodeValue self.CustomAttributes = CustomAttributes_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'ClassDeclarations': ClassDeclarations_ = '' for text__content_ in child_.childNodes: ClassDeclarations_ += text__content_.nodeValue self.ClassDeclarations = ClassDeclarations_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Initialization': obj_ = Documentation.factory() obj_.build(child_) self.setDocumentation(obj_) # end class PythonExport class Methode: subclass = None def __init__(self, Const=0, Name='', Keyword=0, Documentation=None, Parameter=None): self.Const = Const self.Name = Name self.Keyword = Keyword self.Documentation = Documentation if Parameter is None: self.Parameter = [] else: self.Parameter = Parameter def factory(*args_, **kwargs_): if Methode.subclass: return Methode.subclass(*args_, **kwargs_) else: return Methode(*args_, **kwargs_) factory = staticmethod(factory) def getDocumentation(self): return self.Documentation def setDocumentation(self, Documentation): self.Documentation = Documentation def getParameter(self): return self.Parameter def setParameter(self, Parameter): self.Parameter = Parameter def addParameter(self, value): self.Parameter.append(value) def insertParameter(self, index, value): self.Parameter[index] = value def getConst(self): return self.Const def setConst(self, Const): self.Const = Const def getName(self): return self.Name def setName(self, Name): self.Name = Name def getKeyword(self): return self.Keyword def setKeyword(self, Keyword): self.Keyword = Keyword def export(self, outfile, level, name_='Methode'): showIndent(outfile, level) outfile.write('<%s' % (name_, )) self.exportAttributes(outfile, level, name_='Methode') outfile.write('>\n') self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='Methode'): if self.getConst() is not None: outfile.write(' Const="%s"' % (self.getConst(), )) outfile.write(' Name="%s"' % (self.getName(), )) if self.getKeyword() is not None: outfile.write(' Keyword="%s"' % (self.getKeyword(), )) def exportChildren(self, outfile, level, name_='Methode'): if self.Documentation: self.Documentation.export(outfile, level) for Parameter_ in self.getParameter(): Parameter_.export(outfile, level) def exportLiteral(self, outfile, level, name_='Methode'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): showIndent(outfile, level) outfile.write('Const = "%s",\n' % (self.getConst(),)) showIndent(outfile, level) outfile.write('Name = "%s",\n' % (self.getName(),)) showIndent(outfile, level) outfile.write('Keyword = "%s",\n' % (self.getKeyword(),)) def exportLiteralChildren(self, outfile, level, name_): if self.Documentation: showIndent(outfile, level) outfile.write('Documentation=Documentation(\n') self.Documentation.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('Parameter=[\n') level += 1 for Parameter in self.Parameter: showIndent(outfile, level) outfile.write('Parameter(\n') Parameter.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('Const'): if attrs.get('Const').value in ('true', '1'): self.Const = 1 elif attrs.get('Const').value in ('false', '0'): self.Const = 0 else: raise ValueError('Bad boolean attribute (Const)') if attrs.get('Name'): self.Name = attrs.get('Name').value if attrs.get('Keyword'): if attrs.get('Keyword').value in ('true', '1'): self.Keyword = 1 elif attrs.get('Keyword').value in ('false', '0'): self.Keyword = 0 else: raise ValueError('Bad boolean attribute (Keyword)') def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Documentation': obj_ = Documentation.factory() obj_.build(child_) self.setDocumentation(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Parameter': obj_ = Parameter.factory() obj_.build(child_) self.Parameter.append(obj_) # end class Methode class Attribute: subclass = None def __init__(self, ReadOnly=0, Name='', Documentation=None, Parameter=None): self.ReadOnly = ReadOnly self.Name = Name self.Documentation = Documentation self.Parameter = Parameter def factory(*args_, **kwargs_): if Attribute.subclass: return Attribute.subclass(*args_, **kwargs_) else: return Attribute(*args_, **kwargs_) factory = staticmethod(factory) def getDocumentation(self): return self.Documentation def setDocumentation(self, Documentation): self.Documentation = Documentation def getParameter(self): return self.Parameter def setParameter(self, Parameter): self.Parameter = Parameter def getReadonly(self): return self.ReadOnly def setReadonly(self, ReadOnly): self.ReadOnly = ReadOnly def getName(self): return self.Name def setName(self, Name): self.Name = Name def export(self, outfile, level, name_='Attribute'): showIndent(outfile, level) outfile.write('<%s' % (name_, )) self.exportAttributes(outfile, level, name_='Attribute') outfile.write('>\n') self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='Attribute'): outfile.write(' ReadOnly="%s"' % (self.getReadonly(), )) outfile.write(' Name="%s"' % (self.getName(), )) def exportChildren(self, outfile, level, name_='Attribute'): if self.Documentation: self.Documentation.export(outfile, level) if self.Parameter: self.Parameter.export(outfile, level) def exportLiteral(self, outfile, level, name_='Attribute'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): showIndent(outfile, level) outfile.write('ReadOnly = "%s",\n' % (self.getReadonly(),)) showIndent(outfile, level) outfile.write('Name = "%s",\n' % (self.getName(),)) def exportLiteralChildren(self, outfile, level, name_): if self.Documentation: showIndent(outfile, level) outfile.write('Documentation=Documentation(\n') self.Documentation.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') if self.Parameter: showIndent(outfile, level) outfile.write('Parameter=Parameter(\n') self.Parameter.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('ReadOnly'): if attrs.get('ReadOnly').value in ('true', '1'): self.ReadOnly = 1 elif attrs.get('ReadOnly').value in ('false', '0'): self.ReadOnly = 0 else: raise ValueError('Bad boolean attribute (ReadOnly)') if attrs.get('Name'): self.Name = attrs.get('Name').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Documentation': obj_ = Documentation.factory() obj_.build(child_) self.setDocumentation(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Parameter': obj_ = Parameter.factory() obj_.build(child_) self.setParameter(obj_) # end class Attribute class Sequence: subclass = None def __init__(self, sq_slice=0, sq_item=0, sq_concat=0, sq_inplace_repeat=0, sq_ass_slice=0, sq_contains=0, sq_ass_item=0, sq_repeat=0, sq_length=0, sq_inplace_concat=0, valueOf_=''): self.sq_slice = sq_slice self.sq_item = sq_item self.sq_concat = sq_concat self.sq_inplace_repeat = sq_inplace_repeat self.sq_ass_slice = sq_ass_slice self.sq_contains = sq_contains self.sq_ass_item = sq_ass_item self.sq_repeat = sq_repeat self.sq_length = sq_length self.sq_inplace_concat = sq_inplace_concat self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if Sequence.subclass: return Sequence.subclass(*args_, **kwargs_) else: return Sequence(*args_, **kwargs_) factory = staticmethod(factory) def getSq_slice(self): return self.sq_slice def setSq_slice(self, sq_slice): self.sq_slice = sq_slice def getSq_item(self): return self.sq_item def setSq_item(self, sq_item): self.sq_item = sq_item def getSq_concat(self): return self.sq_concat def setSq_concat(self, sq_concat): self.sq_concat = sq_concat def getSq_inplace_repeat(self): return self.sq_inplace_repeat def setSq_inplace_repeat(self, sq_inplace_repeat): self.sq_inplace_repeat = sq_inplace_repeat def getSq_ass_slice(self): return self.sq_ass_slice def setSq_ass_slice(self, sq_ass_slice): self.sq_ass_slice = sq_ass_slice def getSq_contains(self): return self.sq_contains def setSq_contains(self, sq_contains): self.sq_contains = sq_contains def getSq_ass_item(self): return self.sq_ass_item def setSq_ass_item(self, sq_ass_item): self.sq_ass_item = sq_ass_item def getSq_repeat(self): return self.sq_repeat def setSq_repeat(self, sq_repeat): self.sq_repeat = sq_repeat def getSq_length(self): return self.sq_length def setSq_length(self, sq_length): self.sq_length = sq_length def getSq_inplace_concat(self): return self.sq_inplace_concat def setSq_inplace_concat(self, sq_inplace_concat): self.sq_inplace_concat = sq_inplace_concat def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, name_='Sequence'): showIndent(outfile, level) outfile.write('<%s' % (name_, )) self.exportAttributes(outfile, level, name_='Sequence') outfile.write('>\n') self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='Sequence'): outfile.write(' sq_slice="%s"' % (self.getSq_slice(), )) outfile.write(' sq_item="%s"' % (self.getSq_item(), )) outfile.write(' sq_concat="%s"' % (self.getSq_concat(), )) outfile.write(' sq_inplace_repeat="%s"' % (self.getSq_inplace_repeat(), )) outfile.write(' sq_ass_slice="%s"' % (self.getSq_ass_slice(), )) outfile.write(' sq_contains="%s"' % (self.getSq_contains(), )) outfile.write(' sq_ass_item="%s"' % (self.getSq_ass_item(), )) outfile.write(' sq_repeat="%s"' % (self.getSq_repeat(), )) outfile.write(' sq_length="%s"' % (self.getSq_length(), )) outfile.write(' sq_inplace_concat="%s"' % (self.getSq_inplace_concat(), )) def exportChildren(self, outfile, level, name_='Sequence'): outfile.write(self.valueOf_) def exportLiteral(self, outfile, level, name_='Sequence'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): showIndent(outfile, level) outfile.write('sq_slice = "%s",\n' % (self.getSq_slice(),)) showIndent(outfile, level) outfile.write('sq_item = "%s",\n' % (self.getSq_item(),)) showIndent(outfile, level) outfile.write('sq_concat = "%s",\n' % (self.getSq_concat(),)) showIndent(outfile, level) outfile.write('sq_inplace_repeat = "%s",\n' % (self.getSq_inplace_repeat(),)) showIndent(outfile, level) outfile.write('sq_ass_slice = "%s",\n' % (self.getSq_ass_slice(),)) showIndent(outfile, level) outfile.write('sq_contains = "%s",\n' % (self.getSq_contains(),)) showIndent(outfile, level) outfile.write('sq_ass_item = "%s",\n' % (self.getSq_ass_item(),)) showIndent(outfile, level) outfile.write('sq_repeat = "%s",\n' % (self.getSq_repeat(),)) showIndent(outfile, level) outfile.write('sq_length = "%s",\n' % (self.getSq_length(),)) showIndent(outfile, level) outfile.write('sq_inplace_concat = "%s",\n' % (self.getSq_inplace_concat(),)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('sq_slice'): if attrs.get('sq_slice').value in ('true', '1'): self.sq_slice = 1 elif attrs.get('sq_slice').value in ('false', '0'): self.sq_slice = 0 else: raise ValueError('Bad boolean attribute (sq_slice)') if attrs.get('sq_item'): if attrs.get('sq_item').value in ('true', '1'): self.sq_item = 1 elif attrs.get('sq_item').value in ('false', '0'): self.sq_item = 0 else: raise ValueError('Bad boolean attribute (sq_item)') if attrs.get('sq_concat'): if attrs.get('sq_concat').value in ('true', '1'): self.sq_concat = 1 elif attrs.get('sq_concat').value in ('false', '0'): self.sq_concat = 0 else: raise ValueError('Bad boolean attribute (sq_concat)') if attrs.get('sq_inplace_repeat'): if attrs.get('sq_inplace_repeat').value in ('true', '1'): self.sq_inplace_repeat = 1 elif attrs.get('sq_inplace_repeat').value in ('false', '0'): self.sq_inplace_repeat = 0 else: raise ValueError('Bad boolean attribute (sq_inplace_repeat)') if attrs.get('sq_ass_slice'): if attrs.get('sq_ass_slice').value in ('true', '1'): self.sq_ass_slice = 1 elif attrs.get('sq_ass_slice').value in ('false', '0'): self.sq_ass_slice = 0 else: raise ValueError('Bad boolean attribute (sq_ass_slice)') if attrs.get('sq_contains'): if attrs.get('sq_contains').value in ('true', '1'): self.sq_contains = 1 elif attrs.get('sq_contains').value in ('false', '0'): self.sq_contains = 0 else: raise ValueError('Bad boolean attribute (sq_contains)') if attrs.get('sq_ass_item'): if attrs.get('sq_ass_item').value in ('true', '1'): self.sq_ass_item = 1 elif attrs.get('sq_ass_item').value in ('false', '0'): self.sq_ass_item = 0 else: raise ValueError('Bad boolean attribute (sq_ass_item)') if attrs.get('sq_repeat'): if attrs.get('sq_repeat').value in ('true', '1'): self.sq_repeat = 1 elif attrs.get('sq_repeat').value in ('false', '0'): self.sq_repeat = 0 else: raise ValueError('Bad boolean attribute (sq_repeat)') if attrs.get('sq_length'): if attrs.get('sq_length').value in ('true', '1'): self.sq_length = 1 elif attrs.get('sq_length').value in ('false', '0'): self.sq_length = 0 else: raise ValueError('Bad boolean attribute (sq_length)') if attrs.get('sq_inplace_concat'): if attrs.get('sq_inplace_concat').value in ('true', '1'): self.sq_inplace_concat = 1 elif attrs.get('sq_inplace_concat').value in ('false', '0'): self.sq_inplace_concat = 0 else: raise ValueError('Bad boolean attribute (sq_inplace_concat)') def buildChildren(self, child_, nodeName_): self.valueOf_ = '' for child in child_.childNodes: if child.nodeType == Node.TEXT_NODE: self.valueOf_ += child.nodeValue # end class Sequence class Module: subclass = None def __init__(self, Name='', Documentation=None, Dependencies=None, Content=None): self.Name = Name self.Documentation = Documentation self.Dependencies = Dependencies self.Content = Content def factory(*args_, **kwargs_): if Module.subclass: return Module.subclass(*args_, **kwargs_) else: return Module(*args_, **kwargs_) factory = staticmethod(factory) def getDocumentation(self): return self.Documentation def setDocumentation(self, Documentation): self.Documentation = Documentation def getDependencies(self): return self.Dependencies def setDependencies(self, Dependencies): self.Dependencies = Dependencies def getContent(self): return self.Content def setContent(self, Content): self.Content = Content def getName(self): return self.Name def setName(self, Name): self.Name = Name def export(self, outfile, level, name_='Module'): showIndent(outfile, level) outfile.write('<%s' % (name_, )) self.exportAttributes(outfile, level, name_='Module') outfile.write('>\n') self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='Module'): outfile.write(' Name="%s"' % (self.getName(), )) def exportChildren(self, outfile, level, name_='Module'): if self.Documentation: self.Documentation.export(outfile, level) if self.Dependencies: self.Dependencies.export(outfile, level) if self.Content: self.Content.export(outfile, level) def exportLiteral(self, outfile, level, name_='Module'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): showIndent(outfile, level) outfile.write('Name = "%s",\n' % (self.getName(),)) def exportLiteralChildren(self, outfile, level, name_): if self.Documentation: showIndent(outfile, level) outfile.write('Documentation=Documentation(\n') self.Documentation.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') if self.Dependencies: showIndent(outfile, level) outfile.write('Dependencies=Dependencies(\n') self.Dependencies.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') if self.Content: showIndent(outfile, level) outfile.write('Content=Content(\n') self.Content.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('Name'): self.Name = attrs.get('Name').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Documentation': obj_ = Documentation.factory() obj_.build(child_) self.setDocumentation(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Dependencies': obj_ = Dependencies.factory() obj_.build(child_) self.setDependencies(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Content': obj_ = Content.factory() obj_.build(child_) self.setContent(obj_) # end class Module class Dependencies: subclass = None def __init__(self, Module=None): if Module is None: self.Module = [] else: self.Module = Module def factory(*args_, **kwargs_): if Dependencies.subclass: return Dependencies.subclass(*args_, **kwargs_) else: return Dependencies(*args_, **kwargs_) factory = staticmethod(factory) def getModule(self): return self.Module def setModule(self, Module): self.Module = Module def addModule(self, value): self.Module.append(value) def insertModule(self, index, value): self.Module[index] = value def export(self, outfile, level, name_='Dependencies'): showIndent(outfile, level) outfile.write('<%s>\n' % name_) self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='Dependencies'): pass def exportChildren(self, outfile, level, name_='Dependencies'): for Module_ in self.getModule(): Module_.export(outfile, level) def exportLiteral(self, outfile, level, name_='Dependencies'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('Module=[\n') level += 1 for Module in self.Module: showIndent(outfile, level) outfile.write('Module(\n') Module.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Module': obj_ = Module.factory() obj_.build(child_) self.Module.append(obj_) # end class Dependencies class Content: subclass = None def __init__(self, Property=None, Feature=None, DocObject=None, GuiCommand=None, PreferencesPage=None): if Property is None: self.Property = [] else: self.Property = Property if Feature is None: self.Feature = [] else: self.Feature = Feature if DocObject is None: self.DocObject = [] else: self.DocObject = DocObject if GuiCommand is None: self.GuiCommand = [] else: self.GuiCommand = GuiCommand if PreferencesPage is None: self.PreferencesPage = [] else: self.PreferencesPage = PreferencesPage def factory(*args_, **kwargs_): if Content.subclass: return Content.subclass(*args_, **kwargs_) else: return Content(*args_, **kwargs_) factory = staticmethod(factory) def getProperty(self): return self.Property def setProperty(self, Property): self.Property = Property def addProperty(self, value): self.Property.append(value) def insertProperty(self, index, value): self.Property[index] = value def getFeature(self): return self.Feature def setFeature(self, Feature): self.Feature = Feature def addFeature(self, value): self.Feature.append(value) def insertFeature(self, index, value): self.Feature[index] = value def getDocobject(self): return self.DocObject def setDocobject(self, DocObject): self.DocObject = DocObject def addDocobject(self, value): self.DocObject.append(value) def insertDocobject(self, index, value): self.DocObject[index] = value def getGuicommand(self): return self.GuiCommand def setGuicommand(self, GuiCommand): self.GuiCommand = GuiCommand def addGuicommand(self, value): self.GuiCommand.append(value) def insertGuicommand(self, index, value): self.GuiCommand[index] = value def getPreferencespage(self): return self.PreferencesPage def setPreferencespage(self, PreferencesPage): self.PreferencesPage = PreferencesPage def addPreferencespage(self, value): self.PreferencesPage.append(value) def insertPreferencespage(self, index, value): self.PreferencesPage[index] = value def export(self, outfile, level, name_='Content'): showIndent(outfile, level) outfile.write('<%s>\n' % name_) self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='Content'): pass def exportChildren(self, outfile, level, name_='Content'): for Property_ in self.getProperty(): Property_.export(outfile, level) for Feature_ in self.getFeature(): Feature_.export(outfile, level) for DocObject_ in self.getDocobject(): DocObject_.export(outfile, level) for GuiCommand_ in self.getGuicommand(): showIndent(outfile, level) outfile.write('<GuiCommand>%s</GuiCommand>\n' % quote_xml(GuiCommand_)) for PreferencesPage_ in self.getPreferencespage(): showIndent(outfile, level) outfile.write('<PreferencesPage>%s</PreferencesPage>\n' % quote_xml(PreferencesPage_)) def exportLiteral(self, outfile, level, name_='Content'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('Property=[\n') level += 1 for Property in self.Property: showIndent(outfile, level) outfile.write('Property(\n') Property.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('Feature=[\n') level += 1 for Feature in self.Feature: showIndent(outfile, level) outfile.write('Feature(\n') Feature.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('DocObject=[\n') level += 1 for DocObject in self.DocObject: showIndent(outfile, level) outfile.write('DocObject(\n') DocObject.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('GuiCommand=[\n') level += 1 for GuiCommand in self.GuiCommand: showIndent(outfile, level) outfile.write('%s,\n' % quote_python(GuiCommand)) level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('PreferencesPage=[\n') level += 1 for PreferencesPage in self.PreferencesPage: showIndent(outfile, level) outfile.write('%s,\n' % quote_python(PreferencesPage)) level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Property': obj_ = Property.factory() obj_.build(child_) self.Property.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Feature': obj_ = Feature.factory() obj_.build(child_) self.Feature.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'DocObject': obj_ = DocObject.factory() obj_.build(child_) self.DocObject.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'GuiCommand': GuiCommand_ = '' for text__content_ in child_.childNodes: GuiCommand_ += text__content_.nodeValue self.GuiCommand.append(GuiCommand_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'PreferencesPage': PreferencesPage_ = '' for text__content_ in child_.childNodes: PreferencesPage_ += text__content_.nodeValue self.PreferencesPage.append(PreferencesPage_) # end class Content class Feature: subclass = None def __init__(self, Name='', Documentation=None, Property=None, ViewProvider=None): self.Name = Name self.Documentation = Documentation if Property is None: self.Property = [] else: self.Property = Property self.ViewProvider = ViewProvider def factory(*args_, **kwargs_): if Feature.subclass: return Feature.subclass(*args_, **kwargs_) else: return Feature(*args_, **kwargs_) factory = staticmethod(factory) def getDocumentation(self): return self.Documentation def setDocumentation(self, Documentation): self.Documentation = Documentation def getProperty(self): return self.Property def setProperty(self, Property): self.Property = Property def addProperty(self, value): self.Property.append(value) def insertProperty(self, index, value): self.Property[index] = value def getViewprovider(self): return self.ViewProvider def setViewprovider(self, ViewProvider): self.ViewProvider = ViewProvider def getName(self): return self.Name def setName(self, Name): self.Name = Name def export(self, outfile, level, name_='Feature'): showIndent(outfile, level) outfile.write('<%s' % (name_, )) self.exportAttributes(outfile, level, name_='Feature') outfile.write('>\n') self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='Feature'): outfile.write(' Name="%s"' % (self.getName(), )) def exportChildren(self, outfile, level, name_='Feature'): if self.Documentation: self.Documentation.export(outfile, level) for Property_ in self.getProperty(): Property_.export(outfile, level) if self.ViewProvider: self.ViewProvider.export(outfile, level) def exportLiteral(self, outfile, level, name_='Feature'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): showIndent(outfile, level) outfile.write('Name = "%s",\n' % (self.getName(),)) def exportLiteralChildren(self, outfile, level, name_): if self.Documentation: showIndent(outfile, level) outfile.write('Documentation=Documentation(\n') self.Documentation.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('Property=[\n') level += 1 for Property in self.Property: showIndent(outfile, level) outfile.write('Property(\n') Property.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') if self.ViewProvider: showIndent(outfile, level) outfile.write('ViewProvider=ViewProvider(\n') self.ViewProvider.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('Name'): self.Name = attrs.get('Name').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Documentation': obj_ = Documentation.factory() obj_.build(child_) self.setDocumentation(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Property': obj_ = Property.factory() obj_.build(child_) self.Property.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'ViewProvider': obj_ = ViewProvider.factory() obj_.build(child_) self.setViewprovider(obj_) # end class Feature class DocObject: subclass = None def __init__(self, Name='', Documentation=None, Property=None): self.Name = Name self.Documentation = Documentation if Property is None: self.Property = [] else: self.Property = Property def factory(*args_, **kwargs_): if DocObject.subclass: return DocObject.subclass(*args_, **kwargs_) else: return DocObject(*args_, **kwargs_) factory = staticmethod(factory) def getDocumentation(self): return self.Documentation def setDocumentation(self, Documentation): self.Documentation = Documentation def getProperty(self): return self.Property def setProperty(self, Property): self.Property = Property def addProperty(self, value): self.Property.append(value) def insertProperty(self, index, value): self.Property[index] = value def getName(self): return self.Name def setName(self, Name): self.Name = Name def export(self, outfile, level, name_='DocObject'): showIndent(outfile, level) outfile.write('<%s' % (name_, )) self.exportAttributes(outfile, level, name_='DocObject') outfile.write('>\n') self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='DocObject'): outfile.write(' Name="%s"' % (self.getName(), )) def exportChildren(self, outfile, level, name_='DocObject'): if self.Documentation: self.Documentation.export(outfile, level) for Property_ in self.getProperty(): Property_.export(outfile, level) def exportLiteral(self, outfile, level, name_='DocObject'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): showIndent(outfile, level) outfile.write('Name = "%s",\n' % (self.getName(),)) def exportLiteralChildren(self, outfile, level, name_): if self.Documentation: showIndent(outfile, level) outfile.write('Documentation=Documentation(\n') self.Documentation.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('Property=[\n') level += 1 for Property in self.Property: showIndent(outfile, level) outfile.write('Property(\n') Property.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('Name'): self.Name = attrs.get('Name').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Documentation': obj_ = Documentation.factory() obj_.build(child_) self.setDocumentation(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Property': obj_ = Property.factory() obj_.build(child_) self.Property.append(obj_) # end class DocObject class Property: subclass = None def __init__(self, Type='', Name='', StartValue='', Documentation=None): self.Type = Type self.Name = Name self.StartValue = StartValue self.Documentation = Documentation def factory(*args_, **kwargs_): if Property.subclass: return Property.subclass(*args_, **kwargs_) else: return Property(*args_, **kwargs_) factory = staticmethod(factory) def getDocumentation(self): return self.Documentation def setDocumentation(self, Documentation): self.Documentation = Documentation def getType(self): return self.Type def setType(self, Type): self.Type = Type def getName(self): return self.Name def setName(self, Name): self.Name = Name def getStartvalue(self): return self.StartValue def setStartvalue(self, StartValue): self.StartValue = StartValue def export(self, outfile, level, name_='Property'): showIndent(outfile, level) outfile.write('<%s' % (name_, )) self.exportAttributes(outfile, level, name_='Property') outfile.write('>\n') self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='Property'): outfile.write(' Type="%s"' % (self.getType(), )) outfile.write(' Name="%s"' % (self.getName(), )) if self.getStartvalue() is not None: outfile.write(' StartValue="%s"' % (self.getStartvalue(), )) def exportChildren(self, outfile, level, name_='Property'): if self.Documentation: self.Documentation.export(outfile, level) def exportLiteral(self, outfile, level, name_='Property'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): showIndent(outfile, level) outfile.write('Type = "%s",\n' % (self.getType(),)) showIndent(outfile, level) outfile.write('Name = "%s",\n' % (self.getName(),)) showIndent(outfile, level) outfile.write('StartValue = "%s",\n' % (self.getStartvalue(),)) def exportLiteralChildren(self, outfile, level, name_): if self.Documentation: showIndent(outfile, level) outfile.write('Documentation=Documentation(\n') self.Documentation.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('Type'): self.Type = attrs.get('Type').value if attrs.get('Name'): self.Name = attrs.get('Name').value if attrs.get('StartValue'): self.StartValue = attrs.get('StartValue').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Documentation': obj_ = Documentation.factory() obj_.build(child_) self.setDocumentation(obj_) # end class Property class Documentation: subclass = None def __init__(self, Author=None, DeveloperDocu='', UserDocu=''): self.Author = Author self.DeveloperDocu = DeveloperDocu self.UserDocu = UserDocu def factory(*args_, **kwargs_): if Documentation.subclass: return Documentation.subclass(*args_, **kwargs_) else: return Documentation(*args_, **kwargs_) factory = staticmethod(factory) def getAuthor(self): return self.Author def setAuthor(self, Author): self.Author = Author def getDeveloperdocu(self): return self.DeveloperDocu def setDeveloperdocu(self, DeveloperDocu): self.DeveloperDocu = DeveloperDocu def getUserdocu(self): return self.UserDocu def setUserdocu(self, UserDocu): self.UserDocu = UserDocu def export(self, outfile, level, name_='Documentation'): showIndent(outfile, level) outfile.write('<%s>\n' % name_) self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='Documentation'): pass def exportChildren(self, outfile, level, name_='Documentation'): if self.Author: self.Author.export(outfile, level) showIndent(outfile, level) outfile.write('<DeveloperDocu>%s</DeveloperDocu>\n' % quote_xml(self.getDeveloperdocu())) showIndent(outfile, level) outfile.write('<UserDocu>%s</UserDocu>\n' % quote_xml(self.getUserdocu())) def exportLiteral(self, outfile, level, name_='Documentation'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.Author: showIndent(outfile, level) outfile.write('Author=Author(\n') self.Author.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('DeveloperDocu=%s,\n' % quote_python(self.getDeveloperdocu())) showIndent(outfile, level) outfile.write('UserDocu=%s,\n' % quote_python(self.getUserdocu())) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Author': obj_ = Author.factory() obj_.build(child_) self.setAuthor(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'DeveloperDocu': DeveloperDocu_ = '' for text__content_ in child_.childNodes: DeveloperDocu_ += text__content_.nodeValue self.DeveloperDocu = DeveloperDocu_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'UserDocu': UserDocu_ = '' for text__content_ in child_.childNodes: UserDocu_ += text__content_.nodeValue self.UserDocu = UserDocu_ # end class Documentation class Author: subclass = None def __init__(self, Name='', Licence='', EMail='', valueOf_=''): self.Name = Name self.Licence = Licence self.EMail = EMail self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if Author.subclass: return Author.subclass(*args_, **kwargs_) else: return Author(*args_, **kwargs_) factory = staticmethod(factory) def getName(self): return self.Name def setName(self, Name): self.Name = Name def getLicence(self): return self.Licence def setLicence(self, Licence): self.Licence = Licence def getEmail(self): return self.EMail def setEmail(self, EMail): self.EMail = EMail def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, name_='Author'): showIndent(outfile, level) outfile.write('<%s' % (name_, )) self.exportAttributes(outfile, level, name_='Author') outfile.write('>\n') self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='Author'): outfile.write(' Name="%s"' % (self.getName(), )) if self.getLicence() is not None: outfile.write(' Licence="%s"' % (self.getLicence(), )) outfile.write(' EMail="%s"' % (self.getEmail(), )) def exportChildren(self, outfile, level, name_='Author'): outfile.write(self.valueOf_) def exportLiteral(self, outfile, level, name_='Author'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): showIndent(outfile, level) outfile.write('Name = "%s",\n' % (self.getName(),)) showIndent(outfile, level) outfile.write('Licence = "%s",\n' % (self.getLicence(),)) showIndent(outfile, level) outfile.write('EMail = "%s",\n' % (self.getEmail(),)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('Name'): self.Name = attrs.get('Name').value if attrs.get('Licence'): self.Licence = attrs.get('Licence').value if attrs.get('EMail'): self.EMail = attrs.get('EMail').value def buildChildren(self, child_, nodeName_): self.valueOf_ = '' for child in child_.childNodes: if child.nodeType == Node.TEXT_NODE: self.valueOf_ += child.nodeValue # end class Author class ViewProvider: subclass = None def __init__(self, Property=None): if Property is None: self.Property = [] else: self.Property = Property def factory(*args_, **kwargs_): if ViewProvider.subclass: return ViewProvider.subclass(*args_, **kwargs_) else: return ViewProvider(*args_, **kwargs_) factory = staticmethod(factory) def getProperty(self): return self.Property def setProperty(self, Property): self.Property = Property def addProperty(self, value): self.Property.append(value) def insertProperty(self, index, value): self.Property[index] = value def export(self, outfile, level, name_='ViewProvider'): showIndent(outfile, level) outfile.write('<%s>\n' % name_) self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='ViewProvider'): pass def exportChildren(self, outfile, level, name_='ViewProvider'): for Property_ in self.getProperty(): Property_.export(outfile, level) def exportLiteral(self, outfile, level, name_='ViewProvider'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('Property=[\n') level += 1 for Property in self.Property: showIndent(outfile, level) outfile.write('Property(\n') Property.exportLiteral(outfile, level) showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'Property': obj_ = Property.factory() obj_.build(child_) self.Property.append(obj_) # end class ViewProvider class Parameter: subclass = None def __init__(self, Type='', Name='', valueOf_=''): self.Type = Type self.Name = Name self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if Parameter.subclass: return Parameter.subclass(*args_, **kwargs_) else: return Parameter(*args_, **kwargs_) factory = staticmethod(factory) def getType(self): return self.Type def setType(self, Type): self.Type = Type def getName(self): return self.Name def setName(self, Name): self.Name = Name def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, name_='Parameter'): showIndent(outfile, level) outfile.write('<%s' % (name_, )) self.exportAttributes(outfile, level, name_='Parameter') outfile.write('>\n') self.exportChildren(outfile, level + 1, name_) showIndent(outfile, level) outfile.write('</%s>\n' % name_) def exportAttributes(self, outfile, level, name_='Parameter'): outfile.write(' Type="%s"' % (self.getType(), )) outfile.write(' Name="%s"' % (self.getName(), )) def exportChildren(self, outfile, level, name_='Parameter'): outfile.write(self.valueOf_) def exportLiteral(self, outfile, level, name_='Parameter'): level += 1 self.exportLiteralAttributes(outfile, level, name_) self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): showIndent(outfile, level) outfile.write('Type = "%s",\n' % (self.getType(),)) showIndent(outfile, level) outfile.write('Name = "%s",\n' % (self.getName(),)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('Type'): self.Type = attrs.get('Type').value if attrs.get('Name'): self.Name = attrs.get('Name').value def buildChildren(self, child_, nodeName_): self.valueOf_ = '' for child in child_.childNodes: if child.nodeType == Node.TEXT_NODE: self.valueOf_ += child.nodeValue # end class Parameter from xml.sax import handler, make_parser class SaxStackElement: def __init__(self, name='', obj=None): self.name = name self.obj = obj self.content = '' # # SAX handler # class SaxGeneratemodelHandler(handler.ContentHandler): def __init__(self): self.stack = [] self.root = None def getRoot(self): return self.root def setDocumentLocator(self, locator): self.locator = locator def showError(self, msg): print '*** (showError):', msg sys.exit(-1) def startElement(self, name, attrs): done = 0 if name == 'GenerateModel': obj = GenerateModel.factory() stackObj = SaxStackElement('GenerateModel', obj) self.stack.append(stackObj) done = 1 elif name == 'Module': obj = Module.factory() stackObj = SaxStackElement('Module', obj) self.stack.append(stackObj) done = 1 elif name == 'PythonExport': obj = PythonExport.factory() val = attrs.get('FatherNamespace', None) if val is not None: obj.setFathernamespace(val) val = attrs.get('RichCompare', None) if val is not None: if val in ('true', '1'): obj.setRichcompare(1) elif val in ('false', '0'): obj.setRichcompare(0) else: self.reportError('"RichCompare" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('Name', None) if val is not None: obj.setName(val) val = attrs.get('Reference', None) if val is not None: if val in ('true', '1'): obj.setReference(1) elif val in ('false', '0'): obj.setReference(0) else: self.reportError('"Reference" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('FatherInclude', None) if val is not None: obj.setFatherinclude(val) val = attrs.get('Father', None) if val is not None: obj.setFather(val) val = attrs.get('Namespace', None) if val is not None: obj.setNamespace(val) val = attrs.get('Twin', None) if val is not None: obj.setTwin(val) val = attrs.get('Constructor', None) if val is not None: if val in ('true', '1'): obj.setConstructor(1) elif val in ('false', '0'): obj.setConstructor(0) else: self.reportError('"Constructor" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('Initialization', None) if val is not None: if val in ('true', '1'): obj.setInitialization(1) elif val in ('false', '0'): obj.setInitialization(0) else: self.reportError('"Initialization" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('TwinPointer', None) if val is not None: obj.setTwinpointer(val) val = attrs.get('Include', None) if val is not None: obj.setInclude(val) val = attrs.get('NumberProtocol', None) if val is not None: if val in ('true', '1'): obj.setNumberprotocol(1) elif val in ('false', '0'): obj.setNumberprotocol(0) else: self.reportError('"NumberProtocol" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('Delete', None) if val is not None: if val in ('true', '1'): obj.setDelete(1) elif val in ('false', '0'): obj.setDelete(0) else: self.reportError('"Delete" attribute must be boolean ("true", "1", "false", "0")') stackObj = SaxStackElement('PythonExport', obj) self.stack.append(stackObj) done = 1 elif name == 'Documentation': obj = Documentation.factory() stackObj = SaxStackElement('Documentation', obj) self.stack.append(stackObj) done = 1 elif name == 'Methode': obj = Methode.factory() val = attrs.get('Const', None) if val is not None: if val in ('true', '1'): obj.setConst(1) elif val in ('false', '0'): obj.setConst(0) else: self.reportError('"Const" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('Name', None) if val is not None: obj.setName(val) val = attrs.get('Keyword', None) if val is not None: if val in ('true', '1'): obj.setKeyword(1) elif val in ('false', '0'): obj.setKeyword(0) else: self.reportError('"Keyword" attribute must be boolean ("true", "1", "false", "0")') stackObj = SaxStackElement('Methode', obj) self.stack.append(stackObj) done = 1 elif name == 'Parameter': obj = Parameter.factory() val = attrs.get('Type', None) if val is not None: obj.setType(val) val = attrs.get('Name', None) if val is not None: obj.setName(val) stackObj = SaxStackElement('Parameter', obj) self.stack.append(stackObj) done = 1 elif name == 'Attribute': obj = Attribute.factory() val = attrs.get('ReadOnly', None) if val is not None: if val in ('true', '1'): obj.setReadonly(1) elif val in ('false', '0'): obj.setReadonly(0) else: self.reportError('"ReadOnly" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('Name', None) if val is not None: obj.setName(val) stackObj = SaxStackElement('Attribute', obj) self.stack.append(stackObj) done = 1 elif name == 'Sequence': obj = Sequence.factory() val = attrs.get('sq_slice', None) if val is not None: if val in ('true', '1'): obj.setSq_slice(1) elif val in ('false', '0'): obj.setSq_slice(0) else: self.reportError('"sq_slice" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('sq_item', None) if val is not None: if val in ('true', '1'): obj.setSq_item(1) elif val in ('false', '0'): obj.setSq_item(0) else: self.reportError('"sq_item" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('sq_concat', None) if val is not None: if val in ('true', '1'): obj.setSq_concat(1) elif val in ('false', '0'): obj.setSq_concat(0) else: self.reportError('"sq_concat" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('sq_inplace_repeat', None) if val is not None: if val in ('true', '1'): obj.setSq_inplace_repeat(1) elif val in ('false', '0'): obj.setSq_inplace_repeat(0) else: self.reportError('"sq_inplace_repeat" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('sq_ass_slice', None) if val is not None: if val in ('true', '1'): obj.setSq_ass_slice(1) elif val in ('false', '0'): obj.setSq_ass_slice(0) else: self.reportError('"sq_ass_slice" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('sq_contains', None) if val is not None: if val in ('true', '1'): obj.setSq_contains(1) elif val in ('false', '0'): obj.setSq_contains(0) else: self.reportError('"sq_contains" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('sq_ass_item', None) if val is not None: if val in ('true', '1'): obj.setSq_ass_item(1) elif val in ('false', '0'): obj.setSq_ass_item(0) else: self.reportError('"sq_ass_item" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('sq_repeat', None) if val is not None: if val in ('true', '1'): obj.setSq_repeat(1) elif val in ('false', '0'): obj.setSq_repeat(0) else: self.reportError('"sq_repeat" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('sq_length', None) if val is not None: if val in ('true', '1'): obj.setSq_length(1) elif val in ('false', '0'): obj.setSq_length(0) else: self.reportError('"sq_length" attribute must be boolean ("true", "1", "false", "0")') val = attrs.get('sq_inplace_concat', None) if val is not None: if val in ('true', '1'): obj.setSq_inplace_concat(1) elif val in ('false', '0'): obj.setSq_inplace_concat(0) else: self.reportError('"sq_inplace_concat" attribute must be boolean ("true", "1", "false", "0")') stackObj = SaxStackElement('Sequence', obj) self.stack.append(stackObj) done = 1 elif name == 'CustomAttributes': stackObj = SaxStackElement('CustomAttributes', None) self.stack.append(stackObj) done = 1 elif name == 'ClassDeclarations': stackObj = SaxStackElement('ClassDeclarations', None) self.stack.append(stackObj) done = 1 elif name == 'Dependencies': obj = Dependencies.factory() stackObj = SaxStackElement('Dependencies', obj) self.stack.append(stackObj) done = 1 elif name == 'Content': obj = Content.factory() stackObj = SaxStackElement('Content', obj) self.stack.append(stackObj) done = 1 elif name == 'Property': obj = Property.factory() stackObj = SaxStackElement('Property', obj) self.stack.append(stackObj) done = 1 elif name == 'Feature': obj = Feature.factory() val = attrs.get('Name', None) if val is not None: obj.setName(val) stackObj = SaxStackElement('Feature', obj) self.stack.append(stackObj) done = 1 elif name == 'ViewProvider': obj = ViewProvider.factory() stackObj = SaxStackElement('ViewProvider', obj) self.stack.append(stackObj) done = 1 elif name == 'DocObject': obj = DocObject.factory() val = attrs.get('Name', None) if val is not None: obj.setName(val) stackObj = SaxStackElement('DocObject', obj) self.stack.append(stackObj) done = 1 elif name == 'GuiCommand': stackObj = SaxStackElement('GuiCommand', None) self.stack.append(stackObj) done = 1 elif name == 'PreferencesPage': stackObj = SaxStackElement('PreferencesPage', None) self.stack.append(stackObj) done = 1 elif name == 'Author': obj = Author.factory() val = attrs.get('Name', None) if val is not None: obj.setName(val) val = attrs.get('Licence', None) if val is not None: obj.setLicence(val) val = attrs.get('EMail', None) if val is not None: obj.setEmail(val) stackObj = SaxStackElement('Author', obj) self.stack.append(stackObj) done = 1 elif name == 'DeveloperDocu': stackObj = SaxStackElement('DeveloperDocu', None) self.stack.append(stackObj) done = 1 elif name == 'UserDocu': stackObj = SaxStackElement('UserDocu', None) self.stack.append(stackObj) done = 1 if not done: self.reportError('"%s" element not allowed here.' % name) def endElement(self, name): done = 0 if name == 'GenerateModel': if len(self.stack) == 1: self.root = self.stack[-1].obj self.stack.pop() done = 1 elif name == 'Module': if len(self.stack) >= 2: self.stack[-2].obj.addModule(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'PythonExport': if len(self.stack) >= 2: self.stack[-2].obj.addPythonexport(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'Documentation': if len(self.stack) >= 2: self.stack[-2].obj.setDocumentation(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'Methode': if len(self.stack) >= 2: self.stack[-2].obj.addMethode(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'Parameter': if len(self.stack) >= 2: self.stack[-2].obj.addParameter(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'Attribute': if len(self.stack) >= 2: self.stack[-2].obj.addAttribute(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'Sequence': if len(self.stack) >= 2: self.stack[-2].obj.setSequence(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'CustomAttributes': if len(self.stack) >= 2: content = self.stack[-1].content self.stack[-2].obj.setCustomattributes(content) self.stack.pop() done = 1 elif name == 'ClassDeclarations': if len(self.stack) >= 2: content = self.stack[-1].content self.stack[-2].obj.setClassdeclarations(content) self.stack.pop() done = 1 elif name == 'Dependencies': if len(self.stack) >= 2: self.stack[-2].obj.setDependencies(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'Content': if len(self.stack) >= 2: self.stack[-2].obj.setContent(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'Property': if len(self.stack) >= 2: self.stack[-2].obj.addProperty(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'Feature': if len(self.stack) >= 2: self.stack[-2].obj.addFeature(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'ViewProvider': if len(self.stack) >= 2: self.stack[-2].obj.setViewprovider(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'DocObject': if len(self.stack) >= 2: self.stack[-2].obj.addDocobject(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'GuiCommand': if len(self.stack) >= 2: content = self.stack[-1].content self.stack[-2].obj.addGuicommand(content) self.stack.pop() done = 1 elif name == 'PreferencesPage': if len(self.stack) >= 2: content = self.stack[-1].content self.stack[-2].obj.addPreferencespage(content) self.stack.pop() done = 1 elif name == 'Author': if len(self.stack) >= 2: self.stack[-2].obj.setAuthor(self.stack[-1].obj) self.stack.pop() done = 1 elif name == 'DeveloperDocu': if len(self.stack) >= 2: content = self.stack[-1].content self.stack[-2].obj.setDeveloperdocu(content) self.stack.pop() done = 1 elif name == 'UserDocu': if len(self.stack) >= 2: content = self.stack[-1].content self.stack[-2].obj.setUserdocu(content) self.stack.pop() done = 1 if not done: self.reportError('"%s" element not allowed here.' % name) def characters(self, chrs, start, end): if len(self.stack) > 0: self.stack[-1].content += chrs[start:end] def reportError(self, mesg): locator = self.locator sys.stderr.write('Doc: %s Line: %d Column: %d\n' % \ (locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber() + 1)) sys.stderr.write(mesg) sys.stderr.write('\n') sys.exit(-1) #raise RuntimeError USAGE_TEXT = """ Usage: python <Parser>.py [ -s ] <in_xml_file> Options: -s Use the SAX parser, not the minidom parser. """ def usage(): print USAGE_TEXT sys.exit(-1) # # SAX handler used to determine the top level element. # class SaxSelectorHandler(handler.ContentHandler): def __init__(self): self.topElementName = None def getTopElementName(self): return self.topElementName def startElement(self, name, attrs): self.topElementName = name raise StopIteration def parseSelect(inFileName): infile = file(inFileName, 'r') topElementName = None parser = make_parser() documentHandler = SaxSelectorHandler() parser.setContentHandler(documentHandler) try: try: parser.parse(infile) except StopIteration: topElementName = documentHandler.getTopElementName() if topElementName is None: raise RuntimeError, 'no top level element' topElementName = topElementName.replace('-', '_').replace(':', '_') if topElementName not in globals(): raise RuntimeError, 'no class for top element: %s' % topElementName topElement = globals()[topElementName] infile.seek(0) doc = minidom.parse(infile) finally: infile.close() rootNode = doc.childNodes[0] rootObj = topElement.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None sys.stdout.write('<?xml version="1.0" ?>\n') rootObj.export(sys.stdout, 0) return rootObj def saxParse(inFileName): parser = make_parser() documentHandler = SaxGeneratemodelHandler() parser.setDocumentHandler(documentHandler) parser.parse('file:%s' % inFileName) root = documentHandler.getRoot() sys.stdout.write('<?xml version="1.0" ?>\n') root.export(sys.stdout, 0) return root def saxParseString(inString): parser = make_parser() documentHandler = SaxGeneratemodelHandler() parser.setDocumentHandler(documentHandler) parser.feed(inString) parser.close() rootObj = documentHandler.getRoot() #sys.stdout.write('<?xml version="1.0" ?>\n') #rootObj.export(sys.stdout, 0) return rootObj def parse(inFileName): doc = minidom.parse(inFileName) rootNode = doc.documentElement rootObj = GenerateModel.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None sys.stdout.write('<?xml version="1.0" ?>\n') rootObj.export(sys.stdout, 0, name_="GenerateModel") return rootObj def parseString(inString): doc = minidom.parseString(inString) rootNode = doc.documentElement rootObj = GenerateModel.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None sys.stdout.write('<?xml version="1.0" ?>\n') rootObj.export(sys.stdout, 0, name_="GenerateModel") return rootObj def parseLiteral(inFileName): doc = minidom.parse(inFileName) rootNode = doc.documentElement rootObj = GenerateModel.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None sys.stdout.write('from generateModel_Module import *\n\n') sys.stdout.write('rootObj = GenerateModel(\n') rootObj.exportLiteral(sys.stdout, 0, name_="GenerateModel") sys.stdout.write(')\n') return rootObj def main(): args = sys.argv[1:] if len(args) == 2 and args[0] == '-s': saxParse(args[1]) elif len(args) == 1: parse(args[0]) else: usage() if __name__ == '__main__': main() #import pdb #pdb.run('main()')
lgpl-2.1
BlesseNtumble/Traincraft-5
src/main/java/train/common/entity/rollingStock/EntityLocoSteamBR80_DB.java
5508
package train.common.entity.rollingStock; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; import train.common.Traincraft; import train.common.api.LiquidManager; import train.common.api.SteamTrain; import train.common.library.EnumTrains; import train.common.library.GuiIDs; public class EntityLocoSteamBR80_DB extends SteamTrain { public EntityLocoSteamBR80_DB(World world) { super(world, EnumTrains.locoSteamBR80.getTankCapacity(), LiquidManager.WATER_FILTER); initLocoSteam(); } public void initLocoSteam() { fuelTrain = 0; locoInvent = new ItemStack[inventorySize]; } public EntityLocoSteamBR80_DB(World world, double d, double d1, double d2) { this(world); setPosition(d, d1 + (double) yOffset, d2); motionX = 0.0D; motionY = 0.0D; motionZ = 0.0D; prevPosX = d; prevPosY = d1; prevPosZ = d2; } @Override public void updateRiderPosition() { double distance = -0.1; double pitchRads = this.anglePitchClient * 3.141592653589793D / 180.0D; float rotationCos1 = (float) Math.cos(Math.toRadians(this.renderYaw + 90)); float rotationSin1 = (float) Math.sin(Math.toRadians((this.renderYaw + 90))); float pitch = (float) (posY + ((Math.tan(pitchRads)*distance)+getMountedYOffset()) + riddenByEntity.getYOffset()+0.45); double bogieX1 = (this.posX + (rotationCos1 * distance)); double bogieZ1 = (this.posZ + (rotationSin1* distance)); if(anglePitchClient>20 && rotationCos1 == 1){ bogieX1-=pitchRads*0.9; pitch-=pitchRads*0.3; } if(anglePitchClient>20 && rotationSin1 == 1){ bogieZ1-=pitchRads*0.9; pitch-=pitchRads*0.3; } riddenByEntity.setPosition(bogieX1, pitch, bogieZ1); //riddenByEntity.setPosition(posX, posY + getMountedYOffset() + riddenByEntity.getYOffset() + 0.45, posZ); } @Override public void setDead() { super.setDead(); isDead = true; if (worldObj.isRemote) { return; } label0: for (int i = 0; i < getSizeInventory(); i++) { ItemStack itemstack = getStackInSlot(i); if (itemstack == null) { continue; } float f = rand.nextFloat() * 0.8F + 0.1F; float f1 = rand.nextFloat() * 0.8F + 0.1F; float f2 = rand.nextFloat() * 0.8F + 0.1F; do { if (itemstack.stackSize <= 0) { continue label0; } int j = rand.nextInt(21) + 10; if (j > itemstack.stackSize) { j = itemstack.stackSize; } itemstack.stackSize -= j; EntityItem entityitem = new EntityItem(worldObj, posX + (double) f, posY + (double) f1, posZ + (double) f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); float f3 = 0.05F; entityitem.motionX = (float) rand.nextGaussian() * f3; entityitem.motionY = (float) rand.nextGaussian() * f3 + 0.2F; entityitem.motionZ = (float) rand.nextGaussian() * f3; worldObj.spawnEntityInWorld(entityitem); } while (true); } } @Override public void pressKey(int i) { if (i == 7 && riddenByEntity != null && riddenByEntity instanceof EntityPlayer) { ((EntityPlayer) riddenByEntity).openGui(Traincraft.instance, GuiIDs.LOCO, worldObj, (int) this.posX, (int) this.posY, (int) this.posZ); } } @Override public void onUpdate() { checkInvent(locoInvent[0], locoInvent[1], this); super.onUpdate(); } @Override protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { super.writeEntityToNBT(nbttagcompound); nbttagcompound.setShort("fuelTrain", (short) fuelTrain); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < locoInvent.length; i++) { if (locoInvent[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte) i); locoInvent[i].writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } nbttagcompound.setTag("Items", nbttaglist); } @Override protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { super.readEntityFromNBT(nbttagcompound); fuelTrain = nbttagcompound.getShort("fuelTrain"); NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); locoInvent = new ItemStack[getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); i++) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("Slot") & 0xff; if (j >= 0 && j < locoInvent.length) { locoInvent[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } } @Override public int getSizeInventory() { return inventorySize; } @Override public String getInventoryName() { return "BR80"; } @Override public boolean interactFirst(EntityPlayer entityplayer) { playerEntity = entityplayer; if ((super.interactFirst(entityplayer))) { return false; } if (!worldObj.isRemote) { if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { return true; } entityplayer.mountEntity(this); } return true; } @Override public float getOptimalDistance(EntityMinecart cart) { float dist = 1.1F; return (dist); } @Override public boolean canBeAdjusted(EntityMinecart cart) { return canBeAdjusted; } @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { return true; } }
lgpl-2.1
dsroche/flint2
fmpq_mat/window_init.c
849
/* Copyright (C) 2015 Elena Sergeicheva This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <http://www.gnu.org/licenses/>. */ #include "fmpq_mat.h" void fmpq_mat_window_init(fmpq_mat_t window, const fmpq_mat_t mat, slong r1, slong c1, slong r2, slong c2) { slong i; window->entries = NULL; if (r2 > r1) window->rows = (fmpq **) flint_malloc((r2 - r1) * sizeof(fmpq *)); if (mat->c > 0) { for (i = 0; i < r2 - r1; i++) window->rows[i] = mat->rows[r1 + i] + c1; } window->r = r2 - r1; window->c = c2 - c1; }
lgpl-2.1
drf/Ketaroller
cmake/modules/FindAlsa.cmake
997
# - Find alsa # Find the alsa libraries (asound) # # This module defines the following variables: # ALSA_FOUND - True if ALSA_INCLUDE_DIR & ALSA_LIBRARY are found # ALSA_LIBRARIES - Set when ALSA_LIBRARY is found # ALSA_INCLUDE_DIRS - Set when ALSA_INCLUDE_DIR is found # # ALSA_INCLUDE_DIR - where to find asoundlib.h, etc. # ALSA_LIBRARY - the asound library # find_path(ALSA_INCLUDE_DIR NAMES asoundlib.h PATH_SUFFIXES alsa DOC "The ALSA (asound) include directory" ) find_library(ALSA_LIBRARY NAMES asound DOC "The ALSA (asound) library" ) # handle the QUIETLY and REQUIRED arguments and set ALSA_FOUND to TRUE if # all listed variables are TRUE include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA DEFAULT_MSG ALSA_LIBRARY ALSA_INCLUDE_DIR) if(ALSA_FOUND) set( ALSA_LIBRARIES ${ALSA_LIBRARY} ) set( ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIR} ) endif() mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY)
lgpl-2.1
GerhardUlli/TSxBot
src/tsxdk/entity/meta/EntityList.java
928
package tsxdk.entity.meta; import java.util.Collection; import tsxdk.entity.TsEntity; /** * Generic Type for Entity-lists. * Used For Channels, Clients, Complains * @param <E> The entity stored in this list * @param <S> The Slot for this entity (unique ID) */ public interface EntityList<E extends TsEntity, S> { /** * @param slot The identifier for this slot * @return An Entity for given slot */ E acquire (S slot); /** * Sets all registered entities to the initial state */ void setInitial (); /** * Sets all registered entities to the touched state */ void setTouched(); /** * Clears cached entities */ void clearCache(); /** * Removes all unused Entities */ void cleanUp(); /** * @return the count of entities in this list */ int getEntityCount (); TsEntity[] getIterable(); Collection<? super E> getContentList(); }
lgpl-2.1
CodeDJ/qt5-hidpi
qt/qtbase/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
25201
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QtTest/QTest> #ifdef Q_OS_WIN #include <winsock2.h> #endif #include <qcoreapplication.h> #include <qdatastream.h> #include <qhostaddress.h> #include <qdatetime.h> #ifdef Q_OS_UNIX #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #endif #ifdef Q_OS_VXWORKS #include <sockLib.h> #endif #include <stddef.h> #define PLATFORMSOCKETENGINE QNativeSocketEngine #define PLATFORMSOCKETENGINESTRING "QNativeSocketEngine" #include <private/qnativesocketengine_p.h> #include <qstringlist.h> #include "../../../network-settings.h" class tst_PlatformSocketEngine : public QObject { Q_OBJECT public: tst_PlatformSocketEngine(); virtual ~tst_PlatformSocketEngine(); public slots: void initTestCase(); void init(); void cleanup(); private slots: void construction(); void simpleConnectToIMAP(); void udpLoopbackTest(); void udpIPv6LoopbackTest(); void broadcastTest(); void serverTest(); void udpLoopbackPerformance(); void tcpLoopbackPerformance(); void readWriteBufferSize(); void bind(); void networkError(); void setSocketDescriptor(); void invalidSend(); void receiveUrgentData(); void tooManySockets(); }; tst_PlatformSocketEngine::tst_PlatformSocketEngine() { } tst_PlatformSocketEngine::~tst_PlatformSocketEngine() { } void tst_PlatformSocketEngine::initTestCase() { QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); } void tst_PlatformSocketEngine::init() { } void tst_PlatformSocketEngine::cleanup() { } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::construction() { PLATFORMSOCKETENGINE socketDevice; QVERIFY(!socketDevice.isValid()); // Initialize device QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QVERIFY(socketDevice.isValid()); QVERIFY(socketDevice.protocol() == QAbstractSocket::IPv4Protocol); QVERIFY(socketDevice.socketType() == QAbstractSocket::TcpSocket); QVERIFY(socketDevice.state() == QAbstractSocket::UnconnectedState); QVERIFY(socketDevice.socketDescriptor() != -1); QVERIFY(socketDevice.localAddress() == QHostAddress()); QVERIFY(socketDevice.localPort() == 0); QVERIFY(socketDevice.peerAddress() == QHostAddress()); QVERIFY(socketDevice.peerPort() == 0); QVERIFY(socketDevice.error() == QAbstractSocket::UnknownSocketError); QTest::ignoreMessage(QtWarningMsg, PLATFORMSOCKETENGINESTRING "::bytesAvailable() was called in QAbstractSocket::UnconnectedState"); QVERIFY(socketDevice.bytesAvailable() == -1); QTest::ignoreMessage(QtWarningMsg, PLATFORMSOCKETENGINESTRING "::hasPendingDatagrams() was called in QAbstractSocket::UnconnectedState"); QVERIFY(!socketDevice.hasPendingDatagrams()); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::simpleConnectToIMAP() { PLATFORMSOCKETENGINE socketDevice; // Initialize device QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QVERIFY(socketDevice.state() == QAbstractSocket::UnconnectedState); const bool isConnected = socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143); if (!isConnected) { QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); } QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); // Read the greeting qint64 available = socketDevice.bytesAvailable(); QVERIFY(available > 0); QByteArray array; array.resize(available); QVERIFY(socketDevice.read(array.data(), array.size()) == available); // Check that the greeting is what we expect it to be QVERIFY2(QtNetworkSettings::compareReplyIMAP(array), array.constData()); // Write a logout message QByteArray array2 = "ZZZ LOGOUT\r\n"; QVERIFY(socketDevice.write(array2.data(), array2.size()) == array2.size()); // Wait for the response QVERIFY(socketDevice.waitForRead()); available = socketDevice.bytesAvailable(); QVERIFY(available > 0); array.resize(available); QVERIFY(socketDevice.read(array.data(), array.size()) == available); // Check that the greeting is what we expect it to be QCOMPARE(array.constData(), "* BYE LOGOUT received\r\n" "ZZZ OK Completed\r\n"); // Wait for the response QVERIFY(socketDevice.waitForRead()); char c; QVERIFY(socketDevice.read(&c, sizeof(c)) == -1); QVERIFY(socketDevice.error() == QAbstractSocket::RemoteHostClosedError); QVERIFY(socketDevice.state() == QAbstractSocket::UnconnectedState); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::udpLoopbackTest() { PLATFORMSOCKETENGINE udpSocket; // Initialize device #1 QVERIFY(udpSocket.initialize(QAbstractSocket::UdpSocket)); QVERIFY(udpSocket.isValid()); QVERIFY(udpSocket.socketDescriptor() != -1); QVERIFY(udpSocket.protocol() == QAbstractSocket::IPv4Protocol); QVERIFY(udpSocket.socketType() == QAbstractSocket::UdpSocket); QVERIFY(udpSocket.state() == QAbstractSocket::UnconnectedState); // Bind #1 to localhost QVERIFY(udpSocket.bind(QHostAddress("127.0.0.1"), 0)); QVERIFY(udpSocket.state() == QAbstractSocket::BoundState); quint16 port = udpSocket.localPort(); QVERIFY(port != 0); // Initialize device #2 PLATFORMSOCKETENGINE udpSocket2; QVERIFY(udpSocket2.initialize(QAbstractSocket::UdpSocket)); // Connect device #2 to #1 QVERIFY(udpSocket2.connectToHost(QHostAddress("127.0.0.1"), port)); QVERIFY(udpSocket2.state() == QAbstractSocket::ConnectedState); // Write a message to #1 QByteArray message1 = "hei der"; QVERIFY(udpSocket2.write(message1.data(), message1.size()) == message1.size()); // Read the message from #2 QVERIFY(udpSocket.waitForRead()); QVERIFY(udpSocket.hasPendingDatagrams()); qint64 available = udpSocket.pendingDatagramSize(); QVERIFY(available > 0); QByteArray answer; answer.resize(available); QHostAddress senderAddress; quint16 senderPort = 0; QVERIFY(udpSocket.readDatagram(answer.data(), answer.size(), &senderAddress, &senderPort) == message1.size()); QVERIFY(senderAddress == QHostAddress("127.0.0.1")); QVERIFY(senderPort != 0); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::udpIPv6LoopbackTest() { PLATFORMSOCKETENGINE udpSocket; // Initialize device #1 bool init = udpSocket.initialize(QAbstractSocket::UdpSocket, QAbstractSocket::IPv6Protocol); if (!init) { QVERIFY(udpSocket.error() == QAbstractSocket::UnsupportedSocketOperationError); } else { QVERIFY(udpSocket.protocol() == QAbstractSocket::IPv6Protocol); // Bind #1 to localhost QVERIFY(udpSocket.bind(QHostAddress("::1"), 0)); QVERIFY(udpSocket.state() == QAbstractSocket::BoundState); quint16 port = udpSocket.localPort(); QVERIFY(port != 0); // Initialize device #2 PLATFORMSOCKETENGINE udpSocket2; QVERIFY(udpSocket2.initialize(QAbstractSocket::UdpSocket, QAbstractSocket::IPv6Protocol)); // Connect device #2 to #1 QVERIFY(udpSocket2.connectToHost(QHostAddress("::1"), port)); QVERIFY(udpSocket2.state() == QAbstractSocket::ConnectedState); // Write a message to #1 QByteArray message1 = "hei der"; QVERIFY(udpSocket2.write(message1.data(), message1.size()) == message1.size()); // Read the message from #2 QVERIFY(udpSocket.waitForRead()); QVERIFY(udpSocket.hasPendingDatagrams()); qint64 available = udpSocket.pendingDatagramSize(); QVERIFY(available > 0); QByteArray answer; answer.resize(available); QHostAddress senderAddress; quint16 senderPort = 0; QVERIFY(udpSocket.readDatagram(answer.data(), answer.size(), &senderAddress, &senderPort) == message1.size()); QVERIFY(senderAddress == QHostAddress("::1")); QVERIFY(senderPort != 0); } } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::broadcastTest() { #ifdef Q_OS_AIX QSKIP("Broadcast does not work on darko"); #endif PLATFORMSOCKETENGINE broadcastSocket; // Initialize a regular Udp socket QVERIFY(broadcastSocket.initialize(QAbstractSocket::UdpSocket, QAbstractSocket::AnyIPProtocol)); // Bind to any port on all interfaces QVERIFY(broadcastSocket.bind(QHostAddress::Any, 0)); QVERIFY(broadcastSocket.state() == QAbstractSocket::BoundState); quint16 port = broadcastSocket.localPort(); QVERIFY(port > 0); // Broadcast an inappropriate troll message QByteArray trollMessage = "MOOT wtf is a MOOT? talk english not your sutpiD ENGLISH."; qint64 written = broadcastSocket.writeDatagram(trollMessage.data(), trollMessage.size(), QHostAddress::Broadcast, port); QCOMPARE((int)written, trollMessage.size()); // Wait until we receive it ourselves #if defined(Q_OS_FREEBSD) QEXPECT_FAIL("", "Broadcasting to 255.255.255.255 does not work on FreeBSD", Abort); #endif QVERIFY(broadcastSocket.waitForRead()); QVERIFY(broadcastSocket.hasPendingDatagrams()); qlonglong available = broadcastSocket.pendingDatagramSize(); QByteArray response; response.resize(available); QVERIFY(broadcastSocket.readDatagram(response.data(), response.size()) == response.size()); QCOMPARE(response, trollMessage); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::serverTest() { PLATFORMSOCKETENGINE server; // Initialize a Tcp socket QVERIFY(server.initialize(QAbstractSocket::TcpSocket)); // Bind to any port on all interfaces QVERIFY(server.bind(QHostAddress("0.0.0.0"), 0)); QVERIFY(server.state() == QAbstractSocket::BoundState); quint16 port = server.localPort(); // Listen for incoming connections QVERIFY(server.listen()); QVERIFY(server.state() == QAbstractSocket::ListeningState); // Initialize a Tcp socket PLATFORMSOCKETENGINE client; QVERIFY(client.initialize(QAbstractSocket::TcpSocket)); if (!client.connectToHost(QHostAddress("127.0.0.1"), port)) { QVERIFY(client.state() == QAbstractSocket::ConnectingState); QVERIFY(client.waitForWrite()); QVERIFY(client.state() == QAbstractSocket::ConnectedState); } // The server accepts the connection int socketDescriptor = server.accept(); QVERIFY(socketDescriptor > 0); // A socket device is initialized on the server side, passing the // socket descriptor from accept(). It's pre-connected. PLATFORMSOCKETENGINE serverSocket; QVERIFY(serverSocket.initialize(socketDescriptor)); QVERIFY(serverSocket.state() == QAbstractSocket::ConnectedState); // The server socket sends a greeting to the clietn QByteArray greeting = "Greetings!"; QVERIFY(serverSocket.write(greeting.data(), greeting.size()) == greeting.size()); // The client waits for the greeting to arrive QVERIFY(client.waitForRead()); qint64 available = client.bytesAvailable(); QVERIFY(available > 0); // The client reads the greeting and checks that it's correct QByteArray response; response.resize(available); QVERIFY(client.read(response.data(), response.size()) == response.size()); QCOMPARE(response, greeting); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::udpLoopbackPerformance() { PLATFORMSOCKETENGINE udpSocket; // Initialize device #1 QVERIFY(udpSocket.initialize(QAbstractSocket::UdpSocket)); QVERIFY(udpSocket.isValid()); QVERIFY(udpSocket.socketDescriptor() != -1); QVERIFY(udpSocket.protocol() == QAbstractSocket::IPv4Protocol); QVERIFY(udpSocket.socketType() == QAbstractSocket::UdpSocket); QVERIFY(udpSocket.state() == QAbstractSocket::UnconnectedState); // Bind #1 to localhost QVERIFY(udpSocket.bind(QHostAddress("127.0.0.1"), 0)); QVERIFY(udpSocket.state() == QAbstractSocket::BoundState); quint16 port = udpSocket.localPort(); QVERIFY(port != 0); // Initialize device #2 PLATFORMSOCKETENGINE udpSocket2; QVERIFY(udpSocket2.initialize(QAbstractSocket::UdpSocket)); // Connect device #2 to #1 QVERIFY(udpSocket2.connectToHost(QHostAddress("127.0.0.1"), port)); QVERIFY(udpSocket2.state() == QAbstractSocket::ConnectedState); const int messageSize = 8192; QByteArray message1(messageSize, '@'); QByteArray answer(messageSize, '@'); QHostAddress localhost = QHostAddress::LocalHost; qlonglong readBytes = 0; QTime timer; timer.start(); while (timer.elapsed() < 5000) { udpSocket2.write(message1.data(), message1.size()); udpSocket.waitForRead(); while (udpSocket.hasPendingDatagrams()) { readBytes += (qlonglong) udpSocket.readDatagram(answer.data(), answer.size()); } } qDebug("\t\t%.1fMB/%.1fs: %.1fMB/s", readBytes / (1024.0 * 1024.0), timer.elapsed() / 1024.0, (readBytes / (timer.elapsed() / 1000.0)) / (1024 * 1024)); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::tcpLoopbackPerformance() { PLATFORMSOCKETENGINE server; // Initialize a Tcp socket QVERIFY(server.initialize(QAbstractSocket::TcpSocket)); // Bind to any port on all interfaces QVERIFY(server.bind(QHostAddress("0.0.0.0"), 0)); QVERIFY(server.state() == QAbstractSocket::BoundState); quint16 port = server.localPort(); // Listen for incoming connections QVERIFY(server.listen()); QVERIFY(server.state() == QAbstractSocket::ListeningState); // Initialize a Tcp socket PLATFORMSOCKETENGINE client; QVERIFY(client.initialize(QAbstractSocket::TcpSocket)); // Connect to our server if (!client.connectToHost(QHostAddress("127.0.0.1"), port)) { QVERIFY(client.state() == QAbstractSocket::ConnectingState); QVERIFY(client.waitForWrite()); QVERIFY(client.state() == QAbstractSocket::ConnectedState); } // The server accepts the connection int socketDescriptor = server.accept(); QVERIFY(socketDescriptor > 0); // A socket device is initialized on the server side, passing the // socket descriptor from accept(). It's pre-connected. PLATFORMSOCKETENGINE serverSocket; QVERIFY(serverSocket.initialize(socketDescriptor)); QVERIFY(serverSocket.state() == QAbstractSocket::ConnectedState); const int messageSize = 1024 * 256; QByteArray message1(messageSize, '@'); QByteArray answer(messageSize, '@'); QTime timer; timer.start(); qlonglong readBytes = 0; while (timer.elapsed() < 5000) { qlonglong written = serverSocket.write(message1.data(), message1.size()); while (written > 0) { client.waitForRead(); if (client.bytesAvailable() > 0) { qlonglong readNow = client.read(answer.data(), answer.size()); written -= readNow; readBytes += readNow; } } } qDebug("\t\t%.1fMB/%.1fs: %.1fMB/s", readBytes / (1024.0 * 1024.0), timer.elapsed() / 1024.0, (readBytes / (timer.elapsed() / 1000.0)) / (1024 * 1024)); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::readWriteBufferSize() { PLATFORMSOCKETENGINE device; QVERIFY(device.initialize(QAbstractSocket::TcpSocket)); qint64 bufferSize = device.receiveBufferSize(); QVERIFY(bufferSize != -1); device.setReceiveBufferSize(bufferSize + 1); #if defined(Q_OS_WINCE) QEXPECT_FAIL(0, "Not supported by default on WinCE", Continue); #endif QVERIFY(device.receiveBufferSize() > bufferSize); bufferSize = device.sendBufferSize(); QVERIFY(bufferSize != -1); device.setSendBufferSize(bufferSize + 1); QVERIFY(device.sendBufferSize() > bufferSize); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::tooManySockets() { #if defined Q_OS_WIN QSKIP("Certain windows machines suffocate and spend too much time in this test."); #endif QList<PLATFORMSOCKETENGINE *> sockets; PLATFORMSOCKETENGINE *socketLayer = 0; for (;;) { socketLayer = new PLATFORMSOCKETENGINE; sockets.append(socketLayer); if (!socketLayer->initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)) break; } QCOMPARE(socketLayer->error(), QAbstractSocket::SocketResourceError); qDeleteAll(sockets); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::bind() { #if !defined Q_OS_WIN PLATFORMSOCKETENGINE binder; QVERIFY(binder.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QVERIFY(!binder.bind(QHostAddress::AnyIPv4, 82)); QVERIFY(binder.error() == QAbstractSocket::SocketAccessError); #endif PLATFORMSOCKETENGINE binder2; QVERIFY(binder2.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QVERIFY(binder2.bind(QHostAddress::AnyIPv4, 31180)); PLATFORMSOCKETENGINE binder3; QVERIFY(binder3.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QVERIFY(!binder3.bind(QHostAddress::AnyIPv4, 31180)); QVERIFY(binder3.error() == QAbstractSocket::AddressInUseError); if (QtNetworkSettings::hasIPv6()) { PLATFORMSOCKETENGINE binder4; QVERIFY(binder4.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv6Protocol)); QVERIFY(binder4.bind(QHostAddress::AnyIPv6, 31180)); PLATFORMSOCKETENGINE binder5; QVERIFY(binder5.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv6Protocol)); QVERIFY(!binder5.bind(QHostAddress::AnyIPv6, 31180)); QVERIFY(binder5.error() == QAbstractSocket::AddressInUseError); } PLATFORMSOCKETENGINE binder6; QVERIFY(binder6.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::AnyIPProtocol)); QVERIFY(binder6.bind(QHostAddress::Any, 31181)); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::networkError() { PLATFORMSOCKETENGINE client; QVERIFY(client.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); const bool isConnected = client.connectToHost(QtNetworkSettings::serverIP(), 143); if (!isConnected) { QVERIFY(client.state() == QAbstractSocket::ConnectingState); QVERIFY(client.waitForWrite()); QVERIFY(client.state() == QAbstractSocket::ConnectedState); } QVERIFY(client.state() == QAbstractSocket::ConnectedState); // An unexpected network error! #ifdef Q_OS_WIN // could use shutdown to produce different errors ::closesocket(client.socketDescriptor()); #else ::close(client.socketDescriptor()); #endif QVERIFY(client.read(0, 0) == -1); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::setSocketDescriptor() { PLATFORMSOCKETENGINE socket1; QVERIFY(socket1.initialize(QAbstractSocket::TcpSocket)); PLATFORMSOCKETENGINE socket2; QVERIFY(socket2.initialize(socket1.socketDescriptor())); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::invalidSend() { PLATFORMSOCKETENGINE socket; QVERIFY(socket.initialize(QAbstractSocket::TcpSocket)); QTest::ignoreMessage(QtWarningMsg, PLATFORMSOCKETENGINESTRING "::writeDatagram() was" " called by a socket other than QAbstractSocket::UdpSocket"); QCOMPARE(socket.writeDatagram("hei", 3, QHostAddress::LocalHost, 143), (qlonglong) -1); } //--------------------------------------------------------------------------- void tst_PlatformSocketEngine::receiveUrgentData() { PLATFORMSOCKETENGINE server; QVERIFY(server.initialize(QAbstractSocket::TcpSocket)); // Bind to any port on all interfaces QVERIFY(server.bind(QHostAddress("0.0.0.0"), 0)); QVERIFY(server.state() == QAbstractSocket::BoundState); quint16 port = server.localPort(); QVERIFY(server.listen()); QVERIFY(server.state() == QAbstractSocket::ListeningState); PLATFORMSOCKETENGINE client; QVERIFY(client.initialize(QAbstractSocket::TcpSocket)); if (!client.connectToHost(QHostAddress("127.0.0.1"), port)) { QVERIFY(client.state() == QAbstractSocket::ConnectingState); QVERIFY(client.waitForWrite()); QVERIFY(client.state() == QAbstractSocket::ConnectedState); } int socketDescriptor = server.accept(); QVERIFY(socketDescriptor > 0); PLATFORMSOCKETENGINE serverSocket; QVERIFY(serverSocket.initialize(socketDescriptor)); QVERIFY(serverSocket.state() == QAbstractSocket::ConnectedState); char msg; int available; QByteArray response; // Native OOB data test doesn't work on HP-UX or WinCE #if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE) // The server sends an urgent message msg = 'Q'; QCOMPARE(int(::send(socketDescriptor, &msg, sizeof(msg), MSG_OOB)), 1); // The client receives the urgent message QVERIFY(client.waitForRead()); available = client.bytesAvailable(); QCOMPARE(available, 1); response.resize(available); QCOMPARE(client.read(response.data(), response.size()), qint64(1)); QCOMPARE(response.at(0), msg); // The client sends an urgent message msg = 'T'; int clientDescriptor = client.socketDescriptor(); QCOMPARE(int(::send(clientDescriptor, &msg, sizeof(msg), MSG_OOB)), 1); // The server receives the urgent message QVERIFY(serverSocket.waitForRead()); available = serverSocket.bytesAvailable(); QCOMPARE(available, 1); response.resize(available); QCOMPARE(serverSocket.read(response.data(), response.size()), qint64(1)); QCOMPARE(response.at(0), msg); #endif } QTEST_MAIN(tst_PlatformSocketEngine) #include "tst_platformsocketengine.moc"
lgpl-2.1
StingStriker353/More-Everything-Mod
src/main/java/com/riphtix/mem/client/forgeobjmodelported/obj/Face.java
2439
package com.riphtix.mem.client.forgeobjmodelported.obj; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.util.Vec3; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class Face { public Vertex[] vertices; public Vertex[] vertexNormals; public Vertex faceNormal; public TextureCoordinate[] textureCoordinates; @SideOnly(Side.CLIENT) public void addFaceForRender(WorldRenderer worldRenderer) { addFaceForRender(worldRenderer, 0.0005F); } @SideOnly(Side.CLIENT) public void addFaceForRender(WorldRenderer worldRenderer, float textureOffset) { if (faceNormal == null) { faceNormal = this.calculateFaceNormal(); } worldRenderer.setNormal(faceNormal.x, faceNormal.y, faceNormal.z); float averageU = 0F; float averageV = 0F; if ((textureCoordinates != null) && (textureCoordinates.length > 0)) { for (int i = 0; i < textureCoordinates.length; ++i) { averageU += textureCoordinates[i].u; averageV += textureCoordinates[i].v; } averageU = averageU / textureCoordinates.length; averageV = averageV / textureCoordinates.length; } float offsetU, offsetV; for (int i = 0; i < vertices.length; ++i) { if ((textureCoordinates != null) && (textureCoordinates.length > 0)) { offsetU = textureOffset; offsetV = textureOffset; if (textureCoordinates[i].u > averageU) { offsetU = -offsetU; } if (textureCoordinates[i].v > averageV) { offsetV = -offsetV; } worldRenderer.addVertexWithUV(vertices[i].x, vertices[i].y, vertices[i].z, textureCoordinates[i].u + offsetU, textureCoordinates[i].v + offsetV); } else { worldRenderer.addVertex(vertices[i].x, vertices[i].y, vertices[i].z); } } } public Vertex calculateFaceNormal() { Vec3 v1 = new Vec3(vertices[1].x - vertices[0].x, vertices[1].y - vertices[0].y, vertices[1].z - vertices[0].z); Vec3 v2 = new Vec3(vertices[2].x - vertices[0].x, vertices[2].y - vertices[0].y, vertices[2].z - vertices[0].z); Vec3 normalVector = null; normalVector = v1.crossProduct(v2).normalize(); return new Vertex((float) normalVector.xCoord, (float) normalVector.yCoord, (float) normalVector.zCoord); } }
lgpl-2.1
deniskin82/tntdb
include/tntdb/mysql/impl/statement.h
4580
/* * Copyright (C) 2005 Tommi Maekitalo * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * As a special exception, you may use this file as part of a free * software library without restriction. Specifically, if other files * instantiate templates or use macros or inline functions from this * file, or you compile this file and link it with other files to * produce an executable, this file does not by itself cause the * resulting executable to be covered by the GNU General Public * License. This exception does not however invalidate any other * reasons why the executable file might be covered by the GNU Library * General Public License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef TNTDB_MYSQL_IMPL_SQLSTATEMENT_H #define TNTDB_MYSQL_IMPL_SQLSTATEMENT_H #include <tntdb/iface/istatement.h> #include <tntdb/iface/irow.h> #include <tntdb/mysql/bindvalues.h> #include <tntdb/mysql/impl/boundrow.h> #include <tntdb/connection.h> #include <map> namespace tntdb { namespace mysql { class Statement : public IStatement { typedef std::multimap<std::string, unsigned> hostvarMapType; tntdb::Connection conn; std::string query; BindValues inVars; hostvarMapType hostvarMap; MYSQL* mysql; MYSQL_STMT* stmt; MYSQL_FIELD* fields; unsigned field_count; cxxtools::SmartPtr<BoundRow> rowPtr; cxxtools::SmartPtr<BoundRow> getRow(); cxxtools::SmartPtr<IRow> fetchRow(); public: Statement(const tntdb::Connection& conn, MYSQL* mysql, const std::string& query); ~Statement(); // methods of IStatement void clear(); void setNull(const std::string& col); void setBool(const std::string& col, bool data); void setShort(const std::string& col, short data); void setInt(const std::string& col, int data); void setLong(const std::string& col, long data); void setUnsignedShort(const std::string& col, unsigned short data); void setUnsigned(const std::string& col, unsigned data); void setUnsignedLong(const std::string& col, unsigned long data); void setInt32(const std::string& col, int32_t data); void setUnsigned32(const std::string& col, uint32_t data); void setInt64(const std::string& col, int64_t data); void setUnsigned64(const std::string& col, uint64_t data); void setDecimal(const std::string& col, const Decimal& data); void setFloat(const std::string& col, float data); void setDouble(const std::string& col, double data); void setChar(const std::string& col, char data); void setString(const std::string& col, const std::string& data); void setBlob(const std::string& col, const Blob& data); void setDate(const std::string& col, const Date& data); void setTime(const std::string& col, const Time& data); void setDatetime(const std::string& col, const Datetime& data); size_type execute(); tntdb::Result select(); tntdb::Row selectRow(); tntdb::Value selectValue(); ICursor* createCursor(unsigned fetchsize); // specfic methods /// getStmt returns a MYSQL_STMT. The caller is responsable to close /// the statement. If this class has already prepared a statement, /// this is returned and removed from this class. MYSQL_STMT* getStmt(); void execute(MYSQL_STMT* stmt, unsigned fetchsize); /// Statement-handles retrieved by getStmt can be offered for reuse /// with this method. Ownership is transfered back to this class. /// If there is already a statement, the offered statement is closed. void putback(MYSQL_STMT* stmt); MYSQL_FIELD* getFields(); unsigned getFieldCount(); }; } } #endif // TNTDB_MYSQL_IMPL_SQLSTATEMENT_H
lgpl-2.1
Luxoft/SDLP2
SDL_Core/src/components/transport_manager/include/transport_manager/transport_adapter/device_scanner.h
2851
/** * \file device_scanner.h * \brief DeviceScanner class header file. * Copyright (c) 2013, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following * disclaimer in the documentation and/or other materials provided with the * distribution. * * Neither the name of the Ford Motor Company nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_DEVICE_SCANNER_H_ #define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_DEVICE_SCANNER_H_ #include "transport_manager/transport_adapter/device.h" #include "transport_manager/transport_adapter/transport_adapter.h" namespace transport_manager { namespace transport_adapter { /** * @brief Abstract class for device scanner. */ class DeviceScanner { public: /** * @brief Start device scanner. * * @return Error information about reason of initialization failure. */ virtual TransportAdapter::Error Init() = 0; /** * @brief * * @return Error information about reason of Scan failure. */ virtual TransportAdapter::Error Scan() = 0; /** * @brief Stop device scanner. */ virtual void Terminate() = 0; /** * @brief Check device scanner for initialization. * * @return true - initialized. * false - not initialized. */ virtual bool IsInitialised() const = 0; /** * @brief Destructor. */ virtual ~DeviceScanner() { } }; } // namespace transport_adapter } // namespace transport_manager #endif /* DEVICE_SCANNER_H_ */
lgpl-2.1
GNOME/monet
monet/mn-private.h
208
#ifndef MN_PRIVATE_H #define MN_PRIVATE_H #define MN_PARAM_READONLY G_PARAM_READABLE | G_PARAM_STATIC_STRINGS #define MN_PARAM_READWRITE G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS #endif /* MN_PRIVATE_H */
lgpl-2.1
kerrickstaley/clutter-vala
clutter/deprecated/clutter-state.c
72681
/* * Clutter. * * An OpenGL based 'interactive canvas' library. * * Authored By Øyvind Kolås <pippin@linux.intel.com> * * Copyright (C) 2009 Intel Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ /** * SECTION:clutter-state * @short_description: State machine with animated transitions * * #ClutterState is an object controlling the tweening of properties on * multiple actors between a set of named states. #ClutterStateKey<!-- -->s * define how the properties are animated. If the source_state_name for a key * is NULL it is used for transition to the target state unless a specific key * exists for transitioning from the current state to the requested state. * * <example id="ClutterState-example"> * <title>A ClutterState example</title> * <para>The following example defines a "base" and a "hover" state in a * #ClutterState instance.</para> * <programlisting> * ClutterState *state = clutter_state_new (); * ClutterColor color = { 0, }; * * /&ast; transition from any state to the "base" state &ast;/ * clutter_color_from_string (&color, "rgb(255, 0, 0)"); * clutter_state_set (state, NULL, "base", * actor, "color", CLUTTER_LINEAR, &color, * actor, "scale-x", CLUTTER_EASE_IN_BOUNCE, 1.0, * actor, "scale-y", CLUTTER_EASE_IN_BOUNCE, 1.0, * NULL); * * /&ast; transition from the "base" state to the "hover" state &ast;/ * clutter_color_from_string (&color, "rgb(0, 0, 255)"); * clutter_state_set (state, "base", "hover", * actor, "color", CLUTTER_LINEAR, &color, * actor, "scale-x", CLUTTER_EASE_OUT_BOUNCE, 1.7, * actor, "scale-y", CLUTTER_EASE_OUT_BOUNCE, 1.7, * NULL); * * /&ast; the default duration of any transition &ast;/ * clutter_state_set_duration (state, NULL, NULL, 500); * * /&ast; set "base" as the initial state &ast;/ * clutter_state_warp_to_state (state, "base"); * </programlisting> * <para>The actor then uses the #ClutterState to animate through the * two states using callbacks for the #ClutterActor::enter-event and * #ClutterActor::leave-event signals.</para> * <programlisting> * static gboolean * on_enter (ClutterActor *actor, * ClutterEvent *event, * ClutterState *state) * { * clutter_state_set_state (state, "hover"); * * return TRUE; * } * * static gboolean * on_leave (ClutterActor *actor, * ClutterEvent *event, * ClutterState *state) * { * clutter_state_set_state (state, "base"); * * return TRUE; * } * </programlisting> * </example> * * <refsect2 id="ClutterState-script"> * <title>ClutterState description for #ClutterScript</title> * <para>#ClutterState defines a custom <emphasis>transitions</emphasis> * property which allows describing the states.</para> * <para>The <emphasis>transitions</emphasis> property has the following * syntax:</para> * <informalexample> * <programlisting> * { * "transitions" : [ * { * "source" : "&lt;source-state&gt;", * "target" : "&lt;target-state&gt;", * "duration" : &lt;milliseconds&gt;, * "keys" : [ * [ * "&lt;object-id&gt;", * "&lt;property-name&gt;", * "&lt;easing-mode&gt;", * "&lt;final-value&gt;", * ], * [ * "&lt;object-id&gt;", * "&lt;property-name&gt;", * "&lt;easing-mode&gt;", * "&lt;final-value&gt;", * &lt;pre-delay&gt;, * &lt;post-delay&gt; * ], * ... * ] * }, * { * "source" : "&lt;source-state&gt;", * "target" : "&lt;target-state&gt;", * "duration" : &lt;milliseconds&gt;, * "animator" : "&lt;animator-definition&gt;" * }, * ... * ] * } * </programlisting> * </informalexample> * <para>Each element of the <emphasis>transitions</emphasis> array follows * the same rules as clutter_state_set_key().</para> * <para>The <emphasis>source</emphasis> and <emphasis>target</emphasis> * values control the source and target state of the transition. The * <emphasis>key</emphasis> and <emphasis>animator</emphasis> are mutually * exclusive. The <emphasis>pre-delay</emphasis> and * <emphasis>post-delay</emphasis> values are optional.</para> * <example id="ClutterState-script-example"> * <title>ClutterState definition</title> * <para>The example below is a translation into a #ClutterScript * definition of the code in the <ulink linkend="ClutterState-example">example * above</ulink>.</para> * <programlisting> * { * "id" : "button-state", * "type" : "ClutterState", * "duration" : 500, * "transitions" : [ * { * "source" : "*", * "target" : "base", * "keys" : [ * [ "button", "color", "linear", "rgb(255, 0, 0)" ], * [ "button", "scale-x", "easeInBounce", 1.0 ], * [ "button", "scale-y", "easeInBounce", 1.0 ] * ] * }, * { * "source" : "base", * "target" : "hover", * "keys" : [ * [ "button", "color", "linear", "rgb(0, 0, 255)" ], * [ "button", "scale-x", "easeOutBounce", 1.7 ], * [ "button", "scale-y", "easeOutBounce", 1.7 ] * ] * } * ] * } * </programlisting> * </example> * </refsect2> * * #ClutterState is available since Clutter 1.4. * * #ClutterState has been deprecated in Clutter 1.12. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <gobject/gvaluecollector.h> #include <string.h> #define CLUTTER_DISABLE_DEPRECATION_WARNINGS #include "clutter-state.h" #include "clutter-alpha.h" #include "clutter-animatable.h" #include "clutter-animator.h" #include "clutter-enum-types.h" #include "clutter-interval.h" #include "clutter-marshal.h" #include "clutter-private.h" #include "clutter-scriptable.h" #include "clutter-script-private.h" typedef struct StateAnimator { const gchar *source_state_name; /* interned string identifying entry */ ClutterAnimator *animator; /* pointer to animator itself */ } StateAnimator; typedef struct State { const gchar *name; /* interned string for this state name */ GHashTable *durations; /* durations for transitions from various state names */ GList *keys; /* list of all keys pertaining to transitions from other states to this one */ GArray *animators; /* list of animators for transitioning from * specific source states */ ClutterState *clutter_state; /* the ClutterState object this state belongs to */ } State; struct _ClutterStatePrivate { GHashTable *states; /* contains state objects */ guint duration; /* global fallback duration */ ClutterTimeline *timeline; /* The timeline used for doing the progress */ ClutterTimeline *slave_timeline; /* a slave timeline used to compute alphas */ const gchar *source_state_name; /* current source state */ State *source_state; /* current source_state */ const gchar *target_state_name; /* current target state */ State *target_state; /* target state name */ ClutterAnimator *current_animator; /* !NULL if the current transition is overriden by an animator */ }; #define SLAVE_TIMELINE_LENGTH 10000 /* * ClutterStateKey: * * An opaque data structure with accessor functions. * */ typedef struct _ClutterStateKey { GObject *object; /* an Gobject */ const gchar *property_name;/* the name of a property */ gulong mode; /* alpha to use */ GValue value; /* target value */ gdouble pre_delay; /* fraction of duration to delay before starting */ gdouble pre_pre_delay;/* fraction of duration to add to pre_delay. This is used to set keys during transitions. */ gdouble post_delay; /* fraction of duration to be done in */ State *source_state; /* source state */ State *target_state; /* target state */ ClutterAlpha *alpha; /* The alpha this key uses for interpolation */ ClutterInterval *interval; /* The interval this key uses for interpolation */ guint is_animatable : 1; guint is_inert : 1; /* set if the key is being destroyed due to weak reference */ gint ref_count; /* reference count for boxed life time */ } _ClutterStateKey; enum { PROP_0, PROP_DURATION, PROP_STATE, PROP_LAST }; static GParamSpec *obj_props[PROP_LAST]; enum { COMPLETED, LAST_SIGNAL }; static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); static guint state_signals[LAST_SIGNAL] = {0, }; #define CLUTTER_STATE_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ CLUTTER_TYPE_STATE, \ ClutterStatePrivate)) G_DEFINE_TYPE_WITH_CODE (ClutterState, clutter_state, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, clutter_scriptable_iface_init)); /** * clutter_state_new: * * Creates a new #ClutterState * * Return value: the newly create #ClutterState instance * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ ClutterState * clutter_state_new (void) { return g_object_new (CLUTTER_TYPE_STATE, NULL); } static gint sort_props_func (gconstpointer a, gconstpointer b) { const ClutterStateKey *pa = a; const ClutterStateKey *pb = b; if (pa->object == pb->object) { gint propnamediff = pa->property_name-pb->property_name; if (propnamediff == 0) return pb->source_state - pa->source_state; return propnamediff; } return pa->object - pb->object; } static State * clutter_state_fetch_state (ClutterState *state, const gchar *state_name, gboolean force_creation); static void object_disappeared (gpointer data, GObject *where_the_object_was); static ClutterStateKey * clutter_state_key_new (State *state, GObject *object, const gchar *property_name, GParamSpec *pspec, guint mode) { ClutterStatePrivate *priv = state->clutter_state->priv; ClutterStateKey *state_key; GValue value = G_VALUE_INIT; state_key = g_slice_new0 (ClutterStateKey); state_key->target_state = state; state_key->object = object; state_key->property_name = g_intern_string (property_name); state_key->mode = mode; state_key->is_animatable = CLUTTER_IS_ANIMATABLE (object); state_key->alpha = clutter_alpha_new (); g_object_ref_sink (state_key->alpha); clutter_alpha_set_mode (state_key->alpha, mode); clutter_alpha_set_timeline (state_key->alpha, priv->slave_timeline); state_key->interval = g_object_new (CLUTTER_TYPE_INTERVAL, "value-type", G_PARAM_SPEC_VALUE_TYPE (pspec), NULL); g_object_ref_sink (state_key->interval); g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); clutter_interval_set_initial_value (state_key->interval, &value); clutter_interval_set_final_value (state_key->interval, &value); g_value_unset (&value); g_object_weak_ref (object, object_disappeared, state_key->target_state->clutter_state); return state_key; } static void clutter_state_key_free (gpointer clutter_state_key) { ClutterStateKey *key = clutter_state_key; if (key == NULL) return; key->ref_count -= 1; if (key->ref_count > 0) return; if (!key->is_inert) { g_object_weak_unref (key->object, object_disappeared, key->target_state->clutter_state); } g_value_unset (&key->value); g_object_unref (key->alpha); g_object_unref (key->interval); g_slice_free (ClutterStateKey, key); } static inline void clutter_state_remove_key_internal (ClutterState *this, const gchar *source_state_name, const gchar *target_state_name, GObject *object, const gchar *property_name, gboolean is_inert) { GList *s, *state_list; State *source_state = NULL; source_state_name = g_intern_string (source_state_name); target_state_name = g_intern_string (target_state_name); property_name = g_intern_string (property_name); if (source_state_name) source_state = clutter_state_fetch_state (this, source_state_name, FALSE); again_from_start: if (target_state_name != NULL) state_list = g_list_append (NULL, (gpointer) target_state_name); else state_list = clutter_state_get_states (this); for (s = state_list; s != NULL; s = s->next) { State *target_state; target_state = clutter_state_fetch_state (this, s->data, FALSE); /* Go through each TargetState */ if (target_state) { GList *k = target_state->keys; /* Note the safe while() loop, because we modify the list inline */ while (k != NULL) { ClutterStateKey *key = k->data; k = k->next; /* Check if each key matches query */ if ( (object == NULL || (object == key->object)) && (source_state == NULL || (source_state == key->source_state)) && (property_name == NULL || ((property_name == key->property_name)))) { /* Remove matching key */ target_state->keys = g_list_remove (target_state->keys, key); key->is_inert = is_inert; clutter_state_key_free (key); /* no more keys with transitions to this target_state*/ if (target_state->keys == NULL) { /* If this state is the current state, unset the state */ if (target_state == this->priv->target_state) clutter_state_set_state (this, NULL); /* remove any keys that exist that uses this state as a source */ clutter_state_remove_key_internal (this, s->data, NULL, NULL, NULL, is_inert); g_hash_table_remove (this->priv->states, s->data); goto again_from_start; /* we have just freed State *target_state, so need to restart removal */ } } } } } g_list_free (state_list); } static void object_disappeared (gpointer data, GObject *where_the_object_was) { clutter_state_remove_key_internal (data, NULL, NULL, (gpointer) where_the_object_was, NULL, TRUE); } static void state_free (gpointer data) { State *state = data; for (; state->keys; state->keys = g_list_remove (state->keys, state->keys->data)) clutter_state_key_free (state->keys->data); g_array_free (state->animators, TRUE); g_hash_table_destroy (state->durations); g_free (state); } static State * state_new (ClutterState *clutter_state, const gchar *name) { State *state; state = g_new0 (State, 1); state->clutter_state = clutter_state; state->name = name; state->animators = g_array_new (TRUE, TRUE, sizeof (StateAnimator)); state->durations = g_hash_table_new (g_direct_hash, g_direct_equal); return state; } static void clutter_state_finalize (GObject *object) { ClutterStatePrivate *priv = CLUTTER_STATE (object)->priv; g_hash_table_destroy (priv->states); g_object_unref (priv->timeline); g_object_unref (priv->slave_timeline); G_OBJECT_CLASS (clutter_state_parent_class)->finalize (object); } static void clutter_state_completed (ClutterTimeline *timeline, ClutterState *state) { ClutterStatePrivate *priv = state->priv; if (priv->current_animator) { clutter_animator_set_timeline (priv->current_animator, NULL); priv->current_animator = NULL; } g_signal_emit (state, state_signals[COMPLETED], 0); } static void clutter_state_new_frame (ClutterTimeline *timeline, gint msecs, ClutterState *state) { ClutterStatePrivate *priv = state->priv; GList *k; gdouble progress; const gchar *curprop = NULL; GObject *curobj = NULL; gboolean found_specific = FALSE; if (priv->current_animator) return; progress = clutter_timeline_get_progress (timeline); for (k = priv->target_state->keys; k; k = k->next) { ClutterStateKey *key = k->data; gdouble sub_progress; if ((curprop && !(curprop == key->property_name)) || key->object != curobj) { curprop = key->property_name; curobj = key->object; found_specific = FALSE; } if (!found_specific) { if (key->source_state != NULL && key->source_state->name != NULL && priv->source_state_name != NULL && g_str_equal (priv->source_state_name, key->source_state->name)) { found_specific = TRUE; } if (found_specific || key->source_state == NULL) { gdouble pre_delay = key->pre_delay + key->pre_pre_delay; sub_progress = (progress - pre_delay) / (1.0 - (pre_delay + key->post_delay)); if (sub_progress >= 0.0) { if (sub_progress >= 1.0) sub_progress = 1.0; clutter_timeline_advance (priv->slave_timeline, sub_progress * SLAVE_TIMELINE_LENGTH); sub_progress = clutter_alpha_get_alpha (key->alpha); if (key->is_animatable) { ClutterAnimatable *animatable; GValue value = G_VALUE_INIT; gboolean res; animatable = CLUTTER_ANIMATABLE (key->object); g_value_init (&value, clutter_state_key_get_property_type (key)); res = clutter_animatable_interpolate_value (animatable, key->property_name, key->interval, sub_progress, &value); if (res) clutter_animatable_set_final_state (animatable, key->property_name, &value); g_value_unset (&value); } else { const GValue *value; value = clutter_interval_compute (key->interval, sub_progress); if (value != NULL) g_object_set_property (key->object, key->property_name, value); } } /* XXX: should the target value of the default destination be * used even when found a specific source_state key? */ } } } } static ClutterTimeline * clutter_state_change (ClutterState *state, const gchar *target_state_name, gboolean animate) { ClutterStatePrivate *priv; ClutterAnimator *animator; State *new_state; guint duration; GList *k; g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL); priv = state->priv; /* If we've been asked to change state to NULL, reset the * ClutterState to its initial state, but leave the keys * alone. */ if (!target_state_name) { if (!priv->target_state) return NULL; priv->source_state_name = priv->target_state_name = NULL; priv->source_state = priv->target_state = NULL; clutter_timeline_stop (priv->timeline); clutter_timeline_rewind (priv->timeline); if (priv->current_animator) { clutter_animator_set_timeline (priv->current_animator, NULL); priv->current_animator = NULL; } return NULL; } target_state_name = g_intern_string (target_state_name); if (target_state_name == priv->target_state_name) { /* Avoid transitioning if the desired state is already current, * unless we're warping to it and the state transition is in * progress (in that case, immediately warp to the state). */ if (!clutter_timeline_is_playing (priv->timeline) || animate) return priv->timeline; } if (priv->current_animator != NULL) { clutter_animator_set_timeline (priv->current_animator, NULL); priv->current_animator = NULL; } priv->source_state_name = priv->target_state_name; priv->target_state_name = target_state_name; g_object_notify_by_pspec (G_OBJECT (state), obj_props[PROP_STATE]); duration = clutter_state_get_duration (state, priv->source_state_name, priv->target_state_name); clutter_timeline_set_duration (priv->timeline, duration); new_state = clutter_state_fetch_state (state, target_state_name, FALSE); if (new_state == NULL) { g_warning ("State '%s' not found", target_state_name); return NULL; } animator = clutter_state_get_animator (state, priv->source_state_name, priv->target_state_name); priv->target_state = new_state; if (animator == NULL && new_state->keys == NULL) animator = clutter_state_get_animator (state, NULL, priv->target_state_name); if (animator != NULL) { /* we've got an animator overriding the tweened animation */ priv->current_animator = animator; clutter_animator_set_timeline (animator, priv->timeline); } else { for (k = new_state->keys; k != NULL; k = k->next) { ClutterStateKey *key = k->data; GValue initial = G_VALUE_INIT; /* Reset the pre-pre-delay - this is only used for setting keys * during transitions. */ key->pre_pre_delay = 0; g_value_init (&initial, clutter_interval_get_value_type (key->interval)); if (key->is_animatable) { ClutterAnimatable *animatable; animatable = CLUTTER_ANIMATABLE (key->object); clutter_animatable_get_initial_state (animatable, key->property_name, &initial); } else g_object_get_property (key->object, key->property_name, &initial); if (clutter_alpha_get_mode (key->alpha) != key->mode) clutter_alpha_set_mode (key->alpha, key->mode); clutter_interval_set_initial_value (key->interval, &initial); clutter_interval_set_final_value (key->interval, &key->value); g_value_unset (&initial); } } if (!animate) { clutter_timeline_stop (priv->timeline); clutter_timeline_advance (priv->timeline, duration); /* emit signals, to change properties, and indicate that the * state change is complete */ g_signal_emit_by_name (priv->timeline, "new-frame", GINT_TO_POINTER (duration), NULL); g_signal_emit_by_name (priv->timeline, "completed", NULL); } else { clutter_timeline_stop (priv->timeline); clutter_timeline_rewind (priv->timeline); clutter_timeline_start (priv->timeline); } return priv->timeline; } /** * clutter_state_set_state: * @state: a #ClutterState * @target_state_name: the state to transition to * * Change the current state of #ClutterState to @target_state_name. * * The state will animate during its transition, see * #clutter_state_warp_to_state for animation-free state switching. * * Setting a %NULL state will stop the current animation and unset * the current state, but keys will be left intact. * * Return value: (transfer none): the #ClutterTimeline that drives the * state transition. The returned timeline is owned by the #ClutterState * and it should not be unreferenced * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ ClutterTimeline * clutter_state_set_state (ClutterState *state, const gchar *target_state_name) { return clutter_state_change (state, target_state_name, TRUE); } /** * clutter_state_warp_to_state: * @state: a #ClutterState * @target_state_name: the state to transition to * * Change to the specified target state immediately with no animation. * * See clutter_state_set_state(). * * Return value: (transfer none): the #ClutterTimeline that drives the * state transition. The returned timeline is owned by the #ClutterState * and it should not be unreferenced * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ ClutterTimeline * clutter_state_warp_to_state (ClutterState *state, const gchar *target_state_name) { return clutter_state_change (state, target_state_name, FALSE); } static GParamSpec * get_property_from_object (GObject *gobject, const gchar *property_name) { GParamSpec *pspec; if (CLUTTER_IS_ANIMATABLE (gobject)) { ClutterAnimatable *animatable = CLUTTER_ANIMATABLE (gobject); pspec = clutter_animatable_find_property (animatable, property_name); } else { GObjectClass *klass = G_OBJECT_GET_CLASS (gobject); pspec = g_object_class_find_property (klass, property_name); } if (pspec == NULL) { g_warning ("Cannot bind property '%s': objects of type '%s' " "do not have this property", property_name, G_OBJECT_TYPE_NAME (gobject)); return NULL; } if (!(pspec->flags & G_PARAM_WRITABLE)) { g_warning ("Cannot bind property '%s' of object of type '%s': " "the property is not writable", property_name, G_OBJECT_TYPE_NAME (gobject)); return NULL; } if (!(pspec->flags & G_PARAM_READABLE)) { g_warning ("Cannot bind property '%s' of object of type '%s': " "the property is not readable", property_name, G_OBJECT_TYPE_NAME (gobject)); return NULL; } if (pspec->flags & G_PARAM_CONSTRUCT_ONLY) { g_warning ("Cannot bind property '%s' of object of type '%s': " "the property is set as constructor-only", property_name, G_OBJECT_TYPE_NAME (gobject)); return NULL; } return pspec; } /** * clutter_state_set: * @state: a #ClutterState instance. * @source_state_name: (allow-none): the name of the source state keys are being added for * @target_state_name: the name of the target state keys are being added for * @first_object: a #GObject * @first_property_name: a property of @first_object to specify a key for * @first_mode: the id of the alpha function to use * @...: the value @first_property_name should have in @target_state_name, * followed by object, property name, mode, value tuples, terminated * by %NULL * * Adds multiple keys to a named state of a #ClutterState instance, specifying * the easing mode and value a given property of an object should have at a * given progress of the animation. * * The mode specified is the easing mode used when going to from the previous * key to the specified key. * * For instance, the code below: * * |[ * clutter_state_set (state, NULL, "hover", * button, "opacity", CLUTTER_LINEAR, 255, * button, "scale-x", CLUTTER_EASE_OUT_CUBIC, 1.2, * button, "scale-y", CLUTTER_EASE_OUT_CUBIC, 1.2, * NULL); * ]| * * will create a transition from any state (a @source_state_name or NULL is * treated as a wildcard) and a state named "hover"; the * <emphasis>button</emphasis> object will have the #ClutterActor:opacity * property animated to a value of 255 using %CLUTTER_LINEAR as the animation * mode, and the #ClutterActor:scale-x and #ClutterActor:scale-y properties * animated to a value of 1.2 using %CLUTTER_EASE_OUT_CUBIC as the animation * mode. To change the state (and start the transition) you can use the * clutter_state_set_state() function: * * |[ * clutter_state_set_state (state, "hover"); * ]| * * If a given object, state_name, property tuple already exist in the * #ClutterState instance, then the mode and value will be replaced with * the new specified values. * * If a property name is prefixed with "delayed::" two additional * arguments per key are expected: a value relative to the full state time * to pause before transitioning and a similar value to pause after * transitioning, e.g.: * * |[ * clutter_state_set (state, "hover", "toggled", * button, "delayed::scale-x", CLUTTER_LINEAR, 1.0, 0.2, 0.2, * button, "delayed::scale-y", CLUTTER_LINEAR, 1.0, 0.2, 0.2, * NULL); * ]| * * will pause for 20% of the duration of the transition before animating, * and 20% of the duration after animating. * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ void clutter_state_set (ClutterState *state, const gchar *source_state_name, const gchar *target_state_name, gpointer first_object, const gchar *first_property_name, gulong first_mode, ...) { gpointer object; const gchar *property_name; gulong mode; va_list args; g_return_if_fail (CLUTTER_IS_STATE (state)); object = first_object; property_name = first_property_name; mode = first_mode; va_start (args, first_mode); g_return_if_fail (G_IS_OBJECT (first_object)); g_return_if_fail (first_property_name); while (object != NULL) { GParamSpec *pspec; GValue value = G_VALUE_INIT; gchar *error = NULL; gboolean is_delayed = FALSE; if (g_str_has_prefix (property_name, "delayed::")) { property_name = strstr (property_name, "::") + 2; is_delayed = TRUE; } pspec = get_property_from_object (object, property_name); if (pspec == NULL) break; G_VALUE_COLLECT_INIT (&value, G_PARAM_SPEC_VALUE_TYPE (pspec), args, 0, &error); if (error != NULL) { g_warning ("%s: %s", G_STRLOC, error); g_free (error); break; } if (is_delayed) { gdouble pre_delay = va_arg (args, gdouble); gdouble post_delay = va_arg (args, gdouble); clutter_state_set_key (state, source_state_name, target_state_name, object, property_name, mode, &value, pre_delay, post_delay); } else { clutter_state_set_key (state, source_state_name, target_state_name, object, property_name, mode, &value, 0.0, 0.0); } g_value_unset (&value); object = va_arg (args, gpointer); if (object != NULL) { property_name = va_arg (args, gchar*); mode = va_arg (args, gulong); } } va_end (args); } static void clutter_state_set_key_internal (ClutterState *state, ClutterStateKey *key) { ClutterStatePrivate *priv = state->priv; State *target_state = key->target_state; GList *old_item = NULL; if ((old_item = g_list_find_custom (target_state->keys, key, sort_props_func))) { ClutterStateKey *old_key = old_item->data; target_state->keys = g_list_remove (target_state->keys, old_key); clutter_state_key_free (old_key); } target_state->keys = g_list_insert_sorted (target_state->keys, key, sort_props_func); /* If the current target state is modified, we have some work to do. * * If the animation is running, we add a key to the current animation * with a delay of the current duration so that the new animation will * animate into place. * * If the animation isn't running, but the state is set, we immediately * warp to that state. */ if (key->target_state == priv->target_state) { if (!clutter_timeline_is_playing (priv->timeline)) { /* We can warp to the state by setting a NULL state, then setting * the target state again. */ clutter_state_change (state, NULL, FALSE); clutter_state_change (state, target_state->name, FALSE); } else { /* Set the ClutterInterval associated with the state */ GValue initial = G_VALUE_INIT; gdouble progress = clutter_timeline_get_progress (priv->timeline); g_value_init (&initial, clutter_interval_get_value_type (key->interval)); if (key->is_animatable) { ClutterAnimatable *animatable; animatable = CLUTTER_ANIMATABLE (key->object); clutter_animatable_get_initial_state (animatable, key->property_name, &initial); } else g_object_get_property (key->object, key->property_name, &initial); if (clutter_alpha_get_mode (key->alpha) != key->mode) clutter_alpha_set_mode (key->alpha, key->mode); clutter_interval_set_initial_value (key->interval, &initial); clutter_interval_set_final_value (key->interval, &key->value); g_value_unset (&initial); /* Set the delay as if the interval had just begun */ if (progress > key->pre_delay) key->pre_pre_delay = MIN (progress - key->pre_delay, 1.0 - key->post_delay); } } } /* * clutter_state_fetch_state: * @state: a #ClutterState * @state_name: the name of the state to be retrieved * @create: %TRUE if the state should be instantiated if not found * * Retrieves the #State structure for @state_name inside the given * #ClutterState instance * * If @state_name is %NULL and @create is %TRUE then NULL will * be returned. * * Return value: a #State structure for the given name, or %NULL */ static State * clutter_state_fetch_state (ClutterState *state, const gchar *state_name, gboolean create) { ClutterStatePrivate *priv = state->priv; State *retval; if (state_name == NULL) { return NULL; } else state_name = g_intern_string (state_name); retval = g_hash_table_lookup (priv->states, state_name); if (retval == NULL && create) { retval = state_new (state, state_name); g_hash_table_insert (priv->states, (gpointer) state_name, retval); } return retval; } /** * clutter_state_set_key: * @state: a #ClutterState instance. * @source_state_name: (allow-none): the source transition to specify * transition for, or %NULL to specify the default fallback when a * more specific source state doesn't exist. * @target_state_name: the name of the transition to set a key value for. * @object: the #GObject to set a key for * @property_name: the property to set a key for * @mode: the id of the alpha function to use * @value: the value for property_name of object in state_name * @pre_delay: relative time of the transition to be idle in the beginning * of the transition * @post_delay: relative time of the transition to be idle in the end of * the transition * * Sets one specific end key for a state name, @object, @property_name * combination. * * Return value: (transfer none): the #ClutterState instance, allowing * chaining of multiple calls * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ ClutterState * clutter_state_set_key (ClutterState *state, const gchar *source_state_name, const gchar *target_state_name, GObject *object, const gchar *property_name, guint mode, const GValue *value, gdouble pre_delay, gdouble post_delay) { GParamSpec *pspec; ClutterStateKey *state_key; State *source_state = NULL; State *target_state; g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL); g_return_val_if_fail (G_IS_OBJECT (object), NULL); g_return_val_if_fail (property_name, NULL); g_return_val_if_fail (value, NULL); pspec = get_property_from_object (object, property_name); if (pspec == NULL) return state; source_state = clutter_state_fetch_state (state, source_state_name, TRUE); target_state = clutter_state_fetch_state (state, target_state_name, TRUE); property_name = g_intern_string (property_name); state_key = clutter_state_key_new (target_state, object, property_name, pspec, mode); state_key->source_state = source_state; state_key->pre_delay = pre_delay; state_key->post_delay = post_delay; g_value_init (&state_key->value, G_VALUE_TYPE (value)); g_value_copy (value, &state_key->value); clutter_state_set_key_internal (state, state_key); return state; } /** * clutter_state_get_states: * @state: a #ClutterState instance. * * Gets a list of all the state names managed by this #ClutterState. * * Return value: (transfer container) (element-type utf8): a newly allocated * #GList of state names. The contents of the returned #GList are owned * by the #ClutterState and should not be modified or freed. Use * g_list_free() to free the resources allocated by the returned list when * done using it * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ GList * clutter_state_get_states (ClutterState *state) { g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL); return g_hash_table_get_keys (state->priv->states); } /** * clutter_state_get_keys: * @state: a #ClutterState instance. * @source_state_name: (allow-none): the source transition name to query, * or %NULL for all source states * @target_state_name: (allow-none): the target transition name to query, * or %NULL for all target states * @object: (allow-none): the specific object instance to list keys for, * or %NULL for all managed objects * @property_name: (allow-none): the property name to search for, or %NULL * for all properties. * * Returns a list of pointers to opaque structures with accessor functions * that describe the keys added to an animator. * * Return value: (transfer container) (element-type Clutter.StateKey): a * newly allocated #GList of #ClutterStateKey<!-- -->s. The contents of * the returned list are owned by the #ClutterState and should not be * modified or freed. Use g_list_free() to free the resources allocated * by the returned list when done using it * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ GList * clutter_state_get_keys (ClutterState *state, const gchar *source_state_name, const gchar *target_state_name, GObject *object, const gchar *property_name) { GList *s, *state_list; GList *targets = NULL; State *source_state = NULL; g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL); source_state_name = g_intern_string (source_state_name); target_state_name = g_intern_string (target_state_name); property_name = g_intern_string (property_name); if (target_state_name != NULL) state_list = g_list_append (NULL, (gpointer) target_state_name); else state_list = clutter_state_get_states (state); if (source_state_name) source_state = clutter_state_fetch_state (state, source_state_name, FALSE); for (s = state_list; s != NULL; s = s->next) { State *target_state; target_state = clutter_state_fetch_state (state, s->data, FALSE); if (target_state != NULL) { GList *k; for (k = target_state->keys; k; k = k->next) { ClutterStateKey *key = k->data; if ((object == NULL || (object == key->object)) && (source_state_name == NULL || source_state == key->source_state) && (property_name == NULL || (property_name == key->property_name))) { targets = g_list_prepend (targets, key); } } } } g_list_free (state_list); return g_list_reverse (targets); } /** * clutter_state_remove_key: * @state: a #ClutterState instance. * @source_state_name: (allow-none): the source state name to query, * or %NULL for all source states * @target_state_name: (allow-none): the target state name to query, * or %NULL for all target states * @object: (allow-none): the specific object instance to list keys for, * or %NULL for all managed objects * @property_name: (allow-none): the property name to search for, * or %NULL for all properties. * * Removes all keys matching the search criteria passed in arguments. * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ void clutter_state_remove_key (ClutterState *state, const gchar *source_state_name, const gchar *target_state_name, GObject *object, const gchar *property_name) { g_return_if_fail (CLUTTER_IS_STATE (state)); clutter_state_remove_key_internal (state, source_state_name, target_state_name, object, property_name, FALSE); } /** * clutter_state_get_timeline: * @state: a #ClutterState * * Gets the timeline driving the #ClutterState * * Return value: (transfer none): the #ClutterTimeline that drives * the state change animations. The returned timeline is owned * by the #ClutterState and it should not be unreferenced directly * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ ClutterTimeline * clutter_state_get_timeline (ClutterState *state) { g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL); return state->priv->timeline; } static void clutter_state_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { ClutterState *state = CLUTTER_STATE (object); switch (prop_id) { case PROP_STATE: clutter_state_set_state (state, g_value_get_string (value)); break; case PROP_DURATION: state->priv->duration = g_value_get_uint (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } } static void clutter_state_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { ClutterState *state = CLUTTER_STATE (object); switch (prop_id) { case PROP_STATE: g_value_set_string (value, clutter_state_get_state (state)); break; case PROP_DURATION: g_value_set_uint (value, state->priv->duration); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } } static void clutter_state_class_init (ClutterStateClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GParamSpec *pspec; g_type_class_add_private (klass, sizeof (ClutterStatePrivate)); gobject_class->finalize = clutter_state_finalize; gobject_class->set_property = clutter_state_set_property; gobject_class->get_property = clutter_state_get_property; /** * ClutterState::completed: * @state: the #ClutterState that emitted the signal * * The ::completed signal is emitted when a #ClutterState reaches * the target state specified by clutter_state_set_state() or * clutter_state_warp_to_state(). * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ state_signals[COMPLETED] = g_signal_new (I_("completed"), G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ClutterStateClass, completed), NULL, NULL, _clutter_marshal_VOID__VOID, G_TYPE_NONE, 0); /** * ClutterState:state: * * The currently set target state, setting it causes the * state machine to transition to the new state, use * clutter_state_warp_to_state() to change state without * a transition. * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ pspec = g_param_spec_string ("state", P_("State"), P_("Currently set state, (transition to this state might not be complete)"), NULL, CLUTTER_PARAM_READWRITE); obj_props[PROP_STATE] = pspec; g_object_class_install_property (gobject_class, PROP_STATE, pspec); /** * ClutterState:duration: * * Default duration used if an duration has not been specified for a specific * source/target state pair. The values is in milliseconds. * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ pspec = g_param_spec_uint ("duration", P_("Duration"), P_("Default transition duration"), 0, 86400000, 1000, CLUTTER_PARAM_READWRITE); obj_props[PROP_DURATION] = pspec; g_object_class_install_property (gobject_class, PROP_DURATION, pspec); } static void clutter_state_init (ClutterState *self) { ClutterStatePrivate *priv; priv = self->priv = CLUTTER_STATE_GET_PRIVATE (self); priv->states = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, state_free); self->priv->source_state_name = NULL; self->priv->target_state_name = NULL; self->priv->duration = 1000; priv->timeline = clutter_timeline_new (1000); g_signal_connect (priv->timeline, "new-frame", G_CALLBACK (clutter_state_new_frame), self); g_signal_connect (priv->timeline, "completed", G_CALLBACK (clutter_state_completed), self); priv->slave_timeline = clutter_timeline_new (SLAVE_TIMELINE_LENGTH); } /** * clutter_state_get_animator: * @state: a #ClutterState instance. * @source_state_name: the name of a source state * @target_state_name: the name of a target state * * Retrieves the #ClutterAnimator that is being used for transitioning * between the two states, if any has been set * * Return value: (transfer none): a #ClutterAnimator instance, or %NULL * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ ClutterAnimator * clutter_state_get_animator (ClutterState *state, const gchar *source_state_name, const gchar *target_state_name) { State *target_state; guint i; g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL); source_state_name = g_intern_string (source_state_name); if (source_state_name == g_intern_static_string ("")) source_state_name = NULL; target_state_name = g_intern_string (target_state_name); target_state = clutter_state_fetch_state (state, target_state_name, FALSE); if (target_state == NULL) return NULL; for (i = 0; i < target_state->animators->len; i++) { const StateAnimator *animator; animator = &g_array_index (target_state->animators, StateAnimator, i); if (animator->source_state_name == source_state_name) return animator->animator; } return NULL; } /** * clutter_state_set_animator: * @state: a #ClutterState instance. * @source_state_name: the name of a source state * @target_state_name: the name of a target state * @animator: (allow-none): a #ClutterAnimator instance, or %NULL to * unset an existing #ClutterAnimator * * Specifies a #ClutterAnimator to be used when transitioning between * the two named states. * * The @animator allows specifying a transition between the state that is * more elaborate than the basic transitions allowed by the tweening of * properties defined in the #ClutterState keys. * * If @animator is %NULL it will unset an existing animator. * * #ClutterState will take a reference on the passed @animator, if any * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ void clutter_state_set_animator (ClutterState *state, const gchar *source_state_name, const gchar *target_state_name, ClutterAnimator *animator) { State *target_state; guint i; g_return_if_fail (CLUTTER_IS_STATE (state)); source_state_name = g_intern_string (source_state_name); target_state_name = g_intern_string (target_state_name); target_state = clutter_state_fetch_state (state, target_state_name, TRUE); if (target_state == NULL) return; for (i = 0; target_state->animators->len; i++) { StateAnimator *a; a = &g_array_index (target_state->animators, StateAnimator, i); if (a->source_state_name == source_state_name) { g_object_unref (a->animator); if (animator != NULL) a->animator = g_object_ref (animator); else { /* remove the matched animator if passed NULL */ g_array_remove_index (target_state->animators, i); } return; } } if (animator != NULL) { StateAnimator state_animator = { source_state_name, g_object_ref (animator) }; g_array_append_val (target_state->animators, state_animator); } } static gpointer clutter_state_key_copy (gpointer boxed) { if (boxed != NULL) { ClutterStateKey *key = boxed; key->ref_count += 1; } return boxed; } G_DEFINE_BOXED_TYPE (ClutterStateKey, clutter_state_key, clutter_state_key_copy, clutter_state_key_free); /** * clutter_state_key_get_pre_delay: * @state_key: a #ClutterStateKey * * Retrieves the pause before transitioning starts as a fraction of * the total transition time. * * Return value: the pre delay used before starting the transition. * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ gdouble clutter_state_key_get_pre_delay (const ClutterStateKey *state_key) { g_return_val_if_fail (state_key != NULL, 0.0); return state_key->pre_delay; } /** * clutter_state_key_get_post_delay: * @state_key: a #ClutterStateKey * * Retrieves the duration of the pause after transitioning is complete * as a fraction of the total transition time. * * Return value: the post delay, used after doing the transition. * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ gdouble clutter_state_key_get_post_delay (const ClutterStateKey *state_key) { g_return_val_if_fail (state_key != NULL, 0.0); return state_key->post_delay; } /** * clutter_state_key_get_mode: * @state_key: a #ClutterStateKey * * Retrieves the easing mode used for @state_key. * * Return value: the mode of a #ClutterStateKey * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ gulong clutter_state_key_get_mode (const ClutterStateKey *state_key) { g_return_val_if_fail (state_key != NULL, 0); return state_key->mode; } /** * clutter_state_key_get_value: * @state_key: a #ClutterStateKey * @value: a #GValue initialized with the correct type for the @state_key * * Retrieves a copy of the value for a #ClutterStateKey. * * The #GValue needs to be already initialized for the value type * of the property or to a type that allow transformation from the value * type of the key. * * Use g_value_unset() when done. * * Return value: %TRUE if the value was successfully retrieved, * and %FALSE otherwise * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ gboolean clutter_state_key_get_value (const ClutterStateKey *state_key, GValue *value) { g_return_val_if_fail (state_key != NULL, FALSE); g_return_val_if_fail (value != NULL, FALSE); g_return_val_if_fail (G_VALUE_TYPE (value) != G_TYPE_INVALID, FALSE); if (!g_type_is_a (G_VALUE_TYPE (&state_key->value), G_VALUE_TYPE (value))) { if (g_value_type_compatible (G_VALUE_TYPE (&state_key->value), G_VALUE_TYPE (value))) { g_value_copy (&state_key->value, value); return TRUE; } if (g_value_type_transformable (G_VALUE_TYPE (&state_key->value), G_VALUE_TYPE (value))) { if (g_value_transform (&state_key->value, value)) return TRUE; } g_warning ("%s: Unable to convert from %s to %s for the " "property '%s' of object %s in the state key", G_STRLOC, g_type_name (G_VALUE_TYPE (&state_key->value)), g_type_name (G_VALUE_TYPE (value)), state_key->property_name, G_OBJECT_TYPE_NAME (state_key->object)); return FALSE; } else g_value_copy (&state_key->value, value); return TRUE; } /** * clutter_state_key_get_object: * @state_key: a #ClutterStateKey * * Retrieves the object instance this #ClutterStateKey applies to. * * Return value: (transfer none): the object this state key applies to. * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ GObject * clutter_state_key_get_object (const ClutterStateKey *state_key) { g_return_val_if_fail (state_key, NULL); return state_key->object; } /** * clutter_state_key_get_property_name: * @state_key: a #ClutterStateKey * * Retrieves the name of the property this #ClutterStateKey applies to * * Return value: the name of the property. The returned string is owned * by the #ClutterStateKey and should never be modified or freed * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ const gchar * clutter_state_key_get_property_name (const ClutterStateKey *state_key) { g_return_val_if_fail (state_key, NULL); return state_key->property_name; } /** * clutter_state_key_get_source_state_name: * @state_key: a #ClutterStateKey * * Retrieves the name of the source state of the @state_key * * Return value: the name of the source state for this key, or %NULL * if this is the generic state key for the given property when * transitioning to the target state. The returned string is owned * by the #ClutterStateKey and should never be modified or freed * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ const gchar * clutter_state_key_get_source_state_name (const ClutterStateKey *state_key) { g_return_val_if_fail (state_key, NULL); if (state_key->source_state != NULL) return state_key->source_state->name; return NULL; } /** * clutter_state_key_get_target_state_name: * @state_key: a #ClutterStateKey * * Get the name of the source state this #ClutterStateKey contains, * or NULL if this is the generic state key for the given property * when transitioning to the target state. * * Return value: the name of the source state for this key, or NULL if * the key is generic * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ const gchar * clutter_state_key_get_target_state_name (const ClutterStateKey *state_key) { g_return_val_if_fail (state_key, NULL); return state_key->target_state->name; } /** * clutter_state_key_get_property_type: * @key: a #ClutterStateKey * * Retrieves the #GType of the property a key applies to * * You can use this type to initialize the #GValue to pass to * clutter_state_key_get_value() * * Return value: the #GType of the property * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ GType clutter_state_key_get_property_type (const ClutterStateKey *key) { g_return_val_if_fail (key != NULL, G_TYPE_INVALID); return G_VALUE_TYPE (&key->value); } /** * clutter_state_set_duration: * @state: a #ClutterState * @source_state_name: (allow-none): the name of the source state, or %NULL * @target_state_name: (allow-none): the name of the target state, or %NULL * @duration: the duration of the transition, in milliseconds * * Sets the duration of a transition. * * If both state names are %NULL the default duration for @state is set. * * If only @target_state_name is specified, the passed @duration becomes * the default duration for transitions to the target state. * * If both states names are specified, the passed @duration only applies * to the specified transition. * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ void clutter_state_set_duration (ClutterState *state, const gchar *source_state_name, const gchar *target_state_name, guint duration) { State *target_state; g_return_if_fail (CLUTTER_IS_STATE (state)); source_state_name = g_intern_string (source_state_name); if (source_state_name == g_intern_static_string ("")) source_state_name = NULL; target_state_name = g_intern_string (target_state_name); if (target_state_name == g_intern_static_string ("")) target_state_name = NULL; if (target_state_name == NULL) { state->priv->duration = duration; return; } target_state = clutter_state_fetch_state (state, target_state_name, FALSE); if (target_state != NULL) { if (source_state_name != NULL) g_hash_table_insert (target_state->durations, (gpointer) source_state_name, GINT_TO_POINTER (duration)); else g_hash_table_insert (target_state->durations, NULL, GINT_TO_POINTER (duration)); } } /** * clutter_state_get_duration: * @state: a #ClutterState * @source_state_name: (allow-none): the name of the source state to * get the duration of, or %NULL * @target_state_name: (allow-none): the name of the source state to * get the duration of, or %NULL * * Queries the duration used for transitions between a source and * target state pair * * The semantics for the query are the same as the semantics used for * setting the duration with clutter_state_set_duration() * * Return value: the duration, in milliseconds * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ guint clutter_state_get_duration (ClutterState *state, const gchar *source_state_name, const gchar *target_state_name) { State *target_state; guint ret = 0; g_return_val_if_fail (CLUTTER_IS_STATE (state), 0); source_state_name = g_intern_string (source_state_name); if (source_state_name == g_intern_static_string ("")) source_state_name = NULL; target_state_name = g_intern_string (target_state_name); if (target_state_name == g_intern_static_string ("")) target_state_name = NULL; if (target_state_name == NULL) return state->priv->duration; target_state = clutter_state_fetch_state (state, target_state_name, FALSE); if (target_state != NULL) { if (source_state_name) { ret = GPOINTER_TO_INT (g_hash_table_lookup (target_state->durations, source_state_name)); if(!ret) ret = GPOINTER_TO_INT (g_hash_table_lookup (target_state->durations, NULL)); } else ret = GPOINTER_TO_INT (g_hash_table_lookup (target_state->durations, NULL)); } if (!ret) ret = state->priv->duration; return ret; } /** * clutter_state_get_state: * @state: a #ClutterState * * Queries the currently set target state. * * During a transition this function will return the target of the transition. * * This function is useful when called from handlers of the * #ClutterState::completed signal. * * Return value: a string containing the target state. The returned string * is owned by the #ClutterState and should not be modified or freed * * Since: 1.4 * Deprecated: 1.12: Use #ClutterKeyframeTransition and * #ClutterTransitionGroup instead */ const gchar * clutter_state_get_state (ClutterState *state) { g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL); return state->priv->target_state_name; } typedef struct _ParseClosure { ClutterState *state; ClutterScript *script; GValue *value; gboolean result; } ParseClosure; static void parse_state_transition (JsonArray *array, guint index_, JsonNode *element, gpointer data) { ParseClosure *clos = data; JsonObject *object; const gchar *source_name, *target_name; State *source_state, *target_state; JsonArray *keys; GSList *valid_keys = NULL; GList *array_keys, *k; if (JSON_NODE_TYPE (element) != JSON_NODE_OBJECT) { g_warning ("The 'transitions' member of a ClutterState description " "should be an array of objects, but the element %d of the " "array is of type '%s'. The element will be ignored.", index_, json_node_type_name (element)); return; } object = json_node_get_object (element); if (!json_object_has_member (object, "source") || !json_object_has_member (object, "target") || !(json_object_has_member (object, "keys") || json_object_has_member (object, "animator"))) { g_warning ("The transition description at index %d is missing one " "of the mandatory members: source, target and keys or " "animator", index_); return; } source_name = json_object_get_string_member (object, "source"); source_state = clutter_state_fetch_state (clos->state, source_name, TRUE); target_name = json_object_get_string_member (object, "target"); target_state = clutter_state_fetch_state (clos->state, target_name, TRUE); if (json_object_has_member (object, "duration")) { guint duration = json_object_get_int_member (object, "duration"); clutter_state_set_duration (clos->state, source_name, target_name, duration); } if (json_object_has_member (object, "animator")) { const gchar *id_ = json_object_get_string_member (object, "animator"); GObject *animator; animator = clutter_script_get_object (clos->script, id_); if (animator == NULL) { g_warning ("No object with id '%s' has been defined.", id_); return; } clutter_state_set_animator (clos->state, source_name, target_name, CLUTTER_ANIMATOR (animator)); } if (!json_object_has_member (object, "keys")) return; keys = json_object_get_array_member (object, "keys"); if (keys == NULL && !json_object_has_member (object, "animator")) { g_warning ("The transition description at index %d has an invalid " "key member of type '%s' when an array was expected.", index_, json_node_type_name (json_object_get_member (object, "keys"))); return; } if (G_IS_VALUE (clos->value)) valid_keys = g_slist_reverse (g_value_get_pointer (clos->value)); else g_value_init (clos->value, G_TYPE_POINTER); array_keys = json_array_get_elements (keys); for (k = array_keys; k != NULL; k = k->next) { JsonNode *node = k->data; JsonArray *key = json_node_get_array (node); ClutterStateKey *state_key; GObject *gobject; GParamSpec *pspec; const gchar *id_; const gchar *property; gulong mode; gboolean res; id_ = json_array_get_string_element (key, 0); gobject = clutter_script_get_object (clos->script, id_); if (gobject == NULL) { g_warning ("No object with id '%s' has been defined.", id_); continue; } property = json_array_get_string_element (key, 1); pspec = get_property_from_object (gobject, property); if (pspec == NULL) { g_warning ("The object of type '%s' and name '%s' has no " "property named '%s'.", G_OBJECT_TYPE_NAME (gobject), id_, property); continue; } mode = _clutter_script_resolve_animation_mode (json_array_get_element (key, 2)); state_key = clutter_state_key_new (target_state, gobject, property, pspec, mode); res = _clutter_script_parse_node (clos->script, &(state_key->value), property, json_array_get_element (key, 3), pspec); if (!res) { g_warning ("Unable to parse the key value for the " "property '%s' of object '%s' at index %d", property, id_, index_); clutter_state_key_free (state_key); continue; } switch (json_array_get_length (key)) { case 5: state_key->pre_delay = json_array_get_double_element (key, 4); state_key->post_delay = 0.0; break; case 6: state_key->pre_delay = json_array_get_double_element (key, 4); state_key->post_delay = json_array_get_double_element (key, 5); break; default: state_key->pre_delay = 0.0; state_key->post_delay = 0.0; break; } state_key->source_state = source_state; valid_keys = g_slist_prepend (valid_keys, state_key); } g_list_free (array_keys); g_value_set_pointer (clos->value, g_slist_reverse (valid_keys)); clos->result = TRUE; } static gboolean clutter_state_parse_custom_node (ClutterScriptable *scriptable, ClutterScript *script, GValue *value, const gchar *name, JsonNode *node) { ParseClosure clos; if (strcmp (name, "transitions") != 0) return FALSE; if (JSON_NODE_TYPE (node) != JSON_NODE_ARRAY) return FALSE; clos.state = CLUTTER_STATE (scriptable); clos.script = script; clos.value = value; clos.result = FALSE; json_array_foreach_element (json_node_get_array (node), parse_state_transition, &clos); return clos.result; } static void clutter_state_set_custom_property (ClutterScriptable *scriptable, ClutterScript *script, const gchar *name, const GValue *value) { if (strcmp (name, "transitions") == 0) { ClutterState *state = CLUTTER_STATE (scriptable); GSList *keys = g_value_get_pointer (value); GSList *k; for (k = keys; k != NULL; k = k->next) clutter_state_set_key_internal (state, k->data); g_slist_free (keys); } else g_object_set_property (G_OBJECT (scriptable), name, value); } static void clutter_scriptable_iface_init (ClutterScriptableIface *iface) { iface->parse_custom_node = clutter_state_parse_custom_node; iface->set_custom_property = clutter_state_set_custom_property; }
lgpl-2.1
mbatchelor/pentaho-reporting
libraries/librepository/src/main/java/org/pentaho/reporting/libraries/repository/zip/ZipContentLocation.java
9822
/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2006 - 2017 Hitachi Vantara and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.repository.zip; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.pentaho.reporting.libraries.base.util.IOUtils; import org.pentaho.reporting.libraries.repository.ContentCreationException; import org.pentaho.reporting.libraries.repository.ContentEntity; import org.pentaho.reporting.libraries.repository.ContentIOException; import org.pentaho.reporting.libraries.repository.ContentItem; import org.pentaho.reporting.libraries.repository.ContentLocation; import org.pentaho.reporting.libraries.repository.LibRepositoryBoot; import org.pentaho.reporting.libraries.repository.Repository; import org.pentaho.reporting.libraries.repository.RepositoryUtilities; import java.util.Date; import java.util.HashMap; import java.util.zip.ZipEntry; public class ZipContentLocation implements ContentLocation { private static final Log logger = LogFactory.getLog( ZipContentLocation.class ); private ZipRepository repository; private ZipContentLocation parent; private String comment; private String name; private long size; private long time; private String entryName; private HashMap entries; public ZipContentLocation( final ZipRepository repository, final ZipContentLocation parent, final String entryName ) { if ( repository == null ) { throw new NullPointerException(); } if ( entryName == null ) { throw new NullPointerException(); } this.repository = repository; this.parent = parent; this.entryName = entryName; this.entries = new HashMap(); this.name = RepositoryUtilities.buildName( this, "/" ) + '/'; this.time = System.currentTimeMillis(); } public ZipContentLocation( ZipRepository repository, ZipContentLocation parent, ZipEntry zipEntry ) { if ( repository == null ) { throw new NullPointerException(); } if ( parent == null ) { throw new NullPointerException(); } if ( zipEntry == null ) { throw new NullPointerException(); } this.repository = repository; this.parent = parent; this.entryName = IOUtils.getInstance().getFileName( zipEntry.getName() ); this.comment = zipEntry.getComment(); this.size = zipEntry.getSize(); this.time = zipEntry.getTime(); this.entries = new HashMap(); this.name = RepositoryUtilities.buildName( this, "/" ) + '/'; } private void updateMetaData( final ZipEntry zipEntry ) { this.comment = zipEntry.getComment(); this.size = zipEntry.getSize(); this.time = zipEntry.getTime(); } public void updateDirectoryEntry( final String[] name, final int index, final ZipEntry zipEntry ) { if ( name == null ) { throw new NullPointerException(); } if ( zipEntry == null ) { throw new NullPointerException(); } final String path = name[ index ]; final Object entry = entries.get( path ); if ( entry instanceof ContentItem ) { logger.warn( "Directory-Entry with the same name as a Content-Entry encountered: " + path ); return; } final ZipContentLocation location; if ( entry == null ) { location = new ZipContentLocation( repository, this, path ); entries.put( path, location ); } else { location = (ZipContentLocation) entry; } final int nextNameIdx = index + 1; if ( nextNameIdx < name.length ) { location.updateDirectoryEntry( name, nextNameIdx, zipEntry ); } else if ( nextNameIdx == name.length ) { location.updateMetaData( zipEntry ); } } public void updateEntry( final String[] name, final int index, final ZipEntry zipEntry, final byte[] data ) { if ( name == null ) { throw new NullPointerException(); } if ( zipEntry == null ) { throw new NullPointerException(); } if ( data == null ) { throw new NullPointerException(); } final String path = name[ index ]; final Object entry = entries.get( path ); final int nextNameIdx = index + 1; if ( nextNameIdx < name.length ) { if ( entry instanceof ContentItem ) { logger.warn( "Directory-Entry with the same name as a Content-Entry encountered: " + path ); return; } final ZipContentLocation location; if ( entry == null ) { location = new ZipContentLocation( repository, this, path ); entries.put( path, location ); } else { location = (ZipContentLocation) entry; } if ( nextNameIdx < name.length ) { location.updateEntry( name, nextNameIdx, zipEntry, data ); } } else if ( nextNameIdx == name.length ) { if ( entry instanceof ContentItem ) { logger.warn( "Duplicate Content-Entry encountered: " + path ); return; } else if ( entry != null ) { logger.warn( "Replacing Directory-Entry with the same name as a Content-Entry: " + path ); } final ZipContentItem contentItem = new ZipContentItem( repository, this, zipEntry, data ); entries.put( path, contentItem ); } } public ContentEntity[] listContents() throws ContentIOException { return (ContentEntity[]) entries.values().toArray( new ContentEntity[ entries.size() ] ); } public ContentEntity getEntry( final String name ) throws ContentIOException { return (ContentEntity) entries.get( name ); } public boolean exists( final String name ) { return entries.containsKey( name ); } public ContentItem createItem( final String name ) throws ContentCreationException { if ( entries.containsKey( name ) ) { throw new ContentCreationException( "An entry with name '" + name + "' already exists." ); } if ( name.indexOf( '/' ) != -1 ) { throw new ContentCreationException( "The entry-name '" + name + "' is invalid." ); } if ( "".equals( name ) || ".".equals( name ) || "..".equals( name ) ) { throw new ContentCreationException( "The entry-name '" + name + "' is invalid." ); } final ZipContentItem value = new ZipContentItem( repository, this, name ); entries.put( name, value ); return value; } public ContentLocation createLocation( final String name ) throws ContentCreationException { if ( entries.containsKey( name ) ) { throw new ContentCreationException( "An entry with name '" + name + "' already exists." ); } if ( entries.containsKey( name ) ) { throw new ContentCreationException( "An entry with name '" + name + "' already exists." ); } if ( name.indexOf( '/' ) != -1 ) { throw new ContentCreationException( "The entry-name '" + name + "' is invalid." ); } if ( "".equals( name ) || ".".equals( name ) || "..".equals( name ) ) { throw new ContentCreationException( "The entry-name '" + name + "' is invalid." ); } final ZipContentLocation value = new ZipContentLocation( repository, this, name ); entries.put( name, value ); return value; } public String getName() { return entryName; } public Object getContentId() { return name; } public Object getAttribute( final String domain, final String key ) { if ( LibRepositoryBoot.REPOSITORY_DOMAIN.equals( domain ) ) { if ( LibRepositoryBoot.SIZE_ATTRIBUTE.equals( key ) ) { return new Long( size ); } else if ( LibRepositoryBoot.VERSION_ATTRIBUTE.equals( key ) ) { return new Date( time ); } } else if ( LibRepositoryBoot.ZIP_DOMAIN.equals( domain ) ) { if ( LibRepositoryBoot.ZIP_COMMENT_ATTRIBUTE.equals( key ) ) { return comment; } } return null; } public boolean setAttribute( final String domain, final String key, final Object value ) { if ( LibRepositoryBoot.REPOSITORY_DOMAIN.equals( domain ) ) { if ( LibRepositoryBoot.VERSION_ATTRIBUTE.equals( key ) ) { if ( value instanceof Date ) { final Date n = (Date) value; time = n.getTime(); return true; } else if ( value instanceof Number ) { final Number n = (Number) value; time = n.longValue(); return true; } } } else if ( LibRepositoryBoot.ZIP_DOMAIN.equals( domain ) ) { if ( LibRepositoryBoot.ZIP_COMMENT_ATTRIBUTE.equals( key ) ) { if ( value != null ) { comment = String.valueOf( value ); return true; } else { comment = null; return true; } } } return false; } public ContentLocation getParent() { return parent; } public Repository getRepository() { return repository; } public boolean delete() { if ( parent == null ) { return false; } return parent.removeEntity( this ); } public boolean removeEntity( final ContentEntity entity ) { return ( entries.remove( entity.getName() ) != null ); } }
lgpl-2.1
darkeports/tc5-port
src/main/java/thaumcraft/codechicken/lib/vec/Vector3.java
12227
package codechicken.lib.vec; import codechicken.lib.math.MathHelper; import codechicken.lib.util.Copyable; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.util.vector.Vector3f; import org.lwjgl.util.vector.Vector4f; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; public class Vector3 implements Copyable<Vector3> { public static Vector3 zero = new Vector3(); public static Vector3 one = new Vector3(1, 1, 1); public static Vector3 center = new Vector3(0.5, 0.5, 0.5); public double x; public double y; public double z; public Vector3() { } public Vector3(double d, double d1, double d2) { x = d; y = d1; z = d2; } public Vector3(Vector3 vec) { x = vec.x; y = vec.y; z = vec.z; } public Vector3(double[] da) { this(da[0], da[1], da[2]); } public Vector3(float[] fa) { this(fa[0], fa[1], fa[2]); } public Vector3(Vec3d vec) { x = vec.xCoord; y = vec.yCoord; z = vec.zCoord; } @Deprecated // use Vector3.fromBlockPos //TODO, 1.11 move this to Vec3i public Vector3(BlockPos pos) { x = pos.getX(); y = pos.getY(); z = pos.getZ(); } public static Vector3 fromBlockPos(BlockPos pos) { return new Vector3(pos.getX(), pos.getY(), pos.getZ()); } public static Vector3 fromBlockPosCenter(BlockPos pos) { return fromBlockPos(pos).add(0.5); } public static Vector3 fromEntity(Entity e) { return new Vector3(e.posX, e.posY, e.posZ); } public static Vector3 fromEntityCenter(Entity e) { return new Vector3(e.posX, e.posY - e.getYOffset() + e.height / 2, e.posZ); } public static Vector3 fromTile(TileEntity tile) { return fromBlockPos(tile.getPos()); } public static Vector3 fromTileCenter(TileEntity tile) { return fromTile(tile).add(0.5); } public static Vector3 fromAxes(double[] da) { return new Vector3(da[2], da[0], da[1]); } public static Vector3 fromAxes(float[] fa) { return new Vector3(fa[2], fa[0], fa[1]); } public static Vector3 fromArray(double[] da) { return new Vector3(da[0], da[1], da[2]); } public static Vector3 fromArray(float[] fa) { return new Vector3(fa[0], fa[1], fa[2]); } public Vec3d vec3() { return new Vec3d(x, y, z); } public BlockPos pos() { return new BlockPos(x, y, z); } @SideOnly (Side.CLIENT) public Vector3f vector3f() { return new Vector3f((float) x, (float) y, (float) z); } @SideOnly (Side.CLIENT) public Vector4f vector4f() { return new Vector4f((float) x, (float) y, (float) z, 1); } @SideOnly (Side.CLIENT) public void glVertex() { GlStateManager.glVertex3f((float) x, (float) y, (float) z); } public Vector3 set(double x1, double y1, double z1) { x = x1; y = y1; z = z1; return this; } public Vector3 set(double d) { return set(d, d, d); } public Vector3 set(Vector3 vec) { return set(vec.x, vec.y, vec.z); } public Vector3 set(double[] da) { return set(da[0], da[1], da[2]); } public Vector3 set(float[] fa) { return set(fa[0], fa[1], fa[2]); } public Vector3 add(double dx, double dy, double dz) { x += dx; y += dy; z += dz; return this; } public Vector3 add(double d) { return add(d, d, d); } public Vector3 add(Vector3 vec) { return add(vec.x, vec.y, vec.z); } public Vector3 add(BlockPos pos) { return add(pos.getX(), pos.getY(), pos.getZ()); } public Vector3 subtract(double dx, double dy, double dz) { x -= dx; y -= dy; z -= dz; return this; } public Vector3 subtract(double d) { return subtract(d, d, d); } public Vector3 subtract(Vector3 vec) { return subtract(vec.x, vec.y, vec.z); } public Vector3 subtract(BlockPos pos) { return subtract(pos.getX(), pos.getY(), pos.getZ()); } @Deprecated //Use subtract public Vector3 sub(Vector3 vec) { return subtract(vec); } @Deprecated //Use subtract public Vector3 sub(BlockPos pos) { return subtract(pos); } public Vector3 multiply(double fx, double fy, double fz) { x *= fx; y *= fy; z *= fz; return this; } public Vector3 multiply(double f) { return multiply(f, f, f); } public Vector3 multiply(Vector3 f) { return multiply(f.x, f.y, f.z); } public Vector3 divide(double fx, double fy, double fz) { x /= fx; y /= fy; z /= fz; return this; } public Vector3 divide(double f) { return divide(f, f, f); } public Vector3 divide(Vector3 vec) { return divide(vec.x, vec.y, vec.z); } public Vector3 divide(BlockPos pos) { return divide(pos.getX(), pos.getY(), pos.getZ()); } public Vector3 floor() { x = MathHelper.floor(x); y = MathHelper.floor(y); z = MathHelper.floor(z); return this; } public Vector3 celi() { x = MathHelper.ceil(x); y = MathHelper.ceil(y); z = MathHelper.ceil(z); return this; } public double mag() { return Math.sqrt(x * x + y * y + z * z); } public double magSquared() { return x * x + y * y + z * z; } public Vector3 negate() { x = -x; y = -y; z = -z; return this; } public Vector3 normalize() { double d = mag(); if (d != 0) { multiply(1 / d); } return this; } public double dotProduct(double x1, double y1, double z1) { return x1 * x + y1 * y + z1 * z; } public double dotProduct(Vector3 vec) { double d = vec.x * x + vec.y * y + vec.z * z; if (d > 1 && d < 1.00001) { d = 1; } else if (d < -1 && d > -1.00001) { d = -1; } return d; } public Vector3 crossProduct(Vector3 vec) { double d = y * vec.z - z * vec.y; double d1 = z * vec.x - x * vec.z; double d2 = x * vec.y - y * vec.x; x = d; y = d1; z = d2; return this; } public Vector3 perpendicular() { if (z == 0) { return zCrossProduct(); } return xCrossProduct(); } public Vector3 xCrossProduct() { double d = z; double d1 = -y; x = 0; y = d; z = d1; return this; } public Vector3 zCrossProduct() { double d = y; double d1 = -x; x = d; y = d1; z = 0; return this; } public Vector3 yCrossProduct() { double d = -z; double d1 = x; x = d; y = 0; z = d1; return this; } public double scalarProject(Vector3 b) { double l = b.mag(); return l == 0 ? 0 : dotProduct(b) / l; } public Vector3 project(Vector3 b) { double l = b.magSquared(); if (l == 0) { set(0, 0, 0); return this; } double m = dotProduct(b) / l; set(b).multiply(m); return this; } public Vector3 rotate(double angle, Vector3 axis) { Quat.aroundAxis(axis.copy().normalize(), angle).rotate(this); return this; } public Vector3 rotate(Quat rotator) { rotator.rotate(this); return this; } public double angle(Vector3 vec) { return Math.acos(copy().normalize().dotProduct(vec.copy().normalize())); } public Vector3 YZintercept(Vector3 end, double px) { double dx = end.x - x; double dy = end.y - y; double dz = end.z - z; if (dx == 0) { return null; } double d = (px - x) / dx; if (MathHelper.between(-1E-5, d, 1E-5)) { return this; } if (!MathHelper.between(0, d, 1)) { return null; } x = px; y += d * dy; z += d * dz; return this; } public Vector3 XZintercept(Vector3 end, double py) { double dx = end.x - x; double dy = end.y - y; double dz = end.z - z; if (dy == 0) { return null; } double d = (py - y) / dy; if (MathHelper.between(-1E-5, d, 1E-5)) { return this; } if (!MathHelper.between(0, d, 1)) { return null; } x += d * dx; y = py; z += d * dz; return this; } public Vector3 XYintercept(Vector3 end, double pz) { double dx = end.x - x; double dy = end.y - y; double dz = end.z - z; if (dz == 0) { return null; } double d = (pz - z) / dz; if (MathHelper.between(-1E-5, d, 1E-5)) { return this; } if (!MathHelper.between(0, d, 1)) { return null; } x += d * dx; y += d * dy; z = pz; return this; } public boolean isZero() { return x == 0 && y == 0 && z == 0; } public boolean isAxial() { return x == 0 ? (y == 0 || z == 0) : (y == 0 && z == 0); } public double getSide(int side) { switch (side) { case 0: case 1: return y; case 2: case 3: return z; case 4: case 5: return x; } throw new IndexOutOfBoundsException("Switch Falloff"); } public Vector3 setSide(int s, double v) { switch (s) { case 0: case 1: y = v; break; case 2: case 3: z = v; break; case 4: case 5: x = v; break; default: throw new IndexOutOfBoundsException("Switch Falloff"); } return this; } @Override public boolean equals(Object o) { if (!(o instanceof Vector3)) { return false; } Vector3 v = (Vector3) o; return x == v.x && y == v.y && z == v.z; } /** * Equals method with tolerance * * @return true if this is equal to v within +-1E-5 */ public boolean equalsT(Vector3 v) { return MathHelper.between(x - 1E-5, v.x, x + 1E-5) && MathHelper.between(y - 1E-5, v.y, y + 1E-5) && MathHelper.between(z - 1E-5, v.z, z + 1E-5); } public Vector3 copy() { return new Vector3(this); } public String toString() { MathContext cont = new MathContext(4, RoundingMode.HALF_UP); return "Vector3(" + new BigDecimal(x, cont) + ", " + new BigDecimal(y, cont) + ", " + new BigDecimal(z, cont) + ")"; } public Translation translation() { return new Translation(this); } public Vector3 apply(Transformation t) { t.apply(this); return this; } public Vector3 $tilde() { return normalize(); } public Vector3 unary_$tilde() { return normalize(); } public Vector3 $plus(Vector3 v) { return add(v); } public Vector3 $minus(Vector3 v) { return subtract(v); } public Vector3 $times(double d) { return multiply(d); } public Vector3 $div(double d) { return multiply(1 / d); } public Vector3 $times(Vector3 v) { return crossProduct(v); } public double $dot$times(Vector3 v) { return dotProduct(v); } }
lgpl-2.1
turran/enesim
src/examples/enesim_example_renderer.h
1601
#ifndef _EXAMPLE_H #define _EXAMPLE_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #define _GNU_SOURCE 1 #include <stdio.h> #include "Enesim.h" #if BUILD_OPENGL #include "Enesim_OpenGL.h" #if BUILD_GLX #include <X11/Xlib.h> #include <GL/glx.h> #endif #endif #if BUILD_OPENGL #include "Enesim_OpenCL.h" #endif #define WIDTH 256 #define HEIGHT 256 typedef struct _Enesim_Example_Renderer_Options { Enesim_Rop rop; int width; int height; const char *name; const char *backend_name; int x; int y; int times; } Enesim_Example_Renderer_Options; /* for later help() */ typedef struct _Enesim_Example_Renderer_Backend_Interface { Eina_Bool (*setup)(Enesim_Example_Renderer_Options *options); void (*cleanup)(void); void (*run)(Enesim_Renderer *r, Enesim_Example_Renderer_Options *options); } Enesim_Example_Renderer_Backend_Interface; /* function every example must implement */ Enesim_Renderer * enesim_example_renderer_renderer_get(Enesim_Example_Renderer_Options *options); void enesim_example_renderer_draw(Enesim_Renderer *r, Enesim_Surface *s, Enesim_Example_Renderer_Options *options); /* the different interfaces */ extern Enesim_Example_Renderer_Backend_Interface enesim_example_renderer_backend_image; #if BUILD_OPENGL #if BUILD_GLX extern Enesim_Example_Renderer_Backend_Interface enesim_example_renderer_backend_glx; #endif #if BUILD_WGL extern Enesim_Example_Renderer_Backend_Interface enesim_example_renderer_backend_wgl; #endif #endif #if BUILD_OPENCL extern Enesim_Example_Renderer_Backend_Interface enesim_example_renderer_backend_opencl_image; #endif #endif
lgpl-2.1
sehugg/SSBT
fastjlib/java/lang/Float.java
2269
package java.lang; public final class Float extends Number { public static final float MIN_VALUE = 1.4e-45f; public static final float MAX_VALUE = 3.4028235e+38f; public static final float NEGATIVE_INFINITY = -1.0f/0.0f; public static final float POSITIVE_INFINITY = 1.0f/0.0f; public static final float NaN = 0.0f/0.0f; public static final int WIDEFP_SIGNIFICAND_BITS = 24; public static final int WIDEFP_MIN_EXPONENT = -126; public static final int WIDEFP_MAX_EXPONENT = 127; public static final Class TYPE = float.class; private float value; static { System.loadLibrary("javalang"); } public Float(float value) { this.value = value; } public Float(double value) { this((float)value); } public Float(String s) throws NullPointerException, NumberFormatException { value = parseFloat(s); } public String toString() { return toString(value); } public boolean equals(Object obj) { return (obj instanceof Float && ((Float)obj).value == value); } public int hashCode() { return floatToIntBits(value); } public int intValue() { return (int)value; } public long longValue() { return (long)value; } public float floatValue() { return value; } public double doubleValue() { return value; } public native static String toString(float f); public static Float valueOf(String s) throws NullPointerException, NumberFormatException { if (s == null) throw new NullPointerException("Float.valueOf(String) passed null as argument"); return new Float(Float.parseFloat(s)); } public boolean isNaN() { return isNaN(value); } public static boolean isNaN(float v) { return (floatToIntBits(v) == 0x7fc00000); } public boolean isInfinite() { return isInfinite(value); } public static boolean isInfinite(float v) { return (v == POSITIVE_INFINITY || v == NEGATIVE_INFINITY); } public native static int floatToIntBits(float value); public native static float intBitsToFloat(int bits); public native static float parseFloat(String s); }
lgpl-2.1
levants/lightmare
lightmare-criteria/src/main/java/org/lightmare/criteria/tuples/QueryTuple.java
5968
/* * Lightmare-criteria, JPA-QL query generator using lambda expressions * * Copyright (c) 2013, Levan Tsinadze, or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU * Lesser General Public License, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this distribution; if not, write to: * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ package org.lightmare.criteria.tuples; import java.io.Serializable; import java.lang.reflect.Field; import java.lang.reflect.Method; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.lightmare.criteria.query.orm.links.Parts; import org.lightmare.criteria.utils.ObjectUtils; import org.lightmare.criteria.utils.StringUtils; /** * Query field and entity type container class * * @author Levan Tsinadze * */ public class QueryTuple implements Serializable, Cloneable { private static final long serialVersionUID = 1L; private String entityName; private final String methodName; private String fieldName; private String paramName; private Class<?> entityType; private Method method; private Field field; private Class<?> fieldType; private TemporalType temporalType; private Class<?> genericType; private String alias; private static final String ALIAS_PREFIX = "c"; private static final String FORMATTER = "%s %s %s"; protected QueryTuple(final String entityName, final String methodName, final String fieldName) { this.entityName = entityName; this.methodName = methodName; this.setFieldName(fieldName); } /** * Initializes {@link org.lightmare.criteria.tuples.QueryTuple} by method * description * * @param entityName * @param methodName * @param fieldName * @return {@link org.lightmare.criteria.tuples.QueryTuple} instance */ public static QueryTuple of(final String entityName, final String methodName, final String fieldName) { return new QueryTuple(entityName, methodName, fieldName); } /** * Initializes {@link org.lightmare.criteria.tuples.QueryTuple} by field * name * * @param fieldName * @return {@link org.lightmare.criteria.tuples.QueryTuple} instance */ public static QueryTuple of(final String fieldName) { return new QueryTuple(null, null, fieldName); } public String getEntityName() { return entityName; } private void setEntityName(String entityName) { this.entityName = entityName; } public String getMethodName() { return methodName; } /** * Sets field and parameter names * * @param fieldName */ public void setFieldName(String fieldName) { this.fieldName = fieldName; this.paramName = Parts.refineName(fieldName); } public String getFieldName() { return fieldName; } public String getParamName() { return paramName; } public Class<?> getEntityType() { return entityType; } public void setEntityType(Class<?> entityType) { this.entityType = entityType; } public void setTypeAndName(Class<?> entityType) { setEntityType(entityType); setEntityName(entityType.getName()); } public Method getMethod() { return method; } public void setMethod(Method method) { this.method = method; } public Field getField() { return field; } public void setField(Field field) { this.field = field; this.fieldType = ObjectUtils.ifIsNotNull(field, Field::getType); } public Class<?> getFieldType() { return fieldType; } public TemporalType getTemporalType() { return temporalType; } public void setTemporalType(TemporalType temporalType) { this.temporalType = temporalType; } public void setTemporalType(Temporal temporal) { ObjectUtils.nonNull(temporal, c -> setTemporalType(c.value())); } public Class<?> getGenericType() { return ObjectUtils.thisOrDefault(genericType, field::getType, this::setGenericType); } public void setGenericType(Class<?> genericType) { this.genericType = genericType; } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } public boolean hasNoAlias() { return StringUtils.isEmpty(alias); } public void setAlias(int index) { this.alias = StringUtils.thisOrDefault(alias, () -> ALIAS_PREFIX.concat(String.valueOf(index))); } public <F> Class<F> getCollectionType() { return ObjectUtils.getAndCast(this::getGenericType); } public <F> Class<F> getFieldGenericType() { return ObjectUtils.getAndCast(this::getFieldType); } @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } @Override public String toString() { return String.format(FORMATTER, entityName, methodName, fieldName); } }
lgpl-2.1
mbert/mulberry-lib-jx
libjcore/code/JDirInfo.h
8464
/****************************************************************************** JDirInfo.h Interface for the JDirInfo class Copyright © 1996 by Glenn W. Bach. All rights reserved. Copyright © 1997-98 by John Lindal. All rights reserved. ******************************************************************************/ #ifndef _H_JDirInfo #define _H_JDirInfo #if !defined _J_UNIX && !defined ACE_LACKS_PRAGMA_ONCE #pragma once #endif #include <JContainer.h> #include <JDirEntry.h> // for convenience #include <JPtrArray.h> #include <JError.h> #include <jTime.h> class JRegex; class JString; class JProgressDisplay; typedef JOrderedSetT::CompareResult (JCompareDirEntries)(JDirEntry * const &, JDirEntry * const &); typedef JBoolean (JCheckPermissions)(const JDirEntry&); class JDirInfo : public JContainer { public: static JBoolean Create(const JCharacter* dirName, JDirInfo** obj); static JBoolean Create(const JDirInfo& source, const JCharacter* dirName, JDirInfo** obj); static JBoolean OKToCreate(const JCharacter* dirName); JDirInfo(const JDirInfo& source); JDirInfo(const JDirInfo& source, const JCharacter* dirName); virtual ~JDirInfo(); const JDirInfo& operator=(const JDirInfo& source); void CopySettings(const JDirInfo& source); JBoolean DirectoryExists() const; const JString& GetDirectory() const; JBoolean IsWritable() const; JError GoUp(); JError GoDown(const JCharacter* dirName); void GoToClosest(const JCharacter* dirName); JError GoTo(const JCharacter* dirName); void ChangeSort(JCompareDirEntries* f, const JOrderedSetT::SortOrder order); JBoolean FilesVisible() const; void ShowFiles(const JBoolean showFiles); JBoolean DirsVisible() const; void ShowDirs(const JBoolean showDirs); JBoolean HiddenVisible() const; void ShowHidden(const JBoolean showHidden); JBoolean OthersVisible() const; void ShowOthers(const JBoolean showOthers); JBoolean HasWildcardFilter() const; void SetWildcardFilter(const JCharacter* filterStr, const JBoolean negate = kJFalse, const JBoolean caseSensitive = kJFalse); void ClearWildcardFilter(); JBoolean WillApplyWildcardFilterToDirs() const; void ShouldApplyWildcardFilterToDirs(const JBoolean apply = kJTrue); JBoolean HasDirEntryFilter() const; void SetDirEntryFilter(JCheckPermissions* f); void ClearDirEntryFilter(); JBoolean HasContentFilter() const; JError SetContentFilter(const JCharacter* regexStr); void ClearContentFilter(); void ResetCSFFilters(); void ChangeProgressDisplay(JProgressDisplay* pg); void UseDefaultProgressDisplay(); JBoolean WillSwitchToValidDirectory() const; void ShouldSwitchToValidDirectory(const JBoolean switchIfInvalid = kJTrue); JBoolean Update(const JBoolean force = kJFalse); // updates if necessary JBoolean ForceUpdate(); // updates regardless JSize GetEntryCount() const; const JDirEntry& GetEntry(const JIndex index) const; JBoolean FindEntry(const JCharacter* name, JIndex* index) const; JBoolean ClosestMatch(const JCharacter* prefixStr, JIndex* index) const; static JBoolean BuildRegexFromWildcardFilter(const JCharacter* filterStr, JString* regexStr); static JBoolean Empty(const JCharacter* dirName); protected: JDirInfo(const JCharacter* dirName); virtual JBoolean IsVisible(const JDirEntry& entry) const; JBoolean MatchesNameFilter(const JDirEntry& entry) const; JBoolean MatchesDirEntryFilter(const JDirEntry& entry) const; JBoolean MatchesContentFilter(const JDirEntry& entry) const; private: JBoolean itsIsValidFlag; JBoolean itsSwitchIfInvalidFlag; JString* itsCWD; JBoolean itsIsWritableFlag; time_t itsModTime; time_t itsStatusTime; JBoolean itsShowFilesFlag; JBoolean itsShowDirsFlag; JBoolean itsShowHiddenFlag; JBoolean itsShowOthersFlag; JRegex* itsNameRegex; // can be NULL JBoolean itsInvertNameRegexFlag; JBoolean itsFilterDirsFlag; JRegex* itsContentRegex; // can be NULL JCheckPermissions* itsPermFilter; // can be NULL JPtrArray<JDirEntry>* itsDirEntries; // everything, current sorting fn JPtrArray<JDirEntry>* itsVisEntries; // visible, current sorting fn JPtrArray<JDirEntry>* itsAlphaEntries; // visible, sorted alphabetically JProgressDisplay* itsPG; // can be NULL private: void JDirInfoX(const JDirInfo& source); void AllocateCWD(const JCharacter* dirName); void PrivateCopySettings(const JDirInfo& source); void CopyDirEntries(const JDirInfo& source); JError BuildInfo(); void BuildInfo1(JProgressDisplay& pg); void ApplyFilters(const JBoolean update); static void AppendRegex(const JCharacter* origStr, JString* regexStr); public: // JBroadcaster messages static const JCharacter* kContentsWillBeUpdated; static const JCharacter* kContentsChanged; static const JCharacter* kPathChanged; static const JCharacter* kPermissionsChanged; static const JCharacter* kSettingsChanged; class ContentsWillBeUpdated : public JBroadcaster::Message { public: ContentsWillBeUpdated() : JBroadcaster::Message(kContentsWillBeUpdated) { }; }; class ContentsChanged : public JBroadcaster::Message { public: ContentsChanged() : JBroadcaster::Message(kContentsChanged) { }; }; class PathChanged : public JBroadcaster::Message { public: PathChanged() : JBroadcaster::Message(kPathChanged) { }; }; class PermissionsChanged : public JBroadcaster::Message { public: PermissionsChanged() : JBroadcaster::Message(kPermissionsChanged) { }; }; class SettingsChanged : public JBroadcaster::Message { public: SettingsChanged() : JBroadcaster::Message(kSettingsChanged) { }; }; }; /****************************************************************************** DirectoryExists ******************************************************************************/ inline JBoolean JDirInfo::DirectoryExists() const { return itsIsValidFlag; } /****************************************************************************** GetDirectory ******************************************************************************/ inline const JString& JDirInfo::GetDirectory() const { return *itsCWD; } /****************************************************************************** Filters ******************************************************************************/ inline JBoolean JDirInfo::FilesVisible() const { return itsShowFilesFlag; } inline JBoolean JDirInfo::DirsVisible() const { return itsShowDirsFlag; } inline JBoolean JDirInfo::HiddenVisible() const { return itsShowHiddenFlag; } inline JBoolean JDirInfo::OthersVisible() const { return itsShowOthersFlag; } inline JBoolean JDirInfo::HasWildcardFilter() const { return JNegate( itsNameRegex == NULL ); } inline JBoolean JDirInfo::WillApplyWildcardFilterToDirs() const { return itsFilterDirsFlag; } inline JBoolean JDirInfo::HasDirEntryFilter() const { return JNegate( itsPermFilter == NULL ); } inline JBoolean JDirInfo::HasContentFilter() const { return JNegate( itsContentRegex == NULL ); } /****************************************************************************** IsWritable ******************************************************************************/ inline JBoolean JDirInfo::IsWritable() const { return itsIsWritableFlag; } /****************************************************************************** GetEntryCount ******************************************************************************/ inline JSize JDirInfo::GetEntryCount() const { return GetElementCount(); } /****************************************************************************** GetEntry ******************************************************************************/ inline const JDirEntry& JDirInfo::GetEntry ( const JIndex index ) const { return *(itsVisEntries->NthElement(index)); } /****************************************************************************** Switch to valid directory if curr dir is invalid ******************************************************************************/ inline JBoolean JDirInfo::WillSwitchToValidDirectory() const { return itsSwitchIfInvalidFlag; } inline void JDirInfo::ShouldSwitchToValidDirectory ( const JBoolean switchIfInvalid ) { itsSwitchIfInvalidFlag = switchIfInvalid; if (itsSwitchIfInvalidFlag && !itsIsValidFlag) { ForceUpdate(); } } #endif
lgpl-2.1
jondo2010/OpenSG
Source/Contrib/ComplexSceneManager/Helper/OSGCSMLogger.cpp
7775
/*---------------------------------------------------------------------------*\ * OpenSG * * * * * * Copyright (C) 2000-2006 by the OpenSG Forum * * * * www.opensg.org * * * * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * * * \*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*\ * License * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Library General Public License as published * * by the Free Software Foundation, version 2. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * Library General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * \*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*\ * Changes * * * * * * * * * * * * * \*---------------------------------------------------------------------------*/ //--------------------------------------------------------------------------- // Includes //--------------------------------------------------------------------------- #include <cstdlib> #include <cstdio> #include "OSGConfig.h" #include "OSGCSMLogger.h" #include "OSGNameAttachment.h" OSG_BEGIN_NAMESPACE // Documentation for this class is emitted in the // OSGCSMLoggerBase.cpp file. // To modify it, please change the .fcd file (OSGCSMLogger.fcd) and // regenerate the base file. /***************************************************************************\ * Class variables * \***************************************************************************/ /***************************************************************************\ * Class methods * \***************************************************************************/ void CSMLogger::initMethod(InitPhase ePhase) { Inherited::initMethod(ePhase); if(ePhase == TypeObject::SystemPost) { } } /***************************************************************************\ * Instance methods * \***************************************************************************/ /*-------------------------------------------------------------------------*\ - private - \*-------------------------------------------------------------------------*/ /*----------------------- constructors & destructors ----------------------*/ CSMLogger::CSMLogger(void) : Inherited() { } CSMLogger::CSMLogger(const CSMLogger &source) : Inherited(source) { } CSMLogger::~CSMLogger(void) { } /*----------------------------- class specific ----------------------------*/ void CSMLogger::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); if(0x0000 != (whichField & (ContainersFieldMask | FieldsFieldMask))) { } } void CSMLogger::dump( UInt32 , const BitVector ) const { SLOG << "Dump CSMLogger NI" << std::endl; } void CSMLogger::postOSGLoading(FileContextAttachment * const pContext) { MFContainersType::const_iterator cIt = _mfContainers.begin(); MFContainersType::const_iterator cEnd = _mfContainers.end (); MFString ::const_iterator fIt = _mfFields.begin (); MFString ::const_iterator fEnd = _mfFields.end (); for(; cIt != cEnd && fIt != fEnd; ++cIt, ++fIt) { fprintf(stderr, "log : %p (%s).%s\n", static_cast<void *>(*cIt), (*cIt) != NULL ? (*cIt)->getType().getCName() : "---", fIt->c_str() ); const FieldDescriptionBase *pDesc = (*cIt)->getFieldDescription(fIt->c_str()); if(pDesc != NULL) { ChangedFunctor logCB = boost::bind(&CSMLogger::doLog, this, _1, _2, _3, pDesc->getFieldId(), pDesc->getFieldMask()); (*cIt)->addChangedFunctor(logCB, ""); } } } void CSMLogger::doLog(FieldContainer *pContainer, BitVector bvFlags , UInt32 origin , UInt32 uiRefFieldId, BitVector uiRefFieldMask) { if(0x0000 != (bvFlags & uiRefFieldMask) && _sfEnabled.getValue() == true) { GetFieldHandlePtr pFH = pContainer->getField(uiRefFieldId); if(pFH && pFH->isValid() == true) { static CErrOutStream cerrStream; const FieldDescriptionBase *pDesc = pContainer->getFieldDescription(uiRefFieldId); AttachmentContainer *pAtt = dynamic_cast<AttachmentContainer *>(pContainer); if(pAtt != NULL) { const Char8 *szName = getName(pAtt); if(szName != NULL) { cerrStream << "[" << szName << "]:"; } } cerrStream << pContainer->getType().getName() << "." << pDesc->getName() << " : "; pFH->pushValueToStream(cerrStream); cerrStream << std::endl; } } } OSG_END_NAMESPACE
lgpl-2.1
oregional/tiki
themes/snow/css/snow.css
171326
@import url("//fonts.googleapis.com/css?family=Simonetta"); /* The Snow theme style sheet for Tiki Wiki CMS Groupware. */ /*! * Bootstrap v3.3.7 (http://getbootstrap.com) * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ /*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ html { font-family: sans-serif; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; } body { margin: 0; } article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { display: block; } audio, canvas, progress, video { display: inline-block; vertical-align: baseline; } audio:not([controls]) { display: none; height: 0; } [hidden], template { display: none; } a { background-color: transparent; } a:active, a:hover { outline: 0; } abbr[title] { border-bottom: 1px dotted; } b, strong { font-weight: bold; } dfn { font-style: italic; } h1 { font-size: 2em; margin: 0.67em 0; } mark { background: #ff0; color: #000; } small { font-size: 80%; } sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } sup { top: -0.5em; } sub { bottom: -0.25em; } img { border: 0; } svg:not(:root) { overflow: hidden; } figure { margin: 1em 40px; } hr { box-sizing: content-box; height: 0; } pre { overflow: auto; } code, kbd, pre, samp { font-family: monospace, monospace; font-size: 1em; } button, input, optgroup, select, textarea { color: inherit; font: inherit; margin: 0; } button { overflow: visible; } button, select { text-transform: none; } button, html input[type="button"], input[type="reset"], input[type="submit"] { -webkit-appearance: button; cursor: pointer; } button[disabled], html input[disabled] { cursor: default; } button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; } input { line-height: normal; } input[type="checkbox"], input[type="radio"] { box-sizing: border-box; padding: 0; } input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { height: auto; } input[type="search"] { -webkit-appearance: textfield; box-sizing: content-box; } input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; } fieldset { border: 1px solid #c0c0c0; margin: 0 2px; padding: 0.35em 0.625em 0.75em; } legend { border: 0; padding: 0; } textarea { overflow: auto; } optgroup { font-weight: bold; } table { border-collapse: collapse; border-spacing: 0; } td, th { padding: 0; } /*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ @media print { *, *:before, *:after { background: transparent !important; color: #000 !important; box-shadow: none !important; text-shadow: none !important; } a, a:visited { text-decoration: underline; } a[href]:after { content: " (" attr(href) ")"; } abbr[title]:after { content: " (" attr(title) ")"; } a[href^="#"]:after, a[href^="javascript:"]:after { content: ""; } pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } thead { display: table-header-group; } tr, img { page-break-inside: avoid; } img { max-width: 100% !important; } p, h2, h3 { orphans: 3; widows: 3; } h2, h3 { page-break-after: avoid; } .navbar { display: none; } .btn > .caret, .dropup > .btn > .caret { border-top-color: #000 !important; } .label { border: 1px solid #000; } .table { border-collapse: collapse !important; } .table td, .table th { background-color: #fff !important; } .table-bordered th, .table-bordered td { border: 1px solid #ddd !important; } } @font-face { font-family: 'Glyphicons Halflings'; src: url('../../../vendor_bundled/vendor/twitter/bootstrap/fonts/glyphicons-halflings-regular.eot'); src: url('../../../vendor_bundled/vendor/twitter/bootstrap/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../../../vendor_bundled/vendor/twitter/bootstrap/fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../../../vendor_bundled/vendor/twitter/bootstrap/fonts/glyphicons-halflings-regular.woff') format('woff'), url('../../../vendor_bundled/vendor/twitter/bootstrap/fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../../../vendor_bundled/vendor/twitter/bootstrap/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); } .glyphicon { position: relative; top: 1px; display: inline-block; font-family: 'Glyphicons Halflings'; font-style: normal; font-weight: normal; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .glyphicon-asterisk:before { content: "\002a"; } .glyphicon-plus:before { content: "\002b"; } .glyphicon-euro:before, .glyphicon-eur:before { content: "\20ac"; } .glyphicon-minus:before { content: "\2212"; } .glyphicon-cloud:before { content: "\2601"; } .glyphicon-envelope:before { content: "\2709"; } .glyphicon-pencil:before { content: "\270f"; } .glyphicon-glass:before { content: "\e001"; } .glyphicon-music:before { content: "\e002"; } .glyphicon-search:before { content: "\e003"; } .glyphicon-heart:before { content: "\e005"; } .glyphicon-star:before { content: "\e006"; } .glyphicon-star-empty:before { content: "\e007"; } .glyphicon-user:before { content: "\e008"; } .glyphicon-film:before { content: "\e009"; } .glyphicon-th-large:before { content: "\e010"; } .glyphicon-th:before { content: "\e011"; } .glyphicon-th-list:before { content: "\e012"; } .glyphicon-ok:before { content: "\e013"; } .glyphicon-remove:before { content: "\e014"; } .glyphicon-zoom-in:before { content: "\e015"; } .glyphicon-zoom-out:before { content: "\e016"; } .glyphicon-off:before { content: "\e017"; } .glyphicon-signal:before { content: "\e018"; } .glyphicon-cog:before { content: "\e019"; } .glyphicon-trash:before { content: "\e020"; } .glyphicon-home:before { content: "\e021"; } .glyphicon-file:before { content: "\e022"; } .glyphicon-time:before { content: "\e023"; } .glyphicon-road:before { content: "\e024"; } .glyphicon-download-alt:before { content: "\e025"; } .glyphicon-download:before { content: "\e026"; } .glyphicon-upload:before { content: "\e027"; } .glyphicon-inbox:before { content: "\e028"; } .glyphicon-play-circle:before { content: "\e029"; } .glyphicon-repeat:before { content: "\e030"; } .glyphicon-refresh:before { content: "\e031"; } .glyphicon-list-alt:before { content: "\e032"; } .glyphicon-lock:before { content: "\e033"; } .glyphicon-flag:before { content: "\e034"; } .glyphicon-headphones:before { content: "\e035"; } .glyphicon-volume-off:before { content: "\e036"; } .glyphicon-volume-down:before { content: "\e037"; } .glyphicon-volume-up:before { content: "\e038"; } .glyphicon-qrcode:before { content: "\e039"; } .glyphicon-barcode:before { content: "\e040"; } .glyphicon-tag:before { content: "\e041"; } .glyphicon-tags:before { content: "\e042"; } .glyphicon-book:before { content: "\e043"; } .glyphicon-bookmark:before { content: "\e044"; } .glyphicon-print:before { content: "\e045"; } .glyphicon-camera:before { content: "\e046"; } .glyphicon-font:before { content: "\e047"; } .glyphicon-bold:before { content: "\e048"; } .glyphicon-italic:before { content: "\e049"; } .glyphicon-text-height:before { content: "\e050"; } .glyphicon-text-width:before { content: "\e051"; } .glyphicon-align-left:before { content: "\e052"; } .glyphicon-align-center:before { content: "\e053"; } .glyphicon-align-right:before { content: "\e054"; } .glyphicon-align-justify:before { content: "\e055"; } .glyphicon-list:before { content: "\e056"; } .glyphicon-indent-left:before { content: "\e057"; } .glyphicon-indent-right:before { content: "\e058"; } .glyphicon-facetime-video:before { content: "\e059"; } .glyphicon-picture:before { content: "\e060"; } .glyphicon-map-marker:before { content: "\e062"; } .glyphicon-adjust:before { content: "\e063"; } .glyphicon-tint:before { content: "\e064"; } .glyphicon-edit:before { content: "\e065"; } .glyphicon-share:before { content: "\e066"; } .glyphicon-check:before { content: "\e067"; } .glyphicon-move:before { content: "\e068"; } .glyphicon-step-backward:before { content: "\e069"; } .glyphicon-fast-backward:before { content: "\e070"; } .glyphicon-backward:before { content: "\e071"; } .glyphicon-play:before { content: "\e072"; } .glyphicon-pause:before { content: "\e073"; } .glyphicon-stop:before { content: "\e074"; } .glyphicon-forward:before { content: "\e075"; } .glyphicon-fast-forward:before { content: "\e076"; } .glyphicon-step-forward:before { content: "\e077"; } .glyphicon-eject:before { content: "\e078"; } .glyphicon-chevron-left:before { content: "\e079"; } .glyphicon-chevron-right:before { content: "\e080"; } .glyphicon-plus-sign:before { content: "\e081"; } .glyphicon-minus-sign:before { content: "\e082"; } .glyphicon-remove-sign:before { content: "\e083"; } .glyphicon-ok-sign:before { content: "\e084"; } .glyphicon-question-sign:before { content: "\e085"; } .glyphicon-info-sign:before { content: "\e086"; } .glyphicon-screenshot:before { content: "\e087"; } .glyphicon-remove-circle:before { content: "\e088"; } .glyphicon-ok-circle:before { content: "\e089"; } .glyphicon-ban-circle:before { content: "\e090"; } .glyphicon-arrow-left:before { content: "\e091"; } .glyphicon-arrow-right:before { content: "\e092"; } .glyphicon-arrow-up:before { content: "\e093"; } .glyphicon-arrow-down:before { content: "\e094"; } .glyphicon-share-alt:before { content: "\e095"; } .glyphicon-resize-full:before { content: "\e096"; } .glyphicon-resize-small:before { content: "\e097"; } .glyphicon-exclamation-sign:before { content: "\e101"; } .glyphicon-gift:before { content: "\e102"; } .glyphicon-leaf:before { content: "\e103"; } .glyphicon-fire:before { content: "\e104"; } .glyphicon-eye-open:before { content: "\e105"; } .glyphicon-eye-close:before { content: "\e106"; } .glyphicon-warning-sign:before { content: "\e107"; } .glyphicon-plane:before { content: "\e108"; } .glyphicon-calendar:before { content: "\e109"; } .glyphicon-random:before { content: "\e110"; } .glyphicon-comment:before { content: "\e111"; } .glyphicon-magnet:before { content: "\e112"; } .glyphicon-chevron-up:before { content: "\e113"; } .glyphicon-chevron-down:before { content: "\e114"; } .glyphicon-retweet:before { content: "\e115"; } .glyphicon-shopping-cart:before { content: "\e116"; } .glyphicon-folder-close:before { content: "\e117"; } .glyphicon-folder-open:before { content: "\e118"; } .glyphicon-resize-vertical:before { content: "\e119"; } .glyphicon-resize-horizontal:before { content: "\e120"; } .glyphicon-hdd:before { content: "\e121"; } .glyphicon-bullhorn:before { content: "\e122"; } .glyphicon-bell:before { content: "\e123"; } .glyphicon-certificate:before { content: "\e124"; } .glyphicon-thumbs-up:before { content: "\e125"; } .glyphicon-thumbs-down:before { content: "\e126"; } .glyphicon-hand-right:before { content: "\e127"; } .glyphicon-hand-left:before { content: "\e128"; } .glyphicon-hand-up:before { content: "\e129"; } .glyphicon-hand-down:before { content: "\e130"; } .glyphicon-circle-arrow-right:before { content: "\e131"; } .glyphicon-circle-arrow-left:before { content: "\e132"; } .glyphicon-circle-arrow-up:before { content: "\e133"; } .glyphicon-circle-arrow-down:before { content: "\e134"; } .glyphicon-globe:before { content: "\e135"; } .glyphicon-wrench:before { content: "\e136"; } .glyphicon-tasks:before { content: "\e137"; } .glyphicon-filter:before { content: "\e138"; } .glyphicon-briefcase:before { content: "\e139"; } .glyphicon-fullscreen:before { content: "\e140"; } .glyphicon-dashboard:before { content: "\e141"; } .glyphicon-paperclip:before { content: "\e142"; } .glyphicon-heart-empty:before { content: "\e143"; } .glyphicon-link:before { content: "\e144"; } .glyphicon-phone:before { content: "\e145"; } .glyphicon-pushpin:before { content: "\e146"; } .glyphicon-usd:before { content: "\e148"; } .glyphicon-gbp:before { content: "\e149"; } .glyphicon-sort:before { content: "\e150"; } .glyphicon-sort-by-alphabet:before { content: "\e151"; } .glyphicon-sort-by-alphabet-alt:before { content: "\e152"; } .glyphicon-sort-by-order:before { content: "\e153"; } .glyphicon-sort-by-order-alt:before { content: "\e154"; } .glyphicon-sort-by-attributes:before { content: "\e155"; } .glyphicon-sort-by-attributes-alt:before { content: "\e156"; } .glyphicon-unchecked:before { content: "\e157"; } .glyphicon-expand:before { content: "\e158"; } .glyphicon-collapse-down:before { content: "\e159"; } .glyphicon-collapse-up:before { content: "\e160"; } .glyphicon-log-in:before { content: "\e161"; } .glyphicon-flash:before { content: "\e162"; } .glyphicon-log-out:before { content: "\e163"; } .glyphicon-new-window:before { content: "\e164"; } .glyphicon-record:before { content: "\e165"; } .glyphicon-save:before { content: "\e166"; } .glyphicon-open:before { content: "\e167"; } .glyphicon-saved:before { content: "\e168"; } .glyphicon-import:before { content: "\e169"; } .glyphicon-export:before { content: "\e170"; } .glyphicon-send:before { content: "\e171"; } .glyphicon-floppy-disk:before { content: "\e172"; } .glyphicon-floppy-saved:before { content: "\e173"; } .glyphicon-floppy-remove:before { content: "\e174"; } .glyphicon-floppy-save:before { content: "\e175"; } .glyphicon-floppy-open:before { content: "\e176"; } .glyphicon-credit-card:before { content: "\e177"; } .glyphicon-transfer:before { content: "\e178"; } .glyphicon-cutlery:before { content: "\e179"; } .glyphicon-header:before { content: "\e180"; } .glyphicon-compressed:before { content: "\e181"; } .glyphicon-earphone:before { content: "\e182"; } .glyphicon-phone-alt:before { content: "\e183"; } .glyphicon-tower:before { content: "\e184"; } .glyphicon-stats:before { content: "\e185"; } .glyphicon-sd-video:before { content: "\e186"; } .glyphicon-hd-video:before { content: "\e187"; } .glyphicon-subtitles:before { content: "\e188"; } .glyphicon-sound-stereo:before { content: "\e189"; } .glyphicon-sound-dolby:before { content: "\e190"; } .glyphicon-sound-5-1:before { content: "\e191"; } .glyphicon-sound-6-1:before { content: "\e192"; } .glyphicon-sound-7-1:before { content: "\e193"; } .glyphicon-copyright-mark:before { content: "\e194"; } .glyphicon-registration-mark:before { content: "\e195"; } .glyphicon-cloud-download:before { content: "\e197"; } .glyphicon-cloud-upload:before { content: "\e198"; } .glyphicon-tree-conifer:before { content: "\e199"; } .glyphicon-tree-deciduous:before { content: "\e200"; } .glyphicon-cd:before { content: "\e201"; } .glyphicon-save-file:before { content: "\e202"; } .glyphicon-open-file:before { content: "\e203"; } .glyphicon-level-up:before { content: "\e204"; } .glyphicon-copy:before { content: "\e205"; } .glyphicon-paste:before { content: "\e206"; } .glyphicon-alert:before { content: "\e209"; } .glyphicon-equalizer:before { content: "\e210"; } .glyphicon-king:before { content: "\e211"; } .glyphicon-queen:before { content: "\e212"; } .glyphicon-pawn:before { content: "\e213"; } .glyphicon-bishop:before { content: "\e214"; } .glyphicon-knight:before { content: "\e215"; } .glyphicon-baby-formula:before { content: "\e216"; } .glyphicon-tent:before { content: "\26fa"; } .glyphicon-blackboard:before { content: "\e218"; } .glyphicon-bed:before { content: "\e219"; } .glyphicon-apple:before { content: "\f8ff"; } .glyphicon-erase:before { content: "\e221"; } .glyphicon-hourglass:before { content: "\231b"; } .glyphicon-lamp:before { content: "\e223"; } .glyphicon-duplicate:before { content: "\e224"; } .glyphicon-piggy-bank:before { content: "\e225"; } .glyphicon-scissors:before { content: "\e226"; } .glyphicon-bitcoin:before { content: "\e227"; } .glyphicon-btc:before { content: "\e227"; } .glyphicon-xbt:before { content: "\e227"; } .glyphicon-yen:before { content: "\00a5"; } .glyphicon-jpy:before { content: "\00a5"; } .glyphicon-ruble:before { content: "\20bd"; } .glyphicon-rub:before { content: "\20bd"; } .glyphicon-scale:before { content: "\e230"; } .glyphicon-ice-lolly:before { content: "\e231"; } .glyphicon-ice-lolly-tasted:before { content: "\e232"; } .glyphicon-education:before { content: "\e233"; } .glyphicon-option-horizontal:before { content: "\e234"; } .glyphicon-option-vertical:before { content: "\e235"; } .glyphicon-menu-hamburger:before { content: "\e236"; } .glyphicon-modal-window:before { content: "\e237"; } .glyphicon-oil:before { content: "\e238"; } .glyphicon-grain:before { content: "\e239"; } .glyphicon-sunglasses:before { content: "\e240"; } .glyphicon-text-size:before { content: "\e241"; } .glyphicon-text-color:before { content: "\e242"; } .glyphicon-text-background:before { content: "\e243"; } .glyphicon-object-align-top:before { content: "\e244"; } .glyphicon-object-align-bottom:before { content: "\e245"; } .glyphicon-object-align-horizontal:before { content: "\e246"; } .glyphicon-object-align-left:before { content: "\e247"; } .glyphicon-object-align-vertical:before { content: "\e248"; } .glyphicon-object-align-right:before { content: "\e249"; } .glyphicon-triangle-right:before { content: "\e250"; } .glyphicon-triangle-left:before { content: "\e251"; } .glyphicon-triangle-bottom:before { content: "\e252"; } .glyphicon-triangle-top:before { content: "\e253"; } .glyphicon-console:before { content: "\e254"; } .glyphicon-superscript:before { content: "\e255"; } .glyphicon-subscript:before { content: "\e256"; } .glyphicon-menu-left:before { content: "\e257"; } .glyphicon-menu-right:before { content: "\e258"; } .glyphicon-menu-down:before { content: "\e259"; } .glyphicon-menu-up:before { content: "\e260"; } * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } *:before, *:after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } html { font-size: 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.42857143; color: #333333; background-color: #fefeff; } input, button, select, textarea { font-family: inherit; font-size: inherit; line-height: inherit; } a { color: #613b8d; text-decoration: none; } a:hover, a:focus { color: #3c2457; text-decoration: underline; } a:focus { outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } figure { margin: 0; } img { vertical-align: middle; } .img-responsive, .thumbnail > img, .thumbnail a > img, .carousel-inner > .item > img, .carousel-inner > .item > a > img { display: block; max-width: 100%; height: auto; } .img-rounded { border-radius: 6px; } .img-thumbnail { padding: 4px; line-height: 1.42857143; background-color: #fefeff; border: 1px solid #dddddd; border-radius: 4px; -webkit-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; display: inline-block; max-width: 100%; height: auto; } .img-circle { border-radius: 50%; } hr { margin-top: 20px; margin-bottom: 20px; border: 0; border-top: 1px solid #eeeeee; } .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; } .sr-only-focusable:active, .sr-only-focusable:focus { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; } [role="button"] { cursor: pointer; } h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-family: Simonetta, serif; font-weight: 500; line-height: 1.1; color: inherit; } h1 small, h2 small, h3 small, h4 small, h5 small, h6 small, .h1 small, .h2 small, .h3 small, .h4 small, .h5 small, .h6 small, h1 .small, h2 .small, h3 .small, h4 .small, h5 .small, h6 .small, .h1 .small, .h2 .small, .h3 .small, .h4 .small, .h5 .small, .h6 .small { font-weight: normal; line-height: 1; color: #999999; } h1, .h1, h2, .h2, h3, .h3 { margin-top: 20px; margin-bottom: 10px; } h1 small, .h1 small, h2 small, .h2 small, h3 small, .h3 small, h1 .small, .h1 .small, h2 .small, .h2 .small, h3 .small, .h3 .small { font-size: 65%; } h4, .h4, h5, .h5, h6, .h6 { margin-top: 10px; margin-bottom: 10px; } h4 small, .h4 small, h5 small, .h5 small, h6 small, .h6 small, h4 .small, .h4 .small, h5 .small, .h5 .small, h6 .small, .h6 .small { font-size: 75%; } h1, .h1 { font-size: 36px; } h2, .h2 { font-size: 30px; } h3, .h3 { font-size: 24px; } h4, .h4 { font-size: 18px; } h5, .h5 { font-size: 14px; } h6, .h6 { font-size: 12px; } p { margin: 0 0 10px; } .lead { margin-bottom: 20px; font-size: 16px; font-weight: 300; line-height: 1.4; } @media (min-width: 768px) { .lead { font-size: 21px; } } small, .small { font-size: 85%; } mark, .mark { background-color: #fcf8e3; padding: .2em; } .text-left { text-align: left; } .text-right { text-align: right; } .text-center { text-align: center; } .text-justify { text-align: justify; } .text-nowrap { white-space: nowrap; } .text-lowercase { text-transform: lowercase; } .text-uppercase { text-transform: uppercase; } .text-capitalize { text-transform: capitalize; } .text-muted { color: #999999; } .text-primary { color: #95a0be; } a.text-primary:hover, a.text-primary:focus { color: #7584ab; } .text-success { color: #3c763d; } a.text-success:hover, a.text-success:focus { color: #2b542c; } .text-info { color: #31708f; } a.text-info:hover, a.text-info:focus { color: #245269; } .text-warning { color: #8a6d3b; } a.text-warning:hover, a.text-warning:focus { color: #66512c; } .text-danger { color: #a94442; } a.text-danger:hover, a.text-danger:focus { color: #843534; } .bg-primary { color: #fff; background-color: #95a0be; } a.bg-primary:hover, a.bg-primary:focus { background-color: #7584ab; } .bg-success { background-color: #dff0d8; } a.bg-success:hover, a.bg-success:focus { background-color: #c1e2b3; } .bg-info { background-color: #d9edf7; } a.bg-info:hover, a.bg-info:focus { background-color: #afd9ee; } .bg-warning { background-color: #fcf8e3; } a.bg-warning:hover, a.bg-warning:focus { background-color: #f7ecb5; } .bg-danger { background-color: #f2dede; } a.bg-danger:hover, a.bg-danger:focus { background-color: #e4b9b9; } .page-header { padding-bottom: 9px; margin: 40px 0 20px; border-bottom: 1px solid #eeeeee; } ul, ol { margin-top: 0; margin-bottom: 10px; } ul ul, ol ul, ul ol, ol ol { margin-bottom: 0; } .list-unstyled { padding-left: 0; list-style: none; } .list-inline { padding-left: 0; list-style: none; margin-left: -5px; } .list-inline > li { display: inline-block; padding-left: 5px; padding-right: 5px; } dl { margin-top: 0; margin-bottom: 20px; } dt, dd { line-height: 1.42857143; } dt { font-weight: bold; } dd { margin-left: 0; } @media (min-width: 768px) { .dl-horizontal dt { float: left; width: 160px; clear: left; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .dl-horizontal dd { margin-left: 180px; } } abbr[title], abbr[data-original-title] { cursor: help; border-bottom: 1px dotted #999999; } .initialism { font-size: 90%; text-transform: uppercase; } blockquote { padding: 10px 20px; margin: 0 0 20px; font-size: 17.5px; border-left: 5px solid #eeeeee; } blockquote p:last-child, blockquote ul:last-child, blockquote ol:last-child { margin-bottom: 0; } blockquote footer, blockquote small, blockquote .small { display: block; font-size: 80%; line-height: 1.42857143; color: #999999; } blockquote footer:before, blockquote small:before, blockquote .small:before { content: '\2014 \00A0'; } .blockquote-reverse, blockquote.pull-right { padding-right: 15px; padding-left: 0; border-right: 5px solid #eeeeee; border-left: 0; text-align: right; } .blockquote-reverse footer:before, blockquote.pull-right footer:before, .blockquote-reverse small:before, blockquote.pull-right small:before, .blockquote-reverse .small:before, blockquote.pull-right .small:before { content: ''; } .blockquote-reverse footer:after, blockquote.pull-right footer:after, .blockquote-reverse small:after, blockquote.pull-right small:after, .blockquote-reverse .small:after, blockquote.pull-right .small:after { content: '\00A0 \2014'; } address { margin-bottom: 20px; font-style: normal; line-height: 1.42857143; } code, kbd, pre, samp { font-family: Menlo, Monaco, Consolas, "Courier New", monospace; } code { padding: 2px 4px; font-size: 90%; color: #444444; background-color: #f8f8f8; border-radius: 4px; } kbd { padding: 2px 4px; font-size: 90%; color: #ffffff; background-color: #333333; border-radius: 3px; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25); } kbd kbd { padding: 0; font-size: 100%; font-weight: bold; box-shadow: none; } pre { display: block; padding: 9.5px; margin: 0 0 10px; font-size: 13px; line-height: 1.42857143; word-break: break-all; word-wrap: break-word; color: #333333; background-color: #f5f5f5; border: 1px solid #cccccc; border-radius: 4px; } pre code { padding: 0; font-size: inherit; color: inherit; white-space: pre-wrap; background-color: transparent; border-radius: 0; } .pre-scrollable { max-height: 340px; overflow-y: scroll; } .container { margin-right: auto; margin-left: auto; padding-left: 15px; padding-right: 15px; } @media (min-width: 768px) { .container { width: 750px; } } @media (min-width: 992px) { .container { width: 970px; } } @media (min-width: 1200px) { .container { width: 1170px; } } .container-fluid { margin-right: auto; margin-left: auto; padding-left: 15px; padding-right: 15px; } .row { margin-left: -15px; margin-right: -15px; } .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { position: relative; min-height: 1px; padding-left: 15px; padding-right: 15px; } .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { float: left; } .col-xs-12 { width: 100%; } .col-xs-11 { width: 91.66666667%; } .col-xs-10 { width: 83.33333333%; } .col-xs-9 { width: 75%; } .col-xs-8 { width: 66.66666667%; } .col-xs-7 { width: 58.33333333%; } .col-xs-6 { width: 50%; } .col-xs-5 { width: 41.66666667%; } .col-xs-4 { width: 33.33333333%; } .col-xs-3 { width: 25%; } .col-xs-2 { width: 16.66666667%; } .col-xs-1 { width: 8.33333333%; } .col-xs-pull-12 { right: 100%; } .col-xs-pull-11 { right: 91.66666667%; } .col-xs-pull-10 { right: 83.33333333%; } .col-xs-pull-9 { right: 75%; } .col-xs-pull-8 { right: 66.66666667%; } .col-xs-pull-7 { right: 58.33333333%; } .col-xs-pull-6 { right: 50%; } .col-xs-pull-5 { right: 41.66666667%; } .col-xs-pull-4 { right: 33.33333333%; } .col-xs-pull-3 { right: 25%; } .col-xs-pull-2 { right: 16.66666667%; } .col-xs-pull-1 { right: 8.33333333%; } .col-xs-pull-0 { right: auto; } .col-xs-push-12 { left: 100%; } .col-xs-push-11 { left: 91.66666667%; } .col-xs-push-10 { left: 83.33333333%; } .col-xs-push-9 { left: 75%; } .col-xs-push-8 { left: 66.66666667%; } .col-xs-push-7 { left: 58.33333333%; } .col-xs-push-6 { left: 50%; } .col-xs-push-5 { left: 41.66666667%; } .col-xs-push-4 { left: 33.33333333%; } .col-xs-push-3 { left: 25%; } .col-xs-push-2 { left: 16.66666667%; } .col-xs-push-1 { left: 8.33333333%; } .col-xs-push-0 { left: auto; } .col-xs-offset-12 { margin-left: 100%; } .col-xs-offset-11 { margin-left: 91.66666667%; } .col-xs-offset-10 { margin-left: 83.33333333%; } .col-xs-offset-9 { margin-left: 75%; } .col-xs-offset-8 { margin-left: 66.66666667%; } .col-xs-offset-7 { margin-left: 58.33333333%; } .col-xs-offset-6 { margin-left: 50%; } .col-xs-offset-5 { margin-left: 41.66666667%; } .col-xs-offset-4 { margin-left: 33.33333333%; } .col-xs-offset-3 { margin-left: 25%; } .col-xs-offset-2 { margin-left: 16.66666667%; } .col-xs-offset-1 { margin-left: 8.33333333%; } .col-xs-offset-0 { margin-left: 0%; } @media (min-width: 768px) { .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { float: left; } .col-sm-12 { width: 100%; } .col-sm-11 { width: 91.66666667%; } .col-sm-10 { width: 83.33333333%; } .col-sm-9 { width: 75%; } .col-sm-8 { width: 66.66666667%; } .col-sm-7 { width: 58.33333333%; } .col-sm-6 { width: 50%; } .col-sm-5 { width: 41.66666667%; } .col-sm-4 { width: 33.33333333%; } .col-sm-3 { width: 25%; } .col-sm-2 { width: 16.66666667%; } .col-sm-1 { width: 8.33333333%; } .col-sm-pull-12 { right: 100%; } .col-sm-pull-11 { right: 91.66666667%; } .col-sm-pull-10 { right: 83.33333333%; } .col-sm-pull-9 { right: 75%; } .col-sm-pull-8 { right: 66.66666667%; } .col-sm-pull-7 { right: 58.33333333%; } .col-sm-pull-6 { right: 50%; } .col-sm-pull-5 { right: 41.66666667%; } .col-sm-pull-4 { right: 33.33333333%; } .col-sm-pull-3 { right: 25%; } .col-sm-pull-2 { right: 16.66666667%; } .col-sm-pull-1 { right: 8.33333333%; } .col-sm-pull-0 { right: auto; } .col-sm-push-12 { left: 100%; } .col-sm-push-11 { left: 91.66666667%; } .col-sm-push-10 { left: 83.33333333%; } .col-sm-push-9 { left: 75%; } .col-sm-push-8 { left: 66.66666667%; } .col-sm-push-7 { left: 58.33333333%; } .col-sm-push-6 { left: 50%; } .col-sm-push-5 { left: 41.66666667%; } .col-sm-push-4 { left: 33.33333333%; } .col-sm-push-3 { left: 25%; } .col-sm-push-2 { left: 16.66666667%; } .col-sm-push-1 { left: 8.33333333%; } .col-sm-push-0 { left: auto; } .col-sm-offset-12 { margin-left: 100%; } .col-sm-offset-11 { margin-left: 91.66666667%; } .col-sm-offset-10 { margin-left: 83.33333333%; } .col-sm-offset-9 { margin-left: 75%; } .col-sm-offset-8 { margin-left: 66.66666667%; } .col-sm-offset-7 { margin-left: 58.33333333%; } .col-sm-offset-6 { margin-left: 50%; } .col-sm-offset-5 { margin-left: 41.66666667%; } .col-sm-offset-4 { margin-left: 33.33333333%; } .col-sm-offset-3 { margin-left: 25%; } .col-sm-offset-2 { margin-left: 16.66666667%; } .col-sm-offset-1 { margin-left: 8.33333333%; } .col-sm-offset-0 { margin-left: 0%; } } @media (min-width: 992px) { .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { float: left; } .col-md-12 { width: 100%; } .col-md-11 { width: 91.66666667%; } .col-md-10 { width: 83.33333333%; } .col-md-9 { width: 75%; } .col-md-8 { width: 66.66666667%; } .col-md-7 { width: 58.33333333%; } .col-md-6 { width: 50%; } .col-md-5 { width: 41.66666667%; } .col-md-4 { width: 33.33333333%; } .col-md-3 { width: 25%; } .col-md-2 { width: 16.66666667%; } .col-md-1 { width: 8.33333333%; } .col-md-pull-12 { right: 100%; } .col-md-pull-11 { right: 91.66666667%; } .col-md-pull-10 { right: 83.33333333%; } .col-md-pull-9 { right: 75%; } .col-md-pull-8 { right: 66.66666667%; } .col-md-pull-7 { right: 58.33333333%; } .col-md-pull-6 { right: 50%; } .col-md-pull-5 { right: 41.66666667%; } .col-md-pull-4 { right: 33.33333333%; } .col-md-pull-3 { right: 25%; } .col-md-pull-2 { right: 16.66666667%; } .col-md-pull-1 { right: 8.33333333%; } .col-md-pull-0 { right: auto; } .col-md-push-12 { left: 100%; } .col-md-push-11 { left: 91.66666667%; } .col-md-push-10 { left: 83.33333333%; } .col-md-push-9 { left: 75%; } .col-md-push-8 { left: 66.66666667%; } .col-md-push-7 { left: 58.33333333%; } .col-md-push-6 { left: 50%; } .col-md-push-5 { left: 41.66666667%; } .col-md-push-4 { left: 33.33333333%; } .col-md-push-3 { left: 25%; } .col-md-push-2 { left: 16.66666667%; } .col-md-push-1 { left: 8.33333333%; } .col-md-push-0 { left: auto; } .col-md-offset-12 { margin-left: 100%; } .col-md-offset-11 { margin-left: 91.66666667%; } .col-md-offset-10 { margin-left: 83.33333333%; } .col-md-offset-9 { margin-left: 75%; } .col-md-offset-8 { margin-left: 66.66666667%; } .col-md-offset-7 { margin-left: 58.33333333%; } .col-md-offset-6 { margin-left: 50%; } .col-md-offset-5 { margin-left: 41.66666667%; } .col-md-offset-4 { margin-left: 33.33333333%; } .col-md-offset-3 { margin-left: 25%; } .col-md-offset-2 { margin-left: 16.66666667%; } .col-md-offset-1 { margin-left: 8.33333333%; } .col-md-offset-0 { margin-left: 0%; } } @media (min-width: 1200px) { .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { float: left; } .col-lg-12 { width: 100%; } .col-lg-11 { width: 91.66666667%; } .col-lg-10 { width: 83.33333333%; } .col-lg-9 { width: 75%; } .col-lg-8 { width: 66.66666667%; } .col-lg-7 { width: 58.33333333%; } .col-lg-6 { width: 50%; } .col-lg-5 { width: 41.66666667%; } .col-lg-4 { width: 33.33333333%; } .col-lg-3 { width: 25%; } .col-lg-2 { width: 16.66666667%; } .col-lg-1 { width: 8.33333333%; } .col-lg-pull-12 { right: 100%; } .col-lg-pull-11 { right: 91.66666667%; } .col-lg-pull-10 { right: 83.33333333%; } .col-lg-pull-9 { right: 75%; } .col-lg-pull-8 { right: 66.66666667%; } .col-lg-pull-7 { right: 58.33333333%; } .col-lg-pull-6 { right: 50%; } .col-lg-pull-5 { right: 41.66666667%; } .col-lg-pull-4 { right: 33.33333333%; } .col-lg-pull-3 { right: 25%; } .col-lg-pull-2 { right: 16.66666667%; } .col-lg-pull-1 { right: 8.33333333%; } .col-lg-pull-0 { right: auto; } .col-lg-push-12 { left: 100%; } .col-lg-push-11 { left: 91.66666667%; } .col-lg-push-10 { left: 83.33333333%; } .col-lg-push-9 { left: 75%; } .col-lg-push-8 { left: 66.66666667%; } .col-lg-push-7 { left: 58.33333333%; } .col-lg-push-6 { left: 50%; } .col-lg-push-5 { left: 41.66666667%; } .col-lg-push-4 { left: 33.33333333%; } .col-lg-push-3 { left: 25%; } .col-lg-push-2 { left: 16.66666667%; } .col-lg-push-1 { left: 8.33333333%; } .col-lg-push-0 { left: auto; } .col-lg-offset-12 { margin-left: 100%; } .col-lg-offset-11 { margin-left: 91.66666667%; } .col-lg-offset-10 { margin-left: 83.33333333%; } .col-lg-offset-9 { margin-left: 75%; } .col-lg-offset-8 { margin-left: 66.66666667%; } .col-lg-offset-7 { margin-left: 58.33333333%; } .col-lg-offset-6 { margin-left: 50%; } .col-lg-offset-5 { margin-left: 41.66666667%; } .col-lg-offset-4 { margin-left: 33.33333333%; } .col-lg-offset-3 { margin-left: 25%; } .col-lg-offset-2 { margin-left: 16.66666667%; } .col-lg-offset-1 { margin-left: 8.33333333%; } .col-lg-offset-0 { margin-left: 0%; } } table { background-color: transparent; } caption { padding-top: 8px; padding-bottom: 8px; color: #999999; text-align: left; } th { text-align: left; } .table { width: 100%; max-width: 100%; margin-bottom: 20px; } .table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td { padding: 8px; line-height: 1.42857143; vertical-align: top; border-top: 1px solid #dddddd; } .table > thead > tr > th { vertical-align: bottom; border-bottom: 2px solid #dddddd; } .table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > th, .table > caption + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > td, .table > thead:first-child > tr:first-child > td { border-top: 0; } .table > tbody + tbody { border-top: 2px solid #dddddd; } .table .table { background-color: #fefeff; } .table-condensed > thead > tr > th, .table-condensed > tbody > tr > th, .table-condensed > tfoot > tr > th, .table-condensed > thead > tr > td, .table-condensed > tbody > tr > td, .table-condensed > tfoot > tr > td { padding: 5px; } .table-bordered { border: 1px solid #dddddd; } .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td { border: 1px solid #dddddd; } .table-bordered > thead > tr > th, .table-bordered > thead > tr > td { border-bottom-width: 2px; } .table-striped > tbody > tr:nth-of-type(odd) { background-color: #f9f9f9; } .table-hover > tbody > tr:hover { background-color: #f5f5f5; } table col[class*="col-"] { position: static; float: none; display: table-column; } table td[class*="col-"], table th[class*="col-"] { position: static; float: none; display: table-cell; } .table > thead > tr > td.active, .table > tbody > tr > td.active, .table > tfoot > tr > td.active, .table > thead > tr > th.active, .table > tbody > tr > th.active, .table > tfoot > tr > th.active, .table > thead > tr.active > td, .table > tbody > tr.active > td, .table > tfoot > tr.active > td, .table > thead > tr.active > th, .table > tbody > tr.active > th, .table > tfoot > tr.active > th { background-color: #f5f5f5; } .table-hover > tbody > tr > td.active:hover, .table-hover > tbody > tr > th.active:hover, .table-hover > tbody > tr.active:hover > td, .table-hover > tbody > tr:hover > .active, .table-hover > tbody > tr.active:hover > th { background-color: #e8e8e8; } .table > thead > tr > td.success, .table > tbody > tr > td.success, .table > tfoot > tr > td.success, .table > thead > tr > th.success, .table > tbody > tr > th.success, .table > tfoot > tr > th.success, .table > thead > tr.success > td, .table > tbody > tr.success > td, .table > tfoot > tr.success > td, .table > thead > tr.success > th, .table > tbody > tr.success > th, .table > tfoot > tr.success > th { background-color: #dff0d8; } .table-hover > tbody > tr > td.success:hover, .table-hover > tbody > tr > th.success:hover, .table-hover > tbody > tr.success:hover > td, .table-hover > tbody > tr:hover > .success, .table-hover > tbody > tr.success:hover > th { background-color: #d0e9c6; } .table > thead > tr > td.info, .table > tbody > tr > td.info, .table > tfoot > tr > td.info, .table > thead > tr > th.info, .table > tbody > tr > th.info, .table > tfoot > tr > th.info, .table > thead > tr.info > td, .table > tbody > tr.info > td, .table > tfoot > tr.info > td, .table > thead > tr.info > th, .table > tbody > tr.info > th, .table > tfoot > tr.info > th { background-color: #d9edf7; } .table-hover > tbody > tr > td.info:hover, .table-hover > tbody > tr > th.info:hover, .table-hover > tbody > tr.info:hover > td, .table-hover > tbody > tr:hover > .info, .table-hover > tbody > tr.info:hover > th { background-color: #c4e3f3; } .table > thead > tr > td.warning, .table > tbody > tr > td.warning, .table > tfoot > tr > td.warning, .table > thead > tr > th.warning, .table > tbody > tr > th.warning, .table > tfoot > tr > th.warning, .table > thead > tr.warning > td, .table > tbody > tr.warning > td, .table > tfoot > tr.warning > td, .table > thead > tr.warning > th, .table > tbody > tr.warning > th, .table > tfoot > tr.warning > th { background-color: #fcf8e3; } .table-hover > tbody > tr > td.warning:hover, .table-hover > tbody > tr > th.warning:hover, .table-hover > tbody > tr.warning:hover > td, .table-hover > tbody > tr:hover > .warning, .table-hover > tbody > tr.warning:hover > th { background-color: #faf2cc; } .table > thead > tr > td.danger, .table > tbody > tr > td.danger, .table > tfoot > tr > td.danger, .table > thead > tr > th.danger, .table > tbody > tr > th.danger, .table > tfoot > tr > th.danger, .table > thead > tr.danger > td, .table > tbody > tr.danger > td, .table > tfoot > tr.danger > td, .table > thead > tr.danger > th, .table > tbody > tr.danger > th, .table > tfoot > tr.danger > th { background-color: #f2dede; } .table-hover > tbody > tr > td.danger:hover, .table-hover > tbody > tr > th.danger:hover, .table-hover > tbody > tr.danger:hover > td, .table-hover > tbody > tr:hover > .danger, .table-hover > tbody > tr.danger:hover > th { background-color: #ebcccc; } .table-responsive { overflow-x: auto; min-height: 0.01%; } @media screen and (max-width: 767px) { .table-responsive { width: 100%; margin-bottom: 15px; overflow-y: hidden; -ms-overflow-style: -ms-autohiding-scrollbar; border: 1px solid #dddddd; } .table-responsive > .table { margin-bottom: 0; } .table-responsive > .table > thead > tr > th, .table-responsive > .table > tbody > tr > th, .table-responsive > .table > tfoot > tr > th, .table-responsive > .table > thead > tr > td, .table-responsive > .table > tbody > tr > td, .table-responsive > .table > tfoot > tr > td { white-space: nowrap; } .table-responsive > .table-bordered { border: 0; } .table-responsive > .table-bordered > thead > tr > th:first-child, .table-responsive > .table-bordered > tbody > tr > th:first-child, .table-responsive > .table-bordered > tfoot > tr > th:first-child, .table-responsive > .table-bordered > thead > tr > td:first-child, .table-responsive > .table-bordered > tbody > tr > td:first-child, .table-responsive > .table-bordered > tfoot > tr > td:first-child { border-left: 0; } .table-responsive > .table-bordered > thead > tr > th:last-child, .table-responsive > .table-bordered > tbody > tr > th:last-child, .table-responsive > .table-bordered > tfoot > tr > th:last-child, .table-responsive > .table-bordered > thead > tr > td:last-child, .table-responsive > .table-bordered > tbody > tr > td:last-child, .table-responsive > .table-bordered > tfoot > tr > td:last-child { border-right: 0; } .table-responsive > .table-bordered > tbody > tr:last-child > th, .table-responsive > .table-bordered > tfoot > tr:last-child > th, .table-responsive > .table-bordered > tbody > tr:last-child > td, .table-responsive > .table-bordered > tfoot > tr:last-child > td { border-bottom: 0; } } fieldset { padding: 0; margin: 0; border: 0; min-width: 0; } legend { display: block; width: 100%; padding: 0; margin-bottom: 20px; font-size: 21px; line-height: inherit; color: #333333; border: 0; border-bottom: 1px solid #e5e5e5; } label { display: inline-block; max-width: 100%; margin-bottom: 5px; font-weight: bold; } input[type="search"] { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } input[type="radio"], input[type="checkbox"] { margin: 4px 0 0; margin-top: 1px \9; line-height: normal; } input[type="file"] { display: block; } input[type="range"] { display: block; width: 100%; } select[multiple], select[size] { height: auto; } input[type="file"]:focus, input[type="radio"]:focus, input[type="checkbox"]:focus { outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } output { display: block; padding-top: 7px; font-size: 14px; line-height: 1.42857143; color: #555555; } .form-control { display: block; width: 100%; height: 34px; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; color: #555555; background-color: #fefeff; background-image: none; border: 1px solid #d7e5f3; border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; } .form-control:focus { border-color: #66afe9; outline: 0; -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); } .form-control::-moz-placeholder { color: #999999; opacity: 1; } .form-control:-ms-input-placeholder { color: #999999; } .form-control::-webkit-input-placeholder { color: #999999; } .form-control::-ms-expand { border: 0; background-color: transparent; } .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { background-color: #eeeeee; opacity: 1; } .form-control[disabled], fieldset[disabled] .form-control { cursor: not-allowed; } textarea.form-control { height: auto; } input[type="search"] { -webkit-appearance: none; } @media screen and (-webkit-min-device-pixel-ratio: 0) { input[type="date"].form-control, input[type="time"].form-control, input[type="datetime-local"].form-control, input[type="month"].form-control { line-height: 34px; } input[type="date"].input-sm, input[type="time"].input-sm, input[type="datetime-local"].input-sm, input[type="month"].input-sm, .input-group-sm input[type="date"], .input-group-sm input[type="time"], .input-group-sm input[type="datetime-local"], .input-group-sm input[type="month"] { line-height: 30px; } input[type="date"].input-lg, input[type="time"].input-lg, input[type="datetime-local"].input-lg, input[type="month"].input-lg, .input-group-lg input[type="date"], .input-group-lg input[type="time"], .input-group-lg input[type="datetime-local"], .input-group-lg input[type="month"] { line-height: 46px; } } .form-group { margin-bottom: 15px; } .radio, .checkbox { position: relative; display: block; margin-top: 10px; margin-bottom: 10px; } .radio label, .checkbox label { min-height: 20px; padding-left: 20px; margin-bottom: 0; font-weight: normal; cursor: pointer; } .radio input[type="radio"], .radio-inline input[type="radio"], .checkbox input[type="checkbox"], .checkbox-inline input[type="checkbox"] { position: absolute; margin-left: -20px; margin-top: 4px \9; } .radio + .radio, .checkbox + .checkbox { margin-top: -5px; } .radio-inline, .checkbox-inline { position: relative; display: inline-block; padding-left: 20px; margin-bottom: 0; vertical-align: middle; font-weight: normal; cursor: pointer; } .radio-inline + .radio-inline, .checkbox-inline + .checkbox-inline { margin-top: 0; margin-left: 10px; } input[type="radio"][disabled], input[type="checkbox"][disabled], input[type="radio"].disabled, input[type="checkbox"].disabled, fieldset[disabled] input[type="radio"], fieldset[disabled] input[type="checkbox"] { cursor: not-allowed; } .radio-inline.disabled, .checkbox-inline.disabled, fieldset[disabled] .radio-inline, fieldset[disabled] .checkbox-inline { cursor: not-allowed; } .radio.disabled label, .checkbox.disabled label, fieldset[disabled] .radio label, fieldset[disabled] .checkbox label { cursor: not-allowed; } .form-control-static { padding-top: 7px; padding-bottom: 7px; margin-bottom: 0; min-height: 34px; } .form-control-static.input-lg, .form-control-static.input-sm { padding-left: 0; padding-right: 0; } .input-sm { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px; } select.input-sm { height: 30px; line-height: 30px; } textarea.input-sm, select[multiple].input-sm { height: auto; } .form-group-sm .form-control { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px; } .form-group-sm select.form-control { height: 30px; line-height: 30px; } .form-group-sm textarea.form-control, .form-group-sm select[multiple].form-control { height: auto; } .form-group-sm .form-control-static { height: 30px; min-height: 32px; padding: 6px 10px; font-size: 12px; line-height: 1.5; } .input-lg { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.33; border-radius: 6px; } select.input-lg { height: 46px; line-height: 46px; } textarea.input-lg, select[multiple].input-lg { height: auto; } .form-group-lg .form-control { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.33; border-radius: 6px; } .form-group-lg select.form-control { height: 46px; line-height: 46px; } .form-group-lg textarea.form-control, .form-group-lg select[multiple].form-control { height: auto; } .form-group-lg .form-control-static { height: 46px; min-height: 38px; padding: 11px 16px; font-size: 18px; line-height: 1.33; } .has-feedback { position: relative; } .has-feedback .form-control { padding-right: 42.5px; } .form-control-feedback { position: absolute; top: 0; right: 0; z-index: 2; display: block; width: 34px; height: 34px; line-height: 34px; text-align: center; pointer-events: none; } .input-lg + .form-control-feedback, .input-group-lg + .form-control-feedback, .form-group-lg .form-control + .form-control-feedback { width: 46px; height: 46px; line-height: 46px; } .input-sm + .form-control-feedback, .input-group-sm + .form-control-feedback, .form-group-sm .form-control + .form-control-feedback { width: 30px; height: 30px; line-height: 30px; } .has-success .help-block, .has-success .control-label, .has-success .radio, .has-success .checkbox, .has-success .radio-inline, .has-success .checkbox-inline, .has-success.radio label, .has-success.checkbox label, .has-success.radio-inline label, .has-success.checkbox-inline label { color: #3c763d; } .has-success .form-control { border-color: #3c763d; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } .has-success .form-control:focus { border-color: #2b542c; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; } .has-success .input-group-addon { color: #3c763d; border-color: #3c763d; background-color: #dff0d8; } .has-success .form-control-feedback { color: #3c763d; } .has-warning .help-block, .has-warning .control-label, .has-warning .radio, .has-warning .checkbox, .has-warning .radio-inline, .has-warning .checkbox-inline, .has-warning.radio label, .has-warning.checkbox label, .has-warning.radio-inline label, .has-warning.checkbox-inline label { color: #8a6d3b; } .has-warning .form-control { border-color: #8a6d3b; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } .has-warning .form-control:focus { border-color: #66512c; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; } .has-warning .input-group-addon { color: #8a6d3b; border-color: #8a6d3b; background-color: #fcf8e3; } .has-warning .form-control-feedback { color: #8a6d3b; } .has-error .help-block, .has-error .control-label, .has-error .radio, .has-error .checkbox, .has-error .radio-inline, .has-error .checkbox-inline, .has-error.radio label, .has-error.checkbox label, .has-error.radio-inline label, .has-error.checkbox-inline label { color: #a94442; } .has-error .form-control { border-color: #a94442; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } .has-error .form-control:focus { border-color: #843534; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; } .has-error .input-group-addon { color: #a94442; border-color: #a94442; background-color: #f2dede; } .has-error .form-control-feedback { color: #a94442; } .has-feedback label ~ .form-control-feedback { top: 25px; } .has-feedback label.sr-only ~ .form-control-feedback { top: 0; } .help-block { display: block; margin-top: 5px; margin-bottom: 10px; color: #737373; } @media (min-width: 768px) { .form-inline .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle; } .form-inline .form-control { display: inline-block; width: auto; vertical-align: middle; } .form-inline .form-control-static { display: inline-block; } .form-inline .input-group { display: inline-table; vertical-align: middle; } .form-inline .input-group .input-group-addon, .form-inline .input-group .input-group-btn, .form-inline .input-group .form-control { width: auto; } .form-inline .input-group > .form-control { width: 100%; } .form-inline .control-label { margin-bottom: 0; vertical-align: middle; } .form-inline .radio, .form-inline .checkbox { display: inline-block; margin-top: 0; margin-bottom: 0; vertical-align: middle; } .form-inline .radio label, .form-inline .checkbox label { padding-left: 0; } .form-inline .radio input[type="radio"], .form-inline .checkbox input[type="checkbox"] { position: relative; margin-left: 0; } .form-inline .has-feedback .form-control-feedback { top: 0; } } .form-horizontal .radio, .form-horizontal .checkbox, .form-horizontal .radio-inline, .form-horizontal .checkbox-inline { margin-top: 0; margin-bottom: 0; padding-top: 7px; } .form-horizontal .radio, .form-horizontal .checkbox { min-height: 27px; } .form-horizontal .form-group { margin-left: -15px; margin-right: -15px; } @media (min-width: 768px) { .form-horizontal .control-label { text-align: right; margin-bottom: 0; padding-top: 7px; } } .form-horizontal .has-feedback .form-control-feedback { right: 15px; } @media (min-width: 768px) { .form-horizontal .form-group-lg .control-label { padding-top: 11px; font-size: 18px; } } @media (min-width: 768px) { .form-horizontal .form-group-sm .control-label { padding-top: 6px; font-size: 12px; } } .btn { display: inline-block; margin-bottom: 0; font-weight: normal; text-align: center; vertical-align: middle; touch-action: manipulation; cursor: pointer; background-image: none; border: 1px solid transparent; white-space: nowrap; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; border-radius: 4px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .btn:focus, .btn:active:focus, .btn.active:focus, .btn.focus, .btn:active.focus, .btn.active.focus { outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } .btn:hover, .btn:focus, .btn.focus { color: #ffffff; text-decoration: none; } .btn:active, .btn.active { outline: 0; background-image: none; -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); } .btn.disabled, .btn[disabled], fieldset[disabled] .btn { cursor: not-allowed; opacity: 0.65; filter: alpha(opacity=65); -webkit-box-shadow: none; box-shadow: none; } a.btn.disabled, fieldset[disabled] a.btn { pointer-events: none; } .btn-default { color: #ffffff; background-color: #95a0be; border-color: #818181; } .btn-default:focus, .btn-default.focus { color: #ffffff; background-color: #7584ab; border-color: #414141; } .btn-default:hover { color: #ffffff; background-color: #7584ab; border-color: #626262; } .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { color: #ffffff; background-color: #7584ab; border-color: #626262; } .btn-default:active:hover, .btn-default.active:hover, .open > .dropdown-toggle.btn-default:hover, .btn-default:active:focus, .btn-default.active:focus, .open > .dropdown-toggle.btn-default:focus, .btn-default:active.focus, .btn-default.active.focus, .open > .dropdown-toggle.btn-default.focus { color: #ffffff; background-color: #60709c; border-color: #414141; } .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { background-image: none; } .btn-default.disabled:hover, .btn-default[disabled]:hover, fieldset[disabled] .btn-default:hover, .btn-default.disabled:focus, .btn-default[disabled]:focus, fieldset[disabled] .btn-default:focus, .btn-default.disabled.focus, .btn-default[disabled].focus, fieldset[disabled] .btn-default.focus { background-color: #95a0be; border-color: #818181; } .btn-default .badge { color: #95a0be; background-color: #ffffff; } .btn-primary { color: #ffffff; background-color: #95a0be; border-color: #8592b4; } .btn-primary:focus, .btn-primary.focus { color: #ffffff; background-color: #7584ab; border-color: #475373; } .btn-primary:hover { color: #ffffff; background-color: #7584ab; border-color: #60709c; } .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary { color: #ffffff; background-color: #7584ab; border-color: #60709c; } .btn-primary:active:hover, .btn-primary.active:hover, .open > .dropdown-toggle.btn-primary:hover, .btn-primary:active:focus, .btn-primary.active:focus, .open > .dropdown-toggle.btn-primary:focus, .btn-primary:active.focus, .btn-primary.active.focus, .open > .dropdown-toggle.btn-primary.focus { color: #ffffff; background-color: #60709c; border-color: #475373; } .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary { background-image: none; } .btn-primary.disabled:hover, .btn-primary[disabled]:hover, fieldset[disabled] .btn-primary:hover, .btn-primary.disabled:focus, .btn-primary[disabled]:focus, fieldset[disabled] .btn-primary:focus, .btn-primary.disabled.focus, .btn-primary[disabled].focus, fieldset[disabled] .btn-primary.focus { background-color: #95a0be; border-color: #8592b4; } .btn-primary .badge { color: #95a0be; background-color: #ffffff; } .btn-success { color: #2d672d; background-color: #5cb85c; border-color: #4cae4c; } .btn-success:focus, .btn-success.focus { color: #2d672d; background-color: #449d44; border-color: #255625; } .btn-success:hover { color: #2d672d; background-color: #449d44; border-color: #398439; } .btn-success:active, .btn-success.active, .open > .dropdown-toggle.btn-success { color: #2d672d; background-color: #449d44; border-color: #398439; } .btn-success:active:hover, .btn-success.active:hover, .open > .dropdown-toggle.btn-success:hover, .btn-success:active:focus, .btn-success.active:focus, .open > .dropdown-toggle.btn-success:focus, .btn-success:active.focus, .btn-success.active.focus, .open > .dropdown-toggle.btn-success.focus { color: #2d672d; background-color: #398439; border-color: #255625; } .btn-success:active, .btn-success.active, .open > .dropdown-toggle.btn-success { background-image: none; } .btn-success.disabled:hover, .btn-success[disabled]:hover, fieldset[disabled] .btn-success:hover, .btn-success.disabled:focus, .btn-success[disabled]:focus, fieldset[disabled] .btn-success:focus, .btn-success.disabled.focus, .btn-success[disabled].focus, fieldset[disabled] .btn-success.focus { background-color: #5cb85c; border-color: #4cae4c; } .btn-success .badge { color: #5cb85c; background-color: #2d672d; } .btn-info { color: #1f7e9a; background-color: #5bc0de; border-color: #46b8da; } .btn-info:focus, .btn-info.focus { color: #1f7e9a; background-color: #31b0d5; border-color: #1b6d85; } .btn-info:hover { color: #1f7e9a; background-color: #31b0d5; border-color: #269abc; } .btn-info:active, .btn-info.active, .open > .dropdown-toggle.btn-info { color: #1f7e9a; background-color: #31b0d5; border-color: #269abc; } .btn-info:active:hover, .btn-info.active:hover, .open > .dropdown-toggle.btn-info:hover, .btn-info:active:focus, .btn-info.active:focus, .open > .dropdown-toggle.btn-info:focus, .btn-info:active.focus, .btn-info.active.focus, .open > .dropdown-toggle.btn-info.focus { color: #1f7e9a; background-color: #269abc; border-color: #1b6d85; } .btn-info:active, .btn-info.active, .open > .dropdown-toggle.btn-info { background-image: none; } .btn-info.disabled:hover, .btn-info[disabled]:hover, fieldset[disabled] .btn-info:hover, .btn-info.disabled:focus, .btn-info[disabled]:focus, fieldset[disabled] .btn-info:focus, .btn-info.disabled.focus, .btn-info[disabled].focus, fieldset[disabled] .btn-info.focus { background-color: #5bc0de; border-color: #46b8da; } .btn-info .badge { color: #5bc0de; background-color: #1f7e9a; } .btn-warning { color: #b06d0f; background-color: #f0ad4e; border-color: #eea236; } .btn-warning:focus, .btn-warning.focus { color: #b06d0f; background-color: #ec971f; border-color: #985f0d; } .btn-warning:hover { color: #b06d0f; background-color: #ec971f; border-color: #d58512; } .btn-warning:active, .btn-warning.active, .open > .dropdown-toggle.btn-warning { color: #b06d0f; background-color: #ec971f; border-color: #d58512; } .btn-warning:active:hover, .btn-warning.active:hover, .open > .dropdown-toggle.btn-warning:hover, .btn-warning:active:focus, .btn-warning.active:focus, .open > .dropdown-toggle.btn-warning:focus, .btn-warning:active.focus, .btn-warning.active.focus, .open > .dropdown-toggle.btn-warning.focus { color: #b06d0f; background-color: #d58512; border-color: #985f0d; } .btn-warning:active, .btn-warning.active, .open > .dropdown-toggle.btn-warning { background-image: none; } .btn-warning.disabled:hover, .btn-warning[disabled]:hover, fieldset[disabled] .btn-warning:hover, .btn-warning.disabled:focus, .btn-warning[disabled]:focus, fieldset[disabled] .btn-warning:focus, .btn-warning.disabled.focus, .btn-warning[disabled].focus, fieldset[disabled] .btn-warning.focus { background-color: #f0ad4e; border-color: #eea236; } .btn-warning .badge { color: #f0ad4e; background-color: #b06d0f; } .btn-danger { color: #b52b27; background-color: #d9534f; border-color: #d43f3a; } .btn-danger:focus, .btn-danger.focus { color: #b52b27; background-color: #c9302c; border-color: #761c19; } .btn-danger:hover { color: #b52b27; background-color: #c9302c; border-color: #ac2925; } .btn-danger:active, .btn-danger.active, .open > .dropdown-toggle.btn-danger { color: #b52b27; background-color: #c9302c; border-color: #ac2925; } .btn-danger:active:hover, .btn-danger.active:hover, .open > .dropdown-toggle.btn-danger:hover, .btn-danger:active:focus, .btn-danger.active:focus, .open > .dropdown-toggle.btn-danger:focus, .btn-danger:active.focus, .btn-danger.active.focus, .open > .dropdown-toggle.btn-danger.focus { color: #b52b27; background-color: #ac2925; border-color: #761c19; } .btn-danger:active, .btn-danger.active, .open > .dropdown-toggle.btn-danger { background-image: none; } .btn-danger.disabled:hover, .btn-danger[disabled]:hover, fieldset[disabled] .btn-danger:hover, .btn-danger.disabled:focus, .btn-danger[disabled]:focus, fieldset[disabled] .btn-danger:focus, .btn-danger.disabled.focus, .btn-danger[disabled].focus, fieldset[disabled] .btn-danger.focus { background-color: #d9534f; border-color: #d43f3a; } .btn-danger .badge { color: #d9534f; background-color: #b52b27; } .btn-link { color: #613b8d; font-weight: normal; border-radius: 0; } .btn-link, .btn-link:active, .btn-link.active, .btn-link[disabled], fieldset[disabled] .btn-link { background-color: transparent; -webkit-box-shadow: none; box-shadow: none; } .btn-link, .btn-link:hover, .btn-link:focus, .btn-link:active { border-color: transparent; } .btn-link:hover, .btn-link:focus { color: #3c2457; text-decoration: underline; background-color: transparent; } .btn-link[disabled]:hover, fieldset[disabled] .btn-link:hover, .btn-link[disabled]:focus, fieldset[disabled] .btn-link:focus { color: #999999; text-decoration: none; } .btn-lg, .btn-group-lg > .btn { padding: 10px 16px; font-size: 18px; line-height: 1.33; border-radius: 6px; } .btn-sm, .btn-group-sm > .btn { padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px; } .btn-xs, .btn-group-xs > .btn { padding: 1px 5px; font-size: 12px; line-height: 1.5; border-radius: 3px; } .btn-block { display: block; width: 100%; } .btn-block + .btn-block { margin-top: 5px; } input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="button"].btn-block { width: 100%; } .fade { opacity: 0; -webkit-transition: opacity 0.15s linear; -o-transition: opacity 0.15s linear; transition: opacity 0.15s linear; } .fade.in { opacity: 1; } .collapse { display: none; } .collapse.in { display: block; } tr.collapse.in { display: table-row; } tbody.collapse.in { display: table-row-group; } .collapsing { position: relative; height: 0; overflow: hidden; -webkit-transition-property: height, visibility; transition-property: height, visibility; -webkit-transition-duration: 0.35s; transition-duration: 0.35s; -webkit-transition-timing-function: ease; transition-timing-function: ease; } .caret { display: inline-block; width: 0; height: 0; margin-left: 2px; vertical-align: middle; border-top: 4px dashed; border-top: 4px solid \9; border-right: 4px solid transparent; border-left: 4px solid transparent; } .dropup, .dropdown { position: relative; } .dropdown-toggle:focus { outline: 0; } .dropdown-menu { position: absolute; top: 100%; left: 0; z-index: 1000; display: none; float: left; min-width: 160px; padding: 5px 0; margin: 2px 0 0; list-style: none; font-size: 14px; text-align: left; background-color: #ebf2f9; border: 1px solid #c3d8ed; border: 1px solid #6a6a6a; border-radius: 4px; -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); background-clip: padding-box; } .dropdown-menu.pull-right { right: 0; left: auto; } .dropdown-menu .divider { height: 1px; margin: 9px 0; overflow: hidden; background-color: #ebf2f9; } .dropdown-menu > li > a { display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: 1.42857143; color: #333333; white-space: nowrap; } .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus { text-decoration: none; color: #262626; background-color: url('../images/flakesptn3.jpg') transparent; } .dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus { color: #ffffff; text-decoration: none; outline: 0; background-color: #d7e5f3; } .dropdown-menu > .disabled > a, .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus { color: #999999; } .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus { text-decoration: none; background-color: transparent; background-image: none; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); cursor: not-allowed; } .open > .dropdown-menu { display: block; } .open > a { outline: 0; } .dropdown-menu-right { left: auto; right: 0; } .dropdown-menu-left { left: 0; right: auto; } .dropdown-header { display: block; padding: 3px 20px; font-size: 12px; line-height: 1.42857143; color: #999999; white-space: nowrap; } .dropdown-backdrop { position: fixed; left: 0; right: 0; bottom: 0; top: 0; z-index: 990; } .pull-right > .dropdown-menu { right: 0; left: auto; } .dropup .caret, .navbar-fixed-bottom .dropdown .caret { border-top: 0; border-bottom: 4px dashed; border-bottom: 4px solid \9; content: ""; } .dropup .dropdown-menu, .navbar-fixed-bottom .dropdown .dropdown-menu { top: auto; bottom: 100%; margin-bottom: 2px; } @media (min-width: 768px) { .navbar-right .dropdown-menu { left: auto; right: 0; } .navbar-right .dropdown-menu-left { left: 0; right: auto; } } .btn-group, .btn-group-vertical { position: relative; display: inline-block; vertical-align: middle; } .btn-group > .btn, .btn-group-vertical > .btn { position: relative; float: left; } .btn-group > .btn:hover, .btn-group-vertical > .btn:hover, .btn-group > .btn:focus, .btn-group-vertical > .btn:focus, .btn-group > .btn:active, .btn-group-vertical > .btn:active, .btn-group > .btn.active, .btn-group-vertical > .btn.active { z-index: 2; } .btn-group .btn + .btn, .btn-group .btn + .btn-group, .btn-group .btn-group + .btn, .btn-group .btn-group + .btn-group { margin-left: -1px; } .btn-toolbar { margin-left: -5px; } .btn-toolbar .btn, .btn-toolbar .btn-group, .btn-toolbar .input-group { float: left; } .btn-toolbar > .btn, .btn-toolbar > .btn-group, .btn-toolbar > .input-group { margin-left: 5px; } .btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { border-radius: 0; } .btn-group > .btn:first-child { margin-left: 0; } .btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { border-bottom-right-radius: 0; border-top-right-radius: 0; } .btn-group > .btn:last-child:not(:first-child), .btn-group > .dropdown-toggle:not(:first-child) { border-bottom-left-radius: 0; border-top-left-radius: 0; } .btn-group > .btn-group { float: left; } .btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { border-radius: 0; } .btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child, .btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle { border-bottom-right-radius: 0; border-top-right-radius: 0; } .btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child { border-bottom-left-radius: 0; border-top-left-radius: 0; } .btn-group .dropdown-toggle:active, .btn-group.open .dropdown-toggle { outline: 0; } .btn-group > .btn + .dropdown-toggle { padding-left: 8px; padding-right: 8px; } .btn-group > .btn-lg + .dropdown-toggle { padding-left: 12px; padding-right: 12px; } .btn-group.open .dropdown-toggle { -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); } .btn-group.open .dropdown-toggle.btn-link { -webkit-box-shadow: none; box-shadow: none; } .btn .caret { margin-left: 0; } .btn-lg .caret { border-width: 5px 5px 0; border-bottom-width: 0; } .dropup .btn-lg .caret { border-width: 0 5px 5px; } .btn-group-vertical > .btn, .btn-group-vertical > .btn-group, .btn-group-vertical > .btn-group > .btn { display: block; float: none; width: 100%; max-width: 100%; } .btn-group-vertical > .btn-group > .btn { float: none; } .btn-group-vertical > .btn + .btn, .btn-group-vertical > .btn + .btn-group, .btn-group-vertical > .btn-group + .btn, .btn-group-vertical > .btn-group + .btn-group { margin-top: -1px; margin-left: 0; } .btn-group-vertical > .btn:not(:first-child):not(:last-child) { border-radius: 0; } .btn-group-vertical > .btn:first-child:not(:last-child) { border-top-right-radius: 4px; border-top-left-radius: 4px; border-bottom-right-radius: 0; border-bottom-left-radius: 0; } .btn-group-vertical > .btn:last-child:not(:first-child) { border-top-right-radius: 0; border-top-left-radius: 0; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; } .btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { border-radius: 0; } .btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child, .btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle { border-bottom-right-radius: 0; border-bottom-left-radius: 0; } .btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child { border-top-right-radius: 0; border-top-left-radius: 0; } .btn-group-justified { display: table; width: 100%; table-layout: fixed; border-collapse: separate; } .btn-group-justified > .btn, .btn-group-justified > .btn-group { float: none; display: table-cell; width: 1%; } .btn-group-justified > .btn-group .btn { width: 100%; } .btn-group-justified > .btn-group .dropdown-menu { left: auto; } [data-toggle="buttons"] > .btn input[type="radio"], [data-toggle="buttons"] > .btn-group > .btn input[type="radio"], [data-toggle="buttons"] > .btn input[type="checkbox"], [data-toggle="buttons"] > .btn-group > .btn input[type="checkbox"] { position: absolute; clip: rect(0, 0, 0, 0); pointer-events: none; } .input-group { position: relative; display: table; border-collapse: separate; } .input-group[class*="col-"] { float: none; padding-left: 0; padding-right: 0; } .input-group .form-control { position: relative; z-index: 2; float: left; width: 100%; margin-bottom: 0; } .input-group .form-control:focus { z-index: 3; } .input-group-lg > .form-control, .input-group-lg > .input-group-addon, .input-group-lg > .input-group-btn > .btn { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.33; border-radius: 6px; } select.input-group-lg > .form-control, select.input-group-lg > .input-group-addon, select.input-group-lg > .input-group-btn > .btn { height: 46px; line-height: 46px; } textarea.input-group-lg > .form-control, textarea.input-group-lg > .input-group-addon, textarea.input-group-lg > .input-group-btn > .btn, select[multiple].input-group-lg > .form-control, select[multiple].input-group-lg > .input-group-addon, select[multiple].input-group-lg > .input-group-btn > .btn { height: auto; } .input-group-sm > .form-control, .input-group-sm > .input-group-addon, .input-group-sm > .input-group-btn > .btn { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px; } select.input-group-sm > .form-control, select.input-group-sm > .input-group-addon, select.input-group-sm > .input-group-btn > .btn { height: 30px; line-height: 30px; } textarea.input-group-sm > .form-control, textarea.input-group-sm > .input-group-addon, textarea.input-group-sm > .input-group-btn > .btn, select[multiple].input-group-sm > .form-control, select[multiple].input-group-sm > .input-group-addon, select[multiple].input-group-sm > .input-group-btn > .btn { height: auto; } .input-group-addon, .input-group-btn, .input-group .form-control { display: table-cell; } .input-group-addon:not(:first-child):not(:last-child), .input-group-btn:not(:first-child):not(:last-child), .input-group .form-control:not(:first-child):not(:last-child) { border-radius: 0; } .input-group-addon, .input-group-btn { width: 1%; white-space: nowrap; vertical-align: middle; } .input-group-addon { padding: 6px 12px; font-size: 14px; font-weight: normal; line-height: 1; color: #555555; text-align: center; background-color: #eeeeee; border: 1px solid #d7e5f3; border-radius: 4px; } .input-group-addon.input-sm { padding: 5px 10px; font-size: 12px; border-radius: 3px; } .input-group-addon.input-lg { padding: 10px 16px; font-size: 18px; border-radius: 6px; } .input-group-addon input[type="radio"], .input-group-addon input[type="checkbox"] { margin-top: 0; } .input-group .form-control:first-child, .input-group-addon:first-child, .input-group-btn:first-child > .btn, .input-group-btn:first-child > .btn-group > .btn, .input-group-btn:first-child > .dropdown-toggle, .input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle), .input-group-btn:last-child > .btn-group:not(:last-child) > .btn { border-bottom-right-radius: 0; border-top-right-radius: 0; } .input-group-addon:first-child { border-right: 0; } .input-group .form-control:last-child, .input-group-addon:last-child, .input-group-btn:last-child > .btn, .input-group-btn:last-child > .btn-group > .btn, .input-group-btn:last-child > .dropdown-toggle, .input-group-btn:first-child > .btn:not(:first-child), .input-group-btn:first-child > .btn-group:not(:first-child) > .btn { border-bottom-left-radius: 0; border-top-left-radius: 0; } .input-group-addon:last-child { border-left: 0; } .input-group-btn { position: relative; font-size: 0; white-space: nowrap; } .input-group-btn > .btn { position: relative; } .input-group-btn > .btn + .btn { margin-left: -1px; } .input-group-btn > .btn:hover, .input-group-btn > .btn:focus, .input-group-btn > .btn:active { z-index: 2; } .input-group-btn:first-child > .btn, .input-group-btn:first-child > .btn-group { margin-right: -1px; } .input-group-btn:last-child > .btn, .input-group-btn:last-child > .btn-group { z-index: 2; margin-left: -1px; } .nav { margin-bottom: 0; padding-left: 0; list-style: none; } .nav > li { position: relative; display: block; } .nav > li > a { position: relative; display: block; padding: 10px 15px; } .nav > li > a:hover, .nav > li > a:focus { text-decoration: none; background-color: url('../images/flakesptn3.jpg'); } .nav > li.disabled > a { color: #999999; } .nav > li.disabled > a:hover, .nav > li.disabled > a:focus { color: #999999; text-decoration: none; background-color: transparent; cursor: not-allowed; } .nav .open > a, .nav .open > a:hover, .nav .open > a:focus { background-color: url('../images/flakesptn3.jpg'); border-color: #613b8d; } .nav .nav-divider { height: 1px; margin: 9px 0; overflow: hidden; background-color: #e5e5e5; } .nav > li > a > img { max-width: none; } .nav-tabs { border-bottom: 1px solid #818181; } .nav-tabs > li { float: left; margin-bottom: -1px; } .nav-tabs > li > a { margin-right: 2px; line-height: 1.42857143; border: 1px solid transparent; border-radius: 4px 4px 0 0; } .nav-tabs > li > a:hover { border-color: #9b9b9b #9b9b9b #818181; } .nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus { color: #555555; background-color: #fefeff; border: 1px solid #dddddd; border-bottom-color: transparent; cursor: default; } .nav-tabs.nav-justified { width: 100%; border-bottom: 0; } .nav-tabs.nav-justified > li { float: none; } .nav-tabs.nav-justified > li > a { text-align: center; margin-bottom: 5px; } .nav-tabs.nav-justified > .dropdown .dropdown-menu { top: auto; left: auto; } @media (min-width: 768px) { .nav-tabs.nav-justified > li { display: table-cell; width: 1%; } .nav-tabs.nav-justified > li > a { margin-bottom: 0; } } .nav-tabs.nav-justified > li > a { margin-right: 0; border-radius: 4px; } .nav-tabs.nav-justified > .active > a, .nav-tabs.nav-justified > .active > a:hover, .nav-tabs.nav-justified > .active > a:focus { border: 1px solid #dddddd; } @media (min-width: 768px) { .nav-tabs.nav-justified > li > a { border-bottom: 1px solid #dddddd; border-radius: 4px 4px 0 0; } .nav-tabs.nav-justified > .active > a, .nav-tabs.nav-justified > .active > a:hover, .nav-tabs.nav-justified > .active > a:focus { border-bottom-color: #fefeff; } } .nav-pills > li { float: left; } .nav-pills > li > a { border-radius: 4px; } .nav-pills > li + li { margin-left: 2px; } .nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { color: #ffffff; background-color: #d7e5f3; } .nav-stacked > li { float: none; } .nav-stacked > li + li { margin-top: 2px; margin-left: 0; } .nav-justified { width: 100%; } .nav-justified > li { float: none; } .nav-justified > li > a { text-align: center; margin-bottom: 5px; } .nav-justified > .dropdown .dropdown-menu { top: auto; left: auto; } @media (min-width: 768px) { .nav-justified > li { display: table-cell; width: 1%; } .nav-justified > li > a { margin-bottom: 0; } } .nav-tabs-justified { border-bottom: 0; } .nav-tabs-justified > li > a { margin-right: 0; border-radius: 4px; } .nav-tabs-justified > .active > a, .nav-tabs-justified > .active > a:hover, .nav-tabs-justified > .active > a:focus { border: 1px solid #dddddd; } @media (min-width: 768px) { .nav-tabs-justified > li > a { border-bottom: 1px solid #dddddd; border-radius: 4px 4px 0 0; } .nav-tabs-justified > .active > a, .nav-tabs-justified > .active > a:hover, .nav-tabs-justified > .active > a:focus { border-bottom-color: #fefeff; } } .tab-content > .tab-pane { display: none; } .tab-content > .active { display: block; } .nav-tabs .dropdown-menu { margin-top: -1px; border-top-right-radius: 0; border-top-left-radius: 0; } .navbar { position: relative; min-height: 35px; margin-bottom: 20px; border: 1px solid transparent; } @media (min-width: 768px) { .navbar { border-radius: 4px; } } @media (min-width: 768px) { .navbar-header { float: left; } } .navbar-collapse { overflow-x: visible; padding-right: 15px; padding-left: 15px; border-top: 1px solid transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1); -webkit-overflow-scrolling: touch; } .navbar-collapse.in { overflow-y: auto; } @media (min-width: 768px) { .navbar-collapse { width: auto; border-top: 0; box-shadow: none; } .navbar-collapse.collapse { display: block !important; height: auto !important; padding-bottom: 0; overflow: visible !important; } .navbar-collapse.in { overflow-y: visible; } .navbar-fixed-top .navbar-collapse, .navbar-static-top .navbar-collapse, .navbar-fixed-bottom .navbar-collapse { padding-left: 0; padding-right: 0; } } .navbar-fixed-top .navbar-collapse, .navbar-fixed-bottom .navbar-collapse { max-height: 340px; } @media (max-device-width: 480px) and (orientation: landscape) { .navbar-fixed-top .navbar-collapse, .navbar-fixed-bottom .navbar-collapse { max-height: 200px; } } .container > .navbar-header, .container-fluid > .navbar-header, .container > .navbar-collapse, .container-fluid > .navbar-collapse { margin-right: -15px; margin-left: -15px; } @media (min-width: 768px) { .container > .navbar-header, .container-fluid > .navbar-header, .container > .navbar-collapse, .container-fluid > .navbar-collapse { margin-right: 0; margin-left: 0; } } .navbar-static-top { z-index: 1000; border-width: 0 0 1px; } @media (min-width: 768px) { .navbar-static-top { border-radius: 0; } } .navbar-fixed-top, .navbar-fixed-bottom { position: fixed; right: 0; left: 0; z-index: 1030; } @media (min-width: 768px) { .navbar-fixed-top, .navbar-fixed-bottom { border-radius: 0; } } .navbar-fixed-top { top: 0; border-width: 0 0 1px; } .navbar-fixed-bottom { bottom: 0; margin-bottom: 0; border-width: 1px 0 0; } .navbar-brand { float: left; padding: 7.5px 15px; font-size: 18px; line-height: 20px; height: 35px; } .navbar-brand:hover, .navbar-brand:focus { text-decoration: none; } .navbar-brand > img { display: block; } @media (min-width: 768px) { .navbar > .container .navbar-brand, .navbar > .container-fluid .navbar-brand { margin-left: -15px; } } .navbar-toggle { position: relative; float: right; margin-right: 15px; padding: 9px 10px; margin-top: 0.5px; margin-bottom: 0.5px; background-color: transparent; background-image: none; border: 1px solid transparent; border-radius: 4px; } .navbar-toggle:focus { outline: 0; } .navbar-toggle .icon-bar { display: block; width: 22px; height: 2px; border-radius: 1px; } .navbar-toggle .icon-bar + .icon-bar { margin-top: 4px; } @media (min-width: 768px) { .navbar-toggle { display: none; } } .navbar-nav { margin: 3.75px -15px; } .navbar-nav > li > a { padding-top: 10px; padding-bottom: 10px; line-height: 20px; } @media (max-width: 767px) { .navbar-nav .open .dropdown-menu { position: static; float: none; width: auto; margin-top: 0; background-color: transparent; border: 0; box-shadow: none; } .navbar-nav .open .dropdown-menu > li > a, .navbar-nav .open .dropdown-menu .dropdown-header { padding: 5px 15px 5px 25px; } .navbar-nav .open .dropdown-menu > li > a { line-height: 20px; } .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-nav .open .dropdown-menu > li > a:focus { background-image: none; } } @media (min-width: 768px) { .navbar-nav { float: left; margin: 0; } .navbar-nav > li { float: left; } .navbar-nav > li > a { padding-top: 7.5px; padding-bottom: 7.5px; } } .navbar-form { margin-left: -15px; margin-right: -15px; padding: 10px 15px; border-top: 1px solid transparent; border-bottom: 1px solid transparent; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); margin-top: 0.5px; margin-bottom: 0.5px; } @media (min-width: 768px) { .navbar-form .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle; } .navbar-form .form-control { display: inline-block; width: auto; vertical-align: middle; } .navbar-form .form-control-static { display: inline-block; } .navbar-form .input-group { display: inline-table; vertical-align: middle; } .navbar-form .input-group .input-group-addon, .navbar-form .input-group .input-group-btn, .navbar-form .input-group .form-control { width: auto; } .navbar-form .input-group > .form-control { width: 100%; } .navbar-form .control-label { margin-bottom: 0; vertical-align: middle; } .navbar-form .radio, .navbar-form .checkbox { display: inline-block; margin-top: 0; margin-bottom: 0; vertical-align: middle; } .navbar-form .radio label, .navbar-form .checkbox label { padding-left: 0; } .navbar-form .radio input[type="radio"], .navbar-form .checkbox input[type="checkbox"] { position: relative; margin-left: 0; } .navbar-form .has-feedback .form-control-feedback { top: 0; } } @media (max-width: 767px) { .navbar-form .form-group { margin-bottom: 5px; } .navbar-form .form-group:last-child { margin-bottom: 0; } } @media (min-width: 768px) { .navbar-form { width: auto; border: 0; margin-left: 0; margin-right: 0; padding-top: 0; padding-bottom: 0; -webkit-box-shadow: none; box-shadow: none; } } .navbar-nav > li > .dropdown-menu { margin-top: 0; border-top-right-radius: 0; border-top-left-radius: 0; } .navbar-fixed-bottom .navbar-nav > li > .dropdown-menu { margin-bottom: 0; border-top-right-radius: 4px; border-top-left-radius: 4px; border-bottom-right-radius: 0; border-bottom-left-radius: 0; } .navbar-btn { margin-top: 0.5px; margin-bottom: 0.5px; } .navbar-btn.btn-sm { margin-top: 2.5px; margin-bottom: 2.5px; } .navbar-btn.btn-xs { margin-top: 6.5px; margin-bottom: 6.5px; } .navbar-text { margin-top: 7.5px; margin-bottom: 7.5px; } @media (min-width: 768px) { .navbar-text { float: left; margin-left: 15px; margin-right: 15px; } } @media (min-width: 768px) { .navbar-left { float: left !important; } .navbar-right { float: right !important; margin-right: -15px; } .navbar-right ~ .navbar-right { margin-right: 0; } } .navbar-default { background-color: #f8f8f8; border-color: #e7e7e7; } .navbar-default .navbar-brand { color: #393e51; } .navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus { color: #242733; background-color: transparent; } .navbar-default .navbar-text { color: #777777; } .navbar-default .navbar-nav > li > a { color: #393e51; } .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus { color: #6c7b8c; background-color: url('../images/flakesptn3.jpg'); } .navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus { color: #555555; background-color: transparent; } .navbar-default .navbar-nav > .disabled > a, .navbar-default .navbar-nav > .disabled > a:hover, .navbar-default .navbar-nav > .disabled > a:focus { color: #cccccc; background-color: transparent; } .navbar-default .navbar-toggle { border-color: #dddddd; } .navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus { background-color: #dddddd; } .navbar-default .navbar-toggle .icon-bar { background-color: #888888; } .navbar-default .navbar-collapse, .navbar-default .navbar-form { border-color: #e7e7e7; } .navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus { background-color: transparent; color: #555555; } @media (max-width: 767px) { .navbar-default .navbar-nav .open .dropdown-menu > li > a { color: #393e51; } .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus { color: #6c7b8c; background-color: url('../images/flakesptn3.jpg'); } .navbar-default .navbar-nav .open .dropdown-menu > .active > a, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus { color: #555555; background-color: transparent; } .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a, .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus { color: #cccccc; background-color: transparent; } } .navbar-default .navbar-link { color: #393e51; } .navbar-default .navbar-link:hover { color: #6c7b8c; } .navbar-default .btn-link { color: #393e51; } .navbar-default .btn-link:hover, .navbar-default .btn-link:focus { color: #6c7b8c; } .navbar-default .btn-link[disabled]:hover, fieldset[disabled] .navbar-default .btn-link:hover, .navbar-default .btn-link[disabled]:focus, fieldset[disabled] .navbar-default .btn-link:focus { color: #cccccc; } .navbar-inverse { background-color: #234c75; border-color: #17324e; } .navbar-inverse .navbar-brand { color: #eeeeee; } .navbar-inverse .navbar-brand:hover, .navbar-inverse .navbar-brand:focus { color: #ffffff; background-color: transparent; } .navbar-inverse .navbar-text { color: #999999; } .navbar-inverse .navbar-nav > li > a { color: #eeeeee; } .navbar-inverse .navbar-nav > li > a:hover, .navbar-inverse .navbar-nav > li > a:focus { color: #ffffff; background-color: transparent; } .navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:hover, .navbar-inverse .navbar-nav > .active > a:focus { color: #ffffff; background-color: #17324e; } .navbar-inverse .navbar-nav > .disabled > a, .navbar-inverse .navbar-nav > .disabled > a:hover, .navbar-inverse .navbar-nav > .disabled > a:focus { color: #eeeeee; background-color: transparent; } .navbar-inverse .navbar-toggle { border-color: #333333; } .navbar-inverse .navbar-toggle:hover, .navbar-inverse .navbar-toggle:focus { background-color: #333333; } .navbar-inverse .navbar-toggle .icon-bar { background-color: #ffffff; } .navbar-inverse .navbar-collapse, .navbar-inverse .navbar-form { border-color: #1b3a59; } .navbar-inverse .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .open > a:hover, .navbar-inverse .navbar-nav > .open > a:focus { background-color: #17324e; color: #ffffff; } @media (max-width: 767px) { .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header { border-color: #17324e; } .navbar-inverse .navbar-nav .open .dropdown-menu .divider { background-color: #17324e; } .navbar-inverse .navbar-nav .open .dropdown-menu > li > a { color: #eeeeee; } .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus { color: #ffffff; background-color: transparent; } .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a, .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus { color: #ffffff; background-color: #17324e; } .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a, .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus { color: #eeeeee; background-color: transparent; } } .navbar-inverse .navbar-link { color: #eeeeee; } .navbar-inverse .navbar-link:hover { color: #ffffff; } .navbar-inverse .btn-link { color: #eeeeee; } .navbar-inverse .btn-link:hover, .navbar-inverse .btn-link:focus { color: #ffffff; } .navbar-inverse .btn-link[disabled]:hover, fieldset[disabled] .navbar-inverse .btn-link:hover, .navbar-inverse .btn-link[disabled]:focus, fieldset[disabled] .navbar-inverse .btn-link:focus { color: #eeeeee; } .breadcrumb { padding: 8px 15px; margin-bottom: 20px; list-style: none; background-color: #f5f5f5; border-radius: 4px; } .breadcrumb > li { display: inline-block; } .breadcrumb > li + li:before { content: "/\00a0"; padding: 0 5px; color: #cccccc; } .breadcrumb > .active { color: #999999; } .pagination { display: inline-block; padding-left: 0; margin: 20px 0; border-radius: 4px; } .pagination > li { display: inline; } .pagination > li > a, .pagination > li > span { position: relative; float: left; padding: 6px 12px; line-height: 1.42857143; text-decoration: none; color: #613b8d; background-color: #ffffff; border: 1px solid #dddddd; margin-left: -1px; } .pagination > li:first-child > a, .pagination > li:first-child > span { margin-left: 0; border-bottom-left-radius: 4px; border-top-left-radius: 4px; } .pagination > li:last-child > a, .pagination > li:last-child > span { border-bottom-right-radius: 4px; border-top-right-radius: 4px; } .pagination > li > a:hover, .pagination > li > span:hover, .pagination > li > a:focus, .pagination > li > span:focus { z-index: 2; color: #3c2457; background-color: #eeeeee; border-color: #dddddd; } .pagination > .active > a, .pagination > .active > span, .pagination > .active > a:hover, .pagination > .active > span:hover, .pagination > .active > a:focus, .pagination > .active > span:focus { z-index: 3; color: #ffffff; background-color: #95a0be; border-color: #95a0be; cursor: default; } .pagination > .disabled > span, .pagination > .disabled > span:hover, .pagination > .disabled > span:focus, .pagination > .disabled > a, .pagination > .disabled > a:hover, .pagination > .disabled > a:focus { color: #999999; background-color: #ffffff; border-color: #dddddd; cursor: not-allowed; } .pagination-lg > li > a, .pagination-lg > li > span { padding: 10px 16px; font-size: 18px; line-height: 1.33; } .pagination-lg > li:first-child > a, .pagination-lg > li:first-child > span { border-bottom-left-radius: 6px; border-top-left-radius: 6px; } .pagination-lg > li:last-child > a, .pagination-lg > li:last-child > span { border-bottom-right-radius: 6px; border-top-right-radius: 6px; } .pagination-sm > li > a, .pagination-sm > li > span { padding: 5px 10px; font-size: 12px; line-height: 1.5; } .pagination-sm > li:first-child > a, .pagination-sm > li:first-child > span { border-bottom-left-radius: 3px; border-top-left-radius: 3px; } .pagination-sm > li:last-child > a, .pagination-sm > li:last-child > span { border-bottom-right-radius: 3px; border-top-right-radius: 3px; } .pager { padding-left: 0; margin: 20px 0; list-style: none; text-align: center; } .pager li { display: inline; } .pager li > a, .pager li > span { display: inline-block; padding: 5px 14px; background-color: #ffffff; border: 1px solid #dddddd; border-radius: 15px; } .pager li > a:hover, .pager li > a:focus { text-decoration: none; background-color: #eeeeee; } .pager .next > a, .pager .next > span { float: right; } .pager .previous > a, .pager .previous > span { float: left; } .pager .disabled > a, .pager .disabled > a:hover, .pager .disabled > a:focus, .pager .disabled > span { color: #999999; background-color: #ffffff; cursor: not-allowed; } .label { display: inline; padding: .2em .6em .3em; font-size: 75%; font-weight: bold; line-height: 1; color: #ffffff; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: .25em; } a.label:hover, a.label:focus { color: #ffffff; text-decoration: none; cursor: pointer; } .label:empty { display: none; } .btn .label { position: relative; top: -1px; } .label-default { background-color: #999999; } .label-default[href]:hover, .label-default[href]:focus { background-color: #808080; } .label-primary { background-color: #95a0be; } .label-primary[href]:hover, .label-primary[href]:focus { background-color: #7584ab; } .label-success { background-color: #5cb85c; } .label-success[href]:hover, .label-success[href]:focus { background-color: #449d44; } .label-info { background-color: #5bc0de; } .label-info[href]:hover, .label-info[href]:focus { background-color: #31b0d5; } .label-warning { background-color: #f0ad4e; } .label-warning[href]:hover, .label-warning[href]:focus { background-color: #ec971f; } .label-danger { background-color: #d9534f; } .label-danger[href]:hover, .label-danger[href]:focus { background-color: #c9302c; } .badge { display: inline-block; min-width: 10px; padding: 3px 7px; font-size: 12px; font-weight: bold; color: #ffffff; line-height: 1; vertical-align: middle; white-space: nowrap; text-align: center; background-color: #999999; border-radius: 10px; } .badge:empty { display: none; } .btn .badge { position: relative; top: -1px; } .btn-xs .badge, .btn-group-xs > .btn .badge { top: 0; padding: 1px 5px; } a.badge:hover, a.badge:focus { color: #ffffff; text-decoration: none; cursor: pointer; } .list-group-item.active > .badge, .nav-pills > .active > a > .badge { color: #613b8d; background-color: #ffffff; } .list-group-item > .badge { float: right; } .list-group-item > .badge + .badge { margin-right: 5px; } .nav-pills > li > a > .badge { margin-left: 3px; } .jumbotron { padding-top: 30px; padding-bottom: 30px; margin-bottom: 30px; color: inherit; background-color: #adc6eb; } .jumbotron h1, .jumbotron .h1 { color: inherit; } .jumbotron p { margin-bottom: 15px; font-size: 21px; font-weight: 200; } .jumbotron > hr { border-top-color: #84aae1; } .container .jumbotron, .container-fluid .jumbotron { border-radius: 6px; padding-left: 15px; padding-right: 15px; } .jumbotron .container { max-width: 100%; } @media screen and (min-width: 768px) { .jumbotron { padding-top: 48px; padding-bottom: 48px; } .container .jumbotron, .container-fluid .jumbotron { padding-left: 60px; padding-right: 60px; } .jumbotron h1, .jumbotron .h1 { font-size: 63px; } } .thumbnail { display: block; padding: 4px; margin-bottom: 20px; line-height: 1.42857143; background-color: #fefeff; border: 1px solid #dddddd; border-radius: 4px; -webkit-transition: border 0.2s ease-in-out; -o-transition: border 0.2s ease-in-out; transition: border 0.2s ease-in-out; } .thumbnail > img, .thumbnail a > img { margin-left: auto; margin-right: auto; } a.thumbnail:hover, a.thumbnail:focus, a.thumbnail.active { border-color: #613b8d; } .thumbnail .caption { padding: 9px; color: #333333; } .alert { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; } .alert h4 { margin-top: 0; color: inherit; } .alert .alert-link { font-weight: bold; } .alert > p, .alert > ul { margin-bottom: 0; } .alert > p + p { margin-top: 5px; } .alert-dismissable, .alert-dismissible { padding-right: 35px; } .alert-dismissable .close, .alert-dismissible .close { position: relative; top: -2px; right: -21px; color: inherit; } .alert-success { background-color: #dff0d8; border-color: #d6e9c6; color: #3c763d; } .alert-success hr { border-top-color: #c9e2b3; } .alert-success .alert-link { color: #2b542c; } .alert-info { background-color: #d9edf7; border-color: #bce8f1; color: #31708f; } .alert-info hr { border-top-color: #a6e1ec; } .alert-info .alert-link { color: #245269; } .alert-warning { background-color: #fcf8e3; border-color: #faebcc; color: #8a6d3b; } .alert-warning hr { border-top-color: #f7e1b5; } .alert-warning .alert-link { color: #66512c; } .alert-danger { background-color: #f2dede; border-color: #ebccd1; color: #a94442; } .alert-danger hr { border-top-color: #e4b9c0; } .alert-danger .alert-link { color: #843534; } @-webkit-keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } @keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } .progress { overflow: hidden; height: 20px; margin-bottom: 20px; background-color: #f5f5f5; border-radius: 4px; -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); } .progress-bar { float: left; width: 0%; height: 100%; font-size: 12px; line-height: 20px; color: #ffffff; text-align: center; background-color: #95a0be; -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); -webkit-transition: width 0.6s ease; -o-transition: width 0.6s ease; transition: width 0.6s ease; } .progress-striped .progress-bar, .progress-bar-striped { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-size: 40px 40px; } .progress.active .progress-bar, .progress-bar.active { -webkit-animation: progress-bar-stripes 2s linear infinite; -o-animation: progress-bar-stripes 2s linear infinite; animation: progress-bar-stripes 2s linear infinite; } .progress-bar-success { background-color: #5cb85c; } .progress-striped .progress-bar-success { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .progress-bar-info { background-color: #5bc0de; } .progress-striped .progress-bar-info { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .progress-bar-warning { background-color: #f0ad4e; } .progress-striped .progress-bar-warning { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .progress-bar-danger { background-color: #d9534f; } .progress-striped .progress-bar-danger { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .media { margin-top: 15px; } .media:first-child { margin-top: 0; } .media, .media-body { zoom: 1; overflow: hidden; } .media-body { width: 10000px; } .media-object { display: block; } .media-object.img-thumbnail { max-width: none; } .media-right, .media > .pull-right { padding-left: 10px; } .media-left, .media > .pull-left { padding-right: 10px; } .media-left, .media-right, .media-body { display: table-cell; vertical-align: top; } .media-middle { vertical-align: middle; } .media-bottom { vertical-align: bottom; } .media-heading { margin-top: 0; margin-bottom: 5px; } .media-list { padding-left: 0; list-style: none; } .list-group { margin-bottom: 20px; padding-left: 0; } .list-group-item { position: relative; display: block; padding: 10px 15px; margin-bottom: -1px; background-color: #ffffff; border: 1px solid #dddddd; } .list-group-item:first-child { border-top-right-radius: 4px; border-top-left-radius: 4px; } .list-group-item:last-child { margin-bottom: 0; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; } a.list-group-item, button.list-group-item { color: #555555; } a.list-group-item .list-group-item-heading, button.list-group-item .list-group-item-heading { color: #333333; } a.list-group-item:hover, button.list-group-item:hover, a.list-group-item:focus, button.list-group-item:focus { text-decoration: none; color: #555555; background-color: #f5f5f5; } button.list-group-item { width: 100%; text-align: left; } .list-group-item.disabled, .list-group-item.disabled:hover, .list-group-item.disabled:focus { background-color: #eeeeee; color: #999999; cursor: not-allowed; } .list-group-item.disabled .list-group-item-heading, .list-group-item.disabled:hover .list-group-item-heading, .list-group-item.disabled:focus .list-group-item-heading { color: inherit; } .list-group-item.disabled .list-group-item-text, .list-group-item.disabled:hover .list-group-item-text, .list-group-item.disabled:focus .list-group-item-text { color: #999999; } .list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus { z-index: 2; color: #ffffff; background-color: #d7e5f3; border-color: #d7e5f3; } .list-group-item.active .list-group-item-heading, .list-group-item.active:hover .list-group-item-heading, .list-group-item.active:focus .list-group-item-heading, .list-group-item.active .list-group-item-heading > small, .list-group-item.active:hover .list-group-item-heading > small, .list-group-item.active:focus .list-group-item-heading > small, .list-group-item.active .list-group-item-heading > .small, .list-group-item.active:hover .list-group-item-heading > .small, .list-group-item.active:focus .list-group-item-heading > .small { color: inherit; } .list-group-item.active .list-group-item-text, .list-group-item.active:hover .list-group-item-text, .list-group-item.active:focus .list-group-item-text { color: #ffffff; } .list-group-item-success { color: #3c763d; background-color: #dff0d8; } a.list-group-item-success, button.list-group-item-success { color: #3c763d; } a.list-group-item-success .list-group-item-heading, button.list-group-item-success .list-group-item-heading { color: inherit; } a.list-group-item-success:hover, button.list-group-item-success:hover, a.list-group-item-success:focus, button.list-group-item-success:focus { color: #3c763d; background-color: #d0e9c6; } a.list-group-item-success.active, button.list-group-item-success.active, a.list-group-item-success.active:hover, button.list-group-item-success.active:hover, a.list-group-item-success.active:focus, button.list-group-item-success.active:focus { color: #fff; background-color: #3c763d; border-color: #3c763d; } .list-group-item-info { color: #31708f; background-color: #d9edf7; } a.list-group-item-info, button.list-group-item-info { color: #31708f; } a.list-group-item-info .list-group-item-heading, button.list-group-item-info .list-group-item-heading { color: inherit; } a.list-group-item-info:hover, button.list-group-item-info:hover, a.list-group-item-info:focus, button.list-group-item-info:focus { color: #31708f; background-color: #c4e3f3; } a.list-group-item-info.active, button.list-group-item-info.active, a.list-group-item-info.active:hover, button.list-group-item-info.active:hover, a.list-group-item-info.active:focus, button.list-group-item-info.active:focus { color: #fff; background-color: #31708f; border-color: #31708f; } .list-group-item-warning { color: #8a6d3b; background-color: #fcf8e3; } a.list-group-item-warning, button.list-group-item-warning { color: #8a6d3b; } a.list-group-item-warning .list-group-item-heading, button.list-group-item-warning .list-group-item-heading { color: inherit; } a.list-group-item-warning:hover, button.list-group-item-warning:hover, a.list-group-item-warning:focus, button.list-group-item-warning:focus { color: #8a6d3b; background-color: #faf2cc; } a.list-group-item-warning.active, button.list-group-item-warning.active, a.list-group-item-warning.active:hover, button.list-group-item-warning.active:hover, a.list-group-item-warning.active:focus, button.list-group-item-warning.active:focus { color: #fff; background-color: #8a6d3b; border-color: #8a6d3b; } .list-group-item-danger { color: #a94442; background-color: #f2dede; } a.list-group-item-danger, button.list-group-item-danger { color: #a94442; } a.list-group-item-danger .list-group-item-heading, button.list-group-item-danger .list-group-item-heading { color: inherit; } a.list-group-item-danger:hover, button.list-group-item-danger:hover, a.list-group-item-danger:focus, button.list-group-item-danger:focus { color: #a94442; background-color: #ebcccc; } a.list-group-item-danger.active, button.list-group-item-danger.active, a.list-group-item-danger.active:hover, button.list-group-item-danger.active:hover, a.list-group-item-danger.active:focus, button.list-group-item-danger.active:focus { color: #fff; background-color: #a94442; border-color: #a94442; } .list-group-item-heading { margin-top: 0; margin-bottom: 5px; } .list-group-item-text { margin-bottom: 0; line-height: 1.3; } .panel { margin-bottom: 20px; background-color: #ffffff; border: 1px solid transparent; border-radius: 4px; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); } .panel-body { padding: 15px 28px; } .panel-heading { padding: 10px 15px; border-bottom: 1px solid transparent; border-top-right-radius: 3px; border-top-left-radius: 3px; } .panel-heading > .dropdown .dropdown-toggle { color: inherit; } .panel-title { margin-top: 0; margin-bottom: 0; font-size: 16px; color: inherit; } .panel-title > a, .panel-title > small, .panel-title > .small, .panel-title > small > a, .panel-title > .small > a { color: inherit; } .panel-footer { padding: 10px 15px; background-color: #f5f5f5; border-top: 1px solid #c3d8ed; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } .panel > .list-group, .panel > .panel-collapse > .list-group { margin-bottom: 0; } .panel > .list-group .list-group-item, .panel > .panel-collapse > .list-group .list-group-item { border-width: 1px 0; border-radius: 0; } .panel > .list-group:first-child .list-group-item:first-child, .panel > .panel-collapse > .list-group:first-child .list-group-item:first-child { border-top: 0; border-top-right-radius: 3px; border-top-left-radius: 3px; } .panel > .list-group:last-child .list-group-item:last-child, .panel > .panel-collapse > .list-group:last-child .list-group-item:last-child { border-bottom: 0; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } .panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child { border-top-right-radius: 0; border-top-left-radius: 0; } .panel-heading + .list-group .list-group-item:first-child { border-top-width: 0; } .list-group + .panel-footer { border-top-width: 0; } .panel > .table, .panel > .table-responsive > .table, .panel > .panel-collapse > .table { margin-bottom: 0; } .panel > .table caption, .panel > .table-responsive > .table caption, .panel > .panel-collapse > .table caption { padding-left: 15px 28px; padding-right: 15px 28px; } .panel > .table:first-child, .panel > .table-responsive:first-child > .table:first-child { border-top-right-radius: 3px; border-top-left-radius: 3px; } .panel > .table:first-child > thead:first-child > tr:first-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child, .panel > .table:first-child > tbody:first-child > tr:first-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child { border-top-left-radius: 3px; border-top-right-radius: 3px; } .panel > .table:first-child > thead:first-child > tr:first-child td:first-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child, .panel > .table:first-child > tbody:first-child > tr:first-child td:first-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child, .panel > .table:first-child > thead:first-child > tr:first-child th:first-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child, .panel > .table:first-child > tbody:first-child > tr:first-child th:first-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child { border-top-left-radius: 3px; } .panel > .table:first-child > thead:first-child > tr:first-child td:last-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child, .panel > .table:first-child > tbody:first-child > tr:first-child td:last-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child, .panel > .table:first-child > thead:first-child > tr:first-child th:last-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child, .panel > .table:first-child > tbody:first-child > tr:first-child th:last-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child { border-top-right-radius: 3px; } .panel > .table:last-child, .panel > .table-responsive:last-child > .table:last-child { border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } .panel > .table:last-child > tbody:last-child > tr:last-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child, .panel > .table:last-child > tfoot:last-child > tr:last-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child { border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; } .panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child, .panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child, .panel > .table:last-child > tbody:last-child > tr:last-child th:first-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child, .panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child { border-bottom-left-radius: 3px; } .panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child, .panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child, .panel > .table:last-child > tbody:last-child > tr:last-child th:last-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child, .panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child { border-bottom-right-radius: 3px; } .panel > .panel-body + .table, .panel > .panel-body + .table-responsive, .panel > .table + .panel-body, .panel > .table-responsive + .panel-body { border-top: 1px solid #dddddd; } .panel > .table > tbody:first-child > tr:first-child th, .panel > .table > tbody:first-child > tr:first-child td { border-top: 0; } .panel > .table-bordered, .panel > .table-responsive > .table-bordered { border: 0; } .panel > .table-bordered > thead > tr > th:first-child, .panel > .table-responsive > .table-bordered > thead > tr > th:first-child, .panel > .table-bordered > tbody > tr > th:first-child, .panel > .table-responsive > .table-bordered > tbody > tr > th:first-child, .panel > .table-bordered > tfoot > tr > th:first-child, .panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child, .panel > .table-bordered > thead > tr > td:first-child, .panel > .table-responsive > .table-bordered > thead > tr > td:first-child, .panel > .table-bordered > tbody > tr > td:first-child, .panel > .table-responsive > .table-bordered > tbody > tr > td:first-child, .panel > .table-bordered > tfoot > tr > td:first-child, .panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child { border-left: 0; } .panel > .table-bordered > thead > tr > th:last-child, .panel > .table-responsive > .table-bordered > thead > tr > th:last-child, .panel > .table-bordered > tbody > tr > th:last-child, .panel > .table-responsive > .table-bordered > tbody > tr > th:last-child, .panel > .table-bordered > tfoot > tr > th:last-child, .panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child, .panel > .table-bordered > thead > tr > td:last-child, .panel > .table-responsive > .table-bordered > thead > tr > td:last-child, .panel > .table-bordered > tbody > tr > td:last-child, .panel > .table-responsive > .table-bordered > tbody > tr > td:last-child, .panel > .table-bordered > tfoot > tr > td:last-child, .panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child { border-right: 0; } .panel > .table-bordered > thead > tr:first-child > td, .panel > .table-responsive > .table-bordered > thead > tr:first-child > td, .panel > .table-bordered > tbody > tr:first-child > td, .panel > .table-responsive > .table-bordered > tbody > tr:first-child > td, .panel > .table-bordered > thead > tr:first-child > th, .panel > .table-responsive > .table-bordered > thead > tr:first-child > th, .panel > .table-bordered > tbody > tr:first-child > th, .panel > .table-responsive > .table-bordered > tbody > tr:first-child > th { border-bottom: 0; } .panel > .table-bordered > tbody > tr:last-child > td, .panel > .table-responsive > .table-bordered > tbody > tr:last-child > td, .panel > .table-bordered > tfoot > tr:last-child > td, .panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td, .panel > .table-bordered > tbody > tr:last-child > th, .panel > .table-responsive > .table-bordered > tbody > tr:last-child > th, .panel > .table-bordered > tfoot > tr:last-child > th, .panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th { border-bottom: 0; } .panel > .table-responsive { border: 0; margin-bottom: 0; } .panel-group { margin-bottom: 20px; } .panel-group .panel { margin-bottom: 0; border-radius: 4px; } .panel-group .panel + .panel { margin-top: 5px; } .panel-group .panel-heading { border-bottom: 0; } .panel-group .panel-heading + .panel-collapse > .panel-body, .panel-group .panel-heading + .panel-collapse > .list-group { border-top: 1px solid #c3d8ed; } .panel-group .panel-footer { border-top: 0; } .panel-group .panel-footer + .panel-collapse .panel-body { border-bottom: 1px solid #c3d8ed; } .panel-default { border-color: #c3d8ed; } .panel-default > .panel-heading { color: #333333; background-color: #f5f5f5; border-color: #c3d8ed; } .panel-default > .panel-heading + .panel-collapse > .panel-body { border-top-color: #c3d8ed; } .panel-default > .panel-heading .badge { color: #f5f5f5; background-color: #333333; } .panel-default > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #c3d8ed; } .panel-primary { border-color: #c3d8ed; } .panel-primary > .panel-heading { color: #ffffff; background-color: #95a0be; border-color: #c3d8ed; } .panel-primary > .panel-heading + .panel-collapse > .panel-body { border-top-color: #c3d8ed; } .panel-primary > .panel-heading .badge { color: #95a0be; background-color: #ffffff; } .panel-primary > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #c3d8ed; } .panel-success { border-color: #d6e9c6; } .panel-success > .panel-heading { color: #3c763d; background-color: #dff0d8; border-color: #d6e9c6; } .panel-success > .panel-heading + .panel-collapse > .panel-body { border-top-color: #d6e9c6; } .panel-success > .panel-heading .badge { color: #dff0d8; background-color: #3c763d; } .panel-success > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #d6e9c6; } .panel-info { border-color: #bce8f1; } .panel-info > .panel-heading { color: #31708f; background-color: #d9edf7; border-color: #bce8f1; } .panel-info > .panel-heading + .panel-collapse > .panel-body { border-top-color: #bce8f1; } .panel-info > .panel-heading .badge { color: #d9edf7; background-color: #31708f; } .panel-info > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #bce8f1; } .panel-warning { border-color: #faebcc; } .panel-warning > .panel-heading { color: #8a6d3b; background-color: #fcf8e3; border-color: #faebcc; } .panel-warning > .panel-heading + .panel-collapse > .panel-body { border-top-color: #faebcc; } .panel-warning > .panel-heading .badge { color: #fcf8e3; background-color: #8a6d3b; } .panel-warning > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #faebcc; } .panel-danger { border-color: #ebccd1; } .panel-danger > .panel-heading { color: #a94442; background-color: #f2dede; border-color: #ebccd1; } .panel-danger > .panel-heading + .panel-collapse > .panel-body { border-top-color: #ebccd1; } .panel-danger > .panel-heading .badge { color: #f2dede; background-color: #a94442; } .panel-danger > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #ebccd1; } .embed-responsive { position: relative; display: block; height: 0; padding: 0; overflow: hidden; } .embed-responsive .embed-responsive-item, .embed-responsive iframe, .embed-responsive embed, .embed-responsive object, .embed-responsive video { position: absolute; top: 0; left: 0; bottom: 0; height: 100%; width: 100%; border: 0; } .embed-responsive-16by9 { padding-bottom: 56.25%; } .embed-responsive-4by3 { padding-bottom: 75%; } .well { min-height: 20px; padding: 19px; margin-bottom: 20px; background-color: #c3d6ef; border: 1px solid #a7c3e7; border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); } .well blockquote { border-color: #ddd; border-color: rgba(0, 0, 0, 0.15); } .well-lg { padding: 24px; border-radius: 6px; } .well-sm { padding: 9px; border-radius: 3px; } .close { float: right; font-size: 21px; font-weight: bold; line-height: 1; color: #000000; text-shadow: 0 1px 0 #ffffff; opacity: 0.2; filter: alpha(opacity=20); } .close:hover, .close:focus { color: #000000; text-decoration: none; cursor: pointer; opacity: 0.5; filter: alpha(opacity=50); } button.close { padding: 0; cursor: pointer; background: transparent; border: 0; -webkit-appearance: none; } .modal-open { overflow: hidden; } .modal { display: none; overflow: hidden; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1050; -webkit-overflow-scrolling: touch; outline: 0; } .modal.fade .modal-dialog { -webkit-transform: translate(0, -25%); -ms-transform: translate(0, -25%); -o-transform: translate(0, -25%); transform: translate(0, -25%); -webkit-transition: -webkit-transform 0.3s ease-out; -moz-transition: -moz-transform 0.3s ease-out; -o-transition: -o-transform 0.3s ease-out; transition: transform 0.3s ease-out; } .modal.in .modal-dialog { -webkit-transform: translate(0, 0); -ms-transform: translate(0, 0); -o-transform: translate(0, 0); transform: translate(0, 0); } .modal-open .modal { overflow-x: hidden; overflow-y: auto; } .modal-dialog { position: relative; width: auto; margin: 10px; } .modal-content { position: relative; background-color: #ffffff; border: 1px solid #999999; border: 1px solid rgba(0, 0, 0, 0.2); border-radius: 6px; -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5); box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5); background-clip: padding-box; outline: 0; } .modal-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1040; background-color: #000000; } .modal-backdrop.fade { opacity: 0; filter: alpha(opacity=0); } .modal-backdrop.in { opacity: 0.5; filter: alpha(opacity=50); } .modal-header { padding: 15px; border-bottom: 1px solid #e5e5e5; } .modal-header .close { margin-top: -2px; } .modal-title { margin: 0; line-height: 1.42857143; } .modal-body { position: relative; padding: 15px; } .modal-footer { padding: 15px; text-align: right; border-top: 1px solid #e5e5e5; } .modal-footer .btn + .btn { margin-left: 5px; margin-bottom: 0; } .modal-footer .btn-group .btn + .btn { margin-left: -1px; } .modal-footer .btn-block + .btn-block { margin-left: 0; } .modal-scrollbar-measure { position: absolute; top: -9999px; width: 50px; height: 50px; overflow: scroll; } @media (min-width: 768px) { .modal-dialog { width: 600px; margin: 30px auto; } .modal-content { -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); } .modal-sm { width: 300px; } } @media (min-width: 992px) { .modal-lg { width: 900px; } } .tooltip { position: absolute; z-index: 1070; display: block; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: normal; font-weight: normal; letter-spacing: normal; line-break: auto; line-height: 1.42857143; text-align: left; text-align: start; text-decoration: none; text-shadow: none; text-transform: none; white-space: normal; word-break: normal; word-spacing: normal; word-wrap: normal; font-size: 12px; opacity: 0; filter: alpha(opacity=0); } .tooltip.in { opacity: 0.9; filter: alpha(opacity=90); } .tooltip.top { margin-top: -3px; padding: 5px 0; } .tooltip.right { margin-left: 3px; padding: 0 5px; } .tooltip.bottom { margin-top: 3px; padding: 5px 0; } .tooltip.left { margin-left: -3px; padding: 0 5px; } .tooltip-inner { max-width: 200px; padding: 3px 8px; color: #ffffff; text-align: center; background-color: #000000; border-radius: 4px; } .tooltip-arrow { position: absolute; width: 0; height: 0; border-color: transparent; border-style: solid; } .tooltip.top .tooltip-arrow { bottom: 0; left: 50%; margin-left: -5px; border-width: 5px 5px 0; border-top-color: #000000; } .tooltip.top-left .tooltip-arrow { bottom: 0; right: 5px; margin-bottom: -5px; border-width: 5px 5px 0; border-top-color: #000000; } .tooltip.top-right .tooltip-arrow { bottom: 0; left: 5px; margin-bottom: -5px; border-width: 5px 5px 0; border-top-color: #000000; } .tooltip.right .tooltip-arrow { top: 50%; left: 0; margin-top: -5px; border-width: 5px 5px 5px 0; border-right-color: #000000; } .tooltip.left .tooltip-arrow { top: 50%; right: 0; margin-top: -5px; border-width: 5px 0 5px 5px; border-left-color: #000000; } .tooltip.bottom .tooltip-arrow { top: 0; left: 50%; margin-left: -5px; border-width: 0 5px 5px; border-bottom-color: #000000; } .tooltip.bottom-left .tooltip-arrow { top: 0; right: 5px; margin-top: -5px; border-width: 0 5px 5px; border-bottom-color: #000000; } .tooltip.bottom-right .tooltip-arrow { top: 0; left: 5px; margin-top: -5px; border-width: 0 5px 5px; border-bottom-color: #000000; } .popover { position: absolute; top: 0; left: 0; z-index: 1060; display: none; max-width: 276px; padding: 1px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: normal; font-weight: normal; letter-spacing: normal; line-break: auto; line-height: 1.42857143; text-align: left; text-align: start; text-decoration: none; text-shadow: none; text-transform: none; white-space: normal; word-break: normal; word-spacing: normal; word-wrap: normal; font-size: 14px; background-color: #ffffff; background-clip: padding-box; border: 1px solid #cccccc; border: 1px solid rgba(0, 0, 0, 0.2); border-radius: 6px; -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); } .popover.top { margin-top: -10px; } .popover.right { margin-left: 10px; } .popover.bottom { margin-top: 10px; } .popover.left { margin-left: -10px; } .popover-title { margin: 0; padding: 8px 14px; font-size: 14px; background-color: #f7f7f7; border-bottom: 1px solid #ebebeb; border-radius: 5px 5px 0 0; } .popover-content { padding: 9px 14px; } .popover > .arrow, .popover > .arrow:after { position: absolute; display: block; width: 0; height: 0; border-color: transparent; border-style: solid; } .popover > .arrow { border-width: 11px; } .popover > .arrow:after { border-width: 10px; content: ""; } .popover.top > .arrow { left: 50%; margin-left: -11px; border-bottom-width: 0; border-top-color: #999999; border-top-color: rgba(0, 0, 0, 0.25); bottom: -11px; } .popover.top > .arrow:after { content: " "; bottom: 1px; margin-left: -10px; border-bottom-width: 0; border-top-color: #ffffff; } .popover.right > .arrow { top: 50%; left: -11px; margin-top: -11px; border-left-width: 0; border-right-color: #999999; border-right-color: rgba(0, 0, 0, 0.25); } .popover.right > .arrow:after { content: " "; left: 1px; bottom: -10px; border-left-width: 0; border-right-color: #ffffff; } .popover.bottom > .arrow { left: 50%; margin-left: -11px; border-top-width: 0; border-bottom-color: #999999; border-bottom-color: rgba(0, 0, 0, 0.25); top: -11px; } .popover.bottom > .arrow:after { content: " "; top: 1px; margin-left: -10px; border-top-width: 0; border-bottom-color: #ffffff; } .popover.left > .arrow { top: 50%; right: -11px; margin-top: -11px; border-right-width: 0; border-left-color: #999999; border-left-color: rgba(0, 0, 0, 0.25); } .popover.left > .arrow:after { content: " "; right: 1px; border-right-width: 0; border-left-color: #ffffff; bottom: -10px; } .carousel { position: relative; } .carousel-inner { position: relative; overflow: hidden; width: 100%; } .carousel-inner > .item { display: none; position: relative; -webkit-transition: 0.6s ease-in-out left; -o-transition: 0.6s ease-in-out left; transition: 0.6s ease-in-out left; } .carousel-inner > .item > img, .carousel-inner > .item > a > img { line-height: 1; } @media all and (transform-3d), (-webkit-transform-3d) { .carousel-inner > .item { -webkit-transition: -webkit-transform 0.6s ease-in-out; -moz-transition: -moz-transform 0.6s ease-in-out; -o-transition: -o-transform 0.6s ease-in-out; transition: transform 0.6s ease-in-out; -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; backface-visibility: hidden; -webkit-perspective: 1000px; -moz-perspective: 1000px; perspective: 1000px; } .carousel-inner > .item.next, .carousel-inner > .item.active.right { -webkit-transform: translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0); left: 0; } .carousel-inner > .item.prev, .carousel-inner > .item.active.left { -webkit-transform: translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0); left: 0; } .carousel-inner > .item.next.left, .carousel-inner > .item.prev.right, .carousel-inner > .item.active { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); left: 0; } } .carousel-inner > .active, .carousel-inner > .next, .carousel-inner > .prev { display: block; } .carousel-inner > .active { left: 0; } .carousel-inner > .next, .carousel-inner > .prev { position: absolute; top: 0; width: 100%; } .carousel-inner > .next { left: 100%; } .carousel-inner > .prev { left: -100%; } .carousel-inner > .next.left, .carousel-inner > .prev.right { left: 0; } .carousel-inner > .active.left { left: -100%; } .carousel-inner > .active.right { left: 100%; } .carousel-control { position: absolute; top: 0; left: 0; bottom: 0; width: 15%; opacity: 0.5; filter: alpha(opacity=50); font-size: 20px; color: #ffffff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); background-color: rgba(0, 0, 0, 0); } .carousel-control.left { background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); } .carousel-control.right { left: auto; right: 0; background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); background-image: linear-gradient(to right, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); } .carousel-control:hover, .carousel-control:focus { outline: 0; color: #ffffff; text-decoration: none; opacity: 0.9; filter: alpha(opacity=90); } .carousel-control .icon-prev, .carousel-control .icon-next, .carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-right { position: absolute; top: 50%; margin-top: -10px; z-index: 5; display: inline-block; } .carousel-control .icon-prev, .carousel-control .glyphicon-chevron-left { left: 50%; margin-left: -10px; } .carousel-control .icon-next, .carousel-control .glyphicon-chevron-right { right: 50%; margin-right: -10px; } .carousel-control .icon-prev, .carousel-control .icon-next { width: 20px; height: 20px; line-height: 1; font-family: serif; } .carousel-control .icon-prev:before { content: '\2039'; } .carousel-control .icon-next:before { content: '\203a'; } .carousel-indicators { position: absolute; bottom: 10px; left: 50%; z-index: 15; width: 60%; margin-left: -30%; padding-left: 0; list-style: none; text-align: center; } .carousel-indicators li { display: inline-block; width: 10px; height: 10px; margin: 1px; text-indent: -999px; border: 1px solid #ffffff; border-radius: 10px; cursor: pointer; background-color: #000 \9; background-color: rgba(0, 0, 0, 0); } .carousel-indicators .active { margin: 0; width: 12px; height: 12px; background-color: #ffffff; } .carousel-caption { position: absolute; left: 15%; right: 15%; bottom: 20px; z-index: 10; padding-top: 20px; padding-bottom: 20px; color: #ffffff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); } .carousel-caption .btn { text-shadow: none; } @media screen and (min-width: 768px) { .carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-right, .carousel-control .icon-prev, .carousel-control .icon-next { width: 30px; height: 30px; margin-top: -10px; font-size: 30px; } .carousel-control .glyphicon-chevron-left, .carousel-control .icon-prev { margin-left: -10px; } .carousel-control .glyphicon-chevron-right, .carousel-control .icon-next { margin-right: -10px; } .carousel-caption { left: 20%; right: 20%; padding-bottom: 30px; } .carousel-indicators { bottom: 20px; } } .clearfix:before, .clearfix:after, .dl-horizontal dd:before, .dl-horizontal dd:after, .container:before, .container:after, .container-fluid:before, .container-fluid:after, .row:before, .row:after, .form-horizontal .form-group:before, .form-horizontal .form-group:after, .btn-toolbar:before, .btn-toolbar:after, .btn-group-vertical > .btn-group:before, .btn-group-vertical > .btn-group:after, .nav:before, .nav:after, .navbar:before, .navbar:after, .navbar-header:before, .navbar-header:after, .navbar-collapse:before, .navbar-collapse:after, .pager:before, .pager:after, .panel-body:before, .panel-body:after, .modal-header:before, .modal-header:after, .modal-footer:before, .modal-footer:after { content: " "; display: table; } .clearfix:after, .dl-horizontal dd:after, .container:after, .container-fluid:after, .row:after, .form-horizontal .form-group:after, .btn-toolbar:after, .btn-group-vertical > .btn-group:after, .nav:after, .navbar:after, .navbar-header:after, .navbar-collapse:after, .pager:after, .panel-body:after, .modal-header:after, .modal-footer:after { clear: both; } .center-block { display: block; margin-left: auto; margin-right: auto; } .pull-right { float: right !important; } .pull-left { float: left !important; } .hide { display: none !important; } .show { display: block !important; } .invisible { visibility: hidden; } .text-hide { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; } .hidden { display: none !important; } .affix { position: fixed; } @-ms-viewport { width: device-width; } .visible-xs, .visible-sm, .visible-md, .visible-lg { display: none !important; } .visible-xs-block, .visible-xs-inline, .visible-xs-inline-block, .visible-sm-block, .visible-sm-inline, .visible-sm-inline-block, .visible-md-block, .visible-md-inline, .visible-md-inline-block, .visible-lg-block, .visible-lg-inline, .visible-lg-inline-block { display: none !important; } @media (max-width: 767px) { .visible-xs { display: block !important; } table.visible-xs { display: table !important; } tr.visible-xs { display: table-row !important; } th.visible-xs, td.visible-xs { display: table-cell !important; } } @media (max-width: 767px) { .visible-xs-block { display: block !important; } } @media (max-width: 767px) { .visible-xs-inline { display: inline !important; } } @media (max-width: 767px) { .visible-xs-inline-block { display: inline-block !important; } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm { display: block !important; } table.visible-sm { display: table !important; } tr.visible-sm { display: table-row !important; } th.visible-sm, td.visible-sm { display: table-cell !important; } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm-block { display: block !important; } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm-inline { display: inline !important; } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm-inline-block { display: inline-block !important; } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md { display: block !important; } table.visible-md { display: table !important; } tr.visible-md { display: table-row !important; } th.visible-md, td.visible-md { display: table-cell !important; } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md-block { display: block !important; } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md-inline { display: inline !important; } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md-inline-block { display: inline-block !important; } } @media (min-width: 1200px) { .visible-lg { display: block !important; } table.visible-lg { display: table !important; } tr.visible-lg { display: table-row !important; } th.visible-lg, td.visible-lg { display: table-cell !important; } } @media (min-width: 1200px) { .visible-lg-block { display: block !important; } } @media (min-width: 1200px) { .visible-lg-inline { display: inline !important; } } @media (min-width: 1200px) { .visible-lg-inline-block { display: inline-block !important; } } @media (max-width: 767px) { .hidden-xs { display: none !important; } } @media (min-width: 768px) and (max-width: 991px) { .hidden-sm { display: none !important; } } @media (min-width: 992px) and (max-width: 1199px) { .hidden-md { display: none !important; } } @media (min-width: 1200px) { .hidden-lg { display: none !important; } } .visible-print { display: none !important; } @media print { .visible-print { display: block !important; } table.visible-print { display: table !important; } tr.visible-print { display: table-row !important; } th.visible-print, td.visible-print { display: table-cell !important; } } .visible-print-block { display: none !important; } @media print { .visible-print-block { display: block !important; } } .visible-print-inline { display: none !important; } @media print { .visible-print-inline { display: inline !important; } } .visible-print-inline-block { display: none !important; } @media print { .visible-print-inline-block { display: inline-block !important; } } @media print { .hidden-print { display: none !important; } } .navbar-collapse.collapse.in { background: #f8f8f8; } .warning a, .warning a:link, .warning a:visited { color: #8a6d3b; } .calhighlight { color: #31708f; background: #d9edf7; } a.fc-event:hover { color: #ffffff; } .filter .fancyfilter { border: thin solid #818181 /*black*/; } .filter .fancyfilter .token { background: #fefeff; } .note-list .postbody-title { background: #ffffff; color: #333333; } .post-approved-n { border-left: 3px dotted #3c763d; } .post-approved-r { border-left: 3px double #8a6d3b; } .post-approved-r .content * { background: url('../../../img/icons/dots.gif'); } .dropdown-menu { color: #999999; } .cssmenu_horiz > li:hover, .cssmenu_horiz > li.sfHover, .cssmenu_vert > li:hover, .cssmenu_vert > li.sfHover { -webkit-transition: none; -moz-transition: none; -o-transition: none; transition: none; } .topbar .nav > li > a:hover, .topbar .nav > li > a:focus { background: transparent; } .cssmenu_horiz ul, .cssmenu_vert ul { border: #6a6a6a; } .cssmenu_horiz ul li a, .cssmenu_vert ul li a { background: #ebf2f9; color: #333333; } .cssmenu_horiz > ul > li:hover > a, .cssmenu_vert > ul > li:hover > a { color: #262626; background: url('../images/flakesptn3.jpg') transparent; } .sf-arrows .sf-with-ul:after { border: 5px solid transparent; border-top-color: #613b8d; } .cssmenu_vert.sf-arrows li > .sf-with-ul:after { border-color: transparent; border-left-color: #613b8d; /* edit this to suit design (no rgba in IE8) */ } .sf-arrows ul .sf-with-ul:after, .cssmenu_vert.sf-arrows ul > li > .sf-with-ul:after { border-color: transparent; border-left-color: #333333; /* edit this to suit design (no rgba in IE8) */ } .sf-arrows ul li > .sf-with-ul:focus:after, .sf-arrows ul li:hover > .sf-with-ul:after, .sf-arrows ul .sfHover > .sf-with-ul:after { border-color: transparent; border-left-color: #262626; } .cssmenu_vert.sf-arrows li > .sf-with-ul:focus:after, .cssmenu_vert.sf-arrows li:hover > .sf-with-ul:after, .cssmenu_vert.sf-arrows .sfHover > .sf-with-ul:after { border-color: transparent; border-left-color: #262626; } .topbar, .topbar .navbar-default .navbar-nav > li, .topbar .nav > li { background: #f8f8f8; color: #777777; } .topbar > a, .topbar .navbar-default .navbar-nav > li > a, .topbar .nav > li > a { color: #393e51; padding-top: 7.5px; padding-bottom: 7.5px; } .topbar > a:hover, .topbar .navbar-default .navbar-nav > li > a:hover, .topbar .nav > li > a:hover, .topbar > a:focus, .topbar .navbar-default .navbar-nav > li > a:focus, .topbar .nav > li > a:focus { color: #6c7b8c; } .topbar .cssmenu_horiz ul { background: #ebf2f9; } .topbar .cssmenu_horiz.sf-arrows > .menuSection0 > .sf-with-ul:after { border: 5px solid transparent; border-top-color: #393e51; } .topbar .cssmenu_horiz.sf-arrows > .menuSection0:hover > .sf-with-ul:after, .topbar .cssmenu_horiz.sf-arrows > .menuSection0.sfhover > .sf-with-ul:after { border-top-color: #6c7b8c; } /* order of following 3 rules important for fallbacks to work */ .dropdown-menu .dropdown-title, .dropdown-menu li label { color: #333333; } .thumbinfosothers { color: #eeeeee; } table.treetable.objectperms td.added { background-color: #dff0d8; } table.treetable.objectperms td.removed { background-color: #fcf8e3; } .progressBarInProgress { background-color: #31708f; color: #d9edf7; } .progressBarComplete { background-color: #3c763d; color: #dff0d8; } .progressBarError { background-color: #8a6d3b; color: #fcf8e3; } .progressContainer { border: solid 1px rgba(0, 0, 0, 0.2); background-color: #ffffff; } .filter-panel-heading a:after { color: #555555; } .olControlMousePosition { background: rgba(0, 0, 0, 0.75); color: #fefeff; } .olControlScaleLineTop, .olControlScaleLineBottom { background-color: rgba(255, 255, 255, 0.5); } .ui-selectmenu-icon { background-color: inherit; border: solid 5px transparent !important; -webkit-box-shadow: -5px 0 5px 2px rgba(0, 0, 0, 0.1), -1px 0 0 rgba(0, 0, 0, 0.1), -2px 0 0 rgba(255, 255, 255, 0.25); box-shadow: -5px 0 5px 2px rgba(0, 0, 0, 0.1), -1px 0 0 rgba(0, 0, 0, 0.1), -2px 0 0 rgba(255, 255, 255, 0.25); } .dirsitetrail { color: #f5f5f5; } .dirsitecats { color: #f5f5f5; } #resultzone > div:hover { background: #dff0d8; } .searchresults blockquote em, .highlight, .btn-default.highlight a, .btn-default a.highlight { background: #f2dede; color: #a94442; border-color: #ebccd1; } .btn-default.highlight:hover { background: #dca7a7; } .btn-default.btn-link, .btn-default.btn-link:hover { background: transparent; border: none; } #ajaxLoadingBG { background: transparent url('../../../img/overlay-light.png'); } #ajaxLoading { color: #eeeeee; background: transparent url('../../../img/loading-light.gif') no-repeat 50% 50%; } #cookie_consent_div { padding: 15px; border: 1px solid #bce8f1; color: #31708f; background-color: #d9edf7; } #cookie_consent_div.banner { padding: 15px; border: 1px solid #bce8f1; } html#print, body.print * { background: #ffffff; color: #000000; } body.fullscreen { background: #ffffff; } .attention { color: #a94442; } #debugconsole { background: #234c75; color: #eeeeee; border: 2px solid #17324e; } #debugconsole form { color: #999999; } #debugconsole a { color: #ffffff; } #debugconsole a.btn { color: #393e51; } a.icon, img.icon { background: transparent; } div #metadata fieldset.tabcontent, div #metadata div.tabs { background-color: transparent; } .openid_url { background: #ffffff url('../../../img/icons/login-OpenID-bg.gif') 1px 1px no-repeat; } input:-webkit-autofill { background-color: #fefeff !important; /* needs important because Chrome has it already important */ background-image: none !important; color: #555555 !important; /* the Google guys forgot the number-one rule... when they specify background they should specify forgeround color too ;) */ } #cboxTitle { background-color: #fefeff; } #captchaImg { border: 1px solid #c3d8ed; } form.simple label.error { background: url('../../../img/icons/error.png') no-repeat 0 4px; color: #a94442; } form.simple label .warning { color: #a94442; } .tiki-modal .mask { background-color: #fefeff; } .ui-dialog { background: #fefeff; color: #333333; } .cssmenu_horiz ul li.selected a, .cssmenu_vert ul li.selected a, .cssmenu_horiz ul li a:hover, .cssmenu_vert ul li a:hover { text-decoration: none; color: #262626; background-color: url('../images/flakesptn3.jpg') transparent; } .box-quickadmin .cssmenu_horiz ul li { background-color: #fefeff; } .box-switch_lang .box-data img.highlight { border: 0.1em solid #ebccd1; } .box-switch_lang .box-data .highlight { border: 0.1em solid #ebccd1; } div.cvsup { color: #999999; } .layout_social .topbar_modules h1.sitetitle, .layout_social_modules .topbar_modules h1.sitetitle, .layout_fixed_top_modules #top_modules h1.sitetitle { color: #393e51; } .layout_social .topbar_modules .navbar-inverse .navbar-collapse, .layout_social_modules .topbar_modules .navbar-inverse .navbar-collapse, .layout_fixed_top_modules #top_modules .navbar-inverse .navbar-collapse, .layout_social .topbar_modules .navbar-inverse .navbar-form, .layout_social_modules .topbar_modules .navbar-inverse .navbar-form, .layout_fixed_top_modules #top_modules .navbar-inverse .navbar-form, .layout_social .topbar_modules .navbar-inverse, .layout_social_modules .topbar_modules .navbar-inverse, .layout_fixed_top_modules #top_modules .navbar-inverse { border-color: transparent; } .prio1 { background: inherit; } .prio2 { background: #dff0d8; color: #3c763d; border: #d6e9c6; } .prio2 a { color: #3c763d; } .prio3 { background: #d9edf7; color: #31708f; border: #bce8f1; } .prio3 a { color: #31708f; } .prio4 { background: #fcf8e3; color: #8a6d3b; border: #faebcc; } .prio4 a { color: #8a6d3b; } .prio5 { background: #f2dede; color: #a94442; border: #ebccd1; } .prio5 a { color: #a94442; } .messureadflag { background: #555555; } .messureadhead { background: #999999; } .messureadbody { background: #eeeeee; } .readlink { color: #333333; } .webmail_item { border: 1px solid #c3d8ed; } .webmail_list .odd { background: #f9f9f9; } .webmail_list .button { background: #fefeff; border: 1px solid #c3d8ed; } .webmail_list .webmail_read { background: #d9edf7; } .webmail_list .webmail_replied { background: #dff0d8; } .webmail_list .webmail_taken { border: #faebcc; color: #8a6d3b; } .webmail_message { background: #fefeff; } .webmail_message_headers { background: #fefeff; } .webmail_message_headers th { background: transparent; } .tiki_sheet table td { border: 1px solid #c3d8ed; } .odd { background: transparent; color: #333333; } .even { background: #f9f9f9; color: #333333; } .helptool-admin { border-left: medium double #999999; } .toolbar-list { border-left: medium double #999999; } .toolbars-picker { background: #fefeff; border: thin solid #333333; color: #333333; } .toolbars-picker a { border: 1px solid #fefeff; color: #333333; } .toolbars-picker a:hover { border: 1px solid #a94442; background: #999999; color: #333333; } .textarea-toolbar > div { background-color: #eeeeee; border: outset 1px #eeeeee; } #intertrans-indicator { background-color: #dff0d8; color: #3c763d; } #intertrans-form { background-color: #ffffff; border: 1px solid #c3d8ed; color: #333333; } #edit_translations tr.last { border-bottom: 2px solid #d6e9c6; } ul.all_languages > li { border: 1px solid #d6e9c6; } .plugin-mouseover { background: #ffffff; border: 1px solid rgba(0, 0, 0, 0.2); } .mandatory_note { color: #a94442; } .author0 { color: #3c763d; } .author1 { color: #31708f; } .author2 { color: #8a6d3b; } .author3 { color: #a94442; } .author4 { color: #3c766d; } .author5 { color: #60318f; } .author6 { color: #658a3b; } .author7 { color: #a99a42; } .author8 { color: #3c4e76; } .author9 { color: #8f318f; } .author10 { color: #3b8a53; } .author11 { color: #62a942; } .author12 { color: #6d3c76; } .author13 { color: #8f3151; } .author14 { color: #3b728a; } .author15 { color: #42a989; } .structuremenu .menuSection { border-left: 1px dotted #555555; } .cke_editable:hover { outline: #555555 dotted 1px; } .tiki_plugin { background-color: transparent; border: 1px solid #999999; } .unsavedChangesInEditor { border: 1px solid; border-color: #faebcc; } .autotoc > .nav { background: #ffffff; border: 1px solid #c3d8ed; border-radius: 4px; } .autotoc * { color: #613b8d; } .autotoc .nav > li > a:hover, .autotoc .nav .nav > li > a:hover { color: #3c2457; } .plugin-form-float { background: #fefeff; color: #333333; border: solid 2px #333333; } body.wikitext { background: #fefeff; color: #333333; } .editable-inline { background: transparent url('../../../img/icons/database_lightning.png') no-repeat top right; padding-right: 20px; display: inline-block; } .editable-inline.loaded { background: #ffffff; padding: 6px; border: 1px solid #eee; border-radius: 4px; z-index: 2; } .editable-inline.failure { background: transparent url('../../../img/icons/lock_gray.png') no-repeat top right; } .editable-inline.modified { border: solid 2px #d43f3a; padding: 2px; } .editable-inline.unsaved { border: solid 2px #d43f3a; } .structure_select .cssmenu_horiz ul li { border: 1px solid #555555; } .admintoclevel .actions input { border: solid 1px #555555; } .TextArea-fullscreen { background-color: #555555; } .TextArea-fullscreen .actions, .CodeMirror-fullscreen .actions { background-color: #fefeff; border-top: #eeeeee 1px solid; } #autosave_preview { background-color: #fefeff; color: #333333; } #autosave_preview_grippy { background-color: #eeeeee; background-image: url('../../../img/icons/shading.png'); } h1:hover a.tiki_anchor, h2:hover a.tiki_anchor, h3:hover a.tiki_anchor, h4:hover a.tiki_anchor, h5:hover a.tiki_anchor, h6:hover a.tiki_anchor { color: #eeeeee; } h1 a.tiki_anchor:hover, h2 a.tiki_anchor:hover, h3 a.tiki_anchor:hover, h4 a.tiki_anchor:hover, h5 a.tiki_anchor:hover, h6 a.tiki_anchor:hover { color: #555555; } .wiki .namespace { background: #eeeeee; } .site_report a { border-left: 1px solid #555555; border-right: 1px solid #555555; } .quotebody { border-left: 2px solid #999999; } .mandatory_star { color: #ebccd1; } .trackerplugindesc { color: #333333; } .charCount { color: #333333; } .imgbox { border: 1px solid rgba(0, 0, 0, 0.2); background-color: #ffffff; } .ic_button { border: 2px solid #dddddd; } .ic_active { border: 2px solid #95a0be; } .ic_caption { background: #234c75; color: #999999; } .wp-cookie-consent-required { color: #a94442; } .wp-sign { color: #ffffff; background-color: #000000; } .wp-sign a, .wp-sign a:visited { color: #ffffff; } .wp-sign a:hover, .wp-sign a:visited:hover { color: #ffffff; text-decoration: none; } .toc { border-top: 1px dotted #999999; border-bottom: 1px dotted #999999; } .diff td { border: 1px solid #333333; } .diff div { border-top: 1px solid #999999; } .diffadded { background: #dff0d8; color: #3c763d; } .diffdeleted { background: #f2dede; color: #a94442; } .diffinldel { background: #fcf8e3; } .diffbody { background: #eeeeee; color: #222222; } .diffchar { color: #c0605e; } .diffadded .diffchar { color: #4d984e; } .searchresults blockquote em.hlt1, .searchresults blockquote em.hlt6, .highlight_word_0 { color: #3c763d; background: #dff0d8; } .searchresults blockquote em.hlt2, .searchresults blockquote em.hlt7, .highlight_word_1 { color: #31708f; background: #d9edf7; } .searchresults blockquote em.hlt3, .searchresults blockquote em.hlt8, .highlight_word_2 { color: #8a6d3b; background: #fcf8e3; } .searchresults blockquote em.hlt4, .searchresults blockquote em.hlt9, .highlight_word_3 { color: #a94442; background: #f2dede; } .searchresults blockquote em.hlt5, .searchresults blockquote em.hlt10, .highlight_word_4 { color: #a96642; background: #f2e5de; } /* Structures drill-down menu */ div.drillshow { border: 1px solid #999999; } .chosen-container-multi .chosen-choices { background-color: #ffffff; color: #555555; border: 1px solid #d7e5f3; } .chosen-container-single .chosen-single, .chosen-container-active.chosen-with-drop .chosen-single, .chosen-container .chosen-drop, .chosen-container-multi .chosen-choices .search-choice { background-color: #fefeff; color: #555555; border: 1px solid #d7e5f3; } .chosen-container-single .chosen-search input[type="text"] { background-color: #fefeff; border: 1px solid #d7e5f3; } .chosen-container .chosen-results li.highlighted { background-color: url('../images/flakesptn3.jpg') transparent; color: #262626; } .tiki .chosen-container .active-result { color: #555555; } .breadcrumb { font-style: normal; font-size: 90%; display: block; } a.admbox.off { border: 1px solid #2a3144; color: #999999; } a.admbox.off:hover, a.admbox.off:focus, a.admbox.off:active { border: 1px solid #2a3144; color: #999999; } .tiki .ui-widget-content, span.plugin-mouseover { background: #ffffff; color: #333333; border: 1px solid rgba(0, 0, 0, 0.2); } .tiki .ui-widget-header { background: #ffffff; color: #333333; border: 1px solid rgba(0, 0, 0, 0.2); } .tiki .ui-dialog-content { background: #ffffff; color: #333333; } .tiki .ui-dialog-content select, .tiki .ui-dialog-content input, .tiki .ui-dialog-content optgroup, .tiki .ui-dialog-content textarea { background: #fefeff; color: #555555; } .tiki .ui-widget button { background: #95a0be; color: #ffffff; } .tiki .modal-content .ui-state-default { color: #613b8d; } .tiki .modal-content .ui-state-hover:hover { color: #3c2457; } .dropdown-menu { color: #333333; } .tiki .col1 .table-responsive { border: 1px solid #c3d8ed; } .codecaption { display: inline-block; color: #444444; background: #f8f8f8; border: 1px solid #dddddd; border-bottom: none; padding: 2px 9.5px; font-size: 0.8em; font-weight: bold; } code, pre.codelisting { color: #444444; background: #f8f8f8; border: 1px solid #dddddd; border-radius: 1px; } .edit-menu { position: absolute; top: 6px; right: 2px; } @media (min-width: 992px) { .edit-menu { display: none; } .navbar-default:hover .edit-menu { display: block; } } @media (max-width: 767px) { .navbar-default .edit-menu { top: 48px; } } .adminoptionboxchild { border-bottom: 1px solid #eeeeee; } .adminoptionboxchild legend { font-size: 19px; } input[type="checkbox"].preffilter-toggle-round + label { background-color: #999999; } input[type="checkbox"].preffilter-toggle-round + label:before { color: #ffffff; background-color: #95a0be; border-color: #818181; } input[type="checkbox"].preffilter-toggle-round:checked + label:before { color: #ffffff; background-color: #95a0be; border-color: #8592b4; } .margin-bottom-xs { margin-bottom: 5px; } .margin-bottom-sm { margin-bottom: 10px; } .margin-bottom-md { margin-bottom: 20px; } .margin-bottom-lg { margin-bottom: 40px; } /* black */ /* white */ /* automatically choose the correct arrow/text color */ .tsFilterInput { border: none; background-color: #f2f8fb; } table.tablesorter { /* style header */ } table.tablesorter thead tr.tablesorter-headerRow th.tablesorter-headerUnSorted:not(.sorter-false) { background-image: url(data:image/gif;base64,R0lGODlhFQAJAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==); } table.tablesorter thead tr.tablesorter-headerRow th.tablesorter-headerAsc { background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7); } table.tablesorter thead tr.tablesorter-headerRow th.tablesorter-headerDesc { background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7); } table.tablesorter thead tr.tablesorter-filter-row input.tablesorter-filter { border: none; background-color: #f2f8fb; } table.tablesorter thead tr.tablesorter-filter-row input.dateFrom, table.tablesorter thead tr.tablesorter-filter-row input.dateTo { border: none; background-color: #f2f8fb; } table.tablesorter thead tr.tablesorter-headerRow, table.tablesorter thead tr.tablesorter-filter-row { background-color: #fefeff; } .tiki .pvtUi { color: #333333; } .tiki table.pvtTable { font-size: 14px; } .tiki table.pvtTable tr th { background-color: #d9edf7; color: #31708f; border: 1px solid #dddddd; font-size: 14px; padding: 5px; } .tiki table.pvtTable tr td { color: #333333; background-color: transparent; border-color: #dddddd; } .tiki .pvtTotal, .tiki .pvtGrandTotal { font-weight: bold; } .tiki .pvtVals { text-align: center; } .tiki .pvtAggregator, .tiki .pvtRenderer, .tiki .pvtSearch, .tiki .pvtAttrDropdown { margin-bottom: 5px; background: #fefeff; color: #555555; border: 1px solid #d7e5f3; border-radius: 4px; } .tiki .pvtAxisContainer, .tiki .pvtVals { border-color: #dddddd; background: #fefeff; padding: 5px; } .tiki .pvtAxisContainer li.pvtPlaceholder { padding: 3px 15px; border-radius: 5px; border: 1px dashed #dddddd; } .tiki .pvtAxisContainer li span.pvtAttr { -webkit-text-size-adjust: 100%; padding: 2px 5px; white-space: nowrap; background: #95a0be; border: 1px solid #818181; border-radius: 4px; color: #ffffff; } .tiki .pvtTriangle { cursor: pointer; color: grey; } .tiki .pvtHorizList li { display: inline; } .tiki .pvtVertList { vertical-align: top; } .tiki .pvtFilteredAttribute { font-style: italic; } .tiki .pvtFilterBox { z-index: 100; width: 280px; border: 1px solid #dddddd; background-color: #ffffff; position: absolute; padding: 20px; text-align: center; } .tiki .pvtFilterBox h4 { margin: 0; } .tiki .pvtFilterBox p { margin: 1em auto; } .tiki .pvtFilterBox label { font-weight: normal; } .tiki .pvtFilterBox input[type='checkbox'] { margin-right: 5px; } .tiki .pvtCheckContainer { text-align: left; overflow: auto; width: 100%; max-height: 200px; } .tiki .pvtCheckContainer p { margin: 5px; } .tiki .pvtRendererArea { padding: 5px; } .tiki .pvtFilterBox button { background: #95a0be; border: 1px solid #818181; border-radius: 4px; color: #ffffff; } .tiki .pvtFilterBox button:hover { background: #9599be; } .tiki .pvtFilterBox button + button { margin-left: 4px; margin-bottom: 4px; } .tiki .c3 line, .tiki .c3 path, .tiki .c3 svg { fill: none; stroke: #333333; } .tiki select { font-size: 14px; } .tiki .ui-state-default, .tiki .ui-widget-content .ui-state-default, .tiki .ui-widget-header .ui-state-default, .tiki .ui-button, .tiki html .ui-button.ui-state-disabled:hover, .tiki html .ui-button.ui-state-disabled:active { border: 1px solid #818181; background: #95a0be; font-weight: normal; color: #ffffff; font-size: 14px; } .tiki .ui-state-hover, .tiki .ui-widget-content .ui-state-hover, .tiki .ui-widget-header .ui-state-hover, .tiki .ui-state-focus, .tiki .ui-widget-content .ui-state-focus, .tiki .ui-widget-header .ui-state-focus, .tiki .ui-button:hover, .tiki .ui-button:focus { border: 1px solid #818181; background: #95a0be; font-weight: normal; color: #ffffff; } .tiki .ui-widget-header a { color: #613b8d; } body, body.fullscreen { background: url('../images/flakesptn2.jpg'); background-attachment: fixed; } header.container { margin-top: 20px; } .topbar { margin-bottom: 20px; } .layout_social .navbar-fixed-top, .layout_social .navbar-fixed-top .container, .navbar-default, .topbar, .topbar .cssmenu_horiz > ul, .topbar .navbar-default .navbar-nav > li, .topbar .nav > li, .layout_social .navbar-inverse .navbar-form, .layout_social .navbar-inverse .container { background: url('../images/flakesptn3.jpg'); border: none; } .layout_classic header.container, .layout_classic .middle.container, .layout_classic .footer_liner, .layout_social > .container, .layout_basic > .container, .layout_fixed_top_modules .container.middle { background: #ebf2f9; -webkit-box-shadow: 0 0 70px 72px #ffffff; box-shadow: 0 0 100px 100px #ebf2f9; } .layout_social .navbar-inverse { border-bottom: 1px solid #6c7b8c; } .navbar-inverse .navbar-brand, .navbar-inverse a, .navbar-inverse .navbar-nav > li > a { color: #1c1329; } .layout_social > .container { margin-top: 46px; } .well, .jumbotron, .adminanchors { background: url('../images/flakesptn4.jpg'); } .panel { background: #d7e5f3; } .panel-heading, .panel-footer { background: url('../images/flakesptn3.jpg'); } .blog-postbody-title h2.panel-title { font-size: 20px; } #col2 .panel, #col3 .panel, #col2 .panel-default, #col3 .panel-default { background: none; border: none; } #col2 .panel-footer, #col3 .panel-footer { display: none; } .topbar .navbar-default { background: transparent; border: none; } .topbar .form-group { margin-bottom: 0; } /* .topbar .nav > li > a:hover, .topbar .nav > li > a:focus, .topbar .cssmenu_horiz > li > a:hover, .topbar .cssmenu_horiz > li:hover, .topbar .cssmenu_horiz li.sfHover:hover, .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus { background: #D7E5F3 url('@{imagePath}pagetitle-bg.jpg') repeat-x; color: #555555; } .dropdown-menu > li > form { background: url('@{imagePath}flakesptn2.jpg'); } .dropdown-menu > li > a { background: url('@{imagePath}flakesptn2.jpg'); &:hover { background: url('@{imagePath}flakesptn3.jpg'); } } .nav > li > a:hover {background: url('@{imagePath}flakesptn3.jpg');} */ .btn, .btn-default, .nav-tabs > li > a, .input-group-addon { background: url('../images/pagetitle-bg.jpg'); background-size: cover; } .btn:hover, .btn-default:hover, .nav-tabs > li > a:hover, .input-group-addon:hover { background: url('../images/pagetitle-bg.jpg') 0 100% cover; } .btn:not(btn-link), .nav-tabs > li > a { border-width: 2px; } .btn-link { border: none; background: none; } /* .table-striped > tbody > tr:nth-child(2n+1) > td, .table-striped > tbody > tr:nth-child(2n+1) > th {background: transparent url('@{imagePath}flakesptn3.jpg') } .table-striped > tbody > tr.success:nth-child(2n+1) > td, .table-striped > tbody > tr.success:nth-child(2n+1) > th {background: @state-success-bg; } .table-striped > tbody > tr.info:nth-child(2n+1) > td, .table-striped > tbody > tr.info:nth-child(2n+1) > th {background: @state-info-bg; } .table-striped > tbody > tr.warning:nth-child(2n+1) > td, .table-striped > tbody > tr.warning:nth-child(2n+1) > th {background: @state-warning-bg; } .table-striped > tbody > tr.danger:nth-child(2n+1) > td, .table-striped > tbody > tr.danger:nth-child(2n+1) > th {background: @state-danger-bg; }*/ .cssmenu_horiz li ul, .cssmenu_vert li ul { padding: 5px 0; margin: 2px 0 0; background: url('../images/flakesptn2.jpg'); border: 1px solid #c3d8ed; border: 1px solid #6a6a6a; border-radius: 4px; -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); -webkit-background-clip: padding-box; background-clip: padding-box; } .cssmenu_horiz li ul > li > a, .cssmenu_vert li ul > li > a { padding: 3px 20px; font-weight: normal; line-height: 1.42857143; color: #333333; } .cssmenu_horiz > li > a:hover, .cssmenu_vert > li > a:hover, .cssmenu_horiz ul > li > a:hover, .cssmenu_vert ul > li > a:hover, .cssmenu_horiz > li > a:focus, .cssmenu_vert > li > a:focus, .cssmenu_horiz ul > li > a:focus, .cssmenu_vert ul > li > a:focus { text-decoration: none; color: #262626; }
lgpl-2.1
laoduliu/QX
doc/doc/protocol-s2.html
5536
<html> <head> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <!--Generated by XBook. Do not edit!!!--> <!--Author: Just van den Broecke--> <!--Email: just@justobjects.nl--> <!--See www.justobjects.nl for more info--> <title>Protocol Services</title> <meta HTTP-EQUIV="Pragma" CONTENT="no-cache"> <style type="text/css" ID="DocStyles"> BODY, .MAIN, .ABSTRACT { background: #ffffff; color: #000066; line-height: 16px; font-size: 11px; font-family : Verdana, Helvetica, Arial, sans-serif; } .ABSTRACT { font-style : italic; font-family : Georgia, "Times New Roman", serif; } BODY { margin-left: 5%; margin-right: 24%; } .NAV { font-size: 11px; } H1, H2, H3, H4, H5, H6, .H7, .H8, .TITLE { color: #990033; } .TITLE { font-size: 24px; } H1 { font-size: 16px; } H2 { font-size: 14px; } H3 { font-size: 12px; } H4 { font-size: 11px; } H5 { font-style : italic; font-size: 11px; } H6 { font-style : italic; font-weight : normal; font-size: 11px; } .H7, .H8 { font-weight : normal; font-size: 11px; } .LISTING { background-color: #F0F0F0; color: #000000; font-size: 11px; font-family : "Courier New", Courier, monospaced; } </style> </head> <body marginwidth="0"> <table cellpadding="8" border="0"> <tr> <td> <div class="NAV"> <a href="protocol-s1.html">Previous</a> | <a href="protocol.html">Up</a> | <a href="protocol-s3.html">Next</a> </div> </td><td><i> <div class="NAV">Pushlets - Protocol Specification</div> </i></td><td> <div class="NAV"> <a href="protocol-toc.html">TOC</a> </div> </td> </tr> </table> <hr> <a name="A1265375183406"></a><A name="s2."></A> <h1>2. Protocol Services</h1> <div class="MAIN"> <P> Below is a summary of the Pushlet protocol services. </P> <table cellspacing="0" cellpadding="8" border="1"> <tr> <td rowspan="" colspan="" align="left"> <div class="MAIN"> <B><I>Service</I></B> </div> </td> <td rowspan="" colspan="" align="left"> <div class="MAIN"> <B><I>Description</I></B> </div> </td> </tr> <tr> <td rowspan="" colspan="" align="left"> <div class="MAIN"> <FONT FACE="courier">join</FONT> </div> </td> <td rowspan="" colspan="" align="left"> <div class="MAIN">Start a Pushlet session</div> </td> </tr> <tr> <td rowspan="" colspan="" align="left"> <div class="MAIN"> <FONT FACE="courier">leave</FONT> </div> </td> <td rowspan="" colspan="" align="left"> <div class="MAIN">Stop a Pushlet session</div> </td> </tr> <tr> <td rowspan="" colspan="" align="left"> <div class="MAIN"> <FONT FACE="courier">subscribe</FONT> </div> </td> <td rowspan="" colspan="" align="left"> <div class="MAIN">Subscribe to one or more subjects</div> </td> </tr> <tr> <td rowspan="" colspan="" align="left"> <div class="MAIN"> <FONT FACE="courier">unsubscribe</FONT> </div> </td> <td rowspan="" colspan="" align="left"> <div class="MAIN">Unsubscribe from one or more or all subjects</div> </td> </tr> <tr> <td rowspan="" colspan="" align="left"> <div class="MAIN"> <FONT FACE="courier">listen</FONT> </div> </td> <td rowspan="" colspan="" align="left"> <div class="MAIN">Open data channel and starts data streaming in one of three modes: <FONT FACE="courier">stream</FONT>, <FONT FACE="courier">pull</FONT> or <FONT FACE="courier">poll</FONT>. In pull or poll mode the server may provide so called <FONT FACE="courier">refresh</FONT> indications that the client should refresh this data stream request </div> </td> </tr> <tr> <td rowspan="" colspan="" align="left"> <div class="MAIN"> <FONT FACE="courier">join-listen</FONT> </div> </td> <td rowspan="" colspan="" align="left"> <div class="MAIN">One-request service to immediately join, subscribe and start streaming data events. After this service the state is similar as after <FONT FACE="courier">listen</FONT>. Simple and <A target="_new" href="http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm" CLASS="EXTLINK">RESTful</A> clients may use this one-shot service. </div> </td> </tr> <tr> <td rowspan="" colspan="" align="left"> <div class="MAIN"> <FONT FACE="courier">publish</FONT> </div> </td> <td rowspan="" colspan="" align="left"> <div class="MAIN"> Publish data event to be dispatched by the server. Clients may use this service to multicast or unicast events through the server. </div> </td> </tr> <tr> <td rowspan="" colspan="" align="left"> <div class="MAIN"> <FONT FACE="courier">heartbeat</FONT> </div> </td> <td rowspan="" colspan="" align="left"> <div class="MAIN">Indicate peer is alive</div> </td> </tr> </table> </div> <hr> <table cellpadding="8" border="0"> <tr> <td> <div class="NAV"> <a href="protocol-s1.html">Previous</a> | <a href="protocol.html">Up</a> | <a href="protocol-s3.html">Next</a> </div> </td><td><i> <div class="NAV">Pushlets - Protocol Specification</div> </i></td><td> <div class="NAV"> <a href="protocol-toc.html">TOC</a> </div> </td> </tr> </table> </body> </html>
lgpl-2.1
dudochkin-victor/libgogootouch
src/views/mlabelview.cpp
8685
/*************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (directui@nokia.com) ** ** This file is part of libmeegotouch. ** ** If you have questions regarding the use of this file, please contact ** Nokia at directui@nokia.com. ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation ** and appearing in the file LICENSE.LGPL included in the packaging ** of this file. ** ****************************************************************************/ #include "mlabelview.h" #include "mlabelview_p.h" #include "mlabelmodel.h" #include "mlabel.h" #include "mviewcreator.h" #include "mlocale.h" #include <QTextDocument> #include <QPixmapCache> #include <QAbstractTextDocumentLayout> #include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneResizeEvent> #include <QTimer> MLabelViewPrivate::MLabelViewPrivate() : MWidgetViewPrivate(), highlighterUpdateTimer(0) { impl = new MLabelViewSimple(this); } MLabelViewPrivate::~MLabelViewPrivate() { delete impl; delete highlighterUpdateTimer; } const MLabelModel *MLabelViewPrivate::model() const { Q_Q(const MLabelView); return q->model(); } const MLabelStyle *MLabelViewPrivate::style() const { Q_Q(const MLabelView); return q->style().operator ->(); } const QRectF MLabelViewPrivate::boundingRect() const { Q_Q(const MLabelView); return q->boundingRect(); } void MLabelViewPrivate::requestHighlighterUpdate(int interval) { Q_Q(MLabelView); if (!highlighterUpdateTimer) { highlighterUpdateTimer = new QTimer(); highlighterUpdateTimer->setSingleShot(true); QObject::connect(highlighterUpdateTimer, SIGNAL(timeout()), q, SLOT(_q_highlighterUpdateTimerExceeded())); } highlighterUpdateTimer->start(interval); } void MLabelViewPrivate::_q_highlighterUpdateTimerExceeded() { MLabelViewRich *labelViewRich = static_cast<MLabelViewRich*>(impl); labelViewRich->cleanupTiles(); controller->update(); } bool MLabelViewPrivate::displayAsRichText(QString text, Qt::TextFormat textFormat, int numberOfHighlighters) const { if (textFormat == Qt::RichText) { return true; } else if (textFormat == Qt::PlainText) { return false; } //Qt::mightBeRichText stops at the first line break text.replace("\n", " "); return Qt::mightBeRichText(text) || (numberOfHighlighters > 0); } void MLabelViewPrivate::autoSetTextDirection() { // Set text direction Qt::LayoutDirection textDirection = model()->textDirection(); if (textDirection == Qt::LayoutDirectionAuto) { switch (MLocale::defaultLayoutDirection()) { case Qt::LeftToRight: textDirection = Qt::LeftToRight; break; case Qt::RightToLeft: textDirection = Qt::RightToLeft; break; case Qt::LayoutDirectionAuto: default: textDirection = MLocale::directionForText(model()->text()); // look at the text content break; } } textOptions.setTextDirection(textDirection); // Set alignment Qt::Alignment alignment = model()->alignment(); if (textDirection == Qt::RightToLeft && !(alignment & Qt::AlignAbsolute)) { // Mirror horizontal alignment Qt::Alignment horAlignment = (alignment & Qt::AlignHorizontal_Mask); if (horAlignment & Qt::AlignRight) { horAlignment = Qt::AlignLeft; } else if (!(horAlignment & Qt::AlignHCenter)) { horAlignment = Qt::AlignRight; } alignment = (alignment & ~Qt::AlignHorizontal_Mask) | horAlignment; } textOptions.setAlignment(alignment); } MLabelView::MLabelView(MLabel *controller) : MWidgetView(new MLabelViewPrivate) { Q_D(MLabelView); d->controller = controller; } MLabelView::~MLabelView() { } void MLabelView::applyStyle() { MWidgetView::applyStyle(); Q_D(MLabelView); d->impl->markDirty(); d->impl->applyStyle(); const MLabelStyle* labelStyle = d->style(); d->paddedSize = size() - QSizeF(labelStyle->paddingLeft() + labelStyle->paddingRight(), labelStyle->paddingTop() + labelStyle->paddingBottom()); updateGeometry(); } void MLabelView::drawContents(QPainter *painter, const QStyleOptionGraphicsItem *option) const { Q_D(const MLabelView); Q_UNUSED(option); //Opacity for the label qreal oldOpacity = painter->opacity(); const MLabelStyle* labelStyle = d->style(); if (labelStyle->textOpacity() >= 0.0) painter->setOpacity(d->controller->effectiveOpacity() * labelStyle->textOpacity()); //give size adjusted with padding to the actual implementation class d->impl->drawContents(painter, d->paddedSize); painter->setOpacity(oldOpacity); } void MLabelView::resizeEvent(QGraphicsSceneResizeEvent *event) { MWidgetView::resizeEvent(event); Q_D(MLabelView); d->impl->markDirty(); const MLabelStyle* labelStyle = d->style(); QSizeF padding(labelStyle->paddingLeft() + labelStyle->paddingRight(), labelStyle->paddingTop() + labelStyle->paddingBottom()); d->paddedSize = event->newSize() - QSizeF(labelStyle->paddingLeft() + labelStyle->paddingRight(), labelStyle->paddingTop() + labelStyle->paddingBottom()); event->setOldSize(event->oldSize() - padding); event->setNewSize(d->paddedSize); if (d->impl->resizeEvent(event)) { updateGeometry(); } } QFont MLabelView::font() const { return style()->font(); } QSizeF MLabelView::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const { Q_D(const MLabelView); const MLabelStyle *s = static_cast<const MLabelStyle *>(style().operator ->()); QSizeF padding(s->paddingLeft() + s->paddingRight(), s->paddingTop() + s->paddingBottom()); return d->impl->sizeHint(which, constraint - padding) + padding; } void MLabelView::setupModel() { MWidgetView::setupModel(); Q_D(MLabelView); bool shouldBeRich = d->displayAsRichText(model()->text(), model()->textFormat(), model()->highlighters().size()); // Check has label type changed since last call to this method. Re-allocate label with correct type. if (d->impl->isRich() != shouldBeRich) { MLabelViewSimple* oldView = d->impl; if (shouldBeRich) d->impl = new MLabelViewRich(d); else d->impl = new MLabelViewSimple(d); delete oldView; } d->impl->setupModel(); d->impl->markDirty(); } void MLabelView::updateData(const QList<const char *>& modifications) { MWidgetView::updateData(modifications); Q_D(MLabelView); if (modifications.contains(MLabelModel::Text) || modifications.contains(MLabelModel::Highlighters) || modifications.contains(MLabelModel::TextFormat)) { // Check has label type changed since last call to this method. Re-allocate label with correct type. bool shouldBeRich = d->displayAsRichText(model()->text(), model()->textFormat(), model()->highlighters().size()); bool shouldBeSimple = !shouldBeRich; if ((shouldBeRich && !d->impl->isRich()) || (shouldBeSimple && d->impl->isRich())) { MLabelViewSimple* oldView = d->impl; if (shouldBeRich) d->impl = new MLabelViewRich(d); else d->impl = new MLabelViewSimple(d); delete oldView; d->impl->setupModel(); } } if (d->impl->updateData(modifications)) updateGeometry(); d->impl->markDirty(); update(); } void MLabelView::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(MLabelView); d->impl->mousePressEvent(event); } void MLabelView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_D(MLabelView); d->impl->mouseReleaseEvent(event); } void MLabelView::cancelEvent(MCancelEvent *event) { Q_D(MLabelView); d->impl->cancelEvent(event); } void MLabelView::longPressEvent(QGraphicsSceneContextMenuEvent *event) { event->ignore(); } void MLabelView::tapAndHoldGestureEvent(QGestureEvent *event, QTapAndHoldGesture* gesture) { Q_D(MLabelView); d->impl->longPressEvent(event,gesture); } void MLabelView::orientationChangeEvent(MOrientationChangeEvent *event) { Q_D(MLabelView); MWidgetView::orientationChangeEvent(event); d->impl->orientationChangeEvent(event); } M_REGISTER_VIEW_NEW(MLabelView, MLabel) #include "moc_mlabelview.cpp"
lgpl-2.1
d-plaindoux/fluent-rest
fluent_rest/runtime/response.py
1628
# Copyright (C)2016 D. Plaindoux. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2, or (at your option) any # later version. class WebException(Exception): def __init__(self, status, message=None): Exception.__init__(self) self.status = status self.message = message @staticmethod def get(status): switcher = { 400: WebException.badRequest, 401: WebException.unauthorized, 402: WebException.paymentRequired, 404: WebException.notFound, 406: WebException.notAcceptable } return switcher.get(status, lambda m: WebException(status, m)) @staticmethod def badRequest(message=None): return WebException(400, "Bad request" if message is None else message) @staticmethod def unauthorized(message=None): return WebException(401, "Unauthorized" if message is None else message) @staticmethod def paymentRequired(message=None): return WebException(402, "Payment Required" if message is None else message) @staticmethod def notFound(message=None): return WebException(404, "Not found" if message is None else message) @staticmethod def notAcceptable(message=None): return WebException(406, "Not acceptable" if message is None else message)
lgpl-2.1
tzlaine/GG
src/adobe/basic_sheet.cpp
10637
/* Copyright 2005-2007 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://stlab.adobe.com/licenses.html) */ /*************************************************************************************************/ #include <GG/adobe/basic_sheet.hpp> #include <GG/adobe/dictionary.hpp> #include <GG/adobe/string.hpp> #include <GG/adobe/algorithm/for_each.hpp> #include <GG/adobe/future/widgets/headers/widget_tokens.hpp> #include <GG/adobe/future/widgets/headers/factory.hpp> #include <GG/ExpressionWriter.h> #include <stdexcept> /*************************************************************************************************/ namespace { /*************************************************************************************************/ bool is_container(adobe::name_t wnd_type) { return wnd_type == adobe::name_dialog || wnd_type == adobe::name_group || wnd_type == adobe::name_radio_button_group || wnd_type == adobe::name_tab_group || wnd_type == adobe::name_overlay || wnd_type == adobe::name_panel || wnd_type == adobe::name_row || wnd_type == adobe::name_column; } /*************************************************************************************************/ } /*************************************************************************************************/ namespace adobe { /*************************************************************************************************/ void basic_sheet_t::add_constant(name_t name, const line_position_t& position, const array_t& initializer, const any_regular_t& value) { if (added_elements_m.empty() || added_elements_m.back().which() != 0 || boost::get<added_cell_set_t>(added_elements_m.back()).access_m != access_constant) { added_elements_m.push_back(added_cell_set_t(access_constant)); } boost::get<added_cell_set_t>(added_elements_m.back()).added_cells_m.push_back( cell_parameters_t(name, position, initializer) ); constant_cell_set_m.push_back(cell_t(value)); const cell_t* cell(&constant_cell_set_m.back()); variable_index_m.insert(std::make_pair(name.c_str(), cell)); } /*************************************************************************************************/ void basic_sheet_t::add_interface(name_t name, const line_position_t& position, const array_t& initializer, const any_regular_t& value) { if (added_elements_m.empty() || added_elements_m.back().which() != 0 || boost::get<added_cell_set_t>(added_elements_m.back()).access_m != access_interface) { added_elements_m.push_back(added_cell_set_t(access_constant)); } boost::get<added_cell_set_t>(added_elements_m.back()).added_cells_m.push_back( cell_parameters_t(name, position, initializer) ); interface_cell_set_m.push_back(interface_cell_t(value)); interface_cell_t* cell(&interface_cell_set_m.back()); variable_index_m.insert(std::make_pair(name.c_str(), cell)); interface_index_m.insert(std::make_pair(name.c_str(), cell)); } /*************************************************************************************************/ void basic_sheet_t::add_view(const boost::any& parent_, name_t name, const line_position_t& position, const array_t& initializer, const boost::any& view_) { if (added_elements_m.empty() || added_elements_m.back().which() != 1) added_elements_m.push_back(added_view_set_t()); added_view_set_t& added_view_set = boost::get<added_view_set_t>(added_elements_m.back()); GG::Wnd* parent = boost::any_cast<widget_node_t>(parent_).display_token_m; GG::Wnd* view = boost::any_cast<widget_node_t>(view_).display_token_m; view_parameters_t params(view, position, name, initializer); if (!added_view_set.m_current_nested_view) { added_view_set.m_nested_views = nested_views_t(params, 0); added_view_set.m_current_nested_view = &added_view_set.m_nested_views; } else { while (added_view_set.m_current_nested_view->m_view_parameters.m_parent != parent && added_view_set.m_current_nested_view->m_nested_view_parent) { added_view_set.m_current_nested_view = added_view_set.m_current_nested_view->m_nested_view_parent; } assert(added_view_set.m_current_nested_view); const bool container = is_container(name); if (container) params.m_parent = parent; added_view_set.m_current_nested_view->m_children.push_back( nested_views_t(params, added_view_set.m_current_nested_view) ); if (container) { added_view_set.m_current_nested_view = &added_view_set.m_current_nested_view->m_children.back(); } } } /*************************************************************************************************/ std::size_t basic_sheet_t::count_interface(name_t name) const { return interface_index_m.count(name.c_str()); } /*************************************************************************************************/ basic_sheet_t::connection_t basic_sheet_t::monitor_value(name_t name, const monitor_value_t& monitor) { interface_cell_t* cell(lookup_interface(name)); monitor(cell->value_m); return (cell->monitor_value_m.connect(monitor)); } /*************************************************************************************************/ void basic_sheet_t::set(const dictionary_t& cell_set) { dictionary_t::const_iterator iter(cell_set.begin()); dictionary_t::const_iterator last(cell_set.end()); for (; iter != last; ++iter) set(iter->first, iter->second); } /*************************************************************************************************/ void basic_sheet_t::set(name_t name, const any_regular_t& value) { interface_cell_t* cell(lookup_interface(name)); cell->value_m = value; cell->monitor_value_m(value); } /*************************************************************************************************/ const any_regular_t& basic_sheet_t::operator[](name_t name) const { variable_index_t::const_iterator iter(variable_index_m.find(name.c_str())); if (iter == variable_index_m.end()) { std::string error("basic_sheet_t variable cell does not exist: "); error << name.c_str(); throw std::logic_error(error); } return iter->second->value_m; } /*************************************************************************************************/ adobe::dictionary_t basic_sheet_t::contributing() const { interface_index_t::const_iterator iter(interface_index_m.begin()); interface_index_t::const_iterator last(interface_index_m.end()); adobe::dictionary_t result; for (; iter != last; ++iter) result.insert(std::make_pair(adobe::name_t(iter->first), iter->second->value_m)); return result; } /*************************************************************************************************/ void basic_sheet_t::print(std::ostream& os) const { os << "layout name_ignored\n" << "{\n"; for (std::size_t i = 0; i < added_elements_m.size(); ++i) { if (i) os << '\n'; if (added_elements_m[i].which() == 0) { const added_cell_set_t& cell_set = boost::get<added_cell_set_t>(added_elements_m[i]); switch (cell_set.access_m) { case access_constant: os << "constant:\n"; break; case access_interface: os << "interface:\n"; break; } for (std::size_t j = 0; j < cell_set.added_cells_m.size(); ++j) { const cell_parameters_t& params = cell_set.added_cells_m[j]; // TODO: print detailed comment os << " " << params.name_m << " : " << GG::WriteExpression(params.initializer_m) << ";\n"; // TODO: print brief comment } } else { const added_view_set_t& view_set = boost::get<added_view_set_t>(added_elements_m[i]); os << " view "; print_nested_view(os, view_set.m_nested_views, 1); } } os << "}\n"; } /*************************************************************************************************/ void basic_sheet_t::print_nested_view(std::ostream& os, const nested_views_t& nested_view, unsigned int indent) const { const view_parameters_t& params = nested_view.m_view_parameters; // TODO: print detailed comment std::string initial_indent(indent * 4, ' '); if (indent == 1u) initial_indent.clear(); std::string param_string = GG::WriteExpression(params.m_parameters); os << initial_indent << params.m_name << '(' << param_string.substr(1, param_string.size() - 3) << ')'; if (nested_view.m_children.empty()) { if (indent == 1u) { os << "\n" // TODO: print brief comment << " {}\n"; } else { os << ";\n"; // TODO: print brief comment } } else { // TODO: print brief comment os << '\n' << std::string(indent * 4, ' ') << "{\n"; for (std::size_t i = 0; i < nested_view.m_children.size(); ++i) { print_nested_view(os, nested_view.m_children[i], indent + 1); } os << std::string(indent * 4, ' ') << "}\n"; } } /*************************************************************************************************/ basic_sheet_t::interface_cell_t* basic_sheet_t::lookup_interface(name_t name) { interface_index_t::iterator iter(interface_index_m.find(name.c_str())); if (iter == interface_index_m.end()) { std::string error("basic_sheet_t interface cell does not exist: "); error << name.c_str(); throw std::logic_error(error); } return iter->second; } /*************************************************************************************************/ } // namespace adobe /*************************************************************************************************/
lgpl-2.1
1fechner/FeatureExtractor
sources/FeatureExtractor/lib/hibernate-release-5.1.0.Final/project/hibernate-core/src/main/java/org/hibernate/loader/plan/build/spi/QuerySpaceTreePrinter.java
11114
/* * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ package org.hibernate.loader.plan.build.spi; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.io.PrintWriter; import org.hibernate.internal.util.StringHelper; import org.hibernate.loader.EntityAliases; import org.hibernate.loader.plan.exec.spi.AliasResolutionContext; import org.hibernate.loader.plan.exec.spi.CollectionReferenceAliases; import org.hibernate.loader.plan.exec.spi.EntityReferenceAliases; import org.hibernate.loader.plan.spi.CollectionQuerySpace; import org.hibernate.loader.plan.spi.CompositeQuerySpace; import org.hibernate.loader.plan.spi.EntityQuerySpace; import org.hibernate.loader.plan.spi.Join; import org.hibernate.loader.plan.spi.JoinDefinedByMetadata; import org.hibernate.loader.plan.spi.QuerySpace; import org.hibernate.loader.plan.spi.QuerySpaces; /** * Prints a {@link QuerySpaces} graph as a tree structure. * <p/> * Intended for use in debugging, logging, etc. * * @author Steve Ebersole */ public class QuerySpaceTreePrinter { /** * Singleton access */ public static final QuerySpaceTreePrinter INSTANCE = new QuerySpaceTreePrinter(); private QuerySpaceTreePrinter() { } /** * Returns a String containing the {@link QuerySpaces} graph as a tree structure. * * @param spaces The {@link QuerySpaces} object. * @param aliasResolutionContext The context for resolving table and column aliases * for the {@link QuerySpace} references in <code>spaces</code>; if null, * table and column aliases are not included in returned value.. * @return the String containing the {@link QuerySpaces} graph as a tree structure. */ public String asString(QuerySpaces spaces, AliasResolutionContext aliasResolutionContext) { return asString( spaces, 0, aliasResolutionContext ); } /** * Returns a String containing the {@link QuerySpaces} graph as a tree structure, starting * at a particular depth. * * The value for depth indicates the number of indentations that will * prefix all lines in the returned String. Root query spaces will be written with depth + 1 * and the depth will be further incremented as joined query spaces are traversed. * * An indentation is defined as the number of characters defined by {@link TreePrinterHelper#INDENTATION}. * * @param spaces The {@link QuerySpaces} object. * @param depth The intial number of indentations * @param aliasResolutionContext The context for resolving table and column aliases * for the {@link QuerySpace} references in <code>spaces</code>; if null, * table and column aliases are not included in returned value.. * @return the String containing the {@link QuerySpaces} graph as a tree structure. */ public String asString(QuerySpaces spaces, int depth, AliasResolutionContext aliasResolutionContext) { final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final PrintStream printStream = new PrintStream( byteArrayOutputStream ); write( spaces, depth, aliasResolutionContext, printStream ); printStream.flush(); return new String( byteArrayOutputStream.toByteArray() ); } /** * Returns a String containing the {@link QuerySpaces} graph as a tree structure, starting * at a particular depth. * * The value for depth indicates the number of indentations that will * prefix all lines in the returned String. Root query spaces will be written with depth + 1 * and the depth will be further incremented as joined query spaces are traversed. * * An indentation is defined as the number of characters defined by {@link TreePrinterHelper#INDENTATION}. * * @param spaces The {@link QuerySpaces} object. * @param depth The intial number of indentations * @param aliasResolutionContext The context for resolving table and column aliases * for the {@link QuerySpace} references in <code>spaces</code>; if null, * table and column aliases are not included in returned value. * @param printStream The print stream for writing. */ public void write( QuerySpaces spaces, int depth, AliasResolutionContext aliasResolutionContext, PrintStream printStream) { write( spaces, depth, aliasResolutionContext, new PrintWriter( printStream ) ); } /** * Returns a String containing the {@link QuerySpaces} graph as a tree structure, starting * at a particular depth. * * The value for depth indicates the number of indentations that will * prefix all lines in the returned String. Root query spaces will be written with depth + 1 * and the depth will be further incremented as joined query spaces are traversed. * * An indentation is defined as the number of characters defined by {@link TreePrinterHelper#INDENTATION}. * * @param spaces The {@link QuerySpaces} object. * @param depth The intial number of indentations * @param aliasResolutionContext The context for resolving table and column aliases * for the {@link QuerySpace} references in <code>spaces</code>; if null, * table and column aliases are not included in returned value. * @param printWriter The print writer for writing. */ public void write( QuerySpaces spaces, int depth, AliasResolutionContext aliasResolutionContext, PrintWriter printWriter) { if ( spaces == null ) { printWriter.println( "QuerySpaces is null!" ); return; } printWriter.println( TreePrinterHelper.INSTANCE.generateNodePrefix( depth ) + "QuerySpaces" ); for ( QuerySpace querySpace : spaces.getRootQuerySpaces() ) { writeQuerySpace( querySpace, depth + 1, aliasResolutionContext, printWriter ); } printWriter.flush(); } private void writeQuerySpace( QuerySpace querySpace, int depth, AliasResolutionContext aliasResolutionContext, PrintWriter printWriter) { generateDetailLines( querySpace, depth, aliasResolutionContext, printWriter ); writeJoins( querySpace.getJoins(), depth + 1, aliasResolutionContext, printWriter ); } final int detailDepthOffset = 1; private void generateDetailLines( QuerySpace querySpace, int depth, AliasResolutionContext aliasResolutionContext, PrintWriter printWriter) { printWriter.println( TreePrinterHelper.INSTANCE.generateNodePrefix( depth ) + extractDetails( querySpace ) ); if ( aliasResolutionContext == null ) { return; } printWriter.println( TreePrinterHelper.INSTANCE.generateNodePrefix( depth + detailDepthOffset ) + "SQL table alias mapping - " + aliasResolutionContext.resolveSqlTableAliasFromQuerySpaceUid( querySpace.getUid() ) ); final EntityReferenceAliases entityAliases = aliasResolutionContext.resolveEntityReferenceAliases( querySpace.getUid() ); final CollectionReferenceAliases collectionReferenceAliases = aliasResolutionContext.resolveCollectionReferenceAliases( querySpace.getUid() ); if ( entityAliases != null ) { printWriter.println( TreePrinterHelper.INSTANCE.generateNodePrefix( depth + detailDepthOffset ) + "alias suffix - " + entityAliases.getColumnAliases().getSuffix() ); printWriter.println( TreePrinterHelper.INSTANCE.generateNodePrefix( depth + detailDepthOffset ) + "suffixed key columns - {" + StringHelper.join( ", ", entityAliases.getColumnAliases().getSuffixedKeyAliases() ) + "}" ); } if ( collectionReferenceAliases != null ) { printWriter.println( TreePrinterHelper.INSTANCE.generateNodePrefix( depth + detailDepthOffset ) + "alias suffix - " + collectionReferenceAliases.getCollectionColumnAliases().getSuffix() ); printWriter.println( TreePrinterHelper.INSTANCE.generateNodePrefix( depth + detailDepthOffset ) + "suffixed key columns - {" + StringHelper.join( ", ", collectionReferenceAliases.getCollectionColumnAliases().getSuffixedKeyAliases() ) + "}" ); final EntityAliases elementAliases = collectionReferenceAliases.getEntityElementAliases() == null ? null : collectionReferenceAliases.getEntityElementAliases().getColumnAliases(); if ( elementAliases != null ) { printWriter.println( TreePrinterHelper.INSTANCE.generateNodePrefix( depth + detailDepthOffset ) + "entity-element alias suffix - " + elementAliases.getSuffix() ); printWriter.println( TreePrinterHelper.INSTANCE.generateNodePrefix( depth + detailDepthOffset ) + elementAliases.getSuffix() + "entity-element suffixed key columns - " + StringHelper.join( ", ", elementAliases.getSuffixedKeyAliases() ) ); } } } private void writeJoins( Iterable<Join> joins, int depth, AliasResolutionContext aliasResolutionContext, PrintWriter printWriter) { for ( Join join : joins ) { printWriter.println( TreePrinterHelper.INSTANCE.generateNodePrefix( depth ) + extractDetails( join ) ); writeQuerySpace( join.getRightHandSide(), depth+1, aliasResolutionContext, printWriter ); } } /** * Returns a String containing high-level details about the {@link QuerySpace}, such as: * <ul> * <li>query space class name</li> * <li>unique ID</li> * <li>entity name (for {@link EntityQuerySpace}</li> * <li>collection role (for {@link CollectionQuerySpace}</li> * * </ul> * @param space The query space * @return a String containing details about the {@link QuerySpace} */ public String extractDetails(QuerySpace space) { if ( EntityQuerySpace.class.isInstance( space ) ) { final EntityQuerySpace entityQuerySpace = (EntityQuerySpace) space; return String.format( "%s(uid=%s, entity=%s)", entityQuerySpace.getClass().getSimpleName(), entityQuerySpace.getUid(), entityQuerySpace.getEntityPersister().getEntityName() ); } else if ( CompositeQuerySpace.class.isInstance( space ) ) { final CompositeQuerySpace compositeQuerySpace = (CompositeQuerySpace) space; return String.format( "%s(uid=%s)", compositeQuerySpace.getClass().getSimpleName(), compositeQuerySpace.getUid() ); } else if ( CollectionQuerySpace.class.isInstance( space ) ) { final CollectionQuerySpace collectionQuerySpace = (CollectionQuerySpace) space; return String.format( "%s(uid=%s, collection=%s)", collectionQuerySpace.getClass().getSimpleName(), collectionQuerySpace.getUid(), collectionQuerySpace.getCollectionPersister().getRole() ); } return space.toString(); } private String extractDetails(Join join) { return String.format( "JOIN (%s) : %s -> %s", determineJoinType( join ), join.getLeftHandSide().getUid(), join.getRightHandSide().getUid() ); } private String determineJoinType(Join join) { if ( JoinDefinedByMetadata.class.isInstance( join ) ) { return "JoinDefinedByMetadata(" + ( (JoinDefinedByMetadata) join ).getJoinedPropertyName() + ")"; } return join.getClass().getSimpleName(); } }
lgpl-2.1
colede/qtcreator
src/plugins/android/androiddeployqtwidget.cpp
14080
/************************************************************************** ** ** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com> ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "androiddeployqtwidget.h" #include "ui_androiddeployqtwidget.h" #include "androidcreatekeystorecertificate.h" #include "androiddeployqtstep.h" #include "androidmanager.h" #include "createandroidmanifestwizard.h" #include "androidextralibrarylistmodel.h" #include <projectexplorer/target.h> #include <qmakeprojectmanager/qmakebuildconfiguration.h> #include <qmakeprojectmanager/qmakeproject.h> #include <qmakeprojectmanager/qmakenodes.h> #include <utils/fancylineedit.h> #include <utils/pathchooser.h> #include <QFileDialog> #include <algorithm> using namespace Android; using namespace Internal; AndroidDeployQtWidget::AndroidDeployQtWidget(AndroidDeployQtStep *step) : ProjectExplorer::BuildStepConfigWidget(), m_ui(new Ui::AndroidDeployQtWidget), m_step(step), m_currentBuildConfiguration(0), m_ignoreChange(false) { m_ui->setupUi(this); // Target sdk combobox int minApiLevel = 9; QStringList targets = AndroidConfig::apiLevelNamesFor(AndroidConfigurations::currentConfig().sdkTargets(minApiLevel)); m_ui->targetSDKComboBox->addItems(targets); m_ui->targetSDKComboBox->setCurrentIndex(targets.indexOf(step->buildTargetSdk())); // deployment option switch (m_step->deployAction()) { case AndroidDeployQtStep::MinistroDeployment: m_ui->ministroOption->setChecked(true); break; case AndroidDeployQtStep::DebugDeployment: m_ui->temporaryQtOption->setChecked(true); break; case AndroidDeployQtStep::BundleLibrariesDeployment: m_ui->bundleQtOption->setChecked(true); break; default: // can't happen break; } // signing m_ui->signPackageCheckBox->setChecked(m_step->signPackage()); m_ui->KeystoreLocationPathChooser->setExpectedKind(Utils::PathChooser::File); m_ui->KeystoreLocationPathChooser->lineEdit()->setReadOnly(true); m_ui->KeystoreLocationPathChooser->setPath(m_step->keystorePath().toUserOutput()); m_ui->KeystoreLocationPathChooser->setInitialBrowsePathBackup(QDir::homePath()); m_ui->KeystoreLocationPathChooser->setPromptDialogFilter(tr("Keystore files (*.keystore *.jks)")); m_ui->KeystoreLocationPathChooser->setPromptDialogTitle(tr("Select keystore file")); m_ui->signingDebugWarningIcon->hide(); m_ui->signingDebugWarningLabel->hide(); signPackageCheckBoxToggled(m_step->signPackage()); m_ui->verboseOutputCheckBox->setChecked(m_step->verboseOutput()); m_ui->openPackageLocationCheckBox->setChecked(m_step->openPackageLocation()); bool oldFiles = AndroidManager::checkForQt51Files(m_step->project()->projectDirectory().toString()); m_ui->oldFilesWarningIcon->setVisible(oldFiles); m_ui->oldFilesWarningLabel->setVisible(oldFiles); // target sdk connect(m_ui->targetSDKComboBox, SIGNAL(activated(QString)), SLOT(setTargetSdk(QString))); // deployment options connect(m_ui->ministroOption, SIGNAL(clicked()), SLOT(setMinistro())); connect(m_ui->temporaryQtOption, SIGNAL(clicked()), SLOT(setDeployLocalQtLibs())); connect(m_ui->bundleQtOption, SIGNAL(clicked()), SLOT(setBundleQtLibs())); connect(m_ui->installMinistroButton, SIGNAL(clicked()), SLOT(installMinistro())); connect(m_ui->cleanLibsPushButton, SIGNAL(clicked()), SLOT(cleanLibsOnDevice())); connect(m_ui->resetDefaultDevices, SIGNAL(clicked()), SLOT(resetDefaultDevices())); connect(m_ui->openPackageLocationCheckBox, SIGNAL(toggled(bool)), this, SLOT(openPackageLocationCheckBoxToggled(bool))); connect(m_ui->verboseOutputCheckBox, SIGNAL(toggled(bool)), this, SLOT(verboseOutputCheckBoxToggled(bool))); //signing connect(m_ui->signPackageCheckBox, SIGNAL(toggled(bool)), this, SLOT(signPackageCheckBoxToggled(bool))); connect(m_ui->KeystoreCreatePushButton, SIGNAL(clicked()), this, SLOT(createKeyStore())); connect(m_ui->KeystoreLocationPathChooser, SIGNAL(pathChanged(QString)), SLOT(updateKeyStorePath(QString))); connect(m_ui->certificatesAliasComboBox, SIGNAL(activated(QString)), this, SLOT(certificatesAliasComboBoxActivated(QString))); connect(m_ui->certificatesAliasComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(certificatesAliasComboBoxCurrentIndexChanged(QString))); activeBuildConfigurationChanged(); connect(m_step->target(), SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), this, SLOT(activeBuildConfigurationChanged())); connect(m_ui->inputFileComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(inputFileComboBoxIndexChanged())); updateInputFileUi(); connect(m_step, SIGNAL(inputFileChanged()), this, SLOT(updateInputFileUi())); connect(m_ui->createAndroidManifestButton, SIGNAL(clicked()), this, SLOT(createManifestButton())); m_extraLibraryListModel = new AndroidExtraLibraryListModel(static_cast<QmakeProjectManager::QmakeProject *>(m_step->project()), this); m_ui->androidExtraLibsListView->setModel(m_extraLibraryListModel); connect(m_ui->androidExtraLibsListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(checkEnableRemoveButton())); connect(m_ui->addAndroidExtraLibButton, SIGNAL(clicked()), this, SLOT(addAndroidExtraLib())); connect(m_ui->removeAndroidExtraLibButton, SIGNAL(clicked()), this, SLOT(removeAndroidExtraLib())); connect(m_extraLibraryListModel, SIGNAL(enabledChanged(bool)), m_ui->additionalLibrariesGroupBox, SLOT(setEnabled(bool))); m_ui->additionalLibrariesGroupBox->setEnabled(m_extraLibraryListModel->isEnabled()); } AndroidDeployQtWidget::~AndroidDeployQtWidget() { delete m_ui; } void AndroidDeployQtWidget::createManifestButton() { CreateAndroidManifestWizard wizard(m_step->target()); wizard.exec(); } void AndroidDeployQtWidget::updateInputFileUi() { QmakeProjectManager::QmakeProject *project = static_cast<QmakeProjectManager::QmakeProject *>(m_step->project()); QList<QmakeProjectManager::QmakeProFileNode *> nodes = project->applicationProFiles(); int size = nodes.size(); if (size == 0 || size == 1) { // there's nothing to select, e.g. before parsing m_ui->inputFileLabel->setVisible(false); m_ui->inputFileComboBox->setVisible(false); } else { m_ignoreChange = true; m_ui->inputFileLabel->setVisible(true); m_ui->inputFileComboBox->setVisible(true); m_ui->inputFileComboBox->clear(); foreach (QmakeProjectManager::QmakeProFileNode *node, nodes) m_ui->inputFileComboBox->addItem(node->displayName(), node->path()); int index = m_ui->inputFileComboBox->findData(m_step->proFilePathForInputFile()); m_ui->inputFileComboBox->setCurrentIndex(index); m_ignoreChange = false; } } void AndroidDeployQtWidget::inputFileComboBoxIndexChanged() { if (m_ignoreChange) return; QString proFilePath = m_ui->inputFileComboBox->itemData(m_ui->inputFileComboBox->currentIndex()).toString(); m_step->setProFilePathForInputFile(proFilePath); } QString AndroidDeployQtWidget::displayName() const { return tr("<b>Deploy configurations</b>"); } QString AndroidDeployQtWidget::summaryText() const { return displayName(); } void AndroidDeployQtWidget::setTargetSdk(const QString &sdk) { m_step->setBuildTargetSdk(sdk); } void AndroidDeployQtWidget::setMinistro() { m_step->setDeployAction(AndroidDeployQtStep::MinistroDeployment); } void AndroidDeployQtWidget::setDeployLocalQtLibs() { m_step->setDeployAction(AndroidDeployQtStep::DebugDeployment); } void AndroidDeployQtWidget::setBundleQtLibs() { m_step->setDeployAction(AndroidDeployQtStep::BundleLibrariesDeployment); } void AndroidDeployQtWidget::installMinistro() { QString packagePath = QFileDialog::getOpenFileName(this, tr("Qt Android Smart Installer"), QDir::homePath(), tr("Android package (*.apk)")); if (!packagePath.isEmpty()) AndroidManager::installQASIPackage(m_step->target(), packagePath); } void AndroidDeployQtWidget::cleanLibsOnDevice() { AndroidManager::cleanLibsOnDevice(m_step->target()); } void AndroidDeployQtWidget::resetDefaultDevices() { AndroidConfigurations::clearDefaultDevices(m_step->project()); } void AndroidDeployQtWidget::signPackageCheckBoxToggled(bool checked) { m_ui->certificatesAliasComboBox->setEnabled(checked); m_step->setSignPackage(checked); updateSigningWarning(); if (!checked) return; if (!m_step->keystorePath().isEmpty()) setCertificates(); } void AndroidDeployQtWidget::createKeyStore() { AndroidCreateKeystoreCertificate d; if (d.exec() != QDialog::Accepted) return; m_ui->KeystoreLocationPathChooser->setPath(d.keystoreFilePath().toUserOutput()); m_step->setKeystorePath(d.keystoreFilePath()); m_step->setKeystorePassword(d.keystorePassword()); m_step->setCertificateAlias(d.certificateAlias()); m_step->setCertificatePassword(d.certificatePassword()); setCertificates(); } void AndroidDeployQtWidget::setCertificates() { QAbstractItemModel *certificates = m_step->keystoreCertificates(); m_ui->signPackageCheckBox->setChecked(certificates); m_ui->certificatesAliasComboBox->setModel(certificates); } void AndroidDeployQtWidget::updateKeyStorePath(const QString &path) { Utils::FileName file = Utils::FileName::fromString(path); m_step->setKeystorePath(file); m_ui->signPackageCheckBox->setChecked(!file.isEmpty()); if (!file.isEmpty()) setCertificates(); } void AndroidDeployQtWidget::certificatesAliasComboBoxActivated(const QString &alias) { if (alias.length()) m_step->setCertificateAlias(alias); } void AndroidDeployQtWidget::certificatesAliasComboBoxCurrentIndexChanged(const QString &alias) { if (alias.length()) m_step->setCertificateAlias(alias); } void AndroidDeployQtWidget::openPackageLocationCheckBoxToggled(bool checked) { m_step->setOpenPackageLocation(checked); } void AndroidDeployQtWidget::verboseOutputCheckBoxToggled(bool checked) { m_step->setVerboseOutput(checked); } void AndroidDeployQtWidget::activeBuildConfigurationChanged() { if (m_currentBuildConfiguration) disconnect(m_currentBuildConfiguration, SIGNAL(qmakeBuildConfigurationChanged()), this, SLOT(updateSigningWarning())); updateSigningWarning(); QmakeProjectManager::QmakeBuildConfiguration *bc = qobject_cast<QmakeProjectManager::QmakeBuildConfiguration *>(m_step->target()->activeBuildConfiguration()); m_currentBuildConfiguration = bc; if (bc) connect(bc, SIGNAL(qmakeBuildConfigurationChanged()), this, SLOT(updateSigningWarning())); m_currentBuildConfiguration = bc; } void AndroidDeployQtWidget::updateSigningWarning() { QmakeProjectManager::QmakeBuildConfiguration *bc = qobject_cast<QmakeProjectManager::QmakeBuildConfiguration *>(m_step->target()->activeBuildConfiguration()); bool debug = bc && (bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild); if (m_step->signPackage() && debug) { m_ui->signingDebugWarningIcon->setVisible(true); m_ui->signingDebugWarningLabel->setVisible(true); } else { m_ui->signingDebugWarningIcon->setVisible(false); m_ui->signingDebugWarningLabel->setVisible(false); } } void AndroidDeployQtWidget::addAndroidExtraLib() { QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select additional libraries"), m_currentBuildConfiguration->target()->project()->projectDirectory().toString(), tr("Libraries (*.so)")); if (!fileNames.isEmpty()) m_extraLibraryListModel->addEntries(fileNames); } void AndroidDeployQtWidget::removeAndroidExtraLib() { QModelIndexList removeList = m_ui->androidExtraLibsListView->selectionModel()->selectedIndexes(); m_extraLibraryListModel->removeEntries(removeList); } void AndroidDeployQtWidget::checkEnableRemoveButton() { m_ui->removeAndroidExtraLibButton->setEnabled(m_ui->androidExtraLibsListView->selectionModel()->hasSelection()); }
lgpl-2.1
aliteralmind/xbnpe
main/_docs/basics/tpkc/build_proc_tech_info2.html
10945
<HTML><HEAD> <TITLE>XBNPE: TPKC build</TITLE> <meta name="viewport" content="width=device-width" /> </HEAD> <BODY BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#0000FF"><a name="top"></a> <a name="bldrgc"/><H2><CODE>[<A HREF="#top">top</A>]</CODE> &nbsp; TPKC-build: Before everything else: Manually creating the raw-global-configuration</H2> <P><UL> <LI><B>File:</B> <I>None</I></LI> <LI><B>Input:</B> Each category's command list.</LI> <LI><B>Output:</B> <CODE>zzXPSUB_DIR_tpkcRawCfgGlobal\[cat-abrv].txt</CODE></LI> </UL></P> <P>Before the TPKC project can be built, its &quot;Raw Global Command Configuration&quot; (or &quot;raw-global-config&quot;) must be created. This is a largely manual process--very little of it is automated. However, it is only necessary to do this <I>entire</I> process once. When a new version of TextPad is released, if it eliminates, adds, renames, or fundamentally changes any built-in command, these output files must be updated to reflect it--and then the TPKC project must be re-built.</P> <P>The raw-global-config is stored in <CODE>zzXPSUB_DIR_tpkcRawCfgGlobal</CODE></P> <P>This section documents the creation of the raw-global-config from <I>nothing</I>--as if it never existed.</P> <P><B>Steps, in order:</B><OL> <LI><CODE>[<FONT SIZE="+1"><B><A HREF="#creatergc_1ovrcfg">GO</A></B></FONT>]</CODE> Update the all-category-qbl</LI> <LI><CODE>[<FONT SIZE="+1"><B><A HREF="#creatergc_2catcfg">GO</A></B></FONT>]</CODE> Update category configuration</LI> <LI><CODE>[<FONT SIZE="+1"><B><A HREF="#creatergc_3rawglblcfg">GO</A></B></FONT>]</CODE> Create the raw-global-config</LI> </OL></P> <H4><U>Warning</U></H4> <P>The TPKC-build-process will fail if there are any empty-lines anywhere in the raw-global-config files.</P> <PRE> <HR/> </PRE> <a name="creatergc_1ovrcfg"/><H3>Step 1: Update the all-category-qbl</H3> <P>Update the all-category-qbl <BR> &nbsp; &nbsp; <CODE><A HREF="config_vars.html#zTpkcAllCategoryAbrvLCsQbl">zTpkcAllCategoryAbrvLCsQbl</A></CODE> <BR>to reflect the new category-list.</P> <PRE> <HR/> </PRE> <a name="creatergc_2catcfg"/><H3>Update category configuration</H3> <P>Update the <A HREF="config_vars.html#catcfg">category configuration</A>, to reflect the values in the all-category-qbl (<A HREF="config_vars.html#zTpkcAllCategoryAbrvLCsQbl"><CODE>zTpkcAllCategoryAbrvLCsQbl</CODE></A>). The command-list for each category can be retrieved via <BR> &nbsp; &nbsp; <CODE>TextPad &gt; Preferences &gt; Keyboard &gt; [one-category] &gt; [List-button]</CODE> <BR>and using only the values in the first column. Get the first column values by turning word-wrap off, checking <BR> &nbsp; &nbsp; <CODE>TextPad &gt; Configure &gt; Block Select Mode</CODE> <BR>and then selecting the column with the mouse. Alternatively, use this regex replacement:<UL> <LI><B>Find what:</B> <CODE>^([^ ]+) .+$</CODE></LI> <LI><B>Replace with:</B> <CODE>$1</CODE></LI> </UL></P> <P><I>To prepare for the next step (creating the raw-global-config), save this command-name column into <BR> &nbsp; &nbsp; <CODE>zzXPSUB_DIR_tpkcRawCfgGlobal\[cat-abrv].px.txt</CODE> <BR>where <CODE>[cat-abrv]</CODE> is as defined in the all-category-qbl (<A HREF="config_vars.html#zTpkcAllCategoryAbrvLCsQbl"><CODE>zTpkcAllCategoryAbrvLCsQbl</CODE></A>), </I></P> <P>Now close the document and continue with that same text remaining in the clipboard.</P> <H4><U>Creating the category's command list: <CODE><A HREF="config_vars.html#AllCmdsQbl">zTpkc[cat-abrv]AllCmdsQbl</A></CODE></U></H4> <P>In the category-confg file <BR> &nbsp; &nbsp; <B>-<CODE>zzXPSUB_DIR_tpkcConfigCategory\[cat-abrv].px.txt</CODE></B> <BR>replace the value of <BR> &nbsp; &nbsp; <CODE>zTpkc[cat-abrv]AllCmdsQbl</CODE> <BR>with the list currently in the clipboard. To transform this column of command names in to a Square-Bracketed List (qb-list) as expected, select the column and then use these two regex replacements:<OL> <LI>Surround each with square brackets:<UL> <LI><B>Find what:</B> <CODE>^(.+)$</CODE></LI> <LI><B>Replace with:</B> <CODE>[$1]</CODE></LI> </UL></LI> <LI>Eliminate all new-lines:<UL> <LI><B>Find what:</B> <CODE>\n</CODE></LI> <LI><B>Replace with:</B> <I>nothing</I></LI> </UL></LI> </OL></P> <a name="charcatcmdnameexception"/><H4><U>Command-name exception for 'Characters' category</U></H4> <P>The command names for the Characters category, as assigned by TextPad <BR> &nbsp; &nbsp; <CODE>TextPad &gt; Preferences &gt; Keyboard &gt; Categories &gt; <I>&quot;Characters&quot;</I> &gt; Commands</CODE> <BR>Are not appropriate for the TPKC project. This is the only category in which this is an issue. Instead, as of version 7.0.9, use <A HREF="../../../textpad__tpkc/for_v_7_0_9/documentation_and_scripts/_char_category_cmd_name_alternatives.txt">these alternatives</A>.</P> <P>Note each name starts with &quot;<CODE>Char##</CODE>&quot; (zero-padded for numbers less than ten), to ensure the ordering is exactly the same as the original list.</P> <PRE> <HR/> </PRE> <a name="creatergc_3rawglblcfg"/><H3>Create the raw-global-configuration</H3> <P>In the previous step, you duplicated the command-name column to <BR> &nbsp; &nbsp; <CODE>zzXPSUB_DIR_tpkcRawCfgGlobal\[cat-abrv].px.txt</CODE> <BR>After this final step, these files become the raw-global-config.</P> <P>For example (assuming TextPad version 7.0.9), here are the first five lines from <BR> &nbsp; &nbsp; <CODE>{#insert zzXPSUB_DIR_tpkcRawCfgGlobal}file.txt</CODE></P> <PRE>FileClose FileCloseAll FileExit FileGoTo FileManage</PRE> <P>This needs to be transformed to the following:</P> <PRE>FileClose zTPFileClose Fcls yes 50 (*NOTHING! No steps! This command is the top-most command in the list.*) FileCloseAll zTPFileCloseAll Fclsa {#insert zzEmptyStringMarker} 50 \\\{#DOWN\\\}\\\{#insert z5ThnTSlp\\\} FileExit zTPFileExit Fxit {#insert zzEmptyStringMarker} {#insert zzEmptyStringMarker} \\\{#DOWN -count 2\\\}\\\{#insert z5ThnTSlp\\\} FileGoTo zTPFileOpenSelPath Fgoto {#insert zzEmptyStringMarker} 100 \\\{#DOWN -count 3\\\}\\\{#insert z5ThnTSlp\\\} FileManage zTPFileManager Fmngr {#insert zzEmptyStringMarker} 50 \\\{#PGDN\\\}\\\{#insert z5ThnTSlp\\\}\\\{#UP -count 2\\\}\\\{#insert z5ThnTSlp\\\}</PRE> <P>Columns:<OL> <LI>Command name</LI> <LI>The default phrase name. This will be assigned to the <A HREF="config_vars.html#globalcmd">command-configuration</A> variable <BR> &nbsp; &nbsp; <CODE><A HREF="config_vars.html#DfltPhrsNm">zTpkc[abrv]DfltPhrsNm</A></CODE></LI> <LI>The command abbreviation: <BR> &nbsp; &nbsp; <CODE><A HREF="config_vars.html#Abrv1C">zTpkc[abrv]Abrv1C</A></CODE></LI> <LI>Is this a bootstrap command/does this command have a bootstrap key-command? If yes, &quot;<CODE>yes</CODE>&quot;, otherwise <CODE>''</CODE>. <BR> &nbsp; &nbsp; <CODE><A HREF="config_vars.html#IsBtstrp_yes">zTpkc[abrv]IsBtstrp_yes</A></CODE></LI> <LI>The specific navigational steps, from the top of its command-list <BR> &nbsp; &nbsp; <CODE>TextPad &gt; Preferences &gt; Keyboard &gt; [Category name] &gt; Commands</CODE> <BR>to <I>this</I> command. If this command <I>is</I> the top command, then this should be a comment saying so (empty-string is not allowed). Note that each step is a raw PhraseExpress function-call (and not its XBN-PhraseExpress alternative, such as <BR> &nbsp; &nbsp; <CODE>{#insert zDOWN}</CODE> <BR>), and each step is followed by a call to <CODE>z5ThnTSlp</CODE>. <BR> &nbsp; &nbsp; <CODE><A HREF="config_vars.html#StpsFrmCmdListTop">zTpkc[abrv]StpsFrmCmdListTop</A></CODE></LI> </OL></P> <H4><U>Notes on determining the values of each column</U></H4> <P><OL> <LI><B>Default phrase name:</B> At first, simply consider making this equal to <BR> &nbsp; &nbsp; <CODE>zTP[command-name]</CODE> <BR>then tailor as necessary.</LI> <LI><B>The command abbreviation:</B> You'll need to manually and individually decide on each abbreviation.</LI> <LI><B>Is this a bootstrap command?</B> Default to empty-string, then tailor as necessary.</LI> </OL></P> <P><B>Determining the go-to-command-from-list-top steps.</B></P> <P><OL> <LI>In each raw-config document, with word-wrap off and <BR> &nbsp; &nbsp; <CODE>Textpad &gt; Configure &gt; Block select mode</CODE> <BR>on (checked), copy the first column (the command names) from each document, and paste them all into a SINGLE document. Use <BR> &nbsp; &nbsp; <CODE>TextPad &gt; Configure &gt; Block Select Mode</CODE> <BR>to put them all into <A HREF="all_cmd_nms_2_cols.txt">two columns</A> (it looks much cleaner when viewed in TextPad).</LI> <LI>ALSO use these first-column texts to create each of the <CODE>[zTpkc*AllCmdsQbl]</CODE> (and its corresponding <CODE>[zTpkc*CmdCount]</CODE>) variables in <CODE>[zzXPSUB_DIR_tpkcConfigCategory]</CODE></LI> Print out this document and use it to determine the go-to-command-from-Commands-list-top, as demonstrated in <BR> &nbsp; &nbsp; <CODE><A HREF="all_cmd_nms_2_cols.pdf">all_cmd_nms_2_cols.pdf</A></CODE> <BR>Once all the <CODE>HOME</CODE>, <CODE>END</CODE>, <CODE>PGUP#</CODE>, and <CODE>PGDN#</CODE>-s are determined, the rest are simply an <CODE>UP#</CODE>-or-<CODE>DOWN#</CODE> away from that original <CODE>HOME</CODE> (or <CODE>END</CODE>, or <CODE>PGUP#</CODE>, or <CODE>PGDN#</CODE>). Use empty-lines and bookmarks to make this easier, as demonstrated here: <P><IMG SRC="../../images/basics/tpkc/assinging_each_cmd_to_gt_steps_from_list_top_starting_point.JPG"/></P> <LI>Using both <BR> &nbsp; &nbsp; <CODE>[zXPROOT_DIR_tpkcRawCfgGlobal][category-abrv].px.txt</CODE> <BR>and the concepts in this <A HREF="all_cmd_nms_2_cols.pdf">pdf</A>, write the go-to-cmd-from-list-top phrases. in the <I>last</I> column (in place of the &quot;<CODE>X<!---->XX</CODE>&quot;-s). Use raw PhraseExpress function calls and follow each with <CODE>[z5ThnSlp]</CODE>. For example: <BR> &nbsp; &nbsp; <CODE>\\\{#PGDN -count 3\\\}\\\{#insert z5ThnSlp\\\}\\\{#UP\\\}\\\{#insert z5ThnSlp\\\}</CODE></LI> <LI>This is now considered the TPKC's &quot;raw global configuration&quot;. It needs to be processed by <BR> &nbsp; &nbsp; <CODE>zTpkcCreateAllGlblCmdCfgFilesForAllCats</CODE></LI> </OL></P> <P><B>For categories where every command name starts with the same letter</B> (such as Edit and Window), the commands <CODE>END</CODE>, <CODE>PGDN</CODE>, and <CODE>PGUP</CODE> will be the basis. For example, to get to <CODE>EditCutLine</CODE>, use these steps: <BR> &nbsp; &nbsp; <CODE>\\\{#PGDN -count 3\\\}\\\{#insert z5ThnSlp\\\}\\\{#DOWN\\\}\\\{#insert z5ThnSlp\\\}</CODE></P> <P>For categories with commands having multiple starting characters (such as Search, Configure, and Cursor), the first character can be used in its place. For example, to get to <CODE>MatchBracketExtend</CODE>, use these steps: <BR> &nbsp; &nbsp; <CODE>m\\\{#insert z5ThnSlp\\\}\\\{#DOWN\\\}\\\{#insert z5ThnSlp\\\}</CODE></P> <PRE> </PRE> </BODY></HTML>
lgpl-2.1
abetv/jubatus
jubatus/core/fv_converter/num_filter_factory.hpp
1374
// Jubatus: Online machine learning framework for distributed environment // Copyright (C) 2011 Preferred Infrastructure and Nippon Telegraph and Telephone Corporation. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License version 2.1 as published by the Free Software Foundation. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #ifndef JUBATUS_CORE_FV_CONVERTER_NUM_FILTER_FACTORY_HPP_ #define JUBATUS_CORE_FV_CONVERTER_NUM_FILTER_FACTORY_HPP_ #include <string> #include <map> namespace jubatus { namespace core { namespace fv_converter { class num_filter; class num_filter_factory { public: num_filter* create( const std::string& name, const std::map<std::string, std::string>& params) const; }; } // namespace fv_converter } // namespace core } // namespace jubatus #endif // JUBATUS_CORE_FV_CONVERTER_NUM_FILTER_FACTORY_HPP_
lgpl-2.1
gambess/ERP-Arica
htdocs/ecm/search.php
8580
<?php /* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2008-2009 Regis Houssin <regis@dolibarr.fr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * \file htdocs/ecm/index.php * \ingroup ecm * \brief Main page for ECM section area * \version $Id: search.php,v 1.19 2011/07/31 23:50:55 eldy Exp $ * \author Laurent Destailleur */ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/ecm.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/treeview.lib.php"); require_once(DOL_DOCUMENT_ROOT."/ecm/class/ecmdirectory.class.php"); // Load traductions files $langs->load("ecm"); $langs->load("companies"); $langs->load("other"); $langs->load("users"); $langs->load("orders"); $langs->load("propal"); $langs->load("bills"); $langs->load("contracts"); // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'ecm',''); // Load permissions $user->getrights('ecm'); // Get parameters $socid = isset($_GET["socid"])?$_GET["socid"]:''; $action = isset($_GET["action"])?$_GET["action"]:$_POST['action']; $section=isset($_GET["section"])?$_GET["section"]:$_POST['section']; if (! $section) $section=0; $upload_dir = $conf->ecm->dir_output.'/'.$section; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="label"; $ecmdir = new ECMDirectory($db); if (! empty($_REQUEST["section"])) { $result=$ecmdir->fetch($_REQUEST["section"]); if (! $result > 0) { dol_print_error($db,$ecmdir->error); exit; } } /******************************************************************* * ACTIONS * * Put here all code to do according to value of "action" parameter ********************************************************************/ /******************************************************************* * PAGE * * Put here all code to do according to value of "action" parameter ********************************************************************/ llxHeader(); $form=new Form($db); $ecmdirstatic = new ECMDirectory($db); $userstatic = new User($db); // Ajout rubriques automatiques $rowspan=0; $sectionauto=array(); if ($conf->product->enabled || $conf->service->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>$conf->product->enabled, 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } if ($conf->societe->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } if ($conf->propal->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); } if ($conf->contrat->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } if ($conf->commande->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled,'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByOrders")); } if ($conf->facture->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } //*********************** // List //*********************** print_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("Search")); //print $langs->trans("ECMAreaDesc")."<br>"; //print $langs->trans("ECMAreaDesc2")."<br>"; //print "<br>\n"; print $langs->trans("FeatureNotYetAvailable").'.<br><br>'; if ($mesg) { print $mesg."<br>"; } // Tool bar $head = ecm_prepare_head_fm($fac); //dol_fiche_head($head, 'search_form', '', 1); print '<table class="border" width="100%"><tr><td width="40%" valign="top">'; // Left area //print_fiche_titre($langs->trans("ECMSectionsManual")); print '<form method="post" action="'.DOL_URL_ROOT.'/ecm/search.php">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<table class="nobordernopadding" width="100%">'; print "<tr class=\"liste_titre\">"; print '<td colspan="2">'.$langs->trans("ECMSearchByKeywords").'</td></tr>'; print "<tr ".$bc[false]."><td>".$langs->trans("Ref").':</td><td align="right"><input type="text" name="search_ref" class="flat" size="14"></td></tr>'; print "<tr ".$bc[false]."><td>".$langs->trans("Title").':</td><td align="right"><input type="text" name="search_title" class="flat" size="14"></td></tr>'; print "<tr ".$bc[false]."><td>".$langs->trans("Keyword").':</td><td align="right"><input type="text" name="search_keyword" class="flat" size="14"></td></tr>'; print "<tr ".$bc[false].'><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>'; print "</table></form>"; //print $langs->trans("ECMSectionManualDesc"); //print_fiche_titre($langs->trans("ECMSectionAuto")); print '<form method="post" action="'.DOL_URL_ROOT.'/ecm/search.php">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<table class="nobordernopadding" width="100%">'; print "<tr class=\"liste_titre\">"; print '<td colspan="4">'.$langs->trans("ECMSearchByEntity").'</td></tr>'; $buthtml='<td rowspan="'.$rowspan.'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>'; $butshown=0; foreach($sectionauto as $sectioncur) { if (! $sectioncur['test']) continue; //if ($butshown % 2 == 0) print '<tr '. $bc[false].'>'; print "<td>".$sectioncur['label'].':</td>'; print '<td'; //if ($butshown % 2 == 1) print ' align="right"'; print '>'; print '<input type="text" name="search_'.$sectioncur['module'].'" class="flat" size="14">'; print '</td>'; //if ($butshown % 2 == 1) print '</tr>'; $butshown++; } //if ($butshown % 2 == 1) // print '<td>&nbsp;</td><td>&nbsp;</td></tr>'; print '<tr '. $bc[false].'><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>'; print "</table></form>"; //print $langs->trans("ECMSectionAutoDesc"); print '</td><td valign="top">'; // Right area $relativepath=$ecmdir->getRelativePath(); $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $formfile=new FormFile($db); $param='&amp;section='.$section; $textifempty=($section?$langs->trans("NoFileFound"):$langs->trans("ECMSelectASection")); $formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty); // print '<table width="100%" class="border">'; // print '<tr><td> </td></tr></table>'; print '</td></tr>'; print '</table>'; print '<br>'; // End of page $db->close(); llxFooter('$Date: 2011/07/31 23:50:55 $ - $Revision: 1.19 $'); ?>
lgpl-2.1
ssdxiao/kimchi
ui/css/theme-default/window.css
2502
/* * Project Kimchi * * Copyright IBM, Corp. 2013 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Hide the "Build Me" warning */ #buildme { display: none; } .bgmask { position: fixed; left: 0; right: 0; top: 0; bottom: 0; background: url(../images/theme-default/bg-mask.png); z-index: 100; overflow: hidden; } .window { position: absolute; margin: auto; left: 0; right: 0; top: 0; bottom: 0; box-shadow: 2px 2px 6px #000; border: 2px solid #0f71b4; -webkit-border-radius: 8px; -moz-border-radius: 8px; border-radius: 8px; background-color: #eee; box-sizing: border-box; max-width: 100%; max-height: 100%; } .window>header, .window>form>header { position: absolute; left: 0; right: 0; top: 0; height: 48px; z-index: 100; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.05); } .window footer { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; z-index: 100; box-shadow: 0 -1px 1px rgba(0, 0, 0, 0.15); } .window .content { position: absolute; left: 0; right: 0; top: 0; bottom: 0; overflow: auto; margin: 48px 0 56px; } .window .close { position: absolute; width: 30px; height: 30px; top: 7px; right: 7px; -webkit-border-radius: 30px; -moz-border-radius: 30px; border-radius: 30px; border: 2px solid #ccc; color: #ccc; font-size: 24px; text-align: center; line-height: 30px; font-weight: bold; background: #eee; cursor: pointer; } .window>header>.close:HOVER, .window>form>header>.close:HOVER { border: 2px solid #444; color: #444; } .window>header>.title, .window>form>header>.title { font-size: 18px; height: 48px; line-height: 48px; color: #06C; margin: 0 10px; font-weight: bold; text-shadow: -1px -1px 1px #eaeaea, 1px 1px 1px #fff; }
lgpl-2.1
FernCreek/tinymce
modules/bridge/src/main/ts/ephox/bridge/components/toolbar/ToolbarMenuButton.ts
1266
import { ValueSchema, FieldSchema } from '@ephox/boulder'; import { Result } from '@ephox/katamari'; import { BaseMenuButton, BaseMenuButtonApi, baseMenuButtonFields, BaseMenuButtonInstanceApi, MenuButtonItemTypes } from '../../core/MenuButton'; export type ToolbarMenuButtonItemTypes = MenuButtonItemTypes; export type SuccessCallback = (menu: string | ToolbarMenuButtonItemTypes[]) => void; export interface ToolbarMenuButtonApi extends BaseMenuButtonApi { type?: 'menubutton'; onSetup?: (api: ToolbarMenuButtonInstanceApi) => (api: ToolbarMenuButtonInstanceApi) => void; } export interface ToolbarMenuButton extends BaseMenuButton { type: 'menubutton'; onSetup: (api: ToolbarMenuButtonInstanceApi) => (api: ToolbarMenuButtonInstanceApi) => void; } export interface ToolbarMenuButtonInstanceApi extends BaseMenuButtonInstanceApi { } export const MenuButtonSchema = ValueSchema.objOf([ FieldSchema.strictString('type'), ...baseMenuButtonFields ]); export const isMenuButtonButton = (spec: any): spec is ToolbarMenuButton => spec.type === 'menubutton'; export const createMenuButton = (spec: any): Result<ToolbarMenuButton, ValueSchema.SchemaError<any>> => { return ValueSchema.asRaw<ToolbarMenuButton>('menubutton', MenuButtonSchema, spec); };
lgpl-2.1
AutomacaoNet/MotorTributarioNet
src/Shared.MotorTributarioNet/Impostos/Tributacoes/TributacaoIbpt.cs
2720
// Projeto: Motor Tributario // Biblioteca C# para Cálculos Tributários Do Brasil // NF-e, NFC-e, CT-e, SAT-Fiscal // // Esta biblioteca é software livre; você pode redistribuí-la e/ou modificá-la // sob os termos da Licença Pública Geral Menor do GNU conforme publicada pela // Free Software Foundation; tanto a versão 2.1 da Licença, ou (a seu critério) // qualquer versão posterior. // // Esta biblioteca é distribuída na expectativa de que seja útil, porém, SEM // NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU // ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral Menor // do GNU para mais detalhes. (Arquivo LICENÇA.TXT ou LICENSE.TXT) // // Você deve ter recebido uma cópia da Licença Pública Geral Menor do GNU junto // com esta biblioteca; se não, escreva para a Free Software Foundation, Inc., // no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. // Você também pode obter uma copia da licença em: // https://github.com/AutomacaoNet/MotorTributarioNet/blob/master/LICENSE using MotorTributarioNet.Impostos.Implementacoes; namespace MotorTributarioNet.Impostos.Tributacoes { public class TributacaoIbpt { private readonly ITributavel _tributavel; private readonly IIbpt _ibpt; public TributacaoIbpt(ITributavel tributavel, IIbpt ibpt) { _tributavel = tributavel; _ibpt = ibpt; } public IResultadoCalculoIbpt Calcula() { var baseCalculo = _tributavel.ValorProduto * _tributavel.QuantidadeProduto - _tributavel.Desconto; var impostoAproximadoFederal = baseCalculo * _ibpt.PercentualFederal / 100; var impostoAproximadoMunicipio = baseCalculo * _ibpt.PercentualMunicipal / 100; var impostoAproximadoEstadual = baseCalculo * _ibpt.PercentualEstadual / 100; var impostoAproximadoImportados = baseCalculo * _ibpt.PercentualFederalImportados / 100; return new ResultadoCalculoIbpt(impostoAproximadoFederal, impostoAproximadoMunicipio, impostoAproximadoEstadual, impostoAproximadoImportados, baseCalculo); } } }
lgpl-2.1
joevandyk/osg
src/osgPlugins/osgSim/IO_VisibilityGroup.cpp
2072
#include "osgSim/VisibilityGroup" #include "osgDB/Registry" #include "osgDB/Input" #include "osgDB/Output" using namespace osg; using namespace osgSim; using namespace osgDB; // forward declare functions to use later. bool VisibilityGroup_readLocalData(Object& obj, Input& fr); bool VisibilityGroup_writeLocalData(const Object& obj, Output& fw); // register the read and write functions with the osgDB::Registry. RegisterDotOsgWrapperProxy g_VisibilityGroupProxy ( new VisibilityGroup, "VisibilityGroup", "Object Node VisibilityGroup Group", &VisibilityGroup_readLocalData, &VisibilityGroup_writeLocalData ); bool VisibilityGroup_readLocalData(Object& obj, Input& fr) { bool iteratorAdvanced = false; VisibilityGroup& vg = static_cast<VisibilityGroup&>(obj); unsigned int mask = vg.getVolumeIntersectionMask(); if (fr[0].matchWord("volumeIntersectionMask") && fr[1].getUInt(mask)) { vg.setNodeMask(mask); fr+=2; iteratorAdvanced = true; } if (fr[0].matchWord("segmentLength")) { if (fr[1].isFloat()) { float value; fr[1].getFloat(value); vg.setSegmentLength(value); iteratorAdvanced = true; fr += 2; } } if (fr.matchSequence("visibilityVolume")) { // int entry = fr[0].getNoNestedBrackets(); ++fr; Node* node = NULL; if((node=fr.readNode())!=NULL) { vg.setVisibilityVolume(node); iteratorAdvanced = true; } } return iteratorAdvanced; } bool VisibilityGroup_writeLocalData(const Object& obj, Output& fw) { const VisibilityGroup& vg = static_cast<const VisibilityGroup&>(obj); fw.indent()<<"volumeIntersectionMask 0x"<<std::hex<<vg.getVolumeIntersectionMask()<<std::dec<<std::endl; fw.indent()<<"segmentLength "<<vg.getSegmentLength()<<std::endl; fw.indent()<<"visibilityVolume" <<std::endl; fw.moveIn(); fw.writeObject(*vg.getVisibilityVolume()); fw.moveOut(); return true; }
lgpl-2.1
Darkaqua/Blacksmith-Api
src/main/java/api/net/darkaqua/blacksmith/api/client/particle/IParticle.java
153
package net.darkaqua.blacksmith.api.client.particle; /** * Created by cout970 on 18/01/2016. */ public interface IParticle { String getName(); }
lgpl-2.1
Fosstrak/fosstrak.github.io
hal/apidocs/org/accada/hal/MemoryDescriptor.html
12852
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_05) on Tue Mar 25 10:54:12 CET 2008 --> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <TITLE> MemoryDescriptor (hal 0.4.1-SNAPSHOT API) </TITLE> <META NAME="date" CONTENT="2008-03-25"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="MemoryDescriptor (hal 0.4.1-SNAPSHOT API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/MemoryDescriptor.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../org/accada/hal/MemoryBankDescriptor.html" title="class in org.accada.hal"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../org/accada/hal/Observation.html" title="class in org.accada.hal"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?org/accada/hal/MemoryDescriptor.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="MemoryDescriptor.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> org.accada.hal</FONT> <BR> Class MemoryDescriptor</H2> <PRE> java.lang.Object <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>org.accada.hal.MemoryDescriptor</B> </PRE> <HR> <DL> <DT><PRE>public class <B>MemoryDescriptor</B><DT>extends java.lang.Object</DL> </PRE> <P> The class is a data structure to store information that describes the memory structure of a tag, i.e. the memory banks. <P> <P> <DL> <DT><B>Author:</B></DT> <DD>Matthias Lampe, lampe@acm.org</DD> </DL> <HR> <P> <!-- =========== FIELD SUMMARY =========== --> <A NAME="field_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Field Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;<A HREF="../../../org/accada/hal/MemoryBankDescriptor.html" title="class in org.accada.hal">MemoryBankDescriptor</A>[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../org/accada/hal/MemoryDescriptor.html#memoryBankDescriptors">memoryBankDescriptors</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The descriptions of the memory banks</TD> </TR> </TABLE> &nbsp; <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../org/accada/hal/MemoryDescriptor.html#MemoryDescriptor(org.accada.hal.MemoryBankDescriptor[])">MemoryDescriptor</A></B>(<A HREF="../../../org/accada/hal/MemoryBankDescriptor.html" title="class in org.accada.hal">MemoryBankDescriptor</A>[]&nbsp;memoryBankDescriptors)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;creates a memory descriptor with the given paramter.</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../org/accada/hal/MemoryBankDescriptor.html" title="class in org.accada.hal">MemoryBankDescriptor</A>[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../org/accada/hal/MemoryDescriptor.html#getMemoryBankDescriptors()">getMemoryBankDescriptors</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gets the descriptions of the memory banks.</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ============ FIELD DETAIL =========== --> <A NAME="field_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Field Detail</B></FONT></TH> </TR> </TABLE> <A NAME="memoryBankDescriptors"><!-- --></A><H3> memoryBankDescriptors</H3> <PRE> protected <A HREF="../../../org/accada/hal/MemoryBankDescriptor.html" title="class in org.accada.hal">MemoryBankDescriptor</A>[] <B>memoryBankDescriptors</B></PRE> <DL> <DD>The descriptions of the memory banks <P> <DL> </DL> </DL> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="MemoryDescriptor(org.accada.hal.MemoryBankDescriptor[])"><!-- --></A><H3> MemoryDescriptor</H3> <PRE> public <B>MemoryDescriptor</B>(<A HREF="../../../org/accada/hal/MemoryBankDescriptor.html" title="class in org.accada.hal">MemoryBankDescriptor</A>[]&nbsp;memoryBankDescriptors)</PRE> <DL> <DD>creates a memory descriptor with the given paramter. <P> <DL> <DT><B>Parameters:</B><DD><CODE>memoryBankDescriptors</CODE> - the descriptions of the memory banks</DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="getMemoryBankDescriptors()"><!-- --></A><H3> getMemoryBankDescriptors</H3> <PRE> public <A HREF="../../../org/accada/hal/MemoryBankDescriptor.html" title="class in org.accada.hal">MemoryBankDescriptor</A>[] <B>getMemoryBankDescriptors</B>()</PRE> <DL> <DD>gets the descriptions of the memory banks. <P> <DD><DL> <DT><B>Returns:</B><DD>the memory bank descriptors</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/MemoryDescriptor.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../org/accada/hal/MemoryBankDescriptor.html" title="class in org.accada.hal"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../org/accada/hal/Observation.html" title="class in org.accada.hal"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?org/accada/hal/MemoryDescriptor.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="MemoryDescriptor.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> Copyright &#169; 2008. All Rights Reserved. </BODY> </HTML>
lgpl-2.1
pemryan/DAKOTA
src/DataModel.cpp
6824
/* _______________________________________________________________________ DAKOTA: Design Analysis Kit for Optimization and Terascale Applications Copyright (c) 2010, Sandia National Laboratories. This software is distributed under the GNU Lesser General Public License. For more information, see the README file in the top Dakota directory. _______________________________________________________________________ */ //- Class: DataModel //- Description: Class implementation //- Owner: Mike Eldred #include "DataModel.hpp" #include "dakota_data_io.hpp" namespace Dakota { DataModelRep::DataModelRep(): modelType("single"), //approxPointReuse("none"), hierarchicalTags(false), pointsTotal(0), pointsManagement(DEFAULT_POINTS), approxImportAnnotated(true), approxExportAnnotated(true), approxCorrectionType(NO_CORRECTION), approxCorrectionOrder(0), modelUseDerivsFlag(false), polynomialOrder(2), krigingMaxTrials(0), krigingNugget(0.0), krigingFindNugget(0), mlsPolyOrder(0), mlsWeightFunction(0), rbfBases(0), rbfMaxPts(0), rbfMaxSubsets(0), rbfMinPartition(0), marsMaxBases(0), annRandomWeight(0),annNodes(0), annRange(0.0), trendOrder("reduced_quadratic"), pointSelection(false), crossValidateFlag(false), numFolds(0), percentFold(0.0), pressFlag(false), approxChallengeAnnotated(true), referenceCount(1) { } void DataModelRep::write(MPIPackBuffer& s) const { s << idModel << modelType << variablesPointer << interfacePointer << responsesPointer << hierarchicalTags << subMethodPointer << surrogateFnIndices << surrogateType << truthModelPointer << lowFidelityModelPointer << pointsTotal << pointsManagement << approxPointReuse << approxImportFile << approxImportAnnotated << approxExportFile << approxExportAnnotated << approxExportModelFile << approxCorrectionType << approxCorrectionOrder << modelUseDerivsFlag << polynomialOrder << krigingCorrelations << krigingOptMethod << krigingMaxTrials << krigingMaxCorrelations << krigingMinCorrelations << krigingNugget << krigingFindNugget << mlsPolyOrder << mlsWeightFunction << rbfBases << rbfMaxPts << rbfMaxSubsets << rbfMinPartition << marsMaxBases << marsInterpolation << annRandomWeight << annNodes << annRange << trendOrder << pointSelection << diagMetrics << crossValidateFlag << numFolds << percentFold << pressFlag << approxChallengeFile << approxChallengeAnnotated << optionalInterfRespPointer << primaryVarMaps << secondaryVarMaps << primaryRespCoeffs << secondaryRespCoeffs; } void DataModelRep::read(MPIUnpackBuffer& s) { s >> idModel >> modelType >> variablesPointer >> interfacePointer >> responsesPointer >> hierarchicalTags >> subMethodPointer >> surrogateFnIndices >> surrogateType >> truthModelPointer >> lowFidelityModelPointer >> pointsTotal >> pointsManagement >> approxPointReuse >> approxImportFile >> approxImportAnnotated >> approxExportFile >> approxExportAnnotated >> approxExportModelFile >> approxCorrectionType >> approxCorrectionOrder >> modelUseDerivsFlag >> polynomialOrder >> krigingCorrelations >> krigingOptMethod >> krigingMaxTrials >> krigingMaxCorrelations >> krigingMinCorrelations >> krigingNugget >> krigingFindNugget >> mlsPolyOrder >> mlsWeightFunction >> rbfBases >> rbfMaxPts >> rbfMaxSubsets >> rbfMinPartition >> marsMaxBases >> marsInterpolation >> annRandomWeight >> annNodes >> annRange >> trendOrder >> pointSelection >> diagMetrics >> crossValidateFlag >> numFolds >> percentFold >> pressFlag >> approxChallengeFile >> approxChallengeAnnotated >> optionalInterfRespPointer >> primaryVarMaps >> secondaryVarMaps >> primaryRespCoeffs >> secondaryRespCoeffs; } void DataModelRep::write(std::ostream& s) const { s << idModel << modelType << variablesPointer << interfacePointer << responsesPointer << hierarchicalTags << subMethodPointer << surrogateFnIndices << surrogateType << truthModelPointer << lowFidelityModelPointer << pointsTotal << pointsManagement << approxPointReuse << approxImportFile << approxImportAnnotated << approxExportFile << approxExportAnnotated << approxExportModelFile << approxCorrectionType << approxCorrectionOrder << modelUseDerivsFlag << polynomialOrder << krigingCorrelations << krigingOptMethod << krigingMaxTrials << krigingMaxCorrelations << krigingMinCorrelations << krigingNugget << krigingFindNugget << mlsPolyOrder << mlsWeightFunction << rbfBases << rbfMaxPts << rbfMaxSubsets << rbfMinPartition << marsMaxBases << marsInterpolation << annRandomWeight << annNodes << annRange << trendOrder << pointSelection << diagMetrics << crossValidateFlag << numFolds << percentFold << pressFlag << approxChallengeFile << approxChallengeAnnotated << optionalInterfRespPointer << primaryVarMaps << secondaryVarMaps << primaryRespCoeffs << secondaryRespCoeffs; } DataModel::DataModel(): dataModelRep(new DataModelRep()) { #ifdef REFCOUNT_DEBUG Cout << "DataModel::DataModel(), dataModelRep referenceCount = " << dataModelRep->referenceCount << std::endl; #endif } DataModel::DataModel(const DataModel& data_model) { // Increment new (no old to decrement) dataModelRep = data_model.dataModelRep; if (dataModelRep) // Check for an assignment of NULL dataModelRep->referenceCount++; #ifdef REFCOUNT_DEBUG Cout << "DataModel::DataModel(DataModel&)" << std::endl; if (dataModelRep) Cout << "dataModelRep referenceCount = " << dataModelRep->referenceCount << std::endl; #endif } DataModel& DataModel::operator=(const DataModel& data_model) { if (dataModelRep != data_model.dataModelRep) { // normal case: old != new // Decrement old if (dataModelRep) // Check for NULL if ( --dataModelRep->referenceCount == 0 ) delete dataModelRep; // Assign and increment new dataModelRep = data_model.dataModelRep; if (dataModelRep) // Check for NULL dataModelRep->referenceCount++; } // else if assigning same rep, then do nothing since referenceCount // should already be correct #ifdef REFCOUNT_DEBUG Cout << "DataModel::operator=(DataModel&)" << std::endl; if (dataModelRep) Cout << "dataModelRep referenceCount = " << dataModelRep->referenceCount << std::endl; #endif return *this; } DataModel::~DataModel() { if (dataModelRep) { // Check for NULL --dataModelRep->referenceCount; // decrement #ifdef REFCOUNT_DEBUG Cout << "dataModelRep referenceCount decremented to " << dataModelRep->referenceCount << std::endl; #endif if (dataModelRep->referenceCount == 0) { #ifdef REFCOUNT_DEBUG Cout << "deleting dataModelRep" << std::endl; #endif delete dataModelRep; } } } } // namespace Dakota
lgpl-2.1
bakaiadam/collaborative_qt_creator
src/libs/qmleditorwidgets/customcolordialog.cpp
6384
/************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** ** GNU Lesser General Public License Usage ** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this file. ** Please review the following information to ensure the GNU Lesser General ** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** Other Usage ** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** **************************************************************************/ #include "customcolordialog.h" #include "huecontrol.h" #include "colorbox.h" #include <QtGui/QHBoxLayout> #include <QtGui/QLabel> #include <QtGui/QPainter> #include <QtGui/QDoubleSpinBox> #include <QtGui/QGridLayout> #include <QtGui/QPushButton> #include <QtGui/QDialogButtonBox> #include <QtGui/QGraphicsEffect> namespace QmlEditorWidgets { CustomColorDialog::CustomColorDialog(QWidget *parent) : QFrame(parent ) { setFrameStyle(QFrame::NoFrame); setFrameShape(QFrame::StyledPanel); setFrameShadow(QFrame::Sunken); QGraphicsDropShadowEffect *dropShadowEffect = new QGraphicsDropShadowEffect; dropShadowEffect->setBlurRadius(6); dropShadowEffect->setOffset(2, 2); setGraphicsEffect(dropShadowEffect); setAutoFillBackground(true); m_hueControl = new HueControl(this); m_colorBox = new ColorBox(this); QWidget *colorFrameWidget = new QWidget(this); QVBoxLayout* vBox = new QVBoxLayout(colorFrameWidget); colorFrameWidget->setLayout(vBox); vBox->setSpacing(0); vBox->setMargin(0); vBox->setContentsMargins(0,5,0,28); m_beforeColorWidget = new QFrame(colorFrameWidget); m_beforeColorWidget->setFixedSize(30, 18); m_beforeColorWidget->setAutoFillBackground(true); m_currentColorWidget = new QFrame(colorFrameWidget); m_currentColorWidget->setFixedSize(30, 18); m_currentColorWidget->setAutoFillBackground(true); vBox->addWidget(m_beforeColorWidget); vBox->addWidget(m_currentColorWidget); m_rSpinBox = new QDoubleSpinBox(this); m_gSpinBox = new QDoubleSpinBox(this); m_bSpinBox = new QDoubleSpinBox(this); m_alphaSpinBox = new QDoubleSpinBox(this); QGridLayout *gridLayout = new QGridLayout(this); gridLayout->setSpacing(4); gridLayout->setVerticalSpacing(4); gridLayout->setMargin(4); setLayout(gridLayout); gridLayout->addWidget(m_colorBox, 0, 0, 4, 1); gridLayout->addWidget(m_hueControl, 0, 1, 4, 1); gridLayout->addWidget(colorFrameWidget, 0, 2, 2, 1); gridLayout->addWidget(new QLabel("R", this), 0, 3, 1, 1); gridLayout->addWidget(new QLabel("G", this), 1, 3, 1, 1); gridLayout->addWidget(new QLabel("B", this), 2, 3, 1, 1); gridLayout->addWidget(new QLabel("A", this), 3, 3, 1, 1); gridLayout->addWidget(m_rSpinBox, 0, 4, 1, 1); gridLayout->addWidget(m_gSpinBox, 1, 4, 1, 1); gridLayout->addWidget(m_bSpinBox, 2, 4, 1, 1); gridLayout->addWidget(m_alphaSpinBox, 3, 4, 1, 1); QDialogButtonBox *buttonBox = new QDialogButtonBox(this); QPushButton *cancelButton = buttonBox->addButton(QDialogButtonBox::Cancel); QPushButton *applyButton = buttonBox->addButton(QDialogButtonBox::Apply); gridLayout->addWidget(buttonBox, 4, 0, 1, 2); resize(sizeHint()); connect(m_colorBox, SIGNAL(colorChanged()), this, SLOT(onColorBoxChanged())); connect(m_alphaSpinBox, SIGNAL(valueChanged(double)), this, SLOT(spinBoxChanged())); connect(m_rSpinBox, SIGNAL(valueChanged(double)), this, SLOT(spinBoxChanged())); connect(m_gSpinBox, SIGNAL(valueChanged(double)), this, SLOT(spinBoxChanged())); connect(m_bSpinBox, SIGNAL(valueChanged(double)), this, SLOT(spinBoxChanged())); connect(m_hueControl, SIGNAL(hueChanged(int)), this, SLOT(onHueChanged(int))); connect(applyButton, SIGNAL(pressed()), this, SLOT(onAccept())); connect(cancelButton, SIGNAL(pressed()), this, SIGNAL(rejected())); m_alphaSpinBox->setMaximum(1); m_rSpinBox->setMaximum(1); m_gSpinBox->setMaximum(1); m_bSpinBox->setMaximum(1); m_alphaSpinBox->setSingleStep(0.1); m_rSpinBox->setSingleStep(0.1); m_gSpinBox->setSingleStep(0.1); m_bSpinBox->setSingleStep(0.1); m_blockUpdate = false; } void CustomColorDialog::setupColor(const QColor &color) { QPalette pal = m_beforeColorWidget->palette(); pal.setColor(QPalette::Background, color); m_beforeColorWidget->setPalette(pal); setColor(color); } void CustomColorDialog::spinBoxChanged() { if (m_blockUpdate) return; QColor newColor; newColor.setAlphaF(m_alphaSpinBox->value()); newColor.setRedF(m_rSpinBox->value()); newColor.setGreenF(m_gSpinBox->value()); newColor.setBlueF(m_bSpinBox->value()); setColor(newColor); } void CustomColorDialog::onColorBoxChanged() { if (m_blockUpdate) return; setColor(m_colorBox->color()); } void CustomColorDialog::setupWidgets() { m_blockUpdate = true; m_hueControl->setHue(m_color.hsvHue()); m_alphaSpinBox->setValue(m_color.alphaF()); m_rSpinBox->setValue(m_color.redF()); m_gSpinBox->setValue(m_color.greenF()); m_bSpinBox->setValue(m_color.blueF()); m_colorBox->setColor(m_color); QPalette pal = m_currentColorWidget->palette(); pal.setColor(QPalette::Background, m_color); m_currentColorWidget->setPalette(pal); m_blockUpdate = false; } void CustomColorDialog::leaveEvent(QEvent *) { #ifdef Q_WS_MAC unsetCursor(); #endif } void CustomColorDialog::enterEvent(QEvent *) { #ifdef Q_WS_MAC setCursor(Qt::ArrowCursor); #endif } } //QmlEditorWidgets
lgpl-2.1
bakaiadam/collaborative_qt_creator
src/plugins/madde/qt4maemotarget.cpp
43717
/************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** ** GNU Lesser General Public License Usage ** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this file. ** Please review the following information to ensure the GNU Lesser General ** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** Other Usage ** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** **************************************************************************/ #include "qt4maemotarget.h" #include "maemoglobal.h" #include "maemopackagecreationstep.h" #include "maemorunconfiguration.h" #include "maemotoolchain.h" #include "qt4maemodeployconfiguration.h" #include <coreplugin/filemanager.h> #include <coreplugin/icore.h> #include <coreplugin/iversioncontrol.h> #include <coreplugin/vcsmanager.h> #include <projectexplorer/abi.h> #include <projectexplorer/customexecutablerunconfiguration.h> #include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectnodes.h> #include <projectexplorer/toolchain.h> #include <qt4projectmanager/qt4project.h> #include <qt4projectmanager/qt4buildconfiguration.h> #include <qt4projectmanager/qt4nodes.h> #include <qtsupport/baseqtversion.h> #include <utils/fileutils.h> #include <utils/filesystemwatcher.h> #include <utils/qtcassert.h> #include <QtGui/QApplication> #include <QtGui/QMainWindow> #include <QtCore/QBuffer> #include <QtCore/QDateTime> #include <QtCore/QLocale> #include <QtCore/QRegExp> #include <QtCore/QDir> #include <QtCore/QFile> #include <QtCore/QFileInfo> #include <QtCore/QProcess> #include <QtCore/QStringList> #include <QtGui/QIcon> #include <QtGui/QMessageBox> #include <cctype> using namespace Qt4ProjectManager; namespace Madde { namespace Internal { namespace { const QByteArray NameFieldName("Package"); const QByteArray IconFieldName("XB-Maemo-Icon-26"); const QByteArray ShortDescriptionFieldName("Description"); const QByteArray PackageFieldName("Package"); const QLatin1String PackagingDirName("qtc_packaging"); const QByteArray NameTag("Name"); const QByteArray SummaryTag("Summary"); const QByteArray VersionTag("Version"); const QByteArray ReleaseTag("Release"); bool adaptTagValue(QByteArray &document, const QByteArray &fieldName, const QByteArray &newFieldValue, bool caseSensitive) { QByteArray adaptedLine = fieldName + ": " + newFieldValue; const QByteArray completeTag = fieldName + ':'; const int lineOffset = caseSensitive ? document.indexOf(completeTag) : document.toLower().indexOf(completeTag.toLower()); if (lineOffset == -1) { document.append(adaptedLine).append('\n'); return true; } int newlineOffset = document.indexOf('\n', lineOffset); bool updated = false; if (newlineOffset == -1) { newlineOffset = document.length(); adaptedLine += '\n'; updated = true; } const int replaceCount = newlineOffset - lineOffset; if (!updated && document.mid(lineOffset, replaceCount) != adaptedLine) updated = true; if (updated) document.replace(lineOffset, replaceCount, adaptedLine); return updated; } } // anonymous namespace AbstractQt4MaemoTarget::AbstractQt4MaemoTarget(Qt4Project *parent, const QString &id) : Qt4BaseTarget(parent, id), m_filesWatcher(new Utils::FileSystemWatcher(this)), m_buildConfigurationFactory(new Qt4BuildConfigurationFactory(this)), m_isInitialized(false) { m_filesWatcher->setObjectName(QLatin1String("Qt4MaemoTarget")); setIcon(QIcon(":/projectexplorer/images/MaemoDevice.png")); connect(parent, SIGNAL(addedTarget(ProjectExplorer::Target*)), this, SLOT(handleTargetAdded(ProjectExplorer::Target*))); connect(parent, SIGNAL(fromMapFinished()), this, SLOT(handleFromMapFinished())); } AbstractQt4MaemoTarget::~AbstractQt4MaemoTarget() { } QList<ProjectExplorer::ToolChain *> AbstractQt4MaemoTarget::possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const { QList<ProjectExplorer::ToolChain *> result; Qt4BuildConfiguration *qt4Bc = qobject_cast<Qt4BuildConfiguration *>(bc); if (!qt4Bc) return result; QList<ProjectExplorer::ToolChain *> candidates = Qt4BaseTarget::possibleToolChains(bc); foreach (ProjectExplorer::ToolChain *i, candidates) { MaemoToolChain *tc = dynamic_cast<MaemoToolChain *>(i); if (!tc || !qt4Bc->qtVersion()) continue; if (tc->qtVersionId() == qt4Bc->qtVersion()->uniqueId()) result.append(tc); } return result; } ProjectExplorer::IBuildConfigurationFactory *AbstractQt4MaemoTarget::buildConfigurationFactory() const { return m_buildConfigurationFactory; } void AbstractQt4MaemoTarget::createApplicationProFiles() { removeUnconfiguredCustomExectutableRunConfigurations(); QList<Qt4ProFileNode *> profiles = qt4Project()->applicationProFiles(); QSet<QString> paths; foreach (Qt4ProFileNode *pro, profiles) paths << pro->path(); foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) if (MaemoRunConfiguration *qt4rc = qobject_cast<MaemoRunConfiguration *>(rc)) paths.remove(qt4rc->proFilePath()); // Only add new runconfigurations if there are none. foreach (const QString &path, paths) addRunConfiguration(new MaemoRunConfiguration(this, path)); // Oh still none? Add a custom executable runconfiguration if (runConfigurations().isEmpty()) { addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(this)); } } QList<ProjectExplorer::RunConfiguration *> AbstractQt4MaemoTarget::runConfigurationsForNode(ProjectExplorer::Node *n) { QList<ProjectExplorer::RunConfiguration *> result; foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) if (MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *>(rc)) if (mrc->proFilePath() == n->path()) result << rc; return result; } bool AbstractQt4MaemoTarget::setProjectVersion(const QString &version, QString *error) { bool success = true; foreach (Target * const target, project()->targets()) { AbstractQt4MaemoTarget * const maemoTarget = qobject_cast<AbstractQt4MaemoTarget *>(target); if (maemoTarget) { if (!maemoTarget->setProjectVersionInternal(version, error)) success = false; } } return success; } bool AbstractQt4MaemoTarget::setPackageName(const QString &name) { bool success = true; foreach (Target * const target, project()->targets()) { AbstractQt4MaemoTarget * const maemoTarget = qobject_cast<AbstractQt4MaemoTarget *>(target); if (maemoTarget) { if (!maemoTarget->setPackageNameInternal(name)) success = false; } } return success; } bool AbstractQt4MaemoTarget::setShortDescription(const QString &description) { bool success = true; foreach (Target * const target, project()->targets()) { AbstractQt4MaemoTarget * const maemoTarget = qobject_cast<AbstractQt4MaemoTarget *>(target); if (maemoTarget) { if (!maemoTarget->setShortDescriptionInternal(description)) success = false; } } return success; } QSharedPointer<QFile> AbstractQt4MaemoTarget::openFile(const QString &filePath, QIODevice::OpenMode mode, QString *error) const { const QString nativePath = QDir::toNativeSeparators(filePath); QSharedPointer<QFile> file(new QFile(filePath)); if (!file->open(mode)) { if (error) { *error = tr("Cannot open file '%1': %2") .arg(nativePath, file->errorString()); } file.clear(); } return file; } void AbstractQt4MaemoTarget::handleFromMapFinished() { handleTargetAdded(this); } void AbstractQt4MaemoTarget::handleTargetAdded(ProjectExplorer::Target *target) { if (target != this) return; if (!project()->rootProjectNode()) { // Project is not fully setup yet, happens on new project // we wait for the fromMapFinished that comes afterwards return; } disconnect(project(), SIGNAL(fromMapFinished()), this, SLOT(handleFromMapFinished())); disconnect(project(), SIGNAL(addedTarget(ProjectExplorer::Target*)), this, SLOT(handleTargetAdded(ProjectExplorer::Target*))); connect(project(), SIGNAL(aboutToRemoveTarget(ProjectExplorer::Target*)), SLOT(handleTargetToBeRemoved(ProjectExplorer::Target*))); const ActionStatus status = createTemplates(); if (status == ActionFailed) return; if (status == ActionSuccessful) // Don't do this when the packaging data already exists. initPackagingSettingsFromOtherTarget(); handleTargetAddedSpecial(); if (status == ActionSuccessful) { const QStringList &files = packagingFilePaths(); if (!files.isEmpty()) { const QString list = QLatin1String("<ul><li>") + files.join(QLatin1String("</li><li>")) + QLatin1String("</li></ul>"); QMessageBox::StandardButton button = QMessageBox::question(Core::ICore::instance()->mainWindow(), tr("Add Packaging Files to Project"), tr("<html>Qt Creator has set up the following files to enable " "packaging:\n %1\nDo you want to add them to the project?</html>") .arg(list), QMessageBox::Yes | QMessageBox::No); if (button == QMessageBox::Yes) { ProjectExplorer::ProjectExplorerPlugin::instance() ->addExistingFiles(project()->rootProjectNode(), files); } } } m_isInitialized = true; } void AbstractQt4MaemoTarget::handleTargetToBeRemoved(ProjectExplorer::Target *target) { if (target != this) return; if (!targetCanBeRemoved()) return; Core::ICore * const core = Core::ICore::instance(); const int answer = QMessageBox::warning(core->mainWindow(), tr("Qt Creator"), tr("Do you want to remove the packaging file(s) " "associated with the target '%1'?").arg(displayName()), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (answer == QMessageBox::No) return; const QStringList pkgFilePaths = packagingFilePaths(); if (!pkgFilePaths.isEmpty()) { project()->rootProjectNode()->removeFiles(ProjectExplorer::UnknownFileType, pkgFilePaths); Core::IVersionControl * const vcs = core->vcsManager() ->findVersionControlForDirectory(QFileInfo(pkgFilePaths.first()).dir().path()); if (vcs && vcs->supportsOperation(Core::IVersionControl::DeleteOperation)) { foreach (const QString &filePath, pkgFilePaths) vcs->vcsDelete(filePath); } } delete m_filesWatcher; removeTarget(); QString error; const QString packagingPath = project()->projectDirectory() + QLatin1Char('/') + PackagingDirName; const QStringList otherContents = QDir(packagingPath).entryList(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot); if (otherContents.isEmpty()) { if (!Utils::FileUtils::removeRecursively(packagingPath, &error)) qDebug("%s", qPrintable(error)); } } AbstractQt4MaemoTarget::ActionStatus AbstractQt4MaemoTarget::createTemplates() { QDir projectDir(project()->projectDirectory()); if (!projectDir.exists(PackagingDirName) && !projectDir.mkdir(PackagingDirName)) { raiseError(tr("Error creating packaging directory '%1'.") .arg(PackagingDirName)); return ActionFailed; } return createSpecialTemplates(); } bool AbstractQt4MaemoTarget::initPackagingSettingsFromOtherTarget() { bool success = true; foreach (const Target * const target, project()->targets()) { const AbstractQt4MaemoTarget * const maemoTarget = qobject_cast<const AbstractQt4MaemoTarget *>(target); if (maemoTarget && maemoTarget != this && maemoTarget->m_isInitialized) { if (!setProjectVersionInternal(maemoTarget->projectVersion())) success = false; if (!setPackageNameInternal(maemoTarget->packageName())) success = false; if (!setShortDescriptionInternal(maemoTarget->shortDescription())) success = false; break; } } return initAdditionalPackagingSettingsFromOtherTarget() && success; } void AbstractQt4MaemoTarget::raiseError(const QString &reason) { QMessageBox::critical(0, tr("Error creating MeeGo templates"), reason); } AbstractDebBasedQt4MaemoTarget::AbstractDebBasedQt4MaemoTarget(Qt4Project *parent, const QString &id) : AbstractQt4MaemoTarget(parent, id) { } AbstractDebBasedQt4MaemoTarget::~AbstractDebBasedQt4MaemoTarget() {} QString AbstractDebBasedQt4MaemoTarget::projectVersion(QString *error) const { QSharedPointer<QFile> changeLog = openFile(changeLogFilePath(), QIODevice::ReadOnly, error); if (!changeLog) return QString(); const QByteArray &firstLine = changeLog->readLine(); const int openParenPos = firstLine.indexOf('('); if (openParenPos == -1) { if (error) { *error = tr("Debian changelog file '%1' has unexpected format.") .arg(QDir::toNativeSeparators(changeLog->fileName())); } return QString(); } const int closeParenPos = firstLine.indexOf(')', openParenPos); if (closeParenPos == -1) { if (error) { *error = tr("Debian changelog file '%1' has unexpected format.") .arg(QDir::toNativeSeparators(changeLog->fileName())); } return QString(); } return QString::fromUtf8(firstLine.mid(openParenPos + 1, closeParenPos - openParenPos - 1).data()); } bool AbstractDebBasedQt4MaemoTarget::setProjectVersionInternal(const QString &version, QString *error) { const QString filePath = changeLogFilePath(); Utils::FileReader reader; if (!reader.fetch(filePath, error)) return false; QString content = QString::fromUtf8(reader.data()); if (content.contains(QLatin1Char('(') + version + QLatin1Char(')'))) { if (error) { *error = tr("Refusing to update changelog file: Already contains version '%1'.") .arg(version); } return false; } int maintainerOffset = content.indexOf(QLatin1String("\n -- ")); const int eolOffset = content.indexOf(QLatin1Char('\n'), maintainerOffset+1); if (maintainerOffset == -1 || eolOffset == -1) { if (error) { *error = tr("Cannot update changelog: Invalid format (no maintainer entry found)."); } return false; } ++maintainerOffset; const QDateTime currentDateTime = QDateTime::currentDateTime(); QDateTime utcDateTime = QDateTime(currentDateTime); utcDateTime.setTimeSpec(Qt::UTC); int utcOffsetSeconds = currentDateTime.secsTo(utcDateTime); QChar sign; if (utcOffsetSeconds < 0) { utcOffsetSeconds = -utcOffsetSeconds; sign = QLatin1Char('-'); } else { sign = QLatin1Char('+'); } const int utcOffsetMinutes = (utcOffsetSeconds / 60) % 60; const int utcOffsetHours = utcOffsetSeconds / 3600; const QString dateString = QString::fromLatin1("%1, %2 %3 %4 %5%6%7") .arg(shortDayOfWeekName(currentDateTime)) .arg(currentDateTime.toString(QLatin1String("dd"))) .arg(shortMonthName(currentDateTime)) .arg(currentDateTime.toString(QLatin1String("yyyy hh:mm:ss"))).arg(sign) .arg(utcOffsetHours, 2, 10, QLatin1Char('0')) .arg(utcOffsetMinutes, 2, 10, QLatin1Char('0')); const QString maintainerLine = content.mid(maintainerOffset, eolOffset - maintainerOffset + 1) .replace(QRegExp(QLatin1String("> [^\\n]*\n")), QString::fromLocal8Bit("> %1").arg(dateString)); QString versionLine = content.left(content.indexOf(QLatin1Char('\n'))) .replace(QRegExp(QLatin1String("\\([a-zA-Z0-9_\\.]+\\)")), QLatin1Char('(') + version + QLatin1Char(')')); const QString newEntry = versionLine + QLatin1String("\n * <Add change description here>\n\n") + maintainerLine + QLatin1String("\n\n"); content.prepend(newEntry); Core::FileChangeBlocker update(filePath); Utils::FileSaver saver(filePath); saver.write(content.toUtf8()); return saver.finalize(error); } QIcon AbstractDebBasedQt4MaemoTarget::packageManagerIcon(QString *error) const { const QByteArray &base64Icon = controlFileFieldValue(IconFieldName, true); if (base64Icon.isEmpty()) return QIcon(); QPixmap pixmap; if (!pixmap.loadFromData(QByteArray::fromBase64(base64Icon))) { if (error) *error = tr("Invalid icon data in Debian control file."); return QIcon(); } return QIcon(pixmap); } bool AbstractDebBasedQt4MaemoTarget::setPackageManagerIconInternal(const QString &iconFilePath, QString *error) { const QString filePath = controlFilePath(); Utils::FileReader reader; if (!reader.fetch(filePath, error)) return false; const QPixmap pixmap(iconFilePath); if (pixmap.isNull()) { if (error) *error = tr("Could not read image file '%1'.").arg(iconFilePath); return false; } QByteArray iconAsBase64; QBuffer buffer(&iconAsBase64); buffer.open(QIODevice::WriteOnly); if (!pixmap.scaled(packageManagerIconSize()).save(&buffer, QFileInfo(iconFilePath).suffix().toAscii())) { if (error) *error = tr("Could not export image file '%1'.").arg(iconFilePath); return false; } buffer.close(); iconAsBase64 = iconAsBase64.toBase64(); QByteArray contents = reader.data(); const QByteArray iconFieldNameWithColon = IconFieldName + ':'; const int iconFieldPos = contents.startsWith(iconFieldNameWithColon) ? 0 : contents.indexOf('\n' + iconFieldNameWithColon); if (iconFieldPos == -1) { if (!contents.endsWith('\n')) contents += '\n'; contents.append(iconFieldNameWithColon).append(' ').append(iconAsBase64) .append('\n'); } else { const int oldIconStartPos = (iconFieldPos != 0) + iconFieldPos + iconFieldNameWithColon.length(); int nextEolPos = contents.indexOf('\n', oldIconStartPos); while (nextEolPos != -1 && nextEolPos != contents.length() - 1 && contents.at(nextEolPos + 1) != '\n' && (contents.at(nextEolPos + 1) == '#' || std::isspace(contents.at(nextEolPos + 1)))) nextEolPos = contents.indexOf('\n', nextEolPos + 1); if (nextEolPos == -1) nextEolPos = contents.length(); contents.replace(oldIconStartPos, nextEolPos - oldIconStartPos, ' ' + iconAsBase64); } Core::FileChangeBlocker update(filePath); Utils::FileSaver saver(filePath); saver.write(contents); return saver.finalize(error); } QString AbstractDebBasedQt4MaemoTarget::packageName() const { return QString::fromUtf8(controlFileFieldValue(NameFieldName, false)); } bool AbstractDebBasedQt4MaemoTarget::setPackageNameInternal(const QString &packageName) { const QString oldPackageName = this->packageName(); if (!setControlFieldValue(NameFieldName, packageName.toUtf8())) return false; if (!setControlFieldValue("Source", packageName.toUtf8())) return false; Utils::FileReader reader; if (!reader.fetch(changeLogFilePath())) return false; QString changelogContents = QString::fromUtf8(reader.data()); QRegExp pattern(QLatin1String("[^\\s]+( \\(\\d\\.\\d\\.\\d\\))")); changelogContents.replace(pattern, packageName + QLatin1String("\\1")); Utils::FileSaver saver(changeLogFilePath()); saver.write(changelogContents.toUtf8()); if (!saver.finalize()) return false; if (!reader.fetch(rulesFilePath())) return false; QByteArray rulesContents = reader.data(); const QString oldString = QLatin1String("debian/") + oldPackageName; const QString newString = QLatin1String("debian/") + packageName; rulesContents.replace(oldString.toUtf8(), newString.toUtf8()); Utils::FileSaver rulesSaver(rulesFilePath()); rulesSaver.write(rulesContents); return rulesSaver.finalize(); } QString AbstractDebBasedQt4MaemoTarget::packageManagerName() const { return QString::fromUtf8(controlFileFieldValue(packageManagerNameFieldName(), false)); } bool AbstractDebBasedQt4MaemoTarget::setPackageManagerName(const QString &name, QString *error) { bool success = true; foreach (Target * const t, project()->targets()) { AbstractDebBasedQt4MaemoTarget * const target = qobject_cast<AbstractDebBasedQt4MaemoTarget *>(t); if (target) { if (!target->setPackageManagerNameInternal(name, error)) success = false; } } return success; } bool AbstractDebBasedQt4MaemoTarget::setPackageManagerNameInternal(const QString &name, QString *error) { Q_UNUSED(error); return setControlFieldValue(packageManagerNameFieldName(), name.toUtf8()); } QString AbstractDebBasedQt4MaemoTarget::shortDescription() const { return QString::fromUtf8(controlFileFieldValue(ShortDescriptionFieldName, false)); } QString AbstractDebBasedQt4MaemoTarget::packageFileName() const { return QString::fromUtf8(controlFileFieldValue(PackageFieldName, false)) + QLatin1Char('_') + projectVersion() + QLatin1String("_armel.deb"); } bool AbstractDebBasedQt4MaemoTarget::setShortDescriptionInternal(const QString &description) { return setControlFieldValue(ShortDescriptionFieldName, description.toUtf8()); } QString AbstractDebBasedQt4MaemoTarget::debianDirPath() const { return project()->projectDirectory() + QLatin1Char('/') + PackagingDirName + QLatin1Char('/') + debianDirName(); } QStringList AbstractDebBasedQt4MaemoTarget::debianFiles() const { return QDir(debianDirPath()) .entryList(QDir::Files, QDir::Name | QDir::IgnoreCase); } QString AbstractDebBasedQt4MaemoTarget::changeLogFilePath() const { return debianDirPath() + QLatin1String("/changelog"); } QString AbstractDebBasedQt4MaemoTarget::controlFilePath() const { return debianDirPath() + QLatin1String("/control"); } QString AbstractDebBasedQt4MaemoTarget::rulesFilePath() const { return debianDirPath() + QLatin1String("/rules"); } QByteArray AbstractDebBasedQt4MaemoTarget::controlFileFieldValue(const QString &key, bool multiLine) const { QByteArray value; Utils::FileReader reader; if (!reader.fetch(controlFilePath())) return value; const QByteArray &contents = reader.data(); const int keyPos = contents.indexOf(key.toUtf8() + ':'); if (keyPos == -1) return value; int valueStartPos = keyPos + key.length() + 1; int valueEndPos = contents.indexOf('\n', keyPos); if (valueEndPos == -1) valueEndPos = contents.count(); value = contents.mid(valueStartPos, valueEndPos - valueStartPos).trimmed(); if (multiLine) { Q_FOREVER { valueStartPos = valueEndPos + 1; if (valueStartPos >= contents.count()) break; const char firstChar = contents.at(valueStartPos); if (firstChar == '#' || isspace(firstChar)) { valueEndPos = contents.indexOf('\n', valueStartPos); if (valueEndPos == -1) valueEndPos = contents.count(); if (firstChar != '#') { value += contents.mid(valueStartPos, valueEndPos - valueStartPos).trimmed(); } } else { break; } } } return value; } bool AbstractDebBasedQt4MaemoTarget::setControlFieldValue(const QByteArray &fieldName, const QByteArray &fieldValue) { Utils::FileReader reader; if (!reader.fetch(controlFilePath())) return false; QByteArray contents = reader.data(); if (adaptControlFileField(contents, fieldName, fieldValue)) { Core::FileChangeBlocker update(controlFilePath()); Utils::FileSaver saver(controlFilePath()); saver.write(contents); return saver.finalize(); } return true; } bool AbstractDebBasedQt4MaemoTarget::adaptControlFileField(QByteArray &document, const QByteArray &fieldName, const QByteArray &newFieldValue) { return adaptTagValue(document, fieldName, newFieldValue, true); } void AbstractDebBasedQt4MaemoTarget::handleTargetAddedSpecial() { if (controlFileFieldValue(IconFieldName, true).isEmpty()) { // Such a file is created by the mobile wizards. const QString iconPath = project()->projectDirectory() + QLatin1Char('/') + project()->displayName() + QLatin1String("64.png"); if (QFileInfo(iconPath).exists()) setPackageManagerIcon(iconPath); } m_filesWatcher->addDirectory(debianDirPath(), Utils::FileSystemWatcher::WatchAllChanges); m_controlFile = new WatchableFile(controlFilePath(), this); connect(m_controlFile, SIGNAL(modified()), SIGNAL(controlChanged())); m_changeLogFile = new WatchableFile(changeLogFilePath(), this); connect(m_changeLogFile, SIGNAL(modified()), SIGNAL(changeLogChanged())); Core::FileManager::instance()->addFiles(QList<Core::IFile *>() << m_controlFile << m_changeLogFile); connect(m_filesWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(handleDebianDirContentsChanged())); handleDebianDirContentsChanged(); emit controlChanged(); emit changeLogChanged(); } bool AbstractDebBasedQt4MaemoTarget::targetCanBeRemoved() const { return QFileInfo(debianDirPath()).exists(); } void AbstractDebBasedQt4MaemoTarget::removeTarget() { QString error; if (!Utils::FileUtils::removeRecursively(debianDirPath(), &error)) qDebug("%s", qPrintable(error)); } void AbstractDebBasedQt4MaemoTarget::handleDebianDirContentsChanged() { emit debianDirContentsChanged(); } AbstractQt4MaemoTarget::ActionStatus AbstractDebBasedQt4MaemoTarget::createSpecialTemplates() { if (QFileInfo(debianDirPath()).exists()) return NoActionRequired; QDir projectDir(project()->projectDirectory()); QProcess dh_makeProc; QString error; const Qt4BuildConfiguration * const bc = qobject_cast<Qt4BuildConfiguration * >(activeBuildConfiguration()); AbstractMaemoPackageCreationStep::preparePackagingProcess(&dh_makeProc, bc, projectDir.path() + QLatin1Char('/') + PackagingDirName); const QString dhMakeDebianDir = projectDir.path() + QLatin1Char('/') + PackagingDirName + QLatin1String("/debian"); Utils::FileUtils::removeRecursively(dhMakeDebianDir, &error); const QStringList dh_makeArgs = QStringList() << QLatin1String("dh_make") << QLatin1String("-s") << QLatin1String("-n") << QLatin1String("-p") << (defaultPackageFileName() + QLatin1Char('_') + AbstractMaemoPackageCreationStep::DefaultVersionNumber); QtSupport::BaseQtVersion *lqt = activeQt4BuildConfiguration()->qtVersion(); if (!lqt) { raiseError(tr("Unable to create Debian templates: No Qt version set")); return ActionFailed; } if (!MaemoGlobal::callMad(dh_makeProc, dh_makeArgs, lqt->qmakeCommand().toString(), true) || !dh_makeProc.waitForStarted()) { raiseError(tr("Unable to create Debian templates: dh_make failed (%1)") .arg(dh_makeProc.errorString())); return ActionFailed; } dh_makeProc.write("\n"); // Needs user input. dh_makeProc.waitForFinished(-1); if (dh_makeProc.error() != QProcess::UnknownError || dh_makeProc.exitCode() != 0) { raiseError(tr("Unable to create debian templates: dh_make failed (%1)") .arg(dh_makeProc.errorString())); return ActionFailed; } if (!QFile::rename(dhMakeDebianDir, debianDirPath())) { raiseError(tr("Unable to move new debian directory to '%1'.") .arg(QDir::toNativeSeparators(debianDirPath()))); Utils::FileUtils::removeRecursively(dhMakeDebianDir, &error); return ActionFailed; } QDir debianDir(debianDirPath()); const QStringList &files = debianDir.entryList(QDir::Files); foreach (const QString &fileName, files) { if (fileName.endsWith(QLatin1String(".ex"), Qt::CaseInsensitive) || fileName.compare(QLatin1String("README.debian"), Qt::CaseInsensitive) == 0 || fileName.compare(QLatin1String("dirs"), Qt::CaseInsensitive) == 0 || fileName.compare(QLatin1String("docs"), Qt::CaseInsensitive) == 0) { debianDir.remove(fileName); } } return adaptRulesFile() && adaptControlFile() ? ActionSuccessful : ActionFailed; } bool AbstractDebBasedQt4MaemoTarget::adaptRulesFile() { Utils::FileReader reader; if (!reader.fetch(rulesFilePath())) { raiseError(reader.errorString()); return false; } QByteArray rulesContents = reader.data(); const QByteArray comment("# Uncomment this line for use without Qt Creator"); rulesContents.replace("DESTDIR", "INSTALL_ROOT"); rulesContents.replace("dh_shlibdeps", "# dh_shlibdeps " + comment); rulesContents.replace("# Add here commands to configure the package.", "# qmake PREFIX=/usr" + comment); rulesContents.replace("$(MAKE)\n", "# $(MAKE) " + comment + '\n'); // Would be the right solution, but does not work (on Windows), // because dpkg-genchanges doesn't know about it (and can't be told). // rulesContents.replace("dh_builddeb", "dh_builddeb --destdir=."); Utils::FileSaver saver(rulesFilePath()); saver.write(rulesContents); if (!saver.finalize()) { raiseError(saver.errorString()); return false; } return true; } bool AbstractDebBasedQt4MaemoTarget::adaptControlFile() { Utils::FileReader reader; if (!reader.fetch(controlFilePath())) { raiseError(reader.errorString()); return false; } QByteArray controlContents = reader.data(); adaptControlFileField(controlContents, "Section", defaultSection()); adaptControlFileField(controlContents, "Priority", "optional"); adaptControlFileField(controlContents, packageManagerNameFieldName(), project()->displayName().toUtf8()); const int buildDependsOffset = controlContents.indexOf("Build-Depends:"); if (buildDependsOffset == -1) { qDebug("Unexpected: no Build-Depends field in debian control file."); } else { int buildDependsNewlineOffset = controlContents.indexOf('\n', buildDependsOffset); if (buildDependsNewlineOffset == -1) { controlContents += '\n'; buildDependsNewlineOffset = controlContents.length() - 1; } controlContents.insert(buildDependsNewlineOffset, ", libqt4-dev"); } addAdditionalControlFileFields(controlContents); Utils::FileSaver saver(controlFilePath()); saver.write(controlContents); if (!saver.finalize()) { raiseError(saver.errorString()); return false; } return true; } bool AbstractDebBasedQt4MaemoTarget::initAdditionalPackagingSettingsFromOtherTarget() { foreach (const Target * const t, project()->targets()) { const AbstractDebBasedQt4MaemoTarget *target = qobject_cast<const AbstractDebBasedQt4MaemoTarget *>(t); if (target && target != this) { return setControlFieldValue(IconFieldName, target->controlFileFieldValue(IconFieldName, true)); } } return true; } QStringList AbstractDebBasedQt4MaemoTarget::packagingFilePaths() const { QStringList filePaths; const QString parentDir = debianDirPath(); foreach (const QString &fileName, debianFiles()) filePaths << parentDir + QLatin1Char('/') + fileName; return filePaths; } QString AbstractDebBasedQt4MaemoTarget::defaultPackageFileName() const { QString packageName = project()->displayName().toLower(); // We also replace dots, because OVI store chokes on them. const QRegExp legalLetter(QLatin1String("[a-z0-9+-]"), Qt::CaseSensitive, QRegExp::WildcardUnix); for (int i = 0; i < packageName.length(); ++i) { if (!legalLetter.exactMatch(packageName.mid(i, 1))) packageName[i] = QLatin1Char('-'); } return packageName; } bool AbstractDebBasedQt4MaemoTarget::setPackageManagerIcon(const QString &iconFilePath, QString *error) { bool success = true; foreach (Target * const target, project()->targets()) { AbstractDebBasedQt4MaemoTarget* const maemoTarget = qobject_cast<AbstractDebBasedQt4MaemoTarget*>(target); if (maemoTarget) { if (!maemoTarget->setPackageManagerIconInternal(iconFilePath, error)) success = false; } } return success; } // The QDateTime API can only deliver these in localized form... QString AbstractDebBasedQt4MaemoTarget::shortMonthName(const QDateTime &dt) const { switch (dt.date().month()) { case 1: return QLatin1String("Jan"); case 2: return QLatin1String("Feb"); case 3: return QLatin1String("Mar"); case 4: return QLatin1String("Apr"); case 5: return QLatin1String("May"); case 6: return QLatin1String("Jun"); case 7: return QLatin1String("Jul"); case 8: return QLatin1String("Aug"); case 9: return QLatin1String("Sep"); case 10: return QLatin1String("Oct"); case 11: return QLatin1String("Nov"); case 12: return QLatin1String("Dec"); default: QTC_ASSERT(false, return QString()); } } QString AbstractDebBasedQt4MaemoTarget::shortDayOfWeekName(const QDateTime &dt) const { switch (dt.date().dayOfWeek()) { case Qt::Monday: return QLatin1String("Mon"); case Qt::Tuesday: return QLatin1String("Tue"); case Qt::Wednesday: return QLatin1String("Wed"); case Qt::Thursday: return QLatin1String("Thu"); case Qt::Friday: return QLatin1String("Fri"); case Qt::Saturday: return QLatin1String("Sat"); case Qt::Sunday: return QLatin1String("Sun"); default: QTC_ASSERT(false, return QString()); } } AbstractRpmBasedQt4MaemoTarget::AbstractRpmBasedQt4MaemoTarget(Qt4Project *parent, const QString &id) : AbstractQt4MaemoTarget(parent, id) { } AbstractRpmBasedQt4MaemoTarget::~AbstractRpmBasedQt4MaemoTarget() { } QString AbstractRpmBasedQt4MaemoTarget::specFilePath() const { const QLatin1Char sep('/'); return project()->projectDirectory() + sep + PackagingDirName + sep + specFileName(); } QString AbstractRpmBasedQt4MaemoTarget::projectVersion(QString *error) const { return QString::fromUtf8(getValueForTag(VersionTag, error)); } bool AbstractRpmBasedQt4MaemoTarget::setProjectVersionInternal(const QString &version, QString *error) { return setValueForTag(VersionTag, version.toUtf8(), error); } QString AbstractRpmBasedQt4MaemoTarget::packageName() const { return QString::fromUtf8(getValueForTag(NameTag, 0)); } bool AbstractRpmBasedQt4MaemoTarget::setPackageNameInternal(const QString &name) { return setValueForTag(NameTag, name.toUtf8(), 0); } QString AbstractRpmBasedQt4MaemoTarget::shortDescription() const { return QString::fromUtf8(getValueForTag(SummaryTag, 0)); } QString AbstractRpmBasedQt4MaemoTarget::packageFileName() const { QtSupport::BaseQtVersion *lqt = activeQt4BuildConfiguration()->qtVersion(); if (!lqt) return QString(); return packageName() + QLatin1Char('-') + projectVersion() + QLatin1Char('-') + QString::fromUtf8(getValueForTag(ReleaseTag, 0)) + QLatin1Char('.') + MaemoGlobal::architecture(lqt->qmakeCommand().toString()) + QLatin1String(".rpm"); } bool AbstractRpmBasedQt4MaemoTarget::setShortDescriptionInternal(const QString &description) { return setValueForTag(SummaryTag, description.toUtf8(), 0); } AbstractQt4MaemoTarget::ActionStatus AbstractRpmBasedQt4MaemoTarget::createSpecialTemplates() { if (QFileInfo(specFilePath()).exists()) return NoActionRequired; QByteArray initialContent( "Name: %%name%%\n" "Summary: <insert short description here>\n" "Version: 0.0.1\n" "Release: 1\n" "License: <Enter your application's license here>\n" "Group: <Set your application's group here>\n" "%description\n" "<Insert longer, multi-line description\n" "here.>\n" "\n" "%prep\n" "%setup -q\n" "\n" "%build\n" "# You can leave this empty for use with Qt Creator." "\n" "%install\n" "rm -rf %{buildroot}\n" "make INSTALL_ROOT=%{buildroot} install\n" "\n" "%clean\n" "rm -rf %{buildroot}\n" "\n" "BuildRequires: \n" "# %define _unpackaged_files_terminate_build 0\n" "%files\n" "%defattr(-,root,root,-)" "/usr\n" "/opt\n" "# Add additional files to be included in the package here.\n" "%pre\n" "# Add pre-install scripts here." "%post\n" "/sbin/ldconfig # For shared libraries\n" "%preun\n" "# Add pre-uninstall scripts here." "%postun\n" "# Add post-uninstall scripts here." ); initialContent.replace("%%name%%", project()->displayName().toUtf8()); Utils::FileSaver saver(specFilePath()); saver.write(initialContent); return saver.finalize() ? ActionSuccessful : ActionFailed; } void AbstractRpmBasedQt4MaemoTarget::handleTargetAddedSpecial() { m_specFile = new WatchableFile(specFilePath(), this); connect(m_specFile, SIGNAL(modified()), SIGNAL(specFileChanged())); Core::FileManager::instance()->addFile(m_specFile); emit specFileChanged(); } bool AbstractRpmBasedQt4MaemoTarget::targetCanBeRemoved() const { return QFileInfo(specFilePath()).exists(); } void AbstractRpmBasedQt4MaemoTarget::removeTarget() { QFile::remove(specFilePath()); } bool AbstractRpmBasedQt4MaemoTarget::initAdditionalPackagingSettingsFromOtherTarget() { // Nothing to do here for now. return true; } QByteArray AbstractRpmBasedQt4MaemoTarget::getValueForTag(const QByteArray &tag, QString *error) const { Utils::FileReader reader; if (!reader.fetch(specFilePath(), error)) return QByteArray(); const QByteArray &content = reader.data(); const QByteArray completeTag = tag.toLower() + ':'; int index = content.toLower().indexOf(completeTag); if (index == -1) return QByteArray(); index += completeTag.count(); int endIndex = content.indexOf('\n', index); if (endIndex == -1) endIndex = content.count(); return content.mid(index, endIndex - index).trimmed(); } bool AbstractRpmBasedQt4MaemoTarget::setValueForTag(const QByteArray &tag, const QByteArray &value, QString *error) { Utils::FileReader reader; if (!reader.fetch(specFilePath(), error)) return false; QByteArray content = reader.data(); if (adaptTagValue(content, tag, value, false)) { Utils::FileSaver saver(specFilePath()); saver.write(content); return saver.finalize(error); } return true; } Qt4Maemo5Target::Qt4Maemo5Target(Qt4Project *parent, const QString &id) : AbstractDebBasedQt4MaemoTarget(parent, id) { setDisplayName(defaultDisplayName()); } Qt4Maemo5Target::~Qt4Maemo5Target() {} QString Qt4Maemo5Target::defaultDisplayName() { return QApplication::translate("Qt4ProjectManager::Qt4Target", "Maemo5", "Qt4 Maemo5 target display name"); } void Qt4Maemo5Target::addAdditionalControlFileFields(QByteArray &controlContents) { Q_UNUSED(controlContents); } QString Qt4Maemo5Target::debianDirName() const { return QLatin1String("debian_fremantle"); } QByteArray Qt4Maemo5Target::packageManagerNameFieldName() const { return "XB-Maemo-Display-Name"; } QSize Qt4Maemo5Target::packageManagerIconSize() const { return QSize(48, 48); } QByteArray Qt4Maemo5Target::defaultSection() const { return "user/hidden"; } Qt4HarmattanTarget::Qt4HarmattanTarget(Qt4Project *parent, const QString &id) : AbstractDebBasedQt4MaemoTarget(parent, id) { setDisplayName(defaultDisplayName()); } Qt4HarmattanTarget::~Qt4HarmattanTarget() {} QString Qt4HarmattanTarget::defaultDisplayName() { return QApplication::translate("Qt4ProjectManager::Qt4Target", "Harmattan", "Qt4 Harmattan target display name"); } QString Qt4HarmattanTarget::aegisManifestFileName() { return QLatin1String("manifest.aegis"); } void Qt4HarmattanTarget::handleTargetAddedSpecial() { AbstractDebBasedQt4MaemoTarget::handleTargetAddedSpecial(); const QFile aegisFile(debianDirPath() + QLatin1Char('/') + aegisManifestFileName()); if (aegisFile.exists()) return; Utils::FileReader reader; if (!reader.fetch(Core::ICore::instance()->resourcePath() + QLatin1String("/templates/shared/") + aegisManifestFileName())) { qDebug("Reading manifest template failed."); return; } QString content = QString::fromUtf8(reader.data()); content.replace(QLatin1String("%%PROJECTNAME%%"), project()->displayName()); Utils::FileSaver writer(aegisFile.fileName(), QIODevice::WriteOnly); writer.write(content.toUtf8()); if (!writer.finalize()) { qDebug("Failure writing manifest file."); return; } } void Qt4HarmattanTarget::addAdditionalControlFileFields(QByteArray &controlContents) { Q_UNUSED(controlContents); } QString Qt4HarmattanTarget::debianDirName() const { return QLatin1String("debian_harmattan"); } QByteArray Qt4HarmattanTarget::packageManagerNameFieldName() const { return "XSBC-Maemo-Display-Name"; } QSize Qt4HarmattanTarget::packageManagerIconSize() const { return QSize(64, 64); } QByteArray Qt4HarmattanTarget::defaultSection() const { return "user/other"; } Qt4MeegoTarget::Qt4MeegoTarget(Qt4Project *parent, const QString &id) : AbstractRpmBasedQt4MaemoTarget(parent, id) { setDisplayName(defaultDisplayName()); } Qt4MeegoTarget::~Qt4MeegoTarget() {} QString Qt4MeegoTarget::defaultDisplayName() { return QApplication::translate("Qt4ProjectManager::Qt4Target", "MeeGo", "Qt4 MeeGo target display name"); } QString Qt4MeegoTarget::specFileName() const { return QLatin1String("meego.spec"); } } // namespace Internal } // namespace Madde
lgpl-2.1
LibreOffice/noa-libre
src/ag/ion/noa/internal/printing/PrintService.java
8706
/**************************************************************************** * * * NOA (Nice Office Access) * * ------------------------------------------------------------------------ * * * * The Contents of this file are made available subject to * * the terms of GNU Lesser General Public License Version 2.1. * * * * GNU Lesser General Public License Version 2.1 * * ======================================================================== * * Copyright 2003-2007 by IOn AG * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License version 2.1, as published by the Free Software Foundation. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * * MA 02111-1307 USA * * * * Contact us: * * http://www.ion.ag * * http://ubion.ion.ag * * info@ion.ag * * * ****************************************************************************/ /* * Last changes made by $Author: andreas $, $Date: 2006-11-06 07:24:57 +0100 (Mo, 06 Nov 2006) $ */ package ag.ion.noa.internal.printing; import ag.ion.bion.officelayer.document.DocumentException; import ag.ion.bion.officelayer.document.IDocument; import ag.ion.noa.NOAException; import ag.ion.noa.printing.IPrintProperties; import ag.ion.noa.printing.IPrintService; import ag.ion.noa.printing.IPrinter; import com.sun.star.beans.PropertyValue; import com.sun.star.uno.UnoRuntime; import com.sun.star.view.XPrintable; /** * Service for printing documents. * * @author Markus Krüger * @version $Revision: 10398 $ */ public class PrintService implements IPrintService { private IDocument document = null; //---------------------------------------------------------------------------- /** * Constructs new PrintService. * * @param document the document using this print service * * @author Markus Krüger * @date 16.08.2007 */ public PrintService(IDocument document) { if(document == null) throw new NullPointerException("Invalid document for print service."); this.document = document; } //---------------------------------------------------------------------------- /** * Prints the document to the active printer. * * @throws DocumentException if printing fails * * @author Markus Krüger * @date 16.08.2007 */ public void print() throws DocumentException { print(null); } //---------------------------------------------------------------------------- /** * Prints the document to the active printer with the given print properties. * * @param printProperties the properties to print with, or null to use default settings * * @throws DocumentException if printing fails * * @author Markus Krüger * @date 16.08.2007 */ public void print(IPrintProperties printProperties) throws DocumentException { try { XPrintable xPrintable = (XPrintable)UnoRuntime.queryInterface(XPrintable.class, document.getXComponent()); PropertyValue[] printOpts = null; if(printProperties != null) { if(printProperties.getPages() != null) printOpts = new PropertyValue[2]; else printOpts = new PropertyValue[1]; printOpts[0] = new PropertyValue(); printOpts[0].Name = "CopyCount"; printOpts[0].Value = printProperties.getCopyCount(); if(printProperties.getPages() != null) { printOpts[1] = new PropertyValue(); printOpts[1].Name = "Pages"; printOpts[1].Value = printProperties.getPages(); } } else printOpts = new PropertyValue[0]; xPrintable.print(printOpts); } catch(Throwable throwable) { throw new DocumentException(throwable); } } //---------------------------------------------------------------------------- /** * Returns if the active printer is busy. * * @return if the active printer is busy * * @throws NOAException if the busy state could not be retrieved * * @author Markus Krüger * @date 16.08.2007 */ public boolean isActivePrinterBusy() throws NOAException { try { XPrintable xPrintable = (XPrintable)UnoRuntime.queryInterface(XPrintable.class, document.getXComponent()); PropertyValue[] printerProps = xPrintable.getPrinter(); Boolean busy = new Boolean(false); for(int i = 0; i < printerProps.length; i++) { if(printerProps[i].Name.equals("IsBusy")) busy = (Boolean)printerProps[i].Value; } return busy.booleanValue(); } catch(Throwable throwable) { throw new NOAException(throwable); } } //---------------------------------------------------------------------------- /** * Returns the active printer. * * @return the active printer * * @throws NOAException if printer could not be retrieved * * @author Markus Krüger * @date 16.08.2007 */ public IPrinter getActivePrinter() throws NOAException { try { XPrintable xPrintable = (XPrintable)UnoRuntime.queryInterface(XPrintable.class, document.getXComponent()); PropertyValue[] printerProps = xPrintable.getPrinter(); String name = null; for(int i = 0; i < printerProps.length; i++) { if(printerProps[i].Name.equals("Name")) name = (String)printerProps[i].Value; } return new Printer(name); } catch(Throwable throwable) { throw new NOAException(throwable); } } //---------------------------------------------------------------------------- /** * Sets the active printer. * * @param printer the printer to be set to be active * * @throws NOAException if printer could not be set * * @author Markus Krüger * @date 16.08.2007 */ public void setActivePrinter(IPrinter printer) throws NOAException { try { if(printer == null) throw new NullPointerException("Invalid printer to be set"); XPrintable xPrintable = (XPrintable)UnoRuntime.queryInterface(XPrintable.class, document.getXComponent()); PropertyValue[] printerDesc = new PropertyValue[1]; printerDesc[0] = new PropertyValue(); printerDesc[0].Name = "Name"; printerDesc[0].Value = printer.getName(); xPrintable.setPrinter(printerDesc); } catch(Throwable throwable) { throw new NOAException(throwable); } } //---------------------------------------------------------------------------- /** * Constructs a printer with the given properties and returns it. * * @param name the name of the printer cue to be used * * @return the constructed printer * * @throws NOAException if printer could not be constructed * * @author Markus Krüger * @date 16.08.2007 */ public IPrinter createPrinter(String name) throws NOAException { return new Printer(name); } //---------------------------------------------------------------------------- }
lgpl-2.1
sitofabi/duplicati
Duplicati/Library/Backend/AzureBlob/AzureBlobWrapper.cs
5715
#region Disclaimer / License // Copyright (C) 2015, The Duplicati Team // http://www.duplicati.com, info@duplicati.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #endregion using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; using Duplicati.Library.Common.IO; using Duplicati.Library.Interface; using Duplicati.Library.Utility; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Blob; namespace Duplicati.Library.Backend.AzureBlob { /// <summary> /// Azure blob storage facade. /// </summary> public class AzureBlobWrapper { private readonly string _containerName; private readonly CloudBlobContainer _container; public string[] DnsNames { get { var lst = new List<string>(); if (_container != null) { if (_container.Uri != null) lst.Add(_container.Uri.Host); if (_container.StorageUri != null) { if (_container.StorageUri.PrimaryUri != null) lst.Add(_container.StorageUri.PrimaryUri.Host); if (_container.StorageUri.SecondaryUri != null) lst.Add(_container.StorageUri.SecondaryUri.Host); } } return lst.ToArray(); } } public AzureBlobWrapper(string accountName, string accessKey, string containerName) { OperationContext.GlobalSendingRequest += (sender, args) => { args.Request.UserAgent = string.Format( "APN/1.0 Duplicati/{0} AzureBlob/2.0 {1}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version, Microsoft.WindowsAzure.Storage.Shared.Protocol.Constants.HeaderConstants.UserAgent ); }; var connectionString = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", accountName, accessKey); var storageAccount = CloudStorageAccount.Parse(connectionString); var blobClient = storageAccount.CreateCloudBlobClient(); _containerName = containerName; _container = blobClient.GetContainerReference(containerName); } public void AddContainer() { _container.Create(BlobContainerPublicAccessType.Off); } public virtual void GetFileStream(string keyName, Stream target) { _container.GetBlockBlobReference(keyName).DownloadToStream(target); } public virtual async Task AddFileStream(string keyName, Stream source, CancellationToken cancelToken) { await _container.GetBlockBlobReference(keyName).UploadFromStreamAsync(source, cancelToken); } public void DeleteObject(string keyName) { _container.GetBlockBlobReference(keyName).DeleteIfExists(); } public virtual List<IFileEntry> ListContainerEntries() { var listBlobItems = _container.ListBlobs(blobListingDetails: BlobListingDetails.Metadata); try { return listBlobItems.Select(x => { var absolutePath = x.StorageUri.PrimaryUri.AbsolutePath; var containerSegment = string.Concat("/", _containerName, "/"); var blobName = absolutePath.Substring(absolutePath.IndexOf( containerSegment, System.StringComparison.Ordinal) + containerSegment.Length); try { if (x is CloudBlockBlob) { var cb = (CloudBlockBlob)x; var lastModified = new System.DateTime(); if (cb.Properties.LastModified != null) lastModified = new System.DateTime(cb.Properties.LastModified.Value.Ticks, System.DateTimeKind.Utc); return new FileEntry(Uri.UrlDecode(blobName.Replace("+", "%2B")), cb.Properties.Length, lastModified, lastModified); } } catch { // If the metadata fails to parse, return the basic entry } return new FileEntry(Uri.UrlDecode(blobName.Replace("+", "%2B"))); }) .Cast<IFileEntry>() .ToList(); } catch (StorageException ex) { if (ex.RequestInformation.HttpStatusCode == 404) { throw new FolderMissingException(ex); } throw; } } } }
lgpl-2.1
shabanovd/exist
src/org/exist/storage/ConsistencyCheckTask.java
10914
/* * eXist Open Source Native XML Database * Copyright (C) 2001-07 The eXist Project * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * $Id$ */ package org.exist.storage; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.List; import java.util.Properties; import org.exist.EXistException; import org.exist.backup.ConsistencyCheck; import org.exist.backup.ErrorReport; import org.exist.backup.SystemExport; import org.exist.management.Agent; import org.exist.management.AgentFactory; import org.exist.management.TaskStatus; import org.exist.security.PermissionDeniedException; import org.exist.util.Configuration; import org.exist.xquery.TerminatedException; import static java.nio.charset.StandardCharsets.UTF_8; public class ConsistencyCheckTask implements SystemTask { private String exportDir; private boolean createBackup = false; private boolean createZip = true; private boolean paused = false; private boolean incremental = false; private boolean incrementalCheck = false; private boolean checkDocs = false; private int maxInc = -1; private File lastExportedBackup = null; private ProcessMonitor.Monitor monitor = new ProcessMonitor.Monitor(); public final static String OUTPUT_PROP_NAME = "output"; public final static String ZIP_PROP_NAME = "zip"; public final static String BACKUP_PROP_NAME = "backup"; public final static String INCREMENTAL_PROP_NAME = "incremental"; public final static String INCREMENTAL_CHECK_PROP_NAME = "incremental-check"; public final static String MAX_PROP_NAME = "max"; public final static String CHECK_DOCS_PROP_NAME = "check-documents"; private final static LoggingCallback logCallback = new LoggingCallback(); @Override public boolean afterCheckpoint() { return false; } public void configure(Configuration config, Properties properties) throws EXistException { exportDir = properties.getProperty(OUTPUT_PROP_NAME, "export"); File dir = new File(exportDir); if (!dir.isAbsolute()) { dir = new File((String) config.getProperty(BrokerPool.PROPERTY_DATA_DIR), exportDir); } dir.mkdirs(); exportDir = dir.getAbsolutePath(); if (LOG.isDebugEnabled()) { LOG.debug("Using output directory " + exportDir); } final String backup = properties.getProperty(BACKUP_PROP_NAME, "no"); createBackup = backup.equalsIgnoreCase("YES"); final String zip = properties.getProperty(ZIP_PROP_NAME, "yes"); createZip = zip.equalsIgnoreCase("YES"); final String inc = properties.getProperty(INCREMENTAL_PROP_NAME, "no"); incremental = inc.equalsIgnoreCase("YES"); final String incCheck = properties.getProperty(INCREMENTAL_CHECK_PROP_NAME, "yes"); incrementalCheck = incCheck.equalsIgnoreCase("YES"); final String max = properties.getProperty(MAX_PROP_NAME, "5"); try { maxInc = Integer.parseInt(max); } catch (final NumberFormatException e) { throw new EXistException("Parameter 'max' has to be an integer"); } final String check = properties.getProperty(CHECK_DOCS_PROP_NAME, "no"); checkDocs = check.equalsIgnoreCase("YES"); } @Override public void execute(DBBroker broker) throws EXistException { final Agent agentInstance = AgentFactory.getInstance(); final BrokerPool brokerPool = broker.getBrokerPool(); final TaskStatus endStatus = new TaskStatus(TaskStatus.Status.STOPPED_OK); agentInstance.changeStatus(brokerPool, new TaskStatus(TaskStatus.Status.INIT)); if (paused) { LOG.info("Consistency check is paused."); agentInstance.changeStatus(brokerPool, new TaskStatus(TaskStatus.Status.PAUSED)); return; } brokerPool.getProcessMonitor().startJob(ProcessMonitor.ACTION_BACKUP, null, monitor); PrintWriter report = null; try { boolean doBackup = createBackup; // TODO: don't use the direct access feature for now. needs more testing List<ErrorReport> errors = null; if (!incremental || incrementalCheck) { LOG.info("Starting consistency check..."); report = openLog(); final CheckCallback cb = new CheckCallback(report); final ConsistencyCheck check = new ConsistencyCheck(broker, false, checkDocs); agentInstance.changeStatus(brokerPool, new TaskStatus(TaskStatus.Status.RUNNING_CHECK)); errors = check.checkAll(cb); if (!errors.isEmpty()) { endStatus.setStatus(TaskStatus.Status.STOPPED_ERROR); endStatus.setReason(errors); LOG.error("Errors found: " + errors.size()); doBackup = true; if (fatalErrorsFound(errors)) { LOG.error("Fatal errors were found: pausing the consistency check task."); paused = true; } } LOG.info("Finished consistency check"); } if (doBackup) { LOG.info("Starting backup..."); final SystemExport sysexport = new SystemExport(broker, logCallback, monitor, false); lastExportedBackup = sysexport.export(exportDir, incremental, maxInc, createZip, errors); agentInstance.changeStatus(brokerPool, new TaskStatus(TaskStatus.Status.RUNNING_BACKUP)); if (lastExportedBackup != null) { LOG.info("Created backup to file: " + lastExportedBackup.getAbsolutePath()); } LOG.info("Finished backup"); } } catch (final TerminatedException e) { throw new EXistException(e.getMessage(), e); } catch (final PermissionDeniedException e) { //TODO should maybe throw PermissionDeniedException instead! throw new EXistException(e.getMessage(), e); } finally { if (report != null) { report.close(); } agentInstance.changeStatus(brokerPool, endStatus); brokerPool.getProcessMonitor().endJob(); } } /** * Gets the last exported backup */ public File getLastExportedBackup() { return lastExportedBackup; } private boolean fatalErrorsFound(List<ErrorReport> errors) { for (final ErrorReport error : errors) { switch (error.getErrcode()) { // the following errors are considered fatal: export the db and // stop the task case ErrorReport.CHILD_COLLECTION: case ErrorReport.RESOURCE_ACCESS_FAILED: return true; } } // no fatal errors return false; } private PrintWriter openLog() throws EXistException { try { final File file = SystemExport.getUniqueFile("report", ".log", exportDir); final OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); return new PrintWriter(new OutputStreamWriter(os, UTF_8)); } catch (final FileNotFoundException e) { throw new EXistException("ERROR: failed to create report file in " + exportDir, e); } } private static class LoggingCallback implements SystemExport.StatusCallback { public void startCollection(String path) throws TerminatedException { } public void startDocument(String name, int current, int count) throws TerminatedException { } public void error(String message, Throwable exception) { LOG.error(message, exception); } } private class CheckCallback implements ConsistencyCheck.ProgressCallback, SystemExport.StatusCallback { private PrintWriter log; private boolean errorFound = false; private CheckCallback(PrintWriter log) { this.log = log; } // public void startDocument(String path) { // } public void startDocument(String name, int current, int count) throws TerminatedException { if (!monitor.proceed()) { throw new TerminatedException("consistency check terminated"); } if ((current % 1000 == 0) || (current == count)) { log.write(" DOCUMENT: "); log.write(Integer.valueOf(current).toString()); log.write(" of "); log.write(Integer.valueOf(count).toString()); log.write('\n'); log.flush(); } } public void startCollection(String path) throws TerminatedException { if (!monitor.proceed()) { throw new TerminatedException("consistency check terminated"); } if (errorFound) { log.write("----------------------------------------------\n"); } errorFound = false; log.write("COLLECTION: "); log.write(path); log.write('\n'); log.flush(); } public void error(ErrorReport error) { log.write("----------------------------------------------\n"); log.write(error.toString()); log.write('\n'); log.flush(); } public void error(String message, Throwable exception) { log.write("----------------------------------------------\n"); log.write("EXPORT ERROR: "); log.write(message); log.write('\n'); exception.printStackTrace(log); log.flush(); } } }
lgpl-2.1
worldforge/sage
sage/sage.h
466222
/* This file is autogenerated by build_sage.pl */ // This file may be redistributed and modified only under the terms of // the GNU Lesser General Public License (See COPYING for details). // Copyright (C) 2003 - 2009 Simon Goodall #ifndef SAGE_H #define SAGE_H 1 #ifdef __glext_h_ #error glext.h has already been included. #endif #define __glext_h_ 1 #define GL_ARB_MULTITEXTURE 0 #define GL_ARB_TRANSPOSE_MATRIX 1 #define GL_ARB_MULTISAMPLE 2 #define GL_ARB_TEXTURE_ENV_ADD 3 #define GL_ARB_TEXTURE_CUBE_MAP 4 #define GL_ARB_TEXTURE_COMPRESSION 5 #define GL_ARB_TEXTURE_BORDER_CLAMP 6 #define GL_ARB_POINT_PARAMETERS 7 #define GL_ARB_VERTEX_BLEND 8 #define GL_ARB_MATRIX_PALETTE 9 #define GL_ARB_TEXTURE_ENV_COMBINE 10 #define GL_ARB_TEXTURE_ENV_CROSSBAR 11 #define GL_ARB_TEXTURE_ENV_DOT3 12 #define GL_ARB_TEXTURE_MIRRORED_REPEAT 13 #define GL_ARB_DEPTH_TEXTURE 14 #define GL_ARB_SHADOW 15 #define GL_ARB_SHADOW_AMBIENT 16 #define GL_ARB_WINDOW_POS 17 #define GL_ARB_VERTEX_PROGRAM 18 #define GL_ARB_FRAGMENT_PROGRAM 19 #define GL_ARB_VERTEX_BUFFER_OBJECT 20 #define GL_ARB_OCCLUSION_QUERY 21 #define GL_ARB_SHADER_OBJECTS 22 #define GL_ARB_VERTEX_SHADER 23 #define GL_ARB_FRAGMENT_SHADER 24 #define GL_ARB_SHADING_LANGUAGE_100 25 #define GL_ARB_TEXTURE_NON_POWER_OF_TWO 26 #define GL_ARB_POINT_SPRITE 27 #define GL_ARB_FRAGMENT_PROGRAM_SHADOW 28 #define GL_ARB_DRAW_BUFFERS 29 #define GL_ARB_TEXTURE_RECTANGLE 30 #define GL_ARB_COLOR_BUFFER_FLOAT 31 #define GL_ARB_HALF_FLOAT_PIXEL 32 #define GL_ARB_TEXTURE_FLOAT 33 #define GL_ARB_PIXEL_BUFFER_OBJECT 34 #define GL_ARB_DEPTH_BUFFER_FLOAT 35 #define GL_ARB_DRAW_INSTANCED 36 #define GL_ARB_FRAMEBUFFER_OBJECT 37 #define GL_ARB_FRAMEBUFFER_SRGB 38 #define GL_ARB_GEOMETRY_SHADER4 39 #define GL_ARB_HALF_FLOAT_VERTEX 40 #define GL_ARB_INSTANCED_ARRAYS 41 #define GL_ARB_MAP_BUFFER_RANGE 42 #define GL_ARB_TEXTURE_BUFFER_OBJECT 43 #define GL_ARB_TEXTURE_COMPRESSION_RGTC 44 #define GL_ARB_TEXTURE_RG 45 #define GL_ARB_VERTEX_ARRAY_OBJECT 46 #define GL_ARB_UNIFORM_BUFFER_OBJECT 47 #define GL_ARB_COMPATIBILITY 48 #define GL_ARB_COPY_BUFFER 49 #define GL_ARB_SHADER_TEXTURE_LOD 50 #define GL_ARB_DEPTH_CLAMP 51 #define GL_ARB_DRAW_ELEMENTS_BASE_VERTEX 52 #define GL_ARB_FRAGMENT_COORD_CONVENTIONS 53 #define GL_ARB_PROVOKING_VERTEX 54 #define GL_ARB_SEAMLESS_CUBE_MAP 55 #define GL_ARB_TEXTURE_MULTISAMPLE 56 #define GL_ARB_VERTEX_ARRAY_BGRA 57 #define GL_ARB_DRAW_BUFFERS_BLEND 58 #define GL_ARB_SAMPLE_SHADING 59 #define GL_ARB_TEXTURE_CUBE_MAP_ARRAY 60 #define GL_ARB_TEXTURE_GATHER 61 #define GL_ARB_TEXTURE_QUERY_LOD 62 #define GL_EXT_ABGR 63 #define GL_EXT_BLEND_COLOR 64 #define GL_EXT_POLYGON_OFFSET 65 #define GL_EXT_TEXTURE 66 #define GL_EXT_TEXTURE3D 67 #define GL_SGIS_TEXTURE_FILTER4 68 #define GL_EXT_SUBTEXTURE 69 #define GL_EXT_COPY_TEXTURE 70 #define GL_EXT_HISTOGRAM 71 #define GL_EXT_CONVOLUTION 72 #define GL_SGI_COLOR_MATRIX 73 #define GL_SGI_COLOR_TABLE 74 #define GL_SGIX_PIXEL_TEXTURE 75 #define GL_SGIS_PIXEL_TEXTURE 76 #define GL_SGIS_TEXTURE4D 77 #define GL_SGI_TEXTURE_COLOR_TABLE 78 #define GL_EXT_CMYKA 79 #define GL_EXT_TEXTURE_OBJECT 80 #define GL_SGIS_DETAIL_TEXTURE 81 #define GL_SGIS_SHARPEN_TEXTURE 82 #define GL_EXT_PACKED_PIXELS 83 #define GL_SGIS_TEXTURE_LOD 84 #define GL_SGIS_MULTISAMPLE 85 #define GL_EXT_RESCALE_NORMAL 86 #define GL_EXT_VERTEX_ARRAY 87 #define GL_EXT_MISC_ATTRIBUTE 88 #define GL_SGIS_GENERATE_MIPMAP 89 #define GL_SGIX_CLIPMAP 90 #define GL_SGIX_SHADOW 91 #define GL_SGIS_TEXTURE_EDGE_CLAMP 92 #define GL_SGIS_TEXTURE_BORDER_CLAMP 93 #define GL_EXT_BLEND_MINMAX 94 #define GL_EXT_BLEND_SUBTRACT 95 #define GL_EXT_BLEND_LOGIC_OP 96 #define GL_SGIX_INTERLACE 97 #define GL_SGIX_PIXEL_TILES 98 #define GL_SGIX_TEXTURE_SELECT 99 #define GL_SGIX_SPRITE 100 #define GL_SGIX_TEXTURE_MULTI_BUFFER 101 #define GL_EXT_POINT_PARAMETERS 102 #define GL_SGIS_POINT_PARAMETERS 103 #define GL_SGIX_INSTRUMENTS 104 #define GL_SGIX_TEXTURE_SCALE_BIAS 105 #define GL_SGIX_FRAMEZOOM 106 #define GL_SGIX_TAG_SAMPLE_BUFFER 107 #define GL_SGIX_POLYNOMIAL_FFD 108 #define GL_SGIX_REFERENCE_PLANE 109 #define GL_SGIX_FLUSH_RASTER 110 #define GL_SGIX_DEPTH_TEXTURE 111 #define GL_SGIS_FOG_FUNCTION 112 #define GL_SGIX_FOG_OFFSET 113 #define GL_HP_IMAGE_TRANSFORM 114 #define GL_HP_CONVOLUTION_BORDER_MODES 115 #define GL_SGIX_TEXTURE_ADD_ENV 116 #define GL_EXT_COLOR_SUBTABLE 117 #define GL_PGI_VERTEX_HINTS 118 #define GL_PGI_MISC_HINTS 119 #define GL_EXT_PALETTED_TEXTURE 120 #define GL_EXT_CLIP_VOLUME_HINT 121 #define GL_SGIX_LIST_PRIORITY 122 #define GL_SGIX_IR_INSTRUMENT1 123 #define GL_SGIX_CALLIGRAPHIC_FRAGMENT 124 #define GL_SGIX_TEXTURE_LOD_BIAS 125 #define GL_SGIX_SHADOW_AMBIENT 126 #define GL_EXT_INDEX_TEXTURE 127 #define GL_EXT_INDEX_MATERIAL 128 #define GL_EXT_INDEX_FUNC 129 #define GL_EXT_INDEX_ARRAY_FORMATS 130 #define GL_EXT_COMPILED_VERTEX_ARRAY 131 #define GL_EXT_CULL_VERTEX 132 #define GL_SGIX_YCRCB 133 #define GL_SGIX_FRAGMENT_LIGHTING 134 #define GL_IBM_RASTERPOS_CLIP 135 #define GL_HP_TEXTURE_LIGHTING 136 #define GL_EXT_DRAW_RANGE_ELEMENTS 137 #define GL_WIN_PHONG_SHADING 138 #define GL_WIN_SPECULAR_FOG 139 #define GL_EXT_LIGHT_TEXTURE 140 #define GL_SGIX_BLEND_ALPHA_MINMAX 141 #define GL_EXT_BGRA 142 #define GL_SGIX_ASYNC 143 #define GL_SGIX_ASYNC_PIXEL 144 #define GL_SGIX_ASYNC_HISTOGRAM 145 #define GL_INTEL_PARALLEL_ARRAYS 146 #define GL_HP_OCCLUSION_TEST 147 #define GL_EXT_PIXEL_TRANSFORM 148 #define GL_EXT_PIXEL_TRANSFORM_COLOR_TABLE 149 #define GL_EXT_SHARED_TEXTURE_PALETTE 150 #define GL_EXT_SEPARATE_SPECULAR_COLOR 151 #define GL_EXT_SECONDARY_COLOR 152 #define GL_EXT_TEXTURE_PERTURB_NORMAL 153 #define GL_EXT_MULTI_DRAW_ARRAYS 154 #define GL_EXT_FOG_COORD 155 #define GL_REND_SCREEN_COORDINATES 156 #define GL_EXT_COORDINATE_FRAME 157 #define GL_EXT_TEXTURE_ENV_COMBINE 158 #define GL_APPLE_SPECULAR_VECTOR 159 #define GL_APPLE_TRANSFORM_HINT 160 #define GL_SGIX_FOG_SCALE 161 #define GL_SUNX_CONSTANT_DATA 162 #define GL_SUN_GLOBAL_ALPHA 163 #define GL_SUN_TRIANGLE_LIST 164 #define GL_SUN_VERTEX 165 #define GL_EXT_BLEND_FUNC_SEPARATE 166 #define GL_INGR_BLEND_FUNC_SEPARATE 167 #define GL_INGR_COLOR_CLAMP 168 #define GL_INGR_INTERLACE_READ 169 #define GL_EXT_STENCIL_WRAP 170 #define GL_EXT_422_PIXELS 171 #define GL_NV_TEXGEN_REFLECTION 172 #define GL_SUN_CONVOLUTION_BORDER_MODES 173 #define GL_EXT_TEXTURE_ENV_ADD 174 #define GL_EXT_TEXTURE_LOD_BIAS 175 #define GL_EXT_TEXTURE_FILTER_ANISOTROPIC 176 #define GL_EXT_VERTEX_WEIGHTING 177 #define GL_NV_LIGHT_MAX_EXPONENT 178 #define GL_NV_VERTEX_ARRAY_RANGE 179 #define GL_NV_REGISTER_COMBINERS 180 #define GL_NV_FOG_DISTANCE 181 #define GL_NV_TEXGEN_EMBOSS 182 #define GL_NV_BLEND_SQUARE 183 #define GL_NV_TEXTURE_ENV_COMBINE4 184 #define GL_MESA_RESIZE_BUFFERS 185 #define GL_MESA_WINDOW_POS 186 #define GL_IBM_CULL_VERTEX 187 #define GL_IBM_MULTIMODE_DRAW_ARRAYS 188 #define GL_IBM_VERTEX_ARRAY_LISTS 189 #define GL_SGIX_SUBSAMPLE 190 #define GL_SGIX_YCRCBA 191 #define GL_SGIX_YCRCB_SUBSAMPLE 192 #define GL_SGIX_DEPTH_PASS_INSTRUMENT 193 #define GL_3DFX_TEXTURE_COMPRESSION_FXT1 194 #define GL_3DFX_MULTISAMPLE 195 #define GL_3DFX_TBUFFER 196 #define GL_EXT_MULTISAMPLE 197 #define GL_SGIX_VERTEX_PRECLIP 198 #define GL_SGIX_CONVOLUTION_ACCURACY 199 #define GL_SGIX_RESAMPLE 200 #define GL_SGIS_POINT_LINE_TEXGEN 201 #define GL_SGIS_TEXTURE_COLOR_MASK 202 #define GL_SGIX_IGLOO_INTERFACE 203 #define GL_EXT_TEXTURE_ENV_DOT3 204 #define GL_ATI_TEXTURE_MIRROR_ONCE 205 #define GL_NV_FENCE 206 #define GL_NV_EVALUATORS 207 #define GL_NV_PACKED_DEPTH_STENCIL 208 #define GL_NV_REGISTER_COMBINERS2 209 #define GL_NV_TEXTURE_COMPRESSION_VTC 210 #define GL_NV_TEXTURE_RECTANGLE 211 #define GL_NV_TEXTURE_SHADER 212 #define GL_NV_TEXTURE_SHADER2 213 #define GL_NV_VERTEX_ARRAY_RANGE2 214 #define GL_NV_VERTEX_PROGRAM 215 #define GL_SGIX_TEXTURE_COORDINATE_CLAMP 216 #define GL_SGIX_SCALEBIAS_HINT 217 #define GL_OML_INTERLACE 218 #define GL_OML_SUBSAMPLE 219 #define GL_OML_RESAMPLE 220 #define GL_NV_COPY_DEPTH_TO_COLOR 221 #define GL_ATI_ENVMAP_BUMPMAP 222 #define GL_ATI_FRAGMENT_SHADER 223 #define GL_ATI_PN_TRIANGLES 224 #define GL_ATI_VERTEX_ARRAY_OBJECT 225 #define GL_EXT_VERTEX_SHADER 226 #define GL_ATI_VERTEX_STREAMS 227 #define GL_ATI_ELEMENT_ARRAY 228 #define GL_SUN_MESH_ARRAY 229 #define GL_SUN_SLICE_ACCUM 230 #define GL_NV_MULTISAMPLE_FILTER_HINT 231 #define GL_NV_DEPTH_CLAMP 232 #define GL_NV_OCCLUSION_QUERY 233 #define GL_NV_POINT_SPRITE 234 #define GL_NV_TEXTURE_SHADER3 235 #define GL_NV_VERTEX_PROGRAM1_1 236 #define GL_EXT_SHADOW_FUNCS 237 #define GL_EXT_STENCIL_TWO_SIDE 238 #define GL_ATI_TEXT_FRAGMENT_SHADER 239 #define GL_APPLE_CLIENT_STORAGE 240 #define GL_APPLE_ELEMENT_ARRAY 241 #define GL_APPLE_FENCE 242 #define GL_APPLE_VERTEX_ARRAY_OBJECT 243 #define GL_APPLE_VERTEX_ARRAY_RANGE 244 #define GL_APPLE_YCBCR_422 245 #define GL_S3_S3TC 246 #define GL_ATI_DRAW_BUFFERS 247 #define GL_ATI_PIXEL_FORMAT_FLOAT 248 #define GL_ATI_TEXTURE_ENV_COMBINE3 249 #define GL_ATI_TEXTURE_FLOAT 250 #define GL_NV_FLOAT_BUFFER 251 #define GL_NV_FRAGMENT_PROGRAM 252 #define GL_NV_HALF_FLOAT 253 #define GL_NV_PIXEL_DATA_RANGE 254 #define GL_NV_PRIMITIVE_RESTART 255 #define GL_NV_TEXTURE_EXPAND_NORMAL 256 #define GL_NV_VERTEX_PROGRAM2 257 #define GL_ATI_MAP_OBJECT_BUFFER 258 #define GL_ATI_SEPARATE_STENCIL 259 #define GL_ATI_VERTEX_ATTRIB_ARRAY_OBJECT 260 #define GL_OES_READ_FORMAT 261 #define GL_EXT_DEPTH_BOUNDS_TEST 262 #define GL_EXT_TEXTURE_MIRROR_CLAMP 263 #define GL_EXT_BLEND_EQUATION_SEPARATE 264 #define GL_MESA_PACK_INVERT 265 #define GL_MESA_YCBCR_TEXTURE 266 #define GL_EXT_PIXEL_BUFFER_OBJECT 267 #define GL_NV_FRAGMENT_PROGRAM_OPTION 268 #define GL_NV_FRAGMENT_PROGRAM2 269 #define GL_NV_VERTEX_PROGRAM2_OPTION 270 #define GL_NV_VERTEX_PROGRAM3 271 #define GL_EXT_FRAMEBUFFER_OBJECT 272 #define GL_GREMEDY_STRING_MARKER 273 #define GL_EXT_PACKED_DEPTH_STENCIL 274 #define GL_EXT_STENCIL_CLEAR_TAG 275 #define GL_EXT_TEXTURE_SRGB 276 #define GL_EXT_FRAMEBUFFER_BLIT 277 #define GL_EXT_FRAMEBUFFER_MULTISAMPLE 278 #define GL_MESAX_TEXTURE_STACK 279 #define GL_EXT_TIMER_QUERY 280 #define GL_EXT_GPU_PROGRAM_PARAMETERS 281 #define GL_APPLE_FLUSH_BUFFER_RANGE 282 #define GL_NV_GPU_PROGRAM4 283 #define GL_NV_GEOMETRY_PROGRAM4 284 #define GL_EXT_GEOMETRY_SHADER4 285 #define GL_NV_VERTEX_PROGRAM4 286 #define GL_EXT_GPU_SHADER4 287 #define GL_EXT_DRAW_INSTANCED 288 #define GL_EXT_PACKED_FLOAT 289 #define GL_EXT_TEXTURE_ARRAY 290 #define GL_EXT_TEXTURE_BUFFER_OBJECT 291 #define GL_EXT_TEXTURE_COMPRESSION_LATC 292 #define GL_EXT_TEXTURE_COMPRESSION_RGTC 293 #define GL_EXT_TEXTURE_SHARED_EXPONENT 294 #define GL_NV_DEPTH_BUFFER_FLOAT 295 #define GL_NV_FRAGMENT_PROGRAM4 296 #define GL_NV_FRAMEBUFFER_MULTISAMPLE_COVERAGE 297 #define GL_EXT_FRAMEBUFFER_SRGB 298 #define GL_NV_GEOMETRY_SHADER4 299 #define GL_NV_PARAMETER_BUFFER_OBJECT 300 #define GL_EXT_DRAW_BUFFERS2 301 #define GL_NV_TRANSFORM_FEEDBACK 302 #define GL_EXT_BINDABLE_UNIFORM 303 #define GL_EXT_TEXTURE_INTEGER 304 #define GL_GREMEDY_FRAME_TERMINATOR 305 #define GL_NV_CONDITIONAL_RENDER 306 #define GL_NV_PRESENT_VIDEO 307 #define GL_EXT_TRANSFORM_FEEDBACK 308 #define GL_EXT_DIRECT_STATE_ACCESS 309 #define GL_EXT_VERTEX_ARRAY_BGRA 310 #define GL_EXT_TEXTURE_SWIZZLE 311 #define GL_NV_EXPLICIT_MULTISAMPLE 312 #define GL_NV_TRANSFORM_FEEDBACK2 313 #define GL_ATI_MEMINFO 314 #define GL_AMD_PERFORMANCE_MONITOR 315 #define GL_AMD_TEXTURE_TEXTURE4 316 #define GL_AMD_VERTEX_SHADER_TESSELATOR 317 #define GL_EXT_PROVOKING_VERTEX 318 #define GL_EXT_TEXTURE_SNORM 319 #define GL_AMD_DRAW_BUFFERS_BLEND 320 #define GL_APPLE_TEXTURE_RANGE 321 #define GL_APPLE_FLOAT_PIXELS 322 #define GL_APPLE_VERTEX_PROGRAM_EVALUATORS 323 #define GL_APPLE_AUX_DEPTH_STENCIL 324 #define GL_APPLE_OBJECT_PURGEABLE 325 #define GL_APPLE_ROW_BYTES 326 #define GL_APPLE_RGB_422 327 #define GL_NV_VIDEO_CAPTURE 328 #define GL_NV_COPY_IMAGE 329 #define GL_EXT_SEPARATE_SHADER_OBJECTS 330 #define GL_NV_PARAMETER_BUFFER_OBJECT2 331 #define GL_NV_SHADER_BUFFER_LOAD 332 #define GL_NV_VERTEX_BUFFER_UNIFIED_MEMORY 333 #define GL_NV_TEXTURE_BARRIER 334 #define SAGE_LAST_EXTENSION 335 #include <sage/header.h> #include <sage/GL.h> #include <stddef.h> SAGEAPI int sage_ext[SAGE_LAST_EXTENSION]; #ifndef GL_VERSION_1_2 #define GL_UNSIGNED_BYTE_3_3_2 0x8032 #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 #define GL_UNSIGNED_INT_8_8_8_8 0x8035 #define GL_UNSIGNED_INT_10_10_10_2 0x8036 #define GL_TEXTURE_BINDING_3D 0x806A #define GL_PACK_SKIP_IMAGES 0x806B #define GL_PACK_IMAGE_HEIGHT 0x806C #define GL_UNPACK_SKIP_IMAGES 0x806D #define GL_UNPACK_IMAGE_HEIGHT 0x806E #define GL_TEXTURE_3D 0x806F #define GL_PROXY_TEXTURE_3D 0x8070 #define GL_TEXTURE_DEPTH 0x8071 #define GL_TEXTURE_WRAP_R 0x8072 #define GL_MAX_3D_TEXTURE_SIZE 0x8073 #define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 #define GL_UNSIGNED_SHORT_5_6_5 0x8363 #define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 #define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 #define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 #define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 #define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 #define GL_BGR 0x80E0 #define GL_BGRA 0x80E1 #define GL_MAX_ELEMENTS_VERTICES 0x80E8 #define GL_MAX_ELEMENTS_INDICES 0x80E9 #define GL_CLAMP_TO_EDGE 0x812F #define GL_TEXTURE_MIN_LOD 0x813A #define GL_TEXTURE_MAX_LOD 0x813B #define GL_TEXTURE_BASE_LEVEL 0x813C #define GL_TEXTURE_MAX_LEVEL 0x813D #define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 #define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 #define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 #define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E #endif #ifndef GL_VERSION_1_2_DEPRECATED #define GL_RESCALE_NORMAL 0x803A #define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 #define GL_SINGLE_COLOR 0x81F9 #define GL_SEPARATE_SPECULAR_COLOR 0x81FA #define GL_ALIASED_POINT_SIZE_RANGE 0x846D #endif #ifndef GL_ARB_imaging #define GL_CONSTANT_COLOR 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 #define GL_CONSTANT_ALPHA 0x8003 #define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 #define GL_BLEND_COLOR 0x8005 #define GL_FUNC_ADD 0x8006 #define GL_MIN 0x8007 #define GL_MAX 0x8008 #define GL_BLEND_EQUATION 0x8009 #define GL_FUNC_SUBTRACT 0x800A #define GL_FUNC_REVERSE_SUBTRACT 0x800B #endif #ifndef GL_ARB_imaging_DEPRECATED #define GL_CONVOLUTION_1D 0x8010 #define GL_CONVOLUTION_2D 0x8011 #define GL_SEPARABLE_2D 0x8012 #define GL_CONVOLUTION_BORDER_MODE 0x8013 #define GL_CONVOLUTION_FILTER_SCALE 0x8014 #define GL_CONVOLUTION_FILTER_BIAS 0x8015 #define GL_REDUCE 0x8016 #define GL_CONVOLUTION_FORMAT 0x8017 #define GL_CONVOLUTION_WIDTH 0x8018 #define GL_CONVOLUTION_HEIGHT 0x8019 #define GL_MAX_CONVOLUTION_WIDTH 0x801A #define GL_MAX_CONVOLUTION_HEIGHT 0x801B #define GL_POST_CONVOLUTION_RED_SCALE 0x801C #define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D #define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E #define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F #define GL_POST_CONVOLUTION_RED_BIAS 0x8020 #define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 #define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 #define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 #define GL_HISTOGRAM 0x8024 #define GL_PROXY_HISTOGRAM 0x8025 #define GL_HISTOGRAM_WIDTH 0x8026 #define GL_HISTOGRAM_FORMAT 0x8027 #define GL_HISTOGRAM_RED_SIZE 0x8028 #define GL_HISTOGRAM_GREEN_SIZE 0x8029 #define GL_HISTOGRAM_BLUE_SIZE 0x802A #define GL_HISTOGRAM_ALPHA_SIZE 0x802B #define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C #define GL_HISTOGRAM_SINK 0x802D #define GL_MINMAX 0x802E #define GL_MINMAX_FORMAT 0x802F #define GL_MINMAX_SINK 0x8030 #define GL_TABLE_TOO_LARGE 0x8031 #define GL_COLOR_MATRIX 0x80B1 #define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 #define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 #define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 #define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 #define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 #define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 #define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 #define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 #define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA #define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB #define GL_COLOR_TABLE 0x80D0 #define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 #define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 #define GL_PROXY_COLOR_TABLE 0x80D3 #define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 #define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 #define GL_COLOR_TABLE_SCALE 0x80D6 #define GL_COLOR_TABLE_BIAS 0x80D7 #define GL_COLOR_TABLE_FORMAT 0x80D8 #define GL_COLOR_TABLE_WIDTH 0x80D9 #define GL_COLOR_TABLE_RED_SIZE 0x80DA #define GL_COLOR_TABLE_GREEN_SIZE 0x80DB #define GL_COLOR_TABLE_BLUE_SIZE 0x80DC #define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD #define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE #define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF #define GL_CONSTANT_BORDER 0x8151 #define GL_REPLICATE_BORDER 0x8153 #define GL_CONVOLUTION_BORDER_COLOR 0x8154 #endif #ifndef GL_VERSION_1_3 #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 #define GL_TEXTURE2 0x84C2 #define GL_TEXTURE3 0x84C3 #define GL_TEXTURE4 0x84C4 #define GL_TEXTURE5 0x84C5 #define GL_TEXTURE6 0x84C6 #define GL_TEXTURE7 0x84C7 #define GL_TEXTURE8 0x84C8 #define GL_TEXTURE9 0x84C9 #define GL_TEXTURE10 0x84CA #define GL_TEXTURE11 0x84CB #define GL_TEXTURE12 0x84CC #define GL_TEXTURE13 0x84CD #define GL_TEXTURE14 0x84CE #define GL_TEXTURE15 0x84CF #define GL_TEXTURE16 0x84D0 #define GL_TEXTURE17 0x84D1 #define GL_TEXTURE18 0x84D2 #define GL_TEXTURE19 0x84D3 #define GL_TEXTURE20 0x84D4 #define GL_TEXTURE21 0x84D5 #define GL_TEXTURE22 0x84D6 #define GL_TEXTURE23 0x84D7 #define GL_TEXTURE24 0x84D8 #define GL_TEXTURE25 0x84D9 #define GL_TEXTURE26 0x84DA #define GL_TEXTURE27 0x84DB #define GL_TEXTURE28 0x84DC #define GL_TEXTURE29 0x84DD #define GL_TEXTURE30 0x84DE #define GL_TEXTURE31 0x84DF #define GL_ACTIVE_TEXTURE 0x84E0 #define GL_MULTISAMPLE 0x809D #define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E #define GL_SAMPLE_ALPHA_TO_ONE 0x809F #define GL_SAMPLE_COVERAGE 0x80A0 #define GL_SAMPLE_BUFFERS 0x80A8 #define GL_SAMPLES 0x80A9 #define GL_SAMPLE_COVERAGE_VALUE 0x80AA #define GL_SAMPLE_COVERAGE_INVERT 0x80AB #define GL_TEXTURE_CUBE_MAP 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A #define GL_PROXY_TEXTURE_CUBE_MAP 0x851B #define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C #define GL_COMPRESSED_RGB 0x84ED #define GL_COMPRESSED_RGBA 0x84EE #define GL_TEXTURE_COMPRESSION_HINT 0x84EF #define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 #define GL_TEXTURE_COMPRESSED 0x86A1 #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 #define GL_CLAMP_TO_BORDER 0x812D #endif #ifndef GL_VERSION_1_3_DEPRECATED #define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 #define GL_MAX_TEXTURE_UNITS 0x84E2 #define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 #define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 #define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 #define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 #define GL_MULTISAMPLE_BIT 0x20000000 #define GL_NORMAL_MAP 0x8511 #define GL_REFLECTION_MAP 0x8512 #define GL_COMPRESSED_ALPHA 0x84E9 #define GL_COMPRESSED_LUMINANCE 0x84EA #define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB #define GL_COMPRESSED_INTENSITY 0x84EC #define GL_COMBINE 0x8570 #define GL_COMBINE_RGB 0x8571 #define GL_COMBINE_ALPHA 0x8572 #define GL_SOURCE0_RGB 0x8580 #define GL_SOURCE1_RGB 0x8581 #define GL_SOURCE2_RGB 0x8582 #define GL_SOURCE0_ALPHA 0x8588 #define GL_SOURCE1_ALPHA 0x8589 #define GL_SOURCE2_ALPHA 0x858A #define GL_OPERAND0_RGB 0x8590 #define GL_OPERAND1_RGB 0x8591 #define GL_OPERAND2_RGB 0x8592 #define GL_OPERAND0_ALPHA 0x8598 #define GL_OPERAND1_ALPHA 0x8599 #define GL_OPERAND2_ALPHA 0x859A #define GL_RGB_SCALE 0x8573 #define GL_ADD_SIGNED 0x8574 #define GL_INTERPOLATE 0x8575 #define GL_SUBTRACT 0x84E7 #define GL_CONSTANT 0x8576 #define GL_PRIMARY_COLOR 0x8577 #define GL_PREVIOUS 0x8578 #define GL_DOT3_RGB 0x86AE #define GL_DOT3_RGBA 0x86AF #endif #ifndef GL_VERSION_1_4 #define GL_BLEND_DST_RGB 0x80C8 #define GL_BLEND_SRC_RGB 0x80C9 #define GL_BLEND_DST_ALPHA 0x80CA #define GL_BLEND_SRC_ALPHA 0x80CB #define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 #define GL_DEPTH_COMPONENT16 0x81A5 #define GL_DEPTH_COMPONENT24 0x81A6 #define GL_DEPTH_COMPONENT32 0x81A7 #define GL_MIRRORED_REPEAT 0x8370 #define GL_MAX_TEXTURE_LOD_BIAS 0x84FD #define GL_TEXTURE_LOD_BIAS 0x8501 #define GL_INCR_WRAP 0x8507 #define GL_DECR_WRAP 0x8508 #define GL_TEXTURE_DEPTH_SIZE 0x884A #define GL_TEXTURE_COMPARE_MODE 0x884C #define GL_TEXTURE_COMPARE_FUNC 0x884D #endif #ifndef GL_VERSION_1_4_DEPRECATED #define GL_POINT_SIZE_MIN 0x8126 #define GL_POINT_SIZE_MAX 0x8127 #define GL_POINT_DISTANCE_ATTENUATION 0x8129 #define GL_GENERATE_MIPMAP 0x8191 #define GL_GENERATE_MIPMAP_HINT 0x8192 #define GL_FOG_COORDINATE_SOURCE 0x8450 #define GL_FOG_COORDINATE 0x8451 #define GL_FRAGMENT_DEPTH 0x8452 #define GL_CURRENT_FOG_COORDINATE 0x8453 #define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 #define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 #define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 #define GL_FOG_COORDINATE_ARRAY 0x8457 #define GL_COLOR_SUM 0x8458 #define GL_CURRENT_SECONDARY_COLOR 0x8459 #define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A #define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B #define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C #define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D #define GL_SECONDARY_COLOR_ARRAY 0x845E #define GL_TEXTURE_FILTER_CONTROL 0x8500 #define GL_DEPTH_TEXTURE_MODE 0x884B #define GL_COMPARE_R_TO_TEXTURE 0x884E #endif #ifndef GL_VERSION_1_5 #define GL_BUFFER_SIZE 0x8764 #define GL_BUFFER_USAGE 0x8765 #define GL_QUERY_COUNTER_BITS 0x8864 #define GL_CURRENT_QUERY 0x8865 #define GL_QUERY_RESULT 0x8866 #define GL_QUERY_RESULT_AVAILABLE 0x8867 #define GL_ARRAY_BUFFER 0x8892 #define GL_ELEMENT_ARRAY_BUFFER 0x8893 #define GL_ARRAY_BUFFER_BINDING 0x8894 #define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F #define GL_READ_ONLY 0x88B8 #define GL_WRITE_ONLY 0x88B9 #define GL_READ_WRITE 0x88BA #define GL_BUFFER_ACCESS 0x88BB #define GL_BUFFER_MAPPED 0x88BC #define GL_BUFFER_MAP_POINTER 0x88BD #define GL_STREAM_DRAW 0x88E0 #define GL_STREAM_READ 0x88E1 #define GL_STREAM_COPY 0x88E2 #define GL_STATIC_DRAW 0x88E4 #define GL_STATIC_READ 0x88E5 #define GL_STATIC_COPY 0x88E6 #define GL_DYNAMIC_DRAW 0x88E8 #define GL_DYNAMIC_READ 0x88E9 #define GL_DYNAMIC_COPY 0x88EA #define GL_SAMPLES_PASSED 0x8914 #endif #ifndef GL_VERSION_1_5_DEPRECATED #define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 #define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 #define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 #define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 #define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A #define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B #define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C #define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D #define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E #define GL_FOG_COORD_SRC 0x8450 #define GL_FOG_COORD 0x8451 #define GL_CURRENT_FOG_COORD 0x8453 #define GL_FOG_COORD_ARRAY_TYPE 0x8454 #define GL_FOG_COORD_ARRAY_STRIDE 0x8455 #define GL_FOG_COORD_ARRAY_POINTER 0x8456 #define GL_FOG_COORD_ARRAY 0x8457 #define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D #define GL_SRC0_RGB 0x8580 #define GL_SRC1_RGB 0x8581 #define GL_SRC2_RGB 0x8582 #define GL_SRC0_ALPHA 0x8588 #define GL_SRC1_ALPHA 0x8589 #define GL_SRC2_ALPHA 0x858A #endif #ifndef GL_VERSION_2_0 #define GL_BLEND_EQUATION_RGB 0x8009 #define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 #define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 #define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 #define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 #define GL_CURRENT_VERTEX_ATTRIB 0x8626 #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 #define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 #define GL_STENCIL_BACK_FUNC 0x8800 #define GL_STENCIL_BACK_FAIL 0x8801 #define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 #define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 #define GL_MAX_DRAW_BUFFERS 0x8824 #define GL_DRAW_BUFFER0 0x8825 #define GL_DRAW_BUFFER1 0x8826 #define GL_DRAW_BUFFER2 0x8827 #define GL_DRAW_BUFFER3 0x8828 #define GL_DRAW_BUFFER4 0x8829 #define GL_DRAW_BUFFER5 0x882A #define GL_DRAW_BUFFER6 0x882B #define GL_DRAW_BUFFER7 0x882C #define GL_DRAW_BUFFER8 0x882D #define GL_DRAW_BUFFER9 0x882E #define GL_DRAW_BUFFER10 0x882F #define GL_DRAW_BUFFER11 0x8830 #define GL_DRAW_BUFFER12 0x8831 #define GL_DRAW_BUFFER13 0x8832 #define GL_DRAW_BUFFER14 0x8833 #define GL_DRAW_BUFFER15 0x8834 #define GL_BLEND_EQUATION_ALPHA 0x883D #define GL_MAX_VERTEX_ATTRIBS 0x8869 #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A #define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 #define GL_FRAGMENT_SHADER 0x8B30 #define GL_VERTEX_SHADER 0x8B31 #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 #define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A #define GL_MAX_VARYING_FLOATS 0x8B4B #define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C #define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D #define GL_SHADER_TYPE 0x8B4F #define GL_FLOAT_VEC2 0x8B50 #define GL_FLOAT_VEC3 0x8B51 #define GL_FLOAT_VEC4 0x8B52 #define GL_INT_VEC2 0x8B53 #define GL_INT_VEC3 0x8B54 #define GL_INT_VEC4 0x8B55 #define GL_BOOL 0x8B56 #define GL_BOOL_VEC2 0x8B57 #define GL_BOOL_VEC3 0x8B58 #define GL_BOOL_VEC4 0x8B59 #define GL_FLOAT_MAT2 0x8B5A #define GL_FLOAT_MAT3 0x8B5B #define GL_FLOAT_MAT4 0x8B5C #define GL_SAMPLER_1D 0x8B5D #define GL_SAMPLER_2D 0x8B5E #define GL_SAMPLER_3D 0x8B5F #define GL_SAMPLER_CUBE 0x8B60 #define GL_SAMPLER_1D_SHADOW 0x8B61 #define GL_SAMPLER_2D_SHADOW 0x8B62 #define GL_DELETE_STATUS 0x8B80 #define GL_COMPILE_STATUS 0x8B81 #define GL_LINK_STATUS 0x8B82 #define GL_VALIDATE_STATUS 0x8B83 #define GL_INFO_LOG_LENGTH 0x8B84 #define GL_ATTACHED_SHADERS 0x8B85 #define GL_ACTIVE_UNIFORMS 0x8B86 #define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 #define GL_SHADER_SOURCE_LENGTH 0x8B88 #define GL_ACTIVE_ATTRIBUTES 0x8B89 #define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A #define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B #define GL_SHADING_LANGUAGE_VERSION 0x8B8C #define GL_CURRENT_PROGRAM 0x8B8D #define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 #define GL_LOWER_LEFT 0x8CA1 #define GL_UPPER_LEFT 0x8CA2 #define GL_STENCIL_BACK_REF 0x8CA3 #define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 #define GL_STENCIL_BACK_WRITEMASK 0x8CA5 #endif #ifndef GL_VERSION_2_0_DEPRECATED #define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 #define GL_POINT_SPRITE 0x8861 #define GL_COORD_REPLACE 0x8862 #define GL_MAX_TEXTURE_COORDS 0x8871 #endif #ifndef GL_VERSION_2_1 #define GL_PIXEL_PACK_BUFFER 0x88EB #define GL_PIXEL_UNPACK_BUFFER 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED #define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF #define GL_FLOAT_MAT2x3 0x8B65 #define GL_FLOAT_MAT2x4 0x8B66 #define GL_FLOAT_MAT3x2 0x8B67 #define GL_FLOAT_MAT3x4 0x8B68 #define GL_FLOAT_MAT4x2 0x8B69 #define GL_FLOAT_MAT4x3 0x8B6A #define GL_SRGB 0x8C40 #define GL_SRGB8 0x8C41 #define GL_SRGB_ALPHA 0x8C42 #define GL_SRGB8_ALPHA8 0x8C43 #define GL_COMPRESSED_SRGB 0x8C48 #define GL_COMPRESSED_SRGB_ALPHA 0x8C49 #endif #ifndef GL_VERSION_2_1_DEPRECATED #define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F #define GL_SLUMINANCE_ALPHA 0x8C44 #define GL_SLUMINANCE8_ALPHA8 0x8C45 #define GL_SLUMINANCE 0x8C46 #define GL_SLUMINANCE8 0x8C47 #define GL_COMPRESSED_SLUMINANCE 0x8C4A #define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B #endif #ifndef GL_VERSION_3_0 #define GL_COMPARE_REF_TO_TEXTURE 0x884E #define GL_CLIP_DISTANCE0 0x3000 #define GL_CLIP_DISTANCE1 0x3001 #define GL_CLIP_DISTANCE2 0x3002 #define GL_CLIP_DISTANCE3 0x3003 #define GL_CLIP_DISTANCE4 0x3004 #define GL_CLIP_DISTANCE5 0x3005 #define GL_CLIP_DISTANCE6 0x3006 #define GL_CLIP_DISTANCE7 0x3007 #define GL_MAX_CLIP_DISTANCES 0x0D32 #define GL_MAJOR_VERSION 0x821B #define GL_MINOR_VERSION 0x821C #define GL_NUM_EXTENSIONS 0x821D #define GL_CONTEXT_FLAGS 0x821E #define GL_DEPTH_BUFFER 0x8223 #define GL_STENCIL_BUFFER 0x8224 #define GL_COMPRESSED_RED 0x8225 #define GL_COMPRESSED_RG 0x8226 #define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 #define GL_RGBA32F 0x8814 #define GL_RGB32F 0x8815 #define GL_RGBA16F 0x881A #define GL_RGB16F 0x881B #define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD #define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF #define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 #define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 #define GL_CLAMP_READ_COLOR 0x891C #define GL_FIXED_ONLY 0x891D #define GL_MAX_VARYING_COMPONENTS 0x8B4B #define GL_TEXTURE_1D_ARRAY 0x8C18 #define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 #define GL_TEXTURE_2D_ARRAY 0x8C1A #define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B #define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C #define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D #define GL_R11F_G11F_B10F 0x8C3A #define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B #define GL_RGB9_E5 0x8C3D #define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E #define GL_TEXTURE_SHARED_SIZE 0x8C3F #define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 #define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 #define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 #define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 #define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 #define GL_PRIMITIVES_GENERATED 0x8C87 #define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 #define GL_RASTERIZER_DISCARD 0x8C89 #define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B #define GL_INTERLEAVED_ATTRIBS 0x8C8C #define GL_SEPARATE_ATTRIBS 0x8C8D #define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E #define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F #define GL_RGBA32UI 0x8D70 #define GL_RGB32UI 0x8D71 #define GL_RGBA16UI 0x8D76 #define GL_RGB16UI 0x8D77 #define GL_RGBA8UI 0x8D7C #define GL_RGB8UI 0x8D7D #define GL_RGBA32I 0x8D82 #define GL_RGB32I 0x8D83 #define GL_RGBA16I 0x8D88 #define GL_RGB16I 0x8D89 #define GL_RGBA8I 0x8D8E #define GL_RGB8I 0x8D8F #define GL_RED_INTEGER 0x8D94 #define GL_GREEN_INTEGER 0x8D95 #define GL_BLUE_INTEGER 0x8D96 #define GL_RGB_INTEGER 0x8D98 #define GL_RGBA_INTEGER 0x8D99 #define GL_BGR_INTEGER 0x8D9A #define GL_BGRA_INTEGER 0x8D9B #define GL_SAMPLER_1D_ARRAY 0x8DC0 #define GL_SAMPLER_2D_ARRAY 0x8DC1 #define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 #define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 #define GL_SAMPLER_CUBE_SHADOW 0x8DC5 #define GL_UNSIGNED_INT_VEC2 0x8DC6 #define GL_UNSIGNED_INT_VEC3 0x8DC7 #define GL_UNSIGNED_INT_VEC4 0x8DC8 #define GL_INT_SAMPLER_1D 0x8DC9 #define GL_INT_SAMPLER_2D 0x8DCA #define GL_INT_SAMPLER_3D 0x8DCB #define GL_INT_SAMPLER_CUBE 0x8DCC #define GL_INT_SAMPLER_1D_ARRAY 0x8DCE #define GL_INT_SAMPLER_2D_ARRAY 0x8DCF #define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 #define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 #define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 #define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 #define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 #define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 #define GL_QUERY_WAIT 0x8E13 #define GL_QUERY_NO_WAIT 0x8E14 #define GL_QUERY_BY_REGION_WAIT 0x8E15 #define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 #define GL_BUFFER_ACCESS_FLAGS 0x911F #define GL_BUFFER_MAP_LENGTH 0x9120 #define GL_BUFFER_MAP_OFFSET 0x9121 #endif #ifndef GL_VERSION_3_0_DEPRECATED #define GL_CLAMP_VERTEX_COLOR 0x891A #define GL_CLAMP_FRAGMENT_COLOR 0x891B #define GL_ALPHA_INTEGER 0x8D97 #endif #ifndef GL_VERSION_3_1 #define GL_SAMPLER_2D_RECT 0x8B63 #define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 #define GL_SAMPLER_BUFFER 0x8DC2 #define GL_INT_SAMPLER_2D_RECT 0x8DCD #define GL_INT_SAMPLER_BUFFER 0x8DD0 #define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 #define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 #define GL_TEXTURE_BUFFER 0x8C2A #define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B #define GL_TEXTURE_BINDING_BUFFER 0x8C2C #define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D #define GL_TEXTURE_BUFFER_FORMAT 0x8C2E #define GL_TEXTURE_RECTANGLE 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 #define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 #define GL_RED_SNORM 0x8F90 #define GL_RG_SNORM 0x8F91 #define GL_RGB_SNORM 0x8F92 #define GL_RGBA_SNORM 0x8F93 #define GL_R8_SNORM 0x8F94 #define GL_RG8_SNORM 0x8F95 #define GL_RGB8_SNORM 0x8F96 #define GL_RGBA8_SNORM 0x8F97 #define GL_R16_SNORM 0x8F98 #define GL_RG16_SNORM 0x8F99 #define GL_RGB16_SNORM 0x8F9A #define GL_RGBA16_SNORM 0x8F9B #define GL_SIGNED_NORMALIZED 0x8F9C #define GL_PRIMITIVE_RESTART 0x8F9D #define GL_PRIMITIVE_RESTART_INDEX 0x8F9E #endif #ifndef GL_VERSION_3_2 #define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 #define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 #define GL_LINES_ADJACENCY 0x000A #define GL_LINE_STRIP_ADJACENCY 0x000B #define GL_TRIANGLES_ADJACENCY 0x000C #define GL_TRIANGLE_STRIP_ADJACENCY 0x000D #define GL_PROGRAM_POINT_SIZE 0x8642 #define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 #define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 #define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 #define GL_GEOMETRY_SHADER 0x8DD9 #define GL_GEOMETRY_VERTICES_OUT 0x8916 #define GL_GEOMETRY_INPUT_TYPE 0x8917 #define GL_GEOMETRY_OUTPUT_TYPE 0x8918 #define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF #define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 #define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 #define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 #define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 #define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 #define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 #define GL_CONTEXT_PROFILE_MASK 0x9126 /* Reuse tokens from ARB_sync */ #endif #ifndef GL_ARB_multitexture #define GL_TEXTURE0_ARB 0x84C0 #define GL_TEXTURE1_ARB 0x84C1 #define GL_TEXTURE2_ARB 0x84C2 #define GL_TEXTURE3_ARB 0x84C3 #define GL_TEXTURE4_ARB 0x84C4 #define GL_TEXTURE5_ARB 0x84C5 #define GL_TEXTURE6_ARB 0x84C6 #define GL_TEXTURE7_ARB 0x84C7 #define GL_TEXTURE8_ARB 0x84C8 #define GL_TEXTURE9_ARB 0x84C9 #define GL_TEXTURE10_ARB 0x84CA #define GL_TEXTURE11_ARB 0x84CB #define GL_TEXTURE12_ARB 0x84CC #define GL_TEXTURE13_ARB 0x84CD #define GL_TEXTURE14_ARB 0x84CE #define GL_TEXTURE15_ARB 0x84CF #define GL_TEXTURE16_ARB 0x84D0 #define GL_TEXTURE17_ARB 0x84D1 #define GL_TEXTURE18_ARB 0x84D2 #define GL_TEXTURE19_ARB 0x84D3 #define GL_TEXTURE20_ARB 0x84D4 #define GL_TEXTURE21_ARB 0x84D5 #define GL_TEXTURE22_ARB 0x84D6 #define GL_TEXTURE23_ARB 0x84D7 #define GL_TEXTURE24_ARB 0x84D8 #define GL_TEXTURE25_ARB 0x84D9 #define GL_TEXTURE26_ARB 0x84DA #define GL_TEXTURE27_ARB 0x84DB #define GL_TEXTURE28_ARB 0x84DC #define GL_TEXTURE29_ARB 0x84DD #define GL_TEXTURE30_ARB 0x84DE #define GL_TEXTURE31_ARB 0x84DF #define GL_ACTIVE_TEXTURE_ARB 0x84E0 #define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 #define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 #endif #ifndef GL_ARB_transpose_matrix #define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 #define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 #define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 #define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 #endif #ifndef GL_ARB_multisample #define GL_MULTISAMPLE_ARB 0x809D #define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E #define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F #define GL_SAMPLE_COVERAGE_ARB 0x80A0 #define GL_SAMPLE_BUFFERS_ARB 0x80A8 #define GL_SAMPLES_ARB 0x80A9 #define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA #define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB #define GL_MULTISAMPLE_BIT_ARB 0x20000000 #endif #ifndef GL_ARB_texture_env_add #endif #ifndef GL_ARB_texture_cube_map #define GL_NORMAL_MAP_ARB 0x8511 #define GL_REFLECTION_MAP_ARB 0x8512 #define GL_TEXTURE_CUBE_MAP_ARB 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A #define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B #define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C #endif #ifndef GL_ARB_texture_compression #define GL_COMPRESSED_ALPHA_ARB 0x84E9 #define GL_COMPRESSED_LUMINANCE_ARB 0x84EA #define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB #define GL_COMPRESSED_INTENSITY_ARB 0x84EC #define GL_COMPRESSED_RGB_ARB 0x84ED #define GL_COMPRESSED_RGBA_ARB 0x84EE #define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF #define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 #define GL_TEXTURE_COMPRESSED_ARB 0x86A1 #define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 #endif #ifndef GL_ARB_texture_border_clamp #define GL_CLAMP_TO_BORDER_ARB 0x812D #endif #ifndef GL_ARB_point_parameters #define GL_POINT_SIZE_MIN_ARB 0x8126 #define GL_POINT_SIZE_MAX_ARB 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 #define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 #endif #ifndef GL_ARB_vertex_blend #define GL_MAX_VERTEX_UNITS_ARB 0x86A4 #define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 #define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 #define GL_VERTEX_BLEND_ARB 0x86A7 #define GL_CURRENT_WEIGHT_ARB 0x86A8 #define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 #define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA #define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB #define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC #define GL_WEIGHT_ARRAY_ARB 0x86AD #define GL_MODELVIEW0_ARB 0x1700 #define GL_MODELVIEW1_ARB 0x850A #define GL_MODELVIEW2_ARB 0x8722 #define GL_MODELVIEW3_ARB 0x8723 #define GL_MODELVIEW4_ARB 0x8724 #define GL_MODELVIEW5_ARB 0x8725 #define GL_MODELVIEW6_ARB 0x8726 #define GL_MODELVIEW7_ARB 0x8727 #define GL_MODELVIEW8_ARB 0x8728 #define GL_MODELVIEW9_ARB 0x8729 #define GL_MODELVIEW10_ARB 0x872A #define GL_MODELVIEW11_ARB 0x872B #define GL_MODELVIEW12_ARB 0x872C #define GL_MODELVIEW13_ARB 0x872D #define GL_MODELVIEW14_ARB 0x872E #define GL_MODELVIEW15_ARB 0x872F #define GL_MODELVIEW16_ARB 0x8730 #define GL_MODELVIEW17_ARB 0x8731 #define GL_MODELVIEW18_ARB 0x8732 #define GL_MODELVIEW19_ARB 0x8733 #define GL_MODELVIEW20_ARB 0x8734 #define GL_MODELVIEW21_ARB 0x8735 #define GL_MODELVIEW22_ARB 0x8736 #define GL_MODELVIEW23_ARB 0x8737 #define GL_MODELVIEW24_ARB 0x8738 #define GL_MODELVIEW25_ARB 0x8739 #define GL_MODELVIEW26_ARB 0x873A #define GL_MODELVIEW27_ARB 0x873B #define GL_MODELVIEW28_ARB 0x873C #define GL_MODELVIEW29_ARB 0x873D #define GL_MODELVIEW30_ARB 0x873E #define GL_MODELVIEW31_ARB 0x873F #endif #ifndef GL_ARB_matrix_palette #define GL_MATRIX_PALETTE_ARB 0x8840 #define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 #define GL_MAX_PALETTE_MATRICES_ARB 0x8842 #define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 #define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 #define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 #define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 #define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 #define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 #define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 #endif #ifndef GL_ARB_texture_env_combine #define GL_COMBINE_ARB 0x8570 #define GL_COMBINE_RGB_ARB 0x8571 #define GL_COMBINE_ALPHA_ARB 0x8572 #define GL_SOURCE0_RGB_ARB 0x8580 #define GL_SOURCE1_RGB_ARB 0x8581 #define GL_SOURCE2_RGB_ARB 0x8582 #define GL_SOURCE0_ALPHA_ARB 0x8588 #define GL_SOURCE1_ALPHA_ARB 0x8589 #define GL_SOURCE2_ALPHA_ARB 0x858A #define GL_OPERAND0_RGB_ARB 0x8590 #define GL_OPERAND1_RGB_ARB 0x8591 #define GL_OPERAND2_RGB_ARB 0x8592 #define GL_OPERAND0_ALPHA_ARB 0x8598 #define GL_OPERAND1_ALPHA_ARB 0x8599 #define GL_OPERAND2_ALPHA_ARB 0x859A #define GL_RGB_SCALE_ARB 0x8573 #define GL_ADD_SIGNED_ARB 0x8574 #define GL_INTERPOLATE_ARB 0x8575 #define GL_SUBTRACT_ARB 0x84E7 #define GL_CONSTANT_ARB 0x8576 #define GL_PRIMARY_COLOR_ARB 0x8577 #define GL_PREVIOUS_ARB 0x8578 #endif #ifndef GL_ARB_texture_env_crossbar #endif #ifndef GL_ARB_texture_env_dot3 #define GL_DOT3_RGB_ARB 0x86AE #define GL_DOT3_RGBA_ARB 0x86AF #endif #ifndef GL_ARB_texture_mirrored_repeat #define GL_MIRRORED_REPEAT_ARB 0x8370 #endif #ifndef GL_ARB_depth_texture #define GL_DEPTH_COMPONENT16_ARB 0x81A5 #define GL_DEPTH_COMPONENT24_ARB 0x81A6 #define GL_DEPTH_COMPONENT32_ARB 0x81A7 #define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A #define GL_DEPTH_TEXTURE_MODE_ARB 0x884B #endif #ifndef GL_ARB_shadow #define GL_TEXTURE_COMPARE_MODE_ARB 0x884C #define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D #define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E #endif #ifndef GL_ARB_shadow_ambient #define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF #endif #ifndef GL_ARB_window_pos #endif #ifndef GL_ARB_vertex_program #define GL_COLOR_SUM_ARB 0x8458 #define GL_VERTEX_PROGRAM_ARB 0x8620 #define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 #define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 #define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 #define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 #define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 #define GL_PROGRAM_LENGTH_ARB 0x8627 #define GL_PROGRAM_STRING_ARB 0x8628 #define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E #define GL_MAX_PROGRAM_MATRICES_ARB 0x862F #define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 #define GL_CURRENT_MATRIX_ARB 0x8641 #define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 #define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 #define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 #define GL_PROGRAM_ERROR_POSITION_ARB 0x864B #define GL_PROGRAM_BINDING_ARB 0x8677 #define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A #define GL_PROGRAM_ERROR_STRING_ARB 0x8874 #define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 #define GL_PROGRAM_FORMAT_ARB 0x8876 #define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 #define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 #define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 #define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 #define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 #define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 #define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 #define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 #define GL_PROGRAM_PARAMETERS_ARB 0x88A8 #define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 #define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA #define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB #define GL_PROGRAM_ATTRIBS_ARB 0x88AC #define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD #define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE #define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF #define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 #define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 #define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 #define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 #define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 #define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 #define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 #define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 #define GL_MATRIX0_ARB 0x88C0 #define GL_MATRIX1_ARB 0x88C1 #define GL_MATRIX2_ARB 0x88C2 #define GL_MATRIX3_ARB 0x88C3 #define GL_MATRIX4_ARB 0x88C4 #define GL_MATRIX5_ARB 0x88C5 #define GL_MATRIX6_ARB 0x88C6 #define GL_MATRIX7_ARB 0x88C7 #define GL_MATRIX8_ARB 0x88C8 #define GL_MATRIX9_ARB 0x88C9 #define GL_MATRIX10_ARB 0x88CA #define GL_MATRIX11_ARB 0x88CB #define GL_MATRIX12_ARB 0x88CC #define GL_MATRIX13_ARB 0x88CD #define GL_MATRIX14_ARB 0x88CE #define GL_MATRIX15_ARB 0x88CF #define GL_MATRIX16_ARB 0x88D0 #define GL_MATRIX17_ARB 0x88D1 #define GL_MATRIX18_ARB 0x88D2 #define GL_MATRIX19_ARB 0x88D3 #define GL_MATRIX20_ARB 0x88D4 #define GL_MATRIX21_ARB 0x88D5 #define GL_MATRIX22_ARB 0x88D6 #define GL_MATRIX23_ARB 0x88D7 #define GL_MATRIX24_ARB 0x88D8 #define GL_MATRIX25_ARB 0x88D9 #define GL_MATRIX26_ARB 0x88DA #define GL_MATRIX27_ARB 0x88DB #define GL_MATRIX28_ARB 0x88DC #define GL_MATRIX29_ARB 0x88DD #define GL_MATRIX30_ARB 0x88DE #define GL_MATRIX31_ARB 0x88DF #endif #ifndef GL_ARB_fragment_program #define GL_FRAGMENT_PROGRAM_ARB 0x8804 #define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 #define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 #define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 #define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 #define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 #define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A #define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B #define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C #define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D #define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E #define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F #define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 #define GL_MAX_TEXTURE_COORDS_ARB 0x8871 #define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 #endif #ifndef GL_ARB_vertex_buffer_object #define GL_BUFFER_SIZE_ARB 0x8764 #define GL_BUFFER_USAGE_ARB 0x8765 #define GL_ARRAY_BUFFER_ARB 0x8892 #define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 #define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 #define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 #define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 #define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 #define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 #define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 #define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A #define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B #define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C #define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D #define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F #define GL_READ_ONLY_ARB 0x88B8 #define GL_WRITE_ONLY_ARB 0x88B9 #define GL_READ_WRITE_ARB 0x88BA #define GL_BUFFER_ACCESS_ARB 0x88BB #define GL_BUFFER_MAPPED_ARB 0x88BC #define GL_BUFFER_MAP_POINTER_ARB 0x88BD #define GL_STREAM_DRAW_ARB 0x88E0 #define GL_STREAM_READ_ARB 0x88E1 #define GL_STREAM_COPY_ARB 0x88E2 #define GL_STATIC_DRAW_ARB 0x88E4 #define GL_STATIC_READ_ARB 0x88E5 #define GL_STATIC_COPY_ARB 0x88E6 #define GL_DYNAMIC_DRAW_ARB 0x88E8 #define GL_DYNAMIC_READ_ARB 0x88E9 #define GL_DYNAMIC_COPY_ARB 0x88EA #endif #ifndef GL_ARB_occlusion_query #define GL_QUERY_COUNTER_BITS_ARB 0x8864 #define GL_CURRENT_QUERY_ARB 0x8865 #define GL_QUERY_RESULT_ARB 0x8866 #define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 #define GL_SAMPLES_PASSED_ARB 0x8914 #endif #ifndef GL_ARB_shader_objects #define GL_PROGRAM_OBJECT_ARB 0x8B40 #define GL_SHADER_OBJECT_ARB 0x8B48 #define GL_OBJECT_TYPE_ARB 0x8B4E #define GL_OBJECT_SUBTYPE_ARB 0x8B4F #define GL_FLOAT_VEC2_ARB 0x8B50 #define GL_FLOAT_VEC3_ARB 0x8B51 #define GL_FLOAT_VEC4_ARB 0x8B52 #define GL_INT_VEC2_ARB 0x8B53 #define GL_INT_VEC3_ARB 0x8B54 #define GL_INT_VEC4_ARB 0x8B55 #define GL_BOOL_ARB 0x8B56 #define GL_BOOL_VEC2_ARB 0x8B57 #define GL_BOOL_VEC3_ARB 0x8B58 #define GL_BOOL_VEC4_ARB 0x8B59 #define GL_FLOAT_MAT2_ARB 0x8B5A #define GL_FLOAT_MAT3_ARB 0x8B5B #define GL_FLOAT_MAT4_ARB 0x8B5C #define GL_SAMPLER_1D_ARB 0x8B5D #define GL_SAMPLER_2D_ARB 0x8B5E #define GL_SAMPLER_3D_ARB 0x8B5F #define GL_SAMPLER_CUBE_ARB 0x8B60 #define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 #define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 #define GL_SAMPLER_2D_RECT_ARB 0x8B63 #define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 #define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 #define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 #define GL_OBJECT_LINK_STATUS_ARB 0x8B82 #define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 #define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 #define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 #define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 #define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 #define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 #endif #ifndef GL_ARB_vertex_shader #define GL_VERTEX_SHADER_ARB 0x8B31 #define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A #define GL_MAX_VARYING_FLOATS_ARB 0x8B4B #define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C #define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D #define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 #define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A #endif #ifndef GL_ARB_fragment_shader #define GL_FRAGMENT_SHADER_ARB 0x8B30 #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 #define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B #endif #ifndef GL_ARB_shading_language_100 #define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C #endif #ifndef GL_ARB_texture_non_power_of_two #endif #ifndef GL_ARB_point_sprite #define GL_POINT_SPRITE_ARB 0x8861 #define GL_COORD_REPLACE_ARB 0x8862 #endif #ifndef GL_ARB_fragment_program_shadow #endif #ifndef GL_ARB_draw_buffers #define GL_MAX_DRAW_BUFFERS_ARB 0x8824 #define GL_DRAW_BUFFER0_ARB 0x8825 #define GL_DRAW_BUFFER1_ARB 0x8826 #define GL_DRAW_BUFFER2_ARB 0x8827 #define GL_DRAW_BUFFER3_ARB 0x8828 #define GL_DRAW_BUFFER4_ARB 0x8829 #define GL_DRAW_BUFFER5_ARB 0x882A #define GL_DRAW_BUFFER6_ARB 0x882B #define GL_DRAW_BUFFER7_ARB 0x882C #define GL_DRAW_BUFFER8_ARB 0x882D #define GL_DRAW_BUFFER9_ARB 0x882E #define GL_DRAW_BUFFER10_ARB 0x882F #define GL_DRAW_BUFFER11_ARB 0x8830 #define GL_DRAW_BUFFER12_ARB 0x8831 #define GL_DRAW_BUFFER13_ARB 0x8832 #define GL_DRAW_BUFFER14_ARB 0x8833 #define GL_DRAW_BUFFER15_ARB 0x8834 #endif #ifndef GL_ARB_texture_rectangle #define GL_TEXTURE_RECTANGLE_ARB 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 #define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 #endif #ifndef GL_ARB_color_buffer_float #define GL_RGBA_FLOAT_MODE_ARB 0x8820 #define GL_CLAMP_VERTEX_COLOR_ARB 0x891A #define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B #define GL_CLAMP_READ_COLOR_ARB 0x891C #define GL_FIXED_ONLY_ARB 0x891D #endif #ifndef GL_ARB_half_float_pixel #define GL_HALF_FLOAT_ARB 0x140B #endif #ifndef GL_ARB_texture_float #define GL_TEXTURE_RED_TYPE_ARB 0x8C10 #define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 #define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 #define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 #define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 #define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 #define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 #define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 #define GL_RGBA32F_ARB 0x8814 #define GL_RGB32F_ARB 0x8815 #define GL_ALPHA32F_ARB 0x8816 #define GL_INTENSITY32F_ARB 0x8817 #define GL_LUMINANCE32F_ARB 0x8818 #define GL_LUMINANCE_ALPHA32F_ARB 0x8819 #define GL_RGBA16F_ARB 0x881A #define GL_RGB16F_ARB 0x881B #define GL_ALPHA16F_ARB 0x881C #define GL_INTENSITY16F_ARB 0x881D #define GL_LUMINANCE16F_ARB 0x881E #define GL_LUMINANCE_ALPHA16F_ARB 0x881F #endif #ifndef GL_ARB_pixel_buffer_object #define GL_PIXEL_PACK_BUFFER_ARB 0x88EB #define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED #define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF #endif #ifndef GL_ARB_depth_buffer_float #define GL_DEPTH_COMPONENT32F 0x8CAC #define GL_DEPTH32F_STENCIL8 0x8CAD #define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD #endif #ifndef GL_ARB_draw_instanced #endif #ifndef GL_ARB_framebuffer_object #define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 #define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 #define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 #define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 #define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 #define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 #define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 #define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 #define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 #define GL_FRAMEBUFFER_DEFAULT 0x8218 #define GL_FRAMEBUFFER_UNDEFINED 0x8219 #define GL_DEPTH_STENCIL_ATTACHMENT 0x821A #define GL_MAX_RENDERBUFFER_SIZE 0x84E8 #define GL_DEPTH_STENCIL 0x84F9 #define GL_UNSIGNED_INT_24_8 0x84FA #define GL_DEPTH24_STENCIL8 0x88F0 #define GL_TEXTURE_STENCIL_SIZE 0x88F1 #define GL_TEXTURE_RED_TYPE 0x8C10 #define GL_TEXTURE_GREEN_TYPE 0x8C11 #define GL_TEXTURE_BLUE_TYPE 0x8C12 #define GL_TEXTURE_ALPHA_TYPE 0x8C13 #define GL_TEXTURE_DEPTH_TYPE 0x8C16 #define GL_UNSIGNED_NORMALIZED 0x8C17 #define GL_FRAMEBUFFER_BINDING 0x8CA6 #define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING #define GL_RENDERBUFFER_BINDING 0x8CA7 #define GL_READ_FRAMEBUFFER 0x8CA8 #define GL_DRAW_FRAMEBUFFER 0x8CA9 #define GL_READ_FRAMEBUFFER_BINDING 0x8CAA #define GL_RENDERBUFFER_SAMPLES 0x8CAB #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 #define GL_FRAMEBUFFER_COMPLETE 0x8CD5 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC #define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD #define GL_MAX_COLOR_ATTACHMENTS 0x8CDF #define GL_COLOR_ATTACHMENT0 0x8CE0 #define GL_COLOR_ATTACHMENT1 0x8CE1 #define GL_COLOR_ATTACHMENT2 0x8CE2 #define GL_COLOR_ATTACHMENT3 0x8CE3 #define GL_COLOR_ATTACHMENT4 0x8CE4 #define GL_COLOR_ATTACHMENT5 0x8CE5 #define GL_COLOR_ATTACHMENT6 0x8CE6 #define GL_COLOR_ATTACHMENT7 0x8CE7 #define GL_COLOR_ATTACHMENT8 0x8CE8 #define GL_COLOR_ATTACHMENT9 0x8CE9 #define GL_COLOR_ATTACHMENT10 0x8CEA #define GL_COLOR_ATTACHMENT11 0x8CEB #define GL_COLOR_ATTACHMENT12 0x8CEC #define GL_COLOR_ATTACHMENT13 0x8CED #define GL_COLOR_ATTACHMENT14 0x8CEE #define GL_COLOR_ATTACHMENT15 0x8CEF #define GL_DEPTH_ATTACHMENT 0x8D00 #define GL_STENCIL_ATTACHMENT 0x8D20 #define GL_FRAMEBUFFER 0x8D40 #define GL_RENDERBUFFER 0x8D41 #define GL_RENDERBUFFER_WIDTH 0x8D42 #define GL_RENDERBUFFER_HEIGHT 0x8D43 #define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 #define GL_STENCIL_INDEX1 0x8D46 #define GL_STENCIL_INDEX4 0x8D47 #define GL_STENCIL_INDEX8 0x8D48 #define GL_STENCIL_INDEX16 0x8D49 #define GL_RENDERBUFFER_RED_SIZE 0x8D50 #define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 #define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 #define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 #define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 #define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 #define GL_MAX_SAMPLES 0x8D57 #endif #ifndef GL_ARB_framebuffer_object_DEPRECATED #define GL_INDEX 0x8222 #define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 #define GL_TEXTURE_INTENSITY_TYPE 0x8C15 #endif #ifndef GL_ARB_framebuffer_sRGB #define GL_FRAMEBUFFER_SRGB 0x8DB9 #endif #ifndef GL_ARB_geometry_shader4 #define GL_LINES_ADJACENCY_ARB 0x000A #define GL_LINE_STRIP_ADJACENCY_ARB 0x000B #define GL_TRIANGLES_ADJACENCY_ARB 0x000C #define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D #define GL_PROGRAM_POINT_SIZE_ARB 0x8642 #define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29 #define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7 #define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8 #define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9 #define GL_GEOMETRY_SHADER_ARB 0x8DD9 #define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA #define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB #define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC #define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD #define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE #define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF #define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0 #define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1 #endif #ifndef GL_ARB_half_float_vertex #define GL_HALF_FLOAT 0x140B #endif #ifndef GL_ARB_instanced_arrays #define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE #endif #ifndef GL_ARB_map_buffer_range #define GL_MAP_READ_BIT 0x0001 #define GL_MAP_WRITE_BIT 0x0002 #define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 #define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 #define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 #define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 #endif #ifndef GL_ARB_texture_buffer_object #define GL_TEXTURE_BUFFER_ARB 0x8C2A #define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B #define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C #define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D #define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E #endif #ifndef GL_ARB_texture_compression_rgtc #define GL_COMPRESSED_RED_RGTC1 0x8DBB #define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC #define GL_COMPRESSED_RG_RGTC2 0x8DBD #define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE #endif #ifndef GL_ARB_texture_rg #define GL_RG 0x8227 #define GL_RG_INTEGER 0x8228 #define GL_R8 0x8229 #define GL_R16 0x822A #define GL_RG8 0x822B #define GL_RG16 0x822C #define GL_R16F 0x822D #define GL_R32F 0x822E #define GL_RG16F 0x822F #define GL_RG32F 0x8230 #define GL_R8I 0x8231 #define GL_R8UI 0x8232 #define GL_R16I 0x8233 #define GL_R16UI 0x8234 #define GL_R32I 0x8235 #define GL_R32UI 0x8236 #define GL_RG8I 0x8237 #define GL_RG8UI 0x8238 #define GL_RG16I 0x8239 #define GL_RG16UI 0x823A #define GL_RG32I 0x823B #define GL_RG32UI 0x823C #endif #ifndef GL_ARB_vertex_array_object #define GL_VERTEX_ARRAY_BINDING 0x85B5 #endif #ifndef GL_ARB_uniform_buffer_object #define GL_UNIFORM_BUFFER 0x8A11 #define GL_UNIFORM_BUFFER_BINDING 0x8A28 #define GL_UNIFORM_BUFFER_START 0x8A29 #define GL_UNIFORM_BUFFER_SIZE 0x8A2A #define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B #define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C #define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D #define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E #define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F #define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 #define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 #define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 #define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 #define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 #define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 #define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 #define GL_UNIFORM_TYPE 0x8A37 #define GL_UNIFORM_SIZE 0x8A38 #define GL_UNIFORM_NAME_LENGTH 0x8A39 #define GL_UNIFORM_BLOCK_INDEX 0x8A3A #define GL_UNIFORM_OFFSET 0x8A3B #define GL_UNIFORM_ARRAY_STRIDE 0x8A3C #define GL_UNIFORM_MATRIX_STRIDE 0x8A3D #define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E #define GL_UNIFORM_BLOCK_BINDING 0x8A3F #define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 #define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 #define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 #define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 #define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 #endif #ifndef GL_ARB_compatibility #endif #ifndef GL_ARB_copy_buffer #define GL_COPY_READ_BUFFER 0x8F36 #define GL_COPY_WRITE_BUFFER 0x8F37 #endif #ifndef GL_ARB_shader_texture_lod #endif #ifndef GL_ARB_depth_clamp #define GL_DEPTH_CLAMP 0x864F #endif #ifndef GL_ARB_draw_elements_base_vertex #endif #ifndef GL_ARB_fragment_coord_conventions #endif #ifndef GL_ARB_provoking_vertex #define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C #define GL_FIRST_VERTEX_CONVENTION 0x8E4D #define GL_LAST_VERTEX_CONVENTION 0x8E4E #define GL_PROVOKING_VERTEX 0x8E4F #endif #ifndef GL_ARB_seamless_cube_map #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F #endif #ifndef GL_ARB_sync #define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 #define GL_OBJECT_TYPE 0x9112 #define GL_SYNC_CONDITION 0x9113 #define GL_SYNC_STATUS 0x9114 #define GL_SYNC_FLAGS 0x9115 #define GL_SYNC_FENCE 0x9116 #define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 #define GL_UNSIGNALED 0x9118 #define GL_SIGNALED 0x9119 #define GL_ALREADY_SIGNALED 0x911A #define GL_TIMEOUT_EXPIRED 0x911B #define GL_CONDITION_SATISFIED 0x911C #define GL_WAIT_FAILED 0x911D #define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 #endif #ifndef GL_ARB_texture_multisample #define GL_SAMPLE_POSITION 0x8E50 #define GL_SAMPLE_MASK 0x8E51 #define GL_SAMPLE_MASK_VALUE 0x8E52 #define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 #define GL_TEXTURE_2D_MULTISAMPLE 0x9100 #define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 #define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 #define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 #define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 #define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 #define GL_TEXTURE_SAMPLES 0x9106 #define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 #define GL_SAMPLER_2D_MULTISAMPLE 0x9108 #define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 #define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A #define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B #define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C #define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D #define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E #define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F #define GL_MAX_INTEGER_SAMPLES 0x9110 #endif #ifndef GL_ARB_vertex_array_bgra #endif #ifndef GL_ARB_draw_buffers_blend #endif #ifndef GL_ARB_sample_shading #define GL_SAMPLE_SHADING 0x8C36 #define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 #endif #ifndef GL_ARB_texture_cube_map_array #define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 #define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A #define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B #define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C #define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D #define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E #define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F #endif #ifndef GL_ARB_texture_gather #define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E #define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F #define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS 0x8F9F #endif #ifndef GL_ARB_texture_query_lod #endif #ifndef GL_EXT_abgr #define GL_ABGR_EXT 0x8000 #endif #ifndef GL_EXT_blend_color #define GL_CONSTANT_COLOR_EXT 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 #define GL_CONSTANT_ALPHA_EXT 0x8003 #define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 #define GL_BLEND_COLOR_EXT 0x8005 #endif #ifndef GL_EXT_polygon_offset #define GL_POLYGON_OFFSET_EXT 0x8037 #define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 #define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 #endif #ifndef GL_EXT_texture #define GL_ALPHA4_EXT 0x803B #define GL_ALPHA8_EXT 0x803C #define GL_ALPHA12_EXT 0x803D #define GL_ALPHA16_EXT 0x803E #define GL_LUMINANCE4_EXT 0x803F #define GL_LUMINANCE8_EXT 0x8040 #define GL_LUMINANCE12_EXT 0x8041 #define GL_LUMINANCE16_EXT 0x8042 #define GL_LUMINANCE4_ALPHA4_EXT 0x8043 #define GL_LUMINANCE6_ALPHA2_EXT 0x8044 #define GL_LUMINANCE8_ALPHA8_EXT 0x8045 #define GL_LUMINANCE12_ALPHA4_EXT 0x8046 #define GL_LUMINANCE12_ALPHA12_EXT 0x8047 #define GL_LUMINANCE16_ALPHA16_EXT 0x8048 #define GL_INTENSITY_EXT 0x8049 #define GL_INTENSITY4_EXT 0x804A #define GL_INTENSITY8_EXT 0x804B #define GL_INTENSITY12_EXT 0x804C #define GL_INTENSITY16_EXT 0x804D #define GL_RGB2_EXT 0x804E #define GL_RGB4_EXT 0x804F #define GL_RGB5_EXT 0x8050 #define GL_RGB8_EXT 0x8051 #define GL_RGB10_EXT 0x8052 #define GL_RGB12_EXT 0x8053 #define GL_RGB16_EXT 0x8054 #define GL_RGBA2_EXT 0x8055 #define GL_RGBA4_EXT 0x8056 #define GL_RGB5_A1_EXT 0x8057 #define GL_RGBA8_EXT 0x8058 #define GL_RGB10_A2_EXT 0x8059 #define GL_RGBA12_EXT 0x805A #define GL_RGBA16_EXT 0x805B #define GL_TEXTURE_RED_SIZE_EXT 0x805C #define GL_TEXTURE_GREEN_SIZE_EXT 0x805D #define GL_TEXTURE_BLUE_SIZE_EXT 0x805E #define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F #define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 #define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 #define GL_REPLACE_EXT 0x8062 #define GL_PROXY_TEXTURE_1D_EXT 0x8063 #define GL_PROXY_TEXTURE_2D_EXT 0x8064 #define GL_TEXTURE_TOO_LARGE_EXT 0x8065 #endif #ifndef GL_EXT_texture3D #define GL_PACK_SKIP_IMAGES_EXT 0x806B #define GL_PACK_IMAGE_HEIGHT_EXT 0x806C #define GL_UNPACK_SKIP_IMAGES_EXT 0x806D #define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E #define GL_TEXTURE_3D_EXT 0x806F #define GL_PROXY_TEXTURE_3D_EXT 0x8070 #define GL_TEXTURE_DEPTH_EXT 0x8071 #define GL_TEXTURE_WRAP_R_EXT 0x8072 #define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 #endif #ifndef GL_SGIS_texture_filter4 #define GL_FILTER4_SGIS 0x8146 #define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 #endif #ifndef GL_EXT_subtexture #endif #ifndef GL_EXT_copy_texture #endif #ifndef GL_EXT_histogram #define GL_HISTOGRAM_EXT 0x8024 #define GL_PROXY_HISTOGRAM_EXT 0x8025 #define GL_HISTOGRAM_WIDTH_EXT 0x8026 #define GL_HISTOGRAM_FORMAT_EXT 0x8027 #define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 #define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 #define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A #define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B #define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C #define GL_HISTOGRAM_SINK_EXT 0x802D #define GL_MINMAX_EXT 0x802E #define GL_MINMAX_FORMAT_EXT 0x802F #define GL_MINMAX_SINK_EXT 0x8030 #define GL_TABLE_TOO_LARGE_EXT 0x8031 #endif #ifndef GL_EXT_convolution #define GL_CONVOLUTION_1D_EXT 0x8010 #define GL_CONVOLUTION_2D_EXT 0x8011 #define GL_SEPARABLE_2D_EXT 0x8012 #define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 #define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 #define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 #define GL_REDUCE_EXT 0x8016 #define GL_CONVOLUTION_FORMAT_EXT 0x8017 #define GL_CONVOLUTION_WIDTH_EXT 0x8018 #define GL_CONVOLUTION_HEIGHT_EXT 0x8019 #define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A #define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B #define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C #define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D #define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E #define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F #define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 #define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 #define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 #define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 #endif #ifndef GL_SGI_color_matrix #define GL_COLOR_MATRIX_SGI 0x80B1 #define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 #define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 #define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 #define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 #define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 #define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 #define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 #define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 #define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA #define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB #endif #ifndef GL_SGI_color_table #define GL_COLOR_TABLE_SGI 0x80D0 #define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 #define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 #define GL_PROXY_COLOR_TABLE_SGI 0x80D3 #define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 #define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 #define GL_COLOR_TABLE_SCALE_SGI 0x80D6 #define GL_COLOR_TABLE_BIAS_SGI 0x80D7 #define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 #define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 #define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA #define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB #define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC #define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD #define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE #define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF #endif #ifndef GL_SGIS_pixel_texture #define GL_PIXEL_TEXTURE_SGIS 0x8353 #define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 #define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 #define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 #endif #ifndef GL_SGIX_pixel_texture #define GL_PIXEL_TEX_GEN_SGIX 0x8139 #define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B #endif #ifndef GL_SGIS_texture4D #define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 #define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 #define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 #define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 #define GL_TEXTURE_4D_SGIS 0x8134 #define GL_PROXY_TEXTURE_4D_SGIS 0x8135 #define GL_TEXTURE_4DSIZE_SGIS 0x8136 #define GL_TEXTURE_WRAP_Q_SGIS 0x8137 #define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 #define GL_TEXTURE_4D_BINDING_SGIS 0x814F #endif #ifndef GL_SGI_texture_color_table #define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC #define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD #endif #ifndef GL_EXT_cmyka #define GL_CMYK_EXT 0x800C #define GL_CMYKA_EXT 0x800D #define GL_PACK_CMYK_HINT_EXT 0x800E #define GL_UNPACK_CMYK_HINT_EXT 0x800F #endif #ifndef GL_EXT_texture_object #define GL_TEXTURE_PRIORITY_EXT 0x8066 #define GL_TEXTURE_RESIDENT_EXT 0x8067 #define GL_TEXTURE_1D_BINDING_EXT 0x8068 #define GL_TEXTURE_2D_BINDING_EXT 0x8069 #define GL_TEXTURE_3D_BINDING_EXT 0x806A #endif #ifndef GL_SGIS_detail_texture #define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 #define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 #define GL_LINEAR_DETAIL_SGIS 0x8097 #define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 #define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 #define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A #define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B #define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C #endif #ifndef GL_SGIS_sharpen_texture #define GL_LINEAR_SHARPEN_SGIS 0x80AD #define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE #define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF #define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 #endif #ifndef GL_EXT_packed_pixels #define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 #define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 #define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 #define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 #endif #ifndef GL_SGIS_texture_lod #define GL_TEXTURE_MIN_LOD_SGIS 0x813A #define GL_TEXTURE_MAX_LOD_SGIS 0x813B #define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C #define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D #endif #ifndef GL_SGIS_multisample #define GL_MULTISAMPLE_SGIS 0x809D #define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E #define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F #define GL_SAMPLE_MASK_SGIS 0x80A0 #define GL_1PASS_SGIS 0x80A1 #define GL_2PASS_0_SGIS 0x80A2 #define GL_2PASS_1_SGIS 0x80A3 #define GL_4PASS_0_SGIS 0x80A4 #define GL_4PASS_1_SGIS 0x80A5 #define GL_4PASS_2_SGIS 0x80A6 #define GL_4PASS_3_SGIS 0x80A7 #define GL_SAMPLE_BUFFERS_SGIS 0x80A8 #define GL_SAMPLES_SGIS 0x80A9 #define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA #define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB #define GL_SAMPLE_PATTERN_SGIS 0x80AC #endif #ifndef GL_EXT_rescale_normal #define GL_RESCALE_NORMAL_EXT 0x803A #endif #ifndef GL_EXT_vertex_array #define GL_VERTEX_ARRAY_EXT 0x8074 #define GL_NORMAL_ARRAY_EXT 0x8075 #define GL_COLOR_ARRAY_EXT 0x8076 #define GL_INDEX_ARRAY_EXT 0x8077 #define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 #define GL_EDGE_FLAG_ARRAY_EXT 0x8079 #define GL_VERTEX_ARRAY_SIZE_EXT 0x807A #define GL_VERTEX_ARRAY_TYPE_EXT 0x807B #define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C #define GL_VERTEX_ARRAY_COUNT_EXT 0x807D #define GL_NORMAL_ARRAY_TYPE_EXT 0x807E #define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F #define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 #define GL_COLOR_ARRAY_SIZE_EXT 0x8081 #define GL_COLOR_ARRAY_TYPE_EXT 0x8082 #define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 #define GL_COLOR_ARRAY_COUNT_EXT 0x8084 #define GL_INDEX_ARRAY_TYPE_EXT 0x8085 #define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 #define GL_INDEX_ARRAY_COUNT_EXT 0x8087 #define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 #define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 #define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A #define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B #define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C #define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D #define GL_VERTEX_ARRAY_POINTER_EXT 0x808E #define GL_NORMAL_ARRAY_POINTER_EXT 0x808F #define GL_COLOR_ARRAY_POINTER_EXT 0x8090 #define GL_INDEX_ARRAY_POINTER_EXT 0x8091 #define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 #define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 #endif #ifndef GL_EXT_misc_attribute #endif #ifndef GL_SGIS_generate_mipmap #define GL_GENERATE_MIPMAP_SGIS 0x8191 #define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 #endif #ifndef GL_SGIX_clipmap #define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 #define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 #define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 #define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 #define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 #define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 #define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 #define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 #define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 #define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D #define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E #define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F #endif #ifndef GL_SGIX_shadow #define GL_TEXTURE_COMPARE_SGIX 0x819A #define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B #define GL_TEXTURE_LEQUAL_R_SGIX 0x819C #define GL_TEXTURE_GEQUAL_R_SGIX 0x819D #endif #ifndef GL_SGIS_texture_edge_clamp #define GL_CLAMP_TO_EDGE_SGIS 0x812F #endif #ifndef GL_SGIS_texture_border_clamp #define GL_CLAMP_TO_BORDER_SGIS 0x812D #endif #ifndef GL_EXT_blend_minmax #define GL_FUNC_ADD_EXT 0x8006 #define GL_MIN_EXT 0x8007 #define GL_MAX_EXT 0x8008 #define GL_BLEND_EQUATION_EXT 0x8009 #endif #ifndef GL_EXT_blend_subtract #define GL_FUNC_SUBTRACT_EXT 0x800A #define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B #endif #ifndef GL_EXT_blend_logic_op #endif #ifndef GL_SGIX_interlace #define GL_INTERLACE_SGIX 0x8094 #endif #ifndef GL_SGIX_pixel_tiles #define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E #define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F #define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 #define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 #define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 #define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 #define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 #define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 #endif #ifndef GL_SGIS_texture_select #define GL_DUAL_ALPHA4_SGIS 0x8110 #define GL_DUAL_ALPHA8_SGIS 0x8111 #define GL_DUAL_ALPHA12_SGIS 0x8112 #define GL_DUAL_ALPHA16_SGIS 0x8113 #define GL_DUAL_LUMINANCE4_SGIS 0x8114 #define GL_DUAL_LUMINANCE8_SGIS 0x8115 #define GL_DUAL_LUMINANCE12_SGIS 0x8116 #define GL_DUAL_LUMINANCE16_SGIS 0x8117 #define GL_DUAL_INTENSITY4_SGIS 0x8118 #define GL_DUAL_INTENSITY8_SGIS 0x8119 #define GL_DUAL_INTENSITY12_SGIS 0x811A #define GL_DUAL_INTENSITY16_SGIS 0x811B #define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C #define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D #define GL_QUAD_ALPHA4_SGIS 0x811E #define GL_QUAD_ALPHA8_SGIS 0x811F #define GL_QUAD_LUMINANCE4_SGIS 0x8120 #define GL_QUAD_LUMINANCE8_SGIS 0x8121 #define GL_QUAD_INTENSITY4_SGIS 0x8122 #define GL_QUAD_INTENSITY8_SGIS 0x8123 #define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 #define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 #endif #ifndef GL_SGIX_sprite #define GL_SPRITE_SGIX 0x8148 #define GL_SPRITE_MODE_SGIX 0x8149 #define GL_SPRITE_AXIS_SGIX 0x814A #define GL_SPRITE_TRANSLATION_SGIX 0x814B #define GL_SPRITE_AXIAL_SGIX 0x814C #define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D #define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E #endif #ifndef GL_SGIX_texture_multi_buffer #define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E #endif #ifndef GL_EXT_point_parameters #define GL_POINT_SIZE_MIN_EXT 0x8126 #define GL_POINT_SIZE_MAX_EXT 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 #define GL_DISTANCE_ATTENUATION_EXT 0x8129 #endif #ifndef GL_SGIS_point_parameters #define GL_POINT_SIZE_MIN_SGIS 0x8126 #define GL_POINT_SIZE_MAX_SGIS 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 #define GL_DISTANCE_ATTENUATION_SGIS 0x8129 #endif #ifndef GL_SGIX_instruments #define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 #define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 #endif #ifndef GL_SGIX_texture_scale_bias #define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 #define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A #define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B #define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C #endif #ifndef GL_SGIX_framezoom #define GL_FRAMEZOOM_SGIX 0x818B #define GL_FRAMEZOOM_FACTOR_SGIX 0x818C #define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D #endif #ifndef GL_SGIX_tag_sample_buffer #endif #ifndef GL_FfdMaskSGIX #define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 #define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 #endif #ifndef GL_SGIX_polynomial_ffd #define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 #define GL_TEXTURE_DEFORMATION_SGIX 0x8195 #define GL_DEFORMATIONS_MASK_SGIX 0x8196 #define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 #endif #ifndef GL_SGIX_reference_plane #define GL_REFERENCE_PLANE_SGIX 0x817D #define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E #endif #ifndef GL_SGIX_flush_raster #endif #ifndef GL_SGIX_depth_texture #define GL_DEPTH_COMPONENT16_SGIX 0x81A5 #define GL_DEPTH_COMPONENT24_SGIX 0x81A6 #define GL_DEPTH_COMPONENT32_SGIX 0x81A7 #endif #ifndef GL_SGIS_fog_function #define GL_FOG_FUNC_SGIS 0x812A #define GL_FOG_FUNC_POINTS_SGIS 0x812B #define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C #endif #ifndef GL_SGIX_fog_offset #define GL_FOG_OFFSET_SGIX 0x8198 #define GL_FOG_OFFSET_VALUE_SGIX 0x8199 #endif #ifndef GL_HP_image_transform #define GL_IMAGE_SCALE_X_HP 0x8155 #define GL_IMAGE_SCALE_Y_HP 0x8156 #define GL_IMAGE_TRANSLATE_X_HP 0x8157 #define GL_IMAGE_TRANSLATE_Y_HP 0x8158 #define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 #define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A #define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B #define GL_IMAGE_MAG_FILTER_HP 0x815C #define GL_IMAGE_MIN_FILTER_HP 0x815D #define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E #define GL_CUBIC_HP 0x815F #define GL_AVERAGE_HP 0x8160 #define GL_IMAGE_TRANSFORM_2D_HP 0x8161 #define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 #define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 #endif #ifndef GL_HP_convolution_border_modes #define GL_IGNORE_BORDER_HP 0x8150 #define GL_CONSTANT_BORDER_HP 0x8151 #define GL_REPLICATE_BORDER_HP 0x8153 #define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 #endif #ifndef GL_INGR_palette_buffer #endif #ifndef GL_SGIX_texture_add_env #define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE #endif #ifndef GL_EXT_color_subtable #endif #ifndef GL_PGI_vertex_hints #define GL_VERTEX_DATA_HINT_PGI 0x1A22A #define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B #define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C #define GL_MAX_VERTEX_HINT_PGI 0x1A22D #define GL_COLOR3_BIT_PGI 0x00010000 #define GL_COLOR4_BIT_PGI 0x00020000 #define GL_EDGEFLAG_BIT_PGI 0x00040000 #define GL_INDEX_BIT_PGI 0x00080000 #define GL_MAT_AMBIENT_BIT_PGI 0x00100000 #define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 #define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 #define GL_MAT_EMISSION_BIT_PGI 0x00800000 #define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 #define GL_MAT_SHININESS_BIT_PGI 0x02000000 #define GL_MAT_SPECULAR_BIT_PGI 0x04000000 #define GL_NORMAL_BIT_PGI 0x08000000 #define GL_TEXCOORD1_BIT_PGI 0x10000000 #define GL_TEXCOORD2_BIT_PGI 0x20000000 #define GL_TEXCOORD3_BIT_PGI 0x40000000 #define GL_TEXCOORD4_BIT_PGI 0x80000000 #define GL_VERTEX23_BIT_PGI 0x00000004 #define GL_VERTEX4_BIT_PGI 0x00000008 #endif #ifndef GL_PGI_misc_hints #define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 #define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD #define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE #define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 #define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 #define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 #define GL_ALWAYS_FAST_HINT_PGI 0x1A20C #define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D #define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E #define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F #define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 #define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 #define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 #define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 #define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 #define GL_FULL_STIPPLE_HINT_PGI 0x1A219 #define GL_CLIP_NEAR_HINT_PGI 0x1A220 #define GL_CLIP_FAR_HINT_PGI 0x1A221 #define GL_WIDE_LINE_HINT_PGI 0x1A222 #define GL_BACK_NORMALS_HINT_PGI 0x1A223 #endif #ifndef GL_EXT_paletted_texture #define GL_COLOR_INDEX1_EXT 0x80E2 #define GL_COLOR_INDEX2_EXT 0x80E3 #define GL_COLOR_INDEX4_EXT 0x80E4 #define GL_COLOR_INDEX8_EXT 0x80E5 #define GL_COLOR_INDEX12_EXT 0x80E6 #define GL_COLOR_INDEX16_EXT 0x80E7 #define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED #endif #ifndef GL_EXT_clip_volume_hint #define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 #endif #ifndef GL_SGIX_list_priority #define GL_LIST_PRIORITY_SGIX 0x8182 #endif #ifndef GL_SGIX_ir_instrument1 #define GL_IR_INSTRUMENT1_SGIX 0x817F #endif #ifndef GL_SGIX_calligraphic_fragment #define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 #endif #ifndef GL_SGIX_texture_lod_bias #define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E #define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F #define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 #endif #ifndef GL_SGIX_shadow_ambient #define GL_SHADOW_AMBIENT_SGIX 0x80BF #endif #ifndef GL_EXT_index_texture #endif #ifndef GL_EXT_index_material #define GL_INDEX_MATERIAL_EXT 0x81B8 #define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 #define GL_INDEX_MATERIAL_FACE_EXT 0x81BA #endif #ifndef GL_EXT_index_func #define GL_INDEX_TEST_EXT 0x81B5 #define GL_INDEX_TEST_FUNC_EXT 0x81B6 #define GL_INDEX_TEST_REF_EXT 0x81B7 #endif #ifndef GL_EXT_index_array_formats #define GL_IUI_V2F_EXT 0x81AD #define GL_IUI_V3F_EXT 0x81AE #define GL_IUI_N3F_V2F_EXT 0x81AF #define GL_IUI_N3F_V3F_EXT 0x81B0 #define GL_T2F_IUI_V2F_EXT 0x81B1 #define GL_T2F_IUI_V3F_EXT 0x81B2 #define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 #define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 #endif #ifndef GL_EXT_compiled_vertex_array #define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 #define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 #endif #ifndef GL_EXT_cull_vertex #define GL_CULL_VERTEX_EXT 0x81AA #define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB #define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC #endif #ifndef GL_SGIX_ycrcb #define GL_YCRCB_422_SGIX 0x81BB #define GL_YCRCB_444_SGIX 0x81BC #endif #ifndef GL_SGIX_fragment_lighting #define GL_FRAGMENT_LIGHTING_SGIX 0x8400 #define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 #define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 #define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 #define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 #define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 #define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 #define GL_LIGHT_ENV_MODE_SGIX 0x8407 #define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 #define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 #define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A #define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B #define GL_FRAGMENT_LIGHT0_SGIX 0x840C #define GL_FRAGMENT_LIGHT1_SGIX 0x840D #define GL_FRAGMENT_LIGHT2_SGIX 0x840E #define GL_FRAGMENT_LIGHT3_SGIX 0x840F #define GL_FRAGMENT_LIGHT4_SGIX 0x8410 #define GL_FRAGMENT_LIGHT5_SGIX 0x8411 #define GL_FRAGMENT_LIGHT6_SGIX 0x8412 #define GL_FRAGMENT_LIGHT7_SGIX 0x8413 #endif #ifndef GL_IBM_rasterpos_clip #define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 #endif #ifndef GL_HP_texture_lighting #define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 #define GL_TEXTURE_POST_SPECULAR_HP 0x8168 #define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 #endif #ifndef GL_EXT_draw_range_elements #define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 #define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 #endif #ifndef GL_WIN_phong_shading #define GL_PHONG_WIN 0x80EA #define GL_PHONG_HINT_WIN 0x80EB #endif #ifndef GL_WIN_specular_fog #define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC #endif #ifndef GL_EXT_light_texture #define GL_FRAGMENT_MATERIAL_EXT 0x8349 #define GL_FRAGMENT_NORMAL_EXT 0x834A #define GL_FRAGMENT_COLOR_EXT 0x834C #define GL_ATTENUATION_EXT 0x834D #define GL_SHADOW_ATTENUATION_EXT 0x834E #define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F #define GL_TEXTURE_LIGHT_EXT 0x8350 #define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 #define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 #endif #ifndef GL_SGIX_blend_alpha_minmax #define GL_ALPHA_MIN_SGIX 0x8320 #define GL_ALPHA_MAX_SGIX 0x8321 #endif #ifndef GL_SGIX_impact_pixel_texture #define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 #define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 #define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 #define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 #define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 #define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 #define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A #endif #ifndef GL_EXT_bgra #define GL_BGR_EXT 0x80E0 #define GL_BGRA_EXT 0x80E1 #endif #ifndef GL_SGIX_async #define GL_ASYNC_MARKER_SGIX 0x8329 #endif #ifndef GL_SGIX_async_pixel #define GL_ASYNC_TEX_IMAGE_SGIX 0x835C #define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D #define GL_ASYNC_READ_PIXELS_SGIX 0x835E #define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F #define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 #define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 #endif #ifndef GL_SGIX_async_histogram #define GL_ASYNC_HISTOGRAM_SGIX 0x832C #define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D #endif #ifndef GL_INTEL_texture_scissor #endif #ifndef GL_INTEL_parallel_arrays #define GL_PARALLEL_ARRAYS_INTEL 0x83F4 #define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 #define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 #define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 #define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 #endif #ifndef GL_HP_occlusion_test #define GL_OCCLUSION_TEST_HP 0x8165 #define GL_OCCLUSION_TEST_RESULT_HP 0x8166 #endif #ifndef GL_EXT_pixel_transform #define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 #define GL_PIXEL_MAG_FILTER_EXT 0x8331 #define GL_PIXEL_MIN_FILTER_EXT 0x8332 #define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 #define GL_CUBIC_EXT 0x8334 #define GL_AVERAGE_EXT 0x8335 #define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 #define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 #define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 #endif #ifndef GL_EXT_pixel_transform_color_table #endif #ifndef GL_EXT_shared_texture_palette #define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB #endif #ifndef GL_EXT_separate_specular_color #define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 #define GL_SINGLE_COLOR_EXT 0x81F9 #define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA #endif #ifndef GL_EXT_secondary_color #define GL_COLOR_SUM_EXT 0x8458 #define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 #define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A #define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B #define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C #define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D #define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E #endif #ifndef GL_EXT_texture_perturb_normal #define GL_PERTURB_EXT 0x85AE #define GL_TEXTURE_NORMAL_EXT 0x85AF #endif #ifndef GL_EXT_multi_draw_arrays #endif #ifndef GL_EXT_fog_coord #define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 #define GL_FOG_COORDINATE_EXT 0x8451 #define GL_FRAGMENT_DEPTH_EXT 0x8452 #define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 #define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 #define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 #define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 #define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 #endif #ifndef GL_REND_screen_coordinates #define GL_SCREEN_COORDINATES_REND 0x8490 #define GL_INVERTED_SCREEN_W_REND 0x8491 #endif #ifndef GL_EXT_coordinate_frame #define GL_TANGENT_ARRAY_EXT 0x8439 #define GL_BINORMAL_ARRAY_EXT 0x843A #define GL_CURRENT_TANGENT_EXT 0x843B #define GL_CURRENT_BINORMAL_EXT 0x843C #define GL_TANGENT_ARRAY_TYPE_EXT 0x843E #define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F #define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 #define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 #define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 #define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 #define GL_MAP1_TANGENT_EXT 0x8444 #define GL_MAP2_TANGENT_EXT 0x8445 #define GL_MAP1_BINORMAL_EXT 0x8446 #define GL_MAP2_BINORMAL_EXT 0x8447 #endif #ifndef GL_EXT_texture_env_combine #define GL_COMBINE_EXT 0x8570 #define GL_COMBINE_RGB_EXT 0x8571 #define GL_COMBINE_ALPHA_EXT 0x8572 #define GL_RGB_SCALE_EXT 0x8573 #define GL_ADD_SIGNED_EXT 0x8574 #define GL_INTERPOLATE_EXT 0x8575 #define GL_CONSTANT_EXT 0x8576 #define GL_PRIMARY_COLOR_EXT 0x8577 #define GL_PREVIOUS_EXT 0x8578 #define GL_SOURCE0_RGB_EXT 0x8580 #define GL_SOURCE1_RGB_EXT 0x8581 #define GL_SOURCE2_RGB_EXT 0x8582 #define GL_SOURCE0_ALPHA_EXT 0x8588 #define GL_SOURCE1_ALPHA_EXT 0x8589 #define GL_SOURCE2_ALPHA_EXT 0x858A #define GL_OPERAND0_RGB_EXT 0x8590 #define GL_OPERAND1_RGB_EXT 0x8591 #define GL_OPERAND2_RGB_EXT 0x8592 #define GL_OPERAND0_ALPHA_EXT 0x8598 #define GL_OPERAND1_ALPHA_EXT 0x8599 #define GL_OPERAND2_ALPHA_EXT 0x859A #endif #ifndef GL_APPLE_specular_vector #define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 #endif #ifndef GL_APPLE_transform_hint #define GL_TRANSFORM_HINT_APPLE 0x85B1 #endif #ifndef GL_SGIX_fog_scale #define GL_FOG_SCALE_SGIX 0x81FC #define GL_FOG_SCALE_VALUE_SGIX 0x81FD #endif #ifndef GL_SUNX_constant_data #define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 #define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 #endif #ifndef GL_SUN_global_alpha #define GL_GLOBAL_ALPHA_SUN 0x81D9 #define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA #endif #ifndef GL_SUN_triangle_list #define GL_RESTART_SUN 0x0001 #define GL_REPLACE_MIDDLE_SUN 0x0002 #define GL_REPLACE_OLDEST_SUN 0x0003 #define GL_TRIANGLE_LIST_SUN 0x81D7 #define GL_REPLACEMENT_CODE_SUN 0x81D8 #define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 #define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 #define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 #define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 #define GL_R1UI_V3F_SUN 0x85C4 #define GL_R1UI_C4UB_V3F_SUN 0x85C5 #define GL_R1UI_C3F_V3F_SUN 0x85C6 #define GL_R1UI_N3F_V3F_SUN 0x85C7 #define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 #define GL_R1UI_T2F_V3F_SUN 0x85C9 #define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA #define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB #endif #ifndef GL_SUN_vertex #endif #ifndef GL_EXT_blend_func_separate #define GL_BLEND_DST_RGB_EXT 0x80C8 #define GL_BLEND_SRC_RGB_EXT 0x80C9 #define GL_BLEND_DST_ALPHA_EXT 0x80CA #define GL_BLEND_SRC_ALPHA_EXT 0x80CB #endif #ifndef GL_INGR_color_clamp #define GL_RED_MIN_CLAMP_INGR 0x8560 #define GL_GREEN_MIN_CLAMP_INGR 0x8561 #define GL_BLUE_MIN_CLAMP_INGR 0x8562 #define GL_ALPHA_MIN_CLAMP_INGR 0x8563 #define GL_RED_MAX_CLAMP_INGR 0x8564 #define GL_GREEN_MAX_CLAMP_INGR 0x8565 #define GL_BLUE_MAX_CLAMP_INGR 0x8566 #define GL_ALPHA_MAX_CLAMP_INGR 0x8567 #endif #ifndef GL_INGR_interlace_read #define GL_INTERLACE_READ_INGR 0x8568 #endif #ifndef GL_EXT_stencil_wrap #define GL_INCR_WRAP_EXT 0x8507 #define GL_DECR_WRAP_EXT 0x8508 #endif #ifndef GL_EXT_422_pixels #define GL_422_EXT 0x80CC #define GL_422_REV_EXT 0x80CD #define GL_422_AVERAGE_EXT 0x80CE #define GL_422_REV_AVERAGE_EXT 0x80CF #endif #ifndef GL_NV_texgen_reflection #define GL_NORMAL_MAP_NV 0x8511 #define GL_REFLECTION_MAP_NV 0x8512 #endif #ifndef GL_EXT_texture_cube_map #define GL_NORMAL_MAP_EXT 0x8511 #define GL_REFLECTION_MAP_EXT 0x8512 #define GL_TEXTURE_CUBE_MAP_EXT 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A #define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B #define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C #endif #ifndef GL_SUN_convolution_border_modes #define GL_WRAP_BORDER_SUN 0x81D4 #endif #ifndef GL_EXT_texture_env_add #endif #ifndef GL_EXT_texture_lod_bias #define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD #define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 #define GL_TEXTURE_LOD_BIAS_EXT 0x8501 #endif #ifndef GL_EXT_texture_filter_anisotropic #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF #endif #ifndef GL_EXT_vertex_weighting #define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH #define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 #define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX #define GL_MODELVIEW1_MATRIX_EXT 0x8506 #define GL_VERTEX_WEIGHTING_EXT 0x8509 #define GL_MODELVIEW0_EXT GL_MODELVIEW #define GL_MODELVIEW1_EXT 0x850A #define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B #define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C #define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D #define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E #define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F #define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 #endif #ifndef GL_NV_light_max_exponent #define GL_MAX_SHININESS_NV 0x8504 #define GL_MAX_SPOT_EXPONENT_NV 0x8505 #endif #ifndef GL_NV_vertex_array_range #define GL_VERTEX_ARRAY_RANGE_NV 0x851D #define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E #define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F #define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 #define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 #endif #ifndef GL_NV_register_combiners #define GL_REGISTER_COMBINERS_NV 0x8522 #define GL_VARIABLE_A_NV 0x8523 #define GL_VARIABLE_B_NV 0x8524 #define GL_VARIABLE_C_NV 0x8525 #define GL_VARIABLE_D_NV 0x8526 #define GL_VARIABLE_E_NV 0x8527 #define GL_VARIABLE_F_NV 0x8528 #define GL_VARIABLE_G_NV 0x8529 #define GL_CONSTANT_COLOR0_NV 0x852A #define GL_CONSTANT_COLOR1_NV 0x852B #define GL_PRIMARY_COLOR_NV 0x852C #define GL_SECONDARY_COLOR_NV 0x852D #define GL_SPARE0_NV 0x852E #define GL_SPARE1_NV 0x852F #define GL_DISCARD_NV 0x8530 #define GL_E_TIMES_F_NV 0x8531 #define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 #define GL_UNSIGNED_IDENTITY_NV 0x8536 #define GL_UNSIGNED_INVERT_NV 0x8537 #define GL_EXPAND_NORMAL_NV 0x8538 #define GL_EXPAND_NEGATE_NV 0x8539 #define GL_HALF_BIAS_NORMAL_NV 0x853A #define GL_HALF_BIAS_NEGATE_NV 0x853B #define GL_SIGNED_IDENTITY_NV 0x853C #define GL_SIGNED_NEGATE_NV 0x853D #define GL_SCALE_BY_TWO_NV 0x853E #define GL_SCALE_BY_FOUR_NV 0x853F #define GL_SCALE_BY_ONE_HALF_NV 0x8540 #define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 #define GL_COMBINER_INPUT_NV 0x8542 #define GL_COMBINER_MAPPING_NV 0x8543 #define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 #define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 #define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 #define GL_COMBINER_MUX_SUM_NV 0x8547 #define GL_COMBINER_SCALE_NV 0x8548 #define GL_COMBINER_BIAS_NV 0x8549 #define GL_COMBINER_AB_OUTPUT_NV 0x854A #define GL_COMBINER_CD_OUTPUT_NV 0x854B #define GL_COMBINER_SUM_OUTPUT_NV 0x854C #define GL_MAX_GENERAL_COMBINERS_NV 0x854D #define GL_NUM_GENERAL_COMBINERS_NV 0x854E #define GL_COLOR_SUM_CLAMP_NV 0x854F #define GL_COMBINER0_NV 0x8550 #define GL_COMBINER1_NV 0x8551 #define GL_COMBINER2_NV 0x8552 #define GL_COMBINER3_NV 0x8553 #define GL_COMBINER4_NV 0x8554 #define GL_COMBINER5_NV 0x8555 #define GL_COMBINER6_NV 0x8556 #define GL_COMBINER7_NV 0x8557 #endif #ifndef GL_NV_fog_distance #define GL_FOG_DISTANCE_MODE_NV 0x855A #define GL_EYE_RADIAL_NV 0x855B #define GL_EYE_PLANE_ABSOLUTE_NV 0x855C #endif #ifndef GL_NV_texgen_emboss #define GL_EMBOSS_LIGHT_NV 0x855D #define GL_EMBOSS_CONSTANT_NV 0x855E #define GL_EMBOSS_MAP_NV 0x855F #endif #ifndef GL_NV_blend_square #endif #ifndef GL_NV_texture_env_combine4 #define GL_COMBINE4_NV 0x8503 #define GL_SOURCE3_RGB_NV 0x8583 #define GL_SOURCE3_ALPHA_NV 0x858B #define GL_OPERAND3_RGB_NV 0x8593 #define GL_OPERAND3_ALPHA_NV 0x859B #endif #ifndef GL_MESA_resize_buffers #endif #ifndef GL_MESA_window_pos #endif #ifndef GL_EXT_texture_compression_s3tc #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 #endif #ifndef GL_IBM_cull_vertex #endif #ifndef GL_IBM_multimode_draw_arrays #endif #ifndef GL_IBM_vertex_array_lists #endif #ifndef GL_SGIX_subsample #define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 #define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 #define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 #define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 #define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 #endif #ifndef GL_SGIX_ycrcb_subsample #endif #ifndef GL_SGIX_ycrcba #define GL_YCRCB_SGIX 0x8318 #define GL_YCRCBA_SGIX 0x8319 #endif #ifndef GL_SGI_depth_pass_instrument #define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 #define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 #define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 #endif #ifndef GL_3DFX_texture_compression_FXT1 #define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 #define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 #endif #ifndef GL_3DFX_multisample #define GL_MULTISAMPLE_3DFX 0x86B2 #define GL_SAMPLE_BUFFERS_3DFX 0x86B3 #define GL_SAMPLES_3DFX 0x86B4 #define GL_MULTISAMPLE_BIT_3DFX 0x20000000 #endif #ifndef GL_3DFX_tbuffer #endif #ifndef GL_EXT_multisample #define GL_MULTISAMPLE_EXT 0x809D #define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E #define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F #define GL_SAMPLE_MASK_EXT 0x80A0 #define GL_1PASS_EXT 0x80A1 #define GL_2PASS_0_EXT 0x80A2 #define GL_2PASS_1_EXT 0x80A3 #define GL_4PASS_0_EXT 0x80A4 #define GL_4PASS_1_EXT 0x80A5 #define GL_4PASS_2_EXT 0x80A6 #define GL_4PASS_3_EXT 0x80A7 #define GL_SAMPLE_BUFFERS_EXT 0x80A8 #define GL_SAMPLES_EXT 0x80A9 #define GL_SAMPLE_MASK_VALUE_EXT 0x80AA #define GL_SAMPLE_MASK_INVERT_EXT 0x80AB #define GL_SAMPLE_PATTERN_EXT 0x80AC #define GL_MULTISAMPLE_BIT_EXT 0x20000000 #endif #ifndef GL_SGIX_vertex_preclip #define GL_VERTEX_PRECLIP_SGIX 0x83EE #define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF #endif #ifndef GL_SGIX_convolution_accuracy #define GL_CONVOLUTION_HINT_SGIX 0x8316 #endif #ifndef GL_SGIX_resample #define GL_PACK_RESAMPLE_SGIX 0x842C #define GL_UNPACK_RESAMPLE_SGIX 0x842D #define GL_RESAMPLE_REPLICATE_SGIX 0x842E #define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F #define GL_RESAMPLE_DECIMATE_SGIX 0x8430 #endif #ifndef GL_SGIS_point_line_texgen #define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 #define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 #define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 #define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 #define GL_EYE_POINT_SGIS 0x81F4 #define GL_OBJECT_POINT_SGIS 0x81F5 #define GL_EYE_LINE_SGIS 0x81F6 #define GL_OBJECT_LINE_SGIS 0x81F7 #endif #ifndef GL_SGIS_texture_color_mask #define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF #endif #ifndef GL_EXT_texture_env_dot3 #define GL_DOT3_RGB_EXT 0x8740 #define GL_DOT3_RGBA_EXT 0x8741 #endif #ifndef GL_ATI_texture_mirror_once #define GL_MIRROR_CLAMP_ATI 0x8742 #define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 #endif #ifndef GL_NV_fence #define GL_ALL_COMPLETED_NV 0x84F2 #define GL_FENCE_STATUS_NV 0x84F3 #define GL_FENCE_CONDITION_NV 0x84F4 #endif #ifndef GL_IBM_texture_mirrored_repeat #define GL_MIRRORED_REPEAT_IBM 0x8370 #endif #ifndef GL_NV_evaluators #define GL_EVAL_2D_NV 0x86C0 #define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 #define GL_MAP_TESSELLATION_NV 0x86C2 #define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 #define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 #define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 #define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 #define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 #define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 #define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 #define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA #define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB #define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC #define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD #define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE #define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF #define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 #define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 #define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 #define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 #define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 #define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 #define GL_MAX_MAP_TESSELLATION_NV 0x86D6 #define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 #endif #ifndef GL_NV_packed_depth_stencil #define GL_DEPTH_STENCIL_NV 0x84F9 #define GL_UNSIGNED_INT_24_8_NV 0x84FA #endif #ifndef GL_NV_register_combiners2 #define GL_PER_STAGE_CONSTANTS_NV 0x8535 #endif #ifndef GL_NV_texture_compression_vtc #endif #ifndef GL_NV_texture_rectangle #define GL_TEXTURE_RECTANGLE_NV 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 #define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 #endif #ifndef GL_NV_texture_shader #define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C #define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D #define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E #define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 #define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA #define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB #define GL_DSDT_MAG_INTENSITY_NV 0x86DC #define GL_SHADER_CONSISTENT_NV 0x86DD #define GL_TEXTURE_SHADER_NV 0x86DE #define GL_SHADER_OPERATION_NV 0x86DF #define GL_CULL_MODES_NV 0x86E0 #define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 #define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 #define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 #define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV #define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV #define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV #define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 #define GL_CONST_EYE_NV 0x86E5 #define GL_PASS_THROUGH_NV 0x86E6 #define GL_CULL_FRAGMENT_NV 0x86E7 #define GL_OFFSET_TEXTURE_2D_NV 0x86E8 #define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 #define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA #define GL_DOT_PRODUCT_NV 0x86EC #define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED #define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE #define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 #define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 #define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 #define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 #define GL_HILO_NV 0x86F4 #define GL_DSDT_NV 0x86F5 #define GL_DSDT_MAG_NV 0x86F6 #define GL_DSDT_MAG_VIB_NV 0x86F7 #define GL_HILO16_NV 0x86F8 #define GL_SIGNED_HILO_NV 0x86F9 #define GL_SIGNED_HILO16_NV 0x86FA #define GL_SIGNED_RGBA_NV 0x86FB #define GL_SIGNED_RGBA8_NV 0x86FC #define GL_SIGNED_RGB_NV 0x86FE #define GL_SIGNED_RGB8_NV 0x86FF #define GL_SIGNED_LUMINANCE_NV 0x8701 #define GL_SIGNED_LUMINANCE8_NV 0x8702 #define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 #define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 #define GL_SIGNED_ALPHA_NV 0x8705 #define GL_SIGNED_ALPHA8_NV 0x8706 #define GL_SIGNED_INTENSITY_NV 0x8707 #define GL_SIGNED_INTENSITY8_NV 0x8708 #define GL_DSDT8_NV 0x8709 #define GL_DSDT8_MAG8_NV 0x870A #define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B #define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C #define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D #define GL_HI_SCALE_NV 0x870E #define GL_LO_SCALE_NV 0x870F #define GL_DS_SCALE_NV 0x8710 #define GL_DT_SCALE_NV 0x8711 #define GL_MAGNITUDE_SCALE_NV 0x8712 #define GL_VIBRANCE_SCALE_NV 0x8713 #define GL_HI_BIAS_NV 0x8714 #define GL_LO_BIAS_NV 0x8715 #define GL_DS_BIAS_NV 0x8716 #define GL_DT_BIAS_NV 0x8717 #define GL_MAGNITUDE_BIAS_NV 0x8718 #define GL_VIBRANCE_BIAS_NV 0x8719 #define GL_TEXTURE_BORDER_VALUES_NV 0x871A #define GL_TEXTURE_HI_SIZE_NV 0x871B #define GL_TEXTURE_LO_SIZE_NV 0x871C #define GL_TEXTURE_DS_SIZE_NV 0x871D #define GL_TEXTURE_DT_SIZE_NV 0x871E #define GL_TEXTURE_MAG_SIZE_NV 0x871F #endif #ifndef GL_NV_texture_shader2 #define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF #endif #ifndef GL_NV_vertex_array_range2 #define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 #endif #ifndef GL_NV_vertex_program #define GL_VERTEX_PROGRAM_NV 0x8620 #define GL_VERTEX_STATE_PROGRAM_NV 0x8621 #define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 #define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 #define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 #define GL_CURRENT_ATTRIB_NV 0x8626 #define GL_PROGRAM_LENGTH_NV 0x8627 #define GL_PROGRAM_STRING_NV 0x8628 #define GL_MODELVIEW_PROJECTION_NV 0x8629 #define GL_IDENTITY_NV 0x862A #define GL_INVERSE_NV 0x862B #define GL_TRANSPOSE_NV 0x862C #define GL_INVERSE_TRANSPOSE_NV 0x862D #define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E #define GL_MAX_TRACK_MATRICES_NV 0x862F #define GL_MATRIX0_NV 0x8630 #define GL_MATRIX1_NV 0x8631 #define GL_MATRIX2_NV 0x8632 #define GL_MATRIX3_NV 0x8633 #define GL_MATRIX4_NV 0x8634 #define GL_MATRIX5_NV 0x8635 #define GL_MATRIX6_NV 0x8636 #define GL_MATRIX7_NV 0x8637 #define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 #define GL_CURRENT_MATRIX_NV 0x8641 #define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 #define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 #define GL_PROGRAM_PARAMETER_NV 0x8644 #define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 #define GL_PROGRAM_TARGET_NV 0x8646 #define GL_PROGRAM_RESIDENT_NV 0x8647 #define GL_TRACK_MATRIX_NV 0x8648 #define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 #define GL_VERTEX_PROGRAM_BINDING_NV 0x864A #define GL_PROGRAM_ERROR_POSITION_NV 0x864B #define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 #define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 #define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 #define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 #define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 #define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 #define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 #define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 #define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 #define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 #define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A #define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B #define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C #define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D #define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E #define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F #define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 #define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 #define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 #define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 #define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 #define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 #define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 #define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 #define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 #define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 #define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A #define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B #define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C #define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D #define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E #define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F #define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 #define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 #define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 #define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 #define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 #define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 #define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 #define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 #define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 #define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 #define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A #define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B #define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C #define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D #define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E #define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F #endif #ifndef GL_SGIX_texture_coordinate_clamp #define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 #define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A #define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B #endif #ifndef GL_SGIX_scalebias_hint #define GL_SCALEBIAS_HINT_SGIX 0x8322 #endif #ifndef GL_OML_interlace #define GL_INTERLACE_OML 0x8980 #define GL_INTERLACE_READ_OML 0x8981 #endif #ifndef GL_OML_subsample #define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 #define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 #endif #ifndef GL_OML_resample #define GL_PACK_RESAMPLE_OML 0x8984 #define GL_UNPACK_RESAMPLE_OML 0x8985 #define GL_RESAMPLE_REPLICATE_OML 0x8986 #define GL_RESAMPLE_ZERO_FILL_OML 0x8987 #define GL_RESAMPLE_AVERAGE_OML 0x8988 #define GL_RESAMPLE_DECIMATE_OML 0x8989 #endif #ifndef GL_NV_copy_depth_to_color #define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E #define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F #endif #ifndef GL_ATI_envmap_bumpmap #define GL_BUMP_ROT_MATRIX_ATI 0x8775 #define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 #define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 #define GL_BUMP_TEX_UNITS_ATI 0x8778 #define GL_DUDV_ATI 0x8779 #define GL_DU8DV8_ATI 0x877A #define GL_BUMP_ENVMAP_ATI 0x877B #define GL_BUMP_TARGET_ATI 0x877C #endif #ifndef GL_ATI_fragment_shader #define GL_FRAGMENT_SHADER_ATI 0x8920 #define GL_REG_0_ATI 0x8921 #define GL_REG_1_ATI 0x8922 #define GL_REG_2_ATI 0x8923 #define GL_REG_3_ATI 0x8924 #define GL_REG_4_ATI 0x8925 #define GL_REG_5_ATI 0x8926 #define GL_REG_6_ATI 0x8927 #define GL_REG_7_ATI 0x8928 #define GL_REG_8_ATI 0x8929 #define GL_REG_9_ATI 0x892A #define GL_REG_10_ATI 0x892B #define GL_REG_11_ATI 0x892C #define GL_REG_12_ATI 0x892D #define GL_REG_13_ATI 0x892E #define GL_REG_14_ATI 0x892F #define GL_REG_15_ATI 0x8930 #define GL_REG_16_ATI 0x8931 #define GL_REG_17_ATI 0x8932 #define GL_REG_18_ATI 0x8933 #define GL_REG_19_ATI 0x8934 #define GL_REG_20_ATI 0x8935 #define GL_REG_21_ATI 0x8936 #define GL_REG_22_ATI 0x8937 #define GL_REG_23_ATI 0x8938 #define GL_REG_24_ATI 0x8939 #define GL_REG_25_ATI 0x893A #define GL_REG_26_ATI 0x893B #define GL_REG_27_ATI 0x893C #define GL_REG_28_ATI 0x893D #define GL_REG_29_ATI 0x893E #define GL_REG_30_ATI 0x893F #define GL_REG_31_ATI 0x8940 #define GL_CON_0_ATI 0x8941 #define GL_CON_1_ATI 0x8942 #define GL_CON_2_ATI 0x8943 #define GL_CON_3_ATI 0x8944 #define GL_CON_4_ATI 0x8945 #define GL_CON_5_ATI 0x8946 #define GL_CON_6_ATI 0x8947 #define GL_CON_7_ATI 0x8948 #define GL_CON_8_ATI 0x8949 #define GL_CON_9_ATI 0x894A #define GL_CON_10_ATI 0x894B #define GL_CON_11_ATI 0x894C #define GL_CON_12_ATI 0x894D #define GL_CON_13_ATI 0x894E #define GL_CON_14_ATI 0x894F #define GL_CON_15_ATI 0x8950 #define GL_CON_16_ATI 0x8951 #define GL_CON_17_ATI 0x8952 #define GL_CON_18_ATI 0x8953 #define GL_CON_19_ATI 0x8954 #define GL_CON_20_ATI 0x8955 #define GL_CON_21_ATI 0x8956 #define GL_CON_22_ATI 0x8957 #define GL_CON_23_ATI 0x8958 #define GL_CON_24_ATI 0x8959 #define GL_CON_25_ATI 0x895A #define GL_CON_26_ATI 0x895B #define GL_CON_27_ATI 0x895C #define GL_CON_28_ATI 0x895D #define GL_CON_29_ATI 0x895E #define GL_CON_30_ATI 0x895F #define GL_CON_31_ATI 0x8960 #define GL_MOV_ATI 0x8961 #define GL_ADD_ATI 0x8963 #define GL_MUL_ATI 0x8964 #define GL_SUB_ATI 0x8965 #define GL_DOT3_ATI 0x8966 #define GL_DOT4_ATI 0x8967 #define GL_MAD_ATI 0x8968 #define GL_LERP_ATI 0x8969 #define GL_CND_ATI 0x896A #define GL_CND0_ATI 0x896B #define GL_DOT2_ADD_ATI 0x896C #define GL_SECONDARY_INTERPOLATOR_ATI 0x896D #define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E #define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F #define GL_NUM_PASSES_ATI 0x8970 #define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 #define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 #define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 #define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 #define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 #define GL_SWIZZLE_STR_ATI 0x8976 #define GL_SWIZZLE_STQ_ATI 0x8977 #define GL_SWIZZLE_STR_DR_ATI 0x8978 #define GL_SWIZZLE_STQ_DQ_ATI 0x8979 #define GL_SWIZZLE_STRQ_ATI 0x897A #define GL_SWIZZLE_STRQ_DQ_ATI 0x897B #define GL_RED_BIT_ATI 0x00000001 #define GL_GREEN_BIT_ATI 0x00000002 #define GL_BLUE_BIT_ATI 0x00000004 #define GL_2X_BIT_ATI 0x00000001 #define GL_4X_BIT_ATI 0x00000002 #define GL_8X_BIT_ATI 0x00000004 #define GL_HALF_BIT_ATI 0x00000008 #define GL_QUARTER_BIT_ATI 0x00000010 #define GL_EIGHTH_BIT_ATI 0x00000020 #define GL_SATURATE_BIT_ATI 0x00000040 #define GL_COMP_BIT_ATI 0x00000002 #define GL_NEGATE_BIT_ATI 0x00000004 #define GL_BIAS_BIT_ATI 0x00000008 #endif #ifndef GL_ATI_pn_triangles #define GL_PN_TRIANGLES_ATI 0x87F0 #define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 #define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 #define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 #define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 #define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 #define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 #define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 #define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 #endif #ifndef GL_ATI_vertex_array_object #define GL_STATIC_ATI 0x8760 #define GL_DYNAMIC_ATI 0x8761 #define GL_PRESERVE_ATI 0x8762 #define GL_DISCARD_ATI 0x8763 #define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 #define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 #define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 #define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 #endif #ifndef GL_EXT_vertex_shader #define GL_VERTEX_SHADER_EXT 0x8780 #define GL_VERTEX_SHADER_BINDING_EXT 0x8781 #define GL_OP_INDEX_EXT 0x8782 #define GL_OP_NEGATE_EXT 0x8783 #define GL_OP_DOT3_EXT 0x8784 #define GL_OP_DOT4_EXT 0x8785 #define GL_OP_MUL_EXT 0x8786 #define GL_OP_ADD_EXT 0x8787 #define GL_OP_MADD_EXT 0x8788 #define GL_OP_FRAC_EXT 0x8789 #define GL_OP_MAX_EXT 0x878A #define GL_OP_MIN_EXT 0x878B #define GL_OP_SET_GE_EXT 0x878C #define GL_OP_SET_LT_EXT 0x878D #define GL_OP_CLAMP_EXT 0x878E #define GL_OP_FLOOR_EXT 0x878F #define GL_OP_ROUND_EXT 0x8790 #define GL_OP_EXP_BASE_2_EXT 0x8791 #define GL_OP_LOG_BASE_2_EXT 0x8792 #define GL_OP_POWER_EXT 0x8793 #define GL_OP_RECIP_EXT 0x8794 #define GL_OP_RECIP_SQRT_EXT 0x8795 #define GL_OP_SUB_EXT 0x8796 #define GL_OP_CROSS_PRODUCT_EXT 0x8797 #define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 #define GL_OP_MOV_EXT 0x8799 #define GL_OUTPUT_VERTEX_EXT 0x879A #define GL_OUTPUT_COLOR0_EXT 0x879B #define GL_OUTPUT_COLOR1_EXT 0x879C #define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D #define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E #define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F #define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 #define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 #define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 #define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 #define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 #define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 #define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 #define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 #define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 #define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 #define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA #define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB #define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC #define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD #define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE #define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF #define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 #define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 #define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 #define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 #define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 #define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 #define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 #define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 #define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 #define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 #define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA #define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB #define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC #define GL_OUTPUT_FOG_EXT 0x87BD #define GL_SCALAR_EXT 0x87BE #define GL_VECTOR_EXT 0x87BF #define GL_MATRIX_EXT 0x87C0 #define GL_VARIANT_EXT 0x87C1 #define GL_INVARIANT_EXT 0x87C2 #define GL_LOCAL_CONSTANT_EXT 0x87C3 #define GL_LOCAL_EXT 0x87C4 #define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 #define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 #define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 #define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 #define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 #define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA #define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB #define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC #define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD #define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE #define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF #define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 #define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 #define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 #define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 #define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 #define GL_X_EXT 0x87D5 #define GL_Y_EXT 0x87D6 #define GL_Z_EXT 0x87D7 #define GL_W_EXT 0x87D8 #define GL_NEGATIVE_X_EXT 0x87D9 #define GL_NEGATIVE_Y_EXT 0x87DA #define GL_NEGATIVE_Z_EXT 0x87DB #define GL_NEGATIVE_W_EXT 0x87DC #define GL_ZERO_EXT 0x87DD #define GL_ONE_EXT 0x87DE #define GL_NEGATIVE_ONE_EXT 0x87DF #define GL_NORMALIZED_RANGE_EXT 0x87E0 #define GL_FULL_RANGE_EXT 0x87E1 #define GL_CURRENT_VERTEX_EXT 0x87E2 #define GL_MVP_MATRIX_EXT 0x87E3 #define GL_VARIANT_VALUE_EXT 0x87E4 #define GL_VARIANT_DATATYPE_EXT 0x87E5 #define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 #define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 #define GL_VARIANT_ARRAY_EXT 0x87E8 #define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 #define GL_INVARIANT_VALUE_EXT 0x87EA #define GL_INVARIANT_DATATYPE_EXT 0x87EB #define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC #define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED #endif #ifndef GL_ATI_vertex_streams #define GL_MAX_VERTEX_STREAMS_ATI 0x876B #define GL_VERTEX_STREAM0_ATI 0x876C #define GL_VERTEX_STREAM1_ATI 0x876D #define GL_VERTEX_STREAM2_ATI 0x876E #define GL_VERTEX_STREAM3_ATI 0x876F #define GL_VERTEX_STREAM4_ATI 0x8770 #define GL_VERTEX_STREAM5_ATI 0x8771 #define GL_VERTEX_STREAM6_ATI 0x8772 #define GL_VERTEX_STREAM7_ATI 0x8773 #define GL_VERTEX_SOURCE_ATI 0x8774 #endif #ifndef GL_ATI_element_array #define GL_ELEMENT_ARRAY_ATI 0x8768 #define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 #define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A #endif #ifndef GL_SUN_mesh_array #define GL_QUAD_MESH_SUN 0x8614 #define GL_TRIANGLE_MESH_SUN 0x8615 #endif #ifndef GL_SUN_slice_accum #define GL_SLICE_ACCUM_SUN 0x85CC #endif #ifndef GL_NV_multisample_filter_hint #define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 #endif #ifndef GL_NV_depth_clamp #define GL_DEPTH_CLAMP_NV 0x864F #endif #ifndef GL_NV_occlusion_query #define GL_PIXEL_COUNTER_BITS_NV 0x8864 #define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 #define GL_PIXEL_COUNT_NV 0x8866 #define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 #endif #ifndef GL_NV_point_sprite #define GL_POINT_SPRITE_NV 0x8861 #define GL_COORD_REPLACE_NV 0x8862 #define GL_POINT_SPRITE_R_MODE_NV 0x8863 #endif #ifndef GL_NV_texture_shader3 #define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 #define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 #define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 #define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 #define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 #define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 #define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 #define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 #define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 #define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 #define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A #define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B #define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C #define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D #define GL_HILO8_NV 0x885E #define GL_SIGNED_HILO8_NV 0x885F #define GL_FORCE_BLUE_TO_ONE_NV 0x8860 #endif #ifndef GL_NV_vertex_program1_1 #endif #ifndef GL_EXT_shadow_funcs #endif #ifndef GL_EXT_stencil_two_side #define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 #define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 #endif #ifndef GL_ATI_text_fragment_shader #define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 #endif #ifndef GL_APPLE_client_storage #define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 #endif #ifndef GL_APPLE_element_array #define GL_ELEMENT_ARRAY_APPLE 0x8768 #define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 #define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A #endif #ifndef GL_APPLE_fence #define GL_DRAW_PIXELS_APPLE 0x8A0A #define GL_FENCE_APPLE 0x8A0B #endif #ifndef GL_APPLE_vertex_array_object #define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 #endif #ifndef GL_APPLE_vertex_array_range #define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D #define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E #define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F #define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 #define GL_STORAGE_CACHED_APPLE 0x85BE #define GL_STORAGE_SHARED_APPLE 0x85BF #endif #ifndef GL_APPLE_ycbcr_422 #define GL_YCBCR_422_APPLE 0x85B9 #define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA #define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB #endif #ifndef GL_S3_s3tc #define GL_RGB_S3TC 0x83A0 #define GL_RGB4_S3TC 0x83A1 #define GL_RGBA_S3TC 0x83A2 #define GL_RGBA4_S3TC 0x83A3 #endif #ifndef GL_ATI_draw_buffers #define GL_MAX_DRAW_BUFFERS_ATI 0x8824 #define GL_DRAW_BUFFER0_ATI 0x8825 #define GL_DRAW_BUFFER1_ATI 0x8826 #define GL_DRAW_BUFFER2_ATI 0x8827 #define GL_DRAW_BUFFER3_ATI 0x8828 #define GL_DRAW_BUFFER4_ATI 0x8829 #define GL_DRAW_BUFFER5_ATI 0x882A #define GL_DRAW_BUFFER6_ATI 0x882B #define GL_DRAW_BUFFER7_ATI 0x882C #define GL_DRAW_BUFFER8_ATI 0x882D #define GL_DRAW_BUFFER9_ATI 0x882E #define GL_DRAW_BUFFER10_ATI 0x882F #define GL_DRAW_BUFFER11_ATI 0x8830 #define GL_DRAW_BUFFER12_ATI 0x8831 #define GL_DRAW_BUFFER13_ATI 0x8832 #define GL_DRAW_BUFFER14_ATI 0x8833 #define GL_DRAW_BUFFER15_ATI 0x8834 #endif #ifndef GL_ATI_pixel_format_float #define GL_TYPE_RGBA_FLOAT_ATI 0x8820 #define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 #endif #ifndef GL_ATI_texture_env_combine3 #define GL_MODULATE_ADD_ATI 0x8744 #define GL_MODULATE_SIGNED_ADD_ATI 0x8745 #define GL_MODULATE_SUBTRACT_ATI 0x8746 #endif #ifndef GL_ATI_texture_float #define GL_RGBA_FLOAT32_ATI 0x8814 #define GL_RGB_FLOAT32_ATI 0x8815 #define GL_ALPHA_FLOAT32_ATI 0x8816 #define GL_INTENSITY_FLOAT32_ATI 0x8817 #define GL_LUMINANCE_FLOAT32_ATI 0x8818 #define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 #define GL_RGBA_FLOAT16_ATI 0x881A #define GL_RGB_FLOAT16_ATI 0x881B #define GL_ALPHA_FLOAT16_ATI 0x881C #define GL_INTENSITY_FLOAT16_ATI 0x881D #define GL_LUMINANCE_FLOAT16_ATI 0x881E #define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F #endif #ifndef GL_NV_float_buffer #define GL_FLOAT_R_NV 0x8880 #define GL_FLOAT_RG_NV 0x8881 #define GL_FLOAT_RGB_NV 0x8882 #define GL_FLOAT_RGBA_NV 0x8883 #define GL_FLOAT_R16_NV 0x8884 #define GL_FLOAT_R32_NV 0x8885 #define GL_FLOAT_RG16_NV 0x8886 #define GL_FLOAT_RG32_NV 0x8887 #define GL_FLOAT_RGB16_NV 0x8888 #define GL_FLOAT_RGB32_NV 0x8889 #define GL_FLOAT_RGBA16_NV 0x888A #define GL_FLOAT_RGBA32_NV 0x888B #define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C #define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D #define GL_FLOAT_RGBA_MODE_NV 0x888E #endif #ifndef GL_NV_fragment_program #define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 #define GL_FRAGMENT_PROGRAM_NV 0x8870 #define GL_MAX_TEXTURE_COORDS_NV 0x8871 #define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 #define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 #define GL_PROGRAM_ERROR_STRING_NV 0x8874 #endif #ifndef GL_NV_half_float #define GL_HALF_FLOAT_NV 0x140B #endif #ifndef GL_NV_pixel_data_range #define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 #define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 #define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A #define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B #define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C #define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D #endif #ifndef GL_NV_primitive_restart #define GL_PRIMITIVE_RESTART_NV 0x8558 #define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 #endif #ifndef GL_NV_texture_expand_normal #define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F #endif #ifndef GL_NV_vertex_program2 #endif #ifndef GL_ATI_map_object_buffer #endif #ifndef GL_ATI_separate_stencil #define GL_STENCIL_BACK_FUNC_ATI 0x8800 #define GL_STENCIL_BACK_FAIL_ATI 0x8801 #define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 #define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 #endif #ifndef GL_ATI_vertex_attrib_array_object #endif #ifndef GL_OES_read_format #define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A #define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B #endif #ifndef GL_EXT_depth_bounds_test #define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 #define GL_DEPTH_BOUNDS_EXT 0x8891 #endif #ifndef GL_EXT_texture_mirror_clamp #define GL_MIRROR_CLAMP_EXT 0x8742 #define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 #define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 #endif #ifndef GL_EXT_blend_equation_separate #define GL_BLEND_EQUATION_RGB_EXT 0x8009 #define GL_BLEND_EQUATION_ALPHA_EXT 0x883D #endif #ifndef GL_MESA_pack_invert #define GL_PACK_INVERT_MESA 0x8758 #endif #ifndef GL_MESA_ycbcr_texture #define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA #define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB #define GL_YCBCR_MESA 0x8757 #endif #ifndef GL_EXT_pixel_buffer_object #define GL_PIXEL_PACK_BUFFER_EXT 0x88EB #define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED #define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF #endif #ifndef GL_NV_fragment_program_option #endif #ifndef GL_NV_fragment_program2 #define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 #define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 #define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 #define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 #define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 #endif #ifndef GL_NV_vertex_program2_option #endif #ifndef GL_NV_vertex_program3 #endif #ifndef GL_EXT_framebuffer_object #define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 #define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 #define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 #define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC #define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD #define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 #define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 #define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 #define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 #define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 #define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 #define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 #define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 #define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 #define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 #define GL_COLOR_ATTACHMENT10_EXT 0x8CEA #define GL_COLOR_ATTACHMENT11_EXT 0x8CEB #define GL_COLOR_ATTACHMENT12_EXT 0x8CEC #define GL_COLOR_ATTACHMENT13_EXT 0x8CED #define GL_COLOR_ATTACHMENT14_EXT 0x8CEE #define GL_COLOR_ATTACHMENT15_EXT 0x8CEF #define GL_DEPTH_ATTACHMENT_EXT 0x8D00 #define GL_STENCIL_ATTACHMENT_EXT 0x8D20 #define GL_FRAMEBUFFER_EXT 0x8D40 #define GL_RENDERBUFFER_EXT 0x8D41 #define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 #define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 #define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 #define GL_STENCIL_INDEX1_EXT 0x8D46 #define GL_STENCIL_INDEX4_EXT 0x8D47 #define GL_STENCIL_INDEX8_EXT 0x8D48 #define GL_STENCIL_INDEX16_EXT 0x8D49 #define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 #define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 #define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 #define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 #define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 #define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 #endif #ifndef GL_GREMEDY_string_marker #endif #ifndef GL_EXT_packed_depth_stencil #define GL_DEPTH_STENCIL_EXT 0x84F9 #define GL_UNSIGNED_INT_24_8_EXT 0x84FA #define GL_DEPTH24_STENCIL8_EXT 0x88F0 #define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 #endif #ifndef GL_EXT_stencil_clear_tag #define GL_STENCIL_TAG_BITS_EXT 0x88F2 #define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 #endif #ifndef GL_EXT_texture_sRGB #define GL_SRGB_EXT 0x8C40 #define GL_SRGB8_EXT 0x8C41 #define GL_SRGB_ALPHA_EXT 0x8C42 #define GL_SRGB8_ALPHA8_EXT 0x8C43 #define GL_SLUMINANCE_ALPHA_EXT 0x8C44 #define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 #define GL_SLUMINANCE_EXT 0x8C46 #define GL_SLUMINANCE8_EXT 0x8C47 #define GL_COMPRESSED_SRGB_EXT 0x8C48 #define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 #define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A #define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B #define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F #endif #ifndef GL_EXT_framebuffer_blit #define GL_READ_FRAMEBUFFER_EXT 0x8CA8 #define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 #define GL_DRAW_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING_EXT #define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA #endif #ifndef GL_EXT_framebuffer_multisample #define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 #define GL_MAX_SAMPLES_EXT 0x8D57 #endif #ifndef GL_MESAX_texture_stack #define GL_TEXTURE_1D_STACK_MESAX 0x8759 #define GL_TEXTURE_2D_STACK_MESAX 0x875A #define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B #define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C #define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D #define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E #endif #ifndef GL_EXT_timer_query #define GL_TIME_ELAPSED_EXT 0x88BF #endif #ifndef GL_EXT_gpu_program_parameters #endif #ifndef GL_APPLE_flush_buffer_range #define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 #define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 #endif #ifndef GL_NV_gpu_program4 #define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 #define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 #define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 #define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 #define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 #define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 #define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 #define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 #endif #ifndef GL_NV_geometry_program4 #define GL_LINES_ADJACENCY_EXT 0x000A #define GL_LINE_STRIP_ADJACENCY_EXT 0x000B #define GL_TRIANGLES_ADJACENCY_EXT 0x000C #define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D #define GL_GEOMETRY_PROGRAM_NV 0x8C26 #define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 #define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 #define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA #define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB #define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC #define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 #define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 #define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 #define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 #define GL_PROGRAM_POINT_SIZE_EXT 0x8642 #endif #ifndef GL_EXT_geometry_shader4 #define GL_GEOMETRY_SHADER_EXT 0x8DD9 #define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD #define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE #define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B #define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF #define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 #define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 #endif #ifndef GL_NV_vertex_program4 #define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD #endif #ifndef GL_EXT_gpu_shader4 #define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 #define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 #define GL_SAMPLER_BUFFER_EXT 0x8DC2 #define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 #define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 #define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 #define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 #define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 #define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 #define GL_INT_SAMPLER_1D_EXT 0x8DC9 #define GL_INT_SAMPLER_2D_EXT 0x8DCA #define GL_INT_SAMPLER_3D_EXT 0x8DCB #define GL_INT_SAMPLER_CUBE_EXT 0x8DCC #define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD #define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE #define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF #define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 #define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 #define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 #define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 #define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 #define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 #define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 #define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 #define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 #endif #ifndef GL_EXT_draw_instanced #endif #ifndef GL_EXT_packed_float #define GL_R11F_G11F_B10F_EXT 0x8C3A #define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B #define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C #endif #ifndef GL_EXT_texture_array #define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 #define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 #define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A #define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B #define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C #define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D #define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF #define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E #endif #ifndef GL_EXT_texture_buffer_object #define GL_TEXTURE_BUFFER_EXT 0x8C2A #define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B #define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C #define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D #define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E #endif #ifndef GL_EXT_texture_compression_latc #define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 #define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 #define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 #define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 #endif #ifndef GL_EXT_texture_compression_rgtc #define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB #define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC #define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD #define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE #endif #ifndef GL_EXT_texture_shared_exponent #define GL_RGB9_E5_EXT 0x8C3D #define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E #define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F #endif #ifndef GL_NV_depth_buffer_float #define GL_DEPTH_COMPONENT32F_NV 0x8DAB #define GL_DEPTH32F_STENCIL8_NV 0x8DAC #define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD #define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF #endif #ifndef GL_NV_fragment_program4 #endif #ifndef GL_NV_framebuffer_multisample_coverage #define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB #define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 #define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 #define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 #endif #ifndef GL_EXT_framebuffer_sRGB #define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 #define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA #endif #ifndef GL_NV_geometry_shader4 #endif #ifndef GL_NV_parameter_buffer_object #define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 #define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 #define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 #define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 #define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 #endif #ifndef GL_EXT_draw_buffers2 #endif #ifndef GL_NV_transform_feedback #define GL_BACK_PRIMARY_COLOR_NV 0x8C77 #define GL_BACK_SECONDARY_COLOR_NV 0x8C78 #define GL_TEXTURE_COORD_NV 0x8C79 #define GL_CLIP_DISTANCE_NV 0x8C7A #define GL_VERTEX_ID_NV 0x8C7B #define GL_PRIMITIVE_ID_NV 0x8C7C #define GL_GENERIC_ATTRIB_NV 0x8C7D #define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E #define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 #define GL_ACTIVE_VARYINGS_NV 0x8C81 #define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 #define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 #define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 #define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 #define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 #define GL_PRIMITIVES_GENERATED_NV 0x8C87 #define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 #define GL_RASTERIZER_DISCARD_NV 0x8C89 #define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV 0x8C8A #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B #define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C #define GL_SEPARATE_ATTRIBS_NV 0x8C8D #define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E #define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F #endif #ifndef GL_EXT_bindable_uniform #define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 #define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 #define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 #define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED #define GL_UNIFORM_BUFFER_EXT 0x8DEE #define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF #endif #ifndef GL_EXT_texture_integer #define GL_RGBA32UI_EXT 0x8D70 #define GL_RGB32UI_EXT 0x8D71 #define GL_ALPHA32UI_EXT 0x8D72 #define GL_INTENSITY32UI_EXT 0x8D73 #define GL_LUMINANCE32UI_EXT 0x8D74 #define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 #define GL_RGBA16UI_EXT 0x8D76 #define GL_RGB16UI_EXT 0x8D77 #define GL_ALPHA16UI_EXT 0x8D78 #define GL_INTENSITY16UI_EXT 0x8D79 #define GL_LUMINANCE16UI_EXT 0x8D7A #define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B #define GL_RGBA8UI_EXT 0x8D7C #define GL_RGB8UI_EXT 0x8D7D #define GL_ALPHA8UI_EXT 0x8D7E #define GL_INTENSITY8UI_EXT 0x8D7F #define GL_LUMINANCE8UI_EXT 0x8D80 #define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 #define GL_RGBA32I_EXT 0x8D82 #define GL_RGB32I_EXT 0x8D83 #define GL_ALPHA32I_EXT 0x8D84 #define GL_INTENSITY32I_EXT 0x8D85 #define GL_LUMINANCE32I_EXT 0x8D86 #define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 #define GL_RGBA16I_EXT 0x8D88 #define GL_RGB16I_EXT 0x8D89 #define GL_ALPHA16I_EXT 0x8D8A #define GL_INTENSITY16I_EXT 0x8D8B #define GL_LUMINANCE16I_EXT 0x8D8C #define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D #define GL_RGBA8I_EXT 0x8D8E #define GL_RGB8I_EXT 0x8D8F #define GL_ALPHA8I_EXT 0x8D90 #define GL_INTENSITY8I_EXT 0x8D91 #define GL_LUMINANCE8I_EXT 0x8D92 #define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 #define GL_RED_INTEGER_EXT 0x8D94 #define GL_GREEN_INTEGER_EXT 0x8D95 #define GL_BLUE_INTEGER_EXT 0x8D96 #define GL_ALPHA_INTEGER_EXT 0x8D97 #define GL_RGB_INTEGER_EXT 0x8D98 #define GL_RGBA_INTEGER_EXT 0x8D99 #define GL_BGR_INTEGER_EXT 0x8D9A #define GL_BGRA_INTEGER_EXT 0x8D9B #define GL_LUMINANCE_INTEGER_EXT 0x8D9C #define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D #define GL_RGBA_INTEGER_MODE_EXT 0x8D9E #endif #ifndef GL_GREMEDY_frame_terminator #endif #ifndef GL_NV_conditional_render #define GL_QUERY_WAIT_NV 0x8E13 #define GL_QUERY_NO_WAIT_NV 0x8E14 #define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 #define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 #endif #ifndef GL_NV_present_video #define GL_FRAME_NV 0x8E26 #define GL_FIELDS_NV 0x8E27 #define GL_CURRENT_TIME_NV 0x8E28 #define GL_NUM_FILL_STREAMS_NV 0x8E29 #define GL_PRESENT_TIME_NV 0x8E2A #define GL_PRESENT_DURATION_NV 0x8E2B #endif #ifndef GL_EXT_transform_feedback #define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E #define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84 #define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85 #define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F #define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C #define GL_SEPARATE_ATTRIBS_EXT 0x8C8D #define GL_PRIMITIVES_GENERATED_EXT 0x8C87 #define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88 #define GL_RASTERIZER_DISCARD_EXT 0x8C89 #define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80 #define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83 #define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F #define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76 #endif #ifndef GL_EXT_direct_state_access #define GL_PROGRAM_MATRIX_EXT 0x8E2D #define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E #define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F #endif #ifndef GL_EXT_vertex_array_bgra #endif #ifndef GL_EXT_texture_swizzle #define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 #define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 #define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 #define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45 #define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46 #endif #ifndef GL_NV_explicit_multisample #define GL_SAMPLE_POSITION_NV 0x8E50 #define GL_SAMPLE_MASK_NV 0x8E51 #define GL_SAMPLE_MASK_VALUE_NV 0x8E52 #define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53 #define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54 #define GL_TEXTURE_RENDERBUFFER_NV 0x8E55 #define GL_SAMPLER_RENDERBUFFER_NV 0x8E56 #define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57 #define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58 #define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59 #endif #ifndef GL_NV_transform_feedback2 #define GL_TRANSFORM_FEEDBACK_NV 0x8E22 #define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23 #define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24 #define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25 #endif #ifndef GL_ATI_meminfo #define GL_VBO_FREE_MEMORY_ATI 0x87FB #define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC #define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD #endif #ifndef GL_AMD_performance_monitor #define GL_COUNTER_TYPE_AMD 0x8BC0 #define GL_COUNTER_RANGE_AMD 0x8BC1 #define GL_UNSIGNED_INT64_AMD 0x8BC2 #define GL_PERCENTAGE_AMD 0x8BC3 #define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 #define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 #define GL_PERFMON_RESULT_AMD 0x8BC6 #endif #ifndef GL_AMD_texture_texture4 #endif #ifndef GL_AMD_vertex_shader_tesselator #define GL_SAMPLER_BUFFER_AMD 0x9001 #define GL_INT_SAMPLER_BUFFER_AMD 0x9002 #define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 #define GL_TESSELLATION_MODE_AMD 0x9004 #define GL_TESSELLATION_FACTOR_AMD 0x9005 #define GL_DISCRETE_AMD 0x9006 #define GL_CONTINUOUS_AMD 0x9007 #endif #ifndef GL_EXT_provoking_vertex #define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C #define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D #define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E #define GL_PROVOKING_VERTEX_EXT 0x8E4F #endif #ifndef GL_EXT_texture_snorm #define GL_ALPHA_SNORM 0x9010 #define GL_LUMINANCE_SNORM 0x9011 #define GL_LUMINANCE_ALPHA_SNORM 0x9012 #define GL_INTENSITY_SNORM 0x9013 #define GL_ALPHA8_SNORM 0x9014 #define GL_LUMINANCE8_SNORM 0x9015 #define GL_LUMINANCE8_ALPHA8_SNORM 0x9016 #define GL_INTENSITY8_SNORM 0x9017 #define GL_ALPHA16_SNORM 0x9018 #define GL_LUMINANCE16_SNORM 0x9019 #define GL_LUMINANCE16_ALPHA16_SNORM 0x901A #define GL_INTENSITY16_SNORM 0x901B #endif #ifndef GL_AMD_draw_buffers_blend #endif #ifndef GL_APPLE_texture_range #define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 #define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 #define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC #define GL_STORAGE_PRIVATE_APPLE 0x85BD #endif #ifndef GL_APPLE_float_pixels #define GL_HALF_APPLE 0x140B #define GL_RGBA_FLOAT32_APPLE 0x8814 #define GL_RGB_FLOAT32_APPLE 0x8815 #define GL_ALPHA_FLOAT32_APPLE 0x8816 #define GL_INTENSITY_FLOAT32_APPLE 0x8817 #define GL_LUMINANCE_FLOAT32_APPLE 0x8818 #define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 #define GL_RGBA_FLOAT16_APPLE 0x881A #define GL_RGB_FLOAT16_APPLE 0x881B #define GL_ALPHA_FLOAT16_APPLE 0x881C #define GL_INTENSITY_FLOAT16_APPLE 0x881D #define GL_LUMINANCE_FLOAT16_APPLE 0x881E #define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F #define GL_COLOR_FLOAT_APPLE 0x8A0F #endif #ifndef GL_APPLE_vertex_program_evaluators #define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00 #define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01 #define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02 #define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03 #define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04 #define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05 #define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06 #define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07 #define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08 #define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09 #endif #ifndef GL_APPLE_aux_depth_stencil #define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14 #endif #ifndef GL_APPLE_object_purgeable #define GL_BUFFER_OBJECT_APPLE 0x85B3 #define GL_RELEASED_APPLE 0x8A19 #define GL_VOLATILE_APPLE 0x8A1A #define GL_RETAINED_APPLE 0x8A1B #define GL_UNDEFINED_APPLE 0x8A1C #define GL_PURGEABLE_APPLE 0x8A1D #endif #ifndef GL_APPLE_row_bytes #define GL_PACK_ROW_BYTES_APPLE 0x8A15 #define GL_UNPACK_ROW_BYTES_APPLE 0x8A16 #endif #ifndef GL_APPLE_rgb_422 #define GL_RGB_422_APPLE 0x8A1F #endif #ifndef GL_NV_video_capture #define GL_VIDEO_BUFFER_NV 0x9020 #define GL_VIDEO_BUFFER_BINDING_NV 0x9021 #define GL_FIELD_UPPER_NV 0x9022 #define GL_FIELD_LOWER_NV 0x9023 #define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024 #define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025 #define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026 #define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027 #define GL_VIDEO_BUFFER_PITCH_NV 0x9028 #define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029 #define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A #define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B #define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C #define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D #define GL_PARTIAL_SUCCESS_NV 0x902E #define GL_SUCCESS_NV 0x902F #define GL_FAILURE_NV 0x9030 #define GL_YCBYCR8_422_NV 0x9031 #define GL_YCBAYCR8A_4224_NV 0x9032 #define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033 #define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034 #define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035 #define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036 #define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037 #define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038 #define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039 #define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A #define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B #define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C #endif #ifndef GL_NV_copy_image #endif #ifndef GL_EXT_separate_shader_objects #define GL_ACTIVE_PROGRAM_EXT 0x8B8D #endif #ifndef GL_NV_parameter_buffer_object2 #endif #ifndef GL_NV_shader_buffer_load #define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D #define GL_GPU_ADDRESS_NV 0x8F34 #define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35 #endif #ifndef GL_NV_vertex_buffer_unified_memory #define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E #define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F #define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20 #define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21 #define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22 #define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23 #define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24 #define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25 #define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26 #define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27 #define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28 #define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29 #define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A #define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B #define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C #define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D #define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E #define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F #define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30 #define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31 #define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32 #define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33 #endif #ifndef GL_NV_texture_barrier #endif #ifndef GL_VERSION_2_0 typedef char GLchar; #endif #ifndef GL_VERSION_1_5 typedef ptrdiff_t GLintptr; typedef ptrdiff_t GLsizeiptr; #endif #ifndef GL_ARB_vertex_buffer_object typedef ptrdiff_t GLintptrARB; typedef ptrdiff_t GLsizeiptrARB; #endif #ifndef GL_ARB_shader_objects typedef char GLcharARB; typedef unsigned int GLhandleARB; #endif #ifndef GL_ARB_half_float_pixel typedef unsigned short GLhalfARB; #endif #ifndef GL_NV_half_float typedef unsigned short GLhalfNV; #endif #ifndef GLEXT_64_TYPES_DEFINED /* This code block is duplicated in glxext.h, so must be protected */ #define GLEXT_64_TYPES_DEFINED /* Define int32_t, int64_t, and uint64_t types for UST/MSC */ /* (as used in the GL_EXT_timer_query extension). */ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #include <inttypes.h> #elif defined(__sun__) || defined(__digital__) #include <inttypes.h> #if defined(__STDC__) #if defined(__arch64__) || defined(_LP64) typedef long int int64_t; typedef unsigned long int uint64_t; #else typedef long long int int64_t; typedef unsigned long long int uint64_t; #endif /* __arch64__ */ #endif /* __STDC__ */ #elif defined( __VMS ) || defined(__sgi) #include <inttypes.h> #elif defined(__SCO__) || defined(__USLC__) #include <stdint.h> #elif defined(__UNIXOS2__) || defined(__SOL64__) typedef long int int32_t; typedef long long int int64_t; typedef unsigned long long int uint64_t; #elif defined(_WIN32) && defined(__GNUC__) #include <stdint.h> #elif defined(_WIN32) typedef __int32 int32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #else /* Fallback if nothing above works */ #include <inttypes.h> #endif #endif #ifndef GL_EXT_timer_query typedef int64_t GLint64EXT; typedef uint64_t GLuint64EXT; #endif #ifndef ARB_sync typedef int64_t GLint64; typedef uint64_t GLuint64; typedef struct __GLsync *GLsync; #endif #ifndef GL_VERSION_1_2 #define GL_VERSION_1_2 1 #ifndef glBlendColor #define glBlendColor SAGE_glBlendColor #endif #ifndef glBlendEquation #define glBlendEquation SAGE_glBlendEquation #endif #ifndef glDrawRangeElements #define glDrawRangeElements SAGE_glDrawRangeElements #endif #ifndef glTexImage3D #define glTexImage3D SAGE_glTexImage3D #endif #ifndef glTexSubImage3D #define glTexSubImage3D SAGE_glTexSubImage3D #endif #ifndef glCopyTexSubImage3D #define glCopyTexSubImage3D SAGE_glCopyTexSubImage3D #endif #endif #ifndef GL_VERSION_1_2_DEPRECATED #define GL_VERSION_1_2_DEPRECATED 1 #ifndef glColorTable #define glColorTable SAGE_glColorTable #endif #ifndef glColorTableParameterfv #define glColorTableParameterfv SAGE_glColorTableParameterfv #endif #ifndef glColorTableParameteriv #define glColorTableParameteriv SAGE_glColorTableParameteriv #endif #ifndef glCopyColorTable #define glCopyColorTable SAGE_glCopyColorTable #endif #ifndef glGetColorTable #define glGetColorTable SAGE_glGetColorTable #endif #ifndef glGetColorTableParameterfv #define glGetColorTableParameterfv SAGE_glGetColorTableParameterfv #endif #ifndef glGetColorTableParameteriv #define glGetColorTableParameteriv SAGE_glGetColorTableParameteriv #endif #ifndef glColorSubTable #define glColorSubTable SAGE_glColorSubTable #endif #ifndef glCopyColorSubTable #define glCopyColorSubTable SAGE_glCopyColorSubTable #endif #ifndef glConvolutionFilter1D #define glConvolutionFilter1D SAGE_glConvolutionFilter1D #endif #ifndef glConvolutionFilter2D #define glConvolutionFilter2D SAGE_glConvolutionFilter2D #endif #ifndef glConvolutionParameterf #define glConvolutionParameterf SAGE_glConvolutionParameterf #endif #ifndef glConvolutionParameterfv #define glConvolutionParameterfv SAGE_glConvolutionParameterfv #endif #ifndef glConvolutionParameteri #define glConvolutionParameteri SAGE_glConvolutionParameteri #endif #ifndef glConvolutionParameteriv #define glConvolutionParameteriv SAGE_glConvolutionParameteriv #endif #ifndef glCopyConvolutionFilter1D #define glCopyConvolutionFilter1D SAGE_glCopyConvolutionFilter1D #endif #ifndef glCopyConvolutionFilter2D #define glCopyConvolutionFilter2D SAGE_glCopyConvolutionFilter2D #endif #ifndef glGetConvolutionFilter #define glGetConvolutionFilter SAGE_glGetConvolutionFilter #endif #ifndef glGetConvolutionParameterfv #define glGetConvolutionParameterfv SAGE_glGetConvolutionParameterfv #endif #ifndef glGetConvolutionParameteriv #define glGetConvolutionParameteriv SAGE_glGetConvolutionParameteriv #endif #ifndef glGetSeparableFilter #define glGetSeparableFilter SAGE_glGetSeparableFilter #endif #ifndef glSeparableFilter2D #define glSeparableFilter2D SAGE_glSeparableFilter2D #endif #ifndef glGetHistogram #define glGetHistogram SAGE_glGetHistogram #endif #ifndef glGetHistogramParameterfv #define glGetHistogramParameterfv SAGE_glGetHistogramParameterfv #endif #ifndef glGetHistogramParameteriv #define glGetHistogramParameteriv SAGE_glGetHistogramParameteriv #endif #ifndef glGetMinmax #define glGetMinmax SAGE_glGetMinmax #endif #ifndef glGetMinmaxParameterfv #define glGetMinmaxParameterfv SAGE_glGetMinmaxParameterfv #endif #ifndef glGetMinmaxParameteriv #define glGetMinmaxParameteriv SAGE_glGetMinmaxParameteriv #endif #ifndef glHistogram #define glHistogram SAGE_glHistogram #endif #ifndef glMinmax #define glMinmax SAGE_glMinmax #endif #ifndef glResetHistogram #define glResetHistogram SAGE_glResetHistogram #endif #ifndef glResetMinmax #define glResetMinmax SAGE_glResetMinmax #endif #endif #ifndef GL_VERSION_1_3 #define GL_VERSION_1_3 1 #ifndef glActiveTexture #define glActiveTexture SAGE_glActiveTexture #endif #ifndef glSampleCoverage #define glSampleCoverage SAGE_glSampleCoverage #endif #ifndef glCompressedTexImage3D #define glCompressedTexImage3D SAGE_glCompressedTexImage3D #endif #ifndef glCompressedTexImage2D #define glCompressedTexImage2D SAGE_glCompressedTexImage2D #endif #ifndef glCompressedTexImage1D #define glCompressedTexImage1D SAGE_glCompressedTexImage1D #endif #ifndef glCompressedTexSubImage3D #define glCompressedTexSubImage3D SAGE_glCompressedTexSubImage3D #endif #ifndef glCompressedTexSubImage2D #define glCompressedTexSubImage2D SAGE_glCompressedTexSubImage2D #endif #ifndef glCompressedTexSubImage1D #define glCompressedTexSubImage1D SAGE_glCompressedTexSubImage1D #endif #ifndef glGetCompressedTexImage #define glGetCompressedTexImage SAGE_glGetCompressedTexImage #endif #endif #ifndef GL_VERSION_1_3_DEPRECATED #define GL_VERSION_1_3_DEPRECATED 1 #ifndef glClientActiveTexture #define glClientActiveTexture SAGE_glClientActiveTexture #endif #ifndef glMultiTexCoord1d #define glMultiTexCoord1d SAGE_glMultiTexCoord1d #endif #ifndef glMultiTexCoord1dv #define glMultiTexCoord1dv SAGE_glMultiTexCoord1dv #endif #ifndef glMultiTexCoord1f #define glMultiTexCoord1f SAGE_glMultiTexCoord1f #endif #ifndef glMultiTexCoord1fv #define glMultiTexCoord1fv SAGE_glMultiTexCoord1fv #endif #ifndef glMultiTexCoord1i #define glMultiTexCoord1i SAGE_glMultiTexCoord1i #endif #ifndef glMultiTexCoord1iv #define glMultiTexCoord1iv SAGE_glMultiTexCoord1iv #endif #ifndef glMultiTexCoord1s #define glMultiTexCoord1s SAGE_glMultiTexCoord1s #endif #ifndef glMultiTexCoord1sv #define glMultiTexCoord1sv SAGE_glMultiTexCoord1sv #endif #ifndef glMultiTexCoord2d #define glMultiTexCoord2d SAGE_glMultiTexCoord2d #endif #ifndef glMultiTexCoord2dv #define glMultiTexCoord2dv SAGE_glMultiTexCoord2dv #endif #ifndef glMultiTexCoord2f #define glMultiTexCoord2f SAGE_glMultiTexCoord2f #endif #ifndef glMultiTexCoord2fv #define glMultiTexCoord2fv SAGE_glMultiTexCoord2fv #endif #ifndef glMultiTexCoord2i #define glMultiTexCoord2i SAGE_glMultiTexCoord2i #endif #ifndef glMultiTexCoord2iv #define glMultiTexCoord2iv SAGE_glMultiTexCoord2iv #endif #ifndef glMultiTexCoord2s #define glMultiTexCoord2s SAGE_glMultiTexCoord2s #endif #ifndef glMultiTexCoord2sv #define glMultiTexCoord2sv SAGE_glMultiTexCoord2sv #endif #ifndef glMultiTexCoord3d #define glMultiTexCoord3d SAGE_glMultiTexCoord3d #endif #ifndef glMultiTexCoord3dv #define glMultiTexCoord3dv SAGE_glMultiTexCoord3dv #endif #ifndef glMultiTexCoord3f #define glMultiTexCoord3f SAGE_glMultiTexCoord3f #endif #ifndef glMultiTexCoord3fv #define glMultiTexCoord3fv SAGE_glMultiTexCoord3fv #endif #ifndef glMultiTexCoord3i #define glMultiTexCoord3i SAGE_glMultiTexCoord3i #endif #ifndef glMultiTexCoord3iv #define glMultiTexCoord3iv SAGE_glMultiTexCoord3iv #endif #ifndef glMultiTexCoord3s #define glMultiTexCoord3s SAGE_glMultiTexCoord3s #endif #ifndef glMultiTexCoord3sv #define glMultiTexCoord3sv SAGE_glMultiTexCoord3sv #endif #ifndef glMultiTexCoord4d #define glMultiTexCoord4d SAGE_glMultiTexCoord4d #endif #ifndef glMultiTexCoord4dv #define glMultiTexCoord4dv SAGE_glMultiTexCoord4dv #endif #ifndef glMultiTexCoord4f #define glMultiTexCoord4f SAGE_glMultiTexCoord4f #endif #ifndef glMultiTexCoord4fv #define glMultiTexCoord4fv SAGE_glMultiTexCoord4fv #endif #ifndef glMultiTexCoord4i #define glMultiTexCoord4i SAGE_glMultiTexCoord4i #endif #ifndef glMultiTexCoord4iv #define glMultiTexCoord4iv SAGE_glMultiTexCoord4iv #endif #ifndef glMultiTexCoord4s #define glMultiTexCoord4s SAGE_glMultiTexCoord4s #endif #ifndef glMultiTexCoord4sv #define glMultiTexCoord4sv SAGE_glMultiTexCoord4sv #endif #ifndef glLoadTransposeMatrixf #define glLoadTransposeMatrixf SAGE_glLoadTransposeMatrixf #endif #ifndef glLoadTransposeMatrixd #define glLoadTransposeMatrixd SAGE_glLoadTransposeMatrixd #endif #ifndef glMultTransposeMatrixf #define glMultTransposeMatrixf SAGE_glMultTransposeMatrixf #endif #ifndef glMultTransposeMatrixd #define glMultTransposeMatrixd SAGE_glMultTransposeMatrixd #endif #endif #ifndef GL_VERSION_1_4 #define GL_VERSION_1_4 1 #ifndef glBlendFuncSeparate #define glBlendFuncSeparate SAGE_glBlendFuncSeparate #endif #ifndef glMultiDrawArrays #define glMultiDrawArrays SAGE_glMultiDrawArrays #endif #ifndef glMultiDrawElements #define glMultiDrawElements SAGE_glMultiDrawElements #endif #ifndef glPointParameterf #define glPointParameterf SAGE_glPointParameterf #endif #ifndef glPointParameterfv #define glPointParameterfv SAGE_glPointParameterfv #endif #ifndef glPointParameteri #define glPointParameteri SAGE_glPointParameteri #endif #ifndef glPointParameteriv #define glPointParameteriv SAGE_glPointParameteriv #endif #endif #ifndef GL_VERSION_1_4_DEPRECATED #define GL_VERSION_1_4_DEPRECATED 1 #ifndef glFogCoordf #define glFogCoordf SAGE_glFogCoordf #endif #ifndef glFogCoordfv #define glFogCoordfv SAGE_glFogCoordfv #endif #ifndef glFogCoordd #define glFogCoordd SAGE_glFogCoordd #endif #ifndef glFogCoorddv #define glFogCoorddv SAGE_glFogCoorddv #endif #ifndef glFogCoordPointer #define glFogCoordPointer SAGE_glFogCoordPointer #endif #ifndef glSecondaryColor3b #define glSecondaryColor3b SAGE_glSecondaryColor3b #endif #ifndef glSecondaryColor3bv #define glSecondaryColor3bv SAGE_glSecondaryColor3bv #endif #ifndef glSecondaryColor3d #define glSecondaryColor3d SAGE_glSecondaryColor3d #endif #ifndef glSecondaryColor3dv #define glSecondaryColor3dv SAGE_glSecondaryColor3dv #endif #ifndef glSecondaryColor3f #define glSecondaryColor3f SAGE_glSecondaryColor3f #endif #ifndef glSecondaryColor3fv #define glSecondaryColor3fv SAGE_glSecondaryColor3fv #endif #ifndef glSecondaryColor3i #define glSecondaryColor3i SAGE_glSecondaryColor3i #endif #ifndef glSecondaryColor3iv #define glSecondaryColor3iv SAGE_glSecondaryColor3iv #endif #ifndef glSecondaryColor3s #define glSecondaryColor3s SAGE_glSecondaryColor3s #endif #ifndef glSecondaryColor3sv #define glSecondaryColor3sv SAGE_glSecondaryColor3sv #endif #ifndef glSecondaryColor3ub #define glSecondaryColor3ub SAGE_glSecondaryColor3ub #endif #ifndef glSecondaryColor3ubv #define glSecondaryColor3ubv SAGE_glSecondaryColor3ubv #endif #ifndef glSecondaryColor3ui #define glSecondaryColor3ui SAGE_glSecondaryColor3ui #endif #ifndef glSecondaryColor3uiv #define glSecondaryColor3uiv SAGE_glSecondaryColor3uiv #endif #ifndef glSecondaryColor3us #define glSecondaryColor3us SAGE_glSecondaryColor3us #endif #ifndef glSecondaryColor3usv #define glSecondaryColor3usv SAGE_glSecondaryColor3usv #endif #ifndef glSecondaryColorPointer #define glSecondaryColorPointer SAGE_glSecondaryColorPointer #endif #ifndef glWindowPos2d #define glWindowPos2d SAGE_glWindowPos2d #endif #ifndef glWindowPos2dv #define glWindowPos2dv SAGE_glWindowPos2dv #endif #ifndef glWindowPos2f #define glWindowPos2f SAGE_glWindowPos2f #endif #ifndef glWindowPos2fv #define glWindowPos2fv SAGE_glWindowPos2fv #endif #ifndef glWindowPos2i #define glWindowPos2i SAGE_glWindowPos2i #endif #ifndef glWindowPos2iv #define glWindowPos2iv SAGE_glWindowPos2iv #endif #ifndef glWindowPos2s #define glWindowPos2s SAGE_glWindowPos2s #endif #ifndef glWindowPos2sv #define glWindowPos2sv SAGE_glWindowPos2sv #endif #ifndef glWindowPos3d #define glWindowPos3d SAGE_glWindowPos3d #endif #ifndef glWindowPos3dv #define glWindowPos3dv SAGE_glWindowPos3dv #endif #ifndef glWindowPos3f #define glWindowPos3f SAGE_glWindowPos3f #endif #ifndef glWindowPos3fv #define glWindowPos3fv SAGE_glWindowPos3fv #endif #ifndef glWindowPos3i #define glWindowPos3i SAGE_glWindowPos3i #endif #ifndef glWindowPos3iv #define glWindowPos3iv SAGE_glWindowPos3iv #endif #ifndef glWindowPos3s #define glWindowPos3s SAGE_glWindowPos3s #endif #ifndef glWindowPos3sv #define glWindowPos3sv SAGE_glWindowPos3sv #endif #endif #ifndef GL_VERSION_1_5 #define GL_VERSION_1_5 1 #ifndef glGenQueries #define glGenQueries SAGE_glGenQueries #endif #ifndef glDeleteQueries #define glDeleteQueries SAGE_glDeleteQueries #endif #ifndef glIsQuery #define glIsQuery SAGE_glIsQuery #endif #ifndef glBeginQuery #define glBeginQuery SAGE_glBeginQuery #endif #ifndef glEndQuery #define glEndQuery SAGE_glEndQuery #endif #ifndef glGetQueryiv #define glGetQueryiv SAGE_glGetQueryiv #endif #ifndef glGetQueryObjectiv #define glGetQueryObjectiv SAGE_glGetQueryObjectiv #endif #ifndef glGetQueryObjectuiv #define glGetQueryObjectuiv SAGE_glGetQueryObjectuiv #endif #ifndef glBindBuffer #define glBindBuffer SAGE_glBindBuffer #endif #ifndef glDeleteBuffers #define glDeleteBuffers SAGE_glDeleteBuffers #endif #ifndef glGenBuffers #define glGenBuffers SAGE_glGenBuffers #endif #ifndef glIsBuffer #define glIsBuffer SAGE_glIsBuffer #endif #ifndef glBufferData #define glBufferData SAGE_glBufferData #endif #ifndef glBufferSubData #define glBufferSubData SAGE_glBufferSubData #endif #ifndef glGetBufferSubData #define glGetBufferSubData SAGE_glGetBufferSubData #endif #ifndef glMapBuffer #define glMapBuffer SAGE_glMapBuffer #endif #ifndef glUnmapBuffer #define glUnmapBuffer SAGE_glUnmapBuffer #endif #ifndef glGetBufferParameteriv #define glGetBufferParameteriv SAGE_glGetBufferParameteriv #endif #ifndef glGetBufferPointerv #define glGetBufferPointerv SAGE_glGetBufferPointerv #endif #endif #ifndef GL_VERSION_2_0 #define GL_VERSION_2_0 1 #ifndef glBlendEquationSeparate #define glBlendEquationSeparate SAGE_glBlendEquationSeparate #endif #ifndef glDrawBuffers #define glDrawBuffers SAGE_glDrawBuffers #endif #ifndef glStencilOpSeparate #define glStencilOpSeparate SAGE_glStencilOpSeparate #endif #ifndef glStencilFuncSeparate #define glStencilFuncSeparate SAGE_glStencilFuncSeparate #endif #ifndef glStencilMaskSeparate #define glStencilMaskSeparate SAGE_glStencilMaskSeparate #endif #ifndef glAttachShader #define glAttachShader SAGE_glAttachShader #endif #ifndef glBindAttribLocation #define glBindAttribLocation SAGE_glBindAttribLocation #endif #ifndef glCompileShader #define glCompileShader SAGE_glCompileShader #endif #ifndef glCreateProgram #define glCreateProgram SAGE_glCreateProgram #endif #ifndef glCreateShader #define glCreateShader SAGE_glCreateShader #endif #ifndef glDeleteProgram #define glDeleteProgram SAGE_glDeleteProgram #endif #ifndef glDeleteShader #define glDeleteShader SAGE_glDeleteShader #endif #ifndef glDetachShader #define glDetachShader SAGE_glDetachShader #endif #ifndef glDisableVertexAttribArray #define glDisableVertexAttribArray SAGE_glDisableVertexAttribArray #endif #ifndef glEnableVertexAttribArray #define glEnableVertexAttribArray SAGE_glEnableVertexAttribArray #endif #ifndef glGetActiveAttrib #define glGetActiveAttrib SAGE_glGetActiveAttrib #endif #ifndef glGetActiveUniform #define glGetActiveUniform SAGE_glGetActiveUniform #endif #ifndef glGetAttachedShaders #define glGetAttachedShaders SAGE_glGetAttachedShaders #endif #ifndef glGetAttribLocation #define glGetAttribLocation SAGE_glGetAttribLocation #endif #ifndef glGetProgramiv #define glGetProgramiv SAGE_glGetProgramiv #endif #ifndef glGetProgramInfoLog #define glGetProgramInfoLog SAGE_glGetProgramInfoLog #endif #ifndef glGetShaderiv #define glGetShaderiv SAGE_glGetShaderiv #endif #ifndef glGetShaderInfoLog #define glGetShaderInfoLog SAGE_glGetShaderInfoLog #endif #ifndef glGetShaderSource #define glGetShaderSource SAGE_glGetShaderSource #endif #ifndef glGetUniformLocation #define glGetUniformLocation SAGE_glGetUniformLocation #endif #ifndef glGetUniformfv #define glGetUniformfv SAGE_glGetUniformfv #endif #ifndef glGetUniformiv #define glGetUniformiv SAGE_glGetUniformiv #endif #ifndef glGetVertexAttribdv #define glGetVertexAttribdv SAGE_glGetVertexAttribdv #endif #ifndef glGetVertexAttribfv #define glGetVertexAttribfv SAGE_glGetVertexAttribfv #endif #ifndef glGetVertexAttribiv #define glGetVertexAttribiv SAGE_glGetVertexAttribiv #endif #ifndef glGetVertexAttribPointerv #define glGetVertexAttribPointerv SAGE_glGetVertexAttribPointerv #endif #ifndef glIsProgram #define glIsProgram SAGE_glIsProgram #endif #ifndef glIsShader #define glIsShader SAGE_glIsShader #endif #ifndef glLinkProgram #define glLinkProgram SAGE_glLinkProgram #endif #ifndef glShaderSource #define glShaderSource SAGE_glShaderSource #endif #ifndef glUseProgram #define glUseProgram SAGE_glUseProgram #endif #ifndef glUniform1f #define glUniform1f SAGE_glUniform1f #endif #ifndef glUniform2f #define glUniform2f SAGE_glUniform2f #endif #ifndef glUniform3f #define glUniform3f SAGE_glUniform3f #endif #ifndef glUniform4f #define glUniform4f SAGE_glUniform4f #endif #ifndef glUniform1i #define glUniform1i SAGE_glUniform1i #endif #ifndef glUniform2i #define glUniform2i SAGE_glUniform2i #endif #ifndef glUniform3i #define glUniform3i SAGE_glUniform3i #endif #ifndef glUniform4i #define glUniform4i SAGE_glUniform4i #endif #ifndef glUniform1fv #define glUniform1fv SAGE_glUniform1fv #endif #ifndef glUniform2fv #define glUniform2fv SAGE_glUniform2fv #endif #ifndef glUniform3fv #define glUniform3fv SAGE_glUniform3fv #endif #ifndef glUniform4fv #define glUniform4fv SAGE_glUniform4fv #endif #ifndef glUniform1iv #define glUniform1iv SAGE_glUniform1iv #endif #ifndef glUniform2iv #define glUniform2iv SAGE_glUniform2iv #endif #ifndef glUniform3iv #define glUniform3iv SAGE_glUniform3iv #endif #ifndef glUniform4iv #define glUniform4iv SAGE_glUniform4iv #endif #ifndef glUniformMatrix2fv #define glUniformMatrix2fv SAGE_glUniformMatrix2fv #endif #ifndef glUniformMatrix3fv #define glUniformMatrix3fv SAGE_glUniformMatrix3fv #endif #ifndef glUniformMatrix4fv #define glUniformMatrix4fv SAGE_glUniformMatrix4fv #endif #ifndef glValidateProgram #define glValidateProgram SAGE_glValidateProgram #endif #ifndef glVertexAttrib1d #define glVertexAttrib1d SAGE_glVertexAttrib1d #endif #ifndef glVertexAttrib1dv #define glVertexAttrib1dv SAGE_glVertexAttrib1dv #endif #ifndef glVertexAttrib1f #define glVertexAttrib1f SAGE_glVertexAttrib1f #endif #ifndef glVertexAttrib1fv #define glVertexAttrib1fv SAGE_glVertexAttrib1fv #endif #ifndef glVertexAttrib1s #define glVertexAttrib1s SAGE_glVertexAttrib1s #endif #ifndef glVertexAttrib1sv #define glVertexAttrib1sv SAGE_glVertexAttrib1sv #endif #ifndef glVertexAttrib2d #define glVertexAttrib2d SAGE_glVertexAttrib2d #endif #ifndef glVertexAttrib2dv #define glVertexAttrib2dv SAGE_glVertexAttrib2dv #endif #ifndef glVertexAttrib2f #define glVertexAttrib2f SAGE_glVertexAttrib2f #endif #ifndef glVertexAttrib2fv #define glVertexAttrib2fv SAGE_glVertexAttrib2fv #endif #ifndef glVertexAttrib2s #define glVertexAttrib2s SAGE_glVertexAttrib2s #endif #ifndef glVertexAttrib2sv #define glVertexAttrib2sv SAGE_glVertexAttrib2sv #endif #ifndef glVertexAttrib3d #define glVertexAttrib3d SAGE_glVertexAttrib3d #endif #ifndef glVertexAttrib3dv #define glVertexAttrib3dv SAGE_glVertexAttrib3dv #endif #ifndef glVertexAttrib3f #define glVertexAttrib3f SAGE_glVertexAttrib3f #endif #ifndef glVertexAttrib3fv #define glVertexAttrib3fv SAGE_glVertexAttrib3fv #endif #ifndef glVertexAttrib3s #define glVertexAttrib3s SAGE_glVertexAttrib3s #endif #ifndef glVertexAttrib3sv #define glVertexAttrib3sv SAGE_glVertexAttrib3sv #endif #ifndef glVertexAttrib4Nbv #define glVertexAttrib4Nbv SAGE_glVertexAttrib4Nbv #endif #ifndef glVertexAttrib4Niv #define glVertexAttrib4Niv SAGE_glVertexAttrib4Niv #endif #ifndef glVertexAttrib4Nsv #define glVertexAttrib4Nsv SAGE_glVertexAttrib4Nsv #endif #ifndef glVertexAttrib4Nub #define glVertexAttrib4Nub SAGE_glVertexAttrib4Nub #endif #ifndef glVertexAttrib4Nubv #define glVertexAttrib4Nubv SAGE_glVertexAttrib4Nubv #endif #ifndef glVertexAttrib4Nuiv #define glVertexAttrib4Nuiv SAGE_glVertexAttrib4Nuiv #endif #ifndef glVertexAttrib4Nusv #define glVertexAttrib4Nusv SAGE_glVertexAttrib4Nusv #endif #ifndef glVertexAttrib4bv #define glVertexAttrib4bv SAGE_glVertexAttrib4bv #endif #ifndef glVertexAttrib4d #define glVertexAttrib4d SAGE_glVertexAttrib4d #endif #ifndef glVertexAttrib4dv #define glVertexAttrib4dv SAGE_glVertexAttrib4dv #endif #ifndef glVertexAttrib4f #define glVertexAttrib4f SAGE_glVertexAttrib4f #endif #ifndef glVertexAttrib4fv #define glVertexAttrib4fv SAGE_glVertexAttrib4fv #endif #ifndef glVertexAttrib4iv #define glVertexAttrib4iv SAGE_glVertexAttrib4iv #endif #ifndef glVertexAttrib4s #define glVertexAttrib4s SAGE_glVertexAttrib4s #endif #ifndef glVertexAttrib4sv #define glVertexAttrib4sv SAGE_glVertexAttrib4sv #endif #ifndef glVertexAttrib4ubv #define glVertexAttrib4ubv SAGE_glVertexAttrib4ubv #endif #ifndef glVertexAttrib4uiv #define glVertexAttrib4uiv SAGE_glVertexAttrib4uiv #endif #ifndef glVertexAttrib4usv #define glVertexAttrib4usv SAGE_glVertexAttrib4usv #endif #ifndef glVertexAttribPointer #define glVertexAttribPointer SAGE_glVertexAttribPointer #endif #endif #ifndef GL_VERSION_2_1 #define GL_VERSION_2_1 1 #ifndef glUniformMatrix2x3fv #define glUniformMatrix2x3fv SAGE_glUniformMatrix2x3fv #endif #ifndef glUniformMatrix3x2fv #define glUniformMatrix3x2fv SAGE_glUniformMatrix3x2fv #endif #ifndef glUniformMatrix2x4fv #define glUniformMatrix2x4fv SAGE_glUniformMatrix2x4fv #endif #ifndef glUniformMatrix4x2fv #define glUniformMatrix4x2fv SAGE_glUniformMatrix4x2fv #endif #ifndef glUniformMatrix3x4fv #define glUniformMatrix3x4fv SAGE_glUniformMatrix3x4fv #endif #ifndef glUniformMatrix4x3fv #define glUniformMatrix4x3fv SAGE_glUniformMatrix4x3fv #endif #endif #ifndef GL_VERSION_3_0 #define GL_VERSION_3_0 1 #ifndef glColorMaski #define glColorMaski SAGE_glColorMaski #endif #ifndef glEnablei #define glEnablei SAGE_glEnablei #endif #ifndef glDisablei #define glDisablei SAGE_glDisablei #endif #ifndef glIsEnabledi #define glIsEnabledi SAGE_glIsEnabledi #endif #ifndef glBeginTransformFeedback #define glBeginTransformFeedback SAGE_glBeginTransformFeedback #endif #ifndef glEndTransformFeedback #define glEndTransformFeedback SAGE_glEndTransformFeedback #endif #ifndef glBindBufferRange #define glBindBufferRange SAGE_glBindBufferRange #endif #ifndef glBindBufferBase #define glBindBufferBase SAGE_glBindBufferBase #endif #ifndef glTransformFeedbackVaryings #define glTransformFeedbackVaryings SAGE_glTransformFeedbackVaryings #endif #ifndef glGetTransformFeedbackVarying #define glGetTransformFeedbackVarying SAGE_glGetTransformFeedbackVarying #endif #ifndef glClampColor #define glClampColor SAGE_glClampColor #endif #ifndef glBeginConditionalRender #define glBeginConditionalRender SAGE_glBeginConditionalRender #endif #ifndef glEndConditionalRender #define glEndConditionalRender SAGE_glEndConditionalRender #endif #ifndef glVertexAttribIPointer #define glVertexAttribIPointer SAGE_glVertexAttribIPointer #endif #ifndef glGetVertexAttribIiv #define glGetVertexAttribIiv SAGE_glGetVertexAttribIiv #endif #ifndef glGetVertexAttribIuiv #define glGetVertexAttribIuiv SAGE_glGetVertexAttribIuiv #endif #ifndef glVertexAttribI1i #define glVertexAttribI1i SAGE_glVertexAttribI1i #endif #ifndef glVertexAttribI2i #define glVertexAttribI2i SAGE_glVertexAttribI2i #endif #ifndef glVertexAttribI3i #define glVertexAttribI3i SAGE_glVertexAttribI3i #endif #ifndef glVertexAttribI4i #define glVertexAttribI4i SAGE_glVertexAttribI4i #endif #ifndef glVertexAttribI1ui #define glVertexAttribI1ui SAGE_glVertexAttribI1ui #endif #ifndef glVertexAttribI2ui #define glVertexAttribI2ui SAGE_glVertexAttribI2ui #endif #ifndef glVertexAttribI3ui #define glVertexAttribI3ui SAGE_glVertexAttribI3ui #endif #ifndef glVertexAttribI4ui #define glVertexAttribI4ui SAGE_glVertexAttribI4ui #endif #ifndef glVertexAttribI1iv #define glVertexAttribI1iv SAGE_glVertexAttribI1iv #endif #ifndef glVertexAttribI2iv #define glVertexAttribI2iv SAGE_glVertexAttribI2iv #endif #ifndef glVertexAttribI3iv #define glVertexAttribI3iv SAGE_glVertexAttribI3iv #endif #ifndef glVertexAttribI4iv #define glVertexAttribI4iv SAGE_glVertexAttribI4iv #endif #ifndef glVertexAttribI1uiv #define glVertexAttribI1uiv SAGE_glVertexAttribI1uiv #endif #ifndef glVertexAttribI2uiv #define glVertexAttribI2uiv SAGE_glVertexAttribI2uiv #endif #ifndef glVertexAttribI3uiv #define glVertexAttribI3uiv SAGE_glVertexAttribI3uiv #endif #ifndef glVertexAttribI4uiv #define glVertexAttribI4uiv SAGE_glVertexAttribI4uiv #endif #ifndef glVertexAttribI4bv #define glVertexAttribI4bv SAGE_glVertexAttribI4bv #endif #ifndef glVertexAttribI4sv #define glVertexAttribI4sv SAGE_glVertexAttribI4sv #endif #ifndef glVertexAttribI4ubv #define glVertexAttribI4ubv SAGE_glVertexAttribI4ubv #endif #ifndef glVertexAttribI4usv #define glVertexAttribI4usv SAGE_glVertexAttribI4usv #endif #ifndef glGetUniformuiv #define glGetUniformuiv SAGE_glGetUniformuiv #endif #ifndef glBindFragDataLocation #define glBindFragDataLocation SAGE_glBindFragDataLocation #endif #ifndef glGetFragDataLocation #define glGetFragDataLocation SAGE_glGetFragDataLocation #endif #ifndef glUniform1ui #define glUniform1ui SAGE_glUniform1ui #endif #ifndef glUniform2ui #define glUniform2ui SAGE_glUniform2ui #endif #ifndef glUniform3ui #define glUniform3ui SAGE_glUniform3ui #endif #ifndef glUniform4ui #define glUniform4ui SAGE_glUniform4ui #endif #ifndef glUniform1uiv #define glUniform1uiv SAGE_glUniform1uiv #endif #ifndef glUniform2uiv #define glUniform2uiv SAGE_glUniform2uiv #endif #ifndef glUniform3uiv #define glUniform3uiv SAGE_glUniform3uiv #endif #ifndef glUniform4uiv #define glUniform4uiv SAGE_glUniform4uiv #endif #ifndef glTexParameterIiv #define glTexParameterIiv SAGE_glTexParameterIiv #endif #ifndef glTexParameterIuiv #define glTexParameterIuiv SAGE_glTexParameterIuiv #endif #ifndef glGetTexParameterIiv #define glGetTexParameterIiv SAGE_glGetTexParameterIiv #endif #ifndef glGetTexParameterIuiv #define glGetTexParameterIuiv SAGE_glGetTexParameterIuiv #endif #ifndef glClearBufferiv #define glClearBufferiv SAGE_glClearBufferiv #endif #ifndef glClearBufferuiv #define glClearBufferuiv SAGE_glClearBufferuiv #endif #ifndef glClearBufferfv #define glClearBufferfv SAGE_glClearBufferfv #endif #ifndef glClearBufferfi #define glClearBufferfi SAGE_glClearBufferfi #endif #ifndef glGetStringi #define glGetStringi SAGE_glGetStringi #endif #endif #ifndef GL_VERSION_3_1 #define GL_VERSION_3_1 1 #ifndef glDrawArraysInstanced #define glDrawArraysInstanced SAGE_glDrawArraysInstanced #endif #ifndef glDrawElementsInstanced #define glDrawElementsInstanced SAGE_glDrawElementsInstanced #endif #ifndef glTexBuffer #define glTexBuffer SAGE_glTexBuffer #endif #ifndef glPrimitiveRestartIndex #define glPrimitiveRestartIndex SAGE_glPrimitiveRestartIndex #endif #endif #ifndef GL_VERSION_3_2 #define GL_VERSION_3_2 1 /* ARB_sync */ #ifndef glGetBufferParameteri64v #define glGetBufferParameteri64v SAGE_glGetBufferParameteri64v #endif #ifndef glProgramParameteri #define glProgramParameteri SAGE_glProgramParameteri #endif #ifndef glFramebufferTexture #define glFramebufferTexture SAGE_glFramebufferTexture #endif #ifndef glFramebufferTextureFace #define glFramebufferTextureFace SAGE_glFramebufferTextureFace #endif #endif #ifndef GL_ARB_multitexture #define GL_ARB_multitexture 1 #ifndef glActiveTextureARB #define glActiveTextureARB SAGE_glActiveTextureARB #endif #ifndef glClientActiveTextureARB #define glClientActiveTextureARB SAGE_glClientActiveTextureARB #endif #ifndef glMultiTexCoord1dARB #define glMultiTexCoord1dARB SAGE_glMultiTexCoord1dARB #endif #ifndef glMultiTexCoord1dvARB #define glMultiTexCoord1dvARB SAGE_glMultiTexCoord1dvARB #endif #ifndef glMultiTexCoord1fARB #define glMultiTexCoord1fARB SAGE_glMultiTexCoord1fARB #endif #ifndef glMultiTexCoord1fvARB #define glMultiTexCoord1fvARB SAGE_glMultiTexCoord1fvARB #endif #ifndef glMultiTexCoord1iARB #define glMultiTexCoord1iARB SAGE_glMultiTexCoord1iARB #endif #ifndef glMultiTexCoord1ivARB #define glMultiTexCoord1ivARB SAGE_glMultiTexCoord1ivARB #endif #ifndef glMultiTexCoord1sARB #define glMultiTexCoord1sARB SAGE_glMultiTexCoord1sARB #endif #ifndef glMultiTexCoord1svARB #define glMultiTexCoord1svARB SAGE_glMultiTexCoord1svARB #endif #ifndef glMultiTexCoord2dARB #define glMultiTexCoord2dARB SAGE_glMultiTexCoord2dARB #endif #ifndef glMultiTexCoord2dvARB #define glMultiTexCoord2dvARB SAGE_glMultiTexCoord2dvARB #endif #ifndef glMultiTexCoord2fARB #define glMultiTexCoord2fARB SAGE_glMultiTexCoord2fARB #endif #ifndef glMultiTexCoord2fvARB #define glMultiTexCoord2fvARB SAGE_glMultiTexCoord2fvARB #endif #ifndef glMultiTexCoord2iARB #define glMultiTexCoord2iARB SAGE_glMultiTexCoord2iARB #endif #ifndef glMultiTexCoord2ivARB #define glMultiTexCoord2ivARB SAGE_glMultiTexCoord2ivARB #endif #ifndef glMultiTexCoord2sARB #define glMultiTexCoord2sARB SAGE_glMultiTexCoord2sARB #endif #ifndef glMultiTexCoord2svARB #define glMultiTexCoord2svARB SAGE_glMultiTexCoord2svARB #endif #ifndef glMultiTexCoord3dARB #define glMultiTexCoord3dARB SAGE_glMultiTexCoord3dARB #endif #ifndef glMultiTexCoord3dvARB #define glMultiTexCoord3dvARB SAGE_glMultiTexCoord3dvARB #endif #ifndef glMultiTexCoord3fARB #define glMultiTexCoord3fARB SAGE_glMultiTexCoord3fARB #endif #ifndef glMultiTexCoord3fvARB #define glMultiTexCoord3fvARB SAGE_glMultiTexCoord3fvARB #endif #ifndef glMultiTexCoord3iARB #define glMultiTexCoord3iARB SAGE_glMultiTexCoord3iARB #endif #ifndef glMultiTexCoord3ivARB #define glMultiTexCoord3ivARB SAGE_glMultiTexCoord3ivARB #endif #ifndef glMultiTexCoord3sARB #define glMultiTexCoord3sARB SAGE_glMultiTexCoord3sARB #endif #ifndef glMultiTexCoord3svARB #define glMultiTexCoord3svARB SAGE_glMultiTexCoord3svARB #endif #ifndef glMultiTexCoord4dARB #define glMultiTexCoord4dARB SAGE_glMultiTexCoord4dARB #endif #ifndef glMultiTexCoord4dvARB #define glMultiTexCoord4dvARB SAGE_glMultiTexCoord4dvARB #endif #ifndef glMultiTexCoord4fARB #define glMultiTexCoord4fARB SAGE_glMultiTexCoord4fARB #endif #ifndef glMultiTexCoord4fvARB #define glMultiTexCoord4fvARB SAGE_glMultiTexCoord4fvARB #endif #ifndef glMultiTexCoord4iARB #define glMultiTexCoord4iARB SAGE_glMultiTexCoord4iARB #endif #ifndef glMultiTexCoord4ivARB #define glMultiTexCoord4ivARB SAGE_glMultiTexCoord4ivARB #endif #ifndef glMultiTexCoord4sARB #define glMultiTexCoord4sARB SAGE_glMultiTexCoord4sARB #endif #ifndef glMultiTexCoord4svARB #define glMultiTexCoord4svARB SAGE_glMultiTexCoord4svARB #endif #endif #ifndef GL_ARB_transpose_matrix #define GL_ARB_transpose_matrix 1 #ifndef glLoadTransposeMatrixfARB #define glLoadTransposeMatrixfARB SAGE_glLoadTransposeMatrixfARB #endif #ifndef glLoadTransposeMatrixdARB #define glLoadTransposeMatrixdARB SAGE_glLoadTransposeMatrixdARB #endif #ifndef glMultTransposeMatrixfARB #define glMultTransposeMatrixfARB SAGE_glMultTransposeMatrixfARB #endif #ifndef glMultTransposeMatrixdARB #define glMultTransposeMatrixdARB SAGE_glMultTransposeMatrixdARB #endif #endif #ifndef GL_ARB_multisample #define GL_ARB_multisample 1 #ifndef glSampleCoverageARB #define glSampleCoverageARB SAGE_glSampleCoverageARB #endif #endif #ifndef GL_ARB_texture_env_add #define GL_ARB_texture_env_add 1 #endif #ifndef GL_ARB_texture_cube_map #define GL_ARB_texture_cube_map 1 #endif #ifndef GL_ARB_texture_compression #define GL_ARB_texture_compression 1 #ifndef glCompressedTexImage3DARB #define glCompressedTexImage3DARB SAGE_glCompressedTexImage3DARB #endif #ifndef glCompressedTexImage2DARB #define glCompressedTexImage2DARB SAGE_glCompressedTexImage2DARB #endif #ifndef glCompressedTexImage1DARB #define glCompressedTexImage1DARB SAGE_glCompressedTexImage1DARB #endif #ifndef glCompressedTexSubImage3DARB #define glCompressedTexSubImage3DARB SAGE_glCompressedTexSubImage3DARB #endif #ifndef glCompressedTexSubImage2DARB #define glCompressedTexSubImage2DARB SAGE_glCompressedTexSubImage2DARB #endif #ifndef glCompressedTexSubImage1DARB #define glCompressedTexSubImage1DARB SAGE_glCompressedTexSubImage1DARB #endif #ifndef glGetCompressedTexImageARB #define glGetCompressedTexImageARB SAGE_glGetCompressedTexImageARB #endif #endif #ifndef GL_ARB_texture_border_clamp #define GL_ARB_texture_border_clamp 1 #endif #ifndef GL_ARB_point_parameters #define GL_ARB_point_parameters 1 #ifndef glPointParameterfARB #define glPointParameterfARB SAGE_glPointParameterfARB #endif #ifndef glPointParameterfvARB #define glPointParameterfvARB SAGE_glPointParameterfvARB #endif #endif #ifndef GL_ARB_vertex_blend #define GL_ARB_vertex_blend 1 #ifndef glWeightbvARB #define glWeightbvARB SAGE_glWeightbvARB #endif #ifndef glWeightsvARB #define glWeightsvARB SAGE_glWeightsvARB #endif #ifndef glWeightivARB #define glWeightivARB SAGE_glWeightivARB #endif #ifndef glWeightfvARB #define glWeightfvARB SAGE_glWeightfvARB #endif #ifndef glWeightdvARB #define glWeightdvARB SAGE_glWeightdvARB #endif #ifndef glWeightubvARB #define glWeightubvARB SAGE_glWeightubvARB #endif #ifndef glWeightusvARB #define glWeightusvARB SAGE_glWeightusvARB #endif #ifndef glWeightuivARB #define glWeightuivARB SAGE_glWeightuivARB #endif #ifndef glWeightPointerARB #define glWeightPointerARB SAGE_glWeightPointerARB #endif #ifndef glVertexBlendARB #define glVertexBlendARB SAGE_glVertexBlendARB #endif #endif #ifndef GL_ARB_matrix_palette #define GL_ARB_matrix_palette 1 #ifndef glCurrentPaletteMatrixARB #define glCurrentPaletteMatrixARB SAGE_glCurrentPaletteMatrixARB #endif #ifndef glMatrixIndexubvARB #define glMatrixIndexubvARB SAGE_glMatrixIndexubvARB #endif #ifndef glMatrixIndexusvARB #define glMatrixIndexusvARB SAGE_glMatrixIndexusvARB #endif #ifndef glMatrixIndexuivARB #define glMatrixIndexuivARB SAGE_glMatrixIndexuivARB #endif #ifndef glMatrixIndexPointerARB #define glMatrixIndexPointerARB SAGE_glMatrixIndexPointerARB #endif #endif #ifndef GL_ARB_texture_env_combine #define GL_ARB_texture_env_combine 1 #endif #ifndef GL_ARB_texture_env_crossbar #define GL_ARB_texture_env_crossbar 1 #endif #ifndef GL_ARB_texture_env_dot3 #define GL_ARB_texture_env_dot3 1 #endif #ifndef GL_ARB_texture_mirrored_repeat #define GL_ARB_texture_mirrored_repeat 1 #endif #ifndef GL_ARB_depth_texture #define GL_ARB_depth_texture 1 #endif #ifndef GL_ARB_shadow #define GL_ARB_shadow 1 #endif #ifndef GL_ARB_shadow_ambient #define GL_ARB_shadow_ambient 1 #endif #ifndef GL_ARB_window_pos #define GL_ARB_window_pos 1 #ifndef glWindowPos2dARB #define glWindowPos2dARB SAGE_glWindowPos2dARB #endif #ifndef glWindowPos2dvARB #define glWindowPos2dvARB SAGE_glWindowPos2dvARB #endif #ifndef glWindowPos2fARB #define glWindowPos2fARB SAGE_glWindowPos2fARB #endif #ifndef glWindowPos2fvARB #define glWindowPos2fvARB SAGE_glWindowPos2fvARB #endif #ifndef glWindowPos2iARB #define glWindowPos2iARB SAGE_glWindowPos2iARB #endif #ifndef glWindowPos2ivARB #define glWindowPos2ivARB SAGE_glWindowPos2ivARB #endif #ifndef glWindowPos2sARB #define glWindowPos2sARB SAGE_glWindowPos2sARB #endif #ifndef glWindowPos2svARB #define glWindowPos2svARB SAGE_glWindowPos2svARB #endif #ifndef glWindowPos3dARB #define glWindowPos3dARB SAGE_glWindowPos3dARB #endif #ifndef glWindowPos3dvARB #define glWindowPos3dvARB SAGE_glWindowPos3dvARB #endif #ifndef glWindowPos3fARB #define glWindowPos3fARB SAGE_glWindowPos3fARB #endif #ifndef glWindowPos3fvARB #define glWindowPos3fvARB SAGE_glWindowPos3fvARB #endif #ifndef glWindowPos3iARB #define glWindowPos3iARB SAGE_glWindowPos3iARB #endif #ifndef glWindowPos3ivARB #define glWindowPos3ivARB SAGE_glWindowPos3ivARB #endif #ifndef glWindowPos3sARB #define glWindowPos3sARB SAGE_glWindowPos3sARB #endif #ifndef glWindowPos3svARB #define glWindowPos3svARB SAGE_glWindowPos3svARB #endif #endif #ifndef GL_ARB_vertex_program #define GL_ARB_vertex_program 1 #ifndef glVertexAttrib1dARB #define glVertexAttrib1dARB SAGE_glVertexAttrib1dARB #endif #ifndef glVertexAttrib1dvARB #define glVertexAttrib1dvARB SAGE_glVertexAttrib1dvARB #endif #ifndef glVertexAttrib1fARB #define glVertexAttrib1fARB SAGE_glVertexAttrib1fARB #endif #ifndef glVertexAttrib1fvARB #define glVertexAttrib1fvARB SAGE_glVertexAttrib1fvARB #endif #ifndef glVertexAttrib1sARB #define glVertexAttrib1sARB SAGE_glVertexAttrib1sARB #endif #ifndef glVertexAttrib1svARB #define glVertexAttrib1svARB SAGE_glVertexAttrib1svARB #endif #ifndef glVertexAttrib2dARB #define glVertexAttrib2dARB SAGE_glVertexAttrib2dARB #endif #ifndef glVertexAttrib2dvARB #define glVertexAttrib2dvARB SAGE_glVertexAttrib2dvARB #endif #ifndef glVertexAttrib2fARB #define glVertexAttrib2fARB SAGE_glVertexAttrib2fARB #endif #ifndef glVertexAttrib2fvARB #define glVertexAttrib2fvARB SAGE_glVertexAttrib2fvARB #endif #ifndef glVertexAttrib2sARB #define glVertexAttrib2sARB SAGE_glVertexAttrib2sARB #endif #ifndef glVertexAttrib2svARB #define glVertexAttrib2svARB SAGE_glVertexAttrib2svARB #endif #ifndef glVertexAttrib3dARB #define glVertexAttrib3dARB SAGE_glVertexAttrib3dARB #endif #ifndef glVertexAttrib3dvARB #define glVertexAttrib3dvARB SAGE_glVertexAttrib3dvARB #endif #ifndef glVertexAttrib3fARB #define glVertexAttrib3fARB SAGE_glVertexAttrib3fARB #endif #ifndef glVertexAttrib3fvARB #define glVertexAttrib3fvARB SAGE_glVertexAttrib3fvARB #endif #ifndef glVertexAttrib3sARB #define glVertexAttrib3sARB SAGE_glVertexAttrib3sARB #endif #ifndef glVertexAttrib3svARB #define glVertexAttrib3svARB SAGE_glVertexAttrib3svARB #endif #ifndef glVertexAttrib4NbvARB #define glVertexAttrib4NbvARB SAGE_glVertexAttrib4NbvARB #endif #ifndef glVertexAttrib4NivARB #define glVertexAttrib4NivARB SAGE_glVertexAttrib4NivARB #endif #ifndef glVertexAttrib4NsvARB #define glVertexAttrib4NsvARB SAGE_glVertexAttrib4NsvARB #endif #ifndef glVertexAttrib4NubARB #define glVertexAttrib4NubARB SAGE_glVertexAttrib4NubARB #endif #ifndef glVertexAttrib4NubvARB #define glVertexAttrib4NubvARB SAGE_glVertexAttrib4NubvARB #endif #ifndef glVertexAttrib4NuivARB #define glVertexAttrib4NuivARB SAGE_glVertexAttrib4NuivARB #endif #ifndef glVertexAttrib4NusvARB #define glVertexAttrib4NusvARB SAGE_glVertexAttrib4NusvARB #endif #ifndef glVertexAttrib4bvARB #define glVertexAttrib4bvARB SAGE_glVertexAttrib4bvARB #endif #ifndef glVertexAttrib4dARB #define glVertexAttrib4dARB SAGE_glVertexAttrib4dARB #endif #ifndef glVertexAttrib4dvARB #define glVertexAttrib4dvARB SAGE_glVertexAttrib4dvARB #endif #ifndef glVertexAttrib4fARB #define glVertexAttrib4fARB SAGE_glVertexAttrib4fARB #endif #ifndef glVertexAttrib4fvARB #define glVertexAttrib4fvARB SAGE_glVertexAttrib4fvARB #endif #ifndef glVertexAttrib4ivARB #define glVertexAttrib4ivARB SAGE_glVertexAttrib4ivARB #endif #ifndef glVertexAttrib4sARB #define glVertexAttrib4sARB SAGE_glVertexAttrib4sARB #endif #ifndef glVertexAttrib4svARB #define glVertexAttrib4svARB SAGE_glVertexAttrib4svARB #endif #ifndef glVertexAttrib4ubvARB #define glVertexAttrib4ubvARB SAGE_glVertexAttrib4ubvARB #endif #ifndef glVertexAttrib4uivARB #define glVertexAttrib4uivARB SAGE_glVertexAttrib4uivARB #endif #ifndef glVertexAttrib4usvARB #define glVertexAttrib4usvARB SAGE_glVertexAttrib4usvARB #endif #ifndef glVertexAttribPointerARB #define glVertexAttribPointerARB SAGE_glVertexAttribPointerARB #endif #ifndef glEnableVertexAttribArrayARB #define glEnableVertexAttribArrayARB SAGE_glEnableVertexAttribArrayARB #endif #ifndef glDisableVertexAttribArrayARB #define glDisableVertexAttribArrayARB SAGE_glDisableVertexAttribArrayARB #endif #ifndef glProgramStringARB #define glProgramStringARB SAGE_glProgramStringARB #endif #ifndef glBindProgramARB #define glBindProgramARB SAGE_glBindProgramARB #endif #ifndef glDeleteProgramsARB #define glDeleteProgramsARB SAGE_glDeleteProgramsARB #endif #ifndef glGenProgramsARB #define glGenProgramsARB SAGE_glGenProgramsARB #endif #ifndef glProgramEnvParameter4dARB #define glProgramEnvParameter4dARB SAGE_glProgramEnvParameter4dARB #endif #ifndef glProgramEnvParameter4dvARB #define glProgramEnvParameter4dvARB SAGE_glProgramEnvParameter4dvARB #endif #ifndef glProgramEnvParameter4fARB #define glProgramEnvParameter4fARB SAGE_glProgramEnvParameter4fARB #endif #ifndef glProgramEnvParameter4fvARB #define glProgramEnvParameter4fvARB SAGE_glProgramEnvParameter4fvARB #endif #ifndef glProgramLocalParameter4dARB #define glProgramLocalParameter4dARB SAGE_glProgramLocalParameter4dARB #endif #ifndef glProgramLocalParameter4dvARB #define glProgramLocalParameter4dvARB SAGE_glProgramLocalParameter4dvARB #endif #ifndef glProgramLocalParameter4fARB #define glProgramLocalParameter4fARB SAGE_glProgramLocalParameter4fARB #endif #ifndef glProgramLocalParameter4fvARB #define glProgramLocalParameter4fvARB SAGE_glProgramLocalParameter4fvARB #endif #ifndef glGetProgramEnvParameterdvARB #define glGetProgramEnvParameterdvARB SAGE_glGetProgramEnvParameterdvARB #endif #ifndef glGetProgramEnvParameterfvARB #define glGetProgramEnvParameterfvARB SAGE_glGetProgramEnvParameterfvARB #endif #ifndef glGetProgramLocalParameterdvARB #define glGetProgramLocalParameterdvARB SAGE_glGetProgramLocalParameterdvARB #endif #ifndef glGetProgramLocalParameterfvARB #define glGetProgramLocalParameterfvARB SAGE_glGetProgramLocalParameterfvARB #endif #ifndef glGetProgramivARB #define glGetProgramivARB SAGE_glGetProgramivARB #endif #ifndef glGetProgramStringARB #define glGetProgramStringARB SAGE_glGetProgramStringARB #endif #ifndef glGetVertexAttribdvARB #define glGetVertexAttribdvARB SAGE_glGetVertexAttribdvARB #endif #ifndef glGetVertexAttribfvARB #define glGetVertexAttribfvARB SAGE_glGetVertexAttribfvARB #endif #ifndef glGetVertexAttribivARB #define glGetVertexAttribivARB SAGE_glGetVertexAttribivARB #endif #ifndef glGetVertexAttribPointervARB #define glGetVertexAttribPointervARB SAGE_glGetVertexAttribPointervARB #endif #ifndef glIsProgramARB #define glIsProgramARB SAGE_glIsProgramARB #endif #endif #ifndef GL_ARB_fragment_program #define GL_ARB_fragment_program 1 #endif #ifndef GL_ARB_vertex_buffer_object #define GL_ARB_vertex_buffer_object 1 #ifndef glBindBufferARB #define glBindBufferARB SAGE_glBindBufferARB #endif #ifndef glDeleteBuffersARB #define glDeleteBuffersARB SAGE_glDeleteBuffersARB #endif #ifndef glGenBuffersARB #define glGenBuffersARB SAGE_glGenBuffersARB #endif #ifndef glIsBufferARB #define glIsBufferARB SAGE_glIsBufferARB #endif #ifndef glBufferDataARB #define glBufferDataARB SAGE_glBufferDataARB #endif #ifndef glBufferSubDataARB #define glBufferSubDataARB SAGE_glBufferSubDataARB #endif #ifndef glGetBufferSubDataARB #define glGetBufferSubDataARB SAGE_glGetBufferSubDataARB #endif #ifndef glMapBufferARB #define glMapBufferARB SAGE_glMapBufferARB #endif #ifndef glUnmapBufferARB #define glUnmapBufferARB SAGE_glUnmapBufferARB #endif #ifndef glGetBufferParameterivARB #define glGetBufferParameterivARB SAGE_glGetBufferParameterivARB #endif #ifndef glGetBufferPointervARB #define glGetBufferPointervARB SAGE_glGetBufferPointervARB #endif #endif #ifndef GL_ARB_occlusion_query #define GL_ARB_occlusion_query 1 #ifndef glGenQueriesARB #define glGenQueriesARB SAGE_glGenQueriesARB #endif #ifndef glDeleteQueriesARB #define glDeleteQueriesARB SAGE_glDeleteQueriesARB #endif #ifndef glIsQueryARB #define glIsQueryARB SAGE_glIsQueryARB #endif #ifndef glBeginQueryARB #define glBeginQueryARB SAGE_glBeginQueryARB #endif #ifndef glEndQueryARB #define glEndQueryARB SAGE_glEndQueryARB #endif #ifndef glGetQueryivARB #define glGetQueryivARB SAGE_glGetQueryivARB #endif #ifndef glGetQueryObjectivARB #define glGetQueryObjectivARB SAGE_glGetQueryObjectivARB #endif #ifndef glGetQueryObjectuivARB #define glGetQueryObjectuivARB SAGE_glGetQueryObjectuivARB #endif #endif #ifndef GL_ARB_shader_objects #define GL_ARB_shader_objects 1 #ifndef glDeleteObjectARB #define glDeleteObjectARB SAGE_glDeleteObjectARB #endif #ifndef glGetHandleARB #define glGetHandleARB SAGE_glGetHandleARB #endif #ifndef glDetachObjectARB #define glDetachObjectARB SAGE_glDetachObjectARB #endif #ifndef glCreateShaderObjectARB #define glCreateShaderObjectARB SAGE_glCreateShaderObjectARB #endif #ifndef glShaderSourceARB #define glShaderSourceARB SAGE_glShaderSourceARB #endif #ifndef glCompileShaderARB #define glCompileShaderARB SAGE_glCompileShaderARB #endif #ifndef glCreateProgramObjectARB #define glCreateProgramObjectARB SAGE_glCreateProgramObjectARB #endif #ifndef glAttachObjectARB #define glAttachObjectARB SAGE_glAttachObjectARB #endif #ifndef glLinkProgramARB #define glLinkProgramARB SAGE_glLinkProgramARB #endif #ifndef glUseProgramObjectARB #define glUseProgramObjectARB SAGE_glUseProgramObjectARB #endif #ifndef glValidateProgramARB #define glValidateProgramARB SAGE_glValidateProgramARB #endif #ifndef glUniform1fARB #define glUniform1fARB SAGE_glUniform1fARB #endif #ifndef glUniform2fARB #define glUniform2fARB SAGE_glUniform2fARB #endif #ifndef glUniform3fARB #define glUniform3fARB SAGE_glUniform3fARB #endif #ifndef glUniform4fARB #define glUniform4fARB SAGE_glUniform4fARB #endif #ifndef glUniform1iARB #define glUniform1iARB SAGE_glUniform1iARB #endif #ifndef glUniform2iARB #define glUniform2iARB SAGE_glUniform2iARB #endif #ifndef glUniform3iARB #define glUniform3iARB SAGE_glUniform3iARB #endif #ifndef glUniform4iARB #define glUniform4iARB SAGE_glUniform4iARB #endif #ifndef glUniform1fvARB #define glUniform1fvARB SAGE_glUniform1fvARB #endif #ifndef glUniform2fvARB #define glUniform2fvARB SAGE_glUniform2fvARB #endif #ifndef glUniform3fvARB #define glUniform3fvARB SAGE_glUniform3fvARB #endif #ifndef glUniform4fvARB #define glUniform4fvARB SAGE_glUniform4fvARB #endif #ifndef glUniform1ivARB #define glUniform1ivARB SAGE_glUniform1ivARB #endif #ifndef glUniform2ivARB #define glUniform2ivARB SAGE_glUniform2ivARB #endif #ifndef glUniform3ivARB #define glUniform3ivARB SAGE_glUniform3ivARB #endif #ifndef glUniform4ivARB #define glUniform4ivARB SAGE_glUniform4ivARB #endif #ifndef glUniformMatrix2fvARB #define glUniformMatrix2fvARB SAGE_glUniformMatrix2fvARB #endif #ifndef glUniformMatrix3fvARB #define glUniformMatrix3fvARB SAGE_glUniformMatrix3fvARB #endif #ifndef glUniformMatrix4fvARB #define glUniformMatrix4fvARB SAGE_glUniformMatrix4fvARB #endif #ifndef glGetObjectParameterfvARB #define glGetObjectParameterfvARB SAGE_glGetObjectParameterfvARB #endif #ifndef glGetObjectParameterivARB #define glGetObjectParameterivARB SAGE_glGetObjectParameterivARB #endif #ifndef glGetInfoLogARB #define glGetInfoLogARB SAGE_glGetInfoLogARB #endif #ifndef glGetAttachedObjectsARB #define glGetAttachedObjectsARB SAGE_glGetAttachedObjectsARB #endif #ifndef glGetUniformLocationARB #define glGetUniformLocationARB SAGE_glGetUniformLocationARB #endif #ifndef glGetActiveUniformARB #define glGetActiveUniformARB SAGE_glGetActiveUniformARB #endif #ifndef glGetUniformfvARB #define glGetUniformfvARB SAGE_glGetUniformfvARB #endif #ifndef glGetUniformivARB #define glGetUniformivARB SAGE_glGetUniformivARB #endif #ifndef glGetShaderSourceARB #define glGetShaderSourceARB SAGE_glGetShaderSourceARB #endif #endif #ifndef GL_ARB_vertex_shader #define GL_ARB_vertex_shader 1 #ifndef glBindAttribLocationARB #define glBindAttribLocationARB SAGE_glBindAttribLocationARB #endif #ifndef glGetActiveAttribARB #define glGetActiveAttribARB SAGE_glGetActiveAttribARB #endif #ifndef glGetAttribLocationARB #define glGetAttribLocationARB SAGE_glGetAttribLocationARB #endif #endif #ifndef GL_ARB_fragment_shader #define GL_ARB_fragment_shader 1 #endif #ifndef GL_ARB_shading_language_100 #define GL_ARB_shading_language_100 1 #endif #ifndef GL_ARB_texture_non_power_of_two #define GL_ARB_texture_non_power_of_two 1 #endif #ifndef GL_ARB_point_sprite #define GL_ARB_point_sprite 1 #endif #ifndef GL_ARB_fragment_program_shadow #define GL_ARB_fragment_program_shadow 1 #endif #ifndef GL_ARB_draw_buffers #define GL_ARB_draw_buffers 1 #ifndef glDrawBuffersARB #define glDrawBuffersARB SAGE_glDrawBuffersARB #endif #endif #ifndef GL_ARB_texture_rectangle #define GL_ARB_texture_rectangle 1 #endif #ifndef GL_ARB_color_buffer_float #define GL_ARB_color_buffer_float 1 #ifndef glClampColorARB #define glClampColorARB SAGE_glClampColorARB #endif #endif #ifndef GL_ARB_half_float_pixel #define GL_ARB_half_float_pixel 1 #endif #ifndef GL_ARB_texture_float #define GL_ARB_texture_float 1 #endif #ifndef GL_ARB_pixel_buffer_object #define GL_ARB_pixel_buffer_object 1 #endif #ifndef GL_ARB_depth_buffer_float #define GL_ARB_depth_buffer_float 1 #endif #ifndef GL_ARB_draw_instanced #define GL_ARB_draw_instanced 1 #ifndef glDrawArraysInstancedARB #define glDrawArraysInstancedARB SAGE_glDrawArraysInstancedARB #endif #ifndef glDrawElementsInstancedARB #define glDrawElementsInstancedARB SAGE_glDrawElementsInstancedARB #endif #endif #ifndef GL_ARB_framebuffer_object #define GL_ARB_framebuffer_object 1 #ifndef glIsRenderbuffer #define glIsRenderbuffer SAGE_glIsRenderbuffer #endif #ifndef glBindRenderbuffer #define glBindRenderbuffer SAGE_glBindRenderbuffer #endif #ifndef glDeleteRenderbuffers #define glDeleteRenderbuffers SAGE_glDeleteRenderbuffers #endif #ifndef glGenRenderbuffers #define glGenRenderbuffers SAGE_glGenRenderbuffers #endif #ifndef glRenderbufferStorage #define glRenderbufferStorage SAGE_glRenderbufferStorage #endif #ifndef glGetRenderbufferParameteriv #define glGetRenderbufferParameteriv SAGE_glGetRenderbufferParameteriv #endif #ifndef glIsFramebuffer #define glIsFramebuffer SAGE_glIsFramebuffer #endif #ifndef glBindFramebuffer #define glBindFramebuffer SAGE_glBindFramebuffer #endif #ifndef glDeleteFramebuffers #define glDeleteFramebuffers SAGE_glDeleteFramebuffers #endif #ifndef glGenFramebuffers #define glGenFramebuffers SAGE_glGenFramebuffers #endif #ifndef glCheckFramebufferStatus #define glCheckFramebufferStatus SAGE_glCheckFramebufferStatus #endif #ifndef glFramebufferTexture1D #define glFramebufferTexture1D SAGE_glFramebufferTexture1D #endif #ifndef glFramebufferTexture2D #define glFramebufferTexture2D SAGE_glFramebufferTexture2D #endif #ifndef glFramebufferTexture3D #define glFramebufferTexture3D SAGE_glFramebufferTexture3D #endif #ifndef glFramebufferRenderbuffer #define glFramebufferRenderbuffer SAGE_glFramebufferRenderbuffer #endif #ifndef glGetFramebufferAttachmentParameteriv #define glGetFramebufferAttachmentParameteriv SAGE_glGetFramebufferAttachmentParameteriv #endif #ifndef glGenerateMipmap #define glGenerateMipmap SAGE_glGenerateMipmap #endif #ifndef glBlitFramebuffer #define glBlitFramebuffer SAGE_glBlitFramebuffer #endif #ifndef glRenderbufferStorageMultisample #define glRenderbufferStorageMultisample SAGE_glRenderbufferStorageMultisample #endif #ifndef glFramebufferTextureLayer #define glFramebufferTextureLayer SAGE_glFramebufferTextureLayer #endif #endif #ifndef GL_ARB_framebuffer_sRGB #define GL_ARB_framebuffer_sRGB 1 #endif #ifndef GL_ARB_geometry_shader4 #define GL_ARB_geometry_shader4 1 #ifndef glProgramParameteriARB #define glProgramParameteriARB SAGE_glProgramParameteriARB #endif #ifndef glFramebufferTextureARB #define glFramebufferTextureARB SAGE_glFramebufferTextureARB #endif #ifndef glFramebufferTextureLayerARB #define glFramebufferTextureLayerARB SAGE_glFramebufferTextureLayerARB #endif #ifndef glFramebufferTextureFaceARB #define glFramebufferTextureFaceARB SAGE_glFramebufferTextureFaceARB #endif #endif #ifndef GL_ARB_half_float_vertex #define GL_ARB_half_float_vertex 1 #endif #ifndef GL_ARB_instanced_arrays #define GL_ARB_instanced_arrays 1 #ifndef glVertexAttribDivisorARB #define glVertexAttribDivisorARB SAGE_glVertexAttribDivisorARB #endif #endif #ifndef GL_ARB_map_buffer_range #define GL_ARB_map_buffer_range 1 #ifndef glMapBufferRange #define glMapBufferRange SAGE_glMapBufferRange #endif #ifndef glFlushMappedBufferRange #define glFlushMappedBufferRange SAGE_glFlushMappedBufferRange #endif #endif #ifndef GL_ARB_texture_buffer_object #define GL_ARB_texture_buffer_object 1 #ifndef glTexBufferARB #define glTexBufferARB SAGE_glTexBufferARB #endif #endif #ifndef GL_ARB_texture_compression_rgtc #define GL_ARB_texture_compression_rgtc 1 #endif #ifndef GL_ARB_texture_rg #define GL_ARB_texture_rg 1 #endif #ifndef GL_ARB_vertex_array_object #define GL_ARB_vertex_array_object 1 #ifndef glBindVertexArray #define glBindVertexArray SAGE_glBindVertexArray #endif #ifndef glDeleteVertexArrays #define glDeleteVertexArrays SAGE_glDeleteVertexArrays #endif #ifndef glGenVertexArrays #define glGenVertexArrays SAGE_glGenVertexArrays #endif #ifndef glIsVertexArray #define glIsVertexArray SAGE_glIsVertexArray #endif #endif #ifndef GL_ARB_uniform_buffer_object #define GL_ARB_uniform_buffer_object 1 #ifndef glGetUniformIndices #define glGetUniformIndices SAGE_glGetUniformIndices #endif #ifndef glGetActiveUniformsiv #define glGetActiveUniformsiv SAGE_glGetActiveUniformsiv #endif #ifndef glGetActiveUniformName #define glGetActiveUniformName SAGE_glGetActiveUniformName #endif #ifndef glGetUniformBlockIndex #define glGetUniformBlockIndex SAGE_glGetUniformBlockIndex #endif #ifndef glGetActiveUniformBlockiv #define glGetActiveUniformBlockiv SAGE_glGetActiveUniformBlockiv #endif #ifndef glGetActiveUniformBlockName #define glGetActiveUniformBlockName SAGE_glGetActiveUniformBlockName #endif #ifndef glUniformBlockBinding #define glUniformBlockBinding SAGE_glUniformBlockBinding #endif #endif #ifndef GL_ARB_compatibility #define GL_ARB_compatibility 1 #endif #ifndef GL_ARB_copy_buffer #define GL_ARB_copy_buffer 1 #ifndef glCopyBufferSubData #define glCopyBufferSubData SAGE_glCopyBufferSubData #endif #endif #ifndef GL_ARB_shader_texture_lod #define GL_ARB_shader_texture_lod 1 #endif #ifndef GL_ARB_depth_clamp #define GL_ARB_depth_clamp 1 #endif #ifndef GL_ARB_draw_elements_base_vertex #define GL_ARB_draw_elements_base_vertex 1 #ifndef glDrawElementsBaseVertex #define glDrawElementsBaseVertex SAGE_glDrawElementsBaseVertex #endif #ifndef glDrawRangeElementsBaseVertex #define glDrawRangeElementsBaseVertex SAGE_glDrawRangeElementsBaseVertex #endif #ifndef glDrawElementsInstancedBaseVertex #define glDrawElementsInstancedBaseVertex SAGE_glDrawElementsInstancedBaseVertex #endif #ifndef glMultiDrawElementsBaseVertex #define glMultiDrawElementsBaseVertex SAGE_glMultiDrawElementsBaseVertex #endif #endif #ifndef GL_ARB_fragment_coord_conventions #define GL_ARB_fragment_coord_conventions 1 #endif #ifndef GL_ARB_provoking_vertex #define GL_ARB_provoking_vertex 1 #ifndef glProvokingVertex #define glProvokingVertex SAGE_glProvokingVertex #endif #endif #ifndef GL_ARB_seamless_cube_map #define GL_ARB_seamless_cube_map 1 #endif #ifndef GL_ARB_sync #define GL_ARB_sync 1 #ifndef glFenceSync #define glFenceSync SAGE_glFenceSync #endif #ifndef glIsSync #define glIsSync SAGE_glIsSync #endif #ifndef glDeleteSync #define glDeleteSync SAGE_glDeleteSync #endif #ifndef glClientWaitSync #define glClientWaitSync SAGE_glClientWaitSync #endif #ifndef glWaitSync #define glWaitSync SAGE_glWaitSync #endif #ifndef glGetInteger64v #define glGetInteger64v SAGE_glGetInteger64v #endif #ifndef glGetSynciv #define glGetSynciv SAGE_glGetSynciv #endif #endif #ifndef GL_ARB_texture_multisample #define GL_ARB_texture_multisample 1 #ifndef glTexImage2DMultisample #define glTexImage2DMultisample SAGE_glTexImage2DMultisample #endif #ifndef glTexImage3DMultisample #define glTexImage3DMultisample SAGE_glTexImage3DMultisample #endif #ifndef glGetMultisamplefv #define glGetMultisamplefv SAGE_glGetMultisamplefv #endif #ifndef glSampleMaski #define glSampleMaski SAGE_glSampleMaski #endif #endif #ifndef GL_ARB_vertex_array_bgra #define GL_ARB_vertex_array_bgra 1 #endif #ifndef GL_ARB_draw_buffers_blend #define GL_ARB_draw_buffers_blend 1 #ifndef glBlendEquationi #define glBlendEquationi SAGE_glBlendEquationi #endif #ifndef glBlendEquationSeparatei #define glBlendEquationSeparatei SAGE_glBlendEquationSeparatei #endif #ifndef glBlendFunci #define glBlendFunci SAGE_glBlendFunci #endif #ifndef glBlendFuncSeparatei #define glBlendFuncSeparatei SAGE_glBlendFuncSeparatei #endif #endif #ifndef GL_ARB_sample_shading #define GL_ARB_sample_shading 1 #ifndef glMinSampleShading #define glMinSampleShading SAGE_glMinSampleShading #endif #endif #ifndef GL_ARB_texture_cube_map_array #define GL_ARB_texture_cube_map_array 1 #endif #ifndef GL_ARB_texture_gather #define GL_ARB_texture_gather 1 #endif #ifndef GL_ARB_texture_query_lod #define GL_ARB_texture_query_lod 1 #endif #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 #endif #ifndef GL_EXT_blend_color #define GL_EXT_blend_color 1 #ifndef glBlendColorEXT #define glBlendColorEXT SAGE_glBlendColorEXT #endif #endif #ifndef GL_EXT_polygon_offset #define GL_EXT_polygon_offset 1 #ifndef glPolygonOffsetEXT #define glPolygonOffsetEXT SAGE_glPolygonOffsetEXT #endif #endif #ifndef GL_EXT_texture #define GL_EXT_texture 1 #endif #ifndef GL_EXT_texture3D #define GL_EXT_texture3D 1 #ifndef glTexImage3DEXT #define glTexImage3DEXT SAGE_glTexImage3DEXT #endif #ifndef glTexSubImage3DEXT #define glTexSubImage3DEXT SAGE_glTexSubImage3DEXT #endif #endif #ifndef GL_SGIS_texture_filter4 #define GL_SGIS_texture_filter4 1 #ifndef glGetTexFilterFuncSGIS #define glGetTexFilterFuncSGIS SAGE_glGetTexFilterFuncSGIS #endif #ifndef glTexFilterFuncSGIS #define glTexFilterFuncSGIS SAGE_glTexFilterFuncSGIS #endif #endif #ifndef GL_EXT_subtexture #define GL_EXT_subtexture 1 #ifndef glTexSubImage1DEXT #define glTexSubImage1DEXT SAGE_glTexSubImage1DEXT #endif #ifndef glTexSubImage2DEXT #define glTexSubImage2DEXT SAGE_glTexSubImage2DEXT #endif #endif #ifndef GL_EXT_copy_texture #define GL_EXT_copy_texture 1 #ifndef glCopyTexImage1DEXT #define glCopyTexImage1DEXT SAGE_glCopyTexImage1DEXT #endif #ifndef glCopyTexImage2DEXT #define glCopyTexImage2DEXT SAGE_glCopyTexImage2DEXT #endif #ifndef glCopyTexSubImage1DEXT #define glCopyTexSubImage1DEXT SAGE_glCopyTexSubImage1DEXT #endif #ifndef glCopyTexSubImage2DEXT #define glCopyTexSubImage2DEXT SAGE_glCopyTexSubImage2DEXT #endif #ifndef glCopyTexSubImage3DEXT #define glCopyTexSubImage3DEXT SAGE_glCopyTexSubImage3DEXT #endif #endif #ifndef GL_EXT_histogram #define GL_EXT_histogram 1 #ifndef glGetHistogramEXT #define glGetHistogramEXT SAGE_glGetHistogramEXT #endif #ifndef glGetHistogramParameterfvEXT #define glGetHistogramParameterfvEXT SAGE_glGetHistogramParameterfvEXT #endif #ifndef glGetHistogramParameterivEXT #define glGetHistogramParameterivEXT SAGE_glGetHistogramParameterivEXT #endif #ifndef glGetMinmaxEXT #define glGetMinmaxEXT SAGE_glGetMinmaxEXT #endif #ifndef glGetMinmaxParameterfvEXT #define glGetMinmaxParameterfvEXT SAGE_glGetMinmaxParameterfvEXT #endif #ifndef glGetMinmaxParameterivEXT #define glGetMinmaxParameterivEXT SAGE_glGetMinmaxParameterivEXT #endif #ifndef glHistogramEXT #define glHistogramEXT SAGE_glHistogramEXT #endif #ifndef glMinmaxEXT #define glMinmaxEXT SAGE_glMinmaxEXT #endif #ifndef glResetHistogramEXT #define glResetHistogramEXT SAGE_glResetHistogramEXT #endif #ifndef glResetMinmaxEXT #define glResetMinmaxEXT SAGE_glResetMinmaxEXT #endif #endif #ifndef GL_EXT_convolution #define GL_EXT_convolution 1 #ifndef glConvolutionFilter1DEXT #define glConvolutionFilter1DEXT SAGE_glConvolutionFilter1DEXT #endif #ifndef glConvolutionFilter2DEXT #define glConvolutionFilter2DEXT SAGE_glConvolutionFilter2DEXT #endif #ifndef glConvolutionParameterfEXT #define glConvolutionParameterfEXT SAGE_glConvolutionParameterfEXT #endif #ifndef glConvolutionParameterfvEXT #define glConvolutionParameterfvEXT SAGE_glConvolutionParameterfvEXT #endif #ifndef glConvolutionParameteriEXT #define glConvolutionParameteriEXT SAGE_glConvolutionParameteriEXT #endif #ifndef glConvolutionParameterivEXT #define glConvolutionParameterivEXT SAGE_glConvolutionParameterivEXT #endif #ifndef glCopyConvolutionFilter1DEXT #define glCopyConvolutionFilter1DEXT SAGE_glCopyConvolutionFilter1DEXT #endif #ifndef glCopyConvolutionFilter2DEXT #define glCopyConvolutionFilter2DEXT SAGE_glCopyConvolutionFilter2DEXT #endif #ifndef glGetConvolutionFilterEXT #define glGetConvolutionFilterEXT SAGE_glGetConvolutionFilterEXT #endif #ifndef glGetConvolutionParameterfvEXT #define glGetConvolutionParameterfvEXT SAGE_glGetConvolutionParameterfvEXT #endif #ifndef glGetConvolutionParameterivEXT #define glGetConvolutionParameterivEXT SAGE_glGetConvolutionParameterivEXT #endif #ifndef glGetSeparableFilterEXT #define glGetSeparableFilterEXT SAGE_glGetSeparableFilterEXT #endif #ifndef glSeparableFilter2DEXT #define glSeparableFilter2DEXT SAGE_glSeparableFilter2DEXT #endif #endif #ifndef GL_SGI_color_matrix #define GL_SGI_color_matrix 1 #endif #ifndef GL_SGI_color_table #define GL_SGI_color_table 1 #ifndef glColorTableSGI #define glColorTableSGI SAGE_glColorTableSGI #endif #ifndef glColorTableParameterfvSGI #define glColorTableParameterfvSGI SAGE_glColorTableParameterfvSGI #endif #ifndef glColorTableParameterivSGI #define glColorTableParameterivSGI SAGE_glColorTableParameterivSGI #endif #ifndef glCopyColorTableSGI #define glCopyColorTableSGI SAGE_glCopyColorTableSGI #endif #ifndef glGetColorTableSGI #define glGetColorTableSGI SAGE_glGetColorTableSGI #endif #ifndef glGetColorTableParameterfvSGI #define glGetColorTableParameterfvSGI SAGE_glGetColorTableParameterfvSGI #endif #ifndef glGetColorTableParameterivSGI #define glGetColorTableParameterivSGI SAGE_glGetColorTableParameterivSGI #endif #endif #ifndef GL_SGIX_pixel_texture #define GL_SGIX_pixel_texture 1 #ifndef glPixelTexGenSGIX #define glPixelTexGenSGIX SAGE_glPixelTexGenSGIX #endif #endif #ifndef GL_SGIS_pixel_texture #define GL_SGIS_pixel_texture 1 #ifndef glPixelTexGenParameteriSGIS #define glPixelTexGenParameteriSGIS SAGE_glPixelTexGenParameteriSGIS #endif #ifndef glPixelTexGenParameterivSGIS #define glPixelTexGenParameterivSGIS SAGE_glPixelTexGenParameterivSGIS #endif #ifndef glPixelTexGenParameterfSGIS #define glPixelTexGenParameterfSGIS SAGE_glPixelTexGenParameterfSGIS #endif #ifndef glPixelTexGenParameterfvSGIS #define glPixelTexGenParameterfvSGIS SAGE_glPixelTexGenParameterfvSGIS #endif #ifndef glGetPixelTexGenParameterivSGIS #define glGetPixelTexGenParameterivSGIS SAGE_glGetPixelTexGenParameterivSGIS #endif #ifndef glGetPixelTexGenParameterfvSGIS #define glGetPixelTexGenParameterfvSGIS SAGE_glGetPixelTexGenParameterfvSGIS #endif #endif #ifndef GL_SGIS_texture4D #define GL_SGIS_texture4D 1 #ifndef glTexImage4DSGIS #define glTexImage4DSGIS SAGE_glTexImage4DSGIS #endif #ifndef glTexSubImage4DSGIS #define glTexSubImage4DSGIS SAGE_glTexSubImage4DSGIS #endif #endif #ifndef GL_SGI_texture_color_table #define GL_SGI_texture_color_table 1 #endif #ifndef GL_EXT_cmyka #define GL_EXT_cmyka 1 #endif #ifndef GL_EXT_texture_object #define GL_EXT_texture_object 1 #ifndef glAreTexturesResidentEXT #define glAreTexturesResidentEXT SAGE_glAreTexturesResidentEXT #endif #ifndef glBindTextureEXT #define glBindTextureEXT SAGE_glBindTextureEXT #endif #ifndef glDeleteTexturesEXT #define glDeleteTexturesEXT SAGE_glDeleteTexturesEXT #endif #ifndef glGenTexturesEXT #define glGenTexturesEXT SAGE_glGenTexturesEXT #endif #ifndef glIsTextureEXT #define glIsTextureEXT SAGE_glIsTextureEXT #endif #ifndef glPrioritizeTexturesEXT #define glPrioritizeTexturesEXT SAGE_glPrioritizeTexturesEXT #endif #endif #ifndef GL_SGIS_detail_texture #define GL_SGIS_detail_texture 1 #ifndef glDetailTexFuncSGIS #define glDetailTexFuncSGIS SAGE_glDetailTexFuncSGIS #endif #ifndef glGetDetailTexFuncSGIS #define glGetDetailTexFuncSGIS SAGE_glGetDetailTexFuncSGIS #endif #endif #ifndef GL_SGIS_sharpen_texture #define GL_SGIS_sharpen_texture 1 #ifndef glSharpenTexFuncSGIS #define glSharpenTexFuncSGIS SAGE_glSharpenTexFuncSGIS #endif #ifndef glGetSharpenTexFuncSGIS #define glGetSharpenTexFuncSGIS SAGE_glGetSharpenTexFuncSGIS #endif #endif #ifndef GL_EXT_packed_pixels #define GL_EXT_packed_pixels 1 #endif #ifndef GL_SGIS_texture_lod #define GL_SGIS_texture_lod 1 #endif #ifndef GL_SGIS_multisample #define GL_SGIS_multisample 1 #ifndef glSampleMaskSGIS #define glSampleMaskSGIS SAGE_glSampleMaskSGIS #endif #ifndef glSamplePatternSGIS #define glSamplePatternSGIS SAGE_glSamplePatternSGIS #endif #endif #ifndef GL_EXT_rescale_normal #define GL_EXT_rescale_normal 1 #endif #ifndef GL_EXT_vertex_array #define GL_EXT_vertex_array 1 #ifndef glArrayElementEXT #define glArrayElementEXT SAGE_glArrayElementEXT #endif #ifndef glColorPointerEXT #define glColorPointerEXT SAGE_glColorPointerEXT #endif #ifndef glDrawArraysEXT #define glDrawArraysEXT SAGE_glDrawArraysEXT #endif #ifndef glEdgeFlagPointerEXT #define glEdgeFlagPointerEXT SAGE_glEdgeFlagPointerEXT #endif #ifndef glGetPointervEXT #define glGetPointervEXT SAGE_glGetPointervEXT #endif #ifndef glIndexPointerEXT #define glIndexPointerEXT SAGE_glIndexPointerEXT #endif #ifndef glNormalPointerEXT #define glNormalPointerEXT SAGE_glNormalPointerEXT #endif #ifndef glTexCoordPointerEXT #define glTexCoordPointerEXT SAGE_glTexCoordPointerEXT #endif #ifndef glVertexPointerEXT #define glVertexPointerEXT SAGE_glVertexPointerEXT #endif #endif #ifndef GL_EXT_misc_attribute #define GL_EXT_misc_attribute 1 #endif #ifndef GL_SGIS_generate_mipmap #define GL_SGIS_generate_mipmap 1 #endif #ifndef GL_SGIX_clipmap #define GL_SGIX_clipmap 1 #endif #ifndef GL_SGIX_shadow #define GL_SGIX_shadow 1 #endif #ifndef GL_SGIS_texture_edge_clamp #define GL_SGIS_texture_edge_clamp 1 #endif #ifndef GL_SGIS_texture_border_clamp #define GL_SGIS_texture_border_clamp 1 #endif #ifndef GL_EXT_blend_minmax #define GL_EXT_blend_minmax 1 #ifndef glBlendEquationEXT #define glBlendEquationEXT SAGE_glBlendEquationEXT #endif #endif #ifndef GL_EXT_blend_subtract #define GL_EXT_blend_subtract 1 #endif #ifndef GL_EXT_blend_logic_op #define GL_EXT_blend_logic_op 1 #endif #ifndef GL_SGIX_interlace #define GL_SGIX_interlace 1 #endif #ifndef GL_SGIX_pixel_tiles #define GL_SGIX_pixel_tiles 1 #endif #ifndef GL_SGIX_texture_select #define GL_SGIX_texture_select 1 #endif #ifndef GL_SGIX_sprite #define GL_SGIX_sprite 1 #ifndef glSpriteParameterfSGIX #define glSpriteParameterfSGIX SAGE_glSpriteParameterfSGIX #endif #ifndef glSpriteParameterfvSGIX #define glSpriteParameterfvSGIX SAGE_glSpriteParameterfvSGIX #endif #ifndef glSpriteParameteriSGIX #define glSpriteParameteriSGIX SAGE_glSpriteParameteriSGIX #endif #ifndef glSpriteParameterivSGIX #define glSpriteParameterivSGIX SAGE_glSpriteParameterivSGIX #endif #endif #ifndef GL_SGIX_texture_multi_buffer #define GL_SGIX_texture_multi_buffer 1 #endif #ifndef GL_EXT_point_parameters #define GL_EXT_point_parameters 1 #ifndef glPointParameterfEXT #define glPointParameterfEXT SAGE_glPointParameterfEXT #endif #ifndef glPointParameterfvEXT #define glPointParameterfvEXT SAGE_glPointParameterfvEXT #endif #endif #ifndef GL_SGIS_point_parameters #define GL_SGIS_point_parameters 1 #ifndef glPointParameterfSGIS #define glPointParameterfSGIS SAGE_glPointParameterfSGIS #endif #ifndef glPointParameterfvSGIS #define glPointParameterfvSGIS SAGE_glPointParameterfvSGIS #endif #endif #ifndef GL_SGIX_instruments #define GL_SGIX_instruments 1 #ifndef glGetInstrumentsSGIX #define glGetInstrumentsSGIX SAGE_glGetInstrumentsSGIX #endif #ifndef glInstrumentsBufferSGIX #define glInstrumentsBufferSGIX SAGE_glInstrumentsBufferSGIX #endif #ifndef glPollInstrumentsSGIX #define glPollInstrumentsSGIX SAGE_glPollInstrumentsSGIX #endif #ifndef glReadInstrumentsSGIX #define glReadInstrumentsSGIX SAGE_glReadInstrumentsSGIX #endif #ifndef glStartInstrumentsSGIX #define glStartInstrumentsSGIX SAGE_glStartInstrumentsSGIX #endif #ifndef glStopInstrumentsSGIX #define glStopInstrumentsSGIX SAGE_glStopInstrumentsSGIX #endif #endif #ifndef GL_SGIX_texture_scale_bias #define GL_SGIX_texture_scale_bias 1 #endif #ifndef GL_SGIX_framezoom #define GL_SGIX_framezoom 1 #ifndef glFrameZoomSGIX #define glFrameZoomSGIX SAGE_glFrameZoomSGIX #endif #endif #ifndef GL_SGIX_tag_sample_buffer #define GL_SGIX_tag_sample_buffer 1 #ifndef glTagSampleBufferSGIX #define glTagSampleBufferSGIX SAGE_glTagSampleBufferSGIX #endif #endif #ifndef GL_SGIX_polynomial_ffd #define GL_SGIX_polynomial_ffd 1 #ifndef glDeformationMap3dSGIX #define glDeformationMap3dSGIX SAGE_glDeformationMap3dSGIX #endif #ifndef glDeformationMap3fSGIX #define glDeformationMap3fSGIX SAGE_glDeformationMap3fSGIX #endif #ifndef glDeformSGIX #define glDeformSGIX SAGE_glDeformSGIX #endif #ifndef glLoadIdentityDeformationMapSGIX #define glLoadIdentityDeformationMapSGIX SAGE_glLoadIdentityDeformationMapSGIX #endif #endif #ifndef GL_SGIX_reference_plane #define GL_SGIX_reference_plane 1 #ifndef glReferencePlaneSGIX #define glReferencePlaneSGIX SAGE_glReferencePlaneSGIX #endif #endif #ifndef GL_SGIX_flush_raster #define GL_SGIX_flush_raster 1 #ifndef glFlushRasterSGIX #define glFlushRasterSGIX SAGE_glFlushRasterSGIX #endif #endif #ifndef GL_SGIX_depth_texture #define GL_SGIX_depth_texture 1 #endif #ifndef GL_SGIS_fog_function #define GL_SGIS_fog_function 1 #ifndef glFogFuncSGIS #define glFogFuncSGIS SAGE_glFogFuncSGIS #endif #ifndef glGetFogFuncSGIS #define glGetFogFuncSGIS SAGE_glGetFogFuncSGIS #endif #endif #ifndef GL_SGIX_fog_offset #define GL_SGIX_fog_offset 1 #endif #ifndef GL_HP_image_transform #define GL_HP_image_transform 1 #ifndef glImageTransformParameteriHP #define glImageTransformParameteriHP SAGE_glImageTransformParameteriHP #endif #ifndef glImageTransformParameterfHP #define glImageTransformParameterfHP SAGE_glImageTransformParameterfHP #endif #ifndef glImageTransformParameterivHP #define glImageTransformParameterivHP SAGE_glImageTransformParameterivHP #endif #ifndef glImageTransformParameterfvHP #define glImageTransformParameterfvHP SAGE_glImageTransformParameterfvHP #endif #ifndef glGetImageTransformParameterivHP #define glGetImageTransformParameterivHP SAGE_glGetImageTransformParameterivHP #endif #ifndef glGetImageTransformParameterfvHP #define glGetImageTransformParameterfvHP SAGE_glGetImageTransformParameterfvHP #endif #endif #ifndef GL_HP_convolution_border_modes #define GL_HP_convolution_border_modes 1 #endif #ifndef GL_SGIX_texture_add_env #define GL_SGIX_texture_add_env 1 #endif #ifndef GL_EXT_color_subtable #define GL_EXT_color_subtable 1 #ifndef glColorSubTableEXT #define glColorSubTableEXT SAGE_glColorSubTableEXT #endif #ifndef glCopyColorSubTableEXT #define glCopyColorSubTableEXT SAGE_glCopyColorSubTableEXT #endif #endif #ifndef GL_PGI_vertex_hints #define GL_PGI_vertex_hints 1 #endif #ifndef GL_PGI_misc_hints #define GL_PGI_misc_hints 1 #ifndef glHintPGI #define glHintPGI SAGE_glHintPGI #endif #endif #ifndef GL_EXT_paletted_texture #define GL_EXT_paletted_texture 1 #ifndef glColorTableEXT #define glColorTableEXT SAGE_glColorTableEXT #endif #ifndef glGetColorTableEXT #define glGetColorTableEXT SAGE_glGetColorTableEXT #endif #ifndef glGetColorTableParameterivEXT #define glGetColorTableParameterivEXT SAGE_glGetColorTableParameterivEXT #endif #ifndef glGetColorTableParameterfvEXT #define glGetColorTableParameterfvEXT SAGE_glGetColorTableParameterfvEXT #endif #endif #ifndef GL_EXT_clip_volume_hint #define GL_EXT_clip_volume_hint 1 #endif #ifndef GL_SGIX_list_priority #define GL_SGIX_list_priority 1 #ifndef glGetListParameterfvSGIX #define glGetListParameterfvSGIX SAGE_glGetListParameterfvSGIX #endif #ifndef glGetListParameterivSGIX #define glGetListParameterivSGIX SAGE_glGetListParameterivSGIX #endif #ifndef glListParameterfSGIX #define glListParameterfSGIX SAGE_glListParameterfSGIX #endif #ifndef glListParameterfvSGIX #define glListParameterfvSGIX SAGE_glListParameterfvSGIX #endif #ifndef glListParameteriSGIX #define glListParameteriSGIX SAGE_glListParameteriSGIX #endif #ifndef glListParameterivSGIX #define glListParameterivSGIX SAGE_glListParameterivSGIX #endif #endif #ifndef GL_SGIX_ir_instrument1 #define GL_SGIX_ir_instrument1 1 #endif #ifndef GL_SGIX_calligraphic_fragment #define GL_SGIX_calligraphic_fragment 1 #endif #ifndef GL_SGIX_texture_lod_bias #define GL_SGIX_texture_lod_bias 1 #endif #ifndef GL_SGIX_shadow_ambient #define GL_SGIX_shadow_ambient 1 #endif #ifndef GL_EXT_index_texture #define GL_EXT_index_texture 1 #endif #ifndef GL_EXT_index_material #define GL_EXT_index_material 1 #ifndef glIndexMaterialEXT #define glIndexMaterialEXT SAGE_glIndexMaterialEXT #endif #endif #ifndef GL_EXT_index_func #define GL_EXT_index_func 1 #ifndef glIndexFuncEXT #define glIndexFuncEXT SAGE_glIndexFuncEXT #endif #endif #ifndef GL_EXT_index_array_formats #define GL_EXT_index_array_formats 1 #endif #ifndef GL_EXT_compiled_vertex_array #define GL_EXT_compiled_vertex_array 1 #ifndef glLockArraysEXT #define glLockArraysEXT SAGE_glLockArraysEXT #endif #ifndef glUnlockArraysEXT #define glUnlockArraysEXT SAGE_glUnlockArraysEXT #endif #endif #ifndef GL_EXT_cull_vertex #define GL_EXT_cull_vertex 1 #ifndef glCullParameterdvEXT #define glCullParameterdvEXT SAGE_glCullParameterdvEXT #endif #ifndef glCullParameterfvEXT #define glCullParameterfvEXT SAGE_glCullParameterfvEXT #endif #endif #ifndef GL_SGIX_ycrcb #define GL_SGIX_ycrcb 1 #endif #ifndef GL_SGIX_fragment_lighting #define GL_SGIX_fragment_lighting 1 #ifndef glFragmentColorMaterialSGIX #define glFragmentColorMaterialSGIX SAGE_glFragmentColorMaterialSGIX #endif #ifndef glFragmentLightfSGIX #define glFragmentLightfSGIX SAGE_glFragmentLightfSGIX #endif #ifndef glFragmentLightfvSGIX #define glFragmentLightfvSGIX SAGE_glFragmentLightfvSGIX #endif #ifndef glFragmentLightiSGIX #define glFragmentLightiSGIX SAGE_glFragmentLightiSGIX #endif #ifndef glFragmentLightivSGIX #define glFragmentLightivSGIX SAGE_glFragmentLightivSGIX #endif #ifndef glFragmentLightModelfSGIX #define glFragmentLightModelfSGIX SAGE_glFragmentLightModelfSGIX #endif #ifndef glFragmentLightModelfvSGIX #define glFragmentLightModelfvSGIX SAGE_glFragmentLightModelfvSGIX #endif #ifndef glFragmentLightModeliSGIX #define glFragmentLightModeliSGIX SAGE_glFragmentLightModeliSGIX #endif #ifndef glFragmentLightModelivSGIX #define glFragmentLightModelivSGIX SAGE_glFragmentLightModelivSGIX #endif #ifndef glFragmentMaterialfSGIX #define glFragmentMaterialfSGIX SAGE_glFragmentMaterialfSGIX #endif #ifndef glFragmentMaterialfvSGIX #define glFragmentMaterialfvSGIX SAGE_glFragmentMaterialfvSGIX #endif #ifndef glFragmentMaterialiSGIX #define glFragmentMaterialiSGIX SAGE_glFragmentMaterialiSGIX #endif #ifndef glFragmentMaterialivSGIX #define glFragmentMaterialivSGIX SAGE_glFragmentMaterialivSGIX #endif #ifndef glGetFragmentLightfvSGIX #define glGetFragmentLightfvSGIX SAGE_glGetFragmentLightfvSGIX #endif #ifndef glGetFragmentLightivSGIX #define glGetFragmentLightivSGIX SAGE_glGetFragmentLightivSGIX #endif #ifndef glGetFragmentMaterialfvSGIX #define glGetFragmentMaterialfvSGIX SAGE_glGetFragmentMaterialfvSGIX #endif #ifndef glGetFragmentMaterialivSGIX #define glGetFragmentMaterialivSGIX SAGE_glGetFragmentMaterialivSGIX #endif #ifndef glLightEnviSGIX #define glLightEnviSGIX SAGE_glLightEnviSGIX #endif #endif #ifndef GL_IBM_rasterpos_clip #define GL_IBM_rasterpos_clip 1 #endif #ifndef GL_HP_texture_lighting #define GL_HP_texture_lighting 1 #endif #ifndef GL_EXT_draw_range_elements #define GL_EXT_draw_range_elements 1 #ifndef glDrawRangeElementsEXT #define glDrawRangeElementsEXT SAGE_glDrawRangeElementsEXT #endif #endif #ifndef GL_WIN_phong_shading #define GL_WIN_phong_shading 1 #endif #ifndef GL_WIN_specular_fog #define GL_WIN_specular_fog 1 #endif #ifndef GL_EXT_light_texture #define GL_EXT_light_texture 1 #ifndef glApplyTextureEXT #define glApplyTextureEXT SAGE_glApplyTextureEXT #endif #ifndef glTextureLightEXT #define glTextureLightEXT SAGE_glTextureLightEXT #endif #ifndef glTextureMaterialEXT #define glTextureMaterialEXT SAGE_glTextureMaterialEXT #endif #endif #ifndef GL_SGIX_blend_alpha_minmax #define GL_SGIX_blend_alpha_minmax 1 #endif #ifndef GL_EXT_bgra #define GL_EXT_bgra 1 #endif #ifndef GL_SGIX_async #define GL_SGIX_async 1 #ifndef glAsyncMarkerSGIX #define glAsyncMarkerSGIX SAGE_glAsyncMarkerSGIX #endif #ifndef glFinishAsyncSGIX #define glFinishAsyncSGIX SAGE_glFinishAsyncSGIX #endif #ifndef glPollAsyncSGIX #define glPollAsyncSGIX SAGE_glPollAsyncSGIX #endif #ifndef glGenAsyncMarkersSGIX #define glGenAsyncMarkersSGIX SAGE_glGenAsyncMarkersSGIX #endif #ifndef glDeleteAsyncMarkersSGIX #define glDeleteAsyncMarkersSGIX SAGE_glDeleteAsyncMarkersSGIX #endif #ifndef glIsAsyncMarkerSGIX #define glIsAsyncMarkerSGIX SAGE_glIsAsyncMarkerSGIX #endif #endif #ifndef GL_SGIX_async_pixel #define GL_SGIX_async_pixel 1 #endif #ifndef GL_SGIX_async_histogram #define GL_SGIX_async_histogram 1 #endif #ifndef GL_INTEL_parallel_arrays #define GL_INTEL_parallel_arrays 1 #ifndef glVertexPointervINTEL #define glVertexPointervINTEL SAGE_glVertexPointervINTEL #endif #ifndef glNormalPointervINTEL #define glNormalPointervINTEL SAGE_glNormalPointervINTEL #endif #ifndef glColorPointervINTEL #define glColorPointervINTEL SAGE_glColorPointervINTEL #endif #ifndef glTexCoordPointervINTEL #define glTexCoordPointervINTEL SAGE_glTexCoordPointervINTEL #endif #endif #ifndef GL_HP_occlusion_test #define GL_HP_occlusion_test 1 #endif #ifndef GL_EXT_pixel_transform #define GL_EXT_pixel_transform 1 #ifndef glPixelTransformParameteriEXT #define glPixelTransformParameteriEXT SAGE_glPixelTransformParameteriEXT #endif #ifndef glPixelTransformParameterfEXT #define glPixelTransformParameterfEXT SAGE_glPixelTransformParameterfEXT #endif #ifndef glPixelTransformParameterivEXT #define glPixelTransformParameterivEXT SAGE_glPixelTransformParameterivEXT #endif #ifndef glPixelTransformParameterfvEXT #define glPixelTransformParameterfvEXT SAGE_glPixelTransformParameterfvEXT #endif #endif #ifndef GL_EXT_pixel_transform_color_table #define GL_EXT_pixel_transform_color_table 1 #endif #ifndef GL_EXT_shared_texture_palette #define GL_EXT_shared_texture_palette 1 #endif #ifndef GL_EXT_separate_specular_color #define GL_EXT_separate_specular_color 1 #endif #ifndef GL_EXT_secondary_color #define GL_EXT_secondary_color 1 #ifndef glSecondaryColor3bEXT #define glSecondaryColor3bEXT SAGE_glSecondaryColor3bEXT #endif #ifndef glSecondaryColor3bvEXT #define glSecondaryColor3bvEXT SAGE_glSecondaryColor3bvEXT #endif #ifndef glSecondaryColor3dEXT #define glSecondaryColor3dEXT SAGE_glSecondaryColor3dEXT #endif #ifndef glSecondaryColor3dvEXT #define glSecondaryColor3dvEXT SAGE_glSecondaryColor3dvEXT #endif #ifndef glSecondaryColor3fEXT #define glSecondaryColor3fEXT SAGE_glSecondaryColor3fEXT #endif #ifndef glSecondaryColor3fvEXT #define glSecondaryColor3fvEXT SAGE_glSecondaryColor3fvEXT #endif #ifndef glSecondaryColor3iEXT #define glSecondaryColor3iEXT SAGE_glSecondaryColor3iEXT #endif #ifndef glSecondaryColor3ivEXT #define glSecondaryColor3ivEXT SAGE_glSecondaryColor3ivEXT #endif #ifndef glSecondaryColor3sEXT #define glSecondaryColor3sEXT SAGE_glSecondaryColor3sEXT #endif #ifndef glSecondaryColor3svEXT #define glSecondaryColor3svEXT SAGE_glSecondaryColor3svEXT #endif #ifndef glSecondaryColor3ubEXT #define glSecondaryColor3ubEXT SAGE_glSecondaryColor3ubEXT #endif #ifndef glSecondaryColor3ubvEXT #define glSecondaryColor3ubvEXT SAGE_glSecondaryColor3ubvEXT #endif #ifndef glSecondaryColor3uiEXT #define glSecondaryColor3uiEXT SAGE_glSecondaryColor3uiEXT #endif #ifndef glSecondaryColor3uivEXT #define glSecondaryColor3uivEXT SAGE_glSecondaryColor3uivEXT #endif #ifndef glSecondaryColor3usEXT #define glSecondaryColor3usEXT SAGE_glSecondaryColor3usEXT #endif #ifndef glSecondaryColor3usvEXT #define glSecondaryColor3usvEXT SAGE_glSecondaryColor3usvEXT #endif #ifndef glSecondaryColorPointerEXT #define glSecondaryColorPointerEXT SAGE_glSecondaryColorPointerEXT #endif #endif #ifndef GL_EXT_texture_perturb_normal #define GL_EXT_texture_perturb_normal 1 #ifndef glTextureNormalEXT #define glTextureNormalEXT SAGE_glTextureNormalEXT #endif #endif #ifndef GL_EXT_multi_draw_arrays #define GL_EXT_multi_draw_arrays 1 #ifndef glMultiDrawArraysEXT #define glMultiDrawArraysEXT SAGE_glMultiDrawArraysEXT #endif #ifndef glMultiDrawElementsEXT #define glMultiDrawElementsEXT SAGE_glMultiDrawElementsEXT #endif #endif #ifndef GL_EXT_fog_coord #define GL_EXT_fog_coord 1 #ifndef glFogCoordfEXT #define glFogCoordfEXT SAGE_glFogCoordfEXT #endif #ifndef glFogCoordfvEXT #define glFogCoordfvEXT SAGE_glFogCoordfvEXT #endif #ifndef glFogCoorddEXT #define glFogCoorddEXT SAGE_glFogCoorddEXT #endif #ifndef glFogCoorddvEXT #define glFogCoorddvEXT SAGE_glFogCoorddvEXT #endif #ifndef glFogCoordPointerEXT #define glFogCoordPointerEXT SAGE_glFogCoordPointerEXT #endif #endif #ifndef GL_REND_screen_coordinates #define GL_REND_screen_coordinates 1 #endif #ifndef GL_EXT_coordinate_frame #define GL_EXT_coordinate_frame 1 #ifndef glTangent3bEXT #define glTangent3bEXT SAGE_glTangent3bEXT #endif #ifndef glTangent3bvEXT #define glTangent3bvEXT SAGE_glTangent3bvEXT #endif #ifndef glTangent3dEXT #define glTangent3dEXT SAGE_glTangent3dEXT #endif #ifndef glTangent3dvEXT #define glTangent3dvEXT SAGE_glTangent3dvEXT #endif #ifndef glTangent3fEXT #define glTangent3fEXT SAGE_glTangent3fEXT #endif #ifndef glTangent3fvEXT #define glTangent3fvEXT SAGE_glTangent3fvEXT #endif #ifndef glTangent3iEXT #define glTangent3iEXT SAGE_glTangent3iEXT #endif #ifndef glTangent3ivEXT #define glTangent3ivEXT SAGE_glTangent3ivEXT #endif #ifndef glTangent3sEXT #define glTangent3sEXT SAGE_glTangent3sEXT #endif #ifndef glTangent3svEXT #define glTangent3svEXT SAGE_glTangent3svEXT #endif #ifndef glBinormal3bEXT #define glBinormal3bEXT SAGE_glBinormal3bEXT #endif #ifndef glBinormal3bvEXT #define glBinormal3bvEXT SAGE_glBinormal3bvEXT #endif #ifndef glBinormal3dEXT #define glBinormal3dEXT SAGE_glBinormal3dEXT #endif #ifndef glBinormal3dvEXT #define glBinormal3dvEXT SAGE_glBinormal3dvEXT #endif #ifndef glBinormal3fEXT #define glBinormal3fEXT SAGE_glBinormal3fEXT #endif #ifndef glBinormal3fvEXT #define glBinormal3fvEXT SAGE_glBinormal3fvEXT #endif #ifndef glBinormal3iEXT #define glBinormal3iEXT SAGE_glBinormal3iEXT #endif #ifndef glBinormal3ivEXT #define glBinormal3ivEXT SAGE_glBinormal3ivEXT #endif #ifndef glBinormal3sEXT #define glBinormal3sEXT SAGE_glBinormal3sEXT #endif #ifndef glBinormal3svEXT #define glBinormal3svEXT SAGE_glBinormal3svEXT #endif #ifndef glTangentPointerEXT #define glTangentPointerEXT SAGE_glTangentPointerEXT #endif #ifndef glBinormalPointerEXT #define glBinormalPointerEXT SAGE_glBinormalPointerEXT #endif #endif #ifndef GL_EXT_texture_env_combine #define GL_EXT_texture_env_combine 1 #endif #ifndef GL_APPLE_specular_vector #define GL_APPLE_specular_vector 1 #endif #ifndef GL_APPLE_transform_hint #define GL_APPLE_transform_hint 1 #endif #ifndef GL_SGIX_fog_scale #define GL_SGIX_fog_scale 1 #endif #ifndef GL_SUNX_constant_data #define GL_SUNX_constant_data 1 #ifndef glFinishTextureSUNX #define glFinishTextureSUNX SAGE_glFinishTextureSUNX #endif #endif #ifndef GL_SUN_global_alpha #define GL_SUN_global_alpha 1 #ifndef glGlobalAlphaFactorbSUN #define glGlobalAlphaFactorbSUN SAGE_glGlobalAlphaFactorbSUN #endif #ifndef glGlobalAlphaFactorsSUN #define glGlobalAlphaFactorsSUN SAGE_glGlobalAlphaFactorsSUN #endif #ifndef glGlobalAlphaFactoriSUN #define glGlobalAlphaFactoriSUN SAGE_glGlobalAlphaFactoriSUN #endif #ifndef glGlobalAlphaFactorfSUN #define glGlobalAlphaFactorfSUN SAGE_glGlobalAlphaFactorfSUN #endif #ifndef glGlobalAlphaFactordSUN #define glGlobalAlphaFactordSUN SAGE_glGlobalAlphaFactordSUN #endif #ifndef glGlobalAlphaFactorubSUN #define glGlobalAlphaFactorubSUN SAGE_glGlobalAlphaFactorubSUN #endif #ifndef glGlobalAlphaFactorusSUN #define glGlobalAlphaFactorusSUN SAGE_glGlobalAlphaFactorusSUN #endif #ifndef glGlobalAlphaFactoruiSUN #define glGlobalAlphaFactoruiSUN SAGE_glGlobalAlphaFactoruiSUN #endif #endif #ifndef GL_SUN_triangle_list #define GL_SUN_triangle_list 1 #ifndef glReplacementCodeuiSUN #define glReplacementCodeuiSUN SAGE_glReplacementCodeuiSUN #endif #ifndef glReplacementCodeusSUN #define glReplacementCodeusSUN SAGE_glReplacementCodeusSUN #endif #ifndef glReplacementCodeubSUN #define glReplacementCodeubSUN SAGE_glReplacementCodeubSUN #endif #ifndef glReplacementCodeuivSUN #define glReplacementCodeuivSUN SAGE_glReplacementCodeuivSUN #endif #ifndef glReplacementCodeusvSUN #define glReplacementCodeusvSUN SAGE_glReplacementCodeusvSUN #endif #ifndef glReplacementCodeubvSUN #define glReplacementCodeubvSUN SAGE_glReplacementCodeubvSUN #endif #ifndef glReplacementCodePointerSUN #define glReplacementCodePointerSUN SAGE_glReplacementCodePointerSUN #endif #endif #ifndef GL_SUN_vertex #define GL_SUN_vertex 1 #ifndef glColor4ubVertex2fSUN #define glColor4ubVertex2fSUN SAGE_glColor4ubVertex2fSUN #endif #ifndef glColor4ubVertex2fvSUN #define glColor4ubVertex2fvSUN SAGE_glColor4ubVertex2fvSUN #endif #ifndef glColor4ubVertex3fSUN #define glColor4ubVertex3fSUN SAGE_glColor4ubVertex3fSUN #endif #ifndef glColor4ubVertex3fvSUN #define glColor4ubVertex3fvSUN SAGE_glColor4ubVertex3fvSUN #endif #ifndef glColor3fVertex3fSUN #define glColor3fVertex3fSUN SAGE_glColor3fVertex3fSUN #endif #ifndef glColor3fVertex3fvSUN #define glColor3fVertex3fvSUN SAGE_glColor3fVertex3fvSUN #endif #ifndef glNormal3fVertex3fSUN #define glNormal3fVertex3fSUN SAGE_glNormal3fVertex3fSUN #endif #ifndef glNormal3fVertex3fvSUN #define glNormal3fVertex3fvSUN SAGE_glNormal3fVertex3fvSUN #endif #ifndef glColor4fNormal3fVertex3fSUN #define glColor4fNormal3fVertex3fSUN SAGE_glColor4fNormal3fVertex3fSUN #endif #ifndef glColor4fNormal3fVertex3fvSUN #define glColor4fNormal3fVertex3fvSUN SAGE_glColor4fNormal3fVertex3fvSUN #endif #ifndef glTexCoord2fVertex3fSUN #define glTexCoord2fVertex3fSUN SAGE_glTexCoord2fVertex3fSUN #endif #ifndef glTexCoord2fVertex3fvSUN #define glTexCoord2fVertex3fvSUN SAGE_glTexCoord2fVertex3fvSUN #endif #ifndef glTexCoord4fVertex4fSUN #define glTexCoord4fVertex4fSUN SAGE_glTexCoord4fVertex4fSUN #endif #ifndef glTexCoord4fVertex4fvSUN #define glTexCoord4fVertex4fvSUN SAGE_glTexCoord4fVertex4fvSUN #endif #ifndef glTexCoord2fColor4ubVertex3fSUN #define glTexCoord2fColor4ubVertex3fSUN SAGE_glTexCoord2fColor4ubVertex3fSUN #endif #ifndef glTexCoord2fColor4ubVertex3fvSUN #define glTexCoord2fColor4ubVertex3fvSUN SAGE_glTexCoord2fColor4ubVertex3fvSUN #endif #ifndef glTexCoord2fColor3fVertex3fSUN #define glTexCoord2fColor3fVertex3fSUN SAGE_glTexCoord2fColor3fVertex3fSUN #endif #ifndef glTexCoord2fColor3fVertex3fvSUN #define glTexCoord2fColor3fVertex3fvSUN SAGE_glTexCoord2fColor3fVertex3fvSUN #endif #ifndef glTexCoord2fNormal3fVertex3fSUN #define glTexCoord2fNormal3fVertex3fSUN SAGE_glTexCoord2fNormal3fVertex3fSUN #endif #ifndef glTexCoord2fNormal3fVertex3fvSUN #define glTexCoord2fNormal3fVertex3fvSUN SAGE_glTexCoord2fNormal3fVertex3fvSUN #endif #ifndef glTexCoord2fColor4fNormal3fVertex3fSUN #define glTexCoord2fColor4fNormal3fVertex3fSUN SAGE_glTexCoord2fColor4fNormal3fVertex3fSUN #endif #ifndef glTexCoord2fColor4fNormal3fVertex3fvSUN #define glTexCoord2fColor4fNormal3fVertex3fvSUN SAGE_glTexCoord2fColor4fNormal3fVertex3fvSUN #endif #ifndef glTexCoord4fColor4fNormal3fVertex4fSUN #define glTexCoord4fColor4fNormal3fVertex4fSUN SAGE_glTexCoord4fColor4fNormal3fVertex4fSUN #endif #ifndef glTexCoord4fColor4fNormal3fVertex4fvSUN #define glTexCoord4fColor4fNormal3fVertex4fvSUN SAGE_glTexCoord4fColor4fNormal3fVertex4fvSUN #endif #ifndef glReplacementCodeuiVertex3fSUN #define glReplacementCodeuiVertex3fSUN SAGE_glReplacementCodeuiVertex3fSUN #endif #ifndef glReplacementCodeuiVertex3fvSUN #define glReplacementCodeuiVertex3fvSUN SAGE_glReplacementCodeuiVertex3fvSUN #endif #ifndef glReplacementCodeuiColor4ubVertex3fSUN #define glReplacementCodeuiColor4ubVertex3fSUN SAGE_glReplacementCodeuiColor4ubVertex3fSUN #endif #ifndef glReplacementCodeuiColor4ubVertex3fvSUN #define glReplacementCodeuiColor4ubVertex3fvSUN SAGE_glReplacementCodeuiColor4ubVertex3fvSUN #endif #ifndef glReplacementCodeuiColor3fVertex3fSUN #define glReplacementCodeuiColor3fVertex3fSUN SAGE_glReplacementCodeuiColor3fVertex3fSUN #endif #ifndef glReplacementCodeuiColor3fVertex3fvSUN #define glReplacementCodeuiColor3fVertex3fvSUN SAGE_glReplacementCodeuiColor3fVertex3fvSUN #endif #ifndef glReplacementCodeuiNormal3fVertex3fSUN #define glReplacementCodeuiNormal3fVertex3fSUN SAGE_glReplacementCodeuiNormal3fVertex3fSUN #endif #ifndef glReplacementCodeuiNormal3fVertex3fvSUN #define glReplacementCodeuiNormal3fVertex3fvSUN SAGE_glReplacementCodeuiNormal3fVertex3fvSUN #endif #ifndef glReplacementCodeuiColor4fNormal3fVertex3fSUN #define glReplacementCodeuiColor4fNormal3fVertex3fSUN SAGE_glReplacementCodeuiColor4fNormal3fVertex3fSUN #endif #ifndef glReplacementCodeuiColor4fNormal3fVertex3fvSUN #define glReplacementCodeuiColor4fNormal3fVertex3fvSUN SAGE_glReplacementCodeuiColor4fNormal3fVertex3fvSUN #endif #ifndef glReplacementCodeuiTexCoord2fVertex3fSUN #define glReplacementCodeuiTexCoord2fVertex3fSUN SAGE_glReplacementCodeuiTexCoord2fVertex3fSUN #endif #ifndef glReplacementCodeuiTexCoord2fVertex3fvSUN #define glReplacementCodeuiTexCoord2fVertex3fvSUN SAGE_glReplacementCodeuiTexCoord2fVertex3fvSUN #endif #ifndef glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN #define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN SAGE_glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN #endif #ifndef glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN #define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN SAGE_glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN #endif #ifndef glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN #define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN SAGE_glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN #endif #ifndef glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN #define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN SAGE_glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN #endif #endif #ifndef GL_EXT_blend_func_separate #define GL_EXT_blend_func_separate 1 #ifndef glBlendFuncSeparateEXT #define glBlendFuncSeparateEXT SAGE_glBlendFuncSeparateEXT #endif #endif #ifndef GL_INGR_blend_func_separate #define GL_INGR_blend_func_separate 1 #ifndef glBlendFuncSeparateINGR #define glBlendFuncSeparateINGR SAGE_glBlendFuncSeparateINGR #endif #endif #ifndef GL_INGR_color_clamp #define GL_INGR_color_clamp 1 #endif #ifndef GL_INGR_interlace_read #define GL_INGR_interlace_read 1 #endif #ifndef GL_EXT_stencil_wrap #define GL_EXT_stencil_wrap 1 #endif #ifndef GL_EXT_422_pixels #define GL_EXT_422_pixels 1 #endif #ifndef GL_NV_texgen_reflection #define GL_NV_texgen_reflection 1 #endif #ifndef GL_SUN_convolution_border_modes #define GL_SUN_convolution_border_modes 1 #endif #ifndef GL_EXT_texture_env_add #define GL_EXT_texture_env_add 1 #endif #ifndef GL_EXT_texture_lod_bias #define GL_EXT_texture_lod_bias 1 #endif #ifndef GL_EXT_texture_filter_anisotropic #define GL_EXT_texture_filter_anisotropic 1 #endif #ifndef GL_EXT_vertex_weighting #define GL_EXT_vertex_weighting 1 #ifndef glVertexWeightfEXT #define glVertexWeightfEXT SAGE_glVertexWeightfEXT #endif #ifndef glVertexWeightfvEXT #define glVertexWeightfvEXT SAGE_glVertexWeightfvEXT #endif #ifndef glVertexWeightPointerEXT #define glVertexWeightPointerEXT SAGE_glVertexWeightPointerEXT #endif #endif #ifndef GL_NV_light_max_exponent #define GL_NV_light_max_exponent 1 #endif #ifndef GL_NV_vertex_array_range #define GL_NV_vertex_array_range 1 #ifndef glFlushVertexArrayRangeNV #define glFlushVertexArrayRangeNV SAGE_glFlushVertexArrayRangeNV #endif #ifndef glVertexArrayRangeNV #define glVertexArrayRangeNV SAGE_glVertexArrayRangeNV #endif #endif #ifndef GL_NV_register_combiners #define GL_NV_register_combiners 1 #ifndef glCombinerParameterfvNV #define glCombinerParameterfvNV SAGE_glCombinerParameterfvNV #endif #ifndef glCombinerParameterfNV #define glCombinerParameterfNV SAGE_glCombinerParameterfNV #endif #ifndef glCombinerParameterivNV #define glCombinerParameterivNV SAGE_glCombinerParameterivNV #endif #ifndef glCombinerParameteriNV #define glCombinerParameteriNV SAGE_glCombinerParameteriNV #endif #ifndef glCombinerInputNV #define glCombinerInputNV SAGE_glCombinerInputNV #endif #ifndef glCombinerOutputNV #define glCombinerOutputNV SAGE_glCombinerOutputNV #endif #ifndef glFinalCombinerInputNV #define glFinalCombinerInputNV SAGE_glFinalCombinerInputNV #endif #ifndef glGetCombinerInputParameterfvNV #define glGetCombinerInputParameterfvNV SAGE_glGetCombinerInputParameterfvNV #endif #ifndef glGetCombinerInputParameterivNV #define glGetCombinerInputParameterivNV SAGE_glGetCombinerInputParameterivNV #endif #ifndef glGetCombinerOutputParameterfvNV #define glGetCombinerOutputParameterfvNV SAGE_glGetCombinerOutputParameterfvNV #endif #ifndef glGetCombinerOutputParameterivNV #define glGetCombinerOutputParameterivNV SAGE_glGetCombinerOutputParameterivNV #endif #ifndef glGetFinalCombinerInputParameterfvNV #define glGetFinalCombinerInputParameterfvNV SAGE_glGetFinalCombinerInputParameterfvNV #endif #ifndef glGetFinalCombinerInputParameterivNV #define glGetFinalCombinerInputParameterivNV SAGE_glGetFinalCombinerInputParameterivNV #endif #endif #ifndef GL_NV_fog_distance #define GL_NV_fog_distance 1 #endif #ifndef GL_NV_texgen_emboss #define GL_NV_texgen_emboss 1 #endif #ifndef GL_NV_blend_square #define GL_NV_blend_square 1 #endif #ifndef GL_NV_texture_env_combine4 #define GL_NV_texture_env_combine4 1 #endif #ifndef GL_MESA_resize_buffers #define GL_MESA_resize_buffers 1 #ifndef glResizeBuffersMESA #define glResizeBuffersMESA SAGE_glResizeBuffersMESA #endif #endif #ifndef GL_MESA_window_pos #define GL_MESA_window_pos 1 #ifndef glWindowPos2dMESA #define glWindowPos2dMESA SAGE_glWindowPos2dMESA #endif #ifndef glWindowPos2dvMESA #define glWindowPos2dvMESA SAGE_glWindowPos2dvMESA #endif #ifndef glWindowPos2fMESA #define glWindowPos2fMESA SAGE_glWindowPos2fMESA #endif #ifndef glWindowPos2fvMESA #define glWindowPos2fvMESA SAGE_glWindowPos2fvMESA #endif #ifndef glWindowPos2iMESA #define glWindowPos2iMESA SAGE_glWindowPos2iMESA #endif #ifndef glWindowPos2ivMESA #define glWindowPos2ivMESA SAGE_glWindowPos2ivMESA #endif #ifndef glWindowPos2sMESA #define glWindowPos2sMESA SAGE_glWindowPos2sMESA #endif #ifndef glWindowPos2svMESA #define glWindowPos2svMESA SAGE_glWindowPos2svMESA #endif #ifndef glWindowPos3dMESA #define glWindowPos3dMESA SAGE_glWindowPos3dMESA #endif #ifndef glWindowPos3dvMESA #define glWindowPos3dvMESA SAGE_glWindowPos3dvMESA #endif #ifndef glWindowPos3fMESA #define glWindowPos3fMESA SAGE_glWindowPos3fMESA #endif #ifndef glWindowPos3fvMESA #define glWindowPos3fvMESA SAGE_glWindowPos3fvMESA #endif #ifndef glWindowPos3iMESA #define glWindowPos3iMESA SAGE_glWindowPos3iMESA #endif #ifndef glWindowPos3ivMESA #define glWindowPos3ivMESA SAGE_glWindowPos3ivMESA #endif #ifndef glWindowPos3sMESA #define glWindowPos3sMESA SAGE_glWindowPos3sMESA #endif #ifndef glWindowPos3svMESA #define glWindowPos3svMESA SAGE_glWindowPos3svMESA #endif #ifndef glWindowPos4dMESA #define glWindowPos4dMESA SAGE_glWindowPos4dMESA #endif #ifndef glWindowPos4dvMESA #define glWindowPos4dvMESA SAGE_glWindowPos4dvMESA #endif #ifndef glWindowPos4fMESA #define glWindowPos4fMESA SAGE_glWindowPos4fMESA #endif #ifndef glWindowPos4fvMESA #define glWindowPos4fvMESA SAGE_glWindowPos4fvMESA #endif #ifndef glWindowPos4iMESA #define glWindowPos4iMESA SAGE_glWindowPos4iMESA #endif #ifndef glWindowPos4ivMESA #define glWindowPos4ivMESA SAGE_glWindowPos4ivMESA #endif #ifndef glWindowPos4sMESA #define glWindowPos4sMESA SAGE_glWindowPos4sMESA #endif #ifndef glWindowPos4svMESA #define glWindowPos4svMESA SAGE_glWindowPos4svMESA #endif #endif #ifndef GL_IBM_cull_vertex #define GL_IBM_cull_vertex 1 #endif #ifndef GL_IBM_multimode_draw_arrays #define GL_IBM_multimode_draw_arrays 1 #ifndef glMultiModeDrawArraysIBM #define glMultiModeDrawArraysIBM SAGE_glMultiModeDrawArraysIBM #endif #ifndef glMultiModeDrawElementsIBM #define glMultiModeDrawElementsIBM SAGE_glMultiModeDrawElementsIBM #endif #endif #ifndef GL_IBM_vertex_array_lists #define GL_IBM_vertex_array_lists 1 #ifndef glColorPointerListIBM #define glColorPointerListIBM SAGE_glColorPointerListIBM #endif #ifndef glSecondaryColorPointerListIBM #define glSecondaryColorPointerListIBM SAGE_glSecondaryColorPointerListIBM #endif #ifndef glEdgeFlagPointerListIBM #define glEdgeFlagPointerListIBM SAGE_glEdgeFlagPointerListIBM #endif #ifndef glFogCoordPointerListIBM #define glFogCoordPointerListIBM SAGE_glFogCoordPointerListIBM #endif #ifndef glIndexPointerListIBM #define glIndexPointerListIBM SAGE_glIndexPointerListIBM #endif #ifndef glNormalPointerListIBM #define glNormalPointerListIBM SAGE_glNormalPointerListIBM #endif #ifndef glTexCoordPointerListIBM #define glTexCoordPointerListIBM SAGE_glTexCoordPointerListIBM #endif #ifndef glVertexPointerListIBM #define glVertexPointerListIBM SAGE_glVertexPointerListIBM #endif #endif #ifndef GL_SGIX_subsample #define GL_SGIX_subsample 1 #endif #ifndef GL_SGIX_ycrcba #define GL_SGIX_ycrcba 1 #endif #ifndef GL_SGIX_ycrcb_subsample #define GL_SGIX_ycrcb_subsample 1 #endif #ifndef GL_SGIX_depth_pass_instrument #define GL_SGIX_depth_pass_instrument 1 #endif #ifndef GL_3DFX_texture_compression_FXT1 #define GL_3DFX_texture_compression_FXT1 1 #endif #ifndef GL_3DFX_multisample #define GL_3DFX_multisample 1 #endif #ifndef GL_3DFX_tbuffer #define GL_3DFX_tbuffer 1 #ifndef glTbufferMask3DFX #define glTbufferMask3DFX SAGE_glTbufferMask3DFX #endif #endif #ifndef GL_EXT_multisample #define GL_EXT_multisample 1 #ifndef glSampleMaskEXT #define glSampleMaskEXT SAGE_glSampleMaskEXT #endif #ifndef glSamplePatternEXT #define glSamplePatternEXT SAGE_glSamplePatternEXT #endif #endif #ifndef GL_SGIX_vertex_preclip #define GL_SGIX_vertex_preclip 1 #endif #ifndef GL_SGIX_convolution_accuracy #define GL_SGIX_convolution_accuracy 1 #endif #ifndef GL_SGIX_resample #define GL_SGIX_resample 1 #endif #ifndef GL_SGIS_point_line_texgen #define GL_SGIS_point_line_texgen 1 #endif #ifndef GL_SGIS_texture_color_mask #define GL_SGIS_texture_color_mask 1 #ifndef glTextureColorMaskSGIS #define glTextureColorMaskSGIS SAGE_glTextureColorMaskSGIS #endif #endif #ifndef GL_SGIX_igloo_interface #define GL_SGIX_igloo_interface 1 #ifndef glIglooInterfaceSGIX #define glIglooInterfaceSGIX SAGE_glIglooInterfaceSGIX #endif #endif #ifndef GL_EXT_texture_env_dot3 #define GL_EXT_texture_env_dot3 1 #endif #ifndef GL_ATI_texture_mirror_once #define GL_ATI_texture_mirror_once 1 #endif #ifndef GL_NV_fence #define GL_NV_fence 1 #ifndef glDeleteFencesNV #define glDeleteFencesNV SAGE_glDeleteFencesNV #endif #ifndef glGenFencesNV #define glGenFencesNV SAGE_glGenFencesNV #endif #ifndef glIsFenceNV #define glIsFenceNV SAGE_glIsFenceNV #endif #ifndef glTestFenceNV #define glTestFenceNV SAGE_glTestFenceNV #endif #ifndef glGetFenceivNV #define glGetFenceivNV SAGE_glGetFenceivNV #endif #ifndef glFinishFenceNV #define glFinishFenceNV SAGE_glFinishFenceNV #endif #ifndef glSetFenceNV #define glSetFenceNV SAGE_glSetFenceNV #endif #endif #ifndef GL_NV_evaluators #define GL_NV_evaluators 1 #ifndef glMapControlPointsNV #define glMapControlPointsNV SAGE_glMapControlPointsNV #endif #ifndef glMapParameterivNV #define glMapParameterivNV SAGE_glMapParameterivNV #endif #ifndef glMapParameterfvNV #define glMapParameterfvNV SAGE_glMapParameterfvNV #endif #ifndef glGetMapControlPointsNV #define glGetMapControlPointsNV SAGE_glGetMapControlPointsNV #endif #ifndef glGetMapParameterivNV #define glGetMapParameterivNV SAGE_glGetMapParameterivNV #endif #ifndef glGetMapParameterfvNV #define glGetMapParameterfvNV SAGE_glGetMapParameterfvNV #endif #ifndef glGetMapAttribParameterivNV #define glGetMapAttribParameterivNV SAGE_glGetMapAttribParameterivNV #endif #ifndef glGetMapAttribParameterfvNV #define glGetMapAttribParameterfvNV SAGE_glGetMapAttribParameterfvNV #endif #ifndef glEvalMapsNV #define glEvalMapsNV SAGE_glEvalMapsNV #endif #endif #ifndef GL_NV_packed_depth_stencil #define GL_NV_packed_depth_stencil 1 #endif #ifndef GL_NV_register_combiners2 #define GL_NV_register_combiners2 1 #ifndef glCombinerStageParameterfvNV #define glCombinerStageParameterfvNV SAGE_glCombinerStageParameterfvNV #endif #ifndef glGetCombinerStageParameterfvNV #define glGetCombinerStageParameterfvNV SAGE_glGetCombinerStageParameterfvNV #endif #endif #ifndef GL_NV_texture_compression_vtc #define GL_NV_texture_compression_vtc 1 #endif #ifndef GL_NV_texture_rectangle #define GL_NV_texture_rectangle 1 #endif #ifndef GL_NV_texture_shader #define GL_NV_texture_shader 1 #endif #ifndef GL_NV_texture_shader2 #define GL_NV_texture_shader2 1 #endif #ifndef GL_NV_vertex_array_range2 #define GL_NV_vertex_array_range2 1 #endif #ifndef GL_NV_vertex_program #define GL_NV_vertex_program 1 #ifndef glAreProgramsResidentNV #define glAreProgramsResidentNV SAGE_glAreProgramsResidentNV #endif #ifndef glBindProgramNV #define glBindProgramNV SAGE_glBindProgramNV #endif #ifndef glDeleteProgramsNV #define glDeleteProgramsNV SAGE_glDeleteProgramsNV #endif #ifndef glExecuteProgramNV #define glExecuteProgramNV SAGE_glExecuteProgramNV #endif #ifndef glGenProgramsNV #define glGenProgramsNV SAGE_glGenProgramsNV #endif #ifndef glGetProgramParameterdvNV #define glGetProgramParameterdvNV SAGE_glGetProgramParameterdvNV #endif #ifndef glGetProgramParameterfvNV #define glGetProgramParameterfvNV SAGE_glGetProgramParameterfvNV #endif #ifndef glGetProgramivNV #define glGetProgramivNV SAGE_glGetProgramivNV #endif #ifndef glGetProgramStringNV #define glGetProgramStringNV SAGE_glGetProgramStringNV #endif #ifndef glGetTrackMatrixivNV #define glGetTrackMatrixivNV SAGE_glGetTrackMatrixivNV #endif #ifndef glGetVertexAttribdvNV #define glGetVertexAttribdvNV SAGE_glGetVertexAttribdvNV #endif #ifndef glGetVertexAttribfvNV #define glGetVertexAttribfvNV SAGE_glGetVertexAttribfvNV #endif #ifndef glGetVertexAttribivNV #define glGetVertexAttribivNV SAGE_glGetVertexAttribivNV #endif #ifndef glGetVertexAttribPointervNV #define glGetVertexAttribPointervNV SAGE_glGetVertexAttribPointervNV #endif #ifndef glIsProgramNV #define glIsProgramNV SAGE_glIsProgramNV #endif #ifndef glLoadProgramNV #define glLoadProgramNV SAGE_glLoadProgramNV #endif #ifndef glProgramParameter4dNV #define glProgramParameter4dNV SAGE_glProgramParameter4dNV #endif #ifndef glProgramParameter4dvNV #define glProgramParameter4dvNV SAGE_glProgramParameter4dvNV #endif #ifndef glProgramParameter4fNV #define glProgramParameter4fNV SAGE_glProgramParameter4fNV #endif #ifndef glProgramParameter4fvNV #define glProgramParameter4fvNV SAGE_glProgramParameter4fvNV #endif #ifndef glProgramParameters4dvNV #define glProgramParameters4dvNV SAGE_glProgramParameters4dvNV #endif #ifndef glProgramParameters4fvNV #define glProgramParameters4fvNV SAGE_glProgramParameters4fvNV #endif #ifndef glRequestResidentProgramsNV #define glRequestResidentProgramsNV SAGE_glRequestResidentProgramsNV #endif #ifndef glTrackMatrixNV #define glTrackMatrixNV SAGE_glTrackMatrixNV #endif #ifndef glVertexAttribPointerNV #define glVertexAttribPointerNV SAGE_glVertexAttribPointerNV #endif #ifndef glVertexAttrib1dNV #define glVertexAttrib1dNV SAGE_glVertexAttrib1dNV #endif #ifndef glVertexAttrib1dvNV #define glVertexAttrib1dvNV SAGE_glVertexAttrib1dvNV #endif #ifndef glVertexAttrib1fNV #define glVertexAttrib1fNV SAGE_glVertexAttrib1fNV #endif #ifndef glVertexAttrib1fvNV #define glVertexAttrib1fvNV SAGE_glVertexAttrib1fvNV #endif #ifndef glVertexAttrib1sNV #define glVertexAttrib1sNV SAGE_glVertexAttrib1sNV #endif #ifndef glVertexAttrib1svNV #define glVertexAttrib1svNV SAGE_glVertexAttrib1svNV #endif #ifndef glVertexAttrib2dNV #define glVertexAttrib2dNV SAGE_glVertexAttrib2dNV #endif #ifndef glVertexAttrib2dvNV #define glVertexAttrib2dvNV SAGE_glVertexAttrib2dvNV #endif #ifndef glVertexAttrib2fNV #define glVertexAttrib2fNV SAGE_glVertexAttrib2fNV #endif #ifndef glVertexAttrib2fvNV #define glVertexAttrib2fvNV SAGE_glVertexAttrib2fvNV #endif #ifndef glVertexAttrib2sNV #define glVertexAttrib2sNV SAGE_glVertexAttrib2sNV #endif #ifndef glVertexAttrib2svNV #define glVertexAttrib2svNV SAGE_glVertexAttrib2svNV #endif #ifndef glVertexAttrib3dNV #define glVertexAttrib3dNV SAGE_glVertexAttrib3dNV #endif #ifndef glVertexAttrib3dvNV #define glVertexAttrib3dvNV SAGE_glVertexAttrib3dvNV #endif #ifndef glVertexAttrib3fNV #define glVertexAttrib3fNV SAGE_glVertexAttrib3fNV #endif #ifndef glVertexAttrib3fvNV #define glVertexAttrib3fvNV SAGE_glVertexAttrib3fvNV #endif #ifndef glVertexAttrib3sNV #define glVertexAttrib3sNV SAGE_glVertexAttrib3sNV #endif #ifndef glVertexAttrib3svNV #define glVertexAttrib3svNV SAGE_glVertexAttrib3svNV #endif #ifndef glVertexAttrib4dNV #define glVertexAttrib4dNV SAGE_glVertexAttrib4dNV #endif #ifndef glVertexAttrib4dvNV #define glVertexAttrib4dvNV SAGE_glVertexAttrib4dvNV #endif #ifndef glVertexAttrib4fNV #define glVertexAttrib4fNV SAGE_glVertexAttrib4fNV #endif #ifndef glVertexAttrib4fvNV #define glVertexAttrib4fvNV SAGE_glVertexAttrib4fvNV #endif #ifndef glVertexAttrib4sNV #define glVertexAttrib4sNV SAGE_glVertexAttrib4sNV #endif #ifndef glVertexAttrib4svNV #define glVertexAttrib4svNV SAGE_glVertexAttrib4svNV #endif #ifndef glVertexAttrib4ubNV #define glVertexAttrib4ubNV SAGE_glVertexAttrib4ubNV #endif #ifndef glVertexAttrib4ubvNV #define glVertexAttrib4ubvNV SAGE_glVertexAttrib4ubvNV #endif #ifndef glVertexAttribs1dvNV #define glVertexAttribs1dvNV SAGE_glVertexAttribs1dvNV #endif #ifndef glVertexAttribs1fvNV #define glVertexAttribs1fvNV SAGE_glVertexAttribs1fvNV #endif #ifndef glVertexAttribs1svNV #define glVertexAttribs1svNV SAGE_glVertexAttribs1svNV #endif #ifndef glVertexAttribs2dvNV #define glVertexAttribs2dvNV SAGE_glVertexAttribs2dvNV #endif #ifndef glVertexAttribs2fvNV #define glVertexAttribs2fvNV SAGE_glVertexAttribs2fvNV #endif #ifndef glVertexAttribs2svNV #define glVertexAttribs2svNV SAGE_glVertexAttribs2svNV #endif #ifndef glVertexAttribs3dvNV #define glVertexAttribs3dvNV SAGE_glVertexAttribs3dvNV #endif #ifndef glVertexAttribs3fvNV #define glVertexAttribs3fvNV SAGE_glVertexAttribs3fvNV #endif #ifndef glVertexAttribs3svNV #define glVertexAttribs3svNV SAGE_glVertexAttribs3svNV #endif #ifndef glVertexAttribs4dvNV #define glVertexAttribs4dvNV SAGE_glVertexAttribs4dvNV #endif #ifndef glVertexAttribs4fvNV #define glVertexAttribs4fvNV SAGE_glVertexAttribs4fvNV #endif #ifndef glVertexAttribs4svNV #define glVertexAttribs4svNV SAGE_glVertexAttribs4svNV #endif #ifndef glVertexAttribs4ubvNV #define glVertexAttribs4ubvNV SAGE_glVertexAttribs4ubvNV #endif #endif #ifndef GL_SGIX_texture_coordinate_clamp #define GL_SGIX_texture_coordinate_clamp 1 #endif #ifndef GL_SGIX_scalebias_hint #define GL_SGIX_scalebias_hint 1 #endif #ifndef GL_OML_interlace #define GL_OML_interlace 1 #endif #ifndef GL_OML_subsample #define GL_OML_subsample 1 #endif #ifndef GL_OML_resample #define GL_OML_resample 1 #endif #ifndef GL_NV_copy_depth_to_color #define GL_NV_copy_depth_to_color 1 #endif #ifndef GL_ATI_envmap_bumpmap #define GL_ATI_envmap_bumpmap 1 #ifndef glTexBumpParameterivATI #define glTexBumpParameterivATI SAGE_glTexBumpParameterivATI #endif #ifndef glTexBumpParameterfvATI #define glTexBumpParameterfvATI SAGE_glTexBumpParameterfvATI #endif #ifndef glGetTexBumpParameterivATI #define glGetTexBumpParameterivATI SAGE_glGetTexBumpParameterivATI #endif #ifndef glGetTexBumpParameterfvATI #define glGetTexBumpParameterfvATI SAGE_glGetTexBumpParameterfvATI #endif #endif #ifndef GL_ATI_fragment_shader #define GL_ATI_fragment_shader 1 #ifndef glGenFragmentShadersATI #define glGenFragmentShadersATI SAGE_glGenFragmentShadersATI #endif #ifndef glBindFragmentShaderATI #define glBindFragmentShaderATI SAGE_glBindFragmentShaderATI #endif #ifndef glDeleteFragmentShaderATI #define glDeleteFragmentShaderATI SAGE_glDeleteFragmentShaderATI #endif #ifndef glBeginFragmentShaderATI #define glBeginFragmentShaderATI SAGE_glBeginFragmentShaderATI #endif #ifndef glEndFragmentShaderATI #define glEndFragmentShaderATI SAGE_glEndFragmentShaderATI #endif #ifndef glPassTexCoordATI #define glPassTexCoordATI SAGE_glPassTexCoordATI #endif #ifndef glSampleMapATI #define glSampleMapATI SAGE_glSampleMapATI #endif #ifndef glColorFragmentOp1ATI #define glColorFragmentOp1ATI SAGE_glColorFragmentOp1ATI #endif #ifndef glColorFragmentOp2ATI #define glColorFragmentOp2ATI SAGE_glColorFragmentOp2ATI #endif #ifndef glColorFragmentOp3ATI #define glColorFragmentOp3ATI SAGE_glColorFragmentOp3ATI #endif #ifndef glAlphaFragmentOp1ATI #define glAlphaFragmentOp1ATI SAGE_glAlphaFragmentOp1ATI #endif #ifndef glAlphaFragmentOp2ATI #define glAlphaFragmentOp2ATI SAGE_glAlphaFragmentOp2ATI #endif #ifndef glAlphaFragmentOp3ATI #define glAlphaFragmentOp3ATI SAGE_glAlphaFragmentOp3ATI #endif #ifndef glSetFragmentShaderConstantATI #define glSetFragmentShaderConstantATI SAGE_glSetFragmentShaderConstantATI #endif #endif #ifndef GL_ATI_pn_triangles #define GL_ATI_pn_triangles 1 #ifndef glPNTrianglesiATI #define glPNTrianglesiATI SAGE_glPNTrianglesiATI #endif #ifndef glPNTrianglesfATI #define glPNTrianglesfATI SAGE_glPNTrianglesfATI #endif #endif #ifndef GL_ATI_vertex_array_object #define GL_ATI_vertex_array_object 1 #ifndef glNewObjectBufferATI #define glNewObjectBufferATI SAGE_glNewObjectBufferATI #endif #ifndef glIsObjectBufferATI #define glIsObjectBufferATI SAGE_glIsObjectBufferATI #endif #ifndef glUpdateObjectBufferATI #define glUpdateObjectBufferATI SAGE_glUpdateObjectBufferATI #endif #ifndef glGetObjectBufferfvATI #define glGetObjectBufferfvATI SAGE_glGetObjectBufferfvATI #endif #ifndef glGetObjectBufferivATI #define glGetObjectBufferivATI SAGE_glGetObjectBufferivATI #endif #ifndef glFreeObjectBufferATI #define glFreeObjectBufferATI SAGE_glFreeObjectBufferATI #endif #ifndef glArrayObjectATI #define glArrayObjectATI SAGE_glArrayObjectATI #endif #ifndef glGetArrayObjectfvATI #define glGetArrayObjectfvATI SAGE_glGetArrayObjectfvATI #endif #ifndef glGetArrayObjectivATI #define glGetArrayObjectivATI SAGE_glGetArrayObjectivATI #endif #ifndef glVariantArrayObjectATI #define glVariantArrayObjectATI SAGE_glVariantArrayObjectATI #endif #ifndef glGetVariantArrayObjectfvATI #define glGetVariantArrayObjectfvATI SAGE_glGetVariantArrayObjectfvATI #endif #ifndef glGetVariantArrayObjectivATI #define glGetVariantArrayObjectivATI SAGE_glGetVariantArrayObjectivATI #endif #endif #ifndef GL_EXT_vertex_shader #define GL_EXT_vertex_shader 1 #ifndef glBeginVertexShaderEXT #define glBeginVertexShaderEXT SAGE_glBeginVertexShaderEXT #endif #ifndef glEndVertexShaderEXT #define glEndVertexShaderEXT SAGE_glEndVertexShaderEXT #endif #ifndef glBindVertexShaderEXT #define glBindVertexShaderEXT SAGE_glBindVertexShaderEXT #endif #ifndef glGenVertexShadersEXT #define glGenVertexShadersEXT SAGE_glGenVertexShadersEXT #endif #ifndef glDeleteVertexShaderEXT #define glDeleteVertexShaderEXT SAGE_glDeleteVertexShaderEXT #endif #ifndef glShaderOp1EXT #define glShaderOp1EXT SAGE_glShaderOp1EXT #endif #ifndef glShaderOp2EXT #define glShaderOp2EXT SAGE_glShaderOp2EXT #endif #ifndef glShaderOp3EXT #define glShaderOp3EXT SAGE_glShaderOp3EXT #endif #ifndef glSwizzleEXT #define glSwizzleEXT SAGE_glSwizzleEXT #endif #ifndef glWriteMaskEXT #define glWriteMaskEXT SAGE_glWriteMaskEXT #endif #ifndef glInsertComponentEXT #define glInsertComponentEXT SAGE_glInsertComponentEXT #endif #ifndef glExtractComponentEXT #define glExtractComponentEXT SAGE_glExtractComponentEXT #endif #ifndef glGenSymbolsEXT #define glGenSymbolsEXT SAGE_glGenSymbolsEXT #endif #ifndef glSetInvariantEXT #define glSetInvariantEXT SAGE_glSetInvariantEXT #endif #ifndef glSetLocalConstantEXT #define glSetLocalConstantEXT SAGE_glSetLocalConstantEXT #endif #ifndef glVariantbvEXT #define glVariantbvEXT SAGE_glVariantbvEXT #endif #ifndef glVariantsvEXT #define glVariantsvEXT SAGE_glVariantsvEXT #endif #ifndef glVariantivEXT #define glVariantivEXT SAGE_glVariantivEXT #endif #ifndef glVariantfvEXT #define glVariantfvEXT SAGE_glVariantfvEXT #endif #ifndef glVariantdvEXT #define glVariantdvEXT SAGE_glVariantdvEXT #endif #ifndef glVariantubvEXT #define glVariantubvEXT SAGE_glVariantubvEXT #endif #ifndef glVariantusvEXT #define glVariantusvEXT SAGE_glVariantusvEXT #endif #ifndef glVariantuivEXT #define glVariantuivEXT SAGE_glVariantuivEXT #endif #ifndef glVariantPointerEXT #define glVariantPointerEXT SAGE_glVariantPointerEXT #endif #ifndef glEnableVariantClientStateEXT #define glEnableVariantClientStateEXT SAGE_glEnableVariantClientStateEXT #endif #ifndef glDisableVariantClientStateEXT #define glDisableVariantClientStateEXT SAGE_glDisableVariantClientStateEXT #endif #ifndef glBindLightParameterEXT #define glBindLightParameterEXT SAGE_glBindLightParameterEXT #endif #ifndef glBindMaterialParameterEXT #define glBindMaterialParameterEXT SAGE_glBindMaterialParameterEXT #endif #ifndef glBindTexGenParameterEXT #define glBindTexGenParameterEXT SAGE_glBindTexGenParameterEXT #endif #ifndef glBindTextureUnitParameterEXT #define glBindTextureUnitParameterEXT SAGE_glBindTextureUnitParameterEXT #endif #ifndef glBindParameterEXT #define glBindParameterEXT SAGE_glBindParameterEXT #endif #ifndef glIsVariantEnabledEXT #define glIsVariantEnabledEXT SAGE_glIsVariantEnabledEXT #endif #ifndef glGetVariantBooleanvEXT #define glGetVariantBooleanvEXT SAGE_glGetVariantBooleanvEXT #endif #ifndef glGetVariantIntegervEXT #define glGetVariantIntegervEXT SAGE_glGetVariantIntegervEXT #endif #ifndef glGetVariantFloatvEXT #define glGetVariantFloatvEXT SAGE_glGetVariantFloatvEXT #endif #ifndef glGetVariantPointervEXT #define glGetVariantPointervEXT SAGE_glGetVariantPointervEXT #endif #ifndef glGetInvariantBooleanvEXT #define glGetInvariantBooleanvEXT SAGE_glGetInvariantBooleanvEXT #endif #ifndef glGetInvariantIntegervEXT #define glGetInvariantIntegervEXT SAGE_glGetInvariantIntegervEXT #endif #ifndef glGetInvariantFloatvEXT #define glGetInvariantFloatvEXT SAGE_glGetInvariantFloatvEXT #endif #ifndef glGetLocalConstantBooleanvEXT #define glGetLocalConstantBooleanvEXT SAGE_glGetLocalConstantBooleanvEXT #endif #ifndef glGetLocalConstantIntegervEXT #define glGetLocalConstantIntegervEXT SAGE_glGetLocalConstantIntegervEXT #endif #ifndef glGetLocalConstantFloatvEXT #define glGetLocalConstantFloatvEXT SAGE_glGetLocalConstantFloatvEXT #endif #endif #ifndef GL_ATI_vertex_streams #define GL_ATI_vertex_streams 1 #ifndef glVertexStream1sATI #define glVertexStream1sATI SAGE_glVertexStream1sATI #endif #ifndef glVertexStream1svATI #define glVertexStream1svATI SAGE_glVertexStream1svATI #endif #ifndef glVertexStream1iATI #define glVertexStream1iATI SAGE_glVertexStream1iATI #endif #ifndef glVertexStream1ivATI #define glVertexStream1ivATI SAGE_glVertexStream1ivATI #endif #ifndef glVertexStream1fATI #define glVertexStream1fATI SAGE_glVertexStream1fATI #endif #ifndef glVertexStream1fvATI #define glVertexStream1fvATI SAGE_glVertexStream1fvATI #endif #ifndef glVertexStream1dATI #define glVertexStream1dATI SAGE_glVertexStream1dATI #endif #ifndef glVertexStream1dvATI #define glVertexStream1dvATI SAGE_glVertexStream1dvATI #endif #ifndef glVertexStream2sATI #define glVertexStream2sATI SAGE_glVertexStream2sATI #endif #ifndef glVertexStream2svATI #define glVertexStream2svATI SAGE_glVertexStream2svATI #endif #ifndef glVertexStream2iATI #define glVertexStream2iATI SAGE_glVertexStream2iATI #endif #ifndef glVertexStream2ivATI #define glVertexStream2ivATI SAGE_glVertexStream2ivATI #endif #ifndef glVertexStream2fATI #define glVertexStream2fATI SAGE_glVertexStream2fATI #endif #ifndef glVertexStream2fvATI #define glVertexStream2fvATI SAGE_glVertexStream2fvATI #endif #ifndef glVertexStream2dATI #define glVertexStream2dATI SAGE_glVertexStream2dATI #endif #ifndef glVertexStream2dvATI #define glVertexStream2dvATI SAGE_glVertexStream2dvATI #endif #ifndef glVertexStream3sATI #define glVertexStream3sATI SAGE_glVertexStream3sATI #endif #ifndef glVertexStream3svATI #define glVertexStream3svATI SAGE_glVertexStream3svATI #endif #ifndef glVertexStream3iATI #define glVertexStream3iATI SAGE_glVertexStream3iATI #endif #ifndef glVertexStream3ivATI #define glVertexStream3ivATI SAGE_glVertexStream3ivATI #endif #ifndef glVertexStream3fATI #define glVertexStream3fATI SAGE_glVertexStream3fATI #endif #ifndef glVertexStream3fvATI #define glVertexStream3fvATI SAGE_glVertexStream3fvATI #endif #ifndef glVertexStream3dATI #define glVertexStream3dATI SAGE_glVertexStream3dATI #endif #ifndef glVertexStream3dvATI #define glVertexStream3dvATI SAGE_glVertexStream3dvATI #endif #ifndef glVertexStream4sATI #define glVertexStream4sATI SAGE_glVertexStream4sATI #endif #ifndef glVertexStream4svATI #define glVertexStream4svATI SAGE_glVertexStream4svATI #endif #ifndef glVertexStream4iATI #define glVertexStream4iATI SAGE_glVertexStream4iATI #endif #ifndef glVertexStream4ivATI #define glVertexStream4ivATI SAGE_glVertexStream4ivATI #endif #ifndef glVertexStream4fATI #define glVertexStream4fATI SAGE_glVertexStream4fATI #endif #ifndef glVertexStream4fvATI #define glVertexStream4fvATI SAGE_glVertexStream4fvATI #endif #ifndef glVertexStream4dATI #define glVertexStream4dATI SAGE_glVertexStream4dATI #endif #ifndef glVertexStream4dvATI #define glVertexStream4dvATI SAGE_glVertexStream4dvATI #endif #ifndef glNormalStream3bATI #define glNormalStream3bATI SAGE_glNormalStream3bATI #endif #ifndef glNormalStream3bvATI #define glNormalStream3bvATI SAGE_glNormalStream3bvATI #endif #ifndef glNormalStream3sATI #define glNormalStream3sATI SAGE_glNormalStream3sATI #endif #ifndef glNormalStream3svATI #define glNormalStream3svATI SAGE_glNormalStream3svATI #endif #ifndef glNormalStream3iATI #define glNormalStream3iATI SAGE_glNormalStream3iATI #endif #ifndef glNormalStream3ivATI #define glNormalStream3ivATI SAGE_glNormalStream3ivATI #endif #ifndef glNormalStream3fATI #define glNormalStream3fATI SAGE_glNormalStream3fATI #endif #ifndef glNormalStream3fvATI #define glNormalStream3fvATI SAGE_glNormalStream3fvATI #endif #ifndef glNormalStream3dATI #define glNormalStream3dATI SAGE_glNormalStream3dATI #endif #ifndef glNormalStream3dvATI #define glNormalStream3dvATI SAGE_glNormalStream3dvATI #endif #ifndef glClientActiveVertexStreamATI #define glClientActiveVertexStreamATI SAGE_glClientActiveVertexStreamATI #endif #ifndef glVertexBlendEnviATI #define glVertexBlendEnviATI SAGE_glVertexBlendEnviATI #endif #ifndef glVertexBlendEnvfATI #define glVertexBlendEnvfATI SAGE_glVertexBlendEnvfATI #endif #endif #ifndef GL_ATI_element_array #define GL_ATI_element_array 1 #ifndef glElementPointerATI #define glElementPointerATI SAGE_glElementPointerATI #endif #ifndef glDrawElementArrayATI #define glDrawElementArrayATI SAGE_glDrawElementArrayATI #endif #ifndef glDrawRangeElementArrayATI #define glDrawRangeElementArrayATI SAGE_glDrawRangeElementArrayATI #endif #endif #ifndef GL_SUN_mesh_array #define GL_SUN_mesh_array 1 #ifndef glDrawMeshArraysSUN #define glDrawMeshArraysSUN SAGE_glDrawMeshArraysSUN #endif #endif #ifndef GL_SUN_slice_accum #define GL_SUN_slice_accum 1 #endif #ifndef GL_NV_multisample_filter_hint #define GL_NV_multisample_filter_hint 1 #endif #ifndef GL_NV_depth_clamp #define GL_NV_depth_clamp 1 #endif #ifndef GL_NV_occlusion_query #define GL_NV_occlusion_query 1 #ifndef glGenOcclusionQueriesNV #define glGenOcclusionQueriesNV SAGE_glGenOcclusionQueriesNV #endif #ifndef glDeleteOcclusionQueriesNV #define glDeleteOcclusionQueriesNV SAGE_glDeleteOcclusionQueriesNV #endif #ifndef glIsOcclusionQueryNV #define glIsOcclusionQueryNV SAGE_glIsOcclusionQueryNV #endif #ifndef glBeginOcclusionQueryNV #define glBeginOcclusionQueryNV SAGE_glBeginOcclusionQueryNV #endif #ifndef glEndOcclusionQueryNV #define glEndOcclusionQueryNV SAGE_glEndOcclusionQueryNV #endif #ifndef glGetOcclusionQueryivNV #define glGetOcclusionQueryivNV SAGE_glGetOcclusionQueryivNV #endif #ifndef glGetOcclusionQueryuivNV #define glGetOcclusionQueryuivNV SAGE_glGetOcclusionQueryuivNV #endif #endif #ifndef GL_NV_point_sprite #define GL_NV_point_sprite 1 #ifndef glPointParameteriNV #define glPointParameteriNV SAGE_glPointParameteriNV #endif #ifndef glPointParameterivNV #define glPointParameterivNV SAGE_glPointParameterivNV #endif #endif #ifndef GL_NV_texture_shader3 #define GL_NV_texture_shader3 1 #endif #ifndef GL_NV_vertex_program1_1 #define GL_NV_vertex_program1_1 1 #endif #ifndef GL_EXT_shadow_funcs #define GL_EXT_shadow_funcs 1 #endif #ifndef GL_EXT_stencil_two_side #define GL_EXT_stencil_two_side 1 #ifndef glActiveStencilFaceEXT #define glActiveStencilFaceEXT SAGE_glActiveStencilFaceEXT #endif #endif #ifndef GL_ATI_text_fragment_shader #define GL_ATI_text_fragment_shader 1 #endif #ifndef GL_APPLE_client_storage #define GL_APPLE_client_storage 1 #endif #ifndef GL_APPLE_element_array #define GL_APPLE_element_array 1 #ifndef glElementPointerAPPLE #define glElementPointerAPPLE SAGE_glElementPointerAPPLE #endif #ifndef glDrawElementArrayAPPLE #define glDrawElementArrayAPPLE SAGE_glDrawElementArrayAPPLE #endif #ifndef glDrawRangeElementArrayAPPLE #define glDrawRangeElementArrayAPPLE SAGE_glDrawRangeElementArrayAPPLE #endif #ifndef glMultiDrawElementArrayAPPLE #define glMultiDrawElementArrayAPPLE SAGE_glMultiDrawElementArrayAPPLE #endif #ifndef glMultiDrawRangeElementArrayAPPLE #define glMultiDrawRangeElementArrayAPPLE SAGE_glMultiDrawRangeElementArrayAPPLE #endif #endif #ifndef GL_APPLE_fence #define GL_APPLE_fence 1 #ifndef glGenFencesAPPLE #define glGenFencesAPPLE SAGE_glGenFencesAPPLE #endif #ifndef glDeleteFencesAPPLE #define glDeleteFencesAPPLE SAGE_glDeleteFencesAPPLE #endif #ifndef glSetFenceAPPLE #define glSetFenceAPPLE SAGE_glSetFenceAPPLE #endif #ifndef glIsFenceAPPLE #define glIsFenceAPPLE SAGE_glIsFenceAPPLE #endif #ifndef glTestFenceAPPLE #define glTestFenceAPPLE SAGE_glTestFenceAPPLE #endif #ifndef glFinishFenceAPPLE #define glFinishFenceAPPLE SAGE_glFinishFenceAPPLE #endif #ifndef glTestObjectAPPLE #define glTestObjectAPPLE SAGE_glTestObjectAPPLE #endif #ifndef glFinishObjectAPPLE #define glFinishObjectAPPLE SAGE_glFinishObjectAPPLE #endif #endif #ifndef GL_APPLE_vertex_array_object #define GL_APPLE_vertex_array_object 1 #ifndef glBindVertexArrayAPPLE #define glBindVertexArrayAPPLE SAGE_glBindVertexArrayAPPLE #endif #ifndef glDeleteVertexArraysAPPLE #define glDeleteVertexArraysAPPLE SAGE_glDeleteVertexArraysAPPLE #endif #ifndef glGenVertexArraysAPPLE #define glGenVertexArraysAPPLE SAGE_glGenVertexArraysAPPLE #endif #ifndef glIsVertexArrayAPPLE #define glIsVertexArrayAPPLE SAGE_glIsVertexArrayAPPLE #endif #endif #ifndef GL_APPLE_vertex_array_range #define GL_APPLE_vertex_array_range 1 #ifndef glVertexArrayRangeAPPLE #define glVertexArrayRangeAPPLE SAGE_glVertexArrayRangeAPPLE #endif #ifndef glFlushVertexArrayRangeAPPLE #define glFlushVertexArrayRangeAPPLE SAGE_glFlushVertexArrayRangeAPPLE #endif #ifndef glVertexArrayParameteriAPPLE #define glVertexArrayParameteriAPPLE SAGE_glVertexArrayParameteriAPPLE #endif #endif #ifndef GL_APPLE_ycbcr_422 #define GL_APPLE_ycbcr_422 1 #endif #ifndef GL_S3_s3tc #define GL_S3_s3tc 1 #endif #ifndef GL_ATI_draw_buffers #define GL_ATI_draw_buffers 1 #ifndef glDrawBuffersATI #define glDrawBuffersATI SAGE_glDrawBuffersATI #endif #endif #ifndef GL_ATI_pixel_format_float #define GL_ATI_pixel_format_float 1 #endif #ifndef GL_ATI_texture_env_combine3 #define GL_ATI_texture_env_combine3 1 #endif #ifndef GL_ATI_texture_float #define GL_ATI_texture_float 1 #endif #ifndef GL_NV_float_buffer #define GL_NV_float_buffer 1 #endif #ifndef GL_NV_fragment_program #define GL_NV_fragment_program 1 #ifndef glProgramNamedParameter4fNV #define glProgramNamedParameter4fNV SAGE_glProgramNamedParameter4fNV #endif #ifndef glProgramNamedParameter4dNV #define glProgramNamedParameter4dNV SAGE_glProgramNamedParameter4dNV #endif #ifndef glProgramNamedParameter4fvNV #define glProgramNamedParameter4fvNV SAGE_glProgramNamedParameter4fvNV #endif #ifndef glProgramNamedParameter4dvNV #define glProgramNamedParameter4dvNV SAGE_glProgramNamedParameter4dvNV #endif #ifndef glGetProgramNamedParameterfvNV #define glGetProgramNamedParameterfvNV SAGE_glGetProgramNamedParameterfvNV #endif #ifndef glGetProgramNamedParameterdvNV #define glGetProgramNamedParameterdvNV SAGE_glGetProgramNamedParameterdvNV #endif #endif #ifndef GL_NV_half_float #define GL_NV_half_float 1 #ifndef glVertex2hNV #define glVertex2hNV SAGE_glVertex2hNV #endif #ifndef glVertex2hvNV #define glVertex2hvNV SAGE_glVertex2hvNV #endif #ifndef glVertex3hNV #define glVertex3hNV SAGE_glVertex3hNV #endif #ifndef glVertex3hvNV #define glVertex3hvNV SAGE_glVertex3hvNV #endif #ifndef glVertex4hNV #define glVertex4hNV SAGE_glVertex4hNV #endif #ifndef glVertex4hvNV #define glVertex4hvNV SAGE_glVertex4hvNV #endif #ifndef glNormal3hNV #define glNormal3hNV SAGE_glNormal3hNV #endif #ifndef glNormal3hvNV #define glNormal3hvNV SAGE_glNormal3hvNV #endif #ifndef glColor3hNV #define glColor3hNV SAGE_glColor3hNV #endif #ifndef glColor3hvNV #define glColor3hvNV SAGE_glColor3hvNV #endif #ifndef glColor4hNV #define glColor4hNV SAGE_glColor4hNV #endif #ifndef glColor4hvNV #define glColor4hvNV SAGE_glColor4hvNV #endif #ifndef glTexCoord1hNV #define glTexCoord1hNV SAGE_glTexCoord1hNV #endif #ifndef glTexCoord1hvNV #define glTexCoord1hvNV SAGE_glTexCoord1hvNV #endif #ifndef glTexCoord2hNV #define glTexCoord2hNV SAGE_glTexCoord2hNV #endif #ifndef glTexCoord2hvNV #define glTexCoord2hvNV SAGE_glTexCoord2hvNV #endif #ifndef glTexCoord3hNV #define glTexCoord3hNV SAGE_glTexCoord3hNV #endif #ifndef glTexCoord3hvNV #define glTexCoord3hvNV SAGE_glTexCoord3hvNV #endif #ifndef glTexCoord4hNV #define glTexCoord4hNV SAGE_glTexCoord4hNV #endif #ifndef glTexCoord4hvNV #define glTexCoord4hvNV SAGE_glTexCoord4hvNV #endif #ifndef glMultiTexCoord1hNV #define glMultiTexCoord1hNV SAGE_glMultiTexCoord1hNV #endif #ifndef glMultiTexCoord1hvNV #define glMultiTexCoord1hvNV SAGE_glMultiTexCoord1hvNV #endif #ifndef glMultiTexCoord2hNV #define glMultiTexCoord2hNV SAGE_glMultiTexCoord2hNV #endif #ifndef glMultiTexCoord2hvNV #define glMultiTexCoord2hvNV SAGE_glMultiTexCoord2hvNV #endif #ifndef glMultiTexCoord3hNV #define glMultiTexCoord3hNV SAGE_glMultiTexCoord3hNV #endif #ifndef glMultiTexCoord3hvNV #define glMultiTexCoord3hvNV SAGE_glMultiTexCoord3hvNV #endif #ifndef glMultiTexCoord4hNV #define glMultiTexCoord4hNV SAGE_glMultiTexCoord4hNV #endif #ifndef glMultiTexCoord4hvNV #define glMultiTexCoord4hvNV SAGE_glMultiTexCoord4hvNV #endif #ifndef glFogCoordhNV #define glFogCoordhNV SAGE_glFogCoordhNV #endif #ifndef glFogCoordhvNV #define glFogCoordhvNV SAGE_glFogCoordhvNV #endif #ifndef glSecondaryColor3hNV #define glSecondaryColor3hNV SAGE_glSecondaryColor3hNV #endif #ifndef glSecondaryColor3hvNV #define glSecondaryColor3hvNV SAGE_glSecondaryColor3hvNV #endif #ifndef glVertexWeighthNV #define glVertexWeighthNV SAGE_glVertexWeighthNV #endif #ifndef glVertexWeighthvNV #define glVertexWeighthvNV SAGE_glVertexWeighthvNV #endif #ifndef glVertexAttrib1hNV #define glVertexAttrib1hNV SAGE_glVertexAttrib1hNV #endif #ifndef glVertexAttrib1hvNV #define glVertexAttrib1hvNV SAGE_glVertexAttrib1hvNV #endif #ifndef glVertexAttrib2hNV #define glVertexAttrib2hNV SAGE_glVertexAttrib2hNV #endif #ifndef glVertexAttrib2hvNV #define glVertexAttrib2hvNV SAGE_glVertexAttrib2hvNV #endif #ifndef glVertexAttrib3hNV #define glVertexAttrib3hNV SAGE_glVertexAttrib3hNV #endif #ifndef glVertexAttrib3hvNV #define glVertexAttrib3hvNV SAGE_glVertexAttrib3hvNV #endif #ifndef glVertexAttrib4hNV #define glVertexAttrib4hNV SAGE_glVertexAttrib4hNV #endif #ifndef glVertexAttrib4hvNV #define glVertexAttrib4hvNV SAGE_glVertexAttrib4hvNV #endif #ifndef glVertexAttribs1hvNV #define glVertexAttribs1hvNV SAGE_glVertexAttribs1hvNV #endif #ifndef glVertexAttribs2hvNV #define glVertexAttribs2hvNV SAGE_glVertexAttribs2hvNV #endif #ifndef glVertexAttribs3hvNV #define glVertexAttribs3hvNV SAGE_glVertexAttribs3hvNV #endif #ifndef glVertexAttribs4hvNV #define glVertexAttribs4hvNV SAGE_glVertexAttribs4hvNV #endif #endif #ifndef GL_NV_pixel_data_range #define GL_NV_pixel_data_range 1 #ifndef glPixelDataRangeNV #define glPixelDataRangeNV SAGE_glPixelDataRangeNV #endif #ifndef glFlushPixelDataRangeNV #define glFlushPixelDataRangeNV SAGE_glFlushPixelDataRangeNV #endif #endif #ifndef GL_NV_primitive_restart #define GL_NV_primitive_restart 1 #ifndef glPrimitiveRestartNV #define glPrimitiveRestartNV SAGE_glPrimitiveRestartNV #endif #ifndef glPrimitiveRestartIndexNV #define glPrimitiveRestartIndexNV SAGE_glPrimitiveRestartIndexNV #endif #endif #ifndef GL_NV_texture_expand_normal #define GL_NV_texture_expand_normal 1 #endif #ifndef GL_NV_vertex_program2 #define GL_NV_vertex_program2 1 #endif #ifndef GL_ATI_map_object_buffer #define GL_ATI_map_object_buffer 1 #ifndef glMapObjectBufferATI #define glMapObjectBufferATI SAGE_glMapObjectBufferATI #endif #ifndef glUnmapObjectBufferATI #define glUnmapObjectBufferATI SAGE_glUnmapObjectBufferATI #endif #endif #ifndef GL_ATI_separate_stencil #define GL_ATI_separate_stencil 1 #ifndef glStencilOpSeparateATI #define glStencilOpSeparateATI SAGE_glStencilOpSeparateATI #endif #ifndef glStencilFuncSeparateATI #define glStencilFuncSeparateATI SAGE_glStencilFuncSeparateATI #endif #endif #ifndef GL_ATI_vertex_attrib_array_object #define GL_ATI_vertex_attrib_array_object 1 #ifndef glVertexAttribArrayObjectATI #define glVertexAttribArrayObjectATI SAGE_glVertexAttribArrayObjectATI #endif #ifndef glGetVertexAttribArrayObjectfvATI #define glGetVertexAttribArrayObjectfvATI SAGE_glGetVertexAttribArrayObjectfvATI #endif #ifndef glGetVertexAttribArrayObjectivATI #define glGetVertexAttribArrayObjectivATI SAGE_glGetVertexAttribArrayObjectivATI #endif #endif #ifndef GL_OES_read_format #define GL_OES_read_format 1 #endif #ifndef GL_EXT_depth_bounds_test #define GL_EXT_depth_bounds_test 1 #ifndef glDepthBoundsEXT #define glDepthBoundsEXT SAGE_glDepthBoundsEXT #endif #endif #ifndef GL_EXT_texture_mirror_clamp #define GL_EXT_texture_mirror_clamp 1 #endif #ifndef GL_EXT_blend_equation_separate #define GL_EXT_blend_equation_separate 1 #ifndef glBlendEquationSeparateEXT #define glBlendEquationSeparateEXT SAGE_glBlendEquationSeparateEXT #endif #endif #ifndef GL_MESA_pack_invert #define GL_MESA_pack_invert 1 #endif #ifndef GL_MESA_ycbcr_texture #define GL_MESA_ycbcr_texture 1 #endif #ifndef GL_EXT_pixel_buffer_object #define GL_EXT_pixel_buffer_object 1 #endif #ifndef GL_NV_fragment_program_option #define GL_NV_fragment_program_option 1 #endif #ifndef GL_NV_fragment_program2 #define GL_NV_fragment_program2 1 #endif #ifndef GL_NV_vertex_program2_option #define GL_NV_vertex_program2_option 1 #endif #ifndef GL_NV_vertex_program3 #define GL_NV_vertex_program3 1 #endif #ifndef GL_EXT_framebuffer_object #define GL_EXT_framebuffer_object 1 #ifndef glIsRenderbufferEXT #define glIsRenderbufferEXT SAGE_glIsRenderbufferEXT #endif #ifndef glBindRenderbufferEXT #define glBindRenderbufferEXT SAGE_glBindRenderbufferEXT #endif #ifndef glDeleteRenderbuffersEXT #define glDeleteRenderbuffersEXT SAGE_glDeleteRenderbuffersEXT #endif #ifndef glGenRenderbuffersEXT #define glGenRenderbuffersEXT SAGE_glGenRenderbuffersEXT #endif #ifndef glRenderbufferStorageEXT #define glRenderbufferStorageEXT SAGE_glRenderbufferStorageEXT #endif #ifndef glGetRenderbufferParameterivEXT #define glGetRenderbufferParameterivEXT SAGE_glGetRenderbufferParameterivEXT #endif #ifndef glIsFramebufferEXT #define glIsFramebufferEXT SAGE_glIsFramebufferEXT #endif #ifndef glBindFramebufferEXT #define glBindFramebufferEXT SAGE_glBindFramebufferEXT #endif #ifndef glDeleteFramebuffersEXT #define glDeleteFramebuffersEXT SAGE_glDeleteFramebuffersEXT #endif #ifndef glGenFramebuffersEXT #define glGenFramebuffersEXT SAGE_glGenFramebuffersEXT #endif #ifndef glCheckFramebufferStatusEXT #define glCheckFramebufferStatusEXT SAGE_glCheckFramebufferStatusEXT #endif #ifndef glFramebufferTexture1DEXT #define glFramebufferTexture1DEXT SAGE_glFramebufferTexture1DEXT #endif #ifndef glFramebufferTexture2DEXT #define glFramebufferTexture2DEXT SAGE_glFramebufferTexture2DEXT #endif #ifndef glFramebufferTexture3DEXT #define glFramebufferTexture3DEXT SAGE_glFramebufferTexture3DEXT #endif #ifndef glFramebufferRenderbufferEXT #define glFramebufferRenderbufferEXT SAGE_glFramebufferRenderbufferEXT #endif #ifndef glGetFramebufferAttachmentParameterivEXT #define glGetFramebufferAttachmentParameterivEXT SAGE_glGetFramebufferAttachmentParameterivEXT #endif #ifndef glGenerateMipmapEXT #define glGenerateMipmapEXT SAGE_glGenerateMipmapEXT #endif #endif #ifndef GL_GREMEDY_string_marker #define GL_GREMEDY_string_marker 1 #ifndef glStringMarkerGREMEDY #define glStringMarkerGREMEDY SAGE_glStringMarkerGREMEDY #endif #endif #ifndef GL_EXT_packed_depth_stencil #define GL_EXT_packed_depth_stencil 1 #endif #ifndef GL_EXT_stencil_clear_tag #define GL_EXT_stencil_clear_tag 1 #ifndef glStencilClearTagEXT #define glStencilClearTagEXT SAGE_glStencilClearTagEXT #endif #endif #ifndef GL_EXT_texture_sRGB #define GL_EXT_texture_sRGB 1 #endif #ifndef GL_EXT_framebuffer_blit #define GL_EXT_framebuffer_blit 1 #ifndef glBlitFramebufferEXT #define glBlitFramebufferEXT SAGE_glBlitFramebufferEXT #endif #endif #ifndef GL_EXT_framebuffer_multisample #define GL_EXT_framebuffer_multisample 1 #ifndef glRenderbufferStorageMultisampleEXT #define glRenderbufferStorageMultisampleEXT SAGE_glRenderbufferStorageMultisampleEXT #endif #endif #ifndef GL_MESAX_texture_stack #define GL_MESAX_texture_stack 1 #endif #ifndef GL_EXT_timer_query #define GL_EXT_timer_query 1 #ifndef glGetQueryObjecti64vEXT #define glGetQueryObjecti64vEXT SAGE_glGetQueryObjecti64vEXT #endif #ifndef glGetQueryObjectui64vEXT #define glGetQueryObjectui64vEXT SAGE_glGetQueryObjectui64vEXT #endif #endif #ifndef GL_EXT_gpu_program_parameters #define GL_EXT_gpu_program_parameters 1 #ifndef glProgramEnvParameters4fvEXT #define glProgramEnvParameters4fvEXT SAGE_glProgramEnvParameters4fvEXT #endif #ifndef glProgramLocalParameters4fvEXT #define glProgramLocalParameters4fvEXT SAGE_glProgramLocalParameters4fvEXT #endif #endif #ifndef GL_APPLE_flush_buffer_range #define GL_APPLE_flush_buffer_range 1 #ifndef glBufferParameteriAPPLE #define glBufferParameteriAPPLE SAGE_glBufferParameteriAPPLE #endif #ifndef glFlushMappedBufferRangeAPPLE #define glFlushMappedBufferRangeAPPLE SAGE_glFlushMappedBufferRangeAPPLE #endif #endif #ifndef GL_NV_gpu_program4 #define GL_NV_gpu_program4 1 #ifndef glProgramLocalParameterI4iNV #define glProgramLocalParameterI4iNV SAGE_glProgramLocalParameterI4iNV #endif #ifndef glProgramLocalParameterI4ivNV #define glProgramLocalParameterI4ivNV SAGE_glProgramLocalParameterI4ivNV #endif #ifndef glProgramLocalParametersI4ivNV #define glProgramLocalParametersI4ivNV SAGE_glProgramLocalParametersI4ivNV #endif #ifndef glProgramLocalParameterI4uiNV #define glProgramLocalParameterI4uiNV SAGE_glProgramLocalParameterI4uiNV #endif #ifndef glProgramLocalParameterI4uivNV #define glProgramLocalParameterI4uivNV SAGE_glProgramLocalParameterI4uivNV #endif #ifndef glProgramLocalParametersI4uivNV #define glProgramLocalParametersI4uivNV SAGE_glProgramLocalParametersI4uivNV #endif #ifndef glProgramEnvParameterI4iNV #define glProgramEnvParameterI4iNV SAGE_glProgramEnvParameterI4iNV #endif #ifndef glProgramEnvParameterI4ivNV #define glProgramEnvParameterI4ivNV SAGE_glProgramEnvParameterI4ivNV #endif #ifndef glProgramEnvParametersI4ivNV #define glProgramEnvParametersI4ivNV SAGE_glProgramEnvParametersI4ivNV #endif #ifndef glProgramEnvParameterI4uiNV #define glProgramEnvParameterI4uiNV SAGE_glProgramEnvParameterI4uiNV #endif #ifndef glProgramEnvParameterI4uivNV #define glProgramEnvParameterI4uivNV SAGE_glProgramEnvParameterI4uivNV #endif #ifndef glProgramEnvParametersI4uivNV #define glProgramEnvParametersI4uivNV SAGE_glProgramEnvParametersI4uivNV #endif #ifndef glGetProgramLocalParameterIivNV #define glGetProgramLocalParameterIivNV SAGE_glGetProgramLocalParameterIivNV #endif #ifndef glGetProgramLocalParameterIuivNV #define glGetProgramLocalParameterIuivNV SAGE_glGetProgramLocalParameterIuivNV #endif #ifndef glGetProgramEnvParameterIivNV #define glGetProgramEnvParameterIivNV SAGE_glGetProgramEnvParameterIivNV #endif #ifndef glGetProgramEnvParameterIuivNV #define glGetProgramEnvParameterIuivNV SAGE_glGetProgramEnvParameterIuivNV #endif #endif #ifndef GL_NV_geometry_program4 #define GL_NV_geometry_program4 1 #ifndef glProgramVertexLimitNV #define glProgramVertexLimitNV SAGE_glProgramVertexLimitNV #endif #ifndef glFramebufferTextureEXT #define glFramebufferTextureEXT SAGE_glFramebufferTextureEXT #endif #ifndef glFramebufferTextureLayerEXT #define glFramebufferTextureLayerEXT SAGE_glFramebufferTextureLayerEXT #endif #ifndef glFramebufferTextureFaceEXT #define glFramebufferTextureFaceEXT SAGE_glFramebufferTextureFaceEXT #endif #endif #ifndef GL_EXT_geometry_shader4 #define GL_EXT_geometry_shader4 1 #ifndef glProgramParameteriEXT #define glProgramParameteriEXT SAGE_glProgramParameteriEXT #endif #endif #ifndef GL_NV_vertex_program4 #define GL_NV_vertex_program4 1 #ifndef glVertexAttribI1iEXT #define glVertexAttribI1iEXT SAGE_glVertexAttribI1iEXT #endif #ifndef glVertexAttribI2iEXT #define glVertexAttribI2iEXT SAGE_glVertexAttribI2iEXT #endif #ifndef glVertexAttribI3iEXT #define glVertexAttribI3iEXT SAGE_glVertexAttribI3iEXT #endif #ifndef glVertexAttribI4iEXT #define glVertexAttribI4iEXT SAGE_glVertexAttribI4iEXT #endif #ifndef glVertexAttribI1uiEXT #define glVertexAttribI1uiEXT SAGE_glVertexAttribI1uiEXT #endif #ifndef glVertexAttribI2uiEXT #define glVertexAttribI2uiEXT SAGE_glVertexAttribI2uiEXT #endif #ifndef glVertexAttribI3uiEXT #define glVertexAttribI3uiEXT SAGE_glVertexAttribI3uiEXT #endif #ifndef glVertexAttribI4uiEXT #define glVertexAttribI4uiEXT SAGE_glVertexAttribI4uiEXT #endif #ifndef glVertexAttribI1ivEXT #define glVertexAttribI1ivEXT SAGE_glVertexAttribI1ivEXT #endif #ifndef glVertexAttribI2ivEXT #define glVertexAttribI2ivEXT SAGE_glVertexAttribI2ivEXT #endif #ifndef glVertexAttribI3ivEXT #define glVertexAttribI3ivEXT SAGE_glVertexAttribI3ivEXT #endif #ifndef glVertexAttribI4ivEXT #define glVertexAttribI4ivEXT SAGE_glVertexAttribI4ivEXT #endif #ifndef glVertexAttribI1uivEXT #define glVertexAttribI1uivEXT SAGE_glVertexAttribI1uivEXT #endif #ifndef glVertexAttribI2uivEXT #define glVertexAttribI2uivEXT SAGE_glVertexAttribI2uivEXT #endif #ifndef glVertexAttribI3uivEXT #define glVertexAttribI3uivEXT SAGE_glVertexAttribI3uivEXT #endif #ifndef glVertexAttribI4uivEXT #define glVertexAttribI4uivEXT SAGE_glVertexAttribI4uivEXT #endif #ifndef glVertexAttribI4bvEXT #define glVertexAttribI4bvEXT SAGE_glVertexAttribI4bvEXT #endif #ifndef glVertexAttribI4svEXT #define glVertexAttribI4svEXT SAGE_glVertexAttribI4svEXT #endif #ifndef glVertexAttribI4ubvEXT #define glVertexAttribI4ubvEXT SAGE_glVertexAttribI4ubvEXT #endif #ifndef glVertexAttribI4usvEXT #define glVertexAttribI4usvEXT SAGE_glVertexAttribI4usvEXT #endif #ifndef glVertexAttribIPointerEXT #define glVertexAttribIPointerEXT SAGE_glVertexAttribIPointerEXT #endif #ifndef glGetVertexAttribIivEXT #define glGetVertexAttribIivEXT SAGE_glGetVertexAttribIivEXT #endif #ifndef glGetVertexAttribIuivEXT #define glGetVertexAttribIuivEXT SAGE_glGetVertexAttribIuivEXT #endif #endif #ifndef GL_EXT_gpu_shader4 #define GL_EXT_gpu_shader4 1 #ifndef glGetUniformuivEXT #define glGetUniformuivEXT SAGE_glGetUniformuivEXT #endif #ifndef glBindFragDataLocationEXT #define glBindFragDataLocationEXT SAGE_glBindFragDataLocationEXT #endif #ifndef glGetFragDataLocationEXT #define glGetFragDataLocationEXT SAGE_glGetFragDataLocationEXT #endif #ifndef glUniform1uiEXT #define glUniform1uiEXT SAGE_glUniform1uiEXT #endif #ifndef glUniform2uiEXT #define glUniform2uiEXT SAGE_glUniform2uiEXT #endif #ifndef glUniform3uiEXT #define glUniform3uiEXT SAGE_glUniform3uiEXT #endif #ifndef glUniform4uiEXT #define glUniform4uiEXT SAGE_glUniform4uiEXT #endif #ifndef glUniform1uivEXT #define glUniform1uivEXT SAGE_glUniform1uivEXT #endif #ifndef glUniform2uivEXT #define glUniform2uivEXT SAGE_glUniform2uivEXT #endif #ifndef glUniform3uivEXT #define glUniform3uivEXT SAGE_glUniform3uivEXT #endif #ifndef glUniform4uivEXT #define glUniform4uivEXT SAGE_glUniform4uivEXT #endif #endif #ifndef GL_EXT_draw_instanced #define GL_EXT_draw_instanced 1 #ifndef glDrawArraysInstancedEXT #define glDrawArraysInstancedEXT SAGE_glDrawArraysInstancedEXT #endif #ifndef glDrawElementsInstancedEXT #define glDrawElementsInstancedEXT SAGE_glDrawElementsInstancedEXT #endif #endif #ifndef GL_EXT_packed_float #define GL_EXT_packed_float 1 #endif #ifndef GL_EXT_texture_array #define GL_EXT_texture_array 1 #endif #ifndef GL_EXT_texture_buffer_object #define GL_EXT_texture_buffer_object 1 #ifndef glTexBufferEXT #define glTexBufferEXT SAGE_glTexBufferEXT #endif #endif #ifndef GL_EXT_texture_compression_latc #define GL_EXT_texture_compression_latc 1 #endif #ifndef GL_EXT_texture_compression_rgtc #define GL_EXT_texture_compression_rgtc 1 #endif #ifndef GL_EXT_texture_shared_exponent #define GL_EXT_texture_shared_exponent 1 #endif #ifndef GL_NV_depth_buffer_float #define GL_NV_depth_buffer_float 1 #ifndef glDepthRangedNV #define glDepthRangedNV SAGE_glDepthRangedNV #endif #ifndef glClearDepthdNV #define glClearDepthdNV SAGE_glClearDepthdNV #endif #ifndef glDepthBoundsdNV #define glDepthBoundsdNV SAGE_glDepthBoundsdNV #endif #endif #ifndef GL_NV_fragment_program4 #define GL_NV_fragment_program4 1 #endif #ifndef GL_NV_framebuffer_multisample_coverage #define GL_NV_framebuffer_multisample_coverage 1 #ifndef glRenderbufferStorageMultisampleCoverageNV #define glRenderbufferStorageMultisampleCoverageNV SAGE_glRenderbufferStorageMultisampleCoverageNV #endif #endif #ifndef GL_EXT_framebuffer_sRGB #define GL_EXT_framebuffer_sRGB 1 #endif #ifndef GL_NV_geometry_shader4 #define GL_NV_geometry_shader4 1 #endif #ifndef GL_NV_parameter_buffer_object #define GL_NV_parameter_buffer_object 1 #ifndef glProgramBufferParametersfvNV #define glProgramBufferParametersfvNV SAGE_glProgramBufferParametersfvNV #endif #ifndef glProgramBufferParametersIivNV #define glProgramBufferParametersIivNV SAGE_glProgramBufferParametersIivNV #endif #ifndef glProgramBufferParametersIuivNV #define glProgramBufferParametersIuivNV SAGE_glProgramBufferParametersIuivNV #endif #endif #ifndef GL_EXT_draw_buffers2 #define GL_EXT_draw_buffers2 1 #ifndef glColorMaskIndexedEXT #define glColorMaskIndexedEXT SAGE_glColorMaskIndexedEXT #endif #ifndef glGetBooleanIndexedvEXT #define glGetBooleanIndexedvEXT SAGE_glGetBooleanIndexedvEXT #endif #ifndef glGetIntegerIndexedvEXT #define glGetIntegerIndexedvEXT SAGE_glGetIntegerIndexedvEXT #endif #ifndef glEnableIndexedEXT #define glEnableIndexedEXT SAGE_glEnableIndexedEXT #endif #ifndef glDisableIndexedEXT #define glDisableIndexedEXT SAGE_glDisableIndexedEXT #endif #ifndef glIsEnabledIndexedEXT #define glIsEnabledIndexedEXT SAGE_glIsEnabledIndexedEXT #endif #endif #ifndef GL_NV_transform_feedback #define GL_NV_transform_feedback 1 #ifndef glBeginTransformFeedbackNV #define glBeginTransformFeedbackNV SAGE_glBeginTransformFeedbackNV #endif #ifndef glEndTransformFeedbackNV #define glEndTransformFeedbackNV SAGE_glEndTransformFeedbackNV #endif #ifndef glTransformFeedbackAttribsNV #define glTransformFeedbackAttribsNV SAGE_glTransformFeedbackAttribsNV #endif #ifndef glBindBufferRangeNV #define glBindBufferRangeNV SAGE_glBindBufferRangeNV #endif #ifndef glBindBufferOffsetNV #define glBindBufferOffsetNV SAGE_glBindBufferOffsetNV #endif #ifndef glBindBufferBaseNV #define glBindBufferBaseNV SAGE_glBindBufferBaseNV #endif #ifndef glTransformFeedbackVaryingsNV #define glTransformFeedbackVaryingsNV SAGE_glTransformFeedbackVaryingsNV #endif #ifndef glActiveVaryingNV #define glActiveVaryingNV SAGE_glActiveVaryingNV #endif #ifndef glGetVaryingLocationNV #define glGetVaryingLocationNV SAGE_glGetVaryingLocationNV #endif #ifndef glGetActiveVaryingNV #define glGetActiveVaryingNV SAGE_glGetActiveVaryingNV #endif #ifndef glGetTransformFeedbackVaryingNV #define glGetTransformFeedbackVaryingNV SAGE_glGetTransformFeedbackVaryingNV #endif #endif #ifndef GL_EXT_bindable_uniform #define GL_EXT_bindable_uniform 1 #ifndef glUniformBufferEXT #define glUniformBufferEXT SAGE_glUniformBufferEXT #endif #ifndef glGetUniformBufferSizeEXT #define glGetUniformBufferSizeEXT SAGE_glGetUniformBufferSizeEXT #endif #ifndef glGetUniformOffsetEXT #define glGetUniformOffsetEXT SAGE_glGetUniformOffsetEXT #endif #endif #ifndef GL_EXT_texture_integer #define GL_EXT_texture_integer 1 #ifndef glTexParameterIivEXT #define glTexParameterIivEXT SAGE_glTexParameterIivEXT #endif #ifndef glTexParameterIuivEXT #define glTexParameterIuivEXT SAGE_glTexParameterIuivEXT #endif #ifndef glGetTexParameterIivEXT #define glGetTexParameterIivEXT SAGE_glGetTexParameterIivEXT #endif #ifndef glGetTexParameterIuivEXT #define glGetTexParameterIuivEXT SAGE_glGetTexParameterIuivEXT #endif #ifndef glClearColorIiEXT #define glClearColorIiEXT SAGE_glClearColorIiEXT #endif #ifndef glClearColorIuiEXT #define glClearColorIuiEXT SAGE_glClearColorIuiEXT #endif #endif #ifndef GL_GREMEDY_frame_terminator #define GL_GREMEDY_frame_terminator 1 #ifndef glFrameTerminatorGREMEDY #define glFrameTerminatorGREMEDY SAGE_glFrameTerminatorGREMEDY #endif #endif #ifndef GL_NV_conditional_render #define GL_NV_conditional_render 1 #ifndef glBeginConditionalRenderNV #define glBeginConditionalRenderNV SAGE_glBeginConditionalRenderNV #endif #ifndef glEndConditionalRenderNV #define glEndConditionalRenderNV SAGE_glEndConditionalRenderNV #endif #endif #ifndef GL_NV_present_video #define GL_NV_present_video 1 #ifndef glPresentFrameKeyedNV #define glPresentFrameKeyedNV SAGE_glPresentFrameKeyedNV #endif #ifndef glPresentFrameDualFillNV #define glPresentFrameDualFillNV SAGE_glPresentFrameDualFillNV #endif #ifndef glGetVideoivNV #define glGetVideoivNV SAGE_glGetVideoivNV #endif #ifndef glGetVideouivNV #define glGetVideouivNV SAGE_glGetVideouivNV #endif #ifndef glGetVideoi64vNV #define glGetVideoi64vNV SAGE_glGetVideoi64vNV #endif #ifndef glGetVideoui64vNV #define glGetVideoui64vNV SAGE_glGetVideoui64vNV #endif #endif #ifndef GL_EXT_transform_feedback #define GL_EXT_transform_feedback 1 #ifndef glBeginTransformFeedbackEXT #define glBeginTransformFeedbackEXT SAGE_glBeginTransformFeedbackEXT #endif #ifndef glEndTransformFeedbackEXT #define glEndTransformFeedbackEXT SAGE_glEndTransformFeedbackEXT #endif #ifndef glBindBufferRangeEXT #define glBindBufferRangeEXT SAGE_glBindBufferRangeEXT #endif #ifndef glBindBufferOffsetEXT #define glBindBufferOffsetEXT SAGE_glBindBufferOffsetEXT #endif #ifndef glBindBufferBaseEXT #define glBindBufferBaseEXT SAGE_glBindBufferBaseEXT #endif #ifndef glTransformFeedbackVaryingsEXT #define glTransformFeedbackVaryingsEXT SAGE_glTransformFeedbackVaryingsEXT #endif #ifndef glGetTransformFeedbackVaryingEXT #define glGetTransformFeedbackVaryingEXT SAGE_glGetTransformFeedbackVaryingEXT #endif #endif #ifndef GL_EXT_direct_state_access #define GL_EXT_direct_state_access 1 #ifndef glClientAttribDefaultEXT #define glClientAttribDefaultEXT SAGE_glClientAttribDefaultEXT #endif #ifndef glPushClientAttribDefaultEXT #define glPushClientAttribDefaultEXT SAGE_glPushClientAttribDefaultEXT #endif #ifndef glMatrixLoadfEXT #define glMatrixLoadfEXT SAGE_glMatrixLoadfEXT #endif #ifndef glMatrixLoaddEXT #define glMatrixLoaddEXT SAGE_glMatrixLoaddEXT #endif #ifndef glMatrixMultfEXT #define glMatrixMultfEXT SAGE_glMatrixMultfEXT #endif #ifndef glMatrixMultdEXT #define glMatrixMultdEXT SAGE_glMatrixMultdEXT #endif #ifndef glMatrixLoadIdentityEXT #define glMatrixLoadIdentityEXT SAGE_glMatrixLoadIdentityEXT #endif #ifndef glMatrixRotatefEXT #define glMatrixRotatefEXT SAGE_glMatrixRotatefEXT #endif #ifndef glMatrixRotatedEXT #define glMatrixRotatedEXT SAGE_glMatrixRotatedEXT #endif #ifndef glMatrixScalefEXT #define glMatrixScalefEXT SAGE_glMatrixScalefEXT #endif #ifndef glMatrixScaledEXT #define glMatrixScaledEXT SAGE_glMatrixScaledEXT #endif #ifndef glMatrixTranslatefEXT #define glMatrixTranslatefEXT SAGE_glMatrixTranslatefEXT #endif #ifndef glMatrixTranslatedEXT #define glMatrixTranslatedEXT SAGE_glMatrixTranslatedEXT #endif #ifndef glMatrixFrustumEXT #define glMatrixFrustumEXT SAGE_glMatrixFrustumEXT #endif #ifndef glMatrixOrthoEXT #define glMatrixOrthoEXT SAGE_glMatrixOrthoEXT #endif #ifndef glMatrixPopEXT #define glMatrixPopEXT SAGE_glMatrixPopEXT #endif #ifndef glMatrixPushEXT #define glMatrixPushEXT SAGE_glMatrixPushEXT #endif #ifndef glMatrixLoadTransposefEXT #define glMatrixLoadTransposefEXT SAGE_glMatrixLoadTransposefEXT #endif #ifndef glMatrixLoadTransposedEXT #define glMatrixLoadTransposedEXT SAGE_glMatrixLoadTransposedEXT #endif #ifndef glMatrixMultTransposefEXT #define glMatrixMultTransposefEXT SAGE_glMatrixMultTransposefEXT #endif #ifndef glMatrixMultTransposedEXT #define glMatrixMultTransposedEXT SAGE_glMatrixMultTransposedEXT #endif #ifndef glTextureParameterfEXT #define glTextureParameterfEXT SAGE_glTextureParameterfEXT #endif #ifndef glTextureParameterfvEXT #define glTextureParameterfvEXT SAGE_glTextureParameterfvEXT #endif #ifndef glTextureParameteriEXT #define glTextureParameteriEXT SAGE_glTextureParameteriEXT #endif #ifndef glTextureParameterivEXT #define glTextureParameterivEXT SAGE_glTextureParameterivEXT #endif #ifndef glTextureImage1DEXT #define glTextureImage1DEXT SAGE_glTextureImage1DEXT #endif #ifndef glTextureImage2DEXT #define glTextureImage2DEXT SAGE_glTextureImage2DEXT #endif #ifndef glTextureSubImage1DEXT #define glTextureSubImage1DEXT SAGE_glTextureSubImage1DEXT #endif #ifndef glTextureSubImage2DEXT #define glTextureSubImage2DEXT SAGE_glTextureSubImage2DEXT #endif #ifndef glCopyTextureImage1DEXT #define glCopyTextureImage1DEXT SAGE_glCopyTextureImage1DEXT #endif #ifndef glCopyTextureImage2DEXT #define glCopyTextureImage2DEXT SAGE_glCopyTextureImage2DEXT #endif #ifndef glCopyTextureSubImage1DEXT #define glCopyTextureSubImage1DEXT SAGE_glCopyTextureSubImage1DEXT #endif #ifndef glCopyTextureSubImage2DEXT #define glCopyTextureSubImage2DEXT SAGE_glCopyTextureSubImage2DEXT #endif #ifndef glGetTextureImageEXT #define glGetTextureImageEXT SAGE_glGetTextureImageEXT #endif #ifndef glGetTextureParameterfvEXT #define glGetTextureParameterfvEXT SAGE_glGetTextureParameterfvEXT #endif #ifndef glGetTextureParameterivEXT #define glGetTextureParameterivEXT SAGE_glGetTextureParameterivEXT #endif #ifndef glGetTextureLevelParameterfvEXT #define glGetTextureLevelParameterfvEXT SAGE_glGetTextureLevelParameterfvEXT #endif #ifndef glGetTextureLevelParameterivEXT #define glGetTextureLevelParameterivEXT SAGE_glGetTextureLevelParameterivEXT #endif #ifndef glTextureImage3DEXT #define glTextureImage3DEXT SAGE_glTextureImage3DEXT #endif #ifndef glTextureSubImage3DEXT #define glTextureSubImage3DEXT SAGE_glTextureSubImage3DEXT #endif #ifndef glCopyTextureSubImage3DEXT #define glCopyTextureSubImage3DEXT SAGE_glCopyTextureSubImage3DEXT #endif #ifndef glMultiTexParameterfEXT #define glMultiTexParameterfEXT SAGE_glMultiTexParameterfEXT #endif #ifndef glMultiTexParameterfvEXT #define glMultiTexParameterfvEXT SAGE_glMultiTexParameterfvEXT #endif #ifndef glMultiTexParameteriEXT #define glMultiTexParameteriEXT SAGE_glMultiTexParameteriEXT #endif #ifndef glMultiTexParameterivEXT #define glMultiTexParameterivEXT SAGE_glMultiTexParameterivEXT #endif #ifndef glMultiTexImage1DEXT #define glMultiTexImage1DEXT SAGE_glMultiTexImage1DEXT #endif #ifndef glMultiTexImage2DEXT #define glMultiTexImage2DEXT SAGE_glMultiTexImage2DEXT #endif #ifndef glMultiTexSubImage1DEXT #define glMultiTexSubImage1DEXT SAGE_glMultiTexSubImage1DEXT #endif #ifndef glMultiTexSubImage2DEXT #define glMultiTexSubImage2DEXT SAGE_glMultiTexSubImage2DEXT #endif #ifndef glCopyMultiTexImage1DEXT #define glCopyMultiTexImage1DEXT SAGE_glCopyMultiTexImage1DEXT #endif #ifndef glCopyMultiTexImage2DEXT #define glCopyMultiTexImage2DEXT SAGE_glCopyMultiTexImage2DEXT #endif #ifndef glCopyMultiTexSubImage1DEXT #define glCopyMultiTexSubImage1DEXT SAGE_glCopyMultiTexSubImage1DEXT #endif #ifndef glCopyMultiTexSubImage2DEXT #define glCopyMultiTexSubImage2DEXT SAGE_glCopyMultiTexSubImage2DEXT #endif #ifndef glGetMultiTexImageEXT #define glGetMultiTexImageEXT SAGE_glGetMultiTexImageEXT #endif #ifndef glGetMultiTexParameterfvEXT #define glGetMultiTexParameterfvEXT SAGE_glGetMultiTexParameterfvEXT #endif #ifndef glGetMultiTexParameterivEXT #define glGetMultiTexParameterivEXT SAGE_glGetMultiTexParameterivEXT #endif #ifndef glGetMultiTexLevelParameterfvEXT #define glGetMultiTexLevelParameterfvEXT SAGE_glGetMultiTexLevelParameterfvEXT #endif #ifndef glGetMultiTexLevelParameterivEXT #define glGetMultiTexLevelParameterivEXT SAGE_glGetMultiTexLevelParameterivEXT #endif #ifndef glMultiTexImage3DEXT #define glMultiTexImage3DEXT SAGE_glMultiTexImage3DEXT #endif #ifndef glMultiTexSubImage3DEXT #define glMultiTexSubImage3DEXT SAGE_glMultiTexSubImage3DEXT #endif #ifndef glCopyMultiTexSubImage3DEXT #define glCopyMultiTexSubImage3DEXT SAGE_glCopyMultiTexSubImage3DEXT #endif #ifndef glBindMultiTextureEXT #define glBindMultiTextureEXT SAGE_glBindMultiTextureEXT #endif #ifndef glEnableClientStateIndexedEXT #define glEnableClientStateIndexedEXT SAGE_glEnableClientStateIndexedEXT #endif #ifndef glDisableClientStateIndexedEXT #define glDisableClientStateIndexedEXT SAGE_glDisableClientStateIndexedEXT #endif #ifndef glMultiTexCoordPointerEXT #define glMultiTexCoordPointerEXT SAGE_glMultiTexCoordPointerEXT #endif #ifndef glMultiTexEnvfEXT #define glMultiTexEnvfEXT SAGE_glMultiTexEnvfEXT #endif #ifndef glMultiTexEnvfvEXT #define glMultiTexEnvfvEXT SAGE_glMultiTexEnvfvEXT #endif #ifndef glMultiTexEnviEXT #define glMultiTexEnviEXT SAGE_glMultiTexEnviEXT #endif #ifndef glMultiTexEnvivEXT #define glMultiTexEnvivEXT SAGE_glMultiTexEnvivEXT #endif #ifndef glMultiTexGendEXT #define glMultiTexGendEXT SAGE_glMultiTexGendEXT #endif #ifndef glMultiTexGendvEXT #define glMultiTexGendvEXT SAGE_glMultiTexGendvEXT #endif #ifndef glMultiTexGenfEXT #define glMultiTexGenfEXT SAGE_glMultiTexGenfEXT #endif #ifndef glMultiTexGenfvEXT #define glMultiTexGenfvEXT SAGE_glMultiTexGenfvEXT #endif #ifndef glMultiTexGeniEXT #define glMultiTexGeniEXT SAGE_glMultiTexGeniEXT #endif #ifndef glMultiTexGenivEXT #define glMultiTexGenivEXT SAGE_glMultiTexGenivEXT #endif #ifndef glGetMultiTexEnvfvEXT #define glGetMultiTexEnvfvEXT SAGE_glGetMultiTexEnvfvEXT #endif #ifndef glGetMultiTexEnvivEXT #define glGetMultiTexEnvivEXT SAGE_glGetMultiTexEnvivEXT #endif #ifndef glGetMultiTexGendvEXT #define glGetMultiTexGendvEXT SAGE_glGetMultiTexGendvEXT #endif #ifndef glGetMultiTexGenfvEXT #define glGetMultiTexGenfvEXT SAGE_glGetMultiTexGenfvEXT #endif #ifndef glGetMultiTexGenivEXT #define glGetMultiTexGenivEXT SAGE_glGetMultiTexGenivEXT #endif #ifndef glGetFloatIndexedvEXT #define glGetFloatIndexedvEXT SAGE_glGetFloatIndexedvEXT #endif #ifndef glGetDoubleIndexedvEXT #define glGetDoubleIndexedvEXT SAGE_glGetDoubleIndexedvEXT #endif #ifndef glGetPointerIndexedvEXT #define glGetPointerIndexedvEXT SAGE_glGetPointerIndexedvEXT #endif #ifndef glCompressedTextureImage3DEXT #define glCompressedTextureImage3DEXT SAGE_glCompressedTextureImage3DEXT #endif #ifndef glCompressedTextureImage2DEXT #define glCompressedTextureImage2DEXT SAGE_glCompressedTextureImage2DEXT #endif #ifndef glCompressedTextureImage1DEXT #define glCompressedTextureImage1DEXT SAGE_glCompressedTextureImage1DEXT #endif #ifndef glCompressedTextureSubImage3DEXT #define glCompressedTextureSubImage3DEXT SAGE_glCompressedTextureSubImage3DEXT #endif #ifndef glCompressedTextureSubImage2DEXT #define glCompressedTextureSubImage2DEXT SAGE_glCompressedTextureSubImage2DEXT #endif #ifndef glCompressedTextureSubImage1DEXT #define glCompressedTextureSubImage1DEXT SAGE_glCompressedTextureSubImage1DEXT #endif #ifndef glGetCompressedTextureImageEXT #define glGetCompressedTextureImageEXT SAGE_glGetCompressedTextureImageEXT #endif #ifndef glCompressedMultiTexImage3DEXT #define glCompressedMultiTexImage3DEXT SAGE_glCompressedMultiTexImage3DEXT #endif #ifndef glCompressedMultiTexImage2DEXT #define glCompressedMultiTexImage2DEXT SAGE_glCompressedMultiTexImage2DEXT #endif #ifndef glCompressedMultiTexImage1DEXT #define glCompressedMultiTexImage1DEXT SAGE_glCompressedMultiTexImage1DEXT #endif #ifndef glCompressedMultiTexSubImage3DEXT #define glCompressedMultiTexSubImage3DEXT SAGE_glCompressedMultiTexSubImage3DEXT #endif #ifndef glCompressedMultiTexSubImage2DEXT #define glCompressedMultiTexSubImage2DEXT SAGE_glCompressedMultiTexSubImage2DEXT #endif #ifndef glCompressedMultiTexSubImage1DEXT #define glCompressedMultiTexSubImage1DEXT SAGE_glCompressedMultiTexSubImage1DEXT #endif #ifndef glGetCompressedMultiTexImageEXT #define glGetCompressedMultiTexImageEXT SAGE_glGetCompressedMultiTexImageEXT #endif #ifndef glNamedProgramStringEXT #define glNamedProgramStringEXT SAGE_glNamedProgramStringEXT #endif #ifndef glNamedProgramLocalParameter4dEXT #define glNamedProgramLocalParameter4dEXT SAGE_glNamedProgramLocalParameter4dEXT #endif #ifndef glNamedProgramLocalParameter4dvEXT #define glNamedProgramLocalParameter4dvEXT SAGE_glNamedProgramLocalParameter4dvEXT #endif #ifndef glNamedProgramLocalParameter4fEXT #define glNamedProgramLocalParameter4fEXT SAGE_glNamedProgramLocalParameter4fEXT #endif #ifndef glNamedProgramLocalParameter4fvEXT #define glNamedProgramLocalParameter4fvEXT SAGE_glNamedProgramLocalParameter4fvEXT #endif #ifndef glGetNamedProgramLocalParameterdvEXT #define glGetNamedProgramLocalParameterdvEXT SAGE_glGetNamedProgramLocalParameterdvEXT #endif #ifndef glGetNamedProgramLocalParameterfvEXT #define glGetNamedProgramLocalParameterfvEXT SAGE_glGetNamedProgramLocalParameterfvEXT #endif #ifndef glGetNamedProgramivEXT #define glGetNamedProgramivEXT SAGE_glGetNamedProgramivEXT #endif #ifndef glGetNamedProgramStringEXT #define glGetNamedProgramStringEXT SAGE_glGetNamedProgramStringEXT #endif #ifndef glNamedProgramLocalParameters4fvEXT #define glNamedProgramLocalParameters4fvEXT SAGE_glNamedProgramLocalParameters4fvEXT #endif #ifndef glNamedProgramLocalParameterI4iEXT #define glNamedProgramLocalParameterI4iEXT SAGE_glNamedProgramLocalParameterI4iEXT #endif #ifndef glNamedProgramLocalParameterI4ivEXT #define glNamedProgramLocalParameterI4ivEXT SAGE_glNamedProgramLocalParameterI4ivEXT #endif #ifndef glNamedProgramLocalParametersI4ivEXT #define glNamedProgramLocalParametersI4ivEXT SAGE_glNamedProgramLocalParametersI4ivEXT #endif #ifndef glNamedProgramLocalParameterI4uiEXT #define glNamedProgramLocalParameterI4uiEXT SAGE_glNamedProgramLocalParameterI4uiEXT #endif #ifndef glNamedProgramLocalParameterI4uivEXT #define glNamedProgramLocalParameterI4uivEXT SAGE_glNamedProgramLocalParameterI4uivEXT #endif #ifndef glNamedProgramLocalParametersI4uivEXT #define glNamedProgramLocalParametersI4uivEXT SAGE_glNamedProgramLocalParametersI4uivEXT #endif #ifndef glGetNamedProgramLocalParameterIivEXT #define glGetNamedProgramLocalParameterIivEXT SAGE_glGetNamedProgramLocalParameterIivEXT #endif #ifndef glGetNamedProgramLocalParameterIuivEXT #define glGetNamedProgramLocalParameterIuivEXT SAGE_glGetNamedProgramLocalParameterIuivEXT #endif #ifndef glTextureParameterIivEXT #define glTextureParameterIivEXT SAGE_glTextureParameterIivEXT #endif #ifndef glTextureParameterIuivEXT #define glTextureParameterIuivEXT SAGE_glTextureParameterIuivEXT #endif #ifndef glGetTextureParameterIivEXT #define glGetTextureParameterIivEXT SAGE_glGetTextureParameterIivEXT #endif #ifndef glGetTextureParameterIuivEXT #define glGetTextureParameterIuivEXT SAGE_glGetTextureParameterIuivEXT #endif #ifndef glMultiTexParameterIivEXT #define glMultiTexParameterIivEXT SAGE_glMultiTexParameterIivEXT #endif #ifndef glMultiTexParameterIuivEXT #define glMultiTexParameterIuivEXT SAGE_glMultiTexParameterIuivEXT #endif #ifndef glGetMultiTexParameterIivEXT #define glGetMultiTexParameterIivEXT SAGE_glGetMultiTexParameterIivEXT #endif #ifndef glGetMultiTexParameterIuivEXT #define glGetMultiTexParameterIuivEXT SAGE_glGetMultiTexParameterIuivEXT #endif #ifndef glProgramUniform1fEXT #define glProgramUniform1fEXT SAGE_glProgramUniform1fEXT #endif #ifndef glProgramUniform2fEXT #define glProgramUniform2fEXT SAGE_glProgramUniform2fEXT #endif #ifndef glProgramUniform3fEXT #define glProgramUniform3fEXT SAGE_glProgramUniform3fEXT #endif #ifndef glProgramUniform4fEXT #define glProgramUniform4fEXT SAGE_glProgramUniform4fEXT #endif #ifndef glProgramUniform1iEXT #define glProgramUniform1iEXT SAGE_glProgramUniform1iEXT #endif #ifndef glProgramUniform2iEXT #define glProgramUniform2iEXT SAGE_glProgramUniform2iEXT #endif #ifndef glProgramUniform3iEXT #define glProgramUniform3iEXT SAGE_glProgramUniform3iEXT #endif #ifndef glProgramUniform4iEXT #define glProgramUniform4iEXT SAGE_glProgramUniform4iEXT #endif #ifndef glProgramUniform1fvEXT #define glProgramUniform1fvEXT SAGE_glProgramUniform1fvEXT #endif #ifndef glProgramUniform2fvEXT #define glProgramUniform2fvEXT SAGE_glProgramUniform2fvEXT #endif #ifndef glProgramUniform3fvEXT #define glProgramUniform3fvEXT SAGE_glProgramUniform3fvEXT #endif #ifndef glProgramUniform4fvEXT #define glProgramUniform4fvEXT SAGE_glProgramUniform4fvEXT #endif #ifndef glProgramUniform1ivEXT #define glProgramUniform1ivEXT SAGE_glProgramUniform1ivEXT #endif #ifndef glProgramUniform2ivEXT #define glProgramUniform2ivEXT SAGE_glProgramUniform2ivEXT #endif #ifndef glProgramUniform3ivEXT #define glProgramUniform3ivEXT SAGE_glProgramUniform3ivEXT #endif #ifndef glProgramUniform4ivEXT #define glProgramUniform4ivEXT SAGE_glProgramUniform4ivEXT #endif #ifndef glProgramUniformMatrix2fvEXT #define glProgramUniformMatrix2fvEXT SAGE_glProgramUniformMatrix2fvEXT #endif #ifndef glProgramUniformMatrix3fvEXT #define glProgramUniformMatrix3fvEXT SAGE_glProgramUniformMatrix3fvEXT #endif #ifndef glProgramUniformMatrix4fvEXT #define glProgramUniformMatrix4fvEXT SAGE_glProgramUniformMatrix4fvEXT #endif #ifndef glProgramUniformMatrix2x3fvEXT #define glProgramUniformMatrix2x3fvEXT SAGE_glProgramUniformMatrix2x3fvEXT #endif #ifndef glProgramUniformMatrix3x2fvEXT #define glProgramUniformMatrix3x2fvEXT SAGE_glProgramUniformMatrix3x2fvEXT #endif #ifndef glProgramUniformMatrix2x4fvEXT #define glProgramUniformMatrix2x4fvEXT SAGE_glProgramUniformMatrix2x4fvEXT #endif #ifndef glProgramUniformMatrix4x2fvEXT #define glProgramUniformMatrix4x2fvEXT SAGE_glProgramUniformMatrix4x2fvEXT #endif #ifndef glProgramUniformMatrix3x4fvEXT #define glProgramUniformMatrix3x4fvEXT SAGE_glProgramUniformMatrix3x4fvEXT #endif #ifndef glProgramUniformMatrix4x3fvEXT #define glProgramUniformMatrix4x3fvEXT SAGE_glProgramUniformMatrix4x3fvEXT #endif #ifndef glProgramUniform1uiEXT #define glProgramUniform1uiEXT SAGE_glProgramUniform1uiEXT #endif #ifndef glProgramUniform2uiEXT #define glProgramUniform2uiEXT SAGE_glProgramUniform2uiEXT #endif #ifndef glProgramUniform3uiEXT #define glProgramUniform3uiEXT SAGE_glProgramUniform3uiEXT #endif #ifndef glProgramUniform4uiEXT #define glProgramUniform4uiEXT SAGE_glProgramUniform4uiEXT #endif #ifndef glProgramUniform1uivEXT #define glProgramUniform1uivEXT SAGE_glProgramUniform1uivEXT #endif #ifndef glProgramUniform2uivEXT #define glProgramUniform2uivEXT SAGE_glProgramUniform2uivEXT #endif #ifndef glProgramUniform3uivEXT #define glProgramUniform3uivEXT SAGE_glProgramUniform3uivEXT #endif #ifndef glProgramUniform4uivEXT #define glProgramUniform4uivEXT SAGE_glProgramUniform4uivEXT #endif #ifndef glNamedBufferDataEXT #define glNamedBufferDataEXT SAGE_glNamedBufferDataEXT #endif #ifndef glNamedBufferSubDataEXT #define glNamedBufferSubDataEXT SAGE_glNamedBufferSubDataEXT #endif #ifndef glMapNamedBufferEXT #define glMapNamedBufferEXT SAGE_glMapNamedBufferEXT #endif #ifndef glUnmapNamedBufferEXT #define glUnmapNamedBufferEXT SAGE_glUnmapNamedBufferEXT #endif #ifndef glGetNamedBufferParameterivEXT #define glGetNamedBufferParameterivEXT SAGE_glGetNamedBufferParameterivEXT #endif #ifndef glGetNamedBufferPointervEXT #define glGetNamedBufferPointervEXT SAGE_glGetNamedBufferPointervEXT #endif #ifndef glGetNamedBufferSubDataEXT #define glGetNamedBufferSubDataEXT SAGE_glGetNamedBufferSubDataEXT #endif #ifndef glTextureBufferEXT #define glTextureBufferEXT SAGE_glTextureBufferEXT #endif #ifndef glMultiTexBufferEXT #define glMultiTexBufferEXT SAGE_glMultiTexBufferEXT #endif #ifndef glNamedRenderbufferStorageEXT #define glNamedRenderbufferStorageEXT SAGE_glNamedRenderbufferStorageEXT #endif #ifndef glGetNamedRenderbufferParameterivEXT #define glGetNamedRenderbufferParameterivEXT SAGE_glGetNamedRenderbufferParameterivEXT #endif #ifndef glCheckNamedFramebufferStatusEXT #define glCheckNamedFramebufferStatusEXT SAGE_glCheckNamedFramebufferStatusEXT #endif #ifndef glNamedFramebufferTexture1DEXT #define glNamedFramebufferTexture1DEXT SAGE_glNamedFramebufferTexture1DEXT #endif #ifndef glNamedFramebufferTexture2DEXT #define glNamedFramebufferTexture2DEXT SAGE_glNamedFramebufferTexture2DEXT #endif #ifndef glNamedFramebufferTexture3DEXT #define glNamedFramebufferTexture3DEXT SAGE_glNamedFramebufferTexture3DEXT #endif #ifndef glNamedFramebufferRenderbufferEXT #define glNamedFramebufferRenderbufferEXT SAGE_glNamedFramebufferRenderbufferEXT #endif #ifndef glGetNamedFramebufferAttachmentParameterivEXT #define glGetNamedFramebufferAttachmentParameterivEXT SAGE_glGetNamedFramebufferAttachmentParameterivEXT #endif #ifndef glGenerateTextureMipmapEXT #define glGenerateTextureMipmapEXT SAGE_glGenerateTextureMipmapEXT #endif #ifndef glGenerateMultiTexMipmapEXT #define glGenerateMultiTexMipmapEXT SAGE_glGenerateMultiTexMipmapEXT #endif #ifndef glFramebufferDrawBufferEXT #define glFramebufferDrawBufferEXT SAGE_glFramebufferDrawBufferEXT #endif #ifndef glFramebufferDrawBuffersEXT #define glFramebufferDrawBuffersEXT SAGE_glFramebufferDrawBuffersEXT #endif #ifndef glFramebufferReadBufferEXT #define glFramebufferReadBufferEXT SAGE_glFramebufferReadBufferEXT #endif #ifndef glGetFramebufferParameterivEXT #define glGetFramebufferParameterivEXT SAGE_glGetFramebufferParameterivEXT #endif #ifndef glNamedRenderbufferStorageMultisampleEXT #define glNamedRenderbufferStorageMultisampleEXT SAGE_glNamedRenderbufferStorageMultisampleEXT #endif #ifndef glNamedRenderbufferStorageMultisampleCoverageEXT #define glNamedRenderbufferStorageMultisampleCoverageEXT SAGE_glNamedRenderbufferStorageMultisampleCoverageEXT #endif #ifndef glNamedFramebufferTextureEXT #define glNamedFramebufferTextureEXT SAGE_glNamedFramebufferTextureEXT #endif #ifndef glNamedFramebufferTextureLayerEXT #define glNamedFramebufferTextureLayerEXT SAGE_glNamedFramebufferTextureLayerEXT #endif #ifndef glNamedFramebufferTextureFaceEXT #define glNamedFramebufferTextureFaceEXT SAGE_glNamedFramebufferTextureFaceEXT #endif #ifndef glTextureRenderbufferEXT #define glTextureRenderbufferEXT SAGE_glTextureRenderbufferEXT #endif #ifndef glMultiTexRenderbufferEXT #define glMultiTexRenderbufferEXT SAGE_glMultiTexRenderbufferEXT #endif #endif #ifndef GL_EXT_vertex_array_bgra #define GL_EXT_vertex_array_bgra 1 #endif #ifndef GL_EXT_texture_swizzle #define GL_EXT_texture_swizzle 1 #endif #ifndef GL_NV_explicit_multisample #define GL_NV_explicit_multisample 1 #ifndef glGetMultisamplefvNV #define glGetMultisamplefvNV SAGE_glGetMultisamplefvNV #endif #ifndef glSampleMaskIndexedNV #define glSampleMaskIndexedNV SAGE_glSampleMaskIndexedNV #endif #ifndef glTexRenderbufferNV #define glTexRenderbufferNV SAGE_glTexRenderbufferNV #endif #endif #ifndef GL_NV_transform_feedback2 #define GL_NV_transform_feedback2 1 #ifndef glBindTransformFeedbackNV #define glBindTransformFeedbackNV SAGE_glBindTransformFeedbackNV #endif #ifndef glDeleteTransformFeedbacksNV #define glDeleteTransformFeedbacksNV SAGE_glDeleteTransformFeedbacksNV #endif #ifndef glGenTransformFeedbacksNV #define glGenTransformFeedbacksNV SAGE_glGenTransformFeedbacksNV #endif #ifndef glIsTransformFeedbackNV #define glIsTransformFeedbackNV SAGE_glIsTransformFeedbackNV #endif #ifndef glPauseTransformFeedbackNV #define glPauseTransformFeedbackNV SAGE_glPauseTransformFeedbackNV #endif #ifndef glResumeTransformFeedbackNV #define glResumeTransformFeedbackNV SAGE_glResumeTransformFeedbackNV #endif #ifndef glDrawTransformFeedbackNV #define glDrawTransformFeedbackNV SAGE_glDrawTransformFeedbackNV #endif #endif #ifndef GL_ATI_meminfo #define GL_ATI_meminfo 1 #endif #ifndef GL_AMD_performance_monitor #define GL_AMD_performance_monitor 1 #ifndef glGetPerfMonitorGroupsAMD #define glGetPerfMonitorGroupsAMD SAGE_glGetPerfMonitorGroupsAMD #endif #ifndef glGetPerfMonitorCountersAMD #define glGetPerfMonitorCountersAMD SAGE_glGetPerfMonitorCountersAMD #endif #ifndef glGetPerfMonitorGroupStringAMD #define glGetPerfMonitorGroupStringAMD SAGE_glGetPerfMonitorGroupStringAMD #endif #ifndef glGetPerfMonitorCounterStringAMD #define glGetPerfMonitorCounterStringAMD SAGE_glGetPerfMonitorCounterStringAMD #endif #ifndef glGetPerfMonitorCounterInfoAMD #define glGetPerfMonitorCounterInfoAMD SAGE_glGetPerfMonitorCounterInfoAMD #endif #ifndef glGenPerfMonitorsAMD #define glGenPerfMonitorsAMD SAGE_glGenPerfMonitorsAMD #endif #ifndef glDeletePerfMonitorsAMD #define glDeletePerfMonitorsAMD SAGE_glDeletePerfMonitorsAMD #endif #ifndef glSelectPerfMonitorCountersAMD #define glSelectPerfMonitorCountersAMD SAGE_glSelectPerfMonitorCountersAMD #endif #ifndef glBeginPerfMonitorAMD #define glBeginPerfMonitorAMD SAGE_glBeginPerfMonitorAMD #endif #ifndef glEndPerfMonitorAMD #define glEndPerfMonitorAMD SAGE_glEndPerfMonitorAMD #endif #ifndef glGetPerfMonitorCounterDataAMD #define glGetPerfMonitorCounterDataAMD SAGE_glGetPerfMonitorCounterDataAMD #endif #endif #ifndef GL_AMD_texture_texture4 #define GL_AMD_texture_texture4 1 #endif #ifndef GL_AMD_vertex_shader_tesselator #define GL_AMD_vertex_shader_tesselator 1 #ifndef glTessellationFactorAMD #define glTessellationFactorAMD SAGE_glTessellationFactorAMD #endif #ifndef glTessellationModeAMD #define glTessellationModeAMD SAGE_glTessellationModeAMD #endif #endif #ifndef GL_EXT_provoking_vertex #define GL_EXT_provoking_vertex 1 #ifndef glProvokingVertexEXT #define glProvokingVertexEXT SAGE_glProvokingVertexEXT #endif #endif #ifndef GL_EXT_texture_snorm #define GL_EXT_texture_snorm 1 #endif #ifndef GL_AMD_draw_buffers_blend #define GL_AMD_draw_buffers_blend 1 #ifndef glBlendFuncIndexedAMD #define glBlendFuncIndexedAMD SAGE_glBlendFuncIndexedAMD #endif #ifndef glBlendFuncSeparateIndexedAMD #define glBlendFuncSeparateIndexedAMD SAGE_glBlendFuncSeparateIndexedAMD #endif #ifndef glBlendEquationIndexedAMD #define glBlendEquationIndexedAMD SAGE_glBlendEquationIndexedAMD #endif #ifndef glBlendEquationSeparateIndexedAMD #define glBlendEquationSeparateIndexedAMD SAGE_glBlendEquationSeparateIndexedAMD #endif #endif #ifndef GL_APPLE_texture_range #define GL_APPLE_texture_range 1 #ifndef glTextureRangeAPPLE #define glTextureRangeAPPLE SAGE_glTextureRangeAPPLE #endif #ifndef glGetTexParameterPointervAPPLE #define glGetTexParameterPointervAPPLE SAGE_glGetTexParameterPointervAPPLE #endif #endif #ifndef GL_APPLE_float_pixels #define GL_APPLE_float_pixels 1 #endif #ifndef GL_APPLE_vertex_program_evaluators #define GL_APPLE_vertex_program_evaluators 1 #ifndef glEnableVertexAttribAPPLE #define glEnableVertexAttribAPPLE SAGE_glEnableVertexAttribAPPLE #endif #ifndef glDisableVertexAttribAPPLE #define glDisableVertexAttribAPPLE SAGE_glDisableVertexAttribAPPLE #endif #ifndef glIsVertexAttribEnabledAPPLE #define glIsVertexAttribEnabledAPPLE SAGE_glIsVertexAttribEnabledAPPLE #endif #ifndef glMapVertexAttrib1dAPPLE #define glMapVertexAttrib1dAPPLE SAGE_glMapVertexAttrib1dAPPLE #endif #ifndef glMapVertexAttrib1fAPPLE #define glMapVertexAttrib1fAPPLE SAGE_glMapVertexAttrib1fAPPLE #endif #ifndef glMapVertexAttrib2dAPPLE #define glMapVertexAttrib2dAPPLE SAGE_glMapVertexAttrib2dAPPLE #endif #ifndef glMapVertexAttrib2fAPPLE #define glMapVertexAttrib2fAPPLE SAGE_glMapVertexAttrib2fAPPLE #endif #endif #ifndef GL_APPLE_aux_depth_stencil #define GL_APPLE_aux_depth_stencil 1 #endif #ifndef GL_APPLE_object_purgeable #define GL_APPLE_object_purgeable 1 #ifndef glObjectPurgeableAPPLE #define glObjectPurgeableAPPLE SAGE_glObjectPurgeableAPPLE #endif #ifndef glObjectUnpurgeableAPPLE #define glObjectUnpurgeableAPPLE SAGE_glObjectUnpurgeableAPPLE #endif #ifndef glGetObjectParameterivAPPLE #define glGetObjectParameterivAPPLE SAGE_glGetObjectParameterivAPPLE #endif #endif #ifndef GL_APPLE_row_bytes #define GL_APPLE_row_bytes 1 #endif #ifndef GL_APPLE_rgb_422 #define GL_APPLE_rgb_422 1 #endif #ifndef GL_NV_video_capture #define GL_NV_video_capture 1 #ifndef glBeginVideoCaptureNV #define glBeginVideoCaptureNV SAGE_glBeginVideoCaptureNV #endif #ifndef glBindVideoCaptureStreamBufferNV #define glBindVideoCaptureStreamBufferNV SAGE_glBindVideoCaptureStreamBufferNV #endif #ifndef glBindVideoCaptureStreamTextureNV #define glBindVideoCaptureStreamTextureNV SAGE_glBindVideoCaptureStreamTextureNV #endif #ifndef glEndVideoCaptureNV #define glEndVideoCaptureNV SAGE_glEndVideoCaptureNV #endif #ifndef glGetVideoCaptureivNV #define glGetVideoCaptureivNV SAGE_glGetVideoCaptureivNV #endif #ifndef glGetVideoCaptureStreamivNV #define glGetVideoCaptureStreamivNV SAGE_glGetVideoCaptureStreamivNV #endif #ifndef glGetVideoCaptureStreamfvNV #define glGetVideoCaptureStreamfvNV SAGE_glGetVideoCaptureStreamfvNV #endif #ifndef glGetVideoCaptureStreamdvNV #define glGetVideoCaptureStreamdvNV SAGE_glGetVideoCaptureStreamdvNV #endif #ifndef glVideoCaptureNV #define glVideoCaptureNV SAGE_glVideoCaptureNV #endif #ifndef glVideoCaptureStreamParameterivNV #define glVideoCaptureStreamParameterivNV SAGE_glVideoCaptureStreamParameterivNV #endif #ifndef glVideoCaptureStreamParameterfvNV #define glVideoCaptureStreamParameterfvNV SAGE_glVideoCaptureStreamParameterfvNV #endif #ifndef glVideoCaptureStreamParameterdvNV #define glVideoCaptureStreamParameterdvNV SAGE_glVideoCaptureStreamParameterdvNV #endif #endif #ifndef GL_NV_copy_image #define GL_NV_copy_image 1 #ifndef glCopyImageSubDataNV #define glCopyImageSubDataNV SAGE_glCopyImageSubDataNV #endif #endif #ifndef GL_EXT_separate_shader_objects #define GL_EXT_separate_shader_objects 1 #ifndef glUseShaderProgramEXT #define glUseShaderProgramEXT SAGE_glUseShaderProgramEXT #endif #ifndef glActiveProgramEXT #define glActiveProgramEXT SAGE_glActiveProgramEXT #endif #ifndef glCreateShaderProgramEXT #define glCreateShaderProgramEXT SAGE_glCreateShaderProgramEXT #endif #endif #ifndef GL_NV_parameter_buffer_object2 #define GL_NV_parameter_buffer_object2 1 #endif #ifndef GL_NV_shader_buffer_load #define GL_NV_shader_buffer_load 1 #ifndef glMakeBufferResidentNV #define glMakeBufferResidentNV SAGE_glMakeBufferResidentNV #endif #ifndef glMakeBufferNonResidentNV #define glMakeBufferNonResidentNV SAGE_glMakeBufferNonResidentNV #endif #ifndef glIsBufferResidentNV #define glIsBufferResidentNV SAGE_glIsBufferResidentNV #endif #ifndef glNamedMakeBufferResidentNV #define glNamedMakeBufferResidentNV SAGE_glNamedMakeBufferResidentNV #endif #ifndef glNamedMakeBufferNonResidentNV #define glNamedMakeBufferNonResidentNV SAGE_glNamedMakeBufferNonResidentNV #endif #ifndef glIsNamedBufferResidentNV #define glIsNamedBufferResidentNV SAGE_glIsNamedBufferResidentNV #endif #ifndef glGetBufferParameterui64vNV #define glGetBufferParameterui64vNV SAGE_glGetBufferParameterui64vNV #endif #ifndef glGetNamedBufferParameterui64vNV #define glGetNamedBufferParameterui64vNV SAGE_glGetNamedBufferParameterui64vNV #endif #ifndef glGetIntegerui64vNV #define glGetIntegerui64vNV SAGE_glGetIntegerui64vNV #endif #ifndef glUniformui64NV #define glUniformui64NV SAGE_glUniformui64NV #endif #ifndef glUniformui64vNV #define glUniformui64vNV SAGE_glUniformui64vNV #endif #ifndef glGetUniformui64vNV #define glGetUniformui64vNV SAGE_glGetUniformui64vNV #endif #ifndef glProgramUniformui64NV #define glProgramUniformui64NV SAGE_glProgramUniformui64NV #endif #ifndef glProgramUniformui64vNV #define glProgramUniformui64vNV SAGE_glProgramUniformui64vNV #endif #endif #ifndef GL_NV_vertex_buffer_unified_memory #define GL_NV_vertex_buffer_unified_memory 1 #ifndef glBufferAddressRangeNV #define glBufferAddressRangeNV SAGE_glBufferAddressRangeNV #endif #ifndef glVertexFormatNV #define glVertexFormatNV SAGE_glVertexFormatNV #endif #ifndef glNormalFormatNV #define glNormalFormatNV SAGE_glNormalFormatNV #endif #ifndef glColorFormatNV #define glColorFormatNV SAGE_glColorFormatNV #endif #ifndef glIndexFormatNV #define glIndexFormatNV SAGE_glIndexFormatNV #endif #ifndef glTexCoordFormatNV #define glTexCoordFormatNV SAGE_glTexCoordFormatNV #endif #ifndef glEdgeFlagFormatNV #define glEdgeFlagFormatNV SAGE_glEdgeFlagFormatNV #endif #ifndef glSecondaryColorFormatNV #define glSecondaryColorFormatNV SAGE_glSecondaryColorFormatNV #endif #ifndef glFogCoordFormatNV #define glFogCoordFormatNV SAGE_glFogCoordFormatNV #endif #ifndef glVertexAttribFormatNV #define glVertexAttribFormatNV SAGE_glVertexAttribFormatNV #endif #ifndef glVertexAttribIFormatNV #define glVertexAttribIFormatNV SAGE_glVertexAttribIFormatNV #endif #endif #ifndef GL_NV_texture_barrier #define GL_NV_texture_barrier 1 #ifndef glTextureBarrierNV #define glTextureBarrierNV SAGE_glTextureBarrierNV #endif #endif #include <sage/sage_fptr.h> SAGEAPI SAGE_PFNGLBLENDCOLORPROC SAGE_glBlendColor; SAGEAPI SAGE_PFNGLBLENDEQUATIONPROC SAGE_glBlendEquation; SAGEAPI SAGE_PFNGLDRAWRANGEELEMENTSPROC SAGE_glDrawRangeElements; SAGEAPI SAGE_PFNGLTEXIMAGE3DPROC SAGE_glTexImage3D; SAGEAPI SAGE_PFNGLTEXSUBIMAGE3DPROC SAGE_glTexSubImage3D; SAGEAPI SAGE_PFNGLCOPYTEXSUBIMAGE3DPROC SAGE_glCopyTexSubImage3D; SAGEAPI SAGE_PFNGLCOLORTABLEPROC SAGE_glColorTable; SAGEAPI SAGE_PFNGLCOLORTABLEPARAMETERFVPROC SAGE_glColorTableParameterfv; SAGEAPI SAGE_PFNGLCOLORTABLEPARAMETERIVPROC SAGE_glColorTableParameteriv; SAGEAPI SAGE_PFNGLCOPYCOLORTABLEPROC SAGE_glCopyColorTable; SAGEAPI SAGE_PFNGLGETCOLORTABLEPROC SAGE_glGetColorTable; SAGEAPI SAGE_PFNGLGETCOLORTABLEPARAMETERFVPROC SAGE_glGetColorTableParameterfv; SAGEAPI SAGE_PFNGLGETCOLORTABLEPARAMETERIVPROC SAGE_glGetColorTableParameteriv; SAGEAPI SAGE_PFNGLCOLORSUBTABLEPROC SAGE_glColorSubTable; SAGEAPI SAGE_PFNGLCOPYCOLORSUBTABLEPROC SAGE_glCopyColorSubTable; SAGEAPI SAGE_PFNGLCONVOLUTIONFILTER1DPROC SAGE_glConvolutionFilter1D; SAGEAPI SAGE_PFNGLCONVOLUTIONFILTER2DPROC SAGE_glConvolutionFilter2D; SAGEAPI SAGE_PFNGLCONVOLUTIONPARAMETERFPROC SAGE_glConvolutionParameterf; SAGEAPI SAGE_PFNGLCONVOLUTIONPARAMETERFVPROC SAGE_glConvolutionParameterfv; SAGEAPI SAGE_PFNGLCONVOLUTIONPARAMETERIPROC SAGE_glConvolutionParameteri; SAGEAPI SAGE_PFNGLCONVOLUTIONPARAMETERIVPROC SAGE_glConvolutionParameteriv; SAGEAPI SAGE_PFNGLCOPYCONVOLUTIONFILTER1DPROC SAGE_glCopyConvolutionFilter1D; SAGEAPI SAGE_PFNGLCOPYCONVOLUTIONFILTER2DPROC SAGE_glCopyConvolutionFilter2D; SAGEAPI SAGE_PFNGLGETCONVOLUTIONFILTERPROC SAGE_glGetConvolutionFilter; SAGEAPI SAGE_PFNGLGETCONVOLUTIONPARAMETERFVPROC SAGE_glGetConvolutionParameterfv; SAGEAPI SAGE_PFNGLGETCONVOLUTIONPARAMETERIVPROC SAGE_glGetConvolutionParameteriv; SAGEAPI SAGE_PFNGLGETSEPARABLEFILTERPROC SAGE_glGetSeparableFilter; SAGEAPI SAGE_PFNGLSEPARABLEFILTER2DPROC SAGE_glSeparableFilter2D; SAGEAPI SAGE_PFNGLGETHISTOGRAMPROC SAGE_glGetHistogram; SAGEAPI SAGE_PFNGLGETHISTOGRAMPARAMETERFVPROC SAGE_glGetHistogramParameterfv; SAGEAPI SAGE_PFNGLGETHISTOGRAMPARAMETERIVPROC SAGE_glGetHistogramParameteriv; SAGEAPI SAGE_PFNGLGETMINMAXPROC SAGE_glGetMinmax; SAGEAPI SAGE_PFNGLGETMINMAXPARAMETERFVPROC SAGE_glGetMinmaxParameterfv; SAGEAPI SAGE_PFNGLGETMINMAXPARAMETERIVPROC SAGE_glGetMinmaxParameteriv; SAGEAPI SAGE_PFNGLHISTOGRAMPROC SAGE_glHistogram; SAGEAPI SAGE_PFNGLMINMAXPROC SAGE_glMinmax; SAGEAPI SAGE_PFNGLRESETHISTOGRAMPROC SAGE_glResetHistogram; SAGEAPI SAGE_PFNGLRESETMINMAXPROC SAGE_glResetMinmax; SAGEAPI SAGE_PFNGLACTIVETEXTUREPROC SAGE_glActiveTexture; SAGEAPI SAGE_PFNGLSAMPLECOVERAGEPROC SAGE_glSampleCoverage; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXIMAGE3DPROC SAGE_glCompressedTexImage3D; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXIMAGE2DPROC SAGE_glCompressedTexImage2D; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXIMAGE1DPROC SAGE_glCompressedTexImage1D; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC SAGE_glCompressedTexSubImage3D; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC SAGE_glCompressedTexSubImage2D; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC SAGE_glCompressedTexSubImage1D; SAGEAPI SAGE_PFNGLGETCOMPRESSEDTEXIMAGEPROC SAGE_glGetCompressedTexImage; SAGEAPI SAGE_PFNGLCLIENTACTIVETEXTUREPROC SAGE_glClientActiveTexture; SAGEAPI SAGE_PFNGLMULTITEXCOORD1DPROC SAGE_glMultiTexCoord1d; SAGEAPI SAGE_PFNGLMULTITEXCOORD1DVPROC SAGE_glMultiTexCoord1dv; SAGEAPI SAGE_PFNGLMULTITEXCOORD1FPROC SAGE_glMultiTexCoord1f; SAGEAPI SAGE_PFNGLMULTITEXCOORD1FVPROC SAGE_glMultiTexCoord1fv; SAGEAPI SAGE_PFNGLMULTITEXCOORD1IPROC SAGE_glMultiTexCoord1i; SAGEAPI SAGE_PFNGLMULTITEXCOORD1IVPROC SAGE_glMultiTexCoord1iv; SAGEAPI SAGE_PFNGLMULTITEXCOORD1SPROC SAGE_glMultiTexCoord1s; SAGEAPI SAGE_PFNGLMULTITEXCOORD1SVPROC SAGE_glMultiTexCoord1sv; SAGEAPI SAGE_PFNGLMULTITEXCOORD2DPROC SAGE_glMultiTexCoord2d; SAGEAPI SAGE_PFNGLMULTITEXCOORD2DVPROC SAGE_glMultiTexCoord2dv; SAGEAPI SAGE_PFNGLMULTITEXCOORD2FPROC SAGE_glMultiTexCoord2f; SAGEAPI SAGE_PFNGLMULTITEXCOORD2FVPROC SAGE_glMultiTexCoord2fv; SAGEAPI SAGE_PFNGLMULTITEXCOORD2IPROC SAGE_glMultiTexCoord2i; SAGEAPI SAGE_PFNGLMULTITEXCOORD2IVPROC SAGE_glMultiTexCoord2iv; SAGEAPI SAGE_PFNGLMULTITEXCOORD2SPROC SAGE_glMultiTexCoord2s; SAGEAPI SAGE_PFNGLMULTITEXCOORD2SVPROC SAGE_glMultiTexCoord2sv; SAGEAPI SAGE_PFNGLMULTITEXCOORD3DPROC SAGE_glMultiTexCoord3d; SAGEAPI SAGE_PFNGLMULTITEXCOORD3DVPROC SAGE_glMultiTexCoord3dv; SAGEAPI SAGE_PFNGLMULTITEXCOORD3FPROC SAGE_glMultiTexCoord3f; SAGEAPI SAGE_PFNGLMULTITEXCOORD3FVPROC SAGE_glMultiTexCoord3fv; SAGEAPI SAGE_PFNGLMULTITEXCOORD3IPROC SAGE_glMultiTexCoord3i; SAGEAPI SAGE_PFNGLMULTITEXCOORD3IVPROC SAGE_glMultiTexCoord3iv; SAGEAPI SAGE_PFNGLMULTITEXCOORD3SPROC SAGE_glMultiTexCoord3s; SAGEAPI SAGE_PFNGLMULTITEXCOORD3SVPROC SAGE_glMultiTexCoord3sv; SAGEAPI SAGE_PFNGLMULTITEXCOORD4DPROC SAGE_glMultiTexCoord4d; SAGEAPI SAGE_PFNGLMULTITEXCOORD4DVPROC SAGE_glMultiTexCoord4dv; SAGEAPI SAGE_PFNGLMULTITEXCOORD4FPROC SAGE_glMultiTexCoord4f; SAGEAPI SAGE_PFNGLMULTITEXCOORD4FVPROC SAGE_glMultiTexCoord4fv; SAGEAPI SAGE_PFNGLMULTITEXCOORD4IPROC SAGE_glMultiTexCoord4i; SAGEAPI SAGE_PFNGLMULTITEXCOORD4IVPROC SAGE_glMultiTexCoord4iv; SAGEAPI SAGE_PFNGLMULTITEXCOORD4SPROC SAGE_glMultiTexCoord4s; SAGEAPI SAGE_PFNGLMULTITEXCOORD4SVPROC SAGE_glMultiTexCoord4sv; SAGEAPI SAGE_PFNGLLOADTRANSPOSEMATRIXFPROC SAGE_glLoadTransposeMatrixf; SAGEAPI SAGE_PFNGLLOADTRANSPOSEMATRIXDPROC SAGE_glLoadTransposeMatrixd; SAGEAPI SAGE_PFNGLMULTTRANSPOSEMATRIXFPROC SAGE_glMultTransposeMatrixf; SAGEAPI SAGE_PFNGLMULTTRANSPOSEMATRIXDPROC SAGE_glMultTransposeMatrixd; SAGEAPI SAGE_PFNGLBLENDFUNCSEPARATEPROC SAGE_glBlendFuncSeparate; SAGEAPI SAGE_PFNGLMULTIDRAWARRAYSPROC SAGE_glMultiDrawArrays; SAGEAPI SAGE_PFNGLMULTIDRAWELEMENTSPROC SAGE_glMultiDrawElements; SAGEAPI SAGE_PFNGLPOINTPARAMETERFPROC SAGE_glPointParameterf; SAGEAPI SAGE_PFNGLPOINTPARAMETERFVPROC SAGE_glPointParameterfv; SAGEAPI SAGE_PFNGLPOINTPARAMETERIPROC SAGE_glPointParameteri; SAGEAPI SAGE_PFNGLPOINTPARAMETERIVPROC SAGE_glPointParameteriv; SAGEAPI SAGE_PFNGLFOGCOORDFPROC SAGE_glFogCoordf; SAGEAPI SAGE_PFNGLFOGCOORDFVPROC SAGE_glFogCoordfv; SAGEAPI SAGE_PFNGLFOGCOORDDPROC SAGE_glFogCoordd; SAGEAPI SAGE_PFNGLFOGCOORDDVPROC SAGE_glFogCoorddv; SAGEAPI SAGE_PFNGLFOGCOORDPOINTERPROC SAGE_glFogCoordPointer; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3BPROC SAGE_glSecondaryColor3b; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3BVPROC SAGE_glSecondaryColor3bv; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3DPROC SAGE_glSecondaryColor3d; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3DVPROC SAGE_glSecondaryColor3dv; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3FPROC SAGE_glSecondaryColor3f; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3FVPROC SAGE_glSecondaryColor3fv; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3IPROC SAGE_glSecondaryColor3i; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3IVPROC SAGE_glSecondaryColor3iv; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3SPROC SAGE_glSecondaryColor3s; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3SVPROC SAGE_glSecondaryColor3sv; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3UBPROC SAGE_glSecondaryColor3ub; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3UBVPROC SAGE_glSecondaryColor3ubv; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3UIPROC SAGE_glSecondaryColor3ui; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3UIVPROC SAGE_glSecondaryColor3uiv; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3USPROC SAGE_glSecondaryColor3us; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3USVPROC SAGE_glSecondaryColor3usv; SAGEAPI SAGE_PFNGLSECONDARYCOLORPOINTERPROC SAGE_glSecondaryColorPointer; SAGEAPI SAGE_PFNGLWINDOWPOS2DPROC SAGE_glWindowPos2d; SAGEAPI SAGE_PFNGLWINDOWPOS2DVPROC SAGE_glWindowPos2dv; SAGEAPI SAGE_PFNGLWINDOWPOS2FPROC SAGE_glWindowPos2f; SAGEAPI SAGE_PFNGLWINDOWPOS2FVPROC SAGE_glWindowPos2fv; SAGEAPI SAGE_PFNGLWINDOWPOS2IPROC SAGE_glWindowPos2i; SAGEAPI SAGE_PFNGLWINDOWPOS2IVPROC SAGE_glWindowPos2iv; SAGEAPI SAGE_PFNGLWINDOWPOS2SPROC SAGE_glWindowPos2s; SAGEAPI SAGE_PFNGLWINDOWPOS2SVPROC SAGE_glWindowPos2sv; SAGEAPI SAGE_PFNGLWINDOWPOS3DPROC SAGE_glWindowPos3d; SAGEAPI SAGE_PFNGLWINDOWPOS3DVPROC SAGE_glWindowPos3dv; SAGEAPI SAGE_PFNGLWINDOWPOS3FPROC SAGE_glWindowPos3f; SAGEAPI SAGE_PFNGLWINDOWPOS3FVPROC SAGE_glWindowPos3fv; SAGEAPI SAGE_PFNGLWINDOWPOS3IPROC SAGE_glWindowPos3i; SAGEAPI SAGE_PFNGLWINDOWPOS3IVPROC SAGE_glWindowPos3iv; SAGEAPI SAGE_PFNGLWINDOWPOS3SPROC SAGE_glWindowPos3s; SAGEAPI SAGE_PFNGLWINDOWPOS3SVPROC SAGE_glWindowPos3sv; SAGEAPI SAGE_PFNGLGENQUERIESPROC SAGE_glGenQueries; SAGEAPI SAGE_PFNGLDELETEQUERIESPROC SAGE_glDeleteQueries; SAGEAPI SAGE_PFNGLISQUERYPROC SAGE_glIsQuery; SAGEAPI SAGE_PFNGLBEGINQUERYPROC SAGE_glBeginQuery; SAGEAPI SAGE_PFNGLENDQUERYPROC SAGE_glEndQuery; SAGEAPI SAGE_PFNGLGETQUERYIVPROC SAGE_glGetQueryiv; SAGEAPI SAGE_PFNGLGETQUERYOBJECTIVPROC SAGE_glGetQueryObjectiv; SAGEAPI SAGE_PFNGLGETQUERYOBJECTUIVPROC SAGE_glGetQueryObjectuiv; SAGEAPI SAGE_PFNGLBINDBUFFERPROC SAGE_glBindBuffer; SAGEAPI SAGE_PFNGLDELETEBUFFERSPROC SAGE_glDeleteBuffers; SAGEAPI SAGE_PFNGLGENBUFFERSPROC SAGE_glGenBuffers; SAGEAPI SAGE_PFNGLISBUFFERPROC SAGE_glIsBuffer; SAGEAPI SAGE_PFNGLBUFFERDATAPROC SAGE_glBufferData; SAGEAPI SAGE_PFNGLBUFFERSUBDATAPROC SAGE_glBufferSubData; SAGEAPI SAGE_PFNGLGETBUFFERSUBDATAPROC SAGE_glGetBufferSubData; SAGEAPI SAGE_PFNGLMAPBUFFERPROC SAGE_glMapBuffer; SAGEAPI SAGE_PFNGLUNMAPBUFFERPROC SAGE_glUnmapBuffer; SAGEAPI SAGE_PFNGLGETBUFFERPARAMETERIVPROC SAGE_glGetBufferParameteriv; SAGEAPI SAGE_PFNGLGETBUFFERPOINTERVPROC SAGE_glGetBufferPointerv; SAGEAPI SAGE_PFNGLBLENDEQUATIONSEPARATEPROC SAGE_glBlendEquationSeparate; SAGEAPI SAGE_PFNGLDRAWBUFFERSPROC SAGE_glDrawBuffers; SAGEAPI SAGE_PFNGLSTENCILOPSEPARATEPROC SAGE_glStencilOpSeparate; SAGEAPI SAGE_PFNGLSTENCILFUNCSEPARATEPROC SAGE_glStencilFuncSeparate; SAGEAPI SAGE_PFNGLSTENCILMASKSEPARATEPROC SAGE_glStencilMaskSeparate; SAGEAPI SAGE_PFNGLATTACHSHADERPROC SAGE_glAttachShader; SAGEAPI SAGE_PFNGLBINDATTRIBLOCATIONPROC SAGE_glBindAttribLocation; SAGEAPI SAGE_PFNGLCOMPILESHADERPROC SAGE_glCompileShader; SAGEAPI SAGE_PFNGLCREATEPROGRAMPROC SAGE_glCreateProgram; SAGEAPI SAGE_PFNGLCREATESHADERPROC SAGE_glCreateShader; SAGEAPI SAGE_PFNGLDELETEPROGRAMPROC SAGE_glDeleteProgram; SAGEAPI SAGE_PFNGLDELETESHADERPROC SAGE_glDeleteShader; SAGEAPI SAGE_PFNGLDETACHSHADERPROC SAGE_glDetachShader; SAGEAPI SAGE_PFNGLDISABLEVERTEXATTRIBARRAYPROC SAGE_glDisableVertexAttribArray; SAGEAPI SAGE_PFNGLENABLEVERTEXATTRIBARRAYPROC SAGE_glEnableVertexAttribArray; SAGEAPI SAGE_PFNGLGETACTIVEATTRIBPROC SAGE_glGetActiveAttrib; SAGEAPI SAGE_PFNGLGETACTIVEUNIFORMPROC SAGE_glGetActiveUniform; SAGEAPI SAGE_PFNGLGETATTACHEDSHADERSPROC SAGE_glGetAttachedShaders; SAGEAPI SAGE_PFNGLGETATTRIBLOCATIONPROC SAGE_glGetAttribLocation; SAGEAPI SAGE_PFNGLGETPROGRAMIVPROC SAGE_glGetProgramiv; SAGEAPI SAGE_PFNGLGETPROGRAMINFOLOGPROC SAGE_glGetProgramInfoLog; SAGEAPI SAGE_PFNGLGETSHADERIVPROC SAGE_glGetShaderiv; SAGEAPI SAGE_PFNGLGETSHADERINFOLOGPROC SAGE_glGetShaderInfoLog; SAGEAPI SAGE_PFNGLGETSHADERSOURCEPROC SAGE_glGetShaderSource; SAGEAPI SAGE_PFNGLGETUNIFORMLOCATIONPROC SAGE_glGetUniformLocation; SAGEAPI SAGE_PFNGLGETUNIFORMFVPROC SAGE_glGetUniformfv; SAGEAPI SAGE_PFNGLGETUNIFORMIVPROC SAGE_glGetUniformiv; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBDVPROC SAGE_glGetVertexAttribdv; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBFVPROC SAGE_glGetVertexAttribfv; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBIVPROC SAGE_glGetVertexAttribiv; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBPOINTERVPROC SAGE_glGetVertexAttribPointerv; SAGEAPI SAGE_PFNGLISPROGRAMPROC SAGE_glIsProgram; SAGEAPI SAGE_PFNGLISSHADERPROC SAGE_glIsShader; SAGEAPI SAGE_PFNGLLINKPROGRAMPROC SAGE_glLinkProgram; SAGEAPI SAGE_PFNGLSHADERSOURCEPROC SAGE_glShaderSource; SAGEAPI SAGE_PFNGLUSEPROGRAMPROC SAGE_glUseProgram; SAGEAPI SAGE_PFNGLUNIFORM1FPROC SAGE_glUniform1f; SAGEAPI SAGE_PFNGLUNIFORM2FPROC SAGE_glUniform2f; SAGEAPI SAGE_PFNGLUNIFORM3FPROC SAGE_glUniform3f; SAGEAPI SAGE_PFNGLUNIFORM4FPROC SAGE_glUniform4f; SAGEAPI SAGE_PFNGLUNIFORM1IPROC SAGE_glUniform1i; SAGEAPI SAGE_PFNGLUNIFORM2IPROC SAGE_glUniform2i; SAGEAPI SAGE_PFNGLUNIFORM3IPROC SAGE_glUniform3i; SAGEAPI SAGE_PFNGLUNIFORM4IPROC SAGE_glUniform4i; SAGEAPI SAGE_PFNGLUNIFORM1FVPROC SAGE_glUniform1fv; SAGEAPI SAGE_PFNGLUNIFORM2FVPROC SAGE_glUniform2fv; SAGEAPI SAGE_PFNGLUNIFORM3FVPROC SAGE_glUniform3fv; SAGEAPI SAGE_PFNGLUNIFORM4FVPROC SAGE_glUniform4fv; SAGEAPI SAGE_PFNGLUNIFORM1IVPROC SAGE_glUniform1iv; SAGEAPI SAGE_PFNGLUNIFORM2IVPROC SAGE_glUniform2iv; SAGEAPI SAGE_PFNGLUNIFORM3IVPROC SAGE_glUniform3iv; SAGEAPI SAGE_PFNGLUNIFORM4IVPROC SAGE_glUniform4iv; SAGEAPI SAGE_PFNGLUNIFORMMATRIX2FVPROC SAGE_glUniformMatrix2fv; SAGEAPI SAGE_PFNGLUNIFORMMATRIX3FVPROC SAGE_glUniformMatrix3fv; SAGEAPI SAGE_PFNGLUNIFORMMATRIX4FVPROC SAGE_glUniformMatrix4fv; SAGEAPI SAGE_PFNGLVALIDATEPROGRAMPROC SAGE_glValidateProgram; SAGEAPI SAGE_PFNGLVERTEXATTRIB1DPROC SAGE_glVertexAttrib1d; SAGEAPI SAGE_PFNGLVERTEXATTRIB1DVPROC SAGE_glVertexAttrib1dv; SAGEAPI SAGE_PFNGLVERTEXATTRIB1FPROC SAGE_glVertexAttrib1f; SAGEAPI SAGE_PFNGLVERTEXATTRIB1FVPROC SAGE_glVertexAttrib1fv; SAGEAPI SAGE_PFNGLVERTEXATTRIB1SPROC SAGE_glVertexAttrib1s; SAGEAPI SAGE_PFNGLVERTEXATTRIB1SVPROC SAGE_glVertexAttrib1sv; SAGEAPI SAGE_PFNGLVERTEXATTRIB2DPROC SAGE_glVertexAttrib2d; SAGEAPI SAGE_PFNGLVERTEXATTRIB2DVPROC SAGE_glVertexAttrib2dv; SAGEAPI SAGE_PFNGLVERTEXATTRIB2FPROC SAGE_glVertexAttrib2f; SAGEAPI SAGE_PFNGLVERTEXATTRIB2FVPROC SAGE_glVertexAttrib2fv; SAGEAPI SAGE_PFNGLVERTEXATTRIB2SPROC SAGE_glVertexAttrib2s; SAGEAPI SAGE_PFNGLVERTEXATTRIB2SVPROC SAGE_glVertexAttrib2sv; SAGEAPI SAGE_PFNGLVERTEXATTRIB3DPROC SAGE_glVertexAttrib3d; SAGEAPI SAGE_PFNGLVERTEXATTRIB3DVPROC SAGE_glVertexAttrib3dv; SAGEAPI SAGE_PFNGLVERTEXATTRIB3FPROC SAGE_glVertexAttrib3f; SAGEAPI SAGE_PFNGLVERTEXATTRIB3FVPROC SAGE_glVertexAttrib3fv; SAGEAPI SAGE_PFNGLVERTEXATTRIB3SPROC SAGE_glVertexAttrib3s; SAGEAPI SAGE_PFNGLVERTEXATTRIB3SVPROC SAGE_glVertexAttrib3sv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NBVPROC SAGE_glVertexAttrib4Nbv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NIVPROC SAGE_glVertexAttrib4Niv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NSVPROC SAGE_glVertexAttrib4Nsv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NUBPROC SAGE_glVertexAttrib4Nub; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NUBVPROC SAGE_glVertexAttrib4Nubv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NUIVPROC SAGE_glVertexAttrib4Nuiv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NUSVPROC SAGE_glVertexAttrib4Nusv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4BVPROC SAGE_glVertexAttrib4bv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4DPROC SAGE_glVertexAttrib4d; SAGEAPI SAGE_PFNGLVERTEXATTRIB4DVPROC SAGE_glVertexAttrib4dv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4FPROC SAGE_glVertexAttrib4f; SAGEAPI SAGE_PFNGLVERTEXATTRIB4FVPROC SAGE_glVertexAttrib4fv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4IVPROC SAGE_glVertexAttrib4iv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4SPROC SAGE_glVertexAttrib4s; SAGEAPI SAGE_PFNGLVERTEXATTRIB4SVPROC SAGE_glVertexAttrib4sv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4UBVPROC SAGE_glVertexAttrib4ubv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4UIVPROC SAGE_glVertexAttrib4uiv; SAGEAPI SAGE_PFNGLVERTEXATTRIB4USVPROC SAGE_glVertexAttrib4usv; SAGEAPI SAGE_PFNGLVERTEXATTRIBPOINTERPROC SAGE_glVertexAttribPointer; SAGEAPI SAGE_PFNGLUNIFORMMATRIX2X3FVPROC SAGE_glUniformMatrix2x3fv; SAGEAPI SAGE_PFNGLUNIFORMMATRIX3X2FVPROC SAGE_glUniformMatrix3x2fv; SAGEAPI SAGE_PFNGLUNIFORMMATRIX2X4FVPROC SAGE_glUniformMatrix2x4fv; SAGEAPI SAGE_PFNGLUNIFORMMATRIX4X2FVPROC SAGE_glUniformMatrix4x2fv; SAGEAPI SAGE_PFNGLUNIFORMMATRIX3X4FVPROC SAGE_glUniformMatrix3x4fv; SAGEAPI SAGE_PFNGLUNIFORMMATRIX4X3FVPROC SAGE_glUniformMatrix4x3fv; SAGEAPI SAGE_PFNGLCOLORMASKIPROC SAGE_glColorMaski; SAGEAPI SAGE_PFNGLENABLEIPROC SAGE_glEnablei; SAGEAPI SAGE_PFNGLDISABLEIPROC SAGE_glDisablei; SAGEAPI SAGE_PFNGLISENABLEDIPROC SAGE_glIsEnabledi; SAGEAPI SAGE_PFNGLBEGINTRANSFORMFEEDBACKPROC SAGE_glBeginTransformFeedback; SAGEAPI SAGE_PFNGLENDTRANSFORMFEEDBACKPROC SAGE_glEndTransformFeedback; SAGEAPI SAGE_PFNGLBINDBUFFERRANGEPROC SAGE_glBindBufferRange; SAGEAPI SAGE_PFNGLBINDBUFFERBASEPROC SAGE_glBindBufferBase; SAGEAPI SAGE_PFNGLTRANSFORMFEEDBACKVARYINGSPROC SAGE_glTransformFeedbackVaryings; SAGEAPI SAGE_PFNGLGETTRANSFORMFEEDBACKVARYINGPROC SAGE_glGetTransformFeedbackVarying; SAGEAPI SAGE_PFNGLCLAMPCOLORPROC SAGE_glClampColor; SAGEAPI SAGE_PFNGLBEGINCONDITIONALRENDERPROC SAGE_glBeginConditionalRender; SAGEAPI SAGE_PFNGLENDCONDITIONALRENDERPROC SAGE_glEndConditionalRender; SAGEAPI SAGE_PFNGLVERTEXATTRIBIPOINTERPROC SAGE_glVertexAttribIPointer; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBIIVPROC SAGE_glGetVertexAttribIiv; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBIUIVPROC SAGE_glGetVertexAttribIuiv; SAGEAPI SAGE_PFNGLVERTEXATTRIBI1IPROC SAGE_glVertexAttribI1i; SAGEAPI SAGE_PFNGLVERTEXATTRIBI2IPROC SAGE_glVertexAttribI2i; SAGEAPI SAGE_PFNGLVERTEXATTRIBI3IPROC SAGE_glVertexAttribI3i; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4IPROC SAGE_glVertexAttribI4i; SAGEAPI SAGE_PFNGLVERTEXATTRIBI1UIPROC SAGE_glVertexAttribI1ui; SAGEAPI SAGE_PFNGLVERTEXATTRIBI2UIPROC SAGE_glVertexAttribI2ui; SAGEAPI SAGE_PFNGLVERTEXATTRIBI3UIPROC SAGE_glVertexAttribI3ui; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4UIPROC SAGE_glVertexAttribI4ui; SAGEAPI SAGE_PFNGLVERTEXATTRIBI1IVPROC SAGE_glVertexAttribI1iv; SAGEAPI SAGE_PFNGLVERTEXATTRIBI2IVPROC SAGE_glVertexAttribI2iv; SAGEAPI SAGE_PFNGLVERTEXATTRIBI3IVPROC SAGE_glVertexAttribI3iv; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4IVPROC SAGE_glVertexAttribI4iv; SAGEAPI SAGE_PFNGLVERTEXATTRIBI1UIVPROC SAGE_glVertexAttribI1uiv; SAGEAPI SAGE_PFNGLVERTEXATTRIBI2UIVPROC SAGE_glVertexAttribI2uiv; SAGEAPI SAGE_PFNGLVERTEXATTRIBI3UIVPROC SAGE_glVertexAttribI3uiv; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4UIVPROC SAGE_glVertexAttribI4uiv; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4BVPROC SAGE_glVertexAttribI4bv; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4SVPROC SAGE_glVertexAttribI4sv; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4UBVPROC SAGE_glVertexAttribI4ubv; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4USVPROC SAGE_glVertexAttribI4usv; SAGEAPI SAGE_PFNGLGETUNIFORMUIVPROC SAGE_glGetUniformuiv; SAGEAPI SAGE_PFNGLBINDFRAGDATALOCATIONPROC SAGE_glBindFragDataLocation; SAGEAPI SAGE_PFNGLGETFRAGDATALOCATIONPROC SAGE_glGetFragDataLocation; SAGEAPI SAGE_PFNGLUNIFORM1UIPROC SAGE_glUniform1ui; SAGEAPI SAGE_PFNGLUNIFORM2UIPROC SAGE_glUniform2ui; SAGEAPI SAGE_PFNGLUNIFORM3UIPROC SAGE_glUniform3ui; SAGEAPI SAGE_PFNGLUNIFORM4UIPROC SAGE_glUniform4ui; SAGEAPI SAGE_PFNGLUNIFORM1UIVPROC SAGE_glUniform1uiv; SAGEAPI SAGE_PFNGLUNIFORM2UIVPROC SAGE_glUniform2uiv; SAGEAPI SAGE_PFNGLUNIFORM3UIVPROC SAGE_glUniform3uiv; SAGEAPI SAGE_PFNGLUNIFORM4UIVPROC SAGE_glUniform4uiv; SAGEAPI SAGE_PFNGLTEXPARAMETERIIVPROC SAGE_glTexParameterIiv; SAGEAPI SAGE_PFNGLTEXPARAMETERIUIVPROC SAGE_glTexParameterIuiv; SAGEAPI SAGE_PFNGLGETTEXPARAMETERIIVPROC SAGE_glGetTexParameterIiv; SAGEAPI SAGE_PFNGLGETTEXPARAMETERIUIVPROC SAGE_glGetTexParameterIuiv; SAGEAPI SAGE_PFNGLCLEARBUFFERIVPROC SAGE_glClearBufferiv; SAGEAPI SAGE_PFNGLCLEARBUFFERUIVPROC SAGE_glClearBufferuiv; SAGEAPI SAGE_PFNGLCLEARBUFFERFVPROC SAGE_glClearBufferfv; SAGEAPI SAGE_PFNGLCLEARBUFFERFIPROC SAGE_glClearBufferfi; SAGEAPI SAGE_PFNGLGETSTRINGIPROC SAGE_glGetStringi; SAGEAPI SAGE_PFNGLDRAWARRAYSINSTANCEDPROC SAGE_glDrawArraysInstanced; SAGEAPI SAGE_PFNGLDRAWELEMENTSINSTANCEDPROC SAGE_glDrawElementsInstanced; SAGEAPI SAGE_PFNGLTEXBUFFERPROC SAGE_glTexBuffer; SAGEAPI SAGE_PFNGLPRIMITIVERESTARTINDEXPROC SAGE_glPrimitiveRestartIndex; SAGEAPI SAGE_PFNGLGETBUFFERPARAMETERI64VPROC SAGE_glGetBufferParameteri64v; SAGEAPI SAGE_PFNGLPROGRAMPARAMETERIPROC SAGE_glProgramParameteri; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTUREPROC SAGE_glFramebufferTexture; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTUREFACEPROC SAGE_glFramebufferTextureFace; SAGEAPI SAGE_PFNGLACTIVETEXTUREARBPROC SAGE_glActiveTextureARB; SAGEAPI SAGE_PFNGLCLIENTACTIVETEXTUREARBPROC SAGE_glClientActiveTextureARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD1DARBPROC SAGE_glMultiTexCoord1dARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD1DVARBPROC SAGE_glMultiTexCoord1dvARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD1FARBPROC SAGE_glMultiTexCoord1fARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD1FVARBPROC SAGE_glMultiTexCoord1fvARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD1IARBPROC SAGE_glMultiTexCoord1iARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD1IVARBPROC SAGE_glMultiTexCoord1ivARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD1SARBPROC SAGE_glMultiTexCoord1sARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD1SVARBPROC SAGE_glMultiTexCoord1svARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD2DARBPROC SAGE_glMultiTexCoord2dARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD2DVARBPROC SAGE_glMultiTexCoord2dvARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD2FARBPROC SAGE_glMultiTexCoord2fARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD2FVARBPROC SAGE_glMultiTexCoord2fvARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD2IARBPROC SAGE_glMultiTexCoord2iARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD2IVARBPROC SAGE_glMultiTexCoord2ivARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD2SARBPROC SAGE_glMultiTexCoord2sARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD2SVARBPROC SAGE_glMultiTexCoord2svARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD3DARBPROC SAGE_glMultiTexCoord3dARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD3DVARBPROC SAGE_glMultiTexCoord3dvARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD3FARBPROC SAGE_glMultiTexCoord3fARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD3FVARBPROC SAGE_glMultiTexCoord3fvARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD3IARBPROC SAGE_glMultiTexCoord3iARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD3IVARBPROC SAGE_glMultiTexCoord3ivARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD3SARBPROC SAGE_glMultiTexCoord3sARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD3SVARBPROC SAGE_glMultiTexCoord3svARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD4DARBPROC SAGE_glMultiTexCoord4dARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD4DVARBPROC SAGE_glMultiTexCoord4dvARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD4FARBPROC SAGE_glMultiTexCoord4fARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD4FVARBPROC SAGE_glMultiTexCoord4fvARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD4IARBPROC SAGE_glMultiTexCoord4iARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD4IVARBPROC SAGE_glMultiTexCoord4ivARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD4SARBPROC SAGE_glMultiTexCoord4sARB; SAGEAPI SAGE_PFNGLMULTITEXCOORD4SVARBPROC SAGE_glMultiTexCoord4svARB; SAGEAPI SAGE_PFNGLLOADTRANSPOSEMATRIXFARBPROC SAGE_glLoadTransposeMatrixfARB; SAGEAPI SAGE_PFNGLLOADTRANSPOSEMATRIXDARBPROC SAGE_glLoadTransposeMatrixdARB; SAGEAPI SAGE_PFNGLMULTTRANSPOSEMATRIXFARBPROC SAGE_glMultTransposeMatrixfARB; SAGEAPI SAGE_PFNGLMULTTRANSPOSEMATRIXDARBPROC SAGE_glMultTransposeMatrixdARB; SAGEAPI SAGE_PFNGLSAMPLECOVERAGEARBPROC SAGE_glSampleCoverageARB; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXIMAGE3DARBPROC SAGE_glCompressedTexImage3DARB; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXIMAGE2DARBPROC SAGE_glCompressedTexImage2DARB; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXIMAGE1DARBPROC SAGE_glCompressedTexImage1DARB; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC SAGE_glCompressedTexSubImage3DARB; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC SAGE_glCompressedTexSubImage2DARB; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC SAGE_glCompressedTexSubImage1DARB; SAGEAPI SAGE_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC SAGE_glGetCompressedTexImageARB; SAGEAPI SAGE_PFNGLPOINTPARAMETERFARBPROC SAGE_glPointParameterfARB; SAGEAPI SAGE_PFNGLPOINTPARAMETERFVARBPROC SAGE_glPointParameterfvARB; SAGEAPI SAGE_PFNGLWEIGHTBVARBPROC SAGE_glWeightbvARB; SAGEAPI SAGE_PFNGLWEIGHTSVARBPROC SAGE_glWeightsvARB; SAGEAPI SAGE_PFNGLWEIGHTIVARBPROC SAGE_glWeightivARB; SAGEAPI SAGE_PFNGLWEIGHTFVARBPROC SAGE_glWeightfvARB; SAGEAPI SAGE_PFNGLWEIGHTDVARBPROC SAGE_glWeightdvARB; SAGEAPI SAGE_PFNGLWEIGHTUBVARBPROC SAGE_glWeightubvARB; SAGEAPI SAGE_PFNGLWEIGHTUSVARBPROC SAGE_glWeightusvARB; SAGEAPI SAGE_PFNGLWEIGHTUIVARBPROC SAGE_glWeightuivARB; SAGEAPI SAGE_PFNGLWEIGHTPOINTERARBPROC SAGE_glWeightPointerARB; SAGEAPI SAGE_PFNGLVERTEXBLENDARBPROC SAGE_glVertexBlendARB; SAGEAPI SAGE_PFNGLCURRENTPALETTEMATRIXARBPROC SAGE_glCurrentPaletteMatrixARB; SAGEAPI SAGE_PFNGLMATRIXINDEXUBVARBPROC SAGE_glMatrixIndexubvARB; SAGEAPI SAGE_PFNGLMATRIXINDEXUSVARBPROC SAGE_glMatrixIndexusvARB; SAGEAPI SAGE_PFNGLMATRIXINDEXUIVARBPROC SAGE_glMatrixIndexuivARB; SAGEAPI SAGE_PFNGLMATRIXINDEXPOINTERARBPROC SAGE_glMatrixIndexPointerARB; SAGEAPI SAGE_PFNGLWINDOWPOS2DARBPROC SAGE_glWindowPos2dARB; SAGEAPI SAGE_PFNGLWINDOWPOS2DVARBPROC SAGE_glWindowPos2dvARB; SAGEAPI SAGE_PFNGLWINDOWPOS2FARBPROC SAGE_glWindowPos2fARB; SAGEAPI SAGE_PFNGLWINDOWPOS2FVARBPROC SAGE_glWindowPos2fvARB; SAGEAPI SAGE_PFNGLWINDOWPOS2IARBPROC SAGE_glWindowPos2iARB; SAGEAPI SAGE_PFNGLWINDOWPOS2IVARBPROC SAGE_glWindowPos2ivARB; SAGEAPI SAGE_PFNGLWINDOWPOS2SARBPROC SAGE_glWindowPos2sARB; SAGEAPI SAGE_PFNGLWINDOWPOS2SVARBPROC SAGE_glWindowPos2svARB; SAGEAPI SAGE_PFNGLWINDOWPOS3DARBPROC SAGE_glWindowPos3dARB; SAGEAPI SAGE_PFNGLWINDOWPOS3DVARBPROC SAGE_glWindowPos3dvARB; SAGEAPI SAGE_PFNGLWINDOWPOS3FARBPROC SAGE_glWindowPos3fARB; SAGEAPI SAGE_PFNGLWINDOWPOS3FVARBPROC SAGE_glWindowPos3fvARB; SAGEAPI SAGE_PFNGLWINDOWPOS3IARBPROC SAGE_glWindowPos3iARB; SAGEAPI SAGE_PFNGLWINDOWPOS3IVARBPROC SAGE_glWindowPos3ivARB; SAGEAPI SAGE_PFNGLWINDOWPOS3SARBPROC SAGE_glWindowPos3sARB; SAGEAPI SAGE_PFNGLWINDOWPOS3SVARBPROC SAGE_glWindowPos3svARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB1DARBPROC SAGE_glVertexAttrib1dARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB1DVARBPROC SAGE_glVertexAttrib1dvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB1FARBPROC SAGE_glVertexAttrib1fARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB1FVARBPROC SAGE_glVertexAttrib1fvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB1SARBPROC SAGE_glVertexAttrib1sARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB1SVARBPROC SAGE_glVertexAttrib1svARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB2DARBPROC SAGE_glVertexAttrib2dARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB2DVARBPROC SAGE_glVertexAttrib2dvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB2FARBPROC SAGE_glVertexAttrib2fARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB2FVARBPROC SAGE_glVertexAttrib2fvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB2SARBPROC SAGE_glVertexAttrib2sARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB2SVARBPROC SAGE_glVertexAttrib2svARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB3DARBPROC SAGE_glVertexAttrib3dARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB3DVARBPROC SAGE_glVertexAttrib3dvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB3FARBPROC SAGE_glVertexAttrib3fARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB3FVARBPROC SAGE_glVertexAttrib3fvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB3SARBPROC SAGE_glVertexAttrib3sARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB3SVARBPROC SAGE_glVertexAttrib3svARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NBVARBPROC SAGE_glVertexAttrib4NbvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NIVARBPROC SAGE_glVertexAttrib4NivARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NSVARBPROC SAGE_glVertexAttrib4NsvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NUBARBPROC SAGE_glVertexAttrib4NubARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NUBVARBPROC SAGE_glVertexAttrib4NubvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NUIVARBPROC SAGE_glVertexAttrib4NuivARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4NUSVARBPROC SAGE_glVertexAttrib4NusvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4BVARBPROC SAGE_glVertexAttrib4bvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4DARBPROC SAGE_glVertexAttrib4dARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4DVARBPROC SAGE_glVertexAttrib4dvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4FARBPROC SAGE_glVertexAttrib4fARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4FVARBPROC SAGE_glVertexAttrib4fvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4IVARBPROC SAGE_glVertexAttrib4ivARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4SARBPROC SAGE_glVertexAttrib4sARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4SVARBPROC SAGE_glVertexAttrib4svARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4UBVARBPROC SAGE_glVertexAttrib4ubvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4UIVARBPROC SAGE_glVertexAttrib4uivARB; SAGEAPI SAGE_PFNGLVERTEXATTRIB4USVARBPROC SAGE_glVertexAttrib4usvARB; SAGEAPI SAGE_PFNGLVERTEXATTRIBPOINTERARBPROC SAGE_glVertexAttribPointerARB; SAGEAPI SAGE_PFNGLENABLEVERTEXATTRIBARRAYARBPROC SAGE_glEnableVertexAttribArrayARB; SAGEAPI SAGE_PFNGLDISABLEVERTEXATTRIBARRAYARBPROC SAGE_glDisableVertexAttribArrayARB; SAGEAPI SAGE_PFNGLPROGRAMSTRINGARBPROC SAGE_glProgramStringARB; SAGEAPI SAGE_PFNGLBINDPROGRAMARBPROC SAGE_glBindProgramARB; SAGEAPI SAGE_PFNGLDELETEPROGRAMSARBPROC SAGE_glDeleteProgramsARB; SAGEAPI SAGE_PFNGLGENPROGRAMSARBPROC SAGE_glGenProgramsARB; SAGEAPI SAGE_PFNGLPROGRAMENVPARAMETER4DARBPROC SAGE_glProgramEnvParameter4dARB; SAGEAPI SAGE_PFNGLPROGRAMENVPARAMETER4DVARBPROC SAGE_glProgramEnvParameter4dvARB; SAGEAPI SAGE_PFNGLPROGRAMENVPARAMETER4FARBPROC SAGE_glProgramEnvParameter4fARB; SAGEAPI SAGE_PFNGLPROGRAMENVPARAMETER4FVARBPROC SAGE_glProgramEnvParameter4fvARB; SAGEAPI SAGE_PFNGLPROGRAMLOCALPARAMETER4DARBPROC SAGE_glProgramLocalParameter4dARB; SAGEAPI SAGE_PFNGLPROGRAMLOCALPARAMETER4DVARBPROC SAGE_glProgramLocalParameter4dvARB; SAGEAPI SAGE_PFNGLPROGRAMLOCALPARAMETER4FARBPROC SAGE_glProgramLocalParameter4fARB; SAGEAPI SAGE_PFNGLPROGRAMLOCALPARAMETER4FVARBPROC SAGE_glProgramLocalParameter4fvARB; SAGEAPI SAGE_PFNGLGETPROGRAMENVPARAMETERDVARBPROC SAGE_glGetProgramEnvParameterdvARB; SAGEAPI SAGE_PFNGLGETPROGRAMENVPARAMETERFVARBPROC SAGE_glGetProgramEnvParameterfvARB; SAGEAPI SAGE_PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC SAGE_glGetProgramLocalParameterdvARB; SAGEAPI SAGE_PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC SAGE_glGetProgramLocalParameterfvARB; SAGEAPI SAGE_PFNGLGETPROGRAMIVARBPROC SAGE_glGetProgramivARB; SAGEAPI SAGE_PFNGLGETPROGRAMSTRINGARBPROC SAGE_glGetProgramStringARB; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBDVARBPROC SAGE_glGetVertexAttribdvARB; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBFVARBPROC SAGE_glGetVertexAttribfvARB; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBIVARBPROC SAGE_glGetVertexAttribivARB; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBPOINTERVARBPROC SAGE_glGetVertexAttribPointervARB; SAGEAPI SAGE_PFNGLISPROGRAMARBPROC SAGE_glIsProgramARB; SAGEAPI SAGE_PFNGLBINDBUFFERARBPROC SAGE_glBindBufferARB; SAGEAPI SAGE_PFNGLDELETEBUFFERSARBPROC SAGE_glDeleteBuffersARB; SAGEAPI SAGE_PFNGLGENBUFFERSARBPROC SAGE_glGenBuffersARB; SAGEAPI SAGE_PFNGLISBUFFERARBPROC SAGE_glIsBufferARB; SAGEAPI SAGE_PFNGLBUFFERDATAARBPROC SAGE_glBufferDataARB; SAGEAPI SAGE_PFNGLBUFFERSUBDATAARBPROC SAGE_glBufferSubDataARB; SAGEAPI SAGE_PFNGLGETBUFFERSUBDATAARBPROC SAGE_glGetBufferSubDataARB; SAGEAPI SAGE_PFNGLMAPBUFFERARBPROC SAGE_glMapBufferARB; SAGEAPI SAGE_PFNGLUNMAPBUFFERARBPROC SAGE_glUnmapBufferARB; SAGEAPI SAGE_PFNGLGETBUFFERPARAMETERIVARBPROC SAGE_glGetBufferParameterivARB; SAGEAPI SAGE_PFNGLGETBUFFERPOINTERVARBPROC SAGE_glGetBufferPointervARB; SAGEAPI SAGE_PFNGLGENQUERIESARBPROC SAGE_glGenQueriesARB; SAGEAPI SAGE_PFNGLDELETEQUERIESARBPROC SAGE_glDeleteQueriesARB; SAGEAPI SAGE_PFNGLISQUERYARBPROC SAGE_glIsQueryARB; SAGEAPI SAGE_PFNGLBEGINQUERYARBPROC SAGE_glBeginQueryARB; SAGEAPI SAGE_PFNGLENDQUERYARBPROC SAGE_glEndQueryARB; SAGEAPI SAGE_PFNGLGETQUERYIVARBPROC SAGE_glGetQueryivARB; SAGEAPI SAGE_PFNGLGETQUERYOBJECTIVARBPROC SAGE_glGetQueryObjectivARB; SAGEAPI SAGE_PFNGLGETQUERYOBJECTUIVARBPROC SAGE_glGetQueryObjectuivARB; SAGEAPI SAGE_PFNGLDELETEOBJECTARBPROC SAGE_glDeleteObjectARB; SAGEAPI SAGE_PFNGLGETHANDLEARBPROC SAGE_glGetHandleARB; SAGEAPI SAGE_PFNGLDETACHOBJECTARBPROC SAGE_glDetachObjectARB; SAGEAPI SAGE_PFNGLCREATESHADEROBJECTARBPROC SAGE_glCreateShaderObjectARB; SAGEAPI SAGE_PFNGLSHADERSOURCEARBPROC SAGE_glShaderSourceARB; SAGEAPI SAGE_PFNGLCOMPILESHADERARBPROC SAGE_glCompileShaderARB; SAGEAPI SAGE_PFNGLCREATEPROGRAMOBJECTARBPROC SAGE_glCreateProgramObjectARB; SAGEAPI SAGE_PFNGLATTACHOBJECTARBPROC SAGE_glAttachObjectARB; SAGEAPI SAGE_PFNGLLINKPROGRAMARBPROC SAGE_glLinkProgramARB; SAGEAPI SAGE_PFNGLUSEPROGRAMOBJECTARBPROC SAGE_glUseProgramObjectARB; SAGEAPI SAGE_PFNGLVALIDATEPROGRAMARBPROC SAGE_glValidateProgramARB; SAGEAPI SAGE_PFNGLUNIFORM1FARBPROC SAGE_glUniform1fARB; SAGEAPI SAGE_PFNGLUNIFORM2FARBPROC SAGE_glUniform2fARB; SAGEAPI SAGE_PFNGLUNIFORM3FARBPROC SAGE_glUniform3fARB; SAGEAPI SAGE_PFNGLUNIFORM4FARBPROC SAGE_glUniform4fARB; SAGEAPI SAGE_PFNGLUNIFORM1IARBPROC SAGE_glUniform1iARB; SAGEAPI SAGE_PFNGLUNIFORM2IARBPROC SAGE_glUniform2iARB; SAGEAPI SAGE_PFNGLUNIFORM3IARBPROC SAGE_glUniform3iARB; SAGEAPI SAGE_PFNGLUNIFORM4IARBPROC SAGE_glUniform4iARB; SAGEAPI SAGE_PFNGLUNIFORM1FVARBPROC SAGE_glUniform1fvARB; SAGEAPI SAGE_PFNGLUNIFORM2FVARBPROC SAGE_glUniform2fvARB; SAGEAPI SAGE_PFNGLUNIFORM3FVARBPROC SAGE_glUniform3fvARB; SAGEAPI SAGE_PFNGLUNIFORM4FVARBPROC SAGE_glUniform4fvARB; SAGEAPI SAGE_PFNGLUNIFORM1IVARBPROC SAGE_glUniform1ivARB; SAGEAPI SAGE_PFNGLUNIFORM2IVARBPROC SAGE_glUniform2ivARB; SAGEAPI SAGE_PFNGLUNIFORM3IVARBPROC SAGE_glUniform3ivARB; SAGEAPI SAGE_PFNGLUNIFORM4IVARBPROC SAGE_glUniform4ivARB; SAGEAPI SAGE_PFNGLUNIFORMMATRIX2FVARBPROC SAGE_glUniformMatrix2fvARB; SAGEAPI SAGE_PFNGLUNIFORMMATRIX3FVARBPROC SAGE_glUniformMatrix3fvARB; SAGEAPI SAGE_PFNGLUNIFORMMATRIX4FVARBPROC SAGE_glUniformMatrix4fvARB; SAGEAPI SAGE_PFNGLGETOBJECTPARAMETERFVARBPROC SAGE_glGetObjectParameterfvARB; SAGEAPI SAGE_PFNGLGETOBJECTPARAMETERIVARBPROC SAGE_glGetObjectParameterivARB; SAGEAPI SAGE_PFNGLGETINFOLOGARBPROC SAGE_glGetInfoLogARB; SAGEAPI SAGE_PFNGLGETATTACHEDOBJECTSARBPROC SAGE_glGetAttachedObjectsARB; SAGEAPI SAGE_PFNGLGETUNIFORMLOCATIONARBPROC SAGE_glGetUniformLocationARB; SAGEAPI SAGE_PFNGLGETACTIVEUNIFORMARBPROC SAGE_glGetActiveUniformARB; SAGEAPI SAGE_PFNGLGETUNIFORMFVARBPROC SAGE_glGetUniformfvARB; SAGEAPI SAGE_PFNGLGETUNIFORMIVARBPROC SAGE_glGetUniformivARB; SAGEAPI SAGE_PFNGLGETSHADERSOURCEARBPROC SAGE_glGetShaderSourceARB; SAGEAPI SAGE_PFNGLBINDATTRIBLOCATIONARBPROC SAGE_glBindAttribLocationARB; SAGEAPI SAGE_PFNGLGETACTIVEATTRIBARBPROC SAGE_glGetActiveAttribARB; SAGEAPI SAGE_PFNGLGETATTRIBLOCATIONARBPROC SAGE_glGetAttribLocationARB; SAGEAPI SAGE_PFNGLDRAWBUFFERSARBPROC SAGE_glDrawBuffersARB; SAGEAPI SAGE_PFNGLCLAMPCOLORARBPROC SAGE_glClampColorARB; SAGEAPI SAGE_PFNGLDRAWARRAYSINSTANCEDARBPROC SAGE_glDrawArraysInstancedARB; SAGEAPI SAGE_PFNGLDRAWELEMENTSINSTANCEDARBPROC SAGE_glDrawElementsInstancedARB; SAGEAPI SAGE_PFNGLISRENDERBUFFERPROC SAGE_glIsRenderbuffer; SAGEAPI SAGE_PFNGLBINDRENDERBUFFERPROC SAGE_glBindRenderbuffer; SAGEAPI SAGE_PFNGLDELETERENDERBUFFERSPROC SAGE_glDeleteRenderbuffers; SAGEAPI SAGE_PFNGLGENRENDERBUFFERSPROC SAGE_glGenRenderbuffers; SAGEAPI SAGE_PFNGLRENDERBUFFERSTORAGEPROC SAGE_glRenderbufferStorage; SAGEAPI SAGE_PFNGLGETRENDERBUFFERPARAMETERIVPROC SAGE_glGetRenderbufferParameteriv; SAGEAPI SAGE_PFNGLISFRAMEBUFFERPROC SAGE_glIsFramebuffer; SAGEAPI SAGE_PFNGLBINDFRAMEBUFFERPROC SAGE_glBindFramebuffer; SAGEAPI SAGE_PFNGLDELETEFRAMEBUFFERSPROC SAGE_glDeleteFramebuffers; SAGEAPI SAGE_PFNGLGENFRAMEBUFFERSPROC SAGE_glGenFramebuffers; SAGEAPI SAGE_PFNGLCHECKFRAMEBUFFERSTATUSPROC SAGE_glCheckFramebufferStatus; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTURE1DPROC SAGE_glFramebufferTexture1D; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTURE2DPROC SAGE_glFramebufferTexture2D; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTURE3DPROC SAGE_glFramebufferTexture3D; SAGEAPI SAGE_PFNGLFRAMEBUFFERRENDERBUFFERPROC SAGE_glFramebufferRenderbuffer; SAGEAPI SAGE_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC SAGE_glGetFramebufferAttachmentParameteriv; SAGEAPI SAGE_PFNGLGENERATEMIPMAPPROC SAGE_glGenerateMipmap; SAGEAPI SAGE_PFNGLBLITFRAMEBUFFERPROC SAGE_glBlitFramebuffer; SAGEAPI SAGE_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC SAGE_glRenderbufferStorageMultisample; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTURELAYERPROC SAGE_glFramebufferTextureLayer; SAGEAPI SAGE_PFNGLPROGRAMPARAMETERIARBPROC SAGE_glProgramParameteriARB; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTUREARBPROC SAGE_glFramebufferTextureARB; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTURELAYERARBPROC SAGE_glFramebufferTextureLayerARB; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTUREFACEARBPROC SAGE_glFramebufferTextureFaceARB; SAGEAPI SAGE_PFNGLVERTEXATTRIBDIVISORARBPROC SAGE_glVertexAttribDivisorARB; SAGEAPI SAGE_PFNGLMAPBUFFERRANGEPROC SAGE_glMapBufferRange; SAGEAPI SAGE_PFNGLFLUSHMAPPEDBUFFERRANGEPROC SAGE_glFlushMappedBufferRange; SAGEAPI SAGE_PFNGLTEXBUFFERARBPROC SAGE_glTexBufferARB; SAGEAPI SAGE_PFNGLBINDVERTEXARRAYPROC SAGE_glBindVertexArray; SAGEAPI SAGE_PFNGLDELETEVERTEXARRAYSPROC SAGE_glDeleteVertexArrays; SAGEAPI SAGE_PFNGLGENVERTEXARRAYSPROC SAGE_glGenVertexArrays; SAGEAPI SAGE_PFNGLISVERTEXARRAYPROC SAGE_glIsVertexArray; SAGEAPI SAGE_PFNGLGETUNIFORMINDICESPROC SAGE_glGetUniformIndices; SAGEAPI SAGE_PFNGLGETACTIVEUNIFORMSIVPROC SAGE_glGetActiveUniformsiv; SAGEAPI SAGE_PFNGLGETACTIVEUNIFORMNAMEPROC SAGE_glGetActiveUniformName; SAGEAPI SAGE_PFNGLGETUNIFORMBLOCKINDEXPROC SAGE_glGetUniformBlockIndex; SAGEAPI SAGE_PFNGLGETACTIVEUNIFORMBLOCKIVPROC SAGE_glGetActiveUniformBlockiv; SAGEAPI SAGE_PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC SAGE_glGetActiveUniformBlockName; SAGEAPI SAGE_PFNGLUNIFORMBLOCKBINDINGPROC SAGE_glUniformBlockBinding; SAGEAPI SAGE_PFNGLCOPYBUFFERSUBDATAPROC SAGE_glCopyBufferSubData; SAGEAPI SAGE_PFNGLDRAWELEMENTSBASEVERTEXPROC SAGE_glDrawElementsBaseVertex; SAGEAPI SAGE_PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC SAGE_glDrawRangeElementsBaseVertex; SAGEAPI SAGE_PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC SAGE_glDrawElementsInstancedBaseVertex; SAGEAPI SAGE_PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC SAGE_glMultiDrawElementsBaseVertex; SAGEAPI SAGE_PFNGLPROVOKINGVERTEXPROC SAGE_glProvokingVertex; SAGEAPI SAGE_PFNGLFENCESYNCPROC SAGE_glFenceSync; SAGEAPI SAGE_PFNGLISSYNCPROC SAGE_glIsSync; SAGEAPI SAGE_PFNGLDELETESYNCPROC SAGE_glDeleteSync; SAGEAPI SAGE_PFNGLCLIENTWAITSYNCPROC SAGE_glClientWaitSync; SAGEAPI SAGE_PFNGLWAITSYNCPROC SAGE_glWaitSync; SAGEAPI SAGE_PFNGLGETINTEGER64VPROC SAGE_glGetInteger64v; SAGEAPI SAGE_PFNGLGETSYNCIVPROC SAGE_glGetSynciv; SAGEAPI SAGE_PFNGLTEXIMAGE2DMULTISAMPLEPROC SAGE_glTexImage2DMultisample; SAGEAPI SAGE_PFNGLTEXIMAGE3DMULTISAMPLEPROC SAGE_glTexImage3DMultisample; SAGEAPI SAGE_PFNGLGETMULTISAMPLEFVPROC SAGE_glGetMultisamplefv; SAGEAPI SAGE_PFNGLSAMPLEMASKIPROC SAGE_glSampleMaski; SAGEAPI SAGE_PFNGLBLENDEQUATIONIPROC SAGE_glBlendEquationi; SAGEAPI SAGE_PFNGLBLENDEQUATIONSEPARATEIPROC SAGE_glBlendEquationSeparatei; SAGEAPI SAGE_PFNGLBLENDFUNCIPROC SAGE_glBlendFunci; SAGEAPI SAGE_PFNGLBLENDFUNCSEPARATEIPROC SAGE_glBlendFuncSeparatei; SAGEAPI SAGE_PFNGLMINSAMPLESHADINGPROC SAGE_glMinSampleShading; SAGEAPI SAGE_PFNGLBLENDCOLOREXTPROC SAGE_glBlendColorEXT; SAGEAPI SAGE_PFNGLPOLYGONOFFSETEXTPROC SAGE_glPolygonOffsetEXT; SAGEAPI SAGE_PFNGLTEXIMAGE3DEXTPROC SAGE_glTexImage3DEXT; SAGEAPI SAGE_PFNGLTEXSUBIMAGE3DEXTPROC SAGE_glTexSubImage3DEXT; SAGEAPI SAGE_PFNGLGETTEXFILTERFUNCSGISPROC SAGE_glGetTexFilterFuncSGIS; SAGEAPI SAGE_PFNGLTEXFILTERFUNCSGISPROC SAGE_glTexFilterFuncSGIS; SAGEAPI SAGE_PFNGLTEXSUBIMAGE1DEXTPROC SAGE_glTexSubImage1DEXT; SAGEAPI SAGE_PFNGLTEXSUBIMAGE2DEXTPROC SAGE_glTexSubImage2DEXT; SAGEAPI SAGE_PFNGLCOPYTEXIMAGE1DEXTPROC SAGE_glCopyTexImage1DEXT; SAGEAPI SAGE_PFNGLCOPYTEXIMAGE2DEXTPROC SAGE_glCopyTexImage2DEXT; SAGEAPI SAGE_PFNGLCOPYTEXSUBIMAGE1DEXTPROC SAGE_glCopyTexSubImage1DEXT; SAGEAPI SAGE_PFNGLCOPYTEXSUBIMAGE2DEXTPROC SAGE_glCopyTexSubImage2DEXT; SAGEAPI SAGE_PFNGLCOPYTEXSUBIMAGE3DEXTPROC SAGE_glCopyTexSubImage3DEXT; SAGEAPI SAGE_PFNGLGETHISTOGRAMEXTPROC SAGE_glGetHistogramEXT; SAGEAPI SAGE_PFNGLGETHISTOGRAMPARAMETERFVEXTPROC SAGE_glGetHistogramParameterfvEXT; SAGEAPI SAGE_PFNGLGETHISTOGRAMPARAMETERIVEXTPROC SAGE_glGetHistogramParameterivEXT; SAGEAPI SAGE_PFNGLGETMINMAXEXTPROC SAGE_glGetMinmaxEXT; SAGEAPI SAGE_PFNGLGETMINMAXPARAMETERFVEXTPROC SAGE_glGetMinmaxParameterfvEXT; SAGEAPI SAGE_PFNGLGETMINMAXPARAMETERIVEXTPROC SAGE_glGetMinmaxParameterivEXT; SAGEAPI SAGE_PFNGLHISTOGRAMEXTPROC SAGE_glHistogramEXT; SAGEAPI SAGE_PFNGLMINMAXEXTPROC SAGE_glMinmaxEXT; SAGEAPI SAGE_PFNGLRESETHISTOGRAMEXTPROC SAGE_glResetHistogramEXT; SAGEAPI SAGE_PFNGLRESETMINMAXEXTPROC SAGE_glResetMinmaxEXT; SAGEAPI SAGE_PFNGLCONVOLUTIONFILTER1DEXTPROC SAGE_glConvolutionFilter1DEXT; SAGEAPI SAGE_PFNGLCONVOLUTIONFILTER2DEXTPROC SAGE_glConvolutionFilter2DEXT; SAGEAPI SAGE_PFNGLCONVOLUTIONPARAMETERFEXTPROC SAGE_glConvolutionParameterfEXT; SAGEAPI SAGE_PFNGLCONVOLUTIONPARAMETERFVEXTPROC SAGE_glConvolutionParameterfvEXT; SAGEAPI SAGE_PFNGLCONVOLUTIONPARAMETERIEXTPROC SAGE_glConvolutionParameteriEXT; SAGEAPI SAGE_PFNGLCONVOLUTIONPARAMETERIVEXTPROC SAGE_glConvolutionParameterivEXT; SAGEAPI SAGE_PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC SAGE_glCopyConvolutionFilter1DEXT; SAGEAPI SAGE_PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC SAGE_glCopyConvolutionFilter2DEXT; SAGEAPI SAGE_PFNGLGETCONVOLUTIONFILTEREXTPROC SAGE_glGetConvolutionFilterEXT; SAGEAPI SAGE_PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC SAGE_glGetConvolutionParameterfvEXT; SAGEAPI SAGE_PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC SAGE_glGetConvolutionParameterivEXT; SAGEAPI SAGE_PFNGLGETSEPARABLEFILTEREXTPROC SAGE_glGetSeparableFilterEXT; SAGEAPI SAGE_PFNGLSEPARABLEFILTER2DEXTPROC SAGE_glSeparableFilter2DEXT; SAGEAPI SAGE_PFNGLCOLORTABLESGIPROC SAGE_glColorTableSGI; SAGEAPI SAGE_PFNGLCOLORTABLEPARAMETERFVSGIPROC SAGE_glColorTableParameterfvSGI; SAGEAPI SAGE_PFNGLCOLORTABLEPARAMETERIVSGIPROC SAGE_glColorTableParameterivSGI; SAGEAPI SAGE_PFNGLCOPYCOLORTABLESGIPROC SAGE_glCopyColorTableSGI; SAGEAPI SAGE_PFNGLGETCOLORTABLESGIPROC SAGE_glGetColorTableSGI; SAGEAPI SAGE_PFNGLGETCOLORTABLEPARAMETERFVSGIPROC SAGE_glGetColorTableParameterfvSGI; SAGEAPI SAGE_PFNGLGETCOLORTABLEPARAMETERIVSGIPROC SAGE_glGetColorTableParameterivSGI; SAGEAPI SAGE_PFNGLPIXELTEXGENSGIXPROC SAGE_glPixelTexGenSGIX; SAGEAPI SAGE_PFNGLPIXELTEXGENPARAMETERISGISPROC SAGE_glPixelTexGenParameteriSGIS; SAGEAPI SAGE_PFNGLPIXELTEXGENPARAMETERIVSGISPROC SAGE_glPixelTexGenParameterivSGIS; SAGEAPI SAGE_PFNGLPIXELTEXGENPARAMETERFSGISPROC SAGE_glPixelTexGenParameterfSGIS; SAGEAPI SAGE_PFNGLPIXELTEXGENPARAMETERFVSGISPROC SAGE_glPixelTexGenParameterfvSGIS; SAGEAPI SAGE_PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC SAGE_glGetPixelTexGenParameterivSGIS; SAGEAPI SAGE_PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC SAGE_glGetPixelTexGenParameterfvSGIS; SAGEAPI SAGE_PFNGLTEXIMAGE4DSGISPROC SAGE_glTexImage4DSGIS; SAGEAPI SAGE_PFNGLTEXSUBIMAGE4DSGISPROC SAGE_glTexSubImage4DSGIS; SAGEAPI SAGE_PFNGLARETEXTURESRESIDENTEXTPROC SAGE_glAreTexturesResidentEXT; SAGEAPI SAGE_PFNGLBINDTEXTUREEXTPROC SAGE_glBindTextureEXT; SAGEAPI SAGE_PFNGLDELETETEXTURESEXTPROC SAGE_glDeleteTexturesEXT; SAGEAPI SAGE_PFNGLGENTEXTURESEXTPROC SAGE_glGenTexturesEXT; SAGEAPI SAGE_PFNGLISTEXTUREEXTPROC SAGE_glIsTextureEXT; SAGEAPI SAGE_PFNGLPRIORITIZETEXTURESEXTPROC SAGE_glPrioritizeTexturesEXT; SAGEAPI SAGE_PFNGLDETAILTEXFUNCSGISPROC SAGE_glDetailTexFuncSGIS; SAGEAPI SAGE_PFNGLGETDETAILTEXFUNCSGISPROC SAGE_glGetDetailTexFuncSGIS; SAGEAPI SAGE_PFNGLSHARPENTEXFUNCSGISPROC SAGE_glSharpenTexFuncSGIS; SAGEAPI SAGE_PFNGLGETSHARPENTEXFUNCSGISPROC SAGE_glGetSharpenTexFuncSGIS; SAGEAPI SAGE_PFNGLSAMPLEMASKSGISPROC SAGE_glSampleMaskSGIS; SAGEAPI SAGE_PFNGLSAMPLEPATTERNSGISPROC SAGE_glSamplePatternSGIS; SAGEAPI SAGE_PFNGLARRAYELEMENTEXTPROC SAGE_glArrayElementEXT; SAGEAPI SAGE_PFNGLCOLORPOINTEREXTPROC SAGE_glColorPointerEXT; SAGEAPI SAGE_PFNGLDRAWARRAYSEXTPROC SAGE_glDrawArraysEXT; SAGEAPI SAGE_PFNGLEDGEFLAGPOINTEREXTPROC SAGE_glEdgeFlagPointerEXT; SAGEAPI SAGE_PFNGLGETPOINTERVEXTPROC SAGE_glGetPointervEXT; SAGEAPI SAGE_PFNGLINDEXPOINTEREXTPROC SAGE_glIndexPointerEXT; SAGEAPI SAGE_PFNGLNORMALPOINTEREXTPROC SAGE_glNormalPointerEXT; SAGEAPI SAGE_PFNGLTEXCOORDPOINTEREXTPROC SAGE_glTexCoordPointerEXT; SAGEAPI SAGE_PFNGLVERTEXPOINTEREXTPROC SAGE_glVertexPointerEXT; SAGEAPI SAGE_PFNGLBLENDEQUATIONEXTPROC SAGE_glBlendEquationEXT; SAGEAPI SAGE_PFNGLSPRITEPARAMETERFSGIXPROC SAGE_glSpriteParameterfSGIX; SAGEAPI SAGE_PFNGLSPRITEPARAMETERFVSGIXPROC SAGE_glSpriteParameterfvSGIX; SAGEAPI SAGE_PFNGLSPRITEPARAMETERISGIXPROC SAGE_glSpriteParameteriSGIX; SAGEAPI SAGE_PFNGLSPRITEPARAMETERIVSGIXPROC SAGE_glSpriteParameterivSGIX; SAGEAPI SAGE_PFNGLPOINTPARAMETERFEXTPROC SAGE_glPointParameterfEXT; SAGEAPI SAGE_PFNGLPOINTPARAMETERFVEXTPROC SAGE_glPointParameterfvEXT; SAGEAPI SAGE_PFNGLPOINTPARAMETERFSGISPROC SAGE_glPointParameterfSGIS; SAGEAPI SAGE_PFNGLPOINTPARAMETERFVSGISPROC SAGE_glPointParameterfvSGIS; SAGEAPI SAGE_PFNGLGETINSTRUMENTSSGIXPROC SAGE_glGetInstrumentsSGIX; SAGEAPI SAGE_PFNGLINSTRUMENTSBUFFERSGIXPROC SAGE_glInstrumentsBufferSGIX; SAGEAPI SAGE_PFNGLPOLLINSTRUMENTSSGIXPROC SAGE_glPollInstrumentsSGIX; SAGEAPI SAGE_PFNGLREADINSTRUMENTSSGIXPROC SAGE_glReadInstrumentsSGIX; SAGEAPI SAGE_PFNGLSTARTINSTRUMENTSSGIXPROC SAGE_glStartInstrumentsSGIX; SAGEAPI SAGE_PFNGLSTOPINSTRUMENTSSGIXPROC SAGE_glStopInstrumentsSGIX; SAGEAPI SAGE_PFNGLFRAMEZOOMSGIXPROC SAGE_glFrameZoomSGIX; SAGEAPI SAGE_PFNGLTAGSAMPLEBUFFERSGIXPROC SAGE_glTagSampleBufferSGIX; SAGEAPI SAGE_PFNGLDEFORMATIONMAP3DSGIXPROC SAGE_glDeformationMap3dSGIX; SAGEAPI SAGE_PFNGLDEFORMATIONMAP3FSGIXPROC SAGE_glDeformationMap3fSGIX; SAGEAPI SAGE_PFNGLDEFORMSGIXPROC SAGE_glDeformSGIX; SAGEAPI SAGE_PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC SAGE_glLoadIdentityDeformationMapSGIX; SAGEAPI SAGE_PFNGLREFERENCEPLANESGIXPROC SAGE_glReferencePlaneSGIX; SAGEAPI SAGE_PFNGLFLUSHRASTERSGIXPROC SAGE_glFlushRasterSGIX; SAGEAPI SAGE_PFNGLFOGFUNCSGISPROC SAGE_glFogFuncSGIS; SAGEAPI SAGE_PFNGLGETFOGFUNCSGISPROC SAGE_glGetFogFuncSGIS; SAGEAPI SAGE_PFNGLIMAGETRANSFORMPARAMETERIHPPROC SAGE_glImageTransformParameteriHP; SAGEAPI SAGE_PFNGLIMAGETRANSFORMPARAMETERFHPPROC SAGE_glImageTransformParameterfHP; SAGEAPI SAGE_PFNGLIMAGETRANSFORMPARAMETERIVHPPROC SAGE_glImageTransformParameterivHP; SAGEAPI SAGE_PFNGLIMAGETRANSFORMPARAMETERFVHPPROC SAGE_glImageTransformParameterfvHP; SAGEAPI SAGE_PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC SAGE_glGetImageTransformParameterivHP; SAGEAPI SAGE_PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC SAGE_glGetImageTransformParameterfvHP; SAGEAPI SAGE_PFNGLCOLORSUBTABLEEXTPROC SAGE_glColorSubTableEXT; SAGEAPI SAGE_PFNGLCOPYCOLORSUBTABLEEXTPROC SAGE_glCopyColorSubTableEXT; SAGEAPI SAGE_PFNGLHINTPGIPROC SAGE_glHintPGI; SAGEAPI SAGE_PFNGLCOLORTABLEEXTPROC SAGE_glColorTableEXT; SAGEAPI SAGE_PFNGLGETCOLORTABLEEXTPROC SAGE_glGetColorTableEXT; SAGEAPI SAGE_PFNGLGETCOLORTABLEPARAMETERIVEXTPROC SAGE_glGetColorTableParameterivEXT; SAGEAPI SAGE_PFNGLGETCOLORTABLEPARAMETERFVEXTPROC SAGE_glGetColorTableParameterfvEXT; SAGEAPI SAGE_PFNGLGETLISTPARAMETERFVSGIXPROC SAGE_glGetListParameterfvSGIX; SAGEAPI SAGE_PFNGLGETLISTPARAMETERIVSGIXPROC SAGE_glGetListParameterivSGIX; SAGEAPI SAGE_PFNGLLISTPARAMETERFSGIXPROC SAGE_glListParameterfSGIX; SAGEAPI SAGE_PFNGLLISTPARAMETERFVSGIXPROC SAGE_glListParameterfvSGIX; SAGEAPI SAGE_PFNGLLISTPARAMETERISGIXPROC SAGE_glListParameteriSGIX; SAGEAPI SAGE_PFNGLLISTPARAMETERIVSGIXPROC SAGE_glListParameterivSGIX; SAGEAPI SAGE_PFNGLINDEXMATERIALEXTPROC SAGE_glIndexMaterialEXT; SAGEAPI SAGE_PFNGLINDEXFUNCEXTPROC SAGE_glIndexFuncEXT; SAGEAPI SAGE_PFNGLLOCKARRAYSEXTPROC SAGE_glLockArraysEXT; SAGEAPI SAGE_PFNGLUNLOCKARRAYSEXTPROC SAGE_glUnlockArraysEXT; SAGEAPI SAGE_PFNGLCULLPARAMETERDVEXTPROC SAGE_glCullParameterdvEXT; SAGEAPI SAGE_PFNGLCULLPARAMETERFVEXTPROC SAGE_glCullParameterfvEXT; SAGEAPI SAGE_PFNGLFRAGMENTCOLORMATERIALSGIXPROC SAGE_glFragmentColorMaterialSGIX; SAGEAPI SAGE_PFNGLFRAGMENTLIGHTFSGIXPROC SAGE_glFragmentLightfSGIX; SAGEAPI SAGE_PFNGLFRAGMENTLIGHTFVSGIXPROC SAGE_glFragmentLightfvSGIX; SAGEAPI SAGE_PFNGLFRAGMENTLIGHTISGIXPROC SAGE_glFragmentLightiSGIX; SAGEAPI SAGE_PFNGLFRAGMENTLIGHTIVSGIXPROC SAGE_glFragmentLightivSGIX; SAGEAPI SAGE_PFNGLFRAGMENTLIGHTMODELFSGIXPROC SAGE_glFragmentLightModelfSGIX; SAGEAPI SAGE_PFNGLFRAGMENTLIGHTMODELFVSGIXPROC SAGE_glFragmentLightModelfvSGIX; SAGEAPI SAGE_PFNGLFRAGMENTLIGHTMODELISGIXPROC SAGE_glFragmentLightModeliSGIX; SAGEAPI SAGE_PFNGLFRAGMENTLIGHTMODELIVSGIXPROC SAGE_glFragmentLightModelivSGIX; SAGEAPI SAGE_PFNGLFRAGMENTMATERIALFSGIXPROC SAGE_glFragmentMaterialfSGIX; SAGEAPI SAGE_PFNGLFRAGMENTMATERIALFVSGIXPROC SAGE_glFragmentMaterialfvSGIX; SAGEAPI SAGE_PFNGLFRAGMENTMATERIALISGIXPROC SAGE_glFragmentMaterialiSGIX; SAGEAPI SAGE_PFNGLFRAGMENTMATERIALIVSGIXPROC SAGE_glFragmentMaterialivSGIX; SAGEAPI SAGE_PFNGLGETFRAGMENTLIGHTFVSGIXPROC SAGE_glGetFragmentLightfvSGIX; SAGEAPI SAGE_PFNGLGETFRAGMENTLIGHTIVSGIXPROC SAGE_glGetFragmentLightivSGIX; SAGEAPI SAGE_PFNGLGETFRAGMENTMATERIALFVSGIXPROC SAGE_glGetFragmentMaterialfvSGIX; SAGEAPI SAGE_PFNGLGETFRAGMENTMATERIALIVSGIXPROC SAGE_glGetFragmentMaterialivSGIX; SAGEAPI SAGE_PFNGLLIGHTENVISGIXPROC SAGE_glLightEnviSGIX; SAGEAPI SAGE_PFNGLDRAWRANGEELEMENTSEXTPROC SAGE_glDrawRangeElementsEXT; SAGEAPI SAGE_PFNGLAPPLYTEXTUREEXTPROC SAGE_glApplyTextureEXT; SAGEAPI SAGE_PFNGLTEXTURELIGHTEXTPROC SAGE_glTextureLightEXT; SAGEAPI SAGE_PFNGLTEXTUREMATERIALEXTPROC SAGE_glTextureMaterialEXT; SAGEAPI SAGE_PFNGLASYNCMARKERSGIXPROC SAGE_glAsyncMarkerSGIX; SAGEAPI SAGE_PFNGLFINISHASYNCSGIXPROC SAGE_glFinishAsyncSGIX; SAGEAPI SAGE_PFNGLPOLLASYNCSGIXPROC SAGE_glPollAsyncSGIX; SAGEAPI SAGE_PFNGLGENASYNCMARKERSSGIXPROC SAGE_glGenAsyncMarkersSGIX; SAGEAPI SAGE_PFNGLDELETEASYNCMARKERSSGIXPROC SAGE_glDeleteAsyncMarkersSGIX; SAGEAPI SAGE_PFNGLISASYNCMARKERSGIXPROC SAGE_glIsAsyncMarkerSGIX; SAGEAPI SAGE_PFNGLVERTEXPOINTERVINTELPROC SAGE_glVertexPointervINTEL; SAGEAPI SAGE_PFNGLNORMALPOINTERVINTELPROC SAGE_glNormalPointervINTEL; SAGEAPI SAGE_PFNGLCOLORPOINTERVINTELPROC SAGE_glColorPointervINTEL; SAGEAPI SAGE_PFNGLTEXCOORDPOINTERVINTELPROC SAGE_glTexCoordPointervINTEL; SAGEAPI SAGE_PFNGLPIXELTRANSFORMPARAMETERIEXTPROC SAGE_glPixelTransformParameteriEXT; SAGEAPI SAGE_PFNGLPIXELTRANSFORMPARAMETERFEXTPROC SAGE_glPixelTransformParameterfEXT; SAGEAPI SAGE_PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC SAGE_glPixelTransformParameterivEXT; SAGEAPI SAGE_PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC SAGE_glPixelTransformParameterfvEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3BEXTPROC SAGE_glSecondaryColor3bEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3BVEXTPROC SAGE_glSecondaryColor3bvEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3DEXTPROC SAGE_glSecondaryColor3dEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3DVEXTPROC SAGE_glSecondaryColor3dvEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3FEXTPROC SAGE_glSecondaryColor3fEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3FVEXTPROC SAGE_glSecondaryColor3fvEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3IEXTPROC SAGE_glSecondaryColor3iEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3IVEXTPROC SAGE_glSecondaryColor3ivEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3SEXTPROC SAGE_glSecondaryColor3sEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3SVEXTPROC SAGE_glSecondaryColor3svEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3UBEXTPROC SAGE_glSecondaryColor3ubEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3UBVEXTPROC SAGE_glSecondaryColor3ubvEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3UIEXTPROC SAGE_glSecondaryColor3uiEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3UIVEXTPROC SAGE_glSecondaryColor3uivEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3USEXTPROC SAGE_glSecondaryColor3usEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3USVEXTPROC SAGE_glSecondaryColor3usvEXT; SAGEAPI SAGE_PFNGLSECONDARYCOLORPOINTEREXTPROC SAGE_glSecondaryColorPointerEXT; SAGEAPI SAGE_PFNGLTEXTURENORMALEXTPROC SAGE_glTextureNormalEXT; SAGEAPI SAGE_PFNGLMULTIDRAWARRAYSEXTPROC SAGE_glMultiDrawArraysEXT; SAGEAPI SAGE_PFNGLMULTIDRAWELEMENTSEXTPROC SAGE_glMultiDrawElementsEXT; SAGEAPI SAGE_PFNGLFOGCOORDFEXTPROC SAGE_glFogCoordfEXT; SAGEAPI SAGE_PFNGLFOGCOORDFVEXTPROC SAGE_glFogCoordfvEXT; SAGEAPI SAGE_PFNGLFOGCOORDDEXTPROC SAGE_glFogCoorddEXT; SAGEAPI SAGE_PFNGLFOGCOORDDVEXTPROC SAGE_glFogCoorddvEXT; SAGEAPI SAGE_PFNGLFOGCOORDPOINTEREXTPROC SAGE_glFogCoordPointerEXT; SAGEAPI SAGE_PFNGLTANGENT3BEXTPROC SAGE_glTangent3bEXT; SAGEAPI SAGE_PFNGLTANGENT3BVEXTPROC SAGE_glTangent3bvEXT; SAGEAPI SAGE_PFNGLTANGENT3DEXTPROC SAGE_glTangent3dEXT; SAGEAPI SAGE_PFNGLTANGENT3DVEXTPROC SAGE_glTangent3dvEXT; SAGEAPI SAGE_PFNGLTANGENT3FEXTPROC SAGE_glTangent3fEXT; SAGEAPI SAGE_PFNGLTANGENT3FVEXTPROC SAGE_glTangent3fvEXT; SAGEAPI SAGE_PFNGLTANGENT3IEXTPROC SAGE_glTangent3iEXT; SAGEAPI SAGE_PFNGLTANGENT3IVEXTPROC SAGE_glTangent3ivEXT; SAGEAPI SAGE_PFNGLTANGENT3SEXTPROC SAGE_glTangent3sEXT; SAGEAPI SAGE_PFNGLTANGENT3SVEXTPROC SAGE_glTangent3svEXT; SAGEAPI SAGE_PFNGLBINORMAL3BEXTPROC SAGE_glBinormal3bEXT; SAGEAPI SAGE_PFNGLBINORMAL3BVEXTPROC SAGE_glBinormal3bvEXT; SAGEAPI SAGE_PFNGLBINORMAL3DEXTPROC SAGE_glBinormal3dEXT; SAGEAPI SAGE_PFNGLBINORMAL3DVEXTPROC SAGE_glBinormal3dvEXT; SAGEAPI SAGE_PFNGLBINORMAL3FEXTPROC SAGE_glBinormal3fEXT; SAGEAPI SAGE_PFNGLBINORMAL3FVEXTPROC SAGE_glBinormal3fvEXT; SAGEAPI SAGE_PFNGLBINORMAL3IEXTPROC SAGE_glBinormal3iEXT; SAGEAPI SAGE_PFNGLBINORMAL3IVEXTPROC SAGE_glBinormal3ivEXT; SAGEAPI SAGE_PFNGLBINORMAL3SEXTPROC SAGE_glBinormal3sEXT; SAGEAPI SAGE_PFNGLBINORMAL3SVEXTPROC SAGE_glBinormal3svEXT; SAGEAPI SAGE_PFNGLTANGENTPOINTEREXTPROC SAGE_glTangentPointerEXT; SAGEAPI SAGE_PFNGLBINORMALPOINTEREXTPROC SAGE_glBinormalPointerEXT; SAGEAPI SAGE_PFNGLFINISHTEXTURESUNXPROC SAGE_glFinishTextureSUNX; SAGEAPI SAGE_PFNGLGLOBALALPHAFACTORBSUNPROC SAGE_glGlobalAlphaFactorbSUN; SAGEAPI SAGE_PFNGLGLOBALALPHAFACTORSSUNPROC SAGE_glGlobalAlphaFactorsSUN; SAGEAPI SAGE_PFNGLGLOBALALPHAFACTORISUNPROC SAGE_glGlobalAlphaFactoriSUN; SAGEAPI SAGE_PFNGLGLOBALALPHAFACTORFSUNPROC SAGE_glGlobalAlphaFactorfSUN; SAGEAPI SAGE_PFNGLGLOBALALPHAFACTORDSUNPROC SAGE_glGlobalAlphaFactordSUN; SAGEAPI SAGE_PFNGLGLOBALALPHAFACTORUBSUNPROC SAGE_glGlobalAlphaFactorubSUN; SAGEAPI SAGE_PFNGLGLOBALALPHAFACTORUSSUNPROC SAGE_glGlobalAlphaFactorusSUN; SAGEAPI SAGE_PFNGLGLOBALALPHAFACTORUISUNPROC SAGE_glGlobalAlphaFactoruiSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUISUNPROC SAGE_glReplacementCodeuiSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUSSUNPROC SAGE_glReplacementCodeusSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUBSUNPROC SAGE_glReplacementCodeubSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUIVSUNPROC SAGE_glReplacementCodeuivSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUSVSUNPROC SAGE_glReplacementCodeusvSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUBVSUNPROC SAGE_glReplacementCodeubvSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEPOINTERSUNPROC SAGE_glReplacementCodePointerSUN; SAGEAPI SAGE_PFNGLCOLOR4UBVERTEX2FSUNPROC SAGE_glColor4ubVertex2fSUN; SAGEAPI SAGE_PFNGLCOLOR4UBVERTEX2FVSUNPROC SAGE_glColor4ubVertex2fvSUN; SAGEAPI SAGE_PFNGLCOLOR4UBVERTEX3FSUNPROC SAGE_glColor4ubVertex3fSUN; SAGEAPI SAGE_PFNGLCOLOR4UBVERTEX3FVSUNPROC SAGE_glColor4ubVertex3fvSUN; SAGEAPI SAGE_PFNGLCOLOR3FVERTEX3FSUNPROC SAGE_glColor3fVertex3fSUN; SAGEAPI SAGE_PFNGLCOLOR3FVERTEX3FVSUNPROC SAGE_glColor3fVertex3fvSUN; SAGEAPI SAGE_PFNGLNORMAL3FVERTEX3FSUNPROC SAGE_glNormal3fVertex3fSUN; SAGEAPI SAGE_PFNGLNORMAL3FVERTEX3FVSUNPROC SAGE_glNormal3fVertex3fvSUN; SAGEAPI SAGE_PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC SAGE_glColor4fNormal3fVertex3fSUN; SAGEAPI SAGE_PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC SAGE_glColor4fNormal3fVertex3fvSUN; SAGEAPI SAGE_PFNGLTEXCOORD2FVERTEX3FSUNPROC SAGE_glTexCoord2fVertex3fSUN; SAGEAPI SAGE_PFNGLTEXCOORD2FVERTEX3FVSUNPROC SAGE_glTexCoord2fVertex3fvSUN; SAGEAPI SAGE_PFNGLTEXCOORD4FVERTEX4FSUNPROC SAGE_glTexCoord4fVertex4fSUN; SAGEAPI SAGE_PFNGLTEXCOORD4FVERTEX4FVSUNPROC SAGE_glTexCoord4fVertex4fvSUN; SAGEAPI SAGE_PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC SAGE_glTexCoord2fColor4ubVertex3fSUN; SAGEAPI SAGE_PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC SAGE_glTexCoord2fColor4ubVertex3fvSUN; SAGEAPI SAGE_PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC SAGE_glTexCoord2fColor3fVertex3fSUN; SAGEAPI SAGE_PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC SAGE_glTexCoord2fColor3fVertex3fvSUN; SAGEAPI SAGE_PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC SAGE_glTexCoord2fNormal3fVertex3fSUN; SAGEAPI SAGE_PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC SAGE_glTexCoord2fNormal3fVertex3fvSUN; SAGEAPI SAGE_PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC SAGE_glTexCoord2fColor4fNormal3fVertex3fSUN; SAGEAPI SAGE_PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC SAGE_glTexCoord2fColor4fNormal3fVertex3fvSUN; SAGEAPI SAGE_PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC SAGE_glTexCoord4fColor4fNormal3fVertex4fSUN; SAGEAPI SAGE_PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC SAGE_glTexCoord4fColor4fNormal3fVertex4fvSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC SAGE_glReplacementCodeuiVertex3fSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC SAGE_glReplacementCodeuiVertex3fvSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC SAGE_glReplacementCodeuiColor4ubVertex3fSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC SAGE_glReplacementCodeuiColor4ubVertex3fvSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC SAGE_glReplacementCodeuiColor3fVertex3fSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC SAGE_glReplacementCodeuiColor3fVertex3fvSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC SAGE_glReplacementCodeuiNormal3fVertex3fSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC SAGE_glReplacementCodeuiNormal3fVertex3fvSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC SAGE_glReplacementCodeuiColor4fNormal3fVertex3fSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC SAGE_glReplacementCodeuiColor4fNormal3fVertex3fvSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC SAGE_glReplacementCodeuiTexCoord2fVertex3fSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC SAGE_glReplacementCodeuiTexCoord2fVertex3fvSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC SAGE_glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC SAGE_glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC SAGE_glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN; SAGEAPI SAGE_PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC SAGE_glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN; SAGEAPI SAGE_PFNGLBLENDFUNCSEPARATEEXTPROC SAGE_glBlendFuncSeparateEXT; SAGEAPI SAGE_PFNGLBLENDFUNCSEPARATEINGRPROC SAGE_glBlendFuncSeparateINGR; SAGEAPI SAGE_PFNGLVERTEXWEIGHTFEXTPROC SAGE_glVertexWeightfEXT; SAGEAPI SAGE_PFNGLVERTEXWEIGHTFVEXTPROC SAGE_glVertexWeightfvEXT; SAGEAPI SAGE_PFNGLVERTEXWEIGHTPOINTEREXTPROC SAGE_glVertexWeightPointerEXT; SAGEAPI SAGE_PFNGLFLUSHVERTEXARRAYRANGENVPROC SAGE_glFlushVertexArrayRangeNV; SAGEAPI SAGE_PFNGLVERTEXARRAYRANGENVPROC SAGE_glVertexArrayRangeNV; SAGEAPI SAGE_PFNGLCOMBINERPARAMETERFVNVPROC SAGE_glCombinerParameterfvNV; SAGEAPI SAGE_PFNGLCOMBINERPARAMETERFNVPROC SAGE_glCombinerParameterfNV; SAGEAPI SAGE_PFNGLCOMBINERPARAMETERIVNVPROC SAGE_glCombinerParameterivNV; SAGEAPI SAGE_PFNGLCOMBINERPARAMETERINVPROC SAGE_glCombinerParameteriNV; SAGEAPI SAGE_PFNGLCOMBINERINPUTNVPROC SAGE_glCombinerInputNV; SAGEAPI SAGE_PFNGLCOMBINEROUTPUTNVPROC SAGE_glCombinerOutputNV; SAGEAPI SAGE_PFNGLFINALCOMBINERINPUTNVPROC SAGE_glFinalCombinerInputNV; SAGEAPI SAGE_PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC SAGE_glGetCombinerInputParameterfvNV; SAGEAPI SAGE_PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC SAGE_glGetCombinerInputParameterivNV; SAGEAPI SAGE_PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC SAGE_glGetCombinerOutputParameterfvNV; SAGEAPI SAGE_PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC SAGE_glGetCombinerOutputParameterivNV; SAGEAPI SAGE_PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC SAGE_glGetFinalCombinerInputParameterfvNV; SAGEAPI SAGE_PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC SAGE_glGetFinalCombinerInputParameterivNV; SAGEAPI SAGE_PFNGLRESIZEBUFFERSMESAPROC SAGE_glResizeBuffersMESA; SAGEAPI SAGE_PFNGLWINDOWPOS2DMESAPROC SAGE_glWindowPos2dMESA; SAGEAPI SAGE_PFNGLWINDOWPOS2DVMESAPROC SAGE_glWindowPos2dvMESA; SAGEAPI SAGE_PFNGLWINDOWPOS2FMESAPROC SAGE_glWindowPos2fMESA; SAGEAPI SAGE_PFNGLWINDOWPOS2FVMESAPROC SAGE_glWindowPos2fvMESA; SAGEAPI SAGE_PFNGLWINDOWPOS2IMESAPROC SAGE_glWindowPos2iMESA; SAGEAPI SAGE_PFNGLWINDOWPOS2IVMESAPROC SAGE_glWindowPos2ivMESA; SAGEAPI SAGE_PFNGLWINDOWPOS2SMESAPROC SAGE_glWindowPos2sMESA; SAGEAPI SAGE_PFNGLWINDOWPOS2SVMESAPROC SAGE_glWindowPos2svMESA; SAGEAPI SAGE_PFNGLWINDOWPOS3DMESAPROC SAGE_glWindowPos3dMESA; SAGEAPI SAGE_PFNGLWINDOWPOS3DVMESAPROC SAGE_glWindowPos3dvMESA; SAGEAPI SAGE_PFNGLWINDOWPOS3FMESAPROC SAGE_glWindowPos3fMESA; SAGEAPI SAGE_PFNGLWINDOWPOS3FVMESAPROC SAGE_glWindowPos3fvMESA; SAGEAPI SAGE_PFNGLWINDOWPOS3IMESAPROC SAGE_glWindowPos3iMESA; SAGEAPI SAGE_PFNGLWINDOWPOS3IVMESAPROC SAGE_glWindowPos3ivMESA; SAGEAPI SAGE_PFNGLWINDOWPOS3SMESAPROC SAGE_glWindowPos3sMESA; SAGEAPI SAGE_PFNGLWINDOWPOS3SVMESAPROC SAGE_glWindowPos3svMESA; SAGEAPI SAGE_PFNGLWINDOWPOS4DMESAPROC SAGE_glWindowPos4dMESA; SAGEAPI SAGE_PFNGLWINDOWPOS4DVMESAPROC SAGE_glWindowPos4dvMESA; SAGEAPI SAGE_PFNGLWINDOWPOS4FMESAPROC SAGE_glWindowPos4fMESA; SAGEAPI SAGE_PFNGLWINDOWPOS4FVMESAPROC SAGE_glWindowPos4fvMESA; SAGEAPI SAGE_PFNGLWINDOWPOS4IMESAPROC SAGE_glWindowPos4iMESA; SAGEAPI SAGE_PFNGLWINDOWPOS4IVMESAPROC SAGE_glWindowPos4ivMESA; SAGEAPI SAGE_PFNGLWINDOWPOS4SMESAPROC SAGE_glWindowPos4sMESA; SAGEAPI SAGE_PFNGLWINDOWPOS4SVMESAPROC SAGE_glWindowPos4svMESA; SAGEAPI SAGE_PFNGLMULTIMODEDRAWARRAYSIBMPROC SAGE_glMultiModeDrawArraysIBM; SAGEAPI SAGE_PFNGLMULTIMODEDRAWELEMENTSIBMPROC SAGE_glMultiModeDrawElementsIBM; SAGEAPI SAGE_PFNGLCOLORPOINTERLISTIBMPROC SAGE_glColorPointerListIBM; SAGEAPI SAGE_PFNGLSECONDARYCOLORPOINTERLISTIBMPROC SAGE_glSecondaryColorPointerListIBM; SAGEAPI SAGE_PFNGLEDGEFLAGPOINTERLISTIBMPROC SAGE_glEdgeFlagPointerListIBM; SAGEAPI SAGE_PFNGLFOGCOORDPOINTERLISTIBMPROC SAGE_glFogCoordPointerListIBM; SAGEAPI SAGE_PFNGLINDEXPOINTERLISTIBMPROC SAGE_glIndexPointerListIBM; SAGEAPI SAGE_PFNGLNORMALPOINTERLISTIBMPROC SAGE_glNormalPointerListIBM; SAGEAPI SAGE_PFNGLTEXCOORDPOINTERLISTIBMPROC SAGE_glTexCoordPointerListIBM; SAGEAPI SAGE_PFNGLVERTEXPOINTERLISTIBMPROC SAGE_glVertexPointerListIBM; SAGEAPI SAGE_PFNGLTBUFFERMASK3DFXPROC SAGE_glTbufferMask3DFX; SAGEAPI SAGE_PFNGLSAMPLEMASKEXTPROC SAGE_glSampleMaskEXT; SAGEAPI SAGE_PFNGLSAMPLEPATTERNEXTPROC SAGE_glSamplePatternEXT; SAGEAPI SAGE_PFNGLTEXTURECOLORMASKSGISPROC SAGE_glTextureColorMaskSGIS; SAGEAPI SAGE_PFNGLIGLOOINTERFACESGIXPROC SAGE_glIglooInterfaceSGIX; SAGEAPI SAGE_PFNGLDELETEFENCESNVPROC SAGE_glDeleteFencesNV; SAGEAPI SAGE_PFNGLGENFENCESNVPROC SAGE_glGenFencesNV; SAGEAPI SAGE_PFNGLISFENCENVPROC SAGE_glIsFenceNV; SAGEAPI SAGE_PFNGLTESTFENCENVPROC SAGE_glTestFenceNV; SAGEAPI SAGE_PFNGLGETFENCEIVNVPROC SAGE_glGetFenceivNV; SAGEAPI SAGE_PFNGLFINISHFENCENVPROC SAGE_glFinishFenceNV; SAGEAPI SAGE_PFNGLSETFENCENVPROC SAGE_glSetFenceNV; SAGEAPI SAGE_PFNGLMAPCONTROLPOINTSNVPROC SAGE_glMapControlPointsNV; SAGEAPI SAGE_PFNGLMAPPARAMETERIVNVPROC SAGE_glMapParameterivNV; SAGEAPI SAGE_PFNGLMAPPARAMETERFVNVPROC SAGE_glMapParameterfvNV; SAGEAPI SAGE_PFNGLGETMAPCONTROLPOINTSNVPROC SAGE_glGetMapControlPointsNV; SAGEAPI SAGE_PFNGLGETMAPPARAMETERIVNVPROC SAGE_glGetMapParameterivNV; SAGEAPI SAGE_PFNGLGETMAPPARAMETERFVNVPROC SAGE_glGetMapParameterfvNV; SAGEAPI SAGE_PFNGLGETMAPATTRIBPARAMETERIVNVPROC SAGE_glGetMapAttribParameterivNV; SAGEAPI SAGE_PFNGLGETMAPATTRIBPARAMETERFVNVPROC SAGE_glGetMapAttribParameterfvNV; SAGEAPI SAGE_PFNGLEVALMAPSNVPROC SAGE_glEvalMapsNV; SAGEAPI SAGE_PFNGLCOMBINERSTAGEPARAMETERFVNVPROC SAGE_glCombinerStageParameterfvNV; SAGEAPI SAGE_PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC SAGE_glGetCombinerStageParameterfvNV; SAGEAPI SAGE_PFNGLAREPROGRAMSRESIDENTNVPROC SAGE_glAreProgramsResidentNV; SAGEAPI SAGE_PFNGLBINDPROGRAMNVPROC SAGE_glBindProgramNV; SAGEAPI SAGE_PFNGLDELETEPROGRAMSNVPROC SAGE_glDeleteProgramsNV; SAGEAPI SAGE_PFNGLEXECUTEPROGRAMNVPROC SAGE_glExecuteProgramNV; SAGEAPI SAGE_PFNGLGENPROGRAMSNVPROC SAGE_glGenProgramsNV; SAGEAPI SAGE_PFNGLGETPROGRAMPARAMETERDVNVPROC SAGE_glGetProgramParameterdvNV; SAGEAPI SAGE_PFNGLGETPROGRAMPARAMETERFVNVPROC SAGE_glGetProgramParameterfvNV; SAGEAPI SAGE_PFNGLGETPROGRAMIVNVPROC SAGE_glGetProgramivNV; SAGEAPI SAGE_PFNGLGETPROGRAMSTRINGNVPROC SAGE_glGetProgramStringNV; SAGEAPI SAGE_PFNGLGETTRACKMATRIXIVNVPROC SAGE_glGetTrackMatrixivNV; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBDVNVPROC SAGE_glGetVertexAttribdvNV; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBFVNVPROC SAGE_glGetVertexAttribfvNV; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBIVNVPROC SAGE_glGetVertexAttribivNV; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBPOINTERVNVPROC SAGE_glGetVertexAttribPointervNV; SAGEAPI SAGE_PFNGLISPROGRAMNVPROC SAGE_glIsProgramNV; SAGEAPI SAGE_PFNGLLOADPROGRAMNVPROC SAGE_glLoadProgramNV; SAGEAPI SAGE_PFNGLPROGRAMPARAMETER4DNVPROC SAGE_glProgramParameter4dNV; SAGEAPI SAGE_PFNGLPROGRAMPARAMETER4DVNVPROC SAGE_glProgramParameter4dvNV; SAGEAPI SAGE_PFNGLPROGRAMPARAMETER4FNVPROC SAGE_glProgramParameter4fNV; SAGEAPI SAGE_PFNGLPROGRAMPARAMETER4FVNVPROC SAGE_glProgramParameter4fvNV; SAGEAPI SAGE_PFNGLPROGRAMPARAMETERS4DVNVPROC SAGE_glProgramParameters4dvNV; SAGEAPI SAGE_PFNGLPROGRAMPARAMETERS4FVNVPROC SAGE_glProgramParameters4fvNV; SAGEAPI SAGE_PFNGLREQUESTRESIDENTPROGRAMSNVPROC SAGE_glRequestResidentProgramsNV; SAGEAPI SAGE_PFNGLTRACKMATRIXNVPROC SAGE_glTrackMatrixNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBPOINTERNVPROC SAGE_glVertexAttribPointerNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB1DNVPROC SAGE_glVertexAttrib1dNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB1DVNVPROC SAGE_glVertexAttrib1dvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB1FNVPROC SAGE_glVertexAttrib1fNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB1FVNVPROC SAGE_glVertexAttrib1fvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB1SNVPROC SAGE_glVertexAttrib1sNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB1SVNVPROC SAGE_glVertexAttrib1svNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB2DNVPROC SAGE_glVertexAttrib2dNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB2DVNVPROC SAGE_glVertexAttrib2dvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB2FNVPROC SAGE_glVertexAttrib2fNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB2FVNVPROC SAGE_glVertexAttrib2fvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB2SNVPROC SAGE_glVertexAttrib2sNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB2SVNVPROC SAGE_glVertexAttrib2svNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB3DNVPROC SAGE_glVertexAttrib3dNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB3DVNVPROC SAGE_glVertexAttrib3dvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB3FNVPROC SAGE_glVertexAttrib3fNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB3FVNVPROC SAGE_glVertexAttrib3fvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB3SNVPROC SAGE_glVertexAttrib3sNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB3SVNVPROC SAGE_glVertexAttrib3svNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB4DNVPROC SAGE_glVertexAttrib4dNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB4DVNVPROC SAGE_glVertexAttrib4dvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB4FNVPROC SAGE_glVertexAttrib4fNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB4FVNVPROC SAGE_glVertexAttrib4fvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB4SNVPROC SAGE_glVertexAttrib4sNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB4SVNVPROC SAGE_glVertexAttrib4svNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB4UBNVPROC SAGE_glVertexAttrib4ubNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB4UBVNVPROC SAGE_glVertexAttrib4ubvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS1DVNVPROC SAGE_glVertexAttribs1dvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS1FVNVPROC SAGE_glVertexAttribs1fvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS1SVNVPROC SAGE_glVertexAttribs1svNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS2DVNVPROC SAGE_glVertexAttribs2dvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS2FVNVPROC SAGE_glVertexAttribs2fvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS2SVNVPROC SAGE_glVertexAttribs2svNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS3DVNVPROC SAGE_glVertexAttribs3dvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS3FVNVPROC SAGE_glVertexAttribs3fvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS3SVNVPROC SAGE_glVertexAttribs3svNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS4DVNVPROC SAGE_glVertexAttribs4dvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS4FVNVPROC SAGE_glVertexAttribs4fvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS4SVNVPROC SAGE_glVertexAttribs4svNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS4UBVNVPROC SAGE_glVertexAttribs4ubvNV; SAGEAPI SAGE_PFNGLTEXBUMPPARAMETERIVATIPROC SAGE_glTexBumpParameterivATI; SAGEAPI SAGE_PFNGLTEXBUMPPARAMETERFVATIPROC SAGE_glTexBumpParameterfvATI; SAGEAPI SAGE_PFNGLGETTEXBUMPPARAMETERIVATIPROC SAGE_glGetTexBumpParameterivATI; SAGEAPI SAGE_PFNGLGETTEXBUMPPARAMETERFVATIPROC SAGE_glGetTexBumpParameterfvATI; SAGEAPI SAGE_PFNGLGENFRAGMENTSHADERSATIPROC SAGE_glGenFragmentShadersATI; SAGEAPI SAGE_PFNGLBINDFRAGMENTSHADERATIPROC SAGE_glBindFragmentShaderATI; SAGEAPI SAGE_PFNGLDELETEFRAGMENTSHADERATIPROC SAGE_glDeleteFragmentShaderATI; SAGEAPI SAGE_PFNGLBEGINFRAGMENTSHADERATIPROC SAGE_glBeginFragmentShaderATI; SAGEAPI SAGE_PFNGLENDFRAGMENTSHADERATIPROC SAGE_glEndFragmentShaderATI; SAGEAPI SAGE_PFNGLPASSTEXCOORDATIPROC SAGE_glPassTexCoordATI; SAGEAPI SAGE_PFNGLSAMPLEMAPATIPROC SAGE_glSampleMapATI; SAGEAPI SAGE_PFNGLCOLORFRAGMENTOP1ATIPROC SAGE_glColorFragmentOp1ATI; SAGEAPI SAGE_PFNGLCOLORFRAGMENTOP2ATIPROC SAGE_glColorFragmentOp2ATI; SAGEAPI SAGE_PFNGLCOLORFRAGMENTOP3ATIPROC SAGE_glColorFragmentOp3ATI; SAGEAPI SAGE_PFNGLALPHAFRAGMENTOP1ATIPROC SAGE_glAlphaFragmentOp1ATI; SAGEAPI SAGE_PFNGLALPHAFRAGMENTOP2ATIPROC SAGE_glAlphaFragmentOp2ATI; SAGEAPI SAGE_PFNGLALPHAFRAGMENTOP3ATIPROC SAGE_glAlphaFragmentOp3ATI; SAGEAPI SAGE_PFNGLSETFRAGMENTSHADERCONSTANTATIPROC SAGE_glSetFragmentShaderConstantATI; SAGEAPI SAGE_PFNGLPNTRIANGLESIATIPROC SAGE_glPNTrianglesiATI; SAGEAPI SAGE_PFNGLPNTRIANGLESFATIPROC SAGE_glPNTrianglesfATI; SAGEAPI SAGE_PFNGLNEWOBJECTBUFFERATIPROC SAGE_glNewObjectBufferATI; SAGEAPI SAGE_PFNGLISOBJECTBUFFERATIPROC SAGE_glIsObjectBufferATI; SAGEAPI SAGE_PFNGLUPDATEOBJECTBUFFERATIPROC SAGE_glUpdateObjectBufferATI; SAGEAPI SAGE_PFNGLGETOBJECTBUFFERFVATIPROC SAGE_glGetObjectBufferfvATI; SAGEAPI SAGE_PFNGLGETOBJECTBUFFERIVATIPROC SAGE_glGetObjectBufferivATI; SAGEAPI SAGE_PFNGLFREEOBJECTBUFFERATIPROC SAGE_glFreeObjectBufferATI; SAGEAPI SAGE_PFNGLARRAYOBJECTATIPROC SAGE_glArrayObjectATI; SAGEAPI SAGE_PFNGLGETARRAYOBJECTFVATIPROC SAGE_glGetArrayObjectfvATI; SAGEAPI SAGE_PFNGLGETARRAYOBJECTIVATIPROC SAGE_glGetArrayObjectivATI; SAGEAPI SAGE_PFNGLVARIANTARRAYOBJECTATIPROC SAGE_glVariantArrayObjectATI; SAGEAPI SAGE_PFNGLGETVARIANTARRAYOBJECTFVATIPROC SAGE_glGetVariantArrayObjectfvATI; SAGEAPI SAGE_PFNGLGETVARIANTARRAYOBJECTIVATIPROC SAGE_glGetVariantArrayObjectivATI; SAGEAPI SAGE_PFNGLBEGINVERTEXSHADEREXTPROC SAGE_glBeginVertexShaderEXT; SAGEAPI SAGE_PFNGLENDVERTEXSHADEREXTPROC SAGE_glEndVertexShaderEXT; SAGEAPI SAGE_PFNGLBINDVERTEXSHADEREXTPROC SAGE_glBindVertexShaderEXT; SAGEAPI SAGE_PFNGLGENVERTEXSHADERSEXTPROC SAGE_glGenVertexShadersEXT; SAGEAPI SAGE_PFNGLDELETEVERTEXSHADEREXTPROC SAGE_glDeleteVertexShaderEXT; SAGEAPI SAGE_PFNGLSHADEROP1EXTPROC SAGE_glShaderOp1EXT; SAGEAPI SAGE_PFNGLSHADEROP2EXTPROC SAGE_glShaderOp2EXT; SAGEAPI SAGE_PFNGLSHADEROP3EXTPROC SAGE_glShaderOp3EXT; SAGEAPI SAGE_PFNGLSWIZZLEEXTPROC SAGE_glSwizzleEXT; SAGEAPI SAGE_PFNGLWRITEMASKEXTPROC SAGE_glWriteMaskEXT; SAGEAPI SAGE_PFNGLINSERTCOMPONENTEXTPROC SAGE_glInsertComponentEXT; SAGEAPI SAGE_PFNGLEXTRACTCOMPONENTEXTPROC SAGE_glExtractComponentEXT; SAGEAPI SAGE_PFNGLGENSYMBOLSEXTPROC SAGE_glGenSymbolsEXT; SAGEAPI SAGE_PFNGLSETINVARIANTEXTPROC SAGE_glSetInvariantEXT; SAGEAPI SAGE_PFNGLSETLOCALCONSTANTEXTPROC SAGE_glSetLocalConstantEXT; SAGEAPI SAGE_PFNGLVARIANTBVEXTPROC SAGE_glVariantbvEXT; SAGEAPI SAGE_PFNGLVARIANTSVEXTPROC SAGE_glVariantsvEXT; SAGEAPI SAGE_PFNGLVARIANTIVEXTPROC SAGE_glVariantivEXT; SAGEAPI SAGE_PFNGLVARIANTFVEXTPROC SAGE_glVariantfvEXT; SAGEAPI SAGE_PFNGLVARIANTDVEXTPROC SAGE_glVariantdvEXT; SAGEAPI SAGE_PFNGLVARIANTUBVEXTPROC SAGE_glVariantubvEXT; SAGEAPI SAGE_PFNGLVARIANTUSVEXTPROC SAGE_glVariantusvEXT; SAGEAPI SAGE_PFNGLVARIANTUIVEXTPROC SAGE_glVariantuivEXT; SAGEAPI SAGE_PFNGLVARIANTPOINTEREXTPROC SAGE_glVariantPointerEXT; SAGEAPI SAGE_PFNGLENABLEVARIANTCLIENTSTATEEXTPROC SAGE_glEnableVariantClientStateEXT; SAGEAPI SAGE_PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC SAGE_glDisableVariantClientStateEXT; SAGEAPI SAGE_PFNGLBINDLIGHTPARAMETEREXTPROC SAGE_glBindLightParameterEXT; SAGEAPI SAGE_PFNGLBINDMATERIALPARAMETEREXTPROC SAGE_glBindMaterialParameterEXT; SAGEAPI SAGE_PFNGLBINDTEXGENPARAMETEREXTPROC SAGE_glBindTexGenParameterEXT; SAGEAPI SAGE_PFNGLBINDTEXTUREUNITPARAMETEREXTPROC SAGE_glBindTextureUnitParameterEXT; SAGEAPI SAGE_PFNGLBINDPARAMETEREXTPROC SAGE_glBindParameterEXT; SAGEAPI SAGE_PFNGLISVARIANTENABLEDEXTPROC SAGE_glIsVariantEnabledEXT; SAGEAPI SAGE_PFNGLGETVARIANTBOOLEANVEXTPROC SAGE_glGetVariantBooleanvEXT; SAGEAPI SAGE_PFNGLGETVARIANTINTEGERVEXTPROC SAGE_glGetVariantIntegervEXT; SAGEAPI SAGE_PFNGLGETVARIANTFLOATVEXTPROC SAGE_glGetVariantFloatvEXT; SAGEAPI SAGE_PFNGLGETVARIANTPOINTERVEXTPROC SAGE_glGetVariantPointervEXT; SAGEAPI SAGE_PFNGLGETINVARIANTBOOLEANVEXTPROC SAGE_glGetInvariantBooleanvEXT; SAGEAPI SAGE_PFNGLGETINVARIANTINTEGERVEXTPROC SAGE_glGetInvariantIntegervEXT; SAGEAPI SAGE_PFNGLGETINVARIANTFLOATVEXTPROC SAGE_glGetInvariantFloatvEXT; SAGEAPI SAGE_PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC SAGE_glGetLocalConstantBooleanvEXT; SAGEAPI SAGE_PFNGLGETLOCALCONSTANTINTEGERVEXTPROC SAGE_glGetLocalConstantIntegervEXT; SAGEAPI SAGE_PFNGLGETLOCALCONSTANTFLOATVEXTPROC SAGE_glGetLocalConstantFloatvEXT; SAGEAPI SAGE_PFNGLVERTEXSTREAM1SATIPROC SAGE_glVertexStream1sATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM1SVATIPROC SAGE_glVertexStream1svATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM1IATIPROC SAGE_glVertexStream1iATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM1IVATIPROC SAGE_glVertexStream1ivATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM1FATIPROC SAGE_glVertexStream1fATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM1FVATIPROC SAGE_glVertexStream1fvATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM1DATIPROC SAGE_glVertexStream1dATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM1DVATIPROC SAGE_glVertexStream1dvATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM2SATIPROC SAGE_glVertexStream2sATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM2SVATIPROC SAGE_glVertexStream2svATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM2IATIPROC SAGE_glVertexStream2iATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM2IVATIPROC SAGE_glVertexStream2ivATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM2FATIPROC SAGE_glVertexStream2fATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM2FVATIPROC SAGE_glVertexStream2fvATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM2DATIPROC SAGE_glVertexStream2dATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM2DVATIPROC SAGE_glVertexStream2dvATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM3SATIPROC SAGE_glVertexStream3sATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM3SVATIPROC SAGE_glVertexStream3svATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM3IATIPROC SAGE_glVertexStream3iATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM3IVATIPROC SAGE_glVertexStream3ivATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM3FATIPROC SAGE_glVertexStream3fATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM3FVATIPROC SAGE_glVertexStream3fvATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM3DATIPROC SAGE_glVertexStream3dATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM3DVATIPROC SAGE_glVertexStream3dvATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM4SATIPROC SAGE_glVertexStream4sATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM4SVATIPROC SAGE_glVertexStream4svATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM4IATIPROC SAGE_glVertexStream4iATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM4IVATIPROC SAGE_glVertexStream4ivATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM4FATIPROC SAGE_glVertexStream4fATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM4FVATIPROC SAGE_glVertexStream4fvATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM4DATIPROC SAGE_glVertexStream4dATI; SAGEAPI SAGE_PFNGLVERTEXSTREAM4DVATIPROC SAGE_glVertexStream4dvATI; SAGEAPI SAGE_PFNGLNORMALSTREAM3BATIPROC SAGE_glNormalStream3bATI; SAGEAPI SAGE_PFNGLNORMALSTREAM3BVATIPROC SAGE_glNormalStream3bvATI; SAGEAPI SAGE_PFNGLNORMALSTREAM3SATIPROC SAGE_glNormalStream3sATI; SAGEAPI SAGE_PFNGLNORMALSTREAM3SVATIPROC SAGE_glNormalStream3svATI; SAGEAPI SAGE_PFNGLNORMALSTREAM3IATIPROC SAGE_glNormalStream3iATI; SAGEAPI SAGE_PFNGLNORMALSTREAM3IVATIPROC SAGE_glNormalStream3ivATI; SAGEAPI SAGE_PFNGLNORMALSTREAM3FATIPROC SAGE_glNormalStream3fATI; SAGEAPI SAGE_PFNGLNORMALSTREAM3FVATIPROC SAGE_glNormalStream3fvATI; SAGEAPI SAGE_PFNGLNORMALSTREAM3DATIPROC SAGE_glNormalStream3dATI; SAGEAPI SAGE_PFNGLNORMALSTREAM3DVATIPROC SAGE_glNormalStream3dvATI; SAGEAPI SAGE_PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC SAGE_glClientActiveVertexStreamATI; SAGEAPI SAGE_PFNGLVERTEXBLENDENVIATIPROC SAGE_glVertexBlendEnviATI; SAGEAPI SAGE_PFNGLVERTEXBLENDENVFATIPROC SAGE_glVertexBlendEnvfATI; SAGEAPI SAGE_PFNGLELEMENTPOINTERATIPROC SAGE_glElementPointerATI; SAGEAPI SAGE_PFNGLDRAWELEMENTARRAYATIPROC SAGE_glDrawElementArrayATI; SAGEAPI SAGE_PFNGLDRAWRANGEELEMENTARRAYATIPROC SAGE_glDrawRangeElementArrayATI; SAGEAPI SAGE_PFNGLDRAWMESHARRAYSSUNPROC SAGE_glDrawMeshArraysSUN; SAGEAPI SAGE_PFNGLGENOCCLUSIONQUERIESNVPROC SAGE_glGenOcclusionQueriesNV; SAGEAPI SAGE_PFNGLDELETEOCCLUSIONQUERIESNVPROC SAGE_glDeleteOcclusionQueriesNV; SAGEAPI SAGE_PFNGLISOCCLUSIONQUERYNVPROC SAGE_glIsOcclusionQueryNV; SAGEAPI SAGE_PFNGLBEGINOCCLUSIONQUERYNVPROC SAGE_glBeginOcclusionQueryNV; SAGEAPI SAGE_PFNGLENDOCCLUSIONQUERYNVPROC SAGE_glEndOcclusionQueryNV; SAGEAPI SAGE_PFNGLGETOCCLUSIONQUERYIVNVPROC SAGE_glGetOcclusionQueryivNV; SAGEAPI SAGE_PFNGLGETOCCLUSIONQUERYUIVNVPROC SAGE_glGetOcclusionQueryuivNV; SAGEAPI SAGE_PFNGLPOINTPARAMETERINVPROC SAGE_glPointParameteriNV; SAGEAPI SAGE_PFNGLPOINTPARAMETERIVNVPROC SAGE_glPointParameterivNV; SAGEAPI SAGE_PFNGLACTIVESTENCILFACEEXTPROC SAGE_glActiveStencilFaceEXT; SAGEAPI SAGE_PFNGLELEMENTPOINTERAPPLEPROC SAGE_glElementPointerAPPLE; SAGEAPI SAGE_PFNGLDRAWELEMENTARRAYAPPLEPROC SAGE_glDrawElementArrayAPPLE; SAGEAPI SAGE_PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC SAGE_glDrawRangeElementArrayAPPLE; SAGEAPI SAGE_PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC SAGE_glMultiDrawElementArrayAPPLE; SAGEAPI SAGE_PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC SAGE_glMultiDrawRangeElementArrayAPPLE; SAGEAPI SAGE_PFNGLGENFENCESAPPLEPROC SAGE_glGenFencesAPPLE; SAGEAPI SAGE_PFNGLDELETEFENCESAPPLEPROC SAGE_glDeleteFencesAPPLE; SAGEAPI SAGE_PFNGLSETFENCEAPPLEPROC SAGE_glSetFenceAPPLE; SAGEAPI SAGE_PFNGLISFENCEAPPLEPROC SAGE_glIsFenceAPPLE; SAGEAPI SAGE_PFNGLTESTFENCEAPPLEPROC SAGE_glTestFenceAPPLE; SAGEAPI SAGE_PFNGLFINISHFENCEAPPLEPROC SAGE_glFinishFenceAPPLE; SAGEAPI SAGE_PFNGLTESTOBJECTAPPLEPROC SAGE_glTestObjectAPPLE; SAGEAPI SAGE_PFNGLFINISHOBJECTAPPLEPROC SAGE_glFinishObjectAPPLE; SAGEAPI SAGE_PFNGLBINDVERTEXARRAYAPPLEPROC SAGE_glBindVertexArrayAPPLE; SAGEAPI SAGE_PFNGLDELETEVERTEXARRAYSAPPLEPROC SAGE_glDeleteVertexArraysAPPLE; SAGEAPI SAGE_PFNGLGENVERTEXARRAYSAPPLEPROC SAGE_glGenVertexArraysAPPLE; SAGEAPI SAGE_PFNGLISVERTEXARRAYAPPLEPROC SAGE_glIsVertexArrayAPPLE; SAGEAPI SAGE_PFNGLVERTEXARRAYRANGEAPPLEPROC SAGE_glVertexArrayRangeAPPLE; SAGEAPI SAGE_PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC SAGE_glFlushVertexArrayRangeAPPLE; SAGEAPI SAGE_PFNGLVERTEXARRAYPARAMETERIAPPLEPROC SAGE_glVertexArrayParameteriAPPLE; SAGEAPI SAGE_PFNGLDRAWBUFFERSATIPROC SAGE_glDrawBuffersATI; SAGEAPI SAGE_PFNGLPROGRAMNAMEDPARAMETER4FNVPROC SAGE_glProgramNamedParameter4fNV; SAGEAPI SAGE_PFNGLPROGRAMNAMEDPARAMETER4DNVPROC SAGE_glProgramNamedParameter4dNV; SAGEAPI SAGE_PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC SAGE_glProgramNamedParameter4fvNV; SAGEAPI SAGE_PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC SAGE_glProgramNamedParameter4dvNV; SAGEAPI SAGE_PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC SAGE_glGetProgramNamedParameterfvNV; SAGEAPI SAGE_PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC SAGE_glGetProgramNamedParameterdvNV; SAGEAPI SAGE_PFNGLVERTEX2HNVPROC SAGE_glVertex2hNV; SAGEAPI SAGE_PFNGLVERTEX2HVNVPROC SAGE_glVertex2hvNV; SAGEAPI SAGE_PFNGLVERTEX3HNVPROC SAGE_glVertex3hNV; SAGEAPI SAGE_PFNGLVERTEX3HVNVPROC SAGE_glVertex3hvNV; SAGEAPI SAGE_PFNGLVERTEX4HNVPROC SAGE_glVertex4hNV; SAGEAPI SAGE_PFNGLVERTEX4HVNVPROC SAGE_glVertex4hvNV; SAGEAPI SAGE_PFNGLNORMAL3HNVPROC SAGE_glNormal3hNV; SAGEAPI SAGE_PFNGLNORMAL3HVNVPROC SAGE_glNormal3hvNV; SAGEAPI SAGE_PFNGLCOLOR3HNVPROC SAGE_glColor3hNV; SAGEAPI SAGE_PFNGLCOLOR3HVNVPROC SAGE_glColor3hvNV; SAGEAPI SAGE_PFNGLCOLOR4HNVPROC SAGE_glColor4hNV; SAGEAPI SAGE_PFNGLCOLOR4HVNVPROC SAGE_glColor4hvNV; SAGEAPI SAGE_PFNGLTEXCOORD1HNVPROC SAGE_glTexCoord1hNV; SAGEAPI SAGE_PFNGLTEXCOORD1HVNVPROC SAGE_glTexCoord1hvNV; SAGEAPI SAGE_PFNGLTEXCOORD2HNVPROC SAGE_glTexCoord2hNV; SAGEAPI SAGE_PFNGLTEXCOORD2HVNVPROC SAGE_glTexCoord2hvNV; SAGEAPI SAGE_PFNGLTEXCOORD3HNVPROC SAGE_glTexCoord3hNV; SAGEAPI SAGE_PFNGLTEXCOORD3HVNVPROC SAGE_glTexCoord3hvNV; SAGEAPI SAGE_PFNGLTEXCOORD4HNVPROC SAGE_glTexCoord4hNV; SAGEAPI SAGE_PFNGLTEXCOORD4HVNVPROC SAGE_glTexCoord4hvNV; SAGEAPI SAGE_PFNGLMULTITEXCOORD1HNVPROC SAGE_glMultiTexCoord1hNV; SAGEAPI SAGE_PFNGLMULTITEXCOORD1HVNVPROC SAGE_glMultiTexCoord1hvNV; SAGEAPI SAGE_PFNGLMULTITEXCOORD2HNVPROC SAGE_glMultiTexCoord2hNV; SAGEAPI SAGE_PFNGLMULTITEXCOORD2HVNVPROC SAGE_glMultiTexCoord2hvNV; SAGEAPI SAGE_PFNGLMULTITEXCOORD3HNVPROC SAGE_glMultiTexCoord3hNV; SAGEAPI SAGE_PFNGLMULTITEXCOORD3HVNVPROC SAGE_glMultiTexCoord3hvNV; SAGEAPI SAGE_PFNGLMULTITEXCOORD4HNVPROC SAGE_glMultiTexCoord4hNV; SAGEAPI SAGE_PFNGLMULTITEXCOORD4HVNVPROC SAGE_glMultiTexCoord4hvNV; SAGEAPI SAGE_PFNGLFOGCOORDHNVPROC SAGE_glFogCoordhNV; SAGEAPI SAGE_PFNGLFOGCOORDHVNVPROC SAGE_glFogCoordhvNV; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3HNVPROC SAGE_glSecondaryColor3hNV; SAGEAPI SAGE_PFNGLSECONDARYCOLOR3HVNVPROC SAGE_glSecondaryColor3hvNV; SAGEAPI SAGE_PFNGLVERTEXWEIGHTHNVPROC SAGE_glVertexWeighthNV; SAGEAPI SAGE_PFNGLVERTEXWEIGHTHVNVPROC SAGE_glVertexWeighthvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB1HNVPROC SAGE_glVertexAttrib1hNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB1HVNVPROC SAGE_glVertexAttrib1hvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB2HNVPROC SAGE_glVertexAttrib2hNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB2HVNVPROC SAGE_glVertexAttrib2hvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB3HNVPROC SAGE_glVertexAttrib3hNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB3HVNVPROC SAGE_glVertexAttrib3hvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB4HNVPROC SAGE_glVertexAttrib4hNV; SAGEAPI SAGE_PFNGLVERTEXATTRIB4HVNVPROC SAGE_glVertexAttrib4hvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS1HVNVPROC SAGE_glVertexAttribs1hvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS2HVNVPROC SAGE_glVertexAttribs2hvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS3HVNVPROC SAGE_glVertexAttribs3hvNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBS4HVNVPROC SAGE_glVertexAttribs4hvNV; SAGEAPI SAGE_PFNGLPIXELDATARANGENVPROC SAGE_glPixelDataRangeNV; SAGEAPI SAGE_PFNGLFLUSHPIXELDATARANGENVPROC SAGE_glFlushPixelDataRangeNV; SAGEAPI SAGE_PFNGLPRIMITIVERESTARTNVPROC SAGE_glPrimitiveRestartNV; SAGEAPI SAGE_PFNGLPRIMITIVERESTARTINDEXNVPROC SAGE_glPrimitiveRestartIndexNV; SAGEAPI SAGE_PFNGLMAPOBJECTBUFFERATIPROC SAGE_glMapObjectBufferATI; SAGEAPI SAGE_PFNGLUNMAPOBJECTBUFFERATIPROC SAGE_glUnmapObjectBufferATI; SAGEAPI SAGE_PFNGLSTENCILOPSEPARATEATIPROC SAGE_glStencilOpSeparateATI; SAGEAPI SAGE_PFNGLSTENCILFUNCSEPARATEATIPROC SAGE_glStencilFuncSeparateATI; SAGEAPI SAGE_PFNGLVERTEXATTRIBARRAYOBJECTATIPROC SAGE_glVertexAttribArrayObjectATI; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC SAGE_glGetVertexAttribArrayObjectfvATI; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC SAGE_glGetVertexAttribArrayObjectivATI; SAGEAPI SAGE_PFNGLDEPTHBOUNDSEXTPROC SAGE_glDepthBoundsEXT; SAGEAPI SAGE_PFNGLBLENDEQUATIONSEPARATEEXTPROC SAGE_glBlendEquationSeparateEXT; SAGEAPI SAGE_PFNGLISRENDERBUFFEREXTPROC SAGE_glIsRenderbufferEXT; SAGEAPI SAGE_PFNGLBINDRENDERBUFFEREXTPROC SAGE_glBindRenderbufferEXT; SAGEAPI SAGE_PFNGLDELETERENDERBUFFERSEXTPROC SAGE_glDeleteRenderbuffersEXT; SAGEAPI SAGE_PFNGLGENRENDERBUFFERSEXTPROC SAGE_glGenRenderbuffersEXT; SAGEAPI SAGE_PFNGLRENDERBUFFERSTORAGEEXTPROC SAGE_glRenderbufferStorageEXT; SAGEAPI SAGE_PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC SAGE_glGetRenderbufferParameterivEXT; SAGEAPI SAGE_PFNGLISFRAMEBUFFEREXTPROC SAGE_glIsFramebufferEXT; SAGEAPI SAGE_PFNGLBINDFRAMEBUFFEREXTPROC SAGE_glBindFramebufferEXT; SAGEAPI SAGE_PFNGLDELETEFRAMEBUFFERSEXTPROC SAGE_glDeleteFramebuffersEXT; SAGEAPI SAGE_PFNGLGENFRAMEBUFFERSEXTPROC SAGE_glGenFramebuffersEXT; SAGEAPI SAGE_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC SAGE_glCheckFramebufferStatusEXT; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTURE1DEXTPROC SAGE_glFramebufferTexture1DEXT; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC SAGE_glFramebufferTexture2DEXT; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTURE3DEXTPROC SAGE_glFramebufferTexture3DEXT; SAGEAPI SAGE_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC SAGE_glFramebufferRenderbufferEXT; SAGEAPI SAGE_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC SAGE_glGetFramebufferAttachmentParameterivEXT; SAGEAPI SAGE_PFNGLGENERATEMIPMAPEXTPROC SAGE_glGenerateMipmapEXT; SAGEAPI SAGE_PFNGLSTRINGMARKERGREMEDYPROC SAGE_glStringMarkerGREMEDY; SAGEAPI SAGE_PFNGLSTENCILCLEARTAGEXTPROC SAGE_glStencilClearTagEXT; SAGEAPI SAGE_PFNGLBLITFRAMEBUFFEREXTPROC SAGE_glBlitFramebufferEXT; SAGEAPI SAGE_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC SAGE_glRenderbufferStorageMultisampleEXT; SAGEAPI SAGE_PFNGLGETQUERYOBJECTI64VEXTPROC SAGE_glGetQueryObjecti64vEXT; SAGEAPI SAGE_PFNGLGETQUERYOBJECTUI64VEXTPROC SAGE_glGetQueryObjectui64vEXT; SAGEAPI SAGE_PFNGLPROGRAMENVPARAMETERS4FVEXTPROC SAGE_glProgramEnvParameters4fvEXT; SAGEAPI SAGE_PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC SAGE_glProgramLocalParameters4fvEXT; SAGEAPI SAGE_PFNGLBUFFERPARAMETERIAPPLEPROC SAGE_glBufferParameteriAPPLE; SAGEAPI SAGE_PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC SAGE_glFlushMappedBufferRangeAPPLE; SAGEAPI SAGE_PFNGLPROGRAMLOCALPARAMETERI4INVPROC SAGE_glProgramLocalParameterI4iNV; SAGEAPI SAGE_PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC SAGE_glProgramLocalParameterI4ivNV; SAGEAPI SAGE_PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC SAGE_glProgramLocalParametersI4ivNV; SAGEAPI SAGE_PFNGLPROGRAMLOCALPARAMETERI4UINVPROC SAGE_glProgramLocalParameterI4uiNV; SAGEAPI SAGE_PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC SAGE_glProgramLocalParameterI4uivNV; SAGEAPI SAGE_PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC SAGE_glProgramLocalParametersI4uivNV; SAGEAPI SAGE_PFNGLPROGRAMENVPARAMETERI4INVPROC SAGE_glProgramEnvParameterI4iNV; SAGEAPI SAGE_PFNGLPROGRAMENVPARAMETERI4IVNVPROC SAGE_glProgramEnvParameterI4ivNV; SAGEAPI SAGE_PFNGLPROGRAMENVPARAMETERSI4IVNVPROC SAGE_glProgramEnvParametersI4ivNV; SAGEAPI SAGE_PFNGLPROGRAMENVPARAMETERI4UINVPROC SAGE_glProgramEnvParameterI4uiNV; SAGEAPI SAGE_PFNGLPROGRAMENVPARAMETERI4UIVNVPROC SAGE_glProgramEnvParameterI4uivNV; SAGEAPI SAGE_PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC SAGE_glProgramEnvParametersI4uivNV; SAGEAPI SAGE_PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC SAGE_glGetProgramLocalParameterIivNV; SAGEAPI SAGE_PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC SAGE_glGetProgramLocalParameterIuivNV; SAGEAPI SAGE_PFNGLGETPROGRAMENVPARAMETERIIVNVPROC SAGE_glGetProgramEnvParameterIivNV; SAGEAPI SAGE_PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC SAGE_glGetProgramEnvParameterIuivNV; SAGEAPI SAGE_PFNGLPROGRAMVERTEXLIMITNVPROC SAGE_glProgramVertexLimitNV; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTUREEXTPROC SAGE_glFramebufferTextureEXT; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC SAGE_glFramebufferTextureLayerEXT; SAGEAPI SAGE_PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC SAGE_glFramebufferTextureFaceEXT; SAGEAPI SAGE_PFNGLPROGRAMPARAMETERIEXTPROC SAGE_glProgramParameteriEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI1IEXTPROC SAGE_glVertexAttribI1iEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI2IEXTPROC SAGE_glVertexAttribI2iEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI3IEXTPROC SAGE_glVertexAttribI3iEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4IEXTPROC SAGE_glVertexAttribI4iEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI1UIEXTPROC SAGE_glVertexAttribI1uiEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI2UIEXTPROC SAGE_glVertexAttribI2uiEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI3UIEXTPROC SAGE_glVertexAttribI3uiEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4UIEXTPROC SAGE_glVertexAttribI4uiEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI1IVEXTPROC SAGE_glVertexAttribI1ivEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI2IVEXTPROC SAGE_glVertexAttribI2ivEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI3IVEXTPROC SAGE_glVertexAttribI3ivEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4IVEXTPROC SAGE_glVertexAttribI4ivEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI1UIVEXTPROC SAGE_glVertexAttribI1uivEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI2UIVEXTPROC SAGE_glVertexAttribI2uivEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI3UIVEXTPROC SAGE_glVertexAttribI3uivEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4UIVEXTPROC SAGE_glVertexAttribI4uivEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4BVEXTPROC SAGE_glVertexAttribI4bvEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4SVEXTPROC SAGE_glVertexAttribI4svEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4UBVEXTPROC SAGE_glVertexAttribI4ubvEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBI4USVEXTPROC SAGE_glVertexAttribI4usvEXT; SAGEAPI SAGE_PFNGLVERTEXATTRIBIPOINTEREXTPROC SAGE_glVertexAttribIPointerEXT; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBIIVEXTPROC SAGE_glGetVertexAttribIivEXT; SAGEAPI SAGE_PFNGLGETVERTEXATTRIBIUIVEXTPROC SAGE_glGetVertexAttribIuivEXT; SAGEAPI SAGE_PFNGLGETUNIFORMUIVEXTPROC SAGE_glGetUniformuivEXT; SAGEAPI SAGE_PFNGLBINDFRAGDATALOCATIONEXTPROC SAGE_glBindFragDataLocationEXT; SAGEAPI SAGE_PFNGLGETFRAGDATALOCATIONEXTPROC SAGE_glGetFragDataLocationEXT; SAGEAPI SAGE_PFNGLUNIFORM1UIEXTPROC SAGE_glUniform1uiEXT; SAGEAPI SAGE_PFNGLUNIFORM2UIEXTPROC SAGE_glUniform2uiEXT; SAGEAPI SAGE_PFNGLUNIFORM3UIEXTPROC SAGE_glUniform3uiEXT; SAGEAPI SAGE_PFNGLUNIFORM4UIEXTPROC SAGE_glUniform4uiEXT; SAGEAPI SAGE_PFNGLUNIFORM1UIVEXTPROC SAGE_glUniform1uivEXT; SAGEAPI SAGE_PFNGLUNIFORM2UIVEXTPROC SAGE_glUniform2uivEXT; SAGEAPI SAGE_PFNGLUNIFORM3UIVEXTPROC SAGE_glUniform3uivEXT; SAGEAPI SAGE_PFNGLUNIFORM4UIVEXTPROC SAGE_glUniform4uivEXT; SAGEAPI SAGE_PFNGLDRAWARRAYSINSTANCEDEXTPROC SAGE_glDrawArraysInstancedEXT; SAGEAPI SAGE_PFNGLDRAWELEMENTSINSTANCEDEXTPROC SAGE_glDrawElementsInstancedEXT; SAGEAPI SAGE_PFNGLTEXBUFFEREXTPROC SAGE_glTexBufferEXT; SAGEAPI SAGE_PFNGLDEPTHRANGEDNVPROC SAGE_glDepthRangedNV; SAGEAPI SAGE_PFNGLCLEARDEPTHDNVPROC SAGE_glClearDepthdNV; SAGEAPI SAGE_PFNGLDEPTHBOUNDSDNVPROC SAGE_glDepthBoundsdNV; SAGEAPI SAGE_PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC SAGE_glRenderbufferStorageMultisampleCoverageNV; SAGEAPI SAGE_PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC SAGE_glProgramBufferParametersfvNV; SAGEAPI SAGE_PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC SAGE_glProgramBufferParametersIivNV; SAGEAPI SAGE_PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC SAGE_glProgramBufferParametersIuivNV; SAGEAPI SAGE_PFNGLCOLORMASKINDEXEDEXTPROC SAGE_glColorMaskIndexedEXT; SAGEAPI SAGE_PFNGLGETBOOLEANINDEXEDVEXTPROC SAGE_glGetBooleanIndexedvEXT; SAGEAPI SAGE_PFNGLGETINTEGERINDEXEDVEXTPROC SAGE_glGetIntegerIndexedvEXT; SAGEAPI SAGE_PFNGLENABLEINDEXEDEXTPROC SAGE_glEnableIndexedEXT; SAGEAPI SAGE_PFNGLDISABLEINDEXEDEXTPROC SAGE_glDisableIndexedEXT; SAGEAPI SAGE_PFNGLISENABLEDINDEXEDEXTPROC SAGE_glIsEnabledIndexedEXT; SAGEAPI SAGE_PFNGLBEGINTRANSFORMFEEDBACKNVPROC SAGE_glBeginTransformFeedbackNV; SAGEAPI SAGE_PFNGLENDTRANSFORMFEEDBACKNVPROC SAGE_glEndTransformFeedbackNV; SAGEAPI SAGE_PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC SAGE_glTransformFeedbackAttribsNV; SAGEAPI SAGE_PFNGLBINDBUFFERRANGENVPROC SAGE_glBindBufferRangeNV; SAGEAPI SAGE_PFNGLBINDBUFFEROFFSETNVPROC SAGE_glBindBufferOffsetNV; SAGEAPI SAGE_PFNGLBINDBUFFERBASENVPROC SAGE_glBindBufferBaseNV; SAGEAPI SAGE_PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC SAGE_glTransformFeedbackVaryingsNV; SAGEAPI SAGE_PFNGLACTIVEVARYINGNVPROC SAGE_glActiveVaryingNV; SAGEAPI SAGE_PFNGLGETVARYINGLOCATIONNVPROC SAGE_glGetVaryingLocationNV; SAGEAPI SAGE_PFNGLGETACTIVEVARYINGNVPROC SAGE_glGetActiveVaryingNV; SAGEAPI SAGE_PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC SAGE_glGetTransformFeedbackVaryingNV; SAGEAPI SAGE_PFNGLUNIFORMBUFFEREXTPROC SAGE_glUniformBufferEXT; SAGEAPI SAGE_PFNGLGETUNIFORMBUFFERSIZEEXTPROC SAGE_glGetUniformBufferSizeEXT; SAGEAPI SAGE_PFNGLGETUNIFORMOFFSETEXTPROC SAGE_glGetUniformOffsetEXT; SAGEAPI SAGE_PFNGLTEXPARAMETERIIVEXTPROC SAGE_glTexParameterIivEXT; SAGEAPI SAGE_PFNGLTEXPARAMETERIUIVEXTPROC SAGE_glTexParameterIuivEXT; SAGEAPI SAGE_PFNGLGETTEXPARAMETERIIVEXTPROC SAGE_glGetTexParameterIivEXT; SAGEAPI SAGE_PFNGLGETTEXPARAMETERIUIVEXTPROC SAGE_glGetTexParameterIuivEXT; SAGEAPI SAGE_PFNGLCLEARCOLORIIEXTPROC SAGE_glClearColorIiEXT; SAGEAPI SAGE_PFNGLCLEARCOLORIUIEXTPROC SAGE_glClearColorIuiEXT; SAGEAPI SAGE_PFNGLFRAMETERMINATORGREMEDYPROC SAGE_glFrameTerminatorGREMEDY; SAGEAPI SAGE_PFNGLBEGINCONDITIONALRENDERNVPROC SAGE_glBeginConditionalRenderNV; SAGEAPI SAGE_PFNGLENDCONDITIONALRENDERNVPROC SAGE_glEndConditionalRenderNV; SAGEAPI SAGE_PFNGLPRESENTFRAMEKEYEDNVPROC SAGE_glPresentFrameKeyedNV; SAGEAPI SAGE_PFNGLPRESENTFRAMEDUALFILLNVPROC SAGE_glPresentFrameDualFillNV; SAGEAPI SAGE_PFNGLGETVIDEOIVNVPROC SAGE_glGetVideoivNV; SAGEAPI SAGE_PFNGLGETVIDEOUIVNVPROC SAGE_glGetVideouivNV; SAGEAPI SAGE_PFNGLGETVIDEOI64VNVPROC SAGE_glGetVideoi64vNV; SAGEAPI SAGE_PFNGLGETVIDEOUI64VNVPROC SAGE_glGetVideoui64vNV; SAGEAPI SAGE_PFNGLBEGINTRANSFORMFEEDBACKEXTPROC SAGE_glBeginTransformFeedbackEXT; SAGEAPI SAGE_PFNGLENDTRANSFORMFEEDBACKEXTPROC SAGE_glEndTransformFeedbackEXT; SAGEAPI SAGE_PFNGLBINDBUFFERRANGEEXTPROC SAGE_glBindBufferRangeEXT; SAGEAPI SAGE_PFNGLBINDBUFFEROFFSETEXTPROC SAGE_glBindBufferOffsetEXT; SAGEAPI SAGE_PFNGLBINDBUFFERBASEEXTPROC SAGE_glBindBufferBaseEXT; SAGEAPI SAGE_PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC SAGE_glTransformFeedbackVaryingsEXT; SAGEAPI SAGE_PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC SAGE_glGetTransformFeedbackVaryingEXT; SAGEAPI SAGE_PFNGLCLIENTATTRIBDEFAULTEXTPROC SAGE_glClientAttribDefaultEXT; SAGEAPI SAGE_PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC SAGE_glPushClientAttribDefaultEXT; SAGEAPI SAGE_PFNGLMATRIXLOADFEXTPROC SAGE_glMatrixLoadfEXT; SAGEAPI SAGE_PFNGLMATRIXLOADDEXTPROC SAGE_glMatrixLoaddEXT; SAGEAPI SAGE_PFNGLMATRIXMULTFEXTPROC SAGE_glMatrixMultfEXT; SAGEAPI SAGE_PFNGLMATRIXMULTDEXTPROC SAGE_glMatrixMultdEXT; SAGEAPI SAGE_PFNGLMATRIXLOADIDENTITYEXTPROC SAGE_glMatrixLoadIdentityEXT; SAGEAPI SAGE_PFNGLMATRIXROTATEFEXTPROC SAGE_glMatrixRotatefEXT; SAGEAPI SAGE_PFNGLMATRIXROTATEDEXTPROC SAGE_glMatrixRotatedEXT; SAGEAPI SAGE_PFNGLMATRIXSCALEFEXTPROC SAGE_glMatrixScalefEXT; SAGEAPI SAGE_PFNGLMATRIXSCALEDEXTPROC SAGE_glMatrixScaledEXT; SAGEAPI SAGE_PFNGLMATRIXTRANSLATEFEXTPROC SAGE_glMatrixTranslatefEXT; SAGEAPI SAGE_PFNGLMATRIXTRANSLATEDEXTPROC SAGE_glMatrixTranslatedEXT; SAGEAPI SAGE_PFNGLMATRIXFRUSTUMEXTPROC SAGE_glMatrixFrustumEXT; SAGEAPI SAGE_PFNGLMATRIXORTHOEXTPROC SAGE_glMatrixOrthoEXT; SAGEAPI SAGE_PFNGLMATRIXPOPEXTPROC SAGE_glMatrixPopEXT; SAGEAPI SAGE_PFNGLMATRIXPUSHEXTPROC SAGE_glMatrixPushEXT; SAGEAPI SAGE_PFNGLMATRIXLOADTRANSPOSEFEXTPROC SAGE_glMatrixLoadTransposefEXT; SAGEAPI SAGE_PFNGLMATRIXLOADTRANSPOSEDEXTPROC SAGE_glMatrixLoadTransposedEXT; SAGEAPI SAGE_PFNGLMATRIXMULTTRANSPOSEFEXTPROC SAGE_glMatrixMultTransposefEXT; SAGEAPI SAGE_PFNGLMATRIXMULTTRANSPOSEDEXTPROC SAGE_glMatrixMultTransposedEXT; SAGEAPI SAGE_PFNGLTEXTUREPARAMETERFEXTPROC SAGE_glTextureParameterfEXT; SAGEAPI SAGE_PFNGLTEXTUREPARAMETERFVEXTPROC SAGE_glTextureParameterfvEXT; SAGEAPI SAGE_PFNGLTEXTUREPARAMETERIEXTPROC SAGE_glTextureParameteriEXT; SAGEAPI SAGE_PFNGLTEXTUREPARAMETERIVEXTPROC SAGE_glTextureParameterivEXT; SAGEAPI SAGE_PFNGLTEXTUREIMAGE1DEXTPROC SAGE_glTextureImage1DEXT; SAGEAPI SAGE_PFNGLTEXTUREIMAGE2DEXTPROC SAGE_glTextureImage2DEXT; SAGEAPI SAGE_PFNGLTEXTURESUBIMAGE1DEXTPROC SAGE_glTextureSubImage1DEXT; SAGEAPI SAGE_PFNGLTEXTURESUBIMAGE2DEXTPROC SAGE_glTextureSubImage2DEXT; SAGEAPI SAGE_PFNGLCOPYTEXTUREIMAGE1DEXTPROC SAGE_glCopyTextureImage1DEXT; SAGEAPI SAGE_PFNGLCOPYTEXTUREIMAGE2DEXTPROC SAGE_glCopyTextureImage2DEXT; SAGEAPI SAGE_PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC SAGE_glCopyTextureSubImage1DEXT; SAGEAPI SAGE_PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC SAGE_glCopyTextureSubImage2DEXT; SAGEAPI SAGE_PFNGLGETTEXTUREIMAGEEXTPROC SAGE_glGetTextureImageEXT; SAGEAPI SAGE_PFNGLGETTEXTUREPARAMETERFVEXTPROC SAGE_glGetTextureParameterfvEXT; SAGEAPI SAGE_PFNGLGETTEXTUREPARAMETERIVEXTPROC SAGE_glGetTextureParameterivEXT; SAGEAPI SAGE_PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC SAGE_glGetTextureLevelParameterfvEXT; SAGEAPI SAGE_PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC SAGE_glGetTextureLevelParameterivEXT; SAGEAPI SAGE_PFNGLTEXTUREIMAGE3DEXTPROC SAGE_glTextureImage3DEXT; SAGEAPI SAGE_PFNGLTEXTURESUBIMAGE3DEXTPROC SAGE_glTextureSubImage3DEXT; SAGEAPI SAGE_PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC SAGE_glCopyTextureSubImage3DEXT; SAGEAPI SAGE_PFNGLMULTITEXPARAMETERFEXTPROC SAGE_glMultiTexParameterfEXT; SAGEAPI SAGE_PFNGLMULTITEXPARAMETERFVEXTPROC SAGE_glMultiTexParameterfvEXT; SAGEAPI SAGE_PFNGLMULTITEXPARAMETERIEXTPROC SAGE_glMultiTexParameteriEXT; SAGEAPI SAGE_PFNGLMULTITEXPARAMETERIVEXTPROC SAGE_glMultiTexParameterivEXT; SAGEAPI SAGE_PFNGLMULTITEXIMAGE1DEXTPROC SAGE_glMultiTexImage1DEXT; SAGEAPI SAGE_PFNGLMULTITEXIMAGE2DEXTPROC SAGE_glMultiTexImage2DEXT; SAGEAPI SAGE_PFNGLMULTITEXSUBIMAGE1DEXTPROC SAGE_glMultiTexSubImage1DEXT; SAGEAPI SAGE_PFNGLMULTITEXSUBIMAGE2DEXTPROC SAGE_glMultiTexSubImage2DEXT; SAGEAPI SAGE_PFNGLCOPYMULTITEXIMAGE1DEXTPROC SAGE_glCopyMultiTexImage1DEXT; SAGEAPI SAGE_PFNGLCOPYMULTITEXIMAGE2DEXTPROC SAGE_glCopyMultiTexImage2DEXT; SAGEAPI SAGE_PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC SAGE_glCopyMultiTexSubImage1DEXT; SAGEAPI SAGE_PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC SAGE_glCopyMultiTexSubImage2DEXT; SAGEAPI SAGE_PFNGLGETMULTITEXIMAGEEXTPROC SAGE_glGetMultiTexImageEXT; SAGEAPI SAGE_PFNGLGETMULTITEXPARAMETERFVEXTPROC SAGE_glGetMultiTexParameterfvEXT; SAGEAPI SAGE_PFNGLGETMULTITEXPARAMETERIVEXTPROC SAGE_glGetMultiTexParameterivEXT; SAGEAPI SAGE_PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC SAGE_glGetMultiTexLevelParameterfvEXT; SAGEAPI SAGE_PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC SAGE_glGetMultiTexLevelParameterivEXT; SAGEAPI SAGE_PFNGLMULTITEXIMAGE3DEXTPROC SAGE_glMultiTexImage3DEXT; SAGEAPI SAGE_PFNGLMULTITEXSUBIMAGE3DEXTPROC SAGE_glMultiTexSubImage3DEXT; SAGEAPI SAGE_PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC SAGE_glCopyMultiTexSubImage3DEXT; SAGEAPI SAGE_PFNGLBINDMULTITEXTUREEXTPROC SAGE_glBindMultiTextureEXT; SAGEAPI SAGE_PFNGLENABLECLIENTSTATEINDEXEDEXTPROC SAGE_glEnableClientStateIndexedEXT; SAGEAPI SAGE_PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC SAGE_glDisableClientStateIndexedEXT; SAGEAPI SAGE_PFNGLMULTITEXCOORDPOINTEREXTPROC SAGE_glMultiTexCoordPointerEXT; SAGEAPI SAGE_PFNGLMULTITEXENVFEXTPROC SAGE_glMultiTexEnvfEXT; SAGEAPI SAGE_PFNGLMULTITEXENVFVEXTPROC SAGE_glMultiTexEnvfvEXT; SAGEAPI SAGE_PFNGLMULTITEXENVIEXTPROC SAGE_glMultiTexEnviEXT; SAGEAPI SAGE_PFNGLMULTITEXENVIVEXTPROC SAGE_glMultiTexEnvivEXT; SAGEAPI SAGE_PFNGLMULTITEXGENDEXTPROC SAGE_glMultiTexGendEXT; SAGEAPI SAGE_PFNGLMULTITEXGENDVEXTPROC SAGE_glMultiTexGendvEXT; SAGEAPI SAGE_PFNGLMULTITEXGENFEXTPROC SAGE_glMultiTexGenfEXT; SAGEAPI SAGE_PFNGLMULTITEXGENFVEXTPROC SAGE_glMultiTexGenfvEXT; SAGEAPI SAGE_PFNGLMULTITEXGENIEXTPROC SAGE_glMultiTexGeniEXT; SAGEAPI SAGE_PFNGLMULTITEXGENIVEXTPROC SAGE_glMultiTexGenivEXT; SAGEAPI SAGE_PFNGLGETMULTITEXENVFVEXTPROC SAGE_glGetMultiTexEnvfvEXT; SAGEAPI SAGE_PFNGLGETMULTITEXENVIVEXTPROC SAGE_glGetMultiTexEnvivEXT; SAGEAPI SAGE_PFNGLGETMULTITEXGENDVEXTPROC SAGE_glGetMultiTexGendvEXT; SAGEAPI SAGE_PFNGLGETMULTITEXGENFVEXTPROC SAGE_glGetMultiTexGenfvEXT; SAGEAPI SAGE_PFNGLGETMULTITEXGENIVEXTPROC SAGE_glGetMultiTexGenivEXT; SAGEAPI SAGE_PFNGLGETFLOATINDEXEDVEXTPROC SAGE_glGetFloatIndexedvEXT; SAGEAPI SAGE_PFNGLGETDOUBLEINDEXEDVEXTPROC SAGE_glGetDoubleIndexedvEXT; SAGEAPI SAGE_PFNGLGETPOINTERINDEXEDVEXTPROC SAGE_glGetPointerIndexedvEXT; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC SAGE_glCompressedTextureImage3DEXT; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC SAGE_glCompressedTextureImage2DEXT; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC SAGE_glCompressedTextureImage1DEXT; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC SAGE_glCompressedTextureSubImage3DEXT; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC SAGE_glCompressedTextureSubImage2DEXT; SAGEAPI SAGE_PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC SAGE_glCompressedTextureSubImage1DEXT; SAGEAPI SAGE_PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC SAGE_glGetCompressedTextureImageEXT; SAGEAPI SAGE_PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC SAGE_glCompressedMultiTexImage3DEXT; SAGEAPI SAGE_PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC SAGE_glCompressedMultiTexImage2DEXT; SAGEAPI SAGE_PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC SAGE_glCompressedMultiTexImage1DEXT; SAGEAPI SAGE_PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC SAGE_glCompressedMultiTexSubImage3DEXT; SAGEAPI SAGE_PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC SAGE_glCompressedMultiTexSubImage2DEXT; SAGEAPI SAGE_PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC SAGE_glCompressedMultiTexSubImage1DEXT; SAGEAPI SAGE_PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC SAGE_glGetCompressedMultiTexImageEXT; SAGEAPI SAGE_PFNGLNAMEDPROGRAMSTRINGEXTPROC SAGE_glNamedProgramStringEXT; SAGEAPI SAGE_PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC SAGE_glNamedProgramLocalParameter4dEXT; SAGEAPI SAGE_PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC SAGE_glNamedProgramLocalParameter4dvEXT; SAGEAPI SAGE_PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC SAGE_glNamedProgramLocalParameter4fEXT; SAGEAPI SAGE_PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC SAGE_glNamedProgramLocalParameter4fvEXT; SAGEAPI SAGE_PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC SAGE_glGetNamedProgramLocalParameterdvEXT; SAGEAPI SAGE_PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC SAGE_glGetNamedProgramLocalParameterfvEXT; SAGEAPI SAGE_PFNGLGETNAMEDPROGRAMIVEXTPROC SAGE_glGetNamedProgramivEXT; SAGEAPI SAGE_PFNGLGETNAMEDPROGRAMSTRINGEXTPROC SAGE_glGetNamedProgramStringEXT; SAGEAPI SAGE_PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC SAGE_glNamedProgramLocalParameters4fvEXT; SAGEAPI SAGE_PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC SAGE_glNamedProgramLocalParameterI4iEXT; SAGEAPI SAGE_PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC SAGE_glNamedProgramLocalParameterI4ivEXT; SAGEAPI SAGE_PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC SAGE_glNamedProgramLocalParametersI4ivEXT; SAGEAPI SAGE_PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC SAGE_glNamedProgramLocalParameterI4uiEXT; SAGEAPI SAGE_PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC SAGE_glNamedProgramLocalParameterI4uivEXT; SAGEAPI SAGE_PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC SAGE_glNamedProgramLocalParametersI4uivEXT; SAGEAPI SAGE_PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC SAGE_glGetNamedProgramLocalParameterIivEXT; SAGEAPI SAGE_PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC SAGE_glGetNamedProgramLocalParameterIuivEXT; SAGEAPI SAGE_PFNGLTEXTUREPARAMETERIIVEXTPROC SAGE_glTextureParameterIivEXT; SAGEAPI SAGE_PFNGLTEXTUREPARAMETERIUIVEXTPROC SAGE_glTextureParameterIuivEXT; SAGEAPI SAGE_PFNGLGETTEXTUREPARAMETERIIVEXTPROC SAGE_glGetTextureParameterIivEXT; SAGEAPI SAGE_PFNGLGETTEXTUREPARAMETERIUIVEXTPROC SAGE_glGetTextureParameterIuivEXT; SAGEAPI SAGE_PFNGLMULTITEXPARAMETERIIVEXTPROC SAGE_glMultiTexParameterIivEXT; SAGEAPI SAGE_PFNGLMULTITEXPARAMETERIUIVEXTPROC SAGE_glMultiTexParameterIuivEXT; SAGEAPI SAGE_PFNGLGETMULTITEXPARAMETERIIVEXTPROC SAGE_glGetMultiTexParameterIivEXT; SAGEAPI SAGE_PFNGLGETMULTITEXPARAMETERIUIVEXTPROC SAGE_glGetMultiTexParameterIuivEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM1FEXTPROC SAGE_glProgramUniform1fEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM2FEXTPROC SAGE_glProgramUniform2fEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM3FEXTPROC SAGE_glProgramUniform3fEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM4FEXTPROC SAGE_glProgramUniform4fEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM1IEXTPROC SAGE_glProgramUniform1iEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM2IEXTPROC SAGE_glProgramUniform2iEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM3IEXTPROC SAGE_glProgramUniform3iEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM4IEXTPROC SAGE_glProgramUniform4iEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM1FVEXTPROC SAGE_glProgramUniform1fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM2FVEXTPROC SAGE_glProgramUniform2fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM3FVEXTPROC SAGE_glProgramUniform3fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM4FVEXTPROC SAGE_glProgramUniform4fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM1IVEXTPROC SAGE_glProgramUniform1ivEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM2IVEXTPROC SAGE_glProgramUniform2ivEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM3IVEXTPROC SAGE_glProgramUniform3ivEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM4IVEXTPROC SAGE_glProgramUniform4ivEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC SAGE_glProgramUniformMatrix2fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC SAGE_glProgramUniformMatrix3fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC SAGE_glProgramUniformMatrix4fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC SAGE_glProgramUniformMatrix2x3fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC SAGE_glProgramUniformMatrix3x2fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC SAGE_glProgramUniformMatrix2x4fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC SAGE_glProgramUniformMatrix4x2fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC SAGE_glProgramUniformMatrix3x4fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC SAGE_glProgramUniformMatrix4x3fvEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM1UIEXTPROC SAGE_glProgramUniform1uiEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM2UIEXTPROC SAGE_glProgramUniform2uiEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM3UIEXTPROC SAGE_glProgramUniform3uiEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM4UIEXTPROC SAGE_glProgramUniform4uiEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM1UIVEXTPROC SAGE_glProgramUniform1uivEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM2UIVEXTPROC SAGE_glProgramUniform2uivEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM3UIVEXTPROC SAGE_glProgramUniform3uivEXT; SAGEAPI SAGE_PFNGLPROGRAMUNIFORM4UIVEXTPROC SAGE_glProgramUniform4uivEXT; SAGEAPI SAGE_PFNGLNAMEDBUFFERDATAEXTPROC SAGE_glNamedBufferDataEXT; SAGEAPI SAGE_PFNGLNAMEDBUFFERSUBDATAEXTPROC SAGE_glNamedBufferSubDataEXT; SAGEAPI SAGE_PFNGLMAPNAMEDBUFFEREXTPROC SAGE_glMapNamedBufferEXT; SAGEAPI SAGE_PFNGLUNMAPNAMEDBUFFEREXTPROC SAGE_glUnmapNamedBufferEXT; SAGEAPI SAGE_PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC SAGE_glGetNamedBufferParameterivEXT; SAGEAPI SAGE_PFNGLGETNAMEDBUFFERPOINTERVEXTPROC SAGE_glGetNamedBufferPointervEXT; SAGEAPI SAGE_PFNGLGETNAMEDBUFFERSUBDATAEXTPROC SAGE_glGetNamedBufferSubDataEXT; SAGEAPI SAGE_PFNGLTEXTUREBUFFEREXTPROC SAGE_glTextureBufferEXT; SAGEAPI SAGE_PFNGLMULTITEXBUFFEREXTPROC SAGE_glMultiTexBufferEXT; SAGEAPI SAGE_PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC SAGE_glNamedRenderbufferStorageEXT; SAGEAPI SAGE_PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC SAGE_glGetNamedRenderbufferParameterivEXT; SAGEAPI SAGE_PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC SAGE_glCheckNamedFramebufferStatusEXT; SAGEAPI SAGE_PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC SAGE_glNamedFramebufferTexture1DEXT; SAGEAPI SAGE_PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC SAGE_glNamedFramebufferTexture2DEXT; SAGEAPI SAGE_PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC SAGE_glNamedFramebufferTexture3DEXT; SAGEAPI SAGE_PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC SAGE_glNamedFramebufferRenderbufferEXT; SAGEAPI SAGE_PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC SAGE_glGetNamedFramebufferAttachmentParameterivEXT; SAGEAPI SAGE_PFNGLGENERATETEXTUREMIPMAPEXTPROC SAGE_glGenerateTextureMipmapEXT; SAGEAPI SAGE_PFNGLGENERATEMULTITEXMIPMAPEXTPROC SAGE_glGenerateMultiTexMipmapEXT; SAGEAPI SAGE_PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC SAGE_glFramebufferDrawBufferEXT; SAGEAPI SAGE_PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC SAGE_glFramebufferDrawBuffersEXT; SAGEAPI SAGE_PFNGLFRAMEBUFFERREADBUFFEREXTPROC SAGE_glFramebufferReadBufferEXT; SAGEAPI SAGE_PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC SAGE_glGetFramebufferParameterivEXT; SAGEAPI SAGE_PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC SAGE_glNamedRenderbufferStorageMultisampleEXT; SAGEAPI SAGE_PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC SAGE_glNamedRenderbufferStorageMultisampleCoverageEXT; SAGEAPI SAGE_PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC SAGE_glNamedFramebufferTextureEXT; SAGEAPI SAGE_PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC SAGE_glNamedFramebufferTextureLayerEXT; SAGEAPI SAGE_PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC SAGE_glNamedFramebufferTextureFaceEXT; SAGEAPI SAGE_PFNGLTEXTURERENDERBUFFEREXTPROC SAGE_glTextureRenderbufferEXT; SAGEAPI SAGE_PFNGLMULTITEXRENDERBUFFEREXTPROC SAGE_glMultiTexRenderbufferEXT; SAGEAPI SAGE_PFNGLGETMULTISAMPLEFVNVPROC SAGE_glGetMultisamplefvNV; SAGEAPI SAGE_PFNGLSAMPLEMASKINDEXEDNVPROC SAGE_glSampleMaskIndexedNV; SAGEAPI SAGE_PFNGLTEXRENDERBUFFERNVPROC SAGE_glTexRenderbufferNV; SAGEAPI SAGE_PFNGLBINDTRANSFORMFEEDBACKNVPROC SAGE_glBindTransformFeedbackNV; SAGEAPI SAGE_PFNGLDELETETRANSFORMFEEDBACKSNVPROC SAGE_glDeleteTransformFeedbacksNV; SAGEAPI SAGE_PFNGLGENTRANSFORMFEEDBACKSNVPROC SAGE_glGenTransformFeedbacksNV; SAGEAPI SAGE_PFNGLISTRANSFORMFEEDBACKNVPROC SAGE_glIsTransformFeedbackNV; SAGEAPI SAGE_PFNGLPAUSETRANSFORMFEEDBACKNVPROC SAGE_glPauseTransformFeedbackNV; SAGEAPI SAGE_PFNGLRESUMETRANSFORMFEEDBACKNVPROC SAGE_glResumeTransformFeedbackNV; SAGEAPI SAGE_PFNGLDRAWTRANSFORMFEEDBACKNVPROC SAGE_glDrawTransformFeedbackNV; SAGEAPI SAGE_PFNGLGETPERFMONITORGROUPSAMDPROC SAGE_glGetPerfMonitorGroupsAMD; SAGEAPI SAGE_PFNGLGETPERFMONITORCOUNTERSAMDPROC SAGE_glGetPerfMonitorCountersAMD; SAGEAPI SAGE_PFNGLGETPERFMONITORGROUPSTRINGAMDPROC SAGE_glGetPerfMonitorGroupStringAMD; SAGEAPI SAGE_PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC SAGE_glGetPerfMonitorCounterStringAMD; SAGEAPI SAGE_PFNGLGETPERFMONITORCOUNTERINFOAMDPROC SAGE_glGetPerfMonitorCounterInfoAMD; SAGEAPI SAGE_PFNGLGENPERFMONITORSAMDPROC SAGE_glGenPerfMonitorsAMD; SAGEAPI SAGE_PFNGLDELETEPERFMONITORSAMDPROC SAGE_glDeletePerfMonitorsAMD; SAGEAPI SAGE_PFNGLSELECTPERFMONITORCOUNTERSAMDPROC SAGE_glSelectPerfMonitorCountersAMD; SAGEAPI SAGE_PFNGLBEGINPERFMONITORAMDPROC SAGE_glBeginPerfMonitorAMD; SAGEAPI SAGE_PFNGLENDPERFMONITORAMDPROC SAGE_glEndPerfMonitorAMD; SAGEAPI SAGE_PFNGLGETPERFMONITORCOUNTERDATAAMDPROC SAGE_glGetPerfMonitorCounterDataAMD; SAGEAPI SAGE_PFNGLTESSELLATIONFACTORAMDPROC SAGE_glTessellationFactorAMD; SAGEAPI SAGE_PFNGLTESSELLATIONMODEAMDPROC SAGE_glTessellationModeAMD; SAGEAPI SAGE_PFNGLPROVOKINGVERTEXEXTPROC SAGE_glProvokingVertexEXT; SAGEAPI SAGE_PFNGLBLENDFUNCINDEXEDAMDPROC SAGE_glBlendFuncIndexedAMD; SAGEAPI SAGE_PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC SAGE_glBlendFuncSeparateIndexedAMD; SAGEAPI SAGE_PFNGLBLENDEQUATIONINDEXEDAMDPROC SAGE_glBlendEquationIndexedAMD; SAGEAPI SAGE_PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC SAGE_glBlendEquationSeparateIndexedAMD; SAGEAPI SAGE_PFNGLTEXTURERANGEAPPLEPROC SAGE_glTextureRangeAPPLE; SAGEAPI SAGE_PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC SAGE_glGetTexParameterPointervAPPLE; SAGEAPI SAGE_PFNGLENABLEVERTEXATTRIBAPPLEPROC SAGE_glEnableVertexAttribAPPLE; SAGEAPI SAGE_PFNGLDISABLEVERTEXATTRIBAPPLEPROC SAGE_glDisableVertexAttribAPPLE; SAGEAPI SAGE_PFNGLISVERTEXATTRIBENABLEDAPPLEPROC SAGE_glIsVertexAttribEnabledAPPLE; SAGEAPI SAGE_PFNGLMAPVERTEXATTRIB1DAPPLEPROC SAGE_glMapVertexAttrib1dAPPLE; SAGEAPI SAGE_PFNGLMAPVERTEXATTRIB1FAPPLEPROC SAGE_glMapVertexAttrib1fAPPLE; SAGEAPI SAGE_PFNGLMAPVERTEXATTRIB2DAPPLEPROC SAGE_glMapVertexAttrib2dAPPLE; SAGEAPI SAGE_PFNGLMAPVERTEXATTRIB2FAPPLEPROC SAGE_glMapVertexAttrib2fAPPLE; SAGEAPI SAGE_PFNGLOBJECTPURGEABLEAPPLEPROC SAGE_glObjectPurgeableAPPLE; SAGEAPI SAGE_PFNGLOBJECTUNPURGEABLEAPPLEPROC SAGE_glObjectUnpurgeableAPPLE; SAGEAPI SAGE_PFNGLGETOBJECTPARAMETERIVAPPLEPROC SAGE_glGetObjectParameterivAPPLE; SAGEAPI SAGE_PFNGLBEGINVIDEOCAPTURENVPROC SAGE_glBeginVideoCaptureNV; SAGEAPI SAGE_PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC SAGE_glBindVideoCaptureStreamBufferNV; SAGEAPI SAGE_PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC SAGE_glBindVideoCaptureStreamTextureNV; SAGEAPI SAGE_PFNGLENDVIDEOCAPTURENVPROC SAGE_glEndVideoCaptureNV; SAGEAPI SAGE_PFNGLGETVIDEOCAPTUREIVNVPROC SAGE_glGetVideoCaptureivNV; SAGEAPI SAGE_PFNGLGETVIDEOCAPTURESTREAMIVNVPROC SAGE_glGetVideoCaptureStreamivNV; SAGEAPI SAGE_PFNGLGETVIDEOCAPTURESTREAMFVNVPROC SAGE_glGetVideoCaptureStreamfvNV; SAGEAPI SAGE_PFNGLGETVIDEOCAPTURESTREAMDVNVPROC SAGE_glGetVideoCaptureStreamdvNV; SAGEAPI SAGE_PFNGLVIDEOCAPTURENVPROC SAGE_glVideoCaptureNV; SAGEAPI SAGE_PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC SAGE_glVideoCaptureStreamParameterivNV; SAGEAPI SAGE_PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC SAGE_glVideoCaptureStreamParameterfvNV; SAGEAPI SAGE_PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC SAGE_glVideoCaptureStreamParameterdvNV; SAGEAPI SAGE_PFNGLCOPYIMAGESUBDATANVPROC SAGE_glCopyImageSubDataNV; SAGEAPI SAGE_PFNGLUSESHADERPROGRAMEXTPROC SAGE_glUseShaderProgramEXT; SAGEAPI SAGE_PFNGLACTIVEPROGRAMEXTPROC SAGE_glActiveProgramEXT; SAGEAPI SAGE_PFNGLCREATESHADERPROGRAMEXTPROC SAGE_glCreateShaderProgramEXT; SAGEAPI SAGE_PFNGLMAKEBUFFERRESIDENTNVPROC SAGE_glMakeBufferResidentNV; SAGEAPI SAGE_PFNGLMAKEBUFFERNONRESIDENTNVPROC SAGE_glMakeBufferNonResidentNV; SAGEAPI SAGE_PFNGLISBUFFERRESIDENTNVPROC SAGE_glIsBufferResidentNV; SAGEAPI SAGE_PFNGLNAMEDMAKEBUFFERRESIDENTNVPROC SAGE_glNamedMakeBufferResidentNV; SAGEAPI SAGE_PFNGLNAMEDMAKEBUFFERNONRESIDENTNVPROC SAGE_glNamedMakeBufferNonResidentNV; SAGEAPI SAGE_PFNGLISNAMEDBUFFERRESIDENTNVPROC SAGE_glIsNamedBufferResidentNV; SAGEAPI SAGE_PFNGLGETBUFFERPARAMETERUI64VNVPROC SAGE_glGetBufferParameterui64vNV; SAGEAPI SAGE_PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC SAGE_glGetNamedBufferParameterui64vNV; SAGEAPI SAGE_PFNGLGETINTEGERUI64VNVPROC SAGE_glGetIntegerui64vNV; SAGEAPI SAGE_PFNGLUNIFORMUI64NVPROC SAGE_glUniformui64NV; SAGEAPI SAGE_PFNGLUNIFORMUI64VNVPROC SAGE_glUniformui64vNV; SAGEAPI SAGE_PFNGLGETUNIFORMUI64VNVPROC SAGE_glGetUniformui64vNV; SAGEAPI SAGE_PFNGLPROGRAMUNIFORMUI64NVPROC SAGE_glProgramUniformui64NV; SAGEAPI SAGE_PFNGLPROGRAMUNIFORMUI64VNVPROC SAGE_glProgramUniformui64vNV; SAGEAPI SAGE_PFNGLBUFFERADDRESSRANGENVPROC SAGE_glBufferAddressRangeNV; SAGEAPI SAGE_PFNGLVERTEXFORMATNVPROC SAGE_glVertexFormatNV; SAGEAPI SAGE_PFNGLNORMALFORMATNVPROC SAGE_glNormalFormatNV; SAGEAPI SAGE_PFNGLCOLORFORMATNVPROC SAGE_glColorFormatNV; SAGEAPI SAGE_PFNGLINDEXFORMATNVPROC SAGE_glIndexFormatNV; SAGEAPI SAGE_PFNGLTEXCOORDFORMATNVPROC SAGE_glTexCoordFormatNV; SAGEAPI SAGE_PFNGLEDGEFLAGFORMATNVPROC SAGE_glEdgeFlagFormatNV; SAGEAPI SAGE_PFNGLSECONDARYCOLORFORMATNVPROC SAGE_glSecondaryColorFormatNV; SAGEAPI SAGE_PFNGLFOGCOORDFORMATNVPROC SAGE_glFogCoordFormatNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBFORMATNVPROC SAGE_glVertexAttribFormatNV; SAGEAPI SAGE_PFNGLVERTEXATTRIBIFORMATNVPROC SAGE_glVertexAttribIFormatNV; SAGEAPI SAGE_PFNGLTEXTUREBARRIERNVPROC SAGE_glTextureBarrierNV; SAGEAPI int sage_init(void); #endif
lgpl-2.1
dudochkin-victor/libqttracker
src/include/sopranolive/ontologies/core/rdfs.h
89378
/* * rdfs.h, manually edited */ #ifndef SOPRANOLIVE_ONTOLOGIESGENERAL_RDFS_H_FORWARD_DECLARATIONS #define SOPRANOLIVE_ONTOLOGIESGENERAL_RDFS_H_FORWARD_DECLARATIONS // Namespace objects and forward declarations section #include "../../QLiveAutogenerationBase" namespace SopranoLive { namespace Ontologies { namespace Core { /* \defgroup onto_rdfs_classes namespace rdfs class definitions * { * } */ /* \defgroup onto_rdfs_properties namespace rdfs property definitions * { * } */ /* \defgroup onto_rdfs_resources namespace rdfs resource definitions * { * } */ static const char rdfs_namespace_prefix[] = "http://www.w3.org/2000/01/rdf-schema#"; struct Ontology_rdfs { // The defining context of this namespace typedef ::SopranoLive::Contexts::Core ResourceContext; static QUrl iri(QString suffix = QString()) { return QLatin1String(rdfs_namespace_prefix) + suffix; } }; namespace rdfs { inline QUrl iri(QString suffix) { return Ontology_rdfs::iri(suffix); } /* * \section classes Classes */ // { class Class; class Literal; class Resource; // } } } } } #endif /* SOPRANOLIVE_ONTOLOGIESGENERAL_RDFS_H_FORWARD_DECLARATIONS */ // Property class definitions section #if (!defined(SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_ONLY) || defined(Q_MOC_RUN)) #ifndef SOPRANOLIVE_ONTOLOGIESGENERAL_RDFS_H_PROPERTY_DEFINITIONS #define SOPRANOLIVE_ONTOLOGIESGENERAL_RDFS_H_PROPERTY_DEFINITIONS #ifdef SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_ONLY #include "dc.h" #include "rdf.h" #include "xsd.h" #elif defined(SOPRANOLIVE_ONTOLOGIESGENERAL_TOP_LEVEL_INCLUDING) #define SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_ONLY #include "dc.h" #include "rdf.h" #include "xsd.h" #undef SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_ONLY #else #define SOPRANOLIVE_ONTOLOGIESGENERAL_TOP_LEVEL_INCLUDING #define SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_ONLY #include "dc.h" #include "rdf.h" #include "xsd.h" #undef SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_ONLY #undef SOPRANOLIVE_ONTOLOGIESGENERAL_TOP_LEVEL_INCLUDING #endif // SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_ONLY namespace SopranoLive { namespace Ontologies { namespace Core { namespace rdfs { /* * \section properties Property description classes */ // { /* Property generated from rdfs:subClassOf * \anchor rdfs_subClassOf * \n rdfs:range=rdfs:Class * \n tracker:modified=2250 * \n rdfs:domain=rdfs:Class * \n tracker:added=2010-04-08T11:21:26Z */ /// \ingroup onto_rdfs_properties class subClassOf { public: /// \return encoded iri of this property static const char *encodedIri() { return "http://www.w3.org/2000/01/rdf-schema#subClassOf"; } /// \return iri of this property static QUrl const &iri() { static QUrl *ret = 0; if(!ret) ret = new QUrl(QUrl::fromEncoded(encodedIri(), QUrl::StrictMode)); return *ret; } /// The defining context of this property typedef ::SopranoLive::Contexts::Core ResourceContext; /// When this property class is used as a resource it has type rdf:Property typedef rdf::Property ResourceType; // The ontology of this property typedef Ontology_rdfs Ontology; /// The base strategy of this property. Typically just contains the multiplevalued/optionalvalud attributes. enum { BaseStrategy = 0 }; /// The domain/owning class of this property typedef Class Domain; /// The domain/owning class of this property (for symmetry with RDFRange) typedef Class RDFDomain; /// The localized c++ range type of this property typedef Class Range; /// The full, non-localized rdf range type of this property typedef Class RDFRange; }; /* Property generated from rdfs:comment * \anchor rdfs_comment * \n rdfs:range=xsd:string * \n tracker:modified=2252 * \n rdfs:domain=rdfs:Resource * \n tracker:added=2010-04-08T11:21:26Z * \n nrl:maxCardinality=1 */ /// \ingroup onto_rdfs_properties class comment { public: /// \return encoded iri of this property static const char *encodedIri() { return "http://www.w3.org/2000/01/rdf-schema#comment"; } /// \return iri of this property static QUrl const &iri() { static QUrl *ret = 0; if(!ret) ret = new QUrl(QUrl::fromEncoded(encodedIri(), QUrl::StrictMode)); return *ret; } /// The defining context of this property typedef ::SopranoLive::Contexts::Core ResourceContext; /// When this property class is used as a resource it has type rdf:Property typedef rdf::Property ResourceType; // The ontology of this property typedef Ontology_rdfs Ontology; /// The base strategy of this property. Typically just contains the multiplevalued/optionalvalud attributes. enum { BaseStrategy = ::SopranoLive::RDFStrategy::NonMultipleValued | ::SopranoLive::RDFStrategy::Literal }; /// The domain/owning class of this property typedef Resource Domain; /// The domain/owning class of this property (for symmetry with RDFRange) typedef Resource RDFDomain; /// The localized c++ range type of this property typedef QString Range; /// The full, non-localized rdf range type of this property typedef ::SopranoLive::Ontologies::Core::xsd::string RDFRange; }; /* Property generated from rdfs:label * \anchor rdfs_label * \n rdfs:range=xsd:string * \n tracker:modified=2253 * \n rdfs:domain=rdfs:Resource * \n tracker:added=2010-04-08T11:21:26Z * \n nrl:maxCardinality=1 */ /// \ingroup onto_rdfs_properties class label { public: /// \return encoded iri of this property static const char *encodedIri() { return "http://www.w3.org/2000/01/rdf-schema#label"; } /// \return iri of this property static QUrl const &iri() { static QUrl *ret = 0; if(!ret) ret = new QUrl(QUrl::fromEncoded(encodedIri(), QUrl::StrictMode)); return *ret; } /// The defining context of this property typedef ::SopranoLive::Contexts::Core ResourceContext; /// When this property class is used as a resource it has type rdf:Property typedef rdf::Property ResourceType; // The ontology of this property typedef Ontology_rdfs Ontology; /// The base strategy of this property. Typically just contains the multiplevalued/optionalvalud attributes. enum { BaseStrategy = ::SopranoLive::RDFStrategy::NonMultipleValued | ::SopranoLive::RDFStrategy::Literal }; /// The domain/owning class of this property typedef Resource Domain; /// The domain/owning class of this property (for symmetry with RDFRange) typedef Resource RDFDomain; /// The localized c++ range type of this property typedef QString Range; /// The full, non-localized rdf range type of this property typedef ::SopranoLive::Ontologies::Core::xsd::string RDFRange; }; /* Property generated from rdfs:domain * \anchor rdfs_domain * \n rdfs:range=rdfs:Resource * \n tracker:modified=2254 * \n rdfs:domain=rdf:Property * \n tracker:added=2010-04-08T11:21:26Z * \n nrl:maxCardinality=1 */ /// \ingroup onto_rdfs_properties class domain { public: /// \return encoded iri of this property static const char *encodedIri() { return "http://www.w3.org/2000/01/rdf-schema#domain"; } /// \return iri of this property static QUrl const &iri() { static QUrl *ret = 0; if(!ret) ret = new QUrl(QUrl::fromEncoded(encodedIri(), QUrl::StrictMode)); return *ret; } /// The defining context of this property typedef ::SopranoLive::Contexts::Core ResourceContext; /// When this property class is used as a resource it has type rdf:Property typedef rdf::Property ResourceType; // The ontology of this property typedef Ontology_rdfs Ontology; /// The base strategy of this property. Typically just contains the multiplevalued/optionalvalud attributes. enum { BaseStrategy = ::SopranoLive::RDFStrategy::NonMultipleValued }; /// The domain/owning class of this property typedef rdf::Property Domain; /// The domain/owning class of this property (for symmetry with RDFRange) typedef rdf::Property RDFDomain; /// The localized c++ range type of this property typedef Resource Range; /// The full, non-localized rdf range type of this property typedef Resource RDFRange; }; /* Property generated from rdfs:range * \anchor rdfs_range * \n rdfs:range=rdfs:Class * \n tracker:modified=2255 * \n rdfs:domain=rdf:Property * \n tracker:added=2010-04-08T11:21:26Z * \n nrl:maxCardinality=1 */ /// \ingroup onto_rdfs_properties class range { public: /// \return encoded iri of this property static const char *encodedIri() { return "http://www.w3.org/2000/01/rdf-schema#range"; } /// \return iri of this property static QUrl const &iri() { static QUrl *ret = 0; if(!ret) ret = new QUrl(QUrl::fromEncoded(encodedIri(), QUrl::StrictMode)); return *ret; } /// The defining context of this property typedef ::SopranoLive::Contexts::Core ResourceContext; /// When this property class is used as a resource it has type rdf:Property typedef rdf::Property ResourceType; // The ontology of this property typedef Ontology_rdfs Ontology; /// The base strategy of this property. Typically just contains the multiplevalued/optionalvalud attributes. enum { BaseStrategy = ::SopranoLive::RDFStrategy::NonMultipleValued }; /// The domain/owning class of this property typedef rdf::Property Domain; /// The domain/owning class of this property (for symmetry with RDFRange) typedef rdf::Property RDFDomain; /// The localized c++ range type of this property typedef Class Range; /// The full, non-localized rdf range type of this property typedef Class RDFRange; }; /* Property generated from rdfs:subPropertyOf * \anchor rdfs_subPropertyOf * \n rdfs:range=rdf:Property * \n tracker:modified=2251 * \n rdfs:domain=rdf:Property * \n tracker:added=2010-04-08T11:21:26Z */ /// \ingroup onto_rdfs_properties class subPropertyOf { public: /// \return encoded iri of this property static const char *encodedIri() { return "http://www.w3.org/2000/01/rdf-schema#subPropertyOf"; } /// \return iri of this property static QUrl const &iri() { static QUrl *ret = 0; if(!ret) ret = new QUrl(QUrl::fromEncoded(encodedIri(), QUrl::StrictMode)); return *ret; } /// The defining context of this property typedef ::SopranoLive::Contexts::Core ResourceContext; /// When this property class is used as a resource it has type rdf:Property typedef rdf::Property ResourceType; // The ontology of this property typedef Ontology_rdfs Ontology; /// The base strategy of this property. Typically just contains the multiplevalued/optionalvalud attributes. enum { BaseStrategy = 0 }; /// The domain/owning class of this property typedef rdf::Property Domain; /// The domain/owning class of this property (for symmetry with RDFRange) typedef rdf::Property RDFDomain; /// The localized c++ range type of this property typedef rdf::Property Range; /// The full, non-localized rdf range type of this property typedef rdf::Property RDFRange; }; // } /* * \section resources Resource description classes */ // { // } } } } } #endif /* SOPRANOLIVE_ONTOLOGIESGENERAL_RDFS_H_PROPERTY_DEFINITIONS */ #endif /* (!defined(SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_ONLY) || defined(Q_MOC_RUN) */ #if ( ( !defined(SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_ONLY) \ && !defined(SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_AND_PROPERTY_DEFINITIONS_ONLY) \ ) || defined(Q_MOC_RUN)) #ifndef SOPRANOLIVE_ONTOLOGIESGENERAL_RDFS_H_CLASS_DEFINITIONS #define SOPRANOLIVE_ONTOLOGIESGENERAL_RDFS_H_CLASS_DEFINITIONS #ifdef SOPRANOLIVE_ONTOLOGIESGENERAL_TOP_LEVEL_INCLUDING #define SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_AND_PROPERTY_DEFINITIONS_ONLY #include "dc.h" #include "rdf.h" #include "xsd.h" #undef SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_AND_PROPERTY_DEFINITIONS_ONLY #else // !defined(SOPRANOLIVE_ONTOLOGIESGENERAL_TOP_LEVEL_INCLUDING) #define SOPRANOLIVE_ONTOLOGIESGENERAL_TOP_LEVEL_INCLUDING #define SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_AND_PROPERTY_DEFINITIONS_ONLY #include "dc.h" #include "rdf.h" #include "xsd.h" #undef SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_AND_PROPERTY_DEFINITIONS_ONLY #undef SOPRANOLIVE_ONTOLOGIESGENERAL_TOP_LEVEL_INCLUDING #endif // SOPRANOLIVE_ONTOLOGIESGENERAL_TOP_LEVEL_INCLUDING namespace SopranoLive { namespace Ontologies { namespace Core { namespace rdfs { using namespace rdf; using namespace xsd; /* Class generated from rdfs:Resource * \ingroup onto_rdfs_classes * All resources * * rdfs:label = All Resources * * tracker:modified = 2058 * * tracker:added = 2010-04-08T11:21:26Z * * \b Properties \b having \b this \b class \b as \b Range \n * \ref dc_source "dc:source" * \ref rdfs_domain "rdfs:domain" * \ref nao_isRelated "nao:isRelated" * \ref nao_hasTag "nao:hasTag" */ class Resource : public virtual LiveResourceBridge { // Q_OBJECT public: // The defining context of this class typedef ::SopranoLive::Contexts::Core ResourceContext; // When used as a resource, this class has a type rdfs:Class typedef rdfs::Class ResourceType; // the ontology of this class typedef Ontology_rdfs Ontology; /// The base strategy of this class enum { BaseStrategy = 0 }; /// The base classes of this class /* * A smart, by-value convenience smart \ref SopranoLive::Live pointer to this class */ typedef ::SopranoLive::Live<Resource> Live; Resource() { this->attachInterfaceHelper< Resource >(); } ~Resource() { this->detachInterfaceHelper< Resource >(); } /* * \name Property accessor and manipulator methods */ // { /* Property generated from dc:rights * \n Information about rights held in and over the resource. * \n rdfs:label=Rights * \n nrl:maxCardinality=1 * \n rdfs:range=xsd:string * \n rdfs:domain=rdfs:Resource * \n tracker:modified=2280 * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcRightss(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_rights "dc:rights" set. \sa LiveResource::liveObjects */ LiveNodes liveDcRightss(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::rights >(object_info, strategy, parent); } /* \fn LiveNodes getDcRightss(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_rights "dc:rights" set. \sa LiveResource::getObjects */ LiveNodes getDcRightss(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::rights >(object_info, strategy, parent); } /* \fn void setDcRightss(LiveNodes const &dcRights_) Sets the property \ref dc_rights "dc:rights" set to the given \a dcRights_ set. \sa LiveResource::setObjects */ void setDcRightss(LiveNodes const &dcRights_) { setObjects(dc::rights::iri(), dcRights_); } /* \fn void removeDcRightss(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_rights "dc:rights" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcRightss(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::rights::iri(), object_info); } /* \fn QString getDcRights() Returns the property \ref dc_rights "dc:rights". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getDcRights() { return AutoGen::Value< QString >::fromNode(getObject< dc::rights >()); } /* \fn void setDcRights(QString const &dcRights_) Sets the property \ref dc_rights "dc:rights" to the given \a dcRights. \sa LiveResource::setObject */ void setDcRights(QString const &dcRights_) { setObject(dc::rights::iri(), AutoGen::Value< QString >::toNode(dcRights_ )); } /* \fn QString firstDcRights() Returns the first property \ref dc_rights "dc:rights". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcRights() { return AutoGen::Value< QString >::fromNode(firstObject< dc::rights >()); } /* \fn void addDcRights(QString const &dcRights_) Adds the given \a dcRights_ to the property \ref dc_rights "dc:rights" set. \sa LiveResource::addObject */ void addDcRights(QString const &dcRights_) { addObject(dc::rights::iri(), AutoGen::Value< QString >::toNode(dcRights_)); } /* \fn void removeDcRights(QString const &dcRights_) Removes the given \a dcRights_ from the property \ref dc_rights "dc:rights" set. \sa LiveResource::removeObject */ void removeDcRights(QString const &dcRights_) { removeObject(dc::rights::iri(), AutoGen::Value< QString >::toNode(dcRights_)); } /* Property generated from dc:contributor * \n An entity responsible for making contributions to the resource. * \n rdfs:label=Contributor * \n rdfs:range=xsd:string * \n rdfs:domain=rdfs:Resource * \n tracker:weight=4 * \n tracker:modified=2271 * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcContributors(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_contributor "dc:contributor" set. \sa LiveResource::liveObjects */ LiveNodes liveDcContributors(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::contributor >(object_info, strategy, parent); } /* \fn LiveNodes getDcContributors(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_contributor "dc:contributor" set. \sa LiveResource::getObjects */ LiveNodes getDcContributors(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::contributor >(object_info, strategy, parent); } /* \fn void setDcContributors(LiveNodes const &dcContributor_) Sets the property \ref dc_contributor "dc:contributor" set to the given \a dcContributor_ set. \sa LiveResource::setObjects */ void setDcContributors(LiveNodes const &dcContributor_) { setObjects(dc::contributor::iri(), dcContributor_); } /* \fn void removeDcContributors(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_contributor "dc:contributor" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcContributors(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::contributor::iri(), object_info); } /* \fn QString firstDcContributor() Returns the first property \ref dc_contributor "dc:contributor". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcContributor() { return AutoGen::Value< QString >::fromNode(firstObject< dc::contributor >()); } /* \fn void addDcContributor(QString const &dcContributor_) Adds the given \a dcContributor_ to the property \ref dc_contributor "dc:contributor" set. \sa LiveResource::addObject */ void addDcContributor(QString const &dcContributor_) { addObject(dc::contributor::iri(), AutoGen::Value< QString >::toNode(dcContributor_)); } /* \fn void removeDcContributor(QString const &dcContributor_) Removes the given \a dcContributor_ from the property \ref dc_contributor "dc:contributor" set. \sa LiveResource::removeObject */ void removeDcContributor(QString const &dcContributor_) { removeObject(dc::contributor::iri(), AutoGen::Value< QString >::toNode(dcContributor_)); } /* Property generated from dc:format * \n The file format, physical medium, or dimensions of the resource. * \n rdfs:label=Format * \n nrl:maxCardinality=1 * \n rdfs:range=xsd:string * \n rdfs:domain=rdfs:Resource * \n tracker:modified=2274 * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcFormats(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_format "dc:format" set. \sa LiveResource::liveObjects */ LiveNodes liveDcFormats(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::format >(object_info, strategy, parent); } /* \fn LiveNodes getDcFormats(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_format "dc:format" set. \sa LiveResource::getObjects */ LiveNodes getDcFormats(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::format >(object_info, strategy, parent); } /* \fn void setDcFormats(LiveNodes const &dcFormat_) Sets the property \ref dc_format "dc:format" set to the given \a dcFormat_ set. \sa LiveResource::setObjects */ void setDcFormats(LiveNodes const &dcFormat_) { setObjects(dc::format::iri(), dcFormat_); } /* \fn void removeDcFormats(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_format "dc:format" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcFormats(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::format::iri(), object_info); } /* \fn QString getDcFormat() Returns the property \ref dc_format "dc:format". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getDcFormat() { return AutoGen::Value< QString >::fromNode(getObject< dc::format >()); } /* \fn void setDcFormat(QString const &dcFormat_) Sets the property \ref dc_format "dc:format" to the given \a dcFormat. \sa LiveResource::setObject */ void setDcFormat(QString const &dcFormat_) { setObject(dc::format::iri(), AutoGen::Value< QString >::toNode(dcFormat_ )); } /* \fn QString firstDcFormat() Returns the first property \ref dc_format "dc:format". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcFormat() { return AutoGen::Value< QString >::fromNode(firstObject< dc::format >()); } /* \fn void addDcFormat(QString const &dcFormat_) Adds the given \a dcFormat_ to the property \ref dc_format "dc:format" set. \sa LiveResource::addObject */ void addDcFormat(QString const &dcFormat_) { addObject(dc::format::iri(), AutoGen::Value< QString >::toNode(dcFormat_)); } /* \fn void removeDcFormat(QString const &dcFormat_) Removes the given \a dcFormat_ from the property \ref dc_format "dc:format" set. \sa LiveResource::removeObject */ void removeDcFormat(QString const &dcFormat_) { removeObject(dc::format::iri(), AutoGen::Value< QString >::toNode(dcFormat_)); } /* Property generated from dc:publisher * \n An entity responsible for making the resource available. * \n rdfs:label=Publisher * \n nrl:maxCardinality=1 * \n rdfs:range=xsd:string * \n rdfs:domain=rdfs:Resource * \n tracker:weight=4 * \n tracker:modified=2270 * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcPublishers(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_publisher "dc:publisher" set. \sa LiveResource::liveObjects */ LiveNodes liveDcPublishers(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::publisher >(object_info, strategy, parent); } /* \fn LiveNodes getDcPublishers(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_publisher "dc:publisher" set. \sa LiveResource::getObjects */ LiveNodes getDcPublishers(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::publisher >(object_info, strategy, parent); } /* \fn void setDcPublishers(LiveNodes const &dcPublisher_) Sets the property \ref dc_publisher "dc:publisher" set to the given \a dcPublisher_ set. \sa LiveResource::setObjects */ void setDcPublishers(LiveNodes const &dcPublisher_) { setObjects(dc::publisher::iri(), dcPublisher_); } /* \fn void removeDcPublishers(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_publisher "dc:publisher" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcPublishers(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::publisher::iri(), object_info); } /* \fn QString getDcPublisher() Returns the property \ref dc_publisher "dc:publisher". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getDcPublisher() { return AutoGen::Value< QString >::fromNode(getObject< dc::publisher >()); } /* \fn void setDcPublisher(QString const &dcPublisher_) Sets the property \ref dc_publisher "dc:publisher" to the given \a dcPublisher. \sa LiveResource::setObject */ void setDcPublisher(QString const &dcPublisher_) { setObject(dc::publisher::iri(), AutoGen::Value< QString >::toNode(dcPublisher_ )); } /* \fn QString firstDcPublisher() Returns the first property \ref dc_publisher "dc:publisher". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcPublisher() { return AutoGen::Value< QString >::fromNode(firstObject< dc::publisher >()); } /* \fn void addDcPublisher(QString const &dcPublisher_) Adds the given \a dcPublisher_ to the property \ref dc_publisher "dc:publisher" set. \sa LiveResource::addObject */ void addDcPublisher(QString const &dcPublisher_) { addObject(dc::publisher::iri(), AutoGen::Value< QString >::toNode(dcPublisher_)); } /* \fn void removeDcPublisher(QString const &dcPublisher_) Removes the given \a dcPublisher_ from the property \ref dc_publisher "dc:publisher" set. \sa LiveResource::removeObject */ void removeDcPublisher(QString const &dcPublisher_) { removeObject(dc::publisher::iri(), AutoGen::Value< QString >::toNode(dcPublisher_)); } /* Property generated from rdf:type * \n rdfs:range=rdfs:Class * \n tracker:modified=2249 * \n rdfs:domain=rdfs:Resource * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveRdfTypes(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref rdf_type "rdf:type" set. \sa LiveResource::liveObjects */ LiveNodes liveRdfTypes(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< rdf::type >(object_info, strategy, parent); } /* \fn LiveNodes getRdfTypes(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref rdf_type "rdf:type" set. \sa LiveResource::getObjects */ LiveNodes getRdfTypes(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< rdf::type >(object_info, strategy, parent); } /* \fn void setRdfTypes(LiveNodes const &rdfType_) Sets the property \ref rdf_type "rdf:type" set to the given \a rdfType_ set. \sa LiveResource::setObjects */ void setRdfTypes(LiveNodes const &rdfType_) { setObjects(rdf::type::iri(), rdfType_); } /* \fn void removeRdfTypes(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref rdf_type "rdf:type" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeRdfTypes(RDFVariable const &object_info = RDFVariable()) { removeObjects(rdf::type::iri(), object_info); } /* \fn ::SopranoLive::Live< Class > firstRdfType() Returns the first property \ref rdf_type "rdf:type". If the property didn't exist, a null LiveNode is returned. \sa LiveResource::firstObject */ ::SopranoLive::Live< Class > firstRdfType() { return firstObject< rdf::type >(); } /* \fn ::SopranoLive::Live< Class > addRdfType() Adds a new uniquely named resource to the property \ref rdf_type "rdf:type" set and returns a live version of it. \sa LiveResource::addObject */ ::SopranoLive::Live< Class > addRdfType() { return addObject< rdf::type >(); } /* \fn ::SopranoLive::Live< Class > addRdfType(::SopranoLive::Live< Class > const &rdfType_) Adds the given \a rdfType_ to the property \ref rdf_type "rdf:type" set and returns a live version of it. \sa LiveResource::addObject */ ::SopranoLive::Live< Class > addRdfType(::SopranoLive::Live< Class > const &rdfType_) { return addObject(rdf::type::iri(), rdfType_); } /* \fn void removeRdfType(::SopranoLive::Live< Class > const &rdfType_) Removes the given \a rdfType_ from the property \ref rdf_type "rdf:type" set. \sa LiveResource::removeObject */ void removeRdfType(::SopranoLive::Live< Class > const &rdfType_) { removeObject(rdf::type::iri(), rdfType_); } /* Property generated from dc:title * \n A name given to the resource. * \n rdfs:label=Title * \n nrl:maxCardinality=1 * \n rdfs:range=xsd:string * \n rdfs:domain=rdfs:Resource * \n tracker:weight=10 * \n tracker:modified=2266 * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcTitles(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_title "dc:title" set. \sa LiveResource::liveObjects */ LiveNodes liveDcTitles(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::title >(object_info, strategy, parent); } /* \fn LiveNodes getDcTitles(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_title "dc:title" set. \sa LiveResource::getObjects */ LiveNodes getDcTitles(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::title >(object_info, strategy, parent); } /* \fn void setDcTitles(LiveNodes const &dcTitle_) Sets the property \ref dc_title "dc:title" set to the given \a dcTitle_ set. \sa LiveResource::setObjects */ void setDcTitles(LiveNodes const &dcTitle_) { setObjects(dc::title::iri(), dcTitle_); } /* \fn void removeDcTitles(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_title "dc:title" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcTitles(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::title::iri(), object_info); } /* \fn QString getDcTitle() Returns the property \ref dc_title "dc:title". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getDcTitle() { return AutoGen::Value< QString >::fromNode(getObject< dc::title >()); } /* \fn void setDcTitle(QString const &dcTitle_) Sets the property \ref dc_title "dc:title" to the given \a dcTitle. \sa LiveResource::setObject */ void setDcTitle(QString const &dcTitle_) { setObject(dc::title::iri(), AutoGen::Value< QString >::toNode(dcTitle_ )); } /* \fn QString firstDcTitle() Returns the first property \ref dc_title "dc:title". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcTitle() { return AutoGen::Value< QString >::fromNode(firstObject< dc::title >()); } /* \fn void addDcTitle(QString const &dcTitle_) Adds the given \a dcTitle_ to the property \ref dc_title "dc:title" set. \sa LiveResource::addObject */ void addDcTitle(QString const &dcTitle_) { addObject(dc::title::iri(), AutoGen::Value< QString >::toNode(dcTitle_)); } /* \fn void removeDcTitle(QString const &dcTitle_) Removes the given \a dcTitle_ from the property \ref dc_title "dc:title" set. \sa LiveResource::removeObject */ void removeDcTitle(QString const &dcTitle_) { removeObject(dc::title::iri(), AutoGen::Value< QString >::toNode(dcTitle_)); } /* Property generated from dc:source * \n A related resource from which the described resource is derived. * \n rdfs:range=rdfs:Resource * \n rdfs:label=Source * \n tracker:modified=2276 * \n rdfs:domain=rdfs:Resource * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcSources(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_source "dc:source" set. \sa LiveResource::liveObjects */ LiveNodes liveDcSources(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::source >(object_info, strategy, parent); } /* \fn LiveNodes getDcSources(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_source "dc:source" set. \sa LiveResource::getObjects */ LiveNodes getDcSources(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::source >(object_info, strategy, parent); } /* \fn void setDcSources(LiveNodes const &dcSource_) Sets the property \ref dc_source "dc:source" set to the given \a dcSource_ set. \sa LiveResource::setObjects */ void setDcSources(LiveNodes const &dcSource_) { setObjects(dc::source::iri(), dcSource_); } /* \fn void removeDcSources(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_source "dc:source" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcSources(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::source::iri(), object_info); } /* \fn ::SopranoLive::Live< Resource > firstDcSource() Returns the first property \ref dc_source "dc:source". If the property didn't exist, a null LiveNode is returned. \sa LiveResource::firstObject */ ::SopranoLive::Live< Resource > firstDcSource() { return firstObject< dc::source >(); } /* \fn ::SopranoLive::Live< Resource > addDcSource() Adds a new uniquely named resource to the property \ref dc_source "dc:source" set and returns a live version of it. \sa LiveResource::addObject */ ::SopranoLive::Live< Resource > addDcSource() { return addObject< dc::source >(); } /* \fn ::SopranoLive::Live< Resource > addDcSource(::SopranoLive::Live< Resource > const &dcSource_) Adds the given \a dcSource_ to the property \ref dc_source "dc:source" set and returns a live version of it. \sa LiveResource::addObject */ ::SopranoLive::Live< Resource > addDcSource(::SopranoLive::Live< Resource > const &dcSource_) { return addObject(dc::source::iri(), dcSource_); } /* \fn void removeDcSource(::SopranoLive::Live< Resource > const &dcSource_) Removes the given \a dcSource_ from the property \ref dc_source "dc:source" set. \sa LiveResource::removeObject */ void removeDcSource(::SopranoLive::Live< Resource > const &dcSource_) { removeObject(dc::source::iri(), dcSource_); } /* Property generated from dc:date * \n A point or period of time associated with an event in the lifecycle of the resource. * \n rdfs:range=xsd:dateTime * \n rdfs:label=Date * \n tracker:modified=2272 * \n rdfs:domain=rdfs:Resource * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcDates(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_date "dc:date" set. \sa LiveResource::liveObjects */ LiveNodes liveDcDates(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::date >(object_info, strategy, parent); } /* \fn LiveNodes getDcDates(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_date "dc:date" set. \sa LiveResource::getObjects */ LiveNodes getDcDates(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::date >(object_info, strategy, parent); } /* \fn void setDcDates(LiveNodes const &dcDate_) Sets the property \ref dc_date "dc:date" set to the given \a dcDate_ set. \sa LiveResource::setObjects */ void setDcDates(LiveNodes const &dcDate_) { setObjects(dc::date::iri(), dcDate_); } /* \fn void removeDcDates(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_date "dc:date" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcDates(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::date::iri(), object_info); } /* \fn QDateTime firstDcDate() Returns the first property \ref dc_date "dc:date". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QDateTime firstDcDate() { return AutoGen::Value< QDateTime >::fromNode(firstObject< dc::date >()); } /* \fn void addDcDate(QDateTime const &dcDate_) Adds the given \a dcDate_ to the property \ref dc_date "dc:date" set. \sa LiveResource::addObject */ void addDcDate(QDateTime const &dcDate_) { addObject(dc::date::iri(), AutoGen::Value< QDateTime >::toNode(dcDate_)); } /* \fn void removeDcDate(QDateTime const &dcDate_) Removes the given \a dcDate_ from the property \ref dc_date "dc:date" set. \sa LiveResource::removeObject */ void removeDcDate(QDateTime const &dcDate_) { removeObject(dc::date::iri(), AutoGen::Value< QDateTime >::toNode(dcDate_)); } /* Property generated from dc:identifier * \n An unambiguous reference to the resource within a given context. * \n rdfs:label=Identifier * \n nrl:maxCardinality=1 * \n rdfs:range=xsd:string * \n rdfs:domain=rdfs:Resource * \n tracker:modified=2275 * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcIdentifiers(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_identifier "dc:identifier" set. \sa LiveResource::liveObjects */ LiveNodes liveDcIdentifiers(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::identifier >(object_info, strategy, parent); } /* \fn LiveNodes getDcIdentifiers(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_identifier "dc:identifier" set. \sa LiveResource::getObjects */ LiveNodes getDcIdentifiers(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::identifier >(object_info, strategy, parent); } /* \fn void setDcIdentifiers(LiveNodes const &dcIdentifier_) Sets the property \ref dc_identifier "dc:identifier" set to the given \a dcIdentifier_ set. \sa LiveResource::setObjects */ void setDcIdentifiers(LiveNodes const &dcIdentifier_) { setObjects(dc::identifier::iri(), dcIdentifier_); } /* \fn void removeDcIdentifiers(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_identifier "dc:identifier" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcIdentifiers(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::identifier::iri(), object_info); } /* \fn QString getDcIdentifier() Returns the property \ref dc_identifier "dc:identifier". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getDcIdentifier() { return AutoGen::Value< QString >::fromNode(getObject< dc::identifier >()); } /* \fn void setDcIdentifier(QString const &dcIdentifier_) Sets the property \ref dc_identifier "dc:identifier" to the given \a dcIdentifier. \sa LiveResource::setObject */ void setDcIdentifier(QString const &dcIdentifier_) { setObject(dc::identifier::iri(), AutoGen::Value< QString >::toNode(dcIdentifier_ )); } /* \fn QString firstDcIdentifier() Returns the first property \ref dc_identifier "dc:identifier". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcIdentifier() { return AutoGen::Value< QString >::fromNode(firstObject< dc::identifier >()); } /* \fn void addDcIdentifier(QString const &dcIdentifier_) Adds the given \a dcIdentifier_ to the property \ref dc_identifier "dc:identifier" set. \sa LiveResource::addObject */ void addDcIdentifier(QString const &dcIdentifier_) { addObject(dc::identifier::iri(), AutoGen::Value< QString >::toNode(dcIdentifier_)); } /* \fn void removeDcIdentifier(QString const &dcIdentifier_) Removes the given \a dcIdentifier_ from the property \ref dc_identifier "dc:identifier" set. \sa LiveResource::removeObject */ void removeDcIdentifier(QString const &dcIdentifier_) { removeObject(dc::identifier::iri(), AutoGen::Value< QString >::toNode(dcIdentifier_)); } /* Property generated from dc:description * \n An account of the resource. * \n rdfs:label=Description * \n nrl:maxCardinality=1 * \n rdfs:range=xsd:string * \n rdfs:domain=rdfs:Resource * \n tracker:weight=3 * \n tracker:modified=2269 * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcDescriptions(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_description "dc:description" set. \sa LiveResource::liveObjects */ LiveNodes liveDcDescriptions(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::description >(object_info, strategy, parent); } /* \fn LiveNodes getDcDescriptions(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_description "dc:description" set. \sa LiveResource::getObjects */ LiveNodes getDcDescriptions(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::description >(object_info, strategy, parent); } /* \fn void setDcDescriptions(LiveNodes const &dcDescription_) Sets the property \ref dc_description "dc:description" set to the given \a dcDescription_ set. \sa LiveResource::setObjects */ void setDcDescriptions(LiveNodes const &dcDescription_) { setObjects(dc::description::iri(), dcDescription_); } /* \fn void removeDcDescriptions(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_description "dc:description" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcDescriptions(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::description::iri(), object_info); } /* \fn QString getDcDescription() Returns the property \ref dc_description "dc:description". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getDcDescription() { return AutoGen::Value< QString >::fromNode(getObject< dc::description >()); } /* \fn void setDcDescription(QString const &dcDescription_) Sets the property \ref dc_description "dc:description" to the given \a dcDescription. \sa LiveResource::setObject */ void setDcDescription(QString const &dcDescription_) { setObject(dc::description::iri(), AutoGen::Value< QString >::toNode(dcDescription_ )); } /* \fn QString firstDcDescription() Returns the first property \ref dc_description "dc:description". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcDescription() { return AutoGen::Value< QString >::fromNode(firstObject< dc::description >()); } /* \fn void addDcDescription(QString const &dcDescription_) Adds the given \a dcDescription_ to the property \ref dc_description "dc:description" set. \sa LiveResource::addObject */ void addDcDescription(QString const &dcDescription_) { addObject(dc::description::iri(), AutoGen::Value< QString >::toNode(dcDescription_)); } /* \fn void removeDcDescription(QString const &dcDescription_) Removes the given \a dcDescription_ from the property \ref dc_description "dc:description" set. \sa LiveResource::removeObject */ void removeDcDescription(QString const &dcDescription_) { removeObject(dc::description::iri(), AutoGen::Value< QString >::toNode(dcDescription_)); } /* Property generated from dc:relation * \n A related resource. * \n rdfs:range=xsd:string * \n rdfs:label=Relation * \n tracker:modified=2278 * \n rdfs:domain=rdfs:Resource * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcRelations(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_relation "dc:relation" set. \sa LiveResource::liveObjects */ LiveNodes liveDcRelations(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::relation >(object_info, strategy, parent); } /* \fn LiveNodes getDcRelations(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_relation "dc:relation" set. \sa LiveResource::getObjects */ LiveNodes getDcRelations(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::relation >(object_info, strategy, parent); } /* \fn void setDcRelations(LiveNodes const &dcRelation_) Sets the property \ref dc_relation "dc:relation" set to the given \a dcRelation_ set. \sa LiveResource::setObjects */ void setDcRelations(LiveNodes const &dcRelation_) { setObjects(dc::relation::iri(), dcRelation_); } /* \fn void removeDcRelations(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_relation "dc:relation" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcRelations(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::relation::iri(), object_info); } /* \fn QString firstDcRelation() Returns the first property \ref dc_relation "dc:relation". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcRelation() { return AutoGen::Value< QString >::fromNode(firstObject< dc::relation >()); } /* \fn void addDcRelation(QString const &dcRelation_) Adds the given \a dcRelation_ to the property \ref dc_relation "dc:relation" set. \sa LiveResource::addObject */ void addDcRelation(QString const &dcRelation_) { addObject(dc::relation::iri(), AutoGen::Value< QString >::toNode(dcRelation_)); } /* \fn void removeDcRelation(QString const &dcRelation_) Removes the given \a dcRelation_ from the property \ref dc_relation "dc:relation" set. \sa LiveResource::removeObject */ void removeDcRelation(QString const &dcRelation_) { removeObject(dc::relation::iri(), AutoGen::Value< QString >::toNode(dcRelation_)); } /* Property generated from rdfs:label * \n rdfs:range=xsd:string * \n tracker:modified=2253 * \n rdfs:domain=rdfs:Resource * \n tracker:added=2010-04-08T11:21:26Z * \n nrl:maxCardinality=1 */ /* \fn LiveNodes liveLabels(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref rdfs_label "rdfs:label" set. \sa LiveResource::liveObjects */ LiveNodes liveLabels(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< rdfs::label >(object_info, strategy, parent); } /* \fn LiveNodes getLabels(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref rdfs_label "rdfs:label" set. \sa LiveResource::getObjects */ LiveNodes getLabels(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< rdfs::label >(object_info, strategy, parent); } /* \fn void setLabels(LiveNodes const &label_) Sets the property \ref rdfs_label "rdfs:label" set to the given \a label_ set. \sa LiveResource::setObjects */ void setLabels(LiveNodes const &label_) { setObjects(rdfs::label::iri(), label_); } /* \fn void removeLabels(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref rdfs_label "rdfs:label" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeLabels(RDFVariable const &object_info = RDFVariable()) { removeObjects(rdfs::label::iri(), object_info); } /* \fn QString getLabel() Returns the property \ref rdfs_label "rdfs:label". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getLabel() { return AutoGen::Value< QString >::fromNode(getObject< rdfs::label >()); } /* \fn void setLabel(QString const &label_) Sets the property \ref rdfs_label "rdfs:label" to the given \a label. \sa LiveResource::setObject */ void setLabel(QString const &label_) { setObject(rdfs::label::iri(), AutoGen::Value< QString >::toNode(label_ )); } /* \fn QString firstLabel() Returns the first property \ref rdfs_label "rdfs:label". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstLabel() { return AutoGen::Value< QString >::fromNode(firstObject< rdfs::label >()); } /* \fn void addLabel(QString const &label_) Adds the given \a label_ to the property \ref rdfs_label "rdfs:label" set. \sa LiveResource::addObject */ void addLabel(QString const &label_) { addObject(rdfs::label::iri(), AutoGen::Value< QString >::toNode(label_)); } /* \fn void removeLabel(QString const &label_) Removes the given \a label_ from the property \ref rdfs_label "rdfs:label" set. \sa LiveResource::removeObject */ void removeLabel(QString const &label_) { removeObject(rdfs::label::iri(), AutoGen::Value< QString >::toNode(label_)); } /* Property generated from dc:creator * \n An entity primarily responsible for making the resource. * \n rdfs:label=Creator * \n nrl:maxCardinality=1 * \n rdfs:range=xsd:string * \n rdfs:domain=rdfs:Resource * \n tracker:weight=4 * \n tracker:modified=2267 * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcCreators(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_creator "dc:creator" set. \sa LiveResource::liveObjects */ LiveNodes liveDcCreators(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::creator >(object_info, strategy, parent); } /* \fn LiveNodes getDcCreators(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_creator "dc:creator" set. \sa LiveResource::getObjects */ LiveNodes getDcCreators(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::creator >(object_info, strategy, parent); } /* \fn void setDcCreators(LiveNodes const &dcCreator_) Sets the property \ref dc_creator "dc:creator" set to the given \a dcCreator_ set. \sa LiveResource::setObjects */ void setDcCreators(LiveNodes const &dcCreator_) { setObjects(dc::creator::iri(), dcCreator_); } /* \fn void removeDcCreators(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_creator "dc:creator" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcCreators(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::creator::iri(), object_info); } /* \fn QString getDcCreator() Returns the property \ref dc_creator "dc:creator". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getDcCreator() { return AutoGen::Value< QString >::fromNode(getObject< dc::creator >()); } /* \fn void setDcCreator(QString const &dcCreator_) Sets the property \ref dc_creator "dc:creator" to the given \a dcCreator. \sa LiveResource::setObject */ void setDcCreator(QString const &dcCreator_) { setObject(dc::creator::iri(), AutoGen::Value< QString >::toNode(dcCreator_ )); } /* \fn QString firstDcCreator() Returns the first property \ref dc_creator "dc:creator". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcCreator() { return AutoGen::Value< QString >::fromNode(firstObject< dc::creator >()); } /* \fn void addDcCreator(QString const &dcCreator_) Adds the given \a dcCreator_ to the property \ref dc_creator "dc:creator" set. \sa LiveResource::addObject */ void addDcCreator(QString const &dcCreator_) { addObject(dc::creator::iri(), AutoGen::Value< QString >::toNode(dcCreator_)); } /* \fn void removeDcCreator(QString const &dcCreator_) Removes the given \a dcCreator_ from the property \ref dc_creator "dc:creator" set. \sa LiveResource::removeObject */ void removeDcCreator(QString const &dcCreator_) { removeObject(dc::creator::iri(), AutoGen::Value< QString >::toNode(dcCreator_)); } /* Property generated from rdfs:comment * \n rdfs:range=xsd:string * \n tracker:modified=2252 * \n rdfs:domain=rdfs:Resource * \n tracker:added=2010-04-08T11:21:26Z * \n nrl:maxCardinality=1 */ /* \fn LiveNodes liveComments(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref rdfs_comment "rdfs:comment" set. \sa LiveResource::liveObjects */ LiveNodes liveComments(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< rdfs::comment >(object_info, strategy, parent); } /* \fn LiveNodes getComments(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref rdfs_comment "rdfs:comment" set. \sa LiveResource::getObjects */ LiveNodes getComments(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< rdfs::comment >(object_info, strategy, parent); } /* \fn void setComments(LiveNodes const &comment_) Sets the property \ref rdfs_comment "rdfs:comment" set to the given \a comment_ set. \sa LiveResource::setObjects */ void setComments(LiveNodes const &comment_) { setObjects(rdfs::comment::iri(), comment_); } /* \fn void removeComments(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref rdfs_comment "rdfs:comment" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeComments(RDFVariable const &object_info = RDFVariable()) { removeObjects(rdfs::comment::iri(), object_info); } /* \fn QString getComment() Returns the property \ref rdfs_comment "rdfs:comment". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getComment() { return AutoGen::Value< QString >::fromNode(getObject< rdfs::comment >()); } /* \fn void setComment(QString const &comment_) Sets the property \ref rdfs_comment "rdfs:comment" to the given \a comment. \sa LiveResource::setObject */ void setComment(QString const &comment_) { setObject(rdfs::comment::iri(), AutoGen::Value< QString >::toNode(comment_ )); } /* \fn QString firstComment() Returns the first property \ref rdfs_comment "rdfs:comment". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstComment() { return AutoGen::Value< QString >::fromNode(firstObject< rdfs::comment >()); } /* \fn void addComment(QString const &comment_) Adds the given \a comment_ to the property \ref rdfs_comment "rdfs:comment" set. \sa LiveResource::addObject */ void addComment(QString const &comment_) { addObject(rdfs::comment::iri(), AutoGen::Value< QString >::toNode(comment_)); } /* \fn void removeComment(QString const &comment_) Removes the given \a comment_ from the property \ref rdfs_comment "rdfs:comment" set. \sa LiveResource::removeObject */ void removeComment(QString const &comment_) { removeObject(rdfs::comment::iri(), AutoGen::Value< QString >::toNode(comment_)); } /* Property generated from dc:type * \n The nature or genre of the resource. * \n rdfs:label=Type * \n nrl:maxCardinality=1 * \n rdfs:range=xsd:string * \n rdfs:domain=rdfs:Resource * \n tracker:modified=2273 * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcTypes(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_type "dc:type" set. \sa LiveResource::liveObjects */ LiveNodes liveDcTypes(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::type >(object_info, strategy, parent); } /* \fn LiveNodes getDcTypes(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_type "dc:type" set. \sa LiveResource::getObjects */ LiveNodes getDcTypes(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::type >(object_info, strategy, parent); } /* \fn void setDcTypes(LiveNodes const &dcType_) Sets the property \ref dc_type "dc:type" set to the given \a dcType_ set. \sa LiveResource::setObjects */ void setDcTypes(LiveNodes const &dcType_) { setObjects(dc::type::iri(), dcType_); } /* \fn void removeDcTypes(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_type "dc:type" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcTypes(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::type::iri(), object_info); } /* \fn QString getDcType() Returns the property \ref dc_type "dc:type". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getDcType() { return AutoGen::Value< QString >::fromNode(getObject< dc::type >()); } /* \fn void setDcType(QString const &dcType_) Sets the property \ref dc_type "dc:type" to the given \a dcType. \sa LiveResource::setObject */ void setDcType(QString const &dcType_) { setObject(dc::type::iri(), AutoGen::Value< QString >::toNode(dcType_ )); } /* \fn QString firstDcType() Returns the first property \ref dc_type "dc:type". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcType() { return AutoGen::Value< QString >::fromNode(firstObject< dc::type >()); } /* \fn void addDcType(QString const &dcType_) Adds the given \a dcType_ to the property \ref dc_type "dc:type" set. \sa LiveResource::addObject */ void addDcType(QString const &dcType_) { addObject(dc::type::iri(), AutoGen::Value< QString >::toNode(dcType_)); } /* \fn void removeDcType(QString const &dcType_) Removes the given \a dcType_ from the property \ref dc_type "dc:type" set. \sa LiveResource::removeObject */ void removeDcType(QString const &dcType_) { removeObject(dc::type::iri(), AutoGen::Value< QString >::toNode(dcType_)); } /* Property generated from dc:language * \n A language of the resource. * \n rdfs:label=Language * \n nrl:maxCardinality=1 * \n rdfs:range=xsd:string * \n rdfs:domain=rdfs:Resource * \n tracker:modified=2277 * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcLanguages(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_language "dc:language" set. \sa LiveResource::liveObjects */ LiveNodes liveDcLanguages(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::language >(object_info, strategy, parent); } /* \fn LiveNodes getDcLanguages(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_language "dc:language" set. \sa LiveResource::getObjects */ LiveNodes getDcLanguages(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::language >(object_info, strategy, parent); } /* \fn void setDcLanguages(LiveNodes const &dcLanguage_) Sets the property \ref dc_language "dc:language" set to the given \a dcLanguage_ set. \sa LiveResource::setObjects */ void setDcLanguages(LiveNodes const &dcLanguage_) { setObjects(dc::language::iri(), dcLanguage_); } /* \fn void removeDcLanguages(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_language "dc:language" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcLanguages(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::language::iri(), object_info); } /* \fn QString getDcLanguage() Returns the property \ref dc_language "dc:language". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getDcLanguage() { return AutoGen::Value< QString >::fromNode(getObject< dc::language >()); } /* \fn void setDcLanguage(QString const &dcLanguage_) Sets the property \ref dc_language "dc:language" to the given \a dcLanguage. \sa LiveResource::setObject */ void setDcLanguage(QString const &dcLanguage_) { setObject(dc::language::iri(), AutoGen::Value< QString >::toNode(dcLanguage_ )); } /* \fn QString firstDcLanguage() Returns the first property \ref dc_language "dc:language". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcLanguage() { return AutoGen::Value< QString >::fromNode(firstObject< dc::language >()); } /* \fn void addDcLanguage(QString const &dcLanguage_) Adds the given \a dcLanguage_ to the property \ref dc_language "dc:language" set. \sa LiveResource::addObject */ void addDcLanguage(QString const &dcLanguage_) { addObject(dc::language::iri(), AutoGen::Value< QString >::toNode(dcLanguage_)); } /* \fn void removeDcLanguage(QString const &dcLanguage_) Removes the given \a dcLanguage_ from the property \ref dc_language "dc:language" set. \sa LiveResource::removeObject */ void removeDcLanguage(QString const &dcLanguage_) { removeObject(dc::language::iri(), AutoGen::Value< QString >::toNode(dcLanguage_)); } /* Property generated from dc:coverage * \n The spatial or temporal topic of the resource, the spatial applicability of the resource, or the jurisdiction under which the resource is relevant. * \n rdfs:label=Coverage * \n nrl:maxCardinality=1 * \n rdfs:range=xsd:string * \n rdfs:domain=rdfs:Resource * \n tracker:modified=2279 * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcCoverages(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_coverage "dc:coverage" set. \sa LiveResource::liveObjects */ LiveNodes liveDcCoverages(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::coverage >(object_info, strategy, parent); } /* \fn LiveNodes getDcCoverages(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_coverage "dc:coverage" set. \sa LiveResource::getObjects */ LiveNodes getDcCoverages(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::coverage >(object_info, strategy, parent); } /* \fn void setDcCoverages(LiveNodes const &dcCoverage_) Sets the property \ref dc_coverage "dc:coverage" set to the given \a dcCoverage_ set. \sa LiveResource::setObjects */ void setDcCoverages(LiveNodes const &dcCoverage_) { setObjects(dc::coverage::iri(), dcCoverage_); } /* \fn void removeDcCoverages(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_coverage "dc:coverage" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcCoverages(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::coverage::iri(), object_info); } /* \fn QString getDcCoverage() Returns the property \ref dc_coverage "dc:coverage". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getDcCoverage() { return AutoGen::Value< QString >::fromNode(getObject< dc::coverage >()); } /* \fn void setDcCoverage(QString const &dcCoverage_) Sets the property \ref dc_coverage "dc:coverage" to the given \a dcCoverage. \sa LiveResource::setObject */ void setDcCoverage(QString const &dcCoverage_) { setObject(dc::coverage::iri(), AutoGen::Value< QString >::toNode(dcCoverage_ )); } /* \fn QString firstDcCoverage() Returns the first property \ref dc_coverage "dc:coverage". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcCoverage() { return AutoGen::Value< QString >::fromNode(firstObject< dc::coverage >()); } /* \fn void addDcCoverage(QString const &dcCoverage_) Adds the given \a dcCoverage_ to the property \ref dc_coverage "dc:coverage" set. \sa LiveResource::addObject */ void addDcCoverage(QString const &dcCoverage_) { addObject(dc::coverage::iri(), AutoGen::Value< QString >::toNode(dcCoverage_)); } /* \fn void removeDcCoverage(QString const &dcCoverage_) Removes the given \a dcCoverage_ from the property \ref dc_coverage "dc:coverage" set. \sa LiveResource::removeObject */ void removeDcCoverage(QString const &dcCoverage_) { removeObject(dc::coverage::iri(), AutoGen::Value< QString >::toNode(dcCoverage_)); } /* Property generated from dc:subject * \n The topic of the resource. * \n rdfs:label=Subject * \n nrl:maxCardinality=1 * \n rdfs:range=xsd:string * \n rdfs:domain=rdfs:Resource * \n tracker:weight=5 * \n tracker:modified=2268 * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveDcSubjects(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref dc_subject "dc:subject" set. \sa LiveResource::liveObjects */ LiveNodes liveDcSubjects(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< dc::subject >(object_info, strategy, parent); } /* \fn LiveNodes getDcSubjects(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref dc_subject "dc:subject" set. \sa LiveResource::getObjects */ LiveNodes getDcSubjects(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< dc::subject >(object_info, strategy, parent); } /* \fn void setDcSubjects(LiveNodes const &dcSubject_) Sets the property \ref dc_subject "dc:subject" set to the given \a dcSubject_ set. \sa LiveResource::setObjects */ void setDcSubjects(LiveNodes const &dcSubject_) { setObjects(dc::subject::iri(), dcSubject_); } /* \fn void removeDcSubjects(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref dc_subject "dc:subject" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeDcSubjects(RDFVariable const &object_info = RDFVariable()) { removeObjects(dc::subject::iri(), object_info); } /* \fn QString getDcSubject() Returns the property \ref dc_subject "dc:subject". If the property didn't exist, it is set to a default initialized value of type QString and returned. \sa LiveResource::getObject */ QString getDcSubject() { return AutoGen::Value< QString >::fromNode(getObject< dc::subject >()); } /* \fn void setDcSubject(QString const &dcSubject_) Sets the property \ref dc_subject "dc:subject" to the given \a dcSubject. \sa LiveResource::setObject */ void setDcSubject(QString const &dcSubject_) { setObject(dc::subject::iri(), AutoGen::Value< QString >::toNode(dcSubject_ )); } /* \fn QString firstDcSubject() Returns the first property \ref dc_subject "dc:subject". If the property didn't exist, a default value is returned. \sa LiveResource::firstObject */ QString firstDcSubject() { return AutoGen::Value< QString >::fromNode(firstObject< dc::subject >()); } /* \fn void addDcSubject(QString const &dcSubject_) Adds the given \a dcSubject_ to the property \ref dc_subject "dc:subject" set. \sa LiveResource::addObject */ void addDcSubject(QString const &dcSubject_) { addObject(dc::subject::iri(), AutoGen::Value< QString >::toNode(dcSubject_)); } /* \fn void removeDcSubject(QString const &dcSubject_) Removes the given \a dcSubject_ from the property \ref dc_subject "dc:subject" set. \sa LiveResource::removeObject */ void removeDcSubject(QString const &dcSubject_) { removeObject(dc::subject::iri(), AutoGen::Value< QString >::toNode(dcSubject_)); } // } }; /* Class generated from rdfs:Class * \ingroup onto_rdfs_classes * * rdfs:label = Class * * tracker:modified = 2059 * * tracker:added = 2010-04-08T11:21:26Z * * \b Properties \b having \b this \b class \b as \b Range \n * \ref rdfs_range "rdfs:range" * \ref rdfs_subClassOf "rdfs:subClassOf" * \ref rdf_type "rdf:type" */ class Class : public virtual Resource { // Q_OBJECT public: /* \return encoded iri of this class */ static const char *encodedIri() { return "http://www.w3.org/2000/01/rdf-schema#Class"; } /* \return iri of this class */ static QUrl const &iri() { static QUrl *ret = 0; if(!ret) ret = new QUrl(QUrl::fromEncoded(encodedIri(), QUrl::StrictMode)); return *ret; } typedef QPair<Resource, ::SopranoLive::Detail::EmptyBase > BaseClasses; // The defining context of this class typedef ::SopranoLive::Contexts::Core ResourceContext; // When used as a resource, this class has a type rdfs:Class typedef rdfs::Class ResourceType; // the ontology of this class typedef Ontology_rdfs Ontology; /// The base strategy of this class enum { BaseStrategy = 0 }; /// The base classes of this class /* * A smart, by-value convenience smart \ref SopranoLive::Live pointer to this class */ typedef ::SopranoLive::Live<Class> Live; Class() { this->attachInterfaceHelper< Class >(); } ~Class() { this->detachInterfaceHelper< Class >(); } /* * \name Property accessor and manipulator methods */ // { /* Property generated from rdfs:subClassOf * \n rdfs:range=rdfs:Class * \n tracker:modified=2250 * \n rdfs:domain=rdfs:Class * \n tracker:added=2010-04-08T11:21:26Z */ /* \fn LiveNodes liveSubClassOfs(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns a live model of property \ref rdfs_subClassOf "rdfs:subClassOf" set. \sa LiveResource::liveObjects */ LiveNodes liveSubClassOfs(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return liveObjects< rdfs::subClassOf >(object_info, strategy, parent); } /* \fn LiveNodes getSubClassOfs(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) Returns all current values of property \ref rdfs_subClassOf "rdfs:subClassOf" set. \sa LiveResource::getObjects */ LiveNodes getSubClassOfs(RDFVariable const &object_info = RDFVariable(), RDFStrategyFlags strategy = RDFStrategy::DefaultStrategy, QSharedPointer<QObject> const &parent = QSharedPointer<QObject>()) { return getObjects< rdfs::subClassOf >(object_info, strategy, parent); } /* \fn void setSubClassOfs(LiveNodes const &subClassOf_) Sets the property \ref rdfs_subClassOf "rdfs:subClassOf" set to the given \a subClassOf_ set. \sa LiveResource::setObjects */ void setSubClassOfs(LiveNodes const &subClassOf_) { setObjects(rdfs::subClassOf::iri(), subClassOf_); } /* \fn void removeSubClassOfs(RDFVariable const &object_info = RDFVariable()) Removes the properties from property \ref rdfs_subClassOf "rdfs:subClassOf" set which match the given \a object_info . \sa LiveResource::removeObjects */ void removeSubClassOfs(RDFVariable const &object_info = RDFVariable()) { removeObjects(rdfs::subClassOf::iri(), object_info); } /* \fn ::SopranoLive::Live< Class > firstSubClassOf() Returns the first property \ref rdfs_subClassOf "rdfs:subClassOf". If the property didn't exist, a null LiveNode is returned. \sa LiveResource::firstObject */ ::SopranoLive::Live< Class > firstSubClassOf() { return firstObject< rdfs::subClassOf >(); } /* \fn ::SopranoLive::Live< Class > addSubClassOf() Adds a new uniquely named resource to the property \ref rdfs_subClassOf "rdfs:subClassOf" set and returns a live version of it. \sa LiveResource::addObject */ ::SopranoLive::Live< Class > addSubClassOf() { return addObject< rdfs::subClassOf >(); } /* \fn ::SopranoLive::Live< Class > addSubClassOf(::SopranoLive::Live< Class > const &subClassOf_) Adds the given \a subClassOf_ to the property \ref rdfs_subClassOf "rdfs:subClassOf" set and returns a live version of it. \sa LiveResource::addObject */ ::SopranoLive::Live< Class > addSubClassOf(::SopranoLive::Live< Class > const &subClassOf_) { return addObject(rdfs::subClassOf::iri(), subClassOf_); } /* \fn void removeSubClassOf(::SopranoLive::Live< Class > const &subClassOf_) Removes the given \a subClassOf_ from the property \ref rdfs_subClassOf "rdfs:subClassOf" set. \sa LiveResource::removeObject */ void removeSubClassOf(::SopranoLive::Live< Class > const &subClassOf_) { removeObject(rdfs::subClassOf::iri(), subClassOf_); } // } }; /* Class generated from rdfs:Literal * \ingroup onto_rdfs_classes * * rdfs:label = Literal * * tracker:modified = 2061 * * tracker:added = 2010-04-08T11:21:26Z */ class Literal : public virtual Resource { // Q_OBJECT public: /* \return encoded iri of this class */ static const char *encodedIri() { return "http://www.w3.org/2000/01/rdf-schema#Literal"; } /* \return iri of this class */ static QUrl const &iri() { static QUrl *ret = 0; if(!ret) ret = new QUrl(QUrl::fromEncoded(encodedIri(), QUrl::StrictMode)); return *ret; } typedef QPair<Resource, ::SopranoLive::Detail::EmptyBase > BaseClasses; // The defining context of this class typedef ::SopranoLive::Contexts::Core ResourceContext; // When used as a resource, this class has a type rdfs:Class typedef rdfs::Class ResourceType; // the ontology of this class typedef Ontology_rdfs Ontology; /// The base strategy of this class enum { BaseStrategy = 0 }; /// The base classes of this class /* * A smart, by-value convenience smart \ref SopranoLive::Live pointer to this class */ typedef ::SopranoLive::Live<Literal> Live; Literal() { this->attachInterfaceHelper< Literal >(); } ~Literal() { this->detachInterfaceHelper< Literal >(); } /* * \name Property accessor and manipulator methods */ // { // } }; } } } } Q_DECLARE_METATYPE(SopranoLive::Ontologies::Core::rdfs::Class::Live) Q_DECLARE_METATYPE(SopranoLive::Ontologies::Core::rdfs::Literal::Live) Q_DECLARE_METATYPE(SopranoLive::Ontologies::Core::rdfs::Resource::Live) #endif /* SOPRANOLIVE_ONTOLOGIESGENERAL_RDFS_H_CLASS_DEFINITIONS */ #endif /* ( ( !defined(SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_ONLY) && !defined(SOPRANOLIVE_ONTOLOGIESGENERAL_FORWARD_DECLARATIONS_AND_PROPERTY_DEFINITIONS_ONLY)) || defined(Q_MOC_RUN)) */ #if !defined(SOPRANOLIVE_ONTOLOGIESGENERAL_TOP_LEVEL_INCLUDING) && !defined(SOPRANOLIVE_ONTOLOGIESGENERAL_RDFS_H_POST_INCLUDES) #define SOPRANOLIVE_ONTOLOGIESGENERAL_RDFS_H_POST_INCLUDES #include "dc.h" #include "rdf.h" #include "xsd.h" #endif
lgpl-2.1
OPENDAP/olfs
src/opendap/hai/BesControlApi.java
15055
/* * ///////////////////////////////////////////////////////////////////////////// * // This file is part of the "Hyrax Data Server" project. * // * // * // Copyright (c) 2013 OPeNDAP, Inc. * // Author: Nathan David Potter <ndp@opendap.org> * // * // This library is free software; you can redistribute it and/or * // modify it under the terms of the GNU Lesser General Public * // License as published by the Free Software Foundation; either * // version 2.1 of the License, or (at your option) any later version. * // * // This library is distributed in the hope that it will be useful, * // but WITHOUT ANY WARRANTY; without even the implied warranty of * // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * // Lesser General Public License for more details. * // * // You should have received a copy of the GNU Lesser General Public * // License along with this library; if not, write to the Free Software * // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * // * // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112. * ///////////////////////////////////////////////////////////////////////////// */ package opendap.hai; import opendap.bes.BES; import opendap.bes.BESManager; import opendap.bes.BesAdminFail; import opendap.bes.BesGroup; import opendap.coreServlet.HttpResponder; import opendap.coreServlet.ResourceInfo; import opendap.coreServlet.Scrub; import opendap.io.HyraxStringEncoding; import org.apache.commons.lang.StringEscapeUtils; import org.jdom.Document; import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.input.SAXBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.*; public class BesControlApi extends HttpResponder { private Logger log; private static String defaultRegex = ".*\\/besctl"; public void init() { log = LoggerFactory.getLogger(getClass()); log.debug("Initializing BES Controller."); } public BesControlApi(String sysPath) { super(sysPath, null, defaultRegex); init(); } public BesControlApi(String sysPath, String pathPrefix) { super(sysPath, pathPrefix, defaultRegex); init(); } @Override public ResourceInfo getResourceInfo(String resourceName) throws Exception { return null; //To change body of implemented methods use File | Settings | File Templates. } @Override public long getLastModified(HttpServletRequest request) throws Exception { return new Date().getTime(); //To change body of implemented methods use File | Settings | File Templates. } public void respondToHttpGetRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { controlApi(request,response,false); } @Override public void respondToHttpPostRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { controlApi(request,response,true); } private void controlApi(HttpServletRequest request, HttpServletResponse response, boolean isPost) throws IOException { StringBuilder sb = new StringBuilder(); Enumeration headers = request.getHeaderNames(); while(headers.hasMoreElements()){ String headerName = (String) headers.nextElement(); String headerValue = request.getHeader(headerName); sb.append(" ").append(headerName).append(" = '").append(headerValue).append("'\n"); } log.debug("\nHTTP HEADERS:\n{}",sb); //log.debug("\nBODY:\n{}",getRequestBodyAsString(request)); HashMap<String,String> kvp = Util.processQuery(request); String status = null; try { status = processBesCommand(kvp, isPost); } catch (BesAdminFail baf){ status = baf.getMessage(); } PrintWriter output = response.getWriter(); //@todo work this out to not escape everything. //output.append(StringEscapeUtils.escapeHtml(status)); //String s = processStatus(status); output.append(status); output.flush(); } public String processStatus(String status){ StringBuilder s = new StringBuilder(); SAXBuilder sb = new SAXBuilder(false); ByteArrayInputStream bais = new ByteArrayInputStream(status.getBytes(HyraxStringEncoding.getCharset())); try { Document besResponseDoc = sb.build(bais); Element besResponse = besResponseDoc.getRootElement(); String errorResponse = processBesErrors(besResponse); if(errorResponse.length()==0){ Element ok = besResponse.getChild("OK",opendap.namespaces.BES.BES_ADMIN_NS); if(ok!=null){ s.append("OK"); } else { s.append("ERROR! Unrecognized BES response."); } } else { s.append(errorResponse); } } catch (JDOMException e) { s.append("Failed to parse BES response! Msg: ").append(e.getMessage()); log.error(s.toString()); } catch (IOException e) { s.append("Failed to ingest BES response! Msg: ").append(e.getMessage()); log.error(s.toString()); } return s.toString(); } public String besLogTailResponse(String logResponse){ StringBuilder s = new StringBuilder(); SAXBuilder sb = new SAXBuilder(false); ByteArrayInputStream bais = new ByteArrayInputStream(logResponse.getBytes(HyraxStringEncoding.getCharset())); try { Document besResponseDoc = sb.build(bais); Element besResponse = besResponseDoc.getRootElement(); String errorResponse = processBesErrors(besResponse); if(errorResponse.length()==0){ Element besLog = besResponse.getChild("BesLog",opendap.namespaces.BES.BES_ADMIN_NS); if(besLog!=null){ s.append(besLog.getText()); } else { s.append("ERROR! Unrecognized BES response."); } } else { s.append(errorResponse); } } catch (JDOMException e) { s.append("Failed to parse BES response! Msg: ").append(e.getMessage()); log.error(s.toString()); } catch (IOException e) { s.append("Failed to ingest BES response! Msg: ").append(e.getMessage()); log.error(s.toString()); } return s.toString(); } private String processBesErrors(Element topElem){ StringBuilder s = new StringBuilder(); List errors = topElem.getChildren("BESError", opendap.namespaces.BES.BES_ADMIN_NS); if(!errors.isEmpty()) { for(Object o: errors){ Element error = (Element) o; Element msgElem = error.getChild("Message",opendap.namespaces.BES.BES_ADMIN_NS); Element typeElem = error.getChild("Type",opendap.namespaces.BES.BES_ADMIN_NS); String msg = "BES ERROR Message Is Missing"; if(msgElem!=null) msg = msgElem.getTextNormalize(); String type = "BES ERROR Type Is Missing"; if(typeElem!=null) type = typeElem.getTextNormalize(); s.append("Error[").append(type).append("]: ").append(msg).append("\n"); } } return s.toString(); } private enum besCmds { cmd, prefix, Start, StopNice, StopNow, getConfig, module, setConfig, CONFIGURATION, getLog, lines, getLoggerState, setLoggerState, logger, state, setLoggerStates, enable, disable, on, off } /** * * @param kvp * @return */ public String processBesCommand(HashMap<String, String> kvp, boolean isPost) throws BesAdminFail { StringBuilder sb = new StringBuilder(); StringBuilder status = new StringBuilder(); String module, loggerName, loggerState; String besCmd = kvp.get("cmd"); String currentPrefix = kvp.get("prefix"); String currentBesName = kvp.get("besName"); if (currentPrefix!=null && currentBesName!=null && besCmd != null) { BesGroup besGroup = BESManager.getBesGroup(currentPrefix); BES bes = besGroup.get(currentBesName); if(bes!=null){ switch(besCmds.valueOf(besCmd)){ case Start: sb.append(processStatus(bes.start())); break; case StopNice: sb.append(processStatus(bes.stopNice(3000))); break; case StopNow: sb.append(processStatus(bes.stopNow())); break; case getConfig: module = kvp.get(besCmds.module.toString()); /* sb.append("You issued a getConfig command"); if(module!=null) sb.append(" for module '").append(module).append("'.\n"); else sb.append(".\n"); */ status.append(bes.getConfiguration(module)); sb.append(status); break; case setConfig: String submittedConfiguration = kvp.get(besCmds.CONFIGURATION.toString()); if(isPost && submittedConfiguration!=null ){ module = kvp.get(besCmds.module.toString()); /* sb.append("You issued a setConfig command"); if(module!=null) sb.append(" for module '").append(module).append("'.\n"); else sb.append(".\n"); sb.append("Your Configuration: \n"); sb.append(submittedConfiguration); */ status.append(bes.setConfiguration(module, submittedConfiguration)); sb.append(processStatus(status.toString())); } else { sb.append("In order to use the setConfig command you MUST supply a configuration via HTTP POST content.\n"); } break; case getLog: String logLines = kvp.get("lines"); String logContent = bes.getLog(logLines); logContent = besLogTailResponse(logContent); logContent = StringEscapeUtils.escapeXml(logContent); sb.append(logContent); break; case getLoggerState: loggerName = getValidLoggerName(bes, kvp.get(besCmds.logger.toString())); status.append(bes.getLoggerState(loggerName)); sb.append(status); break; case setLoggerState: loggerName = getValidLoggerName(bes, kvp.get(besCmds.logger.toString())); if(loggerName != null){ loggerState = getValidLoggerState(kvp.get(besCmds.state.toString())); status = new StringBuilder(); status.append(bes.setLoggerState(loggerName,loggerState)).append("\n"); sb.append(status); } else { sb.append("User requested an unknown logger."); } break; case setLoggerStates: String enabledLoggers = kvp.get(besCmds.enable.toString()); String disabledLoggers = kvp.get(besCmds.disable.toString()); status = new StringBuilder(); for (String enabledLoggerName : enabledLoggers.split(",")) { loggerName = getValidLoggerName(bes, enabledLoggerName); if (loggerName != null) status.append(bes.setLoggerState(loggerName, besCmds.on.toString())).append("\n"); } for (String disabledLoggerName : disabledLoggers.split(",")) { loggerName = getValidLoggerName(bes, disabledLoggerName); if (loggerName != null) status.append(bes.setLoggerState(loggerName, besCmds.off.toString())).append("\n"); } sb.append(status); break; default: sb.append(" Unrecognized BES command: ").append(Scrub.simpleString(besCmd)); break; } } else { String cleanPrefix = Scrub.fileName(currentPrefix); String cleanBesName= Scrub.fileName(currentBesName); sb.append("The BES group associated with the prefix '").append(cleanPrefix).append("' "); sb.append("does not contain a BES associated with the name '").append(cleanBesName).append("' "); log.error("OUCH!! The BESManager failed to locate a BES named '{}' in the BesGroup associated " + "with the prefix '{}'",cleanBesName,cleanPrefix); } } else { sb.append(" Waiting for you to do something..."); } return sb.toString(); } private String getValidLoggerName(BES bes, String loggerName) throws BesAdminFail { TreeMap<String,BES.BesLogger> validLoggers = bes.getBesLoggers(); if(validLoggers.containsKey(loggerName)){ BES.BesLogger besLogger = validLoggers.get(loggerName); return besLogger.getName(); } log.debug("User requested unknown BES logger: '{}'", loggerName); return null; } private String getValidLoggerState(String loggerState) throws BesAdminFail { if(!loggerState.equals(besCmds.on.toString())) loggerState = besCmds.off.toString(); return loggerState; } }
lgpl-2.1
developwith/wildfly-torquebox
jruby/lib/ruby/gems/shared/gems/torquebox-core-3.1.0-java/spec/logger_spec.rb
2854
require 'torquebox/logger' require 'fileutils' require 'logger' shared_examples_for 'a torquebox logger' do it "should look nice for class objects" do require 'torquebox/service_registry' logger = TorqueBox::Logger.new(TorqueBox::ServiceRegistry) logger.error("JC: log for cache store") end it "should support the various boolean methods" do logger.should respond_to(:debug?) logger.should respond_to(:info?) logger.should respond_to(:warn?) logger.should respond_to(:error?) logger.should respond_to(:fatal?) end it "should not barf on meaningless level setting" do logger.level = Logger::WARN logger.level.should == Logger::WARN end it "should deal with blocks correctly" do logger.error "JC: message zero" logger.error { "JC: message" } logger.error "JC: message too" end it "should handle nil parameters" do logger.info(nil) end it "should support the rack.errors interface" do logger.should respond_to(:puts) logger.should respond_to(:write) logger.should respond_to(:flush) end it "should have a formatter" do logger.should respond_to(:formatter) logger.formatter.should_not be_nil end end describe TorqueBox::Logger do let(:logger) { TorqueBox::Logger.new } it_should_behave_like 'a torquebox logger' it "should support the trace boolean method" do logger.should respond_to(:trace?) end it "should support the add method" do fake_logger = mock('logger') org.jboss.logging::Logger.stub!(:getLogger).and_return(fake_logger) logger = TorqueBox::Logger.new fake_logger.should_receive(:debug).with('debug') logger.add(Logger::DEBUG, 'debug', nil) fake_logger.should_receive(:info).with('info') logger.add(Logger::INFO, 'info', nil) fake_logger.should_receive(:warn).with('warning') logger.add(Logger::WARN, 'warning', nil) fake_logger.should_receive(:error).with('error') logger.add(Logger::ERROR, 'error', nil) fake_logger.should_receive(:warn).with('unknown') logger.add(Logger::UNKNOWN, 'unknown', nil) fake_logger.should_receive(:warn).with('block') logger.add(Logger::WARN, nil, nil) { 'block' } end end describe TorqueBox::FallbackLogger do before(:each) do @log_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'target', 'logger_spec_output.log')) ENV['TORQUEBOX_FALLBACK_LOGFILE'] = @log_path end after(:each) do FileUtils.rm_f(@log_path) end let(:logger) { TorqueBox::FallbackLogger.new } it_should_behave_like 'a torquebox logger' it "should let users override the fallback log file" do logger.info('testing fallback log file') File.read(@log_path).should include('testing fallback log file') end end
lgpl-2.1
rsfreitas/libcollections
examples/plugin/java/Jplugin.java
5169
import cplugin.CpluginEntryAPI; import cplugin.CpluginModule; /** * We need to follow the Java coding style and keep the main class with the * same name as the source file. This is required by the libcollections. * * Another requirement is the class constructor, it must receive no arguments. */ public class Jplugin implements CpluginEntryAPI, CpluginModule { private final String name = "jplugin"; private final String version = "0.1"; private final String creator = "Rodrigo Freitas"; private final String description = "Java plugin example"; private final String API = "{" + "\"API\": [" + "{ \"name\": \"foo_int\", \"return_type\": \"int\" }," + "{ \"name\": \"foo_uint\", \"return_type\": \"uint\" }," + "{ \"name\": \"foo_char\", \"return_type\": \"char\" }," + "{ \"name\": \"foo_uchar\", \"return_type\": \"uchar\" }," + "{ \"name\": \"foo_sint\", \"return_type\": \"sint\" }," + "{ \"name\": \"foo_usint\", \"return_type\": \"usint\" }," + "{ \"name\": \"foo_float\", \"return_type\": \"float\" }," + "{ \"name\": \"foo_double\", \"return_type\": \"double\" }," + "{ \"name\": \"foo_long\", \"return_type\": \"long\" }," + "{ \"name\": \"foo_ulong\", \"return_type\": \"ulong\" }," + "{ \"name\": \"foo_llong\", \"return_type\": \"llong\" }," + "{ \"name\": \"foo_ullong\", \"return_type\": \"ullong\" }," + "{ \"name\": \"foo_boolean\", \"return_type\": \"boolean\" }," + "{ \"name\": \"foo_args\", \"return_type\": \"void\", \"arguments\": [" + "{ \"name\": \"arg1\", \"type\": \"int\" }," + "{ \"name\": \"arg2\", \"type\": \"uint\" }," + "{ \"name\": \"arg3\", \"type\": \"sint\" }," + "{ \"name\": \"arg4\", \"type\": \"usint\" }," + "{ \"name\": \"arg5\", \"type\": \"char\" }," + "{ \"name\": \"arg6\", \"type\": \"uchar\" }," + "{ \"name\": \"arg7\", \"type\": \"float\" }," + "{ \"name\": \"arg8\", \"type\": \"double\" }," + "{ \"name\": \"arg9\", \"type\": \"long\" }," + "{ \"name\": \"arg10\", \"type\": \"ulong\" }," + "{ \"name\": \"arg11\", \"type\": \"llong\" }," + "{ \"name\": \"arg12\", \"type\": \"ullong\" }," + "{ \"name\": \"arg13\", \"type\": \"boolean\" }," + "{ \"name\": \"arg14\", \"type\": \"string\" }" + "] }" + "]"+ "}"; /** Module info functions */ @Override public String getName() { System.out.println("getName"); return name; } @Override public String getVersion() { System.out.println("getVersion"); return version; } @Override public String getAuthor() { System.out.println("getAuthor"); return creator; } @Override public String getDescription() { System.out.println("getDescription"); return description; } @Override public String getAPI() { System.out.println("getAPI"); return API; } /** Module init/uninit functions */ @Override public int module_init() { System.out.println("module init"); return 0; } @Override public void module_uninit() { System.out.println("module uninit"); } Jplugin() { System.out.println("Constructor"); } /** Module API Examples */ public int foo_int() { System.out.println("foo_int"); return 42; } public int foo_uint() { System.out.println("foo_uint"); return 420; } public short foo_sint() { System.out.println("foo_sint"); return 421; } public short foo_usint() { System.out.println("foo_usint"); return 4201; } public byte foo_char() { System.out.println("foo_char"); return 'a'; } public byte foo_uchar() { System.out.println("foo_uchar"); return (byte)230; } public float foo_float() { System.out.println("foo_float"); return 42.5f; } public double foo_double() { System.out.println("foo_double"); return 4.2; } public boolean foo_boolean() { System.out.println("foo_boolean"); return true; } public int foo_long() { System.out.println("foo_long"); return 42000; } public int foo_ulong() { System.out.println("foo_ulong"); return 420001; } public long foo_llong() { System.out.println("foo_llong"); return 420009; } public long foo_ullong() { System.out.println("foo_ullong"); return 4200019; } /* With arguments, with return */ public void foo_args(String args) { /* XXX: The arguments are in a JSON format. */ System.out.println("Arguments: " + args); } public void outside_api() { System.out.println("I'm outside the API"); } }
lgpl-2.1
pocketbook-free/browser
midori-0.2.4/midori/midori-locationaction.c
57734
/* Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de> Copyright (C) 2008 Dale Whittaker <dayul@users.sf.net> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See the file COPYING for the full license text. */ #include "midori-locationaction.h" #include "gtkiconentry.h" #include "marshal.h" #include "sokoke.h" #include "midori-browser.h" #include <string.h> #include <glib/gi18n.h> #include <gdk/gdkkeysyms.h> #if HAVE_SQLITE #include <sqlite3.h> #endif #define COMPLETION_DELAY 150 #define MAX_ITEMS 25 struct _MidoriLocationAction { GtkAction parent_instance; gchar* text; gchar* uri; KatzeArray* search_engines; gdouble progress; gchar* secondary_icon; guint completion_timeout; gchar* key; GtkWidget* popup; GtkWidget* treeview; GtkTreeModel* completion_model; gint completion_index; GtkWidget* entry; GdkPixbuf* default_icon; KatzeArray* history; }; struct _MidoriLocationActionClass { GtkActionClass parent_class; }; G_DEFINE_TYPE (MidoriLocationAction, midori_location_action, GTK_TYPE_ACTION) enum { PROP_0, PROP_PROGRESS, PROP_SECONDARY_ICON, PROP_HISTORY }; enum { ACTIVE_CHANGED, FOCUS_IN, FOCUS_OUT, SECONDARY_ICON_RELEASED, RESET_URI, SUBMIT_URI, LAST_SIGNAL }; static guint signals[LAST_SIGNAL]; enum { FAVICON_COL, URI_COL, TITLE_COL, VISITS_COL, VISIBLE_COL, YALIGN_COL, BACKGROUND_COL, STYLE_COL, N_COLS }; static void midori_location_action_finalize (GObject* object); static void midori_location_action_set_property (GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec); static void midori_location_action_get_property (GObject* object, guint prop_id, GValue* value, GParamSpec* pspec); static void midori_location_action_activate (GtkAction* object); static GtkWidget* midori_location_action_create_tool_item (GtkAction* action); static void midori_location_action_connect_proxy (GtkAction* action, GtkWidget* proxy); static void midori_location_action_disconnect_proxy (GtkAction* action, GtkWidget* proxy); static void midori_location_entry_render_text_cb (GtkCellLayout* layout, GtkCellRenderer* renderer, GtkTreeModel* model, GtkTreeIter* iter, gpointer data); static void midori_location_action_popdown_completion (MidoriLocationAction* location_action); static void midori_location_action_class_init (MidoriLocationActionClass* class) { GObjectClass* gobject_class; GtkActionClass* action_class; signals[ACTIVE_CHANGED] = g_signal_new ("active-changed", G_TYPE_FROM_CLASS (class), (GSignalFlags) (G_SIGNAL_RUN_LAST), 0, 0, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); /** * MidoriLocationAction:focus-in: * * The focus-in signal is emitted when the entry obtains the focus. * * Since 0.1.8 */ signals[FOCUS_IN] = g_signal_new ("focus-in", G_TYPE_FROM_CLASS (class), (GSignalFlags) (G_SIGNAL_RUN_LAST), 0, 0, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[FOCUS_OUT] = g_signal_new ("focus-out", G_TYPE_FROM_CLASS (class), (GSignalFlags) (G_SIGNAL_RUN_LAST), 0, 0, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); /** * MidoriLocationAction:secondary-icon-released: * * The secondary-icon-released signal is emitted when the mouse button * is released above the secondary icon. * * Since 0.1.10 a signal handler can return %TRUE to stop signal * emission, for instance to suppress default behavior. */ signals[SECONDARY_ICON_RELEASED] = g_signal_new ("secondary-icon-released", G_TYPE_FROM_CLASS (class), (GSignalFlags) (G_SIGNAL_RUN_LAST), 0, g_signal_accumulator_true_handled, NULL, midori_cclosure_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, GTK_TYPE_WIDGET); signals[RESET_URI] = g_signal_new ("reset-uri", G_TYPE_FROM_CLASS (class), (GSignalFlags) (G_SIGNAL_RUN_LAST), 0, 0, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[SUBMIT_URI] = g_signal_new ("submit-uri", G_TYPE_FROM_CLASS (class), (GSignalFlags) (G_SIGNAL_RUN_LAST), 0, 0, NULL, midori_cclosure_marshal_VOID__STRING_BOOLEAN, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN); gobject_class = G_OBJECT_CLASS (class); gobject_class->finalize = midori_location_action_finalize; gobject_class->set_property = midori_location_action_set_property; gobject_class->get_property = midori_location_action_get_property; action_class = GTK_ACTION_CLASS (class); action_class->activate = midori_location_action_activate; action_class->create_tool_item = midori_location_action_create_tool_item; action_class->connect_proxy = midori_location_action_connect_proxy; action_class->disconnect_proxy = midori_location_action_disconnect_proxy; g_object_class_install_property (gobject_class, PROP_PROGRESS, g_param_spec_double ( "progress", "Progress", "The current progress of the action", 0.0, 1.0, 0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SECONDARY_ICON, g_param_spec_string ( "secondary-icon", "Secondary", "The stock ID of the secondary icon", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * MidoriLocationAction:history: * * The list of history items. * * This is actually a reference to a history instance. * * Since 0.1.8 */ g_object_class_install_property (gobject_class, PROP_HISTORY, g_param_spec_object ( "history", "History", "The list of history items", KATZE_TYPE_ARRAY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /* We want location entries to have appears-as-list applied */ gtk_rc_parse_string ("style \"midori-location-entry-style\" {\n" " GtkComboBox::appears-as-list = 1\n }\n" "widget \"*MidoriLocationEntry\" " "style \"midori-location-entry-style\"\n"); } static GtkTreeModel* midori_location_action_create_model (void) { GtkTreeModel* model = (GtkTreeModel*) gtk_list_store_new (N_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_FLOAT, GDK_TYPE_COLOR, G_TYPE_BOOLEAN); return model; } #if HAVE_SQLITE static void midori_location_action_popup_position (GtkWidget* popup, GtkWidget* widget) { gint wx, wy; GtkRequisition menu_req; GtkRequisition widget_req; GdkScreen* screen; gint monitor_num; GdkRectangle monitor; gdk_window_get_origin (widget->window, &wx, &wy); gtk_widget_size_request (popup, &menu_req); gtk_widget_size_request (widget, &widget_req); screen = gtk_widget_get_screen (widget); monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window); gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); if (wy + widget_req.height + menu_req.height <= monitor.y + monitor.height || wy - monitor.y < (monitor.y + monitor.height) - (wy + widget_req.height)) wy += widget_req.height; else wy -= menu_req.height; gtk_window_move (GTK_WINDOW (popup), wx, wy); gtk_window_resize (GTK_WINDOW (popup), widget->allocation.width, 1); } static gboolean midori_location_action_treeview_button_press_cb (GtkWidget* treeview, GdkEventButton* event, MidoriLocationAction* action) { GtkTreePath* path; if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (treeview), event->x, event->y, &path, NULL, NULL, NULL)) { GtkTreeIter iter; gchar* uri; gtk_tree_model_get_iter (action->completion_model, &iter, path); gtk_tree_path_free (path); midori_location_action_popdown_completion (action); gtk_tree_model_get (action->completion_model, &iter, URI_COL, &uri, -1); gtk_entry_set_text (GTK_ENTRY (action->entry), uri); g_signal_emit (action, signals[SUBMIT_URI], 0, uri, MIDORI_MOD_NEW_TAB (event->state)); g_free (uri); return TRUE; } return FALSE; } static gboolean midori_location_action_popup_timeout_cb (gpointer data) { MidoriLocationAction* action = data; GtkTreeViewColumn* column; GtkListStore* store; gint result; static sqlite3_stmt* stmt; const gchar* sqlcmd; gint matches, searches, height, screen_height, browser_height, sep; MidoriBrowser* browser; GtkStyle* style; if (!action->entry || !gtk_widget_has_focus (action->entry) || !action->history) return FALSE; if (!(action->key && *action->key)) { midori_location_action_popdown_completion (action); return FALSE; } if (!stmt) { sqlite3* db; db = g_object_get_data (G_OBJECT (action->history), "db"); sqlcmd = "SELECT type, uri, title, count() AS ct FROM history_view " "WHERE uri LIKE ?1 OR title LIKE ?1 GROUP BY uri " "UNION ALL " "SELECT type, replace(uri, '%s', title) AS uri, title, count() AS ct FROM search_view " "WHERE title LIKE ?1 GROUP BY uri " "ORDER BY ct DESC LIMIT ?2"; sqlite3_prepare_v2 (db, sqlcmd, strlen (sqlcmd) + 1, &stmt, NULL); } sqlite3_bind_text (stmt, 1, g_strdup_printf ("%%%s%%", action->key), -1, g_free); sqlite3_bind_int64 (stmt, 2, MAX_ITEMS); result = sqlite3_step (stmt); if (result != SQLITE_ROW && !action->search_engines) { g_print (_("Failed to select from history\n")); sqlite3_reset (stmt); sqlite3_clear_bindings (stmt); midori_location_action_popdown_completion (action); return FALSE; } if (G_UNLIKELY (!action->popup)) { GtkTreeModel* model = NULL; GtkWidget* popup; GtkWidget* scrolled; GtkWidget* treeview; GtkCellRenderer* renderer; model = midori_location_action_create_model (); action->completion_model = model; popup = gtk_window_new (GTK_WINDOW_POPUP); gtk_window_set_type_hint (GTK_WINDOW (popup), GDK_WINDOW_TYPE_HINT_COMBO); scrolled = g_object_new (GTK_TYPE_SCROLLED_WINDOW, "hscrollbar-policy", GTK_POLICY_NEVER, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL); gtk_container_add (GTK_CONTAINER (popup), scrolled); treeview = gtk_tree_view_new_with_model (model); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE); gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (treeview), TRUE); gtk_container_add (GTK_CONTAINER (scrolled), treeview); g_signal_connect (treeview, "button-press-event", G_CALLBACK (midori_location_action_treeview_button_press_cb), action); /* a nasty hack to get the completions treeview to size nicely */ gtk_widget_set_size_request (gtk_scrolled_window_get_vscrollbar ( GTK_SCROLLED_WINDOW (scrolled)), -1, 0); action->treeview = treeview; column = gtk_tree_view_column_new (); renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column), renderer, FALSE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (column), renderer, "pixbuf", FAVICON_COL, "yalign", YALIGN_COL, "cell-background-gdk", BACKGROUND_COL, NULL); renderer = gtk_cell_renderer_text_new (); g_object_set_data (G_OBJECT (renderer), "location-action", action); gtk_cell_renderer_set_fixed_size (renderer, 1, -1); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column), renderer, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (column), renderer, "cell-background-gdk", BACKGROUND_COL, NULL); gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (column), renderer, midori_location_entry_render_text_cb, action, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); action->popup = popup; g_signal_connect (popup, "destroy", G_CALLBACK (gtk_widget_destroyed), &action->popup); } store = GTK_LIST_STORE (action->completion_model); gtk_list_store_clear (store); matches = searches = 0; style = gtk_widget_get_style (action->treeview); while (result == SQLITE_ROW) { sqlite3_int64 type = sqlite3_column_int64 (stmt, 0); const unsigned char* uri = sqlite3_column_text (stmt, 1); const unsigned char* title = sqlite3_column_text (stmt, 2); GdkPixbuf* icon = katze_load_cached_icon ((gchar*)uri, NULL); if (!icon) icon = action->default_icon; if (type == 1 /* history_view */) gtk_list_store_insert_with_values (store, NULL, matches, URI_COL, uri, TITLE_COL, title, YALIGN_COL, 0.25, FAVICON_COL, icon, -1); else if (type == 2 /* search_view */) { gchar* search_title = g_strdup_printf (_("Search for %s"), title); gtk_list_store_insert_with_values (store, NULL, matches, URI_COL, uri, TITLE_COL, search_title, YALIGN_COL, 0.25, STYLE_COL, 1, FAVICON_COL, icon, -1); g_free (search_title); } matches++; result = sqlite3_step (stmt); } sqlite3_reset (stmt); sqlite3_clear_bindings (stmt); if (action->search_engines) { gint i = 0; KatzeItem* item; while ((item = katze_array_get_nth_item (action->search_engines, i))) { gchar* uri; gchar* title; uri = sokoke_search_uri (katze_item_get_uri (item), action->key); title = g_strdup_printf (_("Search with %s"), katze_item_get_name (item)); gtk_list_store_insert_with_values (store, NULL, matches + i, URI_COL, uri, TITLE_COL, title, YALIGN_COL, 0.25, BACKGROUND_COL, style ? &style->bg[GTK_STATE_NORMAL] : NULL, STYLE_COL, 1, FAVICON_COL, NULL, -1); g_free (uri); g_free (title); i++; } searches += i; } if (!GTK_WIDGET_VISIBLE (action->popup)) { GtkWidget* toplevel = gtk_widget_get_toplevel (action->entry); gtk_window_set_screen (GTK_WINDOW (action->popup), gtk_widget_get_screen (action->entry)); gtk_window_set_transient_for (GTK_WINDOW (action->popup), GTK_WINDOW (toplevel)); gtk_tree_view_columns_autosize (GTK_TREE_VIEW (action->treeview)); } browser = midori_browser_get_for_widget (action->entry); column = gtk_tree_view_get_column (GTK_TREE_VIEW (action->treeview), 0); gtk_tree_view_column_cell_get_size (column, NULL, NULL, NULL, NULL, &height); screen_height = gdk_screen_get_height (gtk_widget_get_screen (action->popup)); gtk_window_get_size (GTK_WINDOW (browser), NULL, &browser_height); screen_height = MIN (MIN (browser_height, screen_height / 1.5), screen_height / 1.5); gtk_widget_style_get (action->treeview, "vertical-separator", &sep, NULL); /* FIXME: Instead of 1.5 we should relate to the height of one line */ height = MIN (matches * height + (matches + searches) * sep + searches * height / 1.5, screen_height); gtk_widget_set_size_request (action->treeview, -1, height); midori_location_action_popup_position (action->popup, action->entry); gtk_widget_show_all (action->popup); return FALSE; } #endif static void midori_location_action_popup_completion (MidoriLocationAction* action, GtkWidget* entry, gchar* key) { if (action->completion_timeout) g_source_remove (action->completion_timeout); katze_assign (action->key, key); action->entry = entry; g_signal_connect (entry, "destroy", G_CALLBACK (gtk_widget_destroyed), &action->entry); #if HAVE_SQLITE action->completion_timeout = g_timeout_add (COMPLETION_DELAY, midori_location_action_popup_timeout_cb, action); /* TODO: Inline completion */ #endif } static void midori_location_action_popdown_completion (MidoriLocationAction* location_action) { if (G_LIKELY (location_action->popup)) { gtk_widget_hide (location_action->popup); katze_assign (location_action->key, NULL); gtk_tree_selection_unselect_all (gtk_tree_view_get_selection ( GTK_TREE_VIEW (location_action->treeview))); } if (location_action->completion_timeout) { g_source_remove (location_action->completion_timeout); location_action->completion_timeout = 0; } location_action->completion_index = -1; } /* Allow this to be used in tests, it's otherwise private */ /*static*/ GtkWidget* midori_location_action_entry_for_proxy (GtkWidget* proxy) { GtkWidget* alignment = gtk_bin_get_child (GTK_BIN (proxy)); GtkWidget* entry = gtk_bin_get_child (GTK_BIN (alignment)); return entry; } /** * midori_location_action_freeze: * @location_action: a #MidoriLocationAction * * Freezing of the action doesn't do anything. * * Deprecated: 0.2.3 **/ void midori_location_action_freeze (MidoriLocationAction* location_action) { /* Nothing to do */ } /** * midori_location_action_thaw: * @location_action: a #MidoriLocationAction * * Thawing of the action doesn't do anything. * * Deprecated: 0.2.3 **/ void midori_location_action_thaw (MidoriLocationAction* location_action) { /* Nothing to do */ } static void midori_location_action_init (MidoriLocationAction* location_action) { location_action->text = location_action->uri = NULL; location_action->search_engines = NULL; location_action->progress = 0.0; location_action->secondary_icon = NULL; location_action->default_icon = NULL; location_action->completion_timeout = 0; location_action->completion_index = -1; location_action->key = NULL; location_action->popup = NULL; location_action->entry = NULL; location_action->history = NULL; } static void midori_location_action_finalize (GObject* object) { MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (object); katze_assign (location_action->text, NULL); katze_assign (location_action->uri, NULL); katze_assign (location_action->search_engines, NULL); katze_assign (location_action->key, NULL); if (location_action->popup) { gtk_widget_destroy (location_action->popup); location_action->popup = NULL; } katze_object_assign (location_action->default_icon, NULL); katze_object_assign (location_action->history, NULL); G_OBJECT_CLASS (midori_location_action_parent_class)->finalize (object); } static void midori_location_action_toggle_arrow_cb (GtkWidget* widget, MidoriLocationAction* location_action) { gboolean show = FALSE; #if HAVE_SQLITE sqlite3* db; const gchar* sqlcmd; sqlite3_stmt* statement; gint result; #endif if (!GTK_IS_BUTTON (widget)) return; #if HAVE_SQLITE db = g_object_get_data (G_OBJECT (location_action->history), "db"); sqlcmd = "SELECT uri FROM history LIMIT 1"; sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL); result = sqlite3_step (statement); if (result == SQLITE_ROW) show = TRUE; sqlite3_finalize (statement); #endif sokoke_widget_set_visible (widget, show); gtk_widget_set_size_request (widget, show ? -1 : 1, show ? -1 : 1); } static void midori_location_action_toggle_arrow (MidoriLocationAction* location_action) { GSList* proxies; if (!location_action->history) return; proxies = gtk_action_get_proxies (GTK_ACTION (location_action)); for (; proxies != NULL; proxies = g_slist_next (proxies)) if (GTK_IS_TOOL_ITEM (proxies->data)) { GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data); gtk_container_forall (GTK_CONTAINER (entry), (GtkCallback)midori_location_action_toggle_arrow_cb, location_action); } } static void midori_location_action_set_property (GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) { MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (object); switch (prop_id) { case PROP_PROGRESS: midori_location_action_set_progress (location_action, g_value_get_double (value)); break; case PROP_SECONDARY_ICON: midori_location_action_set_secondary_icon (location_action, g_value_get_string (value)); break; case PROP_HISTORY: { katze_assign (location_action->history, g_value_dup_object (value)); midori_location_action_toggle_arrow (location_action); break; } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void midori_location_action_get_property (GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (object); switch (prop_id) { case PROP_PROGRESS: g_value_set_double (value, location_action->progress); break; case PROP_SECONDARY_ICON: g_value_set_string (value, location_action->secondary_icon); break; case PROP_HISTORY: g_value_set_object (value, location_action->history); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void midori_location_action_activate (GtkAction* action) { GSList* proxies; GtkWidget* entry; proxies = gtk_action_get_proxies (action); for (; proxies != NULL; proxies = g_slist_next (proxies)) if (GTK_IS_TOOL_ITEM (proxies->data)) { entry = midori_location_action_entry_for_proxy (proxies->data); /* Obviously only one widget can end up with the focus. Yet we can't predict which one that is, can we? */ gtk_widget_grab_focus (entry); } if (GTK_ACTION_CLASS (midori_location_action_parent_class)->activate) GTK_ACTION_CLASS (midori_location_action_parent_class)->activate (action); } static GtkWidget* midori_location_action_create_tool_item (GtkAction* action) { GtkWidget* toolitem; GtkWidget* alignment; GtkWidget* location_entry; GtkWidget* entry; #if HAVE_HILDON HildonGtkInputMode mode; #endif toolitem = GTK_WIDGET (gtk_tool_item_new ()); gtk_tool_item_set_expand (GTK_TOOL_ITEM (toolitem), TRUE); alignment = gtk_alignment_new (0.0f, 0.5f, 1.0f, 0.1f); gtk_widget_show (alignment); gtk_container_add (GTK_CONTAINER (toolitem), alignment); location_entry = gtk_combo_box_entry_new (); gtk_widget_set_name (location_entry, "MidoriLocationEntry"); gtk_widget_show (location_entry); gtk_container_add (GTK_CONTAINER (alignment), location_entry); #if HAVE_HILDON entry = gtk_entry_new (); mode = hildon_gtk_entry_get_input_mode (GTK_ENTRY (entry)); mode &= ~HILDON_GTK_INPUT_MODE_AUTOCAP; hildon_gtk_entry_set_input_mode (GTK_ENTRY (entry), mode); #else entry = gtk_icon_entry_new (); gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_FILE); gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_SECONDARY, TRUE); #endif gtk_widget_show (entry); gtk_container_add (GTK_CONTAINER (location_entry), entry); return toolitem; } static void midori_location_action_changed_cb (GtkEntry* entry, MidoriLocationAction* location_action) { katze_assign (location_action->text, g_strdup (gtk_entry_get_text (entry))); } static void midori_location_action_move_cursor_cb (GtkEntry* entry, GtkMovementStep step, gint count, gboolean extend_selection, MidoriLocationAction* action) { gchar* text = g_strdup (pango_layout_get_text (gtk_entry_get_layout (entry))); /* Update entry with the completed text */ gtk_entry_set_text (entry, text); g_free (text); midori_location_action_popdown_completion (action); } static void midori_location_action_backspace_cb (GtkWidget* entry, MidoriLocationAction* action) { gchar* key = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry))); midori_location_action_popup_completion (action, entry, key); action->completion_index = -1; } static void midori_location_action_paste_clipboard_cb (GtkWidget* entry, MidoriLocationAction* action) { gchar* key = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry))); midori_location_action_popup_completion (action, entry, key); action->completion_index = -1; g_signal_emit (GTK_ACTION (action), signals[SUBMIT_URI], 0, key, FALSE); } static gboolean midori_location_action_button_press_event_cb (GtkEntry* entry, GdkEventKey* event, MidoriLocationAction* action) { if (action->popup && GTK_WIDGET_VISIBLE (action->popup)) { midori_location_action_popdown_completion (action); /* Allow button handling, for context menu and selection */ return FALSE; } return FALSE; } static gboolean midori_location_action_key_press_event_cb (GtkEntry* entry, GdkEventKey* event, GtkAction* action) { GtkWidget* widget = GTK_WIDGET (entry); MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action); const gchar* text; gboolean is_enter = FALSE; switch (event->keyval) { case GDK_ISO_Enter: case GDK_KP_Enter: case GDK_Return: is_enter = TRUE; case GDK_Left: case GDK_KP_Left: case GDK_Right: case GDK_KP_Right: if (location_action->popup && GTK_WIDGET_VISIBLE (location_action->popup)) { GtkTreeModel* model = location_action->completion_model; GtkTreeIter iter; gint selected = location_action->completion_index; midori_location_action_popdown_completion (location_action); if (selected > -1 && gtk_tree_model_iter_nth_child (model, &iter, NULL, selected)) { gchar* uri; gtk_tree_model_get (model, &iter, URI_COL, &uri, -1); gtk_entry_set_text (entry, uri); if (is_enter) g_signal_emit (action, signals[SUBMIT_URI], 0, uri, MIDORI_MOD_NEW_TAB (event->state)); g_free (uri); return TRUE; } } if (is_enter) if ((text = gtk_entry_get_text (entry)) && *text) g_signal_emit (action, signals[SUBMIT_URI], 0, text, MIDORI_MOD_NEW_TAB (event->state)); break; case GDK_Escape: { if (location_action->popup && GTK_WIDGET_VISIBLE (location_action->popup)) { midori_location_action_popdown_completion (location_action); text = gtk_entry_get_text (entry); pango_layout_set_text (gtk_entry_get_layout (entry), text, -1); return TRUE; } g_signal_emit (action, signals[RESET_URI], 0); /* Return FALSE to allow Escape to stop loading */ return FALSE; } case GDK_Page_Up: case GDK_Page_Down: if (!(location_action->popup && GTK_WIDGET_VISIBLE (location_action->popup))) return TRUE; case GDK_Down: case GDK_KP_Down: case GDK_Up: case GDK_KP_Up: { GtkWidget* parent; if (location_action->popup && GTK_WIDGET_VISIBLE (location_action->popup)) { GtkTreeModel* model = location_action->completion_model; gint matches = gtk_tree_model_iter_n_children (model, NULL); GtkTreePath* path; GtkTreeIter iter; gint selected = location_action->completion_index; if (event->keyval == GDK_Down || event->keyval == GDK_KP_Down) selected = MIN (selected + 1, matches -1); else if (event->keyval == GDK_Up || event->keyval == GDK_KP_Up) { if (selected == -1) selected = matches - 1; else selected = MAX (selected - 1, 0); } else if (event->keyval == GDK_Page_Down) selected = MIN (selected + 14, matches -1); else if (event->keyval == GDK_Page_Up) selected = MAX (selected - 14, 0); path = gtk_tree_path_new_from_indices (selected, -1); gtk_tree_view_set_cursor (GTK_TREE_VIEW (location_action->treeview), path, NULL, FALSE); gtk_tree_path_free (path); if (gtk_tree_model_iter_nth_child (model, &iter, NULL, selected)) { gchar* uri; gtk_tree_model_get (model, &iter, URI_COL, &uri, -1); /* Update the layout without actually changing the text */ pango_layout_set_text (gtk_entry_get_layout (entry), uri, -1); g_free (uri); } location_action->completion_index = selected; return TRUE; } parent = gtk_widget_get_parent (widget); if (!katze_object_get_boolean (parent, "popup-shown")) gtk_combo_box_popup (GTK_COMBO_BOX (parent)); return TRUE; } default: { gunichar character; gchar buffer[7]; gint length; gchar* key; character = gdk_keyval_to_unicode (event->keyval); /* Don't trigger completion on control characters */ if (!character || event->is_modifier) return FALSE; length = g_unichar_to_utf8 (character, buffer); buffer[length] = '\0'; key = g_strconcat (gtk_entry_get_text (entry), buffer, NULL); midori_location_action_popup_completion (location_action, widget, key); location_action->completion_index = -1; return FALSE; } } return FALSE; } #if GTK_CHECK_VERSION (2, 19, 3) static void midori_location_action_preedit_changed_cb (GtkWidget* entry, const gchar* preedit, GtkAction* action) { MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action); gchar* key = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry))); midori_location_action_popup_completion (location_action, entry, key); } #endif static gboolean midori_location_action_focus_in_event_cb (GtkWidget* widget, GdkEventKey* event, GtkAction* action) { g_signal_emit (action, signals[FOCUS_IN], 0); return FALSE; } static gboolean midori_location_action_focus_out_event_cb (GtkWidget* widget, GdkEventKey* event, GtkAction* action) { midori_location_action_popdown_completion (MIDORI_LOCATION_ACTION (action)); g_signal_emit (action, signals[FOCUS_OUT], 0); return FALSE; } static void midori_location_action_icon_released_cb (GtkWidget* widget, GtkIconEntryPosition icon_pos, gint button, GtkAction* action) { if (icon_pos == GTK_ICON_ENTRY_SECONDARY) { gboolean result; g_signal_emit (action, signals[SECONDARY_ICON_RELEASED], 0, widget, &result); } } static void midori_location_entry_render_text_cb (GtkCellLayout* layout, GtkCellRenderer* renderer, GtkTreeModel* model, GtkTreeIter* iter, gpointer data) { MidoriLocationAction* action = data; gchar* uri; gchar* title; GdkColor* background; gboolean style; gchar* desc; gchar* desc_uri; gchar* desc_title; const gchar* str; gchar* key; gchar* start; gchar* skey; gchar* temp; gchar** parts; size_t len; gtk_tree_model_get (model, iter, URI_COL, &uri, TITLE_COL, &title, BACKGROUND_COL, &background, STYLE_COL, &style, -1); if (style) /* A search engine action */ { g_object_set (renderer, "text", title, "ellipsize-set", TRUE, "ellipsize", PANGO_ELLIPSIZE_END, NULL); g_free (uri); g_free (title); return; } desc = desc_uri = desc_title = key = NULL; if (action->key) str = action->key; else str = ""; key = g_utf8_strdown (str, -1); len = strlen (key); if (G_LIKELY (uri)) { temp = g_utf8_strdown (uri, -1); if ((start = strstr (temp, key)) && (start - temp)) { skey = g_strndup (uri + (start - temp), len); parts = g_strsplit (uri, skey, 2); if (parts[0] && parts[1]) desc_uri = g_markup_printf_escaped ("%s<b>%s</b>%s", parts[0], skey, parts[1]); g_strfreev (parts); g_free (skey); } if (!desc_uri) desc_uri = g_markup_escape_text (uri, -1); g_free (temp); } if (G_LIKELY (title)) { temp = g_utf8_strdown (title, -1); if ((start = strstr (temp, key)) && (start - temp)) { skey = g_strndup (title + (start - temp), len); parts = g_strsplit (title, skey, 2); if (parts[0] && parts[1]) desc_title = g_markup_printf_escaped ("%s<b>%s</b>%s", parts[0], skey, parts[1]); g_strfreev (parts); g_free (skey); } if (!desc_title) desc_title = g_markup_escape_text (title, -1); g_free (temp); } if (desc_title) { desc = g_strdup_printf ("%s\n<span color='gray45'>%s</span>", desc_title, desc_uri); g_free (desc_uri); g_free (desc_title); } else desc = desc_uri; g_object_set (renderer, "markup", desc, "ellipsize-set", TRUE, "ellipsize", PANGO_ELLIPSIZE_END, NULL); g_free (uri); g_free (title); g_free (key); g_free (desc); } static void midori_location_action_entry_changed_cb (GtkComboBox* combo_box, MidoriLocationAction* location_action) { GtkTreeIter iter; if (gtk_combo_box_get_active_iter (combo_box, &iter)) { GtkIconEntry* entry; if ((entry = GTK_ICON_ENTRY (gtk_bin_get_child (GTK_BIN (combo_box))))) { GtkTreeModel* model; gchar* uri; #if !HAVE_HILDON GdkPixbuf* pixbuf; #endif model = gtk_combo_box_get_model (combo_box); gtk_tree_model_get (model, &iter, URI_COL, &uri, -1); #if !HAVE_HILDON gtk_tree_model_get (model, &iter, FAVICON_COL, &pixbuf, -1); gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, pixbuf); g_object_unref (pixbuf); #endif katze_assign (location_action->text, uri); katze_assign (location_action->uri, g_strdup (uri)); g_signal_emit (location_action, signals[ACTIVE_CHANGED], 0, gtk_combo_box_get_active (combo_box)); } } } static void midori_location_action_entry_popup_cb (GtkComboBox* combo_box, MidoriLocationAction* location_action) { #if HAVE_SQLITE GtkListStore* store; gint result; const gchar* sqlcmd; static sqlite3_stmt* stmt; gint matches; store = GTK_LIST_STORE (gtk_combo_box_get_model (combo_box)); gtk_list_store_clear (store); if (!stmt) { sqlite3* db; db = g_object_get_data (G_OBJECT (location_action->history), "db"); sqlcmd = "SELECT uri, title FROM history" " GROUP BY uri ORDER BY count() DESC LIMIT ?"; sqlite3_prepare_v2 (db, sqlcmd, -1, &stmt, NULL); } sqlite3_bind_int64 (stmt, 1, MAX_ITEMS); result = sqlite3_step (stmt); if (result != SQLITE_ROW) { g_print (_("Failed to execute database statement\n")); sqlite3_reset (stmt); sqlite3_clear_bindings (stmt); return; } matches = 0; do { const unsigned char* uri = sqlite3_column_text (stmt, 0); const unsigned char* title = sqlite3_column_text (stmt, 1); GdkPixbuf* icon = katze_load_cached_icon ((gchar*)uri, NULL); if (!icon) icon = location_action->default_icon; gtk_list_store_insert_with_values (store, NULL, matches, URI_COL, uri, TITLE_COL, title, YALIGN_COL, 0.25, FAVICON_COL, icon, -1); matches++; result = sqlite3_step (stmt); } while (result == SQLITE_ROW); sqlite3_reset (stmt); sqlite3_clear_bindings (stmt); #endif } static void midori_location_action_paste_proceed_cb (GtkWidget* menuitem, GtkWidget* location_action) { GtkClipboard* clipboard = gtk_clipboard_get_for_display ( gtk_widget_get_display (GTK_WIDGET (menuitem)),GDK_SELECTION_CLIPBOARD); gchar* uri; if ((uri = gtk_clipboard_wait_for_text (clipboard))) { g_signal_emit (location_action, signals[SUBMIT_URI], 0, uri, FALSE); g_free (uri); } } static void midori_location_action_populate_popup_cb (GtkWidget* entry, GtkMenuShell* menu, MidoriLocationAction* location_action) { MidoriBrowser* browser = midori_browser_get_for_widget (entry); GtkActionGroup* actions = midori_browser_get_action_group (browser); GtkWidget* menuitem; menuitem = gtk_separator_menu_item_new (); gtk_widget_show (menuitem); gtk_menu_shell_append (menu, menuitem); menuitem = sokoke_action_create_popup_menu_item ( gtk_action_group_get_action (actions, "ManageSearchEngines")); gtk_menu_shell_append (menu, menuitem); /* i18n: Right-click on Location, Open an URL from the clipboard */ menuitem = gtk_menu_item_new_with_mnemonic (_("Paste and p_roceed")); gtk_widget_show (menuitem); gtk_menu_shell_append (menu, menuitem); g_signal_connect (menuitem, "activate", G_CALLBACK (midori_location_action_paste_proceed_cb), location_action); } static void midori_location_action_connect_proxy (GtkAction* action, GtkWidget* proxy) { MidoriLocationAction* location_action; GtkCellRenderer* renderer; GTK_ACTION_CLASS (midori_location_action_parent_class)->connect_proxy ( action, proxy); location_action = MIDORI_LOCATION_ACTION (action); katze_object_assign (location_action->default_icon, gtk_widget_render_icon (proxy, GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL)); if (GTK_IS_TOOL_ITEM (proxy)) { GtkWidget* entry = midori_location_action_entry_for_proxy (proxy); GtkWidget* child = gtk_bin_get_child (GTK_BIN (entry)); GtkTreeModel* model = midori_location_action_create_model (); gtk_icon_entry_set_progress_fraction (GTK_ICON_ENTRY (child), MIDORI_LOCATION_ACTION (action)->progress); gtk_combo_box_set_model (GTK_COMBO_BOX (entry), model); #if GTK_CHECK_VERSION (2, 14, 0) gtk_combo_box_set_button_sensitivity (GTK_COMBO_BOX (entry), GTK_SENSITIVITY_ON); #endif gtk_combo_box_entry_set_text_column ( GTK_COMBO_BOX_ENTRY (entry), URI_COL); gtk_cell_layout_clear (GTK_CELL_LAYOUT (entry)); /* Setup the renderer for the favicon */ renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (entry), renderer, FALSE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (entry), renderer, "pixbuf", FAVICON_COL, "yalign", YALIGN_COL, NULL); renderer = gtk_cell_renderer_text_new (); g_object_set_data (G_OBJECT (renderer), "location-action", action); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (entry), renderer, TRUE); gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (entry), renderer, midori_location_entry_render_text_cb, action, NULL); gtk_combo_box_set_active (GTK_COMBO_BOX (entry), -1); if (location_action->history) gtk_container_forall (GTK_CONTAINER (entry), (GtkCallback)midori_location_action_toggle_arrow_cb, action); g_signal_connect (entry, "changed", G_CALLBACK (midori_location_action_entry_changed_cb), action); g_signal_connect (entry, "popup", G_CALLBACK (midori_location_action_entry_popup_cb), action); g_object_connect (child, "signal::changed", midori_location_action_changed_cb, action, "signal::move-cursor", midori_location_action_move_cursor_cb, action, "signal-after::backspace", midori_location_action_backspace_cb, action, "signal-after::paste-clipboard", midori_location_action_paste_clipboard_cb, action, "signal::button-press-event", midori_location_action_button_press_event_cb, action, "signal::key-press-event", midori_location_action_key_press_event_cb, action, #if GTK_CHECK_VERSION (2, 19, 3) "signal-after::preedit-changed", midori_location_action_preedit_changed_cb, action, #endif "signal::focus-in-event", midori_location_action_focus_in_event_cb, action, "signal::focus-out-event", midori_location_action_focus_out_event_cb, action, "signal::icon-release", midori_location_action_icon_released_cb, action, "signal::populate-popup", midori_location_action_populate_popup_cb, action, NULL); } } static void midori_location_action_disconnect_proxy (GtkAction* action, GtkWidget* proxy) { /* FIXME: This is wrong */ g_signal_handlers_disconnect_by_func (proxy, G_CALLBACK (gtk_action_activate), action); GTK_ACTION_CLASS (midori_location_action_parent_class)->disconnect_proxy (action, proxy); } /** * midori_location_action_get_uri: * @location_action: a #MidoriLocationAction * * Retrieves the current URI. See also midori_location_action_get_text(). * * Return value: the current URI **/ const gchar* midori_location_action_get_uri (MidoriLocationAction* location_action) { g_return_val_if_fail (MIDORI_IS_LOCATION_ACTION (location_action), NULL); return location_action->uri; } /** * midori_location_action_get_text: * @location_action: a #MidoriLocationAction * * Retrieves the current text, which may be the current URI or * anything typed in the entry. * * Return value: the current text * * Since: 0.2.0 **/ const gchar* midori_location_action_get_text (MidoriLocationAction* location_action) { g_return_val_if_fail (MIDORI_IS_LOCATION_ACTION (location_action), NULL); return location_action->text; } /** * midori_location_action_set_text: * @location_action: a #MidoriLocationAction * @text: a string * * Sets the entry text to @text and, if applicable, updates the icon. * * Since: 0.2.0 **/ void midori_location_action_set_text (MidoriLocationAction* location_action, const gchar* text) { GSList* proxies; GtkWidget* location_entry; GtkWidget* entry; GdkPixbuf* icon; g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); g_return_if_fail (text != NULL); midori_location_action_popdown_completion (location_action); katze_assign (location_action->text, g_strdup (text)); katze_assign (location_action->uri, g_strdup (text)); if (!(proxies = gtk_action_get_proxies (GTK_ACTION (location_action)))) return; if (!(icon = katze_load_cached_icon (location_action->uri, NULL))) icon = g_object_ref (location_action->default_icon); for (; proxies != NULL; proxies = g_slist_next (proxies)) if (GTK_IS_TOOL_ITEM (proxies->data)) { location_entry = midori_location_action_entry_for_proxy (proxies->data); entry = gtk_bin_get_child (GTK_BIN (location_entry)); gtk_entry_set_text (GTK_ENTRY (entry), text); #if !HAVE_HILDON gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, icon); #endif } g_object_unref (icon); } /** * midori_location_action_set_uri: * @location_action: a #MidoriLocationAction * @uri: an URI string * * Sets the entry URI to @uri and, if applicable, updates the icon. * * Deprecated: 0.2.0 **/ void midori_location_action_set_uri (MidoriLocationAction* location_action, const gchar* uri) { g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); g_return_if_fail (uri != NULL); katze_assign (location_action->uri, g_strdup (uri)); midori_location_action_set_text (location_action, uri); } /** * midori_location_action_set_icon: * @location_action: a #MidoriLocationAction * @icon: a #GdkPixbuf or %NULL * * Sets the icon shown on the left hand side. * * Note: Since 0.1.8 %NULL can be passed to indicate that the * visible URI refers to a target, not the current location. **/ void midori_location_action_set_icon (MidoriLocationAction* location_action, GdkPixbuf* icon) { #if !HAVE_HILDON GSList* proxies; GtkWidget* location_entry; GtkWidget* entry; g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); g_return_if_fail (!icon || GDK_IS_PIXBUF (icon)); proxies = gtk_action_get_proxies (GTK_ACTION (location_action)); for (; proxies != NULL; proxies = g_slist_next (proxies)) if (GTK_IS_TOOL_ITEM (proxies->data)) { location_entry = midori_location_action_entry_for_proxy (proxies->data); entry = gtk_bin_get_child (GTK_BIN (location_entry)); if (icon) gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, icon); else gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_JUMP_TO); } #endif } void midori_location_action_add_uri (MidoriLocationAction* location_action, const gchar* uri) { g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); g_return_if_fail (uri != NULL); katze_assign (location_action->uri, g_strdup (uri)); midori_location_action_toggle_arrow (location_action); } void midori_location_action_add_item (MidoriLocationAction* location_action, const gchar* uri, GdkPixbuf* icon, const gchar* title) { #if !HAVE_HILDON GSList* proxies; GtkWidget* location_entry; GtkWidget* entry; #endif g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); g_return_if_fail (uri != NULL); g_return_if_fail (title != NULL); g_return_if_fail (!icon || GDK_IS_PIXBUF (icon)); #if !HAVE_HILDON proxies = gtk_action_get_proxies (GTK_ACTION (location_action)); for (; proxies != NULL; proxies = g_slist_next (proxies)) if (GTK_IS_TOOL_ITEM (proxies->data)) { location_entry = midori_location_action_entry_for_proxy (proxies->data); entry = gtk_bin_get_child (GTK_BIN (location_entry)); gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, icon); } #endif } void midori_location_action_set_icon_for_uri (MidoriLocationAction* location_action, GdkPixbuf* icon, const gchar* uri) { #if !HAVE_HILDON GSList* proxies; GtkWidget* location_entry; GtkWidget* entry; #endif g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); g_return_if_fail (!icon || GDK_IS_PIXBUF (icon)); g_return_if_fail (uri != NULL); #if !HAVE_HILDON proxies = gtk_action_get_proxies (GTK_ACTION (location_action)); for (; proxies != NULL; proxies = g_slist_next (proxies)) if (GTK_IS_TOOL_ITEM (proxies->data)) { location_entry = midori_location_action_entry_for_proxy (proxies->data); entry = gtk_bin_get_child (GTK_BIN (location_entry)); gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, icon); } #endif } void midori_location_action_set_title_for_uri (MidoriLocationAction* location_action, const gchar* title, const gchar* uri) { /* Nothing to do */ } /** * midori_location_action_set_search_engines: * @location_action: a #MidoriLocationAction * @search_engines: a #KatzeArray * * Assigns the specified search engines to the location action. * Search engines will appear as actions in the completion. * * Since: 0.1.6 **/ void midori_location_action_set_search_engines (MidoriLocationAction* location_action, KatzeArray* search_engines) { g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); if (search_engines) g_object_ref (search_engines); katze_object_assign (location_action->search_engines, search_engines); } gdouble midori_location_action_get_progress (MidoriLocationAction* location_action) { g_return_val_if_fail (MIDORI_IS_LOCATION_ACTION (location_action), 0.0); return location_action->progress; } void midori_location_action_set_progress (MidoriLocationAction* location_action, gdouble progress) { GSList* proxies; GtkWidget* entry; GtkWidget* child; g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); location_action->progress = CLAMP (progress, 0.0, 1.0); proxies = gtk_action_get_proxies (GTK_ACTION (location_action)); for (; proxies != NULL; proxies = g_slist_next (proxies)) if (GTK_IS_TOOL_ITEM (proxies->data)) { entry = midori_location_action_entry_for_proxy (proxies->data); child = gtk_bin_get_child (GTK_BIN (entry)); gtk_icon_entry_set_progress_fraction (GTK_ICON_ENTRY (child), location_action->progress); } } void midori_location_action_set_secondary_icon (MidoriLocationAction* location_action, const gchar* stock_id) { #if !HAVE_HILDON GSList* proxies; GtkWidget* entry; GtkWidget* child; #endif GtkStockItem stock_item; g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); g_return_if_fail (!stock_id || gtk_stock_lookup (stock_id, &stock_item)); katze_assign (location_action->secondary_icon, g_strdup (stock_id)); #if !HAVE_HILDON proxies = gtk_action_get_proxies (GTK_ACTION (location_action)); for (; proxies != NULL; proxies = g_slist_next (proxies)) if (GTK_IS_TOOL_ITEM (proxies->data)) { entry = midori_location_action_entry_for_proxy (proxies->data); child = gtk_bin_get_child (GTK_BIN (entry)); gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child), GTK_ICON_ENTRY_SECONDARY, stock_id); } #endif } /** * midori_location_action_delete_item_from_uri: * @location_action: a #MidoriLocationAction * @uri: a string * * Finds the item from the list matching @uri * and removes it if it is the last instance. **/ void midori_location_action_delete_item_from_uri (MidoriLocationAction* location_action, const gchar* uri) { /* Nothing to do */ } void midori_location_action_clear (MidoriLocationAction* location_action) { g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); midori_location_action_toggle_arrow (location_action); }
lgpl-2.1
BackupGGCode/ewlibs
app/eedit/core/module/module.cpp
1025
#include <iostream> #include <map> #include <string> #include "module.hpp" #include "core/log.hpp" namespace eedit { std::map<std::string, ::module_fn> modfunc_table; int register_module_function(const char * name, module_fn fn) { auto ret = modfunc_table.insert(std::pair<std::string, module_fn>(std::string(name), fn)); if (ret.second == false) { app_log << "function '" << name << "' already existed\n"; app_log << " with a value of " << ret.first->second << '\n'; return -1; } return 0; } ::module_fn get_module_function(const char * name) { auto ret = modfunc_table.find(std::string(name)); if (ret != modfunc_table.end()) { return *ret->second; } app_log << __PRETTY_FUNCTION__ << " function '" << name << "' not found\n"; return nullptr; } } extern "C" { int eedit_register_module_function(const char * name, module_fn fn) { return eedit::register_module_function(name, fn); } module_fn eedit_get_module_function(const char * name) { return eedit::get_module_function(name); } }
lgpl-2.1
kasicass/gearx
include/wpp/wszoom.h
240
#ifndef _WINDSOUL_ZOOM_BITMAP_H_ #define _WINDSOUL_ZOOM_BITMAP_H_ #pragma once #include "wsaddon.h" class WINDSOULADD_API WZoomBitmap : public WBitmap { public: using WBitmap::Draw; void Draw(const WBitmap &bmp,int w,int h); }; #endif
lgpl-2.1
sshah-solarflare/Libvirt-PCI-passthrough-
src/qemu/qemu_security_stacked.c
15828
/* * Copyright (C) 2010 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * QEMU stacked security driver */ #include <config.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include "qemu_security_stacked.h" #include "qemu_conf.h" #include "datatypes.h" #include "virterror_internal.h" #include "util.h" #include "memory.h" #include "logging.h" #include "pci.h" #include "hostusb.h" #include "storage_file.h" #define VIR_FROM_THIS VIR_FROM_QEMU static struct qemud_driver *driver; void qemuSecurityStackedSetDriver(struct qemud_driver *newdriver) { driver = newdriver; } static int qemuSecurityStackedVerify(virDomainDefPtr def) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainSecurityVerify && driver->securitySecondaryDriver->domainSecurityVerify(def) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainSecurityVerify && driver->securityPrimaryDriver->domainSecurityVerify(def) < 0) rc = -1; return rc; } static int qemuSecurityStackedGenLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainGenSecurityLabel && driver->securitySecondaryDriver->domainGenSecurityLabel(driver->securitySecondaryDriver, vm) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainGenSecurityLabel && driver->securityPrimaryDriver->domainGenSecurityLabel(driver->securityPrimaryDriver, vm) < 0) rc = -1; return rc; } static int qemuSecurityStackedReleaseLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainReleaseSecurityLabel && driver->securitySecondaryDriver->domainReleaseSecurityLabel(driver->securitySecondaryDriver, vm) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainReleaseSecurityLabel && driver->securityPrimaryDriver->domainReleaseSecurityLabel(driver->securityPrimaryDriver, vm) < 0) rc = -1; return rc; } static int qemuSecurityStackedReserveLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainReserveSecurityLabel && driver->securitySecondaryDriver->domainReserveSecurityLabel(driver->securitySecondaryDriver, vm) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainReserveSecurityLabel && driver->securityPrimaryDriver->domainReserveSecurityLabel(driver->securityPrimaryDriver, vm) < 0) rc = -1; return rc; } static int qemuSecurityStackedSetSecurityImageLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm, virDomainDiskDefPtr disk) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainSetSecurityImageLabel && driver->securitySecondaryDriver->domainSetSecurityImageLabel(driver->securitySecondaryDriver, vm, disk) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainSetSecurityImageLabel && driver->securityPrimaryDriver->domainSetSecurityImageLabel(driver->securityPrimaryDriver, vm, disk) < 0) rc = -1; return rc; } static int qemuSecurityStackedRestoreSecurityImageLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm, virDomainDiskDefPtr disk) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainRestoreSecurityImageLabel && driver->securitySecondaryDriver->domainRestoreSecurityImageLabel(driver->securitySecondaryDriver, vm, disk) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainRestoreSecurityImageLabel && driver->securityPrimaryDriver->domainRestoreSecurityImageLabel(driver->securityPrimaryDriver, vm, disk) < 0) rc = -1; return rc; } static int qemuSecurityStackedSetSecurityHostdevLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm, virDomainHostdevDefPtr dev) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainSetSecurityHostdevLabel && driver->securitySecondaryDriver->domainSetSecurityHostdevLabel(driver->securitySecondaryDriver, vm, dev) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainSetSecurityHostdevLabel && driver->securityPrimaryDriver->domainSetSecurityHostdevLabel(driver->securityPrimaryDriver, vm, dev) < 0) rc = -1; return rc; } static int qemuSecurityStackedRestoreSecurityHostdevLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm, virDomainHostdevDefPtr dev) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainRestoreSecurityHostdevLabel && driver->securitySecondaryDriver->domainRestoreSecurityHostdevLabel(driver->securitySecondaryDriver, vm, dev) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainRestoreSecurityHostdevLabel && driver->securityPrimaryDriver->domainRestoreSecurityHostdevLabel(driver->securityPrimaryDriver, vm, dev) < 0) rc = -1; return rc; } static int qemuSecurityStackedSetSecurityAllLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm, const char *stdin_path) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainSetSecurityAllLabel && driver->securitySecondaryDriver->domainSetSecurityAllLabel(driver->securitySecondaryDriver, vm, stdin_path) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainSetSecurityAllLabel && driver->securityPrimaryDriver->domainSetSecurityAllLabel(driver->securityPrimaryDriver, vm, stdin_path) < 0) rc = -1; return rc; } static int qemuSecurityStackedRestoreSecurityAllLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm, int migrated) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainRestoreSecurityAllLabel && driver->securitySecondaryDriver->domainRestoreSecurityAllLabel(driver->securitySecondaryDriver, vm, migrated) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainRestoreSecurityAllLabel && driver->securityPrimaryDriver->domainRestoreSecurityAllLabel(driver->securityPrimaryDriver, vm, migrated) < 0) rc = -1; return rc; } static int qemuSecurityStackedSetSavedStateLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm, const char *savefile) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainSetSavedStateLabel && driver->securitySecondaryDriver->domainSetSavedStateLabel(driver->securitySecondaryDriver, vm, savefile) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainSetSavedStateLabel && driver->securityPrimaryDriver->domainSetSavedStateLabel(driver->securityPrimaryDriver, vm, savefile) < 0) rc = -1; return rc; } static int qemuSecurityStackedRestoreSavedStateLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm, const char *savefile) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainRestoreSavedStateLabel && driver->securitySecondaryDriver->domainRestoreSavedStateLabel(driver->securitySecondaryDriver, vm, savefile) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainRestoreSavedStateLabel && driver->securityPrimaryDriver->domainRestoreSavedStateLabel(driver->securityPrimaryDriver, vm, savefile) < 0) rc = -1; return rc; } static int qemuSecurityStackedSetProcessLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainSetSecurityProcessLabel && driver->securitySecondaryDriver->domainSetSecurityProcessLabel(driver->securitySecondaryDriver, vm) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainSetSecurityProcessLabel && driver->securityPrimaryDriver->domainSetSecurityProcessLabel(driver->securityPrimaryDriver, vm) < 0) rc = -1; return rc; } static int qemuSecurityStackedGetProcessLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm, virSecurityLabelPtr seclabel) { int rc = 0; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainGetSecurityProcessLabel && driver->securityPrimaryDriver->domainGetSecurityProcessLabel(driver->securityPrimaryDriver, vm, seclabel) < 0) rc = -1; return rc; } static int qemuSecurityStackedSetSocketLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm) { int rc = 0; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainSetSecuritySocketLabel && driver->securityPrimaryDriver->domainSetSecuritySocketLabel(driver->securityPrimaryDriver, vm) < 0) rc = -1; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainSetSecuritySocketLabel && driver->securitySecondaryDriver->domainSetSecuritySocketLabel(driver->securitySecondaryDriver, vm) < 0) rc = -1; return rc; } static int qemuSecurityStackedClearSocketLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED, virDomainObjPtr vm) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainClearSecuritySocketLabel && driver->securitySecondaryDriver->domainClearSecuritySocketLabel(driver->securitySecondaryDriver, vm) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainClearSecuritySocketLabel && driver->securityPrimaryDriver->domainClearSecuritySocketLabel(driver->securityPrimaryDriver, vm) < 0) rc = -1; return rc; } static int qemuSecurityStackedSetFDLabel(virDomainObjPtr vm, int fd) { int rc = 0; if (driver->securitySecondaryDriver && driver->securitySecondaryDriver->domainSetSecurityFDLabel && driver->securitySecondaryDriver->domainSetSecurityFDLabel(vm, fd) < 0) rc = -1; if (driver->securityPrimaryDriver && driver->securityPrimaryDriver->domainSetSecurityFDLabel && driver->securityPrimaryDriver->domainSetSecurityFDLabel(vm, fd) < 0) rc = -1; return rc; } virSecurityDriver qemuStackedSecurityDriver = { .name = "qemuStacked", .domainSecurityVerify = qemuSecurityStackedVerify, .domainGenSecurityLabel = qemuSecurityStackedGenLabel, .domainReleaseSecurityLabel = qemuSecurityStackedReleaseLabel, .domainReserveSecurityLabel = qemuSecurityStackedReserveLabel, .domainGetSecurityProcessLabel = qemuSecurityStackedGetProcessLabel, .domainSetSecurityProcessLabel = qemuSecurityStackedSetProcessLabel, .domainSetSecurityImageLabel = qemuSecurityStackedSetSecurityImageLabel, .domainRestoreSecurityImageLabel = qemuSecurityStackedRestoreSecurityImageLabel, .domainSetSecurityAllLabel = qemuSecurityStackedSetSecurityAllLabel, .domainRestoreSecurityAllLabel = qemuSecurityStackedRestoreSecurityAllLabel, .domainSetSecurityHostdevLabel = qemuSecurityStackedSetSecurityHostdevLabel, .domainRestoreSecurityHostdevLabel = qemuSecurityStackedRestoreSecurityHostdevLabel, .domainSetSavedStateLabel = qemuSecurityStackedSetSavedStateLabel, .domainRestoreSavedStateLabel = qemuSecurityStackedRestoreSavedStateLabel, .domainClearSecuritySocketLabel = qemuSecurityStackedClearSocketLabel, .domainSetSecuritySocketLabel = qemuSecurityStackedSetSocketLabel, .domainSetSecurityFDLabel = qemuSecurityStackedSetFDLabel, };
lgpl-2.1
petosorus/javamon
README.md
731
Javamon ======= Clone de pokémon en Java. Architecture MVC. Additions de gameplay : permadeath choix du type de sauvegarde (auto only ou manuelle) Tâche actuelle : système de combat - test des dommagse selon types <br/> Credits <br/> Aide technique : <a href="https://twitter.com/flynscape" >Flyn</a>, <a href="https://twitter.com/RedCaptcha" >Red Captcha</a> <br/> Additions de gameplay : <a href="https://twitter.com/Salamiaou" >Gabriel Barboteau</a> <br/> Aide gamesystem : <a href="https://twitter.com/Quentin_Falcon" >Quentin Falcon</a>, <a href="https://twitter.com/Mutsuiii" >Mutsui</a> Ressources : <br/> http://bulbapedia.bulbagarden.net/ (anglais) <br/> http://www.pokepedia.fr/ (français) <br/>
lgpl-2.1
cbosdo/libvirt
src/vbox/vbox_tmpl.c
350499
/** @file vbox_tmpl.c * Template File to support multiple versions of VirtualBox * at runtime :). * * IMPORTANT: * Please dont include this file in the src/Makefile.am, it * is automatically include by other files. */ /* * Copyright (C) 2010-2013 Red Hat, Inc. * Copyright (C) 2008-2009 Sun Microsystems, Inc. * * This file is part of a free software library; you can redistribute * it and/or modify it under the terms of the GNU Lesser General * Public License version 2.1 as published by the Free Software * Foundation and shipped in the "COPYING.LESSER" file with this library. * The library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY of any kind. * * Sun LGPL Disclaimer: For the avoidance of doubt, except that if * any license choice other than GPL or LGPL is available it will * apply instead, Sun elects to use only the Lesser General Public * License version 2.1 (LGPLv2) at this time for any software where * a choice of LGPL license versions is made available with the * language indicating that LGPLv2 or any later version may be used, * or where a choice of which version of the LGPL is applied is * otherwise unspecified. * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 USA or visit http://www.sun.com if you need * additional information or have any questions. */ #include <config.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include "internal.h" #include "datatypes.h" #include "domain_conf.h" #include "snapshot_conf.h" #include "network_conf.h" #include "virerror.h" #include "domain_event.h" #include "storage_conf.h" #include "virstoragefile.h" #include "viruuid.h" #include "viralloc.h" #include "nodeinfo.h" #include "virlog.h" #include "vbox_driver.h" #include "configmake.h" #include "virfile.h" #include "fdstream.h" #include "viruri.h" #include "virstring.h" /* This one changes from version to version. */ #if VBOX_API_VERSION == 2002 # include "vbox_CAPI_v2_2.h" #elif VBOX_API_VERSION == 3000 # include "vbox_CAPI_v3_0.h" #elif VBOX_API_VERSION == 3001 # include "vbox_CAPI_v3_1.h" #elif VBOX_API_VERSION == 3002 # include "vbox_CAPI_v3_2.h" #elif VBOX_API_VERSION == 4000 # include "vbox_CAPI_v4_0.h" #elif VBOX_API_VERSION == 4001 # include "vbox_CAPI_v4_1.h" #elif VBOX_API_VERSION == 4002 # include "vbox_CAPI_v4_2.h" #elif VBOX_API_VERSION == 4003 # include "vbox_CAPI_v4_3.h" #else # error "Unsupport VBOX_API_VERSION" #endif /* Include this *last* or we'll get the wrong vbox_CAPI_*.h. */ #include "vbox_glue.h" #define VIR_FROM_THIS VIR_FROM_VBOX #define VBOX_UTF16_FREE(arg) \ do { \ if (arg) { \ data->pFuncs->pfnUtf16Free(arg); \ (arg) = NULL; \ } \ } while (0) #define VBOX_UTF8_FREE(arg) \ do { \ if (arg) { \ data->pFuncs->pfnUtf8Free(arg); \ (arg) = NULL; \ } \ } while (0) #define VBOX_COM_UNALLOC_MEM(arg) \ do { \ if (arg) { \ data->pFuncs->pfnComUnallocMem(arg); \ (arg) = NULL; \ } \ } while (0) #define VBOX_UTF16_TO_UTF8(arg1, arg2) data->pFuncs->pfnUtf16ToUtf8(arg1, arg2) #define VBOX_UTF8_TO_UTF16(arg1, arg2) data->pFuncs->pfnUtf8ToUtf16(arg1, arg2) #define VBOX_ADDREF(arg) (arg)->vtbl->nsisupports.AddRef((nsISupports *)(arg)) #define VBOX_RELEASE(arg) \ do { \ if (arg) { \ (arg)->vtbl->nsisupports.Release((nsISupports *)(arg)); \ (arg) = NULL; \ } \ } while (0) #define VBOX_OBJECT_CHECK(conn, type, value) \ vboxGlobalData *data = conn->privateData;\ type ret = value;\ if (!data->vboxObj) {\ return ret;\ } #define VBOX_OBJECT_HOST_CHECK(conn, type, value) \ vboxGlobalData *data = conn->privateData;\ type ret = value;\ IHost *host = NULL;\ if (!data->vboxObj) {\ return ret;\ }\ data->vboxObj->vtbl->GetHost(data->vboxObj, &host);\ if (!host) {\ return ret;\ } #if VBOX_API_VERSION < 3001 # define VBOX_MEDIUM_RELEASE(arg) \ if (arg)\ (arg)->vtbl->imedium.nsisupports.Release((nsISupports *)(arg)) # define VBOX_MEDIUM_FUNC_ARG1(object, func, arg1) \ (object)->vtbl->imedium.func((IMedium *)(object), arg1) # define VBOX_MEDIUM_FUNC_ARG2(object, func, arg1, arg2) \ (object)->vtbl->imedium.func((IMedium *)(object), arg1, arg2) #else /* VBOX_API_VERSION >= 3001 */ typedef IMedium IHardDisk; typedef IMediumAttachment IHardDiskAttachment; # define MediaState_Inaccessible MediumState_Inaccessible # define HardDiskVariant_Standard MediumVariant_Standard # define HardDiskVariant_Fixed MediumVariant_Fixed # define VBOX_MEDIUM_RELEASE(arg) VBOX_RELEASE(arg) # define VBOX_MEDIUM_FUNC_ARG1(object, func, arg1) \ (object)->vtbl->func(object, arg1) # define VBOX_MEDIUM_FUNC_ARG2(object, func, arg1, arg2) \ (object)->vtbl->func(object, arg1, arg2) #endif /* VBOX_API_VERSION >= 3001 */ #define DEBUGPRUnichar(msg, strUtf16) \ if (strUtf16) {\ char *strUtf8 = NULL;\ \ g_pVBoxGlobalData->pFuncs->pfnUtf16ToUtf8(strUtf16, &strUtf8);\ if (strUtf8) {\ VIR_DEBUG("%s: %s", msg, strUtf8);\ g_pVBoxGlobalData->pFuncs->pfnUtf8Free(strUtf8);\ }\ } #define DEBUGUUID(msg, iid) \ {\ VIR_DEBUG(msg ": {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",\ (unsigned)(iid)->m0,\ (unsigned)(iid)->m1,\ (unsigned)(iid)->m2,\ (unsigned)(iid)->m3[0],\ (unsigned)(iid)->m3[1],\ (unsigned)(iid)->m3[2],\ (unsigned)(iid)->m3[3],\ (unsigned)(iid)->m3[4],\ (unsigned)(iid)->m3[5],\ (unsigned)(iid)->m3[6],\ (unsigned)(iid)->m3[7]);\ }\ typedef struct { virMutex lock; unsigned long version; virCapsPtr caps; virDomainXMLOptionPtr xmlopt; IVirtualBox *vboxObj; ISession *vboxSession; /** Our version specific API table pointer. */ PCVBOXXPCOM pFuncs; #if VBOX_API_VERSION == 2002 } vboxGlobalData; #else /* !(VBOX_API_VERSION == 2002) */ /* Async event handling */ virObjectEventStatePtr domainEvents; int fdWatch; # if VBOX_API_VERSION <= 3002 /* IVirtualBoxCallback is used in VirtualBox 3.x only */ IVirtualBoxCallback *vboxCallback; # endif /* VBOX_API_VERSION <= 3002 */ nsIEventQueue *vboxQueue; int volatile vboxCallBackRefCount; /* pointer back to the connection */ virConnectPtr conn; } vboxGlobalData; /* g_pVBoxGlobalData has to be global variable, * there is no other way to make the callbacks * work other then having g_pVBoxGlobalData as * global, because the functions namely AddRef, * Release, etc consider it as global and you * can't change the function definition as it * is XPCOM nsISupport::* function and it expects * them that way */ static vboxGlobalData *g_pVBoxGlobalData = NULL; #endif /* !(VBOX_API_VERSION == 2002) */ #if VBOX_API_VERSION < 4000 # define VBOX_OBJECT_GET_MACHINE(/* in */ iid_value, /* out */ machine) \ data->vboxObj->vtbl->GetMachine(data->vboxObj, iid_value, machine) # define VBOX_SESSION_OPEN(/* in */ iid_value, /* unused */ machine) \ data->vboxObj->vtbl->OpenSession(data->vboxObj, data->vboxSession, iid_value) # define VBOX_SESSION_OPEN_EXISTING(/* in */ iid_value, /* unused */ machine) \ data->vboxObj->vtbl->OpenExistingSession(data->vboxObj, data->vboxSession, iid_value) # define VBOX_SESSION_CLOSE() \ data->vboxSession->vtbl->Close(data->vboxSession) #else /* VBOX_API_VERSION >= 4000 */ # define VBOX_OBJECT_GET_MACHINE(/* in */ iid_value, /* out */ machine) \ data->vboxObj->vtbl->FindMachine(data->vboxObj, iid_value, machine) # define VBOX_SESSION_OPEN(/* unused */ iid_value, /* in */ machine) \ machine->vtbl->LockMachine(machine, data->vboxSession, LockType_Write) # define VBOX_SESSION_OPEN_EXISTING(/* unused */ iid_value, /* in */ machine) \ machine->vtbl->LockMachine(machine, data->vboxSession, LockType_Shared) # define VBOX_SESSION_CLOSE() \ data->vboxSession->vtbl->UnlockMachine(data->vboxSession) #endif /* VBOX_API_VERSION >= 4000 */ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml); static int vboxDomainCreate(virDomainPtr dom); static int vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags); static void vboxDriverLock(vboxGlobalData *data) { virMutexLock(&data->lock); } static void vboxDriverUnlock(vboxGlobalData *data) { virMutexUnlock(&data->lock); } #if VBOX_API_VERSION == 2002 static void nsIDtoChar(unsigned char *uuid, const nsID *iid) { char uuidstrsrc[VIR_UUID_STRING_BUFLEN]; char uuidstrdst[VIR_UUID_STRING_BUFLEN]; unsigned char uuidinterim[VIR_UUID_BUFLEN]; size_t i; memcpy(uuidinterim, iid, VIR_UUID_BUFLEN); virUUIDFormat(uuidinterim, uuidstrsrc); uuidstrdst[0] = uuidstrsrc[6]; uuidstrdst[1] = uuidstrsrc[7]; uuidstrdst[2] = uuidstrsrc[4]; uuidstrdst[3] = uuidstrsrc[5]; uuidstrdst[4] = uuidstrsrc[2]; uuidstrdst[5] = uuidstrsrc[3]; uuidstrdst[6] = uuidstrsrc[0]; uuidstrdst[7] = uuidstrsrc[1]; uuidstrdst[8] = uuidstrsrc[8]; uuidstrdst[9] = uuidstrsrc[11]; uuidstrdst[10] = uuidstrsrc[12]; uuidstrdst[11] = uuidstrsrc[9]; uuidstrdst[12] = uuidstrsrc[10]; uuidstrdst[13] = uuidstrsrc[13]; uuidstrdst[14] = uuidstrsrc[16]; uuidstrdst[15] = uuidstrsrc[17]; uuidstrdst[16] = uuidstrsrc[14]; uuidstrdst[17] = uuidstrsrc[15]; for (i = 18; i < VIR_UUID_STRING_BUFLEN; i++) { uuidstrdst[i] = uuidstrsrc[i]; } uuidstrdst[VIR_UUID_STRING_BUFLEN-1] = '\0'; ignore_value(virUUIDParse(uuidstrdst, uuid)); } static void nsIDFromChar(nsID *iid, const unsigned char *uuid) { char uuidstrsrc[VIR_UUID_STRING_BUFLEN]; char uuidstrdst[VIR_UUID_STRING_BUFLEN]; unsigned char uuidinterim[VIR_UUID_BUFLEN]; size_t i; virUUIDFormat(uuid, uuidstrsrc); uuidstrdst[0] = uuidstrsrc[6]; uuidstrdst[1] = uuidstrsrc[7]; uuidstrdst[2] = uuidstrsrc[4]; uuidstrdst[3] = uuidstrsrc[5]; uuidstrdst[4] = uuidstrsrc[2]; uuidstrdst[5] = uuidstrsrc[3]; uuidstrdst[6] = uuidstrsrc[0]; uuidstrdst[7] = uuidstrsrc[1]; uuidstrdst[8] = uuidstrsrc[8]; uuidstrdst[9] = uuidstrsrc[11]; uuidstrdst[10] = uuidstrsrc[12]; uuidstrdst[11] = uuidstrsrc[9]; uuidstrdst[12] = uuidstrsrc[10]; uuidstrdst[13] = uuidstrsrc[13]; uuidstrdst[14] = uuidstrsrc[16]; uuidstrdst[15] = uuidstrsrc[17]; uuidstrdst[16] = uuidstrsrc[14]; uuidstrdst[17] = uuidstrsrc[15]; for (i = 18; i < VIR_UUID_STRING_BUFLEN; i++) { uuidstrdst[i] = uuidstrsrc[i]; } uuidstrdst[VIR_UUID_STRING_BUFLEN-1] = '\0'; ignore_value(virUUIDParse(uuidstrdst, uuidinterim)); memcpy(iid, uuidinterim, VIR_UUID_BUFLEN); } # ifdef WIN32 typedef struct _vboxIID_v2_x_WIN32 vboxIID; typedef struct _vboxIID_v2_x_WIN32 vboxIID_v2_x_WIN32; struct _vboxIID_v2_x_WIN32 { /* IID is represented by a GUID value. */ GUID value; }; # define VBOX_IID_INITIALIZER { { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } } } static void vboxIIDUnalloc_v2_x_WIN32(vboxGlobalData *data ATTRIBUTE_UNUSED, vboxIID_v2_x_WIN32 *iid ATTRIBUTE_UNUSED) { /* Nothing to free */ } static void vboxIIDToUUID_v2_x_WIN32(vboxIID_v2_x_WIN32 *iid, unsigned char *uuid) { nsIDtoChar(uuid, (nsID *)&iid->value); } static void vboxIIDFromUUID_v2_x_WIN32(vboxGlobalData *data, vboxIID_v2_x_WIN32 *iid, const unsigned char *uuid) { vboxIIDUnalloc_v2_x_WIN32(data, iid); nsIDFromChar((nsID *)&iid->value, uuid); } static bool vboxIIDIsEqual_v2_x_WIN32(vboxIID_v2_x_WIN32 *iid1, vboxIID_v2_x_WIN32 *iid2) { return memcmp(&iid1->value, &iid2->value, sizeof(GUID)) == 0; } static void vboxIIDFromArrayItem_v2_x_WIN32(vboxGlobalData *data, vboxIID_v2_x_WIN32 *iid, vboxArray *array, int idx) { GUID *items = (GUID *)array->items; vboxIIDUnalloc_v2_x_WIN32(data, iid); memcpy(&iid->value, &items[idx], sizeof(GUID)); } # define vboxIIDUnalloc(iid) vboxIIDUnalloc_v2_x_WIN32(data, iid) # define vboxIIDToUUID(iid, uuid) vboxIIDToUUID_v2_x_WIN32(iid, uuid) # define vboxIIDFromUUID(iid, uuid) vboxIIDFromUUID_v2_x_WIN32(data, iid, uuid) # define vboxIIDIsEqual(iid1, iid2) vboxIIDIsEqual_v2_x_WIN32(iid1, iid2) # define vboxIIDFromArrayItem(iid, array, idx) \ vboxIIDFromArrayItem_v2_x_WIN32(data, iid, array, idx) # define DEBUGIID(msg, iid) DEBUGUUID(msg, (nsID *)&(iid)) # else /* !WIN32 */ typedef struct _vboxIID_v2_x vboxIID; typedef struct _vboxIID_v2_x vboxIID_v2_x; struct _vboxIID_v2_x { /* IID is represented by a pointer to a nsID. */ nsID *value; /* backing is used in cases where we need to create or copy an IID. * We cannot allocate memory that can be freed by ComUnallocMem. * Therefore, we use this stack allocated nsID instead. */ nsID backing; }; # define VBOX_IID_INITIALIZER { NULL, { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } } } static void vboxIIDUnalloc_v2_x(vboxGlobalData *data, vboxIID_v2_x *iid) { if (iid->value == NULL) { return; } if (iid->value != &iid->backing) { data->pFuncs->pfnComUnallocMem(iid->value); } iid->value = NULL; } static void vboxIIDToUUID_v2_x(vboxIID_v2_x *iid, unsigned char *uuid) { nsIDtoChar(uuid, iid->value); } static void vboxIIDFromUUID_v2_x(vboxGlobalData *data, vboxIID_v2_x *iid, const unsigned char *uuid) { vboxIIDUnalloc_v2_x(data, iid); iid->value = &iid->backing; sa_assert(iid->value); nsIDFromChar(iid->value, uuid); } static bool vboxIIDIsEqual_v2_x(vboxIID_v2_x *iid1, vboxIID_v2_x *iid2) { return memcmp(iid1->value, iid2->value, sizeof(nsID)) == 0; } static void vboxIIDFromArrayItem_v2_x(vboxGlobalData *data, vboxIID_v2_x *iid, vboxArray *array, int idx) { vboxIIDUnalloc_v2_x(data, iid); iid->value = &iid->backing; memcpy(iid->value, array->items[idx], sizeof(nsID)); } # define vboxIIDUnalloc(iid) vboxIIDUnalloc_v2_x(data, iid) # define vboxIIDToUUID(iid, uuid) vboxIIDToUUID_v2_x(iid, uuid) # define vboxIIDFromUUID(iid, uuid) vboxIIDFromUUID_v2_x(data, iid, uuid) # define vboxIIDIsEqual(iid1, iid2) vboxIIDIsEqual_v2_x(iid1, iid2) # define vboxIIDFromArrayItem(iid, array, idx) \ vboxIIDFromArrayItem_v2_x(data, iid, array, idx) # define DEBUGIID(msg, iid) DEBUGUUID(msg, iid) # endif /* !WIN32 */ #else /* VBOX_API_VERSION != 2002 */ typedef struct _vboxIID_v3_x vboxIID; typedef struct _vboxIID_v3_x vboxIID_v3_x; struct _vboxIID_v3_x { /* IID is represented by a UTF-16 encoded UUID in string form. */ PRUnichar *value; /* owner indicates if we own the value and need to free it. */ bool owner; }; # define VBOX_IID_INITIALIZER { NULL, true } static void vboxIIDUnalloc_v3_x(vboxGlobalData *data, vboxIID_v3_x *iid) { if (iid->value != NULL && iid->owner) { data->pFuncs->pfnUtf16Free(iid->value); } iid->value = NULL; iid->owner = true; } static void vboxIIDToUUID_v3_x(vboxGlobalData *data, vboxIID_v3_x *iid, unsigned char *uuid) { char *utf8 = NULL; data->pFuncs->pfnUtf16ToUtf8(iid->value, &utf8); ignore_value(virUUIDParse(utf8, uuid)); data->pFuncs->pfnUtf8Free(utf8); } static void vboxIIDFromUUID_v3_x(vboxGlobalData *data, vboxIID_v3_x *iid, const unsigned char *uuid) { char utf8[VIR_UUID_STRING_BUFLEN]; vboxIIDUnalloc_v3_x(data, iid); virUUIDFormat(uuid, utf8); data->pFuncs->pfnUtf8ToUtf16(utf8, &iid->value); } static bool vboxIIDIsEqual_v3_x(vboxGlobalData *data, vboxIID_v3_x *iid1, vboxIID_v3_x *iid2) { unsigned char uuid1[VIR_UUID_BUFLEN]; unsigned char uuid2[VIR_UUID_BUFLEN]; /* Note: we can't directly compare the utf8 strings here * cause the two UUID's may have separators as space or '-' * or mixture of both and we don't want to fail here by * using direct string comparison. Here virUUIDParse() takes * care of these cases. */ vboxIIDToUUID_v3_x(data, iid1, uuid1); vboxIIDToUUID_v3_x(data, iid2, uuid2); return memcmp(uuid1, uuid2, VIR_UUID_BUFLEN) == 0; } static void vboxIIDFromArrayItem_v3_x(vboxGlobalData *data, vboxIID_v3_x *iid, vboxArray *array, int idx) { vboxIIDUnalloc_v3_x(data, iid); iid->value = array->items[idx]; iid->owner = false; } # define vboxIIDUnalloc(iid) vboxIIDUnalloc_v3_x(data, iid) # define vboxIIDToUUID(iid, uuid) vboxIIDToUUID_v3_x(data, iid, uuid) # define vboxIIDFromUUID(iid, uuid) vboxIIDFromUUID_v3_x(data, iid, uuid) # define vboxIIDIsEqual(iid1, iid2) vboxIIDIsEqual_v3_x(data, iid1, iid2) # define vboxIIDFromArrayItem(iid, array, idx) \ vboxIIDFromArrayItem_v3_x(data, iid, array, idx) # define DEBUGIID(msg, strUtf16) DEBUGPRUnichar(msg, strUtf16) # if VBOX_API_VERSION >= 3001 /** * function to generate the name for medium, * for e.g: hda, sda, etc * * @returns null terminated string with device name or NULL * for failures * @param conn Input Connection Pointer * @param storageBus Input storage bus type * @param deviceInst Input device instance number * @param devicePort Input port number * @param deviceSlot Input slot number * @param aMaxPortPerInst Input array of max port per device instance * @param aMaxSlotPerPort Input array of max slot per device port * */ static char *vboxGenerateMediumName(PRUint32 storageBus, PRInt32 deviceInst, PRInt32 devicePort, PRInt32 deviceSlot, PRUint32 *aMaxPortPerInst, PRUint32 *aMaxSlotPerPort) { const char *prefix = NULL; char *name = NULL; int total = 0; PRUint32 maxPortPerInst = 0; PRUint32 maxSlotPerPort = 0; if (!aMaxPortPerInst || !aMaxSlotPerPort) return NULL; if ((storageBus < StorageBus_IDE) || (storageBus > StorageBus_Floppy)) return NULL; maxPortPerInst = aMaxPortPerInst[storageBus]; maxSlotPerPort = aMaxSlotPerPort[storageBus]; total = (deviceInst * maxPortPerInst * maxSlotPerPort) + (devicePort * maxSlotPerPort) + deviceSlot; if (storageBus == StorageBus_IDE) { prefix = "hd"; } else if ((storageBus == StorageBus_SATA) || (storageBus == StorageBus_SCSI)) { prefix = "sd"; } else if (storageBus == StorageBus_Floppy) { prefix = "fd"; } name = virIndexToDiskName(total, prefix); VIR_DEBUG("name=%s, total=%d, storageBus=%u, deviceInst=%d, " "devicePort=%d deviceSlot=%d, maxPortPerInst=%u maxSlotPerPort=%u", NULLSTR(name), total, storageBus, deviceInst, devicePort, deviceSlot, maxPortPerInst, maxSlotPerPort); return name; } /** * function to get the StorageBus, Port number * and Device number for the given devicename * e.g: hda has StorageBus = IDE, port = 0, * device = 0 * * @returns true on Success, false on failure. * @param deviceName Input device name * @param aMaxPortPerInst Input array of max port per device instance * @param aMaxSlotPerPort Input array of max slot per device port * @param storageBus Input storage bus type * @param deviceInst Output device instance number * @param devicePort Output port number * @param deviceSlot Output slot number * */ static bool vboxGetDeviceDetails(const char *deviceName, PRUint32 *aMaxPortPerInst, PRUint32 *aMaxSlotPerPort, PRUint32 storageBus, PRInt32 *deviceInst, PRInt32 *devicePort, PRInt32 *deviceSlot) { int total = 0; PRUint32 maxPortPerInst = 0; PRUint32 maxSlotPerPort = 0; if (!deviceName || !deviceInst || !devicePort || !deviceSlot || !aMaxPortPerInst || !aMaxSlotPerPort) return false; if ((storageBus < StorageBus_IDE) || (storageBus > StorageBus_Floppy)) return false; total = virDiskNameToIndex(deviceName); maxPortPerInst = aMaxPortPerInst[storageBus]; maxSlotPerPort = aMaxSlotPerPort[storageBus]; if (!maxPortPerInst || !maxSlotPerPort || (total < 0)) return false; *deviceInst = total / (maxPortPerInst * maxSlotPerPort); *devicePort = (total % (maxPortPerInst * maxSlotPerPort)) / maxSlotPerPort; *deviceSlot = (total % (maxPortPerInst * maxSlotPerPort)) % maxSlotPerPort; VIR_DEBUG("name=%s, total=%d, storageBus=%u, deviceInst=%d, " "devicePort=%d deviceSlot=%d, maxPortPerInst=%u maxSlotPerPort=%u", deviceName, total, storageBus, *deviceInst, *devicePort, *deviceSlot, maxPortPerInst, maxSlotPerPort); return true; } /** * function to get the values for max port per * instance and max slots per port for the devices * * @returns true on Success, false on failure. * @param vbox Input IVirtualBox pointer * @param maxPortPerInst Output array of max port per instance * @param maxSlotPerPort Output array of max slot per port * */ static bool vboxGetMaxPortSlotValues(IVirtualBox *vbox, PRUint32 *maxPortPerInst, PRUint32 *maxSlotPerPort) { ISystemProperties *sysProps = NULL; if (!vbox) return false; vbox->vtbl->GetSystemProperties(vbox, &sysProps); if (!sysProps) return false; sysProps->vtbl->GetMaxPortCountForStorageBus(sysProps, StorageBus_IDE, &maxPortPerInst[StorageBus_IDE]); sysProps->vtbl->GetMaxPortCountForStorageBus(sysProps, StorageBus_SATA, &maxPortPerInst[StorageBus_SATA]); sysProps->vtbl->GetMaxPortCountForStorageBus(sysProps, StorageBus_SCSI, &maxPortPerInst[StorageBus_SCSI]); sysProps->vtbl->GetMaxPortCountForStorageBus(sysProps, StorageBus_Floppy, &maxPortPerInst[StorageBus_Floppy]); sysProps->vtbl->GetMaxDevicesPerPortForStorageBus(sysProps, StorageBus_IDE, &maxSlotPerPort[StorageBus_IDE]); sysProps->vtbl->GetMaxDevicesPerPortForStorageBus(sysProps, StorageBus_SATA, &maxSlotPerPort[StorageBus_SATA]); sysProps->vtbl->GetMaxDevicesPerPortForStorageBus(sysProps, StorageBus_SCSI, &maxSlotPerPort[StorageBus_SCSI]); sysProps->vtbl->GetMaxDevicesPerPortForStorageBus(sysProps, StorageBus_Floppy, &maxSlotPerPort[StorageBus_Floppy]); VBOX_RELEASE(sysProps); return true; } /** * Converts Utf-16 string to int */ static int PRUnicharToInt(PRUnichar *strUtf16) { char *strUtf8 = NULL; int ret = 0; if (!strUtf16) return -1; g_pVBoxGlobalData->pFuncs->pfnUtf16ToUtf8(strUtf16, &strUtf8); if (!strUtf8) return -1; if (virStrToLong_i(strUtf8, NULL, 10, &ret) < 0) ret = -1; g_pVBoxGlobalData->pFuncs->pfnUtf8Free(strUtf8); return ret; } /** * Converts int to Utf-16 string */ static PRUnichar *PRUnicharFromInt(int n) { PRUnichar *strUtf16 = NULL; char s[24]; snprintf(s, sizeof(s), "%d", n); g_pVBoxGlobalData->pFuncs->pfnUtf8ToUtf16(s, &strUtf16); return strUtf16; } # endif /* VBOX_API_VERSION >= 3001 */ #endif /* !(VBOX_API_VERSION == 2002) */ static PRUnichar * vboxSocketFormatAddrUtf16(vboxGlobalData *data, virSocketAddrPtr addr) { char *utf8 = NULL; PRUnichar *utf16 = NULL; utf8 = virSocketAddrFormat(addr); if (utf8 == NULL) { return NULL; } VBOX_UTF8_TO_UTF16(utf8, &utf16); VIR_FREE(utf8); return utf16; } static int vboxSocketParseAddrUtf16(vboxGlobalData *data, const PRUnichar *utf16, virSocketAddrPtr addr) { int result = -1; char *utf8 = NULL; VBOX_UTF16_TO_UTF8(utf16, &utf8); if (virSocketAddrParse(addr, utf8, AF_UNSPEC) < 0) { goto cleanup; } result = 0; cleanup: VBOX_UTF8_FREE(utf8); return result; } static virDomainDefParserConfig vboxDomainDefParserConfig = { .macPrefix = { 0x08, 0x00, 0x27 }, }; static virDomainXMLOptionPtr vboxXMLConfInit(void) { return virDomainXMLOptionNew(&vboxDomainDefParserConfig, NULL, NULL); } static virCapsPtr vboxCapsInit(void) { virCapsPtr caps; virCapsGuestPtr guest; if ((caps = virCapabilitiesNew(virArchFromHost(), 0, 0)) == NULL) goto no_memory; if (nodeCapsInitNUMA(caps) < 0) goto no_memory; if ((guest = virCapabilitiesAddGuest(caps, "hvm", caps->host.arch, NULL, NULL, 0, NULL)) == NULL) goto no_memory; if (virCapabilitiesAddGuestDomain(guest, "vbox", NULL, NULL, 0, NULL) == NULL) goto no_memory; return caps; no_memory: virObjectUnref(caps); return NULL; } static int vboxInitialize(vboxGlobalData *data) { data->pFuncs = g_pfnGetFunctions(VBOX_XPCOMC_VERSION); if (data->pFuncs == NULL) goto cleanup; #if VBOX_XPCOMC_VERSION == 0x00010000U data->pFuncs->pfnComInitialize(&data->vboxObj, &data->vboxSession); #else /* !(VBOX_XPCOMC_VERSION == 0x00010000U) */ data->pFuncs->pfnComInitialize(IVIRTUALBOX_IID_STR, &data->vboxObj, ISESSION_IID_STR, &data->vboxSession); # if VBOX_API_VERSION == 2002 /* No event queue functionality in 2.2.* as of now */ # else /* !(VBOX_API_VERSION == 2002) */ /* Initial the fWatch needed for Event Callbacks */ data->fdWatch = -1; data->pFuncs->pfnGetEventQueue(&data->vboxQueue); if (data->vboxQueue == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nsIEventQueue object is null")); goto cleanup; } # endif /* !(VBOX_API_VERSION == 2002) */ #endif /* !(VBOX_XPCOMC_VERSION == 0x00010000U) */ if (data->vboxObj == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("IVirtualBox object is null")); goto cleanup; } if (data->vboxSession == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("ISession object is null")); goto cleanup; } return 0; cleanup: return -1; } static int vboxExtractVersion(vboxGlobalData *data) { int ret = -1; PRUnichar *versionUtf16 = NULL; nsresult rc; if (data->version > 0) return 0; rc = data->vboxObj->vtbl->GetVersion(data->vboxObj, &versionUtf16); if (NS_SUCCEEDED(rc)) { char *vboxVersion = NULL; VBOX_UTF16_TO_UTF8(versionUtf16, &vboxVersion); if (virParseVersionString(vboxVersion, &data->version, false) >= 0) ret = 0; VBOX_UTF8_FREE(vboxVersion); VBOX_COM_UNALLOC_MEM(versionUtf16); } if (ret != 0) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not extract VirtualBox version")); return ret; } static void vboxUninitialize(vboxGlobalData *data) { if (!data) return; if (data->pFuncs) data->pFuncs->pfnComUninitialize(); virObjectUnref(data->caps); virObjectUnref(data->xmlopt); #if VBOX_API_VERSION == 2002 /* No domainEventCallbacks in 2.2.* version */ #else /* !(VBOX_API_VERSION == 2002) */ virObjectEventStateFree(data->domainEvents); #endif /* !(VBOX_API_VERSION == 2002) */ VIR_FREE(data); } static virDrvOpenStatus vboxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED, unsigned int flags) { vboxGlobalData *data = NULL; uid_t uid = geteuid(); virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); if (conn->uri == NULL && !(conn->uri = virURIParse(uid ? "vbox:///session" : "vbox:///system"))) return VIR_DRV_OPEN_ERROR; if (conn->uri->scheme == NULL || STRNEQ(conn->uri->scheme, "vbox")) return VIR_DRV_OPEN_DECLINED; /* Leave for remote driver */ if (conn->uri->server != NULL) return VIR_DRV_OPEN_DECLINED; if (conn->uri->path == NULL || STREQ(conn->uri->path, "")) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no VirtualBox driver path specified (try vbox:///session)")); return VIR_DRV_OPEN_ERROR; } if (uid != 0) { if (STRNEQ(conn->uri->path, "/session")) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path); return VIR_DRV_OPEN_ERROR; } } else { /* root */ if (STRNEQ(conn->uri->path, "/system") && STRNEQ(conn->uri->path, "/session")) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path); return VIR_DRV_OPEN_ERROR; } } if (VIR_ALLOC(data) < 0) return VIR_DRV_OPEN_ERROR; if (!(data->caps = vboxCapsInit()) || vboxInitialize(data) < 0 || vboxExtractVersion(data) < 0 || !(data->xmlopt = vboxXMLConfInit())) { vboxUninitialize(data); return VIR_DRV_OPEN_ERROR; } #if VBOX_API_VERSION == 2002 /* No domainEventCallbacks in 2.2.* version */ #else /* !(VBOX_API_VERSION == 2002) */ if (!(data->domainEvents = virObjectEventStateNew())) { vboxUninitialize(data); return VIR_DRV_OPEN_ERROR; } data->conn = conn; g_pVBoxGlobalData = data; #endif /* !(VBOX_API_VERSION == 2002) */ conn->privateData = data; VIR_DEBUG("in vboxOpen"); return VIR_DRV_OPEN_SUCCESS; } static int vboxConnectClose(virConnectPtr conn) { vboxGlobalData *data = conn->privateData; VIR_DEBUG("%s: in vboxClose", conn->driver->name); vboxUninitialize(data); conn->privateData = NULL; return 0; } static int vboxConnectGetVersion(virConnectPtr conn, unsigned long *version) { vboxGlobalData *data = conn->privateData; VIR_DEBUG("%s: in vboxGetVersion", conn->driver->name); vboxDriverLock(data); *version = data->version; vboxDriverUnlock(data); return 0; } static char *vboxConnectGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED) { return virGetHostname(); } static int vboxConnectIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED) { /* Driver is using local, non-network based transport */ return 1; } static int vboxConnectIsEncrypted(virConnectPtr conn ATTRIBUTE_UNUSED) { /* No encryption is needed, or used on the local transport*/ return 0; } static int vboxConnectIsAlive(virConnectPtr conn ATTRIBUTE_UNUSED) { return 1; } static int vboxConnectGetMaxVcpus(virConnectPtr conn, const char *type ATTRIBUTE_UNUSED) { VBOX_OBJECT_CHECK(conn, int, -1); PRUint32 maxCPUCount = 0; /* VirtualBox Supports only hvm and thus the type passed to it * has no meaning, setting it to ATTRIBUTE_UNUSED */ ISystemProperties *systemProperties = NULL; data->vboxObj->vtbl->GetSystemProperties(data->vboxObj, &systemProperties); if (systemProperties) { systemProperties->vtbl->GetMaxGuestCPUCount(systemProperties, &maxCPUCount); VBOX_RELEASE(systemProperties); } if (maxCPUCount > 0) ret = maxCPUCount; return ret; } static char *vboxConnectGetCapabilities(virConnectPtr conn) { VBOX_OBJECT_CHECK(conn, char *, NULL); vboxDriverLock(data); ret = virCapabilitiesFormatXML(data->caps); vboxDriverUnlock(data); return ret; } static int vboxConnectListDomains(virConnectPtr conn, int *ids, int nids) { VBOX_OBJECT_CHECK(conn, int, -1); vboxArray machines = VBOX_ARRAY_INITIALIZER; PRUint32 state; nsresult rc; size_t i, j; rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get list of Domains, rc=%08x"), (unsigned)rc); goto cleanup; } ret = 0; for (i = 0, j = 0; (i < machines.count) && (j < nids); ++i) { IMachine *machine = machines.items[i]; if (machine) { PRBool isAccessible = PR_FALSE; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetState(machine, &state); if ((state >= MachineState_FirstOnline) && (state <= MachineState_LastOnline)) { ret++; ids[j++] = i + 1; } } } } cleanup: vboxArrayRelease(&machines); return ret; } static int vboxConnectNumOfDomains(virConnectPtr conn) { VBOX_OBJECT_CHECK(conn, int, -1); vboxArray machines = VBOX_ARRAY_INITIALIZER; PRUint32 state; nsresult rc; size_t i; rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get number of Domains, rc=%08x"), (unsigned)rc); goto cleanup; } ret = 0; for (i = 0; i < machines.count; ++i) { IMachine *machine = machines.items[i]; if (machine) { PRBool isAccessible = PR_FALSE; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetState(machine, &state); if ((state >= MachineState_FirstOnline) && (state <= MachineState_LastOnline)) ret++; } } } cleanup: vboxArrayRelease(&machines); return ret; } static virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml, unsigned int flags) { /* VirtualBox currently doesn't have support for running * virtual machines without actually defining them and thus * for time being just define new machine and start it. * * TODO: After the appropriate API's are added in VirtualBox * change this behaviour to the expected one. */ virDomainPtr dom; virCheckFlags(0, NULL); dom = vboxDomainDefineXML(conn, xml); if (dom == NULL) return NULL; if (vboxDomainCreate(dom) < 0) { vboxDomainUndefineFlags(dom, 0); virObjectUnref(dom); return NULL; } return dom; } static virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id) { VBOX_OBJECT_CHECK(conn, virDomainPtr, NULL); vboxArray machines = VBOX_ARRAY_INITIALIZER; vboxIID iid = VBOX_IID_INITIALIZER; unsigned char uuid[VIR_UUID_BUFLEN]; PRUint32 state; nsresult rc; /* Internal vbox IDs start from 0, the public libvirt ID * starts from 1, so refuse id==0, and adjust the rest*/ if (id == 0) { virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching id %d"), id); return NULL; } id = id - 1; rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get list of machines, rc=%08x"), (unsigned)rc); return NULL; } if (id < machines.count) { IMachine *machine = machines.items[id]; if (machine) { PRBool isAccessible = PR_FALSE; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetState(machine, &state); if ((state >= MachineState_FirstOnline) && (state <= MachineState_LastOnline)) { PRUnichar *machineNameUtf16 = NULL; char *machineNameUtf8 = NULL; machine->vtbl->GetName(machine, &machineNameUtf16); VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineNameUtf8); machine->vtbl->GetId(machine, &iid.value); vboxIIDToUUID(&iid, uuid); vboxIIDUnalloc(&iid); /* get a new domain pointer from virGetDomain, if it fails * then no need to assign the id, else assign the id, cause * it is -1 by default. rest is taken care by virGetDomain * itself, so need not worry. */ ret = virGetDomain(conn, machineNameUtf8, uuid); if (ret) ret->id = id + 1; /* Cleanup all the XPCOM allocated stuff here */ VBOX_UTF8_FREE(machineNameUtf8); VBOX_UTF16_FREE(machineNameUtf16); } } } } vboxArrayRelease(&machines); return ret; } static virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid) { VBOX_OBJECT_CHECK(conn, virDomainPtr, NULL); vboxArray machines = VBOX_ARRAY_INITIALIZER; vboxIID iid = VBOX_IID_INITIALIZER; char *machineNameUtf8 = NULL; PRUnichar *machineNameUtf16 = NULL; unsigned char iid_as_uuid[VIR_UUID_BUFLEN]; size_t i; int matched = 0; nsresult rc; rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get list of machines, rc=%08x"), (unsigned)rc); return NULL; } for (i = 0; i < machines.count; ++i) { IMachine *machine = machines.items[i]; PRBool isAccessible = PR_FALSE; if (!machine) continue; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { rc = machine->vtbl->GetId(machine, &iid.value); if (NS_FAILED(rc)) continue; vboxIIDToUUID(&iid, iid_as_uuid); vboxIIDUnalloc(&iid); if (memcmp(uuid, iid_as_uuid, VIR_UUID_BUFLEN) == 0) { PRUint32 state; matched = 1; machine->vtbl->GetName(machine, &machineNameUtf16); VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineNameUtf8); machine->vtbl->GetState(machine, &state); /* get a new domain pointer from virGetDomain, if it fails * then no need to assign the id, else assign the id, cause * it is -1 by default. rest is taken care by virGetDomain * itself, so need not worry. */ ret = virGetDomain(conn, machineNameUtf8, iid_as_uuid); if (ret && (state >= MachineState_FirstOnline) && (state <= MachineState_LastOnline)) ret->id = i + 1; } if (matched == 1) break; } } /* Do the cleanup and take care you dont leak any memory */ VBOX_UTF8_FREE(machineNameUtf8); VBOX_COM_UNALLOC_MEM(machineNameUtf16); vboxArrayRelease(&machines); return ret; } static virDomainPtr vboxDomainLookupByName(virConnectPtr conn, const char *name) { VBOX_OBJECT_CHECK(conn, virDomainPtr, NULL); vboxArray machines = VBOX_ARRAY_INITIALIZER; vboxIID iid = VBOX_IID_INITIALIZER; char *machineNameUtf8 = NULL; PRUnichar *machineNameUtf16 = NULL; unsigned char uuid[VIR_UUID_BUFLEN]; size_t i; int matched = 0; nsresult rc; rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get list of machines, rc=%08x"), (unsigned)rc); return NULL; } for (i = 0; i < machines.count; ++i) { IMachine *machine = machines.items[i]; PRBool isAccessible = PR_FALSE; if (!machine) continue; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetName(machine, &machineNameUtf16); VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineNameUtf8); if (STREQ(name, machineNameUtf8)) { PRUint32 state; matched = 1; machine->vtbl->GetId(machine, &iid.value); vboxIIDToUUID(&iid, uuid); vboxIIDUnalloc(&iid); machine->vtbl->GetState(machine, &state); /* get a new domain pointer from virGetDomain, if it fails * then no need to assign the id, else assign the id, cause * it is -1 by default. rest is taken care by virGetDomain * itself, so need not worry. */ ret = virGetDomain(conn, machineNameUtf8, uuid); if (ret && (state >= MachineState_FirstOnline) && (state <= MachineState_LastOnline)) ret->id = i + 1; } VBOX_UTF8_FREE(machineNameUtf8); VBOX_COM_UNALLOC_MEM(machineNameUtf16); if (matched == 1) break; } } vboxArrayRelease(&machines); return ret; } static int vboxDomainIsActive(virDomainPtr dom) { VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxArray machines = VBOX_ARRAY_INITIALIZER; vboxIID iid = VBOX_IID_INITIALIZER; char *machineNameUtf8 = NULL; PRUnichar *machineNameUtf16 = NULL; unsigned char uuid[VIR_UUID_BUFLEN]; size_t i; int matched = 0; nsresult rc; rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get list of machines, rc=%08x"), (unsigned)rc); return ret; } for (i = 0; i < machines.count; ++i) { IMachine *machine = machines.items[i]; PRBool isAccessible = PR_FALSE; if (!machine) continue; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { rc = machine->vtbl->GetId(machine, &iid.value); if (NS_FAILED(rc)) continue; vboxIIDToUUID(&iid, uuid); vboxIIDUnalloc(&iid); if (memcmp(dom->uuid, uuid, VIR_UUID_BUFLEN) == 0) { PRUint32 state; matched = 1; machine->vtbl->GetName(machine, &machineNameUtf16); VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineNameUtf8); machine->vtbl->GetState(machine, &state); if ((state >= MachineState_FirstOnline) && (state <= MachineState_LastOnline)) ret = 1; else ret = 0; } if (matched == 1) break; } } /* Do the cleanup and take care you dont leak any memory */ VBOX_UTF8_FREE(machineNameUtf8); VBOX_COM_UNALLOC_MEM(machineNameUtf16); vboxArrayRelease(&machines); return ret; } static int vboxDomainIsPersistent(virDomainPtr dom ATTRIBUTE_UNUSED) { /* All domains are persistent. However, we do want to check for * existence. */ VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxIID iid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; nsresult rc; vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } ret = 1; cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED) { /* VBox domains never have a persistent state that differs from * current state. However, we do want to check for existence. */ VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxIID iid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; nsresult rc; vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } ret = 0; cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainSuspend(virDomainPtr dom) { VBOX_OBJECT_CHECK(dom->conn, int, -1); IMachine *machine = NULL; vboxIID iid = VBOX_IID_INITIALIZER; IConsole *console = NULL; PRBool isAccessible = PR_FALSE; PRUint32 state; nsresult rc; vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching id %d"), dom->id); goto cleanup; } if (!machine) goto cleanup; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetState(machine, &state); if (state == MachineState_Running) { /* set state pause */ VBOX_SESSION_OPEN_EXISTING(iid.value, machine); data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (console) { console->vtbl->Pause(console); VBOX_RELEASE(console); ret = 0; } else { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("error while suspending the domain")); goto cleanup; } VBOX_SESSION_CLOSE(); } else { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("machine not in running state to suspend it")); goto cleanup; } } cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainResume(virDomainPtr dom) { VBOX_OBJECT_CHECK(dom->conn, int, -1); IMachine *machine = NULL; vboxIID iid = VBOX_IID_INITIALIZER; IConsole *console = NULL; PRUint32 state = MachineState_Null; nsresult rc; PRBool isAccessible = PR_FALSE; vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching id %d"), dom->id); goto cleanup; } if (!machine) goto cleanup; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetState(machine, &state); if (state == MachineState_Paused) { /* resume the machine here */ VBOX_SESSION_OPEN_EXISTING(iid.value, machine); data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (console) { console->vtbl->Resume(console); VBOX_RELEASE(console); ret = 0; } else { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("error while resuming the domain")); goto cleanup; } VBOX_SESSION_CLOSE(); } else { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("machine not paused, so can't resume it")); goto cleanup; } } cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainShutdownFlags(virDomainPtr dom, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, int, -1); IMachine *machine = NULL; vboxIID iid = VBOX_IID_INITIALIZER; IConsole *console = NULL; PRUint32 state = MachineState_Null; PRBool isAccessible = PR_FALSE; nsresult rc; virCheckFlags(0, -1); vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching id %d"), dom->id); goto cleanup; } if (!machine) goto cleanup; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetState(machine, &state); if (state == MachineState_Paused) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("machine paused, so can't power it down")); goto cleanup; } else if (state == MachineState_PoweredOff) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("machine already powered down")); goto cleanup; } VBOX_SESSION_OPEN_EXISTING(iid.value, machine); data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (console) { console->vtbl->PowerButton(console); VBOX_RELEASE(console); ret = 0; } VBOX_SESSION_CLOSE(); } cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainShutdown(virDomainPtr dom) { return vboxDomainShutdownFlags(dom, 0); } static int vboxDomainReboot(virDomainPtr dom, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, int, -1); IMachine *machine = NULL; vboxIID iid = VBOX_IID_INITIALIZER; IConsole *console = NULL; PRUint32 state = MachineState_Null; PRBool isAccessible = PR_FALSE; nsresult rc; virCheckFlags(0, -1); vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching id %d"), dom->id); goto cleanup; } if (!machine) goto cleanup; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetState(machine, &state); if (state == MachineState_Running) { VBOX_SESSION_OPEN_EXISTING(iid.value, machine); data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (console) { console->vtbl->Reset(console); VBOX_RELEASE(console); ret = 0; } VBOX_SESSION_CLOSE(); } else { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("machine not running, so can't reboot it")); goto cleanup; } } cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainDestroyFlags(virDomainPtr dom, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, int, -1); IMachine *machine = NULL; vboxIID iid = VBOX_IID_INITIALIZER; IConsole *console = NULL; PRUint32 state = MachineState_Null; PRBool isAccessible = PR_FALSE; nsresult rc; virCheckFlags(0, -1); vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching id %d"), dom->id); goto cleanup; } if (!machine) goto cleanup; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetState(machine, &state); if (state == MachineState_PoweredOff) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("machine already powered down")); goto cleanup; } VBOX_SESSION_OPEN_EXISTING(iid.value, machine); data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (console) { #if VBOX_API_VERSION == 2002 console->vtbl->PowerDown(console); #else IProgress *progress = NULL; console->vtbl->PowerDown(console, &progress); if (progress) { progress->vtbl->WaitForCompletion(progress, -1); VBOX_RELEASE(progress); } #endif VBOX_RELEASE(console); dom->id = -1; ret = 0; } VBOX_SESSION_CLOSE(); } cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainDestroy(virDomainPtr dom) { return vboxDomainDestroyFlags(dom, 0); } static char *vboxDomainGetOSType(virDomainPtr dom ATTRIBUTE_UNUSED) { /* Returning "hvm" always as suggested on list, cause * this functions seems to be badly named and it * is supposed to pass the ABI name and not the domain * operating system driver as I had imagined ;) */ char *osType; ignore_value(VIR_STRDUP(osType, "hvm")); return osType; } static int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory) { VBOX_OBJECT_CHECK(dom->conn, int, -1); IMachine *machine = NULL; vboxIID iid = VBOX_IID_INITIALIZER; PRUint32 state = MachineState_Null; PRBool isAccessible = PR_FALSE; nsresult rc; vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching id %d"), dom->id); goto cleanup; } if (!machine) goto cleanup; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetState(machine, &state); if (state != MachineState_PoweredOff) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("memory size can't be changed unless domain is powered down")); goto cleanup; } rc = VBOX_SESSION_OPEN(iid.value, machine); if (NS_SUCCEEDED(rc)) { rc = data->vboxSession->vtbl->GetMachine(data->vboxSession, &machine); if (NS_SUCCEEDED(rc) && machine) { rc = machine->vtbl->SetMemorySize(machine, VIR_DIV_UP(memory, 1024)); if (NS_SUCCEEDED(rc)) { machine->vtbl->SaveSettings(machine); ret = 0; } else { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not set the memory size of the " "domain to: %lu Kb, rc=%08x"), memory, (unsigned)rc); } } VBOX_SESSION_CLOSE(); } } cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static virDomainState vboxConvertState(enum MachineState state) { switch (state) { case MachineState_Running: return VIR_DOMAIN_RUNNING; case MachineState_Stuck: return VIR_DOMAIN_BLOCKED; case MachineState_Paused: return VIR_DOMAIN_PAUSED; case MachineState_Stopping: return VIR_DOMAIN_SHUTDOWN; case MachineState_PoweredOff: case MachineState_Saved: return VIR_DOMAIN_SHUTOFF; case MachineState_Aborted: return VIR_DOMAIN_CRASHED; case MachineState_Null: default: return VIR_DOMAIN_NOSTATE; } } static int vboxDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) { VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxArray machines = VBOX_ARRAY_INITIALIZER; char *machineName = NULL; PRUnichar *machineNameUtf16 = NULL; nsresult rc; size_t i = 0; rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get list of machines, rc=%08x"), (unsigned)rc); goto cleanup; } info->nrVirtCpu = 0; for (i = 0; i < machines.count; ++i) { IMachine *machine = machines.items[i]; PRBool isAccessible = PR_FALSE; if (!machine) continue; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetName(machine, &machineNameUtf16); VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName); if (STREQ(dom->name, machineName)) { /* Get the Machine State (also match it with * virDomainState). Get the Machine memory and * for time being set max_balloon and cur_balloon to same * Also since there is no direct way of checking * the cputime required (one condition being the * VM is remote), return zero for cputime. Get the * number of CPU. */ PRUint32 CPUCount = 0; PRUint32 memorySize = 0; PRUint32 state = MachineState_Null; PRUint32 maxMemorySize = 4 * 1024; ISystemProperties *systemProperties = NULL; data->vboxObj->vtbl->GetSystemProperties(data->vboxObj, &systemProperties); if (systemProperties) { systemProperties->vtbl->GetMaxGuestRAM(systemProperties, &maxMemorySize); VBOX_RELEASE(systemProperties); systemProperties = NULL; } machine->vtbl->GetCPUCount(machine, &CPUCount); machine->vtbl->GetMemorySize(machine, &memorySize); machine->vtbl->GetState(machine, &state); info->cpuTime = 0; info->nrVirtCpu = CPUCount; info->memory = memorySize * 1024; info->maxMem = maxMemorySize * 1024; info->state = vboxConvertState(state); ret = 0; } VBOX_UTF8_FREE(machineName); VBOX_COM_UNALLOC_MEM(machineNameUtf16); if (info->nrVirtCpu) break; } } vboxArrayRelease(&machines); cleanup: return ret; } static int vboxDomainGetState(virDomainPtr dom, int *state, int *reason, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxIID domiid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; PRUint32 mstate = MachineState_Null; nsresult rc; virCheckFlags(0, -1); vboxIIDFromUUID(&domiid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } machine->vtbl->GetState(machine, &mstate); *state = vboxConvertState(mstate); if (reason) *reason = 0; ret = 0; cleanup: vboxIIDUnalloc(&domiid); return ret; } static int vboxDomainSave(virDomainPtr dom, const char *path ATTRIBUTE_UNUSED) { VBOX_OBJECT_CHECK(dom->conn, int, -1); IConsole *console = NULL; vboxIID iid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; nsresult rc; /* VirtualBox currently doesn't support saving to a file * at a location other then the machine folder and thus * setting path to ATTRIBUTE_UNUSED for now, will change * this behaviour once get the VirtualBox API in right * shape to do this */ /* Open a Session for the machine */ vboxIIDFromUUID(&iid, dom->uuid); #if VBOX_API_VERSION >= 4000 /* Get machine for the call to VBOX_SESSION_OPEN_EXISTING */ rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); return -1; } #endif rc = VBOX_SESSION_OPEN_EXISTING(iid.value, machine); if (NS_SUCCEEDED(rc)) { rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (NS_SUCCEEDED(rc) && console) { IProgress *progress = NULL; console->vtbl->SaveState(console, &progress); if (progress) { #if VBOX_API_VERSION == 2002 nsresult resultCode; #else PRInt32 resultCode; #endif progress->vtbl->WaitForCompletion(progress, -1); progress->vtbl->GetResultCode(progress, &resultCode); if (NS_SUCCEEDED(resultCode)) { ret = 0; } VBOX_RELEASE(progress); } VBOX_RELEASE(console); } VBOX_SESSION_CLOSE(); } DEBUGIID("UUID of machine being saved:", iid.value); VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, int, -1); IMachine *machine = NULL; vboxIID iid = VBOX_IID_INITIALIZER; PRUint32 CPUCount = nvcpus; nsresult rc; if (flags != VIR_DOMAIN_AFFECT_LIVE) { virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); return -1; } vboxIIDFromUUID(&iid, dom->uuid); #if VBOX_API_VERSION >= 4000 /* Get machine for the call to VBOX_SESSION_OPEN */ rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); return -1; } #endif rc = VBOX_SESSION_OPEN(iid.value, machine); if (NS_SUCCEEDED(rc)) { data->vboxSession->vtbl->GetMachine(data->vboxSession, &machine); if (machine) { rc = machine->vtbl->SetCPUCount(machine, CPUCount); if (NS_SUCCEEDED(rc)) { machine->vtbl->SaveSettings(machine); ret = 0; } else { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not set the number of cpus of the domain " "to: %u, rc=%08x"), CPUCount, (unsigned)rc); } VBOX_RELEASE(machine); } else { virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching id %d"), dom->id); } } else { virReportError(VIR_ERR_NO_DOMAIN, _("can't open session to the domain with id %d"), dom->id); } VBOX_SESSION_CLOSE(); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) { return vboxDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_AFFECT_LIVE); } static int vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, int, -1); ISystemProperties *systemProperties = NULL; PRUint32 maxCPUCount = 0; if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) { virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); return -1; } /* Currently every domain supports the same number of max cpus * as that supported by vbox and thus take it directly from * the systemproperties. */ data->vboxObj->vtbl->GetSystemProperties(data->vboxObj, &systemProperties); if (systemProperties) { systemProperties->vtbl->GetMaxGuestCPUCount(systemProperties, &maxCPUCount); VBOX_RELEASE(systemProperties); } if (maxCPUCount > 0) ret = maxCPUCount; return ret; } static int vboxDomainGetMaxVcpus(virDomainPtr dom) { return vboxDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)); } static void vboxHostDeviceGetXMLDesc(vboxGlobalData *data, virDomainDefPtr def, IMachine *machine) { #if VBOX_API_VERSION < 4003 IUSBController *USBController = NULL; PRBool enabled = PR_FALSE; #else IUSBDeviceFilters *USBDeviceFilters = NULL; #endif vboxArray deviceFilters = VBOX_ARRAY_INITIALIZER; size_t i; PRUint32 USBFilterCount = 0; def->nhostdevs = 0; #if VBOX_API_VERSION < 4003 machine->vtbl->GetUSBController(machine, &USBController); if (!USBController) return; USBController->vtbl->GetEnabled(USBController, &enabled); if (!enabled) goto release_controller; vboxArrayGet(&deviceFilters, USBController, USBController->vtbl->GetDeviceFilters); #else machine->vtbl->GetUSBDeviceFilters(machine, &USBDeviceFilters); if (!USBDeviceFilters) return; vboxArrayGet(&deviceFilters, USBDeviceFilters, USBDeviceFilters->vtbl->GetDeviceFilters); #endif if (deviceFilters.count <= 0) goto release_filters; /* check if the filters are active and then only * alloc mem and set def->nhostdevs */ for (i = 0; i < deviceFilters.count; i++) { PRBool active = PR_FALSE; IUSBDeviceFilter *deviceFilter = deviceFilters.items[i]; deviceFilter->vtbl->GetActive(deviceFilter, &active); if (active) { def->nhostdevs++; } } if (def->nhostdevs == 0) goto release_filters; /* Alloc mem needed for the filters now */ if (VIR_ALLOC_N(def->hostdevs, def->nhostdevs) < 0) goto release_filters; for (i = 0; (USBFilterCount < def->nhostdevs) || (i < deviceFilters.count); i++) { PRBool active = PR_FALSE; IUSBDeviceFilter *deviceFilter = deviceFilters.items[i]; PRUnichar *vendorIdUtf16 = NULL; char *vendorIdUtf8 = NULL; unsigned vendorId = 0; PRUnichar *productIdUtf16 = NULL; char *productIdUtf8 = NULL; unsigned productId = 0; char *endptr = NULL; deviceFilter->vtbl->GetActive(deviceFilter, &active); if (!active) continue; def->hostdevs[USBFilterCount] = virDomainHostdevDefAlloc(); if (!def->hostdevs[USBFilterCount]) continue; def->hostdevs[USBFilterCount]->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; def->hostdevs[USBFilterCount]->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB; deviceFilter->vtbl->GetVendorId(deviceFilter, &vendorIdUtf16); deviceFilter->vtbl->GetProductId(deviceFilter, &productIdUtf16); VBOX_UTF16_TO_UTF8(vendorIdUtf16, &vendorIdUtf8); VBOX_UTF16_TO_UTF8(productIdUtf16, &productIdUtf8); vendorId = strtol(vendorIdUtf8, &endptr, 16); productId = strtol(productIdUtf8, &endptr, 16); def->hostdevs[USBFilterCount]->source.subsys.u.usb.vendor = vendorId; def->hostdevs[USBFilterCount]->source.subsys.u.usb.product = productId; VBOX_UTF16_FREE(vendorIdUtf16); VBOX_UTF8_FREE(vendorIdUtf8); VBOX_UTF16_FREE(productIdUtf16); VBOX_UTF8_FREE(productIdUtf8); USBFilterCount++; } release_filters: vboxArrayRelease(&deviceFilters); #if VBOX_API_VERSION < 4003 release_controller: VBOX_RELEASE(USBController); #else VBOX_RELEASE(USBDeviceFilters); #endif } static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, char *, NULL); virDomainDefPtr def = NULL; IMachine *machine = NULL; vboxIID iid = VBOX_IID_INITIALIZER; int gotAllABoutDef = -1; nsresult rc; /* Flags checked by virDomainDefFormat */ if (VIR_ALLOC(def) < 0) goto cleanup; vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_SUCCEEDED(rc)) { PRBool accessible = PR_FALSE; machine->vtbl->GetAccessible(machine, &accessible); if (accessible) { size_t i = 0; PRBool PAEEnabled = PR_FALSE; PRBool ACPIEnabled = PR_FALSE; PRBool IOAPICEnabled = PR_FALSE; PRBool VRDxEnabled = PR_FALSE; PRUint32 CPUCount = 0; PRUint32 memorySize = 0; PRUint32 netAdpCnt = 0; PRUint32 netAdpIncCnt = 0; PRUint32 maxMemorySize = 4 * 1024; PRUint32 maxBootPosition = 0; PRUint32 serialPortCount = 0; PRUint32 serialPortIncCount = 0; PRUint32 parallelPortCount = 0; PRUint32 parallelPortIncCount = 0; IBIOSSettings *bios = NULL; #if VBOX_API_VERSION < 3001 PRInt32 hddNum = 0; IDVDDrive *dvdDrive = NULL; IHardDisk *hardDiskPM = NULL; IHardDisk *hardDiskPS = NULL; IHardDisk *hardDiskSS = NULL; const char *hddBus = "IDE"; PRUnichar *hddBusUtf16 = NULL; IFloppyDrive *floppyDrive = NULL; #else /* VBOX_API_VERSION >= 3001 */ vboxArray mediumAttachments = VBOX_ARRAY_INITIALIZER; #endif /* VBOX_API_VERSION >= 3001 */ #if VBOX_API_VERSION < 4000 IVRDPServer *VRDxServer = NULL; #else /* VBOX_API_VERSION >= 4000 */ IVRDEServer *VRDxServer = NULL; #endif /* VBOX_API_VERSION >= 4000 */ IAudioAdapter *audioAdapter = NULL; #if VBOX_API_VERSION >= 4001 PRUint32 chipsetType = ChipsetType_Null; #endif /* VBOX_API_VERSION >= 4001 */ ISystemProperties *systemProperties = NULL; def->virtType = VIR_DOMAIN_VIRT_VBOX; def->id = dom->id; memcpy(def->uuid, dom->uuid, VIR_UUID_BUFLEN); if (VIR_STRDUP(def->name, dom->name) < 0) goto cleanup; machine->vtbl->GetMemorySize(machine, &memorySize); def->mem.cur_balloon = memorySize * 1024; #if VBOX_API_VERSION >= 4001 machine->vtbl->GetChipsetType(machine, &chipsetType); #endif /* VBOX_API_VERSION >= 4001 */ data->vboxObj->vtbl->GetSystemProperties(data->vboxObj, &systemProperties); if (systemProperties) { systemProperties->vtbl->GetMaxGuestRAM(systemProperties, &maxMemorySize); systemProperties->vtbl->GetMaxBootPosition(systemProperties, &maxBootPosition); #if VBOX_API_VERSION < 4001 systemProperties->vtbl->GetNetworkAdapterCount(systemProperties, &netAdpCnt); #else /* VBOX_API_VERSION >= 4000 */ systemProperties->vtbl->GetMaxNetworkAdapters(systemProperties, chipsetType, &netAdpCnt); #endif /* VBOX_API_VERSION >= 4000 */ systemProperties->vtbl->GetSerialPortCount(systemProperties, &serialPortCount); systemProperties->vtbl->GetParallelPortCount(systemProperties, &parallelPortCount); VBOX_RELEASE(systemProperties); systemProperties = NULL; } /* Currently setting memory and maxMemory as same, cause * the notation here seems to be inconsistent while * reading and while dumping xml */ /* def->mem.max_balloon = maxMemorySize * 1024; */ def->mem.max_balloon = memorySize * 1024; machine->vtbl->GetCPUCount(machine, &CPUCount); def->maxvcpus = def->vcpus = CPUCount; /* Skip cpumasklen, cpumask, onReboot, onPoweroff, onCrash */ if (VIR_STRDUP(def->os.type, "hvm") < 0) goto cleanup; def->os.arch = virArchFromHost(); def->os.nBootDevs = 0; for (i = 0; (i < VIR_DOMAIN_BOOT_LAST) && (i < maxBootPosition); i++) { PRUint32 device = DeviceType_Null; machine->vtbl->GetBootOrder(machine, i+1, &device); if (device == DeviceType_Floppy) { def->os.bootDevs[i] = VIR_DOMAIN_BOOT_FLOPPY; def->os.nBootDevs++; } else if (device == DeviceType_DVD) { def->os.bootDevs[i] = VIR_DOMAIN_BOOT_CDROM; def->os.nBootDevs++; } else if (device == DeviceType_HardDisk) { def->os.bootDevs[i] = VIR_DOMAIN_BOOT_DISK; def->os.nBootDevs++; } else if (device == DeviceType_Network) { def->os.bootDevs[i] = VIR_DOMAIN_BOOT_NET; def->os.nBootDevs++; } else if (device == DeviceType_USB) { /* Not supported by libvirt yet */ } else if (device == DeviceType_SharedFolder) { /* Not supported by libvirt yet */ /* Can VirtualBox really boot from a shared folder? */ } } #if VBOX_API_VERSION < 3001 machine->vtbl->GetPAEEnabled(machine, &PAEEnabled); #elif VBOX_API_VERSION == 3001 machine->vtbl->GetCpuProperty(machine, CpuPropertyType_PAE, &PAEEnabled); #elif VBOX_API_VERSION >= 3002 machine->vtbl->GetCPUProperty(machine, CPUPropertyType_PAE, &PAEEnabled); #endif if (PAEEnabled) def->features[VIR_DOMAIN_FEATURE_PAE] = VIR_DOMAIN_FEATURE_STATE_ON; machine->vtbl->GetBIOSSettings(machine, &bios); if (bios) { bios->vtbl->GetACPIEnabled(bios, &ACPIEnabled); if (ACPIEnabled) def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_DOMAIN_FEATURE_STATE_ON; bios->vtbl->GetIOAPICEnabled(bios, &IOAPICEnabled); if (IOAPICEnabled) def->features[VIR_DOMAIN_FEATURE_APIC] = VIR_DOMAIN_FEATURE_STATE_ON; VBOX_RELEASE(bios); } /* Currently VirtualBox always uses locatime * so locatime is always true here */ def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME; /* dump video options vram/2d/3d/directx/etc. */ { /* Currently supports only one graphics card */ def->nvideos = 1; if (VIR_ALLOC_N(def->videos, def->nvideos) >= 0) { if (VIR_ALLOC(def->videos[0]) >= 0) { /* the default is: vram is 8MB, One monitor, 3dAccel Off */ PRUint32 VRAMSize = 8; PRUint32 monitorCount = 1; PRBool accelerate3DEnabled = PR_FALSE; PRBool accelerate2DEnabled = PR_FALSE; machine->vtbl->GetVRAMSize(machine, &VRAMSize); machine->vtbl->GetMonitorCount(machine, &monitorCount); machine->vtbl->GetAccelerate3DEnabled(machine, &accelerate3DEnabled); #if VBOX_API_VERSION >= 3001 machine->vtbl->GetAccelerate2DVideoEnabled(machine, &accelerate2DEnabled); #endif /* VBOX_API_VERSION >= 3001 */ def->videos[0]->type = VIR_DOMAIN_VIDEO_TYPE_VBOX; def->videos[0]->vram = VRAMSize * 1024; def->videos[0]->heads = monitorCount; if (VIR_ALLOC(def->videos[0]->accel) >= 0) { def->videos[0]->accel->support3d = accelerate3DEnabled; def->videos[0]->accel->support2d = accelerate2DEnabled; } } } } /* dump display options vrdp/gui/sdl */ { int vrdpPresent = 0; int sdlPresent = 0; int guiPresent = 0; int totalPresent = 0; char *guiDisplay = NULL; char *sdlDisplay = NULL; PRUnichar *keyTypeUtf16 = NULL; PRUnichar *valueTypeUtf16 = NULL; char *valueTypeUtf8 = NULL; def->ngraphics = 0; VBOX_UTF8_TO_UTF16("FRONTEND/Type", &keyTypeUtf16); machine->vtbl->GetExtraData(machine, keyTypeUtf16, &valueTypeUtf16); VBOX_UTF16_FREE(keyTypeUtf16); if (valueTypeUtf16) { VBOX_UTF16_TO_UTF8(valueTypeUtf16, &valueTypeUtf8); VBOX_UTF16_FREE(valueTypeUtf16); if (STREQ(valueTypeUtf8, "sdl") || STREQ(valueTypeUtf8, "gui")) { PRUnichar *keyDislpayUtf16 = NULL; PRUnichar *valueDisplayUtf16 = NULL; char *valueDisplayUtf8 = NULL; VBOX_UTF8_TO_UTF16("FRONTEND/Display", &keyDislpayUtf16); machine->vtbl->GetExtraData(machine, keyDislpayUtf16, &valueDisplayUtf16); VBOX_UTF16_FREE(keyDislpayUtf16); if (valueDisplayUtf16) { VBOX_UTF16_TO_UTF8(valueDisplayUtf16, &valueDisplayUtf8); VBOX_UTF16_FREE(valueDisplayUtf16); if (strlen(valueDisplayUtf8) <= 0) VBOX_UTF8_FREE(valueDisplayUtf8); } if (STREQ(valueTypeUtf8, "sdl")) { sdlPresent = 1; if (VIR_STRDUP(sdlDisplay, valueDisplayUtf8) < 0) { /* just don't go to cleanup yet as it is ok to have * sdlDisplay as NULL and we check it below if it * exist and then only use it there */ } totalPresent++; } if (STREQ(valueTypeUtf8, "gui")) { guiPresent = 1; if (VIR_STRDUP(guiDisplay, valueDisplayUtf8) < 0) { /* just don't go to cleanup yet as it is ok to have * guiDisplay as NULL and we check it below if it * exist and then only use it there */ } totalPresent++; } VBOX_UTF8_FREE(valueDisplayUtf8); } if (STREQ(valueTypeUtf8, "vrdp")) vrdpPresent = 1; VBOX_UTF8_FREE(valueTypeUtf8); } if ((totalPresent > 0) && (VIR_ALLOC_N(def->graphics, totalPresent) >= 0)) { if ((guiPresent) && (VIR_ALLOC(def->graphics[def->ngraphics]) >= 0)) { def->graphics[def->ngraphics]->type = VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP; if (guiDisplay) def->graphics[def->ngraphics]->data.desktop.display = guiDisplay; def->ngraphics++; } if ((sdlPresent) && (VIR_ALLOC(def->graphics[def->ngraphics]) >= 0)) { def->graphics[def->ngraphics]->type = VIR_DOMAIN_GRAPHICS_TYPE_SDL; if (sdlDisplay) def->graphics[def->ngraphics]->data.sdl.display = sdlDisplay; def->ngraphics++; } } else if ((vrdpPresent != 1) && (totalPresent == 0) && (VIR_ALLOC_N(def->graphics, 1) >= 0)) { if (VIR_ALLOC(def->graphics[def->ngraphics]) >= 0) { const char *tmp; def->graphics[def->ngraphics]->type = VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP; tmp = virGetEnvBlockSUID("DISPLAY"); if (VIR_STRDUP(def->graphics[def->ngraphics]->data.desktop.display, tmp) < 0) { /* just don't go to cleanup yet as it is ok to have * display as NULL */ } totalPresent++; def->ngraphics++; } } #if VBOX_API_VERSION < 4000 machine->vtbl->GetVRDPServer(machine, &VRDxServer); #else /* VBOX_API_VERSION >= 4000 */ machine->vtbl->GetVRDEServer(machine, &VRDxServer); #endif /* VBOX_API_VERSION >= 4000 */ if (VRDxServer) { VRDxServer->vtbl->GetEnabled(VRDxServer, &VRDxEnabled); if (VRDxEnabled) { totalPresent++; if ((VIR_REALLOC_N(def->graphics, totalPresent) >= 0) && (VIR_ALLOC(def->graphics[def->ngraphics]) >= 0)) { PRUnichar *netAddressUtf16 = NULL; char *netAddressUtf8 = NULL; PRBool allowMultiConnection = PR_FALSE; PRBool reuseSingleConnection = PR_FALSE; #if VBOX_API_VERSION < 3001 PRUint32 VRDPport = 0; VRDxServer->vtbl->GetPort(VRDxServer, &VRDPport); if (VRDPport) { def->graphics[def->ngraphics]->data.rdp.port = VRDPport; #elif VBOX_API_VERSION < 4000 /* 3001 <= VBOX_API_VERSION < 4000 */ PRUnichar *VRDPport = NULL; VRDxServer->vtbl->GetPorts(VRDxServer, &VRDPport); if (VRDPport) { /* even if vbox supports mutilpe ports, single port for now here */ def->graphics[def->ngraphics]->data.rdp.port = PRUnicharToInt(VRDPport); VBOX_UTF16_FREE(VRDPport); #else /* VBOX_API_VERSION >= 4000 */ PRUnichar *VRDEPortsKey = NULL; PRUnichar *VRDEPortsValue = NULL; VBOX_UTF8_TO_UTF16("TCP/Ports", &VRDEPortsKey); VRDxServer->vtbl->GetVRDEProperty(VRDxServer, VRDEPortsKey, &VRDEPortsValue); VBOX_UTF16_FREE(VRDEPortsKey); if (VRDEPortsValue) { /* even if vbox supports mutilpe ports, single port for now here */ def->graphics[def->ngraphics]->data.rdp.port = PRUnicharToInt(VRDEPortsValue); VBOX_UTF16_FREE(VRDEPortsValue); #endif /* VBOX_API_VERSION >= 4000 */ } else { def->graphics[def->ngraphics]->data.rdp.autoport = true; } def->graphics[def->ngraphics]->type = VIR_DOMAIN_GRAPHICS_TYPE_RDP; #if VBOX_API_VERSION >= 4000 PRUnichar *VRDENetAddressKey = NULL; VBOX_UTF8_TO_UTF16("TCP/Address", &VRDENetAddressKey); VRDxServer->vtbl->GetVRDEProperty(VRDxServer, VRDENetAddressKey, &netAddressUtf16); VBOX_UTF16_FREE(VRDENetAddressKey); #else /* VBOX_API_VERSION < 4000 */ VRDxServer->vtbl->GetNetAddress(VRDxServer, &netAddressUtf16); #endif /* VBOX_API_VERSION < 4000 */ if (netAddressUtf16) { VBOX_UTF16_TO_UTF8(netAddressUtf16, &netAddressUtf8); if (STRNEQ(netAddressUtf8, "")) virDomainGraphicsListenSetAddress(def->graphics[def->ngraphics], 0, netAddressUtf8, -1, true); VBOX_UTF16_FREE(netAddressUtf16); VBOX_UTF8_FREE(netAddressUtf8); } VRDxServer->vtbl->GetAllowMultiConnection(VRDxServer, &allowMultiConnection); if (allowMultiConnection) { def->graphics[def->ngraphics]->data.rdp.multiUser = true; } VRDxServer->vtbl->GetReuseSingleConnection(VRDxServer, &reuseSingleConnection); if (reuseSingleConnection) { def->graphics[def->ngraphics]->data.rdp.replaceUser = true; } def->ngraphics++; } else virReportOOMError(); } VBOX_RELEASE(VRDxServer); } } #if VBOX_API_VERSION < 3001 /* dump IDE hdds if present */ VBOX_UTF8_TO_UTF16(hddBus, &hddBusUtf16); def->ndisks = 0; machine->vtbl->GetHardDisk(machine, hddBusUtf16, 0, 0, &hardDiskPM); if (hardDiskPM) def->ndisks++; machine->vtbl->GetHardDisk(machine, hddBusUtf16, 0, 1, &hardDiskPS); if (hardDiskPS) def->ndisks++; machine->vtbl->GetHardDisk(machine, hddBusUtf16, 1, 1, &hardDiskSS); if (hardDiskSS) def->ndisks++; VBOX_UTF16_FREE(hddBusUtf16); if ((def->ndisks > 0) && (VIR_ALLOC_N(def->disks, def->ndisks) >= 0)) { for (i = 0; i < def->ndisks; i++) { if (VIR_ALLOC(def->disks[i]) >= 0) { def->disks[i]->device = VIR_DOMAIN_DISK_DEVICE_DISK; def->disks[i]->bus = VIR_DOMAIN_DISK_BUS_IDE; def->disks[i]->type = VIR_DOMAIN_DISK_TYPE_FILE; } } } if (hardDiskPM) { PRUnichar *hddlocationUtf16 = NULL; char *hddlocation = NULL; PRUint32 hddType = HardDiskType_Normal; hardDiskPM->vtbl->imedium.GetLocation((IMedium *)hardDiskPM, &hddlocationUtf16); VBOX_UTF16_TO_UTF8(hddlocationUtf16, &hddlocation); hardDiskPM->vtbl->GetType(hardDiskPM, &hddType); if (hddType == HardDiskType_Immutable) def->disks[hddNum]->readonly = true; ignore_value(VIR_STRDUP(def->disks[hddNum]->src, hddlocation)); ignore_value(VIR_STRDUP(def->disks[hddNum]->dst, "hda")); hddNum++; VBOX_UTF8_FREE(hddlocation); VBOX_UTF16_FREE(hddlocationUtf16); VBOX_MEDIUM_RELEASE(hardDiskPM); } if (hardDiskPS) { PRUnichar *hddlocationUtf16 = NULL; char *hddlocation = NULL; PRUint32 hddType = HardDiskType_Normal; hardDiskPS->vtbl->imedium.GetLocation((IMedium *)hardDiskPS, &hddlocationUtf16); VBOX_UTF16_TO_UTF8(hddlocationUtf16, &hddlocation); hardDiskPS->vtbl->GetType(hardDiskPS, &hddType); if (hddType == HardDiskType_Immutable) def->disks[hddNum]->readonly = true; ignore_value(VIR_STRDUP(def->disks[hddNum]->src, hddlocation)); ignore_value(VIR_STRDUP(def->disks[hddNum]->dst, "hdb")); hddNum++; VBOX_UTF8_FREE(hddlocation); VBOX_UTF16_FREE(hddlocationUtf16); VBOX_MEDIUM_RELEASE(hardDiskPS); } if (hardDiskSS) { PRUnichar *hddlocationUtf16 = NULL; char *hddlocation = NULL; PRUint32 hddType = HardDiskType_Normal; hardDiskSS->vtbl->imedium.GetLocation((IMedium *)hardDiskSS, &hddlocationUtf16); VBOX_UTF16_TO_UTF8(hddlocationUtf16, &hddlocation); hardDiskSS->vtbl->GetType(hardDiskSS, &hddType); if (hddType == HardDiskType_Immutable) def->disks[hddNum]->readonly = true; ignore_value(VIR_STRDUP(def->disks[hddNum]->src, hddlocation)); ignore_value(VIR_STRDUP(def->disks[hddNum]->dst, "hdd")); hddNum++; VBOX_UTF8_FREE(hddlocation); VBOX_UTF16_FREE(hddlocationUtf16); VBOX_MEDIUM_RELEASE(hardDiskSS); } #else /* VBOX_API_VERSION >= 3001 */ /* dump IDE hdds if present */ bool error = false; int diskCount = 0; PRUint32 maxPortPerInst[StorageBus_Floppy + 1] = {}; PRUint32 maxSlotPerPort[StorageBus_Floppy + 1] = {}; def->ndisks = 0; vboxArrayGet(&mediumAttachments, machine, machine->vtbl->GetMediumAttachments); /* get the number of attachments */ for (i = 0; i < mediumAttachments.count; i++) { IMediumAttachment *imediumattach = mediumAttachments.items[i]; if (imediumattach) { IMedium *medium = NULL; imediumattach->vtbl->GetMedium(imediumattach, &medium); if (medium) { def->ndisks++; VBOX_RELEASE(medium); } } } /* Allocate mem, if fails return error */ if (VIR_ALLOC_N(def->disks, def->ndisks) >= 0) { for (i = 0; i < def->ndisks; i++) { if (VIR_ALLOC(def->disks[i]) < 0) { error = true; break; } } } else { error = true; } if (!error) error = !vboxGetMaxPortSlotValues(data->vboxObj, maxPortPerInst, maxSlotPerPort); /* get the attachment details here */ for (i = 0; i < mediumAttachments.count && diskCount < def->ndisks && !error; i++) { IMediumAttachment *imediumattach = mediumAttachments.items[i]; IStorageController *storageController = NULL; PRUnichar *storageControllerName = NULL; PRUint32 deviceType = DeviceType_Null; PRUint32 storageBus = StorageBus_Null; PRBool readOnly = PR_FALSE; IMedium *medium = NULL; PRUnichar *mediumLocUtf16 = NULL; char *mediumLocUtf8 = NULL; PRUint32 deviceInst = 0; PRInt32 devicePort = 0; PRInt32 deviceSlot = 0; if (!imediumattach) continue; imediumattach->vtbl->GetMedium(imediumattach, &medium); if (!medium) continue; imediumattach->vtbl->GetController(imediumattach, &storageControllerName); if (!storageControllerName) { VBOX_RELEASE(medium); continue; } machine->vtbl->GetStorageControllerByName(machine, storageControllerName, &storageController); VBOX_UTF16_FREE(storageControllerName); if (!storageController) { VBOX_RELEASE(medium); continue; } medium->vtbl->GetLocation(medium, &mediumLocUtf16); VBOX_UTF16_TO_UTF8(mediumLocUtf16, &mediumLocUtf8); VBOX_UTF16_FREE(mediumLocUtf16); ignore_value(VIR_STRDUP(def->disks[diskCount]->src, mediumLocUtf8)); VBOX_UTF8_FREE(mediumLocUtf8); if (!(def->disks[diskCount]->src)) { VBOX_RELEASE(medium); VBOX_RELEASE(storageController); error = true; break; } storageController->vtbl->GetBus(storageController, &storageBus); if (storageBus == StorageBus_IDE) { def->disks[diskCount]->bus = VIR_DOMAIN_DISK_BUS_IDE; } else if (storageBus == StorageBus_SATA) { def->disks[diskCount]->bus = VIR_DOMAIN_DISK_BUS_SATA; } else if (storageBus == StorageBus_SCSI) { def->disks[diskCount]->bus = VIR_DOMAIN_DISK_BUS_SCSI; } else if (storageBus == StorageBus_Floppy) { def->disks[diskCount]->bus = VIR_DOMAIN_DISK_BUS_FDC; } imediumattach->vtbl->GetType(imediumattach, &deviceType); if (deviceType == DeviceType_HardDisk) def->disks[diskCount]->device = VIR_DOMAIN_DISK_DEVICE_DISK; else if (deviceType == DeviceType_Floppy) def->disks[diskCount]->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY; else if (deviceType == DeviceType_DVD) def->disks[diskCount]->device = VIR_DOMAIN_DISK_DEVICE_CDROM; imediumattach->vtbl->GetPort(imediumattach, &devicePort); imediumattach->vtbl->GetDevice(imediumattach, &deviceSlot); def->disks[diskCount]->dst = vboxGenerateMediumName(storageBus, deviceInst, devicePort, deviceSlot, maxPortPerInst, maxSlotPerPort); if (!def->disks[diskCount]->dst) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not generate medium name for the disk " "at: controller instance:%u, port:%d, slot:%d"), deviceInst, devicePort, deviceSlot); VBOX_RELEASE(medium); VBOX_RELEASE(storageController); error = true; break; } medium->vtbl->GetReadOnly(medium, &readOnly); if (readOnly == PR_TRUE) def->disks[diskCount]->readonly = true; def->disks[diskCount]->type = VIR_DOMAIN_DISK_TYPE_FILE; VBOX_RELEASE(medium); VBOX_RELEASE(storageController); diskCount++; } vboxArrayRelease(&mediumAttachments); /* cleanup on error */ if (error) { for (i = 0; i < def->ndisks; i++) { VIR_FREE(def->disks[i]); } VIR_FREE(def->disks); def->ndisks = 0; } #endif /* VBOX_API_VERSION >= 3001 */ /* shared folders */ vboxArray sharedFolders = VBOX_ARRAY_INITIALIZER; def->nfss = 0; vboxArrayGet(&sharedFolders, machine, machine->vtbl->GetSharedFolders); if (sharedFolders.count > 0) { if (VIR_ALLOC_N(def->fss, sharedFolders.count) < 0) goto sharedFoldersCleanup; for (i = 0; i < sharedFolders.count; i++) { ISharedFolder *sharedFolder = sharedFolders.items[i]; PRUnichar *nameUtf16 = NULL; char *name = NULL; PRUnichar *hostPathUtf16 = NULL; char *hostPath = NULL; PRBool writable = PR_FALSE; if (VIR_ALLOC(def->fss[i]) < 0) goto sharedFoldersCleanup; def->fss[i]->type = VIR_DOMAIN_FS_TYPE_MOUNT; sharedFolder->vtbl->GetHostPath(sharedFolder, &hostPathUtf16); VBOX_UTF16_TO_UTF8(hostPathUtf16, &hostPath); if (VIR_STRDUP(def->fss[i]->src, hostPath) < 0) { VBOX_UTF8_FREE(hostPath); VBOX_UTF16_FREE(hostPathUtf16); goto sharedFoldersCleanup; } VBOX_UTF8_FREE(hostPath); VBOX_UTF16_FREE(hostPathUtf16); sharedFolder->vtbl->GetName(sharedFolder, &nameUtf16); VBOX_UTF16_TO_UTF8(nameUtf16, &name); if (VIR_STRDUP(def->fss[i]->dst, name) < 0) { VBOX_UTF8_FREE(name); VBOX_UTF16_FREE(nameUtf16); goto sharedFoldersCleanup; } VBOX_UTF8_FREE(name); VBOX_UTF16_FREE(nameUtf16); sharedFolder->vtbl->GetWritable(sharedFolder, &writable); def->fss[i]->readonly = !writable; ++def->nfss; } } sharedFoldersCleanup: vboxArrayRelease(&sharedFolders); /* dump network cards if present */ def->nnets = 0; /* Get which network cards are enabled */ for (i = 0; i < netAdpCnt; i++) { INetworkAdapter *adapter = NULL; machine->vtbl->GetNetworkAdapter(machine, i, &adapter); if (adapter) { PRBool enabled = PR_FALSE; adapter->vtbl->GetEnabled(adapter, &enabled); if (enabled) { def->nnets++; } VBOX_RELEASE(adapter); } } /* Allocate memory for the networkcards which are enabled */ if ((def->nnets > 0) && (VIR_ALLOC_N(def->nets, def->nnets) >= 0)) { for (i = 0; i < def->nnets; i++) { ignore_value(VIR_ALLOC(def->nets[i])); } } /* Now get the details about the network cards here */ for (i = 0; netAdpIncCnt < def->nnets && i < netAdpCnt; i++) { INetworkAdapter *adapter = NULL; machine->vtbl->GetNetworkAdapter(machine, i, &adapter); if (adapter) { PRBool enabled = PR_FALSE; adapter->vtbl->GetEnabled(adapter, &enabled); if (enabled) { PRUint32 attachmentType = NetworkAttachmentType_Null; PRUint32 adapterType = NetworkAdapterType_Null; PRUnichar *MACAddressUtf16 = NULL; char *MACAddress = NULL; char macaddr[VIR_MAC_STRING_BUFLEN] = {0}; adapter->vtbl->GetAttachmentType(adapter, &attachmentType); if (attachmentType == NetworkAttachmentType_NAT) { def->nets[netAdpIncCnt]->type = VIR_DOMAIN_NET_TYPE_USER; } else if (attachmentType == NetworkAttachmentType_Bridged) { PRUnichar *hostIntUtf16 = NULL; char *hostInt = NULL; def->nets[netAdpIncCnt]->type = VIR_DOMAIN_NET_TYPE_BRIDGE; #if VBOX_API_VERSION < 4001 adapter->vtbl->GetHostInterface(adapter, &hostIntUtf16); #else /* VBOX_API_VERSION >= 4001 */ adapter->vtbl->GetBridgedInterface(adapter, &hostIntUtf16); #endif /* VBOX_API_VERSION >= 4001 */ VBOX_UTF16_TO_UTF8(hostIntUtf16, &hostInt); ignore_value(VIR_STRDUP(def->nets[netAdpIncCnt]->data.bridge.brname, hostInt)); VBOX_UTF8_FREE(hostInt); VBOX_UTF16_FREE(hostIntUtf16); } else if (attachmentType == NetworkAttachmentType_Internal) { PRUnichar *intNetUtf16 = NULL; char *intNet = NULL; def->nets[netAdpIncCnt]->type = VIR_DOMAIN_NET_TYPE_INTERNAL; adapter->vtbl->GetInternalNetwork(adapter, &intNetUtf16); VBOX_UTF16_TO_UTF8(intNetUtf16, &intNet); ignore_value(VIR_STRDUP(def->nets[netAdpIncCnt]->data.internal.name, intNet)); VBOX_UTF8_FREE(intNet); VBOX_UTF16_FREE(intNetUtf16); } else if (attachmentType == NetworkAttachmentType_HostOnly) { PRUnichar *hostIntUtf16 = NULL; char *hostInt = NULL; def->nets[netAdpIncCnt]->type = VIR_DOMAIN_NET_TYPE_NETWORK; #if VBOX_API_VERSION < 4001 adapter->vtbl->GetHostInterface(adapter, &hostIntUtf16); #else /* VBOX_API_VERSION >= 4001 */ adapter->vtbl->GetHostOnlyInterface(adapter, &hostIntUtf16); #endif /* VBOX_API_VERSION >= 4001 */ VBOX_UTF16_TO_UTF8(hostIntUtf16, &hostInt); ignore_value(VIR_STRDUP(def->nets[netAdpIncCnt]->data.network.name, hostInt)); VBOX_UTF8_FREE(hostInt); VBOX_UTF16_FREE(hostIntUtf16); } else { /* default to user type i.e. NAT in VirtualBox if this * dump is ever used to create a machine. */ def->nets[netAdpIncCnt]->type = VIR_DOMAIN_NET_TYPE_USER; } adapter->vtbl->GetAdapterType(adapter, &adapterType); if (adapterType == NetworkAdapterType_Am79C970A) { ignore_value(VIR_STRDUP(def->nets[netAdpIncCnt]->model, "Am79C970A")); } else if (adapterType == NetworkAdapterType_Am79C973) { ignore_value(VIR_STRDUP(def->nets[netAdpIncCnt]->model, "Am79C973")); } else if (adapterType == NetworkAdapterType_I82540EM) { ignore_value(VIR_STRDUP(def->nets[netAdpIncCnt]->model, "82540EM")); } else if (adapterType == NetworkAdapterType_I82545EM) { ignore_value(VIR_STRDUP(def->nets[netAdpIncCnt]->model, "82545EM")); } else if (adapterType == NetworkAdapterType_I82543GC) { ignore_value(VIR_STRDUP(def->nets[netAdpIncCnt]->model, "82543GC")); #if VBOX_API_VERSION >= 3001 } else if (adapterType == NetworkAdapterType_Virtio) { ignore_value(VIR_STRDUP(def->nets[netAdpIncCnt]->model, "virtio")); #endif /* VBOX_API_VERSION >= 3001 */ } adapter->vtbl->GetMACAddress(adapter, &MACAddressUtf16); VBOX_UTF16_TO_UTF8(MACAddressUtf16, &MACAddress); snprintf(macaddr, VIR_MAC_STRING_BUFLEN, "%c%c:%c%c:%c%c:%c%c:%c%c:%c%c", MACAddress[0], MACAddress[1], MACAddress[2], MACAddress[3], MACAddress[4], MACAddress[5], MACAddress[6], MACAddress[7], MACAddress[8], MACAddress[9], MACAddress[10], MACAddress[11]); /* XXX some real error handling here some day ... */ if (virMacAddrParse(macaddr, &def->nets[netAdpIncCnt]->mac) < 0) {} netAdpIncCnt++; VBOX_UTF16_FREE(MACAddressUtf16); VBOX_UTF8_FREE(MACAddress); } VBOX_RELEASE(adapter); } } /* dump sound card if active */ /* Set def->nsounds to one as VirtualBox currently supports * only one sound card */ machine->vtbl->GetAudioAdapter(machine, &audioAdapter); if (audioAdapter) { PRBool enabled = PR_FALSE; audioAdapter->vtbl->GetEnabled(audioAdapter, &enabled); if (enabled) { PRUint32 audioController = AudioControllerType_AC97; def->nsounds = 1; if (VIR_ALLOC_N(def->sounds, def->nsounds) >= 0) { if (VIR_ALLOC(def->sounds[0]) >= 0) { audioAdapter->vtbl->GetAudioController(audioAdapter, &audioController); if (audioController == AudioControllerType_SB16) { def->sounds[0]->model = VIR_DOMAIN_SOUND_MODEL_SB16; } else if (audioController == AudioControllerType_AC97) { def->sounds[0]->model = VIR_DOMAIN_SOUND_MODEL_AC97; } } else { VIR_FREE(def->sounds); def->nsounds = 0; } } else { def->nsounds = 0; } } VBOX_RELEASE(audioAdapter); } #if VBOX_API_VERSION < 3001 /* dump CDROM/DVD if the drive is attached and has DVD/CD in it */ machine->vtbl->GetDVDDrive(machine, &dvdDrive); if (dvdDrive) { PRUint32 state = DriveState_Null; dvdDrive->vtbl->GetState(dvdDrive, &state); if (state == DriveState_ImageMounted) { IDVDImage *dvdImage = NULL; dvdDrive->vtbl->GetImage(dvdDrive, &dvdImage); if (dvdImage) { PRUnichar *locationUtf16 = NULL; char *location = NULL; dvdImage->vtbl->imedium.GetLocation((IMedium *)dvdImage, &locationUtf16); VBOX_UTF16_TO_UTF8(locationUtf16, &location); def->ndisks++; if (VIR_REALLOC_N(def->disks, def->ndisks) >= 0) { if (VIR_ALLOC(def->disks[def->ndisks - 1]) >= 0) { def->disks[def->ndisks - 1]->device = VIR_DOMAIN_DISK_DEVICE_CDROM; def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_IDE; def->disks[def->ndisks - 1]->type = VIR_DOMAIN_DISK_TYPE_FILE; def->disks[def->ndisks - 1]->readonly = true; ignore_value(VIR_STRDUP(def->disks[def->ndisks - 1]->src, location)); ignore_value(VIR_STRDUP(def->disks[def->ndisks - 1]->dst, "hdc")); def->ndisks--; } else { def->ndisks--; } } else { def->ndisks--; } VBOX_UTF8_FREE(location); VBOX_UTF16_FREE(locationUtf16); VBOX_MEDIUM_RELEASE(dvdImage); } } VBOX_RELEASE(dvdDrive); } /* dump Floppy if the drive is attached and has floppy in it */ machine->vtbl->GetFloppyDrive(machine, &floppyDrive); if (floppyDrive) { PRBool enabled = PR_FALSE; floppyDrive->vtbl->GetEnabled(floppyDrive, &enabled); if (enabled) { PRUint32 state = DriveState_Null; floppyDrive->vtbl->GetState(floppyDrive, &state); if (state == DriveState_ImageMounted) { IFloppyImage *floppyImage = NULL; floppyDrive->vtbl->GetImage(floppyDrive, &floppyImage); if (floppyImage) { PRUnichar *locationUtf16 = NULL; char *location = NULL; floppyImage->vtbl->imedium.GetLocation((IMedium *)floppyImage, &locationUtf16); VBOX_UTF16_TO_UTF8(locationUtf16, &location); def->ndisks++; if (VIR_REALLOC_N(def->disks, def->ndisks) >= 0) { if (VIR_ALLOC(def->disks[def->ndisks - 1]) >= 0) { def->disks[def->ndisks - 1]->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY; def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_FDC; def->disks[def->ndisks - 1]->type = VIR_DOMAIN_DISK_TYPE_FILE; def->disks[def->ndisks - 1]->readonly = false; ignore_value(VIR_STRDUP(def->disks[def->ndisks - 1]->src, location)); ignore_value(VIR_STRDUP(def->disks[def->ndisks - 1]->dst, "fda")); def->ndisks--; } else { def->ndisks--; } } else { def->ndisks--; } VBOX_UTF8_FREE(location); VBOX_UTF16_FREE(locationUtf16); VBOX_MEDIUM_RELEASE(floppyImage); } } } VBOX_RELEASE(floppyDrive); } #else /* VBOX_API_VERSION >= 3001 */ #endif /* VBOX_API_VERSION >= 3001 */ /* dump serial port if active */ def->nserials = 0; /* Get which serial ports are enabled/active */ for (i = 0; i < serialPortCount; i++) { ISerialPort *serialPort = NULL; machine->vtbl->GetSerialPort(machine, i, &serialPort); if (serialPort) { PRBool enabled = PR_FALSE; serialPort->vtbl->GetEnabled(serialPort, &enabled); if (enabled) { def->nserials++; } VBOX_RELEASE(serialPort); } } /* Allocate memory for the serial ports which are enabled */ if ((def->nserials > 0) && (VIR_ALLOC_N(def->serials, def->nserials) >= 0)) { for (i = 0; i < def->nserials; i++) { ignore_value(VIR_ALLOC(def->serials[i])); } } /* Now get the details about the serial ports here */ for (i = 0; serialPortIncCount < def->nserials && i < serialPortCount; i++) { ISerialPort *serialPort = NULL; machine->vtbl->GetSerialPort(machine, i, &serialPort); if (serialPort) { PRBool enabled = PR_FALSE; serialPort->vtbl->GetEnabled(serialPort, &enabled); if (enabled) { PRUint32 hostMode = PortMode_Disconnected; PRUint32 IOBase = 0; PRUint32 IRQ = 0; PRUnichar *pathUtf16 = NULL; char *path = NULL; serialPort->vtbl->GetHostMode(serialPort, &hostMode); if (hostMode == PortMode_HostPipe) { def->serials[serialPortIncCount]->source.type = VIR_DOMAIN_CHR_TYPE_PIPE; } else if (hostMode == PortMode_HostDevice) { def->serials[serialPortIncCount]->source.type = VIR_DOMAIN_CHR_TYPE_DEV; #if VBOX_API_VERSION >= 3000 } else if (hostMode == PortMode_RawFile) { def->serials[serialPortIncCount]->source.type = VIR_DOMAIN_CHR_TYPE_FILE; #endif /* VBOX_API_VERSION >= 3000 */ } else { def->serials[serialPortIncCount]->source.type = VIR_DOMAIN_CHR_TYPE_NULL; } def->serials[serialPortIncCount]->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL; serialPort->vtbl->GetIRQ(serialPort, &IRQ); serialPort->vtbl->GetIOBase(serialPort, &IOBase); if ((IRQ == 4) && (IOBase == 1016)) { def->serials[serialPortIncCount]->target.port = 0; } else if ((IRQ == 3) && (IOBase == 760)) { def->serials[serialPortIncCount]->target.port = 1; } serialPort->vtbl->GetPath(serialPort, &pathUtf16); if (pathUtf16) { VBOX_UTF16_TO_UTF8(pathUtf16, &path); ignore_value(VIR_STRDUP(def->serials[serialPortIncCount]->source.data.file.path, path)); } serialPortIncCount++; VBOX_UTF16_FREE(pathUtf16); VBOX_UTF8_FREE(path); } VBOX_RELEASE(serialPort); } } /* dump parallel ports if active */ def->nparallels = 0; /* Get which parallel ports are enabled/active */ for (i = 0; i < parallelPortCount; i++) { IParallelPort *parallelPort = NULL; machine->vtbl->GetParallelPort(machine, i, &parallelPort); if (parallelPort) { PRBool enabled = PR_FALSE; parallelPort->vtbl->GetEnabled(parallelPort, &enabled); if (enabled) { def->nparallels++; } VBOX_RELEASE(parallelPort); } } /* Allocate memory for the parallel ports which are enabled */ if ((def->nparallels > 0) && (VIR_ALLOC_N(def->parallels, def->nparallels) >= 0)) { for (i = 0; i < def->nparallels; i++) { ignore_value(VIR_ALLOC(def->parallels[i])); } } /* Now get the details about the parallel ports here */ for (i = 0; parallelPortIncCount < def->nparallels && i < parallelPortCount; i++) { IParallelPort *parallelPort = NULL; machine->vtbl->GetParallelPort(machine, i, &parallelPort); if (parallelPort) { PRBool enabled = PR_FALSE; parallelPort->vtbl->GetEnabled(parallelPort, &enabled); if (enabled) { PRUint32 IOBase = 0; PRUint32 IRQ = 0; PRUnichar *pathUtf16 = NULL; char *path = NULL; parallelPort->vtbl->GetIRQ(parallelPort, &IRQ); parallelPort->vtbl->GetIOBase(parallelPort, &IOBase); if ((IRQ == 7) && (IOBase == 888)) { def->parallels[parallelPortIncCount]->target.port = 0; } else if ((IRQ == 5) && (IOBase == 632)) { def->parallels[parallelPortIncCount]->target.port = 1; } def->parallels[parallelPortIncCount]->source.type = VIR_DOMAIN_CHR_TYPE_FILE; def->parallels[parallelPortIncCount]->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL; parallelPort->vtbl->GetPath(parallelPort, &pathUtf16); VBOX_UTF16_TO_UTF8(pathUtf16, &path); ignore_value(VIR_STRDUP(def->parallels[parallelPortIncCount]->source.data.file.path, path)); parallelPortIncCount++; VBOX_UTF16_FREE(pathUtf16); VBOX_UTF8_FREE(path); } VBOX_RELEASE(parallelPort); } } /* dump USB devices/filters if active */ vboxHostDeviceGetXMLDesc(data, def, machine); /* all done so set gotAllABoutDef and pass def to virDomainDefFormat * to generate XML for it */ gotAllABoutDef = 0; } VBOX_RELEASE(machine); machine = NULL; } if (gotAllABoutDef == 0) ret = virDomainDefFormat(def, flags); cleanup: vboxIIDUnalloc(&iid); virDomainDefFree(def); return ret; } static int vboxConnectListDefinedDomains(virConnectPtr conn, char ** const names, int maxnames) { VBOX_OBJECT_CHECK(conn, int, -1); vboxArray machines = VBOX_ARRAY_INITIALIZER; char *machineName = NULL; PRUnichar *machineNameUtf16 = NULL; PRUint32 state; nsresult rc; size_t i, j; rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get list of Defined Domains, rc=%08x"), (unsigned)rc); goto cleanup; } memset(names, 0, sizeof(names[i]) * maxnames); ret = 0; for (i = 0, j = 0; (i < machines.count) && (j < maxnames); i++) { IMachine *machine = machines.items[i]; if (machine) { PRBool isAccessible = PR_FALSE; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetState(machine, &state); if ((state < MachineState_FirstOnline) || (state > MachineState_LastOnline)) { machine->vtbl->GetName(machine, &machineNameUtf16); VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName); if (VIR_STRDUP(names[j], machineName) < 0) { VBOX_UTF16_FREE(machineNameUtf16); VBOX_UTF8_FREE(machineName); for (j = 0; j < maxnames; j++) VIR_FREE(names[j]); ret = -1; goto cleanup; } VBOX_UTF16_FREE(machineNameUtf16); VBOX_UTF8_FREE(machineName); j++; ret++; } } } } cleanup: vboxArrayRelease(&machines); return ret; } static int vboxConnectNumOfDefinedDomains(virConnectPtr conn) { VBOX_OBJECT_CHECK(conn, int, -1); vboxArray machines = VBOX_ARRAY_INITIALIZER; PRUint32 state = MachineState_Null; nsresult rc; size_t i; rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get number of Defined Domains, rc=%08x"), (unsigned)rc); goto cleanup; } ret = 0; for (i = 0; i < machines.count; ++i) { IMachine *machine = machines.items[i]; if (machine) { PRBool isAccessible = PR_FALSE; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetState(machine, &state); if ((state < MachineState_FirstOnline) || (state > MachineState_LastOnline)) { ret++; } } } } cleanup: vboxArrayRelease(&machines); return ret; } static int vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine, vboxIID *iid ATTRIBUTE_UNUSED /* >= 4.0 */) { VBOX_OBJECT_CHECK(dom->conn, int, -1); int vrdpPresent = 0; int sdlPresent = 0; int guiPresent = 0; char *guiDisplay = NULL; char *sdlDisplay = NULL; PRUnichar *keyTypeUtf16 = NULL; PRUnichar *valueTypeUtf16 = NULL; char *valueTypeUtf8 = NULL; PRUnichar *keyDislpayUtf16 = NULL; PRUnichar *valueDisplayUtf16 = NULL; char *valueDisplayUtf8 = NULL; IProgress *progress = NULL; PRUnichar *env = NULL; PRUnichar *sessionType = NULL; nsresult rc; VBOX_UTF8_TO_UTF16("FRONTEND/Type", &keyTypeUtf16); machine->vtbl->GetExtraData(machine, keyTypeUtf16, &valueTypeUtf16); VBOX_UTF16_FREE(keyTypeUtf16); if (valueTypeUtf16) { VBOX_UTF16_TO_UTF8(valueTypeUtf16, &valueTypeUtf8); VBOX_UTF16_FREE(valueTypeUtf16); if (STREQ(valueTypeUtf8, "sdl") || STREQ(valueTypeUtf8, "gui")) { VBOX_UTF8_TO_UTF16("FRONTEND/Display", &keyDislpayUtf16); machine->vtbl->GetExtraData(machine, keyDislpayUtf16, &valueDisplayUtf16); VBOX_UTF16_FREE(keyDislpayUtf16); if (valueDisplayUtf16) { VBOX_UTF16_TO_UTF8(valueDisplayUtf16, &valueDisplayUtf8); VBOX_UTF16_FREE(valueDisplayUtf16); if (strlen(valueDisplayUtf8) <= 0) VBOX_UTF8_FREE(valueDisplayUtf8); } if (STREQ(valueTypeUtf8, "sdl")) { sdlPresent = 1; if (VIR_STRDUP(sdlDisplay, valueDisplayUtf8) < 0) { /* just don't go to cleanup yet as it is ok to have * sdlDisplay as NULL and we check it below if it * exist and then only use it there */ } } if (STREQ(valueTypeUtf8, "gui")) { guiPresent = 1; if (VIR_STRDUP(guiDisplay, valueDisplayUtf8) < 0) { /* just don't go to cleanup yet as it is ok to have * guiDisplay as NULL and we check it below if it * exist and then only use it there */ } } } if (STREQ(valueTypeUtf8, "vrdp")) { vrdpPresent = 1; } if (!vrdpPresent && !sdlPresent && !guiPresent) { /* if nothing is selected it means either the machine xml * file is really old or some values are missing so fallback */ guiPresent = 1; } VBOX_UTF8_FREE(valueTypeUtf8); } else { guiPresent = 1; } VBOX_UTF8_FREE(valueDisplayUtf8); if (guiPresent) { if (guiDisplay) { char *displayutf8; if (virAsprintf(&displayutf8, "DISPLAY=%s", guiDisplay) >= 0) { VBOX_UTF8_TO_UTF16(displayutf8, &env); VIR_FREE(displayutf8); } VIR_FREE(guiDisplay); } VBOX_UTF8_TO_UTF16("gui", &sessionType); } if (sdlPresent) { if (sdlDisplay) { char *displayutf8; if (virAsprintf(&displayutf8, "DISPLAY=%s", sdlDisplay) >= 0) { VBOX_UTF8_TO_UTF16(displayutf8, &env); VIR_FREE(displayutf8); } VIR_FREE(sdlDisplay); } VBOX_UTF8_TO_UTF16("sdl", &sessionType); } if (vrdpPresent) { VBOX_UTF8_TO_UTF16("vrdp", &sessionType); } #if VBOX_API_VERSION < 4000 rc = data->vboxObj->vtbl->OpenRemoteSession(data->vboxObj, data->vboxSession, iid->value, sessionType, env, &progress); #else /* VBOX_API_VERSION >= 4000 */ rc = machine->vtbl->LaunchVMProcess(machine, data->vboxSession, sessionType, env, &progress); #endif /* VBOX_API_VERSION >= 4000 */ if (NS_FAILED(rc)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("OpenRemoteSession/LaunchVMProcess failed, domain can't be started")); ret = -1; } else { PRBool completed = 0; #if VBOX_API_VERSION == 2002 nsresult resultCode; #else PRInt32 resultCode; #endif progress->vtbl->WaitForCompletion(progress, -1); rc = progress->vtbl->GetCompleted(progress, &completed); if (NS_FAILED(rc)) { /* error */ ret = -1; } progress->vtbl->GetResultCode(progress, &resultCode); if (NS_FAILED(resultCode)) { /* error */ ret = -1; } else { /* all ok set the domid */ dom->id = maxDomID + 1; ret = 0; } } VBOX_RELEASE(progress); VBOX_SESSION_CLOSE(); VBOX_UTF16_FREE(env); VBOX_UTF16_FREE(sessionType); return ret; } static int vboxDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxArray machines = VBOX_ARRAY_INITIALIZER; unsigned char uuid[VIR_UUID_BUFLEN] = {0}; nsresult rc; size_t i = 0; virCheckFlags(0, -1); if (!dom->name) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Error while reading the domain name")); goto cleanup; } rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get list of machines, rc=%08x"), (unsigned)rc); goto cleanup; } for (i = 0; i < machines.count; ++i) { IMachine *machine = machines.items[i]; PRBool isAccessible = PR_FALSE; if (!machine) continue; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { vboxIID iid = VBOX_IID_INITIALIZER; rc = machine->vtbl->GetId(machine, &iid.value); if (NS_FAILED(rc)) continue; vboxIIDToUUID(&iid, uuid); if (memcmp(dom->uuid, uuid, VIR_UUID_BUFLEN) == 0) { PRUint32 state = MachineState_Null; machine->vtbl->GetState(machine, &state); if ((state == MachineState_PoweredOff) || (state == MachineState_Saved) || (state == MachineState_Aborted)) { ret = vboxStartMachine(dom, i, machine, &iid); } else { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("machine is not in " "poweroff|saved|aborted state, so " "couldn't start it")); ret = -1; } } vboxIIDUnalloc(&iid); if (ret != -1) break; } } /* Do the cleanup and take care you dont leak any memory */ vboxArrayRelease(&machines); cleanup: return ret; } static int vboxDomainCreate(virDomainPtr dom) { return vboxDomainCreateWithFlags(dom, 0); } static void vboxSetBootDeviceOrder(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) { ISystemProperties *systemProperties = NULL; PRUint32 maxBootPosition = 0; size_t i = 0; VIR_DEBUG("def->os.type %s", def->os.type); VIR_DEBUG("def->os.arch %s", virArchToString(def->os.arch)); VIR_DEBUG("def->os.machine %s", def->os.machine); VIR_DEBUG("def->os.nBootDevs %zu", def->os.nBootDevs); VIR_DEBUG("def->os.bootDevs[0] %d", def->os.bootDevs[0]); VIR_DEBUG("def->os.bootDevs[1] %d", def->os.bootDevs[1]); VIR_DEBUG("def->os.bootDevs[2] %d", def->os.bootDevs[2]); VIR_DEBUG("def->os.bootDevs[3] %d", def->os.bootDevs[3]); VIR_DEBUG("def->os.init %s", def->os.init); VIR_DEBUG("def->os.kernel %s", def->os.kernel); VIR_DEBUG("def->os.initrd %s", def->os.initrd); VIR_DEBUG("def->os.cmdline %s", def->os.cmdline); VIR_DEBUG("def->os.root %s", def->os.root); VIR_DEBUG("def->os.loader %s", def->os.loader); VIR_DEBUG("def->os.bootloader %s", def->os.bootloader); VIR_DEBUG("def->os.bootloaderArgs %s", def->os.bootloaderArgs); data->vboxObj->vtbl->GetSystemProperties(data->vboxObj, &systemProperties); if (systemProperties) { systemProperties->vtbl->GetMaxBootPosition(systemProperties, &maxBootPosition); VBOX_RELEASE(systemProperties); systemProperties = NULL; } /* Clear the defaults first */ for (i = 0; i < maxBootPosition; i++) { machine->vtbl->SetBootOrder(machine, i+1, DeviceType_Null); } for (i = 0; (i < def->os.nBootDevs) && (i < maxBootPosition); i++) { PRUint32 device = DeviceType_Null; if (def->os.bootDevs[i] == VIR_DOMAIN_BOOT_FLOPPY) { device = DeviceType_Floppy; } else if (def->os.bootDevs[i] == VIR_DOMAIN_BOOT_CDROM) { device = DeviceType_DVD; } else if (def->os.bootDevs[i] == VIR_DOMAIN_BOOT_DISK) { device = DeviceType_HardDisk; } else if (def->os.bootDevs[i] == VIR_DOMAIN_BOOT_NET) { device = DeviceType_Network; } machine->vtbl->SetBootOrder(machine, i+1, device); } } static void vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) { size_t i; nsresult rc; #if VBOX_API_VERSION < 3001 if (def->ndisks == 0) return; for (i = 0; i < def->ndisks; i++) { VIR_DEBUG("disk(%zu) type: %d", i, def->disks[i]->type); VIR_DEBUG("disk(%zu) device: %d", i, def->disks[i]->device); VIR_DEBUG("disk(%zu) bus: %d", i, def->disks[i]->bus); VIR_DEBUG("disk(%zu) src: %s", i, def->disks[i]->src); VIR_DEBUG("disk(%zu) dst: %s", i, def->disks[i]->dst); VIR_DEBUG("disk(%zu) driverName: %s", i, def->disks[i]->driverName); VIR_DEBUG("disk(%zu) driverType: %s", i, virStorageFileFormatTypeToString(def->disks[i]->format)); VIR_DEBUG("disk(%zu) cachemode: %d", i, def->disks[i]->cachemode); VIR_DEBUG("disk(%zu) readonly: %s", i, (def->disks[i]->readonly ? "True" : "False")); VIR_DEBUG("disk(%zu) shared: %s", i, (def->disks[i]->shared ? "True" : "False")); if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_FILE && def->disks[i]->src != NULL) { IDVDDrive *dvdDrive = NULL; /* Currently CDROM/DVD Drive is always IDE * Secondary Master so neglecting the following * parameters: * def->disks[i]->bus * def->disks[i]->dst */ machine->vtbl->GetDVDDrive(machine, &dvdDrive); if (dvdDrive) { IDVDImage *dvdImage = NULL; PRUnichar *dvdfileUtf16 = NULL; vboxIID dvduuid = VBOX_IID_INITIALIZER; vboxIID dvdemptyuuid = VBOX_IID_INITIALIZER; VBOX_UTF8_TO_UTF16(def->disks[i]->src, &dvdfileUtf16); data->vboxObj->vtbl->FindDVDImage(data->vboxObj, dvdfileUtf16, &dvdImage); if (!dvdImage) { data->vboxObj->vtbl->OpenDVDImage(data->vboxObj, dvdfileUtf16, dvdemptyuuid.value, &dvdImage); } if (dvdImage) { rc = dvdImage->vtbl->imedium.GetId((IMedium *)dvdImage, &dvduuid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("can't get the uuid of the file to " "be attached to cdrom: %s, rc=%08x"), def->disks[i]->src, (unsigned)rc); } else { rc = dvdDrive->vtbl->MountImage(dvdDrive, dvduuid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not attach the file to cdrom: %s, rc=%08x"), def->disks[i]->src, (unsigned)rc); } else { DEBUGIID("CD/DVDImage UUID:", dvduuid.value); } } VBOX_MEDIUM_RELEASE(dvdImage); } vboxIIDUnalloc(&dvduuid); VBOX_UTF16_FREE(dvdfileUtf16); VBOX_RELEASE(dvdDrive); } } else if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_BLOCK) { } } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) { if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_FILE && def->disks[i]->src != NULL) { IHardDisk *hardDisk = NULL; PRUnichar *hddfileUtf16 = NULL; vboxIID hdduuid = VBOX_IID_INITIALIZER; PRUnichar *hddEmpty = NULL; /* Current Limitation: Harddisk can't be connected to * Secondary Master as Secondary Master is always used * for CD/DVD Drive, so don't connect the harddisk if it * is requested to be connected to Secondary master */ VBOX_UTF8_TO_UTF16(def->disks[i]->src, &hddfileUtf16); VBOX_UTF8_TO_UTF16("", &hddEmpty); data->vboxObj->vtbl->FindHardDisk(data->vboxObj, hddfileUtf16, &hardDisk); if (!hardDisk) { # if VBOX_API_VERSION == 2002 data->vboxObj->vtbl->OpenHardDisk(data->vboxObj, hddfileUtf16, AccessMode_ReadWrite, &hardDisk); # else data->vboxObj->vtbl->OpenHardDisk(data->vboxObj, hddfileUtf16, AccessMode_ReadWrite, 0, hddEmpty, 0, hddEmpty, &hardDisk); # endif } if (hardDisk) { rc = hardDisk->vtbl->imedium.GetId((IMedium *)hardDisk, &hdduuid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("can't get the uuid of the file to be " "attached as harddisk: %s, rc=%08x"), def->disks[i]->src, (unsigned)rc); } else { if (def->disks[i]->readonly) { hardDisk->vtbl->SetType(hardDisk, HardDiskType_Immutable); VIR_DEBUG("setting harddisk to readonly"); } else if (!def->disks[i]->readonly) { hardDisk->vtbl->SetType(hardDisk, HardDiskType_Normal); VIR_DEBUG("setting harddisk type to normal"); } if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_IDE) { if (STREQ(def->disks[i]->dst, "hdc")) { VIR_DEBUG("Not connecting harddisk to hdc as hdc" " is taken by CD/DVD Drive"); } else { PRInt32 channel = 0; PRInt32 device = 0; PRUnichar *hddcnameUtf16 = NULL; char *hddcname; ignore_value(VIR_STRDUP(hddcname, "IDE")); VBOX_UTF8_TO_UTF16(hddcname, &hddcnameUtf16); VIR_FREE(hddcname); if (STREQ(def->disks[i]->dst, "hda")) { channel = 0; device = 0; } else if (STREQ(def->disks[i]->dst, "hdb")) { channel = 0; device = 1; } else if (STREQ(def->disks[i]->dst, "hdd")) { channel = 1; device = 1; } rc = machine->vtbl->AttachHardDisk(machine, hdduuid.value, hddcnameUtf16, channel, device); VBOX_UTF16_FREE(hddcnameUtf16); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not attach the file as " "harddisk: %s, rc=%08x"), def->disks[i]->src, (unsigned)rc); } else { DEBUGIID("Attached HDD with UUID", hdduuid.value); } } } } VBOX_MEDIUM_RELEASE(hardDisk); } vboxIIDUnalloc(&hdduuid); VBOX_UTF16_FREE(hddEmpty); VBOX_UTF16_FREE(hddfileUtf16); } else if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_BLOCK) { } } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_FILE && def->disks[i]->src != NULL) { IFloppyDrive *floppyDrive; machine->vtbl->GetFloppyDrive(machine, &floppyDrive); if (floppyDrive) { rc = floppyDrive->vtbl->SetEnabled(floppyDrive, 1); if (NS_SUCCEEDED(rc)) { IFloppyImage *floppyImage = NULL; PRUnichar *fdfileUtf16 = NULL; vboxIID fduuid = VBOX_IID_INITIALIZER; vboxIID fdemptyuuid = VBOX_IID_INITIALIZER; VBOX_UTF8_TO_UTF16(def->disks[i]->src, &fdfileUtf16); rc = data->vboxObj->vtbl->FindFloppyImage(data->vboxObj, fdfileUtf16, &floppyImage); if (!floppyImage) { data->vboxObj->vtbl->OpenFloppyImage(data->vboxObj, fdfileUtf16, fdemptyuuid.value, &floppyImage); } if (floppyImage) { rc = floppyImage->vtbl->imedium.GetId((IMedium *)floppyImage, &fduuid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("can't get the uuid of the file to " "be attached to floppy drive: %s, rc=%08x"), def->disks[i]->src, (unsigned)rc); } else { rc = floppyDrive->vtbl->MountImage(floppyDrive, fduuid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not attach the file to " "floppy drive: %s, rc=%08x"), def->disks[i]->src, (unsigned)rc); } else { DEBUGIID("floppyImage UUID", fduuid.value); } } VBOX_MEDIUM_RELEASE(floppyImage); } vboxIIDUnalloc(&fduuid); VBOX_UTF16_FREE(fdfileUtf16); } VBOX_RELEASE(floppyDrive); } } else if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_BLOCK) { } } } #else /* VBOX_API_VERSION >= 3001 */ PRUint32 maxPortPerInst[StorageBus_Floppy + 1] = {}; PRUint32 maxSlotPerPort[StorageBus_Floppy + 1] = {}; PRUnichar *storageCtlName = NULL; bool error = false; /* get the max port/slots/etc for the given storage bus */ error = !vboxGetMaxPortSlotValues(data->vboxObj, maxPortPerInst, maxSlotPerPort); /* add a storage controller for the mediums to be attached */ /* this needs to change when multiple controller are supported for * ver > 3.1 */ { IStorageController *storageCtl = NULL; PRUnichar *sName = NULL; VBOX_UTF8_TO_UTF16("IDE Controller", &sName); machine->vtbl->AddStorageController(machine, sName, StorageBus_IDE, &storageCtl); VBOX_UTF16_FREE(sName); VBOX_RELEASE(storageCtl); VBOX_UTF8_TO_UTF16("SATA Controller", &sName); machine->vtbl->AddStorageController(machine, sName, StorageBus_SATA, &storageCtl); VBOX_UTF16_FREE(sName); VBOX_RELEASE(storageCtl); VBOX_UTF8_TO_UTF16("SCSI Controller", &sName); machine->vtbl->AddStorageController(machine, sName, StorageBus_SCSI, &storageCtl); VBOX_UTF16_FREE(sName); VBOX_RELEASE(storageCtl); VBOX_UTF8_TO_UTF16("Floppy Controller", &sName); machine->vtbl->AddStorageController(machine, sName, StorageBus_Floppy, &storageCtl); VBOX_UTF16_FREE(sName); VBOX_RELEASE(storageCtl); } for (i = 0; i < def->ndisks && !error; i++) { VIR_DEBUG("disk(%zu) type: %d", i, def->disks[i]->type); VIR_DEBUG("disk(%zu) device: %d", i, def->disks[i]->device); VIR_DEBUG("disk(%zu) bus: %d", i, def->disks[i]->bus); VIR_DEBUG("disk(%zu) src: %s", i, def->disks[i]->src); VIR_DEBUG("disk(%zu) dst: %s", i, def->disks[i]->dst); VIR_DEBUG("disk(%zu) driverName: %s", i, def->disks[i]->driverName); VIR_DEBUG("disk(%zu) driverType: %s", i, virStorageFileFormatTypeToString(def->disks[i]->format)); VIR_DEBUG("disk(%zu) cachemode: %d", i, def->disks[i]->cachemode); VIR_DEBUG("disk(%zu) readonly: %s", i, (def->disks[i]->readonly ? "True" : "False")); VIR_DEBUG("disk(%zu) shared: %s", i, (def->disks[i]->shared ? "True" : "False")); if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_FILE && def->disks[i]->src != NULL) { IMedium *medium = NULL; PRUnichar *mediumUUID = NULL; PRUnichar *mediumFileUtf16 = NULL; PRUint32 storageBus = StorageBus_Null; PRUint32 deviceType = DeviceType_Null; # if VBOX_API_VERSION >= 4000 PRUint32 accessMode = AccessMode_ReadOnly; # endif PRInt32 deviceInst = 0; PRInt32 devicePort = 0; PRInt32 deviceSlot = 0; VBOX_UTF8_TO_UTF16(def->disks[i]->src, &mediumFileUtf16); if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) { deviceType = DeviceType_HardDisk; # if VBOX_API_VERSION < 4000 data->vboxObj->vtbl->FindHardDisk(data->vboxObj, mediumFileUtf16, &medium); # else accessMode = AccessMode_ReadWrite; # endif } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { deviceType = DeviceType_DVD; # if VBOX_API_VERSION < 4000 data->vboxObj->vtbl->FindDVDImage(data->vboxObj, mediumFileUtf16, &medium); # else accessMode = AccessMode_ReadOnly; # endif } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { deviceType = DeviceType_Floppy; # if VBOX_API_VERSION < 4000 data->vboxObj->vtbl->FindFloppyImage(data->vboxObj, mediumFileUtf16, &medium); # else accessMode = AccessMode_ReadWrite; # endif } else { VBOX_UTF16_FREE(mediumFileUtf16); continue; } # if VBOX_API_VERSION >= 4000 && VBOX_API_VERSION < 4002 data->vboxObj->vtbl->FindMedium(data->vboxObj, mediumFileUtf16, deviceType, &medium); # elif VBOX_API_VERSION >= 4002 data->vboxObj->vtbl->OpenMedium(data->vboxObj, mediumFileUtf16, deviceType, accessMode, PR_FALSE, &medium); # endif if (!medium) { PRUnichar *mediumEmpty = NULL; VBOX_UTF8_TO_UTF16("", &mediumEmpty); # if VBOX_API_VERSION < 4000 if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) { rc = data->vboxObj->vtbl->OpenHardDisk(data->vboxObj, mediumFileUtf16, AccessMode_ReadWrite, false, mediumEmpty, false, mediumEmpty, &medium); } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { rc = data->vboxObj->vtbl->OpenDVDImage(data->vboxObj, mediumFileUtf16, mediumEmpty, &medium); } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { rc = data->vboxObj->vtbl->OpenFloppyImage(data->vboxObj, mediumFileUtf16, mediumEmpty, &medium); } else { rc = 0; } # elif VBOX_API_VERSION == 4000 rc = data->vboxObj->vtbl->OpenMedium(data->vboxObj, mediumFileUtf16, deviceType, accessMode, &medium); # elif VBOX_API_VERSION >= 4001 rc = data->vboxObj->vtbl->OpenMedium(data->vboxObj, mediumFileUtf16, deviceType, accessMode, false, &medium); # endif /* VBOX_API_VERSION >= 4001 */ VBOX_UTF16_FREE(mediumEmpty); } if (!medium) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to attach the following disk/dvd/floppy " "to the machine: %s, rc=%08x"), def->disks[i]->src, (unsigned)rc); VBOX_UTF16_FREE(mediumFileUtf16); continue; } rc = medium->vtbl->GetId(medium, &mediumUUID); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("can't get the uuid of the file to be attached " "as harddisk/dvd/floppy: %s, rc=%08x"), def->disks[i]->src, (unsigned)rc); VBOX_RELEASE(medium); VBOX_UTF16_FREE(mediumFileUtf16); continue; } if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) { if (def->disks[i]->readonly) { medium->vtbl->SetType(medium, MediumType_Immutable); VIR_DEBUG("setting harddisk to immutable"); } else if (!def->disks[i]->readonly) { medium->vtbl->SetType(medium, MediumType_Normal); VIR_DEBUG("setting harddisk type to normal"); } } if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_IDE) { VBOX_UTF8_TO_UTF16("IDE Controller", &storageCtlName); storageBus = StorageBus_IDE; } else if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_SATA) { VBOX_UTF8_TO_UTF16("SATA Controller", &storageCtlName); storageBus = StorageBus_SATA; } else if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_SCSI) { VBOX_UTF8_TO_UTF16("SCSI Controller", &storageCtlName); storageBus = StorageBus_SCSI; } else if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_FDC) { VBOX_UTF8_TO_UTF16("Floppy Controller", &storageCtlName); storageBus = StorageBus_Floppy; } /* get the device details i.e instance, port and slot */ if (!vboxGetDeviceDetails(def->disks[i]->dst, maxPortPerInst, maxSlotPerPort, storageBus, &deviceInst, &devicePort, &deviceSlot)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("can't get the port/slot number of " "harddisk/dvd/floppy to be attached: " "%s, rc=%08x"), def->disks[i]->src, (unsigned)rc); VBOX_RELEASE(medium); VBOX_UTF16_FREE(mediumUUID); VBOX_UTF16_FREE(mediumFileUtf16); continue; } /* attach the harddisk/dvd/Floppy to the storage controller */ rc = machine->vtbl->AttachDevice(machine, storageCtlName, devicePort, deviceSlot, deviceType, # if VBOX_API_VERSION < 4000 mediumUUID); # else /* VBOX_API_VERSION >= 4000 */ medium); # endif /* VBOX_API_VERSION >= 4000 */ if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not attach the file as " "harddisk/dvd/floppy: %s, rc=%08x"), def->disks[i]->src, (unsigned)rc); } else { DEBUGIID("Attached HDD/DVD/Floppy with UUID", mediumUUID); } VBOX_RELEASE(medium); VBOX_UTF16_FREE(mediumUUID); VBOX_UTF16_FREE(mediumFileUtf16); VBOX_UTF16_FREE(storageCtlName); } } #endif /* VBOX_API_VERSION >= 3001 */ } static void vboxAttachSound(virDomainDefPtr def, IMachine *machine) { nsresult rc; /* Check if def->nsounds is one as VirtualBox currently supports * only one sound card */ if (def->nsounds == 1) { IAudioAdapter *audioAdapter = NULL; machine->vtbl->GetAudioAdapter(machine, &audioAdapter); if (audioAdapter) { rc = audioAdapter->vtbl->SetEnabled(audioAdapter, 1); if (NS_SUCCEEDED(rc)) { if (def->sounds[0]->model == VIR_DOMAIN_SOUND_MODEL_SB16) { audioAdapter->vtbl->SetAudioController(audioAdapter, AudioControllerType_SB16); } else if (def->sounds[0]->model == VIR_DOMAIN_SOUND_MODEL_AC97) { audioAdapter->vtbl->SetAudioController(audioAdapter, AudioControllerType_AC97); } } VBOX_RELEASE(audioAdapter); } } } static void vboxAttachNetwork(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) { ISystemProperties *systemProperties = NULL; #if VBOX_API_VERSION >= 4001 PRUint32 chipsetType = ChipsetType_Null; #endif /* VBOX_API_VERSION >= 4001 */ PRUint32 networkAdapterCount = 0; size_t i = 0; #if VBOX_API_VERSION >= 4001 machine->vtbl->GetChipsetType(machine, &chipsetType); #endif /* VBOX_API_VERSION >= 4001 */ data->vboxObj->vtbl->GetSystemProperties(data->vboxObj, &systemProperties); if (systemProperties) { #if VBOX_API_VERSION < 4001 systemProperties->vtbl->GetNetworkAdapterCount(systemProperties, &networkAdapterCount); #else /* VBOX_API_VERSION >= 4000 */ systemProperties->vtbl->GetMaxNetworkAdapters(systemProperties, chipsetType, &networkAdapterCount); #endif /* VBOX_API_VERSION >= 4000 */ VBOX_RELEASE(systemProperties); systemProperties = NULL; } VIR_DEBUG("Number of Network Cards to be connected: %zu", def->nnets); VIR_DEBUG("Number of Network Cards available: %d", networkAdapterCount); for (i = 0; (i < def->nnets) && (i < networkAdapterCount); i++) { INetworkAdapter *adapter = NULL; PRUint32 adapterType = NetworkAdapterType_Null; char macaddr[VIR_MAC_STRING_BUFLEN] = {0}; char macaddrvbox[VIR_MAC_STRING_BUFLEN - 5] = {0}; virMacAddrFormat(&def->nets[i]->mac, macaddr); snprintf(macaddrvbox, VIR_MAC_STRING_BUFLEN - 5, "%02X%02X%02X%02X%02X%02X", def->nets[i]->mac.addr[0], def->nets[i]->mac.addr[1], def->nets[i]->mac.addr[2], def->nets[i]->mac.addr[3], def->nets[i]->mac.addr[4], def->nets[i]->mac.addr[5]); macaddrvbox[VIR_MAC_STRING_BUFLEN - 6] = '\0'; VIR_DEBUG("NIC(%zu): Type: %d", i, def->nets[i]->type); VIR_DEBUG("NIC(%zu): Model: %s", i, def->nets[i]->model); VIR_DEBUG("NIC(%zu): Mac: %s", i, macaddr); VIR_DEBUG("NIC(%zu): ifname: %s", i, def->nets[i]->ifname); if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_NETWORK) { VIR_DEBUG("NIC(%zu): name: %s", i, def->nets[i]->data.network.name); } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_INTERNAL) { VIR_DEBUG("NIC(%zu): name: %s", i, def->nets[i]->data.internal.name); } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_USER) { VIR_DEBUG("NIC(%zu): NAT.", i); } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_BRIDGE) { VIR_DEBUG("NIC(%zu): brname: %s", i, def->nets[i]->data.bridge.brname); VIR_DEBUG("NIC(%zu): script: %s", i, def->nets[i]->script); VIR_DEBUG("NIC(%zu): ipaddr: %s", i, def->nets[i]->data.bridge.ipaddr); } machine->vtbl->GetNetworkAdapter(machine, i, &adapter); if (adapter) { PRUnichar *MACAddress = NULL; adapter->vtbl->SetEnabled(adapter, 1); if (def->nets[i]->model) { if (STRCASEEQ(def->nets[i]->model, "Am79C970A")) { adapterType = NetworkAdapterType_Am79C970A; } else if (STRCASEEQ(def->nets[i]->model, "Am79C973")) { adapterType = NetworkAdapterType_Am79C973; } else if (STRCASEEQ(def->nets[i]->model, "82540EM")) { adapterType = NetworkAdapterType_I82540EM; } else if (STRCASEEQ(def->nets[i]->model, "82545EM")) { adapterType = NetworkAdapterType_I82545EM; } else if (STRCASEEQ(def->nets[i]->model, "82543GC")) { adapterType = NetworkAdapterType_I82543GC; #if VBOX_API_VERSION >= 3001 } else if (STRCASEEQ(def->nets[i]->model, "virtio")) { adapterType = NetworkAdapterType_Virtio; #endif /* VBOX_API_VERSION >= 3001 */ } } else { adapterType = NetworkAdapterType_Am79C973; } adapter->vtbl->SetAdapterType(adapter, adapterType); if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_BRIDGE) { PRUnichar *hostInterface = NULL; /* Bridged Network */ #if VBOX_API_VERSION < 4001 adapter->vtbl->AttachToBridgedInterface(adapter); #else /* VBOX_API_VERSION >= 4001 */ adapter->vtbl->SetAttachmentType(adapter, NetworkAttachmentType_Bridged); #endif /* VBOX_API_VERSION >= 4001 */ if (def->nets[i]->data.bridge.brname) { VBOX_UTF8_TO_UTF16(def->nets[i]->data.bridge.brname, &hostInterface); #if VBOX_API_VERSION < 4001 adapter->vtbl->SetHostInterface(adapter, hostInterface); #else /* VBOX_API_VERSION >= 4001 */ adapter->vtbl->SetBridgedInterface(adapter, hostInterface); #endif /* VBOX_API_VERSION >= 4001 */ VBOX_UTF16_FREE(hostInterface); } } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_INTERNAL) { PRUnichar *internalNetwork = NULL; /* Internal Network */ #if VBOX_API_VERSION < 4001 adapter->vtbl->AttachToInternalNetwork(adapter); #else /* VBOX_API_VERSION >= 4001 */ adapter->vtbl->SetAttachmentType(adapter, NetworkAttachmentType_Internal); #endif /* VBOX_API_VERSION >= 4001 */ if (def->nets[i]->data.internal.name) { VBOX_UTF8_TO_UTF16(def->nets[i]->data.internal.name, &internalNetwork); adapter->vtbl->SetInternalNetwork(adapter, internalNetwork); VBOX_UTF16_FREE(internalNetwork); } } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_NETWORK) { PRUnichar *hostInterface = NULL; /* Host Only Networking (currently only vboxnet0 available * on *nix and mac, on windows you can create and configure * as many as you want) */ #if VBOX_API_VERSION < 4001 adapter->vtbl->AttachToHostOnlyInterface(adapter); #else /* VBOX_API_VERSION >= 4001 */ adapter->vtbl->SetAttachmentType(adapter, NetworkAttachmentType_HostOnly); #endif /* VBOX_API_VERSION >= 4001 */ if (def->nets[i]->data.network.name) { VBOX_UTF8_TO_UTF16(def->nets[i]->data.network.name, &hostInterface); #if VBOX_API_VERSION < 4001 adapter->vtbl->SetHostInterface(adapter, hostInterface); #else /* VBOX_API_VERSION >= 4001 */ adapter->vtbl->SetHostOnlyInterface(adapter, hostInterface); #endif /* VBOX_API_VERSION >= 4001 */ VBOX_UTF16_FREE(hostInterface); } } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_USER) { /* NAT */ #if VBOX_API_VERSION < 4001 adapter->vtbl->AttachToNAT(adapter); #else /* VBOX_API_VERSION >= 4001 */ adapter->vtbl->SetAttachmentType(adapter, NetworkAttachmentType_NAT); #endif /* VBOX_API_VERSION >= 4001 */ } else { /* else always default to NAT if we don't understand * what option is been passed to us */ #if VBOX_API_VERSION < 4001 adapter->vtbl->AttachToNAT(adapter); #else /* VBOX_API_VERSION >= 4001 */ adapter->vtbl->SetAttachmentType(adapter, NetworkAttachmentType_NAT); #endif /* VBOX_API_VERSION >= 4001 */ } VBOX_UTF8_TO_UTF16(macaddrvbox, &MACAddress); adapter->vtbl->SetMACAddress(adapter, MACAddress); VBOX_UTF16_FREE(MACAddress); } } } static void vboxAttachSerial(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) { ISystemProperties *systemProperties = NULL; PRUint32 serialPortCount = 0; size_t i = 0; data->vboxObj->vtbl->GetSystemProperties(data->vboxObj, &systemProperties); if (systemProperties) { systemProperties->vtbl->GetSerialPortCount(systemProperties, &serialPortCount); VBOX_RELEASE(systemProperties); systemProperties = NULL; } VIR_DEBUG("Number of Serial Ports to be connected: %zu", def->nserials); VIR_DEBUG("Number of Serial Ports available: %d", serialPortCount); for (i = 0; (i < def->nserials) && (i < serialPortCount); i++) { ISerialPort *serialPort = NULL; VIR_DEBUG("SerialPort(%zu): Type: %d", i, def->serials[i]->source.type); VIR_DEBUG("SerialPort(%zu): target.port: %d", i, def->serials[i]->target.port); machine->vtbl->GetSerialPort(machine, i, &serialPort); if (serialPort) { PRUnichar *pathUtf16 = NULL; serialPort->vtbl->SetEnabled(serialPort, 1); if (def->serials[i]->source.data.file.path) { VBOX_UTF8_TO_UTF16(def->serials[i]->source.data.file.path, &pathUtf16); serialPort->vtbl->SetPath(serialPort, pathUtf16); } /* For now hard code the serial ports to COM1 and COM2, * COM1 (Base Addr: 0x3F8 (decimal: 1016), IRQ: 4) * COM2 (Base Addr: 0x2F8 (decimal: 760), IRQ: 3) * TODO: make this more flexible */ /* TODO: to improve the libvirt XMl handling so * that def->serials[i]->target.port shows real port * and not always start at 0 */ if (def->serials[i]->target.port == 0) { serialPort->vtbl->SetIRQ(serialPort, 4); serialPort->vtbl->SetIOBase(serialPort, 1016); VIR_DEBUG(" serialPort-%zu irq: %d, iobase 0x%x, path: %s", i, 4, 1016, def->serials[i]->source.data.file.path); } else if (def->serials[i]->target.port == 1) { serialPort->vtbl->SetIRQ(serialPort, 3); serialPort->vtbl->SetIOBase(serialPort, 760); VIR_DEBUG(" serialPort-%zu irq: %d, iobase 0x%x, path: %s", i, 3, 760, def->serials[i]->source.data.file.path); } if (def->serials[i]->source.type == VIR_DOMAIN_CHR_TYPE_DEV) { serialPort->vtbl->SetHostMode(serialPort, PortMode_HostDevice); } else if (def->serials[i]->source.type == VIR_DOMAIN_CHR_TYPE_PIPE) { serialPort->vtbl->SetHostMode(serialPort, PortMode_HostPipe); #if VBOX_API_VERSION >= 3000 } else if (def->serials[i]->source.type == VIR_DOMAIN_CHR_TYPE_FILE) { serialPort->vtbl->SetHostMode(serialPort, PortMode_RawFile); #endif /* VBOX_API_VERSION >= 3000 */ } else { serialPort->vtbl->SetHostMode(serialPort, PortMode_Disconnected); } VBOX_RELEASE(serialPort); VBOX_UTF16_FREE(pathUtf16); } } } static void vboxAttachParallel(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) { ISystemProperties *systemProperties = NULL; PRUint32 parallelPortCount = 0; size_t i = 0; data->vboxObj->vtbl->GetSystemProperties(data->vboxObj, &systemProperties); if (systemProperties) { systemProperties->vtbl->GetParallelPortCount(systemProperties, &parallelPortCount); VBOX_RELEASE(systemProperties); systemProperties = NULL; } VIR_DEBUG("Number of Parallel Ports to be connected: %zu", def->nparallels); VIR_DEBUG("Number of Parallel Ports available: %d", parallelPortCount); for (i = 0; (i < def->nparallels) && (i < parallelPortCount); i++) { IParallelPort *parallelPort = NULL; VIR_DEBUG("ParallelPort(%zu): Type: %d", i, def->parallels[i]->source.type); VIR_DEBUG("ParallelPort(%zu): target.port: %d", i, def->parallels[i]->target.port); machine->vtbl->GetParallelPort(machine, i, &parallelPort); if (parallelPort) { PRUnichar *pathUtf16 = NULL; VBOX_UTF8_TO_UTF16(def->parallels[i]->source.data.file.path, &pathUtf16); /* For now hard code the parallel ports to * LPT1 (Base Addr: 0x378 (decimal: 888), IRQ: 7) * LPT2 (Base Addr: 0x278 (decimal: 632), IRQ: 5) * TODO: make this more flexible */ if ((def->parallels[i]->source.type == VIR_DOMAIN_CHR_TYPE_DEV) || (def->parallels[i]->source.type == VIR_DOMAIN_CHR_TYPE_PTY) || (def->parallels[i]->source.type == VIR_DOMAIN_CHR_TYPE_FILE) || (def->parallels[i]->source.type == VIR_DOMAIN_CHR_TYPE_PIPE)) { parallelPort->vtbl->SetPath(parallelPort, pathUtf16); if (i == 0) { parallelPort->vtbl->SetIRQ(parallelPort, 7); parallelPort->vtbl->SetIOBase(parallelPort, 888); VIR_DEBUG(" parallePort-%zu irq: %d, iobase 0x%x, path: %s", i, 7, 888, def->parallels[i]->source.data.file.path); } else if (i == 1) { parallelPort->vtbl->SetIRQ(parallelPort, 5); parallelPort->vtbl->SetIOBase(parallelPort, 632); VIR_DEBUG(" parallePort-%zu irq: %d, iobase 0x%x, path: %s", i, 5, 632, def->parallels[i]->source.data.file.path); } } /* like serial port, parallel port can't be enabled unless * correct IRQ and IOBase values are specified. */ parallelPort->vtbl->SetEnabled(parallelPort, 1); VBOX_RELEASE(parallelPort); VBOX_UTF16_FREE(pathUtf16); } } } static void vboxAttachVideo(virDomainDefPtr def, IMachine *machine) { if ((def->nvideos == 1) && (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_VBOX)) { machine->vtbl->SetVRAMSize(machine, VIR_DIV_UP(def->videos[0]->vram, 1024)); machine->vtbl->SetMonitorCount(machine, def->videos[0]->heads); if (def->videos[0]->accel) { machine->vtbl->SetAccelerate3DEnabled(machine, def->videos[0]->accel->support3d); #if VBOX_API_VERSION >= 3001 machine->vtbl->SetAccelerate2DVideoEnabled(machine, def->videos[0]->accel->support2d); #endif /* VBOX_API_VERSION >= 3001 */ } else { machine->vtbl->SetAccelerate3DEnabled(machine, 0); #if VBOX_API_VERSION >= 3001 machine->vtbl->SetAccelerate2DVideoEnabled(machine, 0); #endif /* VBOX_API_VERSION >= 3001 */ } } } static void vboxAttachDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) { int vrdpPresent = 0; int sdlPresent = 0; int guiPresent = 0; char *guiDisplay = NULL; char *sdlDisplay = NULL; size_t i = 0; for (i = 0; i < def->ngraphics; i++) { #if VBOX_API_VERSION < 4000 IVRDPServer *VRDxServer = NULL; #else /* VBOX_API_VERSION >= 4000 */ IVRDEServer *VRDxServer = NULL; #endif /* VBOX_API_VERSION >= 4000 */ if ((def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_RDP) && (vrdpPresent == 0)) { vrdpPresent = 1; #if VBOX_API_VERSION < 4000 machine->vtbl->GetVRDPServer(machine, &VRDxServer); #else /* VBOX_API_VERSION >= 4000 */ machine->vtbl->GetVRDEServer(machine, &VRDxServer); #endif /* VBOX_API_VERSION >= 4000 */ if (VRDxServer) { const char *listenAddr = virDomainGraphicsListenGetAddress(def->graphics[i], 0); VRDxServer->vtbl->SetEnabled(VRDxServer, PR_TRUE); VIR_DEBUG("VRDP Support turned ON."); #if VBOX_API_VERSION < 3001 if (def->graphics[i]->data.rdp.port) { VRDxServer->vtbl->SetPort(VRDxServer, def->graphics[i]->data.rdp.port); VIR_DEBUG("VRDP Port changed to: %d", def->graphics[i]->data.rdp.port); } else if (def->graphics[i]->data.rdp.autoport) { /* Setting the port to 0 will reset its value to * the default one which is 3389 currently */ VRDxServer->vtbl->SetPort(VRDxServer, 0); VIR_DEBUG("VRDP Port changed to default, which is 3389 currently"); } #elif VBOX_API_VERSION < 4000 /* 3001 <= VBOX_API_VERSION < 4000 */ PRUnichar *portUtf16 = NULL; portUtf16 = PRUnicharFromInt(def->graphics[i]->data.rdp.port); VRDxServer->vtbl->SetPorts(VRDxServer, portUtf16); VBOX_UTF16_FREE(portUtf16); #else /* VBOX_API_VERSION >= 4000 */ PRUnichar *VRDEPortsKey = NULL; PRUnichar *VRDEPortsValue = NULL; VBOX_UTF8_TO_UTF16("TCP/Ports", &VRDEPortsKey); VRDEPortsValue = PRUnicharFromInt(def->graphics[i]->data.rdp.port); VRDxServer->vtbl->SetVRDEProperty(VRDxServer, VRDEPortsKey, VRDEPortsValue); VBOX_UTF16_FREE(VRDEPortsKey); VBOX_UTF16_FREE(VRDEPortsValue); #endif /* VBOX_API_VERSION >= 4000 */ if (def->graphics[i]->data.rdp.replaceUser) { VRDxServer->vtbl->SetReuseSingleConnection(VRDxServer, PR_TRUE); VIR_DEBUG("VRDP set to reuse single connection"); } if (def->graphics[i]->data.rdp.multiUser) { VRDxServer->vtbl->SetAllowMultiConnection(VRDxServer, PR_TRUE); VIR_DEBUG("VRDP set to allow multiple connection"); } if (listenAddr) { #if VBOX_API_VERSION >= 4000 PRUnichar *netAddressKey = NULL; #endif PRUnichar *netAddressUtf16 = NULL; VBOX_UTF8_TO_UTF16(listenAddr, &netAddressUtf16); #if VBOX_API_VERSION < 4000 VRDxServer->vtbl->SetNetAddress(VRDxServer, netAddressUtf16); #else /* VBOX_API_VERSION >= 4000 */ VBOX_UTF8_TO_UTF16("TCP/Address", &netAddressKey); VRDxServer->vtbl->SetVRDEProperty(VRDxServer, netAddressKey, netAddressUtf16); VBOX_UTF16_FREE(netAddressKey); #endif /* VBOX_API_VERSION >= 4000 */ VIR_DEBUG("VRDP listen address is set to: %s", listenAddr); VBOX_UTF16_FREE(netAddressUtf16); } VBOX_RELEASE(VRDxServer); } } if ((def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP) && (guiPresent == 0)) { guiPresent = 1; if (VIR_STRDUP(guiDisplay, def->graphics[i]->data.desktop.display) < 0) { /* just don't go to cleanup yet as it is ok to have * guiDisplay as NULL and we check it below if it * exist and then only use it there */ } } if ((def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) && (sdlPresent == 0)) { sdlPresent = 1; if (VIR_STRDUP(sdlDisplay, def->graphics[i]->data.sdl.display) < 0) { /* just don't go to cleanup yet as it is ok to have * sdlDisplay as NULL and we check it below if it * exist and then only use it there */ } } } if ((vrdpPresent == 1) && (guiPresent == 0) && (sdlPresent == 0)) { /* store extradata key that frontend is set to vrdp */ PRUnichar *keyTypeUtf16 = NULL; PRUnichar *valueTypeUtf16 = NULL; VBOX_UTF8_TO_UTF16("FRONTEND/Type", &keyTypeUtf16); VBOX_UTF8_TO_UTF16("vrdp", &valueTypeUtf16); machine->vtbl->SetExtraData(machine, keyTypeUtf16, valueTypeUtf16); VBOX_UTF16_FREE(keyTypeUtf16); VBOX_UTF16_FREE(valueTypeUtf16); } else if ((guiPresent == 0) && (sdlPresent == 1)) { /* store extradata key that frontend is set to sdl */ PRUnichar *keyTypeUtf16 = NULL; PRUnichar *valueTypeUtf16 = NULL; PRUnichar *keyDislpayUtf16 = NULL; PRUnichar *valueDisplayUtf16 = NULL; VBOX_UTF8_TO_UTF16("FRONTEND/Type", &keyTypeUtf16); VBOX_UTF8_TO_UTF16("sdl", &valueTypeUtf16); machine->vtbl->SetExtraData(machine, keyTypeUtf16, valueTypeUtf16); VBOX_UTF16_FREE(keyTypeUtf16); VBOX_UTF16_FREE(valueTypeUtf16); if (sdlDisplay) { VBOX_UTF8_TO_UTF16("FRONTEND/Display", &keyDislpayUtf16); VBOX_UTF8_TO_UTF16(sdlDisplay, &valueDisplayUtf16); machine->vtbl->SetExtraData(machine, keyDislpayUtf16, valueDisplayUtf16); VBOX_UTF16_FREE(keyDislpayUtf16); VBOX_UTF16_FREE(valueDisplayUtf16); } } else { /* if all are set then default is gui, with vrdp turned on */ PRUnichar *keyTypeUtf16 = NULL; PRUnichar *valueTypeUtf16 = NULL; PRUnichar *keyDislpayUtf16 = NULL; PRUnichar *valueDisplayUtf16 = NULL; VBOX_UTF8_TO_UTF16("FRONTEND/Type", &keyTypeUtf16); VBOX_UTF8_TO_UTF16("gui", &valueTypeUtf16); machine->vtbl->SetExtraData(machine, keyTypeUtf16, valueTypeUtf16); VBOX_UTF16_FREE(keyTypeUtf16); VBOX_UTF16_FREE(valueTypeUtf16); if (guiDisplay) { VBOX_UTF8_TO_UTF16("FRONTEND/Display", &keyDislpayUtf16); VBOX_UTF8_TO_UTF16(guiDisplay, &valueDisplayUtf16); machine->vtbl->SetExtraData(machine, keyDislpayUtf16, valueDisplayUtf16); VBOX_UTF16_FREE(keyDislpayUtf16); VBOX_UTF16_FREE(valueDisplayUtf16); } } VIR_FREE(guiDisplay); VIR_FREE(sdlDisplay); } static void vboxAttachUSB(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) { #if VBOX_API_VERSION < 4003 IUSBController *USBController = NULL; #else IUSBDeviceFilters *USBDeviceFilters = NULL; #endif size_t i = 0; bool isUSB = false; if (def->nhostdevs == 0) return; /* Loop through the devices first and see if you * have a USB Device, only if you have one then * start the USB controller else just proceed as * usual */ for (i = 0; i < def->nhostdevs; i++) { if (def->hostdevs[i]->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) continue; if (def->hostdevs[i]->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) continue; if (!def->hostdevs[i]->source.subsys.u.usb.vendor && !def->hostdevs[i]->source.subsys.u.usb.product) continue; VIR_DEBUG("USB Device detected, VendorId:0x%x, ProductId:0x%x", def->hostdevs[i]->source.subsys.u.usb.vendor, def->hostdevs[i]->source.subsys.u.usb.product); isUSB = true; break; } if (!isUSB) return; #if VBOX_API_VERSION < 4003 /* First Start the USB Controller and then loop * to attach USB Devices to it */ machine->vtbl->GetUSBController(machine, &USBController); if (!USBController) return; USBController->vtbl->SetEnabled(USBController, 1); # if VBOX_API_VERSION < 4002 USBController->vtbl->SetEnabledEhci(USBController, 1); # else USBController->vtbl->SetEnabledEHCI(USBController, 1); # endif #else machine->vtbl->GetUSBDeviceFilters(machine, &USBDeviceFilters); if (!USBDeviceFilters) return; #endif for (i = 0; i < def->nhostdevs; i++) { char *filtername = NULL; PRUnichar *filternameUtf16 = NULL; IUSBDeviceFilter *filter = NULL; PRUnichar *vendorIdUtf16 = NULL; char vendorId[40] = {0}; PRUnichar *productIdUtf16 = NULL; char productId[40] = {0}; if (def->hostdevs[i]->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) continue; if (def->hostdevs[i]->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) continue; /* Zero pad for nice alignment when fewer than 9999 * devices. */ if (virAsprintf(&filtername, "filter%04zu", i) >= 0) { VBOX_UTF8_TO_UTF16(filtername, &filternameUtf16); VIR_FREE(filtername); #if VBOX_API_VERSION < 4003 USBController->vtbl->CreateDeviceFilter(USBController, filternameUtf16, &filter); #else USBDeviceFilters->vtbl->CreateDeviceFilter(USBDeviceFilters, filternameUtf16, &filter); #endif } VBOX_UTF16_FREE(filternameUtf16); if (!filter) continue; if (!def->hostdevs[i]->source.subsys.u.usb.vendor && !def->hostdevs[i]->source.subsys.u.usb.product) continue; if (def->hostdevs[i]->source.subsys.u.usb.vendor) { snprintf(vendorId, sizeof(vendorId), "%x", def->hostdevs[i]->source.subsys.u.usb.vendor); VBOX_UTF8_TO_UTF16(vendorId, &vendorIdUtf16); filter->vtbl->SetVendorId(filter, vendorIdUtf16); VBOX_UTF16_FREE(vendorIdUtf16); } if (def->hostdevs[i]->source.subsys.u.usb.product) { snprintf(productId, sizeof(productId), "%x", def->hostdevs[i]->source.subsys.u.usb.product); VBOX_UTF8_TO_UTF16(productId, &productIdUtf16); filter->vtbl->SetProductId(filter, productIdUtf16); VBOX_UTF16_FREE(productIdUtf16); } filter->vtbl->SetActive(filter, 1); #if VBOX_API_VERSION < 4003 USBController->vtbl->InsertDeviceFilter(USBController, i, filter); #else USBDeviceFilters->vtbl->InsertDeviceFilter(USBDeviceFilters, i, filter); #endif VBOX_RELEASE(filter); } #if VBOX_API_VERSION < 4003 VBOX_RELEASE(USBController); #else VBOX_RELEASE(USBDeviceFilters); #endif } static void vboxAttachSharedFolder(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) { size_t i; PRUnichar *nameUtf16; PRUnichar *hostPathUtf16; PRBool writable; if (def->nfss == 0) return; for (i = 0; i < def->nfss; i++) { if (def->fss[i]->type != VIR_DOMAIN_FS_TYPE_MOUNT) continue; VBOX_UTF8_TO_UTF16(def->fss[i]->dst, &nameUtf16); VBOX_UTF8_TO_UTF16(def->fss[i]->src, &hostPathUtf16); writable = !def->fss[i]->readonly; #if VBOX_API_VERSION < 4000 machine->vtbl->CreateSharedFolder(machine, nameUtf16, hostPathUtf16, writable); #else /* VBOX_API_VERSION >= 4000 */ machine->vtbl->CreateSharedFolder(machine, nameUtf16, hostPathUtf16, writable, PR_FALSE); #endif /* VBOX_API_VERSION >= 4000 */ VBOX_UTF16_FREE(nameUtf16); VBOX_UTF16_FREE(hostPathUtf16); } } static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) { VBOX_OBJECT_CHECK(conn, virDomainPtr, NULL); IMachine *machine = NULL; IBIOSSettings *bios = NULL; vboxIID iid = VBOX_IID_INITIALIZER; vboxIID mchiid = VBOX_IID_INITIALIZER; virDomainDefPtr def = NULL; PRUnichar *machineNameUtf16 = NULL; #if VBOX_API_VERSION >= 3002 && VBOX_API_VERSION < 4002 PRBool override = PR_FALSE; #endif nsresult rc; char uuidstr[VIR_UUID_STRING_BUFLEN]; #if VBOX_API_VERSION >= 4002 const char *flagsUUIDPrefix = "UUID="; const char *flagsForceOverwrite = "forceOverwrite=0"; const char *flagsSeparator = ","; char createFlags[strlen(flagsUUIDPrefix) + VIR_UUID_STRING_BUFLEN + strlen(flagsSeparator) + strlen(flagsForceOverwrite) + 1]; PRUnichar *createFlagsUtf16 = NULL; #endif if (!(def = virDomainDefParseString(xml, data->caps, data->xmlopt, 1 << VIR_DOMAIN_VIRT_VBOX, VIR_DOMAIN_XML_INACTIVE))) { goto cleanup; } VBOX_UTF8_TO_UTF16(def->name, &machineNameUtf16); vboxIIDFromUUID(&iid, def->uuid); virUUIDFormat(def->uuid, uuidstr); #if VBOX_API_VERSION < 3002 rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj, machineNameUtf16, NULL, NULL, iid.value, &machine); #elif VBOX_API_VERSION < 4000 /* 3002 <= VBOX_API_VERSION < 4000 */ rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj, machineNameUtf16, NULL, NULL, iid.value, override, &machine); #elif VBOX_API_VERSION >= 4000 && VBOX_API_VERSION < 4002 rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj, NULL, machineNameUtf16, NULL, iid.value, override, &machine); #else /* VBOX_API_VERSION >= 4002 */ snprintf(createFlags, sizeof(createFlags), "%s%s%s%s", flagsUUIDPrefix, uuidstr, flagsSeparator, flagsForceOverwrite ); VBOX_UTF8_TO_UTF16(createFlags, &createFlagsUtf16); rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj, NULL, machineNameUtf16, 0, nsnull, nsnull, createFlagsUtf16, &machine); #endif /* VBOX_API_VERSION >= 4002 */ VBOX_UTF16_FREE(machineNameUtf16); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not define a domain, rc=%08x"), (unsigned)rc); goto cleanup; } rc = machine->vtbl->SetMemorySize(machine, VIR_DIV_UP(def->mem.cur_balloon, 1024)); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not set the memory size of the domain to: %llu Kb, " "rc=%08x"), def->mem.cur_balloon, (unsigned)rc); } if (def->vcpus != def->maxvcpus) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("current vcpu count must equal maximum")); } rc = machine->vtbl->SetCPUCount(machine, def->maxvcpus); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not set the number of virtual CPUs to: %u, rc=%08x"), def->maxvcpus, (unsigned)rc); } #if VBOX_API_VERSION < 3001 rc = machine->vtbl->SetPAEEnabled(machine, def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_DOMAIN_FEATURE_STATE_ON); #elif VBOX_API_VERSION == 3001 rc = machine->vtbl->SetCpuProperty(machine, CpuPropertyType_PAE, def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_DOMAIN_FEATURE_STATE_ON); #elif VBOX_API_VERSION >= 3002 rc = machine->vtbl->SetCPUProperty(machine, CPUPropertyType_PAE, def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_DOMAIN_FEATURE_STATE_ON); #endif if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not change PAE status to: %s, rc=%08x"), (def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_DOMAIN_FEATURE_STATE_ON) ? _("Enabled") : _("Disabled"), (unsigned)rc); } machine->vtbl->GetBIOSSettings(machine, &bios); if (bios) { rc = bios->vtbl->SetACPIEnabled(bios, def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_DOMAIN_FEATURE_STATE_ON); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not change ACPI status to: %s, rc=%08x"), (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_DOMAIN_FEATURE_STATE_ON) ? _("Enabled") : _("Disabled"), (unsigned)rc); } rc = bios->vtbl->SetIOAPICEnabled(bios, def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_DOMAIN_FEATURE_STATE_ON); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not change APIC status to: %s, rc=%08x"), (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_DOMAIN_FEATURE_STATE_ON) ? _("Enabled") : _("Disabled"), (unsigned)rc); } VBOX_RELEASE(bios); } /* Register the machine before attaching other devices to it */ rc = data->vboxObj->vtbl->RegisterMachine(data->vboxObj, machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not define a domain, rc=%08x"), (unsigned)rc); goto cleanup; } /* Get the uuid of the machine, currently it is immutable * object so open a session to it and get it back, so that * you can make changes to the machine setting */ machine->vtbl->GetId(machine, &mchiid.value); VBOX_SESSION_OPEN(mchiid.value, machine); data->vboxSession->vtbl->GetMachine(data->vboxSession, &machine); vboxSetBootDeviceOrder(def, data, machine); vboxAttachDrives(def, data, machine); vboxAttachSound(def, machine); vboxAttachNetwork(def, data, machine); vboxAttachSerial(def, data, machine); vboxAttachParallel(def, data, machine); vboxAttachVideo(def, machine); vboxAttachDisplay(def, data, machine); vboxAttachUSB(def, data, machine); vboxAttachSharedFolder(def, data, machine); /* Save the machine settings made till now and close the * session. also free up the mchiid variable used. */ rc = machine->vtbl->SaveSettings(machine); VBOX_SESSION_CLOSE(); vboxIIDUnalloc(&mchiid); ret = virGetDomain(conn, def->name, def->uuid); VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); virDomainDefFree(def); return ret; cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); virDomainDefFree(def); return NULL; } static int vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, int, -1); IMachine *machine = NULL; vboxIID iid = VBOX_IID_INITIALIZER; nsresult rc; #if VBOX_API_VERSION >= 4000 vboxArray media = VBOX_ARRAY_INITIALIZER; #endif /* No managed save, so we explicitly reject * VIR_DOMAIN_UNDEFINE_MANAGED_SAVE. No snapshot metadata for * VBox, so we can trivially ignore that flag. */ virCheckFlags(VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA, -1); vboxIIDFromUUID(&iid, dom->uuid); #if VBOX_API_VERSION < 4000 /* Block for checking if HDD's are attched to VM. * considering just IDE bus for now. Also skipped * chanel=1 and device=0 (Secondary Master) as currenlty * it is allocated to CD/DVD Drive by default. * * Only do this for VirtualBox 3.x and before. Since * VirtualBox 4.0 the Unregister method can do this for use. */ { PRUnichar *hddcnameUtf16 = NULL; char *hddcname; ignore_value(VIR_STRDUP(hddcname, "IDE")); VBOX_UTF8_TO_UTF16(hddcname, &hddcnameUtf16); VIR_FREE(hddcname); /* Open a Session for the machine */ rc = VBOX_SESSION_OPEN(iid.value, machine); if (NS_SUCCEEDED(rc)) { rc = data->vboxSession->vtbl->GetMachine(data->vboxSession, &machine); if (NS_SUCCEEDED(rc) && machine) { # if VBOX_API_VERSION < 3001 /* Disconnect all the drives if present */ machine->vtbl->DetachHardDisk(machine, hddcnameUtf16, 0, 0); machine->vtbl->DetachHardDisk(machine, hddcnameUtf16, 0, 1); machine->vtbl->DetachHardDisk(machine, hddcnameUtf16, 1, 1); # else /* VBOX_API_VERSION >= 3001 */ /* get all the controller first, then the attachments and * remove them all so that the machine can be undefined */ vboxArray storageControllers = VBOX_ARRAY_INITIALIZER; size_t i = 0, j = 0; vboxArrayGet(&storageControllers, machine, machine->vtbl->GetStorageControllers); for (i = 0; i < storageControllers.count; i++) { IStorageController *strCtl = storageControllers.items[i]; PRUnichar *strCtlName = NULL; vboxArray mediumAttachments = VBOX_ARRAY_INITIALIZER; if (!strCtl) continue; strCtl->vtbl->GetName(strCtl, &strCtlName); vboxArrayGetWithPtrArg(&mediumAttachments, machine, machine->vtbl->GetMediumAttachmentsOfController, strCtlName); for (j = 0; j < mediumAttachments.count; j++) { IMediumAttachment *medAtt = mediumAttachments.items[j]; PRInt32 port = ~0U; PRInt32 device = ~0U; if (!medAtt) continue; medAtt->vtbl->GetPort(medAtt, &port); medAtt->vtbl->GetDevice(medAtt, &device); if ((port != ~0U) && (device != ~0U)) { machine->vtbl->DetachDevice(machine, strCtlName, port, device); } } vboxArrayRelease(&storageControllers); machine->vtbl->RemoveStorageController(machine, strCtlName); VBOX_UTF16_FREE(strCtlName); } vboxArrayRelease(&storageControllers); # endif /* VBOX_API_VERSION >= 3001 */ machine->vtbl->SaveSettings(machine); } VBOX_SESSION_CLOSE(); } VBOX_UTF16_FREE(hddcnameUtf16); } #endif #if VBOX_API_VERSION < 4000 rc = data->vboxObj->vtbl->UnregisterMachine(data->vboxObj, iid.value, &machine); #else /* VBOX_API_VERSION >= 4000 */ rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); return -1; } /* We're not interested in the array returned by the Unregister method, * but in the side effect of unregistering the virtual machine. In order * to call the Unregister method correctly we need to use the vboxArray * wrapper here. */ rc = vboxArrayGetWithUintArg(&media, machine, machine->vtbl->Unregister, CleanupMode_DetachAllReturnNone); #endif /* VBOX_API_VERSION >= 4000 */ DEBUGIID("UUID of machine being undefined", iid.value); if (NS_SUCCEEDED(rc)) { #if VBOX_API_VERSION < 4000 machine->vtbl->DeleteSettings(machine); #else /* VBOX_API_VERSION >= 4000 */ IProgress *progress = NULL; /* The IMachine Delete method takes an array of IMedium items to be * deleted along with the virtual machine. We just want to pass an * empty array. But instead of adding a full vboxArraySetWithReturn to * the glue layer (in order to handle the required signature of the * Delete method) we use a local solution here. */ # ifdef WIN32 SAFEARRAY *safeArray = NULL; typedef HRESULT __stdcall (*IMachine_Delete)(IMachine *self, SAFEARRAY **media, IProgress **progress); # if VBOX_API_VERSION < 4003 ((IMachine_Delete)machine->vtbl->Delete)(machine, &safeArray, &progress); # else ((IMachine_Delete)machine->vtbl->DeleteConfig)(machine, &safeArray, &progress); # endif # else /* XPCOM doesn't like NULL as an array, even when the array size is 0. * Instead pass it a dummy array to avoid passing NULL. */ IMedium *array[] = { NULL }; # if VBOX_API_VERSION < 4003 machine->vtbl->Delete(machine, 0, array, &progress); # else machine->vtbl->DeleteConfig(machine, 0, array, &progress); # endif # endif if (progress != NULL) { progress->vtbl->WaitForCompletion(progress, -1); VBOX_RELEASE(progress); } #endif /* VBOX_API_VERSION >= 4000 */ ret = 0; } else { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not delete the domain, rc=%08x"), (unsigned)rc); } #if VBOX_API_VERSION >= 4000 vboxArrayUnalloc(&media); #endif vboxIIDUnalloc(&iid); VBOX_RELEASE(machine); return ret; } static int vboxDomainUndefine(virDomainPtr dom) { return vboxDomainUndefineFlags(dom, 0); } static int vboxDomainAttachDeviceImpl(virDomainPtr dom, const char *xml, int mediaChangeOnly ATTRIBUTE_UNUSED) { VBOX_OBJECT_CHECK(dom->conn, int, -1); IMachine *machine = NULL; vboxIID iid = VBOX_IID_INITIALIZER; PRUint32 state = MachineState_Null; virDomainDefPtr def = NULL; virDomainDeviceDefPtr dev = NULL; nsresult rc; if (VIR_ALLOC(def) < 0) return ret; if (VIR_STRDUP(def->os.type, "hvm") < 0) goto cleanup; dev = virDomainDeviceDefParse(xml, def, data->caps, data->xmlopt, VIR_DOMAIN_XML_INACTIVE); if (dev == NULL) goto cleanup; vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } if (machine) { machine->vtbl->GetState(machine, &state); if ((state == MachineState_Running) || (state == MachineState_Paused)) { rc = VBOX_SESSION_OPEN_EXISTING(iid.value, machine); } else { rc = VBOX_SESSION_OPEN(iid.value, machine); } if (NS_SUCCEEDED(rc)) { rc = data->vboxSession->vtbl->GetMachine(data->vboxSession, &machine); if (NS_SUCCEEDED(rc) && machine) { if (dev->type == VIR_DOMAIN_DEVICE_DISK) { #if VBOX_API_VERSION < 3001 if (dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { if (dev->data.disk->type == VIR_DOMAIN_DISK_TYPE_FILE && dev->data.disk->src != NULL) { IDVDDrive *dvdDrive = NULL; /* Currently CDROM/DVD Drive is always IDE * Secondary Master so neglecting the following * parameter dev->data.disk->bus */ machine->vtbl->GetDVDDrive(machine, &dvdDrive); if (dvdDrive) { IDVDImage *dvdImage = NULL; PRUnichar *dvdfileUtf16 = NULL; vboxIID dvduuid = VBOX_IID_INITIALIZER; vboxIID dvdemptyuuid = VBOX_IID_INITIALIZER; VBOX_UTF8_TO_UTF16(dev->data.disk->src, &dvdfileUtf16); data->vboxObj->vtbl->FindDVDImage(data->vboxObj, dvdfileUtf16, &dvdImage); if (!dvdImage) { data->vboxObj->vtbl->OpenDVDImage(data->vboxObj, dvdfileUtf16, dvdemptyuuid.value, &dvdImage); } if (dvdImage) { rc = dvdImage->vtbl->imedium.GetId((IMedium *)dvdImage, &dvduuid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("can't get the uuid of the file to " "be attached to cdrom: %s, rc=%08x"), dev->data.disk->src, (unsigned)rc); } else { /* unmount the previous mounted image */ dvdDrive->vtbl->Unmount(dvdDrive); rc = dvdDrive->vtbl->MountImage(dvdDrive, dvduuid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not attach the file to cdrom: %s, rc=%08x"), dev->data.disk->src, (unsigned)rc); } else { ret = 0; DEBUGIID("CD/DVD Image UUID:", dvduuid.value); } } VBOX_MEDIUM_RELEASE(dvdImage); } vboxIIDUnalloc(&dvduuid); VBOX_UTF16_FREE(dvdfileUtf16); VBOX_RELEASE(dvdDrive); } } else if (dev->data.disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK) { } } else if (dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { if (dev->data.disk->type == VIR_DOMAIN_DISK_TYPE_FILE && dev->data.disk->src != NULL) { IFloppyDrive *floppyDrive; machine->vtbl->GetFloppyDrive(machine, &floppyDrive); if (floppyDrive) { rc = floppyDrive->vtbl->SetEnabled(floppyDrive, 1); if (NS_SUCCEEDED(rc)) { IFloppyImage *floppyImage = NULL; PRUnichar *fdfileUtf16 = NULL; vboxIID fduuid = VBOX_IID_INITIALIZER; vboxIID fdemptyuuid = VBOX_IID_INITIALIZER; VBOX_UTF8_TO_UTF16(dev->data.disk->src, &fdfileUtf16); rc = data->vboxObj->vtbl->FindFloppyImage(data->vboxObj, fdfileUtf16, &floppyImage); if (!floppyImage) { data->vboxObj->vtbl->OpenFloppyImage(data->vboxObj, fdfileUtf16, fdemptyuuid.value, &floppyImage); } if (floppyImage) { rc = floppyImage->vtbl->imedium.GetId((IMedium *)floppyImage, &fduuid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("can't get the uuid of the file to be " "attached to floppy drive: %s, rc=%08x"), dev->data.disk->src, (unsigned)rc); } else { rc = floppyDrive->vtbl->MountImage(floppyDrive, fduuid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not attach the file to floppy drive: %s, rc=%08x"), dev->data.disk->src, (unsigned)rc); } else { ret = 0; DEBUGIID("attached floppy, UUID:", fduuid.value); } } VBOX_MEDIUM_RELEASE(floppyImage); } vboxIIDUnalloc(&fduuid); VBOX_UTF16_FREE(fdfileUtf16); } VBOX_RELEASE(floppyDrive); } } else if (dev->data.disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK) { } } #else /* VBOX_API_VERSION >= 3001 */ #endif /* VBOX_API_VERSION >= 3001 */ } else if (dev->type == VIR_DOMAIN_DEVICE_NET) { } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) { if (dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) { if (dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) { } } } else if (dev->type == VIR_DOMAIN_DEVICE_FS && dev->data.fs->type == VIR_DOMAIN_FS_TYPE_MOUNT) { PRUnichar *nameUtf16; PRUnichar *hostPathUtf16; PRBool writable; VBOX_UTF8_TO_UTF16(dev->data.fs->dst, &nameUtf16); VBOX_UTF8_TO_UTF16(dev->data.fs->src, &hostPathUtf16); writable = !dev->data.fs->readonly; #if VBOX_API_VERSION < 4000 rc = machine->vtbl->CreateSharedFolder(machine, nameUtf16, hostPathUtf16, writable); #else /* VBOX_API_VERSION >= 4000 */ rc = machine->vtbl->CreateSharedFolder(machine, nameUtf16, hostPathUtf16, writable, PR_FALSE); #endif /* VBOX_API_VERSION >= 4000 */ if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not attach shared folder '%s', rc=%08x"), dev->data.fs->dst, (unsigned)rc); } else { ret = 0; } VBOX_UTF16_FREE(nameUtf16); VBOX_UTF16_FREE(hostPathUtf16); } machine->vtbl->SaveSettings(machine); VBOX_RELEASE(machine); } VBOX_SESSION_CLOSE(); } } cleanup: vboxIIDUnalloc(&iid); virDomainDefFree(def); virDomainDeviceDefFree(dev); return ret; } static int vboxDomainAttachDevice(virDomainPtr dom, const char *xml) { return vboxDomainAttachDeviceImpl(dom, xml, 0); } static int vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, unsigned int flags) { virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); if (flags & VIR_DOMAIN_AFFECT_CONFIG) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot modify the persistent configuration of a domain")); return -1; } return vboxDomainAttachDeviceImpl(dom, xml, 0); } static int vboxDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml, unsigned int flags) { virCheckFlags(VIR_DOMAIN_AFFECT_CURRENT | VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); if (flags & VIR_DOMAIN_AFFECT_CONFIG) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot modify the persistent configuration of a domain")); return -1; } return vboxDomainAttachDeviceImpl(dom, xml, 1); } static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) { VBOX_OBJECT_CHECK(dom->conn, int, -1); IMachine *machine = NULL; vboxIID iid = VBOX_IID_INITIALIZER; PRUint32 state = MachineState_Null; virDomainDefPtr def = NULL; virDomainDeviceDefPtr dev = NULL; nsresult rc; if (VIR_ALLOC(def) < 0) return ret; if (VIR_STRDUP(def->os.type, "hvm") < 0) goto cleanup; dev = virDomainDeviceDefParse(xml, def, data->caps, data->xmlopt, VIR_DOMAIN_XML_INACTIVE); if (dev == NULL) goto cleanup; vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } if (machine) { machine->vtbl->GetState(machine, &state); if ((state == MachineState_Running) || (state == MachineState_Paused)) { rc = VBOX_SESSION_OPEN_EXISTING(iid.value, machine); } else { rc = VBOX_SESSION_OPEN(iid.value, machine); } if (NS_SUCCEEDED(rc)) { rc = data->vboxSession->vtbl->GetMachine(data->vboxSession, &machine); if (NS_SUCCEEDED(rc) && machine) { if (dev->type == VIR_DOMAIN_DEVICE_DISK) { #if VBOX_API_VERSION < 3001 if (dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { if (dev->data.disk->type == VIR_DOMAIN_DISK_TYPE_FILE) { IDVDDrive *dvdDrive = NULL; /* Currently CDROM/DVD Drive is always IDE * Secondary Master so neglecting the following * parameter dev->data.disk->bus */ machine->vtbl->GetDVDDrive(machine, &dvdDrive); if (dvdDrive) { rc = dvdDrive->vtbl->Unmount(dvdDrive); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not de-attach the mounted ISO, rc=%08x"), (unsigned)rc); } else { ret = 0; } VBOX_RELEASE(dvdDrive); } } else if (dev->data.disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK) { } } else if (dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { if (dev->data.disk->type == VIR_DOMAIN_DISK_TYPE_FILE) { IFloppyDrive *floppyDrive; machine->vtbl->GetFloppyDrive(machine, &floppyDrive); if (floppyDrive) { PRBool enabled = PR_FALSE; floppyDrive->vtbl->GetEnabled(floppyDrive, &enabled); if (enabled) { rc = floppyDrive->vtbl->Unmount(floppyDrive); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not attach the file " "to floppy drive, rc=%08x"), (unsigned)rc); } else { ret = 0; } } else { /* If you are here means floppy drive is already unmounted * so don't flag error, just say everything is fine and quit */ ret = 0; } VBOX_RELEASE(floppyDrive); } } else if (dev->data.disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK) { } } #else /* VBOX_API_VERSION >= 3001 */ #endif /* VBOX_API_VERSION >= 3001 */ } else if (dev->type == VIR_DOMAIN_DEVICE_NET) { } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) { if (dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) { if (dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) { } } } else if (dev->type == VIR_DOMAIN_DEVICE_FS && dev->data.fs->type == VIR_DOMAIN_FS_TYPE_MOUNT) { PRUnichar *nameUtf16; VBOX_UTF8_TO_UTF16(dev->data.fs->dst, &nameUtf16); rc = machine->vtbl->RemoveSharedFolder(machine, nameUtf16); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not detach shared folder '%s', rc=%08x"), dev->data.fs->dst, (unsigned)rc); } else { ret = 0; } VBOX_UTF16_FREE(nameUtf16); } machine->vtbl->SaveSettings(machine); VBOX_RELEASE(machine); } VBOX_SESSION_CLOSE(); } } cleanup: vboxIIDUnalloc(&iid); virDomainDefFree(def); virDomainDeviceDefFree(dev); return ret; } static int vboxDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, unsigned int flags) { virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); if (flags & VIR_DOMAIN_AFFECT_CONFIG) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot modify the persistent configuration of a domain")); return -1; } return vboxDomainDetachDevice(dom, xml); } static int vboxDomainSnapshotGetAll(virDomainPtr dom, IMachine *machine, ISnapshot ***snapshots) { vboxIID empty = VBOX_IID_INITIALIZER; ISnapshot **list = NULL; PRUint32 count; nsresult rc; unsigned int next; unsigned int top; rc = machine->vtbl->GetSnapshotCount(machine, &count); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get snapshot count for domain %s"), dom->name); goto error; } if (count == 0) goto out; if (VIR_ALLOC_N(list, count) < 0) goto error; #if VBOX_API_VERSION < 4000 rc = machine->vtbl->GetSnapshot(machine, empty.value, list); #else /* VBOX_API_VERSION >= 4000 */ rc = machine->vtbl->FindSnapshot(machine, empty.value, list); #endif /* VBOX_API_VERSION >= 4000 */ if (NS_FAILED(rc) || !list[0]) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get root snapshot for domain %s"), dom->name); goto error; } /* BFS walk through snapshot tree */ top = 1; for (next = 0; next < count; next++) { vboxArray children = VBOX_ARRAY_INITIALIZER; size_t i; if (!list[next]) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected number of snapshots < %u"), count); goto error; } rc = vboxArrayGet(&children, list[next], list[next]->vtbl->GetChildren); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get children snapshots")); goto error; } for (i = 0; i < children.count; i++) { ISnapshot *child = children.items[i]; if (!child) continue; if (top == count) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected number of snapshots > %u"), count); vboxArrayRelease(&children); goto error; } VBOX_ADDREF(child); list[top++] = child; } vboxArrayRelease(&children); } out: *snapshots = list; return count; error: if (list) { for (next = 0; next < count; next++) VBOX_RELEASE(list[next]); } VIR_FREE(list); return -1; } static ISnapshot * vboxDomainSnapshotGet(vboxGlobalData *data, virDomainPtr dom, IMachine *machine, const char *name) { ISnapshot **snapshots = NULL; ISnapshot *snapshot = NULL; nsresult rc; int count = 0; size_t i; if ((count = vboxDomainSnapshotGetAll(dom, machine, &snapshots)) < 0) goto cleanup; for (i = 0; i < count; i++) { PRUnichar *nameUtf16; char *nameUtf8; rc = snapshots[i]->vtbl->GetName(snapshots[i], &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get snapshot name")); goto cleanup; } VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8); VBOX_UTF16_FREE(nameUtf16); if (STREQ(name, nameUtf8)) snapshot = snapshots[i]; VBOX_UTF8_FREE(nameUtf8); if (snapshot) break; } if (!snapshot) { virReportError(VIR_ERR_OPERATION_INVALID, _("domain %s has no snapshots with name %s"), dom->name, name); goto cleanup; } cleanup: if (count > 0) { for (i = 0; i < count; i++) { if (snapshots[i] != snapshot) VBOX_RELEASE(snapshots[i]); } } VIR_FREE(snapshots); return snapshot; } static virDomainSnapshotPtr vboxDomainSnapshotCreateXML(virDomainPtr dom, const char *xmlDesc, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, virDomainSnapshotPtr, NULL); virDomainSnapshotDefPtr def = NULL; vboxIID domiid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; IConsole *console = NULL; IProgress *progress = NULL; ISnapshot *snapshot = NULL; PRUnichar *name = NULL; PRUnichar *description = NULL; PRUint32 state; nsresult rc; #if VBOX_API_VERSION == 2002 nsresult result; #else PRInt32 result; #endif /* VBox has no snapshot metadata, so this flag is trivial. */ virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA, NULL); if (!(def = virDomainSnapshotDefParseString(xmlDesc, data->caps, data->xmlopt, 0, 0))) goto cleanup; if (def->ndisks) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("disk snapshots not supported yet")); goto cleanup; } vboxIIDFromUUID(&domiid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } rc = machine->vtbl->GetState(machine, &state); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get domain state")); goto cleanup; } if ((state >= MachineState_FirstOnline) && (state <= MachineState_LastOnline)) { rc = VBOX_SESSION_OPEN_EXISTING(domiid.value, machine); } else { rc = VBOX_SESSION_OPEN(domiid.value, machine); } if (NS_SUCCEEDED(rc)) rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not open VirtualBox session with domain %s"), dom->name); goto cleanup; } VBOX_UTF8_TO_UTF16(def->name, &name); if (!name) { virReportOOMError(); goto cleanup; } if (def->description) { VBOX_UTF8_TO_UTF16(def->description, &description); if (!description) { virReportOOMError(); goto cleanup; } } rc = console->vtbl->TakeSnapshot(console, name, description, &progress); if (NS_FAILED(rc) || !progress) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not take snapshot of domain %s"), dom->name); goto cleanup; } progress->vtbl->WaitForCompletion(progress, -1); progress->vtbl->GetResultCode(progress, &result); if (NS_FAILED(result)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not take snapshot of domain %s"), dom->name); goto cleanup; } rc = machine->vtbl->GetCurrentSnapshot(machine, &snapshot); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get current snapshot of domain %s"), dom->name); goto cleanup; } ret = virGetDomainSnapshot(dom, def->name); cleanup: VBOX_RELEASE(progress); VBOX_UTF16_FREE(description); VBOX_UTF16_FREE(name); VBOX_RELEASE(console); VBOX_SESSION_CLOSE(); VBOX_RELEASE(machine); vboxIIDUnalloc(&domiid); virDomainSnapshotDefFree(def); return ret; } static char * vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, unsigned int flags) { virDomainPtr dom = snapshot->domain; VBOX_OBJECT_CHECK(dom->conn, char *, NULL); vboxIID domiid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; ISnapshot *snap = NULL; ISnapshot *parent = NULL; nsresult rc; virDomainSnapshotDefPtr def = NULL; PRUnichar *str16; char *str8; PRInt64 timestamp; PRBool online = PR_FALSE; char uuidstr[VIR_UUID_STRING_BUFLEN]; virCheckFlags(0, NULL); vboxIIDFromUUID(&domiid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } if (!(snap = vboxDomainSnapshotGet(data, dom, machine, snapshot->name))) goto cleanup; if (VIR_ALLOC(def) < 0) goto cleanup; if (VIR_STRDUP(def->name, snapshot->name) < 0) goto cleanup; rc = snap->vtbl->GetDescription(snap, &str16); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get description of snapshot %s"), snapshot->name); goto cleanup; } if (str16) { VBOX_UTF16_TO_UTF8(str16, &str8); VBOX_UTF16_FREE(str16); if (VIR_STRDUP(def->description, str8) < 0) { VBOX_UTF8_FREE(str8); goto cleanup; } VBOX_UTF8_FREE(str8); } rc = snap->vtbl->GetTimeStamp(snap, &timestamp); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get creation time of snapshot %s"), snapshot->name); goto cleanup; } /* timestamp is in milliseconds while creationTime in seconds */ def->creationTime = timestamp / 1000; rc = snap->vtbl->GetParent(snap, &parent); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get parent of snapshot %s"), snapshot->name); goto cleanup; } if (parent) { rc = parent->vtbl->GetName(parent, &str16); if (NS_FAILED(rc) || !str16) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get name of parent of snapshot %s"), snapshot->name); goto cleanup; } VBOX_UTF16_TO_UTF8(str16, &str8); VBOX_UTF16_FREE(str16); if (VIR_STRDUP(def->parent, str8) < 0) { VBOX_UTF8_FREE(str8); goto cleanup; } VBOX_UTF8_FREE(str8); } rc = snap->vtbl->GetOnline(snap, &online); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get online state of snapshot %s"), snapshot->name); goto cleanup; } if (online) def->state = VIR_DOMAIN_RUNNING; else def->state = VIR_DOMAIN_SHUTOFF; virUUIDFormat(dom->uuid, uuidstr); ret = virDomainSnapshotDefFormat(uuidstr, def, flags, 0); cleanup: virDomainSnapshotDefFree(def); VBOX_RELEASE(parent); VBOX_RELEASE(snap); VBOX_RELEASE(machine); vboxIIDUnalloc(&domiid); return ret; } static int vboxDomainSnapshotNum(virDomainPtr dom, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxIID iid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; nsresult rc; PRUint32 snapshotCount; virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_ROOTS | VIR_DOMAIN_SNAPSHOT_LIST_METADATA, -1); vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } /* VBox snapshots do not require libvirt to maintain any metadata. */ if (flags & VIR_DOMAIN_SNAPSHOT_LIST_METADATA) { ret = 0; goto cleanup; } rc = machine->vtbl->GetSnapshotCount(machine, &snapshotCount); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get snapshot count for domain %s"), dom->name); goto cleanup; } /* VBox has at most one root snapshot. */ if (snapshotCount && (flags & VIR_DOMAIN_SNAPSHOT_LIST_ROOTS)) ret = 1; else ret = snapshotCount; cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainSnapshotListNames(virDomainPtr dom, char **names, int nameslen, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxIID iid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; nsresult rc; ISnapshot **snapshots = NULL; int count = 0; size_t i; virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_ROOTS | VIR_DOMAIN_SNAPSHOT_LIST_METADATA, -1); vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } if (flags & VIR_DOMAIN_SNAPSHOT_LIST_METADATA) { ret = 0; goto cleanup; } if (flags & VIR_DOMAIN_SNAPSHOT_LIST_ROOTS) { vboxIID empty = VBOX_IID_INITIALIZER; if (VIR_ALLOC_N(snapshots, 1) < 0) goto cleanup; #if VBOX_API_VERSION < 4000 rc = machine->vtbl->GetSnapshot(machine, empty.value, snapshots); #else /* VBOX_API_VERSION >= 4000 */ rc = machine->vtbl->FindSnapshot(machine, empty.value, snapshots); #endif /* VBOX_API_VERSION >= 4000 */ if (NS_FAILED(rc) || !snapshots[0]) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get root snapshot for domain %s"), dom->name); goto cleanup; } count = 1; } else { if ((count = vboxDomainSnapshotGetAll(dom, machine, &snapshots)) < 0) goto cleanup; } for (i = 0; i < nameslen; i++) { PRUnichar *nameUtf16; char *name; if (i >= count) break; rc = snapshots[i]->vtbl->GetName(snapshots[i], &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get snapshot name")); goto cleanup; } VBOX_UTF16_TO_UTF8(nameUtf16, &name); VBOX_UTF16_FREE(nameUtf16); if (VIR_STRDUP(names[i], name) < 0) { VBOX_UTF8_FREE(name); goto cleanup; } VBOX_UTF8_FREE(name); } if (count <= nameslen) ret = count; else ret = nameslen; cleanup: if (count > 0) { for (i = 0; i < count; i++) VBOX_RELEASE(snapshots[i]); } VIR_FREE(snapshots); VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static virDomainSnapshotPtr vboxDomainSnapshotLookupByName(virDomainPtr dom, const char *name, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, virDomainSnapshotPtr, NULL); vboxIID iid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; ISnapshot *snapshot = NULL; nsresult rc; virCheckFlags(0, NULL); vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } if (!(snapshot = vboxDomainSnapshotGet(data, dom, machine, name))) goto cleanup; ret = virGetDomainSnapshot(dom, name); cleanup: VBOX_RELEASE(snapshot); VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainHasCurrentSnapshot(virDomainPtr dom, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxIID iid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; ISnapshot *snapshot = NULL; nsresult rc; virCheckFlags(0, -1); vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } rc = machine->vtbl->GetCurrentSnapshot(machine, &snapshot); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get current snapshot")); goto cleanup; } if (snapshot) ret = 1; else ret = 0; cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static virDomainSnapshotPtr vboxDomainSnapshotGetParent(virDomainSnapshotPtr snapshot, unsigned int flags) { virDomainPtr dom = snapshot->domain; VBOX_OBJECT_CHECK(dom->conn, virDomainSnapshotPtr, NULL); vboxIID iid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; ISnapshot *snap = NULL; ISnapshot *parent = NULL; PRUnichar *nameUtf16 = NULL; char *name = NULL; nsresult rc; virCheckFlags(0, NULL); vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } if (!(snap = vboxDomainSnapshotGet(data, dom, machine, snapshot->name))) goto cleanup; rc = snap->vtbl->GetParent(snap, &parent); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get parent of snapshot %s"), snapshot->name); goto cleanup; } if (!parent) { virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, _("snapshot '%s' does not have a parent"), snapshot->name); goto cleanup; } rc = parent->vtbl->GetName(parent, &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get name of parent of snapshot %s"), snapshot->name); goto cleanup; } VBOX_UTF16_TO_UTF8(nameUtf16, &name); if (!name) { virReportOOMError(); goto cleanup; } ret = virGetDomainSnapshot(dom, name); cleanup: VBOX_UTF8_FREE(name); VBOX_UTF16_FREE(nameUtf16); VBOX_RELEASE(snap); VBOX_RELEASE(parent); VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static virDomainSnapshotPtr vboxDomainSnapshotCurrent(virDomainPtr dom, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, virDomainSnapshotPtr, NULL); vboxIID iid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; ISnapshot *snapshot = NULL; PRUnichar *nameUtf16 = NULL; char *name = NULL; nsresult rc; virCheckFlags(0, NULL); vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } rc = machine->vtbl->GetCurrentSnapshot(machine, &snapshot); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get current snapshot")); goto cleanup; } if (!snapshot) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain has no snapshots")); goto cleanup; } rc = snapshot->vtbl->GetName(snapshot, &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get current snapshot name")); goto cleanup; } VBOX_UTF16_TO_UTF8(nameUtf16, &name); if (!name) { virReportOOMError(); goto cleanup; } ret = virGetDomainSnapshot(dom, name); cleanup: VBOX_UTF8_FREE(name); VBOX_UTF16_FREE(nameUtf16); VBOX_RELEASE(snapshot); VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot, unsigned int flags) { virDomainPtr dom = snapshot->domain; VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxIID iid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; ISnapshot *snap = NULL; ISnapshot *current = NULL; PRUnichar *nameUtf16 = NULL; char *name = NULL; nsresult rc; virCheckFlags(0, -1); vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } if (!(snap = vboxDomainSnapshotGet(data, dom, machine, snapshot->name))) goto cleanup; rc = machine->vtbl->GetCurrentSnapshot(machine, &current); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get current snapshot")); goto cleanup; } if (!current) { ret = 0; goto cleanup; } rc = current->vtbl->GetName(current, &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get current snapshot name")); goto cleanup; } VBOX_UTF16_TO_UTF8(nameUtf16, &name); if (!name) { virReportOOMError(); goto cleanup; } ret = STREQ(snapshot->name, name); cleanup: VBOX_UTF8_FREE(name); VBOX_UTF16_FREE(nameUtf16); VBOX_RELEASE(snap); VBOX_RELEASE(current); VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot, unsigned int flags) { virDomainPtr dom = snapshot->domain; VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxIID iid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; ISnapshot *snap = NULL; nsresult rc; virCheckFlags(0, -1); vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } /* Check that snapshot exists. If so, there is no metadata. */ if (!(snap = vboxDomainSnapshotGet(data, dom, machine, snapshot->name))) goto cleanup; ret = 0; cleanup: VBOX_RELEASE(snap); VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } #if VBOX_API_VERSION < 3001 static int vboxDomainSnapshotRestore(virDomainPtr dom, IMachine *machine, ISnapshot *snapshot) { VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxIID iid = VBOX_IID_INITIALIZER; nsresult rc; rc = snapshot->vtbl->GetId(snapshot, &iid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get snapshot UUID")); goto cleanup; } rc = machine->vtbl->SetCurrentSnapshot(machine, iid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not restore snapshot for domain %s"), dom->name); goto cleanup; } ret = 0; cleanup: vboxIIDUnalloc(&iid); return ret; } #else static int vboxDomainSnapshotRestore(virDomainPtr dom, IMachine *machine, ISnapshot *snapshot) { VBOX_OBJECT_CHECK(dom->conn, int, -1); IConsole *console = NULL; IProgress *progress = NULL; PRUint32 state; nsresult rc; PRInt32 result; vboxIID domiid = VBOX_IID_INITIALIZER; rc = machine->vtbl->GetId(machine, &domiid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get domain UUID")); goto cleanup; } rc = machine->vtbl->GetState(machine, &state); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get domain state")); goto cleanup; } if (state >= MachineState_FirstOnline && state <= MachineState_LastOnline) { virReportError(VIR_ERR_OPERATION_INVALID, _("domain %s is already running"), dom->name); goto cleanup; } rc = VBOX_SESSION_OPEN(domiid.value, machine); if (NS_SUCCEEDED(rc)) rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not open VirtualBox session with domain %s"), dom->name); goto cleanup; } rc = console->vtbl->RestoreSnapshot(console, snapshot, &progress); if (NS_FAILED(rc) || !progress) { if (rc == VBOX_E_INVALID_VM_STATE) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot restore domain snapshot for running domain")); } else { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not restore snapshot for domain %s"), dom->name); } goto cleanup; } progress->vtbl->WaitForCompletion(progress, -1); progress->vtbl->GetResultCode(progress, &result); if (NS_FAILED(result)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not restore snapshot for domain %s"), dom->name); goto cleanup; } ret = 0; cleanup: VBOX_RELEASE(progress); VBOX_RELEASE(console); VBOX_SESSION_CLOSE(); vboxIIDUnalloc(&domiid); return ret; } #endif static int vboxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, unsigned int flags) { virDomainPtr dom = snapshot->domain; VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxIID domiid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; ISnapshot *newSnapshot = NULL; ISnapshot *prevSnapshot = NULL; PRBool online = PR_FALSE; PRUint32 state; nsresult rc; virCheckFlags(0, -1); vboxIIDFromUUID(&domiid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } newSnapshot = vboxDomainSnapshotGet(data, dom, machine, snapshot->name); if (!newSnapshot) goto cleanup; rc = newSnapshot->vtbl->GetOnline(newSnapshot, &online); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get online state of snapshot %s"), snapshot->name); goto cleanup; } rc = machine->vtbl->GetCurrentSnapshot(machine, &prevSnapshot); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get current snapshot of domain %s"), dom->name); goto cleanup; } rc = machine->vtbl->GetState(machine, &state); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get domain state")); goto cleanup; } if (state >= MachineState_FirstOnline && state <= MachineState_LastOnline) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot revert snapshot of running domain")); goto cleanup; } if (vboxDomainSnapshotRestore(dom, machine, newSnapshot)) goto cleanup; if (online) { ret = vboxDomainCreate(dom); if (!ret) vboxDomainSnapshotRestore(dom, machine, prevSnapshot); } else ret = 0; cleanup: VBOX_RELEASE(prevSnapshot); VBOX_RELEASE(newSnapshot); vboxIIDUnalloc(&domiid); return ret; } static int vboxDomainSnapshotDeleteSingle(vboxGlobalData *data, IConsole *console, ISnapshot *snapshot) { IProgress *progress = NULL; vboxIID iid = VBOX_IID_INITIALIZER; int ret = -1; nsresult rc; #if VBOX_API_VERSION == 2002 nsresult result; #else PRInt32 result; #endif rc = snapshot->vtbl->GetId(snapshot, &iid.value); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get snapshot UUID")); goto cleanup; } #if VBOX_API_VERSION < 3001 rc = console->vtbl->DiscardSnapshot(console, iid.value, &progress); #else rc = console->vtbl->DeleteSnapshot(console, iid.value, &progress); #endif if (NS_FAILED(rc) || !progress) { if (rc == VBOX_E_INVALID_VM_STATE) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot delete domain snapshot for running domain")); } else { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not delete snapshot")); } goto cleanup; } progress->vtbl->WaitForCompletion(progress, -1); progress->vtbl->GetResultCode(progress, &result); if (NS_FAILED(result)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not delete snapshot")); goto cleanup; } ret = 0; cleanup: VBOX_RELEASE(progress); vboxIIDUnalloc(&iid); return ret; } static int vboxDomainSnapshotDeleteTree(vboxGlobalData *data, IConsole *console, ISnapshot *snapshot) { vboxArray children = VBOX_ARRAY_INITIALIZER; int ret = -1; nsresult rc; size_t i; rc = vboxArrayGet(&children, snapshot, snapshot->vtbl->GetChildren); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get children snapshots")); goto cleanup; } for (i = 0; i < children.count; i++) { if (vboxDomainSnapshotDeleteTree(data, console, children.items[i])) goto cleanup; } ret = vboxDomainSnapshotDeleteSingle(data, console, snapshot); cleanup: vboxArrayRelease(&children); return ret; } static int vboxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, unsigned int flags) { virDomainPtr dom = snapshot->domain; VBOX_OBJECT_CHECK(dom->conn, int, -1); vboxIID domiid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; ISnapshot *snap = NULL; IConsole *console = NULL; PRUint32 state; nsresult rc; virCheckFlags(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN | VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY, -1); vboxIIDFromUUID(&domiid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching UUID")); goto cleanup; } snap = vboxDomainSnapshotGet(data, dom, machine, snapshot->name); if (!snap) goto cleanup; rc = machine->vtbl->GetState(machine, &state); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get domain state")); goto cleanup; } /* VBOX snapshots do not require any libvirt metadata, making this * flag trivial once we know we have a valid snapshot. */ if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY) { ret = 0; goto cleanup; } if (state >= MachineState_FirstOnline && state <= MachineState_LastOnline) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot delete snapshots of running domain")); goto cleanup; } rc = VBOX_SESSION_OPEN(domiid.value, machine); if (NS_SUCCEEDED(rc)) rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("could not open VirtualBox session with domain %s"), dom->name); goto cleanup; } if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN) ret = vboxDomainSnapshotDeleteTree(data, console, snap); else ret = vboxDomainSnapshotDeleteSingle(data, console, snap); cleanup: VBOX_RELEASE(console); VBOX_RELEASE(snap); vboxIIDUnalloc(&domiid); VBOX_SESSION_CLOSE(); return ret; } #if VBOX_API_VERSION <= 2002 || VBOX_API_VERSION >= 4000 /* No Callback support for VirtualBox 2.2.* series */ /* No Callback support for VirtualBox 4.* series */ #else /* !(VBOX_API_VERSION == 2002 || VBOX_API_VERSION >= 4000) */ /* Functions needed for Callbacks */ static nsresult PR_COM_METHOD vboxCallbackOnMachineStateChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, PRUnichar *machineId, PRUint32 state) { virDomainPtr dom = NULL; int event = 0; int detail = 0; vboxDriverLock(g_pVBoxGlobalData); VIR_DEBUG("IVirtualBoxCallback: %p, State: %d", pThis, state); DEBUGPRUnichar("machineId", machineId); if (machineId) { char *machineIdUtf8 = NULL; unsigned char uuid[VIR_UUID_BUFLEN]; g_pVBoxGlobalData->pFuncs->pfnUtf16ToUtf8(machineId, &machineIdUtf8); ignore_value(virUUIDParse(machineIdUtf8, uuid)); dom = vboxDomainLookupByUUID(g_pVBoxGlobalData->conn, uuid); if (dom) { virObjectEventPtr ev; if (state == MachineState_Starting) { event = VIR_DOMAIN_EVENT_STARTED; detail = VIR_DOMAIN_EVENT_STARTED_BOOTED; } else if (state == MachineState_Restoring) { event = VIR_DOMAIN_EVENT_STARTED; detail = VIR_DOMAIN_EVENT_STARTED_RESTORED; } else if (state == MachineState_Paused) { event = VIR_DOMAIN_EVENT_SUSPENDED; detail = VIR_DOMAIN_EVENT_SUSPENDED_PAUSED; } else if (state == MachineState_Running) { event = VIR_DOMAIN_EVENT_RESUMED; detail = VIR_DOMAIN_EVENT_RESUMED_UNPAUSED; } else if (state == MachineState_PoweredOff) { event = VIR_DOMAIN_EVENT_STOPPED; detail = VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN; } else if (state == MachineState_Stopping) { event = VIR_DOMAIN_EVENT_STOPPED; detail = VIR_DOMAIN_EVENT_STOPPED_DESTROYED; } else if (state == MachineState_Aborted) { event = VIR_DOMAIN_EVENT_STOPPED; detail = VIR_DOMAIN_EVENT_STOPPED_CRASHED; } else if (state == MachineState_Saving) { event = VIR_DOMAIN_EVENT_STOPPED; detail = VIR_DOMAIN_EVENT_STOPPED_SAVED; } else { event = VIR_DOMAIN_EVENT_STOPPED; detail = VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN; } ev = virDomainEventLifecycleNewFromDom(dom, event, detail); if (ev) virObjectEventStateQueue(g_pVBoxGlobalData->domainEvents, ev); } } vboxDriverUnlock(g_pVBoxGlobalData); return NS_OK; } static nsresult PR_COM_METHOD vboxCallbackOnMachineDataChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, PRUnichar *machineId) { VIR_DEBUG("IVirtualBoxCallback: %p", pThis); DEBUGPRUnichar("machineId", machineId); return NS_OK; } static nsresult PR_COM_METHOD vboxCallbackOnExtraDataCanChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, PRUnichar *machineId, PRUnichar *key, PRUnichar *value, PRUnichar **error ATTRIBUTE_UNUSED, PRBool *allowChange ATTRIBUTE_UNUSED) { VIR_DEBUG("IVirtualBoxCallback: %p, allowChange: %s", pThis, *allowChange ? "true" : "false"); DEBUGPRUnichar("machineId", machineId); DEBUGPRUnichar("key", key); DEBUGPRUnichar("value", value); return NS_OK; } static nsresult PR_COM_METHOD vboxCallbackOnExtraDataChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, PRUnichar *machineId, PRUnichar *key, PRUnichar *value) { VIR_DEBUG("IVirtualBoxCallback: %p", pThis); DEBUGPRUnichar("machineId", machineId); DEBUGPRUnichar("key", key); DEBUGPRUnichar("value", value); return NS_OK; } # if VBOX_API_VERSION < 3001 static nsresult PR_COM_METHOD vboxCallbackOnMediaRegistered(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, PRUnichar *mediaId, PRUint32 mediaType ATTRIBUTE_UNUSED, PRBool registered ATTRIBUTE_UNUSED) { VIR_DEBUG("IVirtualBoxCallback: %p, registered: %s", pThis, registered ? "true" : "false"); VIR_DEBUG("mediaType: %d", mediaType); DEBUGPRUnichar("mediaId", mediaId); return NS_OK; } # else /* VBOX_API_VERSION >= 3001 */ # endif /* VBOX_API_VERSION >= 3001 */ static nsresult PR_COM_METHOD vboxCallbackOnMachineRegistered(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, PRUnichar *machineId, PRBool registered) { virDomainPtr dom = NULL; int event = 0; int detail = 0; vboxDriverLock(g_pVBoxGlobalData); VIR_DEBUG("IVirtualBoxCallback: %p, registered: %s", pThis, registered ? "true" : "false"); DEBUGPRUnichar("machineId", machineId); if (machineId) { char *machineIdUtf8 = NULL; unsigned char uuid[VIR_UUID_BUFLEN]; g_pVBoxGlobalData->pFuncs->pfnUtf16ToUtf8(machineId, &machineIdUtf8); ignore_value(virUUIDParse(machineIdUtf8, uuid)); dom = vboxDomainLookupByUUID(g_pVBoxGlobalData->conn, uuid); if (dom) { virObjectEventPtr ev; /* CURRENT LIMITATION: we never get the VIR_DOMAIN_EVENT_UNDEFINED * event because the when the machine is de-registered the call * to vboxDomainLookupByUUID fails and thus we don't get any * dom pointer which is necessary (null dom pointer doesn't work) * to show the VIR_DOMAIN_EVENT_UNDEFINED event */ if (registered) { event = VIR_DOMAIN_EVENT_DEFINED; detail = VIR_DOMAIN_EVENT_DEFINED_ADDED; } else { event = VIR_DOMAIN_EVENT_UNDEFINED; detail = VIR_DOMAIN_EVENT_UNDEFINED_REMOVED; } ev = virDomainEventLifecycleNewFromDom(dom, event, detail); if (ev) virObjectEventStateQueue(g_pVBoxGlobalData->domainEvents, ev); } } vboxDriverUnlock(g_pVBoxGlobalData); return NS_OK; } static nsresult PR_COM_METHOD vboxCallbackOnSessionStateChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, PRUnichar *machineId, PRUint32 state ATTRIBUTE_UNUSED) { VIR_DEBUG("IVirtualBoxCallback: %p, state: %d", pThis, state); DEBUGPRUnichar("machineId", machineId); return NS_OK; } static nsresult PR_COM_METHOD vboxCallbackOnSnapshotTaken(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, PRUnichar *machineId, PRUnichar *snapshotId) { VIR_DEBUG("IVirtualBoxCallback: %p", pThis); DEBUGPRUnichar("machineId", machineId); DEBUGPRUnichar("snapshotId", snapshotId); return NS_OK; } static nsresult PR_COM_METHOD vboxCallbackOnSnapshotDiscarded(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, PRUnichar *machineId, PRUnichar *snapshotId) { VIR_DEBUG("IVirtualBoxCallback: %p", pThis); DEBUGPRUnichar("machineId", machineId); DEBUGPRUnichar("snapshotId", snapshotId); return NS_OK; } static nsresult PR_COM_METHOD vboxCallbackOnSnapshotChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, PRUnichar *machineId, PRUnichar *snapshotId) { VIR_DEBUG("IVirtualBoxCallback: %p", pThis); DEBUGPRUnichar("machineId", machineId); DEBUGPRUnichar("snapshotId", snapshotId); return NS_OK; } static nsresult PR_COM_METHOD vboxCallbackOnGuestPropertyChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, PRUnichar *machineId, PRUnichar *name, PRUnichar *value, PRUnichar *flags) { VIR_DEBUG("IVirtualBoxCallback: %p", pThis); DEBUGPRUnichar("machineId", machineId); DEBUGPRUnichar("name", name); DEBUGPRUnichar("value", value); DEBUGPRUnichar("flags", flags); return NS_OK; } static nsresult PR_COM_METHOD vboxCallbackAddRef(nsISupports *pThis ATTRIBUTE_UNUSED) { nsresult c; c = ++g_pVBoxGlobalData->vboxCallBackRefCount; VIR_DEBUG("pThis: %p, vboxCallback AddRef: %d", pThis, c); return c; } static nsresult PR_COM_METHOD vboxCallbackRelease(nsISupports *pThis) { nsresult c; c = --g_pVBoxGlobalData->vboxCallBackRefCount; if (c == 0) { /* delete object */ VIR_FREE(pThis->vtbl); VIR_FREE(pThis); } VIR_DEBUG("pThis: %p, vboxCallback Release: %d", pThis, c); return c; } static nsresult PR_COM_METHOD vboxCallbackQueryInterface(nsISupports *pThis, const nsID *iid, void **resultp) { IVirtualBoxCallback *that = (IVirtualBoxCallback *)pThis; static const nsID ivirtualboxCallbackUUID = IVIRTUALBOXCALLBACK_IID; static const nsID isupportIID = NS_ISUPPORTS_IID; /* Match UUID for IVirtualBoxCallback class */ if (memcmp(iid, &ivirtualboxCallbackUUID, sizeof(nsID)) == 0 || memcmp(iid, &isupportIID, sizeof(nsID)) == 0) { g_pVBoxGlobalData->vboxCallBackRefCount++; *resultp = that; VIR_DEBUG("pThis: %p, vboxCallback QueryInterface: %d", pThis, g_pVBoxGlobalData->vboxCallBackRefCount); return NS_OK; } VIR_DEBUG("pThis: %p, vboxCallback QueryInterface didn't find a matching interface", pThis); DEBUGUUID("The UUID Callback Interface expects", iid); DEBUGUUID("The UUID Callback Interface got", &ivirtualboxCallbackUUID); return NS_NOINTERFACE; } static IVirtualBoxCallback *vboxAllocCallbackObj(void) { IVirtualBoxCallback *vboxCallback = NULL; /* Allocate, Initialize and return a valid * IVirtualBoxCallback object here */ if ((VIR_ALLOC(vboxCallback) < 0) || (VIR_ALLOC(vboxCallback->vtbl) < 0)) { VIR_FREE(vboxCallback); return NULL; } { vboxCallback->vtbl->nsisupports.AddRef = &vboxCallbackAddRef; vboxCallback->vtbl->nsisupports.Release = &vboxCallbackRelease; vboxCallback->vtbl->nsisupports.QueryInterface = &vboxCallbackQueryInterface; vboxCallback->vtbl->OnMachineStateChange = &vboxCallbackOnMachineStateChange; vboxCallback->vtbl->OnMachineDataChange = &vboxCallbackOnMachineDataChange; vboxCallback->vtbl->OnExtraDataCanChange = &vboxCallbackOnExtraDataCanChange; vboxCallback->vtbl->OnExtraDataChange = &vboxCallbackOnExtraDataChange; # if VBOX_API_VERSION < 3001 vboxCallback->vtbl->OnMediaRegistered = &vboxCallbackOnMediaRegistered; # else /* VBOX_API_VERSION >= 3001 */ # endif /* VBOX_API_VERSION >= 3001 */ vboxCallback->vtbl->OnMachineRegistered = &vboxCallbackOnMachineRegistered; vboxCallback->vtbl->OnSessionStateChange = &vboxCallbackOnSessionStateChange; vboxCallback->vtbl->OnSnapshotTaken = &vboxCallbackOnSnapshotTaken; # if VBOX_API_VERSION < 3002 vboxCallback->vtbl->OnSnapshotDiscarded = &vboxCallbackOnSnapshotDiscarded; # else /* VBOX_API_VERSION >= 3002 */ vboxCallback->vtbl->OnSnapshotDeleted = &vboxCallbackOnSnapshotDiscarded; # endif /* VBOX_API_VERSION >= 3002 */ vboxCallback->vtbl->OnSnapshotChange = &vboxCallbackOnSnapshotChange; vboxCallback->vtbl->OnGuestPropertyChange = &vboxCallbackOnGuestPropertyChange; g_pVBoxGlobalData->vboxCallBackRefCount = 1; } return vboxCallback; } static void vboxReadCallback(int watch ATTRIBUTE_UNUSED, int fd, int events ATTRIBUTE_UNUSED, void *opaque ATTRIBUTE_UNUSED) { if (fd >= 0) { g_pVBoxGlobalData->vboxQueue->vtbl->ProcessPendingEvents(g_pVBoxGlobalData->vboxQueue); } else { nsresult rc; PLEvent *pEvent = NULL; rc = g_pVBoxGlobalData->vboxQueue->vtbl->WaitForEvent(g_pVBoxGlobalData->vboxQueue, &pEvent); if (NS_SUCCEEDED(rc)) g_pVBoxGlobalData->vboxQueue->vtbl->HandleEvent(g_pVBoxGlobalData->vboxQueue, pEvent); } } static int vboxConnectDomainEventRegister(virConnectPtr conn, virConnectDomainEventCallback callback, void *opaque, virFreeCallback freecb) { VBOX_OBJECT_CHECK(conn, int, -1); int vboxRet = -1; nsresult rc; /* Locking has to be there as callbacks are not * really fully thread safe */ vboxDriverLock(data); if (data->vboxCallback == NULL) { data->vboxCallback = vboxAllocCallbackObj(); if (data->vboxCallback != NULL) { rc = data->vboxObj->vtbl->RegisterCallback(data->vboxObj, data->vboxCallback); if (NS_SUCCEEDED(rc)) { vboxRet = 0; } } } else { vboxRet = 0; } /* Get the vbox file handle and add a event handle to it * so that the events can be passed down to the user */ if (vboxRet == 0) { if (data->fdWatch < 0) { PRInt32 vboxFileHandle; vboxFileHandle = data->vboxQueue->vtbl->GetEventQueueSelectFD(data->vboxQueue); data->fdWatch = virEventAddHandle(vboxFileHandle, VIR_EVENT_HANDLE_READABLE, vboxReadCallback, NULL, NULL); } if (data->fdWatch >= 0) { /* Once a callback is registered with virtualbox, use a list * to store the callbacks registered with libvirt so that * later you can iterate over them */ ret = virDomainEventStateRegister(conn, data->domainEvents, callback, opaque, freecb); VIR_DEBUG("virObjectEventStateRegister (ret = %d) (conn: %p, " "callback: %p, opaque: %p, " "freecb: %p)", ret, conn, callback, opaque, freecb); } } vboxDriverUnlock(data); if (ret >= 0) { return ret; } else { if (data->vboxObj && data->vboxCallback) { data->vboxObj->vtbl->UnregisterCallback(data->vboxObj, data->vboxCallback); } return -1; } } static int vboxConnectDomainEventDeregister(virConnectPtr conn, virConnectDomainEventCallback callback) { VBOX_OBJECT_CHECK(conn, int, -1); int cnt; /* Locking has to be there as callbacks are not * really fully thread safe */ vboxDriverLock(data); cnt = virDomainEventStateDeregister(conn, data->domainEvents, callback); if (data->vboxCallback && cnt == 0) { data->vboxObj->vtbl->UnregisterCallback(data->vboxObj, data->vboxCallback); VBOX_RELEASE(data->vboxCallback); /* Remove the Event file handle on which we are listening as well */ virEventRemoveHandle(data->fdWatch); data->fdWatch = -1; } vboxDriverUnlock(data); return ret; } static int vboxConnectDomainEventRegisterAny(virConnectPtr conn, virDomainPtr dom, int eventID, virConnectDomainEventGenericCallback callback, void *opaque, virFreeCallback freecb) { VBOX_OBJECT_CHECK(conn, int, -1); int vboxRet = -1; nsresult rc; /* Locking has to be there as callbacks are not * really fully thread safe */ vboxDriverLock(data); if (data->vboxCallback == NULL) { data->vboxCallback = vboxAllocCallbackObj(); if (data->vboxCallback != NULL) { rc = data->vboxObj->vtbl->RegisterCallback(data->vboxObj, data->vboxCallback); if (NS_SUCCEEDED(rc)) { vboxRet = 0; } } } else { vboxRet = 0; } /* Get the vbox file handle and add a event handle to it * so that the events can be passed down to the user */ if (vboxRet == 0) { if (data->fdWatch < 0) { PRInt32 vboxFileHandle; vboxFileHandle = data->vboxQueue->vtbl->GetEventQueueSelectFD(data->vboxQueue); data->fdWatch = virEventAddHandle(vboxFileHandle, VIR_EVENT_HANDLE_READABLE, vboxReadCallback, NULL, NULL); } if (data->fdWatch >= 0) { /* Once a callback is registered with virtualbox, use a list * to store the callbacks registered with libvirt so that * later you can iterate over them */ if (virDomainEventStateRegisterID(conn, data->domainEvents, dom, eventID, callback, opaque, freecb, &ret) < 0) ret = -1; VIR_DEBUG("virDomainEventStateRegisterID (ret = %d) (conn: %p, " "callback: %p, opaque: %p, " "freecb: %p)", ret, conn, callback, opaque, freecb); } } vboxDriverUnlock(data); if (ret >= 0) { return ret; } else { if (data->vboxObj && data->vboxCallback) { data->vboxObj->vtbl->UnregisterCallback(data->vboxObj, data->vboxCallback); } return -1; } } static int vboxConnectDomainEventDeregisterAny(virConnectPtr conn, int callbackID) { VBOX_OBJECT_CHECK(conn, int, -1); int cnt; /* Locking has to be there as callbacks are not * really fully thread safe */ vboxDriverLock(data); cnt = virObjectEventStateDeregisterID(conn, data->domainEvents, callbackID); if (data->vboxCallback && cnt == 0) { data->vboxObj->vtbl->UnregisterCallback(data->vboxObj, data->vboxCallback); VBOX_RELEASE(data->vboxCallback); /* Remove the Event file handle on which we are listening as well */ virEventRemoveHandle(data->fdWatch); data->fdWatch = -1; } vboxDriverUnlock(data); return ret; } #endif /* !(VBOX_API_VERSION == 2002 || VBOX_API_VERSION >= 4000) */ /** * The Network Functions here on */ static virDrvOpenStatus vboxNetworkOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED, unsigned int flags) { vboxGlobalData *data = conn->privateData; virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); if (STRNEQ(conn->driver->name, "VBOX")) goto cleanup; if ((data->pFuncs == NULL) || (data->vboxObj == NULL) || (data->vboxSession == NULL)) goto cleanup; VIR_DEBUG("network initialized"); /* conn->networkPrivateData = some network specific data */ return VIR_DRV_OPEN_SUCCESS; cleanup: return VIR_DRV_OPEN_DECLINED; } static int vboxNetworkClose(virConnectPtr conn) { VIR_DEBUG("network uninitialized"); conn->networkPrivateData = NULL; return 0; } static int vboxConnectNumOfNetworks(virConnectPtr conn) { VBOX_OBJECT_HOST_CHECK(conn, int, 0); vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER; size_t i = 0; vboxArrayGet(&networkInterfaces, host, host->vtbl->GetNetworkInterfaces); for (i = 0; i < networkInterfaces.count; i++) { IHostNetworkInterface *networkInterface = networkInterfaces.items[i]; if (networkInterface) { PRUint32 interfaceType = 0; networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType); if (interfaceType == HostNetworkInterfaceType_HostOnly) { PRUint32 status = HostNetworkInterfaceStatus_Unknown; networkInterface->vtbl->GetStatus(networkInterface, &status); if (status == HostNetworkInterfaceStatus_Up) ret++; } } } vboxArrayRelease(&networkInterfaces); VBOX_RELEASE(host); VIR_DEBUG("numActive: %d", ret); return ret; } static int vboxConnectListNetworks(virConnectPtr conn, char **const names, int nnames) { VBOX_OBJECT_HOST_CHECK(conn, int, 0); vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER; size_t i = 0; vboxArrayGet(&networkInterfaces, host, host->vtbl->GetNetworkInterfaces); for (i = 0; (ret < nnames) && (i < networkInterfaces.count); i++) { IHostNetworkInterface *networkInterface = networkInterfaces.items[i]; if (networkInterface) { PRUint32 interfaceType = 0; networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType); if (interfaceType == HostNetworkInterfaceType_HostOnly) { PRUint32 status = HostNetworkInterfaceStatus_Unknown; networkInterface->vtbl->GetStatus(networkInterface, &status); if (status == HostNetworkInterfaceStatus_Up) { char *nameUtf8 = NULL; PRUnichar *nameUtf16 = NULL; networkInterface->vtbl->GetName(networkInterface, &nameUtf16); VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8); VIR_DEBUG("nnames[%d]: %s", ret, nameUtf8); if (VIR_STRDUP(names[ret], nameUtf8) >= 0) ret++; VBOX_UTF8_FREE(nameUtf8); VBOX_UTF16_FREE(nameUtf16); } } } } vboxArrayRelease(&networkInterfaces); VBOX_RELEASE(host); return ret; } static int vboxConnectNumOfDefinedNetworks(virConnectPtr conn) { VBOX_OBJECT_HOST_CHECK(conn, int, 0); vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER; size_t i = 0; vboxArrayGet(&networkInterfaces, host, host->vtbl->GetNetworkInterfaces); for (i = 0; i < networkInterfaces.count; i++) { IHostNetworkInterface *networkInterface = networkInterfaces.items[i]; if (networkInterface) { PRUint32 interfaceType = 0; networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType); if (interfaceType == HostNetworkInterfaceType_HostOnly) { PRUint32 status = HostNetworkInterfaceStatus_Unknown; networkInterface->vtbl->GetStatus(networkInterface, &status); if (status == HostNetworkInterfaceStatus_Down) ret++; } } } vboxArrayRelease(&networkInterfaces); VBOX_RELEASE(host); VIR_DEBUG("numActive: %d", ret); return ret; } static int vboxConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames) { VBOX_OBJECT_HOST_CHECK(conn, int, 0); vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER; size_t i = 0; vboxArrayGet(&networkInterfaces, host, host->vtbl->GetNetworkInterfaces); for (i = 0; (ret < nnames) && (i < networkInterfaces.count); i++) { IHostNetworkInterface *networkInterface = networkInterfaces.items[i]; if (networkInterface) { PRUint32 interfaceType = 0; networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType); if (interfaceType == HostNetworkInterfaceType_HostOnly) { PRUint32 status = HostNetworkInterfaceStatus_Unknown; networkInterface->vtbl->GetStatus(networkInterface, &status); if (status == HostNetworkInterfaceStatus_Down) { char *nameUtf8 = NULL; PRUnichar *nameUtf16 = NULL; networkInterface->vtbl->GetName(networkInterface, &nameUtf16); VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8); VIR_DEBUG("nnames[%d]: %s", ret, nameUtf8); if (VIR_STRDUP(names[ret], nameUtf8) >= 0) ret++; VBOX_UTF8_FREE(nameUtf8); VBOX_UTF16_FREE(nameUtf16); } } } } vboxArrayRelease(&networkInterfaces); VBOX_RELEASE(host); return ret; } static virNetworkPtr vboxNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid) { VBOX_OBJECT_HOST_CHECK(conn, virNetworkPtr, NULL); vboxIID iid = VBOX_IID_INITIALIZER; vboxIIDFromUUID(&iid, uuid); /* TODO: "internal" networks are just strings and * thus can't do much with them */ IHostNetworkInterface *networkInterface = NULL; host->vtbl->FindHostNetworkInterfaceById(host, iid.value, &networkInterface); if (networkInterface) { PRUint32 interfaceType = 0; networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType); if (interfaceType == HostNetworkInterfaceType_HostOnly) { char *nameUtf8 = NULL; PRUnichar *nameUtf16 = NULL; networkInterface->vtbl->GetName(networkInterface, &nameUtf16); VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8); ret = virGetNetwork(conn, nameUtf8, uuid); VIR_DEBUG("Network Name: %s", nameUtf8); DEBUGIID("Network UUID", iid.value); VBOX_UTF8_FREE(nameUtf8); VBOX_UTF16_FREE(nameUtf16); } VBOX_RELEASE(networkInterface); } VBOX_RELEASE(host); vboxIIDUnalloc(&iid); return ret; } static virNetworkPtr vboxNetworkLookupByName(virConnectPtr conn, const char *name) { VBOX_OBJECT_HOST_CHECK(conn, virNetworkPtr, NULL); PRUnichar *nameUtf16 = NULL; IHostNetworkInterface *networkInterface = NULL; VBOX_UTF8_TO_UTF16(name, &nameUtf16); host->vtbl->FindHostNetworkInterfaceByName(host, nameUtf16, &networkInterface); if (networkInterface) { PRUint32 interfaceType = 0; networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType); if (interfaceType == HostNetworkInterfaceType_HostOnly) { unsigned char uuid[VIR_UUID_BUFLEN]; vboxIID iid = VBOX_IID_INITIALIZER; networkInterface->vtbl->GetId(networkInterface, &iid.value); vboxIIDToUUID(&iid, uuid); ret = virGetNetwork(conn, name, uuid); VIR_DEBUG("Network Name: %s", name); DEBUGIID("Network UUID", iid.value); vboxIIDUnalloc(&iid); } VBOX_RELEASE(networkInterface); } VBOX_UTF16_FREE(nameUtf16); VBOX_RELEASE(host); return ret; } static virNetworkPtr vboxNetworkDefineCreateXML(virConnectPtr conn, const char *xml, bool start) { VBOX_OBJECT_HOST_CHECK(conn, virNetworkPtr, NULL); PRUnichar *networkInterfaceNameUtf16 = NULL; char *networkInterfaceNameUtf8 = NULL; IHostNetworkInterface *networkInterface = NULL; nsresult rc; virNetworkDefPtr def = virNetworkDefParseString(xml); virNetworkIpDefPtr ipdef; virSocketAddr netmask; if ((!def) || (def->forward.type != VIR_NETWORK_FORWARD_NONE) || (def->nips == 0 || !def->ips)) goto cleanup; /* Look for the first IPv4 IP address definition and use that. * If there weren't any IPv4 addresses, ignore the network (since it's * required below to have an IPv4 address) */ ipdef = virNetworkDefGetIpByIndex(def, AF_INET, 0); if (!ipdef) goto cleanup; if (virNetworkIpDefNetmask(ipdef, &netmask) < 0) goto cleanup; /* the current limitation of hostonly network is that you can't * assign a name to it and it defaults to vboxnet*, for e.g: * vboxnet0, vboxnet1, etc. Also the UUID is assigned to it * automatically depending on the mac address and thus both * these paramters are ignored here for now. */ #if VBOX_API_VERSION == 2002 if (STREQ(def->name, "vboxnet0")) { PRUint32 interfaceType = 0; VBOX_UTF8_TO_UTF16(def->name, &networkInterfaceNameUtf16); host->vtbl->FindHostNetworkInterfaceByName(host, networkInterfaceNameUtf16, &networkInterface); networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType); if (interfaceType != HostNetworkInterfaceType_HostOnly) { VBOX_RELEASE(networkInterface); networkInterface = NULL; } } #else /* VBOX_API_VERSION != 2002 */ { IProgress *progress = NULL; host->vtbl->CreateHostOnlyNetworkInterface(host, &networkInterface, &progress); if (progress) { progress->vtbl->WaitForCompletion(progress, -1); VBOX_RELEASE(progress); } } #endif /* VBOX_API_VERSION != 2002 */ if (networkInterface) { unsigned char uuid[VIR_UUID_BUFLEN]; char *networkNameUtf8 = NULL; PRUnichar *networkNameUtf16 = NULL; vboxIID vboxnetiid = VBOX_IID_INITIALIZER; networkInterface->vtbl->GetName(networkInterface, &networkInterfaceNameUtf16); if (networkInterfaceNameUtf16) { VBOX_UTF16_TO_UTF8(networkInterfaceNameUtf16, &networkInterfaceNameUtf8); if (virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s", networkInterfaceNameUtf8) < 0) { VBOX_RELEASE(host); VBOX_RELEASE(networkInterface); goto cleanup; } } VBOX_UTF8_TO_UTF16(networkNameUtf8, &networkNameUtf16); /* Currently support only one dhcp server per network * with contigious address space from start to end */ if ((ipdef->nranges >= 1) && VIR_SOCKET_ADDR_VALID(&ipdef->ranges[0].start) && VIR_SOCKET_ADDR_VALID(&ipdef->ranges[0].end)) { IDHCPServer *dhcpServer = NULL; data->vboxObj->vtbl->FindDHCPServerByNetworkName(data->vboxObj, networkNameUtf16, &dhcpServer); if (!dhcpServer) { /* create a dhcp server */ data->vboxObj->vtbl->CreateDHCPServer(data->vboxObj, networkNameUtf16, &dhcpServer); VIR_DEBUG("couldn't find dhcp server so creating one"); } if (dhcpServer) { PRUnichar *ipAddressUtf16 = NULL; PRUnichar *networkMaskUtf16 = NULL; PRUnichar *fromIPAddressUtf16 = NULL; PRUnichar *toIPAddressUtf16 = NULL; PRUnichar *trunkTypeUtf16 = NULL; ipAddressUtf16 = vboxSocketFormatAddrUtf16(data, &ipdef->address); networkMaskUtf16 = vboxSocketFormatAddrUtf16(data, &netmask); fromIPAddressUtf16 = vboxSocketFormatAddrUtf16(data, &ipdef->ranges[0].start); toIPAddressUtf16 = vboxSocketFormatAddrUtf16(data, &ipdef->ranges[0].end); if (ipAddressUtf16 == NULL || networkMaskUtf16 == NULL || fromIPAddressUtf16 == NULL || toIPAddressUtf16 == NULL) { VBOX_UTF16_FREE(ipAddressUtf16); VBOX_UTF16_FREE(networkMaskUtf16); VBOX_UTF16_FREE(fromIPAddressUtf16); VBOX_UTF16_FREE(toIPAddressUtf16); VBOX_RELEASE(dhcpServer); goto cleanup; } VBOX_UTF8_TO_UTF16("netflt", &trunkTypeUtf16); dhcpServer->vtbl->SetEnabled(dhcpServer, PR_TRUE); dhcpServer->vtbl->SetConfiguration(dhcpServer, ipAddressUtf16, networkMaskUtf16, fromIPAddressUtf16, toIPAddressUtf16); if (start) dhcpServer->vtbl->Start(dhcpServer, networkNameUtf16, networkInterfaceNameUtf16, trunkTypeUtf16); VBOX_UTF16_FREE(ipAddressUtf16); VBOX_UTF16_FREE(networkMaskUtf16); VBOX_UTF16_FREE(fromIPAddressUtf16); VBOX_UTF16_FREE(toIPAddressUtf16); VBOX_UTF16_FREE(trunkTypeUtf16); VBOX_RELEASE(dhcpServer); } } if ((ipdef->nhosts >= 1) && VIR_SOCKET_ADDR_VALID(&ipdef->hosts[0].ip)) { PRUnichar *ipAddressUtf16 = NULL; PRUnichar *networkMaskUtf16 = NULL; ipAddressUtf16 = vboxSocketFormatAddrUtf16(data, &ipdef->hosts[0].ip); networkMaskUtf16 = vboxSocketFormatAddrUtf16(data, &netmask); if (ipAddressUtf16 == NULL || networkMaskUtf16 == NULL) { VBOX_UTF16_FREE(ipAddressUtf16); VBOX_UTF16_FREE(networkMaskUtf16); goto cleanup; } /* Current drawback is that since EnableStaticIpConfig() sets * IP and enables the interface so even if the dhcpserver is not * started the interface is still up and running */ #if VBOX_API_VERSION < 4002 networkInterface->vtbl->EnableStaticIpConfig(networkInterface, ipAddressUtf16, networkMaskUtf16); #else networkInterface->vtbl->EnableStaticIPConfig(networkInterface, ipAddressUtf16, networkMaskUtf16); #endif VBOX_UTF16_FREE(ipAddressUtf16); VBOX_UTF16_FREE(networkMaskUtf16); } else { #if VBOX_API_VERSION < 4002 networkInterface->vtbl->EnableDynamicIpConfig(networkInterface); networkInterface->vtbl->DhcpRediscover(networkInterface); #else networkInterface->vtbl->EnableDynamicIPConfig(networkInterface); networkInterface->vtbl->DHCPRediscover(networkInterface); #endif } rc = networkInterface->vtbl->GetId(networkInterface, &vboxnetiid.value); if (NS_SUCCEEDED(rc)) { vboxIIDToUUID(&vboxnetiid, uuid); DEBUGIID("Real Network UUID", vboxnetiid.value); vboxIIDUnalloc(&vboxnetiid); ret = virGetNetwork(conn, networkInterfaceNameUtf8, uuid); } VIR_FREE(networkNameUtf8); VBOX_UTF16_FREE(networkNameUtf16); VBOX_RELEASE(networkInterface); } VBOX_UTF8_FREE(networkInterfaceNameUtf8); VBOX_UTF16_FREE(networkInterfaceNameUtf16); VBOX_RELEASE(host); cleanup: virNetworkDefFree(def); return ret; } static virNetworkPtr vboxNetworkCreateXML(virConnectPtr conn, const char *xml) { return vboxNetworkDefineCreateXML(conn, xml, true); } static virNetworkPtr vboxNetworkDefineXML(virConnectPtr conn, const char *xml) { return vboxNetworkDefineCreateXML(conn, xml, false); } static int vboxNetworkUndefineDestroy(virNetworkPtr network, bool removeinterface) { VBOX_OBJECT_HOST_CHECK(network->conn, int, -1); char *networkNameUtf8 = NULL; PRUnichar *networkInterfaceNameUtf16 = NULL; IHostNetworkInterface *networkInterface = NULL; /* Current limitation of the function for VirtualBox 2.2.* is * that you can't delete the default hostonly adaptor namely: * vboxnet0 and thus all this functions does is remove the * dhcp server configuration, but the network can still be used * by giving the machine static IP and also it will still * show up in the net-list in virsh */ if (virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s", network->name) < 0) goto cleanup; VBOX_UTF8_TO_UTF16(network->name, &networkInterfaceNameUtf16); host->vtbl->FindHostNetworkInterfaceByName(host, networkInterfaceNameUtf16, &networkInterface); if (networkInterface) { PRUint32 interfaceType = 0; networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType); if (interfaceType == HostNetworkInterfaceType_HostOnly) { PRUnichar *networkNameUtf16 = NULL; IDHCPServer *dhcpServer = NULL; #if VBOX_API_VERSION != 2002 if (removeinterface) { PRUnichar *iidUtf16 = NULL; IProgress *progress = NULL; networkInterface->vtbl->GetId(networkInterface, &iidUtf16); if (iidUtf16) { # if VBOX_API_VERSION == 3000 IHostNetworkInterface *netInt = NULL; host->vtbl->RemoveHostOnlyNetworkInterface(host, iidUtf16, &netInt, &progress); VBOX_RELEASE(netInt); # else /* VBOX_API_VERSION > 3000 */ host->vtbl->RemoveHostOnlyNetworkInterface(host, iidUtf16, &progress); # endif /* VBOX_API_VERSION > 3000 */ VBOX_UTF16_FREE(iidUtf16); } if (progress) { progress->vtbl->WaitForCompletion(progress, -1); VBOX_RELEASE(progress); } } #endif /* VBOX_API_VERSION != 2002 */ VBOX_UTF8_TO_UTF16(networkNameUtf8, &networkNameUtf16); data->vboxObj->vtbl->FindDHCPServerByNetworkName(data->vboxObj, networkNameUtf16, &dhcpServer); if (dhcpServer) { dhcpServer->vtbl->SetEnabled(dhcpServer, PR_FALSE); dhcpServer->vtbl->Stop(dhcpServer); if (removeinterface) data->vboxObj->vtbl->RemoveDHCPServer(data->vboxObj, dhcpServer); VBOX_RELEASE(dhcpServer); } VBOX_UTF16_FREE(networkNameUtf16); } VBOX_RELEASE(networkInterface); } VBOX_UTF16_FREE(networkInterfaceNameUtf16); VBOX_RELEASE(host); ret = 0; cleanup: VIR_FREE(networkNameUtf8); return ret; } static int vboxNetworkUndefine(virNetworkPtr network) { return vboxNetworkUndefineDestroy(network, true); } static int vboxNetworkCreate(virNetworkPtr network) { VBOX_OBJECT_HOST_CHECK(network->conn, int, -1); char *networkNameUtf8 = NULL; PRUnichar *networkInterfaceNameUtf16 = NULL; IHostNetworkInterface *networkInterface = NULL; /* Current limitation of the function for VirtualBox 2.2.* is * that the default hostonly network "vboxnet0" is always active * and thus all this functions does is start the dhcp server, * but the network can still be used without starting the dhcp * server by giving the machine static IP */ if (virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s", network->name) < 0) goto cleanup; VBOX_UTF8_TO_UTF16(network->name, &networkInterfaceNameUtf16); host->vtbl->FindHostNetworkInterfaceByName(host, networkInterfaceNameUtf16, &networkInterface); if (networkInterface) { PRUint32 interfaceType = 0; networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType); if (interfaceType == HostNetworkInterfaceType_HostOnly) { PRUnichar *networkNameUtf16 = NULL; IDHCPServer *dhcpServer = NULL; VBOX_UTF8_TO_UTF16(networkNameUtf8, &networkNameUtf16); data->vboxObj->vtbl->FindDHCPServerByNetworkName(data->vboxObj, networkNameUtf16, &dhcpServer); if (dhcpServer) { PRUnichar *trunkTypeUtf16 = NULL; dhcpServer->vtbl->SetEnabled(dhcpServer, PR_TRUE); VBOX_UTF8_TO_UTF16("netflt", &trunkTypeUtf16); dhcpServer->vtbl->Start(dhcpServer, networkNameUtf16, networkInterfaceNameUtf16, trunkTypeUtf16); VBOX_UTF16_FREE(trunkTypeUtf16); VBOX_RELEASE(dhcpServer); } VBOX_UTF16_FREE(networkNameUtf16); } VBOX_RELEASE(networkInterface); } VBOX_UTF16_FREE(networkInterfaceNameUtf16); VBOX_RELEASE(host); ret = 0; cleanup: VIR_FREE(networkNameUtf8); return ret; } static int vboxNetworkDestroy(virNetworkPtr network) { return vboxNetworkUndefineDestroy(network, false); } static char *vboxNetworkGetXMLDesc(virNetworkPtr network, unsigned int flags) { VBOX_OBJECT_HOST_CHECK(network->conn, char *, NULL); virNetworkDefPtr def = NULL; virNetworkIpDefPtr ipdef = NULL; char *networkNameUtf8 = NULL; PRUnichar *networkInterfaceNameUtf16 = NULL; IHostNetworkInterface *networkInterface = NULL; virCheckFlags(0, NULL); if (VIR_ALLOC(def) < 0) goto cleanup; if (VIR_ALLOC(ipdef) < 0) goto cleanup; def->ips = ipdef; def->nips = 1; if (virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s", network->name) < 0) goto cleanup; VBOX_UTF8_TO_UTF16(network->name, &networkInterfaceNameUtf16); host->vtbl->FindHostNetworkInterfaceByName(host, networkInterfaceNameUtf16, &networkInterface); if (networkInterface) { PRUint32 interfaceType = 0; networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType); if (interfaceType == HostNetworkInterfaceType_HostOnly) { if (VIR_STRDUP(def->name, network->name) >= 0) { PRUnichar *networkNameUtf16 = NULL; IDHCPServer *dhcpServer = NULL; vboxIID vboxnet0IID = VBOX_IID_INITIALIZER; networkInterface->vtbl->GetId(networkInterface, &vboxnet0IID.value); vboxIIDToUUID(&vboxnet0IID, def->uuid); VBOX_UTF8_TO_UTF16(networkNameUtf8, &networkNameUtf16); def->forward.type = VIR_NETWORK_FORWARD_NONE; data->vboxObj->vtbl->FindDHCPServerByNetworkName(data->vboxObj, networkNameUtf16, &dhcpServer); if (dhcpServer) { ipdef->nranges = 1; if (VIR_ALLOC_N(ipdef->ranges, ipdef->nranges) >=0) { PRUnichar *ipAddressUtf16 = NULL; PRUnichar *networkMaskUtf16 = NULL; PRUnichar *fromIPAddressUtf16 = NULL; PRUnichar *toIPAddressUtf16 = NULL; bool errorOccurred = false; dhcpServer->vtbl->GetIPAddress(dhcpServer, &ipAddressUtf16); dhcpServer->vtbl->GetNetworkMask(dhcpServer, &networkMaskUtf16); dhcpServer->vtbl->GetLowerIP(dhcpServer, &fromIPAddressUtf16); dhcpServer->vtbl->GetUpperIP(dhcpServer, &toIPAddressUtf16); /* Currently virtualbox supports only one dhcp server per network * with contigious address space from start to end */ if (vboxSocketParseAddrUtf16(data, ipAddressUtf16, &ipdef->address) < 0 || vboxSocketParseAddrUtf16(data, networkMaskUtf16, &ipdef->netmask) < 0 || vboxSocketParseAddrUtf16(data, fromIPAddressUtf16, &ipdef->ranges[0].start) < 0 || vboxSocketParseAddrUtf16(data, toIPAddressUtf16, &ipdef->ranges[0].end) < 0) { errorOccurred = true; } VBOX_UTF16_FREE(ipAddressUtf16); VBOX_UTF16_FREE(networkMaskUtf16); VBOX_UTF16_FREE(fromIPAddressUtf16); VBOX_UTF16_FREE(toIPAddressUtf16); if (errorOccurred) { goto cleanup; } } else { ipdef->nranges = 0; } ipdef->nhosts = 1; if (VIR_ALLOC_N(ipdef->hosts, ipdef->nhosts) >=0) { if (VIR_STRDUP(ipdef->hosts[0].name, network->name) < 0) { VIR_FREE(ipdef->hosts); ipdef->nhosts = 0; } else { PRUnichar *macAddressUtf16 = NULL; PRUnichar *ipAddressUtf16 = NULL; bool errorOccurred = false; networkInterface->vtbl->GetHardwareAddress(networkInterface, &macAddressUtf16); networkInterface->vtbl->GetIPAddress(networkInterface, &ipAddressUtf16); VBOX_UTF16_TO_UTF8(macAddressUtf16, &ipdef->hosts[0].mac); if (vboxSocketParseAddrUtf16(data, ipAddressUtf16, &ipdef->hosts[0].ip) < 0) { errorOccurred = true; } VBOX_UTF16_FREE(macAddressUtf16); VBOX_UTF16_FREE(ipAddressUtf16); if (errorOccurred) { goto cleanup; } } } else { ipdef->nhosts = 0; } VBOX_RELEASE(dhcpServer); } else { PRUnichar *networkMaskUtf16 = NULL; PRUnichar *ipAddressUtf16 = NULL; bool errorOccurred = false; networkInterface->vtbl->GetNetworkMask(networkInterface, &networkMaskUtf16); networkInterface->vtbl->GetIPAddress(networkInterface, &ipAddressUtf16); if (vboxSocketParseAddrUtf16(data, networkMaskUtf16, &ipdef->netmask) < 0 || vboxSocketParseAddrUtf16(data, ipAddressUtf16, &ipdef->address) < 0) { errorOccurred = true; } VBOX_UTF16_FREE(networkMaskUtf16); VBOX_UTF16_FREE(ipAddressUtf16); if (errorOccurred) { goto cleanup; } } DEBUGIID("Network UUID", vboxnet0IID.value); vboxIIDUnalloc(&vboxnet0IID); VBOX_UTF16_FREE(networkNameUtf16); } } VBOX_RELEASE(networkInterface); } VBOX_UTF16_FREE(networkInterfaceNameUtf16); VBOX_RELEASE(host); ret = virNetworkDefFormat(def, 0); cleanup: virNetworkDefFree(def); VIR_FREE(networkNameUtf8); return ret; } /** * The Storage Functions here on */ static virDrvOpenStatus vboxStorageOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED, unsigned int flags) { vboxGlobalData *data = conn->privateData; virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); if (STRNEQ(conn->driver->name, "VBOX")) return VIR_DRV_OPEN_DECLINED; if ((data->pFuncs == NULL) || (data->vboxObj == NULL) || (data->vboxSession == NULL)) return VIR_DRV_OPEN_ERROR; VIR_DEBUG("vbox storage initialized"); /* conn->storagePrivateData = some storage specific data */ return VIR_DRV_OPEN_SUCCESS; } static int vboxStorageClose(virConnectPtr conn) { VIR_DEBUG("vbox storage uninitialized"); conn->storagePrivateData = NULL; return 0; } static int vboxConnectNumOfStoragePools(virConnectPtr conn ATTRIBUTE_UNUSED) { /** Currently only one pool supported, the default one * given by ISystemProperties::defaultHardDiskFolder() */ return 1; } static int vboxConnectListStoragePools(virConnectPtr conn ATTRIBUTE_UNUSED, char **const names, int nnames) { int numActive = 0; if (nnames == 1 && VIR_STRDUP(names[numActive], "default-pool") > 0) numActive++; return numActive; } static virStoragePoolPtr vboxStoragePoolLookupByName(virConnectPtr conn, const char *name) { virStoragePoolPtr ret = NULL; /** Current limitation of the function: since * the default pool doesn't have UUID just assign * one till vbox can handle pools */ if (STREQ("default-pool", name)) { unsigned char uuid[VIR_UUID_BUFLEN]; const char *uuidstr = "1deff1ff-1481-464f-967f-a50fe8936cc4"; ignore_value(virUUIDParse(uuidstr, uuid)); ret = virGetStoragePool(conn, name, uuid, NULL, NULL); } return ret; } static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool) { VBOX_OBJECT_CHECK(pool->conn, int, -1); vboxArray hardDisks = VBOX_ARRAY_INITIALIZER; PRUint32 hardDiskAccessible = 0; nsresult rc; size_t i; rc = vboxArrayGet(&hardDisks, data->vboxObj, data->vboxObj->vtbl->GetHardDisks); if (NS_SUCCEEDED(rc)) { for (i = 0; i < hardDisks.count; ++i) { IHardDisk *hardDisk = hardDisks.items[i]; if (hardDisk) { PRUint32 hddstate; VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetState, &hddstate); if (hddstate != MediaState_Inaccessible) hardDiskAccessible++; } } vboxArrayRelease(&hardDisks); ret = hardDiskAccessible; } else { ret = -1; virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get number of volumes in the pool: %s, rc=%08x"), pool->name, (unsigned)rc); } return ret; } static int vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, int nnames) { VBOX_OBJECT_CHECK(pool->conn, int, -1); vboxArray hardDisks = VBOX_ARRAY_INITIALIZER; PRUint32 numActive = 0; nsresult rc; size_t i; rc = vboxArrayGet(&hardDisks, data->vboxObj, data->vboxObj->vtbl->GetHardDisks); if (NS_SUCCEEDED(rc)) { for (i = 0; i < hardDisks.count && numActive < nnames; ++i) { IHardDisk *hardDisk = hardDisks.items[i]; if (hardDisk) { PRUint32 hddstate; char *nameUtf8 = NULL; PRUnichar *nameUtf16 = NULL; VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetState, &hddstate); if (hddstate != MediaState_Inaccessible) { VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetName, &nameUtf16); VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8); VBOX_UTF16_FREE(nameUtf16); if (nameUtf8) { VIR_DEBUG("nnames[%d]: %s", numActive, nameUtf8); if (VIR_STRDUP(names[numActive], nameUtf8) > 0) numActive++; VBOX_UTF8_FREE(nameUtf8); } } } } vboxArrayRelease(&hardDisks); ret = numActive; } else { ret = -1; virReportError(VIR_ERR_INTERNAL_ERROR, _("could not get the volume list in the pool: %s, rc=%08x"), pool->name, (unsigned)rc); } return ret; } static virStorageVolPtr vboxStorageVolLookupByName(virStoragePoolPtr pool, const char *name) { VBOX_OBJECT_CHECK(pool->conn, virStorageVolPtr, NULL); vboxArray hardDisks = VBOX_ARRAY_INITIALIZER; nsresult rc; size_t i; if (!name) return ret; rc = vboxArrayGet(&hardDisks, data->vboxObj, data->vboxObj->vtbl->GetHardDisks); if (NS_SUCCEEDED(rc)) { for (i = 0; i < hardDisks.count; ++i) { IHardDisk *hardDisk = hardDisks.items[i]; if (hardDisk) { PRUint32 hddstate; char *nameUtf8 = NULL; PRUnichar *nameUtf16 = NULL; VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetState, &hddstate); if (hddstate != MediaState_Inaccessible) { VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetName, &nameUtf16); if (nameUtf16) { VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8); VBOX_UTF16_FREE(nameUtf16); } if (nameUtf8 && STREQ(nameUtf8, name)) { vboxIID hddIID = VBOX_IID_INITIALIZER; unsigned char uuid[VIR_UUID_BUFLEN]; char key[VIR_UUID_STRING_BUFLEN] = ""; rc = VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetId, &hddIID.value); if (NS_SUCCEEDED(rc)) { vboxIIDToUUID(&hddIID, uuid); virUUIDFormat(uuid, key); ret = virGetStorageVol(pool->conn, pool->name, name, key, NULL, NULL); VIR_DEBUG("virStorageVolPtr: %p", ret); VIR_DEBUG("Storage Volume Name: %s", name); VIR_DEBUG("Storage Volume key : %s", key); VIR_DEBUG("Storage Volume Pool: %s", pool->name); } vboxIIDUnalloc(&hddIID); VBOX_UTF8_FREE(nameUtf8); break; } VBOX_UTF8_FREE(nameUtf8); } } } vboxArrayRelease(&hardDisks); } return ret; } static virStorageVolPtr vboxStorageVolLookupByKey(virConnectPtr conn, const char *key) { VBOX_OBJECT_CHECK(conn, virStorageVolPtr, NULL); vboxIID hddIID = VBOX_IID_INITIALIZER; unsigned char uuid[VIR_UUID_BUFLEN]; IHardDisk *hardDisk = NULL; nsresult rc; if (!key) return ret; if (virUUIDParse(key, uuid) < 0) { virReportError(VIR_ERR_INVALID_ARG, _("Could not parse UUID from '%s'"), key); return NULL; } vboxIIDFromUUID(&hddIID, uuid); #if VBOX_API_VERSION < 4000 rc = data->vboxObj->vtbl->GetHardDisk(data->vboxObj, hddIID.value, &hardDisk); #elif VBOX_API_VERSION >= 4000 && VBOX_API_VERSION < 4002 rc = data->vboxObj->vtbl->FindMedium(data->vboxObj, hddIID.value, DeviceType_HardDisk, &hardDisk); #else rc = data->vboxObj->vtbl->OpenMedium(data->vboxObj, hddIID.value, DeviceType_HardDisk, AccessMode_ReadWrite, PR_FALSE, &hardDisk); #endif /* VBOX_API_VERSION >= 4000 */ if (NS_SUCCEEDED(rc)) { PRUint32 hddstate; VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetState, &hddstate); if (hddstate != MediaState_Inaccessible) { PRUnichar *hddNameUtf16 = NULL; char *hddNameUtf8 = NULL; VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetName, &hddNameUtf16); VBOX_UTF16_TO_UTF8(hddNameUtf16, &hddNameUtf8); if (hddNameUtf8) { if (vboxConnectNumOfStoragePools(conn) == 1) { ret = virGetStorageVol(conn, "default-pool", hddNameUtf8, key, NULL, NULL); VIR_DEBUG("Storage Volume Pool: %s", "default-pool"); } else { /* TODO: currently only one default pool and thus * nothing here, change it when pools are supported */ } VIR_DEBUG("Storage Volume Name: %s", key); VIR_DEBUG("Storage Volume key : %s", hddNameUtf8); VBOX_UTF8_FREE(hddNameUtf8); VBOX_UTF16_FREE(hddNameUtf16); } } VBOX_MEDIUM_RELEASE(hardDisk); } vboxIIDUnalloc(&hddIID); return ret; } static virStorageVolPtr vboxStorageVolLookupByPath(virConnectPtr conn, const char *path) { VBOX_OBJECT_CHECK(conn, virStorageVolPtr, NULL); PRUnichar *hddPathUtf16 = NULL; IHardDisk *hardDisk = NULL; nsresult rc; if (!path) return ret; VBOX_UTF8_TO_UTF16(path, &hddPathUtf16); if (!hddPathUtf16) return ret; #if VBOX_API_VERSION < 4000 rc = data->vboxObj->vtbl->FindHardDisk(data->vboxObj, hddPathUtf16, &hardDisk); #elif VBOX_API_VERSION >= 4000 && VBOX_API_VERSION < 4002 rc = data->vboxObj->vtbl->FindMedium(data->vboxObj, hddPathUtf16, DeviceType_HardDisk, &hardDisk); #else rc = data->vboxObj->vtbl->OpenMedium(data->vboxObj, hddPathUtf16, DeviceType_HardDisk, AccessMode_ReadWrite, PR_FALSE, &hardDisk); #endif /* VBOX_API_VERSION >= 4000 */ if (NS_SUCCEEDED(rc)) { PRUint32 hddstate; VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetState, &hddstate); if (hddstate != MediaState_Inaccessible) { PRUnichar *hddNameUtf16 = NULL; char *hddNameUtf8 = NULL; VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetName, &hddNameUtf16); if (hddNameUtf16) { VBOX_UTF16_TO_UTF8(hddNameUtf16, &hddNameUtf8); VBOX_UTF16_FREE(hddNameUtf16); } if (hddNameUtf8) { vboxIID hddIID = VBOX_IID_INITIALIZER; unsigned char uuid[VIR_UUID_BUFLEN]; char key[VIR_UUID_STRING_BUFLEN] = ""; rc = VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetId, &hddIID.value); if (NS_SUCCEEDED(rc)) { vboxIIDToUUID(&hddIID, uuid); virUUIDFormat(uuid, key); /* TODO: currently only one default pool and thus * the check below, change it when pools are supported */ if (vboxConnectNumOfStoragePools(conn) == 1) ret = virGetStorageVol(conn, "default-pool", hddNameUtf8, key, NULL, NULL); VIR_DEBUG("Storage Volume Pool: %s", "default-pool"); VIR_DEBUG("Storage Volume Name: %s", hddNameUtf8); VIR_DEBUG("Storage Volume key : %s", key); } vboxIIDUnalloc(&hddIID); } VBOX_UTF8_FREE(hddNameUtf8); } VBOX_MEDIUM_RELEASE(hardDisk); } VBOX_UTF16_FREE(hddPathUtf16); return ret; } static virStorageVolPtr vboxStorageVolCreateXML(virStoragePoolPtr pool, const char *xml, unsigned int flags) { VBOX_OBJECT_CHECK(pool->conn, virStorageVolPtr, NULL); virStorageVolDefPtr def = NULL; PRUnichar *hddFormatUtf16 = NULL; PRUnichar *hddNameUtf16 = NULL; virStoragePoolDef poolDef; nsresult rc; virCheckFlags(0, NULL); /* since there is currently one default pool now * and virStorageVolDefFormat() just checks it type * so just assign it for now, change the behaviour * when vbox supports pools. */ memset(&poolDef, 0, sizeof(poolDef)); poolDef.type = VIR_STORAGE_POOL_DIR; if ((def = virStorageVolDefParseString(&poolDef, xml)) == NULL) goto cleanup; if (!def->name || (def->type != VIR_STORAGE_VOL_FILE)) goto cleanup; /* TODO: for now only the vmdk, vpc and vdi type harddisk * variants can be created, also since there is no vdi * type in enum virStorageFileFormat {} the default * will be to create vdi if nothing is specified in * def->target.format */ if (def->target.format == VIR_STORAGE_FILE_VMDK) { VBOX_UTF8_TO_UTF16("VMDK", &hddFormatUtf16); } else if (def->target.format == VIR_STORAGE_FILE_VPC) { VBOX_UTF8_TO_UTF16("VHD", &hddFormatUtf16); } else { VBOX_UTF8_TO_UTF16("VDI", &hddFormatUtf16); } VBOX_UTF8_TO_UTF16(def->name, &hddNameUtf16); if (hddFormatUtf16 && hddNameUtf16) { IHardDisk *hardDisk = NULL; rc = data->vboxObj->vtbl->CreateHardDisk(data->vboxObj, hddFormatUtf16, hddNameUtf16, &hardDisk); if (NS_SUCCEEDED(rc)) { IProgress *progress = NULL; PRUint64 logicalSize = VIR_DIV_UP(def->capacity, 1024 * 1024); PRUint32 variant = HardDiskVariant_Standard; if (def->capacity == def->allocation) variant = HardDiskVariant_Fixed; #if VBOX_API_VERSION < 4003 rc = hardDisk->vtbl->CreateBaseStorage(hardDisk, logicalSize, variant, &progress); #else rc = hardDisk->vtbl->CreateBaseStorage(hardDisk, logicalSize, 1, &variant, &progress); #endif if (NS_SUCCEEDED(rc) && progress) { #if VBOX_API_VERSION == 2002 nsresult resultCode; #else PRInt32 resultCode; #endif progress->vtbl->WaitForCompletion(progress, -1); progress->vtbl->GetResultCode(progress, &resultCode); if (NS_SUCCEEDED(resultCode)) { vboxIID hddIID = VBOX_IID_INITIALIZER; unsigned char uuid[VIR_UUID_BUFLEN]; char key[VIR_UUID_STRING_BUFLEN] = ""; rc = VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetId, &hddIID.value); if (NS_SUCCEEDED(rc)) { vboxIIDToUUID(&hddIID, uuid); virUUIDFormat(uuid, key); ret = virGetStorageVol(pool->conn, pool->name, def->name, key, NULL, NULL); } vboxIIDUnalloc(&hddIID); } VBOX_RELEASE(progress); } } } VBOX_UTF16_FREE(hddFormatUtf16); VBOX_UTF16_FREE(hddNameUtf16); cleanup: virStorageVolDefFree(def); return ret; } static int vboxStorageVolDelete(virStorageVolPtr vol, unsigned int flags) { VBOX_OBJECT_CHECK(vol->conn, int, -1); vboxIID hddIID = VBOX_IID_INITIALIZER; unsigned char uuid[VIR_UUID_BUFLEN]; IHardDisk *hardDisk = NULL; int deregister = 0; nsresult rc; size_t i = 0; size_t j = 0; virCheckFlags(0, -1); if (virUUIDParse(vol->key, uuid) < 0) { virReportError(VIR_ERR_INVALID_ARG, _("Could not parse UUID from '%s'"), vol->key); return -1; } vboxIIDFromUUID(&hddIID, uuid); #if VBOX_API_VERSION < 4000 rc = data->vboxObj->vtbl->GetHardDisk(data->vboxObj, hddIID.value, &hardDisk); #elif VBOX_API_VERSION >= 4000 && VBOX_API_VERSION < 4002 rc = data->vboxObj->vtbl->FindMedium(data->vboxObj, hddIID.value, DeviceType_HardDisk, &hardDisk); #else rc = data->vboxObj->vtbl->OpenMedium(data->vboxObj, hddIID.value, DeviceType_HardDisk, AccessMode_ReadWrite, PR_FALSE, &hardDisk); #endif /* VBOX_API_VERSION >= 4000 */ if (NS_SUCCEEDED(rc)) { PRUint32 hddstate; VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetState, &hddstate); if (hddstate != MediaState_Inaccessible) { PRUint32 machineIdsSize = 0; vboxArray machineIds = VBOX_ARRAY_INITIALIZER; #if VBOX_API_VERSION < 3001 vboxArrayGet(&machineIds, hardDisk, hardDisk->vtbl->imedium.GetMachineIds); #else /* VBOX_API_VERSION >= 3001 */ vboxArrayGet(&machineIds, hardDisk, hardDisk->vtbl->GetMachineIds); #endif /* VBOX_API_VERSION >= 3001 */ #if VBOX_API_VERSION == 2002 && defined WIN32 /* VirtualBox 2.2 on Windows represents IIDs as GUIDs and the * machineIds array contains direct instances of the GUID struct * instead of pointers to the actual struct instances. But there * is no 128bit width simple item type for a SafeArray to fit a * GUID in. The largest simple type it 64bit width and VirtualBox * uses two of this 64bit items to represents one GUID. Therefore, * we divide the size of the SafeArray by two, to compensate for * this workaround in VirtualBox */ machineIds.count /= 2; #endif /* VBOX_API_VERSION >= 2002 */ machineIdsSize = machineIds.count; for (i = 0; i < machineIds.count; i++) { IMachine *machine = NULL; vboxIID machineId = VBOX_IID_INITIALIZER; vboxIIDFromArrayItem(&machineId, &machineIds, i); #if VBOX_API_VERSION >= 4000 rc = VBOX_OBJECT_GET_MACHINE(machineId.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); break; } #endif rc = VBOX_SESSION_OPEN(machineId.value, machine); if (NS_SUCCEEDED(rc)) { rc = data->vboxSession->vtbl->GetMachine(data->vboxSession, &machine); if (NS_SUCCEEDED(rc)) { vboxArray hddAttachments = VBOX_ARRAY_INITIALIZER; #if VBOX_API_VERSION < 3001 vboxArrayGet(&hddAttachments, machine, machine->vtbl->GetHardDiskAttachments); #else /* VBOX_API_VERSION >= 3001 */ vboxArrayGet(&hddAttachments, machine, machine->vtbl->GetMediumAttachments); #endif /* VBOX_API_VERSION >= 3001 */ for (j = 0; j < hddAttachments.count; j++) { IHardDiskAttachment *hddAttachment = hddAttachments.items[j]; if (hddAttachment) { IHardDisk *hdd = NULL; #if VBOX_API_VERSION < 3001 rc = hddAttachment->vtbl->GetHardDisk(hddAttachment, &hdd); #else /* VBOX_API_VERSION >= 3001 */ rc = hddAttachment->vtbl->GetMedium(hddAttachment, &hdd); #endif /* VBOX_API_VERSION >= 3001 */ if (NS_SUCCEEDED(rc) && hdd) { vboxIID iid = VBOX_IID_INITIALIZER; rc = VBOX_MEDIUM_FUNC_ARG1(hdd, GetId, &iid.value); if (NS_SUCCEEDED(rc)) { DEBUGIID("HardDisk (to delete) UUID", hddIID.value); DEBUGIID("HardDisk (currently processing) UUID", iid.value); if (vboxIIDIsEqual(&hddIID, &iid)) { PRUnichar *controller = NULL; PRInt32 port = 0; PRInt32 device = 0; DEBUGIID("Found HardDisk to delete, UUID", hddIID.value); hddAttachment->vtbl->GetController(hddAttachment, &controller); hddAttachment->vtbl->GetPort(hddAttachment, &port); hddAttachment->vtbl->GetDevice(hddAttachment, &device); #if VBOX_API_VERSION < 3001 rc = machine->vtbl->DetachHardDisk(machine, controller, port, device); #else /* VBOX_API_VERSION >= 3001 */ rc = machine->vtbl->DetachDevice(machine, controller, port, device); #endif /* VBOX_API_VERSION >= 3001 */ if (NS_SUCCEEDED(rc)) { rc = machine->vtbl->SaveSettings(machine); VIR_DEBUG("saving machine settings"); } if (NS_SUCCEEDED(rc)) { deregister++; VIR_DEBUG("deregistering hdd:%d", deregister); } VBOX_UTF16_FREE(controller); } vboxIIDUnalloc(&iid); } VBOX_MEDIUM_RELEASE(hdd); } } } vboxArrayRelease(&hddAttachments); VBOX_RELEASE(machine); } VBOX_SESSION_CLOSE(); } vboxIIDUnalloc(&machineId); } vboxArrayUnalloc(&machineIds); if (machineIdsSize == 0 || machineIdsSize == deregister) { IProgress *progress = NULL; rc = hardDisk->vtbl->DeleteStorage(hardDisk, &progress); if (NS_SUCCEEDED(rc) && progress) { progress->vtbl->WaitForCompletion(progress, -1); VBOX_RELEASE(progress); DEBUGIID("HardDisk deleted, UUID", hddIID.value); ret = 0; } } } VBOX_MEDIUM_RELEASE(hardDisk); } vboxIIDUnalloc(&hddIID); return ret; } static int vboxStorageVolGetInfo(virStorageVolPtr vol, virStorageVolInfoPtr info) { VBOX_OBJECT_CHECK(vol->conn, int, -1); IHardDisk *hardDisk = NULL; unsigned char uuid[VIR_UUID_BUFLEN]; vboxIID hddIID = VBOX_IID_INITIALIZER; nsresult rc; if (!info) return ret; if (virUUIDParse(vol->key, uuid) < 0) { virReportError(VIR_ERR_INVALID_ARG, _("Could not parse UUID from '%s'"), vol->key); return ret; } vboxIIDFromUUID(&hddIID, uuid); #if VBOX_API_VERSION < 4000 rc = data->vboxObj->vtbl->GetHardDisk(data->vboxObj, hddIID.value, &hardDisk); #elif VBOX_API_VERSION >= 4000 && VBOX_API_VERSION < 4002 rc = data->vboxObj->vtbl->FindMedium(data->vboxObj, hddIID.value, DeviceType_HardDisk, &hardDisk); #else rc = data->vboxObj->vtbl->OpenMedium(data->vboxObj, hddIID.value, DeviceType_HardDisk, AccessMode_ReadWrite, PR_FALSE, &hardDisk); #endif /* VBOX_API_VERSION >= 4000 */ if (NS_SUCCEEDED(rc)) { PRUint32 hddstate; VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetState, &hddstate); if (hddstate != MediaState_Inaccessible) { #if VBOX_API_VERSION < 4000 PRUint64 hddLogicalSize; PRUint64 hddActualSize; #else /* VBOX_API_VERSION >= 4000 */ PRInt64 hddLogicalSize; PRInt64 hddActualSize; #endif /* VBOX_API_VERSION >= 4000 */ info->type = VIR_STORAGE_VOL_FILE; hardDisk->vtbl->GetLogicalSize(hardDisk, &hddLogicalSize); #if VBOX_API_VERSION < 4000 info->capacity = hddLogicalSize * 1024 * 1024; /* MB => Bytes */ #else /* VBOX_API_VERSION >= 4000 */ info->capacity = hddLogicalSize; #endif /* VBOX_API_VERSION >= 4000 */ VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetSize, &hddActualSize); info->allocation = hddActualSize; ret = 0; VIR_DEBUG("Storage Volume Name: %s", vol->name); VIR_DEBUG("Storage Volume Type: %s", info->type == VIR_STORAGE_VOL_BLOCK ? "Block" : "File"); VIR_DEBUG("Storage Volume Capacity: %llu", info->capacity); VIR_DEBUG("Storage Volume Allocation: %llu", info->allocation); } VBOX_MEDIUM_RELEASE(hardDisk); } vboxIIDUnalloc(&hddIID); return ret; } static char *vboxStorageVolGetXMLDesc(virStorageVolPtr vol, unsigned int flags) { VBOX_OBJECT_CHECK(vol->conn, char *, NULL); IHardDisk *hardDisk = NULL; unsigned char uuid[VIR_UUID_BUFLEN]; vboxIID hddIID = VBOX_IID_INITIALIZER; virStoragePoolDef pool; virStorageVolDef def; int defOk = 0; nsresult rc; virCheckFlags(0, NULL); memset(&pool, 0, sizeof(pool)); memset(&def, 0, sizeof(def)); if (virUUIDParse(vol->key, uuid) < 0) { virReportError(VIR_ERR_INVALID_ARG, _("Could not parse UUID from '%s'"), vol->key); return ret; } vboxIIDFromUUID(&hddIID, uuid); #if VBOX_API_VERSION < 4000 rc = data->vboxObj->vtbl->GetHardDisk(data->vboxObj, hddIID.value, &hardDisk); #elif VBOX_API_VERSION >= 4000 && VBOX_API_VERSION < 4002 rc = data->vboxObj->vtbl->FindMedium(data->vboxObj, hddIID.value, DeviceType_HardDisk, &hardDisk); #else rc = data->vboxObj->vtbl->OpenMedium(data->vboxObj, hddIID.value, DeviceType_HardDisk, AccessMode_ReadWrite, PR_FALSE, &hardDisk); #endif /* VBOX_API_VERSION >= 4000 */ if (NS_SUCCEEDED(rc)) { PRUint32 hddstate; VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetState, &hddstate); if (NS_SUCCEEDED(rc) && hddstate != MediaState_Inaccessible) { PRUnichar *hddFormatUtf16 = NULL; #if VBOX_API_VERSION < 4000 PRUint64 hddLogicalSize; PRUint64 hddActualSize; #else /* VBOX_API_VERSION >= 4000 */ PRInt64 hddLogicalSize; PRInt64 hddActualSize; #endif /* VBOX_API_VERSION >= 4000 */ /* since there is currently one default pool now * and virStorageVolDefFormat() just checks it type * so just assign it for now, change the behaviour * when vbox supports pools. */ pool.type = VIR_STORAGE_POOL_DIR; def.type = VIR_STORAGE_VOL_FILE; defOk = 1; rc = hardDisk->vtbl->GetLogicalSize(hardDisk, &hddLogicalSize); if (NS_SUCCEEDED(rc) && defOk) { #if VBOX_API_VERSION < 4000 def.capacity = hddLogicalSize * 1024 * 1024; /* MB => Bytes */ #else /* VBOX_API_VERSION >= 4000 */ def.capacity = hddLogicalSize; #endif /* VBOX_API_VERSION >= 4000 */ } else defOk = 0; rc = VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetSize, &hddActualSize); if (NS_SUCCEEDED(rc) && defOk) def.allocation = hddActualSize; else defOk = 0; if (VIR_STRDUP(def.name, vol->name) < 0) defOk = 0; if (VIR_STRDUP(def.key, vol->key) < 0) defOk = 0; rc = hardDisk->vtbl->GetFormat(hardDisk, &hddFormatUtf16); if (NS_SUCCEEDED(rc) && defOk) { char *hddFormatUtf8 = NULL; VBOX_UTF16_TO_UTF8(hddFormatUtf16, &hddFormatUtf8); if (hddFormatUtf8) { VIR_DEBUG("Storage Volume Format: %s", hddFormatUtf8); if (STRCASEEQ("vmdk", hddFormatUtf8)) def.target.format = VIR_STORAGE_FILE_VMDK; else if (STRCASEEQ("vhd", hddFormatUtf8)) def.target.format = VIR_STORAGE_FILE_VPC; else def.target.format = VIR_STORAGE_FILE_RAW; /* TODO: need to add vdi to enum virStorageFileFormat {} * and then add it here */ VBOX_UTF8_FREE(hddFormatUtf8); } VBOX_UTF16_FREE(hddFormatUtf16); } else { defOk = 0; } } VBOX_MEDIUM_RELEASE(hardDisk); } vboxIIDUnalloc(&hddIID); if (defOk) ret = virStorageVolDefFormat(&pool, &def); return ret; } static char *vboxStorageVolGetPath(virStorageVolPtr vol) { VBOX_OBJECT_CHECK(vol->conn, char *, NULL); IHardDisk *hardDisk = NULL; unsigned char uuid[VIR_UUID_BUFLEN]; vboxIID hddIID = VBOX_IID_INITIALIZER; nsresult rc; if (virUUIDParse(vol->key, uuid) < 0) { virReportError(VIR_ERR_INVALID_ARG, _("Could not parse UUID from '%s'"), vol->key); return ret; } vboxIIDFromUUID(&hddIID, uuid); #if VBOX_API_VERSION < 4000 rc = data->vboxObj->vtbl->GetHardDisk(data->vboxObj, hddIID.value, &hardDisk); #elif VBOX_API_VERSION >= 4000 && VBOX_API_VERSION < 4002 rc = data->vboxObj->vtbl->FindMedium(data->vboxObj, hddIID.value, DeviceType_HardDisk, &hardDisk); #else rc = data->vboxObj->vtbl->OpenMedium(data->vboxObj, hddIID.value, DeviceType_HardDisk, AccessMode_ReadWrite, PR_FALSE, &hardDisk); #endif /* VBOX_API_VERSION >= 4000 */ if (NS_SUCCEEDED(rc)) { PRUint32 hddstate; VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetState, &hddstate); if (hddstate != MediaState_Inaccessible) { PRUnichar *hddLocationUtf16 = NULL; char *hddLocationUtf8 = NULL; VBOX_MEDIUM_FUNC_ARG1(hardDisk, GetLocation, &hddLocationUtf16); VBOX_UTF16_TO_UTF8(hddLocationUtf16, &hddLocationUtf8); if (hddLocationUtf8) { ignore_value(VIR_STRDUP(ret, hddLocationUtf8)); VIR_DEBUG("Storage Volume Name: %s", vol->name); VIR_DEBUG("Storage Volume Path: %s", hddLocationUtf8); VIR_DEBUG("Storage Volume Pool: %s", vol->pool); VBOX_UTF8_FREE(hddLocationUtf8); } VBOX_UTF16_FREE(hddLocationUtf16); } VBOX_MEDIUM_RELEASE(hardDisk); } vboxIIDUnalloc(&hddIID); return ret; } #if VBOX_API_VERSION >= 4000 static char * vboxDomainScreenshot(virDomainPtr dom, virStreamPtr st, unsigned int screen, unsigned int flags) { VBOX_OBJECT_CHECK(dom->conn, char *, NULL); IConsole *console = NULL; vboxIID iid = VBOX_IID_INITIALIZER; IMachine *machine = NULL; nsresult rc; char *tmp; int tmp_fd = -1; unsigned int max_screen; virCheckFlags(0, NULL); vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); return NULL; } rc = machine->vtbl->GetMonitorCount(machine, &max_screen); if (NS_FAILED(rc)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("unable to get monitor count")); VBOX_RELEASE(machine); return NULL; } if (screen >= max_screen) { virReportError(VIR_ERR_INVALID_ARG, _("screen ID higher than monitor " "count (%d)"), max_screen); VBOX_RELEASE(machine); return NULL; } if (virAsprintf(&tmp, "%s/cache/libvirt/vbox.screendump.XXXXXX", LOCALSTATEDIR) < 0) { VBOX_RELEASE(machine); return NULL; } if ((tmp_fd = mkostemp(tmp, O_CLOEXEC)) == -1) { virReportSystemError(errno, _("mkostemp(\"%s\") failed"), tmp); VIR_FREE(tmp); VBOX_RELEASE(machine); return NULL; } rc = VBOX_SESSION_OPEN_EXISTING(iid.value, machine); if (NS_SUCCEEDED(rc)) { rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (NS_SUCCEEDED(rc) && console) { IDisplay *display = NULL; console->vtbl->GetDisplay(console, &display); if (display) { PRUint32 width, height, bitsPerPixel; PRUint32 screenDataSize; PRUint8 *screenData; # if VBOX_API_VERSION >= 4003 PRInt32 xOrigin, yOrigin; # endif rc = display->vtbl->GetScreenResolution(display, screen, &width, &height, # if VBOX_API_VERSION < 4003 &bitsPerPixel); # else &bitsPerPixel, &xOrigin, &yOrigin); # endif if (NS_FAILED(rc) || !width || !height) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("unable to get screen resolution")); goto endjob; } rc = display->vtbl->TakeScreenShotPNGToArray(display, screen, width, height, &screenDataSize, &screenData); if (NS_FAILED(rc)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("failed to take screenshot")); goto endjob; } if (safewrite(tmp_fd, (char *) screenData, screenDataSize) < 0) { virReportSystemError(errno, _("unable to write data " "to '%s'"), tmp); goto endjob; } if (VIR_CLOSE(tmp_fd) < 0) { virReportSystemError(errno, _("unable to close %s"), tmp); goto endjob; } if (VIR_STRDUP(ret, "image/png") < 0) goto endjob; if (virFDStreamOpenFile(st, tmp, 0, 0, O_RDONLY) < 0) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("unable to open stream")); VIR_FREE(ret); } endjob: VIR_FREE(screenData); VBOX_RELEASE(display); } VBOX_RELEASE(console); } VBOX_SESSION_CLOSE(); } VIR_FORCE_CLOSE(tmp_fd); unlink(tmp); VIR_FREE(tmp); VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; } #endif /* VBOX_API_VERSION >= 4000 */ #define MATCH(FLAG) (flags & (FLAG)) static int vboxConnectListAllDomains(virConnectPtr conn, virDomainPtr **domains, unsigned int flags) { VBOX_OBJECT_CHECK(conn, int, -1); vboxArray machines = VBOX_ARRAY_INITIALIZER; char *machineNameUtf8 = NULL; PRUnichar *machineNameUtf16 = NULL; unsigned char uuid[VIR_UUID_BUFLEN]; vboxIID iid = VBOX_IID_INITIALIZER; PRUint32 state; nsresult rc; size_t i; virDomainPtr dom; virDomainPtr *doms = NULL; int count = 0; bool active; PRUint32 snapshotCount; virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1); /* filter out flag options that will produce 0 results in vbox driver: * - managed save: vbox guests don't have managed save images * - autostart: vbox doesn't support autostarting guests * - persistance: vbox doesn't support transient guests */ if ((MATCH(VIR_CONNECT_LIST_DOMAINS_TRANSIENT) && !MATCH(VIR_CONNECT_LIST_DOMAINS_PERSISTENT)) || (MATCH(VIR_CONNECT_LIST_DOMAINS_AUTOSTART) && !MATCH(VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART)) || (MATCH(VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE) && !MATCH(VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE))) { if (domains && VIR_ALLOC_N(*domains, 1) < 0) goto cleanup; ret = 0; goto cleanup; } rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get list of domains, rc=%08x"), (unsigned)rc); goto cleanup; } if (domains && VIR_ALLOC_N(doms, machines.count + 1) < 0) goto cleanup; for (i = 0; i < machines.count; i++) { IMachine *machine = machines.items[i]; if (machine) { PRBool isAccessible = PR_FALSE; machine->vtbl->GetAccessible(machine, &isAccessible); if (isAccessible) { machine->vtbl->GetState(machine, &state); if (state >= MachineState_FirstOnline && state <= MachineState_LastOnline) active = true; else active = false; /* filter by active state */ if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE) && !((MATCH(VIR_CONNECT_LIST_DOMAINS_ACTIVE) && active) || (MATCH(VIR_CONNECT_LIST_DOMAINS_INACTIVE) && !active))) continue; /* filter by snapshot existence */ if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_SNAPSHOT)) { rc = machine->vtbl->GetSnapshotCount(machine, &snapshotCount); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not get snapshot count for listed domains")); goto cleanup; } if (!((MATCH(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT) && snapshotCount > 0) || (MATCH(VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT) && snapshotCount == 0))) continue; } /* filter by machine state */ if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE) && !((MATCH(VIR_CONNECT_LIST_DOMAINS_RUNNING) && state == MachineState_Running) || (MATCH(VIR_CONNECT_LIST_DOMAINS_PAUSED) && state == MachineState_Paused) || (MATCH(VIR_CONNECT_LIST_DOMAINS_SHUTOFF) && state == MachineState_PoweredOff) || (MATCH(VIR_CONNECT_LIST_DOMAINS_OTHER) && (state != MachineState_Running && state != MachineState_Paused && state != MachineState_PoweredOff)))) continue; /* just count the machines */ if (!doms) { count++; continue; } machine->vtbl->GetName(machine, &machineNameUtf16); VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineNameUtf8); machine->vtbl->GetId(machine, &iid.value); vboxIIDToUUID(&iid, uuid); vboxIIDUnalloc(&iid); dom = virGetDomain(conn, machineNameUtf8, uuid); VBOX_UTF8_FREE(machineNameUtf8); VBOX_UTF16_FREE(machineNameUtf16); if (!dom) goto cleanup; if (active) dom->id = i + 1; doms[count++] = dom; } } } if (doms) { /* safe to ignore, new size will be equal or less than * previous allocation*/ ignore_value(VIR_REALLOC_N(doms, count + 1)); *domains = doms; doms = NULL; } ret = count; cleanup: if (doms) { for (i = 0; i < count; i++) { if (doms[i]) virDomainFree(doms[i]); } } VIR_FREE(doms); vboxArrayRelease(&machines); return ret; } #undef MATCH static int vboxNodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo) { return nodeGetInfo(nodeinfo); } static int vboxNodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED, unsigned long long *freeMems, int startCell, int maxCells) { return nodeGetCellsFreeMemory(freeMems, startCell, maxCells); } static unsigned long long vboxNodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED) { return nodeGetFreeMemory(); } /** * Function Tables */ virDriver NAME(Driver) = { .no = VIR_DRV_VBOX, .name = "VBOX", .connectOpen = vboxConnectOpen, /* 0.6.3 */ .connectClose = vboxConnectClose, /* 0.6.3 */ .connectGetVersion = vboxConnectGetVersion, /* 0.6.3 */ .connectGetHostname = vboxConnectGetHostname, /* 0.6.3 */ .connectGetMaxVcpus = vboxConnectGetMaxVcpus, /* 0.6.3 */ .nodeGetInfo = vboxNodeGetInfo, /* 0.6.3 */ .connectGetCapabilities = vboxConnectGetCapabilities, /* 0.6.3 */ .connectListDomains = vboxConnectListDomains, /* 0.6.3 */ .connectNumOfDomains = vboxConnectNumOfDomains, /* 0.6.3 */ .connectListAllDomains = vboxConnectListAllDomains, /* 0.9.13 */ .domainCreateXML = vboxDomainCreateXML, /* 0.6.3 */ .domainLookupByID = vboxDomainLookupByID, /* 0.6.3 */ .domainLookupByUUID = vboxDomainLookupByUUID, /* 0.6.3 */ .domainLookupByName = vboxDomainLookupByName, /* 0.6.3 */ .domainSuspend = vboxDomainSuspend, /* 0.6.3 */ .domainResume = vboxDomainResume, /* 0.6.3 */ .domainShutdown = vboxDomainShutdown, /* 0.6.3 */ .domainShutdownFlags = vboxDomainShutdownFlags, /* 0.9.10 */ .domainReboot = vboxDomainReboot, /* 0.6.3 */ .domainDestroy = vboxDomainDestroy, /* 0.6.3 */ .domainDestroyFlags = vboxDomainDestroyFlags, /* 0.9.4 */ .domainGetOSType = vboxDomainGetOSType, /* 0.6.3 */ .domainSetMemory = vboxDomainSetMemory, /* 0.6.3 */ .domainGetInfo = vboxDomainGetInfo, /* 0.6.3 */ .domainGetState = vboxDomainGetState, /* 0.9.2 */ .domainSave = vboxDomainSave, /* 0.6.3 */ .domainSetVcpus = vboxDomainSetVcpus, /* 0.7.1 */ .domainSetVcpusFlags = vboxDomainSetVcpusFlags, /* 0.8.5 */ .domainGetVcpusFlags = vboxDomainGetVcpusFlags, /* 0.8.5 */ .domainGetMaxVcpus = vboxDomainGetMaxVcpus, /* 0.7.1 */ .domainGetXMLDesc = vboxDomainGetXMLDesc, /* 0.6.3 */ .connectListDefinedDomains = vboxConnectListDefinedDomains, /* 0.6.3 */ .connectNumOfDefinedDomains = vboxConnectNumOfDefinedDomains, /* 0.6.3 */ .domainCreate = vboxDomainCreate, /* 0.6.3 */ .domainCreateWithFlags = vboxDomainCreateWithFlags, /* 0.8.2 */ .domainDefineXML = vboxDomainDefineXML, /* 0.6.3 */ .domainUndefine = vboxDomainUndefine, /* 0.6.3 */ .domainUndefineFlags = vboxDomainUndefineFlags, /* 0.9.5 */ .domainAttachDevice = vboxDomainAttachDevice, /* 0.6.3 */ .domainAttachDeviceFlags = vboxDomainAttachDeviceFlags, /* 0.7.7 */ .domainDetachDevice = vboxDomainDetachDevice, /* 0.6.3 */ .domainDetachDeviceFlags = vboxDomainDetachDeviceFlags, /* 0.7.7 */ .domainUpdateDeviceFlags = vboxDomainUpdateDeviceFlags, /* 0.8.0 */ .nodeGetCellsFreeMemory = vboxNodeGetCellsFreeMemory, /* 0.6.5 */ .nodeGetFreeMemory = vboxNodeGetFreeMemory, /* 0.6.5 */ #if VBOX_API_VERSION >= 4000 .domainScreenshot = vboxDomainScreenshot, /* 0.9.2 */ #endif #if VBOX_API_VERSION > 2002 && VBOX_API_VERSION < 4000 .connectDomainEventRegister = vboxConnectDomainEventRegister, /* 0.7.0 */ .connectDomainEventDeregister = vboxConnectDomainEventDeregister, /* 0.7.0 */ #endif .connectIsEncrypted = vboxConnectIsEncrypted, /* 0.7.3 */ .connectIsSecure = vboxConnectIsSecure, /* 0.7.3 */ .domainIsActive = vboxDomainIsActive, /* 0.7.3 */ .domainIsPersistent = vboxDomainIsPersistent, /* 0.7.3 */ .domainIsUpdated = vboxDomainIsUpdated, /* 0.8.6 */ #if VBOX_API_VERSION > 2002 && VBOX_API_VERSION < 4000 .connectDomainEventRegisterAny = vboxConnectDomainEventRegisterAny, /* 0.8.0 */ .connectDomainEventDeregisterAny = vboxConnectDomainEventDeregisterAny, /* 0.8.0 */ #endif .domainSnapshotCreateXML = vboxDomainSnapshotCreateXML, /* 0.8.0 */ .domainSnapshotGetXMLDesc = vboxDomainSnapshotGetXMLDesc, /* 0.8.0 */ .domainSnapshotNum = vboxDomainSnapshotNum, /* 0.8.0 */ .domainSnapshotListNames = vboxDomainSnapshotListNames, /* 0.8.0 */ .domainSnapshotLookupByName = vboxDomainSnapshotLookupByName, /* 0.8.0 */ .domainHasCurrentSnapshot = vboxDomainHasCurrentSnapshot, /* 0.8.0 */ .domainSnapshotGetParent = vboxDomainSnapshotGetParent, /* 0.9.7 */ .domainSnapshotCurrent = vboxDomainSnapshotCurrent, /* 0.8.0 */ .domainSnapshotIsCurrent = vboxDomainSnapshotIsCurrent, /* 0.9.13 */ .domainSnapshotHasMetadata = vboxDomainSnapshotHasMetadata, /* 0.9.13 */ .domainRevertToSnapshot = vboxDomainRevertToSnapshot, /* 0.8.0 */ .domainSnapshotDelete = vboxDomainSnapshotDelete, /* 0.8.0 */ .connectIsAlive = vboxConnectIsAlive, /* 0.9.8 */ }; virNetworkDriver NAME(NetworkDriver) = { "VBOX", .networkOpen = vboxNetworkOpen, /* 0.6.4 */ .networkClose = vboxNetworkClose, /* 0.6.4 */ .connectNumOfNetworks = vboxConnectNumOfNetworks, /* 0.6.4 */ .connectListNetworks = vboxConnectListNetworks, /* 0.6.4 */ .connectNumOfDefinedNetworks = vboxConnectNumOfDefinedNetworks, /* 0.6.4 */ .connectListDefinedNetworks = vboxConnectListDefinedNetworks, /* 0.6.4 */ .networkLookupByUUID = vboxNetworkLookupByUUID, /* 0.6.4 */ .networkLookupByName = vboxNetworkLookupByName, /* 0.6.4 */ .networkCreateXML = vboxNetworkCreateXML, /* 0.6.4 */ .networkDefineXML = vboxNetworkDefineXML, /* 0.6.4 */ .networkUndefine = vboxNetworkUndefine, /* 0.6.4 */ .networkCreate = vboxNetworkCreate, /* 0.6.4 */ .networkDestroy = vboxNetworkDestroy, /* 0.6.4 */ .networkGetXMLDesc = vboxNetworkGetXMLDesc, /* 0.6.4 */ }; virStorageDriver NAME(StorageDriver) = { .name = "VBOX", .storageOpen = vboxStorageOpen, /* 0.7.1 */ .storageClose = vboxStorageClose, /* 0.7.1 */ .connectNumOfStoragePools = vboxConnectNumOfStoragePools, /* 0.7.1 */ .connectListStoragePools = vboxConnectListStoragePools, /* 0.7.1 */ .storagePoolLookupByName = vboxStoragePoolLookupByName, /* 0.7.1 */ .storagePoolNumOfVolumes = vboxStoragePoolNumOfVolumes, /* 0.7.1 */ .storagePoolListVolumes = vboxStoragePoolListVolumes, /* 0.7.1 */ .storageVolLookupByName = vboxStorageVolLookupByName, /* 0.7.1 */ .storageVolLookupByKey = vboxStorageVolLookupByKey, /* 0.7.1 */ .storageVolLookupByPath = vboxStorageVolLookupByPath, /* 0.7.1 */ .storageVolCreateXML = vboxStorageVolCreateXML, /* 0.7.1 */ .storageVolDelete = vboxStorageVolDelete, /* 0.7.1 */ .storageVolGetInfo = vboxStorageVolGetInfo, /* 0.7.1 */ .storageVolGetXMLDesc = vboxStorageVolGetXMLDesc, /* 0.7.1 */ .storageVolGetPath = vboxStorageVolGetPath /* 0.7.1 */ };
lgpl-2.1
britto/agendatech
app/models/notifier.rb
246
class Notifier < ActionMailer::Base default :from => "contato@agendatech.com.br", :to => ["andersonlfl@gmail.com", "alots.ssa@gmail.com"] def envia_email(contato) @contato = contato mail(:subject => "Contato agendatech") end end
lgpl-2.1